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
aebf74c7a423da1aea7c9bcbc05a9562b76a712b
[ "variant = super().create(**kwargs)\nfrom .tasks import update_product_minimal_variant_price_task\nupdate_product_minimal_variant_price_task.delay(variant.product_id)\nreturn variant", "variants = super().bulk_create(objs, batch_size=batch_size, ignore_conflicts=ignore_conflicts)\nproduct_ids = set()\nfor obj in ...
<|body_start_0|> variant = super().create(**kwargs) from .tasks import update_product_minimal_variant_price_task update_product_minimal_variant_price_task.delay(variant.product_id) return variant <|end_body_0|> <|body_start_1|> variants = super().bulk_create(objs, batch_size=bat...
ProductVariantQueryset
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductVariantQueryset: def create(self, **kwargs): """Create a product's variant. After the creation update the "minimal_variant_price" of the product.""" <|body_0|> def bulk_create(self, objs, batch_size=None, ignore_conflicts=False): """Insert each of the product'...
stack_v2_sparse_classes_36k_train_030900
20,044
permissive
[ { "docstring": "Create a product's variant. After the creation update the \"minimal_variant_price\" of the product.", "name": "create", "signature": "def create(self, **kwargs)" }, { "docstring": "Insert each of the product's variant instances into the database. After the creation update the \"m...
2
null
Implement the Python class `ProductVariantQueryset` described below. Class description: Implement the ProductVariantQueryset class. Method signatures and docstrings: - def create(self, **kwargs): Create a product's variant. After the creation update the "minimal_variant_price" of the product. - def bulk_create(self, ...
Implement the Python class `ProductVariantQueryset` described below. Class description: Implement the ProductVariantQueryset class. Method signatures and docstrings: - def create(self, **kwargs): Create a product's variant. After the creation update the "minimal_variant_price" of the product. - def bulk_create(self, ...
0a190ca9bcf96cf44f7773686205f2c1f83f3769
<|skeleton|> class ProductVariantQueryset: def create(self, **kwargs): """Create a product's variant. After the creation update the "minimal_variant_price" of the product.""" <|body_0|> def bulk_create(self, objs, batch_size=None, ignore_conflicts=False): """Insert each of the product'...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProductVariantQueryset: def create(self, **kwargs): """Create a product's variant. After the creation update the "minimal_variant_price" of the product.""" variant = super().create(**kwargs) from .tasks import update_product_minimal_variant_price_task update_product_minimal_var...
the_stack_v2_python_sparse
product/new_product.py
rajeshr188/django-onex
train
2
bcb1386226f451d7ab531307f78a957a193fdae4
[ "self.trigger = trigger\nself.loan = message_ctx.get('loan', {})\ntemplates = dict(self.default_templates, **current_app.config['ILS_MAIL_LOAN_TEMPLATES'])\nif not self.trigger or self.trigger not in templates:\n raise KeyError('Invalid trigger argument `{0}` or not found in templates `{1}`.'.format(self.trigger...
<|body_start_0|> self.trigger = trigger self.loan = message_ctx.get('loan', {}) templates = dict(self.default_templates, **current_app.config['ILS_MAIL_LOAN_TEMPLATES']) if not self.trigger or self.trigger not in templates: raise KeyError('Invalid trigger argument `{0}` or no...
Loan message.
LoanMessage
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoanMessage: """Loan message.""" def __init__(self, trigger, message_ctx, **kwargs): """Create loan message based on the trigger.""" <|body_0|> def trigger_template(self): """Get the template filename based on the trigger.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_030901
2,471
permissive
[ { "docstring": "Create loan message based on the trigger.", "name": "__init__", "signature": "def __init__(self, trigger, message_ctx, **kwargs)" }, { "docstring": "Get the template filename based on the trigger.", "name": "trigger_template", "signature": "def trigger_template(self)" }...
2
stack_v2_sparse_classes_30k_train_002774
Implement the Python class `LoanMessage` described below. Class description: Loan message. Method signatures and docstrings: - def __init__(self, trigger, message_ctx, **kwargs): Create loan message based on the trigger. - def trigger_template(self): Get the template filename based on the trigger.
Implement the Python class `LoanMessage` described below. Class description: Loan message. Method signatures and docstrings: - def __init__(self, trigger, message_ctx, **kwargs): Create loan message based on the trigger. - def trigger_template(self): Get the template filename based on the trigger. <|skeleton|> class...
42ba282968d0aa28fb1bfc71d0709685165aaec4
<|skeleton|> class LoanMessage: """Loan message.""" def __init__(self, trigger, message_ctx, **kwargs): """Create loan message based on the trigger.""" <|body_0|> def trigger_template(self): """Get the template filename based on the trigger.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoanMessage: """Loan message.""" def __init__(self, trigger, message_ctx, **kwargs): """Create loan message based on the trigger.""" self.trigger = trigger self.loan = message_ctx.get('loan', {}) templates = dict(self.default_templates, **current_app.config['ILS_MAIL_LOAN_...
the_stack_v2_python_sparse
invenio_app_ils/circulation/mail/messages.py
equadon/invenio-app-ils
train
0
4da9a2adcf6b4f7281dd1a661bd15c6a96d226d8
[ "self._api_key = api_key\nself.latitude = latitude\nself.longitude = longitude\nself.requested_units = units\nself.data = None\nself.currently = None\nself.hourly = None\nself.daily = None\nself._connect_error = False", "try:\n self.data = forecastio.load_forecast(self._api_key, self.latitude, self.longitude, ...
<|body_start_0|> self._api_key = api_key self.latitude = latitude self.longitude = longitude self.requested_units = units self.data = None self.currently = None self.hourly = None self.daily = None self._connect_error = False <|end_body_0|> <|body...
Get the latest data from Dark Sky.
DarkSkyData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DarkSkyData: """Get the latest data from Dark Sky.""" def __init__(self, api_key, latitude, longitude, units): """Initialize the data object.""" <|body_0|> def update(self): """Get the latest data from Dark Sky.""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_030902
9,045
permissive
[ { "docstring": "Initialize the data object.", "name": "__init__", "signature": "def __init__(self, api_key, latitude, longitude, units)" }, { "docstring": "Get the latest data from Dark Sky.", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_004449
Implement the Python class `DarkSkyData` described below. Class description: Get the latest data from Dark Sky. Method signatures and docstrings: - def __init__(self, api_key, latitude, longitude, units): Initialize the data object. - def update(self): Get the latest data from Dark Sky.
Implement the Python class `DarkSkyData` described below. Class description: Get the latest data from Dark Sky. Method signatures and docstrings: - def __init__(self, api_key, latitude, longitude, units): Initialize the data object. - def update(self): Get the latest data from Dark Sky. <|skeleton|> class DarkSkyDat...
bfa315be51371a1b63e04342a0b275a57ae148bd
<|skeleton|> class DarkSkyData: """Get the latest data from Dark Sky.""" def __init__(self, api_key, latitude, longitude, units): """Initialize the data object.""" <|body_0|> def update(self): """Get the latest data from Dark Sky.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DarkSkyData: """Get the latest data from Dark Sky.""" def __init__(self, api_key, latitude, longitude, units): """Initialize the data object.""" self._api_key = api_key self.latitude = latitude self.longitude = longitude self.requested_units = units self.da...
the_stack_v2_python_sparse
homeassistant/components/darksky/weather.py
bdraco/home-assistant
train
13
d71368117861e3ff97d5936e9e363f1e4234c5e8
[ "try:\n return Theme.objects.get(pk=pk_theme)\nexcept Theme.DoesNotExist:\n raise Http404", "theme = self.get_object(pk)\nresponse = self.serializer(theme)\nreturn Response(response.data, status=status.HTTP_200_OK)", "theme = self.get_object(pk)\nresponse = self.serializer(theme, data=request.data)\nif re...
<|body_start_0|> try: return Theme.objects.get(pk=pk_theme) except Theme.DoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> theme = self.get_object(pk) response = self.serializer(theme) return Response(response.data, status=status.HTTP_200_OK) <|...
...
VThemeDetail
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VThemeDetail: """...""" def get_object(self, pk_theme: Union[str, int]): """...""" <|body_0|> def get(self, request, pk: Union[str, int], format=None): """...""" <|body_1|> def put(self, request, pk: Union[str, int], format=None): """...""" ...
stack_v2_sparse_classes_36k_train_030903
2,319
permissive
[ { "docstring": "...", "name": "get_object", "signature": "def get_object(self, pk_theme: Union[str, int])" }, { "docstring": "...", "name": "get", "signature": "def get(self, request, pk: Union[str, int], format=None)" }, { "docstring": "...", "name": "put", "signature": ...
4
stack_v2_sparse_classes_30k_train_014310
Implement the Python class `VThemeDetail` described below. Class description: ... Method signatures and docstrings: - def get_object(self, pk_theme: Union[str, int]): ... - def get(self, request, pk: Union[str, int], format=None): ... - def put(self, request, pk: Union[str, int], format=None): ... - def delete(self, ...
Implement the Python class `VThemeDetail` described below. Class description: ... Method signatures and docstrings: - def get_object(self, pk_theme: Union[str, int]): ... - def get(self, request, pk: Union[str, int], format=None): ... - def put(self, request, pk: Union[str, int], format=None): ... - def delete(self, ...
660664ba2321499e92c3c5c23719756db2569e90
<|skeleton|> class VThemeDetail: """...""" def get_object(self, pk_theme: Union[str, int]): """...""" <|body_0|> def get(self, request, pk: Union[str, int], format=None): """...""" <|body_1|> def put(self, request, pk: Union[str, int], format=None): """...""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VThemeDetail: """...""" def get_object(self, pk_theme: Union[str, int]): """...""" try: return Theme.objects.get(pk=pk_theme) except Theme.DoesNotExist: raise Http404 def get(self, request, pk: Union[str, int], format=None): """...""" t...
the_stack_v2_python_sparse
apps/theme/views/vtheme.py
magocod/djrepo
train
1
24b3e4e1ebe7c48e67a558fd5e67f0b5250d01dc
[ "ctx.batch_size = tensor.shape[0]\ngathered_tensor = [torch.zeros_like(tensor) for _ in range(torch.distributed.get_world_size())]\ntorch.distributed.all_gather(gathered_tensor, tensor.contiguous())\nreturn torch.cat(gathered_tensor, 0)", "start_idx = torch.distributed.get_rank() * ctx.batch_size\nstop_idx = star...
<|body_start_0|> ctx.batch_size = tensor.shape[0] gathered_tensor = [torch.zeros_like(tensor) for _ in range(torch.distributed.get_world_size())] torch.distributed.all_gather(gathered_tensor, tensor.contiguous()) return torch.cat(gathered_tensor, 0) <|end_body_0|> <|body_start_1|> ...
ConcatenateAll
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license", "CC-BY-NC-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConcatenateAll: def forward(ctx: Any, tensor: Tensor) -> Tensor: """Concatenates tensors from all GPUs.""" <|body_0|> def backward(ctx: Any, grad_output: Tensor) -> Tensor: """Sums the gradients from all GPUs and takes the ones corresponding to our mini-batch.""" ...
stack_v2_sparse_classes_36k_train_030904
7,051
permissive
[ { "docstring": "Concatenates tensors from all GPUs.", "name": "forward", "signature": "def forward(ctx: Any, tensor: Tensor) -> Tensor" }, { "docstring": "Sums the gradients from all GPUs and takes the ones corresponding to our mini-batch.", "name": "backward", "signature": "def backward...
2
null
Implement the Python class `ConcatenateAll` described below. Class description: Implement the ConcatenateAll class. Method signatures and docstrings: - def forward(ctx: Any, tensor: Tensor) -> Tensor: Concatenates tensors from all GPUs. - def backward(ctx: Any, grad_output: Tensor) -> Tensor: Sums the gradients from ...
Implement the Python class `ConcatenateAll` described below. Class description: Implement the ConcatenateAll class. Method signatures and docstrings: - def forward(ctx: Any, tensor: Tensor) -> Tensor: Concatenates tensors from all GPUs. - def backward(ctx: Any, grad_output: Tensor) -> Tensor: Sums the gradients from ...
bdf311369b236c1e3d0336c7ed4ba249854f8606
<|skeleton|> class ConcatenateAll: def forward(ctx: Any, tensor: Tensor) -> Tensor: """Concatenates tensors from all GPUs.""" <|body_0|> def backward(ctx: Any, grad_output: Tensor) -> Tensor: """Sums the gradients from all GPUs and takes the ones corresponding to our mini-batch.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConcatenateAll: def forward(ctx: Any, tensor: Tensor) -> Tensor: """Concatenates tensors from all GPUs.""" ctx.batch_size = tensor.shape[0] gathered_tensor = [torch.zeros_like(tensor) for _ in range(torch.distributed.get_world_size())] torch.distributed.all_gather(gathered_tens...
the_stack_v2_python_sparse
src/pl_bolts/models/self_supervised/moco/utils.py
Lightning-Universe/lightning-bolts
train
76
23683020a85a94ac8efbd08f1a25be6dc99f3530
[ "if self._os is None:\n os_name = sys.platform\n if os_name.lower().startswith('linux'):\n os_name = 'Linux'\n elif os_name == 'win32':\n os_name = 'Win32'\n elif os_name == 'cygwin':\n os_name = 'Cygwin'\n elif os_name == 'darwin':\n os_name = 'Darwin'\n self._os = os_...
<|body_start_0|> if self._os is None: os_name = sys.platform if os_name.lower().startswith('linux'): os_name = 'Linux' elif os_name == 'win32': os_name = 'Win32' elif os_name == 'cygwin': os_name = 'Cygwin' ...
Mange User-Agent settings when talking to external services We follow the style as documented here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent
UserAgent
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserAgent: """Mange User-Agent settings when talking to external services We follow the style as documented here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent""" def os(self): """The operating system name.""" <|body_0|> def repo(self): """...
stack_v2_sparse_classes_36k_train_030905
11,001
permissive
[ { "docstring": "The operating system name.", "name": "os", "signature": "def os(self)" }, { "docstring": "The UA when connecting directly from repo.", "name": "repo", "signature": "def repo(self)" }, { "docstring": "The UA when running git.", "name": "git", "signature": "...
3
stack_v2_sparse_classes_30k_train_015948
Implement the Python class `UserAgent` described below. Class description: Mange User-Agent settings when talking to external services We follow the style as documented here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent Method signatures and docstrings: - def os(self): The operating system nam...
Implement the Python class `UserAgent` described below. Class description: Mange User-Agent settings when talking to external services We follow the style as documented here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent Method signatures and docstrings: - def os(self): The operating system nam...
edcaa94ca86d29c1ea106eddac837f4a699379ba
<|skeleton|> class UserAgent: """Mange User-Agent settings when talking to external services We follow the style as documented here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent""" def os(self): """The operating system name.""" <|body_0|> def repo(self): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserAgent: """Mange User-Agent settings when talking to external services We follow the style as documented here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent""" def os(self): """The operating system name.""" if self._os is None: os_name = sys.platform ...
the_stack_v2_python_sparse
git_command.py
GerritCodeReview/git-repo
train
274
ea64585ad2159e3910c01d657ab4f8dee1850a47
[ "super().__init__(name)\nif match is None:\n match = lambda _: True\nif loader is None:\n loader = DefaultPackageRepositoryLoader()\nself.match = match\nself.loader = loader", "if (path := pathfromlocation(location)):\n if path.exists() and self.match(path):\n return self.loader.load(location.name...
<|body_start_0|> super().__init__(name) if match is None: match = lambda _: True if loader is None: loader = DefaultPackageRepositoryLoader() self.match = match self.loader = loader <|end_body_0|> <|body_start_1|> if (path := pathfromlocation(loca...
Provide a package from the local filesystem.
LocalProvider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocalProvider: """Provide a package from the local filesystem.""" def __init__(self, name: str='local', /, *, match: Optional[PathMatcher]=None, loader: Optional[PackageRepositoryLoader]=None) -> None: """Initialize.""" <|body_0|> def provide(self, location: Location) ->...
stack_v2_sparse_classes_36k_train_030906
4,520
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, name: str='local', /, *, match: Optional[PathMatcher]=None, loader: Optional[PackageRepositoryLoader]=None) -> None" }, { "docstring": "Retrieve the package repository at the given location.", "name": "provide...
2
null
Implement the Python class `LocalProvider` described below. Class description: Provide a package from the local filesystem. Method signatures and docstrings: - def __init__(self, name: str='local', /, *, match: Optional[PathMatcher]=None, loader: Optional[PackageRepositoryLoader]=None) -> None: Initialize. - def prov...
Implement the Python class `LocalProvider` described below. Class description: Provide a package from the local filesystem. Method signatures and docstrings: - def __init__(self, name: str='local', /, *, match: Optional[PathMatcher]=None, loader: Optional[PackageRepositoryLoader]=None) -> None: Initialize. - def prov...
c6b26377153d60d5da825002e03f9a28467378a9
<|skeleton|> class LocalProvider: """Provide a package from the local filesystem.""" def __init__(self, name: str='local', /, *, match: Optional[PathMatcher]=None, loader: Optional[PackageRepositoryLoader]=None) -> None: """Initialize.""" <|body_0|> def provide(self, location: Location) ->...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LocalProvider: """Provide a package from the local filesystem.""" def __init__(self, name: str='local', /, *, match: Optional[PathMatcher]=None, loader: Optional[PackageRepositoryLoader]=None) -> None: """Initialize.""" super().__init__(name) if match is None: match = ...
the_stack_v2_python_sparse
src/cutty/packages/domain/providers.py
cjolowicz/cutty
train
4
cf0f0d60a1504f875cffb931bafc08cb7349e0e2
[ "self.max = float('-inf')\nself.helper(root)\nreturn self.max", "if node is None:\n return (float('-inf'), float('inf'))\nleft_max, left_min = self.helper(node.left)\nright_max, right_min = self.helper(node.right)\ndescent_max = max(left_max, right_max)\ndescent_min = min(left_min, right_min)\nif descent_max !...
<|body_start_0|> self.max = float('-inf') self.helper(root) return self.max <|end_body_0|> <|body_start_1|> if node is None: return (float('-inf'), float('inf')) left_max, left_min = self.helper(node.left) right_max, right_min = self.helper(node.right) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxAncestorDiff(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def helper(self, node): """return the maximum and minimun node value of all descendants of parameter `node`""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_030907
2,711
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "maxAncestorDiff", "signature": "def maxAncestorDiff(self, root)" }, { "docstring": "return the maximum and minimun node value of all descendants of parameter `node`", "name": "helper", "signature": "def helper(self, node)" } ]
2
stack_v2_sparse_classes_30k_test_000742
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxAncestorDiff(self, root): :type root: TreeNode :rtype: int - def helper(self, node): return the maximum and minimun node value of all descendants of parameter `node`
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxAncestorDiff(self, root): :type root: TreeNode :rtype: int - def helper(self, node): return the maximum and minimun node value of all descendants of parameter `node` <|sk...
34a78e06d493e61b21d4442747e9102abf9b319b
<|skeleton|> class Solution: def maxAncestorDiff(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def helper(self, node): """return the maximum and minimun node value of all descendants of parameter `node`""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxAncestorDiff(self, root): """:type root: TreeNode :rtype: int""" self.max = float('-inf') self.helper(root) return self.max def helper(self, node): """return the maximum and minimun node value of all descendants of parameter `node`""" if no...
the_stack_v2_python_sparse
1026_Maximum_Differnce_Between_Node_and_Ancestor.py
sunnyyeti/Leetcode-solutions
train
0
f4a5cc685caf7747ed8dad6b3e143696a62f7096
[ "self._whithout_iren_start = whithout_iren_start\nself.showm = showm\nself.window2image_filter = vtk.vtkWindowToImageFilter()\nself.window2image_filter.SetInput(self.showm.window)\nself.image_buffers = []\nself.image_buffer_names = []\nself.info_buffer_name = None\nself.image_reprs = []\nself.num_buffers = num_buff...
<|body_start_0|> self._whithout_iren_start = whithout_iren_start self.showm = showm self.window2image_filter = vtk.vtkWindowToImageFilter() self.window2image_filter.SetInput(self.showm.window) self.image_buffers = [] self.image_buffer_names = [] self.info_buffer_n...
This obj is responsible to create a StreamClient.
FuryStreamClient
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FuryStreamClient: """This obj is responsible to create a StreamClient.""" def __init__(self, showm, max_window_size=None, use_raw_array=True, whithout_iren_start=False, num_buffers=2): """A StreamClient extracts a framebuffer from the OpenGL context and writes into a shared memory re...
stack_v2_sparse_classes_36k_train_030908
12,536
permissive
[ { "docstring": "A StreamClient extracts a framebuffer from the OpenGL context and writes into a shared memory resource. Parameters ---------- showm : ShowManager max_window_size : tuple of ints, optional This allows resize events inside of the FURY window instance. Should be greater than the window size. use_ra...
4
stack_v2_sparse_classes_30k_train_004718
Implement the Python class `FuryStreamClient` described below. Class description: This obj is responsible to create a StreamClient. Method signatures and docstrings: - def __init__(self, showm, max_window_size=None, use_raw_array=True, whithout_iren_start=False, num_buffers=2): A StreamClient extracts a framebuffer f...
Implement the Python class `FuryStreamClient` described below. Class description: This obj is responsible to create a StreamClient. Method signatures and docstrings: - def __init__(self, showm, max_window_size=None, use_raw_array=True, whithout_iren_start=False, num_buffers=2): A StreamClient extracts a framebuffer f...
e595bad0246899d58d24121dcc291eb050721f9f
<|skeleton|> class FuryStreamClient: """This obj is responsible to create a StreamClient.""" def __init__(self, showm, max_window_size=None, use_raw_array=True, whithout_iren_start=False, num_buffers=2): """A StreamClient extracts a framebuffer from the OpenGL context and writes into a shared memory re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FuryStreamClient: """This obj is responsible to create a StreamClient.""" def __init__(self, showm, max_window_size=None, use_raw_array=True, whithout_iren_start=False, num_buffers=2): """A StreamClient extracts a framebuffer from the OpenGL context and writes into a shared memory resource. Param...
the_stack_v2_python_sparse
fury/stream/client.py
fury-gl/fury
train
209
cf220b474653884bff6845600cb796a388e52fa2
[ "self.cur: pymysql.cursors.Cursor = db_connection.get_cursor()\nself.db_name: str = db_connection.db_name\nself.check_db_schema()", "self.cur.execute('SHOW TABLES;')\ntables = self.cur.fetchall()\nif not tables:\n msg = 'No tables found in database: Run generator script!'\n logging.exception(msg)\n raise...
<|body_start_0|> self.cur: pymysql.cursors.Cursor = db_connection.get_cursor() self.db_name: str = db_connection.db_name self.check_db_schema() <|end_body_0|> <|body_start_1|> self.cur.execute('SHOW TABLES;') tables = self.cur.fetchall() if not tables: msg = ...
Check the database schema for exoskeleton.
DatabaseSchemaCheck
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseSchemaCheck: """Check the database schema for exoskeleton.""" def __init__(self, db_connection: database_connection.DatabaseConnection) -> None: """Sets defaults""" <|body_0|> def __check_table_existence(self) -> bool: """Check if all expected tables exis...
stack_v2_sparse_classes_36k_train_030909
7,443
permissive
[ { "docstring": "Sets defaults", "name": "__init__", "signature": "def __init__(self, db_connection: database_connection.DatabaseConnection) -> None" }, { "docstring": "Check if all expected tables exist.", "name": "__check_table_existence", "signature": "def __check_table_existence(self)...
6
stack_v2_sparse_classes_30k_train_000514
Implement the Python class `DatabaseSchemaCheck` described below. Class description: Check the database schema for exoskeleton. Method signatures and docstrings: - def __init__(self, db_connection: database_connection.DatabaseConnection) -> None: Sets defaults - def __check_table_existence(self) -> bool: Check if all...
Implement the Python class `DatabaseSchemaCheck` described below. Class description: Check the database schema for exoskeleton. Method signatures and docstrings: - def __init__(self, db_connection: database_connection.DatabaseConnection) -> None: Sets defaults - def __check_table_existence(self) -> bool: Check if all...
2cdeaeca0094a7aa37c5e2b78a0e4c82da609817
<|skeleton|> class DatabaseSchemaCheck: """Check the database schema for exoskeleton.""" def __init__(self, db_connection: database_connection.DatabaseConnection) -> None: """Sets defaults""" <|body_0|> def __check_table_existence(self) -> bool: """Check if all expected tables exis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatabaseSchemaCheck: """Check the database schema for exoskeleton.""" def __init__(self, db_connection: database_connection.DatabaseConnection) -> None: """Sets defaults""" self.cur: pymysql.cursors.Cursor = db_connection.get_cursor() self.db_name: str = db_connection.db_name ...
the_stack_v2_python_sparse
exoskeleton/database_schema_check.py
RuedigerVoigt/exoskeleton
train
23
904269380f0bbb9550daf93798583a2ee4c71bab
[ "salt = uuid.uuid4().hex.encode('utf-8')\nhashed_password = hashlib.sha512(password.encode('utf-8') + salt).hexdigest()\nself.master_password = hashed_password\nself.save()", "check = hmac.compare_digest(crypt.crypt(password, self.password), self.password)\nif not check:\n raise ValueError(\"hashed version doe...
<|body_start_0|> salt = uuid.uuid4().hex.encode('utf-8') hashed_password = hashlib.sha512(password.encode('utf-8') + salt).hexdigest() self.master_password = hashed_password self.save() <|end_body_0|> <|body_start_1|> check = hmac.compare_digest(crypt.crypt(password, self.passwo...
Standard user model. Stores minimal data about the user to handle the authentication, like email, username, and auth token, apart from some extra parameters for administration.
User
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: """Standard user model. Stores minimal data about the user to handle the authentication, like email, username, and auth token, apart from some extra parameters for administration.""" def set_master_password(self, password): """Method to set the password of the user. If the user...
stack_v2_sparse_classes_36k_train_030910
2,707
permissive
[ { "docstring": "Method to set the password of the user. If the user registers through social networks, this method will be called to create a scrambled password.", "name": "set_master_password", "signature": "def set_master_password(self, password)" }, { "docstring": "Method to check that the se...
2
stack_v2_sparse_classes_30k_train_021246
Implement the Python class `User` described below. Class description: Standard user model. Stores minimal data about the user to handle the authentication, like email, username, and auth token, apart from some extra parameters for administration. Method signatures and docstrings: - def set_master_password(self, passw...
Implement the Python class `User` described below. Class description: Standard user model. Stores minimal data about the user to handle the authentication, like email, username, and auth token, apart from some extra parameters for administration. Method signatures and docstrings: - def set_master_password(self, passw...
6344a63dd3009179c05ccb7bf9d98e22999ad2a3
<|skeleton|> class User: """Standard user model. Stores minimal data about the user to handle the authentication, like email, username, and auth token, apart from some extra parameters for administration.""" def set_master_password(self, password): """Method to set the password of the user. If the user...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class User: """Standard user model. Stores minimal data about the user to handle the authentication, like email, username, and auth token, apart from some extra parameters for administration.""" def set_master_password(self, password): """Method to set the password of the user. If the user registers th...
the_stack_v2_python_sparse
sikre/models/users.py
gnef/sikr
train
0
a184c10bc5a33f14401a45ca96bc88c0ee033b86
[ "try:\n resp = Node().get_data_by_id(uid)\n return masked_json_template(resp, 200)\nexcept:\n abort(400, 'Input unrecognizable.')", "try:\n json_data = api.payload\n resp = Node().update_data_by_id(uid, json_data)\n return masked_json_template(resp, 200)\nexcept:\n abort(400, 'Input unrecogni...
<|body_start_0|> try: resp = Node().get_data_by_id(uid) return masked_json_template(resp, 200) except: abort(400, 'Input unrecognizable.') <|end_body_0|> <|body_start_1|> try: json_data = api.payload resp = Node().update_data_by_id(uid...
DroneIDFindRoute
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DroneIDFindRoute: def get(self, uid): """Get data by ID""" <|body_0|> def put(self, uid): """Update data by ID""" <|body_1|> def delete(self, uid): """Delete data by ID""" <|body_2|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_36k_train_030911
4,218
permissive
[ { "docstring": "Get data by ID", "name": "get", "signature": "def get(self, uid)" }, { "docstring": "Update data by ID", "name": "put", "signature": "def put(self, uid)" }, { "docstring": "Delete data by ID", "name": "delete", "signature": "def delete(self, uid)" } ]
3
stack_v2_sparse_classes_30k_train_002350
Implement the Python class `DroneIDFindRoute` described below. Class description: Implement the DroneIDFindRoute class. Method signatures and docstrings: - def get(self, uid): Get data by ID - def put(self, uid): Update data by ID - def delete(self, uid): Delete data by ID
Implement the Python class `DroneIDFindRoute` described below. Class description: Implement the DroneIDFindRoute class. Method signatures and docstrings: - def get(self, uid): Get data by ID - def put(self, uid): Update data by ID - def delete(self, uid): Delete data by ID <|skeleton|> class DroneIDFindRoute: d...
100fca0d2dd9b0b2ab2fa5974d8126af35ddcfd1
<|skeleton|> class DroneIDFindRoute: def get(self, uid): """Get data by ID""" <|body_0|> def put(self, uid): """Update data by ID""" <|body_1|> def delete(self, uid): """Delete data by ID""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DroneIDFindRoute: def get(self, uid): """Get data by ID""" try: resp = Node().get_data_by_id(uid) return masked_json_template(resp, 200) except: abort(400, 'Input unrecognizable.') def put(self, uid): """Update data by ID""" try:...
the_stack_v2_python_sparse
app/controllers/api/node/node.py
ardihikaru/api-dashboard-5g-dive
train
0
e24b0d307cfa8afca269e5b10cc97d8961d4bfea
[ "self.__radius = radius\nself.__x_center = x_center\nself.__y_center = y_center", "r = self.__radius * math.sqrt(random.uniform(0, 1))\ntheta = 2 * math.pi * random.uniform(0, 1)\nreturn (r * math.cos(theta) + self.__x_center, r * math.sin(theta) + self.__y_center)" ]
<|body_start_0|> self.__radius = radius self.__x_center = x_center self.__y_center = y_center <|end_body_0|> <|body_start_1|> r = self.__radius * math.sqrt(random.uniform(0, 1)) theta = 2 * math.pi * random.uniform(0, 1) return (r * math.cos(theta) + self.__x_center, r *...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.__radius = ra...
stack_v2_sparse_classes_36k_train_030912
655
permissive
[ { "docstring": ":type radius: float :type x_center: float :type y_center: float", "name": "__init__", "signature": "def __init__(self, radius, x_center, y_center)" }, { "docstring": ":rtype: List[float]", "name": "randPoint", "signature": "def randPoint(self)" } ]
2
stack_v2_sparse_classes_30k_train_000380
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float - def randPoint(self): :rtype: List[float]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float - def randPoint(self): :rtype: List[float] <|skeleton|> class Sol...
4dc4e6642dc92f1983c13564cc0fd99917cab358
<|skeleton|> class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" <|body_0|> def randPoint(self): """:rtype: List[float]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, radius, x_center, y_center): """:type radius: float :type x_center: float :type y_center: float""" self.__radius = radius self.__x_center = x_center self.__y_center = y_center def randPoint(self): """:rtype: List[float]""" r = s...
the_stack_v2_python_sparse
Python/generate-random-point-in-a-circle.py
kamyu104/LeetCode-Solutions
train
4,549
4704fb5bb98f16ea37779ddadde55f974c7b9a34
[ "response = await self._api.get('/v1/status/leader')\nif response.status == 200:\n return response.body", "response = await self._api.get('/v1/status/peers')\nif response.status == 200:\n return set(response.body)" ]
<|body_start_0|> response = await self._api.get('/v1/status/leader') if response.status == 200: return response.body <|end_body_0|> <|body_start_1|> response = await self._api.get('/v1/status/peers') if response.status == 200: return set(response.body) <|end_body...
Get information about the status of the Consul cluster. .. note:: this information is generally very low level and not often useful for clients.
StatusEndpoint
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StatusEndpoint: """Get information about the status of the Consul cluster. .. note:: this information is generally very low level and not often useful for clients.""" async def leader(self): """Returns the current Raft leader Returns: str: address of leader such as ``10.1.10.12:8300`...
stack_v2_sparse_classes_36k_train_030913
1,254
permissive
[ { "docstring": "Returns the current Raft leader Returns: str: address of leader such as ``10.1.10.12:8300``", "name": "leader", "signature": "async def leader(self)" }, { "docstring": "Returns the current Raft peer set Returns: Collection: addresses of peers This endpoint retrieves the Raft peer...
2
stack_v2_sparse_classes_30k_train_004400
Implement the Python class `StatusEndpoint` described below. Class description: Get information about the status of the Consul cluster. .. note:: this information is generally very low level and not often useful for clients. Method signatures and docstrings: - async def leader(self): Returns the current Raft leader R...
Implement the Python class `StatusEndpoint` described below. Class description: Get information about the status of the Consul cluster. .. note:: this information is generally very low level and not often useful for clients. Method signatures and docstrings: - async def leader(self): Returns the current Raft leader R...
02f7a529d7dc2e49bed942111067aa5faf320e90
<|skeleton|> class StatusEndpoint: """Get information about the status of the Consul cluster. .. note:: this information is generally very low level and not often useful for clients.""" async def leader(self): """Returns the current Raft leader Returns: str: address of leader such as ``10.1.10.12:8300`...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StatusEndpoint: """Get information about the status of the Consul cluster. .. note:: this information is generally very low level and not often useful for clients.""" async def leader(self): """Returns the current Raft leader Returns: str: address of leader such as ``10.1.10.12:8300``""" ...
the_stack_v2_python_sparse
aioconsul/client/status_endpoint.py
johnnoone/aioconsul
train
8
8edb1e384fe6665489a8e884074e94c677d9b1b3
[ "test_data = {'username': 'amdin', 'password': 'beidouxing1'}\nexpect_data = {'code': '0', 'msg': '登录成功'}\nres = login_check(**test_data)\nself.assertEqual(res, expect_data)", "test_data = {'username': 'amdin', 'password': 'beidouxing1'}\nexpect_data = {'code': '1', 'msg': '账号密码不匹配'}\nres = login_check(**test_dat...
<|body_start_0|> test_data = {'username': 'amdin', 'password': 'beidouxing1'} expect_data = {'code': '0', 'msg': '登录成功'} res = login_check(**test_data) self.assertEqual(res, expect_data) <|end_body_0|> <|body_start_1|> test_data = {'username': 'amdin', 'password': 'beidouxing1'}...
如果有前置条件和后置条件,需要重写脚手架 定义单元测试,但是测试函数(方法)必须是要以test开头
Test_login
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_login: """如果有前置条件和后置条件,需要重写脚手架 定义单元测试,但是测试函数(方法)必须是要以test开头""" def test_login_success(self): """账号密码正确 :return:""" <|body_0|> def test_login_pwderror(self): """账号正确,密码错误 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> test_data = {...
stack_v2_sparse_classes_36k_train_030914
1,754
no_license
[ { "docstring": "账号密码正确 :return:", "name": "test_login_success", "signature": "def test_login_success(self)" }, { "docstring": "账号正确,密码错误 :return:", "name": "test_login_pwderror", "signature": "def test_login_pwderror(self)" } ]
2
stack_v2_sparse_classes_30k_train_004113
Implement the Python class `Test_login` described below. Class description: 如果有前置条件和后置条件,需要重写脚手架 定义单元测试,但是测试函数(方法)必须是要以test开头 Method signatures and docstrings: - def test_login_success(self): 账号密码正确 :return: - def test_login_pwderror(self): 账号正确,密码错误 :return:
Implement the Python class `Test_login` described below. Class description: 如果有前置条件和后置条件,需要重写脚手架 定义单元测试,但是测试函数(方法)必须是要以test开头 Method signatures and docstrings: - def test_login_success(self): 账号密码正确 :return: - def test_login_pwderror(self): 账号正确,密码错误 :return: <|skeleton|> class Test_login: """如果有前置条件和后置条件,需要重写脚手...
a6854496543fc04c22678ac3c758cd5556dd694e
<|skeleton|> class Test_login: """如果有前置条件和后置条件,需要重写脚手架 定义单元测试,但是测试函数(方法)必须是要以test开头""" def test_login_success(self): """账号密码正确 :return:""" <|body_0|> def test_login_pwderror(self): """账号正确,密码错误 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_login: """如果有前置条件和后置条件,需要重写脚手架 定义单元测试,但是测试函数(方法)必须是要以test开头""" def test_login_success(self): """账号密码正确 :return:""" test_data = {'username': 'amdin', 'password': 'beidouxing1'} expect_data = {'code': '0', 'msg': '登录成功'} res = login_check(**test_data) self.asser...
the_stack_v2_python_sparse
day10/Beautidul_test.py
yantianpeng123/python
train
0
86cc8b2f1844a75c8c2759b7cb3e4b983ddf62b2
[ "r = resource.replace(' ', '-').lower()\nfilename = '.'.join([str(id_), 'png'])\nself.__data = {'type': r, 'path': filename, 'url': '/'.join([SPRITE_URL, r, filename])}\nif lookup:\n self.load()\n self.__is_loaded = True\nelse:\n self.__is_loaded = False", "if not self.__is_loaded:\n self.load()\n ...
<|body_start_0|> r = resource.replace(' ', '-').lower() filename = '.'.join([str(id_), 'png']) self.__data = {'type': r, 'path': filename, 'url': '/'.join([SPRITE_URL, r, filename])} if lookup: self.load() self.__is_loaded = True else: self.__i...
Class for downloading sprites to your computer and then locating them. The only notable attribute of this class is a str with the absolute path to the sprite. This is designed as such so that you can load the image in whatever image class your specific application requires. The path can be found in the `path` attribute...
SpriteResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpriteResource: """Class for downloading sprites to your computer and then locating them. The only notable attribute of this class is a str with the absolute path to the sprite. This is designed as such so that you can load the image in whatever image class your specific application requires. The...
stack_v2_sparse_classes_36k_train_030915
17,492
permissive
[ { "docstring": "Constructs a SpriteResource object. :param resource: which type of sprite, currently, 'pokemon' is the only valid option. :param id_: id of the pokemon to download. :param lookup: whether or not to retrieve the image immediately.", "name": "__init__", "signature": "def __init__(self, res...
3
stack_v2_sparse_classes_30k_val_000267
Implement the Python class `SpriteResource` described below. Class description: Class for downloading sprites to your computer and then locating them. The only notable attribute of this class is a str with the absolute path to the sprite. This is designed as such so that you can load the image in whatever image class ...
Implement the Python class `SpriteResource` described below. Class description: Class for downloading sprites to your computer and then locating them. The only notable attribute of this class is a str with the absolute path to the sprite. This is designed as such so that you can load the image in whatever image class ...
12c7e5a9c18b0445a01a61fa1e05f2681bf884df
<|skeleton|> class SpriteResource: """Class for downloading sprites to your computer and then locating them. The only notable attribute of this class is a str with the absolute path to the sprite. This is designed as such so that you can load the image in whatever image class your specific application requires. The...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpriteResource: """Class for downloading sprites to your computer and then locating them. The only notable attribute of this class is a str with the absolute path to the sprite. This is designed as such so that you can load the image in whatever image class your specific application requires. The path can be ...
the_stack_v2_python_sparse
venv/Lib/site-packages/pokebase/api.py
BDubon/Wander
train
1
8d9bcfc70ba6819b2efcff956328e4731d6471f0
[ "self.entity_description = description\nself.sid = sid\nself.api = api\nself.period = period\nif sid:\n self._attr_name = f'efergy_{sid}'\nif description.key == CONF_COST:\n self._attr_native_unit_of_measurement = f'{currency}/{period}'", "try:\n self._attr_native_value = await self.api.async_get_reading...
<|body_start_0|> self.entity_description = description self.sid = sid self.api = api self.period = period if sid: self._attr_name = f'efergy_{sid}' if description.key == CONF_COST: self._attr_native_unit_of_measurement = f'{currency}/{period}' <|en...
Implementation of an Efergy sensor.
EfergySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EfergySensor: """Implementation of an Efergy sensor.""" def __init__(self, api: Efergy, period: str, currency: str, description: SensorEntityDescription, sid: str=None) -> None: """Initialize the sensor.""" <|body_0|> async def async_update(self) -> None: """Get ...
stack_v2_sparse_classes_36k_train_030916
5,134
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, api: Efergy, period: str, currency: str, description: SensorEntityDescription, sid: str=None) -> None" }, { "docstring": "Get the Efergy monitor data from the web service.", "name": "async_update", ...
2
null
Implement the Python class `EfergySensor` described below. Class description: Implementation of an Efergy sensor. Method signatures and docstrings: - def __init__(self, api: Efergy, period: str, currency: str, description: SensorEntityDescription, sid: str=None) -> None: Initialize the sensor. - async def async_updat...
Implement the Python class `EfergySensor` described below. Class description: Implementation of an Efergy sensor. Method signatures and docstrings: - def __init__(self, api: Efergy, period: str, currency: str, description: SensorEntityDescription, sid: str=None) -> None: Initialize the sensor. - async def async_updat...
8de7966104911bca6f855a1755a6d71a07afb9de
<|skeleton|> class EfergySensor: """Implementation of an Efergy sensor.""" def __init__(self, api: Efergy, period: str, currency: str, description: SensorEntityDescription, sid: str=None) -> None: """Initialize the sensor.""" <|body_0|> async def async_update(self) -> None: """Get ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EfergySensor: """Implementation of an Efergy sensor.""" def __init__(self, api: Efergy, period: str, currency: str, description: SensorEntityDescription, sid: str=None) -> None: """Initialize the sensor.""" self.entity_description = description self.sid = sid self.api = ap...
the_stack_v2_python_sparse
homeassistant/components/efergy/sensor.py
AlexxIT/home-assistant
train
9
e405f838c6cea738af7d34a921e3e68512d9be48
[ "cls._condition.acquire()\nprint('Added new file to the playlist')\ncls._playlist.append(FmPlayer.FileInfo(file_name, delete_after_convert=delete_after_convert, delete_after_play=delete_after_play))\ncls._condition.notify()\ncls._condition.release()", "print('Playing ' + file_info.file_name())\nwav_file = cls._co...
<|body_start_0|> cls._condition.acquire() print('Added new file to the playlist') cls._playlist.append(FmPlayer.FileInfo(file_name, delete_after_convert=delete_after_convert, delete_after_play=delete_after_play)) cls._condition.notify() cls._condition.release() <|end_body_0|> <|...
Plays files over FM
FmPlayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FmPlayer: """Plays files over FM""" def play_file(cls, file_name, delete_after_play=True, delete_after_convert=True): """adds a new file to the queue""" <|body_0|> def _play_file(cls, file_info: FileInfo): """INTERNAL USE ONLY, plays the file over fm""" <...
stack_v2_sparse_classes_36k_train_030917
4,403
no_license
[ { "docstring": "adds a new file to the queue", "name": "play_file", "signature": "def play_file(cls, file_name, delete_after_play=True, delete_after_convert=True)" }, { "docstring": "INTERNAL USE ONLY, plays the file over fm", "name": "_play_file", "signature": "def _play_file(cls, file_...
5
stack_v2_sparse_classes_30k_train_009452
Implement the Python class `FmPlayer` described below. Class description: Plays files over FM Method signatures and docstrings: - def play_file(cls, file_name, delete_after_play=True, delete_after_convert=True): adds a new file to the queue - def _play_file(cls, file_info: FileInfo): INTERNAL USE ONLY, plays the file...
Implement the Python class `FmPlayer` described below. Class description: Plays files over FM Method signatures and docstrings: - def play_file(cls, file_name, delete_after_play=True, delete_after_convert=True): adds a new file to the queue - def _play_file(cls, file_info: FileInfo): INTERNAL USE ONLY, plays the file...
a90d31ff68a2e941d1e95176c68f85aa128af1c0
<|skeleton|> class FmPlayer: """Plays files over FM""" def play_file(cls, file_name, delete_after_play=True, delete_after_convert=True): """adds a new file to the queue""" <|body_0|> def _play_file(cls, file_info: FileInfo): """INTERNAL USE ONLY, plays the file over fm""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FmPlayer: """Plays files over FM""" def play_file(cls, file_name, delete_after_play=True, delete_after_convert=True): """adds a new file to the queue""" cls._condition.acquire() print('Added new file to the playlist') cls._playlist.append(FmPlayer.FileInfo(file_name, delet...
the_stack_v2_python_sparse
radio/RadioPlayer.py
MetalBlueberry/ErniHpBot
train
0
27a95de152d97ca0150b96291dcabfc06a185dec
[ "if site.page_cache[site.url_stem + '/wp-login.php'].contains_pattern('loginform'):\n return 1\nelse:\n return 0", "if site.home_page.contains_pattern('wp-content/themes/'):\n return 1\nelse:\n return 0" ]
<|body_start_0|> if site.page_cache[site.url_stem + '/wp-login.php'].contains_pattern('loginform'): return 1 else: return 0 <|end_body_0|> <|body_start_1|> if site.home_page.contains_pattern('wp-content/themes/'): return 1 else: return 0 <...
Signature
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Signature: def test_has_wp_login(self, site): """By default, Wordpress ships with a login page at /wp-login.php""" <|body_0|> def test_has_wp_theme(self, site): """Wordpress sites manage layouts and other formatting using style sheets in themes directory.""" ...
stack_v2_sparse_classes_36k_train_030918
1,181
permissive
[ { "docstring": "By default, Wordpress ships with a login page at /wp-login.php", "name": "test_has_wp_login", "signature": "def test_has_wp_login(self, site)" }, { "docstring": "Wordpress sites manage layouts and other formatting using style sheets in themes directory.", "name": "test_has_wp...
2
stack_v2_sparse_classes_30k_train_005055
Implement the Python class `Signature` described below. Class description: Implement the Signature class. Method signatures and docstrings: - def test_has_wp_login(self, site): By default, Wordpress ships with a login page at /wp-login.php - def test_has_wp_theme(self, site): Wordpress sites manage layouts and other ...
Implement the Python class `Signature` described below. Class description: Implement the Signature class. Method signatures and docstrings: - def test_has_wp_login(self, site): By default, Wordpress ships with a login page at /wp-login.php - def test_has_wp_theme(self, site): Wordpress sites manage layouts and other ...
850bac5a1f5de67025bfaed252fbcde0b6ea6846
<|skeleton|> class Signature: def test_has_wp_login(self, site): """By default, Wordpress ships with a login page at /wp-login.php""" <|body_0|> def test_has_wp_theme(self, site): """Wordpress sites manage layouts and other formatting using style sheets in themes directory.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Signature: def test_has_wp_login(self, site): """By default, Wordpress ships with a login page at /wp-login.php""" if site.page_cache[site.url_stem + '/wp-login.php'].contains_pattern('loginform'): return 1 else: return 0 def test_has_wp_theme(self, site): ...
the_stack_v2_python_sparse
cmfieldguide/cmsdetector/signatures/wordpress.py
kartiktodi/cmfieldguide
train
0
8c99e8c53ee936db9ef0aaf7f0586711eb793f2d
[ "count_to_map = {}\nresult = []\nfor i in range(len(nums)):\n count_to_map[nums[i]] = count_to_map.get(nums[i], 0) + 1\n if count_to_map[nums[i]] > 1:\n result.append(nums[i])\nprint('print_repeating_using_hash_map(): {}'.format(result))", "c = Counter(nums)\nprint('Debug: Printing Counter object - ...
<|body_start_0|> count_to_map = {} result = [] for i in range(len(nums)): count_to_map[nums[i]] = count_to_map.get(nums[i], 0) + 1 if count_to_map[nums[i]] > 1: result.append(nums[i]) print('print_repeating_using_hash_map(): {}'.format(result)) <|e...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def print_repeating_using_hash_map(self, nums): """In this method we use hash map to store the value and its count. While updating the count check if count exceeds 1 and add to the resulting array TC = O(N) SC = O(N+k) K being the number of elements repeating :param nums: :retu...
stack_v2_sparse_classes_36k_train_030919
3,185
no_license
[ { "docstring": "In this method we use hash map to store the value and its count. While updating the count check if count exceeds 1 and add to the resulting array TC = O(N) SC = O(N+k) K being the number of elements repeating :param nums: :return:", "name": "print_repeating_using_hash_map", "signature": ...
3
stack_v2_sparse_classes_30k_train_013671
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def print_repeating_using_hash_map(self, nums): In this method we use hash map to store the value and its count. While updating the count check if count exceeds 1 and add to the ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def print_repeating_using_hash_map(self, nums): In this method we use hash map to store the value and its count. While updating the count check if count exceeds 1 and add to the ...
f51caae9b764837ff9107d8b3d116637cdc102b0
<|skeleton|> class Solution: def print_repeating_using_hash_map(self, nums): """In this method we use hash map to store the value and its count. While updating the count check if count exceeds 1 and add to the resulting array TC = O(N) SC = O(N+k) K being the number of elements repeating :param nums: :retu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def print_repeating_using_hash_map(self, nums): """In this method we use hash map to store the value and its count. While updating the count check if count exceeds 1 and add to the resulting array TC = O(N) SC = O(N+k) K being the number of elements repeating :param nums: :return:""" ...
the_stack_v2_python_sparse
Leetcode/repeating_elements.py
madhuri-majety/IK
train
0
767d460fc994ffc06b03b324aea193b141ae8b81
[ "self.n = len(w)\nself.pre = [0] * self.n\nself.pre[0] = w[0]\nfor i in range(1, self.n):\n self.pre[i] = self.pre[i - 1] + w[i]\nself.num = self.pre[-1]", "idx = random.randint(0, self.num - 1)\nfor i in range(self.n):\n if self.pre[i] > idx:\n return i" ]
<|body_start_0|> self.n = len(w) self.pre = [0] * self.n self.pre[0] = w[0] for i in range(1, self.n): self.pre[i] = self.pre[i - 1] + w[i] self.num = self.pre[-1] <|end_body_0|> <|body_start_1|> idx = random.randint(0, self.num - 1) for i in range(se...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.n = len(w) self.pre = [0] * self.n self.pre[0] = w[0] for i in rang...
stack_v2_sparse_classes_36k_train_030920
1,212
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
aba3b3627c1510cf61eaf8555389aad09cd112bb
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" self.n = len(w) self.pre = [0] * self.n self.pre[0] = w[0] for i in range(1, self.n): self.pre[i] = self.pre[i - 1] + w[i] self.num = self.pre[-1] def pickIndex(self): """:rtype: ...
the_stack_v2_python_sparse
problem528.py
digitalladder/leetcode
train
0
b665ffe3a4cb15944105358fda19bd84cd90dc33
[ "self.stop = stop\nself.route = route\nself.info = [{ATTR_DUE_AT: 'n/a', ATTR_ROUTE: self.route, ATTR_DUE_IN: 'n/a'}]", "params = {}\nparams['stopid'] = self.stop\nif self.route:\n params['routeid'] = self.route\nparams['maxresults'] = 2\nparams['format'] = 'json'\nresponse = requests.get(_RESOURCE, params, ti...
<|body_start_0|> self.stop = stop self.route = route self.info = [{ATTR_DUE_AT: 'n/a', ATTR_ROUTE: self.route, ATTR_DUE_IN: 'n/a'}] <|end_body_0|> <|body_start_1|> params = {} params['stopid'] = self.stop if self.route: params['routeid'] = self.route ...
The Class for handling the data retrieval.
PublicTransportData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublicTransportData: """The Class for handling the data retrieval.""" def __init__(self, stop, route): """Initialize the data object.""" <|body_0|> def update(self): """Get the latest data from opendata.ch.""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_030921
5,470
permissive
[ { "docstring": "Initialize the data object.", "name": "__init__", "signature": "def __init__(self, stop, route)" }, { "docstring": "Get the latest data from opendata.ch.", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_011805
Implement the Python class `PublicTransportData` described below. Class description: The Class for handling the data retrieval. Method signatures and docstrings: - def __init__(self, stop, route): Initialize the data object. - def update(self): Get the latest data from opendata.ch.
Implement the Python class `PublicTransportData` described below. Class description: The Class for handling the data retrieval. Method signatures and docstrings: - def __init__(self, stop, route): Initialize the data object. - def update(self): Get the latest data from opendata.ch. <|skeleton|> class PublicTransport...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class PublicTransportData: """The Class for handling the data retrieval.""" def __init__(self, stop, route): """Initialize the data object.""" <|body_0|> def update(self): """Get the latest data from opendata.ch.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PublicTransportData: """The Class for handling the data retrieval.""" def __init__(self, stop, route): """Initialize the data object.""" self.stop = stop self.route = route self.info = [{ATTR_DUE_AT: 'n/a', ATTR_ROUTE: self.route, ATTR_DUE_IN: 'n/a'}] def update(self)...
the_stack_v2_python_sparse
homeassistant/components/dublin_bus_transport/sensor.py
home-assistant/core
train
35,501
e6c9cf6da6605b85cb1f18d03674620b7c7e21c3
[ "out = []\ns = sorted(intervals, key=lambda i: i.start)\nfor i in s:\n if out and i.start <= out[-1][1]:\n out[-1][1] = max(out[-1][1], i.end)\n else:\n out += ([i.start, i.end],)\nreturn out", "result = []\nintervals.sort(key=lambda i: i.start)\nfor i in intervals:\n if not result or i.sta...
<|body_start_0|> out = [] s = sorted(intervals, key=lambda i: i.start) for i in s: if out and i.start <= out[-1][1]: out[-1][1] = max(out[-1][1], i.end) else: out += ([i.start, i.end],) return out <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_0|> def rewrite(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_1|> <|end_skeleton|> <|body_start_0|> out...
stack_v2_sparse_classes_36k_train_030922
1,665
no_license
[ { "docstring": ":type intervals: List[Interval] :rtype: List[Interval]", "name": "merge", "signature": "def merge(self, intervals)" }, { "docstring": ":type intervals: List[Interval] :rtype: List[Interval]", "name": "rewrite", "signature": "def rewrite(self, intervals)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, intervals): :type intervals: List[Interval] :rtype: List[Interval] - def rewrite(self, intervals): :type intervals: List[Interval] :rtype: List[Interval]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, intervals): :type intervals: List[Interval] :rtype: List[Interval] - def rewrite(self, intervals): :type intervals: List[Interval] :rtype: List[Interval] <|skele...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_0|> def rewrite(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" out = [] s = sorted(intervals, key=lambda i: i.start) for i in s: if out and i.start <= out[-1][1]: out[-1][1] = max(out[-1][1], i.end) els...
the_stack_v2_python_sparse
co_ms/56_Merge_Intervals.py
vsdrun/lc_public
train
6
118cd38a9e7de23b1564b78b7fbbed100145a519
[ "r = len(matrix)\nc = len(matrix[0])\nif r == 0 or c == 0:\n return None\nself.m = [[0 for j in range(c)] for i in range(r)]\nfor i in range(r):\n for j in range(c):\n self.m[i][j] = matrix[i][j]", "sum = 0\nfor i in range(row1, row2 + 1):\n for j in range(col1, col2 + 1):\n sum += self.m[i...
<|body_start_0|> r = len(matrix) c = len(matrix[0]) if r == 0 or c == 0: return None self.m = [[0 for j in range(c)] for i in range(r)] for i in range(r): for j in range(c): self.m[i][j] = matrix[i][j] <|end_body_0|> <|body_start_1|> ...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_030923
2,085
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, row1, col1, row2, col2)" ...
2
null
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
48d436701840f8c162829cb101ecde444def2307
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" r = len(matrix) c = len(matrix[0]) if r == 0 or c == 0: return None self.m = [[0 for j in range(c)] for i in range(r)] for i in range(r): for j in range(c): ...
the_stack_v2_python_sparse
304. Range Sum Query 2D - Immutable.py
lixuanhong/LeetCode
train
0
63261ab45cee431839087451197539845792fd7a
[ "self.mapping = collections.defaultdict(set)\nfor op in (op for op in graph.get_operations()):\n if op.name.startswith(common.SKIPPED_PREFIXES):\n continue\n for op_input in op.inputs:\n self.mapping[op_input].add(op)", "result = set()\nfor inp in producer_op.outputs:\n result.update(self.m...
<|body_start_0|> self.mapping = collections.defaultdict(set) for op in (op for op in graph.get_operations()): if op.name.startswith(common.SKIPPED_PREFIXES): continue for op_input in op.inputs: self.mapping[op_input].add(op) <|end_body_0|> <|body_...
Holds a mapping from tensor's name to ops that take it as input.
InputToOps
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputToOps: """Holds a mapping from tensor's name to ops that take it as input.""" def __init__(self, graph): """Initializes mapping from tensor's name to ops that take it. Helps find edges between ops faster and avoids iterating over the whole graph. The mapping is of type Dict[str,...
stack_v2_sparse_classes_36k_train_030924
2,232
permissive
[ { "docstring": "Initializes mapping from tensor's name to ops that take it. Helps find edges between ops faster and avoids iterating over the whole graph. The mapping is of type Dict[str, Set[tf.Operation]]. Note: while inserting operations into the graph, we do not update the mapping, assuming that insertion p...
2
stack_v2_sparse_classes_30k_train_012602
Implement the Python class `InputToOps` described below. Class description: Holds a mapping from tensor's name to ops that take it as input. Method signatures and docstrings: - def __init__(self, graph): Initializes mapping from tensor's name to ops that take it. Helps find edges between ops faster and avoids iterati...
Implement the Python class `InputToOps` described below. Class description: Holds a mapping from tensor's name to ops that take it as input. Method signatures and docstrings: - def __init__(self, graph): Initializes mapping from tensor's name to ops that take it. Helps find edges between ops faster and avoids iterati...
cabf6e4f1970dc14302f87414f170de19944bac2
<|skeleton|> class InputToOps: """Holds a mapping from tensor's name to ops that take it as input.""" def __init__(self, graph): """Initializes mapping from tensor's name to ops that take it. Helps find edges between ops faster and avoids iterating over the whole graph. The mapping is of type Dict[str,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InputToOps: """Holds a mapping from tensor's name to ops that take it as input.""" def __init__(self, graph): """Initializes mapping from tensor's name to ops that take it. Helps find edges between ops faster and avoids iterating over the whole graph. The mapping is of type Dict[str, Set[tf.Opera...
the_stack_v2_python_sparse
Tensorflow/source/tensorflow/contrib/quantize/python/input_to_ops.py
ryfeus/lambda-packs
train
1,283
0d7435c9c3f78fea8212d02288beb662458c31ff
[ "keyword = get_object_or_404(Keyword, pk=keyword_id)\nserializer = KeywordSerializer(keyword)\nreturn Response(serializer.data)", "keyword = get_object_or_404(Keyword, pk=keyword_id)\nserializer = KeywordSerializer(keyword, data=request.data)\nif serializer.is_valid():\n serializer.save()\n return Response(...
<|body_start_0|> keyword = get_object_or_404(Keyword, pk=keyword_id) serializer = KeywordSerializer(keyword) return Response(serializer.data) <|end_body_0|> <|body_start_1|> keyword = get_object_or_404(Keyword, pk=keyword_id) serializer = KeywordSerializer(keyword, data=request....
KeywordDetail
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeywordDetail: def get(self, request, keyword_id, format=None): """Get keyword detail""" <|body_0|> def put(self, request, keyword_id, format=None): """Edit keyword --- serializer: administrator.serializers.KeywordSerializer""" <|body_1|> def delete(self...
stack_v2_sparse_classes_36k_train_030925
30,608
permissive
[ { "docstring": "Get keyword detail", "name": "get", "signature": "def get(self, request, keyword_id, format=None)" }, { "docstring": "Edit keyword --- serializer: administrator.serializers.KeywordSerializer", "name": "put", "signature": "def put(self, request, keyword_id, format=None)" ...
3
stack_v2_sparse_classes_30k_train_018200
Implement the Python class `KeywordDetail` described below. Class description: Implement the KeywordDetail class. Method signatures and docstrings: - def get(self, request, keyword_id, format=None): Get keyword detail - def put(self, request, keyword_id, format=None): Edit keyword --- serializer: administrator.serial...
Implement the Python class `KeywordDetail` described below. Class description: Implement the KeywordDetail class. Method signatures and docstrings: - def get(self, request, keyword_id, format=None): Get keyword detail - def put(self, request, keyword_id, format=None): Edit keyword --- serializer: administrator.serial...
73728463badb3bfd4413aa0f7aeb44a9606fdfea
<|skeleton|> class KeywordDetail: def get(self, request, keyword_id, format=None): """Get keyword detail""" <|body_0|> def put(self, request, keyword_id, format=None): """Edit keyword --- serializer: administrator.serializers.KeywordSerializer""" <|body_1|> def delete(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeywordDetail: def get(self, request, keyword_id, format=None): """Get keyword detail""" keyword = get_object_or_404(Keyword, pk=keyword_id) serializer = KeywordSerializer(keyword) return Response(serializer.data) def put(self, request, keyword_id, format=None): ""...
the_stack_v2_python_sparse
administrator/views.py
belatrix/BackendAllStars
train
5
530891ce0e430c68f51c74ca3a736cbc18339c37
[ "self.save_new_valid_exploration('Exp1', 'user@example.com', end_state_name='End')\ncollection = collection_domain.Collection.from_yaml('cid', self.YAML_CONTENT_V1)\nself.assertEqual(collection.to_yaml(), self._LATEST_YAML_CONTENT)", "self.save_new_valid_exploration('Exp1', 'user@example.com', end_state_name='End...
<|body_start_0|> self.save_new_valid_exploration('Exp1', 'user@example.com', end_state_name='End') collection = collection_domain.Collection.from_yaml('cid', self.YAML_CONTENT_V1) self.assertEqual(collection.to_yaml(), self._LATEST_YAML_CONTENT) <|end_body_0|> <|body_start_1|> self.save...
Test migration methods for yaml content.
SchemaMigrationUnitTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchemaMigrationUnitTests: """Test migration methods for yaml content.""" def test_load_from_v1(self) -> None: """Test direct loading from a v1 yaml file.""" <|body_0|> def test_load_from_v2(self) -> None: """Test direct loading from a v2 yaml file.""" <|b...
stack_v2_sparse_classes_36k_train_030926
48,157
permissive
[ { "docstring": "Test direct loading from a v1 yaml file.", "name": "test_load_from_v1", "signature": "def test_load_from_v1(self) -> None" }, { "docstring": "Test direct loading from a v2 yaml file.", "name": "test_load_from_v2", "signature": "def test_load_from_v2(self) -> None" }, ...
6
stack_v2_sparse_classes_30k_train_006167
Implement the Python class `SchemaMigrationUnitTests` described below. Class description: Test migration methods for yaml content. Method signatures and docstrings: - def test_load_from_v1(self) -> None: Test direct loading from a v1 yaml file. - def test_load_from_v2(self) -> None: Test direct loading from a v2 yaml...
Implement the Python class `SchemaMigrationUnitTests` described below. Class description: Test migration methods for yaml content. Method signatures and docstrings: - def test_load_from_v1(self) -> None: Test direct loading from a v1 yaml file. - def test_load_from_v2(self) -> None: Test direct loading from a v2 yaml...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class SchemaMigrationUnitTests: """Test migration methods for yaml content.""" def test_load_from_v1(self) -> None: """Test direct loading from a v1 yaml file.""" <|body_0|> def test_load_from_v2(self) -> None: """Test direct loading from a v2 yaml file.""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SchemaMigrationUnitTests: """Test migration methods for yaml content.""" def test_load_from_v1(self) -> None: """Test direct loading from a v1 yaml file.""" self.save_new_valid_exploration('Exp1', 'user@example.com', end_state_name='End') collection = collection_domain.Collection....
the_stack_v2_python_sparse
core/domain/collection_domain_test.py
oppia/oppia
train
6,172
7523105669ae7627d18d1e9523e957225a7f3a43
[ "if match(KeyboardInputConverter.SHORTCUT, key_combination):\n is_success, result = KeyboardInputConverter._try_convert_to_shortcut(key_combination)\n if is_success:\n return (KeyboardInputConverter.InputType.SHORTCUT, result)\n return (KeyboardInputConverter.InputType.TEXT, result)\nif match(Keyboa...
<|body_start_0|> if match(KeyboardInputConverter.SHORTCUT, key_combination): is_success, result = KeyboardInputConverter._try_convert_to_shortcut(key_combination) if is_success: return (KeyboardInputConverter.InputType.SHORTCUT, result) return (KeyboardInputCo...
Helper class for simplifying keyboard input converting.
KeyboardInputConverter
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeyboardInputConverter: """Helper class for simplifying keyboard input converting.""" def convert_key_combination(key_combination): """Convert user-defined keys combination into text or VirtualKeyShort combination. Args: key_combination (String array): Array of Strings to execute key...
stack_v2_sparse_classes_36k_train_030927
7,506
permissive
[ { "docstring": "Convert user-defined keys combination into text or VirtualKeyShort combination. Args: key_combination (String array): Array of Strings to execute keyboard actions. Raises: FlaUiError: If key_combination is invalid. Returns: Pair(Action, ConvertedValue): Action type (text or shortcut) and prepare...
3
stack_v2_sparse_classes_30k_train_004557
Implement the Python class `KeyboardInputConverter` described below. Class description: Helper class for simplifying keyboard input converting. Method signatures and docstrings: - def convert_key_combination(key_combination): Convert user-defined keys combination into text or VirtualKeyShort combination. Args: key_co...
Implement the Python class `KeyboardInputConverter` described below. Class description: Helper class for simplifying keyboard input converting. Method signatures and docstrings: - def convert_key_combination(key_combination): Convert user-defined keys combination into text or VirtualKeyShort combination. Args: key_co...
352851193265d62ab8282dd9ac2a416fe47e4717
<|skeleton|> class KeyboardInputConverter: """Helper class for simplifying keyboard input converting.""" def convert_key_combination(key_combination): """Convert user-defined keys combination into text or VirtualKeyShort combination. Args: key_combination (String array): Array of Strings to execute key...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeyboardInputConverter: """Helper class for simplifying keyboard input converting.""" def convert_key_combination(key_combination): """Convert user-defined keys combination into text or VirtualKeyShort combination. Args: key_combination (String array): Array of Strings to execute keyboard actions...
the_stack_v2_python_sparse
src/FlaUILibrary/flaui/util/keyboardinputconverter.py
minatuyang/robotframework-flaui
train
0
35aca5e55f14c8710c26c818a1e7781e9723ba00
[ "self.status = status\nself.start_response = start_response\nself.headers = wsgiref.headers.Headers([])\nself.body = None", "if not self.status:\n raise ValueError('Status code not set for a HTTP response.')\nstatus_msg = '%d %s' % (self.status, http_codes[self.status])\nself.start_response(status_msg, self.he...
<|body_start_0|> self.status = status self.start_response = start_response self.headers = wsgiref.headers.Headers([]) self.body = None <|end_body_0|> <|body_start_1|> if not self.status: raise ValueError('Status code not set for a HTTP response.') status_msg ...
Response wrapper class.
Response
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Response: """Response wrapper class.""" def __init__(self, status, start_response): """Constructor for the Response class. @param status: response status code, can be modified later @param start_response: wsgi start_response function @type status: int @type start_response: callable""...
stack_v2_sparse_classes_36k_train_030928
29,611
permissive
[ { "docstring": "Constructor for the Response class. @param status: response status code, can be modified later @param start_response: wsgi start_response function @type status: int @type start_response: callable", "name": "__init__", "signature": "def __init__(self, status, start_response)" }, { ...
2
stack_v2_sparse_classes_30k_train_015560
Implement the Python class `Response` described below. Class description: Response wrapper class. Method signatures and docstrings: - def __init__(self, status, start_response): Constructor for the Response class. @param status: response status code, can be modified later @param start_response: wsgi start_response fu...
Implement the Python class `Response` described below. Class description: Response wrapper class. Method signatures and docstrings: - def __init__(self, status, start_response): Constructor for the Response class. @param status: response status code, can be modified later @param start_response: wsgi start_response fu...
69f9c870369085f4440033201e2fb263a463a523
<|skeleton|> class Response: """Response wrapper class.""" def __init__(self, status, start_response): """Constructor for the Response class. @param status: response status code, can be modified later @param start_response: wsgi start_response function @type status: int @type start_response: callable""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Response: """Response wrapper class.""" def __init__(self, status, start_response): """Constructor for the Response class. @param status: response status code, can be modified later @param start_response: wsgi start_response function @type status: int @type start_response: callable""" sel...
the_stack_v2_python_sparse
WebBrickLibs/brisa/core/webserver.py
AndyThirtover/wb_gateway
train
0
114e2abf2443502ebd90f8ca3b4738e8fe1307cb
[ "self.uidevice = uidevice\nself.device = uidevice.device\nif not layout:\n layout = self.default_layout\nself._layout = layout", "if app_name == 'uiphone':\n self.device.press('home')\n self.device.wait.update()\n names = [u'Téléphone', 'Phone']\n for name in names:\n if self.device(text=nam...
<|body_start_0|> self.uidevice = uidevice self.device = uidevice.device if not layout: layout = self.default_layout self._layout = layout <|end_body_0|> <|body_start_1|> if app_name == 'uiphone': self.device.press('home') self.device.wait.upda...
represents the location of each app on the device menu eg uiphone: home quick 0 or home quick phone
ApplicationLayout
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApplicationLayout: """represents the location of each app on the device menu eg uiphone: home quick 0 or home quick phone""" def __init__(self, uidevice, layout=None): """:param uidevice: :return:""" <|body_0|> def goto(self, app_name): """:param app_name: :retur...
stack_v2_sparse_classes_36k_train_030929
4,449
no_license
[ { "docstring": ":param uidevice: :return:", "name": "__init__", "signature": "def __init__(self, uidevice, layout=None)" }, { "docstring": ":param app_name: :return:", "name": "goto", "signature": "def goto(self, app_name)" }, { "docstring": ":param index: :return:", "name": ...
3
stack_v2_sparse_classes_30k_train_005682
Implement the Python class `ApplicationLayout` described below. Class description: represents the location of each app on the device menu eg uiphone: home quick 0 or home quick phone Method signatures and docstrings: - def __init__(self, uidevice, layout=None): :param uidevice: :return: - def goto(self, app_name): :p...
Implement the Python class `ApplicationLayout` described below. Class description: represents the location of each app on the device menu eg uiphone: home quick 0 or home quick phone Method signatures and docstrings: - def __init__(self, uidevice, layout=None): :param uidevice: :return: - def goto(self, app_name): :p...
01c9cbb2c01586521d525106edc575f1ccfee4de
<|skeleton|> class ApplicationLayout: """represents the location of each app on the device menu eg uiphone: home quick 0 or home quick phone""" def __init__(self, uidevice, layout=None): """:param uidevice: :return:""" <|body_0|> def goto(self, app_name): """:param app_name: :retur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApplicationLayout: """represents the location of each app on the device menu eg uiphone: home quick 0 or home quick phone""" def __init__(self, uidevice, layout=None): """:param uidevice: :return:""" self.uidevice = uidevice self.device = uidevice.device if not layout: ...
the_stack_v2_python_sparse
droydrunner/uisystem.py
cocoon-project/droydrunner
train
1
9da906cc8d350e0ca68cbc5f1dc9481fba113f2c
[ "self._refresh()\nfor item in self._items:\n item.initialize()\nsuper(DynamicTemplate, self).initialize()", "parent = self.parent\ndestroy_items = parent is None or not parent.is_destroyed\nsuper(DynamicTemplate, self).destroy()\nif destroy_items:\n for item in self._items:\n if not item.is_destroyed...
<|body_start_0|> self._refresh() for item in self._items: item.initialize() super(DynamicTemplate, self).initialize() <|end_body_0|> <|body_start_1|> parent = self.parent destroy_items = parent is None or not parent.is_destroyed super(DynamicTemplate, self).d...
An object which dynamically instantiates a template. A DynamicTemplate allows a template to be instantiated using the runtime scope available to RHS expressions. Creating a DynamicTemplate without a parent is a programming error.
DynamicTemplate
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DynamicTemplate: """An object which dynamically instantiates a template. A DynamicTemplate allows a template to be instantiated using the runtime scope available to RHS expressions. Creating a DynamicTemplate without a parent is a programming error.""" def initialize(self): """A reim...
stack_v2_sparse_classes_36k_train_030930
5,088
permissive
[ { "docstring": "A reimplemented initializer. This method will instantiate the template and initialize the items for the first time.", "name": "initialize", "signature": "def initialize(self)" }, { "docstring": "A reimplemented destructor. This method will ensure that the instantiated tempalte it...
4
null
Implement the Python class `DynamicTemplate` described below. Class description: An object which dynamically instantiates a template. A DynamicTemplate allows a template to be instantiated using the runtime scope available to RHS expressions. Creating a DynamicTemplate without a parent is a programming error. Method ...
Implement the Python class `DynamicTemplate` described below. Class description: An object which dynamically instantiates a template. A DynamicTemplate allows a template to be instantiated using the runtime scope available to RHS expressions. Creating a DynamicTemplate without a parent is a programming error. Method ...
b54467b48941ce20d0ffadb7385483d2e51963f5
<|skeleton|> class DynamicTemplate: """An object which dynamically instantiates a template. A DynamicTemplate allows a template to be instantiated using the runtime scope available to RHS expressions. Creating a DynamicTemplate without a parent is a programming error.""" def initialize(self): """A reim...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DynamicTemplate: """An object which dynamically instantiates a template. A DynamicTemplate allows a template to be instantiated using the runtime scope available to RHS expressions. Creating a DynamicTemplate without a parent is a programming error.""" def initialize(self): """A reimplemented ini...
the_stack_v2_python_sparse
enaml/core/dynamic_template.py
bburan/enaml
train
0
f2371f15e53fb26d50b309fbd40a8b338781cf6b
[ "logger.info('Validationing FastQ file')\nif configuration is None:\n configuration = {}\nself.configuration.update(configuration)", "output_files_generated = {}\noutput_metadata = {}\nlogger.info('Generating validation report for FastQ file')\nfastqc_handle = fastqcTool()\nlogger.progress('FASTQC Validation',...
<|body_start_0|> logger.info('Validationing FastQ file') if configuration is None: configuration = {} self.configuration.update(configuration) <|end_body_0|> <|body_start_1|> output_files_generated = {} output_metadata = {} logger.info('Generating validation ...
Workflow to download and pre-index a given genome
process_fastqc
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class process_fastqc: """Workflow to download and pre-index a given genome""" def __init__(self, configuration=None): """Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specifi...
stack_v2_sparse_classes_36k_train_030931
4,873
permissive
[ { "docstring": "Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specific to each Tool.", "name": "__init__", "signature": "def __init__(self, configuration=None)" }, { "docstring": "...
2
stack_v2_sparse_classes_30k_train_006921
Implement the Python class `process_fastqc` described below. Class description: Workflow to download and pre-index a given genome Method signatures and docstrings: - def __init__(self, configuration=None): Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define h...
Implement the Python class `process_fastqc` described below. Class description: Workflow to download and pre-index a given genome Method signatures and docstrings: - def __init__(self, configuration=None): Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define h...
50c7115c0c1a6af48dc34f275e469d1b9eb02999
<|skeleton|> class process_fastqc: """Workflow to download and pre-index a given genome""" def __init__(self, configuration=None): """Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specifi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class process_fastqc: """Workflow to download and pre-index a given genome""" def __init__(self, configuration=None): """Initialise the class Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specific to each Too...
the_stack_v2_python_sparse
process_fastqc.py
Multiscale-Genomics/mg-process-fastq
train
2
86606bc769437f84b37de8eb1be2a52e0111826a
[ "for key in indicts:\n if not key.startswith('text search dictionary '):\n raise KeyError('Unrecognized object type: %s' % key)\n tsd = key[23:]\n self[schema.name, tsd] = tsdict = TSDictionary(schema=schema.name, name=tsd)\n indict = indicts[key]\n if indict:\n for attr, val in list(in...
<|body_start_0|> for key in indicts: if not key.startswith('text search dictionary '): raise KeyError('Unrecognized object type: %s' % key) tsd = key[23:] self[schema.name, tsd] = tsdict = TSDictionary(schema=schema.name, name=tsd) indict = indicts...
The collection of text search dictionaries in a database
TSDictionaryDict
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TSDictionaryDict: """The collection of text search dictionaries in a database""" def from_map(self, schema, indicts): """Initialize the dictionary of dictionaries by examining the input map :param schema: schema owning the dictionaries :param indicts: input YAML map defining the dict...
stack_v2_sparse_classes_36k_train_030932
15,925
permissive
[ { "docstring": "Initialize the dictionary of dictionaries by examining the input map :param schema: schema owning the dictionaries :param indicts: input YAML map defining the dictionaries", "name": "from_map", "signature": "def from_map(self, schema, indicts)" }, { "docstring": "Generate SQL to ...
2
stack_v2_sparse_classes_30k_train_017862
Implement the Python class `TSDictionaryDict` described below. Class description: The collection of text search dictionaries in a database Method signatures and docstrings: - def from_map(self, schema, indicts): Initialize the dictionary of dictionaries by examining the input map :param schema: schema owning the dict...
Implement the Python class `TSDictionaryDict` described below. Class description: The collection of text search dictionaries in a database Method signatures and docstrings: - def from_map(self, schema, indicts): Initialize the dictionary of dictionaries by examining the input map :param schema: schema owning the dict...
0133f3bc522890e0564d27de6791824acb4d2773
<|skeleton|> class TSDictionaryDict: """The collection of text search dictionaries in a database""" def from_map(self, schema, indicts): """Initialize the dictionary of dictionaries by examining the input map :param schema: schema owning the dictionaries :param indicts: input YAML map defining the dict...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TSDictionaryDict: """The collection of text search dictionaries in a database""" def from_map(self, schema, indicts): """Initialize the dictionary of dictionaries by examining the input map :param schema: schema owning the dictionaries :param indicts: input YAML map defining the dictionaries""" ...
the_stack_v2_python_sparse
pyrseas/dbobject/textsearch.py
vayerx/Pyrseas
train
1
7f65df1744c71553f605286898749eb0e1510eae
[ "super().__init__()\nassert feature_size != 0 and feature_size & feature_size - 1 == 0, 'latent size not a power of 2'\nif height >= 4:\n assert feature_size >= np.power(2, height - 4), 'feature size cannot be produced'\nself.use_eql = use_eql\nself.height = height\nself.feature_size = feature_size\nself.final_b...
<|body_start_0|> super().__init__() assert feature_size != 0 and feature_size & feature_size - 1 == 0, 'latent size not a power of 2' if height >= 4: assert feature_size >= np.power(2, height - 4), 'feature size cannot be produced' self.use_eql = use_eql self.height =...
Discriminator
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Discriminator: def __init__(self, height=7, feature_size=512, use_eql=True): """constructor for the class :param height: total height of the discriminator (Must be equal to the Generator depth) :param feature_size: size of the deepest features extracted (Must be equal to Generator latent...
stack_v2_sparse_classes_36k_train_030933
10,883
permissive
[ { "docstring": "constructor for the class :param height: total height of the discriminator (Must be equal to the Generator depth) :param feature_size: size of the deepest features extracted (Must be equal to Generator latent_size) :param use_eql: whether to use equalized learning rate", "name": "__init__", ...
2
stack_v2_sparse_classes_30k_train_014260
Implement the Python class `Discriminator` described below. Class description: Implement the Discriminator class. Method signatures and docstrings: - def __init__(self, height=7, feature_size=512, use_eql=True): constructor for the class :param height: total height of the discriminator (Must be equal to the Generator...
Implement the Python class `Discriminator` described below. Class description: Implement the Discriminator class. Method signatures and docstrings: - def __init__(self, height=7, feature_size=512, use_eql=True): constructor for the class :param height: total height of the discriminator (Must be equal to the Generator...
30e7404924070f63b68e73f33f2b42ea8be22f65
<|skeleton|> class Discriminator: def __init__(self, height=7, feature_size=512, use_eql=True): """constructor for the class :param height: total height of the discriminator (Must be equal to the Generator depth) :param feature_size: size of the deepest features extracted (Must be equal to Generator latent...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Discriminator: def __init__(self, height=7, feature_size=512, use_eql=True): """constructor for the class :param height: total height of the discriminator (Must be equal to the Generator depth) :param feature_size: size of the deepest features extracted (Must be equal to Generator latent_size) :param ...
the_stack_v2_python_sparse
model/pggan/utils/Networks.py
TrendingTechnology/MTV-TSA
train
0
173567c5f93001837948d8172ef77e09f7e207b7
[ "runs_tup = []\nfor run in runs:\n monitor = run.get_alg_monitor()\n max_reward = max(monitor.rewards)\n runs_tup.append((run, max_reward))\nself._result = sorted(runs_tup, key=itemgetter(1), reverse=True)", "if not hasattr(self, '_result'):\n self._result = None\nreturn self._result", "if self.resu...
<|body_start_0|> runs_tup = [] for run in runs: monitor = run.get_alg_monitor() max_reward = max(monitor.rewards) runs_tup.append((run, max_reward)) self._result = sorted(runs_tup, key=itemgetter(1), reverse=True) <|end_body_0|> <|body_start_1|> if no...
Find the best performance achieved within runs.
BestPerformance
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BestPerformance: """Find the best performance achieved within runs.""" def __call__(self, runs): """Sort content of runs by performance. This class creates a tuple with a BenchRun and its respective best performance and then stores in a descending sorted list. The results are accessi...
stack_v2_sparse_classes_36k_train_030934
4,432
permissive
[ { "docstring": "Sort content of runs by performance. This class creates a tuple with a BenchRun and its respective best performance and then stores in a descending sorted list. The results are accessible through the result method. Parameters ---------- runs : List of BenchRun instances May be any subset of Benc...
3
null
Implement the Python class `BestPerformance` described below. Class description: Find the best performance achieved within runs. Method signatures and docstrings: - def __call__(self, runs): Sort content of runs by performance. This class creates a tuple with a BenchRun and its respective best performance and then st...
Implement the Python class `BestPerformance` described below. Class description: Find the best performance achieved within runs. Method signatures and docstrings: - def __call__(self, runs): Sort content of runs by performance. This class creates a tuple with a BenchRun and its respective best performance and then st...
8500c8dd90a2b59a91b988a3c83e529f6c69332f
<|skeleton|> class BestPerformance: """Find the best performance achieved within runs.""" def __call__(self, runs): """Sort content of runs by performance. This class creates a tuple with a BenchRun and its respective best performance and then stores in a descending sorted list. The results are accessi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BestPerformance: """Find the best performance achieved within runs.""" def __call__(self, runs): """Sort content of runs by performance. This class creates a tuple with a BenchRun and its respective best performance and then stores in a descending sorted list. The results are accessible through t...
the_stack_v2_python_sparse
Safe-RL/Safe-RL-Benchmark/SafeRLBench/measure.py
chauncygu/Safe-Reinforcement-Learning-Baselines
train
233
1eeb6e54f67effbf01af3e31d3dd239b998e4fff
[ "if self.standalone:\n yield '<?xml version=\"1.0\"?>'\n yield from super().header()\n yield ''\nyield '<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">'\nreturn", "yield '</svg>'\nif self.standalone:\n yield ''\n yield from super().footer()\nreturn" ]
<|body_start_0|> if self.standalone: yield '<?xml version="1.0"?>' yield from super().header() yield '' yield '<svg version="1.1" xmlns="http://www.w3.org/2000/svg">' return <|end_body_0|> <|body_start_1|> yield '</svg>' if self.standalone: ...
Support for SVG, the scalable vector graphics format
SVG
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SVG: """Support for SVG, the scalable vector graphics format""" def header(self): """Layout the {document} using my stationery for the header and footer""" <|body_0|> def footer(self): """Build the document footer""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_030935
1,453
permissive
[ { "docstring": "Layout the {document} using my stationery for the header and footer", "name": "header", "signature": "def header(self)" }, { "docstring": "Build the document footer", "name": "footer", "signature": "def footer(self)" } ]
2
stack_v2_sparse_classes_30k_train_013304
Implement the Python class `SVG` described below. Class description: Support for SVG, the scalable vector graphics format Method signatures and docstrings: - def header(self): Layout the {document} using my stationery for the header and footer - def footer(self): Build the document footer
Implement the Python class `SVG` described below. Class description: Support for SVG, the scalable vector graphics format Method signatures and docstrings: - def header(self): Layout the {document} using my stationery for the header and footer - def footer(self): Build the document footer <|skeleton|> class SVG: ...
d741c44ffb3e9e1f726bf492202ac8738bb4aa1c
<|skeleton|> class SVG: """Support for SVG, the scalable vector graphics format""" def header(self): """Layout the {document} using my stationery for the header and footer""" <|body_0|> def footer(self): """Build the document footer""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SVG: """Support for SVG, the scalable vector graphics format""" def header(self): """Layout the {document} using my stationery for the header and footer""" if self.standalone: yield '<?xml version="1.0"?>' yield from super().header() yield '' yi...
the_stack_v2_python_sparse
packages/pyre/weaver/SVG.py
pyre/pyre
train
27
fe86294cb26d6c8e26bfcd46f17bb2f43aabbd8b
[ "if _cfg.server_backend == 'cassandra':\n clear_graph()\nelse:\n Gremlin().gremlin_post('graph.truncateBackend();')\nInsertData(gremlin='gremlin_traverser.txt').gremlin_graph()", "json = {'sources': {'ids': [], 'label': 'person', 'properties': {'name': 'marko'}}, 'steps': [{'direction': 'OUT', 'labels': ['k...
<|body_start_0|> if _cfg.server_backend == 'cassandra': clear_graph() else: Gremlin().gremlin_post('graph.truncateBackend();') InsertData(gremlin='gremlin_traverser.txt').gremlin_graph() <|end_body_0|> <|body_start_1|> json = {'sources': {'ids': [], 'label': 'per...
查询一批顶点符合条件的路径
TestCustomizedPaths
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCustomizedPaths: """查询一批顶点符合条件的路径""" def setup_class(self): """测试类开始""" <|body_0|> def test_reqiured_params(self): """source、max_depth :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if _cfg.server_backend == 'cassandra': ...
stack_v2_sparse_classes_36k_train_030936
2,712
no_license
[ { "docstring": "测试类开始", "name": "setup_class", "signature": "def setup_class(self)" }, { "docstring": "source、max_depth :return:", "name": "test_reqiured_params", "signature": "def test_reqiured_params(self)" } ]
2
stack_v2_sparse_classes_30k_train_012543
Implement the Python class `TestCustomizedPaths` described below. Class description: 查询一批顶点符合条件的路径 Method signatures and docstrings: - def setup_class(self): 测试类开始 - def test_reqiured_params(self): source、max_depth :return:
Implement the Python class `TestCustomizedPaths` described below. Class description: 查询一批顶点符合条件的路径 Method signatures and docstrings: - def setup_class(self): 测试类开始 - def test_reqiured_params(self): source、max_depth :return: <|skeleton|> class TestCustomizedPaths: """查询一批顶点符合条件的路径""" def setup_class(self): ...
89e5b34ab925bcc0bbc4ad63302e96c62a420399
<|skeleton|> class TestCustomizedPaths: """查询一批顶点符合条件的路径""" def setup_class(self): """测试类开始""" <|body_0|> def test_reqiured_params(self): """source、max_depth :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCustomizedPaths: """查询一批顶点符合条件的路径""" def setup_class(self): """测试类开始""" if _cfg.server_backend == 'cassandra': clear_graph() else: Gremlin().gremlin_post('graph.truncateBackend();') InsertData(gremlin='gremlin_traverser.txt').gremlin_graph() ...
the_stack_v2_python_sparse
src/graph_function_test/server/algorithm_oltp/test_customized_path.py
hugegraph/hugegraph-test
train
1
5b52c4153f231b0efb645d96d5aee78fa6c47785
[ "i = len(nums) - 2\nwhile i >= 0 and nums[i] >= nums[i + 1]:\n i -= 1\nif i >= 0:\n j = len(nums) - 1\n while j >= 0 and nums[i] >= nums[j]:\n j -= 1\n nums[i], nums[j] = (nums[j], nums[i])\nleft, right = (i + 1, len(nums) - 1)\nwhile left < right:\n nums[left], nums[right] = (nums[right], num...
<|body_start_0|> i = len(nums) - 2 while i >= 0 and nums[i] >= nums[i + 1]: i -= 1 if i >= 0: j = len(nums) - 1 while j >= 0 and nums[i] >= nums[j]: j -= 1 nums[i], nums[j] = (nums[j], nums[i]) left, right = (i + 1, len(nums...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextPermutation(self, nums: List[int]): """方法一:两遍扫描【官方解】 目标:一个大于当前序列的新序列,且变大的幅度尽可能小 解析:""" <|body_0|> def nextPermutation1(self, nums: List[int]): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|b...
stack_v2_sparse_classes_36k_train_030937
2,561
no_license
[ { "docstring": "方法一:两遍扫描【官方解】 目标:一个大于当前序列的新序列,且变大的幅度尽可能小 解析:", "name": "nextPermutation", "signature": "def nextPermutation(self, nums: List[int])" }, { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "nextPermutation1", "s...
2
stack_v2_sparse_classes_30k_test_000429
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums: List[int]): 方法一:两遍扫描【官方解】 目标:一个大于当前序列的新序列,且变大的幅度尽可能小 解析: - def nextPermutation1(self, nums: List[int]): :type nums: List[int] :rtype: void Do not ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums: List[int]): 方法一:两遍扫描【官方解】 目标:一个大于当前序列的新序列,且变大的幅度尽可能小 解析: - def nextPermutation1(self, nums: List[int]): :type nums: List[int] :rtype: void Do not ...
f831fd9603592ae5bee3679924f962a3ebce381c
<|skeleton|> class Solution: def nextPermutation(self, nums: List[int]): """方法一:两遍扫描【官方解】 目标:一个大于当前序列的新序列,且变大的幅度尽可能小 解析:""" <|body_0|> def nextPermutation1(self, nums: List[int]): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def nextPermutation(self, nums: List[int]): """方法一:两遍扫描【官方解】 目标:一个大于当前序列的新序列,且变大的幅度尽可能小 解析:""" i = len(nums) - 2 while i >= 0 and nums[i] >= nums[i + 1]: i -= 1 if i >= 0: j = len(nums) - 1 while j >= 0 and nums[i] >= nums[j]: ...
the_stack_v2_python_sparse
topic23_math/T31_nextPermutation/interview.py
GongFuXiong/leetcode
train
0
a1a395007d8647610334b0fa4c1d0a8bbcd872c0
[ "self.name = name\nself.version = version\nself.propertiesFileContent = propertiesFileContent\nself.ipAddress = ipAddress\nself.osh = None\nself.nodes = []\nself.packages = []\nself.quorumServer = quorumServer", "if self.name:\n self.osh = ObjectStateHolder('serviceguardcluster')\n self.osh.setAttribute('da...
<|body_start_0|> self.name = name self.version = version self.propertiesFileContent = propertiesFileContent self.ipAddress = ipAddress self.osh = None self.nodes = [] self.packages = [] self.quorumServer = quorumServer <|end_body_0|> <|body_start_1|> ...
Data Object represents Service Guard Cluster
Cluster
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cluster: """Data Object represents Service Guard Cluster""" def __init__(self, name, version, ipAddress, propertiesFileContent, quorumServer=None): """@types: str, str, str, str, QuorumServer""" <|body_0|> def build(self): """Creates serviceguardcluster OSH @retu...
stack_v2_sparse_classes_36k_train_030938
23,160
no_license
[ { "docstring": "@types: str, str, str, str, QuorumServer", "name": "__init__", "signature": "def __init__(self, name, version, ipAddress, propertiesFileContent, quorumServer=None)" }, { "docstring": "Creates serviceguardcluster OSH @returns: instance of serviceguardcluster OSH", "name": "bui...
2
stack_v2_sparse_classes_30k_train_010424
Implement the Python class `Cluster` described below. Class description: Data Object represents Service Guard Cluster Method signatures and docstrings: - def __init__(self, name, version, ipAddress, propertiesFileContent, quorumServer=None): @types: str, str, str, str, QuorumServer - def build(self): Creates serviceg...
Implement the Python class `Cluster` described below. Class description: Data Object represents Service Guard Cluster Method signatures and docstrings: - def __init__(self, name, version, ipAddress, propertiesFileContent, quorumServer=None): @types: str, str, str, str, QuorumServer - def build(self): Creates serviceg...
c431e809e8d0f82e1bca7e3429dd0245560b5680
<|skeleton|> class Cluster: """Data Object represents Service Guard Cluster""" def __init__(self, name, version, ipAddress, propertiesFileContent, quorumServer=None): """@types: str, str, str, str, QuorumServer""" <|body_0|> def build(self): """Creates serviceguardcluster OSH @retu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cluster: """Data Object represents Service Guard Cluster""" def __init__(self, name, version, ipAddress, propertiesFileContent, quorumServer=None): """@types: str, str, str, str, QuorumServer""" self.name = name self.version = version self.propertiesFileContent = propertie...
the_stack_v2_python_sparse
reference/ucmdb/discovery/service_guard.py
madmonkyang/cda-record
train
0
bff0e35b1c2e2a7cc4776bdd12ebd0cf320cfee3
[ "if not intervals:\n return 0\nintervals.sort(key=lambda d: d.start)\nend = intervals[0].end\nerased = 0\nfor i in intervals[1:]:\n if i.start < end:\n erased += 1\n end = min(i.end, end)\n else:\n end = i.end\nreturn erased", "if len(p) > len(s) or (s == [] and p == []):\n return...
<|body_start_0|> if not intervals: return 0 intervals.sort(key=lambda d: d.start) end = intervals[0].end erased = 0 for i in intervals[1:]: if i.start < end: erased += 1 end = min(i.end, end) else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def eraseOverlapIntervals(self, intervals): """:type intervals: List[Interval] :rtype: int""" <|body_0|> def findAnagrams(self, s, p): """:type s: str :type p: str :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not in...
stack_v2_sparse_classes_36k_train_030939
4,691
no_license
[ { "docstring": ":type intervals: List[Interval] :rtype: int", "name": "eraseOverlapIntervals", "signature": "def eraseOverlapIntervals(self, intervals)" }, { "docstring": ":type s: str :type p: str :rtype: List[int]", "name": "findAnagrams", "signature": "def findAnagrams(self, s, p)" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def eraseOverlapIntervals(self, intervals): :type intervals: List[Interval] :rtype: int - def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def eraseOverlapIntervals(self, intervals): :type intervals: List[Interval] :rtype: int - def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int] <|skeleton|> ...
692bf0e5aab402d55463274e99ab4d0ed56ce64c
<|skeleton|> class Solution: def eraseOverlapIntervals(self, intervals): """:type intervals: List[Interval] :rtype: int""" <|body_0|> def findAnagrams(self, s, p): """:type s: str :type p: str :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def eraseOverlapIntervals(self, intervals): """:type intervals: List[Interval] :rtype: int""" if not intervals: return 0 intervals.sort(key=lambda d: d.start) end = intervals[0].end erased = 0 for i in intervals[1:]: if i.start ...
the_stack_v2_python_sparse
438-find_anagrams_in_string.py
WweiL/LeetCode
train
0
d7f47a058014efd4aa4e8f07b64b44942e6f85a9
[ "assert self.user_id is not None\nbelongs_to_learnt_list = False\ngoals_limit_exceeded = False\nbelongs_to_learnt_list, goals_limit_exceeded = learner_progress_services.validate_and_add_topic_to_learn_goal(self.user_id, topic_id)\nself.values.update({'belongs_to_learnt_list': belongs_to_learnt_list, 'goals_limit_ex...
<|body_start_0|> assert self.user_id is not None belongs_to_learnt_list = False goals_limit_exceeded = False belongs_to_learnt_list, goals_limit_exceeded = learner_progress_services.validate_and_add_topic_to_learn_goal(self.user_id, topic_id) self.values.update({'belongs_to_learn...
Handles operations related to the learner goals.
LearnerGoalsHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LearnerGoalsHandler: """Handles operations related to the learner goals.""" def post(self, activity_type: str, topic_id: str) -> None: """Adds a topic to the learner's learning goals. Args: activity_type: str. The activity type. topic_id: str. The ID of the topic.""" <|body_0...
stack_v2_sparse_classes_36k_train_030940
3,947
permissive
[ { "docstring": "Adds a topic to the learner's learning goals. Args: activity_type: str. The activity type. topic_id: str. The ID of the topic.", "name": "post", "signature": "def post(self, activity_type: str, topic_id: str) -> None" }, { "docstring": "Removes a topic from the learner's learning...
2
stack_v2_sparse_classes_30k_train_012919
Implement the Python class `LearnerGoalsHandler` described below. Class description: Handles operations related to the learner goals. Method signatures and docstrings: - def post(self, activity_type: str, topic_id: str) -> None: Adds a topic to the learner's learning goals. Args: activity_type: str. The activity type...
Implement the Python class `LearnerGoalsHandler` described below. Class description: Handles operations related to the learner goals. Method signatures and docstrings: - def post(self, activity_type: str, topic_id: str) -> None: Adds a topic to the learner's learning goals. Args: activity_type: str. The activity type...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class LearnerGoalsHandler: """Handles operations related to the learner goals.""" def post(self, activity_type: str, topic_id: str) -> None: """Adds a topic to the learner's learning goals. Args: activity_type: str. The activity type. topic_id: str. The ID of the topic.""" <|body_0...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LearnerGoalsHandler: """Handles operations related to the learner goals.""" def post(self, activity_type: str, topic_id: str) -> None: """Adds a topic to the learner's learning goals. Args: activity_type: str. The activity type. topic_id: str. The ID of the topic.""" assert self.user_id i...
the_stack_v2_python_sparse
core/controllers/learner_goals.py
oppia/oppia
train
6,172
3c7e2e1d237f6cdef2b1601db6e22248424b5cd2
[ "self.config = config\nself.url = config['url']\nself.api_version = '2_0'\nself.default_dimensions = config['dimensions']\nself.token_expiration = 1438\nif 'hostname' not in self.default_dimensions:\n self.default_dimensions['hostname'] = get_hostname()\nlog.debug('Getting token from Keystone')\nself.keystone_ur...
<|body_start_0|> self.config = config self.url = config['url'] self.api_version = '2_0' self.default_dimensions = config['dimensions'] self.token_expiration = 1438 if 'hostname' not in self.default_dimensions: self.default_dimensions['hostname'] = get_hostname...
Sends measurements to MonAPI Any errors should raise an exception so the transaction calling this is not committed
MonAPI
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MonAPI: """Sends measurements to MonAPI Any errors should raise an exception so the transaction calling this is not committed""" def __init__(self, config): """Initialize Mon api client connection.""" <|body_0|> def _post(self, measurements): """Does the actual h...
stack_v2_sparse_classes_36k_train_030941
4,034
permissive
[ { "docstring": "Initialize Mon api client connection.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Does the actual http post measurements is a list of Measurement", "name": "_post", "signature": "def _post(self, measurements)" }, { "docstring...
4
stack_v2_sparse_classes_30k_train_019338
Implement the Python class `MonAPI` described below. Class description: Sends measurements to MonAPI Any errors should raise an exception so the transaction calling this is not committed Method signatures and docstrings: - def __init__(self, config): Initialize Mon api client connection. - def _post(self, measurement...
Implement the Python class `MonAPI` described below. Class description: Sends measurements to MonAPI Any errors should raise an exception so the transaction calling this is not committed Method signatures and docstrings: - def __init__(self, config): Initialize Mon api client connection. - def _post(self, measurement...
b98424f5271cdc076654a1acf4f87066d5bedb61
<|skeleton|> class MonAPI: """Sends measurements to MonAPI Any errors should raise an exception so the transaction calling this is not committed""" def __init__(self, config): """Initialize Mon api client connection.""" <|body_0|> def _post(self, measurements): """Does the actual h...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MonAPI: """Sends measurements to MonAPI Any errors should raise an exception so the transaction calling this is not committed""" def __init__(self, config): """Initialize Mon api client connection.""" self.config = config self.url = config['url'] self.api_version = '2_0' ...
the_stack_v2_python_sparse
monagent/forwarder/api/mon.py
ghessler/mon-agent
train
1
286b2390ffa2a5408b9ff12a690525cf5d0cda73
[ "self.data = matrix\nself.res = deepcopy(matrix)\nfor i in range(0, len(matrix)):\n for j in range(0, len(matrix[0])):\n self.res[i][j] = sum(self.data[i][0:j + 1])", "sumD = 0\nfor i in range(row1, row2 + 1):\n sumD = sumD + self.res[i][col2] - self.res[i][col1] + self.data[i][col1]\nreturn sumD" ]
<|body_start_0|> self.data = matrix self.res = deepcopy(matrix) for i in range(0, len(matrix)): for j in range(0, len(matrix[0])): self.res[i][j] = sum(self.data[i][0:j + 1]) <|end_body_0|> <|body_start_1|> sumD = 0 for i in range(row1, row2 + 1): ...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_030942
1,193
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, row1, col1, row2, col2)" ...
2
stack_v2_sparse_classes_30k_test_000116
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
94b46e6c89d254d9dafc504f14c60136403b7ae8
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" self.data = matrix self.res = deepcopy(matrix) for i in range(0, len(matrix)): for j in range(0, len(matrix[0])): self.res[i][j] = sum(self.data[i][0:j + 1]) def sumRegio...
the_stack_v2_python_sparse
leetcode_NumMatrix.py
lp2016/New_Algorithm
train
0
6c1ccf4bbf6f4e3e80c43ccc498b8f96a2d13788
[ "super().__init__()\nself.out_channels = out_channels\nself.full = nn.Linear(style_channels, out_channels)", "style_feat = self.full(style_feat)\nout = x + style_feat.unsqueeze(-1).unsqueeze(-1)\nreturn out" ]
<|body_start_0|> super().__init__() self.out_channels = out_channels self.full = nn.Linear(style_channels, out_channels) <|end_body_0|> <|body_start_1|> style_feat = self.full(style_feat) out = x + style_feat.unsqueeze(-1).unsqueeze(-1) return out <|end_body_1|>
StyleBlock
[ "MIT", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StyleBlock: def __init__(self, style_channels: int, out_channels: int) -> None: """Add a style vector to the input tensor. See Cellpose. Cellpose: - https://www.nature.com/articles/s41592-020-01018-x Parameters ---------- style_channels : int Number of style vector channels. out_channels...
stack_v2_sparse_classes_36k_train_030943
5,285
permissive
[ { "docstring": "Add a style vector to the input tensor. See Cellpose. Cellpose: - https://www.nature.com/articles/s41592-020-01018-x Parameters ---------- style_channels : int Number of style vector channels. out_channels : int Number of output channels.", "name": "__init__", "signature": "def __init__(...
2
stack_v2_sparse_classes_30k_train_014146
Implement the Python class `StyleBlock` described below. Class description: Implement the StyleBlock class. Method signatures and docstrings: - def __init__(self, style_channels: int, out_channels: int) -> None: Add a style vector to the input tensor. See Cellpose. Cellpose: - https://www.nature.com/articles/s41592-0...
Implement the Python class `StyleBlock` described below. Class description: Implement the StyleBlock class. Method signatures and docstrings: - def __init__(self, style_channels: int, out_channels: int) -> None: Add a style vector to the input tensor. See Cellpose. Cellpose: - https://www.nature.com/articles/s41592-0...
7f79405012eb934b419bbdba8de23f35e840ca85
<|skeleton|> class StyleBlock: def __init__(self, style_channels: int, out_channels: int) -> None: """Add a style vector to the input tensor. See Cellpose. Cellpose: - https://www.nature.com/articles/s41592-020-01018-x Parameters ---------- style_channels : int Number of style vector channels. out_channels...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StyleBlock: def __init__(self, style_channels: int, out_channels: int) -> None: """Add a style vector to the input tensor. See Cellpose. Cellpose: - https://www.nature.com/articles/s41592-020-01018-x Parameters ---------- style_channels : int Number of style vector channels. out_channels : int Number ...
the_stack_v2_python_sparse
cellseg_models_pytorch/modules/misc_modules.py
okunator/cellseg_models.pytorch
train
43
4f13d081e64ede2a1cce0231f137bff549c0dfdf
[ "if model._meta.app_label == 'rcs_assets':\n return 'rcs_assets'\nreturn None", "if model._meta.app_label == 'rcs_assets':\n return 'rcs_assets'\nreturn None", "if obj1._meta.app_label == 'rcs_assets' or obj2._meta.app_label == 'rcs_assets':\n return True\nreturn None", "if app_label == 'rcs_assets':...
<|body_start_0|> if model._meta.app_label == 'rcs_assets': return 'rcs_assets' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label == 'rcs_assets': return 'rcs_assets' return None <|end_body_1|> <|body_start_2|> if obj1._meta.app_label =...
A read-only router to control all database operations on models in the rcs_assets application.
RCSAssetsRouter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RCSAssetsRouter: """A read-only router to control all database operations on models in the rcs_assets application.""" def db_for_read(self, model, **hints): """Attempts to read rcs_assets models go to rcs_assets.""" <|body_0|> def db_for_write(self, model, **hints): ...
stack_v2_sparse_classes_36k_train_030944
1,057
permissive
[ { "docstring": "Attempts to read rcs_assets models go to rcs_assets.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "No writes.", "name": "db_for_write", "signature": "def db_for_write(self, model, **hints)" }, { "docstring": "Allo...
4
stack_v2_sparse_classes_30k_train_007708
Implement the Python class `RCSAssetsRouter` described below. Class description: A read-only router to control all database operations on models in the rcs_assets application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read rcs_assets models go to rcs_assets. - def db_for_w...
Implement the Python class `RCSAssetsRouter` described below. Class description: A read-only router to control all database operations on models in the rcs_assets application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read rcs_assets models go to rcs_assets. - def db_for_w...
c6e3bf2b6c79d60b9f278c4c352899f33ce02ddb
<|skeleton|> class RCSAssetsRouter: """A read-only router to control all database operations on models in the rcs_assets application.""" def db_for_read(self, model, **hints): """Attempts to read rcs_assets models go to rcs_assets.""" <|body_0|> def db_for_write(self, model, **hints): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RCSAssetsRouter: """A read-only router to control all database operations on models in the rcs_assets application.""" def db_for_read(self, model, **hints): """Attempts to read rcs_assets models go to rcs_assets.""" if model._meta.app_label == 'rcs_assets': return 'rcs_assets'...
the_stack_v2_python_sparse
rcs_assets/router.py
rockychen-dpaw/oim-cms
train
0
b50145d1a8834f56f496b977e2ceabe3ea3a84ed
[ "w = PlotProperties(None, color=1, marker=3, marker_size=10, legend='LL')\nyield w\n'Destroy the GUI'\nw.close()", "assert isinstance(widget, QtWidgets.QDialog)\nassert widget.windowTitle() == 'Modify Plot Properties'\nassert widget.cbColor.currentText() == 'Green'\nassert widget.cbColor.count() == 7\nassert widg...
<|body_start_0|> w = PlotProperties(None, color=1, marker=3, marker_size=10, legend='LL') yield w 'Destroy the GUI' w.close() <|end_body_0|> <|body_start_1|> assert isinstance(widget, QtWidgets.QDialog) assert widget.windowTitle() == 'Modify Plot Properties' asse...
Test the PlotProperties
PlotPropertiesTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlotPropertiesTest: """Test the PlotProperties""" def widget(self, qapp): """Create/Destroy the PlotProperties""" <|body_0|> def testDefaults(self, widget): """Test the GUI in its default state""" <|body_1|> def testDefaultsWithCustomColor(self, widg...
stack_v2_sparse_classes_36k_train_030945
3,276
permissive
[ { "docstring": "Create/Destroy the PlotProperties", "name": "widget", "signature": "def widget(self, qapp)" }, { "docstring": "Test the GUI in its default state", "name": "testDefaults", "signature": "def testDefaults(self, widget)" }, { "docstring": "Test the GUI when called wit...
5
null
Implement the Python class `PlotPropertiesTest` described below. Class description: Test the PlotProperties Method signatures and docstrings: - def widget(self, qapp): Create/Destroy the PlotProperties - def testDefaults(self, widget): Test the GUI in its default state - def testDefaultsWithCustomColor(self, widget):...
Implement the Python class `PlotPropertiesTest` described below. Class description: Test the PlotProperties Method signatures and docstrings: - def widget(self, qapp): Create/Destroy the PlotProperties - def testDefaults(self, widget): Test the GUI in its default state - def testDefaultsWithCustomColor(self, widget):...
55b1e9f6db58e33729f2a93b7dd1d8bf255b46f7
<|skeleton|> class PlotPropertiesTest: """Test the PlotProperties""" def widget(self, qapp): """Create/Destroy the PlotProperties""" <|body_0|> def testDefaults(self, widget): """Test the GUI in its default state""" <|body_1|> def testDefaultsWithCustomColor(self, widg...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlotPropertiesTest: """Test the PlotProperties""" def widget(self, qapp): """Create/Destroy the PlotProperties""" w = PlotProperties(None, color=1, marker=3, marker_size=10, legend='LL') yield w 'Destroy the GUI' w.close() def testDefaults(self, widget): ...
the_stack_v2_python_sparse
src/sas/qtgui/Plotting/UnitTesting/PlotPropertiesTest.py
SasView/sasview
train
48
4d2b16d984f666c8f889f4220e454810707c341b
[ "super().__init__()\nself._sampler_inbatch = sampler_inbatch\nself._triplet_margin_loss = TripletMarginLoss(margin=margin)", "labels_list = convert_labels2list(labels)\nfeatures_anchor, features_positive, features_negative = self._sampler_inbatch.sample(features=features, labels=labels_list)\nloss = self._triplet...
<|body_start_0|> super().__init__() self._sampler_inbatch = sampler_inbatch self._triplet_margin_loss = TripletMarginLoss(margin=margin) <|end_body_0|> <|body_start_1|> labels_list = convert_labels2list(labels) features_anchor, features_positive, features_negative = self._sample...
This class combines in-batch sampling of triplets and default TripletMargingLoss from PyTorch.
TripletMarginLossWithSampler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TripletMarginLossWithSampler: """This class combines in-batch sampling of triplets and default TripletMargingLoss from PyTorch.""" def __init__(self, margin: float, sampler_inbatch: 'IInbatchTripletSampler'): """Args: margin: margin value sampler_inbatch: sampler for forming triplets...
stack_v2_sparse_classes_36k_train_030946
10,393
permissive
[ { "docstring": "Args: margin: margin value sampler_inbatch: sampler for forming triplets inside the batch", "name": "__init__", "signature": "def __init__(self, margin: float, sampler_inbatch: 'IInbatchTripletSampler')" }, { "docstring": "Args: features: features with shape [batch_size, features...
2
null
Implement the Python class `TripletMarginLossWithSampler` described below. Class description: This class combines in-batch sampling of triplets and default TripletMargingLoss from PyTorch. Method signatures and docstrings: - def __init__(self, margin: float, sampler_inbatch: 'IInbatchTripletSampler'): Args: margin: m...
Implement the Python class `TripletMarginLossWithSampler` described below. Class description: This class combines in-batch sampling of triplets and default TripletMargingLoss from PyTorch. Method signatures and docstrings: - def __init__(self, margin: float, sampler_inbatch: 'IInbatchTripletSampler'): Args: margin: m...
e99f90655d0efcf22559a46e928f0f98c9807ebf
<|skeleton|> class TripletMarginLossWithSampler: """This class combines in-batch sampling of triplets and default TripletMargingLoss from PyTorch.""" def __init__(self, margin: float, sampler_inbatch: 'IInbatchTripletSampler'): """Args: margin: margin value sampler_inbatch: sampler for forming triplets...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TripletMarginLossWithSampler: """This class combines in-batch sampling of triplets and default TripletMargingLoss from PyTorch.""" def __init__(self, margin: float, sampler_inbatch: 'IInbatchTripletSampler'): """Args: margin: margin value sampler_inbatch: sampler for forming triplets inside the b...
the_stack_v2_python_sparse
catalyst/contrib/losses/triplet.py
catalyst-team/catalyst
train
3,038
90f118203d5556bd5e4753ac63b74a1273e43c7f
[ "for i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if nums[i] == nums[j]:\n return True\nreturn False", "nums = sorted(nums)\nfor i in range(1, len(nums)):\n if nums[i] == nums[i - 1]:\n return True\nreturn False", "distinct_nums = set()\nfor number in nums:\n if...
<|body_start_0|> for i in range(len(nums)): for j in range(i + 1, len(nums)): if nums[i] == nums[j]: return True return False <|end_body_0|> <|body_start_1|> nums = sorted(nums) for i in range(1, len(nums)): if nums[i] == nums[...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsDuplicate(self, nums): """Brute Force Solution Time N^2, Space 1 :type nums: List[int] :rtype: bool""" <|body_0|> def containsDuplciateOptimized(self, nums): """Time N lg N Memory 1 :type nums: List[int] :rtype: bool""" <|body_1|> d...
stack_v2_sparse_classes_36k_train_030947
1,217
permissive
[ { "docstring": "Brute Force Solution Time N^2, Space 1 :type nums: List[int] :rtype: bool", "name": "containsDuplicate", "signature": "def containsDuplicate(self, nums)" }, { "docstring": "Time N lg N Memory 1 :type nums: List[int] :rtype: bool", "name": "containsDuplciateOptimized", "si...
3
stack_v2_sparse_classes_30k_train_009247
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsDuplicate(self, nums): Brute Force Solution Time N^2, Space 1 :type nums: List[int] :rtype: bool - def containsDuplciateOptimized(self, nums): Time N lg N Memory 1 :t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsDuplicate(self, nums): Brute Force Solution Time N^2, Space 1 :type nums: List[int] :rtype: bool - def containsDuplciateOptimized(self, nums): Time N lg N Memory 1 :t...
d2ffcccede5d1543aea48f18a39cdbd3d83e3ed8
<|skeleton|> class Solution: def containsDuplicate(self, nums): """Brute Force Solution Time N^2, Space 1 :type nums: List[int] :rtype: bool""" <|body_0|> def containsDuplciateOptimized(self, nums): """Time N lg N Memory 1 :type nums: List[int] :rtype: bool""" <|body_1|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def containsDuplicate(self, nums): """Brute Force Solution Time N^2, Space 1 :type nums: List[int] :rtype: bool""" for i in range(len(nums)): for j in range(i + 1, len(nums)): if nums[i] == nums[j]: return True return False ...
the_stack_v2_python_sparse
arrays/find_duplicates.py
kandarpck/leetcode
train
0
a320e9d341febd41831eab90935fb24784544471
[ "context = self._context or {}\nrp_obj = self.env['res.partner']\nacc_part_brw = rp_obj._find_accounting_partner(rp_obj.browse(partner_id))\nreturn {'value': {'partner_vat': acc_part_brw.vat[2:]}}", "context = self._context or {}\nrate_brw = self.env['islr.rates'].browse(rate_id)\nreturn {'value': {'porcent_rete'...
<|body_start_0|> context = self._context or {} rp_obj = self.env['res.partner'] acc_part_brw = rp_obj._find_accounting_partner(rp_obj.browse(partner_id)) return {'value': {'partner_vat': acc_part_brw.vat[2:]}} <|end_body_0|> <|body_start_1|> context = self._context or {} ...
IslrXmlWhLine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IslrXmlWhLine: def onchange_partner_vat(self, partner_id): """Changing the partner, the partner_vat field is updated.""" <|body_0|> def onchange_code_perc(self, rate_id): """Changing the rate of the islr, the porcent_rete and concept_code fields is updated.""" ...
stack_v2_sparse_classes_36k_train_030948
15,777
no_license
[ { "docstring": "Changing the partner, the partner_vat field is updated.", "name": "onchange_partner_vat", "signature": "def onchange_partner_vat(self, partner_id)" }, { "docstring": "Changing the rate of the islr, the porcent_rete and concept_code fields is updated.", "name": "onchange_code_...
2
null
Implement the Python class `IslrXmlWhLine` described below. Class description: Implement the IslrXmlWhLine class. Method signatures and docstrings: - def onchange_partner_vat(self, partner_id): Changing the partner, the partner_vat field is updated. - def onchange_code_perc(self, rate_id): Changing the rate of the is...
Implement the Python class `IslrXmlWhLine` described below. Class description: Implement the IslrXmlWhLine class. Method signatures and docstrings: - def onchange_partner_vat(self, partner_id): Changing the partner, the partner_vat field is updated. - def onchange_code_perc(self, rate_id): Changing the rate of the is...
b95909d0689fc787185290565f0873040a6027cf
<|skeleton|> class IslrXmlWhLine: def onchange_partner_vat(self, partner_id): """Changing the partner, the partner_vat field is updated.""" <|body_0|> def onchange_code_perc(self, rate_id): """Changing the rate of the islr, the porcent_rete and concept_code fields is updated.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IslrXmlWhLine: def onchange_partner_vat(self, partner_id): """Changing the partner, the partner_vat field is updated.""" context = self._context or {} rp_obj = self.env['res.partner'] acc_part_brw = rp_obj._find_accounting_partner(rp_obj.browse(partner_id)) return {'val...
the_stack_v2_python_sparse
localizacion_metromed/l10n_ve_withholding_islr/models/islr_xml_wh.py
Tysamncaweb/produccion2
train
1
d9ed09bd2e1ad82f43e3df80d31db225925a16c2
[ "string = ''\nnodes = [root]\nwhile nodes:\n node = nodes.pop(0)\n if node is None:\n string += 'None#'\n else:\n string += str(node.val) + '#'\n nodes.append(node.left)\n nodes.append(node.right)\nreturn string", "i = 0\nval = ''\nnodes = []\nj = -1\nwhile i < len(data):\n ...
<|body_start_0|> string = '' nodes = [root] while nodes: node = nodes.pop(0) if node is None: string += 'None#' else: string += str(node.val) + '#' nodes.append(node.left) nodes.append(node.right)...
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_030949
1,243
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_003594
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:...
15f012927dc34b5d751af6633caa5e8882d26ff7
<|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""" string = '' nodes = [root] while nodes: node = nodes.pop(0) if node is None: string += 'None#' else: s...
the_stack_v2_python_sparse
python/297.SerializeAndDeserializeBinaryTree.py
MaxPoon/Leetcode
train
15
da6978f7c5c5ec78529bf8b2d8576f133f89ef27
[ "logging.Handler.__init__(self)\nQtCore.QObject.__init__(self)\nself.setFormatter(logging.Formatter('%(levelname)s (%(name)s): %(message)s'))", "try:\n msg = self.format(record)\n self.show_log.emit([msg])\nexcept (KeyboardInterrupt, SystemExit):\n raise\nexcept:\n self.handleError(record)" ]
<|body_start_0|> logging.Handler.__init__(self) QtCore.QObject.__init__(self) self.setFormatter(logging.Formatter('%(levelname)s (%(name)s): %(message)s')) <|end_body_0|> <|body_start_1|> try: msg = self.format(record) self.show_log.emit([msg]) except (Ke...
A handler class which sends log strings to a wx object
LogHandler
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogHandler: """A handler class which sends log strings to a wx object""" def __init__(self): """Initialize the handler""" <|body_0|> def emit(self, record): """Emit a record.""" <|body_1|> <|end_skeleton|> <|body_start_0|> logging.Handler.__init...
stack_v2_sparse_classes_36k_train_030950
13,593
permissive
[ { "docstring": "Initialize the handler", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Emit a record.", "name": "emit", "signature": "def emit(self, record)" } ]
2
stack_v2_sparse_classes_30k_train_011771
Implement the Python class `LogHandler` described below. Class description: A handler class which sends log strings to a wx object Method signatures and docstrings: - def __init__(self): Initialize the handler - def emit(self, record): Emit a record.
Implement the Python class `LogHandler` described below. Class description: A handler class which sends log strings to a wx object Method signatures and docstrings: - def __init__(self): Initialize the handler - def emit(self, record): Emit a record. <|skeleton|> class LogHandler: """A handler class which sends ...
8e2f39d1ad2f3351ef31009e810cf9ab6a750693
<|skeleton|> class LogHandler: """A handler class which sends log strings to a wx object""" def __init__(self): """Initialize the handler""" <|body_0|> def emit(self, record): """Emit a record.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LogHandler: """A handler class which sends log strings to a wx object""" def __init__(self): """Initialize the handler""" logging.Handler.__init__(self) QtCore.QObject.__init__(self) self.setFormatter(logging.Formatter('%(levelname)s (%(name)s): %(message)s')) def emi...
the_stack_v2_python_sparse
pyrpl/widgets/pyrpl_widget.py
lneuhaus/pyrpl
train
120
0f41461bb3aa7919169ee81fc9154f5cdb26756c
[ "super(Reweighing, self).__init__(unprivileged_groups=unprivileged_groups, privileged_groups=privileged_groups)\nself.unprivileged_groups = unprivileged_groups\nself.privileged_groups = privileged_groups\nself.w_p_fav = 1.0\nself.w_p_unfav = 1.0\nself.w_up_fav = 1.0\nself.w_up_unfav = 1.0", "priv_cond, unpriv_con...
<|body_start_0|> super(Reweighing, self).__init__(unprivileged_groups=unprivileged_groups, privileged_groups=privileged_groups) self.unprivileged_groups = unprivileged_groups self.privileged_groups = privileged_groups self.w_p_fav = 1.0 self.w_p_unfav = 1.0 self.w_up_fav ...
Reweighing is a preprocessing technique that Weights the examples in each (group, label) combination differently to ensure fairness before classification [4]_. References: .. [4] F. Kamiran and T. Calders, "Data Preprocessing Techniques for Classification without Discrimination," Knowledge and Information Systems, 2012...
Reweighing
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reweighing: """Reweighing is a preprocessing technique that Weights the examples in each (group, label) combination differently to ensure fairness before classification [4]_. References: .. [4] F. Kamiran and T. Calders, "Data Preprocessing Techniques for Classification without Discrimination," K...
stack_v2_sparse_classes_36k_train_030951
4,913
permissive
[ { "docstring": "Args: unprivileged_groups (list(dict)): Representation for unprivileged group. privileged_groups (list(dict)): Representation for privileged group.", "name": "__init__", "signature": "def __init__(self, unprivileged_groups, privileged_groups)" }, { "docstring": "Compute the weigh...
4
null
Implement the Python class `Reweighing` described below. Class description: Reweighing is a preprocessing technique that Weights the examples in each (group, label) combination differently to ensure fairness before classification [4]_. References: .. [4] F. Kamiran and T. Calders, "Data Preprocessing Techniques for Cl...
Implement the Python class `Reweighing` described below. Class description: Reweighing is a preprocessing technique that Weights the examples in each (group, label) combination differently to ensure fairness before classification [4]_. References: .. [4] F. Kamiran and T. Calders, "Data Preprocessing Techniques for Cl...
6f9972e4a7dbca2402f29b86ea67889143dbeb3e
<|skeleton|> class Reweighing: """Reweighing is a preprocessing technique that Weights the examples in each (group, label) combination differently to ensure fairness before classification [4]_. References: .. [4] F. Kamiran and T. Calders, "Data Preprocessing Techniques for Classification without Discrimination," K...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Reweighing: """Reweighing is a preprocessing technique that Weights the examples in each (group, label) combination differently to ensure fairness before classification [4]_. References: .. [4] F. Kamiran and T. Calders, "Data Preprocessing Techniques for Classification without Discrimination," Knowledge and ...
the_stack_v2_python_sparse
aif360/algorithms/preprocessing/reweighing.py
Trusted-AI/AIF360
train
1,157
16756e27a5c850618b7b29a93c8e10e8d11def36
[ "self.distribution_res = dist_res\nself.mean_z = None\nself.std_z = None\nself.z_edges = []\nself.firing_prob = None\nself.firing_prob_nonlin = None\nself.learned = False", "self.mean_z = np.mean(z, axis=0)\nself.std_z = np.std(z, axis=0)\np_spike = np.mean(y)\np_z, p_z_spike, self.z_edges = z_dist(z, y, self.dis...
<|body_start_0|> self.distribution_res = dist_res self.mean_z = None self.std_z = None self.z_edges = [] self.firing_prob = None self.firing_prob_nonlin = None self.learned = False <|end_body_0|> <|body_start_1|> self.mean_z = np.mean(z, axis=0) s...
Generic 1- or 2-D nonlinearity for LN or context models
Nonlinearity
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Nonlinearity: """Generic 1- or 2-D nonlinearity for LN or context models""" def __init__(self, dist_res=11): """Create nonliearity object Args: dist_res: resolution along each dimension when approximating probability distributions Raise""" <|body_0|> def estimate(self, z...
stack_v2_sparse_classes_36k_train_030952
3,357
permissive
[ { "docstring": "Create nonliearity object Args: dist_res: resolution along each dimension when approximating probability distributions Raise", "name": "__init__", "signature": "def __init__(self, dist_res=11)" }, { "docstring": "Estimating the probability distribution p(spike|z) This function es...
3
stack_v2_sparse_classes_30k_train_018351
Implement the Python class `Nonlinearity` described below. Class description: Generic 1- or 2-D nonlinearity for LN or context models Method signatures and docstrings: - def __init__(self, dist_res=11): Create nonliearity object Args: dist_res: resolution along each dimension when approximating probability distributi...
Implement the Python class `Nonlinearity` described below. Class description: Generic 1- or 2-D nonlinearity for LN or context models Method signatures and docstrings: - def __init__(self, dist_res=11): Create nonliearity object Args: dist_res: resolution along each dimension when approximating probability distributi...
48ad0f8ff161b516363396e099ea19795403d303
<|skeleton|> class Nonlinearity: """Generic 1- or 2-D nonlinearity for LN or context models""" def __init__(self, dist_res=11): """Create nonliearity object Args: dist_res: resolution along each dimension when approximating probability distributions Raise""" <|body_0|> def estimate(self, z...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Nonlinearity: """Generic 1- or 2-D nonlinearity for LN or context models""" def __init__(self, dist_res=11): """Create nonliearity object Args: dist_res: resolution along each dimension when approximating probability distributions Raise""" self.distribution_res = dist_res self.mea...
the_stack_v2_python_sparse
rf_models/rf_nonlinearity.py
JohanWesto/receptive-field-models
train
1
ae9fec5d297b5f84a8cbcb6a18e57a07393e2e34
[ "master_ms_tuple = data.DESCRIPT_DICT[activity]\nms_act_descript = get_linear_nlg(master_ms_tuple)\nreturn ms_act_descript", "master_ms_tuple = data.MMT_GEN_DESCRIPT\nms_gen_descript = get_linear_nlg(master_ms_tuple)\nreturn ms_gen_descript", "attr = handler_input.attributes_manager.session_attributes\nif activ...
<|body_start_0|> master_ms_tuple = data.DESCRIPT_DICT[activity] ms_act_descript = get_linear_nlg(master_ms_tuple) return ms_act_descript <|end_body_0|> <|body_start_1|> master_ms_tuple = data.MMT_GEN_DESCRIPT ms_gen_descript = get_linear_nlg(master_ms_tuple) return ms_ge...
DescriptUtils
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DescriptUtils: def get_ms_corresponding_descript(activity: str) -> str: """Returns description of the passed activity.""" <|body_0|> def get_ms_overall_act_descript() -> str: """Returns description of overall activities. Triggered if activity slot is not resolved."""...
stack_v2_sparse_classes_36k_train_030953
2,421
permissive
[ { "docstring": "Returns description of the passed activity.", "name": "get_ms_corresponding_descript", "signature": "def get_ms_corresponding_descript(activity: str) -> str" }, { "docstring": "Returns description of overall activities. Triggered if activity slot is not resolved.", "name": "g...
4
null
Implement the Python class `DescriptUtils` described below. Class description: Implement the DescriptUtils class. Method signatures and docstrings: - def get_ms_corresponding_descript(activity: str) -> str: Returns description of the passed activity. - def get_ms_overall_act_descript() -> str: Returns description of ...
Implement the Python class `DescriptUtils` described below. Class description: Implement the DescriptUtils class. Method signatures and docstrings: - def get_ms_corresponding_descript(activity: str) -> str: Returns description of the passed activity. - def get_ms_overall_act_descript() -> str: Returns description of ...
1072dea1a5be0b339211ff39db6a89a90aca64c1
<|skeleton|> class DescriptUtils: def get_ms_corresponding_descript(activity: str) -> str: """Returns description of the passed activity.""" <|body_0|> def get_ms_overall_act_descript() -> str: """Returns description of overall activities. Triggered if activity slot is not resolved."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DescriptUtils: def get_ms_corresponding_descript(activity: str) -> str: """Returns description of the passed activity.""" master_ms_tuple = data.DESCRIPT_DICT[activity] ms_act_descript = get_linear_nlg(master_ms_tuple) return ms_act_descript def get_ms_overall_act_descript...
the_stack_v2_python_sparse
1_code/act_descriptions/act_descript_utils.py
jaimiles23/Multiplication-Medley
train
0
876d1d26635d85f2f94a706ea78757ce80e3824d
[ "if 'odd' == 'odd':\n arrayextension = 5\nelse:\n arrayextension = 0\narraylength = 96 + arrayextension\nMaxVal = 255\nMinVal = 0\nself.gentest = bytes([MaxVal // 2] * arraylength)", "with self.assertRaises(TypeError):\n result = bytesfunc.bmin(1, nosimd=True)\nwith self.assertRaises(TypeError):\n res...
<|body_start_0|> if 'odd' == 'odd': arrayextension = 5 else: arrayextension = 0 arraylength = 96 + arrayextension MaxVal = 255 MinVal = 0 self.gentest = bytes([MaxVal // 2] * arraylength) <|end_body_0|> <|body_start_1|> with self.assertRai...
Test bmin for basic parameter tests. op_template_params
bmin_parameter_odd_arraysize_without_simd_bytes
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class bmin_parameter_odd_arraysize_without_simd_bytes: """Test bmin for basic parameter tests. op_template_params""" def setUp(self): """Initialise.""" <|body_0|> def test_bmin_param_function_01(self): """Test bmin - Sequence type bytes. Test invalid parameter type odd...
stack_v2_sparse_classes_36k_train_030954
49,998
permissive
[ { "docstring": "Initialise.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test bmin - Sequence type bytes. Test invalid parameter type odd length array without SIMD.", "name": "test_bmin_param_function_01", "signature": "def test_bmin_param_function_01(self)" }, ...
5
stack_v2_sparse_classes_30k_train_000027
Implement the Python class `bmin_parameter_odd_arraysize_without_simd_bytes` described below. Class description: Test bmin for basic parameter tests. op_template_params Method signatures and docstrings: - def setUp(self): Initialise. - def test_bmin_param_function_01(self): Test bmin - Sequence type bytes. Test inval...
Implement the Python class `bmin_parameter_odd_arraysize_without_simd_bytes` described below. Class description: Test bmin for basic parameter tests. op_template_params Method signatures and docstrings: - def setUp(self): Initialise. - def test_bmin_param_function_01(self): Test bmin - Sequence type bytes. Test inval...
28fe0705fc59b0646a4d44e539c919173e8e8b99
<|skeleton|> class bmin_parameter_odd_arraysize_without_simd_bytes: """Test bmin for basic parameter tests. op_template_params""" def setUp(self): """Initialise.""" <|body_0|> def test_bmin_param_function_01(self): """Test bmin - Sequence type bytes. Test invalid parameter type odd...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class bmin_parameter_odd_arraysize_without_simd_bytes: """Test bmin for basic parameter tests. op_template_params""" def setUp(self): """Initialise.""" if 'odd' == 'odd': arrayextension = 5 else: arrayextension = 0 arraylength = 96 + arrayextension ...
the_stack_v2_python_sparse
unittest/test_bmin.py
m1griffin/bytesfunc
train
2
5c60d785931e3ded631f928274b04f364c560cc2
[ "super().__init__(dist_sync_on_step=dist_sync_on_step)\nself.threshold = threshold\nself.length = length\nself.reduce_dims = reduce_dims\nself.add_state('hits', default=torch.zeros(length), dist_reduce_fx='sum')\nself.add_state('false_alarms', default=torch.zeros(length), dist_reduce_fx='sum')\nself.add_state('miss...
<|body_start_0|> super().__init__(dist_sync_on_step=dist_sync_on_step) self.threshold = threshold self.length = length self.reduce_dims = reduce_dims self.add_state('hits', default=torch.zeros(length), dist_reduce_fx='sum') self.add_state('false_alarms', default=torch.zer...
Equivalent Threat Score metric.
ETS
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ETS: """Equivalent Threat Score metric.""" def __init__(self, threshold, length, reduce_dims=(0, 2, 3, 4), dist_sync_on_step=False): """Initilize metric.""" <|body_0|> def update(self, preds: torch.Tensor, target: torch.Tensor): """Update calculations.""" ...
stack_v2_sparse_classes_36k_train_030955
4,694
permissive
[ { "docstring": "Initilize metric.", "name": "__init__", "signature": "def __init__(self, threshold, length, reduce_dims=(0, 2, 3, 4), dist_sync_on_step=False)" }, { "docstring": "Update calculations.", "name": "update", "signature": "def update(self, preds: torch.Tensor, target: torch.Te...
3
stack_v2_sparse_classes_30k_train_001740
Implement the Python class `ETS` described below. Class description: Equivalent Threat Score metric. Method signatures and docstrings: - def __init__(self, threshold, length, reduce_dims=(0, 2, 3, 4), dist_sync_on_step=False): Initilize metric. - def update(self, preds: torch.Tensor, target: torch.Tensor): Update cal...
Implement the Python class `ETS` described below. Class description: Equivalent Threat Score metric. Method signatures and docstrings: - def __init__(self, threshold, length, reduce_dims=(0, 2, 3, 4), dist_sync_on_step=False): Initilize metric. - def update(self, preds: torch.Tensor, target: torch.Tensor): Update cal...
655e7dc62f28f142521d3abb7221e4b6860452a4
<|skeleton|> class ETS: """Equivalent Threat Score metric.""" def __init__(self, threshold, length, reduce_dims=(0, 2, 3, 4), dist_sync_on_step=False): """Initilize metric.""" <|body_0|> def update(self, preds: torch.Tensor, target: torch.Tensor): """Update calculations.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ETS: """Equivalent Threat Score metric.""" def __init__(self, threshold, length, reduce_dims=(0, 2, 3, 4), dist_sync_on_step=False): """Initilize metric.""" super().__init__(dist_sync_on_step=dist_sync_on_step) self.threshold = threshold self.length = length self.r...
the_stack_v2_python_sparse
metrics/cat_scores.py
fmidev/lagrangian-convolutional-neural-network
train
9
601ba2bdebd6037995f3fc07a4ced019fba902ec
[ "if filename == cls._configs[0]:\n return cls.generateBirdConf(node, services)\nelse:\n raise ValueError", "for ifc in node.netifs():\n if hasattr(ifc, 'control') and ifc.control == True:\n continue\n for a in ifc.addrlist:\n if a.find('.') >= 0:\n return a.split('/')[0]\nretu...
<|body_start_0|> if filename == cls._configs[0]: return cls.generateBirdConf(node, services) else: raise ValueError <|end_body_0|> <|body_start_1|> for ifc in node.netifs(): if hasattr(ifc, 'control') and ifc.control == True: continue ...
Bird router support
Bird
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bird: """Bird router support""" def generateconfig(cls, node, filename, services): """Return the bird.conf file contents.""" <|body_0|> def routerid(node): """Helper to return the first IPv4 address of a node as its router ID.""" <|body_1|> def gener...
stack_v2_sparse_classes_36k_train_030956
7,179
permissive
[ { "docstring": "Return the bird.conf file contents.", "name": "generateconfig", "signature": "def generateconfig(cls, node, filename, services)" }, { "docstring": "Helper to return the first IPv4 address of a node as its router ID.", "name": "routerid", "signature": "def routerid(node)" ...
3
stack_v2_sparse_classes_30k_train_017985
Implement the Python class `Bird` described below. Class description: Bird router support Method signatures and docstrings: - def generateconfig(cls, node, filename, services): Return the bird.conf file contents. - def routerid(node): Helper to return the first IPv4 address of a node as its router ID. - def generateB...
Implement the Python class `Bird` described below. Class description: Bird router support Method signatures and docstrings: - def generateconfig(cls, node, filename, services): Return the bird.conf file contents. - def routerid(node): Helper to return the first IPv4 address of a node as its router ID. - def generateB...
9c246b0ae0e9182dcf61acc4faee41841d5cbd51
<|skeleton|> class Bird: """Bird router support""" def generateconfig(cls, node, filename, services): """Return the bird.conf file contents.""" <|body_0|> def routerid(node): """Helper to return the first IPv4 address of a node as its router ID.""" <|body_1|> def gener...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bird: """Bird router support""" def generateconfig(cls, node, filename, services): """Return the bird.conf file contents.""" if filename == cls._configs[0]: return cls.generateBirdConf(node, services) else: raise ValueError def routerid(node): ...
the_stack_v2_python_sparse
coreemu-read-only/daemon/core/services/bird.py
ermin-sakic/common-open-research-emulator-CORE
train
3
f7d97379091cbb2e6762b3ce66de028ab153250c
[ "self.filter_query = filter_query\nself.include_deleted_records = include_deleted_records\nself.mutation_type = mutation_type\nself.new_object_name = new_object_name\nself.record_id_vec = record_id_vec\nself.sfdc_restore_type = sfdc_restore_type", "if dictionary is None:\n return None\nfilter_query = dictionar...
<|body_start_0|> self.filter_query = filter_query self.include_deleted_records = include_deleted_records self.mutation_type = mutation_type self.new_object_name = new_object_name self.record_id_vec = record_id_vec self.sfdc_restore_type = sfdc_restore_type <|end_body_0|> ...
Implementation of the 'SfdcRestoreObjectParams' model. TODO: type description here. Attributes: filter_query (string): This field contains the user provided query to select only subset of records in an object for recovery. This field is set only if restore_type is 'kRestoreFilter;. include_deleted_records (bool): This ...
SfdcRestoreObjectParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SfdcRestoreObjectParams: """Implementation of the 'SfdcRestoreObjectParams' model. TODO: type description here. Attributes: filter_query (string): This field contains the user provided query to select only subset of records in an object for recovery. This field is set only if restore_type is 'kRe...
stack_v2_sparse_classes_36k_train_030957
3,608
permissive
[ { "docstring": "Constructor for the SfdcRestoreObjectParams class", "name": "__init__", "signature": "def __init__(self, filter_query=None, include_deleted_records=None, mutation_type=None, new_object_name=None, record_id_vec=None, sfdc_restore_type=None)" }, { "docstring": "Creates an instance ...
2
null
Implement the Python class `SfdcRestoreObjectParams` described below. Class description: Implementation of the 'SfdcRestoreObjectParams' model. TODO: type description here. Attributes: filter_query (string): This field contains the user provided query to select only subset of records in an object for recovery. This fi...
Implement the Python class `SfdcRestoreObjectParams` described below. Class description: Implementation of the 'SfdcRestoreObjectParams' model. TODO: type description here. Attributes: filter_query (string): This field contains the user provided query to select only subset of records in an object for recovery. This fi...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SfdcRestoreObjectParams: """Implementation of the 'SfdcRestoreObjectParams' model. TODO: type description here. Attributes: filter_query (string): This field contains the user provided query to select only subset of records in an object for recovery. This field is set only if restore_type is 'kRe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SfdcRestoreObjectParams: """Implementation of the 'SfdcRestoreObjectParams' model. TODO: type description here. Attributes: filter_query (string): This field contains the user provided query to select only subset of records in an object for recovery. This field is set only if restore_type is 'kRestoreFilter;....
the_stack_v2_python_sparse
cohesity_management_sdk/models/sfdc_restore_object_params.py
cohesity/management-sdk-python
train
24
48ba74dc0de17e416439cd1ee0fa916e4595354e
[ "left = longest = 0\nlast = dict()\nfor i, char in enumerate(s):\n if char in last and last[char] >= left:\n if i - left > longest:\n longest = i - left\n left = last[char] + 1\n last[char] = i\nif len(s) - left > longest:\n return len(s) - left\nreturn longest", "r, current, set...
<|body_start_0|> left = longest = 0 last = dict() for i, char in enumerate(s): if char in last and last[char] >= left: if i - left > longest: longest = i - left left = last[char] + 1 last[char] = i if len(s) - le...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstring2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> left = longest = 0 last = dict() ...
stack_v2_sparse_classes_36k_train_030958
951
permissive
[ { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring2", "signature": "def lengthOfLongestSubstring2(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_012098
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring2(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring2(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def lengthOf...
d203aecd1afe1af13a0384a9c657c8424aab322d
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstring2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" left = longest = 0 last = dict() for i, char in enumerate(s): if char in last and last[char] >= left: if i - left > longest: longest = i - left ...
the_stack_v2_python_sparse
medium/Q3_LongestSubstringWithoutRepeatingCharacters.py
Kaciras/leetcode
train
0
c05347afaab8e3ec1ecd5a3e5d24d0ebb82c5c70
[ "super().__init__(X)\nself.bands_subset = np.array(bands_subset)\nself.outliers_fraction = outliers_fraction\nself.assume_centered = assume_centered\nself.support_fraction = support_fraction\nself.no_data = no_data", "n_used_bands = len(self.bands_subset)\nimage_bands_flattened = np.zeros((self.cols * self.rows, ...
<|body_start_0|> super().__init__(X) self.bands_subset = np.array(bands_subset) self.outliers_fraction = outliers_fraction self.assume_centered = assume_centered self.support_fraction = support_fraction self.no_data = no_data <|end_body_0|> <|body_start_1|> n_use...
Antares implementation of elliptic envelop thresholding transformation This class implements the elliptic envelope method to threshold a difference image (like that prodced by the iMAD-MAF transform) to produce a change/no-change classes partition. It uses an elliptic envelope, this method will detect point in the data...
Transform
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transform: """Antares implementation of elliptic envelop thresholding transformation This class implements the elliptic envelope method to threshold a difference image (like that prodced by the iMAD-MAF transform) to produce a change/no-change classes partition. It uses an elliptic envelope, this...
stack_v2_sparse_classes_36k_train_030959
3,281
no_license
[ { "docstring": "Instantiate class Args: bands_subset (list): Which bands to consider. outlier_fraction (float): The proportion of outliers in the data set. assume_centered (bool): If True it will not center the data. support_fraction (float): The proportion of points to be included in the support of the raw MCD...
2
stack_v2_sparse_classes_30k_train_002045
Implement the Python class `Transform` described below. Class description: Antares implementation of elliptic envelop thresholding transformation This class implements the elliptic envelope method to threshold a difference image (like that prodced by the iMAD-MAF transform) to produce a change/no-change classes partit...
Implement the Python class `Transform` described below. Class description: Antares implementation of elliptic envelop thresholding transformation This class implements the elliptic envelope method to threshold a difference image (like that prodced by the iMAD-MAF transform) to produce a change/no-change classes partit...
ab8073a4b45915ba51c718b5403795c44f9b0027
<|skeleton|> class Transform: """Antares implementation of elliptic envelop thresholding transformation This class implements the elliptic envelope method to threshold a difference image (like that prodced by the iMAD-MAF transform) to produce a change/no-change classes partition. It uses an elliptic envelope, this...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transform: """Antares implementation of elliptic envelop thresholding transformation This class implements the elliptic envelope method to threshold a difference image (like that prodced by the iMAD-MAF transform) to produce a change/no-change classes partition. It uses an elliptic envelope, this method will ...
the_stack_v2_python_sparse
madmex/lcc/transform/elliptic.py
ixime/antares3
train
0
76997bac14cd15a9097540a7974faeebddf9614f
[ "if root is None:\n return False\nreturn self.isPath(root, arr, 0)", "if root.val != arr[index]:\n return False\nif index == len(arr) - 1:\n return root.left is None and root.right is None\nreturn root.left is not None and self.isPath(root.left, arr, index + 1) or (root.right is not None and self.isPath(...
<|body_start_0|> if root is None: return False return self.isPath(root, arr, 0) <|end_body_0|> <|body_start_1|> if root.val != arr[index]: return False if index == len(arr) - 1: return root.left is None and root.right is None return root.left ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidSequence(self, root, arr): """:param root: TreeNode() :param arr: List(int) :return: bool""" <|body_0|> def isPath(self, root, arr, index): """:param root: TreeNode() :param arr: List(int) :param index: int :return: bool""" <|body_1|> <|...
stack_v2_sparse_classes_36k_train_030960
2,189
no_license
[ { "docstring": ":param root: TreeNode() :param arr: List(int) :return: bool", "name": "isValidSequence", "signature": "def isValidSequence(self, root, arr)" }, { "docstring": ":param root: TreeNode() :param arr: List(int) :param index: int :return: bool", "name": "isPath", "signature": "...
2
stack_v2_sparse_classes_30k_train_009639
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidSequence(self, root, arr): :param root: TreeNode() :param arr: List(int) :return: bool - def isPath(self, root, arr, index): :param root: TreeNode() :param arr: List(i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidSequence(self, root, arr): :param root: TreeNode() :param arr: List(int) :return: bool - def isPath(self, root, arr, index): :param root: TreeNode() :param arr: List(i...
875a7de772b8923518abb5e98e5a068456e6b2ee
<|skeleton|> class Solution: def isValidSequence(self, root, arr): """:param root: TreeNode() :param arr: List(int) :return: bool""" <|body_0|> def isPath(self, root, arr, index): """:param root: TreeNode() :param arr: List(int) :param index: int :return: bool""" <|body_1|> <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isValidSequence(self, root, arr): """:param root: TreeNode() :param arr: List(int) :return: bool""" if root is None: return False return self.isPath(root, arr, 0) def isPath(self, root, arr, index): """:param root: TreeNode() :param arr: List(int)...
the_stack_v2_python_sparse
isValidSequence.py
zenithude/Python-Leetcode
train
0
1c6315bf1ee497701ab03a0319aa9cf1024b13f0
[ "url = '/dashboard/'\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 302)", "url = '/dashboard/'\nself.client.login(username=self.adminUN, password='pass')\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 200)...
<|body_start_0|> url = '/dashboard/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status_code, 302) <|end_body_0|> <|body_start_1|> url = '/dashboard/' self.client.login(username=self.adminUN, password='pass') response = self.clie...
DashboardTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DashboardTestCase: def test_not_logged_in(self): """Test that the dashboard view will redirect whilst not logged in.""" <|body_0|> def test_logged_in_admin(self): """Test that the dashboard view will load whilst logged in as admin.""" <|body_1|> def test...
stack_v2_sparse_classes_36k_train_030961
26,818
permissive
[ { "docstring": "Test that the dashboard view will redirect whilst not logged in.", "name": "test_not_logged_in", "signature": "def test_not_logged_in(self)" }, { "docstring": "Test that the dashboard view will load whilst logged in as admin.", "name": "test_logged_in_admin", "signature":...
3
null
Implement the Python class `DashboardTestCase` described below. Class description: Implement the DashboardTestCase class. Method signatures and docstrings: - def test_not_logged_in(self): Test that the dashboard view will redirect whilst not logged in. - def test_logged_in_admin(self): Test that the dashboard view wi...
Implement the Python class `DashboardTestCase` described below. Class description: Implement the DashboardTestCase class. Method signatures and docstrings: - def test_not_logged_in(self): Test that the dashboard view will redirect whilst not logged in. - def test_logged_in_admin(self): Test that the dashboard view wi...
37d2942efcbdaad072f7a06ac876a40e0f69f702
<|skeleton|> class DashboardTestCase: def test_not_logged_in(self): """Test that the dashboard view will redirect whilst not logged in.""" <|body_0|> def test_logged_in_admin(self): """Test that the dashboard view will load whilst logged in as admin.""" <|body_1|> def test...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DashboardTestCase: def test_not_logged_in(self): """Test that the dashboard view will redirect whilst not logged in.""" url = '/dashboard/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status_code, 302) def test_logged_in_admin(self...
the_stack_v2_python_sparse
mooring/test_views.py
dbca-wa/moorings
train
0
0ed27124791a1a0e70c27d5e6ba55891f41eea98
[ "if not mail:\n raise ValueError(_('The mail must be set'))\nmail = self.normalize_email(mail)\nuser = self.model(mail=mail, **extra_fields)\nuser.set_password(password)\nuser.save()\nreturn user", "extra_fields.setdefault('is_staff', True)\nextra_fields.setdefault('is_superuser', True)\nextra_fields.setdefaul...
<|body_start_0|> if not mail: raise ValueError(_('The mail must be set')) mail = self.normalize_email(mail) user = self.model(mail=mail, **extra_fields) user.set_password(password) user.save() return user <|end_body_0|> <|body_start_1|> extra_fields.s...
Custom user model manager where mail is the unique identifiers for authentication instead of usernames.
CustomUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomUserManager: """Custom user model manager where mail is the unique identifiers for authentication instead of usernames.""" def create_user(self, mail, password, **extra_fields): """Create and save a User with the given mail and password.""" <|body_0|> def create_su...
stack_v2_sparse_classes_36k_train_030962
1,316
no_license
[ { "docstring": "Create and save a User with the given mail and password.", "name": "create_user", "signature": "def create_user(self, mail, password, **extra_fields)" }, { "docstring": "Create and save a SuperUser with the given mail and password.", "name": "create_superuser", "signature...
2
stack_v2_sparse_classes_30k_train_004179
Implement the Python class `CustomUserManager` described below. Class description: Custom user model manager where mail is the unique identifiers for authentication instead of usernames. Method signatures and docstrings: - def create_user(self, mail, password, **extra_fields): Create and save a User with the given ma...
Implement the Python class `CustomUserManager` described below. Class description: Custom user model manager where mail is the unique identifiers for authentication instead of usernames. Method signatures and docstrings: - def create_user(self, mail, password, **extra_fields): Create and save a User with the given ma...
def86352c8d68281900688b1b95621c28848ccf0
<|skeleton|> class CustomUserManager: """Custom user model manager where mail is the unique identifiers for authentication instead of usernames.""" def create_user(self, mail, password, **extra_fields): """Create and save a User with the given mail and password.""" <|body_0|> def create_su...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomUserManager: """Custom user model manager where mail is the unique identifiers for authentication instead of usernames.""" def create_user(self, mail, password, **extra_fields): """Create and save a User with the given mail and password.""" if not mail: raise ValueError(...
the_stack_v2_python_sparse
accounts/managers.py
der-bernd/BiloPortal
train
0
a882fa8a40c0ccfb6f84b73582bf3cc90d9e8bee
[ "Graph.__init__(self, n, nodeData)\nself._adjMatrix = []\nrow = [None] * n\nfor i in range(n):\n self._adjMatrix.append(row[:])", "if node1 < self._numVerts and node2 < self._numVerts:\n self._adjMatrix[node1][node2] = True\n self._adjMatrix[node2][node1] = True\n return True\nelif node1 >= self._numV...
<|body_start_0|> Graph.__init__(self, n, nodeData) self._adjMatrix = [] row = [None] * n for i in range(n): self._adjMatrix.append(row[:]) <|end_body_0|> <|body_start_1|> if node1 < self._numVerts and node2 < self._numVerts: self._adjMatrix[node1][node2] ...
A graph contains vertices and edges: This implementation uses an adjacency matrix to represent edges.
MatrixGraph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatrixGraph: """A graph contains vertices and edges: This implementation uses an adjacency matrix to represent edges.""" def __init__(self, n, nodeData=[]): """Takes the number of nodes in the graph, and optionally a list of data to associate with each node. The data is assigned to n...
stack_v2_sparse_classes_36k_train_030963
16,606
no_license
[ { "docstring": "Takes the number of nodes in the graph, and optionally a list of data to associate with each node. The data is assigned to nodes in numeric order, starting with node 0. The edge information is represented using an adjacency matrix. This is initialized, but contains no edges; edges must be added ...
5
null
Implement the Python class `MatrixGraph` described below. Class description: A graph contains vertices and edges: This implementation uses an adjacency matrix to represent edges. Method signatures and docstrings: - def __init__(self, n, nodeData=[]): Takes the number of nodes in the graph, and optionally a list of da...
Implement the Python class `MatrixGraph` described below. Class description: A graph contains vertices and edges: This implementation uses an adjacency matrix to represent edges. Method signatures and docstrings: - def __init__(self, n, nodeData=[]): Takes the number of nodes in the graph, and optionally a list of da...
97bb378a325b1639110de06b88d6e237dffc7330
<|skeleton|> class MatrixGraph: """A graph contains vertices and edges: This implementation uses an adjacency matrix to represent edges.""" def __init__(self, n, nodeData=[]): """Takes the number of nodes in the graph, and optionally a list of data to associate with each node. The data is assigned to n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MatrixGraph: """A graph contains vertices and edges: This implementation uses an adjacency matrix to represent edges.""" def __init__(self, n, nodeData=[]): """Takes the number of nodes in the graph, and optionally a list of data to associate with each node. The data is assigned to nodes in numer...
the_stack_v2_python_sparse
backups/speedy_nav-2/scripts/Graphs.py
FoxRobotLab/catkin_ws
train
6
cd8d22e46ba847769f048ad78e47486e3e3c9c43
[ "self.protection_sources = protection_sources\nself.sid = sid\nself.views = views", "if dictionary is None:\n return None\nprotection_sources = None\nif dictionary.get('protectionSources') != None:\n protection_sources = list()\n for structure in dictionary.get('protectionSources'):\n protection_s...
<|body_start_0|> self.protection_sources = protection_sources self.sid = sid self.views = views <|end_body_0|> <|body_start_1|> if dictionary is None: return None protection_sources = None if dictionary.get('protectionSources') != None: protection...
Implementation of the 'SourcesForSid' model. Protection Sources and Views With Access Permissions. Specifies the Protection Sources objects and Views that the specified principal has permissions to access. The principal is specified using a security identifier (SID). Attributes: protection_sources (list of ProtectionSo...
SourcesForSid
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourcesForSid: """Implementation of the 'SourcesForSid' model. Protection Sources and Views With Access Permissions. Specifies the Protection Sources objects and Views that the specified principal has permissions to access. The principal is specified using a security identifier (SID). Attributes:...
stack_v2_sparse_classes_36k_train_030964
2,792
permissive
[ { "docstring": "Constructor for the SourcesForSid class", "name": "__init__", "signature": "def __init__(self, protection_sources=None, sid=None, views=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the ...
2
stack_v2_sparse_classes_30k_train_013244
Implement the Python class `SourcesForSid` described below. Class description: Implementation of the 'SourcesForSid' model. Protection Sources and Views With Access Permissions. Specifies the Protection Sources objects and Views that the specified principal has permissions to access. The principal is specified using a...
Implement the Python class `SourcesForSid` described below. Class description: Implementation of the 'SourcesForSid' model. Protection Sources and Views With Access Permissions. Specifies the Protection Sources objects and Views that the specified principal has permissions to access. The principal is specified using a...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SourcesForSid: """Implementation of the 'SourcesForSid' model. Protection Sources and Views With Access Permissions. Specifies the Protection Sources objects and Views that the specified principal has permissions to access. The principal is specified using a security identifier (SID). Attributes:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SourcesForSid: """Implementation of the 'SourcesForSid' model. Protection Sources and Views With Access Permissions. Specifies the Protection Sources objects and Views that the specified principal has permissions to access. The principal is specified using a security identifier (SID). Attributes: protection_s...
the_stack_v2_python_sparse
cohesity_management_sdk/models/sources_for_sid.py
cohesity/management-sdk-python
train
24
6f8f3fafedd4d67f38afac40fd5f50399532339a
[ "if overlays is None:\n raise ValueError('Must specify overlays.')\nself._toolchains = []\nself._require_explicit_default_toolchain = True\nself._require_explicit_default_toolchain = False\nfor overlay_path in overlays:\n self._AddToolchainsFromOverlayDir(overlay_path)", "config_path = os.path.join(overlay_...
<|body_start_0|> if overlays is None: raise ValueError('Must specify overlays.') self._toolchains = [] self._require_explicit_default_toolchain = True self._require_explicit_default_toolchain = False for overlay_path in overlays: self._AddToolchainsFromOve...
Represents a list of toolchains.
ToolchainList
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ToolchainList: """Represents a list of toolchains.""" def __init__(self, overlays): """Construct an instance. Args: overlays: list of overlay directories to add toolchains from.""" <|body_0|> def _AddToolchainsFromOverlayDir(self, overlay_dir): """Add toolchains ...
stack_v2_sparse_classes_36k_train_030965
4,300
permissive
[ { "docstring": "Construct an instance. Args: overlays: list of overlay directories to add toolchains from.", "name": "__init__", "signature": "def __init__(self, overlays)" }, { "docstring": "Add toolchains to |self| from the given overlay. Does not include overlays that this overlay depends on....
4
stack_v2_sparse_classes_30k_train_016725
Implement the Python class `ToolchainList` described below. Class description: Represents a list of toolchains. Method signatures and docstrings: - def __init__(self, overlays): Construct an instance. Args: overlays: list of overlay directories to add toolchains from. - def _AddToolchainsFromOverlayDir(self, overlay_...
Implement the Python class `ToolchainList` described below. Class description: Represents a list of toolchains. Method signatures and docstrings: - def __init__(self, overlays): Construct an instance. Args: overlays: list of overlay directories to add toolchains from. - def _AddToolchainsFromOverlayDir(self, overlay_...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class ToolchainList: """Represents a list of toolchains.""" def __init__(self, overlays): """Construct an instance. Args: overlays: list of overlay directories to add toolchains from.""" <|body_0|> def _AddToolchainsFromOverlayDir(self, overlay_dir): """Add toolchains ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ToolchainList: """Represents a list of toolchains.""" def __init__(self, overlays): """Construct an instance. Args: overlays: list of overlay directories to add toolchains from.""" if overlays is None: raise ValueError('Must specify overlays.') self._toolchains = [] ...
the_stack_v2_python_sparse
third_party/chromite/lib/toolchain_list.py
metux/chromium-suckless
train
5
ab9f69693cb98711ec19d0fc9cc6d03486f5cb51
[ "super(Application, self).__init__(master)\nself.grid()\nself.create_widgets()", "Label(self, text='Choose your favorite genre!').grid(row=0, column=0, sticky=W)\nLabel(self, text='Choose only one: ').grid(row=1, column=0, sticky=W)\nself.favorite = StringVar()\nself.favorite.set(None)\nRadiobutton(self, text='Co...
<|body_start_0|> super(Application, self).__init__(master) self.grid() self.create_widgets() <|end_body_0|> <|body_start_1|> Label(self, text='Choose your favorite genre!').grid(row=0, column=0, sticky=W) Label(self, text='Choose only one: ').grid(row=1, column=0, sticky=W) ...
GUI app that allows to choose your favorite genre!
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """GUI app that allows to choose your favorite genre!""" def __init__(self, master): """Frame initiation""" <|body_0|> def create_widgets(self): """Elements that will help to choose""" <|body_1|> def update_text(self): """refresh...
stack_v2_sparse_classes_36k_train_030966
2,083
no_license
[ { "docstring": "Frame initiation", "name": "__init__", "signature": "def __init__(self, master)" }, { "docstring": "Elements that will help to choose", "name": "create_widgets", "signature": "def create_widgets(self)" }, { "docstring": "refreshes text area while user changes his ...
3
null
Implement the Python class `Application` described below. Class description: GUI app that allows to choose your favorite genre! Method signatures and docstrings: - def __init__(self, master): Frame initiation - def create_widgets(self): Elements that will help to choose - def update_text(self): refreshes text area wh...
Implement the Python class `Application` described below. Class description: GUI app that allows to choose your favorite genre! Method signatures and docstrings: - def __init__(self, master): Frame initiation - def create_widgets(self): Elements that will help to choose - def update_text(self): refreshes text area wh...
19343c985f368770dc01ce415506506d62a23285
<|skeleton|> class Application: """GUI app that allows to choose your favorite genre!""" def __init__(self, master): """Frame initiation""" <|body_0|> def create_widgets(self): """Elements that will help to choose""" <|body_1|> def update_text(self): """refresh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Application: """GUI app that allows to choose your favorite genre!""" def __init__(self, master): """Frame initiation""" super(Application, self).__init__(master) self.grid() self.create_widgets() def create_widgets(self): """Elements that will help to choose"...
the_stack_v2_python_sparse
gui/movie_chooser_2.py
gofr1/python-learning
train
0
2b7082a9a5b3a7653cafb2a882fbaca59cedd053
[ "if not A or len(A) <= 0:\n return\nnum = len(A)\nB = [1] * num\nfor i in range(num):\n for j in range(num):\n if j == i:\n continue\n else:\n B[i] = B[i] * A[j]\n print(B[i])\nreturn B", "if A is None or len(A) <= 0:\n return\nlength = len(A)\nB = [1] * len...
<|body_start_0|> if not A or len(A) <= 0: return num = len(A) B = [1] * num for i in range(num): for j in range(num): if j == i: continue else: B[i] = B[i] * A[j] print(B[i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def multiply_1(self, A): """暴力法 :param A: :return:""" <|body_0|> def multiply_2(self, A): """将B写成一个n*n的矩阵,观察得到一个上三角和下三角,可以分别求得 需要注意的是,返回数组B的初始化,为[1] * length :param A: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not A or le...
stack_v2_sparse_classes_36k_train_030967
1,402
no_license
[ { "docstring": "暴力法 :param A: :return:", "name": "multiply_1", "signature": "def multiply_1(self, A)" }, { "docstring": "将B写成一个n*n的矩阵,观察得到一个上三角和下三角,可以分别求得 需要注意的是,返回数组B的初始化,为[1] * length :param A: :return:", "name": "multiply_2", "signature": "def multiply_2(self, A)" } ]
2
stack_v2_sparse_classes_30k_train_000266
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def multiply_1(self, A): 暴力法 :param A: :return: - def multiply_2(self, A): 将B写成一个n*n的矩阵,观察得到一个上三角和下三角,可以分别求得 需要注意的是,返回数组B的初始化,为[1] * length :param A: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def multiply_1(self, A): 暴力法 :param A: :return: - def multiply_2(self, A): 将B写成一个n*n的矩阵,观察得到一个上三角和下三角,可以分别求得 需要注意的是,返回数组B的初始化,为[1] * length :param A: :return: <|skeleton|> class...
746d77e9bfbcb3877fefae9a915004b3bfbcc612
<|skeleton|> class Solution: def multiply_1(self, A): """暴力法 :param A: :return:""" <|body_0|> def multiply_2(self, A): """将B写成一个n*n的矩阵,观察得到一个上三角和下三角,可以分别求得 需要注意的是,返回数组B的初始化,为[1] * length :param A: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def multiply_1(self, A): """暴力法 :param A: :return:""" if not A or len(A) <= 0: return num = len(A) B = [1] * num for i in range(num): for j in range(num): if j == i: continue else: ...
the_stack_v2_python_sparse
剑指offer/第一遍/构建乘积数组.py
leilalu/algorithm
train
0
6321d075c4faf3509ae909e0b0424fcacf03dc95
[ "super().__init__(api, coordinator, name, server_unique_id)\nself.entity_description = description\nself._attr_name = f'{name} {description.name}'\nself._attr_unique_id = f'{self._server_unique_id}/{description.name}'", "try:\n return round(self.api.data[self.entity_description.key], 2)\nexcept TypeError:\n ...
<|body_start_0|> super().__init__(api, coordinator, name, server_unique_id) self.entity_description = description self._attr_name = f'{name} {description.name}' self._attr_unique_id = f'{self._server_unique_id}/{description.name}' <|end_body_0|> <|body_start_1|> try: ...
Representation of a Pi-hole sensor.
PiHoleSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PiHoleSensor: """Representation of a Pi-hole sensor.""" def __init__(self, api: Hole, coordinator: DataUpdateCoordinator, name: str, server_unique_id: str, description: PiHoleSensorEntityDescription) -> None: """Initialize a Pi-hole sensor.""" <|body_0|> def native_value...
stack_v2_sparse_classes_36k_train_030968
2,130
permissive
[ { "docstring": "Initialize a Pi-hole sensor.", "name": "__init__", "signature": "def __init__(self, api: Hole, coordinator: DataUpdateCoordinator, name: str, server_unique_id: str, description: PiHoleSensorEntityDescription) -> None" }, { "docstring": "Return the state of the device.", "name...
2
null
Implement the Python class `PiHoleSensor` described below. Class description: Representation of a Pi-hole sensor. Method signatures and docstrings: - def __init__(self, api: Hole, coordinator: DataUpdateCoordinator, name: str, server_unique_id: str, description: PiHoleSensorEntityDescription) -> None: Initialize a Pi...
Implement the Python class `PiHoleSensor` described below. Class description: Representation of a Pi-hole sensor. Method signatures and docstrings: - def __init__(self, api: Hole, coordinator: DataUpdateCoordinator, name: str, server_unique_id: str, description: PiHoleSensorEntityDescription) -> None: Initialize a Pi...
8de7966104911bca6f855a1755a6d71a07afb9de
<|skeleton|> class PiHoleSensor: """Representation of a Pi-hole sensor.""" def __init__(self, api: Hole, coordinator: DataUpdateCoordinator, name: str, server_unique_id: str, description: PiHoleSensorEntityDescription) -> None: """Initialize a Pi-hole sensor.""" <|body_0|> def native_value...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PiHoleSensor: """Representation of a Pi-hole sensor.""" def __init__(self, api: Hole, coordinator: DataUpdateCoordinator, name: str, server_unique_id: str, description: PiHoleSensorEntityDescription) -> None: """Initialize a Pi-hole sensor.""" super().__init__(api, coordinator, name, serv...
the_stack_v2_python_sparse
homeassistant/components/pi_hole/sensor.py
AlexxIT/home-assistant
train
9
495471a0786a9f35f3d57346242a08b80e1b76f3
[ "specified_root = dirpath_testdata\nactual_result = da.lwc.discover.path(key='root', dirpath_lwc_root=specified_root)\nexpected_result = specified_root\nassert expected_result == actual_result", "dirpath_root = da.lwc.discover.path('root')\nassert os.path.isdir(dirpath_root), 'Discovered path for key \"root\" doe...
<|body_start_0|> specified_root = dirpath_testdata actual_result = da.lwc.discover.path(key='root', dirpath_lwc_root=specified_root) expected_result = specified_root assert expected_result == actual_result <|end_body_0|> <|body_start_1|> dirpath_root = da.lwc.discover.path('root...
Specify the da.lwc.discover.path() function.
SpecifyPath
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpecifyPath: """Specify the da.lwc.discover.path() function.""" def it_can_discover_the_root_of_the_repo(self, dirpath_testdata): """It can correctly identify the root of the repository.""" <|body_0|> def it_can_discover_parts_of_the_repo(self): """It can correct...
stack_v2_sparse_classes_36k_train_030969
5,877
permissive
[ { "docstring": "It can correctly identify the root of the repository.", "name": "it_can_discover_the_root_of_the_repo", "signature": "def it_can_discover_the_root_of_the_repo(self, dirpath_testdata)" }, { "docstring": "It can correctly identify the root of the real directories.", "name": "it...
2
stack_v2_sparse_classes_30k_train_002925
Implement the Python class `SpecifyPath` described below. Class description: Specify the da.lwc.discover.path() function. Method signatures and docstrings: - def it_can_discover_the_root_of_the_repo(self, dirpath_testdata): It can correctly identify the root of the repository. - def it_can_discover_parts_of_the_repo(...
Implement the Python class `SpecifyPath` described below. Class description: Specify the da.lwc.discover.path() function. Method signatures and docstrings: - def it_can_discover_the_root_of_the_repo(self, dirpath_testdata): It can correctly identify the root of the repository. - def it_can_discover_parts_of_the_repo(...
04a13be2792323e3f9fdb83fd236a8e9cfe6aa2d
<|skeleton|> class SpecifyPath: """Specify the da.lwc.discover.path() function.""" def it_can_discover_the_root_of_the_repo(self, dirpath_testdata): """It can correctly identify the root of the repository.""" <|body_0|> def it_can_discover_parts_of_the_repo(self): """It can correct...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpecifyPath: """Specify the da.lwc.discover.path() function.""" def it_can_discover_the_root_of_the_repo(self, dirpath_testdata): """It can correctly identify the root of the repository.""" specified_root = dirpath_testdata actual_result = da.lwc.discover.path(key='root', dirpath_...
the_stack_v2_python_sparse
a3_src/h70_internal/da/lwc/spec/spec_discover.py
wtpayne/hiai
train
5
f624bd376e8211c5d1404c74eabb1e8f2bbec9a1
[ "nums = [0] * (n + 1)\nnums[0] = 1\nnums[1] = 1\nfor i in range(2, n + 1):\n for j in range(0, i):\n nums[i] += nums[j] * nums[i - j - 1]\nreturn nums[n]", "if n == 0:\n return 1\nif n == 1:\n return 1\nresult = 0\nfor i in range(1, n + 1):\n result += self.numTrees(i - 1) * self.numTrees(n - i...
<|body_start_0|> nums = [0] * (n + 1) nums[0] = 1 nums[1] = 1 for i in range(2, n + 1): for j in range(0, i): nums[i] += nums[j] * nums[i - j - 1] return nums[n] <|end_body_0|> <|body_start_1|> if n == 0: return 1 if n == 1...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numTrees(self, n): """:type n: int :rtype: int""" <|body_0|> def numTrees1(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums = [0] * (n + 1) nums[0] = 1 nums[1] = 1 for i...
stack_v2_sparse_classes_36k_train_030970
698
permissive
[ { "docstring": ":type n: int :rtype: int", "name": "numTrees", "signature": "def numTrees(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "numTrees1", "signature": "def numTrees1(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_011280
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTrees(self, n): :type n: int :rtype: int - def numTrees1(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTrees(self, n): :type n: int :rtype: int - def numTrees1(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def numTrees(self, n): """:type n: i...
64847cbb1adcaca4561b949e8acc52e8e031a6cb
<|skeleton|> class Solution: def numTrees(self, n): """:type n: int :rtype: int""" <|body_0|> def numTrees1(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numTrees(self, n): """:type n: int :rtype: int""" nums = [0] * (n + 1) nums[0] = 1 nums[1] = 1 for i in range(2, n + 1): for j in range(0, i): nums[i] += nums[j] * nums[i - j - 1] return nums[n] def numTrees1(self, ...
the_stack_v2_python_sparse
UniqueBinarySearchTrees96.py
Bit64L/LeetCode-Python-
train
0
e9d5f911db466574d83bbbdff41d017b178f8281
[ "if not isinstance(zoom, (list, tuple)) or len(zoom) != 2:\n raise ValueError('zoom_range argument must be list/tuple with two values!')\nself.zoom = zoom\nself.lazy = lazy\nself.reference = reference\nself.tx = tio.ANTsTransform(precision='float', dimension=2, transform_type='AffineTransform')\nif self.referenc...
<|body_start_0|> if not isinstance(zoom, (list, tuple)) or len(zoom) != 2: raise ValueError('zoom_range argument must be list/tuple with two values!') self.zoom = zoom self.lazy = lazy self.reference = reference self.tx = tio.ANTsTransform(precision='float', dimension...
Create an ANTs Affine Transform with a specified level of zoom. Any value greater than 1 implies a "zoom-out" and anything less than 1 implies a "zoom-in".
Zoom2D
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Zoom2D: """Create an ANTs Affine Transform with a specified level of zoom. Any value greater than 1 implies a "zoom-out" and anything less than 1 implies a "zoom-in".""" def __init__(self, zoom, reference=None, lazy=False): """Initialize a Zoom2D object Arguments --------- zoom_range...
stack_v2_sparse_classes_36k_train_030971
21,674
permissive
[ { "docstring": "Initialize a Zoom2D object Arguments --------- zoom_range : list or tuple Lower and Upper bounds on zoom parameter. e.g. zoom_range = (0.7,0.9) will result in a random draw of the zoom parameters between 0.7 and 0.9 reference : ANTsImage (optional but recommended) image providing the reference s...
2
null
Implement the Python class `Zoom2D` described below. Class description: Create an ANTs Affine Transform with a specified level of zoom. Any value greater than 1 implies a "zoom-out" and anything less than 1 implies a "zoom-in". Method signatures and docstrings: - def __init__(self, zoom, reference=None, lazy=False): ...
Implement the Python class `Zoom2D` described below. Class description: Create an ANTs Affine Transform with a specified level of zoom. Any value greater than 1 implies a "zoom-out" and anything less than 1 implies a "zoom-in". Method signatures and docstrings: - def __init__(self, zoom, reference=None, lazy=False): ...
41f2dd3fcf72654f284dac1a9448033e963f0afb
<|skeleton|> class Zoom2D: """Create an ANTs Affine Transform with a specified level of zoom. Any value greater than 1 implies a "zoom-out" and anything less than 1 implies a "zoom-in".""" def __init__(self, zoom, reference=None, lazy=False): """Initialize a Zoom2D object Arguments --------- zoom_range...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Zoom2D: """Create an ANTs Affine Transform with a specified level of zoom. Any value greater than 1 implies a "zoom-out" and anything less than 1 implies a "zoom-in".""" def __init__(self, zoom, reference=None, lazy=False): """Initialize a Zoom2D object Arguments --------- zoom_range : list or tu...
the_stack_v2_python_sparse
ants/contrib/sampling/affine2d.py
ANTsX/ANTsPy
train
483
7f7d9a36ac14170a0235e3013451a3b7d78552a1
[ "super().__init__()\nci = in_channels\nfor i, params in enumerate(convs):\n setattr(self, f'conv2d{i}', nn.Conv2d(ci, *params))\n ci = params[0]\nself.activation_fn = activation_fn\nself.nlayers = len(convs)\nself.activate_last = activate_last", "for i in range(self.nlayers - 1):\n x = self.activation_fn...
<|body_start_0|> super().__init__() ci = in_channels for i, params in enumerate(convs): setattr(self, f'conv2d{i}', nn.Conv2d(ci, *params)) ci = params[0] self.activation_fn = activation_fn self.nlayers = len(convs) self.activate_last = activate_la...
Convolutional network.
Conv2dNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv2dNet: """Convolutional network.""" def __init__(self, in_channels=3, convs=[], activation_fn=F.relu, activate_last=False): """Init. Creates a simple conv net. Example: net = Conv2dNet(3, [(16,3), (32,3,2), (64,3,1,1)]) Args: in_channels (int): number of channels of the input to ...
stack_v2_sparse_classes_36k_train_030972
4,966
no_license
[ { "docstring": "Init. Creates a simple conv net. Example: net = Conv2dNet(3, [(16,3), (32,3,2), (64,3,1,1)]) Args: in_channels (int): number of channels of the input to the network. convs (list): Describes the conv layers. Each element of the list should contain the args for torch.nn.Conv2d in order. At minimum...
2
stack_v2_sparse_classes_30k_test_000626
Implement the Python class `Conv2dNet` described below. Class description: Convolutional network. Method signatures and docstrings: - def __init__(self, in_channels=3, convs=[], activation_fn=F.relu, activate_last=False): Init. Creates a simple conv net. Example: net = Conv2dNet(3, [(16,3), (32,3,2), (64,3,1,1)]) Arg...
Implement the Python class `Conv2dNet` described below. Class description: Convolutional network. Method signatures and docstrings: - def __init__(self, in_channels=3, convs=[], activation_fn=F.relu, activate_last=False): Init. Creates a simple conv net. Example: net = Conv2dNet(3, [(16,3), (32,3,2), (64,3,1,1)]) Arg...
e71c4b12955b01bfb907aa31c91ded6bcd8aaec8
<|skeleton|> class Conv2dNet: """Convolutional network.""" def __init__(self, in_channels=3, convs=[], activation_fn=F.relu, activate_last=False): """Init. Creates a simple conv net. Example: net = Conv2dNet(3, [(16,3), (32,3,2), (64,3,1,1)]) Args: in_channels (int): number of channels of the input to ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Conv2dNet: """Convolutional network.""" def __init__(self, in_channels=3, convs=[], activation_fn=F.relu, activate_last=False): """Init. Creates a simple conv net. Example: net = Conv2dNet(3, [(16,3), (32,3,2), (64,3,1,1)]) Args: in_channels (int): number of channels of the input to the network. ...
the_stack_v2_python_sparse
dl/modules/core.py
cbschaff/dl
train
1
6b8aef9eccbc434cb60ca039c763b17dcfe2b757
[ "self.email_id = email_id\nself.totp_qr_code_url = totp_qr_code_url\nself.totp_secret_key = totp_secret_key\nself.two_fa_mode = two_fa_mode", "if dictionary is None:\n return None\nemail_id = dictionary.get('EmailID')\ntotp_qr_code_url = dictionary.get('TOTPQRCodeUrl')\ntotp_secret_key = dictionary.get('TOTPSe...
<|body_start_0|> self.email_id = email_id self.totp_qr_code_url = totp_qr_code_url self.totp_secret_key = totp_secret_key self.two_fa_mode = two_fa_mode <|end_body_0|> <|body_start_1|> if dictionary is None: return None email_id = dictionary.get('EmailID') ...
Implementation of the 'GetLinuxSupportUser2FAResult' model. TODO: type description here. Attributes: email_id (string): TODO: Type description here. totp_qr_code_url (string): TODO: Type description here. totp_secret_key (string): TODO: Type description here. two_fa_mode (long|int): TODO: Type description here.
GetLinuxSupportUser2FAResult
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetLinuxSupportUser2FAResult: """Implementation of the 'GetLinuxSupportUser2FAResult' model. TODO: type description here. Attributes: email_id (string): TODO: Type description here. totp_qr_code_url (string): TODO: Type description here. totp_secret_key (string): TODO: Type description here. two_...
stack_v2_sparse_classes_36k_train_030973
2,143
permissive
[ { "docstring": "Constructor for the GetLinuxSupportUser2FAResult class", "name": "__init__", "signature": "def __init__(self, email_id=None, totp_qr_code_url=None, totp_secret_key=None, two_fa_mode=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (di...
2
stack_v2_sparse_classes_30k_train_014245
Implement the Python class `GetLinuxSupportUser2FAResult` described below. Class description: Implementation of the 'GetLinuxSupportUser2FAResult' model. TODO: type description here. Attributes: email_id (string): TODO: Type description here. totp_qr_code_url (string): TODO: Type description here. totp_secret_key (str...
Implement the Python class `GetLinuxSupportUser2FAResult` described below. Class description: Implementation of the 'GetLinuxSupportUser2FAResult' model. TODO: type description here. Attributes: email_id (string): TODO: Type description here. totp_qr_code_url (string): TODO: Type description here. totp_secret_key (str...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class GetLinuxSupportUser2FAResult: """Implementation of the 'GetLinuxSupportUser2FAResult' model. TODO: type description here. Attributes: email_id (string): TODO: Type description here. totp_qr_code_url (string): TODO: Type description here. totp_secret_key (string): TODO: Type description here. two_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetLinuxSupportUser2FAResult: """Implementation of the 'GetLinuxSupportUser2FAResult' model. TODO: type description here. Attributes: email_id (string): TODO: Type description here. totp_qr_code_url (string): TODO: Type description here. totp_secret_key (string): TODO: Type description here. two_fa_mode (long...
the_stack_v2_python_sparse
cohesity_management_sdk/models/get_linux_support_user_2_fa_result.py
cohesity/management-sdk-python
train
24
3a679414aadea906bd7ce5f436ca960facb8554d
[ "event_data = OLECFItemEventData()\nevent_data.creation_time = self._GetCreationTime(olecf_item)\nevent_data.modification_time = self._GetModificationTime(olecf_item)\nevent_data.name = olecf_item.name\nevent_data.size = olecf_item.size\nparser_mediator.ProduceEventData(event_data)\nfor sub_item in olecf_item.sub_i...
<|body_start_0|> event_data = OLECFItemEventData() event_data.creation_time = self._GetCreationTime(olecf_item) event_data.modification_time = self._GetModificationTime(olecf_item) event_data.name = olecf_item.name event_data.size = olecf_item.size parser_mediator.Produce...
Class to define the default OLECF file plugin.
DefaultOLECFPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultOLECFPlugin: """Class to define the default OLECF file plugin.""" def _ParseItem(self, parser_mediator, olecf_item): """Parses an OLECF item. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. olecf_it...
stack_v2_sparse_classes_36k_train_030974
2,478
permissive
[ { "docstring": "Parses an OLECF item. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. olecf_item (pyolecf.item): OLECF item. Returns: bool: True if an event was produced.", "name": "_ParseItem", "signature": "def _ParseItem(s...
2
null
Implement the Python class `DefaultOLECFPlugin` described below. Class description: Class to define the default OLECF file plugin. Method signatures and docstrings: - def _ParseItem(self, parser_mediator, olecf_item): Parses an OLECF item. Args: parser_mediator (ParserMediator): mediates interactions between parsers ...
Implement the Python class `DefaultOLECFPlugin` described below. Class description: Class to define the default OLECF file plugin. Method signatures and docstrings: - def _ParseItem(self, parser_mediator, olecf_item): Parses an OLECF item. Args: parser_mediator (ParserMediator): mediates interactions between parsers ...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class DefaultOLECFPlugin: """Class to define the default OLECF file plugin.""" def _ParseItem(self, parser_mediator, olecf_item): """Parses an OLECF item. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. olecf_it...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DefaultOLECFPlugin: """Class to define the default OLECF file plugin.""" def _ParseItem(self, parser_mediator, olecf_item): """Parses an OLECF item. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. olecf_item (pyolecf.i...
the_stack_v2_python_sparse
plaso/parsers/olecf_plugins/default.py
log2timeline/plaso
train
1,506
0910a6ca0de2cfa6f0848745170e1f71236295b4
[ "project = self.create(spec=spec)\nself._client.logger.info('Created project ID: %s NAME: %s', project.id, project.name)\nif dataset_path:\n project.import_dataset(format_name=dataset_format, filename=dataset_path, pbar=pbar, status_check_period=status_check_period)\nproject.fetch()\nreturn project", "filename...
<|body_start_0|> project = self.create(spec=spec) self._client.logger.info('Created project ID: %s NAME: %s', project.id, project.name) if dataset_path: project.import_dataset(format_name=dataset_format, filename=dataset_path, pbar=pbar, status_check_period=status_check_period) ...
ProjectsRepo
[ "LGPL-2.0-or-later", "MIT", "GPL-1.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectsRepo: def create_from_dataset(self, spec: models.IProjectWriteRequest, *, dataset_path: str='', dataset_format: str='CVAT XML 1.1', status_check_period: int=None, pbar: Optional[ProgressReporter]=None) -> Project: """Create a new project with the given name and labels JSON and ad...
stack_v2_sparse_classes_36k_train_030975
6,652
permissive
[ { "docstring": "Create a new project with the given name and labels JSON and add the files to it. Returns: id of the created project", "name": "create_from_dataset", "signature": "def create_from_dataset(self, spec: models.IProjectWriteRequest, *, dataset_path: str='', dataset_format: str='CVAT XML 1.1'...
2
null
Implement the Python class `ProjectsRepo` described below. Class description: Implement the ProjectsRepo class. Method signatures and docstrings: - def create_from_dataset(self, spec: models.IProjectWriteRequest, *, dataset_path: str='', dataset_format: str='CVAT XML 1.1', status_check_period: int=None, pbar: Optiona...
Implement the Python class `ProjectsRepo` described below. Class description: Implement the ProjectsRepo class. Method signatures and docstrings: - def create_from_dataset(self, spec: models.IProjectWriteRequest, *, dataset_path: str='', dataset_format: str='CVAT XML 1.1', status_check_period: int=None, pbar: Optiona...
899c9fd75146744def061efd7ab1b1c6c9f6942f
<|skeleton|> class ProjectsRepo: def create_from_dataset(self, spec: models.IProjectWriteRequest, *, dataset_path: str='', dataset_format: str='CVAT XML 1.1', status_check_period: int=None, pbar: Optional[ProgressReporter]=None) -> Project: """Create a new project with the given name and labels JSON and ad...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectsRepo: def create_from_dataset(self, spec: models.IProjectWriteRequest, *, dataset_path: str='', dataset_format: str='CVAT XML 1.1', status_check_period: int=None, pbar: Optional[ProgressReporter]=None) -> Project: """Create a new project with the given name and labels JSON and add the files to...
the_stack_v2_python_sparse
cvat-sdk/cvat_sdk/core/proxies/projects.py
opencv/cvat
train
6,558
c0320c5c72af7c1e729bc22d1c690368ba171d20
[ "Parametre.__init__(self, 'déplacer', 'move')\nself.tronquer = True\nself.schema = '<cle>'\nself.aide_courte = 'déplace une diligence'\nself.aide_longue = \"Cette commande permet de déplacer aléatoirement une diligence d'une salle. Vous devez préciser en paramètre la clé de la diligence (identique au nom de zone, c...
<|body_start_0|> Parametre.__init__(self, 'déplacer', 'move') self.tronquer = True self.schema = '<cle>' self.aide_courte = 'déplace une diligence' self.aide_longue = "Cette commande permet de déplacer aléatoirement une diligence d'une salle. Vous devez préciser en paramètre la c...
Commande 'diligence déplacer'.
PrmDeplacer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmDeplacer: """Commande 'diligence déplacer'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|> <|body_start_0|> Param...
stack_v2_sparse_classes_36k_train_030976
3,494
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
null
Implement the Python class `PrmDeplacer` described below. Class description: Commande 'diligence déplacer'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre
Implement the Python class `PrmDeplacer` described below. Class description: Commande 'diligence déplacer'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmDeplacer: """Commande '...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmDeplacer: """Commande 'diligence déplacer'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmDeplacer: """Commande 'diligence déplacer'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'déplacer', 'move') self.tronquer = True self.schema = '<cle>' self.aide_courte = 'déplace une diligence' self.aide_longue = "Cett...
the_stack_v2_python_sparse
src/secondaires/diligence/commandes/diligence/deplacer.py
vincent-lg/tsunami
train
5
b5343630cc6fab3f7710a3209f3f9736ea9892e0
[ "super(CSVWriter, self).__init__(filename)\nself.data_file = None\nself.writer = None\nif filename:\n self.data_file = open(filename, 'w', encoding='utf-8', newline='')\n self.writer = csv.writer(self.data_file, dialect='excel')", "if not self.writer:\n return False\nself.writer.writerow(line)\nreturn Tr...
<|body_start_0|> super(CSVWriter, self).__init__(filename) self.data_file = None self.writer = None if filename: self.data_file = open(filename, 'w', encoding='utf-8', newline='') self.writer = csv.writer(self.data_file, dialect='excel') <|end_body_0|> <|body_sta...
CSV file's writer.
CSVWriter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSVWriter: """CSV file's writer.""" def __init__(self, filename=None): """Args: filename: (String) data file's name. Returns: None""" <|body_0|> def writeln(self, line): """Write data line. Args: line: (List) Line data. Returns: boolean: Write success.""" ...
stack_v2_sparse_classes_36k_train_030977
6,679
permissive
[ { "docstring": "Args: filename: (String) data file's name. Returns: None", "name": "__init__", "signature": "def __init__(self, filename=None)" }, { "docstring": "Write data line. Args: line: (List) Line data. Returns: boolean: Write success.", "name": "writeln", "signature": "def writel...
3
null
Implement the Python class `CSVWriter` described below. Class description: CSV file's writer. Method signatures and docstrings: - def __init__(self, filename=None): Args: filename: (String) data file's name. Returns: None - def writeln(self, line): Write data line. Args: line: (List) Line data. Returns: boolean: Writ...
Implement the Python class `CSVWriter` described below. Class description: CSV file's writer. Method signatures and docstrings: - def __init__(self, filename=None): Args: filename: (String) data file's name. Returns: None - def writeln(self, line): Write data line. Args: line: (List) Line data. Returns: boolean: Writ...
5fa06b29bf800646dc4da5851fdf7a1f299f15a7
<|skeleton|> class CSVWriter: """CSV file's writer.""" def __init__(self, filename=None): """Args: filename: (String) data file's name. Returns: None""" <|body_0|> def writeln(self, line): """Write data line. Args: line: (List) Line data. Returns: boolean: Write success.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CSVWriter: """CSV file's writer.""" def __init__(self, filename=None): """Args: filename: (String) data file's name. Returns: None""" super(CSVWriter, self).__init__(filename) self.data_file = None self.writer = None if filename: self.data_file = open(f...
the_stack_v2_python_sparse
muddery/common/utils/writers.py
muddery/muddery
train
139
88f54374ec43f587394d36325a3ca57441be734a
[ "dummy_node = current = ListNode(None)\nwhile l1 and l2:\n if l1.val <= l2.val:\n current.next = l1\n l1 = l1.next\n else:\n current.next = l2\n l2 = l2.next\n current = current.next\ncurrent.next = l1 or l2\nreturn dummy_node.next", "if not l1 or not l2:\n return l1 or l2\...
<|body_start_0|> dummy_node = current = ListNode(None) while l1 and l2: if l1.val <= l2.val: current.next = l1 l1 = l1.next else: current.next = l2 l2 = l2.next current = current.next current.next...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: """非递归:生成哨兵结点。每次比较l1和l2的大小,新head每次指向值比较小的结点。""" <|body_0|> def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """递归:递归比较下一个结点和另一方结点。""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_030978
1,995
no_license
[ { "docstring": "非递归:生成哨兵结点。每次比较l1和l2的大小,新head每次指向值比较小的结点。", "name": "mergeTwoLists1", "signature": "def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode" }, { "docstring": "递归:递归比较下一个结点和另一方结点。", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1: ListNode, l2: ...
2
stack_v2_sparse_classes_30k_val_000578
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: 非递归:生成哨兵结点。每次比较l1和l2的大小,新head每次指向值比较小的结点。 - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 递归:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: 非递归:生成哨兵结点。每次比较l1和l2的大小,新head每次指向值比较小的结点。 - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 递归:...
2bbb1640589aab34f2bc42489283033cc11fb885
<|skeleton|> class Solution: def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: """非递归:生成哨兵结点。每次比较l1和l2的大小,新head每次指向值比较小的结点。""" <|body_0|> def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """递归:递归比较下一个结点和另一方结点。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists1(self, l1: ListNode, l2: ListNode) -> ListNode: """非递归:生成哨兵结点。每次比较l1和l2的大小,新head每次指向值比较小的结点。""" dummy_node = current = ListNode(None) while l1 and l2: if l1.val <= l2.val: current.next = l1 l1 = l1.next ...
the_stack_v2_python_sparse
021_merge-two-sorted-lists.py
helloocc/algorithm
train
1
2aaec870117c92c8968339120ebd9dc6fe41a4d0
[ "super().__init__()\nself.use_additional_convs = use_additional_convs\nself.convs1 = torch.nn.ModuleList()\nif use_additional_convs:\n self.convs2 = torch.nn.ModuleList()\nassert kernel_size % 2 == 1, 'Kernel size must be odd number.'\nfor dilation in dilations:\n self.convs1 += [torch.nn.Sequential(getattr(t...
<|body_start_0|> super().__init__() self.use_additional_convs = use_additional_convs self.convs1 = torch.nn.ModuleList() if use_additional_convs: self.convs2 = torch.nn.ModuleList() assert kernel_size % 2 == 1, 'Kernel size must be odd number.' for dilation in...
Residual block module in HiFiGAN.
ResidualBlock
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResidualBlock: """Residual block module in HiFiGAN.""" def __init__(self, kernel_size: int=3, channels: int=512, dilations: List[int]=[1, 3, 5], bias: bool=True, use_additional_convs: bool=True, nonlinear_activation: str='LeakyReLU', nonlinear_activation_params: Dict[str, Any]={'negative_slo...
stack_v2_sparse_classes_36k_train_030979
3,313
permissive
[ { "docstring": "Initialize ResidualBlock module. Args: kernel_size (int): Kernel size of dilation convolution layer. channels (int): Number of channels for convolution layer. dilations (List[int]): List of dilation factors. use_additional_convs (bool): Whether to use additional convolution layers. bias (bool): ...
2
null
Implement the Python class `ResidualBlock` described below. Class description: Residual block module in HiFiGAN. Method signatures and docstrings: - def __init__(self, kernel_size: int=3, channels: int=512, dilations: List[int]=[1, 3, 5], bias: bool=True, use_additional_convs: bool=True, nonlinear_activation: str='Le...
Implement the Python class `ResidualBlock` described below. Class description: Residual block module in HiFiGAN. Method signatures and docstrings: - def __init__(self, kernel_size: int=3, channels: int=512, dilations: List[int]=[1, 3, 5], bias: bool=True, use_additional_convs: bool=True, nonlinear_activation: str='Le...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class ResidualBlock: """Residual block module in HiFiGAN.""" def __init__(self, kernel_size: int=3, channels: int=512, dilations: List[int]=[1, 3, 5], bias: bool=True, use_additional_convs: bool=True, nonlinear_activation: str='LeakyReLU', nonlinear_activation_params: Dict[str, Any]={'negative_slo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResidualBlock: """Residual block module in HiFiGAN.""" def __init__(self, kernel_size: int=3, channels: int=512, dilations: List[int]=[1, 3, 5], bias: bool=True, use_additional_convs: bool=True, nonlinear_activation: str='LeakyReLU', nonlinear_activation_params: Dict[str, Any]={'negative_slope': 0.1}): ...
the_stack_v2_python_sparse
espnet2/gan_tts/hifigan/residual_block.py
espnet/espnet
train
7,242
94ce59d99d24e91ff511a91f2b987535903c8523
[ "if not root:\n return\ntree = root\nlink = TreeNode(1)\nstart = link\nstack = []\nwhile stack or root:\n if root:\n stack.append(root)\n root = root.left\n if root:\n link.right = TreeNode(root.val)\n link = link.right\n else:\n root = stack.pop()\n ...
<|body_start_0|> if not root: return tree = root link = TreeNode(1) start = link stack = [] while stack or root: if root: stack.append(root) root = root.left if root: link.right = ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _flatten(self, root): """:type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.""" <|body_0|> def __flatten(self, root): """:type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.""" ...
stack_v2_sparse_classes_36k_train_030980
5,026
permissive
[ { "docstring": ":type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.", "name": "_flatten", "signature": "def _flatten(self, root)" }, { "docstring": ":type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.", "name": "__flatte...
5
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _flatten(self, root): :type root: TreeNode :rtype: None Do not return anything, modify root in-place instead. - def __flatten(self, root): :type root: TreeNode :rtype: None D...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _flatten(self, root): :type root: TreeNode :rtype: None Do not return anything, modify root in-place instead. - def __flatten(self, root): :type root: TreeNode :rtype: None D...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _flatten(self, root): """:type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.""" <|body_0|> def __flatten(self, root): """:type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _flatten(self, root): """:type root: TreeNode :rtype: None Do not return anything, modify root in-place instead.""" if not root: return tree = root link = TreeNode(1) start = link stack = [] while stack or root: if r...
the_stack_v2_python_sparse
114.flatten-binary-tree-to-linked-list.py
windard/leeeeee
train
0
dc8c286d67d3fa5b44f40a5803b3bd5fa0fca6d3
[ "super().__init__(screen_width, screen_height, State.PLAYMODE, screen, 0, 0, debug)\nfirst_pixel = self.screen_height // 2\nself.header = self.write(Screen.title_font, WHITE, 'Modes', self.screen_width // 2, self.screen_height // 5)\ntutorial = self.write(Screen.end_font, WHITE, 'Tutorial', self.screen_width // 2, ...
<|body_start_0|> super().__init__(screen_width, screen_height, State.PLAYMODE, screen, 0, 0, debug) first_pixel = self.screen_height // 2 self.header = self.write(Screen.title_font, WHITE, 'Modes', self.screen_width // 2, self.screen_height // 5) tutorial = self.write(Screen.end_font, WH...
PlayModeScreen
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlayModeScreen: def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False): """Main screen for the different play modes""" <|body_0|> def check_mouse_clicks(self) -> State: """Check the button that the player pressed""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_030981
3,245
permissive
[ { "docstring": "Main screen for the different play modes", "name": "__init__", "signature": "def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False)" }, { "docstring": "Check the button that the player pressed", "name": "check_mouse_clicks", "signature": "def...
4
null
Implement the Python class `PlayModeScreen` described below. Class description: Implement the PlayModeScreen class. Method signatures and docstrings: - def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False): Main screen for the different play modes - def check_mouse_clicks(self) -> State...
Implement the Python class `PlayModeScreen` described below. Class description: Implement the PlayModeScreen class. Method signatures and docstrings: - def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False): Main screen for the different play modes - def check_mouse_clicks(self) -> State...
6f8f2da4fd26ef1d77c0c6183230c3a5e6bf0bb9
<|skeleton|> class PlayModeScreen: def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False): """Main screen for the different play modes""" <|body_0|> def check_mouse_clicks(self) -> State: """Check the button that the player pressed""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlayModeScreen: def __init__(self, screen_width: int, screen_height: int, screen, debug: bool=False): """Main screen for the different play modes""" super().__init__(screen_width, screen_height, State.PLAYMODE, screen, 0, 0, debug) first_pixel = self.screen_height // 2 self.hea...
the_stack_v2_python_sparse
gym_invaders/gym_game/envs/classes/Game/Screens/PlayModesScreen.py
Jh123x/Orbital
train
4
f9311aaea85b4579481d753930a3ae6c8710222d
[ "f = {}\nd = {}\n\ndef find(x):\n f.setdefault(x, x)\n d.setdefault(x, 1)\n if x != f[x]:\n t = f[x]\n f[x] = find(t)\n d[x] *= d[t]\n return f[x]\n return x\n\ndef union(A, B, value):\n a, b = (find(A), find(B))\n if a != b:\n f[a] = b\n d[a] = d[B] / d[A...
<|body_start_0|> f = {} d = {} def find(x): f.setdefault(x, x) d.setdefault(x, 1) if x != f[x]: t = f[x] f[x] = find(t) d[x] *= d[t] return f[x] return x def union(A, B, valu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def calcEquation1(self, equations: List[List[str]], values: List[float], queries: List[List[str]]) -> List[float]: """思路:并查集 @param equations: @param values: @param queries: @return:""" <|body_0|> def calcEquation2(self, equations: List[List[str]], values: List[flo...
stack_v2_sparse_classes_36k_train_030982
4,321
no_license
[ { "docstring": "思路:并查集 @param equations: @param values: @param queries: @return:", "name": "calcEquation1", "signature": "def calcEquation1(self, equations: List[List[str]], values: List[float], queries: List[List[str]]) -> List[float]" }, { "docstring": "思路:floyd @param equations: @param values...
2
stack_v2_sparse_classes_30k_train_009821
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calcEquation1(self, equations: List[List[str]], values: List[float], queries: List[List[str]]) -> List[float]: 思路:并查集 @param equations: @param values: @param queries: @return...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calcEquation1(self, equations: List[List[str]], values: List[float], queries: List[List[str]]) -> List[float]: 思路:并查集 @param equations: @param values: @param queries: @return...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def calcEquation1(self, equations: List[List[str]], values: List[float], queries: List[List[str]]) -> List[float]: """思路:并查集 @param equations: @param values: @param queries: @return:""" <|body_0|> def calcEquation2(self, equations: List[List[str]], values: List[flo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def calcEquation1(self, equations: List[List[str]], values: List[float], queries: List[List[str]]) -> List[float]: """思路:并查集 @param equations: @param values: @param queries: @return:""" f = {} d = {} def find(x): f.setdefault(x, x) d.setdefaul...
the_stack_v2_python_sparse
LeetCode/并查集/399. 除法求值.py
yiming1012/MyLeetCode
train
2
a4376fcf1ffc2d58fbeb5838f1da7437b129a4d0
[ "super(ApplyGrid, self).__init__()\nself.device = device\nself.dtype = dtype\nself.interpolation_mode = interp_mode\nself.padding_mode = pad_mode\nself.grid = grid", "app = ApplyGrid(grid, interp_mode, pad_mode, device, dtype)\napp = app.to(device)\napp = app.type(dtype)\nfor attr, val in app.__dict__.items():\n ...
<|body_start_0|> super(ApplyGrid, self).__init__() self.device = device self.dtype = dtype self.interpolation_mode = interp_mode self.padding_mode = pad_mode self.grid = grid <|end_body_0|> <|body_start_1|> app = ApplyGrid(grid, interp_mode, pad_mode, device, dty...
ApplyGrid
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApplyGrid: def __init__(self, grid, interp_mode='bilinear', pad_mode='zeros', device='cpu', dtype=torch.float32): """Base constructor method. Use ApplyGrid.Create to construct an ApplyGrid filter. The base constructor does not allow class:'StructuredGrid' types to be added to the specifi...
stack_v2_sparse_classes_36k_train_030983
5,295
permissive
[ { "docstring": "Base constructor method. Use ApplyGrid.Create to construct an ApplyGrid filter. The base constructor does not allow class:'StructuredGrid' types to be added to the specific memory location, so not all attributes will be on the same memory device.", "name": "__init__", "signature": "def _...
4
stack_v2_sparse_classes_30k_train_010374
Implement the Python class `ApplyGrid` described below. Class description: Implement the ApplyGrid class. Method signatures and docstrings: - def __init__(self, grid, interp_mode='bilinear', pad_mode='zeros', device='cpu', dtype=torch.float32): Base constructor method. Use ApplyGrid.Create to construct an ApplyGrid f...
Implement the Python class `ApplyGrid` described below. Class description: Implement the ApplyGrid class. Method signatures and docstrings: - def __init__(self, grid, interp_mode='bilinear', pad_mode='zeros', device='cpu', dtype=torch.float32): Base constructor method. Use ApplyGrid.Create to construct an ApplyGrid f...
a42a407dc62151ab8a7eb4be3aee1318b984502c
<|skeleton|> class ApplyGrid: def __init__(self, grid, interp_mode='bilinear', pad_mode='zeros', device='cpu', dtype=torch.float32): """Base constructor method. Use ApplyGrid.Create to construct an ApplyGrid filter. The base constructor does not allow class:'StructuredGrid' types to be added to the specifi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApplyGrid: def __init__(self, grid, interp_mode='bilinear', pad_mode='zeros', device='cpu', dtype=torch.float32): """Base constructor method. Use ApplyGrid.Create to construct an ApplyGrid filter. The base constructor does not allow class:'StructuredGrid' types to be added to the specific memory locat...
the_stack_v2_python_sparse
camp/StructuredGridOperators/UnaryOperators/ApplyGridFilter.py
fuslab-uofu/CAMP
train
0
bcb8ae93f8e78c6fd8149468b202b5ec9fd1b9f8
[ "kwargs['default'] = default\nkwargs['types'] = (Head, str)\nsuper().__init__(**kwargs)", "if isinstance(value, Head):\n return value\nvalue = super().parse(value)\nif value is UNDEF or value is None:\n return value\nif callable(value):\n return value\nreturn Head.create(value)" ]
<|body_start_0|> kwargs['default'] = default kwargs['types'] = (Head, str) super().__init__(**kwargs) <|end_body_0|> <|body_start_1|> if isinstance(value, Head): return value value = super().parse(value) if value is UNDEF or value is None: return ...
Defines a head property, which simplifies a head definition by converting specific symbols into an instance of corresponding head glyph. Available symbols are defined by the pero.HEAD enum.
HeadProperty
[ "LicenseRef-scancode-philippe-de-muyter", "LicenseRef-scancode-commercial-license", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HeadProperty: """Defines a head property, which simplifies a head definition by converting specific symbols into an instance of corresponding head glyph. Available symbols are defined by the pero.HEAD enum.""" def __init__(self, default=UNDEF, **kwargs): """Initializes a new instance...
stack_v2_sparse_classes_36k_train_030984
10,431
permissive
[ { "docstring": "Initializes a new instance of HeadProperty.", "name": "__init__", "signature": "def __init__(self, default=UNDEF, **kwargs)" }, { "docstring": "Validates and converts given value.", "name": "parse", "signature": "def parse(self, value)" } ]
2
null
Implement the Python class `HeadProperty` described below. Class description: Defines a head property, which simplifies a head definition by converting specific symbols into an instance of corresponding head glyph. Available symbols are defined by the pero.HEAD enum. Method signatures and docstrings: - def __init__(s...
Implement the Python class `HeadProperty` described below. Class description: Defines a head property, which simplifies a head definition by converting specific symbols into an instance of corresponding head glyph. Available symbols are defined by the pero.HEAD enum. Method signatures and docstrings: - def __init__(s...
d59b1bc056f3037b7b7ab635b6deb41120612965
<|skeleton|> class HeadProperty: """Defines a head property, which simplifies a head definition by converting specific symbols into an instance of corresponding head glyph. Available symbols are defined by the pero.HEAD enum.""" def __init__(self, default=UNDEF, **kwargs): """Initializes a new instance...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HeadProperty: """Defines a head property, which simplifies a head definition by converting specific symbols into an instance of corresponding head glyph. Available symbols are defined by the pero.HEAD enum.""" def __init__(self, default=UNDEF, **kwargs): """Initializes a new instance of HeadPrope...
the_stack_v2_python_sparse
pero/glyphs/heads.py
xxao/pero
train
31
5b2d9b847408c6bd8df3ed9f69b8e6c100e9a79c
[ "typeid, value = (userindex.typeid, userindex.value)\nif Retrieve.byindex(typeid, value):\n raise error.UserIndexValueBound(typeid + ' - ' + value)\ntry:\n user: User = Retrieve.byid(userid)\n user.indexs.append(userindex)\nexcept mongoengine.NotUniqueError as _error:\n raise error.UserIndexTypeBound(ty...
<|body_start_0|> typeid, value = (userindex.typeid, userindex.value) if Retrieve.byindex(typeid, value): raise error.UserIndexValueBound(typeid + ' - ' + value) try: user: User = Retrieve.byid(userid) user.indexs.append(userindex) except mongoengine.No...
创建用户静态函数集合
Create
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Create: """创建用户静态函数集合""" def index(userid: ObjectId, userindex: UserIndex) -> List[UserIndex]: """该函数将为用户新增一种索引类型: 1. 首先会检查指定的索引值是否被其他用户绑定过 2. 尝试插入检查是否发生 unique 错误""" <|body_0|> def group(userid: ObjectId, groupid: ObjectId) -> User: """向组中添加用户: 向用户组的用户记录中添加 向用户的...
stack_v2_sparse_classes_36k_train_030985
4,956
permissive
[ { "docstring": "该函数将为用户新增一种索引类型: 1. 首先会检查指定的索引值是否被其他用户绑定过 2. 尝试插入检查是否发生 unique 错误", "name": "index", "signature": "def index(userid: ObjectId, userindex: UserIndex) -> List[UserIndex]" }, { "docstring": "向组中添加用户: 向用户组的用户记录中添加 向用户的组记录中添加", "name": "group", "signature": "def group(userid: ...
2
null
Implement the Python class `Create` described below. Class description: 创建用户静态函数集合 Method signatures and docstrings: - def index(userid: ObjectId, userindex: UserIndex) -> List[UserIndex]: 该函数将为用户新增一种索引类型: 1. 首先会检查指定的索引值是否被其他用户绑定过 2. 尝试插入检查是否发生 unique 错误 - def group(userid: ObjectId, groupid: ObjectId) -> User: 向组中添加...
Implement the Python class `Create` described below. Class description: 创建用户静态函数集合 Method signatures and docstrings: - def index(userid: ObjectId, userindex: UserIndex) -> List[UserIndex]: 该函数将为用户新增一种索引类型: 1. 首先会检查指定的索引值是否被其他用户绑定过 2. 尝试插入检查是否发生 unique 错误 - def group(userid: ObjectId, groupid: ObjectId) -> User: 向组中添加...
79e34f4b8fba8c6fd208b5a3049103dca2064ab5
<|skeleton|> class Create: """创建用户静态函数集合""" def index(userid: ObjectId, userindex: UserIndex) -> List[UserIndex]: """该函数将为用户新增一种索引类型: 1. 首先会检查指定的索引值是否被其他用户绑定过 2. 尝试插入检查是否发生 unique 错误""" <|body_0|> def group(userid: ObjectId, groupid: ObjectId) -> User: """向组中添加用户: 向用户组的用户记录中添加 向用户的...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Create: """创建用户静态函数集合""" def index(userid: ObjectId, userindex: UserIndex) -> List[UserIndex]: """该函数将为用户新增一种索引类型: 1. 首先会检查指定的索引值是否被其他用户绑定过 2. 尝试插入检查是否发生 unique 错误""" typeid, value = (userindex.typeid, userindex.value) if Retrieve.byindex(typeid, value): raise error.Us...
the_stack_v2_python_sparse
leaf/rbac/functions/user.py
guiqiqi/leaf
train
122
26ee07307cb543a6aba562cddb82d4ad8aceab9d
[ "component_spc = kwargs['spc'] if 'spc' in kwargs else spc.SPC\nwx_panel.COMPONENT.__init__(self, parent=parent, resource=resource, spc=component_spc, context=context)\nolap_query_browser.iqOLAPQueryBrowserProto.__init__(self, *args, parent=parent, **kwargs)", "psp = self.getAttribute('olap_server')\nlog_func.deb...
<|body_start_0|> component_spc = kwargs['spc'] if 'spc' in kwargs else spc.SPC wx_panel.COMPONENT.__init__(self, parent=parent, resource=resource, spc=component_spc, context=context) olap_query_browser.iqOLAPQueryBrowserProto.__init__(self, *args, parent=parent, **kwargs) <|end_body_0|> <|body_...
OLAP server query browser component.
iqWxOLAPQueryBrowser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class iqWxOLAPQueryBrowser: """OLAP server query browser component.""" def __init__(self, parent=None, resource=None, context=None, *args, **kwargs): """Standard component constructor. :param parent: Parent object. :param resource: Object resource dictionary. :param context: Context dictio...
stack_v2_sparse_classes_36k_train_030986
1,543
no_license
[ { "docstring": "Standard component constructor. :param parent: Parent object. :param resource: Object resource dictionary. :param context: Context dictionary.", "name": "__init__", "signature": "def __init__(self, parent=None, resource=None, context=None, *args, **kwargs)" }, { "docstring": "OLA...
3
stack_v2_sparse_classes_30k_train_006739
Implement the Python class `iqWxOLAPQueryBrowser` described below. Class description: OLAP server query browser component. Method signatures and docstrings: - def __init__(self, parent=None, resource=None, context=None, *args, **kwargs): Standard component constructor. :param parent: Parent object. :param resource: O...
Implement the Python class `iqWxOLAPQueryBrowser` described below. Class description: OLAP server query browser component. Method signatures and docstrings: - def __init__(self, parent=None, resource=None, context=None, *args, **kwargs): Standard component constructor. :param parent: Parent object. :param resource: O...
7550e242746cb2fb1219474463f8db21f8e3e114
<|skeleton|> class iqWxOLAPQueryBrowser: """OLAP server query browser component.""" def __init__(self, parent=None, resource=None, context=None, *args, **kwargs): """Standard component constructor. :param parent: Parent object. :param resource: Object resource dictionary. :param context: Context dictio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class iqWxOLAPQueryBrowser: """OLAP server query browser component.""" def __init__(self, parent=None, resource=None, context=None, *args, **kwargs): """Standard component constructor. :param parent: Parent object. :param resource: Object resource dictionary. :param context: Context dictionary.""" ...
the_stack_v2_python_sparse
iq/components/wx_olap_query_browser/component.py
XHermitOne/iq_framework
train
1
c4cbb75a4fc0deb33fbada77ea48c1ca933116b3
[ "try:\n self._client = mongo.MongoClient(configuration['hostname'], configuration['port'])\n self._db = self._client[configuration['bdname']]\nexcept mongo.errors.PyMongoError:\n raise Exception('Error initializing database')", "try:\n mongo.collection.Collection(self._db, collection_name, create=True...
<|body_start_0|> try: self._client = mongo.MongoClient(configuration['hostname'], configuration['port']) self._db = self._client[configuration['bdname']] except mongo.errors.PyMongoError: raise Exception('Error initializing database') <|end_body_0|> <|body_start_1|> ...
Database
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Database: def __init__(self, configuration): """:param configuration: :param logger:""" <|body_0|> def create_store(self, collection_name): """this method create a collection in mongodb database :param collection_name: the collection name""" <|body_1|> d...
stack_v2_sparse_classes_36k_train_030987
1,706
no_license
[ { "docstring": ":param configuration: :param logger:", "name": "__init__", "signature": "def __init__(self, configuration)" }, { "docstring": "this method create a collection in mongodb database :param collection_name: the collection name", "name": "create_store", "signature": "def creat...
4
stack_v2_sparse_classes_30k_train_006411
Implement the Python class `Database` described below. Class description: Implement the Database class. Method signatures and docstrings: - def __init__(self, configuration): :param configuration: :param logger: - def create_store(self, collection_name): this method create a collection in mongodb database :param coll...
Implement the Python class `Database` described below. Class description: Implement the Database class. Method signatures and docstrings: - def __init__(self, configuration): :param configuration: :param logger: - def create_store(self, collection_name): this method create a collection in mongodb database :param coll...
a7eb1019e62a0bdce52a4547e1c829aa0cfd28c2
<|skeleton|> class Database: def __init__(self, configuration): """:param configuration: :param logger:""" <|body_0|> def create_store(self, collection_name): """this method create a collection in mongodb database :param collection_name: the collection name""" <|body_1|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Database: def __init__(self, configuration): """:param configuration: :param logger:""" try: self._client = mongo.MongoClient(configuration['hostname'], configuration['port']) self._db = self._client[configuration['bdname']] except mongo.errors.PyMongoError: ...
the_stack_v2_python_sparse
src/datastore/database.py
mhamedLmarbouh/yt-Gender-Resolver
train
0
f69d4851f1b9bcf927a08eeea912151e6891a696
[ "self.word_dict = defaultdict(list)\nfor i, w in enumerate(words):\n self.word_dict[w].append(i)", "mini = sys.maxint\nfor i in self.word_dict[word1]:\n idx = bisect_left(self.word_dict[word2], i)\n for nei in (-1, 0):\n if 0 <= idx + nei < len(self.word_dict[word2]):\n mini = min(mini,...
<|body_start_0|> self.word_dict = defaultdict(list) for i, w in enumerate(words): self.word_dict[w].append(i) <|end_body_0|> <|body_start_1|> mini = sys.maxint for i in self.word_dict[word1]: idx = bisect_left(self.word_dict[word2], i) for nei in (-1,...
WordDistance
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDistance: def __init__(self, words): """initialize your data structure here. :type words: list[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_030988
857
permissive
[ { "docstring": "initialize your data structure here. :type words: list[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "shortest", "signature": "def shortest(self, word1, word2)" } ]
2
stack_v2_sparse_classes_30k_train_014652
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): initialize your data structure here. :type words: list[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): initialize your data structure here. :type words: list[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int ...
cbbd4a67ab342ada2421e13f82d660b1d47d4d20
<|skeleton|> class WordDistance: def __init__(self, words): """initialize your data structure here. :type words: list[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordDistance: def __init__(self, words): """initialize your data structure here. :type words: list[str]""" self.word_dict = defaultdict(list) for i, w in enumerate(words): self.word_dict[w].append(i) def shortest(self, word1, word2): """:type word1: str :type w...
the_stack_v2_python_sparse
244 Shortest Word Distance II.py
Aminaba123/LeetCode
train
1
3bfa569bd9e828d08fb8a64bb2baf36d19cdd4c2
[ "def isPalindrome(s):\n return s == s[::-1]\nmemo = {}\n\ndef helper(s):\n if not s:\n return [[]]\n if s in memo:\n return memo[s]\n res = []\n for i in range(len(s)):\n if isPalindrome(s[:i + 1]):\n cur = [s[:i + 1]]\n pars = helper(s[i + 1:])\n ...
<|body_start_0|> def isPalindrome(s): return s == s[::-1] memo = {} def helper(s): if not s: return [[]] if s in memo: return memo[s] res = [] for i in range(len(s)): if isPalindrome(s[:i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def partitionDP(self, s): """:type s: str :rtype: List[List[str]]""" <|body_0|> def partition(self, s): """:type s: str :rtype: List[List[str]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> def isPalindrome(s): return s == s[...
stack_v2_sparse_classes_36k_train_030989
2,078
no_license
[ { "docstring": ":type s: str :rtype: List[List[str]]", "name": "partitionDP", "signature": "def partitionDP(self, s)" }, { "docstring": ":type s: str :rtype: List[List[str]]", "name": "partition", "signature": "def partition(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_018937
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def partitionDP(self, s): :type s: str :rtype: List[List[str]] - def partition(self, s): :type s: str :rtype: List[List[str]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def partitionDP(self, s): :type s: str :rtype: List[List[str]] - def partition(self, s): :type s: str :rtype: List[List[str]] <|skeleton|> class Solution: def partitionDP(s...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def partitionDP(self, s): """:type s: str :rtype: List[List[str]]""" <|body_0|> def partition(self, s): """:type s: str :rtype: List[List[str]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def partitionDP(self, s): """:type s: str :rtype: List[List[str]]""" def isPalindrome(s): return s == s[::-1] memo = {} def helper(s): if not s: return [[]] if s in memo: return memo[s] r...
the_stack_v2_python_sparse
P/PalindromePartitioning.py
bssrdf/pyleet
train
2
54ac2e5bc9ae8d48b98b2d59e47134e45b5050f6
[ "self._train_api = train_api\nself._from_station = from_station\nself._to_station = to_station\nself._weekday = weekday\nself._time = departuretime\nself._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, entry_id)}, manufacturer='Trafikverket', model='v2.0', name=name, configu...
<|body_start_0|> self._train_api = train_api self._from_station = from_station self._to_station = to_station self._weekday = weekday self._time = departuretime self._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, entry_id)}, manufa...
Contains data about a train depature.
TrainSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrainSensor: """Contains data about a train depature.""" def __init__(self, train_api: TrafikverketTrain, name: str, from_station: StationInfo, to_station: StationInfo, weekday: list, departuretime: time | None, entry_id: str) -> None: """Initialize the sensor.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_030990
7,335
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, train_api: TrafikverketTrain, name: str, from_station: StationInfo, to_station: StationInfo, weekday: list, departuretime: time | None, entry_id: str) -> None" }, { "docstring": "Retrieve latest state."...
3
stack_v2_sparse_classes_30k_train_020171
Implement the Python class `TrainSensor` described below. Class description: Contains data about a train depature. Method signatures and docstrings: - def __init__(self, train_api: TrafikverketTrain, name: str, from_station: StationInfo, to_station: StationInfo, weekday: list, departuretime: time | None, entry_id: st...
Implement the Python class `TrainSensor` described below. Class description: Contains data about a train depature. Method signatures and docstrings: - def __init__(self, train_api: TrafikverketTrain, name: str, from_station: StationInfo, to_station: StationInfo, weekday: list, departuretime: time | None, entry_id: st...
2e65b77b2b5c17919939481f327963abdfdc53f0
<|skeleton|> class TrainSensor: """Contains data about a train depature.""" def __init__(self, train_api: TrafikverketTrain, name: str, from_station: StationInfo, to_station: StationInfo, weekday: list, departuretime: time | None, entry_id: str) -> None: """Initialize the sensor.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrainSensor: """Contains data about a train depature.""" def __init__(self, train_api: TrafikverketTrain, name: str, from_station: StationInfo, to_station: StationInfo, weekday: list, departuretime: time | None, entry_id: str) -> None: """Initialize the sensor.""" self._train_api = train_...
the_stack_v2_python_sparse
homeassistant/components/trafikverket_train/sensor.py
konnected-io/home-assistant
train
24
b40401c639898c6b42bc30524abe59a8664f6585
[ "verifier = {'oauth_token': request.resource_owner_key, 'oauth_verifier': self.token_generator()}\nverifier.update(credentials)\nself.request_validator.save_verifier(request.resource_owner_key, verifier, request)\nreturn verifier", "request = self._create_request(uri, http_method=http_method, body=body, headers=h...
<|body_start_0|> verifier = {'oauth_token': request.resource_owner_key, 'oauth_verifier': self.token_generator()} verifier.update(credentials) self.request_validator.save_verifier(request.resource_owner_key, verifier, request) return verifier <|end_body_0|> <|body_start_1|> requ...
An endpoint responsible for letting authenticated users authorize access to their protected resources to a client. Typical use would be to have two views, one for displaying the authorization form and one to process said form on submission. The first view will want to utilize ``get_realms_and_credentials`` to fetch req...
AuthorizationEndpoint
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthorizationEndpoint: """An endpoint responsible for letting authenticated users authorize access to their protected resources to a client. Typical use would be to have two views, one for displaying the authorization form and one to process said form on submission. The first view will want to ut...
stack_v2_sparse_classes_36k_train_030991
6,724
permissive
[ { "docstring": "Create and save a new request token. :param request: OAuthlib request. :type request: oauthlib.common.Request :param credentials: A dict of extra token credentials. :returns: The verifier as a dict.", "name": "create_verifier", "signature": "def create_verifier(self, request, credentials...
3
stack_v2_sparse_classes_30k_train_012778
Implement the Python class `AuthorizationEndpoint` described below. Class description: An endpoint responsible for letting authenticated users authorize access to their protected resources to a client. Typical use would be to have two views, one for displaying the authorization form and one to process said form on sub...
Implement the Python class `AuthorizationEndpoint` described below. Class description: An endpoint responsible for letting authenticated users authorize access to their protected resources to a client. Typical use would be to have two views, one for displaying the authorization form and one to process said form on sub...
00f9a212004a80df790ed071a59af53a05f5e3f2
<|skeleton|> class AuthorizationEndpoint: """An endpoint responsible for letting authenticated users authorize access to their protected resources to a client. Typical use would be to have two views, one for displaying the authorization form and one to process said form on submission. The first view will want to ut...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthorizationEndpoint: """An endpoint responsible for letting authenticated users authorize access to their protected resources to a client. Typical use would be to have two views, one for displaying the authorization form and one to process said form on submission. The first view will want to utilize ``get_r...
the_stack_v2_python_sparse
oauthlib/oauth1/rfc5849/endpoints/authorization.py
oauthlib/oauthlib
train
1,223
ad0e9ba91d045cebf944cf12f1874f9ad42291d4
[ "unit = ToDoCategory()\nunit.add_item(['default item'])\nself.assertEqual(unit.category['default'], ['default item'])\nunit.add_item(['custom item 1', 'cat1', 'cat2'])\nself.assertEqual(unit.category['cat1'], ['custom item 1'])\nself.assertEqual(unit.category['cat2'], ['custom item 1'])\nunit.add_item(['custom item...
<|body_start_0|> unit = ToDoCategory() unit.add_item(['default item']) self.assertEqual(unit.category['default'], ['default item']) unit.add_item(['custom item 1', 'cat1', 'cat2']) self.assertEqual(unit.category['cat1'], ['custom item 1']) self.assertEqual(unit.category['...
Tests for ToDoCategory class methods.
ToDoCategoryTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ToDoCategoryTestCase: """Tests for ToDoCategory class methods.""" def test_add_item(self): """Tests for add_item method.""" <|body_0|> def test_retrieve_item(self): """Tests for retrieve_item method""" <|body_1|> def test_delete_item(self): "...
stack_v2_sparse_classes_36k_train_030992
7,962
no_license
[ { "docstring": "Tests for add_item method.", "name": "test_add_item", "signature": "def test_add_item(self)" }, { "docstring": "Tests for retrieve_item method", "name": "test_retrieve_item", "signature": "def test_retrieve_item(self)" }, { "docstring": "Tests for delete_item meth...
4
stack_v2_sparse_classes_30k_train_009551
Implement the Python class `ToDoCategoryTestCase` described below. Class description: Tests for ToDoCategory class methods. Method signatures and docstrings: - def test_add_item(self): Tests for add_item method. - def test_retrieve_item(self): Tests for retrieve_item method - def test_delete_item(self): Tests for del...
Implement the Python class `ToDoCategoryTestCase` described below. Class description: Tests for ToDoCategory class methods. Method signatures and docstrings: - def test_add_item(self): Tests for add_item method. - def test_retrieve_item(self): Tests for retrieve_item method - def test_delete_item(self): Tests for del...
a84e5c510be4e114f4fbd060185fe4a0a97b2186
<|skeleton|> class ToDoCategoryTestCase: """Tests for ToDoCategory class methods.""" def test_add_item(self): """Tests for add_item method.""" <|body_0|> def test_retrieve_item(self): """Tests for retrieve_item method""" <|body_1|> def test_delete_item(self): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ToDoCategoryTestCase: """Tests for ToDoCategory class methods.""" def test_add_item(self): """Tests for add_item method.""" unit = ToDoCategory() unit.add_item(['default item']) self.assertEqual(unit.category['default'], ['default item']) unit.add_item(['custom ite...
the_stack_v2_python_sparse
int/dp_219_int.py
robpalbrah/RedditDailyProgrammer
train
0
492bb6b023a9436c7338891d6c8ae079d76aee2d
[ "if self.size > 0:\n new_point = self.create_structured_array(perception, self.members.dtype, 1)\n self.copy_perception(new_point, 0, perception)\n members = structured_to_unstructured(self.members[0:self.size][list(new_point.dtype.names)])\n point = structured_to_unstructured(new_point)\n membership...
<|body_start_0|> if self.size > 0: new_point = self.create_structured_array(perception, self.members.dtype, 1) self.copy_perception(new_point, 0, perception) members = structured_to_unstructured(self.members[0:self.size][list(new_point.dtype.names)]) point = struc...
Calculate the new activation value. This activation value is for a given perception and it is calculated as follows: - Calculate the closest point and antipoint to the new point. - Calculate the activation as the value of the equation of a line passing through (0, closest_point_activation) and (closest_point_distance +...
DynamicMembershipPointBasedSpace
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DynamicMembershipPointBasedSpace: """Calculate the new activation value. This activation value is for a given perception and it is calculated as follows: - Calculate the closest point and antipoint to the new point. - Calculate the activation as the value of the equation of a line passing through...
stack_v2_sparse_classes_36k_train_030993
21,021
no_license
[ { "docstring": "Add a new point to the p-node.", "name": "add_point", "signature": "def add_point(self, perception, confidence)" }, { "docstring": "Calculate the new activation value.", "name": "get_probability", "signature": "def get_probability(self, perception)" } ]
2
null
Implement the Python class `DynamicMembershipPointBasedSpace` described below. Class description: Calculate the new activation value. This activation value is for a given perception and it is calculated as follows: - Calculate the closest point and antipoint to the new point. - Calculate the activation as the value of...
Implement the Python class `DynamicMembershipPointBasedSpace` described below. Class description: Calculate the new activation value. This activation value is for a given perception and it is calculated as follows: - Calculate the closest point and antipoint to the new point. - Calculate the activation as the value of...
2a0667a1cdd34c4a5e0239dea376c3a39f6b070a
<|skeleton|> class DynamicMembershipPointBasedSpace: """Calculate the new activation value. This activation value is for a given perception and it is calculated as follows: - Calculate the closest point and antipoint to the new point. - Calculate the activation as the value of the equation of a line passing through...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DynamicMembershipPointBasedSpace: """Calculate the new activation value. This activation value is for a given perception and it is calculated as follows: - Calculate the closest point and antipoint to the new point. - Calculate the activation as the value of the equation of a line passing through (0, closest_...
the_stack_v2_python_sparse
mdb_ltm/src/mdb_ltm/space.py
GII/MDB
train
0
a2eea48a807112b79da1dc96694011b6eddee46e
[ "vks = msg.get(Connection.CONNECTION, {}).get(DIDDoc.DID_DOC, {}).get('publicKey')\nvk = vks[0].get('publicKeyBase58') if vks and isinstance(vks, list) and (len(vks) > 0) else None\nendpoints = msg.get(Connection.CONNECTION, {}).get(DIDDoc.DID_DOC, {}).get('service')\nendpoint = endpoints[0].get('serviceEndpoint') ...
<|body_start_0|> vks = msg.get(Connection.CONNECTION, {}).get(DIDDoc.DID_DOC, {}).get('publicKey') vk = vks[0].get('publicKeyBase58') if vks and isinstance(vks, list) and (len(vks) > 0) else None endpoints = msg.get(Connection.CONNECTION, {}).get(DIDDoc.DID_DOC, {}).get('service') endpoi...
Connection
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Connection: def extract_verkey_endpoint(msg: Message) -> (Optional, Optional): """Extract verkey and endpoint that will be used to send message back to the sender of this message. Might return None.""" <|body_0|> def extract_their_info(msg: Message): """Extract the o...
stack_v2_sparse_classes_36k_train_030994
7,850
permissive
[ { "docstring": "Extract verkey and endpoint that will be used to send message back to the sender of this message. Might return None.", "name": "extract_verkey_endpoint", "signature": "def extract_verkey_endpoint(msg: Message) -> (Optional, Optional)" }, { "docstring": "Extract the other particip...
2
stack_v2_sparse_classes_30k_train_014843
Implement the Python class `Connection` described below. Class description: Implement the Connection class. Method signatures and docstrings: - def extract_verkey_endpoint(msg: Message) -> (Optional, Optional): Extract verkey and endpoint that will be used to send message back to the sender of this message. Might ret...
Implement the Python class `Connection` described below. Class description: Implement the Connection class. Method signatures and docstrings: - def extract_verkey_endpoint(msg: Message) -> (Optional, Optional): Extract verkey and endpoint that will be used to send message back to the sender of this message. Might ret...
3371a44144f45c7978b3454a440fe143eda7b1de
<|skeleton|> class Connection: def extract_verkey_endpoint(msg: Message) -> (Optional, Optional): """Extract verkey and endpoint that will be used to send message back to the sender of this message. Might return None.""" <|body_0|> def extract_their_info(msg: Message): """Extract the o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Connection: def extract_verkey_endpoint(msg: Message) -> (Optional, Optional): """Extract verkey and endpoint that will be used to send message back to the sender of this message. Might return None.""" vks = msg.get(Connection.CONNECTION, {}).get(DIDDoc.DID_DOC, {}).get('publicKey') vk...
the_stack_v2_python_sparse
python_agent_utils/messages/connection.py
TedKang/Indy-Agent
train
0
9948a0726f7a8ac952d193426f00b0befa4c3166
[ "nx = config['nx']\ndx = config['dx']\nxbgn, _ = config['x_limits']\nx_r = np.asarray(config['x_r'])\nself.nrec = len(x_r)\nxpos = x_r - xbgn\nixr = np.clip(np.ceil(xpos / dx), 1, nx - 1).astype(np.int64)\nfrac = ixr - xpos / dx\nself.ixr = torch.from_numpy(ixr).long().to(device)\nself.frac = torch.from_numpy(frac)...
<|body_start_0|> nx = config['nx'] dx = config['dx'] xbgn, _ = config['x_limits'] x_r = np.asarray(config['x_r']) self.nrec = len(x_r) xpos = x_r - xbgn ixr = np.clip(np.ceil(xpos / dx), 1, nx - 1).astype(np.int64) frac = ixr - xpos / dx self.ixr =...
Receivers
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Receivers: def __init__(self, config): """Configures interpolation of receivers in sampling grid""" <|body_0|> def sample(self, u): """Interpolates amplitude at each receiver point for current time""" <|body_1|> <|end_skeleton|> <|body_start_0|> nx ...
stack_v2_sparse_classes_36k_train_030995
20,893
no_license
[ { "docstring": "Configures interpolation of receivers in sampling grid", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Interpolates amplitude at each receiver point for current time", "name": "sample", "signature": "def sample(self, u)" } ]
2
stack_v2_sparse_classes_30k_train_004889
Implement the Python class `Receivers` described below. Class description: Implement the Receivers class. Method signatures and docstrings: - def __init__(self, config): Configures interpolation of receivers in sampling grid - def sample(self, u): Interpolates amplitude at each receiver point for current time
Implement the Python class `Receivers` described below. Class description: Implement the Receivers class. Method signatures and docstrings: - def __init__(self, config): Configures interpolation of receivers in sampling grid - def sample(self, u): Interpolates amplitude at each receiver point for current time <|skel...
b7477f7659126da69b9a1bab0377f12c595ffbfb
<|skeleton|> class Receivers: def __init__(self, config): """Configures interpolation of receivers in sampling grid""" <|body_0|> def sample(self, u): """Interpolates amplitude at each receiver point for current time""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Receivers: def __init__(self, config): """Configures interpolation of receivers in sampling grid""" nx = config['nx'] dx = config['dx'] xbgn, _ = config['x_limits'] x_r = np.asarray(config['x_r']) self.nrec = len(x_r) xpos = x_r - xbgn ixr = np.c...
the_stack_v2_python_sparse
fwi-dl/Wave1D_AGfunc.py
lhuang-pvamu/pytorch-examples
train
1
062aaa0efecafac8e8ea4d32d8801c2602edb756
[ "if stamp is None or stamp.size == 0:\n return\nstamp_width = stamp.shape[0]\nif len(stamp.shape) == 1:\n stamp_width = int(math.sqrt(stamp.shape[0]))\nif stamp.size != stamp_width * stamp_width:\n raise ValueError('Expected square stamp, but found {stamp.shape}')\nif axes is None:\n fig = plt.figure()\...
<|body_start_0|> if stamp is None or stamp.size == 0: return stamp_width = stamp.shape[0] if len(stamp.shape) == 1: stamp_width = int(math.sqrt(stamp.shape[0])) if stamp.size != stamp_width * stamp_width: raise ValueError('Expected square stamp, but fo...
ResultsVisualizer
[ "BSD-2-Clause-Views", "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResultsVisualizer: def plot_single_stamp(stamp, axes=None): """Plot a single stamp image. Parameters ---------- stamp : np.array The numpy array containing the stamp's pixel values. axes : matplotlib.axes.Axes The axes on which to draw the figure.""" <|body_0|> def plot_stam...
stack_v2_sparse_classes_36k_train_030996
5,463
permissive
[ { "docstring": "Plot a single stamp image. Parameters ---------- stamp : np.array The numpy array containing the stamp's pixel values. axes : matplotlib.axes.Axes The axes on which to draw the figure.", "name": "plot_single_stamp", "signature": "def plot_single_stamp(stamp, axes=None)" }, { "doc...
4
stack_v2_sparse_classes_30k_train_021655
Implement the Python class `ResultsVisualizer` described below. Class description: Implement the ResultsVisualizer class. Method signatures and docstrings: - def plot_single_stamp(stamp, axes=None): Plot a single stamp image. Parameters ---------- stamp : np.array The numpy array containing the stamp's pixel values. ...
Implement the Python class `ResultsVisualizer` described below. Class description: Implement the ResultsVisualizer class. Method signatures and docstrings: - def plot_single_stamp(stamp, axes=None): Plot a single stamp image. Parameters ---------- stamp : np.array The numpy array containing the stamp's pixel values. ...
94cb6d75c139de8fbd03082e3b533e50cccefc0b
<|skeleton|> class ResultsVisualizer: def plot_single_stamp(stamp, axes=None): """Plot a single stamp image. Parameters ---------- stamp : np.array The numpy array containing the stamp's pixel values. axes : matplotlib.axes.Axes The axes on which to draw the figure.""" <|body_0|> def plot_stam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResultsVisualizer: def plot_single_stamp(stamp, axes=None): """Plot a single stamp image. Parameters ---------- stamp : np.array The numpy array containing the stamp's pixel values. axes : matplotlib.axes.Axes The axes on which to draw the figure.""" if stamp is None or stamp.size == 0: ...
the_stack_v2_python_sparse
src/kbmod/analysis/plot_results.py
dirac-institute/kbmod
train
27
52766b63250e46f75fe96371732b49b2efd7345b
[ "if self.request.user.has_perm('account.view_user'):\n return True\nif self.request.user.has_perm('account.backup'):\n return True\nif self.request.user.has_perm('account.restore'):\n return True\nif self.request.user.has_perm('account.export'):\n return True\nif self.request.user.has_perm('account.impo...
<|body_start_0|> if self.request.user.has_perm('account.view_user'): return True if self.request.user.has_perm('account.backup'): return True if self.request.user.has_perm('account.restore'): return True if self.request.user.has_perm('account.export'):...
View for account index page
Index
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Index: """View for account index page""" def test_func(self): """Check if user ownership""" <|body_0|> def get_context_data(self, *, object_list=None, **kwargs): """Get the context for this view.""" <|body_1|> <|end_skeleton|> <|body_start_0|> i...
stack_v2_sparse_classes_36k_train_030997
20,739
permissive
[ { "docstring": "Check if user ownership", "name": "test_func", "signature": "def test_func(self)" }, { "docstring": "Get the context for this view.", "name": "get_context_data", "signature": "def get_context_data(self, *, object_list=None, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_004807
Implement the Python class `Index` described below. Class description: View for account index page Method signatures and docstrings: - def test_func(self): Check if user ownership - def get_context_data(self, *, object_list=None, **kwargs): Get the context for this view.
Implement the Python class `Index` described below. Class description: View for account index page Method signatures and docstrings: - def test_func(self): Check if user ownership - def get_context_data(self, *, object_list=None, **kwargs): Get the context for this view. <|skeleton|> class Index: """View for acc...
f3f8354bf164fcfe86d597cdbc28b0e3b7b73bd1
<|skeleton|> class Index: """View for account index page""" def test_func(self): """Check if user ownership""" <|body_0|> def get_context_data(self, *, object_list=None, **kwargs): """Get the context for this view.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Index: """View for account index page""" def test_func(self): """Check if user ownership""" if self.request.user.has_perm('account.view_user'): return True if self.request.user.has_perm('account.backup'): return True if self.request.user.has_perm('a...
the_stack_v2_python_sparse
seshat/account/views.py
XecusM/SESHAT
train
0
033a891127ba7aff9a2d1c7a6acfcd83bd40db47
[ "user_obj = request.user\nfm_cls = lookup_file_manager(resource)\nif fm_cls:\n return fm_cls(user_obj, **kwargs)", "fm = self._get_file_manager(request, **kwargs)\nop = getattr(fm, operation)\ntry:\n body_json = json.loads(request.body)\nexcept ValueError:\n body_json = {}\nd = body_json\nd.update(kwargs...
<|body_start_0|> user_obj = request.user fm_cls = lookup_file_manager(resource) if fm_cls: return fm_cls(user_obj, **kwargs) <|end_body_0|> <|body_start_1|> fm = self._get_file_manager(request, **kwargs) op = getattr(fm, operation) try: body_json ...
Base View which instatiates corresponding file manager and execute correct operation.
BaseDataView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseDataView: """Base View which instatiates corresponding file manager and execute correct operation.""" def _get_file_manager(self, request, resource, **kwargs): """Instantiates the correct file manager class Args: request: Request object. Used to get the user object. resource: Res...
stack_v2_sparse_classes_36k_train_030998
7,492
no_license
[ { "docstring": "Instantiates the correct file manager class Args: request: Request object. Used to get the user object. resource: Resource name to decide which class to instantiate.", "name": "_get_file_manager", "signature": "def _get_file_manager(self, request, resource, **kwargs)" }, { "docst...
3
null
Implement the Python class `BaseDataView` described below. Class description: Base View which instatiates corresponding file manager and execute correct operation. Method signatures and docstrings: - def _get_file_manager(self, request, resource, **kwargs): Instantiates the correct file manager class Args: request: R...
Implement the Python class `BaseDataView` described below. Class description: Base View which instatiates corresponding file manager and execute correct operation. Method signatures and docstrings: - def _get_file_manager(self, request, resource, **kwargs): Instantiates the correct file manager class Args: request: R...
fa96bae001cf95e198fb3f8c388b8505086230d5
<|skeleton|> class BaseDataView: """Base View which instatiates corresponding file manager and execute correct operation.""" def _get_file_manager(self, request, resource, **kwargs): """Instantiates the correct file manager class Args: request: Request object. Used to get the user object. resource: Res...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseDataView: """Base View which instatiates corresponding file manager and execute correct operation.""" def _get_file_manager(self, request, resource, **kwargs): """Instantiates the correct file manager class Args: request: Request object. Used to get the user object. resource: Resource name to...
the_stack_v2_python_sparse
designsafe/apps/api/data/views.py
climberfields/portal
train
2
b8066e3fb1e3ec7236a3cb3027cd872401134acc
[ "self.gateway_url = 'https://api.telerivet.com/v1/projects/%s/messages/send' % config.get('project_id')\nself.api_key = config.get('api_key')\nself.route_id = config.get('route_id')\nself.priority = config.get('priority')", "gateway_params = {'to_number': recipient, 'content': text}\ngateway_params.update(dict([(...
<|body_start_0|> self.gateway_url = 'https://api.telerivet.com/v1/projects/%s/messages/send' % config.get('project_id') self.api_key = config.get('api_key') self.route_id = config.get('route_id') self.priority = config.get('priority') <|end_body_0|> <|body_start_1|> gateway_para...
Telerivet Gateway class
TelerivetGateway
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TelerivetGateway: """Telerivet Gateway class""" def __init__(self, config): """initializes the kannel gateway object :param config: The configuration object obtained from the app settings""" <|body_0|> def send(self, text, recipient, sender=''): """Sends the mess...
stack_v2_sparse_classes_36k_train_030999
3,492
no_license
[ { "docstring": "initializes the kannel gateway object :param config: The configuration object obtained from the app settings", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Sends the message to the specified recipients using this gateway :param text: Contents o...
2
null
Implement the Python class `TelerivetGateway` described below. Class description: Telerivet Gateway class Method signatures and docstrings: - def __init__(self, config): initializes the kannel gateway object :param config: The configuration object obtained from the app settings - def send(self, text, recipient, sende...
Implement the Python class `TelerivetGateway` described below. Class description: Telerivet Gateway class Method signatures and docstrings: - def __init__(self, config): initializes the kannel gateway object :param config: The configuration object obtained from the app settings - def send(self, text, recipient, sende...
e071b05b6122a756313c561643d343fa4d23b097
<|skeleton|> class TelerivetGateway: """Telerivet Gateway class""" def __init__(self, config): """initializes the kannel gateway object :param config: The configuration object obtained from the app settings""" <|body_0|> def send(self, text, recipient, sender=''): """Sends the mess...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TelerivetGateway: """Telerivet Gateway class""" def __init__(self, config): """initializes the kannel gateway object :param config: The configuration object obtained from the app settings""" self.gateway_url = 'https://api.telerivet.com/v1/projects/%s/messages/send' % config.get('project_...
the_stack_v2_python_sparse
apollo/messaging/outgoing.py
Ismail774403783/apollo
train
0