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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
61106e8de673ddc0d96a74e3bc887fc5d10b1d80 | [
"if isinstance(key, int):\n return TransType(key)\nif key not in TransType._member_map_:\n extend_enum(TransType, key, default)\nreturn TransType[key]",
"if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 144 <= value <= 252:\n ... | <|body_start_0|>
if isinstance(key, int):
return TransType(key)
if key not in TransType._member_map_:
extend_enum(TransType, key, default)
return TransType[key]
<|end_body_0|>
<|body_start_1|>
if not (isinstance(value, int) and 0 <= value <= 255):
rai... | [TransType] Transport Layer Protocol Numbers | TransType | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransType:
"""[TransType] Transport Layer Protocol Numbers"""
def get(key, default=-1):
"""Backport support for original codes."""
<|body_0|>
def _missing_(cls, value):
"""Lookup function used when value is not found."""
<|body_1|>
<|end_skeleton|>
<|bo... | stack_v2_sparse_classes_36k_train_030000 | 12,333 | permissive | [
{
"docstring": "Backport support for original codes.",
"name": "get",
"signature": "def get(key, default=-1)"
},
{
"docstring": "Lookup function used when value is not found.",
"name": "_missing_",
"signature": "def _missing_(cls, value)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000418 | Implement the Python class `TransType` described below.
Class description:
[TransType] Transport Layer Protocol Numbers
Method signatures and docstrings:
- def get(key, default=-1): Backport support for original codes.
- def _missing_(cls, value): Lookup function used when value is not found. | Implement the Python class `TransType` described below.
Class description:
[TransType] Transport Layer Protocol Numbers
Method signatures and docstrings:
- def get(key, default=-1): Backport support for original codes.
- def _missing_(cls, value): Lookup function used when value is not found.
<|skeleton|>
class Tran... | 90cd07d67df28d5c5ab0585bc60f467a78d9db33 | <|skeleton|>
class TransType:
"""[TransType] Transport Layer Protocol Numbers"""
def get(key, default=-1):
"""Backport support for original codes."""
<|body_0|>
def _missing_(cls, value):
"""Lookup function used when value is not found."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TransType:
"""[TransType] Transport Layer Protocol Numbers"""
def get(key, default=-1):
"""Backport support for original codes."""
if isinstance(key, int):
return TransType(key)
if key not in TransType._member_map_:
extend_enum(TransType, key, default)
... | the_stack_v2_python_sparse | pcapkit/const/reg/transtype.py | stjordanis/PyPCAPKit | train | 0 |
606538c813ed3dfe3ca6e3f8429d798e41cfe229 | [
"data: StrDict = dict(type='SetFreeCamera')\ndata['pos'] = pos\ndata['dir'] = direction\nself._send(data).ack('FreeCameraSet')",
"data: StrDict = dict(type='SetRelativeCam')\ndata['pos'] = pos\nif rot_quat:\n data['rot'] = rot_quat\nself._send(data).ack('RelativeCamSet')",
"data: StrDict = dict(type='SetPlay... | <|body_start_0|>
data: StrDict = dict(type='SetFreeCamera')
data['pos'] = pos
data['dir'] = direction
self._send(data).ack('FreeCameraSet')
<|end_body_0|>
<|body_start_1|>
data: StrDict = dict(type='SetRelativeCam')
data['pos'] = pos
if rot_quat:
data... | An API class which allows control of the in-game camera and also provides information about the semantic annotation classes. Args: beamng: An instance of the simulator. | CameraApi | [
"MIT",
"LicenseRef-scancode-proprietary-license",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CameraApi:
"""An API class which allows control of the in-game camera and also provides information about the semantic annotation classes. Args: beamng: An instance of the simulator."""
def set_free(self, pos: Float3, direction: Float3) -> None:
"""Sets the position and direction of ... | stack_v2_sparse_classes_36k_train_030001 | 5,399 | permissive | [
{
"docstring": "Sets the position and direction of the free camera. The free camera is one that does not follow any particular vehicle, but can instead be put at any spot and any position on the map. Args: pos: The position of the camera as a (x, y, z) triplet. direction: The directional vector of the camera as... | 6 | null | Implement the Python class `CameraApi` described below.
Class description:
An API class which allows control of the in-game camera and also provides information about the semantic annotation classes. Args: beamng: An instance of the simulator.
Method signatures and docstrings:
- def set_free(self, pos: Float3, direct... | Implement the Python class `CameraApi` described below.
Class description:
An API class which allows control of the in-game camera and also provides information about the semantic annotation classes. Args: beamng: An instance of the simulator.
Method signatures and docstrings:
- def set_free(self, pos: Float3, direct... | 656b09c8b08e0a46a84561f52a6cc54b88710948 | <|skeleton|>
class CameraApi:
"""An API class which allows control of the in-game camera and also provides information about the semantic annotation classes. Args: beamng: An instance of the simulator."""
def set_free(self, pos: Float3, direction: Float3) -> None:
"""Sets the position and direction of ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CameraApi:
"""An API class which allows control of the in-game camera and also provides information about the semantic annotation classes. Args: beamng: An instance of the simulator."""
def set_free(self, pos: Float3, direction: Float3) -> None:
"""Sets the position and direction of the free came... | the_stack_v2_python_sparse | src/beamngpy/api/beamng/camera.py | BeamNG/BeamNGpy | train | 235 |
2b718cd6dbb5d396e2c566ce23abf2c9bf2de137 | [
"n = len(array)\ni, j = (0, 0)\ncurr_ones = 0\nmax_ones = 0\nwhile j < n:\n if array[j]:\n curr_ones += 1\n j += 1\n max_ones = max(max_ones, curr_ones)\n elif not array[j] and m > 0:\n curr_ones += 1\n m -= 1\n j += 1\n max_ones = max(max_ones, curr_ones)\n ... | <|body_start_0|>
n = len(array)
i, j = (0, 0)
curr_ones = 0
max_ones = 0
while j < n:
if array[j]:
curr_ones += 1
j += 1
max_ones = max(max_ones, curr_ones)
elif not array[j] and m > 0:
curr_o... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def max_ones_length(self, array, m):
"""Returns count of maximum consecutive ones that can be achieved by flipping m zeroes. Time complexity: O(n). Space complexity: O(1), n is len(array)."""
<|body_0|>
def max_ones_seq(self, array, m):
"""Returns indices o... | stack_v2_sparse_classes_36k_train_030002 | 2,867 | no_license | [
{
"docstring": "Returns count of maximum consecutive ones that can be achieved by flipping m zeroes. Time complexity: O(n). Space complexity: O(1), n is len(array).",
"name": "max_ones_length",
"signature": "def max_ones_length(self, array, m)"
},
{
"docstring": "Returns indices of longest seque... | 2 | stack_v2_sparse_classes_30k_train_016866 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def max_ones_length(self, array, m): Returns count of maximum consecutive ones that can be achieved by flipping m zeroes. Time complexity: O(n). Space complexity: O(1), n is len(... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def max_ones_length(self, array, m): Returns count of maximum consecutive ones that can be achieved by flipping m zeroes. Time complexity: O(n). Space complexity: O(1), n is len(... | 71b722ddfe8da04572e527b055cf8723d5c87bbf | <|skeleton|>
class Solution:
def max_ones_length(self, array, m):
"""Returns count of maximum consecutive ones that can be achieved by flipping m zeroes. Time complexity: O(n). Space complexity: O(1), n is len(array)."""
<|body_0|>
def max_ones_seq(self, array, m):
"""Returns indices o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def max_ones_length(self, array, m):
"""Returns count of maximum consecutive ones that can be achieved by flipping m zeroes. Time complexity: O(n). Space complexity: O(1), n is len(array)."""
n = len(array)
i, j = (0, 0)
curr_ones = 0
max_ones = 0
whil... | the_stack_v2_python_sparse | Arrays/max_consecutive_ones.py | vladn90/Algorithms | train | 0 | |
68a410420663d7efb491778e748b31fdac7ce3fa | [
"filters = {}\nif hasattr(request, 'GET'):\n filters = request.GET.copy()\nfilters.update(kwargs)\nif 'community' in filters:\n try:\n community = Community.objects.get(uuid=uuid_from_uri(filters['community']))\n im = community.image_set.filter(is_active=True)\n wb = community.wordbox_set... | <|body_start_0|>
filters = {}
if hasattr(request, 'GET'):
filters = request.GET.copy()
filters.update(kwargs)
if 'community' in filters:
try:
community = Community.objects.get(uuid=uuid_from_uri(filters['community']))
im = community... | MediaResource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MediaResource:
def obj_get_list(self, request=None, **kwargs):
"""A ORM-specific implementation of ``obj_get_list``. Takes an optional ``request`` object, whose ``GET`` dictionary can be used to narrow the query."""
<|body_0|>
def full_dehydrate(self, bundle):
"""Giv... | stack_v2_sparse_classes_36k_train_030003 | 30,895 | no_license | [
{
"docstring": "A ORM-specific implementation of ``obj_get_list``. Takes an optional ``request`` object, whose ``GET`` dictionary can be used to narrow the query.",
"name": "obj_get_list",
"signature": "def obj_get_list(self, request=None, **kwargs)"
},
{
"docstring": "Given a bundle with an obj... | 2 | stack_v2_sparse_classes_30k_train_001796 | Implement the Python class `MediaResource` described below.
Class description:
Implement the MediaResource class.
Method signatures and docstrings:
- def obj_get_list(self, request=None, **kwargs): A ORM-specific implementation of ``obj_get_list``. Takes an optional ``request`` object, whose ``GET`` dictionary can be... | Implement the Python class `MediaResource` described below.
Class description:
Implement the MediaResource class.
Method signatures and docstrings:
- def obj_get_list(self, request=None, **kwargs): A ORM-specific implementation of ``obj_get_list``. Takes an optional ``request`` object, whose ``GET`` dictionary can be... | 698e027b7f6f4db5c2e9b9a899ba74f4ad4daf8e | <|skeleton|>
class MediaResource:
def obj_get_list(self, request=None, **kwargs):
"""A ORM-specific implementation of ``obj_get_list``. Takes an optional ``request`` object, whose ``GET`` dictionary can be used to narrow the query."""
<|body_0|>
def full_dehydrate(self, bundle):
"""Giv... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MediaResource:
def obj_get_list(self, request=None, **kwargs):
"""A ORM-specific implementation of ``obj_get_list``. Takes an optional ``request`` object, whose ``GET`` dictionary can be used to narrow the query."""
filters = {}
if hasattr(request, 'GET'):
filters = request... | the_stack_v2_python_sparse | back-end/website/api/v1/media_resources.py | dchang00/keekaa-back-end | train | 0 | |
3a754953d80565e4610a3fb0ea76a8ca4e767d99 | [
"super().__init__()\nself.cfg = cfg\nself.task_queue = task_queue\nself.result_queue = result_queue\nself.gpu_id = gpu_id\nself.device = torch.device(f'npu:{NPU_CALCULATE_DEVICE}') if self.cfg.NUM_GPUS else 'cpu'",
"model = Predictor(self.cfg, gpu_id=self.gpu_id)\nwhile True:\n task = self.task_queue.get()\n ... | <|body_start_0|>
super().__init__()
self.cfg = cfg
self.task_queue = task_queue
self.result_queue = result_queue
self.gpu_id = gpu_id
self.device = torch.device(f'npu:{NPU_CALCULATE_DEVICE}') if self.cfg.NUM_GPUS else 'cpu'
<|end_body_0|>
<|body_start_1|>
model =... | _Predictor | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference",
"GPL-1.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _Predictor:
def __init__(self, cfg, task_queue, result_queue, gpu_id=None):
"""Predict Worker for Detectron2. Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py task_queue (mp.Queue): a shared queue for incoming task. result_queue (mp.Queue): a shared queue... | stack_v2_sparse_classes_36k_train_030004 | 11,834 | permissive | [
{
"docstring": "Predict Worker for Detectron2. Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py task_queue (mp.Queue): a shared queue for incoming task. result_queue (mp.Queue): a shared queue for predicted results. gpu_id (int): index of the GPU device for the current child pro... | 2 | null | Implement the Python class `_Predictor` described below.
Class description:
Implement the _Predictor class.
Method signatures and docstrings:
- def __init__(self, cfg, task_queue, result_queue, gpu_id=None): Predict Worker for Detectron2. Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.... | Implement the Python class `_Predictor` described below.
Class description:
Implement the _Predictor class.
Method signatures and docstrings:
- def __init__(self, cfg, task_queue, result_queue, gpu_id=None): Predict Worker for Detectron2. Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.... | 92acc188d3a0f634de58463b6676e70df83ef808 | <|skeleton|>
class _Predictor:
def __init__(self, cfg, task_queue, result_queue, gpu_id=None):
"""Predict Worker for Detectron2. Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py task_queue (mp.Queue): a shared queue for incoming task. result_queue (mp.Queue): a shared queue... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _Predictor:
def __init__(self, cfg, task_queue, result_queue, gpu_id=None):
"""Predict Worker for Detectron2. Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py task_queue (mp.Queue): a shared queue for incoming task. result_queue (mp.Queue): a shared queue for predicted... | the_stack_v2_python_sparse | PyTorch/dev/cv/image_classification/SlowFast_ID0646_for_PyTorch/slowfast/visualization/async_predictor.py | Ascend/ModelZoo-PyTorch | train | 23 | |
2c5069ee8fdb431f2c3e01e7464edd3736b1a48d | [
"params = kwarg['params']\ncmd = 'ip neigh {} '.format(command)\nif 'address' in params:\n cmd += '{} '.format(params['address'])\nif 'lladdr' in params:\n cmd += 'lladdr {} '.format(params['lladdr'])\nif 'nud' in params:\n cmd += 'nud {} '.format(params['nud'])\nif 'proxy' in params:\n cmd += 'proxy {}... | <|body_start_0|>
params = kwarg['params']
cmd = 'ip neigh {} '.format(command)
if 'address' in params:
cmd += '{} '.format(params['address'])
if 'lladdr' in params:
cmd += 'lladdr {} '.format(params['lladdr'])
if 'nud' in params:
cmd += 'nud {}... | LinuxIpNeighborImpl | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinuxIpNeighborImpl:
def format_modify(self, command, *argv, **kwarg):
"""ip neigh { add | del | change | replace } { ADDR [ lladdr LLADDR ] [ nud { permanent | noarp | stale | reachable } ] | proxy ADDR } [ dev DEV ]"""
<|body_0|>
def format_show(self, command, *argv, **kwa... | stack_v2_sparse_classes_36k_train_030005 | 1,569 | permissive | [
{
"docstring": "ip neigh { add | del | change | replace } { ADDR [ lladdr LLADDR ] [ nud { permanent | noarp | stale | reachable } ] | proxy ADDR } [ dev DEV ]",
"name": "format_modify",
"signature": "def format_modify(self, command, *argv, **kwarg)"
},
{
"docstring": "ip neigh { show | flush } ... | 2 | stack_v2_sparse_classes_30k_train_011000 | Implement the Python class `LinuxIpNeighborImpl` described below.
Class description:
Implement the LinuxIpNeighborImpl class.
Method signatures and docstrings:
- def format_modify(self, command, *argv, **kwarg): ip neigh { add | del | change | replace } { ADDR [ lladdr LLADDR ] [ nud { permanent | noarp | stale | rea... | Implement the Python class `LinuxIpNeighborImpl` described below.
Class description:
Implement the LinuxIpNeighborImpl class.
Method signatures and docstrings:
- def format_modify(self, command, *argv, **kwarg): ip neigh { add | del | change | replace } { ADDR [ lladdr LLADDR ] [ nud { permanent | noarp | stale | rea... | e4c8221e18cd94e7424c30e12eb0fb82f7767267 | <|skeleton|>
class LinuxIpNeighborImpl:
def format_modify(self, command, *argv, **kwarg):
"""ip neigh { add | del | change | replace } { ADDR [ lladdr LLADDR ] [ nud { permanent | noarp | stale | reachable } ] | proxy ADDR } [ dev DEV ]"""
<|body_0|>
def format_show(self, command, *argv, **kwa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinuxIpNeighborImpl:
def format_modify(self, command, *argv, **kwarg):
"""ip neigh { add | del | change | replace } { ADDR [ lladdr LLADDR ] [ nud { permanent | noarp | stale | reachable } ] | proxy ADDR } [ dev DEV ]"""
params = kwarg['params']
cmd = 'ip neigh {} '.format(command)
... | the_stack_v2_python_sparse | Amazon_Framework/DentOsTestbedLib/src/dent_os_testbed/lib/ip/linux/linux_ip_neighbor_impl.py | tld3daniel/testing | train | 0 | |
e0144f7becef9a723925fe45456472320060c585 | [
"data = parse(filename)\nscore = 0\nfor line in data:\n score += corrupted_score(line)\nreturn score",
"data = parse(filename)\nvalid_data = []\nscores = []\nfor line in data:\n if corrupted_score(line) > 0:\n continue\n score = complete(line)\n scores.append(score)\nscores = sorted(scores)\nre... | <|body_start_0|>
data = parse(filename)
score = 0
for line in data:
score += corrupted_score(line)
return score
<|end_body_0|>
<|body_start_1|>
data = parse(filename)
valid_data = []
scores = []
for line in data:
if corrupted_score... | AoC 2021 Day 10 | Day10 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Day10:
"""AoC 2021 Day 10"""
def part1(filename: str) -> int:
"""Given a filename, solve 2021 day 10 part 1"""
<|body_0|>
def part2(filename: str) -> int:
"""Given a filename, solve 2021 day 10 part 2"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_030006 | 2,081 | no_license | [
{
"docstring": "Given a filename, solve 2021 day 10 part 1",
"name": "part1",
"signature": "def part1(filename: str) -> int"
},
{
"docstring": "Given a filename, solve 2021 day 10 part 2",
"name": "part2",
"signature": "def part2(filename: str) -> int"
}
] | 2 | null | Implement the Python class `Day10` described below.
Class description:
AoC 2021 Day 10
Method signatures and docstrings:
- def part1(filename: str) -> int: Given a filename, solve 2021 day 10 part 1
- def part2(filename: str) -> int: Given a filename, solve 2021 day 10 part 2 | Implement the Python class `Day10` described below.
Class description:
AoC 2021 Day 10
Method signatures and docstrings:
- def part1(filename: str) -> int: Given a filename, solve 2021 day 10 part 1
- def part2(filename: str) -> int: Given a filename, solve 2021 day 10 part 2
<|skeleton|>
class Day10:
"""AoC 202... | e89db235837d2d05848210a18c9c2a4456085570 | <|skeleton|>
class Day10:
"""AoC 2021 Day 10"""
def part1(filename: str) -> int:
"""Given a filename, solve 2021 day 10 part 1"""
<|body_0|>
def part2(filename: str) -> int:
"""Given a filename, solve 2021 day 10 part 2"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Day10:
"""AoC 2021 Day 10"""
def part1(filename: str) -> int:
"""Given a filename, solve 2021 day 10 part 1"""
data = parse(filename)
score = 0
for line in data:
score += corrupted_score(line)
return score
def part2(filename: str) -> int:
"... | the_stack_v2_python_sparse | 2021/python2021/aoc/day10.py | mreishus/aoc | train | 16 |
5733953116584b38c29720e87e60aed7331a636a | [
"self.name = name\nself.yMin = index * 1.1\nself.yMax = yMax\nself.x = [0]\nself.xBase = [0]\nself.y = [self.yMin]\nself.yBase = [self.yMin]\nself.state = 0\nself.yPrev = 0\nself.xPrev = 0\nself.sig = pw.plot(pen=color, name=self.name)\nself.sig.setData(self.x, self.y)\nself.base = pw.plot(pen=color)\nself.base.set... | <|body_start_0|>
self.name = name
self.yMin = index * 1.1
self.yMax = yMax
self.x = [0]
self.xBase = [0]
self.y = [self.yMin]
self.yBase = [self.yMin]
self.state = 0
self.yPrev = 0
self.xPrev = 0
self.sig = pw.plot(pen=color, name=s... | IntCurve | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IntCurve:
def __init__(self, name, index, color, yMax, pw):
"""Args: name: [int] the handle for the curve index: [int] index for the trace we want to manipulate color: [Qt variable] trace color assigned by the name yMax: [int] may Y range pw: [Qt object] Qt PLot Widget"""
<|body_... | stack_v2_sparse_classes_36k_train_030007 | 11,411 | no_license | [
{
"docstring": "Args: name: [int] the handle for the curve index: [int] index for the trace we want to manipulate color: [Qt variable] trace color assigned by the name yMax: [int] may Y range pw: [Qt object] Qt PLot Widget",
"name": "__init__",
"signature": "def __init__(self, name, index, color, yMax, ... | 3 | null | Implement the Python class `IntCurve` described below.
Class description:
Implement the IntCurve class.
Method signatures and docstrings:
- def __init__(self, name, index, color, yMax, pw): Args: name: [int] the handle for the curve index: [int] index for the trace we want to manipulate color: [Qt variable] trace col... | Implement the Python class `IntCurve` described below.
Class description:
Implement the IntCurve class.
Method signatures and docstrings:
- def __init__(self, name, index, color, yMax, pw): Args: name: [int] the handle for the curve index: [int] index for the trace we want to manipulate color: [Qt variable] trace col... | 30b10c2d3f17909b437cd57b0325d8b4ba6929b8 | <|skeleton|>
class IntCurve:
def __init__(self, name, index, color, yMax, pw):
"""Args: name: [int] the handle for the curve index: [int] index for the trace we want to manipulate color: [Qt variable] trace color assigned by the name yMax: [int] may Y range pw: [Qt object] Qt PLot Widget"""
<|body_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IntCurve:
def __init__(self, name, index, color, yMax, pw):
"""Args: name: [int] the handle for the curve index: [int] index for the trace we want to manipulate color: [Qt variable] trace color assigned by the name yMax: [int] may Y range pw: [Qt object] Qt PLot Widget"""
self.name = name
... | the_stack_v2_python_sparse | ShrewDriver/ui/live_plot_2AFC.py | msarvestani/shrewdriver | train | 2 | |
a8391d3f203bf47ff321870d6e6c860562ccfbf3 | [
"super(ExtensionClient, self).__init__(serialize_format, deserialize_format)\nself.auth_token = auth_token\nself.default_headers['X-Auth-Token'] = auth_token\nct = '{content_type}/{content_subtype}'.format(content_type='application', content_subtype=self.serialize_format)\naccept = '{content_type}/{content_subtype}... | <|body_start_0|>
super(ExtensionClient, self).__init__(serialize_format, deserialize_format)
self.auth_token = auth_token
self.default_headers['X-Auth-Token'] = auth_token
ct = '{content_type}/{content_subtype}'.format(content_type='application', content_subtype=self.serialize_format)
... | ExtensionClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExtensionClient:
def __init__(self, url, auth_token, serialize_format=None, deserialize_format=None):
"""@param url: Base URL for the compute service @type url: String @param auth_token: Auth token to be used for all requests @type auth_token: String @param serialize_format: Format for s... | stack_v2_sparse_classes_36k_train_030008 | 2,383 | permissive | [
{
"docstring": "@param url: Base URL for the compute service @type url: String @param auth_token: Auth token to be used for all requests @type auth_token: String @param serialize_format: Format for serializing requests @type serialize_format: String @param deserialize_format: Format for de-serializing responses... | 2 | stack_v2_sparse_classes_30k_train_002652 | Implement the Python class `ExtensionClient` described below.
Class description:
Implement the ExtensionClient class.
Method signatures and docstrings:
- def __init__(self, url, auth_token, serialize_format=None, deserialize_format=None): @param url: Base URL for the compute service @type url: String @param auth_toke... | Implement the Python class `ExtensionClient` described below.
Class description:
Implement the ExtensionClient class.
Method signatures and docstrings:
- def __init__(self, url, auth_token, serialize_format=None, deserialize_format=None): @param url: Base URL for the compute service @type url: String @param auth_toke... | 7d49cf6bfd7e1a6e5b739e7de52f2e18e5ccf924 | <|skeleton|>
class ExtensionClient:
def __init__(self, url, auth_token, serialize_format=None, deserialize_format=None):
"""@param url: Base URL for the compute service @type url: String @param auth_token: Auth token to be used for all requests @type auth_token: String @param serialize_format: Format for s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExtensionClient:
def __init__(self, url, auth_token, serialize_format=None, deserialize_format=None):
"""@param url: Base URL for the compute service @type url: String @param auth_token: Auth token to be used for all requests @type auth_token: String @param serialize_format: Format for serializing req... | the_stack_v2_python_sparse | cloudcafe/compute/extensions/extensions_api/clients/extensions_client.py | kurhula/cloudcafe | train | 0 | |
c313c90d6589fc0b615c558199a66f4191796ce0 | [
"nums.sort()\nif len(nums) > 2:\n n = 1\n while n < len(nums) - 1:\n nums[n], nums[n + 1] = (nums[n + 1], nums[n])\n n += 2",
"for i in range(1, len(nums), 2):\n if nums[i] < nums[i - 1]:\n nums[i], nums[i - 1] = (nums[i - 1], nums[i])\n if i + 1 < len(nums) and nums[i] < nums[i +... | <|body_start_0|>
nums.sort()
if len(nums) > 2:
n = 1
while n < len(nums) - 1:
nums[n], nums[n + 1] = (nums[n + 1], nums[n])
n += 2
<|end_body_0|>
<|body_start_1|>
for i in range(1, len(nums), 2):
if nums[i] < nums[i - 1]:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def wiggleSort(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def wiggleSort_II(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."... | stack_v2_sparse_classes_36k_train_030009 | 807 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.",
"name": "wiggleSort",
"signature": "def wiggleSort(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.",
"name": "wi... | 2 | stack_v2_sparse_classes_30k_val_000746 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wiggleSort(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def wiggleSort_II(self, nums): :type nums: List[int] :rtype... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wiggleSort(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def wiggleSort_II(self, nums): :type nums: List[int] :rtype... | 1461b10b8910fa90a311939c6df9082a8526f9b1 | <|skeleton|>
class Solution:
def wiggleSort(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def wiggleSort_II(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def wiggleSort(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
nums.sort()
if len(nums) > 2:
n = 1
while n < len(nums) - 1:
nums[n], nums[n + 1] = (nums[n + 1], nums[n])
... | the_stack_v2_python_sparse | Medium/280_wiggleSort.py | Yucheng7713/CodingPracticeByYuch | train | 0 | |
368b4caa18a8e9323e195fc6d75ba7d42abd44ee | [
"from dials.algorithms.background.simple import Constant2dModeller, Constant3dModeller, Creator, Linear2dModeller, Linear3dModeller, MosflmOutlierRejector, NormalOutlierRejector, NSigmaOutlierRejector, TruncatedOutlierRejector, TukeyOutlierRejector\n\ndef select_modeller():\n if model == 'constant2d':\n r... | <|body_start_0|>
from dials.algorithms.background.simple import Constant2dModeller, Constant3dModeller, Creator, Linear2dModeller, Linear3dModeller, MosflmOutlierRejector, NormalOutlierRejector, NSigmaOutlierRejector, TruncatedOutlierRejector, TukeyOutlierRejector
def select_modeller():
if ... | Class to do background subtraction. | BackgroundAlgorithm | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BackgroundAlgorithm:
"""Class to do background subtraction."""
def __init__(self, experiments, outlier='nsigma', model='constant3d', **kwargs):
"""Initialise the algorithm. :param experiments: The list of experiments :param outlier: The outlier rejection algorithm :param model: The b... | stack_v2_sparse_classes_36k_train_030010 | 5,905 | permissive | [
{
"docstring": "Initialise the algorithm. :param experiments: The list of experiments :param outlier: The outlier rejection algorithm :param model: The background model algorithm",
"name": "__init__",
"signature": "def __init__(self, experiments, outlier='nsigma', model='constant3d', **kwargs)"
},
{... | 2 | null | Implement the Python class `BackgroundAlgorithm` described below.
Class description:
Class to do background subtraction.
Method signatures and docstrings:
- def __init__(self, experiments, outlier='nsigma', model='constant3d', **kwargs): Initialise the algorithm. :param experiments: The list of experiments :param out... | Implement the Python class `BackgroundAlgorithm` described below.
Class description:
Class to do background subtraction.
Method signatures and docstrings:
- def __init__(self, experiments, outlier='nsigma', model='constant3d', **kwargs): Initialise the algorithm. :param experiments: The list of experiments :param out... | 88bf7f7c5ac44defc046ebf0719cde748092cfff | <|skeleton|>
class BackgroundAlgorithm:
"""Class to do background subtraction."""
def __init__(self, experiments, outlier='nsigma', model='constant3d', **kwargs):
"""Initialise the algorithm. :param experiments: The list of experiments :param outlier: The outlier rejection algorithm :param model: The b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BackgroundAlgorithm:
"""Class to do background subtraction."""
def __init__(self, experiments, outlier='nsigma', model='constant3d', **kwargs):
"""Initialise the algorithm. :param experiments: The list of experiments :param outlier: The outlier rejection algorithm :param model: The background mod... | the_stack_v2_python_sparse | src/dials/algorithms/background/simple/algorithm.py | dials/dials | train | 71 |
d751fe1efda16d763e8d80fc297607e5b97f0eb5 | [
"tools.validate_int(sequence_number, min=0, max=255, name='Block sequence counter')\nif data is not None and (not isinstance(data, bytes)):\n raise ValueError('data must be a bytes object')\nrequest = Request(service=cls)\nrequest.data = struct.pack('B', sequence_number)\nif data is not None:\n request.data +... | <|body_start_0|>
tools.validate_int(sequence_number, min=0, max=255, name='Block sequence counter')
if data is not None and (not isinstance(data, bytes)):
raise ValueError('data must be a bytes object')
request = Request(service=cls)
request.data = struct.pack('B', sequence_n... | TransferData | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransferData:
def make_request(cls, sequence_number: int, data: Optional[bytes]=None) -> Request:
"""Generates a request for TransferData :param sequence_number: Corresponds to an 8bit counter that should increment for each new block transferred. Allowed values are from 0 to 0xFF :type s... | stack_v2_sparse_classes_36k_train_030011 | 3,721 | permissive | [
{
"docstring": "Generates a request for TransferData :param sequence_number: Corresponds to an 8bit counter that should increment for each new block transferred. Allowed values are from 0 to 0xFF :type sequence_number: int :param data: Optional additional data to send to the server :type data: bytes :raises Val... | 2 | stack_v2_sparse_classes_30k_train_006787 | Implement the Python class `TransferData` described below.
Class description:
Implement the TransferData class.
Method signatures and docstrings:
- def make_request(cls, sequence_number: int, data: Optional[bytes]=None) -> Request: Generates a request for TransferData :param sequence_number: Corresponds to an 8bit co... | Implement the Python class `TransferData` described below.
Class description:
Implement the TransferData class.
Method signatures and docstrings:
- def make_request(cls, sequence_number: int, data: Optional[bytes]=None) -> Request: Generates a request for TransferData :param sequence_number: Corresponds to an 8bit co... | 1b93cc3cd0e09a21d48881ba53aed257f841bb89 | <|skeleton|>
class TransferData:
def make_request(cls, sequence_number: int, data: Optional[bytes]=None) -> Request:
"""Generates a request for TransferData :param sequence_number: Corresponds to an 8bit counter that should increment for each new block transferred. Allowed values are from 0 to 0xFF :type s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TransferData:
def make_request(cls, sequence_number: int, data: Optional[bytes]=None) -> Request:
"""Generates a request for TransferData :param sequence_number: Corresponds to an 8bit counter that should increment for each new block transferred. Allowed values are from 0 to 0xFF :type sequence_number... | the_stack_v2_python_sparse | udsoncan/services/TransferData.py | pylessard/python-udsoncan | train | 477 | |
3aa2285efd246c67c64029f79686255970282379 | [
"if len(num) <= k:\n return '0'\nelif k <= 0:\n return num\ncount = 0\nindex = 0\nnew_num = ''\nwhile index < len(num):\n if index + 1 < len(num) and int(num[index]) > int(num[index + 1]):\n index += 1\n count += 1\n while new_num and count < k and (num[index] == '0'):\n new... | <|body_start_0|>
if len(num) <= k:
return '0'
elif k <= 0:
return num
count = 0
index = 0
new_num = ''
while index < len(num):
if index + 1 < len(num) and int(num[index]) > int(num[index + 1]):
index += 1
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _removeKdigits(self, num, k):
""":type num: str :type k: int :rtype: str"""
<|body_0|>
def __removeKdigits(self, num, k):
""":type num: str :type k: int :rtype: str"""
<|body_1|>
def removeKdigits(self, num, k):
""":type num: str :t... | stack_v2_sparse_classes_36k_train_030012 | 14,768 | permissive | [
{
"docstring": ":type num: str :type k: int :rtype: str",
"name": "_removeKdigits",
"signature": "def _removeKdigits(self, num, k)"
},
{
"docstring": ":type num: str :type k: int :rtype: str",
"name": "__removeKdigits",
"signature": "def __removeKdigits(self, num, k)"
},
{
"docst... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _removeKdigits(self, num, k): :type num: str :type k: int :rtype: str
- def __removeKdigits(self, num, k): :type num: str :type k: int :rtype: str
- def removeKdigits(self, n... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _removeKdigits(self, num, k): :type num: str :type k: int :rtype: str
- def __removeKdigits(self, num, k): :type num: str :type k: int :rtype: str
- def removeKdigits(self, n... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _removeKdigits(self, num, k):
""":type num: str :type k: int :rtype: str"""
<|body_0|>
def __removeKdigits(self, num, k):
""":type num: str :type k: int :rtype: str"""
<|body_1|>
def removeKdigits(self, num, k):
""":type num: str :t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def _removeKdigits(self, num, k):
""":type num: str :type k: int :rtype: str"""
if len(num) <= k:
return '0'
elif k <= 0:
return num
count = 0
index = 0
new_num = ''
while index < len(num):
if index + 1 < len... | the_stack_v2_python_sparse | 402.remove-k-digits.py | windard/leeeeee | train | 0 | |
e0241a90482930b76a7320537c167a22fe8e5a28 | [
"if m < n:\n m, n = (n, m)\nwhile n:\n temp = m % n\n m, n = (n, temp)\nreturn m",
"while m != n:\n if m > n:\n m -= n\n elif m < n:\n n -= m\nreturn n"
] | <|body_start_0|>
if m < n:
m, n = (n, m)
while n:
temp = m % n
m, n = (n, temp)
return m
<|end_body_0|>
<|body_start_1|>
while m != n:
if m > n:
m -= n
elif m < n:
n -= m
return n
<|end_b... | 最大公约数 greatest common divisor: gcd(m,n) = k 最小公倍数 Least common multiple: lcm(m,n) = m*n*k 所以求最小公倍数 等于求最大公约数 | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""最大公约数 greatest common divisor: gcd(m,n) = k 最小公倍数 Least common multiple: lcm(m,n) = m*n*k 所以求最小公倍数 等于求最大公约数"""
def gcd(self, m, n):
"""辗转相除 对数级的时间复杂度"""
<|body_0|>
def gcd_(self, m, n):
"""更相减损"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_030013 | 730 | no_license | [
{
"docstring": "辗转相除 对数级的时间复杂度",
"name": "gcd",
"signature": "def gcd(self, m, n)"
},
{
"docstring": "更相减损",
"name": "gcd_",
"signature": "def gcd_(self, m, n)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
最大公约数 greatest common divisor: gcd(m,n) = k 最小公倍数 Least common multiple: lcm(m,n) = m*n*k 所以求最小公倍数 等于求最大公约数
Method signatures and docstrings:
- def gcd(self, m, n): 辗转相除 对数级的时间复杂度
- def gcd_(self, m, n): 更相减损 | Implement the Python class `Solution` described below.
Class description:
最大公约数 greatest common divisor: gcd(m,n) = k 最小公倍数 Least common multiple: lcm(m,n) = m*n*k 所以求最小公倍数 等于求最大公约数
Method signatures and docstrings:
- def gcd(self, m, n): 辗转相除 对数级的时间复杂度
- def gcd_(self, m, n): 更相减损
<|skeleton|>
class Solution:
"... | 57f303aa6e76f7c5292fa60bffdfddcb4ff9ddfb | <|skeleton|>
class Solution:
"""最大公约数 greatest common divisor: gcd(m,n) = k 最小公倍数 Least common multiple: lcm(m,n) = m*n*k 所以求最小公倍数 等于求最大公约数"""
def gcd(self, m, n):
"""辗转相除 对数级的时间复杂度"""
<|body_0|>
def gcd_(self, m, n):
"""更相减损"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""最大公约数 greatest common divisor: gcd(m,n) = k 最小公倍数 Least common multiple: lcm(m,n) = m*n*k 所以求最小公倍数 等于求最大公约数"""
def gcd(self, m, n):
"""辗转相除 对数级的时间复杂度"""
if m < n:
m, n = (n, m)
while n:
temp = m % n
m, n = (n, temp)
return m... | the_stack_v2_python_sparse | 4_LEETCODE/7_MATH/最大公约数/求最大公约数.py | fzingithub/SwordRefers2Offer | train | 1 |
7413c6083484f8b895855e3b850b412c5e775141 | [
"self.node_size_x = node_size_x\nself.node_size_y = node_size_y\nself.xl = xl\nself.yl = yl\nself.xh = xh\nself.yh = yh\nself.num_bins_x = num_bins_x\nself.num_bins_y = num_bins_y\nself.initial_range_list = [[num_movable_nodes, num_movable_nodes + num_terminals]]\nself.range_list = [[0, num_movable_nodes], [node_si... | <|body_start_0|>
self.node_size_x = node_size_x
self.node_size_y = node_size_y
self.xl = xl
self.yl = yl
self.xh = xh
self.yh = yh
self.num_bins_x = num_bins_x
self.num_bins_y = num_bins_y
self.initial_range_list = [[num_movable_nodes, num_movable_... | @brief Compute density overflow for both movable and fixed cells. The density map for fixed cells is pre-computed. Each call will only compute the density map for movable cells. | DensityOverflow | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DensityOverflow:
"""@brief Compute density overflow for both movable and fixed cells. The density map for fixed cells is pre-computed. Each call will only compute the density map for movable cells."""
def __init__(self, node_size_x, node_size_y, xl, yl, xh, yh, num_bins_x, num_bins_y, num_mo... | stack_v2_sparse_classes_36k_train_030014 | 3,946 | permissive | [
{
"docstring": "@brief initialization @param node_size_x cell width array consisting of movable cells, fixed cells, and filler cells in order @param node_size_y cell height array consisting of movable cells, fixed cells, and filler cells in order @param xl left boundary @param yl bottom boundary @param xh right... | 2 | stack_v2_sparse_classes_30k_train_017774 | Implement the Python class `DensityOverflow` described below.
Class description:
@brief Compute density overflow for both movable and fixed cells. The density map for fixed cells is pre-computed. Each call will only compute the density map for movable cells.
Method signatures and docstrings:
- def __init__(self, node... | Implement the Python class `DensityOverflow` described below.
Class description:
@brief Compute density overflow for both movable and fixed cells. The density map for fixed cells is pre-computed. Each call will only compute the density map for movable cells.
Method signatures and docstrings:
- def __init__(self, node... | f59ebfa4831573d3db38642f4b2d2e2108bd6e3e | <|skeleton|>
class DensityOverflow:
"""@brief Compute density overflow for both movable and fixed cells. The density map for fixed cells is pre-computed. Each call will only compute the density map for movable cells."""
def __init__(self, node_size_x, node_size_y, xl, yl, xh, yh, num_bins_x, num_bins_y, num_mo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DensityOverflow:
"""@brief Compute density overflow for both movable and fixed cells. The density map for fixed cells is pre-computed. Each call will only compute the density map for movable cells."""
def __init__(self, node_size_x, node_size_y, xl, yl, xh, yh, num_bins_x, num_bins_y, num_movable_nodes, ... | the_stack_v2_python_sparse | dreamplace/ops/density_overflow/density_overflow.py | limbo018/DREAMPlace | train | 539 |
966c0cf276de17547391f6ca332ee22e40a07cad | [
"if data is not None:\n data = np.atleast_2d(data)\n self.mean = data.mean(axis=0)\n self.std = data.std(axis=0)\n self.nobservations = data.shape[0]\n self.ndimensions = data.shape[1]\nelse:\n self.nobservations = 0",
"if self.nobservations == 0:\n self.__init__(data)\nelse:\n data = np.a... | <|body_start_0|>
if data is not None:
data = np.atleast_2d(data)
self.mean = data.mean(axis=0)
self.std = data.std(axis=0)
self.nobservations = data.shape[0]
self.ndimensions = data.shape[1]
else:
self.nobservations = 0
<|end_body_0... | StatsRecords is usefull when computing mean and standard deviation in a huge amount of data. source: http://notmatthancock.github.io/2017/03/23/simple-batch-stat-updates.html | StatsRecorder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StatsRecorder:
"""StatsRecords is usefull when computing mean and standard deviation in a huge amount of data. source: http://notmatthancock.github.io/2017/03/23/simple-batch-stat-updates.html"""
def __init__(self, data=None):
"""data: ndarray, shape (nobservations, ndimensions)"""
... | stack_v2_sparse_classes_36k_train_030015 | 2,332 | no_license | [
{
"docstring": "data: ndarray, shape (nobservations, ndimensions)",
"name": "__init__",
"signature": "def __init__(self, data=None)"
},
{
"docstring": "data: ndarray, shape (nobservations, ndimensions)",
"name": "update",
"signature": "def update(self, data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020070 | Implement the Python class `StatsRecorder` described below.
Class description:
StatsRecords is usefull when computing mean and standard deviation in a huge amount of data. source: http://notmatthancock.github.io/2017/03/23/simple-batch-stat-updates.html
Method signatures and docstrings:
- def __init__(self, data=None... | Implement the Python class `StatsRecorder` described below.
Class description:
StatsRecords is usefull when computing mean and standard deviation in a huge amount of data. source: http://notmatthancock.github.io/2017/03/23/simple-batch-stat-updates.html
Method signatures and docstrings:
- def __init__(self, data=None... | ceceebe143e14475bad55bee6554524d3fb3c53b | <|skeleton|>
class StatsRecorder:
"""StatsRecords is usefull when computing mean and standard deviation in a huge amount of data. source: http://notmatthancock.github.io/2017/03/23/simple-batch-stat-updates.html"""
def __init__(self, data=None):
"""data: ndarray, shape (nobservations, ndimensions)"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StatsRecorder:
"""StatsRecords is usefull when computing mean and standard deviation in a huge amount of data. source: http://notmatthancock.github.io/2017/03/23/simple-batch-stat-updates.html"""
def __init__(self, data=None):
"""data: ndarray, shape (nobservations, ndimensions)"""
if dat... | the_stack_v2_python_sparse | models/base/utils.py | felippe-mendonca/tf-human-action-datasets | train | 5 |
9409a11171e1dc68f3867eee90ebc6e8e336a82b | [
"self.names, self.all, self.x, self.y, self.klass = (t, [], [], [], None)\nfor n, s in enumerate(t):\n col = Num(n, s) if re.findall('^[A-Z]+', s) else Sym(n, s)\n self.all.append(col)\n if not re.findall('X$', s):\n if re.findall('!$', s):\n self.klass = col\n self.y.append(col) i... | <|body_start_0|>
self.names, self.all, self.x, self.y, self.klass = (t, [], [], [], None)
for n, s in enumerate(t):
col = Num(n, s) if re.findall('^[A-Z]+', s) else Sym(n, s)
self.all.append(col)
if not re.findall('X$', s):
if re.findall('!$', s):
... | Factory for managing a set of NUMs or SYMs | Cols | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cols:
"""Factory for managing a set of NUMs or SYMs"""
def __init__(self, t):
"""Initializes a new Cols object, contains many columns :param t: Row to convert to NUMs or SYMs"""
<|body_0|>
def add(self, row: Row) -> None:
"""Updates the columns with details from ... | stack_v2_sparse_classes_36k_train_030016 | 1,157 | permissive | [
{
"docstring": "Initializes a new Cols object, contains many columns :param t: Row to convert to NUMs or SYMs",
"name": "__init__",
"signature": "def __init__(self, t)"
},
{
"docstring": "Updates the columns with details from row :param row: Row to add",
"name": "add",
"signature": "def ... | 2 | stack_v2_sparse_classes_30k_val_001184 | Implement the Python class `Cols` described below.
Class description:
Factory for managing a set of NUMs or SYMs
Method signatures and docstrings:
- def __init__(self, t): Initializes a new Cols object, contains many columns :param t: Row to convert to NUMs or SYMs
- def add(self, row: Row) -> None: Updates the colum... | Implement the Python class `Cols` described below.
Class description:
Factory for managing a set of NUMs or SYMs
Method signatures and docstrings:
- def __init__(self, t): Initializes a new Cols object, contains many columns :param t: Row to convert to NUMs or SYMs
- def add(self, row: Row) -> None: Updates the colum... | c1357a0bd865dece9889c4c372523c6f6b97e85d | <|skeleton|>
class Cols:
"""Factory for managing a set of NUMs or SYMs"""
def __init__(self, t):
"""Initializes a new Cols object, contains many columns :param t: Row to convert to NUMs or SYMs"""
<|body_0|>
def add(self, row: Row) -> None:
"""Updates the columns with details from ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Cols:
"""Factory for managing a set of NUMs or SYMs"""
def __init__(self, t):
"""Initializes a new Cols object, contains many columns :param t: Row to convert to NUMs or SYMs"""
self.names, self.all, self.x, self.y, self.klass = (t, [], [], [], None)
for n, s in enumerate(t):
... | the_stack_v2_python_sparse | src/HW4/cols.py | kingan1/CSC591-Group9-Homeworks | train | 0 |
599471fca4ccb4ca24191a09dc5ffa6db27b94f2 | [
"super().__init__(validate)\nself._n_shots = None\nself._n_circuits = None\nself._memory_allocation = memory_allocation",
"self._n_shots = len(data[0])\nself._n_circuits = len(data)\nif self._validate:\n if data.shape[:2] != (self._n_circuits, self._n_shots):\n raise DataProcessorError(f'The datum given... | <|body_start_0|>
super().__init__(validate)
self._n_shots = None
self._n_circuits = None
self._memory_allocation = memory_allocation
<|end_body_0|>
<|body_start_1|>
self._n_shots = len(data[0])
self._n_circuits = len(data)
if self._validate:
if data.s... | An abstract node for restless data processing nodes. In restless measurements, the qubit is not reset after each measurement. Instead, the outcome of the previous quantum non-demolition measurement is the initial state for the current circuit. Restless measurements therefore require special data processing nodes that a... | RestlessNode | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestlessNode:
"""An abstract node for restless data processing nodes. In restless measurements, the qubit is not reset after each measurement. Instead, the outcome of the previous quantum non-demolition measurement is the initial state for the current circuit. Restless measurements therefore requ... | stack_v2_sparse_classes_36k_train_030017 | 42,185 | permissive | [
{
"docstring": "Initialize a restless node. Args: validate: If set to True the node will validate its input. memory_allocation: If set to \"c\" the node assumes that the backend subsequently first measures all circuits and then repeats this n times, where n is the total number of shots. The default value is \"c... | 3 | stack_v2_sparse_classes_30k_train_008840 | Implement the Python class `RestlessNode` described below.
Class description:
An abstract node for restless data processing nodes. In restless measurements, the qubit is not reset after each measurement. Instead, the outcome of the previous quantum non-demolition measurement is the initial state for the current circui... | Implement the Python class `RestlessNode` described below.
Class description:
An abstract node for restless data processing nodes. In restless measurements, the qubit is not reset after each measurement. Instead, the outcome of the previous quantum non-demolition measurement is the initial state for the current circui... | a387675a3fe817cef05b968bbf3e05799a09aaae | <|skeleton|>
class RestlessNode:
"""An abstract node for restless data processing nodes. In restless measurements, the qubit is not reset after each measurement. Instead, the outcome of the previous quantum non-demolition measurement is the initial state for the current circuit. Restless measurements therefore requ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RestlessNode:
"""An abstract node for restless data processing nodes. In restless measurements, the qubit is not reset after each measurement. Instead, the outcome of the previous quantum non-demolition measurement is the initial state for the current circuit. Restless measurements therefore require special d... | the_stack_v2_python_sparse | qiskit_experiments/data_processing/nodes.py | oliverdial/qiskit-experiments | train | 0 |
a92237f39bfc10360782e8529872fe53ceb6f8ad | [
"publisher = None\ntry:\n publisher = getUtility(IEventPublisher, 'batch')\n count = 0\n for event in events:\n try:\n self._publishEvent(event, publisher)\n count += 1\n except IOError as e:\n log.critical('Unable to publish event to %s: %s', publisher, e)\n ... | <|body_start_0|>
publisher = None
try:
publisher = getUtility(IEventPublisher, 'batch')
count = 0
for event in events:
try:
self._publishEvent(event, publisher)
count += 1
except IOError as e:
... | Mix-in class that takes a MySQL db connection and builds inserts that sends the event to the backend. | MySqlSendEventMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MySqlSendEventMixin:
"""Mix-in class that takes a MySQL db connection and builds inserts that sends the event to the backend."""
def sendEvents(self, events):
"""Sends multiple events using a single publisher. This prevents using a new connection for each event."""
<|body_0|>... | stack_v2_sparse_classes_36k_train_030018 | 3,847 | no_license | [
{
"docstring": "Sends multiple events using a single publisher. This prevents using a new connection for each event.",
"name": "sendEvents",
"signature": "def sendEvents(self, events)"
},
{
"docstring": "Send an event to the backend. @param event: an event @type event: Event class @return: event... | 4 | null | Implement the Python class `MySqlSendEventMixin` described below.
Class description:
Mix-in class that takes a MySQL db connection and builds inserts that sends the event to the backend.
Method signatures and docstrings:
- def sendEvents(self, events): Sends multiple events using a single publisher. This prevents usi... | Implement the Python class `MySqlSendEventMixin` described below.
Class description:
Mix-in class that takes a MySQL db connection and builds inserts that sends the event to the backend.
Method signatures and docstrings:
- def sendEvents(self, events): Sends multiple events using a single publisher. This prevents usi... | 1ea508c3d2b51742bc3b448c445cd0a3dba9e798 | <|skeleton|>
class MySqlSendEventMixin:
"""Mix-in class that takes a MySQL db connection and builds inserts that sends the event to the backend."""
def sendEvents(self, events):
"""Sends multiple events using a single publisher. This prevents using a new connection for each event."""
<|body_0|>... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MySqlSendEventMixin:
"""Mix-in class that takes a MySQL db connection and builds inserts that sends the event to the backend."""
def sendEvents(self, events):
"""Sends multiple events using a single publisher. This prevents using a new connection for each event."""
publisher = None
... | the_stack_v2_python_sparse | Products/ZenEvents/MySqlSendEvent.py | zenoss/zenoss-prodbin | train | 27 |
2bec81149662312e79c4bf490537b81533701d67 | [
"def _commands_help(topic):\n com = obj.get('endroid.plugins.command')\n return com._help_main(topic, plugin=obj)\nif not 'commands' in obj._help_topics:\n setattr(obj, 'help_topics', {'commands': _commands_help})\nreturn obj._help_topics",
"topics = obj._help_topics.copy()\ntopics.update(value)\nobj._he... | <|body_start_0|>
def _commands_help(topic):
com = obj.get('endroid.plugins.command')
return com._help_main(topic, plugin=obj)
if not 'commands' in obj._help_topics:
setattr(obj, 'help_topics', {'commands': _commands_help})
return obj._help_topics
<|end_body_0|... | Descriptor to handle auto-updating of the help_topics. This is required if a plugin doesn't just define its help_topics at the class level, and instead sets it during its initialisation. This descriptor will update the help_topics instead of replacing them when set. | _Topics | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _Topics:
"""Descriptor to handle auto-updating of the help_topics. This is required if a plugin doesn't just define its help_topics at the class level, and instead sets it during its initialisation. This descriptor will update the help_topics instead of replacing them when set."""
def __get_... | stack_v2_sparse_classes_36k_train_030019 | 13,347 | no_license | [
{
"docstring": "As well as fetching the help_topics (from the _help_topics field), this also injects the 'commands' entry into topics. It is done here, as this is the first point at which we have an instance of the plugin (needed to do the filtering later when displaying the help). Moral of the story: injecting... | 2 | stack_v2_sparse_classes_30k_train_013955 | Implement the Python class `_Topics` described below.
Class description:
Descriptor to handle auto-updating of the help_topics. This is required if a plugin doesn't just define its help_topics at the class level, and instead sets it during its initialisation. This descriptor will update the help_topics instead of repl... | Implement the Python class `_Topics` described below.
Class description:
Descriptor to handle auto-updating of the help_topics. This is required if a plugin doesn't just define its help_topics at the class level, and instead sets it during its initialisation. This descriptor will update the help_topics instead of repl... | 26e19a67551c0524186c096439c33eaa003c8f20 | <|skeleton|>
class _Topics:
"""Descriptor to handle auto-updating of the help_topics. This is required if a plugin doesn't just define its help_topics at the class level, and instead sets it during its initialisation. This descriptor will update the help_topics instead of replacing them when set."""
def __get_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _Topics:
"""Descriptor to handle auto-updating of the help_topics. This is required if a plugin doesn't just define its help_topics at the class level, and instead sets it during its initialisation. This descriptor will update the help_topics instead of replacing them when set."""
def __get__(self, obj, ... | the_stack_v2_python_sparse | src/endroid/plugins/command.py | ensoft/endroid | train | 0 |
a9f742f99d7a8bf522c19daa6a5bdc8d90724cb4 | [
"with self.cached_session() as sess:\n size, shape = (2, [2, 3])\n my_buffer = tensor_buffer.TensorBuffer(size, shape, name='my_buffer')\n value1 = [[1, 2, 3], [4, 5, 6]]\n with tf.control_dependencies([my_buffer.append(value1)]):\n value2 = [[7, 8, 9], [10, 11, 12]]\n with tf.control_depe... | <|body_start_0|>
with self.cached_session() as sess:
size, shape = (2, [2, 3])
my_buffer = tensor_buffer.TensorBuffer(size, shape, name='my_buffer')
value1 = [[1, 2, 3], [4, 5, 6]]
with tf.control_dependencies([my_buffer.append(value1)]):
value2 = ... | Tests for TensorBuffer in graph mode. | TensorBufferTest | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TensorBufferTest:
"""Tests for TensorBuffer in graph mode."""
def test_noresize(self):
"""Test buffer does not resize if capacity is not exceeded."""
<|body_0|>
def test_resize(self):
"""Test buffer resizes if capacity is exceeded."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k_train_030020 | 2,573 | permissive | [
{
"docstring": "Test buffer does not resize if capacity is not exceeded.",
"name": "test_noresize",
"signature": "def test_noresize(self)"
},
{
"docstring": "Test buffer resizes if capacity is exceeded.",
"name": "test_resize",
"signature": "def test_resize(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009718 | Implement the Python class `TensorBufferTest` described below.
Class description:
Tests for TensorBuffer in graph mode.
Method signatures and docstrings:
- def test_noresize(self): Test buffer does not resize if capacity is not exceeded.
- def test_resize(self): Test buffer resizes if capacity is exceeded. | Implement the Python class `TensorBufferTest` described below.
Class description:
Tests for TensorBuffer in graph mode.
Method signatures and docstrings:
- def test_noresize(self): Test buffer does not resize if capacity is not exceeded.
- def test_resize(self): Test buffer resizes if capacity is exceeded.
<|skeleto... | c92610e37aa340932ed2d963813e0890035a22bc | <|skeleton|>
class TensorBufferTest:
"""Tests for TensorBuffer in graph mode."""
def test_noresize(self):
"""Test buffer does not resize if capacity is not exceeded."""
<|body_0|>
def test_resize(self):
"""Test buffer resizes if capacity is exceeded."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TensorBufferTest:
"""Tests for TensorBuffer in graph mode."""
def test_noresize(self):
"""Test buffer does not resize if capacity is not exceeded."""
with self.cached_session() as sess:
size, shape = (2, [2, 3])
my_buffer = tensor_buffer.TensorBuffer(size, shape, n... | the_stack_v2_python_sparse | tensorflow_privacy/privacy/analysis/tensor_buffer_graph_test.py | tensorflow/privacy | train | 1,881 |
ddf2baa5a550fa6ca0af7901032aefe2bab0d429 | [
"self.write_root(root)\nfor child in root.children():\n n = child.level()\n for p in child.self_and_subtree():\n if g.app.force_at_auto_sentinels:\n self.put_node_sentinel(p, '#')\n indent = '\\t' * (p.level() - n)\n self.put('%s%s' % (indent, p.h))\n for s in p.b.splitl... | <|body_start_0|>
self.write_root(root)
for child in root.children():
n = child.level()
for p in child.self_and_subtree():
if g.app.force_at_auto_sentinels:
self.put_node_sentinel(p, '#')
indent = '\t' * (p.level() - n)
... | The writer class for .otl files. | OtlWriter | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OtlWriter:
"""The writer class for .otl files."""
def write(self, root: Position) -> None:
"""Write all the *descendants* of an @auto-otl node."""
<|body_0|>
def write_root(self, root: Position) -> None:
"""Write the root @auto-org node."""
<|body_1|>
<|... | stack_v2_sparse_classes_36k_train_030021 | 1,620 | permissive | [
{
"docstring": "Write all the *descendants* of an @auto-otl node.",
"name": "write",
"signature": "def write(self, root: Position) -> None"
},
{
"docstring": "Write the root @auto-org node.",
"name": "write_root",
"signature": "def write_root(self, root: Position) -> None"
}
] | 2 | stack_v2_sparse_classes_30k_train_001071 | Implement the Python class `OtlWriter` described below.
Class description:
The writer class for .otl files.
Method signatures and docstrings:
- def write(self, root: Position) -> None: Write all the *descendants* of an @auto-otl node.
- def write_root(self, root: Position) -> None: Write the root @auto-org node. | Implement the Python class `OtlWriter` described below.
Class description:
The writer class for .otl files.
Method signatures and docstrings:
- def write(self, root: Position) -> None: Write all the *descendants* of an @auto-otl node.
- def write_root(self, root: Position) -> None: Write the root @auto-org node.
<|s... | a3f6c3ebda805dc40cd93123948f153a26eccee5 | <|skeleton|>
class OtlWriter:
"""The writer class for .otl files."""
def write(self, root: Position) -> None:
"""Write all the *descendants* of an @auto-otl node."""
<|body_0|>
def write_root(self, root: Position) -> None:
"""Write the root @auto-org node."""
<|body_1|>
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OtlWriter:
"""The writer class for .otl files."""
def write(self, root: Position) -> None:
"""Write all the *descendants* of an @auto-otl node."""
self.write_root(root)
for child in root.children():
n = child.level()
for p in child.self_and_subtree():
... | the_stack_v2_python_sparse | leo/plugins/writers/otl.py | leo-editor/leo-editor | train | 1,671 |
69f577738cfbf130400e4845012d5fefb446e338 | [
"super(TextInput, self).__init__(attrs)\nif source is None:\n raise ValueError('A source url should be given')\nself.source = source\nself.min_length = int(min_length)\nself.result_limit = result_limit\nself.force_check = force_check",
"if value is None:\n value = ''\nattrs['type'] = 'text'\nattrs['name'] =... | <|body_start_0|>
super(TextInput, self).__init__(attrs)
if source is None:
raise ValueError('A source url should be given')
self.source = source
self.min_length = int(min_length)
self.result_limit = result_limit
self.force_check = force_check
<|end_body_0|>
<... | A text input that autocompletes getting a json list | AutocompleteTextInput | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutocompleteTextInput:
"""A text input that autocompletes getting a json list"""
def __init__(self, attrs=None, source=None, min_length=3, result_limit=100, force_check=True):
"""It inits the widget. A source url for the json list should be given."""
<|body_0|>
def rende... | stack_v2_sparse_classes_36k_train_030022 | 7,303 | no_license | [
{
"docstring": "It inits the widget. A source url for the json list should be given.",
"name": "__init__",
"signature": "def __init__(self, attrs=None, source=None, min_length=3, result_limit=100, force_check=True)"
},
{
"docstring": "It renders the html and the javascript",
"name": "render"... | 3 | null | Implement the Python class `AutocompleteTextInput` described below.
Class description:
A text input that autocompletes getting a json list
Method signatures and docstrings:
- def __init__(self, attrs=None, source=None, min_length=3, result_limit=100, force_check=True): It inits the widget. A source url for the json l... | Implement the Python class `AutocompleteTextInput` described below.
Class description:
A text input that autocompletes getting a json list
Method signatures and docstrings:
- def __init__(self, attrs=None, source=None, min_length=3, result_limit=100, force_check=True): It inits the widget. A source url for the json l... | 46364a9b82bee21444acf343f7f543b28a71f616 | <|skeleton|>
class AutocompleteTextInput:
"""A text input that autocompletes getting a json list"""
def __init__(self, attrs=None, source=None, min_length=3, result_limit=100, force_check=True):
"""It inits the widget. A source url for the json list should be given."""
<|body_0|>
def rende... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AutocompleteTextInput:
"""A text input that autocompletes getting a json list"""
def __init__(self, attrs=None, source=None, min_length=3, result_limit=100, force_check=True):
"""It inits the widget. A source url for the json list should be given."""
super(TextInput, self).__init__(attrs)... | the_stack_v2_python_sparse | vavilov/forms/widgets.py | pziarsolo/vavilov2 | train | 0 |
67adaa152a4bc9d06eee9596aaba2936532a9819 | [
"form = GameForm()\nform.urlsafe_key = self.key.urlsafe()\nform.user_email = self.user.get().email\nform.user_name = self.user.get().displayName\nform.total_rounds = self.total_rounds\nform.remaining_rounds = self.remaining_rounds\nform.user_wins = self.user_wins\nform.cpu_wins = self.cpu_wins\nform.game_over = sel... | <|body_start_0|>
form = GameForm()
form.urlsafe_key = self.key.urlsafe()
form.user_email = self.user.get().email
form.user_name = self.user.get().displayName
form.total_rounds = self.total_rounds
form.remaining_rounds = self.remaining_rounds
form.user_wins = self.... | Game object | Game | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Game:
"""Game object"""
def to_form(self):
"""Returns a GameForm representation of the Game"""
<|body_0|>
def to_gamehistory_form(self):
"""Returns a GameHistoryForm RPC message from a Game entity"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_030023 | 4,239 | no_license | [
{
"docstring": "Returns a GameForm representation of the Game",
"name": "to_form",
"signature": "def to_form(self)"
},
{
"docstring": "Returns a GameHistoryForm RPC message from a Game entity",
"name": "to_gamehistory_form",
"signature": "def to_gamehistory_form(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_010908 | Implement the Python class `Game` described below.
Class description:
Game object
Method signatures and docstrings:
- def to_form(self): Returns a GameForm representation of the Game
- def to_gamehistory_form(self): Returns a GameHistoryForm RPC message from a Game entity | Implement the Python class `Game` described below.
Class description:
Game object
Method signatures and docstrings:
- def to_form(self): Returns a GameForm representation of the Game
- def to_gamehistory_form(self): Returns a GameHistoryForm RPC message from a Game entity
<|skeleton|>
class Game:
"""Game object"... | 3d22a7658ecd130d25ac927290da583d2bd30b8a | <|skeleton|>
class Game:
"""Game object"""
def to_form(self):
"""Returns a GameForm representation of the Game"""
<|body_0|>
def to_gamehistory_form(self):
"""Returns a GameHistoryForm RPC message from a Game entity"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Game:
"""Game object"""
def to_form(self):
"""Returns a GameForm representation of the Game"""
form = GameForm()
form.urlsafe_key = self.key.urlsafe()
form.user_email = self.user.get().email
form.user_name = self.user.get().displayName
form.total_rounds = s... | the_stack_v2_python_sparse | Rock-Paper-Scissors/models/Game.py | Drew-Kimberly/fullstack | train | 0 |
c83db03c5bb92abc5d8e906d0e21542fb8668d1c | [
"dp = [float('inf') for _ in range(n + 1)]\ndp[0] = 0\nfor i in range(n + 1):\n j = 1\n while n >= i + j * j:\n dp[i + j * j] = min(dp[i] + 1, dp[i + j * j])\n j += 1\nreturn dp[-1]",
"num = [0]\nwhile len(num) <= n:\n num.append(min((num[-i * i] for i in range(1, int(len(num) ** 0.5 + 1)))... | <|body_start_0|>
dp = [float('inf') for _ in range(n + 1)]
dp[0] = 0
for i in range(n + 1):
j = 1
while n >= i + j * j:
dp[i + j * j] = min(dp[i] + 1, dp[i + j * j])
j += 1
return dp[-1]
<|end_body_0|>
<|body_start_1|>
num ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numSquares_2(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def numSquares(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dp = [float('inf') for _ in range(n + 1)]
dp[0] = 0
f... | stack_v2_sparse_classes_36k_train_030024 | 1,085 | no_license | [
{
"docstring": ":type n: int :rtype: int",
"name": "numSquares_2",
"signature": "def numSquares_2(self, n)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "numSquares",
"signature": "def numSquares(self, n)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquares_2(self, n): :type n: int :rtype: int
- def numSquares(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 numSquares_2(self, n): :type n: int :rtype: int
- def numSquares(self, n): :type n: int :rtype: int
<|skeleton|>
class Solution:
def numSquares_2(self, n):
""":... | 0ca8983505ef5f694b68198742aaf50fc0b80e6b | <|skeleton|>
class Solution:
def numSquares_2(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def numSquares(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 numSquares_2(self, n):
""":type n: int :rtype: int"""
dp = [float('inf') for _ in range(n + 1)]
dp[0] = 0
for i in range(n + 1):
j = 1
while n >= i + j * j:
dp[i + j * j] = min(dp[i] + 1, dp[i + j * j])
j += ... | the_stack_v2_python_sparse | leetcode 251-300/279. Perfect Squares.py | raxxar1024/code_snippet | train | 0 | |
f7279dd7a59193d4317e1748c5a992caeaa62e1b | [
"self.rects = rects\nself.weights = []\nfor [x_bl, y_bl, x_tr, y_tr] in self.rects:\n self.weights.append((x_tr - x_bl + 1) * (y_tr - y_bl + 1))",
"[x_bl, y_bl, x_tr, y_tr] = random.choices(self.rects, weights=self.weights)[0]\nres = [random.randrange(x_bl, x_tr + 1), random.randrange(y_bl, y_tr + 1)]\nreturn ... | <|body_start_0|>
self.rects = rects
self.weights = []
for [x_bl, y_bl, x_tr, y_tr] in self.rects:
self.weights.append((x_tr - x_bl + 1) * (y_tr - y_bl + 1))
<|end_body_0|>
<|body_start_1|>
[x_bl, y_bl, x_tr, y_tr] = random.choices(self.rects, weights=self.weights)[0]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, rects):
""":type rects: List[List[int]]"""
<|body_0|>
def pick(self):
""":rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.rects = rects
self.weights = []
for [x_bl, y_bl, x_tr, y_tr]... | stack_v2_sparse_classes_36k_train_030025 | 1,616 | no_license | [
{
"docstring": ":type rects: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, rects)"
},
{
"docstring": ":rtype: List[int]",
"name": "pick",
"signature": "def pick(self)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, rects): :type rects: List[List[int]]
- def pick(self): :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, rects): :type rects: List[List[int]]
- def pick(self): :rtype: List[int]
<|skeleton|>
class Solution:
def __init__(self, rects):
""":type rects: ... | f93380721b8383817fe2b0d728deca1321c9ef45 | <|skeleton|>
class Solution:
def __init__(self, rects):
""":type rects: List[List[int]]"""
<|body_0|>
def pick(self):
""":rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, rects):
""":type rects: List[List[int]]"""
self.rects = rects
self.weights = []
for [x_bl, y_bl, x_tr, y_tr] in self.rects:
self.weights.append((x_tr - x_bl + 1) * (y_tr - y_bl + 1))
def pick(self):
""":rtype: List[int]"""
... | the_stack_v2_python_sparse | explore/2020/august/Random_Point_in_Non-overlapping_Rectangles.py | lixiang2017/leetcode | train | 5 | |
4cbb13cea2166ce462e8ddd8c8520c6fb94f7974 | [
"self.max_width = max_width\nself.closed = False\nsuper().__init__(visible=False, vsync=False, resizable=True)",
"assert isinstance(x, np.ndarray), f'expected numpy array dtype, got {type(x)}'\nassert x.ndim == 3, f'expected ndim=3, got {x.ndim}'\nassert x.shape[-1] == 3, f'expected 3 color channel, got {x.shape[... | <|body_start_0|>
self.max_width = max_width
self.closed = False
super().__init__(visible=False, vsync=False, resizable=True)
<|end_body_0|>
<|body_start_1|>
assert isinstance(x, np.ndarray), f'expected numpy array dtype, got {type(x)}'
assert x.ndim == 3, f'expected ndim=3, got ... | Display an image from an RGB array in an OpenGL window. Example:: imageviewer = ImageViewer(max_width=500) image = np.asarray(Image.open('x.jpg')) imageviewer(image) | ImageViewer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageViewer:
"""Display an image from an RGB array in an OpenGL window. Example:: imageviewer = ImageViewer(max_width=500) image = np.asarray(Image.open('x.jpg')) imageviewer(image)"""
def __init__(self, max_width=500):
"""Initialize the OpenGL window. Args: max_width (int): maximum ... | stack_v2_sparse_classes_36k_train_030026 | 3,097 | permissive | [
{
"docstring": "Initialize the OpenGL window. Args: max_width (int): maximum width of the window.",
"name": "__init__",
"signature": "def __init__(self, max_width=500)"
},
{
"docstring": "Create an image from the given RGB array and display to the window. Args: x (ndarray): RGB array",
"name... | 3 | stack_v2_sparse_classes_30k_train_012611 | Implement the Python class `ImageViewer` described below.
Class description:
Display an image from an RGB array in an OpenGL window. Example:: imageviewer = ImageViewer(max_width=500) image = np.asarray(Image.open('x.jpg')) imageviewer(image)
Method signatures and docstrings:
- def __init__(self, max_width=500): Init... | Implement the Python class `ImageViewer` described below.
Class description:
Display an image from an RGB array in an OpenGL window. Example:: imageviewer = ImageViewer(max_width=500) image = np.asarray(Image.open('x.jpg')) imageviewer(image)
Method signatures and docstrings:
- def __init__(self, max_width=500): Init... | 273bb7f5babb1f250f6dba0b5f62c6614f301719 | <|skeleton|>
class ImageViewer:
"""Display an image from an RGB array in an OpenGL window. Example:: imageviewer = ImageViewer(max_width=500) image = np.asarray(Image.open('x.jpg')) imageviewer(image)"""
def __init__(self, max_width=500):
"""Initialize the OpenGL window. Args: max_width (int): maximum ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImageViewer:
"""Display an image from an RGB array in an OpenGL window. Example:: imageviewer = ImageViewer(max_width=500) image = np.asarray(Image.open('x.jpg')) imageviewer(image)"""
def __init__(self, max_width=500):
"""Initialize the OpenGL window. Args: max_width (int): maximum width of the ... | the_stack_v2_python_sparse | lagom/vis/image_viewer.py | LorinChen/lagom | train | 1 |
75464d33be402e7a31e2b28c92d89bee016dbe37 | [
"self.modified_coeff = modified_coeff\nself.a = a\nself.b = b",
"ans = 0\nfor coeff in self.modified_coeff:\n ans *= x\n ans += coeff\nreturn ans"
] | <|body_start_0|>
self.modified_coeff = modified_coeff
self.a = a
self.b = b
<|end_body_0|>
<|body_start_1|>
ans = 0
for coeff in self.modified_coeff:
ans *= x
ans += coeff
return ans
<|end_body_1|>
| SievePolynomial | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SievePolynomial:
def __init__(self, modified_coeff=(), a=None, b=None):
"""This class denotes the seive polynomial. If ``g(x) = (a*x + b)**2 - N``. `g(x)` can be expanded to ``a*x**2 + 2*a*b*x + b**2 - N``, so the coefficient is stored in the form `[a**2, 2*a*b, b**2 - N]`. This ensures ... | stack_v2_sparse_classes_36k_train_030027 | 18,360 | permissive | [
{
"docstring": "This class denotes the seive polynomial. If ``g(x) = (a*x + b)**2 - N``. `g(x)` can be expanded to ``a*x**2 + 2*a*b*x + b**2 - N``, so the coefficient is stored in the form `[a**2, 2*a*b, b**2 - N]`. This ensures faster `eval` method because we dont have to perform `a**2, 2*a*b, b**2` every time... | 2 | stack_v2_sparse_classes_30k_train_002316 | Implement the Python class `SievePolynomial` described below.
Class description:
Implement the SievePolynomial class.
Method signatures and docstrings:
- def __init__(self, modified_coeff=(), a=None, b=None): This class denotes the seive polynomial. If ``g(x) = (a*x + b)**2 - N``. `g(x)` can be expanded to ``a*x**2 +... | Implement the Python class `SievePolynomial` described below.
Class description:
Implement the SievePolynomial class.
Method signatures and docstrings:
- def __init__(self, modified_coeff=(), a=None, b=None): This class denotes the seive polynomial. If ``g(x) = (a*x + b)**2 - N``. `g(x)` can be expanded to ``a*x**2 +... | 69f98fb2b0d845e76874067a381dba37b577e8c5 | <|skeleton|>
class SievePolynomial:
def __init__(self, modified_coeff=(), a=None, b=None):
"""This class denotes the seive polynomial. If ``g(x) = (a*x + b)**2 - N``. `g(x)` can be expanded to ``a*x**2 + 2*a*b*x + b**2 - N``, so the coefficient is stored in the form `[a**2, 2*a*b, b**2 - N]`. This ensures ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SievePolynomial:
def __init__(self, modified_coeff=(), a=None, b=None):
"""This class denotes the seive polynomial. If ``g(x) = (a*x + b)**2 - N``. `g(x)` can be expanded to ``a*x**2 + 2*a*b*x + b**2 - N``, so the coefficient is stored in the form `[a**2, 2*a*b, b**2 - N]`. This ensures faster `eval` ... | the_stack_v2_python_sparse | sympy/ntheory/qs.py | sympy/sympy | train | 10,928 | |
21b6f008f645d46f9b723f0ca9d02f289111f64b | [
"device_ids = map(hm.uid_to_device_id, identified_devices.values())\nfound_types = map(lambda dev: hm.DEVICES[dev]['name'], device_ids)\nself.assertListEqual(sorted(self.VIRTUAL_DEVICE_TYPES), sorted(found_types), msg)",
"virtual_devices = []\nfor vdev_type in self.VIRTUAL_DEVICE_TYPES:\n virtual_devices.appen... | <|body_start_0|>
device_ids = map(hm.uid_to_device_id, identified_devices.values())
found_types = map(lambda dev: hm.DEVICES[dev]['name'], device_ids)
self.assertListEqual(sorted(self.VIRTUAL_DEVICE_TYPES), sorted(found_types), msg)
<|end_body_0|>
<|body_start_1|>
virtual_devices = []
... | Tests for `identify_smart_sensors`. | IdentifySmartSensorsTests | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IdentifySmartSensorsTests:
"""Tests for `identify_smart_sensors`."""
def assert_all_devices_identified(self, identified_devices, msg=None):
"""Assert that IDENTIFIED_DEVICES contains all devices in VIRTUAL_DEVICE_TYPES."""
<|body_0|>
def test_detect_devices(self):
... | stack_v2_sparse_classes_36k_train_030028 | 2,478 | permissive | [
{
"docstring": "Assert that IDENTIFIED_DEVICES contains all devices in VIRTUAL_DEVICE_TYPES.",
"name": "assert_all_devices_identified",
"signature": "def assert_all_devices_identified(self, identified_devices, msg=None)"
},
{
"docstring": "Test detection of valid devices.",
"name": "test_det... | 4 | stack_v2_sparse_classes_30k_train_020555 | Implement the Python class `IdentifySmartSensorsTests` described below.
Class description:
Tests for `identify_smart_sensors`.
Method signatures and docstrings:
- def assert_all_devices_identified(self, identified_devices, msg=None): Assert that IDENTIFIED_DEVICES contains all devices in VIRTUAL_DEVICE_TYPES.
- def t... | Implement the Python class `IdentifySmartSensorsTests` described below.
Class description:
Tests for `identify_smart_sensors`.
Method signatures and docstrings:
- def assert_all_devices_identified(self, identified_devices, msg=None): Assert that IDENTIFIED_DEVICES contains all devices in VIRTUAL_DEVICE_TYPES.
- def t... | fd8585663a7f0c1c159d3b4712e80d1ea27adaee | <|skeleton|>
class IdentifySmartSensorsTests:
"""Tests for `identify_smart_sensors`."""
def assert_all_devices_identified(self, identified_devices, msg=None):
"""Assert that IDENTIFIED_DEVICES contains all devices in VIRTUAL_DEVICE_TYPES."""
<|body_0|>
def test_detect_devices(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IdentifySmartSensorsTests:
"""Tests for `identify_smart_sensors`."""
def assert_all_devices_identified(self, identified_devices, msg=None):
"""Assert that IDENTIFIED_DEVICES contains all devices in VIRTUAL_DEVICE_TYPES."""
device_ids = map(hm.uid_to_device_id, identified_devices.values())... | the_stack_v2_python_sparse | hibike/hibike_tests/hibike_process_tests.py | SuperMaltese/PieCentral | train | 0 |
87afac5d563560c732ee67f5a3bdb97735b196f8 | [
"self.batch_size = 0\nself.games = np.asarray([])\nself.max_steps = game_config.game.duration * game_config.game.fps\nself.game_config = game_config\nself.pop_config = pop_config",
"genome_id, genome = genome\nstates = np.asarray([g.reset()[D_SENSOR_LIST] for g in self.games])\nfinished = np.repeat(False, self.ba... | <|body_start_0|>
self.batch_size = 0
self.games = np.asarray([])
self.max_steps = game_config.game.duration * game_config.game.fps
self.game_config = game_config
self.pop_config = pop_config
<|end_body_0|>
<|body_start_1|>
genome_id, genome = genome
states = np.a... | This class provides an environment to evaluate a single genome on multiple games. | MultiEnvironment | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiEnvironment:
"""This class provides an environment to evaluate a single genome on multiple games."""
def __init__(self, game_config: Config, pop_config: Config):
"""Create an environment in which the genomes get evaluated across different games. :param game_config: Config file f... | stack_v2_sparse_classes_36k_train_030029 | 7,283 | permissive | [
{
"docstring": "Create an environment in which the genomes get evaluated across different games. :param game_config: Config file for game-creation :param pop_config: Config file specifying how genome's network will be made",
"name": "__init__",
"signature": "def __init__(self, game_config: Config, pop_c... | 4 | null | Implement the Python class `MultiEnvironment` described below.
Class description:
This class provides an environment to evaluate a single genome on multiple games.
Method signatures and docstrings:
- def __init__(self, game_config: Config, pop_config: Config): Create an environment in which the genomes get evaluated ... | Implement the Python class `MultiEnvironment` described below.
Class description:
This class provides an environment to evaluate a single genome on multiple games.
Method signatures and docstrings:
- def __init__(self, game_config: Config, pop_config: Config): Create an environment in which the genomes get evaluated ... | 818a4ce941536611c0f1780f7c4a6238f0e1884e | <|skeleton|>
class MultiEnvironment:
"""This class provides an environment to evaluate a single genome on multiple games."""
def __init__(self, game_config: Config, pop_config: Config):
"""Create an environment in which the genomes get evaluated across different games. :param game_config: Config file f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiEnvironment:
"""This class provides an environment to evaluate a single genome on multiple games."""
def __init__(self, game_config: Config, pop_config: Config):
"""Create an environment in which the genomes get evaluated across different games. :param game_config: Config file for game-creat... | the_stack_v2_python_sparse | environment/env_multi.py | RubenPants/EvolvableRNN | train | 1 |
c3a8c7f4e389872df9d951fe78ea39b5b5daa9a1 | [
"self.surface = pygame.Surface(dim)\nself.pos = pos\nself.size = size\nself.color = color\nself.arcs = []\ncount = 10\npalette = get_rgb_color_gradient((50, 140, 70), (240, 0, 70), count)\nfor i in range(count):\n start_angle = random.randint(-360, 360)\n stop_angle = random.randint(-360, 360)\n width = 10... | <|body_start_0|>
self.surface = pygame.Surface(dim)
self.pos = pos
self.size = size
self.color = color
self.arcs = []
count = 10
palette = get_rgb_color_gradient((50, 140, 70), (240, 0, 70), count)
for i in range(count):
start_angle = random.ra... | Draw Superformula Object and vary some parameters on every frame | ArcAnimation | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArcAnimation:
"""Draw Superformula Object and vary some parameters on every frame"""
def __init__(self, dim: tuple, pos: pygame.Vector2, size: int, color: tuple):
"""animated superformula figure in 2D, altering some parameters every frame :param dim: dimension of surface to draw on :... | stack_v2_sparse_classes_36k_train_030030 | 5,052 | no_license | [
{
"docstring": "animated superformula figure in 2D, altering some parameters every frame :param dim: dimension of surface to draw on :param pos: position to set particle, center of particle :param size: size of particle :param color: color of particle :param parms: tuple oof four (m, n1, n2, n3)",
"name": "... | 2 | null | Implement the Python class `ArcAnimation` described below.
Class description:
Draw Superformula Object and vary some parameters on every frame
Method signatures and docstrings:
- def __init__(self, dim: tuple, pos: pygame.Vector2, size: int, color: tuple): animated superformula figure in 2D, altering some parameters ... | Implement the Python class `ArcAnimation` described below.
Class description:
Draw Superformula Object and vary some parameters on every frame
Method signatures and docstrings:
- def __init__(self, dim: tuple, pos: pygame.Vector2, size: int, color: tuple): animated superformula figure in 2D, altering some parameters ... | 1fd421195a2888c0588a49f5a043a1110eedcdbf | <|skeleton|>
class ArcAnimation:
"""Draw Superformula Object and vary some parameters on every frame"""
def __init__(self, dim: tuple, pos: pygame.Vector2, size: int, color: tuple):
"""animated superformula figure in 2D, altering some parameters every frame :param dim: dimension of surface to draw on :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ArcAnimation:
"""Draw Superformula Object and vary some parameters on every frame"""
def __init__(self, dim: tuple, pos: pygame.Vector2, size: int, color: tuple):
"""animated superformula figure in 2D, altering some parameters every frame :param dim: dimension of surface to draw on :param pos: po... | the_stack_v2_python_sparse | effects/CircleArcs.py | gunny26/pygame | train | 5 |
f2fd975bcf31650bc785d5a241aae312d13ee7d4 | [
"try:\n self.ID = hash(ID)\nexcept:\n raise TypeError('Item IDs must be hashable')\nself.data, self.keyCache = ({}, {})\nself.writeTracker = DeferredTracker()\nif url:\n self.i = items.Items(self.ID, url[0], **kw)\nelse:\n self.i = items.Items(self.ID)\nself.isPreloadMode = False",
"d = self.loadAll()... | <|body_start_0|>
try:
self.ID = hash(ID)
except:
raise TypeError('Item IDs must be hashable')
self.data, self.keyCache = ({}, {})
self.writeTracker = DeferredTracker()
if url:
self.i = items.Items(self.ID, url[0], **kw)
else:
... | I am a base class for a database-persistent dictionary-like object uniquely identified by the hashable constructor argument I{ID}. Before you use any instance of me, you must specify the parameters for creating an SQLAlchemy database engine. A single argument is used, which specifies a connection to a database via an R... | PersistentDictBase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PersistentDictBase:
"""I am a base class for a database-persistent dictionary-like object uniquely identified by the hashable constructor argument I{ID}. Before you use any instance of me, you must specify the parameters for creating an SQLAlchemy database engine. A single argument is used, which... | stack_v2_sparse_classes_36k_train_030031 | 15,255 | no_license | [
{
"docstring": "Instantiates me with an item store keyed to the supplied hashable I{ID}. Ensures that I have access to a class-wide instance of a L{Search} object so that I can update the database's full-text index when writing values containing text content. In addition to any engine-specifying keywords suppli... | 5 | stack_v2_sparse_classes_30k_train_020755 | Implement the Python class `PersistentDictBase` described below.
Class description:
I am a base class for a database-persistent dictionary-like object uniquely identified by the hashable constructor argument I{ID}. Before you use any instance of me, you must specify the parameters for creating an SQLAlchemy database e... | Implement the Python class `PersistentDictBase` described below.
Class description:
I am a base class for a database-persistent dictionary-like object uniquely identified by the hashable constructor argument I{ID}. Before you use any instance of me, you must specify the parameters for creating an SQLAlchemy database e... | f8e1fd067a1d001006163e8c3316029f37af139c | <|skeleton|>
class PersistentDictBase:
"""I am a base class for a database-persistent dictionary-like object uniquely identified by the hashable constructor argument I{ID}. Before you use any instance of me, you must specify the parameters for creating an SQLAlchemy database engine. A single argument is used, which... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PersistentDictBase:
"""I am a base class for a database-persistent dictionary-like object uniquely identified by the hashable constructor argument I{ID}. Before you use any instance of me, you must specify the parameters for creating an SQLAlchemy database engine. A single argument is used, which specifies a ... | the_stack_v2_python_sparse | src/dsem/lib/sasync/pdict.py | D3f0/txscada | train | 9 |
0d9c4334fc53e39470fd64725f5aff4c93626e94 | [
"section = Section('DEFAULT')\nsection['key1'] = 100\nsection['key2'] = 123.456\nsection['key3'] = 'True'\nsection['key4'] = '123'\nsection['key5'] = 'C:\\\\test\\\\nope\\\\red\\\\中文\\\\英文.jpg'\nsection['key6'] = False\nsection['key7'] = [1, -2, 3]\nsection['key8'] = [1.1, -2.2, 3.3]\nsection['key9'] = ['1', '1.1',... | <|body_start_0|>
section = Section('DEFAULT')
section['key1'] = 100
section['key2'] = 123.456
section['key3'] = 'True'
section['key4'] = '123'
section['key5'] = 'C:\\test\\nope\\red\\中文\\英文.jpg'
section['key6'] = False
section['key7'] = [1, -2, 3]
... | SectionUnittest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SectionUnittest:
def test_str(self):
"""测试__str__()方法是否能返回正确的字符串"""
<|body_0|>
def test_from_text(self):
"""测试from_text()方法能否将字符串解析成section"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
section = Section('DEFAULT')
section['key1'] = 100
... | stack_v2_sparse_classes_36k_train_030032 | 16,385 | no_license | [
{
"docstring": "测试__str__()方法是否能返回正确的字符串",
"name": "test_str",
"signature": "def test_str(self)"
},
{
"docstring": "测试from_text()方法能否将字符串解析成section",
"name": "test_from_text",
"signature": "def test_from_text(self)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000171 | Implement the Python class `SectionUnittest` described below.
Class description:
Implement the SectionUnittest class.
Method signatures and docstrings:
- def test_str(self): 测试__str__()方法是否能返回正确的字符串
- def test_from_text(self): 测试from_text()方法能否将字符串解析成section | Implement the Python class `SectionUnittest` described below.
Class description:
Implement the SectionUnittest class.
Method signatures and docstrings:
- def test_str(self): 测试__str__()方法是否能返回正确的字符串
- def test_from_text(self): 测试from_text()方法能否将字符串解析成section
<|skeleton|>
class SectionUnittest:
def test_str(self... | e4db975abf8566074cd610b1f026f858db047a9e | <|skeleton|>
class SectionUnittest:
def test_str(self):
"""测试__str__()方法是否能返回正确的字符串"""
<|body_0|>
def test_from_text(self):
"""测试from_text()方法能否将字符串解析成section"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SectionUnittest:
def test_str(self):
"""测试__str__()方法是否能返回正确的字符串"""
section = Section('DEFAULT')
section['key1'] = 100
section['key2'] = 123.456
section['key3'] = 'True'
section['key4'] = '123'
section['key5'] = 'C:\\test\\nope\\red\\中文\\英文.jpg'
... | the_stack_v2_python_sparse | angora/GADGET/configuration.py | MacHu-GWU/Angora | train | 0 | |
b6b65782dabc3ff499cfb958e6a1250c852f90b1 | [
"self.SetStartDate(2013, 10, 7)\nself.SetEndDate(2013, 10, 11)\nspy = self.AddEquity('SPY')\nibm = self.AddEquity('IBM')\nself._symbols = [spy.Symbol, ibm.Symbol]\nself._trin = self.TRIN(self._symbols, Resolution.Minute)\nself._trin2 = None",
"if self._trin.IsReady:\n self._trin.Reset()\n self.UnregisterInd... | <|body_start_0|>
self.SetStartDate(2013, 10, 7)
self.SetEndDate(2013, 10, 11)
spy = self.AddEquity('SPY')
ibm = self.AddEquity('IBM')
self._symbols = [spy.Symbol, ibm.Symbol]
self._trin = self.TRIN(self._symbols, Resolution.Minute)
self._trin2 = None
<|end_body_0|... | UnregisterIndicatorRegressionAlgorithm | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnregisterIndicatorRegressionAlgorithm:
def Initialize(self):
"""Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized."""
<|body_0|>
def OnData(self, data):
"""OnData event is the pri... | stack_v2_sparse_classes_36k_train_030033 | 2,225 | permissive | [
{
"docstring": "Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.",
"name": "Initialize",
"signature": "def Initialize(self)"
},
{
"docstring": "OnData event is the primary entry point for your algorithm. Eac... | 2 | stack_v2_sparse_classes_30k_train_015214 | Implement the Python class `UnregisterIndicatorRegressionAlgorithm` described below.
Class description:
Implement the UnregisterIndicatorRegressionAlgorithm class.
Method signatures and docstrings:
- def Initialize(self): Initialise the data and resolution required, as well as the cash and start-end dates for your al... | Implement the Python class `UnregisterIndicatorRegressionAlgorithm` described below.
Class description:
Implement the UnregisterIndicatorRegressionAlgorithm class.
Method signatures and docstrings:
- def Initialize(self): Initialise the data and resolution required, as well as the cash and start-end dates for your al... | b33dd3bc140e14b883f39ecf848a793cf7292277 | <|skeleton|>
class UnregisterIndicatorRegressionAlgorithm:
def Initialize(self):
"""Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized."""
<|body_0|>
def OnData(self, data):
"""OnData event is the pri... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UnregisterIndicatorRegressionAlgorithm:
def Initialize(self):
"""Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized."""
self.SetStartDate(2013, 10, 7)
self.SetEndDate(2013, 10, 11)
spy = self.... | the_stack_v2_python_sparse | Algorithm.Python/UnregisterIndicatorRegressionAlgorithm.py | Capnode/Algoloop | train | 87 | |
603a80e2eee4ce102e19ac312e463be5f612d5a9 | [
"if not self._parser:\n self._init_parser()\nargs = self._parser.parse_args(args)\nmapping = self._arg_to_choices\nfor k, v in vars(args).items():\n if k in mapping:\n setattr(args, k, mapping[k][v])\nreturn args",
"if not args[0].startswith('-'):\n raise ValueError('Only optional arguments can be... | <|body_start_0|>
if not self._parser:
self._init_parser()
args = self._parser.parse_args(args)
mapping = self._arg_to_choices
for k, v in vars(args).items():
if k in mapping:
setattr(args, k, mapping[k][v])
return args
<|end_body_0|>
<|bod... | Wrapper class around argparse.ArgumentParser. This class allow to defer the actual creation of the parser and can hence be used to modify some arguments (choices) before creating the real parser. | ArgParser | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArgParser:
"""Wrapper class around argparse.ArgumentParser. This class allow to defer the actual creation of the parser and can hence be used to modify some arguments (choices) before creating the real parser."""
def parse_args(self, args=None):
"""Parse the arguments. By default the... | stack_v2_sparse_classes_36k_train_030034 | 11,122 | permissive | [
{
"docstring": "Parse the arguments. By default the arguments passed on the command line are parsed.",
"name": "parse_args",
"signature": "def parse_args(self, args=None)"
},
{
"docstring": "Add an argument to the parser. See argparse documentation for the accepted arguments and their meaning.",... | 4 | null | Implement the Python class `ArgParser` described below.
Class description:
Wrapper class around argparse.ArgumentParser. This class allow to defer the actual creation of the parser and can hence be used to modify some arguments (choices) before creating the real parser.
Method signatures and docstrings:
- def parse_a... | Implement the Python class `ArgParser` described below.
Class description:
Wrapper class around argparse.ArgumentParser. This class allow to defer the actual creation of the parser and can hence be used to modify some arguments (choices) before creating the real parser.
Method signatures and docstrings:
- def parse_a... | bb003a0ec74b622e1fb0e1dbfdd052f43531bfbd | <|skeleton|>
class ArgParser:
"""Wrapper class around argparse.ArgumentParser. This class allow to defer the actual creation of the parser and can hence be used to modify some arguments (choices) before creating the real parser."""
def parse_args(self, args=None):
"""Parse the arguments. By default the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ArgParser:
"""Wrapper class around argparse.ArgumentParser. This class allow to defer the actual creation of the parser and can hence be used to modify some arguments (choices) before creating the real parser."""
def parse_args(self, args=None):
"""Parse the arguments. By default the arguments pa... | the_stack_v2_python_sparse | exopy/__main__.py | Exopy/exopy | train | 17 |
c8b2ca6de19c3c372573a4acf4791283971199ca | [
"self._host = host\nself._port = port\nif os.environ.get('TEST_MODE') != 'UNIT_TEST':\n self.connection = pika.BlockingConnection(pika.ConnectionParameters(host=self._host, port=self._port))\nself.sender_lock = threading.Lock()",
"while True:\n try:\n with self.sender_lock:\n with self.con... | <|body_start_0|>
self._host = host
self._port = port
if os.environ.get('TEST_MODE') != 'UNIT_TEST':
self.connection = pika.BlockingConnection(pika.ConnectionParameters(host=self._host, port=self._port))
self.sender_lock = threading.Lock()
<|end_body_0|>
<|body_start_1|>
... | The singleton - is a core API object for API class. | RabbitApi | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RabbitApi:
"""The singleton - is a core API object for API class."""
def __init__(self, host: str, port: int):
"""Constructor for RabbitApi class :param host (str): ip or hostname of Rabbitmq service :param port (int):port of Rabbitmq service"""
<|body_0|>
def emit(self,... | stack_v2_sparse_classes_36k_train_030035 | 2,095 | permissive | [
{
"docstring": "Constructor for RabbitApi class :param host (str): ip or hostname of Rabbitmq service :param port (int):port of Rabbitmq service",
"name": "__init__",
"signature": "def __init__(self, host: str, port: int)"
},
{
"docstring": "Function for sending events used by API.send() :param ... | 2 | stack_v2_sparse_classes_30k_train_012137 | Implement the Python class `RabbitApi` described below.
Class description:
The singleton - is a core API object for API class.
Method signatures and docstrings:
- def __init__(self, host: str, port: int): Constructor for RabbitApi class :param host (str): ip or hostname of Rabbitmq service :param port (int):port of R... | Implement the Python class `RabbitApi` described below.
Class description:
The singleton - is a core API object for API class.
Method signatures and docstrings:
- def __init__(self, host: str, port: int): Constructor for RabbitApi class :param host (str): ip or hostname of Rabbitmq service :param port (int):port of R... | 647ad6d7cc5f91c188aa45e403d9c1a33a7fe947 | <|skeleton|>
class RabbitApi:
"""The singleton - is a core API object for API class."""
def __init__(self, host: str, port: int):
"""Constructor for RabbitApi class :param host (str): ip or hostname of Rabbitmq service :param port (int):port of Rabbitmq service"""
<|body_0|>
def emit(self,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RabbitApi:
"""The singleton - is a core API object for API class."""
def __init__(self, host: str, port: int):
"""Constructor for RabbitApi class :param host (str): ip or hostname of Rabbitmq service :param port (int):port of Rabbitmq service"""
self._host = host
self._port = port... | the_stack_v2_python_sparse | main_node/tools/rabbit_API_class.py | dpukhkaiev/BRISE2 | train | 6 |
baa785734b1f9c9098f3b4f4bb083685230afe98 | [
"if not Flags.ARGS.pkg_version_prefix:\n Flags.ARGS.pkg_version_prefix = Packages.get_valid_package_prefix(GitUtil.get_latest_commit()[0:6])\nversion = self._packager.make_package(self._rule)\nif Flags.ARGS.pkg_version_path:\n with open(Flags.ARGS.pkg_version_path, 'a') as f:\n config = {}\n con... | <|body_start_0|>
if not Flags.ARGS.pkg_version_prefix:
Flags.ARGS.pkg_version_prefix = Packages.get_valid_package_prefix(GitUtil.get_latest_commit()[0:6])
version = self._packager.make_package(self._rule)
if Flags.ARGS.pkg_version_path:
with open(Flags.ARGS.pkg_version_pa... | Main class to handle all the packaging commands | Packager | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Packager:
"""Main class to handle all the packaging commands"""
def run(self):
"""build and create the package Returns: tuple(string, string) the package name followed by the package version name"""
<|body_0|>
def __init__(self, rule_name):
"""initializes the sta... | stack_v2_sparse_classes_36k_train_030036 | 3,469 | permissive | [
{
"docstring": "build and create the package Returns: tuple(string, string) the package name followed by the package version name",
"name": "run",
"signature": "def run(self)"
},
{
"docstring": "initializes the state Args: rule_name (string) - the rule name Raises: UnsupportedRuleError: raises e... | 2 | null | Implement the Python class `Packager` described below.
Class description:
Main class to handle all the packaging commands
Method signatures and docstrings:
- def run(self): build and create the package Returns: tuple(string, string) the package name followed by the package version name
- def __init__(self, rule_name)... | Implement the Python class `Packager` described below.
Class description:
Main class to handle all the packaging commands
Method signatures and docstrings:
- def run(self): build and create the package Returns: tuple(string, string) the package name followed by the package version name
- def __init__(self, rule_name)... | 70280110ec342a6f6db1c102e96756fcc3c3c01b | <|skeleton|>
class Packager:
"""Main class to handle all the packaging commands"""
def run(self):
"""build and create the package Returns: tuple(string, string) the package name followed by the package version name"""
<|body_0|>
def __init__(self, rule_name):
"""initializes the sta... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Packager:
"""Main class to handle all the packaging commands"""
def run(self):
"""build and create the package Returns: tuple(string, string) the package name followed by the package version name"""
if not Flags.ARGS.pkg_version_prefix:
Flags.ARGS.pkg_version_prefix = Packages... | the_stack_v2_python_sparse | pylib/mps/packager/packager.py | room77/py77 | train | 0 |
05e71eeab763f5e05ae6c5c6fb43f18fd78136c1 | [
"super().pre_run(step, level_number)\nL = step.levels[level_number]\nself.add_to_stats(process=0, time=0, level=0, iter=0, sweep=0, type='u0', value=L.u[0])",
"super().post_step(step, level_number)\nL = step.levels[level_number]\nself.add_to_stats(process=step.status.slot, time=L.time, level=L.level_index, iter=s... | <|body_start_0|>
super().pre_run(step, level_number)
L = step.levels[level_number]
self.add_to_stats(process=0, time=0, level=0, iter=0, sweep=0, type='u0', value=L.u[0])
<|end_body_0|>
<|body_start_1|>
super().post_step(step, level_number)
L = step.levels[level_number]
... | Record data required for analysis of problems in the resilience project | LogData | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LogData:
"""Record data required for analysis of problems in the resilience project"""
def pre_run(self, step, level_number):
"""Record initial conditions"""
<|body_0|>
def post_step(self, step, level_number):
"""Record final solutions as well as step size and er... | stack_v2_sparse_classes_36k_train_030037 | 3,815 | permissive | [
{
"docstring": "Record initial conditions",
"name": "pre_run",
"signature": "def pre_run(self, step, level_number)"
},
{
"docstring": "Record final solutions as well as step size and error estimates",
"name": "post_step",
"signature": "def post_step(self, step, level_number)"
}
] | 2 | null | Implement the Python class `LogData` described below.
Class description:
Record data required for analysis of problems in the resilience project
Method signatures and docstrings:
- def pre_run(self, step, level_number): Record initial conditions
- def post_step(self, step, level_number): Record final solutions as wel... | Implement the Python class `LogData` described below.
Class description:
Record data required for analysis of problems in the resilience project
Method signatures and docstrings:
- def pre_run(self, step, level_number): Record initial conditions
- def post_step(self, step, level_number): Record final solutions as wel... | 1a51834bedffd4472e344bed28f4d766614b1537 | <|skeleton|>
class LogData:
"""Record data required for analysis of problems in the resilience project"""
def pre_run(self, step, level_number):
"""Record initial conditions"""
<|body_0|>
def post_step(self, step, level_number):
"""Record final solutions as well as step size and er... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LogData:
"""Record data required for analysis of problems in the resilience project"""
def pre_run(self, step, level_number):
"""Record initial conditions"""
super().pre_run(step, level_number)
L = step.levels[level_number]
self.add_to_stats(process=0, time=0, level=0, ite... | the_stack_v2_python_sparse | pySDC/projects/Resilience/hook.py | Parallel-in-Time/pySDC | train | 30 |
90feda40c4d5771f5c37975f4a33a63c05c4f0c3 | [
"super().__init__()\nself._level = level\nself.image = pygame.Surface((width, height), pygame.SRCALPHA)\nself._visualize(width, height)\nself.rect = self.image.get_rect()\nself.rect.midbottom = (x_coordinate, y_coordinate)",
"self.rect.x -= self._level.speed\nif self.rect.right < 0:\n self.kill()",
"black = ... | <|body_start_0|>
super().__init__()
self._level = level
self.image = pygame.Surface((width, height), pygame.SRCALPHA)
self._visualize(width, height)
self.rect = self.image.get_rect()
self.rect.midbottom = (x_coordinate, y_coordinate)
<|end_body_0|>
<|body_start_1|>
... | A class to represent obstacle object at the game level. Attributes: level: Level object x_coordinate: Spawn location at the x-axis. y_coordinate: Spawn location at the y-axis. width: Width of the obstacle object. heigth: Heigth of the obstacle object. | Obstacle | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Obstacle:
"""A class to represent obstacle object at the game level. Attributes: level: Level object x_coordinate: Spawn location at the x-axis. y_coordinate: Spawn location at the y-axis. width: Width of the obstacle object. heigth: Heigth of the obstacle object."""
def __init__(self, level... | stack_v2_sparse_classes_36k_train_030038 | 1,926 | no_license | [
{
"docstring": "Constructs all the necessary attributes for the obstacle object. Args: level (Level): Level object x_coordinate (int): Spawn location at the x-axis. y_coordinate (int): Spawn location at the y-axis. width (int): Width of the obstacle object. height (int): Heigth of the obstacle object.",
"na... | 3 | stack_v2_sparse_classes_30k_train_006060 | Implement the Python class `Obstacle` described below.
Class description:
A class to represent obstacle object at the game level. Attributes: level: Level object x_coordinate: Spawn location at the x-axis. y_coordinate: Spawn location at the y-axis. width: Width of the obstacle object. heigth: Heigth of the obstacle o... | Implement the Python class `Obstacle` described below.
Class description:
A class to represent obstacle object at the game level. Attributes: level: Level object x_coordinate: Spawn location at the x-axis. y_coordinate: Spawn location at the y-axis. width: Width of the obstacle object. heigth: Heigth of the obstacle o... | 29cd15dddff620de068a479595a5cb9aba855343 | <|skeleton|>
class Obstacle:
"""A class to represent obstacle object at the game level. Attributes: level: Level object x_coordinate: Spawn location at the x-axis. y_coordinate: Spawn location at the y-axis. width: Width of the obstacle object. heigth: Heigth of the obstacle object."""
def __init__(self, level... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Obstacle:
"""A class to represent obstacle object at the game level. Attributes: level: Level object x_coordinate: Spawn location at the x-axis. y_coordinate: Spawn location at the y-axis. width: Width of the obstacle object. heigth: Heigth of the obstacle object."""
def __init__(self, level, x_coordinat... | the_stack_v2_python_sparse | src/entities/obstacle.py | TopiasHarjunpaa/ot-harjoitustyo | train | 0 |
01b54eb12e1dc4f7a3bbefc9bfa5cc5a09879992 | [
"BaseMechanicsSolver.class_name = 'SolidMechanicsSolver'\nBaseMechanicsSolver.__init__(self, problem, fname_pressure=fname_pressure, fname_hdf5=fname_hdf5, fname_xdmf=fname_xdmf)\nself._fnames.update(disp=fname_disp)\nself._file_disp = _create_file_objects(fname_disp)\nreturn None",
"problem = self._problem\ninco... | <|body_start_0|>
BaseMechanicsSolver.class_name = 'SolidMechanicsSolver'
BaseMechanicsSolver.__init__(self, problem, fname_pressure=fname_pressure, fname_hdf5=fname_hdf5, fname_xdmf=fname_xdmf)
self._fnames.update(disp=fname_disp)
self._file_disp = _create_file_objects(fname_disp)
... | This class is derived from the dolfin.NonlinearVariationalSolver to solve problems formulated with SolidMechanicsProblem. It passes the UFL variational forms to the solver, and loops through all time steps if the problem is unsteady. The solvers that are available through this class are the same as those available thro... | SolidMechanicsSolver | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SolidMechanicsSolver:
"""This class is derived from the dolfin.NonlinearVariationalSolver to solve problems formulated with SolidMechanicsProblem. It passes the UFL variational forms to the solver, and loops through all time steps if the problem is unsteady. The solvers that are available through... | stack_v2_sparse_classes_36k_train_030039 | 33,832 | permissive | [
{
"docstring": "Initialize a SolidMechanicsSolver object. Parameters ---------- problem : SolidMechanicsProblem A SolidMechanicsProblem object that contains the necessary UFL forms to define and solve the problem specified in a config dictionary. fname_disp : str (default None) Name of the file series in which ... | 3 | stack_v2_sparse_classes_30k_train_013282 | Implement the Python class `SolidMechanicsSolver` described below.
Class description:
This class is derived from the dolfin.NonlinearVariationalSolver to solve problems formulated with SolidMechanicsProblem. It passes the UFL variational forms to the solver, and loops through all time steps if the problem is unsteady.... | Implement the Python class `SolidMechanicsSolver` described below.
Class description:
This class is derived from the dolfin.NonlinearVariationalSolver to solve problems formulated with SolidMechanicsProblem. It passes the UFL variational forms to the solver, and loops through all time steps if the problem is unsteady.... | 632609a5eea1def5d079d62e818aabbdfd3727dd | <|skeleton|>
class SolidMechanicsSolver:
"""This class is derived from the dolfin.NonlinearVariationalSolver to solve problems formulated with SolidMechanicsProblem. It passes the UFL variational forms to the solver, and loops through all time steps if the problem is unsteady. The solvers that are available through... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SolidMechanicsSolver:
"""This class is derived from the dolfin.NonlinearVariationalSolver to solve problems formulated with SolidMechanicsProblem. It passes the UFL variational forms to the solver, and loops through all time steps if the problem is unsteady. The solvers that are available through this class a... | the_stack_v2_python_sparse | fenicsmechanics/solidmechanics.py | Tatha911/SOFTX_2018_73 | train | 0 |
fb10f6d6998c8c810fe9818015376f0b41ba7a02 | [
"if value is not None:\n assert value.tzinfo == timezone.utc, f\"Expected '{value}' to be UTC\"\nreturn value",
"if value is not None:\n assert value.tzinfo is None\n return value.replace(tzinfo=timezone.utc)\nreturn None"
] | <|body_start_0|>
if value is not None:
assert value.tzinfo == timezone.utc, f"Expected '{value}' to be UTC"
return value
<|end_body_0|>
<|body_start_1|>
if value is not None:
assert value.tzinfo is None
return value.replace(tzinfo=timezone.utc)
return... | A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. Motivation: We generally want our datetimes to have a UTC timezone so they're u... | UTCDateTime | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UTCDateTime:
"""A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. Motivation: We generally want our dateti... | stack_v2_sparse_classes_36k_train_030040 | 2,273 | permissive | [
{
"docstring": "Prepare a Python datetime object to inserted into SQL via SQLAlchemy.",
"name": "process_bind_param",
"signature": "def process_bind_param(self, value: Optional[datetime], dialect: object) -> Optional[datetime]"
},
{
"docstring": "Process a Python datetime object that SQLAlchemy ... | 2 | stack_v2_sparse_classes_30k_test_000146 | Implement the Python class `UTCDateTime` described below.
Class description:
A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. M... | Implement the Python class `UTCDateTime` described below.
Class description:
A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. M... | 026b523c8c9e5d45910c490efb89194d72595be9 | <|skeleton|>
class UTCDateTime:
"""A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. Motivation: We generally want our dateti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UTCDateTime:
"""A SQL column type to store UTC datetimes. Usage example: table = sqlalchemy.Table( ... sqlalchemy.Column("my_datetime_column", UTCDateTime) ) Opentrons robot-server code should always use this instead of SQLAlchemy's built-in DateTime type. Motivation: We generally want our datetimes to have a... | the_stack_v2_python_sparse | robot-server/robot_server/persistence/_utc_datetime.py | Opentrons/opentrons | train | 326 |
7c56c7818b568bfd8f17c80fc95956e8ee7542f8 | [
"iterator = self.process_video if self.vid_cap else self.process_frames\nfor item in iterator():\n yield item",
"logger.info('Loading file list from %s', self.folder)\nfor frame in os.listdir(self.folder):\n if not self.valid_extension(frame):\n continue\n filename = os.path.splitext(frame)[0]\n ... | <|body_start_0|>
iterator = self.process_video if self.vid_cap else self.process_frames
for item in iterator():
yield item
<|end_body_0|>
<|body_start_1|>
logger.info('Loading file list from %s', self.folder)
for frame in os.listdir(self.folder):
if not self.vali... | Object to hold the frames that are to be checked against | Frames | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Frames:
"""Object to hold the frames that are to be checked against"""
def process_folder(self):
"""Iterate through the frames dir pulling the base filename"""
<|body_0|>
def process_frames(self):
"""Process exported Frames"""
<|body_1|>
def process_... | stack_v2_sparse_classes_36k_train_030041 | 13,433 | permissive | [
{
"docstring": "Iterate through the frames dir pulling the base filename",
"name": "process_folder",
"signature": "def process_folder(self)"
},
{
"docstring": "Process exported Frames",
"name": "process_frames",
"signature": "def process_frames(self)"
},
{
"docstring": "Dummy in ... | 5 | null | Implement the Python class `Frames` described below.
Class description:
Object to hold the frames that are to be checked against
Method signatures and docstrings:
- def process_folder(self): Iterate through the frames dir pulling the base filename
- def process_frames(self): Process exported Frames
- def process_vide... | Implement the Python class `Frames` described below.
Class description:
Object to hold the frames that are to be checked against
Method signatures and docstrings:
- def process_folder(self): Iterate through the frames dir pulling the base filename
- def process_frames(self): Process exported Frames
- def process_vide... | e507f94d4f5d74c36e41c386c6fb14bb745a4885 | <|skeleton|>
class Frames:
"""Object to hold the frames that are to be checked against"""
def process_folder(self):
"""Iterate through the frames dir pulling the base filename"""
<|body_0|>
def process_frames(self):
"""Process exported Frames"""
<|body_1|>
def process_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Frames:
"""Object to hold the frames that are to be checked against"""
def process_folder(self):
"""Iterate through the frames dir pulling the base filename"""
iterator = self.process_video if self.vid_cap else self.process_frames
for item in iterator():
yield item
... | the_stack_v2_python_sparse | tools/lib_alignments/media.py | oveis/DeepVideoFaceSwap | train | 6 |
c1dd343ce4c81426613f70d8ef7c0458d47866d1 | [
"self._ir_api = irish_rail\nself.station = station\nself.direction = direction\nself.destination = destination\nself.stops_at = stops_at\nself.info = self._empty_train_data()",
"trains = self._ir_api.get_station_by_name(self.station, direction=self.direction, destination=self.destination, stops_at=self.stops_at)\... | <|body_start_0|>
self._ir_api = irish_rail
self.station = station
self.direction = direction
self.destination = destination
self.stops_at = stops_at
self.info = self._empty_train_data()
<|end_body_0|>
<|body_start_1|>
trains = self._ir_api.get_station_by_name(sel... | The Class for handling the data retrieval. | IrishRailTransportData | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IrishRailTransportData:
"""The Class for handling the data retrieval."""
def __init__(self, irish_rail, station, direction, destination, stops_at):
"""Initialize the data object."""
<|body_0|>
def update(self):
"""Get the latest data from irishrail."""
<|... | stack_v2_sparse_classes_36k_train_030042 | 6,444 | permissive | [
{
"docstring": "Initialize the data object.",
"name": "__init__",
"signature": "def __init__(self, irish_rail, station, direction, destination, stops_at)"
},
{
"docstring": "Get the latest data from irishrail.",
"name": "update",
"signature": "def update(self)"
},
{
"docstring": ... | 3 | stack_v2_sparse_classes_30k_train_004542 | Implement the Python class `IrishRailTransportData` described below.
Class description:
The Class for handling the data retrieval.
Method signatures and docstrings:
- def __init__(self, irish_rail, station, direction, destination, stops_at): Initialize the data object.
- def update(self): Get the latest data from iri... | Implement the Python class `IrishRailTransportData` described below.
Class description:
The Class for handling the data retrieval.
Method signatures and docstrings:
- def __init__(self, irish_rail, station, direction, destination, stops_at): Initialize the data object.
- def update(self): Get the latest data from iri... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class IrishRailTransportData:
"""The Class for handling the data retrieval."""
def __init__(self, irish_rail, station, direction, destination, stops_at):
"""Initialize the data object."""
<|body_0|>
def update(self):
"""Get the latest data from irishrail."""
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IrishRailTransportData:
"""The Class for handling the data retrieval."""
def __init__(self, irish_rail, station, direction, destination, stops_at):
"""Initialize the data object."""
self._ir_api = irish_rail
self.station = station
self.direction = direction
self.de... | the_stack_v2_python_sparse | homeassistant/components/irish_rail_transport/sensor.py | home-assistant/core | train | 35,501 |
c4d8c3d2af017a29b0e4a95688802e8f77ab5b9f | [
"kappa = 0.5\nnt_dist = (0.25, 0.25, 0.25, 0.25)\nmodel = F84.create_rate_matrix(kappa, nt_dist)\nsequence_pair = ('AAAA', 'ACGT')\nt = 2.0\nresult = get_log_likelihood(t, sequence_pair, model)",
"sequence_pair = ('AAAAAAAAAACCCCCCCCCC', 'ATGGGGGGGGCGTTTTTTTT')\nuniform_nt_dist = (0.25, 0.25, 0.25, 0.25)\nmore_li... | <|body_start_0|>
kappa = 0.5
nt_dist = (0.25, 0.25, 0.25, 0.25)
model = F84.create_rate_matrix(kappa, nt_dist)
sequence_pair = ('AAAA', 'ACGT')
t = 2.0
result = get_log_likelihood(t, sequence_pair, model)
<|end_body_0|>
<|body_start_1|>
sequence_pair = ('AAAAAAAA... | TestPairLikelihood | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestPairLikelihood:
def test_basic_log_likelihood(self):
"""Assert that the log likelihood function does not give an error for simple input."""
<|body_0|>
def test_unequal_log_likelihood(self):
"""Assert that the log likelihood function gives greater log likelihood t... | stack_v2_sparse_classes_36k_train_030043 | 5,792 | no_license | [
{
"docstring": "Assert that the log likelihood function does not give an error for simple input.",
"name": "test_basic_log_likelihood",
"signature": "def test_basic_log_likelihood(self)"
},
{
"docstring": "Assert that the log likelihood function gives greater log likelihood to the more likely ch... | 3 | null | Implement the Python class `TestPairLikelihood` described below.
Class description:
Implement the TestPairLikelihood class.
Method signatures and docstrings:
- def test_basic_log_likelihood(self): Assert that the log likelihood function does not give an error for simple input.
- def test_unequal_log_likelihood(self):... | Implement the Python class `TestPairLikelihood` described below.
Class description:
Implement the TestPairLikelihood class.
Method signatures and docstrings:
- def test_basic_log_likelihood(self): Assert that the log likelihood function does not give an error for simple input.
- def test_unequal_log_likelihood(self):... | 91c6f8331f18c914eb3dfc51bc166915998c5081 | <|skeleton|>
class TestPairLikelihood:
def test_basic_log_likelihood(self):
"""Assert that the log likelihood function does not give an error for simple input."""
<|body_0|>
def test_unequal_log_likelihood(self):
"""Assert that the log likelihood function gives greater log likelihood t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestPairLikelihood:
def test_basic_log_likelihood(self):
"""Assert that the log likelihood function does not give an error for simple input."""
kappa = 0.5
nt_dist = (0.25, 0.25, 0.25, 0.25)
model = F84.create_rate_matrix(kappa, nt_dist)
sequence_pair = ('AAAA', 'ACGT')... | the_stack_v2_python_sparse | PairLikelihood.py | argriffing/xgcode | train | 1 | |
f8865b651726b6cdbb7c1a833ff4ec0c5b52ff55 | [
"self.id = id\nself.insurance_centre_id = insurance_centre_id\nself.question = question\nself.answer = answer\nself.sort_priority = sort_priority\nself.question_group_param_id = question_group_param_id\nself.is_active = is_active\nself.the_insurance_centre = the_insurance_centre\nself.the_question_group_param = the... | <|body_start_0|>
self.id = id
self.insurance_centre_id = insurance_centre_id
self.question = question
self.answer = answer
self.sort_priority = sort_priority
self.question_group_param_id = question_group_param_id
self.is_active = is_active
self.the_insuran... | Implementation of the 'Faq/InsuranceCentre' model. TODO: type model description here. Attributes: id (int): TODO: type description here. insurance_centre_id (int): TODO: type description here. question (string): TODO: type description here. answer (string): TODO: type description here. sort_priority (int): TODO: type d... | FaqInsuranceCentre | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FaqInsuranceCentre:
"""Implementation of the 'Faq/InsuranceCentre' model. TODO: type model description here. Attributes: id (int): TODO: type description here. insurance_centre_id (int): TODO: type description here. question (string): TODO: type description here. answer (string): TODO: type descr... | stack_v2_sparse_classes_36k_train_030044 | 5,405 | permissive | [
{
"docstring": "Constructor for the FaqInsuranceCentre class",
"name": "__init__",
"signature": "def __init__(self, id=None, insurance_centre_id=None, question=None, answer=None, question_group_param_id=None, is_active=None, create_on=None, update_on=None, created_by=None, create_on_persian_date=None, u... | 2 | stack_v2_sparse_classes_30k_train_015196 | Implement the Python class `FaqInsuranceCentre` described below.
Class description:
Implementation of the 'Faq/InsuranceCentre' model. TODO: type model description here. Attributes: id (int): TODO: type description here. insurance_centre_id (int): TODO: type description here. question (string): TODO: type description ... | Implement the Python class `FaqInsuranceCentre` described below.
Class description:
Implementation of the 'Faq/InsuranceCentre' model. TODO: type model description here. Attributes: id (int): TODO: type description here. insurance_centre_id (int): TODO: type description here. question (string): TODO: type description ... | b574a76a8805b306a423229b572c36dae0159def | <|skeleton|>
class FaqInsuranceCentre:
"""Implementation of the 'Faq/InsuranceCentre' model. TODO: type model description here. Attributes: id (int): TODO: type description here. insurance_centre_id (int): TODO: type description here. question (string): TODO: type description here. answer (string): TODO: type descr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FaqInsuranceCentre:
"""Implementation of the 'Faq/InsuranceCentre' model. TODO: type model description here. Attributes: id (int): TODO: type description here. insurance_centre_id (int): TODO: type description here. question (string): TODO: type description here. answer (string): TODO: type description here. ... | the_stack_v2_python_sparse | easybimehlanding/models/faq_insurance_centre.py | kmelodi/EasyBimehLanding_Python | train | 0 |
930c34d4658427fea1abe0938cc33bec875494be | [
"super().__init__()\nself.error_string = error_string\nself.error_code = error_code",
"if self.error_code is None:\n return self.error_string\nelse:\n return self.error_code + ' : ' + self.error_string"
] | <|body_start_0|>
super().__init__()
self.error_string = error_string
self.error_code = error_code
<|end_body_0|>
<|body_start_1|>
if self.error_code is None:
return self.error_string
else:
return self.error_code + ' : ' + self.error_string
<|end_body_1|>
| DBException Class | DBException | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DBException:
"""DBException Class"""
def __init__(self, error_string, error_code=None):
"""Instantiate DBException class object"""
<|body_0|>
def get_message(self):
"""Returning error message"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super... | stack_v2_sparse_classes_36k_train_030045 | 513 | no_license | [
{
"docstring": "Instantiate DBException class object",
"name": "__init__",
"signature": "def __init__(self, error_string, error_code=None)"
},
{
"docstring": "Returning error message",
"name": "get_message",
"signature": "def get_message(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014904 | Implement the Python class `DBException` described below.
Class description:
DBException Class
Method signatures and docstrings:
- def __init__(self, error_string, error_code=None): Instantiate DBException class object
- def get_message(self): Returning error message | Implement the Python class `DBException` described below.
Class description:
DBException Class
Method signatures and docstrings:
- def __init__(self, error_string, error_code=None): Instantiate DBException class object
- def get_message(self): Returning error message
<|skeleton|>
class DBException:
"""DBExceptio... | 0a16a9905a3b0689e3186c76089a99000a4c649d | <|skeleton|>
class DBException:
"""DBException Class"""
def __init__(self, error_string, error_code=None):
"""Instantiate DBException class object"""
<|body_0|>
def get_message(self):
"""Returning error message"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DBException:
"""DBException Class"""
def __init__(self, error_string, error_code=None):
"""Instantiate DBException class object"""
super().__init__()
self.error_string = error_string
self.error_code = error_code
def get_message(self):
"""Returning error messag... | the_stack_v2_python_sparse | com/itt/tds/db/exceptions/DBException.py | mukultaneja/TaskDistributionSystem | train | 0 |
79acc4c1457c3c68a88850b7946cb2970491229b | [
"self.repository = repository\nself.key = key\nself.img_bytes_io = None\nsuper(LoadImage, self).__init__(prefix='LI', phase_name='Load image', invocation_id=invocation_id)",
"if not self.__load_image():\n return False\nreturn True",
"status, response, img_bytes_io = self.repository.load_file_as_bytes_io(self... | <|body_start_0|>
self.repository = repository
self.key = key
self.img_bytes_io = None
super(LoadImage, self).__init__(prefix='LI', phase_name='Load image', invocation_id=invocation_id)
<|end_body_0|>
<|body_start_1|>
if not self.__load_image():
return False
r... | Image loading object, responsible for preparing the file storage structure, accessing the blob storage API, and evaluating the response. | LoadImage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoadImage:
"""Image loading object, responsible for preparing the file storage structure, accessing the blob storage API, and evaluating the response."""
def __init__(self, repository, key: str, invocation_id: str):
"""Constructor of the load image object, stores provided and locally... | stack_v2_sparse_classes_36k_train_030046 | 2,233 | no_license | [
{
"docstring": "Constructor of the load image object, stores provided and locally generated data, runs main object procedure. :param repository: selected repository to work upon. :param key: string containing stored image name. :param invocation_id: string containing id of current cloud function invocation to b... | 3 | stack_v2_sparse_classes_30k_train_000799 | Implement the Python class `LoadImage` described below.
Class description:
Image loading object, responsible for preparing the file storage structure, accessing the blob storage API, and evaluating the response.
Method signatures and docstrings:
- def __init__(self, repository, key: str, invocation_id: str): Construc... | Implement the Python class `LoadImage` described below.
Class description:
Image loading object, responsible for preparing the file storage structure, accessing the blob storage API, and evaluating the response.
Method signatures and docstrings:
- def __init__(self, repository, key: str, invocation_id: str): Construc... | 8f1b94518303c4e0a38df1ff6caa0e7326451d67 | <|skeleton|>
class LoadImage:
"""Image loading object, responsible for preparing the file storage structure, accessing the blob storage API, and evaluating the response."""
def __init__(self, repository, key: str, invocation_id: str):
"""Constructor of the load image object, stores provided and locally... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoadImage:
"""Image loading object, responsible for preparing the file storage structure, accessing the blob storage API, and evaluating the response."""
def __init__(self, repository, key: str, invocation_id: str):
"""Constructor of the load image object, stores provided and locally generated da... | the_stack_v2_python_sparse | Serverless/handlers/s3_generate_thumbnail/load_image.py | RogerVFbr/MyCelebs | train | 0 |
986c9ee24b0f0fa54c77baaf71d188c6f623bef1 | [
"G = 0\nfor s, a, r in zip(reversed(states[:-1]), reversed(actions), reversed(rewards)):\n G = r + gamma * G\n if alpha:\n self.Q[s, a] = self.Q[s, a] + alpha * (G - self.Q[s, a])\n else:\n self.Q[s, a] = self.Q[s, a] + 1 / self.n[s, a] * (G - self.Q[s, a])",
"steps, reward = ([], [])\nfor ... | <|body_start_0|>
G = 0
for s, a, r in zip(reversed(states[:-1]), reversed(actions), reversed(rewards)):
G = r + gamma * G
if alpha:
self.Q[s, a] = self.Q[s, a] + alpha * (G - self.Q[s, a])
else:
self.Q[s, a] = self.Q[s, a] + 1 / self.n[... | MonteCarlo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MonteCarlo:
def update(self, states, actions, rewards, alpha=None, gamma=1):
"""update Q function based on trajectory of states, actions, and rewards"""
<|body_0|>
def train(self, iterations=1000, epsilon=0, alpha=None, gamma=1):
"""train agent"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_030047 | 7,134 | no_license | [
{
"docstring": "update Q function based on trajectory of states, actions, and rewards",
"name": "update",
"signature": "def update(self, states, actions, rewards, alpha=None, gamma=1)"
},
{
"docstring": "train agent",
"name": "train",
"signature": "def train(self, iterations=1000, epsilo... | 2 | stack_v2_sparse_classes_30k_train_019125 | Implement the Python class `MonteCarlo` described below.
Class description:
Implement the MonteCarlo class.
Method signatures and docstrings:
- def update(self, states, actions, rewards, alpha=None, gamma=1): update Q function based on trajectory of states, actions, and rewards
- def train(self, iterations=1000, epsi... | Implement the Python class `MonteCarlo` described below.
Class description:
Implement the MonteCarlo class.
Method signatures and docstrings:
- def update(self, states, actions, rewards, alpha=None, gamma=1): update Q function based on trajectory of states, actions, and rewards
- def train(self, iterations=1000, epsi... | ab6216a00f30cb5c3ea896b7a0fda7f01845c206 | <|skeleton|>
class MonteCarlo:
def update(self, states, actions, rewards, alpha=None, gamma=1):
"""update Q function based on trajectory of states, actions, and rewards"""
<|body_0|>
def train(self, iterations=1000, epsilon=0, alpha=None, gamma=1):
"""train agent"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MonteCarlo:
def update(self, states, actions, rewards, alpha=None, gamma=1):
"""update Q function based on trajectory of states, actions, and rewards"""
G = 0
for s, a, r in zip(reversed(states[:-1]), reversed(actions), reversed(rewards)):
G = r + gamma * G
if a... | the_stack_v2_python_sparse | gridworld/rickgrid/Agents.py | richard-warren/rl_sandbox | train | 0 | |
1bebf5d0ceac2ebb9379f272ee52d5b9dac018d6 | [
"key = LibraryUsageLocatorV2.from_string(usage_key_str)\napi.require_permission_for_library_key(key.lib_key, request.user, permissions.CAN_VIEW_THIS_CONTENT_LIBRARY)\nfiles = api.get_library_block_static_asset_files(key)\nfor f in files:\n if f.path == file_path:\n return Response(LibraryXBlockStaticFileS... | <|body_start_0|>
key = LibraryUsageLocatorV2.from_string(usage_key_str)
api.require_permission_for_library_key(key.lib_key, request.user, permissions.CAN_VIEW_THIS_CONTENT_LIBRARY)
files = api.get_library_block_static_asset_files(key)
for f in files:
if f.path == file_path:
... | Views to work with an existing XBlock's static asset files | LibraryBlockAssetView | [
"AGPL-3.0-only",
"AGPL-3.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LibraryBlockAssetView:
"""Views to work with an existing XBlock's static asset files"""
def get(self, request, usage_key_str, file_path):
"""Get a static asset file belonging to this block."""
<|body_0|>
def put(self, request, usage_key_str, file_path):
"""Replac... | stack_v2_sparse_classes_36k_train_030048 | 42,120 | permissive | [
{
"docstring": "Get a static asset file belonging to this block.",
"name": "get",
"signature": "def get(self, request, usage_key_str, file_path)"
},
{
"docstring": "Replace a static asset file belonging to this block.",
"name": "put",
"signature": "def put(self, request, usage_key_str, f... | 3 | null | Implement the Python class `LibraryBlockAssetView` described below.
Class description:
Views to work with an existing XBlock's static asset files
Method signatures and docstrings:
- def get(self, request, usage_key_str, file_path): Get a static asset file belonging to this block.
- def put(self, request, usage_key_st... | Implement the Python class `LibraryBlockAssetView` described below.
Class description:
Views to work with an existing XBlock's static asset files
Method signatures and docstrings:
- def get(self, request, usage_key_str, file_path): Get a static asset file belonging to this block.
- def put(self, request, usage_key_st... | 5809eaca7079a15ee56b0b7fcfea425337046c97 | <|skeleton|>
class LibraryBlockAssetView:
"""Views to work with an existing XBlock's static asset files"""
def get(self, request, usage_key_str, file_path):
"""Get a static asset file belonging to this block."""
<|body_0|>
def put(self, request, usage_key_str, file_path):
"""Replac... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LibraryBlockAssetView:
"""Views to work with an existing XBlock's static asset files"""
def get(self, request, usage_key_str, file_path):
"""Get a static asset file belonging to this block."""
key = LibraryUsageLocatorV2.from_string(usage_key_str)
api.require_permission_for_librar... | the_stack_v2_python_sparse | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/content_libraries/views.py | luque/better-ways-of-thinking-about-software | train | 3 |
57afabfaf156351e8508aa1f86d0a664f6549914 | [
"if not root:\n return False\nif not root.left and (not root.right):\n return root.val == sum\nreturn self.hasPathSum(root.left, sum - root.val) or self.hasPathSum(root.right, sum - root.val)",
"if not root:\n return False\nstack = [(root.val, root)]\nwhile stack:\n value, node = stack.pop()\n if n... | <|body_start_0|>
if not root:
return False
if not root.left and (not root.right):
return root.val == sum
return self.hasPathSum(root.left, sum - root.val) or self.hasPathSum(root.right, sum - root.val)
<|end_body_0|>
<|body_start_1|>
if not root:
retu... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hasPathSum(self, root: TreeNode, sum: int) -> bool:
"""递归 到某个节点时,判断其是否是叶子节点并且值是否等于sum 若不是,则递归判断左右子树 注: 递归判断时,需要减去当前root的值"""
<|body_0|>
def hasPathSum_1(self, root: TreeNode, sum: int) -> bool:
"""迭代 每次把之前节点的值加起来"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_030049 | 1,824 | no_license | [
{
"docstring": "递归 到某个节点时,判断其是否是叶子节点并且值是否等于sum 若不是,则递归判断左右子树 注: 递归判断时,需要减去当前root的值",
"name": "hasPathSum",
"signature": "def hasPathSum(self, root: TreeNode, sum: int) -> bool"
},
{
"docstring": "迭代 每次把之前节点的值加起来",
"name": "hasPathSum_1",
"signature": "def hasPathSum_1(self, root: TreeNod... | 2 | stack_v2_sparse_classes_30k_train_018690 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasPathSum(self, root: TreeNode, sum: int) -> bool: 递归 到某个节点时,判断其是否是叶子节点并且值是否等于sum 若不是,则递归判断左右子树 注: 递归判断时,需要减去当前root的值
- def hasPathSum_1(self, root: TreeNode, sum: int) -> b... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasPathSum(self, root: TreeNode, sum: int) -> bool: 递归 到某个节点时,判断其是否是叶子节点并且值是否等于sum 若不是,则递归判断左右子树 注: 递归判断时,需要减去当前root的值
- def hasPathSum_1(self, root: TreeNode, sum: int) -> b... | 3508e1ce089131b19603c3206aab4cf43023bb19 | <|skeleton|>
class Solution:
def hasPathSum(self, root: TreeNode, sum: int) -> bool:
"""递归 到某个节点时,判断其是否是叶子节点并且值是否等于sum 若不是,则递归判断左右子树 注: 递归判断时,需要减去当前root的值"""
<|body_0|>
def hasPathSum_1(self, root: TreeNode, sum: int) -> bool:
"""迭代 每次把之前节点的值加起来"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def hasPathSum(self, root: TreeNode, sum: int) -> bool:
"""递归 到某个节点时,判断其是否是叶子节点并且值是否等于sum 若不是,则递归判断左右子树 注: 递归判断时,需要减去当前root的值"""
if not root:
return False
if not root.left and (not root.right):
return root.val == sum
return self.hasPathSum(root... | the_stack_v2_python_sparse | algorithm/leetcode/tree/17-路径总和.py | lxconfig/UbuntuCode_bak | train | 0 | |
94558eea3b8d41d41e194423cf37729a16bdff7a | [
"if not nums:\n return -1\nl, r = (0, len(nums) - 1)\nwhile l < r - 1:\n mid = (l + r) / 2\n if nums[mid] == target:\n return mid\n elif nums[mid] > target:\n if nums[mid] < nums[r]:\n r = mid\n elif target < nums[l]:\n l = mid\n else:\n r = m... | <|body_start_0|>
if not nums:
return -1
l, r = (0, len(nums) - 1)
while l < r - 1:
mid = (l + r) / 2
if nums[mid] == target:
return mid
elif nums[mid] > target:
if nums[mid] < nums[r]:
r = mid
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int 自己写的代码虽然很烂,但是速度beats 100. 不知道为何"""
<|body_0|>
def search(self, nums, target):
"""借鉴别人的代码。速度反而慢了。设计l < r-1是一个trick,可以让r l = mid, 然后跳出while。单独处理l r相邻的情况 The idea is that wh... | stack_v2_sparse_classes_36k_train_030050 | 2,532 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: int 自己写的代码虽然很烂,但是速度beats 100. 不知道为何",
"name": "search",
"signature": "def search(self, nums, target)"
},
{
"docstring": "借鉴别人的代码。速度反而慢了。设计l < r-1是一个trick,可以让r l = mid, 然后跳出while。单独处理l r相邻的情况 The idea is that when rotating the array,... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int 自己写的代码虽然很烂,但是速度beats 100. 不知道为何
- def search(self, nums, target): 借鉴别人的代码。速度反而慢了。设计l < r-1是一个t... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int 自己写的代码虽然很烂,但是速度beats 100. 不知道为何
- def search(self, nums, target): 借鉴别人的代码。速度反而慢了。设计l < r-1是一个t... | 22794e5e80f534c41ff81eb40072acaa1346a75c | <|skeleton|>
class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int 自己写的代码虽然很烂,但是速度beats 100. 不知道为何"""
<|body_0|>
def search(self, nums, target):
"""借鉴别人的代码。速度反而慢了。设计l < r-1是一个trick,可以让r l = mid, 然后跳出while。单独处理l r相邻的情况 The idea is that wh... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int 自己写的代码虽然很烂,但是速度beats 100. 不知道为何"""
if not nums:
return -1
l, r = (0, len(nums) - 1)
while l < r - 1:
mid = (l + r) / 2
if nums[mid] == target:
... | the_stack_v2_python_sparse | 033.py | huosan0123/leetcode-py | train | 0 | |
2f1c549672138c80aaf2d9e599d57cb36b458a89 | [
"self.db = config['mongo']['database']\nself.collection = config['mongo']['COLLECTION']\nself.mongo_config = config['mongo']\nif self.mongo_config == False:\n return None\nself.user = self.mongo_config.get('user', '')\nself.password = self.mongo_config.get('password', '')\nself.host = self.mongo_config.get('host... | <|body_start_0|>
self.db = config['mongo']['database']
self.collection = config['mongo']['COLLECTION']
self.mongo_config = config['mongo']
if self.mongo_config == False:
return None
self.user = self.mongo_config.get('user', '')
self.password = self.mongo_confi... | ZenMongoDB | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZenMongoDB:
def __init__(self):
"""コンストラクタ"""
<|body_0|>
def connect_db(self):
"""モンゴブ接続機能"""
<|body_1|>
def insert_data(self, data, collection):
"""Insert data into Collection :param data :(dictionary) format {"field_key": "field_value"} :param ... | stack_v2_sparse_classes_36k_train_030051 | 4,730 | no_license | [
{
"docstring": "コンストラクタ",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "モンゴブ接続機能",
"name": "connect_db",
"signature": "def connect_db(self)"
},
{
"docstring": "Insert data into Collection :param data :(dictionary) format {\"field_key\": \"field_value\"}... | 5 | stack_v2_sparse_classes_30k_train_015049 | Implement the Python class `ZenMongoDB` described below.
Class description:
Implement the ZenMongoDB class.
Method signatures and docstrings:
- def __init__(self): コンストラクタ
- def connect_db(self): モンゴブ接続機能
- def insert_data(self, data, collection): Insert data into Collection :param data :(dictionary) format {"field_k... | Implement the Python class `ZenMongoDB` described below.
Class description:
Implement the ZenMongoDB class.
Method signatures and docstrings:
- def __init__(self): コンストラクタ
- def connect_db(self): モンゴブ接続機能
- def insert_data(self, data, collection): Insert data into Collection :param data :(dictionary) format {"field_k... | ec32afdb2a17acbcb21089008a37526195dd39f1 | <|skeleton|>
class ZenMongoDB:
def __init__(self):
"""コンストラクタ"""
<|body_0|>
def connect_db(self):
"""モンゴブ接続機能"""
<|body_1|>
def insert_data(self, data, collection):
"""Insert data into Collection :param data :(dictionary) format {"field_key": "field_value"} :param ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZenMongoDB:
def __init__(self):
"""コンストラクタ"""
self.db = config['mongo']['database']
self.collection = config['mongo']['COLLECTION']
self.mongo_config = config['mongo']
if self.mongo_config == False:
return None
self.user = self.mongo_config.get('user... | the_stack_v2_python_sparse | Python test/Project/Project/src/bbin/zen/db/mongo.py | sacki123/django_training | train | 1 | |
9534f33286a7ed8895c05302321c87eecf6f8be0 | [
"if self.session.loggedIn:\n self.head = ('303 SEE OTHER', [('location', '/you')])\n self.session.pushAlert(\"It looks like you're already signed in!\", 'Hey there!', 'info')\nelse:\n loginForm = authLoginTmpl(searchList=[self.tmplSearchList])\n return loginForm",
"passwd = self.env['members']['passwo... | <|body_start_0|>
if self.session.loggedIn:
self.head = ('303 SEE OTHER', [('location', '/you')])
self.session.pushAlert("It looks like you're already signed in!", 'Hey there!', 'info')
else:
loginForm = authLoginTmpl(searchList=[self.tmplSearchList])
retur... | authLogin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class authLogin:
def GET(self):
"""Display the login page or redirect to their dashboard if they are already logged in"""
<|body_0|>
def POST(self):
"""Use form data to check login, and the redirect if successful if not successful then redirect to the login page again."""
... | stack_v2_sparse_classes_36k_train_030052 | 2,033 | permissive | [
{
"docstring": "Display the login page or redirect to their dashboard if they are already logged in",
"name": "GET",
"signature": "def GET(self)"
},
{
"docstring": "Use form data to check login, and the redirect if successful if not successful then redirect to the login page again.",
"name":... | 2 | null | Implement the Python class `authLogin` described below.
Class description:
Implement the authLogin class.
Method signatures and docstrings:
- def GET(self): Display the login page or redirect to their dashboard if they are already logged in
- def POST(self): Use form data to check login, and the redirect if successfu... | Implement the Python class `authLogin` described below.
Class description:
Implement the authLogin class.
Method signatures and docstrings:
- def GET(self): Display the login page or redirect to their dashboard if they are already logged in
- def POST(self): Use form data to check login, and the redirect if successfu... | fbf9d0c5278a23f18b586dee89bb054794b3d452 | <|skeleton|>
class authLogin:
def GET(self):
"""Display the login page or redirect to their dashboard if they are already logged in"""
<|body_0|>
def POST(self):
"""Use form data to check login, and the redirect if successful if not successful then redirect to the login page again."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class authLogin:
def GET(self):
"""Display the login page or redirect to their dashboard if they are already logged in"""
if self.session.loggedIn:
self.head = ('303 SEE OTHER', [('location', '/you')])
self.session.pushAlert("It looks like you're already signed in!", 'Hey the... | the_stack_v2_python_sparse | flagr_core/controllers/auth/authLoginController.py | JoshAshby/Fla.gr | train | 0 | |
66141244093686008d246fda6194258f1010b87b | [
"self.products = {}\nself.arr.sort()\nfor i, n in enumerate(self.arr):\n i_start = 0\n i_end = i - 1\n while i_start <= i_end:\n prod = self.arr[i_start] * self.arr[i_end]\n if prod == n:\n self.products[n] = self.products.get(n, []) + [[self.arr[i_start], self.arr[i_end]]]\n ... | <|body_start_0|>
self.products = {}
self.arr.sort()
for i, n in enumerate(self.arr):
i_start = 0
i_end = i - 1
while i_start <= i_end:
prod = self.arr[i_start] * self.arr[i_end]
if prod == n:
self.products[n]... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getProducts(self) -> None:
"""Runtime complexity: O(n^2) Space complexity: O(n)"""
<|body_0|>
def numFactoredBinaryTrees(self, arr: List[int]) -> int:
"""Runtime complexity: O(n^2) (including inside functions) Space complexity: O(n^2) (including inside ... | stack_v2_sparse_classes_36k_train_030053 | 2,805 | no_license | [
{
"docstring": "Runtime complexity: O(n^2) Space complexity: O(n)",
"name": "getProducts",
"signature": "def getProducts(self) -> None"
},
{
"docstring": "Runtime complexity: O(n^2) (including inside functions) Space complexity: O(n^2) (including inside functions)",
"name": "numFactoredBinar... | 3 | stack_v2_sparse_classes_30k_train_005301 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getProducts(self) -> None: Runtime complexity: O(n^2) Space complexity: O(n)
- def numFactoredBinaryTrees(self, arr: List[int]) -> int: Runtime complexity: O(n^2) (including ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getProducts(self) -> None: Runtime complexity: O(n^2) Space complexity: O(n)
- def numFactoredBinaryTrees(self, arr: List[int]) -> int: Runtime complexity: O(n^2) (including ... | ee8237b66975fb5584a3d68b311e762c0462c8aa | <|skeleton|>
class Solution:
def getProducts(self) -> None:
"""Runtime complexity: O(n^2) Space complexity: O(n)"""
<|body_0|>
def numFactoredBinaryTrees(self, arr: List[int]) -> int:
"""Runtime complexity: O(n^2) (including inside functions) Space complexity: O(n^2) (including inside ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def getProducts(self) -> None:
"""Runtime complexity: O(n^2) Space complexity: O(n)"""
self.products = {}
self.arr.sort()
for i, n in enumerate(self.arr):
i_start = 0
i_end = i - 1
while i_start <= i_end:
prod = self... | the_stack_v2_python_sparse | LC823-Binary-Trees-With-Factors.py | kate-melnykova/LeetCode-solutions | train | 2 | |
2e695057d742e328839c2376ae3af9b8591737a6 | [
"self._profiler = cProfile.Profile()\nself.loaded = False\nself.task_url = '/profiler/store'\nkey = int(key) if key and key.isdigit() else None\ndata = storage.from_key(key) if key else None\nif data:\n self.profile_key = key\n self.pstats_obj = ppstats.from_gz(data.profile)\n self.path = data.path\n se... | <|body_start_0|>
self._profiler = cProfile.Profile()
self.loaded = False
self.task_url = '/profiler/store'
key = int(key) if key and key.isdigit() else None
data = storage.from_key(key) if key else None
if data:
self.profile_key = key
self.pstats_o... | Profiler class that contains profiling data. | GAEProfiler | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GAEProfiler:
"""Profiler class that contains profiling data."""
def __init__(self, path=None, key=None):
"""Constructs a new profiler for the given path."""
<|body_0|>
def get_pstats(self):
"""Return a ppstats object from current profile data."""
<|body_1... | stack_v2_sparse_classes_36k_train_030054 | 3,597 | permissive | [
{
"docstring": "Constructs a new profiler for the given path.",
"name": "__init__",
"signature": "def __init__(self, path=None, key=None)"
},
{
"docstring": "Return a ppstats object from current profile data.",
"name": "get_pstats",
"signature": "def get_pstats(self)"
},
{
"docst... | 4 | null | Implement the Python class `GAEProfiler` described below.
Class description:
Profiler class that contains profiling data.
Method signatures and docstrings:
- def __init__(self, path=None, key=None): Constructs a new profiler for the given path.
- def get_pstats(self): Return a ppstats object from current profile data... | Implement the Python class `GAEProfiler` described below.
Class description:
Profiler class that contains profiling data.
Method signatures and docstrings:
- def __init__(self, path=None, key=None): Constructs a new profiler for the given path.
- def get_pstats(self): Return a ppstats object from current profile data... | 9bd45c168f8ddb5c0e6c04eacdcaeafd61908be7 | <|skeleton|>
class GAEProfiler:
"""Profiler class that contains profiling data."""
def __init__(self, path=None, key=None):
"""Constructs a new profiler for the given path."""
<|body_0|>
def get_pstats(self):
"""Return a ppstats object from current profile data."""
<|body_1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GAEProfiler:
"""Profiler class that contains profiling data."""
def __init__(self, path=None, key=None):
"""Constructs a new profiler for the given path."""
self._profiler = cProfile.Profile()
self.loaded = False
self.task_url = '/profiler/store'
key = int(key) if ... | the_stack_v2_python_sparse | app/soc/profiling/profiler.py | pombredanne/Melange-1 | train | 0 |
231d0b1e0d0f9c8899f702a507a37384c1360e01 | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('xcao19', 'xcao19')\nurl = 'https://data.boston.gov/datastore/dump/0b2be5cb-89c6-4328-93be-c54ba723f8db?q=&sort=_id+asc&fields=X%2CY%2COBJECTID%2CBLDG_ID%2CBID%2CADDRESS%2CPOINT_X%2CPOINT_Y%2CNAME%2CNEIGH... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('xcao19', 'xcao19')
url = 'https://data.boston.gov/datastore/dump/0b2be5cb-89c6-4328-93be-c54ba723f8db?q=&sort=_id+asc&fields=X%2CY%2COBJECTID%2CBLDG_ID%2C... | policeStation | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class policeStation:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything... | stack_v2_sparse_classes_36k_train_030055 | 3,520 | no_license | [
{
"docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d... | 2 | stack_v2_sparse_classes_30k_val_000233 | Implement the Python class `policeStation` described below.
Class description:
Implement the policeStation class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=None, e... | Implement the Python class `policeStation` described below.
Class description:
Implement the policeStation class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=None, e... | 90284cf3debbac36eead07b8d2339cdd191b86cf | <|skeleton|>
class policeStation:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class policeStation:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('xcao19', 'xcao19')
url = 'htt... | the_stack_v2_python_sparse | xcao19/policeStation.py | maximega/course-2019-spr-proj | train | 2 | |
0dbf99a1b69f7e45d5ce0baba13da1e7f4255da3 | [
"me = get_object_or_404(CustomUser, id=request.user.id)\nif 'refreshAvatar' in request.data:\n g = Gravatar(me.email)\n me.gravatar = g.get_image(size=120, default='retro', use_ssl=True)\nfor key in request.data:\n setattr(me, key, request.data[key])\nme.save()\nserializer = ProfileSerializer(me).data\nret... | <|body_start_0|>
me = get_object_or_404(CustomUser, id=request.user.id)
if 'refreshAvatar' in request.data:
g = Gravatar(me.email)
me.gravatar = g.get_image(size=120, default='retro', use_ssl=True)
for key in request.data:
setattr(me, key, request.data[key])
... | Endpoint for obtaining a user's profile. The profile consists of the user's activity, favorite games, bio, reviews, contact information, stats, lists, followers and other stuff. This endpoint accepts both GET and POST methods. | ProfileView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProfileView:
"""Endpoint for obtaining a user's profile. The profile consists of the user's activity, favorite games, bio, reviews, contact information, stats, lists, followers and other stuff. This endpoint accepts both GET and POST methods."""
def post(self, request, *args, **kwargs):
... | stack_v2_sparse_classes_36k_train_030056 | 6,584 | no_license | [
{
"docstring": "Method for updating your profile.",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
},
{
"docstring": "Method for getting the profile.",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015721 | Implement the Python class `ProfileView` described below.
Class description:
Endpoint for obtaining a user's profile. The profile consists of the user's activity, favorite games, bio, reviews, contact information, stats, lists, followers and other stuff. This endpoint accepts both GET and POST methods.
Method signatu... | Implement the Python class `ProfileView` described below.
Class description:
Endpoint for obtaining a user's profile. The profile consists of the user's activity, favorite games, bio, reviews, contact information, stats, lists, followers and other stuff. This endpoint accepts both GET and POST methods.
Method signatu... | 7f7e44ca0dae3525394458c16b7093f90612524b | <|skeleton|>
class ProfileView:
"""Endpoint for obtaining a user's profile. The profile consists of the user's activity, favorite games, bio, reviews, contact information, stats, lists, followers and other stuff. This endpoint accepts both GET and POST methods."""
def post(self, request, *args, **kwargs):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProfileView:
"""Endpoint for obtaining a user's profile. The profile consists of the user's activity, favorite games, bio, reviews, contact information, stats, lists, followers and other stuff. This endpoint accepts both GET and POST methods."""
def post(self, request, *args, **kwargs):
"""Method... | the_stack_v2_python_sparse | backend/users/views.py | RMalmberg/overworld | train | 3 |
b0dbba7e74d26a783de40ad27050539d426db675 | [
"self.threads = []\nself.data = {'candles': [], 'RSI': [], 'candles_ready': False, 'rsi_ready': False}\nself.pill2kill = threading.Event()\nself.trading_data = {}\nself.trading_data['lotage'] = lotage\nself.trading_data['time_period'] = time_period\nself.trading_data['market'] = market",
"t = threading.Thread(tar... | <|body_start_0|>
self.threads = []
self.data = {'candles': [], 'RSI': [], 'candles_ready': False, 'rsi_ready': False}
self.pill2kill = threading.Event()
self.trading_data = {}
self.trading_data['lotage'] = lotage
self.trading_data['time_period'] = time_period
self... | Bot | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bot:
def __init__(self, lotage: float, time_period: int, market: str):
"""Constructor of the bot. It justs fills the needed informartion for the bot. Args: lotage (float): Lotage to be used by the bot. time_period (int): Time period of the bot, 1 minute, 15 minutes... (in seconds) market... | stack_v2_sparse_classes_36k_train_030057 | 2,915 | no_license | [
{
"docstring": "Constructor of the bot. It justs fills the needed informartion for the bot. Args: lotage (float): Lotage to be used by the bot. time_period (int): Time period of the bot, 1 minute, 15 minutes... (in seconds) market (str): Market to operate in.",
"name": "__init__",
"signature": "def __in... | 6 | stack_v2_sparse_classes_30k_train_000521 | Implement the Python class `Bot` described below.
Class description:
Implement the Bot class.
Method signatures and docstrings:
- def __init__(self, lotage: float, time_period: int, market: str): Constructor of the bot. It justs fills the needed informartion for the bot. Args: lotage (float): Lotage to be used by the... | Implement the Python class `Bot` described below.
Class description:
Implement the Bot class.
Method signatures and docstrings:
- def __init__(self, lotage: float, time_period: int, market: str): Constructor of the bot. It justs fills the needed informartion for the bot. Args: lotage (float): Lotage to be used by the... | d6efbee05896e4c743f94a2a97b7b8be51bc7770 | <|skeleton|>
class Bot:
def __init__(self, lotage: float, time_period: int, market: str):
"""Constructor of the bot. It justs fills the needed informartion for the bot. Args: lotage (float): Lotage to be used by the bot. time_period (int): Time period of the bot, 1 minute, 15 minutes... (in seconds) market... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Bot:
def __init__(self, lotage: float, time_period: int, market: str):
"""Constructor of the bot. It justs fills the needed informartion for the bot. Args: lotage (float): Lotage to be used by the bot. time_period (int): Time period of the bot, 1 minute, 15 minutes... (in seconds) market (str): Market... | the_stack_v2_python_sparse | ta/RSI/BOT/bot.py | cvillarr123/TradingBOTCVI | train | 0 | |
f6a394faa689e60f477dcf8d5c205e02c9acab8c | [
"self.segmentator = segmentator.eval()\nself.pca_model = pca_model\nself.xgb_model = xgb_model",
"bttnk_features = self.segmentator.encoders(inputs)\nbttnk_features = bttnk_features.reshape(bttnk_features.shape[0], -1)\ntransformed_features = self.pca_model.transform(bttnk_features)\nprediction = self.xgb_model.p... | <|body_start_0|>
self.segmentator = segmentator.eval()
self.pca_model = pca_model
self.xgb_model = xgb_model
<|end_body_0|>
<|body_start_1|>
bttnk_features = self.segmentator.encoders(inputs)
bttnk_features = bttnk_features.reshape(bttnk_features.shape[0], -1)
transforme... | XGBoostPredictor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XGBoostPredictor:
def __init__(self, segmentator, pca_model, xgb_model):
"""Make XGBoost predictin of probability. Parameters: ----------- segmentator : torch.Module segmentation model (3D unet) to fetch bottleneck pca_model : sklearn.decomposition.pca.PCA pca model for feature reduction... | stack_v2_sparse_classes_36k_train_030058 | 1,667 | no_license | [
{
"docstring": "Make XGBoost predictin of probability. Parameters: ----------- segmentator : torch.Module segmentation model (3D unet) to fetch bottleneck pca_model : sklearn.decomposition.pca.PCA pca model for feature reduction xgb_model : xgboost.sklearn.XGBRegressor xgboost model for predicting probabilities... | 2 | stack_v2_sparse_classes_30k_train_002973 | Implement the Python class `XGBoostPredictor` described below.
Class description:
Implement the XGBoostPredictor class.
Method signatures and docstrings:
- def __init__(self, segmentator, pca_model, xgb_model): Make XGBoost predictin of probability. Parameters: ----------- segmentator : torch.Module segmentation mode... | Implement the Python class `XGBoostPredictor` described below.
Class description:
Implement the XGBoostPredictor class.
Method signatures and docstrings:
- def __init__(self, segmentator, pca_model, xgb_model): Make XGBoost predictin of probability. Parameters: ----------- segmentator : torch.Module segmentation mode... | 9554e0f96703a37a9a41fc70dc8e70e45c6181a2 | <|skeleton|>
class XGBoostPredictor:
def __init__(self, segmentator, pca_model, xgb_model):
"""Make XGBoost predictin of probability. Parameters: ----------- segmentator : torch.Module segmentation model (3D unet) to fetch bottleneck pca_model : sklearn.decomposition.pca.PCA pca model for feature reduction... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class XGBoostPredictor:
def __init__(self, segmentator, pca_model, xgb_model):
"""Make XGBoost predictin of probability. Parameters: ----------- segmentator : torch.Module segmentation model (3D unet) to fetch bottleneck pca_model : sklearn.decomposition.pca.PCA pca model for feature reduction xgb_model : x... | the_stack_v2_python_sparse | dnn_backend/radio_dep/radio/backend/distributed/xgboost.py | theVmagnificient/radiology_web | train | 0 | |
76f32816b81a2645b48c5f143d13198f86ec11e7 | [
"try:\n return float(value)\nexcept ValueError:\n raise ValueError('Attempted to set value for an %s field which is not compatible: %s' % (self.typeName(), repr(value)))",
"if isinstance(value, float):\n return 1\nreturn 0"
] | <|body_start_0|>
try:
return float(value)
except ValueError:
raise ValueError('Attempted to set value for an %s field which is not compatible: %s' % (self.typeName(), repr(value)))
<|end_body_0|>
<|body_start_1|>
if isinstance(value, float):
return 1
... | SFFloat field/event type base-class | _SFFloat | [
"GPL-1.0-or-later",
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-copyleft",
"LGPL-2.1-or-later",
"GPL-3.0-only",
"LGPL-2.0-or-later",
"GPL-3.0-or-later"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _SFFloat:
"""SFFloat field/event type base-class"""
def coerce(self, value):
"""Coerce the given value to our type Allowable types: any object with true/false protocol"""
<|body_0|>
def check(self, value):
"""Check that value is of precisely the expected data typ... | stack_v2_sparse_classes_36k_train_030059 | 34,853 | permissive | [
{
"docstring": "Coerce the given value to our type Allowable types: any object with true/false protocol",
"name": "coerce",
"signature": "def coerce(self, value)"
},
{
"docstring": "Check that value is of precisely the expected data type",
"name": "check",
"signature": "def check(self, v... | 2 | stack_v2_sparse_classes_30k_train_021221 | Implement the Python class `_SFFloat` described below.
Class description:
SFFloat field/event type base-class
Method signatures and docstrings:
- def coerce(self, value): Coerce the given value to our type Allowable types: any object with true/false protocol
- def check(self, value): Check that value is of precisely ... | Implement the Python class `_SFFloat` described below.
Class description:
SFFloat field/event type base-class
Method signatures and docstrings:
- def coerce(self, value): Coerce the given value to our type Allowable types: any object with true/false protocol
- def check(self, value): Check that value is of precisely ... | 7f600ad153270feff12aa7aa86d7ed0a49ebc71c | <|skeleton|>
class _SFFloat:
"""SFFloat field/event type base-class"""
def coerce(self, value):
"""Coerce the given value to our type Allowable types: any object with true/false protocol"""
<|body_0|>
def check(self, value):
"""Check that value is of precisely the expected data typ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _SFFloat:
"""SFFloat field/event type base-class"""
def coerce(self, value):
"""Coerce the given value to our type Allowable types: any object with true/false protocol"""
try:
return float(value)
except ValueError:
raise ValueError('Attempted to set value f... | the_stack_v2_python_sparse | pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/vrml/fieldtypes.py | alexus37/AugmentedRealityChess | train | 1 |
e82b6cff6379ef8b3de49108d46e4e2374ae4d0b | [
"super(SwingMeter, self).__init__()\nself.screen = screen\nself.size = (500, 20)\nself.x = self.screen.get_size()[0] // 2 - 300\nself.y = self.screen.get_size()[1] - 40\nself.golfer = golfer\nself.in_swing = False\nself.in_backswing = False\nself.in_followthru = False\nself.power = 0\nself.accuracy = 0\nself.perfec... | <|body_start_0|>
super(SwingMeter, self).__init__()
self.screen = screen
self.size = (500, 20)
self.x = self.screen.get_size()[0] // 2 - 300
self.y = self.screen.get_size()[1] - 40
self.golfer = golfer
self.in_swing = False
self.in_backswing = False
... | SwingMeter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SwingMeter:
def __init__(self, screen, golfer):
"""Initialize the golf club. :param screen: The pygame display :param golfer: The golf player"""
<|body_0|>
def update(self, pressed_keys):
"""The swing meter."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_030060 | 1,825 | no_license | [
{
"docstring": "Initialize the golf club. :param screen: The pygame display :param golfer: The golf player",
"name": "__init__",
"signature": "def __init__(self, screen, golfer)"
},
{
"docstring": "The swing meter.",
"name": "update",
"signature": "def update(self, pressed_keys)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007833 | Implement the Python class `SwingMeter` described below.
Class description:
Implement the SwingMeter class.
Method signatures and docstrings:
- def __init__(self, screen, golfer): Initialize the golf club. :param screen: The pygame display :param golfer: The golf player
- def update(self, pressed_keys): The swing met... | Implement the Python class `SwingMeter` described below.
Class description:
Implement the SwingMeter class.
Method signatures and docstrings:
- def __init__(self, screen, golfer): Initialize the golf club. :param screen: The pygame display :param golfer: The golf player
- def update(self, pressed_keys): The swing met... | bc0e94bec6b62dcc0da410e9f25be787b11d5a78 | <|skeleton|>
class SwingMeter:
def __init__(self, screen, golfer):
"""Initialize the golf club. :param screen: The pygame display :param golfer: The golf player"""
<|body_0|>
def update(self, pressed_keys):
"""The swing meter."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SwingMeter:
def __init__(self, screen, golfer):
"""Initialize the golf club. :param screen: The pygame display :param golfer: The golf player"""
super(SwingMeter, self).__init__()
self.screen = screen
self.size = (500, 20)
self.x = self.screen.get_size()[0] // 2 - 300
... | the_stack_v2_python_sparse | objects/swing_meter.py | notinuse1234/zoom_zoom_zow | train | 0 | |
fe6ec0b0172bccfe1dfef58f3ff38453d0091efb | [
"with testing.test_setup():\n user = models.User(name='test', email='test@test.com', password='test')\n user.deletion_behaviour = settings_enums.DeletionBehaviour.CASCADE\n db.DB.session.add(user)\n db.DB.session.commit()\n setting = user.get_setting('deletion_behaviour')\n self.assertEqual('delet... | <|body_start_0|>
with testing.test_setup():
user = models.User(name='test', email='test@test.com', password='test')
user.deletion_behaviour = settings_enums.DeletionBehaviour.CASCADE
db.DB.session.add(user)
db.DB.session.commit()
setting = user.get_set... | Tests for User model. | UserTest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserTest:
"""Tests for User model."""
def test_get_setting__setting_exists(self):
"""Test User.get_settings when the setting exists."""
<|body_0|>
def test_get_setting__setting_does_not_exist(self):
"""Test User.get_settings when the setting does not exist."""
... | stack_v2_sparse_classes_36k_train_030061 | 1,956 | permissive | [
{
"docstring": "Test User.get_settings when the setting exists.",
"name": "test_get_setting__setting_exists",
"signature": "def test_get_setting__setting_exists(self)"
},
{
"docstring": "Test User.get_settings when the setting does not exist.",
"name": "test_get_setting__setting_does_not_exi... | 3 | stack_v2_sparse_classes_30k_train_009692 | Implement the Python class `UserTest` described below.
Class description:
Tests for User model.
Method signatures and docstrings:
- def test_get_setting__setting_exists(self): Test User.get_settings when the setting exists.
- def test_get_setting__setting_does_not_exist(self): Test User.get_settings when the setting ... | Implement the Python class `UserTest` described below.
Class description:
Tests for User model.
Method signatures and docstrings:
- def test_get_setting__setting_exists(self): Test User.get_settings when the setting exists.
- def test_get_setting__setting_does_not_exist(self): Test User.get_settings when the setting ... | 7d529d9eaeb9de7a9aebe6aa373e1b3611bfd2ad | <|skeleton|>
class UserTest:
"""Tests for User model."""
def test_get_setting__setting_exists(self):
"""Test User.get_settings when the setting exists."""
<|body_0|>
def test_get_setting__setting_does_not_exist(self):
"""Test User.get_settings when the setting does not exist."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserTest:
"""Tests for User model."""
def test_get_setting__setting_exists(self):
"""Test User.get_settings when the setting exists."""
with testing.test_setup():
user = models.User(name='test', email='test@test.com', password='test')
user.deletion_behaviour = sett... | the_stack_v2_python_sparse | lime/database/user_test.py | toastwaffle/LiME | train | 1 |
e4dcde8aecf647a42b0c87fc5c54f7465caef302 | [
"for device_table in self.device_table_to_attribute.keys():\n statement = 'DELETE FROM machine_{} WHERE machine_id = %s'.format(device_table)\n database.execute(statement, (before_insert.id,))\n for device_id in getattr(before_insert, before_insert.device_table_to_attribute[device_table]):\n stateme... | <|body_start_0|>
for device_table in self.device_table_to_attribute.keys():
statement = 'DELETE FROM machine_{} WHERE machine_id = %s'.format(device_table)
database.execute(statement, (before_insert.id,))
for device_id in getattr(before_insert, before_insert.device_table_to_a... | Machine | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Machine:
def _update_devices(self, before_insert):
"""Update this Machine's devices in the database."""
<|body_0|>
def from_tile_id_and_rack_position(cls, tile_id, position):
"""Get a Rack from the ID of the tile its Rack is on, and its position in the Rack."""
... | stack_v2_sparse_classes_36k_train_030062 | 3,796 | permissive | [
{
"docstring": "Update this Machine's devices in the database.",
"name": "_update_devices",
"signature": "def _update_devices(self, before_insert)"
},
{
"docstring": "Get a Rack from the ID of the tile its Rack is on, and its position in the Rack.",
"name": "from_tile_id_and_rack_position",
... | 6 | stack_v2_sparse_classes_30k_train_011744 | Implement the Python class `Machine` described below.
Class description:
Implement the Machine class.
Method signatures and docstrings:
- def _update_devices(self, before_insert): Update this Machine's devices in the database.
- def from_tile_id_and_rack_position(cls, tile_id, position): Get a Rack from the ID of the... | Implement the Python class `Machine` described below.
Class description:
Implement the Machine class.
Method signatures and docstrings:
- def _update_devices(self, before_insert): Update this Machine's devices in the database.
- def from_tile_id_and_rack_position(cls, tile_id, position): Get a Rack from the ID of the... | 71aa937a9b7db7289d69ac85587387070d2af851 | <|skeleton|>
class Machine:
def _update_devices(self, before_insert):
"""Update this Machine's devices in the database."""
<|body_0|>
def from_tile_id_and_rack_position(cls, tile_id, position):
"""Get a Rack from the ID of the tile its Rack is on, and its position in the Rack."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Machine:
def _update_devices(self, before_insert):
"""Update this Machine's devices in the database."""
for device_table in self.device_table_to_attribute.keys():
statement = 'DELETE FROM machine_{} WHERE machine_id = %s'.format(device_table)
database.execute(statement,... | the_stack_v2_python_sparse | opendc/models/machine.py | atlarge-research/opendc-web-server | train | 2 | |
6af95f316c42d0cf9e08338f065e7ebf6413fffd | [
"smach.State.__init__(self, outcomes=['done'])\nself._robot = robot\nself.arm_designator = arm",
"arm = self.arm_designator.resolve()\narm.reset()\nif self._robot.robot_name == 'amigo':\n self._robot.torso.reset()\nif arm is not None:\n arm.gripper.send_goal('close')\nself._robot.head.reset()\nself._robot.h... | <|body_start_0|>
smach.State.__init__(self, outcomes=['done'])
self._robot = robot
self.arm_designator = arm
<|end_body_0|>
<|body_start_1|>
arm = self.arm_designator.resolve()
arm.reset()
if self._robot.robot_name == 'amigo':
self._robot.torso.reset()
... | Class to reset the robot after a grab has failed | ResetOnFailure | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResetOnFailure:
"""Class to reset the robot after a grab has failed"""
def __init__(self, robot, arm):
"""Constructor :param robot: robot object :param arm: arm designator"""
<|body_0|>
def execute(self, userdata=None):
"""Execute hook"""
<|body_1|>
<|en... | stack_v2_sparse_classes_36k_train_030063 | 15,024 | no_license | [
{
"docstring": "Constructor :param robot: robot object :param arm: arm designator",
"name": "__init__",
"signature": "def __init__(self, robot, arm)"
},
{
"docstring": "Execute hook",
"name": "execute",
"signature": "def execute(self, userdata=None)"
}
] | 2 | null | Implement the Python class `ResetOnFailure` described below.
Class description:
Class to reset the robot after a grab has failed
Method signatures and docstrings:
- def __init__(self, robot, arm): Constructor :param robot: robot object :param arm: arm designator
- def execute(self, userdata=None): Execute hook | Implement the Python class `ResetOnFailure` described below.
Class description:
Class to reset the robot after a grab has failed
Method signatures and docstrings:
- def __init__(self, robot, arm): Constructor :param robot: robot object :param arm: arm designator
- def execute(self, userdata=None): Execute hook
<|ske... | 092a354315b9b2c08e32cdc049791d82dfd47745 | <|skeleton|>
class ResetOnFailure:
"""Class to reset the robot after a grab has failed"""
def __init__(self, robot, arm):
"""Constructor :param robot: robot object :param arm: arm designator"""
<|body_0|>
def execute(self, userdata=None):
"""Execute hook"""
<|body_1|>
<|en... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResetOnFailure:
"""Class to reset the robot after a grab has failed"""
def __init__(self, robot, arm):
"""Constructor :param robot: robot object :param arm: arm designator"""
smach.State.__init__(self, outcomes=['done'])
self._robot = robot
self.arm_designator = arm
d... | the_stack_v2_python_sparse | robot_smach_states/src/robot_smach_states/manipulation/grab.py | tue-robotics/tue_robocup | train | 39 |
1a62c91cdcdb50eec307a072555f87befa931953 | [
"size = len(entities)\nif size > 0:\n store = get_current_store()\n chunk = options.get('chunk_size', None)\n entity_type = type(entities[0])\n serialized_values = serializer_services.serialize(entities, **options)\n if chunk is None:\n chunk = 0\n chunk = int(chunk)\n if size <= chunk o... | <|body_start_0|>
size = len(entities)
if size > 0:
store = get_current_store()
chunk = options.get('chunk_size', None)
entity_type = type(entities[0])
serialized_values = serializer_services.serialize(entities, **options)
if chunk is None:
... | database bulk manager class. | DatabaseBulkManager | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatabaseBulkManager:
"""database bulk manager class."""
def insert(self, *entities, **options):
"""bulk inserts the given entities. note that entities must be from the same type. :param BaseEntity entities: entities to be inserted. :keyword int chunk_size: chunk size to insert values... | stack_v2_sparse_classes_36k_train_030064 | 20,839 | permissive | [
{
"docstring": "bulk inserts the given entities. note that entities must be from the same type. :param BaseEntity entities: entities to be inserted. :keyword int chunk_size: chunk size to insert values. after each chunk, store will be committed. if not provided, all values will be inserted in a single call and ... | 2 | stack_v2_sparse_classes_30k_train_007143 | Implement the Python class `DatabaseBulkManager` described below.
Class description:
database bulk manager class.
Method signatures and docstrings:
- def insert(self, *entities, **options): bulk inserts the given entities. note that entities must be from the same type. :param BaseEntity entities: entities to be inser... | Implement the Python class `DatabaseBulkManager` described below.
Class description:
database bulk manager class.
Method signatures and docstrings:
- def insert(self, *entities, **options): bulk inserts the given entities. note that entities must be from the same type. :param BaseEntity entities: entities to be inser... | 9d4776498225de4f3d16a4600b5b19212abe8562 | <|skeleton|>
class DatabaseBulkManager:
"""database bulk manager class."""
def insert(self, *entities, **options):
"""bulk inserts the given entities. note that entities must be from the same type. :param BaseEntity entities: entities to be inserted. :keyword int chunk_size: chunk size to insert values... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DatabaseBulkManager:
"""database bulk manager class."""
def insert(self, *entities, **options):
"""bulk inserts the given entities. note that entities must be from the same type. :param BaseEntity entities: entities to be inserted. :keyword int chunk_size: chunk size to insert values. after each ... | the_stack_v2_python_sparse | src/pyrin/database/bulk/manager.py | mononobi/pyrin | train | 20 |
dd740be3da9fd0b284fef64de8b7d30a7f07c308 | [
"self._list_maps()\nselected_map = pre_selected\nmaps = self.maps\nwhile selected_map is None:\n selected_map = input('Entrez un nombre pour choisir un labyrithe: ')\n try:\n selected_map = int(selected_map)\n except:\n print(\"Ceci n'est pas un nombre...\")\n selected_map = None\n ... | <|body_start_0|>
self._list_maps()
selected_map = pre_selected
maps = self.maps
while selected_map is None:
selected_map = input('Entrez un nombre pour choisir un labyrithe: ')
try:
selected_map = int(selected_map)
except:
... | Interface machine pour le controlleur serveur. Cette interface sert UNIQUEMENT pour la selection de du labyrithe coté serveur. | ServerIhm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ServerIhm:
"""Interface machine pour le controlleur serveur. Cette interface sert UNIQUEMENT pour la selection de du labyrithe coté serveur."""
def get_map(self, pre_selected=None):
"""On recupère la chemin vers la carte choisie par l'utilisaeur. Si l'input est invalide on boucle, si... | stack_v2_sparse_classes_36k_train_030065 | 11,965 | no_license | [
{
"docstring": "On recupère la chemin vers la carte choisie par l'utilisaeur. Si l'input est invalide on boucle, si le nombre entré ne correspond à aucune carte, on boucle. Sinon, on retourne le chemin vers la carte. L'argument pre_selected, peut nous permettre de présélectionner un labyrinthe.",
"name": "g... | 3 | stack_v2_sparse_classes_30k_train_013324 | Implement the Python class `ServerIhm` described below.
Class description:
Interface machine pour le controlleur serveur. Cette interface sert UNIQUEMENT pour la selection de du labyrithe coté serveur.
Method signatures and docstrings:
- def get_map(self, pre_selected=None): On recupère la chemin vers la carte choisi... | Implement the Python class `ServerIhm` described below.
Class description:
Interface machine pour le controlleur serveur. Cette interface sert UNIQUEMENT pour la selection de du labyrithe coté serveur.
Method signatures and docstrings:
- def get_map(self, pre_selected=None): On recupère la chemin vers la carte choisi... | 10d973bc939bc2b48b16acc59d259f955513409e | <|skeleton|>
class ServerIhm:
"""Interface machine pour le controlleur serveur. Cette interface sert UNIQUEMENT pour la selection de du labyrithe coté serveur."""
def get_map(self, pre_selected=None):
"""On recupère la chemin vers la carte choisie par l'utilisaeur. Si l'input est invalide on boucle, si... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ServerIhm:
"""Interface machine pour le controlleur serveur. Cette interface sert UNIQUEMENT pour la selection de du labyrithe coté serveur."""
def get_map(self, pre_selected=None):
"""On recupère la chemin vers la carte choisie par l'utilisaeur. Si l'input est invalide on boucle, si le nombre en... | the_stack_v2_python_sparse | Python/OC/activity2/server_controllers/server.py | fherbine/trainingPython-Kivy | train | 0 |
bf19325112f6e33a520bc5e8f102caa1a172a423 | [
"app = current_application\nproj = biz.get_project(app, id, domain, type, biz_id)\nreturn proj",
"app = current_application\nproj = biz.get_project(app, id, domain, type, biz_id)\nbiz.update_project(proj, request.get_json())\nreturn (None, 204)"
] | <|body_start_0|>
app = current_application
proj = biz.get_project(app, id, domain, type, biz_id)
return proj
<|end_body_0|>
<|body_start_1|>
app = current_application
proj = biz.get_project(app, id, domain, type, biz_id)
biz.update_project(proj, request.get_json())
... | ProjectItem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectItem:
def get(self, id=None, domain=None, type=None, biz_id=None):
"""获取项目"""
<|body_0|>
def patch(self, id=None, domain=None, type=None, biz_id=None):
"""更新项目信息: owner, customers, leader, meta_data, scope_labels, class_labels"""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k_train_030066 | 6,400 | no_license | [
{
"docstring": "获取项目",
"name": "get",
"signature": "def get(self, id=None, domain=None, type=None, biz_id=None)"
},
{
"docstring": "更新项目信息: owner, customers, leader, meta_data, scope_labels, class_labels",
"name": "patch",
"signature": "def patch(self, id=None, domain=None, type=None, bi... | 2 | stack_v2_sparse_classes_30k_test_001085 | Implement the Python class `ProjectItem` described below.
Class description:
Implement the ProjectItem class.
Method signatures and docstrings:
- def get(self, id=None, domain=None, type=None, biz_id=None): 获取项目
- def patch(self, id=None, domain=None, type=None, biz_id=None): 更新项目信息: owner, customers, leader, meta_da... | Implement the Python class `ProjectItem` described below.
Class description:
Implement the ProjectItem class.
Method signatures and docstrings:
- def get(self, id=None, domain=None, type=None, biz_id=None): 获取项目
- def patch(self, id=None, domain=None, type=None, biz_id=None): 更新项目信息: owner, customers, leader, meta_da... | 37efe7819d5df5d0ebd4bdf9d0072a6848813d18 | <|skeleton|>
class ProjectItem:
def get(self, id=None, domain=None, type=None, biz_id=None):
"""获取项目"""
<|body_0|>
def patch(self, id=None, domain=None, type=None, biz_id=None):
"""更新项目信息: owner, customers, leader, meta_data, scope_labels, class_labels"""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProjectItem:
def get(self, id=None, domain=None, type=None, biz_id=None):
"""获取项目"""
app = current_application
proj = biz.get_project(app, id, domain, type, biz_id)
return proj
def patch(self, id=None, domain=None, type=None, biz_id=None):
"""更新项目信息: owner, custome... | the_stack_v2_python_sparse | src/app/apis/namespaces/app/project_resources.py | webee/customer-service-api | train | 0 | |
628fda1db97c5e726e38584163fcec58cc457fc9 | [
"audit = Audit()\naudit.audit_type = AuditType.Project.value\naudit.audit_type_id = project.id\naudit.sub_type = None\naudit.sub_type_id = None\naudit.field = 'status'\naudit.old_value = None if project.status == ProjectStatus.Draft else project.status - 1\naudit.new_value = project.status\naudit.created_by = user.... | <|body_start_0|>
audit = Audit()
audit.audit_type = AuditType.Project.value
audit.audit_type_id = project.id
audit.sub_type = None
audit.sub_type_id = None
audit.field = 'status'
audit.old_value = None if project.status == ProjectStatus.Draft else project.status -... | Service to manage Audit log. | AuditService | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AuditService:
"""Service to manage Audit log."""
def log_project_status_change(cls, project: Project, user: User):
"""Log project status change after save."""
<|body_0|>
def log(cls, audit_type: AuditType, old_model, model, user: User):
"""Compare and log changes... | stack_v2_sparse_classes_36k_train_030067 | 2,618 | permissive | [
{
"docstring": "Log project status change after save.",
"name": "log_project_status_change",
"signature": "def log_project_status_change(cls, project: Project, user: User)"
},
{
"docstring": "Compare and log changes from model.",
"name": "log",
"signature": "def log(cls, audit_type: Audi... | 3 | stack_v2_sparse_classes_30k_val_001024 | Implement the Python class `AuditService` described below.
Class description:
Service to manage Audit log.
Method signatures and docstrings:
- def log_project_status_change(cls, project: Project, user: User): Log project status change after save.
- def log(cls, audit_type: AuditType, old_model, model, user: User): Co... | Implement the Python class `AuditService` described below.
Class description:
Service to manage Audit log.
Method signatures and docstrings:
- def log_project_status_change(cls, project: Project, user: User): Log project status change after save.
- def log(cls, audit_type: AuditType, old_model, model, user: User): Co... | 3bfe09c100a0f5b98d61228324336d5f45ad93ad | <|skeleton|>
class AuditService:
"""Service to manage Audit log."""
def log_project_status_change(cls, project: Project, user: User):
"""Log project status change after save."""
<|body_0|>
def log(cls, audit_type: AuditType, old_model, model, user: User):
"""Compare and log changes... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AuditService:
"""Service to manage Audit log."""
def log_project_status_change(cls, project: Project, user: User):
"""Log project status change after save."""
audit = Audit()
audit.audit_type = AuditType.Project.value
audit.audit_type_id = project.id
audit.sub_type... | the_stack_v2_python_sparse | selfservice-api/src/selfservice_api/services/audit.py | bcgov/BCSC-SS | train | 2 |
63d22c51c4672aa3a749280c75c1df311d6ab1c3 | [
"if User.objects.filter(email__iexact=value).exists():\n raise serializers.ValidationError(_('EMAIL.IN_USE'))\nreturn value.lower()",
"user = User(**data)\npassword = data.get('password')\nerrors = dict()\ntry:\n validators.validate_password(password=password, user=User)\nexcept exceptions.ValidationError a... | <|body_start_0|>
if User.objects.filter(email__iexact=value).exists():
raise serializers.ValidationError(_('EMAIL.IN_USE'))
return value.lower()
<|end_body_0|>
<|body_start_1|>
user = User(**data)
password = data.get('password')
errors = dict()
try:
... | Profile serializer for creating a user instance | ProfileCreateSerializer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProfileCreateSerializer:
"""Profile serializer for creating a user instance"""
def validate_email(self, value):
"""Check if email is already in use"""
<|body_0|>
def validate(self, data):
"""Validate Password"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_030068 | 6,076 | permissive | [
{
"docstring": "Check if email is already in use",
"name": "validate_email",
"signature": "def validate_email(self, value)"
},
{
"docstring": "Validate Password",
"name": "validate",
"signature": "def validate(self, data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000407 | Implement the Python class `ProfileCreateSerializer` described below.
Class description:
Profile serializer for creating a user instance
Method signatures and docstrings:
- def validate_email(self, value): Check if email is already in use
- def validate(self, data): Validate Password | Implement the Python class `ProfileCreateSerializer` described below.
Class description:
Profile serializer for creating a user instance
Method signatures and docstrings:
- def validate_email(self, value): Check if email is already in use
- def validate(self, data): Validate Password
<|skeleton|>
class ProfileCreate... | 5e1a2b51aee87eb79443e0489d13f976b0e6bae8 | <|skeleton|>
class ProfileCreateSerializer:
"""Profile serializer for creating a user instance"""
def validate_email(self, value):
"""Check if email is already in use"""
<|body_0|>
def validate(self, data):
"""Validate Password"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProfileCreateSerializer:
"""Profile serializer for creating a user instance"""
def validate_email(self, value):
"""Check if email is already in use"""
if User.objects.filter(email__iexact=value).exists():
raise serializers.ValidationError(_('EMAIL.IN_USE'))
return valu... | the_stack_v2_python_sparse | api/api_v1/profiles/serializers.py | ehsanghaffar/djangoware | train | 1 |
96e85c15aae8b697099964d70fba021dc4998790 | [
"import pandas as pd\nfiles = _tar_file_iterator(stream, fileselect=fileselect, filerename=filerename, verbose_open=verbose_open)\nsamples = _group_by_keys(files, meta=dict(__url__=path), suffixes=suffixes)\nfor sample in samples:\n if decoder is not None:\n sample = _apply_list(decoder, sample, default=_... | <|body_start_0|>
import pandas as pd
files = _tar_file_iterator(stream, fileselect=fileselect, filerename=filerename, verbose_open=verbose_open)
samples = _group_by_keys(files, meta=dict(__url__=path), suffixes=suffixes)
for sample in samples:
if decoder is not None:
... | A Datasource for WebDataset datasets (tar format with naming conventions). | WebDatasetDatasource | [
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WebDatasetDatasource:
"""A Datasource for WebDataset datasets (tar format with naming conventions)."""
def _read_stream(self, stream: 'pyarrow.NativeFile', path: str, decoder: Optional[Union[bool, str, callable, list]]=True, fileselect: Optional[Union[bool, callable, list]]=None, filerename:... | stack_v2_sparse_classes_36k_train_030069 | 12,607 | permissive | [
{
"docstring": "Read and decode samples from a stream. Note that fileselect selects files during reading, while suffixes selects files during the grouping step. Args: stream: File descriptor to read from. path: Path to the data. decoder: decoder or list of decoders to be applied to samples fileselect: Predicate... | 2 | null | Implement the Python class `WebDatasetDatasource` described below.
Class description:
A Datasource for WebDataset datasets (tar format with naming conventions).
Method signatures and docstrings:
- def _read_stream(self, stream: 'pyarrow.NativeFile', path: str, decoder: Optional[Union[bool, str, callable, list]]=True,... | Implement the Python class `WebDatasetDatasource` described below.
Class description:
A Datasource for WebDataset datasets (tar format with naming conventions).
Method signatures and docstrings:
- def _read_stream(self, stream: 'pyarrow.NativeFile', path: str, decoder: Optional[Union[bool, str, callable, list]]=True,... | edba68c3e7cf255d1d6479329f305adb7fa4c3ed | <|skeleton|>
class WebDatasetDatasource:
"""A Datasource for WebDataset datasets (tar format with naming conventions)."""
def _read_stream(self, stream: 'pyarrow.NativeFile', path: str, decoder: Optional[Union[bool, str, callable, list]]=True, fileselect: Optional[Union[bool, callable, list]]=None, filerename:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WebDatasetDatasource:
"""A Datasource for WebDataset datasets (tar format with naming conventions)."""
def _read_stream(self, stream: 'pyarrow.NativeFile', path: str, decoder: Optional[Union[bool, str, callable, list]]=True, fileselect: Optional[Union[bool, callable, list]]=None, filerename: Optional[Uni... | the_stack_v2_python_sparse | python/ray/data/datasource/webdataset_datasource.py | ray-project/ray | train | 29,482 |
675bc42bd2bb86d97d8deea5c91a1ffe8b84fcdd | [
"super(GluonTSModel, self).__init__(model_data, image, role, entry_point, predictor_cls=predictor_cls, **kwargs)\nself.framework_version = framework_version\nself.model_server_workers = model_server_workers",
"is_mms_version = parse_version(self.framework_version) >= parse_version(self._LOWEST_MMS_VERSION)\ndeplo... | <|body_start_0|>
super(GluonTSModel, self).__init__(model_data, image, role, entry_point, predictor_cls=predictor_cls, **kwargs)
self.framework_version = framework_version
self.model_server_workers = model_server_workers
<|end_body_0|>
<|body_start_1|>
is_mms_version = parse_version(sel... | An GluonTS SageMaker ``Model`` that can be deployed to a SageMaker ``Endpoint``. | GluonTSModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GluonTSModel:
"""An GluonTS SageMaker ``Model`` that can be deployed to a SageMaker ``Endpoint``."""
def __init__(self, model_data, role, entry_point, image: str=None, framework_version: str=GLUONTS_VERSION, predictor_cls=GluonTSPredictor, model_server_workers: int=None, **kwargs):
"... | stack_v2_sparse_classes_36k_train_030070 | 6,390 | permissive | [
{
"docstring": "Initialize a GluonTSModel. Parameters ---------- model_data: The S3 location of a SageMaker model data ``.tar.gz`` file. role: An AWS IAM role (either name or full ARN). The Amazon SageMaker training jobs and APIs that create Amazon SageMaker endpoints use this role to access training data and m... | 2 | stack_v2_sparse_classes_30k_train_018300 | Implement the Python class `GluonTSModel` described below.
Class description:
An GluonTS SageMaker ``Model`` that can be deployed to a SageMaker ``Endpoint``.
Method signatures and docstrings:
- def __init__(self, model_data, role, entry_point, image: str=None, framework_version: str=GLUONTS_VERSION, predictor_cls=Gl... | Implement the Python class `GluonTSModel` described below.
Class description:
An GluonTS SageMaker ``Model`` that can be deployed to a SageMaker ``Endpoint``.
Method signatures and docstrings:
- def __init__(self, model_data, role, entry_point, image: str=None, framework_version: str=GLUONTS_VERSION, predictor_cls=Gl... | df4256b0e67120db555c109a1bf6cfa2b3bd3cd8 | <|skeleton|>
class GluonTSModel:
"""An GluonTS SageMaker ``Model`` that can be deployed to a SageMaker ``Endpoint``."""
def __init__(self, model_data, role, entry_point, image: str=None, framework_version: str=GLUONTS_VERSION, predictor_cls=GluonTSPredictor, model_server_workers: int=None, **kwargs):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GluonTSModel:
"""An GluonTS SageMaker ``Model`` that can be deployed to a SageMaker ``Endpoint``."""
def __init__(self, model_data, role, entry_point, image: str=None, framework_version: str=GLUONTS_VERSION, predictor_cls=GluonTSPredictor, model_server_workers: int=None, **kwargs):
"""Initialize ... | the_stack_v2_python_sparse | src/gluonts/nursery/sagemaker_sdk/model.py | mbohlkeschneider/gluon-ts | train | 54 |
5a53986976488525cbfd3dee51d8beb14e80bf43 | [
"pages = ['http://www.dermundo.com']\nlangs = ['de', 'es', 'fr', 'pt']\nfor p in pages:\n for l in langs:\n params = dict(url=p, language=l)\n taskqueue.add(url='/wwl/crawler')",
"url = self.request.get('url')\nlanguage = self.request.get('language')\nheaders = dict()\nheaders['Accept-Language'] ... | <|body_start_0|>
pages = ['http://www.dermundo.com']
langs = ['de', 'es', 'fr', 'pt']
for p in pages:
for l in langs:
params = dict(url=p, language=l)
taskqueue.add(url='/wwl/crawler')
<|end_body_0|>
<|body_start_1|>
url = self.request.get('ur... | Crawler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Crawler:
def get(self):
"""Starts crawler worker tasks for main pages"""
<|body_0|>
def post(self):
"""Crawls pages scheduled by /wwl/crawler"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
pages = ['http://www.dermundo.com']
langs = ['de', ... | stack_v2_sparse_classes_36k_train_030071 | 1,511 | no_license | [
{
"docstring": "Starts crawler worker tasks for main pages",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Crawls pages scheduled by /wwl/crawler",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002722 | Implement the Python class `Crawler` described below.
Class description:
Implement the Crawler class.
Method signatures and docstrings:
- def get(self): Starts crawler worker tasks for main pages
- def post(self): Crawls pages scheduled by /wwl/crawler | Implement the Python class `Crawler` described below.
Class description:
Implement the Crawler class.
Method signatures and docstrings:
- def get(self): Starts crawler worker tasks for main pages
- def post(self): Crawls pages scheduled by /wwl/crawler
<|skeleton|>
class Crawler:
def get(self):
"""Start... | 06f65ff465c4dc742e71c9d17ec04268762bc9f3 | <|skeleton|>
class Crawler:
def get(self):
"""Starts crawler worker tasks for main pages"""
<|body_0|>
def post(self):
"""Crawls pages scheduled by /wwl/crawler"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Crawler:
def get(self):
"""Starts crawler worker tasks for main pages"""
pages = ['http://www.dermundo.com']
langs = ['de', 'es', 'fr', 'pt']
for p in pages:
for l in langs:
params = dict(url=p, language=l)
taskqueue.add(url='/wwl/cra... | the_stack_v2_python_sparse | worldwidelexicon/widgets/wwlproxy/crawler.py | thiur/worldwidelexicon | train | 0 | |
e5b99a7696dbf3dd7e541aae721b61621570f650 | [
"self.logger = logger\nself.grab_period = grab_period\nself.grab_limit = grab_limit\nself.file_index = 1\nself.call_index = 0\nimage_dirs = sorted(glob.glob('Images[0-9][0-9][0-9][0-9]'))\nif len(image_dirs) != 0:\n last_dir = image_dirs[-1]\n dir_index = int(last_dir[-4:]) + 1\nelse:\n dir_index = 1\nself... | <|body_start_0|>
self.logger = logger
self.grab_period = grab_period
self.grab_limit = grab_limit
self.file_index = 1
self.call_index = 0
image_dirs = sorted(glob.glob('Images[0-9][0-9][0-9][0-9]'))
if len(image_dirs) != 0:
last_dir = image_dirs[-1]
... | ImageGrabber | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageGrabber:
def __init__(self, logger, grab_period=5, grab_limit=100):
"""Create a image grabber that grabs an image every grab_period calls. Default is every 5th call. Usage: ig = ImageGrabber(logger, grab_period=5, grab_limit=50) while 1: ret, frame = cap.read() # get image, for exam... | stack_v2_sparse_classes_36k_train_030072 | 1,983 | no_license | [
{
"docstring": "Create a image grabber that grabs an image every grab_period calls. Default is every 5th call. Usage: ig = ImageGrabber(logger, grab_period=5, grab_limit=50) while 1: ret, frame = cap.read() # get image, for example process_image_to_extract_info(frame) if appropriate_to_grab: ig.grab(frame,log_m... | 2 | stack_v2_sparse_classes_30k_train_007881 | Implement the Python class `ImageGrabber` described below.
Class description:
Implement the ImageGrabber class.
Method signatures and docstrings:
- def __init__(self, logger, grab_period=5, grab_limit=100): Create a image grabber that grabs an image every grab_period calls. Default is every 5th call. Usage: ig = Imag... | Implement the Python class `ImageGrabber` described below.
Class description:
Implement the ImageGrabber class.
Method signatures and docstrings:
- def __init__(self, logger, grab_period=5, grab_limit=100): Create a image grabber that grabs an image every grab_period calls. Default is every 5th call. Usage: ig = Imag... | 6452a0b36b60ab79c2d113cbe9d68ea79e9e6ed2 | <|skeleton|>
class ImageGrabber:
def __init__(self, logger, grab_period=5, grab_limit=100):
"""Create a image grabber that grabs an image every grab_period calls. Default is every 5th call. Usage: ig = ImageGrabber(logger, grab_period=5, grab_limit=50) while 1: ret, frame = cap.read() # get image, for exam... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImageGrabber:
def __init__(self, logger, grab_period=5, grab_limit=100):
"""Create a image grabber that grabs an image every grab_period calls. Default is every 5th call. Usage: ig = ImageGrabber(logger, grab_period=5, grab_limit=50) while 1: ret, frame = cap.read() # get image, for example process_im... | the_stack_v2_python_sparse | image_grabber.py | FRC1076/Vision_2016 | train | 0 | |
577919043c0f591141055425e96e01912b45715f | [
"sql = self._grammar.compile_table_exists()\ndatabase = self._connection.get_database_name()\ntable = self._connection.get_table_prefix() + table\nreturn len(self._connection.select(sql, [database, table])) > 0",
"sql = self._grammar.compile_column_exists()\ndatabase = self._connection.get_database_name()\ntable ... | <|body_start_0|>
sql = self._grammar.compile_table_exists()
database = self._connection.get_database_name()
table = self._connection.get_table_prefix() + table
return len(self._connection.select(sql, [database, table])) > 0
<|end_body_0|>
<|body_start_1|>
sql = self._grammar.com... | MySQLSchemaBuilder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MySQLSchemaBuilder:
def has_table(self, table):
"""Determine if the given table exists. :param table: The table :type table: str :rtype: bool"""
<|body_0|>
def get_column_listing(self, table):
"""Get the column listing for a given table. :param table: The table :type... | stack_v2_sparse_classes_36k_train_030073 | 1,229 | permissive | [
{
"docstring": "Determine if the given table exists. :param table: The table :type table: str :rtype: bool",
"name": "has_table",
"signature": "def has_table(self, table)"
},
{
"docstring": "Get the column listing for a given table. :param table: The table :type table: str :rtype: list",
"na... | 2 | stack_v2_sparse_classes_30k_train_016229 | Implement the Python class `MySQLSchemaBuilder` described below.
Class description:
Implement the MySQLSchemaBuilder class.
Method signatures and docstrings:
- def has_table(self, table): Determine if the given table exists. :param table: The table :type table: str :rtype: bool
- def get_column_listing(self, table): ... | Implement the Python class `MySQLSchemaBuilder` described below.
Class description:
Implement the MySQLSchemaBuilder class.
Method signatures and docstrings:
- def has_table(self, table): Determine if the given table exists. :param table: The table :type table: str :rtype: bool
- def get_column_listing(self, table): ... | 375ffeb9b519ca1ac4cc5be4b61e87c0a82d1be4 | <|skeleton|>
class MySQLSchemaBuilder:
def has_table(self, table):
"""Determine if the given table exists. :param table: The table :type table: str :rtype: bool"""
<|body_0|>
def get_column_listing(self, table):
"""Get the column listing for a given table. :param table: The table :type... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MySQLSchemaBuilder:
def has_table(self, table):
"""Determine if the given table exists. :param table: The table :type table: str :rtype: bool"""
sql = self._grammar.compile_table_exists()
database = self._connection.get_database_name()
table = self._connection.get_table_prefix(... | the_stack_v2_python_sparse | orator/schema/mysql_builder.py | MasoniteFramework/orator | train | 1 | |
d52dda6e9972a945db4028d5bac7f7d27b1ffdc0 | [
"idxDict = dict()\nfor idx, num in enumerate(nums):\n if target - num in idxDict:\n return [idxDict[target - num], idx]\n idxDict[num] = idx",
"_nums = []\nfor i in xrange(len(nums)):\n _nums.append((i, nums[i]))\n_nums = sorted(_nums, key=lambda num: num[1])\ni, j = (0, len(_nums) - 1)\nwhile i <... | <|body_start_0|>
idxDict = dict()
for idx, num in enumerate(nums):
if target - num in idxDict:
return [idxDict[target - num], idx]
idxDict[num] = idx
<|end_body_0|>
<|body_start_1|>
_nums = []
for i in xrange(len(nums)):
_nums.append((... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] 假设有唯一解,可以用hash表存下target-num的索引 time: O(n) space: O(n)"""
<|body_0|>
def twoSum2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] 先排... | stack_v2_sparse_classes_36k_train_030074 | 1,382 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int] 假设有唯一解,可以用hash表存下target-num的索引 time: O(n) space: O(n)",
"name": "twoSum",
"signature": "def twoSum(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int] 先排序再用夹逼法进行查找",
"name"... | 2 | stack_v2_sparse_classes_30k_train_014825 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] 假设有唯一解,可以用hash表存下target-num的索引 time: O(n) space: O(n)
- def twoSum2(self, nums, target):... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] 假设有唯一解,可以用hash表存下target-num的索引 time: O(n) space: O(n)
- def twoSum2(self, nums, target):... | 9687f8e743a8b6396fff192f22b5256d1025f86b | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] 假设有唯一解,可以用hash表存下target-num的索引 time: O(n) space: O(n)"""
<|body_0|>
def twoSum2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] 先排... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] 假设有唯一解,可以用hash表存下target-num的索引 time: O(n) space: O(n)"""
idxDict = dict()
for idx, num in enumerate(nums):
if target - num in idxDict:
return [idxDict[targ... | the_stack_v2_python_sparse | 2017/hashtab/Two_Sum.py | buhuipao/LeetCode | train | 5 | |
7d24e02be100406ad2f5d8369abefe79cedf2503 | [
"self._fitted_markov = fitted_markov\nself._chain_length = chain_length\nself.equilibrium_distro = fitted_markov.get_equilibrium_distro()\nself._fraction_below_states = fraction_below_states",
"initial_state_rv = numpy.random.rand()\nfor initial_state in range(self._fraction_below_states.size):\n initial_state... | <|body_start_0|>
self._fitted_markov = fitted_markov
self._chain_length = chain_length
self.equilibrium_distro = fitted_markov.get_equilibrium_distro()
self._fraction_below_states = fraction_below_states
<|end_body_0|>
<|body_start_1|>
initial_state_rv = numpy.random.rand()
... | Generator of random realizations of CDF at quantile. | DrawRandomCDF | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DrawRandomCDF:
"""Generator of random realizations of CDF at quantile."""
def __init__(self, fitted_markov, chain_length, fraction_below_states):
"""Prepare to draw random realizations of the CDF per given process."""
<|body_0|>
def __call__(self):
"""Generate an... | stack_v2_sparse_classes_36k_train_030075 | 13,854 | permissive | [
{
"docstring": "Prepare to draw random realizations of the CDF per given process.",
"name": "__init__",
"signature": "def __init__(self, fitted_markov, chain_length, fraction_below_states)"
},
{
"docstring": "Generate another independent random sample.",
"name": "__call__",
"signature": ... | 2 | stack_v2_sparse_classes_30k_train_003211 | Implement the Python class `DrawRandomCDF` described below.
Class description:
Generator of random realizations of CDF at quantile.
Method signatures and docstrings:
- def __init__(self, fitted_markov, chain_length, fraction_below_states): Prepare to draw random realizations of the CDF per given process.
- def __call... | Implement the Python class `DrawRandomCDF` described below.
Class description:
Generator of random realizations of CDF at quantile.
Method signatures and docstrings:
- def __init__(self, fitted_markov, chain_length, fraction_below_states): Prepare to draw random realizations of the CDF per given process.
- def __call... | 18f5f35239d3c9ce3ebfd072f5dbc72f5f1532e9 | <|skeleton|>
class DrawRandomCDF:
"""Generator of random realizations of CDF at quantile."""
def __init__(self, fitted_markov, chain_length, fraction_below_states):
"""Prepare to draw random realizations of the CDF per given process."""
<|body_0|>
def __call__(self):
"""Generate an... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DrawRandomCDF:
"""Generator of random realizations of CDF at quantile."""
def __init__(self, fitted_markov, chain_length, fraction_below_states):
"""Prepare to draw random realizations of the CDF per given process."""
self._fitted_markov = fitted_markov
self._chain_length = chain_... | the_stack_v2_python_sparse | emcee_quantile_convergence.py | kpenev/general_purpose_python_modules | train | 0 |
0c0f5243c511c84f13e31cf058e1a67678a9a938 | [
"if control_signal_fns:\n control_event = tuple((f(0) for f in control_signal_fns))\n if disable_conditioning_fn is not None:\n control_event = (disable_conditioning_fn(0), control_event)\n control_events = [control_event]\n control_state = PerformanceControlState(current_perf_index=0, current_pe... | <|body_start_0|>
if control_signal_fns:
control_event = tuple((f(0) for f in control_signal_fns))
if disable_conditioning_fn is not None:
control_event = (disable_conditioning_fn(0), control_event)
control_events = [control_event]
control_state = P... | Class for RNN performance generation models. | PerformanceRnnModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PerformanceRnnModel:
"""Class for RNN performance generation models."""
def generate_performance(self, num_steps, primer_sequence, temperature=1.0, beam_size=1, branch_factor=1, steps_per_iteration=1, control_signal_fns=None, disable_conditioning_fn=None):
"""Generate a performance t... | stack_v2_sparse_classes_36k_train_030076 | 14,668 | permissive | [
{
"docstring": "Generate a performance track from a primer performance track. Args: num_steps: The integer length in steps of the final track, after generation. Includes the primer. primer_sequence: The primer sequence, a Performance object. temperature: A float specifying how much to divide the logits by befor... | 2 | null | Implement the Python class `PerformanceRnnModel` described below.
Class description:
Class for RNN performance generation models.
Method signatures and docstrings:
- def generate_performance(self, num_steps, primer_sequence, temperature=1.0, beam_size=1, branch_factor=1, steps_per_iteration=1, control_signal_fns=None... | Implement the Python class `PerformanceRnnModel` described below.
Class description:
Class for RNN performance generation models.
Method signatures and docstrings:
- def generate_performance(self, num_steps, primer_sequence, temperature=1.0, beam_size=1, branch_factor=1, steps_per_iteration=1, control_signal_fns=None... | 548dc4e2e6a8e3ac65e1921bd94fe589d661d47b | <|skeleton|>
class PerformanceRnnModel:
"""Class for RNN performance generation models."""
def generate_performance(self, num_steps, primer_sequence, temperature=1.0, beam_size=1, branch_factor=1, steps_per_iteration=1, control_signal_fns=None, disable_conditioning_fn=None):
"""Generate a performance t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PerformanceRnnModel:
"""Class for RNN performance generation models."""
def generate_performance(self, num_steps, primer_sequence, temperature=1.0, beam_size=1, branch_factor=1, steps_per_iteration=1, control_signal_fns=None, disable_conditioning_fn=None):
"""Generate a performance track from a p... | the_stack_v2_python_sparse | magenta/models/performance_rnn/performance_model.py | magenta/magenta | train | 4,142 |
fbbf8122b3a330fe9b615a99cee7ebc5097fd799 | [
"self.call_id = call_id\nself.parent_call_id = parent_call_id\nself.application_id = application_id\nself.account_id = account_id\nself.to = to\nself.mfrom = mfrom\nself.direction = direction\nself.state = state\nself.start_time = APIHelper.RFC3339DateTime(start_time) if start_time else None\nself.answer_time = API... | <|body_start_0|>
self.call_id = call_id
self.parent_call_id = parent_call_id
self.application_id = application_id
self.account_id = account_id
self.to = to
self.mfrom = mfrom
self.direction = direction
self.state = state
self.start_time = APIHelper... | Implementation of the 'ApiCallStateResponse' model. TODO: type model description here. Attributes: call_id (string): TODO: type description here. parent_call_id (string): TODO: type description here. application_id (string): TODO: type description here. account_id (string): TODO: type description here. to (string): TOD... | ApiCallStateResponse | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiCallStateResponse:
"""Implementation of the 'ApiCallStateResponse' model. TODO: type model description here. Attributes: call_id (string): TODO: type description here. parent_call_id (string): TODO: type description here. application_id (string): TODO: type description here. account_id (string... | stack_v2_sparse_classes_36k_train_030077 | 5,493 | permissive | [
{
"docstring": "Constructor for the ApiCallStateResponse class",
"name": "__init__",
"signature": "def __init__(self, call_id=None, parent_call_id=None, application_id=None, account_id=None, to=None, mfrom=None, direction=None, state=None, start_time=None, answer_time=None, end_time=None, disconnect_cau... | 2 | stack_v2_sparse_classes_30k_val_001138 | Implement the Python class `ApiCallStateResponse` described below.
Class description:
Implementation of the 'ApiCallStateResponse' model. TODO: type model description here. Attributes: call_id (string): TODO: type description here. parent_call_id (string): TODO: type description here. application_id (string): TODO: ty... | Implement the Python class `ApiCallStateResponse` described below.
Class description:
Implementation of the 'ApiCallStateResponse' model. TODO: type model description here. Attributes: call_id (string): TODO: type description here. parent_call_id (string): TODO: type description here. application_id (string): TODO: ty... | 5332f29d1c093003444384f63a9d4a00843c954f | <|skeleton|>
class ApiCallStateResponse:
"""Implementation of the 'ApiCallStateResponse' model. TODO: type model description here. Attributes: call_id (string): TODO: type description here. parent_call_id (string): TODO: type description here. application_id (string): TODO: type description here. account_id (string... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ApiCallStateResponse:
"""Implementation of the 'ApiCallStateResponse' model. TODO: type model description here. Attributes: call_id (string): TODO: type description here. parent_call_id (string): TODO: type description here. application_id (string): TODO: type description here. account_id (string): TODO: type... | the_stack_v2_python_sparse | bandwidth/voice/models/api_call_state_response.py | Spaced-Out/python-bandwidth-sdk | train | 0 |
109a7f4b043dc9bb993cd3ba83c004b66adc1b9c | [
"plugin = NeighbourSelection()\nresult, result_nodes = plugin.build_KDTree(self.region_land_mask)\nexpected_length = self.region_land_mask.shape[0] * self.region_land_mask.shape[1]\nself.assertEqual(result_nodes.shape[0], expected_length)\nself.assertIsInstance(result, scipy.spatial.ckdtree.cKDTree)",
"plugin = N... | <|body_start_0|>
plugin = NeighbourSelection()
result, result_nodes = plugin.build_KDTree(self.region_land_mask)
expected_length = self.region_land_mask.shape[0] * self.region_land_mask.shape[1]
self.assertEqual(result_nodes.shape[0], expected_length)
self.assertIsInstance(result... | Test construction of a KDTree with scipy. | Test_build_KDTree | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_build_KDTree:
"""Test construction of a KDTree with scipy."""
def test_basic(self):
"""Test that the expected number of nodes are created and that a tree is returned; this should be the lengths of the x and y coordinates multiplied in the simple case."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_030078 | 40,371 | permissive | [
{
"docstring": "Test that the expected number of nodes are created and that a tree is returned; this should be the lengths of the x and y coordinates multiplied in the simple case.",
"name": "test_basic",
"signature": "def test_basic(self)"
},
{
"docstring": "Test that the expected number of nod... | 2 | null | Implement the Python class `Test_build_KDTree` described below.
Class description:
Test construction of a KDTree with scipy.
Method signatures and docstrings:
- def test_basic(self): Test that the expected number of nodes are created and that a tree is returned; this should be the lengths of the x and y coordinates m... | Implement the Python class `Test_build_KDTree` described below.
Class description:
Test construction of a KDTree with scipy.
Method signatures and docstrings:
- def test_basic(self): Test that the expected number of nodes are created and that a tree is returned; this should be the lengths of the x and y coordinates m... | cd2c9019944345df1e703bf8f625db537ad9f559 | <|skeleton|>
class Test_build_KDTree:
"""Test construction of a KDTree with scipy."""
def test_basic(self):
"""Test that the expected number of nodes are created and that a tree is returned; this should be the lengths of the x and y coordinates multiplied in the simple case."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test_build_KDTree:
"""Test construction of a KDTree with scipy."""
def test_basic(self):
"""Test that the expected number of nodes are created and that a tree is returned; this should be the lengths of the x and y coordinates multiplied in the simple case."""
plugin = NeighbourSelection()... | the_stack_v2_python_sparse | improver_tests/spotdata/test_NeighbourSelection.py | metoppv/improver | train | 101 |
99ecabd7878a307ded4f743e80d294fd7a4ad100 | [
"SizedWidget.__init__(self, width, height)\nself.background = GetTransparentSurface(width - 6, height - 6)\nself.background.fill((3, 60, 176, 127))\nself.horizontalBar = Surface((width - 6, 4))\nself.verticalBar = Surface((4, height - 6))",
"self.drawOnSurface(self.background, left=3.0 / self.width, top=3.0 / sel... | <|body_start_0|>
SizedWidget.__init__(self, width, height)
self.background = GetTransparentSurface(width - 6, height - 6)
self.background.fill((3, 60, 176, 127))
self.horizontalBar = Surface((width - 6, 4))
self.verticalBar = Surface((4, height - 6))
<|end_body_0|>
<|body_start_... | Represents the widget for a Menu Background | MenuBackgroundWidget | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MenuBackgroundWidget:
"""Represents the widget for a Menu Background"""
def __init__(self, width, height):
"""Initialize the widget"""
<|body_0|>
def drawSurface(self):
"""Draw the Widget"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
SizedWidg... | stack_v2_sparse_classes_36k_train_030079 | 1,701 | no_license | [
{
"docstring": "Initialize the widget",
"name": "__init__",
"signature": "def __init__(self, width, height)"
},
{
"docstring": "Draw the Widget",
"name": "drawSurface",
"signature": "def drawSurface(self)"
}
] | 2 | null | Implement the Python class `MenuBackgroundWidget` described below.
Class description:
Represents the widget for a Menu Background
Method signatures and docstrings:
- def __init__(self, width, height): Initialize the widget
- def drawSurface(self): Draw the Widget | Implement the Python class `MenuBackgroundWidget` described below.
Class description:
Represents the widget for a Menu Background
Method signatures and docstrings:
- def __init__(self, width, height): Initialize the widget
- def drawSurface(self): Draw the Widget
<|skeleton|>
class MenuBackgroundWidget:
"""Repre... | 3931eee5fd04e18bb1738a0b27a4c6979dc4db01 | <|skeleton|>
class MenuBackgroundWidget:
"""Represents the widget for a Menu Background"""
def __init__(self, width, height):
"""Initialize the widget"""
<|body_0|>
def drawSurface(self):
"""Draw the Widget"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MenuBackgroundWidget:
"""Represents the widget for a Menu Background"""
def __init__(self, width, height):
"""Initialize the widget"""
SizedWidget.__init__(self, width, height)
self.background = GetTransparentSurface(width - 6, height - 6)
self.background.fill((3, 60, 176,... | the_stack_v2_python_sparse | src/Screen/Pygame/Menu/menu_background_widget.py | sgtnourry/Pokemon-Project | train | 0 |
52f8ab59a6c17c6fdd3c26f46e564645874801f2 | [
"try:\n applet = Applet().load(id=applet, force=True)\nexcept:\n raise ValidationException(message='Invalid Applet ID', field='applet')\nassignmentsCollection = Collection().findOne({'name': 'Assignments'})\nif not assignmentsCollection:\n Collection().createCollection('Assignments')\ntry:\n assignment ... | <|body_start_0|>
try:
applet = Applet().load(id=applet, force=True)
except:
raise ValidationException(message='Invalid Applet ID', field='applet')
assignmentsCollection = Collection().findOne({'name': 'Assignments'})
if not assignmentsCollection:
Colle... | Assignments are access-controlled Folders, each of which contains managerially-controlled Applet Folders. | Assignment | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Assignment:
"""Assignments are access-controlled Folders, each of which contains managerially-controlled Applet Folders."""
def create(self, applet, user):
"""Create an Assignment for a given Applet, returning an existing Assignment if one or more exists. :param applet: The ID of the... | stack_v2_sparse_classes_36k_train_030080 | 8,452 | permissive | [
{
"docstring": "Create an Assignment for a given Applet, returning an existing Assignment if one or more exists. :param applet: The ID of the Applet for which to find Assignments. :type applet: str :param user: User :type user: User :returns: New Assignments",
"name": "create",
"signature": "def create(... | 3 | stack_v2_sparse_classes_30k_train_015704 | Implement the Python class `Assignment` described below.
Class description:
Assignments are access-controlled Folders, each of which contains managerially-controlled Applet Folders.
Method signatures and docstrings:
- def create(self, applet, user): Create an Assignment for a given Applet, returning an existing Assig... | Implement the Python class `Assignment` described below.
Class description:
Assignments are access-controlled Folders, each of which contains managerially-controlled Applet Folders.
Method signatures and docstrings:
- def create(self, applet, user): Create an Assignment for a given Applet, returning an existing Assig... | 96b76353e59377c920570fca767fe4faa84965f7 | <|skeleton|>
class Assignment:
"""Assignments are access-controlled Folders, each of which contains managerially-controlled Applet Folders."""
def create(self, applet, user):
"""Create an Assignment for a given Applet, returning an existing Assignment if one or more exists. :param applet: The ID of the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Assignment:
"""Assignments are access-controlled Folders, each of which contains managerially-controlled Applet Folders."""
def create(self, applet, user):
"""Create an Assignment for a given Applet, returning an existing Assignment if one or more exists. :param applet: The ID of the Applet for w... | the_stack_v2_python_sparse | girderformindlogger/models/assignment.py | jj105/mindlogger-app-backend | train | 0 |
c9ba981394003fe64a5b71a299d283d6134e4452 | [
"self.request_id = request_id\nself.valid = valid\nself.seal = seal\nself.signers = signers\nself.summary = summary\nself.validation_error = validation_error\nself.audit_id = audit_id\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\nrequest_id = dictionary.get('reque... | <|body_start_0|>
self.request_id = request_id
self.valid = valid
self.seal = seal
self.signers = signers
self.summary = summary
self.validation_error = validation_error
self.audit_id = audit_id
self.additional_properties = additional_properties
<|end_body_... | Implementation of the 'ValidateSDOResponse' model. TODO: type model description here. Attributes: request_id (string): TODO: type description here. valid (bool): Is the SDO valid seal (Seal): Is the Seal of the SDO valid signers (list of ValidatedSigners): TODO: type description here. summary (string): TODO: type descr... | ValidateSDOResponse | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValidateSDOResponse:
"""Implementation of the 'ValidateSDOResponse' model. TODO: type model description here. Attributes: request_id (string): TODO: type description here. valid (bool): Is the SDO valid seal (Seal): Is the Seal of the SDO valid signers (list of ValidatedSigners): TODO: type descr... | stack_v2_sparse_classes_36k_train_030081 | 3,878 | permissive | [
{
"docstring": "Constructor for the ValidateSDOResponse class",
"name": "__init__",
"signature": "def __init__(self, request_id=None, valid=None, seal=None, signers=None, summary=None, validation_error=None, audit_id=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this... | 2 | null | Implement the Python class `ValidateSDOResponse` described below.
Class description:
Implementation of the 'ValidateSDOResponse' model. TODO: type model description here. Attributes: request_id (string): TODO: type description here. valid (bool): Is the SDO valid seal (Seal): Is the Seal of the SDO valid signers (list... | Implement the Python class `ValidateSDOResponse` described below.
Class description:
Implementation of the 'ValidateSDOResponse' model. TODO: type model description here. Attributes: request_id (string): TODO: type description here. valid (bool): Is the SDO valid seal (Seal): Is the Seal of the SDO valid signers (list... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class ValidateSDOResponse:
"""Implementation of the 'ValidateSDOResponse' model. TODO: type model description here. Attributes: request_id (string): TODO: type description here. valid (bool): Is the SDO valid seal (Seal): Is the Seal of the SDO valid signers (list of ValidatedSigners): TODO: type descr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ValidateSDOResponse:
"""Implementation of the 'ValidateSDOResponse' model. TODO: type model description here. Attributes: request_id (string): TODO: type description here. valid (bool): Is the SDO valid seal (Seal): Is the Seal of the SDO valid signers (list of ValidatedSigners): TODO: type description here. ... | the_stack_v2_python_sparse | idfy_rest_client/models/validate_sdo_response.py | dealflowteam/Idfy | train | 0 |
937da1ba3199550c04aa656c0a29fc6b0bf7ca11 | [
"if not head:\n return None\nbefore, after = self.split(head, x)\nnode = self.merge(before, after)\nreturn node",
"before.next = fast\nafter.next = slow\nwhile head:\n if head.val <= x:\n fast.next = head\n fast = fast.next\n else:\n slow.next = head\n slow = slow.next\n he... | <|body_start_0|>
if not head:
return None
before, after = self.split(head, x)
node = self.merge(before, after)
return node
<|end_body_0|>
<|body_start_1|>
before.next = fast
after.next = slow
while head:
if head.val <= x:
f... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def partition(self, head, x):
"""Partition a linked list around value x and returns the head. Approach: Divide and Conquer - Merge Sort 1. Divides the list into two halves around x. 3. Merges the halves and updates the head pointer. Analysis: Time Complexity: O(NlogN), where N ... | stack_v2_sparse_classes_36k_train_030082 | 1,534 | no_license | [
{
"docstring": "Partition a linked list around value x and returns the head. Approach: Divide and Conquer - Merge Sort 1. Divides the list into two halves around x. 3. Merges the halves and updates the head pointer. Analysis: Time Complexity: O(NlogN), where N means the number of the given list.",
"name": "... | 3 | stack_v2_sparse_classes_30k_train_017403 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def partition(self, head, x): Partition a linked list around value x and returns the head. Approach: Divide and Conquer - Merge Sort 1. Divides the list into two halves around x.... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def partition(self, head, x): Partition a linked list around value x and returns the head. Approach: Divide and Conquer - Merge Sort 1. Divides the list into two halves around x.... | 14977e1d321ceb55aa73cf4782a6bbbb13b5373e | <|skeleton|>
class Solution:
def partition(self, head, x):
"""Partition a linked list around value x and returns the head. Approach: Divide and Conquer - Merge Sort 1. Divides the list into two halves around x. 3. Merges the halves and updates the head pointer. Analysis: Time Complexity: O(NlogN), where N ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def partition(self, head, x):
"""Partition a linked list around value x and returns the head. Approach: Divide and Conquer - Merge Sort 1. Divides the list into two halves around x. 3. Merges the halves and updates the head pointer. Analysis: Time Complexity: O(NlogN), where N means the numb... | the_stack_v2_python_sparse | python/partition_lists.py | iamedwardshen/leetcode-solutions | train | 1 | |
261b27e358a07113a7514dbc32996d90756e4624 | [
"self.pump_capacity = pump_capacity\nself.hw_to_start_pumping = hw_to_start_pumping\nself.hw_to_stop_pumping = hw_to_stop_pumping\nself.pump_rate_of_increase = pump_rate_of_increase\nself.pump_rate_of_decrease = pump_rate_of_decrease\nself.domain = domain\nself.last_time_called = domain.get_time()\nself.time = doma... | <|body_start_0|>
self.pump_capacity = pump_capacity
self.hw_to_start_pumping = hw_to_start_pumping
self.hw_to_stop_pumping = hw_to_stop_pumping
self.pump_rate_of_increase = pump_rate_of_increase
self.pump_rate_of_decrease = pump_rate_of_decrease
self.domain = domain
... | Transfer water from one site to another at a given rate, based on the pump capacities and observed headwater/tailwater. This class returns a callable object which can compute the rate of pumping. This can be passed to an internal_boundary_operator. The locations of the latter are defined based on the enquiry points of ... | pumping_station_function | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class pumping_station_function:
"""Transfer water from one site to another at a given rate, based on the pump capacities and observed headwater/tailwater. This class returns a callable object which can compute the rate of pumping. This can be passed to an internal_boundary_operator. The locations of th... | stack_v2_sparse_classes_36k_train_030083 | 19,665 | permissive | [
{
"docstring": "@param domain ANUGA domain @param pump_capacity (m^3/s) @param hw_to_start_pumping Turn pumps on if hw exceeds this (m) @param hw_to_stop_pumping Turn pumps off if hw below this (m) @param initial_pump_rate rate of pumps at start of simulation (m^3/s) @param pump_rate_of_increase Accelleration o... | 2 | null | Implement the Python class `pumping_station_function` described below.
Class description:
Transfer water from one site to another at a given rate, based on the pump capacities and observed headwater/tailwater. This class returns a callable object which can compute the rate of pumping. This can be passed to an internal... | Implement the Python class `pumping_station_function` described below.
Class description:
Transfer water from one site to another at a given rate, based on the pump capacities and observed headwater/tailwater. This class returns a callable object which can compute the rate of pumping. This can be passed to an internal... | 6d6d8e22b7e15b601f960c198b521bc20682477c | <|skeleton|>
class pumping_station_function:
"""Transfer water from one site to another at a given rate, based on the pump capacities and observed headwater/tailwater. This class returns a callable object which can compute the rate of pumping. This can be passed to an internal_boundary_operator. The locations of th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class pumping_station_function:
"""Transfer water from one site to another at a given rate, based on the pump capacities and observed headwater/tailwater. This class returns a callable object which can compute the rate of pumping. This can be passed to an internal_boundary_operator. The locations of the latter are ... | the_stack_v2_python_sparse | anuga/structures/internal_boundary_functions.py | stoiver/anuga_core | train | 4 |
459ef204d1c0f363be5dcfe3248056ac298a29ef | [
"threading.Thread.__init__(self)\nself.func = func\nself.args = args\nself.kwargs = kwargs\nself.result = NoResult",
"try:\n self.result = self.func(*self.args, **self.kwargs)\nexcept Exception as e:\n self.result = NoResult"
] | <|body_start_0|>
threading.Thread.__init__(self)
self.func = func
self.args = args
self.kwargs = kwargs
self.result = NoResult
<|end_body_0|>
<|body_start_1|>
try:
self.result = self.func(*self.args, **self.kwargs)
except Exception as e:
s... | A Thread which can be used to timeout | TimeoutThread | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TimeoutThread:
"""A Thread which can be used to timeout"""
def __init__(self, func, *args, **kwargs) -> None:
"""Construct a Timeout Thread :param func: The function being called :param args: The arguments :param kwargs: The key word arguments"""
<|body_0|>
def run(self)... | stack_v2_sparse_classes_36k_train_030084 | 2,229 | no_license | [
{
"docstring": "Construct a Timeout Thread :param func: The function being called :param args: The arguments :param kwargs: The key word arguments",
"name": "__init__",
"signature": "def __init__(self, func, *args, **kwargs) -> None"
},
{
"docstring": "Call the function with the arguments to get... | 2 | stack_v2_sparse_classes_30k_train_001101 | Implement the Python class `TimeoutThread` described below.
Class description:
A Thread which can be used to timeout
Method signatures and docstrings:
- def __init__(self, func, *args, **kwargs) -> None: Construct a Timeout Thread :param func: The function being called :param args: The arguments :param kwargs: The ke... | Implement the Python class `TimeoutThread` described below.
Class description:
A Thread which can be used to timeout
Method signatures and docstrings:
- def __init__(self, func, *args, **kwargs) -> None: Construct a Timeout Thread :param func: The function being called :param args: The arguments :param kwargs: The ke... | a59252a7d55a474bcb2b469414902c585bc89641 | <|skeleton|>
class TimeoutThread:
"""A Thread which can be used to timeout"""
def __init__(self, func, *args, **kwargs) -> None:
"""Construct a Timeout Thread :param func: The function being called :param args: The arguments :param kwargs: The key word arguments"""
<|body_0|>
def run(self)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TimeoutThread:
"""A Thread which can be used to timeout"""
def __init__(self, func, *args, **kwargs) -> None:
"""Construct a Timeout Thread :param func: The function being called :param args: The arguments :param kwargs: The key word arguments"""
threading.Thread.__init__(self)
se... | the_stack_v2_python_sparse | evolution/root_evo/data_defs/timeout.py | escowart/SoftwareDev | train | 0 |
6686b9ffc6573f146a957b5eb063297d49c57622 | [
"result = {'result': 'NG', 'content': ''}\nsec_data = CtrlDSSection().get_sub_by_usecase(usecase_id, sec_type)\nif sec_data:\n result['result'] = 'OK'\n result['content'] = {'usecase_id': usecase_id, 'sec_type': sec_type, 'section_list': sec_data}\nreturn result",
"data_json = request.get_json()\nresult = {... | <|body_start_0|>
result = {'result': 'NG', 'content': ''}
sec_data = CtrlDSSection().get_sub_by_usecase(usecase_id, sec_type)
if sec_data:
result['result'] = 'OK'
result['content'] = {'usecase_id': usecase_id, 'sec_type': sec_type, 'section_list': sec_data}
return... | ApiDsUcSub | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiDsUcSub:
def get(self, usecase_id, sec_type):
"""取usecase下的sequence :return:"""
<|body_0|>
def post(self):
"""編輯usecase下的usecase :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = {'result': 'NG', 'content': ''}
sec_data = ... | stack_v2_sparse_classes_36k_train_030085 | 31,026 | no_license | [
{
"docstring": "取usecase下的sequence :return:",
"name": "get",
"signature": "def get(self, usecase_id, sec_type)"
},
{
"docstring": "編輯usecase下的usecase :return:",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016522 | Implement the Python class `ApiDsUcSub` described below.
Class description:
Implement the ApiDsUcSub class.
Method signatures and docstrings:
- def get(self, usecase_id, sec_type): 取usecase下的sequence :return:
- def post(self): 編輯usecase下的usecase :return: | Implement the Python class `ApiDsUcSub` described below.
Class description:
Implement the ApiDsUcSub class.
Method signatures and docstrings:
- def get(self, usecase_id, sec_type): 取usecase下的sequence :return:
- def post(self): 編輯usecase下的usecase :return:
<|skeleton|>
class ApiDsUcSub:
def get(self, usecase_id, ... | 64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11 | <|skeleton|>
class ApiDsUcSub:
def get(self, usecase_id, sec_type):
"""取usecase下的sequence :return:"""
<|body_0|>
def post(self):
"""編輯usecase下的usecase :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ApiDsUcSub:
def get(self, usecase_id, sec_type):
"""取usecase下的sequence :return:"""
result = {'result': 'NG', 'content': ''}
sec_data = CtrlDSSection().get_sub_by_usecase(usecase_id, sec_type)
if sec_data:
result['result'] = 'OK'
result['content'] = {'use... | the_stack_v2_python_sparse | Source/collaboration_2/app/api_1_0/api_ds_doc.py | lsn1183/web_project | train | 0 | |
c689c88dcc486df31c566f0c2f5bd52dee42cfec | [
"try:\n pl_module = pl_module.to(memory_format=torch.channels_last)\nexcept Exception as e:\n warning(f'Convert model to channels last failed, fall back to origin memory format. Exception msg: {e}')\n return super().setup(trainer, pl_module, stage)\nfn_old = getattr(pl_module, 'on_befor... | <|body_start_0|>
try:
pl_module = pl_module.to(memory_format=torch.channels_last)
except Exception as e:
warning(f'Convert model to channels last failed, fall back to origin memory format. Exception msg: {e}')
return super().setup(trainer, pl_modul... | Custom pl.Callback for converting model and data to channels_last. | ChannelsLastCallback | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChannelsLastCallback:
"""Custom pl.Callback for converting model and data to channels_last."""
def setup(self, trainer, pl_module, stage: Optional[str]=None) -> None:
"""Override hook setup to convert model to channels_last and wrap DataHook."""
<|body_0|>
def teardown(s... | stack_v2_sparse_classes_36k_train_030086 | 4,527 | permissive | [
{
"docstring": "Override hook setup to convert model to channels_last and wrap DataHook.",
"name": "setup",
"signature": "def setup(self, trainer, pl_module, stage: Optional[str]=None) -> None"
},
{
"docstring": "Undo the changes to pl_module at end of fit, validate, tests, or predict.",
"na... | 2 | null | Implement the Python class `ChannelsLastCallback` described below.
Class description:
Custom pl.Callback for converting model and data to channels_last.
Method signatures and docstrings:
- def setup(self, trainer, pl_module, stage: Optional[str]=None) -> None: Override hook setup to convert model to channels_last and... | Implement the Python class `ChannelsLastCallback` described below.
Class description:
Custom pl.Callback for converting model and data to channels_last.
Method signatures and docstrings:
- def setup(self, trainer, pl_module, stage: Optional[str]=None) -> None: Override hook setup to convert model to channels_last and... | 4ffa012a426e0d16ed13b707b03d8787ddca6aa4 | <|skeleton|>
class ChannelsLastCallback:
"""Custom pl.Callback for converting model and data to channels_last."""
def setup(self, trainer, pl_module, stage: Optional[str]=None) -> None:
"""Override hook setup to convert model to channels_last and wrap DataHook."""
<|body_0|>
def teardown(s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChannelsLastCallback:
"""Custom pl.Callback for converting model and data to channels_last."""
def setup(self, trainer, pl_module, stage: Optional[str]=None) -> None:
"""Override hook setup to convert model to channels_last and wrap DataHook."""
try:
pl_module = pl_module.to(m... | the_stack_v2_python_sparse | python/nano/src/bigdl/nano/utils/pytorch/channel_last.py | intel-analytics/BigDL | train | 4,913 |
aaa53f0cccb3c0e1243abf6daa5670d7468b10e5 | [
"super(Crash, self).__init__(Crash.__name__)\nif time is None:\n raise ValueError('Parameter \"time\": a time abstraction object expected but \"None\" value given!')\ncheck_argument_type(Crash.__name__, 'nodes_number', int, nodes_number, self.logger)\nif nodes_number <= 0:\n raise ValueError('Parameter \"node... | <|body_start_0|>
super(Crash, self).__init__(Crash.__name__)
if time is None:
raise ValueError('Parameter "time": a time abstraction object expected but "None" value given!')
check_argument_type(Crash.__name__, 'nodes_number', int, nodes_number, self.logger)
if nodes_number <... | This class implements the process crash model. .. note:: It is presumed that the :meth:`node_failure` method is called at each step of the simulation. | Crash | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Crash:
"""This class implements the process crash model. .. note:: It is presumed that the :meth:`node_failure` method is called at each step of the simulation."""
def __init__(self, time, nodes_number, crash_probability, maximum_crash_number, total_simulation_steps, transient_steps=0):
... | stack_v2_sparse_classes_36k_train_030087 | 11,001 | permissive | [
{
"docstring": "*Parameters*: - **time**: a simulation time object of the :class:`sim2net._time.Time` class; - **nodes_number** (`int`): the total number of nodes in the simulated network; - **crash_probability** (`float`): the probability that a single process will crash during the total simulation time; - **m... | 3 | stack_v2_sparse_classes_30k_test_001140 | Implement the Python class `Crash` described below.
Class description:
This class implements the process crash model. .. note:: It is presumed that the :meth:`node_failure` method is called at each step of the simulation.
Method signatures and docstrings:
- def __init__(self, time, nodes_number, crash_probability, ma... | Implement the Python class `Crash` described below.
Class description:
This class implements the process crash model. .. note:: It is presumed that the :meth:`node_failure` method is called at each step of the simulation.
Method signatures and docstrings:
- def __init__(self, time, nodes_number, crash_probability, ma... | ed93d1e3067c569dd4194658b0d02da6b0ab4bed | <|skeleton|>
class Crash:
"""This class implements the process crash model. .. note:: It is presumed that the :meth:`node_failure` method is called at each step of the simulation."""
def __init__(self, time, nodes_number, crash_probability, maximum_crash_number, total_simulation_steps, transient_steps=0):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Crash:
"""This class implements the process crash model. .. note:: It is presumed that the :meth:`node_failure` method is called at each step of the simulation."""
def __init__(self, time, nodes_number, crash_probability, maximum_crash_number, total_simulation_steps, transient_steps=0):
"""*Param... | the_stack_v2_python_sparse | sim2net/failure/crash.py | mkalewski/sim2net | train | 14 |
6dc069f7a147b9ec4f789e3ebebce154d7700402 | [
"self._callback = callback\nself._files = files\nself.file_mtimes = {file_name: None for file_name in self._files}\nfor k in self.file_mtimes:\n try:\n self.file_mtimes[k] = op.getmtime(k)\n except OSError:\n logging.debug('Getmtime for %s, failed: %s', k, traceback.format_exc())",
"logging.de... | <|body_start_0|>
self._callback = callback
self._files = files
self.file_mtimes = {file_name: None for file_name in self._files}
for k in self.file_mtimes:
try:
self.file_mtimes[k] = op.getmtime(k)
except OSError:
logging.debug('Get... | Files change checker. | FileChangesChecker | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileChangesChecker:
"""Files change checker."""
def __init__(self, callback: Callable, files: List):
"""Initializes FileChangesChecker. Arguments: callback: Callback function for files change. files: Files to be monitored with full path."""
<|body_0|>
def check_changes(s... | stack_v2_sparse_classes_36k_train_030088 | 3,923 | permissive | [
{
"docstring": "Initializes FileChangesChecker. Arguments: callback: Callback function for files change. files: Files to be monitored with full path.",
"name": "__init__",
"signature": "def __init__(self, callback: Callable, files: List)"
},
{
"docstring": "Check files change. If some files are ... | 2 | stack_v2_sparse_classes_30k_train_015422 | Implement the Python class `FileChangesChecker` described below.
Class description:
Files change checker.
Method signatures and docstrings:
- def __init__(self, callback: Callable, files: List): Initializes FileChangesChecker. Arguments: callback: Callback function for files change. files: Files to be monitored with ... | Implement the Python class `FileChangesChecker` described below.
Class description:
Files change checker.
Method signatures and docstrings:
- def __init__(self, callback: Callable, files: List): Initializes FileChangesChecker. Arguments: callback: Callback function for files change. files: Files to be monitored with ... | bbeb74e681176d5543e1f3b5d94cb4d791c38010 | <|skeleton|>
class FileChangesChecker:
"""Files change checker."""
def __init__(self, callback: Callable, files: List):
"""Initializes FileChangesChecker. Arguments: callback: Callback function for files change. files: Files to be monitored with full path."""
<|body_0|>
def check_changes(s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileChangesChecker:
"""Files change checker."""
def __init__(self, callback: Callable, files: List):
"""Initializes FileChangesChecker. Arguments: callback: Callback function for files change. files: Files to be monitored with full path."""
self._callback = callback
self._files = ... | the_stack_v2_python_sparse | src/TA-opnsense/bin/ta_opnsense/aob_py3/solnlib/file_monitor.py | ZachChristensen28/TA-opnsense | train | 13 |
4f236bcb1c4a1071c549ac271fb7184ebb8bea5a | [
"super().__init__(grad=grad, **kwargs)\nself.keys = keys\nself.prob = prob\nif not isinstance(dims, DiscreteParameter):\n if len(dims) > 2:\n dims = list(combinations(dims, 2))\n else:\n dims = (dims,)\n dims = DiscreteParameter(dims)\nself.register_sampler('dims', dims)",
"if torch.rand(1)... | <|body_start_0|>
super().__init__(grad=grad, **kwargs)
self.keys = keys
self.prob = prob
if not isinstance(dims, DiscreteParameter):
if len(dims) > 2:
dims = list(combinations(dims, 2))
else:
dims = (dims,)
dims = Discre... | Random mirror transform | Mirror | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Mirror:
"""Random mirror transform"""
def __init__(self, dims: Union[int, DiscreteParameter, Sequence[Union[int, DiscreteParameter]]], keys: Sequence[str]=('data',), prob: float=0.5, grad: bool=False, **kwargs):
"""Args: dims: axes which should be mirrored keys: keys which should be ... | stack_v2_sparse_classes_36k_train_030089 | 11,105 | permissive | [
{
"docstring": "Args: dims: axes which should be mirrored keys: keys which should be mirrored prob: probability for mirror. If float value is provided, it is used for all dims grad: enable gradient computation inside transformation **kwargs: keyword arguments passed to superclass Examples: >>> # Use mirror tran... | 2 | stack_v2_sparse_classes_30k_train_001312 | Implement the Python class `Mirror` described below.
Class description:
Random mirror transform
Method signatures and docstrings:
- def __init__(self, dims: Union[int, DiscreteParameter, Sequence[Union[int, DiscreteParameter]]], keys: Sequence[str]=('data',), prob: float=0.5, grad: bool=False, **kwargs): Args: dims: ... | Implement the Python class `Mirror` described below.
Class description:
Random mirror transform
Method signatures and docstrings:
- def __init__(self, dims: Union[int, DiscreteParameter, Sequence[Union[int, DiscreteParameter]]], keys: Sequence[str]=('data',), prob: float=0.5, grad: bool=False, **kwargs): Args: dims: ... | ab6fbcfe7215c2a5b8e401b70909f6a32d0d167b | <|skeleton|>
class Mirror:
"""Random mirror transform"""
def __init__(self, dims: Union[int, DiscreteParameter, Sequence[Union[int, DiscreteParameter]]], keys: Sequence[str]=('data',), prob: float=0.5, grad: bool=False, **kwargs):
"""Args: dims: axes which should be mirrored keys: keys which should be ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Mirror:
"""Random mirror transform"""
def __init__(self, dims: Union[int, DiscreteParameter, Sequence[Union[int, DiscreteParameter]]], keys: Sequence[str]=('data',), prob: float=0.5, grad: bool=False, **kwargs):
"""Args: dims: axes which should be mirrored keys: keys which should be mirrored prob... | the_stack_v2_python_sparse | rising/transforms/spatial.py | PhoenixDL/rising | train | 318 |
8167c0a1ea45e31f83421a6f2d0e374a9f6cb2ef | [
"self.detection = FrameDetection(model_detector, model_classifier, args)\nself.streamlit_window = st.empty()\nself.args = args",
"logging.info(' To stop processing please press the letter \"q\"')\nif self.args['type_detection'] == 'webcam':\n logging.info(' Starting webcam analyse ...')\n self._webcam_detec... | <|body_start_0|>
self.detection = FrameDetection(model_detector, model_classifier, args)
self.streamlit_window = st.empty()
self.args = args
<|end_body_0|>
<|body_start_1|>
logging.info(' To stop processing please press the letter "q"')
if self.args['type_detection'] == 'webcam'... | Detection processing. Methods ------- medium_pipeline_selection webcam_detection video_detection image_detection | MediumSelection | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MediumSelection:
"""Detection processing. Methods ------- medium_pipeline_selection webcam_detection video_detection image_detection"""
def __init__(self, model_detector, model_classifier, args):
"""Class initialisation Parameters ---------- model_detector model_classifier args : Arg... | stack_v2_sparse_classes_36k_train_030090 | 2,739 | no_license | [
{
"docstring": "Class initialisation Parameters ---------- model_detector model_classifier args : ArgumentsParser",
"name": "__init__",
"signature": "def __init__(self, model_detector, model_classifier, args)"
},
{
"docstring": "Launch pipeline corresponding to image, video or webcam",
"name... | 5 | stack_v2_sparse_classes_30k_train_001449 | Implement the Python class `MediumSelection` described below.
Class description:
Detection processing. Methods ------- medium_pipeline_selection webcam_detection video_detection image_detection
Method signatures and docstrings:
- def __init__(self, model_detector, model_classifier, args): Class initialisation Paramet... | Implement the Python class `MediumSelection` described below.
Class description:
Detection processing. Methods ------- medium_pipeline_selection webcam_detection video_detection image_detection
Method signatures and docstrings:
- def __init__(self, model_detector, model_classifier, args): Class initialisation Paramet... | 227641cc02f5c3aef04f3c27cbfc316382041ae0 | <|skeleton|>
class MediumSelection:
"""Detection processing. Methods ------- medium_pipeline_selection webcam_detection video_detection image_detection"""
def __init__(self, model_detector, model_classifier, args):
"""Class initialisation Parameters ---------- model_detector model_classifier args : Arg... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MediumSelection:
"""Detection processing. Methods ------- medium_pipeline_selection webcam_detection video_detection image_detection"""
def __init__(self, model_detector, model_classifier, args):
"""Class initialisation Parameters ---------- model_detector model_classifier args : ArgumentsParser"... | the_stack_v2_python_sparse | yotta_p2/bj-computer-vision/masked_face/domain/predict_medium.py | j-bd/various_exs | train | 0 |
b0143bb6d0bb82f09f48ba6f9ec3a1c38761bc7d | [
"if field_name == 'name':\n return 'name__iexact'\nreturn field_name",
"sources = [serializer.fields[field_name].source for field_name in self.fields]\nif serializer.instance is not None:\n for source in sources:\n if source not in attrs:\n attrs[source] = getattr(serializer.instance, sour... | <|body_start_0|>
if field_name == 'name':
return 'name__iexact'
return field_name
<|end_body_0|>
<|body_start_1|>
sources = [serializer.fields[field_name].source for field_name in self.fields]
if serializer.instance is not None:
for source in sources:
... | CaseInsensitiveUniqueTogetherValidator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CaseInsensitiveUniqueTogetherValidator:
def process_field_name(self, field_name):
"""Right now, we presume that certain names are string-y, and can be case-insensitive compared."""
<|body_0|>
def filter_queryset(self, attrs, queryset, serializer):
"""Filter the query... | stack_v2_sparse_classes_36k_train_030091 | 1,977 | permissive | [
{
"docstring": "Right now, we presume that certain names are string-y, and can be case-insensitive compared.",
"name": "process_field_name",
"signature": "def process_field_name(self, field_name)"
},
{
"docstring": "Filter the queryset to all instances matching the given attributes.",
"name"... | 2 | null | Implement the Python class `CaseInsensitiveUniqueTogetherValidator` described below.
Class description:
Implement the CaseInsensitiveUniqueTogetherValidator class.
Method signatures and docstrings:
- def process_field_name(self, field_name): Right now, we presume that certain names are string-y, and can be case-insen... | Implement the Python class `CaseInsensitiveUniqueTogetherValidator` described below.
Class description:
Implement the CaseInsensitiveUniqueTogetherValidator class.
Method signatures and docstrings:
- def process_field_name(self, field_name): Right now, we presume that certain names are string-y, and can be case-insen... | 5423ac74635fb313732b1f84e6238a8bd5c356b0 | <|skeleton|>
class CaseInsensitiveUniqueTogetherValidator:
def process_field_name(self, field_name):
"""Right now, we presume that certain names are string-y, and can be case-insensitive compared."""
<|body_0|>
def filter_queryset(self, attrs, queryset, serializer):
"""Filter the query... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CaseInsensitiveUniqueTogetherValidator:
def process_field_name(self, field_name):
"""Right now, we presume that certain names are string-y, and can be case-insensitive compared."""
if field_name == 'name':
return 'name__iexact'
return field_name
def filter_queryset(sel... | the_stack_v2_python_sparse | metecho/api/validators.py | anspaujd/Metecho | train | 0 | |
81da77d8ade9f28e3235c0fb4f2cf51b5d1c0fde | [
"super().__init__()\nself.document_store: Optional[KeywordDocumentStore] = document_store\nself.top_k = top_k\nself.custom_query = custom_query\nself.all_terms_must_match = all_terms_must_match\nself.scale_score = scale_score",
"document_store = document_store or self.document_store\nif document_store is None:\n ... | <|body_start_0|>
super().__init__()
self.document_store: Optional[KeywordDocumentStore] = document_store
self.top_k = top_k
self.custom_query = custom_query
self.all_terms_must_match = all_terms_must_match
self.scale_score = scale_score
<|end_body_0|>
<|body_start_1|>
... | BM25Retriever | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BM25Retriever:
def __init__(self, document_store: Optional[KeywordDocumentStore]=None, top_k: int=10, all_terms_must_match: bool=False, custom_query: Optional[str]=None, scale_score: bool=True):
""":param document_store: An instance of one of the following DocumentStores to retrieve from... | stack_v2_sparse_classes_36k_train_030092 | 35,145 | permissive | [
{
"docstring": ":param document_store: An instance of one of the following DocumentStores to retrieve from: InMemoryDocumentStore, ElasticsearchDocumentStore and OpenSearchDocumentStore. If None, a document store must be passed to the retrieve method for this Retriever to work. :param all_terms_must_match: Whet... | 3 | stack_v2_sparse_classes_30k_train_000166 | Implement the Python class `BM25Retriever` described below.
Class description:
Implement the BM25Retriever class.
Method signatures and docstrings:
- def __init__(self, document_store: Optional[KeywordDocumentStore]=None, top_k: int=10, all_terms_must_match: bool=False, custom_query: Optional[str]=None, scale_score: ... | Implement the Python class `BM25Retriever` described below.
Class description:
Implement the BM25Retriever class.
Method signatures and docstrings:
- def __init__(self, document_store: Optional[KeywordDocumentStore]=None, top_k: int=10, all_terms_must_match: bool=False, custom_query: Optional[str]=None, scale_score: ... | 5f1256ac7e5734c2ea481e72cb7e02c34baf8c43 | <|skeleton|>
class BM25Retriever:
def __init__(self, document_store: Optional[KeywordDocumentStore]=None, top_k: int=10, all_terms_must_match: bool=False, custom_query: Optional[str]=None, scale_score: bool=True):
""":param document_store: An instance of one of the following DocumentStores to retrieve from... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BM25Retriever:
def __init__(self, document_store: Optional[KeywordDocumentStore]=None, top_k: int=10, all_terms_must_match: bool=False, custom_query: Optional[str]=None, scale_score: bool=True):
""":param document_store: An instance of one of the following DocumentStores to retrieve from: InMemoryDocu... | the_stack_v2_python_sparse | haystack/nodes/retriever/sparse.py | deepset-ai/haystack | train | 10,599 | |
a4c92dc2e4bd50720f827198864ef1386395f214 | [
"self.cluster_uuid = cluster_uuid\nself.description = description\nself.mount_path = mount_path\nself.name = name\nself.ngt_capabilities = ngt_capabilities\nself.ngt_enable_status = ngt_enable_status\nself.ngt_install_status = ngt_install_status\nself.ngt_reachable = ngt_reachable\nself.ngt_version = ngt_version\ns... | <|body_start_0|>
self.cluster_uuid = cluster_uuid
self.description = description
self.mount_path = mount_path
self.name = name
self.ngt_capabilities = ngt_capabilities
self.ngt_enable_status = ngt_enable_status
self.ngt_install_status = ngt_install_status
... | Implementation of the 'AcropolisProtectionSource' model. Specifies a Protection Source in Acropolis environment. Attributes: cluster_uuid (string): Specifies the UUID of the Acropolis cluster instance to which this entity belongs to. description (string): Specifies a description about the Protection Source. mount_path ... | AcropolisProtectionSource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AcropolisProtectionSource:
"""Implementation of the 'AcropolisProtectionSource' model. Specifies a Protection Source in Acropolis environment. Attributes: cluster_uuid (string): Specifies the UUID of the Acropolis cluster instance to which this entity belongs to. description (string): Specifies a... | stack_v2_sparse_classes_36k_train_030093 | 5,814 | permissive | [
{
"docstring": "Constructor for the AcropolisProtectionSource class",
"name": "__init__",
"signature": "def __init__(self, cluster_uuid=None, description=None, mount_path=None, name=None, ngt_capabilities=None, ngt_enable_status=None, ngt_install_status=None, ngt_reachable=None, ngt_version=None, mtype=... | 2 | null | Implement the Python class `AcropolisProtectionSource` described below.
Class description:
Implementation of the 'AcropolisProtectionSource' model. Specifies a Protection Source in Acropolis environment. Attributes: cluster_uuid (string): Specifies the UUID of the Acropolis cluster instance to which this entity belong... | Implement the Python class `AcropolisProtectionSource` described below.
Class description:
Implementation of the 'AcropolisProtectionSource' model. Specifies a Protection Source in Acropolis environment. Attributes: cluster_uuid (string): Specifies the UUID of the Acropolis cluster instance to which this entity belong... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class AcropolisProtectionSource:
"""Implementation of the 'AcropolisProtectionSource' model. Specifies a Protection Source in Acropolis environment. Attributes: cluster_uuid (string): Specifies the UUID of the Acropolis cluster instance to which this entity belongs to. description (string): Specifies a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AcropolisProtectionSource:
"""Implementation of the 'AcropolisProtectionSource' model. Specifies a Protection Source in Acropolis environment. Attributes: cluster_uuid (string): Specifies the UUID of the Acropolis cluster instance to which this entity belongs to. description (string): Specifies a description ... | the_stack_v2_python_sparse | cohesity_management_sdk/models/acropolis_protection_source.py | cohesity/management-sdk-python | train | 24 |
2f87dda8f91eb64b1d2486e9ecad0191ac3cad1a | [
"controller = ImageController(db)\ndata = controller.next()\nreturn serialize(data)",
"data = request.json\ndata = deserialize(data)\nprint('Received data: ', data)\ncontroller = ImageController(db)\ncontroller.classify(data)\nreturn serialize(controller.next())"
] | <|body_start_0|>
controller = ImageController(db)
data = controller.next()
return serialize(data)
<|end_body_0|>
<|body_start_1|>
data = request.json
data = deserialize(data)
print('Received data: ', data)
controller = ImageController(db)
controller.class... | Generates the next image to be displayed, and receives the label corresponding to that image. | Image | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Image:
"""Generates the next image to be displayed, and receives the label corresponding to that image."""
def get(self):
"""Returns the next image to be displayed."""
<|body_0|>
def post(self):
"""Classifies an image. data: 'image': { '_id': MongoDB ObjectId, 'f... | stack_v2_sparse_classes_36k_train_030094 | 3,299 | no_license | [
{
"docstring": "Returns the next image to be displayed.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Classifies an image. data: 'image': { '_id': MongoDB ObjectId, 'filename': filename of the image } 'tags': the classifications of the image. They look something like: [ [ x_co... | 2 | stack_v2_sparse_classes_30k_train_018799 | Implement the Python class `Image` described below.
Class description:
Generates the next image to be displayed, and receives the label corresponding to that image.
Method signatures and docstrings:
- def get(self): Returns the next image to be displayed.
- def post(self): Classifies an image. data: 'image': { '_id':... | Implement the Python class `Image` described below.
Class description:
Generates the next image to be displayed, and receives the label corresponding to that image.
Method signatures and docstrings:
- def get(self): Returns the next image to be displayed.
- def post(self): Classifies an image. data: 'image': { '_id':... | 3aec625f40fdd81b6b2948c95d6a783421aaf266 | <|skeleton|>
class Image:
"""Generates the next image to be displayed, and receives the label corresponding to that image."""
def get(self):
"""Returns the next image to be displayed."""
<|body_0|>
def post(self):
"""Classifies an image. data: 'image': { '_id': MongoDB ObjectId, 'f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Image:
"""Generates the next image to be displayed, and receives the label corresponding to that image."""
def get(self):
"""Returns the next image to be displayed."""
controller = ImageController(db)
data = controller.next()
return serialize(data)
def post(self):
... | the_stack_v2_python_sparse | server/server.py | o-hill/invasive | train | 0 |
d3493ec479f8fa959f92cc8a114f114e913650e2 | [
"self.n = n\nself.identity = identity_element_func\nself.binary = binary_operation_func\nn2 = 1\nwhile n2 < n:\n n2 <<= 1\nself.n2 = n2\nself.tree = [identity_element_func() for _ in range(n2 << 1)]",
"index += self.n2\nself.tree[index] = self.binary(self.tree[index], x)\nwhile index > 1:\n x = self.binary(... | <|body_start_0|>
self.n = n
self.identity = identity_element_func
self.binary = binary_operation_func
n2 = 1
while n2 < n:
n2 <<= 1
self.n2 = n2
self.tree = [identity_element_func() for _ in range(n2 << 1)]
<|end_body_0|>
<|body_start_1|>
inde... | Segment tree Store value as object type and optional function for binary operarion. "get" function return a value by binary operarion result. O(logN) "update" function update tree's a value. O(logN) Attributes ---------- n : int Number of elements identity element_func : func identity_element for initialization if oper... | segtree | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class segtree:
"""Segment tree Store value as object type and optional function for binary operarion. "get" function return a value by binary operarion result. O(logN) "update" function update tree's a value. O(logN) Attributes ---------- n : int Number of elements identity element_func : func identity... | stack_v2_sparse_classes_36k_train_030095 | 4,318 | permissive | [
{
"docstring": "Constructer(Initialize parameter in this class) Parameters ---------- n : int Number of elements identity_element_func : func identity element for initialization if operator is * and identiry element is e, e * A = A and A * e = A binary_operation_func : func function for binary operation x and y... | 3 | null | Implement the Python class `segtree` described below.
Class description:
Segment tree Store value as object type and optional function for binary operarion. "get" function return a value by binary operarion result. O(logN) "update" function update tree's a value. O(logN) Attributes ---------- n : int Number of element... | Implement the Python class `segtree` described below.
Class description:
Segment tree Store value as object type and optional function for binary operarion. "get" function return a value by binary operarion result. O(logN) "update" function update tree's a value. O(logN) Attributes ---------- n : int Number of element... | 79a16474a8f21310e0fb47e536d527dd5dc6d655 | <|skeleton|>
class segtree:
"""Segment tree Store value as object type and optional function for binary operarion. "get" function return a value by binary operarion result. O(logN) "update" function update tree's a value. O(logN) Attributes ---------- n : int Number of elements identity element_func : func identity... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class segtree:
"""Segment tree Store value as object type and optional function for binary operarion. "get" function return a value by binary operarion result. O(logN) "update" function update tree's a value. O(logN) Attributes ---------- n : int Number of elements identity element_func : func identity_element for ... | the_stack_v2_python_sparse | src/data/201.py | NULLCT/LOMC | train | 0 |
f0d7d0a5b878b74c30b96cfaddc37c69646c1895 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WindowsAutopilotDeviceIdentity()",
"from .enrollment_state import EnrollmentState\nfrom .entity import Entity\nfrom .enrollment_state import EnrollmentState\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'addr... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return WindowsAutopilotDeviceIdentity()
<|end_body_0|>
<|body_start_1|>
from .enrollment_state import EnrollmentState
from .entity import Entity
from .enrollment_state import Enrollment... | The windowsAutopilotDeviceIdentity resource represents a Windows Autopilot Device. | WindowsAutopilotDeviceIdentity | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WindowsAutopilotDeviceIdentity:
"""The windowsAutopilotDeviceIdentity resource represents a Windows Autopilot Device."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsAutopilotDeviceIdentity:
"""Creates a new instance of the appropriate class bas... | stack_v2_sparse_classes_36k_train_030096 | 6,119 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: WindowsAutopilotDeviceIdentity",
"name": "create_from_discriminator_value",
"signature": "def create_from_di... | 3 | stack_v2_sparse_classes_30k_train_004881 | Implement the Python class `WindowsAutopilotDeviceIdentity` described below.
Class description:
The windowsAutopilotDeviceIdentity resource represents a Windows Autopilot Device.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsAutopilotDeviceIden... | Implement the Python class `WindowsAutopilotDeviceIdentity` described below.
Class description:
The windowsAutopilotDeviceIdentity resource represents a Windows Autopilot Device.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsAutopilotDeviceIden... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class WindowsAutopilotDeviceIdentity:
"""The windowsAutopilotDeviceIdentity resource represents a Windows Autopilot Device."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsAutopilotDeviceIdentity:
"""Creates a new instance of the appropriate class bas... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WindowsAutopilotDeviceIdentity:
"""The windowsAutopilotDeviceIdentity resource represents a Windows Autopilot Device."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WindowsAutopilotDeviceIdentity:
"""Creates a new instance of the appropriate class based on discrim... | the_stack_v2_python_sparse | msgraph/generated/models/windows_autopilot_device_identity.py | microsoftgraph/msgraph-sdk-python | train | 135 |
70693ee80e74cb3d47bc8b09503baeb87d73fc51 | [
"company = Company.objects.get(id=view.kwargs['company_pk'])\nrole = request.user.get_role_for_company(company)\nif view.action == 'list':\n return role.has_permission(RECEIVE_FEEDBACK)\nelif view.action == 'create':\n return role.has_permission(CREATE_FEEDBACK)\nelse:\n return True",
"company = Company.... | <|body_start_0|>
company = Company.objects.get(id=view.kwargs['company_pk'])
role = request.user.get_role_for_company(company)
if view.action == 'list':
return role.has_permission(RECEIVE_FEEDBACK)
elif view.action == 'create':
return role.has_permission(CREATE_FE... | Permission class for the FeedbackViewSet. | FeedbackPermission | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FeedbackPermission:
"""Permission class for the FeedbackViewSet."""
def has_permission(self, request, view):
"""Return value for the common model."""
<|body_0|>
def has_object_permission(self, request, view, obj):
"""Return permission value for the particular mod... | stack_v2_sparse_classes_36k_train_030097 | 1,658 | no_license | [
{
"docstring": "Return value for the common model.",
"name": "has_permission",
"signature": "def has_permission(self, request, view)"
},
{
"docstring": "Return permission value for the particular model.",
"name": "has_object_permission",
"signature": "def has_object_permission(self, requ... | 2 | null | Implement the Python class `FeedbackPermission` described below.
Class description:
Permission class for the FeedbackViewSet.
Method signatures and docstrings:
- def has_permission(self, request, view): Return value for the common model.
- def has_object_permission(self, request, view, obj): Return permission value f... | Implement the Python class `FeedbackPermission` described below.
Class description:
Permission class for the FeedbackViewSet.
Method signatures and docstrings:
- def has_permission(self, request, view): Return value for the common model.
- def has_object_permission(self, request, view, obj): Return permission value f... | 252b0ebd77eefbcc945a0efc3068cc3421f46d5f | <|skeleton|>
class FeedbackPermission:
"""Permission class for the FeedbackViewSet."""
def has_permission(self, request, view):
"""Return value for the common model."""
<|body_0|>
def has_object_permission(self, request, view, obj):
"""Return permission value for the particular mod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FeedbackPermission:
"""Permission class for the FeedbackViewSet."""
def has_permission(self, request, view):
"""Return value for the common model."""
company = Company.objects.get(id=view.kwargs['company_pk'])
role = request.user.get_role_for_company(company)
if view.actio... | the_stack_v2_python_sparse | app/feedbacks/permissions.py | vsokoltsov/Interview360Server | train | 2 |
6c771564414db03c60f123468b4281684dd358c2 | [
"self.tileset = None\nself.dim = 0\nself.size = None\nself.tsize = None\nself.tiles = []",
"self.tileset = Image.open(fname)\nself.dim = dim\nself.size = self.tileset.size\nself.tsize = (self.size[0] // self.dim, self.size[1] // dim)\nself.tiles = []\ntop, bottom = (0, self.dim)\nfor y in range(self.tsize[1]):\n ... | <|body_start_0|>
self.tileset = None
self.dim = 0
self.size = None
self.tsize = None
self.tiles = []
<|end_body_0|>
<|body_start_1|>
self.tileset = Image.open(fname)
self.dim = dim
self.size = self.tileset.size
self.tsize = (self.size[0] // self.d... | TileSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TileSet:
def __init__(self):
"""tileset is an image file with the images broken in to dim x dim tiles tile 0 is upper left and move across then down"""
<|body_0|>
def load_tileset(self, fname, dim):
"""open the passed file and assume square dim tiles"""
<|bod... | stack_v2_sparse_classes_36k_train_030098 | 13,292 | no_license | [
{
"docstring": "tileset is an image file with the images broken in to dim x dim tiles tile 0 is upper left and move across then down",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "open the passed file and assume square dim tiles",
"name": "load_tileset",
"sign... | 3 | null | Implement the Python class `TileSet` described below.
Class description:
Implement the TileSet class.
Method signatures and docstrings:
- def __init__(self): tileset is an image file with the images broken in to dim x dim tiles tile 0 is upper left and move across then down
- def load_tileset(self, fname, dim): open ... | Implement the Python class `TileSet` described below.
Class description:
Implement the TileSet class.
Method signatures and docstrings:
- def __init__(self): tileset is an image file with the images broken in to dim x dim tiles tile 0 is upper left and move across then down
- def load_tileset(self, fname, dim): open ... | efaf89cac9474fe278865aa13593597e037688cc | <|skeleton|>
class TileSet:
def __init__(self):
"""tileset is an image file with the images broken in to dim x dim tiles tile 0 is upper left and move across then down"""
<|body_0|>
def load_tileset(self, fname, dim):
"""open the passed file and assume square dim tiles"""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TileSet:
def __init__(self):
"""tileset is an image file with the images broken in to dim x dim tiles tile 0 is upper left and move across then down"""
self.tileset = None
self.dim = 0
self.size = None
self.tsize = None
self.tiles = []
def load_tileset(self... | the_stack_v2_python_sparse | Paths/main.py | Feenix33/PyGameG | train | 0 | |
b41715677acbd75f12b1dad741899f0c664ac824 | [
"super(ConfirmationView, self).__init__()\nself.buttonsFactory = ButtonsFactory()\nself.fontFactory = FontFactory()\nself.widgetFactory = WidgetFactory()\nself.gridFactory = GridFactory()\nself.labelFactory = LabelFactory()\nself.setupUi()\nself.setupConfirmationView()",
"self.setObjectName('ConfirmationWidget')\... | <|body_start_0|>
super(ConfirmationView, self).__init__()
self.buttonsFactory = ButtonsFactory()
self.fontFactory = FontFactory()
self.widgetFactory = WidgetFactory()
self.gridFactory = GridFactory()
self.labelFactory = LabelFactory()
self.setupUi()
self.s... | Confirmation view class of QWidget type | ConfirmationView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfirmationView:
"""Confirmation view class of QWidget type"""
def __init__(self):
"""The constructor of confirmation view class which set up: buttonsFactory, fontFactory, widgetFactory, gridFactory, labelFactory and setups UI :param parent: widget parent :param geometry: geometry o... | stack_v2_sparse_classes_36k_train_030099 | 4,518 | no_license | [
{
"docstring": "The constructor of confirmation view class which set up: buttonsFactory, fontFactory, widgetFactory, gridFactory, labelFactory and setups UI :param parent: widget parent :param geometry: geometry object :param name: widget name",
"name": "__init__",
"signature": "def __init__(self)"
},... | 6 | stack_v2_sparse_classes_30k_train_007287 | Implement the Python class `ConfirmationView` described below.
Class description:
Confirmation view class of QWidget type
Method signatures and docstrings:
- def __init__(self): The constructor of confirmation view class which set up: buttonsFactory, fontFactory, widgetFactory, gridFactory, labelFactory and setups UI... | Implement the Python class `ConfirmationView` described below.
Class description:
Confirmation view class of QWidget type
Method signatures and docstrings:
- def __init__(self): The constructor of confirmation view class which set up: buttonsFactory, fontFactory, widgetFactory, gridFactory, labelFactory and setups UI... | cde38a32acd645d1a341cc5c61b598f6eba77112 | <|skeleton|>
class ConfirmationView:
"""Confirmation view class of QWidget type"""
def __init__(self):
"""The constructor of confirmation view class which set up: buttonsFactory, fontFactory, widgetFactory, gridFactory, labelFactory and setups UI :param parent: widget parent :param geometry: geometry o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConfirmationView:
"""Confirmation view class of QWidget type"""
def __init__(self):
"""The constructor of confirmation view class which set up: buttonsFactory, fontFactory, widgetFactory, gridFactory, labelFactory and setups UI :param parent: widget parent :param geometry: geometry object :param ... | the_stack_v2_python_sparse | src/view/ConfirmationView.py | majczel23000/Ticket-Machine-Python | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.