blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
172123e56ba54fc8c4d0a801c18b0cff571083c1 | [
"provider_url = self.provider_url\nif provider_url is None:\n return None\nreturn provider_url.replace('$1', metaidentifier)",
"node = bioregistry_metaresource.term(self.prefix)\ngraph.add((node, RDF['type'], bioregistry_schema[self.__class__.__name__]))\ngraph.add((node, RDFS['label'], Literal(self.name)))\ng... | <|body_start_0|>
provider_url = self.provider_url
if provider_url is None:
return None
return provider_url.replace('$1', metaidentifier)
<|end_body_0|>
<|body_start_1|>
node = bioregistry_metaresource.term(self.prefix)
graph.add((node, RDF['type'], bioregistry_schema... | Metadata about a registry. | Registry | [
"MIT",
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Registry:
"""Metadata about a registry."""
def get_provider(self, metaidentifier: str) -> Optional[str]:
"""Get the provider string."""
<|body_0|>
def add_triples(self, graph: rdflib.Graph) -> Node:
"""Add triples to an RDF graph for this registry."""
<|b... | stack_v2_sparse_classes_36k_train_024200 | 10,018 | permissive | [
{
"docstring": "Get the provider string.",
"name": "get_provider",
"signature": "def get_provider(self, metaidentifier: str) -> Optional[str]"
},
{
"docstring": "Add triples to an RDF graph for this registry.",
"name": "add_triples",
"signature": "def add_triples(self, graph: rdflib.Grap... | 2 | stack_v2_sparse_classes_30k_train_019440 | Implement the Python class `Registry` described below.
Class description:
Metadata about a registry.
Method signatures and docstrings:
- def get_provider(self, metaidentifier: str) -> Optional[str]: Get the provider string.
- def add_triples(self, graph: rdflib.Graph) -> Node: Add triples to an RDF graph for this reg... | Implement the Python class `Registry` described below.
Class description:
Metadata about a registry.
Method signatures and docstrings:
- def get_provider(self, metaidentifier: str) -> Optional[str]: Get the provider string.
- def add_triples(self, graph: rdflib.Graph) -> Node: Add triples to an RDF graph for this reg... | ff20ca569958eec19ed23bc67c0485663e67ebd9 | <|skeleton|>
class Registry:
"""Metadata about a registry."""
def get_provider(self, metaidentifier: str) -> Optional[str]:
"""Get the provider string."""
<|body_0|>
def add_triples(self, graph: rdflib.Graph) -> Node:
"""Add triples to an RDF graph for this registry."""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Registry:
"""Metadata about a registry."""
def get_provider(self, metaidentifier: str) -> Optional[str]:
"""Get the provider string."""
provider_url = self.provider_url
if provider_url is None:
return None
return provider_url.replace('$1', metaidentifier)
... | the_stack_v2_python_sparse | src/bioregistry/schema/struct.py | polyneme/bioregistry | train | 0 |
9be4760076178743ad2adb72cc7f77d524475289 | [
"ip = readConfig.ip\ni_port = readConfig.i_port\nurl = 'http://' + ip + ':' + i_port + '/backend/capacity/maintain/siteInfo'\nheader = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0', 'X-Requested-With': 'XMLHttpRequest', 'Connection': 'keep-alive'}\npar = {'userCode': use... | <|body_start_0|>
ip = readConfig.ip
i_port = readConfig.i_port
url = 'http://' + ip + ':' + i_port + '/backend/capacity/maintain/siteInfo'
header = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0', 'X-Requested-With': 'XMLHttpRequest', 'Connectio... | 站长站点信息接口 | Maintain_siteinfo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Maintain_siteinfo:
"""站长站点信息接口"""
def siteinfo(self, userCode):
"""一个参数: 登录用户code(工号):userCode"""
<|body_0|>
def test_siteinfo1(self):
"""测试站长站点信息接口:请求参数正确"""
<|body_1|>
def test_siteinfo2(self):
"""测试站长站点信息接口:登录用户code(工号)不存在"""
<|bod... | stack_v2_sparse_classes_36k_train_024201 | 2,994 | no_license | [
{
"docstring": "一个参数: 登录用户code(工号):userCode",
"name": "siteinfo",
"signature": "def siteinfo(self, userCode)"
},
{
"docstring": "测试站长站点信息接口:请求参数正确",
"name": "test_siteinfo1",
"signature": "def test_siteinfo1(self)"
},
{
"docstring": "测试站长站点信息接口:登录用户code(工号)不存在",
"name": "test... | 4 | stack_v2_sparse_classes_30k_train_020607 | Implement the Python class `Maintain_siteinfo` described below.
Class description:
站长站点信息接口
Method signatures and docstrings:
- def siteinfo(self, userCode): 一个参数: 登录用户code(工号):userCode
- def test_siteinfo1(self): 测试站长站点信息接口:请求参数正确
- def test_siteinfo2(self): 测试站长站点信息接口:登录用户code(工号)不存在
- def test_siteinfo3(self): 测试站... | Implement the Python class `Maintain_siteinfo` described below.
Class description:
站长站点信息接口
Method signatures and docstrings:
- def siteinfo(self, userCode): 一个参数: 登录用户code(工号):userCode
- def test_siteinfo1(self): 测试站长站点信息接口:请求参数正确
- def test_siteinfo2(self): 测试站长站点信息接口:登录用户code(工号)不存在
- def test_siteinfo3(self): 测试站... | f581f7e3f558fa8aa69b92f99ee32c2c77afc770 | <|skeleton|>
class Maintain_siteinfo:
"""站长站点信息接口"""
def siteinfo(self, userCode):
"""一个参数: 登录用户code(工号):userCode"""
<|body_0|>
def test_siteinfo1(self):
"""测试站长站点信息接口:请求参数正确"""
<|body_1|>
def test_siteinfo2(self):
"""测试站长站点信息接口:登录用户code(工号)不存在"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Maintain_siteinfo:
"""站长站点信息接口"""
def siteinfo(self, userCode):
"""一个参数: 登录用户code(工号):userCode"""
ip = readConfig.ip
i_port = readConfig.i_port
url = 'http://' + ip + ':' + i_port + '/backend/capacity/maintain/siteInfo'
header = {'User-Agent': 'Mozilla/5.0 (Windows... | the_stack_v2_python_sparse | case/test_maintain_siteInfo.py | jasnPackage/zhandian_jiekou | train | 0 |
965bcf457c6d6c424f9bd74f8b96fc491108547e | [
"tagname = g.json.pop('tag', None)\nif tagname:\n if not isinstance(tagname, STRING_TYPES):\n return (jsonify(error='tag must be of type string'), BAD_REQUEST)\npathmap = PathMap(**g.json)\nif tagname:\n tag = Tag.query.filter_by(tag=tagname).first()\n if not tag:\n tag = Tag(tag=tagname)\n ... | <|body_start_0|>
tagname = g.json.pop('tag', None)
if tagname:
if not isinstance(tagname, STRING_TYPES):
return (jsonify(error='tag must be of type string'), BAD_REQUEST)
pathmap = PathMap(**g.json)
if tagname:
tag = Tag.query.filter_by(tag=tagname... | PathMapIndexAPI | [
"BSD-3-Clause",
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PathMapIndexAPI:
def post(self):
"""A ``POST`` to this endpoint will create a new path map. A path map will list the equivalent path prefixes for all three supported families of operating systems, Linux, Windows and OS X. A path map can optionally be restricted to one tag, in which case ... | stack_v2_sparse_classes_36k_train_024202 | 11,366 | permissive | [
{
"docstring": "A ``POST`` to this endpoint will create a new path map. A path map will list the equivalent path prefixes for all three supported families of operating systems, Linux, Windows and OS X. A path map can optionally be restricted to one tag, in which case it will only apply to agents with that tag. ... | 2 | stack_v2_sparse_classes_30k_train_000378 | Implement the Python class `PathMapIndexAPI` described below.
Class description:
Implement the PathMapIndexAPI class.
Method signatures and docstrings:
- def post(self): A ``POST`` to this endpoint will create a new path map. A path map will list the equivalent path prefixes for all three supported families of operat... | Implement the Python class `PathMapIndexAPI` described below.
Class description:
Implement the PathMapIndexAPI class.
Method signatures and docstrings:
- def post(self): A ``POST`` to this endpoint will create a new path map. A path map will list the equivalent path prefixes for all three supported families of operat... | ea04bbcb807eb669415c569417b4b1b68e75d29d | <|skeleton|>
class PathMapIndexAPI:
def post(self):
"""A ``POST`` to this endpoint will create a new path map. A path map will list the equivalent path prefixes for all three supported families of operating systems, Linux, Windows and OS X. A path map can optionally be restricted to one tag, in which case ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PathMapIndexAPI:
def post(self):
"""A ``POST`` to this endpoint will create a new path map. A path map will list the equivalent path prefixes for all three supported families of operating systems, Linux, Windows and OS X. A path map can optionally be restricted to one tag, in which case it will only a... | the_stack_v2_python_sparse | pyfarm/master/api/pathmaps.py | pyfarm/pyfarm-master | train | 2 | |
86900507eb1c7bbb75bb1acb8836d304c1f4e76e | [
"if self.key not in data:\n _logger.debug(f'Could not find {self.key} key.')\n data[self.key] = self.get_hash(circuit)\n return True\nnew_hash = self.get_hash(circuit)\nif data[self.key] == new_hash:\n _logger.debug('Hashes match; no change detected.')\n return False\ndata[self.key] = new_hash\n_logg... | <|body_start_0|>
if self.key not in data:
_logger.debug(f'Could not find {self.key} key.')
data[self.key] = self.get_hash(circuit)
return True
new_hash = self.get_hash(circuit)
if data[self.key] == new_hash:
_logger.debug('Hashes match; no change d... | The ChangePredicate class. The ChangePredicate returns true if the circuit has changed since the last call. On the first call, the predicate returns true. | ChangePredicate | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChangePredicate:
"""The ChangePredicate class. The ChangePredicate returns true if the circuit has changed since the last call. On the first call, the predicate returns true."""
def get_truth_value(self, circuit: Circuit, data: PassData) -> bool:
"""Call this predicate, see :class:`P... | stack_v2_sparse_classes_36k_train_024203 | 1,984 | permissive | [
{
"docstring": "Call this predicate, see :class:`PassPredicate` for more info.",
"name": "get_truth_value",
"signature": "def get_truth_value(self, circuit: Circuit, data: PassData) -> bool"
},
{
"docstring": "Retreive hash associated with `circuit`.",
"name": "get_hash",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_train_014333 | Implement the Python class `ChangePredicate` described below.
Class description:
The ChangePredicate class. The ChangePredicate returns true if the circuit has changed since the last call. On the first call, the predicate returns true.
Method signatures and docstrings:
- def get_truth_value(self, circuit: Circuit, da... | Implement the Python class `ChangePredicate` described below.
Class description:
The ChangePredicate class. The ChangePredicate returns true if the circuit has changed since the last call. On the first call, the predicate returns true.
Method signatures and docstrings:
- def get_truth_value(self, circuit: Circuit, da... | c89112d15072e8ffffb68cf1757b184e2aeb3dc8 | <|skeleton|>
class ChangePredicate:
"""The ChangePredicate class. The ChangePredicate returns true if the circuit has changed since the last call. On the first call, the predicate returns true."""
def get_truth_value(self, circuit: Circuit, data: PassData) -> bool:
"""Call this predicate, see :class:`P... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChangePredicate:
"""The ChangePredicate class. The ChangePredicate returns true if the circuit has changed since the last call. On the first call, the predicate returns true."""
def get_truth_value(self, circuit: Circuit, data: PassData) -> bool:
"""Call this predicate, see :class:`PassPredicate`... | the_stack_v2_python_sparse | bqskit/passes/control/predicates/change.py | BQSKit/bqskit | train | 54 |
b5d840f7b9d100a1486b507b8d33b1ff385a10f5 | [
"self._attribute = attribute\nself.item = item\nself.next = next\nself.precede = precede",
"if self.item != None:\n output = str(self.item.__dict__[_attribute])\nelse:\n return 'Empty node'\nif self.next != None:\n output += ', ' + str(self.next)\nreturn output"
] | <|body_start_0|>
self._attribute = attribute
self.item = item
self.next = next
self.precede = precede
<|end_body_0|>
<|body_start_1|>
if self.item != None:
output = str(self.item.__dict__[_attribute])
else:
return 'Empty node'
if self.next... | Class Node used in the linked chain. | Node | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Node:
"""Class Node used in the linked chain."""
def __init__(self, attribute, item=None, next=None, precede=None):
"""Standard python initializer, works with an attribute. This is the searchkey of the object."""
<|body_0|>
def __str__(self):
"""Basic visual repr... | stack_v2_sparse_classes_36k_train_024204 | 5,458 | no_license | [
{
"docstring": "Standard python initializer, works with an attribute. This is the searchkey of the object.",
"name": "__init__",
"signature": "def __init__(self, attribute, item=None, next=None, precede=None)"
},
{
"docstring": "Basic visual representation of a node.",
"name": "__str__",
... | 2 | stack_v2_sparse_classes_30k_train_000840 | Implement the Python class `Node` described below.
Class description:
Class Node used in the linked chain.
Method signatures and docstrings:
- def __init__(self, attribute, item=None, next=None, precede=None): Standard python initializer, works with an attribute. This is the searchkey of the object.
- def __str__(sel... | Implement the Python class `Node` described below.
Class description:
Class Node used in the linked chain.
Method signatures and docstrings:
- def __init__(self, attribute, item=None, next=None, precede=None): Standard python initializer, works with an attribute. This is the searchkey of the object.
- def __str__(sel... | 51790aaa91c4229379c883cfefe4ffe597d5e2ac | <|skeleton|>
class Node:
"""Class Node used in the linked chain."""
def __init__(self, attribute, item=None, next=None, precede=None):
"""Standard python initializer, works with an attribute. This is the searchkey of the object."""
<|body_0|>
def __str__(self):
"""Basic visual repr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Node:
"""Class Node used in the linked chain."""
def __init__(self, attribute, item=None, next=None, precede=None):
"""Standard python initializer, works with an attribute. This is the searchkey of the object."""
self._attribute = attribute
self.item = item
self.next = nex... | the_stack_v2_python_sparse | v2/kinepolis/structures/slinkedchain.py | evertheylen/kinepolis | train | 0 |
d4debfa56e0886cd9149ac9660403776113a9204 | [
"try:\n lookups = await self.nyuki.storage.lookups.get()\nexcept AutoReconnect:\n return Response(status=503)\nreturn Response(lookups)",
"data = await request.post()\nif 'csv' not in data or not isinstance(data['csv'], FileField):\n return Response(status=400, body={'error': \"'csv' field must be a CSV ... | <|body_start_0|>
try:
lookups = await self.nyuki.storage.lookups.get()
except AutoReconnect:
return Response(status=503)
return Response(lookups)
<|end_body_0|>
<|body_start_1|>
data = await request.post()
if 'csv' not in data or not isinstance(data['csv'... | ApiFactoryLookups | [
"MIT",
"GPL-1.0-or-later",
"LicenseRef-scancode-other-copyleft",
"GPL-2.0-or-later",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later",
"GPL-2.0-only",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-generic-exception",
"Apache-2.0",
"LicenseRef-scancode-warran... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiFactoryLookups:
async def get(self, request):
"""Return the list of all lookups"""
<|body_0|>
async def post(self, request):
"""Get a CSV file and parse it into a new lookup table."""
<|body_1|>
async def put(self, request):
"""Insert a new lo... | stack_v2_sparse_classes_36k_train_024205 | 10,772 | permissive | [
{
"docstring": "Return the list of all lookups",
"name": "get",
"signature": "async def get(self, request)"
},
{
"docstring": "Get a CSV file and parse it into a new lookup table.",
"name": "post",
"signature": "async def post(self, request)"
},
{
"docstring": "Insert a new looku... | 4 | null | Implement the Python class `ApiFactoryLookups` described below.
Class description:
Implement the ApiFactoryLookups class.
Method signatures and docstrings:
- async def get(self, request): Return the list of all lookups
- async def post(self, request): Get a CSV file and parse it into a new lookup table.
- async def p... | Implement the Python class `ApiFactoryLookups` described below.
Class description:
Implement the ApiFactoryLookups class.
Method signatures and docstrings:
- async def get(self, request): Return the list of all lookups
- async def post(self, request): Get a CSV file and parse it into a new lookup table.
- async def p... | f185fababee380660930243515652093855acfe7 | <|skeleton|>
class ApiFactoryLookups:
async def get(self, request):
"""Return the list of all lookups"""
<|body_0|>
async def post(self, request):
"""Get a CSV file and parse it into a new lookup table."""
<|body_1|>
async def put(self, request):
"""Insert a new lo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ApiFactoryLookups:
async def get(self, request):
"""Return the list of all lookups"""
try:
lookups = await self.nyuki.storage.lookups.get()
except AutoReconnect:
return Response(status=503)
return Response(lookups)
async def post(self, request):
... | the_stack_v2_python_sparse | nyuki/workflow/api/factory.py | d-nery/nyuki | train | 0 | |
d994fc32514f8166a35f40972a7fc640054a3b88 | [
"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... | Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the [Grafeas](https://grafeas.io) API. Analysis results are stored as a series of occurrences. An `Occurrence` contains information about a specific analysis instance on a resource. An occu... | ContainerAnalysisServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContainerAnalysisServicer:
"""Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the [Grafeas](https://grafeas.io) API. Analysis results are stored as a series of occurrences. An `Occurrence` contains information abou... | stack_v2_sparse_classes_36k_train_024206 | 6,187 | permissive | [
{
"docstring": "Sets the access control policy on the specified note or occurrence. Requires `containeranalysis.notes.setIamPolicy` or `containeranalysis.occurrences.setIamPolicy` permission if the resource is a note or an occurrence, respectively. The resource takes the format `projects/[PROJECT_ID]/notes/[NOT... | 3 | null | Implement the Python class `ContainerAnalysisServicer` described below.
Class description:
Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the [Grafeas](https://grafeas.io) API. Analysis results are stored as a series of occurrences. An... | Implement the Python class `ContainerAnalysisServicer` described below.
Class description:
Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the [Grafeas](https://grafeas.io) API. Analysis results are stored as a series of occurrences. An... | d897d56bce03d1fda98b79afb08264e51d46c421 | <|skeleton|>
class ContainerAnalysisServicer:
"""Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the [Grafeas](https://grafeas.io) API. Analysis results are stored as a series of occurrences. An `Occurrence` contains information abou... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ContainerAnalysisServicer:
"""Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the [Grafeas](https://grafeas.io) API. Analysis results are stored as a series of occurrences. An `Occurrence` contains information about a specific ... | the_stack_v2_python_sparse | containeranalysis/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2_grpc.py | tswast/google-cloud-python | train | 1 |
7102898c76ab92c702557deb0f20aa42967d2770 | [
"with mute_signals(post_save):\n profile = ProfileFactory()\nassert profile.student_id is not None\nassert profile.student_id == profile.id",
"with mute_signals(post_save):\n profile_one = ProfileFactory()\n profile_two = ProfileFactory()\nassert profile_two.student_id > profile_one.student_id",
"with ... | <|body_start_0|>
with mute_signals(post_save):
profile = ProfileFactory()
assert profile.student_id is not None
assert profile.student_id == profile.id
<|end_body_0|>
<|body_start_1|>
with mute_signals(post_save):
profile_one = ProfileFactory()
profil... | tests that student_id is updated properly | StudentIdTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StudentIdTests:
"""tests that student_id is updated properly"""
def test_on_save(self):
"""test that a student id is set on save"""
<|body_0|>
def test_increments(self):
"""test that a student id increments correctly"""
<|body_1|>
def test_doesnt_cha... | stack_v2_sparse_classes_36k_train_024207 | 10,083 | permissive | [
{
"docstring": "test that a student id is set on save",
"name": "test_on_save",
"signature": "def test_on_save(self)"
},
{
"docstring": "test that a student id increments correctly",
"name": "test_increments",
"signature": "def test_increments(self)"
},
{
"docstring": "test that ... | 5 | null | Implement the Python class `StudentIdTests` described below.
Class description:
tests that student_id is updated properly
Method signatures and docstrings:
- def test_on_save(self): test that a student id is set on save
- def test_increments(self): test that a student id increments correctly
- def test_doesnt_change_... | Implement the Python class `StudentIdTests` described below.
Class description:
tests that student_id is updated properly
Method signatures and docstrings:
- def test_on_save(self): test that a student id is set on save
- def test_increments(self): test that a student id increments correctly
- def test_doesnt_change_... | d6564caca0b7bbfd31e67a751564107fd17d6eb0 | <|skeleton|>
class StudentIdTests:
"""tests that student_id is updated properly"""
def test_on_save(self):
"""test that a student id is set on save"""
<|body_0|>
def test_increments(self):
"""test that a student id increments correctly"""
<|body_1|>
def test_doesnt_cha... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StudentIdTests:
"""tests that student_id is updated properly"""
def test_on_save(self):
"""test that a student id is set on save"""
with mute_signals(post_save):
profile = ProfileFactory()
assert profile.student_id is not None
assert profile.student_id == profi... | the_stack_v2_python_sparse | profiles/models_test.py | mitodl/micromasters | train | 35 |
aed6e064a4327ef1ee1d80fb195d8fc99b9780d8 | [
"self.current_ind = 0\nself.images = images\nself.xlabels = xlabels",
"plt.gcf()\nif event.key == 'right' and self.current_ind < len(self.images):\n self.current_ind += 1\nelif event.key == 'left' and self.current_ind > 0:\n self.current_ind -= 1\nplt.clf()\nevent.canvas.figure.gca().imshow(self.images[self... | <|body_start_0|>
self.current_ind = 0
self.images = images
self.xlabels = xlabels
<|end_body_0|>
<|body_start_1|>
plt.gcf()
if event.key == 'right' and self.current_ind < len(self.images):
self.current_ind += 1
elif event.key == 'left' and self.current_ind > ... | ImageCycler | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageCycler:
def __init__(self, images, xlabels=None):
"""Convenience object to cycle through a list of images inside a jupyter notebook. Parameters ---------- images : list List of numpy arrays to display as images xlabels : list, optional List of custom labels for the images"""
... | stack_v2_sparse_classes_36k_train_024208 | 14,615 | permissive | [
{
"docstring": "Convenience object to cycle through a list of images inside a jupyter notebook. Parameters ---------- images : list List of numpy arrays to display as images xlabels : list, optional List of custom labels for the images",
"name": "__init__",
"signature": "def __init__(self, images, xlabe... | 3 | stack_v2_sparse_classes_30k_train_010564 | Implement the Python class `ImageCycler` described below.
Class description:
Implement the ImageCycler class.
Method signatures and docstrings:
- def __init__(self, images, xlabels=None): Convenience object to cycle through a list of images inside a jupyter notebook. Parameters ---------- images : list List of numpy ... | Implement the Python class `ImageCycler` described below.
Class description:
Implement the ImageCycler class.
Method signatures and docstrings:
- def __init__(self, images, xlabels=None): Convenience object to cycle through a list of images inside a jupyter notebook. Parameters ---------- images : list List of numpy ... | 041391f4ef0667e555046fc66f5beb67b4975dda | <|skeleton|>
class ImageCycler:
def __init__(self, images, xlabels=None):
"""Convenience object to cycle through a list of images inside a jupyter notebook. Parameters ---------- images : list List of numpy arrays to display as images xlabels : list, optional List of custom labels for the images"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImageCycler:
def __init__(self, images, xlabels=None):
"""Convenience object to cycle through a list of images inside a jupyter notebook. Parameters ---------- images : list List of numpy arrays to display as images xlabels : list, optional List of custom labels for the images"""
self.current_... | the_stack_v2_python_sparse | astronomaly/utils/utils.py | MichelleLochner/astronomaly | train | 69 | |
e6c97b98de218a4a1496b80d657ae048f70cd08a | [
"super().__init__()\nself.device = device\nself.tok_embedding = nn.Embedding(num_embeddings=input_dim, embedding_dim=hid_dim)\nself.pos_embedding = nn.Embedding(num_embeddings=max_length, embedding_dim=hid_dim)\nself.layers = nn.ModuleList([GatedEncoderLayer(hid_dim, n_heads, pf_dim, dropout, device) for _ in range... | <|body_start_0|>
super().__init__()
self.device = device
self.tok_embedding = nn.Embedding(num_embeddings=input_dim, embedding_dim=hid_dim)
self.pos_embedding = nn.Embedding(num_embeddings=max_length, embedding_dim=hid_dim)
self.layers = nn.ModuleList([GatedEncoderLayer(hid_dim, ... | Encoder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Encoder:
def __init__(self, input_dim: int, hid_dim: int, n_layers: int, n_heads: int, pf_dim: int, dropout: float, device: str, max_length=100):
"""Encoder class for Gated Transformer which is used for + embedding preprocessed input texts + calling n_layers EncoderLayers + providing enc... | stack_v2_sparse_classes_36k_train_024209 | 14,453 | permissive | [
{
"docstring": "Encoder class for Gated Transformer which is used for + embedding preprocessed input texts + calling n_layers EncoderLayers + providing encoded output for Decoder Parameters ---------- input_dim: int input dimension of the tokenized text to Input Embedding layer hid_dim: int dimension of the out... | 2 | stack_v2_sparse_classes_30k_train_005211 | Implement the Python class `Encoder` described below.
Class description:
Implement the Encoder class.
Method signatures and docstrings:
- def __init__(self, input_dim: int, hid_dim: int, n_layers: int, n_heads: int, pf_dim: int, dropout: float, device: str, max_length=100): Encoder class for Gated Transformer which i... | Implement the Python class `Encoder` described below.
Class description:
Implement the Encoder class.
Method signatures and docstrings:
- def __init__(self, input_dim: int, hid_dim: int, n_layers: int, n_heads: int, pf_dim: int, dropout: float, device: str, max_length=100): Encoder class for Gated Transformer which i... | a6c870d4ed0788f15cfdf58c85ed5201dff60ee9 | <|skeleton|>
class Encoder:
def __init__(self, input_dim: int, hid_dim: int, n_layers: int, n_heads: int, pf_dim: int, dropout: float, device: str, max_length=100):
"""Encoder class for Gated Transformer which is used for + embedding preprocessed input texts + calling n_layers EncoderLayers + providing enc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Encoder:
def __init__(self, input_dim: int, hid_dim: int, n_layers: int, n_heads: int, pf_dim: int, dropout: float, device: str, max_length=100):
"""Encoder class for Gated Transformer which is used for + embedding preprocessed input texts + calling n_layers EncoderLayers + providing encoded output fo... | the_stack_v2_python_sparse | src/gated_transformers_nlp/utils/gated_transformers/encoder.py | mnguyen0226/gated_transformers_nlp | train | 2 | |
8b0c887dc94d59a2f782401c8e9f537122c86463 | [
"TestCaseData.__init__(self)\nself.idTestGroup = None\nself.aidTestCaseArgs = []",
"TestCaseData.initFromDbRow(self, aoRow)\nself.idTestGroup = aoRow[-2]\nself.aidTestCaseArgs = aoRow[-1]\nreturn self"
] | <|body_start_0|>
TestCaseData.__init__(self)
self.idTestGroup = None
self.aidTestCaseArgs = []
<|end_body_0|>
<|body_start_1|>
TestCaseData.initFromDbRow(self, aoRow)
self.idTestGroup = aoRow[-2]
self.aidTestCaseArgs = aoRow[-1]
return self
<|end_body_1|>
| Special representation of a Test Group Member item | TestGroupMemberData2 | [
"GPL-2.0-only",
"LicenseRef-scancode-unknown-license-reference",
"CDDL-1.0",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"LGPL-2.1-or-later",
"GPL-2.0-or-later",
"MPL-1.0",
"LicenseRef-scancode-generic-exception",
"Apache-2.0",
"OpenSSL",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestGroupMemberData2:
"""Special representation of a Test Group Member item"""
def __init__(self):
"""Extend parent class"""
<|body_0|>
def initFromDbRowEx(self, aoRow):
"""Reinitialize from this query: SELECT TestCases.*, TestGroupMembers.idTestGroup, TestGroupM... | stack_v2_sparse_classes_36k_train_024210 | 31,264 | permissive | [
{
"docstring": "Extend parent class",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Reinitialize from this query: SELECT TestCases.*, TestGroupMembers.idTestGroup, TestGroupMembers.aidTestCaseArgs FROM TestCases, TestGroupMembers WHERE TestCases.idTestCase = TestGroupM... | 2 | null | Implement the Python class `TestGroupMemberData2` described below.
Class description:
Special representation of a Test Group Member item
Method signatures and docstrings:
- def __init__(self): Extend parent class
- def initFromDbRowEx(self, aoRow): Reinitialize from this query: SELECT TestCases.*, TestGroupMembers.id... | Implement the Python class `TestGroupMemberData2` described below.
Class description:
Special representation of a Test Group Member item
Method signatures and docstrings:
- def __init__(self): Extend parent class
- def initFromDbRowEx(self, aoRow): Reinitialize from this query: SELECT TestCases.*, TestGroupMembers.id... | 6f78952d58da52ea4f0e55b2ab297f28e80c1160 | <|skeleton|>
class TestGroupMemberData2:
"""Special representation of a Test Group Member item"""
def __init__(self):
"""Extend parent class"""
<|body_0|>
def initFromDbRowEx(self, aoRow):
"""Reinitialize from this query: SELECT TestCases.*, TestGroupMembers.idTestGroup, TestGroupM... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestGroupMemberData2:
"""Special representation of a Test Group Member item"""
def __init__(self):
"""Extend parent class"""
TestCaseData.__init__(self)
self.idTestGroup = None
self.aidTestCaseArgs = []
def initFromDbRowEx(self, aoRow):
"""Reinitialize from th... | the_stack_v2_python_sparse | third_party/virtualbox/src/VBox/ValidationKit/testmanager/core/testgroup.py | thalium/icebox | train | 585 |
04c2c5e1b496e73ff87fb17fa4732f582cdaa1b2 | [
"sesh_attr = handler_input.attributes_manager.session_attributes\ncurrent_date = date.today()\ncurrent_date_str = TimeEncoder.convert_date_to_str(current_date)\nsesh_attr['today'] = current_date_str\nreturn",
"attr = handler_input.attributes_manager.session_attributes\nif attr['current_player'] == None:\n attr... | <|body_start_0|>
sesh_attr = handler_input.attributes_manager.session_attributes
current_date = date.today()
current_date_str = TimeEncoder.convert_date_to_str(current_date)
sesh_attr['today'] = current_date_str
return
<|end_body_0|>
<|body_start_1|>
attr = handler_input... | SessionAttrMnger | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SessionAttrMnger:
def load_session_attr(handler_input) -> None:
"""Loads all necessary session attributes."""
<|body_0|>
def set_pointer_attr(handler_input) -> None:
"""Sets next_pointer when not current player."""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_36k_train_024211 | 1,193 | permissive | [
{
"docstring": "Loads all necessary session attributes.",
"name": "load_session_attr",
"signature": "def load_session_attr(handler_input) -> None"
},
{
"docstring": "Sets next_pointer when not current player.",
"name": "set_pointer_attr",
"signature": "def set_pointer_attr(handler_input)... | 2 | null | Implement the Python class `SessionAttrMnger` described below.
Class description:
Implement the SessionAttrMnger class.
Method signatures and docstrings:
- def load_session_attr(handler_input) -> None: Loads all necessary session attributes.
- def set_pointer_attr(handler_input) -> None: Sets next_pointer when not cu... | Implement the Python class `SessionAttrMnger` described below.
Class description:
Implement the SessionAttrMnger class.
Method signatures and docstrings:
- def load_session_attr(handler_input) -> None: Loads all necessary session attributes.
- def set_pointer_attr(handler_input) -> None: Sets next_pointer when not cu... | 1072dea1a5be0b339211ff39db6a89a90aca64c1 | <|skeleton|>
class SessionAttrMnger:
def load_session_attr(handler_input) -> None:
"""Loads all necessary session attributes."""
<|body_0|>
def set_pointer_attr(handler_input) -> None:
"""Sets next_pointer when not current player."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SessionAttrMnger:
def load_session_attr(handler_input) -> None:
"""Loads all necessary session attributes."""
sesh_attr = handler_input.attributes_manager.session_attributes
current_date = date.today()
current_date_str = TimeEncoder.convert_date_to_str(current_date)
ses... | the_stack_v2_python_sparse | 1_code/attr_mngment/sesh_attr_manager.py | jaimiles23/Multiplication-Medley | train | 0 | |
3391c4e1d303518a92891b7a158618cc930f5c20 | [
"h = {}\nfor idx, i in enumerate(nums):\n h[i] = idx\nfor idx, s in enumerate(nums):\n print(s, target - s)\n if h.has_key(target - s) and idx != h[target - s]:\n return [idx, h[target - s]]",
"dicta = {}\nfor i in range(len(nums)):\n x = nums[i]\n if target - x in dicta:\n return (di... | <|body_start_0|>
h = {}
for idx, i in enumerate(nums):
h[i] = idx
for idx, s in enumerate(nums):
print(s, target - s)
if h.has_key(target - s) and idx != h[target - s]:
return [idx, h[target - s]]
<|end_body_0|>
<|body_start_1|>
dicta ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_024212 | 1,450 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum2",
"signature": "def twoSum2(self, nums, target)"
}... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum2(self, nums, target): :type nums: List[int] :type target: int :rtype: List[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum2(self, nums, target): :type nums: List[int] :type target: int :rtype: List[... | b0f498ebe84e46b7e17e94759dd462891dcc8f85 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
h = {}
for idx, i in enumerate(nums):
h[i] = idx
for idx, s in enumerate(nums):
print(s, target - s)
if h.has_key(target - s) and idx !=... | the_stack_v2_python_sparse | 初级算法/array_9.py | wulinlw/leetcode_cn | train | 0 | |
c0b5960f6068d0a276878bf89b02c6c37e0656ed | [
"stateanalyzer = DH.StateAnalyzer(mergeddata)\nVALID_STATES = stateanalyzer.get_state_list()\nself.assertEqual(len(VALID_STATES), 55)\nstateanalyzer.set_state_data('NY')\nself.assertEqual(stateanalyzer.filtered_data.can_off_sta.unique(), ['NY'])\nstateanalyzer.set_state_data('CA')\nself.assertEqual(stateanalyzer.fi... | <|body_start_0|>
stateanalyzer = DH.StateAnalyzer(mergeddata)
VALID_STATES = stateanalyzer.get_state_list()
self.assertEqual(len(VALID_STATES), 55)
stateanalyzer.set_state_data('NY')
self.assertEqual(stateanalyzer.filtered_data.can_off_sta.unique(), ['NY'])
stateanalyzer.... | Unit Test for DataHandlers in DataHandler.py | DataHandlerTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataHandlerTest:
"""Unit Test for DataHandlers in DataHandler.py"""
def test_StateAnalyzer(self):
"""This tests StateAnalyzer class"""
<|body_0|>
def test_YearAnalyzer(self):
"""This tests YearAnalyzer class"""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_36k_train_024213 | 2,909 | no_license | [
{
"docstring": "This tests StateAnalyzer class",
"name": "test_StateAnalyzer",
"signature": "def test_StateAnalyzer(self)"
},
{
"docstring": "This tests YearAnalyzer class",
"name": "test_YearAnalyzer",
"signature": "def test_YearAnalyzer(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012845 | Implement the Python class `DataHandlerTest` described below.
Class description:
Unit Test for DataHandlers in DataHandler.py
Method signatures and docstrings:
- def test_StateAnalyzer(self): This tests StateAnalyzer class
- def test_YearAnalyzer(self): This tests YearAnalyzer class | Implement the Python class `DataHandlerTest` described below.
Class description:
Unit Test for DataHandlers in DataHandler.py
Method signatures and docstrings:
- def test_StateAnalyzer(self): This tests StateAnalyzer class
- def test_YearAnalyzer(self): This tests YearAnalyzer class
<|skeleton|>
class DataHandlerTes... | dc9185cbc5e65650d985ebecf877a157c8c19a13 | <|skeleton|>
class DataHandlerTest:
"""Unit Test for DataHandlers in DataHandler.py"""
def test_StateAnalyzer(self):
"""This tests StateAnalyzer class"""
<|body_0|>
def test_YearAnalyzer(self):
"""This tests YearAnalyzer class"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataHandlerTest:
"""Unit Test for DataHandlers in DataHandler.py"""
def test_StateAnalyzer(self):
"""This tests StateAnalyzer class"""
stateanalyzer = DH.StateAnalyzer(mergeddata)
VALID_STATES = stateanalyzer.get_state_list()
self.assertEqual(len(VALID_STATES), 55)
... | the_stack_v2_python_sparse | FINAL_PROJECT/PROJECT/test.py | ds-ga-1007/final_project | train | 0 |
95e4d1b7f8a6965e0aa7ba1dfad1c51865b11ec9 | [
"conversion_imports.check()\nsuper().__init__(remove_numeric_tables=remove_numeric_tables, valid_languages=valid_languages, id_hash_keys=id_hash_keys, progress_bar=progress_bar)\nself.remove_code_snippets = remove_code_snippets\nself.extract_headlines = extract_headlines\nself.add_frontmatter_to_meta = add_frontmat... | <|body_start_0|>
conversion_imports.check()
super().__init__(remove_numeric_tables=remove_numeric_tables, valid_languages=valid_languages, id_hash_keys=id_hash_keys, progress_bar=progress_bar)
self.remove_code_snippets = remove_code_snippets
self.extract_headlines = extract_headlines
... | MarkdownConverter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MarkdownConverter:
def __init__(self, remove_numeric_tables: bool=False, valid_languages: Optional[List[str]]=None, id_hash_keys: Optional[List[str]]=None, progress_bar: bool=True, remove_code_snippets: bool=True, extract_headlines: bool=False, add_frontmatter_to_meta: bool=False):
""":p... | stack_v2_sparse_classes_36k_train_024214 | 6,131 | permissive | [
{
"docstring": ":param remove_numeric_tables: Not applicable. :param valid_languages: Not applicable. :param id_hash_keys: Generate the document ID from a custom list of strings that refer to the document's attributes. To make sure you don't have duplicate documents in your DocumentStore if texts are not unique... | 3 | null | Implement the Python class `MarkdownConverter` described below.
Class description:
Implement the MarkdownConverter class.
Method signatures and docstrings:
- def __init__(self, remove_numeric_tables: bool=False, valid_languages: Optional[List[str]]=None, id_hash_keys: Optional[List[str]]=None, progress_bar: bool=True... | Implement the Python class `MarkdownConverter` described below.
Class description:
Implement the MarkdownConverter class.
Method signatures and docstrings:
- def __init__(self, remove_numeric_tables: bool=False, valid_languages: Optional[List[str]]=None, id_hash_keys: Optional[List[str]]=None, progress_bar: bool=True... | 5f1256ac7e5734c2ea481e72cb7e02c34baf8c43 | <|skeleton|>
class MarkdownConverter:
def __init__(self, remove_numeric_tables: bool=False, valid_languages: Optional[List[str]]=None, id_hash_keys: Optional[List[str]]=None, progress_bar: bool=True, remove_code_snippets: bool=True, extract_headlines: bool=False, add_frontmatter_to_meta: bool=False):
""":p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MarkdownConverter:
def __init__(self, remove_numeric_tables: bool=False, valid_languages: Optional[List[str]]=None, id_hash_keys: Optional[List[str]]=None, progress_bar: bool=True, remove_code_snippets: bool=True, extract_headlines: bool=False, add_frontmatter_to_meta: bool=False):
""":param remove_nu... | the_stack_v2_python_sparse | haystack/nodes/file_converter/markdown.py | deepset-ai/haystack | train | 10,599 | |
1576c586beff949b9797000b76bbcfd91cb139b5 | [
"del update_time\nerr = 'action_schema -> resolve_action_data'\nwith ax_model.try_catch(info.context['session'], err, no_commit=True):\n query = Action.get_query(info=info)\n ax_action = query.filter(AxAction.guid == uuid.UUID(guid)).first()\n return ax_action",
"current_user = info.context['user']\ndel ... | <|body_start_0|>
del update_time
err = 'action_schema -> resolve_action_data'
with ax_model.try_catch(info.context['session'], err, no_commit=True):
query = Action.get_query(info=info)
ax_action = query.filter(AxAction.guid == uuid.UUID(guid)).first()
return a... | Query all data of AxAction and related classes | ActionQuery | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActionQuery:
"""Query all data of AxAction and related classes"""
async def resolve_action_data(self, info, guid=None, update_time=None):
"""Gets AxAction by guid. Used in TheActionModal.vue."""
<|body_0|>
async def resolve_actions_avalible(self, info, form_db_name, curr... | stack_v2_sparse_classes_36k_train_024215 | 35,425 | no_license | [
{
"docstring": "Gets AxAction by guid. Used in TheActionModal.vue.",
"name": "resolve_action_data",
"signature": "async def resolve_action_data(self, info, guid=None, update_time=None)"
},
{
"docstring": "Gets AxActions for current state",
"name": "resolve_actions_avalible",
"signature":... | 2 | null | Implement the Python class `ActionQuery` described below.
Class description:
Query all data of AxAction and related classes
Method signatures and docstrings:
- async def resolve_action_data(self, info, guid=None, update_time=None): Gets AxAction by guid. Used in TheActionModal.vue.
- async def resolve_actions_avalibl... | Implement the Python class `ActionQuery` described below.
Class description:
Query all data of AxAction and related classes
Method signatures and docstrings:
- async def resolve_action_data(self, info, guid=None, update_time=None): Gets AxAction by guid. Used in TheActionModal.vue.
- async def resolve_actions_avalibl... | 3540979e680732d38e25a6b39f09338985de6743 | <|skeleton|>
class ActionQuery:
"""Query all data of AxAction and related classes"""
async def resolve_action_data(self, info, guid=None, update_time=None):
"""Gets AxAction by guid. Used in TheActionModal.vue."""
<|body_0|>
async def resolve_actions_avalible(self, info, form_db_name, curr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ActionQuery:
"""Query all data of AxAction and related classes"""
async def resolve_action_data(self, info, guid=None, update_time=None):
"""Gets AxAction by guid. Used in TheActionModal.vue."""
del update_time
err = 'action_schema -> resolve_action_data'
with ax_model.try... | the_stack_v2_python_sparse | Calculation methods/CalcMethods_Lab_3_V15_Task_3_15/venv/Lib/site-packages/ax/backend/schemas/action_schema.py | areyykarthik/Zhukouski_Pavel_BSU_Projects | train | 0 |
cf72857e0c6ee2954b16175b4fd121d77ad36994 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Win32LobAppAssignmentSettings()",
"from .mobile_app_assignment_settings import MobileAppAssignmentSettings\nfrom .mobile_app_install_time_settings import MobileAppInstallTimeSettings\nfrom .win32_lob_app_delivery_optimization_priority ... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return Win32LobAppAssignmentSettings()
<|end_body_0|>
<|body_start_1|>
from .mobile_app_assignment_settings import MobileAppAssignmentSettings
from .mobile_app_install_time_settings import Mobi... | Contains properties used to assign an Win32 LOB mobile app to a group. | Win32LobAppAssignmentSettings | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Win32LobAppAssignmentSettings:
"""Contains properties used to assign an Win32 LOB mobile app to a group."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppAssignmentSettings:
"""Creates a new instance of the appropriate class based on discrimi... | stack_v2_sparse_classes_36k_train_024216 | 4,532 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Win32LobAppAssignmentSettings",
"name": "create_from_discriminator_value",
"signature": "def create_from_dis... | 3 | null | Implement the Python class `Win32LobAppAssignmentSettings` described below.
Class description:
Contains properties used to assign an Win32 LOB mobile app to a group.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppAssignmentSettings: Creates ... | Implement the Python class `Win32LobAppAssignmentSettings` described below.
Class description:
Contains properties used to assign an Win32 LOB mobile app to a group.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppAssignmentSettings: Creates ... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class Win32LobAppAssignmentSettings:
"""Contains properties used to assign an Win32 LOB mobile app to a group."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppAssignmentSettings:
"""Creates a new instance of the appropriate class based on discrimi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Win32LobAppAssignmentSettings:
"""Contains properties used to assign an Win32 LOB mobile app to a group."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppAssignmentSettings:
"""Creates a new instance of the appropriate class based on discriminator value A... | the_stack_v2_python_sparse | msgraph/generated/models/win32_lob_app_assignment_settings.py | microsoftgraph/msgraph-sdk-python | train | 135 |
d33beea26b62063adb94c54288d8a6da4a68132d | [
"super(UploadForm, self).__init__(*args, **kwargs)\nif self.instance:\n self.fields['consent_form']._file = self.instance.consent_form\n download_url = '%s?consent_form' % r.program().urlOf('gci_student_form_upload')\n self.fields['consent_form']._link = download_url\n self.fields['student_id_form']._fi... | <|body_start_0|>
super(UploadForm, self).__init__(*args, **kwargs)
if self.instance:
self.fields['consent_form']._file = self.instance.consent_form
download_url = '%s?consent_form' % r.program().urlOf('gci_student_form_upload')
self.fields['consent_form']._link = down... | Django form to upload student forms | UploadForm | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UploadForm:
"""Django form to upload student forms"""
def __init__(self, r, *args, **kwargs):
"""Initializes the FileFields."""
<|body_0|>
def clean(self):
"""Ensure that at least one of the fields has data."""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_36k_train_024217 | 6,627 | permissive | [
{
"docstring": "Initializes the FileFields.",
"name": "__init__",
"signature": "def __init__(self, r, *args, **kwargs)"
},
{
"docstring": "Ensure that at least one of the fields has data.",
"name": "clean",
"signature": "def clean(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016523 | Implement the Python class `UploadForm` described below.
Class description:
Django form to upload student forms
Method signatures and docstrings:
- def __init__(self, r, *args, **kwargs): Initializes the FileFields.
- def clean(self): Ensure that at least one of the fields has data. | Implement the Python class `UploadForm` described below.
Class description:
Django form to upload student forms
Method signatures and docstrings:
- def __init__(self, r, *args, **kwargs): Initializes the FileFields.
- def clean(self): Ensure that at least one of the fields has data.
<|skeleton|>
class UploadForm:
... | 6bbd1674c99fe285596e46e738856a82afe036af | <|skeleton|>
class UploadForm:
"""Django form to upload student forms"""
def __init__(self, r, *args, **kwargs):
"""Initializes the FileFields."""
<|body_0|>
def clean(self):
"""Ensure that at least one of the fields has data."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UploadForm:
"""Django form to upload student forms"""
def __init__(self, r, *args, **kwargs):
"""Initializes the FileFields."""
super(UploadForm, self).__init__(*args, **kwargs)
if self.instance:
self.fields['consent_form']._file = self.instance.consent_form
... | the_stack_v2_python_sparse | app/soc/modules/gci/views/student_forms.py | adviti/melange | train | 0 |
c7d64e0427e3b62463bfe7302ece906cd7de6f3b | [
"self.rho = rho\nself.stepSize = alpha_step\nself.stepFactor = alpha_factor",
"direction = state['direction']\nif 'initial_alpha_step' in state:\n alpha = state['initial_alpha_step']\nelse:\n alpha = self.stepSize\nf1temp = function(origin)\ngradient = state['gradient']\nwhile True:\n ftemp = function(or... | <|body_start_0|>
self.rho = rho
self.stepSize = alpha_step
self.stepFactor = alpha_factor
<|end_body_0|>
<|body_start_1|>
direction = state['direction']
if 'initial_alpha_step' in state:
alpha = state['initial_alpha_step']
else:
alpha = self.stepS... | The backtracking algorithm for enforcing Armijo rule | BacktrackingSearch | [
"BSD-3-Clause",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BacktrackingSearch:
"""The backtracking algorithm for enforcing Armijo rule"""
def __init__(self, rho=0.1, alpha_step=1.0, alpha_factor=0.5, **kwargs):
"""Can have : - a coefficient for the Armijo rule (rho = 0.1) - an alpha factor to modulate the step (alpha_step = 1.) - an alpha fa... | stack_v2_sparse_classes_36k_train_024218 | 1,202 | permissive | [
{
"docstring": "Can have : - a coefficient for the Armijo rule (rho = 0.1) - an alpha factor to modulate the step (alpha_step = 1.) - an alpha factor < 1 that will decrease the step size until the rule is valid (alpha_factor = 0.5)",
"name": "__init__",
"signature": "def __init__(self, rho=0.1, alpha_st... | 2 | stack_v2_sparse_classes_30k_train_004139 | Implement the Python class `BacktrackingSearch` described below.
Class description:
The backtracking algorithm for enforcing Armijo rule
Method signatures and docstrings:
- def __init__(self, rho=0.1, alpha_step=1.0, alpha_factor=0.5, **kwargs): Can have : - a coefficient for the Armijo rule (rho = 0.1) - an alpha fa... | Implement the Python class `BacktrackingSearch` described below.
Class description:
The backtracking algorithm for enforcing Armijo rule
Method signatures and docstrings:
- def __init__(self, rho=0.1, alpha_step=1.0, alpha_factor=0.5, **kwargs): Can have : - a coefficient for the Armijo rule (rho = 0.1) - an alpha fa... | 3d298e908ff55340cd3612078508be0c791f63a8 | <|skeleton|>
class BacktrackingSearch:
"""The backtracking algorithm for enforcing Armijo rule"""
def __init__(self, rho=0.1, alpha_step=1.0, alpha_factor=0.5, **kwargs):
"""Can have : - a coefficient for the Armijo rule (rho = 0.1) - an alpha factor to modulate the step (alpha_step = 1.) - an alpha fa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BacktrackingSearch:
"""The backtracking algorithm for enforcing Armijo rule"""
def __init__(self, rho=0.1, alpha_step=1.0, alpha_factor=0.5, **kwargs):
"""Can have : - a coefficient for the Armijo rule (rho = 0.1) - an alpha factor to modulate the step (alpha_step = 1.) - an alpha factor < 1 that... | the_stack_v2_python_sparse | PyDSTool/Toolbox/optimizers/line_search/backtracking_search.py | mdlama/pydstool | train | 2 |
490c541e1e7c845c400c88e892bbf4e0fb7e22cd | [
"if not head or not head.next or (not head.next.next):\n return head\neven, odd = (head, head.next)\neven_tail, odd_tail = (even, odd)\ni = 2\nnode = head.next.next\nwhile node:\n if i % 2 == 0:\n even_tail.next = node\n even_tail = node\n else:\n odd_tail.next = node\n odd_tail... | <|body_start_0|>
if not head or not head.next or (not head.next.next):
return head
even, odd = (head, head.next)
even_tail, odd_tail = (even, odd)
i = 2
node = head.next.next
while node:
if i % 2 == 0:
even_tail.next = node
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def oddEvenList(self, head: ListNode) -> ListNode:
"""04/06/2020 23:13"""
<|body_0|>
def oddEvenList(self, head: Optional[ListNode]) -> Optional[ListNode]:
"""Dec 09, 2021 10:13"""
<|body_1|>
def oddEvenList(self, head: Optional[ListNode]) -> O... | stack_v2_sparse_classes_36k_train_024219 | 3,350 | no_license | [
{
"docstring": "04/06/2020 23:13",
"name": "oddEvenList",
"signature": "def oddEvenList(self, head: ListNode) -> ListNode"
},
{
"docstring": "Dec 09, 2021 10:13",
"name": "oddEvenList",
"signature": "def oddEvenList(self, head: Optional[ListNode]) -> Optional[ListNode]"
},
{
"doc... | 4 | stack_v2_sparse_classes_30k_test_000372 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def oddEvenList(self, head: ListNode) -> ListNode: 04/06/2020 23:13
- def oddEvenList(self, head: Optional[ListNode]) -> Optional[ListNode]: Dec 09, 2021 10:13
- def oddEvenList(... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def oddEvenList(self, head: ListNode) -> ListNode: 04/06/2020 23:13
- def oddEvenList(self, head: Optional[ListNode]) -> Optional[ListNode]: Dec 09, 2021 10:13
- def oddEvenList(... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def oddEvenList(self, head: ListNode) -> ListNode:
"""04/06/2020 23:13"""
<|body_0|>
def oddEvenList(self, head: Optional[ListNode]) -> Optional[ListNode]:
"""Dec 09, 2021 10:13"""
<|body_1|>
def oddEvenList(self, head: Optional[ListNode]) -> O... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def oddEvenList(self, head: ListNode) -> ListNode:
"""04/06/2020 23:13"""
if not head or not head.next or (not head.next.next):
return head
even, odd = (head, head.next)
even_tail, odd_tail = (even, odd)
i = 2
node = head.next.next
... | the_stack_v2_python_sparse | leetcode/solved/328_Odd_Even_Linked_List/solution.py | sungminoh/algorithms | train | 0 | |
1da377aae169f5683096ad4e2dc84812f71cfb3b | [
"self.d = []\nfor i in range(1, len(A), 2):\n for j in range(A[i - 1]):\n self.d.append(A[i])",
"if len(self.d) >= n:\n ret = self.d[n - 1]\n self.d = self.d[n:]\nelse:\n ret = -1\n self.d = []\nreturn ret"
] | <|body_start_0|>
self.d = []
for i in range(1, len(A), 2):
for j in range(A[i - 1]):
self.d.append(A[i])
<|end_body_0|>
<|body_start_1|>
if len(self.d) >= n:
ret = self.d[n - 1]
self.d = self.d[n:]
else:
ret = -1
... | RLEIterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RLEIterator:
def __init__(self, A):
""":type A: List[int]"""
<|body_0|>
def next(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.d = []
for i in range(1, len(A), 2):
for j in range(A[i -... | stack_v2_sparse_classes_36k_train_024220 | 628 | no_license | [
{
"docstring": ":type A: List[int]",
"name": "__init__",
"signature": "def __init__(self, A)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "next",
"signature": "def next(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003262 | Implement the Python class `RLEIterator` described below.
Class description:
Implement the RLEIterator class.
Method signatures and docstrings:
- def __init__(self, A): :type A: List[int]
- def next(self, n): :type n: int :rtype: int | Implement the Python class `RLEIterator` described below.
Class description:
Implement the RLEIterator class.
Method signatures and docstrings:
- def __init__(self, A): :type A: List[int]
- def next(self, n): :type n: int :rtype: int
<|skeleton|>
class RLEIterator:
def __init__(self, A):
""":type A: Lis... | 33e5d12bfd9ed9a49cf55df8bd7c6dd8178ec36d | <|skeleton|>
class RLEIterator:
def __init__(self, A):
""":type A: List[int]"""
<|body_0|>
def next(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RLEIterator:
def __init__(self, A):
""":type A: List[int]"""
self.d = []
for i in range(1, len(A), 2):
for j in range(A[i - 1]):
self.d.append(A[i])
def next(self, n):
""":type n: int :rtype: int"""
if len(self.d) >= n:
ret =... | the_stack_v2_python_sparse | iter.py | kirihar2/coding-competition | train | 0 | |
ef8cf3ed1bb6efef8ac8061e9c559d1da83aa062 | [
"super().__init__(data_dims, nsteps=nsteps, window_size=window_size, input_keys=input_keys, name=name)\nself.nx = data_dims['x0'][-1]\nself.timedelay = timedelay\nself.nx_td = self.nx * (1 + self.timedelay)\nself.out_features = self.nx_td",
"features = self.features(data)\nXtd = self.net(features).view(self.timed... | <|body_start_0|>
super().__init__(data_dims, nsteps=nsteps, window_size=window_size, input_keys=input_keys, name=name)
self.nx = data_dims['x0'][-1]
self.timedelay = timedelay
self.nx_td = self.nx * (1 + self.timedelay)
self.out_features = self.nx_td
<|end_body_0|>
<|body_start_... | seq2seqTimeDelayEstimator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class seq2seqTimeDelayEstimator:
def __init__(self, data_dims, nsteps=1, window_size=1, input_keys=['Yp'], timedelay=0, name='estimator'):
""":param data_dims: dict {str: tuple of ints) Data structure describing dimensions of input variables :param nsteps: (int) Prediction horizon :param windo... | stack_v2_sparse_classes_36k_train_024221 | 17,996 | permissive | [
{
"docstring": ":param data_dims: dict {str: tuple of ints) Data structure describing dimensions of input variables :param nsteps: (int) Prediction horizon :param window_size: (int) Size of sequence history to use as input to the state estimator. :param input_keys: (List of str) List of input variable names :pa... | 2 | stack_v2_sparse_classes_30k_train_007568 | Implement the Python class `seq2seqTimeDelayEstimator` described below.
Class description:
Implement the seq2seqTimeDelayEstimator class.
Method signatures and docstrings:
- def __init__(self, data_dims, nsteps=1, window_size=1, input_keys=['Yp'], timedelay=0, name='estimator'): :param data_dims: dict {str: tuple of ... | Implement the Python class `seq2seqTimeDelayEstimator` described below.
Class description:
Implement the seq2seqTimeDelayEstimator class.
Method signatures and docstrings:
- def __init__(self, data_dims, nsteps=1, window_size=1, input_keys=['Yp'], timedelay=0, name='estimator'): :param data_dims: dict {str: tuple of ... | d45b88c5d2cb5afcc942bfdbc6b8041c574614a3 | <|skeleton|>
class seq2seqTimeDelayEstimator:
def __init__(self, data_dims, nsteps=1, window_size=1, input_keys=['Yp'], timedelay=0, name='estimator'):
""":param data_dims: dict {str: tuple of ints) Data structure describing dimensions of input variables :param nsteps: (int) Prediction horizon :param windo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class seq2seqTimeDelayEstimator:
def __init__(self, data_dims, nsteps=1, window_size=1, input_keys=['Yp'], timedelay=0, name='estimator'):
""":param data_dims: dict {str: tuple of ints) Data structure describing dimensions of input variables :param nsteps: (int) Prediction horizon :param window_size: (int) ... | the_stack_v2_python_sparse | neuromancer/neuromancer/estimators.py | pnnl/FlexyAirDeepMPC | train | 1 | |
c373807f10c6a72c295cb702e3a50002a71bb8fc | [
"malicious_node = None\nif self is NodeApproach.SINGLE or self is NodeApproach.INDIRECT or self is NodeApproach.DIRECT or (self is NodeApproach.ZERO_FEATURES):\n malicious_index = np.random.choice(BFS_size, 1)\n malicious_node, _ = neighbours_and_dist[malicious_index.item()]\n malicious_node = torch.tensor... | <|body_start_0|>
malicious_node = None
if self is NodeApproach.SINGLE or self is NodeApproach.INDIRECT or self is NodeApproach.DIRECT or (self is NodeApproach.ZERO_FEATURES):
malicious_index = np.random.choice(BFS_size, 1)
malicious_node, _ = neighbours_and_dist[malicious_index.i... | an object for the different node-based-attack approaches | NodeApproach | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NodeApproach:
"""an object for the different node-based-attack approaches"""
def getMaliciousNode(self, attack, attacked_node: torch.Tensor, y_target: torch.Tensor, node_num: int, neighbours_and_dist: torch.Tensor, BFS_size: int):
"""a get function for the malicious/attacker node, ch... | stack_v2_sparse_classes_36k_train_024222 | 6,766 | no_license | [
{
"docstring": "a get function for the malicious/attacker node, chosen by approach the agree approach is an exception as it test whether or not GRAD_CHOICE and TOPOLOGY select the same node Parameters ---------- attack: oneGNNAttack attacked_node: torch.Tensor - the victim node y_target: torch.Tensor - the targ... | 3 | stack_v2_sparse_classes_30k_train_014332 | Implement the Python class `NodeApproach` described below.
Class description:
an object for the different node-based-attack approaches
Method signatures and docstrings:
- def getMaliciousNode(self, attack, attacked_node: torch.Tensor, y_target: torch.Tensor, node_num: int, neighbours_and_dist: torch.Tensor, BFS_size:... | Implement the Python class `NodeApproach` described below.
Class description:
an object for the different node-based-attack approaches
Method signatures and docstrings:
- def getMaliciousNode(self, attack, attacked_node: torch.Tensor, y_target: torch.Tensor, node_num: int, neighbours_and_dist: torch.Tensor, BFS_size:... | 96ef03959e188c8f12bd47cd190034602fc93b38 | <|skeleton|>
class NodeApproach:
"""an object for the different node-based-attack approaches"""
def getMaliciousNode(self, attack, attacked_node: torch.Tensor, y_target: torch.Tensor, node_num: int, neighbours_and_dist: torch.Tensor, BFS_size: int):
"""a get function for the malicious/attacker node, ch... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NodeApproach:
"""an object for the different node-based-attack approaches"""
def getMaliciousNode(self, attack, attacked_node: torch.Tensor, y_target: torch.Tensor, node_num: int, neighbours_and_dist: torch.Tensor, BFS_size: int):
"""a get function for the malicious/attacker node, chosen by appro... | the_stack_v2_python_sparse | implementation/classes/approach_classes.py | benfinkelshtein/SINGLE | train | 8 |
4b691f256f2e6b10294c0fb6d374d592081f7935 | [
"now_stamp = time.time()\nlocal_time = datetime.datetime.fromtimestamp(now_stamp)\nutc_time = datetime.datetime.utcfromtimestamp(now_stamp)\noffset = local_time - utc_time\nlocal_st = utc_st + offset\nreturn local_st",
"time_struct = time.mktime(local_st.timetuple())\nutc_st = datetime.datetime.utcfromtimestamp(t... | <|body_start_0|>
now_stamp = time.time()
local_time = datetime.datetime.fromtimestamp(now_stamp)
utc_time = datetime.datetime.utcfromtimestamp(now_stamp)
offset = local_time - utc_time
local_st = utc_st + offset
return local_st
<|end_body_0|>
<|body_start_1|>
tim... | TimeUtil | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TimeUtil:
def utc2local(utc_st):
"""UTC时间转本地时间(+8: 00)"""
<|body_0|>
def local2utc(local_st):
"""本地时间转UTC时间(-8: 00)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
now_stamp = time.time()
local_time = datetime.datetime.fromtimestamp(now_stam... | stack_v2_sparse_classes_36k_train_024223 | 792 | no_license | [
{
"docstring": "UTC时间转本地时间(+8: 00)",
"name": "utc2local",
"signature": "def utc2local(utc_st)"
},
{
"docstring": "本地时间转UTC时间(-8: 00)",
"name": "local2utc",
"signature": "def local2utc(local_st)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005191 | Implement the Python class `TimeUtil` described below.
Class description:
Implement the TimeUtil class.
Method signatures and docstrings:
- def utc2local(utc_st): UTC时间转本地时间(+8: 00)
- def local2utc(local_st): 本地时间转UTC时间(-8: 00) | Implement the Python class `TimeUtil` described below.
Class description:
Implement the TimeUtil class.
Method signatures and docstrings:
- def utc2local(utc_st): UTC时间转本地时间(+8: 00)
- def local2utc(local_st): 本地时间转UTC时间(-8: 00)
<|skeleton|>
class TimeUtil:
def utc2local(utc_st):
"""UTC时间转本地时间(+8: 00)"""... | 2664e8f8500367ea91e4ec9ba17d3b22e0c7133d | <|skeleton|>
class TimeUtil:
def utc2local(utc_st):
"""UTC时间转本地时间(+8: 00)"""
<|body_0|>
def local2utc(local_st):
"""本地时间转UTC时间(-8: 00)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TimeUtil:
def utc2local(utc_st):
"""UTC时间转本地时间(+8: 00)"""
now_stamp = time.time()
local_time = datetime.datetime.fromtimestamp(now_stamp)
utc_time = datetime.datetime.utcfromtimestamp(now_stamp)
offset = local_time - utc_time
local_st = utc_st + offset
r... | the_stack_v2_python_sparse | background/byQY/core/TimeUtil.py | evaseemefly/NearGoos | train | 1 | |
1d6bf86eca6c58e765c54602f646241b04bed68c | [
"import win32clipboard\nwin32clipboard.OpenClipboard()\nwin32clipboard.EmptyClipboard()\nwin32clipboard.CloseClipboard()\nreturn True",
"import win32clipboard\ntry:\n win32clipboard.OpenClipboard()\n value = win32clipboard.GetClipboardData(win32clipboard.CF_TEXT)\n win32clipboard.CloseClipboard()\nexcept... | <|body_start_0|>
import win32clipboard
win32clipboard.OpenClipboard()
win32clipboard.EmptyClipboard()
win32clipboard.CloseClipboard()
return True
<|end_body_0|>
<|body_start_1|>
import win32clipboard
try:
win32clipboard.OpenClipboard()
val... | Clipboard | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Clipboard:
def clear(self):
"""emarks Deletes the content of the clipboard. eturn <bool> success"""
<|body_0|>
def text(self):
"""emarks Returns the text hold in the clipboard. eturn <string> text"""
<|body_1|>
def setText(self, text):
"""emarks ... | stack_v2_sparse_classes_36k_train_024224 | 1,686 | permissive | [
{
"docstring": "emarks Deletes the content of the clipboard. eturn <bool> success",
"name": "clear",
"signature": "def clear(self)"
},
{
"docstring": "emarks Returns the text hold in the clipboard. eturn <string> text",
"name": "text",
"signature": "def text(self)"
},
{
"docstrin... | 4 | null | Implement the Python class `Clipboard` described below.
Class description:
Implement the Clipboard class.
Method signatures and docstrings:
- def clear(self): emarks Deletes the content of the clipboard. eturn <bool> success
- def text(self): emarks Returns the text hold in the clipboard. eturn <string> text
- def se... | Implement the Python class `Clipboard` described below.
Class description:
Implement the Clipboard class.
Method signatures and docstrings:
- def clear(self): emarks Deletes the content of the clipboard. eturn <bool> success
- def text(self): emarks Returns the text hold in the clipboard. eturn <string> text
- def se... | 8cf02f9325177c46f52ea757861ca2c9015cb0d8 | <|skeleton|>
class Clipboard:
def clear(self):
"""emarks Deletes the content of the clipboard. eturn <bool> success"""
<|body_0|>
def text(self):
"""emarks Returns the text hold in the clipboard. eturn <string> text"""
<|body_1|>
def setText(self, text):
"""emarks ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Clipboard:
def clear(self):
"""emarks Deletes the content of the clipboard. eturn <bool> success"""
import win32clipboard
win32clipboard.OpenClipboard()
win32clipboard.EmptyClipboard()
win32clipboard.CloseClipboard()
return True
def text(self):
"""e... | the_stack_v2_python_sparse | cross3d/classes/clipboard.py | josephkirk/cross3d | train | 1 | |
90990c623df6a4b12aac1c6ea4f3bcbccc5b52ff | [
"self.is_unique = {}\nself.queue = collections.deque()\nfor num in nums:\n self.add(num)",
"while self.queue:\n n = self.queue[0]\n if not self.is_unique[n]:\n self.queue.popleft()\n else:\n return n\nreturn -1",
"if value not in self.is_unique:\n self.is_unique[value] = True\n s... | <|body_start_0|>
self.is_unique = {}
self.queue = collections.deque()
for num in nums:
self.add(num)
<|end_body_0|>
<|body_start_1|>
while self.queue:
n = self.queue[0]
if not self.is_unique[n]:
self.queue.popleft()
else:
... | FirstUnique | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FirstUnique:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def showFirstUnique(self):
""":rtype: int"""
<|body_1|>
def add(self, value):
""":type value: int :rtype: None"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_36k_train_024225 | 942 | no_license | [
{
"docstring": ":type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":rtype: int",
"name": "showFirstUnique",
"signature": "def showFirstUnique(self)"
},
{
"docstring": ":type value: int :rtype: None",
"name": "add",
"sign... | 3 | null | Implement the Python class `FirstUnique` described below.
Class description:
Implement the FirstUnique class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def showFirstUnique(self): :rtype: int
- def add(self, value): :type value: int :rtype: None | Implement the Python class `FirstUnique` described below.
Class description:
Implement the FirstUnique class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def showFirstUnique(self): :rtype: int
- def add(self, value): :type value: int :rtype: None
<|skeleton|>
class FirstUniq... | 474886c5c43a6192db2708e664663542c2e39548 | <|skeleton|>
class FirstUnique:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def showFirstUnique(self):
""":rtype: int"""
<|body_1|>
def add(self, value):
""":type value: int :rtype: None"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FirstUnique:
def __init__(self, nums):
""":type nums: List[int]"""
self.is_unique = {}
self.queue = collections.deque()
for num in nums:
self.add(num)
def showFirstUnique(self):
""":rtype: int"""
while self.queue:
n = self.queue[0]
... | the_stack_v2_python_sparse | question_leetcode/1429_2.py | paul0920/leetcode | train | 1 | |
a13a2ecb0cd7c0bebe278951c7f0406fad3582aa | [
"super(subMemberObjectListNode, self).__init__(subMember, tree, container)\nself._listNodeTreeItemId = tree.AppendItem(parentTreeItemId, subMember.fancyName)\ntree.SetItemPyData(self._listNodeTreeItemId, (subMember, container))\niconIndex = getIconIndex(subMember.groupIcon)\ntree.SetItemImage(self._listNodeTreeItem... | <|body_start_0|>
super(subMemberObjectListNode, self).__init__(subMember, tree, container)
self._listNodeTreeItemId = tree.AppendItem(parentTreeItemId, subMember.fancyName)
tree.SetItemPyData(self._listNodeTreeItemId, (subMember, container))
iconIndex = getIconIndex(subMember.groupIcon)
... | Private class. Information for a submember node that wraps a single object. | subMemberObjectListNode | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class subMemberObjectListNode:
"""Private class. Information for a submember node that wraps a single object."""
def __init__(self, subMember, tree, container, parentTreeItemId):
"""Create a new node inside the tree that wraps the specified submember"""
<|body_0|>
def insertCh... | stack_v2_sparse_classes_36k_train_024226 | 11,787 | no_license | [
{
"docstring": "Create a new node inside the tree that wraps the specified submember",
"name": "__init__",
"signature": "def __init__(self, subMember, tree, container, parentTreeItemId)"
},
{
"docstring": "Private. Wraps the specified object in a new NodeData and inserts it at the specified posi... | 2 | stack_v2_sparse_classes_30k_train_013209 | Implement the Python class `subMemberObjectListNode` described below.
Class description:
Private class. Information for a submember node that wraps a single object.
Method signatures and docstrings:
- def __init__(self, subMember, tree, container, parentTreeItemId): Create a new node inside the tree that wraps the sp... | Implement the Python class `subMemberObjectListNode` described below.
Class description:
Private class. Information for a submember node that wraps a single object.
Method signatures and docstrings:
- def __init__(self, subMember, tree, container, parentTreeItemId): Create a new node inside the tree that wraps the sp... | f5ecde937663091fd324c9d22fd72542d4eb1e16 | <|skeleton|>
class subMemberObjectListNode:
"""Private class. Information for a submember node that wraps a single object."""
def __init__(self, subMember, tree, container, parentTreeItemId):
"""Create a new node inside the tree that wraps the specified submember"""
<|body_0|>
def insertCh... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class subMemberObjectListNode:
"""Private class. Information for a submember node that wraps a single object."""
def __init__(self, subMember, tree, container, parentTreeItemId):
"""Create a new node inside the tree that wraps the specified submember"""
super(subMemberObjectListNode, self).__in... | the_stack_v2_python_sparse | Python/App/Proxys/NodeData.py | kujira70/simbicon | train | 3 |
7c25530098b4414818ddad23d8d38f202cdc419e | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Win32LobAppProductCodeRule()",
"from .win32_lob_app_rule import Win32LobAppRule\nfrom .win32_lob_app_rule_operator import Win32LobAppRuleOperator\nfrom .win32_lob_app_rule import Win32LobAppRule\nfrom .win32_lob_app_rule_operator impor... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return Win32LobAppProductCodeRule()
<|end_body_0|>
<|body_start_1|>
from .win32_lob_app_rule import Win32LobAppRule
from .win32_lob_app_rule_operator import Win32LobAppRuleOperator
from... | A complex type to store the product code and version rule data for a Win32 LOB app. This rule is not supported as a requirement rule. | Win32LobAppProductCodeRule | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Win32LobAppProductCodeRule:
"""A complex type to store the product code and version rule data for a Win32 LOB app. This rule is not supported as a requirement rule."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppProductCodeRule:
"""Creates ... | stack_v2_sparse_classes_36k_train_024227 | 3,115 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Win32LobAppProductCodeRule",
"name": "create_from_discriminator_value",
"signature": "def create_from_discri... | 3 | stack_v2_sparse_classes_30k_train_005692 | Implement the Python class `Win32LobAppProductCodeRule` described below.
Class description:
A complex type to store the product code and version rule data for a Win32 LOB app. This rule is not supported as a requirement rule.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional... | Implement the Python class `Win32LobAppProductCodeRule` described below.
Class description:
A complex type to store the product code and version rule data for a Win32 LOB app. This rule is not supported as a requirement rule.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class Win32LobAppProductCodeRule:
"""A complex type to store the product code and version rule data for a Win32 LOB app. This rule is not supported as a requirement rule."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppProductCodeRule:
"""Creates ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Win32LobAppProductCodeRule:
"""A complex type to store the product code and version rule data for a Win32 LOB app. This rule is not supported as a requirement rule."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppProductCodeRule:
"""Creates a new instanc... | the_stack_v2_python_sparse | msgraph/generated/models/win32_lob_app_product_code_rule.py | microsoftgraph/msgraph-sdk-python | train | 135 |
c425c4d9bc8a845ea90b4fb5b50f6bd9499a6301 | [
"StrategyPlayer.__init__(self, id, PlayerKind.Mixed)\nself.Defensive = DefensivePlayer(id)\nself.Aggressive = AggressivePlayer(id)\nself.Fast = FastPlayer(id)",
"successorIndex = self.Defensive.select_nonrandom_new_state(board_state, successors, timestamp)\nif successorIndex != -1:\n return successorIndex\nsuc... | <|body_start_0|>
StrategyPlayer.__init__(self, id, PlayerKind.Mixed)
self.Defensive = DefensivePlayer(id)
self.Aggressive = AggressivePlayer(id)
self.Fast = FastPlayer(id)
<|end_body_0|>
<|body_start_1|>
successorIndex = self.Defensive.select_nonrandom_new_state(board_state, suc... | Class that defines a Ludo player that makes moves based on mixed strategy. First defensive, if not aggressive, if not fast, if not random strategy. | MixedStrategyPlayer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MixedStrategyPlayer:
"""Class that defines a Ludo player that makes moves based on mixed strategy. First defensive, if not aggressive, if not fast, if not random strategy."""
def __init__(self, id):
"""Construct a new mixed_strategy player."""
<|body_0|>
def select_nonra... | stack_v2_sparse_classes_36k_train_024228 | 1,574 | no_license | [
{
"docstring": "Construct a new mixed_strategy player.",
"name": "__init__",
"signature": "def __init__(self, id)"
},
{
"docstring": "Override the parent method in order to implement a fast-player strategy",
"name": "select_nonrandom_new_state",
"signature": "def select_nonrandom_new_sta... | 2 | stack_v2_sparse_classes_30k_test_000964 | Implement the Python class `MixedStrategyPlayer` described below.
Class description:
Class that defines a Ludo player that makes moves based on mixed strategy. First defensive, if not aggressive, if not fast, if not random strategy.
Method signatures and docstrings:
- def __init__(self, id): Construct a new mixed_str... | Implement the Python class `MixedStrategyPlayer` described below.
Class description:
Class that defines a Ludo player that makes moves based on mixed strategy. First defensive, if not aggressive, if not fast, if not random strategy.
Method signatures and docstrings:
- def __init__(self, id): Construct a new mixed_str... | b398aec87d9ff310e351c4b8c77d9a3e0f8d8d77 | <|skeleton|>
class MixedStrategyPlayer:
"""Class that defines a Ludo player that makes moves based on mixed strategy. First defensive, if not aggressive, if not fast, if not random strategy."""
def __init__(self, id):
"""Construct a new mixed_strategy player."""
<|body_0|>
def select_nonra... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MixedStrategyPlayer:
"""Class that defines a Ludo player that makes moves based on mixed strategy. First defensive, if not aggressive, if not fast, if not random strategy."""
def __init__(self, id):
"""Construct a new mixed_strategy player."""
StrategyPlayer.__init__(self, id, PlayerKind.... | the_stack_v2_python_sparse | src/mixed_strategy_player.py | gagbaghdas/AILudoPlayer | train | 0 |
70ef90889b07f4df1a5b5aaf9bdcdc8cc6eaf111 | [
"driver = self.driver\ndriver.get(self.base_url)\nhomepage = HomePage(self.driver)\nhomepage.click_oa()\nhomepage.sleep(0.5)\nhomepage.click_itfw()\nhomepage.click_yxgl()\nhomepage.sleep(0.1)\nhomepage.click_tsyxsq()\nhomepage.switch_frame(driver.find_element_by_xpath(\"//iframe[@src='http://oa2.eascs.com/eaoa/emai... | <|body_start_0|>
driver = self.driver
driver.get(self.base_url)
homepage = HomePage(self.driver)
homepage.click_oa()
homepage.sleep(0.5)
homepage.click_itfw()
homepage.click_yxgl()
homepage.sleep(0.1)
homepage.click_tsyxsq()
homepage.switch... | 邮箱管理 | Start | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Start:
"""邮箱管理"""
def test1_tsyxsq(self):
"""特殊邮箱申请"""
<|body_0|>
def test2_tsyxsq(self):
"""临时邮件组管理"""
<|body_1|>
def test3_tsyxsq(self):
"""邮件组发送申请"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
driver = self.driver
... | stack_v2_sparse_classes_36k_train_024229 | 3,013 | no_license | [
{
"docstring": "特殊邮箱申请",
"name": "test1_tsyxsq",
"signature": "def test1_tsyxsq(self)"
},
{
"docstring": "临时邮件组管理",
"name": "test2_tsyxsq",
"signature": "def test2_tsyxsq(self)"
},
{
"docstring": "邮件组发送申请",
"name": "test3_tsyxsq",
"signature": "def test3_tsyxsq(self)"
}... | 3 | stack_v2_sparse_classes_30k_train_012793 | Implement the Python class `Start` described below.
Class description:
邮箱管理
Method signatures and docstrings:
- def test1_tsyxsq(self): 特殊邮箱申请
- def test2_tsyxsq(self): 临时邮件组管理
- def test3_tsyxsq(self): 邮件组发送申请 | Implement the Python class `Start` described below.
Class description:
邮箱管理
Method signatures and docstrings:
- def test1_tsyxsq(self): 特殊邮箱申请
- def test2_tsyxsq(self): 临时邮件组管理
- def test3_tsyxsq(self): 邮件组发送申请
<|skeleton|>
class Start:
"""邮箱管理"""
def test1_tsyxsq(self):
"""特殊邮箱申请"""
<|body_... | a90695147681163d45d4951f6a921eda816500bb | <|skeleton|>
class Start:
"""邮箱管理"""
def test1_tsyxsq(self):
"""特殊邮箱申请"""
<|body_0|>
def test2_tsyxsq(self):
"""临时邮件组管理"""
<|body_1|>
def test3_tsyxsq(self):
"""邮件组发送申请"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Start:
"""邮箱管理"""
def test1_tsyxsq(self):
"""特殊邮箱申请"""
driver = self.driver
driver.get(self.base_url)
homepage = HomePage(self.driver)
homepage.click_oa()
homepage.sleep(0.5)
homepage.click_itfw()
homepage.click_yxgl()
homepage.sleep... | the_stack_v2_python_sparse | oa_test_case/oa_yxgl.py | shengli520/yyt | train | 0 |
3c1b24f676dcfbc58ceb690124dabc73519c4914 | [
"self._parameters = parameters\nif not hasattr(self, '_mapper'):\n self._mapper = OCPProviderMap(provider=self.provider, report_type=parameters.report_type)\nif parameters.get_filter('enabled') is None:\n parameters.set_filter(**{'enabled': True})\nsuper().__init__(parameters)",
"filter_map = deepcopy(TagQu... | <|body_start_0|>
self._parameters = parameters
if not hasattr(self, '_mapper'):
self._mapper = OCPProviderMap(provider=self.provider, report_type=parameters.report_type)
if parameters.get_filter('enabled') is None:
parameters.set_filter(**{'enabled': True})
super(... | Handles tag queries and responses for OCP. | OCPTagQueryHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OCPTagQueryHandler:
"""Handles tag queries and responses for OCP."""
def __init__(self, parameters):
"""Establish AWS report query handler. Args: parameters (QueryParameters): parameter object for query"""
<|body_0|>
def filter_map(self):
"""Establish which filte... | stack_v2_sparse_classes_36k_train_024230 | 4,620 | permissive | [
{
"docstring": "Establish AWS report query handler. Args: parameters (QueryParameters): parameter object for query",
"name": "__init__",
"signature": "def __init__(self, parameters)"
},
{
"docstring": "Establish which filter map to use based on tag API.",
"name": "filter_map",
"signature... | 2 | stack_v2_sparse_classes_30k_train_020849 | Implement the Python class `OCPTagQueryHandler` described below.
Class description:
Handles tag queries and responses for OCP.
Method signatures and docstrings:
- def __init__(self, parameters): Establish AWS report query handler. Args: parameters (QueryParameters): parameter object for query
- def filter_map(self): ... | Implement the Python class `OCPTagQueryHandler` described below.
Class description:
Handles tag queries and responses for OCP.
Method signatures and docstrings:
- def __init__(self, parameters): Establish AWS report query handler. Args: parameters (QueryParameters): parameter object for query
- def filter_map(self): ... | 0416e5216eb1ec4b41c8dd4999adde218b1ab2e1 | <|skeleton|>
class OCPTagQueryHandler:
"""Handles tag queries and responses for OCP."""
def __init__(self, parameters):
"""Establish AWS report query handler. Args: parameters (QueryParameters): parameter object for query"""
<|body_0|>
def filter_map(self):
"""Establish which filte... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OCPTagQueryHandler:
"""Handles tag queries and responses for OCP."""
def __init__(self, parameters):
"""Establish AWS report query handler. Args: parameters (QueryParameters): parameter object for query"""
self._parameters = parameters
if not hasattr(self, '_mapper'):
... | the_stack_v2_python_sparse | koku/api/tags/ocp/queries.py | project-koku/koku | train | 225 |
e3bc578e03846f97d1463077d8a11d9321e84435 | [
"length = longest = 0\nfor num in nums:\n if num == 1:\n length += 1\n else:\n longest = longest if longest > length else length\n length = 0\nreturn longest if longest > length else length",
"length = longest = 0\nfor num in nums:\n if num == 1:\n length += 1\n else:\n ... | <|body_start_0|>
length = longest = 0
for num in nums:
if num == 1:
length += 1
else:
longest = longest if longest > length else length
length = 0
return longest if longest > length else length
<|end_body_0|>
<|body_start_1... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _findMaxConsecutiveOnes(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findMaxConsecutiveOnes(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
length = longest = 0
... | stack_v2_sparse_classes_36k_train_024231 | 1,591 | permissive | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "_findMaxConsecutiveOnes",
"signature": "def _findMaxConsecutiveOnes(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "findMaxConsecutiveOnes",
"signature": "def findMaxConsecutiveOnes(self, nums)"
}... | 2 | stack_v2_sparse_classes_30k_train_004222 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _findMaxConsecutiveOnes(self, nums): :type nums: List[int] :rtype: int
- def findMaxConsecutiveOnes(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 _findMaxConsecutiveOnes(self, nums): :type nums: List[int] :rtype: int
- def findMaxConsecutiveOnes(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solutio... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _findMaxConsecutiveOnes(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findMaxConsecutiveOnes(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def _findMaxConsecutiveOnes(self, nums):
""":type nums: List[int] :rtype: int"""
length = longest = 0
for num in nums:
if num == 1:
length += 1
else:
longest = longest if longest > length else length
leng... | the_stack_v2_python_sparse | 485.max-consecutive-ones.py | windard/leeeeee | train | 0 | |
b751083f8b405f3cf87f545ff4ae44a72ae8cc6b | [
"device = torch.device('cuda')\nself.encoder = networks.ResnetEncoder(18, False)\nself.depth_decoder = networks.DepthDecoder(num_ch_enc=self.encoder.num_ch_enc, scales=range(4))\nprint('==> Initialize Depth-CNN with {}'.format(weight_path))\nencoder_path = os.path.join(weight_path, 'encoder.pth')\nloaded_dict_enc =... | <|body_start_0|>
device = torch.device('cuda')
self.encoder = networks.ResnetEncoder(18, False)
self.depth_decoder = networks.DepthDecoder(num_ch_enc=self.encoder.num_ch_enc, scales=range(4))
print('==> Initialize Depth-CNN with {}'.format(weight_path))
encoder_path = os.path.joi... | Monodepth2DepthNet | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Monodepth2DepthNet:
def initialize_network_model(self, weight_path, dataset='kitti'):
"""initialize network and load pretrained model Args: weight_path (str): directory stores pretrained models - encoder.pth: encoder model - depth.pth: depth decoder model dataset (str): dataset setup for... | stack_v2_sparse_classes_36k_train_024232 | 3,625 | permissive | [
{
"docstring": "initialize network and load pretrained model Args: weight_path (str): directory stores pretrained models - encoder.pth: encoder model - depth.pth: depth decoder model dataset (str): dataset setup for min/max depth",
"name": "initialize_network_model",
"signature": "def initialize_network... | 2 | stack_v2_sparse_classes_30k_train_014060 | Implement the Python class `Monodepth2DepthNet` described below.
Class description:
Implement the Monodepth2DepthNet class.
Method signatures and docstrings:
- def initialize_network_model(self, weight_path, dataset='kitti'): initialize network and load pretrained model Args: weight_path (str): directory stores pretr... | Implement the Python class `Monodepth2DepthNet` described below.
Class description:
Implement the Monodepth2DepthNet class.
Method signatures and docstrings:
- def initialize_network_model(self, weight_path, dataset='kitti'): initialize network and load pretrained model Args: weight_path (str): directory stores pretr... | 5417faacb5af7b0e8a4857a88c8a099a2d403f7a | <|skeleton|>
class Monodepth2DepthNet:
def initialize_network_model(self, weight_path, dataset='kitti'):
"""initialize network and load pretrained model Args: weight_path (str): directory stores pretrained models - encoder.pth: encoder model - depth.pth: depth decoder model dataset (str): dataset setup for... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Monodepth2DepthNet:
def initialize_network_model(self, weight_path, dataset='kitti'):
"""initialize network and load pretrained model Args: weight_path (str): directory stores pretrained models - encoder.pth: encoder model - depth.pth: depth decoder model dataset (str): dataset setup for min/max depth... | the_stack_v2_python_sparse | libs/deep_depth/monodepth2.py | KuangHaofei/DF-VO | train | 0 | |
1cc0e9e621c42e13d9cdcd29c0e3ee39caeece4d | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ConversationThread()",
"from .entity import Entity\nfrom .post import Post\nfrom .recipient import Recipient\nfrom .entity import Entity\nfrom .post import Post\nfrom .recipient import Recipient\nfields: Dict[str, Callable[[Any], None]... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return ConversationThread()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .post import Post
from .recipient import Recipient
from .entity import Entity
... | ConversationThread | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConversationThread:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConversationThread:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje... | stack_v2_sparse_classes_36k_train_024233 | 4,784 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ConversationThread",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_... | 3 | null | Implement the Python class `ConversationThread` described below.
Class description:
Implement the ConversationThread class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConversationThread: Creates a new instance of the appropriate class based on disc... | Implement the Python class `ConversationThread` described below.
Class description:
Implement the ConversationThread class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConversationThread: Creates a new instance of the appropriate class based on disc... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ConversationThread:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConversationThread:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConversationThread:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConversationThread:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Co... | the_stack_v2_python_sparse | msgraph/generated/models/conversation_thread.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
ad29b1837ce39a4be0200f090d59eb124731e5f3 | [
"self.number = number\nself.current_color = '000000'\nself.log = logging.getLogger('RASPLed')\nself.strip = strip",
"new_color = '{0}{1}{2}'.format(hex(int(color[0]))[2:].zfill(2), hex(int(color[1]))[2:].zfill(2), hex(int(color[2]))[2:].zfill(2))\ntry:\n self.current_color = new_color\n self.strip.setPixelC... | <|body_start_0|>
self.number = number
self.current_color = '000000'
self.log = logging.getLogger('RASPLed')
self.strip = strip
<|end_body_0|>
<|body_start_1|>
new_color = '{0}{1}{2}'.format(hex(int(color[0]))[2:].zfill(2), hex(int(color[1]))[2:].zfill(2), hex(int(color[2]))[2:].... | RASPLed | [
"MIT",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RASPLed:
def __init__(self, config, number, strip):
"""Initialise led."""
<|body_0|>
def color(self, color):
"""Set the LED to the specified color. Args: color: a list of int colors. one for each channel. Returns: None"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_024234 | 20,244 | permissive | [
{
"docstring": "Initialise led.",
"name": "__init__",
"signature": "def __init__(self, config, number, strip)"
},
{
"docstring": "Set the LED to the specified color. Args: color: a list of int colors. one for each channel. Returns: None",
"name": "color",
"signature": "def color(self, co... | 2 | stack_v2_sparse_classes_30k_train_001690 | Implement the Python class `RASPLed` described below.
Class description:
Implement the RASPLed class.
Method signatures and docstrings:
- def __init__(self, config, number, strip): Initialise led.
- def color(self, color): Set the LED to the specified color. Args: color: a list of int colors. one for each channel. Re... | Implement the Python class `RASPLed` described below.
Class description:
Implement the RASPLed class.
Method signatures and docstrings:
- def __init__(self, config, number, strip): Initialise led.
- def color(self, color): Set the LED to the specified color. Args: color: a list of int colors. one for each channel. Re... | 00937ab2ff51b1dc668bf465282ffa8ff1eebbd8 | <|skeleton|>
class RASPLed:
def __init__(self, config, number, strip):
"""Initialise led."""
<|body_0|>
def color(self, color):
"""Set the LED to the specified color. Args: color: a list of int colors. one for each channel. Returns: None"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RASPLed:
def __init__(self, config, number, strip):
"""Initialise led."""
self.number = number
self.current_color = '000000'
self.log = logging.getLogger('RASPLed')
self.strip = strip
def color(self, color):
"""Set the LED to the specified color. Args: colo... | the_stack_v2_python_sparse | mpf/platforms/rasppinball/rasppinball.py | vgrillot/mpf | train | 0 | |
e2063b4154f217d2ff5041f56af8865f22ccaa65 | [
"challenges: List[Dict[str, Any]] = []\nchallenges = OfficerChallenges.Table(self, challenges)\nUtility.WriteFile(self, f'{self.eXAssets}/officerChallenges.json', challenges)\nlog.info(f'Compiled {len(challenges):,} Officer Challenges')",
"table: List[Dict[str, Any]] = Utility.ReadCSV(self, f'{self.iXAssets}/elde... | <|body_start_0|>
challenges: List[Dict[str, Any]] = []
challenges = OfficerChallenges.Table(self, challenges)
Utility.WriteFile(self, f'{self.eXAssets}/officerChallenges.json', challenges)
log.info(f'Compiled {len(challenges):,} Officer Challenges')
<|end_body_0|>
<|body_start_1|>
... | Officer Challenge XAssets. | OfficerChallenges | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OfficerChallenges:
"""Officer Challenge XAssets."""
def Compile(self: Any) -> None:
"""Compile the Officer Challenge XAssets."""
<|body_0|>
def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
"""Compile the elder_challenges.csv XAsset.... | stack_v2_sparse_classes_36k_train_024235 | 13,794 | permissive | [
{
"docstring": "Compile the Officer Challenge XAssets.",
"name": "Compile",
"signature": "def Compile(self: Any) -> None"
},
{
"docstring": "Compile the elder_challenges.csv XAsset.",
"name": "Table",
"signature": "def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[str, ... | 2 | stack_v2_sparse_classes_30k_train_012888 | Implement the Python class `OfficerChallenges` described below.
Class description:
Officer Challenge XAssets.
Method signatures and docstrings:
- def Compile(self: Any) -> None: Compile the Officer Challenge XAssets.
- def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[str, Any]]: Compile the elder_c... | Implement the Python class `OfficerChallenges` described below.
Class description:
Officer Challenge XAssets.
Method signatures and docstrings:
- def Compile(self: Any) -> None: Compile the Officer Challenge XAssets.
- def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[str, Any]]: Compile the elder_c... | 82d3198a64eb2905e96dd536ce2f0acb52f9ce77 | <|skeleton|>
class OfficerChallenges:
"""Officer Challenge XAssets."""
def Compile(self: Any) -> None:
"""Compile the Officer Challenge XAssets."""
<|body_0|>
def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
"""Compile the elder_challenges.csv XAsset.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OfficerChallenges:
"""Officer Challenge XAssets."""
def Compile(self: Any) -> None:
"""Compile the Officer Challenge XAssets."""
challenges: List[Dict[str, Any]] = []
challenges = OfficerChallenges.Table(self, challenges)
Utility.WriteFile(self, f'{self.eXAssets}/officerCh... | the_stack_v2_python_sparse | ModernWarfare/XAssets/challenges.py | dbuentello/Hyde | train | 0 |
1e58859cb11092f28d446dc5d1d8d7a0b81b09dc | [
"self.discovery = discovery\nself.consumer_key = consumer_key\nself.consumer_secret = consumer_secret\nself.user_agent = user_agent\nself.params = kwargs\nself.request_token = {}\nrequired = {}\nfor uriinfo in discovery.itervalues():\n for name, value in uriinfo['parameters'].iteritems():\n if value['requ... | <|body_start_0|>
self.discovery = discovery
self.consumer_key = consumer_key
self.consumer_secret = consumer_secret
self.user_agent = user_agent
self.params = kwargs
self.request_token = {}
required = {}
for uriinfo in discovery.itervalues():
f... | Does the Three Legged Dance for OAuth 1.0a. | FlowThreeLegged | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FlowThreeLegged:
"""Does the Three Legged Dance for OAuth 1.0a."""
def __init__(self, discovery, consumer_key, consumer_secret, user_agent, **kwargs):
"""discovery - Section of the API discovery document that describes the OAuth endpoints. consumer_key - OAuth consumer key consumer_s... | stack_v2_sparse_classes_36k_train_024236 | 15,148 | permissive | [
{
"docstring": "discovery - Section of the API discovery document that describes the OAuth endpoints. consumer_key - OAuth consumer key consumer_secret - OAuth consumer secret user_agent - The HTTP User-Agent that identifies the application. **kwargs - The keyword arguments are all optional and required paramet... | 3 | null | Implement the Python class `FlowThreeLegged` described below.
Class description:
Does the Three Legged Dance for OAuth 1.0a.
Method signatures and docstrings:
- def __init__(self, discovery, consumer_key, consumer_secret, user_agent, **kwargs): discovery - Section of the API discovery document that describes the OAut... | Implement the Python class `FlowThreeLegged` described below.
Class description:
Does the Three Legged Dance for OAuth 1.0a.
Method signatures and docstrings:
- def __init__(self, discovery, consumer_key, consumer_secret, user_agent, **kwargs): discovery - Section of the API discovery document that describes the OAut... | e3c50ee4ec8364c61cfff3ea68ece1098674f4d6 | <|skeleton|>
class FlowThreeLegged:
"""Does the Three Legged Dance for OAuth 1.0a."""
def __init__(self, discovery, consumer_key, consumer_secret, user_agent, **kwargs):
"""discovery - Section of the API discovery document that describes the OAuth endpoints. consumer_key - OAuth consumer key consumer_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FlowThreeLegged:
"""Does the Three Legged Dance for OAuth 1.0a."""
def __init__(self, discovery, consumer_key, consumer_secret, user_agent, **kwargs):
"""discovery - Section of the API discovery document that describes the OAuth endpoints. consumer_key - OAuth consumer key consumer_secret - OAuth... | the_stack_v2_python_sparse | earthengine/google-api-python-client/apiclient/oauth.py | MapofLife/MOL | train | 19 |
ff8739d3bf20714b39dbbb763c9b52194206ca2a | [
"self.self_attn = ConditionalAttention(**self.self_attn_cfg)\nself.cross_attn = ConditionalAttention(**self.cross_attn_cfg)\nself.embed_dims = self.self_attn.embed_dims\nself.ffn = FFN(**self.ffn_cfg)\nnorms_list = [build_norm_layer(self.norm_cfg, self.embed_dims)[1] for _ in range(3)]\nself.norms = ModuleList(norm... | <|body_start_0|>
self.self_attn = ConditionalAttention(**self.self_attn_cfg)
self.cross_attn = ConditionalAttention(**self.cross_attn_cfg)
self.embed_dims = self.self_attn.embed_dims
self.ffn = FFN(**self.ffn_cfg)
norms_list = [build_norm_layer(self.norm_cfg, self.embed_dims)[1] ... | Implements decoder layer in Conditional DETR transformer. | ConditionalDetrTransformerDecoderLayer | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConditionalDetrTransformerDecoderLayer:
"""Implements decoder layer in Conditional DETR transformer."""
def _init_layers(self):
"""Initialize self-attention, cross-attention, FFN, and normalization."""
<|body_0|>
def forward(self, query: Tensor, key: Tensor=None, query_p... | stack_v2_sparse_classes_36k_train_024237 | 7,563 | permissive | [
{
"docstring": "Initialize self-attention, cross-attention, FFN, and normalization.",
"name": "_init_layers",
"signature": "def _init_layers(self)"
},
{
"docstring": "Args: query (Tensor): The input query, has shape (bs, num_queries, dim) key (Tensor, optional): The input key, has shape (bs, num... | 2 | null | Implement the Python class `ConditionalDetrTransformerDecoderLayer` described below.
Class description:
Implements decoder layer in Conditional DETR transformer.
Method signatures and docstrings:
- def _init_layers(self): Initialize self-attention, cross-attention, FFN, and normalization.
- def forward(self, query: T... | Implement the Python class `ConditionalDetrTransformerDecoderLayer` described below.
Class description:
Implements decoder layer in Conditional DETR transformer.
Method signatures and docstrings:
- def _init_layers(self): Initialize self-attention, cross-attention, FFN, and normalization.
- def forward(self, query: T... | 8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6 | <|skeleton|>
class ConditionalDetrTransformerDecoderLayer:
"""Implements decoder layer in Conditional DETR transformer."""
def _init_layers(self):
"""Initialize self-attention, cross-attention, FFN, and normalization."""
<|body_0|>
def forward(self, query: Tensor, key: Tensor=None, query_p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConditionalDetrTransformerDecoderLayer:
"""Implements decoder layer in Conditional DETR transformer."""
def _init_layers(self):
"""Initialize self-attention, cross-attention, FFN, and normalization."""
self.self_attn = ConditionalAttention(**self.self_attn_cfg)
self.cross_attn = C... | the_stack_v2_python_sparse | ai/mmdetection/mmdet/models/layers/transformer/conditional_detr_layers.py | alldatacenter/alldata | train | 774 |
a552106afb5cc8a71b66d0adfafd9a184894585c | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('chuci_yfch_yuwan_zhurh', 'chuci_yfch_yuwan_zhurh')\npipline = [{'$group': {'_id': '$CityName', 'population': {'$max': '$PopulationCount'}}}]\nagg_result = repo['chuci_yfch_yuwan_zhurh.health'].aggregate(... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('chuci_yfch_yuwan_zhurh', 'chuci_yfch_yuwan_zhurh')
pipline = [{'$group': {'_id': '$CityName', 'population': {'$max': '$PopulationCount'}}}]
agg_re... | health_uber_output | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class health_uber_output:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing every... | stack_v2_sparse_classes_36k_train_024238 | 5,159 | no_license | [
{
"docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d... | 2 | stack_v2_sparse_classes_30k_train_006313 | Implement the Python class `health_uber_output` described below.
Class description:
Implement the health_uber_output class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTi... | Implement the Python class `health_uber_output` described below.
Class description:
Implement the health_uber_output class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTi... | 90284cf3debbac36eead07b8d2339cdd191b86cf | <|skeleton|>
class health_uber_output:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing every... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class health_uber_output:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('chuci_yfch_yuwan_zhurh', 'chuci_... | the_stack_v2_python_sparse | chuci_yfch_yuwan_zhurh/health_uber_output.py | maximega/course-2019-spr-proj | train | 2 | |
91e30ac2ad6ad6fe2a3ba6d708611bb1f1f967f9 | [
"self.photo_bucket = photo_bucket\nself.rekognition_client = rekognition_client\nself.ses_client = ses_client",
"result = 200\nreport_csv = ['Photo,Label,Confidence']\ntry:\n for photo in self.photo_bucket.objects.all():\n try:\n response = self.rekognition_client.detect_labels(Image={'S3Obje... | <|body_start_0|>
self.photo_bucket = photo_bucket
self.rekognition_client = rekognition_client
self.ses_client = ses_client
<|end_body_0|>
<|body_start_1|>
result = 200
report_csv = ['Photo,Label,Confidence']
try:
for photo in self.photo_bucket.objects.all():... | Encapsulates a report resource that can get reports of all images in your Amazon Simple Storage Service (Amazon S3) bucket and send emails about them. | Report | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Report:
"""Encapsulates a report resource that can get reports of all images in your Amazon Simple Storage Service (Amazon S3) bucket and send emails about them."""
def __init__(self, photo_bucket, rekognition_client, ses_client):
""":param photo_bucket: The S3 bucket where your phot... | stack_v2_sparse_classes_36k_train_024239 | 4,839 | permissive | [
{
"docstring": ":param photo_bucket: The S3 bucket where your photos are stored. :param rekognition_client: A Boto3 Amazon Rekognition client. :param ses_client: A Boto3 Amazon Simple Email Service (Amazon SES) client.",
"name": "__init__",
"signature": "def __init__(self, photo_bucket, rekognition_clie... | 3 | null | Implement the Python class `Report` described below.
Class description:
Encapsulates a report resource that can get reports of all images in your Amazon Simple Storage Service (Amazon S3) bucket and send emails about them.
Method signatures and docstrings:
- def __init__(self, photo_bucket, rekognition_client, ses_cl... | Implement the Python class `Report` described below.
Class description:
Encapsulates a report resource that can get reports of all images in your Amazon Simple Storage Service (Amazon S3) bucket and send emails about them.
Method signatures and docstrings:
- def __init__(self, photo_bucket, rekognition_client, ses_cl... | dec41fb589043ac9d8667aac36fb88a53c3abe50 | <|skeleton|>
class Report:
"""Encapsulates a report resource that can get reports of all images in your Amazon Simple Storage Service (Amazon S3) bucket and send emails about them."""
def __init__(self, photo_bucket, rekognition_client, ses_client):
""":param photo_bucket: The S3 bucket where your phot... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Report:
"""Encapsulates a report resource that can get reports of all images in your Amazon Simple Storage Service (Amazon S3) bucket and send emails about them."""
def __init__(self, photo_bucket, rekognition_client, ses_client):
""":param photo_bucket: The S3 bucket where your photos are stored... | the_stack_v2_python_sparse | python/cross_service/photo_analyzer/api/report.py | awsdocs/aws-doc-sdk-examples | train | 8,240 |
230e85628c62cd1b6f2bbad827fab61227c72304 | [
"row = g.db.query(MachineGroup).get(machinegroup_id)\nif not row:\n log.warning('Requested a non-existant machine group %s', machinegroup_id)\n abort(http_client.NOT_FOUND, description='Machine Group not found')\nrecord = row.as_dict()\nrecord['url'] = url_for('machinegroups.entry', machinegroup_id=machinegro... | <|body_start_0|>
row = g.db.query(MachineGroup).get(machinegroup_id)
if not row:
log.warning('Requested a non-existant machine group %s', machinegroup_id)
abort(http_client.NOT_FOUND, description='Machine Group not found')
record = row.as_dict()
record['url'] = ur... | Information about specific machines | MachineGroupAPI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MachineGroupAPI:
"""Information about specific machines"""
def get(self, machinegroup_id):
"""Find machine group by ID Get information about a single battle server machine. Just dumps out the DB row as json"""
<|body_0|>
def patch(self, machinegroup_id):
"""Updat... | stack_v2_sparse_classes_36k_train_024240 | 4,880 | permissive | [
{
"docstring": "Find machine group by ID Get information about a single battle server machine. Just dumps out the DB row as json",
"name": "get",
"signature": "def get(self, machinegroup_id)"
},
{
"docstring": "Update machine group",
"name": "patch",
"signature": "def patch(self, machine... | 2 | null | Implement the Python class `MachineGroupAPI` described below.
Class description:
Information about specific machines
Method signatures and docstrings:
- def get(self, machinegroup_id): Find machine group by ID Get information about a single battle server machine. Just dumps out the DB row as json
- def patch(self, ma... | Implement the Python class `MachineGroupAPI` described below.
Class description:
Information about specific machines
Method signatures and docstrings:
- def get(self, machinegroup_id): Find machine group by ID Get information about a single battle server machine. Just dumps out the DB row as json
- def patch(self, ma... | 9825cb22b26b577b715f2ce95453363bf90ecc7e | <|skeleton|>
class MachineGroupAPI:
"""Information about specific machines"""
def get(self, machinegroup_id):
"""Find machine group by ID Get information about a single battle server machine. Just dumps out the DB row as json"""
<|body_0|>
def patch(self, machinegroup_id):
"""Updat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MachineGroupAPI:
"""Information about specific machines"""
def get(self, machinegroup_id):
"""Find machine group by ID Get information about a single battle server machine. Just dumps out the DB row as json"""
row = g.db.query(MachineGroup).get(machinegroup_id)
if not row:
... | the_stack_v2_python_sparse | driftbase/api/machinegroups.py | dgnorth/drift-base | train | 1 |
00cf4f5b1317ed365c3cc3ddb25df182a73f78c5 | [
"inner_text = '编辑'\nselector = 'view.swiper-box>view>view.operation>view.operation-btn'\nel_swiper = self.page.get_element('view.page').get_element('swiper')\nel_preview = el_swiper.get_element('swiper-item>preview#release')\nel_preview.click()\nself.page.sleep(1)\nel_btn = el_preview.get_element(selector, inner_te... | <|body_start_0|>
inner_text = '编辑'
selector = 'view.swiper-box>view>view.operation>view.operation-btn'
el_swiper = self.page.get_element('view.page').get_element('swiper')
el_preview = el_swiper.get_element('swiper-item>preview#release')
el_preview.click()
self.page.sleep... | Elements | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Elements:
def edit_btn(self):
"""编辑 按钮"""
<|body_0|>
def release_btn(self):
"""发布 按钮"""
<|body_1|>
def title_inputbox(self):
"""广告标题 输入框"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
inner_text = '编辑'
selector = 'view.... | stack_v2_sparse_classes_36k_train_024241 | 2,466 | no_license | [
{
"docstring": "编辑 按钮",
"name": "edit_btn",
"signature": "def edit_btn(self)"
},
{
"docstring": "发布 按钮",
"name": "release_btn",
"signature": "def release_btn(self)"
},
{
"docstring": "广告标题 输入框",
"name": "title_inputbox",
"signature": "def title_inputbox(self)"
}
] | 3 | null | Implement the Python class `Elements` described below.
Class description:
Implement the Elements class.
Method signatures and docstrings:
- def edit_btn(self): 编辑 按钮
- def release_btn(self): 发布 按钮
- def title_inputbox(self): 广告标题 输入框 | Implement the Python class `Elements` described below.
Class description:
Implement the Elements class.
Method signatures and docstrings:
- def edit_btn(self): 编辑 按钮
- def release_btn(self): 发布 按钮
- def title_inputbox(self): 广告标题 输入框
<|skeleton|>
class Elements:
def edit_btn(self):
"""编辑 按钮"""
<... | 3011071556a3fa097d951a1823a4870cc4cc81e1 | <|skeleton|>
class Elements:
def edit_btn(self):
"""编辑 按钮"""
<|body_0|>
def release_btn(self):
"""发布 按钮"""
<|body_1|>
def title_inputbox(self):
"""广告标题 输入框"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Elements:
def edit_btn(self):
"""编辑 按钮"""
inner_text = '编辑'
selector = 'view.swiper-box>view>view.operation>view.operation-btn'
el_swiper = self.page.get_element('view.page').get_element('swiper')
el_preview = el_swiper.get_element('swiper-item>preview#release')
... | the_stack_v2_python_sparse | sevenautotest/testobjects/pages/apppages/yy/preview_page.py | hotswwkyo/SevenPytest | train | 3 | |
02774c1261595edc12f3a21ea68dcdbe2bf3c05f | [
"identities = {}\nprocess_identity(identities, 'identity-uuid', {'addresses': {'msisdn': {'+27820001001': {}}}, 'operator_id': 'operator_uuid', 'passport_no': 'A12345', 'passport_origin': 'zw', 'consent': True, 'sa_id_no': '123456', 'mom_given_name': 'Test name', 'mom_family_name': 'Test family name', 'faccode': '1... | <|body_start_0|>
identities = {}
process_identity(identities, 'identity-uuid', {'addresses': {'msisdn': {'+27820001001': {}}}, 'operator_id': 'operator_uuid', 'passport_no': 'A12345', 'passport_origin': 'zw', 'consent': True, 'sa_id_no': '123456', 'mom_given_name': 'Test name', 'mom_family_name': 'Test ... | ProcessIdentityTests | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProcessIdentityTests:
def test_all_identity_details_stored(self):
"""All the relevant details on the identity should be stored in the dictionary"""
<|body_0|>
def test_no_fields(self):
"""It should handle missing fields"""
<|body_1|>
<|end_skeleton|>
<|body... | stack_v2_sparse_classes_36k_train_024242 | 17,808 | permissive | [
{
"docstring": "All the relevant details on the identity should be stored in the dictionary",
"name": "test_all_identity_details_stored",
"signature": "def test_all_identity_details_stored(self)"
},
{
"docstring": "It should handle missing fields",
"name": "test_no_fields",
"signature": ... | 2 | stack_v2_sparse_classes_30k_train_014090 | Implement the Python class `ProcessIdentityTests` described below.
Class description:
Implement the ProcessIdentityTests class.
Method signatures and docstrings:
- def test_all_identity_details_stored(self): All the relevant details on the identity should be stored in the dictionary
- def test_no_fields(self): It sho... | Implement the Python class `ProcessIdentityTests` described below.
Class description:
Implement the ProcessIdentityTests class.
Method signatures and docstrings:
- def test_all_identity_details_stored(self): All the relevant details on the identity should be stored in the dictionary
- def test_no_fields(self): It sho... | e1ea0beaf079f4f4d5f9562fb9d9a4f0670f459f | <|skeleton|>
class ProcessIdentityTests:
def test_all_identity_details_stored(self):
"""All the relevant details on the identity should be stored in the dictionary"""
<|body_0|>
def test_no_fields(self):
"""It should handle missing fields"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProcessIdentityTests:
def test_all_identity_details_stored(self):
"""All the relevant details on the identity should be stored in the dictionary"""
identities = {}
process_identity(identities, 'identity-uuid', {'addresses': {'msisdn': {'+27820001001': {}}}, 'operator_id': 'operator_uui... | the_stack_v2_python_sparse | scripts/migrate_to_rapidpro/test_collect_information.py | praekeltfoundation/ndoh-hub | train | 0 | |
c66654e5ce8afdd80b6d98ce11865674951ace1c | [
"self.Wh = np.random.randn(i + h, h)\nself.Wy = np.random.randn(h, o)\nself.bh = np.zeros((1, h))\nself.by = np.zeros((1, o))",
"Exp = np.exp(h)\nExp = Exp / np.sum(Exp, 1, keepdims=True)\nreturn Exp",
"h_next = np.tanh(np.hstack((h_prev, x_t)) @ self.Wh + self.bh)\ny = self.softmax(h_next @ self.Wy + self.by)\... | <|body_start_0|>
self.Wh = np.random.randn(i + h, h)
self.Wy = np.random.randn(h, o)
self.bh = np.zeros((1, h))
self.by = np.zeros((1, o))
<|end_body_0|>
<|body_start_1|>
Exp = np.exp(h)
Exp = Exp / np.sum(Exp, 1, keepdims=True)
return Exp
<|end_body_1|>
<|body_... | represents a cell of a simple RNN | RNNCell | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RNNCell:
"""represents a cell of a simple RNN"""
def __init__(self, i, h, o):
"""Class constructor"""
<|body_0|>
def softmax(h):
"""softmax activation function"""
<|body_1|>
def forward(self, h_prev, x_t):
"""represent the weights and biases ... | stack_v2_sparse_classes_36k_train_024243 | 855 | no_license | [
{
"docstring": "Class constructor",
"name": "__init__",
"signature": "def __init__(self, i, h, o)"
},
{
"docstring": "softmax activation function",
"name": "softmax",
"signature": "def softmax(h)"
},
{
"docstring": "represent the weights and biases of the cell",
"name": "forw... | 3 | null | Implement the Python class `RNNCell` described below.
Class description:
represents a cell of a simple RNN
Method signatures and docstrings:
- def __init__(self, i, h, o): Class constructor
- def softmax(h): softmax activation function
- def forward(self, h_prev, x_t): represent the weights and biases of the cell | Implement the Python class `RNNCell` described below.
Class description:
represents a cell of a simple RNN
Method signatures and docstrings:
- def __init__(self, i, h, o): Class constructor
- def softmax(h): softmax activation function
- def forward(self, h_prev, x_t): represent the weights and biases of the cell
<|... | c23deee331a71a089197547fcae4c1eefb8d24ef | <|skeleton|>
class RNNCell:
"""represents a cell of a simple RNN"""
def __init__(self, i, h, o):
"""Class constructor"""
<|body_0|>
def softmax(h):
"""softmax activation function"""
<|body_1|>
def forward(self, h_prev, x_t):
"""represent the weights and biases ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RNNCell:
"""represents a cell of a simple RNN"""
def __init__(self, i, h, o):
"""Class constructor"""
self.Wh = np.random.randn(i + h, h)
self.Wy = np.random.randn(h, o)
self.bh = np.zeros((1, h))
self.by = np.zeros((1, o))
def softmax(h):
"""softmax a... | the_stack_v2_python_sparse | supervised_learning/0x0D-RNNs/0-rnn_cell.py | YosriGFX/holbertonschool-machine_learning | train | 0 |
33019cffc8cf1a595802092b51ad871607d19d78 | [
"while path and path[-1] == '\\\\':\n path = path[:-1]\nif path:\n _, _, path = path.rpartition('\\\\')\nreturn path",
"user_account = artifacts.UserAccountArtifact(identifier=registry_key.name, path_separator='\\\\')\nregistry_value = registry_key.GetValueByName('ProfileImagePath')\nif registry_value:\n ... | <|body_start_0|>
while path and path[-1] == '\\':
path = path[:-1]
if path:
_, _, path = path.rpartition('\\')
return path
<|end_body_0|>
<|body_start_1|>
user_account = artifacts.UserAccountArtifact(identifier=registry_key.name, path_separator='\\')
regi... | The Windows user account plugin. | WindowsUserAccountsPlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WindowsUserAccountsPlugin:
"""The Windows user account plugin."""
def _GetUsernameFromProfilePath(self, path):
"""Retrieves the username from a Windows profile path. Trailing path path segment are ignored. Args: path (str): a Windows path with '\\' as path segment separator. Returns:... | stack_v2_sparse_classes_36k_train_024244 | 34,521 | permissive | [
{
"docstring": "Retrieves the username from a Windows profile path. Trailing path path segment are ignored. Args: path (str): a Windows path with '\\\\' as path segment separator. Returns: str: basename which is the last path segment.",
"name": "_GetUsernameFromProfilePath",
"signature": "def _GetUserna... | 2 | null | Implement the Python class `WindowsUserAccountsPlugin` described below.
Class description:
The Windows user account plugin.
Method signatures and docstrings:
- def _GetUsernameFromProfilePath(self, path): Retrieves the username from a Windows profile path. Trailing path path segment are ignored. Args: path (str): a W... | Implement the Python class `WindowsUserAccountsPlugin` described below.
Class description:
The Windows user account plugin.
Method signatures and docstrings:
- def _GetUsernameFromProfilePath(self, path): Retrieves the username from a Windows profile path. Trailing path path segment are ignored. Args: path (str): a W... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class WindowsUserAccountsPlugin:
"""The Windows user account plugin."""
def _GetUsernameFromProfilePath(self, path):
"""Retrieves the username from a Windows profile path. Trailing path path segment are ignored. Args: path (str): a Windows path with '\\' as path segment separator. Returns:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WindowsUserAccountsPlugin:
"""The Windows user account plugin."""
def _GetUsernameFromProfilePath(self, path):
"""Retrieves the username from a Windows profile path. Trailing path path segment are ignored. Args: path (str): a Windows path with '\\' as path segment separator. Returns: str: basenam... | the_stack_v2_python_sparse | plaso/preprocessors/windows.py | log2timeline/plaso | train | 1,506 |
84646463273a373a72a32de11730d3b054953826 | [
"n = len(nums)\nif n == 0:\n return\ndp = [0] * n\ndp[0] = nums[0]\nfor i in range(1, n):\n dp[i] = dp[i - 1] + nums[i]\nself.dp = dp",
"\"\"\"(i, j) = (0, j) - (0, i-1)\"\"\"\nif self.dp is None:\n return 0\nif i == 0:\n return self.dp[j]\nreturn self.dp[j] - self.dp[i - 1]"
] | <|body_start_0|>
n = len(nums)
if n == 0:
return
dp = [0] * n
dp[0] = nums[0]
for i in range(1, n):
dp[i] = dp[i - 1] + nums[i]
self.dp = dp
<|end_body_0|>
<|body_start_1|>
"""(i, j) = (0, j) - (0, i-1)"""
if self.dp is None:
... | NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
def __init__(self, nums: List[int]):
"""Precompute, Time: O(n), Space: O(n)"""
<|body_0|>
def sumRange(self, i: int, j: int) -> int:
"""Time: O(1)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
n = len(nums)
if n == 0:
... | stack_v2_sparse_classes_36k_train_024245 | 1,378 | no_license | [
{
"docstring": "Precompute, Time: O(n), Space: O(n)",
"name": "__init__",
"signature": "def __init__(self, nums: List[int])"
},
{
"docstring": "Time: O(1)",
"name": "sumRange",
"signature": "def sumRange(self, i: int, j: int) -> int"
}
] | 2 | null | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums: List[int]): Precompute, Time: O(n), Space: O(n)
- def sumRange(self, i: int, j: int) -> int: Time: O(1) | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums: List[int]): Precompute, Time: O(n), Space: O(n)
- def sumRange(self, i: int, j: int) -> int: Time: O(1)
<|skeleton|>
class NumArray:
def __init__(s... | 72136e3487d239f5b37e2d6393e034262a6bf599 | <|skeleton|>
class NumArray:
def __init__(self, nums: List[int]):
"""Precompute, Time: O(n), Space: O(n)"""
<|body_0|>
def sumRange(self, i: int, j: int) -> int:
"""Time: O(1)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumArray:
def __init__(self, nums: List[int]):
"""Precompute, Time: O(n), Space: O(n)"""
n = len(nums)
if n == 0:
return
dp = [0] * n
dp[0] = nums[0]
for i in range(1, n):
dp[i] = dp[i - 1] + nums[i]
self.dp = dp
def sumRange... | the_stack_v2_python_sparse | python/303-Range Sum Query - Immutable.py | cwza/leetcode | train | 0 | |
e3ce99851776f8765ee672db602a5a416f365141 | [
"self.obj = obj\nself.username = obj.username\nself.thisRunFolder = None\ngauth = GoogleAuth()\ngauth.LoadCredentialsFile('mycreds.txt')\nif gauth.credentials is None:\n gauth.LocalWebserverAuth()\nelif gauth.access_token_expired:\n gauth.Refresh()\nelse:\n gauth.Authorize()\ngauth.SaveCredentialsFile('myc... | <|body_start_0|>
self.obj = obj
self.username = obj.username
self.thisRunFolder = None
gauth = GoogleAuth()
gauth.LoadCredentialsFile('mycreds.txt')
if gauth.credentials is None:
gauth.LocalWebserverAuth()
elif gauth.access_token_expired:
g... | This class will upload and download files from Drive | driveFile | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class driveFile:
"""This class will upload and download files from Drive"""
def __init__(self, obj):
"""Authenticate Login for first time, then ist automatically"""
<|body_0|>
def downloadFile(self, fileNames):
"""Download specified Filename from drive variables ->file... | stack_v2_sparse_classes_36k_train_024246 | 4,145 | no_license | [
{
"docstring": "Authenticate Login for first time, then ist automatically",
"name": "__init__",
"signature": "def __init__(self, obj)"
},
{
"docstring": "Download specified Filename from drive variables ->fileName: name of file to be downloaded Return: ->1 : File was downloaded ->0 : File couldn... | 3 | stack_v2_sparse_classes_30k_train_010402 | Implement the Python class `driveFile` described below.
Class description:
This class will upload and download files from Drive
Method signatures and docstrings:
- def __init__(self, obj): Authenticate Login for first time, then ist automatically
- def downloadFile(self, fileNames): Download specified Filename from d... | Implement the Python class `driveFile` described below.
Class description:
This class will upload and download files from Drive
Method signatures and docstrings:
- def __init__(self, obj): Authenticate Login for first time, then ist automatically
- def downloadFile(self, fileNames): Download specified Filename from d... | 8a35f6f95f1e1b4e1d050541518ce08aa536bba0 | <|skeleton|>
class driveFile:
"""This class will upload and download files from Drive"""
def __init__(self, obj):
"""Authenticate Login for first time, then ist automatically"""
<|body_0|>
def downloadFile(self, fileNames):
"""Download specified Filename from drive variables ->file... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class driveFile:
"""This class will upload and download files from Drive"""
def __init__(self, obj):
"""Authenticate Login for first time, then ist automatically"""
self.obj = obj
self.username = obj.username
self.thisRunFolder = None
gauth = GoogleAuth()
gauth.L... | the_stack_v2_python_sparse | driveFile.py | yamf0/IGbotTesting | train | 0 |
8b2e01a94b3272c9a05f811a7ebdfa5869304ae6 | [
"if t < 0:\n return False\nif t == 0:\n return self._containsNearbyDuplicate(nums, k)\nbucket = {}\nfor idx, n in enumerate(nums):\n idx_bucket = n / t\n if idx_bucket in bucket:\n return True\n if idx_bucket - 1 in bucket and abs(bucket[idx_bucket - 1] - n) <= t:\n return True\n if ... | <|body_start_0|>
if t < 0:
return False
if t == 0:
return self._containsNearbyDuplicate(nums, k)
bucket = {}
for idx, n in enumerate(nums):
idx_bucket = n / t
if idx_bucket in bucket:
return True
if idx_bucket - ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def containsNearbyAlmostDuplicate(self, nums, k, t):
""":type nums: List[int] :type k: int :type t: int :rtype: bool"""
<|body_0|>
def _containsNearbyDuplicate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k_train_024247 | 1,546 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :type t: int :rtype: bool",
"name": "containsNearbyAlmostDuplicate",
"signature": "def containsNearbyAlmostDuplicate(self, nums, k, t)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: bool",
"name": "_containsNearbyDuplicate",
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def containsNearbyAlmostDuplicate(self, nums, k, t): :type nums: List[int] :type k: int :type t: int :rtype: bool
- def _containsNearbyDuplicate(self, nums, k): :type nums: List[... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def containsNearbyAlmostDuplicate(self, nums, k, t): :type nums: List[int] :type k: int :type t: int :rtype: bool
- def _containsNearbyDuplicate(self, nums, k): :type nums: List[... | fad32c510108d21f78540f8c4ed0295341c0c2dc | <|skeleton|>
class Solution:
def containsNearbyAlmostDuplicate(self, nums, k, t):
""":type nums: List[int] :type k: int :type t: int :rtype: bool"""
<|body_0|>
def _containsNearbyDuplicate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def containsNearbyAlmostDuplicate(self, nums, k, t):
""":type nums: List[int] :type k: int :type t: int :rtype: bool"""
if t < 0:
return False
if t == 0:
return self._containsNearbyDuplicate(nums, k)
bucket = {}
for idx, n in enumerate(... | the_stack_v2_python_sparse | 220 - Contains Duplicate 3/cd3.py | huragok/LeetCode-Practce | train | 0 | |
d21a67aa86295132151774219211bf511183ce77 | [
"siteconfig = SiteConfiguration.objects.get_current()\nself.assertFalse(siteconfig.get(AvatarServiceRegistry.AVATARS_MIGRATED_KEY))\nself.assertTrue(siteconfig.get(AvatarServiceRegistry.AVATARS_ENABLED_KEY))\nself.assertListEqual(siteconfig.get(AvatarServiceRegistry.ENABLED_SERVICES_KEY), [])\nregistry = AvatarServ... | <|body_start_0|>
siteconfig = SiteConfiguration.objects.get_current()
self.assertFalse(siteconfig.get(AvatarServiceRegistry.AVATARS_MIGRATED_KEY))
self.assertTrue(siteconfig.get(AvatarServiceRegistry.AVATARS_ENABLED_KEY))
self.assertListEqual(siteconfig.get(AvatarServiceRegistry.ENABLED_... | Tests for reviewboard.avatars. | AvatarServiceRegistryTests | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AvatarServiceRegistryTests:
"""Tests for reviewboard.avatars."""
def test_migrate_enabled(self):
"""Testing AvatarServiceRegistry migrates avatar settings for enabled gravatars"""
<|body_0|>
def test_migrate_disabled(self):
"""Testing AvatarServiceRegistry migrat... | stack_v2_sparse_classes_36k_train_024248 | 12,493 | permissive | [
{
"docstring": "Testing AvatarServiceRegistry migrates avatar settings for enabled gravatars",
"name": "test_migrate_enabled",
"signature": "def test_migrate_enabled(self)"
},
{
"docstring": "Testing AvatarServiceRegistry migrates avatar settings for disabled gravatars",
"name": "test_migrat... | 2 | stack_v2_sparse_classes_30k_train_017005 | Implement the Python class `AvatarServiceRegistryTests` described below.
Class description:
Tests for reviewboard.avatars.
Method signatures and docstrings:
- def test_migrate_enabled(self): Testing AvatarServiceRegistry migrates avatar settings for enabled gravatars
- def test_migrate_disabled(self): Testing AvatarS... | Implement the Python class `AvatarServiceRegistryTests` described below.
Class description:
Tests for reviewboard.avatars.
Method signatures and docstrings:
- def test_migrate_enabled(self): Testing AvatarServiceRegistry migrates avatar settings for enabled gravatars
- def test_migrate_disabled(self): Testing AvatarS... | 02e1ef3a4e9a8117977b053805234a713c31a699 | <|skeleton|>
class AvatarServiceRegistryTests:
"""Tests for reviewboard.avatars."""
def test_migrate_enabled(self):
"""Testing AvatarServiceRegistry migrates avatar settings for enabled gravatars"""
<|body_0|>
def test_migrate_disabled(self):
"""Testing AvatarServiceRegistry migrat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AvatarServiceRegistryTests:
"""Tests for reviewboard.avatars."""
def test_migrate_enabled(self):
"""Testing AvatarServiceRegistry migrates avatar settings for enabled gravatars"""
siteconfig = SiteConfiguration.objects.get_current()
self.assertFalse(siteconfig.get(AvatarServiceReg... | the_stack_v2_python_sparse | reviewboard/avatars/tests.py | parthyz/reviewboard | train | 1 |
d62d4c18df9988386f3b1707704a8185f361eae8 | [
"super().__init__(*args, **kwargs)\nself.device = device\nself.model = hub.Module(name=model_name)\nself.batch_size = batch_size\nself.traversal_paths = traversal_paths",
"if docs:\n document_batches_generator = get_docs_batch_generator(docs, traversal_path=parameters.get('traversal_paths', self.traversal_path... | <|body_start_0|>
super().__init__(*args, **kwargs)
self.device = device
self.model = hub.Module(name=model_name)
self.batch_size = batch_size
self.traversal_paths = traversal_paths
<|end_body_0|>
<|body_start_1|>
if docs:
document_batches_generator = get_docs... | Encode an array of string in size `B` into an ndarray in size `B x D` The ndarray potentially is BatchSize x (Channel x Height x Width) Internally, :class:`TextPaddlehubEncoder` wraps the Ernie module from paddlehub. https://github.com/PaddlePaddle/PaddleHub For models' details refer to https://www.paddlepaddle.org.cn/... | TextPaddleEncoder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TextPaddleEncoder:
"""Encode an array of string in size `B` into an ndarray in size `B x D` The ndarray potentially is BatchSize x (Channel x Height x Width) Internally, :class:`TextPaddlehubEncoder` wraps the Ernie module from paddlehub. https://github.com/PaddlePaddle/PaddleHub For models' deta... | stack_v2_sparse_classes_36k_train_024249 | 3,488 | permissive | [
{
"docstring": ":param model_name: the name of the model. Supported models include ``ernie``, ``ernie_tiny``, ``ernie_v2_eng_base``, ``ernie_v2_eng_large``, ``bert_chinese_L-12_H-768_A-12``, ``bert_multi_cased_L-12_H-768_A-12``, ``bert_multi_uncased_L-12_H-768_A-12``, ``bert_uncased_L-12_H-768_A-12``, ``bert_un... | 2 | stack_v2_sparse_classes_30k_train_012268 | Implement the Python class `TextPaddleEncoder` described below.
Class description:
Encode an array of string in size `B` into an ndarray in size `B x D` The ndarray potentially is BatchSize x (Channel x Height x Width) Internally, :class:`TextPaddlehubEncoder` wraps the Ernie module from paddlehub. https://github.com/... | Implement the Python class `TextPaddleEncoder` described below.
Class description:
Encode an array of string in size `B` into an ndarray in size `B x D` The ndarray potentially is BatchSize x (Channel x Height x Width) Internally, :class:`TextPaddlehubEncoder` wraps the Ernie module from paddlehub. https://github.com/... | 3b025b6106fca9dba3c2569b0e60da050273fa6e | <|skeleton|>
class TextPaddleEncoder:
"""Encode an array of string in size `B` into an ndarray in size `B x D` The ndarray potentially is BatchSize x (Channel x Height x Width) Internally, :class:`TextPaddlehubEncoder` wraps the Ernie module from paddlehub. https://github.com/PaddlePaddle/PaddleHub For models' deta... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TextPaddleEncoder:
"""Encode an array of string in size `B` into an ndarray in size `B x D` The ndarray potentially is BatchSize x (Channel x Height x Width) Internally, :class:`TextPaddlehubEncoder` wraps the Ernie module from paddlehub. https://github.com/PaddlePaddle/PaddleHub For models' details refer to ... | the_stack_v2_python_sparse | jinahub/encoders/text/TextPaddleEncoder/text_paddle.py | albertocarpentieri/executors | train | 0 |
5451e1ed5dab5e3d125841c52dd919d132efc88c | [
"self._attributeMapping = {}\nself._attributeMapping['hasComponentID'] = 'http://www.imi.kit.edu/abstract-pass-ont#hasModelComponentID'\nself._attributeMapping['hasAbstractVisualRepresentation'] = 'http://www.imi.kit.edu/abstract-pass-ont#hasAbstractVisualRepresentation'\nself._attributeMapping['label'] = 'http://w... | <|body_start_0|>
self._attributeMapping = {}
self._attributeMapping['hasComponentID'] = 'http://www.imi.kit.edu/abstract-pass-ont#hasModelComponentID'
self._attributeMapping['hasAbstractVisualRepresentation'] = 'http://www.imi.kit.edu/abstract-pass-ont#hasAbstractVisualRepresentation'
se... | Class that is responsible to represent a mapping between the attribute names an instance might have and their representation in rdfs (= their resource name). :version: 2015-12-04 :author: Lukas Block | AttributeMapper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttributeMapper:
"""Class that is responsible to represent a mapping between the attribute names an instance might have and their representation in rdfs (= their resource name). :version: 2015-12-04 :author: Lukas Block"""
def __init__(self):
"""Construcotr @return : @author"""
... | stack_v2_sparse_classes_36k_train_024250 | 5,116 | no_license | [
{
"docstring": "Construcotr @return : @author",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Returns the name of an attribute for a given uri (representing an attribute in rdfs). If this attribute uri is currently unknwon a new resource object is created, linking to t... | 3 | stack_v2_sparse_classes_30k_train_005025 | Implement the Python class `AttributeMapper` described below.
Class description:
Class that is responsible to represent a mapping between the attribute names an instance might have and their representation in rdfs (= their resource name). :version: 2015-12-04 :author: Lukas Block
Method signatures and docstrings:
- d... | Implement the Python class `AttributeMapper` described below.
Class description:
Class that is responsible to represent a mapping between the attribute names an instance might have and their representation in rdfs (= their resource name). :version: 2015-12-04 :author: Lukas Block
Method signatures and docstrings:
- d... | f7a0f19c5c697f0050db94e1aca669ea3d2f3d34 | <|skeleton|>
class AttributeMapper:
"""Class that is responsible to represent a mapping between the attribute names an instance might have and their representation in rdfs (= their resource name). :version: 2015-12-04 :author: Lukas Block"""
def __init__(self):
"""Construcotr @return : @author"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AttributeMapper:
"""Class that is responsible to represent a mapping between the attribute names an instance might have and their representation in rdfs (= their resource name). :version: 2015-12-04 :author: Lukas Block"""
def __init__(self):
"""Construcotr @return : @author"""
self._attr... | the_stack_v2_python_sparse | Model/PASS/AttributeMapper.py | uagnd/S-BPM_VR | train | 0 |
ac13a1650b5c3a580a75696bd1c28ff1a14c785c | [
"a = b = 1\nfor i in range(n - 1):\n temp = a + b\n a = b\n b = temp\nreturn b",
"if n == 1:\n return 1\nelif n == 2:\n return 2\nelse:\n return self.climbStairsRecursive(n - 1) + self.climbStairsRecursive(n - 2)"
] | <|body_start_0|>
a = b = 1
for i in range(n - 1):
temp = a + b
a = b
b = temp
return b
<|end_body_0|>
<|body_start_1|>
if n == 1:
return 1
elif n == 2:
return 2
else:
return self.climbStairsRecursive... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def climbStairs(self, n):
"""Returns total possible permutations to reach n using fibonacci approach :type n: int :rtype: int"""
<|body_0|>
def climbStairsRecursive(self, n):
"""Solves fibonacci sequence problem using recursion"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k_train_024251 | 813 | no_license | [
{
"docstring": "Returns total possible permutations to reach n using fibonacci approach :type n: int :rtype: int",
"name": "climbStairs",
"signature": "def climbStairs(self, n)"
},
{
"docstring": "Solves fibonacci sequence problem using recursion",
"name": "climbStairsRecursive",
"signat... | 2 | stack_v2_sparse_classes_30k_train_000860 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def climbStairs(self, n): Returns total possible permutations to reach n using fibonacci approach :type n: int :rtype: int
- def climbStairsRecursive(self, n): Solves fibonacci s... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def climbStairs(self, n): Returns total possible permutations to reach n using fibonacci approach :type n: int :rtype: int
- def climbStairsRecursive(self, n): Solves fibonacci s... | 308889e57e71c369aa8516fba8a2064f6a26abee | <|skeleton|>
class Solution:
def climbStairs(self, n):
"""Returns total possible permutations to reach n using fibonacci approach :type n: int :rtype: int"""
<|body_0|>
def climbStairsRecursive(self, n):
"""Solves fibonacci sequence problem using recursion"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def climbStairs(self, n):
"""Returns total possible permutations to reach n using fibonacci approach :type n: int :rtype: int"""
a = b = 1
for i in range(n - 1):
temp = a + b
a = b
b = temp
return b
def climbStairsRecursive(sel... | the_stack_v2_python_sparse | leet_70.py | mike-jolliffe/Learning | train | 0 | |
bf4d6e92f8f31c889040d1931fb2ec1d177c8099 | [
"self._env = Environment(undefined=StrictUndefined)\n\ndef _load_template(key, source):\n try:\n template = self._env.from_string(source)\n except TemplateSyntaxError as e:\n raise FieldTemplateSyntaxError('syntax error in template %r (source=%r)' % (key, source)) from e\n return template\nse... | <|body_start_0|>
self._env = Environment(undefined=StrictUndefined)
def _load_template(key, source):
try:
template = self._env.from_string(source)
except TemplateSyntaxError as e:
raise FieldTemplateSyntaxError('syntax error in template %r (source... | Render Jinja templates defined in app settings | FieldRenderer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FieldRenderer:
"""Render Jinja templates defined in app settings"""
def __init__(self, config: Dict[str, str]):
"""Prepare the field renderer, parsing all Jinja templates defined in `config`. :param config: dictionary, usually `settings.os2sync_templates`"""
<|body_0|>
d... | stack_v2_sparse_classes_36k_train_024252 | 5,256 | no_license | [
{
"docstring": "Prepare the field renderer, parsing all Jinja templates defined in `config`. :param config: dictionary, usually `settings.os2sync_templates`",
"name": "__init__",
"signature": "def __init__(self, config: Dict[str, str])"
},
{
"docstring": "Render a field template given by `key` u... | 2 | stack_v2_sparse_classes_30k_train_000508 | Implement the Python class `FieldRenderer` described below.
Class description:
Render Jinja templates defined in app settings
Method signatures and docstrings:
- def __init__(self, config: Dict[str, str]): Prepare the field renderer, parsing all Jinja templates defined in `config`. :param config: dictionary, usually ... | Implement the Python class `FieldRenderer` described below.
Class description:
Render Jinja templates defined in app settings
Method signatures and docstrings:
- def __init__(self, config: Dict[str, str]): Prepare the field renderer, parsing all Jinja templates defined in `config`. :param config: dictionary, usually ... | 541bc602873b6f592c3237b6270baa2c738bae46 | <|skeleton|>
class FieldRenderer:
"""Render Jinja templates defined in app settings"""
def __init__(self, config: Dict[str, str]):
"""Prepare the field renderer, parsing all Jinja templates defined in `config`. :param config: dictionary, usually `settings.os2sync_templates`"""
<|body_0|>
d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FieldRenderer:
"""Render Jinja templates defined in app settings"""
def __init__(self, config: Dict[str, str]):
"""Prepare the field renderer, parsing all Jinja templates defined in `config`. :param config: dictionary, usually `settings.os2sync_templates`"""
self._env = Environment(undefi... | the_stack_v2_python_sparse | exporters/os2sync_export/os2sync_export/templates.py | OS2mo/os2mo-data-import-and-export | train | 3 |
b435512200fc41b217e7b054e1cff06bf7f0eeed | [
"nums1[:m].extend(nums2[:n])\nnums1[:m] + nums2[:n]\nnums1.sort()",
"for i in range(n):\n nums1[m + i] = nums2[i]\nnums1.sort()"
] | <|body_start_0|>
nums1[:m].extend(nums2[:n])
nums1[:m] + nums2[:n]
nums1.sort()
<|end_body_0|>
<|body_start_1|>
for i in range(n):
nums1[m + i] = nums2[i]
nums1.sort()
<|end_body_1|>
| Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def merge1(self, nums1, m, nums2, n):
"""Do not return anything, modify nums1 in-place instead."""
<|body_0|>
def merge2(self, nums1, m, nums2, n):
"""Do not return anything, modify nums1 in-place instead."""
<|body_1|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_36k_train_024253 | 1,387 | no_license | [
{
"docstring": "Do not return anything, modify nums1 in-place instead.",
"name": "merge1",
"signature": "def merge1(self, nums1, m, nums2, n)"
},
{
"docstring": "Do not return anything, modify nums1 in-place instead.",
"name": "merge2",
"signature": "def merge2(self, nums1, m, nums2, n)"... | 2 | stack_v2_sparse_classes_30k_train_001070 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge1(self, nums1, m, nums2, n): Do not return anything, modify nums1 in-place instead.
- def merge2(self, nums1, m, nums2, n): Do not return anything, modify nums1 in-place... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def merge1(self, nums1, m, nums2, n): Do not return anything, modify nums1 in-place instead.
- def merge2(self, nums1, m, nums2, n): Do not return anything, modify nums1 in-place... | b8f705a77cfcdb7d498d3422f9c4ee88fd61a3b3 | <|skeleton|>
class Solution:
def merge1(self, nums1, m, nums2, n):
"""Do not return anything, modify nums1 in-place instead."""
<|body_0|>
def merge2(self, nums1, m, nums2, n):
"""Do not return anything, modify nums1 in-place instead."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def merge1(self, nums1, m, nums2, n):
"""Do not return anything, modify nums1 in-place instead."""
nums1[:m].extend(nums2[:n])
nums1[:m] + nums2[:n]
nums1.sort()
def merge2(self, nums1, m, nums2, n):
"""Do not return anything, modify nums1 in-place instea... | the_stack_v2_python_sparse | LeetcodePython/Base/算法面试题2018/1-4-合并两个有序数组.py | selonsy/leetcode | train | 0 | |
ffc0ed4e016f64c96fa25276766ba1c9a5c9fb08 | [
"self.client = pymongo.MongoClient(MONGO_URL)\nself.db = self.client[MONGO_DB]\nself.collection = self.db[MONGO_COLLECTION]\nself.auth = Xdaili().auth()\nself.chrome_options = webdriver.ChromeOptions()\nself.chrome_options.add_argument('--start-maximized')\nself.plugin_file = './utils/proxy_auth_plugin.zip'\nself.c... | <|body_start_0|>
self.client = pymongo.MongoClient(MONGO_URL)
self.db = self.client[MONGO_DB]
self.collection = self.db[MONGO_COLLECTION]
self.auth = Xdaili().auth()
self.chrome_options = webdriver.ChromeOptions()
self.chrome_options.add_argument('--start-maximized')
... | Products | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Products:
def __init__(self):
"""初始化"""
<|body_0|>
def index_page(self, page):
"""抓取索引页 :param page: 页码 :return:"""
<|body_1|>
def get_products(self):
"""提取商品数据"""
<|body_2|>
def save_to_mongo(self, result):
"""存储至数据库 :param ... | stack_v2_sparse_classes_36k_train_024254 | 3,760 | no_license | [
{
"docstring": "初始化",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "抓取索引页 :param page: 页码 :return:",
"name": "index_page",
"signature": "def index_page(self, page)"
},
{
"docstring": "提取商品数据",
"name": "get_products",
"signature": "def get_produc... | 5 | null | Implement the Python class `Products` described below.
Class description:
Implement the Products class.
Method signatures and docstrings:
- def __init__(self): 初始化
- def index_page(self, page): 抓取索引页 :param page: 页码 :return:
- def get_products(self): 提取商品数据
- def save_to_mongo(self, result): 存储至数据库 :param result: 抓取的... | Implement the Python class `Products` described below.
Class description:
Implement the Products class.
Method signatures and docstrings:
- def __init__(self): 初始化
- def index_page(self, page): 抓取索引页 :param page: 页码 :return:
- def get_products(self): 提取商品数据
- def save_to_mongo(self, result): 存储至数据库 :param result: 抓取的... | 87cbae60f7a5b033851b0056dff741a3d5980d06 | <|skeleton|>
class Products:
def __init__(self):
"""初始化"""
<|body_0|>
def index_page(self, page):
"""抓取索引页 :param page: 页码 :return:"""
<|body_1|>
def get_products(self):
"""提取商品数据"""
<|body_2|>
def save_to_mongo(self, result):
"""存储至数据库 :param ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Products:
def __init__(self):
"""初始化"""
self.client = pymongo.MongoClient(MONGO_URL)
self.db = self.client[MONGO_DB]
self.collection = self.db[MONGO_COLLECTION]
self.auth = Xdaili().auth()
self.chrome_options = webdriver.ChromeOptions()
self.chrome_optio... | the_stack_v2_python_sparse | 04-Selenium_Taobao/taobao.py | Northxw/Python3_WebSpider | train | 545 | |
16cb1897a1616d35c893648f4505291e4fab9736 | [
"res = [nums[0]]\nfor i in range(1, len(nums)):\n num = nums[i] + res[i - 1]\n res.append(num)\nreturn res",
"for i in range(1, len(nums)):\n nums[i] = nums[i - 1] + nums[i]\nreturn nums"
] | <|body_start_0|>
res = [nums[0]]
for i in range(1, len(nums)):
num = nums[i] + res[i - 1]
res.append(num)
return res
<|end_body_0|>
<|body_start_1|>
for i in range(1, len(nums)):
nums[i] = nums[i - 1] + nums[i]
return nums
<|end_body_1|>
| Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def runningSum(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def runningSum(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
res = [nums[0]]
for i in ra... | stack_v2_sparse_classes_36k_train_024255 | 560 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "runningSum",
"signature": "def runningSum(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "runningSum",
"signature": "def runningSum(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def runningSum(self, nums): :type nums: List[int] :rtype: List[int]
- def runningSum(self, nums): :type nums: List[int] :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def runningSum(self, nums): :type nums: List[int] :rtype: List[int]
- def runningSum(self, nums): :type nums: List[int] :rtype: List[int]
<|skeleton|>
class Solution:
def r... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def runningSum(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def runningSum(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def runningSum(self, nums):
""":type nums: List[int] :rtype: List[int]"""
res = [nums[0]]
for i in range(1, len(nums)):
num = nums[i] + res[i - 1]
res.append(num)
return res
def runningSum(self, nums):
""":type nums: List[int] :rty... | the_stack_v2_python_sparse | 1480_Running_Sum_of_1d_Array.py | bingli8802/leetcode | train | 0 | |
78e5409add72f1ae97417a4b3d4b401c9ddd9989 | [
"Frame.__init__(self, master)\nself.master.rowconfigure(0, weight=1)\nself.master.columnconfigure(0, weight=1)\nself.grid(sticky=N + S + E + W)\nl0 = Label(self, text='Email Database Search', font=('Helvetica', 16))\nl0.grid(row=0, column=1, columnspan=2)\nl1 = Label(self, text='Not Before (yyy-mm-dd):')\nl1.grid(r... | <|body_start_0|>
Frame.__init__(self, master)
self.master.rowconfigure(0, weight=1)
self.master.columnconfigure(0, weight=1)
self.grid(sticky=N + S + E + W)
l0 = Label(self, text='Email Database Search', font=('Helvetica', 16))
l0.grid(row=0, column=1, columnspan=2)
... | Create window app signature | Application | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Application:
"""Create window app signature"""
def __init__(self, master=None):
"""Establish the window structure, leaving some widgets accessible as app instance variables. Connect button clicks to search_mail method and subject double-clicks to display_mail method."""
<|bod... | stack_v2_sparse_classes_36k_train_024256 | 5,775 | no_license | [
{
"docstring": "Establish the window structure, leaving some widgets accessible as app instance variables. Connect button clicks to search_mail method and subject double-clicks to display_mail method.",
"name": "__init__",
"signature": "def __init__(self, master=None)"
},
{
"docstring": "Take th... | 3 | stack_v2_sparse_classes_30k_train_007915 | Implement the Python class `Application` described below.
Class description:
Create window app signature
Method signatures and docstrings:
- def __init__(self, master=None): Establish the window structure, leaving some widgets accessible as app instance variables. Connect button clicks to search_mail method and subje... | Implement the Python class `Application` described below.
Class description:
Create window app signature
Method signatures and docstrings:
- def __init__(self, master=None): Establish the window structure, leaving some widgets accessible as app instance variables. Connect button clicks to search_mail method and subje... | 06c45545ed064d0e9c4fd15cc81cf454cb079c9d | <|skeleton|>
class Application:
"""Create window app signature"""
def __init__(self, master=None):
"""Establish the window structure, leaving some widgets accessible as app instance variables. Connect button clicks to search_mail method and subject double-clicks to display_mail method."""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Application:
"""Create window app signature"""
def __init__(self, master=None):
"""Establish the window structure, leaving some widgets accessible as app instance variables. Connect button clicks to search_mail method and subject double-clicks to display_mail method."""
Frame.__init__(sel... | the_stack_v2_python_sparse | Lesson 13 - Email Search and Display/mailgui.py | jmwoloso/Python_2 | train | 0 |
72b346eeae68faa1e8a872a39f34d2c9edcec087 | [
"ret = 0\nseen = set()\nm, n = (len(grid), len(grid[0]))\ndirs = [(-1, 0), (1, 0), (0, -1), (0, 1)]\nfor i in range(m):\n for j in range(n):\n if (i, j) in seen or grid[i][j] == '0':\n continue\n ret += 1\n stack = [(i, j)]\n while stack:\n x, y = stack.pop()\n ... | <|body_start_0|>
ret = 0
seen = set()
m, n = (len(grid), len(grid[0]))
dirs = [(-1, 0), (1, 0), (0, -1), (0, 1)]
for i in range(m):
for j in range(n):
if (i, j) in seen or grid[i][j] == '0':
continue
ret += 1
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numIslands(self, grid: List[List[str]]) -> int:
"""Runtime: 375 ms, faster than 80.17% Memory Usage: 21.2 MB, less than 37.33% m == grid.length n == grid[i].length 1 <= m, n <= 300 grid[i][j] is '0' or '1'."""
<|body_0|>
def numIslands2(self, grid: List[List[st... | stack_v2_sparse_classes_36k_train_024257 | 5,764 | permissive | [
{
"docstring": "Runtime: 375 ms, faster than 80.17% Memory Usage: 21.2 MB, less than 37.33% m == grid.length n == grid[i].length 1 <= m, n <= 300 grid[i][j] is '0' or '1'.",
"name": "numIslands",
"signature": "def numIslands(self, grid: List[List[str]]) -> int"
},
{
"docstring": "2019/11/22 :par... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numIslands(self, grid: List[List[str]]) -> int: Runtime: 375 ms, faster than 80.17% Memory Usage: 21.2 MB, less than 37.33% m == grid.length n == grid[i].length 1 <= m, n <= ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numIslands(self, grid: List[List[str]]) -> int: Runtime: 375 ms, faster than 80.17% Memory Usage: 21.2 MB, less than 37.33% m == grid.length n == grid[i].length 1 <= m, n <= ... | 4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5 | <|skeleton|>
class Solution:
def numIslands(self, grid: List[List[str]]) -> int:
"""Runtime: 375 ms, faster than 80.17% Memory Usage: 21.2 MB, less than 37.33% m == grid.length n == grid[i].length 1 <= m, n <= 300 grid[i][j] is '0' or '1'."""
<|body_0|>
def numIslands2(self, grid: List[List[st... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numIslands(self, grid: List[List[str]]) -> int:
"""Runtime: 375 ms, faster than 80.17% Memory Usage: 21.2 MB, less than 37.33% m == grid.length n == grid[i].length 1 <= m, n <= 300 grid[i][j] is '0' or '1'."""
ret = 0
seen = set()
m, n = (len(grid), len(grid[0]))
... | the_stack_v2_python_sparse | src/200-NumberOfIslands.py | Jiezhi/myleetcode | train | 1 | |
516737dca3465c39b1d0c27f9d564a28f7a6218e | [
"cls.region1_model_alias = 'swift_gr_region1'\ncls.region1_proxy_app = 'swift-proxy-region1'\ncls.region2_model_alias = 'swift_gr_region2'\ncls.region2_proxy_app = 'swift-proxy-region2'\nsuper(SwiftGlobalReplicationTests, cls).setUpClass(application_name=cls.region1_proxy_app, model_alias=cls.region1_model_alias)\n... | <|body_start_0|>
cls.region1_model_alias = 'swift_gr_region1'
cls.region1_proxy_app = 'swift-proxy-region1'
cls.region2_model_alias = 'swift_gr_region2'
cls.region2_proxy_app = 'swift-proxy-region2'
super(SwiftGlobalReplicationTests, cls).setUpClass(application_name=cls.region1_p... | Test swift global replication. | SwiftGlobalReplicationTests | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SwiftGlobalReplicationTests:
"""Test swift global replication."""
def setUpClass(cls):
"""Run class setup for running tests."""
<|body_0|>
def tearDown(cls):
"""Remove test resources. The retry decorator is needed as it is luck of the draw as to whether a delete ... | stack_v2_sparse_classes_36k_train_024258 | 19,089 | permissive | [
{
"docstring": "Run class setup for running tests.",
"name": "setUpClass",
"signature": "def setUpClass(cls)"
},
{
"docstring": "Remove test resources. The retry decorator is needed as it is luck of the draw as to whether a delete of a newly created container will result in a 404. Retrying will ... | 4 | stack_v2_sparse_classes_30k_train_013589 | Implement the Python class `SwiftGlobalReplicationTests` described below.
Class description:
Test swift global replication.
Method signatures and docstrings:
- def setUpClass(cls): Run class setup for running tests.
- def tearDown(cls): Remove test resources. The retry decorator is needed as it is luck of the draw as... | Implement the Python class `SwiftGlobalReplicationTests` described below.
Class description:
Test swift global replication.
Method signatures and docstrings:
- def setUpClass(cls): Run class setup for running tests.
- def tearDown(cls): Remove test resources. The retry decorator is needed as it is luck of the draw as... | 3b17ad9d97c57b6e62797d4e3333e4b83e43a447 | <|skeleton|>
class SwiftGlobalReplicationTests:
"""Test swift global replication."""
def setUpClass(cls):
"""Run class setup for running tests."""
<|body_0|>
def tearDown(cls):
"""Remove test resources. The retry decorator is needed as it is luck of the draw as to whether a delete ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SwiftGlobalReplicationTests:
"""Test swift global replication."""
def setUpClass(cls):
"""Run class setup for running tests."""
cls.region1_model_alias = 'swift_gr_region1'
cls.region1_proxy_app = 'swift-proxy-region1'
cls.region2_model_alias = 'swift_gr_region2'
c... | the_stack_v2_python_sparse | zaza/openstack/charm_tests/swift/tests.py | openstack-charmers/zaza-openstack-tests | train | 7 |
1c05d5dd69457efb6a1c87e302cdbb248b365310 | [
"def add_coor(a, b):\n ans = 0\n while a != 0:\n ans += a % 10\n a //= 10\n while b != 0:\n ans += b % 10\n b //= 10\n return ans\nfrom collections import deque\nmat = [[0 for _ in range(n)] for _ in range(m)]\nmat[0][0] = 1\ntemp = deque()\ntemp.append([0, 0])\nres = 0\nwhil... | <|body_start_0|>
def add_coor(a, b):
ans = 0
while a != 0:
ans += a % 10
a //= 10
while b != 0:
ans += b % 10
b //= 10
return ans
from collections import deque
mat = [[0 for _ in range... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def movingCount(self, m: int, n: int, k: int) -> int:
"""思路:BFS经典模板 :param m: :param n: :param k: :return:"""
<|body_0|>
def movingCount2(self, m: int, n: int, k: int) -> int:
"""思路:遍历矩阵 :param m: :param n: :param k: :return:"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k_train_024259 | 4,151 | no_license | [
{
"docstring": "思路:BFS经典模板 :param m: :param n: :param k: :return:",
"name": "movingCount",
"signature": "def movingCount(self, m: int, n: int, k: int) -> int"
},
{
"docstring": "思路:遍历矩阵 :param m: :param n: :param k: :return:",
"name": "movingCount2",
"signature": "def movingCount2(self, ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def movingCount(self, m: int, n: int, k: int) -> int: 思路:BFS经典模板 :param m: :param n: :param k: :return:
- def movingCount2(self, m: int, n: int, k: int) -> int: 思路:遍历矩阵 :param m:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def movingCount(self, m: int, n: int, k: int) -> int: 思路:BFS经典模板 :param m: :param n: :param k: :return:
- def movingCount2(self, m: int, n: int, k: int) -> int: 思路:遍历矩阵 :param m:... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def movingCount(self, m: int, n: int, k: int) -> int:
"""思路:BFS经典模板 :param m: :param n: :param k: :return:"""
<|body_0|>
def movingCount2(self, m: int, n: int, k: int) -> int:
"""思路:遍历矩阵 :param m: :param n: :param k: :return:"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def movingCount(self, m: int, n: int, k: int) -> int:
"""思路:BFS经典模板 :param m: :param n: :param k: :return:"""
def add_coor(a, b):
ans = 0
while a != 0:
ans += a % 10
a //= 10
while b != 0:
ans += b % ... | the_stack_v2_python_sparse | LeetCode/1033. Moving Stones Until Consecutive.py | yiming1012/MyLeetCode | train | 2 | |
91210c5da7156e45737948ff98529d247ed0b3bb | [
"if cls.__singleton == None:\n cls.__singleton = super(ESMPControl, cls).__new__(cls)\n cls.__singleton.__esmp_initialized = False\n cls.__singleton.__esmp_finalized = False\nreturn cls.__singleton",
"if self.__esmp_finalized:\n return False\nif not self.__esmp_initialized:\n ESMP.ESMP_Initialize()... | <|body_start_0|>
if cls.__singleton == None:
cls.__singleton = super(ESMPControl, cls).__new__(cls)
cls.__singleton.__esmp_initialized = False
cls.__singleton.__esmp_finalized = False
return cls.__singleton
<|end_body_0|>
<|body_start_1|>
if self.__esmp_final... | This singleton class and its pair of methods startCheckESMP and stopESMP are designed to called ESMP.ESMP_Initialize and ESMP.ESMP_Finalize once, and only once, in a Python session. When ESMP is initialized in the first call to startCheckESMP, stopESMP is registered with atexit to ensure ESMP is always finalized prior ... | ESMPControl | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ESMPControl:
"""This singleton class and its pair of methods startCheckESMP and stopESMP are designed to called ESMP.ESMP_Initialize and ESMP.ESMP_Finalize once, and only once, in a Python session. When ESMP is initialized in the first call to startCheckESMP, stopESMP is registered with atexit to... | stack_v2_sparse_classes_36k_train_024260 | 3,730 | permissive | [
{
"docstring": "Returns the singleton instance of this class, creating it if it does not already exist.",
"name": "__new__",
"signature": "def __new__(cls)"
},
{
"docstring": "Calls ESMP.ESMP_Initialize and registers stopESMP with atexit when called the first time. Subsequent calls only return w... | 3 | stack_v2_sparse_classes_30k_train_008667 | Implement the Python class `ESMPControl` described below.
Class description:
This singleton class and its pair of methods startCheckESMP and stopESMP are designed to called ESMP.ESMP_Initialize and ESMP.ESMP_Finalize once, and only once, in a Python session. When ESMP is initialized in the first call to startCheckESMP... | Implement the Python class `ESMPControl` described below.
Class description:
This singleton class and its pair of methods startCheckESMP and stopESMP are designed to called ESMP.ESMP_Initialize and ESMP.ESMP_Finalize once, and only once, in a Python session. When ESMP is initialized in the first call to startCheckESMP... | f21d878c776286ee333a44b99e0b31ad53d8917a | <|skeleton|>
class ESMPControl:
"""This singleton class and its pair of methods startCheckESMP and stopESMP are designed to called ESMP.ESMP_Initialize and ESMP.ESMP_Finalize once, and only once, in a Python session. When ESMP is initialized in the first call to startCheckESMP, stopESMP is registered with atexit to... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ESMPControl:
"""This singleton class and its pair of methods startCheckESMP and stopESMP are designed to called ESMP.ESMP_Initialize and ESMP.ESMP_Finalize once, and only once, in a Python session. When ESMP is initialized in the first call to startCheckESMP, stopESMP is registered with atexit to ensure ESMP ... | the_stack_v2_python_sparse | pyfermod/regrid/esmpcontrol.py | NOAA-PMEL/PyFerret | train | 61 |
aaf1e2b67f441c8eb011740fc87b57aa2040bd47 | [
"if not value:\n return []\nreturn [v.strip() for v in value.splitlines() if v != '']",
"super(MultiEmailField, self).validate(value)\ntry:\n for email in value:\n validate_email(email)\nexcept ValidationError:\n raise ValidationError(self.message, code=self.code)"
] | <|body_start_0|>
if not value:
return []
return [v.strip() for v in value.splitlines() if v != '']
<|end_body_0|>
<|body_start_1|>
super(MultiEmailField, self).validate(value)
try:
for email in value:
validate_email(email)
except Validatio... | Email field for multiple emails | MultiEmailField | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiEmailField:
"""Email field for multiple emails"""
def to_python(self, value):
"""Normalize data to a list of strings."""
<|body_0|>
def validate(self, value):
"""Check if value consists only of valid emails."""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_36k_train_024261 | 1,071 | permissive | [
{
"docstring": "Normalize data to a list of strings.",
"name": "to_python",
"signature": "def to_python(self, value)"
},
{
"docstring": "Check if value consists only of valid emails.",
"name": "validate",
"signature": "def validate(self, value)"
}
] | 2 | null | Implement the Python class `MultiEmailField` described below.
Class description:
Email field for multiple emails
Method signatures and docstrings:
- def to_python(self, value): Normalize data to a list of strings.
- def validate(self, value): Check if value consists only of valid emails. | Implement the Python class `MultiEmailField` described below.
Class description:
Email field for multiple emails
Method signatures and docstrings:
- def to_python(self, value): Normalize data to a list of strings.
- def validate(self, value): Check if value consists only of valid emails.
<|skeleton|>
class MultiEmai... | 2305b1e27abb0bfe9fcee93b79e012c62cba712e | <|skeleton|>
class MultiEmailField:
"""Email field for multiple emails"""
def to_python(self, value):
"""Normalize data to a list of strings."""
<|body_0|>
def validate(self, value):
"""Check if value consists only of valid emails."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiEmailField:
"""Email field for multiple emails"""
def to_python(self, value):
"""Normalize data to a list of strings."""
if not value:
return []
return [v.strip() for v in value.splitlines() if v != '']
def validate(self, value):
"""Check if value con... | the_stack_v2_python_sparse | supervisr/mail/fields.py | BeryJu/supervisr | train | 1 |
fa62841e4604253c52f91eca580932b0c672c690 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn File()",
"from .hashes import Hashes\nfrom .hashes import Hashes\nfields: Dict[str, Callable[[Any], None]] = {'hashes': lambda n: setattr(self, 'hashes', n.get_object_value(Hashes)), 'mimeType': lambda n: setattr(self, 'mime_type', n.g... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return File()
<|end_body_0|>
<|body_start_1|>
from .hashes import Hashes
from .hashes import Hashes
fields: Dict[str, Callable[[Any], None]] = {'hashes': lambda n: setattr(self, 'hashes... | File | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class File:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> File:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: File"""
... | stack_v2_sparse_classes_36k_train_024262 | 3,158 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: File",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(parse_no... | 3 | stack_v2_sparse_classes_30k_train_008769 | Implement the Python class `File` described below.
Class description:
Implement the File class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> File: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars... | Implement the Python class `File` described below.
Class description:
Implement the File class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> File: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class File:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> File:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: File"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class File:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> File:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: File"""
if not parse_n... | the_stack_v2_python_sparse | msgraph/generated/models/file.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
3754a6e4494d969e7f3752cdcea9812fb7fa602e | [
"def doit(node):\n if node:\n vals.append(node.val)\n doit(node.left)\n doit(node.right)\n else:\n vals.append('#')\nvals = []\ndoit(root)\nreturn vals",
"def doit():\n val = next(vals)\n if val == '#':\n return None\n else:\n node = TreeNode(val)\n ... | <|body_start_0|>
def doit(node):
if node:
vals.append(node.val)
doit(node.left)
doit(node.right)
else:
vals.append('#')
vals = []
doit(root)
return vals
<|end_body_0|>
<|body_start_1|>
def do... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_024263 | 3,461 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | d2e0fb4a55003d5c230fb8b2e13ac8b224b47a75 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def doit(node):
if node:
vals.append(node.val)
doit(node.left)
doit(node.right)
else:
vals.append(... | the_stack_v2_python_sparse | 449-serializeDeserialize.py | sunshinewxz/leetcode | train | 0 | |
21f191cba3deb7a7f40ed3829472c1ef520994d4 | [
"days = len(prices)\nif days <= 1:\n return 0\nleft_min, right_max = (prices[0], prices[-1])\nleft_profits = [0] * days\nright_profits = [0] * (days + 1)\nfor left in range(1, days):\n left_profits[left] = max(left_profits[left - 1], prices[left] - left_min)\n left_min = min(left_min, prices[left])\n ri... | <|body_start_0|>
days = len(prices)
if days <= 1:
return 0
left_min, right_max = (prices[0], prices[-1])
left_profits = [0] * days
right_profits = [0] * (days + 1)
for left in range(1, days):
left_profits[left] = max(left_profits[left - 1], prices[... | Stock | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Stock:
def get_max_profit_(self, prices: List[int]) -> int:
"""Approach: Bi - directional DP Time Complexity: O(N) Space Complexity: O(N) :param prices: :return:"""
<|body_0|>
def get_max_profit(self, prices: List[int]) -> int:
"""Approach: One Pass Simulation Time C... | stack_v2_sparse_classes_36k_train_024264 | 1,877 | no_license | [
{
"docstring": "Approach: Bi - directional DP Time Complexity: O(N) Space Complexity: O(N) :param prices: :return:",
"name": "get_max_profit_",
"signature": "def get_max_profit_(self, prices: List[int]) -> int"
},
{
"docstring": "Approach: One Pass Simulation Time Complexity: O(N) Space Complexi... | 2 | null | Implement the Python class `Stock` described below.
Class description:
Implement the Stock class.
Method signatures and docstrings:
- def get_max_profit_(self, prices: List[int]) -> int: Approach: Bi - directional DP Time Complexity: O(N) Space Complexity: O(N) :param prices: :return:
- def get_max_profit(self, price... | Implement the Python class `Stock` described below.
Class description:
Implement the Stock class.
Method signatures and docstrings:
- def get_max_profit_(self, prices: List[int]) -> int: Approach: Bi - directional DP Time Complexity: O(N) Space Complexity: O(N) :param prices: :return:
- def get_max_profit(self, price... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class Stock:
def get_max_profit_(self, prices: List[int]) -> int:
"""Approach: Bi - directional DP Time Complexity: O(N) Space Complexity: O(N) :param prices: :return:"""
<|body_0|>
def get_max_profit(self, prices: List[int]) -> int:
"""Approach: One Pass Simulation Time C... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Stock:
def get_max_profit_(self, prices: List[int]) -> int:
"""Approach: Bi - directional DP Time Complexity: O(N) Space Complexity: O(N) :param prices: :return:"""
days = len(prices)
if days <= 1:
return 0
left_min, right_max = (prices[0], prices[-1])
left_... | the_stack_v2_python_sparse | revisited/math_and_strings/buy_stock/best_time_to_buy_stock_iii.py | Shiv2157k/leet_code | train | 1 | |
90670456b35159026496482e1431e500b987f8be | [
"binary_map = {c: pow(2, i) for i, c in enumerate('abcdefghijklmnopqrstuvwxyz')}\nrep_length = {}\nfor w in words:\n rep = sum((binary_map[c] for c in set(w)))\n rep_length[rep] = max(rep_length.get(rep, 0), len(w))\nm = 0\nkeys = list(rep_length.keys())\nfor i in range(len(keys)):\n for j in range(i + 1, ... | <|body_start_0|>
binary_map = {c: pow(2, i) for i, c in enumerate('abcdefghijklmnopqrstuvwxyz')}
rep_length = {}
for w in words:
rep = sum((binary_map[c] for c in set(w)))
rep_length[rep] = max(rep_length.get(rep, 0), len(w))
m = 0
keys = list(rep_length.k... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProduct(self, words: List[str]) -> int:
"""12/28/2019 14:58"""
<|body_0|>
def maxProduct(self, words: List[str]) -> int:
"""06/08/2021 05:20 Time complexity: O(n*n + n*l) Space complexity: O(n)"""
<|body_1|>
def maxProduct(self, words: L... | stack_v2_sparse_classes_36k_train_024265 | 3,026 | no_license | [
{
"docstring": "12/28/2019 14:58",
"name": "maxProduct",
"signature": "def maxProduct(self, words: List[str]) -> int"
},
{
"docstring": "06/08/2021 05:20 Time complexity: O(n*n + n*l) Space complexity: O(n)",
"name": "maxProduct",
"signature": "def maxProduct(self, words: List[str]) -> i... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProduct(self, words: List[str]) -> int: 12/28/2019 14:58
- def maxProduct(self, words: List[str]) -> int: 06/08/2021 05:20 Time complexity: O(n*n + n*l) Space complexity: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProduct(self, words: List[str]) -> int: 12/28/2019 14:58
- def maxProduct(self, words: List[str]) -> int: 06/08/2021 05:20 Time complexity: O(n*n + n*l) Space complexity: ... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def maxProduct(self, words: List[str]) -> int:
"""12/28/2019 14:58"""
<|body_0|>
def maxProduct(self, words: List[str]) -> int:
"""06/08/2021 05:20 Time complexity: O(n*n + n*l) Space complexity: O(n)"""
<|body_1|>
def maxProduct(self, words: L... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProduct(self, words: List[str]) -> int:
"""12/28/2019 14:58"""
binary_map = {c: pow(2, i) for i, c in enumerate('abcdefghijklmnopqrstuvwxyz')}
rep_length = {}
for w in words:
rep = sum((binary_map[c] for c in set(w)))
rep_length[rep] = m... | the_stack_v2_python_sparse | leetcode/solved/318_Maximum_Product_of_Word_Lengths/solution.py | sungminoh/algorithms | train | 0 | |
660cc7d201ffd14dfd1292863cfccb7ae88b2d25 | [
"res = []\n\ndef helper(root):\n if not root:\n return\n res.append(root.val)\n helper(root.left)\n helper(root.right)\nhelper(root)\nreturn res",
"if root is None:\n return []\nstack = [root]\nans = []\nwhile stack:\n tail = stack.pop()\n ans.append(tail.val)\n if tail.right:\n ... | <|body_start_0|>
res = []
def helper(root):
if not root:
return
res.append(root.val)
helper(root.left)
helper(root.right)
helper(root)
return res
<|end_body_0|>
<|body_start_1|>
if root is None:
return ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def preorderTraversal(self, root: TreeNode) -> List[int]:
"""递归"""
<|body_0|>
def preorderTraversal1(self, root: TreeNode) -> List[int]:
"""迭代"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
res = []
def helper(root):
... | stack_v2_sparse_classes_36k_train_024266 | 1,331 | no_license | [
{
"docstring": "递归",
"name": "preorderTraversal",
"signature": "def preorderTraversal(self, root: TreeNode) -> List[int]"
},
{
"docstring": "迭代",
"name": "preorderTraversal1",
"signature": "def preorderTraversal1(self, root: TreeNode) -> List[int]"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def preorderTraversal(self, root: TreeNode) -> List[int]: 递归
- def preorderTraversal1(self, root: TreeNode) -> List[int]: 迭代 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def preorderTraversal(self, root: TreeNode) -> List[int]: 递归
- def preorderTraversal1(self, root: TreeNode) -> List[int]: 迭代
<|skeleton|>
class Solution:
def preorderTraver... | 40726506802d2d60028fdce206696b1df2f63ece | <|skeleton|>
class Solution:
def preorderTraversal(self, root: TreeNode) -> List[int]:
"""递归"""
<|body_0|>
def preorderTraversal1(self, root: TreeNode) -> List[int]:
"""迭代"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def preorderTraversal(self, root: TreeNode) -> List[int]:
"""递归"""
res = []
def helper(root):
if not root:
return
res.append(root.val)
helper(root.left)
helper(root.right)
helper(root)
return res... | the_stack_v2_python_sparse | 二刷+题解/树/preorderTraversal.py | 1oser5/LeetCode | train | 0 | |
919f38b4ae8c468d533312f6e7077cc19dc6fa1b | [
"try:\n state = self.add_model_schema.load(request.json)\n key = CreateDashboardPermalinkCommand(dashboard_id=pk, state=state).run()\n http_origin = request.headers.environ.get('HTTP_ORIGIN')\n url = f'{http_origin}/superset/dashboard/p/{key}/'\n return self.response(201, key=key, url=url)\nexcept (V... | <|body_start_0|>
try:
state = self.add_model_schema.load(request.json)
key = CreateDashboardPermalinkCommand(dashboard_id=pk, state=state).run()
http_origin = request.headers.environ.get('HTTP_ORIGIN')
url = f'{http_origin}/superset/dashboard/p/{key}/'
... | DashboardPermalinkRestApi | [
"Apache-2.0",
"OFL-1.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DashboardPermalinkRestApi:
def post(self, pk: str) -> Response:
"""Stores a new permanent link. --- post: description: >- Stores a new permanent link. parameters: - in: path schema: type: string name: pk requestBody: required: true content: application/json: schema: $ref: '#/components/s... | stack_v2_sparse_classes_36k_train_024267 | 6,224 | permissive | [
{
"docstring": "Stores a new permanent link. --- post: description: >- Stores a new permanent link. parameters: - in: path schema: type: string name: pk requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/DashboardPermalinkPostSchema' responses: 201: description: The perma... | 2 | stack_v2_sparse_classes_30k_train_000249 | Implement the Python class `DashboardPermalinkRestApi` described below.
Class description:
Implement the DashboardPermalinkRestApi class.
Method signatures and docstrings:
- def post(self, pk: str) -> Response: Stores a new permanent link. --- post: description: >- Stores a new permanent link. parameters: - in: path ... | Implement the Python class `DashboardPermalinkRestApi` described below.
Class description:
Implement the DashboardPermalinkRestApi class.
Method signatures and docstrings:
- def post(self, pk: str) -> Response: Stores a new permanent link. --- post: description: >- Stores a new permanent link. parameters: - in: path ... | 0945d4a2f46667aebb9b93d0d7685215627ad237 | <|skeleton|>
class DashboardPermalinkRestApi:
def post(self, pk: str) -> Response:
"""Stores a new permanent link. --- post: description: >- Stores a new permanent link. parameters: - in: path schema: type: string name: pk requestBody: required: true content: application/json: schema: $ref: '#/components/s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DashboardPermalinkRestApi:
def post(self, pk: str) -> Response:
"""Stores a new permanent link. --- post: description: >- Stores a new permanent link. parameters: - in: path schema: type: string name: pk requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Dashboa... | the_stack_v2_python_sparse | superset/dashboards/permalink/api.py | apache-superset/incubator-superset | train | 21 | |
6a8ac9adc532b0c7a82290e2195c0db8d55694a7 | [
"sceneopts.SceneOpts.__init__(self, *args, **kwargs)\nself.zax = 2\nself.setAttribute('zax', 'default', 2)\nself.setAttribute('zoom', 'minval', 10)\nself.setAttribute('zoom', 'maxval', 1000)",
"if self.performance == 3:\n self.renderMode = 'onscreen'\nelif self.performance == 2:\n self.renderMode = 'prerend... | <|body_start_0|>
sceneopts.SceneOpts.__init__(self, *args, **kwargs)
self.zax = 2
self.setAttribute('zax', 'default', 2)
self.setAttribute('zoom', 'minval', 10)
self.setAttribute('zoom', 'maxval', 1000)
<|end_body_0|>
<|body_start_1|>
if self.performance == 3:
... | The ``LightBoxOpts`` class contains display settings for the :class:`.LightBoxPanel` class. All of the properties in the ``LightBoxOpts`` class are defined in the :class:`.LightBoxCanvasOpts` class - see its documentation for more details. | LightBoxOpts | [
"BSD-3-Clause",
"CC-BY-3.0",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LightBoxOpts:
"""The ``LightBoxOpts`` class contains display settings for the :class:`.LightBoxPanel` class. All of the properties in the ``LightBoxOpts`` class are defined in the :class:`.LightBoxCanvasOpts` class - see its documentation for more details."""
def __init__(self, *args, **kwar... | stack_v2_sparse_classes_36k_train_024268 | 2,458 | permissive | [
{
"docstring": "Create a ``LightBoxOpts`` instance. All arguments are passed through to the :class:`.SceneOpts` constructor. The :attr:`.SceneOpts.zoom` attribute is modified, as :class:`LightBoxPanel` uses it slightly differently to the :class:`OrthoPanel`.",
"name": "__init__",
"signature": "def __ini... | 2 | null | Implement the Python class `LightBoxOpts` described below.
Class description:
The ``LightBoxOpts`` class contains display settings for the :class:`.LightBoxPanel` class. All of the properties in the ``LightBoxOpts`` class are defined in the :class:`.LightBoxCanvasOpts` class - see its documentation for more details.
... | Implement the Python class `LightBoxOpts` described below.
Class description:
The ``LightBoxOpts`` class contains display settings for the :class:`.LightBoxPanel` class. All of the properties in the ``LightBoxOpts`` class are defined in the :class:`.LightBoxCanvasOpts` class - see its documentation for more details.
... | 46ccb4fe2b2346eb57576247f49714032b61307a | <|skeleton|>
class LightBoxOpts:
"""The ``LightBoxOpts`` class contains display settings for the :class:`.LightBoxPanel` class. All of the properties in the ``LightBoxOpts`` class are defined in the :class:`.LightBoxCanvasOpts` class - see its documentation for more details."""
def __init__(self, *args, **kwar... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LightBoxOpts:
"""The ``LightBoxOpts`` class contains display settings for the :class:`.LightBoxPanel` class. All of the properties in the ``LightBoxOpts`` class are defined in the :class:`.LightBoxCanvasOpts` class - see its documentation for more details."""
def __init__(self, *args, **kwargs):
... | the_stack_v2_python_sparse | fsleyes/displaycontext/lightboxopts.py | sanjayankur31/fsleyes | train | 1 |
4ee36d78578dbfcc28fdb6601e088ea0fefc4fc7 | [
"super(ActorModel, self).__init__()\nself.params = params\nself.fc1 = nn.Linear(self.params['state_size'], self.params['hidden_size'])\nself.fc1.weight.data = fanin_init(self.fc1.weight.data)\nself.fc2 = nn.Linear(self.params['hidden_size'], self.params['hidden_size'])\nself.fc2.weight.data = fanin_init(self.fc2.we... | <|body_start_0|>
super(ActorModel, self).__init__()
self.params = params
self.fc1 = nn.Linear(self.params['state_size'], self.params['hidden_size'])
self.fc1.weight.data = fanin_init(self.fc1.weight.data)
self.fc2 = nn.Linear(self.params['hidden_size'], self.params['hidden_size']... | ActorModel | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActorModel:
def __init__(self, **params):
"""Provides the policy function :math:`a=\\pi(s)`. Args: state_size (int): Dimension of input state action_size (int): Dimension of output action (int) action_gain (float): Used to scale the output action. The output action range will be in ``[-a... | stack_v2_sparse_classes_36k_train_024269 | 7,544 | permissive | [
{
"docstring": "Provides the policy function :math:`a=\\\\pi(s)`. Args: state_size (int): Dimension of input state action_size (int): Dimension of output action (int) action_gain (float): Used to scale the output action. The output action range will be in ``[-action_gain,+action_gain]``. eps: A constant used in... | 2 | stack_v2_sparse_classes_30k_test_000169 | Implement the Python class `ActorModel` described below.
Class description:
Implement the ActorModel class.
Method signatures and docstrings:
- def __init__(self, **params): Provides the policy function :math:`a=\\pi(s)`. Args: state_size (int): Dimension of input state action_size (int): Dimension of output action (... | Implement the Python class `ActorModel` described below.
Class description:
Implement the ActorModel class.
Method signatures and docstrings:
- def __init__(self, **params): Provides the policy function :math:`a=\\pi(s)`. Args: state_size (int): Dimension of input state action_size (int): Dimension of output action (... | e42f10a58cec6cab70ac2be5ce3af6102caefd81 | <|skeleton|>
class ActorModel:
def __init__(self, **params):
"""Provides the policy function :math:`a=\\pi(s)`. Args: state_size (int): Dimension of input state action_size (int): Dimension of output action (int) action_gain (float): Used to scale the output action. The output action range will be in ``[-a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ActorModel:
def __init__(self, **params):
"""Provides the policy function :math:`a=\\pi(s)`. Args: state_size (int): Dimension of input state action_size (int): Dimension of output action (int) action_gain (float): Used to scale the output action. The output action range will be in ``[-action_gain,+ac... | the_stack_v2_python_sparse | digideep/agent/ddpg/policy.py | sharif1093/digideep | train | 17 | |
1787f634c00762e18ee3fa6f23ada49cc6f02e3f | [
"clear_db()\ntest_import = import_data('csv_files', 'product_file.csv', 'customer_file.csv', 'rental_file.csv')\nself.assertEqual(test_import, [(4, 2, 2), (0, 0, 0)])",
"clear_db()\ntest_import = import_data('csv_files', 'nofile1.csv', 'nofile2.csv', 'nofile3.csv')\nself.assertEqual(test_import, [(0, 0, 0), (1, 1... | <|body_start_0|>
clear_db()
test_import = import_data('csv_files', 'product_file.csv', 'customer_file.csv', 'rental_file.csv')
self.assertEqual(test_import, [(4, 2, 2), (0, 0, 0)])
<|end_body_0|>
<|body_start_1|>
clear_db()
test_import = import_data('csv_files', 'nofile1.csv', '... | tests for basic operations | MongoDBTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MongoDBTest:
"""tests for basic operations"""
def test_import_data(self):
"""tests csv files are imported correctly with correct tuples being returned"""
<|body_0|>
def test_import_data_failure(self):
"""tests exception handing on import data function"""
... | stack_v2_sparse_classes_36k_train_024270 | 2,469 | no_license | [
{
"docstring": "tests csv files are imported correctly with correct tuples being returned",
"name": "test_import_data",
"signature": "def test_import_data(self)"
},
{
"docstring": "tests exception handing on import data function",
"name": "test_import_data_failure",
"signature": "def tes... | 4 | null | Implement the Python class `MongoDBTest` described below.
Class description:
tests for basic operations
Method signatures and docstrings:
- def test_import_data(self): tests csv files are imported correctly with correct tuples being returned
- def test_import_data_failure(self): tests exception handing on import data... | Implement the Python class `MongoDBTest` described below.
Class description:
tests for basic operations
Method signatures and docstrings:
- def test_import_data(self): tests csv files are imported correctly with correct tuples being returned
- def test_import_data_failure(self): tests exception handing on import data... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class MongoDBTest:
"""tests for basic operations"""
def test_import_data(self):
"""tests csv files are imported correctly with correct tuples being returned"""
<|body_0|>
def test_import_data_failure(self):
"""tests exception handing on import data function"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MongoDBTest:
"""tests for basic operations"""
def test_import_data(self):
"""tests csv files are imported correctly with correct tuples being returned"""
clear_db()
test_import = import_data('csv_files', 'product_file.csv', 'customer_file.csv', 'rental_file.csv')
self.asse... | the_stack_v2_python_sparse | students/zach_thomson/lesson09/test_database.py | JavaRod/SP_Python220B_2019 | train | 1 |
77a05df04ddd22f5c609b32ceda10e6d7b02046a | [
"user = User.objects.create(username='testuser', password='qwerty12345Q!')\nrecruiter = User.objects.create(username='recruiter3', first_name='first_recruiter', last_name='last_recruiter', email='recruiter@mail.com')\ncandidate = User.objects.create(username='candidate3', first_name='first_candidate', last_name='la... | <|body_start_0|>
user = User.objects.create(username='testuser', password='qwerty12345Q!')
recruiter = User.objects.create(username='recruiter3', first_name='first_recruiter', last_name='last_recruiter', email='recruiter@mail.com')
candidate = User.objects.create(username='candidate3', first_nam... | Test POST request Answers app | AnswersPostTestCases | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnswersPostTestCases:
"""Test POST request Answers app"""
def setUp(self):
"""Create new data in in linked tables"""
<|body_0|>
def test_post_create_answers(self):
"""Test for POST Answers"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
user = U... | stack_v2_sparse_classes_36k_train_024271 | 13,494 | no_license | [
{
"docstring": "Create new data in in linked tables",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test for POST Answers",
"name": "test_post_create_answers",
"signature": "def test_post_create_answers(self)"
}
] | 2 | null | Implement the Python class `AnswersPostTestCases` described below.
Class description:
Test POST request Answers app
Method signatures and docstrings:
- def setUp(self): Create new data in in linked tables
- def test_post_create_answers(self): Test for POST Answers | Implement the Python class `AnswersPostTestCases` described below.
Class description:
Test POST request Answers app
Method signatures and docstrings:
- def setUp(self): Create new data in in linked tables
- def test_post_create_answers(self): Test for POST Answers
<|skeleton|>
class AnswersPostTestCases:
"""Test... | f448ec0453818d55c5c9d30aaa4f19e1d7ca5867 | <|skeleton|>
class AnswersPostTestCases:
"""Test POST request Answers app"""
def setUp(self):
"""Create new data in in linked tables"""
<|body_0|>
def test_post_create_answers(self):
"""Test for POST Answers"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AnswersPostTestCases:
"""Test POST request Answers app"""
def setUp(self):
"""Create new data in in linked tables"""
user = User.objects.create(username='testuser', password='qwerty12345Q!')
recruiter = User.objects.create(username='recruiter3', first_name='first_recruiter', last_... | the_stack_v2_python_sparse | Portfolio/tech-interview/techinterview/feedback/test_feedback.py | HeCToR74/Python | train | 1 |
008acc477c6de384db81166439581d21a3140acd | [
"if not root:\n return 'null'\nnodes = collections.deque([root])\nmaps = collections.deque([{'v': root.val}])\ntree = maps[0]\nwhile nodes:\n frontNode = nodes.popleft()\n frontMap = maps.popleft()\n if frontNode.left:\n frontMap['l'] = {'v': frontNode.left.val}\n nodes.append(frontNode.le... | <|body_start_0|>
if not root:
return 'null'
nodes = collections.deque([root])
maps = collections.deque([{'v': root.val}])
tree = maps[0]
while nodes:
frontNode = nodes.popleft()
frontMap = maps.popleft()
if frontNode.left:
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_024272 | 17,936 | 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_015202 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 035ef08434fa1ca781a6fb2f9eed3538b7d20c02 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if not root:
return 'null'
nodes = collections.deque([root])
maps = collections.deque([{'v': root.val}])
tree = maps[0]
while nodes:
... | the_stack_v2_python_sparse | leetcode_python/Tree/serialize-and-deserialize-binary-tree.py | yennanliu/CS_basics | train | 64 | |
183fb174054ec2e9c074afbb65c00a7ef0287c04 | [
"if not beginWord or not endWord or (not wordList):\n return 0\nstate_d = self._construct_dict(wordList)\nreturn self.bfs(beginWord, endWord, state_d)",
"res = {}\nfor w in wordList:\n for i in range(len(w)):\n tmp_word = w[:i] + '_' + w[i + 1:]\n res[tmp_word] = res.get(tmp_word, []) + [w]\nr... | <|body_start_0|>
if not beginWord or not endWord or (not wordList):
return 0
state_d = self._construct_dict(wordList)
return self.bfs(beginWord, endWord, state_d)
<|end_body_0|>
<|body_start_1|>
res = {}
for w in wordList:
for i in range(len(w)):
... | This solution uses a hashmap to store all the state spaces Use more space for less time | Solution2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution2:
"""This solution uses a hashmap to store all the state spaces Use more space for less time"""
def ladderLength(self, beginWord, endWord, wordList):
"""main method body :param beginWord: word to start :param endWord: target end word :param wordList: word lists :return: step... | stack_v2_sparse_classes_36k_train_024273 | 2,492 | no_license | [
{
"docstring": "main method body :param beginWord: word to start :param endWord: target end word :param wordList: word lists :return: steps",
"name": "ladderLength",
"signature": "def ladderLength(self, beginWord, endWord, wordList)"
},
{
"docstring": "convert wordList into a neighbor dictionary... | 3 | stack_v2_sparse_classes_30k_train_011488 | Implement the Python class `Solution2` described below.
Class description:
This solution uses a hashmap to store all the state spaces Use more space for less time
Method signatures and docstrings:
- def ladderLength(self, beginWord, endWord, wordList): main method body :param beginWord: word to start :param endWord: ... | Implement the Python class `Solution2` described below.
Class description:
This solution uses a hashmap to store all the state spaces Use more space for less time
Method signatures and docstrings:
- def ladderLength(self, beginWord, endWord, wordList): main method body :param beginWord: word to start :param endWord: ... | 2c534185854c1a6f5ffdb2698f9db9989f30a25b | <|skeleton|>
class Solution2:
"""This solution uses a hashmap to store all the state spaces Use more space for less time"""
def ladderLength(self, beginWord, endWord, wordList):
"""main method body :param beginWord: word to start :param endWord: target end word :param wordList: word lists :return: step... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution2:
"""This solution uses a hashmap to store all the state spaces Use more space for less time"""
def ladderLength(self, beginWord, endWord, wordList):
"""main method body :param beginWord: word to start :param endWord: target end word :param wordList: word lists :return: steps"""
... | the_stack_v2_python_sparse | Week 03/id_118/LeetCode_127_118.py | Carryours/algorithm004-03 | train | 2 |
abc720d6deb39ac814e2f75038e5c195352327f3 | [
"timestamp = self._GetRowValue(query_hash, row, value_name)\nif timestamp is None:\n return None\nreturn dfdatetime_java_time.JavaTime(timestamp=timestamp)",
"query_hash = hash(query)\nevent_data = AndroidSMSEventData()\nevent_data.address = self._GetRowValue(query_hash, row, 'address')\nevent_data.body = self... | <|body_start_0|>
timestamp = self._GetRowValue(query_hash, row, value_name)
if timestamp is None:
return None
return dfdatetime_java_time.JavaTime(timestamp=timestamp)
<|end_body_0|>
<|body_start_1|>
query_hash = hash(query)
event_data = AndroidSMSEventData()
... | SQLite parser plugin for Android text messages (SMS) database files. The Android text messages (SMS) database file is typically stored in: mmssms.dbs | AndroidSMSPlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AndroidSMSPlugin:
"""SQLite parser plugin for Android text messages (SMS) database files. The Android text messages (SMS) database file is typically stored in: mmssms.dbs"""
def _GetDateTimeRowValue(self, query_hash, row, value_name):
"""Retrieves a date and time value from the row. ... | stack_v2_sparse_classes_36k_train_024274 | 7,153 | permissive | [
{
"docstring": "Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced the row. row (sqlite3.Row): row. value_name (str): name of the value. Returns: dfdatetime.JavaTime: date and time value or None if not available.",
"name"... | 2 | stack_v2_sparse_classes_30k_train_004077 | Implement the Python class `AndroidSMSPlugin` described below.
Class description:
SQLite parser plugin for Android text messages (SMS) database files. The Android text messages (SMS) database file is typically stored in: mmssms.dbs
Method signatures and docstrings:
- def _GetDateTimeRowValue(self, query_hash, row, va... | Implement the Python class `AndroidSMSPlugin` described below.
Class description:
SQLite parser plugin for Android text messages (SMS) database files. The Android text messages (SMS) database file is typically stored in: mmssms.dbs
Method signatures and docstrings:
- def _GetDateTimeRowValue(self, query_hash, row, va... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class AndroidSMSPlugin:
"""SQLite parser plugin for Android text messages (SMS) database files. The Android text messages (SMS) database file is typically stored in: mmssms.dbs"""
def _GetDateTimeRowValue(self, query_hash, row, value_name):
"""Retrieves a date and time value from the row. ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AndroidSMSPlugin:
"""SQLite parser plugin for Android text messages (SMS) database files. The Android text messages (SMS) database file is typically stored in: mmssms.dbs"""
def _GetDateTimeRowValue(self, query_hash, row, value_name):
"""Retrieves a date and time value from the row. Args: query_h... | the_stack_v2_python_sparse | plaso/parsers/sqlite_plugins/android_sms.py | log2timeline/plaso | train | 1,506 |
cb913936875d189c6ee3090e99d4d93457041593 | [
"self.vs = cv2.VideoCapture(0)\nself.output_path = output_path\nself.current_image = None\nself.root = tk.Tk()\nself.root.title('OpenCV and Tkinter')\nself.root.protocol('WM_DELETE_WINDOW', self.destructor)\nself.panel = tk.Label(self.root)\nself.panel.pack(padx=10, pady=10)\nbtn = tk.Button(self.root, text='Snapsh... | <|body_start_0|>
self.vs = cv2.VideoCapture(0)
self.output_path = output_path
self.current_image = None
self.root = tk.Tk()
self.root.title('OpenCV and Tkinter')
self.root.protocol('WM_DELETE_WINDOW', self.destructor)
self.panel = tk.Label(self.root)
self.... | Application | [
"LicenseRef-scancode-proprietary-license",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Application:
def __init__(self, output_path='./'):
"""Initialize application which uses OpenCV + Tkinter. It displays a video stream in a Tkinter window and stores current snapshot on disk"""
<|body_0|>
def video_loop(self):
"""Get frame from the video stream and sho... | stack_v2_sparse_classes_36k_train_024275 | 3,301 | permissive | [
{
"docstring": "Initialize application which uses OpenCV + Tkinter. It displays a video stream in a Tkinter window and stores current snapshot on disk",
"name": "__init__",
"signature": "def __init__(self, output_path='./')"
},
{
"docstring": "Get frame from the video stream and show it in Tkint... | 4 | null | Implement the Python class `Application` described below.
Class description:
Implement the Application class.
Method signatures and docstrings:
- def __init__(self, output_path='./'): Initialize application which uses OpenCV + Tkinter. It displays a video stream in a Tkinter window and stores current snapshot on disk... | Implement the Python class `Application` described below.
Class description:
Implement the Application class.
Method signatures and docstrings:
- def __init__(self, output_path='./'): Initialize application which uses OpenCV + Tkinter. It displays a video stream in a Tkinter window and stores current snapshot on disk... | 9d2310c5323b8c8f3b1829787e5176f6fe3fd3cb | <|skeleton|>
class Application:
def __init__(self, output_path='./'):
"""Initialize application which uses OpenCV + Tkinter. It displays a video stream in a Tkinter window and stores current snapshot on disk"""
<|body_0|>
def video_loop(self):
"""Get frame from the video stream and sho... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Application:
def __init__(self, output_path='./'):
"""Initialize application which uses OpenCV + Tkinter. It displays a video stream in a Tkinter window and stores current snapshot on disk"""
self.vs = cv2.VideoCapture(0)
self.output_path = output_path
self.current_image = None... | the_stack_v2_python_sparse | opencv_tkinter.py | foobar167/junkyard | train | 86 | |
38b9452142eaa8cc7c802c034f8e65fdd5efcd10 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn SynchronizationRule()",
"from .container_filter import ContainerFilter\nfrom .group_filter import GroupFilter\nfrom .object_mapping import ObjectMapping\nfrom .string_key_string_value_pair import StringKeyStringValuePair\nfrom .contain... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return SynchronizationRule()
<|end_body_0|>
<|body_start_1|>
from .container_filter import ContainerFilter
from .group_filter import GroupFilter
from .object_mapping import ObjectMappin... | SynchronizationRule | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SynchronizationRule:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationRule:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the ob... | stack_v2_sparse_classes_36k_train_024276 | 6,106 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: SynchronizationRule",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator... | 3 | stack_v2_sparse_classes_30k_train_006408 | Implement the Python class `SynchronizationRule` described below.
Class description:
Implement the SynchronizationRule class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationRule: Creates a new instance of the appropriate class based on d... | Implement the Python class `SynchronizationRule` described below.
Class description:
Implement the SynchronizationRule class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationRule: Creates a new instance of the appropriate class based on d... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class SynchronizationRule:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationRule:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the ob... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SynchronizationRule:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationRule:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ... | the_stack_v2_python_sparse | msgraph/generated/models/synchronization_rule.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
be76ad3d413e402df7e6ac137d0d26a444ef98f9 | [
"super().__init__(max_number=max_number, min_number=min_number, seed=seed)\nself.stamp_size = stamp_size\nself.max_shift = max_shift if max_shift is not None else self.stamp_size / 10.0\nself.min_mag, self.max_mag = (min_mag, max_mag)\nself.mag_name = mag_name",
"if self.mag_name not in table.colnames:\n raise... | <|body_start_0|>
super().__init__(max_number=max_number, min_number=min_number, seed=seed)
self.stamp_size = stamp_size
self.max_shift = max_shift if max_shift is not None else self.stamp_size / 10.0
self.min_mag, self.max_mag = (min_mag, max_mag)
self.mag_name = mag_name
<|end_b... | Default sampling function used for producing blend catalogs. | DefaultSampling | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DefaultSampling:
"""Default sampling function used for producing blend catalogs."""
def __init__(self, max_number: int=2, min_number: int=1, stamp_size: float=24.0, max_shift: Optional[float]=None, seed: int=DEFAULT_SEED, max_mag: float=25.3, min_mag: float=-np.inf, mag_name: str='i_ab'):
... | stack_v2_sparse_classes_36k_train_024277 | 12,943 | permissive | [
{
"docstring": "Initializes default sampling function. Args: max_number: Defined in parent class min_number: Defined in parent class stamp_size: Size of the desired stamp. max_shift: Magnitude of maximum value of shift. If None then it is set as one-tenth the stamp size. (in arcseconds) seed: Seed to initialize... | 2 | stack_v2_sparse_classes_30k_train_003751 | Implement the Python class `DefaultSampling` described below.
Class description:
Default sampling function used for producing blend catalogs.
Method signatures and docstrings:
- def __init__(self, max_number: int=2, min_number: int=1, stamp_size: float=24.0, max_shift: Optional[float]=None, seed: int=DEFAULT_SEED, ma... | Implement the Python class `DefaultSampling` described below.
Class description:
Default sampling function used for producing blend catalogs.
Method signatures and docstrings:
- def __init__(self, max_number: int=2, min_number: int=1, stamp_size: float=24.0, max_shift: Optional[float]=None, seed: int=DEFAULT_SEED, ma... | f5b716a373f130238100db8980aa0d282822983a | <|skeleton|>
class DefaultSampling:
"""Default sampling function used for producing blend catalogs."""
def __init__(self, max_number: int=2, min_number: int=1, stamp_size: float=24.0, max_shift: Optional[float]=None, seed: int=DEFAULT_SEED, max_mag: float=25.3, min_mag: float=-np.inf, mag_name: str='i_ab'):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DefaultSampling:
"""Default sampling function used for producing blend catalogs."""
def __init__(self, max_number: int=2, min_number: int=1, stamp_size: float=24.0, max_shift: Optional[float]=None, seed: int=DEFAULT_SEED, max_mag: float=25.3, min_mag: float=-np.inf, mag_name: str='i_ab'):
"""Init... | the_stack_v2_python_sparse | btk/sampling_functions.py | LSSTDESC/BlendingToolKit | train | 22 |
4749b8e0d38408c2e2d5931a4fa4eba07d6533f1 | [
"super(GPT2LambadaModel, self).__init__()\nif not is_training:\n config.hidden_dropout = 0.0\nself.vocab_size = config.vocab_size\nself.gpt2 = GPT2Model(config, is_training, use_one_hot_embeddings)\nself.cast = P.Cast()\nself.shape = P.Shape()\nself.log_softmax = P.LogSoftmax(axis=-1)\nself.dtype = config.dtype\... | <|body_start_0|>
super(GPT2LambadaModel, self).__init__()
if not is_training:
config.hidden_dropout = 0.0
self.vocab_size = config.vocab_size
self.gpt2 = GPT2Model(config, is_training, use_one_hot_embeddings)
self.cast = P.Cast()
self.shape = P.Shape()
... | GPT2LambadaModel is responsible for Lambada task, i.e. Lambada-train, Lambada-test datasets. | GPT2LambadaModel | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GPT2LambadaModel:
"""GPT2LambadaModel is responsible for Lambada task, i.e. Lambada-train, Lambada-test datasets."""
def __init__(self, config, is_training, use_one_hot_embeddings=False):
"""Args: config: the configuration of GPT-2 model is_training (bool): `True` for train (finetune... | stack_v2_sparse_classes_36k_train_024278 | 2,976 | permissive | [
{
"docstring": "Args: config: the configuration of GPT-2 model is_training (bool): `True` for train (finetune), `False` for evaluation. use_one_hot_embeddings (bool): default False.",
"name": "__init__",
"signature": "def __init__(self, config, is_training, use_one_hot_embeddings=False)"
},
{
"d... | 2 | stack_v2_sparse_classes_30k_train_012487 | Implement the Python class `GPT2LambadaModel` described below.
Class description:
GPT2LambadaModel is responsible for Lambada task, i.e. Lambada-train, Lambada-test datasets.
Method signatures and docstrings:
- def __init__(self, config, is_training, use_one_hot_embeddings=False): Args: config: the configuration of G... | Implement the Python class `GPT2LambadaModel` described below.
Class description:
GPT2LambadaModel is responsible for Lambada task, i.e. Lambada-train, Lambada-test datasets.
Method signatures and docstrings:
- def __init__(self, config, is_training, use_one_hot_embeddings=False): Args: config: the configuration of G... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class GPT2LambadaModel:
"""GPT2LambadaModel is responsible for Lambada task, i.e. Lambada-train, Lambada-test datasets."""
def __init__(self, config, is_training, use_one_hot_embeddings=False):
"""Args: config: the configuration of GPT-2 model is_training (bool): `True` for train (finetune... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GPT2LambadaModel:
"""GPT2LambadaModel is responsible for Lambada task, i.e. Lambada-train, Lambada-test datasets."""
def __init__(self, config, is_training, use_one_hot_embeddings=False):
"""Args: config: the configuration of GPT-2 model is_training (bool): `True` for train (finetune), `False` fo... | the_stack_v2_python_sparse | research/nlp/gpt2/src/GPT2ForLambada.py | mindspore-ai/models | train | 301 |
b7dad5cbab78d310d5723f238d5bd170a1cbd33d | [
"data = request.data\nif data.get('helper_number') is None:\n return False\nphone_pattern = '^(\\\\+91|0)?\\\\d{10}$'\nif re.match(phone_pattern, data.get('helper_number')) is not None:\n return data\nelse:\n return False",
"action_to = ActionTypeOptions()\nassign_so = AssignStatusOptions()\ntask_list = ... | <|body_start_0|>
data = request.data
if data.get('helper_number') is None:
return False
phone_pattern = '^(\\+91|0)?\\d{10}$'
if re.match(phone_pattern, data.get('helper_number')) is not None:
return data
else:
return False
<|end_body_0|>
<|bo... | View used to get all tasks related to a particular helper | GetHelperTasks | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetHelperTasks:
"""View used to get all tasks related to a particular helper"""
def validate_input(self, request):
"""Incoming input validator"""
<|body_0|>
def handler(self, data):
"""Returns the list of tasks for current helper"""
<|body_1|>
def po... | stack_v2_sparse_classes_36k_train_024279 | 4,312 | no_license | [
{
"docstring": "Incoming input validator",
"name": "validate_input",
"signature": "def validate_input(self, request)"
},
{
"docstring": "Returns the list of tasks for current helper",
"name": "handler",
"signature": "def handler(self, data)"
},
{
"docstring": "Post request handle... | 3 | stack_v2_sparse_classes_30k_train_018074 | Implement the Python class `GetHelperTasks` described below.
Class description:
View used to get all tasks related to a particular helper
Method signatures and docstrings:
- def validate_input(self, request): Incoming input validator
- def handler(self, data): Returns the list of tasks for current helper
- def post(s... | Implement the Python class `GetHelperTasks` described below.
Class description:
View used to get all tasks related to a particular helper
Method signatures and docstrings:
- def validate_input(self, request): Incoming input validator
- def handler(self, data): Returns the list of tasks for current helper
- def post(s... | 910ed40940d79f454a02b8553bb2ef76b99c1eaa | <|skeleton|>
class GetHelperTasks:
"""View used to get all tasks related to a particular helper"""
def validate_input(self, request):
"""Incoming input validator"""
<|body_0|>
def handler(self, data):
"""Returns the list of tasks for current helper"""
<|body_1|>
def po... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GetHelperTasks:
"""View used to get all tasks related to a particular helper"""
def validate_input(self, request):
"""Incoming input validator"""
data = request.data
if data.get('helper_number') is None:
return False
phone_pattern = '^(\\+91|0)?\\d{10}$'
... | the_stack_v2_python_sparse | task_manager/views.py | raj231992/helpline | train | 0 |
4c69cc1992eb67446473cc1d948199339e3fccf3 | [
"class_completions = [(cls, f'--{cls.__name__}.') for cls in self.config_classes]\nmatched_completions = class_completions\nif '.' in cword_prefix:\n cword_prefix = cword_prefix[:cword_prefix.index('.') + 1]\n matched_completions = [(cls, c) for cls, c in class_completions if c == cword_prefix]\nelif len(cwor... | <|body_start_0|>
class_completions = [(cls, f'--{cls.__name__}.') for cls in self.config_classes]
matched_completions = class_completions
if '.' in cword_prefix:
cword_prefix = cword_prefix[:cword_prefix.index('.') + 1]
matched_completions = [(cls, c) for cls, c in class_... | An extension of CompletionFinder which dynamically completes class-trait based options This finder adds a few functionalities: 1. When completing options, it will add ``--Class.`` to the list of completions, for each class in `Application.classes` that could complete the current option. 2. If it detects that we are cur... | ExtendedCompletionFinder | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExtendedCompletionFinder:
"""An extension of CompletionFinder which dynamically completes class-trait based options This finder adds a few functionalities: 1. When completing options, it will add ``--Class.`` to the list of completions, for each class in `Application.classes` that could complete ... | stack_v2_sparse_classes_36k_train_024280 | 9,983 | permissive | [
{
"docstring": "Match the word to be completed against our Configurable classes Check if cword_prefix could potentially match against --{class}. for any class in Application.classes.",
"name": "match_class_completions",
"signature": "def match_class_completions(self, cword_prefix: str) -> t.List[t.Tuple... | 4 | null | Implement the Python class `ExtendedCompletionFinder` described below.
Class description:
An extension of CompletionFinder which dynamically completes class-trait based options This finder adds a few functionalities: 1. When completing options, it will add ``--Class.`` to the list of completions, for each class in `Ap... | Implement the Python class `ExtendedCompletionFinder` described below.
Class description:
An extension of CompletionFinder which dynamically completes class-trait based options This finder adds a few functionalities: 1. When completing options, it will add ``--Class.`` to the list of completions, for each class in `Ap... | f5042e35b945aded77b23470ead62d7eacefde92 | <|skeleton|>
class ExtendedCompletionFinder:
"""An extension of CompletionFinder which dynamically completes class-trait based options This finder adds a few functionalities: 1. When completing options, it will add ``--Class.`` to the list of completions, for each class in `Application.classes` that could complete ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExtendedCompletionFinder:
"""An extension of CompletionFinder which dynamically completes class-trait based options This finder adds a few functionalities: 1. When completing options, it will add ``--Class.`` to the list of completions, for each class in `Application.classes` that could complete the current o... | the_stack_v2_python_sparse | contrib/python/traitlets/py3/traitlets/config/argcomplete_config.py | catboost/catboost | train | 8,012 |
09994b4b6a7f8f5e69444dafa2a93fb01500f6eb | [
"if self.parent.ct is None:\n pn.state.notifications.warning('no CT found')\nelse:\n self.parent.ct = denoise(arrays=self.parent.ct, method=self.denoise_method, median_filter_kernel=self.denoise_median_kernel, bilateral_sigma_color=self.denoise_bilateral_sigma_color, bilateral_sigma_spatial=self.denoise_bilat... | <|body_start_0|>
if self.parent.ct is None:
pn.state.notifications.warning('no CT found')
else:
self.parent.ct = denoise(arrays=self.parent.ct, method=self.denoise_method, median_filter_kernel=self.denoise_median_kernel, bilateral_sigma_color=self.denoise_bilateral_sigma_color, b... | Noise reduction widget. Widget for the denoise filter from iMars3D, must have a parent widget with validate ct stack. | Denoise | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Denoise:
"""Noise reduction widget. Widget for the denoise filter from iMars3D, must have a parent widget with validate ct stack."""
def apply(self):
"""Apply denoise."""
<|body_0|>
def panel(self, width=200):
"""App card view."""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k_train_024281 | 3,361 | permissive | [
{
"docstring": "Apply denoise.",
"name": "apply",
"signature": "def apply(self)"
},
{
"docstring": "App card view.",
"name": "panel",
"signature": "def panel(self, width=200)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007303 | Implement the Python class `Denoise` described below.
Class description:
Noise reduction widget. Widget for the denoise filter from iMars3D, must have a parent widget with validate ct stack.
Method signatures and docstrings:
- def apply(self): Apply denoise.
- def panel(self, width=200): App card view. | Implement the Python class `Denoise` described below.
Class description:
Noise reduction widget. Widget for the denoise filter from iMars3D, must have a parent widget with validate ct stack.
Method signatures and docstrings:
- def apply(self): Apply denoise.
- def panel(self, width=200): App card view.
<|skeleton|>
... | 7c9dea7a3a7877af1bafdfb71da8fb018d5d828f | <|skeleton|>
class Denoise:
"""Noise reduction widget. Widget for the denoise filter from iMars3D, must have a parent widget with validate ct stack."""
def apply(self):
"""Apply denoise."""
<|body_0|>
def panel(self, width=200):
"""App card view."""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Denoise:
"""Noise reduction widget. Widget for the denoise filter from iMars3D, must have a parent widget with validate ct stack."""
def apply(self):
"""Apply denoise."""
if self.parent.ct is None:
pn.state.notifications.warning('no CT found')
else:
self.pa... | the_stack_v2_python_sparse | src/imars3d/ui/widgets/denoise.py | ornlneutronimaging/iMars3D | train | 3 |
f220d5a3b797dd532c86c07df34ce9281750c6ad | [
"rs, ls, re, le = ([], [], [], [])\nfor i in range(len(start)):\n if start[i] == 'R':\n rs += (i,)\n elif start[i] == 'L':\n ls += (i,)\n if end[i] == 'R':\n re += (i,)\n elif end[i] == 'L':\n le += (i,)\nif len(rs) != len(re) or len(ls) != len(le):\n return False\nif len(... | <|body_start_0|>
rs, ls, re, le = ([], [], [], [])
for i in range(len(start)):
if start[i] == 'R':
rs += (i,)
elif start[i] == 'L':
ls += (i,)
if end[i] == 'R':
re += (i,)
elif end[i] == 'L':
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canTransform(self, start, end):
""":type start: str :type end: str :rtype: bool"""
<|body_0|>
def canTransform_2(self, start, end):
""":type start: str :type end: str :rtype: bool"""
<|body_1|>
def canTransform_TLE(self, start, end):
... | stack_v2_sparse_classes_36k_train_024282 | 4,147 | no_license | [
{
"docstring": ":type start: str :type end: str :rtype: bool",
"name": "canTransform",
"signature": "def canTransform(self, start, end)"
},
{
"docstring": ":type start: str :type end: str :rtype: bool",
"name": "canTransform_2",
"signature": "def canTransform_2(self, start, end)"
},
... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canTransform(self, start, end): :type start: str :type end: str :rtype: bool
- def canTransform_2(self, start, end): :type start: str :type end: str :rtype: bool
- def canTra... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canTransform(self, start, end): :type start: str :type end: str :rtype: bool
- def canTransform_2(self, start, end): :type start: str :type end: str :rtype: bool
- def canTra... | b4da922c4e8406c486760639b71e3ec50283ca43 | <|skeleton|>
class Solution:
def canTransform(self, start, end):
""":type start: str :type end: str :rtype: bool"""
<|body_0|>
def canTransform_2(self, start, end):
""":type start: str :type end: str :rtype: bool"""
<|body_1|>
def canTransform_TLE(self, start, end):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def canTransform(self, start, end):
""":type start: str :type end: str :rtype: bool"""
rs, ls, re, le = ([], [], [], [])
for i in range(len(start)):
if start[i] == 'R':
rs += (i,)
elif start[i] == 'L':
ls += (i,)
... | the_stack_v2_python_sparse | current_session/python/777.py | YJL33/LeetCode | train | 3 | |
85f47f0d3e6a9c0418d427d00de354e8fc2f4223 | [
"temperature = np.arange(6).reshape(2, 3)\nself.temperature_cube = set_up_variable_cube(temperature)\norography = np.array([[20.0, 30.0, 40.0, 30.0, 25.0, 25.0], [30.0, 50.0, 80.0, 60.0, 50.0, 45.0], [50.0, 65.0, 90.0, 70.0, 60.0, 50.0], [45.0, 60.0, 85.0, 65.0, 55.0, 45.0]])\norography_cube = set_up_orography_cube... | <|body_start_0|>
temperature = np.arange(6).reshape(2, 3)
self.temperature_cube = set_up_variable_cube(temperature)
orography = np.array([[20.0, 30.0, 40.0, 30.0, 25.0, 25.0], [30.0, 50.0, 80.0, 60.0, 50.0, 45.0], [50.0, 65.0, 90.0, 70.0, 60.0, 50.0], [45.0, 60.0, 85.0, 65.0, 55.0, 45.0]])
... | Test the _regrid_variable method | Test__regrid_variable | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test__regrid_variable:
"""Test the _regrid_variable method"""
def setUp(self):
"""Set up input cubes"""
<|body_0|>
def test_basic(self):
"""Test cube of the correct shape and type is returned"""
<|body_1|>
def test_axis_inversion(self):
"""Te... | stack_v2_sparse_classes_36k_train_024283 | 34,979 | permissive | [
{
"docstring": "Set up input cubes",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test cube of the correct shape and type is returned",
"name": "test_basic",
"signature": "def test_basic(self)"
},
{
"docstring": "Test axes are output in ascending order",
... | 6 | stack_v2_sparse_classes_30k_train_013783 | Implement the Python class `Test__regrid_variable` described below.
Class description:
Test the _regrid_variable method
Method signatures and docstrings:
- def setUp(self): Set up input cubes
- def test_basic(self): Test cube of the correct shape and type is returned
- def test_axis_inversion(self): Test axes are out... | Implement the Python class `Test__regrid_variable` described below.
Class description:
Test the _regrid_variable method
Method signatures and docstrings:
- def setUp(self): Set up input cubes
- def test_basic(self): Test cube of the correct shape and type is returned
- def test_axis_inversion(self): Test axes are out... | cd2c9019944345df1e703bf8f625db537ad9f559 | <|skeleton|>
class Test__regrid_variable:
"""Test the _regrid_variable method"""
def setUp(self):
"""Set up input cubes"""
<|body_0|>
def test_basic(self):
"""Test cube of the correct shape and type is returned"""
<|body_1|>
def test_axis_inversion(self):
"""Te... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test__regrid_variable:
"""Test the _regrid_variable method"""
def setUp(self):
"""Set up input cubes"""
temperature = np.arange(6).reshape(2, 3)
self.temperature_cube = set_up_variable_cube(temperature)
orography = np.array([[20.0, 30.0, 40.0, 30.0, 25.0, 25.0], [30.0, 50.... | the_stack_v2_python_sparse | improver_tests/orographic_enhancement/test_OrographicEnhancement.py | metoppv/improver | train | 101 |
2a11ffb30c37628a7335cedc5d71b4d11ccf3514 | [
"envelopes.sort()\n\n@lru_cache(None)\ndef dfs(i):\n if i == 0:\n return 1\n ret = 1\n for j in range(i):\n if envelopes[i][0] > envelopes[j][0] and envelopes[i][1] > envelopes[j][1]:\n ret = max(ret, 1 + dfs(j))\n return ret\nreturn max((dfs(i) for i in range(len(envelopes)))) ... | <|body_start_0|>
envelopes.sort()
@lru_cache(None)
def dfs(i):
if i == 0:
return 1
ret = 1
for j in range(i):
if envelopes[i][0] > envelopes[j][0] and envelopes[i][1] > envelopes[j][1]:
ret = max(ret, 1 + df... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxEnvelopes(self, envelopes: List[List[int]]) -> int:
"""DFS"""
<|body_0|>
def maxEnvelopes(self, envelopes: List[List[int]]) -> int:
"""Time complexity: O(n^2) Space complexity: O(n^2)"""
<|body_1|>
def maxEnvelopes(self, envelopes: List[... | stack_v2_sparse_classes_36k_train_024284 | 5,669 | no_license | [
{
"docstring": "DFS",
"name": "maxEnvelopes",
"signature": "def maxEnvelopes(self, envelopes: List[List[int]]) -> int"
},
{
"docstring": "Time complexity: O(n^2) Space complexity: O(n^2)",
"name": "maxEnvelopes",
"signature": "def maxEnvelopes(self, envelopes: List[List[int]]) -> int"
... | 4 | stack_v2_sparse_classes_30k_train_009499 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxEnvelopes(self, envelopes: List[List[int]]) -> int: DFS
- def maxEnvelopes(self, envelopes: List[List[int]]) -> int: Time complexity: O(n^2) Space complexity: O(n^2)
- def... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxEnvelopes(self, envelopes: List[List[int]]) -> int: DFS
- def maxEnvelopes(self, envelopes: List[List[int]]) -> int: Time complexity: O(n^2) Space complexity: O(n^2)
- def... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def maxEnvelopes(self, envelopes: List[List[int]]) -> int:
"""DFS"""
<|body_0|>
def maxEnvelopes(self, envelopes: List[List[int]]) -> int:
"""Time complexity: O(n^2) Space complexity: O(n^2)"""
<|body_1|>
def maxEnvelopes(self, envelopes: List[... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxEnvelopes(self, envelopes: List[List[int]]) -> int:
"""DFS"""
envelopes.sort()
@lru_cache(None)
def dfs(i):
if i == 0:
return 1
ret = 1
for j in range(i):
if envelopes[i][0] > envelopes[j][0] ... | the_stack_v2_python_sparse | leetcode/solved/354_Russian_Doll_Envelopes/solution.py | sungminoh/algorithms | train | 0 | |
c0095cab6af56ed40673b22f7eb7b9a91964ebb8 | [
"if len(nums) == 0:\n return False\nif len(nums) <= k:\n return len(nums) != len(set(nums))\nreturn any([len(nums[i:i + k + 1]) != len(set(nums[i:i + k + 1])) for i in range(len(nums) - k)])",
"if len(nums) <= 1 or k == 0:\n return False\nif len(nums) <= k:\n x = sorted(nums)\n return any(map(lambd... | <|body_start_0|>
if len(nums) == 0:
return False
if len(nums) <= k:
return len(nums) != len(set(nums))
return any([len(nums[i:i + k + 1]) != len(set(nums[i:i + k + 1])) for i in range(len(nums) - k)])
<|end_body_0|>
<|body_start_1|>
if len(nums) <= 1 or k == 0:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def containsNearbyDuplicate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool"""
<|body_0|>
def containsNearbyAlmostDuplicate(self, nums, k, t):
""":type nums: List[int] :type k: int :type t: int :rtype: bool"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k_train_024285 | 1,013 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: bool",
"name": "containsNearbyDuplicate",
"signature": "def containsNearbyDuplicate(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :type t: int :rtype: bool",
"name": "containsNearbyAlmostDuplicate",
"signa... | 2 | stack_v2_sparse_classes_30k_val_000190 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtype: bool
- def containsNearbyAlmostDuplicate(self, nums, k, t): :type nums: List[int] :type k: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtype: bool
- def containsNearbyAlmostDuplicate(self, nums, k, t): :type nums: List[int] :type k: ... | 113d052de41d85f366c9497fb132df91e619f13a | <|skeleton|>
class Solution:
def containsNearbyDuplicate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool"""
<|body_0|>
def containsNearbyAlmostDuplicate(self, nums, k, t):
""":type nums: List[int] :type k: int :type t: int :rtype: bool"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def containsNearbyDuplicate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool"""
if len(nums) == 0:
return False
if len(nums) <= k:
return len(nums) != len(set(nums))
return any([len(nums[i:i + k + 1]) != len(set(nums[i:i + k +... | the_stack_v2_python_sparse | contains-duplicate.py | ding4it/leetcode | train | 1 | |
c5f92d9a9aadea98e16f229fc545e6c3e53515eb | [
"self.description = description\nself.group_info = group_info\nself.name = name\nself.primary_s_m_t_p_address = primary_s_m_t_p_address\nself.proxy_host_source_id_list = proxy_host_source_id_list\nself.site_info = site_info\nself.team_info = team_info\nself.mtype = mtype\nself.user_info = user_info\nself.uuid = uui... | <|body_start_0|>
self.description = description
self.group_info = group_info
self.name = name
self.primary_s_m_t_p_address = primary_s_m_t_p_address
self.proxy_host_source_id_list = proxy_host_source_id_list
self.site_info = site_info
self.team_info = team_info
... | Implementation of the 'Office365ProtectionSource' model. Specifies a Protection Source in Office 365 environment. Attributes: description (string): Specifies the description of the Office 365 entity. group_info (Office365GroupInfo): Specifies the information about Office365 group. name (string): Specifies the name of t... | Office365ProtectionSource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Office365ProtectionSource:
"""Implementation of the 'Office365ProtectionSource' model. Specifies a Protection Source in Office 365 environment. Attributes: description (string): Specifies the description of the Office 365 entity. group_info (Office365GroupInfo): Specifies the information about Of... | stack_v2_sparse_classes_36k_train_024286 | 5,284 | permissive | [
{
"docstring": "Constructor for the Office365ProtectionSource class",
"name": "__init__",
"signature": "def __init__(self, description=None, group_info=None, name=None, primary_s_m_t_p_address=None, proxy_host_source_id_list=None, site_info=None, team_info=None, mtype=None, user_info=None, uuid=None, we... | 2 | stack_v2_sparse_classes_30k_train_001069 | Implement the Python class `Office365ProtectionSource` described below.
Class description:
Implementation of the 'Office365ProtectionSource' model. Specifies a Protection Source in Office 365 environment. Attributes: description (string): Specifies the description of the Office 365 entity. group_info (Office365GroupIn... | Implement the Python class `Office365ProtectionSource` described below.
Class description:
Implementation of the 'Office365ProtectionSource' model. Specifies a Protection Source in Office 365 environment. Attributes: description (string): Specifies the description of the Office 365 entity. group_info (Office365GroupIn... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class Office365ProtectionSource:
"""Implementation of the 'Office365ProtectionSource' model. Specifies a Protection Source in Office 365 environment. Attributes: description (string): Specifies the description of the Office 365 entity. group_info (Office365GroupInfo): Specifies the information about Of... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Office365ProtectionSource:
"""Implementation of the 'Office365ProtectionSource' model. Specifies a Protection Source in Office 365 environment. Attributes: description (string): Specifies the description of the Office 365 entity. group_info (Office365GroupInfo): Specifies the information about Office365 group... | the_stack_v2_python_sparse | cohesity_management_sdk/models/office_365_protection_source.py | cohesity/management-sdk-python | train | 24 |
ae4e3880ffa17975430fea490f616daefa904fd9 | [
"config = ContainerConfig('shipper/base', \"echo 'hi'\")\nexpected = {'AttachStderr': False, 'AttachStdin': False, 'AttachStdout': False, 'Cmd': ['echo', 'hi'], 'Dns': None, 'Env': None, 'Hostname': None, 'Image': 'shipper/base', 'Memory': 0, 'OpenStdin': False, 'StdinOnce': False, 'ExposedPorts': {}, 'Tty': False,... | <|body_start_0|>
config = ContainerConfig('shipper/base', "echo 'hi'")
expected = {'AttachStderr': False, 'AttachStdin': False, 'AttachStdout': False, 'Cmd': ['echo', 'hi'], 'Dns': None, 'Env': None, 'Hostname': None, 'Image': 'shipper/base', 'Memory': 0, 'OpenStdin': False, 'StdinOnce': False, 'Exposed... | Tests container wrappers | ShipperContainerTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShipperContainerTestCase:
"""Tests container wrappers"""
def test_container_config_defaults(self):
"""Makes sure defaults for container config function are sane."""
<|body_0|>
def test_container_config(self):
"""Make sure all parameters are converted properly and... | stack_v2_sparse_classes_36k_train_024287 | 49,482 | no_license | [
{
"docstring": "Makes sure defaults for container config function are sane.",
"name": "test_container_config_defaults",
"signature": "def test_container_config_defaults(self)"
},
{
"docstring": "Make sure all parameters are converted properly and to the right properties.",
"name": "test_cont... | 2 | stack_v2_sparse_classes_30k_train_019045 | Implement the Python class `ShipperContainerTestCase` described below.
Class description:
Tests container wrappers
Method signatures and docstrings:
- def test_container_config_defaults(self): Makes sure defaults for container config function are sane.
- def test_container_config(self): Make sure all parameters are c... | Implement the Python class `ShipperContainerTestCase` described below.
Class description:
Tests container wrappers
Method signatures and docstrings:
- def test_container_config_defaults(self): Makes sure defaults for container config function are sane.
- def test_container_config(self): Make sure all parameters are c... | 0ac6653219c2701c13c508c5c4fc9bc3437eea06 | <|skeleton|>
class ShipperContainerTestCase:
"""Tests container wrappers"""
def test_container_config_defaults(self):
"""Makes sure defaults for container config function are sane."""
<|body_0|>
def test_container_config(self):
"""Make sure all parameters are converted properly and... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ShipperContainerTestCase:
"""Tests container wrappers"""
def test_container_config_defaults(self):
"""Makes sure defaults for container config function are sane."""
config = ContainerConfig('shipper/base', "echo 'hi'")
expected = {'AttachStderr': False, 'AttachStdin': False, 'Atta... | the_stack_v2_python_sparse | repoData/mailgun-shipper/allPythonContent.py | aCoffeeYin/pyreco | train | 0 |
43cccbce5d9fb7a31cfb7f142253a564ebbd7505 | [
"user = User.objects.filter(email__iexact=attrs.get('email')).first()\nif user is None:\n msg = _('Sorry, email not found.')\n raise ValidationError(msg)\nattrs['user'] = user\nreturn attrs",
"forget_password = ForgetPassword(user=validated_data['user'])\nforget_password.save()\nreturn forget_password"
] | <|body_start_0|>
user = User.objects.filter(email__iexact=attrs.get('email')).first()
if user is None:
msg = _('Sorry, email not found.')
raise ValidationError(msg)
attrs['user'] = user
return attrs
<|end_body_0|>
<|body_start_1|>
forget_password = Forget... | The serializer for ForgetPassword Objects | ForgetPasswordSerializer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ForgetPasswordSerializer:
"""The serializer for ForgetPassword Objects"""
def validate(self, attrs):
"""Check if the email is found and it is verified :param attrs: :return:"""
<|body_0|>
def create(self, validated_data):
"""create a ForgetPassword that contains ... | stack_v2_sparse_classes_36k_train_024288 | 1,480 | permissive | [
{
"docstring": "Check if the email is found and it is verified :param attrs: :return:",
"name": "validate",
"signature": "def validate(self, attrs)"
},
{
"docstring": "create a ForgetPassword that contains a key to send to the user in order to enter a new password :param validated_data: :return:... | 2 | null | Implement the Python class `ForgetPasswordSerializer` described below.
Class description:
The serializer for ForgetPassword Objects
Method signatures and docstrings:
- def validate(self, attrs): Check if the email is found and it is verified :param attrs: :return:
- def create(self, validated_data): create a ForgetPa... | Implement the Python class `ForgetPasswordSerializer` described below.
Class description:
The serializer for ForgetPassword Objects
Method signatures and docstrings:
- def validate(self, attrs): Check if the email is found and it is verified :param attrs: :return:
- def create(self, validated_data): create a ForgetPa... | 73d3c40aa449eec5acc59d4493ee94059bddabbd | <|skeleton|>
class ForgetPasswordSerializer:
"""The serializer for ForgetPassword Objects"""
def validate(self, attrs):
"""Check if the email is found and it is verified :param attrs: :return:"""
<|body_0|>
def create(self, validated_data):
"""create a ForgetPassword that contains ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ForgetPasswordSerializer:
"""The serializer for ForgetPassword Objects"""
def validate(self, attrs):
"""Check if the email is found and it is verified :param attrs: :return:"""
user = User.objects.filter(email__iexact=attrs.get('email')).first()
if user is None:
msg = ... | the_stack_v2_python_sparse | libs/core/users/api/serializers/ForgetPasswordSerializer.py | nileshkorpad1/WebDjangular | train | 0 |
b39c2636ecc0a419bab3a42117f8392ed86c90ea | [
"nph = NumpyHist.getFromRoot(h)\nif np.isnan(nph.w).any():\n logging.warning('Warning : nan found in hist %s' % h.GetName())\n return None\nif not hasattr(self, 'ne'):\n raise RuntimeError('New bin edges have not been computed, is the rebin_method() not implemented ?')\nreturn nph.rebin(self.ne).fillHistog... | <|body_start_0|>
nph = NumpyHist.getFromRoot(h)
if np.isnan(nph.w).any():
logging.warning('Warning : nan found in hist %s' % h.GetName())
return None
if not hasattr(self, 'ne'):
raise RuntimeError('New bin edges have not been computed, is the rebin_method() no... | Base rebin method includes common methods to rebin, extract and fill histograms | Rebin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rebin:
"""Base rebin method includes common methods to rebin, extract and fill histograms"""
def __call__(self, h):
"""input : initial histogram TH1 return : rebinned TH1"""
<|body_0|>
def _processHist(h):
"""Input : h, can be - ROOT.TH1X - NumpyHist already - li... | stack_v2_sparse_classes_36k_train_024289 | 35,100 | no_license | [
{
"docstring": "input : initial histogram TH1 return : rebinned TH1",
"name": "__call__",
"signature": "def __call__(self, h)"
},
{
"docstring": "Input : h, can be - ROOT.TH1X - NumpyHist already - list of ROOT.TH1X or NumpyHist return : NumpyHist object",
"name": "_processHist",
"signat... | 2 | stack_v2_sparse_classes_30k_train_014552 | Implement the Python class `Rebin` described below.
Class description:
Base rebin method includes common methods to rebin, extract and fill histograms
Method signatures and docstrings:
- def __call__(self, h): input : initial histogram TH1 return : rebinned TH1
- def _processHist(h): Input : h, can be - ROOT.TH1X - N... | Implement the Python class `Rebin` described below.
Class description:
Base rebin method includes common methods to rebin, extract and fill histograms
Method signatures and docstrings:
- def __call__(self, h): input : initial histogram TH1 return : rebinned TH1
- def _processHist(h): Input : h, can be - ROOT.TH1X - N... | 30df434202df51017309b5bf88a1d9b94041b6ef | <|skeleton|>
class Rebin:
"""Base rebin method includes common methods to rebin, extract and fill histograms"""
def __call__(self, h):
"""input : initial histogram TH1 return : rebinned TH1"""
<|body_0|>
def _processHist(h):
"""Input : h, can be - ROOT.TH1X - NumpyHist already - li... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Rebin:
"""Base rebin method includes common methods to rebin, extract and fill histograms"""
def __call__(self, h):
"""input : initial histogram TH1 return : rebinned TH1"""
nph = NumpyHist.getFromRoot(h)
if np.isnan(nph.w).any():
logging.warning('Warning : nan found i... | the_stack_v2_python_sparse | ZAStatAnalysis/Rebinning.py | kjaffel/ZA_FullAnalysis | train | 11 |
8b1524f82f89e56bdc0725eed75104e45911d2a2 | [
"self._brain_spec = brain_spec\nself._hparams = hparams\n\ndef _create_projection_layer(tf_spec, proto_spec):\n if isinstance(proto_spec, primitives_pb2.NumberType):\n return _normal_projection_net(tf_spec)\n if isinstance(proto_spec, primitives_pb2.CategoryType):\n return _categorical_projectio... | <|body_start_0|>
self._brain_spec = brain_spec
self._hparams = hparams
def _create_projection_layer(tf_spec, proto_spec):
if isinstance(proto_spec, primitives_pb2.NumberType):
return _normal_projection_net(tf_spec)
if isinstance(proto_spec, primitives_pb2... | Creates action outputs from network outputs and observations. | ActionPostprocessor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActionPostprocessor:
"""Creates action outputs from network outputs and observations."""
def __init__(self, brain_spec, hparams):
"""Create a new action postprocessor. Args: brain_spec: A tfa_specs.BrainSpec. hparams: A dictionary of hyperparameters."""
<|body_0|>
def ca... | stack_v2_sparse_classes_36k_train_024290 | 9,003 | permissive | [
{
"docstring": "Create a new action postprocessor. Args: brain_spec: A tfa_specs.BrainSpec. hparams: A dictionary of hyperparameters.",
"name": "__init__",
"signature": "def __init__(self, brain_spec, hparams)"
},
{
"docstring": "Call the action postprocessor to generate action outputs. Args: in... | 2 | null | Implement the Python class `ActionPostprocessor` described below.
Class description:
Creates action outputs from network outputs and observations.
Method signatures and docstrings:
- def __init__(self, brain_spec, hparams): Create a new action postprocessor. Args: brain_spec: A tfa_specs.BrainSpec. hparams: A diction... | Implement the Python class `ActionPostprocessor` described below.
Class description:
Creates action outputs from network outputs and observations.
Method signatures and docstrings:
- def __init__(self, brain_spec, hparams): Create a new action postprocessor. Args: brain_spec: A tfa_specs.BrainSpec. hparams: A diction... | 26ab377a6853463b2efce40970e54d44b91e79ca | <|skeleton|>
class ActionPostprocessor:
"""Creates action outputs from network outputs and observations."""
def __init__(self, brain_spec, hparams):
"""Create a new action postprocessor. Args: brain_spec: A tfa_specs.BrainSpec. hparams: A dictionary of hyperparameters."""
<|body_0|>
def ca... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ActionPostprocessor:
"""Creates action outputs from network outputs and observations."""
def __init__(self, brain_spec, hparams):
"""Create a new action postprocessor. Args: brain_spec: A tfa_specs.BrainSpec. hparams: A dictionary of hyperparameters."""
self._brain_spec = brain_spec
... | the_stack_v2_python_sparse | service/learner/brains/action_postprocessor.py | stewartmiles/falken | train | 1 |
1d41808229125aed317ccae89bf4798bd2229b2b | [
"result, n = (None, len(A))\nfor move in xrange(n):\n tmp = 0\n for i in xrange(n):\n tmp += A[i] * ((i + move) % n)\n result = max(tmp, result) if result else tmp\nreturn result if result else 0",
"result, n = (None, len(A))\ntotal = sum(A)\nprevious = 0\nfor i in xrange(n):\n previous += i * ... | <|body_start_0|>
result, n = (None, len(A))
for move in xrange(n):
tmp = 0
for i in xrange(n):
tmp += A[i] * ((i + move) % n)
result = max(tmp, result) if result else tmp
return result if result else 0
<|end_body_0|>
<|body_start_1|>
r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxRotateFunction(self, A):
""":type A: List[int] :rtype: int"""
<|body_0|>
def maxRotateFunction(self, A):
""":type A: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result, n = (None, len(A))
for move i... | stack_v2_sparse_classes_36k_train_024291 | 1,058 | no_license | [
{
"docstring": ":type A: List[int] :rtype: int",
"name": "maxRotateFunction",
"signature": "def maxRotateFunction(self, A)"
},
{
"docstring": ":type A: List[int] :rtype: int",
"name": "maxRotateFunction",
"signature": "def maxRotateFunction(self, A)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxRotateFunction(self, A): :type A: List[int] :rtype: int
- def maxRotateFunction(self, A): :type A: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxRotateFunction(self, A): :type A: List[int] :rtype: int
- def maxRotateFunction(self, A): :type A: List[int] :rtype: int
<|skeleton|>
class Solution:
def maxRotateFu... | ee79d3437cf47b26a4bca0ec798dc54d7b623453 | <|skeleton|>
class Solution:
def maxRotateFunction(self, A):
""":type A: List[int] :rtype: int"""
<|body_0|>
def maxRotateFunction(self, A):
""":type A: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxRotateFunction(self, A):
""":type A: List[int] :rtype: int"""
result, n = (None, len(A))
for move in xrange(n):
tmp = 0
for i in xrange(n):
tmp += A[i] * ((i + move) % n)
result = max(tmp, result) if result else tmp
... | the_stack_v2_python_sparse | Algorithm/Python/396. Rotate Function.py | WuLC/LeetCode | train | 29 | |
c989580a32933dbd363266bb5f576481a0c7bc6a | [
"FirstFit.__init__(self, seed)\nself.ranking = lambda x: sum(self.avl_resources[x].values())\n'\\n \\n Defines the ranking operator for sorting. Must use the self.avl_resources argument\\n (the available resource dictionary). x represents a key.\\n \\n '",
"if not nodes:... | <|body_start_0|>
FirstFit.__init__(self, seed)
self.ranking = lambda x: sum(self.avl_resources[x].values())
'\n \n Defines the ranking operator for sorting. Must use the self.avl_resources argument\n (the available resource dictionary). x represents a key.\n \... | Best-Fit Allocator It is an allocator which sorts the nodes basing on the amount of free resources, trying to consolidate. The less the available resources, the higher the priority. The allocator is based on ffp_alloc, changing only the sort and adjust methods. | BestFit | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BestFit:
"""Best-Fit Allocator It is an allocator which sorts the nodes basing on the amount of free resources, trying to consolidate. The less the available resources, the higher the priority. The allocator is based on ffp_alloc, changing only the sort and adjust methods."""
def __init__(se... | stack_v2_sparse_classes_36k_train_024292 | 20,954 | permissive | [
{
"docstring": "Constructor for the class. :param seed: seed for random events (not used) :param resource_manager: reference to the system resource manager :param kwargs: None at the moment",
"name": "__init__",
"signature": "def __init__(self, seed=0, **kwargs)"
},
{
"docstring": "Method which ... | 2 | stack_v2_sparse_classes_30k_train_017849 | Implement the Python class `BestFit` described below.
Class description:
Best-Fit Allocator It is an allocator which sorts the nodes basing on the amount of free resources, trying to consolidate. The less the available resources, the higher the priority. The allocator is based on ffp_alloc, changing only the sort and ... | Implement the Python class `BestFit` described below.
Class description:
Best-Fit Allocator It is an allocator which sorts the nodes basing on the amount of free resources, trying to consolidate. The less the available resources, the higher the priority. The allocator is based on ffp_alloc, changing only the sort and ... | 2a3c0e03ce770eddd4cb02b95ba84ebb552ea35b | <|skeleton|>
class BestFit:
"""Best-Fit Allocator It is an allocator which sorts the nodes basing on the amount of free resources, trying to consolidate. The less the available resources, the higher the priority. The allocator is based on ffp_alloc, changing only the sort and adjust methods."""
def __init__(se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BestFit:
"""Best-Fit Allocator It is an allocator which sorts the nodes basing on the amount of free resources, trying to consolidate. The less the available resources, the higher the priority. The allocator is based on ffp_alloc, changing only the sort and adjust methods."""
def __init__(self, seed=0, *... | the_stack_v2_python_sparse | accasim/base/allocator_class.py | cgalleguillosm/accasim | train | 3 |
1e4b7c3ad43fd8a997db78e3c5a0f64c39728ab9 | [
"pg.init()\nuser_data.load()\nSound.update()\npg.display.set_caption('Various Vipers | Saving the Earth')\nself.running = True\nself.mouse_x = self.mouse_y = int()\nself.event = None\nself.screen = pg.display.set_mode((WIDTH, HEIGHT))\nself.clock = pg.time.Clock()\nself.main_menu = MainMenu(self.screen)\nself.optio... | <|body_start_0|>
pg.init()
user_data.load()
Sound.update()
pg.display.set_caption('Various Vipers | Saving the Earth')
self.running = True
self.mouse_x = self.mouse_y = int()
self.event = None
self.screen = pg.display.set_mode((WIDTH, HEIGHT))
self... | Represents main game class. | Game | [
"CC0-1.0",
"CC-BY-4.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Game:
"""Represents main game class."""
def __init__(self):
"""Set initial values."""
<|body_0|>
def reset(self) -> None:
"""Reset and reinitialize main game view."""
<|body_1|>
def run(self) -> None:
"""Draw and get events."""
<|body... | stack_v2_sparse_classes_36k_train_024293 | 3,634 | permissive | [
{
"docstring": "Set initial values.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Reset and reinitialize main game view.",
"name": "reset",
"signature": "def reset(self) -> None"
},
{
"docstring": "Draw and get events.",
"name": "run",
"signat... | 6 | null | Implement the Python class `Game` described below.
Class description:
Represents main game class.
Method signatures and docstrings:
- def __init__(self): Set initial values.
- def reset(self) -> None: Reset and reinitialize main game view.
- def run(self) -> None: Draw and get events.
- def _get_events(self) -> None:... | Implement the Python class `Game` described below.
Class description:
Represents main game class.
Method signatures and docstrings:
- def __init__(self): Set initial values.
- def reset(self) -> None: Reset and reinitialize main game view.
- def run(self) -> None: Draw and get events.
- def _get_events(self) -> None:... | 3c2a1d1937aeed89bb891f5b6f93a6ce053af42a | <|skeleton|>
class Game:
"""Represents main game class."""
def __init__(self):
"""Set initial values."""
<|body_0|>
def reset(self) -> None:
"""Reset and reinitialize main game view."""
<|body_1|>
def run(self) -> None:
"""Draw and get events."""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Game:
"""Represents main game class."""
def __init__(self):
"""Set initial values."""
pg.init()
user_data.load()
Sound.update()
pg.display.set_caption('Various Vipers | Saving the Earth')
self.running = True
self.mouse_x = self.mouse_y = int()
... | the_stack_v2_python_sparse | various_vipers/project/game.py | python-discord/code-jam-5 | train | 32 |
2a4548b175ee3a42d29be97847c07a780669b96c | [
"self.basepath = basepath\nself.available_distributions = collections.defaultdict(list)\nself.available_architectures = collections.defaultdict(list)\nif not self.basepath or not os.path.isdir(self.basepath):\n log('sysroots are not available on this system\\n')\n return\nsysroots = os.listdir(self.basepath)\... | <|body_start_0|>
self.basepath = basepath
self.available_distributions = collections.defaultdict(list)
self.available_architectures = collections.defaultdict(list)
if not self.basepath or not os.path.isdir(self.basepath):
log('sysroots are not available on this system\n')
... | Utilities for sysroots. Public API: properties: - NotFoundError: exception class used for raising exceptions in this utility class - argparse_help: a string for arparse argument help generated based on availablity of sysroots - available: indicates whether or not there are any available sysroots - available_distributio... | Sysroot | [
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Sysroot:
"""Utilities for sysroots. Public API: properties: - NotFoundError: exception class used for raising exceptions in this utility class - argparse_help: a string for arparse argument help generated based on availablity of sysroots - available: indicates whether or not there are any availab... | stack_v2_sparse_classes_36k_train_024294 | 33,624 | permissive | [
{
"docstring": "Scan the configured sysroot base folder for available sysroots and initialize available distribution and architecture maps.",
"name": "__init__",
"signature": "def __init__(self, basepath)"
},
{
"docstring": "Return a path to the requested distribution and architecture sysroot. R... | 3 | stack_v2_sparse_classes_30k_train_016266 | Implement the Python class `Sysroot` described below.
Class description:
Utilities for sysroots. Public API: properties: - NotFoundError: exception class used for raising exceptions in this utility class - argparse_help: a string for arparse argument help generated based on availablity of sysroots - available: indicat... | Implement the Python class `Sysroot` described below.
Class description:
Utilities for sysroots. Public API: properties: - NotFoundError: exception class used for raising exceptions in this utility class - argparse_help: a string for arparse argument help generated based on availablity of sysroots - available: indicat... | 84e319101d4a1200657337dcdf9ed3857fc59e03 | <|skeleton|>
class Sysroot:
"""Utilities for sysroots. Public API: properties: - NotFoundError: exception class used for raising exceptions in this utility class - argparse_help: a string for arparse argument help generated based on availablity of sysroots - available: indicates whether or not there are any availab... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Sysroot:
"""Utilities for sysroots. Public API: properties: - NotFoundError: exception class used for raising exceptions in this utility class - argparse_help: a string for arparse argument help generated based on availablity of sysroots - available: indicates whether or not there are any available sysroots -... | the_stack_v2_python_sparse | chromium/src/build/infra/utilities.py | bopopescu/ofa | train | 0 |
3862d46f666a994feb8e92ed5576540c10705084 | [
"\"\"\"罗马数字转整数\n 击败了1%的解法。。。太差了\"\"\"\nmap_dict = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000, 'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900}\nnum = 0\ni = 0\nwhile i < len(s):\n if i + 1 < len(s) and map_dict.get(s[i:i + 2], None):\n num += map_dict[s[i:i + 2]]\n ... | <|body_start_0|>
"""罗马数字转整数
击败了1%的解法。。。太差了"""
map_dict = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000, 'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900}
num = 0
i = 0
while i < len(s):
if i + 1 < len(s) and map_dict.get(s[... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def romanToInt(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def romanToInt_2(self, s):
""":param s: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
"""罗马数字转整数
击败了1%的解法。。。太差了"""
map_dict = {'I': 1, 'V... | stack_v2_sparse_classes_36k_train_024295 | 1,818 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "romanToInt",
"signature": "def romanToInt(self, s)"
},
{
"docstring": ":param s: :return:",
"name": "romanToInt_2",
"signature": "def romanToInt_2(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003397 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def romanToInt(self, s): :type s: str :rtype: int
- def romanToInt_2(self, s): :param s: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def romanToInt(self, s): :type s: str :rtype: int
- def romanToInt_2(self, s): :param s: :return:
<|skeleton|>
class Solution:
def romanToInt(self, s):
""":type s: ... | 09b7121628df824f432b8cdd25c55f045b013c0b | <|skeleton|>
class Solution:
def romanToInt(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def romanToInt_2(self, s):
""":param s: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def romanToInt(self, s):
""":type s: str :rtype: int"""
"""罗马数字转整数
击败了1%的解法。。。太差了"""
map_dict = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000, 'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900}
num = 0
i = 0
... | the_stack_v2_python_sparse | tuter_start/13_int.py | cainingning/leetcode | train | 1 | |
bf37408db8d201db78f4b869343fea2dbb6c2034 | [
"logger.info('%s initialization' % obj.name)\nsuper(self.__class__, self).__init__(obj, parent)\nself.previous_position = [self.robot_parent.position_3d.x, self.robot_parent.position_3d.y, self.robot_parent.position_3d.z]\nself.previous_orientation = [self.robot_parent.position_3d.yaw, self.robot_parent.position_3d... | <|body_start_0|>
logger.info('%s initialization' % obj.name)
super(self.__class__, self).__init__(obj, parent)
self.previous_position = [self.robot_parent.position_3d.x, self.robot_parent.position_3d.y, self.robot_parent.position_3d.z]
self.previous_orientation = [self.robot_parent.posit... | Odometer sensor | OdometryClass | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OdometryClass:
"""Odometer sensor"""
def __init__(self, obj, parent=None):
"""Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the object's parent."""
<|body_0|>
def default_action(self):
"""Compute the ... | stack_v2_sparse_classes_36k_train_024296 | 2,637 | permissive | [
{
"docstring": "Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the object's parent.",
"name": "__init__",
"signature": "def __init__(self, obj, parent=None)"
},
{
"docstring": "Compute the relative position and rotation of the robot T... | 2 | null | Implement the Python class `OdometryClass` described below.
Class description:
Odometer sensor
Method signatures and docstrings:
- def __init__(self, obj, parent=None): Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the object's parent.
- def default_actio... | Implement the Python class `OdometryClass` described below.
Class description:
Odometer sensor
Method signatures and docstrings:
- def __init__(self, obj, parent=None): Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the object's parent.
- def default_actio... | 07fcb64fea3b58b258e917eb1aed0a585f863418 | <|skeleton|>
class OdometryClass:
"""Odometer sensor"""
def __init__(self, obj, parent=None):
"""Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the object's parent."""
<|body_0|>
def default_action(self):
"""Compute the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OdometryClass:
"""Odometer sensor"""
def __init__(self, obj, parent=None):
"""Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the object's parent."""
logger.info('%s initialization' % obj.name)
super(self.__class__, self... | the_stack_v2_python_sparse | src/morse/sensors/odometry.py | DefaultUser/morse | train | 2 |
9953623dc4c80ba0a2f2574630a8785f80adf645 | [
"result = []\nfor row in triangle:\n if not result:\n result.append(row)\n continue\n last_row = result[-1]\n new_row = []\n for index, value in enumerate(row):\n small_row = []\n if index != 0:\n small_row.append(value + last_row[index - 1])\n if index != l... | <|body_start_0|>
result = []
for row in triangle:
if not result:
result.append(row)
continue
last_row = result[-1]
new_row = []
for index, value in enumerate(row):
small_row = []
if index != 0... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _minimumTotal(self, triangle):
""":type triangle: List[List[int]] :rtype: int"""
<|body_0|>
def __minimumTotal(self, triangle):
""":type triangle: List[List[int]] :rtype: int"""
<|body_1|>
def minimumTotal(self, triangle):
""":type ... | stack_v2_sparse_classes_36k_train_024297 | 2,570 | permissive | [
{
"docstring": ":type triangle: List[List[int]] :rtype: int",
"name": "_minimumTotal",
"signature": "def _minimumTotal(self, triangle)"
},
{
"docstring": ":type triangle: List[List[int]] :rtype: int",
"name": "__minimumTotal",
"signature": "def __minimumTotal(self, triangle)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_020193 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int
- def __minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int
- def minimumTota... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int
- def __minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int
- def minimumTota... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _minimumTotal(self, triangle):
""":type triangle: List[List[int]] :rtype: int"""
<|body_0|>
def __minimumTotal(self, triangle):
""":type triangle: List[List[int]] :rtype: int"""
<|body_1|>
def minimumTotal(self, triangle):
""":type ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def _minimumTotal(self, triangle):
""":type triangle: List[List[int]] :rtype: int"""
result = []
for row in triangle:
if not result:
result.append(row)
continue
last_row = result[-1]
new_row = []
... | the_stack_v2_python_sparse | 120.triangle.py | windard/leeeeee | train | 0 | |
e50ec5e38dfe10068db788d6790ab1d2c6ccf760 | [
"super(TwoLayerNet, self).__init__()\nself.linear1 = nn.Linear(D_in, H)\nself.linear2 = nn.Linear(H, D_out)\nself.sigmoid = nn.Sigmoid()\nself.softmax = nn.Softmax(dim=1)",
"h1 = self.linear1(x)\nh1_s1 = self.sigmoid(h1)\nh2 = self.linear2(h1_s1)\nh2_s2 = self.sigmoid(h2)\nreturn h2_s2"
] | <|body_start_0|>
super(TwoLayerNet, self).__init__()
self.linear1 = nn.Linear(D_in, H)
self.linear2 = nn.Linear(H, D_out)
self.sigmoid = nn.Sigmoid()
self.softmax = nn.Softmax(dim=1)
<|end_body_0|>
<|body_start_1|>
h1 = self.linear1(x)
h1_s1 = self.sigmoid(h1)
... | TwoLayerNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TwoLayerNet:
def __init__(self, D_in, H, D_out):
"""In the constructor we instantiate two nn.Linear modules and assign them as member variables."""
<|body_0|>
def forward(self, x):
"""In the forward function we accept a Tensor of input data and we must return a Tenso... | stack_v2_sparse_classes_36k_train_024298 | 3,920 | no_license | [
{
"docstring": "In the constructor we instantiate two nn.Linear modules and assign them as member variables.",
"name": "__init__",
"signature": "def __init__(self, D_in, H, D_out)"
},
{
"docstring": "In the forward function we accept a Tensor of input data and we must return a Tensor of output d... | 2 | stack_v2_sparse_classes_30k_train_000538 | Implement the Python class `TwoLayerNet` described below.
Class description:
Implement the TwoLayerNet class.
Method signatures and docstrings:
- def __init__(self, D_in, H, D_out): In the constructor we instantiate two nn.Linear modules and assign them as member variables.
- def forward(self, x): In the forward func... | Implement the Python class `TwoLayerNet` described below.
Class description:
Implement the TwoLayerNet class.
Method signatures and docstrings:
- def __init__(self, D_in, H, D_out): In the constructor we instantiate two nn.Linear modules and assign them as member variables.
- def forward(self, x): In the forward func... | a27d1589d639c86fd7572396b00d3bb87341e42b | <|skeleton|>
class TwoLayerNet:
def __init__(self, D_in, H, D_out):
"""In the constructor we instantiate two nn.Linear modules and assign them as member variables."""
<|body_0|>
def forward(self, x):
"""In the forward function we accept a Tensor of input data and we must return a Tenso... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TwoLayerNet:
def __init__(self, D_in, H, D_out):
"""In the constructor we instantiate two nn.Linear modules and assign them as member variables."""
super(TwoLayerNet, self).__init__()
self.linear1 = nn.Linear(D_in, H)
self.linear2 = nn.Linear(H, D_out)
self.sigmoid = nn... | the_stack_v2_python_sparse | CNN/failed_test.py | Darkhunter9/10-701_caltech101 | train | 0 | |
138f7156beb6f43e19cc2c537fb615849f8a81b3 | [
"ohlc = self.dm.quotes()\nma_periods = 10\nperiods_to_alpha = 2 / (ma_periods + 1)\ntypical_px = (ohlc.h + ohlc.l + ohlc.c) / 3.0\ntypical_avg = lp_filter(typical_px, 1, periods_to_alpha)\nlp_freqs = np.arange(periods_to_alpha / 4, periods_to_alpha * 2, periods_to_alpha / 4)\nlp_df = pd.DataFrame(index=typical_avg.... | <|body_start_0|>
ohlc = self.dm.quotes()
ma_periods = 10
periods_to_alpha = 2 / (ma_periods + 1)
typical_px = (ohlc.h + ohlc.l + ohlc.c) / 3.0
typical_avg = lp_filter(typical_px, 1, periods_to_alpha)
lp_freqs = np.arange(periods_to_alpha / 4, periods_to_alpha * 2, periods... | EXOSemiFuture_DynKel_80_20_shorts_lp | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EXOSemiFuture_DynKel_80_20_shorts_lp:
def calc_exo_logic(self):
"""Calculates SmartEXO logic. NOTE: this method must use self.dm.quotes() or self.dm.quotes(series_key='for_secondary_series') to calculate SmartEXO logic :return: Pandas.DataFrame with index like in dm.quotes() (i.e. primar... | stack_v2_sparse_classes_36k_train_024299 | 6,765 | no_license | [
{
"docstring": "Calculates SmartEXO logic. NOTE: this method must use self.dm.quotes() or self.dm.quotes(series_key='for_secondary_series') to calculate SmartEXO logic :return: Pandas.DataFrame with index like in dm.quotes() (i.e. primary quotes)",
"name": "calc_exo_logic",
"signature": "def calc_exo_lo... | 3 | stack_v2_sparse_classes_30k_train_021286 | Implement the Python class `EXOSemiFuture_DynKel_80_20_shorts_lp` described below.
Class description:
Implement the EXOSemiFuture_DynKel_80_20_shorts_lp class.
Method signatures and docstrings:
- def calc_exo_logic(self): Calculates SmartEXO logic. NOTE: this method must use self.dm.quotes() or self.dm.quotes(series_... | Implement the Python class `EXOSemiFuture_DynKel_80_20_shorts_lp` described below.
Class description:
Implement the EXOSemiFuture_DynKel_80_20_shorts_lp class.
Method signatures and docstrings:
- def calc_exo_logic(self): Calculates SmartEXO logic. NOTE: this method must use self.dm.quotes() or self.dm.quotes(series_... | 53a929a0a5698c57acd778abf2b7f16154697faa | <|skeleton|>
class EXOSemiFuture_DynKel_80_20_shorts_lp:
def calc_exo_logic(self):
"""Calculates SmartEXO logic. NOTE: this method must use self.dm.quotes() or self.dm.quotes(series_key='for_secondary_series') to calculate SmartEXO logic :return: Pandas.DataFrame with index like in dm.quotes() (i.e. primar... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EXOSemiFuture_DynKel_80_20_shorts_lp:
def calc_exo_logic(self):
"""Calculates SmartEXO logic. NOTE: this method must use self.dm.quotes() or self.dm.quotes(series_key='for_secondary_series') to calculate SmartEXO logic :return: Pandas.DataFrame with index like in dm.quotes() (i.e. primary quotes)"""
... | the_stack_v2_python_sparse | tmqrindex/deployed/exo_semifuture_dynkel_80_20_shorts_lp.py | trendmanagement/Tmqr-framework-2 | train | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.