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
55985167491ac63bb4049ec33e7dbf677eb205fb
[ "if not isinstance(value, list):\n raise XRPLBinaryCodecException(f'Invalid type to construct a Path: expected list, received {value.__class__.__name__}.')\nbuffer: bytes = b''\nfor PathStep_dict in value:\n pathstep = PathStep.from_value(PathStep_dict)\n buffer += bytes(pathstep)\nreturn Path(buffer)", ...
<|body_start_0|> if not isinstance(value, list): raise XRPLBinaryCodecException(f'Invalid type to construct a Path: expected list, received {value.__class__.__name__}.') buffer: bytes = b'' for PathStep_dict in value: pathstep = PathStep.from_value(PathStep_dict) ...
Class for serializing/deserializing Paths.
Path
[ "ISC", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Path: """Class for serializing/deserializing Paths.""" def from_value(cls: Type[Path], value: List[Dict[str, str]]) -> Path: """Construct a Path from an array of dictionaries describing PathSteps. Args: value: The array to construct a Path object from. Returns: The Path constructed f...
stack_v2_sparse_classes_36k_train_001500
9,067
permissive
[ { "docstring": "Construct a Path from an array of dictionaries describing PathSteps. Args: value: The array to construct a Path object from. Returns: The Path constructed from value. Raises: XRPLBinaryCodecException: If the supplied value is of the wrong type.", "name": "from_value", "signature": "def f...
3
null
Implement the Python class `Path` described below. Class description: Class for serializing/deserializing Paths. Method signatures and docstrings: - def from_value(cls: Type[Path], value: List[Dict[str, str]]) -> Path: Construct a Path from an array of dictionaries describing PathSteps. Args: value: The array to cons...
Implement the Python class `Path` described below. Class description: Class for serializing/deserializing Paths. Method signatures and docstrings: - def from_value(cls: Type[Path], value: List[Dict[str, str]]) -> Path: Construct a Path from an array of dictionaries describing PathSteps. Args: value: The array to cons...
e5bbdf458ad83e6670a4ebf3df63e17fed8b099f
<|skeleton|> class Path: """Class for serializing/deserializing Paths.""" def from_value(cls: Type[Path], value: List[Dict[str, str]]) -> Path: """Construct a Path from an array of dictionaries describing PathSteps. Args: value: The array to construct a Path object from. Returns: The Path constructed f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Path: """Class for serializing/deserializing Paths.""" def from_value(cls: Type[Path], value: List[Dict[str, str]]) -> Path: """Construct a Path from an array of dictionaries describing PathSteps. Args: value: The array to construct a Path object from. Returns: The Path constructed from value. Ra...
the_stack_v2_python_sparse
xrpl/core/binarycodec/types/path_set.py
yyolk/xrpl-py
train
1
ae221d51657dab1f2855d85c500cece6263fcaa0
[ "rv = []\nfor filename in os.listdir(self.cmd_dir):\n if filename.endswith('.py') and filename.startswith('cmd_'):\n rv.append(filename[4:-3])\nrv.sort()\nreturn rv", "try:\n if sys.version_info[0] == 2:\n name = name.encode('ascii', 'replace')\n mod = __import__(self.cmd_namespace + name, ...
<|body_start_0|> rv = [] for filename in os.listdir(self.cmd_dir): if filename.endswith('.py') and filename.startswith('cmd_'): rv.append(filename[4:-3]) rv.sort() return rv <|end_body_0|> <|body_start_1|> try: if sys.version_info[0] == 2:...
DigitalOceanCLI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DigitalOceanCLI: def list_commands(self, ctx): """list the commands found in the commands dir""" <|body_0|> def get_command(self, ctx, name): """import the requested command""" <|body_1|> <|end_skeleton|> <|body_start_0|> rv = [] for filenam...
stack_v2_sparse_classes_36k_train_001501
2,455
permissive
[ { "docstring": "list the commands found in the commands dir", "name": "list_commands", "signature": "def list_commands(self, ctx)" }, { "docstring": "import the requested command", "name": "get_command", "signature": "def get_command(self, ctx, name)" } ]
2
stack_v2_sparse_classes_30k_train_018224
Implement the Python class `DigitalOceanCLI` described below. Class description: Implement the DigitalOceanCLI class. Method signatures and docstrings: - def list_commands(self, ctx): list the commands found in the commands dir - def get_command(self, ctx, name): import the requested command
Implement the Python class `DigitalOceanCLI` described below. Class description: Implement the DigitalOceanCLI class. Method signatures and docstrings: - def list_commands(self, ctx): list the commands found in the commands dir - def get_command(self, ctx, name): import the requested command <|skeleton|> class Digit...
cd78cb7effce3c56a10edafe41753a1751d1d7dc
<|skeleton|> class DigitalOceanCLI: def list_commands(self, ctx): """list the commands found in the commands dir""" <|body_0|> def get_command(self, ctx, name): """import the requested command""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DigitalOceanCLI: def list_commands(self, ctx): """list the commands found in the commands dir""" rv = [] for filename in os.listdir(self.cmd_dir): if filename.endswith('.py') and filename.startswith('cmd_'): rv.append(filename[4:-3]) rv.sort() ...
the_stack_v2_python_sparse
do_cli/contexts.py
meganlkm/do-cli
train
0
337eddbef26f1ccbfe0db7343b8bfe540a7d8811
[ "c, h = carry\ninput_to_hidden = linear.Conv.partial(features=4 * features, kernel_size=kernel_size, strides=strides, padding=padding, bias=bias, dtype=dtype, name='ih')\nhidden_to_hidden = linear.Conv.partial(features=4 * features, kernel_size=kernel_size, strides=strides, padding=padding, bias=bias, dtype=dtype, ...
<|body_start_0|> c, h = carry input_to_hidden = linear.Conv.partial(features=4 * features, kernel_size=kernel_size, strides=strides, padding=padding, bias=bias, dtype=dtype, name='ih') hidden_to_hidden = linear.Conv.partial(features=4 * features, kernel_size=kernel_size, strides=strides, padding...
DEPRECATION WARNING: The `flax.nn` module is Deprecated, use `flax.linen` instead. Learn more and find an upgrade guide at https://github.com/google/flax/blob/master/flax/linen/README.md" A convolutional LSTM cell. The implementation is based on xingjian2015convolutional. Given x_t and the previous state (h_{t-1}, c_{t...
ConvLSTM
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvLSTM: """DEPRECATION WARNING: The `flax.nn` module is Deprecated, use `flax.linen` instead. Learn more and find an upgrade guide at https://github.com/google/flax/blob/master/flax/linen/README.md" A convolutional LSTM cell. The implementation is based on xingjian2015convolutional. Given x_t a...
stack_v2_sparse_classes_36k_train_001502
16,408
permissive
[ { "docstring": "Constructs a convolutional LSTM. Args: carry: the hidden state of the Conv2DLSTM cell, initialized using `Conv2DLSTM.initialize_carry`. inputs: input data with dimensions (batch, spatial_dims..., features). features: number of convolution filters. kernel_size: shape of the convolutional kernel. ...
2
stack_v2_sparse_classes_30k_train_014693
Implement the Python class `ConvLSTM` described below. Class description: DEPRECATION WARNING: The `flax.nn` module is Deprecated, use `flax.linen` instead. Learn more and find an upgrade guide at https://github.com/google/flax/blob/master/flax/linen/README.md" A convolutional LSTM cell. The implementation is based on...
Implement the Python class `ConvLSTM` described below. Class description: DEPRECATION WARNING: The `flax.nn` module is Deprecated, use `flax.linen` instead. Learn more and find an upgrade guide at https://github.com/google/flax/blob/master/flax/linen/README.md" A convolutional LSTM cell. The implementation is based on...
87a483b2b93fa1dd7934da520348e6ce8d7851b4
<|skeleton|> class ConvLSTM: """DEPRECATION WARNING: The `flax.nn` module is Deprecated, use `flax.linen` instead. Learn more and find an upgrade guide at https://github.com/google/flax/blob/master/flax/linen/README.md" A convolutional LSTM cell. The implementation is based on xingjian2015convolutional. Given x_t a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvLSTM: """DEPRECATION WARNING: The `flax.nn` module is Deprecated, use `flax.linen` instead. Learn more and find an upgrade guide at https://github.com/google/flax/blob/master/flax/linen/README.md" A convolutional LSTM cell. The implementation is based on xingjian2015convolutional. Given x_t and the previo...
the_stack_v2_python_sparse
flax/nn/recurrent.py
marcvanzee/flax
train
3
bc4bd704e0e28659c92d5af3cf8dc43c1e6965be
[ "out_channels, in_channels, _, _ = weight.shape\nif ranks == 'evbmf':\n unfold_0 = tl.base.unfold(weight, 0)\n unfold_1 = tl.base.unfold(weight, 1)\n _, diag_0, _, _ = vbmf.EVBMF(unfold_0)\n _, diag_1, _, _ = vbmf.EVBMF(unfold_1)\n out_rank = diag_0.shape[0]\n in_rank = diag_1.shape[1]\nelif isins...
<|body_start_0|> out_channels, in_channels, _, _ = weight.shape if ranks == 'evbmf': unfold_0 = tl.base.unfold(weight, 0) unfold_1 = tl.base.unfold(weight, 1) _, diag_0, _, _ = vbmf.EVBMF(unfold_0) _, diag_1, _, _ = vbmf.EVBMF(unfold_1) out_ran...
Decomposed (or compressed) convolutional layer.
DecomposedConv2d
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecomposedConv2d: """Decomposed (or compressed) convolutional layer.""" def choose_ranks(weight, ranks): """Choose the target ranks.""" <|body_0|> def __init__(self, layer, ranks='evbmf', init=True): """Class initializer.""" <|body_1|> def forward(se...
stack_v2_sparse_classes_36k_train_001503
5,386
permissive
[ { "docstring": "Choose the target ranks.", "name": "choose_ranks", "signature": "def choose_ranks(weight, ranks)" }, { "docstring": "Class initializer.", "name": "__init__", "signature": "def __init__(self, layer, ranks='evbmf', init=True)" }, { "docstring": "Forward propagation....
4
stack_v2_sparse_classes_30k_test_000005
Implement the Python class `DecomposedConv2d` described below. Class description: Decomposed (or compressed) convolutional layer. Method signatures and docstrings: - def choose_ranks(weight, ranks): Choose the target ranks. - def __init__(self, layer, ranks='evbmf', init=True): Class initializer. - def forward(self, ...
Implement the Python class `DecomposedConv2d` described below. Class description: Decomposed (or compressed) convolutional layer. Method signatures and docstrings: - def choose_ranks(weight, ranks): Choose the target ranks. - def __init__(self, layer, ranks='evbmf', init=True): Class initializer. - def forward(self, ...
fe5d1eb5ab5453be70c4be473fd3da71afe4b06c
<|skeleton|> class DecomposedConv2d: """Decomposed (or compressed) convolutional layer.""" def choose_ranks(weight, ranks): """Choose the target ranks.""" <|body_0|> def __init__(self, layer, ranks='evbmf', init=True): """Class initializer.""" <|body_1|> def forward(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecomposedConv2d: """Decomposed (or compressed) convolutional layer.""" def choose_ranks(weight, ranks): """Choose the target ranks.""" out_channels, in_channels, _, _ = weight.shape if ranks == 'evbmf': unfold_0 = tl.base.unfold(weight, 0) unfold_1 = tl.ba...
the_stack_v2_python_sparse
src/kegnet/utils/tucker.py
videoturingtest/KegNet
train
0
7ee2c2015181d14ba2ca2558d54c194c6d80ea40
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
This service allows inspecting the party management state of the ledger known to the participant and managing the participant-local party metadata. The authorization rules for its RPCs are specified on the ``<RpcName>Request`` messages as boolean expressions over these facts: (1) ``HasRight(r)`` denoting whether the au...
PartyManagementServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PartyManagementServiceServicer: """This service allows inspecting the party management state of the ledger known to the participant and managing the participant-local party metadata. The authorization rules for its RPCs are specified on the ``<RpcName>Request`` messages as boolean expressions ove...
stack_v2_sparse_classes_36k_train_001504
16,483
permissive
[ { "docstring": "Return the identifier of the participant. All horizontally scaled replicas should return the same id. daml-on-kv-ledger: returns an identifier supplied on command line at launch time canton: returns globally unique identifier of the participant", "name": "GetParticipantId", "signature": ...
5
null
Implement the Python class `PartyManagementServiceServicer` described below. Class description: This service allows inspecting the party management state of the ledger known to the participant and managing the participant-local party metadata. The authorization rules for its RPCs are specified on the ``<RpcName>Reques...
Implement the Python class `PartyManagementServiceServicer` described below. Class description: This service allows inspecting the party management state of the ledger known to the participant and managing the participant-local party metadata. The authorization rules for its RPCs are specified on the ``<RpcName>Reques...
efdbb00e54614c0af650d7440faaffbde92ad1f4
<|skeleton|> class PartyManagementServiceServicer: """This service allows inspecting the party management state of the ledger known to the participant and managing the participant-local party metadata. The authorization rules for its RPCs are specified on the ``<RpcName>Request`` messages as boolean expressions ove...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PartyManagementServiceServicer: """This service allows inspecting the party management state of the ledger known to the participant and managing the participant-local party metadata. The authorization rules for its RPCs are specified on the ``<RpcName>Request`` messages as boolean expressions over these facts...
the_stack_v2_python_sparse
python/dazl/_gen/com/daml/ledger/api/v1/admin/party_management_service_pb2_grpc.py
digital-asset/dazl-client
train
12
fbc71fc9cb47523ce6a7b1aed3f1c24b3723846b
[ "nums = [i ** 2 for i in range(1, n + 1) if i ** 2 <= n]\ndp = [10 ** 4] * (n + 1)\ndp[0] = 0\nfor j in range(1, n + 1):\n for num in nums:\n if j >= num:\n dp[j] = min(dp[j], dp[j - num] + 1)\nreturn dp[n]", "nums = [i ** 2 for i in range(1, n + 1) if i ** 2 <= n]\ndp = [10 ** 4] * (n + 1)\n...
<|body_start_0|> nums = [i ** 2 for i in range(1, n + 1) if i ** 2 <= n] dp = [10 ** 4] * (n + 1) dp[0] = 0 for j in range(1, n + 1): for num in nums: if j >= num: dp[j] = min(dp[j], dp[j - num] + 1) return dp[n] <|end_body_0|> <|b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSquares(self, n: int) -> int: """版本一""" <|body_0|> def numSquares1(self, n: int) -> int: """版本二""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums = [i ** 2 for i in range(1, n + 1) if i ** 2 <= n] dp = [10 ** 4] * (n + 1)...
stack_v2_sparse_classes_36k_train_001505
1,301
no_license
[ { "docstring": "版本一", "name": "numSquares", "signature": "def numSquares(self, n: int) -> int" }, { "docstring": "版本二", "name": "numSquares1", "signature": "def numSquares1(self, n: int) -> int" } ]
2
stack_v2_sparse_classes_30k_train_002904
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares(self, n: int) -> int: 版本一 - def numSquares1(self, n: int) -> int: 版本二
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares(self, n: int) -> int: 版本一 - def numSquares1(self, n: int) -> int: 版本二 <|skeleton|> class Solution: def numSquares(self, n: int) -> int: """版本一""" ...
9aee4fa0ea211d28ff1e5d9b70597421f9562959
<|skeleton|> class Solution: def numSquares(self, n: int) -> int: """版本一""" <|body_0|> def numSquares1(self, n: int) -> int: """版本二""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numSquares(self, n: int) -> int: """版本一""" nums = [i ** 2 for i in range(1, n + 1) if i ** 2 <= n] dp = [10 ** 4] * (n + 1) dp[0] = 0 for j in range(1, n + 1): for num in nums: if j >= num: dp[j] = min(dp[j],...
the_stack_v2_python_sparse
Python/numSquares.py
Litao439420999/LeetCodeAlgorithm
train
0
be805a89a401f81a532397b06d6191d5ef02ce35
[ "self.loaded = False\nself.instances = instances\nself.path = path", "if not self.instances and (not self.loaded):\n self.loaded = True\n self.instances = {}\n for importer_wrapper in dynamic_directory_importer(path):\n if importer_wrapper.error:\n logger.error('Error Loading Plugin: {0...
<|body_start_0|> self.loaded = False self.instances = instances self.path = path <|end_body_0|> <|body_start_1|> if not self.instances and (not self.loaded): self.loaded = True self.instances = {} for importer_wrapper in dynamic_directory_importer(pat...
PluginManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PluginManager: def __init__(self, instances=None, path=BASE_PLUGIN_DIRECTORY): """Used to initialize plugin""" <|body_0|> def _load(self, path=BASE_PLUGIN_DIRECTORY): """Lazy loading of plugins""" <|body_1|> def __getattr__(self, plugin_name, path=BASE_P...
stack_v2_sparse_classes_36k_train_001506
8,795
permissive
[ { "docstring": "Used to initialize plugin", "name": "__init__", "signature": "def __init__(self, instances=None, path=BASE_PLUGIN_DIRECTORY)" }, { "docstring": "Lazy loading of plugins", "name": "_load", "signature": "def _load(self, path=BASE_PLUGIN_DIRECTORY)" }, { "docstring":...
5
stack_v2_sparse_classes_30k_train_017818
Implement the Python class `PluginManager` described below. Class description: Implement the PluginManager class. Method signatures and docstrings: - def __init__(self, instances=None, path=BASE_PLUGIN_DIRECTORY): Used to initialize plugin - def _load(self, path=BASE_PLUGIN_DIRECTORY): Lazy loading of plugins - def _...
Implement the Python class `PluginManager` described below. Class description: Implement the PluginManager class. Method signatures and docstrings: - def __init__(self, instances=None, path=BASE_PLUGIN_DIRECTORY): Used to initialize plugin - def _load(self, path=BASE_PLUGIN_DIRECTORY): Lazy loading of plugins - def _...
d31d00bb8a28a8d0c999813f616b398f41516244
<|skeleton|> class PluginManager: def __init__(self, instances=None, path=BASE_PLUGIN_DIRECTORY): """Used to initialize plugin""" <|body_0|> def _load(self, path=BASE_PLUGIN_DIRECTORY): """Lazy loading of plugins""" <|body_1|> def __getattr__(self, plugin_name, path=BASE_P...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PluginManager: def __init__(self, instances=None, path=BASE_PLUGIN_DIRECTORY): """Used to initialize plugin""" self.loaded = False self.instances = instances self.path = path def _load(self, path=BASE_PLUGIN_DIRECTORY): """Lazy loading of plugins""" if not ...
the_stack_v2_python_sparse
plugins/plugin_manager.py
ozoneplatform/ozp-backend
train
1
fac5d7f5c4698f79e94d9abaa3e5e6dfd71d5d0e
[ "self.name = name\nself.card_number = card_number\nself.apr_percent = apr_percent\nself.limit = limit\nself.balance = 0\nself.fees = 0", "if purchase_price + self.balance + self.fees > self.limit:\n return False\nelse:\n self.balance += purchase_price\n return True", "if payment_amount > 0 and payment_...
<|body_start_0|> self.name = name self.card_number = card_number self.apr_percent = apr_percent self.limit = limit self.balance = 0 self.fees = 0 <|end_body_0|> <|body_start_1|> if purchase_price + self.balance + self.fees > self.limit: return False ...
This class provides a template for a personal credit card. It has already been completely filled out for you.
CreditCard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreditCard: """This class provides a template for a personal credit card. It has already been completely filled out for you.""" def __init__(self, name, card_number, apr_percent, limit): """Initialize an instance of the class. Arguments: name: The name of the account holder card_numb...
stack_v2_sparse_classes_36k_train_001507
6,139
no_license
[ { "docstring": "Initialize an instance of the class. Arguments: name: The name of the account holder card_number: The credit card number apr_percent: The APR, as a percentage (i.e. 20 instead of 0.2 for a 20 percent APR). limit: The limit on the card. Returns: None Sets the following class attributes: name = na...
4
null
Implement the Python class `CreditCard` described below. Class description: This class provides a template for a personal credit card. It has already been completely filled out for you. Method signatures and docstrings: - def __init__(self, name, card_number, apr_percent, limit): Initialize an instance of the class. ...
Implement the Python class `CreditCard` described below. Class description: This class provides a template for a personal credit card. It has already been completely filled out for you. Method signatures and docstrings: - def __init__(self, name, card_number, apr_percent, limit): Initialize an instance of the class. ...
9f55c92f599166c9ccf9c8ed2c94e337a2423c60
<|skeleton|> class CreditCard: """This class provides a template for a personal credit card. It has already been completely filled out for you.""" def __init__(self, name, card_number, apr_percent, limit): """Initialize an instance of the class. Arguments: name: The name of the account holder card_numb...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreditCard: """This class provides a template for a personal credit card. It has already been completely filled out for you.""" def __init__(self, name, card_number, apr_percent, limit): """Initialize an instance of the class. Arguments: name: The name of the account holder card_number: The credi...
the_stack_v2_python_sparse
Copies/PythFound2/classes_2.py
MFahey0706/LocalMisc
train
0
706ef83f8504f257c5a7d287bf342f597038bd88
[ "declared = []\nfor obj in Rt.objective:\n var_list = splt('[+*/-]', obj)\n for v in var_list:\n if v not in declared:\n self.add_input(v)\n declared.append(v)\n self.add_output('Objective function ' + obj)", "global counter\ncounter += 1\ncpacs_path = mif.get_tooloutput_file...
<|body_start_0|> declared = [] for obj in Rt.objective: var_list = splt('[+*/-]', obj) for v in var_list: if v not in declared: self.add_input(v) declared.append(v) self.add_output('Objective function ' + obj) <|...
Class to compute the objective function(s)
Objective
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Objective: """Class to compute the objective function(s)""" def setup(self): """Setup inputs and outputs""" <|body_0|> def compute(self, inputs, outputs): """Compute the objective expression""" <|body_1|> <|end_skeleton|> <|body_start_0|> declar...
stack_v2_sparse_classes_36k_train_001508
21,151
permissive
[ { "docstring": "Setup inputs and outputs", "name": "setup", "signature": "def setup(self)" }, { "docstring": "Compute the objective expression", "name": "compute", "signature": "def compute(self, inputs, outputs)" } ]
2
stack_v2_sparse_classes_30k_train_011601
Implement the Python class `Objective` described below. Class description: Class to compute the objective function(s) Method signatures and docstrings: - def setup(self): Setup inputs and outputs - def compute(self, inputs, outputs): Compute the objective expression
Implement the Python class `Objective` described below. Class description: Class to compute the objective function(s) Method signatures and docstrings: - def setup(self): Setup inputs and outputs - def compute(self, inputs, outputs): Compute the objective expression <|skeleton|> class Objective: """Class to comp...
3cc211507caab176a76213e442238abfa43afa42
<|skeleton|> class Objective: """Class to compute the objective function(s)""" def setup(self): """Setup inputs and outputs""" <|body_0|> def compute(self, inputs, outputs): """Compute the objective expression""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Objective: """Class to compute the objective function(s)""" def setup(self): """Setup inputs and outputs""" declared = [] for obj in Rt.objective: var_list = splt('[+*/-]', obj) for v in var_list: if v not in declared: se...
the_stack_v2_python_sparse
ceasiompy/Optimisation/optimisation.py
schneo/CEASIOMpy
train
0
5438d06bdd1830e1613cd34df1fb13235798e29b
[ "for i in range(len(s)):\n t = s[:i] + s[i + 1:]\n if t == t[::-1]:\n return True\nreturn s == s[::-1]", "def is_pali_range(i, j):\n return all((s[k] == s[j - k + i] for k in range(i, j)))\nfor i in range(len(s) / 2):\n if s[i] != s[~i]:\n j = len(s) - 1 - i\n return is_pali_range...
<|body_start_0|> for i in range(len(s)): t = s[:i] + s[i + 1:] if t == t[::-1]: return True return s == s[::-1] <|end_body_0|> <|body_start_1|> def is_pali_range(i, j): return all((s[k] == s[j - k + i] for k in range(i, j))) for i in r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def validPalindrome(self, s: str) -> bool: """For each index i in the given string, let's remove that character, then check if the resulting string is a palindrome. If it is, (or if the original string was a palindrome), then we'll return true""" <|body_0|> def val...
stack_v2_sparse_classes_36k_train_001509
1,977
no_license
[ { "docstring": "For each index i in the given string, let's remove that character, then check if the resulting string is a palindrome. If it is, (or if the original string was a palindrome), then we'll return true", "name": "validPalindrome", "signature": "def validPalindrome(self, s: str) -> bool" },...
2
stack_v2_sparse_classes_30k_train_007417
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validPalindrome(self, s: str) -> bool: For each index i in the given string, let's remove that character, then check if the resulting string is a palindrome. If it is, (or if...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validPalindrome(self, s: str) -> bool: For each index i in the given string, let's remove that character, then check if the resulting string is a palindrome. If it is, (or if...
727dec2e23e765925a5e7e003fc99aeaf25111e9
<|skeleton|> class Solution: def validPalindrome(self, s: str) -> bool: """For each index i in the given string, let's remove that character, then check if the resulting string is a palindrome. If it is, (or if the original string was a palindrome), then we'll return true""" <|body_0|> def val...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def validPalindrome(self, s: str) -> bool: """For each index i in the given string, let's remove that character, then check if the resulting string is a palindrome. If it is, (or if the original string was a palindrome), then we'll return true""" for i in range(len(s)): t...
the_stack_v2_python_sparse
funNLearn/src/main/java/dsAlgo/leetcode/P6xx/P680_ValidPalindromeII.py
vishalpmittal/practice-fun
train
0
9c6684aa576dca6d54dd1489545aa23d4bb085fc
[ "tours = StatisticDAO.get_tours(start_date, end_date)\nlabels = [str(name) for name, count in tours]\ndata = [count for name, count in tours]\nreturn (labels, data)", "tourguides = StatisticDAO.get_static_from_tour_guide(start_date, end_date)\nlabels = [str(name) for name, count in tourguides]\ndata = [count for ...
<|body_start_0|> tours = StatisticDAO.get_tours(start_date, end_date) labels = [str(name) for name, count in tours] data = [count for name, count in tours] return (labels, data) <|end_body_0|> <|body_start_1|> tourguides = StatisticDAO.get_static_from_tour_guide(start_date, end_...
Statistics
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Statistics: def get_stat_by_registered_user(self, start_date, end_date): """Queries the tours from the database, then returns a tuple that contains labels and data, which are required to display the carts. :param start_date: the begin of the time interval :param end_date: the end of the ...
stack_v2_sparse_classes_36k_train_001510
2,012
no_license
[ { "docstring": "Queries the tours from the database, then returns a tuple that contains labels and data, which are required to display the carts. :param start_date: the begin of the time interval :param end_date: the end of the time interval :return: a tuple that contains: labels, data", "name": "get_stat_b...
3
stack_v2_sparse_classes_30k_train_020337
Implement the Python class `Statistics` described below. Class description: Implement the Statistics class. Method signatures and docstrings: - def get_stat_by_registered_user(self, start_date, end_date): Queries the tours from the database, then returns a tuple that contains labels and data, which are required to di...
Implement the Python class `Statistics` described below. Class description: Implement the Statistics class. Method signatures and docstrings: - def get_stat_by_registered_user(self, start_date, end_date): Queries the tours from the database, then returns a tuple that contains labels and data, which are required to di...
84fcd3c95bd8792b1f1c9cfc5680b88282a0f922
<|skeleton|> class Statistics: def get_stat_by_registered_user(self, start_date, end_date): """Queries the tours from the database, then returns a tuple that contains labels and data, which are required to display the carts. :param start_date: the begin of the time interval :param end_date: the end of the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Statistics: def get_stat_by_registered_user(self, start_date, end_date): """Queries the tours from the database, then returns a tuple that contains labels and data, which are required to display the carts. :param start_date: the begin of the time interval :param end_date: the end of the time interval ...
the_stack_v2_python_sparse
app/statistics/statistics.py
feco93/TouristGuide
train
0
2553acd15ed4409686ff5a07c3c71ec1af974796
[ "Frame.__init__(self, master)\nself.pack()\nself.createWidgets()", "top_frame = Frame(self)\nself.text_in = Entry(top_frame)\nself.label = Label(top_frame, text='Output label')\nself.text_in.pack()\nself.label.pack()\nself.r = IntVar()\nRadiobutton(top_frame, text='Upper case', variable=self.r, value=1).pack(side...
<|body_start_0|> Frame.__init__(self, master) self.pack() self.createWidgets() <|end_body_0|> <|body_start_1|> top_frame = Frame(self) self.text_in = Entry(top_frame) self.label = Label(top_frame, text='Output label') self.text_in.pack() self.label.pack()...
Application main window class.
Application
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handle(self): ...
stack_v2_sparse_classes_36k_train_001511
1,749
permissive
[ { "docstring": "Main frame initialization (mostly delegated)", "name": "__init__", "signature": "def __init__(self, master=None)" }, { "docstring": "Add all the widgets to the main frame.", "name": "createWidgets", "signature": "def createWidgets(self)" }, { "docstring": "Handle ...
3
stack_v2_sparse_classes_30k_train_003788
Implement the Python class `Application` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createWidgets(self): Add all the widgets to the main frame. - def handle(self): Handle a c...
Implement the Python class `Application` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createWidgets(self): Add all the widgets to the main frame. - def handle(self): Handle a c...
042e0ce964bc88b3f4132dcbd7e06c5f504eae34
<|skeleton|> class Application: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handle(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Application: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" Frame.__init__(self, master) self.pack() self.createWidgets() def createWidgets(self): """Add all the widgets to the main fram...
the_stack_v2_python_sparse
Python2/IntroGUI/src/texthandler.py
ceeblet/OST_PythonCertificationTrack
train
0
1e41de733959a53c45a4cdd478d2252c255c743b
[ "for i in range(1, len(events)):\n assert events[i].obj == events[0].obj\nself.obj = events[0].obj\nself.events = events\nself.events.sort(key=lambda e: e.prob)\nprob = 0\nfor event in self.events:\n prob += event.prob\nassert util.approx(prob, 1.0)", "f = random.random()\nevent = None\nfor i in range(len(s...
<|body_start_0|> for i in range(1, len(events)): assert events[i].obj == events[0].obj self.obj = events[0].obj self.events = events self.events.sort(key=lambda e: e.prob) prob = 0 for event in self.events: prob += event.prob assert util.ap...
A distribution as defined by the scavnger hunt problem.
Distribution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Distribution: """A distribution as defined by the scavnger hunt problem.""" def __init__(self, events): """The distribution is comprised of EVENTS. The events therein are collectively exhaustive, mutually exclusive, and describe the same object.""" <|body_0|> def place(s...
stack_v2_sparse_classes_36k_train_001512
21,028
no_license
[ { "docstring": "The distribution is comprised of EVENTS. The events therein are collectively exhaustive, mutually exclusive, and describe the same object.", "name": "__init__", "signature": "def __init__(self, events)" }, { "docstring": "Generates a random location for the described object to ap...
2
stack_v2_sparse_classes_30k_train_021564
Implement the Python class `Distribution` described below. Class description: A distribution as defined by the scavnger hunt problem. Method signatures and docstrings: - def __init__(self, events): The distribution is comprised of EVENTS. The events therein are collectively exhaustive, mutually exclusive, and describ...
Implement the Python class `Distribution` described below. Class description: A distribution as defined by the scavnger hunt problem. Method signatures and docstrings: - def __init__(self, events): The distribution is comprised of EVENTS. The events therein are collectively exhaustive, mutually exclusive, and describ...
bebffb2e886ba990f6b5fe6d51aa3ec4571c8d8c
<|skeleton|> class Distribution: """A distribution as defined by the scavnger hunt problem.""" def __init__(self, events): """The distribution is comprised of EVENTS. The events therein are collectively exhaustive, mutually exclusive, and describe the same object.""" <|body_0|> def place(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Distribution: """A distribution as defined by the scavnger hunt problem.""" def __init__(self, events): """The distribution is comprised of EVENTS. The events therein are collectively exhaustive, mutually exclusive, and describe the same object.""" for i in range(1, len(events)): ...
the_stack_v2_python_sparse
bwi_scavenger/scripts/absim/world.py
utexas-bwi/scavenger_hunt
train
2
67e5670b3e365348f8797cfe2df8113397c3eee7
[ "expected = '{SHA}X+lk6KR7JuJEH43YnmettCwICdU='\nresult = user.encodePassword('MoinMoin')\nself.assertEqual(result, expected, 'Expected \"%(expected)s\" but got \"%(result)s\"' % locals())\nresult = user.encodePassword(u'MoinMoin')\nself.assertEqual(result, expected, 'Expected \"%(expected)s\" but got \"%(result)s\...
<|body_start_0|> expected = '{SHA}X+lk6KR7JuJEH43YnmettCwICdU=' result = user.encodePassword('MoinMoin') self.assertEqual(result, expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()) result = user.encodePassword(u'MoinMoin') self.assertEqual(result, expected, 'Exp...
user: encode passwords tests
EncodePasswordTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncodePasswordTestCase: """user: encode passwords tests""" def testAscii(self): """user: encode ascii password""" <|body_0|> def testUnicode(self): """user: encode unicode password""" <|body_1|> <|end_skeleton|> <|body_start_0|> expected = '{SHA...
stack_v2_sparse_classes_36k_train_001513
8,790
no_license
[ { "docstring": "user: encode ascii password", "name": "testAscii", "signature": "def testAscii(self)" }, { "docstring": "user: encode unicode password", "name": "testUnicode", "signature": "def testUnicode(self)" } ]
2
stack_v2_sparse_classes_30k_train_002838
Implement the Python class `EncodePasswordTestCase` described below. Class description: user: encode passwords tests Method signatures and docstrings: - def testAscii(self): user: encode ascii password - def testUnicode(self): user: encode unicode password
Implement the Python class `EncodePasswordTestCase` described below. Class description: user: encode passwords tests Method signatures and docstrings: - def testAscii(self): user: encode ascii password - def testUnicode(self): user: encode unicode password <|skeleton|> class EncodePasswordTestCase: """user: enco...
a2c30c3b742c65fb2c5bfbab1267d643823882a5
<|skeleton|> class EncodePasswordTestCase: """user: encode passwords tests""" def testAscii(self): """user: encode ascii password""" <|body_0|> def testUnicode(self): """user: encode unicode password""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncodePasswordTestCase: """user: encode passwords tests""" def testAscii(self): """user: encode ascii password""" expected = '{SHA}X+lk6KR7JuJEH43YnmettCwICdU=' result = user.encodePassword('MoinMoin') self.assertEqual(result, expected, 'Expected "%(expected)s" but got "%(...
the_stack_v2_python_sparse
mysocietyorg/moin/lib/python2.4/site-packages/MoinMoin/_tests/test_user.py
MyfanwyNixon/orgsites
train
0
681d0e58a9c8be76d6122471d48e45f2752e8512
[ "self.__products = {}\nself.__item_code = ''\nself.__item_data = []\nself.__item_price = 0.0\nself.__item_name = ''", "input_file = open('list_price.txt', 'r')\nfor line in input_file:\n line = line.split(',')\n self.__item_code = line[0]\n self.__item_price = float(line[1])\n self.__item_name = line[...
<|body_start_0|> self.__products = {} self.__item_code = '' self.__item_data = [] self.__item_price = 0.0 self.__item_name = '' <|end_body_0|> <|body_start_1|> input_file = open('list_price.txt', 'r') for line in input_file: line = line.split(',') ...
Class reads product list file, displays full list and specific item
ProductList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductList: """Class reads product list file, displays full list and specific item""" def __init__(self): """Creates instance variables""" <|body_0|> def GenerateProductList(self): """Read data in for products and returns information as dictionary""" <|b...
stack_v2_sparse_classes_36k_train_001514
2,595
no_license
[ { "docstring": "Creates instance variables", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Read data in for products and returns information as dictionary", "name": "GenerateProductList", "signature": "def GenerateProductList(self)" }, { "docstring": "D...
4
stack_v2_sparse_classes_30k_train_017122
Implement the Python class `ProductList` described below. Class description: Class reads product list file, displays full list and specific item Method signatures and docstrings: - def __init__(self): Creates instance variables - def GenerateProductList(self): Read data in for products and returns information as dict...
Implement the Python class `ProductList` described below. Class description: Class reads product list file, displays full list and specific item Method signatures and docstrings: - def __init__(self): Creates instance variables - def GenerateProductList(self): Read data in for products and returns information as dict...
37d8f5ef954bf8717a7eb7fd58bfa5607e339265
<|skeleton|> class ProductList: """Class reads product list file, displays full list and specific item""" def __init__(self): """Creates instance variables""" <|body_0|> def GenerateProductList(self): """Read data in for products and returns information as dictionary""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProductList: """Class reads product list file, displays full list and specific item""" def __init__(self): """Creates instance variables""" self.__products = {} self.__item_code = '' self.__item_data = [] self.__item_price = 0.0 self.__item_name = '' d...
the_stack_v2_python_sparse
CSC121FinalProject_WakeMartUpgrade/show_list_prices.py
mischelay2001/WTCSC121
train
1
66524d582224d7d8747f38a06dee9f33b9ea2fdb
[ "self.name = None\nself.contents = []\nself.exclusions = ['*.pyc', '*.pyd', '*.pyo', '*.pyx', '*.pxi', '__pycache__', '*-info', 'EGG_INFO', '*.so']", "parts = {}\nfor node in self.contents:\n self._add_part(node, os.path.basename(self.name), parts)\nreturn parts", "if node.included:\n node_name = parent_n...
<|body_start_0|> self.name = None self.contents = [] self.exclusions = ['*.pyc', '*.pyd', '*.pyo', '*.pyx', '*.pxi', '__pycache__', '*-info', 'EGG_INFO', '*.so'] <|end_body_0|> <|body_start_1|> parts = {} for node in self.contents: self._add_part(node, os.path.basena...
The encapsulation of a memory-filesystem package.
QrcPackage
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QrcPackage: """The encapsulation of a memory-filesystem package.""" def __init__(self): """Initialise the package.""" <|body_0|> def parts(self): """Return the package as a dict of parts.""" <|body_1|> def _add_part(self, node, parent_name, parts): ...
stack_v2_sparse_classes_36k_train_001515
3,140
permissive
[ { "docstring": "Initialise the package.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Return the package as a dict of parts.", "name": "parts", "signature": "def parts(self)" }, { "docstring": "Add a single file or directory to the parts dict.", "...
3
null
Implement the Python class `QrcPackage` described below. Class description: The encapsulation of a memory-filesystem package. Method signatures and docstrings: - def __init__(self): Initialise the package. - def parts(self): Return the package as a dict of parts. - def _add_part(self, node, parent_name, parts): Add a...
Implement the Python class `QrcPackage` described below. Class description: The encapsulation of a memory-filesystem package. Method signatures and docstrings: - def __init__(self): Initialise the package. - def parts(self): Return the package as a dict of parts. - def _add_part(self, node, parent_name, parts): Add a...
4ed2b1b9a2407afcbffdf304020d42b81c4c8cdc
<|skeleton|> class QrcPackage: """The encapsulation of a memory-filesystem package.""" def __init__(self): """Initialise the package.""" <|body_0|> def parts(self): """Return the package as a dict of parts.""" <|body_1|> def _add_part(self, node, parent_name, parts): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QrcPackage: """The encapsulation of a memory-filesystem package.""" def __init__(self): """Initialise the package.""" self.name = None self.contents = [] self.exclusions = ['*.pyc', '*.pyd', '*.pyo', '*.pyx', '*.pxi', '__pycache__', '*-info', 'EGG_INFO', '*.so'] def p...
the_stack_v2_python_sparse
note/demo/pyqt_demo/pyqtdeploy-3.3.0/pyqtdeploy/project/project_parts.py
onsunsl/onsunsl.github.io
train
1
20b84885e1395fc58b3a1bc7e5c96976f2fb02eb
[ "self.cam_files = cam_files\nself.log_files = log_files\nself.shrink_size = shrink_size / 2 if shrink_size else None\nself.resize_dims = resize_dims\nself.crop_size = crop_size\nself.str_angles = np.zeros(1)\nself.folder_name = folder_name\nself.batch_size = batch_size\nself.ds_min = ds_min\nself.ds_max = ds_max", ...
<|body_start_0|> self.cam_files = cam_files self.log_files = log_files self.shrink_size = shrink_size / 2 if shrink_size else None self.resize_dims = resize_dims self.crop_size = crop_size self.str_angles = np.zeros(1) self.folder_name = folder_name self.b...
Class for creating data preprocessor instances.
DataPreprocessor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataPreprocessor: """Class for creating data preprocessor instances.""" def __init__(self, cam_files, log_files, folder_name, batch_size=B_SIZE, ds_min=None, ds_max=None, shrink_size=None, resize_dims=RESIZE_DIMS, crop_size=CROP_SIZE): """Set the data preprocessor instance attributes...
stack_v2_sparse_classes_36k_train_001516
4,470
permissive
[ { "docstring": "Set the data preprocessor instance attributes. :param cam_files: input camera frame recordings :param log_files: measurement log files :param folder_name: name of the folder where the preprocessed data will be stored :param batch_size: preprocessing batch size (set to 64 by default) :param ds_mi...
2
stack_v2_sparse_classes_30k_train_016288
Implement the Python class `DataPreprocessor` described below. Class description: Class for creating data preprocessor instances. Method signatures and docstrings: - def __init__(self, cam_files, log_files, folder_name, batch_size=B_SIZE, ds_min=None, ds_max=None, shrink_size=None, resize_dims=RESIZE_DIMS, crop_size=...
Implement the Python class `DataPreprocessor` described below. Class description: Class for creating data preprocessor instances. Method signatures and docstrings: - def __init__(self, cam_files, log_files, folder_name, batch_size=B_SIZE, ds_min=None, ds_max=None, shrink_size=None, resize_dims=RESIZE_DIMS, crop_size=...
31d23471bccf2c5fe64d5c628a21150d65c2aeec
<|skeleton|> class DataPreprocessor: """Class for creating data preprocessor instances.""" def __init__(self, cam_files, log_files, folder_name, batch_size=B_SIZE, ds_min=None, ds_max=None, shrink_size=None, resize_dims=RESIZE_DIMS, crop_size=CROP_SIZE): """Set the data preprocessor instance attributes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataPreprocessor: """Class for creating data preprocessor instances.""" def __init__(self, cam_files, log_files, folder_name, batch_size=B_SIZE, ds_min=None, ds_max=None, shrink_size=None, resize_dims=RESIZE_DIMS, crop_size=CROP_SIZE): """Set the data preprocessor instance attributes. :param cam_...
the_stack_v2_python_sparse
comma.ai/data_preprocessor.py
SoftwareImpacts/SIMPAC-2021-129
train
0
12f84b3e187a5618b10053ae4d2fbcd9c99cd135
[ "project = get_object_or_404(models.Project, slug=project_slug)\nif request.user.is_authenticated:\n rights = request.user.project_right(project)\nelse:\n rights = get_anonymous_rights(project)\ndata, labels = get_project_fields(project_slug)\nif data:\n if request.is_ajax():\n context = {'project':...
<|body_start_0|> project = get_object_or_404(models.Project, slug=project_slug) if request.user.is_authenticated: rights = request.user.project_right(project) else: rights = get_anonymous_rights(project) data, labels = get_project_fields(project_slug) if d...
View to administrate a project
ProjectAdminView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectAdminView: """View to administrate a project""" def get(self, request, project_slug): """Get the detail of project fields and edit it""" <|body_0|> def post(self, request, project_slug): """View to save modification done to a project""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_001517
24,105
no_license
[ { "docstring": "Get the detail of project fields and edit it", "name": "get", "signature": "def get(self, request, project_slug)" }, { "docstring": "View to save modification done to a project", "name": "post", "signature": "def post(self, request, project_slug)" } ]
2
stack_v2_sparse_classes_30k_test_001044
Implement the Python class `ProjectAdminView` described below. Class description: View to administrate a project Method signatures and docstrings: - def get(self, request, project_slug): Get the detail of project fields and edit it - def post(self, request, project_slug): View to save modification done to a project
Implement the Python class `ProjectAdminView` described below. Class description: View to administrate a project Method signatures and docstrings: - def get(self, request, project_slug): Get the detail of project fields and edit it - def post(self, request, project_slug): View to save modification done to a project ...
0ffdec153648561554cfe7664da4912feb2adc88
<|skeleton|> class ProjectAdminView: """View to administrate a project""" def get(self, request, project_slug): """Get the detail of project fields and edit it""" <|body_0|> def post(self, request, project_slug): """View to save modification done to a project""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectAdminView: """View to administrate a project""" def get(self, request, project_slug): """Get the detail of project fields and edit it""" project = get_object_or_404(models.Project, slug=project_slug) if request.user.is_authenticated: rights = request.user.projec...
the_stack_v2_python_sparse
collab/views/views.py
maxreinhart/collab
train
0
2bc64af81aca855540ffd89a0cbec8f5befad1db
[ "self.w, self.n = (w, len(w))\nfor i in range(1, self.n):\n self.w[i] += self.w[i - 1]", "i, j, r = (0, self.n - 1, random.randint(1, self.w[-1]))\nwhile i <= j:\n m = (i + j) // 2\n if r == self.w[m]:\n return m\n elif r < self.w[m]:\n j = m - 1\n else:\n i = m + 1\nreturn i" ...
<|body_start_0|> self.w, self.n = (w, len(w)) for i in range(1, self.n): self.w[i] += self.w[i - 1] <|end_body_0|> <|body_start_1|> i, j, r = (0, self.n - 1, random.randint(1, self.w[-1])) while i <= j: m = (i + j) // 2 if r == self.w[m]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.w, self.n = (w, len(w)) for i in range(1, self.n): self.w[i] += self.w[...
stack_v2_sparse_classes_36k_train_001518
695
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
stack_v2_sparse_classes_30k_train_010914
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
12f62a218e827e6be2578b206dee9ce256da8d3d
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" self.w, self.n = (w, len(w)) for i in range(1, self.n): self.w[i] += self.w[i - 1] def pickIndex(self): """:rtype: int""" i, j, r = (0, self.n - 1, random.randint(1, self.w[-1])) while i ...
the_stack_v2_python_sparse
Python3/0528_Random_Pick_With_Weight.py
kiranani/playground
train
0
178d7d8221ac670b1c450b8bde4f7a65b20a414d
[ "self.schemas = dict()\nfor url in schema_urls:\n name = url.split('/')[-1]\n self.schemas[name] = {'$ref': url, 'id': url}\nself.resolver = self.resolver_factory()\nself._json_gen = JsonGenerator(resolver=self.resolver)", "if name is None:\n name = random.choice(list(self.schemas.keys()))\n schema = ...
<|body_start_0|> self.schemas = dict() for url in schema_urls: name = url.split('/')[-1] self.schemas[name] = {'$ref': url, 'id': url} self.resolver = self.resolver_factory() self._json_gen = JsonGenerator(resolver=self.resolver) <|end_body_0|> <|body_start_1|> ...
Used to generate random JSON from a from a list of URLs containing JSON schemas.
HCAJsonGenerator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HCAJsonGenerator: """Used to generate random JSON from a from a list of URLs containing JSON schemas.""" def __init__(self, schema_urls): """:param schema_urls: a list of JSON schema URLs.""" <|body_0|> def generate(self, name: str=None) -> str: """Chooses a rand...
stack_v2_sparse_classes_36k_train_001519
2,792
permissive
[ { "docstring": ":param schema_urls: a list of JSON schema URLs.", "name": "__init__", "signature": "def __init__(self, schema_urls)" }, { "docstring": "Chooses a random JSON schema from self.schemas and generates JSON data. :param name: the name of a JSON schema to generate. If None, then a rand...
4
stack_v2_sparse_classes_30k_train_001046
Implement the Python class `HCAJsonGenerator` described below. Class description: Used to generate random JSON from a from a list of URLs containing JSON schemas. Method signatures and docstrings: - def __init__(self, schema_urls): :param schema_urls: a list of JSON schema URLs. - def generate(self, name: str=None) -...
Implement the Python class `HCAJsonGenerator` described below. Class description: Used to generate random JSON from a from a list of URLs containing JSON schemas. Method signatures and docstrings: - def __init__(self, schema_urls): :param schema_urls: a list of JSON schema URLs. - def generate(self, name: str=None) -...
3722323d4eed3089d25f6d6c9cbfb1672b7de939
<|skeleton|> class HCAJsonGenerator: """Used to generate random JSON from a from a list of URLs containing JSON schemas.""" def __init__(self, schema_urls): """:param schema_urls: a list of JSON schema URLs.""" <|body_0|> def generate(self, name: str=None) -> str: """Chooses a rand...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HCAJsonGenerator: """Used to generate random JSON from a from a list of URLs containing JSON schemas.""" def __init__(self, schema_urls): """:param schema_urls: a list of JSON schema URLs.""" self.schemas = dict() for url in schema_urls: name = url.split('/')[-1] ...
the_stack_v2_python_sparse
attic/hca_generator.py
DataBiosphere/azul
train
23
f2d8891caa9d8249ed8731d8babe9002366edba6
[ "these_latitudes_deg, these_longitudes_deg = misc.create_latlng_grid(min_latitude_deg=MIN_GRID_LATITUDE_DEG, max_latitude_deg=MAX_GRID_LATITUDE_DEG, latitude_spacing_deg=LATITUDE_SPACING_DEG, min_longitude_deg=MIN_GRID_LONGITUDE_DEG, max_longitude_deg=MAX_GRID_LONGITUDE_DEG, longitude_spacing_deg=LONGITUDE_SPACING_...
<|body_start_0|> these_latitudes_deg, these_longitudes_deg = misc.create_latlng_grid(min_latitude_deg=MIN_GRID_LATITUDE_DEG, max_latitude_deg=MAX_GRID_LATITUDE_DEG, latitude_spacing_deg=LATITUDE_SPACING_DEG, min_longitude_deg=MIN_GRID_LONGITUDE_DEG, max_longitude_deg=MAX_GRID_LONGITUDE_DEG, longitude_spacing_de...
Each method is a unit test for misc.py.
MiscTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MiscTests: """Each method is a unit test for misc.py.""" def test_create_latlng_grid(self): """Ensures correct output from create_latlng_grid.""" <|body_0|> def test_find_best_and_worst_predictions(self): """Ensures correct output from find_best_and_worst_predict...
stack_v2_sparse_classes_36k_train_001520
2,969
no_license
[ { "docstring": "Ensures correct output from create_latlng_grid.", "name": "test_create_latlng_grid", "signature": "def test_create_latlng_grid(self)" }, { "docstring": "Ensures correct output from find_best_and_worst_predictions.", "name": "test_find_best_and_worst_predictions", "signatu...
2
stack_v2_sparse_classes_30k_train_017452
Implement the Python class `MiscTests` described below. Class description: Each method is a unit test for misc.py. Method signatures and docstrings: - def test_create_latlng_grid(self): Ensures correct output from create_latlng_grid. - def test_find_best_and_worst_predictions(self): Ensures correct output from find_b...
Implement the Python class `MiscTests` described below. Class description: Each method is a unit test for misc.py. Method signatures and docstrings: - def test_create_latlng_grid(self): Ensures correct output from create_latlng_grid. - def test_find_best_and_worst_predictions(self): Ensures correct output from find_b...
517d7cb2008a0ff06014c81e158c13bf8e17590a
<|skeleton|> class MiscTests: """Each method is a unit test for misc.py.""" def test_create_latlng_grid(self): """Ensures correct output from create_latlng_grid.""" <|body_0|> def test_find_best_and_worst_predictions(self): """Ensures correct output from find_best_and_worst_predict...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MiscTests: """Each method is a unit test for misc.py.""" def test_create_latlng_grid(self): """Ensures correct output from create_latlng_grid.""" these_latitudes_deg, these_longitudes_deg = misc.create_latlng_grid(min_latitude_deg=MIN_GRID_LATITUDE_DEG, max_latitude_deg=MAX_GRID_LATITUDE_...
the_stack_v2_python_sparse
ml4rt/utils/misc_test.py
thunderhoser/ml4rt
train
4
30d2b0b1cf973edc2df016f7856a4ad03f37f3f4
[ "parent = request.GET.get('parent', '')\nddlDmlType = request.GET.get('type', '')\nfilterInputValue = request.GET.get('filterInputValue', '')\nversion = request.GET.get('version', '')\ndic = {'parent': parent, 'ddlDmlType': ddlDmlType}\nobj = SqlCaseManage.objects.filter(**dic)\nif version:\n obj = obj.filter(ve...
<|body_start_0|> parent = request.GET.get('parent', '') ddlDmlType = request.GET.get('type', '') filterInputValue = request.GET.get('filterInputValue', '') version = request.GET.get('version', '') dic = {'parent': parent, 'ddlDmlType': ddlDmlType} obj = SqlCaseManage.obje...
SqlCaseManageList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SqlCaseManageList: def get(self, request, *args, **kwargs): """SQL测试用例列表""" <|body_0|> def put(self, request, *args, **kwargs): """编辑SQL测试用例""" <|body_1|> def post(self, request, *args, **kwargs): """创建SQL测试用例 级联更新结构表ddl/dml的数量""" <|body_...
stack_v2_sparse_classes_36k_train_001521
14,029
no_license
[ { "docstring": "SQL测试用例列表", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "编辑SQL测试用例", "name": "put", "signature": "def put(self, request, *args, **kwargs)" }, { "docstring": "创建SQL测试用例 级联更新结构表ddl/dml的数量", "name": "post", "signatu...
4
stack_v2_sparse_classes_30k_train_014142
Implement the Python class `SqlCaseManageList` described below. Class description: Implement the SqlCaseManageList class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): SQL测试用例列表 - def put(self, request, *args, **kwargs): 编辑SQL测试用例 - def post(self, request, *args, **kwargs): 创建SQL测试用例 级联...
Implement the Python class `SqlCaseManageList` described below. Class description: Implement the SqlCaseManageList class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): SQL测试用例列表 - def put(self, request, *args, **kwargs): 编辑SQL测试用例 - def post(self, request, *args, **kwargs): 创建SQL测试用例 级联...
f2523d6e51cde1b53ac6f453f8066b4b90c523b9
<|skeleton|> class SqlCaseManageList: def get(self, request, *args, **kwargs): """SQL测试用例列表""" <|body_0|> def put(self, request, *args, **kwargs): """编辑SQL测试用例""" <|body_1|> def post(self, request, *args, **kwargs): """创建SQL测试用例 级联更新结构表ddl/dml的数量""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SqlCaseManageList: def get(self, request, *args, **kwargs): """SQL测试用例列表""" parent = request.GET.get('parent', '') ddlDmlType = request.GET.get('type', '') filterInputValue = request.GET.get('filterInputValue', '') version = request.GET.get('version', '') dic = ...
the_stack_v2_python_sparse
api/db/rest/sqlCaseManage.py
zhuzhanhao1/backend
train
0
7ada38ce3f9e547a2bbc91c707b9c16f68211b33
[ "expectation = {'include': 'the good stuff'}\nresponse = Response(dummy_response())\ninstance = response[0]\nser = ReadOnlyElasticSerializer(instance)\nser.Meta.exclude = ['exclude']\nself.assertEqual(ser.data, expectation)", "expectation = {'include': 'the good stuff', 'exclude': 'the bad stuff'}\nresponse = Res...
<|body_start_0|> expectation = {'include': 'the good stuff'} response = Response(dummy_response()) instance = response[0] ser = ReadOnlyElasticSerializer(instance) ser.Meta.exclude = ['exclude'] self.assertEqual(ser.data, expectation) <|end_body_0|> <|body_start_1|> ...
Serializer tests.
SerializerTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SerializerTests: """Serializer tests.""" def test_exclusion(self): """Test excluding key from serialized data""" <|body_0|> def test_nonexistent_exclusion(self): """Test proper handling of nonexistent key in exclusion list""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_001522
12,045
permissive
[ { "docstring": "Test excluding key from serialized data", "name": "test_exclusion", "signature": "def test_exclusion(self)" }, { "docstring": "Test proper handling of nonexistent key in exclusion list", "name": "test_nonexistent_exclusion", "signature": "def test_nonexistent_exclusion(se...
2
stack_v2_sparse_classes_30k_train_021584
Implement the Python class `SerializerTests` described below. Class description: Serializer tests. Method signatures and docstrings: - def test_exclusion(self): Test excluding key from serialized data - def test_nonexistent_exclusion(self): Test proper handling of nonexistent key in exclusion list
Implement the Python class `SerializerTests` described below. Class description: Serializer tests. Method signatures and docstrings: - def test_exclusion(self): Test excluding key from serialized data - def test_nonexistent_exclusion(self): Test proper handling of nonexistent key in exclusion list <|skeleton|> class...
73d334a9f0df7c044c06989977a9a22dd2ff9b7a
<|skeleton|> class SerializerTests: """Serializer tests.""" def test_exclusion(self): """Test excluding key from serialized data""" <|body_0|> def test_nonexistent_exclusion(self): """Test proper handling of nonexistent key in exclusion list""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SerializerTests: """Serializer tests.""" def test_exclusion(self): """Test excluding key from serialized data""" expectation = {'include': 'the good stuff'} response = Response(dummy_response()) instance = response[0] ser = ReadOnlyElasticSerializer(instance) ...
the_stack_v2_python_sparse
goldstone/drfes/tests.py
bhuvan-rk/goldstone-server
train
0
5dcfad80b251d5db829b09203f88af2dd6a0f94a
[ "if not head or not head.next:\n return head\ncurr = head\nsize = 1\nwhile curr.next is not None:\n curr = curr.next\n size = size + 1\ncurr.next = head\nfor i in range(size - k % size):\n curr = curr.next\nnew_head = curr.next\ncurr.next = None\nreturn new_head", "if head == None:\n return None\np...
<|body_start_0|> if not head or not head.next: return head curr = head size = 1 while curr.next is not None: curr = curr.next size = size + 1 curr.next = head for i in range(size - k % size): curr = curr.next new_hea...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotateRight2(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_0|> def rotateRight(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n...
stack_v2_sparse_classes_36k_train_001523
1,635
no_license
[ { "docstring": ":type head: ListNode :type k: int :rtype: ListNode", "name": "rotateRight2", "signature": "def rotateRight2(self, head, k)" }, { "docstring": ":type head: ListNode :type k: int :rtype: ListNode", "name": "rotateRight", "signature": "def rotateRight(self, head, k)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotateRight2(self, head, k): :type head: ListNode :type k: int :rtype: ListNode - def rotateRight(self, head, k): :type head: ListNode :type k: int :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotateRight2(self, head, k): :type head: ListNode :type k: int :rtype: ListNode - def rotateRight(self, head, k): :type head: ListNode :type k: int :rtype: ListNode <|skelet...
ab49373ff3fc306a03a90de02e1801b8cbe520d7
<|skeleton|> class Solution: def rotateRight2(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_0|> def rotateRight(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotateRight2(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" if not head or not head.next: return head curr = head size = 1 while curr.next is not None: curr = curr.next size = size + 1 c...
the_stack_v2_python_sparse
finished/061.py
yiguid/LeetCodePractise
train
0
eac421170874c5e50e6aee8b4c18ff0a6cdda4c1
[ "if not language in ACCEPTED_LANGUAGES:\n raise ValueError(f'Language {language} is not supported yet')\nself._language = language\nself._matcher = Matcher(nlp.vocab)\nif language == 'es':\n self._pattern = [{'POS': 'ADV', 'LOWER': {'IN': ['no', 'nunca', 'jamás', 'tampoco']}}]\nelse:\n pass\nself._matcher....
<|body_start_0|> if not language in ACCEPTED_LANGUAGES: raise ValueError(f'Language {language} is not supported yet') self._language = language self._matcher = Matcher(nlp.vocab) if language == 'es': self._pattern = [{'POS': 'ADV', 'LOWER': {'IN': ['no', 'nunca', ...
This tagger has the task to find all verb phrases in a document. It needs to go after the 'Parser' pipeline component.
NegativeExpressionTagger
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NegativeExpressionTagger: """This tagger has the task to find all verb phrases in a document. It needs to go after the 'Parser' pipeline component.""" def __init__(self, nlp, language: str='es') -> None: """This constructor will initialize the object that tags verb phrases. Parameter...
stack_v2_sparse_classes_36k_train_001524
2,745
no_license
[ { "docstring": "This constructor will initialize the object that tags verb phrases. Parameters: nlp: The Spacy model to use this tagger with. language: The language that this pipeline will be used in. Returns: None.", "name": "__init__", "signature": "def __init__(self, nlp, language: str='es') -> None"...
2
stack_v2_sparse_classes_30k_train_017798
Implement the Python class `NegativeExpressionTagger` described below. Class description: This tagger has the task to find all verb phrases in a document. It needs to go after the 'Parser' pipeline component. Method signatures and docstrings: - def __init__(self, nlp, language: str='es') -> None: This constructor wil...
Implement the Python class `NegativeExpressionTagger` described below. Class description: This tagger has the task to find all verb phrases in a document. It needs to go after the 'Parser' pipeline component. Method signatures and docstrings: - def __init__(self, nlp, language: str='es') -> None: This constructor wil...
f23342fbf2cb54a89cd381813ad9eee754b61094
<|skeleton|> class NegativeExpressionTagger: """This tagger has the task to find all verb phrases in a document. It needs to go after the 'Parser' pipeline component.""" def __init__(self, nlp, language: str='es') -> None: """This constructor will initialize the object that tags verb phrases. Parameter...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NegativeExpressionTagger: """This tagger has the task to find all verb phrases in a document. It needs to go after the 'Parser' pipeline component.""" def __init__(self, nlp, language: str='es') -> None: """This constructor will initialize the object that tags verb phrases. Parameters: nlp: The S...
the_stack_v2_python_sparse
src/processing/pipes/negative_expression_tagger.py
persuaide/Tesis_Chatbot
train
0
3077088e5e3a6ce5ab65a0e1aaa97dc97975f27a
[ "super(TwoLayerNet, self).__init__()\nself.linear1 = torch.nn.Linear(D_in, H)\nself.linear2 = torch.nn.Linear(H, D_out)", "h_relu = self.linear1(x).clamp(min=0)\ny_pred = self.linear2(h_relu)\nreturn y_pred" ]
<|body_start_0|> super(TwoLayerNet, self).__init__() self.linear1 = torch.nn.Linear(D_in, H) self.linear2 = torch.nn.Linear(H, D_out) <|end_body_0|> <|body_start_1|> h_relu = self.linear1(x).clamp(min=0) y_pred = self.linear2(h_relu) return y_pred <|end_body_1|>
TwoLayerNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwoLayerNet: def __init__(self, D_in, H, D_out): """在构造函数中,我们实例化了两个nn.Linear模块,并将它们作为成员变量。""" <|body_0|> def forward(self, x): """在前向传播的函数中,我们接收一个输入的张量,也必须返回一个输出张量。 我们可以使用构造函数中定义的模块以及张量上的任意的(可微分的)操作。""" <|body_1|> <|end_skeleton|> <|body_start_0|> s...
stack_v2_sparse_classes_36k_train_001525
16,194
no_license
[ { "docstring": "在构造函数中,我们实例化了两个nn.Linear模块,并将它们作为成员变量。", "name": "__init__", "signature": "def __init__(self, D_in, H, D_out)" }, { "docstring": "在前向传播的函数中,我们接收一个输入的张量,也必须返回一个输出张量。 我们可以使用构造函数中定义的模块以及张量上的任意的(可微分的)操作。", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_008210
Implement the Python class `TwoLayerNet` described below. Class description: Implement the TwoLayerNet class. Method signatures and docstrings: - def __init__(self, D_in, H, D_out): 在构造函数中,我们实例化了两个nn.Linear模块,并将它们作为成员变量。 - def forward(self, x): 在前向传播的函数中,我们接收一个输入的张量,也必须返回一个输出张量。 我们可以使用构造函数中定义的模块以及张量上的任意的(可微分的)操作。
Implement the Python class `TwoLayerNet` described below. Class description: Implement the TwoLayerNet class. Method signatures and docstrings: - def __init__(self, D_in, H, D_out): 在构造函数中,我们实例化了两个nn.Linear模块,并将它们作为成员变量。 - def forward(self, x): 在前向传播的函数中,我们接收一个输入的张量,也必须返回一个输出张量。 我们可以使用构造函数中定义的模块以及张量上的任意的(可微分的)操作。 <|...
272e0b674f2d8ebdca9eea0a35909d2c420212ae
<|skeleton|> class TwoLayerNet: def __init__(self, D_in, H, D_out): """在构造函数中,我们实例化了两个nn.Linear模块,并将它们作为成员变量。""" <|body_0|> def forward(self, x): """在前向传播的函数中,我们接收一个输入的张量,也必须返回一个输出张量。 我们可以使用构造函数中定义的模块以及张量上的任意的(可微分的)操作。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TwoLayerNet: def __init__(self, D_in, H, D_out): """在构造函数中,我们实例化了两个nn.Linear模块,并将它们作为成员变量。""" super(TwoLayerNet, self).__init__() self.linear1 = torch.nn.Linear(D_in, H) self.linear2 = torch.nn.Linear(H, D_out) def forward(self, x): """在前向传播的函数中,我们接收一个输入的张量,也必须返回一个...
the_stack_v2_python_sparse
PyTorch/quick_start_2/function_try.py
StarkTan/Python
train
0
f592050eb75fa027c271798a4074784b43ea122c
[ "cluster = self.cluster\ncluster.populate([3]).start()\nnode = cluster.nodelist()[0]\nnode.drain(block_on_log=True)\ntry:\n node.decommission()\n self.assertFalse('Expected nodetool error')\nexcept ToolError as e:\n self.assertEqual('', e.stderr)\n self.assertTrue('Unsupported operation' in e.stdout)", ...
<|body_start_0|> cluster = self.cluster cluster.populate([3]).start() node = cluster.nodelist()[0] node.drain(block_on_log=True) try: node.decommission() self.assertFalse('Expected nodetool error') except ToolError as e: self.assertEqua...
TestNodetool
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestNodetool: def test_decommission_after_drain_is_invalid(self): """@jira_ticket CASSANDRA-8741 Running a decommission after a drain should generate an unsupported operation message and exit with an error code (which we receive as a ToolError exception).""" <|body_0|> def t...
stack_v2_sparse_classes_36k_train_001526
5,539
permissive
[ { "docstring": "@jira_ticket CASSANDRA-8741 Running a decommission after a drain should generate an unsupported operation message and exit with an error code (which we receive as a ToolError exception).", "name": "test_decommission_after_drain_is_invalid", "signature": "def test_decommission_after_drain...
4
stack_v2_sparse_classes_30k_train_018677
Implement the Python class `TestNodetool` described below. Class description: Implement the TestNodetool class. Method signatures and docstrings: - def test_decommission_after_drain_is_invalid(self): @jira_ticket CASSANDRA-8741 Running a decommission after a drain should generate an unsupported operation message and ...
Implement the Python class `TestNodetool` described below. Class description: Implement the TestNodetool class. Method signatures and docstrings: - def test_decommission_after_drain_is_invalid(self): @jira_ticket CASSANDRA-8741 Running a decommission after a drain should generate an unsupported operation message and ...
9ab09570b4750d9b801e2246d0fbd6016ee0a8ca
<|skeleton|> class TestNodetool: def test_decommission_after_drain_is_invalid(self): """@jira_ticket CASSANDRA-8741 Running a decommission after a drain should generate an unsupported operation message and exit with an error code (which we receive as a ToolError exception).""" <|body_0|> def t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestNodetool: def test_decommission_after_drain_is_invalid(self): """@jira_ticket CASSANDRA-8741 Running a decommission after a drain should generate an unsupported operation message and exit with an error code (which we receive as a ToolError exception).""" cluster = self.cluster clus...
the_stack_v2_python_sparse
nodetool_test.py
DikangGu/cassandra-dtest
train
1
2361b9a96d30fbe16752a84561bf8799304d433a
[ "self.vocab, self.ids_to_tokens = load_vocab(vocab_file)\nnever_split = ('[UNK]', '[SEP]', '[PAD]', '[CLS]', '[MASK]')\nself.basic_tokenizer = BasicTokenizer(do_lower_case=do_lower_case, never_split=never_split)\nself.wordpiece_tokenizer = WordpieceTokenizer(vocab=self.vocab)", "split_tokens = []\nfor token in se...
<|body_start_0|> self.vocab, self.ids_to_tokens = load_vocab(vocab_file) never_split = ('[UNK]', '[SEP]', '[PAD]', '[CLS]', '[MASK]') self.basic_tokenizer = BasicTokenizer(do_lower_case=do_lower_case, never_split=never_split) self.wordpiece_tokenizer = WordpieceTokenizer(vocab=self.vocab...
BERT用の文章の単語分割クラスを実装
BertTokenizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BertTokenizer: """BERT用の文章の単語分割クラスを実装""" def __init__(self, vocab_file, do_lower_case=True): """vocab_file:ボキャブラリーへのパス do_lower_case:前処理で単語を小文字化するかどうか""" <|body_0|> def tokenize(self, text): """文章を単語に分割する関数""" <|body_1|> def convert_tokens_to_ids(sel...
stack_v2_sparse_classes_36k_train_001527
30,882
permissive
[ { "docstring": "vocab_file:ボキャブラリーへのパス do_lower_case:前処理で単語を小文字化するかどうか", "name": "__init__", "signature": "def __init__(self, vocab_file, do_lower_case=True)" }, { "docstring": "文章を単語に分割する関数", "name": "tokenize", "signature": "def tokenize(self, text)" }, { "docstring": "分割された単語リ...
4
stack_v2_sparse_classes_30k_train_009553
Implement the Python class `BertTokenizer` described below. Class description: BERT用の文章の単語分割クラスを実装 Method signatures and docstrings: - def __init__(self, vocab_file, do_lower_case=True): vocab_file:ボキャブラリーへのパス do_lower_case:前処理で単語を小文字化するかどうか - def tokenize(self, text): 文章を単語に分割する関数 - def convert_tokens_to_ids(self, t...
Implement the Python class `BertTokenizer` described below. Class description: BERT用の文章の単語分割クラスを実装 Method signatures and docstrings: - def __init__(self, vocab_file, do_lower_case=True): vocab_file:ボキャブラリーへのパス do_lower_case:前処理で単語を小文字化するかどうか - def tokenize(self, text): 文章を単語に分割する関数 - def convert_tokens_to_ids(self, t...
bada8e07bd7503ed6d7a371fafb7a29b52b06d62
<|skeleton|> class BertTokenizer: """BERT用の文章の単語分割クラスを実装""" def __init__(self, vocab_file, do_lower_case=True): """vocab_file:ボキャブラリーへのパス do_lower_case:前処理で単語を小文字化するかどうか""" <|body_0|> def tokenize(self, text): """文章を単語に分割する関数""" <|body_1|> def convert_tokens_to_ids(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BertTokenizer: """BERT用の文章の単語分割クラスを実装""" def __init__(self, vocab_file, do_lower_case=True): """vocab_file:ボキャブラリーへのパス do_lower_case:前処理で単語を小文字化するかどうか""" self.vocab, self.ids_to_tokens = load_vocab(vocab_file) never_split = ('[UNK]', '[SEP]', '[PAD]', '[CLS]', '[MASK]') se...
the_stack_v2_python_sparse
8_nlp_sentiment_bert/utils/bert.py
YutaroOgawa/pytorch_advanced
train
811
8e5e4a8b188ac4a760496d3de2b2ad27a7251e13
[ "qry = ServiceOperationQuery(self, 'approve', None, {'message': message})\nself.context.add_query(qry)\nreturn self", "qry = ServiceOperationQuery(self, 'decline', None, {'message': message})\nself.context.add_query(qry)\nreturn self" ]
<|body_start_0|> qry = ServiceOperationQuery(self, 'approve', None, {'message': message}) self.context.add_query(qry) return self <|end_body_0|> <|body_start_1|> qry = ServiceOperationQuery(self, 'decline', None, {'message': message}) self.context.add_query(qry) return s...
ScheduleChangeRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScheduleChangeRequest: def approve(self, message): """Approve an ScheduleChangeRequest object. :param str message: A custom approval message.""" <|body_0|> def decline(self, message): """:param str message: A custom approval message.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k_train_001528
757
permissive
[ { "docstring": "Approve an ScheduleChangeRequest object. :param str message: A custom approval message.", "name": "approve", "signature": "def approve(self, message)" }, { "docstring": ":param str message: A custom approval message.", "name": "decline", "signature": "def decline(self, me...
2
null
Implement the Python class `ScheduleChangeRequest` described below. Class description: Implement the ScheduleChangeRequest class. Method signatures and docstrings: - def approve(self, message): Approve an ScheduleChangeRequest object. :param str message: A custom approval message. - def decline(self, message): :param...
Implement the Python class `ScheduleChangeRequest` described below. Class description: Implement the ScheduleChangeRequest class. Method signatures and docstrings: - def approve(self, message): Approve an ScheduleChangeRequest object. :param str message: A custom approval message. - def decline(self, message): :param...
cbd245d1af8d69e013c469cfc2a9851f51c91417
<|skeleton|> class ScheduleChangeRequest: def approve(self, message): """Approve an ScheduleChangeRequest object. :param str message: A custom approval message.""" <|body_0|> def decline(self, message): """:param str message: A custom approval message.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScheduleChangeRequest: def approve(self, message): """Approve an ScheduleChangeRequest object. :param str message: A custom approval message.""" qry = ServiceOperationQuery(self, 'approve', None, {'message': message}) self.context.add_query(qry) return self def decline(sel...
the_stack_v2_python_sparse
office365/teams/schedule/change_request.py
vgrem/Office365-REST-Python-Client
train
1,006
35b766ef72688aab34b36b1bf1154af470e9605c
[ "with dbconnections.pg_connection(must_commit, is_test) as cursor:\n if command_type == CMD_TYPE_TEXT and parameters is not None:\n cursor.execute(command, parameters)\n elif command_type == CMD_TYPE_TEXT and parameters is None:\n cursor.execute(command)\n elif command_type == CMD_TYPE_FUNCTI...
<|body_start_0|> with dbconnections.pg_connection(must_commit, is_test) as cursor: if command_type == CMD_TYPE_TEXT and parameters is not None: cursor.execute(command, parameters) elif command_type == CMD_TYPE_TEXT and parameters is None: cursor.execute(co...
Data access layer class for postgresql data base
PgSqlDal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PgSqlDal: """Data access layer class for postgresql data base""" def execute_no_query(cls, command, command_type, parameters=None, must_commit=True, is_test=False): """Execute queries without returns, command_type parameter must be a CMD_TYPE_FUNCTION or CMD_TYPE_TEXT constants""" ...
stack_v2_sparse_classes_36k_train_001529
2,014
no_license
[ { "docstring": "Execute queries without returns, command_type parameter must be a CMD_TYPE_FUNCTION or CMD_TYPE_TEXT constants", "name": "execute_no_query", "signature": "def execute_no_query(cls, command, command_type, parameters=None, must_commit=True, is_test=False)" }, { "docstring": "Execut...
2
stack_v2_sparse_classes_30k_train_012669
Implement the Python class `PgSqlDal` described below. Class description: Data access layer class for postgresql data base Method signatures and docstrings: - def execute_no_query(cls, command, command_type, parameters=None, must_commit=True, is_test=False): Execute queries without returns, command_type parameter mus...
Implement the Python class `PgSqlDal` described below. Class description: Data access layer class for postgresql data base Method signatures and docstrings: - def execute_no_query(cls, command, command_type, parameters=None, must_commit=True, is_test=False): Execute queries without returns, command_type parameter mus...
4b4125f762dea863f1df5fe0ef9bf2eddd7b3517
<|skeleton|> class PgSqlDal: """Data access layer class for postgresql data base""" def execute_no_query(cls, command, command_type, parameters=None, must_commit=True, is_test=False): """Execute queries without returns, command_type parameter must be a CMD_TYPE_FUNCTION or CMD_TYPE_TEXT constants""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PgSqlDal: """Data access layer class for postgresql data base""" def execute_no_query(cls, command, command_type, parameters=None, must_commit=True, is_test=False): """Execute queries without returns, command_type parameter must be a CMD_TYPE_FUNCTION or CMD_TYPE_TEXT constants""" with db...
the_stack_v2_python_sparse
src/others/dals.py
matheusssilva/PyLoca
train
0
b36fcfe7d6d5350afb995f1862d974729d01e333
[ "parser.add_argument('appname', help='The sample app name, e.g. \"finance\".')\nparser.add_argument('--instance-id', required=True, type=str, help='The Cloud Spanner instance ID for the sample app.')\nparser.add_argument('--database-id', type=str, help='ID of the new Cloud Spanner database to create for the sample ...
<|body_start_0|> parser.add_argument('appname', help='The sample app name, e.g. "finance".') parser.add_argument('--instance-id', required=True, type=str, help='The Cloud Spanner instance ID for the sample app.') parser.add_argument('--database-id', type=str, help='ID of the new Cloud Spanner da...
Initialize a Cloud Spanner sample app. This command creates a Cloud Spanner database in the given instance for the sample app and loads any initial data required by the application.
Init
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Init: """Initialize a Cloud Spanner sample app. This command creates a Cloud Spanner database in the given instance for the sample app and loads any initial data required by the application.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args...
stack_v2_sparse_classes_36k_train_001530
9,146
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.", "name": "Args", "signature": "def Args(parser)" }, { "docstring"...
2
stack_v2_sparse_classes_30k_train_011371
Implement the Python class `Init` described below. Class description: Initialize a Cloud Spanner sample app. This command creates a Cloud Spanner database in the given instance for the sample app and loads any initial data required by the application. Method signatures and docstrings: - def Args(parser): Args is call...
Implement the Python class `Init` described below. Class description: Initialize a Cloud Spanner sample app. This command creates a Cloud Spanner database in the given instance for the sample app and loads any initial data required by the application. Method signatures and docstrings: - def Args(parser): Args is call...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class Init: """Initialize a Cloud Spanner sample app. This command creates a Cloud Spanner database in the given instance for the sample app and loads any initial data required by the application.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Init: """Initialize a Cloud Spanner sample app. This command creates a Cloud Spanner database in the given instance for the sample app and loads any initial data required by the application.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An ...
the_stack_v2_python_sparse
lib/surface/spanner/samples/init.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
4e8f5f53432daf01602b07f8c2ee21fe281b051c
[ "for window in window_seq:\n x_window = self.split(window, depth=depth, **kwargs)\n for index, item in enumerate(x_window):\n yield item", "indexed_window = list((self.Atom(index=index, value=value, state=0) for index, value in enumerate(sequence)))\nindexed_window = self.split_rec(indexed_window, **...
<|body_start_0|> for window in window_seq: x_window = self.split(window, depth=depth, **kwargs) for index, item in enumerate(x_window): yield item <|end_body_0|> <|body_start_1|> indexed_window = list((self.Atom(index=index, value=value, state=0) for index, value...
Need to be calibrated
NikitinSWFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NikitinSWFilter: """Need to be calibrated""" def aggregate_windows(self, window_seq, depth=0, **kwargs): """:param window_seq: :param depth: :param kwargs: :return:""" <|body_0|> def split(self, sequence, use_first=True, **kwargs): """:param sequence: :param use_...
stack_v2_sparse_classes_36k_train_001531
3,632
permissive
[ { "docstring": ":param window_seq: :param depth: :param kwargs: :return:", "name": "aggregate_windows", "signature": "def aggregate_windows(self, window_seq, depth=0, **kwargs)" }, { "docstring": ":param sequence: :param use_first: :param kwargs: :return:", "name": "split", "signature": ...
3
null
Implement the Python class `NikitinSWFilter` described below. Class description: Need to be calibrated Method signatures and docstrings: - def aggregate_windows(self, window_seq, depth=0, **kwargs): :param window_seq: :param depth: :param kwargs: :return: - def split(self, sequence, use_first=True, **kwargs): :param ...
Implement the Python class `NikitinSWFilter` described below. Class description: Need to be calibrated Method signatures and docstrings: - def aggregate_windows(self, window_seq, depth=0, **kwargs): :param window_seq: :param depth: :param kwargs: :return: - def split(self, sequence, use_first=True, **kwargs): :param ...
617ff45c9c3c96bbd9a975aef15f1b2697282b9c
<|skeleton|> class NikitinSWFilter: """Need to be calibrated""" def aggregate_windows(self, window_seq, depth=0, **kwargs): """:param window_seq: :param depth: :param kwargs: :return:""" <|body_0|> def split(self, sequence, use_first=True, **kwargs): """:param sequence: :param use_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NikitinSWFilter: """Need to be calibrated""" def aggregate_windows(self, window_seq, depth=0, **kwargs): """:param window_seq: :param depth: :param kwargs: :return:""" for window in window_seq: x_window = self.split(window, depth=depth, **kwargs) for index, item in...
the_stack_v2_python_sparse
shot_detector/filters/sliding_window/nikitin_swfilter.py
w495/python-video-shot-detector
train
20
311a746fe3d5b3743c6fa746747ff0b0b40aa907
[ "self.wifi_mac = wifi_mac\nself.id = id\nself.serial = serial\nself.device_fields = device_fields", "if dictionary is None:\n return None\ndevice_fields = meraki_sdk.models.device_fields_model.DeviceFieldsModel.from_dictionary(dictionary.get('deviceFields')) if dictionary.get('deviceFields') else None\nwifi_ma...
<|body_start_0|> self.wifi_mac = wifi_mac self.id = id self.serial = serial self.device_fields = device_fields <|end_body_0|> <|body_start_1|> if dictionary is None: return None device_fields = meraki_sdk.models.device_fields_model.DeviceFieldsModel.from_dict...
Implementation of the 'updateNetworkSmDeviceFields' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be modified. id (string): The id of the device to be modified. serial (string): The serial of the device to be modified. device_fields (DeviceFieldsModel): The new fi...
UpdateNetworkSmDeviceFieldsModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkSmDeviceFieldsModel: """Implementation of the 'updateNetworkSmDeviceFields' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be modified. id (string): The id of the device to be modified. serial (string): The serial of the device t...
stack_v2_sparse_classes_36k_train_001532
2,396
permissive
[ { "docstring": "Constructor for the UpdateNetworkSmDeviceFieldsModel class", "name": "__init__", "signature": "def __init__(self, device_fields=None, wifi_mac=None, id=None, serial=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dict...
2
stack_v2_sparse_classes_30k_train_006766
Implement the Python class `UpdateNetworkSmDeviceFieldsModel` described below. Class description: Implementation of the 'updateNetworkSmDeviceFields' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be modified. id (string): The id of the device to be modified. seri...
Implement the Python class `UpdateNetworkSmDeviceFieldsModel` described below. Class description: Implementation of the 'updateNetworkSmDeviceFields' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be modified. id (string): The id of the device to be modified. seri...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkSmDeviceFieldsModel: """Implementation of the 'updateNetworkSmDeviceFields' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be modified. id (string): The id of the device to be modified. serial (string): The serial of the device t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateNetworkSmDeviceFieldsModel: """Implementation of the 'updateNetworkSmDeviceFields' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be modified. id (string): The id of the device to be modified. serial (string): The serial of the device to be modified...
the_stack_v2_python_sparse
meraki_sdk/models/update_network_sm_device_fields_model.py
RaulCatalano/meraki-python-sdk
train
1
feb5f0615cf0d98797ac27dff0810508a4297fd7
[ "for attr in self.to_auto_overload[tensor_type]:\n if attr not in dir(PointerTensor) or attr in self.boolean_comparators:\n new_method = self._get_hooked_pointer_method(attr)\n setattr(PointerTensor, attr, new_method)", "for attr in self.to_auto_overload[framework_cls]:\n new_method = self._ge...
<|body_start_0|> for attr in self.to_auto_overload[tensor_type]: if attr not in dir(PointerTensor) or attr in self.boolean_comparators: new_method = self._get_hooked_pointer_method(attr) setattr(PointerTensor, attr, new_method) <|end_body_0|> <|body_start_1|> ...
Hook for ALL THE POINTER THINGS that must be overloaded and/or modified
PointerHook
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PointerHook: """Hook for ALL THE POINTER THINGS that must be overloaded and/or modified""" def _hook_pointer_tensor_methods(self, tensor_type): """Add hooked version of all methods of the tensor_type to the Pointer tensor: instead of performing the native tensor method, it will be se...
stack_v2_sparse_classes_36k_train_001533
4,576
permissive
[ { "docstring": "Add hooked version of all methods of the tensor_type to the Pointer tensor: instead of performing the native tensor method, it will be sent remotely to the location the pointer is pointing at.", "name": "_hook_pointer_tensor_methods", "signature": "def _hook_pointer_tensor_methods(self, ...
5
null
Implement the Python class `PointerHook` described below. Class description: Hook for ALL THE POINTER THINGS that must be overloaded and/or modified Method signatures and docstrings: - def _hook_pointer_tensor_methods(self, tensor_type): Add hooked version of all methods of the tensor_type to the Pointer tensor: inst...
Implement the Python class `PointerHook` described below. Class description: Hook for ALL THE POINTER THINGS that must be overloaded and/or modified Method signatures and docstrings: - def _hook_pointer_tensor_methods(self, tensor_type): Add hooked version of all methods of the tensor_type to the Pointer tensor: inst...
cc4765bed880ad38a02505834f63df39e0815328
<|skeleton|> class PointerHook: """Hook for ALL THE POINTER THINGS that must be overloaded and/or modified""" def _hook_pointer_tensor_methods(self, tensor_type): """Add hooked version of all methods of the tensor_type to the Pointer tensor: instead of performing the native tensor method, it will be se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PointerHook: """Hook for ALL THE POINTER THINGS that must be overloaded and/or modified""" def _hook_pointer_tensor_methods(self, tensor_type): """Add hooked version of all methods of the tensor_type to the Pointer tensor: instead of performing the native tensor method, it will be sent remotely t...
the_stack_v2_python_sparse
syft/generic/frameworks/hook/pointers.py
tudorcebere/PySyft
train
2
f7ceb9584c3f20fc0339fa3c5894df48f103387f
[ "apply_patch(self.request, save=False, src=self.request.validated['tender_src'])\nif all([i.auctionPeriod and i.auctionPeriod.endDate for i in self.request.validated['tender'].lots if i.status == 'active']):\n configurator = self.request.content_configurator\n add_next_awards(self.request, reverse=configurato...
<|body_start_0|> apply_patch(self.request, save=False, src=self.request.validated['tender_src']) if all([i.auctionPeriod and i.auctionPeriod.endDate for i in self.request.validated['tender'].lots if i.status == 'active']): configurator = self.request.content_configurator add_next...
Auctions resouce
TenderAuctionResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TenderAuctionResource: """Auctions resouce""" def collection_post(self): """Report auction results. Report auction results ----------------------""" <|body_0|> def patch(self): """Set urls for access to auction for lot.""" <|body_1|> def post(self): ...
stack_v2_sparse_classes_36k_train_001534
3,529
permissive
[ { "docstring": "Report auction results. Report auction results ----------------------", "name": "collection_post", "signature": "def collection_post(self)" }, { "docstring": "Set urls for access to auction for lot.", "name": "patch", "signature": "def patch(self)" }, { "docstring...
3
stack_v2_sparse_classes_30k_train_008227
Implement the Python class `TenderAuctionResource` described below. Class description: Auctions resouce Method signatures and docstrings: - def collection_post(self): Report auction results. Report auction results ---------------------- - def patch(self): Set urls for access to auction for lot. - def post(self): Repo...
Implement the Python class `TenderAuctionResource` described below. Class description: Auctions resouce Method signatures and docstrings: - def collection_post(self): Report auction results. Report auction results ---------------------- - def patch(self): Set urls for access to auction for lot. - def post(self): Repo...
5afdd3a62a8e562cf77e2d963d88f1a26613d16a
<|skeleton|> class TenderAuctionResource: """Auctions resouce""" def collection_post(self): """Report auction results. Report auction results ----------------------""" <|body_0|> def patch(self): """Set urls for access to auction for lot.""" <|body_1|> def post(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TenderAuctionResource: """Auctions resouce""" def collection_post(self): """Report auction results. Report auction results ----------------------""" apply_patch(self.request, save=False, src=self.request.validated['tender_src']) if all([i.auctionPeriod and i.auctionPeriod.endDate ...
the_stack_v2_python_sparse
src/openprocurement/tender/cfaua/views/auction.py
pontostroy/api
train
0
44597edfb77c5122191b344429c6d006fa72212e
[ "super().__init__(name='CP2K_INPUT', subsections={})\nself.structure = structure\nself.charge = structure.charge\nself.potential_and_basis = potential_and_basis\nself.multiplicity = multiplicity\nself.override_default_params = override_default_params\nself.project_name = project_name\nself.kwargs = kwargs\nfor s in...
<|body_start_0|> super().__init__(name='CP2K_INPUT', subsections={}) self.structure = structure self.charge = structure.charge self.potential_and_basis = potential_and_basis self.multiplicity = multiplicity self.override_default_params = override_default_params se...
The basic representation of a CP2K input set as a collection of "sections" defining the simulation connected to a structure object. At the most basis level, CP2K requires a &GLOBAL section and &FORCE_EVAL section. Global sets parameters like "RUN_TYPE" or the overall verbosity. FORCE_EVAL is the largest section usually...
Cp2kInputSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cp2kInputSet: """The basic representation of a CP2K input set as a collection of "sections" defining the simulation connected to a structure object. At the most basis level, CP2K requires a &GLOBAL section and &FORCE_EVAL section. Global sets parameters like "RUN_TYPE" or the overall verbosity. F...
stack_v2_sparse_classes_36k_train_001535
48,942
permissive
[ { "docstring": "Args: structure: (Structure or Molecule) pymatgen structure or molecule object used to define the lattice, coordinates, and elements. This structure object cannot contain \"special\" species like the Dummy species, e.g. X, or fractional occupations, e.g. Fe0.2, etc. potential_and_basis: (dict) S...
4
stack_v2_sparse_classes_30k_train_004457
Implement the Python class `Cp2kInputSet` described below. Class description: The basic representation of a CP2K input set as a collection of "sections" defining the simulation connected to a structure object. At the most basis level, CP2K requires a &GLOBAL section and &FORCE_EVAL section. Global sets parameters like...
Implement the Python class `Cp2kInputSet` described below. Class description: The basic representation of a CP2K input set as a collection of "sections" defining the simulation connected to a structure object. At the most basis level, CP2K requires a &GLOBAL section and &FORCE_EVAL section. Global sets parameters like...
6dd3b42f569397fa1a86a16fcfaaa29534abb8ca
<|skeleton|> class Cp2kInputSet: """The basic representation of a CP2K input set as a collection of "sections" defining the simulation connected to a structure object. At the most basis level, CP2K requires a &GLOBAL section and &FORCE_EVAL section. Global sets parameters like "RUN_TYPE" or the overall verbosity. F...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cp2kInputSet: """The basic representation of a CP2K input set as a collection of "sections" defining the simulation connected to a structure object. At the most basis level, CP2K requires a &GLOBAL section and &FORCE_EVAL section. Global sets parameters like "RUN_TYPE" or the overall verbosity. FORCE_EVAL is ...
the_stack_v2_python_sparse
pymatgen/io/cp2k/sets.py
Zhuoying/pymatgen
train
2
d9807e1f9ca01f971e6ef85b3cffc89ccd0b6ce5
[ "self.title = None\nself.title_font_size = 10\nself.plots = [PlotData(self)]\nself.columns = columns\nself.rows = rows", "if self.title is not None:\n plt.title(self.title)\nfor index, cur_plot in enumerate(self.plots):\n plot = figure.add_subplot(self.rows, self.columns, index + 1)\n cur_plot.pyplot_vis...
<|body_start_0|> self.title = None self.title_font_size = 10 self.plots = [PlotData(self)] self.columns = columns self.rows = rows <|end_body_0|> <|body_start_1|> if self.title is not None: plt.title(self.title) for index, cur_plot in enumerate(self.p...
Defines the complete data set of a figure consisting of one or more plots
FigureData
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FigureData: """Defines the complete data set of a figure consisting of one or more plots""" def __init__(self, columns=1, rows=1): """Initializer :param columns: The number of columns :param rows: The number of rows""" <|body_0|> def pyplot_visualize(self, figure): ...
stack_v2_sparse_classes_36k_train_001536
2,008
permissive
[ { "docstring": "Initializer :param columns: The number of columns :param rows: The number of rows", "name": "__init__", "signature": "def __init__(self, columns=1, rows=1)" }, { "docstring": "Visualizes the figure :param figure: The pyplot figure", "name": "pyplot_visualize", "signature"...
2
stack_v2_sparse_classes_30k_train_006018
Implement the Python class `FigureData` described below. Class description: Defines the complete data set of a figure consisting of one or more plots Method signatures and docstrings: - def __init__(self, columns=1, rows=1): Initializer :param columns: The number of columns :param rows: The number of rows - def pyplo...
Implement the Python class `FigureData` described below. Class description: Defines the complete data set of a figure consisting of one or more plots Method signatures and docstrings: - def __init__(self, columns=1, rows=1): Initializer :param columns: The number of columns :param rows: The number of rows - def pyplo...
e27b53e8e9eedc48abc99151f3adbb76f0a9b331
<|skeleton|> class FigureData: """Defines the complete data set of a figure consisting of one or more plots""" def __init__(self, columns=1, rows=1): """Initializer :param columns: The number of columns :param rows: The number of rows""" <|body_0|> def pyplot_visualize(self, figure): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FigureData: """Defines the complete data set of a figure consisting of one or more plots""" def __init__(self, columns=1, rows=1): """Initializer :param columns: The number of columns :param rows: The number of rows""" self.title = None self.title_font_size = 10 self.plots...
the_stack_v2_python_sparse
kaivy/plots/figure_data.py
team-kaivy/kaivy
train
0
8fbe4b7520dbaf572c59d6f73b8f0a4537583b6f
[ "self.V = V\nself.num_param = num_param\nself.step = step\nif init_param.size == 0:\n self.init_param = np.zeros(num_param)\nelse:\n self.init_param = init_param\nself.max_iter = max_iter\nself.tol = tol\nself.report_data = []\nself.quad_conv = True\nself.grad = 0", "b = FullMatrix(self.num_param, 1)\nif pa...
<|body_start_0|> self.V = V self.num_param = num_param self.step = step if init_param.size == 0: self.init_param = np.zeros(num_param) else: self.init_param = init_param self.max_iter = max_iter self.tol = tol self.report_data = [] ...
An instance is a representation of the Quasi-Newton minimization problem.
QNM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QNM: """An instance is a representation of the Quasi-Newton minimization problem.""" def __init__(self, V, num_param, init_param=np.empty(0), tol=10 ** (-7), step=np.float(10 ** (-7)), max_iter=10 ** 2): """V: Objective Function [python function which takes a np.ndarray as an input a...
stack_v2_sparse_classes_36k_train_001537
3,785
no_license
[ { "docstring": "V: Objective Function [python function which takes a np.ndarray as an input and returns a float] num_param: Number of paramters [int] init_param: Initial guess of parameters [np.ndarray] tol: Tolerance [float] step: Step size for calculating derivatives [np.float64] max_iter: Number of maximum i...
6
null
Implement the Python class `QNM` described below. Class description: An instance is a representation of the Quasi-Newton minimization problem. Method signatures and docstrings: - def __init__(self, V, num_param, init_param=np.empty(0), tol=10 ** (-7), step=np.float(10 ** (-7)), max_iter=10 ** 2): V: Objective Functio...
Implement the Python class `QNM` described below. Class description: An instance is a representation of the Quasi-Newton minimization problem. Method signatures and docstrings: - def __init__(self, V, num_param, init_param=np.empty(0), tol=10 ** (-7), step=np.float(10 ** (-7)), max_iter=10 ** 2): V: Objective Functio...
7439f25c7809f4198e452f70ae4269447873f7db
<|skeleton|> class QNM: """An instance is a representation of the Quasi-Newton minimization problem.""" def __init__(self, V, num_param, init_param=np.empty(0), tol=10 ** (-7), step=np.float(10 ** (-7)), max_iter=10 ** 2): """V: Objective Function [python function which takes a np.ndarray as an input a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QNM: """An instance is a representation of the Quasi-Newton minimization problem.""" def __init__(self, V, num_param, init_param=np.empty(0), tol=10 ** (-7), step=np.float(10 ** (-7)), max_iter=10 ** 2): """V: Objective Function [python function which takes a np.ndarray as an input and returns a ...
the_stack_v2_python_sparse
PA3/quasi_newton_min.py
ta275/Scientific-Computing-in-Python
train
0
b751186e072b41eaa4a4d57ebaa6fe20be4b4161
[ "url = reverse(self.list_url)\nresponse = self.client.get(url)\nself.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)\nself.assertNotIn('results', response.data)\nself.assertIn('detail', response.data)\nself.assertEqual(response.data['detail'], STR_401_MESSAGE)", "user = self.template_users['staff_...
<|body_start_0|> url = reverse(self.list_url) response = self.client.get(url) self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) self.assertNotIn('results', response.data) self.assertIn('detail', response.data) self.assertEqual(response.data['detail'], S...
BasicReadApiTestCaseRunMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicReadApiTestCaseRunMixin: def test_list_anonymous(self): """Anonymous user should NOT be able to list""" <|body_0|> def test_list_staff_user(self): """Staff user should be able to list EVERY object""" <|body_1|> def test_detail_anonymous(self): ...
stack_v2_sparse_classes_36k_train_001538
9,174
permissive
[ { "docstring": "Anonymous user should NOT be able to list", "name": "test_list_anonymous", "signature": "def test_list_anonymous(self)" }, { "docstring": "Staff user should be able to list EVERY object", "name": "test_list_staff_user", "signature": "def test_list_staff_user(self)" }, ...
4
null
Implement the Python class `BasicReadApiTestCaseRunMixin` described below. Class description: Implement the BasicReadApiTestCaseRunMixin class. Method signatures and docstrings: - def test_list_anonymous(self): Anonymous user should NOT be able to list - def test_list_staff_user(self): Staff user should be able to li...
Implement the Python class `BasicReadApiTestCaseRunMixin` described below. Class description: Implement the BasicReadApiTestCaseRunMixin class. Method signatures and docstrings: - def test_list_anonymous(self): Anonymous user should NOT be able to list - def test_list_staff_user(self): Staff user should be able to li...
9baa530f2f3405322f74ccc145641148f253341b
<|skeleton|> class BasicReadApiTestCaseRunMixin: def test_list_anonymous(self): """Anonymous user should NOT be able to list""" <|body_0|> def test_list_staff_user(self): """Staff user should be able to list EVERY object""" <|body_1|> def test_detail_anonymous(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasicReadApiTestCaseRunMixin: def test_list_anonymous(self): """Anonymous user should NOT be able to list""" url = reverse(self.list_url) response = self.client.get(url) self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) self.assertNotIn('results', res...
the_stack_v2_python_sparse
palvelutori/test_mixins.py
City-of-Turku/munpalvelut_backend
train
0
c2daa60062af0f947ca5adcfb6c793504d0d9f42
[ "login_page.LoginPage(self.driver).login()\nsleep(2)\nlandlord_nav_page.LandlordNavPage(self.driver).Iamlandlord()\nsleep(2)\nlandlord_nav_page.LandlordNavPage(self.driver).close_weiChat()\nsleep(2)\nlandlord_nav_page.LandlordNavPage(self.driver).microshopmanager()\npo = landlord_microshopmanager_page.LandlordMicro...
<|body_start_0|> login_page.LoginPage(self.driver).login() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).Iamlandlord() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).close_weiChat() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).microsh...
房东微店
TestMicroshopManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMicroshopManager: """房东微店""" def test_edit_weidian(self): """编辑微店,更改微店名称和微店介绍""" <|body_0|> def test_view_again(self): """查看房东说明""" <|body_1|> <|end_skeleton|> <|body_start_0|> login_page.LoginPage(self.driver).login() sleep(2) ...
stack_v2_sparse_classes_36k_train_001539
1,748
permissive
[ { "docstring": "编辑微店,更改微店名称和微店介绍", "name": "test_edit_weidian", "signature": "def test_edit_weidian(self)" }, { "docstring": "查看房东说明", "name": "test_view_again", "signature": "def test_view_again(self)" } ]
2
stack_v2_sparse_classes_30k_train_017658
Implement the Python class `TestMicroshopManager` described below. Class description: 房东微店 Method signatures and docstrings: - def test_edit_weidian(self): 编辑微店,更改微店名称和微店介绍 - def test_view_again(self): 查看房东说明
Implement the Python class `TestMicroshopManager` described below. Class description: 房东微店 Method signatures and docstrings: - def test_edit_weidian(self): 编辑微店,更改微店名称和微店介绍 - def test_view_again(self): 查看房东说明 <|skeleton|> class TestMicroshopManager: """房东微店""" def test_edit_weidian(self): """编辑微店,更改...
192c70c49a8e9e072b9d0d0136f02c653c589410
<|skeleton|> class TestMicroshopManager: """房东微店""" def test_edit_weidian(self): """编辑微店,更改微店名称和微店介绍""" <|body_0|> def test_view_again(self): """查看房东说明""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestMicroshopManager: """房东微店""" def test_edit_weidian(self): """编辑微店,更改微店名称和微店介绍""" login_page.LoginPage(self.driver).login() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).Iamlandlord() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).clos...
the_stack_v2_python_sparse
mayi/test_case/test_landlord_microshopmanager.py
18701016443/mayi
train
0
ae214b5ea2107f11399ec116af749a09cf22f958
[ "searchtemplate = SearchTemplate.query.get(searchtemplate_id)\nif not searchtemplate:\n abort(HTTP_STATUS_CODE_NOT_FOUND, 'Search template was not found')\nreturn self.to_json(searchtemplate)", "searchtemplate = SearchTemplate.query.get(searchtemplate_id)\nif not searchtemplate:\n abort(HTTP_STATUS_CODE_NOT...
<|body_start_0|> searchtemplate = SearchTemplate.query.get(searchtemplate_id) if not searchtemplate: abort(HTTP_STATUS_CODE_NOT_FOUND, 'Search template was not found') return self.to_json(searchtemplate) <|end_body_0|> <|body_start_1|> searchtemplate = SearchTemplate.query.g...
Resource to get a search template.
SearchTemplateResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchTemplateResource: """Resource to get a search template.""" def get(self, searchtemplate_id): """Handles GET request to the resource. Args: searchtemplate_id: Primary key for a search template database model Returns: Search template in JSON (instance of flask.wrappers.Response)"...
stack_v2_sparse_classes_36k_train_001540
7,889
permissive
[ { "docstring": "Handles GET request to the resource. Args: searchtemplate_id: Primary key for a search template database model Returns: Search template in JSON (instance of flask.wrappers.Response)", "name": "get", "signature": "def get(self, searchtemplate_id)" }, { "docstring": "Handles DELETE...
2
stack_v2_sparse_classes_30k_train_001660
Implement the Python class `SearchTemplateResource` described below. Class description: Resource to get a search template. Method signatures and docstrings: - def get(self, searchtemplate_id): Handles GET request to the resource. Args: searchtemplate_id: Primary key for a search template database model Returns: Searc...
Implement the Python class `SearchTemplateResource` described below. Class description: Resource to get a search template. Method signatures and docstrings: - def get(self, searchtemplate_id): Handles GET request to the resource. Args: searchtemplate_id: Primary key for a search template database model Returns: Searc...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class SearchTemplateResource: """Resource to get a search template.""" def get(self, searchtemplate_id): """Handles GET request to the resource. Args: searchtemplate_id: Primary key for a search template database model Returns: Search template in JSON (instance of flask.wrappers.Response)"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SearchTemplateResource: """Resource to get a search template.""" def get(self, searchtemplate_id): """Handles GET request to the resource. Args: searchtemplate_id: Primary key for a search template database model Returns: Search template in JSON (instance of flask.wrappers.Response)""" se...
the_stack_v2_python_sparse
timesketch/api/v1/resources/searchtemplate.py
google/timesketch
train
2,263
d3e05bf52fa25a894ec6c6e64cf351197e4d4898
[ "nums = [str(i) for i in nums]\ncomp = lambda a, b: 1 if a + b > b + a else -1 if a + b < b + a else 0\nnums.sort(key=functools.cmp_to_key(comp), reverse=True)\nif nums and nums[0] == '0':\n return '0'\nreturn ''.join(nums)", "nums = [str(x) for x in nums]\nlongest = max([len(x) for x in nums], default=0)\narr...
<|body_start_0|> nums = [str(i) for i in nums] comp = lambda a, b: 1 if a + b > b + a else -1 if a + b < b + a else 0 nums.sort(key=functools.cmp_to_key(comp), reverse=True) if nums and nums[0] == '0': return '0' return ''.join(nums) <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestNumber(self, nums): """:type nums: List[int] :rtype: str""" <|body_0|> def largestNumber2(self, nums): """:type nums: List[int] :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> nums = [str(i) for i in nums] co...
stack_v2_sparse_classes_36k_train_001541
1,068
no_license
[ { "docstring": ":type nums: List[int] :rtype: str", "name": "largestNumber", "signature": "def largestNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: str", "name": "largestNumber2", "signature": "def largestNumber2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_019073
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestNumber(self, nums): :type nums: List[int] :rtype: str - def largestNumber2(self, nums): :type nums: List[int] :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestNumber(self, nums): :type nums: List[int] :rtype: str - def largestNumber2(self, nums): :type nums: List[int] :rtype: str <|skeleton|> class Solution: def larges...
0fc4c7af59246e3064db41989a45d9db413a624b
<|skeleton|> class Solution: def largestNumber(self, nums): """:type nums: List[int] :rtype: str""" <|body_0|> def largestNumber2(self, nums): """:type nums: List[int] :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestNumber(self, nums): """:type nums: List[int] :rtype: str""" nums = [str(i) for i in nums] comp = lambda a, b: 1 if a + b > b + a else -1 if a + b < b + a else 0 nums.sort(key=functools.cmp_to_key(comp), reverse=True) if nums and nums[0] == '0': ...
the_stack_v2_python_sparse
179. Largest Number/largest.py
Macielyoung/LeetCode
train
1
206824568a0a155303ffc99e08954bbd0f041f68
[ "y = np.array(y)\nif len(y.shape) == 2 and y.shape[1] > 1:\n self.classes_ = np.arange(y.shape[1])\nelif len(y.shape) == 2 and y.shape[1] == 1 or len(y.shape) == 1:\n self.classes_ = np.unique(y)\n y = np.searchsorted(self.classes_, y)\nelse:\n raise ValueError('Invalid shape for y: ' + str(y.shape))\ns...
<|body_start_0|> y = np.array(y) if len(y.shape) == 2 and y.shape[1] > 1: self.classes_ = np.arange(y.shape[1]) elif len(y.shape) == 2 and y.shape[1] == 1 or len(y.shape) == 1: self.classes_ = np.unique(y) y = np.searchsorted(self.classes_, y) else: ...
Implementation of the scikit-learn classifier API for Keras.
KerasClassifier
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KerasClassifier: """Implementation of the scikit-learn classifier API for Keras.""" def fit(self, x, y, **kwargs): """Constructs a new model with `build_fn` & fit the model to `(x, y)`. Arguments: x : array-like, shape `(n_samples, n_features)` Training samples where n_samples in the...
stack_v2_sparse_classes_36k_train_001542
12,728
permissive
[ { "docstring": "Constructs a new model with `build_fn` & fit the model to `(x, y)`. Arguments: x : array-like, shape `(n_samples, n_features)` Training samples where n_samples in the number of samples and n_features is the number of features. y : array-like, shape `(n_samples,)` or `(n_samples, n_outputs)` True...
4
stack_v2_sparse_classes_30k_train_002344
Implement the Python class `KerasClassifier` described below. Class description: Implementation of the scikit-learn classifier API for Keras. Method signatures and docstrings: - def fit(self, x, y, **kwargs): Constructs a new model with `build_fn` & fit the model to `(x, y)`. Arguments: x : array-like, shape `(n_samp...
Implement the Python class `KerasClassifier` described below. Class description: Implementation of the scikit-learn classifier API for Keras. Method signatures and docstrings: - def fit(self, x, y, **kwargs): Constructs a new model with `build_fn` & fit the model to `(x, y)`. Arguments: x : array-like, shape `(n_samp...
cabf6e4f1970dc14302f87414f170de19944bac2
<|skeleton|> class KerasClassifier: """Implementation of the scikit-learn classifier API for Keras.""" def fit(self, x, y, **kwargs): """Constructs a new model with `build_fn` & fit the model to `(x, y)`. Arguments: x : array-like, shape `(n_samples, n_features)` Training samples where n_samples in the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KerasClassifier: """Implementation of the scikit-learn classifier API for Keras.""" def fit(self, x, y, **kwargs): """Constructs a new model with `build_fn` & fit the model to `(x, y)`. Arguments: x : array-like, shape `(n_samples, n_features)` Training samples where n_samples in the number of sa...
the_stack_v2_python_sparse
Tensorflow_Pandas_Numpy/source3.6/tensorflow/python/keras/_impl/keras/wrappers/scikit_learn.py
ryfeus/lambda-packs
train
1,283
f014d651f639d342e5587e92b3d442a9e8f5047a
[ "response = super(EntryProtectionMixin, self).get(request, *args, **kwargs)\nif self.object.login_required and (not request.user.is_authenticated):\n return self.login()\nif self.object.password and self.object.password != self.request.session.get(self.session_key % self.object.pk):\n return self.password()\n...
<|body_start_0|> response = super(EntryProtectionMixin, self).get(request, *args, **kwargs) if self.object.login_required and (not request.user.is_authenticated): return self.login() if self.object.password and self.object.password != self.request.session.get(self.session_key % self....
Mixin returning a login view if the current entry need authentication and password view if the entry is protected by a password.
EntryProtectionMixin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntryProtectionMixin: """Mixin returning a login view if the current entry need authentication and password view if the entry is protected by a password.""" def get(self, request, *args, **kwargs): """Do the login and password protection.""" <|body_0|> def post(self, req...
stack_v2_sparse_classes_36k_train_001543
2,280
permissive
[ { "docstring": "Do the login and password protection.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Do the login and password protection.", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_017982
Implement the Python class `EntryProtectionMixin` described below. Class description: Mixin returning a login view if the current entry need authentication and password view if the entry is protected by a password. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Do the login and password ...
Implement the Python class `EntryProtectionMixin` described below. Class description: Mixin returning a login view if the current entry need authentication and password view if the entry is protected by a password. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Do the login and password ...
0f625237c6712156daa1f6d38055ea98b8bc7a1d
<|skeleton|> class EntryProtectionMixin: """Mixin returning a login view if the current entry need authentication and password view if the entry is protected by a password.""" def get(self, request, *args, **kwargs): """Do the login and password protection.""" <|body_0|> def post(self, req...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EntryProtectionMixin: """Mixin returning a login view if the current entry need authentication and password view if the entry is protected by a password.""" def get(self, request, *args, **kwargs): """Do the login and password protection.""" response = super(EntryProtectionMixin, self).ge...
the_stack_v2_python_sparse
zinnia/views/mixins/entry_protection.py
jplehmann/django-blog-zinnia
train
1
6474087094ba9cce14ca77a0deae4e3c985ec8ba
[ "structure_klifs_ids = [structure_klifs_id]\nviewer = cls._from_structure_klifs_ids(structure_klifs_ids, klifs_session)\nreturn viewer", "if feature_name in self._fingerprint.physicochemical:\n data = fingerprint.physicochemical[feature_name]\n data.index = fingerprint.residue_ids\n data.index = data.ind...
<|body_start_0|> structure_klifs_ids = [structure_klifs_id] viewer = cls._from_structure_klifs_ids(structure_klifs_ids, klifs_session) return viewer <|end_body_0|> <|body_start_1|> if feature_name in self._fingerprint.physicochemical: data = fingerprint.physicochemical[featu...
View a structure's fingerprint in 3D. Attributes ---------- Inherited from kissim.viewer.base._BaseViewer
StructureViewer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StructureViewer: """View a structure's fingerprint in 3D. Attributes ---------- Inherited from kissim.viewer.base._BaseViewer""" def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None): """Initialize viewer from structure KLIFS ID: Generate fingerprint and fetch stru...
stack_v2_sparse_classes_36k_train_001544
2,492
permissive
[ { "docstring": "Initialize viewer from structure KLIFS ID: Generate fingerprint and fetch structure in PDB format.", "name": "from_structure_klifs_id", "signature": "def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None)" }, { "docstring": "Map feature values using color on res...
2
stack_v2_sparse_classes_30k_train_006271
Implement the Python class `StructureViewer` described below. Class description: View a structure's fingerprint in 3D. Attributes ---------- Inherited from kissim.viewer.base._BaseViewer Method signatures and docstrings: - def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None): Initialize viewer fro...
Implement the Python class `StructureViewer` described below. Class description: View a structure's fingerprint in 3D. Attributes ---------- Inherited from kissim.viewer.base._BaseViewer Method signatures and docstrings: - def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None): Initialize viewer fro...
8433bb64062ed785503b96b52f39bbdb02f66381
<|skeleton|> class StructureViewer: """View a structure's fingerprint in 3D. Attributes ---------- Inherited from kissim.viewer.base._BaseViewer""" def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None): """Initialize viewer from structure KLIFS ID: Generate fingerprint and fetch stru...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StructureViewer: """View a structure's fingerprint in 3D. Attributes ---------- Inherited from kissim.viewer.base._BaseViewer""" def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None): """Initialize viewer from structure KLIFS ID: Generate fingerprint and fetch structure in PDB ...
the_stack_v2_python_sparse
kissim/viewer/structure.py
volkamerlab/kissim
train
26
02e594295d5e51cbe86844b04df342034b05d7e1
[ "Filter.__init__(self)\nap = KWArgsProcessor(self, kwargs)\nap.add('verbosity', default=0)\nap.add('evalfunc', default=lambda output, target: -Validator.MSE(output, target))\nap.add('wtRatio', default=array([1, 2], float))\nself.network = evolino_network\nself.dataset = dataset\nself.max_fitness = -Infinity", "nu...
<|body_start_0|> Filter.__init__(self) ap = KWArgsProcessor(self, kwargs) ap.add('verbosity', default=0) ap.add('evalfunc', default=lambda output, target: -Validator.MSE(output, target)) ap.add('wtRatio', default=array([1, 2], float)) self.network = evolino_network ...
Evaluate all individuals of the Evolino population, and store their fitness value inside the population.
EvolinoEvaluation
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EvolinoEvaluation: """Evaluate all individuals of the Evolino population, and store their fitness value inside the population.""" def __init__(self, evolino_network, dataset, **kwargs): """:key evolino_network: an instance of NetworkWrapper() :key dataset: The evaluation dataset :key...
stack_v2_sparse_classes_36k_train_001545
9,839
permissive
[ { "docstring": ":key evolino_network: an instance of NetworkWrapper() :key dataset: The evaluation dataset :key evalfunc: Compares output to target values and returns a scalar, denoting the fitness. Defaults to -mse(output, target). :key wtRatio: Float array of two values denoting the ratio between washout and ...
3
stack_v2_sparse_classes_30k_train_013092
Implement the Python class `EvolinoEvaluation` described below. Class description: Evaluate all individuals of the Evolino population, and store their fitness value inside the population. Method signatures and docstrings: - def __init__(self, evolino_network, dataset, **kwargs): :key evolino_network: an instance of N...
Implement the Python class `EvolinoEvaluation` described below. Class description: Evaluate all individuals of the Evolino population, and store their fitness value inside the population. Method signatures and docstrings: - def __init__(self, evolino_network, dataset, **kwargs): :key evolino_network: an instance of N...
33ead60704d126e58c10d458ddd1e5e5fd17b65d
<|skeleton|> class EvolinoEvaluation: """Evaluate all individuals of the Evolino population, and store their fitness value inside the population.""" def __init__(self, evolino_network, dataset, **kwargs): """:key evolino_network: an instance of NetworkWrapper() :key dataset: The evaluation dataset :key...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EvolinoEvaluation: """Evaluate all individuals of the Evolino population, and store their fitness value inside the population.""" def __init__(self, evolino_network, dataset, **kwargs): """:key evolino_network: an instance of NetworkWrapper() :key dataset: The evaluation dataset :key evalfunc: Co...
the_stack_v2_python_sparse
pybrain/supervised/evolino/filter.py
pybrain2/pybrain2
train
14
b934c2c3ec76eb2917f0d7fdb706d993f6fc35c5
[ "if self.cleaned_data['job2_product'] and self.cleaned_data['job2_qty'] is None:\n raise forms.ValidationError('Enter a quantity.')\nelse:\n return self.cleaned_data['job2_qty']", "if self.cleaned_data['job3_product'] and self.cleaned_data['job3_qty'] is None:\n raise forms.ValidationError('Enter a quant...
<|body_start_0|> if self.cleaned_data['job2_product'] and self.cleaned_data['job2_qty'] is None: raise forms.ValidationError('Enter a quantity.') else: return self.cleaned_data['job2_qty'] <|end_body_0|> <|body_start_1|> if self.cleaned_data['job3_product'] and self.clea...
Form for adding a FastOrder. Data we need to get from user: due_date*, org*, ship_to*, po_number, additional_info,products + quantities (at least one required). All other fields of the Order model are either not relevant, or can by filled in dynamically.
FastOrderForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FastOrderForm: """Form for adding a FastOrder. Data we need to get from user: due_date*, org*, ship_to*, po_number, additional_info,products + quantities (at least one required). All other fields of the Order model are either not relevant, or can by filled in dynamically.""" def clean_job2_q...
stack_v2_sparse_classes_36k_train_001546
7,430
no_license
[ { "docstring": "If a product is selected for job 2, we also need a quantity.", "name": "clean_job2_qty", "signature": "def clean_job2_qty(self)" }, { "docstring": "If a product is selected for job 3, we also need a quantity.", "name": "clean_job3_qty", "signature": "def clean_job3_qty(se...
4
stack_v2_sparse_classes_30k_train_014438
Implement the Python class `FastOrderForm` described below. Class description: Form for adding a FastOrder. Data we need to get from user: due_date*, org*, ship_to*, po_number, additional_info,products + quantities (at least one required). All other fields of the Order model are either not relevant, or can by filled i...
Implement the Python class `FastOrderForm` described below. Class description: Form for adding a FastOrder. Data we need to get from user: due_date*, org*, ship_to*, po_number, additional_info,products + quantities (at least one required). All other fields of the Order model are either not relevant, or can by filled i...
e0b127868d5d2a0b36adaf4e229771d8b7f9bab2
<|skeleton|> class FastOrderForm: """Form for adding a FastOrder. Data we need to get from user: due_date*, org*, ship_to*, po_number, additional_info,products + quantities (at least one required). All other fields of the Order model are either not relevant, or can by filled in dynamically.""" def clean_job2_q...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FastOrderForm: """Form for adding a FastOrder. Data we need to get from user: due_date*, org*, ship_to*, po_number, additional_info,products + quantities (at least one required). All other fields of the Order model are either not relevant, or can by filled in dynamically.""" def clean_job2_qty(self): ...
the_stack_v2_python_sparse
orders/forms.py
MorrisonIO/mimic
train
1
08aee8ec490b4e9910278eb8764bec683d1af6af
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
RoutingServiceServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoutingServiceServicer: """Missing associated documentation comment in .proto file.""" def QueryOriginalStation(self, request, context): """查询起始工作站""" <|body_0|> def QueryNextStation(self, request, context): """查询下一个工作站""" <|body_1|> def QueryRouting...
stack_v2_sparse_classes_36k_train_001547
7,347
no_license
[ { "docstring": "查询起始工作站", "name": "QueryOriginalStation", "signature": "def QueryOriginalStation(self, request, context)" }, { "docstring": "查询下一个工作站", "name": "QueryNextStation", "signature": "def QueryNextStation(self, request, context)" }, { "docstring": "查询工艺路径", "name": ...
4
stack_v2_sparse_classes_30k_train_010896
Implement the Python class `RoutingServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def QueryOriginalStation(self, request, context): 查询起始工作站 - def QueryNextStation(self, request, context): 查询下一个工作站 - def QueryRoutingChai...
Implement the Python class `RoutingServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def QueryOriginalStation(self, request, context): 查询起始工作站 - def QueryNextStation(self, request, context): 查询下一个工作站 - def QueryRoutingChai...
0f6fe31a27de9bcf0697c28574b97555fe36d1e1
<|skeleton|> class RoutingServiceServicer: """Missing associated documentation comment in .proto file.""" def QueryOriginalStation(self, request, context): """查询起始工作站""" <|body_0|> def QueryNextStation(self, request, context): """查询下一个工作站""" <|body_1|> def QueryRouting...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RoutingServiceServicer: """Missing associated documentation comment in .proto file.""" def QueryOriginalStation(self, request, context): """查询起始工作站""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('...
the_stack_v2_python_sparse
lib/grpc/wesrpc/warebasic/routing_pb2_grpc.py
cming091/autotest
train
0
af88b08826fccb2da328d682b689f6f85bd54b71
[ "self._fixtures_ep = data['_links']['fixtures']['href']\nself._players_ep = data['_links']['players']['href']\nself.id = int(data['_links']['self']['href'].split('/')[-1])\nself.name = data['name']\nself.code = data['code']\nself.short_name = data['shortName']\nself.market_value = data['squadMarketValue']\nself.cre...
<|body_start_0|> self._fixtures_ep = data['_links']['fixtures']['href'] self._players_ep = data['_links']['players']['href'] self.id = int(data['_links']['self']['href'].split('/')[-1]) self.name = data['name'] self.code = data['code'] self.short_name = data['shortName'] ...
Team
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Team: def __init__(self, data): """Takes a dict converted from the JSON response by the API and wraps the team data within an object. :param data: The team data from the API's response. :type data: dict""" <|body_0|> def get_fixtures(self): """Return a list of Fixtur...
stack_v2_sparse_classes_36k_train_001548
1,940
permissive
[ { "docstring": "Takes a dict converted from the JSON response by the API and wraps the team data within an object. :param data: The team data from the API's response. :type data: dict", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "Return a list of Fixture object...
3
stack_v2_sparse_classes_30k_train_014997
Implement the Python class `Team` described below. Class description: Implement the Team class. Method signatures and docstrings: - def __init__(self, data): Takes a dict converted from the JSON response by the API and wraps the team data within an object. :param data: The team data from the API's response. :type dat...
Implement the Python class `Team` described below. Class description: Implement the Team class. Method signatures and docstrings: - def __init__(self, data): Takes a dict converted from the JSON response by the API and wraps the team data within an object. :param data: The team data from the API's response. :type dat...
22ed081720c52ef58ec4d1b9ddeb0bf4542a03b4
<|skeleton|> class Team: def __init__(self, data): """Takes a dict converted from the JSON response by the API and wraps the team data within an object. :param data: The team data from the API's response. :type data: dict""" <|body_0|> def get_fixtures(self): """Return a list of Fixtur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Team: def __init__(self, data): """Takes a dict converted from the JSON response by the API and wraps the team data within an object. :param data: The team data from the API's response. :type data: dict""" self._fixtures_ep = data['_links']['fixtures']['href'] self._players_ep = data['...
the_stack_v2_python_sparse
pyfootball/models/team.py
timorthi/pyfootball
train
7
c5990096f3b4ed3aabb1da476f06adc2f1488199
[ "self._imalist = []\nilist = axe_asciidata.open(inlist)\nfor item in ilist[0]:\n if not os.path.isfile(getSIMDATA(item)):\n error_message = '\\nDid not find image: ' + str(getSIMDATA(item)) + ' !!'\n raise aXeSIMError(error_message)\n self._imalist.append(ArtImage(getSIMDATA(item.strip())))", ...
<|body_start_0|> self._imalist = [] ilist = axe_asciidata.open(inlist) for item in ilist[0]: if not os.path.isfile(getSIMDATA(item)): error_message = '\nDid not find image: ' + str(getSIMDATA(item)) + ' !!' raise aXeSIMError(error_message) ...
Class for the image list
ArtImaList
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArtImaList: """Class for the image list""" def __init__(self, inlist): """Initializer for the class @param inlist: name of list with the fits images @type inlist: string""" <|body_0|> def tofits(self, fitsname, indata_copy=0): """Converts and stores the spectra i...
stack_v2_sparse_classes_36k_train_001549
6,339
permissive
[ { "docstring": "Initializer for the class @param inlist: name of list with the fits images @type inlist: string", "name": "__init__", "signature": "def __init__(self, inlist)" }, { "docstring": "Converts and stores the spectra in a fits file Converts all images stored in the class instance to a ...
2
null
Implement the Python class `ArtImaList` described below. Class description: Class for the image list Method signatures and docstrings: - def __init__(self, inlist): Initializer for the class @param inlist: name of list with the fits images @type inlist: string - def tofits(self, fitsname, indata_copy=0): Converts and...
Implement the Python class `ArtImaList` described below. Class description: Class for the image list Method signatures and docstrings: - def __init__(self, inlist): Initializer for the class @param inlist: name of list with the fits images @type inlist: string - def tofits(self, fitsname, indata_copy=0): Converts and...
043c173fd5497c18c2b1bfe8bcff65180bca3996
<|skeleton|> class ArtImaList: """Class for the image list""" def __init__(self, inlist): """Initializer for the class @param inlist: name of list with the fits images @type inlist: string""" <|body_0|> def tofits(self, fitsname, indata_copy=0): """Converts and stores the spectra i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArtImaList: """Class for the image list""" def __init__(self, inlist): """Initializer for the class @param inlist: name of list with the fits images @type inlist: string""" self._imalist = [] ilist = axe_asciidata.open(inlist) for item in ilist[0]: if not os.pa...
the_stack_v2_python_sparse
stsdas/pkg/analysis/slitless/axe/axesrc/templateimages.py
spacetelescope/stsdas_stripped
train
1
c6013f131a6b3e35cb594c75e7cd391dcc7d983f
[ "user = self.get_user(request, username)\ncards = Card.objects.filter(user=user).order_by('order')\nif user == request.user:\n form_action = reverse('flashcards')\nelse:\n form_action = reverse('user_flashcards', args=[user.username])\nform = CardForm()\nreturn render(request, 'flashcards.html', dict(cards=ca...
<|body_start_0|> user = self.get_user(request, username) cards = Card.objects.filter(user=user).order_by('order') if user == request.user: form_action = reverse('flashcards') else: form_action = reverse('user_flashcards', args=[user.username]) form = CardF...
FlashcardsView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlashcardsView: def get(self, request, username=None): """Get form.""" <|body_0|> def post(self, request, username=None): """Form submit.""" <|body_1|> def delete(self, request, pk, username=None): """Delete the flashcard.""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_001550
30,576
permissive
[ { "docstring": "Get form.", "name": "get", "signature": "def get(self, request, username=None)" }, { "docstring": "Form submit.", "name": "post", "signature": "def post(self, request, username=None)" }, { "docstring": "Delete the flashcard.", "name": "delete", "signature"...
3
stack_v2_sparse_classes_30k_train_012922
Implement the Python class `FlashcardsView` described below. Class description: Implement the FlashcardsView class. Method signatures and docstrings: - def get(self, request, username=None): Get form. - def post(self, request, username=None): Form submit. - def delete(self, request, pk, username=None): Delete the fla...
Implement the Python class `FlashcardsView` described below. Class description: Implement the FlashcardsView class. Method signatures and docstrings: - def get(self, request, username=None): Get form. - def post(self, request, username=None): Form submit. - def delete(self, request, pk, username=None): Delete the fla...
51a2ae2b29ae5c91a3cf7171f89edf225cc8a6f0
<|skeleton|> class FlashcardsView: def get(self, request, username=None): """Get form.""" <|body_0|> def post(self, request, username=None): """Form submit.""" <|body_1|> def delete(self, request, pk, username=None): """Delete the flashcard.""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FlashcardsView: def get(self, request, username=None): """Get form.""" user = self.get_user(request, username) cards = Card.objects.filter(user=user).order_by('order') if user == request.user: form_action = reverse('flashcards') else: form_action...
the_stack_v2_python_sparse
tool/views/views.py
mikekeda/tools
train
0
0129f130766d0561669caf1ee58401c880103583
[ "fields = (Subject.name, Term.type, Term.id, Term.day, Term.time_from, Term.time_to, TermSignup.points, TermSignup.reason, TermSignup.reason_accepted, TermSignup.is_assigned)\nres = db.session.query(*fields).join(Term).join(TermGroup).outerjoin(TermSignup).filter(TermGroup.group_id.in_([i.id for i in g.user.groups]...
<|body_start_0|> fields = (Subject.name, Term.type, Term.id, Term.day, Term.time_from, Term.time_to, TermSignup.points, TermSignup.reason, TermSignup.reason_accepted, TermSignup.is_assigned) res = db.session.query(*fields).join(Term).join(TermGroup).outerjoin(TermSignup).filter(TermGroup.group_id.in_([i...
TermSignupAction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TermSignupAction: def get(self): """Returns json in form: { 'subject_terms': [ { "subject_name": "math", "terms_aggregated": [ { 'term_type': 'Exercises', 'terms': [ ... ] } ] }, ... ] }""" <|body_0|> def post(self): """Expects JSON of form: { 'terms_signup': [ { 'te...
stack_v2_sparse_classes_36k_train_001551
8,557
no_license
[ { "docstring": "Returns json in form: { 'subject_terms': [ { \"subject_name\": \"math\", \"terms_aggregated\": [ { 'term_type': 'Exercises', 'terms': [ ... ] } ] }, ... ] }", "name": "get", "signature": "def get(self)" }, { "docstring": "Expects JSON of form: { 'terms_signup': [ { 'term_id': 1, ...
2
stack_v2_sparse_classes_30k_train_008651
Implement the Python class `TermSignupAction` described below. Class description: Implement the TermSignupAction class. Method signatures and docstrings: - def get(self): Returns json in form: { 'subject_terms': [ { "subject_name": "math", "terms_aggregated": [ { 'term_type': 'Exercises', 'terms': [ ... ] } ] }, ... ...
Implement the Python class `TermSignupAction` described below. Class description: Implement the TermSignupAction class. Method signatures and docstrings: - def get(self): Returns json in form: { 'subject_terms': [ { "subject_name": "math", "terms_aggregated": [ { 'term_type': 'Exercises', 'terms': [ ... ] } ] }, ... ...
6495d082da54a135606cf8c8e25d2e6a9b789857
<|skeleton|> class TermSignupAction: def get(self): """Returns json in form: { 'subject_terms': [ { "subject_name": "math", "terms_aggregated": [ { 'term_type': 'Exercises', 'terms': [ ... ] } ] }, ... ] }""" <|body_0|> def post(self): """Expects JSON of form: { 'terms_signup': [ { 'te...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TermSignupAction: def get(self): """Returns json in form: { 'subject_terms': [ { "subject_name": "math", "terms_aggregated": [ { 'term_type': 'Exercises', 'terms': [ ... ] } ] }, ... ] }""" fields = (Subject.name, Term.type, Term.id, Term.day, Term.time_from, Term.time_to, TermSignup.points, T...
the_stack_v2_python_sparse
backend/src/application/views.py
disconnect3d/TermsScheduler
train
1
c1bce218f52678372c242fa2bdade9fdd4d33d68
[ "n = len(s)\ndp = [[0] * n for _ in range(n)]\nans = ''\nfor i in range(n):\n for j in range(i, -1, -1):\n if s[i] == s[j] and (i - j <= 2 or dp[i - 1][j + 1] == 1):\n dp[i][j] = 1\n ans = max(ans, s[j:i + 1], key=len)\nreturn ans", "n = len(s)\nres = ''\n\ndef _helper(s, l, r):\n ...
<|body_start_0|> n = len(s) dp = [[0] * n for _ in range(n)] ans = '' for i in range(n): for j in range(i, -1, -1): if s[i] == s[j] and (i - j <= 2 or dp[i - 1][j + 1] == 1): dp[i][j] = 1 ans = max(ans, s[j:i + 1], key=l...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome_1(self, s: str) -> str: """动态规划: 1. dp[i][j] 表示 s[j:i+1] 是否为回文子串 2. 状态转移方程: - i==j: dp[i][j]=1 - i-j==1 且 s[i]==s[j]: dp[i][j]=1 - i-j>1 且 s[i]==s[j] 且 s[j+1:i] 为回文子串,即 dp[i-1][j+1]==1 时: dp[i][j]=1""" <|body_0|> def longestPalindrome(self, s:...
stack_v2_sparse_classes_36k_train_001552
2,295
no_license
[ { "docstring": "动态规划: 1. dp[i][j] 表示 s[j:i+1] 是否为回文子串 2. 状态转移方程: - i==j: dp[i][j]=1 - i-j==1 且 s[i]==s[j]: dp[i][j]=1 - i-j>1 且 s[i]==s[j] 且 s[j+1:i] 为回文子串,即 dp[i-1][j+1]==1 时: dp[i][j]=1", "name": "longestPalindrome_1", "signature": "def longestPalindrome_1(self, s: str) -> str" }, { "docstring...
2
stack_v2_sparse_classes_30k_val_001023
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome_1(self, s: str) -> str: 动态规划: 1. dp[i][j] 表示 s[j:i+1] 是否为回文子串 2. 状态转移方程: - i==j: dp[i][j]=1 - i-j==1 且 s[i]==s[j]: dp[i][j]=1 - i-j>1 且 s[i]==s[j] 且 s[j+1:i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome_1(self, s: str) -> str: 动态规划: 1. dp[i][j] 表示 s[j:i+1] 是否为回文子串 2. 状态转移方程: - i==j: dp[i][j]=1 - i-j==1 且 s[i]==s[j]: dp[i][j]=1 - i-j>1 且 s[i]==s[j] 且 s[j+1:i...
2b7f4a9fefbfd358f8ff31362d60e2007641ca29
<|skeleton|> class Solution: def longestPalindrome_1(self, s: str) -> str: """动态规划: 1. dp[i][j] 表示 s[j:i+1] 是否为回文子串 2. 状态转移方程: - i==j: dp[i][j]=1 - i-j==1 且 s[i]==s[j]: dp[i][j]=1 - i-j>1 且 s[i]==s[j] 且 s[j+1:i] 为回文子串,即 dp[i-1][j+1]==1 时: dp[i][j]=1""" <|body_0|> def longestPalindrome(self, s:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome_1(self, s: str) -> str: """动态规划: 1. dp[i][j] 表示 s[j:i+1] 是否为回文子串 2. 状态转移方程: - i==j: dp[i][j]=1 - i-j==1 且 s[i]==s[j]: dp[i][j]=1 - i-j>1 且 s[i]==s[j] 且 s[j+1:i] 为回文子串,即 dp[i-1][j+1]==1 时: dp[i][j]=1""" n = len(s) dp = [[0] * n for _ in range(n)] ...
the_stack_v2_python_sparse
Week_08/G20190343020242/LeetCode_5_0242.py
algorithm005-class01/algorithm005-class01
train
27
591d658b9b382c729d725aae725eb8ec846731e2
[ "super().__init__()\nself._hidden_dim = 20\nself.fc1 = nn.Linear(obs_dim, self._hidden_dim)\nself.fc2 = nn.Linear(self._hidden_dim, dim_latent)\nself.act = nn.ReLU(inplace=True)", "x = self.act(self.fc1(x))\nx = self.act(self.fc2(x))\nreturn x" ]
<|body_start_0|> super().__init__() self._hidden_dim = 20 self.fc1 = nn.Linear(obs_dim, self._hidden_dim) self.fc2 = nn.Linear(self._hidden_dim, dim_latent) self.act = nn.ReLU(inplace=True) <|end_body_0|> <|body_start_1|> x = self.act(self.fc1(x)) x = self.act(se...
Multi-Layer Perceptron network
MLP
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLP: """Multi-Layer Perceptron network""" def __init__(self, obs_dim, dim_latent): """Constructor Args: obs_dim: (int) dimension of observation latent_dim: (int) dimension of output latent""" <|body_0|> def forward(self, x): """forward method""" <|body_1|...
stack_v2_sparse_classes_36k_train_001553
719
permissive
[ { "docstring": "Constructor Args: obs_dim: (int) dimension of observation latent_dim: (int) dimension of output latent", "name": "__init__", "signature": "def __init__(self, obs_dim, dim_latent)" }, { "docstring": "forward method", "name": "forward", "signature": "def forward(self, x)" ...
2
stack_v2_sparse_classes_30k_train_009921
Implement the Python class `MLP` described below. Class description: Multi-Layer Perceptron network Method signatures and docstrings: - def __init__(self, obs_dim, dim_latent): Constructor Args: obs_dim: (int) dimension of observation latent_dim: (int) dimension of output latent - def forward(self, x): forward method
Implement the Python class `MLP` described below. Class description: Multi-Layer Perceptron network Method signatures and docstrings: - def __init__(self, obs_dim, dim_latent): Constructor Args: obs_dim: (int) dimension of observation latent_dim: (int) dimension of output latent - def forward(self, x): forward method...
3ad344901c3bb59e0bc16bb70202d2cfd538fd77
<|skeleton|> class MLP: """Multi-Layer Perceptron network""" def __init__(self, obs_dim, dim_latent): """Constructor Args: obs_dim: (int) dimension of observation latent_dim: (int) dimension of output latent""" <|body_0|> def forward(self, x): """forward method""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MLP: """Multi-Layer Perceptron network""" def __init__(self, obs_dim, dim_latent): """Constructor Args: obs_dim: (int) dimension of observation latent_dim: (int) dimension of output latent""" super().__init__() self._hidden_dim = 20 self.fc1 = nn.Linear(obs_dim, self._hidd...
the_stack_v2_python_sparse
baselines/common/networks/mlp.py
baihuaxie/drl-lib
train
0
b1b1bcbe87db7590dd2c458be6efb4c38a3a7667
[ "super(INCEPTION_V3_FID, self).__init__()\nself.resize_input = resize_input\nself.output_blocks = sorted(output_blocks)\nself.last_needed_block = max(output_blocks)\nassert self.last_needed_block <= 3, 'Last possible output block index is 3'\nself.blocks = nn.ModuleList()\ninception = models.inception_v3()\nmodel_p...
<|body_start_0|> super(INCEPTION_V3_FID, self).__init__() self.resize_input = resize_input self.output_blocks = sorted(output_blocks) self.last_needed_block = max(output_blocks) assert self.last_needed_block <= 3, 'Last possible output block index is 3' self.blocks = nn.M...
Pretrained InceptionV3 network returning feature maps
INCEPTION_V3_FID
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class INCEPTION_V3_FID: """Pretrained InceptionV3 network returning feature maps""" def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True): """Build pretrained InceptionV3 Parameters ---------- output_blocks : list of int Indices of blocks to return features of. Possibl...
stack_v2_sparse_classes_36k_train_001554
49,823
no_license
[ { "docstring": "Build pretrained InceptionV3 Parameters ---------- output_blocks : list of int Indices of blocks to return features of. Possible values are: - 0: corresponds to output of first max pooling - 1: corresponds to output of second max pooling - 2: corresponds to output which is fed to aux classifier ...
2
stack_v2_sparse_classes_30k_train_011141
Implement the Python class `INCEPTION_V3_FID` described below. Class description: Pretrained InceptionV3 network returning feature maps Method signatures and docstrings: - def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True): Build pretrained InceptionV3 Parameters ---------- output_blocks : lis...
Implement the Python class `INCEPTION_V3_FID` described below. Class description: Pretrained InceptionV3 network returning feature maps Method signatures and docstrings: - def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True): Build pretrained InceptionV3 Parameters ---------- output_blocks : lis...
2862124dca40daebb0aee79c5c36b17b3266a7f6
<|skeleton|> class INCEPTION_V3_FID: """Pretrained InceptionV3 network returning feature maps""" def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True): """Build pretrained InceptionV3 Parameters ---------- output_blocks : list of int Indices of blocks to return features of. Possibl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class INCEPTION_V3_FID: """Pretrained InceptionV3 network returning feature maps""" def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True): """Build pretrained InceptionV3 Parameters ---------- output_blocks : list of int Indices of blocks to return features of. Possible values are:...
the_stack_v2_python_sparse
image_generation/model.py
azadis/Obj-GAN
train
2
cef340a1f51bc3aac9ff6e53654353c6fdc989cc
[ "self._model_updater = ModelUpdater.get_instance()\nself._racer_profiles = racer_profiles\nself._num_of_agents = len(self._racer_profiles)\nself._race_data = race_data\nself._eval_metrics = eval_metrics\nself._run_phase_subject = run_phase_subject\nself._virtual_event_agent_camera_models = virtual_event_agent_camer...
<|body_start_0|> self._model_updater = ModelUpdater.get_instance() self._racer_profiles = racer_profiles self._num_of_agents = len(self._racer_profiles) self._race_data = race_data self._eval_metrics = eval_metrics self._run_phase_subject = run_phase_subject self....
VirtualEventGraphManager class
VirtualEventGraphManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VirtualEventGraphManager: """VirtualEventGraphManager class""" def __init__(self, racer_profiles, race_data, eval_metrics, run_phase_subject, virtual_event_agent_camera_models): """VirtualEventGraphManager constructor Args: racer_profiles (list): list of racer profile object race_dat...
stack_v2_sparse_classes_36k_train_001555
9,816
permissive
[ { "docstring": "VirtualEventGraphManager constructor Args: racer_profiles (list): list of racer profile object race_data (VirtualEventRaceData): VirtualEventRaceData class instance eval_metrics (list): list of EvalMetrics class instance run_phase_subject (RunPhaseSubject): RunPhaseSubject class instance virtual...
5
null
Implement the Python class `VirtualEventGraphManager` described below. Class description: VirtualEventGraphManager class Method signatures and docstrings: - def __init__(self, racer_profiles, race_data, eval_metrics, run_phase_subject, virtual_event_agent_camera_models): VirtualEventGraphManager constructor Args: rac...
Implement the Python class `VirtualEventGraphManager` described below. Class description: VirtualEventGraphManager class Method signatures and docstrings: - def __init__(self, racer_profiles, race_data, eval_metrics, run_phase_subject, virtual_event_agent_camera_models): VirtualEventGraphManager constructor Args: rac...
2ce50508dd4100eaef7f8729436549a801505705
<|skeleton|> class VirtualEventGraphManager: """VirtualEventGraphManager class""" def __init__(self, racer_profiles, race_data, eval_metrics, run_phase_subject, virtual_event_agent_camera_models): """VirtualEventGraphManager constructor Args: racer_profiles (list): list of racer profile object race_dat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VirtualEventGraphManager: """VirtualEventGraphManager class""" def __init__(self, racer_profiles, race_data, eval_metrics, run_phase_subject, virtual_event_agent_camera_models): """VirtualEventGraphManager constructor Args: racer_profiles (list): list of racer profile object race_data (VirtualEve...
the_stack_v2_python_sparse
bundle/markov/virtual_event/virtual_event_graph_manager.py
aws-deepracer-community/deepracer-simapp
train
83
1f2ac86cd151c5dcf97453c05072a242af38e12b
[ "ticker = pero.LogTicker(base=2, major_count=7)\nticker(start=1.1, end=900.0)\nticks = ticker.major_ticks()\nself.assertEqual(ticks, (2, 4, 8, 16, 32, 64, 128, 256, 512))\nticker(start=1, end=900.0)\nticks = ticker.major_ticks()\nself.assertEqual(ticks, (1, 2, 4, 8, 16, 32, 64, 128, 256, 512))\nticker(start=0.1, en...
<|body_start_0|> ticker = pero.LogTicker(base=2, major_count=7) ticker(start=1.1, end=900.0) ticks = ticker.major_ticks() self.assertEqual(ticks, (2, 4, 8, 16, 32, 64, 128, 256, 512)) ticker(start=1, end=900.0) ticks = ticker.major_ticks() self.assertEqual(ticks, ...
Test case for logarithmic ticker with base 2.
TestCase
[ "LicenseRef-scancode-philippe-de-muyter", "LicenseRef-scancode-commercial-license", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCase: """Test case for logarithmic ticker with base 2.""" def test_major_ticks(self): """Tests whether major ticks are generated works correctly.""" <|body_0|> def test_minor_ticks(self): """Tests whether minor ticks are generated correctly.""" <|body...
stack_v2_sparse_classes_36k_train_001556
3,579
permissive
[ { "docstring": "Tests whether major ticks are generated works correctly.", "name": "test_major_ticks", "signature": "def test_major_ticks(self)" }, { "docstring": "Tests whether minor ticks are generated correctly.", "name": "test_minor_ticks", "signature": "def test_minor_ticks(self)" ...
3
null
Implement the Python class `TestCase` described below. Class description: Test case for logarithmic ticker with base 2. Method signatures and docstrings: - def test_major_ticks(self): Tests whether major ticks are generated works correctly. - def test_minor_ticks(self): Tests whether minor ticks are generated correct...
Implement the Python class `TestCase` described below. Class description: Test case for logarithmic ticker with base 2. Method signatures and docstrings: - def test_major_ticks(self): Tests whether major ticks are generated works correctly. - def test_minor_ticks(self): Tests whether minor ticks are generated correct...
d59b1bc056f3037b7b7ab635b6deb41120612965
<|skeleton|> class TestCase: """Test case for logarithmic ticker with base 2.""" def test_major_ticks(self): """Tests whether major ticks are generated works correctly.""" <|body_0|> def test_minor_ticks(self): """Tests whether minor ticks are generated correctly.""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCase: """Test case for logarithmic ticker with base 2.""" def test_major_ticks(self): """Tests whether major ticks are generated works correctly.""" ticker = pero.LogTicker(base=2, major_count=7) ticker(start=1.1, end=900.0) ticks = ticker.major_ticks() self.as...
the_stack_v2_python_sparse
unittests/tickers/test_log2.py
xxao/pero
train
31
e84bea0b08cf407b80e620c16efdebd4de6ac888
[ "start = datetime.now()\ncount_users_in_db = User.objects.count()\ngenerator_users = GeneratorUsers(count_models_in_db=count_users_in_db)\ngenerated_users = generator_users.generate()\nUser.objects.bulk_create(generated_users)\nusers = User.objects.filter(employee=None).filter(is_superuser=False)\nGenerator.create_...
<|body_start_0|> start = datetime.now() count_users_in_db = User.objects.count() generator_users = GeneratorUsers(count_models_in_db=count_users_in_db) generated_users = generator_users.generate() User.objects.bulk_create(generated_users) users = User.objects.filter(emplo...
Generator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generator: def create_random_users(): """Генерирует случайно сгенерированных пользователей в БД""" <|body_0|> def create_employee(users): """Создает случайного сотрудника по users в БД""" <|body_1|> def create_dependencies_employee(): """Создает ...
stack_v2_sparse_classes_36k_train_001557
4,382
no_license
[ { "docstring": "Генерирует случайно сгенерированных пользователей в БД", "name": "create_random_users", "signature": "def create_random_users()" }, { "docstring": "Создает случайного сотрудника по users в БД", "name": "create_employee", "signature": "def create_employee(users)" }, { ...
6
stack_v2_sparse_classes_30k_train_007982
Implement the Python class `Generator` described below. Class description: Implement the Generator class. Method signatures and docstrings: - def create_random_users(): Генерирует случайно сгенерированных пользователей в БД - def create_employee(users): Создает случайного сотрудника по users в БД - def create_depende...
Implement the Python class `Generator` described below. Class description: Implement the Generator class. Method signatures and docstrings: - def create_random_users(): Генерирует случайно сгенерированных пользователей в БД - def create_employee(users): Создает случайного сотрудника по users в БД - def create_depende...
f4155105f22cfeec976cf2f18ad2a4df57bcb4a2
<|skeleton|> class Generator: def create_random_users(): """Генерирует случайно сгенерированных пользователей в БД""" <|body_0|> def create_employee(users): """Создает случайного сотрудника по users в БД""" <|body_1|> def create_dependencies_employee(): """Создает ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Generator: def create_random_users(): """Генерирует случайно сгенерированных пользователей в БД""" start = datetime.now() count_users_in_db = User.objects.count() generator_users = GeneratorUsers(count_models_in_db=count_users_in_db) generated_users = generator_users.ge...
the_stack_v2_python_sparse
staff_tree/apps/staff/generator.py
RedPowDan/staff_tree
train
0
f2674c59d076454d41b1499abb16c0505beaa9c1
[ "self.time = time\nself.name = name\nself._text = None\nself._position = None\nself._class_name = None", "if self._text:\n return Tag(time=self.time, text=self._text, position=self._position, class_name=self._class_name)\nreturn None" ]
<|body_start_0|> self.time = time self.name = name self._text = None self._position = None self._class_name = None <|end_body_0|> <|body_start_1|> if self._text: return Tag(time=self.time, text=self._text, position=self._position, class_name=self._class_name)...
The base class of an event.
EventData
[ "BSD-3-Clause", "BSD-1-Clause", "LicenseRef-scancode-bsd-x11", "LicenseRef-scancode-other-permissive" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventData: """The base class of an event.""" def __init__(self, time, name): """Initializes an EventData. @param time: A string for event time. @param name: A string for event name.""" <|body_0|> def GetTag(self): """Gets the tag for this event. @returns: A Tag o...
stack_v2_sparse_classes_36k_train_001558
17,308
permissive
[ { "docstring": "Initializes an EventData. @param time: A string for event time. @param name: A string for event name.", "name": "__init__", "signature": "def __init__(self, time, name)" }, { "docstring": "Gets the tag for this event. @returns: A Tag object. Returns None if no need to show tag.",...
2
stack_v2_sparse_classes_30k_train_017426
Implement the Python class `EventData` described below. Class description: The base class of an event. Method signatures and docstrings: - def __init__(self, time, name): Initializes an EventData. @param time: A string for event time. @param name: A string for event name. - def GetTag(self): Gets the tag for this eve...
Implement the Python class `EventData` described below. Class description: The base class of an event. Method signatures and docstrings: - def __init__(self, time, name): Initializes an EventData. @param time: A string for event time. @param name: A string for event name. - def GetTag(self): Gets the tag for this eve...
2ba7bcea4f9d9715cbb1c4e69271f7b185a0786e
<|skeleton|> class EventData: """The base class of an event.""" def __init__(self, time, name): """Initializes an EventData. @param time: A string for event time. @param name: A string for event name.""" <|body_0|> def GetTag(self): """Gets the tag for this event. @returns: A Tag o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventData: """The base class of an event.""" def __init__(self, time, name): """Initializes an EventData. @param time: A string for event time. @param name: A string for event name.""" self.time = time self.name = name self._text = None self._position = None ...
the_stack_v2_python_sparse
external/adhd/scripts/audio_thread_log_viewer/viewer_c3.py
dongdong331/test
train
2
e2500b794eb346bfb53f078459620f1812e6e165
[ "last_occurrence = dict()\nfor index, char in enumerate(string):\n last_occurrence[char] = index\npartitions = []\nleft = right = 0\nfor index, char in enumerate(string):\n right = max(right, last_occurrence[char])\n if index == right:\n partitions.append(index - left + 1)\n left = index + 1\...
<|body_start_0|> last_occurrence = dict() for index, char in enumerate(string): last_occurrence[char] = index partitions = [] left = right = 0 for index, char in enumerate(string): right = max(right, last_occurrence[char]) if index == right: ...
Labels
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Labels: def all_partition_labels_(self, string: str) -> List[int]: """Approach: Two Pointers / Greedy Time Complexity: O(N) Space Complexity: O(1) :param string: :return:""" <|body_0|> def all_partition_labels(self, string: str) -> List[int]: """Approach: Two Pointer...
stack_v2_sparse_classes_36k_train_001559
2,301
no_license
[ { "docstring": "Approach: Two Pointers / Greedy Time Complexity: O(N) Space Complexity: O(1) :param string: :return:", "name": "all_partition_labels_", "signature": "def all_partition_labels_(self, string: str) -> List[int]" }, { "docstring": "Approach: Two Pointers / Greedy Time Complexity: O(N...
2
null
Implement the Python class `Labels` described below. Class description: Implement the Labels class. Method signatures and docstrings: - def all_partition_labels_(self, string: str) -> List[int]: Approach: Two Pointers / Greedy Time Complexity: O(N) Space Complexity: O(1) :param string: :return: - def all_partition_la...
Implement the Python class `Labels` described below. Class description: Implement the Labels class. Method signatures and docstrings: - def all_partition_labels_(self, string: str) -> List[int]: Approach: Two Pointers / Greedy Time Complexity: O(N) Space Complexity: O(1) :param string: :return: - def all_partition_la...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Labels: def all_partition_labels_(self, string: str) -> List[int]: """Approach: Two Pointers / Greedy Time Complexity: O(N) Space Complexity: O(1) :param string: :return:""" <|body_0|> def all_partition_labels(self, string: str) -> List[int]: """Approach: Two Pointer...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Labels: def all_partition_labels_(self, string: str) -> List[int]: """Approach: Two Pointers / Greedy Time Complexity: O(N) Space Complexity: O(1) :param string: :return:""" last_occurrence = dict() for index, char in enumerate(string): last_occurrence[char] = index ...
the_stack_v2_python_sparse
amazon/greedy_or_two_pointers/partition_labels.py
Shiv2157k/leet_code
train
1
acb34716021ba2a1b4d79985539ae1771e605516
[ "super().__init__()\nself.s_dim = obs_dim\nself.a_dim = act_dim\nself._log_std_min = log_std_min\nself._log_std_max = log_std_max\nself.net = tf.keras.Sequential([tf.keras.layers.InputLayer(dtype=tf.float32, input_shape=self.s_dim, name='input')])\nfor i, hidden_size_i in enumerate(hidden_sizes):\n self.net.add(...
<|body_start_0|> super().__init__() self.s_dim = obs_dim self.a_dim = act_dim self._log_std_min = log_std_min self._log_std_max = log_std_max self.net = tf.keras.Sequential([tf.keras.layers.InputLayer(dtype=tf.float32, input_shape=self.s_dim, name='input')]) for i...
The squashed gaussian actor network. Attributes: net (torch.nn.modules.container.Sequential): The input/hidden layers of the network. mu (torch.nn.modules.linear.Linear): The output layer which returns the mean of the actions. log_sigma (torch.nn.modules.linear.Linear): The output layer which returns the log standard d...
SquashedGaussianActor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SquashedGaussianActor: """The squashed gaussian actor network. Attributes: net (torch.nn.modules.container.Sequential): The input/hidden layers of the network. mu (torch.nn.modules.linear.Linear): The output layer which returns the mean of the actions. log_sigma (torch.nn.modules.linear.Linear): ...
stack_v2_sparse_classes_36k_train_001560
4,775
no_license
[ { "docstring": "Constructs all the necessary attributes for the Squashed Gaussian Actor object. Args: obs_dim (int): The dimension of the observation space. act_dim (int): The dimension of the action space. hidden_sizes (list): Array containing the sizes of the hidden layers. log_std_min (int, optional): The mi...
2
stack_v2_sparse_classes_30k_train_008096
Implement the Python class `SquashedGaussianActor` described below. Class description: The squashed gaussian actor network. Attributes: net (torch.nn.modules.container.Sequential): The input/hidden layers of the network. mu (torch.nn.modules.linear.Linear): The output layer which returns the mean of the actions. log_s...
Implement the Python class `SquashedGaussianActor` described below. Class description: The squashed gaussian actor network. Attributes: net (torch.nn.modules.container.Sequential): The input/hidden layers of the network. mu (torch.nn.modules.linear.Linear): The output layer which returns the mean of the actions. log_s...
7828af7b44f54b0d9ed8a7bd11dd0dd4738a3d2e
<|skeleton|> class SquashedGaussianActor: """The squashed gaussian actor network. Attributes: net (torch.nn.modules.container.Sequential): The input/hidden layers of the network. mu (torch.nn.modules.linear.Linear): The output layer which returns the mean of the actions. log_sigma (torch.nn.modules.linear.Linear): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SquashedGaussianActor: """The squashed gaussian actor network. Attributes: net (torch.nn.modules.container.Sequential): The input/hidden layers of the network. mu (torch.nn.modules.linear.Linear): The output layer which returns the mean of the actions. log_sigma (torch.nn.modules.linear.Linear): The output la...
the_stack_v2_python_sparse
sandbox/speed_comparison/timeit_comparison/gaussian_actor_tf2.py
rickstaa/LAC-TF2-TORCH-translation
train
0
0bb3f99bd00d4dd913c9ad807c8ba7313258fcd2
[ "if picking.state in ('cancel', 'done'):\n return True\nif picking.state in ('draft', 'confirmed', 'assigned'):\n self.validate_picking(cr, uid, [picking.id], context=context)\n return True\nreturn False", "if picking.state == '2binvoiced':\n invoice_ids = self.action_invoice_create(cr, uid, [picking....
<|body_start_0|> if picking.state in ('cancel', 'done'): return True if picking.state in ('draft', 'confirmed', 'assigned'): self.validate_picking(cr, uid, [picking.id], context=context) return True return False <|end_body_0|> <|body_start_1|> if pick...
stock_picking
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class stock_picking: def auto_wkf_validate(self, cr, uid, picking, context=None): """Interface method for the automatic worflow. Validate a picking in draft, confirmed or assigned state. :param browse_record picking: the picking to validate :return: True if the picking have been confirmed, Fal...
stack_v2_sparse_classes_36k_train_001561
15,477
no_license
[ { "docstring": "Interface method for the automatic worflow. Validate a picking in draft, confirmed or assigned state. :param browse_record picking: the picking to validate :return: True if the picking have been confirmed, False if not", "name": "auto_wkf_validate", "signature": "def auto_wkf_validate(se...
2
null
Implement the Python class `stock_picking` described below. Class description: Implement the stock_picking class. Method signatures and docstrings: - def auto_wkf_validate(self, cr, uid, picking, context=None): Interface method for the automatic worflow. Validate a picking in draft, confirmed or assigned state. :para...
Implement the Python class `stock_picking` described below. Class description: Implement the stock_picking class. Method signatures and docstrings: - def auto_wkf_validate(self, cr, uid, picking, context=None): Interface method for the automatic worflow. Validate a picking in draft, confirmed or assigned state. :para...
73c8a29a182460e6a8f7a97bbc15f1847dbdd63e
<|skeleton|> class stock_picking: def auto_wkf_validate(self, cr, uid, picking, context=None): """Interface method for the automatic worflow. Validate a picking in draft, confirmed or assigned state. :param browse_record picking: the picking to validate :return: True if the picking have been confirmed, Fal...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class stock_picking: def auto_wkf_validate(self, cr, uid, picking, context=None): """Interface method for the automatic worflow. Validate a picking in draft, confirmed or assigned state. :param browse_record picking: the picking to validate :return: True if the picking have been confirmed, False if not""" ...
the_stack_v2_python_sparse
base_sale_multichannels/workflow_job.py
GoContractPro/Odoo-GCP
train
1
8ea2ac8be3b1468ab9ca5fa52d6240db355dc9be
[ "self.x_angle = random.random() * math.pi\nself.y_angle = random.random() * math.pi\nself.z_angle = random.random() * math.pi\nself.name = f'[X = {self.x_angle}, Y = {self.y_angle}, Z = {self.z_angle}]'", "Rx(self.x_angle) | qubit\nRy(self.y_angle) | qubit\nRz(self.z_angle) | qubit" ]
<|body_start_0|> self.x_angle = random.random() * math.pi self.y_angle = random.random() * math.pi self.z_angle = random.random() * math.pi self.name = f'[X = {self.x_angle}, Y = {self.y_angle}, Z = {self.z_angle}]' <|end_body_0|> <|body_start_1|> Rx(self.x_angle) | qubit ...
This class represents a test case that rotates the qubit around all three axes of the Bloch sphere by random angles between 0 and pi.
RandomRotationTestState
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomRotationTestState: """This class represents a test case that rotates the qubit around all three axes of the Bloch sphere by random angles between 0 and pi.""" def __init__(self): """Creates a RandomRotationTestState instance.""" <|body_0|> def prepare_state(self, q...
stack_v2_sparse_classes_36k_train_001562
6,176
permissive
[ { "docstring": "Creates a RandomRotationTestState instance.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Prepares a qubit in the test state. Parameters: qubit (Qureg): The qubit to prepare in the test state", "name": "prepare_state", "signature": "def prepar...
2
stack_v2_sparse_classes_30k_train_000773
Implement the Python class `RandomRotationTestState` described below. Class description: This class represents a test case that rotates the qubit around all three axes of the Bloch sphere by random angles between 0 and pi. Method signatures and docstrings: - def __init__(self): Creates a RandomRotationTestState insta...
Implement the Python class `RandomRotationTestState` described below. Class description: This class represents a test case that rotates the qubit around all three axes of the Bloch sphere by random angles between 0 and pi. Method signatures and docstrings: - def __init__(self): Creates a RandomRotationTestState insta...
941488f8f8a81a4b7d7fe28414ce14fa478a692a
<|skeleton|> class RandomRotationTestState: """This class represents a test case that rotates the qubit around all three axes of the Bloch sphere by random angles between 0 and pi.""" def __init__(self): """Creates a RandomRotationTestState instance.""" <|body_0|> def prepare_state(self, q...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomRotationTestState: """This class represents a test case that rotates the qubit around all three axes of the Bloch sphere by random angles between 0 and pi.""" def __init__(self): """Creates a RandomRotationTestState instance.""" self.x_angle = random.random() * math.pi self....
the_stack_v2_python_sparse
ProjectQ/ProjectQErrorCorrection/ecc_test_implementation.py
taibah/qsfe
train
0
a22529ec7eb4a121cb1ab05979cddee8ba06a557
[ "super(AdamWeightDecayOptimizer, self).__init__(False, name)\nself.learning_rate = learning_rate\nself.weight_decay_rate = weight_decday_rate\nself.beta_1 = beta_1\nself.beta_2 = beta_2\nself.epsilon = epsilon\nself.exclude_from_weight_decay = exclude_from_weight_decay", "assignments = []\nfor grad, param in grad...
<|body_start_0|> super(AdamWeightDecayOptimizer, self).__init__(False, name) self.learning_rate = learning_rate self.weight_decay_rate = weight_decday_rate self.beta_1 = beta_1 self.beta_2 = beta_2 self.epsilon = epsilon self.exclude_from_weight_decay = exclude_fr...
A basic Adam optimizer that includes "correct" L2 weight decay.
AdamWeightDecayOptimizer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decday_rate=0.0, beta_1=0.0, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer'): """Constructs a AdamWei...
stack_v2_sparse_classes_36k_train_001563
5,841
no_license
[ { "docstring": "Constructs a AdamWeightDecayOptimizer.", "name": "__init__", "signature": "def __init__(self, learning_rate, weight_decday_rate=0.0, beta_1=0.0, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer')" }, { "docstring": "See base class.", ...
4
null
Implement the Python class `AdamWeightDecayOptimizer` described below. Class description: A basic Adam optimizer that includes "correct" L2 weight decay. Method signatures and docstrings: - def __init__(self, learning_rate, weight_decday_rate=0.0, beta_1=0.0, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=Non...
Implement the Python class `AdamWeightDecayOptimizer` described below. Class description: A basic Adam optimizer that includes "correct" L2 weight decay. Method signatures and docstrings: - def __init__(self, learning_rate, weight_decday_rate=0.0, beta_1=0.0, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=Non...
e7997850ec74223b9cea036baf0cced43a4fa909
<|skeleton|> class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decday_rate=0.0, beta_1=0.0, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer'): """Constructs a AdamWei...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decday_rate=0.0, beta_1=0.0, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, name='AdamWeightDecayOptimizer'): """Constructs a AdamWeightDecayOptim...
the_stack_v2_python_sparse
LangueModel/BERT/optimization.py
colabnlp/nlp_research
train
0
bc4b9f7f09e5b0a782c24562c25b716cd7a4ac4c
[ "ChapmanEnskogLennardJones.build_lennard_jones_parameters(cobj)\nif not hasattr(cobj, 'viscosity_collision_integral_callback'):\n cobj.viscosity_collision_integral_callback = collision_integral_neufeld_callback", "units = b.params.get_metadata().derived_units\nT = pyunits.convert(T, to_units=pyunits.K)\nsigma ...
<|body_start_0|> ChapmanEnskogLennardJones.build_lennard_jones_parameters(cobj) if not hasattr(cobj, 'viscosity_collision_integral_callback'): cobj.viscosity_collision_integral_callback = collision_integral_neufeld_callback <|end_body_0|> <|body_start_1|> units = b.params.get_metada...
Implementation of pure component dynamic viscosity from Chapman Enskog Theory
visc_d_phase_comp
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class visc_d_phase_comp: """Implementation of pure component dynamic viscosity from Chapman Enskog Theory""" def build_parameters(cobj, p): """Build Lennard Jones parameters and add callback for viscosity collision integral""" <|body_0|> def return_expression(b, cobj, p, T): ...
stack_v2_sparse_classes_36k_train_001564
4,502
permissive
[ { "docstring": "Build Lennard Jones parameters and add callback for viscosity collision integral", "name": "build_parameters", "signature": "def build_parameters(cobj, p)" }, { "docstring": "Return expression for visc_d_phase_comp", "name": "return_expression", "signature": "def return_e...
2
null
Implement the Python class `visc_d_phase_comp` described below. Class description: Implementation of pure component dynamic viscosity from Chapman Enskog Theory Method signatures and docstrings: - def build_parameters(cobj, p): Build Lennard Jones parameters and add callback for viscosity collision integral - def ret...
Implement the Python class `visc_d_phase_comp` described below. Class description: Implementation of pure component dynamic viscosity from Chapman Enskog Theory Method signatures and docstrings: - def build_parameters(cobj, p): Build Lennard Jones parameters and add callback for viscosity collision integral - def ret...
deacf4c422bc9e50cb347e11a8cbfa0195bd4274
<|skeleton|> class visc_d_phase_comp: """Implementation of pure component dynamic viscosity from Chapman Enskog Theory""" def build_parameters(cobj, p): """Build Lennard Jones parameters and add callback for viscosity collision integral""" <|body_0|> def return_expression(b, cobj, p, T): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class visc_d_phase_comp: """Implementation of pure component dynamic viscosity from Chapman Enskog Theory""" def build_parameters(cobj, p): """Build Lennard Jones parameters and add callback for viscosity collision integral""" ChapmanEnskogLennardJones.build_lennard_jones_parameters(cobj) ...
the_stack_v2_python_sparse
idaes/models/properties/modular_properties/pure/ChapmanEnskog.py
IDAES/idaes-pse
train
173
5f1f77d04e13021596fb23648679ce89135f94d4
[ "self._row = row\nself._col = col\nself._graph = [[] for _ in range(row)]\nself._rowMatching = [-1] * row\nself._colMatching = [-1] * col\nself._matchingEdges: Optional[List[Tuple[int, int]]] = None", "assert 0 <= u < self._row\nassert 0 <= v < self._col\nself._graph[u].append(v)", "def dfs(cur: int) -> bool:\n...
<|body_start_0|> self._row = row self._col = col self._graph = [[] for _ in range(row)] self._rowMatching = [-1] * row self._colMatching = [-1] * col self._matchingEdges: Optional[List[Tuple[int, int]]] = None <|end_body_0|> <|body_start_1|> assert 0 <= u < self....
Hungarian
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Hungarian: def __init__(self, row: int, col: int): """匈牙利算法求无权二分图最大匹配 时间复杂度O(V * E) Args: row (int): 男孩的个数 col (int): 女孩的个数""" <|body_0|> def addEdge(self, u: int, v: int) -> None: """男孩u和女孩v连边""" <|body_1|> def work(self) -> int: """返回最大匹配的个数"""...
stack_v2_sparse_classes_36k_train_001565
3,835
no_license
[ { "docstring": "匈牙利算法求无权二分图最大匹配 时间复杂度O(V * E) Args: row (int): 男孩的个数 col (int): 女孩的个数", "name": "__init__", "signature": "def __init__(self, row: int, col: int)" }, { "docstring": "男孩u和女孩v连边", "name": "addEdge", "signature": "def addEdge(self, u: int, v: int) -> None" }, { "docst...
4
null
Implement the Python class `Hungarian` described below. Class description: Implement the Hungarian class. Method signatures and docstrings: - def __init__(self, row: int, col: int): 匈牙利算法求无权二分图最大匹配 时间复杂度O(V * E) Args: row (int): 男孩的个数 col (int): 女孩的个数 - def addEdge(self, u: int, v: int) -> None: 男孩u和女孩v连边 - def work(...
Implement the Python class `Hungarian` described below. Class description: Implement the Hungarian class. Method signatures and docstrings: - def __init__(self, row: int, col: int): 匈牙利算法求无权二分图最大匹配 时间复杂度O(V * E) Args: row (int): 男孩的个数 col (int): 女孩的个数 - def addEdge(self, u: int, v: int) -> None: 男孩u和女孩v连边 - def work(...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Hungarian: def __init__(self, row: int, col: int): """匈牙利算法求无权二分图最大匹配 时间复杂度O(V * E) Args: row (int): 男孩的个数 col (int): 女孩的个数""" <|body_0|> def addEdge(self, u: int, v: int) -> None: """男孩u和女孩v连边""" <|body_1|> def work(self) -> int: """返回最大匹配的个数"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Hungarian: def __init__(self, row: int, col: int): """匈牙利算法求无权二分图最大匹配 时间复杂度O(V * E) Args: row (int): 男孩的个数 col (int): 女孩的个数""" self._row = row self._col = col self._graph = [[] for _ in range(row)] self._rowMatching = [-1] * row self._colMatching = [-1] * col ...
the_stack_v2_python_sparse
7_graph/二分图/acwing习题/hungarian.py
981377660LMT/algorithm-study
train
225
0f6f3f57c41d38cb9d7ccbe427991bb6b656616b
[ "super(MapBox, self).__init__(format_string=format_string, scheme=scheme, timeout=timeout, proxies=proxies, user_agent=user_agent, ssl_context=ssl_context)\nself.api_key = api_key\nself.domain = domain.strip('/')\nself.api = '%s://%s%s' % (self.scheme, self.domain, self.api_path)", "features = json['features']\ni...
<|body_start_0|> super(MapBox, self).__init__(format_string=format_string, scheme=scheme, timeout=timeout, proxies=proxies, user_agent=user_agent, ssl_context=ssl_context) self.api_key = api_key self.domain = domain.strip('/') self.api = '%s://%s%s' % (self.scheme, self.domain, self.api_...
Geocoder using the Mapbox API. Documentation at: https://www.mapbox.com/api-documentation/ .. versionadded:: 1.17.0
MapBox
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MapBox: """Geocoder using the Mapbox API. Documentation at: https://www.mapbox.com/api-documentation/ .. versionadded:: 1.17.0""" def __init__(self, api_key, format_string=None, scheme=None, timeout=DEFAULT_SENTINEL, proxies=DEFAULT_SENTINEL, user_agent=None, ssl_context=DEFAULT_SENTINEL, do...
stack_v2_sparse_classes_36k_train_001566
6,972
permissive
[ { "docstring": ":param str api_key: The API key required by Mapbox to perform geocoding requests. API keys are managed through Mapox's account page (https://www.mapbox.com/account/access-tokens). :param str format_string: See :attr:`geopy.geocoders.options.default_format_string`. :param str scheme: See :attr:`g...
4
stack_v2_sparse_classes_30k_train_002034
Implement the Python class `MapBox` described below. Class description: Geocoder using the Mapbox API. Documentation at: https://www.mapbox.com/api-documentation/ .. versionadded:: 1.17.0 Method signatures and docstrings: - def __init__(self, api_key, format_string=None, scheme=None, timeout=DEFAULT_SENTINEL, proxies...
Implement the Python class `MapBox` described below. Class description: Geocoder using the Mapbox API. Documentation at: https://www.mapbox.com/api-documentation/ .. versionadded:: 1.17.0 Method signatures and docstrings: - def __init__(self, api_key, format_string=None, scheme=None, timeout=DEFAULT_SENTINEL, proxies...
0c72430da633785fcb14e40d8b007c86081d515d
<|skeleton|> class MapBox: """Geocoder using the Mapbox API. Documentation at: https://www.mapbox.com/api-documentation/ .. versionadded:: 1.17.0""" def __init__(self, api_key, format_string=None, scheme=None, timeout=DEFAULT_SENTINEL, proxies=DEFAULT_SENTINEL, user_agent=None, ssl_context=DEFAULT_SENTINEL, do...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MapBox: """Geocoder using the Mapbox API. Documentation at: https://www.mapbox.com/api-documentation/ .. versionadded:: 1.17.0""" def __init__(self, api_key, format_string=None, scheme=None, timeout=DEFAULT_SENTINEL, proxies=DEFAULT_SENTINEL, user_agent=None, ssl_context=DEFAULT_SENTINEL, domain='api.map...
the_stack_v2_python_sparse
WatchDogs_Visualisation/mainVenv/lib/python3.7/site-packages/geopy/geocoders/mapbox.py
prashanth-thipparthi/WatchDogs_StockMarketAnalysis
train
4
b7c45e3f066cbe69a04cf6d8f39d2f0333fa93c6
[ "if not points:\n return 0\npoints.sort()\narrows = pop_ptr = overlap_ptr = 0\nwhile overlap_ptr < len(points):\n if points[overlap_ptr][0] > points[pop_ptr][-1]:\n pop_ptr = overlap_ptr\n arrows += 1\n points[pop_ptr][-1] = min(points[pop_ptr][-1], points[overlap_ptr][-1])\n overlap_ptr +...
<|body_start_0|> if not points: return 0 points.sort() arrows = pop_ptr = overlap_ptr = 0 while overlap_ptr < len(points): if points[overlap_ptr][0] > points[pop_ptr][-1]: pop_ptr = overlap_ptr arrows += 1 points[pop_ptr...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMinArrowShots(self, points: List[List[int]]) -> int: """------ --- <- make this the new end. ----- ^ | shoot ----- -------- ---------""" <|body_0|> def findMinArrowShots(self, points: List[List[int]]) -> int: """------ --- --------- ------ ---------...
stack_v2_sparse_classes_36k_train_001567
1,580
no_license
[ { "docstring": "------ --- <- make this the new end. ----- ^ | shoot ----- -------- ---------", "name": "findMinArrowShots", "signature": "def findMinArrowShots(self, points: List[List[int]]) -> int" }, { "docstring": "------ --- --------- ------ ----------- ---", "name": "findMinArrowShots"...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinArrowShots(self, points: List[List[int]]) -> int: ------ --- <- make this the new end. ----- ^ | shoot ----- -------- --------- - def findMinArrowShots(self, points: L...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinArrowShots(self, points: List[List[int]]) -> int: ------ --- <- make this the new end. ----- ^ | shoot ----- -------- --------- - def findMinArrowShots(self, points: L...
218a8a97e3926788bb6320dda889bd379083570a
<|skeleton|> class Solution: def findMinArrowShots(self, points: List[List[int]]) -> int: """------ --- <- make this the new end. ----- ^ | shoot ----- -------- ---------""" <|body_0|> def findMinArrowShots(self, points: List[List[int]]) -> int: """------ --- --------- ------ ---------...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMinArrowShots(self, points: List[List[int]]) -> int: """------ --- <- make this the new end. ----- ^ | shoot ----- -------- ---------""" if not points: return 0 points.sort() arrows = pop_ptr = overlap_ptr = 0 while overlap_ptr < len(points...
the_stack_v2_python_sparse
src/452.minimum-number-of-arrows-to-burst-balloons.py
tientheshy/leetcode-solutions
train
0
b5f32f84124af5ab1349b23a8d6ccc05ade5e833
[ "super().__init__()\nself.out_dim = out_dim\nself.num_heads = num_heads\nself.d_k = out_dim // num_heads\nself.k_linear = k_linear\nself.q_linear = q_linear\nself.v_linear = v_linear\nself.w_att = w_att\nself.w_msg = w_msg\nself.mu = mu", "with g.local_scope():\n feat_src, feat_dst = expand_as_pair(feat, g)\n ...
<|body_start_0|> super().__init__() self.out_dim = out_dim self.num_heads = num_heads self.d_k = out_dim // num_heads self.k_linear = k_linear self.q_linear = q_linear self.v_linear = v_linear self.w_att = w_att self.w_msg = w_msg self.mu =...
HGTAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HGTAttention: def __init__(self, out_dim, num_heads, k_linear, q_linear, v_linear, w_att, w_msg, mu): """HGT注意力模块 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param k_linear: nn.Linear(d_in, d_out) :param q_linear: nn.Linear(d_in, d_out) :param v_linear: nn.Linear(d_in, d_out...
stack_v2_sparse_classes_36k_train_001568
8,548
no_license
[ { "docstring": "HGT注意力模块 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param k_linear: nn.Linear(d_in, d_out) :param q_linear: nn.Linear(d_in, d_out) :param v_linear: nn.Linear(d_in, d_out) :param w_att: tensor(K, d_out/K, d_out/K) :param w_msg: tensor(K, d_out/K, d_out/K) :param mu: tensor(1)", ...
2
stack_v2_sparse_classes_30k_train_009176
Implement the Python class `HGTAttention` described below. Class description: Implement the HGTAttention class. Method signatures and docstrings: - def __init__(self, out_dim, num_heads, k_linear, q_linear, v_linear, w_att, w_msg, mu): HGT注意力模块 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param k_linear: ...
Implement the Python class `HGTAttention` described below. Class description: Implement the HGTAttention class. Method signatures and docstrings: - def __init__(self, out_dim, num_heads, k_linear, q_linear, v_linear, w_att, w_msg, mu): HGT注意力模块 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param k_linear: ...
b40071dc9f9fb20f081f4ed4944a7b65de919c18
<|skeleton|> class HGTAttention: def __init__(self, out_dim, num_heads, k_linear, q_linear, v_linear, w_att, w_msg, mu): """HGT注意力模块 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param k_linear: nn.Linear(d_in, d_out) :param q_linear: nn.Linear(d_in, d_out) :param v_linear: nn.Linear(d_in, d_out...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HGTAttention: def __init__(self, out_dim, num_heads, k_linear, q_linear, v_linear, w_att, w_msg, mu): """HGT注意力模块 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param k_linear: nn.Linear(d_in, d_out) :param q_linear: nn.Linear(d_in, d_out) :param v_linear: nn.Linear(d_in, d_out) :param w_att...
the_stack_v2_python_sparse
gnn/hgt/model.py
deepdumbo/pytorch-tutorial-1
train
0
141859457fa78a8eaab25190c403812050348147
[ "self._schema = customer_schema\nself.tracing_id = tracing_id\nwith ProviderDBAccessor(provider_uuid) as provider_accessor:\n self._provider = provider_accessor.get_provider()\ntry:\n self._updater = self._set_updater()\nexcept Exception as err:\n raise CostModelCostUpdaterError(err)", "if self._provider...
<|body_start_0|> self._schema = customer_schema self.tracing_id = tracing_id with ProviderDBAccessor(provider_uuid) as provider_accessor: self._provider = provider_accessor.get_provider() try: self._updater = self._set_updater() except Exception as err: ...
Update reporting summary tables.
CostModelCostUpdater
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CostModelCostUpdater: """Update reporting summary tables.""" def __init__(self, customer_schema, provider_uuid, tracing_id=None): """Initializer. Args: customer_schema (str): Schema name for given customer. provider_uuid (str): The provider uuid.""" <|body_0|> def _set_u...
stack_v2_sparse_classes_36k_train_001569
3,840
permissive
[ { "docstring": "Initializer. Args: customer_schema (str): Schema name for given customer. provider_uuid (str): The provider uuid.", "name": "__init__", "signature": "def __init__(self, customer_schema, provider_uuid, tracing_id=None)" }, { "docstring": "Create the report charge updater object. O...
4
stack_v2_sparse_classes_30k_train_018196
Implement the Python class `CostModelCostUpdater` described below. Class description: Update reporting summary tables. Method signatures and docstrings: - def __init__(self, customer_schema, provider_uuid, tracing_id=None): Initializer. Args: customer_schema (str): Schema name for given customer. provider_uuid (str):...
Implement the Python class `CostModelCostUpdater` described below. Class description: Update reporting summary tables. Method signatures and docstrings: - def __init__(self, customer_schema, provider_uuid, tracing_id=None): Initializer. Args: customer_schema (str): Schema name for given customer. provider_uuid (str):...
0416e5216eb1ec4b41c8dd4999adde218b1ab2e1
<|skeleton|> class CostModelCostUpdater: """Update reporting summary tables.""" def __init__(self, customer_schema, provider_uuid, tracing_id=None): """Initializer. Args: customer_schema (str): Schema name for given customer. provider_uuid (str): The provider uuid.""" <|body_0|> def _set_u...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CostModelCostUpdater: """Update reporting summary tables.""" def __init__(self, customer_schema, provider_uuid, tracing_id=None): """Initializer. Args: customer_schema (str): Schema name for given customer. provider_uuid (str): The provider uuid.""" self._schema = customer_schema ...
the_stack_v2_python_sparse
koku/masu/processor/cost_model_cost_updater.py
project-koku/koku
train
225
7a08fae5d220f1111339dcec9547605ed1f1adac
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn SynchronizationJob()", "from .entity import Entity\nfrom .key_value_pair import KeyValuePair\nfrom .synchronization_schedule import SynchronizationSchedule\nfrom .synchronization_schema import SynchronizationSchema\nfrom .synchronizati...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return SynchronizationJob() <|end_body_0|> <|body_start_1|> from .entity import Entity from .key_value_pair import KeyValuePair from .synchronization_schedule import SynchronizationSche...
SynchronizationJob
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SynchronizationJob: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJob: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje...
stack_v2_sparse_classes_36k_train_001570
4,015
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: SynchronizationJob", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_...
3
stack_v2_sparse_classes_30k_train_012099
Implement the Python class `SynchronizationJob` described below. Class description: Implement the SynchronizationJob class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJob: Creates a new instance of the appropriate class based on disc...
Implement the Python class `SynchronizationJob` described below. Class description: Implement the SynchronizationJob class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJob: Creates a new instance of the appropriate class based on disc...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class SynchronizationJob: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJob: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SynchronizationJob: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJob: """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: Sy...
the_stack_v2_python_sparse
msgraph/generated/models/synchronization_job.py
microsoftgraph/msgraph-sdk-python
train
135
04334445b42d53e46e4fba9551cc43133686f543
[ "self.total = sum(w)\nfor i in range(1, len(w)):\n w[i] += w[i - 1]\nself.w = w", "ind = random.randint(0, self.total - 1)\nl, r = (0, len(self.w))\nwhile l + 1 < r:\n mid = (l + r) / 2\n if ind <= self.w[mid]:\n r = mid\n else:\n l = mid\nif ind <= self.w[l]:\n return l\nreturn r" ]
<|body_start_0|> self.total = sum(w) for i in range(1, len(w)): w[i] += w[i - 1] self.w = w <|end_body_0|> <|body_start_1|> ind = random.randint(0, self.total - 1) l, r = (0, len(self.w)) while l + 1 < r: mid = (l + r) / 2 if ind <= se...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.total = sum(w) for i in range(1, len(w)): w[i] += w[i - 1] self...
stack_v2_sparse_classes_36k_train_001571
824
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
bcb79f329bcb133e6421db8fc1f4780a4eedec39
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" self.total = sum(w) for i in range(1, len(w)): w[i] += w[i - 1] self.w = w def pickIndex(self): """:rtype: int""" ind = random.randint(0, self.total - 1) l, r = (0, len(self.w)) ...
the_stack_v2_python_sparse
528. Random Pick with Weight.py
havenshi/leetcode
train
1
296f9e6210a14ad96edd1c6ccba151a89a822c2c
[ "self.tree = [0] * (2 * self.MAX_ARRAY_SIZE)\nn = len(input_array)\nself.n = n\nfor i in range(n):\n self.tree[n + i] = input_array[i]\nfor i in range(n - 1, 0, -1):\n self.tree[i] = self.tree[i << 1] + self.tree[i << 1 | 1]", "self.tree[index + self.n] = value\nindex = index + self.n\ni = index\nwhile i > ...
<|body_start_0|> self.tree = [0] * (2 * self.MAX_ARRAY_SIZE) n = len(input_array) self.n = n for i in range(n): self.tree[n + i] = input_array[i] for i in range(n - 1, 0, -1): self.tree[i] = self.tree[i << 1] + self.tree[i << 1 | 1] <|end_body_0|> <|body_...
An implementation of Segment Tree
SegmentTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SegmentTree: """An implementation of Segment Tree""" def __init__(self, input_array): """init Segment Tree Args: input_array: Input array Returns: None Raises: None""" <|body_0|> def update(self, index, value): """Update Args: index: to update value: new value Re...
stack_v2_sparse_classes_36k_train_001572
2,356
no_license
[ { "docstring": "init Segment Tree Args: input_array: Input array Returns: None Raises: None", "name": "__init__", "signature": "def __init__(self, input_array)" }, { "docstring": "Update Args: index: to update value: new value Returns: None Raises: None", "name": "update", "signature": "...
3
stack_v2_sparse_classes_30k_train_018039
Implement the Python class `SegmentTree` described below. Class description: An implementation of Segment Tree Method signatures and docstrings: - def __init__(self, input_array): init Segment Tree Args: input_array: Input array Returns: None Raises: None - def update(self, index, value): Update Args: index: to updat...
Implement the Python class `SegmentTree` described below. Class description: An implementation of Segment Tree Method signatures and docstrings: - def __init__(self, input_array): init Segment Tree Args: input_array: Input array Returns: None Raises: None - def update(self, index, value): Update Args: index: to updat...
11f4d25cb211740514c119a60962d075a0817abd
<|skeleton|> class SegmentTree: """An implementation of Segment Tree""" def __init__(self, input_array): """init Segment Tree Args: input_array: Input array Returns: None Raises: None""" <|body_0|> def update(self, index, value): """Update Args: index: to update value: new value Re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SegmentTree: """An implementation of Segment Tree""" def __init__(self, input_array): """init Segment Tree Args: input_array: Input array Returns: None Raises: None""" self.tree = [0] * (2 * self.MAX_ARRAY_SIZE) n = len(input_array) self.n = n for i in range(n): ...
the_stack_v2_python_sparse
python/common/segment_tree.py
santhosh-kumar/AlgorithmsAndDataStructures
train
2
258e556cb491348d7507a28684ae8a3eb27fe9bb
[ "identity = get_jwt_identity()\ncand_id = identity['id']\nsubcribe = get_subcribe(cand_id)\nif not subcribe:\n return response_object()\nelse:\n return response_object(200, 'Thành công.', data=subcribe.to_json())", "identity = get_jwt_identity()\ncand_id = identity['id']\ntopic = request.json['topic']\nprov...
<|body_start_0|> identity = get_jwt_identity() cand_id = identity['id'] subcribe = get_subcribe(cand_id) if not subcribe: return response_object() else: return response_object(200, 'Thành công.', data=subcribe.to_json()) <|end_body_0|> <|body_start_1|> ...
SubcribeEmail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubcribeEmail: def get(self): """get list subcribe email""" <|body_0|> def post(self): """subcribe email: (type= 0 daily, 1: week) (statis= 0: inactive, 1: active)""" <|body_1|> def delete(self): """Delete subcribe""" <|body_2|> <|end_sk...
stack_v2_sparse_classes_36k_train_001573
3,272
no_license
[ { "docstring": "get list subcribe email", "name": "get", "signature": "def get(self)" }, { "docstring": "subcribe email: (type= 0 daily, 1: week) (statis= 0: inactive, 1: active)", "name": "post", "signature": "def post(self)" }, { "docstring": "Delete subcribe", "name": "del...
3
stack_v2_sparse_classes_30k_train_004856
Implement the Python class `SubcribeEmail` described below. Class description: Implement the SubcribeEmail class. Method signatures and docstrings: - def get(self): get list subcribe email - def post(self): subcribe email: (type= 0 daily, 1: week) (statis= 0: inactive, 1: active) - def delete(self): Delete subcribe
Implement the Python class `SubcribeEmail` described below. Class description: Implement the SubcribeEmail class. Method signatures and docstrings: - def get(self): get list subcribe email - def post(self): subcribe email: (type= 0 daily, 1: week) (statis= 0: inactive, 1: active) - def delete(self): Delete subcribe ...
a23e4924b8c66940aa990ef9e19c360a34e5c44e
<|skeleton|> class SubcribeEmail: def get(self): """get list subcribe email""" <|body_0|> def post(self): """subcribe email: (type= 0 daily, 1: week) (statis= 0: inactive, 1: active)""" <|body_1|> def delete(self): """Delete subcribe""" <|body_2|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubcribeEmail: def get(self): """get list subcribe email""" identity = get_jwt_identity() cand_id = identity['id'] subcribe = get_subcribe(cand_id) if not subcribe: return response_object() else: return response_object(200, 'Thành công.',...
the_stack_v2_python_sparse
app/main/controller/subcribe_email_controller.py
loctran0169/automated-resume-screening-server
train
0
13c9f9a257c267056da237e11200e487b5e27a93
[ "self.model = model\nself.n_epochs = params.n_epochs\nself.optimizer = optimizer\nself.criterion = criterion\nself.batch_size = params.batch_size\nself.device = device\nself.dataset = dataset\nself.val_split = params.val_split\nself._init_dataloaders()\nself.current_epoch = 0\nself.train_loss = []\nself.test_loss =...
<|body_start_0|> self.model = model self.n_epochs = params.n_epochs self.optimizer = optimizer self.criterion = criterion self.batch_size = params.batch_size self.device = device self.dataset = dataset self.val_split = params.val_split self._init_d...
class to provide framework for training a network. Attributes: TRAINING n_epochs (int): number of epochs of training model (nn.Module instance): model to be trained dataset (instance of DataSet subclass): to handle data train_loader (DataLoader instance): loader handling training data test_loader (DataLoader instance):...
Trainer
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trainer: """class to provide framework for training a network. Attributes: TRAINING n_epochs (int): number of epochs of training model (nn.Module instance): model to be trained dataset (instance of DataSet subclass): to handle data train_loader (DataLoader instance): loader handling training data...
stack_v2_sparse_classes_36k_train_001574
4,916
permissive
[ { "docstring": "initializes training from a parameter class object Args: model (nn.Module subclass instance): model to be training dataset (DataSet subclass instance): providing data criterion (nn.Loss instance): loss function optimizer (nn.optim instance): optimizer for model parameters params (params class in...
5
stack_v2_sparse_classes_30k_train_013515
Implement the Python class `Trainer` described below. Class description: class to provide framework for training a network. Attributes: TRAINING n_epochs (int): number of epochs of training model (nn.Module instance): model to be trained dataset (instance of DataSet subclass): to handle data train_loader (DataLoader i...
Implement the Python class `Trainer` described below. Class description: class to provide framework for training a network. Attributes: TRAINING n_epochs (int): number of epochs of training model (nn.Module instance): model to be trained dataset (instance of DataSet subclass): to handle data train_loader (DataLoader i...
62921423b787ad8b81b8e60e8de42a3f6e113d88
<|skeleton|> class Trainer: """class to provide framework for training a network. Attributes: TRAINING n_epochs (int): number of epochs of training model (nn.Module instance): model to be trained dataset (instance of DataSet subclass): to handle data train_loader (DataLoader instance): loader handling training data...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Trainer: """class to provide framework for training a network. Attributes: TRAINING n_epochs (int): number of epochs of training model (nn.Module instance): model to be trained dataset (instance of DataSet subclass): to handle data train_loader (DataLoader instance): loader handling training data test_loader ...
the_stack_v2_python_sparse
utils/trainer.py
Bobby-Hua/birdsonearth
train
0
d988bc7a57b4f9dcd271c1965bfc1978d414b4ce
[ "self.assertEquals(2, puzzle3.santa_alone_delivers('>'))\nself.assertEquals(4, puzzle3.santa_alone_delivers('^>v<'))\nself.assertEquals(2, puzzle3.santa_alone_delivers('^v^v^v^v^v'))", "self.assertEquals(3, puzzle3.santa_with_robot_delivers('^v'))\nself.assertEquals(3, puzzle3.santa_with_robot_delivers('^>v<'))\n...
<|body_start_0|> self.assertEquals(2, puzzle3.santa_alone_delivers('>')) self.assertEquals(4, puzzle3.santa_alone_delivers('^>v<')) self.assertEquals(2, puzzle3.santa_alone_delivers('^v^v^v^v^v')) <|end_body_0|> <|body_start_1|> self.assertEquals(3, puzzle3.santa_with_robot_delivers('^v...
Tests for puzzle 3.
TestPuzzle3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPuzzle3: """Tests for puzzle 3.""" def test_puzzle3a(self): """Tests for puzzle 3, part 1.""" <|body_0|> def test_puzzle3b(self): """Tests for puzzle 3, part 1.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.assertEquals(2, puzzle3.san...
stack_v2_sparse_classes_36k_train_001575
744
no_license
[ { "docstring": "Tests for puzzle 3, part 1.", "name": "test_puzzle3a", "signature": "def test_puzzle3a(self)" }, { "docstring": "Tests for puzzle 3, part 1.", "name": "test_puzzle3b", "signature": "def test_puzzle3b(self)" } ]
2
null
Implement the Python class `TestPuzzle3` described below. Class description: Tests for puzzle 3. Method signatures and docstrings: - def test_puzzle3a(self): Tests for puzzle 3, part 1. - def test_puzzle3b(self): Tests for puzzle 3, part 1.
Implement the Python class `TestPuzzle3` described below. Class description: Tests for puzzle 3. Method signatures and docstrings: - def test_puzzle3a(self): Tests for puzzle 3, part 1. - def test_puzzle3b(self): Tests for puzzle 3, part 1. <|skeleton|> class TestPuzzle3: """Tests for puzzle 3.""" def test_...
99d1f68ddf92b989ff775c270d315eb8df4dbd55
<|skeleton|> class TestPuzzle3: """Tests for puzzle 3.""" def test_puzzle3a(self): """Tests for puzzle 3, part 1.""" <|body_0|> def test_puzzle3b(self): """Tests for puzzle 3, part 1.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPuzzle3: """Tests for puzzle 3.""" def test_puzzle3a(self): """Tests for puzzle 3, part 1.""" self.assertEquals(2, puzzle3.santa_alone_delivers('>')) self.assertEquals(4, puzzle3.santa_alone_delivers('^>v<')) self.assertEquals(2, puzzle3.santa_alone_delivers('^v^v^v^v^...
the_stack_v2_python_sparse
puzzle3/python/test_puzzle3.py
jramaswami/Advent-Of-Code-2015
train
0
11955f5dff75c8df0908e72a0a0e978d8254355b
[ "coins.sort()\ndp = [1] + [0] * amount\nfor c in coins:\n for i in range(c, amount + 1):\n if dp[i - c]:\n dp[i] += dp[i - c]\nreturn dp[-1]", "dp = [0] * (amount + 1)\ndp[0] = 1\nfor i in coins:\n for j in range(1, amount + 1):\n if j >= i:\n dp[j] += dp[j - i]\nreturn d...
<|body_start_0|> coins.sort() dp = [1] + [0] * amount for c in coins: for i in range(c, amount + 1): if dp[i - c]: dp[i] += dp[i - c] return dp[-1] <|end_body_0|> <|body_start_1|> dp = [0] * (amount + 1) dp[0] = 1 f...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int beats 93.06%""" <|body_0|> def change0(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int https://leetcode.com/problems/coin-change-2/discuss...
stack_v2_sparse_classes_36k_train_001576
3,013
no_license
[ { "docstring": ":type amount: int :type coins: List[int] :rtype: int beats 93.06%", "name": "change", "signature": "def change(self, amount, coins)" }, { "docstring": ":type amount: int :type coins: List[int] :rtype: int https://leetcode.com/problems/coin-change-2/discuss/99210/python-O(n)-space...
5
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int beats 93.06% - def change0(self, amount, coins): :type amount: int :type coins: List[int] :r...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int beats 93.06% - def change0(self, amount, coins): :type amount: int :type coins: List[int] :r...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int beats 93.06%""" <|body_0|> def change0(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int https://leetcode.com/problems/coin-change-2/discuss...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int beats 93.06%""" coins.sort() dp = [1] + [0] * amount for c in coins: for i in range(c, amount + 1): if dp[i - c]: dp[i] += dp[i - c...
the_stack_v2_python_sparse
LeetCode/518_coin_change_2.py
yao23/Machine_Learning_Playground
train
12
9ab2f45a64c4a55bd88a8c0c07e101f1184bad59
[ "tableaux = self._begin_tableaux(inference)\napplied_rules = {rule_name: [] for rule_name in tableaux_system.rules}\nfor node in LevelOrderIter(tableaux):\n for rule_name in tableaux_system.rules:\n result = tableaux_system.rule_is_applicable(node, rule_name, return_subst_dict=True)\n applicable = ...
<|body_start_0|> tableaux = self._begin_tableaux(inference) applied_rules = {rule_name: [] for rule_name in tableaux_system.rules} for node in LevelOrderIter(tableaux): for rule_name in tableaux_system.rules: result = tableaux_system.rule_is_applicable(node, rule_name...
Solver for tableaux systems Will build a tree for an (either valid or invalid) inference. When a branch is closed, does not continue adding nodes to it. Does not have the rules hardcoded. The ``solve`` method takes a tableaux system as parameter, and the tableaux solver will derive with the rules of the system you give...
TableauxSolver
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TableauxSolver: """Solver for tableaux systems Will build a tree for an (either valid or invalid) inference. When a branch is closed, does not continue adding nodes to it. Does not have the rules hardcoded. The ``solve`` method takes a tableaux system as parameter, and the tableaux solver will de...
stack_v2_sparse_classes_36k_train_001577
9,699
permissive
[ { "docstring": "Builds a tableaux for an inference, given a tableaux system with which to operate. Parameters ---------- inference: logics.classes.propositional.Inference The Inference to build a tableaux for tableaux_system: logics.classes.propositional.proof_theories.TableauxSystem A TableauxSystem or any cla...
2
stack_v2_sparse_classes_30k_train_009773
Implement the Python class `TableauxSolver` described below. Class description: Solver for tableaux systems Will build a tree for an (either valid or invalid) inference. When a branch is closed, does not continue adding nodes to it. Does not have the rules hardcoded. The ``solve`` method takes a tableaux system as par...
Implement the Python class `TableauxSolver` described below. Class description: Solver for tableaux systems Will build a tree for an (either valid or invalid) inference. When a branch is closed, does not continue adding nodes to it. Does not have the rules hardcoded. The ``solve`` method takes a tableaux system as par...
cc3e1665a4679616c282e8790cdac0a555191920
<|skeleton|> class TableauxSolver: """Solver for tableaux systems Will build a tree for an (either valid or invalid) inference. When a branch is closed, does not continue adding nodes to it. Does not have the rules hardcoded. The ``solve`` method takes a tableaux system as parameter, and the tableaux solver will de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TableauxSolver: """Solver for tableaux systems Will build a tree for an (either valid or invalid) inference. When a branch is closed, does not continue adding nodes to it. Does not have the rules hardcoded. The ``solve`` method takes a tableaux system as parameter, and the tableaux solver will derive with the...
the_stack_v2_python_sparse
logics/utils/solvers/tableaux.py
ariroffe/logics
train
15
2a7dea2803f4e5e02da421c0bb051aa76c514ddb
[ "self.__logger = logging.getLogger(__name__)\nself.verbose = verbose\nself.tmp_dir = tmp_dir\nself.algo_name = algo\nself.algo_base = AlgorithmBase(data=data, algo_name=self.algo_name, metric=target_metric, cv_n_jobs=CV_N_JOBS, hpo_algo=hpo_algo, verbose=verbose, random_state=random_state)", "try:\n with Resul...
<|body_start_0|> self.__logger = logging.getLogger(__name__) self.verbose = verbose self.tmp_dir = tmp_dir self.algo_name = algo self.algo_base = AlgorithmBase(data=data, algo_name=self.algo_name, metric=target_metric, cv_n_jobs=CV_N_JOBS, hpo_algo=hpo_algo, verbose=verbose, rand...
Trainer
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trainer: def __init__(self, tmp_dir, algo=None, data=None, target_metric=DEFAULT_TARGET_METRIC, hpo_algo=DEFAULT_HPO_ALGO, verbose=False, random_state=None): """Initialize new trainer""" <|body_0|> def start(self, max_evals): """Start with no limits""" <|body...
stack_v2_sparse_classes_36k_train_001578
4,482
permissive
[ { "docstring": "Initialize new trainer", "name": "__init__", "signature": "def __init__(self, tmp_dir, algo=None, data=None, target_metric=DEFAULT_TARGET_METRIC, hpo_algo=DEFAULT_HPO_ALGO, verbose=False, random_state=None)" }, { "docstring": "Start with no limits", "name": "start", "sign...
3
null
Implement the Python class `Trainer` described below. Class description: Implement the Trainer class. Method signatures and docstrings: - def __init__(self, tmp_dir, algo=None, data=None, target_metric=DEFAULT_TARGET_METRIC, hpo_algo=DEFAULT_HPO_ALGO, verbose=False, random_state=None): Initialize new trainer - def st...
Implement the Python class `Trainer` described below. Class description: Implement the Trainer class. Method signatures and docstrings: - def __init__(self, tmp_dir, algo=None, data=None, target_metric=DEFAULT_TARGET_METRIC, hpo_algo=DEFAULT_HPO_ALGO, verbose=False, random_state=None): Initialize new trainer - def st...
20d8df6172906337f81583dabb841d66b8f31857
<|skeleton|> class Trainer: def __init__(self, tmp_dir, algo=None, data=None, target_metric=DEFAULT_TARGET_METRIC, hpo_algo=DEFAULT_HPO_ALGO, verbose=False, random_state=None): """Initialize new trainer""" <|body_0|> def start(self, max_evals): """Start with no limits""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Trainer: def __init__(self, tmp_dir, algo=None, data=None, target_metric=DEFAULT_TARGET_METRIC, hpo_algo=DEFAULT_HPO_ALGO, verbose=False, random_state=None): """Initialize new trainer""" self.__logger = logging.getLogger(__name__) self.verbose = verbose self.tmp_dir = tmp_dir ...
the_stack_v2_python_sparse
new_algs/Sequence+algorithms/Selection+algorithm/trainer.py
coolsnake/JupyterNotebook
train
0
784ba2c982c389a3f7ca834225c5691aae21508b
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Storage Registry API The Storage Registry API is meant to as registry to obtain information of available storage providers. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119. Th...
StorageRegistryServiceServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StorageRegistryServiceServicer: """Storage Registry API The Storage Registry API is meant to as registry to obtain information of available storage providers. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this d...
stack_v2_sparse_classes_36k_train_001579
5,403
no_license
[ { "docstring": "Returns the storage provider that is reponsible for the given resource reference. MUST return CODE_NOT_FOUND if the reference does not exist.", "name": "GetStorageProvider", "signature": "def GetStorageProvider(self, request, context)" }, { "docstring": "Returns a list of the ava...
3
stack_v2_sparse_classes_30k_train_019138
Implement the Python class `StorageRegistryServiceServicer` described below. Class description: Storage Registry API The Storage Registry API is meant to as registry to obtain information of available storage providers. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMM...
Implement the Python class `StorageRegistryServiceServicer` described below. Class description: Storage Registry API The Storage Registry API is meant to as registry to obtain information of available storage providers. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMM...
dad1a042b38db5f8bedcac3b6af25066f4d6eef9
<|skeleton|> class StorageRegistryServiceServicer: """Storage Registry API The Storage Registry API is meant to as registry to obtain information of available storage providers. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StorageRegistryServiceServicer: """Storage Registry API The Storage Registry API is meant to as registry to obtain information of available storage providers. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are t...
the_stack_v2_python_sparse
cs3/storageregistry/v0alpha/storageregistry_pb2_grpc.py
SamuAlfageme/python-cs3apis
train
0
32c6919df8ea3cf051d571998588441650c45081
[ "if not root:\n return ''\nqueue = []\nvalues = []\nqueue.append(root)\nwhile queue:\n top = queue.pop(0)\n if not top:\n values.append('n')\n continue\n values.append(str(top.val))\n queue.append(top.left)\n queue.append(top.right)\nreturn ','.join(values)", "if not data:\n ret...
<|body_start_0|> if not root: return '' queue = [] values = [] queue.append(root) while queue: top = queue.pop(0) if not top: values.append('n') continue values.append(str(top.val)) queue....
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_001580
1,734
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_006148
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
46ab03e23d15ebd5434ef4dd5ae99130000b00a5
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' queue = [] values = [] queue.append(root) while queue: top = queue.pop(0) if not top: ...
the_stack_v2_python_sparse
leetcode/297_二叉树的序列化与反序列化.py
zhulf0804/Coding.Python
train
3
f9992b4e5ef9e77c2596f230a432ccac79cf7f59
[ "self.filter_quantities = (lambda name: True) if filter_quantities is None else filter_quantities\nself.filter_figures = (lambda name: True) if filter_figures is None else filter_figures\nself.n_histogram_bins = n_histogram_bins\nself.primary_metric = primary_metric", "data = RegressionData(targets=ground_truth, ...
<|body_start_0|> self.filter_quantities = (lambda name: True) if filter_quantities is None else filter_quantities self.filter_figures = (lambda name: True) if filter_figures is None else filter_figures self.n_histogram_bins = n_histogram_bins self.primary_metric = primary_metric <|end_bo...
Evaluator implementation for regression problems.
RegressionEvaluator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegressionEvaluator: """Evaluator implementation for regression problems.""" def __init__(self, filter_quantities: Optional[Callable[[str], bool]]=None, filter_figures: Optional[Callable[[str], bool]]=None, n_histogram_bins: int=DEFAULT_N_HISTOGRAM_BINS, primary_metric: Optional[str]=None): ...
stack_v2_sparse_classes_36k_train_001581
8,607
permissive
[ { "docstring": "Initializes the evaluator with the option to overwrite the default settings. Args: filter_quantities: Callable that receives a quantity name and returns `False` if the quantity should be excluded. Example: `filter_quantities=lambda name: \"vs Rest\" not in name` filter_figures: Callable that rec...
2
stack_v2_sparse_classes_30k_train_013433
Implement the Python class `RegressionEvaluator` described below. Class description: Evaluator implementation for regression problems. Method signatures and docstrings: - def __init__(self, filter_quantities: Optional[Callable[[str], bool]]=None, filter_figures: Optional[Callable[[str], bool]]=None, n_histogram_bins:...
Implement the Python class `RegressionEvaluator` described below. Class description: Evaluator implementation for regression problems. Method signatures and docstrings: - def __init__(self, filter_quantities: Optional[Callable[[str], bool]]=None, filter_figures: Optional[Callable[[str], bool]]=None, n_histogram_bins:...
cc2ff22d25a8dd11da82c103e163e81865562ee9
<|skeleton|> class RegressionEvaluator: """Evaluator implementation for regression problems.""" def __init__(self, filter_quantities: Optional[Callable[[str], bool]]=None, filter_figures: Optional[Callable[[str], bool]]=None, n_histogram_bins: int=DEFAULT_N_HISTOGRAM_BINS, primary_metric: Optional[str]=None): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegressionEvaluator: """Evaluator implementation for regression problems.""" def __init__(self, filter_quantities: Optional[Callable[[str], bool]]=None, filter_figures: Optional[Callable[[str], bool]]=None, n_histogram_bins: int=DEFAULT_N_HISTOGRAM_BINS, primary_metric: Optional[str]=None): """In...
the_stack_v2_python_sparse
src/metriculous/evaluators/_regression_evaluator.py
BikashShaw/metriculous
train
0
a753668d4d1ff674ca97bbeb4c2d0bddc21d99e2
[ "if string_param.startswith('$FILE'):\n path = re.findall('\\\\$FILE\\\\{\\\\\"(.*?)\\\\\"\\\\}', string_param)[0]\n base_folder = kwargs.get('base_folder', '.')\n path = ParseTool.get_possible_path(path, base_folder)\n with open(path, 'r') as read_file:\n string_param = ''.join(read_file)\nretur...
<|body_start_0|> if string_param.startswith('$FILE'): path = re.findall('\\$FILE\\{\\"(.*?)\\"\\}', string_param)[0] base_folder = kwargs.get('base_folder', '.') path = ParseTool.get_possible_path(path, base_folder) with open(path, 'r') as read_file: ...
Enhanced parsing tools.
ParseTool
[ "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParseTool: """Enhanced parsing tools.""" def parse_string_param_if_file(string_param: str, **kwargs): """Use $FILE{"data_path"} to load file from "data_path".""" <|body_0|> def parse_string_param_if_env(string_param: str, **kwargs): """Use $ENV{env_name} to load ...
stack_v2_sparse_classes_36k_train_001582
16,194
permissive
[ { "docstring": "Use $FILE{\"data_path\"} to load file from \"data_path\".", "name": "parse_string_param_if_file", "signature": "def parse_string_param_if_file(string_param: str, **kwargs)" }, { "docstring": "Use $ENV{env_name} to load environment variable \"env_name\".", "name": "parse_strin...
4
null
Implement the Python class `ParseTool` described below. Class description: Enhanced parsing tools. Method signatures and docstrings: - def parse_string_param_if_file(string_param: str, **kwargs): Use $FILE{"data_path"} to load file from "data_path". - def parse_string_param_if_env(string_param: str, **kwargs): Use $E...
Implement the Python class `ParseTool` described below. Class description: Enhanced parsing tools. Method signatures and docstrings: - def parse_string_param_if_file(string_param: str, **kwargs): Use $FILE{"data_path"} to load file from "data_path". - def parse_string_param_if_env(string_param: str, **kwargs): Use $E...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class ParseTool: """Enhanced parsing tools.""" def parse_string_param_if_file(string_param: str, **kwargs): """Use $FILE{"data_path"} to load file from "data_path".""" <|body_0|> def parse_string_param_if_env(string_param: str, **kwargs): """Use $ENV{env_name} to load ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParseTool: """Enhanced parsing tools.""" def parse_string_param_if_file(string_param: str, **kwargs): """Use $FILE{"data_path"} to load file from "data_path".""" if string_param.startswith('$FILE'): path = re.findall('\\$FILE\\{\\"(.*?)\\"\\}', string_param)[0] bas...
the_stack_v2_python_sparse
studio/micro-services/dolphinscheduler/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/yaml_process_define.py
alldatacenter/alldata
train
774
4733ce1f17759607c870d2a127c71c2ab2e8744c
[ "super(WrapEncoderLayer, self).__init__(name_cope)\nself._prepare_encoder_layer = PrepareEncoderDecoderLayer(self.full_name(), src_vocab_size, d_model, max_length, prepostprocess_dropout, word_emb_param_name=word_emb_param_names[0], pos_enc_param_name=pos_enc_param_names[0])\nself._encoder = EncoderLayer(self.full_...
<|body_start_0|> super(WrapEncoderLayer, self).__init__(name_cope) self._prepare_encoder_layer = PrepareEncoderDecoderLayer(self.full_name(), src_vocab_size, d_model, max_length, prepostprocess_dropout, word_emb_param_name=word_emb_param_names[0], pos_enc_param_name=pos_enc_param_names[0]) self....
encoderlayer
WrapEncoderLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WrapEncoderLayer: """encoderlayer""" def __init__(self, name_cope, src_vocab_size, max_length, n_layer, n_head, d_key, d_value, d_model, d_inner_hid, prepostprocess_dropout, attention_dropout, relu_dropout, preprocess_cmd, postprocess_cmd, weight_sharing): """The wrapper assembles to...
stack_v2_sparse_classes_36k_train_001583
40,228
permissive
[ { "docstring": "The wrapper assembles together all needed layers for the encoder.", "name": "__init__", "signature": "def __init__(self, name_cope, src_vocab_size, max_length, n_layer, n_head, d_key, d_value, d_model, d_inner_hid, prepostprocess_dropout, attention_dropout, relu_dropout, preprocess_cmd, ...
2
null
Implement the Python class `WrapEncoderLayer` described below. Class description: encoderlayer Method signatures and docstrings: - def __init__(self, name_cope, src_vocab_size, max_length, n_layer, n_head, d_key, d_value, d_model, d_inner_hid, prepostprocess_dropout, attention_dropout, relu_dropout, preprocess_cmd, p...
Implement the Python class `WrapEncoderLayer` described below. Class description: encoderlayer Method signatures and docstrings: - def __init__(self, name_cope, src_vocab_size, max_length, n_layer, n_head, d_key, d_value, d_model, d_inner_hid, prepostprocess_dropout, attention_dropout, relu_dropout, preprocess_cmd, p...
420527996b6da60ca401717a734329f126ed0680
<|skeleton|> class WrapEncoderLayer: """encoderlayer""" def __init__(self, name_cope, src_vocab_size, max_length, n_layer, n_head, d_key, d_value, d_model, d_inner_hid, prepostprocess_dropout, attention_dropout, relu_dropout, preprocess_cmd, postprocess_cmd, weight_sharing): """The wrapper assembles to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WrapEncoderLayer: """encoderlayer""" def __init__(self, name_cope, src_vocab_size, max_length, n_layer, n_head, d_key, d_value, d_model, d_inner_hid, prepostprocess_dropout, attention_dropout, relu_dropout, preprocess_cmd, postprocess_cmd, weight_sharing): """The wrapper assembles together all ne...
the_stack_v2_python_sparse
dygraph/transformer/model.py
chenbjin/models
train
3
5f67b68dd51fe5b9c669862657c7b6a2dd754abe
[ "n, m = (len(text1), len(text2))\nif n * m == 0:\n return 0\ndp = [[0] * (m + 1) for _ in range(n + 1)]\nfor i in range(1, n + 1):\n for j in range(1, m + 1):\n if text1[i - 1] == text2[j - 1]:\n dp[i][j] = 1 + dp[i - 1][j - 1]\n else:\n dp[i][j] = max(dp[i - 1][j], dp[i][j...
<|body_start_0|> n, m = (len(text1), len(text2)) if n * m == 0: return 0 dp = [[0] * (m + 1) for _ in range(n + 1)] for i in range(1, n + 1): for j in range(1, m + 1): if text1[i - 1] == text2[j - 1]: dp[i][j] = 1 + dp[i - 1][j ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longest_common_subsequence(self, text1: str, text2: str) -> int: """动态规划。""" <|body_0|> def longest_common_subsequence_2(self, text1: str, text2: str) -> int: """动态规划。""" <|body_1|> <|end_skeleton|> <|body_start_0|> n, m = (len(text1),...
stack_v2_sparse_classes_36k_train_001584
3,316
no_license
[ { "docstring": "动态规划。", "name": "longest_common_subsequence", "signature": "def longest_common_subsequence(self, text1: str, text2: str) -> int" }, { "docstring": "动态规划。", "name": "longest_common_subsequence_2", "signature": "def longest_common_subsequence_2(self, text1: str, text2: str)...
2
stack_v2_sparse_classes_30k_train_007487
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longest_common_subsequence(self, text1: str, text2: str) -> int: 动态规划。 - def longest_common_subsequence_2(self, text1: str, text2: str) -> int: 动态规划。
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longest_common_subsequence(self, text1: str, text2: str) -> int: 动态规划。 - def longest_common_subsequence_2(self, text1: str, text2: str) -> int: 动态规划。 <|skeleton|> class Solu...
6932d69353b94ec824dd0ddc86a92453f6673232
<|skeleton|> class Solution: def longest_common_subsequence(self, text1: str, text2: str) -> int: """动态规划。""" <|body_0|> def longest_common_subsequence_2(self, text1: str, text2: str) -> int: """动态规划。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longest_common_subsequence(self, text1: str, text2: str) -> int: """动态规划。""" n, m = (len(text1), len(text2)) if n * m == 0: return 0 dp = [[0] * (m + 1) for _ in range(n + 1)] for i in range(1, n + 1): for j in range(1, m + 1): ...
the_stack_v2_python_sparse
1143_longest-common-subsequence.py
Nigirimeshi/leetcode
train
0
c052853d0526608f97cfc4e2e0129cf21672b283
[ "super(GeneralizedMLP, self).__init__(name=name)\nif layers is not None:\n self._layers = layers\nelse:\n self._layers = [64, 64, 1]\nif regularizer_weight:\n self._regularizers = {'w': tf.contrib.layers.l2_regularizer(scale=regularizer_weight)}\nelse:\n self._regularizers = None\nself._use_batchnorm = ...
<|body_start_0|> super(GeneralizedMLP, self).__init__(name=name) if layers is not None: self._layers = layers else: self._layers = [64, 64, 1] if regularizer_weight: self._regularizers = {'w': tf.contrib.layers.l2_regularizer(scale=regularizer_weight)}...
A multilayer, fully-connected discriminator.
GeneralizedMLP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneralizedMLP: """A multilayer, fully-connected discriminator.""" def __init__(self, name='fc_discriminator', regularizer_weight=0.0, use_batchnorm=False, layers=None, final_activation=None): """Constructs a GeneralizedMLP.""" <|body_0|> def _build(self, input, is_train...
stack_v2_sparse_classes_36k_train_001585
2,866
no_license
[ { "docstring": "Constructs a GeneralizedMLP.", "name": "__init__", "signature": "def __init__(self, name='fc_discriminator', regularizer_weight=0.0, use_batchnorm=False, layers=None, final_activation=None)" }, { "docstring": "Adds the network into the graph.", "name": "_build", "signatur...
2
stack_v2_sparse_classes_30k_train_013416
Implement the Python class `GeneralizedMLP` described below. Class description: A multilayer, fully-connected discriminator. Method signatures and docstrings: - def __init__(self, name='fc_discriminator', regularizer_weight=0.0, use_batchnorm=False, layers=None, final_activation=None): Constructs a GeneralizedMLP. - ...
Implement the Python class `GeneralizedMLP` described below. Class description: A multilayer, fully-connected discriminator. Method signatures and docstrings: - def __init__(self, name='fc_discriminator', regularizer_weight=0.0, use_batchnorm=False, layers=None, final_activation=None): Constructs a GeneralizedMLP. - ...
358a09d491aab0794df9cc7f3f8064430a78fbc3
<|skeleton|> class GeneralizedMLP: """A multilayer, fully-connected discriminator.""" def __init__(self, name='fc_discriminator', regularizer_weight=0.0, use_batchnorm=False, layers=None, final_activation=None): """Constructs a GeneralizedMLP.""" <|body_0|> def _build(self, input, is_train...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeneralizedMLP: """A multilayer, fully-connected discriminator.""" def __init__(self, name='fc_discriminator', regularizer_weight=0.0, use_batchnorm=False, layers=None, final_activation=None): """Constructs a GeneralizedMLP.""" super(GeneralizedMLP, self).__init__(name=name) if la...
the_stack_v2_python_sparse
architectures/mlp_architectures.py
zwbgood6/temporal-hierarchy
train
0
a02aae8b0ad9829c94253ecbd7d633c80ff9b73a
[ "super().__init__(config)\nself.in_proj_weight = nn.Parameter(torch.cat([whisper_layer.self_attn.q_proj.weight, whisper_layer.self_attn.k_proj.weight, whisper_layer.self_attn.v_proj.weight]))\nself.in_proj_bias = nn.Parameter(torch.cat([whisper_layer.self_attn.q_proj.bias, torch.zeros_like(whisper_layer.self_attn.q...
<|body_start_0|> super().__init__(config) self.in_proj_weight = nn.Parameter(torch.cat([whisper_layer.self_attn.q_proj.weight, whisper_layer.self_attn.k_proj.weight, whisper_layer.self_attn.v_proj.weight])) self.in_proj_bias = nn.Parameter(torch.cat([whisper_layer.self_attn.q_proj.bias, torch.ze...
WhisperEncoderLayerBetterTransformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WhisperEncoderLayerBetterTransformer: def __init__(self, whisper_layer, config): """A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` implementation. Args: whisper_layer (`torch.nn.Module`): The original `WhisperEncoderLayer` where the weights needs to be retrieve...
stack_v2_sparse_classes_36k_train_001586
43,670
no_license
[ { "docstring": "A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` implementation. Args: whisper_layer (`torch.nn.Module`): The original `WhisperEncoderLayer` where the weights needs to be retrieved.", "name": "__init__", "signature": "def __init__(self, whisper_layer, config)" ...
2
stack_v2_sparse_classes_30k_train_006410
Implement the Python class `WhisperEncoderLayerBetterTransformer` described below. Class description: Implement the WhisperEncoderLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, whisper_layer, config): A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` imple...
Implement the Python class `WhisperEncoderLayerBetterTransformer` described below. Class description: Implement the WhisperEncoderLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, whisper_layer, config): A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` imple...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class WhisperEncoderLayerBetterTransformer: def __init__(self, whisper_layer, config): """A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` implementation. Args: whisper_layer (`torch.nn.Module`): The original `WhisperEncoderLayer` where the weights needs to be retrieve...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WhisperEncoderLayerBetterTransformer: def __init__(self, whisper_layer, config): """A simple conversion of the WhisperEncoderLayer to its `BetterTransformer` implementation. Args: whisper_layer (`torch.nn.Module`): The original `WhisperEncoderLayer` where the weights needs to be retrieved.""" ...
the_stack_v2_python_sparse
generated/test_huggingface_optimum.py
jansel/pytorch-jit-paritybench
train
35
36d3447e383906243ed73eb832b293d660c64551
[ "self.x = x\nself.y = y\nself.speed = speed\nself.image = pygame.image.load('data/bullet.png').convert_alpha()", "self.y -= self.speed\nif self.y < 0:\n return -1\nelse:\n return 1", "x = self.x - self.image.get_width() / 2\ny = self.y - self.image.get_height() / 2\nscreen.blit(self.image, (x, y))" ]
<|body_start_0|> self.x = x self.y = y self.speed = speed self.image = pygame.image.load('data/bullet.png').convert_alpha() <|end_body_0|> <|body_start_1|> self.y -= self.speed if self.y < 0: return -1 else: return 1 <|end_body_1|> <|body...
子弹类
Bullet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bullet: """子弹类""" def __init__(self, x=0, y=-1, speed=1): """初始化成员变量""" <|body_0|> def move(self): """子弹运动 return -1:子弹摧毁,否则子弹存在""" <|body_1|> def show(self, screen): """子弹显示在屏幕上""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_001587
840
no_license
[ { "docstring": "初始化成员变量", "name": "__init__", "signature": "def __init__(self, x=0, y=-1, speed=1)" }, { "docstring": "子弹运动 return -1:子弹摧毁,否则子弹存在", "name": "move", "signature": "def move(self)" }, { "docstring": "子弹显示在屏幕上", "name": "show", "signature": "def show(self, scr...
3
stack_v2_sparse_classes_30k_train_003693
Implement the Python class `Bullet` described below. Class description: 子弹类 Method signatures and docstrings: - def __init__(self, x=0, y=-1, speed=1): 初始化成员变量 - def move(self): 子弹运动 return -1:子弹摧毁,否则子弹存在 - def show(self, screen): 子弹显示在屏幕上
Implement the Python class `Bullet` described below. Class description: 子弹类 Method signatures and docstrings: - def __init__(self, x=0, y=-1, speed=1): 初始化成员变量 - def move(self): 子弹运动 return -1:子弹摧毁,否则子弹存在 - def show(self, screen): 子弹显示在屏幕上 <|skeleton|> class Bullet: """子弹类""" def __init__(self, x=0, y=-1, s...
a1e624f0afc24ea5f159fa66fed178aa61bb0179
<|skeleton|> class Bullet: """子弹类""" def __init__(self, x=0, y=-1, speed=1): """初始化成员变量""" <|body_0|> def move(self): """子弹运动 return -1:子弹摧毁,否则子弹存在""" <|body_1|> def show(self, screen): """子弹显示在屏幕上""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bullet: """子弹类""" def __init__(self, x=0, y=-1, speed=1): """初始化成员变量""" self.x = x self.y = y self.speed = speed self.image = pygame.image.load('data/bullet.png').convert_alpha() def move(self): """子弹运动 return -1:子弹摧毁,否则子弹存在""" self.y -= self.s...
the_stack_v2_python_sparse
pygame/aircraft/bullet.py
HappyRocky/pythonAI
train
2
8369259d8eb29d70f1c7d450ac592fad6cc5dee6
[ "self._compress = compress\nself._types = ['uint8', 'int8', 'uint16', 'int16', 'uint32', 'int32', 'uint64', 'int64', 'float32', 'float64']\nself._color = color_lib.color(True)\nself._err = self._color.red('ERROR') + ': '\nif compressor == 'snappy':\n self._compressor = snappy.compress\n self._decompressor = s...
<|body_start_0|> self._compress = compress self._types = ['uint8', 'int8', 'uint16', 'int16', 'uint32', 'int32', 'uint64', 'int64', 'float32', 'float64'] self._color = color_lib.color(True) self._err = self._color.red('ERROR') + ': ' if compressor == 'snappy': self._c...
This class serialize and de-serialize the numpy array into string ----------------------------------------------------- The format of the serialized string byte[0]:int8 The dtype of the numpy data, see the self._types byte[1]:int8 The dims of the array, e.g. for rgb image, byte[1] = 3 byte[2:4]:int16 The first dim size...
serialize_numpy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class serialize_numpy: """This class serialize and de-serialize the numpy array into string ----------------------------------------------------- The format of the serialized string byte[0]:int8 The dtype of the numpy data, see the self._types byte[1]:int8 The dims of the array, e.g. for rgb image, byt...
stack_v2_sparse_classes_36k_train_001588
3,592
no_license
[ { "docstring": "The compressor can be snappy or zlib", "name": "__init__", "signature": "def __init__(self, compress=True, compressor='snappy')" }, { "docstring": "Parse the input string return dtype, shape, pure_data_str", "name": "_parse_head", "signature": "def _parse_head(self, raw_d...
5
stack_v2_sparse_classes_30k_test_000047
Implement the Python class `serialize_numpy` described below. Class description: This class serialize and de-serialize the numpy array into string ----------------------------------------------------- The format of the serialized string byte[0]:int8 The dtype of the numpy data, see the self._types byte[1]:int8 The dim...
Implement the Python class `serialize_numpy` described below. Class description: This class serialize and de-serialize the numpy array into string ----------------------------------------------------- The format of the serialized string byte[0]:int8 The dtype of the numpy data, see the self._types byte[1]:int8 The dim...
6ed13aa610a6f2e4e21a6c0349e0d10ebd3c3942
<|skeleton|> class serialize_numpy: """This class serialize and de-serialize the numpy array into string ----------------------------------------------------- The format of the serialized string byte[0]:int8 The dtype of the numpy data, see the self._types byte[1]:int8 The dims of the array, e.g. for rgb image, byt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class serialize_numpy: """This class serialize and de-serialize the numpy array into string ----------------------------------------------------- The format of the serialized string byte[0]:int8 The dtype of the numpy data, see the self._types byte[1]:int8 The dims of the array, e.g. for rgb image, byte[1] = 3 byte...
the_stack_v2_python_sparse
serialize_lib.py
Akrit2013/pymodel
train
1
5388c56d81e1f15971b74de5034f82622c34decc
[ "super().__init__(block_class)\nif not (isinstance(unfixed_dims, int) and unfixed_dims > 0 or unfixed_dims == 'any'):\n raise ValueError(f'{type(self).__name__} requires unfixed_dims to be \"any\" or an int > 0.')\nif not isinstance(fixed_dims, int) or not fixed_dims > 0:\n raise ValueError(f'{type(self).__na...
<|body_start_0|> super().__init__(block_class) if not (isinstance(unfixed_dims, int) and unfixed_dims > 0 or unfixed_dims == 'any'): raise ValueError(f'{type(self).__name__} requires unfixed_dims to be "any" or an int > 0.') if not isinstance(fixed_dims, int) or not fixed_dims > 0: ...
Propagator for fixed output size blocks.
FixedOutputPropagator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FixedOutputPropagator: """Propagator for fixed output size blocks.""" def __init__(self, block_class: str, unfixed_dims: Union[int, str]='any', fixed_dims: int=1): """Initializer for FixedOutputPropagator instance. Args: block_class: The name of the block class being propagated. unfi...
stack_v2_sparse_classes_36k_train_001589
4,438
permissive
[ { "docstring": "Initializer for FixedOutputPropagator instance. Args: block_class: The name of the block class being propagated. unfixed_dims: Number of unfixed dimensions. fixed_dims: Number of fixed dimensions. Raises: ValueError: If fixed_dims not int > 0. ValueError: If unfixed_dims not \"any\" or int > 0."...
3
stack_v2_sparse_classes_30k_train_002536
Implement the Python class `FixedOutputPropagator` described below. Class description: Propagator for fixed output size blocks. Method signatures and docstrings: - def __init__(self, block_class: str, unfixed_dims: Union[int, str]='any', fixed_dims: int=1): Initializer for FixedOutputPropagator instance. Args: block_...
Implement the Python class `FixedOutputPropagator` described below. Class description: Propagator for fixed output size blocks. Method signatures and docstrings: - def __init__(self, block_class: str, unfixed_dims: Union[int, str]='any', fixed_dims: int=1): Initializer for FixedOutputPropagator instance. Args: block_...
55eacc273e61ab0166b5692204a20ab756b92e4c
<|skeleton|> class FixedOutputPropagator: """Propagator for fixed output size blocks.""" def __init__(self, block_class: str, unfixed_dims: Union[int, str]='any', fixed_dims: int=1): """Initializer for FixedOutputPropagator instance. Args: block_class: The name of the block class being propagated. unfi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FixedOutputPropagator: """Propagator for fixed output size blocks.""" def __init__(self, block_class: str, unfixed_dims: Union[int, str]='any', fixed_dims: int=1): """Initializer for FixedOutputPropagator instance. Args: block_class: The name of the block class being propagated. unfixed_dims: Num...
the_stack_v2_python_sparse
narchi/propagators/fixed.py
omni-us/narchi
train
3
4a652fd91d5e1e53d085391e757b6c13917cbee8
[ "self.idevice = idevice\nself.questionTextArea = TextAreaField(x_(u'Question:'), self.idevice.questionInstruc, question)\nself.questionTextArea.idevice = idevice\nself.isCorrect = isCorrect\nself.feedbackTextArea = TextAreaField(x_(u'Feedback'), self.idevice.feedbackInstruc, feedback)\nself.feedbackTextArea.idevice...
<|body_start_0|> self.idevice = idevice self.questionTextArea = TextAreaField(x_(u'Question:'), self.idevice.questionInstruc, question) self.questionTextArea.idevice = idevice self.isCorrect = isCorrect self.feedbackTextArea = TextAreaField(x_(u'Feedback'), self.idevice.feedbackI...
A TrueFalse iDevice is built up of questions. Each question can be rendered as an XHTML element
TrueFalseQuestion
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrueFalseQuestion: """A TrueFalse iDevice is built up of questions. Each question can be rendered as an XHTML element""" def __init__(self, idevice, question='', isCorrect=False, feedback='', hint=''): """Initialize""" <|body_0|> def getResourcesField(self, this_resource...
stack_v2_sparse_classes_36k_train_001590
10,222
no_license
[ { "docstring": "Initialize", "name": "__init__", "signature": "def __init__(self, idevice, question='', isCorrect=False, feedback='', hint='')" }, { "docstring": "implement the specific resource finding mechanism for this iDevice:", "name": "getResourcesField", "signature": "def getResou...
4
stack_v2_sparse_classes_30k_train_009131
Implement the Python class `TrueFalseQuestion` described below. Class description: A TrueFalse iDevice is built up of questions. Each question can be rendered as an XHTML element Method signatures and docstrings: - def __init__(self, idevice, question='', isCorrect=False, feedback='', hint=''): Initialize - def getRe...
Implement the Python class `TrueFalseQuestion` described below. Class description: A TrueFalse iDevice is built up of questions. Each question can be rendered as an XHTML element Method signatures and docstrings: - def __init__(self, idevice, question='', isCorrect=False, feedback='', hint=''): Initialize - def getRe...
1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad
<|skeleton|> class TrueFalseQuestion: """A TrueFalse iDevice is built up of questions. Each question can be rendered as an XHTML element""" def __init__(self, idevice, question='', isCorrect=False, feedback='', hint=''): """Initialize""" <|body_0|> def getResourcesField(self, this_resource...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrueFalseQuestion: """A TrueFalse iDevice is built up of questions. Each question can be rendered as an XHTML element""" def __init__(self, idevice, question='', isCorrect=False, feedback='', hint=''): """Initialize""" self.idevice = idevice self.questionTextArea = TextAreaField(x...
the_stack_v2_python_sparse
eXe/rev3426-3513/left-trunk-3513/exe/engine/truefalseidevice.py
joliebig/featurehouse_fstmerge_examples
train
3
d84c86cf1518a530135e7afd7259def5828cd7f9
[ "if root is None:\n return 'null'\nans = []\n\ndef dfs(root, ans):\n if root is not None:\n ans.append(root.val)\n dfs(root.left, ans)\n dfs(root.right, ans)\n else:\n ans.append('null')\ndfs(root, ans)\nreturn ','.join(list(map(str, ans)))", "ans = data.split(',')\n\ndef tran...
<|body_start_0|> if root is None: return 'null' ans = [] def dfs(root, ans): if root is not None: ans.append(root.val) dfs(root.left, ans) dfs(root.right, ans) else: ans.append('null') df...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_001591
1,971
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_002742
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
c7becb56e207ee2de6dbf662c98db7eb5b9471ff
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root is None: return 'null' ans = [] def dfs(root, ans): if root is not None: ans.append(root.val) dfs(root.le...
the_stack_v2_python_sparse
books/《剑指offer》/剑指 Offer 37. 序列化二叉树.py
KevenGe/LeetCode-Solutions
train
1
6145b38b46939d669f7d673572337bb8cad2a191
[ "question_wrapper = get_question_or_404(request.user, quiz_id, round_id, question_id)\ncontext = {'quiz_id': quiz_id, 'round_id': round_id, 'question_id': question_id, 'question': question_wrapper.host_info(), 'question_types': dict(QuestionType.choices), 'slide_types': dict(SlideType.choices), 'QuestionClass': Que...
<|body_start_0|> question_wrapper = get_question_or_404(request.user, quiz_id, round_id, question_id) context = {'quiz_id': quiz_id, 'round_id': round_id, 'question_id': question_id, 'question': question_wrapper.host_info(), 'question_types': dict(QuestionType.choices), 'slide_types': dict(SlideType.cho...
EditQuestionView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EditQuestionView: def get(self, request, quiz_id, round_id, question_id): """Render the form to edit a question Attributes: None""" <|body_0|> def post(self, request, quiz_id, round_id, question_id): """Edit the attributes of the question model Attributes: PARAMS: - ...
stack_v2_sparse_classes_36k_train_001592
2,660
no_license
[ { "docstring": "Render the form to edit a question Attributes: None", "name": "get", "signature": "def get(self, request, quiz_id, round_id, question_id)" }, { "docstring": "Edit the attributes of the question model Attributes: PARAMS: - quiz_id, round_id, question_id POST: - question_info", ...
2
stack_v2_sparse_classes_30k_test_001157
Implement the Python class `EditQuestionView` described below. Class description: Implement the EditQuestionView class. Method signatures and docstrings: - def get(self, request, quiz_id, round_id, question_id): Render the form to edit a question Attributes: None - def post(self, request, quiz_id, round_id, question_...
Implement the Python class `EditQuestionView` described below. Class description: Implement the EditQuestionView class. Method signatures and docstrings: - def get(self, request, quiz_id, round_id, question_id): Render the form to edit a question Attributes: None - def post(self, request, quiz_id, round_id, question_...
923b8af85eda6136d4e815deb0f5c76ce22e2fc0
<|skeleton|> class EditQuestionView: def get(self, request, quiz_id, round_id, question_id): """Render the form to edit a question Attributes: None""" <|body_0|> def post(self, request, quiz_id, round_id, question_id): """Edit the attributes of the question model Attributes: PARAMS: - ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EditQuestionView: def get(self, request, quiz_id, round_id, question_id): """Render the form to edit a question Attributes: None""" question_wrapper = get_question_or_404(request.user, quiz_id, round_id, question_id) context = {'quiz_id': quiz_id, 'round_id': round_id, 'question_id': q...
the_stack_v2_python_sparse
quiz/views/question.py
AananthV/Quizwin
train
0
8c2363927715a59342ab27d3fd50eeccf8cfff05
[ "super(KafkaHandler, self).__init__()\nself.connection_string = settings.get('hostname') + ':' + str(settings.get('port'))\nself.connection_timeout = settings.get('connection_timeout', 15)\nself.username = settings.get('username')\nself.password = settings.get('password')\nself.security_protocol = 'PLAINTEXT'\nself...
<|body_start_0|> super(KafkaHandler, self).__init__() self.connection_string = settings.get('hostname') + ':' + str(settings.get('port')) self.connection_timeout = settings.get('connection_timeout', 15) self.username = settings.get('username') self.password = settings.get('passwo...
KafkaHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KafkaHandler: def __init__(self, settings): """Initializes the ￿KafkaHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler type name.""" <|body_0|> def send_message(self, queue_name, body): """Sends messag...
stack_v2_sparse_classes_36k_train_001593
3,302
permissive
[ { "docstring": "Initializes the ￿KafkaHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler type name.", "name": "__init__", "signature": "def __init__(self, settings)" }, { "docstring": "Sends message to the queue :param queue_name: ...
3
stack_v2_sparse_classes_30k_train_003653
Implement the Python class `KafkaHandler` described below. Class description: Implement the KafkaHandler class. Method signatures and docstrings: - def __init__(self, settings): Initializes the ￿KafkaHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler ty...
Implement the Python class `KafkaHandler` described below. Class description: Implement the KafkaHandler class. Method signatures and docstrings: - def __init__(self, settings): Initializes the ￿KafkaHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler ty...
db34927e4c45df93438e2b7129f01388f1a34753
<|skeleton|> class KafkaHandler: def __init__(self, settings): """Initializes the ￿KafkaHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler type name.""" <|body_0|> def send_message(self, queue_name, body): """Sends messag...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KafkaHandler: def __init__(self, settings): """Initializes the ￿KafkaHandler with it's special connection string :param settings: settings from `mlapp > config.py` depending on handler type name.""" super(KafkaHandler, self).__init__() self.connection_string = settings.get('hostname') ...
the_stack_v2_python_sparse
mlapp/handlers/message_queues/kafka_handler.py
ghas-results/mlapp
train
0
665a7577576b79da151d370760a12b2bea42c378
[ "connect_mysql = ConnectMysql(host='202.104.102.166', user='rz_cm_master', password='TbLuENLK', port=3306, db='jydb')\nday = \"'2019-03-31'\"\nsql = 'SELECT m.roe,s.SecuCode FROM jydb.LC_MainIndexNew m INNER JOIN jydb.SecuMain s ON (m.CompanyCode = s.CompanyCode) INNER JOIN jydb.CT_SystemConst c ON (s.ListedState =...
<|body_start_0|> connect_mysql = ConnectMysql(host='202.104.102.166', user='rz_cm_master', password='TbLuENLK', port=3306, db='jydb') day = "'2019-03-31'" sql = 'SELECT m.roe,s.SecuCode FROM jydb.LC_MainIndexNew m INNER JOIN jydb.SecuMain s ON (m.CompanyCode = s.CompanyCode) INNER JOIN jydb.CT_S...
TestAssetFinancialAnalysis
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAssetFinancialAnalysis: def test_check_roe_threshold_greater_zero(): """检查数据库绩优股(roe大于0)阈值数据准确性""" <|body_0|> def test_check_roe_threshold_less_zero(): """检查数据库绩优股(roe小于0)阈值数据准确性""" <|body_1|> <|end_skeleton|> <|body_start_0|> connect_mysql = Co...
stack_v2_sparse_classes_36k_train_001594
4,578
no_license
[ { "docstring": "检查数据库绩优股(roe大于0)阈值数据准确性", "name": "test_check_roe_threshold_greater_zero", "signature": "def test_check_roe_threshold_greater_zero()" }, { "docstring": "检查数据库绩优股(roe小于0)阈值数据准确性", "name": "test_check_roe_threshold_less_zero", "signature": "def test_check_roe_threshold_less...
2
null
Implement the Python class `TestAssetFinancialAnalysis` described below. Class description: Implement the TestAssetFinancialAnalysis class. Method signatures and docstrings: - def test_check_roe_threshold_greater_zero(): 检查数据库绩优股(roe大于0)阈值数据准确性 - def test_check_roe_threshold_less_zero(): 检查数据库绩优股(roe小于0)阈值数据准确性
Implement the Python class `TestAssetFinancialAnalysis` described below. Class description: Implement the TestAssetFinancialAnalysis class. Method signatures and docstrings: - def test_check_roe_threshold_greater_zero(): 检查数据库绩优股(roe大于0)阈值数据准确性 - def test_check_roe_threshold_less_zero(): 检查数据库绩优股(roe小于0)阈值数据准确性 <|sk...
eae782a78ffde1276a0812a43d7deefb0bdedeb4
<|skeleton|> class TestAssetFinancialAnalysis: def test_check_roe_threshold_greater_zero(): """检查数据库绩优股(roe大于0)阈值数据准确性""" <|body_0|> def test_check_roe_threshold_less_zero(): """检查数据库绩优股(roe小于0)阈值数据准确性""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAssetFinancialAnalysis: def test_check_roe_threshold_greater_zero(): """检查数据库绩优股(roe大于0)阈值数据准确性""" connect_mysql = ConnectMysql(host='202.104.102.166', user='rz_cm_master', password='TbLuENLK', port=3306, db='jydb') day = "'2019-03-31'" sql = 'SELECT m.roe,s.SecuCode FROM j...
the_stack_v2_python_sparse
test_case/combination_master/fund_research/fund_page/position_analysis/test_asset_financial_analysis.py
liufubin-git/python
train
0
b03ee099689419212b91298a1cc3a692aa82e7e9
[ "prices = [(s.count('0'), s.count('1')) for s in strs]\nprices = Counter(prices)\ndp = [[0] * (n + 1) for i in range(m + 1)]\n\ndef zeroOnePack2D(c0, c1, w=1):\n for i in range(m, c0 - 1, -1):\n for j in range(n, c1 - 1, -1):\n dp[i][j] = max(dp[i][j], dp[i - c0][j - c1] + w)\n\ndef completePac...
<|body_start_0|> prices = [(s.count('0'), s.count('1')) for s in strs] prices = Counter(prices) dp = [[0] * (n + 1) for i in range(m + 1)] def zeroOnePack2D(c0, c1, w=1): for i in range(m, c0 - 1, -1): for j in range(n, c1 - 1, -1): dp[i][...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaxForm(self, strs, m, n): """:type strs: List[str] :type m: int of 0 :type n: int of 1 :rtype: int""" <|body_0|> def naiveFindMaxForm(self, strs, m, n): """:type strs: List[str] :type m: int of 0 :type n: int of 1 :rtype: int""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_001595
6,980
no_license
[ { "docstring": ":type strs: List[str] :type m: int of 0 :type n: int of 1 :rtype: int", "name": "findMaxForm", "signature": "def findMaxForm(self, strs, m, n)" }, { "docstring": ":type strs: List[str] :type m: int of 0 :type n: int of 1 :rtype: int", "name": "naiveFindMaxForm", "signatur...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxForm(self, strs, m, n): :type strs: List[str] :type m: int of 0 :type n: int of 1 :rtype: int - def naiveFindMaxForm(self, strs, m, n): :type strs: List[str] :type m: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxForm(self, strs, m, n): :type strs: List[str] :type m: int of 0 :type n: int of 1 :rtype: int - def naiveFindMaxForm(self, strs, m, n): :type strs: List[str] :type m: ...
97533d53c8892b6519e99f344489fa4fd4c9ab93
<|skeleton|> class Solution: def findMaxForm(self, strs, m, n): """:type strs: List[str] :type m: int of 0 :type n: int of 1 :rtype: int""" <|body_0|> def naiveFindMaxForm(self, strs, m, n): """:type strs: List[str] :type m: int of 0 :type n: int of 1 :rtype: int""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMaxForm(self, strs, m, n): """:type strs: List[str] :type m: int of 0 :type n: int of 1 :rtype: int""" prices = [(s.count('0'), s.count('1')) for s in strs] prices = Counter(prices) dp = [[0] * (n + 1) for i in range(m + 1)] def zeroOnePack2D(c0, c1, ...
the_stack_v2_python_sparse
4. DP/474.py
proTao/leetcode
train
0
c1ed945590b8e6007dc6137ecad43fdbab680693
[ "super(EncodingDetectFilter, self).__init__(builder)\nself._normalize = self.builder.decoder.normalize\nself._meta = self._normalize('meta')", "normalize = self._normalize\niname = normalize(name)\nif iname == self._meta:\n adict = dict([(normalize(key), val) for key, val in attr])\n value = str(adict.get(n...
<|body_start_0|> super(EncodingDetectFilter, self).__init__(builder) self._normalize = self.builder.decoder.normalize self._meta = self._normalize('meta') <|end_body_0|> <|body_start_1|> normalize = self._normalize iname = normalize(name) if iname == self._meta: ...
Extract template encoding and pass it properly to the builder
EncodingDetectFilter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncodingDetectFilter: """Extract template encoding and pass it properly to the builder""" def __init__(self, builder): """Initialization""" <|body_0|> def handle_starttag(self, name, attr, closed, data): """Extract encoding from HTML meta element Here are samples...
stack_v2_sparse_classes_36k_train_001596
6,907
permissive
[ { "docstring": "Initialization", "name": "__init__", "signature": "def __init__(self, builder)" }, { "docstring": "Extract encoding from HTML meta element Here are samples for the expected formats:: <meta charset=\"utf-8\"> <!-- HTML5 --> <meta http-equiv=\"Content-Type\" content=\"text/html; ch...
3
stack_v2_sparse_classes_30k_train_020970
Implement the Python class `EncodingDetectFilter` described below. Class description: Extract template encoding and pass it properly to the builder Method signatures and docstrings: - def __init__(self, builder): Initialization - def handle_starttag(self, name, attr, closed, data): Extract encoding from HTML meta ele...
Implement the Python class `EncodingDetectFilter` described below. Class description: Extract template encoding and pass it properly to the builder Method signatures and docstrings: - def __init__(self, builder): Initialization - def handle_starttag(self, name, attr, closed, data): Extract encoding from HTML meta ele...
65a93080281f9ce5c0379e9dbb111f14965a8613
<|skeleton|> class EncodingDetectFilter: """Extract template encoding and pass it properly to the builder""" def __init__(self, builder): """Initialization""" <|body_0|> def handle_starttag(self, name, attr, closed, data): """Extract encoding from HTML meta element Here are samples...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncodingDetectFilter: """Extract template encoding and pass it properly to the builder""" def __init__(self, builder): """Initialization""" super(EncodingDetectFilter, self).__init__(builder) self._normalize = self.builder.decoder.normalize self._meta = self._normalize('me...
the_stack_v2_python_sparse
tdi/markup/soup/filters.py
ndparker/tdi
train
4
062285f3854f1e3ad28a9a746c17eb49a2c678ad
[ "self.Tc = Tc\nself.Pc = Pc\nself.Vc = Vc\nself.Tb = Tb\nself.structureIndex = structureIndex", "string = 'CriticalPointGroupContribution(Tc={0!r}, Pc={1!r}, Vc={2!r}, Tb={3!r}, structureIndex={4!r}'.format(self.Tc, self.Pc, self.Vc, self.Tb, self.structureIndex)\nstring += ')'\nreturn string" ]
<|body_start_0|> self.Tc = Tc self.Pc = Pc self.Vc = Vc self.Tb = Tb self.structureIndex = structureIndex <|end_body_0|> <|body_start_1|> string = 'CriticalPointGroupContribution(Tc={0!r}, Pc={1!r}, Vc={2!r}, Tb={3!r}, structureIndex={4!r}'.format(self.Tc, self.Pc, self....
Joback group contribution to estimate critical properties
CriticalPointGroupContribution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CriticalPointGroupContribution: """Joback group contribution to estimate critical properties""" def __init__(self, Tc=None, Pc=None, Vc=None, Tb=None, structureIndex=None): """Note that argument names are retained for backward compatibility with loading database files.""" <|b...
stack_v2_sparse_classes_36k_train_001597
26,300
permissive
[ { "docstring": "Note that argument names are retained for backward compatibility with loading database files.", "name": "__init__", "signature": "def __init__(self, Tc=None, Pc=None, Vc=None, Tb=None, structureIndex=None)" }, { "docstring": "Return a string representation that can be used to rec...
2
null
Implement the Python class `CriticalPointGroupContribution` described below. Class description: Joback group contribution to estimate critical properties Method signatures and docstrings: - def __init__(self, Tc=None, Pc=None, Vc=None, Tb=None, structureIndex=None): Note that argument names are retained for backward ...
Implement the Python class `CriticalPointGroupContribution` described below. Class description: Joback group contribution to estimate critical properties Method signatures and docstrings: - def __init__(self, Tc=None, Pc=None, Vc=None, Tb=None, structureIndex=None): Note that argument names are retained for backward ...
349a4af759cf8877197772cd7eaca1e51d46eff5
<|skeleton|> class CriticalPointGroupContribution: """Joback group contribution to estimate critical properties""" def __init__(self, Tc=None, Pc=None, Vc=None, Tb=None, structureIndex=None): """Note that argument names are retained for backward compatibility with loading database files.""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CriticalPointGroupContribution: """Joback group contribution to estimate critical properties""" def __init__(self, Tc=None, Pc=None, Vc=None, Tb=None, structureIndex=None): """Note that argument names are retained for backward compatibility with loading database files.""" self.Tc = Tc ...
the_stack_v2_python_sparse
rmgpy/data/transport.py
CanePan-cc/CanePanWorkshop
train
2
b12f3ded460bd861d96e6c39c5e81eed204ef662
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn MacOSGeneralDeviceConfiguration()", "from .app_list_item import AppListItem\nfrom .app_list_type import AppListType\nfrom .device_configuration import DeviceConfiguration\nfrom .required_password_type import RequiredPasswordType\nfrom ...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return MacOSGeneralDeviceConfiguration() <|end_body_0|> <|body_start_1|> from .app_list_item import AppListItem from .app_list_type import AppListType from .device_configuration import ...
This topic provides descriptions of the declared methods, properties and relationships exposed by the macOSGeneralDeviceConfiguration resource.
MacOSGeneralDeviceConfiguration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MacOSGeneralDeviceConfiguration: """This topic provides descriptions of the declared methods, properties and relationships exposed by the macOSGeneralDeviceConfiguration resource.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSGeneralDeviceConfiguration:...
stack_v2_sparse_classes_36k_train_001598
6,806
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: MacOSGeneralDeviceConfiguration", "name": "create_from_discriminator_value", "signature": "def create_from_d...
3
stack_v2_sparse_classes_30k_train_000798
Implement the Python class `MacOSGeneralDeviceConfiguration` described below. Class description: This topic provides descriptions of the declared methods, properties and relationships exposed by the macOSGeneralDeviceConfiguration resource. Method signatures and docstrings: - def create_from_discriminator_value(parse...
Implement the Python class `MacOSGeneralDeviceConfiguration` described below. Class description: This topic provides descriptions of the declared methods, properties and relationships exposed by the macOSGeneralDeviceConfiguration resource. Method signatures and docstrings: - def create_from_discriminator_value(parse...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class MacOSGeneralDeviceConfiguration: """This topic provides descriptions of the declared methods, properties and relationships exposed by the macOSGeneralDeviceConfiguration resource.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSGeneralDeviceConfiguration:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MacOSGeneralDeviceConfiguration: """This topic provides descriptions of the declared methods, properties and relationships exposed by the macOSGeneralDeviceConfiguration resource.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSGeneralDeviceConfiguration: """C...
the_stack_v2_python_sparse
msgraph/generated/models/mac_o_s_general_device_configuration.py
microsoftgraph/msgraph-sdk-python
train
135
3224c0598ce3b6cbd2dd18d804f8c3ec6cc792c4
[ "super(SI_SNR, self).__init__()\nself.eps = eps\nself.pit = pit", "B, C, S = Y.size()\nzero_mean_target = Y - torch.mean(Y, dim=-1, keepdim=True)\nzero_mean_estimate = Y_ - torch.mean(Y_, dim=-1, keepdim=True)\ns_target = torch.unsqueeze(zero_mean_target, dim=1)\ns_estimate = torch.unsqueeze(zero_mean_estimate, d...
<|body_start_0|> super(SI_SNR, self).__init__() self.eps = eps self.pit = pit <|end_body_0|> <|body_start_1|> B, C, S = Y.size() zero_mean_target = Y - torch.mean(Y, dim=-1, keepdim=True) zero_mean_estimate = Y_ - torch.mean(Y_, dim=-1, keepdim=True) s_target = t...
Scale Invariant Signal to Noise Ratio with support for PIT Training Adapted from: - https://github.com/kaituoxu/Conv-TasNet Attributes: eps {float} -- epsilon to avoid 0 division pit {bool} -- use pit training https://arxiv.org/abs/1607.00325
SI_SNR
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SI_SNR: """Scale Invariant Signal to Noise Ratio with support for PIT Training Adapted from: - https://github.com/kaituoxu/Conv-TasNet Attributes: eps {float} -- epsilon to avoid 0 division pit {bool} -- use pit training https://arxiv.org/abs/1607.00325""" def __init__(self: 'SI_SNR', eps: f...
stack_v2_sparse_classes_36k_train_001599
3,577
permissive
[ { "docstring": "Initialization Keyword Arguments: eps {float} -- epsilon to avoid 0 division (default: {1e-8}) pit {bool} -- use pit training (default: {False})", "name": "__init__", "signature": "def __init__(self: 'SI_SNR', eps: float=1e-08, pit: bool=False) -> None" }, { "docstring": "Forward...
2
stack_v2_sparse_classes_30k_train_015713
Implement the Python class `SI_SNR` described below. Class description: Scale Invariant Signal to Noise Ratio with support for PIT Training Adapted from: - https://github.com/kaituoxu/Conv-TasNet Attributes: eps {float} -- epsilon to avoid 0 division pit {bool} -- use pit training https://arxiv.org/abs/1607.00325 Met...
Implement the Python class `SI_SNR` described below. Class description: Scale Invariant Signal to Noise Ratio with support for PIT Training Adapted from: - https://github.com/kaituoxu/Conv-TasNet Attributes: eps {float} -- epsilon to avoid 0 division pit {bool} -- use pit training https://arxiv.org/abs/1607.00325 Met...
2415502fa8a38d4624b1c71e926f1723bdc8535c
<|skeleton|> class SI_SNR: """Scale Invariant Signal to Noise Ratio with support for PIT Training Adapted from: - https://github.com/kaituoxu/Conv-TasNet Attributes: eps {float} -- epsilon to avoid 0 division pit {bool} -- use pit training https://arxiv.org/abs/1607.00325""" def __init__(self: 'SI_SNR', eps: f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SI_SNR: """Scale Invariant Signal to Noise Ratio with support for PIT Training Adapted from: - https://github.com/kaituoxu/Conv-TasNet Attributes: eps {float} -- epsilon to avoid 0 division pit {bool} -- use pit training https://arxiv.org/abs/1607.00325""" def __init__(self: 'SI_SNR', eps: float=1e-08, p...
the_stack_v2_python_sparse
SPK_SP_Master/wass/convtasnet/loss.py
adamwhitakerwilson/speaker_separation
train
0