blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 467 8.64k | id stringlengths 40 40 | length_bytes int64 515 49.7k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 160 3.93k | prompted_full_text stringlengths 681 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.09k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 331 8.3k | source stringclasses 1
value | source_path stringlengths 5 177 | source_repo stringlengths 6 88 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
42d13a36626ddd8c17a3c3a60834e4e4587d6b59 | [
"Parametre.__init__(self, 'contrôle', 'control')\nself.tronquer = True\nself.schema = '(<texte_libre>)'\nself.aide_courte = 'consulte ou modifie les contrôles'\nself.aide_longue = \"Les contrôles sont des formes d'ordres prolongés. Ils nécessitent généralement la présence d'un commandant (un capitaine ou un second)... | <|body_start_0|>
Parametre.__init__(self, 'contrôle', 'control')
self.tronquer = True
self.schema = '(<texte_libre>)'
self.aide_courte = 'consulte ou modifie les contrôles'
self.aide_longue = "Les contrôles sont des formes d'ordres prolongés. Ils nécessitent généralement la prése... | Commande 'équipage contrôle'. | PrmControle | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmControle:
"""Commande 'équipage contrôle'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Parame... | stack_v2_sparse_classes_10k_train_006200 | 4,660 | permissive | [
{
"docstring": "Constructeur du paramètre",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Interprétation du paramètre",
"name": "interpreter",
"signature": "def interpreter(self, personnage, dic_masques)"
}
] | 2 | null | Implement the Python class `PrmControle` described below.
Class description:
Commande 'équipage contrôle'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre | Implement the Python class `PrmControle` described below.
Class description:
Commande 'équipage contrôle'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre
<|skeleton|>
class PrmControle:
"""Commande 'é... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmControle:
"""Commande 'équipage contrôle'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PrmControle:
"""Commande 'équipage contrôle'."""
def __init__(self):
"""Constructeur du paramètre"""
Parametre.__init__(self, 'contrôle', 'control')
self.tronquer = True
self.schema = '(<texte_libre>)'
self.aide_courte = 'consulte ou modifie les contrôles'
... | the_stack_v2_python_sparse | src/secondaires/navigation/commandes/equipage/controle.py | vincent-lg/tsunami | train | 5 |
a0c114483329b253162e84fc8b70f93bd9eaa3e2 | [
"value = None\ncache = None\nprefix = None\nif self.should_cache():\n prefix = '%s:%s:string' % (self.get_cache_version(), self.get_cache_prefix())\n cache = router.router.get_cache(prefix)\n value = cache.get(prefix)\nif not value:\n value = super(CacheView, self).get_as_string(request, *args, **kwargs... | <|body_start_0|>
value = None
cache = None
prefix = None
if self.should_cache():
prefix = '%s:%s:string' % (self.get_cache_version(), self.get_cache_prefix())
cache = router.router.get_cache(prefix)
value = cache.get(prefix)
if not value:
... | A class based view that overrides the default dispatch method to determine the cache_prefix. If the cms view is available this class will inherit from there otherwise it will inherit from django's generic class View. :param cache_time: How long should we cache this attribute. This gets passed to django middleware and d... | CacheView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CacheView:
"""A class based view that overrides the default dispatch method to determine the cache_prefix. If the cms view is available this class will inherit from there otherwise it will inherit from django's generic class View. :param cache_time: How long should we cache this attribute. This g... | stack_v2_sparse_classes_10k_train_006201 | 7,096 | permissive | [
{
"docstring": "Should only be used when inheriting from cms View. Gets the response as a string and caches it with a separate prefix",
"name": "get_as_string",
"signature": "def get_as_string(self, request, *args, **kwargs)"
},
{
"docstring": "Overrides Django's default dispatch to provide cach... | 2 | stack_v2_sparse_classes_30k_train_004909 | Implement the Python class `CacheView` described below.
Class description:
A class based view that overrides the default dispatch method to determine the cache_prefix. If the cms view is available this class will inherit from there otherwise it will inherit from django's generic class View. :param cache_time: How long... | Implement the Python class `CacheView` described below.
Class description:
A class based view that overrides the default dispatch method to determine the cache_prefix. If the cms view is available this class will inherit from there otherwise it will inherit from django's generic class View. :param cache_time: How long... | 9f5ac28618059eef99152214c7a90ad78151629e | <|skeleton|>
class CacheView:
"""A class based view that overrides the default dispatch method to determine the cache_prefix. If the cms view is available this class will inherit from there otherwise it will inherit from django's generic class View. :param cache_time: How long should we cache this attribute. This g... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CacheView:
"""A class based view that overrides the default dispatch method to determine the cache_prefix. If the cms view is available this class will inherit from there otherwise it will inherit from django's generic class View. :param cache_time: How long should we cache this attribute. This gets passed to... | the_stack_v2_python_sparse | scarlet/cache/views.py | markmiscavage/scarlet | train | 1 |
788e6e3cf4aa4b777a072e472b9304d3e01400b7 | [
"self.entity_description = description\nself._attr_name = f'{name} {description.name}'\nself.bbox_data = bbox_data",
"self.bbox_data.update()\nsensor_type = self.entity_description.key\nif sensor_type == 'down_max_bandwidth':\n self._attr_native_value = round(self.bbox_data.data['rx']['maxBandwidth'] / 1000, 2... | <|body_start_0|>
self.entity_description = description
self._attr_name = f'{name} {description.name}'
self.bbox_data = bbox_data
<|end_body_0|>
<|body_start_1|>
self.bbox_data.update()
sensor_type = self.entity_description.key
if sensor_type == 'down_max_bandwidth':
... | Implementation of a Bbox sensor. | BboxSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BboxSensor:
"""Implementation of a Bbox sensor."""
def __init__(self, bbox_data, name, description: SensorEntityDescription) -> None:
"""Initialize the sensor."""
<|body_0|>
def update(self) -> None:
"""Get the latest data from Bbox and update the state."""
... | stack_v2_sparse_classes_10k_train_006202 | 6,509 | permissive | [
{
"docstring": "Initialize the sensor.",
"name": "__init__",
"signature": "def __init__(self, bbox_data, name, description: SensorEntityDescription) -> None"
},
{
"docstring": "Get the latest data from Bbox and update the state.",
"name": "update",
"signature": "def update(self) -> None"... | 2 | null | Implement the Python class `BboxSensor` described below.
Class description:
Implementation of a Bbox sensor.
Method signatures and docstrings:
- def __init__(self, bbox_data, name, description: SensorEntityDescription) -> None: Initialize the sensor.
- def update(self) -> None: Get the latest data from Bbox and updat... | Implement the Python class `BboxSensor` described below.
Class description:
Implementation of a Bbox sensor.
Method signatures and docstrings:
- def __init__(self, bbox_data, name, description: SensorEntityDescription) -> None: Initialize the sensor.
- def update(self) -> None: Get the latest data from Bbox and updat... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class BboxSensor:
"""Implementation of a Bbox sensor."""
def __init__(self, bbox_data, name, description: SensorEntityDescription) -> None:
"""Initialize the sensor."""
<|body_0|>
def update(self) -> None:
"""Get the latest data from Bbox and update the state."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BboxSensor:
"""Implementation of a Bbox sensor."""
def __init__(self, bbox_data, name, description: SensorEntityDescription) -> None:
"""Initialize the sensor."""
self.entity_description = description
self._attr_name = f'{name} {description.name}'
self.bbox_data = bbox_dat... | the_stack_v2_python_sparse | homeassistant/components/bbox/sensor.py | home-assistant/core | train | 35,501 |
ae9d18ff5cd47707b62de44018aee927236d476b | [
"self._vehicle = vehicle\nself._world = self._vehicle.get_world()\nself._long_controller = PIDLongitudinalController(self._vehicle, **args_longitudinal)\nself._later_controller = PIDLateralController(self._vehicle, **args_lateral)",
"throttle = self._long_controller.run_step(target_speed)\nsteering, adjusted_wayp... | <|body_start_0|>
self._vehicle = vehicle
self._world = self._vehicle.get_world()
self._long_controller = PIDLongitudinalController(self._vehicle, **args_longitudinal)
self._later_controller = PIDLateralController(self._vehicle, **args_lateral)
<|end_body_0|>
<|body_start_1|>
thr... | VehiclePIDController is the combination of two PID controllers (lateral and longitudinal) to perform the low level control a vehicle from client side | VehiclePIDController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VehiclePIDController:
"""VehiclePIDController is the combination of two PID controllers (lateral and longitudinal) to perform the low level control a vehicle from client side"""
def __init__(self, vehicle, args_lateral={'K_P': 1.0, 'K_D': 0.0, 'K_I': 0.0}, args_longitudinal={'K_P': 1.0, 'K_D... | stack_v2_sparse_classes_10k_train_006203 | 13,383 | no_license | [
{
"docstring": ":param vehicle: actor to apply to local planner logic onto :param args_lateral: dictionary of arguments to set the lateral PID controller using the following semantics: K_P -- Proportional term K_D -- Differential term K_I -- Integral term :param args_longitudinal: dictionary of arguments to set... | 4 | stack_v2_sparse_classes_30k_train_006264 | Implement the Python class `VehiclePIDController` described below.
Class description:
VehiclePIDController is the combination of two PID controllers (lateral and longitudinal) to perform the low level control a vehicle from client side
Method signatures and docstrings:
- def __init__(self, vehicle, args_lateral={'K_P... | Implement the Python class `VehiclePIDController` described below.
Class description:
VehiclePIDController is the combination of two PID controllers (lateral and longitudinal) to perform the low level control a vehicle from client side
Method signatures and docstrings:
- def __init__(self, vehicle, args_lateral={'K_P... | da35bfec7d40708e4f76d08f54e04587bef1dd8b | <|skeleton|>
class VehiclePIDController:
"""VehiclePIDController is the combination of two PID controllers (lateral and longitudinal) to perform the low level control a vehicle from client side"""
def __init__(self, vehicle, args_lateral={'K_P': 1.0, 'K_D': 0.0, 'K_I': 0.0}, args_longitudinal={'K_P': 1.0, 'K_D... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class VehiclePIDController:
"""VehiclePIDController is the combination of two PID controllers (lateral and longitudinal) to perform the low level control a vehicle from client side"""
def __init__(self, vehicle, args_lateral={'K_P': 1.0, 'K_D': 0.0, 'K_I': 0.0}, args_longitudinal={'K_P': 1.0, 'K_D': 0.0, 'K_I'... | the_stack_v2_python_sparse | drive_interfaces/carla/comercial_cars/Navigation/controller.py | gy20073/CIL_modular | train | 2 |
f883e6a880abb00f919217d18f267ad42e5f8ff9 | [
"self.__self = '_' + type(self).__name__\nself.__ai = baidu_ai\nself.__Set_Token()",
"host = f'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id={self.__ai.Ak}&client_secret={self.__ai.Sk}'\nhtml = requests.get(host)\nself.__token = html.json().get('access_token')",
"video = cv2.V... | <|body_start_0|>
self.__self = '_' + type(self).__name__
self.__ai = baidu_ai
self.__Set_Token()
<|end_body_0|>
<|body_start_1|>
host = f'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id={self.__ai.Ak}&client_secret={self.__ai.Sk}'
html = requests... | 百度AI工具 | BAIDU_AI_TOOLS | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BAIDU_AI_TOOLS:
"""百度AI工具"""
def __init__(self, baidu_ai: BAIDU_AI):
"""BAIDU_AI_TOOLS(baidu_ai: BAIDU_AI) 初始化 Args: baidu_ai: 百度AI"""
<|body_0|>
def __Set_Token(self) -> None:
"""__Set_Token() -> None 获取设置token Returns: None"""
<|body_1|>
def Cut(cl... | stack_v2_sparse_classes_10k_train_006204 | 3,183 | permissive | [
{
"docstring": "BAIDU_AI_TOOLS(baidu_ai: BAIDU_AI) 初始化 Args: baidu_ai: 百度AI",
"name": "__init__",
"signature": "def __init__(self, baidu_ai: BAIDU_AI)"
},
{
"docstring": "__Set_Token() -> None 获取设置token Returns: None",
"name": "__Set_Token",
"signature": "def __Set_Token(self) -> None"
... | 4 | stack_v2_sparse_classes_30k_train_001474 | Implement the Python class `BAIDU_AI_TOOLS` described below.
Class description:
百度AI工具
Method signatures and docstrings:
- def __init__(self, baidu_ai: BAIDU_AI): BAIDU_AI_TOOLS(baidu_ai: BAIDU_AI) 初始化 Args: baidu_ai: 百度AI
- def __Set_Token(self) -> None: __Set_Token() -> None 获取设置token Returns: None
- def Cut(cls, v... | Implement the Python class `BAIDU_AI_TOOLS` described below.
Class description:
百度AI工具
Method signatures and docstrings:
- def __init__(self, baidu_ai: BAIDU_AI): BAIDU_AI_TOOLS(baidu_ai: BAIDU_AI) 初始化 Args: baidu_ai: 百度AI
- def __Set_Token(self) -> None: __Set_Token() -> None 获取设置token Returns: None
- def Cut(cls, v... | 9e2a023917b86460fb02984aed9fe638c3d38dd4 | <|skeleton|>
class BAIDU_AI_TOOLS:
"""百度AI工具"""
def __init__(self, baidu_ai: BAIDU_AI):
"""BAIDU_AI_TOOLS(baidu_ai: BAIDU_AI) 初始化 Args: baidu_ai: 百度AI"""
<|body_0|>
def __Set_Token(self) -> None:
"""__Set_Token() -> None 获取设置token Returns: None"""
<|body_1|>
def Cut(cl... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BAIDU_AI_TOOLS:
"""百度AI工具"""
def __init__(self, baidu_ai: BAIDU_AI):
"""BAIDU_AI_TOOLS(baidu_ai: BAIDU_AI) 初始化 Args: baidu_ai: 百度AI"""
self.__self = '_' + type(self).__name__
self.__ai = baidu_ai
self.__Set_Token()
def __Set_Token(self) -> None:
"""__Set_Token... | the_stack_v2_python_sparse | inside/Baidu_AI/Baidu_AI_Tools.py | lifansama/learning-power | train | 1 |
9f2c1da0b01bb124c3fb58992fffbd3cc738827e | [
"log_win_level = LEGACY_CONF['Debug']['window_log_level']\ntry:\n after_export = AfterExport(LEGACY_CONF.get_int('General', 'after_export_action', 0))\nexcept ValueError:\n after_export = AfterExport.NORMAL\nres = {}\nfor field in gen_opts_bool:\n try:\n section: str = field.metadata['legacy']\n ... | <|body_start_0|>
log_win_level = LEGACY_CONF['Debug']['window_log_level']
try:
after_export = AfterExport(LEGACY_CONF.get_int('General', 'after_export_action', 0))
except ValueError:
after_export = AfterExport.NORMAL
res = {}
for field in gen_opts_bool:
... | General app config options, mainly booleans. These are all changed in the options window. | GenOptions | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GenOptions:
"""General app config options, mainly booleans. These are all changed in the options window."""
def parse_legacy(cls, conf: Property) -> Dict[str, 'GenOptions']:
"""Parse from the GEN_OPTS config file."""
<|body_0|>
def parse_kv1(cls, data: Property, version:... | stack_v2_sparse_classes_10k_train_006205 | 6,430 | no_license | [
{
"docstring": "Parse from the GEN_OPTS config file.",
"name": "parse_legacy",
"signature": "def parse_legacy(cls, conf: Property) -> Dict[str, 'GenOptions']"
},
{
"docstring": "Parse KV1 values.",
"name": "parse_kv1",
"signature": "def parse_kv1(cls, data: Property, version: int) -> 'Ge... | 5 | stack_v2_sparse_classes_30k_train_002115 | Implement the Python class `GenOptions` described below.
Class description:
General app config options, mainly booleans. These are all changed in the options window.
Method signatures and docstrings:
- def parse_legacy(cls, conf: Property) -> Dict[str, 'GenOptions']: Parse from the GEN_OPTS config file.
- def parse_k... | Implement the Python class `GenOptions` described below.
Class description:
General app config options, mainly booleans. These are all changed in the options window.
Method signatures and docstrings:
- def parse_legacy(cls, conf: Property) -> Dict[str, 'GenOptions']: Parse from the GEN_OPTS config file.
- def parse_k... | 9f9219934b8f4af3c03d0080fad6078a18f3d530 | <|skeleton|>
class GenOptions:
"""General app config options, mainly booleans. These are all changed in the options window."""
def parse_legacy(cls, conf: Property) -> Dict[str, 'GenOptions']:
"""Parse from the GEN_OPTS config file."""
<|body_0|>
def parse_kv1(cls, data: Property, version:... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GenOptions:
"""General app config options, mainly booleans. These are all changed in the options window."""
def parse_legacy(cls, conf: Property) -> Dict[str, 'GenOptions']:
"""Parse from the GEN_OPTS config file."""
log_win_level = LEGACY_CONF['Debug']['window_log_level']
try:
... | the_stack_v2_python_sparse | src/config/gen_opts.py | BEEmod/BEE2.4 | train | 276 |
941113470896a1e32203d151082431c80f53885c | [
"self.commission_dict = commission_dict\nself.df_columns = ['type', 'date', 'symbol', 'commission']\nself.commission_df = pd.DataFrame(columns=self.df_columns)",
"if self.commission_df.shape[0] == 0:\n return str(self.commission_df.info())\nreturn str(self.commission_df)",
"market = ABuEnv.g_market_target if... | <|body_start_0|>
self.commission_dict = commission_dict
self.df_columns = ['type', 'date', 'symbol', 'commission']
self.commission_df = pd.DataFrame(columns=self.df_columns)
<|end_body_0|>
<|body_start_1|>
if self.commission_df.shape[0] == 0:
return str(self.commission_df.in... | 交易手续费计算,记录,分析类,在AbuCapital中实例化 | AbuCommission | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AbuCommission:
"""交易手续费计算,记录,分析类,在AbuCapital中实例化"""
def __init__(self, commission_dict):
""":param commission_dict: 代表用户自定义手续费计算dict对象, key:buy_commission_func, 代表用户自定义买入计算费用方法 key:sell_commission_func,代表用户自定义卖出计算费用方法"""
<|body_0|>
def __str__(self):
"""打印对象显示:如果... | stack_v2_sparse_classes_10k_train_006206 | 9,854 | permissive | [
{
"docstring": ":param commission_dict: 代表用户自定义手续费计算dict对象, key:buy_commission_func, 代表用户自定义买入计算费用方法 key:sell_commission_func,代表用户自定义卖出计算费用方法",
"name": "__init__",
"signature": "def __init__(self, commission_dict)"
},
{
"docstring": "打印对象显示:如果有手续费记录,打印记录df,否则打印commission_df.info",
"name": "_... | 5 | null | Implement the Python class `AbuCommission` described below.
Class description:
交易手续费计算,记录,分析类,在AbuCapital中实例化
Method signatures and docstrings:
- def __init__(self, commission_dict): :param commission_dict: 代表用户自定义手续费计算dict对象, key:buy_commission_func, 代表用户自定义买入计算费用方法 key:sell_commission_func,代表用户自定义卖出计算费用方法
- def __s... | Implement the Python class `AbuCommission` described below.
Class description:
交易手续费计算,记录,分析类,在AbuCapital中实例化
Method signatures and docstrings:
- def __init__(self, commission_dict): :param commission_dict: 代表用户自定义手续费计算dict对象, key:buy_commission_func, 代表用户自定义买入计算费用方法 key:sell_commission_func,代表用户自定义卖出计算费用方法
- def __s... | 2e5ab17f2d20deb3c68c927f6208ea89db7c639d | <|skeleton|>
class AbuCommission:
"""交易手续费计算,记录,分析类,在AbuCapital中实例化"""
def __init__(self, commission_dict):
""":param commission_dict: 代表用户自定义手续费计算dict对象, key:buy_commission_func, 代表用户自定义买入计算费用方法 key:sell_commission_func,代表用户自定义卖出计算费用方法"""
<|body_0|>
def __str__(self):
"""打印对象显示:如果... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AbuCommission:
"""交易手续费计算,记录,分析类,在AbuCapital中实例化"""
def __init__(self, commission_dict):
""":param commission_dict: 代表用户自定义手续费计算dict对象, key:buy_commission_func, 代表用户自定义买入计算费用方法 key:sell_commission_func,代表用户自定义卖出计算费用方法"""
self.commission_dict = commission_dict
self.df_columns = ['t... | the_stack_v2_python_sparse | abupy/TradeBu/ABuCommission.py | luqin/firefly | train | 1 |
57307d145b3497c968be744a00fbc9316eeec546 | [
"result = []\n\ndef preOrder(root):\n if root:\n result.append(str(root.val))\n preOrder(root.left)\n preOrder(root.right)\n else:\n result.append('#')\npreOrder(root)\nreturn ','.join(result)",
"s = s.split(',')\nnum = [-1]\n\ndef Change(num):\n num[0] += 1\n if num[0] < l... | <|body_start_0|>
result = []
def preOrder(root):
if root:
result.append(str(root.val))
preOrder(root.left)
preOrder(root.right)
else:
result.append('#')
preOrder(root)
return ','.join(result)
<|end_b... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def Serialize(self, root):
"""题目描述 请实现两个函数,分别用来序列化和反序列化二叉树 :param root: :return:"""
<|body_0|>
def Deserialize(self, s):
"""题目描述 请实现两个函数,分别用来序列化和反序列化二叉树 :param s: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = []
... | stack_v2_sparse_classes_10k_train_006207 | 1,260 | no_license | [
{
"docstring": "题目描述 请实现两个函数,分别用来序列化和反序列化二叉树 :param root: :return:",
"name": "Serialize",
"signature": "def Serialize(self, root)"
},
{
"docstring": "题目描述 请实现两个函数,分别用来序列化和反序列化二叉树 :param s: :return:",
"name": "Deserialize",
"signature": "def Deserialize(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000290 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def Serialize(self, root): 题目描述 请实现两个函数,分别用来序列化和反序列化二叉树 :param root: :return:
- def Deserialize(self, s): 题目描述 请实现两个函数,分别用来序列化和反序列化二叉树 :param s: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def Serialize(self, root): 题目描述 请实现两个函数,分别用来序列化和反序列化二叉树 :param root: :return:
- def Deserialize(self, s): 题目描述 请实现两个函数,分别用来序列化和反序列化二叉树 :param s: :return:
<|skeleton|>
class Solu... | c6e50be39292f8eefd7d3312ac5d0141bbe06f5b | <|skeleton|>
class Solution:
def Serialize(self, root):
"""题目描述 请实现两个函数,分别用来序列化和反序列化二叉树 :param root: :return:"""
<|body_0|>
def Deserialize(self, s):
"""题目描述 请实现两个函数,分别用来序列化和反序列化二叉树 :param s: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def Serialize(self, root):
"""题目描述 请实现两个函数,分别用来序列化和反序列化二叉树 :param root: :return:"""
result = []
def preOrder(root):
if root:
result.append(str(root.val))
preOrder(root.left)
preOrder(root.right)
else:
... | the_stack_v2_python_sparse | Tree/37_序列化二叉树.py | MingjunGuo/python__offer | train | 0 | |
e73fb9f7c5c3526de6839da18e5b41b1db754e04 | [
"self.cluster_count = cluster_count\nself.cluster_match_string = cluster_match_string\nself.cookie = cookie\nself.end_time_usecs = end_time_usecs\nself.error = error\nself.job_count = job_count\nself.job_match_string = job_match_string\nself.protection_jobs = protection_jobs\nself.search_job_status = search_job_sta... | <|body_start_0|>
self.cluster_count = cluster_count
self.cluster_match_string = cluster_match_string
self.cookie = cookie
self.end_time_usecs = end_time_usecs
self.error = error
self.job_count = job_count
self.job_match_string = job_match_string
self.prote... | Implementation of the 'RemoteVaultSearchJobResults' model. Specifies detailed information about Job Runs of Protection Jobs found by a search Job when searching a remote Vault for archived data. Attributes: cluster_count (int): Specifies number of Clusters that have archived to the remote Vault that match the criteria ... | RemoteVaultSearchJobResults | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RemoteVaultSearchJobResults:
"""Implementation of the 'RemoteVaultSearchJobResults' model. Specifies detailed information about Job Runs of Protection Jobs found by a search Job when searching a remote Vault for archived data. Attributes: cluster_count (int): Specifies number of Clusters that hav... | stack_v2_sparse_classes_10k_train_006208 | 7,245 | permissive | [
{
"docstring": "Constructor for the RemoteVaultSearchJobResults class",
"name": "__init__",
"signature": "def __init__(self, cluster_count=None, cluster_match_string=None, cookie=None, end_time_usecs=None, error=None, job_count=None, job_match_string=None, protection_jobs=None, search_job_status=None, s... | 2 | stack_v2_sparse_classes_30k_train_001203 | Implement the Python class `RemoteVaultSearchJobResults` described below.
Class description:
Implementation of the 'RemoteVaultSearchJobResults' model. Specifies detailed information about Job Runs of Protection Jobs found by a search Job when searching a remote Vault for archived data. Attributes: cluster_count (int)... | Implement the Python class `RemoteVaultSearchJobResults` described below.
Class description:
Implementation of the 'RemoteVaultSearchJobResults' model. Specifies detailed information about Job Runs of Protection Jobs found by a search Job when searching a remote Vault for archived data. Attributes: cluster_count (int)... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RemoteVaultSearchJobResults:
"""Implementation of the 'RemoteVaultSearchJobResults' model. Specifies detailed information about Job Runs of Protection Jobs found by a search Job when searching a remote Vault for archived data. Attributes: cluster_count (int): Specifies number of Clusters that hav... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RemoteVaultSearchJobResults:
"""Implementation of the 'RemoteVaultSearchJobResults' model. Specifies detailed information about Job Runs of Protection Jobs found by a search Job when searching a remote Vault for archived data. Attributes: cluster_count (int): Specifies number of Clusters that have archived to... | the_stack_v2_python_sparse | cohesity_management_sdk/models/remote_vault_search_job_results.py | cohesity/management-sdk-python | train | 24 |
f6400a1157a563dc0a1162d9bed14478f096afaa | [
"super(ReluNet, self).__init__()\nself.input_dim = input_dim\nself.output_dim = output_dim\nself.hidden_dim = hidden_dim\nself.num_layers = num_layers\nself.num_epochs = num_epochs\nself.threshold = threshold\nself.learning_rate = learning_rate\nself.layers = nn.ModuleList()\nself.layers.append(nn.Linear(input_dim,... | <|body_start_0|>
super(ReluNet, self).__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.hidden_dim = hidden_dim
self.num_layers = num_layers
self.num_epochs = num_epochs
self.threshold = threshold
self.learning_rate = learning_rate
... | Fully connected neural network with relu activation | ReluNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReluNet:
"""Fully connected neural network with relu activation"""
def __init__(self, input_dim, output_dim, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001, threshold=0.1):
"""Initilize a Neural Network with Relu activation Args: input_dim: int -- dimension of the ... | stack_v2_sparse_classes_10k_train_006209 | 4,882 | no_license | [
{
"docstring": "Initilize a Neural Network with Relu activation Args: input_dim: int -- dimension of the input feature output_dim: int -- dimension of the output feature hidden_dim: int -- number of hidden units at each layer num_layers: int -- number of hidden layers num_epochs: int -- number of epochs to trai... | 5 | stack_v2_sparse_classes_30k_train_004688 | Implement the Python class `ReluNet` described below.
Class description:
Fully connected neural network with relu activation
Method signatures and docstrings:
- def __init__(self, input_dim, output_dim, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001, threshold=0.1): Initilize a Neural Network with ... | Implement the Python class `ReluNet` described below.
Class description:
Fully connected neural network with relu activation
Method signatures and docstrings:
- def __init__(self, input_dim, output_dim, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001, threshold=0.1): Initilize a Neural Network with ... | d7e651024b07587b46497183d90934561a4839e2 | <|skeleton|>
class ReluNet:
"""Fully connected neural network with relu activation"""
def __init__(self, input_dim, output_dim, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001, threshold=0.1):
"""Initilize a Neural Network with Relu activation Args: input_dim: int -- dimension of the ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ReluNet:
"""Fully connected neural network with relu activation"""
def __init__(self, input_dim, output_dim, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001, threshold=0.1):
"""Initilize a Neural Network with Relu activation Args: input_dim: int -- dimension of the input feature... | the_stack_v2_python_sparse | model/relunet.py | SSF-climate/SSF | train | 7 |
48505463af0fc4fa9e477daae3a01830a30ac4e2 | [
"super().__init__(path)\nself._req_set = set()\nself._parse()",
"if self._req_set != other._req_set:\n print('GC request lists do not match.')\n return False\nelse:\n return True",
"with open(self._path, 'r') as file:\n try:\n line = file.readline()\n while line:\n if SENDIN... | <|body_start_0|>
super().__init__(path)
self._req_set = set()
self._parse()
<|end_body_0|>
<|body_start_1|>
if self._req_set != other._req_set:
print('GC request lists do not match.')
return False
else:
return True
<|end_body_1|>
<|body_start... | Responsible for parsing garbage collector logs | GarbageCollectorLogParser | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GarbageCollectorLogParser:
"""Responsible for parsing garbage collector logs"""
def __init__(self, path):
"""GarbageCollectorLogParser constructor @param path: The path to the garbage collector log file @type path: Str"""
<|body_0|>
def diff_log(self, other):
"""... | stack_v2_sparse_classes_10k_train_006210 | 9,641 | permissive | [
{
"docstring": "GarbageCollectorLogParser constructor @param path: The path to the garbage collector log file @type path: Str",
"name": "__init__",
"signature": "def __init__(self, path)"
},
{
"docstring": "Diffs a GarbageCollectorLogParser's req list to this object's req list @param other: The ... | 3 | stack_v2_sparse_classes_30k_train_000321 | Implement the Python class `GarbageCollectorLogParser` described below.
Class description:
Responsible for parsing garbage collector logs
Method signatures and docstrings:
- def __init__(self, path): GarbageCollectorLogParser constructor @param path: The path to the garbage collector log file @type path: Str
- def di... | Implement the Python class `GarbageCollectorLogParser` described below.
Class description:
Responsible for parsing garbage collector logs
Method signatures and docstrings:
- def __init__(self, path): GarbageCollectorLogParser constructor @param path: The path to the garbage collector log file @type path: Str
- def di... | 5a9ba1af74953334fcf54570f1e31e74ea057688 | <|skeleton|>
class GarbageCollectorLogParser:
"""Responsible for parsing garbage collector logs"""
def __init__(self, path):
"""GarbageCollectorLogParser constructor @param path: The path to the garbage collector log file @type path: Str"""
<|body_0|>
def diff_log(self, other):
"""... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GarbageCollectorLogParser:
"""Responsible for parsing garbage collector logs"""
def __init__(self, path):
"""GarbageCollectorLogParser constructor @param path: The path to the garbage collector log file @type path: Str"""
super().__init__(path)
self._req_set = set()
self._... | the_stack_v2_python_sparse | restler/test_servers/log_parser.py | wisec/restler-fuzzer | train | 0 |
7c0ba5548847f848a4c0e358ab4d5ea2fe81461f | [
"if 1 != bool(toolbar) + bool(title):\n raise ValueError('Just one of toolbar or title should be given')\nif not toolbar:\n toolbar = QToolBar(title)\ntoolbar.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum)\nself.addTab(toolbar, toolbar.windowTitle())\ntoolbar.setToolButtonStyle(Qt.ToolButtonTextUnd... | <|body_start_0|>
if 1 != bool(toolbar) + bool(title):
raise ValueError('Just one of toolbar or title should be given')
if not toolbar:
toolbar = QToolBar(title)
toolbar.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum)
self.addTab(toolbar, toolbar.windowTi... | A ribbon with helpers for containing toolbars | ToolbarRibbon | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ToolbarRibbon:
"""A ribbon with helpers for containing toolbars"""
def add_toolbar(self, title=None, toolbar=None):
"""Creates, adds and returns a QToolBar"""
<|body_0|>
def create_button(self, action=None, icon=None, text=None, menu=None, tooltip=None, properties={}):
... | stack_v2_sparse_classes_10k_train_006211 | 2,405 | permissive | [
{
"docstring": "Creates, adds and returns a QToolBar",
"name": "add_toolbar",
"signature": "def add_toolbar(self, title=None, toolbar=None)"
},
{
"docstring": "Returns a QToolButton",
"name": "create_button",
"signature": "def create_button(self, action=None, icon=None, text=None, menu=N... | 3 | stack_v2_sparse_classes_30k_train_004199 | Implement the Python class `ToolbarRibbon` described below.
Class description:
A ribbon with helpers for containing toolbars
Method signatures and docstrings:
- def add_toolbar(self, title=None, toolbar=None): Creates, adds and returns a QToolBar
- def create_button(self, action=None, icon=None, text=None, menu=None,... | Implement the Python class `ToolbarRibbon` described below.
Class description:
A ribbon with helpers for containing toolbars
Method signatures and docstrings:
- def add_toolbar(self, title=None, toolbar=None): Creates, adds and returns a QToolBar
- def create_button(self, action=None, icon=None, text=None, menu=None,... | 51e11407db838b8847ae8cc973b670c1cdc7d6d5 | <|skeleton|>
class ToolbarRibbon:
"""A ribbon with helpers for containing toolbars"""
def add_toolbar(self, title=None, toolbar=None):
"""Creates, adds and returns a QToolBar"""
<|body_0|>
def create_button(self, action=None, icon=None, text=None, menu=None, tooltip=None, properties={}):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ToolbarRibbon:
"""A ribbon with helpers for containing toolbars"""
def add_toolbar(self, title=None, toolbar=None):
"""Creates, adds and returns a QToolBar"""
if 1 != bool(toolbar) + bool(title):
raise ValueError('Just one of toolbar or title should be given')
if not t... | the_stack_v2_python_sparse | inselect-master/inselect/gui/toolbar_ribbon.py | zyken/BachelorProject | train | 0 |
29625aacef00704352b3d8e2335b8de0a3c294eb | [
"if not num1 or not num2:\n return None\nnum1 = num1[::-1]\nnum2 = num2[::-1]\nres = [0] * (len(num1) + len(num2))\nfor i, n1 in enumerate(num1):\n d1 = int(n1)\n carry = 0\n for j, n2 in enumerate(num2):\n d2 = int(n2)\n cur = d2 * d1 + carry + res[i + j]\n r = cur % 10\n re... | <|body_start_0|>
if not num1 or not num2:
return None
num1 = num1[::-1]
num2 = num2[::-1]
res = [0] * (len(num1) + len(num2))
for i, n1 in enumerate(num1):
d1 = int(n1)
carry = 0
for j, n2 in enumerate(num2):
d2 = in... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def multiply(self, num1, num2):
""":type num1: str :type num2: str :rtype: str"""
<|body_0|>
def multiply_optimization(self, num1, num2):
""":type num1: str :type num2: str :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not... | stack_v2_sparse_classes_10k_train_006212 | 2,736 | no_license | [
{
"docstring": ":type num1: str :type num2: str :rtype: str",
"name": "multiply",
"signature": "def multiply(self, num1, num2)"
},
{
"docstring": ":type num1: str :type num2: str :rtype: str",
"name": "multiply_optimization",
"signature": "def multiply_optimization(self, num1, num2)"
}... | 2 | stack_v2_sparse_classes_30k_train_005157 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def multiply(self, num1, num2): :type num1: str :type num2: str :rtype: str
- def multiply_optimization(self, num1, num2): :type num1: str :type num2: str :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def multiply(self, num1, num2): :type num1: str :type num2: str :rtype: str
- def multiply_optimization(self, num1, num2): :type num1: str :type num2: str :rtype: str
<|skeleton... | 4aa3a3a0da8b911e140446352debb9b567b6d78b | <|skeleton|>
class Solution:
def multiply(self, num1, num2):
""":type num1: str :type num2: str :rtype: str"""
<|body_0|>
def multiply_optimization(self, num1, num2):
""":type num1: str :type num2: str :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def multiply(self, num1, num2):
""":type num1: str :type num2: str :rtype: str"""
if not num1 or not num2:
return None
num1 = num1[::-1]
num2 = num2[::-1]
res = [0] * (len(num1) + len(num2))
for i, n1 in enumerate(num1):
d1 = in... | the_stack_v2_python_sparse | multiply_strings_43.py | adiggo/leetcode_py | train | 0 | |
8c99e8c53ee936db9ef0aaf7f0586711eb793f2d | [
"count_to_map = {}\nresult = []\nfor i in range(len(nums)):\n count_to_map[nums[i]] = count_to_map.get(nums[i], 0) + 1\n if count_to_map[nums[i]] > 1:\n result.append(nums[i])\nprint('print_repeating_using_hash_map(): {}'.format(result))",
"c = Counter(nums)\nprint('Debug: Printing Counter object - ... | <|body_start_0|>
count_to_map = {}
result = []
for i in range(len(nums)):
count_to_map[nums[i]] = count_to_map.get(nums[i], 0) + 1
if count_to_map[nums[i]] > 1:
result.append(nums[i])
print('print_repeating_using_hash_map(): {}'.format(result))
<|e... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def print_repeating_using_hash_map(self, nums):
"""In this method we use hash map to store the value and its count. While updating the count check if count exceeds 1 and add to the resulting array TC = O(N) SC = O(N+k) K being the number of elements repeating :param nums: :retu... | stack_v2_sparse_classes_10k_train_006213 | 3,185 | no_license | [
{
"docstring": "In this method we use hash map to store the value and its count. While updating the count check if count exceeds 1 and add to the resulting array TC = O(N) SC = O(N+k) K being the number of elements repeating :param nums: :return:",
"name": "print_repeating_using_hash_map",
"signature": ... | 3 | stack_v2_sparse_classes_30k_train_001103 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def print_repeating_using_hash_map(self, nums): In this method we use hash map to store the value and its count. While updating the count check if count exceeds 1 and add to the ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def print_repeating_using_hash_map(self, nums): In this method we use hash map to store the value and its count. While updating the count check if count exceeds 1 and add to the ... | f51caae9b764837ff9107d8b3d116637cdc102b0 | <|skeleton|>
class Solution:
def print_repeating_using_hash_map(self, nums):
"""In this method we use hash map to store the value and its count. While updating the count check if count exceeds 1 and add to the resulting array TC = O(N) SC = O(N+k) K being the number of elements repeating :param nums: :retu... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def print_repeating_using_hash_map(self, nums):
"""In this method we use hash map to store the value and its count. While updating the count check if count exceeds 1 and add to the resulting array TC = O(N) SC = O(N+k) K being the number of elements repeating :param nums: :return:"""
... | the_stack_v2_python_sparse | Leetcode/repeating_elements.py | madhuri-majety/IK | train | 0 | |
a39cbcb7848a40c5147dce1db2bf7cc52efac26a | [
"self.constr = constr\nself.conerr = 'Fetcher: Cannot connect with the supplied Connection String.'\nself.sqlerr = 'Fetcher: Error executing the supplied SQL.'",
"try:\n con = pyodbc.connect(self.constr)\nexcept:\n raise self.FetcherError(self.conerr)\ncur = con.cursor()\ncur.execute('SET QUERY_GOVERNOR_COS... | <|body_start_0|>
self.constr = constr
self.conerr = 'Fetcher: Cannot connect with the supplied Connection String.'
self.sqlerr = 'Fetcher: Error executing the supplied SQL.'
<|end_body_0|>
<|body_start_1|>
try:
con = pyodbc.connect(self.constr)
except:
ra... | Simple pyodbc-based SQL Server data grabber. Based off of fetchdata.py, except much simpler. | Fetcher | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fetcher:
"""Simple pyodbc-based SQL Server data grabber. Based off of fetchdata.py, except much simpler."""
def __init__(self, constr):
"""Initializes the Fetcher Class. constr is the connection string to the db of interest."""
<|body_0|>
def fetch(self, fetchsql):
... | stack_v2_sparse_classes_10k_train_006214 | 1,634 | permissive | [
{
"docstring": "Initializes the Fetcher Class. constr is the connection string to the db of interest.",
"name": "__init__",
"signature": "def __init__(self, constr)"
},
{
"docstring": "Fetches data from the connected database. fetchsql is the SQL to execute. returns a list of ordered dicts of th... | 2 | stack_v2_sparse_classes_30k_train_001319 | Implement the Python class `Fetcher` described below.
Class description:
Simple pyodbc-based SQL Server data grabber. Based off of fetchdata.py, except much simpler.
Method signatures and docstrings:
- def __init__(self, constr): Initializes the Fetcher Class. constr is the connection string to the db of interest.
- ... | Implement the Python class `Fetcher` described below.
Class description:
Simple pyodbc-based SQL Server data grabber. Based off of fetchdata.py, except much simpler.
Method signatures and docstrings:
- def __init__(self, constr): Initializes the Fetcher Class. constr is the connection string to the db of interest.
- ... | 931cc4ff0dd955f314e17f6e0d68b514cb854402 | <|skeleton|>
class Fetcher:
"""Simple pyodbc-based SQL Server data grabber. Based off of fetchdata.py, except much simpler."""
def __init__(self, constr):
"""Initializes the Fetcher Class. constr is the connection string to the db of interest."""
<|body_0|>
def fetch(self, fetchsql):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Fetcher:
"""Simple pyodbc-based SQL Server data grabber. Based off of fetchdata.py, except much simpler."""
def __init__(self, constr):
"""Initializes the Fetcher Class. constr is the connection string to the db of interest."""
self.constr = constr
self.conerr = 'Fetcher: Cannot c... | the_stack_v2_python_sparse | Backend/fetcher.py | CityOfNewOrleans/NoticeMe | train | 5 |
8b65546e0921706d76ff03285aaf646194255e69 | [
"if self.current_user == team.owner:\n return True\nraise ApiException(403, '权限错误')",
"team = Team.get_or_404(id=team_id)\nself.has_read_permission(team)\nquery = TeamMemberGroup.select().where(TeamMemberGroup.team == team)\npage = self.paginate_query(query)\ndata = self.get_paginated_data(page=page, alias='gr... | <|body_start_0|>
if self.current_user == team.owner:
return True
raise ApiException(403, '权限错误')
<|end_body_0|>
<|body_start_1|>
team = Team.get_or_404(id=team_id)
self.has_read_permission(team)
query = TeamMemberGroup.select().where(TeamMemberGroup.team == team)
... | 俱乐部分组列表 | TeamMemberGroupHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeamMemberGroupHandler:
"""俱乐部分组列表"""
def has_read_permission(self, team):
"""具有俱乐部分组读取权限"""
<|body_0|>
def get(self, team_id):
"""获取俱乐部分组 Args: team_id: int"""
<|body_1|>
def post(self, team_id):
"""新建俱乐部分组 Args: team_id: Returns:"""
... | stack_v2_sparse_classes_10k_train_006215 | 13,604 | no_license | [
{
"docstring": "具有俱乐部分组读取权限",
"name": "has_read_permission",
"signature": "def has_read_permission(self, team)"
},
{
"docstring": "获取俱乐部分组 Args: team_id: int",
"name": "get",
"signature": "def get(self, team_id)"
},
{
"docstring": "新建俱乐部分组 Args: team_id: Returns:",
"name": "p... | 3 | stack_v2_sparse_classes_30k_train_004852 | Implement the Python class `TeamMemberGroupHandler` described below.
Class description:
俱乐部分组列表
Method signatures and docstrings:
- def has_read_permission(self, team): 具有俱乐部分组读取权限
- def get(self, team_id): 获取俱乐部分组 Args: team_id: int
- def post(self, team_id): 新建俱乐部分组 Args: team_id: Returns: | Implement the Python class `TeamMemberGroupHandler` described below.
Class description:
俱乐部分组列表
Method signatures and docstrings:
- def has_read_permission(self, team): 具有俱乐部分组读取权限
- def get(self, team_id): 获取俱乐部分组 Args: team_id: int
- def post(self, team_id): 新建俱乐部分组 Args: team_id: Returns:
<|skeleton|>
class TeamM... | 49c31d9cce6ca451ff069697913b33fe55028a46 | <|skeleton|>
class TeamMemberGroupHandler:
"""俱乐部分组列表"""
def has_read_permission(self, team):
"""具有俱乐部分组读取权限"""
<|body_0|>
def get(self, team_id):
"""获取俱乐部分组 Args: team_id: int"""
<|body_1|>
def post(self, team_id):
"""新建俱乐部分组 Args: team_id: Returns:"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TeamMemberGroupHandler:
"""俱乐部分组列表"""
def has_read_permission(self, team):
"""具有俱乐部分组读取权限"""
if self.current_user == team.owner:
return True
raise ApiException(403, '权限错误')
def get(self, team_id):
"""获取俱乐部分组 Args: team_id: int"""
team = Team.get_or... | the_stack_v2_python_sparse | PaiDuiGuanJia/yiyun/handlers/rest/team.py | haoweiking/image_tesseract_private | train | 0 |
ed86ecd23c3431869dad06cef9d5b717cd8a2453 | [
"if columns is not None:\n if isinstance(columns, list) or isinstance(columns, tuple):\n self.columns = columns\n else:\n raise TypeError('Invalid type {}'.format(type(columns)))\nelse:\n self.columns = columns\nself.drop = drop",
"if self.columns is None:\n self.columns = X.select_dtype... | <|body_start_0|>
if columns is not None:
if isinstance(columns, list) or isinstance(columns, tuple):
self.columns = columns
else:
raise TypeError('Invalid type {}'.format(type(columns)))
else:
self.columns = columns
self.drop = ... | This transformer applies log to skewed features. Attributes ---------- columns: npandas [n_columns] Examples -------- For usage examples, please see: https://jaisenbe58r.github.io/MLearner/user_guide/preprocessing/FixSkewness/ | FixSkewness | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FixSkewness:
"""This transformer applies log to skewed features. Attributes ---------- columns: npandas [n_columns] Examples -------- For usage examples, please see: https://jaisenbe58r.github.io/MLearner/user_guide/preprocessing/FixSkewness/"""
def __init__(self, columns=None, drop=True):
... | stack_v2_sparse_classes_10k_train_006216 | 3,058 | permissive | [
{
"docstring": "Init log skewed.",
"name": "__init__",
"signature": "def __init__(self, columns=None, drop=True)"
},
{
"docstring": "Selecting skewed columns from the dataset. Parameters ---------- X : {Dataframe}, shape = [n_samples, n_features] Dataframe, where n_samples is the number of sampl... | 3 | stack_v2_sparse_classes_30k_train_004698 | Implement the Python class `FixSkewness` described below.
Class description:
This transformer applies log to skewed features. Attributes ---------- columns: npandas [n_columns] Examples -------- For usage examples, please see: https://jaisenbe58r.github.io/MLearner/user_guide/preprocessing/FixSkewness/
Method signatu... | Implement the Python class `FixSkewness` described below.
Class description:
This transformer applies log to skewed features. Attributes ---------- columns: npandas [n_columns] Examples -------- For usage examples, please see: https://jaisenbe58r.github.io/MLearner/user_guide/preprocessing/FixSkewness/
Method signatu... | e768a4cad150b35fb5bf543ab28aa23764af51d9 | <|skeleton|>
class FixSkewness:
"""This transformer applies log to skewed features. Attributes ---------- columns: npandas [n_columns] Examples -------- For usage examples, please see: https://jaisenbe58r.github.io/MLearner/user_guide/preprocessing/FixSkewness/"""
def __init__(self, columns=None, drop=True):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FixSkewness:
"""This transformer applies log to skewed features. Attributes ---------- columns: npandas [n_columns] Examples -------- For usage examples, please see: https://jaisenbe58r.github.io/MLearner/user_guide/preprocessing/FixSkewness/"""
def __init__(self, columns=None, drop=True):
"""Ini... | the_stack_v2_python_sparse | mlearner/preprocessing/log_skewed.py | jaisenbe58r/MLearner | train | 9 |
49a0342226e76041a7579253595cab30357d8cd7 | [
"self.size = size\nself.processed_bytes = processed_bytes\nself.finished = size == processed_bytes\nself.time = time\nself.source_url = source_url\nself.destination_url = destination_url\nself.component_number = component_number\nself.total_components = total_components\nself.operation_name = operation_name\nself.p... | <|body_start_0|>
self.size = size
self.processed_bytes = processed_bytes
self.finished = size == processed_bytes
self.time = time
self.source_url = source_url
self.destination_url = destination_url
self.component_number = component_number
self.total_compon... | Message class for sending information about operation progress. This class contains specific information on the progress of operating on a file, cloud object, or single component. Attributes: size (int): Total size of file/component in bytes. processed_bytes (int): Number of bytes already operated on. finished (bool): ... | ProgressMessage | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProgressMessage:
"""Message class for sending information about operation progress. This class contains specific information on the progress of operating on a file, cloud object, or single component. Attributes: size (int): Total size of file/component in bytes. processed_bytes (int): Number of b... | stack_v2_sparse_classes_10k_train_006217 | 4,082 | permissive | [
{
"docstring": "Initializes a ProgressMessage. See attributes docstring for arguments.",
"name": "__init__",
"signature": "def __init__(self, size, processed_bytes, time, source_url, destination_url=None, component_number=None, total_components=None, operation_name=None, process_id=None, thread_id=None)... | 2 | stack_v2_sparse_classes_30k_train_001047 | Implement the Python class `ProgressMessage` described below.
Class description:
Message class for sending information about operation progress. This class contains specific information on the progress of operating on a file, cloud object, or single component. Attributes: size (int): Total size of file/component in by... | Implement the Python class `ProgressMessage` described below.
Class description:
Message class for sending information about operation progress. This class contains specific information on the progress of operating on a file, cloud object, or single component. Attributes: size (int): Total size of file/component in by... | 849d09dd7863efecbdf4072a504e1554e119f6ae | <|skeleton|>
class ProgressMessage:
"""Message class for sending information about operation progress. This class contains specific information on the progress of operating on a file, cloud object, or single component. Attributes: size (int): Total size of file/component in bytes. processed_bytes (int): Number of b... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ProgressMessage:
"""Message class for sending information about operation progress. This class contains specific information on the progress of operating on a file, cloud object, or single component. Attributes: size (int): Total size of file/component in bytes. processed_bytes (int): Number of bytes already ... | the_stack_v2_python_sparse | google-cloud-sdk/lib/googlecloudsdk/command_lib/storage/thread_messages.py | PrateekKhatri/gcloud_cli | train | 0 |
2936fb2c028ea411143d858668ee976c4550edae | [
"if not isinstance(self.db.run_date, datetime):\n self.db.run_date = datetime.now() + timedelta(days=7)\nremaining = self.db.run_date - datetime.now()\nreturn remaining",
"rounding_check = timedelta(minutes=5)\nif self.time_remaining < rounding_check:\n return True\nelse:\n return False"
] | <|body_start_0|>
if not isinstance(self.db.run_date, datetime):
self.db.run_date = datetime.now() + timedelta(days=7)
remaining = self.db.run_date - datetime.now()
return remaining
<|end_body_0|>
<|body_start_1|>
rounding_check = timedelta(minutes=5)
if self.time_rem... | Mixin for checking remaining time | RunDateMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RunDateMixin:
"""Mixin for checking remaining time"""
def time_remaining(self):
"""Returns the time the update is scheduled to run.AccountTransaction Returns: remaining (Timedelta): remaining time before weekly update will process"""
<|body_0|>
def check_event(self):
... | stack_v2_sparse_classes_10k_train_006218 | 1,073 | permissive | [
{
"docstring": "Returns the time the update is scheduled to run.AccountTransaction Returns: remaining (Timedelta): remaining time before weekly update will process",
"name": "time_remaining",
"signature": "def time_remaining(self)"
},
{
"docstring": "Determine if enough time has passed. Return t... | 2 | stack_v2_sparse_classes_30k_train_000353 | Implement the Python class `RunDateMixin` described below.
Class description:
Mixin for checking remaining time
Method signatures and docstrings:
- def time_remaining(self): Returns the time the update is scheduled to run.AccountTransaction Returns: remaining (Timedelta): remaining time before weekly update will proc... | Implement the Python class `RunDateMixin` described below.
Class description:
Mixin for checking remaining time
Method signatures and docstrings:
- def time_remaining(self): Returns the time the update is scheduled to run.AccountTransaction Returns: remaining (Timedelta): remaining time before weekly update will proc... | 363a1f14fd1a640580a4bf4486a1afe776757557 | <|skeleton|>
class RunDateMixin:
"""Mixin for checking remaining time"""
def time_remaining(self):
"""Returns the time the update is scheduled to run.AccountTransaction Returns: remaining (Timedelta): remaining time before weekly update will process"""
<|body_0|>
def check_event(self):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RunDateMixin:
"""Mixin for checking remaining time"""
def time_remaining(self):
"""Returns the time the update is scheduled to run.AccountTransaction Returns: remaining (Timedelta): remaining time before weekly update will process"""
if not isinstance(self.db.run_date, datetime):
... | the_stack_v2_python_sparse | typeclasses/scripts/script_mixins.py | Arx-Game/arxcode | train | 52 |
ca0d77c1d52fd1ab79fbd6ac5a9e59996c39377d | [
"from collections import deque\nif not grid:\n return 0\nrows, cols, island_count = (len(grid), len(grid[0]), 0)\nq = deque([])\n\ndef helper(grid: List[List[str]], q: 'deque'):\n while q:\n r, c = q.popleft()\n for dr, dc in ((r + 1, c), (r - 1, c), (r, c + 1), (r, c - 1)):\n if 0 <=... | <|body_start_0|>
from collections import deque
if not grid:
return 0
rows, cols, island_count = (len(grid), len(grid[0]), 0)
q = deque([])
def helper(grid: List[List[str]], q: 'deque'):
while q:
r, c = q.popleft()
for dr, d... | Islands | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Islands:
def total_number_(self, grid: List[List[str]]) -> str:
"""Approach: BFS Time Complexity: O(M*N) Space Complexity: O(min(M,N)) :param grid: :return:"""
<|body_0|>
def total_number(self, grid: List[List[str]]) -> str:
"""Approach: DFS/ Back tracking Time Compl... | stack_v2_sparse_classes_10k_train_006219 | 2,392 | no_license | [
{
"docstring": "Approach: BFS Time Complexity: O(M*N) Space Complexity: O(min(M,N)) :param grid: :return:",
"name": "total_number_",
"signature": "def total_number_(self, grid: List[List[str]]) -> str"
},
{
"docstring": "Approach: DFS/ Back tracking Time Complexity: O(M*N) Space Complexity: O(M*... | 2 | null | Implement the Python class `Islands` described below.
Class description:
Implement the Islands class.
Method signatures and docstrings:
- def total_number_(self, grid: List[List[str]]) -> str: Approach: BFS Time Complexity: O(M*N) Space Complexity: O(min(M,N)) :param grid: :return:
- def total_number(self, grid: List... | Implement the Python class `Islands` described below.
Class description:
Implement the Islands class.
Method signatures and docstrings:
- def total_number_(self, grid: List[List[str]]) -> str: Approach: BFS Time Complexity: O(M*N) Space Complexity: O(min(M,N)) :param grid: :return:
- def total_number(self, grid: List... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class Islands:
def total_number_(self, grid: List[List[str]]) -> str:
"""Approach: BFS Time Complexity: O(M*N) Space Complexity: O(min(M,N)) :param grid: :return:"""
<|body_0|>
def total_number(self, grid: List[List[str]]) -> str:
"""Approach: DFS/ Back tracking Time Compl... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Islands:
def total_number_(self, grid: List[List[str]]) -> str:
"""Approach: BFS Time Complexity: O(M*N) Space Complexity: O(min(M,N)) :param grid: :return:"""
from collections import deque
if not grid:
return 0
rows, cols, island_count = (len(grid), len(grid[0]), 0... | the_stack_v2_python_sparse | revisited_2021/2d_array/number_of_islands.py | Shiv2157k/leet_code | train | 1 | |
03d5b85c85e361b482ae940c56802bd38977f09e | [
"if send_notifications:\n send_notifications_string = 'SendToAllAndSaveCopy'\nelse:\n send_notifications_string = 'SendToNone'\nroot = M.DeleteItem(M.ItemIds(item_id.to_xml()), DeleteType='HardDelete', SendMeetingCancellations=send_notifications_string, AffectedTaskOccurrences='AllOccurrences')\nsuper(DeleteC... | <|body_start_0|>
if send_notifications:
send_notifications_string = 'SendToAllAndSaveCopy'
else:
send_notifications_string = 'SendToNone'
root = M.DeleteItem(M.ItemIds(item_id.to_xml()), DeleteType='HardDelete', SendMeetingCancellations=send_notifications_string, Affected... | Encapsulates a request to delete an existing calendar item. | DeleteCalendarItemRequest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeleteCalendarItemRequest:
"""Encapsulates a request to delete an existing calendar item."""
def __init__(self, principal, item_id, send_notifications=True):
"""Initialize the request. :param principal: Principal email to impersonate :param item_id: Item ID object :type item_id: resp... | stack_v2_sparse_classes_10k_train_006220 | 8,656 | permissive | [
{
"docstring": "Initialize the request. :param principal: Principal email to impersonate :param item_id: Item ID object :type item_id: respa_exchange.objs.ItemID",
"name": "__init__",
"signature": "def __init__(self, principal, item_id, send_notifications=True)"
},
{
"docstring": "Send the delet... | 2 | stack_v2_sparse_classes_30k_train_000183 | Implement the Python class `DeleteCalendarItemRequest` described below.
Class description:
Encapsulates a request to delete an existing calendar item.
Method signatures and docstrings:
- def __init__(self, principal, item_id, send_notifications=True): Initialize the request. :param principal: Principal email to imper... | Implement the Python class `DeleteCalendarItemRequest` described below.
Class description:
Encapsulates a request to delete an existing calendar item.
Method signatures and docstrings:
- def __init__(self, principal, item_id, send_notifications=True): Initialize the request. :param principal: Principal email to imper... | e6ae93087dde0eb62f859da732ee19d0b6c5fccf | <|skeleton|>
class DeleteCalendarItemRequest:
"""Encapsulates a request to delete an existing calendar item."""
def __init__(self, principal, item_id, send_notifications=True):
"""Initialize the request. :param principal: Principal email to impersonate :param item_id: Item ID object :type item_id: resp... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DeleteCalendarItemRequest:
"""Encapsulates a request to delete an existing calendar item."""
def __init__(self, principal, item_id, send_notifications=True):
"""Initialize the request. :param principal: Principal email to impersonate :param item_id: Item ID object :type item_id: respa_exchange.ob... | the_stack_v2_python_sparse | respa_exchange/ews/calendar.py | City-of-Helsinki/respa | train | 69 |
e8cfc0db049a5f73b931b31c11a6b443569a5a38 | [
"self.resolver = resolver\nself.options = options\nself.copyfiles = tuple()",
"self.copyfiles = self.resolver.get_copyfiles(device_start_index)\ncapacity_bytes = filesystem.volume_capacity(self.options.output)\nbackup_bytes = filesystem.directory_size(self.options.output)\ndifferent_indexes = self._find_files_dif... | <|body_start_0|>
self.resolver = resolver
self.options = options
self.copyfiles = tuple()
<|end_body_0|>
<|body_start_1|>
self.copyfiles = self.resolver.get_copyfiles(device_start_index)
capacity_bytes = filesystem.volume_capacity(self.options.output)
backup_bytes = file... | Verifies a portion of a backup written to a single volume. Ex volume 3 of 5 involved in a backup. | Verifier | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Verifier:
"""Verifies a portion of a backup written to a single volume. Ex volume 3 of 5 involved in a backup."""
def __init__(self, resolver, options):
"""Constructor. Args: resolver (multivolumecopy.resolvers.resolver.Resolver): produces list of copyfiles. options (multivolumecopy.... | stack_v2_sparse_classes_10k_train_006221 | 8,019 | permissive | [
{
"docstring": "Constructor. Args: resolver (multivolumecopy.resolvers.resolver.Resolver): produces list of copyfiles. options (multivolumecopy.copyoptions.CopyOptions): options used for copyjob.",
"name": "__init__",
"signature": "def __init__(self, resolver, options)"
},
{
"docstring": "Args: ... | 5 | stack_v2_sparse_classes_30k_val_000264 | Implement the Python class `Verifier` described below.
Class description:
Verifies a portion of a backup written to a single volume. Ex volume 3 of 5 involved in a backup.
Method signatures and docstrings:
- def __init__(self, resolver, options): Constructor. Args: resolver (multivolumecopy.resolvers.resolver.Resolve... | Implement the Python class `Verifier` described below.
Class description:
Verifies a portion of a backup written to a single volume. Ex volume 3 of 5 involved in a backup.
Method signatures and docstrings:
- def __init__(self, resolver, options): Constructor. Args: resolver (multivolumecopy.resolvers.resolver.Resolve... | 9169b97d2f005d56d4ce128069b7de23e677117c | <|skeleton|>
class Verifier:
"""Verifies a portion of a backup written to a single volume. Ex volume 3 of 5 involved in a backup."""
def __init__(self, resolver, options):
"""Constructor. Args: resolver (multivolumecopy.resolvers.resolver.Resolver): produces list of copyfiles. options (multivolumecopy.... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Verifier:
"""Verifies a portion of a backup written to a single volume. Ex volume 3 of 5 involved in a backup."""
def __init__(self, resolver, options):
"""Constructor. Args: resolver (multivolumecopy.resolvers.resolver.Resolver): produces list of copyfiles. options (multivolumecopy.copyoptions.C... | the_stack_v2_python_sparse | multivolumecopy/verifier.py | willjp/multivolumecopy | train | 0 |
bf8d2f008f626698d41ab65acfc7c83450f1a3f7 | [
"N = len(nums)\nresult = 0\na = 0\nb = 0\nfor x in nums:\n if x == 1:\n a += 1\n b += 1\n result = max(a, result)\n else:\n a = b\n b = 0\nif result == N:\n result -= 1\nreturn result",
"N = len(nums)\nresult = 0\nzero_num = 0\nleft = 0\nright = 0\nwhile right < N:\n ... | <|body_start_0|>
N = len(nums)
result = 0
a = 0
b = 0
for x in nums:
if x == 1:
a += 1
b += 1
result = max(a, result)
else:
a = b
b = 0
if result == N:
resu... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestSubarray(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def longestSubarray2(self, nums):
"""滑动窗口法,统计窗口内0的个数,雄安与等于1则扩大窗口,否则滑动窗口"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
N = len(nums)
result = 0
... | stack_v2_sparse_classes_10k_train_006222 | 1,746 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "longestSubarray",
"signature": "def longestSubarray(self, nums)"
},
{
"docstring": "滑动窗口法,统计窗口内0的个数,雄安与等于1则扩大窗口,否则滑动窗口",
"name": "longestSubarray2",
"signature": "def longestSubarray2(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000360 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestSubarray(self, nums): :type nums: List[int] :rtype: int
- def longestSubarray2(self, nums): 滑动窗口法,统计窗口内0的个数,雄安与等于1则扩大窗口,否则滑动窗口 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestSubarray(self, nums): :type nums: List[int] :rtype: int
- def longestSubarray2(self, nums): 滑动窗口法,统计窗口内0的个数,雄安与等于1则扩大窗口,否则滑动窗口
<|skeleton|>
class Solution:
def l... | 837957ea22aa07ce28a6c23ea0419bd2011e1f88 | <|skeleton|>
class Solution:
def longestSubarray(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def longestSubarray2(self, nums):
"""滑动窗口法,统计窗口内0的个数,雄安与等于1则扩大窗口,否则滑动窗口"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def longestSubarray(self, nums):
""":type nums: List[int] :rtype: int"""
N = len(nums)
result = 0
a = 0
b = 0
for x in nums:
if x == 1:
a += 1
b += 1
result = max(a, result)
else:
... | the_stack_v2_python_sparse | 竞赛/29场/删掉一个元素以后全为 1 的最长子数组_M.py | 2226171237/Algorithmpractice | train | 0 | |
9ba5c61cad5e64c7a3c1919f9e6300dc20991a44 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn TermColumn()",
"from .term_store.set import Set\nfrom .term_store.term import Term\nfrom .term_store.set import Set\nfrom .term_store.term import Term\nfields: Dict[str, Callable[[Any], None]] = {'allowMultipleValues': lambda n: setatt... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return TermColumn()
<|end_body_0|>
<|body_start_1|>
from .term_store.set import Set
from .term_store.term import Term
from .term_store.set import Set
from .term_store.term impor... | TermColumn | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TermColumn:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TermColumn:
"""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: Term... | stack_v2_sparse_classes_10k_train_006223 | 3,553 | 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: TermColumn",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(pa... | 3 | null | Implement the Python class `TermColumn` described below.
Class description:
Implement the TermColumn class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TermColumn: Creates a new instance of the appropriate class based on discriminator value Args: pa... | Implement the Python class `TermColumn` described below.
Class description:
Implement the TermColumn class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TermColumn: Creates a new instance of the appropriate class based on discriminator value Args: pa... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class TermColumn:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TermColumn:
"""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: Term... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TermColumn:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> TermColumn:
"""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: TermColumn"""
... | the_stack_v2_python_sparse | msgraph/generated/models/term_column.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
d3299d1b5c13e2bae71d289ebce32b7e784afa75 | [
"self.items = items\nself.name = name\nself.optional = optional",
"if dictionary is None:\n return None\nitems = None\nif dictionary.get('items') != None:\n items = list()\n for structure in dictionary.get('items'):\n items.append(cohesity_management_sdk.models.pod_info_pod_spec_volume_info_key_to... | <|body_start_0|>
self.items = items
self.name = name
self.optional = optional
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
items = None
if dictionary.get('items') != None:
items = list()
for structure in dictionar... | Implementation of the 'PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection' model. TODO: type description here. Attributes: items (list of PodInfo_PodSpec_VolumeInfo_KeyToPath): TODO: Type description here. name (string): TODO: Type description here. optional (bool): TODO: Type description here. | PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection:
"""Implementation of the 'PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection' model. TODO: type description here. Attributes: items (list of PodInfo_PodSpec_VolumeInfo_KeyToPath): TODO: Type descript... | stack_v2_sparse_classes_10k_train_006224 | 2,250 | permissive | [
{
"docstring": "Constructor for the PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection class",
"name": "__init__",
"signature": "def __init__(self, items=None, name=None, optional=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionar... | 2 | null | Implement the Python class `PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection` described below.
Class description:
Implementation of the 'PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection' model. TODO: type description here. Attributes: items (list of PodInfo_PodSpec_Vol... | Implement the Python class `PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection` described below.
Class description:
Implementation of the 'PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection' model. TODO: type description here. Attributes: items (list of PodInfo_PodSpec_Vol... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection:
"""Implementation of the 'PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection' model. TODO: type description here. Attributes: items (list of PodInfo_PodSpec_VolumeInfo_KeyToPath): TODO: Type descript... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection:
"""Implementation of the 'PodInfo_PodSpec_VolumeInfo_Projected_VolumeProjection_ConfigMapProjection' model. TODO: type description here. Attributes: items (list of PodInfo_PodSpec_VolumeInfo_KeyToPath): TODO: Type description here. nam... | the_stack_v2_python_sparse | cohesity_management_sdk/models/pod_info_pod_spec_volume_info_projected_volume_projection_config_map_projection.py | cohesity/management-sdk-python | train | 24 |
7de0ac8c0746f4f26ca096f17215ff6248f9c3e7 | [
"self.active = active\nself.mfrom = mfrom\nself.to = to",
"if dictionary is None:\n return None\nactive = dictionary.get('active')\nmfrom = dictionary.get('from')\nto = dictionary.get('to')\nreturn cls(active, mfrom, to)"
] | <|body_start_0|>
self.active = active
self.mfrom = mfrom
self.to = to
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
active = dictionary.get('active')
mfrom = dictionary.get('from')
to = dictionary.get('to')
return cls(acti... | Implementation of the 'Monday' model. The schedule object for Monday. Attributes: active (bool): Whether the schedule is active (true) or inactive (false) during the time specified between 'from' and 'to'. Defaults to true. mfrom (string): The time, from '00:00' to '24:00'. Must be less than the time specified in 'to'.... | MondayModel | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MondayModel:
"""Implementation of the 'Monday' model. The schedule object for Monday. Attributes: active (bool): Whether the schedule is active (true) or inactive (false) during the time specified between 'from' and 'to'. Defaults to true. mfrom (string): The time, from '00:00' to '24:00'. Must b... | stack_v2_sparse_classes_10k_train_006225 | 2,170 | permissive | [
{
"docstring": "Constructor for the MondayModel class",
"name": "__init__",
"signature": "def __init__(self, active=None, mfrom=None, to=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the object as obtai... | 2 | stack_v2_sparse_classes_30k_val_000099 | Implement the Python class `MondayModel` described below.
Class description:
Implementation of the 'Monday' model. The schedule object for Monday. Attributes: active (bool): Whether the schedule is active (true) or inactive (false) during the time specified between 'from' and 'to'. Defaults to true. mfrom (string): Th... | Implement the Python class `MondayModel` described below.
Class description:
Implementation of the 'Monday' model. The schedule object for Monday. Attributes: active (bool): Whether the schedule is active (true) or inactive (false) during the time specified between 'from' and 'to'. Defaults to true. mfrom (string): Th... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class MondayModel:
"""Implementation of the 'Monday' model. The schedule object for Monday. Attributes: active (bool): Whether the schedule is active (true) or inactive (false) during the time specified between 'from' and 'to'. Defaults to true. mfrom (string): The time, from '00:00' to '24:00'. Must b... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MondayModel:
"""Implementation of the 'Monday' model. The schedule object for Monday. Attributes: active (bool): Whether the schedule is active (true) or inactive (false) during the time specified between 'from' and 'to'. Defaults to true. mfrom (string): The time, from '00:00' to '24:00'. Must be less than t... | the_stack_v2_python_sparse | meraki_sdk/models/monday_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
8b5e8c7b4dd014523e41e88d52899ea7a1e01f59 | [
"from dials.util.options import ArgumentParser\nusage = 'dials.apply_mask models.expt input.mask=pixels.mask'\nself.parser = ArgumentParser(usage=usage, epilog=help_message, phil=phil_scope, read_experiments=True)",
"from dials.util import Sorry\nfrom dials.util.options import flatten_experiments\nparams, options... | <|body_start_0|>
from dials.util.options import ArgumentParser
usage = 'dials.apply_mask models.expt input.mask=pixels.mask'
self.parser = ArgumentParser(usage=usage, epilog=help_message, phil=phil_scope, read_experiments=True)
<|end_body_0|>
<|body_start_1|>
from dials.util import Sorr... | A class to encapsulate the script. | Script | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Script:
"""A class to encapsulate the script."""
def __init__(self):
"""Initialise the script."""
<|body_0|>
def run(self, args=None):
"""Run the script."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
from dials.util.options import ArgumentPars... | stack_v2_sparse_classes_10k_train_006226 | 3,228 | permissive | [
{
"docstring": "Initialise the script.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Run the script.",
"name": "run",
"signature": "def run(self, args=None)"
}
] | 2 | null | Implement the Python class `Script` described below.
Class description:
A class to encapsulate the script.
Method signatures and docstrings:
- def __init__(self): Initialise the script.
- def run(self, args=None): Run the script. | Implement the Python class `Script` described below.
Class description:
A class to encapsulate the script.
Method signatures and docstrings:
- def __init__(self): Initialise the script.
- def run(self, args=None): Run the script.
<|skeleton|>
class Script:
"""A class to encapsulate the script."""
def __init... | 88bf7f7c5ac44defc046ebf0719cde748092cfff | <|skeleton|>
class Script:
"""A class to encapsulate the script."""
def __init__(self):
"""Initialise the script."""
<|body_0|>
def run(self, args=None):
"""Run the script."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Script:
"""A class to encapsulate the script."""
def __init__(self):
"""Initialise the script."""
from dials.util.options import ArgumentParser
usage = 'dials.apply_mask models.expt input.mask=pixels.mask'
self.parser = ArgumentParser(usage=usage, epilog=help_message, phil... | the_stack_v2_python_sparse | src/dials/command_line/apply_mask.py | dials/dials | train | 71 |
decaf7766abd15ff16b9418cdf72feb7e18dc8fc | [
"qs = super(ReleaseViewSet, self).filter_queryset(qs)\nif getattr(self, 'order_queryset', False):\n return sorted(qs, key=models.Release.version_sort_key)\nreturn qs",
"response = super(ReleaseViewSet, self).create(request, *args, **kwargs)\nif response.status_code == status.HTTP_201_CREATED:\n signals.rele... | <|body_start_0|>
qs = super(ReleaseViewSet, self).filter_queryset(qs)
if getattr(self, 'order_queryset', False):
return sorted(qs, key=models.Release.version_sort_key)
return qs
<|end_body_0|>
<|body_start_1|>
response = super(ReleaseViewSet, self).create(request, *args, **k... | An API endpoint providing access to releases. Each release can reference either a product version or a base product (or both). There references are done via human-readable `product_version_id` or `base_product_id`. Composes belonging to given release are referenced via `compose_id`. The list of associated composes incl... | ReleaseViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReleaseViewSet:
"""An API endpoint providing access to releases. Each release can reference either a product version or a base product (or both). There references are done via human-readable `product_version_id` or `base_product_id`. Composes belonging to given release are referenced via `compose... | stack_v2_sparse_classes_10k_train_006227 | 31,272 | permissive | [
{
"docstring": "If the viewset instance has attribute `order_queryset` set to True, this method returns a list of releases ordered by version. Otherwise it will return an unsorted queryset. (It is not possible to sort unconditionally as get_object() will at some point call this method and fail unless it receive... | 4 | stack_v2_sparse_classes_30k_train_003922 | Implement the Python class `ReleaseViewSet` described below.
Class description:
An API endpoint providing access to releases. Each release can reference either a product version or a base product (or both). There references are done via human-readable `product_version_id` or `base_product_id`. Composes belonging to gi... | Implement the Python class `ReleaseViewSet` described below.
Class description:
An API endpoint providing access to releases. Each release can reference either a product version or a base product (or both). There references are done via human-readable `product_version_id` or `base_product_id`. Composes belonging to gi... | af79f73c30fa5f5709ba03d584b7a49b83166b81 | <|skeleton|>
class ReleaseViewSet:
"""An API endpoint providing access to releases. Each release can reference either a product version or a base product (or both). There references are done via human-readable `product_version_id` or `base_product_id`. Composes belonging to given release are referenced via `compose... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ReleaseViewSet:
"""An API endpoint providing access to releases. Each release can reference either a product version or a base product (or both). There references are done via human-readable `product_version_id` or `base_product_id`. Composes belonging to given release are referenced via `compose_id`. The lis... | the_stack_v2_python_sparse | pdc/apps/release/views.py | product-definition-center/product-definition-center | train | 19 |
fe1b68be12c5b5606e3c516dd1543be259d091e3 | [
"data_list = []\nresults = self.query.all()\nformatter = self.request.locale.dates.getFormatter('date', 'short')\nfor result in results:\n data = {}\n data['subject'] = result.short_name\n if ICommittee.providedBy(result.group):\n data['url'] = 'committees/obj-%i/calendar/group/sittings/obj-%i/sched... | <|body_start_0|>
data_list = []
results = self.query.all()
formatter = self.request.locale.dates.getFormatter('date', 'short')
for result in results:
data = {}
data['subject'] = result.short_name
if ICommittee.providedBy(result.group):
... | DraftSittingsViewlet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DraftSittingsViewlet:
def getData(self):
"""return the data of the query"""
<|body_0|>
def update(self):
"""refresh the query"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
data_list = []
results = self.query.all()
formatter = self.... | stack_v2_sparse_classes_10k_train_006228 | 35,739 | no_license | [
{
"docstring": "return the data of the query",
"name": "getData",
"signature": "def getData(self)"
},
{
"docstring": "refresh the query",
"name": "update",
"signature": "def update(self)"
}
] | 2 | null | Implement the Python class `DraftSittingsViewlet` described below.
Class description:
Implement the DraftSittingsViewlet class.
Method signatures and docstrings:
- def getData(self): return the data of the query
- def update(self): refresh the query | Implement the Python class `DraftSittingsViewlet` described below.
Class description:
Implement the DraftSittingsViewlet class.
Method signatures and docstrings:
- def getData(self): return the data of the query
- def update(self): refresh the query
<|skeleton|>
class DraftSittingsViewlet:
def getData(self):
... | 5cf0ba31dfbff8d2c1b4aa8ab6f69c7a0ae9870d | <|skeleton|>
class DraftSittingsViewlet:
def getData(self):
"""return the data of the query"""
<|body_0|>
def update(self):
"""refresh the query"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DraftSittingsViewlet:
def getData(self):
"""return the data of the query"""
data_list = []
results = self.query.all()
formatter = self.request.locale.dates.getFormatter('date', 'short')
for result in results:
data = {}
data['subject'] = result.sh... | the_stack_v2_python_sparse | bungeni.buildout/branches/bungeni.buildout-refactor-2010-06-02/src/bungeni.main/bungeni/ui/viewlets/workspace.py | malangalanga/bungeni-portal | train | 0 | |
c4e6b127330682d4c5d6bf997bf9f0c9ed616928 | [
"super().__init__()\nself.generator = Generator()\nself.master = Master()",
"logger.info('SpNasPipeStep started')\nwhile not self.generator.is_completed:\n id, spnas_sample = self.generator.search_alg.search()\n cls_trainer = ClassFactory.get_cls('trainer')\n trainer = cls_trainer(spnas_sample=spnas_samp... | <|body_start_0|>
super().__init__()
self.generator = Generator()
self.master = Master()
<|end_body_0|>
<|body_start_1|>
logger.info('SpNasPipeStep started')
while not self.generator.is_completed:
id, spnas_sample = self.generator.search_alg.search()
cls_t... | PipeStep is the base components class that can be added in Pipeline. | SpNasPipeStep | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpNasPipeStep:
"""PipeStep is the base components class that can be added in Pipeline."""
def __init__(self):
"""Initialize SpNasPipeStep."""
<|body_0|>
def do(self):
"""Do the main task in this pipe step."""
<|body_1|>
def update_generator(self, gen... | stack_v2_sparse_classes_10k_train_006229 | 3,119 | permissive | [
{
"docstring": "Initialize SpNasPipeStep.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Do the main task in this pipe step.",
"name": "do",
"signature": "def do(self)"
},
{
"docstring": "Get finished worker's info, and use it to update target `generat... | 3 | null | Implement the Python class `SpNasPipeStep` described below.
Class description:
PipeStep is the base components class that can be added in Pipeline.
Method signatures and docstrings:
- def __init__(self): Initialize SpNasPipeStep.
- def do(self): Do the main task in this pipe step.
- def update_generator(self, generat... | Implement the Python class `SpNasPipeStep` described below.
Class description:
PipeStep is the base components class that can be added in Pipeline.
Method signatures and docstrings:
- def __init__(self): Initialize SpNasPipeStep.
- def do(self): Do the main task in this pipe step.
- def update_generator(self, generat... | df51ed9c1d6dbde1deef63f2a037a369f8554406 | <|skeleton|>
class SpNasPipeStep:
"""PipeStep is the base components class that can be added in Pipeline."""
def __init__(self):
"""Initialize SpNasPipeStep."""
<|body_0|>
def do(self):
"""Do the main task in this pipe step."""
<|body_1|>
def update_generator(self, gen... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SpNasPipeStep:
"""PipeStep is the base components class that can be added in Pipeline."""
def __init__(self):
"""Initialize SpNasPipeStep."""
super().__init__()
self.generator = Generator()
self.master = Master()
def do(self):
"""Do the main task in this pipe ... | the_stack_v2_python_sparse | built-in/TensorFlow/Official/cv/image_classification/ResnetVariant_for_TensorFlow/automl/vega/algorithms/nas/sp_nas/spnas_pipe_step.py | Huawei-Ascend/modelzoo | train | 1 |
84f348d1a98a6d4062d03009dbd74ae91d877b5e | [
"self.radius = radius\nself.x_center = x_center\nself.y_center = y_center",
"radians = random() * pi * 2\nl = self.radius * sqrt(random())\nreturn [self.x_center + l * cos(radians), self.y_center + l * sin(radians)]"
] | <|body_start_0|>
self.radius = radius
self.x_center = x_center
self.y_center = y_center
<|end_body_0|>
<|body_start_1|>
radians = random() * pi * 2
l = self.radius * sqrt(random())
return [self.x_center + l * cos(radians), self.y_center + l * sin(radians)]
<|end_body_1|>... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, radius, x_center, y_center):
""":type radius: float :type x_center: float :type y_center: float"""
<|body_0|>
def randPoint(self):
""":rtype: List[float]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.radius = radi... | stack_v2_sparse_classes_10k_train_006230 | 916 | no_license | [
{
"docstring": ":type radius: float :type x_center: float :type y_center: float",
"name": "__init__",
"signature": "def __init__(self, radius, x_center, y_center)"
},
{
"docstring": ":rtype: List[float]",
"name": "randPoint",
"signature": "def randPoint(self)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float
- def randPoint(self): :rtype: List[float] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float
- def randPoint(self): :rtype: List[float]
<|skeleton|>
class Sol... | f93380721b8383817fe2b0d728deca1321c9ef45 | <|skeleton|>
class Solution:
def __init__(self, radius, x_center, y_center):
""":type radius: float :type x_center: float :type y_center: float"""
<|body_0|>
def randPoint(self):
""":rtype: List[float]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, radius, x_center, y_center):
""":type radius: float :type x_center: float :type y_center: float"""
self.radius = radius
self.x_center = x_center
self.y_center = y_center
def randPoint(self):
""":rtype: List[float]"""
radians = r... | the_stack_v2_python_sparse | explore/2021/march/Generate_Random_Point_in_a_Circle.py | lixiang2017/leetcode | train | 5 | |
d20c832b13b8556560575c4ff64d23a29a398626 | [
"self.to = to\nself.application_id = application_id\nself.scope = scope\nself.expiration_time_in_minutes = expiration_time_in_minutes\nself.code = code",
"if dictionary is None:\n return None\nto = dictionary.get('to')\napplication_id = dictionary.get('applicationId')\nexpiration_time_in_minutes = dictionary.g... | <|body_start_0|>
self.to = to
self.application_id = application_id
self.scope = scope
self.expiration_time_in_minutes = expiration_time_in_minutes
self.code = code
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
to = dictionary.get(... | Implementation of the 'TwoFactorVerifyRequestSchema' model. TODO: type model description here. Attributes: to (string): The phone number to send the 2fa code to. application_id (string): The application unique ID, obtained from Bandwidth. scope (string): An optional field to denote what scope or action the 2fa code is ... | TwoFactorVerifyRequestSchema | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TwoFactorVerifyRequestSchema:
"""Implementation of the 'TwoFactorVerifyRequestSchema' model. TODO: type model description here. Attributes: to (string): The phone number to send the 2fa code to. application_id (string): The application unique ID, obtained from Bandwidth. scope (string): An option... | stack_v2_sparse_classes_10k_train_006231 | 2,920 | permissive | [
{
"docstring": "Constructor for the TwoFactorVerifyRequestSchema class",
"name": "__init__",
"signature": "def __init__(self, to=None, application_id=None, expiration_time_in_minutes=None, code=None, scope=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictio... | 2 | stack_v2_sparse_classes_30k_test_000338 | Implement the Python class `TwoFactorVerifyRequestSchema` described below.
Class description:
Implementation of the 'TwoFactorVerifyRequestSchema' model. TODO: type model description here. Attributes: to (string): The phone number to send the 2fa code to. application_id (string): The application unique ID, obtained fr... | Implement the Python class `TwoFactorVerifyRequestSchema` described below.
Class description:
Implementation of the 'TwoFactorVerifyRequestSchema' model. TODO: type model description here. Attributes: to (string): The phone number to send the 2fa code to. application_id (string): The application unique ID, obtained fr... | 447df3cc8cb7acaf3361d842630c432a9c31ce6e | <|skeleton|>
class TwoFactorVerifyRequestSchema:
"""Implementation of the 'TwoFactorVerifyRequestSchema' model. TODO: type model description here. Attributes: to (string): The phone number to send the 2fa code to. application_id (string): The application unique ID, obtained from Bandwidth. scope (string): An option... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TwoFactorVerifyRequestSchema:
"""Implementation of the 'TwoFactorVerifyRequestSchema' model. TODO: type model description here. Attributes: to (string): The phone number to send the 2fa code to. application_id (string): The application unique ID, obtained from Bandwidth. scope (string): An optional field to d... | the_stack_v2_python_sparse | bandwidth/multifactorauth/models/two_factor_verify_request_schema.py | Bandwidth/python-sdk | train | 10 |
0739f4322856affff3ddd86bebaec1f11caa1bc7 | [
"extent_raw_geom = obj['extent']\nif extent_raw_geom is not None:\n extent_geometry = GEOSGeometry(extent_raw_geom)\n return extent_geometry.extent\nreturn None",
"ret = super().to_representation(instance)\nret['id'] = instance['aquifer_id']\nret['name'] = instance['aquifer_name']\nif instance['area']:\n ... | <|body_start_0|>
extent_raw_geom = obj['extent']
if extent_raw_geom is not None:
extent_geometry = GEOSGeometry(extent_raw_geom)
return extent_geometry.extent
return None
<|end_body_0|>
<|body_start_1|>
ret = super().to_representation(instance)
ret['id'] ... | Serialize an aquifer list | AquiferSerializerV2 | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AquiferSerializerV2:
"""Serialize an aquifer list"""
def get_extent(self, obj):
"""Gets a GeoJSON extent"""
<|body_0|>
def to_representation(self, instance):
"""Rather the declare serializer fields, we must reference them here because they are queried as a `dict`... | stack_v2_sparse_classes_10k_train_006232 | 12,484 | permissive | [
{
"docstring": "Gets a GeoJSON extent",
"name": "get_extent",
"signature": "def get_extent(self, obj)"
},
{
"docstring": "Rather the declare serializer fields, we must reference them here because they are queried as a `dict`, which dramatically improves performance due to the high number of join... | 2 | null | Implement the Python class `AquiferSerializerV2` described below.
Class description:
Serialize an aquifer list
Method signatures and docstrings:
- def get_extent(self, obj): Gets a GeoJSON extent
- def to_representation(self, instance): Rather the declare serializer fields, we must reference them here because they ar... | Implement the Python class `AquiferSerializerV2` described below.
Class description:
Serialize an aquifer list
Method signatures and docstrings:
- def get_extent(self, obj): Gets a GeoJSON extent
- def to_representation(self, instance): Rather the declare serializer fields, we must reference them here because they ar... | 6be3701a8e0085d0c6fa199b2672b7f9f1266a03 | <|skeleton|>
class AquiferSerializerV2:
"""Serialize an aquifer list"""
def get_extent(self, obj):
"""Gets a GeoJSON extent"""
<|body_0|>
def to_representation(self, instance):
"""Rather the declare serializer fields, we must reference them here because they are queried as a `dict`... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AquiferSerializerV2:
"""Serialize an aquifer list"""
def get_extent(self, obj):
"""Gets a GeoJSON extent"""
extent_raw_geom = obj['extent']
if extent_raw_geom is not None:
extent_geometry = GEOSGeometry(extent_raw_geom)
return extent_geometry.extent
... | the_stack_v2_python_sparse | app/backend/aquifers/serializers_v2.py | bcgov/gwells | train | 39 |
852e977699115e691a92bf32e780d2c9b2424997 | [
"if self.test_mode:\n current_time = datetime.datetime.now()\n order.invoice = int(time.mktime(current_time.timetuple()))\nreturn super(ProPayConnector, self).process_payment(order, amount, credit_card, billing_record)",
"live_data = {'gateway_url': 'https://epay.propay.com/api/propayapi.aspx', 'cert': 'dcc... | <|body_start_0|>
if self.test_mode:
current_time = datetime.datetime.now()
order.invoice = int(time.mktime(current_time.timetuple()))
return super(ProPayConnector, self).process_payment(order, amount, credit_card, billing_record)
<|end_body_0|>
<|body_start_1|>
live_data... | An ecommerce connector to the ProPay gateway. Link to the docs: http://epay.propay.com/pdf/xmldoc.pdf | ProPayConnector | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProPayConnector:
"""An ecommerce connector to the ProPay gateway. Link to the docs: http://epay.propay.com/pdf/xmldoc.pdf"""
def process_payment(self, order, amount, credit_card, billing_record):
"""For tests, ProPay requires order invoice number to be unique once every 24 hours."""
... | stack_v2_sparse_classes_10k_train_006233 | 11,934 | no_license | [
{
"docstring": "For tests, ProPay requires order invoice number to be unique once every 24 hours.",
"name": "process_payment",
"signature": "def process_payment(self, order, amount, credit_card, billing_record)"
},
{
"docstring": "Process a payment of an order through ProPay gateway.",
"name... | 4 | null | Implement the Python class `ProPayConnector` described below.
Class description:
An ecommerce connector to the ProPay gateway. Link to the docs: http://epay.propay.com/pdf/xmldoc.pdf
Method signatures and docstrings:
- def process_payment(self, order, amount, credit_card, billing_record): For tests, ProPay requires o... | Implement the Python class `ProPayConnector` described below.
Class description:
An ecommerce connector to the ProPay gateway. Link to the docs: http://epay.propay.com/pdf/xmldoc.pdf
Method signatures and docstrings:
- def process_payment(self, order, amount, credit_card, billing_record): For tests, ProPay requires o... | a780ccdc3350d4b5c7990c65d1af8d71060c62cc | <|skeleton|>
class ProPayConnector:
"""An ecommerce connector to the ProPay gateway. Link to the docs: http://epay.propay.com/pdf/xmldoc.pdf"""
def process_payment(self, order, amount, credit_card, billing_record):
"""For tests, ProPay requires order invoice number to be unique once every 24 hours."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ProPayConnector:
"""An ecommerce connector to the ProPay gateway. Link to the docs: http://epay.propay.com/pdf/xmldoc.pdf"""
def process_payment(self, order, amount, credit_card, billing_record):
"""For tests, ProPay requires order invoice number to be unique once every 24 hours."""
if se... | the_stack_v2_python_sparse | ecommerce/connector.py | wcirillo/ten | train | 0 |
986f783a85002178b074a4e4823ca2eb37dd7bb9 | [
"costs = sorted(costs, key=lambda x: x[0])\nresult = 0\nwhile costs:\n a = costs[0][0]\n b = costs[1][1]\n min_cost = costs[0][0] + costs[1][1]\n min_index = 1\n for index, item in enumerate(costs[1:], 1):\n if min_cost > a + item[1]:\n min_cost = a + item[1]\n min_index ... | <|body_start_0|>
costs = sorted(costs, key=lambda x: x[0])
result = 0
while costs:
a = costs[0][0]
b = costs[1][1]
min_cost = costs[0][0] + costs[1][1]
min_index = 1
for index, item in enumerate(costs[1:], 1):
if min_cos... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoCitySchedCost_worng(self, costs):
""":type costs: List[List[int]] :rtype: int"""
<|body_0|>
def twoCitySchedCost(self, costs):
""":type costs: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
costs = sorte... | stack_v2_sparse_classes_10k_train_006234 | 1,005 | no_license | [
{
"docstring": ":type costs: List[List[int]] :rtype: int",
"name": "twoCitySchedCost_worng",
"signature": "def twoCitySchedCost_worng(self, costs)"
},
{
"docstring": ":type costs: List[List[int]] :rtype: int",
"name": "twoCitySchedCost",
"signature": "def twoCitySchedCost(self, costs)"
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoCitySchedCost_worng(self, costs): :type costs: List[List[int]] :rtype: int
- def twoCitySchedCost(self, costs): :type costs: List[List[int]] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoCitySchedCost_worng(self, costs): :type costs: List[List[int]] :rtype: int
- def twoCitySchedCost(self, costs): :type costs: List[List[int]] :rtype: int
<|skeleton|>
clas... | d8ed762d1005975f0de4f07760c9671195621c88 | <|skeleton|>
class Solution:
def twoCitySchedCost_worng(self, costs):
""":type costs: List[List[int]] :rtype: int"""
<|body_0|>
def twoCitySchedCost(self, costs):
""":type costs: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def twoCitySchedCost_worng(self, costs):
""":type costs: List[List[int]] :rtype: int"""
costs = sorted(costs, key=lambda x: x[0])
result = 0
while costs:
a = costs[0][0]
b = costs[1][1]
min_cost = costs[0][0] + costs[1][1]
... | the_stack_v2_python_sparse | two-city-scheduling/solution.py | uxlsl/leetcode_practice | train | 0 | |
7404a7b58c06514cc5aa293cb0e627371d43bff4 | [
"self._image = tfx_image\nself._k8s_core_api = kube_utils.make_core_v1_api()\nself._namespace = name_space\nself._container_name = container_name\nself._job_name = kube_utils.sanitize_pod_name(job_prefix + _generate_component_name_suffix())\nself.ttl_seconds = 5\nself._pod_name = None\nself._stream_pod_logs = strea... | <|body_start_0|>
self._image = tfx_image
self._k8s_core_api = kube_utils.make_core_v1_api()
self._namespace = name_space
self._container_name = container_name
self._job_name = kube_utils.sanitize_pod_name(job_prefix + _generate_component_name_suffix())
self.ttl_seconds = ... | A Kubernetes job runner that launches and executes pipeline components in kubernetes cluster. | KubernetesJobRunner | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KubernetesJobRunner:
"""A Kubernetes job runner that launches and executes pipeline components in kubernetes cluster."""
def __init__(self, tfx_image, job_prefix, container_name, name_space='default', stream_logs=False):
"""Create a kubernetes model server runner. Args: tfx_image: co... | stack_v2_sparse_classes_10k_train_006235 | 7,976 | permissive | [
{
"docstring": "Create a kubernetes model server runner. Args: tfx_image: container image for tfx. job_prefix: prefix for the job. Unique hash will follow as suffix. container_name: name of the container. name_space: namespace of the run. stream_logs: whether to stream logs from the pod.",
"name": "__init__... | 6 | null | Implement the Python class `KubernetesJobRunner` described below.
Class description:
A Kubernetes job runner that launches and executes pipeline components in kubernetes cluster.
Method signatures and docstrings:
- def __init__(self, tfx_image, job_prefix, container_name, name_space='default', stream_logs=False): Cre... | Implement the Python class `KubernetesJobRunner` described below.
Class description:
A Kubernetes job runner that launches and executes pipeline components in kubernetes cluster.
Method signatures and docstrings:
- def __init__(self, tfx_image, job_prefix, container_name, name_space='default', stream_logs=False): Cre... | 1b328504fa08a70388691e4072df76f143631325 | <|skeleton|>
class KubernetesJobRunner:
"""A Kubernetes job runner that launches and executes pipeline components in kubernetes cluster."""
def __init__(self, tfx_image, job_prefix, container_name, name_space='default', stream_logs=False):
"""Create a kubernetes model server runner. Args: tfx_image: co... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class KubernetesJobRunner:
"""A Kubernetes job runner that launches and executes pipeline components in kubernetes cluster."""
def __init__(self, tfx_image, job_prefix, container_name, name_space='default', stream_logs=False):
"""Create a kubernetes model server runner. Args: tfx_image: container image... | the_stack_v2_python_sparse | tfx/orchestration/experimental/centralized_kubernetes_orchestrator/kubernetes_job_runner.py | tensorflow/tfx | train | 2,116 |
0dc1be6032f6f025fb77db479f374b769baff274 | [
"if not string:\n ' Empty String '\n return False\nvalue_dict = {}\nfor ltr in string:\n try:\n value_dict[ltr]\n ' String has a recurring value '\n return False\n except KeyError as err:\n value_dict[ltr] = True\n' String is completely Unique '\nreturn True",
"if not strin... | <|body_start_0|>
if not string:
' Empty String '
return False
value_dict = {}
for ltr in string:
try:
value_dict[ltr]
' String has a recurring value '
return False
except KeyError as err:
... | Check for Unique Characters in a string | UniqueCharacters | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UniqueCharacters:
"""Check for Unique Characters in a string"""
def initial_attempt(cls, string):
"""Initial Attempt"""
<|body_0|>
def without_the_try_catch(cls, string):
"""Attempting the same method as above without the try/catch"""
<|body_1|>
def ... | stack_v2_sparse_classes_10k_train_006236 | 5,023 | no_license | [
{
"docstring": "Initial Attempt",
"name": "initial_attempt",
"signature": "def initial_attempt(cls, string)"
},
{
"docstring": "Attempting the same method as above without the try/catch",
"name": "without_the_try_catch",
"signature": "def without_the_try_catch(cls, string)"
},
{
... | 4 | stack_v2_sparse_classes_30k_train_006515 | Implement the Python class `UniqueCharacters` described below.
Class description:
Check for Unique Characters in a string
Method signatures and docstrings:
- def initial_attempt(cls, string): Initial Attempt
- def without_the_try_catch(cls, string): Attempting the same method as above without the try/catch
- def with... | Implement the Python class `UniqueCharacters` described below.
Class description:
Check for Unique Characters in a string
Method signatures and docstrings:
- def initial_attempt(cls, string): Initial Attempt
- def without_the_try_catch(cls, string): Attempting the same method as above without the try/catch
- def with... | 94a35dc3e25ee55530920fd57d7484d24d4abbfb | <|skeleton|>
class UniqueCharacters:
"""Check for Unique Characters in a string"""
def initial_attempt(cls, string):
"""Initial Attempt"""
<|body_0|>
def without_the_try_catch(cls, string):
"""Attempting the same method as above without the try/catch"""
<|body_1|>
def ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UniqueCharacters:
"""Check for Unique Characters in a string"""
def initial_attempt(cls, string):
"""Initial Attempt"""
if not string:
' Empty String '
return False
value_dict = {}
for ltr in string:
try:
value_dict[ltr]
... | the_stack_v2_python_sparse | src/strings/unique_string_characters.py | DanielHabib/practice_makes_perfect | train | 4 |
a6a6a6648111f73d25432ea79cb7956e909786e5 | [
"self._source = source\nself._time_provider = time_provider\nself._storage_engine = storage_engine",
"if inbox_task.archived:\n return\nasync with self._storage_engine.get_unit_of_work() as uow:\n inbox_task = inbox_task.mark_archived(self._source, self._time_provider.get_current_time())\n await uow.inbo... | <|body_start_0|>
self._source = source
self._time_provider = time_provider
self._storage_engine = storage_engine
<|end_body_0|>
<|body_start_1|>
if inbox_task.archived:
return
async with self._storage_engine.get_unit_of_work() as uow:
inbox_task = inbox_t... | Shared service for archiving an inbox task. | InboxTaskArchiveService | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InboxTaskArchiveService:
"""Shared service for archiving an inbox task."""
def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None:
"""Constructor."""
<|body_0|>
async def do_it(self, progress_reporter: ProgressRe... | stack_v2_sparse_classes_10k_train_006237 | 1,457 | permissive | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None"
},
{
"docstring": "Execute the service's action.",
"name": "do_it",
"signature": "async def do_it(self, prog... | 2 | null | Implement the Python class `InboxTaskArchiveService` described below.
Class description:
Shared service for archiving an inbox task.
Method signatures and docstrings:
- def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: Constructor.
- async def do_it(sel... | Implement the Python class `InboxTaskArchiveService` described below.
Class description:
Shared service for archiving an inbox task.
Method signatures and docstrings:
- def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: Constructor.
- async def do_it(sel... | 911ecd560142a9b4e57498f2b090f9469a0718a1 | <|skeleton|>
class InboxTaskArchiveService:
"""Shared service for archiving an inbox task."""
def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None:
"""Constructor."""
<|body_0|>
async def do_it(self, progress_reporter: ProgressRe... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class InboxTaskArchiveService:
"""Shared service for archiving an inbox task."""
def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None:
"""Constructor."""
self._source = source
self._time_provider = time_provider
self._... | the_stack_v2_python_sparse | src/core/jupiter/core/domain/inbox_tasks/service/archive_service.py | horia141/jupiter | train | 16 |
e21ac1dec0b76efa73ebc920a2f2defb57b2e574 | [
"super(FakeFileSystemBuilder, self).__init__()\nresolver_context = context.Context()\npath_spec = fake_path_spec.FakePathSpec(location='/')\nself.file_system = fake_file_system.FakeFileSystem(resolver_context, path_spec)",
"path_segments = self.file_system.SplitPath(path)\nfor segment_index in range(len(path_segm... | <|body_start_0|>
super(FakeFileSystemBuilder, self).__init__()
resolver_context = context.Context()
path_spec = fake_path_spec.FakePathSpec(location='/')
self.file_system = fake_file_system.FakeFileSystem(resolver_context, path_spec)
<|end_body_0|>
<|body_start_1|>
path_segments... | Builder object for fake file systems. Attributes: file_system (FakeFileSystem): fake file system. | FakeFileSystemBuilder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FakeFileSystemBuilder:
"""Builder object for fake file systems. Attributes: file_system (FakeFileSystem): fake file system."""
def __init__(self):
"""Initializes a fake file system builder."""
<|body_0|>
def _AddParentDirectories(self, path):
"""Adds the parent d... | stack_v2_sparse_classes_10k_train_006238 | 3,992 | permissive | [
{
"docstring": "Initializes a fake file system builder.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Adds the parent directories of a path to the fake file system. Args: path (str): path of the file within the fake file system. Raises: ValueError: if a parent direct... | 6 | stack_v2_sparse_classes_30k_train_004931 | Implement the Python class `FakeFileSystemBuilder` described below.
Class description:
Builder object for fake file systems. Attributes: file_system (FakeFileSystem): fake file system.
Method signatures and docstrings:
- def __init__(self): Initializes a fake file system builder.
- def _AddParentDirectories(self, pat... | Implement the Python class `FakeFileSystemBuilder` described below.
Class description:
Builder object for fake file systems. Attributes: file_system (FakeFileSystem): fake file system.
Method signatures and docstrings:
- def __init__(self): Initializes a fake file system builder.
- def _AddParentDirectories(self, pat... | 28756d910e951a22c5f0b2bcf5184f055a19d544 | <|skeleton|>
class FakeFileSystemBuilder:
"""Builder object for fake file systems. Attributes: file_system (FakeFileSystem): fake file system."""
def __init__(self):
"""Initializes a fake file system builder."""
<|body_0|>
def _AddParentDirectories(self, path):
"""Adds the parent d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FakeFileSystemBuilder:
"""Builder object for fake file systems. Attributes: file_system (FakeFileSystem): fake file system."""
def __init__(self):
"""Initializes a fake file system builder."""
super(FakeFileSystemBuilder, self).__init__()
resolver_context = context.Context()
... | the_stack_v2_python_sparse | dfvfs/helpers/fake_file_system_builder.py | log2timeline/dfvfs | train | 197 |
dcad37a8101e1054ceb0404e5dcec42041a1f2a3 | [
"BaseController.__init__(self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise)\nself.veh_id = veh_id\nself.k_d = k_d\nself.k_v = k_v\nself.k_c = k_c\nself.d_des = d_des\nself.v_des = v_des",
"lead_id = env.k.vehicle.get_leader(self.veh_id)\nif not lead_id:\n return self.max_ac... | <|body_start_0|>
BaseController.__init__(self, veh_id, car_following_params, delay=time_delay, fail_safe=fail_safe, noise=noise)
self.veh_id = veh_id
self.k_d = k_d
self.k_v = k_v
self.k_c = k_c
self.d_des = d_des
self.v_des = v_des
<|end_body_0|>
<|body_start_1|... | Bilateral car-following model controller. This model looks ahead and behind when computing its acceleration. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams see parent class k_d : float... | BCMController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BCMController:
"""Bilateral car-following model controller. This model looks ahead and behind when computing its acceleration. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFol... | stack_v2_sparse_classes_10k_train_006239 | 17,548 | permissive | [
{
"docstring": "Instantiate a Bilateral car-following model controller.",
"name": "__init__",
"signature": "def __init__(self, veh_id, car_following_params, k_d=1, k_v=1, k_c=1, d_des=1, v_des=8, time_delay=0.0, noise=0, fail_safe=None)"
},
{
"docstring": "See parent class. From the paper: There... | 2 | stack_v2_sparse_classes_30k_train_002967 | Implement the Python class `BCMController` described below.
Class description:
Bilateral car-following model controller. This model looks ahead and behind when computing its acceleration. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_followi... | Implement the Python class `BCMController` described below.
Class description:
Bilateral car-following model controller. This model looks ahead and behind when computing its acceleration. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_followi... | badac3da17f04d8d8ae5691ee8ba2af9d56fac35 | <|skeleton|>
class BCMController:
"""Bilateral car-following model controller. This model looks ahead and behind when computing its acceleration. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFol... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BCMController:
"""Bilateral car-following model controller. This model looks ahead and behind when computing its acceleration. Usage ----- See BaseController for usage example. Attributes ---------- veh_id : str Vehicle ID for SUMO identification car_following_params : flow.core.params.SumoCarFollowingParams ... | the_stack_v2_python_sparse | flow/controllers/car_following_models.py | parthjaggi/flow | train | 6 |
e79ae81fbcf6e5f48fbe109144fa7d95ac791bcc | [
"options = super().default_options()\noptions['eta'] = 100\noptions['nu'] = 1000.0\nreturn options",
"if len(self.betas) == 1:\n return\nnu = self.options['nu']\neta = self.options['eta']\nbetas = self.betas\nswapped = np.array([int(swap) for swap in swapped])\nkappa = nu / (i_sample + 1 + nu) / eta\nds = kapp... | <|body_start_0|>
options = super().default_options()
options['eta'] = 100
options['nu'] = 1000.0
return options
<|end_body_0|>
<|body_start_1|>
if len(self.betas) == 1:
return
nu = self.options['nu']
eta = self.options['eta']
betas = self.beta... | Parallel tempering sampler with adaptive temperature adaptation. | AdaptiveParallelTemperingSampler | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdaptiveParallelTemperingSampler:
"""Parallel tempering sampler with adaptive temperature adaptation."""
def default_options(cls) -> Dict:
"""Get default options for sampler."""
<|body_0|>
def adjust_betas(self, i_sample: int, swapped: Sequence[bool]):
"""Update ... | stack_v2_sparse_classes_10k_train_006240 | 1,378 | permissive | [
{
"docstring": "Get default options for sampler.",
"name": "default_options",
"signature": "def default_options(cls) -> Dict"
},
{
"docstring": "Update temperatures as in Vousden2016.",
"name": "adjust_betas",
"signature": "def adjust_betas(self, i_sample: int, swapped: Sequence[bool])"
... | 2 | stack_v2_sparse_classes_30k_train_001289 | Implement the Python class `AdaptiveParallelTemperingSampler` described below.
Class description:
Parallel tempering sampler with adaptive temperature adaptation.
Method signatures and docstrings:
- def default_options(cls) -> Dict: Get default options for sampler.
- def adjust_betas(self, i_sample: int, swapped: Seq... | Implement the Python class `AdaptiveParallelTemperingSampler` described below.
Class description:
Parallel tempering sampler with adaptive temperature adaptation.
Method signatures and docstrings:
- def default_options(cls) -> Dict: Get default options for sampler.
- def adjust_betas(self, i_sample: int, swapped: Seq... | 9a754573a7b77d30d5dc1f67a8dc1be6c29f1640 | <|skeleton|>
class AdaptiveParallelTemperingSampler:
"""Parallel tempering sampler with adaptive temperature adaptation."""
def default_options(cls) -> Dict:
"""Get default options for sampler."""
<|body_0|>
def adjust_betas(self, i_sample: int, swapped: Sequence[bool]):
"""Update ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AdaptiveParallelTemperingSampler:
"""Parallel tempering sampler with adaptive temperature adaptation."""
def default_options(cls) -> Dict:
"""Get default options for sampler."""
options = super().default_options()
options['eta'] = 100
options['nu'] = 1000.0
return ... | the_stack_v2_python_sparse | pypesto/sample/adaptive_parallel_tempering.py | ICB-DCM/pyPESTO | train | 174 |
eb4b47cb6f27ba9d8a6588ceda68177ad7208028 | [
"u = usermanage(self.driver)\nu.open_usermanage()\nself.assertEqual(u.verify(), True)\nu.delete()\nself.assertEqual(u.reason(), '请选择一条数据')\nfunction.screenshot(self.driver, 'user_unselect.jpg')",
"u = usermanage(self.driver)\nu.open_usermanage()\nself.assertEqual(u.verify(), True)\nu.multi_select()\nu.modify()\ns... | <|body_start_0|>
u = usermanage(self.driver)
u.open_usermanage()
self.assertEqual(u.verify(), True)
u.delete()
self.assertEqual(u.reason(), '请选择一条数据')
function.screenshot(self.driver, 'user_unselect.jpg')
<|end_body_0|>
<|body_start_1|>
u = usermanage(self.driver... | Test012_User_List_Error | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test012_User_List_Error:
def test_unselect(self):
"""不选择任何用户"""
<|body_0|>
def test_multiselect(self):
"""选择两个用户"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
u = usermanage(self.driver)
u.open_usermanage()
self.assertEqual(u.verif... | stack_v2_sparse_classes_10k_train_006241 | 910 | no_license | [
{
"docstring": "不选择任何用户",
"name": "test_unselect",
"signature": "def test_unselect(self)"
},
{
"docstring": "选择两个用户",
"name": "test_multiselect",
"signature": "def test_multiselect(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006673 | Implement the Python class `Test012_User_List_Error` described below.
Class description:
Implement the Test012_User_List_Error class.
Method signatures and docstrings:
- def test_unselect(self): 不选择任何用户
- def test_multiselect(self): 选择两个用户 | Implement the Python class `Test012_User_List_Error` described below.
Class description:
Implement the Test012_User_List_Error class.
Method signatures and docstrings:
- def test_unselect(self): 不选择任何用户
- def test_multiselect(self): 选择两个用户
<|skeleton|>
class Test012_User_List_Error:
def test_unselect(self):
... | 6f42c25249fc642cecc270578a180820988d45b5 | <|skeleton|>
class Test012_User_List_Error:
def test_unselect(self):
"""不选择任何用户"""
<|body_0|>
def test_multiselect(self):
"""选择两个用户"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Test012_User_List_Error:
def test_unselect(self):
"""不选择任何用户"""
u = usermanage(self.driver)
u.open_usermanage()
self.assertEqual(u.verify(), True)
u.delete()
self.assertEqual(u.reason(), '请选择一条数据')
function.screenshot(self.driver, 'user_unselect.jpg')
... | the_stack_v2_python_sparse | GlxssLive_web/TestCase/Manage_User/Test012_user_list_error.py | rrmiracle/GlxssLive | train | 0 | |
fb02d3d84fc24021136a445d340ab74ce2e0cb44 | [
"super(FFTConv, self).__init__()\nself.fftsize = FFTSize\nself.tilsize = TilSize\nself.krnsize = FFTSize - TilSize + 1\nself.ichnl = Wreal.shape[1]\nself.ochnl = Wreal.shape[0]\nself.binit = B\nself.k = K\nself.mode = Mode\nself.mask = np.zeros_like(Wreal, dtype=bool)\nprint(Wreal.shape)\nif opt.admm:\n self.wre... | <|body_start_0|>
super(FFTConv, self).__init__()
self.fftsize = FFTSize
self.tilsize = TilSize
self.krnsize = FFTSize - TilSize + 1
self.ichnl = Wreal.shape[1]
self.ochnl = Wreal.shape[0]
self.binit = B
self.k = K
self.mode = Mode
self.mask... | FFTConv | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FFTConv:
def __init__(self, FFTSize, TilSize, Wreal, Wimag, B, K, Mode='valid'):
"""FFTSize: FFT window size for kernel and input TilSize: Tile size when decomposing input W: Initial spatial weights [h,w,ichnl,ochnl] B: Initial spatial bias K: Keep K nonzeros values"""
<|body_0|>... | stack_v2_sparse_classes_10k_train_006242 | 7,874 | no_license | [
{
"docstring": "FFTSize: FFT window size for kernel and input TilSize: Tile size when decomposing input W: Initial spatial weights [h,w,ichnl,ochnl] B: Initial spatial bias K: Keep K nonzeros values",
"name": "__init__",
"signature": "def __init__(self, FFTSize, TilSize, Wreal, Wimag, B, K, Mode='valid'... | 4 | stack_v2_sparse_classes_30k_train_001230 | Implement the Python class `FFTConv` described below.
Class description:
Implement the FFTConv class.
Method signatures and docstrings:
- def __init__(self, FFTSize, TilSize, Wreal, Wimag, B, K, Mode='valid'): FFTSize: FFT window size for kernel and input TilSize: Tile size when decomposing input W: Initial spatial w... | Implement the Python class `FFTConv` described below.
Class description:
Implement the FFTConv class.
Method signatures and docstrings:
- def __init__(self, FFTSize, TilSize, Wreal, Wimag, B, K, Mode='valid'): FFTSize: FFT window size for kernel and input TilSize: Tile size when decomposing input W: Initial spatial w... | b7ea8e6108b73094c53a3100645f14f3985278b1 | <|skeleton|>
class FFTConv:
def __init__(self, FFTSize, TilSize, Wreal, Wimag, B, K, Mode='valid'):
"""FFTSize: FFT window size for kernel and input TilSize: Tile size when decomposing input W: Initial spatial weights [h,w,ichnl,ochnl] B: Initial spatial bias K: Keep K nonzeros values"""
<|body_0|>... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FFTConv:
def __init__(self, FFTSize, TilSize, Wreal, Wimag, B, K, Mode='valid'):
"""FFTSize: FFT window size for kernel and input TilSize: Tile size when decomposing input W: Initial spatial weights [h,w,ichnl,ochnl] B: Initial spatial bias K: Keep K nonzeros values"""
super(FFTConv, self).__i... | the_stack_v2_python_sparse | src/utils/fftConvLayer.py | yuehniu/CNN.frequencyPruning | train | 0 | |
9827027d6011841b373dcc555e813f9804a058c9 | [
"self.dict = dict()\nself.chars = []\nfor i in range(ord('a'), ord('z') + 1):\n self.chars.append(chr(i))",
"for word in dict:\n for charIndex in range(0, len(word)):\n for w in self.chars:\n if w != word[charIndex]:\n newStr = word[0:charIndex] + w + word[charIndex + 1:len(... | <|body_start_0|>
self.dict = dict()
self.chars = []
for i in range(ord('a'), ord('z') + 1):
self.chars.append(chr(i))
<|end_body_0|>
<|body_start_1|>
for word in dict:
for charIndex in range(0, len(word)):
for w in self.chars:
... | MagicDictionary | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MagicDictionary:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def buildDict(self, dict):
"""Build a dictionary through a list of words :type dict: List[str] :rtype: None"""
<|body_1|>
def search(self, word):
"""Return... | stack_v2_sparse_classes_10k_train_006243 | 1,381 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Build a dictionary through a list of words :type dict: List[str] :rtype: None",
"name": "buildDict",
"signature": "def buildDict(self, dict)"
},
{
"docs... | 3 | stack_v2_sparse_classes_30k_train_001732 | Implement the Python class `MagicDictionary` described below.
Class description:
Implement the MagicDictionary class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def buildDict(self, dict): Build a dictionary through a list of words :type dict: List[str] :rtype: None
... | Implement the Python class `MagicDictionary` described below.
Class description:
Implement the MagicDictionary class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def buildDict(self, dict): Build a dictionary through a list of words :type dict: List[str] :rtype: None
... | 56c9bfde870e2d682539e5bf223e0f32e411e610 | <|skeleton|>
class MagicDictionary:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def buildDict(self, dict):
"""Build a dictionary through a list of words :type dict: List[str] :rtype: None"""
<|body_1|>
def search(self, word):
"""Return... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MagicDictionary:
def __init__(self):
"""Initialize your data structure here."""
self.dict = dict()
self.chars = []
for i in range(ord('a'), ord('z') + 1):
self.chars.append(chr(i))
def buildDict(self, dict):
"""Build a dictionary through a list of words... | the_stack_v2_python_sparse | Tree/Implement Magic Dictionary.py | lulukdog/leetcode-Python | train | 3 | |
4d733c4aefc460de5b36fbc0fb046509e030af71 | [
"alloy_type_set = alloy_model.AlloyType.objects.only('id', 'type').filter(is_delete=False)\nalloy = alloy_model.Alloy.objects.only('id', 'name').filter(is_delete=False, id=alloy_id)\nif alloy:\n data = {'alloy_type_set': alloy_type_set, 'alloy': alloy}\n return render(request, 'admin/alloy/alloy_edit.html', c... | <|body_start_0|>
alloy_type_set = alloy_model.AlloyType.objects.only('id', 'type').filter(is_delete=False)
alloy = alloy_model.Alloy.objects.only('id', 'name').filter(is_delete=False, id=alloy_id)
if alloy:
data = {'alloy_type_set': alloy_type_set, 'alloy': alloy}
return ... | 合金修改 | AlloyEdit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlloyEdit:
"""合金修改"""
def get(self, request, alloy_id):
"""指定合金查询展示 :param request: :param alloy_id: :return:"""
<|body_0|>
def put(self, request, alloy_id):
"""指定合金修改 :param request: :param alloy_id: :return:"""
<|body_1|>
def delete(self, request, ... | stack_v2_sparse_classes_10k_train_006244 | 11,849 | no_license | [
{
"docstring": "指定合金查询展示 :param request: :param alloy_id: :return:",
"name": "get",
"signature": "def get(self, request, alloy_id)"
},
{
"docstring": "指定合金修改 :param request: :param alloy_id: :return:",
"name": "put",
"signature": "def put(self, request, alloy_id)"
},
{
"docstring... | 3 | stack_v2_sparse_classes_30k_train_002300 | Implement the Python class `AlloyEdit` described below.
Class description:
合金修改
Method signatures and docstrings:
- def get(self, request, alloy_id): 指定合金查询展示 :param request: :param alloy_id: :return:
- def put(self, request, alloy_id): 指定合金修改 :param request: :param alloy_id: :return:
- def delete(self, request, allo... | Implement the Python class `AlloyEdit` described below.
Class description:
合金修改
Method signatures and docstrings:
- def get(self, request, alloy_id): 指定合金查询展示 :param request: :param alloy_id: :return:
- def put(self, request, alloy_id): 指定合金修改 :param request: :param alloy_id: :return:
- def delete(self, request, allo... | 063332d2a5e2ddabf800817f02074b4f5c162ade | <|skeleton|>
class AlloyEdit:
"""合金修改"""
def get(self, request, alloy_id):
"""指定合金查询展示 :param request: :param alloy_id: :return:"""
<|body_0|>
def put(self, request, alloy_id):
"""指定合金修改 :param request: :param alloy_id: :return:"""
<|body_1|>
def delete(self, request, ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AlloyEdit:
"""合金修改"""
def get(self, request, alloy_id):
"""指定合金查询展示 :param request: :param alloy_id: :return:"""
alloy_type_set = alloy_model.AlloyType.objects.only('id', 'type').filter(is_delete=False)
alloy = alloy_model.Alloy.objects.only('id', 'name').filter(is_delete=False, i... | the_stack_v2_python_sparse | sfs/apps/alloy/views.py | Hx-someone/sfs-1 | train | 0 |
d2295f6d27c31e69bd8355a0bab9e16f7b9cadb3 | [
"preorder = []\n\ndef preOrder(node):\n if node:\n preorder.append(node.val)\n preOrder(node.left)\n preOrder(node.right)\npreOrder(root)\nreturn ' '.join(map(str, preorder))",
"deque = collections.deque((int(val) for val in data.split()))\n\ndef build(floor, ceiling):\n if deque and fl... | <|body_start_0|>
preorder = []
def preOrder(node):
if node:
preorder.append(node.val)
preOrder(node.left)
preOrder(node.right)
preOrder(root)
return ' '.join(map(str, preorder))
<|end_body_0|>
<|body_start_1|>
deque = ... | 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_10k_train_006245 | 1,954 | 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_005271 | 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:... | d1666d44226274f13af25cf878cd63a24e1c5528 | <|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_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
preorder = []
def preOrder(node):
if node:
preorder.append(node.val)
preOrder(node.left)
preOrder(node.right)
... | the_stack_v2_python_sparse | BinaryTree/LeetCode449_SerializeAndDeserializeBST.py | rexhzhang/LeetCodeProbelms | train | 0 | |
0c447ba4e6ed9b18da4726161099ed2380bf0f25 | [
"super(TailLatestFile, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner)\nself.directory = directory\nself.file_pattern = file_pattern\nself.ret_required = False\nself.time_for_failure = time_for_failure\nself._first_line_time = None\nself._check_failure_indication = T... | <|body_start_0|>
super(TailLatestFile, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner)
self.directory = directory
self.file_pattern = file_pattern
self.ret_required = False
self.time_for_failure = time_for_failure
self._fir... | TailLatestFile | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TailLatestFile:
def __init__(self, connection, directory, file_pattern='*', prompt=None, newline_chars=None, runner=None, time_for_failure=0.1):
"""Command for tail latest file from the directory. :param connection: Moler connection to device, terminal when command is executed. :param di... | stack_v2_sparse_classes_10k_train_006246 | 5,682 | permissive | [
{
"docstring": "Command for tail latest file from the directory. :param connection: Moler connection to device, terminal when command is executed. :param directory: path to directory to tail. :param file_pattern: pattern for files from directory. :param prompt: prompt (on system where command runs). :param newl... | 4 | null | Implement the Python class `TailLatestFile` described below.
Class description:
Implement the TailLatestFile class.
Method signatures and docstrings:
- def __init__(self, connection, directory, file_pattern='*', prompt=None, newline_chars=None, runner=None, time_for_failure=0.1): Command for tail latest file from the... | Implement the Python class `TailLatestFile` described below.
Class description:
Implement the TailLatestFile class.
Method signatures and docstrings:
- def __init__(self, connection, directory, file_pattern='*', prompt=None, newline_chars=None, runner=None, time_for_failure=0.1): Command for tail latest file from the... | 5a7bb06807b6e0124c77040367d0c20f42849a4c | <|skeleton|>
class TailLatestFile:
def __init__(self, connection, directory, file_pattern='*', prompt=None, newline_chars=None, runner=None, time_for_failure=0.1):
"""Command for tail latest file from the directory. :param connection: Moler connection to device, terminal when command is executed. :param di... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TailLatestFile:
def __init__(self, connection, directory, file_pattern='*', prompt=None, newline_chars=None, runner=None, time_for_failure=0.1):
"""Command for tail latest file from the directory. :param connection: Moler connection to device, terminal when command is executed. :param directory: path ... | the_stack_v2_python_sparse | moler/cmd/unix/tail_latest_file.py | nokia/moler | train | 60 | |
e5b99a7696dbf3dd7e541aae721b61621570f650 | [
"self.logger = logger\nself.grab_period = grab_period\nself.grab_limit = grab_limit\nself.file_index = 1\nself.call_index = 0\nimage_dirs = sorted(glob.glob('Images[0-9][0-9][0-9][0-9]'))\nif len(image_dirs) != 0:\n last_dir = image_dirs[-1]\n dir_index = int(last_dir[-4:]) + 1\nelse:\n dir_index = 1\nself... | <|body_start_0|>
self.logger = logger
self.grab_period = grab_period
self.grab_limit = grab_limit
self.file_index = 1
self.call_index = 0
image_dirs = sorted(glob.glob('Images[0-9][0-9][0-9][0-9]'))
if len(image_dirs) != 0:
last_dir = image_dirs[-1]
... | ImageGrabber | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageGrabber:
def __init__(self, logger, grab_period=5, grab_limit=100):
"""Create a image grabber that grabs an image every grab_period calls. Default is every 5th call. Usage: ig = ImageGrabber(logger, grab_period=5, grab_limit=50) while 1: ret, frame = cap.read() # get image, for exam... | stack_v2_sparse_classes_10k_train_006247 | 1,983 | no_license | [
{
"docstring": "Create a image grabber that grabs an image every grab_period calls. Default is every 5th call. Usage: ig = ImageGrabber(logger, grab_period=5, grab_limit=50) while 1: ret, frame = cap.read() # get image, for example process_image_to_extract_info(frame) if appropriate_to_grab: ig.grab(frame,log_m... | 2 | stack_v2_sparse_classes_30k_train_000631 | Implement the Python class `ImageGrabber` described below.
Class description:
Implement the ImageGrabber class.
Method signatures and docstrings:
- def __init__(self, logger, grab_period=5, grab_limit=100): Create a image grabber that grabs an image every grab_period calls. Default is every 5th call. Usage: ig = Imag... | Implement the Python class `ImageGrabber` described below.
Class description:
Implement the ImageGrabber class.
Method signatures and docstrings:
- def __init__(self, logger, grab_period=5, grab_limit=100): Create a image grabber that grabs an image every grab_period calls. Default is every 5th call. Usage: ig = Imag... | 6452a0b36b60ab79c2d113cbe9d68ea79e9e6ed2 | <|skeleton|>
class ImageGrabber:
def __init__(self, logger, grab_period=5, grab_limit=100):
"""Create a image grabber that grabs an image every grab_period calls. Default is every 5th call. Usage: ig = ImageGrabber(logger, grab_period=5, grab_limit=50) while 1: ret, frame = cap.read() # get image, for exam... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ImageGrabber:
def __init__(self, logger, grab_period=5, grab_limit=100):
"""Create a image grabber that grabs an image every grab_period calls. Default is every 5th call. Usage: ig = ImageGrabber(logger, grab_period=5, grab_limit=50) while 1: ret, frame = cap.read() # get image, for example process_im... | the_stack_v2_python_sparse | image_grabber.py | FRC1076/Vision_2016 | train | 0 | |
927b204d4c01368f82f4daa91f881857a877aaf8 | [
"self.testcase_paths = testcase_paths\nself.verbose = verbose\nif checker == None:\n self.checker = lambda *_: True\nelse:\n self.checker = checker",
"delete_q = []\nfor testcase in testcases:\n metadata_files = nh.get_metadata_files(testcase)\n delete_q += metadata_files.values()\n placeholder_f =... | <|body_start_0|>
self.testcase_paths = testcase_paths
self.verbose = verbose
if checker == None:
self.checker = lambda *_: True
else:
self.checker = checker
<|end_body_0|>
<|body_start_1|>
delete_q = []
for testcase in testcases:
metad... | @class DedupEngine @brief Performs deduplication on files | DedupEngine | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DedupEngine:
"""@class DedupEngine @brief Performs deduplication on files"""
def __init__(self, testcase_paths, verbose, checker=None):
"""@brief create a DedupEngine object @param testcase_path List of path pointing to testcases to deduplicate @param checker Function that maps a fil... | stack_v2_sparse_classes_10k_train_006248 | 2,774 | permissive | [
{
"docstring": "@brief create a DedupEngine object @param testcase_path List of path pointing to testcases to deduplicate @param checker Function that maps a filename to a boolean indicating if that case should be processed, default: None",
"name": "__init__",
"signature": "def __init__(self, testcase_p... | 3 | stack_v2_sparse_classes_30k_train_001884 | Implement the Python class `DedupEngine` described below.
Class description:
@class DedupEngine @brief Performs deduplication on files
Method signatures and docstrings:
- def __init__(self, testcase_paths, verbose, checker=None): @brief create a DedupEngine object @param testcase_path List of path pointing to testcas... | Implement the Python class `DedupEngine` described below.
Class description:
@class DedupEngine @brief Performs deduplication on files
Method signatures and docstrings:
- def __init__(self, testcase_paths, verbose, checker=None): @brief create a DedupEngine object @param testcase_path List of path pointing to testcas... | 4318d1daf2720a2164ca609ca35f7e33dd312e91 | <|skeleton|>
class DedupEngine:
"""@class DedupEngine @brief Performs deduplication on files"""
def __init__(self, testcase_paths, verbose, checker=None):
"""@brief create a DedupEngine object @param testcase_path List of path pointing to testcases to deduplicate @param checker Function that maps a fil... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DedupEngine:
"""@class DedupEngine @brief Performs deduplication on files"""
def __init__(self, testcase_paths, verbose, checker=None):
"""@brief create a DedupEngine object @param testcase_path List of path pointing to testcases to deduplicate @param checker Function that maps a filename to a bo... | the_stack_v2_python_sparse | src/pmfuzz/core/dedupengine.py | Brokenice0415/pmfuzz | train | 0 |
12dfd81185ad5202bb50bd8cc303b1e1ce06536b | [
"if len(self.max_heap) + len(self.min_heap) & 1 == 0:\n if len(self.min_heap) and self.min_heap[0] < num:\n num = heapq.heappushpop(self.min_heap, num)\n heapq.heappush(self.max_heap, -num)\nelse:\n if len(self.max_heap) and num < -self.max_heap[0]:\n num = -heapq.heappushpop(self.max_heap, -... | <|body_start_0|>
if len(self.max_heap) + len(self.min_heap) & 1 == 0:
if len(self.min_heap) and self.min_heap[0] < num:
num = heapq.heappushpop(self.min_heap, num)
heapq.heappush(self.max_heap, -num)
else:
if len(self.max_heap) and num < -self.max_heap... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def insert(self, num):
"""获取数据流"""
<|body_0|>
def getMedian(self):
"""获取数据流中的中位数"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(self.max_heap) + len(self.min_heap) & 1 == 0:
if len(self.min_heap) and self.min_heap[0] < ... | stack_v2_sparse_classes_10k_train_006249 | 1,466 | no_license | [
{
"docstring": "获取数据流",
"name": "insert",
"signature": "def insert(self, num)"
},
{
"docstring": "获取数据流中的中位数",
"name": "getMedian",
"signature": "def getMedian(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001356 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def insert(self, num): 获取数据流
- def getMedian(self): 获取数据流中的中位数 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def insert(self, num): 获取数据流
- def getMedian(self): 获取数据流中的中位数
<|skeleton|>
class Solution:
def insert(self, num):
"""获取数据流"""
<|body_0|>
def getMedian... | ef6aee94c7990d734271c204034ec273b665226d | <|skeleton|>
class Solution:
def insert(self, num):
"""获取数据流"""
<|body_0|>
def getMedian(self):
"""获取数据流中的中位数"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def insert(self, num):
"""获取数据流"""
if len(self.max_heap) + len(self.min_heap) & 1 == 0:
if len(self.min_heap) and self.min_heap[0] < num:
num = heapq.heappushpop(self.min_heap, num)
heapq.heappush(self.max_heap, -num)
else:
... | the_stack_v2_python_sparse | 剑指offer/数据流中的中位数.py | godzzbboss/leetcode | train | 0 | |
8d90034d6d33a59e63d90dc8c9216bc35554f17f | [
"self.commcell_object = commcell_object\nself._services = commcell_object._services\nself._cvpysdkcommcell_object = commcell_object._cvpysdk_object\nself.update_option = {}",
"if options is None:\n options = 'latest service pack'\nif DownloadOptions.LATEST_SERVICEPACK.value == options:\n self.update_option ... | <|body_start_0|>
self.commcell_object = commcell_object
self._services = commcell_object._services
self._cvpysdkcommcell_object = commcell_object._cvpysdk_object
self.update_option = {}
<|end_body_0|>
<|body_start_1|>
if options is None:
options = 'latest service pac... | "class for downloading software packages | Download | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Download:
""""class for downloading software packages"""
def __init__(self, commcell_object):
"""Initialize commcell_object of the Download class. Args: commcell_object (object) -- instance of the Commcell class Returns: object - instance of the Download class"""
<|body_0|>
... | stack_v2_sparse_classes_10k_train_006250 | 9,594 | permissive | [
{
"docstring": "Initialize commcell_object of the Download class. Args: commcell_object (object) -- instance of the Commcell class Returns: object - instance of the Download class",
"name": "__init__",
"signature": "def __init__(self, commcell_object)"
},
{
"docstring": "Downloads the os package... | 2 | stack_v2_sparse_classes_30k_train_003603 | Implement the Python class `Download` described below.
Class description:
"class for downloading software packages
Method signatures and docstrings:
- def __init__(self, commcell_object): Initialize commcell_object of the Download class. Args: commcell_object (object) -- instance of the Commcell class Returns: object... | Implement the Python class `Download` described below.
Class description:
"class for downloading software packages
Method signatures and docstrings:
- def __init__(self, commcell_object): Initialize commcell_object of the Download class. Args: commcell_object (object) -- instance of the Commcell class Returns: object... | 6aa0beb426a95de877cd531602234515723ccc94 | <|skeleton|>
class Download:
""""class for downloading software packages"""
def __init__(self, commcell_object):
"""Initialize commcell_object of the Download class. Args: commcell_object (object) -- instance of the Commcell class Returns: object - instance of the Download class"""
<|body_0|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Download:
""""class for downloading software packages"""
def __init__(self, commcell_object):
"""Initialize commcell_object of the Download class. Args: commcell_object (object) -- instance of the Commcell class Returns: object - instance of the Download class"""
self.commcell_object = co... | the_stack_v2_python_sparse | cvpysdk/deployment/download.py | jack1806/cvpysdk | train | 1 |
71eec22f52e5bcc839915d474b2404fb52ffe73c | [
"A = list(str(num))\nans = A[:]\nfor i in range(0, len(A)):\n for j in range(i + 1, len(A)):\n A[i], A[j] = (A[j], A[i])\n if A > ans:\n ans = A[:]\n A[i], A[j] = (A[j], A[i])\nreturn int(''.join(ans))",
"A = [int(d) for d in str(num)]\nlast = {x: i for i, x in enumerate(A)}\npr... | <|body_start_0|>
A = list(str(num))
ans = A[:]
for i in range(0, len(A)):
for j in range(i + 1, len(A)):
A[i], A[j] = (A[j], A[i])
if A > ans:
ans = A[:]
A[i], A[j] = (A[j], A[i])
return int(''.join(ans))
<|e... | solution | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""solution"""
def maximum_swap1(self, num):
"""Brute force approach. O(n^3)"""
<|body_0|>
def maximum_swap2(self, num):
"""Greedy approach to solving the problem"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
A = list(str(num))
... | stack_v2_sparse_classes_10k_train_006251 | 1,870 | no_license | [
{
"docstring": "Brute force approach. O(n^3)",
"name": "maximum_swap1",
"signature": "def maximum_swap1(self, num)"
},
{
"docstring": "Greedy approach to solving the problem",
"name": "maximum_swap2",
"signature": "def maximum_swap2(self, num)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001138 | Implement the Python class `Solution` described below.
Class description:
solution
Method signatures and docstrings:
- def maximum_swap1(self, num): Brute force approach. O(n^3)
- def maximum_swap2(self, num): Greedy approach to solving the problem | Implement the Python class `Solution` described below.
Class description:
solution
Method signatures and docstrings:
- def maximum_swap1(self, num): Brute force approach. O(n^3)
- def maximum_swap2(self, num): Greedy approach to solving the problem
<|skeleton|>
class Solution:
"""solution"""
def maximum_swa... | e319481834d0d0519d50bbf00e4f46374bbcf091 | <|skeleton|>
class Solution:
"""solution"""
def maximum_swap1(self, num):
"""Brute force approach. O(n^3)"""
<|body_0|>
def maximum_swap2(self, num):
"""Greedy approach to solving the problem"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
"""solution"""
def maximum_swap1(self, num):
"""Brute force approach. O(n^3)"""
A = list(str(num))
ans = A[:]
for i in range(0, len(A)):
for j in range(i + 1, len(A)):
A[i], A[j] = (A[j], A[i])
if A > ans:
... | the_stack_v2_python_sparse | maximum_swap670.py | raghavgr/Leetcode | train | 1 |
11eac46a5163108d34fa502e4f08e3fcf2d6550c | [
"self._sa_id_card = SAIDCard()\nself._sa_id_book = SAIDBook()\nself._sa_id_book_old = SAIDBookOld()\nself._up_card = UPStudentCard()",
"if id_type == 'idcard':\n return self._sa_id_card\nelif id_type == 'idbook':\n return self._sa_id_book\nelif id_type == 'idbookold':\n return self._sa_id_book_old\nelif ... | <|body_start_0|>
self._sa_id_card = SAIDCard()
self._sa_id_book = SAIDBook()
self._sa_id_book_old = SAIDBookOld()
self._up_card = UPStudentCard()
<|end_body_0|>
<|body_start_1|>
if id_type == 'idcard':
return self._sa_id_card
elif id_type == 'idbook':
... | A class responsible for managing and maintaining the various ID contexts. :_sa_id_card (SAIDCard): A South African ID card context. :_sa_id_book (SAIDBook): A South African ID book context. :_sa_id_book_old (SAIDBookOld): An old South African ID book context. :_up_card (UPStudentCard): A University of Pretoria staff/st... | ContextManager | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContextManager:
"""A class responsible for managing and maintaining the various ID contexts. :_sa_id_card (SAIDCard): A South African ID card context. :_sa_id_book (SAIDBook): A South African ID book context. :_sa_id_book_old (SAIDBookOld): An old South African ID book context. :_up_card (UPStude... | stack_v2_sparse_classes_10k_train_006252 | 2,120 | permissive | [
{
"docstring": "Responsible for initialising the ContextManager object.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Returns an ID context based on the ID type that is passed in as an arg. :param id_type (str): A string indicating a type of ID. Returns: - (IDContext... | 2 | stack_v2_sparse_classes_30k_train_004111 | Implement the Python class `ContextManager` described below.
Class description:
A class responsible for managing and maintaining the various ID contexts. :_sa_id_card (SAIDCard): A South African ID card context. :_sa_id_book (SAIDBook): A South African ID book context. :_sa_id_book_old (SAIDBookOld): An old South Afri... | Implement the Python class `ContextManager` described below.
Class description:
A class responsible for managing and maintaining the various ID contexts. :_sa_id_card (SAIDCard): A South African ID card context. :_sa_id_book (SAIDBook): A South African ID book context. :_sa_id_book_old (SAIDBookOld): An old South Afri... | d62917262080f09d7c9e7262f507e2c1482d7c56 | <|skeleton|>
class ContextManager:
"""A class responsible for managing and maintaining the various ID contexts. :_sa_id_card (SAIDCard): A South African ID card context. :_sa_id_book (SAIDBook): A South African ID book context. :_sa_id_book_old (SAIDBookOld): An old South African ID book context. :_up_card (UPStude... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ContextManager:
"""A class responsible for managing and maintaining the various ID contexts. :_sa_id_card (SAIDCard): A South African ID card context. :_sa_id_book (SAIDBook): A South African ID book context. :_sa_id_book_old (SAIDBookOld): An old South African ID book context. :_up_card (UPStudentCard): A Un... | the_stack_v2_python_sparse | src/main/python/hutts_verification/image_processing/context_manager.py | javaTheHutts/Java-the-Hutts | train | 2 |
938ce690330520ec7c5069c205f9e6ed3a2f9aac | [
"super(SparqlBasedDeductionEngineExtended, self).__init__()\nself.relation = relation\nself.query_executer = kg_query_interface\nself.quality = quality\nself.quality_aggregation = quality_aggregation\nself.labels_indexer = Indexer(store=kg_query_interface.type, endpoint=kg_query_interface.endpoint, graph=kg_query_i... | <|body_start_0|>
super(SparqlBasedDeductionEngineExtended, self).__init__()
self.relation = relation
self.query_executer = kg_query_interface
self.quality = quality
self.quality_aggregation = quality_aggregation
self.labels_indexer = Indexer(store=kg_query_interface.type,... | Deduction engine that converts the rules to sparql and fire them over the KG. The rule-based_deduction takes care of consolidating similar predictions | SparqlBasedDeductionEngineExtended | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SparqlBasedDeductionEngineExtended:
"""Deduction engine that converts the rules to sparql and fire them over the KG. The rule-based_deduction takes care of consolidating similar predictions"""
def __init__(self, kg_query_interface: KGQueryInterfaceExtended, relation=DEFUALT_AUX_RELATION, qua... | stack_v2_sparse_classes_10k_train_006253 | 10,782 | permissive | [
{
"docstring": ":param kg_query_interface: interface for the KG. :param relation: the relation used in the predicted triple (optional) :param quality: objective quality measure for ranking the predictions (optional) by default the exclusive coverage of the rules is used :param quality_aggregation: the methd use... | 5 | stack_v2_sparse_classes_30k_train_000054 | Implement the Python class `SparqlBasedDeductionEngineExtended` described below.
Class description:
Deduction engine that converts the rules to sparql and fire them over the KG. The rule-based_deduction takes care of consolidating similar predictions
Method signatures and docstrings:
- def __init__(self, kg_query_int... | Implement the Python class `SparqlBasedDeductionEngineExtended` described below.
Class description:
Deduction engine that converts the rules to sparql and fire them over the KG. The rule-based_deduction takes care of consolidating similar predictions
Method signatures and docstrings:
- def __init__(self, kg_query_int... | 09e943a23207381de3c3a9e6f70015882b8ec4af | <|skeleton|>
class SparqlBasedDeductionEngineExtended:
"""Deduction engine that converts the rules to sparql and fire them over the KG. The rule-based_deduction takes care of consolidating similar predictions"""
def __init__(self, kg_query_interface: KGQueryInterfaceExtended, relation=DEFUALT_AUX_RELATION, qua... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SparqlBasedDeductionEngineExtended:
"""Deduction engine that converts the rules to sparql and fire them over the KG. The rule-based_deduction takes care of consolidating similar predictions"""
def __init__(self, kg_query_interface: KGQueryInterfaceExtended, relation=DEFUALT_AUX_RELATION, quality='x_cover... | the_stack_v2_python_sparse | excut/feedback/rulebased_deduction/deduction_engine_extended.py | mhmgad/ExCut | train | 9 |
fa04ed7fbb2fb0e85bc1c75c7eaa2fefd467603b | [
"import math\nlow = 1\nhigh = 1000000000\nwhile low < high:\n mid = (low + high) // 2\n time = 0\n for each in piles:\n time += math.ceil(each / mid)\n if time <= H:\n high = mid\n else:\n low = mid + 1\nreturn low",
"from math import ceil\nmini_speed = ceil(sum(piles) / H)\nwh... | <|body_start_0|>
import math
low = 1
high = 1000000000
while low < high:
mid = (low + high) // 2
time = 0
for each in piles:
time += math.ceil(each / mid)
if time <= H:
high = mid
else:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minEatingSpeed(self, piles, H):
""":type piles: List[int] :type H: int :rtype: int"""
<|body_0|>
def minEatingSpeed2(self, piles, H):
""":type piles: List[int] :type H: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
im... | stack_v2_sparse_classes_10k_train_006254 | 1,006 | no_license | [
{
"docstring": ":type piles: List[int] :type H: int :rtype: int",
"name": "minEatingSpeed",
"signature": "def minEatingSpeed(self, piles, H)"
},
{
"docstring": ":type piles: List[int] :type H: int :rtype: int",
"name": "minEatingSpeed2",
"signature": "def minEatingSpeed2(self, piles, H)"... | 2 | stack_v2_sparse_classes_30k_train_006927 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minEatingSpeed(self, piles, H): :type piles: List[int] :type H: int :rtype: int
- def minEatingSpeed2(self, piles, H): :type piles: List[int] :type H: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minEatingSpeed(self, piles, H): :type piles: List[int] :type H: int :rtype: int
- def minEatingSpeed2(self, piles, H): :type piles: List[int] :type H: int :rtype: int
<|skel... | 4105e18050b15fc0409c75353ad31be17187dd34 | <|skeleton|>
class Solution:
def minEatingSpeed(self, piles, H):
""":type piles: List[int] :type H: int :rtype: int"""
<|body_0|>
def minEatingSpeed2(self, piles, H):
""":type piles: List[int] :type H: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def minEatingSpeed(self, piles, H):
""":type piles: List[int] :type H: int :rtype: int"""
import math
low = 1
high = 1000000000
while low < high:
mid = (low + high) // 2
time = 0
for each in piles:
time += ma... | the_stack_v2_python_sparse | minEatingSpeed.py | NeilWangziyu/Leetcode_py | train | 2 | |
c080cdf86e43b13bc5852d13a061e33a6e7b2e73 | [
"_check_data_dim(data, dim=2)\nx = data[:, 0]\ny = data[:, 1]\nA = np.zeros((3, data.shape[0]), dtype=np.double)\nA[2, :] = -1\n\ndef dist(xc, yc):\n return np.sqrt((x - xc) ** 2 + (y - yc) ** 2)\n\ndef fun(params):\n xc, yc, r = params\n return dist(xc, yc) - r\n\ndef Dfun(params):\n xc, yc, r = params... | <|body_start_0|>
_check_data_dim(data, dim=2)
x = data[:, 0]
y = data[:, 1]
A = np.zeros((3, data.shape[0]), dtype=np.double)
A[2, :] = -1
def dist(xc, yc):
return np.sqrt((x - xc) ** 2 + (y - yc) ** 2)
def fun(params):
xc, yc, r = params... | Total least squares estimator for 2D circles. The functional model of the circle is:: r**2 = (x - xc)**2 + (y - yc)**2 This estimator minimizes the squared distances from all points to the circle:: min{ sum((r - sqrt((x_i - xc)**2 + (y_i - yc)**2))**2) } A minimum number of 3 points is required to solve for the paramet... | CircleModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CircleModel:
"""Total least squares estimator for 2D circles. The functional model of the circle is:: r**2 = (x - xc)**2 + (y - yc)**2 This estimator minimizes the squared distances from all points to the circle:: min{ sum((r - sqrt((x_i - xc)**2 + (y_i - yc)**2))**2) } A minimum number of 3 poin... | stack_v2_sparse_classes_10k_train_006255 | 28,119 | permissive | [
{
"docstring": "Estimate circle model from data using total least squares. Parameters ---------- data : (N, 2) array N points with ``(x, y)`` coordinates, respectively. Returns ------- success : bool True, if model estimation succeeds.",
"name": "estimate",
"signature": "def estimate(self, data)"
},
... | 3 | null | Implement the Python class `CircleModel` described below.
Class description:
Total least squares estimator for 2D circles. The functional model of the circle is:: r**2 = (x - xc)**2 + (y - yc)**2 This estimator minimizes the squared distances from all points to the circle:: min{ sum((r - sqrt((x_i - xc)**2 + (y_i - yc... | Implement the Python class `CircleModel` described below.
Class description:
Total least squares estimator for 2D circles. The functional model of the circle is:: r**2 = (x - xc)**2 + (y - yc)**2 This estimator minimizes the squared distances from all points to the circle:: min{ sum((r - sqrt((x_i - xc)**2 + (y_i - yc... | cabf6e4f1970dc14302f87414f170de19944bac2 | <|skeleton|>
class CircleModel:
"""Total least squares estimator for 2D circles. The functional model of the circle is:: r**2 = (x - xc)**2 + (y - yc)**2 This estimator minimizes the squared distances from all points to the circle:: min{ sum((r - sqrt((x_i - xc)**2 + (y_i - yc)**2))**2) } A minimum number of 3 poin... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CircleModel:
"""Total least squares estimator for 2D circles. The functional model of the circle is:: r**2 = (x - xc)**2 + (y - yc)**2 This estimator minimizes the squared distances from all points to the circle:: min{ sum((r - sqrt((x_i - xc)**2 + (y_i - yc)**2))**2) } A minimum number of 3 points is require... | the_stack_v2_python_sparse | Skimage_numpy/source/skimage/measure/fit.py | ryfeus/lambda-packs | train | 1,283 |
b8f7b6633430512ff60337ce3a4275c3d76f5ddd | [
"nums.sort()\nprint(nums)\nprint(nums[len(nums) - k])\nreturn nums[len(nums) - k]",
"pivot = nums[0]\nleft = [l for l in nums if l < pivot]\nequal = [e for e in nums if e == pivot]\nright = [r for r in nums if r > pivot]\nif k <= len(right):\n return self.findKthLargest2(right, k)\nelif k - len(right) <= len(e... | <|body_start_0|>
nums.sort()
print(nums)
print(nums[len(nums) - k])
return nums[len(nums) - k]
<|end_body_0|>
<|body_start_1|>
pivot = nums[0]
left = [l for l in nums if l < pivot]
equal = [e for e in nums if e == pivot]
right = [r for r in nums if r > pi... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findKthLargest(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def findKthLargest2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
nums.s... | stack_v2_sparse_classes_10k_train_006256 | 780 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "findKthLargest",
"signature": "def findKthLargest(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "findKthLargest2",
"signature": "def findKthLargest2(self, nums, k)"
}... | 2 | stack_v2_sparse_classes_30k_train_003988 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findKthLargest(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def findKthLargest2(self, nums, k): :type nums: List[int] :type k: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findKthLargest(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def findKthLargest2(self, nums, k): :type nums: List[int] :type k: int :rtype: int
<|skeleton... | eb5f6488c875c107743f84a44cbbf55ff7ed3296 | <|skeleton|>
class Solution:
def findKthLargest(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def findKthLargest2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def findKthLargest(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
nums.sort()
print(nums)
print(nums[len(nums) - k])
return nums[len(nums) - k]
def findKthLargest2(self, nums, k):
""":type nums: List[int] :type k: int :rtype:... | the_stack_v2_python_sparse | 215__Kth Largest Element.py | chengcheng8632/lovely-nuts | train | 0 | |
76c4c118604dbe89e244db1163048a31835fd479 | [
"import clipboard\nsett = clipboard.paste()\nmeta = analyse(sett)\nlines = []\nlines.append(gen_constructor(meta))\nlines.append(gen_overrides(meta))\nlines.append(gen_as_map(meta))\ncnt = '\\n\\n'.join(lines)\nprint('---------------------- ✁')\nprint(cnt)\nclipboard.copy(cnt)\nprint('done.')",
"import clipboard\... | <|body_start_0|>
import clipboard
sett = clipboard.paste()
meta = analyse(sett)
lines = []
lines.append(gen_constructor(meta))
lines.append(gen_overrides(meta))
lines.append(gen_as_map(meta))
cnt = '\n\n'.join(lines)
print('---------------------- ✁... | GenTool | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GenTool:
def gen_model_cls(self):
"""Code format: ``` class Schedule extends Equatable { DateTime fromDate= DateTime.now(); TimeOfDay fromTime = const TimeOfDay(hour: 7, minute: 28); DateTime toDate = DateTime.now(); TimeOfDay toTime = const TimeOfDay(hour: 7, minute: 28); // final List<... | stack_v2_sparse_classes_10k_train_006257 | 8,411 | permissive | [
{
"docstring": "Code format: ``` class Schedule extends Equatable { DateTime fromDate= DateTime.now(); TimeOfDay fromTime = const TimeOfDay(hour: 7, minute: 28); DateTime toDate = DateTime.now(); TimeOfDay toTime = const TimeOfDay(hour: 7, minute: 28); // final List<String> allActivities = <String>['hiking', 's... | 2 | null | Implement the Python class `GenTool` described below.
Class description:
Implement the GenTool class.
Method signatures and docstrings:
- def gen_model_cls(self): Code format: ``` class Schedule extends Equatable { DateTime fromDate= DateTime.now(); TimeOfDay fromTime = const TimeOfDay(hour: 7, minute: 28); DateTime ... | Implement the Python class `GenTool` described below.
Class description:
Implement the GenTool class.
Method signatures and docstrings:
- def gen_model_cls(self): Code format: ``` class Schedule extends Equatable { DateTime fromDate= DateTime.now(); TimeOfDay fromTime = const TimeOfDay(hour: 7, minute: 28); DateTime ... | 9958d18ee5e75cf9794f546c904097dc1ff4f3a0 | <|skeleton|>
class GenTool:
def gen_model_cls(self):
"""Code format: ``` class Schedule extends Equatable { DateTime fromDate= DateTime.now(); TimeOfDay fromTime = const TimeOfDay(hour: 7, minute: 28); DateTime toDate = DateTime.now(); TimeOfDay toTime = const TimeOfDay(hour: 7, minute: 28); // final List<... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GenTool:
def gen_model_cls(self):
"""Code format: ``` class Schedule extends Equatable { DateTime fromDate= DateTime.now(); TimeOfDay fromTime = const TimeOfDay(hour: 7, minute: 28); DateTime toDate = DateTime.now(); TimeOfDay toTime = const TimeOfDay(hour: 7, minute: 28); // final List<String> allAct... | the_stack_v2_python_sparse | sagas/ofbiz/gen_tool.py | samlet/stack | train | 3 | |
e0129420310964cd2fbd38f1bf74f957e3458b55 | [
"hashmap = {}\nfor idx, num in enumerate(nums):\n rest = target - num\n if rest in hashmap:\n return [idx, hashmap[rest]]\n hashmap[num] = idx",
"sorted_num = sorted(((num, idx) for idx, num in enumerate(nums)))\nleft, right = (0, len(nums) - 1)\nwhile left < right:\n two_sum = sorted_num[left]... | <|body_start_0|>
hashmap = {}
for idx, num in enumerate(nums):
rest = target - num
if rest in hashmap:
return [idx, hashmap[rest]]
hashmap[num] = idx
<|end_body_0|>
<|body_start_1|>
sorted_num = sorted(((num, idx) for idx, num in enumerate(num... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
"""哈希表"""
<|body_0|>
def twoSumSorted(self, nums: List[int], target: int) -> List[int]:
"""排序 + 双指针"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
hashmap = {}
for idx, ... | stack_v2_sparse_classes_10k_train_006258 | 1,647 | no_license | [
{
"docstring": "哈希表",
"name": "twoSum",
"signature": "def twoSum(self, nums: List[int], target: int) -> List[int]"
},
{
"docstring": "排序 + 双指针",
"name": "twoSumSorted",
"signature": "def twoSumSorted(self, nums: List[int], target: int) -> List[int]"
}
] | 2 | stack_v2_sparse_classes_30k_train_002890 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums: List[int], target: int) -> List[int]: 哈希表
- def twoSumSorted(self, nums: List[int], target: int) -> List[int]: 排序 + 双指针 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums: List[int], target: int) -> List[int]: 哈希表
- def twoSumSorted(self, nums: List[int], target: int) -> List[int]: 排序 + 双指针
<|skeleton|>
class Solution:
... | 52756b30e9d51794591aca030bc918e707f473f1 | <|skeleton|>
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
"""哈希表"""
<|body_0|>
def twoSumSorted(self, nums: List[int], target: int) -> List[int]:
"""排序 + 双指针"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
"""哈希表"""
hashmap = {}
for idx, num in enumerate(nums):
rest = target - num
if rest in hashmap:
return [idx, hashmap[rest]]
hashmap[num] = idx
def twoSumSorte... | the_stack_v2_python_sparse | 1.两数之和/solution.py | QtTao/daily_leetcode | train | 0 | |
7c8441d86da1cf129006a3190c237b99dd5a6af8 | [
"super(WeaveModel, self).__init__()\nself.update_pair = update_pair\nlayers = create_weave_layers(weave_args, update_pair)\nif weave_gath_arg:\n if weave_type.lower() == '1d':\n weave_gath = WeaveGather(*weave_gath_arg.args)\n else:\n weave_gath = WeaveGather2D(*weave_gath_arg, batch_first=batch... | <|body_start_0|>
super(WeaveModel, self).__init__()
self.update_pair = update_pair
layers = create_weave_layers(weave_args, update_pair)
if weave_gath_arg:
if weave_type.lower() == '1d':
weave_gath = WeaveGather(*weave_gath_arg.args)
else:
... | WeaveModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WeaveModel:
def __init__(self, weave_args, weave_gath_arg, update_pair=False, weave_type='1D', batch_first=False):
"""Creates a weave model :param weave_args: A list of weave arguments. :param weave_gath_arg: A weave gather argument. :param update_pair: Whether to return the pair-wise em... | stack_v2_sparse_classes_10k_train_006259 | 27,873 | permissive | [
{
"docstring": "Creates a weave model :param weave_args: A list of weave arguments. :param weave_gath_arg: A weave gather argument. :param update_pair: Whether to return the pair-wise embeddings.",
"name": "__init__",
"signature": "def __init__(self, weave_args, weave_gath_arg, update_pair=False, weave_... | 2 | stack_v2_sparse_classes_30k_train_003324 | Implement the Python class `WeaveModel` described below.
Class description:
Implement the WeaveModel class.
Method signatures and docstrings:
- def __init__(self, weave_args, weave_gath_arg, update_pair=False, weave_type='1D', batch_first=False): Creates a weave model :param weave_args: A list of weave arguments. :pa... | Implement the Python class `WeaveModel` described below.
Class description:
Implement the WeaveModel class.
Method signatures and docstrings:
- def __init__(self, weave_args, weave_gath_arg, update_pair=False, weave_type='1D', batch_first=False): Creates a weave model :param weave_args: A list of weave arguments. :pa... | f1ddd11fd769c782c354425967c3cc326b9adf69 | <|skeleton|>
class WeaveModel:
def __init__(self, weave_args, weave_gath_arg, update_pair=False, weave_type='1D', batch_first=False):
"""Creates a weave model :param weave_args: A list of weave arguments. :param weave_gath_arg: A weave gather argument. :param update_pair: Whether to return the pair-wise em... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class WeaveModel:
def __init__(self, weave_args, weave_gath_arg, update_pair=False, weave_type='1D', batch_first=False):
"""Creates a weave model :param weave_args: A list of weave arguments. :param weave_gath_arg: A weave gather argument. :param update_pair: Whether to return the pair-wise embeddings."""
... | the_stack_v2_python_sparse | jova/nn/models.py | bbrighttaer/jova_baselines | train | 2 | |
3dd0d8edb17023d24740181a00f06d6ec22ff317 | [
"visit_func = getattr(self, f'visit_{type(node).__name__}', None)\nif visit_func is not None:\n retval = visit_func(node)\nelse:\n retval = True\nreturn False if retval is False else True",
"leave_func = getattr(self, f'leave_{type(original_node).__name__}', None)\nif leave_func is not None:\n leave_func... | <|body_start_0|>
visit_func = getattr(self, f'visit_{type(node).__name__}', None)
if visit_func is not None:
retval = visit_func(node)
else:
retval = True
return False if retval is False else True
<|end_body_0|>
<|body_start_1|>
leave_func = getattr(self,... | The low-level base visitor class for traversing a CST. This should be used in conjunction with the :func:`~libcst.CSTNode.visit` method on a :class:`~libcst.CSTNode` to visit each element in a tree starting with that node. Unlike :class:`CSTTransformer`, instances of this class cannot modify the tree. When visiting nod... | CSTVisitor | [
"Python-2.0",
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CSTVisitor:
"""The low-level base visitor class for traversing a CST. This should be used in conjunction with the :func:`~libcst.CSTNode.visit` method on a :class:`~libcst.CSTNode` to visit each element in a tree starting with that node. Unlike :class:`CSTTransformer`, instances of this class can... | stack_v2_sparse_classes_10k_train_006260 | 6,835 | permissive | [
{
"docstring": "Called every time a node is visited, before we've visited its children. Returns ``True`` if children should be visited, and returns ``False`` otherwise.",
"name": "on_visit",
"signature": "def on_visit(self, node: 'CSTNode') -> bool"
},
{
"docstring": "Called every time we leave ... | 4 | stack_v2_sparse_classes_30k_train_004230 | Implement the Python class `CSTVisitor` described below.
Class description:
The low-level base visitor class for traversing a CST. This should be used in conjunction with the :func:`~libcst.CSTNode.visit` method on a :class:`~libcst.CSTNode` to visit each element in a tree starting with that node. Unlike :class:`CSTTr... | Implement the Python class `CSTVisitor` described below.
Class description:
The low-level base visitor class for traversing a CST. This should be used in conjunction with the :func:`~libcst.CSTNode.visit` method on a :class:`~libcst.CSTNode` to visit each element in a tree starting with that node. Unlike :class:`CSTTr... | 9286446f889f1778b8f11451a68107052b2930b3 | <|skeleton|>
class CSTVisitor:
"""The low-level base visitor class for traversing a CST. This should be used in conjunction with the :func:`~libcst.CSTNode.visit` method on a :class:`~libcst.CSTNode` to visit each element in a tree starting with that node. Unlike :class:`CSTTransformer`, instances of this class can... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CSTVisitor:
"""The low-level base visitor class for traversing a CST. This should be used in conjunction with the :func:`~libcst.CSTNode.visit` method on a :class:`~libcst.CSTNode` to visit each element in a tree starting with that node. Unlike :class:`CSTTransformer`, instances of this class cannot modify th... | the_stack_v2_python_sparse | libcst/_visitors.py | Instagram/LibCST | train | 1,300 |
ac5b3484ebbde711f9664e8f3e1d80107aab542f | [
"lock_time = utils.milliseconds_now()\nwith session.begin_transaction() as tx:\n instance = cls.find_transaction(tx, uuid)\n if instance is None:\n instance = cls(uuid=uuid, account_number=account_number, name=name, locked=lock_time)\n instance._update(tx, lock_time)\n elif instance.locked ==... | <|body_start_0|>
lock_time = utils.milliseconds_now()
with session.begin_transaction() as tx:
instance = cls.find_transaction(tx, uuid)
if instance is None:
instance = cls(uuid=uuid, account_number=account_number, name=name, locked=lock_time)
insta... | Model an environment lock in the graph. A lock on an environment exists if the locked property for an environmentlock node is not null. | EnvironmentLockEntity | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EnvironmentLockEntity:
"""Model an environment lock in the graph. A lock on an environment exists if the locked property for an environmentlock node is not null."""
def lock(cls, session, uuid, account_number, name):
"""Locks an environment with matching uuid. Lock is obtained in a s... | stack_v2_sparse_classes_10k_train_006261 | 3,581 | permissive | [
{
"docstring": "Locks an environment with matching uuid. Lock is obtained in a single transaction. :param session: neo4j driver session :type session: neo4j.v1.session.BoltSession :param uuid: Environment uuid. :type uuid: str :param account_number: Account number :type account_number: str :param name: Name of ... | 2 | stack_v2_sparse_classes_30k_train_001825 | Implement the Python class `EnvironmentLockEntity` described below.
Class description:
Model an environment lock in the graph. A lock on an environment exists if the locked property for an environmentlock node is not null.
Method signatures and docstrings:
- def lock(cls, session, uuid, account_number, name): Locks a... | Implement the Python class `EnvironmentLockEntity` described below.
Class description:
Model an environment lock in the graph. A lock on an environment exists if the locked property for an environmentlock node is not null.
Method signatures and docstrings:
- def lock(cls, session, uuid, account_number, name): Locks a... | aaab76706c8268d3ff3e87c275baee9dd4714314 | <|skeleton|>
class EnvironmentLockEntity:
"""Model an environment lock in the graph. A lock on an environment exists if the locked property for an environmentlock node is not null."""
def lock(cls, session, uuid, account_number, name):
"""Locks an environment with matching uuid. Lock is obtained in a s... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EnvironmentLockEntity:
"""Model an environment lock in the graph. A lock on an environment exists if the locked property for an environmentlock node is not null."""
def lock(cls, session, uuid, account_number, name):
"""Locks an environment with matching uuid. Lock is obtained in a single transac... | the_stack_v2_python_sparse | cloud_snitch/models/environmentlock.py | rcbops/FleetDeploymentReporting | train | 1 |
8d8b7fbf533b6c6f41137c1a03cbf289b5f6481c | [
"if len(ransomNote) > len(magazine):\n return False\nm1 = [0] * 26\nm2 = [0] * 26\nfor c in ransomNote:\n m1[ord(c) - 97] += 1\nfor c in magazine:\n m2[ord(c) - 97] += 1\nprint(m1)\nprint(m2)\nfor i in range(26):\n if m1[i] != 0 and m1[i] > m2[i]:\n return False\nreturn True",
"if len(ransomNot... | <|body_start_0|>
if len(ransomNote) > len(magazine):
return False
m1 = [0] * 26
m2 = [0] * 26
for c in ransomNote:
m1[ord(c) - 97] += 1
for c in magazine:
m2[ord(c) - 97] += 1
print(m1)
print(m2)
for i in range(26):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canConstruct1(self, ransomNote, magazine):
""":type ransomNote: str :type magazine: str :rtype: bool"""
<|body_0|>
def canConstruct(self, ransomNote, magazine):
""":type ransomNote: str :type magazine: str :rtype: bool"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_10k_train_006262 | 1,185 | no_license | [
{
"docstring": ":type ransomNote: str :type magazine: str :rtype: bool",
"name": "canConstruct1",
"signature": "def canConstruct1(self, ransomNote, magazine)"
},
{
"docstring": ":type ransomNote: str :type magazine: str :rtype: bool",
"name": "canConstruct",
"signature": "def canConstruc... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canConstruct1(self, ransomNote, magazine): :type ransomNote: str :type magazine: str :rtype: bool
- def canConstruct(self, ransomNote, magazine): :type ransomNote: str :type ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canConstruct1(self, ransomNote, magazine): :type ransomNote: str :type magazine: str :rtype: bool
- def canConstruct(self, ransomNote, magazine): :type ransomNote: str :type ... | 70bdd75b6af2e1811c1beab22050c01d28d7373e | <|skeleton|>
class Solution:
def canConstruct1(self, ransomNote, magazine):
""":type ransomNote: str :type magazine: str :rtype: bool"""
<|body_0|>
def canConstruct(self, ransomNote, magazine):
""":type ransomNote: str :type magazine: str :rtype: bool"""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def canConstruct1(self, ransomNote, magazine):
""":type ransomNote: str :type magazine: str :rtype: bool"""
if len(ransomNote) > len(magazine):
return False
m1 = [0] * 26
m2 = [0] * 26
for c in ransomNote:
m1[ord(c) - 97] += 1
f... | the_stack_v2_python_sparse | python/leetcode_bak/383_Ransom_Note.py | bobcaoge/my-code | train | 0 | |
423fc8ed9a661f05ac89e88953c37e34b867b3de | [
"color_generator = getsvgcolors()\nwork_list = load_work()\ngoals = set()\nfor work in work_list:\n if work.category not in ('snowball',):\n continue\n if not hasattr(work, '_meta'):\n continue\n goal = str(work._meta[0]['goal'])\n goals.add(goal)\nfor goal in sorted(goals):\n color, te... | <|body_start_0|>
color_generator = getsvgcolors()
work_list = load_work()
goals = set()
for work in work_list:
if work.category not in ('snowball',):
continue
if not hasattr(work, '_meta'):
continue
goal = str(work._meta... | GoalGraph | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GoalGraph:
def create_widgets(self):
"""Creates custom categories"""
<|body_0|>
def work_key(self, work):
"""Returns work goal"""
<|body_1|>
def filter_work(self, work):
"""Filters work"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_006263 | 8,363 | no_license | [
{
"docstring": "Creates custom categories",
"name": "create_widgets",
"signature": "def create_widgets(self)"
},
{
"docstring": "Returns work goal",
"name": "work_key",
"signature": "def work_key(self, work)"
},
{
"docstring": "Filters work",
"name": "filter_work",
"signa... | 3 | null | Implement the Python class `GoalGraph` described below.
Class description:
Implement the GoalGraph class.
Method signatures and docstrings:
- def create_widgets(self): Creates custom categories
- def work_key(self, work): Returns work goal
- def filter_work(self, work): Filters work | Implement the Python class `GoalGraph` described below.
Class description:
Implement the GoalGraph class.
Method signatures and docstrings:
- def create_widgets(self): Creates custom categories
- def work_key(self, work): Returns work goal
- def filter_work(self, work): Filters work
<|skeleton|>
class GoalGraph:
... | 92997453631f31d7f751861feb9f0d0c76af54d3 | <|skeleton|>
class GoalGraph:
def create_widgets(self):
"""Creates custom categories"""
<|body_0|>
def work_key(self, work):
"""Returns work goal"""
<|body_1|>
def filter_work(self, work):
"""Filters work"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GoalGraph:
def create_widgets(self):
"""Creates custom categories"""
color_generator = getsvgcolors()
work_list = load_work()
goals = set()
for work in work_list:
if work.category not in ('snowball',):
continue
if not hasattr(work... | the_stack_v2_python_sparse | notebooks/graph.py | dew-uff/scripts-provenance | train | 1 | |
4ded124c159fc0565039ea9e4934a5cf46e782c4 | [
"m = len(obstacleGrid)\nif m == 0:\n return 0\nn = len(obstacleGrid[0])\nself.cnt = 0\n\ndef help(obstacleGrid, x, y, m, n):\n if obstacleGrid[x][y]:\n return\n if obstacleGrid[x][y] == 0 and x == m - 1 and (y == n - 1):\n self.cnt += 1\n if x < m and y < n:\n if y + 1 < n and obsta... | <|body_start_0|>
m = len(obstacleGrid)
if m == 0:
return 0
n = len(obstacleGrid[0])
self.cnt = 0
def help(obstacleGrid, x, y, m, n):
if obstacleGrid[x][y]:
return
if obstacleGrid[x][y] == 0 and x == m - 1 and (y == n - 1):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def uniquePathsWithObstacles1(self, obstacleGrid):
""":type obstacleGrid: List[List[int]] :rtype: int"""
<|body_0|>
def uniquePathsWithObstacles2(self, obstacleGrid):
""":type obstacleGrid: List[List[int]] :rtype: int"""
<|body_1|>
def uniquePa... | stack_v2_sparse_classes_10k_train_006264 | 2,216 | no_license | [
{
"docstring": ":type obstacleGrid: List[List[int]] :rtype: int",
"name": "uniquePathsWithObstacles1",
"signature": "def uniquePathsWithObstacles1(self, obstacleGrid)"
},
{
"docstring": ":type obstacleGrid: List[List[int]] :rtype: int",
"name": "uniquePathsWithObstacles2",
"signature": "... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePathsWithObstacles1(self, obstacleGrid): :type obstacleGrid: List[List[int]] :rtype: int
- def uniquePathsWithObstacles2(self, obstacleGrid): :type obstacleGrid: List[L... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePathsWithObstacles1(self, obstacleGrid): :type obstacleGrid: List[List[int]] :rtype: int
- def uniquePathsWithObstacles2(self, obstacleGrid): :type obstacleGrid: List[L... | e5b018493bbd12edcdcd0434f35d9c358106d391 | <|skeleton|>
class Solution:
def uniquePathsWithObstacles1(self, obstacleGrid):
""":type obstacleGrid: List[List[int]] :rtype: int"""
<|body_0|>
def uniquePathsWithObstacles2(self, obstacleGrid):
""":type obstacleGrid: List[List[int]] :rtype: int"""
<|body_1|>
def uniquePa... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def uniquePathsWithObstacles1(self, obstacleGrid):
""":type obstacleGrid: List[List[int]] :rtype: int"""
m = len(obstacleGrid)
if m == 0:
return 0
n = len(obstacleGrid[0])
self.cnt = 0
def help(obstacleGrid, x, y, m, n):
if obs... | the_stack_v2_python_sparse | py/leetcode/63.py | wfeng1991/learnpy | train | 0 | |
290e8cd268006000cee9af28736b19d9a4ad31e6 | [
"super(Weapon, self).at_object_creation()\nself.db.hit = 0.4\nself.db.parry = 0.8\nself.db.damage = 8.0\nself.db.magic = False\nself.cmdset.add_default(CmdSetWeapon, permanent=True)",
"if self.location.has_player and self.home == self.location:\n self.location.msg_contents('%s suddenly and magically fades into... | <|body_start_0|>
super(Weapon, self).at_object_creation()
self.db.hit = 0.4
self.db.parry = 0.8
self.db.damage = 8.0
self.db.magic = False
self.cmdset.add_default(CmdSetWeapon, permanent=True)
<|end_body_0|>
<|body_start_1|>
if self.location.has_player and self.h... | This defines a bladed weapon. Important attributes (set at creation): hit - chance to hit (0-1) parry - chance to parry (0-1) damage - base damage given (modified by hit success and type of attack) (0-10) | Weapon | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Weapon:
"""This defines a bladed weapon. Important attributes (set at creation): hit - chance to hit (0-1) parry - chance to parry (0-1) damage - base damage given (modified by hit success and type of attack) (0-10)"""
def at_object_creation(self):
"""Called at first creation of the ... | stack_v2_sparse_classes_10k_train_006265 | 36,948 | permissive | [
{
"docstring": "Called at first creation of the object",
"name": "at_object_creation",
"signature": "def at_object_creation(self)"
},
{
"docstring": "When reset, the weapon is simply deleted, unless it has a place to return to.",
"name": "reset",
"signature": "def reset(self)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000136 | Implement the Python class `Weapon` described below.
Class description:
This defines a bladed weapon. Important attributes (set at creation): hit - chance to hit (0-1) parry - chance to parry (0-1) damage - base damage given (modified by hit success and type of attack) (0-10)
Method signatures and docstrings:
- def a... | Implement the Python class `Weapon` described below.
Class description:
This defines a bladed weapon. Important attributes (set at creation): hit - chance to hit (0-1) parry - chance to parry (0-1) damage - base damage given (modified by hit success and type of attack) (0-10)
Method signatures and docstrings:
- def a... | 4515b6b569f919b18223ff2b241ea70f3e787e1e | <|skeleton|>
class Weapon:
"""This defines a bladed weapon. Important attributes (set at creation): hit - chance to hit (0-1) parry - chance to parry (0-1) damage - base damage given (modified by hit success and type of attack) (0-10)"""
def at_object_creation(self):
"""Called at first creation of the ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Weapon:
"""This defines a bladed weapon. Important attributes (set at creation): hit - chance to hit (0-1) parry - chance to parry (0-1) damage - base damage given (modified by hit success and type of attack) (0-10)"""
def at_object_creation(self):
"""Called at first creation of the object"""
... | the_stack_v2_python_sparse | contrib/tutorial_world/objects.py | mergederg/deuterium | train | 1 |
850b8b538a5726fce250ed268ee87b763c69599b | [
"tags = ['tag1', 'tag2']\nfeed_url_to_config = {'https://ipstack.com': {'fieldnames': ['value'], 'indicator_type': 'IP'}}\nwith open('test_data/ip_ranges.txt') as ip_ranges_txt:\n ip_ranges = ip_ranges_txt.read().encode('utf8')\nwith requests_mock.Mocker() as m:\n itype = 'IP'\n args = {'indicator_type': i... | <|body_start_0|>
tags = ['tag1', 'tag2']
feed_url_to_config = {'https://ipstack.com': {'fieldnames': ['value'], 'indicator_type': 'IP'}}
with open('test_data/ip_ranges.txt') as ip_ranges_txt:
ip_ranges = ip_ranges_txt.read().encode('utf8')
with requests_mock.Mocker() as m:
... | TestTagsParam | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestTagsParam:
def test_tags_exists(self):
"""Given: - tags ['tag1', 'tag2'] params When: - Running get indicators/fetch indicators Then: - Validating tags key exists with given tags"""
<|body_0|>
def test_tags_not_exists(self):
"""Given: - No tags param When: - Runn... | stack_v2_sparse_classes_10k_train_006266 | 16,849 | permissive | [
{
"docstring": "Given: - tags ['tag1', 'tag2'] params When: - Running get indicators/fetch indicators Then: - Validating tags key exists with given tags",
"name": "test_tags_exists",
"signature": "def test_tags_exists(self)"
},
{
"docstring": "Given: - No tags param When: - Running get indicator... | 2 | null | Implement the Python class `TestTagsParam` described below.
Class description:
Implement the TestTagsParam class.
Method signatures and docstrings:
- def test_tags_exists(self): Given: - tags ['tag1', 'tag2'] params When: - Running get indicators/fetch indicators Then: - Validating tags key exists with given tags
- d... | Implement the Python class `TestTagsParam` described below.
Class description:
Implement the TestTagsParam class.
Method signatures and docstrings:
- def test_tags_exists(self): Given: - tags ['tag1', 'tag2'] params When: - Running get indicators/fetch indicators Then: - Validating tags key exists with given tags
- d... | 890def5a0e0ae8d6eaa538148249ddbc851dbb6b | <|skeleton|>
class TestTagsParam:
def test_tags_exists(self):
"""Given: - tags ['tag1', 'tag2'] params When: - Running get indicators/fetch indicators Then: - Validating tags key exists with given tags"""
<|body_0|>
def test_tags_not_exists(self):
"""Given: - No tags param When: - Runn... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestTagsParam:
def test_tags_exists(self):
"""Given: - tags ['tag1', 'tag2'] params When: - Running get indicators/fetch indicators Then: - Validating tags key exists with given tags"""
tags = ['tag1', 'tag2']
feed_url_to_config = {'https://ipstack.com': {'fieldnames': ['value'], 'indi... | the_stack_v2_python_sparse | Packs/ApiModules/Scripts/CSVFeedApiModule/CSVFeedApiModule_test.py | demisto/content | train | 1,023 | |
4375e2a1aeae290587b1884e656cf83b8cb82a82 | [
"if not root:\n return 0\nreturn 1 + self.countNodes(root.left) + self.countNodes(root.right)",
"if not root:\n return 0\nh = 0\nwhile root.left:\n h += 1\n root = root.left\nreturn 2 ** h - 1"
] | <|body_start_0|>
if not root:
return 0
return 1 + self.countNodes(root.left) + self.countNodes(root.right)
<|end_body_0|>
<|body_start_1|>
if not root:
return 0
h = 0
while root.left:
h += 1
root = root.left
return 2 ** h -... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countNodes(self, root) -> int:
"""完全二叉树: 除了最底层节点可能没填满外, 其余每层节点数都达到最大值, 并且最下面一层的节点都集中在该层最左边的若干位置。 若最底层为第 h 层,则该层包含 1~ 2h 个节点。"""
<|body_0|>
def countFullNodes(self, root):
"""满二叉树,既每层都是满的二叉树 他的节点个数为 2^h -1 个 (h为层数)"""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_10k_train_006267 | 1,095 | no_license | [
{
"docstring": "完全二叉树: 除了最底层节点可能没填满外, 其余每层节点数都达到最大值, 并且最下面一层的节点都集中在该层最左边的若干位置。 若最底层为第 h 层,则该层包含 1~ 2h 个节点。",
"name": "countNodes",
"signature": "def countNodes(self, root) -> int"
},
{
"docstring": "满二叉树,既每层都是满的二叉树 他的节点个数为 2^h -1 个 (h为层数)",
"name": "countFullNodes",
"signature": "def cou... | 2 | stack_v2_sparse_classes_30k_train_004814 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countNodes(self, root) -> int: 完全二叉树: 除了最底层节点可能没填满外, 其余每层节点数都达到最大值, 并且最下面一层的节点都集中在该层最左边的若干位置。 若最底层为第 h 层,则该层包含 1~ 2h 个节点。
- def countFullNodes(self, root): 满二叉树,既每层都是满的二叉树 他的... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countNodes(self, root) -> int: 完全二叉树: 除了最底层节点可能没填满外, 其余每层节点数都达到最大值, 并且最下面一层的节点都集中在该层最左边的若干位置。 若最底层为第 h 层,则该层包含 1~ 2h 个节点。
- def countFullNodes(self, root): 满二叉树,既每层都是满的二叉树 他的... | e0ad5e52829345dd2ce4bc578295336ca07b2662 | <|skeleton|>
class Solution:
def countNodes(self, root) -> int:
"""完全二叉树: 除了最底层节点可能没填满外, 其余每层节点数都达到最大值, 并且最下面一层的节点都集中在该层最左边的若干位置。 若最底层为第 h 层,则该层包含 1~ 2h 个节点。"""
<|body_0|>
def countFullNodes(self, root):
"""满二叉树,既每层都是满的二叉树 他的节点个数为 2^h -1 个 (h为层数)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def countNodes(self, root) -> int:
"""完全二叉树: 除了最底层节点可能没填满外, 其余每层节点数都达到最大值, 并且最下面一层的节点都集中在该层最左边的若干位置。 若最底层为第 h 层,则该层包含 1~ 2h 个节点。"""
if not root:
return 0
return 1 + self.countNodes(root.left) + self.countNodes(root.right)
def countFullNodes(self, root):
... | the_stack_v2_python_sparse | labuladong/二叉树/222.完全二叉树的节点个数.py | Ehco1996/leetcode | train | 7 | |
44d160bd335180af752386c8ffa6662bacf81c5c | [
"self._dbg = debug\nself._log = get_logger(self.__class__.__name__, self._dbg)\nself._paper_tape_file = paper_tape_file\nself._dst = dst\nself._parser = PaperTape(debug=self._dbg)",
"self._log.debug('')\nmusic_data = self._parser.parse(self._paper_tape_file)\nfor dst in self._dst:\n print()\n if ':/' in dst... | <|body_start_0|>
self._dbg = debug
self._log = get_logger(self.__class__.__name__, self._dbg)
self._paper_tape_file = paper_tape_file
self._dst = dst
self._parser = PaperTape(debug=self._dbg)
<|end_body_0|>
<|body_start_1|>
self._log.debug('')
music_data = self._... | PaperTapeApp | PaperTapeApp | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PaperTapeApp:
"""PaperTapeApp"""
def __init__(self, paper_tape_file, dst=(), debug=False) -> None:
"""Constructor Parameters ---------- paper_tape_file: str dst: str"""
<|body_0|>
def main(self):
"""main"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_006268 | 25,197 | no_license | [
{
"docstring": "Constructor Parameters ---------- paper_tape_file: str dst: str",
"name": "__init__",
"signature": "def __init__(self, paper_tape_file, dst=(), debug=False) -> None"
},
{
"docstring": "main",
"name": "main",
"signature": "def main(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002992 | Implement the Python class `PaperTapeApp` described below.
Class description:
PaperTapeApp
Method signatures and docstrings:
- def __init__(self, paper_tape_file, dst=(), debug=False) -> None: Constructor Parameters ---------- paper_tape_file: str dst: str
- def main(self): main | Implement the Python class `PaperTapeApp` described below.
Class description:
PaperTapeApp
Method signatures and docstrings:
- def __init__(self, paper_tape_file, dst=(), debug=False) -> None: Constructor Parameters ---------- paper_tape_file: str dst: str
- def main(self): main
<|skeleton|>
class PaperTapeApp:
... | b8264118d19c7f6c6be9b11f18c890c598eb1295 | <|skeleton|>
class PaperTapeApp:
"""PaperTapeApp"""
def __init__(self, paper_tape_file, dst=(), debug=False) -> None:
"""Constructor Parameters ---------- paper_tape_file: str dst: str"""
<|body_0|>
def main(self):
"""main"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PaperTapeApp:
"""PaperTapeApp"""
def __init__(self, paper_tape_file, dst=(), debug=False) -> None:
"""Constructor Parameters ---------- paper_tape_file: str dst: str"""
self._dbg = debug
self._log = get_logger(self.__class__.__name__, self._dbg)
self._paper_tape_file = pap... | the_stack_v2_python_sparse | musicbox/__main__.py | ytani01/MusicBox | train | 1 |
e125e655a8febcb816ca069eaaa3bbd2076ae4e7 | [
"super(GroupNormStatic, self).__init__()\nself.num_groups = num_groups\nself.num_channels = num_channels\nself.group_norm = nn.GroupNorm(4 * num_groups, 4 * num_channels, eps)",
"batch_size = x.shape[0]\nx = x.view(batch_size, 4 * self.num_channels, -1)\nx = self.group_norm(x)\nx = x.view(batch_size, 4, self.num_... | <|body_start_0|>
super(GroupNormStatic, self).__init__()
self.num_groups = num_groups
self.num_channels = num_channels
self.group_norm = nn.GroupNorm(4 * num_groups, 4 * num_channels, eps)
<|end_body_0|>
<|body_start_1|>
batch_size = x.shape[0]
x = x.view(batch_size, 4 *... | Group normalization layer with an independent scale and bias factor for each instrument | GroupNormStatic | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupNormStatic:
"""Group normalization layer with an independent scale and bias factor for each instrument"""
def __init__(self, _, __, num_groups, num_channels, eps=1e-08):
"""Arguments: num_groups {int} -- Number of normalized groups num_channels {int} -- Number of channels Keywor... | stack_v2_sparse_classes_10k_train_006269 | 37,269 | no_license | [
{
"docstring": "Arguments: num_groups {int} -- Number of normalized groups num_channels {int} -- Number of channels Keyword Arguments: eps {int} -- Constant for numerical stability (default: {1e-8})",
"name": "__init__",
"signature": "def __init__(self, _, __, num_groups, num_channels, eps=1e-08)"
},
... | 2 | stack_v2_sparse_classes_30k_train_003100 | Implement the Python class `GroupNormStatic` described below.
Class description:
Group normalization layer with an independent scale and bias factor for each instrument
Method signatures and docstrings:
- def __init__(self, _, __, num_groups, num_channels, eps=1e-08): Arguments: num_groups {int} -- Number of normaliz... | Implement the Python class `GroupNormStatic` described below.
Class description:
Group normalization layer with an independent scale and bias factor for each instrument
Method signatures and docstrings:
- def __init__(self, _, __, num_groups, num_channels, eps=1e-08): Arguments: num_groups {int} -- Number of normaliz... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class GroupNormStatic:
"""Group normalization layer with an independent scale and bias factor for each instrument"""
def __init__(self, _, __, num_groups, num_channels, eps=1e-08):
"""Arguments: num_groups {int} -- Number of normalized groups num_channels {int} -- Number of channels Keywor... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GroupNormStatic:
"""Group normalization layer with an independent scale and bias factor for each instrument"""
def __init__(self, _, __, num_groups, num_channels, eps=1e-08):
"""Arguments: num_groups {int} -- Number of normalized groups num_channels {int} -- Number of channels Keyword Arguments: ... | the_stack_v2_python_sparse | generated/test_pfnet_research_meta_tasnet.py | jansel/pytorch-jit-paritybench | train | 35 |
f7c0618e8b1af213f6594ad1a6496f5de699e589 | [
"cube = _set_up_height_cube(np.array([5.0, 10.0, 20.0]))\nself.coord_name = 'height'\ndata = np.zeros(cube.shape)\ndata[0] = np.ones(cube[0].shape, dtype=np.int32)\ndata[1] = np.full(cube[1].shape, 2, dtype=np.int32)\ndata[2] = np.full(cube[2].shape, 3, dtype=np.int32)\ndata[0, 0, 0] = 6\ncube.data = data\nself.cub... | <|body_start_0|>
cube = _set_up_height_cube(np.array([5.0, 10.0, 20.0]))
self.coord_name = 'height'
data = np.zeros(cube.shape)
data[0] = np.ones(cube[0].shape, dtype=np.int32)
data[1] = np.full(cube[1].shape, 2, dtype=np.int32)
data[2] = np.full(cube[2].shape, 3, dtype=n... | Test the process method. | Test_process | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_process:
"""Test the process method."""
def setUp(self):
"""Set up the cube."""
<|body_0|>
def test_basic(self):
"""Test that a cube with the points on the chosen coordinate are in the expected order."""
<|body_1|>
def test_metadata(self):
... | stack_v2_sparse_classes_10k_train_006270 | 25,011 | permissive | [
{
"docstring": "Set up the cube.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test that a cube with the points on the chosen coordinate are in the expected order.",
"name": "test_basic",
"signature": "def test_basic(self)"
},
{
"docstring": "Test that the ... | 5 | null | Implement the Python class `Test_process` described below.
Class description:
Test the process method.
Method signatures and docstrings:
- def setUp(self): Set up the cube.
- def test_basic(self): Test that a cube with the points on the chosen coordinate are in the expected order.
- def test_metadata(self): Test that... | Implement the Python class `Test_process` described below.
Class description:
Test the process method.
Method signatures and docstrings:
- def setUp(self): Set up the cube.
- def test_basic(self): Test that a cube with the points on the chosen coordinate are in the expected order.
- def test_metadata(self): Test that... | cd2c9019944345df1e703bf8f625db537ad9f559 | <|skeleton|>
class Test_process:
"""Test the process method."""
def setUp(self):
"""Set up the cube."""
<|body_0|>
def test_basic(self):
"""Test that a cube with the points on the chosen coordinate are in the expected order."""
<|body_1|>
def test_metadata(self):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Test_process:
"""Test the process method."""
def setUp(self):
"""Set up the cube."""
cube = _set_up_height_cube(np.array([5.0, 10.0, 20.0]))
self.coord_name = 'height'
data = np.zeros(cube.shape)
data[0] = np.ones(cube[0].shape, dtype=np.int32)
data[1] = np... | the_stack_v2_python_sparse | improver_tests/utilities/test_mathematical_operations.py | metoppv/improver | train | 101 |
15a5c96388208cf62f15be574b615a6971609528 | [
"py_typecheck.check_callable(executor_stack_fn)\nself._executor_stack_fn = executor_stack_fn\nself._executors = cachetools.LRUCache(_EXECUTOR_CACHE_SIZE)\nif ensure_closed is None:\n ensure_closed = ()\nself._ensure_closed = ensure_closed",
"py_typecheck.check_type(cardinalities, dict)\nkey = _get_hashable_key... | <|body_start_0|>
py_typecheck.check_callable(executor_stack_fn)
self._executor_stack_fn = executor_stack_fn
self._executors = cachetools.LRUCache(_EXECUTOR_CACHE_SIZE)
if ensure_closed is None:
ensure_closed = ()
self._ensure_closed = ensure_closed
<|end_body_0|>
<|b... | Implementation of executor factory holding an executor per cardinality. | ResourceManagingExecutorFactory | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResourceManagingExecutorFactory:
"""Implementation of executor factory holding an executor per cardinality."""
def __init__(self, executor_stack_fn: Callable[[executor_factory.CardinalitiesType], executor_base.Executor], ensure_closed: Optional[Sequence[executor_base.Executor]]=None):
... | stack_v2_sparse_classes_10k_train_006271 | 43,780 | permissive | [
{
"docstring": "Initializes `ResourceManagingExecutorFactory`. `ResourceManagingExecutorFactory` manages a mapping from `cardinalities` to `executor_base.Executors`, closing and destroying the executors in this mapping when asked. Args: executor_stack_fn: Callable taking a mapping from `placements.PlacementLite... | 3 | stack_v2_sparse_classes_30k_train_003085 | Implement the Python class `ResourceManagingExecutorFactory` described below.
Class description:
Implementation of executor factory holding an executor per cardinality.
Method signatures and docstrings:
- def __init__(self, executor_stack_fn: Callable[[executor_factory.CardinalitiesType], executor_base.Executor], ens... | Implement the Python class `ResourceManagingExecutorFactory` described below.
Class description:
Implementation of executor factory holding an executor per cardinality.
Method signatures and docstrings:
- def __init__(self, executor_stack_fn: Callable[[executor_factory.CardinalitiesType], executor_base.Executor], ens... | 9c08381a172a26957d7c50f74214c74fe9a9fb1c | <|skeleton|>
class ResourceManagingExecutorFactory:
"""Implementation of executor factory holding an executor per cardinality."""
def __init__(self, executor_stack_fn: Callable[[executor_factory.CardinalitiesType], executor_base.Executor], ensure_closed: Optional[Sequence[executor_base.Executor]]=None):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ResourceManagingExecutorFactory:
"""Implementation of executor factory holding an executor per cardinality."""
def __init__(self, executor_stack_fn: Callable[[executor_factory.CardinalitiesType], executor_base.Executor], ensure_closed: Optional[Sequence[executor_base.Executor]]=None):
"""Initiali... | the_stack_v2_python_sparse | tensorflow_federated/python/core/impl/executors/executor_stacks.py | Saiprasad16/federated | train | 1 |
3c275477e8c29dea96f8ade7285087113757a58f | [
"self._factor = factor\nself._bias_bra = False\nself._bias_ket = False",
"eps = packet.get_eps()\nqbra, Qbra, pbra, Pbra = pacbra.get_parameters(key=('q', 'Q', 'p', 'P'))\nqket, Qket, pket, Pket = packet.get_parameters(key=('q', 'Q', 'p', 'P'))\nif component is not None:\n kbra = array(pacbra.get_basis_shapes(... | <|body_start_0|>
self._factor = factor
self._bias_bra = False
self._bias_ket = False
<|end_body_0|>
<|body_start_1|>
eps = packet.get_eps()
qbra, Qbra, pbra, Pbra = pacbra.get_parameters(key=('q', 'Q', 'p', 'P'))
qket, Qket, pket, Pket = packet.get_parameters(key=('q', '... | This class implements an oracle by looking at a phase space distance. | SparsityOraclePSHAWP | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SparsityOraclePSHAWP:
"""This class implements an oracle by looking at a phase space distance."""
def __init__(self, factor=1.5):
"""Initialize an oracle for estimating if a specific overlap integral :math:`\\langle \\Psi_k | \\Psi_l \\rangle` is approximately zero. The oracle works ... | stack_v2_sparse_classes_10k_train_006272 | 5,045 | permissive | [
{
"docstring": "Initialize an oracle for estimating if a specific overlap integral :math:`\\\\langle \\\\Psi_k | \\\\Psi_l \\\\rangle` is approximately zero. The oracle works by computing first and second moments :math:`\\\\mu` and :math:`\\\\sigma` of the highest order function :math:`\\\\phi_i` of both wavepa... | 3 | null | Implement the Python class `SparsityOraclePSHAWP` described below.
Class description:
This class implements an oracle by looking at a phase space distance.
Method signatures and docstrings:
- def __init__(self, factor=1.5): Initialize an oracle for estimating if a specific overlap integral :math:`\\langle \\Psi_k | \... | Implement the Python class `SparsityOraclePSHAWP` described below.
Class description:
This class implements an oracle by looking at a phase space distance.
Method signatures and docstrings:
- def __init__(self, factor=1.5): Initialize an oracle for estimating if a specific overlap integral :math:`\\langle \\Psi_k | \... | 225b5dd9b1af1998bd40b5f6467ee959292b6a83 | <|skeleton|>
class SparsityOraclePSHAWP:
"""This class implements an oracle by looking at a phase space distance."""
def __init__(self, factor=1.5):
"""Initialize an oracle for estimating if a specific overlap integral :math:`\\langle \\Psi_k | \\Psi_l \\rangle` is approximately zero. The oracle works ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SparsityOraclePSHAWP:
"""This class implements an oracle by looking at a phase space distance."""
def __init__(self, factor=1.5):
"""Initialize an oracle for estimating if a specific overlap integral :math:`\\langle \\Psi_k | \\Psi_l \\rangle` is approximately zero. The oracle works by computing ... | the_stack_v2_python_sparse | WaveBlocksND/SparsityOraclePSHAWP.py | WaveBlocks/WaveBlocksND | train | 4 |
1b0bd28ce5705593a2dc05215f003a4c3640adf1 | [
"def backtrack(res, path, index, s):\n if len(s) == index:\n res.append(path[:])\n return\n for i in range(index, len(s)):\n substr = s[index:i + 1]\n if substr == substr[::-1]:\n path.append(substr)\n backtrack(res, path, i + 1, s)\n path.pop()\nan... | <|body_start_0|>
def backtrack(res, path, index, s):
if len(s) == index:
res.append(path[:])
return
for i in range(index, len(s)):
substr = s[index:i + 1]
if substr == substr[::-1]:
path.append(substr)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def partition(self, s):
""":type s: str :rtype: List[List[str]]"""
<|body_0|>
def partition_wrong_answer(self, s):
""":type s: str :rtype: List[List[str]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def backtrack(res, path, index, s):
... | stack_v2_sparse_classes_10k_train_006273 | 2,206 | no_license | [
{
"docstring": ":type s: str :rtype: List[List[str]]",
"name": "partition",
"signature": "def partition(self, s)"
},
{
"docstring": ":type s: str :rtype: List[List[str]]",
"name": "partition_wrong_answer",
"signature": "def partition_wrong_answer(self, s)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def partition(self, s): :type s: str :rtype: List[List[str]]
- def partition_wrong_answer(self, s): :type s: str :rtype: List[List[str]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def partition(self, s): :type s: str :rtype: List[List[str]]
- def partition_wrong_answer(self, s): :type s: str :rtype: List[List[str]]
<|skeleton|>
class Solution:
def pa... | 2d5fa4cd696d5035ea8859befeadc5cc436959c9 | <|skeleton|>
class Solution:
def partition(self, s):
""":type s: str :rtype: List[List[str]]"""
<|body_0|>
def partition_wrong_answer(self, s):
""":type s: str :rtype: List[List[str]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def partition(self, s):
""":type s: str :rtype: List[List[str]]"""
def backtrack(res, path, index, s):
if len(s) == index:
res.append(path[:])
return
for i in range(index, len(s)):
substr = s[index:i + 1]
... | the_stack_v2_python_sparse | SourceCode/Python/Problem/00131.Palindrome Partitioning.py | roger6blog/LeetCode | train | 0 | |
c328af232c8df9e8f62f371186f51fd772838d23 | [
"config = super().default_configs()\nconfig.update({'max_char_length': None, 'entry_type': 'ft.onto.base_ontology.Token'})\nreturn config",
"word: Annotation\nif self.config is None:\n raise ProcessorConfigError('Configuration for the extractor not found.')\nfor word in pack.get(self.config.entry_type, context... | <|body_start_0|>
config = super().default_configs()
config.update({'max_char_length': None, 'entry_type': 'ft.onto.base_ontology.Token'})
return config
<|end_body_0|>
<|body_start_1|>
word: Annotation
if self.config is None:
raise ProcessorConfigError('Configuration ... | CharExtractor extracts feature from the text of entry. Text will be split into characters. | CharExtractor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CharExtractor:
"""CharExtractor extracts feature from the text of entry. Text will be split into characters."""
def default_configs(cls):
"""Returns a dictionary of default configuration parameters. Here: - "max_char_length": int The maximum number of characters for one token in the ... | stack_v2_sparse_classes_10k_train_006274 | 4,511 | permissive | [
{
"docstring": "Returns a dictionary of default configuration parameters. Here: - \"max_char_length\": int The maximum number of characters for one token in the text, default is None, which means no limit will be set. - \"entry_type\": str The fully qualified name of an annotation type entry. Characters will be... | 3 | stack_v2_sparse_classes_30k_train_004459 | Implement the Python class `CharExtractor` described below.
Class description:
CharExtractor extracts feature from the text of entry. Text will be split into characters.
Method signatures and docstrings:
- def default_configs(cls): Returns a dictionary of default configuration parameters. Here: - "max_char_length": i... | Implement the Python class `CharExtractor` described below.
Class description:
CharExtractor extracts feature from the text of entry. Text will be split into characters.
Method signatures and docstrings:
- def default_configs(cls): Returns a dictionary of default configuration parameters. Here: - "max_char_length": i... | 13e50aebe2afd79a7a8b3c01f0bb2568addea54f | <|skeleton|>
class CharExtractor:
"""CharExtractor extracts feature from the text of entry. Text will be split into characters."""
def default_configs(cls):
"""Returns a dictionary of default configuration parameters. Here: - "max_char_length": int The maximum number of characters for one token in the ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CharExtractor:
"""CharExtractor extracts feature from the text of entry. Text will be split into characters."""
def default_configs(cls):
"""Returns a dictionary of default configuration parameters. Here: - "max_char_length": int The maximum number of characters for one token in the text, default... | the_stack_v2_python_sparse | forte/data/extractors/char_extractor.py | asyml/forte | train | 233 |
6e830ccb79c876615cbe075dce5643ff4c5ecd96 | [
"budget_line = []\nline_obj = self.env['crossovered.budget.lines']\nfor confirmation in self:\n position = self.env['account.budget.post']._get_budget_position(confirmation.account_id.id)\n if not position:\n raise UserError(_('Confirmation Has no Budget Position!'))\n else:\n budget_line = l... | <|body_start_0|>
budget_line = []
line_obj = self.env['crossovered.budget.lines']
for confirmation in self:
position = self.env['account.budget.post']._get_budget_position(confirmation.account_id.id)
if not position:
raise UserError(_('Confirmation Has no ... | Inherit to overwrite workflow mothods to reflect confirmation state in voucher line | AccountBudgetConfirmationInvoice | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountBudgetConfirmationInvoice:
"""Inherit to overwrite workflow mothods to reflect confirmation state in voucher line"""
def check_budget_invoice(self):
"""This method check whether the budget line residual allow to validate this confirmation or not @return: boolean True if budget... | stack_v2_sparse_classes_10k_train_006275 | 25,644 | no_license | [
{
"docstring": "This method check whether the budget line residual allow to validate this confirmation or not @return: boolean True if budget line residual more that confirm amount, or False",
"name": "check_budget_invoice",
"signature": "def check_budget_invoice(self)"
},
{
"docstring": "overwr... | 4 | null | Implement the Python class `AccountBudgetConfirmationInvoice` described below.
Class description:
Inherit to overwrite workflow mothods to reflect confirmation state in voucher line
Method signatures and docstrings:
- def check_budget_invoice(self): This method check whether the budget line residual allow to validate... | Implement the Python class `AccountBudgetConfirmationInvoice` described below.
Class description:
Inherit to overwrite workflow mothods to reflect confirmation state in voucher line
Method signatures and docstrings:
- def check_budget_invoice(self): This method check whether the budget line residual allow to validate... | 0b997095c260d58b026440967fea3a202bef7efb | <|skeleton|>
class AccountBudgetConfirmationInvoice:
"""Inherit to overwrite workflow mothods to reflect confirmation state in voucher line"""
def check_budget_invoice(self):
"""This method check whether the budget line residual allow to validate this confirmation or not @return: boolean True if budget... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AccountBudgetConfirmationInvoice:
"""Inherit to overwrite workflow mothods to reflect confirmation state in voucher line"""
def check_budget_invoice(self):
"""This method check whether the budget line residual allow to validate this confirmation or not @return: boolean True if budget line residua... | the_stack_v2_python_sparse | v_11/EBS-SVN/trunk/account_ebs/models/account.py | musabahmed/baba | train | 0 |
c58b50a6f63428669b30f3f3d35d9c414a4097b0 | [
"if request.user.is_anonymous:\n return request.session.get('user', {}).get('id')\nreturn None",
"id = AnonUser.get_id(request)\nif id:\n anon_user, created = AnonUser.objects.get_or_create(id=id)\n return anon_user\nelse:\n anon_user = AnonUser.objects.create()\n request.session['user'] = {'anon':... | <|body_start_0|>
if request.user.is_anonymous:
return request.session.get('user', {}).get('id')
return None
<|end_body_0|>
<|body_start_1|>
id = AnonUser.get_id(request)
if id:
anon_user, created = AnonUser.objects.get_or_create(id=id)
return anon_use... | A model to store anonymous users when necessary. Used to associate unauthenticated users with objects, for example, so that the same session job can be provided to them on multiple page refreshes. | AnonUser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnonUser:
"""A model to store anonymous users when necessary. Used to associate unauthenticated users with objects, for example, so that the same session job can be provided to them on multiple page refreshes."""
def get_id(request: HttpRequest) -> Optional[str]:
"""Get the id of the... | stack_v2_sparse_classes_10k_train_006276 | 17,416 | permissive | [
{
"docstring": "Get the id of the anonymous user, if any.",
"name": "get_id",
"signature": "def get_id(request: HttpRequest) -> Optional[str]"
},
{
"docstring": "Create an instance in the database. Only use this when necessary. e.g when you need to associated an anonymous user with another objec... | 2 | null | Implement the Python class `AnonUser` described below.
Class description:
A model to store anonymous users when necessary. Used to associate unauthenticated users with objects, for example, so that the same session job can be provided to them on multiple page refreshes.
Method signatures and docstrings:
- def get_id(... | Implement the Python class `AnonUser` described below.
Class description:
A model to store anonymous users when necessary. Used to associate unauthenticated users with objects, for example, so that the same session job can be provided to them on multiple page refreshes.
Method signatures and docstrings:
- def get_id(... | b0edf060f4cc5494eef81fce62a563bd5b4e8e31 | <|skeleton|>
class AnonUser:
"""A model to store anonymous users when necessary. Used to associate unauthenticated users with objects, for example, so that the same session job can be provided to them on multiple page refreshes."""
def get_id(request: HttpRequest) -> Optional[str]:
"""Get the id of the... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AnonUser:
"""A model to store anonymous users when necessary. Used to associate unauthenticated users with objects, for example, so that the same session job can be provided to them on multiple page refreshes."""
def get_id(request: HttpRequest) -> Optional[str]:
"""Get the id of the anonymous us... | the_stack_v2_python_sparse | manager/users/models.py | stencila/hub | train | 31 |
04ce9d34da08b152aaafb946d65d7ec8005e2b55 | [
"super().__init__()\nself.conv_residual = None\nif in_ch != out_ch:\n self.conv_residual = nn.utils.weight_norm(Conv2D(in_channels=in_ch, out_channels=out_ch, kernel_size=(1, 1)), name='weight', dim=0)\n self.dropout_residual = nn.Dropout(p=dropout)\nself.pad_left = nn.Pad2d((0, 0, kernel_size - 1, 0), 0)\nla... | <|body_start_0|>
super().__init__()
self.conv_residual = None
if in_ch != out_ch:
self.conv_residual = nn.utils.weight_norm(Conv2D(in_channels=in_ch, out_channels=out_ch, kernel_size=(1, 1)), name='weight', dim=0)
self.dropout_residual = nn.Dropout(p=dropout)
self... | ConvGLUBlock | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvGLUBlock:
def __init__(self, kernel_size, in_ch, out_ch, bottlececk_dim=0, dropout=0.0):
"""A convolutional Gated Linear Units (GLU) block. Args: kernel_size (int): kernel size in_ch (int): number of input channels out_ch (int): number of output channels bottlececk_dim (int): dimensi... | stack_v2_sparse_classes_10k_train_006277 | 5,476 | permissive | [
{
"docstring": "A convolutional Gated Linear Units (GLU) block. Args: kernel_size (int): kernel size in_ch (int): number of input channels out_ch (int): number of output channels bottlececk_dim (int): dimension of the bottleneck layers for computational efficiency. Defaults to 0. dropout (float): dropout probab... | 2 | null | Implement the Python class `ConvGLUBlock` described below.
Class description:
Implement the ConvGLUBlock class.
Method signatures and docstrings:
- def __init__(self, kernel_size, in_ch, out_ch, bottlececk_dim=0, dropout=0.0): A convolutional Gated Linear Units (GLU) block. Args: kernel_size (int): kernel size in_ch ... | Implement the Python class `ConvGLUBlock` described below.
Class description:
Implement the ConvGLUBlock class.
Method signatures and docstrings:
- def __init__(self, kernel_size, in_ch, out_ch, bottlececk_dim=0, dropout=0.0): A convolutional Gated Linear Units (GLU) block. Args: kernel_size (int): kernel size in_ch ... | 17854a04d43c231eff66bfed9d6aa55e94a29e79 | <|skeleton|>
class ConvGLUBlock:
def __init__(self, kernel_size, in_ch, out_ch, bottlececk_dim=0, dropout=0.0):
"""A convolutional Gated Linear Units (GLU) block. Args: kernel_size (int): kernel size in_ch (int): number of input channels out_ch (int): number of output channels bottlececk_dim (int): dimensi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ConvGLUBlock:
def __init__(self, kernel_size, in_ch, out_ch, bottlececk_dim=0, dropout=0.0):
"""A convolutional Gated Linear Units (GLU) block. Args: kernel_size (int): kernel size in_ch (int): number of input channels out_ch (int): number of output channels bottlececk_dim (int): dimension of the bott... | the_stack_v2_python_sparse | paddlespeech/s2t/modules/activation.py | anniyanvr/DeepSpeech-1 | train | 0 | |
d114dc29a96f514967e75a8945f43353dbfe08a0 | [
"res = ''\n\ndef postOrder(root):\n nonlocal res\n if not root:\n res += '# '\n return\n postOrder(root.left)\n postOrder(root.right)\n res += str(root.val) + ' '\npostOrder(root)\nreturn res",
"datas = data.split()\n\ndef deOrder():\n val = datas.pop()\n if val == '#':\n ... | <|body_start_0|>
res = ''
def postOrder(root):
nonlocal res
if not root:
res += '# '
return
postOrder(root.left)
postOrder(root.right)
res += str(root.val) + ' '
postOrder(root)
return res
<|end_... | 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_10k_train_006278 | 907 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | bcc04d49969654cb44f79218a7ef2fd5c1e5449a | <|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_10k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
res = ''
def postOrder(root):
nonlocal res
if not root:
res += '# '
return
postOrder(root.left)
p... | the_stack_v2_python_sparse | src/0297-Serialize-and-Deserialize-Binary-Tree/0297.py | luliyucoordinate/Leetcode | train | 1,575 | |
22dba2c5cf6c001c17dbedd38e4cd64a2c9be617 | [
"self._export_dir = export_dir\nself._best = None\nif isinstance(cmp_fn, tuple):\n self.cmp_fn = cmp_fn[0]\n self.is_export = cmp_fn[1]\nelse:\n self.cmp_fn = cmp_fn\n self.is_export = False\nself._best_result = None\nself._epoch_count = 0",
"log.debug('New evaluate result: %s \\nold: %s' % (repr(eval... | <|body_start_0|>
self._export_dir = export_dir
self._best = None
if isinstance(cmp_fn, tuple):
self.cmp_fn = cmp_fn[0]
self.is_export = cmp_fn[1]
else:
self.cmp_fn = cmp_fn
self.is_export = False
self._best_result = None
sel... | export saved model accordingto `cmp_fn` | BestResultExporter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BestResultExporter:
"""export saved model accordingto `cmp_fn`"""
def __init__(self, export_dir, cmp_fn):
"""doc"""
<|body_0|>
def export(self, exe, program, eval_model_spec, eval_result, state):
"""doc"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_006279 | 8,759 | permissive | [
{
"docstring": "doc",
"name": "__init__",
"signature": "def __init__(self, export_dir, cmp_fn)"
},
{
"docstring": "doc",
"name": "export",
"signature": "def export(self, exe, program, eval_model_spec, eval_result, state)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006890 | Implement the Python class `BestResultExporter` described below.
Class description:
export saved model accordingto `cmp_fn`
Method signatures and docstrings:
- def __init__(self, export_dir, cmp_fn): doc
- def export(self, exe, program, eval_model_spec, eval_result, state): doc | Implement the Python class `BestResultExporter` described below.
Class description:
export saved model accordingto `cmp_fn`
Method signatures and docstrings:
- def __init__(self, export_dir, cmp_fn): doc
- def export(self, exe, program, eval_model_spec, eval_result, state): doc
<|skeleton|>
class BestResultExporter:... | e6ab0261eb719c21806bbadfd94001ecfe27de45 | <|skeleton|>
class BestResultExporter:
"""export saved model accordingto `cmp_fn`"""
def __init__(self, export_dir, cmp_fn):
"""doc"""
<|body_0|>
def export(self, exe, program, eval_model_spec, eval_result, state):
"""doc"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BestResultExporter:
"""export saved model accordingto `cmp_fn`"""
def __init__(self, export_dir, cmp_fn):
"""doc"""
self._export_dir = export_dir
self._best = None
if isinstance(cmp_fn, tuple):
self.cmp_fn = cmp_fn[0]
self.is_export = cmp_fn[1]
... | the_stack_v2_python_sparse | competition/ogbg_molhiv/propeller/paddle/train/exporter.py | PaddlePaddle/PaddleHelix | train | 771 |
5e9791417050a60409cd4a1b3d7cc4863b9a7134 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ManagedDeviceOverview()",
"from .device_exchange_access_state_summary import DeviceExchangeAccessStateSummary\nfrom .device_operating_system_summary import DeviceOperatingSystemSummary\nfrom .entity import Entity\nfrom .device_exchange... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return ManagedDeviceOverview()
<|end_body_0|>
<|body_start_1|>
from .device_exchange_access_state_summary import DeviceExchangeAccessStateSummary
from .device_operating_system_summary import De... | Summary data for managed devices | ManagedDeviceOverview | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ManagedDeviceOverview:
"""Summary data for managed devices"""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedDeviceOverview:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to... | stack_v2_sparse_classes_10k_train_006280 | 4,046 | 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: ManagedDeviceOverview",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminat... | 3 | stack_v2_sparse_classes_30k_train_004271 | Implement the Python class `ManagedDeviceOverview` described below.
Class description:
Summary data for managed devices
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedDeviceOverview: Creates a new instance of the appropriate class based on discr... | Implement the Python class `ManagedDeviceOverview` described below.
Class description:
Summary data for managed devices
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedDeviceOverview: Creates a new instance of the appropriate class based on discr... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ManagedDeviceOverview:
"""Summary data for managed devices"""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedDeviceOverview:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ManagedDeviceOverview:
"""Summary data for managed devices"""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedDeviceOverview:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the dis... | the_stack_v2_python_sparse | msgraph/generated/models/managed_device_overview.py | microsoftgraph/msgraph-sdk-python | train | 135 |
ee10de1c9024608da759bcf5af3016d5bc340c91 | [
"get_proxy_objects = []\nget_proxy_objects.clear()\nfor pxyobj in bpy.data.scenes[bpy.context.scene.name].objects:\n if pxyobj.type == 'ARMATURE':\n name = pxyobj.name[:]\n get_proxy_objects.append((name, name, name))\nget_proxy_objects.sort()\nreturn get_proxy_objects",
"get_object_bones = []\ng... | <|body_start_0|>
get_proxy_objects = []
get_proxy_objects.clear()
for pxyobj in bpy.data.scenes[bpy.context.scene.name].objects:
if pxyobj.type == 'ARMATURE':
name = pxyobj.name[:]
get_proxy_objects.append((name, name, name))
get_proxy_objects.... | Property Used for the whole GUI in general | MasterProperties | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MasterProperties:
"""Property Used for the whole GUI in general"""
def proxy_objects(self, context):
"""Obtains a list of proxy objects from the active scene, handles reference bug in Blender 2.6x +"""
<|body_0|>
def bone_objects(self, context):
"""Obtains a list... | stack_v2_sparse_classes_10k_train_006281 | 32,908 | no_license | [
{
"docstring": "Obtains a list of proxy objects from the active scene, handles reference bug in Blender 2.6x +",
"name": "proxy_objects",
"signature": "def proxy_objects(self, context)"
},
{
"docstring": "Obtains a list of 'proxy' objects from the active scene, handles reference bug in Blender 2... | 2 | stack_v2_sparse_classes_30k_train_005765 | Implement the Python class `MasterProperties` described below.
Class description:
Property Used for the whole GUI in general
Method signatures and docstrings:
- def proxy_objects(self, context): Obtains a list of proxy objects from the active scene, handles reference bug in Blender 2.6x +
- def bone_objects(self, con... | Implement the Python class `MasterProperties` described below.
Class description:
Property Used for the whole GUI in general
Method signatures and docstrings:
- def proxy_objects(self, context): Obtains a list of proxy objects from the active scene, handles reference bug in Blender 2.6x +
- def bone_objects(self, con... | 0788f00283d7c8c083aa5d554eb1f32c201adbd6 | <|skeleton|>
class MasterProperties:
"""Property Used for the whole GUI in general"""
def proxy_objects(self, context):
"""Obtains a list of proxy objects from the active scene, handles reference bug in Blender 2.6x +"""
<|body_0|>
def bone_objects(self, context):
"""Obtains a list... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MasterProperties:
"""Property Used for the whole GUI in general"""
def proxy_objects(self, context):
"""Obtains a list of proxy objects from the active scene, handles reference bug in Blender 2.6x +"""
get_proxy_objects = []
get_proxy_objects.clear()
for pxyobj in bpy.data... | the_stack_v2_python_sparse | repos/blender_addons/internal/2.7.x/addon_closeup_cam_2.py | BlenderCN-Org/working_files | train | 0 |
eaa39b8e4841917872a4766f649e2150785a6f66 | [
"dict_pos = {}\nfor i, v in enumerate(numbers):\n dict_pos[target - v] = i + 1\nfor i, v in enumerate(numbers):\n if v in dict_pos:\n return [i + 1, dict_pos[v]]",
"for i, v in enumerate(numbers):\n l, r = (i + 1, len(numbers) - 1)\n tmp = target - v\n while l <= r:\n mid = (l + r) //... | <|body_start_0|>
dict_pos = {}
for i, v in enumerate(numbers):
dict_pos[target - v] = i + 1
for i, v in enumerate(numbers):
if v in dict_pos:
return [i + 1, dict_pos[v]]
<|end_body_0|>
<|body_start_1|>
for i, v in enumerate(numbers):
l... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum_binarySearch(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_10k_train_006282 | 1,013 | no_license | [
{
"docstring": ":type numbers: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, numbers, target)"
},
{
"docstring": ":type numbers: List[int] :type target: int :rtype: List[int]",
"name": "twoSum_binarySearch",
"signature": "def twoSum_bina... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int]
- def twoSum_binarySearch(self, numbers, target): :type numbers: List[int] :type t... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int]
- def twoSum_binarySearch(self, numbers, target): :type numbers: List[int] :type t... | f3fc71f344cd758cfce77f16ab72992c99ab288e | <|skeleton|>
class Solution:
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum_binarySearch(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum(self, numbers, target):
""":type numbers: List[int] :type target: int :rtype: List[int]"""
dict_pos = {}
for i, v in enumerate(numbers):
dict_pos[target - v] = i + 1
for i, v in enumerate(numbers):
if v in dict_pos:
r... | the_stack_v2_python_sparse | 167_twoSumII.py | jennyChing/leetCode | train | 2 | |
eccaa1363fa7709a008ce5ce0c45ddbab37ac8e2 | [
"timestamp = self._GetRowValue(query_hash, row, value_name)\nif timestamp is None:\n return None\nreturn dfdatetime_posix_time.PosixTime(timestamp=timestamp)",
"query_hash = hash(query)\nevent_data = ChromeAutofillEventData()\nevent_data.creation_time = self._GetDateTimeRowValue(query_hash, row, 'date_created'... | <|body_start_0|>
timestamp = self._GetRowValue(query_hash, row, value_name)
if timestamp is None:
return None
return dfdatetime_posix_time.PosixTime(timestamp=timestamp)
<|end_body_0|>
<|body_start_1|>
query_hash = hash(query)
event_data = ChromeAutofillEventData()
... | SQLite parser plugin for Google Chrome autofill database (Web Data) files. The Google Chrome autofill database (Web Data) file is typically stored in: Web Data | ChromeAutofillPlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChromeAutofillPlugin:
"""SQLite parser plugin for Google Chrome autofill database (Web Data) files. The Google Chrome autofill database (Web Data) file is typically stored in: Web Data"""
def _GetDateTimeRowValue(self, query_hash, row, value_name):
"""Retrieves a date and time value ... | stack_v2_sparse_classes_10k_train_006283 | 3,665 | permissive | [
{
"docstring": "Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced the row. row (sqlite3.Row): row. value_name (str): name of the value. Returns: dfdatetime.PosixTime: date and time value or None if not available.",
"name... | 2 | stack_v2_sparse_classes_30k_train_002654 | Implement the Python class `ChromeAutofillPlugin` described below.
Class description:
SQLite parser plugin for Google Chrome autofill database (Web Data) files. The Google Chrome autofill database (Web Data) file is typically stored in: Web Data
Method signatures and docstrings:
- def _GetDateTimeRowValue(self, query... | Implement the Python class `ChromeAutofillPlugin` described below.
Class description:
SQLite parser plugin for Google Chrome autofill database (Web Data) files. The Google Chrome autofill database (Web Data) file is typically stored in: Web Data
Method signatures and docstrings:
- def _GetDateTimeRowValue(self, query... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class ChromeAutofillPlugin:
"""SQLite parser plugin for Google Chrome autofill database (Web Data) files. The Google Chrome autofill database (Web Data) file is typically stored in: Web Data"""
def _GetDateTimeRowValue(self, query_hash, row, value_name):
"""Retrieves a date and time value ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ChromeAutofillPlugin:
"""SQLite parser plugin for Google Chrome autofill database (Web Data) files. The Google Chrome autofill database (Web Data) file is typically stored in: Web Data"""
def _GetDateTimeRowValue(self, query_hash, row, value_name):
"""Retrieves a date and time value from the row.... | the_stack_v2_python_sparse | plaso/parsers/sqlite_plugins/chrome_autofill.py | log2timeline/plaso | train | 1,506 |
3d118cc93d51dbb468cf22f532c3136620d16d7e | [
"counter = 0\nlength = len(nums)\narray = {}\nfor i in range(len(nums) - 1, -1, -1):\n for index in range(length - i):\n sum = array.get(index, 0)\n array[index] = nums[i] + sum\n if array[index] == k:\n counter += 1\nreturn counter",
"count = sum = 0\nmap = {}\nmap[0] = 1\nfor ... | <|body_start_0|>
counter = 0
length = len(nums)
array = {}
for i in range(len(nums) - 1, -1, -1):
for index in range(length - i):
sum = array.get(index, 0)
array[index] = nums[i] + sum
if array[index] == k:
c... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def subarraySum(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def subarraySum2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
counter = 0
... | stack_v2_sparse_classes_10k_train_006284 | 1,119 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "subarraySum",
"signature": "def subarraySum(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "subarraySum2",
"signature": "def subarraySum2(self, nums, k)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005312 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def subarraySum2(self, nums, k): :type nums: List[int] :type k: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def subarraySum2(self, nums, k): :type nums: List[int] :type k: int :rtype: int
<|skeleton|>
cla... | a8b59573dc201438ebd5a5ab64e9ac61255a4abd | <|skeleton|>
class Solution:
def subarraySum(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def subarraySum2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def subarraySum(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
counter = 0
length = len(nums)
array = {}
for i in range(len(nums) - 1, -1, -1):
for index in range(length - i):
sum = array.get(index, 0)
... | the_stack_v2_python_sparse | summer/2018_07_13/subarray-sum-equals-k.py | shaheming/leecode | train | 0 | |
da77f116a79c8cd863999e52b989d3e0892c8543 | [
"self._map = {}\nself._cdllist = CDLList()\nself._cap = capacity",
"node = self._map.get(key, None)\nif node:\n self._cdllist.set_head(node)\n return node.val\nreturn -1",
"if self._cap < 1:\n return\nflag = False\nnode = self._map.get(key, None)\nif node:\n flag = True\n node.val = value\nelse:\... | <|body_start_0|>
self._map = {}
self._cdllist = CDLList()
self._cap = capacity
<|end_body_0|>
<|body_start_1|>
node = self._map.get(key, None)
if node:
self._cdllist.set_head(node)
return node.val
return -1
<|end_body_1|>
<|body_start_2|>
... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
"""_map: :types capacity: int"""
<|body_0|>
def get(self, key):
""":types key: int :rtypes: int"""
<|body_1|>
def put(self, key, value):
""":types key: int :types value: int :rtypes: void"""
<|body_... | stack_v2_sparse_classes_10k_train_006285 | 4,351 | no_license | [
{
"docstring": "_map: :types capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":types key: int :rtypes: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":types key: int :types value: int :rtypes: void",
... | 3 | stack_v2_sparse_classes_30k_val_000094 | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): _map: :types capacity: int
- def get(self, key): :types key: int :rtypes: int
- def put(self, key, value): :types key: int :types value: int :rtypes... | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): _map: :types capacity: int
- def get(self, key): :types key: int :rtypes: int
- def put(self, key, value): :types key: int :types value: int :rtypes... | 8c0c2a8bcd51825e6902e4d03dabbaf6f303ba83 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
"""_map: :types capacity: int"""
<|body_0|>
def get(self, key):
""":types key: int :rtypes: int"""
<|body_1|>
def put(self, key, value):
""":types key: int :types value: int :rtypes: void"""
<|body_... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LRUCache:
def __init__(self, capacity):
"""_map: :types capacity: int"""
self._map = {}
self._cdllist = CDLList()
self._cap = capacity
def get(self, key):
""":types key: int :rtypes: int"""
node = self._map.get(key, None)
if node:
self._... | the_stack_v2_python_sparse | python_fundemental/104_Lru_cache.py | Deanwinger/python_project | train | 0 | |
e603b24693ab033cb8967a8234f78f500d892203 | [
"current = self.head\nwhile current is not None:\n if current.get_data() == item:\n return True\n else:\n if current.get_data() > item:\n return False\n current = current.get_next()\nreturn False",
"current = self.head\nprevious = None\nstop = False\nwhile current is not None... | <|body_start_0|>
current = self.head
while current is not None:
if current.get_data() == item:
return True
else:
if current.get_data() > item:
return False
current = current.get_next()
return False
<|end_... | Ordered List class, a collection of nodes indexed, but the numbers inside must be in order. Inherits __init__, is_empty, size and remove from UnorderedList. | OrderedList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrderedList:
"""Ordered List class, a collection of nodes indexed, but the numbers inside must be in order. Inherits __init__, is_empty, size and remove from UnorderedList."""
def search(self, item):
"""Return True if the item is on the list. O(n)."""
<|body_0|>
def add(... | stack_v2_sparse_classes_10k_train_006286 | 3,468 | no_license | [
{
"docstring": "Return True if the item is on the list. O(n).",
"name": "search",
"signature": "def search(self, item)"
},
{
"docstring": "Add a new item on the correct position.",
"name": "add",
"signature": "def add(self, item)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000170 | Implement the Python class `OrderedList` described below.
Class description:
Ordered List class, a collection of nodes indexed, but the numbers inside must be in order. Inherits __init__, is_empty, size and remove from UnorderedList.
Method signatures and docstrings:
- def search(self, item): Return True if the item ... | Implement the Python class `OrderedList` described below.
Class description:
Ordered List class, a collection of nodes indexed, but the numbers inside must be in order. Inherits __init__, is_empty, size and remove from UnorderedList.
Method signatures and docstrings:
- def search(self, item): Return True if the item ... | 8b01517c9cc3a9b07e6a103d52b87b5f56c4d394 | <|skeleton|>
class OrderedList:
"""Ordered List class, a collection of nodes indexed, but the numbers inside must be in order. Inherits __init__, is_empty, size and remove from UnorderedList."""
def search(self, item):
"""Return True if the item is on the list. O(n)."""
<|body_0|>
def add(... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OrderedList:
"""Ordered List class, a collection of nodes indexed, but the numbers inside must be in order. Inherits __init__, is_empty, size and remove from UnorderedList."""
def search(self, item):
"""Return True if the item is on the list. O(n)."""
current = self.head
while cur... | the_stack_v2_python_sparse | LinearStructures/LinkedList/linkedlist.py | ohduran/problemsolvingalgorithms | train | 0 |
da8091bc1649b808f9ee65dfd57b4e3bb34ecb64 | [
"blocks_args_str = ['r1_k3_s11_e1_i32_o16_se0.25', 'r2_k3_s22_e6_i16_o24_se0.25', 'r2_k5_s22_e6_i24_o40_se0.25', 'r3_k3_s22_e6_i40_o80_se0.25', 'r3_k5_s11_e6_i80_o112_se0.25', 'r4_k5_s22_e6_i112_o192_se0.25', 'r1_k3_s11_e6_i192_o320_se0.25']\nif model_name not in efficientnet_params:\n model_name_string = ', '.j... | <|body_start_0|>
blocks_args_str = ['r1_k3_s11_e1_i32_o16_se0.25', 'r2_k3_s22_e6_i16_o24_se0.25', 'r2_k5_s22_e6_i24_o40_se0.25', 'r3_k3_s22_e6_i40_o80_se0.25', 'r3_k5_s11_e6_i80_o112_se0.25', 'r4_k5_s22_e6_i112_o192_se0.25', 'r1_k3_s11_e6_i192_o320_se0.25']
if model_name not in efficientnet_params:
... | EfficientNetBNFeatures | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EfficientNetBNFeatures:
def __init__(self, model_name: str, pretrained: bool=True, progress: bool=True, spatial_dims: int=2, in_channels: int=3, num_classes: int=1000, norm: str | tuple=('batch', {'eps': 0.001, 'momentum': 0.01}), adv_prop: bool=False) -> None:
"""Initialize EfficientNet... | stack_v2_sparse_classes_10k_train_006287 | 40,667 | permissive | [
{
"docstring": "Initialize EfficientNet-B0 to EfficientNet-B7 models as a backbone, the backbone can be used as an encoder for segmentation and objection models. Compared with the class `EfficientNetBN`, the only different place is the forward function. This class refers to `PyTorch image models <https://github... | 2 | stack_v2_sparse_classes_30k_train_003724 | Implement the Python class `EfficientNetBNFeatures` described below.
Class description:
Implement the EfficientNetBNFeatures class.
Method signatures and docstrings:
- def __init__(self, model_name: str, pretrained: bool=True, progress: bool=True, spatial_dims: int=2, in_channels: int=3, num_classes: int=1000, norm: ... | Implement the Python class `EfficientNetBNFeatures` described below.
Class description:
Implement the EfficientNetBNFeatures class.
Method signatures and docstrings:
- def __init__(self, model_name: str, pretrained: bool=True, progress: bool=True, spatial_dims: int=2, in_channels: int=3, num_classes: int=1000, norm: ... | e48c3e2c741fa3fc705c4425d17ac4a5afac6c47 | <|skeleton|>
class EfficientNetBNFeatures:
def __init__(self, model_name: str, pretrained: bool=True, progress: bool=True, spatial_dims: int=2, in_channels: int=3, num_classes: int=1000, norm: str | tuple=('batch', {'eps': 0.001, 'momentum': 0.01}), adv_prop: bool=False) -> None:
"""Initialize EfficientNet... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EfficientNetBNFeatures:
def __init__(self, model_name: str, pretrained: bool=True, progress: bool=True, spatial_dims: int=2, in_channels: int=3, num_classes: int=1000, norm: str | tuple=('batch', {'eps': 0.001, 'momentum': 0.01}), adv_prop: bool=False) -> None:
"""Initialize EfficientNet-B0 to Efficie... | the_stack_v2_python_sparse | monai/networks/nets/efficientnet.py | Project-MONAI/MONAI | train | 4,805 | |
fef7a5bb5d2dc68d2b30e988409be8e327ebb812 | [
"farm.launch()\nnode = discovery.run_server_in_cloud(cloud)\nlocation = CONF.feature.platform.location\ninstance_id = node.id\nif CONF.feature.platform.is_gce:\n location = node.extra['zone'].name\n instance_id = node.name\nrole_id = IMPL.discovery_manager.get_system_role_id(node.cloud._name, location, CONF.f... | <|body_start_0|>
farm.launch()
node = discovery.run_server_in_cloud(cloud)
location = CONF.feature.platform.location
instance_id = node.id
if CONF.feature.platform.is_gce:
location = node.extra['zone'].name
instance_id = node.name
role_id = IMPL.di... | TestDiscoveryManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestDiscoveryManager:
def test_import_server(self, context: dict, cloud: Cloud, farm: Farm):
"""Import cloud server to Scalr"""
<|body_0|>
def test_deploy_agent(self, context: dict, cloud: Cloud, farm: Farm):
"""Deploy Agent to imported server"""
<|body_1|>
... | stack_v2_sparse_classes_10k_train_006288 | 2,557 | no_license | [
{
"docstring": "Import cloud server to Scalr",
"name": "test_import_server",
"signature": "def test_import_server(self, context: dict, cloud: Cloud, farm: Farm)"
},
{
"docstring": "Deploy Agent to imported server",
"name": "test_deploy_agent",
"signature": "def test_deploy_agent(self, co... | 2 | stack_v2_sparse_classes_30k_train_003847 | Implement the Python class `TestDiscoveryManager` described below.
Class description:
Implement the TestDiscoveryManager class.
Method signatures and docstrings:
- def test_import_server(self, context: dict, cloud: Cloud, farm: Farm): Import cloud server to Scalr
- def test_deploy_agent(self, context: dict, cloud: Cl... | Implement the Python class `TestDiscoveryManager` described below.
Class description:
Implement the TestDiscoveryManager class.
Method signatures and docstrings:
- def test_import_server(self, context: dict, cloud: Cloud, farm: Farm): Import cloud server to Scalr
- def test_deploy_agent(self, context: dict, cloud: Cl... | 87b212e5b35a328b0a3c4d502847989a4d4fd897 | <|skeleton|>
class TestDiscoveryManager:
def test_import_server(self, context: dict, cloud: Cloud, farm: Farm):
"""Import cloud server to Scalr"""
<|body_0|>
def test_deploy_agent(self, context: dict, cloud: Cloud, farm: Farm):
"""Deploy Agent to imported server"""
<|body_1|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestDiscoveryManager:
def test_import_server(self, context: dict, cloud: Cloud, farm: Farm):
"""Import cloud server to Scalr"""
farm.launch()
node = discovery.run_server_in_cloud(cloud)
location = CONF.feature.platform.location
instance_id = node.id
if CONF.feat... | the_stack_v2_python_sparse | scalarizr/lifecycle/test_discovery_manager.py | Scalr/revizor-tests | train | 0 | |
faac29f81eed167eff719c30e413bea06098fe85 | [
"ans = []\nself.removeHelper(s, 0, 0, '(', ')', ans)\nreturn ans",
"sum = 0\nfor i in range(last_i, len(s)):\n if s[i] == char1:\n sum += 1\n if s[i] == char2:\n sum -= 1\n if sum >= 0:\n continue\n for j in range(last_j, i + 1):\n if s[j] == char2 and (j == last_j or s[j] ... | <|body_start_0|>
ans = []
self.removeHelper(s, 0, 0, '(', ')', ans)
return ans
<|end_body_0|>
<|body_start_1|>
sum = 0
for i in range(last_i, len(s)):
if s[i] == char1:
sum += 1
if s[i] == char2:
sum -= 1
if sum... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeInvalidParentheses(self, s):
""":type s: str :rtype: List[str]"""
<|body_0|>
def removeHelper(self, s, last_i, last_j, char1, char2, ans):
"""Remove invalid parentheses in two rounds: 1st round: detect ')' appears more times then '(' 2nd round: de... | stack_v2_sparse_classes_10k_train_006289 | 1,373 | no_license | [
{
"docstring": ":type s: str :rtype: List[str]",
"name": "removeInvalidParentheses",
"signature": "def removeInvalidParentheses(self, s)"
},
{
"docstring": "Remove invalid parentheses in two rounds: 1st round: detect ')' appears more times then '(' 2nd round: detect '(' appears more times then '... | 2 | stack_v2_sparse_classes_30k_val_000304 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeInvalidParentheses(self, s): :type s: str :rtype: List[str]
- def removeHelper(self, s, last_i, last_j, char1, char2, ans): Remove invalid parentheses in two rounds: 1s... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeInvalidParentheses(self, s): :type s: str :rtype: List[str]
- def removeHelper(self, s, last_i, last_j, char1, char2, ans): Remove invalid parentheses in two rounds: 1s... | 83f95caa3f7a487e8561e69133772d5add4484e1 | <|skeleton|>
class Solution:
def removeInvalidParentheses(self, s):
""":type s: str :rtype: List[str]"""
<|body_0|>
def removeHelper(self, s, last_i, last_j, char1, char2, ans):
"""Remove invalid parentheses in two rounds: 1st round: detect ')' appears more times then '(' 2nd round: de... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def removeInvalidParentheses(self, s):
""":type s: str :rtype: List[str]"""
ans = []
self.removeHelper(s, 0, 0, '(', ')', ans)
return ans
def removeHelper(self, s, last_i, last_j, char1, char2, ans):
"""Remove invalid parentheses in two rounds: 1st round:... | the_stack_v2_python_sparse | algorithms.master/invalid paranthesis.py | apk2129/_personal | train | 0 | |
3e9a70f2bb3186f5131a38c2b73f67a7b582a5f0 | [
"super(Recorder, self).__init__()\nself.symbols = symbols\nself.timer_frequency = SNAPSHOT_RATE\nself.workers = dict()\nself.current_time = dt.now()\nself.daemon = False",
"coinbase, bitfinex = self.symbols\nself.workers[coinbase] = CoinbaseClient(sym=coinbase)\nself.workers[bitfinex] = BitfinexClient(sym=bitfine... | <|body_start_0|>
super(Recorder, self).__init__()
self.symbols = symbols
self.timer_frequency = SNAPSHOT_RATE
self.workers = dict()
self.current_time = dt.now()
self.daemon = False
<|end_body_0|>
<|body_start_1|>
coinbase, bitfinex = self.symbols
self.wor... | Recorder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Recorder:
def __init__(self, symbols):
"""Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')]"""
<|body_0|>
def run(self) -> None:
"""New process created to instantiate limit order books for (1) Coinba... | stack_v2_sparse_classes_10k_train_006290 | 4,752 | no_license | [
{
"docstring": "Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')]",
"name": "__init__",
"signature": "def __init__(self, symbols)"
},
{
"docstring": "New process created to instantiate limit order books for (1) Coinbase Pro, and... | 3 | stack_v2_sparse_classes_30k_train_002959 | Implement the Python class `Recorder` described below.
Class description:
Implement the Recorder class.
Method signatures and docstrings:
- def __init__(self, symbols): Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')]
- def run(self) -> None: New pr... | Implement the Python class `Recorder` described below.
Class description:
Implement the Recorder class.
Method signatures and docstrings:
- def __init__(self, symbols): Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')]
- def run(self) -> None: New pr... | 078081e5715cadeae9c798a3d759c9d59d2041bc | <|skeleton|>
class Recorder:
def __init__(self, symbols):
"""Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')]"""
<|body_0|>
def run(self) -> None:
"""New process created to instantiate limit order books for (1) Coinba... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Recorder:
def __init__(self, symbols):
"""Constructor of Recorder. :param symbols: basket of securities to record... Example: symbols = [('BTC-USD, 'tBTCUSD')]"""
super(Recorder, self).__init__()
self.symbols = symbols
self.timer_frequency = SNAPSHOT_RATE
self.workers =... | the_stack_v2_python_sparse | recorder.py | sadighian/crypto-rl | train | 676 | |
cefbd0464db5762ad670394baf0502c961302603 | [
"self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100')\nself.filtry = Caffe.objects.create(name='filtry', city='Warszawa', street='Filry', house_number='14', postal_code='44-100')\nself.cakes = Category.objects.create(name='cakes', caffe=self.caf... | <|body_start_0|>
self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100')
self.filtry = Caffe.objects.create(name='filtry', city='Warszawa', street='Filry', house_number='14', postal_code='44-100')
self.cakes = Category.objects.c... | Product tests. | ProductModelTest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProductModelTest:
"""Product tests."""
def setUp(self):
"""Test data setup."""
<|body_0|>
def test_product(self):
"""Check correctness of creating products and validation."""
<|body_1|>
def test_product_validation(self):
"""Check if Product m... | stack_v2_sparse_classes_10k_train_006291 | 14,711 | permissive | [
{
"docstring": "Test data setup.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Check correctness of creating products and validation.",
"name": "test_product",
"signature": "def test_product(self)"
},
{
"docstring": "Check if Product model is properly valid... | 3 | stack_v2_sparse_classes_30k_train_004242 | Implement the Python class `ProductModelTest` described below.
Class description:
Product tests.
Method signatures and docstrings:
- def setUp(self): Test data setup.
- def test_product(self): Check correctness of creating products and validation.
- def test_product_validation(self): Check if Product model is properl... | Implement the Python class `ProductModelTest` described below.
Class description:
Product tests.
Method signatures and docstrings:
- def setUp(self): Test data setup.
- def test_product(self): Check correctness of creating products and validation.
- def test_product_validation(self): Check if Product model is properl... | cdb7f5edb29255c7e874eaa6231621063210a8b0 | <|skeleton|>
class ProductModelTest:
"""Product tests."""
def setUp(self):
"""Test data setup."""
<|body_0|>
def test_product(self):
"""Check correctness of creating products and validation."""
<|body_1|>
def test_product_validation(self):
"""Check if Product m... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ProductModelTest:
"""Product tests."""
def setUp(self):
"""Test data setup."""
self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100')
self.filtry = Caffe.objects.create(name='filtry', city='Warszawa', street='Fil... | the_stack_v2_python_sparse | caffe/reports/test_models.py | VirrageS/io-kawiarnie | train | 3 |
91bc08739a94ee07872811b6f25477d7b6f76648 | [
"if value < 5:\n raise serializers.ValidationError('amount must be at least 5$')\nreturn value",
"amount = data['amount']\nresponse = stripe.Charge.create(amount=amount, currency='usd', source=data['stripeToken'], description='Donation')\ndatabase_amount = amount * 10\nif response.paid:\n return Donation.ob... | <|body_start_0|>
if value < 5:
raise serializers.ValidationError('amount must be at least 5$')
return value
<|end_body_0|>
<|body_start_1|>
amount = data['amount']
response = stripe.Charge.create(amount=amount, currency='usd', source=data['stripeToken'], description='Donatio... | Donation create serializer. | DonationCreateSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DonationCreateSerializer:
"""Donation create serializer."""
def validate_amount(self, value):
"""Ammount validator."""
<|body_0|>
def create(self, data):
"""Handle creation."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if value < 5:
... | stack_v2_sparse_classes_10k_train_006292 | 1,445 | no_license | [
{
"docstring": "Ammount validator.",
"name": "validate_amount",
"signature": "def validate_amount(self, value)"
},
{
"docstring": "Handle creation.",
"name": "create",
"signature": "def create(self, data)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000116 | Implement the Python class `DonationCreateSerializer` described below.
Class description:
Donation create serializer.
Method signatures and docstrings:
- def validate_amount(self, value): Ammount validator.
- def create(self, data): Handle creation. | Implement the Python class `DonationCreateSerializer` described below.
Class description:
Donation create serializer.
Method signatures and docstrings:
- def validate_amount(self, value): Ammount validator.
- def create(self, data): Handle creation.
<|skeleton|>
class DonationCreateSerializer:
"""Donation create... | e2f4557e2a85405838c6c9f65f1cb8a5f60a35ba | <|skeleton|>
class DonationCreateSerializer:
"""Donation create serializer."""
def validate_amount(self, value):
"""Ammount validator."""
<|body_0|>
def create(self, data):
"""Handle creation."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DonationCreateSerializer:
"""Donation create serializer."""
def validate_amount(self, value):
"""Ammount validator."""
if value < 5:
raise serializers.ValidationError('amount must be at least 5$')
return value
def create(self, data):
"""Handle creation."""... | the_stack_v2_python_sparse | apps/donations/serializers/donations.py | HebertFerrer/WebMaster-back-end | train | 0 |
b300b34faff5c2b1bd2577a76e083bb9bcde0776 | [
"if p.val > root.val < q.val:\n return self.lowestCommonAncestor(root.right, p, q)\nelif p.val < root.val > q.val:\n return self.lowestCommonAncestor(root.left, p, q)\nelse:\n return root",
"if root is None or root == p or root == q:\n return root\nleft = self.lowestCommonAncestor(root.left, p, q)\nri... | <|body_start_0|>
if p.val > root.val < q.val:
return self.lowestCommonAncestor(root.right, p, q)
elif p.val < root.val > q.val:
return self.lowestCommonAncestor(root.left, p, q)
else:
return root
<|end_body_0|>
<|body_start_1|>
if root is None or root... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
"""20190921 模模糊糊地有这样的概念, 最近公共祖先的值应该是介于 p 和 q 之间的, 因为分叉了, 看了覃超的算法课之后, 发现他的解法很清晰, 就是第一次分叉的那个节点就是他们的最近公共祖先 执行用时 :80 ms, 在所有 Python3 提交中击败了100.00% 的用户 内存消耗 :18 MB, 在所有 Python3 提交中击败了5.48%的... | stack_v2_sparse_classes_10k_train_006293 | 2,069 | no_license | [
{
"docstring": "20190921 模模糊糊地有这样的概念, 最近公共祖先的值应该是介于 p 和 q 之间的, 因为分叉了, 看了覃超的算法课之后, 发现他的解法很清晰, 就是第一次分叉的那个节点就是他们的最近公共祖先 执行用时 :80 ms, 在所有 Python3 提交中击败了100.00% 的用户 内存消耗 :18 MB, 在所有 Python3 提交中击败了5.48%的用户",
"name": "lowestCommonAncestor",
"signature": "def lowestCommonAncestor(self, root: 'TreeNode', p: 'Tre... | 2 | stack_v2_sparse_classes_30k_train_005477 | 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': 20190921 模模糊糊地有这样的概念, 最近公共祖先的值应该是介于 p 和 q 之间的, 因为分叉了, 看了覃超的算法课之后, 发现他的解法很清晰, 就是第一次分叉... | 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': 20190921 模模糊糊地有这样的概念, 最近公共祖先的值应该是介于 p 和 q 之间的, 因为分叉了, 看了覃超的算法课之后, 发现他的解法很清晰, 就是第一次分叉... | 99a3abf1774933af73a8405f9b59e5e64906bca4 | <|skeleton|>
class Solution:
def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
"""20190921 模模糊糊地有这样的概念, 最近公共祖先的值应该是介于 p 和 q 之间的, 因为分叉了, 看了覃超的算法课之后, 发现他的解法很清晰, 就是第一次分叉的那个节点就是他们的最近公共祖先 执行用时 :80 ms, 在所有 Python3 提交中击败了100.00% 的用户 内存消耗 :18 MB, 在所有 Python3 提交中击败了5.48%的... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
"""20190921 模模糊糊地有这样的概念, 最近公共祖先的值应该是介于 p 和 q 之间的, 因为分叉了, 看了覃超的算法课之后, 发现他的解法很清晰, 就是第一次分叉的那个节点就是他们的最近公共祖先 执行用时 :80 ms, 在所有 Python3 提交中击败了100.00% 的用户 内存消耗 :18 MB, 在所有 Python3 提交中击败了5.48%的用户"""
... | the_stack_v2_python_sparse | leetcode/235.lowest-common-ancestor-of-a-binary-search-tree.py | iamkissg/leetcode | train | 0 | |
183370fde921c6500c31865d9ff4823138b107f8 | [
"args = dict(is_add=True, locator_set_name=locator_name, sw_if_index=sw_if_index, priority=priority, weight=weight)\ncmd = u'lisp_add_del_locator'\nerr_msg = f\"Failed to add locator on host {node[u'host']}\"\nwith PapiSocketExecutor(node) as papi_exec:\n papi_exec.add(cmd, **args).get_reply(err_msg)",
"args =... | <|body_start_0|>
args = dict(is_add=True, locator_set_name=locator_name, sw_if_index=sw_if_index, priority=priority, weight=weight)
cmd = u'lisp_add_del_locator'
err_msg = f"Failed to add locator on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
papi_exec.a... | Class for the Lisp Locator API. | LispLocator | [
"GPL-1.0-or-later",
"CC-BY-4.0",
"Apache-2.0",
"LicenseRef-scancode-dco-1.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LispLocator:
"""Class for the Lisp Locator API."""
def vpp_add_lisp_locator(node, locator_name, sw_if_index, priority, weight):
"""Set lisp locator on the VPP node in topology. :param node: VPP node. :param locator_name: Name of the locator_set. :param sw_if_index: Sw_if_index if the... | stack_v2_sparse_classes_10k_train_006294 | 14,690 | permissive | [
{
"docstring": "Set lisp locator on the VPP node in topology. :param node: VPP node. :param locator_name: Name of the locator_set. :param sw_if_index: Sw_if_index if the interface. :param priority: Priority of the locator. :param weight: Weight of the locator. :type node: dict :type locator_name: str :type sw_i... | 2 | stack_v2_sparse_classes_30k_train_000350 | Implement the Python class `LispLocator` described below.
Class description:
Class for the Lisp Locator API.
Method signatures and docstrings:
- def vpp_add_lisp_locator(node, locator_name, sw_if_index, priority, weight): Set lisp locator on the VPP node in topology. :param node: VPP node. :param locator_name: Name o... | Implement the Python class `LispLocator` described below.
Class description:
Class for the Lisp Locator API.
Method signatures and docstrings:
- def vpp_add_lisp_locator(node, locator_name, sw_if_index, priority, weight): Set lisp locator on the VPP node in topology. :param node: VPP node. :param locator_name: Name o... | 947057d7310cd1602119258c6b82fbb25fe1b79d | <|skeleton|>
class LispLocator:
"""Class for the Lisp Locator API."""
def vpp_add_lisp_locator(node, locator_name, sw_if_index, priority, weight):
"""Set lisp locator on the VPP node in topology. :param node: VPP node. :param locator_name: Name of the locator_set. :param sw_if_index: Sw_if_index if the... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LispLocator:
"""Class for the Lisp Locator API."""
def vpp_add_lisp_locator(node, locator_name, sw_if_index, priority, weight):
"""Set lisp locator on the VPP node in topology. :param node: VPP node. :param locator_name: Name of the locator_set. :param sw_if_index: Sw_if_index if the interface. :... | the_stack_v2_python_sparse | resources/libraries/python/LispSetup.py | FDio/csit | train | 28 |
a862a36bd53f76d46770aab0978dbe76a93d5cda | [
"self.db = db\nself.meg_maps = dict()\nself.bands = dict()\nself.exponent_map = dict({'Exponents': np.array([])})\nself.oscs_loaded = False\nself.exponents_loaded = False",
"osc_maps_file = os.path.join(self.db.maps_path, 'Oscs', osc_file + '.p')\ndat_in = pickle.load(open(osc_maps_file, 'rb'))\nself.bands = dat_... | <|body_start_0|>
self.db = db
self.meg_maps = dict()
self.bands = dict()
self.exponent_map = dict({'Exponents': np.array([])})
self.oscs_loaded = False
self.exponents_loaded = False
<|end_body_0|>
<|body_start_1|>
osc_maps_file = os.path.join(self.db.maps_path, '... | Class for storing and comparing spatial topographies. | MapCompBase | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MapCompBase:
"""Class for storing and comparing spatial topographies."""
def __init__(self, db):
"""Initialize object with omegamappin database. Parameters ---------- db : OMDB() object Database object for omegamappin project."""
<|body_0|>
def load_meg_maps(self, osc_fi... | stack_v2_sparse_classes_10k_train_006295 | 3,451 | permissive | [
{
"docstring": "Initialize object with omegamappin database. Parameters ---------- db : OMDB() object Database object for omegamappin project.",
"name": "__init__",
"signature": "def __init__(self, db)"
},
{
"docstring": "Load the spatial maps of MEG data (oscillation bands). Parameters --------... | 3 | stack_v2_sparse_classes_30k_train_001917 | Implement the Python class `MapCompBase` described below.
Class description:
Class for storing and comparing spatial topographies.
Method signatures and docstrings:
- def __init__(self, db): Initialize object with omegamappin database. Parameters ---------- db : OMDB() object Database object for omegamappin project.
... | Implement the Python class `MapCompBase` described below.
Class description:
Class for storing and comparing spatial topographies.
Method signatures and docstrings:
- def __init__(self, db): Initialize object with omegamappin database. Parameters ---------- db : OMDB() object Database object for omegamappin project.
... | 5e744ccb4b818cf2fa39f09fc4c8625d24c30e98 | <|skeleton|>
class MapCompBase:
"""Class for storing and comparing spatial topographies."""
def __init__(self, db):
"""Initialize object with omegamappin database. Parameters ---------- db : OMDB() object Database object for omegamappin project."""
<|body_0|>
def load_meg_maps(self, osc_fi... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MapCompBase:
"""Class for storing and comparing spatial topographies."""
def __init__(self, db):
"""Initialize object with omegamappin database. Parameters ---------- db : OMDB() object Database object for omegamappin project."""
self.db = db
self.meg_maps = dict()
self.ba... | the_stack_v2_python_sparse | om/maps/base.py | voytekresearch/omapping | train | 0 |
d0642507d38de59877e3b9bba1e5cdf3f7a9367d | [
"primary_heartbeat = primary_mgt if not primary_heartbeat else primary_heartbeat\nphysical_interfaces = []\nfor interface in interfaces:\n if 'interface_id' not in interface:\n raise CreateEngineFailed('Interface definitions must contain the interface_id field. Failed to create engine: %s' % name)\n if... | <|body_start_0|>
primary_heartbeat = primary_mgt if not primary_heartbeat else primary_heartbeat
physical_interfaces = []
for interface in interfaces:
if 'interface_id' not in interface:
raise CreateEngineFailed('Interface definitions must contain the interface_id fie... | Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interface.add_layer3_cluster_interface` | FirewallCluster | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FirewallCluster:
"""Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interface.add_layer3_cluster_interface`"""
... | stack_v2_sparse_classes_10k_train_006296 | 39,353 | permissive | [
{
"docstring": ":param dict snmp: SNMP dict should have keys `snmp_agent` str defining name of SNMPAgent, `snmp_interface` which is a list of interface IDs, and optionally `snmp_location` which is a string with the SNMP location name.",
"name": "create_bulk",
"signature": "def create_bulk(cls, name, int... | 2 | stack_v2_sparse_classes_30k_val_000391 | Implement the Python class `FirewallCluster` described below.
Class description:
Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interfac... | Implement the Python class `FirewallCluster` described below.
Class description:
Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interfac... | 54386c8a710727cc1acf69334a57b155d2f5408c | <|skeleton|>
class FirewallCluster:
"""Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interface.add_layer3_cluster_interface`"""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FirewallCluster:
"""Firewall Cluster Creates a layer 3 firewall cluster engine with CVI and NDI's. Once engine is created, you can later add additional interfaces using the `engine.physical_interface` reference. .. seealso:: :func:`smc.core.physical_interface.add_layer3_cluster_interface`"""
def create_b... | the_stack_v2_python_sparse | smc/core/engines.py | gabstopper/smc-python | train | 31 |
8e32ba5baf6f91b4f865ee937cd5284d503a14fc | [
"N = len(nums)\nans = [1] * N\nfor i in range(1, N):\n ans[i] = nums[i - 1] * ans[i - 1]\nright = 1\nfor i in range(N - 1, -1, -1):\n ans[i] *= right\n right = right * nums[i]\nreturn ans",
"N = len(nums)\nL = [1] * N\nR = [1] * N\nans = [1] * N\nfor i in range(1, N):\n L[i] = nums[i - 1] * L[i - 1]\n... | <|body_start_0|>
N = len(nums)
ans = [1] * N
for i in range(1, N):
ans[i] = nums[i - 1] * ans[i - 1]
right = 1
for i in range(N - 1, -1, -1):
ans[i] *= right
right = right * nums[i]
return ans
<|end_body_0|>
<|body_start_1|>
N ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def productExceptSelfO1Space(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def productExceptSelf(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
N = len(nums)
... | stack_v2_sparse_classes_10k_train_006297 | 1,592 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "productExceptSelfO1Space",
"signature": "def productExceptSelfO1Space(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "productExceptSelf",
"signature": "def productExceptSelf(self, nums)"... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def productExceptSelfO1Space(self, nums): :type nums: List[int] :rtype: List[int]
- def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def productExceptSelfO1Space(self, nums): :type nums: List[int] :rtype: List[int]
- def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int]
<|skeleton|>
class... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def productExceptSelfO1Space(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def productExceptSelf(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def productExceptSelfO1Space(self, nums):
""":type nums: List[int] :rtype: List[int]"""
N = len(nums)
ans = [1] * N
for i in range(1, N):
ans[i] = nums[i - 1] * ans[i - 1]
right = 1
for i in range(N - 1, -1, -1):
ans[i] *= right... | the_stack_v2_python_sparse | P/ProductofArrayExceptSelf.py | bssrdf/pyleet | train | 2 | |
ce5ff41227402d99412c197b2dcfd4a113492449 | [
"super(FLAME, self).__init__(*args, **kwargs)\nself.keypoint_src = keypoint_src\nself.keypoint_dst = keypoint_dst\nself.keypoint_approximate = keypoint_approximate\nself.num_verts = self.get_num_verts()\nself.num_faces = self.get_num_faces()\nself.num_joints = get_keypoint_num(convention=self.keypoint_dst)",
"fla... | <|body_start_0|>
super(FLAME, self).__init__(*args, **kwargs)
self.keypoint_src = keypoint_src
self.keypoint_dst = keypoint_dst
self.keypoint_approximate = keypoint_approximate
self.num_verts = self.get_num_verts()
self.num_faces = self.get_num_faces()
self.num_jo... | Extension of the official FLAME implementation. | FLAME | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FLAME:
"""Extension of the official FLAME implementation."""
def __init__(self, *args, keypoint_src: str='flame', keypoint_dst: str='human_data', keypoint_approximate: bool=False, **kwargs):
"""Args: *args: extra arguments for FLAME initialization. keypoint_src: source convention of ... | stack_v2_sparse_classes_10k_train_006298 | 6,673 | permissive | [
{
"docstring": "Args: *args: extra arguments for FLAME initialization. keypoint_src: source convention of keypoints. This convention is used for keypoints obtained from joint regressors. Keypoints then undergo conversion into keypoint_dst convention. keypoint_dst: destination convention of keypoints. This conve... | 2 | null | Implement the Python class `FLAME` described below.
Class description:
Extension of the official FLAME implementation.
Method signatures and docstrings:
- def __init__(self, *args, keypoint_src: str='flame', keypoint_dst: str='human_data', keypoint_approximate: bool=False, **kwargs): Args: *args: extra arguments for ... | Implement the Python class `FLAME` described below.
Class description:
Extension of the official FLAME implementation.
Method signatures and docstrings:
- def __init__(self, *args, keypoint_src: str='flame', keypoint_dst: str='human_data', keypoint_approximate: bool=False, **kwargs): Args: *args: extra arguments for ... | 9431addec32f7fbeffa1786927a854c0ab79d9ea | <|skeleton|>
class FLAME:
"""Extension of the official FLAME implementation."""
def __init__(self, *args, keypoint_src: str='flame', keypoint_dst: str='human_data', keypoint_approximate: bool=False, **kwargs):
"""Args: *args: extra arguments for FLAME initialization. keypoint_src: source convention of ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FLAME:
"""Extension of the official FLAME implementation."""
def __init__(self, *args, keypoint_src: str='flame', keypoint_dst: str='human_data', keypoint_approximate: bool=False, **kwargs):
"""Args: *args: extra arguments for FLAME initialization. keypoint_src: source convention of keypoints. Th... | the_stack_v2_python_sparse | mmhuman3d/models/body_models/flame.py | open-mmlab/mmhuman3d | train | 966 |
85dfd7318ed8eb3f68e1aad19c6fdd6f37e1e4f7 | [
"gm_track = gmusic.GMusicTrack(title='Zhao Hua', artist='HVAD & Pan Daijing')\nexpected = ['HVAD', 'Pan Daijing']\nactual = gmspotify.get_gm_track_artists(gm_track)\nself.assertEqual(actual, expected)",
"gm_track = gmusic.GMusicTrack(title='Stretch Deep (feat. Eve Essex)', artist='James K')\nexpected = ['Eve Esse... | <|body_start_0|>
gm_track = gmusic.GMusicTrack(title='Zhao Hua', artist='HVAD & Pan Daijing')
expected = ['HVAD', 'Pan Daijing']
actual = gmspotify.get_gm_track_artists(gm_track)
self.assertEqual(actual, expected)
<|end_body_0|>
<|body_start_1|>
gm_track = gmusic.GMusicTrack(tit... | TestGetGMTrackArtists | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestGetGMTrackArtists:
def test_get_gm_track_artists_ampersand(self):
"""Given a GM Track with an artist string containing multiple artists Should return a list of those artists"""
<|body_0|>
def test_get_gm_track_artists_ft_1(self):
"""Given a GM Track with a title ... | stack_v2_sparse_classes_10k_train_006299 | 9,283 | no_license | [
{
"docstring": "Given a GM Track with an artist string containing multiple artists Should return a list of those artists",
"name": "test_get_gm_track_artists_ampersand",
"signature": "def test_get_gm_track_artists_ampersand(self)"
},
{
"docstring": "Given a GM Track with a title featuring an art... | 3 | stack_v2_sparse_classes_30k_train_001898 | Implement the Python class `TestGetGMTrackArtists` described below.
Class description:
Implement the TestGetGMTrackArtists class.
Method signatures and docstrings:
- def test_get_gm_track_artists_ampersand(self): Given a GM Track with an artist string containing multiple artists Should return a list of those artists
... | Implement the Python class `TestGetGMTrackArtists` described below.
Class description:
Implement the TestGetGMTrackArtists class.
Method signatures and docstrings:
- def test_get_gm_track_artists_ampersand(self): Given a GM Track with an artist string containing multiple artists Should return a list of those artists
... | a29a9771ee1f03650b367b22d5a2bcbabc4d3990 | <|skeleton|>
class TestGetGMTrackArtists:
def test_get_gm_track_artists_ampersand(self):
"""Given a GM Track with an artist string containing multiple artists Should return a list of those artists"""
<|body_0|>
def test_get_gm_track_artists_ft_1(self):
"""Given a GM Track with a title ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestGetGMTrackArtists:
def test_get_gm_track_artists_ampersand(self):
"""Given a GM Track with an artist string containing multiple artists Should return a list of those artists"""
gm_track = gmusic.GMusicTrack(title='Zhao Hua', artist='HVAD & Pan Daijing')
expected = ['HVAD', 'Pan Dai... | the_stack_v2_python_sparse | test_gmspotify.py | jdheyburn/gmspotify | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.