blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2363bcc7080f2c7540520f7bbd8ecec9c925a834 | [
"if x == 0:\n return 0\ny = ''\nrev = 0\na = str(x)\nlength = len(a)\nfor i in range(length):\n index = length - 1 - i\n if not y and a[index] == '0':\n continue\n y += a[index]\nif y[-1] == '-':\n rev = -int(y[0:-1])\n if rev < self.MIN:\n return 0\n return rev\nrev = int(y)\nif ... | <|body_start_0|>
if x == 0:
return 0
y = ''
rev = 0
a = str(x)
length = len(a)
for i in range(length):
index = length - 1 - i
if not y and a[index] == '0':
continue
y += a[index]
if y[-1] == '-':
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverse(self, x: int) -> int:
"""时间复杂度 O(logn) 空间复杂度 O(1) 执行用时 : 44 ms, 在Reverse Integer的Python3提交中击败了99.13% 的用户 内存消耗 : 13.1 MB, 在Reverse Integer的Python3提交中击败了94.93% 的用户"""
<|body_0|>
def reverse1(self, x: int) -> int:
"""弹出和推入数字 时间复杂度 O(logn) 空间复杂度 O(1... | stack_v2_sparse_classes_75kplus_train_069000 | 3,494 | no_license | [
{
"docstring": "时间复杂度 O(logn) 空间复杂度 O(1) 执行用时 : 44 ms, 在Reverse Integer的Python3提交中击败了99.13% 的用户 内存消耗 : 13.1 MB, 在Reverse Integer的Python3提交中击败了94.93% 的用户",
"name": "reverse",
"signature": "def reverse(self, x: int) -> int"
},
{
"docstring": "弹出和推入数字 时间复杂度 O(logn) 空间复杂度 O(1) 执行用时 : 48 ms, 在Reverse... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverse(self, x: int) -> int: 时间复杂度 O(logn) 空间复杂度 O(1) 执行用时 : 44 ms, 在Reverse Integer的Python3提交中击败了99.13% 的用户 内存消耗 : 13.1 MB, 在Reverse Integer的Python3提交中击败了94.93% 的用户
- def r... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverse(self, x: int) -> int: 时间复杂度 O(logn) 空间复杂度 O(1) 执行用时 : 44 ms, 在Reverse Integer的Python3提交中击败了99.13% 的用户 内存消耗 : 13.1 MB, 在Reverse Integer的Python3提交中击败了94.93% 的用户
- def r... | 7bca9dc8ec211be15c12f89bffbb680d639f87bf | <|skeleton|>
class Solution:
def reverse(self, x: int) -> int:
"""时间复杂度 O(logn) 空间复杂度 O(1) 执行用时 : 44 ms, 在Reverse Integer的Python3提交中击败了99.13% 的用户 内存消耗 : 13.1 MB, 在Reverse Integer的Python3提交中击败了94.93% 的用户"""
<|body_0|>
def reverse1(self, x: int) -> int:
"""弹出和推入数字 时间复杂度 O(logn) 空间复杂度 O(1... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def reverse(self, x: int) -> int:
"""时间复杂度 O(logn) 空间复杂度 O(1) 执行用时 : 44 ms, 在Reverse Integer的Python3提交中击败了99.13% 的用户 内存消耗 : 13.1 MB, 在Reverse Integer的Python3提交中击败了94.93% 的用户"""
if x == 0:
return 0
y = ''
rev = 0
a = str(x)
length = len(a)
... | the_stack_v2_python_sparse | python/leetcode/7-reverse-integer.py | wxnacy/study | train | 18 | |
8681cb0b4cd9d3f7f8086d0d85e51ce706a202f5 | [
"if req_format not in ('json', 'xml', ''):\n raise ValueError(\"Unknown data format '%s'\" % req_format)\nif api_version is 1:\n if domain == 'api.twitter.com' or domain == 'stream.twitter.com':\n api_version = '1'\n else:\n api_version = None\ndomain += '/%s' % api_version\nAPICall.__init__(... | <|body_start_0|>
if req_format not in ('json', 'xml', ''):
raise ValueError("Unknown data format '%s'" % req_format)
if api_version is 1:
if domain == 'api.twitter.com' or domain == 'stream.twitter.com':
api_version = '1'
else:
api_vers... | The minimalist yet fully featured Twitter API class. Get RESTful data by accessing members of this class. The result is decoded python objects (lists and dicts). >>> from frappy.services.twitter.twitter import Twitter >>> t = Twitter() >>> statuses = t.statuses.public_timeline() >>> '200 OK' == statuses.headers['respon... | Twitter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Twitter:
"""The minimalist yet fully featured Twitter API class. Get RESTful data by accessing members of this class. The result is decoded python objects (lists and dicts). >>> from frappy.services.twitter.twitter import Twitter >>> t = Twitter() >>> statuses = t.statuses.public_timeline() >>> '... | stack_v2_sparse_classes_75kplus_train_069001 | 4,423 | permissive | [
{
"docstring": "Create a new twitter API connector. Pass an `auth` parameter to use the credentials of a specific user. Generally you'll want to pass an `OAuth` instance:: twitter = Twitter(auth=OAuth( token, token_secret, consumer_key, consumer_secret)) `domain` lets you change the domain you are connecting. B... | 2 | stack_v2_sparse_classes_30k_train_050997 | Implement the Python class `Twitter` described below.
Class description:
The minimalist yet fully featured Twitter API class. Get RESTful data by accessing members of this class. The result is decoded python objects (lists and dicts). >>> from frappy.services.twitter.twitter import Twitter >>> t = Twitter() >>> status... | Implement the Python class `Twitter` described below.
Class description:
The minimalist yet fully featured Twitter API class. Get RESTful data by accessing members of this class. The result is decoded python objects (lists and dicts). >>> from frappy.services.twitter.twitter import Twitter >>> t = Twitter() >>> status... | 543e8d1d6162d1414d05ac60a31c20e223de008d | <|skeleton|>
class Twitter:
"""The minimalist yet fully featured Twitter API class. Get RESTful data by accessing members of this class. The result is decoded python objects (lists and dicts). >>> from frappy.services.twitter.twitter import Twitter >>> t = Twitter() >>> statuses = t.statuses.public_timeline() >>> '... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Twitter:
"""The minimalist yet fully featured Twitter API class. Get RESTful data by accessing members of this class. The result is decoded python objects (lists and dicts). >>> from frappy.services.twitter.twitter import Twitter >>> t = Twitter() >>> statuses = t.statuses.public_timeline() >>> '200 OK' == st... | the_stack_v2_python_sparse | frappy/services/twitter/twitter.py | durden/frappy | train | 8 |
ce61433aae77614924edb9e9fb3c5d0cbc54b55b | [
"self.text = text\nself.token_counts = FreqDist(normalized_tokens(text))\nself.id = id",
"with open(filename, 'r') as myfile:\n text = myfile.read().strip()\nreturn cls(text, filename)"
] | <|body_start_0|>
self.text = text
self.token_counts = FreqDist(normalized_tokens(text))
self.id = id
<|end_body_0|>
<|body_start_1|>
with open(filename, 'r') as myfile:
text = myfile.read().strip()
return cls(text, filename)
<|end_body_1|>
| TextDocument | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TextDocument:
def __init__(self, text, id=None):
"""The constructor for TextDocument class. This creates a TextDocument instance with a string, a dictionary and an identifier. Parameters: text (string): a string. token_counts : a dictionary id : an identifier."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_069002 | 5,876 | no_license | [
{
"docstring": "The constructor for TextDocument class. This creates a TextDocument instance with a string, a dictionary and an identifier. Parameters: text (string): a string. token_counts : a dictionary id : an identifier.",
"name": "__init__",
"signature": "def __init__(self, text, id=None)"
},
{... | 2 | stack_v2_sparse_classes_30k_train_040954 | Implement the Python class `TextDocument` described below.
Class description:
Implement the TextDocument class.
Method signatures and docstrings:
- def __init__(self, text, id=None): The constructor for TextDocument class. This creates a TextDocument instance with a string, a dictionary and an identifier. Parameters:... | Implement the Python class `TextDocument` described below.
Class description:
Implement the TextDocument class.
Method signatures and docstrings:
- def __init__(self, text, id=None): The constructor for TextDocument class. This creates a TextDocument instance with a string, a dictionary and an identifier. Parameters:... | 784f0dd1222e5f89c3594e07dbc91856bb86d2c4 | <|skeleton|>
class TextDocument:
def __init__(self, text, id=None):
"""The constructor for TextDocument class. This creates a TextDocument instance with a string, a dictionary and an identifier. Parameters: text (string): a string. token_counts : a dictionary id : an identifier."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TextDocument:
def __init__(self, text, id=None):
"""The constructor for TextDocument class. This creates a TextDocument instance with a string, a dictionary and an identifier. Parameters: text (string): a string. token_counts : a dictionary id : an identifier."""
self.text = text
self.... | the_stack_v2_python_sparse | src/hw04_text_search/text_vectors.py | hoangantran1109/Symbolic-programming-language | train | 0 | |
8fb5a43d62a71f37897c85d06fbbac499f1cc59d | [
"yield\nif call.when == 'call':\n item.excinfo = call.excinfo",
"case_logger = CaseLoggerExecutor(env_main)\nrequest.addfinalizer(case_logger.suite_teardown)\nreturn case_logger",
"suitelogger.node = request.node\nsuitelogger.suite_name = request.node.module.__name__\nrequest.addfinalizer(suitelogger.case_te... | <|body_start_0|>
yield
if call.when == 'call':
item.excinfo = call.excinfo
<|end_body_0|>
<|body_start_1|>
case_logger = CaseLoggerExecutor(env_main)
request.addfinalizer(case_logger.suite_teardown)
return case_logger
<|end_body_1|>
<|body_start_2|>
suitelog... | Base class for caselogger plugin functionality. | CaseLoggerPlugin | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CaseLoggerPlugin:
"""Base class for caselogger plugin functionality."""
def pytest_runtest_makereport(self, item, call):
"""Add information about test case execution results."""
<|body_0|>
def suitelogger(self, request, env_main):
"""Call caselogger on test suite... | stack_v2_sparse_classes_75kplus_train_069003 | 6,681 | permissive | [
{
"docstring": "Add information about test case execution results.",
"name": "pytest_runtest_makereport",
"signature": "def pytest_runtest_makereport(self, item, call)"
},
{
"docstring": "Call caselogger on test suite teardown. Args: request(pytest.request): pytest request instance env_main (tes... | 3 | stack_v2_sparse_classes_30k_train_017627 | Implement the Python class `CaseLoggerPlugin` described below.
Class description:
Base class for caselogger plugin functionality.
Method signatures and docstrings:
- def pytest_runtest_makereport(self, item, call): Add information about test case execution results.
- def suitelogger(self, request, env_main): Call cas... | Implement the Python class `CaseLoggerPlugin` described below.
Class description:
Base class for caselogger plugin functionality.
Method signatures and docstrings:
- def pytest_runtest_makereport(self, item, call): Add information about test case execution results.
- def suitelogger(self, request, env_main): Call cas... | 2007bf3fe66edfe704e485141c55caed54fe13aa | <|skeleton|>
class CaseLoggerPlugin:
"""Base class for caselogger plugin functionality."""
def pytest_runtest_makereport(self, item, call):
"""Add information about test case execution results."""
<|body_0|>
def suitelogger(self, request, env_main):
"""Call caselogger on test suite... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CaseLoggerPlugin:
"""Base class for caselogger plugin functionality."""
def pytest_runtest_makereport(self, item, call):
"""Add information about test case execution results."""
yield
if call.when == 'call':
item.excinfo = call.excinfo
def suitelogger(self, reques... | the_stack_v2_python_sparse | taf/plugins/pytest_caselogger.py | AndriyZabavskyy/taf | train | 0 |
d4bf699b1c35923d517e60ffe8c56b1cfda77d26 | [
"exif_data = {}\ninfo = getattr(image, '_getexif', lambda: None)()\nif info:\n for tag, value in info.items():\n decoded = TAGS.get(tag, tag)\n if decoded == 'GPSInfo':\n gps_data = {}\n for t in value:\n sub_decoded = GPSTAGS.get(t, t)\n gps_data... | <|body_start_0|>
exif_data = {}
info = getattr(image, '_getexif', lambda: None)()
if info:
for tag, value in info.items():
decoded = TAGS.get(tag, tag)
if decoded == 'GPSInfo':
gps_data = {}
for t in value:
... | Encapsulates EXIF extraction methods to be used on a Pillow Image object. | ExifUtilities | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExifUtilities:
"""Encapsulates EXIF extraction methods to be used on a Pillow Image object."""
def get_exif_data(image: Image) -> dict:
"""Extracts and decodes EXIF data from a Pillow Image object and exposes in dictionary form. :param image: Pillow Image. Image to be manipulated. :r... | stack_v2_sparse_classes_75kplus_train_069004 | 4,025 | no_license | [
{
"docstring": "Extracts and decodes EXIF data from a Pillow Image object and exposes in dictionary form. :param image: Pillow Image. Image to be manipulated. :return: dictionary. Decoded EXIF data.",
"name": "get_exif_data",
"signature": "def get_exif_data(image: Image) -> dict"
},
{
"docstring... | 4 | null | Implement the Python class `ExifUtilities` described below.
Class description:
Encapsulates EXIF extraction methods to be used on a Pillow Image object.
Method signatures and docstrings:
- def get_exif_data(image: Image) -> dict: Extracts and decodes EXIF data from a Pillow Image object and exposes in dictionary form... | Implement the Python class `ExifUtilities` described below.
Class description:
Encapsulates EXIF extraction methods to be used on a Pillow Image object.
Method signatures and docstrings:
- def get_exif_data(image: Image) -> dict: Extracts and decodes EXIF data from a Pillow Image object and exposes in dictionary form... | 8f1b94518303c4e0a38df1ff6caa0e7326451d67 | <|skeleton|>
class ExifUtilities:
"""Encapsulates EXIF extraction methods to be used on a Pillow Image object."""
def get_exif_data(image: Image) -> dict:
"""Extracts and decodes EXIF data from a Pillow Image object and exposes in dictionary form. :param image: Pillow Image. Image to be manipulated. :r... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExifUtilities:
"""Encapsulates EXIF extraction methods to be used on a Pillow Image object."""
def get_exif_data(image: Image) -> dict:
"""Extracts and decodes EXIF data from a Pillow Image object and exposes in dictionary form. :param image: Pillow Image. Image to be manipulated. :return: dictio... | the_stack_v2_python_sparse | Serverless/handlers/http_add_picture/exif_utilities.py | RogerVFbr/MyCelebs | train | 0 |
a6510d990c9bbe7220b3a627f0266e3b0ab8f31c | [
"params = {}\nif filters:\n params.update(filters)\nbase_url = '/stacks/%s' % stack_name\nif not resource_name:\n url = base_url + '/%s/events' % stack_id\nelse:\n url = base_url + '/%s/resources/%s/events' % (stack_id, resource_name)\nif params:\n url += '?%s' % parse.urlencode(params, True)\nif respon... | <|body_start_0|>
params = {}
if filters:
params.update(filters)
base_url = '/stacks/%s' % stack_name
if not resource_name:
url = base_url + '/%s/events' % stack_id
else:
url = base_url + '/%s/resources/%s/events' % (stack_id, resource_name)
... | EventManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventManager:
def list(self, stack_name, stack_id, resource_name=None, response_key=True, filters={}, **kwargs):
"""Get a list of events. :param stack_id: ID of stack the events belong to :param resource_name: Optional name of resources to filter events by :rtype: list of :class:`Event`"... | stack_v2_sparse_classes_75kplus_train_069005 | 1,621 | no_license | [
{
"docstring": "Get a list of events. :param stack_id: ID of stack the events belong to :param resource_name: Optional name of resources to filter events by :rtype: list of :class:`Event`",
"name": "list",
"signature": "def list(self, stack_name, stack_id, resource_name=None, response_key=True, filters=... | 2 | null | Implement the Python class `EventManager` described below.
Class description:
Implement the EventManager class.
Method signatures and docstrings:
- def list(self, stack_name, stack_id, resource_name=None, response_key=True, filters={}, **kwargs): Get a list of events. :param stack_id: ID of stack the events belong to... | Implement the Python class `EventManager` described below.
Class description:
Implement the EventManager class.
Method signatures and docstrings:
- def list(self, stack_name, stack_id, resource_name=None, response_key=True, filters={}, **kwargs): Get a list of events. :param stack_id: ID of stack the events belong to... | 42f9197ba26ffb6b9dd336a524639ecbbf194365 | <|skeleton|>
class EventManager:
def list(self, stack_name, stack_id, resource_name=None, response_key=True, filters={}, **kwargs):
"""Get a list of events. :param stack_id: ID of stack the events belong to :param resource_name: Optional name of resources to filter events by :rtype: list of :class:`Event`"... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EventManager:
def list(self, stack_name, stack_id, resource_name=None, response_key=True, filters={}, **kwargs):
"""Get a list of events. :param stack_id: ID of stack the events belong to :param resource_name: Optional name of resources to filter events by :rtype: list of :class:`Event`"""
par... | the_stack_v2_python_sparse | ops_client/project/heat/events.py | tokuzfunpi/ops_client | train | 0 | |
fb5038717d052abdd949889fa600360489cee659 | [
"super(GNBlock, self).__init__()\nself.edge_update = edge_update\nself.node_update = node_update\nself.global_update = global_update\nself.e2v_merge = e2v_merge\nself.e2u_merge = e2u_merge\nself.v2u_merge = v2u_merge",
"edge_in = torch.cat([graphs.edges, graphs.receiver_nodes, graphs.sender_nodes, graphs.expanded... | <|body_start_0|>
super(GNBlock, self).__init__()
self.edge_update = edge_update
self.node_update = node_update
self.global_update = global_update
self.e2v_merge = e2v_merge
self.e2u_merge = e2u_merge
self.v2u_merge = v2u_merge
<|end_body_0|>
<|body_start_1|>
... | Full GN Block, with all 3 update and aggregation functions reference: https://arxiv.org/pdf/1806.01261.pdf reference2: https://github.com/deepmind/graph_nets/tree/master/graph_nets | GNBlock | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GNBlock:
"""Full GN Block, with all 3 update and aggregation functions reference: https://arxiv.org/pdf/1806.01261.pdf reference2: https://github.com/deepmind/graph_nets/tree/master/graph_nets"""
def __init__(self, edge_update, node_update, global_update, e2v_merge, e2u_merge, v2u_merge):
... | stack_v2_sparse_classes_75kplus_train_069006 | 27,097 | permissive | [
{
"docstring": "Inputs: (parameterizable functions/nn.Modules)",
"name": "__init__",
"signature": "def __init__(self, edge_update, node_update, global_update, e2v_merge, e2u_merge, v2u_merge)"
},
{
"docstring": "run edge update step",
"name": "edge_block",
"signature": "def edge_block(se... | 5 | stack_v2_sparse_classes_30k_train_021514 | Implement the Python class `GNBlock` described below.
Class description:
Full GN Block, with all 3 update and aggregation functions reference: https://arxiv.org/pdf/1806.01261.pdf reference2: https://github.com/deepmind/graph_nets/tree/master/graph_nets
Method signatures and docstrings:
- def __init__(self, edge_upda... | Implement the Python class `GNBlock` described below.
Class description:
Full GN Block, with all 3 update and aggregation functions reference: https://arxiv.org/pdf/1806.01261.pdf reference2: https://github.com/deepmind/graph_nets/tree/master/graph_nets
Method signatures and docstrings:
- def __init__(self, edge_upda... | eb013bb3bab269bda8a8075e64fe3bcd2964d8ae | <|skeleton|>
class GNBlock:
"""Full GN Block, with all 3 update and aggregation functions reference: https://arxiv.org/pdf/1806.01261.pdf reference2: https://github.com/deepmind/graph_nets/tree/master/graph_nets"""
def __init__(self, edge_update, node_update, global_update, e2v_merge, e2u_merge, v2u_merge):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GNBlock:
"""Full GN Block, with all 3 update and aggregation functions reference: https://arxiv.org/pdf/1806.01261.pdf reference2: https://github.com/deepmind/graph_nets/tree/master/graph_nets"""
def __init__(self, edge_update, node_update, global_update, e2v_merge, e2u_merge, v2u_merge):
"""Inpu... | the_stack_v2_python_sparse | marl/utils/networks.py | zhangtjtongxue/learn-to-interact | train | 0 |
3f2145064fc2d94f4926c546949ab120923204f5 | [
"try:\n with open(os.path.join(os.path.dirname(__file__), 'mtexposdata.json')) as fp:\n self.data = json.load(fp)\nexcept FileNotFoundError:\n raise FileNotFoundError('File mtexposdata.json was not found!')",
"feats = dict()\ntry:\n block = self.data[tag[0]]\n feats['name'] = block['upos']\n ... | <|body_start_0|>
try:
with open(os.path.join(os.path.dirname(__file__), 'mtexposdata.json')) as fp:
self.data = json.load(fp)
except FileNotFoundError:
raise FileNotFoundError('File mtexposdata.json was not found!')
<|end_body_0|>
<|body_start_1|>
feats =... | MTEParser | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MTEParser:
def __init__(self):
"""Open and parse mtexposdata.json file. Raises: FileNotFoundError: The file mtexposdata.json data is not exists. PermissionError: You're not allowed to access to mtexposdata.json file."""
<|body_0|>
def parse(self, tag: str):
"""Return... | stack_v2_sparse_classes_75kplus_train_069007 | 3,507 | permissive | [
{
"docstring": "Open and parse mtexposdata.json file. Raises: FileNotFoundError: The file mtexposdata.json data is not exists. PermissionError: You're not allowed to access to mtexposdata.json file.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Returns features of th... | 3 | stack_v2_sparse_classes_30k_train_039720 | Implement the Python class `MTEParser` described below.
Class description:
Implement the MTEParser class.
Method signatures and docstrings:
- def __init__(self): Open and parse mtexposdata.json file. Raises: FileNotFoundError: The file mtexposdata.json data is not exists. PermissionError: You're not allowed to access... | Implement the Python class `MTEParser` described below.
Class description:
Implement the MTEParser class.
Method signatures and docstrings:
- def __init__(self): Open and parse mtexposdata.json file. Raises: FileNotFoundError: The file mtexposdata.json data is not exists. PermissionError: You're not allowed to access... | 97eb739f52e76d9ed184cf55fcd9001c2fca2cff | <|skeleton|>
class MTEParser:
def __init__(self):
"""Open and parse mtexposdata.json file. Raises: FileNotFoundError: The file mtexposdata.json data is not exists. PermissionError: You're not allowed to access to mtexposdata.json file."""
<|body_0|>
def parse(self, tag: str):
"""Return... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MTEParser:
def __init__(self):
"""Open and parse mtexposdata.json file. Raises: FileNotFoundError: The file mtexposdata.json data is not exists. PermissionError: You're not allowed to access to mtexposdata.json file."""
try:
with open(os.path.join(os.path.dirname(__file__), 'mtexpo... | the_stack_v2_python_sparse | pysyntext/libs/ud/mte.py | syntpump/syntext-py-ua | train | 2 | |
cd92f5fde1004eedf8c960c0a6754bbc7aa4cd9c | [
"self.w2v_model = KeyedVectors.load(w2v_path)\nself.data = self.load_data(data_path)\nif model_path and os.path.exists(model_path):\n self.index = self.load_hnsw(model_path)\nelif data_path:\n self.index = self.build_hnsw(model_path, ef=ef, m=M)\nelse:\n logging.error('No existing model and no building dat... | <|body_start_0|>
self.w2v_model = KeyedVectors.load(w2v_path)
self.data = self.load_data(data_path)
if model_path and os.path.exists(model_path):
self.index = self.load_hnsw(model_path)
elif data_path:
self.index = self.build_hnsw(model_path, ef=ef, m=M)
e... | HNSW | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HNSW:
def __init__(self, w2v_path, ef=config.ef_construction, M=config.M, model_path=None, data_path=config.train_path):
"""Args: w2v_path (str): saved gensim word2vec model path. ef (int, optional): maximum size of dynamic list for HNSW, higher is more accurate and slower to construct. ... | stack_v2_sparse_classes_75kplus_train_069008 | 5,361 | no_license | [
{
"docstring": "Args: w2v_path (str): saved gensim word2vec model path. ef (int, optional): maximum size of dynamic list for HNSW, higher is more accurate and slower to construct. M (int, optional): maximum number of outgoing connections in the HNSW graph. model_path (str optional): HNSW model path to load or s... | 6 | stack_v2_sparse_classes_30k_train_023182 | Implement the Python class `HNSW` described below.
Class description:
Implement the HNSW class.
Method signatures and docstrings:
- def __init__(self, w2v_path, ef=config.ef_construction, M=config.M, model_path=None, data_path=config.train_path): Args: w2v_path (str): saved gensim word2vec model path. ef (int, option... | Implement the Python class `HNSW` described below.
Class description:
Implement the HNSW class.
Method signatures and docstrings:
- def __init__(self, w2v_path, ef=config.ef_construction, M=config.M, model_path=None, data_path=config.train_path): Args: w2v_path (str): saved gensim word2vec model path. ef (int, option... | df8aee60cd57ff02ca4b372e264d923b6b3e9cf5 | <|skeleton|>
class HNSW:
def __init__(self, w2v_path, ef=config.ef_construction, M=config.M, model_path=None, data_path=config.train_path):
"""Args: w2v_path (str): saved gensim word2vec model path. ef (int, optional): maximum size of dynamic list for HNSW, higher is more accurate and slower to construct. ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HNSW:
def __init__(self, w2v_path, ef=config.ef_construction, M=config.M, model_path=None, data_path=config.train_path):
"""Args: w2v_path (str): saved gensim word2vec model path. ef (int, optional): maximum size of dynamic list for HNSW, higher is more accurate and slower to construct. M (int, option... | the_stack_v2_python_sparse | 检索对话系统/retrieval/hnsw_faiss.py | SongyuanLi1996/Jeremy | train | 0 | |
a45b53526e266e37d14d480d8b891d8a847fa6b0 | [
"from collections import defaultdict\nself.table = defaultdict(int)\nself.counter = 0",
"self.counter += 1\nl = len(word)\nfor i, char in enumerate(word):\n self.table[l, i, char] |= 1 << self.counter\n self.table[l, i, '.'] |= 1 << self.counter",
"res = None\nl = len(word)\nfor i, char in enumerate(word)... | <|body_start_0|>
from collections import defaultdict
self.table = defaultdict(int)
self.counter = 0
<|end_body_0|>
<|body_start_1|>
self.counter += 1
l = len(word)
for i, char in enumerate(word):
self.table[l, i, char] |= 1 << self.counter
self.ta... | WordDictionary | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordDictionary:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def addWord(self, word):
"""Adds a word into the data structure. :type word: str :rtype: void"""
<|body_1|>
def search(self, word):
"""Returns if the word i... | stack_v2_sparse_classes_75kplus_train_069009 | 1,066 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Adds a word into the data structure. :type word: str :rtype: void",
"name": "addWord",
"signature": "def addWord(self, word)"
},
{
"docstring": "Returns... | 3 | stack_v2_sparse_classes_30k_train_004306 | Implement the Python class `WordDictionary` described below.
Class description:
Implement the WordDictionary class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def addWord(self, word): Adds a word into the data structure. :type word: str :rtype: void
- def search(sel... | Implement the Python class `WordDictionary` described below.
Class description:
Implement the WordDictionary class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def addWord(self, word): Adds a word into the data structure. :type word: str :rtype: void
- def search(sel... | 86ec13f47506a2495ab6b6bbb58d4e8b2a21538b | <|skeleton|>
class WordDictionary:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def addWord(self, word):
"""Adds a word into the data structure. :type word: str :rtype: void"""
<|body_1|>
def search(self, word):
"""Returns if the word i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WordDictionary:
def __init__(self):
"""Initialize your data structure here."""
from collections import defaultdict
self.table = defaultdict(int)
self.counter = 0
def addWord(self, word):
"""Adds a word into the data structure. :type word: str :rtype: void"""
... | the_stack_v2_python_sparse | leetcode/facebook/l300.py | tariqrahiman/pyComPro | train | 0 | |
b7c4fbbe23289c994fb4b39e6221c768ca404539 | [
"parameters = dict()\nparameters['page'] = GraphQLParam(page, 'PageInput', False)\nparameters['filter'] = GraphQLParam(volume_filter, 'VolumeFilter', False)\nparameters['sort'] = GraphQLParam(sort, 'VolumeSort', False)\nresponse = self._query(name='getVolumes', params=parameters, fields=VolumeList.fields())\nreturn... | <|body_start_0|>
parameters = dict()
parameters['page'] = GraphQLParam(page, 'PageInput', False)
parameters['filter'] = GraphQLParam(volume_filter, 'VolumeFilter', False)
parameters['sort'] = GraphQLParam(sort, 'VolumeSort', False)
response = self._query(name='getVolumes', params... | Mixin to add volume related methods to the GraphQL client | VolumeMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VolumeMixin:
"""Mixin to add volume related methods to the GraphQL client"""
def get_volumes(self, page: PageInput=None, volume_filter: VolumeFilter=None, sort: VolumeSort=None) -> VolumeList:
"""Retrieves a list of volumes :param page: The requested page from the server. This is an ... | stack_v2_sparse_classes_75kplus_train_069010 | 28,875 | permissive | [
{
"docstring": "Retrieves a list of volumes :param page: The requested page from the server. This is an optional argument and if omitted the server will default to returning the first page with a maximum of ``100`` items. :type page: PageInput, optional :param volume_filter: A filter object to filter the volume... | 4 | stack_v2_sparse_classes_30k_train_004716 | Implement the Python class `VolumeMixin` described below.
Class description:
Mixin to add volume related methods to the GraphQL client
Method signatures and docstrings:
- def get_volumes(self, page: PageInput=None, volume_filter: VolumeFilter=None, sort: VolumeSort=None) -> VolumeList: Retrieves a list of volumes :pa... | Implement the Python class `VolumeMixin` described below.
Class description:
Mixin to add volume related methods to the GraphQL client
Method signatures and docstrings:
- def get_volumes(self, page: PageInput=None, volume_filter: VolumeFilter=None, sort: VolumeSort=None) -> VolumeList: Retrieves a list of volumes :pa... | 8ea044096bd18aaccbfb81eca4e26ec29895a18c | <|skeleton|>
class VolumeMixin:
"""Mixin to add volume related methods to the GraphQL client"""
def get_volumes(self, page: PageInput=None, volume_filter: VolumeFilter=None, sort: VolumeSort=None) -> VolumeList:
"""Retrieves a list of volumes :param page: The requested page from the server. This is an ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VolumeMixin:
"""Mixin to add volume related methods to the GraphQL client"""
def get_volumes(self, page: PageInput=None, volume_filter: VolumeFilter=None, sort: VolumeSort=None) -> VolumeList:
"""Retrieves a list of volumes :param page: The requested page from the server. This is an optional argu... | the_stack_v2_python_sparse | nebpyclient/api/volumes.py | firefly707/nebpyclient | train | 0 |
f0461d7d5b52fbe23487c28ed79ef3da93001fd4 | [
"c = Client()\nresp = c.get('/react-example/')\nself.assertIn(b'<div id=\"react_container\"></div>', resp.content)\nself.assertIn(b'<script crossorigin src=\"https://unpkg.com/react@16/umd/react.development.js\"></script>', resp.content)\nself.assertIn(b'<script crossorigin src=\"https://unpkg.com/react-dom@16/umd/... | <|body_start_0|>
c = Client()
resp = c.get('/react-example/')
self.assertIn(b'<div id="react_container"></div>', resp.content)
self.assertIn(b'<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>', resp.content)
self.assertIn(b'<script crossorig... | Exercise2Test | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Exercise2Test:
def test_view_and_template(self):
"""Test that the view, URLs and template are set up properly by checking the contents of the response."""
<|body_0|>
def test_js_content(self):
"""Test that some expected things are in the JS file."""
<|body_1|... | stack_v2_sparse_classes_75kplus_train_069011 | 1,730 | permissive | [
{
"docstring": "Test that the view, URLs and template are set up properly by checking the contents of the response.",
"name": "test_view_and_template",
"signature": "def test_view_and_template(self)"
},
{
"docstring": "Test that some expected things are in the JS file.",
"name": "test_js_con... | 2 | stack_v2_sparse_classes_30k_test_002442 | Implement the Python class `Exercise2Test` described below.
Class description:
Implement the Exercise2Test class.
Method signatures and docstrings:
- def test_view_and_template(self): Test that the view, URLs and template are set up properly by checking the contents of the response.
- def test_js_content(self): Test ... | Implement the Python class `Exercise2Test` described below.
Class description:
Implement the Exercise2Test class.
Method signatures and docstrings:
- def test_view_and_template(self): Test that the view, URLs and template are set up properly by checking the contents of the response.
- def test_js_content(self): Test ... | 52e86a8f93cb38bf70d50e9b8d2c6d7dac416f62 | <|skeleton|>
class Exercise2Test:
def test_view_and_template(self):
"""Test that the view, URLs and template are set up properly by checking the contents of the response."""
<|body_0|>
def test_js_content(self):
"""Test that some expected things are in the JS file."""
<|body_1|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Exercise2Test:
def test_view_and_template(self):
"""Test that the view, URLs and template are set up properly by checking the contents of the response."""
c = Client()
resp = c.get('/react-example/')
self.assertIn(b'<div id="react_container"></div>', resp.content)
self.... | the_stack_v2_python_sparse | Chapter16/Exercise16.02/bookr/reviews/tests.py | lmoshood/The-Django-Workshop | train | 0 | |
c6ca08765c9a4de633916902e384d1b66479a6bb | [
"if self.isEmpty():\n self._head = self._Item(k, v)\n self._tail = self._head\n return\nitem = self._Item(k, v)\nwalk = self._head\nwhile walk.getNext():\n if walk.getNext().getVal() >= item.getVal():\n break\n walk = walk.getNext()\nitem.setNext(walk.getNext())\nwalk.setNext(item)",
"item =... | <|body_start_0|>
if self.isEmpty():
self._head = self._Item(k, v)
self._tail = self._head
return
item = self._Item(k, v)
walk = self._head
while walk.getNext():
if walk.getNext().getVal() >= item.getVal():
break
... | A min-oriented priority queue implemented with an unsorted list | SortedPriorityQueue | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SortedPriorityQueue:
"""A min-oriented priority queue implemented with an unsorted list"""
def add(self, k, v):
"""Add a key-value pair (unsorted order)"""
<|body_0|>
def min_(self):
"""Return but do not remove (k,v) tuple with minimun key"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_069012 | 4,764 | no_license | [
{
"docstring": "Add a key-value pair (unsorted order)",
"name": "add",
"signature": "def add(self, k, v)"
},
{
"docstring": "Return but do not remove (k,v) tuple with minimun key",
"name": "min_",
"signature": "def min_(self)"
},
{
"docstring": "Remove and return (k,v) tuple with... | 3 | stack_v2_sparse_classes_30k_test_000200 | Implement the Python class `SortedPriorityQueue` described below.
Class description:
A min-oriented priority queue implemented with an unsorted list
Method signatures and docstrings:
- def add(self, k, v): Add a key-value pair (unsorted order)
- def min_(self): Return but do not remove (k,v) tuple with minimun key
- ... | Implement the Python class `SortedPriorityQueue` described below.
Class description:
A min-oriented priority queue implemented with an unsorted list
Method signatures and docstrings:
- def add(self, k, v): Add a key-value pair (unsorted order)
- def min_(self): Return but do not remove (k,v) tuple with minimun key
- ... | 783daaca7c9b716f080df43c7aa581add3b86a46 | <|skeleton|>
class SortedPriorityQueue:
"""A min-oriented priority queue implemented with an unsorted list"""
def add(self, k, v):
"""Add a key-value pair (unsorted order)"""
<|body_0|>
def min_(self):
"""Return but do not remove (k,v) tuple with minimun key"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SortedPriorityQueue:
"""A min-oriented priority queue implemented with an unsorted list"""
def add(self, k, v):
"""Add a key-value pair (unsorted order)"""
if self.isEmpty():
self._head = self._Item(k, v)
self._tail = self._head
return
item = se... | the_stack_v2_python_sparse | labs/P-QueueBase.py | pithecuse527/Algorithms-MUN | train | 4 |
5a48304f499ede37fd6566713c351806ebb8f96a | [
"size = int(request.GET.get('size', 15))\npage = int(request.GET.get('page', 0))\npats_list = patient_svc.get_infolist()\ntotalelements = len(pats_list)\nif totalelements == 0:\n return ResponseDto(success=False, message='数据库无数据')\ntotalpages = int(math.ceil(float(totalelements) / float(size)))\ntotalpatients = ... | <|body_start_0|>
size = int(request.GET.get('size', 15))
page = int(request.GET.get('page', 0))
pats_list = patient_svc.get_infolist()
totalelements = len(pats_list)
if totalelements == 0:
return ResponseDto(success=False, message='数据库无数据')
totalpages = int(ma... | Patient | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Patient:
def get(self, request):
"""provide patients information list :param size:the number of data on the current page :param page:current page :return: information list"""
<|body_0|>
def delete(self, request):
"""provide patients information list :param size:the n... | stack_v2_sparse_classes_75kplus_train_069013 | 2,554 | no_license | [
{
"docstring": "provide patients information list :param size:the number of data on the current page :param page:current page :return: information list",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "provide patients information list :param size:the number of data on th... | 2 | stack_v2_sparse_classes_30k_train_049327 | Implement the Python class `Patient` described below.
Class description:
Implement the Patient class.
Method signatures and docstrings:
- def get(self, request): provide patients information list :param size:the number of data on the current page :param page:current page :return: information list
- def delete(self, r... | Implement the Python class `Patient` described below.
Class description:
Implement the Patient class.
Method signatures and docstrings:
- def get(self, request): provide patients information list :param size:the number of data on the current page :param page:current page :return: information list
- def delete(self, r... | d3206f29d37735b5cc393744faaa55295fe7d6b1 | <|skeleton|>
class Patient:
def get(self, request):
"""provide patients information list :param size:the number of data on the current page :param page:current page :return: information list"""
<|body_0|>
def delete(self, request):
"""provide patients information list :param size:the n... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Patient:
def get(self, request):
"""provide patients information list :param size:the number of data on the current page :param page:current page :return: information list"""
size = int(request.GET.get('size', 15))
page = int(request.GET.get('page', 0))
pats_list = patient_svc.... | the_stack_v2_python_sparse | back_end/apps/patient/views.py | yongweili1/portal | train | 0 | |
0cd21ed8d514bda491505700f1212be9820440d0 | [
"io.logger.debug('FarFieldIntensity forward 1')\nwave_shifted = wave.ifftshift((3, 4))\nwave_farfield = wave_shifted.fft2_()\nctx.wave_farfield = wave_farfield\nctx.gradient_mask = gradient_mask\nI_model = th.cuda.FloatTensor(wave.size())\nwave_farfield.expect(out=I_model)\nfor dim in range(1, I_model.ndimension() ... | <|body_start_0|>
io.logger.debug('FarFieldIntensity forward 1')
wave_shifted = wave.ifftshift((3, 4))
wave_farfield = wave_shifted.fft2_()
ctx.wave_farfield = wave_farfield
ctx.gradient_mask = gradient_mask
I_model = th.cuda.FloatTensor(wave.size())
wave_farfield.... | FarFieldIntensity | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FarFieldIntensity:
def forward(ctx, wave, dpos, gradient_mask):
"""Parameters ---------- wave : dimension: K, N_p, N_o, M1, M2 dpos : dimension: (2, K, NP, NO, Mx, My) complex tensor Returns ------- I_model : dimension: K, M1, M2 float tensor diffraction intensities"""
<|body_0|>... | stack_v2_sparse_classes_75kplus_train_069014 | 2,721 | permissive | [
{
"docstring": "Parameters ---------- wave : dimension: K, N_p, N_o, M1, M2 dpos : dimension: (2, K, NP, NO, Mx, My) complex tensor Returns ------- I_model : dimension: K, M1, M2 float tensor diffraction intensities",
"name": "forward",
"signature": "def forward(ctx, wave, dpos, gradient_mask)"
},
{... | 2 | stack_v2_sparse_classes_30k_train_041229 | Implement the Python class `FarFieldIntensity` described below.
Class description:
Implement the FarFieldIntensity class.
Method signatures and docstrings:
- def forward(ctx, wave, dpos, gradient_mask): Parameters ---------- wave : dimension: K, N_p, N_o, M1, M2 dpos : dimension: (2, K, NP, NO, Mx, My) complex tensor... | Implement the Python class `FarFieldIntensity` described below.
Class description:
Implement the FarFieldIntensity class.
Method signatures and docstrings:
- def forward(ctx, wave, dpos, gradient_mask): Parameters ---------- wave : dimension: K, N_p, N_o, M1, M2 dpos : dimension: (2, K, NP, NO, Mx, My) complex tensor... | 50833b13160b6afe0a743d63d560bddeee2c18b5 | <|skeleton|>
class FarFieldIntensity:
def forward(ctx, wave, dpos, gradient_mask):
"""Parameters ---------- wave : dimension: K, N_p, N_o, M1, M2 dpos : dimension: (2, K, NP, NO, Mx, My) complex tensor Returns ------- I_model : dimension: K, M1, M2 float tensor diffraction intensities"""
<|body_0|>... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FarFieldIntensity:
def forward(ctx, wave, dpos, gradient_mask):
"""Parameters ---------- wave : dimension: K, N_p, N_o, M1, M2 dpos : dimension: (2, K, NP, NO, Mx, My) complex tensor Returns ------- I_model : dimension: K, M1, M2 float tensor diffraction intensities"""
io.logger.debug('FarFiel... | the_stack_v2_python_sparse | skpr/nn/_functions/FarfieldIntensity.py | 1034776739/scikit-pr-open | train | 0 | |
e1262deca0d3f63d0a94a656765dbd59dc3057ef | [
"super(SingleHierarchy, self).__init__()\nself.level = h_level\ninput_dim, embed_dim, graph_dim = dimensions\nk_local, k_graph = k\nself.local_embedder = PointNetEmbedder(input_dim, embed_dim, k=k_local)\nself.graph_embedder = GraphEmbedder(embed_dim, graph_dim, k=k_graph)\nclassifier_dimensions = dimensions[-1:] +... | <|body_start_0|>
super(SingleHierarchy, self).__init__()
self.level = h_level
input_dim, embed_dim, graph_dim = dimensions
k_local, k_graph = k
self.local_embedder = PointNetEmbedder(input_dim, embed_dim, k=k_local)
self.graph_embedder = GraphEmbedder(embed_dim, graph_dim... | SingleHierarchy | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SingleHierarchy:
def __init__(self, h_level, dimensions, k, classifier_dimensions=None):
"""Init function"""
<|body_0|>
def forward(self, raw_features, edge_vectors):
"""Forward operation of single hierarchy Parameters ---------- positions_batch : Tensor [BxNx3]. Bat... | stack_v2_sparse_classes_75kplus_train_069015 | 10,368 | no_license | [
{
"docstring": "Init function",
"name": "__init__",
"signature": "def __init__(self, h_level, dimensions, k, classifier_dimensions=None)"
},
{
"docstring": "Forward operation of single hierarchy Parameters ---------- positions_batch : Tensor [BxNx3]. Batch of tensors containing positions of node... | 2 | stack_v2_sparse_classes_30k_test_001191 | Implement the Python class `SingleHierarchy` described below.
Class description:
Implement the SingleHierarchy class.
Method signatures and docstrings:
- def __init__(self, h_level, dimensions, k, classifier_dimensions=None): Init function
- def forward(self, raw_features, edge_vectors): Forward operation of single h... | Implement the Python class `SingleHierarchy` described below.
Class description:
Implement the SingleHierarchy class.
Method signatures and docstrings:
- def __init__(self, h_level, dimensions, k, classifier_dimensions=None): Init function
- def forward(self, raw_features, edge_vectors): Forward operation of single h... | 908b2bd2c0f8cf3924135e01fcdfc91f2fc086c7 | <|skeleton|>
class SingleHierarchy:
def __init__(self, h_level, dimensions, k, classifier_dimensions=None):
"""Init function"""
<|body_0|>
def forward(self, raw_features, edge_vectors):
"""Forward operation of single hierarchy Parameters ---------- positions_batch : Tensor [BxNx3]. Bat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SingleHierarchy:
def __init__(self, h_level, dimensions, k, classifier_dimensions=None):
"""Init function"""
super(SingleHierarchy, self).__init__()
self.level = h_level
input_dim, embed_dim, graph_dim = dimensions
k_local, k_graph = k
self.local_embedder = Poin... | the_stack_v2_python_sparse | models/hgcn.py | bkakilli/3d-segmentation | train | 0 | |
830ffb6ba6ceda29adf368e8eb80a52080918b26 | [
"print('Loading warblr')\nt = time.time()\nif not os.path.isdir(path + 'warblr'):\n print('\\tCreating Directory')\n os.mkdir(path + 'warblr')\nif not os.path.exists(path + 'warblr/warblrb10k_public_wav.zip'):\n url = 'https://archive.org/download/warblrb10k_public/warblrb10k_public_wav.zip'\n urllib.re... | <|body_start_0|>
print('Loading warblr')
t = time.time()
if not os.path.isdir(path + 'warblr'):
print('\tCreating Directory')
os.mkdir(path + 'warblr')
if not os.path.exists(path + 'warblr/warblrb10k_public_wav.zip'):
url = 'https://archive.org/downloa... | Binary audio classification, presence or absence of a bird. `Warblr <http://machine-listening.eecs.qmul.ac.uk/bird-audio-detection-challenge/#downloads>`_ comes from a UK bird-sound crowdsourcing research spinout called Warblr. From this initiative we have 10,000 ten-second smartphone audio recordings from around the U... | warblr | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class warblr:
"""Binary audio classification, presence or absence of a bird. `Warblr <http://machine-listening.eecs.qmul.ac.uk/bird-audio-detection-challenge/#downloads>`_ comes from a UK bird-sound crowdsourcing research spinout called Warblr. From this initiative we have 10,000 ten-second smartphone ... | stack_v2_sparse_classes_75kplus_train_069016 | 2,892 | permissive | [
{
"docstring": "Download the data",
"name": "download",
"signature": "def download(path)"
},
{
"docstring": "Load the data given a path",
"name": "load",
"signature": "def load(path=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_050283 | Implement the Python class `warblr` described below.
Class description:
Binary audio classification, presence or absence of a bird. `Warblr <http://machine-listening.eecs.qmul.ac.uk/bird-audio-detection-challenge/#downloads>`_ comes from a UK bird-sound crowdsourcing research spinout called Warblr. From this initiativ... | Implement the Python class `warblr` described below.
Class description:
Binary audio classification, presence or absence of a bird. `Warblr <http://machine-listening.eecs.qmul.ac.uk/bird-audio-detection-challenge/#downloads>`_ comes from a UK bird-sound crowdsourcing research spinout called Warblr. From this initiativ... | d8778c2eb3254b478cef4f45d934bf921e695619 | <|skeleton|>
class warblr:
"""Binary audio classification, presence or absence of a bird. `Warblr <http://machine-listening.eecs.qmul.ac.uk/bird-audio-detection-challenge/#downloads>`_ comes from a UK bird-sound crowdsourcing research spinout called Warblr. From this initiative we have 10,000 ten-second smartphone ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class warblr:
"""Binary audio classification, presence or absence of a bird. `Warblr <http://machine-listening.eecs.qmul.ac.uk/bird-audio-detection-challenge/#downloads>`_ comes from a UK bird-sound crowdsourcing research spinout called Warblr. From this initiative we have 10,000 ten-second smartphone audio recordi... | the_stack_v2_python_sparse | symjax/data/warblr.py | SymJAX/SymJAX | train | 52 |
d6e9111cb6bfd2fde2d505d1e39eb19b75099e35 | [
"def helper(root, res):\n if not root:\n res.append('#')\n return\n res.append(str(root.val))\n helper(root.left, res)\n helper(root.right, res)\nres = []\nhelper(root, res)\nwhile res and res[-1] == '#':\n res.pop()\nreturn ','.join(res)",
"if not input_value:\n return None\nvalue... | <|body_start_0|>
def helper(root, res):
if not root:
res.append('#')
return
res.append(str(root.val))
helper(root.left, res)
helper(root.right, res)
res = []
helper(root, res)
while res and res[-1] == '#':
... | 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, input_value):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_75kplus_train_069017 | 1,345 | 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_015615 | 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, input_value): Decodes your encoded data to tree. :type data: str ... | 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, input_value): Decodes your encoded data to tree. :type data: str ... | 0250c3764b6e68dfe339afe8ee047e16c45db4e0 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, input_value):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def helper(root, res):
if not root:
res.append('#')
return
res.append(str(root.val))
helper(root.left, res)
... | the_stack_v2_python_sparse | Python/LC297_SerializeAndDeserializeTree.py | wondershow/CodingTraining | train | 0 | |
6ed48615e9255011ec0f1db018864ebb26fc3012 | [
"query_params = request.query_params.copy()\nordering_query_params = query_params.getlist(self.ordering_param, [])\n__ordering_params = []\nfor query_param in ordering_query_params:\n __key = query_param.lstrip('-')\n __direction = '-' if query_param.startswith('-') else ''\n if __key in view.ordering_fiel... | <|body_start_0|>
query_params = request.query_params.copy()
ordering_query_params = query_params.getlist(self.ordering_param, [])
__ordering_params = []
for query_param in ordering_query_params:
__key = query_param.lstrip('-')
__direction = '-' if query_param.star... | Ordering filter backend for Elasticsearch. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch_dsl_drf.views import BaseDocumentViewSet >>> >>> # Local article document definition >>> from .documents import ArticleDocument >>> >>> # Local... | OrderingFilterBackend | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrderingFilterBackend:
"""Ordering filter backend for Elasticsearch. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch_dsl_drf.views import BaseDocumentViewSet >>> >>> # Local article document definition >>> from ... | stack_v2_sparse_classes_75kplus_train_069018 | 8,440 | no_license | [
{
"docstring": "Get ordering query params. :param request: Django REST framework request. :param view: View. :type request: rest_framework.request.Request :type view: rest_framework.viewsets.ReadOnlyModelViewSet :return: Ordering params to be used for ordering. :rtype: list",
"name": "get_ordering_query_par... | 2 | stack_v2_sparse_classes_30k_val_001650 | Implement the Python class `OrderingFilterBackend` described below.
Class description:
Ordering filter backend for Elasticsearch. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch_dsl_drf.views import BaseDocumentViewSet >>> >>> # Loca... | Implement the Python class `OrderingFilterBackend` described below.
Class description:
Ordering filter backend for Elasticsearch. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch_dsl_drf.views import BaseDocumentViewSet >>> >>> # Loca... | 51d04b4fd0c201b543fde9c3c94d2dab6e7eee50 | <|skeleton|>
class OrderingFilterBackend:
"""Ordering filter backend for Elasticsearch. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch_dsl_drf.views import BaseDocumentViewSet >>> >>> # Local article document definition >>> from ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OrderingFilterBackend:
"""Ordering filter backend for Elasticsearch. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch_dsl_drf.views import BaseDocumentViewSet >>> >>> # Local article document definition >>> from .documents im... | the_stack_v2_python_sparse | book_es/src/django_elasticsearch_dsl_drf/filter_backends/ordering/common.py | kabrice/book-django | train | 1 |
0e23729a0b717e5d4401017098a58d28d27fbcec | [
"column = self.defaultcolumn if column is None else column\nidx0, idx1 = self.indices\nret = pd.DataFrame(_symmetric_to_square(self[idx0].values, self[idx1].values, self[column.values]))\nret.index.name = idx0\nret.columns.name = idx1\nreturn ret",
"column = 'coef' if column is None else column\nidx0, idx1 = cls(... | <|body_start_0|>
column = self.defaultcolumn if column is None else column
idx0, idx1 = self.indices
ret = pd.DataFrame(_symmetric_to_square(self[idx0].values, self[idx1].values, self[column.values]))
ret.index.name = idx0
ret.columns.name = idx1
return ret
<|end_body_0|>... | Base class for symmetric matrices. | _Symmetric | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _Symmetric:
"""Base class for symmetric matrices."""
def square(self, column=None):
"""Return a square DataFrame of the matrix."""
<|body_0|>
def from_square(cls, square, column=None):
"""Create a symmetric matrix DataFrame from a square array."""
<|body_... | stack_v2_sparse_classes_75kplus_train_069019 | 7,607 | permissive | [
{
"docstring": "Return a square DataFrame of the matrix.",
"name": "square",
"signature": "def square(self, column=None)"
},
{
"docstring": "Create a symmetric matrix DataFrame from a square array.",
"name": "from_square",
"signature": "def from_square(cls, square, column=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004141 | Implement the Python class `_Symmetric` described below.
Class description:
Base class for symmetric matrices.
Method signatures and docstrings:
- def square(self, column=None): Return a square DataFrame of the matrix.
- def from_square(cls, square, column=None): Create a symmetric matrix DataFrame from a square arra... | Implement the Python class `_Symmetric` described below.
Class description:
Base class for symmetric matrices.
Method signatures and docstrings:
- def square(self, column=None): Return a square DataFrame of the matrix.
- def from_square(cls, square, column=None): Create a symmetric matrix DataFrame from a square arra... | 2e87bae3e043e6958129fc823c83ab0b46add8b5 | <|skeleton|>
class _Symmetric:
"""Base class for symmetric matrices."""
def square(self, column=None):
"""Return a square DataFrame of the matrix."""
<|body_0|>
def from_square(cls, square, column=None):
"""Create a symmetric matrix DataFrame from a square array."""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _Symmetric:
"""Base class for symmetric matrices."""
def square(self, column=None):
"""Return a square DataFrame of the matrix."""
column = self.defaultcolumn if column is None else column
idx0, idx1 = self.indices
ret = pd.DataFrame(_symmetric_to_square(self[idx0].values,... | the_stack_v2_python_sparse | exatomic/core/matrices.py | exa-analytics/exatomic | train | 15 |
9ed4dee164fb5b4150e1ec382fc30273511fe59a | [
"self.k = self.k + 1\nself.t = self.t - self.grid_sys.dt\nself.J_next = self.J\nself.J = np.zeros(self.grid_sys.nodes_n, dtype=float)\nself.pi = np.zeros(self.grid_sys.nodes_n, dtype=int)\nself.J_interpol = self.grid_sys.compute_bivariatespline_2D_interpolation_function(self.J_next, kx=3, ky=3)",
"self.Q = np.zer... | <|body_start_0|>
self.k = self.k + 1
self.t = self.t - self.grid_sys.dt
self.J_next = self.J
self.J = np.zeros(self.grid_sys.nodes_n, dtype=float)
self.pi = np.zeros(self.grid_sys.nodes_n, dtype=int)
self.J_interpol = self.grid_sys.compute_bivariatespline_2D_interpolation... | Dynamic programming on a grid sys | DynamicProgramming2DRectBivariateSpline | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DynamicProgramming2DRectBivariateSpline:
"""Dynamic programming on a grid sys"""
def initialize_backward_step(self):
"""One step of value iteration"""
<|body_0|>
def compute_backward_step(self):
"""One step of value iteration"""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_75kplus_train_069020 | 28,371 | permissive | [
{
"docstring": "One step of value iteration",
"name": "initialize_backward_step",
"signature": "def initialize_backward_step(self)"
},
{
"docstring": "One step of value iteration",
"name": "compute_backward_step",
"signature": "def compute_backward_step(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002316 | Implement the Python class `DynamicProgramming2DRectBivariateSpline` described below.
Class description:
Dynamic programming on a grid sys
Method signatures and docstrings:
- def initialize_backward_step(self): One step of value iteration
- def compute_backward_step(self): One step of value iteration | Implement the Python class `DynamicProgramming2DRectBivariateSpline` described below.
Class description:
Dynamic programming on a grid sys
Method signatures and docstrings:
- def initialize_backward_step(self): One step of value iteration
- def compute_backward_step(self): One step of value iteration
<|skeleton|>
cl... | baed84610d6090d42b814183931709fcdf61d012 | <|skeleton|>
class DynamicProgramming2DRectBivariateSpline:
"""Dynamic programming on a grid sys"""
def initialize_backward_step(self):
"""One step of value iteration"""
<|body_0|>
def compute_backward_step(self):
"""One step of value iteration"""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DynamicProgramming2DRectBivariateSpline:
"""Dynamic programming on a grid sys"""
def initialize_backward_step(self):
"""One step of value iteration"""
self.k = self.k + 1
self.t = self.t - self.grid_sys.dt
self.J_next = self.J
self.J = np.zeros(self.grid_sys.nodes_... | the_stack_v2_python_sparse | pyro/planning/dynamicprogramming.py | SherbyRobotics/pyro | train | 35 |
920e2cbd79b0c4829d0edfcbf87b318b07669144 | [
"self.request = request\nself.futures = {}\nsuper(EventsLoader, self).__init__()",
"self.setPriority(QtCore.QThread.LowestPriority)\nself.clearFutures()\nself.futures = {}\ncatalog = None\nLOGGER.info('Making %d event requests', len(self.request.sub_requests))\nwith concurrent.futures.ThreadPoolExecutor(5) as exe... | <|body_start_0|>
self.request = request
self.futures = {}
super(EventsLoader, self).__init__()
<|end_body_0|>
<|body_start_1|>
self.setPriority(QtCore.QThread.LowestPriority)
self.clearFutures()
self.futures = {}
catalog = None
LOGGER.info('Making %d even... | Thread to handle event requests | EventsLoader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventsLoader:
"""Thread to handle event requests"""
def __init__(self, request):
"""Initialization."""
<|body_0|>
def run(self):
"""Make a webservice request for events using the passed in options."""
<|body_1|>
def clearFutures(self):
"""Can... | stack_v2_sparse_classes_75kplus_train_069021 | 4,392 | no_license | [
{
"docstring": "Initialization.",
"name": "__init__",
"signature": "def __init__(self, request)"
},
{
"docstring": "Make a webservice request for events using the passed in options.",
"name": "run",
"signature": "def run(self)"
},
{
"docstring": "Cancel any outstanding tasks",
... | 4 | stack_v2_sparse_classes_30k_train_045038 | Implement the Python class `EventsLoader` described below.
Class description:
Thread to handle event requests
Method signatures and docstrings:
- def __init__(self, request): Initialization.
- def run(self): Make a webservice request for events using the passed in options.
- def clearFutures(self): Cancel any outstan... | Implement the Python class `EventsLoader` described below.
Class description:
Thread to handle event requests
Method signatures and docstrings:
- def __init__(self, request): Initialization.
- def run(self): Make a webservice request for events using the passed in options.
- def clearFutures(self): Cancel any outstan... | 1a1faf5daabfc697172e72856e3fa089df038673 | <|skeleton|>
class EventsLoader:
"""Thread to handle event requests"""
def __init__(self, request):
"""Initialization."""
<|body_0|>
def run(self):
"""Make a webservice request for events using the passed in options."""
<|body_1|>
def clearFutures(self):
"""Can... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EventsLoader:
"""Thread to handle event requests"""
def __init__(self, request):
"""Initialization."""
self.request = request
self.futures = {}
super(EventsLoader, self).__init__()
def run(self):
"""Make a webservice request for events using the passed in opti... | the_stack_v2_python_sparse | venv/Lib/site-packages/pyweed/events_handler.py | wenyali/Decoding_code | train | 0 |
8880c9cf1240a1481e2413155dd65a66495e1ef4 | [
"super().__init__()\nshape = observation_space.shape\nself.conv1 = nn.Conv2d(4, 32, 8, 4)\nself.conv2 = nn.Conv2d(32, 64, 4, 2)\nself.conv3 = nn.Conv2d(64, 64, 3, 1)\nshape = shape[1:]\nfor c in [self.conv1, self.conv2, self.conv3]:\n shape = conv_out_shape(shape, c)\nself.nunits = 64 * np.prod(shape)\nself.fc =... | <|body_start_0|>
super().__init__()
shape = observation_space.shape
self.conv1 = nn.Conv2d(4, 32, 8, 4)
self.conv2 = nn.Conv2d(32, 64, 4, 2)
self.conv3 = nn.Conv2d(64, 64, 3, 1)
shape = shape[1:]
for c in [self.conv1, self.conv2, self.conv3]:
shape = c... | Deep network from https://www.nature.com/articles/nature14236. | IDENet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IDENet:
"""Deep network from https://www.nature.com/articles/nature14236."""
def __init__(self, observation_space):
"""Build network."""
<|body_0|>
def forward(self, x):
"""Forward."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super().__init_... | stack_v2_sparse_classes_75kplus_train_069022 | 21,636 | no_license | [
{
"docstring": "Build network.",
"name": "__init__",
"signature": "def __init__(self, observation_space)"
},
{
"docstring": "Forward.",
"name": "forward",
"signature": "def forward(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_034296 | Implement the Python class `IDENet` described below.
Class description:
Deep network from https://www.nature.com/articles/nature14236.
Method signatures and docstrings:
- def __init__(self, observation_space): Build network.
- def forward(self, x): Forward. | Implement the Python class `IDENet` described below.
Class description:
Deep network from https://www.nature.com/articles/nature14236.
Method signatures and docstrings:
- def __init__(self, observation_space): Build network.
- def forward(self, x): Forward.
<|skeleton|>
class IDENet:
"""Deep network from https:/... | e71c4b12955b01bfb907aa31c91ded6bcd8aaec8 | <|skeleton|>
class IDENet:
"""Deep network from https://www.nature.com/articles/nature14236."""
def __init__(self, observation_space):
"""Build network."""
<|body_0|>
def forward(self, x):
"""Forward."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IDENet:
"""Deep network from https://www.nature.com/articles/nature14236."""
def __init__(self, observation_space):
"""Build network."""
super().__init__()
shape = observation_space.shape
self.conv1 = nn.Conv2d(4, 32, 8, 4)
self.conv2 = nn.Conv2d(32, 64, 4, 2)
... | the_stack_v2_python_sparse | dl/rl/algorithms/ppo2_ngu.py | cbschaff/dl | train | 1 |
8fe44dafdc99c4c9fa2886ab603f8259032ce162 | [
"if iplane is None:\n iplane = [0, 1]\ni_m = nm.sort(iplane)\ni_s = nm.setdiff1d(nm.arange(3), i_m)\ni_ms = {(0, 1): [0, 1, 3], (0, 2): [0, 2, 4], (1, 2): [1, 2, 5]}[tuple(i_m)]\ni_ss = nm.setdiff1d(nm.arange(6), i_ms)\nStruct.__init__(self, iplane=iplane, i_m=i_m, i_s=i_s, i_ms=i_ms, i_ss=i_ss)",
"mg = nm.mes... | <|body_start_0|>
if iplane is None:
iplane = [0, 1]
i_m = nm.sort(iplane)
i_s = nm.setdiff1d(nm.arange(3), i_m)
i_ms = {(0, 1): [0, 1, 3], (0, 2): [0, 2, 4], (1, 2): [1, 2, 5]}[tuple(i_m)]
i_ss = nm.setdiff1d(nm.arange(6), i_ms)
Struct.__init__(self, iplane=ip... | Transformmations of constitutive law coefficients of 3D problems to 2D. | TransformToPlane | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransformToPlane:
"""Transformmations of constitutive law coefficients of 3D problems to 2D."""
def __init__(self, iplane=None):
"""`iplane` ... vector of indices denoting the plane, e.g.: [0, 1]"""
<|body_0|>
def tensor_plane_stress(self, c3=None, d3=None, b3=None):
... | stack_v2_sparse_classes_75kplus_train_069023 | 3,273 | permissive | [
{
"docstring": "`iplane` ... vector of indices denoting the plane, e.g.: [0, 1]",
"name": "__init__",
"signature": "def __init__(self, iplane=None)"
},
{
"docstring": "Transforms all coefficients of the piezoelectric constitutive law from 3D to plane stress problem in 2D: strain/stress ordering/... | 2 | null | Implement the Python class `TransformToPlane` described below.
Class description:
Transformmations of constitutive law coefficients of 3D problems to 2D.
Method signatures and docstrings:
- def __init__(self, iplane=None): `iplane` ... vector of indices denoting the plane, e.g.: [0, 1]
- def tensor_plane_stress(self,... | Implement the Python class `TransformToPlane` described below.
Class description:
Transformmations of constitutive law coefficients of 3D problems to 2D.
Method signatures and docstrings:
- def __init__(self, iplane=None): `iplane` ... vector of indices denoting the plane, e.g.: [0, 1]
- def tensor_plane_stress(self,... | f89b2682df0cdba57c64caa6fe362855f2671465 | <|skeleton|>
class TransformToPlane:
"""Transformmations of constitutive law coefficients of 3D problems to 2D."""
def __init__(self, iplane=None):
"""`iplane` ... vector of indices denoting the plane, e.g.: [0, 1]"""
<|body_0|>
def tensor_plane_stress(self, c3=None, d3=None, b3=None):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TransformToPlane:
"""Transformmations of constitutive law coefficients of 3D problems to 2D."""
def __init__(self, iplane=None):
"""`iplane` ... vector of indices denoting the plane, e.g.: [0, 1]"""
if iplane is None:
iplane = [0, 1]
i_m = nm.sort(iplane)
i_s =... | the_stack_v2_python_sparse | sfepy/mechanics/matcoefs.py | certik/sfepy | train | 2 |
e43b75ae59aed66d3580ed937a92576baa51ebb0 | [
"super(S2VAdaptor, self).__init__()\nself.in_channels = in_channels\nself.channel_inter = nn.Linear(self.in_channels, self.in_channels, bias=False)\nself.channel_bn = nn.BatchNorm1d(self.in_channels)\nself.channel_act = nn.ReLU(inplace=True)",
"if isinstance(pretrained, str):\n logger = logging.getLogger()\n ... | <|body_start_0|>
super(S2VAdaptor, self).__init__()
self.in_channels = in_channels
self.channel_inter = nn.Linear(self.in_channels, self.in_channels, bias=False)
self.channel_bn = nn.BatchNorm1d(self.in_channels)
self.channel_act = nn.ReLU(inplace=True)
<|end_body_0|>
<|body_sta... | Semantic to Visual adaptation module | S2VAdaptor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class S2VAdaptor:
"""Semantic to Visual adaptation module"""
def __init__(self, in_channels=512):
"""RF-Learning s2v adaptor Args: in_channels (int): input channels"""
<|body_0|>
def init_weights(self, pretrained=None):
"""Args: pretrained (str): model path of the pre_... | stack_v2_sparse_classes_75kplus_train_069024 | 4,692 | permissive | [
{
"docstring": "RF-Learning s2v adaptor Args: in_channels (int): input channels",
"name": "__init__",
"signature": "def __init__(self, in_channels=512)"
},
{
"docstring": "Args: pretrained (str): model path of the pre_trained model Returns:",
"name": "init_weights",
"signature": "def ini... | 3 | null | Implement the Python class `S2VAdaptor` described below.
Class description:
Semantic to Visual adaptation module
Method signatures and docstrings:
- def __init__(self, in_channels=512): RF-Learning s2v adaptor Args: in_channels (int): input channels
- def init_weights(self, pretrained=None): Args: pretrained (str): m... | Implement the Python class `S2VAdaptor` described below.
Class description:
Semantic to Visual adaptation module
Method signatures and docstrings:
- def __init__(self, in_channels=512): RF-Learning s2v adaptor Args: in_channels (int): input channels
- def init_weights(self, pretrained=None): Args: pretrained (str): m... | fb47a96d1a38f5ce634c6f12d710ed5300cc89fc | <|skeleton|>
class S2VAdaptor:
"""Semantic to Visual adaptation module"""
def __init__(self, in_channels=512):
"""RF-Learning s2v adaptor Args: in_channels (int): input channels"""
<|body_0|>
def init_weights(self, pretrained=None):
"""Args: pretrained (str): model path of the pre_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class S2VAdaptor:
"""Semantic to Visual adaptation module"""
def __init__(self, in_channels=512):
"""RF-Learning s2v adaptor Args: in_channels (int): input channels"""
super(S2VAdaptor, self).__init__()
self.in_channels = in_channels
self.channel_inter = nn.Linear(self.in_channe... | the_stack_v2_python_sparse | davarocr/davarocr/davar_rcg/models/connects/single_block/RFAdaptor.py | OCRWorld/DAVAR-Lab-OCR | train | 0 |
748a0a54b365e287236a2c5a47048ca9a06c55b8 | [
"pydata = {'username': '15217043402', 'password': 'fzf123456', 'loginType': 3}\nheaders = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36'}\nurl = 'http://passport.com.juooo.net.cn/User/doLoginRoute'\ns = requests.session()\nr = s.po... | <|body_start_0|>
pydata = {'username': '15217043402', 'password': 'fzf123456', 'loginType': 3}
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36'}
url = 'http://passport.com.juooo.net.cn/User/doLoginRoute'... | Test | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test:
def login(self):
"""登录"""
<|body_0|>
def test_buyTickets(self):
"""进入结算页"""
<|body_1|>
def test_createOrder(self):
"""提交订单"""
<|body_2|>
def run_case(self, all_case):
"""运行测试用例"""
<|body_3|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_75kplus_train_069025 | 2,341 | no_license | [
{
"docstring": "登录",
"name": "login",
"signature": "def login(self)"
},
{
"docstring": "进入结算页",
"name": "test_buyTickets",
"signature": "def test_buyTickets(self)"
},
{
"docstring": "提交订单",
"name": "test_createOrder",
"signature": "def test_createOrder(self)"
},
{
... | 4 | null | Implement the Python class `Test` described below.
Class description:
Implement the Test class.
Method signatures and docstrings:
- def login(self): 登录
- def test_buyTickets(self): 进入结算页
- def test_createOrder(self): 提交订单
- def run_case(self, all_case): 运行测试用例 | Implement the Python class `Test` described below.
Class description:
Implement the Test class.
Method signatures and docstrings:
- def login(self): 登录
- def test_buyTickets(self): 进入结算页
- def test_createOrder(self): 提交订单
- def run_case(self, all_case): 运行测试用例
<|skeleton|>
class Test:
def login(self):
"... | 8f10d3c70ab785d4120d24673b0945a169f2355c | <|skeleton|>
class Test:
def login(self):
"""登录"""
<|body_0|>
def test_buyTickets(self):
"""进入结算页"""
<|body_1|>
def test_createOrder(self):
"""提交订单"""
<|body_2|>
def run_case(self, all_case):
"""运行测试用例"""
<|body_3|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Test:
def login(self):
"""登录"""
pydata = {'username': '15217043402', 'password': 'fzf123456', 'loginType': 3}
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36'}
url = 'http://passport.co... | the_stack_v2_python_sparse | mystudy/fzf_request/juooo_01.py | zhenfang95/Hello-World | train | 0 | |
1c3604b96d02fbf96a5450f6d743d10a155b450c | [
"if node.attr == 'display_name_with_default_escaped':\n self.results.violations.append(ExpressionRuleViolation(ruleset.python_deprecated_display_name, self.node_to_expression(node)))\nself.generic_visit(node)",
"if isinstance(node.func, ast.Attribute) and node.func.attr == 'format':\n visitor = FormatInterp... | <|body_start_0|>
if node.attr == 'display_name_with_default_escaped':
self.results.violations.append(ExpressionRuleViolation(ruleset.python_deprecated_display_name, self.node_to_expression(node)))
self.generic_visit(node)
<|end_body_0|>
<|body_start_1|>
if isinstance(node.func, ast.... | Visits all nodes and does not interfere with calls to generic_visit(). This is used in conjunction with other visitors to check for a variety of violations. This visitor is meant to be used once from the root. | AllNodeVisitor | [
"MIT",
"AGPL-3.0-only",
"AGPL-3.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AllNodeVisitor:
"""Visits all nodes and does not interfere with calls to generic_visit(). This is used in conjunction with other visitors to check for a variety of violations. This visitor is meant to be used once from the root."""
def visit_Attribute(self, node):
"""Checks for uses ... | stack_v2_sparse_classes_75kplus_train_069026 | 12,510 | permissive | [
{
"docstring": "Checks for uses of deprecated `display_name_with_default_escaped`. Arguments: node: An AST node.",
"name": "visit_Attribute",
"signature": "def visit_Attribute(self, node)"
},
{
"docstring": "Checks for a variety of violations: - Checks that format() calls with nested HTML() or T... | 3 | stack_v2_sparse_classes_30k_train_038477 | Implement the Python class `AllNodeVisitor` described below.
Class description:
Visits all nodes and does not interfere with calls to generic_visit(). This is used in conjunction with other visitors to check for a variety of violations. This visitor is meant to be used once from the root.
Method signatures and docstr... | Implement the Python class `AllNodeVisitor` described below.
Class description:
Visits all nodes and does not interfere with calls to generic_visit(). This is used in conjunction with other visitors to check for a variety of violations. This visitor is meant to be used once from the root.
Method signatures and docstr... | 5809eaca7079a15ee56b0b7fcfea425337046c97 | <|skeleton|>
class AllNodeVisitor:
"""Visits all nodes and does not interfere with calls to generic_visit(). This is used in conjunction with other visitors to check for a variety of violations. This visitor is meant to be used once from the root."""
def visit_Attribute(self, node):
"""Checks for uses ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AllNodeVisitor:
"""Visits all nodes and does not interfere with calls to generic_visit(). This is used in conjunction with other visitors to check for a variety of violations. This visitor is meant to be used once from the root."""
def visit_Attribute(self, node):
"""Checks for uses of deprecated... | the_stack_v2_python_sparse | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/scripts/xsslint/xsslint/visitors.py | luque/better-ways-of-thinking-about-software | train | 3 |
5bd5f2b5c72b3c676518f41c38bc07d3dd500e58 | [
"information = None\nwith open('src/configuration/connection.json') as json_file:\n data = json.load(json_file)\n if key in data:\n information = data[key]\nreturn information",
"save_data = False\nwith open('src/configuration/connection.json') as json_file:\n data_origin = json.load(json_file)\no... | <|body_start_0|>
information = None
with open('src/configuration/connection.json') as json_file:
data = json.load(json_file)
if key in data:
information = data[key]
return information
<|end_body_0|>
<|body_start_1|>
save_data = False
with ... | This class manages the connection to the configuration server. | ManageConnection | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ManageConnection:
"""This class manages the connection to the configuration server."""
def get_connection(key):
"""This function obtains the connection to the configuration server."""
<|body_0|>
def set_data(key, new_data) -> bool:
"""This function connects to th... | stack_v2_sparse_classes_75kplus_train_069027 | 1,120 | no_license | [
{
"docstring": "This function obtains the connection to the configuration server.",
"name": "get_connection",
"signature": "def get_connection(key)"
},
{
"docstring": "This function connects to the configuration server.",
"name": "set_data",
"signature": "def set_data(key, new_data) -> b... | 2 | null | Implement the Python class `ManageConnection` described below.
Class description:
This class manages the connection to the configuration server.
Method signatures and docstrings:
- def get_connection(key): This function obtains the connection to the configuration server.
- def set_data(key, new_data) -> bool: This fu... | Implement the Python class `ManageConnection` described below.
Class description:
This class manages the connection to the configuration server.
Method signatures and docstrings:
- def get_connection(key): This function obtains the connection to the configuration server.
- def set_data(key, new_data) -> bool: This fu... | cd52bc8d0d60100091637ef79f78cc79d58a1495 | <|skeleton|>
class ManageConnection:
"""This class manages the connection to the configuration server."""
def get_connection(key):
"""This function obtains the connection to the configuration server."""
<|body_0|>
def set_data(key, new_data) -> bool:
"""This function connects to th... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ManageConnection:
"""This class manages the connection to the configuration server."""
def get_connection(key):
"""This function obtains the connection to the configuration server."""
information = None
with open('src/configuration/connection.json') as json_file:
data ... | the_stack_v2_python_sparse | src/configuration/manage_connection.py | YazLuna/APIExpressJobs | train | 0 |
1646348048a6d86ba2c09fe12dcd69fc868de6bc | [
"client = mock_client()\nargs = {'scim': '{\"displayName\": \"The group name\"}'}\nmock_result = mocker.patch('AWSILM.CommandResults')\nwith requests_mock.Mocker() as m:\n m.post(f'{groupUri}', status_code=201, json=APP_GROUP_OUTPUT)\n create_group_command(client, args)\nassert mock_result.call_args.kwargs['o... | <|body_start_0|>
client = mock_client()
args = {'scim': '{"displayName": "The group name"}'}
mock_result = mocker.patch('AWSILM.CommandResults')
with requests_mock.Mocker() as m:
m.post(f'{groupUri}', status_code=201, json=APP_GROUP_OUTPUT)
create_group_command(cl... | TestCreateGroupCommand | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCreateGroupCommand:
def test_success(self, mocker):
"""Given: - An app client object - A scim argument that contains a displayName of a non-existing group in the application When: - Calling the main function with 'iam-create-group' command Then: - Ensure the resulted 'CommandResults'... | stack_v2_sparse_classes_75kplus_train_069028 | 23,298 | permissive | [
{
"docstring": "Given: - An app client object - A scim argument that contains a displayName of a non-existing group in the application When: - Calling the main function with 'iam-create-group' command Then: - Ensure the resulted 'CommandResults' object holds information about the created group.",
"name": "t... | 3 | null | Implement the Python class `TestCreateGroupCommand` described below.
Class description:
Implement the TestCreateGroupCommand class.
Method signatures and docstrings:
- def test_success(self, mocker): Given: - An app client object - A scim argument that contains a displayName of a non-existing group in the application... | Implement the Python class `TestCreateGroupCommand` described below.
Class description:
Implement the TestCreateGroupCommand class.
Method signatures and docstrings:
- def test_success(self, mocker): Given: - An app client object - A scim argument that contains a displayName of a non-existing group in the application... | 890def5a0e0ae8d6eaa538148249ddbc851dbb6b | <|skeleton|>
class TestCreateGroupCommand:
def test_success(self, mocker):
"""Given: - An app client object - A scim argument that contains a displayName of a non-existing group in the application When: - Calling the main function with 'iam-create-group' command Then: - Ensure the resulted 'CommandResults'... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestCreateGroupCommand:
def test_success(self, mocker):
"""Given: - An app client object - A scim argument that contains a displayName of a non-existing group in the application When: - Calling the main function with 'iam-create-group' command Then: - Ensure the resulted 'CommandResults' object holds ... | the_stack_v2_python_sparse | Packs/AWS-ILM/Integrations/AWSILM/AWSILM_test.py | demisto/content | train | 1,023 | |
2b95c81167a9c8ad2b419ba7df2b789271935d7a | [
"if value <= 0:\n raise ValueError(f'Min partition size should be > 0, passed value {value}')\nsuper().put(value)",
"min_partition_size = super().get()\nassert min_partition_size > 0, '`min_partition_size` should be > 0'\nreturn min_partition_size"
] | <|body_start_0|>
if value <= 0:
raise ValueError(f'Min partition size should be > 0, passed value {value}')
super().put(value)
<|end_body_0|>
<|body_start_1|>
min_partition_size = super().get()
assert min_partition_size > 0, '`min_partition_size` should be > 0'
retur... | Minimum number of rows/columns in a single pandas partition split. Once a partition for a pandas dataframe has more than this many elements, Modin adds another partition. | MinPartitionSize | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MinPartitionSize:
"""Minimum number of rows/columns in a single pandas partition split. Once a partition for a pandas dataframe has more than this many elements, Modin adds another partition."""
def put(cls, value: int) -> None:
"""Set ``MinPartitionSize`` with extra checks. Paramete... | stack_v2_sparse_classes_75kplus_train_069029 | 21,244 | permissive | [
{
"docstring": "Set ``MinPartitionSize`` with extra checks. Parameters ---------- value : int Config value to set.",
"name": "put",
"signature": "def put(cls, value: int) -> None"
},
{
"docstring": "Get ``MinPartitionSize`` with extra checks. Returns ------- int",
"name": "get",
"signatu... | 2 | null | Implement the Python class `MinPartitionSize` described below.
Class description:
Minimum number of rows/columns in a single pandas partition split. Once a partition for a pandas dataframe has more than this many elements, Modin adds another partition.
Method signatures and docstrings:
- def put(cls, value: int) -> N... | Implement the Python class `MinPartitionSize` described below.
Class description:
Minimum number of rows/columns in a single pandas partition split. Once a partition for a pandas dataframe has more than this many elements, Modin adds another partition.
Method signatures and docstrings:
- def put(cls, value: int) -> N... | 8f6e00378e095817deccd25f4140406c5ee6c992 | <|skeleton|>
class MinPartitionSize:
"""Minimum number of rows/columns in a single pandas partition split. Once a partition for a pandas dataframe has more than this many elements, Modin adds another partition."""
def put(cls, value: int) -> None:
"""Set ``MinPartitionSize`` with extra checks. Paramete... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MinPartitionSize:
"""Minimum number of rows/columns in a single pandas partition split. Once a partition for a pandas dataframe has more than this many elements, Modin adds another partition."""
def put(cls, value: int) -> None:
"""Set ``MinPartitionSize`` with extra checks. Parameters ----------... | the_stack_v2_python_sparse | modin/config/envvars.py | modin-project/modin | train | 9,241 |
6bff78c43b733319ad9804ba5ed57f1520e81a5b | [
"if book_type == 'magazine' and people not in self.magazine_subscriber:\n self.magazine_subscriber.append(people)\n print('【邮局】%s orders a %s' % (people.name, book_type))\nelif book_type == 'newpaper' and people not in self.newpaper_subscriber:\n self.newpaper_subscriber.append(people)\n print('【邮局】%s o... | <|body_start_0|>
if book_type == 'magazine' and people not in self.magazine_subscriber:
self.magazine_subscriber.append(people)
print('【邮局】%s orders a %s' % (people.name, book_type))
elif book_type == 'newpaper' and people not in self.newpaper_subscriber:
self.newpape... | 分别定义杂志,报纸,小说的读者列表,并且定义订阅和邮寄方法 | Post_Office | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Post_Office:
"""分别定义杂志,报纸,小说的读者列表,并且定义订阅和邮寄方法"""
def register(self, book_type, people):
"""读者订阅不同类型的书籍"""
<|body_0|>
def cancel(self, book_type, people):
"""读者取消订阅"""
<|body_1|>
def post_book(self, book_type, book_name):
"""邮局根据出版社的最新发布将最新的书籍... | stack_v2_sparse_classes_75kplus_train_069030 | 4,026 | no_license | [
{
"docstring": "读者订阅不同类型的书籍",
"name": "register",
"signature": "def register(self, book_type, people)"
},
{
"docstring": "读者取消订阅",
"name": "cancel",
"signature": "def cancel(self, book_type, people)"
},
{
"docstring": "邮局根据出版社的最新发布将最新的书籍邮寄到读者手里",
"name": "post_book",
"sig... | 3 | null | Implement the Python class `Post_Office` described below.
Class description:
分别定义杂志,报纸,小说的读者列表,并且定义订阅和邮寄方法
Method signatures and docstrings:
- def register(self, book_type, people): 读者订阅不同类型的书籍
- def cancel(self, book_type, people): 读者取消订阅
- def post_book(self, book_type, book_name): 邮局根据出版社的最新发布将最新的书籍邮寄到读者手里 | Implement the Python class `Post_Office` described below.
Class description:
分别定义杂志,报纸,小说的读者列表,并且定义订阅和邮寄方法
Method signatures and docstrings:
- def register(self, book_type, people): 读者订阅不同类型的书籍
- def cancel(self, book_type, people): 读者取消订阅
- def post_book(self, book_type, book_name): 邮局根据出版社的最新发布将最新的书籍邮寄到读者手里
<|skel... | 93ce772ae768801af7c0e7e930b96ed30cacc95f | <|skeleton|>
class Post_Office:
"""分别定义杂志,报纸,小说的读者列表,并且定义订阅和邮寄方法"""
def register(self, book_type, people):
"""读者订阅不同类型的书籍"""
<|body_0|>
def cancel(self, book_type, people):
"""读者取消订阅"""
<|body_1|>
def post_book(self, book_type, book_name):
"""邮局根据出版社的最新发布将最新的书籍... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Post_Office:
"""分别定义杂志,报纸,小说的读者列表,并且定义订阅和邮寄方法"""
def register(self, book_type, people):
"""读者订阅不同类型的书籍"""
if book_type == 'magazine' and people not in self.magazine_subscriber:
self.magazine_subscriber.append(people)
print('【邮局】%s orders a %s' % (people.name, book_... | the_stack_v2_python_sparse | base/observe_module.py | skystar-Lion/pydev | train | 1 |
d8491831874b0074670a1ce0508aaeeb4338c665 | [
"super().__init__(X, Y)\nself.max_iterations = max_iterations\nself.threshold = min_delta\nself.lmbda = lmbda",
"i = 0\ndelta = 1.0\nold_rho = numpy.ones(self.X.shape[0])\nweights = numpy.ones((self.X.shape[1], self.X.shape[2]))\nwhile i < self.max_iterations and delta > self.threshold:\n logger.info('Iteratio... | <|body_start_0|>
super().__init__(X, Y)
self.max_iterations = max_iterations
self.threshold = min_delta
self.lmbda = lmbda
<|end_body_0|>
<|body_start_1|>
i = 0
delta = 1.0
old_rho = numpy.ones(self.X.shape[0])
weights = numpy.ones((self.X.shape[1], self.... | Antares implementation of the IR-MAD transformation IR-MAD corresponds to Iterative Reweighted Multivariate Alteration Detection (MAD), it is applied over two matching arrays It implements the method of performing several MAD transformations and re-weighting the importance of the pixels at each consecutive run. Given t... | Transform | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transform:
"""Antares implementation of the IR-MAD transformation IR-MAD corresponds to Iterative Reweighted Multivariate Alteration Detection (MAD), it is applied over two matching arrays It implements the method of performing several MAD transformations and re-weighting the importance of the pi... | stack_v2_sparse_classes_75kplus_train_069031 | 2,753 | no_license | [
{
"docstring": "Instantiate class to run MAD transformation on two arrays Args: max_iterations (int): The maximum number of times that the process will run the MAD transform. min_delta (float): After each successive iteration of the MAD transform, the distance between the eigenvalues is measured. Min_delta is u... | 2 | stack_v2_sparse_classes_30k_train_010029 | Implement the Python class `Transform` described below.
Class description:
Antares implementation of the IR-MAD transformation IR-MAD corresponds to Iterative Reweighted Multivariate Alteration Detection (MAD), it is applied over two matching arrays It implements the method of performing several MAD transformations an... | Implement the Python class `Transform` described below.
Class description:
Antares implementation of the IR-MAD transformation IR-MAD corresponds to Iterative Reweighted Multivariate Alteration Detection (MAD), it is applied over two matching arrays It implements the method of performing several MAD transformations an... | ab8073a4b45915ba51c718b5403795c44f9b0027 | <|skeleton|>
class Transform:
"""Antares implementation of the IR-MAD transformation IR-MAD corresponds to Iterative Reweighted Multivariate Alteration Detection (MAD), it is applied over two matching arrays It implements the method of performing several MAD transformations and re-weighting the importance of the pi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Transform:
"""Antares implementation of the IR-MAD transformation IR-MAD corresponds to Iterative Reweighted Multivariate Alteration Detection (MAD), it is applied over two matching arrays It implements the method of performing several MAD transformations and re-weighting the importance of the pixels at each ... | the_stack_v2_python_sparse | madmex/lcc/transform/irmad.py | ixime/antares3 | train | 0 |
345280c6c4b3d63a3e64f006a2960838ac3c0c5c | [
"self.templdirs = [os.path.dirname(__file__)]\nif dirs:\n self.templdirs.extend(dirs)\nself._charset = charset\ndu = False\nif self._charset.lower() != 'utf-8':\n du = True\nself.tlookup = TemplateLookup(directories=self.templdirs, disable_unicode=du, input_encoding=self._charset, output_encoding=self._charse... | <|body_start_0|>
self.templdirs = [os.path.dirname(__file__)]
if dirs:
self.templdirs.extend(dirs)
self._charset = charset
du = False
if self._charset.lower() != 'utf-8':
du = True
self.tlookup = TemplateLookup(directories=self.templdirs, disable_u... | A TemplateEngine class for Mako template. | MakoTemplateEngine | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MakoTemplateEngine:
"""A TemplateEngine class for Mako template."""
def __init__(self, extension=DEFAULT_EXTENSION, dirs=[], charset='utf-8'):
"""Initialization method"""
<|body_0|>
def get_template(self, path='', string='', tid=''):
"""A method to obtain templat... | stack_v2_sparse_classes_75kplus_train_069032 | 8,943 | permissive | [
{
"docstring": "Initialization method",
"name": "__init__",
"signature": "def __init__(self, extension=DEFAULT_EXTENSION, dirs=[], charset='utf-8')"
},
{
"docstring": "A method to obtain template object, by using given path or string. When argment path is given, method produce template string vi... | 3 | stack_v2_sparse_classes_30k_train_012626 | Implement the Python class `MakoTemplateEngine` described below.
Class description:
A TemplateEngine class for Mako template.
Method signatures and docstrings:
- def __init__(self, extension=DEFAULT_EXTENSION, dirs=[], charset='utf-8'): Initialization method
- def get_template(self, path='', string='', tid=''): A met... | Implement the Python class `MakoTemplateEngine` described below.
Class description:
A TemplateEngine class for Mako template.
Method signatures and docstrings:
- def __init__(self, extension=DEFAULT_EXTENSION, dirs=[], charset='utf-8'): Initialization method
- def get_template(self, path='', string='', tid=''): A met... | e1209f7d44d1c59ff9d373b7d89d414f31a9c28b | <|skeleton|>
class MakoTemplateEngine:
"""A TemplateEngine class for Mako template."""
def __init__(self, extension=DEFAULT_EXTENSION, dirs=[], charset='utf-8'):
"""Initialization method"""
<|body_0|>
def get_template(self, path='', string='', tid=''):
"""A method to obtain templat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MakoTemplateEngine:
"""A TemplateEngine class for Mako template."""
def __init__(self, extension=DEFAULT_EXTENSION, dirs=[], charset='utf-8'):
"""Initialization method"""
self.templdirs = [os.path.dirname(__file__)]
if dirs:
self.templdirs.extend(dirs)
self._ch... | the_stack_v2_python_sparse | aha/widget/handler.py | Letractively/aha-gae | train | 0 |
0bc268e0959ebd52db661aadc09388190f61175c | [
"super(Linker, self).__init__()\nself.config = config\nself.encoder = encoder\nself.entity_embeddings = nn.Embedding(self.config.entity_size, self.config.embedding_dim)\nif self.config.priors:\n self.char_feature_weight = nn.Parameter(torch.FloatTensor([1]))\n self.model_feature_weight = nn.Parameter(torch.Fl... | <|body_start_0|>
super(Linker, self).__init__()
self.config = config
self.encoder = encoder
self.entity_embeddings = nn.Embedding(self.config.entity_size, self.config.embedding_dim)
if self.config.priors:
self.char_feature_weight = nn.Parameter(torch.FloatTensor([1]))... | Linker | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Linker:
def __init__(self, config, encoder):
""":param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions"""
<|body_0|>
def forward(self, entity_candidates, mention_representation, sentence, char_scores, au... | stack_v2_sparse_classes_75kplus_train_069033 | 42,719 | permissive | [
{
"docstring": ":param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions",
"name": "__init__",
"signature": "def __init__(self, config, encoder)"
},
{
"docstring": ":return: unnormalized log probabilities (logits) of gold enti... | 2 | stack_v2_sparse_classes_30k_train_039682 | Implement the Python class `Linker` described below.
Class description:
Implement the Linker class.
Method signatures and docstrings:
- def __init__(self, config, encoder): :param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions
- def forward(self... | Implement the Python class `Linker` described below.
Class description:
Implement the Linker class.
Method signatures and docstrings:
- def __init__(self, config, encoder): :param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions
- def forward(self... | 6a7dcd7d3756327c61ef949e5b4f6af6e2849187 | <|skeleton|>
class Linker:
def __init__(self, config, encoder):
""":param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions"""
<|body_0|>
def forward(self, entity_candidates, mention_representation, sentence, char_scores, au... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Linker:
def __init__(self, config, encoder):
""":param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions"""
super(Linker, self).__init__()
self.config = config
self.encoder = encoder
self.entity_embed... | the_stack_v2_python_sparse | typenet/src/model.py | dhruvdcoder/dl-with-constraints | train | 0 | |
df9419e46b70d5cddc679791a31024bf39c4fb01 | [
"if self.call_args is None:\n expected = self._format_mock_call_signature(args, kwargs)\n raise AssertionError('Expected call: %s\\nNot called' % (expected,))\n\ndef _error_message(cause):\n msg = self._format_mock_failure_message(args, kwargs)\n if six.PY2 and cause is not None:\n msg = '%s\\n%s... | <|body_start_0|>
if self.call_args is None:
expected = self._format_mock_call_signature(args, kwargs)
raise AssertionError('Expected call: %s\nNot called' % (expected,))
def _error_message(cause):
msg = self._format_mock_failure_message(args, kwargs)
if s... | AlteredMagicMock | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlteredMagicMock:
def assert_called_with(self, *args, **kwargs):
"""Assert that the mock was called with the specified arguments. Raises an AssertionError if the args and keyword args passed in are different to the last call to the mock."""
<|body_0|>
def assert_any_call(sel... | stack_v2_sparse_classes_75kplus_train_069034 | 22,331 | no_license | [
{
"docstring": "Assert that the mock was called with the specified arguments. Raises an AssertionError if the args and keyword args passed in are different to the last call to the mock.",
"name": "assert_called_with",
"signature": "def assert_called_with(self, *args, **kwargs)"
},
{
"docstring":... | 3 | stack_v2_sparse_classes_30k_train_020019 | Implement the Python class `AlteredMagicMock` described below.
Class description:
Implement the AlteredMagicMock class.
Method signatures and docstrings:
- def assert_called_with(self, *args, **kwargs): Assert that the mock was called with the specified arguments. Raises an AssertionError if the args and keyword args... | Implement the Python class `AlteredMagicMock` described below.
Class description:
Implement the AlteredMagicMock class.
Method signatures and docstrings:
- def assert_called_with(self, *args, **kwargs): Assert that the mock was called with the specified arguments. Raises an AssertionError if the args and keyword args... | 092a354315b9b2c08e32cdc049791d82dfd47745 | <|skeleton|>
class AlteredMagicMock:
def assert_called_with(self, *args, **kwargs):
"""Assert that the mock was called with the specified arguments. Raises an AssertionError if the args and keyword args passed in are different to the last call to the mock."""
<|body_0|>
def assert_any_call(sel... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AlteredMagicMock:
def assert_called_with(self, *args, **kwargs):
"""Assert that the mock was called with the specified arguments. Raises an AssertionError if the args and keyword args passed in are different to the last call to the mock."""
if self.call_args is None:
expected = sel... | the_stack_v2_python_sparse | robot_skills/src/robot_skills/mockbot.py | tue-robotics/tue_robocup | train | 39 | |
27ed4f03fca2c6b5017c882458829ba68291c1a1 | [
"self._apikey = apikey\nself._url = f'{url}/feed/list.json'\nself._interval = interval\nself._hass = hass\nself.data = None",
"try:\n parameters = {'apikey': self._apikey}\n req = requests.get(self._url, params=parameters, allow_redirects=True, timeout=5)\nexcept requests.exceptions.RequestException as exce... | <|body_start_0|>
self._apikey = apikey
self._url = f'{url}/feed/list.json'
self._interval = interval
self._hass = hass
self.data = None
<|end_body_0|>
<|body_start_1|>
try:
parameters = {'apikey': self._apikey}
req = requests.get(self._url, params... | The class for handling the data retrieval. | EmonCmsData | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmonCmsData:
"""The class for handling the data retrieval."""
def __init__(self, hass, url, apikey, interval):
"""Initialize the data object."""
<|body_0|>
def update(self):
"""Get the latest data from Emoncms."""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_75kplus_train_069035 | 9,706 | permissive | [
{
"docstring": "Initialize the data object.",
"name": "__init__",
"signature": "def __init__(self, hass, url, apikey, interval)"
},
{
"docstring": "Get the latest data from Emoncms.",
"name": "update",
"signature": "def update(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_042854 | Implement the Python class `EmonCmsData` described below.
Class description:
The class for handling the data retrieval.
Method signatures and docstrings:
- def __init__(self, hass, url, apikey, interval): Initialize the data object.
- def update(self): Get the latest data from Emoncms. | Implement the Python class `EmonCmsData` described below.
Class description:
The class for handling the data retrieval.
Method signatures and docstrings:
- def __init__(self, hass, url, apikey, interval): Initialize the data object.
- def update(self): Get the latest data from Emoncms.
<|skeleton|>
class EmonCmsData... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class EmonCmsData:
"""The class for handling the data retrieval."""
def __init__(self, hass, url, apikey, interval):
"""Initialize the data object."""
<|body_0|>
def update(self):
"""Get the latest data from Emoncms."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EmonCmsData:
"""The class for handling the data retrieval."""
def __init__(self, hass, url, apikey, interval):
"""Initialize the data object."""
self._apikey = apikey
self._url = f'{url}/feed/list.json'
self._interval = interval
self._hass = hass
self.data ... | the_stack_v2_python_sparse | homeassistant/components/emoncms/sensor.py | home-assistant/core | train | 35,501 |
f96136f3452fb139fa3d6071624bce3d2108591b | [
"super(MRSLCI, self).__init__(verbose)\nself.nlay = nlay\nself.nx = len(profile)\nself.np = 3 * nlay - 1\nself.mesh2d = pg.createMesh2D(range(self.np + 1), range(self.nx + 1))\nself.mesh2d.rotate(pg.RVector3(0, 0, -np.pi / 2))\nself.setMesh(self.mesh2d)\nself.J = pg.RBlockMatrix()\nself.FOP1d = []\nipos = 0\nfor i,... | <|body_start_0|>
super(MRSLCI, self).__init__(verbose)
self.nlay = nlay
self.nx = len(profile)
self.np = 3 * nlay - 1
self.mesh2d = pg.createMesh2D(range(self.np + 1), range(self.nx + 1))
self.mesh2d.rotate(pg.RVector3(0, 0, -np.pi / 2))
self.setMesh(self.mesh2d)
... | MRS Laterally constrained modelling based on BlockMatrices. | MRSLCI | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MRSLCI:
"""MRS Laterally constrained modelling based on BlockMatrices."""
def __init__(self, profile, nlay=2, verbose=False):
"""Parameters: FDEM data class and number of layers"""
<|body_0|>
def response(self, model):
"""cut-together forward responses of all sou... | stack_v2_sparse_classes_75kplus_train_069036 | 17,204 | permissive | [
{
"docstring": "Parameters: FDEM data class and number of layers",
"name": "__init__",
"signature": "def __init__(self, profile, nlay=2, verbose=False)"
},
{
"docstring": "cut-together forward responses of all soundings",
"name": "response",
"signature": "def response(self, model)"
},
... | 3 | stack_v2_sparse_classes_30k_train_050152 | Implement the Python class `MRSLCI` described below.
Class description:
MRS Laterally constrained modelling based on BlockMatrices.
Method signatures and docstrings:
- def __init__(self, profile, nlay=2, verbose=False): Parameters: FDEM data class and number of layers
- def response(self, model): cut-together forward... | Implement the Python class `MRSLCI` described below.
Class description:
MRS Laterally constrained modelling based on BlockMatrices.
Method signatures and docstrings:
- def __init__(self, profile, nlay=2, verbose=False): Parameters: FDEM data class and number of layers
- def response(self, model): cut-together forward... | 9962fe882fad284e52858ba3aa5e87b2395d791d | <|skeleton|>
class MRSLCI:
"""MRS Laterally constrained modelling based on BlockMatrices."""
def __init__(self, profile, nlay=2, verbose=False):
"""Parameters: FDEM data class and number of layers"""
<|body_0|>
def response(self, model):
"""cut-together forward responses of all sou... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MRSLCI:
"""MRS Laterally constrained modelling based on BlockMatrices."""
def __init__(self, profile, nlay=2, verbose=False):
"""Parameters: FDEM data class and number of layers"""
super(MRSLCI, self).__init__(verbose)
self.nlay = nlay
self.nx = len(profile)
self.n... | the_stack_v2_python_sparse | python/pygimli/physics/sNMR/mrsprofile.py | Geophysics-OpenSource/gimli | train | 0 |
fe851e8badd441176ab25aecc4257dc9083d6f81 | [
"headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer {}'.format(sendgrid_api_key)}\ndata = {'personalizations': [{'to': [{'email': 'recipient@example.com'}]}], 'from': {'email': 'sendeexampexample@example.com'}, 'subject': 'HelloWorld!', 'content': [{'type': 'text/plain', 'value': 'Howdy!'}]}\nr... | <|body_start_0|>
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer {}'.format(sendgrid_api_key)}
data = {'personalizations': [{'to': [{'email': 'recipient@example.com'}]}], 'from': {'email': 'sendeexampexample@example.com'}, 'subject': 'HelloWorld!', 'content': [{'type': 'text/plai... | Helper Class. Contains methods used by Sendgrid Resource classes | SendgridHelper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SendgridHelper:
"""Helper Class. Contains methods used by Sendgrid Resource classes"""
def send_test_request(sendgrid_api_key: str) -> requests.Response:
"""Send POST request to the Sendgrid test endpoint containing the the supplied API key :param sendgrid_api_key: Key whose validity... | stack_v2_sparse_classes_75kplus_train_069037 | 6,487 | permissive | [
{
"docstring": "Send POST request to the Sendgrid test endpoint containing the the supplied API key :param sendgrid_api_key: Key whose validity is to be tested :return: The HTTP response received from Sendgrid",
"name": "send_test_request",
"signature": "def send_test_request(sendgrid_api_key: str) -> r... | 2 | stack_v2_sparse_classes_30k_train_023474 | Implement the Python class `SendgridHelper` described below.
Class description:
Helper Class. Contains methods used by Sendgrid Resource classes
Method signatures and docstrings:
- def send_test_request(sendgrid_api_key: str) -> requests.Response: Send POST request to the Sendgrid test endpoint containing the the sup... | Implement the Python class `SendgridHelper` described below.
Class description:
Helper Class. Contains methods used by Sendgrid Resource classes
Method signatures and docstrings:
- def send_test_request(sendgrid_api_key: str) -> requests.Response: Send POST request to the Sendgrid test endpoint containing the the sup... | 5d123691d1f25d0b85e20e4e8293266bf23c9f8a | <|skeleton|>
class SendgridHelper:
"""Helper Class. Contains methods used by Sendgrid Resource classes"""
def send_test_request(sendgrid_api_key: str) -> requests.Response:
"""Send POST request to the Sendgrid test endpoint containing the the supplied API key :param sendgrid_api_key: Key whose validity... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SendgridHelper:
"""Helper Class. Contains methods used by Sendgrid Resource classes"""
def send_test_request(sendgrid_api_key: str) -> requests.Response:
"""Send POST request to the Sendgrid test endpoint containing the the supplied API key :param sendgrid_api_key: Key whose validity is to be tes... | the_stack_v2_python_sparse | Analytics/resources/sendgrid_management.py | thanosbnt/SharingCitiesDashboard | train | 0 |
b3abd337ca3bfbc1b2c6a8d8aa748cbbdc86f4d1 | [
"if self.action == 'list':\n return Area.objects.filter(parent=None)\nelse:\n return Area.objects.all()",
"if self.action == 'list':\n return AreaSerializer\nelse:\n return SubAreaSerializer"
] | <|body_start_0|>
if self.action == 'list':
return Area.objects.filter(parent=None)
else:
return Area.objects.all()
<|end_body_0|>
<|body_start_1|>
if self.action == 'list':
return AreaSerializer
else:
return SubAreaSerializer
<|end_body_1|... | AreaViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AreaViewSet:
def get_queryset(self):
"""提供数据集"""
<|body_0|>
def get_serializer_class(self):
"""提供序列化器"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if self.action == 'list':
return Area.objects.filter(parent=None)
else:
... | stack_v2_sparse_classes_75kplus_train_069038 | 1,439 | permissive | [
{
"docstring": "提供数据集",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "提供序列化器",
"name": "get_serializer_class",
"signature": "def get_serializer_class(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003506 | Implement the Python class `AreaViewSet` described below.
Class description:
Implement the AreaViewSet class.
Method signatures and docstrings:
- def get_queryset(self): 提供数据集
- def get_serializer_class(self): 提供序列化器 | Implement the Python class `AreaViewSet` described below.
Class description:
Implement the AreaViewSet class.
Method signatures and docstrings:
- def get_queryset(self): 提供数据集
- def get_serializer_class(self): 提供序列化器
<|skeleton|>
class AreaViewSet:
def get_queryset(self):
"""提供数据集"""
<|body_0|>
... | 5fc4d9930b0cd1e115f8c6ebf51cd9e28922d263 | <|skeleton|>
class AreaViewSet:
def get_queryset(self):
"""提供数据集"""
<|body_0|>
def get_serializer_class(self):
"""提供序列化器"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AreaViewSet:
def get_queryset(self):
"""提供数据集"""
if self.action == 'list':
return Area.objects.filter(parent=None)
else:
return Area.objects.all()
def get_serializer_class(self):
"""提供序列化器"""
if self.action == 'list':
return Area... | the_stack_v2_python_sparse | meiduo/meiduo_mall/meiduo_mall/apps/areas/views.py | Highsir/Simplestore | train | 1 | |
6469d64b29c5607b40ea6c5a6ffe491effe4ea2a | [
"args = args.split()\nif _debug:\n TestConsoleCmd._debug('do_test %r', args)\ndate_string, time_string = args\ntest_date = Date(date_string).value\ntest_time = Time(time_string).value\nfor so in schedule_objects:\n v, t = so._task.eval(test_date, test_time)\n print(so.objectName + ', ' + repr(v and v.value... | <|body_start_0|>
args = args.split()
if _debug:
TestConsoleCmd._debug('do_test %r', args)
date_string, time_string = args
test_date = Date(date_string).value
test_time = Time(time_string).value
for so in schedule_objects:
v, t = so._task.eval(test_... | TestConsoleCmd | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestConsoleCmd:
def do_test(self, args):
"""test <date> <time>"""
<|body_0|>
def do_now(self, args):
"""now"""
<|body_1|>
def do_dc(self, args):
"""dc"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
args = args.split()
i... | stack_v2_sparse_classes_75kplus_train_069039 | 9,917 | permissive | [
{
"docstring": "test <date> <time>",
"name": "do_test",
"signature": "def do_test(self, args)"
},
{
"docstring": "now",
"name": "do_now",
"signature": "def do_now(self, args)"
},
{
"docstring": "dc",
"name": "do_dc",
"signature": "def do_dc(self, args)"
}
] | 3 | null | Implement the Python class `TestConsoleCmd` described below.
Class description:
Implement the TestConsoleCmd class.
Method signatures and docstrings:
- def do_test(self, args): test <date> <time>
- def do_now(self, args): now
- def do_dc(self, args): dc | Implement the Python class `TestConsoleCmd` described below.
Class description:
Implement the TestConsoleCmd class.
Method signatures and docstrings:
- def do_test(self, args): test <date> <time>
- def do_now(self, args): now
- def do_dc(self, args): dc
<|skeleton|>
class TestConsoleCmd:
def do_test(self, args)... | a5be2ad5ac69821c12299716b167dd52041b5342 | <|skeleton|>
class TestConsoleCmd:
def do_test(self, args):
"""test <date> <time>"""
<|body_0|>
def do_now(self, args):
"""now"""
<|body_1|>
def do_dc(self, args):
"""dc"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestConsoleCmd:
def do_test(self, args):
"""test <date> <time>"""
args = args.split()
if _debug:
TestConsoleCmd._debug('do_test %r', args)
date_string, time_string = args
test_date = Date(date_string).value
test_time = Time(time_string).value
... | the_stack_v2_python_sparse | samples/LocalScheduleObject1.py | JoelBender/bacpypes | train | 284 | |
640ad988ac1670146cea1f826f36d522fd636ce1 | [
"self.screen_width = 1100\nself.screen_height = 650\nself.bg_color = (230, 230, 230)\nself.ship_limit = 3\nself.bullet_speed_factor = 3\nself.bullet_width = 500\nself.bullet_height = 15\nself.bullet_color = (60, 60, 60)\nself.bullets_allowed = 3\nself.fleet_drop_speed = 10\nself.speedup_scale = 1.1\nself.score_scal... | <|body_start_0|>
self.screen_width = 1100
self.screen_height = 650
self.bg_color = (230, 230, 230)
self.ship_limit = 3
self.bullet_speed_factor = 3
self.bullet_width = 500
self.bullet_height = 15
self.bullet_color = (60, 60, 60)
self.bullets_allowe... | 存储项目的所有设置的类 | Settings | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Settings:
"""存储项目的所有设置的类"""
def __init__(self):
"""初始化游戏的设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""初始化随游戏进行而变化的设置"""
<|body_1|>
def increase_speed(self):
"""提高速度设置和外星人得分点数"""
<|body_2|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_75kplus_train_069040 | 1,491 | no_license | [
{
"docstring": "初始化游戏的设置",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "初始化随游戏进行而变化的设置",
"name": "initialize_dynamic_settings",
"signature": "def initialize_dynamic_settings(self)"
},
{
"docstring": "提高速度设置和外星人得分点数",
"name": "increase_speed",
"... | 3 | stack_v2_sparse_classes_30k_train_008942 | Implement the Python class `Settings` described below.
Class description:
存储项目的所有设置的类
Method signatures and docstrings:
- def __init__(self): 初始化游戏的设置
- def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置
- def increase_speed(self): 提高速度设置和外星人得分点数 | Implement the Python class `Settings` described below.
Class description:
存储项目的所有设置的类
Method signatures and docstrings:
- def __init__(self): 初始化游戏的设置
- def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置
- def increase_speed(self): 提高速度设置和外星人得分点数
<|skeleton|>
class Settings:
"""存储项目的所有设置的类"""
def __init_... | 0bf5ce19d4282dcc615ae4e939893c1017fab1fd | <|skeleton|>
class Settings:
"""存储项目的所有设置的类"""
def __init__(self):
"""初始化游戏的设置"""
<|body_0|>
def initialize_dynamic_settings(self):
"""初始化随游戏进行而变化的设置"""
<|body_1|>
def increase_speed(self):
"""提高速度设置和外星人得分点数"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Settings:
"""存储项目的所有设置的类"""
def __init__(self):
"""初始化游戏的设置"""
self.screen_width = 1100
self.screen_height = 650
self.bg_color = (230, 230, 230)
self.ship_limit = 3
self.bullet_speed_factor = 3
self.bullet_width = 500
self.bullet_height = 15... | the_stack_v2_python_sparse | alien_invasion/settings.py | 957739315/little-items | train | 0 |
ac0161de90c9246f28e6c132b8e1475d3af8c24f | [
"table = getattr(self, model + '_table', None)\nself.default_r_v = None\nif table is None:\n raise AttributeError('%s model not available' % model)\nself.table = table()\nself.range = (min(self.table[0]), max(self.table[0]))\nself.arange = (self.range[0] * 10000.0, self.range[1] * 10000.0)\nself.sigma = sigma\ns... | <|body_start_0|>
table = getattr(self, model + '_table', None)
self.default_r_v = None
if table is None:
raise AttributeError('%s model not available' % model)
self.table = table()
self.range = (min(self.table[0]), max(self.table[0]))
self.arange = (self.range... | Extinction model for de-reddening spectra. | ExtinctionModel | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExtinctionModel:
"""Extinction model for de-reddening spectra."""
def __init__(self, model='rieke1989', cval=np.nan, sigma=10.0, extrapolate=False):
"""Set extinction model. Parameters ---------- model : {'rieke1989', 'nishiyama2009'} Model to use. Options are `rieke1989_table` and `... | stack_v2_sparse_classes_75kplus_train_069041 | 3,929 | permissive | [
{
"docstring": "Set extinction model. Parameters ---------- model : {'rieke1989', 'nishiyama2009'} Model to use. Options are `rieke1989_table` and `nishiyama2009_table`. cval : float, optional Value to fill for missing data. sigma : float, optional Spline fit tension. extrapolate : bool, optional If set, missin... | 4 | stack_v2_sparse_classes_30k_train_006927 | Implement the Python class `ExtinctionModel` described below.
Class description:
Extinction model for de-reddening spectra.
Method signatures and docstrings:
- def __init__(self, model='rieke1989', cval=np.nan, sigma=10.0, extrapolate=False): Set extinction model. Parameters ---------- model : {'rieke1989', 'nishiyam... | Implement the Python class `ExtinctionModel` described below.
Class description:
Extinction model for de-reddening spectra.
Method signatures and docstrings:
- def __init__(self, model='rieke1989', cval=np.nan, sigma=10.0, extrapolate=False): Set extinction model. Parameters ---------- model : {'rieke1989', 'nishiyam... | 493700340cd34d5f319af6f3a562a82135bb30dd | <|skeleton|>
class ExtinctionModel:
"""Extinction model for de-reddening spectra."""
def __init__(self, model='rieke1989', cval=np.nan, sigma=10.0, extrapolate=False):
"""Set extinction model. Parameters ---------- model : {'rieke1989', 'nishiyama2009'} Model to use. Options are `rieke1989_table` and `... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExtinctionModel:
"""Extinction model for de-reddening spectra."""
def __init__(self, model='rieke1989', cval=np.nan, sigma=10.0, extrapolate=False):
"""Set extinction model. Parameters ---------- model : {'rieke1989', 'nishiyama2009'} Model to use. Options are `rieke1989_table` and `nishiyama2009... | the_stack_v2_python_sparse | sofia_redux/spectroscopy/extinction_model.py | SOFIA-USRA/sofia_redux | train | 12 |
d4d8a7b33f3e1759fa6246105510cf6df0ea5c6e | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Provide component information such as parameters. | ComponentInformationServerServiceServicer | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ComponentInformationServerServiceServicer:
"""Provide component information such as parameters."""
def ProvideFloatParam(self, request, context):
"""Provide a param of type float."""
<|body_0|>
def SubscribeFloatParam(self, request, context):
"""Subscribe to floa... | stack_v2_sparse_classes_75kplus_train_069042 | 5,270 | permissive | [
{
"docstring": "Provide a param of type float.",
"name": "ProvideFloatParam",
"signature": "def ProvideFloatParam(self, request, context)"
},
{
"docstring": "Subscribe to float param updates.",
"name": "SubscribeFloatParam",
"signature": "def SubscribeFloatParam(self, request, context)"
... | 2 | null | Implement the Python class `ComponentInformationServerServiceServicer` described below.
Class description:
Provide component information such as parameters.
Method signatures and docstrings:
- def ProvideFloatParam(self, request, context): Provide a param of type float.
- def SubscribeFloatParam(self, request, contex... | Implement the Python class `ComponentInformationServerServiceServicer` described below.
Class description:
Provide component information such as parameters.
Method signatures and docstrings:
- def ProvideFloatParam(self, request, context): Provide a param of type float.
- def SubscribeFloatParam(self, request, contex... | ac985f523cadefbe85ed0524e0b4779392678e9a | <|skeleton|>
class ComponentInformationServerServiceServicer:
"""Provide component information such as parameters."""
def ProvideFloatParam(self, request, context):
"""Provide a param of type float."""
<|body_0|>
def SubscribeFloatParam(self, request, context):
"""Subscribe to floa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ComponentInformationServerServiceServicer:
"""Provide component information such as parameters."""
def ProvideFloatParam(self, request, context):
"""Provide a param of type float."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
... | the_stack_v2_python_sparse | mavsdk/component_information_server_pb2_grpc.py | crisdeodates/UAV-MAVSDK-Python | train | 0 |
c8c167fbdd037939a14fa5513837bc841fe4de63 | [
"products = Product.objects.all()\nserializer = ProductSerializer(products, many=True)\nreturn Response({'products': serializer.data})",
"with open('/home/roman/work/log.txt', 'a') as log:\n log.write(json.dumps(request.COOKIES))\nproduct_id = request.data.get('id')\nsaved_product = get_object_or_404(Product.o... | <|body_start_0|>
products = Product.objects.all()
serializer = ProductSerializer(products, many=True)
return Response({'products': serializer.data})
<|end_body_0|>
<|body_start_1|>
with open('/home/roman/work/log.txt', 'a') as log:
log.write(json.dumps(request.COOKIES))
... | Implementation CRUD api operation | ShopView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShopView:
"""Implementation CRUD api operation"""
def get(self, request):
"""Returns the entire list of products as json"""
<|body_0|>
def post(self, request):
"""Updates product with the passed id"""
<|body_1|>
def put(self, request):
"""Add... | stack_v2_sparse_classes_75kplus_train_069043 | 3,031 | no_license | [
{
"docstring": "Returns the entire list of products as json",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Updates product with the passed id",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "Adds a new product to the store",
... | 4 | stack_v2_sparse_classes_30k_train_003895 | Implement the Python class `ShopView` described below.
Class description:
Implementation CRUD api operation
Method signatures and docstrings:
- def get(self, request): Returns the entire list of products as json
- def post(self, request): Updates product with the passed id
- def put(self, request): Adds a new product... | Implement the Python class `ShopView` described below.
Class description:
Implementation CRUD api operation
Method signatures and docstrings:
- def get(self, request): Returns the entire list of products as json
- def post(self, request): Updates product with the passed id
- def put(self, request): Adds a new product... | 8e6f4134a4bfdf7b14da6de937123a29d159220e | <|skeleton|>
class ShopView:
"""Implementation CRUD api operation"""
def get(self, request):
"""Returns the entire list of products as json"""
<|body_0|>
def post(self, request):
"""Updates product with the passed id"""
<|body_1|>
def put(self, request):
"""Add... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ShopView:
"""Implementation CRUD api operation"""
def get(self, request):
"""Returns the entire list of products as json"""
products = Product.objects.all()
serializer = ProductSerializer(products, many=True)
return Response({'products': serializer.data})
def post(sel... | the_stack_v2_python_sparse | HW_7/mastersporta/shop/views.py | romko11l/Sphere-HW | train | 0 |
5d913f86650247fae808dde41d3aaf5035ae2f37 | [
"super(COG, self).__init__(INF, ACC, *args, **keywords)\nself.failsafe = failsafe\nself.segment_size = segment_size",
"temp = self.accumulate(variable, self.segment_size)\ntry:\n return temp.getCOG()\nexcept:\n if self.failsafe is not None:\n return self.failsafe\n else:\n raise"
] | <|body_start_0|>
super(COG, self).__init__(INF, ACC, *args, **keywords)
self.failsafe = failsafe
self.segment_size = segment_size
<|end_body_0|>
<|body_start_1|>
temp = self.accumulate(variable, self.segment_size)
try:
return temp.getCOG()
except:
... | defuzzification which uses the center of gravity method. | COG | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class COG:
"""defuzzification which uses the center of gravity method."""
def __init__(self, INF=None, ACC=None, failsafe=None, segment_size=None, *args, **keywords):
"""@param failsafe: if is not possible to calculate a center of gravity, return this value if not None or forward the excep... | stack_v2_sparse_classes_75kplus_train_069044 | 2,015 | no_license | [
{
"docstring": "@param failsafe: if is not possible to calculate a center of gravity, return this value if not None or forward the exception @param segment_size: maximum length of segment in polygon of accumulated result set",
"name": "__init__",
"signature": "def __init__(self, INF=None, ACC=None, fail... | 2 | stack_v2_sparse_classes_30k_train_017643 | Implement the Python class `COG` described below.
Class description:
defuzzification which uses the center of gravity method.
Method signatures and docstrings:
- def __init__(self, INF=None, ACC=None, failsafe=None, segment_size=None, *args, **keywords): @param failsafe: if is not possible to calculate a center of gr... | Implement the Python class `COG` described below.
Class description:
defuzzification which uses the center of gravity method.
Method signatures and docstrings:
- def __init__(self, INF=None, ACC=None, failsafe=None, segment_size=None, *args, **keywords): @param failsafe: if is not possible to calculate a center of gr... | a8b38d9801cac548adc4b42472aeba93eead414d | <|skeleton|>
class COG:
"""defuzzification which uses the center of gravity method."""
def __init__(self, INF=None, ACC=None, failsafe=None, segment_size=None, *args, **keywords):
"""@param failsafe: if is not possible to calculate a center of gravity, return this value if not None or forward the excep... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class COG:
"""defuzzification which uses the center of gravity method."""
def __init__(self, INF=None, ACC=None, failsafe=None, segment_size=None, *args, **keywords):
"""@param failsafe: if is not possible to calculate a center of gravity, return this value if not None or forward the exception @param s... | the_stack_v2_python_sparse | Redist/pyfuzzy/defuzzify/COG.py | matcom/simspider | train | 0 |
f94f13bdc2496c726a5ec344fef0b2274ee8e13c | [
"self.NAME = EVITA\nself.tarsqidoc = tarsqidoc\nself.docelement = docelement\nself.doctree = None\nself.imported_events = imported_events",
"self.doctree = create_tarsqi_tree(self.tarsqidoc, self.docelement)\nfor sentence in self.doctree:\n logger.debug('SENTENCE: %s' % get_words_as_string(sentence))\n for ... | <|body_start_0|>
self.NAME = EVITA
self.tarsqidoc = tarsqidoc
self.docelement = docelement
self.doctree = None
self.imported_events = imported_events
<|end_body_0|>
<|body_start_1|>
self.doctree = create_tarsqi_tree(self.tarsqidoc, self.docelement)
for sentence i... | Class that implements Evita's event recognizer. Instance variables contain the name of the component, the TarsqiDocument, a docelement Tag and a TarsqiTree instance. The TarsqiTree instance in the doctree variable is the tree for just one element and not for the whole document or string. | Evita | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Evita:
"""Class that implements Evita's event recognizer. Instance variables contain the name of the component, the TarsqiDocument, a docelement Tag and a TarsqiTree instance. The TarsqiTree instance in the doctree variable is the tree for just one element and not for the whole document or string... | stack_v2_sparse_classes_75kplus_train_069045 | 1,998 | permissive | [
{
"docstring": "Set the NAME instance variable. The doctree variables is filled in during processing.",
"name": "__init__",
"signature": "def __init__(self, tarsqidoc, docelement, imported_events)"
},
{
"docstring": "Process the element slice of the TarsqiDocument. Loop through all sentences in ... | 2 | stack_v2_sparse_classes_30k_train_030254 | Implement the Python class `Evita` described below.
Class description:
Class that implements Evita's event recognizer. Instance variables contain the name of the component, the TarsqiDocument, a docelement Tag and a TarsqiTree instance. The TarsqiTree instance in the doctree variable is the tree for just one element a... | Implement the Python class `Evita` described below.
Class description:
Class that implements Evita's event recognizer. Instance variables contain the name of the component, the TarsqiDocument, a docelement Tag and a TarsqiTree instance. The TarsqiTree instance in the doctree variable is the tree for just one element a... | 085007047ab591426d5c08b123906c070deb6627 | <|skeleton|>
class Evita:
"""Class that implements Evita's event recognizer. Instance variables contain the name of the component, the TarsqiDocument, a docelement Tag and a TarsqiTree instance. The TarsqiTree instance in the doctree variable is the tree for just one element and not for the whole document or string... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Evita:
"""Class that implements Evita's event recognizer. Instance variables contain the name of the component, the TarsqiDocument, a docelement Tag and a TarsqiTree instance. The TarsqiTree instance in the doctree variable is the tree for just one element and not for the whole document or string."""
def... | the_stack_v2_python_sparse | components/evita/main.py | tarsqi/ttk | train | 26 |
11331107fe0ce95c76bcbab6a19bd133db27cb35 | [
"if int(pool_size) > 1:\n log.warn('Parallel partitioning using not supported yet')\nself.pool_size = 1",
"n = len(input_files)\nlog.info('Partition {0} files to {1}'.format(n, output_dir))\nif len(output_prefix) > 0 and (not output_prefix.endswith('_')):\n output_prefix += '_'\nstart = 0\nwhile start <= le... | <|body_start_0|>
if int(pool_size) > 1:
log.warn('Parallel partitioning using not supported yet')
self.pool_size = 1
<|end_body_0|>
<|body_start_1|>
n = len(input_files)
log.info('Partition {0} files to {1}'.format(n, output_dir))
if len(output_prefix) > 0 and (not o... | handles the partitioning job | PartitionEngine | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PartitionEngine:
"""handles the partitioning job"""
def __init__(self, pool_size=1):
"""pool_size: number of processes used for partitioning. currently only 1 process can be used. further the result will not be compressed."""
<|body_0|>
def Partition(self, input_files, o... | stack_v2_sparse_classes_75kplus_train_069046 | 7,956 | permissive | [
{
"docstring": "pool_size: number of processes used for partitioning. currently only 1 process can be used. further the result will not be compressed.",
"name": "__init__",
"signature": "def __init__(self, pool_size=1)"
},
{
"docstring": "read input_files, output records with the same key into t... | 2 | null | Implement the Python class `PartitionEngine` described below.
Class description:
handles the partitioning job
Method signatures and docstrings:
- def __init__(self, pool_size=1): pool_size: number of processes used for partitioning. currently only 1 process can be used. further the result will not be compressed.
- de... | Implement the Python class `PartitionEngine` described below.
Class description:
handles the partitioning job
Method signatures and docstrings:
- def __init__(self, pool_size=1): pool_size: number of processes used for partitioning. currently only 1 process can be used. further the result will not be compressed.
- de... | cf89cff095b542371d10af976fc687a3fb1da471 | <|skeleton|>
class PartitionEngine:
"""handles the partitioning job"""
def __init__(self, pool_size=1):
"""pool_size: number of processes used for partitioning. currently only 1 process can be used. further the result will not be compressed."""
<|body_0|>
def Partition(self, input_files, o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PartitionEngine:
"""handles the partitioning job"""
def __init__(self, pool_size=1):
"""pool_size: number of processes used for partitioning. currently only 1 process can be used. further the result will not be compressed."""
if int(pool_size) > 1:
log.warn('Parallel partition... | the_stack_v2_python_sparse | ex/pp/mr.py | excelly/xpy-ml | train | 0 |
b9bc4e1bec1d5c723245e51ce18fee955d073376 | [
"api_instance = bkuser_sdk.CategoriesApi(self.get_api_client_by_request(request, no_auth=True))\ncategories = self.get_paging_results(api_instance.v2_categories_list)\nreturn {x['id']: x for x in categories}",
"target_start_time = make_aware(validated_data['start_time'] + get_timezone_offset())\ntarget_end_time =... | <|body_start_0|>
api_instance = bkuser_sdk.CategoriesApi(self.get_api_client_by_request(request, no_auth=True))
categories = self.get_paging_results(api_instance.v2_categories_list)
return {x['id']: x for x in categories}
<|end_body_0|>
<|body_start_1|>
target_start_time = make_aware(va... | AuditLogViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AuditLogViewSet:
def _get_categories_map(self, request) -> dict:
"""Get categories id map"""
<|body_0|>
def _get_request_params(validated_data: dict) -> dict:
"""Get params from validated_data"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
api_inst... | stack_v2_sparse_classes_75kplus_train_069047 | 5,862 | permissive | [
{
"docstring": "Get categories id map",
"name": "_get_categories_map",
"signature": "def _get_categories_map(self, request) -> dict"
},
{
"docstring": "Get params from validated_data",
"name": "_get_request_params",
"signature": "def _get_request_params(validated_data: dict) -> dict"
}... | 2 | null | Implement the Python class `AuditLogViewSet` described below.
Class description:
Implement the AuditLogViewSet class.
Method signatures and docstrings:
- def _get_categories_map(self, request) -> dict: Get categories id map
- def _get_request_params(validated_data: dict) -> dict: Get params from validated_data | Implement the Python class `AuditLogViewSet` described below.
Class description:
Implement the AuditLogViewSet class.
Method signatures and docstrings:
- def _get_categories_map(self, request) -> dict: Get categories id map
- def _get_request_params(validated_data: dict) -> dict: Get params from validated_data
<|ske... | 8c633e0a3821beb839ed120c4514c5733e675862 | <|skeleton|>
class AuditLogViewSet:
def _get_categories_map(self, request) -> dict:
"""Get categories id map"""
<|body_0|>
def _get_request_params(validated_data: dict) -> dict:
"""Get params from validated_data"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AuditLogViewSet:
def _get_categories_map(self, request) -> dict:
"""Get categories id map"""
api_instance = bkuser_sdk.CategoriesApi(self.get_api_client_by_request(request, no_auth=True))
categories = self.get_paging_results(api_instance.v2_categories_list)
return {x['id']: x f... | the_stack_v2_python_sparse | src/saas/bkuser_shell/audit/views.py | robert871126/bk-user | train | 0 | |
a6ce87467162a857164874c9a4eac369b1cb143a | [
"expected = {'weather': 1, 'sunny': 1, 'man': 1, 'happy': 1}\nactual = calculate_frequencies(['weather', 'sunny', 'man', 'happy'])\nself.assertEqual(expected, actual)",
"expected = {'weather': 2, 'sunny': 1, 'man': 2, 'happy': 1}\nactual = calculate_frequencies(['weather', 'sunny', 'man', 'happy', 'weather', 'man... | <|body_start_0|>
expected = {'weather': 1, 'sunny': 1, 'man': 1, 'happy': 1}
actual = calculate_frequencies(['weather', 'sunny', 'man', 'happy'])
self.assertEqual(expected, actual)
<|end_body_0|>
<|body_start_1|>
expected = {'weather': 2, 'sunny': 1, 'man': 2, 'happy': 1}
actual... | Tests calculating frequencies function | CalculateFrequenciesTest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CalculateFrequenciesTest:
"""Tests calculating frequencies function"""
def test_calculate_frequencies_ideal(self):
"""Ideal calculate frequencies scenario"""
<|body_0|>
def test_calculate_frequencies_complex(self):
"""Calculate frequencies with several same token... | stack_v2_sparse_classes_75kplus_train_069048 | 1,669 | permissive | [
{
"docstring": "Ideal calculate frequencies scenario",
"name": "test_calculate_frequencies_ideal",
"signature": "def test_calculate_frequencies_ideal(self)"
},
{
"docstring": "Calculate frequencies with several same tokens",
"name": "test_calculate_frequencies_complex",
"signature": "def... | 4 | null | Implement the Python class `CalculateFrequenciesTest` described below.
Class description:
Tests calculating frequencies function
Method signatures and docstrings:
- def test_calculate_frequencies_ideal(self): Ideal calculate frequencies scenario
- def test_calculate_frequencies_complex(self): Calculate frequencies wi... | Implement the Python class `CalculateFrequenciesTest` described below.
Class description:
Tests calculating frequencies function
Method signatures and docstrings:
- def test_calculate_frequencies_ideal(self): Ideal calculate frequencies scenario
- def test_calculate_frequencies_complex(self): Calculate frequencies wi... | ada4bec878dd1cbc19058cb4e87893946ae21498 | <|skeleton|>
class CalculateFrequenciesTest:
"""Tests calculating frequencies function"""
def test_calculate_frequencies_ideal(self):
"""Ideal calculate frequencies scenario"""
<|body_0|>
def test_calculate_frequencies_complex(self):
"""Calculate frequencies with several same token... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CalculateFrequenciesTest:
"""Tests calculating frequencies function"""
def test_calculate_frequencies_ideal(self):
"""Ideal calculate frequencies scenario"""
expected = {'weather': 1, 'sunny': 1, 'man': 1, 'happy': 1}
actual = calculate_frequencies(['weather', 'sunny', 'man', 'hap... | the_stack_v2_python_sparse | lab_1/calculate_frequencies_test.py | WhiteJaeger/2020-2-level-labs | train | 0 |
1003b24f302c47e93747ee595008d4e12d354789 | [
"if len(nums) < 2:\n return 0\nmin_v = min(nums)\nmax_v = max(nums)\nbucket_number = len(nums) + 1\nbucket_size = (max_v - min_v) / (bucket_number - 1)\nif bucket_size == 0:\n return 0\nbucket_list = []\nfor i in range(bucket_number):\n bucket_list.append(Bucket(i))\nfor num in nums:\n bucket_list[int((... | <|body_start_0|>
if len(nums) < 2:
return 0
min_v = min(nums)
max_v = max(nums)
bucket_number = len(nums) + 1
bucket_size = (max_v - min_v) / (bucket_number - 1)
if bucket_size == 0:
return 0
bucket_list = []
for i in range(bucket_n... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maximumGap1(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(nums) < 2:
return 0
... | stack_v2_sparse_classes_75kplus_train_069049 | 2,796 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maximumGap",
"signature": "def maximumGap(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maximumGap1",
"signature": "def maximumGap1(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016015 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumGap(self, nums): :type nums: List[int] :rtype: int
- def maximumGap1(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumGap(self, nums): :type nums: List[int] :rtype: int
- def maximumGap1(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def maximumGap(s... | 2c47abbf020f44c97e7e439735e4b0d49f3b843f | <|skeleton|>
class Solution:
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maximumGap1(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maximumGap(self, nums):
""":type nums: List[int] :rtype: int"""
if len(nums) < 2:
return 0
min_v = min(nums)
max_v = max(nums)
bucket_number = len(nums) + 1
bucket_size = (max_v - min_v) / (bucket_number - 1)
if bucket_size == 0... | the_stack_v2_python_sparse | LeetCode/LeetCode164maximum-gap.py | weiguangjiayou/LeetCode | train | 0 | |
95f60aa5be532451c654bdb2000de35afc308b87 | [
"self.pull(source_file='/sdcard/Android/data/com.abupdate.fota_demo_iot/cache/iport_log.txt', target_path=target_path)\nif os.path.isfile(target_path):\n return target_path\nelse:\n iportLog_file = '/'.join([target_path, 'iport_log.txt'])\n return iportLog_file",
"with open(iportLog_file, 'r', encoding='... | <|body_start_0|>
self.pull(source_file='/sdcard/Android/data/com.abupdate.fota_demo_iot/cache/iport_log.txt', target_path=target_path)
if os.path.isfile(target_path):
return target_path
else:
iportLog_file = '/'.join([target_path, 'iport_log.txt'])
return ipor... | G4 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class G4:
def pull_iportLog(self, target_path):
"""导出设备iport日志 :return:返回iport日志的绝对路径"""
<|body_0|>
def next_check_time(self, iportLog_file):
"""获取下次fota升级周期检测的时间 :param: iportLog_file:iport日志的绝对路径 :return: next_check_time:下次周期检测的时间 next_check_timestamp:下次周期检测时间的时间戳"""
... | stack_v2_sparse_classes_75kplus_train_069050 | 41,889 | no_license | [
{
"docstring": "导出设备iport日志 :return:返回iport日志的绝对路径",
"name": "pull_iportLog",
"signature": "def pull_iportLog(self, target_path)"
},
{
"docstring": "获取下次fota升级周期检测的时间 :param: iportLog_file:iport日志的绝对路径 :return: next_check_time:下次周期检测的时间 next_check_timestamp:下次周期检测时间的时间戳",
"name": "next_check... | 3 | null | Implement the Python class `G4` described below.
Class description:
Implement the G4 class.
Method signatures and docstrings:
- def pull_iportLog(self, target_path): 导出设备iport日志 :return:返回iport日志的绝对路径
- def next_check_time(self, iportLog_file): 获取下次fota升级周期检测的时间 :param: iportLog_file:iport日志的绝对路径 :return: next_check_... | Implement the Python class `G4` described below.
Class description:
Implement the G4 class.
Method signatures and docstrings:
- def pull_iportLog(self, target_path): 导出设备iport日志 :return:返回iport日志的绝对路径
- def next_check_time(self, iportLog_file): 获取下次fota升级周期检测的时间 :param: iportLog_file:iport日志的绝对路径 :return: next_check_... | 6b338d18a75c28781efd19d0984ba604a4574c82 | <|skeleton|>
class G4:
def pull_iportLog(self, target_path):
"""导出设备iport日志 :return:返回iport日志的绝对路径"""
<|body_0|>
def next_check_time(self, iportLog_file):
"""获取下次fota升级周期检测的时间 :param: iportLog_file:iport日志的绝对路径 :return: next_check_time:下次周期检测的时间 next_check_timestamp:下次周期检测时间的时间戳"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class G4:
def pull_iportLog(self, target_path):
"""导出设备iport日志 :return:返回iport日志的绝对路径"""
self.pull(source_file='/sdcard/Android/data/com.abupdate.fota_demo_iot/cache/iport_log.txt', target_path=target_path)
if os.path.isfile(target_path):
return target_path
else:
... | the_stack_v2_python_sparse | common/models.py | xuhonga1216/ucloudlink | train | 0 | |
eec1fe6596707cec2607002c0eaefec805e6f255 | [
"self.config = config_\nself.logger = logging.getLogger('cuda_logger')\ndata_provider = DataProvider(self.config)\nfilename = self.config['city_state_creator'].get('filename', 'city_states.dill')\nself.city_states = data_provider.read_city_states(filename)\nself.reg_models = data_provider.read_regression_models()",... | <|body_start_0|>
self.config = config_
self.logger = logging.getLogger('cuda_logger')
data_provider = DataProvider(self.config)
filename = self.config['city_state_creator'].get('filename', 'city_states.dill')
self.city_states = data_provider.read_city_states(filename)
sel... | Fills up sparse city state matrices | SparseMatrixFiller | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SparseMatrixFiller:
"""Fills up sparse city state matrices"""
def __init__(self, config_):
"""Constructor :param config_: :return:"""
<|body_0|>
def fill_matrices(self):
"""Fills up sparse matrices :param: :return:"""
<|body_1|>
def fill_rewards_matr... | stack_v2_sparse_classes_75kplus_train_069051 | 5,073 | no_license | [
{
"docstring": "Constructor :param config_: :return:",
"name": "__init__",
"signature": "def __init__(self, config_)"
},
{
"docstring": "Fills up sparse matrices :param: :return:",
"name": "fill_matrices",
"signature": "def fill_matrices(self)"
},
{
"docstring": "Fills missing en... | 6 | stack_v2_sparse_classes_30k_test_001783 | Implement the Python class `SparseMatrixFiller` described below.
Class description:
Fills up sparse city state matrices
Method signatures and docstrings:
- def __init__(self, config_): Constructor :param config_: :return:
- def fill_matrices(self): Fills up sparse matrices :param: :return:
- def fill_rewards_matrix(s... | Implement the Python class `SparseMatrixFiller` described below.
Class description:
Fills up sparse city state matrices
Method signatures and docstrings:
- def __init__(self, config_): Constructor :param config_: :return:
- def fill_matrices(self): Fills up sparse matrices :param: :return:
- def fill_rewards_matrix(s... | f7fcd2cc1d6ba18b199d176d4d39193f025ee281 | <|skeleton|>
class SparseMatrixFiller:
"""Fills up sparse city state matrices"""
def __init__(self, config_):
"""Constructor :param config_: :return:"""
<|body_0|>
def fill_matrices(self):
"""Fills up sparse matrices :param: :return:"""
<|body_1|>
def fill_rewards_matr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SparseMatrixFiller:
"""Fills up sparse city state matrices"""
def __init__(self, config_):
"""Constructor :param config_: :return:"""
self.config = config_
self.logger = logging.getLogger('cuda_logger')
data_provider = DataProvider(self.config)
filename = self.conf... | the_stack_v2_python_sparse | learn_to_earn_framework/sparse_matrices/fill_sparse_matrices.py | transparent-framework/optimize-ride-sharing-earnings | train | 7 |
0d7435c9c3f78fea8212d02288beb662458c31ff | [
"badge = get_object_or_404(Badge, pk=badge_id)\nserializer = BadgeSerializer(badge)\nreturn Response(serializer.data)",
"badge = get_object_or_404(Badge, pk=badge_id)\nserializer = BadgeSerializer(badge, data=request.data)\nif serializer.is_valid():\n serializer.save()\n return Response(serializer.data)\nre... | <|body_start_0|>
badge = get_object_or_404(Badge, pk=badge_id)
serializer = BadgeSerializer(badge)
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
badge = get_object_or_404(Badge, pk=badge_id)
serializer = BadgeSerializer(badge, data=request.data)
if ser... | BagdeDetail | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BagdeDetail:
def get(self, request, badge_id, format=None):
"""Get badge details"""
<|body_0|>
def put(self, request, badge_id, format=None):
"""Edit badge --- serializer: administrator.serializers.BadgeSerializer"""
<|body_1|>
def delete(self, request, ... | stack_v2_sparse_classes_75kplus_train_069052 | 30,608 | permissive | [
{
"docstring": "Get badge details",
"name": "get",
"signature": "def get(self, request, badge_id, format=None)"
},
{
"docstring": "Edit badge --- serializer: administrator.serializers.BadgeSerializer",
"name": "put",
"signature": "def put(self, request, badge_id, format=None)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_019316 | Implement the Python class `BagdeDetail` described below.
Class description:
Implement the BagdeDetail class.
Method signatures and docstrings:
- def get(self, request, badge_id, format=None): Get badge details
- def put(self, request, badge_id, format=None): Edit badge --- serializer: administrator.serializers.Badge... | Implement the Python class `BagdeDetail` described below.
Class description:
Implement the BagdeDetail class.
Method signatures and docstrings:
- def get(self, request, badge_id, format=None): Get badge details
- def put(self, request, badge_id, format=None): Edit badge --- serializer: administrator.serializers.Badge... | 73728463badb3bfd4413aa0f7aeb44a9606fdfea | <|skeleton|>
class BagdeDetail:
def get(self, request, badge_id, format=None):
"""Get badge details"""
<|body_0|>
def put(self, request, badge_id, format=None):
"""Edit badge --- serializer: administrator.serializers.BadgeSerializer"""
<|body_1|>
def delete(self, request, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BagdeDetail:
def get(self, request, badge_id, format=None):
"""Get badge details"""
badge = get_object_or_404(Badge, pk=badge_id)
serializer = BadgeSerializer(badge)
return Response(serializer.data)
def put(self, request, badge_id, format=None):
"""Edit badge --- s... | the_stack_v2_python_sparse | administrator/views.py | belatrix/BackendAllStars | train | 5 | |
5ffe2ba1dd325b0a8488a81e4a0f539e86c069b4 | [
"self.sumList = []\na = 0\nfor num in nums:\n a += num\n self.sumList.append(a)",
"if i == 0:\n return self.sumList[j]\nreturn self.sumList[j] - self.sumList[i - 1]"
] | <|body_start_0|>
self.sumList = []
a = 0
for num in nums:
a += num
self.sumList.append(a)
<|end_body_0|>
<|body_start_1|>
if i == 0:
return self.sumList[j]
return self.sumList[j] - self.sumList[i - 1]
<|end_body_1|>
| 记录一个累和数组 | NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
"""记录一个累和数组"""
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|>
self.sumList = []
a = 0
... | stack_v2_sparse_classes_75kplus_train_069053 | 645 | no_license | [
{
"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_036554 | Implement the Python class `NumArray` described below.
Class 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 `NumArray` described below.
Class 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 NumArray:
"""记录一个累和数组"""
def __init__(self, nums):
... | 7167f1a7c6cb16cca63675c80037682752ee2a7d | <|skeleton|>
class NumArray:
"""记录一个累和数组"""
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_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NumArray:
"""记录一个累和数组"""
def __init__(self, nums):
""":type nums: List[int]"""
self.sumList = []
a = 0
for num in nums:
a += num
self.sumList.append(a)
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
if i =... | the_stack_v2_python_sparse | Everyday/No303.py | kikihiter/LeetCode2 | train | 4 |
2518eb7195e35d009f6e743ca176176827ba628a | [
"self.log.append_text('Pushing passenger ' + p_passenger.passenger.id_text)\nDemoBinaryPusher._write_binary_file(p_passenger.passenger.attachments[0].binary_content)\np_passenger.set_pusher_status(self.__module__, QueueStatus.complete)",
"full_path = path.abspath(__file__).replace(DemoBinaryPusher._MODULE_FILE_NA... | <|body_start_0|>
self.log.append_text('Pushing passenger ' + p_passenger.passenger.id_text)
DemoBinaryPusher._write_binary_file(p_passenger.passenger.attachments[0].binary_content)
p_passenger.set_pusher_status(self.__module__, QueueStatus.complete)
<|end_body_0|>
<|body_start_1|>
full_... | Demo binary pusher class | DemoBinaryPusher | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DemoBinaryPusher:
"""Demo binary pusher class"""
def push(self, p_passenger: PassengerQueueStatus):
"""Push demonstration"""
<|body_0|>
def _write_binary_file(p_bin: bytearray):
"""Writes binary file to disk"""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_75kplus_train_069054 | 1,092 | permissive | [
{
"docstring": "Push demonstration",
"name": "push",
"signature": "def push(self, p_passenger: PassengerQueueStatus)"
},
{
"docstring": "Writes binary file to disk",
"name": "_write_binary_file",
"signature": "def _write_binary_file(p_bin: bytearray)"
}
] | 2 | null | Implement the Python class `DemoBinaryPusher` described below.
Class description:
Demo binary pusher class
Method signatures and docstrings:
- def push(self, p_passenger: PassengerQueueStatus): Push demonstration
- def _write_binary_file(p_bin: bytearray): Writes binary file to disk | Implement the Python class `DemoBinaryPusher` described below.
Class description:
Demo binary pusher class
Method signatures and docstrings:
- def push(self, p_passenger: PassengerQueueStatus): Push demonstration
- def _write_binary_file(p_bin: bytearray): Writes binary file to disk
<|skeleton|>
class DemoBinaryPush... | 0f1f290c1b061175a652c3f72efc0d091a5e08c9 | <|skeleton|>
class DemoBinaryPusher:
"""Demo binary pusher class"""
def push(self, p_passenger: PassengerQueueStatus):
"""Push demonstration"""
<|body_0|>
def _write_binary_file(p_bin: bytearray):
"""Writes binary file to disk"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DemoBinaryPusher:
"""Demo binary pusher class"""
def push(self, p_passenger: PassengerQueueStatus):
"""Push demonstration"""
self.log.append_text('Pushing passenger ' + p_passenger.passenger.id_text)
DemoBinaryPusher._write_binary_file(p_passenger.passenger.attachments[0].binary_c... | the_stack_v2_python_sparse | databus/pusher/demo/demo_binary_pusher.py | tedrepo/databus | train | 0 |
8143344e5c36dd829c02dafc0db0191b1258f8ba | [
"application = self.get_object()\nlinkedin_url = request.data.get('linkedin_url')\nresume_file = request.FILES.get('file')\nif linkedin_url is None and resume_file is None and (not application.resume_file):\n raise ValidationError('At least one form of resume is required.')\nif linkedin_url:\n self.validate_l... | <|body_start_0|>
application = self.get_object()
linkedin_url = request.data.get('linkedin_url')
resume_file = request.FILES.get('file')
if linkedin_url is None and resume_file is None and (not application.resume_file):
raise ValidationError('At least one form of resume is re... | View for uploading resume and linkedin URL | UploadResumeView | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UploadResumeView:
"""View for uploading resume and linkedin URL"""
def post(self, request, *args, **kwargs):
"""Update the application with resume and/or linkedin URL"""
<|body_0|>
def validate_linkedin_url(self, linkedin_url):
"""Validate that a LinkedIn URL has... | stack_v2_sparse_classes_75kplus_train_069055 | 9,919 | permissive | [
{
"docstring": "Update the application with resume and/or linkedin URL",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
},
{
"docstring": "Validate that a LinkedIn URL has the right format and length Args: linkedin_url (string): LinkedIn URL of a user",
"name": "vali... | 2 | null | Implement the Python class `UploadResumeView` described below.
Class description:
View for uploading resume and linkedin URL
Method signatures and docstrings:
- def post(self, request, *args, **kwargs): Update the application with resume and/or linkedin URL
- def validate_linkedin_url(self, linkedin_url): Validate th... | Implement the Python class `UploadResumeView` described below.
Class description:
View for uploading resume and linkedin URL
Method signatures and docstrings:
- def post(self, request, *args, **kwargs): Update the application with resume and/or linkedin URL
- def validate_linkedin_url(self, linkedin_url): Validate th... | 339c67b84b661a37ffe32580da72383d95666c5c | <|skeleton|>
class UploadResumeView:
"""View for uploading resume and linkedin URL"""
def post(self, request, *args, **kwargs):
"""Update the application with resume and/or linkedin URL"""
<|body_0|>
def validate_linkedin_url(self, linkedin_url):
"""Validate that a LinkedIn URL has... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UploadResumeView:
"""View for uploading resume and linkedin URL"""
def post(self, request, *args, **kwargs):
"""Update the application with resume and/or linkedin URL"""
application = self.get_object()
linkedin_url = request.data.get('linkedin_url')
resume_file = request.F... | the_stack_v2_python_sparse | applications/views.py | mitodl/bootcamp-ecommerce | train | 6 |
b1462438530b61709e95db91267d5a8ba9babb92 | [
"try:\n data = get_request_data(request)\n availability_trend = DashboardAdministration.availability_trend(system=data.get('system'), interval=data.get('interval'))\n return JsonResponse(availability_trend)\nexcept Exception as ex:\n lgr.exception('Get system availability percentage trend exception: %s'... | <|body_start_0|>
try:
data = get_request_data(request)
availability_trend = DashboardAdministration.availability_trend(system=data.get('system'), interval=data.get('interval'))
return JsonResponse(availability_trend)
except Exception as ex:
lgr.exception('... | Class for grouping public api endpoints | PublicEndpoints | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PublicEndpoints:
"""Class for grouping public api endpoints"""
def get_availability_trend(request):
"""Retrieves availability trend for a system within a give period @param request: The Django WSGI Request to process @type request: WSGIRequest @return: A response code to indicate sta... | stack_v2_sparse_classes_75kplus_train_069056 | 42,022 | no_license | [
{
"docstring": "Retrieves availability trend for a system within a give period @param request: The Django WSGI Request to process @type request: WSGIRequest @return: A response code to indicate status and system uptime trend data @rtype: dict",
"name": "get_availability_trend",
"signature": "def get_ava... | 5 | null | Implement the Python class `PublicEndpoints` described below.
Class description:
Class for grouping public api endpoints
Method signatures and docstrings:
- def get_availability_trend(request): Retrieves availability trend for a system within a give period @param request: The Django WSGI Request to process @type requ... | Implement the Python class `PublicEndpoints` described below.
Class description:
Class for grouping public api endpoints
Method signatures and docstrings:
- def get_availability_trend(request): Retrieves availability trend for a system within a give period @param request: The Django WSGI Request to process @type requ... | 4e0be4a06711b699b20bb4a34c1bc669a2e1b105 | <|skeleton|>
class PublicEndpoints:
"""Class for grouping public api endpoints"""
def get_availability_trend(request):
"""Retrieves availability trend for a system within a give period @param request: The Django WSGI Request to process @type request: WSGIRequest @return: A response code to indicate sta... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PublicEndpoints:
"""Class for grouping public api endpoints"""
def get_availability_trend(request):
"""Retrieves availability trend for a system within a give period @param request: The Django WSGI Request to process @type request: WSGIRequest @return: A response code to indicate status and syste... | the_stack_v2_python_sparse | api/views.py | alovega/helamonitor | train | 0 |
67e05460b7ccb08c8dacf1a60060b6e84169cf42 | [
"self.id = queue.id\nself.is_canceled = queue.is_canceled\nself.configuration = queue.get_execution_configuration()\nself.interface = queue.get_job_interface()\nself.priority = queue.priority\nself.required_resources = queue.get_resources()\nself.scheduled_agent_id = None\nself._queue = queue\nself._scheduled_node_... | <|body_start_0|>
self.id = queue.id
self.is_canceled = queue.is_canceled
self.configuration = queue.get_execution_configuration()
self.interface = queue.get_job_interface()
self.priority = queue.priority
self.required_resources = queue.get_resources()
self.schedul... | This class represents a queued job execution that is being considered for scheduling | QueuedJobExecution | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QueuedJobExecution:
"""This class represents a queued job execution that is being considered for scheduling"""
def __init__(self, queue):
"""Constructor :param queue: The queue model :type queue: :class:`queue.models.Queue`"""
<|body_0|>
def create_job_exe_model(self, fr... | stack_v2_sparse_classes_75kplus_train_069057 | 3,448 | permissive | [
{
"docstring": "Constructor :param queue: The queue model :type queue: :class:`queue.models.Queue`",
"name": "__init__",
"signature": "def __init__(self, queue)"
},
{
"docstring": "Creates and returns a scheduled job execution model :param framework_id: The scheduling framework ID :type framewor... | 3 | null | Implement the Python class `QueuedJobExecution` described below.
Class description:
This class represents a queued job execution that is being considered for scheduling
Method signatures and docstrings:
- def __init__(self, queue): Constructor :param queue: The queue model :type queue: :class:`queue.models.Queue`
- d... | Implement the Python class `QueuedJobExecution` described below.
Class description:
This class represents a queued job execution that is being considered for scheduling
Method signatures and docstrings:
- def __init__(self, queue): Constructor :param queue: The queue model :type queue: :class:`queue.models.Queue`
- d... | 28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b | <|skeleton|>
class QueuedJobExecution:
"""This class represents a queued job execution that is being considered for scheduling"""
def __init__(self, queue):
"""Constructor :param queue: The queue model :type queue: :class:`queue.models.Queue`"""
<|body_0|>
def create_job_exe_model(self, fr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QueuedJobExecution:
"""This class represents a queued job execution that is being considered for scheduling"""
def __init__(self, queue):
"""Constructor :param queue: The queue model :type queue: :class:`queue.models.Queue`"""
self.id = queue.id
self.is_canceled = queue.is_cancele... | the_stack_v2_python_sparse | scale/queue/job_exe.py | kfconsultant/scale | train | 0 |
433b4e99f8c273dfac034a10ea7e5a9906be71da | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | FaceRecognitionServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FaceRecognitionServicer:
def update_library(self, request, context):
"""人脸是否存在"""
<|body_0|>
def upload_face(self, request, context):
"""上传脸谱"""
<|body_1|>
def recognition(self, request, context):
"""人脸识别"""
<|body_2|>
<|end_skeleton|>
... | stack_v2_sparse_classes_75kplus_train_069058 | 2,984 | no_license | [
{
"docstring": "人脸是否存在",
"name": "update_library",
"signature": "def update_library(self, request, context)"
},
{
"docstring": "上传脸谱",
"name": "upload_face",
"signature": "def upload_face(self, request, context)"
},
{
"docstring": "人脸识别",
"name": "recognition",
"signature... | 3 | stack_v2_sparse_classes_30k_train_046674 | Implement the Python class `FaceRecognitionServicer` described below.
Class description:
Implement the FaceRecognitionServicer class.
Method signatures and docstrings:
- def update_library(self, request, context): 人脸是否存在
- def upload_face(self, request, context): 上传脸谱
- def recognition(self, request, context): 人脸识别 | Implement the Python class `FaceRecognitionServicer` described below.
Class description:
Implement the FaceRecognitionServicer class.
Method signatures and docstrings:
- def update_library(self, request, context): 人脸是否存在
- def upload_face(self, request, context): 上传脸谱
- def recognition(self, request, context): 人脸识别
... | 7467cd66e1fc91f0b3a264f8fc9b93f22f09fe7b | <|skeleton|>
class FaceRecognitionServicer:
def update_library(self, request, context):
"""人脸是否存在"""
<|body_0|>
def upload_face(self, request, context):
"""上传脸谱"""
<|body_1|>
def recognition(self, request, context):
"""人脸识别"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FaceRecognitionServicer:
def update_library(self, request, context):
"""人脸是否存在"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def upload_face(self, request, context):
... | the_stack_v2_python_sparse | FireHydrant/common/grpc/model/faceRecognition_pb2_grpc.py | shoogoome/FireHydrant | train | 4 | |
959339e17cf19d0c28480b4b15cbce30ac5cb3d4 | [
"self.height = height\nself.width = width\nself.rng = rng\nself.buffer_size = buffer_size\nself.m = m\nself.batch_size = batch_size\nself.size = 0\nself.current = 0\nself.frames = np.zeros(shape=(buffer_size, height, width), dtype=np.float32)\nself.actions = np.zeros(shape=buffer_size, dtype=np.int)\nself.rewards =... | <|body_start_0|>
self.height = height
self.width = width
self.rng = rng
self.buffer_size = buffer_size
self.m = m
self.batch_size = batch_size
self.size = 0
self.current = 0
self.frames = np.zeros(shape=(buffer_size, height, width), dtype=np.float3... | The replay memory of a DQN agent represented as a circular buffer. | ReplayMemory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReplayMemory:
"""The replay memory of a DQN agent represented as a circular buffer."""
def __init__(self, height, width, rng, buffer_size=100000, m=4, batch_size=32):
"""Initialize the replay memory. :param height: the image height :param width: the image width :param rng: the random... | stack_v2_sparse_classes_75kplus_train_069059 | 3,811 | no_license | [
{
"docstring": "Initialize the replay memory. :param height: the image height :param width: the image width :param rng: the random number generator :param buffer_size: size of the replay memory :param m: number of frames used as input to the network :param batch_size: mini batch size",
"name": "__init__",
... | 5 | stack_v2_sparse_classes_30k_train_052459 | Implement the Python class `ReplayMemory` described below.
Class description:
The replay memory of a DQN agent represented as a circular buffer.
Method signatures and docstrings:
- def __init__(self, height, width, rng, buffer_size=100000, m=4, batch_size=32): Initialize the replay memory. :param height: the image he... | Implement the Python class `ReplayMemory` described below.
Class description:
The replay memory of a DQN agent represented as a circular buffer.
Method signatures and docstrings:
- def __init__(self, height, width, rng, buffer_size=100000, m=4, batch_size=32): Initialize the replay memory. :param height: the image he... | ace443dcfed08f6f93e463b95005dcc1f0d61eb2 | <|skeleton|>
class ReplayMemory:
"""The replay memory of a DQN agent represented as a circular buffer."""
def __init__(self, height, width, rng, buffer_size=100000, m=4, batch_size=32):
"""Initialize the replay memory. :param height: the image height :param width: the image width :param rng: the random... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ReplayMemory:
"""The replay memory of a DQN agent represented as a circular buffer."""
def __init__(self, height, width, rng, buffer_size=100000, m=4, batch_size=32):
"""Initialize the replay memory. :param height: the image height :param width: the image width :param rng: the random number gener... | the_stack_v2_python_sparse | library/dqn/replay_memory.py | BogdanFloris/reinforcement-learning-lib | train | 0 |
0f5f2961aff3823559648c19cfe52f622b5f4290 | [
"for files_info in res_commit_api['files']:\n if files_info['filename'] == file_names_commit:\n raw_url = files_info['raw_url']\n response = request.urlopen(raw_url)\n data_file = response.read()\n data_file = data_file.decode()\n commit_file_data.append(data_file)\n com... | <|body_start_0|>
for files_info in res_commit_api['files']:
if files_info['filename'] == file_names_commit:
raw_url = files_info['raw_url']
response = request.urlopen(raw_url)
data_file = response.read()
data_file = data_file.decode()
... | create the dictionary | commit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class commit:
"""create the dictionary"""
def commit_files(self, file_names_commit, count, res_commit_api, filename=None):
""":param file_name1: :param count: :param res_commit_api: :param filename: :return:"""
<|body_0|>
def lizard(self, file_names_commit, res_commit_api):
... | stack_v2_sparse_classes_75kplus_train_069060 | 5,608 | no_license | [
{
"docstring": ":param file_name1: :param count: :param res_commit_api: :param filename: :return:",
"name": "commit_files",
"signature": "def commit_files(self, file_names_commit, count, res_commit_api, filename=None)"
},
{
"docstring": ":param file_name1: :param res_commit_api: :return:",
"... | 4 | stack_v2_sparse_classes_30k_train_035779 | Implement the Python class `commit` described below.
Class description:
create the dictionary
Method signatures and docstrings:
- def commit_files(self, file_names_commit, count, res_commit_api, filename=None): :param file_name1: :param count: :param res_commit_api: :param filename: :return:
- def lizard(self, file_n... | Implement the Python class `commit` described below.
Class description:
create the dictionary
Method signatures and docstrings:
- def commit_files(self, file_names_commit, count, res_commit_api, filename=None): :param file_name1: :param count: :param res_commit_api: :param filename: :return:
- def lizard(self, file_n... | 4b31f2c7d87c3ad15c7ab8b71a94abdada1faf63 | <|skeleton|>
class commit:
"""create the dictionary"""
def commit_files(self, file_names_commit, count, res_commit_api, filename=None):
""":param file_name1: :param count: :param res_commit_api: :param filename: :return:"""
<|body_0|>
def lizard(self, file_names_commit, res_commit_api):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class commit:
"""create the dictionary"""
def commit_files(self, file_names_commit, count, res_commit_api, filename=None):
""":param file_name1: :param count: :param res_commit_api: :param filename: :return:"""
for files_info in res_commit_api['files']:
if files_info['filename'] == ... | the_stack_v2_python_sparse | fetching_data/commit_api.py | iamthebj/GitPred | train | 0 |
2f80ed59e6982d102ac0cff039fe373199d06090 | [
"log.debug('Outputting %s for query %s', mdseries, query)\nself._qfdomain = 'geckoboard_rag'\nself._write_options()\nself._write_colors()",
"if self.query:\n try:\n qformat = self.query.qformat\n self.jout['prefix'] = qformat.get(self._qfdomain, 'prefix')\n except KeyError:\n pass",
"... | <|body_start_0|>
log.debug('Outputting %s for query %s', mdseries, query)
self._qfdomain = 'geckoboard_rag'
self._write_options()
self._write_colors()
<|end_body_0|>
<|body_start_1|>
if self.query:
try:
qformat = self.query.qformat
sel... | EROut (Extensible Report Outputter) Plugin for Geckoboard RAG. Adds JSON-serializable output to extinfo['jout'] dict. Typical usage is with 1 collapsed query with 3 QMetrics, or several collapsed queries totalling 3 QMetrics, default 'LAST' reduce function, and ghosts disabled. This prevent needless queries from runnin... | EROut_geckoboard_rag | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EROut_geckoboard_rag:
"""EROut (Extensible Report Outputter) Plugin for Geckoboard RAG. Adds JSON-serializable output to extinfo['jout'] dict. Typical usage is with 1 collapsed query with 3 QMetrics, or several collapsed queries totalling 3 QMetrics, default 'LAST' reduce function, and ghosts dis... | stack_v2_sparse_classes_75kplus_train_069061 | 5,238 | permissive | [
{
"docstring": "EROut plugins must implement this abstract method. Invoked to output MultiDataSeries as specified. Returns nothing. Output target should be configured separately.",
"name": "plugin_output",
"signature": "def plugin_output(self, mdseries, query=None)"
},
{
"docstring": "Write opti... | 4 | stack_v2_sparse_classes_30k_train_036505 | Implement the Python class `EROut_geckoboard_rag` described below.
Class description:
EROut (Extensible Report Outputter) Plugin for Geckoboard RAG. Adds JSON-serializable output to extinfo['jout'] dict. Typical usage is with 1 collapsed query with 3 QMetrics, or several collapsed queries totalling 3 QMetrics, default... | Implement the Python class `EROut_geckoboard_rag` described below.
Class description:
EROut (Extensible Report Outputter) Plugin for Geckoboard RAG. Adds JSON-serializable output to extinfo['jout'] dict. Typical usage is with 1 collapsed query with 3 QMetrics, or several collapsed queries totalling 3 QMetrics, default... | a2db75c9ef9a9752997ccb112e8db68c1c8584a0 | <|skeleton|>
class EROut_geckoboard_rag:
"""EROut (Extensible Report Outputter) Plugin for Geckoboard RAG. Adds JSON-serializable output to extinfo['jout'] dict. Typical usage is with 1 collapsed query with 3 QMetrics, or several collapsed queries totalling 3 QMetrics, default 'LAST' reduce function, and ghosts dis... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EROut_geckoboard_rag:
"""EROut (Extensible Report Outputter) Plugin for Geckoboard RAG. Adds JSON-serializable output to extinfo['jout'] dict. Typical usage is with 1 collapsed query with 3 QMetrics, or several collapsed queries totalling 3 QMetrics, default 'LAST' reduce function, and ghosts disabled. This p... | the_stack_v2_python_sparse | py/axonchisel/metrics/io/erout/plugins/ero_geckoboard/rag.py | dkamins/ax_metrics | train | 0 |
c2aad5e506656f92e98c5e94f9993a3f64ab2a55 | [
"super().__init__()\nself.residual = residual\nnorm_kwargs = norm_kwargs if norm_kwargs is not None else {}\nmixer_kwargs = mixer_kwargs if mixer_kwargs is not None else {}\nself.norm = Norm(normalization, **norm_kwargs)\nself.token_mixer = TokenMixer(token_mixer, mixer_kwargs)\nself.reshape = RESHAPE_LOOKUP[token_... | <|body_start_0|>
super().__init__()
self.residual = residual
norm_kwargs = norm_kwargs if norm_kwargs is not None else {}
mixer_kwargs = mixer_kwargs if mixer_kwargs is not None else {}
self.norm = Norm(normalization, **norm_kwargs)
self.token_mixer = TokenMixer(token_mix... | TokenMixerBlock | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TokenMixerBlock:
def __init__(self, token_mixer: str, normalization: str, residual: bool=True, norm_kwargs: Dict[str, Any]=None, mixer_kwargs: Dict[str, Any]=None, **kwargs) -> None:
"""Token mixer block. I.e. norm(x) -> tokenmixer(x) -> residual -> (reshape for MLP) Parameters ---------... | stack_v2_sparse_classes_75kplus_train_069062 | 5,568 | permissive | [
{
"docstring": "Token mixer block. I.e. norm(x) -> tokenmixer(x) -> residual -> (reshape for MLP) Parameters ---------- token_mixer : str Name of the token mixer. Allowed: \"pool\", \"self-attention\", \"mscan\", \"identity\", \"mlp\". normalization : str Name of the normalization method. Allowed: \"bn\", \"bcn... | 2 | null | Implement the Python class `TokenMixerBlock` described below.
Class description:
Implement the TokenMixerBlock class.
Method signatures and docstrings:
- def __init__(self, token_mixer: str, normalization: str, residual: bool=True, norm_kwargs: Dict[str, Any]=None, mixer_kwargs: Dict[str, Any]=None, **kwargs) -> None... | Implement the Python class `TokenMixerBlock` described below.
Class description:
Implement the TokenMixerBlock class.
Method signatures and docstrings:
- def __init__(self, token_mixer: str, normalization: str, residual: bool=True, norm_kwargs: Dict[str, Any]=None, mixer_kwargs: Dict[str, Any]=None, **kwargs) -> None... | 7f79405012eb934b419bbdba8de23f35e840ca85 | <|skeleton|>
class TokenMixerBlock:
def __init__(self, token_mixer: str, normalization: str, residual: bool=True, norm_kwargs: Dict[str, Any]=None, mixer_kwargs: Dict[str, Any]=None, **kwargs) -> None:
"""Token mixer block. I.e. norm(x) -> tokenmixer(x) -> residual -> (reshape for MLP) Parameters ---------... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TokenMixerBlock:
def __init__(self, token_mixer: str, normalization: str, residual: bool=True, norm_kwargs: Dict[str, Any]=None, mixer_kwargs: Dict[str, Any]=None, **kwargs) -> None:
"""Token mixer block. I.e. norm(x) -> tokenmixer(x) -> residual -> (reshape for MLP) Parameters ---------- token_mixer ... | the_stack_v2_python_sparse | cellseg_models_pytorch/modules/token_mixers.py | okunator/cellseg_models.pytorch | train | 43 | |
ea415a6589dd4912ce74e9f43eac2db5f35af687 | [
"super(YOLOLayer, self).__init__()\nself.anchors = torch.Tensor(anchors)\nself.number_anchor = len(anchors)\nself.number_classes = number_classes\nself.image_size = image_size\nself.number_grid = None\nself.number_x_grid = 0\nself.number_y_grid = 0\nself.stride = 0\nself.grid_xy = None\nself.anchor_wh = None\nself.... | <|body_start_0|>
super(YOLOLayer, self).__init__()
self.anchors = torch.Tensor(anchors)
self.number_anchor = len(anchors)
self.number_classes = number_classes
self.image_size = image_size
self.number_grid = None
self.number_x_grid = 0
self.number_y_grid = ... | YOLO的detection head, 使用网络预测的值和预设的anchor组合得到预测的bbox | YOLOLayer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class YOLOLayer:
"""YOLO的detection head, 使用网络预测的值和预设的anchor组合得到预测的bbox"""
def __init__(self, anchors, number_classes, image_size):
"""Args: anchors: numpy.array, anchor的尺度大小 number_classes: 类别数目 image_size: 图片大小 arc:"""
<|body_0|>
def forward(self, feature, image_size):
... | stack_v2_sparse_classes_75kplus_train_069063 | 6,692 | no_license | [
{
"docstring": "Args: anchors: numpy.array, anchor的尺度大小 number_classes: 类别数目 image_size: 图片大小 arc:",
"name": "__init__",
"signature": "def __init__(self, anchors, number_classes, image_size)"
},
{
"docstring": "YOLOLayer的前向传播操作 :param feature: 输入特征图 :param image_size: 原始输入图片的大小 :return: predict:... | 3 | stack_v2_sparse_classes_30k_val_000902 | Implement the Python class `YOLOLayer` described below.
Class description:
YOLO的detection head, 使用网络预测的值和预设的anchor组合得到预测的bbox
Method signatures and docstrings:
- def __init__(self, anchors, number_classes, image_size): Args: anchors: numpy.array, anchor的尺度大小 number_classes: 类别数目 image_size: 图片大小 arc:
- def forward(se... | Implement the Python class `YOLOLayer` described below.
Class description:
YOLO的detection head, 使用网络预测的值和预设的anchor组合得到预测的bbox
Method signatures and docstrings:
- def __init__(self, anchors, number_classes, image_size): Args: anchors: numpy.array, anchor的尺度大小 number_classes: 类别数目 image_size: 图片大小 arc:
- def forward(se... | 7ed453312d1eb7b91aec536a1b009733147c871a | <|skeleton|>
class YOLOLayer:
"""YOLO的detection head, 使用网络预测的值和预设的anchor组合得到预测的bbox"""
def __init__(self, anchors, number_classes, image_size):
"""Args: anchors: numpy.array, anchor的尺度大小 number_classes: 类别数目 image_size: 图片大小 arc:"""
<|body_0|>
def forward(self, feature, image_size):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class YOLOLayer:
"""YOLO的detection head, 使用网络预测的值和预设的anchor组合得到预测的bbox"""
def __init__(self, anchors, number_classes, image_size):
"""Args: anchors: numpy.array, anchor的尺度大小 number_classes: 类别数目 image_size: 图片大小 arc:"""
super(YOLOLayer, self).__init__()
self.anchors = torch.Tensor(ancho... | the_stack_v2_python_sparse | models/layers.py | XiangqianMa/yolov3.pytorch | train | 0 |
ce64b155e92bbc5a4a0aa16c7ad6c746a4842352 | [
"self.get_model = get_model\nassert callable(get_model), get_model\nself.input_signature = input_signature\nself.target_signature = target_signature\nif trainer is None:\n nr_gpu = get_nr_gpu()\n if nr_gpu <= 1:\n trainer = SimpleTrainer()\n else:\n trainer = SyncMultiGPUTrainerParameterServe... | <|body_start_0|>
self.get_model = get_model
assert callable(get_model), get_model
self.input_signature = input_signature
self.target_signature = target_signature
if trainer is None:
nr_gpu = get_nr_gpu()
if nr_gpu <= 1:
trainer = SimpleTrai... | KerasModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KerasModel:
def __init__(self, get_model, input_signature=None, target_signature=None, input=None, trainer=None):
"""Args: get_model (input1, input2, ... -> keras.Model): A function which takes tensors, builds and returns a Keras model. It will be part of the tower function. input_signat... | stack_v2_sparse_classes_75kplus_train_069064 | 12,196 | permissive | [
{
"docstring": "Args: get_model (input1, input2, ... -> keras.Model): A function which takes tensors, builds and returns a Keras model. It will be part of the tower function. input_signature ([tf.TensorSpec]): required. The signature for inputs. target_signature ([tf.TensorSpec]): required. The signature for th... | 3 | stack_v2_sparse_classes_30k_train_030522 | Implement the Python class `KerasModel` described below.
Class description:
Implement the KerasModel class.
Method signatures and docstrings:
- def __init__(self, get_model, input_signature=None, target_signature=None, input=None, trainer=None): Args: get_model (input1, input2, ... -> keras.Model): A function which t... | Implement the Python class `KerasModel` described below.
Class description:
Implement the KerasModel class.
Method signatures and docstrings:
- def __init__(self, get_model, input_signature=None, target_signature=None, input=None, trainer=None): Args: get_model (input1, input2, ... -> keras.Model): A function which t... | 1547a54e8546494614ca31c984a1bfd1d0e24b77 | <|skeleton|>
class KerasModel:
def __init__(self, get_model, input_signature=None, target_signature=None, input=None, trainer=None):
"""Args: get_model (input1, input2, ... -> keras.Model): A function which takes tensors, builds and returns a Keras model. It will be part of the tower function. input_signat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KerasModel:
def __init__(self, get_model, input_signature=None, target_signature=None, input=None, trainer=None):
"""Args: get_model (input1, input2, ... -> keras.Model): A function which takes tensors, builds and returns a Keras model. It will be part of the tower function. input_signature ([tf.Tenso... | the_stack_v2_python_sparse | tensorpack/contrib/keras.py | tensorpack/tensorpack | train | 4,600 | |
452705ccdbd506789c4cb5383cf7613cc123e303 | [
"super().__init__()\nif random_seed is None:\n self.phi = torch_pi * torch.rand(degree + 1, requires_grad=True)\nelse:\n gen = torch.Generator()\n gen.manual_seed(random_seed)\n self.phi = torch_pi * torch.rand(degree + 1, requires_grad=True, generator=gen)\nself.phi = torch.nn.Parameter(self.phi)\nself... | <|body_start_0|>
super().__init__()
if random_seed is None:
self.phi = torch_pi * torch.rand(degree + 1, requires_grad=True)
else:
gen = torch.Generator()
gen.manual_seed(random_seed)
self.phi = torch_pi * torch.rand(degree + 1, requires_grad=True,... | QSP_Func_Fit | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QSP_Func_Fit:
def __init__(self, degree, num_vals, random_seed=None):
"""Given the degree and number of samples, this method randomly initializes the parameter vector (randomness can be set by random_seed)"""
<|body_0|>
def forward(self, omega_mats):
"""PennyLane for... | stack_v2_sparse_classes_75kplus_train_069065 | 21,450 | permissive | [
{
"docstring": "Given the degree and number of samples, this method randomly initializes the parameter vector (randomness can be set by random_seed)",
"name": "__init__",
"signature": "def __init__(self, degree, num_vals, random_seed=None)"
},
{
"docstring": "PennyLane forward implementation",
... | 2 | stack_v2_sparse_classes_30k_train_016090 | Implement the Python class `QSP_Func_Fit` described below.
Class description:
Implement the QSP_Func_Fit class.
Method signatures and docstrings:
- def __init__(self, degree, num_vals, random_seed=None): Given the degree and number of samples, this method randomly initializes the parameter vector (randomness can be s... | Implement the Python class `QSP_Func_Fit` described below.
Class description:
Implement the QSP_Func_Fit class.
Method signatures and docstrings:
- def __init__(self, degree, num_vals, random_seed=None): Given the degree and number of samples, this method randomly initializes the parameter vector (randomness can be s... | 45533ef6f6d7b9cfa0384302fe52b5ead772b923 | <|skeleton|>
class QSP_Func_Fit:
def __init__(self, degree, num_vals, random_seed=None):
"""Given the degree and number of samples, this method randomly initializes the parameter vector (randomness can be set by random_seed)"""
<|body_0|>
def forward(self, omega_mats):
"""PennyLane for... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QSP_Func_Fit:
def __init__(self, degree, num_vals, random_seed=None):
"""Given the degree and number of samples, this method randomly initializes the parameter vector (randomness can be set by random_seed)"""
super().__init__()
if random_seed is None:
self.phi = torch_pi * ... | the_stack_v2_python_sparse | demonstrations/function_fitting_qsp.py | quantshah/qml | train | 0 | |
44b40b5fe641d3e6b46842f191837bd751edbdff | [
"self.key = key\nself.value = value\nself.prev = prev\nself.next = next",
"if self.prev:\n self.prev.next = self.next\nif self.next:\n self.next.prev = self.prev"
] | <|body_start_0|>
self.key = key
self.value = value
self.prev = prev
self.next = next
<|end_body_0|>
<|body_start_1|>
if self.prev:
self.prev.next = self.next
if self.next:
self.next.prev = self.prev
<|end_body_1|>
| CacheNode | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CacheNode:
def __init__(self, key, value, prev=None, next=None):
"""A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by key. :param prev [CacheNode] : Previous CacheNode in list, defaults to None :param next [CacheNo... | stack_v2_sparse_classes_75kplus_train_069066 | 4,360 | permissive | [
{
"docstring": "A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by key. :param prev [CacheNode] : Previous CacheNode in list, defaults to None :param next [CacheNode] : Next CacheNode in list, defaults to None",
"name": "__init__",
... | 2 | stack_v2_sparse_classes_30k_train_052990 | Implement the Python class `CacheNode` described below.
Class description:
Implement the CacheNode class.
Method signatures and docstrings:
- def __init__(self, key, value, prev=None, next=None): A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed b... | Implement the Python class `CacheNode` described below.
Class description:
Implement the CacheNode class.
Method signatures and docstrings:
- def __init__(self, key, value, prev=None, next=None): A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed b... | b0b3d3c6dc3fa397c8c7a492098a02cf75e0ff82 | <|skeleton|>
class CacheNode:
def __init__(self, key, value, prev=None, next=None):
"""A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by key. :param prev [CacheNode] : Previous CacheNode in list, defaults to None :param next [CacheNo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CacheNode:
def __init__(self, key, value, prev=None, next=None):
"""A node in a doubly-linked list-based LRU cache. :param key : Key by which to access nodes. :param value : Value accessed by key. :param prev [CacheNode] : Previous CacheNode in list, defaults to None :param next [CacheNode] : Next Cac... | the_stack_v2_python_sparse | cs/lambda_cs/03_data_structures/lru_cache/lru_cache_cachenode.py | tobias-fyi/vela | train | 0 | |
3aebf913b90385aa85be0608973a4b526da58954 | [
"data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True)\ndata_valid = tfds.load('ted_hrlr_translate/pt_to_en', split='validation', as_supervised=True)\nself.tokenizer_pt, self.tokenizer_en = self.tokenize_dataset(data_train)\nself.data_train = data_train.map(self.tf_encode)\nself.d... | <|body_start_0|>
data_train = tfds.load('ted_hrlr_translate/pt_to_en', split='train', as_supervised=True)
data_valid = tfds.load('ted_hrlr_translate/pt_to_en', split='validation', as_supervised=True)
self.tokenizer_pt, self.tokenizer_en = self.tokenize_dataset(data_train)
self.data_train... | Loads and preps a dataset for machine translation class constructor: def __init__(self, batch_size, max_len) public instance attributes: data_train: contains the ted_hrlr_translate/pt_to_en tf.data.Dataset train split, loaded as_supervided data_valid: contains the ted_hrlr_translate/pt_to_en tf.data.Dataset validate sp... | Dataset | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dataset:
"""Loads and preps a dataset for machine translation class constructor: def __init__(self, batch_size, max_len) public instance attributes: data_train: contains the ted_hrlr_translate/pt_to_en tf.data.Dataset train split, loaded as_supervided data_valid: contains the ted_hrlr_translate/p... | stack_v2_sparse_classes_75kplus_train_069067 | 6,361 | no_license | [
{
"docstring": "Class constructor parameters: batch_size [int]: the batch size for training/validation max_len [int]: the maximum number of tokens allowed per example sentence Sets the public instance attributes: data_train: contains the ted_hrlr_translate/pt_to_en tf.data.Dataset train split, loaded as_supervi... | 4 | stack_v2_sparse_classes_30k_train_026248 | Implement the Python class `Dataset` described below.
Class description:
Loads and preps a dataset for machine translation class constructor: def __init__(self, batch_size, max_len) public instance attributes: data_train: contains the ted_hrlr_translate/pt_to_en tf.data.Dataset train split, loaded as_supervided data_v... | Implement the Python class `Dataset` described below.
Class description:
Loads and preps a dataset for machine translation class constructor: def __init__(self, batch_size, max_len) public instance attributes: data_train: contains the ted_hrlr_translate/pt_to_en tf.data.Dataset train split, loaded as_supervided data_v... | 8834b201ca84937365e4dcc0fac978656cdf5293 | <|skeleton|>
class Dataset:
"""Loads and preps a dataset for machine translation class constructor: def __init__(self, batch_size, max_len) public instance attributes: data_train: contains the ted_hrlr_translate/pt_to_en tf.data.Dataset train split, loaded as_supervided data_valid: contains the ted_hrlr_translate/p... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Dataset:
"""Loads and preps a dataset for machine translation class constructor: def __init__(self, batch_size, max_len) public instance attributes: data_train: contains the ted_hrlr_translate/pt_to_en tf.data.Dataset train split, loaded as_supervided data_valid: contains the ted_hrlr_translate/pt_to_en tf.da... | the_stack_v2_python_sparse | supervised_learning/0x12-transformer_apps/3-dataset.py | ejonakodra/holbertonschool-machine_learning-1 | train | 0 |
b297989a217f7aab4e59bbb4b52079f08a7e04d4 | [
"self.client_id = client_id\nself.client_secret = client_secret\nself.project_key = project_key",
"encoded = base64.b64encode('{}:{}'.format(self.client_id, self.client_secret))\nheaders = {'Authorization': 'Basic {}'.format(encoded), 'Content-Type': 'application/x-www-form-urlencoded'}\nbody = 'grant_type=client... | <|body_start_0|>
self.client_id = client_id
self.client_secret = client_secret
self.project_key = project_key
<|end_body_0|>
<|body_start_1|>
encoded = base64.b64encode('{}:{}'.format(self.client_id, self.client_secret))
headers = {'Authorization': 'Basic {}'.format(encoded), 'C... | SphereAPIAuthenticator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SphereAPIAuthenticator:
def __init__(self, client_id, client_secret, project_key):
""":type client_id: unicode :type client_secret: unicode :type project_key: unicode"""
<|body_0|>
def auth(self):
"""BÄÄÄM BÄ BÄÄÄÄÄMMMMMMM :returns Access token :rtype: dict"""
... | stack_v2_sparse_classes_75kplus_train_069068 | 2,676 | no_license | [
{
"docstring": ":type client_id: unicode :type client_secret: unicode :type project_key: unicode",
"name": "__init__",
"signature": "def __init__(self, client_id, client_secret, project_key)"
},
{
"docstring": "BÄÄÄM BÄ BÄÄÄÄÄMMMMMMM :returns Access token :rtype: dict",
"name": "auth",
"... | 2 | stack_v2_sparse_classes_30k_train_044385 | Implement the Python class `SphereAPIAuthenticator` described below.
Class description:
Implement the SphereAPIAuthenticator class.
Method signatures and docstrings:
- def __init__(self, client_id, client_secret, project_key): :type client_id: unicode :type client_secret: unicode :type project_key: unicode
- def auth... | Implement the Python class `SphereAPIAuthenticator` described below.
Class description:
Implement the SphereAPIAuthenticator class.
Method signatures and docstrings:
- def __init__(self, client_id, client_secret, project_key): :type client_id: unicode :type client_secret: unicode :type project_key: unicode
- def auth... | 0199789b2e2b0a9be8e3b00887e187b2ac97ea47 | <|skeleton|>
class SphereAPIAuthenticator:
def __init__(self, client_id, client_secret, project_key):
""":type client_id: unicode :type client_secret: unicode :type project_key: unicode"""
<|body_0|>
def auth(self):
"""BÄÄÄM BÄ BÄÄÄÄÄMMMMMMM :returns Access token :rtype: dict"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SphereAPIAuthenticator:
def __init__(self, client_id, client_secret, project_key):
""":type client_id: unicode :type client_secret: unicode :type project_key: unicode"""
self.client_id = client_id
self.client_secret = client_secret
self.project_key = project_key
def auth(s... | the_stack_v2_python_sparse | faces/lib/sphere_api/api.py | bartoszhernas/ecommhack.api | train | 0 | |
2cfd77fb3202b5f0d0e22db9296c1520332278fe | [
"self.favorable_label = float(favorable_label)\nself.unfavorable_label = float(unfavorable_label)\nsuper(BinaryLabelDataset, self).__init__(**kwargs)",
"if np.all(self.scores == self.labels):\n self.scores = (self.scores == self.favorable_label).astype(np.float64)\nsuper(BinaryLabelDataset, self).validate_data... | <|body_start_0|>
self.favorable_label = float(favorable_label)
self.unfavorable_label = float(unfavorable_label)
super(BinaryLabelDataset, self).__init__(**kwargs)
<|end_body_0|>
<|body_start_1|>
if np.all(self.scores == self.labels):
self.scores = (self.scores == self.favor... | Base class for all structured datasets with binary labels. | BinaryLabelDataset | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BinaryLabelDataset:
"""Base class for all structured datasets with binary labels."""
def __init__(self, favorable_label=1.0, unfavorable_label=0.0, **kwargs):
"""Args: favorable_label (float): Label value which is considered favorable (i.e. "positive"). unfavorable_label (float): Lab... | stack_v2_sparse_classes_75kplus_train_069069 | 2,023 | permissive | [
{
"docstring": "Args: favorable_label (float): Label value which is considered favorable (i.e. \"positive\"). unfavorable_label (float): Label value which is considered unfavorable (i.e. \"negative\"). **kwargs: StructuredDataset arguments.",
"name": "__init__",
"signature": "def __init__(self, favorabl... | 2 | stack_v2_sparse_classes_30k_train_026094 | Implement the Python class `BinaryLabelDataset` described below.
Class description:
Base class for all structured datasets with binary labels.
Method signatures and docstrings:
- def __init__(self, favorable_label=1.0, unfavorable_label=0.0, **kwargs): Args: favorable_label (float): Label value which is considered fa... | Implement the Python class `BinaryLabelDataset` described below.
Class description:
Base class for all structured datasets with binary labels.
Method signatures and docstrings:
- def __init__(self, favorable_label=1.0, unfavorable_label=0.0, **kwargs): Args: favorable_label (float): Label value which is considered fa... | 6f9972e4a7dbca2402f29b86ea67889143dbeb3e | <|skeleton|>
class BinaryLabelDataset:
"""Base class for all structured datasets with binary labels."""
def __init__(self, favorable_label=1.0, unfavorable_label=0.0, **kwargs):
"""Args: favorable_label (float): Label value which is considered favorable (i.e. "positive"). unfavorable_label (float): Lab... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BinaryLabelDataset:
"""Base class for all structured datasets with binary labels."""
def __init__(self, favorable_label=1.0, unfavorable_label=0.0, **kwargs):
"""Args: favorable_label (float): Label value which is considered favorable (i.e. "positive"). unfavorable_label (float): Label value whic... | the_stack_v2_python_sparse | aif360/datasets/binary_label_dataset.py | Trusted-AI/AIF360 | train | 1,157 |
0f6a8f9a0b2354cd6fe61c9fc6ce284261d00112 | [
"for brid, br in cls.Baudrates:\n if baudrate == br:\n return brid\nraise MTException('unsupported baudrate.')",
"for brid, br in cls.Baudrates:\n if baudrate_id == brid:\n return br\nraise MTException('unknown baudrate id.')"
] | <|body_start_0|>
for brid, br in cls.Baudrates:
if baudrate == br:
return brid
raise MTException('unsupported baudrate.')
<|end_body_0|>
<|body_start_1|>
for brid, br in cls.Baudrates:
if baudrate_id == brid:
return br
raise MTExce... | Baudrate information and conversion. | Baudrates | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Baudrates:
"""Baudrate information and conversion."""
def get_BRID(cls, baudrate):
"""Get baudrate id for a given baudrate."""
<|body_0|>
def get_BR(cls, baudrate_id):
"""Get baudrate for a given baudrate id."""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_75kplus_train_069070 | 7,681 | no_license | [
{
"docstring": "Get baudrate id for a given baudrate.",
"name": "get_BRID",
"signature": "def get_BRID(cls, baudrate)"
},
{
"docstring": "Get baudrate for a given baudrate id.",
"name": "get_BR",
"signature": "def get_BR(cls, baudrate_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_047672 | Implement the Python class `Baudrates` described below.
Class description:
Baudrate information and conversion.
Method signatures and docstrings:
- def get_BRID(cls, baudrate): Get baudrate id for a given baudrate.
- def get_BR(cls, baudrate_id): Get baudrate for a given baudrate id. | Implement the Python class `Baudrates` described below.
Class description:
Baudrate information and conversion.
Method signatures and docstrings:
- def get_BRID(cls, baudrate): Get baudrate id for a given baudrate.
- def get_BR(cls, baudrate_id): Get baudrate for a given baudrate id.
<|skeleton|>
class Baudrates:
... | c49b59e28b0e7de9ab247c7421eb765e77f9eb2c | <|skeleton|>
class Baudrates:
"""Baudrate information and conversion."""
def get_BRID(cls, baudrate):
"""Get baudrate id for a given baudrate."""
<|body_0|>
def get_BR(cls, baudrate_id):
"""Get baudrate for a given baudrate id."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Baudrates:
"""Baudrate information and conversion."""
def get_BRID(cls, baudrate):
"""Get baudrate id for a given baudrate."""
for brid, br in cls.Baudrates:
if baudrate == br:
return brid
raise MTException('unsupported baudrate.')
def get_BR(cls, ... | the_stack_v2_python_sparse | src/xsens_driver/scripts/mtdef.py | Southampton-Maritime-Robotics/DelphinROSv3 | train | 1 |
f90c0ea36d3fa13212380b15cadb34035cd80dc5 | [
"wave = numpy.convolve(one.waveform, two.waveform, mode)\nwave.resize(len(one.waveform))\nsuper().__init__(name, one.times, wave)\nself.one = one\nself.two = two",
"if key in ('', 'both', 'whole', 'self', 0, 3):\n return self\nif key in ('one', 1, self.one.name):\n return self.one\nif key in ('two', 2, self... | <|body_start_0|>
wave = numpy.convolve(one.waveform, two.waveform, mode)
wave.resize(len(one.waveform))
super().__init__(name, one.times, wave)
self.one = one
self.two = two
<|end_body_0|>
<|body_start_1|>
if key in ('', 'both', 'whole', 'self', 0, 3):
return... | A signal formed from the convolution of two signals. | Convolution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Convolution:
"""A signal formed from the convolution of two signals."""
def __init__(self, name, one, two, mode='full'):
"""Create measure from two signals."""
<|body_0|>
def component(self, key):
"""Return component by identifying key."""
<|body_1|>
<|e... | stack_v2_sparse_classes_75kplus_train_069071 | 25,189 | no_license | [
{
"docstring": "Create measure from two signals.",
"name": "__init__",
"signature": "def __init__(self, name, one, two, mode='full')"
},
{
"docstring": "Return component by identifying key.",
"name": "component",
"signature": "def component(self, key)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008481 | Implement the Python class `Convolution` described below.
Class description:
A signal formed from the convolution of two signals.
Method signatures and docstrings:
- def __init__(self, name, one, two, mode='full'): Create measure from two signals.
- def component(self, key): Return component by identifying key. | Implement the Python class `Convolution` described below.
Class description:
A signal formed from the convolution of two signals.
Method signatures and docstrings:
- def __init__(self, name, one, two, mode='full'): Create measure from two signals.
- def component(self, key): Return component by identifying key.
<|sk... | bfaea8464a9f777e5b59216b265fd68fb22564ae | <|skeleton|>
class Convolution:
"""A signal formed from the convolution of two signals."""
def __init__(self, name, one, two, mode='full'):
"""Create measure from two signals."""
<|body_0|>
def component(self, key):
"""Return component by identifying key."""
<|body_1|>
<|e... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Convolution:
"""A signal formed from the convolution of two signals."""
def __init__(self, name, one, two, mode='full'):
"""Create measure from two signals."""
wave = numpy.convolve(one.waveform, two.waveform, mode)
wave.resize(len(one.waveform))
super().__init__(name, one... | the_stack_v2_python_sparse | wirecell/sigproc/fwd.py | WireCell/wire-cell-python | train | 0 |
c3e0776ea2cd320c10db24165bec378b5472863e | [
"super().__init__()\nself.x = x\nself.y = y\nself.width = width\nself.height = height",
"point = Foundation.NSPoint(self.x, self.y)\nsize = Foundation.NSSize(self.width, self.height)\ncontent_rect = Foundation.NSRect(point, size)\nframe_rect = window.frameRectForContentRect_(content_rect)\nwindow.setFrame_display... | <|body_start_0|>
super().__init__()
self.x = x
self.y = y
self.width = width
self.height = height
<|end_body_0|>
<|body_start_1|>
point = Foundation.NSPoint(self.x, self.y)
size = Foundation.NSSize(self.width, self.height)
content_rect = Foundation.NSRect... | FIXME. | XYWidthHeightLayoutDelegate | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XYWidthHeightLayoutDelegate:
"""FIXME."""
def __init__(self, x, y, width, height):
""":param int x: FIXME. :param int y: FIXME. :param int width: the required window width. :param int height: the required window height."""
<|body_0|>
def layout_window(self, window):
... | stack_v2_sparse_classes_75kplus_train_069072 | 1,870 | permissive | [
{
"docstring": ":param int x: FIXME. :param int y: FIXME. :param int width: the required window width. :param int height: the required window height.",
"name": "__init__",
"signature": "def __init__(self, x, y, width, height)"
},
{
"docstring": "Position the window at the provided coordinates. :... | 2 | stack_v2_sparse_classes_30k_train_022114 | Implement the Python class `XYWidthHeightLayoutDelegate` described below.
Class description:
FIXME.
Method signatures and docstrings:
- def __init__(self, x, y, width, height): :param int x: FIXME. :param int y: FIXME. :param int width: the required window width. :param int height: the required window height.
- def l... | Implement the Python class `XYWidthHeightLayoutDelegate` described below.
Class description:
FIXME.
Method signatures and docstrings:
- def __init__(self, x, y, width, height): :param int x: FIXME. :param int y: FIXME. :param int width: the required window width. :param int height: the required window height.
- def l... | 6917730991d920dc97faf69b2190299a0cb50fe1 | <|skeleton|>
class XYWidthHeightLayoutDelegate:
"""FIXME."""
def __init__(self, x, y, width, height):
""":param int x: FIXME. :param int y: FIXME. :param int width: the required window width. :param int height: the required window height."""
<|body_0|>
def layout_window(self, window):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class XYWidthHeightLayoutDelegate:
"""FIXME."""
def __init__(self, x, y, width, height):
""":param int x: FIXME. :param int y: FIXME. :param int width: the required window width. :param int height: the required window height."""
super().__init__()
self.x = x
self.y = y
s... | the_stack_v2_python_sparse | yarely/darwin/common/window/layout.py | opendisplays/yarely | train | 4 |
d49bf2124790386fd698506d000b51d78885c1f0 | [
"if not self._year:\n return\ntime_elements_structure = self._GetValueFromStructure(structure, 'date_time')\ntext = self._GetValueFromStructure(structure, 'text')\ntext = ' '.join(text.split())\nevent_data = XChatLogEventData()\nevent_data.added_time = self._ParseTimeElements(time_elements_structure)\nevent_data... | <|body_start_0|>
if not self._year:
return
time_elements_structure = self._GetValueFromStructure(structure, 'date_time')
text = self._GetValueFromStructure(structure, 'text')
text = ' '.join(text.split())
event_data = XChatLogEventData()
event_data.added_time ... | Text parser plugin for XChat log files. | XChatLogTextPlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XChatLogTextPlugin:
"""Text parser plugin for XChat log files."""
def _ParseLogLine(self, parser_mediator, structure):
"""Parses a log line. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. structure (pypar... | stack_v2_sparse_classes_75kplus_train_069073 | 10,596 | permissive | [
{
"docstring": "Parses a log line. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. structure (pyparsing.ParseResults): structure of tokens derived from a line of a text file.",
"name": "_ParseLogLine",
"signature": "def _Pars... | 5 | stack_v2_sparse_classes_30k_train_013332 | Implement the Python class `XChatLogTextPlugin` described below.
Class description:
Text parser plugin for XChat log files.
Method signatures and docstrings:
- def _ParseLogLine(self, parser_mediator, structure): Parses a log line. Args: parser_mediator (ParserMediator): mediates interactions between parsers and othe... | Implement the Python class `XChatLogTextPlugin` described below.
Class description:
Text parser plugin for XChat log files.
Method signatures and docstrings:
- def _ParseLogLine(self, parser_mediator, structure): Parses a log line. Args: parser_mediator (ParserMediator): mediates interactions between parsers and othe... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class XChatLogTextPlugin:
"""Text parser plugin for XChat log files."""
def _ParseLogLine(self, parser_mediator, structure):
"""Parses a log line. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. structure (pypar... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class XChatLogTextPlugin:
"""Text parser plugin for XChat log files."""
def _ParseLogLine(self, parser_mediator, structure):
"""Parses a log line. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. structure (pyparsing.ParseRes... | the_stack_v2_python_sparse | plaso/parsers/text_plugins/xchatlog.py | log2timeline/plaso | train | 1,506 |
b40649f78e62e1a7f1cf93fe86becbb53f51a325 | [
"if not s:\n return ''\nn = len(s)\ndp = [[False] * n for _ in range(n)]\nmax_len = 1\nres = s[0]\nfor i in range(n):\n dp[i][i] = True\nfor j in range(1, n):\n for i in range(j):\n if s[i] == s[j]:\n if j - 1 - (i + 1) + 1 >= 2:\n dp[i][j] = dp[i + 1][j - 1]\n e... | <|body_start_0|>
if not s:
return ''
n = len(s)
dp = [[False] * n for _ in range(n)]
max_len = 1
res = s[0]
for i in range(n):
dp[i][i] = True
for j in range(1, n):
for i in range(j):
if s[i] == s[j]:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestPalindrome(self, s):
"""首先想到暴力:两重循环, 第一重,从头到尾遍历字符串,i 第二重,从头到尾取j属于[0, i], 看[i, j]是否为回文 时间复杂度:n**3 所以我们继续考虑,引入动态规划,空间换时间,这是从中间往外扩散过程 状态转移方程dp[i][j] = dp[i+1][j-1] if s[i] == s[j] and (j-1)-(i+1) + 1>= 2 True if s[i] == s[j] and j-1 - (i+1) + 1< 2 表明字符串长度不足2,为1 False if... | stack_v2_sparse_classes_75kplus_train_069074 | 4,417 | no_license | [
{
"docstring": "首先想到暴力:两重循环, 第一重,从头到尾遍历字符串,i 第二重,从头到尾取j属于[0, i], 看[i, j]是否为回文 时间复杂度:n**3 所以我们继续考虑,引入动态规划,空间换时间,这是从中间往外扩散过程 状态转移方程dp[i][j] = dp[i+1][j-1] if s[i] == s[j] and (j-1)-(i+1) + 1>= 2 True if s[i] == s[j] and j-1 - (i+1) + 1< 2 表明字符串长度不足2,为1 False if s[i] != s[j] 表明就不是字符串 考虑初始状态:自下而上,初始状态为字符串长度==1,dp[i... | 2 | stack_v2_sparse_classes_30k_train_052510 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, s): 首先想到暴力:两重循环, 第一重,从头到尾遍历字符串,i 第二重,从头到尾取j属于[0, i], 看[i, j]是否为回文 时间复杂度:n**3 所以我们继续考虑,引入动态规划,空间换时间,这是从中间往外扩散过程 状态转移方程dp[i][j] = dp[i+1][j-1] if s[i] =... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, s): 首先想到暴力:两重循环, 第一重,从头到尾遍历字符串,i 第二重,从头到尾取j属于[0, i], 看[i, j]是否为回文 时间复杂度:n**3 所以我们继续考虑,引入动态规划,空间换时间,这是从中间往外扩散过程 状态转移方程dp[i][j] = dp[i+1][j-1] if s[i] =... | f1bbd6b3197cd9ac4f0d35a37539c11b02272065 | <|skeleton|>
class Solution:
def longestPalindrome(self, s):
"""首先想到暴力:两重循环, 第一重,从头到尾遍历字符串,i 第二重,从头到尾取j属于[0, i], 看[i, j]是否为回文 时间复杂度:n**3 所以我们继续考虑,引入动态规划,空间换时间,这是从中间往外扩散过程 状态转移方程dp[i][j] = dp[i+1][j-1] if s[i] == s[j] and (j-1)-(i+1) + 1>= 2 True if s[i] == s[j] and j-1 - (i+1) + 1< 2 表明字符串长度不足2,为1 False if... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def longestPalindrome(self, s):
"""首先想到暴力:两重循环, 第一重,从头到尾遍历字符串,i 第二重,从头到尾取j属于[0, i], 看[i, j]是否为回文 时间复杂度:n**3 所以我们继续考虑,引入动态规划,空间换时间,这是从中间往外扩散过程 状态转移方程dp[i][j] = dp[i+1][j-1] if s[i] == s[j] and (j-1)-(i+1) + 1>= 2 True if s[i] == s[j] and j-1 - (i+1) + 1< 2 表明字符串长度不足2,为1 False if s[i] != s[j] ... | the_stack_v2_python_sparse | leetcode/动态规划/5. 最长回文子串/longestPalindrome.py | guohaoyuan/algorithms-for-work | train | 2 | |
96c56b5e1318bb37994c1186f8e6027a9be4ca12 | [
"if self.request.user.is_authenticated:\n if self.request.user.is_superuser:\n self.data_layer = 'admin_layer'\n else:\n self.data_layer = expressive_layer_name(self.request.user)",
"self.__set_layer_name()\ntry:\n unblocked_ids = self.request.session['datasets']\nexcept KeyError:\n unbl... | <|body_start_0|>
if self.request.user.is_authenticated:
if self.request.user.is_superuser:
self.data_layer = 'admin_layer'
else:
self.data_layer = expressive_layer_name(self.request.user)
<|end_body_0|>
<|body_start_1|>
self.__set_layer_name()
... | Template View to bring the necessary variables for the startup to the template | HomeView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HomeView:
"""Template View to bring the necessary variables for the startup to the template"""
def __set_layer_name(self):
"""Set name for layer in geoserver according to username or as admin_layer."""
<|body_0|>
def get_context_data(self, **kwargs: object):
"""C... | stack_v2_sparse_classes_75kplus_train_069075 | 37,263 | permissive | [
{
"docstring": "Set name for layer in geoserver according to username or as admin_layer.",
"name": "__set_layer_name",
"signature": "def __set_layer_name(self)"
},
{
"docstring": "Collect data needed for startup of V-FOR-WaTer Portal home. :param kwargs: :return:",
"name": "get_context_data"... | 2 | stack_v2_sparse_classes_30k_train_051748 | Implement the Python class `HomeView` described below.
Class description:
Template View to bring the necessary variables for the startup to the template
Method signatures and docstrings:
- def __set_layer_name(self): Set name for layer in geoserver according to username or as admin_layer.
- def get_context_data(self,... | Implement the Python class `HomeView` described below.
Class description:
Template View to bring the necessary variables for the startup to the template
Method signatures and docstrings:
- def __set_layer_name(self): Set name for layer in geoserver according to username or as admin_layer.
- def get_context_data(self,... | 9055095cbe796d6d6e2ce744d727ff60e27e09ed | <|skeleton|>
class HomeView:
"""Template View to bring the necessary variables for the startup to the template"""
def __set_layer_name(self):
"""Set name for layer in geoserver according to username or as admin_layer."""
<|body_0|>
def get_context_data(self, **kwargs: object):
"""C... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HomeView:
"""Template View to bring the necessary variables for the startup to the template"""
def __set_layer_name(self):
"""Set name for layer in geoserver according to username or as admin_layer."""
if self.request.user.is_authenticated:
if self.request.user.is_superuser:
... | the_stack_v2_python_sparse | vfw_home/views.py | VForWaTer/vforwater-portal | train | 8 |
0274e7d795b46e40021b4930afbaf1b7a419833a | [
"url = 'http://www.zhichiwangluo.com/management/marketing/distribution/distribution-rule-management/distribution-rule-management-rule?id=EQBYDcBill'\nself.driver.get(url)\nif self.isDispalyed(self.loc12) == True:\n self.click(self.loc12)\nself.click(self.loc1)\nself.clear(self.loc2)\nself.sendKyes(self.loc2, fir... | <|body_start_0|>
url = 'http://www.zhichiwangluo.com/management/marketing/distribution/distribution-rule-management/distribution-rule-management-rule?id=EQBYDcBill'
self.driver.get(url)
if self.isDispalyed(self.loc12) == True:
self.click(self.loc12)
self.click(self.loc1)
... | 分销 | Distribuiton | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Distribuiton:
"""分销"""
def distributionRule(self, first_Commission, second_Commission):
"""分销规则设置"""
<|body_0|>
def is_distrition_rule_sucess(self, _text):
"""是否添加成功"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
url = 'http://www.zhichiwangluo... | stack_v2_sparse_classes_75kplus_train_069076 | 4,645 | no_license | [
{
"docstring": "分销规则设置",
"name": "distributionRule",
"signature": "def distributionRule(self, first_Commission, second_Commission)"
},
{
"docstring": "是否添加成功",
"name": "is_distrition_rule_sucess",
"signature": "def is_distrition_rule_sucess(self, _text)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018791 | Implement the Python class `Distribuiton` described below.
Class description:
分销
Method signatures and docstrings:
- def distributionRule(self, first_Commission, second_Commission): 分销规则设置
- def is_distrition_rule_sucess(self, _text): 是否添加成功 | Implement the Python class `Distribuiton` described below.
Class description:
分销
Method signatures and docstrings:
- def distributionRule(self, first_Commission, second_Commission): 分销规则设置
- def is_distrition_rule_sucess(self, _text): 是否添加成功
<|skeleton|>
class Distribuiton:
"""分销"""
def distributionRule(sel... | 3b441375fade9ebff025054cedee107217fa2e98 | <|skeleton|>
class Distribuiton:
"""分销"""
def distributionRule(self, first_Commission, second_Commission):
"""分销规则设置"""
<|body_0|>
def is_distrition_rule_sucess(self, _text):
"""是否添加成功"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Distribuiton:
"""分销"""
def distributionRule(self, first_Commission, second_Commission):
"""分销规则设置"""
url = 'http://www.zhichiwangluo.com/management/marketing/distribution/distribution-rule-management/distribution-rule-management-rule?id=EQBYDcBill'
self.driver.get(url)
if ... | the_stack_v2_python_sparse | pages/distribution.py | srf123/zhichi | train | 0 |
83041592f69d5feb5005e60b631cf601eb447b87 | [
"model_list = providerModel.ProviderModel.get_all(self.db.session)\nproviders = [model.as_dict for model in model_list]\nresp.status = HTTP_200\nresp.media = {'providers': providers}",
"PROVIDER_NAME = req.media.get('name')\nmodel4provider = providerModel.ProviderModel(name=PROVIDER_NAME)\ntry:\n model4provide... | <|body_start_0|>
model_list = providerModel.ProviderModel.get_all(self.db.session)
providers = [model.as_dict for model in model_list]
resp.status = HTTP_200
resp.media = {'providers': providers}
<|end_body_0|>
<|body_start_1|>
PROVIDER_NAME = req.media.get('name')
model... | ProvidersCollection | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProvidersCollection:
def on_get(self, req, resp, **kwargs):
"""Get all providers --- summary: Fetches every existent provider description: Endpoint that retrieves every providers tags: - providers responses: 200: description: OK"""
<|body_0|>
def on_post(self, req, resp):
... | stack_v2_sparse_classes_75kplus_train_069077 | 5,502 | permissive | [
{
"docstring": "Get all providers --- summary: Fetches every existent provider description: Endpoint that retrieves every providers tags: - providers responses: 200: description: OK",
"name": "on_get",
"signature": "def on_get(self, req, resp, **kwargs)"
},
{
"docstring": "Post a provider --- su... | 2 | stack_v2_sparse_classes_30k_train_015626 | Implement the Python class `ProvidersCollection` described below.
Class description:
Implement the ProvidersCollection class.
Method signatures and docstrings:
- def on_get(self, req, resp, **kwargs): Get all providers --- summary: Fetches every existent provider description: Endpoint that retrieves every providers t... | Implement the Python class `ProvidersCollection` described below.
Class description:
Implement the ProvidersCollection class.
Method signatures and docstrings:
- def on_get(self, req, resp, **kwargs): Get all providers --- summary: Fetches every existent provider description: Endpoint that retrieves every providers t... | e2c74c36d5eb8492764205fe99558b0818473cb7 | <|skeleton|>
class ProvidersCollection:
def on_get(self, req, resp, **kwargs):
"""Get all providers --- summary: Fetches every existent provider description: Endpoint that retrieves every providers tags: - providers responses: 200: description: OK"""
<|body_0|>
def on_post(self, req, resp):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProvidersCollection:
def on_get(self, req, resp, **kwargs):
"""Get all providers --- summary: Fetches every existent provider description: Endpoint that retrieves every providers tags: - providers responses: 200: description: OK"""
model_list = providerModel.ProviderModel.get_all(self.db.sessi... | the_stack_v2_python_sparse | mobility-service-provider---service/msp/resources/providers.py | vicinityh2020/vicinity-vas-dreven | train | 0 | |
641123d783fd2d06d63f873908c00dcb757940c5 | [
"super().__init__(*args, **kwargs)\nself.model_dir: str = model_dir\nself.config = Config.from_file(os.path.join(self.model_dir, ModelFile.CONFIGURATION))\nself.text_field = IntentBPETextField(self.model_dir, config=self.config)\nself.categories = None\nwith open(os.path.join(self.model_dir, 'categories.json'), 'r'... | <|body_start_0|>
super().__init__(*args, **kwargs)
self.model_dir: str = model_dir
self.config = Config.from_file(os.path.join(self.model_dir, ModelFile.CONFIGURATION))
self.text_field = IntentBPETextField(self.model_dir, config=self.config)
self.categories = None
with op... | DialogIntentPredictionPreprocessor | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DialogIntentPredictionPreprocessor:
def __init__(self, model_dir: str, *args, **kwargs):
"""preprocess the data Args: model_dir (str): model path"""
<|body_0|>
def __call__(self, data: str) -> Dict[str, Any]:
"""process the raw input data Args: data (str): a sentence... | stack_v2_sparse_classes_75kplus_train_069078 | 2,701 | permissive | [
{
"docstring": "preprocess the data Args: model_dir (str): model path",
"name": "__init__",
"signature": "def __init__(self, model_dir: str, *args, **kwargs)"
},
{
"docstring": "process the raw input data Args: data (str): a sentence Example: 'What do I need to do for the card activation?' Retur... | 2 | stack_v2_sparse_classes_30k_train_011141 | Implement the Python class `DialogIntentPredictionPreprocessor` described below.
Class description:
Implement the DialogIntentPredictionPreprocessor class.
Method signatures and docstrings:
- def __init__(self, model_dir: str, *args, **kwargs): preprocess the data Args: model_dir (str): model path
- def __call__(self... | Implement the Python class `DialogIntentPredictionPreprocessor` described below.
Class description:
Implement the DialogIntentPredictionPreprocessor class.
Method signatures and docstrings:
- def __init__(self, model_dir: str, *args, **kwargs): preprocess the data Args: model_dir (str): model path
- def __call__(self... | 8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6 | <|skeleton|>
class DialogIntentPredictionPreprocessor:
def __init__(self, model_dir: str, *args, **kwargs):
"""preprocess the data Args: model_dir (str): model path"""
<|body_0|>
def __call__(self, data: str) -> Dict[str, Any]:
"""process the raw input data Args: data (str): a sentence... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DialogIntentPredictionPreprocessor:
def __init__(self, model_dir: str, *args, **kwargs):
"""preprocess the data Args: model_dir (str): model path"""
super().__init__(*args, **kwargs)
self.model_dir: str = model_dir
self.config = Config.from_file(os.path.join(self.model_dir, Mod... | the_stack_v2_python_sparse | ai/modelscope/modelscope/preprocessors/nlp/space/dialog_intent_prediction_preprocessor.py | alldatacenter/alldata | train | 774 | |
e8e29f5ac83d58e5d02fb3c5bacbdbe4839c6fb0 | [
"if len(s) != len(t):\n return False\nif sorted(s) != sorted(t):\n return False\nreturn True",
"if len(s) != len(t):\n return False\ndict_s = {}\ndict_t = {}\nfor ch in s:\n dict_s[ch] = dict_s.get(ch, 0) + 1\nfor ch in t:\n dict_t[ch] = dict_t.get(ch, 0) + 1\nif dict_s != dict_t:\n return False... | <|body_start_0|>
if len(s) != len(t):
return False
if sorted(s) != sorted(t):
return False
return True
<|end_body_0|>
<|body_start_1|>
if len(s) != len(t):
return False
dict_s = {}
dict_t = {}
for ch in s:
dict_s[ch... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isAnagram(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_0|>
def isAnagram2(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(s) != len(t):
retur... | stack_v2_sparse_classes_75kplus_train_069079 | 849 | no_license | [
{
"docstring": ":type s: str :type t: str :rtype: bool",
"name": "isAnagram",
"signature": "def isAnagram(self, s, t)"
},
{
"docstring": ":type s: str :type t: str :rtype: bool",
"name": "isAnagram2",
"signature": "def isAnagram2(self, s, t)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isAnagram(self, s, t): :type s: str :type t: str :rtype: bool
- def isAnagram2(self, s, t): :type s: str :type t: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isAnagram(self, s, t): :type s: str :type t: str :rtype: bool
- def isAnagram2(self, s, t): :type s: str :type t: str :rtype: bool
<|skeleton|>
class Solution:
def isAn... | 46191f2adfd3687259a670b93dd7912f1fa7db82 | <|skeleton|>
class Solution:
def isAnagram(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_0|>
def isAnagram2(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isAnagram(self, s, t):
""":type s: str :type t: str :rtype: bool"""
if len(s) != len(t):
return False
if sorted(s) != sorted(t):
return False
return True
def isAnagram2(self, s, t):
""":type s: str :type t: str :rtype: bool"""
... | the_stack_v2_python_sparse | Week_02/solution242_is_anagram.py | hongfeng2013/algorithm009-class01 | train | 0 | |
69a7db37f552a29e804b6bdf8cd3878c590c8602 | [
"_LOGGER.debug('Enable sentry mode: %s', self.name)\nawait self.tesla_device.enable_sentry_mode()\nself.async_write_ha_state()",
"_LOGGER.debug('Disable sentry mode: %s', self.name)\nawait self.tesla_device.disable_sentry_mode()\nself.async_write_ha_state()",
"if self.tesla_device.is_on() is None:\n return N... | <|body_start_0|>
_LOGGER.debug('Enable sentry mode: %s', self.name)
await self.tesla_device.enable_sentry_mode()
self.async_write_ha_state()
<|end_body_0|>
<|body_start_1|>
_LOGGER.debug('Disable sentry mode: %s', self.name)
await self.tesla_device.disable_sentry_mode()
... | Representation of a Tesla sentry mode switch. | SentryModeSwitch | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SentryModeSwitch:
"""Representation of a Tesla sentry mode switch."""
async def async_turn_on(self, **kwargs):
"""Send the on command."""
<|body_0|>
async def async_turn_off(self, **kwargs):
"""Send the off command."""
<|body_1|>
def is_on(self):
... | stack_v2_sparse_classes_75kplus_train_069080 | 4,636 | permissive | [
{
"docstring": "Send the on command.",
"name": "async_turn_on",
"signature": "async def async_turn_on(self, **kwargs)"
},
{
"docstring": "Send the off command.",
"name": "async_turn_off",
"signature": "async def async_turn_off(self, **kwargs)"
},
{
"docstring": "Get whether the s... | 3 | stack_v2_sparse_classes_30k_val_002653 | Implement the Python class `SentryModeSwitch` described below.
Class description:
Representation of a Tesla sentry mode switch.
Method signatures and docstrings:
- async def async_turn_on(self, **kwargs): Send the on command.
- async def async_turn_off(self, **kwargs): Send the off command.
- def is_on(self): Get whe... | Implement the Python class `SentryModeSwitch` described below.
Class description:
Representation of a Tesla sentry mode switch.
Method signatures and docstrings:
- async def async_turn_on(self, **kwargs): Send the on command.
- async def async_turn_off(self, **kwargs): Send the off command.
- def is_on(self): Get whe... | 2fee32fce03bc49e86cf2e7b741a15621a97cce5 | <|skeleton|>
class SentryModeSwitch:
"""Representation of a Tesla sentry mode switch."""
async def async_turn_on(self, **kwargs):
"""Send the on command."""
<|body_0|>
async def async_turn_off(self, **kwargs):
"""Send the off command."""
<|body_1|>
def is_on(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SentryModeSwitch:
"""Representation of a Tesla sentry mode switch."""
async def async_turn_on(self, **kwargs):
"""Send the on command."""
_LOGGER.debug('Enable sentry mode: %s', self.name)
await self.tesla_device.enable_sentry_mode()
self.async_write_ha_state()
async ... | the_stack_v2_python_sparse | homeassistant/components/tesla/switch.py | BenWoodford/home-assistant | train | 11 |
44cd910dda05b0f07c9339f3a0fc6d95e9977bb3 | [
"if '_xml_ns' in kwargs:\n self._xml_ns = kwargs['_xml_ns']\nif '_xml_ns_key' in kwargs:\n self._xml_ns_key = kwargs['_xml_ns_key']\nself.Collections = Collections\nself.Products = Products\nsuper(ExploitationFeaturesType, self).__init__(**kwargs)",
"if isinstance(sicd, (list, tuple)):\n collections = []... | <|body_start_0|>
if '_xml_ns' in kwargs:
self._xml_ns = kwargs['_xml_ns']
if '_xml_ns_key' in kwargs:
self._xml_ns_key = kwargs['_xml_ns_key']
self.Collections = Collections
self.Products = Products
super(ExploitationFeaturesType, self).__init__(**kwargs)
... | Computed metadata regarding the collect. | ExploitationFeaturesType | [
"MIT",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExploitationFeaturesType:
"""Computed metadata regarding the collect."""
def __init__(self, Collections=None, Products=None, **kwargs):
"""Parameters ---------- Collections : List[CollectionType] Products : List[ExploitationFeaturesProductType] kwargs"""
<|body_0|>
def f... | stack_v2_sparse_classes_75kplus_train_069081 | 34,922 | permissive | [
{
"docstring": "Parameters ---------- Collections : List[CollectionType] Products : List[ExploitationFeaturesProductType] kwargs",
"name": "__init__",
"signature": "def __init__(self, Collections=None, Products=None, **kwargs)"
},
{
"docstring": "Construct from a sicd element. Parameters -------... | 2 | stack_v2_sparse_classes_30k_train_051952 | Implement the Python class `ExploitationFeaturesType` described below.
Class description:
Computed metadata regarding the collect.
Method signatures and docstrings:
- def __init__(self, Collections=None, Products=None, **kwargs): Parameters ---------- Collections : List[CollectionType] Products : List[ExploitationFea... | Implement the Python class `ExploitationFeaturesType` described below.
Class description:
Computed metadata regarding the collect.
Method signatures and docstrings:
- def __init__(self, Collections=None, Products=None, **kwargs): Parameters ---------- Collections : List[CollectionType] Products : List[ExploitationFea... | de1b1886f161a83b6c89aadc7a2c7cfc4892ef81 | <|skeleton|>
class ExploitationFeaturesType:
"""Computed metadata regarding the collect."""
def __init__(self, Collections=None, Products=None, **kwargs):
"""Parameters ---------- Collections : List[CollectionType] Products : List[ExploitationFeaturesProductType] kwargs"""
<|body_0|>
def f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExploitationFeaturesType:
"""Computed metadata regarding the collect."""
def __init__(self, Collections=None, Products=None, **kwargs):
"""Parameters ---------- Collections : List[CollectionType] Products : List[ExploitationFeaturesProductType] kwargs"""
if '_xml_ns' in kwargs:
... | the_stack_v2_python_sparse | sarpy/io/product/sidd2_elements/ExploitationFeatures.py | ngageoint/sarpy | train | 192 |
02cb5e2a47f634fb905fc7d9c62d4fee83368cfa | [
"super(Classifier, self).__init__()\nself.fc1 = blk.LinearReLU(in_dim=num_channels, out_dim=128)\nself.fc2 = blk.LinearReLU(in_dim=128, out_dim=64)\nself.fc3 = nn.Linear(in_features=64, out_features=2)",
"y = F.relu(self.fc1(x))\ny = F.relu(self.fc2(y))\ny = self.fc3(y)\nreturn y"
] | <|body_start_0|>
super(Classifier, self).__init__()
self.fc1 = blk.LinearReLU(in_dim=num_channels, out_dim=128)
self.fc2 = blk.LinearReLU(in_dim=128, out_dim=64)
self.fc3 = nn.Linear(in_features=64, out_features=2)
<|end_body_0|>
<|body_start_1|>
y = F.relu(self.fc1(x))
... | Classifier | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Classifier:
def __init__(self, num_channels: int):
"""represents the correlation and concatenation classifying heads. :param num_channels: feature dimension of the merged vector."""
<|body_0|>
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""forward pass implem... | stack_v2_sparse_classes_75kplus_train_069082 | 965 | permissive | [
{
"docstring": "represents the correlation and concatenation classifying heads. :param num_channels: feature dimension of the merged vector.",
"name": "__init__",
"signature": "def __init__(self, num_channels: int)"
},
{
"docstring": "forward pass implementation. :param x: input tensor. :return:... | 2 | stack_v2_sparse_classes_30k_train_013785 | Implement the Python class `Classifier` described below.
Class description:
Implement the Classifier class.
Method signatures and docstrings:
- def __init__(self, num_channels: int): represents the correlation and concatenation classifying heads. :param num_channels: feature dimension of the merged vector.
- def forw... | Implement the Python class `Classifier` described below.
Class description:
Implement the Classifier class.
Method signatures and docstrings:
- def __init__(self, num_channels: int): represents the correlation and concatenation classifying heads. :param num_channels: feature dimension of the merged vector.
- def forw... | 583e6868864582f081f18689124e74e9ca169f28 | <|skeleton|>
class Classifier:
def __init__(self, num_channels: int):
"""represents the correlation and concatenation classifying heads. :param num_channels: feature dimension of the merged vector."""
<|body_0|>
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""forward pass implem... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Classifier:
def __init__(self, num_channels: int):
"""represents the correlation and concatenation classifying heads. :param num_channels: feature dimension of the merged vector."""
super(Classifier, self).__init__()
self.fc1 = blk.LinearReLU(in_dim=num_channels, out_dim=128)
s... | the_stack_v2_python_sparse | models/classifier.py | beaupreda/domain-networks | train | 1 | |
f51a5b840773d07f4548dc2e7a52e2ad51ff18b7 | [
"super().__init__(**kwargs)\nself.LayerNorm = tf.keras.layers.LayerNormalization(epsilon=1e-05, name='LayerNorm')\nself.dropout = tf.keras.layers.Dropout(config.hidden_dropout_prob)",
"hidden_states, input_tensor = inputs\nhidden_states = self.dropout(hidden_states, training=training)\nhidden_states = self.LayerN... | <|body_start_0|>
super().__init__(**kwargs)
self.LayerNorm = tf.keras.layers.LayerNormalization(epsilon=1e-05, name='LayerNorm')
self.dropout = tf.keras.layers.Dropout(config.hidden_dropout_prob)
<|end_body_0|>
<|body_start_1|>
hidden_states, input_tensor = inputs
hidden_states ... | Add & Norm module. | Add_and_Norm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Add_and_Norm:
"""Add & Norm module."""
def __init__(self, config, **kwargs):
"""Init variables."""
<|body_0|>
def call(self, inputs, training=False):
"""Call logic."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super().__init__(**kwargs)
... | stack_v2_sparse_classes_75kplus_train_069083 | 3,355 | permissive | [
{
"docstring": "Init variables.",
"name": "__init__",
"signature": "def __init__(self, config, **kwargs)"
},
{
"docstring": "Call logic.",
"name": "call",
"signature": "def call(self, inputs, training=False)"
}
] | 2 | null | Implement the Python class `Add_and_Norm` described below.
Class description:
Add & Norm module.
Method signatures and docstrings:
- def __init__(self, config, **kwargs): Init variables.
- def call(self, inputs, training=False): Call logic. | Implement the Python class `Add_and_Norm` described below.
Class description:
Add & Norm module.
Method signatures and docstrings:
- def __init__(self, config, **kwargs): Init variables.
- def call(self, inputs, training=False): Call logic.
<|skeleton|>
class Add_and_Norm:
"""Add & Norm module."""
def __ini... | 59b523e4b11c827e38cc37817da145af15713bcd | <|skeleton|>
class Add_and_Norm:
"""Add & Norm module."""
def __init__(self, config, **kwargs):
"""Init variables."""
<|body_0|>
def call(self, inputs, training=False):
"""Call logic."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Add_and_Norm:
"""Add & Norm module."""
def __init__(self, config, **kwargs):
"""Init variables."""
super().__init__(**kwargs)
self.LayerNorm = tf.keras.layers.LayerNormalization(epsilon=1e-05, name='LayerNorm')
self.dropout = tf.keras.layers.Dropout(config.hidden_dropout_p... | the_stack_v2_python_sparse | tensorflow_tts/modules/FFT.py | ivenlau/FS2_TTS | train | 0 |
6f7b9a779abd8fe5f117f7610525cc19a0a63d52 | [
"super().__init__()\nself._initialize_arguments(args)\nself.embedding = nn.Linear(self.output_dim, self.rnn_units)\nself.gat_layers = nn.ModuleList([gat_cell.GATGRUCell(args) for _ in range(self.num_rnn_layers)])\nself.fc_out = nn.Linear(self.rnn_units, self.output_dim)\nself.dropout = nn.Dropout(self.dropout)\nsel... | <|body_start_0|>
super().__init__()
self._initialize_arguments(args)
self.embedding = nn.Linear(self.output_dim, self.rnn_units)
self.gat_layers = nn.ModuleList([gat_cell.GATGRUCell(args) for _ in range(self.num_rnn_layers)])
self.fc_out = nn.Linear(self.rnn_units, self.output_di... | Implements GATRNN encoder model. Decodes the input hidden vector to the output time series sequence. | Decoder | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Decoder:
"""Implements GATRNN encoder model. Decodes the input hidden vector to the output time series sequence."""
def __init__(self, args):
"""Instantiates the GATRNN encoder model. Args: args: python argparse.ArgumentParser class, we only use model-related arguments here."""
... | stack_v2_sparse_classes_75kplus_train_069084 | 13,550 | permissive | [
{
"docstring": "Instantiates the GATRNN encoder model. Args: args: python argparse.ArgumentParser class, we only use model-related arguments here.",
"name": "__init__",
"signature": "def __init__(self, args)"
},
{
"docstring": "Decoder forward pass. Args: inputs: input one-step time series, with... | 2 | stack_v2_sparse_classes_30k_train_001675 | Implement the Python class `Decoder` described below.
Class description:
Implements GATRNN encoder model. Decodes the input hidden vector to the output time series sequence.
Method signatures and docstrings:
- def __init__(self, args): Instantiates the GATRNN encoder model. Args: args: python argparse.ArgumentParser ... | Implement the Python class `Decoder` described below.
Class description:
Implements GATRNN encoder model. Decodes the input hidden vector to the output time series sequence.
Method signatures and docstrings:
- def __init__(self, args): Instantiates the GATRNN encoder model. Args: args: python argparse.ArgumentParser ... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class Decoder:
"""Implements GATRNN encoder model. Decodes the input hidden vector to the output time series sequence."""
def __init__(self, args):
"""Instantiates the GATRNN encoder model. Args: args: python argparse.ArgumentParser class, we only use model-related arguments here."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Decoder:
"""Implements GATRNN encoder model. Decodes the input hidden vector to the output time series sequence."""
def __init__(self, args):
"""Instantiates the GATRNN encoder model. Args: args: python argparse.ArgumentParser class, we only use model-related arguments here."""
super().__... | the_stack_v2_python_sparse | editable_graph_temporal/model/gat_model.py | Jimmy-INL/google-research | train | 1 |
22f7f03eec6f53917c83f28b2da5d4a8d380dfba | [
"dot = Digraph(format='png')\nDibujante.subDibujar(arbol, dot)\ndot.render('output2.png', view=True)",
"dot.node(str(id(arbol)), str(arbol.valor) + ('\\n(' + str(round(arbol.ganancia, 2)) + ',' + str(round(arbol.gananciaRelativa * 100, 2)) + '%)' if arbol.ganancia != 0 else ''))\nfor l, h in arbol.hijos.iteritems... | <|body_start_0|>
dot = Digraph(format='png')
Dibujante.subDibujar(arbol, dot)
dot.render('output2.png', view=True)
<|end_body_0|>
<|body_start_1|>
dot.node(str(id(arbol)), str(arbol.valor) + ('\n(' + str(round(arbol.ganancia, 2)) + ',' + str(round(arbol.gananciaRelativa * 100, 2)) + '%)... | Clase que permite obtener una representacion grafica de un arbol de decision | Dibujante | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dibujante:
"""Clase que permite obtener una representacion grafica de un arbol de decision"""
def dibujar(arbol):
"""Construye una representacion grafica del arbol en formato .png"""
<|body_0|>
def subDibujar(arbol, dot):
"""Sub-rutina que dibuja un nodo del arbo... | stack_v2_sparse_classes_75kplus_train_069085 | 978 | no_license | [
{
"docstring": "Construye una representacion grafica del arbol en formato .png",
"name": "dibujar",
"signature": "def dibujar(arbol)"
},
{
"docstring": "Sub-rutina que dibuja un nodo del arbol y se llama recursivamente para dibujar a los hijos",
"name": "subDibujar",
"signature": "def su... | 2 | stack_v2_sparse_classes_30k_train_023500 | Implement the Python class `Dibujante` described below.
Class description:
Clase que permite obtener una representacion grafica de un arbol de decision
Method signatures and docstrings:
- def dibujar(arbol): Construye una representacion grafica del arbol en formato .png
- def subDibujar(arbol, dot): Sub-rutina que di... | Implement the Python class `Dibujante` described below.
Class description:
Clase que permite obtener una representacion grafica de un arbol de decision
Method signatures and docstrings:
- def dibujar(arbol): Construye una representacion grafica del arbol en formato .png
- def subDibujar(arbol, dot): Sub-rutina que di... | ecc727c952f2f9ff1d81c407f14ce39ec3b4f605 | <|skeleton|>
class Dibujante:
"""Clase que permite obtener una representacion grafica de un arbol de decision"""
def dibujar(arbol):
"""Construye una representacion grafica del arbol en formato .png"""
<|body_0|>
def subDibujar(arbol, dot):
"""Sub-rutina que dibuja un nodo del arbo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Dibujante:
"""Clase que permite obtener una representacion grafica de un arbol de decision"""
def dibujar(arbol):
"""Construye una representacion grafica del arbol en formato .png"""
dot = Digraph(format='png')
Dibujante.subDibujar(arbol, dot)
dot.render('output2.png', vie... | the_stack_v2_python_sparse | Practico2/Entrega/dibujante.py | gsiriani/MAA | train | 0 |
812496bf433164a1884cb31f3017717d8c94a4c6 | [
"if context is None:\n context = {}\nres = {}\nfor stock_picking in self.browse(cr, uid, ids, context=context):\n res[stock_picking.id] = False\n if stock_picking.sale_id and stock_picking.sale_id.purchase_order_id or (stock_picking.purchase_id and stock_picking.purchase_id.sale_order_id):\n res[sto... | <|body_start_0|>
if context is None:
context = {}
res = {}
for stock_picking in self.browse(cr, uid, ids, context=context):
res[stock_picking.id] = False
if stock_picking.sale_id and stock_picking.sale_id.purchase_order_id or (stock_picking.purchase_id and sto... | stock_picking | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class stock_picking:
def _get_is_edi(self, cr, uid, ids, name, args, context=None):
"""This method will return if the picking is or not an edi picking"""
<|body_0|>
def _edi_link(self, cr, uid, picking_id, context=None):
"""Method to update the related pickings"""
... | stack_v2_sparse_classes_75kplus_train_069086 | 19,840 | no_license | [
{
"docstring": "This method will return if the picking is or not an edi picking",
"name": "_get_is_edi",
"signature": "def _get_is_edi(self, cr, uid, ids, name, args, context=None)"
},
{
"docstring": "Method to update the related pickings",
"name": "_edi_link",
"signature": "def _edi_lin... | 4 | stack_v2_sparse_classes_30k_train_048161 | Implement the Python class `stock_picking` described below.
Class description:
Implement the stock_picking class.
Method signatures and docstrings:
- def _get_is_edi(self, cr, uid, ids, name, args, context=None): This method will return if the picking is or not an edi picking
- def _edi_link(self, cr, uid, picking_id... | Implement the Python class `stock_picking` described below.
Class description:
Implement the stock_picking class.
Method signatures and docstrings:
- def _get_is_edi(self, cr, uid, ids, name, args, context=None): This method will return if the picking is or not an edi picking
- def _edi_link(self, cr, uid, picking_id... | 3e35f7ba7246c54e5a5b31921b28aa5f1ab24999 | <|skeleton|>
class stock_picking:
def _get_is_edi(self, cr, uid, ids, name, args, context=None):
"""This method will return if the picking is or not an edi picking"""
<|body_0|>
def _edi_link(self, cr, uid, picking_id, context=None):
"""Method to update the related pickings"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class stock_picking:
def _get_is_edi(self, cr, uid, ids, name, args, context=None):
"""This method will return if the picking is or not an edi picking"""
if context is None:
context = {}
res = {}
for stock_picking in self.browse(cr, uid, ids, context=context):
... | the_stack_v2_python_sparse | intercompany_warehouse/stock.py | mgielissen/julius-openobject-addons | train | 1 | |
8f17031301385717c59b9c0cab1453286ec10da7 | [
"res = []\nfor i in range(len(nums) - 1):\n triplets = self.threeSum(nums[i + 1:], target - nums[i])\n for tp in triplets:\n tmp = [nums[i]] + tp\n tmp.sort()\n if tmp not in res:\n res.append(tmp)\nreturn res",
"res = []\nlength = len(nums)\nif nums is None or length < 3:\n ... | <|body_start_0|>
res = []
for i in range(len(nums) - 1):
triplets = self.threeSum(nums[i + 1:], target - nums[i])
for tp in triplets:
tmp = [nums[i]] + tp
tmp.sort()
if tmp not in res:
res.append(tmp)
ret... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def fourSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[List[int]]"""
<|body_0|>
def threeSum(self, nums, target):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_069087 | 1,987 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]]",
"name": "fourSum",
"signature": "def fourSum(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "threeSum",
"signature": "def threeSum(self, nums, target)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]]
- def threeSum(self, nums, target): :type nums: List[int] :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]]
- def threeSum(self, nums, target): :type nums: List[int] :rtype: List[List[int]]... | 0821af55eca60084b503b5f751301048c55e4381 | <|skeleton|>
class Solution:
def fourSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[List[int]]"""
<|body_0|>
def threeSum(self, nums, target):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def fourSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[List[int]]"""
res = []
for i in range(len(nums) - 1):
triplets = self.threeSum(nums[i + 1:], target - nums[i])
for tp in triplets:
tmp = [nums[i]] ... | the_stack_v2_python_sparse | Medium/LC18.py | shuowenwei/LeetCodePython | train | 2 | |
e203b2a3e0f3238bbe95e85b07fc2949520e0903 | [
"for entry in self._async_current_entries():\n if entry.data[CONF_HOST] == conf[CONF_HOST]:\n return self.async_abort(reason='already_configured')\nreturn await self.async_step_user({CONF_HOST: conf[CONF_HOST], CONF_API_VERSION: conf[CONF_API_VERSION]})",
"errors = {}\nif user_input:\n self._default ... | <|body_start_0|>
for entry in self._async_current_entries():
if entry.data[CONF_HOST] == conf[CONF_HOST]:
return self.async_abort(reason='already_configured')
return await self.async_step_user({CONF_HOST: conf[CONF_HOST], CONF_API_VERSION: conf[CONF_API_VERSION]})
<|end_body_... | Handle a config flow for Philips TV. | ConfigFlow | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigFlow:
"""Handle a config flow for Philips TV."""
async def async_step_import(self, conf: Dict[str, Any]):
"""Import a configuration from config.yaml."""
<|body_0|>
async def async_step_user(self, user_input: Optional[FlowUserDict]=None):
"""Handle the initi... | stack_v2_sparse_classes_75kplus_train_069088 | 2,801 | permissive | [
{
"docstring": "Import a configuration from config.yaml.",
"name": "async_step_import",
"signature": "async def async_step_import(self, conf: Dict[str, Any])"
},
{
"docstring": "Handle the initial step.",
"name": "async_step_user",
"signature": "async def async_step_user(self, user_input... | 2 | null | Implement the Python class `ConfigFlow` described below.
Class description:
Handle a config flow for Philips TV.
Method signatures and docstrings:
- async def async_step_import(self, conf: Dict[str, Any]): Import a configuration from config.yaml.
- async def async_step_user(self, user_input: Optional[FlowUserDict]=No... | Implement the Python class `ConfigFlow` described below.
Class description:
Handle a config flow for Philips TV.
Method signatures and docstrings:
- async def async_step_import(self, conf: Dict[str, Any]): Import a configuration from config.yaml.
- async def async_step_user(self, user_input: Optional[FlowUserDict]=No... | 4ab0151fb1cbefb31def23ba850e197da0a5027f | <|skeleton|>
class ConfigFlow:
"""Handle a config flow for Philips TV."""
async def async_step_import(self, conf: Dict[str, Any]):
"""Import a configuration from config.yaml."""
<|body_0|>
async def async_step_user(self, user_input: Optional[FlowUserDict]=None):
"""Handle the initi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConfigFlow:
"""Handle a config flow for Philips TV."""
async def async_step_import(self, conf: Dict[str, Any]):
"""Import a configuration from config.yaml."""
for entry in self._async_current_entries():
if entry.data[CONF_HOST] == conf[CONF_HOST]:
return self.a... | the_stack_v2_python_sparse | homeassistant/components/philips_js/config_flow.py | turbokongen/home-assistant | train | 4 |
5245796541d8f9a6c54ce86dcae46ab22a31d3a0 | [
"self.dataset_class = dataset_class\nself.tag = tag\nself.vr = vr\nself.value = value\nself.value_key = value_key\nself.bulk_data_uri_handler = bulk_data_uri_handler",
"from pydicom.dataelem import empty_value_for_VR\nif self.value_key == 'Value':\n if not isinstance(self.value, list):\n fmt = '\"{}\" o... | <|body_start_0|>
self.dataset_class = dataset_class
self.tag = tag
self.vr = vr
self.value = value
self.value_key = value_key
self.bulk_data_uri_handler = bulk_data_uri_handler
<|end_body_0|>
<|body_start_1|>
from pydicom.dataelem import empty_value_for_VR
... | Handles conversion between JSON struct and :class:`DataElement`. .. versionadded:: 1.4 | JsonDataElementConverter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JsonDataElementConverter:
"""Handles conversion between JSON struct and :class:`DataElement`. .. versionadded:: 1.4"""
def __init__(self, dataset_class, tag, vr, value, value_key, bulk_data_uri_handler):
"""Create a new converter instance. Parameters ---------- dataset_class : datase... | stack_v2_sparse_classes_75kplus_train_069089 | 8,985 | no_license | [
{
"docstring": "Create a new converter instance. Parameters ---------- dataset_class : dataset.Dataset derived class Class used to create sequence items. tag : BaseTag The data element tag. vr : str The data element value representation. value : list The data element's value(s). value_key : str or None Key of t... | 5 | stack_v2_sparse_classes_30k_train_024744 | Implement the Python class `JsonDataElementConverter` described below.
Class description:
Handles conversion between JSON struct and :class:`DataElement`. .. versionadded:: 1.4
Method signatures and docstrings:
- def __init__(self, dataset_class, tag, vr, value, value_key, bulk_data_uri_handler): Create a new convert... | Implement the Python class `JsonDataElementConverter` described below.
Class description:
Handles conversion between JSON struct and :class:`DataElement`. .. versionadded:: 1.4
Method signatures and docstrings:
- def __init__(self, dataset_class, tag, vr, value, value_key, bulk_data_uri_handler): Create a new convert... | f393a945e733fcfe0c63f5dcfffc44c60d2a5862 | <|skeleton|>
class JsonDataElementConverter:
"""Handles conversion between JSON struct and :class:`DataElement`. .. versionadded:: 1.4"""
def __init__(self, dataset_class, tag, vr, value, value_key, bulk_data_uri_handler):
"""Create a new converter instance. Parameters ---------- dataset_class : datase... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class JsonDataElementConverter:
"""Handles conversion between JSON struct and :class:`DataElement`. .. versionadded:: 1.4"""
def __init__(self, dataset_class, tag, vr, value, value_key, bulk_data_uri_handler):
"""Create a new converter instance. Parameters ---------- dataset_class : dataset.Dataset der... | the_stack_v2_python_sparse | venv/Lib/site-packages/pydicom/jsonrep.py | Wushaoyong/tensflowtest | train | 0 |
6d98bbf37a4d45e2ca495cb62db174b5b0340143 | [
"try:\n float(s)\n return True\nexcept ValueError:\n return False",
"try:\n float(s)\n return True\nexcept ValueError:\n return False",
"valid = False\nif dtype == np.bool_:\n valid = True\nelif dtype == str:\n valid = True\nelif dtype == int:\n valid = OptionUtil.isint(val)\nelif dty... | <|body_start_0|>
try:
float(s)
return True
except ValueError:
return False
<|end_body_0|>
<|body_start_1|>
try:
float(s)
return True
except ValueError:
return False
<|end_body_1|>
<|body_start_2|>
valid = F... | OptionUtil | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OptionUtil:
def isfloat(s):
"""Simple method to check that a string is a valid floating point variable Parameters ---------- s : str Returns ------- bool"""
<|body_0|>
def isint(s):
"""Simple data check method to check that a string is a valid integer Parameters ----... | stack_v2_sparse_classes_75kplus_train_069090 | 14,681 | permissive | [
{
"docstring": "Simple method to check that a string is a valid floating point variable Parameters ---------- s : str Returns ------- bool",
"name": "isfloat",
"signature": "def isfloat(s)"
},
{
"docstring": "Simple data check method to check that a string is a valid integer Parameters ---------... | 3 | stack_v2_sparse_classes_30k_val_001329 | Implement the Python class `OptionUtil` described below.
Class description:
Implement the OptionUtil class.
Method signatures and docstrings:
- def isfloat(s): Simple method to check that a string is a valid floating point variable Parameters ---------- s : str Returns ------- bool
- def isint(s): Simple data check m... | Implement the Python class `OptionUtil` described below.
Class description:
Implement the OptionUtil class.
Method signatures and docstrings:
- def isfloat(s): Simple method to check that a string is a valid floating point variable Parameters ---------- s : str Returns ------- bool
- def isint(s): Simple data check m... | 7db7869f34b875c9f76d42b7a4801b0c23738448 | <|skeleton|>
class OptionUtil:
def isfloat(s):
"""Simple method to check that a string is a valid floating point variable Parameters ---------- s : str Returns ------- bool"""
<|body_0|>
def isint(s):
"""Simple data check method to check that a string is a valid integer Parameters ----... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OptionUtil:
def isfloat(s):
"""Simple method to check that a string is a valid floating point variable Parameters ---------- s : str Returns ------- bool"""
try:
float(s)
return True
except ValueError:
return False
def isint(s):
"""Simpl... | the_stack_v2_python_sparse | hataripy/utils/optionblock.py | hatarilabs/hataripy | train | 4 | |
370fb5f38c5dc50220443b44b196ced6fa06e4ae | [
"self.apex_domain = ''\nself.ip = ''\nself.count = ''\nself.status = True\nself.url = url\nself.csp_header = ''\nself.sub_domains = set()",
"try:\n async with aiohttp.request('HEAD', url=self.url, headers={'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.32... | <|body_start_0|>
self.apex_domain = ''
self.ip = ''
self.count = ''
self.status = True
self.url = url
self.csp_header = ''
self.sub_domains = set()
<|end_body_0|>
<|body_start_1|>
try:
async with aiohttp.request('HEAD', url=self.url, headers={... | 利用csp头搜集子域名 | CSPInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CSPInfo:
"""利用csp头搜集子域名"""
def __init__(self, url):
""":param apex_domain: csp头中对应的顶级域名 :param ip: 域名对应ip地址 :param count: 域名有几个子域名 :param status: 域名是否可访问 :param url: 网址"""
<|body_0|>
async def get_csp_header(self):
"""获取url的csp头"""
<|body_1|>
def get... | stack_v2_sparse_classes_75kplus_train_069091 | 3,401 | permissive | [
{
"docstring": ":param apex_domain: csp头中对应的顶级域名 :param ip: 域名对应ip地址 :param count: 域名有几个子域名 :param status: 域名是否可访问 :param url: 网址",
"name": "__init__",
"signature": "def __init__(self, url)"
},
{
"docstring": "获取url的csp头",
"name": "get_csp_header",
"signature": "async def get_csp_header(... | 3 | stack_v2_sparse_classes_30k_train_038088 | Implement the Python class `CSPInfo` described below.
Class description:
利用csp头搜集子域名
Method signatures and docstrings:
- def __init__(self, url): :param apex_domain: csp头中对应的顶级域名 :param ip: 域名对应ip地址 :param count: 域名有几个子域名 :param status: 域名是否可访问 :param url: 网址
- async def get_csp_header(self): 获取url的csp头
- def get_sub... | Implement the Python class `CSPInfo` described below.
Class description:
利用csp头搜集子域名
Method signatures and docstrings:
- def __init__(self, url): :param apex_domain: csp头中对应的顶级域名 :param ip: 域名对应ip地址 :param count: 域名有几个子域名 :param status: 域名是否可访问 :param url: 网址
- async def get_csp_header(self): 获取url的csp头
- def get_sub... | 0d1d31c9abf1d3293d113bff46c400b246434807 | <|skeleton|>
class CSPInfo:
"""利用csp头搜集子域名"""
def __init__(self, url):
""":param apex_domain: csp头中对应的顶级域名 :param ip: 域名对应ip地址 :param count: 域名有几个子域名 :param status: 域名是否可访问 :param url: 网址"""
<|body_0|>
async def get_csp_header(self):
"""获取url的csp头"""
<|body_1|>
def get... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CSPInfo:
"""利用csp头搜集子域名"""
def __init__(self, url):
""":param apex_domain: csp头中对应的顶级域名 :param ip: 域名对应ip地址 :param count: 域名有几个子域名 :param status: 域名是否可访问 :param url: 网址"""
self.apex_domain = ''
self.ip = ''
self.count = ''
self.status = True
self.url = url
... | the_stack_v2_python_sparse | module/active/csp_info.py | j5s/getdomain | train | 0 |
4426add7b5f9689b4e400e9186adacc6f6ed3704 | [
"super(ESPCN, self).__init__()\nself.feature_map_layer = nn.Sequential(nn.Conv2d(in_channels=num_channels, kernel_size=(5, 5), out_channels=64, padding=(2, 2)), nn.Tanh(), nn.Conv2d(in_channels=64, kernel_size=(3, 3), out_channels=32, padding=(1, 1)), nn.Tanh())\nself.sub_pixel_layer = nn.Sequential(nn.Conv2d(in_ch... | <|body_start_0|>
super(ESPCN, self).__init__()
self.feature_map_layer = nn.Sequential(nn.Conv2d(in_channels=num_channels, kernel_size=(5, 5), out_channels=64, padding=(2, 2)), nn.Tanh(), nn.Conv2d(in_channels=64, kernel_size=(3, 3), out_channels=32, padding=(1, 1)), nn.Tanh())
self.sub_pixel_lay... | ESPCN | [
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ESPCN:
def __init__(self, num_channels, scaling_factor):
"""ESPCN Model class :param num_channels (int): Number of channels in input image :param scaling_factor (int): Factor to scale-up the input image by"""
<|body_0|>
def forward(self, x):
""":param x: input image ... | stack_v2_sparse_classes_75kplus_train_069092 | 4,204 | permissive | [
{
"docstring": "ESPCN Model class :param num_channels (int): Number of channels in input image :param scaling_factor (int): Factor to scale-up the input image by",
"name": "__init__",
"signature": "def __init__(self, num_channels, scaling_factor)"
},
{
"docstring": ":param x: input image :return... | 2 | stack_v2_sparse_classes_30k_train_053383 | Implement the Python class `ESPCN` described below.
Class description:
Implement the ESPCN class.
Method signatures and docstrings:
- def __init__(self, num_channels, scaling_factor): ESPCN Model class :param num_channels (int): Number of channels in input image :param scaling_factor (int): Factor to scale-up the inp... | Implement the Python class `ESPCN` described below.
Class description:
Implement the ESPCN class.
Method signatures and docstrings:
- def __init__(self, num_channels, scaling_factor): ESPCN Model class :param num_channels (int): Number of channels in input image :param scaling_factor (int): Factor to scale-up the inp... | 92acc188d3a0f634de58463b6676e70df83ef808 | <|skeleton|>
class ESPCN:
def __init__(self, num_channels, scaling_factor):
"""ESPCN Model class :param num_channels (int): Number of channels in input image :param scaling_factor (int): Factor to scale-up the input image by"""
<|body_0|>
def forward(self, x):
""":param x: input image ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ESPCN:
def __init__(self, num_channels, scaling_factor):
"""ESPCN Model class :param num_channels (int): Number of channels in input image :param scaling_factor (int): Factor to scale-up the input image by"""
super(ESPCN, self).__init__()
self.feature_map_layer = nn.Sequential(nn.Conv2... | the_stack_v2_python_sparse | PyTorch/dev/cv/image_classification/ESPCN_ID2919_for_PyTorch/model.py | Ascend/ModelZoo-PyTorch | train | 23 | |
2d1f1f1067da6e69c84ea8f6a9c9fb338d2247d9 | [
"self.setup = setup\nself.merge_fields = merge_fields\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\nsetup = idfy_rest_client.models.setup.Setup.from_dictionary(dictionary.get('setup')) if dictionary.get('setup') else None\nmerge_fields = dictionary.get('mergeField... | <|body_start_0|>
self.setup = setup
self.merge_fields = merge_fields
self.additional_properties = additional_properties
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
setup = idfy_rest_client.models.setup.Setup.from_dictionary(dictionary.get('setu... | Implementation of the 'Notifications' model. TODO: type model description here. Attributes: setup (Setup): Setup what kind of notifications this signer should get. Defaults to off merge_fields (dict<object, string>): If you create your own notifications texts (See the root object -> Notification), you can create you... | Notifications | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Notifications:
"""Implementation of the 'Notifications' model. TODO: type model description here. Attributes: setup (Setup): Setup what kind of notifications this signer should get. Defaults to off merge_fields (dict<object, string>): If you create your own notifications texts (See the root objec... | stack_v2_sparse_classes_75kplus_train_069093 | 2,680 | permissive | [
{
"docstring": "Constructor for the Notifications class",
"name": "__init__",
"signature": "def __init__(self, setup=None, merge_fields=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representati... | 2 | stack_v2_sparse_classes_30k_train_029605 | Implement the Python class `Notifications` described below.
Class description:
Implementation of the 'Notifications' model. TODO: type model description here. Attributes: setup (Setup): Setup what kind of notifications this signer should get. Defaults to off merge_fields (dict<object, string>): If you create your own ... | Implement the Python class `Notifications` described below.
Class description:
Implementation of the 'Notifications' model. TODO: type model description here. Attributes: setup (Setup): Setup what kind of notifications this signer should get. Defaults to off merge_fields (dict<object, string>): If you create your own ... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class Notifications:
"""Implementation of the 'Notifications' model. TODO: type model description here. Attributes: setup (Setup): Setup what kind of notifications this signer should get. Defaults to off merge_fields (dict<object, string>): If you create your own notifications texts (See the root objec... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Notifications:
"""Implementation of the 'Notifications' model. TODO: type model description here. Attributes: setup (Setup): Setup what kind of notifications this signer should get. Defaults to off merge_fields (dict<object, string>): If you create your own notifications texts (See the root object -> Notif... | the_stack_v2_python_sparse | idfy_rest_client/models/notifications.py | dealflowteam/Idfy | train | 0 |
68bb51913a1609e9a4d566b6749eec13162a4557 | [
"array = [0] * 26\na = ord('a')\nfor x in licensePlate:\n if x.isalpha():\n array[ord(x.lower()) - a] += 1\nmin = 4294967295\nmin_value = 0\nfor word in words:\n tmp = array[:]\n flag = True\n for c in word:\n index = ord(c.lower()) - a\n if tmp[index]:\n tmp[index] -= 1\... | <|body_start_0|>
array = [0] * 26
a = ord('a')
for x in licensePlate:
if x.isalpha():
array[ord(x.lower()) - a] += 1
min = 4294967295
min_value = 0
for word in words:
tmp = array[:]
flag = True
for c in word:... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def shortestCompletingWord(self, licensePlate, words):
""":type licensePlate: str :type words: List[str] :rtype: str"""
<|body_0|>
def shortestCompletingWord(self, licensePlate, words):
"""最优解 :type licensePlate: str :type words: List[str] :rtype: str"""
... | stack_v2_sparse_classes_75kplus_train_069094 | 1,394 | no_license | [
{
"docstring": ":type licensePlate: str :type words: List[str] :rtype: str",
"name": "shortestCompletingWord",
"signature": "def shortestCompletingWord(self, licensePlate, words)"
},
{
"docstring": "最优解 :type licensePlate: str :type words: List[str] :rtype: str",
"name": "shortestCompletingW... | 2 | stack_v2_sparse_classes_30k_test_000384 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def shortestCompletingWord(self, licensePlate, words): :type licensePlate: str :type words: List[str] :rtype: str
- def shortestCompletingWord(self, licensePlate, words): 最优解 :ty... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def shortestCompletingWord(self, licensePlate, words): :type licensePlate: str :type words: List[str] :rtype: str
- def shortestCompletingWord(self, licensePlate, words): 最优解 :ty... | b4fc2ba621f3484973c0520b02c60e5ed1930722 | <|skeleton|>
class Solution:
def shortestCompletingWord(self, licensePlate, words):
""":type licensePlate: str :type words: List[str] :rtype: str"""
<|body_0|>
def shortestCompletingWord(self, licensePlate, words):
"""最优解 :type licensePlate: str :type words: List[str] :rtype: str"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def shortestCompletingWord(self, licensePlate, words):
""":type licensePlate: str :type words: List[str] :rtype: str"""
array = [0] * 26
a = ord('a')
for x in licensePlate:
if x.isalpha():
array[ord(x.lower()) - a] += 1
min = 429496... | the_stack_v2_python_sparse | 748_ShortestCompletingWord_string.py | Black-Mamba24/leetcode-python | train | 0 | |
44ec309c1e17228eb8453d130f693069959a7208 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Proto file describing the Campaign Shared Set service. Service to manage campaign shared sets. | CampaignSharedSetServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CampaignSharedSetServiceServicer:
"""Proto file describing the Campaign Shared Set service. Service to manage campaign shared sets."""
def GetCampaignSharedSet(self, request, context):
"""Returns the requested campaign shared set in full detail."""
<|body_0|>
def MutateC... | stack_v2_sparse_classes_75kplus_train_069095 | 5,856 | permissive | [
{
"docstring": "Returns the requested campaign shared set in full detail.",
"name": "GetCampaignSharedSet",
"signature": "def GetCampaignSharedSet(self, request, context)"
},
{
"docstring": "Creates or removes campaign shared sets. Operation statuses are returned.",
"name": "MutateCampaignSh... | 2 | stack_v2_sparse_classes_30k_train_040895 | Implement the Python class `CampaignSharedSetServiceServicer` described below.
Class description:
Proto file describing the Campaign Shared Set service. Service to manage campaign shared sets.
Method signatures and docstrings:
- def GetCampaignSharedSet(self, request, context): Returns the requested campaign shared s... | Implement the Python class `CampaignSharedSetServiceServicer` described below.
Class description:
Proto file describing the Campaign Shared Set service. Service to manage campaign shared sets.
Method signatures and docstrings:
- def GetCampaignSharedSet(self, request, context): Returns the requested campaign shared s... | 969eff5b6c3cec59d21191fa178cffb6270074c3 | <|skeleton|>
class CampaignSharedSetServiceServicer:
"""Proto file describing the Campaign Shared Set service. Service to manage campaign shared sets."""
def GetCampaignSharedSet(self, request, context):
"""Returns the requested campaign shared set in full detail."""
<|body_0|>
def MutateC... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CampaignSharedSetServiceServicer:
"""Proto file describing the Campaign Shared Set service. Service to manage campaign shared sets."""
def GetCampaignSharedSet(self, request, context):
"""Returns the requested campaign shared set in full detail."""
context.set_code(grpc.StatusCode.UNIMPLE... | the_stack_v2_python_sparse | google/ads/google_ads/v6/proto/services/campaign_shared_set_service_pb2_grpc.py | VincentFritzsche/google-ads-python | train | 0 |
fc63e69a02c228ba2121691b51d8be44b8102992 | [
"self._title = Text('Scrabble!', (330, 65), 58)\nself._keyText = Text('Key!', (630, 60), 18)\nself._keyBox = Rectangle(120, 130, (630, 100))\nself._keyBox.setFillColor('pink')\nself._key1 = Rectangle(10, 10, (580, 70))\nself._key1.setFillColor('green')\nself._text1 = Text(' Start Tile', (630, 75), 10)\nself._key2 =... | <|body_start_0|>
self._title = Text('Scrabble!', (330, 65), 58)
self._keyText = Text('Key!', (630, 60), 18)
self._keyBox = Rectangle(120, 130, (630, 100))
self._keyBox.setFillColor('pink')
self._key1 = Rectangle(10, 10, (580, 70))
self._key1.setFillColor('green')
... | A class primarily for the graphical objects that make up the "Key" for the game | Key | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Key:
"""A class primarily for the graphical objects that make up the "Key" for the game"""
def __init__(self):
"""Creates the following attributes that are all graphical objects for the game's Key"""
<|body_0|>
def addTo(self, win):
"""Adds each graphical object ... | stack_v2_sparse_classes_75kplus_train_069096 | 23,085 | no_license | [
{
"docstring": "Creates the following attributes that are all graphical objects for the game's Key",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Adds each graphical object to the window by looping through a list of the objects",
"name": "addTo",
"signature": ... | 2 | stack_v2_sparse_classes_30k_test_002086 | Implement the Python class `Key` described below.
Class description:
A class primarily for the graphical objects that make up the "Key" for the game
Method signatures and docstrings:
- def __init__(self): Creates the following attributes that are all graphical objects for the game's Key
- def addTo(self, win): Adds e... | Implement the Python class `Key` described below.
Class description:
A class primarily for the graphical objects that make up the "Key" for the game
Method signatures and docstrings:
- def __init__(self): Creates the following attributes that are all graphical objects for the game's Key
- def addTo(self, win): Adds e... | e5d96a65fc84481b85072cfb55dea9a0666634b5 | <|skeleton|>
class Key:
"""A class primarily for the graphical objects that make up the "Key" for the game"""
def __init__(self):
"""Creates the following attributes that are all graphical objects for the game's Key"""
<|body_0|>
def addTo(self, win):
"""Adds each graphical object ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Key:
"""A class primarily for the graphical objects that make up the "Key" for the game"""
def __init__(self):
"""Creates the following attributes that are all graphical objects for the game's Key"""
self._title = Text('Scrabble!', (330, 65), 58)
self._keyText = Text('Key!', (630,... | the_stack_v2_python_sparse | Games-2017/21/Game.py | paulmagnus/CSPy | train | 0 |
4814742139003f0bdc3ecb2c7be564754abf6ffe | [
"self._type = type\nself._project = project\nself._location = location\nself._creds, _ = google.auth.default()\nself._gcp_resources = gcp_resources\nself._session = self._get_session()",
"retry = Retry(total=_CONNECTION_ERROR_RETRY_LIMIT, status_forcelist=[429, 503], backoff_factor=_CONNECTION_RETRY_BACKOFF_FACTO... | <|body_start_0|>
self._type = type
self._project = project
self._location = location
self._creds, _ = google.auth.default()
self._gcp_resources = gcp_resources
self._session = self._get_session()
<|end_body_0|>
<|body_start_1|>
retry = Retry(total=_CONNECTION_ERR... | Common module for creating Dataproc Flex Template jobs. | DataflowFlexTemplateRemoteRunner | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataflowFlexTemplateRemoteRunner:
"""Common module for creating Dataproc Flex Template jobs."""
def __init__(self, type: str, project: str, location: str, gcp_resources: str):
"""Initializes a DataflowFlexTemplateRemoteRunner object."""
<|body_0|>
def _get_session(self) ... | stack_v2_sparse_classes_75kplus_train_069097 | 9,632 | permissive | [
{
"docstring": "Initializes a DataflowFlexTemplateRemoteRunner object.",
"name": "__init__",
"signature": "def __init__(self, type: str, project: str, location: str, gcp_resources: str)"
},
{
"docstring": "Gets a http session.",
"name": "_get_session",
"signature": "def _get_session(self... | 5 | stack_v2_sparse_classes_30k_train_037173 | Implement the Python class `DataflowFlexTemplateRemoteRunner` described below.
Class description:
Common module for creating Dataproc Flex Template jobs.
Method signatures and docstrings:
- def __init__(self, type: str, project: str, location: str, gcp_resources: str): Initializes a DataflowFlexTemplateRemoteRunner o... | Implement the Python class `DataflowFlexTemplateRemoteRunner` described below.
Class description:
Common module for creating Dataproc Flex Template jobs.
Method signatures and docstrings:
- def __init__(self, type: str, project: str, location: str, gcp_resources: str): Initializes a DataflowFlexTemplateRemoteRunner o... | 3fb199658f68e7debf4906d9ce32a9a307e39243 | <|skeleton|>
class DataflowFlexTemplateRemoteRunner:
"""Common module for creating Dataproc Flex Template jobs."""
def __init__(self, type: str, project: str, location: str, gcp_resources: str):
"""Initializes a DataflowFlexTemplateRemoteRunner object."""
<|body_0|>
def _get_session(self) ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DataflowFlexTemplateRemoteRunner:
"""Common module for creating Dataproc Flex Template jobs."""
def __init__(self, type: str, project: str, location: str, gcp_resources: str):
"""Initializes a DataflowFlexTemplateRemoteRunner object."""
self._type = type
self._project = project
... | the_stack_v2_python_sparse | components/google-cloud/google_cloud_pipeline_components/container/preview/dataflow/flex_template/remote_runner.py | kubeflow/pipelines | train | 3,434 |
458090b2507a2a0c3971b26d26739aa775269574 | [
"favs = get_favs(request)\nfavs = favs.filter(itinerary__pk=itinerary_pk)\nif favs.exists():\n for fav in favs.all():\n fav.date_deleted = datetime.today()\n fav.save()\nreturn Response({'status': 'ok', 'count': get_favs_count(request), 'count_it': get_it_count_favs(request)})",
"for fav_id in se... | <|body_start_0|>
favs = get_favs(request)
favs = favs.filter(itinerary__pk=itinerary_pk)
if favs.exists():
for fav in favs.all():
fav.date_deleted = datetime.today()
fav.save()
return Response({'status': 'ok', 'count': get_favs_count(request), ... | DeleteItineraryFavAPIView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeleteItineraryFavAPIView:
def get(self, request, itinerary_pk):
"""Delete a Fav set date_deleted = now TODO"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Delete several Favs at a time set date_deleted = now"""
<|body_1|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_75kplus_train_069098 | 15,319 | no_license | [
{
"docstring": "Delete a Fav set date_deleted = now TODO",
"name": "get",
"signature": "def get(self, request, itinerary_pk)"
},
{
"docstring": "Delete several Favs at a time set date_deleted = now",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_050434 | Implement the Python class `DeleteItineraryFavAPIView` described below.
Class description:
Implement the DeleteItineraryFavAPIView class.
Method signatures and docstrings:
- def get(self, request, itinerary_pk): Delete a Fav set date_deleted = now TODO
- def post(self, request, *args, **kwargs): Delete several Favs a... | Implement the Python class `DeleteItineraryFavAPIView` described below.
Class description:
Implement the DeleteItineraryFavAPIView class.
Method signatures and docstrings:
- def get(self, request, itinerary_pk): Delete a Fav set date_deleted = now TODO
- def post(self, request, *args, **kwargs): Delete several Favs a... | 8a15fc387d20b12d16c171c2d8928a9b9d4ba5e1 | <|skeleton|>
class DeleteItineraryFavAPIView:
def get(self, request, itinerary_pk):
"""Delete a Fav set date_deleted = now TODO"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Delete several Favs at a time set date_deleted = now"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DeleteItineraryFavAPIView:
def get(self, request, itinerary_pk):
"""Delete a Fav set date_deleted = now TODO"""
favs = get_favs(request)
favs = favs.filter(itinerary__pk=itinerary_pk)
if favs.exists():
for fav in favs.all():
fav.date_deleted = dateti... | the_stack_v2_python_sparse | users/views.py | montenegrop/djangotravelportal | train | 0 | |
611ac0dfff4c7dde92dea370c1bfbd75b837467b | [
"super(ExchangeRate, self).__init__(parent)\nself.setupUi(self)\nself.InitUi()",
"self.splitter.setStretchFactor(0, 4)\nself.splitter.setStretchFactor(1, 6)\npg.setConfigOption('background', '#f0f0f0')\nself.drawChart = DrawChart()\nself.exrwidget = self.drawChart.pyqtgraphDrawChart()\nself.verticalLayout.addWidg... | <|body_start_0|>
super(ExchangeRate, self).__init__(parent)
self.setupUi(self)
self.InitUi()
<|end_body_0|>
<|body_start_1|>
self.splitter.setStretchFactor(0, 4)
self.splitter.setStretchFactor(1, 6)
pg.setConfigOption('background', '#f0f0f0')
self.drawChart = Dra... | 外汇汇率展示 | ExchangeRate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExchangeRate:
"""外汇汇率展示"""
def __init__(self, parent=None):
"""一些初始设置"""
<|body_0|>
def InitUi(self):
"""一些界面设置"""
<|body_1|>
def mouseMoved(self, pos):
"""处理鼠标事件"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
super(Exchang... | stack_v2_sparse_classes_75kplus_train_069099 | 7,389 | no_license | [
{
"docstring": "一些初始设置",
"name": "__init__",
"signature": "def __init__(self, parent=None)"
},
{
"docstring": "一些界面设置",
"name": "InitUi",
"signature": "def InitUi(self)"
},
{
"docstring": "处理鼠标事件",
"name": "mouseMoved",
"signature": "def mouseMoved(self, pos)"
}
] | 3 | stack_v2_sparse_classes_30k_train_015167 | Implement the Python class `ExchangeRate` described below.
Class description:
外汇汇率展示
Method signatures and docstrings:
- def __init__(self, parent=None): 一些初始设置
- def InitUi(self): 一些界面设置
- def mouseMoved(self, pos): 处理鼠标事件 | Implement the Python class `ExchangeRate` described below.
Class description:
外汇汇率展示
Method signatures and docstrings:
- def __init__(self, parent=None): 一些初始设置
- def InitUi(self): 一些界面设置
- def mouseMoved(self, pos): 处理鼠标事件
<|skeleton|>
class ExchangeRate:
"""外汇汇率展示"""
def __init__(self, parent=None):
... | 4d4c44365d5d0bf3d9fd94922a13d0b50f17a95c | <|skeleton|>
class ExchangeRate:
"""外汇汇率展示"""
def __init__(self, parent=None):
"""一些初始设置"""
<|body_0|>
def InitUi(self):
"""一些界面设置"""
<|body_1|>
def mouseMoved(self, pos):
"""处理鼠标事件"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExchangeRate:
"""外汇汇率展示"""
def __init__(self, parent=None):
"""一些初始设置"""
super(ExchangeRate, self).__init__(parent)
self.setupUi(self)
self.InitUi()
def InitUi(self):
"""一些界面设置"""
self.splitter.setStretchFactor(0, 4)
self.splitter.setStretchFac... | the_stack_v2_python_sparse | PyQt5All/PyQt588、89、90/exchangerate.py | redmorningcn/PyQT5Example | train | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.