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
717eaf184672192011f9c1d82fb150668a807ab3
[ "fully_specified_config = {}\nif default_config is not None:\n fully_specified_config = copy.deepcopy(default_config)\nif extra_config_key is not None:\n fully_specified_config[extra_config_key] = {}\nif dict_reference is None:\n return fully_specified_config\nhandler = ConfigHandler()\nupdate_config = han...
<|body_start_0|> fully_specified_config = {} if default_config is not None: fully_specified_config = copy.deepcopy(default_config) if extra_config_key is not None: fully_specified_config[extra_config_key] = {} if dict_reference is None: return fully_sp...
Domain Configuration object base class
Config
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Config: """Domain Configuration object base class""" def read_config(self, dict_reference, default_config=None, extra_config_key=None, verbose=False): """Reads a config given a reference to a dictionary. :param dict_reference: A reference to a dictionary. Can be an existing dictionar...
stack_v2_sparse_classes_36k_train_014800
7,465
no_license
[ { "docstring": "Reads a config given a reference to a dictionary. :param dict_reference: A reference to a dictionary. Can be an existing dictionary or a filename to be read in. :param default_config: Default None. When specified, this dictionary contains default key/value pairs which are to be used when the key...
5
null
Implement the Python class `Config` described below. Class description: Domain Configuration object base class Method signatures and docstrings: - def read_config(self, dict_reference, default_config=None, extra_config_key=None, verbose=False): Reads a config given a reference to a dictionary. :param dict_reference: ...
Implement the Python class `Config` described below. Class description: Domain Configuration object base class Method signatures and docstrings: - def read_config(self, dict_reference, default_config=None, extra_config_key=None, verbose=False): Reads a config given a reference to a dictionary. :param dict_reference: ...
99c2f401d6c4b203ee439ed607985a918d0c3c7e
<|skeleton|> class Config: """Domain Configuration object base class""" def read_config(self, dict_reference, default_config=None, extra_config_key=None, verbose=False): """Reads a config given a reference to a dictionary. :param dict_reference: A reference to a dictionary. Can be an existing dictionar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Config: """Domain Configuration object base class""" def read_config(self, dict_reference, default_config=None, extra_config_key=None, verbose=False): """Reads a config given a reference to a dictionary. :param dict_reference: A reference to a dictionary. Can be an existing dictionary or a filena...
the_stack_v2_python_sparse
framework/domain/config.py
Cognizant-CDB-AIA-BAI-AI-OI/LEAF-ENN-Training-V2
train
0
98622b1f23d7e2811ca5992810ecc57ed6fe18e3
[ "num_stations = len(gas)\ngain_at_each_station = []\nfor i in range(num_stations):\n gain_at_each_station.append(gas[i] - cost[i])\ni = 0\nwhile i < num_stations:\n end = self.canCompleteCircuitWithStart(gain_at_each_station, i)\n if end == i + num_stations:\n return i\n elif i < num_stations:\n ...
<|body_start_0|> num_stations = len(gas) gain_at_each_station = [] for i in range(num_stations): gain_at_each_station.append(gas[i] - cost[i]) i = 0 while i < num_stations: end = self.canCompleteCircuitWithStart(gain_at_each_station, i) if end ...
pointer
Solution2
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution2: """pointer""" def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_0|> def canCompleteCircuitWithStart(self, gain_at_each_station, start): """:rtype: the end index""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k_train_014801
2,721
permissive
[ { "docstring": ":type gas: List[int] :type cost: List[int] :rtype: int", "name": "canCompleteCircuit", "signature": "def canCompleteCircuit(self, gas, cost)" }, { "docstring": ":rtype: the end index", "name": "canCompleteCircuitWithStart", "signature": "def canCompleteCircuitWithStart(se...
2
stack_v2_sparse_classes_30k_train_015479
Implement the Python class `Solution2` described below. Class description: pointer Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): :type gas: List[int] :type cost: List[int] :rtype: int - def canCompleteCircuitWithStart(self, gain_at_each_station, start): :rtype: the end index
Implement the Python class `Solution2` described below. Class description: pointer Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): :type gas: List[int] :type cost: List[int] :rtype: int - def canCompleteCircuitWithStart(self, gain_at_each_station, start): :rtype: the end index <|skeleton...
1ed22267156fb968671731c2e983b0e65f670750
<|skeleton|> class Solution2: """pointer""" def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_0|> def canCompleteCircuitWithStart(self, gain_at_each_station, start): """:rtype: the end index""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution2: """pointer""" def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" num_stations = len(gas) gain_at_each_station = [] for i in range(num_stations): gain_at_each_station.append(gas[i] - cost[i]) ...
the_stack_v2_python_sparse
leetcode/134.py
pingrunhuang/CodeChallenge
train
0
a514e6a22086c20949c71e6a4a2981ccf60fb5e1
[ "def _pars(a, b):\n return '%.3f,%.3f' % (a, b)\nfit = continuous()\nxgrid = np.linspace(1, 40, 100)\ny_norm = norm.pdf(xgrid, *fit['norm'])\ny_lognorm = lognorm.pdf(xgrid, *fit['lognorm'])\ny_gamma = gamma.pdf(xgrid, *fit['gamma'])\nfig1, ax1 = plt.subplots()\nax1.hist(fit['x'], bins=15, alpha=0.6, density=True...
<|body_start_0|> def _pars(a, b): return '%.3f,%.3f' % (a, b) fit = continuous() xgrid = np.linspace(1, 40, 100) y_norm = norm.pdf(xgrid, *fit['norm']) y_lognorm = lognorm.pdf(xgrid, *fit['lognorm']) y_gamma = gamma.pdf(xgrid, *fit['gamma']) fig1, ax1 ...
Plotting of the module.
plot
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class plot: """Plotting of the module.""" def continuous(save=False, name='img/parameters/symptoms.png'): """Plot symptoms' duration fitted distributions. After call, use `plt.show()` to show the figure. Args: save (bool, optional): Whether to save the figure, defaultly not. name (str, opt...
stack_v2_sparse_classes_36k_train_014802
5,322
no_license
[ { "docstring": "Plot symptoms' duration fitted distributions. After call, use `plt.show()` to show the figure. Args: save (bool, optional): Whether to save the figure, defaultly not. name (str, optional): Path to save the plot to.", "name": "continuous", "signature": "def continuous(save=False, name='im...
2
stack_v2_sparse_classes_30k_test_000299
Implement the Python class `plot` described below. Class description: Plotting of the module. Method signatures and docstrings: - def continuous(save=False, name='img/parameters/symptoms.png'): Plot symptoms' duration fitted distributions. After call, use `plt.show()` to show the figure. Args: save (bool, optional): ...
Implement the Python class `plot` described below. Class description: Plotting of the module. Method signatures and docstrings: - def continuous(save=False, name='img/parameters/symptoms.png'): Plot symptoms' duration fitted distributions. After call, use `plt.show()` to show the figure. Args: save (bool, optional): ...
3c79101a0e5e83dd24499e628e5c506137ce69c2
<|skeleton|> class plot: """Plotting of the module.""" def continuous(save=False, name='img/parameters/symptoms.png'): """Plot symptoms' duration fitted distributions. After call, use `plt.show()` to show the figure. Args: save (bool, optional): Whether to save the figure, defaultly not. name (str, opt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class plot: """Plotting of the module.""" def continuous(save=False, name='img/parameters/symptoms.png'): """Plot symptoms' duration fitted distributions. After call, use `plt.show()` to show the figure. Args: save (bool, optional): Whether to save the figure, defaultly not. name (str, optional): Path ...
the_stack_v2_python_sparse
src/covid19/symptoms.py
martinbenes1996/732A64
train
0
0fb98998ddaeef5c4bbfdb856d3133c142f8a643
[ "pk = kwargs.get('pk')\nqapp = Qapp.objects.filter(id=pk).first()\nif check_can_edit(qapp, request.user):\n qapp_approval = QappApproval.objects.filter(qapp_id=pk).first()\n approval_form = QappApprovalForm(instance=qapp_approval)\n return render(request, self.template_name, {'object': qapp, 'form': QappFo...
<|body_start_0|> pk = kwargs.get('pk') qapp = Qapp.objects.filter(id=pk).first() if check_can_edit(qapp, request.user): qapp_approval = QappApproval.objects.filter(qapp_id=pk).first() approval_form = QappApprovalForm(instance=qapp_approval) return render(reque...
View for editing the details of an existing Qapp instance.
QappEdit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QappEdit: """View for editing the details of an existing Qapp instance.""" def get(self, request, *args, **kwargs): """GET QAPP Edit page. Override default get request so we can verify the user has edit privileges, either through super status or team membership.""" <|body_0|>...
stack_v2_sparse_classes_36k_train_014803
36,787
no_license
[ { "docstring": "GET QAPP Edit page. Override default get request so we can verify the user has edit privileges, either through super status or team membership.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Qapp Edit Form validation and redirect.", ...
2
null
Implement the Python class `QappEdit` described below. Class description: View for editing the details of an existing Qapp instance. Method signatures and docstrings: - def get(self, request, *args, **kwargs): GET QAPP Edit page. Override default get request so we can verify the user has edit privileges, either throu...
Implement the Python class `QappEdit` described below. Class description: View for editing the details of an existing Qapp instance. Method signatures and docstrings: - def get(self, request, *args, **kwargs): GET QAPP Edit page. Override default get request so we can verify the user has edit privileges, either throu...
ee419afa3c9f4b9ef3b30b62b693cfac956ce5b4
<|skeleton|> class QappEdit: """View for editing the details of an existing Qapp instance.""" def get(self, request, *args, **kwargs): """GET QAPP Edit page. Override default get request so we can verify the user has edit privileges, either through super status or team membership.""" <|body_0|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QappEdit: """View for editing the details of an existing Qapp instance.""" def get(self, request, *args, **kwargs): """GET QAPP Edit page. Override default get request so we can verify the user has edit privileges, either through super status or team membership.""" pk = kwargs.get('pk') ...
the_stack_v2_python_sparse
DataSearch/qar5/views.py
USEPA/FoodWaste
train
1
1a6504d75865be8c6cdf3af1e6e71496e4ae5d4c
[ "if (user := request.get('hass_user')) is None:\n return Context()\nreturn Context(user_id=user.id)", "try:\n msg = json_bytes(result)\nexcept JSON_ENCODE_EXCEPTIONS as err:\n _LOGGER.error('Unable to serialize to JSON. Bad data found at %s', format_unserializable_data(find_paths_unserializable_data(resu...
<|body_start_0|> if (user := request.get('hass_user')) is None: return Context() return Context(user_id=user.id) <|end_body_0|> <|body_start_1|> try: msg = json_bytes(result) except JSON_ENCODE_EXCEPTIONS as err: _LOGGER.error('Unable to serialize to ...
Base view for all views.
HomeAssistantView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HomeAssistantView: """Base view for all views.""" def context(request: web.Request) -> Context: """Generate a context from a request.""" <|body_0|> def json(result: Any, status_code: HTTPStatus | int=HTTPStatus.OK, headers: LooseHeaders | None=None) -> web.Response: ...
stack_v2_sparse_classes_36k_train_014804
5,761
permissive
[ { "docstring": "Generate a context from a request.", "name": "context", "signature": "def context(request: web.Request) -> Context" }, { "docstring": "Return a JSON response.", "name": "json", "signature": "def json(result: Any, status_code: HTTPStatus | int=HTTPStatus.OK, headers: Loose...
4
null
Implement the Python class `HomeAssistantView` described below. Class description: Base view for all views. Method signatures and docstrings: - def context(request: web.Request) -> Context: Generate a context from a request. - def json(result: Any, status_code: HTTPStatus | int=HTTPStatus.OK, headers: LooseHeaders | ...
Implement the Python class `HomeAssistantView` described below. Class description: Base view for all views. Method signatures and docstrings: - def context(request: web.Request) -> Context: Generate a context from a request. - def json(result: Any, status_code: HTTPStatus | int=HTTPStatus.OK, headers: LooseHeaders | ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class HomeAssistantView: """Base view for all views.""" def context(request: web.Request) -> Context: """Generate a context from a request.""" <|body_0|> def json(result: Any, status_code: HTTPStatus | int=HTTPStatus.OK, headers: LooseHeaders | None=None) -> web.Response: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HomeAssistantView: """Base view for all views.""" def context(request: web.Request) -> Context: """Generate a context from a request.""" if (user := request.get('hass_user')) is None: return Context() return Context(user_id=user.id) def json(result: Any, status_co...
the_stack_v2_python_sparse
homeassistant/components/http/view.py
home-assistant/core
train
35,501
aad0bf99b79d76a1c8563c40a4dd035058c8ae4f
[ "add_failed = kwargs.get('add_failed', False)\nadd_succeeded = kwargs.get('add_succeeded', False)\nbook_list = get_object_or_404(models.List, id=list_id)\nbook_list.raise_visible_to_user(request.user)\nif is_api_request(request):\n return ActivitypubResponse(book_list.to_activity(**request.GET))\nif (redirect_op...
<|body_start_0|> add_failed = kwargs.get('add_failed', False) add_succeeded = kwargs.get('add_succeeded', False) book_list = get_object_or_404(models.List, id=list_id) book_list.raise_visible_to_user(request.user) if is_api_request(request): return ActivitypubResponse...
book list page
List
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class List: """book list page""" def get(self, request, list_id, **kwargs): """display a book list""" <|body_0|> def post(self, request, list_id): """edit a list""" <|body_1|> <|end_skeleton|> <|body_start_0|> add_failed = kwargs.get('add_failed', Fal...
stack_v2_sparse_classes_36k_train_014805
11,267
no_license
[ { "docstring": "display a book list", "name": "get", "signature": "def get(self, request, list_id, **kwargs)" }, { "docstring": "edit a list", "name": "post", "signature": "def post(self, request, list_id)" } ]
2
stack_v2_sparse_classes_30k_train_002822
Implement the Python class `List` described below. Class description: book list page Method signatures and docstrings: - def get(self, request, list_id, **kwargs): display a book list - def post(self, request, list_id): edit a list
Implement the Python class `List` described below. Class description: book list page Method signatures and docstrings: - def get(self, request, list_id, **kwargs): display a book list - def post(self, request, list_id): edit a list <|skeleton|> class List: """book list page""" def get(self, request, list_id...
0f8da5b738047f3c34d60d93f59bdedd8f797224
<|skeleton|> class List: """book list page""" def get(self, request, list_id, **kwargs): """display a book list""" <|body_0|> def post(self, request, list_id): """edit a list""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class List: """book list page""" def get(self, request, list_id, **kwargs): """display a book list""" add_failed = kwargs.get('add_failed', False) add_succeeded = kwargs.get('add_succeeded', False) book_list = get_object_or_404(models.List, id=list_id) book_list.raise_vi...
the_stack_v2_python_sparse
bookwyrm/views/list/list.py
bookwyrm-social/bookwyrm
train
1,398
dec29a4f8baab199f4434bfcf2e9b7d995cd7460
[ "if divisor == 0:\n raise ZeroDivisionError\nif abs(divisor) == 1:\n result = dividend if 1 == divisor else -dividend\n return min(2 ** 31 - 1, max(-2 ** 31, result))\nsign = (dividend >= 0) == (divisor >= 0)\nresult = 0\n_divisor = abs(divisor)\n_dividend = abs(dividend)\nwhile _divisor <= _dividend:\n ...
<|body_start_0|> if divisor == 0: raise ZeroDivisionError if abs(divisor) == 1: result = dividend if 1 == divisor else -dividend return min(2 ** 31 - 1, max(-2 ** 31, result)) sign = (dividend >= 0) == (divisor >= 0) result = 0 _divisor = abs(d...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def divide(self, dividend: int, divisor: int) -> int: """二分法 :param int divisor :param int dividend :return int""" <|body_0|> def _multi_divide(self, divisor, dividend): """翻倍除法,如果可以被除,则下一步除数翻倍,直至除数大于被除数, 返回商加总的结果与被除数的剩余值; 这里就不做异常处理了; :param int divisor :pa...
stack_v2_sparse_classes_36k_train_014806
3,032
no_license
[ { "docstring": "二分法 :param int divisor :param int dividend :return int", "name": "divide", "signature": "def divide(self, dividend: int, divisor: int) -> int" }, { "docstring": "翻倍除法,如果可以被除,则下一步除数翻倍,直至除数大于被除数, 返回商加总的结果与被除数的剩余值; 这里就不做异常处理了; :param int divisor :param int dividend :return tuple res...
2
stack_v2_sparse_classes_30k_train_005658
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def divide(self, dividend: int, divisor: int) -> int: 二分法 :param int divisor :param int dividend :return int - def _multi_divide(self, divisor, dividend): 翻倍除法,如果可以被除,则下一步除数翻倍,直至...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def divide(self, dividend: int, divisor: int) -> int: 二分法 :param int divisor :param int dividend :return int - def _multi_divide(self, divisor, dividend): 翻倍除法,如果可以被除,则下一步除数翻倍,直至...
5da202faea8f607e8144960e8ff1eb233aed97ab
<|skeleton|> class Solution: def divide(self, dividend: int, divisor: int) -> int: """二分法 :param int divisor :param int dividend :return int""" <|body_0|> def _multi_divide(self, divisor, dividend): """翻倍除法,如果可以被除,则下一步除数翻倍,直至除数大于被除数, 返回商加总的结果与被除数的剩余值; 这里就不做异常处理了; :param int divisor :pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def divide(self, dividend: int, divisor: int) -> int: """二分法 :param int divisor :param int dividend :return int""" if divisor == 0: raise ZeroDivisionError if abs(divisor) == 1: result = dividend if 1 == divisor else -dividend return min(2 ...
the_stack_v2_python_sparse
刷题/29.两数相除.py
Stella2019/study
train
1
1fc573ccdf558fe76bfea68d0df17e9e1cbc66e6
[ "super().__init__(summary_writer=summary_writer, log_dir=log_dir)\nself.interval = interval\nself.epoch_level = epoch_level\nself.batch_transform = batch_transform\nself.output_transform = output_transform\nself.global_iter_transform = global_iter_transform\nself.index = index\nself.frame_dim = frame_dim\nself.max_...
<|body_start_0|> super().__init__(summary_writer=summary_writer, log_dir=log_dir) self.interval = interval self.epoch_level = epoch_level self.batch_transform = batch_transform self.output_transform = output_transform self.global_iter_transform = global_iter_transform ...
TensorBoardImageHandler is an Ignite Event handler that can visualize images, labels and outputs as 2D/3D images. 2D output (shape in Batch, channel, H, W) will be shown as simple image using the first element in the batch, for 3D to ND output (shape in Batch, channel, H, W, D) input, each of ``self.max_channels`` numb...
TensorBoardImageHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TensorBoardImageHandler: """TensorBoardImageHandler is an Ignite Event handler that can visualize images, labels and outputs as 2D/3D images. 2D output (shape in Batch, channel, H, W) will be shown as simple image using the first element in the batch, for 3D to ND output (shape in Batch, channel,...
stack_v2_sparse_classes_36k_train_014807
23,325
permissive
[ { "docstring": "Args: summary_writer: user can specify TensorBoard or TensorBoardX SummaryWriter, default to create a new TensorBoard writer. log_dir: if using default SummaryWriter, write logs to this directory, default is `./runs`. interval: plot content from engine.state every N epochs or every N iterations,...
3
null
Implement the Python class `TensorBoardImageHandler` described below. Class description: TensorBoardImageHandler is an Ignite Event handler that can visualize images, labels and outputs as 2D/3D images. 2D output (shape in Batch, channel, H, W) will be shown as simple image using the first element in the batch, for 3D...
Implement the Python class `TensorBoardImageHandler` described below. Class description: TensorBoardImageHandler is an Ignite Event handler that can visualize images, labels and outputs as 2D/3D images. 2D output (shape in Batch, channel, H, W) will be shown as simple image using the first element in the batch, for 3D...
e48c3e2c741fa3fc705c4425d17ac4a5afac6c47
<|skeleton|> class TensorBoardImageHandler: """TensorBoardImageHandler is an Ignite Event handler that can visualize images, labels and outputs as 2D/3D images. 2D output (shape in Batch, channel, H, W) will be shown as simple image using the first element in the batch, for 3D to ND output (shape in Batch, channel,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TensorBoardImageHandler: """TensorBoardImageHandler is an Ignite Event handler that can visualize images, labels and outputs as 2D/3D images. 2D output (shape in Batch, channel, H, W) will be shown as simple image using the first element in the batch, for 3D to ND output (shape in Batch, channel, H, W, D) inp...
the_stack_v2_python_sparse
monai/handlers/tensorboard_handlers.py
Project-MONAI/MONAI
train
4,805
1adc618aef64a56acde9078374245a604d2fdec6
[ "cur = head\ncount = 0\nwhile cur and count != k:\n cur = cur.next\n count += 1\nif count == k:\n cur = self.reverseKGroup(cur, k)\n while count > 0:\n count -= 1\n temp = head.next\n head.next = cur\n cur = head\n head = temp\n head = cur\nreturn head", "curr = h...
<|body_start_0|> cur = head count = 0 while cur and count != k: cur = cur.next count += 1 if count == k: cur = self.reverseKGroup(cur, k) while count > 0: count -= 1 temp = head.next head.next...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseKGroup(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_0|> def reverseKGroup_self(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_014808
1,575
no_license
[ { "docstring": ":type head: ListNode :type k: int :rtype: ListNode", "name": "reverseKGroup", "signature": "def reverseKGroup(self, head, k)" }, { "docstring": ":type head: ListNode :type k: int :rtype: ListNode", "name": "reverseKGroup_self", "signature": "def reverseKGroup_self(self, h...
2
stack_v2_sparse_classes_30k_train_013804
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseKGroup(self, head, k): :type head: ListNode :type k: int :rtype: ListNode - def reverseKGroup_self(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 reverseKGroup(self, head, k): :type head: ListNode :type k: int :rtype: ListNode - def reverseKGroup_self(self, head, k): :type head: ListNode :type k: int :rtype: ListNode ...
ea492ec864b50547214ecbbb2cdeeac21e70229b
<|skeleton|> class Solution: def reverseKGroup(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_0|> def reverseKGroup_self(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 reverseKGroup(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" cur = head count = 0 while cur and count != k: cur = cur.next count += 1 if count == k: cur = self.reverseKGroup(cur, k) ...
the_stack_v2_python_sparse
25_reverse_nodes_in_k-group/sol.py
lianke123321/leetcode_sol
train
0
5dbcada26174abe15d3fab2e2fa678c1c8888d83
[ "super().__init__(*args, **kwargs)\nself.data_type = data_type\nself.processor = processor or (lambda x: x)\nself.allow_fallback = allow_fallback", "if isinstance(value, self.data_type):\n return self.processor(value)\ntry:\n return self.processor(self.data_type(value))\nexcept ValueError:\n if not self....
<|body_start_0|> super().__init__(*args, **kwargs) self.data_type = data_type self.processor = processor or (lambda x: x) self.allow_fallback = allow_fallback <|end_body_0|> <|body_start_1|> if isinstance(value, self.data_type): return self.processor(value) t...
Basic property to handle int, Decimal and other basic types.
Basic
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Basic: """Basic property to handle int, Decimal and other basic types.""" def __init__(self, *args: str, data_type: typing.Type, processor: typing.Optional[typing.Callable[[T], T]]=None, allow_fallback: bool=False, **kwargs): """Init method.""" <|body_0|> def handle(self...
stack_v2_sparse_classes_36k_train_014809
4,580
permissive
[ { "docstring": "Init method.", "name": "__init__", "signature": "def __init__(self, *args: str, data_type: typing.Type, processor: typing.Optional[typing.Callable[[T], T]]=None, allow_fallback: bool=False, **kwargs)" }, { "docstring": "Handle value.", "name": "handle", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_015697
Implement the Python class `Basic` described below. Class description: Basic property to handle int, Decimal and other basic types. Method signatures and docstrings: - def __init__(self, *args: str, data_type: typing.Type, processor: typing.Optional[typing.Callable[[T], T]]=None, allow_fallback: bool=False, **kwargs)...
Implement the Python class `Basic` described below. Class description: Basic property to handle int, Decimal and other basic types. Method signatures and docstrings: - def __init__(self, *args: str, data_type: typing.Type, processor: typing.Optional[typing.Callable[[T], T]]=None, allow_fallback: bool=False, **kwargs)...
00909d2c47d158bfeac300e1d7477c4f87c52096
<|skeleton|> class Basic: """Basic property to handle int, Decimal and other basic types.""" def __init__(self, *args: str, data_type: typing.Type, processor: typing.Optional[typing.Callable[[T], T]]=None, allow_fallback: bool=False, **kwargs): """Init method.""" <|body_0|> def handle(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Basic: """Basic property to handle int, Decimal and other basic types.""" def __init__(self, *args: str, data_type: typing.Type, processor: typing.Optional[typing.Callable[[T], T]]=None, allow_fallback: bool=False, **kwargs): """Init method.""" super().__init__(*args, **kwargs) se...
the_stack_v2_python_sparse
knowit/properties/general.py
ratoaq2/knowit
train
27
0758e01a61c678cae2d52e40fa6f40297fbc07a2
[ "integral_map = input_map.clone()\nintegral_map = integral_map.cumsum(dim=-1)\nintegral_map = integral_map.cumsum(dim=-2)\nreturn integral_map", "F = integral_map\nbbox_2d[:, ::2].clamp_(min=0, max=1)\nbbox_2d[:, 1::2].clamp_(min=0, max=1)\nbbox_2d[:, ::2] = bbox_2d[:, ::2] * (F.shape[3] - 1)\nbbox_2d[:, 1::2] = ...
<|body_start_0|> integral_map = input_map.clone() integral_map = integral_map.cumsum(dim=-1) integral_map = integral_map.cumsum(dim=-2) return integral_map <|end_body_0|> <|body_start_1|> F = integral_map bbox_2d[:, ::2].clamp_(min=0, max=1) bbox_2d[:, 1::2].clam...
IntegralMapGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IntegralMapGenerator: def generate(input_map): """Args: input_map: shape(NCHW)""" <|body_0|> def calc(integral_map, bbox_2d, min_area=1): """Args: bbox_2d: shape(N, 4)""" <|body_1|> <|end_skeleton|> <|body_start_0|> integral_map = input_map.clone() ...
stack_v2_sparse_classes_36k_train_014810
2,605
no_license
[ { "docstring": "Args: input_map: shape(NCHW)", "name": "generate", "signature": "def generate(input_map)" }, { "docstring": "Args: bbox_2d: shape(N, 4)", "name": "calc", "signature": "def calc(integral_map, bbox_2d, min_area=1)" } ]
2
stack_v2_sparse_classes_30k_train_019505
Implement the Python class `IntegralMapGenerator` described below. Class description: Implement the IntegralMapGenerator class. Method signatures and docstrings: - def generate(input_map): Args: input_map: shape(NCHW) - def calc(integral_map, bbox_2d, min_area=1): Args: bbox_2d: shape(N, 4)
Implement the Python class `IntegralMapGenerator` described below. Class description: Implement the IntegralMapGenerator class. Method signatures and docstrings: - def generate(input_map): Args: input_map: shape(NCHW) - def calc(integral_map, bbox_2d, min_area=1): Args: bbox_2d: shape(N, 4) <|skeleton|> class Integr...
f0a2a00c15acb2f1ece59b75bced0e27f7119640
<|skeleton|> class IntegralMapGenerator: def generate(input_map): """Args: input_map: shape(NCHW)""" <|body_0|> def calc(integral_map, bbox_2d, min_area=1): """Args: bbox_2d: shape(N, 4)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IntegralMapGenerator: def generate(input_map): """Args: input_map: shape(NCHW)""" integral_map = input_map.clone() integral_map = integral_map.cumsum(dim=-1) integral_map = integral_map.cumsum(dim=-2) return integral_map def calc(integral_map, bbox_2d, min_area=1):...
the_stack_v2_python_sparse
utils/integral_map.py
kl456123/MonoDIS
train
12
3446c4114aa05f19ee41c46430386b9415f3ec7b
[ "if timeout is not None:\n end_time = timeout + time.time()\n\ndef make_future(item):\n future = self.submit(filter_function, item)\n future._item = item\n return future\nfutures = tuple(map(make_future, iterable))\nfutures_iterator = concurrent.futures.as_completed(futures) if as_completed else futures...
<|body_start_0|> if timeout is not None: end_time = timeout + time.time() def make_future(item): future = self.submit(filter_function, item) future._item = item return future futures = tuple(map(make_future, iterable)) futures_iterator = c...
An executor with extra functionality for `map` and `filter`. This is a subclass of `concurrent.futures.Executor`, which is a manager for parallelizing tasks. What this adds over `concurrent.futures.Executor`: - A `.filter` method, which operates like the builtin `filter` except it's parallelized with the executor. - An...
BaseCuteExecutor
[ "BSD-3-Clause", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseCuteExecutor: """An executor with extra functionality for `map` and `filter`. This is a subclass of `concurrent.futures.Executor`, which is a manager for parallelizing tasks. What this adds over `concurrent.futures.Executor`: - A `.filter` method, which operates like the builtin `filter` exce...
stack_v2_sparse_classes_36k_train_014811
4,997
permissive
[ { "docstring": "Get a parallelized version of `filter(filter_function, iterable)`. Specify `as_completed=False` to get the results that were calculated first to be returned first, instead of using the order of `iterable`.", "name": "filter", "signature": "def filter(self, filter_function, iterable, time...
2
null
Implement the Python class `BaseCuteExecutor` described below. Class description: An executor with extra functionality for `map` and `filter`. This is a subclass of `concurrent.futures.Executor`, which is a manager for parallelizing tasks. What this adds over `concurrent.futures.Executor`: - A `.filter` method, which ...
Implement the Python class `BaseCuteExecutor` described below. Class description: An executor with extra functionality for `map` and `filter`. This is a subclass of `concurrent.futures.Executor`, which is a manager for parallelizing tasks. What this adds over `concurrent.futures.Executor`: - A `.filter` method, which ...
cb9ef64b48f1d03275484d707dc5079b6701ad0c
<|skeleton|> class BaseCuteExecutor: """An executor with extra functionality for `map` and `filter`. This is a subclass of `concurrent.futures.Executor`, which is a manager for parallelizing tasks. What this adds over `concurrent.futures.Executor`: - A `.filter` method, which operates like the builtin `filter` exce...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseCuteExecutor: """An executor with extra functionality for `map` and `filter`. This is a subclass of `concurrent.futures.Executor`, which is a manager for parallelizing tasks. What this adds over `concurrent.futures.Executor`: - A `.filter` method, which operates like the builtin `filter` except it's paral...
the_stack_v2_python_sparse
python_toolbox/future_tools.py
cool-RR/python_toolbox
train
130
2f8dfa2dbce137eb9548ccb02aa6a1acf5836866
[ "self.left_top_point = ShapePoint(start_end_points[0])\nself.right_top_point = ShapePoint(start_end_points[1])\nself.bins = bins\nself.count = count\nstep = abs((self.right_top_point[0] - self.left_top_point[0]) / count)\nx_start_point = self.left_top_point[0]\nx_end_point = x_start_point + step\ny_point = self.lef...
<|body_start_0|> self.left_top_point = ShapePoint(start_end_points[0]) self.right_top_point = ShapePoint(start_end_points[1]) self.bins = bins self.count = count step = abs((self.right_top_point[0] - self.left_top_point[0]) / count) x_start_point = self.left_top_point[0] ...
Funnels
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Funnels: def __init__(self, start_end_points: Tuple[tuple, tuple], funnel: Funnel, count: int, bins: Union[int, float], annot: bool=False, *args, **kwargs): """Object-constructor for the funnels. Inside init, you could pass all needed variables that will be passed to the Funnel init as w...
stack_v2_sparse_classes_36k_train_014812
3,894
no_license
[ { "docstring": "Object-constructor for the funnels. Inside init, you could pass all needed variables that will be passed to the Funnel init as well. Args: start_end_points (Tuple[tuple, tuple]): Left top and right top points. ((x1,y1), (x2,y2)). funnel (Funnel): Class for the funnel building. Must be inherited ...
2
stack_v2_sparse_classes_30k_val_000168
Implement the Python class `Funnels` described below. Class description: Implement the Funnels class. Method signatures and docstrings: - def __init__(self, start_end_points: Tuple[tuple, tuple], funnel: Funnel, count: int, bins: Union[int, float], annot: bool=False, *args, **kwargs): Object-constructor for the funne...
Implement the Python class `Funnels` described below. Class description: Implement the Funnels class. Method signatures and docstrings: - def __init__(self, start_end_points: Tuple[tuple, tuple], funnel: Funnel, count: int, bins: Union[int, float], annot: bool=False, *args, **kwargs): Object-constructor for the funne...
290bf56ef888283a0225939ed8b1f87445e506d0
<|skeleton|> class Funnels: def __init__(self, start_end_points: Tuple[tuple, tuple], funnel: Funnel, count: int, bins: Union[int, float], annot: bool=False, *args, **kwargs): """Object-constructor for the funnels. Inside init, you could pass all needed variables that will be passed to the Funnel init as w...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Funnels: def __init__(self, start_end_points: Tuple[tuple, tuple], funnel: Funnel, count: int, bins: Union[int, float], annot: bool=False, *args, **kwargs): """Object-constructor for the funnels. Inside init, you could pass all needed variables that will be passed to the Funnel init as well. Args: sta...
the_stack_v2_python_sparse
classes/funnels.py
mohovkm/habr_manim
train
0
0240f446b4530d7523fe7206109111eba4654ccf
[ "password = self.cleaned_data.get('password')\npassword_confirm = self.cleaned_data.get('password_confirm')\nprint('-----' + str(password))\nprint('-----' + str(password_confirm))\nif password and password_confirm and (password != password_confirm):\n raise forms.ValidationError(\"Passwords don't match\")\nretur...
<|body_start_0|> password = self.cleaned_data.get('password') password_confirm = self.cleaned_data.get('password_confirm') print('-----' + str(password)) print('-----' + str(password_confirm)) if password and password_confirm and (password != password_confirm): raise ...
A form for creating new users. Includes all the required fields, plus a repeated password.
UserCreateForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserCreateForm: """A form for creating new users. Includes all the required fields, plus a repeated password.""" def clean_password_confirm(self): """Validate password confirm Returns:""" <|body_0|> def save(self, commit=True): """Save changes to user info Args: ...
stack_v2_sparse_classes_36k_train_014813
2,266
no_license
[ { "docstring": "Validate password confirm Returns:", "name": "clean_password_confirm", "signature": "def clean_password_confirm(self)" }, { "docstring": "Save changes to user info Args: commit: Returns:", "name": "save", "signature": "def save(self, commit=True)" } ]
2
stack_v2_sparse_classes_30k_train_007768
Implement the Python class `UserCreateForm` described below. Class description: A form for creating new users. Includes all the required fields, plus a repeated password. Method signatures and docstrings: - def clean_password_confirm(self): Validate password confirm Returns: - def save(self, commit=True): Save change...
Implement the Python class `UserCreateForm` described below. Class description: A form for creating new users. Includes all the required fields, plus a repeated password. Method signatures and docstrings: - def clean_password_confirm(self): Validate password confirm Returns: - def save(self, commit=True): Save change...
c76ffcb530ccf95ecacfd448c600eb207c9152f7
<|skeleton|> class UserCreateForm: """A form for creating new users. Includes all the required fields, plus a repeated password.""" def clean_password_confirm(self): """Validate password confirm Returns:""" <|body_0|> def save(self, commit=True): """Save changes to user info Args: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserCreateForm: """A form for creating new users. Includes all the required fields, plus a repeated password.""" def clean_password_confirm(self): """Validate password confirm Returns:""" password = self.cleaned_data.get('password') password_confirm = self.cleaned_data.get('passwo...
the_stack_v2_python_sparse
db-demo/manage_user/forms.py
nmrenyi/CodeDancePedia
train
3
b29b1071fccf738c04e7abde0ba95ee352f7f0e9
[ "sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\ntry:\n sock.sendto(message.encode('utf-8'), ('127.0.0.1', port))\nfinally:\n sock.close()", "sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\nsock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\ntry:\n sock.bind(('127.0.0.1', port))...
<|body_start_0|> sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: sock.sendto(message.encode('utf-8'), ('127.0.0.1', port)) finally: sock.close() <|end_body_0|> <|body_start_1|> sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.sets...
This class provides a simple server and client interface to send pings via the local network. It is mainly used to dynamically update the pipeline settings after they got changed by the various configurators.
UDPListenerService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UDPListenerService: """This class provides a simple server and client interface to send pings via the local network. It is mainly used to dynamically update the pipeline settings after they got changed by the various configurators.""" def ping(port, message='PING'): """Sends a given ...
stack_v2_sparse_classes_36k_train_014814
2,904
permissive
[ { "docstring": "Sends a given message to a given port and immediately returns", "name": "ping", "signature": "def ping(port, message='PING')" }, { "docstring": "Listens to a given port, and calls callback in case a message arrives", "name": "__listen", "signature": "def __listen(port, ca...
4
stack_v2_sparse_classes_30k_test_000743
Implement the Python class `UDPListenerService` described below. Class description: This class provides a simple server and client interface to send pings via the local network. It is mainly used to dynamically update the pipeline settings after they got changed by the various configurators. Method signatures and doc...
Implement the Python class `UDPListenerService` described below. Class description: This class provides a simple server and client interface to send pings via the local network. It is mainly used to dynamically update the pipeline settings after they got changed by the various configurators. Method signatures and doc...
b5672ff3bc1d475bb9b67099f2b38d2a157ae0ac
<|skeleton|> class UDPListenerService: """This class provides a simple server and client interface to send pings via the local network. It is mainly used to dynamically update the pipeline settings after they got changed by the various configurators.""" def ping(port, message='PING'): """Sends a given ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UDPListenerService: """This class provides a simple server and client interface to send pings via the local network. It is mainly used to dynamically update the pipeline settings after they got changed by the various configurators.""" def ping(port, message='PING'): """Sends a given message to a ...
the_stack_v2_python_sparse
rpcore/util/udp_listener_service.py
aimoonchen/RenderPipeline
train
0
fe63c7cf4605ba7a73fb1667aa80103c9aa6e3eb
[ "if not ('email' in self._errors or 'email2' in self._errors):\n email = self.cleaned_data.get('email', 'A')\n email2 = self.cleaned_data.get('email2', 'B')\n if email != email2:\n self._errors['email'] = self.error_class(['This field does not match E-mail confirmation.'])\n self._errors['ema...
<|body_start_0|> if not ('email' in self._errors or 'email2' in self._errors): email = self.cleaned_data.get('email', 'A') email2 = self.cleaned_data.get('email2', 'B') if email != email2: self._errors['email'] = self.error_class(['This field does not match E-...
Form to register a user and organization (i.e. billing profile) at the same time.
PersonalRegistrationForm
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PersonalRegistrationForm: """Form to register a user and organization (i.e. billing profile) at the same time.""" def clean(self): """Validates that both emails as well as both passwords respectively match.""" <|body_0|> def clean_email(self): """Normalizes email...
stack_v2_sparse_classes_36k_train_014815
12,024
permissive
[ { "docstring": "Validates that both emails as well as both passwords respectively match.", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Normalizes emails in all lowercase.", "name": "clean_email", "signature": "def clean_email(self)" }, { "docstring": "Norma...
6
null
Implement the Python class `PersonalRegistrationForm` described below. Class description: Form to register a user and organization (i.e. billing profile) at the same time. Method signatures and docstrings: - def clean(self): Validates that both emails as well as both passwords respectively match. - def clean_email(se...
Implement the Python class `PersonalRegistrationForm` described below. Class description: Form to register a user and organization (i.e. billing profile) at the same time. Method signatures and docstrings: - def clean(self): Validates that both emails as well as both passwords respectively match. - def clean_email(se...
029bfcd9d4b04478950b829aeb0a92f5fd31776e
<|skeleton|> class PersonalRegistrationForm: """Form to register a user and organization (i.e. billing profile) at the same time.""" def clean(self): """Validates that both emails as well as both passwords respectively match.""" <|body_0|> def clean_email(self): """Normalizes email...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PersonalRegistrationForm: """Form to register a user and organization (i.e. billing profile) at the same time.""" def clean(self): """Validates that both emails as well as both passwords respectively match.""" if not ('email' in self._errors or 'email2' in self._errors): email...
the_stack_v2_python_sparse
testsite/views/auth.py
djaodjin/djaodjin-saas
train
503
0a9d33eea2d268ae3fe814ddacdf66a3c86f3764
[ "super().__init__()\nself.keys = parse_lookup_key(target_field)\nself.key = self.keys[-1]", "try:\n if record.access:\n tokens = [grant.to_token() for grant in record.access.grants]\n parent_data = dict_lookup(data, self.keys, parent=True)\n parent_data[self.key] = tokens\nexcept KeyError:...
<|body_start_0|> super().__init__() self.keys = parse_lookup_key(target_field) self.key = self.keys[-1] <|end_body_0|> <|body_start_1|> try: if record.access: tokens = [grant.to_token() for grant in record.access.grants] parent_data = dict_loo...
Elasticsearch dumper extension for access grant tokens support. On dump, it uses the record's ``Access`` system field to generate tokens from the record's (access) ``Grants`` and dump them in the specified target field in the dictionary (per default: ``access.grant_tokens``). On load, it simply removes the target field...
GrantTokensDumperExt
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GrantTokensDumperExt: """Elasticsearch dumper extension for access grant tokens support. On dump, it uses the record's ``Access`` system field to generate tokens from the record's (access) ``Grants`` and dump them in the specified target field in the dictionary (per default: ``access.grant_tokens...
stack_v2_sparse_classes_36k_train_014816
1,783
permissive
[ { "docstring": "Constructor. :param target_field: dot separated path where to dump the tokens.", "name": "__init__", "signature": "def __init__(self, target_field)" }, { "docstring": "Dump the grant tokens to the data dictionary.", "name": "dump", "signature": "def dump(self, record, dat...
3
stack_v2_sparse_classes_30k_train_018571
Implement the Python class `GrantTokensDumperExt` described below. Class description: Elasticsearch dumper extension for access grant tokens support. On dump, it uses the record's ``Access`` system field to generate tokens from the record's (access) ``Grants`` and dump them in the specified target field in the diction...
Implement the Python class `GrantTokensDumperExt` described below. Class description: Elasticsearch dumper extension for access grant tokens support. On dump, it uses the record's ``Access`` system field to generate tokens from the record's (access) ``Grants`` and dump them in the specified target field in the diction...
b4bcc2e16df6048149177a6e1ebd514bdb6b0626
<|skeleton|> class GrantTokensDumperExt: """Elasticsearch dumper extension for access grant tokens support. On dump, it uses the record's ``Access`` system field to generate tokens from the record's (access) ``Grants`` and dump them in the specified target field in the dictionary (per default: ``access.grant_tokens...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GrantTokensDumperExt: """Elasticsearch dumper extension for access grant tokens support. On dump, it uses the record's ``Access`` system field to generate tokens from the record's (access) ``Grants`` and dump them in the specified target field in the dictionary (per default: ``access.grant_tokens``). On load,...
the_stack_v2_python_sparse
invenio_rdm_records/records/dumpers/access.py
ppanero/invenio-rdm-records
train
0
a4f0b3c357cc6e08d6d1b2b3b8c85aaa9dc5e0b6
[ "pval, qval = (p.val, q.val)\nnode = root\nwhile True:\n if min(pval, qval) < node.val and node.val < max(pval, qval) or node.val == pval or node.val == qval:\n return node\n if pval < node.val:\n node = node.left\n else:\n node = node.right", "pval, qval, rval = (p.val, q.val, root....
<|body_start_0|> pval, qval = (p.val, q.val) node = root while True: if min(pval, qval) < node.val and node.val < max(pval, qval) or node.val == pval or node.val == qval: return node if pval < node.val: node = node.left else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """Runtime: 90.61% Memory: 79.93%""" <|body_0|> def lowestCommonAncestorNaive(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """Runtime: 90.6...
stack_v2_sparse_classes_36k_train_014817
1,246
no_license
[ { "docstring": "Runtime: 90.61% Memory: 79.93%", "name": "lowestCommonAncestor", "signature": "def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode'" }, { "docstring": "Runtime: 90.61% Memory: 47.55%", "name": "lowestCommonAncestorNaive", "signature...
2
stack_v2_sparse_classes_30k_train_011717
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': Runtime: 90.61% Memory: 79.93% - def lowestCommonAncestorNaive(self, root: 'TreeNode...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': Runtime: 90.61% Memory: 79.93% - def lowestCommonAncestorNaive(self, root: 'TreeNode...
43dc2e70ef3594b2d0460b4d700618637885d2bd
<|skeleton|> class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """Runtime: 90.61% Memory: 79.93%""" <|body_0|> def lowestCommonAncestorNaive(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """Runtime: 90.6...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """Runtime: 90.61% Memory: 79.93%""" pval, qval = (p.val, q.val) node = root while True: if min(pval, qval) < node.val and node.val < max(pval, qval) or node.val ...
the_stack_v2_python_sparse
src/0235_Lowest_Common_Ancestor_Of_A_Binary_Search_Tree/solution.py
remiscarlet/1337codes
train
0
c899e22e9df7803cf7355350d79c20373d19a2d0
[ "options = super()._default_experiment_options()\noptions.gate_type = SXGate\noptions.add_sx = False\noptions.add_xp_circuit = False\noptions.repetitions = [1, 2, 3, 5, 7, 9, 11, 13, 15, 17, 21, 23, 25]\nreturn options", "options = super()._default_analysis_options()\noptions.angle_per_gate = np.pi / 2\noptions.p...
<|body_start_0|> options = super()._default_experiment_options() options.gate_type = SXGate options.add_sx = False options.add_xp_circuit = False options.repetitions = [1, 2, 3, 5, 7, 9, 11, 13, 15, 17, 21, 23, 25] return options <|end_body_0|> <|body_start_1|> o...
A fine amplitude experiment with all the options set for the :math:`\\pi/2`-rotation. # section: overview :class:`FineSXAmplitude` is a subclass of :class:`FineAmplitude` and is used to set the appropriate values for the default options.
FineSXAmplitude
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FineSXAmplitude: """A fine amplitude experiment with all the options set for the :math:`\\pi/2`-rotation. # section: overview :class:`FineSXAmplitude` is a subclass of :class:`FineAmplitude` and is used to set the appropriate values for the default options.""" def _default_experiment_options...
stack_v2_sparse_classes_36k_train_014818
14,447
permissive
[ { "docstring": "Default values for the fine amplitude experiment. Experiment Options: gate_type (Type): FineSXAmplitude calibrates an SXGate. add_sx (bool): This option is False by default when calibrating gates with a target angle per gate of :math:`\\\\pi/2` as this increases the sensitivity of the experiment...
2
stack_v2_sparse_classes_30k_train_001132
Implement the Python class `FineSXAmplitude` described below. Class description: A fine amplitude experiment with all the options set for the :math:`\\pi/2`-rotation. # section: overview :class:`FineSXAmplitude` is a subclass of :class:`FineAmplitude` and is used to set the appropriate values for the default options. ...
Implement the Python class `FineSXAmplitude` described below. Class description: A fine amplitude experiment with all the options set for the :math:`\\pi/2`-rotation. # section: overview :class:`FineSXAmplitude` is a subclass of :class:`FineAmplitude` and is used to set the appropriate values for the default options. ...
e95ad826943a58c2b2899feb0dd6952cb8a0f5cf
<|skeleton|> class FineSXAmplitude: """A fine amplitude experiment with all the options set for the :math:`\\pi/2`-rotation. # section: overview :class:`FineSXAmplitude` is a subclass of :class:`FineAmplitude` and is used to set the appropriate values for the default options.""" def _default_experiment_options...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FineSXAmplitude: """A fine amplitude experiment with all the options set for the :math:`\\pi/2`-rotation. # section: overview :class:`FineSXAmplitude` is a subclass of :class:`FineAmplitude` and is used to set the appropriate values for the default options.""" def _default_experiment_options(cls) -> Opti...
the_stack_v2_python_sparse
qiskit_experiments/library/calibration/fine_amplitude.py
abhishak3/qiskit-experiments
train
0
55a2cd8eccbbd05f72e82f8b640dc7225f97235f
[ "args = self.parser.parse_args()\nmaster = args.master_url\nremove = args.remove\nwarning = ''\nif remove:\n if 0 == redis.srem(MASTER_BLACKLIST_KEY, master):\n warning = 'The master was already not on the blacklist'\nelif 0 == redis.sadd(MASTER_BLACKLIST_KEY, master):\n warning = 'The master was alrea...
<|body_start_0|> args = self.parser.parse_args() master = args.master_url remove = args.remove warning = '' if remove: if 0 == redis.srem(MASTER_BLACKLIST_KEY, master): warning = 'The master was already not on the blacklist' elif 0 == redis.sad...
Endpoint for managing the Jenkins master blacklist. The blacklist is a set of Jenkins masters that Changes won't give jobs to. This is useful for gracefully removing a master temporarily without having to modify project configs.
JenkinsMasterBlacklistAPIView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JenkinsMasterBlacklistAPIView: """Endpoint for managing the Jenkins master blacklist. The blacklist is a set of Jenkins masters that Changes won't give jobs to. This is useful for gracefully removing a master temporarily without having to modify project configs.""" def post(self): ""...
stack_v2_sparse_classes_36k_train_014819
2,202
permissive
[ { "docstring": "Adds or removes a master from the blacklist. The post params should include the `master_url` to be added or removed. By default, the master will be added to the blacklist. Set `remove` to be true to remove the master. Responds with the current blacklist and a warning message if it was a noop.", ...
2
stack_v2_sparse_classes_30k_train_015184
Implement the Python class `JenkinsMasterBlacklistAPIView` described below. Class description: Endpoint for managing the Jenkins master blacklist. The blacklist is a set of Jenkins masters that Changes won't give jobs to. This is useful for gracefully removing a master temporarily without having to modify project conf...
Implement the Python class `JenkinsMasterBlacklistAPIView` described below. Class description: Endpoint for managing the Jenkins master blacklist. The blacklist is a set of Jenkins masters that Changes won't give jobs to. This is useful for gracefully removing a master temporarily without having to modify project conf...
ae5159498f239a48184accf811cf36be2eab1e96
<|skeleton|> class JenkinsMasterBlacklistAPIView: """Endpoint for managing the Jenkins master blacklist. The blacklist is a set of Jenkins masters that Changes won't give jobs to. This is useful for gracefully removing a master temporarily without having to modify project configs.""" def post(self): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JenkinsMasterBlacklistAPIView: """Endpoint for managing the Jenkins master blacklist. The blacklist is a set of Jenkins masters that Changes won't give jobs to. This is useful for gracefully removing a master temporarily without having to modify project configs.""" def post(self): """Adds or remo...
the_stack_v2_python_sparse
changes/api/jenkins_master_blacklist.py
getsentry/changes
train
6
0504d39c19d4a0d19ef084e4f71ae35eb99d31bc
[ "super(RelationalPointerNet, self).__init__()\nself.hidden_size = hidden_size\ninitializer = nn.initializer.TruncatedNormal(std=init_range)\nself.q = _build_linear(hidden_size, hidden_size, new_name(name, 'query_fc'), initializer)\nself.k = _build_linear(hidden_size, hidden_size, new_name(name, 'key_fc'), initializ...
<|body_start_0|> super(RelationalPointerNet, self).__init__() self.hidden_size = hidden_size initializer = nn.initializer.TruncatedNormal(std=init_range) self.q = _build_linear(hidden_size, hidden_size, new_name(name, 'query_fc'), initializer) self.k = _build_linear(hidden_size, ...
Pointer Netword with Relations
RelationalPointerNet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelationalPointerNet: """Pointer Netword with Relations""" def __init__(self, hidden_size, num_relations, init_range=0.02, name=None): """init of class Args: cfg (TYPE): NULL""" <|body_0|> def forward(self, queries, keys, relations, attn_bias=None): """relational...
stack_v2_sparse_classes_36k_train_014820
15,933
permissive
[ { "docstring": "init of class Args: cfg (TYPE): NULL", "name": "__init__", "signature": "def __init__(self, hidden_size, num_relations, init_range=0.02, name=None)" }, { "docstring": "relational attention forward. seq_len in `shape` means num queries/keys/values of attention Args: queries (TYPE)...
2
stack_v2_sparse_classes_30k_train_001701
Implement the Python class `RelationalPointerNet` described below. Class description: Pointer Netword with Relations Method signatures and docstrings: - def __init__(self, hidden_size, num_relations, init_range=0.02, name=None): init of class Args: cfg (TYPE): NULL - def forward(self, queries, keys, relations, attn_b...
Implement the Python class `RelationalPointerNet` described below. Class description: Pointer Netword with Relations Method signatures and docstrings: - def __init__(self, hidden_size, num_relations, init_range=0.02, name=None): init of class Args: cfg (TYPE): NULL - def forward(self, queries, keys, relations, attn_b...
b8ec015fa9e16c0a879c619ee1f2aab8a393c7bd
<|skeleton|> class RelationalPointerNet: """Pointer Netword with Relations""" def __init__(self, hidden_size, num_relations, init_range=0.02, name=None): """init of class Args: cfg (TYPE): NULL""" <|body_0|> def forward(self, queries, keys, relations, attn_bias=None): """relational...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RelationalPointerNet: """Pointer Netword with Relations""" def __init__(self, hidden_size, num_relations, init_range=0.02, name=None): """init of class Args: cfg (TYPE): NULL""" super(RelationalPointerNet, self).__init__() self.hidden_size = hidden_size initializer = nn.in...
the_stack_v2_python_sparse
NLP/Text2SQL-BASELINE/text2sql/models/relational_transformer.py
sserdoubleh/Research
train
10
cdab675144f7e3eb266d861ef8b867281b201894
[ "if num < 20:\n return self.lessThan20[num]\nres = ''\nfor i in range(len(self.thousands)):\n right = num % 1000\n if right != 0:\n res = self.getWords(right) + self.thousands[i] + ' ' + res\n num //= 1000\nreturn res.strip()", "if num == 0:\n return ''\nelif num < 20:\n return self.lessT...
<|body_start_0|> if num < 20: return self.lessThan20[num] res = '' for i in range(len(self.thousands)): right = num % 1000 if right != 0: res = self.getWords(right) + self.thousands[i] + ' ' + res num //= 1000 return res.str...
Solution
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numberToWords(self, num): """:type num: int :rtype: str""" <|body_0|> def getWords(self, num): """This function will convert any 1-3 digit number to words""" <|body_1|> <|end_skeleton|> <|body_start_0|> if num < 20: return ...
stack_v2_sparse_classes_36k_train_014821
1,834
permissive
[ { "docstring": ":type num: int :rtype: str", "name": "numberToWords", "signature": "def numberToWords(self, num)" }, { "docstring": "This function will convert any 1-3 digit number to words", "name": "getWords", "signature": "def getWords(self, num)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numberToWords(self, num): :type num: int :rtype: str - def getWords(self, num): This function will convert any 1-3 digit number to words
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numberToWords(self, num): :type num: int :rtype: str - def getWords(self, num): This function will convert any 1-3 digit number to words <|skeleton|> class Solution: de...
4c21ab38b75389cfb71f12f995e3860e4cd8641a
<|skeleton|> class Solution: def numberToWords(self, num): """:type num: int :rtype: str""" <|body_0|> def getWords(self, num): """This function will convert any 1-3 digit number to words""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numberToWords(self, num): """:type num: int :rtype: str""" if num < 20: return self.lessThan20[num] res = '' for i in range(len(self.thousands)): right = num % 1000 if right != 0: res = self.getWords(right) + sel...
the_stack_v2_python_sparse
leetcode/273-Hard-Integer-To-English-Words/answer.py
BenDataAnalyst/Practice-Coding-Questions
train
0
bd0f1abfcf830758fb58ba5e12d93d44f79d7085
[ "super(FCModel, self).__init__()\nsizes.insert(0, n_features)\nlayers = [nn.Linear(size_in, size_out) for size_in, size_out in zip(sizes[:-1], sizes[1:])]\nself.input_norm = nn.LayerNorm(n_features) if input_norm else nn.Identity()\nself.activation = nn.Identity() if activation is None else instantiate_class('torch...
<|body_start_0|> super(FCModel, self).__init__() sizes.insert(0, n_features) layers = [nn.Linear(size_in, size_out) for size_in, size_out in zip(sizes[:-1], sizes[1:])] self.input_norm = nn.LayerNorm(n_features) if input_norm else nn.Identity() self.activation = nn.Identity() if ...
This class represents a fully connected neural network model with given layer sizes and activation function.
FCModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FCModel: """This class represents a fully connected neural network model with given layer sizes and activation function.""" def __init__(self, sizes, input_norm, activation, dropout, n_features): """:param sizes: list of layer sizes (excluding the input layer size which is given by n...
stack_v2_sparse_classes_36k_train_014822
21,238
no_license
[ { "docstring": ":param sizes: list of layer sizes (excluding the input layer size which is given by n_features parameter) :param input_norm: flag indicating whether to perform layer normalization on the input :param activation: name of the PyTorch activation function, e.g. Sigmoid or Tanh :param dropout: dropou...
2
stack_v2_sparse_classes_30k_test_001045
Implement the Python class `FCModel` described below. Class description: This class represents a fully connected neural network model with given layer sizes and activation function. Method signatures and docstrings: - def __init__(self, sizes, input_norm, activation, dropout, n_features): :param sizes: list of layer ...
Implement the Python class `FCModel` described below. Class description: This class represents a fully connected neural network model with given layer sizes and activation function. Method signatures and docstrings: - def __init__(self, sizes, input_norm, activation, dropout, n_features): :param sizes: list of layer ...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class FCModel: """This class represents a fully connected neural network model with given layer sizes and activation function.""" def __init__(self, sizes, input_norm, activation, dropout, n_features): """:param sizes: list of layer sizes (excluding the input layer size which is given by n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FCModel: """This class represents a fully connected neural network model with given layer sizes and activation function.""" def __init__(self, sizes, input_norm, activation, dropout, n_features): """:param sizes: list of layer sizes (excluding the input layer size which is given by n_features par...
the_stack_v2_python_sparse
generated/test_allegro_allRank.py
jansel/pytorch-jit-paritybench
train
35
6597a1467ff0993df9996ef2a714c2700249dc3e
[ "self.config = config\nself.model = PairwiseGMF(config)\nself.regs = config['regs']\nself.batch_size = config['batch_size']\nself.optimizer = torch.optim.Adam(self.model.parameters(), lr=config['lr'])\nsuper(PairwiseGMFEngine, self).__init__(config)", "assert hasattr(self, 'model'), 'Please specify the exact mode...
<|body_start_0|> self.config = config self.model = PairwiseGMF(config) self.regs = config['regs'] self.batch_size = config['batch_size'] self.optimizer = torch.optim.Adam(self.model.parameters(), lr=config['lr']) super(PairwiseGMFEngine, self).__init__(config) <|end_body_...
PairwiseGMFEngine Class.
PairwiseGMFEngine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PairwiseGMFEngine: """PairwiseGMFEngine Class.""" def __init__(self, config): """Initialize PairwiseGMFEngine CLass.""" <|body_0|> def train_single_batch(self, batch_data): """Train the model in a single batch. Args: batch_data (list): batch users, positive items...
stack_v2_sparse_classes_36k_train_014823
5,447
permissive
[ { "docstring": "Initialize PairwiseGMFEngine CLass.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Train the model in a single batch. Args: batch_data (list): batch users, positive items and negative items. Return: loss (float): batch loss.", "name": "trai...
4
stack_v2_sparse_classes_30k_train_012907
Implement the Python class `PairwiseGMFEngine` described below. Class description: PairwiseGMFEngine Class. Method signatures and docstrings: - def __init__(self, config): Initialize PairwiseGMFEngine CLass. - def train_single_batch(self, batch_data): Train the model in a single batch. Args: batch_data (list): batch ...
Implement the Python class `PairwiseGMFEngine` described below. Class description: PairwiseGMFEngine Class. Method signatures and docstrings: - def __init__(self, config): Initialize PairwiseGMFEngine CLass. - def train_single_batch(self, batch_data): Train the model in a single batch. Args: batch_data (list): batch ...
625189d5e1002a3edc27c3e3ce075fddf7ae1c92
<|skeleton|> class PairwiseGMFEngine: """PairwiseGMFEngine Class.""" def __init__(self, config): """Initialize PairwiseGMFEngine CLass.""" <|body_0|> def train_single_batch(self, batch_data): """Train the model in a single batch. Args: batch_data (list): batch users, positive items...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PairwiseGMFEngine: """PairwiseGMFEngine Class.""" def __init__(self, config): """Initialize PairwiseGMFEngine CLass.""" self.config = config self.model = PairwiseGMF(config) self.regs = config['regs'] self.batch_size = config['batch_size'] self.optimizer = ...
the_stack_v2_python_sparse
beta_rec/models/pairwise_gmf.py
beta-team/beta-recsys
train
156
c6b3d34ae0da53c8b13ed4e52dbf4f32fcfd3c98
[ "if self.donation_request.donation_for:\n recipient_name = self.donation_request.donation_for.user.first_name\n donation_center_name = self.donation_request.donation_center.name\n recipients = list(set(self.__class__.objects.filter(donation_request=self.donation_request).values_list('created_by', flat=True...
<|body_start_0|> if self.donation_request.donation_for: recipient_name = self.donation_request.donation_for.user.first_name donation_center_name = self.donation_request.donation_center.name recipients = list(set(self.__class__.objects.filter(donation_request=self.donation_req...
DonationRequestAppointment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DonationRequestAppointment: def send_donation_request_completion_email_to_donation_center(self): """Send notification email to donation center on activation.""" <|body_0|> def send_donation_request_completion_email_to_donation_recipient(self): """Send notification em...
stack_v2_sparse_classes_36k_train_014824
11,701
permissive
[ { "docstring": "Send notification email to donation center on activation.", "name": "send_donation_request_completion_email_to_donation_center", "signature": "def send_donation_request_completion_email_to_donation_center(self)" }, { "docstring": "Send notification email to donation recipient on ...
3
stack_v2_sparse_classes_30k_train_011468
Implement the Python class `DonationRequestAppointment` described below. Class description: Implement the DonationRequestAppointment class. Method signatures and docstrings: - def send_donation_request_completion_email_to_donation_center(self): Send notification email to donation center on activation. - def send_dona...
Implement the Python class `DonationRequestAppointment` described below. Class description: Implement the DonationRequestAppointment class. Method signatures and docstrings: - def send_donation_request_completion_email_to_donation_center(self): Send notification email to donation center on activation. - def send_dona...
9b12be9805979058202cec0e2205ceb7bf4a5b53
<|skeleton|> class DonationRequestAppointment: def send_donation_request_completion_email_to_donation_center(self): """Send notification email to donation center on activation.""" <|body_0|> def send_donation_request_completion_email_to_donation_recipient(self): """Send notification em...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DonationRequestAppointment: def send_donation_request_completion_email_to_donation_center(self): """Send notification email to donation center on activation.""" if self.donation_request.donation_for: recipient_name = self.donation_request.donation_for.user.first_name do...
the_stack_v2_python_sparse
bdsg_project-master/donations/models.py
imadarshj/covaid
train
0
904dd8277b28b9a9ce09b8bfdf80ae459d22e430
[ "super(CheckSubscriberVariable, self).__init__(name, topic_name=topic_name, topic_type=topic_type, clearing_policy=clearing_policy)\nself.variable_name = variable_name\nself.expected_value = expected_value\nself.comparison_operator = comparison_operator\nself.fail_if_no_data = fail_if_no_data\nself.fail_if_bad_comp...
<|body_start_0|> super(CheckSubscriberVariable, self).__init__(name, topic_name=topic_name, topic_type=topic_type, clearing_policy=clearing_policy) self.variable_name = variable_name self.expected_value = expected_value self.comparison_operator = comparison_operator self.fail_if_...
Check a subscriber to see if it has a specific variable and optionally whether that variable has a specific value. **Usage Patterns** *Sequence Guard*: RUNNING until there is a successful comparison - fail_if_no_data=False - fail_if_bad_comparison=False *Selector Priority Chooser*: FAILURE until there is a successful c...
CheckSubscriberVariable
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckSubscriberVariable: """Check a subscriber to see if it has a specific variable and optionally whether that variable has a specific value. **Usage Patterns** *Sequence Guard*: RUNNING until there is a successful comparison - fail_if_no_data=False - fail_if_bad_comparison=False *Selector Prior...
stack_v2_sparse_classes_36k_train_014825
15,393
permissive
[ { "docstring": ":param str name: name of the behaviour :param str topic_name: name of the topic to connect to :param obj topic_type: class of the message type (e.g. std_msgs.String) :param str variable_name: name of the variable to check :param obj expected_value: expected value of the variable :param bool fail...
2
stack_v2_sparse_classes_30k_train_014143
Implement the Python class `CheckSubscriberVariable` described below. Class description: Check a subscriber to see if it has a specific variable and optionally whether that variable has a specific value. **Usage Patterns** *Sequence Guard*: RUNNING until there is a successful comparison - fail_if_no_data=False - fail_...
Implement the Python class `CheckSubscriberVariable` described below. Class description: Check a subscriber to see if it has a specific variable and optionally whether that variable has a specific value. **Usage Patterns** *Sequence Guard*: RUNNING until there is a successful comparison - fail_if_no_data=False - fail_...
ce23ceadd0fa371aa911bce1cf3b0651a4b634f3
<|skeleton|> class CheckSubscriberVariable: """Check a subscriber to see if it has a specific variable and optionally whether that variable has a specific value. **Usage Patterns** *Sequence Guard*: RUNNING until there is a successful comparison - fail_if_no_data=False - fail_if_bad_comparison=False *Selector Prior...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CheckSubscriberVariable: """Check a subscriber to see if it has a specific variable and optionally whether that variable has a specific value. **Usage Patterns** *Sequence Guard*: RUNNING until there is a successful comparison - fail_if_no_data=False - fail_if_bad_comparison=False *Selector Priority Chooser*:...
the_stack_v2_python_sparse
py_trees/src/py_trees/subscribers.py
yujinrobot/py_trees_suite
train
0
f9da68ff3c5d221e8e907daea7350a1c6577e8ee
[ "self.expire_days = expire_days\nself.path = os.path.abspath(os.path.expanduser(path))\nos.makedirs(self.path, exist_ok=True)", "key_hash = _sha256(key.encode('utf-8')).hexdigest()\npath = os.path.join(self.path, key_hash)\nif os.path.isfile(path):\n age_days = (time.time() - os.stat(path).st_mtime) / 86400.0\...
<|body_start_0|> self.expire_days = expire_days self.path = os.path.abspath(os.path.expanduser(path)) os.makedirs(self.path, exist_ok=True) <|end_body_0|> <|body_start_1|> key_hash = _sha256(key.encode('utf-8')).hexdigest() path = os.path.join(self.path, key_hash) if os....
Store results of expensive operations on disk with an option to expire the results. This is used to cache the multi-gigabyte test corpuses in `tests/corpus.py`
DiskCache
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiskCache: """Store results of expensive operations on disk with an option to expire the results. This is used to cache the multi-gigabyte test corpuses in `tests/corpus.py`""" def __init__(self, path, expire_days=30): """Create a cache on disk for storing expensive results. Paramete...
stack_v2_sparse_classes_36k_train_014826
21,842
permissive
[ { "docstring": "Create a cache on disk for storing expensive results. Parameters -------------- path : str A writeable location on the current file path. expire_days : int or float How old should results be considered expired.", "name": "__init__", "signature": "def __init__(self, path, expire_days=30)"...
2
null
Implement the Python class `DiskCache` described below. Class description: Store results of expensive operations on disk with an option to expire the results. This is used to cache the multi-gigabyte test corpuses in `tests/corpus.py` Method signatures and docstrings: - def __init__(self, path, expire_days=30): Creat...
Implement the Python class `DiskCache` described below. Class description: Store results of expensive operations on disk with an option to expire the results. This is used to cache the multi-gigabyte test corpuses in `tests/corpus.py` Method signatures and docstrings: - def __init__(self, path, expire_days=30): Creat...
a2f89a6917d69e76914b09c7864acea3a5193f47
<|skeleton|> class DiskCache: """Store results of expensive operations on disk with an option to expire the results. This is used to cache the multi-gigabyte test corpuses in `tests/corpus.py`""" def __init__(self, path, expire_days=30): """Create a cache on disk for storing expensive results. Paramete...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DiskCache: """Store results of expensive operations on disk with an option to expire the results. This is used to cache the multi-gigabyte test corpuses in `tests/corpus.py`""" def __init__(self, path, expire_days=30): """Create a cache on disk for storing expensive results. Parameters ----------...
the_stack_v2_python_sparse
trimesh/caching.py
mikedh/trimesh
train
2,512
936d29a79be4fc8a21068f73c3390acb39e3dcfa
[ "super(QValueNetwork, self).__init__()\nself.action_dim = action_dim\nself.fcs1 = nn.Linear(input_size, 256)\nself.fcs2 = nn.Linear(256, 128)\nself.fca1 = nn.Linear(action_dim, 128)\nself.fc2 = nn.Linear(256, 128)\nself.fc3 = nn.Linear(128, output_size)", "s1 = F.relu(self.fcs1(state))\ns2 = F.relu(self.fcs2(s1))...
<|body_start_0|> super(QValueNetwork, self).__init__() self.action_dim = action_dim self.fcs1 = nn.Linear(input_size, 256) self.fcs2 = nn.Linear(256, 128) self.fca1 = nn.Linear(action_dim, 128) self.fc2 = nn.Linear(256, 128) self.fc3 = nn.Linear(128, output_size) ...
QValueNetwork
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QValueNetwork: def __init__(self, input_size, output_size, action_dim): """:param state_dim: Dimension of input state (int) :param action_dim: Dimension of input action (int) :return:""" <|body_0|> def forward(self, state, action): """returns Value function Q(s,a) ob...
stack_v2_sparse_classes_36k_train_014827
6,887
no_license
[ { "docstring": ":param state_dim: Dimension of input state (int) :param action_dim: Dimension of input action (int) :return:", "name": "__init__", "signature": "def __init__(self, input_size, output_size, action_dim)" }, { "docstring": "returns Value function Q(s,a) obtained from critic network ...
2
stack_v2_sparse_classes_30k_train_000585
Implement the Python class `QValueNetwork` described below. Class description: Implement the QValueNetwork class. Method signatures and docstrings: - def __init__(self, input_size, output_size, action_dim): :param state_dim: Dimension of input state (int) :param action_dim: Dimension of input action (int) :return: - ...
Implement the Python class `QValueNetwork` described below. Class description: Implement the QValueNetwork class. Method signatures and docstrings: - def __init__(self, input_size, output_size, action_dim): :param state_dim: Dimension of input state (int) :param action_dim: Dimension of input action (int) :return: - ...
5cd10dc52f301e7ee2192b63d67e1035e27ad2c2
<|skeleton|> class QValueNetwork: def __init__(self, input_size, output_size, action_dim): """:param state_dim: Dimension of input state (int) :param action_dim: Dimension of input action (int) :return:""" <|body_0|> def forward(self, state, action): """returns Value function Q(s,a) ob...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QValueNetwork: def __init__(self, input_size, output_size, action_dim): """:param state_dim: Dimension of input state (int) :param action_dim: Dimension of input action (int) :return:""" super(QValueNetwork, self).__init__() self.action_dim = action_dim self.fcs1 = nn.Linear(in...
the_stack_v2_python_sparse
algorithm/AC.py
scissorsf/pytorch_begin
train
0
18cdbe6041323b6a8abcc86502359e740eaad428
[ "if len(nums) <= 1:\n return len(nums)\nnums.sort()\nmax_length, count = (1, 1)\nfor i in range(len(nums) - 1):\n if nums[i] + 1 == arr[i + 1]:\n count += 1\n elif nums[i] != nums[i + 1]:\n count = 1\n max_length = max(count, max_length)\nreturn max_length", "if len(nums) <= 1:\n retu...
<|body_start_0|> if len(nums) <= 1: return len(nums) nums.sort() max_length, count = (1, 1) for i in range(len(nums) - 1): if nums[i] + 1 == arr[i + 1]: count += 1 elif nums[i] != nums[i + 1]: count = 1 max_l...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longest_consecutive(self, nums: List[int]) -> List[int]: """找出最大连续子串 Args: nums: 数组 Returns: 连续子串长度""" <|body_0|> def longest_consecutive_2(nums: List[int]) -> int: """找出最大的连续子串 Args: nums: 数组 Returns: 最大子串长度""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_014828
2,456
permissive
[ { "docstring": "找出最大连续子串 Args: nums: 数组 Returns: 连续子串长度", "name": "longest_consecutive", "signature": "def longest_consecutive(self, nums: List[int]) -> List[int]" }, { "docstring": "找出最大的连续子串 Args: nums: 数组 Returns: 最大子串长度", "name": "longest_consecutive_2", "signature": "def longest_con...
2
stack_v2_sparse_classes_30k_train_019926
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longest_consecutive(self, nums: List[int]) -> List[int]: 找出最大连续子串 Args: nums: 数组 Returns: 连续子串长度 - def longest_consecutive_2(nums: List[int]) -> int: 找出最大的连续子串 Args: nums: 数组...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longest_consecutive(self, nums: List[int]) -> List[int]: 找出最大连续子串 Args: nums: 数组 Returns: 连续子串长度 - def longest_consecutive_2(nums: List[int]) -> int: 找出最大的连续子串 Args: nums: 数组...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def longest_consecutive(self, nums: List[int]) -> List[int]: """找出最大连续子串 Args: nums: 数组 Returns: 连续子串长度""" <|body_0|> def longest_consecutive_2(nums: List[int]) -> int: """找出最大的连续子串 Args: nums: 数组 Returns: 最大子串长度""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longest_consecutive(self, nums: List[int]) -> List[int]: """找出最大连续子串 Args: nums: 数组 Returns: 连续子串长度""" if len(nums) <= 1: return len(nums) nums.sort() max_length, count = (1, 1) for i in range(len(nums) - 1): if nums[i] + 1 == arr[i...
the_stack_v2_python_sparse
src/leetcodepython/array/longest_consecutive_sequence _128.py
zhangyu345293721/leetcode
train
101
e333b0919d17302abd8715d38406453afc607ed3
[ "n = len(nums)\nif n <= 1:\n return 0\nmax_value = max(nums)\nmin_value = min(nums)\nbucket_size = n - 1\ninterval = (max_value - min_value) / float(bucket_size)\nMAX_INT, MIN_INT = (1 << 40, -(1 << 40))\nbucket_max = [MIN_INT for i in xrange(bucket_size)]\nbucket_min = [MAX_INT for i in xrange(bucket_size)]\nfo...
<|body_start_0|> n = len(nums) if n <= 1: return 0 max_value = max(nums) min_value = min(nums) bucket_size = n - 1 interval = (max_value - min_value) / float(bucket_size) MAX_INT, MIN_INT = (1 << 40, -(1 << 40)) bucket_max = [MIN_INT for i in x...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maximumGap(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maximumGap_radix_sort(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) if n <= 1: ...
stack_v2_sparse_classes_36k_train_014829
2,684
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maximumGap", "signature": "def maximumGap(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maximumGap_radix_sort", "signature": "def maximumGap_radix_sort(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximumGap(self, nums): :type nums: List[int] :rtype: int - def maximumGap_radix_sort(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximumGap(self, nums): :type nums: List[int] :rtype: int - def maximumGap_radix_sort(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def ma...
0a7aa09a2b95e4caca5b5123fb735ceb5c01e992
<|skeleton|> class Solution: def maximumGap(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maximumGap_radix_sort(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maximumGap(self, nums): """:type nums: List[int] :rtype: int""" n = len(nums) if n <= 1: return 0 max_value = max(nums) min_value = min(nums) bucket_size = n - 1 interval = (max_value - min_value) / float(bucket_size) MA...
the_stack_v2_python_sparse
maximum-gap.py
onestarshang/leetcode
train
0
a93298307b922dc52690651f676a911b32fedf83
[ "db_file = self.db_file\nif logger.isEnabledFor(logging.DEBUG):\n logger.debug(f'creating connection to {db_file}')\ncreated = False\nif not db_file.exists():\n if not self.create_db:\n raise DBError(f'database file {db_file} does not exist')\n if not db_file.parent.exists():\n if logger.isEn...
<|body_start_0|> db_file = self.db_file if logger.isEnabledFor(logging.DEBUG): logger.debug(f'creating connection to {db_file}') created = False if not db_file.exists(): if not self.create_db: raise DBError(f'database file {db_file} does not exist'...
An SQLite connection factory.
SqliteConnectionManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SqliteConnectionManager: """An SQLite connection factory.""" def create(self) -> sqlite3.Connection: """Create a connection by accessing the SQLite file. :raise DBError: if the SQLite file does not exist (caveat see :`obj:create_db`)""" <|body_0|> def drop(self): ...
stack_v2_sparse_classes_36k_train_014830
2,337
permissive
[ { "docstring": "Create a connection by accessing the SQLite file. :raise DBError: if the SQLite file does not exist (caveat see :`obj:create_db`)", "name": "create", "signature": "def create(self) -> sqlite3.Connection" }, { "docstring": "Delete the SQLite database file from the file system.", ...
2
stack_v2_sparse_classes_30k_train_019951
Implement the Python class `SqliteConnectionManager` described below. Class description: An SQLite connection factory. Method signatures and docstrings: - def create(self) -> sqlite3.Connection: Create a connection by accessing the SQLite file. :raise DBError: if the SQLite file does not exist (caveat see :`obj:creat...
Implement the Python class `SqliteConnectionManager` described below. Class description: An SQLite connection factory. Method signatures and docstrings: - def create(self) -> sqlite3.Connection: Create a connection by accessing the SQLite file. :raise DBError: if the SQLite file does not exist (caveat see :`obj:creat...
a1984c23adaad6e8f12fb6f77b2298aa6c4eff5d
<|skeleton|> class SqliteConnectionManager: """An SQLite connection factory.""" def create(self) -> sqlite3.Connection: """Create a connection by accessing the SQLite file. :raise DBError: if the SQLite file does not exist (caveat see :`obj:create_db`)""" <|body_0|> def drop(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SqliteConnectionManager: """An SQLite connection factory.""" def create(self) -> sqlite3.Connection: """Create a connection by accessing the SQLite file. :raise DBError: if the SQLite file does not exist (caveat see :`obj:create_db`)""" db_file = self.db_file if logger.isEnabledFo...
the_stack_v2_python_sparse
src/python/zensols/db/sqlite.py
plandes/dbutil
train
0
f052d9a5e800f73776479f22c6b748115ac3f49d
[ "value_bytes = list(pack('i', value))\nb = [0, 129, self.port, 17, 81, 2] + value_bytes\nawait self.send_message(f'reset pos to {value}', b)", "abs_pos = list(pack('i', pos))\nspeed = self._convert_speed_to_val(speed)\nb = [0, 129, self.port, 17, 13] + abs_pos + [speed, max_power, 126, 0]\nawait self.send_message...
<|body_start_0|> value_bytes = list(pack('i', value)) b = [0, 129, self.port, 17, 81, 2] + value_bytes await self.send_message(f'reset pos to {value}', b) <|end_body_0|> <|body_start_1|> abs_pos = list(pack('i', pos)) speed = self._convert_speed_to_val(speed) b = [0, 129...
TachoMotor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TachoMotor: async def reset_pos(self, value=0): """Reset absolute position of the motor to given `value`, i.e, current position will be reported as `value`. Examples:: await self.motor.rese_pos() # Reset current position to 0 Args: value (int) : Absolute position in degrees. Notes: Use c...
stack_v2_sparse_classes_36k_train_014831
29,020
permissive
[ { "docstring": "Reset absolute position of the motor to given `value`, i.e, current position will be reported as `value`. Examples:: await self.motor.rese_pos() # Reset current position to 0 Args: value (int) : Absolute position in degrees. Notes: Use command GotoAbsolutePosition * 0x00 = hub id * 0x81 = Port O...
4
stack_v2_sparse_classes_30k_train_014844
Implement the Python class `TachoMotor` described below. Class description: Implement the TachoMotor class. Method signatures and docstrings: - async def reset_pos(self, value=0): Reset absolute position of the motor to given `value`, i.e, current position will be reported as `value`. Examples:: await self.motor.rese...
Implement the Python class `TachoMotor` described below. Class description: Implement the TachoMotor class. Method signatures and docstrings: - async def reset_pos(self, value=0): Reset absolute position of the motor to given `value`, i.e, current position will be reported as `value`. Examples:: await self.motor.rese...
960bf1da68baef48e381b4c64e20d48793f89c7e
<|skeleton|> class TachoMotor: async def reset_pos(self, value=0): """Reset absolute position of the motor to given `value`, i.e, current position will be reported as `value`. Examples:: await self.motor.rese_pos() # Reset current position to 0 Args: value (int) : Absolute position in degrees. Notes: Use c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TachoMotor: async def reset_pos(self, value=0): """Reset absolute position of the motor to given `value`, i.e, current position will be reported as `value`. Examples:: await self.motor.rese_pos() # Reset current position to 0 Args: value (int) : Absolute position in degrees. Notes: Use command GotoAbs...
the_stack_v2_python_sparse
bricknil/sensor/motor.py
janvrany/bricknil
train
5
65726c34cc237923ead167730f30bb1963a2294f
[ "if root is None:\n return []\nres = []\nres.append(root.val)\nres.extend(self.preorderTraversal(root.left))\nres.extend(self.preorderTraversal(root.right))\nreturn res", "if root is None:\n return []\nres = []\nres.extend(self.inorderTraversal(root.left))\nres.append(root.val)\nres.extend(self.inorderTrave...
<|body_start_0|> if root is None: return [] res = [] res.append(root.val) res.extend(self.preorderTraversal(root.left)) res.extend(self.preorderTraversal(root.right)) return res <|end_body_0|> <|body_start_1|> if root is None: return [] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def inorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> def postorderTraversal(self, root): """:type root: Tree...
stack_v2_sparse_classes_36k_train_014832
1,813
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "preorderTraversal", "signature": "def preorderTraversal(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "inorderTraversal", "signature": "def inorderTraversal(self, root)" }, { "doc...
3
stack_v2_sparse_classes_30k_train_013889
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def inorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def postorderTraversal(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def inorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def postorderTraversal(self...
79dee7dab41830c4ff9e38858dad229815c719a0
<|skeleton|> class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def inorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> def postorderTraversal(self, root): """:type root: Tree...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" if root is None: return [] res = [] res.append(root.val) res.extend(self.preorderTraversal(root.left)) res.extend(self.preorderTraversal(root.right)) re...
the_stack_v2_python_sparse
Cracking_the_Code_Interview/Leetcode/6.Binary_Tree/Traversal/144_94_145.Traversal_Recursive.py
lzxyzq/Cracking_the_Coding_Interview
train
0
519c43695818684ccb03218570d6f18b12461616
[ "n = len(nums)\nif n == 1:\n return True\njmp_lst = [False for _ in range(n)]\njmp_lst[n - 1] = True\nfor i in range(n - 2, -1, -1):\n for j in range(min(n - i - 1, nums[i]), 0, -1):\n if jmp_lst[i + j]:\n jmp_lst[i] = True\n break\nreturn jmp_lst[0]", "max_step = 0\nfor i, n in...
<|body_start_0|> n = len(nums) if n == 1: return True jmp_lst = [False for _ in range(n)] jmp_lst[n - 1] = True for i in range(n - 2, -1, -1): for j in range(min(n - i - 1, nums[i]), 0, -1): if jmp_lst[i + j]: jmp_lst[i]...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canJump(self, nums: List[int]) -> bool: """166 / 166 test cases passed. Status: Accepted Runtime: 5652 ms Memory Usage: 15.3 MB :param nums: :return:""" <|body_0|> def canJump2(self, nums: List[int]) -> bool: """166 / 166 test cases passed. Status: Acce...
stack_v2_sparse_classes_36k_train_014833
2,508
permissive
[ { "docstring": "166 / 166 test cases passed. Status: Accepted Runtime: 5652 ms Memory Usage: 15.3 MB :param nums: :return:", "name": "canJump", "signature": "def canJump(self, nums: List[int]) -> bool" }, { "docstring": "166 / 166 test cases passed. Status: Accepted Runtime: 500 ms Memory Usage:...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums: List[int]) -> bool: 166 / 166 test cases passed. Status: Accepted Runtime: 5652 ms Memory Usage: 15.3 MB :param nums: :return: - def canJump2(self, nums: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums: List[int]) -> bool: 166 / 166 test cases passed. Status: Accepted Runtime: 5652 ms Memory Usage: 15.3 MB :param nums: :return: - def canJump2(self, nums: ...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def canJump(self, nums: List[int]) -> bool: """166 / 166 test cases passed. Status: Accepted Runtime: 5652 ms Memory Usage: 15.3 MB :param nums: :return:""" <|body_0|> def canJump2(self, nums: List[int]) -> bool: """166 / 166 test cases passed. Status: Acce...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canJump(self, nums: List[int]) -> bool: """166 / 166 test cases passed. Status: Accepted Runtime: 5652 ms Memory Usage: 15.3 MB :param nums: :return:""" n = len(nums) if n == 1: return True jmp_lst = [False for _ in range(n)] jmp_lst[n - 1] = T...
the_stack_v2_python_sparse
src/55-JumpGame.py
Jiezhi/myleetcode
train
1
781f202f255b838b71190a89ae18512fff983de1
[ "for _type in self.REWARD_TYPE_NAME:\n if _type[0] == key:\n return _type[1]\nreturn ''", "record = super(KaHrPayrollReward, self).create(vals)\nif not 'name' in vals or not vals.get('name'):\n type_name = self._get_type_name(record.reward_type)\n record.name = '{0} {1} Tahun, {2}'.format(type_nam...
<|body_start_0|> for _type in self.REWARD_TYPE_NAME: if _type[0] == key: return _type[1] return '' <|end_body_0|> <|body_start_1|> record = super(KaHrPayrollReward, self).create(vals) if not 'name' in vals or not vals.get('name'): type_name = self...
Data of payroll reward. _name = 'ka_hr_payroll.reward'
KaHrPayrollReward
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KaHrPayrollReward: """Data of payroll reward. _name = 'ka_hr_payroll.reward'""" def _get_type_name(self, key): """To get type name of `scale_type` value. Arguments: key {String} -- `scale_type` value. Returns: String -- Result of `scale_type` value check.""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_014834
2,275
no_license
[ { "docstring": "To get type name of `scale_type` value. Arguments: key {String} -- `scale_type` value. Returns: String -- Result of `scale_type` value check.", "name": "_get_type_name", "signature": "def _get_type_name(self, key)" }, { "docstring": "Override method `create()`. Use for insert dat...
2
null
Implement the Python class `KaHrPayrollReward` described below. Class description: Data of payroll reward. _name = 'ka_hr_payroll.reward' Method signatures and docstrings: - def _get_type_name(self, key): To get type name of `scale_type` value. Arguments: key {String} -- `scale_type` value. Returns: String -- Result ...
Implement the Python class `KaHrPayrollReward` described below. Class description: Data of payroll reward. _name = 'ka_hr_payroll.reward' Method signatures and docstrings: - def _get_type_name(self, key): To get type name of `scale_type` value. Arguments: key {String} -- `scale_type` value. Returns: String -- Result ...
97273e0d30ae568a4ddda0d7c5691319d6388a26
<|skeleton|> class KaHrPayrollReward: """Data of payroll reward. _name = 'ka_hr_payroll.reward'""" def _get_type_name(self, key): """To get type name of `scale_type` value. Arguments: key {String} -- `scale_type` value. Returns: String -- Result of `scale_type` value check.""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KaHrPayrollReward: """Data of payroll reward. _name = 'ka_hr_payroll.reward'""" def _get_type_name(self, key): """To get type name of `scale_type` value. Arguments: key {String} -- `scale_type` value. Returns: String -- Result of `scale_type` value check.""" for _type in self.REWARD_TYPE_...
the_stack_v2_python_sparse
ka_hr_payroll/models/reward.py
CakJuice/odoo-sample-code
train
0
fa59991c242f91334023698aec44921ed3d3cf65
[ "n = len(arr)\ndp = [[0] * n for _ in range(n)]\nleafs = [[0] * n for _ in range(n)]\nfor i in range(n):\n dp[i][i] = 0\n leafs[i][i] = arr[i]\nfor l in range(2, n + 1):\n for i in range(n - l + 1):\n j = i + l - 1\n dp[i][j] = min((dp[i][k] + dp[k + 1][j] + leafs[i][k] * leafs[k + 1][j] for ...
<|body_start_0|> n = len(arr) dp = [[0] * n for _ in range(n)] leafs = [[0] * n for _ in range(n)] for i in range(n): dp[i][i] = 0 leafs[i][i] = arr[i] for l in range(2, n + 1): for i in range(n - l + 1): j = i + l - 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mctFromLeafValues1(self, arr: List[int]) -> int: """dynamic programming""" <|body_0|> def mctFromLeafValues2(self, arr: List[int]) -> int: """greedy""" <|body_1|> def mctFromLeafValues3(self, arr: List[int]) -> int: """monotonic dec...
stack_v2_sparse_classes_36k_train_014835
2,353
no_license
[ { "docstring": "dynamic programming", "name": "mctFromLeafValues1", "signature": "def mctFromLeafValues1(self, arr: List[int]) -> int" }, { "docstring": "greedy", "name": "mctFromLeafValues2", "signature": "def mctFromLeafValues2(self, arr: List[int]) -> int" }, { "docstring": "m...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mctFromLeafValues1(self, arr: List[int]) -> int: dynamic programming - def mctFromLeafValues2(self, arr: List[int]) -> int: greedy - def mctFromLeafValues3(self, arr: List[in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mctFromLeafValues1(self, arr: List[int]) -> int: dynamic programming - def mctFromLeafValues2(self, arr: List[int]) -> int: greedy - def mctFromLeafValues3(self, arr: List[in...
6ff1941ff213a843013100ac7033e2d4f90fbd6a
<|skeleton|> class Solution: def mctFromLeafValues1(self, arr: List[int]) -> int: """dynamic programming""" <|body_0|> def mctFromLeafValues2(self, arr: List[int]) -> int: """greedy""" <|body_1|> def mctFromLeafValues3(self, arr: List[int]) -> int: """monotonic dec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mctFromLeafValues1(self, arr: List[int]) -> int: """dynamic programming""" n = len(arr) dp = [[0] * n for _ in range(n)] leafs = [[0] * n for _ in range(n)] for i in range(n): dp[i][i] = 0 leafs[i][i] = arr[i] for l in range...
the_stack_v2_python_sparse
Leetcode 1130. Minimum Cost Tree From Leaf Values.py
Chaoran-sjsu/leetcode
train
0
a39321c641c5377d7fbde65ccf671619ddf98739
[ "if id is not None:\n self.id = id\nelse:\n Base.__nb_objects += 1\n self.id = Base.__nb_objects", "if list_dictionaries is None or len(list_dictionaries) == 0:\n return '[]'\nnew_data = json.dumps(list_dictionaries)\nreturn new_data", "file_name = cls.__name__ + '.json'\nnew_list = []\nif list_objs...
<|body_start_0|> if id is not None: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects <|end_body_0|> <|body_start_1|> if list_dictionaries is None or len(list_dictionaries) == 0: return '[]' new_data = json.dumps(list_d...
New Base class
Base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: """New Base class""" def __init__(self, id=None): """Constructor to define value to ID""" <|body_0|> def to_json_string(list_dictionaries): """Method that returns the JSON string representation""" <|body_1|> def save_to_file(cls, list_objs): ...
stack_v2_sparse_classes_36k_train_014836
2,419
no_license
[ { "docstring": "Constructor to define value to ID", "name": "__init__", "signature": "def __init__(self, id=None)" }, { "docstring": "Method that returns the JSON string representation", "name": "to_json_string", "signature": "def to_json_string(list_dictionaries)" }, { "docstrin...
6
stack_v2_sparse_classes_30k_train_017918
Implement the Python class `Base` described below. Class description: New Base class Method signatures and docstrings: - def __init__(self, id=None): Constructor to define value to ID - def to_json_string(list_dictionaries): Method that returns the JSON string representation - def save_to_file(cls, list_objs): Method...
Implement the Python class `Base` described below. Class description: New Base class Method signatures and docstrings: - def __init__(self, id=None): Constructor to define value to ID - def to_json_string(list_dictionaries): Method that returns the JSON string representation - def save_to_file(cls, list_objs): Method...
0cd11e20344029aeb4f9f89409b459d193404a88
<|skeleton|> class Base: """New Base class""" def __init__(self, id=None): """Constructor to define value to ID""" <|body_0|> def to_json_string(list_dictionaries): """Method that returns the JSON string representation""" <|body_1|> def save_to_file(cls, list_objs): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Base: """New Base class""" def __init__(self, id=None): """Constructor to define value to ID""" if id is not None: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects def to_json_string(list_dictionaries): """Metho...
the_stack_v2_python_sparse
0x0C-python-almost_a_circle/models/base.py
luzperdomo92/holbertonschool-higher_level_programming
train
0
078792af45859978f5e44b8afac3bbd92d69794d
[ "assert self.normalized_payload is not None\nsignature = self.normalized_payload['signature']\nvm_id = self.normalized_payload['vm_id']\nmessage = self.normalized_payload['message']\nreturn classifier_domain.OppiaMLAuthInfo(message, vm_id, signature)", "next_job = classifier_services.fetch_next_job()\nif next_job...
<|body_start_0|> assert self.normalized_payload is not None signature = self.normalized_payload['signature'] vm_id = self.normalized_payload['vm_id'] message = self.normalized_payload['message'] return classifier_domain.OppiaMLAuthInfo(message, vm_id, signature) <|end_body_0|> <...
This handler fetches next job to be processed according to the time and sends back job_id, algorithm_id and training data to the VM.
NextJobHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NextJobHandler: """This handler fetches next job to be processed according to the time and sends back job_id, algorithm_id and training data to the VM.""" def extract_request_message_vm_id_and_signature(self) -> classifier_domain.OppiaMLAuthInfo: """Returns message, vm_id and signatu...
stack_v2_sparse_classes_36k_train_014837
11,389
permissive
[ { "docstring": "Returns message, vm_id and signature retrieved from incoming request. Returns: tuple(str). Message at index 0, vm_id at index 1 and signature at index 2.", "name": "extract_request_message_vm_id_and_signature", "signature": "def extract_request_message_vm_id_and_signature(self) -> classi...
2
null
Implement the Python class `NextJobHandler` described below. Class description: This handler fetches next job to be processed according to the time and sends back job_id, algorithm_id and training data to the VM. Method signatures and docstrings: - def extract_request_message_vm_id_and_signature(self) -> classifier_d...
Implement the Python class `NextJobHandler` described below. Class description: This handler fetches next job to be processed according to the time and sends back job_id, algorithm_id and training data to the VM. Method signatures and docstrings: - def extract_request_message_vm_id_and_signature(self) -> classifier_d...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class NextJobHandler: """This handler fetches next job to be processed according to the time and sends back job_id, algorithm_id and training data to the VM.""" def extract_request_message_vm_id_and_signature(self) -> classifier_domain.OppiaMLAuthInfo: """Returns message, vm_id and signatu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NextJobHandler: """This handler fetches next job to be processed according to the time and sends back job_id, algorithm_id and training data to the VM.""" def extract_request_message_vm_id_and_signature(self) -> classifier_domain.OppiaMLAuthInfo: """Returns message, vm_id and signature retrieved ...
the_stack_v2_python_sparse
core/controllers/classifier.py
oppia/oppia
train
6,172
811f16064de890d44d8810e2cd80e2438c9ca36f
[ "self.ip = ip\nself.mtype = mtype\nself.continent_code = continent_code\nself.continent_name = continent_name\nself.country_code = country_code\nself.country_name = country_name\nself.is_eu = is_eu\nself.geoname_id = geoname_id\nself.city = city\nself.region = region\nself.lat = lat\nself.lon = lon\nself.tz_id = tz...
<|body_start_0|> self.ip = ip self.mtype = mtype self.continent_code = continent_code self.continent_name = continent_name self.country_code = country_code self.country_name = country_name self.is_eu = is_eu self.geoname_id = geoname_id self.city =...
Implementation of the 'IpJson Response' model. TODO: type model description here. Attributes: ip (string): IP address mtype (string): ipv4 or ipv6 continent_code (string): Continent code continent_name (string): Continent name country_code (string): Country code country_name (string): Name of country is_eu (bool): true...
IpJsonResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IpJsonResponse: """Implementation of the 'IpJson Response' model. TODO: type model description here. Attributes: ip (string): IP address mtype (string): ipv4 or ipv6 continent_code (string): Continent code continent_name (string): Continent name country_code (string): Country code country_name (s...
stack_v2_sparse_classes_36k_train_014838
4,303
permissive
[ { "docstring": "Constructor for the IpJsonResponse class", "name": "__init__", "signature": "def __init__(self, ip=None, mtype=None, continent_code=None, continent_name=None, country_code=None, country_name=None, is_eu=None, geoname_id=None, city=None, region=None, lat=None, lon=None, tz_id=None, localt...
2
stack_v2_sparse_classes_30k_train_002372
Implement the Python class `IpJsonResponse` described below. Class description: Implementation of the 'IpJson Response' model. TODO: type model description here. Attributes: ip (string): IP address mtype (string): ipv4 or ipv6 continent_code (string): Continent code continent_name (string): Continent name country_code...
Implement the Python class `IpJsonResponse` described below. Class description: Implementation of the 'IpJson Response' model. TODO: type model description here. Attributes: ip (string): IP address mtype (string): ipv4 or ipv6 continent_code (string): Continent code continent_name (string): Continent name country_code...
790588175af26133562e0f7bf714e1de37d5d400
<|skeleton|> class IpJsonResponse: """Implementation of the 'IpJson Response' model. TODO: type model description here. Attributes: ip (string): IP address mtype (string): ipv4 or ipv6 continent_code (string): Continent code continent_name (string): Continent name country_code (string): Country code country_name (s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IpJsonResponse: """Implementation of the 'IpJson Response' model. TODO: type model description here. Attributes: ip (string): IP address mtype (string): ipv4 or ipv6 continent_code (string): Continent code continent_name (string): Continent name country_code (string): Country code country_name (string): Name ...
the_stack_v2_python_sparse
py07api/weatherapi-Python-CodeGen-PY/weatherapi/models/ip_json_response.py
marcin-se/python-learn
train
1
628a95d8fc10d84a6ccdfbfe1176f61cd0ed5dcd
[ "if root is None:\n return\nroot.left, root.right = (root.right, root.left)\nroot.left = self.invertTree(root.left)\nroot.right = self.invertTree(root.right)\nreturn root", "if root == None:\n return []\nelse:\n result = []\n father_node = [root]\n father_val = [root.val]\n result.append(father_...
<|body_start_0|> if root is None: return root.left, root.right = (root.right, root.left) root.left = self.invertTree(root.left) root.right = self.invertTree(root.right) return root <|end_body_0|> <|body_start_1|> if root == None: return [] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def invertTree(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def levelOrder(self, root): """:type root: TreeNode :rtype: list[list[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root is None: ret...
stack_v2_sparse_classes_36k_train_014839
1,765
no_license
[ { "docstring": ":type root: TreeNode :rtype: TreeNode", "name": "invertTree", "signature": "def invertTree(self, root)" }, { "docstring": ":type root: TreeNode :rtype: list[list[int]]", "name": "levelOrder", "signature": "def levelOrder(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_020804
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree(self, root): :type root: TreeNode :rtype: TreeNode - def levelOrder(self, root): :type root: TreeNode :rtype: list[list[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def invertTree(self, root): :type root: TreeNode :rtype: TreeNode - def levelOrder(self, root): :type root: TreeNode :rtype: list[list[int]] <|skeleton|> class Solution: de...
04bc3b1063d1d8468f3209b24118330cf986bcdc
<|skeleton|> class Solution: def invertTree(self, root): """:type root: TreeNode :rtype: TreeNode""" <|body_0|> def levelOrder(self, root): """:type root: TreeNode :rtype: list[list[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def invertTree(self, root): """:type root: TreeNode :rtype: TreeNode""" if root is None: return root.left, root.right = (root.right, root.left) root.left = self.invertTree(root.left) root.right = self.invertTree(root.right) return root ...
the_stack_v2_python_sparse
python/tree/invertTree.py
xiantang/leetcode
train
4
03914773ece8ab12ee6c3313d805233202e74f25
[ "pqu = PQUModule.PQU(self.value, self.unit)\nif unit is not None:\n pqu.convertToUnit(unit)\nreturn pqu", "if not isinstance(unit, (str, PQUModule.PhysicalUnit)):\n raise TypeError('unit argument must be a str or a PQU.PhysicalUnit.')\nreturn float(self.pqu(unit))" ]
<|body_start_0|> pqu = PQUModule.PQU(self.value, self.unit) if unit is not None: pqu.convertToUnit(unit) return pqu <|end_body_0|> <|body_start_1|> if not isinstance(unit, (str, PQUModule.PhysicalUnit)): raise TypeError('unit argument must be a str or a PQU.Physi...
This is an abstract base class for number quantities. This class adds the pqu and float methods.
number
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class number: """This is an abstract base class for number quantities. This class adds the pqu and float methods.""" def pqu(self, unit=None): """Returns a PQU instance of self's value in units of unit. If unit is None, self's unit is used.""" <|body_0|> def float(self, unit):...
stack_v2_sparse_classes_36k_train_014840
13,106
permissive
[ { "docstring": "Returns a PQU instance of self's value in units of unit. If unit is None, self's unit is used.", "name": "pqu", "signature": "def pqu(self, unit=None)" }, { "docstring": "Returns a float instance of self's value in units of unit.", "name": "float", "signature": "def float...
2
null
Implement the Python class `number` described below. Class description: This is an abstract base class for number quantities. This class adds the pqu and float methods. Method signatures and docstrings: - def pqu(self, unit=None): Returns a PQU instance of self's value in units of unit. If unit is None, self's unit i...
Implement the Python class `number` described below. Class description: This is an abstract base class for number quantities. This class adds the pqu and float methods. Method signatures and docstrings: - def pqu(self, unit=None): Returns a PQU instance of self's value in units of unit. If unit is None, self's unit i...
9566131c37b45fc37f5f8ad07903264864575b6e
<|skeleton|> class number: """This is an abstract base class for number quantities. This class adds the pqu and float methods.""" def pqu(self, unit=None): """Returns a PQU instance of self's value in units of unit. If unit is None, self's unit is used.""" <|body_0|> def float(self, unit):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class number: """This is an abstract base class for number quantities. This class adds the pqu and float methods.""" def pqu(self, unit=None): """Returns a PQU instance of self's value in units of unit. If unit is None, self's unit is used.""" pqu = PQUModule.PQU(self.value, self.unit) ...
the_stack_v2_python_sparse
PoPs/quantities/quantity.py
alhajri/FUDGE
train
0
2350d205b85fbe7316b4472a04a84ed1186f84f2
[ "mongo = main.MongoDBConnection()\nwith mongo:\n db = mongo.connection.storeDB\n db['customers'].drop()\n db['products'].drop()\n db['rentals'].drop()", "mongo = main.MongoDBConnection()\nwith mongo:\n db = mongo.connection.storeDB\n db['customers'].drop()\n db['products'].drop()\n db['ren...
<|body_start_0|> mongo = main.MongoDBConnection() with mongo: db = mongo.connection.storeDB db['customers'].drop() db['products'].drop() db['rentals'].drop() <|end_body_0|> <|body_start_1|> mongo = main.MongoDBConnection() with mongo: ...
Tests the functionality of the Mongo Database
TestDatabase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDatabase: """Tests the functionality of the Mongo Database""" def setUp(self): """Setting up the database for the tests""" <|body_0|> def tearDown(self): """Tearing down anything created or used for testing purposes""" <|body_1|> def test_import_...
stack_v2_sparse_classes_36k_train_014841
3,499
no_license
[ { "docstring": "Setting up the database for the tests", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Tearing down anything created or used for testing purposes", "name": "tearDown", "signature": "def tearDown(self)" }, { "docstring": "Testing the import_data...
5
null
Implement the Python class `TestDatabase` described below. Class description: Tests the functionality of the Mongo Database Method signatures and docstrings: - def setUp(self): Setting up the database for the tests - def tearDown(self): Tearing down anything created or used for testing purposes - def test_import_data...
Implement the Python class `TestDatabase` described below. Class description: Tests the functionality of the Mongo Database Method signatures and docstrings: - def setUp(self): Setting up the database for the tests - def tearDown(self): Tearing down anything created or used for testing purposes - def test_import_data...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class TestDatabase: """Tests the functionality of the Mongo Database""" def setUp(self): """Setting up the database for the tests""" <|body_0|> def tearDown(self): """Tearing down anything created or used for testing purposes""" <|body_1|> def test_import_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDatabase: """Tests the functionality of the Mongo Database""" def setUp(self): """Setting up the database for the tests""" mongo = main.MongoDBConnection() with mongo: db = mongo.connection.storeDB db['customers'].drop() db['products'].drop(...
the_stack_v2_python_sparse
students/humberto_gonzalez/lesson05/test_database.py
JavaRod/SP_Python220B_2019
train
1
503c72178d8d2931ae0e3700e7ee3a0b5478a821
[ "result = {'result': 'NG'}\ndata = request.get_json(force=True)\nif data:\n succsee, message = CtrlQuotations().update_quotation_status(data)\n if succsee:\n result = {'result': 'OK', 'content': message}\n else:\n result['error'] = message\nelse:\n result['error'] = '请不要传空数据'\nreturn resul...
<|body_start_0|> result = {'result': 'NG'} data = request.get_json(force=True) if data: succsee, message = CtrlQuotations().update_quotation_status(data) if succsee: result = {'result': 'OK', 'content': message} else: result['er...
ApiQuotationStatue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiQuotationStatue: def post(self): """修改状态 :return:""" <|body_0|> def get(self, quotation_id): """获取状态 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = {'result': 'NG'} data = request.get_json(force=True) if data: ...
stack_v2_sparse_classes_36k_train_014842
10,406
no_license
[ { "docstring": "修改状态 :return:", "name": "post", "signature": "def post(self)" }, { "docstring": "获取状态 :return:", "name": "get", "signature": "def get(self, quotation_id)" } ]
2
stack_v2_sparse_classes_30k_train_011783
Implement the Python class `ApiQuotationStatue` described below. Class description: Implement the ApiQuotationStatue class. Method signatures and docstrings: - def post(self): 修改状态 :return: - def get(self, quotation_id): 获取状态 :return:
Implement the Python class `ApiQuotationStatue` described below. Class description: Implement the ApiQuotationStatue class. Method signatures and docstrings: - def post(self): 修改状态 :return: - def get(self, quotation_id): 获取状态 :return: <|skeleton|> class ApiQuotationStatue: def post(self): """修改状态 :retur...
64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11
<|skeleton|> class ApiQuotationStatue: def post(self): """修改状态 :return:""" <|body_0|> def get(self, quotation_id): """获取状态 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiQuotationStatue: def post(self): """修改状态 :return:""" result = {'result': 'NG'} data = request.get_json(force=True) if data: succsee, message = CtrlQuotations().update_quotation_status(data) if succsee: result = {'result': 'OK', 'conten...
the_stack_v2_python_sparse
koala/koala_server/app/api_1_0/api_quotations.py
lsn1183/web_project
train
0
e3f1e91a022165a526299378047d7249c65a6eaa
[ "username = request.GET.get('username', None)\nif username is not None:\n cm = get_object_or_404(CM, user__username=username)\n serializer = CMSerializer(cm)\n return JsonResponse({'cms': [serializer.data]}, safe=False)\nelse:\n cms = CM.objects.all()\n serializer = CMSerializer(cms, many=True)\n ...
<|body_start_0|> username = request.GET.get('username', None) if username is not None: cm = get_object_or_404(CM, user__username=username) serializer = CMSerializer(cm) return JsonResponse({'cms': [serializer.data]}, safe=False) else: cms = CM.obje...
课程负责人view
CMs
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CMs: """课程负责人view""" def get(self, request): """查询课程负责人""" <|body_0|> def post(self, request): """增加课程负责人""" <|body_1|> def delete(self, request): """删除课程负责人""" <|body_2|> <|end_skeleton|> <|body_start_0|> username = request...
stack_v2_sparse_classes_36k_train_014843
16,053
permissive
[ { "docstring": "查询课程负责人", "name": "get", "signature": "def get(self, request)" }, { "docstring": "增加课程负责人", "name": "post", "signature": "def post(self, request)" }, { "docstring": "删除课程负责人", "name": "delete", "signature": "def delete(self, request)" } ]
3
stack_v2_sparse_classes_30k_train_005324
Implement the Python class `CMs` described below. Class description: 课程负责人view Method signatures and docstrings: - def get(self, request): 查询课程负责人 - def post(self, request): 增加课程负责人 - def delete(self, request): 删除课程负责人
Implement the Python class `CMs` described below. Class description: 课程负责人view Method signatures and docstrings: - def get(self, request): 查询课程负责人 - def post(self, request): 增加课程负责人 - def delete(self, request): 删除课程负责人 <|skeleton|> class CMs: """课程负责人view""" def get(self, request): """查询课程负责人""" ...
7aaa1be773718de1beb3ce0080edca7c4114b7ad
<|skeleton|> class CMs: """课程负责人view""" def get(self, request): """查询课程负责人""" <|body_0|> def post(self, request): """增加课程负责人""" <|body_1|> def delete(self, request): """删除课程负责人""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CMs: """课程负责人view""" def get(self, request): """查询课程负责人""" username = request.GET.get('username', None) if username is not None: cm = get_object_or_404(CM, user__username=username) serializer = CMSerializer(cm) return JsonResponse({'cms': [seria...
the_stack_v2_python_sparse
user/views.py
MIXISAMA/MIS-backend
train
0
023c4e27374b241b364035cf7e75fa64c29dd7de
[ "parser.display_info.AddFormat(bare_metal_constants.BARE_METAL_STANDALONE_CLUSTERS_FORMAT)\nstandalone_cluster_flags.AddStandaloneClusterResourceArg(parser, verb='to update', positional=True)\nbase.ASYNC_FLAG.AddToParser(parser)\nstandalone_cluster_flags.AddValidationOnly(parser)\nstandalone_cluster_flags.AddAllowM...
<|body_start_0|> parser.display_info.AddFormat(bare_metal_constants.BARE_METAL_STANDALONE_CLUSTERS_FORMAT) standalone_cluster_flags.AddStandaloneClusterResourceArg(parser, verb='to update', positional=True) base.ASYNC_FLAG.AddToParser(parser) standalone_cluster_flags.AddValidationOnly(pa...
Update an Anthos on bare metal standalone cluster.
Update
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Update: """Update an Anthos on bare metal standalone cluster.""" def Args(parser: parser_arguments.ArgumentInterceptor): """Gathers command line arguments for the update command. Args: parser: The argparse parser to add the flag to.""" <|body_0|> def Run(self, args): ...
stack_v2_sparse_classes_36k_train_014844
4,069
permissive
[ { "docstring": "Gathers command line arguments for the update command. Args: parser: The argparse parser to add the flag to.", "name": "Args", "signature": "def Args(parser: parser_arguments.ArgumentInterceptor)" }, { "docstring": "Runs the update command. Args: args: The arguments received from...
2
stack_v2_sparse_classes_30k_train_003760
Implement the Python class `Update` described below. Class description: Update an Anthos on bare metal standalone cluster. Method signatures and docstrings: - def Args(parser: parser_arguments.ArgumentInterceptor): Gathers command line arguments for the update command. Args: parser: The argparse parser to add the fla...
Implement the Python class `Update` described below. Class description: Update an Anthos on bare metal standalone cluster. Method signatures and docstrings: - def Args(parser: parser_arguments.ArgumentInterceptor): Gathers command line arguments for the update command. Args: parser: The argparse parser to add the fla...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class Update: """Update an Anthos on bare metal standalone cluster.""" def Args(parser: parser_arguments.ArgumentInterceptor): """Gathers command line arguments for the update command. Args: parser: The argparse parser to add the flag to.""" <|body_0|> def Run(self, args): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Update: """Update an Anthos on bare metal standalone cluster.""" def Args(parser: parser_arguments.ArgumentInterceptor): """Gathers command line arguments for the update command. Args: parser: The argparse parser to add the flag to.""" parser.display_info.AddFormat(bare_metal_constants.BA...
the_stack_v2_python_sparse
lib/surface/container/bare_metal/standalone_clusters/update.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
a0d553eb9b46b5e4906ead8df3f7c8b439e7e946
[ "xml_root: ET.Element = ET.parse(xml_file_path).getroot()\narticles_xml_list = xml_root.findall('PubmedArticle')\npubmed_articles: [PubMedArticle] = []\nfor article_xml in articles_xml_list:\n pubmed_articles.append(PubMedArticle(article_xml))\nreturn pubmed_articles", "dict_list = []\nfor article in articles:...
<|body_start_0|> xml_root: ET.Element = ET.parse(xml_file_path).getroot() articles_xml_list = xml_root.findall('PubmedArticle') pubmed_articles: [PubMedArticle] = [] for article_xml in articles_xml_list: pubmed_articles.append(PubMedArticle(article_xml)) return pubmed...
Parsing utility for PubMed Article sets. An article set is an xml file with an array of <PubMedArticles>.
ArticleSetParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArticleSetParser: """Parsing utility for PubMed Article sets. An article set is an xml file with an array of <PubMedArticles>.""" def extract_articles(xml_file_path: str) -> [PubMedArticle]: """Extract articles from xml file. Arguments: xml_file_path {str} -- absolute path to xml fil...
stack_v2_sparse_classes_36k_train_014845
9,548
permissive
[ { "docstring": "Extract articles from xml file. Arguments: xml_file_path {str} -- absolute path to xml file Returns: [PubMedArticle] -- List of pubmed article objects", "name": "extract_articles", "signature": "def extract_articles(xml_file_path: str) -> [PubMedArticle]" }, { "docstring": "Gener...
5
stack_v2_sparse_classes_30k_train_012989
Implement the Python class `ArticleSetParser` described below. Class description: Parsing utility for PubMed Article sets. An article set is an xml file with an array of <PubMedArticles>. Method signatures and docstrings: - def extract_articles(xml_file_path: str) -> [PubMedArticle]: Extract articles from xml file. A...
Implement the Python class `ArticleSetParser` described below. Class description: Parsing utility for PubMed Article sets. An article set is an xml file with an array of <PubMedArticles>. Method signatures and docstrings: - def extract_articles(xml_file_path: str) -> [PubMedArticle]: Extract articles from xml file. A...
83e36e24077169d141f25c357cb1009b79b78661
<|skeleton|> class ArticleSetParser: """Parsing utility for PubMed Article sets. An article set is an xml file with an array of <PubMedArticles>.""" def extract_articles(xml_file_path: str) -> [PubMedArticle]: """Extract articles from xml file. Arguments: xml_file_path {str} -- absolute path to xml fil...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArticleSetParser: """Parsing utility for PubMed Article sets. An article set is an xml file with an array of <PubMedArticles>.""" def extract_articles(xml_file_path: str) -> [PubMedArticle]: """Extract articles from xml file. Arguments: xml_file_path {str} -- absolute path to xml file Returns: [P...
the_stack_v2_python_sparse
geniepy/src/geniepy/pubmed.py
cjflanagan/genie-1
train
0
a90b03fe212378f95373e2cdd081680bd4d16050
[ "super().__init__()\nself.content_encoder = ContentEncoder(in_channels, dim, n_residual, n_downsample)\nself.style_encoder = StyleEncoder(in_channels, dim, n_downsample, style_dim)", "content_code = self.content_encoder(x)\nstyle_code = self.style_encoder(x)\nreturn (content_code, style_code)" ]
<|body_start_0|> super().__init__() self.content_encoder = ContentEncoder(in_channels, dim, n_residual, n_downsample) self.style_encoder = StyleEncoder(in_channels, dim, n_downsample, style_dim) <|end_body_0|> <|body_start_1|> content_code = self.content_encoder(x) style_code = ...
A simple Encoder network, which encodes the content and the style separately
Encoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """A simple Encoder network, which encodes the content and the style separately""" def __init__(self, in_channels=3, dim=64, n_residual=3, n_downsample=2, style_dim=8): """Parameters ---------- in_channels : int number of channels per input image dim : int number of filters ...
stack_v2_sparse_classes_36k_train_014846
16,260
permissive
[ { "docstring": "Parameters ---------- in_channels : int number of channels per input image dim : int number of filters n_residual : int number of residual blocks n_downsample : int number of downsampling blocks style_dim : int size of the style dimension", "name": "__init__", "signature": "def __init__(...
2
null
Implement the Python class `Encoder` described below. Class description: A simple Encoder network, which encodes the content and the style separately Method signatures and docstrings: - def __init__(self, in_channels=3, dim=64, n_residual=3, n_downsample=2, style_dim=8): Parameters ---------- in_channels : int number...
Implement the Python class `Encoder` described below. Class description: A simple Encoder network, which encodes the content and the style separately Method signatures and docstrings: - def __init__(self, in_channels=3, dim=64, n_residual=3, n_downsample=2, style_dim=8): Parameters ---------- in_channels : int number...
1078f5030b8aac2bf022daf5fa14d66f74c3c893
<|skeleton|> class Encoder: """A simple Encoder network, which encodes the content and the style separately""" def __init__(self, in_channels=3, dim=64, n_residual=3, n_downsample=2, style_dim=8): """Parameters ---------- in_channels : int number of channels per input image dim : int number of filters ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encoder: """A simple Encoder network, which encodes the content and the style separately""" def __init__(self, in_channels=3, dim=64, n_residual=3, n_downsample=2, style_dim=8): """Parameters ---------- in_channels : int number of channels per input image dim : int number of filters n_residual : ...
the_stack_v2_python_sparse
dlutils/models/gans/munit/models.py
justusschock/dl-utils
train
15
29ab99e26dbe5ac24838ada46ab5fc70add9d541
[ "liList = response.xpath('//div[@class=\"news_list\"]/ul/li')\nfor li in liList:\n href = li.xpath('./a/@href').extract_first()\n title = li.xpath('./a/@title').extract_first()\n publiceTime = li.xpath('./span[@class=\"time\"]/text()').extract_first()\n data = (href, title, publiceTime)\n yield scrap...
<|body_start_0|> liList = response.xpath('//div[@class="news_list"]/ul/li') for li in liList: href = li.xpath('./a/@href').extract_first() title = li.xpath('./a/@title').extract_first() publiceTime = li.xpath('./span[@class="time"]/text()').extract_first() ...
SjdtspiderSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SjdtspiderSpider: def parse(self, response): """列表页解析 :param response: :return:""" <|body_0|> def detailedParse(self, response): """详细页解析 :param response: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> liList = response.xpath('//div[@class...
stack_v2_sparse_classes_36k_train_014847
2,192
no_license
[ { "docstring": "列表页解析 :param response: :return:", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "详细页解析 :param response: :return:", "name": "detailedParse", "signature": "def detailedParse(self, response)" } ]
2
stack_v2_sparse_classes_30k_train_006334
Implement the Python class `SjdtspiderSpider` described below. Class description: Implement the SjdtspiderSpider class. Method signatures and docstrings: - def parse(self, response): 列表页解析 :param response: :return: - def detailedParse(self, response): 详细页解析 :param response: :return:
Implement the Python class `SjdtspiderSpider` described below. Class description: Implement the SjdtspiderSpider class. Method signatures and docstrings: - def parse(self, response): 列表页解析 :param response: :return: - def detailedParse(self, response): 详细页解析 :param response: :return: <|skeleton|> class SjdtspiderSpid...
f8050fd322424dbeb9f5cad33c48497463239d70
<|skeleton|> class SjdtspiderSpider: def parse(self, response): """列表页解析 :param response: :return:""" <|body_0|> def detailedParse(self, response): """详细页解析 :param response: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SjdtspiderSpider: def parse(self, response): """列表页解析 :param response: :return:""" liList = response.xpath('//div[@class="news_list"]/ul/li') for li in liList: href = li.xpath('./a/@href').extract_first() title = li.xpath('./a/@title').extract_first() ...
the_stack_v2_python_sparse
DSB/scrapyDsb/FS_scrapy/fsScrapySpider_scredis/fsScrapySpider/spiders/sjdtSpider.py
ygz93y11y29/PYCH
train
0
cf58a68236fc3811e3804bf3a6ef7629ee657484
[ "if position == 0:\n return isinstance(child, Member)\nreturn isinstance(child, (DataNode, Range))", "if len(self._children) < 2:\n raise InternalError(f'{type(self).__name__} malformed or incomplete: must have one or more children representing array-index expressions but found none.')\nfor idx, child in en...
<|body_start_0|> if position == 0: return isinstance(child, Member) return isinstance(child, (DataNode, Range)) <|end_body_0|> <|body_start_1|> if len(self._children) < 2: raise InternalError(f'{type(self).__name__} malformed or incomplete: must have one or more children...
Abstract class used to extend the ArrayMixin class with functionality common to Nodes that represent accesses to arrays of structures. The primary difference is that the first child of such Nodes must be an instance of Member. Subsequent children then represent the array-index expressions.
ArrayOfStructuresMixin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArrayOfStructuresMixin: """Abstract class used to extend the ArrayMixin class with functionality common to Nodes that represent accesses to arrays of structures. The primary difference is that the first child of such Nodes must be an instance of Member. Subsequent children then represent the arra...
stack_v2_sparse_classes_36k_train_014848
5,143
permissive
[ { "docstring": ":param int position: the position to be validated. :param child: a child to be validated. :type child: sub-class of :py:class:`psyclone.psyir.nodes.Node` :return: whether the given child and position are valid for this node. :rtype: bool", "name": "_validate_child", "signature": "def _va...
3
null
Implement the Python class `ArrayOfStructuresMixin` described below. Class description: Abstract class used to extend the ArrayMixin class with functionality common to Nodes that represent accesses to arrays of structures. The primary difference is that the first child of such Nodes must be an instance of Member. Subs...
Implement the Python class `ArrayOfStructuresMixin` described below. Class description: Abstract class used to extend the ArrayMixin class with functionality common to Nodes that represent accesses to arrays of structures. The primary difference is that the first child of such Nodes must be an instance of Member. Subs...
0b149bc5a76ca85c1dd086c3aa813102d0d04b56
<|skeleton|> class ArrayOfStructuresMixin: """Abstract class used to extend the ArrayMixin class with functionality common to Nodes that represent accesses to arrays of structures. The primary difference is that the first child of such Nodes must be an instance of Member. Subsequent children then represent the arra...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArrayOfStructuresMixin: """Abstract class used to extend the ArrayMixin class with functionality common to Nodes that represent accesses to arrays of structures. The primary difference is that the first child of such Nodes must be an instance of Member. Subsequent children then represent the array-index expre...
the_stack_v2_python_sparse
src/psyclone/psyir/nodes/array_of_structures_mixin.py
stfc/PSyclone
train
100
e0dc03abb80a8d591ff19cfbeaff2829ea092717
[ "click_but_login(self.driver)\nlogin_button(self.driver)\ntext = GetErrorText(self.driver)\nself.assertEqual(text, '请输入用户名/手机号')", "input_username(self.driver, '18513600235')\nlogin_button(self.driver)\ntext = GetErrorText(self.driver)\nself.assertEqual(text, '请输入密码')", "input_username(self.driver, '18513600235...
<|body_start_0|> click_but_login(self.driver) login_button(self.driver) text = GetErrorText(self.driver) self.assertEqual(text, '请输入用户名/手机号') <|end_body_0|> <|body_start_1|> input_username(self.driver, '18513600235') login_button(self.driver) text = GetErrorText(...
Gjs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Gjs: def test_login_null(self): """登录测试:测试用户名和密码为空""" <|body_0|> def test_login_passwd_null(self): """登录测试:测试用户名不为空,密码为空""" <|body_1|> def test_login_success(self): """登录测试:测试用户名和密码正确;验证用户名""" <|body_2|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_014849
1,068
no_license
[ { "docstring": "登录测试:测试用户名和密码为空", "name": "test_login_null", "signature": "def test_login_null(self)" }, { "docstring": "登录测试:测试用户名不为空,密码为空", "name": "test_login_passwd_null", "signature": "def test_login_passwd_null(self)" }, { "docstring": "登录测试:测试用户名和密码正确;验证用户名", "name": "...
3
null
Implement the Python class `Gjs` described below. Class description: Implement the Gjs class. Method signatures and docstrings: - def test_login_null(self): 登录测试:测试用户名和密码为空 - def test_login_passwd_null(self): 登录测试:测试用户名不为空,密码为空 - def test_login_success(self): 登录测试:测试用户名和密码正确;验证用户名
Implement the Python class `Gjs` described below. Class description: Implement the Gjs class. Method signatures and docstrings: - def test_login_null(self): 登录测试:测试用户名和密码为空 - def test_login_passwd_null(self): 登录测试:测试用户名不为空,密码为空 - def test_login_success(self): 登录测试:测试用户名和密码正确;验证用户名 <|skeleton|> class Gjs: def te...
46acedadd225b07fe73f43feebd5c66d19c7eeac
<|skeleton|> class Gjs: def test_login_null(self): """登录测试:测试用户名和密码为空""" <|body_0|> def test_login_passwd_null(self): """登录测试:测试用户名不为空,密码为空""" <|body_1|> def test_login_success(self): """登录测试:测试用户名和密码正确;验证用户名""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Gjs: def test_login_null(self): """登录测试:测试用户名和密码为空""" click_but_login(self.driver) login_button(self.driver) text = GetErrorText(self.driver) self.assertEqual(text, '请输入用户名/手机号') def test_login_passwd_null(self): """登录测试:测试用户名不为空,密码为空""" input_usern...
the_stack_v2_python_sparse
Gjs_Po/testcase/Gjs_login_unittest.py
kuangtao94/TestHome
train
0
6a4e4806df4e24c293067bd670cfa398d410dd91
[ "xml.sax.handler.ContentHandler.__init__(self)\nself._objs = []\nself._being = None\nself._level = 0\nself._tag = None\nself._tile = []\nself._pointer = None\nself._forget_root = True\nself._no_content = no_content\nself._prepare_stringio()", "if not self._no_content:\n self._xmlio = io.StringIO()\n self._x...
<|body_start_0|> xml.sax.handler.ContentHandler.__init__(self) self._objs = [] self._being = None self._level = 0 self._tag = None self._tile = [] self._pointer = None self._forget_root = True self._no_content = no_content self._prepare_str...
Overloads functions about XML, it produces objects at the end we assume the file contains a list of objects.
XMLHandlerDict
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XMLHandlerDict: """Overloads functions about XML, it produces objects at the end we assume the file contains a list of objects.""" def __init__(self, no_content=False): """@param no_content avoid loading the content of every record""" <|body_0|> def _prepare_stringio(sel...
stack_v2_sparse_classes_36k_train_014850
7,250
permissive
[ { "docstring": "@param no_content avoid loading the content of every record", "name": "__init__", "signature": "def __init__(self, no_content=False)" }, { "docstring": "prepare the StringIO stream", "name": "_prepare_stringio", "signature": "def _prepare_stringio(self)" }, { "doc...
5
stack_v2_sparse_classes_30k_train_010409
Implement the Python class `XMLHandlerDict` described below. Class description: Overloads functions about XML, it produces objects at the end we assume the file contains a list of objects. Method signatures and docstrings: - def __init__(self, no_content=False): @param no_content avoid loading the content of every re...
Implement the Python class `XMLHandlerDict` described below. Class description: Overloads functions about XML, it produces objects at the end we assume the file contains a list of objects. Method signatures and docstrings: - def __init__(self, no_content=False): @param no_content avoid loading the content of every re...
68399f58ed258599e77f8bde45835169a0e9238d
<|skeleton|> class XMLHandlerDict: """Overloads functions about XML, it produces objects at the end we assume the file contains a list of objects.""" def __init__(self, no_content=False): """@param no_content avoid loading the content of every record""" <|body_0|> def _prepare_stringio(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XMLHandlerDict: """Overloads functions about XML, it produces objects at the end we assume the file contains a list of objects.""" def __init__(self, no_content=False): """@param no_content avoid loading the content of every record""" xml.sax.handler.ContentHandler.__init__(self) ...
the_stack_v2_python_sparse
src/pyrsslocal/xmlhelper/xml_tree.py
sdpython/pyrsslocal
train
2
0d029d5518c5ac0e841e06652afe17273784ff6e
[ "if not isinstance(bag, Bag):\n raise XacmlContextTypeError('Expecting %r derived type for \"bag\"; got %r' % (Bag, type(bag)))\nif bag.elementType != self.__class__.BAG_TYPE:\n raise XacmlContextTypeError('Expecting %r type elements for \"bag\"; got %r' % (self.__class__.BAG_TYPE, bag.elementType))\nnBagElem...
<|body_start_0|> if not isinstance(bag, Bag): raise XacmlContextTypeError('Expecting %r derived type for "bag"; got %r' % (Bag, type(bag))) if bag.elementType != self.__class__.BAG_TYPE: raise XacmlContextTypeError('Expecting %r type elements for "bag"; got %r' % (self.__class__....
Base class for XACML <type>-and functions @cvar FUNCTION_NS: namespace for this function @type FUNCTION_NS: string @cvar BAG_TYPE: type for @type BAG_TYPE:
And
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class And: """Base class for XACML <type>-and functions @cvar FUNCTION_NS: namespace for this function @type FUNCTION_NS: string @cvar BAG_TYPE: type for @type BAG_TYPE:""" def evaluate(self, bag): """perform AND function on the elements in the bag ref. access_control-xacml-2.0-core-spec-o...
stack_v2_sparse_classes_36k_train_014851
3,368
no_license
[ { "docstring": "perform AND function on the elements in the bag ref. access_control-xacml-2.0-core-spec-os, Fe 2005 - A.3.5 Logical functions @param bag: bag containing elements to be AND'ed @type bag: ndg.xacml.utils.TypedList @return: result of AND operation on the inputs @rtype: bool", "name": "evaluate"...
2
stack_v2_sparse_classes_30k_train_015372
Implement the Python class `And` described below. Class description: Base class for XACML <type>-and functions @cvar FUNCTION_NS: namespace for this function @type FUNCTION_NS: string @cvar BAG_TYPE: type for @type BAG_TYPE: Method signatures and docstrings: - def evaluate(self, bag): perform AND function on the elem...
Implement the Python class `And` described below. Class description: Base class for XACML <type>-and functions @cvar FUNCTION_NS: namespace for this function @type FUNCTION_NS: string @cvar BAG_TYPE: type for @type BAG_TYPE: Method signatures and docstrings: - def evaluate(self, bag): perform AND function on the elem...
737b82c7238ecb755f1b9e455048319a58f06412
<|skeleton|> class And: """Base class for XACML <type>-and functions @cvar FUNCTION_NS: namespace for this function @type FUNCTION_NS: string @cvar BAG_TYPE: type for @type BAG_TYPE:""" def evaluate(self, bag): """perform AND function on the elements in the bag ref. access_control-xacml-2.0-core-spec-o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class And: """Base class for XACML <type>-and functions @cvar FUNCTION_NS: namespace for this function @type FUNCTION_NS: string @cvar BAG_TYPE: type for @type BAG_TYPE:""" def evaluate(self, bag): """perform AND function on the elements in the bag ref. access_control-xacml-2.0-core-spec-os, Fe 2005 - ...
the_stack_v2_python_sparse
pyon/core/governance/policy/xacml/and_function.py
ooici-dm/pyon
train
3
a7cf309dd9e121b0847a949bcd7ffab612c44337
[ "if not s:\n return False\nfor i in xrange(len(s) - 1):\n if s[i] == '+' and s[i + 1] == '+' and (not self.canWin(s[:i] + '--' + s[i + 2:])):\n return True\nreturn False", "isWin = False\nfor i in xrange(len(l) - 1):\n if l[i] == '+' and l[i + 1] == '+':\n l[i] = l[i + 1] = '-'\n isW...
<|body_start_0|> if not s: return False for i in xrange(len(s) - 1): if s[i] == '+' and s[i + 1] == '+' and (not self.canWin(s[:i] + '--' + s[i + 2:])): return True return False <|end_body_0|> <|body_start_1|> isWin = False for i in xrange...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canWin(self, s): """:type s: str :rtype: bool""" <|body_0|> def dfs(self, l): """@param l: the list of character in s @param flag: true the current player is Me flase the current player is not Me""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_014852
917
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "canWin", "signature": "def canWin(self, s)" }, { "docstring": "@param l: the list of character in s @param flag: true the current player is Me flase the current player is not Me", "name": "dfs", "signature": "def dfs(self, l)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canWin(self, s): :type s: str :rtype: bool - def dfs(self, l): @param l: the list of character in s @param flag: true the current player is Me flase the current player is not...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canWin(self, s): :type s: str :rtype: bool - def dfs(self, l): @param l: the list of character in s @param flag: true the current player is Me flase the current player is not...
580366c7de5f27a931930aeec5e08aa043aa1d54
<|skeleton|> class Solution: def canWin(self, s): """:type s: str :rtype: bool""" <|body_0|> def dfs(self, l): """@param l: the list of character in s @param flag: true the current player is Me flase the current player is not Me""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canWin(self, s): """:type s: str :rtype: bool""" if not s: return False for i in xrange(len(s) - 1): if s[i] == '+' and s[i + 1] == '+' and (not self.canWin(s[:i] + '--' + s[i + 2:])): return True return False def dfs(s...
the_stack_v2_python_sparse
294-Flip-Game-II/solution.py
z502185331/leetcode-python
train
0
f3843e3cd179431ad2c5039df69d357a0c7d0421
[ "if not value:\n return []\nreturn value.split('\\r\\n')", "super(MultiEmailField, self).validate(value)\nfor email in value:\n validate_email(email)" ]
<|body_start_0|> if not value: return [] return value.split('\r\n') <|end_body_0|> <|body_start_1|> super(MultiEmailField, self).validate(value) for email in value: validate_email(email) <|end_body_1|>
MultiEmailField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiEmailField: def to_python(self, value): """Normalize data to a list of strings.""" <|body_0|> def validate(self, value): """Check if value consists only of valid emails.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not value: ...
stack_v2_sparse_classes_36k_train_014853
1,940
no_license
[ { "docstring": "Normalize data to a list of strings.", "name": "to_python", "signature": "def to_python(self, value)" }, { "docstring": "Check if value consists only of valid emails.", "name": "validate", "signature": "def validate(self, value)" } ]
2
stack_v2_sparse_classes_30k_val_001012
Implement the Python class `MultiEmailField` described below. Class description: Implement the MultiEmailField class. Method signatures and docstrings: - def to_python(self, value): Normalize data to a list of strings. - def validate(self, value): Check if value consists only of valid emails.
Implement the Python class `MultiEmailField` described below. Class description: Implement the MultiEmailField class. Method signatures and docstrings: - def to_python(self, value): Normalize data to a list of strings. - def validate(self, value): Check if value consists only of valid emails. <|skeleton|> class Mult...
43874528bb09bb79180fe380ecfa05795bc94e4d
<|skeleton|> class MultiEmailField: def to_python(self, value): """Normalize data to a list of strings.""" <|body_0|> def validate(self, value): """Check if value consists only of valid emails.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiEmailField: def to_python(self, value): """Normalize data to a list of strings.""" if not value: return [] return value.split('\r\n') def validate(self, value): """Check if value consists only of valid emails.""" super(MultiEmailField, self).valida...
the_stack_v2_python_sparse
programacion/python/django/t4uAdmin/workflowCodeManager/form.py
adrianlzt/cerebro
train
19
93e5989775c1779db6095dc63156b6743d503b4e
[ "author = g.user\ntags = TagModel.query.filter_by(author_id=author.id).all()\nif not tags:\n abort(404, error=f'No tags yet')\nreturn (tags, 200)", "author = g.user\ntag = TagModel(author_id=author.id, **kwargs)\ntry:\n tag.save()\n return (tag, 201)\nexcept:\n abort(404, error=f'An error occurred whi...
<|body_start_0|> author = g.user tags = TagModel.query.filter_by(author_id=author.id).all() if not tags: abort(404, error=f'No tags yet') return (tags, 200) <|end_body_0|> <|body_start_1|> author = g.user tag = TagModel(author_id=author.id, **kwargs) ...
TagListResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagListResource: def get(self): """Возвращает все теги пользователя Требуется аутентификация. :return: теги""" <|body_0|> def post(self, **kwargs): """Создает тег пользователя. Требуется аутентификация. :param kwargs: параметры для создания тега :return: тег""" ...
stack_v2_sparse_classes_36k_train_014854
3,928
no_license
[ { "docstring": "Возвращает все теги пользователя Требуется аутентификация. :return: теги", "name": "get", "signature": "def get(self)" }, { "docstring": "Создает тег пользователя. Требуется аутентификация. :param kwargs: параметры для создания тега :return: тег", "name": "post", "signatu...
2
stack_v2_sparse_classes_30k_train_000683
Implement the Python class `TagListResource` described below. Class description: Implement the TagListResource class. Method signatures and docstrings: - def get(self): Возвращает все теги пользователя Требуется аутентификация. :return: теги - def post(self, **kwargs): Создает тег пользователя. Требуется аутентификац...
Implement the Python class `TagListResource` described below. Class description: Implement the TagListResource class. Method signatures and docstrings: - def get(self): Возвращает все теги пользователя Требуется аутентификация. :return: теги - def post(self, **kwargs): Создает тег пользователя. Требуется аутентификац...
adb9a3f4524ab76e8ba656344e2ed452e87b577c
<|skeleton|> class TagListResource: def get(self): """Возвращает все теги пользователя Требуется аутентификация. :return: теги""" <|body_0|> def post(self, **kwargs): """Создает тег пользователя. Требуется аутентификация. :param kwargs: параметры для создания тега :return: тег""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TagListResource: def get(self): """Возвращает все теги пользователя Требуется аутентификация. :return: теги""" author = g.user tags = TagModel.query.filter_by(author_id=author.id).all() if not tags: abort(404, error=f'No tags yet') return (tags, 200) de...
the_stack_v2_python_sparse
api/resources/tag.py
UshakovAleksandr/Blog
train
1
b2d167b8b9c6eadfab333688d4a74356b7eed4d9
[ "self.ctr = 0\nself._map = {}\ninput = open(file_name, 'r')\nfor line in input.readlines():\n pos = line.find('#')\n if pos >= 0:\n line = line[:pos]\n line = line.strip()\n if line:\n es = line.split()\n if len(es) == 3:\n bad, good, cnt = es\n bad = bad.lower...
<|body_start_0|> self.ctr = 0 self._map = {} input = open(file_name, 'r') for line in input.readlines(): pos = line.find('#') if pos >= 0: line = line[:pos] line = line.strip() if line: es = line.split() ...
Colour converter using a file for info.
CMap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CMap: """Colour converter using a file for info.""" def __init__(self, file_name): """Read colourmap data from file_name.""" <|body_0|> def mapColour(self, rrggbb): """Map the proffered CSS colour, expressed as 6 hexadecimal digits.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k_train_014855
2,904
no_license
[ { "docstring": "Read colourmap data from file_name.", "name": "__init__", "signature": "def __init__(self, file_name)" }, { "docstring": "Map the proffered CSS colour, expressed as 6 hexadecimal digits.", "name": "mapColour", "signature": "def mapColour(self, rrggbb)" } ]
2
stack_v2_sparse_classes_30k_train_017783
Implement the Python class `CMap` described below. Class description: Colour converter using a file for info. Method signatures and docstrings: - def __init__(self, file_name): Read colourmap data from file_name. - def mapColour(self, rrggbb): Map the proffered CSS colour, expressed as 6 hexadecimal digits.
Implement the Python class `CMap` described below. Class description: Colour converter using a file for info. Method signatures and docstrings: - def __init__(self, file_name): Read colourmap data from file_name. - def mapColour(self, rrggbb): Map the proffered CSS colour, expressed as 6 hexadecimal digits. <|skelet...
21aecd8428d85c960ad8e8dd1a5555ecb2fe8ad7
<|skeleton|> class CMap: """Colour converter using a file for info.""" def __init__(self, file_name): """Read colourmap data from file_name.""" <|body_0|> def mapColour(self, rrggbb): """Map the proffered CSS colour, expressed as 6 hexadecimal digits.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CMap: """Colour converter using a file for info.""" def __init__(self, file_name): """Read colourmap data from file_name.""" self.ctr = 0 self._map = {} input = open(file_name, 'r') for line in input.readlines(): pos = line.find('#') if pos ...
the_stack_v2_python_sparse
pregenerated/pdc/tarot/cmapAdjust.py
pdc/allegedsite
train
0
7d260fc3f3b9de7d635f8b1acfd65fbd72ca8f14
[ "super().__init__()\nself._h = h\nself._attention_size = attention_size\nself._W_q = nn.Linear(d_model, q * self._h)\nself._W_k = nn.Linear(d_model, q * self._h)\nself._W_v = nn.Linear(d_model, v * self._h)\nself._W_o = nn.Linear(self._h * v, d_model)\nself._scores = None", "K = query.shape[1]\nqueries = torch.ca...
<|body_start_0|> super().__init__() self._h = h self._attention_size = attention_size self._W_q = nn.Linear(d_model, q * self._h) self._W_k = nn.Linear(d_model, q * self._h) self._W_v = nn.Linear(d_model, v * self._h) self._W_o = nn.Linear(self._h * v, d_model) ...
Multi Head Attention block from Attention is All You Need. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Parameters ---------- d_model: Dimension of the input vector. q: Dimension of all query m...
MultiHeadAttention
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadAttention: """Multi Head Attention block from Attention is All You Need. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Parameters ---------- d_model: Dimension of...
stack_v2_sparse_classes_36k_train_014856
13,552
permissive
[ { "docstring": "Initialize the Multi Head Block.", "name": "__init__", "signature": "def __init__(self, d_model: int, q: int, v: int, h: int, attention_size: int=None)" }, { "docstring": "Propagate forward the input through the MHB. We compute for each head the queries, keys and values matrices,...
3
null
Implement the Python class `MultiHeadAttention` described below. Class description: Multi Head Attention block from Attention is All You Need. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Para...
Implement the Python class `MultiHeadAttention` described below. Class description: Multi Head Attention block from Attention is All You Need. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Para...
0b801d2d2e828ac480d1097cb3bdd82b1e25c15b
<|skeleton|> class MultiHeadAttention: """Multi Head Attention block from Attention is All You Need. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Parameters ---------- d_model: Dimension of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiHeadAttention: """Multi Head Attention block from Attention is All You Need. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Parameters ---------- d_model: Dimension of the input ve...
the_stack_v2_python_sparse
code/deep/adarnn/tst/multiHeadAttention.py
jindongwang/transferlearning
train
12,773
be0995d2ca54c48b4848544004fd1b9f60b358d4
[ "extra_paths = xmit.get(ADDITIONAL_PATHS_URL)\nif extra_paths is not None:\n self.event_paths = merge_dicts(self.event_paths, extra_paths)", "event = entry['event']\nevent_path = self.event_paths.get(event)\ncompress_json = json.dumps(entry)\ntransmit_json = zlib.compress(compress_json.encode('utf-8'))\nif eve...
<|body_start_0|> extra_paths = xmit.get(ADDITIONAL_PATHS_URL) if extra_paths is not None: self.event_paths = merge_dicts(self.event_paths, extra_paths) <|end_body_0|> <|body_start_1|> event = entry['event'] event_path = self.event_paths.get(event) compress_json = jso...
Forwards data to the Hutton Helper Server.
ForTheMugPlugin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ForTheMugPlugin: """Forwards data to the Hutton Helper Server.""" def plugin_start(self): """Called once at startup. Try to keep it short...""" <|body_0|> def journal_entry(self, cmdr, is_beta, system, station, entry, state): """Called when Elite Dangerous writes...
stack_v2_sparse_classes_36k_train_014857
1,353
no_license
[ { "docstring": "Called once at startup. Try to keep it short...", "name": "plugin_start", "signature": "def plugin_start(self)" }, { "docstring": "Called when Elite Dangerous writes to the commander's journal.", "name": "journal_entry", "signature": "def journal_entry(self, cmdr, is_beta...
2
stack_v2_sparse_classes_30k_train_006341
Implement the Python class `ForTheMugPlugin` described below. Class description: Forwards data to the Hutton Helper Server. Method signatures and docstrings: - def plugin_start(self): Called once at startup. Try to keep it short... - def journal_entry(self, cmdr, is_beta, system, station, entry, state): Called when E...
Implement the Python class `ForTheMugPlugin` described below. Class description: Forwards data to the Hutton Helper Server. Method signatures and docstrings: - def plugin_start(self): Called once at startup. Try to keep it short... - def journal_entry(self, cmdr, is_beta, system, station, entry, state): Called when E...
d4e98c41b756eb420adedb8a41c61eaca1c67296
<|skeleton|> class ForTheMugPlugin: """Forwards data to the Hutton Helper Server.""" def plugin_start(self): """Called once at startup. Try to keep it short...""" <|body_0|> def journal_entry(self, cmdr, is_beta, system, station, entry, state): """Called when Elite Dangerous writes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ForTheMugPlugin: """Forwards data to the Hutton Helper Server.""" def plugin_start(self): """Called once at startup. Try to keep it short...""" extra_paths = xmit.get(ADDITIONAL_PATHS_URL) if extra_paths is not None: self.event_paths = merge_dicts(self.event_paths, ext...
the_stack_v2_python_sparse
forward.py
aarronc/hutton-helper
train
9
e420e1a8b3b70255a0a839a06a005479f42d5e29
[ "self.hass = hass\nself.pushbullet = pushbullet\nself.data: dict[str, Any] = {}\nsuper().__init__(account=pushbullet, on_push=self.update_data)\nself.daemon = True", "if data['type'] == 'push':\n self.data = data['push']\ndispatcher_send(self.hass, DATA_UPDATED)" ]
<|body_start_0|> self.hass = hass self.pushbullet = pushbullet self.data: dict[str, Any] = {} super().__init__(account=pushbullet, on_push=self.update_data) self.daemon = True <|end_body_0|> <|body_start_1|> if data['type'] == 'push': self.data = data['push']...
Provider for an account, leading to one or more sensors.
PushBulletNotificationProvider
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PushBulletNotificationProvider: """Provider for an account, leading to one or more sensors.""" def __init__(self, hass: HomeAssistant, pushbullet: PushBullet) -> None: """Start to retrieve pushes from the given Pushbullet instance.""" <|body_0|> def update_data(self, dat...
stack_v2_sparse_classes_36k_train_014858
1,064
permissive
[ { "docstring": "Start to retrieve pushes from the given Pushbullet instance.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, pushbullet: PushBullet) -> None" }, { "docstring": "Update the current data. Currently only monitors pushes but might be extended to monitor di...
2
null
Implement the Python class `PushBulletNotificationProvider` described below. Class description: Provider for an account, leading to one or more sensors. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, pushbullet: PushBullet) -> None: Start to retrieve pushes from the given Pushbullet insta...
Implement the Python class `PushBulletNotificationProvider` described below. Class description: Provider for an account, leading to one or more sensors. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, pushbullet: PushBullet) -> None: Start to retrieve pushes from the given Pushbullet insta...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class PushBulletNotificationProvider: """Provider for an account, leading to one or more sensors.""" def __init__(self, hass: HomeAssistant, pushbullet: PushBullet) -> None: """Start to retrieve pushes from the given Pushbullet instance.""" <|body_0|> def update_data(self, dat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PushBulletNotificationProvider: """Provider for an account, leading to one or more sensors.""" def __init__(self, hass: HomeAssistant, pushbullet: PushBullet) -> None: """Start to retrieve pushes from the given Pushbullet instance.""" self.hass = hass self.pushbullet = pushbullet ...
the_stack_v2_python_sparse
homeassistant/components/pushbullet/api.py
home-assistant/core
train
35,501
544b8f6fc792ad3d052329333adca9d6f7d46a0a
[ "self.opCount = collections.defaultdict(int)\nself.capacity = capacity\nself.queue = collections.deque()\nself.values = {}", "if key in self.values:\n self.queue.append(key)\n self.opCount[key] += 1\n return self.values[key]\nelse:\n return -1", "self.queue.append(key)\nself.opCount[key] += 1\nself....
<|body_start_0|> self.opCount = collections.defaultdict(int) self.capacity = capacity self.queue = collections.deque() self.values = {} <|end_body_0|> <|body_start_1|> if key in self.values: self.queue.append(key) self.opCount[key] += 1 return...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_014859
2,231
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
stack_v2_sparse_classes_30k_train_019235
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
36d7f9e967a62db77622e0888f61999d7f37579a
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.opCount = collections.defaultdict(int) self.capacity = capacity self.queue = collections.deque() self.values = {} def get(self, key): """:type key: int :rtype: int""" if key in s...
the_stack_v2_python_sparse
P0146.py
westgate458/LeetCode
train
0
611ac0dfff4c7dde92dea370c1bfbd75b837467b
[ "super(ExchangeRate, self).__init__(parent)\nself.setupUi(self)\nself.InitUi()", "self.splitter.setStretchFactor(0, 4)\nself.splitter.setStretchFactor(1, 6)\npg.setConfigOption('background', '#f0f0f0')\nself.drawChart = DrawChart()\nself.exrwidget = self.drawChart.pyqtgraphDrawChart()\nself.verticalLayout.addWidg...
<|body_start_0|> super(ExchangeRate, self).__init__(parent) self.setupUi(self) self.InitUi() <|end_body_0|> <|body_start_1|> self.splitter.setStretchFactor(0, 4) self.splitter.setStretchFactor(1, 6) pg.setConfigOption('background', '#f0f0f0') self.drawChart = Dra...
外汇汇率展示
ExchangeRate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExchangeRate: """外汇汇率展示""" def __init__(self, parent=None): """一些初始设置""" <|body_0|> def InitUi(self): """一些界面设置""" <|body_1|> def mouseMoved(self, pos): """处理鼠标事件""" <|body_2|> <|end_skeleton|> <|body_start_0|> super(Exchang...
stack_v2_sparse_classes_36k_train_014860
7,389
no_license
[ { "docstring": "一些初始设置", "name": "__init__", "signature": "def __init__(self, parent=None)" }, { "docstring": "一些界面设置", "name": "InitUi", "signature": "def InitUi(self)" }, { "docstring": "处理鼠标事件", "name": "mouseMoved", "signature": "def mouseMoved(self, pos)" } ]
3
stack_v2_sparse_classes_30k_train_001102
Implement the Python class `ExchangeRate` described below. Class description: 外汇汇率展示 Method signatures and docstrings: - def __init__(self, parent=None): 一些初始设置 - def InitUi(self): 一些界面设置 - def mouseMoved(self, pos): 处理鼠标事件
Implement the Python class `ExchangeRate` described below. Class description: 外汇汇率展示 Method signatures and docstrings: - def __init__(self, parent=None): 一些初始设置 - def InitUi(self): 一些界面设置 - def mouseMoved(self, pos): 处理鼠标事件 <|skeleton|> class ExchangeRate: """外汇汇率展示""" def __init__(self, parent=None): ...
4d4c44365d5d0bf3d9fd94922a13d0b50f17a95c
<|skeleton|> class ExchangeRate: """外汇汇率展示""" def __init__(self, parent=None): """一些初始设置""" <|body_0|> def InitUi(self): """一些界面设置""" <|body_1|> def mouseMoved(self, pos): """处理鼠标事件""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExchangeRate: """外汇汇率展示""" def __init__(self, parent=None): """一些初始设置""" super(ExchangeRate, self).__init__(parent) self.setupUi(self) self.InitUi() def InitUi(self): """一些界面设置""" self.splitter.setStretchFactor(0, 4) self.splitter.setStretchFac...
the_stack_v2_python_sparse
PyQt5All/PyQt588、89、90/exchangerate.py
redmorningcn/PyQT5Example
train
1
127b536d18395e0b543d55cd05265cf700cf6b83
[ "ENFORCER.enforce_call(action='identity:check_grant', build_target=functools.partial(_build_enforcement_target_attr, project_id=project_id, group_id=group_id, role_id=role_id))\nPROVIDERS.assignment_api.get_grant(project_id=project_id, group_id=group_id, role_id=role_id, inherited_to_projects=True)\nreturn (None, h...
<|body_start_0|> ENFORCER.enforce_call(action='identity:check_grant', build_target=functools.partial(_build_enforcement_target_attr, project_id=project_id, group_id=group_id, role_id=role_id)) PROVIDERS.assignment_api.get_grant(project_id=project_id, group_id=group_id, role_id=role_id, inherited_to_proj...
OSInheritProjectGroupResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OSInheritProjectGroupResource: def get(self, project_id, group_id, role_id): """Check for an inherited grant for a group on a project. GET/HEAD /OS-INHERIT/projects/{project_id}/groups/{group_id} /roles/{role_id}/inherited_to_projects""" <|body_0|> def put(self, project_id, ...
stack_v2_sparse_classes_36k_train_014861
19,022
permissive
[ { "docstring": "Check for an inherited grant for a group on a project. GET/HEAD /OS-INHERIT/projects/{project_id}/groups/{group_id} /roles/{role_id}/inherited_to_projects", "name": "get", "signature": "def get(self, project_id, group_id, role_id)" }, { "docstring": "Create an inherited grant for...
3
stack_v2_sparse_classes_30k_train_013873
Implement the Python class `OSInheritProjectGroupResource` described below. Class description: Implement the OSInheritProjectGroupResource class. Method signatures and docstrings: - def get(self, project_id, group_id, role_id): Check for an inherited grant for a group on a project. GET/HEAD /OS-INHERIT/projects/{proj...
Implement the Python class `OSInheritProjectGroupResource` described below. Class description: Implement the OSInheritProjectGroupResource class. Method signatures and docstrings: - def get(self, project_id, group_id, role_id): Check for an inherited grant for a group on a project. GET/HEAD /OS-INHERIT/projects/{proj...
03a0a8146a78682ede9eca12a5a7fdacde2035c8
<|skeleton|> class OSInheritProjectGroupResource: def get(self, project_id, group_id, role_id): """Check for an inherited grant for a group on a project. GET/HEAD /OS-INHERIT/projects/{project_id}/groups/{group_id} /roles/{role_id}/inherited_to_projects""" <|body_0|> def put(self, project_id, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OSInheritProjectGroupResource: def get(self, project_id, group_id, role_id): """Check for an inherited grant for a group on a project. GET/HEAD /OS-INHERIT/projects/{project_id}/groups/{group_id} /roles/{role_id}/inherited_to_projects""" ENFORCER.enforce_call(action='identity:check_grant', bui...
the_stack_v2_python_sparse
keystone/api/os_inherit.py
sapcc/keystone
train
0
5215bb37c33bbccbbd8d2202efd44a786184941d
[ "self.client_id = client_id\nself.client_secret = client_secret\nself.scope = scope\nself.user_agent = user_agent\nself.auth_uri = auth_uri\nself.token_uri = token_uri\nself.params = kwargs\nself.redirect_uri = None", "self.redirect_uri = redirect_uri\nquery = {'response_type': 'code', 'client_id': self.client_id...
<|body_start_0|> self.client_id = client_id self.client_secret = client_secret self.scope = scope self.user_agent = user_agent self.auth_uri = auth_uri self.token_uri = token_uri self.params = kwargs self.redirect_uri = None <|end_body_0|> <|body_start_1|...
Does the Web Server Flow for OAuth 2.0. OAuth2Credentials objects may be safely pickled and unpickled.
OAuth2WebServerFlow
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OAuth2WebServerFlow: """Does the Web Server Flow for OAuth 2.0. OAuth2Credentials objects may be safely pickled and unpickled.""" def __init__(self, client_id, client_secret, scope, user_agent, auth_uri='https://accounts.google.com/o/oauth2/auth', token_uri='https://accounts.google.com/o/oau...
stack_v2_sparse_classes_36k_train_014862
16,877
permissive
[ { "docstring": "Constructor for OAuth2WebServerFlow Args: client_id: string, client identifier. client_secret: string client secret. scope: string, scope of the credentials being requested. user_agent: string, HTTP User-Agent to provide for this application. auth_uri: string, URI for authorization endpoint. For...
3
null
Implement the Python class `OAuth2WebServerFlow` described below. Class description: Does the Web Server Flow for OAuth 2.0. OAuth2Credentials objects may be safely pickled and unpickled. Method signatures and docstrings: - def __init__(self, client_id, client_secret, scope, user_agent, auth_uri='https://accounts.goo...
Implement the Python class `OAuth2WebServerFlow` described below. Class description: Does the Web Server Flow for OAuth 2.0. OAuth2Credentials objects may be safely pickled and unpickled. Method signatures and docstrings: - def __init__(self, client_id, client_secret, scope, user_agent, auth_uri='https://accounts.goo...
e3c50ee4ec8364c61cfff3ea68ece1098674f4d6
<|skeleton|> class OAuth2WebServerFlow: """Does the Web Server Flow for OAuth 2.0. OAuth2Credentials objects may be safely pickled and unpickled.""" def __init__(self, client_id, client_secret, scope, user_agent, auth_uri='https://accounts.google.com/o/oauth2/auth', token_uri='https://accounts.google.com/o/oau...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OAuth2WebServerFlow: """Does the Web Server Flow for OAuth 2.0. OAuth2Credentials objects may be safely pickled and unpickled.""" def __init__(self, client_id, client_secret, scope, user_agent, auth_uri='https://accounts.google.com/o/oauth2/auth', token_uri='https://accounts.google.com/o/oauth2/token', *...
the_stack_v2_python_sparse
earthengine/google-api-python-client/oauth2client/client.py
MapofLife/MOL
train
19
32479a51ccdc726364001b5d0dd5670b92479083
[ "self.n = n\nself.next = 1\nself.mat = [[0 for i in range(n)] for i in range(n)]\nself.fillnext(0, 0)\nreturn self.mat", "self.mat[y][x] = self.next\nif self.next == self.n * self.n:\n return\nself.next += 1\nif (x == 0 or self.mat[y][x - 1] != 0) and y != 0 and (self.mat[y - 1][x] == 0):\n return self.fill...
<|body_start_0|> self.n = n self.next = 1 self.mat = [[0 for i in range(n)] for i in range(n)] self.fillnext(0, 0) return self.mat <|end_body_0|> <|body_start_1|> self.mat[y][x] = self.next if self.next == self.n * self.n: return self.next += ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generateMatrix(self, n): """:type n: int :rtype: List[List[int]]""" <|body_0|> def fillnext(self, y, x): """when entering this function the point y,x is already sure to be put, so first do it""" <|body_1|> def numberOfBoomerangs(self, point...
stack_v2_sparse_classes_36k_train_014863
3,451
no_license
[ { "docstring": ":type n: int :rtype: List[List[int]]", "name": "generateMatrix", "signature": "def generateMatrix(self, n)" }, { "docstring": "when entering this function the point y,x is already sure to be put, so first do it", "name": "fillnext", "signature": "def fillnext(self, y, x)"...
5
stack_v2_sparse_classes_30k_train_019175
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generateMatrix(self, n): :type n: int :rtype: List[List[int]] - def fillnext(self, y, x): when entering this function the point y,x is already sure to be put, so first do it ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generateMatrix(self, n): :type n: int :rtype: List[List[int]] - def fillnext(self, y, x): when entering this function the point y,x is already sure to be put, so first do it ...
e6114ab9ebd6b401a8b63266010bb1d75e23637f
<|skeleton|> class Solution: def generateMatrix(self, n): """:type n: int :rtype: List[List[int]]""" <|body_0|> def fillnext(self, y, x): """when entering this function the point y,x is already sure to be put, so first do it""" <|body_1|> def numberOfBoomerangs(self, point...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def generateMatrix(self, n): """:type n: int :rtype: List[List[int]]""" self.n = n self.next = 1 self.mat = [[0 for i in range(n)] for i in range(n)] self.fillnext(0, 0) return self.mat def fillnext(self, y, x): """when entering this funct...
the_stack_v2_python_sparse
Hackthon_20180725.py
yusun-hci/LeetCodeDaily
train
0
79acabd4a389c9de7e1ced93adbe9402126d4a18
[ "super(DSANet, self).__init__()\nself.batch_size = batch_size\nself.window = window\nself.local = local\nself.n_multiv = n_multiv\nself.n_kernels = n_kernels\nself.w_kernel = w_kernel\nself.d_model = d_model\nself.d_inner = d_inner\nself.n_layers = n_layers\nself.n_head = n_head\nself.d_k = d_k\nself.d_v = d_v\nsel...
<|body_start_0|> super(DSANet, self).__init__() self.batch_size = batch_size self.window = window self.local = local self.n_multiv = n_multiv self.n_kernels = n_kernels self.w_kernel = w_kernel self.d_model = d_model self.d_inner = d_inner ...
DSANet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DSANet: def __init__(self, batch_size, window, local, n_multiv, n_kernels, w_kernel, d_model, d_inner, n_layers, n_head, d_k, d_v, drop_prob): """Pass in parsed HyperOptArgumentParser to the model""" <|body_0|> def __build_model(self): """Layout model""" <|bo...
stack_v2_sparse_classes_36k_train_014864
11,776
permissive
[ { "docstring": "Pass in parsed HyperOptArgumentParser to the model", "name": "__init__", "signature": "def __init__(self, batch_size, window, local, n_multiv, n_kernels, w_kernel, d_model, d_inner, n_layers, n_head, d_k, d_v, drop_prob)" }, { "docstring": "Layout model", "name": "__build_mod...
3
stack_v2_sparse_classes_30k_train_008894
Implement the Python class `DSANet` described below. Class description: Implement the DSANet class. Method signatures and docstrings: - def __init__(self, batch_size, window, local, n_multiv, n_kernels, w_kernel, d_model, d_inner, n_layers, n_head, d_k, d_v, drop_prob): Pass in parsed HyperOptArgumentParser to the mo...
Implement the Python class `DSANet` described below. Class description: Implement the DSANet class. Method signatures and docstrings: - def __init__(self, batch_size, window, local, n_multiv, n_kernels, w_kernel, d_model, d_inner, n_layers, n_head, d_k, d_v, drop_prob): Pass in parsed HyperOptArgumentParser to the mo...
39b5aeeead440eaa88d6fdaf4a8a70c15373e062
<|skeleton|> class DSANet: def __init__(self, batch_size, window, local, n_multiv, n_kernels, w_kernel, d_model, d_inner, n_layers, n_head, d_k, d_v, drop_prob): """Pass in parsed HyperOptArgumentParser to the model""" <|body_0|> def __build_model(self): """Layout model""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DSANet: def __init__(self, batch_size, window, local, n_multiv, n_kernels, w_kernel, d_model, d_inner, n_layers, n_head, d_k, d_v, drop_prob): """Pass in parsed HyperOptArgumentParser to the model""" super(DSANet, self).__init__() self.batch_size = batch_size self.window = wind...
the_stack_v2_python_sparse
model/dsanet.py
lixiaoyu0575/physionet_challenge2020_pytorch
train
2
6609337c32ef2d8ff77c4edbaa642f2f333d6f92
[ "if 'post_id' not in attrs and 'comment_id' not in attrs:\n raise ValidationError(\"You must provide one of either 'post_id' or 'comment_id'\")\nelif 'post_id' in attrs and 'comment_id' in attrs:\n raise ValidationError(\"You must provide only one of either 'post_id' or 'comment_id', not both\")\nreturn attrs...
<|body_start_0|> if 'post_id' not in attrs and 'comment_id' not in attrs: raise ValidationError("You must provide one of either 'post_id' or 'comment_id'") elif 'post_id' in attrs and 'comment_id' in attrs: raise ValidationError("You must provide only one of either 'post_id' or '...
Serializer for reporting posts and comments
ReportSerializer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReportSerializer: """Serializer for reporting posts and comments""" def validate(self, attrs): """Validate data""" <|body_0|> def create(self, validated_data): """Create a new report""" <|body_1|> <|end_skeleton|> <|body_start_0|> if 'post_id' n...
stack_v2_sparse_classes_36k_train_014865
2,722
permissive
[ { "docstring": "Validate data", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "Create a new report", "name": "create", "signature": "def create(self, validated_data)" } ]
2
null
Implement the Python class `ReportSerializer` described below. Class description: Serializer for reporting posts and comments Method signatures and docstrings: - def validate(self, attrs): Validate data - def create(self, validated_data): Create a new report
Implement the Python class `ReportSerializer` described below. Class description: Serializer for reporting posts and comments Method signatures and docstrings: - def validate(self, attrs): Validate data - def create(self, validated_data): Create a new report <|skeleton|> class ReportSerializer: """Serializer for...
ba7442482da97d463302658c0aac989567ee1241
<|skeleton|> class ReportSerializer: """Serializer for reporting posts and comments""" def validate(self, attrs): """Validate data""" <|body_0|> def create(self, validated_data): """Create a new report""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReportSerializer: """Serializer for reporting posts and comments""" def validate(self, attrs): """Validate data""" if 'post_id' not in attrs and 'comment_id' not in attrs: raise ValidationError("You must provide one of either 'post_id' or 'comment_id'") elif 'post_id' ...
the_stack_v2_python_sparse
channels/serializers/reports.py
mitodl/open-discussions
train
13
195615d77634f7bba2f28f8323e06311ab8d04a8
[ "super(Monitor, self).__init__(agent)\nself._baseagent += '_Monitor'\nself.update_delay = 0.5\nself.last_time = time.time() + 5\nself.history = {}", "self.render()\ns_time = env.get_current_time()\ns_date = s_time.split(' ')[0]\nd_position = {}\nfor s_symbol, instr in iter(self._instr_stack.items()):\n d_posit...
<|body_start_0|> super(Monitor, self).__init__(agent) self._baseagent += '_Monitor' self.update_delay = 0.5 self.last_time = time.time() + 5 self.history = {} <|end_body_0|> <|body_start_1|> self.render() s_time = env.get_current_time() s_date = s_time.sp...
Monitor is used to including new methods to the agent that are not used in production environment and render information to be used in an external data visualization
Monitor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Monitor: """Monitor is used to including new methods to the agent that are not used in production environment and render information to be used in an external data visualization""" def __init__(self, agent): """Initiate a Tester instance. Save all parameters as attributes :param agen...
stack_v2_sparse_classes_36k_train_014866
4,389
permissive
[ { "docstring": "Initiate a Tester instance. Save all parameters as attributes :param agent: Agent object.", "name": "__init__", "signature": "def __init__(self, agent)" }, { "docstring": "Flush all relevant monitor information :param env: Environment Object.", "name": "flush", "signature...
4
stack_v2_sparse_classes_30k_train_019618
Implement the Python class `Monitor` described below. Class description: Monitor is used to including new methods to the agent that are not used in production environment and render information to be used in an external data visualization Method signatures and docstrings: - def __init__(self, agent): Initiate a Teste...
Implement the Python class `Monitor` described below. Class description: Monitor is used to including new methods to the agent that are not used in production environment and render information to be used in an external data visualization Method signatures and docstrings: - def __init__(self, agent): Initiate a Teste...
2d52bdc46895e5659f4ffbc6ffa2629392ed4f9a
<|skeleton|> class Monitor: """Monitor is used to including new methods to the agent that are not used in production environment and render information to be used in an external data visualization""" def __init__(self, agent): """Initiate a Tester instance. Save all parameters as attributes :param agen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Monitor: """Monitor is used to including new methods to the agent that are not used in production environment and render information to be used in an external data visualization""" def __init__(self, agent): """Initiate a Tester instance. Save all parameters as attributes :param agent: Agent obje...
the_stack_v2_python_sparse
gymV02/wrappers/monitoring.py
onesoftsa/neutrino-lab
train
8
5a3fbaad6c7eca0664331e09628896aedea7fcc6
[ "wpf.LoadComponent(self, GUI_XAML_FILE)\nself.Title = title\nself.lblPrompt.Content = prompt", "\"\"\"\n try:\n self.num_value = float(self.numValBox.Text)\n except:\n MessageBox.Show(\"Invalid value entered.\", \"Problem\", MessageBoxButton.OK, MessageBoxImage.Information)\n return\n \"\"...
<|body_start_0|> wpf.LoadComponent(self, GUI_XAML_FILE) self.Title = title self.lblPrompt.Content = prompt <|end_body_0|> <|body_start_1|> """ try: self.num_value = float(self.numValBox.Text) except: MessageBox.Show("Invalid value ente...
CheckerDialog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckerDialog: def __init__(self, prompt=DEFAULT_PROMPT, title=DEFAULT_TITLE): """Warning to check ROIs selected for export Ok and cancel buttons""" <|body_0|> def ok_clicked(self, sender, event): """Close dialog""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_014867
2,151
no_license
[ { "docstring": "Warning to check ROIs selected for export Ok and cancel buttons", "name": "__init__", "signature": "def __init__(self, prompt=DEFAULT_PROMPT, title=DEFAULT_TITLE)" }, { "docstring": "Close dialog", "name": "ok_clicked", "signature": "def ok_clicked(self, sender, event)" ...
2
stack_v2_sparse_classes_30k_train_011701
Implement the Python class `CheckerDialog` described below. Class description: Implement the CheckerDialog class. Method signatures and docstrings: - def __init__(self, prompt=DEFAULT_PROMPT, title=DEFAULT_TITLE): Warning to check ROIs selected for export Ok and cancel buttons - def ok_clicked(self, sender, event): C...
Implement the Python class `CheckerDialog` described below. Class description: Implement the CheckerDialog class. Method signatures and docstrings: - def __init__(self, prompt=DEFAULT_PROMPT, title=DEFAULT_TITLE): Warning to check ROIs selected for export Ok and cancel buttons - def ok_clicked(self, sender, event): C...
ec1627a6faa9bad0eadc6119a8a49c951b1dcbd9
<|skeleton|> class CheckerDialog: def __init__(self, prompt=DEFAULT_PROMPT, title=DEFAULT_TITLE): """Warning to check ROIs selected for export Ok and cancel buttons""" <|body_0|> def ok_clicked(self, sender, event): """Close dialog""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CheckerDialog: def __init__(self, prompt=DEFAULT_PROMPT, title=DEFAULT_TITLE): """Warning to check ROIs selected for export Ok and cancel buttons""" wpf.LoadComponent(self, GUI_XAML_FILE) self.Title = title self.lblPrompt.Content = prompt def ok_clicked(self, sender, event...
the_stack_v2_python_sparse
excludeFromExport/setExcludeExport_gui.py
Golpette/RayStation
train
2
7f1bfe584ab5c65f6113c958a3cdf6d7ea934dfb
[ "self.capacity = capacity\nself.size = 0\nself.cache = dict()\nself.linkedlist = LinkedList()", "node = self.cache.get(key)\nif node is None:\n return -1\nval = node.val\nself.linkedlist.move_to_front(node)\nreturn val", "if key in self.cache:\n node = self.cache[key]\n node.val = value\n self.linke...
<|body_start_0|> self.capacity = capacity self.size = 0 self.cache = dict() self.linkedlist = LinkedList() <|end_body_0|> <|body_start_1|> node = self.cache.get(key) if node is None: return -1 val = node.val self.linkedlist.move_to_front(node)...
最久未使用缓存
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: """最久未使用缓存""" def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <...
stack_v2_sparse_classes_36k_train_014868
3,317
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
stack_v2_sparse_classes_30k_train_005793
Implement the Python class `LRUCache` described below. Class description: 最久未使用缓存 Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LRUCache` described below. Class description: 最久未使用缓存 Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|skeleton|> class LRUCach...
4f5f5124534bd4423356a5f5572b8a39b7828d80
<|skeleton|> class LRUCache: """最久未使用缓存""" def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: """最久未使用缓存""" def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.size = 0 self.cache = dict() self.linkedlist = LinkedList() def get(self, key): """:type key: int :rtype: int""" node = self.cache.get...
the_stack_v2_python_sparse
leetcode/lru-cache/147339447.py
ausaki/data_structures_and_algorithms
train
1
05ae051530d67c090136abc07f39dd5e331ca4e5
[ "self.queue = []\nself.idx = 0\n\ndef flatten(nestedList):\n for elem in nestedList:\n if elem.isInteger():\n self.queue.append(elem.getInteger())\n else:\n sub_nest = elem.getList()\n flatten(sub_nest)\nflatten(nestedList)", "if self.hasNext():\n ret = self.qu...
<|body_start_0|> self.queue = [] self.idx = 0 def flatten(nestedList): for elem in nestedList: if elem.isInteger(): self.queue.append(elem.getInteger()) else: sub_nest = elem.getList() flatte...
NestedIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NestedIterator: def __init__(self, nestedList): """Initialize your data structure here. :type nestedList: List[NestedInteger]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|e...
stack_v2_sparse_classes_36k_train_014869
1,964
no_license
[ { "docstring": "Initialize your data structure here. :type nestedList: List[NestedInteger]", "name": "__init__", "signature": "def __init__(self, nestedList)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "nam...
3
null
Implement the Python class `NestedIterator` described below. Class description: Implement the NestedIterator class. Method signatures and docstrings: - def __init__(self, nestedList): Initialize your data structure here. :type nestedList: List[NestedInteger] - def next(self): :rtype: int - def hasNext(self): :rtype: ...
Implement the Python class `NestedIterator` described below. Class description: Implement the NestedIterator class. Method signatures and docstrings: - def __init__(self, nestedList): Initialize your data structure here. :type nestedList: List[NestedInteger] - def next(self): :rtype: int - def hasNext(self): :rtype: ...
e2fecd266bfced6208694b19a2d81182b13dacd6
<|skeleton|> class NestedIterator: def __init__(self, nestedList): """Initialize your data structure here. :type nestedList: List[NestedInteger]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NestedIterator: def __init__(self, nestedList): """Initialize your data structure here. :type nestedList: List[NestedInteger]""" self.queue = [] self.idx = 0 def flatten(nestedList): for elem in nestedList: if elem.isInteger(): s...
the_stack_v2_python_sparse
NestedIterator.py
HuipengXu/leetcode
train
0
a2b025d9ea3072936da646d90a6429de8def6334
[ "if key:\n self.key = key\nelse:\n from wsgi import application\n self.key = application.make('key')\nif not self.key:\n raise InvalidSecretKey('The encryption key passed in is: None. Be sure there is a secret key present in your .env file or your config/application.py file.')\nself.encryption = None", ...
<|body_start_0|> if key: self.key = key else: from wsgi import application self.key = application.make('key') if not self.key: raise InvalidSecretKey('The encryption key passed in is: None. Be sure there is a secret key present in your .env file or...
Cryptographic signing class.
Sign
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sign: """Cryptographic signing class.""" def __init__(self, key=None): """Sign constructor. Keyword Arguments: key {string} -- The secret key to use. If nothing is passed it then it will use the secret key from the config file. (default: {None}) Raises: InvalidSecretKey -- Thrown if ...
stack_v2_sparse_classes_36k_train_014870
2,357
permissive
[ { "docstring": "Sign constructor. Keyword Arguments: key {string} -- The secret key to use. If nothing is passed it then it will use the secret key from the config file. (default: {None}) Raises: InvalidSecretKey -- Thrown if the secret key does not exist.", "name": "__init__", "signature": "def __init_...
3
null
Implement the Python class `Sign` described below. Class description: Cryptographic signing class. Method signatures and docstrings: - def __init__(self, key=None): Sign constructor. Keyword Arguments: key {string} -- The secret key to use. If nothing is passed it then it will use the secret key from the config file....
Implement the Python class `Sign` described below. Class description: Cryptographic signing class. Method signatures and docstrings: - def __init__(self, key=None): Sign constructor. Keyword Arguments: key {string} -- The secret key to use. If nothing is passed it then it will use the secret key from the config file....
e8e55e5fdced9f28cc8acb1577457a490e5b4b74
<|skeleton|> class Sign: """Cryptographic signing class.""" def __init__(self, key=None): """Sign constructor. Keyword Arguments: key {string} -- The secret key to use. If nothing is passed it then it will use the secret key from the config file. (default: {None}) Raises: InvalidSecretKey -- Thrown if ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sign: """Cryptographic signing class.""" def __init__(self, key=None): """Sign constructor. Keyword Arguments: key {string} -- The secret key to use. If nothing is passed it then it will use the secret key from the config file. (default: {None}) Raises: InvalidSecretKey -- Thrown if the secret ke...
the_stack_v2_python_sparse
src/masonite/auth/Sign.py
MasoniteFramework/masonite
train
2,173
184696f7cd59844f8281219238b3a5e1f57f83ed
[ "super().__init__()\nself.ok_flag = False\nself.setWindowTitle('Вход / регистрация')\nself.setFixedSize(225, 160)\nself.nickname_label = QLabel('Введите имя пользователя:', self)\nself.nickname_label.setFixedSize(200, 15)\nself.nickname_label.move(10, 10)\nself.nickname = QLineEdit(self)\nself.nickname.setFixedSize...
<|body_start_0|> super().__init__() self.ok_flag = False self.setWindowTitle('Вход / регистрация') self.setFixedSize(225, 160) self.nickname_label = QLabel('Введите имя пользователя:', self) self.nickname_label.setFixedSize(200, 15) self.nickname_label.move(10, 10...
The main class of the GUI.
ClientLoginDialog
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientLoginDialog: """The main class of the GUI.""" def __init__(self): """Initialization of GUI. Creates all the components of the window, connects the click event on the OK button to the handler.""" <|body_0|> def btn_click(self): """Handles the click on the OK...
stack_v2_sparse_classes_36k_train_014871
1,800
permissive
[ { "docstring": "Initialization of GUI. Creates all the components of the window, connects the click event on the OK button to the handler.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Handles the click on the OK button, changes the flag to True.", "name": "btn_c...
2
stack_v2_sparse_classes_30k_train_017943
Implement the Python class `ClientLoginDialog` described below. Class description: The main class of the GUI. Method signatures and docstrings: - def __init__(self): Initialization of GUI. Creates all the components of the window, connects the click event on the OK button to the handler. - def btn_click(self): Handle...
Implement the Python class `ClientLoginDialog` described below. Class description: The main class of the GUI. Method signatures and docstrings: - def __init__(self): Initialization of GUI. Creates all the components of the window, connects the click event on the OK button to the handler. - def btn_click(self): Handle...
b145fb0a95f86613da5a168031263a2227065736
<|skeleton|> class ClientLoginDialog: """The main class of the GUI.""" def __init__(self): """Initialization of GUI. Creates all the components of the window, connects the click event on the OK button to the handler.""" <|body_0|> def btn_click(self): """Handles the click on the OK...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClientLoginDialog: """The main class of the GUI.""" def __init__(self): """Initialization of GUI. Creates all the components of the window, connects the click event on the OK button to the handler.""" super().__init__() self.ok_flag = False self.setWindowTitle('Вход / реги...
the_stack_v2_python_sparse
client/client/client/start_window.py
DmitryTakmakov/Takmachat
train
0
27fd82f190f281d01cc9b1ec997f95ef6b2303b4
[ "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...
Copyright (C) 2020 Intel Corporation Licensed subject to the terms of the separately executed evaluation license agreement between Intel Corporation and you.
AggregatorServicer
[ "LicenseRef-scancode-protobuf", "MPL-2.0", "MIT", "BSD-3-Clause", "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AggregatorServicer: """Copyright (C) 2020 Intel Corporation Licensed subject to the terms of the separately executed evaluation license agreement between Intel Corporation and you.""" def GetTasks(self, request, context): """Missing associated documentation comment in .proto file."""...
stack_v2_sparse_classes_36k_train_014872
5,964
permissive
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "GetTasks", "signature": "def GetTasks(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "GetAggregatedTensor", "signature": "def GetAggregatedT...
3
stack_v2_sparse_classes_30k_train_013429
Implement the Python class `AggregatorServicer` described below. Class description: Copyright (C) 2020 Intel Corporation Licensed subject to the terms of the separately executed evaluation license agreement between Intel Corporation and you. Method signatures and docstrings: - def GetTasks(self, request, context): Mi...
Implement the Python class `AggregatorServicer` described below. Class description: Copyright (C) 2020 Intel Corporation Licensed subject to the terms of the separately executed evaluation license agreement between Intel Corporation and you. Method signatures and docstrings: - def GetTasks(self, request, context): Mi...
bd73b749a9ea1b92dbcdd07e639752101d769fc0
<|skeleton|> class AggregatorServicer: """Copyright (C) 2020 Intel Corporation Licensed subject to the terms of the separately executed evaluation license agreement between Intel Corporation and you.""" def GetTasks(self, request, context): """Missing associated documentation comment in .proto file."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AggregatorServicer: """Copyright (C) 2020 Intel Corporation Licensed subject to the terms of the separately executed evaluation license agreement between Intel Corporation and you.""" def GetTasks(self, request, context): """Missing associated documentation comment in .proto file.""" cont...
the_stack_v2_python_sparse
openfl/protocols/federation_pb2_grpc.py
PDuckworth/openfl
train
0
c6c91aaf3aa5341017777ff8955ed8e7aa15d56a
[ "self.cache_root = self._help_cache(cache_root)\nself.training_url = training_url\nself.testing_url = testing_url\nself.validation_url = validation_url\ntraining_path = os.path.join(self.cache_root, name_from_url(self.training_url))\ntesting_path = os.path.join(self.cache_root, name_from_url(self.testing_url))\nval...
<|body_start_0|> self.cache_root = self._help_cache(cache_root) self.training_url = training_url self.testing_url = testing_url self.validation_url = validation_url training_path = os.path.join(self.cache_root, name_from_url(self.training_url)) testing_path = os.path.join...
A dataset with all three of train, test, and validation sets as URLs.
UnpackedRemoteDataset
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnpackedRemoteDataset: """A dataset with all three of train, test, and validation sets as URLs.""" def __init__(self, training_url: str, testing_url: str, validation_url: str, cache_root: Optional[str]=None, stream: bool=True, force: bool=False, eager: bool=False, create_inverse_triples: boo...
stack_v2_sparse_classes_36k_train_014873
9,907
permissive
[ { "docstring": "Initialize dataset. :param training_url: The URL of the training file :param testing_url: The URL of the testing file :param validation_url: The URL of the validation file :param cache_root: An optional directory to store the extracted files. Is none is given, the default PyKEEN directory is use...
2
stack_v2_sparse_classes_30k_train_014882
Implement the Python class `UnpackedRemoteDataset` described below. Class description: A dataset with all three of train, test, and validation sets as URLs. Method signatures and docstrings: - def __init__(self, training_url: str, testing_url: str, validation_url: str, cache_root: Optional[str]=None, stream: bool=Tru...
Implement the Python class `UnpackedRemoteDataset` described below. Class description: A dataset with all three of train, test, and validation sets as URLs. Method signatures and docstrings: - def __init__(self, training_url: str, testing_url: str, validation_url: str, cache_root: Optional[str]=None, stream: bool=Tru...
d731c9990cdd7835f01f129f6134c3bff576821f
<|skeleton|> class UnpackedRemoteDataset: """A dataset with all three of train, test, and validation sets as URLs.""" def __init__(self, training_url: str, testing_url: str, validation_url: str, cache_root: Optional[str]=None, stream: bool=True, force: bool=False, eager: bool=False, create_inverse_triples: boo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UnpackedRemoteDataset: """A dataset with all three of train, test, and validation sets as URLs.""" def __init__(self, training_url: str, testing_url: str, validation_url: str, cache_root: Optional[str]=None, stream: bool=True, force: bool=False, eager: bool=False, create_inverse_triples: bool=False, load...
the_stack_v2_python_sparse
lp_rp/datasets/codex.py
yunnant/NodePiece
train
0
253bd00a234b4f76aed94419423ee08cac5d4f99
[ "self.stopwords = []\nwith open(config.stopwords, encoding='utf-8', mode='r') as f:\n for line in f.readlines():\n self.stopwords.append(line.strip())\nself.tfidf = None\nself.w2v = None\nself.LDAmodel = None", "data = pd.read_csv(path, sep='\\t', header=0)\ndata = data.fillna('')\ndata['text'] = data['...
<|body_start_0|> self.stopwords = [] with open(config.stopwords, encoding='utf-8', mode='r') as f: for line in f.readlines(): self.stopwords.append(line.strip()) self.tfidf = None self.w2v = None self.LDAmodel = None <|end_body_0|> <|body_start_1|> ...
Embedding
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Embedding: def __init__(self): """@description: This is embedding class. Maybe call so many times. we need use singleton model. In this class, we can use tfidf, word2vec, fasttext, autoencoder word embedding @param {type} None @return: None""" <|body_0|> def load_data(self, ...
stack_v2_sparse_classes_36k_train_014874
5,727
no_license
[ { "docstring": "@description: This is embedding class. Maybe call so many times. we need use singleton model. In this class, we can use tfidf, word2vec, fasttext, autoencoder word embedding @param {type} None @return: None", "name": "__init__", "signature": "def __init__(self)" }, { "docstring":...
5
stack_v2_sparse_classes_30k_train_011224
Implement the Python class `Embedding` described below. Class description: Implement the Embedding class. Method signatures and docstrings: - def __init__(self): @description: This is embedding class. Maybe call so many times. we need use singleton model. In this class, we can use tfidf, word2vec, fasttext, autoencod...
Implement the Python class `Embedding` described below. Class description: Implement the Embedding class. Method signatures and docstrings: - def __init__(self): @description: This is embedding class. Maybe call so many times. we need use singleton model. In this class, we can use tfidf, word2vec, fasttext, autoencod...
2a31482ba1f3dacc1a225fefe8e96f7974042ba5
<|skeleton|> class Embedding: def __init__(self): """@description: This is embedding class. Maybe call so many times. we need use singleton model. In this class, we can use tfidf, word2vec, fasttext, autoencoder word embedding @param {type} None @return: None""" <|body_0|> def load_data(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Embedding: def __init__(self): """@description: This is embedding class. Maybe call so many times. we need use singleton model. In this class, we can use tfidf, word2vec, fasttext, autoencoder word embedding @param {type} None @return: None""" self.stopwords = [] with open(config.stopw...
the_stack_v2_python_sparse
ml/embedding.py
yangyuxiang1996/NLP_Text_Classification_for_Intelligent_Triage
train
1
a4254479ee9ae1661f588d95bf8a1a5f8405f8f4
[ "best_data = {'cuisine_primary': ['thai'], 'restaurant': ['thai garden'], 'boro': ['manhattan'], 'swc_type': ['no cafe'], 'score': [0], 'grade': ['a'], 'inspectiondate': ['1/2/2014']}\nbest_restaurant = pd.DataFrame(best_data, columns=['cuisine_primary', 'restaurant', 'boro', 'swc_type', 'score', 'grade', 'inspecti...
<|body_start_0|> best_data = {'cuisine_primary': ['thai'], 'restaurant': ['thai garden'], 'boro': ['manhattan'], 'swc_type': ['no cafe'], 'score': [0], 'grade': ['a'], 'inspectiondate': ['1/2/2014']} best_restaurant = pd.DataFrame(best_data, columns=['cuisine_primary', 'restaurant', 'boro', 'swc_type', ...
Check that get_best_and_worst_data returns the DataFrames of the best and worst restaurants Note: To check for equality of a tuple (DataFrame, DataFrame), I unpack and check each DataFrame individually
GetBestAndWorstDataTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetBestAndWorstDataTests: """Check that get_best_and_worst_data returns the DataFrames of the best and worst restaurants Note: To check for equality of a tuple (DataFrame, DataFrame), I unpack and check each DataFrame individually""" def test_get_best_data(self): """Test that the fun...
stack_v2_sparse_classes_36k_train_014875
6,403
no_license
[ { "docstring": "Test that the function correctly returns the observations of the best restaurant", "name": "test_get_best_data", "signature": "def test_get_best_data(self)" }, { "docstring": "Test that the function correctly returns the observations of the worst restaurant", "name": "test_ge...
2
stack_v2_sparse_classes_30k_train_006217
Implement the Python class `GetBestAndWorstDataTests` described below. Class description: Check that get_best_and_worst_data returns the DataFrames of the best and worst restaurants Note: To check for equality of a tuple (DataFrame, DataFrame), I unpack and check each DataFrame individually Method signatures and docs...
Implement the Python class `GetBestAndWorstDataTests` described below. Class description: Check that get_best_and_worst_data returns the DataFrames of the best and worst restaurants Note: To check for equality of a tuple (DataFrame, DataFrame), I unpack and check each DataFrame individually Method signatures and docs...
dc9185cbc5e65650d985ebecf877a157c8c19a13
<|skeleton|> class GetBestAndWorstDataTests: """Check that get_best_and_worst_data returns the DataFrames of the best and worst restaurants Note: To check for equality of a tuple (DataFrame, DataFrame), I unpack and check each DataFrame individually""" def test_get_best_data(self): """Test that the fun...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetBestAndWorstDataTests: """Check that get_best_and_worst_data returns the DataFrames of the best and worst restaurants Note: To check for equality of a tuple (DataFrame, DataFrame), I unpack and check each DataFrame individually""" def test_get_best_data(self): """Test that the function correct...
the_stack_v2_python_sparse
lh1036/test_inspectiongrades/test_visualizer.py
ds-ga-1007/final_project
train
0
240220008537661d1bb76f7a3d7d8544cb0f472d
[ "url = host + '/api/goods/list'\nr = requests.get(url=url).json()\nout_format('获取产品列表:', r)\nif len(r['data']) != 0:\n sku = r['data'][-1]['sku']\n goods_id = r['data'][-1]['id']\n print('sku:', sku)\n return (sku, goods_id)\nelse:\n print('data is NULL')", "url = host + '/api/address/list'\nr = re...
<|body_start_0|> url = host + '/api/goods/list' r = requests.get(url=url).json() out_format('获取产品列表:', r) if len(r['data']) != 0: sku = r['data'][-1]['sku'] goods_id = r['data'][-1]['id'] print('sku:', sku) return (sku, goods_id) el...
定义一个公共方法的测试类
pubilc_func
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class pubilc_func: """定义一个公共方法的测试类""" def test_get_pro_list(self): """获取产品列表 :return:sku:商品规格""" <|body_0|> def test_address_list(self): """获取地址列表 :param:token:用户授权token :return:address_id:地址id""" <|body_1|> def test_order_list(self): """订单列表 :para...
stack_v2_sparse_classes_36k_train_014876
5,772
no_license
[ { "docstring": "获取产品列表 :return:sku:商品规格", "name": "test_get_pro_list", "signature": "def test_get_pro_list(self)" }, { "docstring": "获取地址列表 :param:token:用户授权token :return:address_id:地址id", "name": "test_address_list", "signature": "def test_address_list(self)" }, { "docstring": "...
6
null
Implement the Python class `pubilc_func` described below. Class description: 定义一个公共方法的测试类 Method signatures and docstrings: - def test_get_pro_list(self): 获取产品列表 :return:sku:商品规格 - def test_address_list(self): 获取地址列表 :param:token:用户授权token :return:address_id:地址id - def test_order_list(self): 订单列表 :param:token:用户授权tok...
Implement the Python class `pubilc_func` described below. Class description: 定义一个公共方法的测试类 Method signatures and docstrings: - def test_get_pro_list(self): 获取产品列表 :return:sku:商品规格 - def test_address_list(self): 获取地址列表 :param:token:用户授权token :return:address_id:地址id - def test_order_list(self): 订单列表 :param:token:用户授权tok...
0ebaae335de2f1633e31c4fc3f60e556220a8bfb
<|skeleton|> class pubilc_func: """定义一个公共方法的测试类""" def test_get_pro_list(self): """获取产品列表 :return:sku:商品规格""" <|body_0|> def test_address_list(self): """获取地址列表 :param:token:用户授权token :return:address_id:地址id""" <|body_1|> def test_order_list(self): """订单列表 :para...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class pubilc_func: """定义一个公共方法的测试类""" def test_get_pro_list(self): """获取产品列表 :return:sku:商品规格""" url = host + '/api/goods/list' r = requests.get(url=url).json() out_format('获取产品列表:', r) if len(r['data']) != 0: sku = r['data'][-1]['sku'] goods_id =...
the_stack_v2_python_sparse
Atle/interface/framework/common/public_func.py
shiqi0128/My_scripts
train
0
07c82af68cd6d99cd537bc4a97438556e37c861c
[ "str = ''\nif root is None:\n return str\nnodes = [root]\nwhile nodes.__len__():\n temp = []\n count = 0\n for node in nodes:\n if node:\n str += '{} '.format(node.val)\n temp.append(node.left)\n temp.append(node.right)\n if node.left:\n ...
<|body_start_0|> str = '' if root is None: return str nodes = [root] while nodes.__len__(): temp = [] count = 0 for node in nodes: if node: str += '{} '.format(node.val) temp.append(no...
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_014877
2,736
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_009094
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:...
055ace9f0ca4fb09326da77ae39e33173b3bde15
<|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""" str = '' if root is None: return str nodes = [root] while nodes.__len__(): temp = [] count = 0 for node in nodes: ...
the_stack_v2_python_sparse
leetcode/0297_H_二叉树的序列化与反序列化.py
CrzRabbit/Python
train
2
20877521465dd7b1a272e3f9d7ecfd5c8d02616c
[ "self.nestedList = nestedList\nself.index = 0\nself.temp = None", "if self.temp == None:\n currentItem = self.nestedList[self.index]\n if type(currentItem) != list:\n self.index += 1\n return currentItem\n else:\n self.temp = NestedIterator(currentItem)\n return self.temp.next...
<|body_start_0|> self.nestedList = nestedList self.index = 0 self.temp = None <|end_body_0|> <|body_start_1|> if self.temp == None: currentItem = self.nestedList[self.index] if type(currentItem) != list: self.index += 1 return curr...
NestedIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NestedIterator: def __init__(self, nestedList): """Initialize your data structure here. :type nestedList: List[NestedInteger]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|e...
stack_v2_sparse_classes_36k_train_014878
1,590
no_license
[ { "docstring": "Initialize your data structure here. :type nestedList: List[NestedInteger]", "name": "__init__", "signature": "def __init__(self, nestedList)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "nam...
3
null
Implement the Python class `NestedIterator` described below. Class description: Implement the NestedIterator class. Method signatures and docstrings: - def __init__(self, nestedList): Initialize your data structure here. :type nestedList: List[NestedInteger] - def next(self): :rtype: int - def hasNext(self): :rtype: ...
Implement the Python class `NestedIterator` described below. Class description: Implement the NestedIterator class. Method signatures and docstrings: - def __init__(self, nestedList): Initialize your data structure here. :type nestedList: List[NestedInteger] - def next(self): :rtype: int - def hasNext(self): :rtype: ...
c937fe19be665ba7ac345e1729ff531f370f30e8
<|skeleton|> class NestedIterator: def __init__(self, nestedList): """Initialize your data structure here. :type nestedList: List[NestedInteger]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NestedIterator: def __init__(self, nestedList): """Initialize your data structure here. :type nestedList: List[NestedInteger]""" self.nestedList = nestedList self.index = 0 self.temp = None def next(self): """:rtype: int""" if self.temp == None: ...
the_stack_v2_python_sparse
google/NestedIterator.py
nguyenngochuy91/companyQuestions
train
1
3411011eaa56df200626ae166e2c566fb42f0ecb
[ "excludedStates = ['VIRGIN ISLANDS', 'PUERTO RICO', 'GUAM', 'ALASKA', 'HAWAII']\nlowerLimit = -400\nupperLimit = -60\nfile = './FilteredData/filteredData.csv'\ndf = pd.read_csv(file)\ndf = df[(df['BEGIN_LON'] > -400) & (df['BEGIN_LON'] < -60) & (df['STATE'].isin(excludedStates) == False)]\nself.frame = df", "df =...
<|body_start_0|> excludedStates = ['VIRGIN ISLANDS', 'PUERTO RICO', 'GUAM', 'ALASKA', 'HAWAII'] lowerLimit = -400 upperLimit = -60 file = './FilteredData/filteredData.csv' df = pd.read_csv(file) df = df[(df['BEGIN_LON'] > -400) & (df['BEGIN_LON'] < -60) & (df['STATE'].isi...
For a given year and list of event types, gives access to longitude and latitude data for events
MapDataSelector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MapDataSelector: """For a given year and list of event types, gives access to longitude and latitude data for events""" def __init__(self, file): """Loads the events, and excludes storms beginning off map, or in untracked states""" <|body_0|> def getYearData(self, year, ...
stack_v2_sparse_classes_36k_train_014879
980
no_license
[ { "docstring": "Loads the events, and excludes storms beginning off map, or in untracked states", "name": "__init__", "signature": "def __init__(self, file)" }, { "docstring": "Returns a tuple of a longitude dataframe and a latitude dataframe for the given year and event list", "name": "getY...
2
null
Implement the Python class `MapDataSelector` described below. Class description: For a given year and list of event types, gives access to longitude and latitude data for events Method signatures and docstrings: - def __init__(self, file): Loads the events, and excludes storms beginning off map, or in untracked state...
Implement the Python class `MapDataSelector` described below. Class description: For a given year and list of event types, gives access to longitude and latitude data for events Method signatures and docstrings: - def __init__(self, file): Loads the events, and excludes storms beginning off map, or in untracked state...
dc9185cbc5e65650d985ebecf877a157c8c19a13
<|skeleton|> class MapDataSelector: """For a given year and list of event types, gives access to longitude and latitude data for events""" def __init__(self, file): """Loads the events, and excludes storms beginning off map, or in untracked states""" <|body_0|> def getYearData(self, year, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MapDataSelector: """For a given year and list of event types, gives access to longitude and latitude data for events""" def __init__(self, file): """Loads the events, and excludes storms beginning off map, or in untracked states""" excludedStates = ['VIRGIN ISLANDS', 'PUERTO RICO', 'GUAM'...
the_stack_v2_python_sparse
rb2540/MapDataSelector.py
ds-ga-1007/final_project
train
0
c5948837d4126533afeac318f888c79053abe88e
[ "idxes = [e[0] for e in endpoints]\nassert idxes == sorted(idxes)\nself._interpolation = linear_interpolation\nself._outside_value = outside_value\nself._endpoints = endpoints", "for (l_t, l), (r_t, r) in zip(self._endpoints[:-1], self._endpoints[1:]):\n if l_t <= t and t < r_t:\n alpha = float(t - l_t)...
<|body_start_0|> idxes = [e[0] for e in endpoints] assert idxes == sorted(idxes) self._interpolation = linear_interpolation self._outside_value = outside_value self._endpoints = endpoints <|end_body_0|> <|body_start_1|> for (l_t, l), (r_t, r) in zip(self._endpoints[:-1],...
PiecewiseSchedule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PiecewiseSchedule: def __init__(self, endpoints, outside_value=None): """Piecewise schedule. endpoints: [(int, int)] list of pairs `(time, value)` meanining that schedule should output `value` when `t==time`. All the values for time must be sorted in an increasing order. When t is betwee...
stack_v2_sparse_classes_36k_train_014880
3,699
permissive
[ { "docstring": "Piecewise schedule. endpoints: [(int, int)] list of pairs `(time, value)` meanining that schedule should output `value` when `t==time`. All the values for time must be sorted in an increasing order. When t is between two times, e.g. `(time_a, value_a)` and `(time_b, value_b)`, such that `time_a ...
2
stack_v2_sparse_classes_30k_val_000099
Implement the Python class `PiecewiseSchedule` described below. Class description: Implement the PiecewiseSchedule class. Method signatures and docstrings: - def __init__(self, endpoints, outside_value=None): Piecewise schedule. endpoints: [(int, int)] list of pairs `(time, value)` meanining that schedule should outp...
Implement the Python class `PiecewiseSchedule` described below. Class description: Implement the PiecewiseSchedule class. Method signatures and docstrings: - def __init__(self, endpoints, outside_value=None): Piecewise schedule. endpoints: [(int, int)] list of pairs `(time, value)` meanining that schedule should outp...
e1bbbaecf18cdc9f8edfbef8075b988a61e21235
<|skeleton|> class PiecewiseSchedule: def __init__(self, endpoints, outside_value=None): """Piecewise schedule. endpoints: [(int, int)] list of pairs `(time, value)` meanining that schedule should output `value` when `t==time`. All the values for time must be sorted in an increasing order. When t is betwee...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PiecewiseSchedule: def __init__(self, endpoints, outside_value=None): """Piecewise schedule. endpoints: [(int, int)] list of pairs `(time, value)` meanining that schedule should output `value` when `t==time`. All the values for time must be sorted in an increasing order. When t is between two times, e...
the_stack_v2_python_sparse
utils.py
brett-daley/dqn-lambda
train
20
26fac3c68d357edadb5ae307b68ba5eafc4a147a
[ "array = tf.convert_to_tensor(array, dtype=tf.float16)\nstandardized_array = load._standardize_data(array, epsilon=0)\nnp.testing.assert_allclose(np.array(standardized_array), np.array([-1.225, 0.0, 1.225]), rtol=0.001, atol=0)", "data = load._preprocess_structured_data(features, label)\nchex.assert_shape(data.x,...
<|body_start_0|> array = tf.convert_to_tensor(array, dtype=tf.float16) standardized_array = load._standardize_data(array, epsilon=0) np.testing.assert_allclose(np.array(standardized_array), np.array([-1.225, 0.0, 1.225]), rtol=0.001, atol=0) <|end_body_0|> <|body_start_1|> data = load._...
LoadTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoadTest: def test_standardize_data(self, array: np.ndarray): """Test data standardization method.""" <|body_0|> def test_preprocess_structured_data(self, features: load.Features, label: int): """Test converting structured data into testbed standardized dictionary fo...
stack_v2_sparse_classes_36k_train_014881
3,101
permissive
[ { "docstring": "Test data standardization method.", "name": "test_standardize_data", "signature": "def test_standardize_data(self, array: np.ndarray)" }, { "docstring": "Test converting structured data into testbed standardized dictionary format.", "name": "test_preprocess_structured_data", ...
4
null
Implement the Python class `LoadTest` described below. Class description: Implement the LoadTest class. Method signatures and docstrings: - def test_standardize_data(self, array: np.ndarray): Test data standardization method. - def test_preprocess_structured_data(self, features: load.Features, label: int): Test conve...
Implement the Python class `LoadTest` described below. Class description: Implement the LoadTest class. Method signatures and docstrings: - def test_standardize_data(self, array: np.ndarray): Test data standardization method. - def test_preprocess_structured_data(self, features: load.Features, label: int): Test conve...
cc2e3de49c29f29852c8cd5885ab54fb6e664e2e
<|skeleton|> class LoadTest: def test_standardize_data(self, array: np.ndarray): """Test data standardization method.""" <|body_0|> def test_preprocess_structured_data(self, features: load.Features, label: int): """Test converting structured data into testbed standardized dictionary fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoadTest: def test_standardize_data(self, array: np.ndarray): """Test data standardization method.""" array = tf.convert_to_tensor(array, dtype=tf.float16) standardized_array = load._standardize_data(array, epsilon=0) np.testing.assert_allclose(np.array(standardized_array), np....
the_stack_v2_python_sparse
neural_testbed/real_data/load_classification_test.py
Aakanksha-Rana/neural_testbed
train
0
1068d2f4d8383c3aa6a1a9c5e0f7ea6c5bd14c99
[ "super().__init__(context)\nself._beam_pipeline_args = []\nself._make_beam_pipeline_fn = None\nif context:\n if isinstance(context, BaseBeamExecutor.Context):\n self._beam_pipeline_args = context.beam_pipeline_args or []\n self._make_beam_pipeline_fn = context.make_beam_pipeline_fn\n else:\n ...
<|body_start_0|> super().__init__(context) self._beam_pipeline_args = [] self._make_beam_pipeline_fn = None if context: if isinstance(context, BaseBeamExecutor.Context): self._beam_pipeline_args = context.beam_pipeline_args or [] self._make_bea...
Abstract TFX executor class for Beam powered components.
BaseBeamExecutor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseBeamExecutor: """Abstract TFX executor class for Beam powered components.""" def __init__(self, context: Optional[Context]=None): """Constructs a beam based executor.""" <|body_0|> def _make_beam_pipeline(self) -> _BeamPipeline: """Makes beam pipeline.""" ...
stack_v2_sparse_classes_36k_train_014882
5,166
permissive
[ { "docstring": "Constructs a beam based executor.", "name": "__init__", "signature": "def __init__(self, context: Optional[Context]=None)" }, { "docstring": "Makes beam pipeline.", "name": "_make_beam_pipeline", "signature": "def _make_beam_pipeline(self) -> _BeamPipeline" } ]
2
stack_v2_sparse_classes_30k_train_018794
Implement the Python class `BaseBeamExecutor` described below. Class description: Abstract TFX executor class for Beam powered components. Method signatures and docstrings: - def __init__(self, context: Optional[Context]=None): Constructs a beam based executor. - def _make_beam_pipeline(self) -> _BeamPipeline: Makes ...
Implement the Python class `BaseBeamExecutor` described below. Class description: Abstract TFX executor class for Beam powered components. Method signatures and docstrings: - def __init__(self, context: Optional[Context]=None): Constructs a beam based executor. - def _make_beam_pipeline(self) -> _BeamPipeline: Makes ...
1b328504fa08a70388691e4072df76f143631325
<|skeleton|> class BaseBeamExecutor: """Abstract TFX executor class for Beam powered components.""" def __init__(self, context: Optional[Context]=None): """Constructs a beam based executor.""" <|body_0|> def _make_beam_pipeline(self) -> _BeamPipeline: """Makes beam pipeline.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseBeamExecutor: """Abstract TFX executor class for Beam powered components.""" def __init__(self, context: Optional[Context]=None): """Constructs a beam based executor.""" super().__init__(context) self._beam_pipeline_args = [] self._make_beam_pipeline_fn = None ...
the_stack_v2_python_sparse
tfx/dsl/components/base/base_beam_executor.py
tensorflow/tfx
train
2,116
1451ccf5ff0951b9c8a222db4384a22ec0166fec
[ "self.pos_enc_type = pos_enc_type\nsuper(ConformerEncoderLayer, self).__init__()\nself.ffn1 = FeedForwardModule(embed_dim, ffn_embed_dim, dropout, dropout)\nself.self_attn_layer_norm = LayerNorm(embed_dim, export=False)\nself.self_attn_dropout = torch.nn.Dropout(dropout)\nif attn_type == 'espnet':\n if self.pos_...
<|body_start_0|> self.pos_enc_type = pos_enc_type super(ConformerEncoderLayer, self).__init__() self.ffn1 = FeedForwardModule(embed_dim, ffn_embed_dim, dropout, dropout) self.self_attn_layer_norm = LayerNorm(embed_dim, export=False) self.self_attn_dropout = torch.nn.Dropout(dropo...
Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA
ConformerEncoderLayer
[ "LicenseRef-scancode-unknown-license-reference", "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConformerEncoderLayer: """Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA""" def __init__(self, embed_dim, ffn_embed_dim, attention_heads, dropout, use_fp16, depthwise_conv_kernel_size=31, activation_fn='swish', attn_t...
stack_v2_sparse_classes_36k_train_014883
9,087
permissive
[ { "docstring": "Args: embed_dim: Input embedding dimension ffn_embed_dim: FFN layer dimension attention_heads: Number of attention heads in MHA dropout: dropout value depthwise_conv_kernel_size: Size of kernel in depthwise conv layer in convolution module activation_fn: Activation function name to use in convul...
2
stack_v2_sparse_classes_30k_train_008016
Implement the Python class `ConformerEncoderLayer` described below. Class description: Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA Method signatures and docstrings: - def __init__(self, embed_dim, ffn_embed_dim, attention_heads, dropout, us...
Implement the Python class `ConformerEncoderLayer` described below. Class description: Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA Method signatures and docstrings: - def __init__(self, embed_dim, ffn_embed_dim, attention_heads, dropout, us...
b60c741f746877293bb85eed6806736fc8fa0ffd
<|skeleton|> class ConformerEncoderLayer: """Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA""" def __init__(self, embed_dim, ffn_embed_dim, attention_heads, dropout, use_fp16, depthwise_conv_kernel_size=31, activation_fn='swish', attn_t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConformerEncoderLayer: """Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA""" def __init__(self, embed_dim, ffn_embed_dim, attention_heads, dropout, use_fp16, depthwise_conv_kernel_size=31, activation_fn='swish', attn_type=None, pos...
the_stack_v2_python_sparse
kosmos-2/fairseq/fairseq/modules/conformer_layer.py
microsoft/unilm
train
15,313
eb594c29a9c5cd8fb406336d507f47e8b326ee9a
[ "self.screen = screen\nself.title_obj = title_obj\nself.unpackButtons(buttons)\nself.background_location = background_location\nif background_location != False:\n self.background = pygame.image.load(background_location)\n self.background_rect = pygame.Rect((0, 0, 1, 1))\nself.playing = True", "if self.backg...
<|body_start_0|> self.screen = screen self.title_obj = title_obj self.unpackButtons(buttons) self.background_location = background_location if background_location != False: self.background = pygame.image.load(background_location) self.background_rect = pyg...
Menu Class which generates and contains menu functionality
Menu
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Menu: """Menu Class which generates and contains menu functionality""" def __init__(self, screen, title_obj, background_location, *buttons): """Menu Unpacks buttons passed into menu""" <|body_0|> def display(self): """Displays all buttons on the screen""" ...
stack_v2_sparse_classes_36k_train_014884
7,504
permissive
[ { "docstring": "Menu Unpacks buttons passed into menu", "name": "__init__", "signature": "def __init__(self, screen, title_obj, background_location, *buttons)" }, { "docstring": "Displays all buttons on the screen", "name": "display", "signature": "def display(self)" }, { "docstr...
5
stack_v2_sparse_classes_30k_val_000436
Implement the Python class `Menu` described below. Class description: Menu Class which generates and contains menu functionality Method signatures and docstrings: - def __init__(self, screen, title_obj, background_location, *buttons): Menu Unpacks buttons passed into menu - def display(self): Displays all buttons on ...
Implement the Python class `Menu` described below. Class description: Menu Class which generates and contains menu functionality Method signatures and docstrings: - def __init__(self, screen, title_obj, background_location, *buttons): Menu Unpacks buttons passed into menu - def display(self): Displays all buttons on ...
01ace29afb066e6d5965d1fd460c5939c8b8c81b
<|skeleton|> class Menu: """Menu Class which generates and contains menu functionality""" def __init__(self, screen, title_obj, background_location, *buttons): """Menu Unpacks buttons passed into menu""" <|body_0|> def display(self): """Displays all buttons on the screen""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Menu: """Menu Class which generates and contains menu functionality""" def __init__(self, screen, title_obj, background_location, *buttons): """Menu Unpacks buttons passed into menu""" self.screen = screen self.title_obj = title_obj self.unpackButtons(buttons) self...
the_stack_v2_python_sparse
classes/menu.py
ShayLn/py-fighter
train
0
834fda0c1e8e7c30970e34f92c72875790dd74d1
[ "super(XLSReader, self).__init__(filename)\nself.sheet = None\nself.row_pos = 0\nself.book = None\nself.sheet = None\nif filename:\n self.book = xlrd.open_workbook(filename)\n self.sheet = self.book.sheet_by_index(0)", "if not self.sheet:\n raise StopIteration\nif self.row_pos >= self.sheet.nrows:\n r...
<|body_start_0|> super(XLSReader, self).__init__(filename) self.sheet = None self.row_pos = 0 self.book = None self.sheet = None if filename: self.book = xlrd.open_workbook(filename) self.sheet = self.book.sheet_by_index(0) <|end_body_0|> <|body_s...
XLS/XLSX file's reader.
XLSReader
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XLSReader: """XLS/XLSX file's reader.""" def __init__(self, filename=None): """Args: filename: (String) data file's name. Returns: None""" <|body_0|> def readln(self): """Read data line. Returns: list: data line""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_014885
3,117
permissive
[ { "docstring": "Args: filename: (String) data file's name. Returns: None", "name": "__init__", "signature": "def __init__(self, filename=None)" }, { "docstring": "Read data line. Returns: list: data line", "name": "readln", "signature": "def readln(self)" } ]
2
stack_v2_sparse_classes_30k_train_012161
Implement the Python class `XLSReader` described below. Class description: XLS/XLSX file's reader. Method signatures and docstrings: - def __init__(self, filename=None): Args: filename: (String) data file's name. Returns: None - def readln(self): Read data line. Returns: list: data line
Implement the Python class `XLSReader` described below. Class description: XLS/XLSX file's reader. Method signatures and docstrings: - def __init__(self, filename=None): Args: filename: (String) data file's name. Returns: None - def readln(self): Read data line. Returns: list: data line <|skeleton|> class XLSReader:...
5fa06b29bf800646dc4da5851fdf7a1f299f15a7
<|skeleton|> class XLSReader: """XLS/XLSX file's reader.""" def __init__(self, filename=None): """Args: filename: (String) data file's name. Returns: None""" <|body_0|> def readln(self): """Read data line. Returns: list: data line""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XLSReader: """XLS/XLSX file's reader.""" def __init__(self, filename=None): """Args: filename: (String) data file's name. Returns: None""" super(XLSReader, self).__init__(filename) self.sheet = None self.row_pos = 0 self.book = None self.sheet = None ...
the_stack_v2_python_sparse
muddery/common/utils/readers.py
muddery/muddery
train
139
ebeec8c223cdcf0644c75a5e67d4b783962a1c16
[ "self.part = part\nself.inner_path = self.inner_path / f'{self.part}.csv'\nif not self.data_root_path.exists() and datapath is None:\n raise RuntimeError(f\"Dataset from repository 'https://github.com/nlpub/russe-wsi-kit' has a lot of bugs. So you should specify @datapath argument in the config file.\")\nself.da...
<|body_start_0|> self.part = part self.inner_path = self.inner_path / f'{self.part}.csv' if not self.data_root_path.exists() and datapath is None: raise RuntimeError(f"Dataset from repository 'https://github.com/nlpub/russe-wsi-kit' has a lot of bugs. So you should specify @datapath ...
RusseBTSRNCDatasetReader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RusseBTSRNCDatasetReader: def __init__(self, part: str='train', datapath: str=None): """Reader for RUSSE WSI dataset - bts-rnc: https://github.com/nlpub/russe-wsi-kit Args: part: part of the bts-rnc dataset""" <|body_0|> def read_dataset(self, limit: int=None) -> Tuple[pd.Da...
stack_v2_sparse_classes_36k_train_014886
3,944
permissive
[ { "docstring": "Reader for RUSSE WSI dataset - bts-rnc: https://github.com/nlpub/russe-wsi-kit Args: part: part of the bts-rnc dataset", "name": "__init__", "signature": "def __init__(self, part: str='train', datapath: str=None)" }, { "docstring": "Reads defined part of bts-rnc dataset Returns: ...
2
stack_v2_sparse_classes_30k_train_011116
Implement the Python class `RusseBTSRNCDatasetReader` described below. Class description: Implement the RusseBTSRNCDatasetReader class. Method signatures and docstrings: - def __init__(self, part: str='train', datapath: str=None): Reader for RUSSE WSI dataset - bts-rnc: https://github.com/nlpub/russe-wsi-kit Args: pa...
Implement the Python class `RusseBTSRNCDatasetReader` described below. Class description: Implement the RusseBTSRNCDatasetReader class. Method signatures and docstrings: - def __init__(self, part: str='train', datapath: str=None): Reader for RUSSE WSI dataset - bts-rnc: https://github.com/nlpub/russe-wsi-kit Args: pa...
c87f67e5fe51fc8307b5d5ff8f404f202f17ab5e
<|skeleton|> class RusseBTSRNCDatasetReader: def __init__(self, part: str='train', datapath: str=None): """Reader for RUSSE WSI dataset - bts-rnc: https://github.com/nlpub/russe-wsi-kit Args: part: part of the bts-rnc dataset""" <|body_0|> def read_dataset(self, limit: int=None) -> Tuple[pd.Da...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RusseBTSRNCDatasetReader: def __init__(self, part: str='train', datapath: str=None): """Reader for RUSSE WSI dataset - bts-rnc: https://github.com/nlpub/russe-wsi-kit Args: part: part of the bts-rnc dataset""" self.part = part self.inner_path = self.inner_path / f'{self.part}.csv' ...
the_stack_v2_python_sparse
lexsubgen/datasets/wsi_ru.py
agoel00/LexSubGen
train
0
1f631787a1f0788076b98af08cf092fa61d0ad07
[ "kwargs = super(BaseView, self).get_context_data(**kwargs)\nkwargs['next'] = self.request.REQUEST.get('next', '')\nreturn kwargs", "tel = request.REQUEST.get('tel')\npassword = request.REQUEST.get('password')\nif not tel:\n messages.error(request, u'账号不能为空')\n return self.get(request, *args, **kwargs)\nif n...
<|body_start_0|> kwargs = super(BaseView, self).get_context_data(**kwargs) kwargs['next'] = self.request.REQUEST.get('next', '') return kwargs <|end_body_0|> <|body_start_1|> tel = request.REQUEST.get('tel') password = request.REQUEST.get('password') if not tel: ...
登录视图 by:范俊伟 at:2015-01-21 登录视图,用于前台界面 by:范俊伟 at:2015-01-26 简单登录界面 by: 范俊伟 at:2015-03-11 增加 next 参数的配置 by: 王健 at:2015-03-16
LoginView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginView: """登录视图 by:范俊伟 at:2015-01-21 登录视图,用于前台界面 by:范俊伟 at:2015-01-26 简单登录界面 by: 范俊伟 at:2015-03-11 增加 next 参数的配置 by: 王健 at:2015-03-16""" def get_context_data(self, **kwargs): """获取模板所需的变量 by:范俊伟 at:2015-01-21""" <|body_0|> def post(self, request, *args, **kwargs): ...
stack_v2_sparse_classes_36k_train_014887
9,935
no_license
[ { "docstring": "获取模板所需的变量 by:范俊伟 at:2015-01-21", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "post请求 by: 范俊伟 at:2015-03-11 修改登录界面 by: 范俊伟 at:2015-03-11 修改默认跳转地址 by: 范俊伟 at:2015-03-17 NSUser增加is_used字段 by: 尚宗凯 at:2015-03-20 NSUser删除is_used字段 b...
2
null
Implement the Python class `LoginView` described below. Class description: 登录视图 by:范俊伟 at:2015-01-21 登录视图,用于前台界面 by:范俊伟 at:2015-01-26 简单登录界面 by: 范俊伟 at:2015-03-11 增加 next 参数的配置 by: 王健 at:2015-03-16 Method signatures and docstrings: - def get_context_data(self, **kwargs): 获取模板所需的变量 by:范俊伟 at:2015-01-21 - def post(self...
Implement the Python class `LoginView` described below. Class description: 登录视图 by:范俊伟 at:2015-01-21 登录视图,用于前台界面 by:范俊伟 at:2015-01-26 简单登录界面 by: 范俊伟 at:2015-03-11 增加 next 参数的配置 by: 王健 at:2015-03-16 Method signatures and docstrings: - def get_context_data(self, **kwargs): 获取模板所需的变量 by:范俊伟 at:2015-01-21 - def post(self...
f8b5cb3adcb8c907834ec3fad1f82bf36be688b7
<|skeleton|> class LoginView: """登录视图 by:范俊伟 at:2015-01-21 登录视图,用于前台界面 by:范俊伟 at:2015-01-26 简单登录界面 by: 范俊伟 at:2015-03-11 增加 next 参数的配置 by: 王健 at:2015-03-16""" def get_context_data(self, **kwargs): """获取模板所需的变量 by:范俊伟 at:2015-01-21""" <|body_0|> def post(self, request, *args, **kwargs): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginView: """登录视图 by:范俊伟 at:2015-01-21 登录视图,用于前台界面 by:范俊伟 at:2015-01-26 简单登录界面 by: 范俊伟 at:2015-03-11 增加 next 参数的配置 by: 王健 at:2015-03-16""" def get_context_data(self, **kwargs): """获取模板所需的变量 by:范俊伟 at:2015-01-21""" kwargs = super(BaseView, self).get_context_data(**kwargs) kwargs['...
the_stack_v2_python_sparse
webhtml/base/views.py
cash2one/ESNS
train
0
1c6315bf1ee497701ab03a0319aa9cf1024b13f0
[ "url = '/success_admissions/'\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 302)", "url = '/success_admissions/'\nself.client.login(username=self.adminUN, password='pass')\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response...
<|body_start_0|> url = '/success_admissions/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status_code, 302) <|end_body_0|> <|body_start_1|> url = '/success_admissions/' self.client.login(username=self.adminUN, password='pass') re...
SuccessAdmissionsTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuccessAdmissionsTestCase: def test_not_logged_in(self): """Test that the success admissions view will redirect whilst not logged in and no payment made.""" <|body_0|> def test_logged_in_admin(self): """Test that the success admissions view will redirect whilst logge...
stack_v2_sparse_classes_36k_train_014888
26,818
permissive
[ { "docstring": "Test that the success admissions view will redirect whilst not logged in and no payment made.", "name": "test_not_logged_in", "signature": "def test_not_logged_in(self)" }, { "docstring": "Test that the success admissions view will redirect whilst logged in as admin and no paymen...
3
null
Implement the Python class `SuccessAdmissionsTestCase` described below. Class description: Implement the SuccessAdmissionsTestCase class. Method signatures and docstrings: - def test_not_logged_in(self): Test that the success admissions view will redirect whilst not logged in and no payment made. - def test_logged_in...
Implement the Python class `SuccessAdmissionsTestCase` described below. Class description: Implement the SuccessAdmissionsTestCase class. Method signatures and docstrings: - def test_not_logged_in(self): Test that the success admissions view will redirect whilst not logged in and no payment made. - def test_logged_in...
37d2942efcbdaad072f7a06ac876a40e0f69f702
<|skeleton|> class SuccessAdmissionsTestCase: def test_not_logged_in(self): """Test that the success admissions view will redirect whilst not logged in and no payment made.""" <|body_0|> def test_logged_in_admin(self): """Test that the success admissions view will redirect whilst logge...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SuccessAdmissionsTestCase: def test_not_logged_in(self): """Test that the success admissions view will redirect whilst not logged in and no payment made.""" url = '/success_admissions/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status...
the_stack_v2_python_sparse
mooring/test_views.py
dbca-wa/moorings
train
0
382b8c12a02887bdf524f81cbcbe63b3c27115e2
[ "rqst = Request('GET', '/manager/status')\nrqst.set_json({'status': 'running'})\nasync with rqst.fetch() as resp:\n return await resp.json()", "rqst = Request('PUT', '/manager/status')\nrqst.set_json({'status': 'frozen', 'force_kill': force_kill})\nasync with rqst.fetch():\n pass", "rqst = Request('PUT', ...
<|body_start_0|> rqst = Request('GET', '/manager/status') rqst.set_json({'status': 'running'}) async with rqst.fetch() as resp: return await resp.json() <|end_body_0|> <|body_start_1|> rqst = Request('PUT', '/manager/status') rqst.set_json({'status': 'frozen', 'force...
Provides controlling of the gateway/manager servers. .. versionadded:: 18.12
Manager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Manager: """Provides controlling of the gateway/manager servers. .. versionadded:: 18.12""" async def status(cls): """Returns the current status of the configured API server.""" <|body_0|> async def freeze(cls, force_kill: bool=False): """Freezes the configured A...
stack_v2_sparse_classes_36k_train_014889
3,078
permissive
[ { "docstring": "Returns the current status of the configured API server.", "name": "status", "signature": "async def status(cls)" }, { "docstring": "Freezes the configured API server. Any API clients will no longer be able to create new compute sessions nor create and modify vfolders/keypairs/et...
6
stack_v2_sparse_classes_30k_test_000083
Implement the Python class `Manager` described below. Class description: Provides controlling of the gateway/manager servers. .. versionadded:: 18.12 Method signatures and docstrings: - async def status(cls): Returns the current status of the configured API server. - async def freeze(cls, force_kill: bool=False): Fre...
Implement the Python class `Manager` described below. Class description: Provides controlling of the gateway/manager servers. .. versionadded:: 18.12 Method signatures and docstrings: - async def status(cls): Returns the current status of the configured API server. - async def freeze(cls, force_kill: bool=False): Fre...
afc831fedb59f791cdf4201e7f617b201d820074
<|skeleton|> class Manager: """Provides controlling of the gateway/manager servers. .. versionadded:: 18.12""" async def status(cls): """Returns the current status of the configured API server.""" <|body_0|> async def freeze(cls, force_kill: bool=False): """Freezes the configured A...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Manager: """Provides controlling of the gateway/manager servers. .. versionadded:: 18.12""" async def status(cls): """Returns the current status of the configured API server.""" rqst = Request('GET', '/manager/status') rqst.set_json({'status': 'running'}) async with rqst.f...
the_stack_v2_python_sparse
src/ai/backend/client/func/manager.py
lablup/backend.ai-client-py
train
7
0bb1de370d90ab6d6850b0a97fc631b8662c076a
[ "if not root:\n return str([])\nans = [root.val]\nqueue = [root]\nwhile queue:\n node = queue.pop(0)\n if node.left:\n queue.append(node.left)\n ans.append(node.left.val)\n else:\n ans.append(None)\n if node.right:\n queue.append(node.right)\n ans.append(node.right....
<|body_start_0|> if not root: return str([]) ans = [root.val] queue = [root] while queue: node = queue.pop(0) if node.left: queue.append(node.left) ans.append(node.left.val) else: ans.append(N...
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_014890
1,762
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_010887
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:...
54d777e11b91c5debe49c1aef723234c66a5d2cc
<|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 str([]) ans = [root.val] queue = [root] while queue: node = queue.pop(0) if node.left: que...
the_stack_v2_python_sparse
leetcode_solution/tree/#297.Serialize_and_Deserialize_Binary_Tree.py
HsiangHung/Code-Challenges
train
0
4a3d25c7358022048e0f534ec908b5337c91dbe5
[ "self.config: Dict[str, str] = {}\nself.config[AcnNodeConfig.KEY] = key\nself.config[AcnNodeConfig.URI] = uri\nself.config[AcnNodeConfig.EXTERNAL_URI] = external_uri if external_uri is not None else ''\nself.config[AcnNodeConfig.DELEGATE_URI] = delegate_uri if delegate_uri is not None else ''\nself.config[AcnNodeCo...
<|body_start_0|> self.config: Dict[str, str] = {} self.config[AcnNodeConfig.KEY] = key self.config[AcnNodeConfig.URI] = uri self.config[AcnNodeConfig.EXTERNAL_URI] = external_uri if external_uri is not None else '' self.config[AcnNodeConfig.DELEGATE_URI] = delegate_uri if delegat...
Store the configuration of an acn node as a dictionary.
AcnNodeConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AcnNodeConfig: """Store the configuration of an acn node as a dictionary.""" def __init__(self, key: str, uri: str, external_uri: Optional[str]=None, delegate_uri: Optional[str]=None, monitoring_uri: Optional[str]=None, entry_peers_maddrs: Optional[List[str]]=None, log_file: Optional[str]=No...
stack_v2_sparse_classes_36k_train_014891
12,337
permissive
[ { "docstring": "Initialize a new ACN configuration from arguments :param key: node private key to use as identity :param uri: node local uri to bind to :param external_uri: node external uri, needed to be reached by others :param delegate_uri: node local uri for delegate service :param monitoring_uri: node moni...
6
stack_v2_sparse_classes_30k_train_017992
Implement the Python class `AcnNodeConfig` described below. Class description: Store the configuration of an acn node as a dictionary. Method signatures and docstrings: - def __init__(self, key: str, uri: str, external_uri: Optional[str]=None, delegate_uri: Optional[str]=None, monitoring_uri: Optional[str]=None, entr...
Implement the Python class `AcnNodeConfig` described below. Class description: Store the configuration of an acn node as a dictionary. Method signatures and docstrings: - def __init__(self, key: str, uri: str, external_uri: Optional[str]=None, delegate_uri: Optional[str]=None, monitoring_uri: Optional[str]=None, entr...
bec49adaeba661d8d0f03ac9935dc89f39d95a0d
<|skeleton|> class AcnNodeConfig: """Store the configuration of an acn node as a dictionary.""" def __init__(self, key: str, uri: str, external_uri: Optional[str]=None, delegate_uri: Optional[str]=None, monitoring_uri: Optional[str]=None, entry_peers_maddrs: Optional[List[str]]=None, log_file: Optional[str]=No...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AcnNodeConfig: """Store the configuration of an acn node as a dictionary.""" def __init__(self, key: str, uri: str, external_uri: Optional[str]=None, delegate_uri: Optional[str]=None, monitoring_uri: Optional[str]=None, entry_peers_maddrs: Optional[List[str]]=None, log_file: Optional[str]=None, enable_ch...
the_stack_v2_python_sparse
scripts/acn/run_acn_node_standalone.py
fetchai/agents-aea
train
192
e28373452bf6a5c2a527e3aba0b7e8a82be3cc41
[ "self.order = []\n\ndef inorder(root):\n if root:\n inorder(root.left)\n self.order.append(root.val)\n inorder(root.right)\ninorder(root)\nprint(self.order)\nreturn self.order == sorted(self.order) and len(self.order) == len(set(self.order))", "def inorder(root, lr, rr):\n if root:\n ...
<|body_start_0|> self.order = [] def inorder(root): if root: inorder(root.left) self.order.append(root.val) inorder(root.right) inorder(root) print(self.order) return self.order == sorted(self.order) and len(self.order)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isValidBST2(self, root): """Another Method""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.order = [] def inorder(root): if root: ...
stack_v2_sparse_classes_36k_train_014892
1,899
no_license
[ { "docstring": ":type root: TreeNode :rtype: bool", "name": "isValidBST", "signature": "def isValidBST(self, root)" }, { "docstring": "Another Method", "name": "isValidBST2", "signature": "def isValidBST2(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_003379
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root): :type root: TreeNode :rtype: bool - def isValidBST2(self, root): Another Method
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root): :type root: TreeNode :rtype: bool - def isValidBST2(self, root): Another Method <|skeleton|> class Solution: def isValidBST(self, root): ...
b7e92f9a7c4d6652d4901b189f51063ce5520653
<|skeleton|> class Solution: def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" <|body_0|> def isValidBST2(self, root): """Another Method""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isValidBST(self, root): """:type root: TreeNode :rtype: bool""" self.order = [] def inorder(root): if root: inorder(root.left) self.order.append(root.val) inorder(root.right) inorder(root) print(...
the_stack_v2_python_sparse
leetcode/medium/validate_bst.py
abkunal/Data-Structures-and-Algorithms
train
2
244a333956720f3b0c9881c16b149d2b0070a0b5
[ "self.mode = RequestType.TRAIN\nasync for r in self._get_results(input_fn, on_done, on_error, on_always, **kwargs):\n yield r", "self.mode = RequestType.SEARCH\nself.add_default_kwargs(kwargs)\nasync for r in self._get_results(input_fn, on_done, on_error, on_always, **kwargs):\n yield r", "self.mode = Req...
<|body_start_0|> self.mode = RequestType.TRAIN async for r in self._get_results(input_fn, on_done, on_error, on_always, **kwargs): yield r <|end_body_0|> <|body_start_1|> self.mode = RequestType.SEARCH self.add_default_kwargs(kwargs) async for r in self._get_results(...
:class:`AsyncClient` is the asynchronous version of the :class:`Client`. They share the same interface, except in :class:`AsyncClient` :meth:`train`, :meth:`index`, :meth:`search` methods are coroutines (i.e. declared with the async/await syntax), simply calling them will not schedule them to be executed. To actually r...
AsyncClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsyncClient: """:class:`AsyncClient` is the asynchronous version of the :class:`Client`. They share the same interface, except in :class:`AsyncClient` :meth:`train`, :meth:`index`, :meth:`search` methods are coroutines (i.e. declared with the async/await syntax), simply calling them will not sche...
stack_v2_sparse_classes_36k_train_014893
8,911
permissive
[ { "docstring": "Issue 'train' request to the Flow. :param input_fn: the input function that generates the content :param on_done: the function to be called when the :class:`Request` object is resolved. :param on_error: the function to be called when the :class:`Request` object is rejected. :param on_always: the...
5
null
Implement the Python class `AsyncClient` described below. Class description: :class:`AsyncClient` is the asynchronous version of the :class:`Client`. They share the same interface, except in :class:`AsyncClient` :meth:`train`, :meth:`index`, :meth:`search` methods are coroutines (i.e. declared with the async/await syn...
Implement the Python class `AsyncClient` described below. Class description: :class:`AsyncClient` is the asynchronous version of the :class:`Client`. They share the same interface, except in :class:`AsyncClient` :meth:`train`, :meth:`index`, :meth:`search` methods are coroutines (i.e. declared with the async/await syn...
97f9e97a4a678a28bdeacbc7346eaf7bbd2aeb89
<|skeleton|> class AsyncClient: """:class:`AsyncClient` is the asynchronous version of the :class:`Client`. They share the same interface, except in :class:`AsyncClient` :meth:`train`, :meth:`index`, :meth:`search` methods are coroutines (i.e. declared with the async/await syntax), simply calling them will not sche...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AsyncClient: """:class:`AsyncClient` is the asynchronous version of the :class:`Client`. They share the same interface, except in :class:`AsyncClient` :meth:`train`, :meth:`index`, :meth:`search` methods are coroutines (i.e. declared with the async/await syntax), simply calling them will not schedule them to ...
the_stack_v2_python_sparse
jina/clients/asyncio.py
deepampatel/jina
train
2
58fef73df6ce18437f3c8ba1b52dd3afb7a29001
[ "super(ConvDropoutNormNonlin2D, self).__init__()\nif nonlin_kwargs is None:\n nonlin_kwargs = {'alpha': 0.01, 'inplace': True}\nif dropout_op_kwargs is None:\n dropout_op_kwargs = {'p': 0.5, 'inplace': True}\nif norm_op_kwargs is None:\n norm_op_kwargs = {'eps': 1e-05, 'affine': True, 'momentum': 0.9}\nif ...
<|body_start_0|> super(ConvDropoutNormNonlin2D, self).__init__() if nonlin_kwargs is None: nonlin_kwargs = {'alpha': 0.01, 'inplace': True} if dropout_op_kwargs is None: dropout_op_kwargs = {'p': 0.5, 'inplace': True} if norm_op_kwargs is None: norm_op...
fixes a bug in ConvDropoutNormNonlin where lrelu was used regardless of nonlin. Bad.
ConvDropoutNormNonlin2D
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvDropoutNormNonlin2D: """fixes a bug in ConvDropoutNormNonlin where lrelu was used regardless of nonlin. Bad.""" def __init__(self, input_channels, output_channels, conv_op=nn.Conv2d, conv_kwargs=None, norm_op=nn.BatchNorm2d, norm_op_kwargs=None, dropout_op=nn.Dropout, dropout_op_kwargs=N...
stack_v2_sparse_classes_36k_train_014894
24,212
permissive
[ { "docstring": "init class", "name": "__init__", "signature": "def __init__(self, input_channels, output_channels, conv_op=nn.Conv2d, conv_kwargs=None, norm_op=nn.BatchNorm2d, norm_op_kwargs=None, dropout_op=nn.Dropout, dropout_op_kwargs=None, nonlin=nn.LeakyReLU, nonlin_kwargs=None)" }, { "docs...
2
stack_v2_sparse_classes_30k_val_001095
Implement the Python class `ConvDropoutNormNonlin2D` described below. Class description: fixes a bug in ConvDropoutNormNonlin where lrelu was used regardless of nonlin. Bad. Method signatures and docstrings: - def __init__(self, input_channels, output_channels, conv_op=nn.Conv2d, conv_kwargs=None, norm_op=nn.BatchNor...
Implement the Python class `ConvDropoutNormNonlin2D` described below. Class description: fixes a bug in ConvDropoutNormNonlin where lrelu was used regardless of nonlin. Bad. Method signatures and docstrings: - def __init__(self, input_channels, output_channels, conv_op=nn.Conv2d, conv_kwargs=None, norm_op=nn.BatchNor...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class ConvDropoutNormNonlin2D: """fixes a bug in ConvDropoutNormNonlin where lrelu was used regardless of nonlin. Bad.""" def __init__(self, input_channels, output_channels, conv_op=nn.Conv2d, conv_kwargs=None, norm_op=nn.BatchNorm2d, norm_op_kwargs=None, dropout_op=nn.Dropout, dropout_op_kwargs=N...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvDropoutNormNonlin2D: """fixes a bug in ConvDropoutNormNonlin where lrelu was used regardless of nonlin. Bad.""" def __init__(self, input_channels, output_channels, conv_op=nn.Conv2d, conv_kwargs=None, norm_op=nn.BatchNorm2d, norm_op_kwargs=None, dropout_op=nn.Dropout, dropout_op_kwargs=None, nonlin=n...
the_stack_v2_python_sparse
research/cv/nnUNet/src/nnunet/network_architecture/generic_UNet.py
mindspore-ai/models
train
301
37e7966239db51d83077f7c67e494b66bbd516bd
[ "if not 'pn_ke' in self.__dict__:\n self.register_auxiliary_attribute('pn_ke', 'real')\npnfx = self.mass * self.pnax\npnfy = self.mass * self.pnay\npnfz = self.mass * self.pnaz\nself.pn_ke -= (self.vx * pnfx + self.vy * pnfy + self.vz * pnfz) * tau", "if not 'pn_mrx' in self.__dict__:\n self.register_auxili...
<|body_start_0|> if not 'pn_ke' in self.__dict__: self.register_auxiliary_attribute('pn_ke', 'real') pnfx = self.mass * self.pnax pnfy = self.mass * self.pnay pnfz = self.mass * self.pnaz self.pn_ke -= (self.vx * pnfx + self.vy * pnfy + self.vz * pnfz) * tau <|end_bod...
This class holds some post-Newtonian methods.
PNbodyMethods
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PNbodyMethods: """This class holds some post-Newtonian methods.""" def pn_kick_ke(self, tau): """Kicks kinetic energy due to post-Newtonian terms.""" <|body_0|> def pn_drift_com_r(self, tau): """Drifts center of mass position due to post-Newtonian terms.""" ...
stack_v2_sparse_classes_36k_train_014895
18,588
permissive
[ { "docstring": "Kicks kinetic energy due to post-Newtonian terms.", "name": "pn_kick_ke", "signature": "def pn_kick_ke(self, tau)" }, { "docstring": "Drifts center of mass position due to post-Newtonian terms.", "name": "pn_drift_com_r", "signature": "def pn_drift_com_r(self, tau)" }, ...
4
stack_v2_sparse_classes_30k_val_000361
Implement the Python class `PNbodyMethods` described below. Class description: This class holds some post-Newtonian methods. Method signatures and docstrings: - def pn_kick_ke(self, tau): Kicks kinetic energy due to post-Newtonian terms. - def pn_drift_com_r(self, tau): Drifts center of mass position due to post-Newt...
Implement the Python class `PNbodyMethods` described below. Class description: This class holds some post-Newtonian methods. Method signatures and docstrings: - def pn_kick_ke(self, tau): Kicks kinetic energy due to post-Newtonian terms. - def pn_drift_com_r(self, tau): Drifts center of mass position due to post-Newt...
67d3aa103d77248a04e8f112930ba7bdb55024b2
<|skeleton|> class PNbodyMethods: """This class holds some post-Newtonian methods.""" def pn_kick_ke(self, tau): """Kicks kinetic energy due to post-Newtonian terms.""" <|body_0|> def pn_drift_com_r(self, tau): """Drifts center of mass position due to post-Newtonian terms.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PNbodyMethods: """This class holds some post-Newtonian methods.""" def pn_kick_ke(self, tau): """Kicks kinetic energy due to post-Newtonian terms.""" if not 'pn_ke' in self.__dict__: self.register_auxiliary_attribute('pn_ke', 'real') pnfx = self.mass * self.pnax ...
the_stack_v2_python_sparse
tupan/particles/body.py
ggf84/tupan
train
1
6d53e5b87547e336c91060ae64a732ce34f90fb6
[ "questionnaire = attr.get('questionnaire')\nquestion_responses = attr.get('question_responses')\nquestion_in_questionnaire = questionnaire.questions.all()\nif len(question_responses) != question_in_questionnaire.count():\n raise serializers.ValidationError(commons_constants.EMPTY_RESPONSE)\nfor question_response...
<|body_start_0|> questionnaire = attr.get('questionnaire') question_responses = attr.get('question_responses') question_in_questionnaire = questionnaire.questions.all() if len(question_responses) != question_in_questionnaire.count(): raise serializers.ValidationError(commons_...
Serializer class for QuestionnaireResponse Model.
QuestionnaireResponseSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionnaireResponseSerializer: """Serializer class for QuestionnaireResponse Model.""" def validate(self, attr): """Method to validate if all the questions belong to the same questionnaire.""" <|body_0|> def create(self, validated_data): """Method to create que...
stack_v2_sparse_classes_36k_train_014896
8,363
no_license
[ { "docstring": "Method to validate if all the questions belong to the same questionnaire.", "name": "validate", "signature": "def validate(self, attr)" }, { "docstring": "Method to create question response and questionnaire response objects.", "name": "create", "signature": "def create(s...
2
stack_v2_sparse_classes_30k_train_014764
Implement the Python class `QuestionnaireResponseSerializer` described below. Class description: Serializer class for QuestionnaireResponse Model. Method signatures and docstrings: - def validate(self, attr): Method to validate if all the questions belong to the same questionnaire. - def create(self, validated_data):...
Implement the Python class `QuestionnaireResponseSerializer` described below. Class description: Serializer class for QuestionnaireResponse Model. Method signatures and docstrings: - def validate(self, attr): Method to validate if all the questions belong to the same questionnaire. - def create(self, validated_data):...
6bcf64c03f0e47f2c11e5dbbf36c87a0ba8a36e6
<|skeleton|> class QuestionnaireResponseSerializer: """Serializer class for QuestionnaireResponse Model.""" def validate(self, attr): """Method to validate if all the questions belong to the same questionnaire.""" <|body_0|> def create(self, validated_data): """Method to create que...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuestionnaireResponseSerializer: """Serializer class for QuestionnaireResponse Model.""" def validate(self, attr): """Method to validate if all the questions belong to the same questionnaire.""" questionnaire = attr.get('questionnaire') question_responses = attr.get('question_resp...
the_stack_v2_python_sparse
backend/backend/apps/surveys/serializers.py
faizalsha/symptom-checker
train
0
8e4471288574ab381e3cb67cd75fab7e673b12f5
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WorkbookNamedItem()", "from .entity import Entity\nfrom .json import Json\nfrom .workbook_worksheet import WorkbookWorksheet\nfrom .entity import Entity\nfrom .json import Json\nfrom .workbook_worksheet import WorkbookWorksheet\nfields...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return WorkbookNamedItem() <|end_body_0|> <|body_start_1|> from .entity import Entity from .json import Json from .workbook_worksheet import WorkbookWorksheet from .entity impor...
WorkbookNamedItem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkbookNamedItem: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookNamedItem: """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...
stack_v2_sparse_classes_36k_train_014897
3,848
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: WorkbookNamedItem", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_v...
3
null
Implement the Python class `WorkbookNamedItem` described below. Class description: Implement the WorkbookNamedItem class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookNamedItem: Creates a new instance of the appropriate class based on discrim...
Implement the Python class `WorkbookNamedItem` described below. Class description: Implement the WorkbookNamedItem class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookNamedItem: Creates a new instance of the appropriate class based on discrim...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class WorkbookNamedItem: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookNamedItem: """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...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkbookNamedItem: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookNamedItem: """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: Work...
the_stack_v2_python_sparse
msgraph/generated/models/workbook_named_item.py
microsoftgraph/msgraph-sdk-python
train
135
b28445bf260542d83963acdbb41e61482411c05f
[ "if not inspect.isclass(member):\n return False\nif not issubclass(member, BaseForm):\n return False\nreturn member.__module__.startswith(__name__)", "Random.atfork()\nlocal_installed_apps = [app for app in settings.INSTALLED_APPS if app.startswith('%s.' % __name__)]\nfor app in local_installed_apps:\n t...
<|body_start_0|> if not inspect.isclass(member): return False if not issubclass(member, BaseForm): return False return member.__module__.startswith(__name__) <|end_body_0|> <|body_start_1|> Random.atfork() local_installed_apps = [app for app in settings.I...
This is the custom app configuration for the lily app. Custom startup code is defined here.
LilyConfig
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LilyConfig: """This is the custom app configuration for the lily app. Custom startup code is defined here.""" def is_form(member): """Allow only custom made classes which are a subclass from BaseForm to pass.""" <|body_0|> def ready(self): """Code run on startup ...
stack_v2_sparse_classes_36k_train_014898
1,742
no_license
[ { "docstring": "Allow only custom made classes which are a subclass from BaseForm to pass.", "name": "is_form", "signature": "def is_form(member)" }, { "docstring": "Code run on startup of django.", "name": "ready", "signature": "def ready(self)" } ]
2
stack_v2_sparse_classes_30k_train_007385
Implement the Python class `LilyConfig` described below. Class description: This is the custom app configuration for the lily app. Custom startup code is defined here. Method signatures and docstrings: - def is_form(member): Allow only custom made classes which are a subclass from BaseForm to pass. - def ready(self):...
Implement the Python class `LilyConfig` described below. Class description: This is the custom app configuration for the lily app. Custom startup code is defined here. Method signatures and docstrings: - def is_form(member): Allow only custom made classes which are a subclass from BaseForm to pass. - def ready(self):...
ddb25fa16280d1ca5fba32f71d65c90815648f0a
<|skeleton|> class LilyConfig: """This is the custom app configuration for the lily app. Custom startup code is defined here.""" def is_form(member): """Allow only custom made classes which are a subclass from BaseForm to pass.""" <|body_0|> def ready(self): """Code run on startup ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LilyConfig: """This is the custom app configuration for the lily app. Custom startup code is defined here.""" def is_form(member): """Allow only custom made classes which are a subclass from BaseForm to pass.""" if not inspect.isclass(member): return False if not issub...
the_stack_v2_python_sparse
lily/app.py
Vegulla/hellolily
train
0
2e98249462e219d92022f5de5b4c8f5a90a64f0b
[ "if queryset is None:\n queryset = self.get_queryset()\nyear = self.kwargs.get('year')\nmonth = self.kwargs.get('month')\nif not year or not month:\n raise AttributeError('Generic detail view %s must be called with the year and month in the URLconf' % self.__class__.__name__)\ntry:\n obj = queryset.get_mon...
<|body_start_0|> if queryset is None: queryset = self.get_queryset() year = self.kwargs.get('year') month = self.kwargs.get('month') if not year or not month: raise AttributeError('Generic detail view %s must be called with the year and month in the URLconf' % sel...
BalanceSheetView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BalanceSheetView: def get_object(self, queryset=None): """Returns the balance sheet by date.""" <|body_0|> def get_template_names(self): """Returns the print template name if print query, otherwise returns super.""" <|body_1|> def get_context_data(self, ...
stack_v2_sparse_classes_36k_train_014899
4,347
permissive
[ { "docstring": "Returns the balance sheet by date.", "name": "get_object", "signature": "def get_object(self, queryset=None)" }, { "docstring": "Returns the print template name if print query, otherwise returns super.", "name": "get_template_names", "signature": "def get_template_names(s...
3
stack_v2_sparse_classes_30k_train_001390
Implement the Python class `BalanceSheetView` described below. Class description: Implement the BalanceSheetView class. Method signatures and docstrings: - def get_object(self, queryset=None): Returns the balance sheet by date. - def get_template_names(self): Returns the print template name if print query, otherwise ...
Implement the Python class `BalanceSheetView` described below. Class description: Implement the BalanceSheetView class. Method signatures and docstrings: - def get_object(self, queryset=None): Returns the balance sheet by date. - def get_template_names(self): Returns the print template name if print query, otherwise ...
a2672e6c3b6eff29cdace200839b1016cf3cc1cd
<|skeleton|> class BalanceSheetView: def get_object(self, queryset=None): """Returns the balance sheet by date.""" <|body_0|> def get_template_names(self): """Returns the print template name if print query, otherwise returns super.""" <|body_1|> def get_context_data(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BalanceSheetView: def get_object(self, queryset=None): """Returns the balance sheet by date.""" if queryset is None: queryset = self.get_queryset() year = self.kwargs.get('year') month = self.kwargs.get('month') if not year or not month: raise At...
the_stack_v2_python_sparse
accounts/views/balance.py
bbengfort/ledger
train
1