blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
3fcc0b2735541cbdcfcf84c9e944b05d218b696c
[ "genus = Integer(genus)\nif not genus >= 0:\n raise ValueError('genus must be positive')\nif marked_separatrix is None:\n marked_separatrix = 'no'\nif not marked_separatrix in ['no', 'out', 'in']:\n raise ValueError('marked_separatrix must be no, out or in')\nself._marked_separatrix = marked_separatrix\nse...
<|body_start_0|> genus = Integer(genus) if not genus >= 0: raise ValueError('genus must be positive') if marked_separatrix is None: marked_separatrix = 'no' if not marked_separatrix in ['no', 'out', 'in']: raise ValueError('marked_separatrix must be no...
Stratas of genus g surfaces. INPUT: - ``genus`` - a non negative integer - ``marked_separatrix`` - 'no', 'out' or 'in'
AbelianStrata_g
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbelianStrata_g: """Stratas of genus g surfaces. INPUT: - ``genus`` - a non negative integer - ``marked_separatrix`` - 'no', 'out' or 'in'""" def __init__(self, genus=None, marked_separatrix=None): """TESTS:: sage: s = AbelianStrata(genus=3) sage: s == loads(dumps(s)) True sage: Abel...
stack_v2_sparse_classes_36k_train_021900
49,724
no_license
[ { "docstring": "TESTS:: sage: s = AbelianStrata(genus=3) sage: s == loads(dumps(s)) True sage: AbelianStrata(genus=-3) Traceback (most recent call last): ... ValueError: genus must be positive sage: AbelianStrata(genus=3, marked_separatrix='yes') Traceback (most recent call last): ... ValueError: marked_separat...
3
null
Implement the Python class `AbelianStrata_g` described below. Class description: Stratas of genus g surfaces. INPUT: - ``genus`` - a non negative integer - ``marked_separatrix`` - 'no', 'out' or 'in' Method signatures and docstrings: - def __init__(self, genus=None, marked_separatrix=None): TESTS:: sage: s = AbelianS...
Implement the Python class `AbelianStrata_g` described below. Class description: Stratas of genus g surfaces. INPUT: - ``genus`` - a non negative integer - ``marked_separatrix`` - 'no', 'out' or 'in' Method signatures and docstrings: - def __init__(self, genus=None, marked_separatrix=None): TESTS:: sage: s = AbelianS...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class AbelianStrata_g: """Stratas of genus g surfaces. INPUT: - ``genus`` - a non negative integer - ``marked_separatrix`` - 'no', 'out' or 'in'""" def __init__(self, genus=None, marked_separatrix=None): """TESTS:: sage: s = AbelianStrata(genus=3) sage: s == loads(dumps(s)) True sage: Abel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AbelianStrata_g: """Stratas of genus g surfaces. INPUT: - ``genus`` - a non negative integer - ``marked_separatrix`` - 'no', 'out' or 'in'""" def __init__(self, genus=None, marked_separatrix=None): """TESTS:: sage: s = AbelianStrata(genus=3) sage: s == loads(dumps(s)) True sage: AbelianStrata(gen...
the_stack_v2_python_sparse
sage/src/sage/dynamics/flat_surfaces/strata.py
bopopescu/geosci
train
0
c114fc40f51d2ab2100d5669e103904de43f946f
[ "request_data = request.GET\nticket_id = kwargs.get('ticket_id')\napp_name = request.META.get('HTTP_APPNAME')\napp_permission_check, msg = account_base_service_ins.app_ticket_permission_check(app_name, ticket_id)\nif not app_permission_check:\n return api_response(-1, msg, '')\nusername = request.META.get('HTTP_...
<|body_start_0|> request_data = request.GET ticket_id = kwargs.get('ticket_id') app_name = request.META.get('HTTP_APPNAME') app_permission_check, msg = account_base_service_ins.app_ticket_permission_check(app_name, ticket_id) if not app_permission_check: return api_re...
TicketView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TicketView: def get(self, request, *args, **kwargs): """获取工单详情,根据用户返回不同的内容(是否有工单表单的编辑权限) :param request: :param args: :param kwargs: :return:""" <|body_0|> def patch(self, request, *args, **kwargs): """处理工单 :param request: :param args: :param kwargs: :return:""" ...
stack_v2_sparse_classes_36k_train_021901
26,311
permissive
[ { "docstring": "获取工单详情,根据用户返回不同的内容(是否有工单表单的编辑权限) :param request: :param args: :param kwargs: :return:", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "处理工单 :param request: :param args: :param kwargs: :return:", "name": "patch", "signature": "def ...
3
stack_v2_sparse_classes_30k_train_016942
Implement the Python class `TicketView` described below. Class description: Implement the TicketView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 获取工单详情,根据用户返回不同的内容(是否有工单表单的编辑权限) :param request: :param args: :param kwargs: :return: - def patch(self, request, *args, **kwargs): 处理...
Implement the Python class `TicketView` described below. Class description: Implement the TicketView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 获取工单详情,根据用户返回不同的内容(是否有工单表单的编辑权限) :param request: :param args: :param kwargs: :return: - def patch(self, request, *args, **kwargs): 处理...
b0e236b314286c5f6cc6959622c9c8505e776443
<|skeleton|> class TicketView: def get(self, request, *args, **kwargs): """获取工单详情,根据用户返回不同的内容(是否有工单表单的编辑权限) :param request: :param args: :param kwargs: :return:""" <|body_0|> def patch(self, request, *args, **kwargs): """处理工单 :param request: :param args: :param kwargs: :return:""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TicketView: def get(self, request, *args, **kwargs): """获取工单详情,根据用户返回不同的内容(是否有工单表单的编辑权限) :param request: :param args: :param kwargs: :return:""" request_data = request.GET ticket_id = kwargs.get('ticket_id') app_name = request.META.get('HTTP_APPNAME') app_permission_che...
the_stack_v2_python_sparse
apps/ticket/views.py
blackholll/loonflow
train
1,864
2436376d98e548df6b8be205d01fe620f077f7c9
[ "if not isinstance(alph_idx, Base58Alphabets):\n raise TypeError('Alphabet index is not an enumerative of Base58Alphabets')\nalphabet = Base58Const.ALPHABETS[alph_idx]\nval = 0\nfor i, c in enumerate(data_str[::-1]):\n val += alphabet.index(c) * Base58Const.RADIX ** i\ndec = bytearray()\nwhile val > 0:\n v...
<|body_start_0|> if not isinstance(alph_idx, Base58Alphabets): raise TypeError('Alphabet index is not an enumerative of Base58Alphabets') alphabet = Base58Const.ALPHABETS[alph_idx] val = 0 for i, c in enumerate(data_str[::-1]): val += alphabet.index(c) * Base58Con...
Base58 decoder class. It provides methods for decoding and checksum decoding Base58 format.
Base58Decoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base58Decoder: """Base58 decoder class. It provides methods for decoding and checksum decoding Base58 format.""" def Decode(data_str: str, alph_idx: Base58Alphabets=Base58Alphabets.BITCOIN) -> bytes: """Decode bytes from a Base58 string. Args: data_str (str) : Data string alph_idx (B...
stack_v2_sparse_classes_36k_train_021902
6,906
permissive
[ { "docstring": "Decode bytes from a Base58 string. Args: data_str (str) : Data string alph_idx (Base58Alphabets, optional): Alphabet index, Bitcoin by default Returns: bytes: Decoded bytes Raises: TypeError: If alphabet index is not a Base58Alphabets enumerative", "name": "Decode", "signature": "def Dec...
2
stack_v2_sparse_classes_30k_train_003778
Implement the Python class `Base58Decoder` described below. Class description: Base58 decoder class. It provides methods for decoding and checksum decoding Base58 format. Method signatures and docstrings: - def Decode(data_str: str, alph_idx: Base58Alphabets=Base58Alphabets.BITCOIN) -> bytes: Decode bytes from a Base...
Implement the Python class `Base58Decoder` described below. Class description: Base58 decoder class. It provides methods for decoding and checksum decoding Base58 format. Method signatures and docstrings: - def Decode(data_str: str, alph_idx: Base58Alphabets=Base58Alphabets.BITCOIN) -> bytes: Decode bytes from a Base...
d15c75ddd74e4838c396a0d036ef6faf11b06a4b
<|skeleton|> class Base58Decoder: """Base58 decoder class. It provides methods for decoding and checksum decoding Base58 format.""" def Decode(data_str: str, alph_idx: Base58Alphabets=Base58Alphabets.BITCOIN) -> bytes: """Decode bytes from a Base58 string. Args: data_str (str) : Data string alph_idx (B...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Base58Decoder: """Base58 decoder class. It provides methods for decoding and checksum decoding Base58 format.""" def Decode(data_str: str, alph_idx: Base58Alphabets=Base58Alphabets.BITCOIN) -> bytes: """Decode bytes from a Base58 string. Args: data_str (str) : Data string alph_idx (Base58Alphabet...
the_stack_v2_python_sparse
bip_utils/base58/base58.py
ebellocchia/bip_utils
train
244
e4d0eb79c819bf5851fbf2d7a759e52397a0c087
[ "super().__init__()\nself.cost_class = cost_class\nself.cost_bbox = cost_bbox\nself.cost_giou = cost_giou\nassert cost_class != 0 or cost_bbox != 0 or cost_giou != 0, 'all costs cant be 0'", "bs, num_queries = outputs['pred_logits'].shape[:2]\npred_logits = outputs['pred_logits']\npred_boxes = outputs['pred_boxes...
<|body_start_0|> super().__init__() self.cost_class = cost_class self.cost_bbox = cost_bbox self.cost_giou = cost_giou assert cost_class != 0 or cost_bbox != 0 or cost_giou != 0, 'all costs cant be 0' <|end_body_0|> <|body_start_1|> bs, num_queries = outputs['pred_logits...
This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the best predictions, while the others are un-matched (...
HungarianMatcher
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HungarianMatcher: """This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the best pr...
stack_v2_sparse_classes_36k_train_021903
5,312
permissive
[ { "docstring": "Creates the matcher Params: cost_class: This is the relative weight of the classification error in the matching cost cost_bbox: This is the relative weight of the L1 error of the bounding box coordinates in the matching cost cost_giou: This is the relative weight of the giou loss of the bounding...
2
null
Implement the Python class `HungarianMatcher` described below. Class description: This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case,...
Implement the Python class `HungarianMatcher` described below. Class description: This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case,...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class HungarianMatcher: """This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the best pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HungarianMatcher: """This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the best predictions, wh...
the_stack_v2_python_sparse
research/cv/detr/src/matcher.py
mindspore-ai/models
train
301
9db1feedb9a50452257eeb67949f75d50f15565c
[ "self.statevar = ['swq']\nself.obsvar = 'snow_cover'\nself.uncert = uncert", "data = {}\ndb = dbio.connect(models.dbname)\ncur = db.cursor()\nfor s in self.statevar:\n sql = \"select ensemble,st_x(geom),st_y(geom),val from (select ensemble,(ST_PixelAsCentroids(rast)).* from {0}.{1} where fdate=date '{2}-{3}-{4...
<|body_start_0|> self.statevar = ['swq'] self.obsvar = 'snow_cover' self.uncert = uncert <|end_body_0|> <|body_start_1|> data = {} db = dbio.connect(models.dbname) cur = db.cursor() for s in self.statevar: sql = "select ensemble,st_x(geom),st_y(geom),...
Snowcover
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Snowcover: def __init__(self, uncert=None): """Initialize MODSCAG snow cover fraction object.""" <|body_0|> def x(self, dt, models): """Retrieve state variable from database.""" <|body_1|> def get(self, dt, models): """Retrieve observations from ...
stack_v2_sparse_classes_36k_train_021904
2,788
permissive
[ { "docstring": "Initialize MODSCAG snow cover fraction object.", "name": "__init__", "signature": "def __init__(self, uncert=None)" }, { "docstring": "Retrieve state variable from database.", "name": "x", "signature": "def x(self, dt, models)" }, { "docstring": "Retrieve observat...
4
stack_v2_sparse_classes_30k_train_008547
Implement the Python class `Snowcover` described below. Class description: Implement the Snowcover class. Method signatures and docstrings: - def __init__(self, uncert=None): Initialize MODSCAG snow cover fraction object. - def x(self, dt, models): Retrieve state variable from database. - def get(self, dt, models): R...
Implement the Python class `Snowcover` described below. Class description: Implement the Snowcover class. Method signatures and docstrings: - def __init__(self, uncert=None): Initialize MODSCAG snow cover fraction object. - def x(self, dt, models): Retrieve state variable from database. - def get(self, dt, models): R...
27d0abcaeefd8760ce68e05e52905aea5f8f3a51
<|skeleton|> class Snowcover: def __init__(self, uncert=None): """Initialize MODSCAG snow cover fraction object.""" <|body_0|> def x(self, dt, models): """Retrieve state variable from database.""" <|body_1|> def get(self, dt, models): """Retrieve observations from ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Snowcover: def __init__(self, uncert=None): """Initialize MODSCAG snow cover fraction object.""" self.statevar = ['swq'] self.obsvar = 'snow_cover' self.uncert = uncert def x(self, dt, models): """Retrieve state variable from database.""" data = {} ...
the_stack_v2_python_sparse
src/datasets/snowcover.py
nasa/RHEAS
train
88
14f58c051bd45199cc2f55a79f4e9885f8a9c5e8
[ "if fe.ff_views in self.MAPPING:\n fe.ff_views = self.MAPPING[fe.ff_views]\n return True\nreturn False", "self.require_cron_header()\nfeatures: ndb.Query = FeatureEntry.query(FeatureEntry.ff_views != NO_PUBLIC_SIGNALS)\ncount = 0\nbatch = []\nBATCH_SIZE = 100\nfor fe in features:\n if self.update_ff_view...
<|body_start_0|> if fe.ff_views in self.MAPPING: fe.ff_views = self.MAPPING[fe.ff_views] return True return False <|end_body_0|> <|body_start_1|> self.require_cron_header() features: ndb.Query = FeatureEntry.query(FeatureEntry.ff_views != NO_PUBLIC_SIGNALS) ...
MigrateGeckoViews
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MigrateGeckoViews: def update_ff_views(self, fe): """Update ff_views and return True if update was needed.""" <|body_0|> def get_template_data(self, **kwargs): """Change gecko views from old options to a more common list.""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_36k_train_021905
7,549
permissive
[ { "docstring": "Update ff_views and return True if update was needed.", "name": "update_ff_views", "signature": "def update_ff_views(self, fe)" }, { "docstring": "Change gecko views from old options to a more common list.", "name": "get_template_data", "signature": "def get_template_data...
2
stack_v2_sparse_classes_30k_train_015325
Implement the Python class `MigrateGeckoViews` described below. Class description: Implement the MigrateGeckoViews class. Method signatures and docstrings: - def update_ff_views(self, fe): Update ff_views and return True if update was needed. - def get_template_data(self, **kwargs): Change gecko views from old option...
Implement the Python class `MigrateGeckoViews` described below. Class description: Implement the MigrateGeckoViews class. Method signatures and docstrings: - def update_ff_views(self, fe): Update ff_views and return True if update was needed. - def get_template_data(self, **kwargs): Change gecko views from old option...
17f9886d064da5bda84006d5866077727646fff2
<|skeleton|> class MigrateGeckoViews: def update_ff_views(self, fe): """Update ff_views and return True if update was needed.""" <|body_0|> def get_template_data(self, **kwargs): """Change gecko views from old options to a more common list.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MigrateGeckoViews: def update_ff_views(self, fe): """Update ff_views and return True if update was needed.""" if fe.ff_views in self.MAPPING: fe.ff_views = self.MAPPING[fe.ff_views] return True return False def get_template_data(self, **kwargs): """...
the_stack_v2_python_sparse
internals/maintenance_scripts.py
GoogleChrome/chromium-dashboard
train
574
8f08a3634154cb2bc8caada8c7b81685d16f84bf
[ "provinces = 0\nvisited = set()\nq = deque()\nfor left in range(len(is_connected)):\n if left not in visited:\n q.append(left)\n while q:\n curr = q.popleft()\n if curr not in visited:\n visited.add(curr)\n for neighbor in range(len(is_connected)):\n ...
<|body_start_0|> provinces = 0 visited = set() q = deque() for left in range(len(is_connected)): if left not in visited: q.append(left) while q: curr = q.popleft() if curr not in visited: ...
City
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class City: def number_of_provinces_bfs(self, is_connected: List[List[int]]) -> int: """Approach: BFS Time Complexity: O(N^2) Space Complexity: O(N) :param is_connected: :return:""" <|body_0|> def number_of_provinces_dfs(self, is_connected: List[List[int]]) -> int: """Appr...
stack_v2_sparse_classes_36k_train_021906
2,443
no_license
[ { "docstring": "Approach: BFS Time Complexity: O(N^2) Space Complexity: O(N) :param is_connected: :return:", "name": "number_of_provinces_bfs", "signature": "def number_of_provinces_bfs(self, is_connected: List[List[int]]) -> int" }, { "docstring": "Approach: DFS Time Complexity: O(N^2) Space Co...
2
stack_v2_sparse_classes_30k_train_007151
Implement the Python class `City` described below. Class description: Implement the City class. Method signatures and docstrings: - def number_of_provinces_bfs(self, is_connected: List[List[int]]) -> int: Approach: BFS Time Complexity: O(N^2) Space Complexity: O(N) :param is_connected: :return: - def number_of_provin...
Implement the Python class `City` described below. Class description: Implement the City class. Method signatures and docstrings: - def number_of_provinces_bfs(self, is_connected: List[List[int]]) -> int: Approach: BFS Time Complexity: O(N^2) Space Complexity: O(N) :param is_connected: :return: - def number_of_provin...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class City: def number_of_provinces_bfs(self, is_connected: List[List[int]]) -> int: """Approach: BFS Time Complexity: O(N^2) Space Complexity: O(N) :param is_connected: :return:""" <|body_0|> def number_of_provinces_dfs(self, is_connected: List[List[int]]) -> int: """Appr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class City: def number_of_provinces_bfs(self, is_connected: List[List[int]]) -> int: """Approach: BFS Time Complexity: O(N^2) Space Complexity: O(N) :param is_connected: :return:""" provinces = 0 visited = set() q = deque() for left in range(len(is_connected)): if...
the_stack_v2_python_sparse
goldman_sachs/number_of_provinces.py
Shiv2157k/leet_code
train
1
5683f229e07f069407ec15c69ad24d472917e3ce
[ "try:\n params = request._serialize()\n headers = request.headers\n body = self.call('CreateTtsTask', params, headers=headers)\n response = json.loads(body)\n model = models.CreateTtsTaskResponse()\n model._deserialize(response['Response'])\n return model\nexcept Exception as e:\n if isinsta...
<|body_start_0|> try: params = request._serialize() headers = request.headers body = self.call('CreateTtsTask', params, headers=headers) response = json.loads(body) model = models.CreateTtsTaskResponse() model._deserialize(response['Respons...
TtsClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TtsClient: def CreateTtsTask(self, request): """本接口服务对10万字符以内的文本进行语音合成,异步返回音频结果。满足一次性合成较长文本的客户需求,如阅读播报、新闻媒体等场景。 <li>支持音频格式:mp3,wav,pcm</li> <li>支持音频采样率:16000 Hz, 8000 Hz</li> <li>支持中文普通话、英文、中英文混读、粤语合成</li> <li>支持语速、音量设置</li> <li>支持回调或轮询的方式获取结果,结果获取请参考 长文本语音合成结果查询。</li> <li>提交长文本语音合成请求后,合...
stack_v2_sparse_classes_36k_train_021907
5,886
permissive
[ { "docstring": "本接口服务对10万字符以内的文本进行语音合成,异步返回音频结果。满足一次性合成较长文本的客户需求,如阅读播报、新闻媒体等场景。 <li>支持音频格式:mp3,wav,pcm</li> <li>支持音频采样率:16000 Hz, 8000 Hz</li> <li>支持中文普通话、英文、中英文混读、粤语合成</li> <li>支持语速、音量设置</li> <li>支持回调或轮询的方式获取结果,结果获取请参考 长文本语音合成结果查询。</li> <li>提交长文本语音合成请求后,合成结果在3小时内完成,音频文件在服务端可保存24小时</li> <p></p> 长文本合成支持 SSML,语法详...
3
null
Implement the Python class `TtsClient` described below. Class description: Implement the TtsClient class. Method signatures and docstrings: - def CreateTtsTask(self, request): 本接口服务对10万字符以内的文本进行语音合成,异步返回音频结果。满足一次性合成较长文本的客户需求,如阅读播报、新闻媒体等场景。 <li>支持音频格式:mp3,wav,pcm</li> <li>支持音频采样率:16000 Hz, 8000 Hz</li> <li>支持中文普通话、英文、...
Implement the Python class `TtsClient` described below. Class description: Implement the TtsClient class. Method signatures and docstrings: - def CreateTtsTask(self, request): 本接口服务对10万字符以内的文本进行语音合成,异步返回音频结果。满足一次性合成较长文本的客户需求,如阅读播报、新闻媒体等场景。 <li>支持音频格式:mp3,wav,pcm</li> <li>支持音频采样率:16000 Hz, 8000 Hz</li> <li>支持中文普通话、英文、...
6baf00a5a56ba58b6a1123423e0a1422d17a0201
<|skeleton|> class TtsClient: def CreateTtsTask(self, request): """本接口服务对10万字符以内的文本进行语音合成,异步返回音频结果。满足一次性合成较长文本的客户需求,如阅读播报、新闻媒体等场景。 <li>支持音频格式:mp3,wav,pcm</li> <li>支持音频采样率:16000 Hz, 8000 Hz</li> <li>支持中文普通话、英文、中英文混读、粤语合成</li> <li>支持语速、音量设置</li> <li>支持回调或轮询的方式获取结果,结果获取请参考 长文本语音合成结果查询。</li> <li>提交长文本语音合成请求后,合...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TtsClient: def CreateTtsTask(self, request): """本接口服务对10万字符以内的文本进行语音合成,异步返回音频结果。满足一次性合成较长文本的客户需求,如阅读播报、新闻媒体等场景。 <li>支持音频格式:mp3,wav,pcm</li> <li>支持音频采样率:16000 Hz, 8000 Hz</li> <li>支持中文普通话、英文、中英文混读、粤语合成</li> <li>支持语速、音量设置</li> <li>支持回调或轮询的方式获取结果,结果获取请参考 长文本语音合成结果查询。</li> <li>提交长文本语音合成请求后,合成结果在3小时内完成,音频文...
the_stack_v2_python_sparse
tencentcloud/tts/v20190823/tts_client.py
TencentCloud/tencentcloud-sdk-python
train
594
30bd1d1296bad3941e7174f1fc07a2e29b80ab5e
[ "self.num_points = num_points\nself.x_values = [ini_coords[0]]\nself.y_values = [ini_coords[1]]\nself.phi_ = []\nself.theta = 0\nself.phi = init_phi\nself.phi_.append(self.phi)\nself.deltaPhi = 0", "while len(self.x_values) < self.num_points:\n self.theta = PI / 2\n self.deltaPhi = deltaAngle(a=1 / 3)\n ...
<|body_start_0|> self.num_points = num_points self.x_values = [ini_coords[0]] self.y_values = [ini_coords[1]] self.phi_ = [] self.theta = 0 self.phi = init_phi self.phi_.append(self.phi) self.deltaPhi = 0 <|end_body_0|> <|body_start_1|> while len(...
A class to generate data.
GenerateLine2D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenerateLine2D: """A class to generate data.""" def __init__(self, ini_coords=[], init_phi=PI / 4, num_points=5000): """Initialize attributes of a data.""" <|body_0|> def fill_points(self): """Calculate all the points in the data.""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k_train_021908
20,287
no_license
[ { "docstring": "Initialize attributes of a data.", "name": "__init__", "signature": "def __init__(self, ini_coords=[], init_phi=PI / 4, num_points=5000)" }, { "docstring": "Calculate all the points in the data.", "name": "fill_points", "signature": "def fill_points(self)" } ]
2
stack_v2_sparse_classes_30k_train_006904
Implement the Python class `GenerateLine2D` described below. Class description: A class to generate data. Method signatures and docstrings: - def __init__(self, ini_coords=[], init_phi=PI / 4, num_points=5000): Initialize attributes of a data. - def fill_points(self): Calculate all the points in the data.
Implement the Python class `GenerateLine2D` described below. Class description: A class to generate data. Method signatures and docstrings: - def __init__(self, ini_coords=[], init_phi=PI / 4, num_points=5000): Initialize attributes of a data. - def fill_points(self): Calculate all the points in the data. <|skeleton...
6e7a278031ff0a1eb51e7810b326d66524d4aef3
<|skeleton|> class GenerateLine2D: """A class to generate data.""" def __init__(self, ini_coords=[], init_phi=PI / 4, num_points=5000): """Initialize attributes of a data.""" <|body_0|> def fill_points(self): """Calculate all the points in the data.""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GenerateLine2D: """A class to generate data.""" def __init__(self, ini_coords=[], init_phi=PI / 4, num_points=5000): """Initialize attributes of a data.""" self.num_points = num_points self.x_values = [ini_coords[0]] self.y_values = [ini_coords[1]] self.phi_ = [] ...
the_stack_v2_python_sparse
check_data/generate_data/generate_data.py
c-feng/Neuron-Tracking
train
1
e821956fe365552bf5e725daea7a87b27b5d45de
[ "positive_ctx = row['positive_ctx']\npositive_ctx_tokens = self.tokenizer.tokenize(positive_ctx)\npositive_ctx_token_ids, positive_ctx_segment_labels, positive_ctx_seq_len, positive_ctx_positions = self.tensorizer_script_impl.numberize([positive_ctx_tokens])\nnegative_ctxs = row['negative_ctxs']\nif negative_ctxs:\...
<|body_start_0|> positive_ctx = row['positive_ctx'] positive_ctx_tokens = self.tokenizer.tokenize(positive_ctx) positive_ctx_token_ids, positive_ctx_segment_labels, positive_ctx_seq_len, positive_ctx_positions = self.tensorizer_script_impl.numberize([positive_ctx_tokens]) negative_ctxs =...
Methods numberize() and tensorize() implement https://fburl.com/an4fv7m1.
BERTContextTensorizerForDenseRetrieval
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BERTContextTensorizerForDenseRetrieval: """Methods numberize() and tensorize() implement https://fburl.com/an4fv7m1.""" def numberize(self, row: Dict) -> Tuple[Any, ...]: """This function contains logic for converting tokens into ids based on the specified vocab. It also outputs, for...
stack_v2_sparse_classes_36k_train_021909
5,499
permissive
[ { "docstring": "This function contains logic for converting tokens into ids based on the specified vocab. It also outputs, for each instance, the vectors needed to run the actual model. It works off of one sample.", "name": "numberize", "signature": "def numberize(self, row: Dict) -> Tuple[Any, ...]" ...
2
stack_v2_sparse_classes_30k_train_016818
Implement the Python class `BERTContextTensorizerForDenseRetrieval` described below. Class description: Methods numberize() and tensorize() implement https://fburl.com/an4fv7m1. Method signatures and docstrings: - def numberize(self, row: Dict) -> Tuple[Any, ...]: This function contains logic for converting tokens in...
Implement the Python class `BERTContextTensorizerForDenseRetrieval` described below. Class description: Methods numberize() and tensorize() implement https://fburl.com/an4fv7m1. Method signatures and docstrings: - def numberize(self, row: Dict) -> Tuple[Any, ...]: This function contains logic for converting tokens in...
3bba58a048c87d7c93a41830fa7853896c4b3e66
<|skeleton|> class BERTContextTensorizerForDenseRetrieval: """Methods numberize() and tensorize() implement https://fburl.com/an4fv7m1.""" def numberize(self, row: Dict) -> Tuple[Any, ...]: """This function contains logic for converting tokens into ids based on the specified vocab. It also outputs, for...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BERTContextTensorizerForDenseRetrieval: """Methods numberize() and tensorize() implement https://fburl.com/an4fv7m1.""" def numberize(self, row: Dict) -> Tuple[Any, ...]: """This function contains logic for converting tokens into ids based on the specified vocab. It also outputs, for each instanc...
the_stack_v2_python_sparse
pytext/data/dense_retrieval_tensorizer.py
mruberry/pytext
train
2
984755bbd2c6d733c0252b21e9ee9c5b5a1e1ee0
[ "stones = {tuple(p) for p in stones}\n\ndef find_min():\n p = None\n m = float('inf')\n for i, (x, y) in enumerate(stones):\n overlaps = len(xp[x].union(yp[y])) - 1\n if 0 < overlaps < m:\n m = overlaps\n p = (x, y)\n return p\n\ndef remove_stone(p):\n xp[p[0]].rem...
<|body_start_0|> stones = {tuple(p) for p in stones} def find_min(): p = None m = float('inf') for i, (x, y) in enumerate(stones): overlaps = len(xp[x].union(yp[y])) - 1 if 0 < overlaps < m: m = overlaps ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeStones(self, stones: List[List[int]]) -> int: """05/29/2020 00:14 Incorrect""" <|body_0|> def removeStones(self, stones: List[List[int]]) -> int: """05/29/2020 00:55""" <|body_1|> def removeStones(self, stones: List[List[int]]) -> int...
stack_v2_sparse_classes_36k_train_021910
6,379
no_license
[ { "docstring": "05/29/2020 00:14 Incorrect", "name": "removeStones", "signature": "def removeStones(self, stones: List[List[int]]) -> int" }, { "docstring": "05/29/2020 00:55", "name": "removeStones", "signature": "def removeStones(self, stones: List[List[int]]) -> int" }, { "doc...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeStones(self, stones: List[List[int]]) -> int: 05/29/2020 00:14 Incorrect - def removeStones(self, stones: List[List[int]]) -> int: 05/29/2020 00:55 - def removeStones(s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeStones(self, stones: List[List[int]]) -> int: 05/29/2020 00:14 Incorrect - def removeStones(self, stones: List[List[int]]) -> int: 05/29/2020 00:55 - def removeStones(s...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def removeStones(self, stones: List[List[int]]) -> int: """05/29/2020 00:14 Incorrect""" <|body_0|> def removeStones(self, stones: List[List[int]]) -> int: """05/29/2020 00:55""" <|body_1|> def removeStones(self, stones: List[List[int]]) -> int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeStones(self, stones: List[List[int]]) -> int: """05/29/2020 00:14 Incorrect""" stones = {tuple(p) for p in stones} def find_min(): p = None m = float('inf') for i, (x, y) in enumerate(stones): overlaps = len(xp[x]...
the_stack_v2_python_sparse
leetcode/solved/984_Most_Stones_Removed_with_Same_Row_or_Column/solution.py
sungminoh/algorithms
train
0
a514b0b25c5b7565b1842b8c71783326d64e52ad
[ "del update_time\ncurrent_user = info.context['user']\nerr = 'Error in GQL query - resolve_all_pages.'\nwith ax_model.try_catch(info.context['session'], err, no_commit=True) as db_session:\n user_guid = current_user.get('user_id', None) if current_user else None\n user_is_admin = current_user.get('is_admin', ...
<|body_start_0|> del update_time current_user = info.context['user'] err = 'Error in GQL query - resolve_all_pages.' with ax_model.try_catch(info.context['session'], err, no_commit=True) as db_session: user_guid = current_user.get('user_id', None) if current_user else None ...
AxPage queryes
PagesQuery
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PagesQuery: """AxPage queryes""" async def resolve_all_pages(self, info, update_time): """Get all pages""" <|body_0|> async def resolve_page_data(self, info, guid=None, update_time=None): """Get specific page""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_021911
11,421
no_license
[ { "docstring": "Get all pages", "name": "resolve_all_pages", "signature": "async def resolve_all_pages(self, info, update_time)" }, { "docstring": "Get specific page", "name": "resolve_page_data", "signature": "async def resolve_page_data(self, info, guid=None, update_time=None)" } ]
2
null
Implement the Python class `PagesQuery` described below. Class description: AxPage queryes Method signatures and docstrings: - async def resolve_all_pages(self, info, update_time): Get all pages - async def resolve_page_data(self, info, guid=None, update_time=None): Get specific page
Implement the Python class `PagesQuery` described below. Class description: AxPage queryes Method signatures and docstrings: - async def resolve_all_pages(self, info, update_time): Get all pages - async def resolve_page_data(self, info, guid=None, update_time=None): Get specific page <|skeleton|> class PagesQuery: ...
3540979e680732d38e25a6b39f09338985de6743
<|skeleton|> class PagesQuery: """AxPage queryes""" async def resolve_all_pages(self, info, update_time): """Get all pages""" <|body_0|> async def resolve_page_data(self, info, guid=None, update_time=None): """Get specific page""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PagesQuery: """AxPage queryes""" async def resolve_all_pages(self, info, update_time): """Get all pages""" del update_time current_user = info.context['user'] err = 'Error in GQL query - resolve_all_pages.' with ax_model.try_catch(info.context['session'], err, no_c...
the_stack_v2_python_sparse
Calculation methods/CalcMethods_Lab_3_V15_Task_3_15/venv/Lib/site-packages/ax/backend/schemas/pages_schema.py
areyykarthik/Zhukouski_Pavel_BSU_Projects
train
0
8d186842ae3a41bc6d217034c9ec605047f200d8
[ "super().__init__(label)\nself.setFocusPolicy(QtCore.Qt.StrongFocus)\nself.setChecked(checked)\nif slot:\n self.stateChanged.connect(slot)", "if event.key() == QtCore.Qt.Key_Up or event.key() == QtCore.Qt.Key_Down:\n if self.isChecked():\n self.setCheckState(QtCore.Qt.Unchecked)\n else:\n s...
<|body_start_0|> super().__init__(label) self.setFocusPolicy(QtCore.Qt.StrongFocus) self.setChecked(checked) if slot: self.stateChanged.connect(slot) <|end_body_0|> <|body_start_1|> if event.key() == QtCore.Qt.Key_Up or event.key() == QtCore.Qt.Key_Down: ...
A checkbox with associated label and slot function.
NXCheckBox
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NXCheckBox: """A checkbox with associated label and slot function.""" def __init__(self, label=None, slot=None, checked=False): """Initialize the checkbox. Parameters ---------- label : str, optional Text describing the checkbox. slot : func, optional Function to be called when the c...
stack_v2_sparse_classes_36k_train_021912
43,131
permissive
[ { "docstring": "Initialize the checkbox. Parameters ---------- label : str, optional Text describing the checkbox. slot : func, optional Function to be called when the checkbox state is changed. checked : bool, optional Initial checkbox state (the default is False).", "name": "__init__", "signature": "d...
2
stack_v2_sparse_classes_30k_train_018075
Implement the Python class `NXCheckBox` described below. Class description: A checkbox with associated label and slot function. Method signatures and docstrings: - def __init__(self, label=None, slot=None, checked=False): Initialize the checkbox. Parameters ---------- label : str, optional Text describing the checkbo...
Implement the Python class `NXCheckBox` described below. Class description: A checkbox with associated label and slot function. Method signatures and docstrings: - def __init__(self, label=None, slot=None, checked=False): Initialize the checkbox. Parameters ---------- label : str, optional Text describing the checkbo...
97110aa2ebeff95cc78496bf5396d6b51fc151a7
<|skeleton|> class NXCheckBox: """A checkbox with associated label and slot function.""" def __init__(self, label=None, slot=None, checked=False): """Initialize the checkbox. Parameters ---------- label : str, optional Text describing the checkbox. slot : func, optional Function to be called when the c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NXCheckBox: """A checkbox with associated label and slot function.""" def __init__(self, label=None, slot=None, checked=False): """Initialize the checkbox. Parameters ---------- label : str, optional Text describing the checkbox. slot : func, optional Function to be called when the checkbox state...
the_stack_v2_python_sparse
src/nexpy/gui/widgets.py
nexpy/nexpy
train
42
ea6b5f7e90939ee120e24683a075d09b9f1fdd0f
[ "left, right = (0, len(nums) - 1)\nidx = 0\nwhile idx <= right:\n while idx <= right and nums[idx] == 2:\n nums[idx], nums[right] = (nums[right], nums[idx])\n right -= 1\n if nums[idx] == 0:\n nums[idx], nums[left] = (nums[left], nums[idx])\n left += 1\n idx += 1", "n = len(nu...
<|body_start_0|> left, right = (0, len(nums) - 1) idx = 0 while idx <= right: while idx <= right and nums[idx] == 2: nums[idx], nums[right] = (nums[right], nums[idx]) right -= 1 if nums[idx] == 0: nums[idx], nums[left] = (nu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortColors(self, nums: List[int]) -> None: """双指针(头尾)""" <|body_0|> def sortColorsOneScan(self, nums: List[int]) -> None: """双指针(前后)""" <|body_1|> def sortColorsTwoScan(self, nums: List[int]) -> None: """单指针(两次遍历)""" <|body_...
stack_v2_sparse_classes_36k_train_021913
3,452
no_license
[ { "docstring": "双指针(头尾)", "name": "sortColors", "signature": "def sortColors(self, nums: List[int]) -> None" }, { "docstring": "双指针(前后)", "name": "sortColorsOneScan", "signature": "def sortColorsOneScan(self, nums: List[int]) -> None" }, { "docstring": "单指针(两次遍历)", "name": "s...
4
stack_v2_sparse_classes_30k_train_016507
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortColors(self, nums: List[int]) -> None: 双指针(头尾) - def sortColorsOneScan(self, nums: List[int]) -> None: 双指针(前后) - def sortColorsTwoScan(self, nums: List[int]) -> None: 单指针...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortColors(self, nums: List[int]) -> None: 双指针(头尾) - def sortColorsOneScan(self, nums: List[int]) -> None: 双指针(前后) - def sortColorsTwoScan(self, nums: List[int]) -> None: 单指针...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def sortColors(self, nums: List[int]) -> None: """双指针(头尾)""" <|body_0|> def sortColorsOneScan(self, nums: List[int]) -> None: """双指针(前后)""" <|body_1|> def sortColorsTwoScan(self, nums: List[int]) -> None: """单指针(两次遍历)""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def sortColors(self, nums: List[int]) -> None: """双指针(头尾)""" left, right = (0, len(nums) - 1) idx = 0 while idx <= right: while idx <= right and nums[idx] == 2: nums[idx], nums[right] = (nums[right], nums[idx]) right -= 1 ...
the_stack_v2_python_sparse
75.颜色分类/solution.py
QtTao/daily_leetcode
train
0
b75b30fef07e84cb2bb9fb8eaf9e36110d12fbfa
[ "for item in response.css('#contentColumn table')[-1:].css('tr')[1:]:\n start = self._parse_start(item)\n if not start:\n continue\n meeting = Meeting(title='Monument Commission', description='', classification=COMMISSION, start=start, end=None, all_day=False, time_notes='', location=self._parse_loc...
<|body_start_0|> for item in response.css('#contentColumn table')[-1:].css('tr')[1:]: start = self._parse_start(item) if not start: continue meeting = Meeting(title='Monument Commission', description='', classification=COMMISSION, start=start, end=None, all_da...
CuyaMonumentSpider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CuyaMonumentSpider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" <|body_0|> def _parse_start(self, item): """Parse start datetime as a naive datetime o...
stack_v2_sparse_classes_36k_train_021914
2,805
permissive
[ { "docstring": "`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "Parse start datetime as a naive datetime object.", "name": "_parse_st...
4
stack_v2_sparse_classes_30k_train_011212
Implement the Python class `CuyaMonumentSpider` described below. Class description: Implement the CuyaMonumentSpider class. Method signatures and docstrings: - def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs. - d...
Implement the Python class `CuyaMonumentSpider` described below. Class description: Implement the CuyaMonumentSpider class. Method signatures and docstrings: - def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs. - d...
105ed65078ab4f7ca54193cc54c8c52dc174d08b
<|skeleton|> class CuyaMonumentSpider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" <|body_0|> def _parse_start(self, item): """Parse start datetime as a naive datetime o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CuyaMonumentSpider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" for item in response.css('#contentColumn table')[-1:].css('tr')[1:]: start = self._parse_start(item) ...
the_stack_v2_python_sparse
city_scrapers/spiders/cuya_monument.py
City-Bureau/city-scrapers-cle
train
17
c1ceafabbcaff4ef3a603106b9fb1d47d4c2d58b
[ "self.rects = rects\nself.sums = []\nfor w in rects:\n weight = (w[2] - w[0] + 1) * (w[3] - w[1] + 1)\n if not self.sums:\n self.sums.append(weight)\n else:\n self.sums.append(weight + self.sums[-1])", "import bisect\npick = random.uniform(0, self.sums[-1])\nb = bisect.bisect_left(self.sums...
<|body_start_0|> self.rects = rects self.sums = [] for w in rects: weight = (w[2] - w[0] + 1) * (w[3] - w[1] + 1) if not self.sums: self.sums.append(weight) else: self.sums.append(weight + self.sums[-1]) <|end_body_0|> <|body_s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, rects): """:type w: List[int] 268 ms""" <|body_0|> def pick(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.rects = rects self.sums = [] for w in rects: weight = (w[...
stack_v2_sparse_classes_36k_train_021915
2,805
no_license
[ { "docstring": ":type w: List[int] 268 ms", "name": "__init__", "signature": "def __init__(self, rects)" }, { "docstring": ":rtype: int", "name": "pick", "signature": "def pick(self)" } ]
2
stack_v2_sparse_classes_30k_train_006797
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type w: List[int] 268 ms - def pick(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type w: List[int] 268 ms - def pick(self): :rtype: int <|skeleton|> class Solution: def __init__(self, rects): """:type w: List[int] 268...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def __init__(self, rects): """:type w: List[int] 268 ms""" <|body_0|> def pick(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, rects): """:type w: List[int] 268 ms""" self.rects = rects self.sums = [] for w in rects: weight = (w[2] - w[0] + 1) * (w[3] - w[1] + 1) if not self.sums: self.sums.append(weight) else: ...
the_stack_v2_python_sparse
RandomPointInNonoverlappingRectangles_MID_882.py
953250587/leetcode-python
train
2
73309d260a18bc14d6796bcd33a22d92ceb748fe
[ "self.method = method\nself.bins = bins\nself.interpolation = interpolation\nself.variable_width = variable_width\nself.model = model", "X = load_and_check(X)\ny = load_and_check(y)\ny = column_or_1d(y)\nlabel_encoder = LabelEncoder()\ny = label_encoder.fit_transform(y).astype(np.float)\nif len(label_encoder.clas...
<|body_start_0|> self.method = method self.bins = bins self.interpolation = interpolation self.variable_width = variable_width self.model = model <|end_body_0|> <|body_start_1|> X = load_and_check(X) y = load_and_check(y) y = column_or_1d(y) label...
Probability calibration.
CalibratedClassifier
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CalibratedClassifier: """Probability calibration.""" def __init__(self, model, method='histogram', bins=100, interpolation=None, variable_width=False): """Constructor. Parameters ----------""" <|body_0|> def fit(self, X, y): """Fit the calibrated model. Parameter...
stack_v2_sparse_classes_36k_train_021916
5,898
permissive
[ { "docstring": "Constructor. Parameters ----------", "name": "__init__", "signature": "def __init__(self, model, method='histogram', bins=100, interpolation=None, variable_width=False)" }, { "docstring": "Fit the calibrated model. Parameters ---------- * `X` [array-like, shape=(n_samples, n_feat...
4
stack_v2_sparse_classes_30k_train_009459
Implement the Python class `CalibratedClassifier` described below. Class description: Probability calibration. Method signatures and docstrings: - def __init__(self, model, method='histogram', bins=100, interpolation=None, variable_width=False): Constructor. Parameters ---------- - def fit(self, X, y): Fit the calibr...
Implement the Python class `CalibratedClassifier` described below. Class description: Probability calibration. Method signatures and docstrings: - def __init__(self, model, method='histogram', bins=100, interpolation=None, variable_width=False): Constructor. Parameters ---------- - def fit(self, X, y): Fit the calibr...
383ef84c449d654d783b4e8bdbb847ee8cbf24b9
<|skeleton|> class CalibratedClassifier: """Probability calibration.""" def __init__(self, model, method='histogram', bins=100, interpolation=None, variable_width=False): """Constructor. Parameters ----------""" <|body_0|> def fit(self, X, y): """Fit the calibrated model. Parameter...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CalibratedClassifier: """Probability calibration.""" def __init__(self, model, method='histogram', bins=100, interpolation=None, variable_width=False): """Constructor. Parameters ----------""" self.method = method self.bins = bins self.interpolation = interpolation ...
the_stack_v2_python_sparse
ml/calibration.py
leonoravesterbacka/carl-torch
train
10
1a40a185be9faa62d8993704205fc718adb50486
[ "if self.CORS_ORIGIN:\n self.set_header('Access-Control-Allow-Origin', self.CORS_ORIGIN)\nif self.CORS_EXPOSE_HEADERS:\n self.set_header('Access-Control-Expose-Headers', self.CORS_EXPOSE_HEADERS)", "if self.CORS_HEADERS:\n self.set_header('Access-Control-Allow-Headers', self.CORS_HEADERS)\nif self.CORS_M...
<|body_start_0|> if self.CORS_ORIGIN: self.set_header('Access-Control-Allow-Origin', self.CORS_ORIGIN) if self.CORS_EXPOSE_HEADERS: self.set_header('Access-Control-Expose-Headers', self.CORS_EXPOSE_HEADERS) <|end_body_0|> <|body_start_1|> if self.CORS_HEADERS: ...
CorsMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CorsMixin: def set_default_headers(self): """设置默认头""" <|body_0|> def options(self, *args, **kwargs): """写入跨域请求header""" <|body_1|> def _get_methods(self): """设置支持的跨域方法""" <|body_2|> <|end_skeleton|> <|body_start_0|> if self.CORS...
stack_v2_sparse_classes_36k_train_021917
2,506
permissive
[ { "docstring": "设置默认头", "name": "set_default_headers", "signature": "def set_default_headers(self)" }, { "docstring": "写入跨域请求header", "name": "options", "signature": "def options(self, *args, **kwargs)" }, { "docstring": "设置支持的跨域方法", "name": "_get_methods", "signature": "...
3
stack_v2_sparse_classes_30k_train_021168
Implement the Python class `CorsMixin` described below. Class description: Implement the CorsMixin class. Method signatures and docstrings: - def set_default_headers(self): 设置默认头 - def options(self, *args, **kwargs): 写入跨域请求header - def _get_methods(self): 设置支持的跨域方法
Implement the Python class `CorsMixin` described below. Class description: Implement the CorsMixin class. Method signatures and docstrings: - def set_default_headers(self): 设置默认头 - def options(self, *args, **kwargs): 写入跨域请求header - def _get_methods(self): 设置支持的跨域方法 <|skeleton|> class CorsMixin: def set_default_...
9999d70429d9f773501f9a11910997343ff2df93
<|skeleton|> class CorsMixin: def set_default_headers(self): """设置默认头""" <|body_0|> def options(self, *args, **kwargs): """写入跨域请求header""" <|body_1|> def _get_methods(self): """设置支持的跨域方法""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CorsMixin: def set_default_headers(self): """设置默认头""" if self.CORS_ORIGIN: self.set_header('Access-Control-Allow-Origin', self.CORS_ORIGIN) if self.CORS_EXPOSE_HEADERS: self.set_header('Access-Control-Expose-Headers', self.CORS_EXPOSE_HEADERS) def options(s...
the_stack_v2_python_sparse
api/common/helpers/tornado_cors.py
bopopescu/smp
train
0
dd73d156fc1da3eb6ba837a2debd1c29998f67c2
[ "super(DetachedPPaNet, self).__init__()\nself.conv_1 = nn.Sequential(nn.Conv2d(n_channels, 64, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.MaxPool2d(kernel_size=2, stride=2, padding=1))\nself.conv_2 = nn.Sequential(nn.Conv2d(64, 128, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.BatchNorm2d(128), nn.Max...
<|body_start_0|> super(DetachedPPaNet, self).__init__() self.conv_1 = nn.Sequential(nn.Conv2d(n_channels, 64, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.MaxPool2d(kernel_size=2, stride=2, padding=1)) self.conv_2 = nn.Sequential(nn.Conv2d(64, 128, kernel_size=3, stride=1, padding=1), nn.R...
This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward.
DetachedPPaNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DetachedPPaNet: """This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward.""" def __init__(self, n_channels, EMBEDING_SIZE): """Initializes MLP object. Args: n_inputs: ...
stack_v2_sparse_classes_36k_train_021918
3,434
no_license
[ { "docstring": "Initializes MLP object. Args: n_inputs: number of inputs. n_hidden: list of ints, specifies the number of units in each linear layer. If the list is empty, the MLP will not have any linear layers, and the model will simply perform a multinomial logistic regression. n_classes: number of classes o...
2
stack_v2_sparse_classes_30k_train_011367
Implement the Python class `DetachedPPaNet` described below. Class description: This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward. Method signatures and docstrings: - def __init__(self, n_channels,...
Implement the Python class `DetachedPPaNet` described below. Class description: This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward. Method signatures and docstrings: - def __init__(self, n_channels,...
b060caa315f0c066410da9580e64d6db0222f2a8
<|skeleton|> class DetachedPPaNet: """This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward.""" def __init__(self, n_channels, EMBEDING_SIZE): """Initializes MLP object. Args: n_inputs: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DetachedPPaNet: """This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward.""" def __init__(self, n_channels, EMBEDING_SIZE): """Initializes MLP object. Args: n_inputs: number of inp...
the_stack_v2_python_sparse
CIFAR-100/DetachedPPaNet.py
VCharatsidis/Unsupervised-Clustering
train
1
766d0870f7958b2e883414a06d72c54e6286fb22
[ "cname = '王jiu九'\nvalue = 'name'\nd_name = 'admin'\nbname = '2e2e2e20001'\ncp = ClientPage(self.driver)\ncp.client_inlet()\ncp.create_client_butt()\ncp.client_not_ret(cname, d_name, sj='1')\nbusy = BusinessPage(self.driver)\nbusy.business_edit_flow(0, bname, '233001')", "cname = '王八0001'\nvalue = 'name'\nd_name =...
<|body_start_0|> cname = '王jiu九' value = 'name' d_name = 'admin' bname = '2e2e2e20001' cp = ClientPage(self.driver) cp.client_inlet() cp.create_client_butt() cp.client_not_ret(cname, d_name, sj='1') busy = BusinessPage(self.driver) busy.bus...
ClientAndBusiness
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientAndBusiness: def test_client_busniess1(self): """新建客户——同时创建商机""" <|body_0|> def test_client_busniess2(self): """新建客户——同时创建商机""" <|body_1|> <|end_skeleton|> <|body_start_0|> cname = '王jiu九' value = 'name' d_name = 'admin' ...
stack_v2_sparse_classes_36k_train_021919
1,175
no_license
[ { "docstring": "新建客户——同时创建商机", "name": "test_client_busniess1", "signature": "def test_client_busniess1(self)" }, { "docstring": "新建客户——同时创建商机", "name": "test_client_busniess2", "signature": "def test_client_busniess2(self)" } ]
2
stack_v2_sparse_classes_30k_train_014216
Implement the Python class `ClientAndBusiness` described below. Class description: Implement the ClientAndBusiness class. Method signatures and docstrings: - def test_client_busniess1(self): 新建客户——同时创建商机 - def test_client_busniess2(self): 新建客户——同时创建商机
Implement the Python class `ClientAndBusiness` described below. Class description: Implement the ClientAndBusiness class. Method signatures and docstrings: - def test_client_busniess1(self): 新建客户——同时创建商机 - def test_client_busniess2(self): 新建客户——同时创建商机 <|skeleton|> class ClientAndBusiness: def test_client_busnie...
b98793fad55500ccb58105a24711ae4b3d8ac6c8
<|skeleton|> class ClientAndBusiness: def test_client_busniess1(self): """新建客户——同时创建商机""" <|body_0|> def test_client_busniess2(self): """新建客户——同时创建商机""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClientAndBusiness: def test_client_busniess1(self): """新建客户——同时创建商机""" cname = '王jiu九' value = 'name' d_name = 'admin' bname = '2e2e2e20001' cp = ClientPage(self.driver) cp.client_inlet() cp.create_client_butt() cp.client_not_ret(cname, d...
the_stack_v2_python_sparse
testcase/test_client_and_business.py
chenkangkang002/CrmAuto
train
0
aeb1413f624bbc7ab7fa98b91e1a9a042ec7a5fa
[ "self.v = x\nself.cl = None\nself.cr = None\nreturn None", "if not a or not isinstance(a, list):\n return TreeNode(None)\no = TreeNode(a[0])\nq = deque([o])\ni = 0\nn = len(a)\nwhile q:\n p = q.popleft()\n if 2 * i + 1 < n:\n p.cl = TreeNode(a[2 * i + 1])\n q.append(p.cl)\n if 2 * i + 2 ...
<|body_start_0|> self.v = x self.cl = None self.cr = None return None <|end_body_0|> <|body_start_1|> if not a or not isinstance(a, list): return TreeNode(None) o = TreeNode(a[0]) q = deque([o]) i = 0 n = len(a) while q: ...
Manage Node objects for binary trees.
TreeNode
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TreeNode: """Manage Node objects for binary trees.""" def __init__(self, x=None): """Constructor for TreeNode objects. :param (int or None) v: integer value for node :param TreeNode cl: pointer to left-side child node :param TreeNode cr: pointer to right-side child node :return: None...
stack_v2_sparse_classes_36k_train_021920
2,391
permissive
[ { "docstring": "Constructor for TreeNode objects. :param (int or None) v: integer value for node :param TreeNode cl: pointer to left-side child node :param TreeNode cr: pointer to right-side child node :return: None :rtype: None", "name": "__init__", "signature": "def __init__(self, x=None)" }, { ...
3
stack_v2_sparse_classes_30k_train_006902
Implement the Python class `TreeNode` described below. Class description: Manage Node objects for binary trees. Method signatures and docstrings: - def __init__(self, x=None): Constructor for TreeNode objects. :param (int or None) v: integer value for node :param TreeNode cl: pointer to left-side child node :param Tr...
Implement the Python class `TreeNode` described below. Class description: Manage Node objects for binary trees. Method signatures and docstrings: - def __init__(self, x=None): Constructor for TreeNode objects. :param (int or None) v: integer value for node :param TreeNode cl: pointer to left-side child node :param Tr...
69f90877c5466927e8b081c4268cbcda074813ec
<|skeleton|> class TreeNode: """Manage Node objects for binary trees.""" def __init__(self, x=None): """Constructor for TreeNode objects. :param (int or None) v: integer value for node :param TreeNode cl: pointer to left-side child node :param TreeNode cr: pointer to right-side child node :return: None...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TreeNode: """Manage Node objects for binary trees.""" def __init__(self, x=None): """Constructor for TreeNode objects. :param (int or None) v: integer value for node :param TreeNode cl: pointer to left-side child node :param TreeNode cr: pointer to right-side child node :return: None :rtype: None...
the_stack_v2_python_sparse
0108_convert_sorted_array_binary_search_tree/python_util.py
arthurdysart/LeetCode
train
0
6804043f2870e68ae5d0d4618d68b40dc09eadd9
[ "for file, phase_sequence, output_signal in self.known_values:\n intcode_program = open(expanduser('~/code/aoc2019/07/%s' % file))\n mem = list(map(int, intcode_program.read().split(',')))\n result = intcode_computer.amplification_circuit(mem, phase_sequence)\n self.assertEqual(output_signal, result)", ...
<|body_start_0|> for file, phase_sequence, output_signal in self.known_values: intcode_program = open(expanduser('~/code/aoc2019/07/%s' % file)) mem = list(map(int, intcode_program.read().split(','))) result = intcode_computer.amplification_circuit(mem, phase_sequence) ...
KnownValues
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KnownValues: def test_amplification_circuit(self): """amplication_circuit should give known result with known input""" <|body_0|> def test_feedback_loop(self): """feedback_loop should give known result with known input""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_021921
1,426
no_license
[ { "docstring": "amplication_circuit should give known result with known input", "name": "test_amplification_circuit", "signature": "def test_amplification_circuit(self)" }, { "docstring": "feedback_loop should give known result with known input", "name": "test_feedback_loop", "signature"...
2
stack_v2_sparse_classes_30k_train_018635
Implement the Python class `KnownValues` described below. Class description: Implement the KnownValues class. Method signatures and docstrings: - def test_amplification_circuit(self): amplication_circuit should give known result with known input - def test_feedback_loop(self): feedback_loop should give known result w...
Implement the Python class `KnownValues` described below. Class description: Implement the KnownValues class. Method signatures and docstrings: - def test_amplification_circuit(self): amplication_circuit should give known result with known input - def test_feedback_loop(self): feedback_loop should give known result w...
98b6d2049e2331c2583d47d05061690b87ea0f2b
<|skeleton|> class KnownValues: def test_amplification_circuit(self): """amplication_circuit should give known result with known input""" <|body_0|> def test_feedback_loop(self): """feedback_loop should give known result with known input""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KnownValues: def test_amplification_circuit(self): """amplication_circuit should give known result with known input""" for file, phase_sequence, output_signal in self.known_values: intcode_program = open(expanduser('~/code/aoc2019/07/%s' % file)) mem = list(map(int, int...
the_stack_v2_python_sparse
07/intcode_test.py
hinzed1127/aoc2019
train
0
214e90c5bfcf485e18e13c001f8e9e2889072097
[ "self.encd = encd\nself.no_inner_groups = no_inner_groups\nself.istring_hook = istring_hook\nif not ifile:\n self.re_list = [DEFAULT_RE]\nelse:\n self.re_list = self.__load(ifile, encd=self.encd)", "output = []\ngroups = ()\nfor re in self.re_list:\n for match in re.finditer(istring):\n groups = m...
<|body_start_0|> self.encd = encd self.no_inner_groups = no_inner_groups self.istring_hook = istring_hook if not ifile: self.re_list = [DEFAULT_RE] else: self.re_list = self.__load(ifile, encd=self.encd) <|end_body_0|> <|body_start_1|> output = []...
Container class used to hold multiple compiled regexps.
MultiRegExp
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiRegExp: """Container class used to hold multiple compiled regexps.""" def __init__(self, ifile, encd='utf8', no_inner_groups=False, istring_hook=lambda istring: [istring]): """Load regular expressions from text file. Read input file passed as argument and convert lines contained...
stack_v2_sparse_classes_36k_train_021922
6,533
permissive
[ { "docstring": "Load regular expressions from text file. Read input file passed as argument and convert lines contained there to a RegExp union, i.e. regexps separated by | (OR). If istring_hook is supplied, it should be a function called for every input line except for lines with compiler directives. Return va...
5
stack_v2_sparse_classes_30k_train_017627
Implement the Python class `MultiRegExp` described below. Class description: Container class used to hold multiple compiled regexps. Method signatures and docstrings: - def __init__(self, ifile, encd='utf8', no_inner_groups=False, istring_hook=lambda istring: [istring]): Load regular expressions from text file. Read ...
Implement the Python class `MultiRegExp` described below. Class description: Container class used to hold multiple compiled regexps. Method signatures and docstrings: - def __init__(self, ifile, encd='utf8', no_inner_groups=False, istring_hook=lambda istring: [istring]): Load regular expressions from text file. Read ...
ac645fb41260b86491b17fbc50e5ea3300dc28b7
<|skeleton|> class MultiRegExp: """Container class used to hold multiple compiled regexps.""" def __init__(self, ifile, encd='utf8', no_inner_groups=False, istring_hook=lambda istring: [istring]): """Load regular expressions from text file. Read input file passed as argument and convert lines contained...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiRegExp: """Container class used to hold multiple compiled regexps.""" def __init__(self, ifile, encd='utf8', no_inner_groups=False, istring_hook=lambda istring: [istring]): """Load regular expressions from text file. Read input file passed as argument and convert lines contained there to a R...
the_stack_v2_python_sparse
scripts/lib/python/ld/lingre/lre.py
WladimirSidorenko/TextNormalization
train
1
abb40f6104d91f9d09907f53c15d22b40b43d962
[ "if not root:\n return 0\nelse:\n l = self.maxDepth(root.left)\n r = self.maxDepth(root.right)\n return max(l, r) + 1", "if not root:\n return 0\ncnt = 0\nqueue = deque()\nqueue.append(root)\nwhile len(queue):\n temp = []\n for _ in range(len(queue)):\n root = queue.pop()\n temp...
<|body_start_0|> if not root: return 0 else: l = self.maxDepth(root.left) r = self.maxDepth(root.right) return max(l, r) + 1 <|end_body_0|> <|body_start_1|> if not root: return 0 cnt = 0 queue = deque() queue.ap...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxDepth(self, root: TreeNode) -> int: """dfs""" <|body_0|> def maxDepth2(self, root: TreeNode) -> int: """bfs""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return 0 else: l = self.maxDept...
stack_v2_sparse_classes_36k_train_021923
1,927
permissive
[ { "docstring": "dfs", "name": "maxDepth", "signature": "def maxDepth(self, root: TreeNode) -> int" }, { "docstring": "bfs", "name": "maxDepth2", "signature": "def maxDepth2(self, root: TreeNode) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root: TreeNode) -> int: dfs - def maxDepth2(self, root: TreeNode) -> int: bfs
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root: TreeNode) -> int: dfs - def maxDepth2(self, root: TreeNode) -> int: bfs <|skeleton|> class Solution: def maxDepth(self, root: TreeNode) -> int: ...
e8a1c6cae6547cbcb6e8494be6df685f3e7c837c
<|skeleton|> class Solution: def maxDepth(self, root: TreeNode) -> int: """dfs""" <|body_0|> def maxDepth2(self, root: TreeNode) -> int: """bfs""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxDepth(self, root: TreeNode) -> int: """dfs""" if not root: return 0 else: l = self.maxDepth(root.left) r = self.maxDepth(root.right) return max(l, r) + 1 def maxDepth2(self, root: TreeNode) -> int: """bfs""" ...
the_stack_v2_python_sparse
104-maximum-depth-of-binary-tree.py
yuenliou/leetcode
train
0
c06d014a3bc9f9f22a071586b781764169f178e6
[ "if not isinstance(permission, Permissions):\n try:\n permission = Permissions(permission)\n except ValueError:\n msg = \"Invalid `permission` value. Available values are: 'View', 'Modify', 'Full Control', 'Denied All', 'Default All'. See: Permissions enum.\"\n exception_handler(msg)\nrig...
<|body_start_0|> if not isinstance(permission, Permissions): try: permission = Permissions(permission) except ValueError: msg = "Invalid `permission` value. Available values are: 'View', 'Modify', 'Full Control', 'Denied All', 'Default All'. See: Permissio...
TrusteeACLMixin class adds ACL management for Trustee classes. Objects currently supporting this Mixin are: (`User` and `UserGroup`).
TrusteeACLMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrusteeACLMixin: """TrusteeACLMixin class adds ACL management for Trustee classes. Objects currently supporting this Mixin are: (`User` and `UserGroup`).""" def set_permission(self, permission: Permissions | str, to_objects: str | list[str], object_type: 'ObjectTypes | int', project: 'Option...
stack_v2_sparse_classes_36k_train_021924
28,085
permissive
[ { "docstring": "Set permission to perform actions on given object(s). Function is used to set permission of the trustee to perform given actions on the provided objects. Within one execution of the function permission will be set in the same manner for each of the provided objects. The only available values of ...
2
stack_v2_sparse_classes_30k_train_012637
Implement the Python class `TrusteeACLMixin` described below. Class description: TrusteeACLMixin class adds ACL management for Trustee classes. Objects currently supporting this Mixin are: (`User` and `UserGroup`). Method signatures and docstrings: - def set_permission(self, permission: Permissions | str, to_objects:...
Implement the Python class `TrusteeACLMixin` described below. Class description: TrusteeACLMixin class adds ACL management for Trustee classes. Objects currently supporting this Mixin are: (`User` and `UserGroup`). Method signatures and docstrings: - def set_permission(self, permission: Permissions | str, to_objects:...
c6cea33b15bcd876ded4de25138b3f5e5165cd6d
<|skeleton|> class TrusteeACLMixin: """TrusteeACLMixin class adds ACL management for Trustee classes. Objects currently supporting this Mixin are: (`User` and `UserGroup`).""" def set_permission(self, permission: Permissions | str, to_objects: str | list[str], object_type: 'ObjectTypes | int', project: 'Option...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrusteeACLMixin: """TrusteeACLMixin class adds ACL management for Trustee classes. Objects currently supporting this Mixin are: (`User` and `UserGroup`).""" def set_permission(self, permission: Permissions | str, to_objects: str | list[str], object_type: 'ObjectTypes | int', project: 'Optional[Project | ...
the_stack_v2_python_sparse
mstrio/utils/acl.py
MicroStrategy/mstrio-py
train
84
00463ef5bf7a318bfe7bcf4ddaf69cb8dac74afb
[ "if SuperUserPermission().can():\n if parsed_args['limit'] is not None and parsed_args['limit'] > 100:\n raise InvalidRequest('Page limit cannot be above 100')\n if parsed_args['limit'] is None:\n users = pre_oci_model.get_active_users(disabled=parsed_args['disabled'])\n return ({'users':...
<|body_start_0|> if SuperUserPermission().can(): if parsed_args['limit'] is not None and parsed_args['limit'] > 100: raise InvalidRequest('Page limit cannot be above 100') if parsed_args['limit'] is None: users = pre_oci_model.get_active_users(disabled=par...
Resource for listing users in the system.
SuperUserList
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuperUserList: """Resource for listing users in the system.""" def get(self, parsed_args, page_token): """Returns a list of all users in the system.""" <|body_0|> def post(self): """Creates a new user.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_021925
40,556
permissive
[ { "docstring": "Returns a list of all users in the system.", "name": "get", "signature": "def get(self, parsed_args, page_token)" }, { "docstring": "Creates a new user.", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `SuperUserList` described below. Class description: Resource for listing users in the system. Method signatures and docstrings: - def get(self, parsed_args, page_token): Returns a list of all users in the system. - def post(self): Creates a new user.
Implement the Python class `SuperUserList` described below. Class description: Resource for listing users in the system. Method signatures and docstrings: - def get(self, parsed_args, page_token): Returns a list of all users in the system. - def post(self): Creates a new user. <|skeleton|> class SuperUserList: "...
e400a0c22c5f89dd35d571654b13d262b1f6e3b3
<|skeleton|> class SuperUserList: """Resource for listing users in the system.""" def get(self, parsed_args, page_token): """Returns a list of all users in the system.""" <|body_0|> def post(self): """Creates a new user.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SuperUserList: """Resource for listing users in the system.""" def get(self, parsed_args, page_token): """Returns a list of all users in the system.""" if SuperUserPermission().can(): if parsed_args['limit'] is not None and parsed_args['limit'] > 100: raise Inv...
the_stack_v2_python_sparse
endpoints/api/superuser.py
quay/quay
train
2,363
b47800257924c858be718f7e4051bdf4b796be5a
[ "coin_list = [0 for _ in range(amount + 1)]\ncoin_list[0] = 1\ncoins.sort()\nfor j in range(len(coins)):\n for i in range(1, amount + 1):\n if i >= coins[j]:\n coin_list[i] += coin_list[i - coins[j]]\nprint(coin_list)\nreturn coin_list[-1]", "dp = [1] + [0] * amount\nfor c in coins:\n for ...
<|body_start_0|> coin_list = [0 for _ in range(amount + 1)] coin_list[0] = 1 coins.sort() for j in range(len(coins)): for i in range(1, amount + 1): if i >= coins[j]: coin_list[i] += coin_list[i - coins[j]] print(coin_list) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" <|body_0|> def change2(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_021926
868
no_license
[ { "docstring": ":type amount: int :type coins: List[int] :rtype: int", "name": "change", "signature": "def change(self, amount, coins)" }, { "docstring": ":type amount: int :type coins: List[int] :rtype: int", "name": "change2", "signature": "def change2(self, amount, coins)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int - def change2(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int - def change2(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int <|...
4105e18050b15fc0409c75353ad31be17187dd34
<|skeleton|> class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" <|body_0|> def change2(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" coin_list = [0 for _ in range(amount + 1)] coin_list[0] = 1 coins.sort() for j in range(len(coins)): for i in range(1, amount + 1): if i >= ...
the_stack_v2_python_sparse
change.py
NeilWangziyu/Leetcode_py
train
2
06266b27143312b718530dcc5db646bd59a37831
[ "self.env_step_time = 0.0\nself.inference_time = 0.0\nself.iters = 0\nself.explore_time_in_epi = 0.0\nself.wait_model_time = 0.0\nself.restore_model_time = 0.0\nself.n_agents = n_agents\nself.env_api_type = env_type\nself._stats = dict()", "_steps = [sta['mean_env_step_time_ms'] for sta in agent_stats]\n_infers =...
<|body_start_0|> self.env_step_time = 0.0 self.inference_time = 0.0 self.iters = 0 self.explore_time_in_epi = 0.0 self.wait_model_time = 0.0 self.restore_model_time = 0.0 self.n_agents = n_agents self.env_api_type = env_type self._stats = dict() <|...
AgentGroup status records handle the env.step and inference time of AgentGroup the status could been make sence within once explore There should been gather by logger or others
AgentGroupStats
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AgentGroupStats: """AgentGroup status records handle the env.step and inference time of AgentGroup the status could been make sence within once explore There should been gather by logger or others""" def __init__(self, n_agents, env_type): """init with default value""" <|body...
stack_v2_sparse_classes_36k_train_021927
5,319
permissive
[ { "docstring": "init with default value", "name": "__init__", "signature": "def __init__(self, n_agents, env_type)" }, { "docstring": "update agent status to agent group", "name": "update_with_agent_stats", "signature": "def update_with_agent_stats(self, agent_stats: list)" }, { ...
4
null
Implement the Python class `AgentGroupStats` described below. Class description: AgentGroup status records handle the env.step and inference time of AgentGroup the status could been make sence within once explore There should been gather by logger or others Method signatures and docstrings: - def __init__(self, n_age...
Implement the Python class `AgentGroupStats` described below. Class description: AgentGroup status records handle the env.step and inference time of AgentGroup the status could been make sence within once explore There should been gather by logger or others Method signatures and docstrings: - def __init__(self, n_age...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class AgentGroupStats: """AgentGroup status records handle the env.step and inference time of AgentGroup the status could been make sence within once explore There should been gather by logger or others""" def __init__(self, n_agents, env_type): """init with default value""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AgentGroupStats: """AgentGroup status records handle the env.step and inference time of AgentGroup the status could been make sence within once explore There should been gather by logger or others""" def __init__(self, n_agents, env_type): """init with default value""" self.env_step_time ...
the_stack_v2_python_sparse
built-in/TensorFlow/Research/reinforcement-learning/ModelZoo_QMIX_TensorFlow/xt/util/profile_stats.py
Huawei-Ascend/modelzoo
train
1
88ee99fcf4634f8a3631379788692d568c5c8ac6
[ "follow_user = self.db.query(FollowUser).filter_by(src_user_id=self.current_user).filter_by(dst_user_id=user_id).filter(FollowUser.is_current()).first()\nif follow_user:\n self.set_status(409)\nelse:\n self.db.add(FollowUser(src_user_id=self.current_user, dst_user_id=user_id))\nself.db.commit()\nself.finish()...
<|body_start_0|> follow_user = self.db.query(FollowUser).filter_by(src_user_id=self.current_user).filter_by(dst_user_id=user_id).filter(FollowUser.is_current()).first() if follow_user: self.set_status(409) else: self.db.add(FollowUser(src_user_id=self.current_user, dst_us...
API_FollowUser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class API_FollowUser: def post(self, user_id): """start following user Parameters ---------- dst_user_id: int (required) Returns ---------- CODES: 200: OK 409: already subscribed BODY: empty""" <|body_0|> def delete(self, user_id): """stop following user Parameters -------...
stack_v2_sparse_classes_36k_train_021928
7,114
no_license
[ { "docstring": "start following user Parameters ---------- dst_user_id: int (required) Returns ---------- CODES: 200: OK 409: already subscribed BODY: empty", "name": "post", "signature": "def post(self, user_id)" }, { "docstring": "stop following user Parameters ---------- dst_user_id: int (req...
2
stack_v2_sparse_classes_30k_val_000828
Implement the Python class `API_FollowUser` described below. Class description: Implement the API_FollowUser class. Method signatures and docstrings: - def post(self, user_id): start following user Parameters ---------- dst_user_id: int (required) Returns ---------- CODES: 200: OK 409: already subscribed BODY: empty ...
Implement the Python class `API_FollowUser` described below. Class description: Implement the API_FollowUser class. Method signatures and docstrings: - def post(self, user_id): start following user Parameters ---------- dst_user_id: int (required) Returns ---------- CODES: 200: OK 409: already subscribed BODY: empty ...
0eab54eb283e7434734b9fbeabd7d3ba249772af
<|skeleton|> class API_FollowUser: def post(self, user_id): """start following user Parameters ---------- dst_user_id: int (required) Returns ---------- CODES: 200: OK 409: already subscribed BODY: empty""" <|body_0|> def delete(self, user_id): """stop following user Parameters -------...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class API_FollowUser: def post(self, user_id): """start following user Parameters ---------- dst_user_id: int (required) Returns ---------- CODES: 200: OK 409: already subscribed BODY: empty""" follow_user = self.db.query(FollowUser).filter_by(src_user_id=self.current_user).filter_by(dst_user_id=use...
the_stack_v2_python_sparse
backend/main_app/api_v1/follow.py
zzzevaka/findchat
train
0
323f137b35fe341a868599f7a62c868edeebaf91
[ "result = {'errcode': 0, 'msg': None}\nid = request.GET.get('id', None)\nqueryset = UrlPermission.objects.only('id', 'title').all()\nrole = Role.objects.filter(id=id).first()\nper_list = []\nif role:\n role_permissions = role.permission.only('id', 'title').all()\n per_ids = [ru.id for ru in role_permissions]\...
<|body_start_0|> result = {'errcode': 0, 'msg': None} id = request.GET.get('id', None) queryset = UrlPermission.objects.only('id', 'title').all() role = Role.objects.filter(id=id).first() per_list = [] if role: role_permissions = role.permission.only('id', 'ti...
GetRoleAllPermission
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetRoleAllPermission: def get(self, request, **kwargs): """获取当前角色的所有权限""" <|body_0|> def post(self, request, **kwargs): """修改 角色的用户信息""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = {'errcode': 0, 'msg': None} id = request.GET.get('...
stack_v2_sparse_classes_36k_train_021929
6,998
no_license
[ { "docstring": "获取当前角色的所有权限", "name": "get", "signature": "def get(self, request, **kwargs)" }, { "docstring": "修改 角色的用户信息", "name": "post", "signature": "def post(self, request, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_014734
Implement the Python class `GetRoleAllPermission` described below. Class description: Implement the GetRoleAllPermission class. Method signatures and docstrings: - def get(self, request, **kwargs): 获取当前角色的所有权限 - def post(self, request, **kwargs): 修改 角色的用户信息
Implement the Python class `GetRoleAllPermission` described below. Class description: Implement the GetRoleAllPermission class. Method signatures and docstrings: - def get(self, request, **kwargs): 获取当前角色的所有权限 - def post(self, request, **kwargs): 修改 角色的用户信息 <|skeleton|> class GetRoleAllPermission: def get(self,...
9ceeecd85fdfd52fb90ebac7cc17092476877640
<|skeleton|> class GetRoleAllPermission: def get(self, request, **kwargs): """获取当前角色的所有权限""" <|body_0|> def post(self, request, **kwargs): """修改 角色的用户信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetRoleAllPermission: def get(self, request, **kwargs): """获取当前角色的所有权限""" result = {'errcode': 0, 'msg': None} id = request.GET.get('id', None) queryset = UrlPermission.objects.only('id', 'title').all() role = Role.objects.filter(id=id).first() per_list = [] ...
the_stack_v2_python_sparse
user/api.py
vanwt/ttcmdb
train
1
ad17bbec842475a716067702df6f6f96c2e980d7
[ "def thoughroot(root):\n nonlocal res\n if not root:\n return 0\n left = max(0, thoughroot(root.left))\n right = max(0, thoughroot(root.right))\n res = max(res, left + right + root.val)\n return max(left, right) + root.val\nres = -float('inf')\nthoughroot(root)\nreturn res", "dp = [-float...
<|body_start_0|> def thoughroot(root): nonlocal res if not root: return 0 left = max(0, thoughroot(root.left)) right = max(0, thoughroot(root.right)) res = max(res, left + right + root.val) return max(left, right) + root.val...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxPathSum(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def maxPathSum0(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def thoughroot(root): nonlocal res ...
stack_v2_sparse_classes_36k_train_021930
1,733
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "maxPathSum", "signature": "def maxPathSum(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "maxPathSum0", "signature": "def maxPathSum0(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_017139
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxPathSum(self, root): :type root: TreeNode :rtype: int - def maxPathSum0(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxPathSum(self, root): :type root: TreeNode :rtype: int - def maxPathSum0(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: def maxPathSum(sel...
9e49b2c6003b957276737005d4aaac276b44d251
<|skeleton|> class Solution: def maxPathSum(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def maxPathSum0(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxPathSum(self, root): """:type root: TreeNode :rtype: int""" def thoughroot(root): nonlocal res if not root: return 0 left = max(0, thoughroot(root.left)) right = max(0, thoughroot(root.right)) res = ma...
the_stack_v2_python_sparse
PythonCode/src/0124_Binary_Tree_Maximum_Path_Sum.py
oneyuan/CodeforFun
train
0
3792202cbca60b4a19deac319b8a16b7cba5d625
[ "group1_antall, group1_image = detectFace(group1)\ngroup1_expectedNumber = 7\nself.assertEqual(group1_antall, group1_expectedNumber)", "couple_antall, couple_image = detectFace(couple)\ncouple_expectedNumber = 2\nself.assertEqual(couple_antall, couple_expectedNumber)" ]
<|body_start_0|> group1_antall, group1_image = detectFace(group1) group1_expectedNumber = 7 self.assertEqual(group1_antall, group1_expectedNumber) <|end_body_0|> <|body_start_1|> couple_antall, couple_image = detectFace(couple) couple_expectedNumber = 2 self.assertEqual(...
Tests for the anonymise module
test_Anon
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_Anon: """Tests for the anonymise module""" def test_faceDetect_Group1(self): """Test for face detection of image (group1.jpg)""" <|body_0|> def test_faceDetect_Couple(self): """Test for face detection of image (couple.jpg)""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k_train_021931
817
no_license
[ { "docstring": "Test for face detection of image (group1.jpg)", "name": "test_faceDetect_Group1", "signature": "def test_faceDetect_Group1(self)" }, { "docstring": "Test for face detection of image (couple.jpg)", "name": "test_faceDetect_Couple", "signature": "def test_faceDetect_Couple(...
2
stack_v2_sparse_classes_30k_train_021031
Implement the Python class `test_Anon` described below. Class description: Tests for the anonymise module Method signatures and docstrings: - def test_faceDetect_Group1(self): Test for face detection of image (group1.jpg) - def test_faceDetect_Couple(self): Test for face detection of image (couple.jpg)
Implement the Python class `test_Anon` described below. Class description: Tests for the anonymise module Method signatures and docstrings: - def test_faceDetect_Group1(self): Test for face detection of image (group1.jpg) - def test_faceDetect_Couple(self): Test for face detection of image (couple.jpg) <|skeleton|> ...
dd40d095231ed397cf69e3598f21483a3bcf11a6
<|skeleton|> class test_Anon: """Tests for the anonymise module""" def test_faceDetect_Group1(self): """Test for face detection of image (group1.jpg)""" <|body_0|> def test_faceDetect_Couple(self): """Test for face detection of image (couple.jpg)""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test_Anon: """Tests for the anonymise module""" def test_faceDetect_Group1(self): """Test for face detection of image (group1.jpg)""" group1_antall, group1_image = detectFace(group1) group1_expectedNumber = 7 self.assertEqual(group1_antall, group1_expectedNumber) def ...
the_stack_v2_python_sparse
src/test_FaceDetect.py
jegerud/Sciprog2020project
train
0
133bf4167981f169c94a2cc6989e7c0ea0c4b5a2
[ "test_class_pos = self.find_test_class(test_file_content)\nif test_class_pos is not None:\n test_class, pos = test_class_pos\n result = class_delimeter + test_class\n test_method = self.find_test_method(test_file_content[pos:])\n if test_method is not None:\n result += method_delimeter + test_met...
<|body_start_0|> test_class_pos = self.find_test_class(test_file_content) if test_class_pos is not None: test_class, pos = test_class_pos result = class_delimeter + test_class test_method = self.find_test_method(test_file_content[pos:]) if test_method is n...
Match a test method under the cursor
TestMethodMatcher
[ "MIT", "GPL-1.0-or-later", "LGPL-2.1-or-later", "GPL-3.0-only", "LicenseRef-scancode-warranty-disclaimer", "GPL-3.0-or-later", "LGPL-2.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMethodMatcher: """Match a test method under the cursor""" def find_test_path(self, test_file_content: str, class_delimeter: str=TEST_DELIMETER, method_delimeter: str=TEST_DELIMETER) -> str: """Try to find the test path, returns None if can't be found""" <|body_0|> de...
stack_v2_sparse_classes_36k_train_021932
10,020
permissive
[ { "docstring": "Try to find the test path, returns None if can't be found", "name": "find_test_path", "signature": "def find_test_path(self, test_file_content: str, class_delimeter: str=TEST_DELIMETER, method_delimeter: str=TEST_DELIMETER) -> str" }, { "docstring": "Try to find the test method, ...
3
null
Implement the Python class `TestMethodMatcher` described below. Class description: Match a test method under the cursor Method signatures and docstrings: - def find_test_path(self, test_file_content: str, class_delimeter: str=TEST_DELIMETER, method_delimeter: str=TEST_DELIMETER) -> str: Try to find the test path, ret...
Implement the Python class `TestMethodMatcher` described below. Class description: Match a test method under the cursor Method signatures and docstrings: - def find_test_path(self, test_file_content: str, class_delimeter: str=TEST_DELIMETER, method_delimeter: str=TEST_DELIMETER) -> str: Try to find the test path, ret...
9a3808d0d79504b488a407084b489b9d687a528a
<|skeleton|> class TestMethodMatcher: """Match a test method under the cursor""" def find_test_path(self, test_file_content: str, class_delimeter: str=TEST_DELIMETER, method_delimeter: str=TEST_DELIMETER) -> str: """Try to find the test path, returns None if can't be found""" <|body_0|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestMethodMatcher: """Match a test method under the cursor""" def find_test_path(self, test_file_content: str, class_delimeter: str=TEST_DELIMETER, method_delimeter: str=TEST_DELIMETER) -> str: """Try to find the test path, returns None if can't be found""" test_class_pos = self.find_test...
the_stack_v2_python_sparse
sublime/Packages/Anaconda/commands/test_runner.py
Kisura/dotfiles
train
0
b9e636a2944fecffcbc228bfe6a9f21bd2b8469a
[ "self.logger = DefaceLogger(__name__, debug=debug)\nself._CACHE_DIR = '/etc/securetea/web_deface/cache_dir'\nself.back_up_mapping = dict()\nself.file_names = []", "try:\n if not os.path.isdir(path):\n Path(path).mkdir()\nexcept FileExistsError:\n os.remove(path)\n self.check_dir(path)\nexcept File...
<|body_start_0|> self.logger = DefaceLogger(__name__, debug=debug) self._CACHE_DIR = '/etc/securetea/web_deface/cache_dir' self.back_up_mapping = dict() self.file_names = [] <|end_body_0|> <|body_start_1|> try: if not os.path.isdir(path): Path(path).m...
BackUp class.
BackUp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackUp: """BackUp class.""" def __init__(self, debug=False): """Initialize BackUp. Args: debug (bool): Log on terminal or not Raises: None Returns: None""" <|body_0|> def check_dir(self, path): """Check whether the directory exists or not. If directory does not e...
stack_v2_sparse_classes_36k_train_021933
3,752
permissive
[ { "docstring": "Initialize BackUp. Args: debug (bool): Log on terminal or not Raises: None Returns: None", "name": "__init__", "signature": "def __init__(self, debug=False)" }, { "docstring": "Check whether the directory exists or not. If directory does not exist, create one. Args: path (str): P...
4
stack_v2_sparse_classes_30k_train_011914
Implement the Python class `BackUp` described below. Class description: BackUp class. Method signatures and docstrings: - def __init__(self, debug=False): Initialize BackUp. Args: debug (bool): Log on terminal or not Raises: None Returns: None - def check_dir(self, path): Check whether the directory exists or not. If...
Implement the Python class `BackUp` described below. Class description: BackUp class. Method signatures and docstrings: - def __init__(self, debug=False): Initialize BackUp. Args: debug (bool): Log on terminal or not Raises: None Returns: None - def check_dir(self, path): Check whether the directory exists or not. If...
43dec187e5848b9ced8a6b4957b6e9028d4d43cd
<|skeleton|> class BackUp: """BackUp class.""" def __init__(self, debug=False): """Initialize BackUp. Args: debug (bool): Log on terminal or not Raises: None Returns: None""" <|body_0|> def check_dir(self, path): """Check whether the directory exists or not. If directory does not e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BackUp: """BackUp class.""" def __init__(self, debug=False): """Initialize BackUp. Args: debug (bool): Log on terminal or not Raises: None Returns: None""" self.logger = DefaceLogger(__name__, debug=debug) self._CACHE_DIR = '/etc/securetea/web_deface/cache_dir' self.back_u...
the_stack_v2_python_sparse
securetea/lib/web_deface/backup.py
rejahrehim/SecureTea-Project
train
1
552a13a1ce1e7cd938b45c94e91ae7585f5443eb
[ "if name and (not namespace) and (not identifier):\n x = pmod_mappings[name]['xrefs'][0]\n namespace, identifier, name = (x.namespace, x.identifier, x.name)\nsuper().__init__(name=name, namespace=namespace, identifier=identifier, xrefs=xrefs)\nif code:\n self[PMOD_CODE] = code\nif position:\n self[PMOD_...
<|body_start_0|> if name and (not namespace) and (not identifier): x = pmod_mappings[name]['xrefs'][0] namespace, identifier, name = (x.namespace, x.identifier, x.name) super().__init__(name=name, namespace=namespace, identifier=identifier, xrefs=xrefs) if code: ...
Build a protein modification variant dictionary.
ProteinModification
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProteinModification: """Build a protein modification variant dictionary.""" def __init__(self, name: str, code: Optional[str]=None, position: Optional[int]=None, namespace: Optional[str]=None, identifier: Optional[str]=None, xrefs: Optional[List[Entity]]=None) -> None: """Build a pro...
stack_v2_sparse_classes_36k_train_021934
34,684
permissive
[ { "docstring": "Build a protein modification variant data dictionary. :param name: The name of the modification :param code: The three letter amino acid code for the affected residue. Capital first letter. :param position: The position of the affected residue :param namespace: The namespace to which the name of...
2
null
Implement the Python class `ProteinModification` described below. Class description: Build a protein modification variant dictionary. Method signatures and docstrings: - def __init__(self, name: str, code: Optional[str]=None, position: Optional[int]=None, namespace: Optional[str]=None, identifier: Optional[str]=None,...
Implement the Python class `ProteinModification` described below. Class description: Build a protein modification variant dictionary. Method signatures and docstrings: - def __init__(self, name: str, code: Optional[str]=None, position: Optional[int]=None, namespace: Optional[str]=None, identifier: Optional[str]=None,...
ed66f013a77f9cbc513892b0dad1025b8f68bb46
<|skeleton|> class ProteinModification: """Build a protein modification variant dictionary.""" def __init__(self, name: str, code: Optional[str]=None, position: Optional[int]=None, namespace: Optional[str]=None, identifier: Optional[str]=None, xrefs: Optional[List[Entity]]=None) -> None: """Build a pro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProteinModification: """Build a protein modification variant dictionary.""" def __init__(self, name: str, code: Optional[str]=None, position: Optional[int]=None, namespace: Optional[str]=None, identifier: Optional[str]=None, xrefs: Optional[List[Entity]]=None) -> None: """Build a protein modifica...
the_stack_v2_python_sparse
src/pybel/dsl/node_classes.py
pybel/pybel
train
133
414066553086dd0ceb7e4a5861656b1c1695ed38
[ "super(UserApplicationChangeForm, self).__init__(data=data, initial=initial, instance=instance)\nlocal_site_field = self.fields['local_site']\nlocal_site_field.queryset = LocalSite.objects.filter(users=user)\nlocal_site_field.widget.attrs['disabled'] = True", "super(UserApplicationChangeForm, self).clean()\nif 'l...
<|body_start_0|> super(UserApplicationChangeForm, self).__init__(data=data, initial=initial, instance=instance) local_site_field = self.fields['local_site'] local_site_field.queryset = LocalSite.objects.filter(users=user) local_site_field.widget.attrs['disabled'] = True <|end_body_0|> <...
A form for an end user to change an Application.
UserApplicationChangeForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserApplicationChangeForm: """A form for an end user to change an Application.""" def __init__(self, user, data=None, initial=None, instance=None): """Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:met...
stack_v2_sparse_classes_36k_train_021935
13,782
permissive
[ { "docstring": "Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:meth:`UserApplicationCreationForm.__init__`. data (dict): The provided data. initial (dict, optional): The initial form values. instance (reviewboard.oauth.models.App...
2
stack_v2_sparse_classes_30k_train_011637
Implement the Python class `UserApplicationChangeForm` described below. Class description: A form for an end user to change an Application. Method signatures and docstrings: - def __init__(self, user, data=None, initial=None, instance=None): Initialize the form. Args: user (django.contrib.auth.models.User): The user ...
Implement the Python class `UserApplicationChangeForm` described below. Class description: A form for an end user to change an Application. Method signatures and docstrings: - def __init__(self, user, data=None, initial=None, instance=None): Initialize the form. Args: user (django.contrib.auth.models.User): The user ...
c3a991f1e9d7682239a1ab0e8661cee6da01d537
<|skeleton|> class UserApplicationChangeForm: """A form for an end user to change an Application.""" def __init__(self, user, data=None, initial=None, instance=None): """Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:met...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserApplicationChangeForm: """A form for an end user to change an Application.""" def __init__(self, user, data=None, initial=None, instance=None): """Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:meth:`UserApplic...
the_stack_v2_python_sparse
reviewboard/oauth/forms.py
reviewboard/reviewboard
train
1,141
4e9878922a1df080980f6ce06c1a1fb939c05562
[ "def from_left(nums):\n \"\"\"increase the smaller number to the previous highest\"\"\"\n found = False\n p = nums[0]\n for i in range(1, len(nums)):\n if p > nums[i]:\n if found:\n return False\n found = True\n else:\n p = nums[i]\n retur...
<|body_start_0|> def from_left(nums): """increase the smaller number to the previous highest""" found = False p = nums[0] for i in range(1, len(nums)): if p > nums[i]: if found: return False ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkPossibility(self, nums: List[int]) -> bool: """02/03/2021 18:41 Two passes from left and from right Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def checkPossibility(self, nums: List[int]) -> bool: """One pass, inplace Time complexity...
stack_v2_sparse_classes_36k_train_021936
3,325
no_license
[ { "docstring": "02/03/2021 18:41 Two passes from left and from right Time complexity: O(n) Space complexity: O(1)", "name": "checkPossibility", "signature": "def checkPossibility(self, nums: List[int]) -> bool" }, { "docstring": "One pass, inplace Time complexity: O(n) Space complexity: O(1)", ...
3
stack_v2_sparse_classes_30k_train_016052
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkPossibility(self, nums: List[int]) -> bool: 02/03/2021 18:41 Two passes from left and from right Time complexity: O(n) Space complexity: O(1) - def checkPossibility(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkPossibility(self, nums: List[int]) -> bool: 02/03/2021 18:41 Two passes from left and from right Time complexity: O(n) Space complexity: O(1) - def checkPossibility(self...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def checkPossibility(self, nums: List[int]) -> bool: """02/03/2021 18:41 Two passes from left and from right Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def checkPossibility(self, nums: List[int]) -> bool: """One pass, inplace Time complexity...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def checkPossibility(self, nums: List[int]) -> bool: """02/03/2021 18:41 Two passes from left and from right Time complexity: O(n) Space complexity: O(1)""" def from_left(nums): """increase the smaller number to the previous highest""" found = False ...
the_stack_v2_python_sparse
leetcode/solved/665_Non-decreasing_Array/solution.py
sungminoh/algorithms
train
0
73ee1bcd02aad80363ad70b5a71c5e1ab11ef13f
[ "self.kernel_fn = kernel_fn\nself.verbose = verbose\nself.random_state = check_random_state(random_state)", "x_vector = weighted_data\nalphas, _, coefs = lars_path(x_vector, weighted_labels, method='lasso', verbose=False)\nreturn (alphas, coefs)", "clf = Ridge(alpha=0, fit_intercept=True, random_state=self.rand...
<|body_start_0|> self.kernel_fn = kernel_fn self.verbose = verbose self.random_state = check_random_state(random_state) <|end_body_0|> <|body_start_1|> x_vector = weighted_data alphas, _, coefs = lars_path(x_vector, weighted_labels, method='lasso', verbose=False) return ...
Class for learning a locally linear sparse model from perturbed data
LimeBase
[ "MIT", "BSD-2-Clause", "LGPL-2.1-or-later", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LimeBase: """Class for learning a locally linear sparse model from perturbed data""" def __init__(self, kernel_fn, verbose=False, random_state=None): """Init function Args: kernel_fn: function that transforms an array of distances into an array of proximity values (floats). verbose: ...
stack_v2_sparse_classes_36k_train_021937
8,448
permissive
[ { "docstring": "Init function Args: kernel_fn: function that transforms an array of distances into an array of proximity values (floats). verbose: if true, print local prediction values from linear model. random_state: an integer or numpy.RandomState that will be used to generate random numbers. If None, the ra...
5
null
Implement the Python class `LimeBase` described below. Class description: Class for learning a locally linear sparse model from perturbed data Method signatures and docstrings: - def __init__(self, kernel_fn, verbose=False, random_state=None): Init function Args: kernel_fn: function that transforms an array of distan...
Implement the Python class `LimeBase` described below. Class description: Class for learning a locally linear sparse model from perturbed data Method signatures and docstrings: - def __init__(self, kernel_fn, verbose=False, random_state=None): Init function Args: kernel_fn: function that transforms an array of distan...
f59730dc7a8735232ef417685800652372c3b5dd
<|skeleton|> class LimeBase: """Class for learning a locally linear sparse model from perturbed data""" def __init__(self, kernel_fn, verbose=False, random_state=None): """Init function Args: kernel_fn: function that transforms an array of distances into an array of proximity values (floats). verbose: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LimeBase: """Class for learning a locally linear sparse model from perturbed data""" def __init__(self, kernel_fn, verbose=False, random_state=None): """Init function Args: kernel_fn: function that transforms an array of distances into an array of proximity values (floats). verbose: if true, prin...
the_stack_v2_python_sparse
tensorwatch/saliency/lime/lime_base.py
microsoft/tensorwatch
train
3,626
f90dd8e2a674920e934d3e925634901e27cc6e1a
[ "super(DynamoDBLambdaTrigger, self).__init__(start_time)\nself.deserializer = TypeDeserializer() if TypeDeserializer else None\nrecord = event['Records'][0]\nself.event_id = record['eventID']\nself.resource['name'] = record['eventSourceARN'].split('/')[-3]\nself.resource['operation'] = record['eventName']\nif recor...
<|body_start_0|> super(DynamoDBLambdaTrigger, self).__init__(start_time) self.deserializer = TypeDeserializer() if TypeDeserializer else None record = event['Records'][0] self.event_id = record['eventID'] self.resource['name'] = record['eventSourceARN'].split('/')[-3] sel...
Represents DynamoDB Lambda trigger
DynamoDBLambdaTrigger
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DynamoDBLambdaTrigger: """Represents DynamoDB Lambda trigger""" def __init__(self, start_time, event, context): """Initialize. :param start_time: event's start time (epoch) :param event: event dict from the entry point :param context: the context dict from the entry point""" ...
stack_v2_sparse_classes_36k_train_021938
18,528
permissive
[ { "docstring": "Initialize. :param start_time: event's start time (epoch) :param event: event dict from the entry point :param context: the context dict from the entry point", "name": "__init__", "signature": "def __init__(self, start_time, event, context)" }, { "docstring": "Deserialize DynamoD...
2
stack_v2_sparse_classes_30k_train_008668
Implement the Python class `DynamoDBLambdaTrigger` described below. Class description: Represents DynamoDB Lambda trigger Method signatures and docstrings: - def __init__(self, start_time, event, context): Initialize. :param start_time: event's start time (epoch) :param event: event dict from the entry point :param c...
Implement the Python class `DynamoDBLambdaTrigger` described below. Class description: Represents DynamoDB Lambda trigger Method signatures and docstrings: - def __init__(self, start_time, event, context): Initialize. :param start_time: event's start time (epoch) :param event: event dict from the entry point :param c...
91e28fe43bc4f42152fb156145088cb8c9f69b85
<|skeleton|> class DynamoDBLambdaTrigger: """Represents DynamoDB Lambda trigger""" def __init__(self, start_time, event, context): """Initialize. :param start_time: event's start time (epoch) :param event: event dict from the entry point :param context: the context dict from the entry point""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DynamoDBLambdaTrigger: """Represents DynamoDB Lambda trigger""" def __init__(self, start_time, event, context): """Initialize. :param start_time: event's start time (epoch) :param event: event dict from the entry point :param context: the context dict from the entry point""" super(DynamoD...
the_stack_v2_python_sparse
epsagon/triggers/aws_lambda.py
epsagon/epsagon-python
train
57
56b2ed806f6eefe6a3b01626e2ffb8abc020fb04
[ "super(RNN, self).__init__()\nself.D_in = D_in\nself.H = H\nself.D_out = D_out\nself.L = L\nself.nonlinearity = nonlinearity\nself.dropout = dropout if L > 1 else 0\nself.device = device\nself.rnn = nn.RNN(input_size=self.D_in, hidden_size=self.H, num_layers=self.L, nonlinearity=self.nonlinearity, dropout=self.drop...
<|body_start_0|> super(RNN, self).__init__() self.D_in = D_in self.H = H self.D_out = D_out self.L = L self.nonlinearity = nonlinearity self.dropout = dropout if L > 1 else 0 self.device = device self.rnn = nn.RNN(input_size=self.D_in, hidden_size=...
Vanilla RNN
RNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNN: """Vanilla RNN""" def __init__(self, D_in, H, D_ctx, D_out, L=1, nonlinearity='tanh', dropout=0.0, device=None): """params D_in: input feature count H: hidden state feature count D_out: output feature count L: number of layers nonlinearity: nonlinearity to use (either tanh or re...
stack_v2_sparse_classes_36k_train_021939
2,083
no_license
[ { "docstring": "params D_in: input feature count H: hidden state feature count D_out: output feature count L: number of layers nonlinearity: nonlinearity to use (either tanh or relu) dropout: dropout probability for each Dropout layer on RNN outputs device: tensor device", "name": "__init__", "signature...
2
stack_v2_sparse_classes_30k_train_014404
Implement the Python class `RNN` described below. Class description: Vanilla RNN Method signatures and docstrings: - def __init__(self, D_in, H, D_ctx, D_out, L=1, nonlinearity='tanh', dropout=0.0, device=None): params D_in: input feature count H: hidden state feature count D_out: output feature count L: number of la...
Implement the Python class `RNN` described below. Class description: Vanilla RNN Method signatures and docstrings: - def __init__(self, D_in, H, D_ctx, D_out, L=1, nonlinearity='tanh', dropout=0.0, device=None): params D_in: input feature count H: hidden state feature count D_out: output feature count L: number of la...
274ff8db17271106155e34725ae69b1a35c962b2
<|skeleton|> class RNN: """Vanilla RNN""" def __init__(self, D_in, H, D_ctx, D_out, L=1, nonlinearity='tanh', dropout=0.0, device=None): """params D_in: input feature count H: hidden state feature count D_out: output feature count L: number of layers nonlinearity: nonlinearity to use (either tanh or re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RNN: """Vanilla RNN""" def __init__(self, D_in, H, D_ctx, D_out, L=1, nonlinearity='tanh', dropout=0.0, device=None): """params D_in: input feature count H: hidden state feature count D_out: output feature count L: number of layers nonlinearity: nonlinearity to use (either tanh or relu) dropout: ...
the_stack_v2_python_sparse
ml/models/RNN.py
gravaman/fleishco
train
0
24b7b5b45c7a8137917896aac65f9de43994ca8e
[ "radii = ['10000']\nlead_times = None\nradii_out, lead_times_out = radius_by_lead_time(radii, lead_times)\nself.assertEqual(radii_out, float(radii[0]))\nself.assertEqual(lead_times_out, None)\nself.assertIsInstance(radii_out, float)", "radii = ['10000', '20000']\nlead_times = ['0', '10']\nradii_out, lead_times_ou...
<|body_start_0|> radii = ['10000'] lead_times = None radii_out, lead_times_out = radius_by_lead_time(radii, lead_times) self.assertEqual(radii_out, float(radii[0])) self.assertEqual(lead_times_out, None) self.assertIsInstance(radii_out, float) <|end_body_0|> <|body_start...
Test the radius_by_lead_time method.
Test_radius_by_lead_time
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_radius_by_lead_time: """Test the radius_by_lead_time method.""" def test_single_radius(self): """Test that when a single radius is provided with no lead times the returned objects are a float equal to the input radius and a NoneType representing the lead times.""" <|body...
stack_v2_sparse_classes_36k_train_021940
3,848
permissive
[ { "docstring": "Test that when a single radius is provided with no lead times the returned objects are a float equal to the input radius and a NoneType representing the lead times.", "name": "test_single_radius", "signature": "def test_single_radius(self)" }, { "docstring": "Test that when multi...
4
null
Implement the Python class `Test_radius_by_lead_time` described below. Class description: Test the radius_by_lead_time method. Method signatures and docstrings: - def test_single_radius(self): Test that when a single radius is provided with no lead times the returned objects are a float equal to the input radius and ...
Implement the Python class `Test_radius_by_lead_time` described below. Class description: Test the radius_by_lead_time method. Method signatures and docstrings: - def test_single_radius(self): Test that when a single radius is provided with no lead times the returned objects are a float equal to the input radius and ...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_radius_by_lead_time: """Test the radius_by_lead_time method.""" def test_single_radius(self): """Test that when a single radius is provided with no lead times the returned objects are a float equal to the input radius and a NoneType representing the lead times.""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_radius_by_lead_time: """Test the radius_by_lead_time method.""" def test_single_radius(self): """Test that when a single radius is provided with no lead times the returned objects are a float equal to the input radius and a NoneType representing the lead times.""" radii = ['10000'] ...
the_stack_v2_python_sparse
improver_tests/nbhood/test_init.py
metoppv/improver
train
101
baf805206c9f377705c1288d0e95895b89490361
[ "left = 0\nwhile left <= right:\n mid = left + (right - left >> 1)\n if nums[mid] == target:\n return mid\n if nums[mid] > target:\n right = mid - 1\n else:\n left = mid + 1\nreturn -1", "n = len(arr)\nret = 0\ndp = [[0 for i in range(n)] for j in range(n)]\nfor i in range(1, n):\...
<|body_start_0|> left = 0 while left <= right: mid = left + (right - left >> 1) if nums[mid] == target: return mid if nums[mid] > target: right = mid - 1 else: left = mid + 1 return -1 <|end_body_0|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def binary_search(self, nums, right, target): """二分查找""" <|body_0|> def lenLongestFibSubseq(self, arr): """:type arr: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> left = 0 while left <= right: m...
stack_v2_sparse_classes_36k_train_021941
860
no_license
[ { "docstring": "二分查找", "name": "binary_search", "signature": "def binary_search(self, nums, right, target)" }, { "docstring": ":type arr: List[int] :rtype: int", "name": "lenLongestFibSubseq", "signature": "def lenLongestFibSubseq(self, arr)" } ]
2
stack_v2_sparse_classes_30k_val_000902
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binary_search(self, nums, right, target): 二分查找 - def lenLongestFibSubseq(self, arr): :type arr: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binary_search(self, nums, right, target): 二分查找 - def lenLongestFibSubseq(self, arr): :type arr: List[int] :rtype: int <|skeleton|> class Solution: def binary_search(sel...
4b30dd6a3f683c8dc71a85f7b947232613a28dc1
<|skeleton|> class Solution: def binary_search(self, nums, right, target): """二分查找""" <|body_0|> def lenLongestFibSubseq(self, arr): """:type arr: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def binary_search(self, nums, right, target): """二分查找""" left = 0 while left <= right: mid = left + (right - left >> 1) if nums[mid] == target: return mid if nums[mid] > target: right = mid - 1 el...
the_stack_v2_python_sparse
最长斐波那契数列__时间超时.py
saintifly/leetcode
train
0
b18156591ffa6a2e2378d6b77eb15b079ccba36c
[ "try:\n\n def generate(vo):\n for exception in list_exceptions(exception_id, vo=vo):\n yield (dumps(exception, cls=APIEncoder) + '\\n')\n return try_stream(generate(vo=request.environ.get('vo')))\nexcept LifetimeExceptionNotFound as error:\n return generate_http_error_flask(404, 'Lifetime...
<|body_start_0|> try: def generate(vo): for exception in list_exceptions(exception_id, vo=vo): yield (dumps(exception, cls=APIEncoder) + '\n') return try_stream(generate(vo=request.environ.get('vo'))) except LifetimeExceptionNotFound as error:...
REST APIs for Lifetime Model exception.
LifetimeExceptionId
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LifetimeExceptionId: """REST APIs for Lifetime Model exception.""" def get(self, exception_id): """Retrieve an exception. .. :quickref: LifetimeExceptionId; Get an exceptions. :param exception_id: The exception identifier. :resheader Content-Type: application/x-json-stream :status 20...
stack_v2_sparse_classes_36k_train_021942
8,648
permissive
[ { "docstring": "Retrieve an exception. .. :quickref: LifetimeExceptionId; Get an exceptions. :param exception_id: The exception identifier. :resheader Content-Type: application/x-json-stream :status 200: OK. :status 401: Invalid Auth Token. :status 404: Lifetime Exception Not Found. :status 406: Not Acceptable....
2
stack_v2_sparse_classes_30k_train_005803
Implement the Python class `LifetimeExceptionId` described below. Class description: REST APIs for Lifetime Model exception. Method signatures and docstrings: - def get(self, exception_id): Retrieve an exception. .. :quickref: LifetimeExceptionId; Get an exceptions. :param exception_id: The exception identifier. :res...
Implement the Python class `LifetimeExceptionId` described below. Class description: REST APIs for Lifetime Model exception. Method signatures and docstrings: - def get(self, exception_id): Retrieve an exception. .. :quickref: LifetimeExceptionId; Get an exceptions. :param exception_id: The exception identifier. :res...
bf33d9441d3b4ff160a392eed56724f635a03fe6
<|skeleton|> class LifetimeExceptionId: """REST APIs for Lifetime Model exception.""" def get(self, exception_id): """Retrieve an exception. .. :quickref: LifetimeExceptionId; Get an exceptions. :param exception_id: The exception identifier. :resheader Content-Type: application/x-json-stream :status 20...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LifetimeExceptionId: """REST APIs for Lifetime Model exception.""" def get(self, exception_id): """Retrieve an exception. .. :quickref: LifetimeExceptionId; Get an exceptions. :param exception_id: The exception identifier. :resheader Content-Type: application/x-json-stream :status 200: OK. :statu...
the_stack_v2_python_sparse
lib/rucio/web/rest/flaskapi/v1/lifetime_exceptions.py
viveknigam3003/rucio
train
1
6bf725f2fb10e51125e36272a73e385b71ecd697
[ "super().__init__(agent)\nself.id = agent_id\nself.experience_replay = experience_replay\nself.param_pipe = param_pipe", "if self.param_pipe is not None and self.param_pipe.poll():\n env_episodes = self.algo.env_episodes\n env_steps = self.algo.env_steps\n self.algo.load(load_dict=self.param_pipe.recv())...
<|body_start_0|> super().__init__(agent) self.id = agent_id self.experience_replay = experience_replay self.param_pipe = param_pipe <|end_body_0|> <|body_start_1|> if self.param_pipe is not None and self.param_pipe.poll(): env_episodes = self.algo.env_episodes ...
An agent that sends its experiences into a queue 1 at a time rather than training directly.
QueueAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueueAgent: """An agent that sends its experiences into a queue 1 at a time rather than training directly.""" def __init__(self, agent: OffPolicyAgent, agent_id: int, experience_replay: PER, param_pipe: Optional[Pipe]=None): """Creates the queue agent, that passes experiences to a qu...
stack_v2_sparse_classes_36k_train_021943
4,100
permissive
[ { "docstring": "Creates the queue agent, that passes experiences to a queue to be inserting into replay buffer. Args: agent: The off policy agent to wrap. agent_id: The id of the agent. experience_replay: The PER object responsible for computing the errors and priorites of experiences. param_pipe: The pipe to r...
4
null
Implement the Python class `QueueAgent` described below. Class description: An agent that sends its experiences into a queue 1 at a time rather than training directly. Method signatures and docstrings: - def __init__(self, agent: OffPolicyAgent, agent_id: int, experience_replay: PER, param_pipe: Optional[Pipe]=None):...
Implement the Python class `QueueAgent` described below. Class description: An agent that sends its experiences into a queue 1 at a time rather than training directly. Method signatures and docstrings: - def __init__(self, agent: OffPolicyAgent, agent_id: int, experience_replay: PER, param_pipe: Optional[Pipe]=None):...
cde3be1c69bfd76fe4a78fa529e851d0a78318c7
<|skeleton|> class QueueAgent: """An agent that sends its experiences into a queue 1 at a time rather than training directly.""" def __init__(self, agent: OffPolicyAgent, agent_id: int, experience_replay: PER, param_pipe: Optional[Pipe]=None): """Creates the queue agent, that passes experiences to a qu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QueueAgent: """An agent that sends its experiences into a queue 1 at a time rather than training directly.""" def __init__(self, agent: OffPolicyAgent, agent_id: int, experience_replay: PER, param_pipe: Optional[Pipe]=None): """Creates the queue agent, that passes experiences to a queue to be ins...
the_stack_v2_python_sparse
hlrl/core/agents/wrappers/queue_agent.py
Chainso/HLRL
train
3
f91725621eb611b46d9bea5aa2c998109d460bbe
[ "id = request.args.get('id')\nif id:\n verify_request = db.get_identity(id)\nelse:\n verify_request = db.get_next_identity()\ncache.set(Identity.get_key(verify_request.id), verify_request, 15 * 60)\nself.id.data = verify_request.id\nreturn verify_request", "verify_request.address_1.value = self.address_1.da...
<|body_start_0|> id = request.args.get('id') if id: verify_request = db.get_identity(id) else: verify_request = db.get_next_identity() cache.set(Identity.get_key(verify_request.id), verify_request, 15 * 60) self.id.data = verify_request.id return v...
VerifyForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VerifyForm: def get(self, request): """do verify form get processing, basically get the request to verify""" <|body_0|> def update_verify_request(self, verify_request): """updates a verification request using form data""" <|body_1|> def get_request(self)...
stack_v2_sparse_classes_36k_train_021944
8,284
no_license
[ { "docstring": "do verify form get processing, basically get the request to verify", "name": "get", "signature": "def get(self, request)" }, { "docstring": "updates a verification request using form data", "name": "update_verify_request", "signature": "def update_verify_request(self, ver...
4
stack_v2_sparse_classes_30k_train_008939
Implement the Python class `VerifyForm` described below. Class description: Implement the VerifyForm class. Method signatures and docstrings: - def get(self, request): do verify form get processing, basically get the request to verify - def update_verify_request(self, verify_request): updates a verification request u...
Implement the Python class `VerifyForm` described below. Class description: Implement the VerifyForm class. Method signatures and docstrings: - def get(self, request): do verify form get processing, basically get the request to verify - def update_verify_request(self, verify_request): updates a verification request u...
932864230d113311674cbe898259d068505c76af
<|skeleton|> class VerifyForm: def get(self, request): """do verify form get processing, basically get the request to verify""" <|body_0|> def update_verify_request(self, verify_request): """updates a verification request using form data""" <|body_1|> def get_request(self)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VerifyForm: def get(self, request): """do verify form get processing, basically get the request to verify""" id = request.args.get('id') if id: verify_request = db.get_identity(id) else: verify_request = db.get_next_identity() cache.set(Identity....
the_stack_v2_python_sparse
verifier/verifier/forms/verify_form.py
bpalazzola/vote
train
0
cb4d280d91cefa328246ec822ca149d55a5c27a0
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('kobesay', 'kobesay')\nrepo.dropCollection('regionhospital')\nrepo.createCollection('regionhospital')\nitems = {}\nhospital = repo.kobesay.hospital.find()\nfor x in hospital:\n zipcode = x['zipcode'].s...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('kobesay', 'kobesay') repo.dropCollection('regionhospital') repo.createCollection('regionhospital') items = {} hospital = repo.kobe...
trans_hospital
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class trans_hospital: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everythin...
stack_v2_sparse_classes_36k_train_021945
3,673
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_train_006168
Implement the Python class `trans_hospital` described below. Class description: Implement the trans_hospital class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None,...
Implement the Python class `trans_hospital` described below. Class description: Implement the trans_hospital class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None,...
0df485d0469c5451ebdcd684bed2a0960ba3ab84
<|skeleton|> class trans_hospital: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everythin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class trans_hospital: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('kobesay', 'kobesay') repo.dr...
the_stack_v2_python_sparse
kobesay/trans_hospital.py
lingyigu/course-2017-spr-proj
train
0
2e1b2f4c33c58bbb6d9c87f3bfe4ff617a0c67df
[ "super(GridSearch, self).__init__(task=task, stopCriteria=stopCriteria, parameters=parameters)\nself.name = 'Grid Search'\nself.order = 0\nself.resolution = np.array(parameters.get('resolution'))\nself.randomize_evaluation_order = parameters.get('randomize_evaluation_order', False)\nif self.resolution.size == self....
<|body_start_0|> super(GridSearch, self).__init__(task=task, stopCriteria=stopCriteria, parameters=parameters) self.name = 'Grid Search' self.order = 0 self.resolution = np.array(parameters.get('resolution')) self.randomize_evaluation_order = parameters.get('randomize_evaluation_...
GridSearch
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GridSearch: def __init__(self, task, stopCriteria, parameters=DotMap()): """Grid Search :param task: :param parameters: resolution: scalar or np.array. define the resolution of the grid to be evaluated. randomize_evaluation_order: Bool. if True, randomize the order in which the points of...
stack_v2_sparse_classes_36k_train_021946
2,630
permissive
[ { "docstring": "Grid Search :param task: :param parameters: resolution: scalar or np.array. define the resolution of the grid to be evaluated. randomize_evaluation_order: Bool. if True, randomize the order in which the points of the grid are evaluated. Useful for purposes of comparing grid search against other ...
2
stack_v2_sparse_classes_30k_train_007404
Implement the Python class `GridSearch` described below. Class description: Implement the GridSearch class. Method signatures and docstrings: - def __init__(self, task, stopCriteria, parameters=DotMap()): Grid Search :param task: :param parameters: resolution: scalar or np.array. define the resolution of the grid to ...
Implement the Python class `GridSearch` described below. Class description: Implement the GridSearch class. Method signatures and docstrings: - def __init__(self, task, stopCriteria, parameters=DotMap()): Grid Search :param task: :param parameters: resolution: scalar or np.array. define the resolution of the grid to ...
e8a108c1975353e5576d5ab8ec7b8017452ea177
<|skeleton|> class GridSearch: def __init__(self, task, stopCriteria, parameters=DotMap()): """Grid Search :param task: :param parameters: resolution: scalar or np.array. define the resolution of the grid to be evaluated. randomize_evaluation_order: Bool. if True, randomize the order in which the points of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GridSearch: def __init__(self, task, stopCriteria, parameters=DotMap()): """Grid Search :param task: :param parameters: resolution: scalar or np.array. define the resolution of the grid to be evaluated. randomize_evaluation_order: Bool. if True, randomize the order in which the points of the grid are ...
the_stack_v2_python_sparse
opto/GridSearch.py
robertocalandra/opto
train
5
d82b75e430e01c48cbb9fe7c2d16af6159b8448c
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Proto file describing the Custom Interest service. Service to manage custom interests.
CustomInterestServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomInterestServiceServicer: """Proto file describing the Custom Interest service. Service to manage custom interests.""" def GetCustomInterest(self, request, context): """Returns the requested custom interest in full detail.""" <|body_0|> def MutateCustomInterests(sel...
stack_v2_sparse_classes_36k_train_021947
3,482
permissive
[ { "docstring": "Returns the requested custom interest in full detail.", "name": "GetCustomInterest", "signature": "def GetCustomInterest(self, request, context)" }, { "docstring": "Creates or updates custom interests. Operation statuses are returned.", "name": "MutateCustomInterests", "s...
2
stack_v2_sparse_classes_30k_train_013565
Implement the Python class `CustomInterestServiceServicer` described below. Class description: Proto file describing the Custom Interest service. Service to manage custom interests. Method signatures and docstrings: - def GetCustomInterest(self, request, context): Returns the requested custom interest in full detail....
Implement the Python class `CustomInterestServiceServicer` described below. Class description: Proto file describing the Custom Interest service. Service to manage custom interests. Method signatures and docstrings: - def GetCustomInterest(self, request, context): Returns the requested custom interest in full detail....
a5b6cede64f4d9912ae6ad26927a54e40448c9fe
<|skeleton|> class CustomInterestServiceServicer: """Proto file describing the Custom Interest service. Service to manage custom interests.""" def GetCustomInterest(self, request, context): """Returns the requested custom interest in full detail.""" <|body_0|> def MutateCustomInterests(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomInterestServiceServicer: """Proto file describing the Custom Interest service. Service to manage custom interests.""" def GetCustomInterest(self, request, context): """Returns the requested custom interest in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) co...
the_stack_v2_python_sparse
google/ads/google_ads/v3/proto/services/custom_interest_service_pb2_grpc.py
fiboknacky/google-ads-python
train
0
29e80ecbd55e38b9e35b16fbef9a747a4d35a73d
[ "try:\n cls.abrir_conexion()\n sql = 'SELECT mat_ins.cantidad,mat_ins.idMaterial FROM mat_ins WHERE idInsumo = {};'.format(id)\n cls.cursor.execute(sql)\n cantmats_ = cls.cursor.fetchall()\n cantmats = []\n for m in cantmats_:\n cantmat = CantMaterial...
<|body_start_0|> try: cls.abrir_conexion() sql = 'SELECT mat_ins.cantidad,mat_ins.idMaterial FROM mat_ins WHERE idInsumo = {};'.format(id) cls.cursor.execute(sql) cantmats_ = cls.cursor.fetchall() cantmats = [] ...
DatosCantMaterial
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatosCantMaterial: def get_from_Insid(cls, id, noClose=False): """Obtiene los materiales que componen un insumo de la BD""" <|body_0|> def addComponente(cls, idMat, idIns, cant): """Registra una cantidad de un material requerido para la produccion de un insumo.""" ...
stack_v2_sparse_classes_36k_train_021948
5,360
no_license
[ { "docstring": "Obtiene los materiales que componen un insumo de la BD", "name": "get_from_Insid", "signature": "def get_from_Insid(cls, id, noClose=False)" }, { "docstring": "Registra una cantidad de un material requerido para la produccion de un insumo.", "name": "addComponente", "sign...
6
null
Implement the Python class `DatosCantMaterial` described below. Class description: Implement the DatosCantMaterial class. Method signatures and docstrings: - def get_from_Insid(cls, id, noClose=False): Obtiene los materiales que componen un insumo de la BD - def addComponente(cls, idMat, idIns, cant): Registra una ca...
Implement the Python class `DatosCantMaterial` described below. Class description: Implement the DatosCantMaterial class. Method signatures and docstrings: - def get_from_Insid(cls, id, noClose=False): Obtiene los materiales que componen un insumo de la BD - def addComponente(cls, idMat, idIns, cant): Registra una ca...
57ca674dba4dabd2526c450ba7210933240f19c5
<|skeleton|> class DatosCantMaterial: def get_from_Insid(cls, id, noClose=False): """Obtiene los materiales que componen un insumo de la BD""" <|body_0|> def addComponente(cls, idMat, idIns, cant): """Registra una cantidad de un material requerido para la produccion de un insumo.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatosCantMaterial: def get_from_Insid(cls, id, noClose=False): """Obtiene los materiales que componen un insumo de la BD""" try: cls.abrir_conexion() sql = 'SELECT mat_ins.cantidad,mat_ins.idMaterial FROM mat_ins WHERE idInsumo = ...
the_stack_v2_python_sparse
data/data_cant_material.py
JoaquinCardonaRuiz/proyecto-final
train
0
2a87983b567a571508f64824ea32e201e8d1f83a
[ "if model._meta.app_label in self.db_user_apps:\n return 'rbac_db'\nreturn None", "if model._meta.app_label in self.db_user_apps:\n return 'rbac_db'\nreturn None", "if app_label in self.db_user_apps:\n return db == 'rbac_db'\nreturn None" ]
<|body_start_0|> if model._meta.app_label in self.db_user_apps: return 'rbac_db' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label in self.db_user_apps: return 'rbac_db' return None <|end_body_1|> <|body_start_2|> if app_label in self....
A router to control all database operations on models in the auth application.
DatabaseRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to default.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write a...
stack_v2_sparse_classes_36k_train_021949
1,058
no_license
[ { "docstring": "Attempts to read auth models go to default.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write auth models go to default.", "name": "db_for_write", "signature": "def db_for_write(self, model, **hints)" }, ...
3
stack_v2_sparse_classes_30k_train_018515
Implement the Python class `DatabaseRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to default. - def db_for_write(self, model, **hints)...
Implement the Python class `DatabaseRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to default. - def db_for_write(self, model, **hints)...
bb85b52598d68956bde8756c8321ade7b8479ba7
<|skeleton|> class DatabaseRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to default.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatabaseRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to default.""" if model._meta.app_label in self.db_user_apps: return 'rbac_db' return None ...
the_stack_v2_python_sparse
rbac_v1/rbac/db_router_setting.py
huiiiuh/huihuiproject
train
0
6edb0cb8f34a40d8ff576e6d6bc42983ff81abe8
[ "if isinstance(schema, dict):\n schema = vol.Schema(schema)\nself._schema = schema\nself._allow_empty = allow_empty", "@wraps(method)\nasync def wrapper(view: _HassViewT, request: web.Request, *args: _P.args, **kwargs: _P.kwargs) -> web.Response:\n \"\"\"Wrap a request handler with data validation.\"\"\"\n ...
<|body_start_0|> if isinstance(schema, dict): schema = vol.Schema(schema) self._schema = schema self._allow_empty = allow_empty <|end_body_0|> <|body_start_1|> @wraps(method) async def wrapper(view: _HassViewT, request: web.Request, *args: _P.args, **kwargs: _P.kwarg...
Decorator that will validate the incoming data. Takes in a voluptuous schema and adds 'data' as keyword argument to the function call. Will return a 400 if no JSON provided or doesn't match schema.
RequestDataValidator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequestDataValidator: """Decorator that will validate the incoming data. Takes in a voluptuous schema and adds 'data' as keyword argument to the function call. Will return a 400 if no JSON provided or doesn't match schema.""" def __init__(self, schema: vol.Schema, allow_empty: bool=False) ->...
stack_v2_sparse_classes_36k_train_021950
2,410
permissive
[ { "docstring": "Initialize the decorator.", "name": "__init__", "signature": "def __init__(self, schema: vol.Schema, allow_empty: bool=False) -> None" }, { "docstring": "Decorate a function.", "name": "__call__", "signature": "def __call__(self, method: Callable[Concatenate[_HassViewT, w...
2
stack_v2_sparse_classes_30k_train_004601
Implement the Python class `RequestDataValidator` described below. Class description: Decorator that will validate the incoming data. Takes in a voluptuous schema and adds 'data' as keyword argument to the function call. Will return a 400 if no JSON provided or doesn't match schema. Method signatures and docstrings: ...
Implement the Python class `RequestDataValidator` described below. Class description: Decorator that will validate the incoming data. Takes in a voluptuous schema and adds 'data' as keyword argument to the function call. Will return a 400 if no JSON provided or doesn't match schema. Method signatures and docstrings: ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class RequestDataValidator: """Decorator that will validate the incoming data. Takes in a voluptuous schema and adds 'data' as keyword argument to the function call. Will return a 400 if no JSON provided or doesn't match schema.""" def __init__(self, schema: vol.Schema, allow_empty: bool=False) ->...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RequestDataValidator: """Decorator that will validate the incoming data. Takes in a voluptuous schema and adds 'data' as keyword argument to the function call. Will return a 400 if no JSON provided or doesn't match schema.""" def __init__(self, schema: vol.Schema, allow_empty: bool=False) -> None: ...
the_stack_v2_python_sparse
homeassistant/components/http/data_validator.py
home-assistant/core
train
35,501
32632a85dc78eef9588f422bb3ad2b38452baa05
[ "if (delta_value := data.get('delta')):\n if isinstance(delta_value, str):\n if (internal_value := DISTRIBUTED_COST_INTERNAL.get(delta_value)):\n data['delta'] = internal_value\n if delta_value == 'cost':\n data['delta'] = 'cost_total'\nreturn super().to_internal_value(data)",...
<|body_start_0|> if (delta_value := data.get('delta')): if isinstance(delta_value, str): if (internal_value := DISTRIBUTED_COST_INTERNAL.get(delta_value)): data['delta'] = internal_value if delta_value == 'cost': data['delta'] =...
Serializer for handling query parameters.
OCPQueryParamSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OCPQueryParamSerializer: """Serializer for handling query parameters.""" def to_internal_value(self, data): """Send to internal value.""" <|body_0|> def validate(self, data): """Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Vali...
stack_v2_sparse_classes_36k_train_021951
8,876
permissive
[ { "docstring": "Send to internal value.", "name": "to_internal_value", "signature": "def to_internal_value(self, data)" }, { "docstring": "Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Validated data Raises: (ValidationError): if field inputs are invalid", ...
3
stack_v2_sparse_classes_30k_train_009141
Implement the Python class `OCPQueryParamSerializer` described below. Class description: Serializer for handling query parameters. Method signatures and docstrings: - def to_internal_value(self, data): Send to internal value. - def validate(self, data): Validate incoming data. Args: data (Dict): data to be validated ...
Implement the Python class `OCPQueryParamSerializer` described below. Class description: Serializer for handling query parameters. Method signatures and docstrings: - def to_internal_value(self, data): Send to internal value. - def validate(self, data): Validate incoming data. Args: data (Dict): data to be validated ...
0416e5216eb1ec4b41c8dd4999adde218b1ab2e1
<|skeleton|> class OCPQueryParamSerializer: """Serializer for handling query parameters.""" def to_internal_value(self, data): """Send to internal value.""" <|body_0|> def validate(self, data): """Validate incoming data. Args: data (Dict): data to be validated Returns: (Dict): Vali...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OCPQueryParamSerializer: """Serializer for handling query parameters.""" def to_internal_value(self, data): """Send to internal value.""" if (delta_value := data.get('delta')): if isinstance(delta_value, str): if (internal_value := DISTRIBUTED_COST_INTERNAL.get...
the_stack_v2_python_sparse
koku/api/report/ocp/serializers.py
project-koku/koku
train
225
a9560075c848dc46dfdefac5754c8036489c793d
[ "if isinstance(id, basestring):\n try:\n id = int(id)\n except ValueError:\n return\nreturn cls.reverse_color.get(id)", "if cls.color_rus.get(name):\n return cls.color_rus.get(name)\nif cls.color_eng.get(name):\n return cls.color_eng.get(name)\nreturn cls.OTHER" ]
<|body_start_0|> if isinstance(id, basestring): try: id = int(id) except ValueError: return return cls.reverse_color.get(id) <|end_body_0|> <|body_start_1|> if cls.color_rus.get(name): return cls.color_rus.get(name) if ...
Colors
Color
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Color: """Colors""" def get_name(cls, id): """Return color name""" <|body_0|> def get_id(cls, name): """Return color id""" <|body_1|> <|end_skeleton|> <|body_start_0|> if isinstance(id, basestring): try: id = int(id) ...
stack_v2_sparse_classes_36k_train_021952
1,457
no_license
[ { "docstring": "Return color name", "name": "get_name", "signature": "def get_name(cls, id)" }, { "docstring": "Return color id", "name": "get_id", "signature": "def get_id(cls, name)" } ]
2
null
Implement the Python class `Color` described below. Class description: Colors Method signatures and docstrings: - def get_name(cls, id): Return color name - def get_id(cls, name): Return color id
Implement the Python class `Color` described below. Class description: Colors Method signatures and docstrings: - def get_name(cls, id): Return color name - def get_id(cls, name): Return color id <|skeleton|> class Color: """Colors""" def get_name(cls, id): """Return color name""" <|body_0|>...
b642bc81cf633c95ccd978d5e9fb4177eee38be4
<|skeleton|> class Color: """Colors""" def get_name(cls, id): """Return color name""" <|body_0|> def get_id(cls, name): """Return color id""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Color: """Colors""" def get_name(cls, id): """Return color name""" if isinstance(id, basestring): try: id = int(id) except ValueError: return return cls.reverse_color.get(id) def get_id(cls, name): """Return colo...
the_stack_v2_python_sparse
apps/catalog/static_names.py
amyard/findinshopGit
train
0
4b612ccddcca123d374e51540159ac2215f18f3c
[ "group = Group.query.get(id)\nif not group:\n api.abort(code=404, message='Group not found')\nreturn {'data': group.__jsonapi__()}", "group = Group.query.get(id)\nif not group:\n api.abort(code=404, message='Group not found')\ndata = request.get_json()['data']\nif 'name' in data['attributes']:\n group.na...
<|body_start_0|> group = Group.query.get(id) if not group: api.abort(code=404, message='Group not found') return {'data': group.__jsonapi__()} <|end_body_0|> <|body_start_1|> group = Group.query.get(id) if not group: api.abort(code=404, message='Group not...
Groups
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Groups: def get(self, id): """Get group""" <|body_0|> def put(self, id): """Update group""" <|body_1|> def delete(self, id): """Delete group""" <|body_2|> <|end_skeleton|> <|body_start_0|> group = Group.query.get(id) if ...
stack_v2_sparse_classes_36k_train_021953
46,738
permissive
[ { "docstring": "Get group", "name": "get", "signature": "def get(self, id)" }, { "docstring": "Update group", "name": "put", "signature": "def put(self, id)" }, { "docstring": "Delete group", "name": "delete", "signature": "def delete(self, id)" } ]
3
stack_v2_sparse_classes_30k_train_009406
Implement the Python class `Groups` described below. Class description: Implement the Groups class. Method signatures and docstrings: - def get(self, id): Get group - def put(self, id): Update group - def delete(self, id): Delete group
Implement the Python class `Groups` described below. Class description: Implement the Groups class. Method signatures and docstrings: - def get(self, id): Get group - def put(self, id): Update group - def delete(self, id): Delete group <|skeleton|> class Groups: def get(self, id): """Get group""" ...
3439a2dd0bd527c5d604801fec3a5aac904a72e2
<|skeleton|> class Groups: def get(self, id): """Get group""" <|body_0|> def put(self, id): """Update group""" <|body_1|> def delete(self, id): """Delete group""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Groups: def get(self, id): """Get group""" group = Group.query.get(id) if not group: api.abort(code=404, message='Group not found') return {'data': group.__jsonapi__()} def put(self, id): """Update group""" group = Group.query.get(id) if...
the_stack_v2_python_sparse
app/views.py
taidos/lxc-rest
train
0
52102028f9d7e53f6f41be7dcc7b2aa4cdb8850c
[ "allure.description('Testing drs creating device')\ndevicetype = 'ovibovi'\nmodel = 'OVI-BOVI'\nhubId = 0\ndevice2 = DRS.create_device(deviceType=devicetype, model=model, hubId=hubId, sensorId=random.randint(1, 100000))", "allure.description('Testing drs creating and delete device')\ndeviceType = 'ovibovi'\nmodel...
<|body_start_0|> allure.description('Testing drs creating device') devicetype = 'ovibovi' model = 'OVI-BOVI' hubId = 0 device2 = DRS.create_device(deviceType=devicetype, model=model, hubId=hubId, sensorId=random.randint(1, 100000)) <|end_body_0|> <|body_start_1|> allure....
Test_DRS_Basic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_DRS_Basic: def test_create_device(self, DRS): """Create device test Send http request to create device""" <|body_0|> def test_create_and_delete_device(self, DRS): """Create and delete device test Send http request to create and then delete device""" <|bo...
stack_v2_sparse_classes_36k_train_021954
6,212
no_license
[ { "docstring": "Create device test Send http request to create device", "name": "test_create_device", "signature": "def test_create_device(self, DRS)" }, { "docstring": "Create and delete device test Send http request to create and then delete device", "name": "test_create_and_delete_device"...
6
stack_v2_sparse_classes_30k_test_000085
Implement the Python class `Test_DRS_Basic` described below. Class description: Implement the Test_DRS_Basic class. Method signatures and docstrings: - def test_create_device(self, DRS): Create device test Send http request to create device - def test_create_and_delete_device(self, DRS): Create and delete device test...
Implement the Python class `Test_DRS_Basic` described below. Class description: Implement the Test_DRS_Basic class. Method signatures and docstrings: - def test_create_device(self, DRS): Create device test Send http request to create device - def test_create_and_delete_device(self, DRS): Create and delete device test...
2b08d3cc153f0ebdd6272a17962e1601390391c5
<|skeleton|> class Test_DRS_Basic: def test_create_device(self, DRS): """Create device test Send http request to create device""" <|body_0|> def test_create_and_delete_device(self, DRS): """Create and delete device test Send http request to create and then delete device""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_DRS_Basic: def test_create_device(self, DRS): """Create device test Send http request to create device""" allure.description('Testing drs creating device') devicetype = 'ovibovi' model = 'OVI-BOVI' hubId = 0 device2 = DRS.create_device(deviceType=devicetype...
the_stack_v2_python_sparse
test_framework_pytest/pytests/farming/cases/test_sf_drs_operations.py
jinnymus/Python
train
0
d4fb412624cdeb3ac37d40944cbbc8e9b16048ba
[ "self.ret = ''\n\ndef traverse(node):\n if node is None:\n self.ret += ',#'\n return\n self.ret += ',' + str(node.val)\n traverse(node.left)\n traverse(node.right)\ntraverse(root)\nreturn self.ret[1:]", "data = data.split(',')\n\ndef decode(d):\n if not d:\n return None\n r ...
<|body_start_0|> self.ret = '' def traverse(node): if node is None: self.ret += ',#' return self.ret += ',' + str(node.val) traverse(node.left) traverse(node.right) traverse(root) return self.ret[1:] <|end_b...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_021955
995
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:...
116e84e41750b8e62e630deceda2e61589c66a3c
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" self.ret = '' def traverse(node): if node is None: self.ret += ',#' return self.ret += ',' + str(node.val) tr...
the_stack_v2_python_sparse
code/algorithm/系列问题/二叉树/14.二叉树的序列化和反序列化.py
fadeawaylove/interview_mkdocs
train
0
da3f89c26f777e1069c26b74158029bc51940ef4
[ "self.prot_attr = prot_attr\nself.adj_mat = adj_mat\npkgs = ('ranger', 'fairadapt')\npkgs = [p for p in pkgs if not robjects.packages.isinstalled(p)]\nif len(pkgs) > 0:\n utls = robjects.packages.importr('utils')\n utls.chooseCRANmirror(ind=1)\n utls.install_packages(StrVector(pkgs))", "df_train = pd.con...
<|body_start_0|> self.prot_attr = prot_attr self.adj_mat = adj_mat pkgs = ('ranger', 'fairadapt') pkgs = [p for p in pkgs if not robjects.packages.isinstalled(p)] if len(pkgs) > 0: utls = robjects.packages.importr('utils') utls.chooseCRANmirror(ind=1) ...
Fair Data Adaptation. Fairadapt is a pre-processing technique that can be used for both fair classification and fair regression [#plecko20]_. The method is a causal inference approach to bias removal and it relies on the causal graph for the dataset. The original implementation is in R [#plecko21]_. References: .. [#pl...
FairAdapt
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FairAdapt: """Fair Data Adaptation. Fairadapt is a pre-processing technique that can be used for both fair classification and fair regression [#plecko20]_. The method is a causal inference approach to bias removal and it relies on the causal graph for the dataset. The original implementation is i...
stack_v2_sparse_classes_36k_train_021956
4,623
permissive
[ { "docstring": "Args: prot_attr (single label): Name of the protected attribute. Must be binary. adj_mat (array-like): A 2-dimensional array representing the adjacency matrix of the causal diagram of the data generating process. Row/column order must match `X_train`.", "name": "__init__", "signature": "...
2
stack_v2_sparse_classes_30k_train_010174
Implement the Python class `FairAdapt` described below. Class description: Fair Data Adaptation. Fairadapt is a pre-processing technique that can be used for both fair classification and fair regression [#plecko20]_. The method is a causal inference approach to bias removal and it relies on the causal graph for the da...
Implement the Python class `FairAdapt` described below. Class description: Fair Data Adaptation. Fairadapt is a pre-processing technique that can be used for both fair classification and fair regression [#plecko20]_. The method is a causal inference approach to bias removal and it relies on the causal graph for the da...
6f9972e4a7dbca2402f29b86ea67889143dbeb3e
<|skeleton|> class FairAdapt: """Fair Data Adaptation. Fairadapt is a pre-processing technique that can be used for both fair classification and fair regression [#plecko20]_. The method is a causal inference approach to bias removal and it relies on the causal graph for the dataset. The original implementation is i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FairAdapt: """Fair Data Adaptation. Fairadapt is a pre-processing technique that can be used for both fair classification and fair regression [#plecko20]_. The method is a causal inference approach to bias removal and it relies on the causal graph for the dataset. The original implementation is in R [#plecko2...
the_stack_v2_python_sparse
aif360/sklearn/preprocessing/fairadapt.py
Trusted-AI/AIF360
train
1,157
eb348e4e342a4ed87ef952c10a0674295f25127b
[ "self.i_pv_4 = i_pv_4\nself.i_pv_6 = i_pv_6\nself.start_date = start_date\nself.end_date = end_date\nself.comments = comments\nself.active = active", "if dictionary is None:\n return None\nstart_date = dictionary.get('Start_Date')\nend_date = dictionary.get('End_Date')\ncomments = dictionary.get('Comments')\na...
<|body_start_0|> self.i_pv_4 = i_pv_4 self.i_pv_6 = i_pv_6 self.start_date = start_date self.end_date = end_date self.comments = comments self.active = active <|end_body_0|> <|body_start_1|> if dictionary is None: return None start_date = dict...
Implementation of the 'IP Address' model. The IP address information referenced by Bouncer when building `ufw` rules Attributes: i_pv_4 (string): IP Address v4 in CIDR Format. Either IPv4 or IPv6 MUST be present. i_pv_6 (string): IP Address v6 in CIDR Format. Either IPv4 or IPv6 MUST be present. start_date (string): St...
IPAddress
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IPAddress: """Implementation of the 'IP Address' model. The IP address information referenced by Bouncer when building `ufw` rules Attributes: i_pv_4 (string): IP Address v4 in CIDR Format. Either IPv4 or IPv6 MUST be present. i_pv_6 (string): IP Address v6 in CIDR Format. Either IPv4 or IPv6 MUS...
stack_v2_sparse_classes_36k_train_021957
2,646
permissive
[ { "docstring": "Constructor for the IPAddress class", "name": "__init__", "signature": "def __init__(self, start_date=None, end_date=None, comments=None, active=None, i_pv_4=None, i_pv_6=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): ...
2
stack_v2_sparse_classes_30k_train_004349
Implement the Python class `IPAddress` described below. Class description: Implementation of the 'IP Address' model. The IP address information referenced by Bouncer when building `ufw` rules Attributes: i_pv_4 (string): IP Address v4 in CIDR Format. Either IPv4 or IPv6 MUST be present. i_pv_6 (string): IP Address v6 ...
Implement the Python class `IPAddress` described below. Class description: Implementation of the 'IP Address' model. The IP address information referenced by Bouncer when building `ufw` rules Attributes: i_pv_4 (string): IP Address v4 in CIDR Format. Either IPv4 or IPv6 MUST be present. i_pv_6 (string): IP Address v6 ...
a178244dbf0b8a165aabc02a5d1ba05006f9ec22
<|skeleton|> class IPAddress: """Implementation of the 'IP Address' model. The IP address information referenced by Bouncer when building `ufw` rules Attributes: i_pv_4 (string): IP Address v4 in CIDR Format. Either IPv4 or IPv6 MUST be present. i_pv_6 (string): IP Address v6 in CIDR Format. Either IPv4 or IPv6 MUS...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IPAddress: """Implementation of the 'IP Address' model. The IP address information referenced by Bouncer when building `ufw` rules Attributes: i_pv_4 (string): IP Address v4 in CIDR Format. Either IPv4 or IPv6 MUST be present. i_pv_6 (string): IP Address v6 in CIDR Format. Either IPv4 or IPv6 MUST be present....
the_stack_v2_python_sparse
sdk/python/bouncerapi/models/ip_address.py
nmfta-repo/nmfta-bouncer
train
1
837e832b59279df66cbd53e5b3eb8b7384cdef11
[ "self._lock = Lock()\nself._condition = Condition(self._lock)\nself._last_rubble = None\nself._qr_sub = rospy.Subscriber('/qr_codes', String, callback=self.qr_cb, queue_size=5)\nself._as = actionlib.SimpleActionServer(action_server_name, RubbleCheckAction, execute_cb=self.execute_cb, auto_start=False)\nself._as.sta...
<|body_start_0|> self._lock = Lock() self._condition = Condition(self._lock) self._last_rubble = None self._qr_sub = rospy.Subscriber('/qr_codes', String, callback=self.qr_cb, queue_size=5) self._as = actionlib.SimpleActionServer(action_server_name, RubbleCheckAction, execute_cb=...
Class for rubble check action server. Attributes: _lock: For locking access to qr messages _condition: Condition variable _last_rubble: Last rubble message received _as: The action server _qr_sub: The subscriber to the qr code topic
RubbleCheckServer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RubbleCheckServer: """Class for rubble check action server. Attributes: _lock: For locking access to qr messages _condition: Condition variable _last_rubble: Last rubble message received _as: The action server _qr_sub: The subscriber to the qr code topic""" def __init__(self, action_server_n...
stack_v2_sparse_classes_36k_train_021958
2,928
no_license
[ { "docstring": "Creates and starts the action server. Args: action_server_name: The name of the action server.", "name": "__init__", "signature": "def __init__(self, action_server_name)" }, { "docstring": "Checks qr topic until something is called or timeout reached. Args: goal: Goal message (em...
3
stack_v2_sparse_classes_30k_train_006261
Implement the Python class `RubbleCheckServer` described below. Class description: Class for rubble check action server. Attributes: _lock: For locking access to qr messages _condition: Condition variable _last_rubble: Last rubble message received _as: The action server _qr_sub: The subscriber to the qr code topic Me...
Implement the Python class `RubbleCheckServer` described below. Class description: Class for rubble check action server. Attributes: _lock: For locking access to qr messages _condition: Condition variable _last_rubble: Last rubble message received _as: The action server _qr_sub: The subscriber to the qr code topic Me...
6217a34519dac55a4597410250f2d26ed23cbcf6
<|skeleton|> class RubbleCheckServer: """Class for rubble check action server. Attributes: _lock: For locking access to qr messages _condition: Condition variable _last_rubble: Last rubble message received _as: The action server _qr_sub: The subscriber to the qr code topic""" def __init__(self, action_server_n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RubbleCheckServer: """Class for rubble check action server. Attributes: _lock: For locking access to qr messages _condition: Condition variable _last_rubble: Last rubble message received _as: The action server _qr_sub: The subscriber to the qr code topic""" def __init__(self, action_server_name): ...
the_stack_v2_python_sparse
aims_rubble_check/scripts/rubble_check_server.py
Forrest-Z/aims_ori_wheel
train
0
fd05645598835592fb1e9c22e8857f6c99964232
[ "self.path = self.__default_filepath if filepath is None else filepath\nself.parser = configparser.ConfigParser()\nif self.__section_default not in self.parser.sections():\n self.parser.add_section(self.__section_default)\nself.parser.read(self.path)", "if self.parser.has_option(section, name):\n return sel...
<|body_start_0|> self.path = self.__default_filepath if filepath is None else filepath self.parser = configparser.ConfigParser() if self.__section_default not in self.parser.sections(): self.parser.add_section(self.__section_default) self.parser.read(self.path) <|end_body_0|>...
A controller class for getting and setting key/value pairs in the config file
Controller
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: """A controller class for getting and setting key/value pairs in the config file""" def __init__(self, filepath=None): """Create an instance of a config controller for getting and setting information""" <|body_0|> def get(self, name, section=__section_default...
stack_v2_sparse_classes_36k_train_021959
2,040
permissive
[ { "docstring": "Create an instance of a config controller for getting and setting information", "name": "__init__", "signature": "def __init__(self, filepath=None)" }, { "docstring": "Returns a value with a given name from the configuration file.", "name": "get", "signature": "def get(se...
4
stack_v2_sparse_classes_30k_train_021047
Implement the Python class `Controller` described below. Class description: A controller class for getting and setting key/value pairs in the config file Method signatures and docstrings: - def __init__(self, filepath=None): Create an instance of a config controller for getting and setting information - def get(self,...
Implement the Python class `Controller` described below. Class description: A controller class for getting and setting key/value pairs in the config file Method signatures and docstrings: - def __init__(self, filepath=None): Create an instance of a config controller for getting and setting information - def get(self,...
25bc6118427f3b369fb61ba0bd38c977be05644f
<|skeleton|> class Controller: """A controller class for getting and setting key/value pairs in the config file""" def __init__(self, filepath=None): """Create an instance of a config controller for getting and setting information""" <|body_0|> def get(self, name, section=__section_default...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Controller: """A controller class for getting and setting key/value pairs in the config file""" def __init__(self, filepath=None): """Create an instance of a config controller for getting and setting information""" self.path = self.__default_filepath if filepath is None else filepath ...
the_stack_v2_python_sparse
apiwrapper/config/controller.py
OGKevin/ComBunqWebApp
train
31
3a8b2f25b2ede5a50ac79f6478866acedd225294
[ "self.content_type = content_type\nself.s3_uri = s3_uri\nself.content_digest = content_digest", "file_source_request = {'S3Uri': self.s3_uri}\nif self.content_digest is not None:\n file_source_request['ContentDigest'] = self.content_digest\nif self.content_type is not None:\n file_source_request['ContentTyp...
<|body_start_0|> self.content_type = content_type self.s3_uri = s3_uri self.content_digest = content_digest <|end_body_0|> <|body_start_1|> file_source_request = {'S3Uri': self.s3_uri} if self.content_digest is not None: file_source_request['ContentDigest'] = self.co...
Accepts file source parameters for conversion to request dict.
FileSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileSource: """Accepts file source parameters for conversion to request dict.""" def __init__(self, s3_uri: Union[str, PipelineVariable], content_digest: Optional[Union[str, PipelineVariable]]=None, content_type: Optional[Union[str, PipelineVariable]]=None): """Initialize a ``FileSou...
stack_v2_sparse_classes_36k_train_021960
7,143
permissive
[ { "docstring": "Initialize a ``FileSource`` instance and turn parameters into dict. Args: s3_uri (str or PipelineVariable): The S3 URI of the metric content_digest (str or PipelineVariable): The digest of the metric (default: None) content_type (str or PipelineVariable): Specifies the type of content in S3 URI ...
2
null
Implement the Python class `FileSource` described below. Class description: Accepts file source parameters for conversion to request dict. Method signatures and docstrings: - def __init__(self, s3_uri: Union[str, PipelineVariable], content_digest: Optional[Union[str, PipelineVariable]]=None, content_type: Optional[Un...
Implement the Python class `FileSource` described below. Class description: Accepts file source parameters for conversion to request dict. Method signatures and docstrings: - def __init__(self, s3_uri: Union[str, PipelineVariable], content_digest: Optional[Union[str, PipelineVariable]]=None, content_type: Optional[Un...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class FileSource: """Accepts file source parameters for conversion to request dict.""" def __init__(self, s3_uri: Union[str, PipelineVariable], content_digest: Optional[Union[str, PipelineVariable]]=None, content_type: Optional[Union[str, PipelineVariable]]=None): """Initialize a ``FileSou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileSource: """Accepts file source parameters for conversion to request dict.""" def __init__(self, s3_uri: Union[str, PipelineVariable], content_digest: Optional[Union[str, PipelineVariable]]=None, content_type: Optional[Union[str, PipelineVariable]]=None): """Initialize a ``FileSource`` instanc...
the_stack_v2_python_sparse
src/sagemaker/model_metrics.py
aws/sagemaker-python-sdk
train
2,050
2a50bb02d8ef45ec96a91d48a2ff4dd94eee5e84
[ "with TemporaryDirectory() as temp:\n trim([self.path / 'input/run'], self.path / 'samples.csv', dir_out=temp)\n files = sorted([p.name for p in Path(temp).glob('*')])\n files_expected = sorted([p.name for p in (self.path / 'output').glob('*')])\n self.assertEqual(files_expected, files)\n for path in...
<|body_start_0|> with TemporaryDirectory() as temp: trim([self.path / 'input/run'], self.path / 'samples.csv', dir_out=temp) files = sorted([p.name for p in Path(temp).glob('*')]) files_expected = sorted([p.name for p in (self.path / 'output').glob('*')]) self.ass...
Basic tests of trim with actual cutadapt. Here we have a simple case with two sample with perfect adapters in R1 and R2. We should see the adapters get removed in the output, cutadapt's JSON report written, and our counts.csv files written. This should work with either a directory or individual R1/R2 pairs as input. Ea...
TestTrimLive
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestTrimLive: """Basic tests of trim with actual cutadapt. Here we have a simple case with two sample with perfect adapters in R1 and R2. We should see the adapters get removed in the output, cutadapt's JSON report written, and our counts.csv files written. This should work with either a director...
stack_v2_sparse_classes_36k_train_021961
2,759
no_license
[ { "docstring": "Test that adapters are trimmed from R1 and R2 pairs with dir input.", "name": "test_trim_dir_input", "signature": "def test_trim_dir_input(self)" }, { "docstring": "Test that adapters are trimmed from R1 and R2 pairs with file input.", "name": "test_trim_file_input", "sig...
2
stack_v2_sparse_classes_30k_train_008084
Implement the Python class `TestTrimLive` described below. Class description: Basic tests of trim with actual cutadapt. Here we have a simple case with two sample with perfect adapters in R1 and R2. We should see the adapters get removed in the output, cutadapt's JSON report written, and our counts.csv files written. ...
Implement the Python class `TestTrimLive` described below. Class description: Basic tests of trim with actual cutadapt. Here we have a simple case with two sample with perfect adapters in R1 and R2. We should see the adapters get removed in the output, cutadapt's JSON report written, and our counts.csv files written. ...
539868dab2041b7694c0d53e8e74cf1b5b033653
<|skeleton|> class TestTrimLive: """Basic tests of trim with actual cutadapt. Here we have a simple case with two sample with perfect adapters in R1 and R2. We should see the adapters get removed in the output, cutadapt's JSON report written, and our counts.csv files written. This should work with either a director...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestTrimLive: """Basic tests of trim with actual cutadapt. Here we have a simple case with two sample with perfect adapters in R1 and R2. We should see the adapters get removed in the output, cutadapt's JSON report written, and our counts.csv files written. This should work with either a directory or individu...
the_stack_v2_python_sparse
test_igseq/test_trim.py
ShawHahnLab/igseq
train
1
0f77a53beb23197c6f3f9cc240d603ba29f5ba22
[ "from collections import defaultdict\nself.index = defaultdict(set)\nself.nums = []", "if val not in self.index:\n self.nums.append(val)\n self.index[val].add(len(self.nums) - 1)\n return True\nself.nums.append(val)\nself.index[val].add(len(self.nums) - 1)\nreturn False", "if val not in self.index:\n ...
<|body_start_0|> from collections import defaultdict self.index = defaultdict(set) self.nums = [] <|end_body_0|> <|body_start_1|> if val not in self.index: self.nums.append(val) self.index[val].add(len(self.nums) - 1) return True self.nums.app...
RandomizedCollection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomizedCollection: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val: int) -> bool: """Inserts a value to the collection. Returns true if the collection did not already contain the specified element.""" <|body_1...
stack_v2_sparse_classes_36k_train_021962
1,815
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Inserts a value to the collection. Returns true if the collection did not already contain the specified element.", "name": "insert", "signature": "def insert(se...
4
null
Implement the Python class `RandomizedCollection` described below. Class description: Implement the RandomizedCollection class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val: int) -> bool: Inserts a value to the collection. Returns true if the coll...
Implement the Python class `RandomizedCollection` described below. Class description: Implement the RandomizedCollection class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val: int) -> bool: Inserts a value to the collection. Returns true if the coll...
0d59c9fb2bec2bcea706733cba0d4ca73e1db0e8
<|skeleton|> class RandomizedCollection: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val: int) -> bool: """Inserts a value to the collection. Returns true if the collection did not already contain the specified element.""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomizedCollection: def __init__(self): """Initialize your data structure here.""" from collections import defaultdict self.index = defaultdict(set) self.nums = [] def insert(self, val: int) -> bool: """Inserts a value to the collection. Returns true if the colle...
the_stack_v2_python_sparse
LeetCode/LeetCode381.py
LChanger/LeetCode
train
0
89272bb16a1a6d6e609bbc091f224660b5061ede
[ "super().__init__(name=name, **kwargs)\nself._output_last_dim = output_last_dim\nself._output_w_init = output_w_init\nself._use_query_residual = use_query_residual\nself._qk_last_dim = qk_last_dim\nself._v_last_dim = v_last_dim\nself._final_project = False\nself._num_heads = num_heads", "decoder_query_shape = inp...
<|body_start_0|> super().__init__(name=name, **kwargs) self._output_last_dim = output_last_dim self._output_w_init = output_w_init self._use_query_residual = use_query_residual self._qk_last_dim = qk_last_dim self._v_last_dim = v_last_dim self._final_project = Fal...
Perceiver Decoder layer. Uses cross attention decoder layer. This layer implements a Perceiver Decoder from "Perceiver: General Perception with Iterative Attention". (https://arxiv.org/abs/2103.03206) References: [Attention Is All You Need](https://arxiv.org/abs/1706.03762) [Perceiver: General Perception with Iterative...
Decoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """Perceiver Decoder layer. Uses cross attention decoder layer. This layer implements a Perceiver Decoder from "Perceiver: General Perception with Iterative Attention". (https://arxiv.org/abs/2103.03206) References: [Attention Is All You Need](https://arxiv.org/abs/1706.03762) [Perceiver...
stack_v2_sparse_classes_36k_train_021963
5,196
permissive
[ { "docstring": "Init. Args: output_last_dim: Last dim size for output. qk_last_dim: When set, determines the last dimension of the attention score output. Check `qk_last_dim` doc in `utils.build_cross_attention_block_args`. v_last_dim: When set, determines the value's last dimension in the multi-head attention....
3
null
Implement the Python class `Decoder` described below. Class description: Perceiver Decoder layer. Uses cross attention decoder layer. This layer implements a Perceiver Decoder from "Perceiver: General Perception with Iterative Attention". (https://arxiv.org/abs/2103.03206) References: [Attention Is All You Need](https...
Implement the Python class `Decoder` described below. Class description: Perceiver Decoder layer. Uses cross attention decoder layer. This layer implements a Perceiver Decoder from "Perceiver: General Perception with Iterative Attention". (https://arxiv.org/abs/2103.03206) References: [Attention Is All You Need](https...
d3507b550a3ade40cade60a79eb5b8978b56c7ae
<|skeleton|> class Decoder: """Perceiver Decoder layer. Uses cross attention decoder layer. This layer implements a Perceiver Decoder from "Perceiver: General Perception with Iterative Attention". (https://arxiv.org/abs/2103.03206) References: [Attention Is All You Need](https://arxiv.org/abs/1706.03762) [Perceiver...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Decoder: """Perceiver Decoder layer. Uses cross attention decoder layer. This layer implements a Perceiver Decoder from "Perceiver: General Perception with Iterative Attention". (https://arxiv.org/abs/2103.03206) References: [Attention Is All You Need](https://arxiv.org/abs/1706.03762) [Perceiver: General Per...
the_stack_v2_python_sparse
official/projects/perceiver/modeling/layers/decoder.py
jianzhnie/models
train
2
17e687ecd76601cb44d77bc8a36681eb9e327c97
[ "super().__init__()\nself.bg_file = bg_file\nself.rmap = rmap\nself.ref_file = ref_file\nself.vcf_file = vcf_file\nself.inputq = inputq\nself.outputter = outputter\nself.annotations = annotations\nif outputter.sample_column:\n self.sample_index = outputter.sample_column - 9\nelse:\n self.sample_index = None\n...
<|body_start_0|> super().__init__() self.bg_file = bg_file self.rmap = rmap self.ref_file = ref_file self.vcf_file = vcf_file self.inputq = inputq self.outputter = outputter self.annotations = annotations if outputter.sample_column: sel...
Fetches vcf entries in a region and calculates coverage to enotype
PCMP
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PCMP: """Fetches vcf entries in a region and calculates coverage to enotype""" def __init__(self, bg_file, rmap, ref_file, vcf_file, inputq, outputter, annotations, ref_pad_bases, passonly=None, phasing=False): """Runs over regions""" <|body_0|> def process_region(self, ...
stack_v2_sparse_classes_36k_train_021964
35,836
permissive
[ { "docstring": "Runs over regions", "name": "__init__", "signature": "def __init__(self, bg_file, rmap, ref_file, vcf_file, inputq, outputter, annotations, ref_pad_bases, passonly=None, phasing=False)" }, { "docstring": "work on all the entries in a region # this needs to fetch the vcf entries #...
6
null
Implement the Python class `PCMP` described below. Class description: Fetches vcf entries in a region and calculates coverage to enotype Method signatures and docstrings: - def __init__(self, bg_file, rmap, ref_file, vcf_file, inputq, outputter, annotations, ref_pad_bases, passonly=None, phasing=False): Runs over reg...
Implement the Python class `PCMP` described below. Class description: Fetches vcf entries in a region and calculates coverage to enotype Method signatures and docstrings: - def __init__(self, bg_file, rmap, ref_file, vcf_file, inputq, outputter, annotations, ref_pad_bases, passonly=None, phasing=False): Runs over reg...
5f40198e95b0626ae143e021ec97884de634e61d
<|skeleton|> class PCMP: """Fetches vcf entries in a region and calculates coverage to enotype""" def __init__(self, bg_file, rmap, ref_file, vcf_file, inputq, outputter, annotations, ref_pad_bases, passonly=None, phasing=False): """Runs over regions""" <|body_0|> def process_region(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PCMP: """Fetches vcf entries in a region and calculates coverage to enotype""" def __init__(self, bg_file, rmap, ref_file, vcf_file, inputq, outputter, annotations, ref_pad_bases, passonly=None, phasing=False): """Runs over regions""" super().__init__() self.bg_file = bg_file ...
the_stack_v2_python_sparse
python/biograph/tools/coverage.py
spiralgenetics/biograph
train
21
a371f4a2a4444c83b33edfdbd76d304f7d132049
[ "self.object_name = object_name\nself.comparitor = comparitor\nself.threshold = threshold\nself.feature = feature\nself.weights = weights", "values = measurements.get_current_measurement(self.object_name, self.feature)\nif values is None:\n values = np.array([np.NaN])\nelif np.isscalar(values):\n values = n...
<|body_start_0|> self.object_name = object_name self.comparitor = comparitor self.threshold = threshold self.feature = feature self.weights = weights <|end_body_0|> <|body_start_1|> values = measurements.get_current_measurement(self.object_name, self.feature) if ...
Represents a single rule
Rule
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rule: """Represents a single rule""" def __init__(self, object_name, feature, comparitor, threshold, weights): """Create a rule object_name - the name of the object in the measurements feature - the name of the measurement (for instance, "AreaShape_Area") comparitor - the comparison ...
stack_v2_sparse_classes_36k_train_021965
5,488
permissive
[ { "docstring": "Create a rule object_name - the name of the object in the measurements feature - the name of the measurement (for instance, \"AreaShape_Area\") comparitor - the comparison to be performed (for instance, \">\") threshold - the positive / negative threshold for the comparison weights - a 2xN matri...
2
stack_v2_sparse_classes_30k_train_020904
Implement the Python class `Rule` described below. Class description: Represents a single rule Method signatures and docstrings: - def __init__(self, object_name, feature, comparitor, threshold, weights): Create a rule object_name - the name of the object in the measurements feature - the name of the measurement (for...
Implement the Python class `Rule` described below. Class description: Represents a single rule Method signatures and docstrings: - def __init__(self, object_name, feature, comparitor, threshold, weights): Create a rule object_name - the name of the object in the measurements feature - the name of the measurement (for...
1d230f129588838a926f93a47b86aa045a8ba93c
<|skeleton|> class Rule: """Represents a single rule""" def __init__(self, object_name, feature, comparitor, threshold, weights): """Create a rule object_name - the name of the object in the measurements feature - the name of the measurement (for instance, "AreaShape_Area") comparitor - the comparison ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Rule: """Represents a single rule""" def __init__(self, object_name, feature, comparitor, threshold, weights): """Create a rule object_name - the name of the object in the measurements feature - the name of the measurement (for instance, "AreaShape_Area") comparitor - the comparison to be perform...
the_stack_v2_python_sparse
cellprofiler/utilities/rules.py
votti/CellProfiler
train
0
370ebfa3944c455fab11b29d1bfb942bda7d2ab0
[ "self.url = '/ydtp-backend-service/api/central/duty_info'\nre = self.get(url=self.zby_api, headers=form_headers)\nreturn re.json()", "self.url = '/ydtp-backend-service/api/hand_over_central_duty'\ndata = {'user_id': user, 'password': pwd}\nre = self.post(self.zby_api, data=data, headers=form_headers)\nreturn re.j...
<|body_start_0|> self.url = '/ydtp-backend-service/api/central/duty_info' re = self.get(url=self.zby_api, headers=form_headers) return re.json() <|end_body_0|> <|body_start_1|> self.url = '/ydtp-backend-service/api/hand_over_central_duty' data = {'user_id': user, 'password': pwd...
个人中心
CentralPersonalInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CentralPersonalInfo: """个人中心""" def duty_info(self): """个人信息""" <|body_0|> def handOverCentralDuty(self, user, pwd): """中央收费处交接班""" <|body_1|> def centralOffDuty(self): """中央收费处下班""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_021966
988
no_license
[ { "docstring": "个人信息", "name": "duty_info", "signature": "def duty_info(self)" }, { "docstring": "中央收费处交接班", "name": "handOverCentralDuty", "signature": "def handOverCentralDuty(self, user, pwd)" }, { "docstring": "中央收费处下班", "name": "centralOffDuty", "signature": "def cen...
3
stack_v2_sparse_classes_30k_train_007127
Implement the Python class `CentralPersonalInfo` described below. Class description: 个人中心 Method signatures and docstrings: - def duty_info(self): 个人信息 - def handOverCentralDuty(self, user, pwd): 中央收费处交接班 - def centralOffDuty(self): 中央收费处下班
Implement the Python class `CentralPersonalInfo` described below. Class description: 个人中心 Method signatures and docstrings: - def duty_info(self): 个人信息 - def handOverCentralDuty(self, user, pwd): 中央收费处交接班 - def centralOffDuty(self): 中央收费处下班 <|skeleton|> class CentralPersonalInfo: """个人中心""" def duty_info(se...
34c368c109867da26d9256bca85f872b0fac2ea7
<|skeleton|> class CentralPersonalInfo: """个人中心""" def duty_info(self): """个人信息""" <|body_0|> def handOverCentralDuty(self, user, pwd): """中央收费处交接班""" <|body_1|> def centralOffDuty(self): """中央收费处下班""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CentralPersonalInfo: """个人中心""" def duty_info(self): """个人信息""" self.url = '/ydtp-backend-service/api/central/duty_info' re = self.get(url=self.zby_api, headers=form_headers) return re.json() def handOverCentralDuty(self, user, pwd): """中央收费处交接班""" sel...
the_stack_v2_python_sparse
Api/centralTollCollection_service/centralPersonalInfo.py
oyebino/pomp_api
train
1
1ae74b7040b53eac06642d2bfb15618f68ba8725
[ "if isinstance(value, Integral):\n return value\nraise TypeError", "if value is None:\n return None\nelse:\n try:\n return int(value)\n except:\n try:\n return long(value)\n except:\n raise TypeError" ]
<|body_start_0|> if isinstance(value, Integral): return value raise TypeError <|end_body_0|> <|body_start_1|> if value is None: return None else: try: return int(value) except: try: retur...
处理 int(long) 类型值的转换。
IntTypeCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IntTypeCase: """处理 int(long) 类型值的转换。""" def to_redis(value): """接受 int 类型值,否则抛出 TypeError 。""" <|body_0|> def to_python(value): """尝试将值转回 int 类型, 如果转换失败,抛出 TypeError。""" <|body_1|> <|end_skeleton|> <|body_start_0|> if isinstance(value, Integral)...
stack_v2_sparse_classes_36k_train_021967
753
no_license
[ { "docstring": "接受 int 类型值,否则抛出 TypeError 。", "name": "to_redis", "signature": "def to_redis(value)" }, { "docstring": "尝试将值转回 int 类型, 如果转换失败,抛出 TypeError。", "name": "to_python", "signature": "def to_python(value)" } ]
2
stack_v2_sparse_classes_30k_train_000342
Implement the Python class `IntTypeCase` described below. Class description: 处理 int(long) 类型值的转换。 Method signatures and docstrings: - def to_redis(value): 接受 int 类型值,否则抛出 TypeError 。 - def to_python(value): 尝试将值转回 int 类型, 如果转换失败,抛出 TypeError。
Implement the Python class `IntTypeCase` described below. Class description: 处理 int(long) 类型值的转换。 Method signatures and docstrings: - def to_redis(value): 接受 int 类型值,否则抛出 TypeError 。 - def to_python(value): 尝试将值转回 int 类型, 如果转换失败,抛出 TypeError。 <|skeleton|> class IntTypeCase: """处理 int(long) 类型值的转换。""" def to...
f9fb551afbf47aaca7cdeba8b64a32d2fe3e30d6
<|skeleton|> class IntTypeCase: """处理 int(long) 类型值的转换。""" def to_redis(value): """接受 int 类型值,否则抛出 TypeError 。""" <|body_0|> def to_python(value): """尝试将值转回 int 类型, 如果转换失败,抛出 TypeError。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IntTypeCase: """处理 int(long) 类型值的转换。""" def to_redis(value): """接受 int 类型值,否则抛出 TypeError 。""" if isinstance(value, Integral): return value raise TypeError def to_python(value): """尝试将值转回 int 类型, 如果转换失败,抛出 TypeError。""" if value is None: ...
the_stack_v2_python_sparse
mysite/base/ooredis/type_case/int_type_case.py
RockyLiys/erp
train
1
7f02a712bd24ffc1fc9155af5a78881d76225f18
[ "self.agent_upgrade_task = agent_upgrade_task\nself.analysis_task = analysis_task\nself.backup_task = backup_task\nself.bulk_install_app_task = bulk_install_app_task\nself.clone_task = clone_task\nself.created_time_secs = created_time_secs\nself.description = description\nself.dismissed = dismissed\nself.dismissed_...
<|body_start_0|> self.agent_upgrade_task = agent_upgrade_task self.analysis_task = analysis_task self.backup_task = backup_task self.bulk_install_app_task = bulk_install_app_task self.clone_task = clone_task self.created_time_secs = created_time_secs self.descript...
Implementation of the 'TaskNotification' model. Structure that captures Task Notifications for a user. Attributes: agent_upgrade_task (AgentUpgradeTaskInfo): The notification details of Agent upgrade Task. analysis_task (AnalysisTaskInfo): The notifications details of Analysis Task. backup_task (BackupTaskInfo): The no...
TaskNotification
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskNotification: """Implementation of the 'TaskNotification' model. Structure that captures Task Notifications for a user. Attributes: agent_upgrade_task (AgentUpgradeTaskInfo): The notification details of Agent upgrade Task. analysis_task (AnalysisTaskInfo): The notifications details of Analysi...
stack_v2_sparse_classes_36k_train_021968
8,762
permissive
[ { "docstring": "Constructor for the TaskNotification class", "name": "__init__", "signature": "def __init__(self, agent_upgrade_task=None, analysis_task=None, backup_task=None, bulk_install_app_task=None, clone_task=None, created_time_secs=None, description=None, dismissed=None, dismissed_time_secs=None...
2
stack_v2_sparse_classes_30k_val_000934
Implement the Python class `TaskNotification` described below. Class description: Implementation of the 'TaskNotification' model. Structure that captures Task Notifications for a user. Attributes: agent_upgrade_task (AgentUpgradeTaskInfo): The notification details of Agent upgrade Task. analysis_task (AnalysisTaskInfo...
Implement the Python class `TaskNotification` described below. Class description: Implementation of the 'TaskNotification' model. Structure that captures Task Notifications for a user. Attributes: agent_upgrade_task (AgentUpgradeTaskInfo): The notification details of Agent upgrade Task. analysis_task (AnalysisTaskInfo...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class TaskNotification: """Implementation of the 'TaskNotification' model. Structure that captures Task Notifications for a user. Attributes: agent_upgrade_task (AgentUpgradeTaskInfo): The notification details of Agent upgrade Task. analysis_task (AnalysisTaskInfo): The notifications details of Analysi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskNotification: """Implementation of the 'TaskNotification' model. Structure that captures Task Notifications for a user. Attributes: agent_upgrade_task (AgentUpgradeTaskInfo): The notification details of Agent upgrade Task. analysis_task (AnalysisTaskInfo): The notifications details of Analysis Task. backu...
the_stack_v2_python_sparse
cohesity_management_sdk/models/task_notification.py
cohesity/management-sdk-python
train
24
363aab6d0afd1376016ecf93c5e464ad36fe97f9
[ "retDataSet = []\nfor featVec in dataSet:\n if featVec[axis] == value:\n reducedFeatVec = featVec[:axis]\n reducedFeatVec.extend(featVec[axis + 1:])\n retDataSet.append(reducedFeatVec)\nreturn retDataSet", "numFeatures = len(dataSet[0]) - 1\nbaseEntropy = ShannonEnt().calcShannonEnt(dataSe...
<|body_start_0|> retDataSet = [] for featVec in dataSet: if featVec[axis] == value: reducedFeatVec = featVec[:axis] reducedFeatVec.extend(featVec[axis + 1:]) retDataSet.append(reducedFeatVec) return retDataSet <|end_body_0|> <|body_sta...
DecisionEnt
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecisionEnt: def splitDataSet(dataSet, axis, value): """按照给定特征划分数据集 :param dataSet: 待划分的数据集 :param axis: 划分数据集的特征 如:0 :param value: 特征的返回值 如:0 结果是第一个字符为0的各个子列表 :return:""" <|body_0|> def chooseBestFeatureToSplit(self, dataSet): """选择最优特征, Gain(D,g) = Ent(D) - SUM(|Dv...
stack_v2_sparse_classes_36k_train_021969
9,864
no_license
[ { "docstring": "按照给定特征划分数据集 :param dataSet: 待划分的数据集 :param axis: 划分数据集的特征 如:0 :param value: 特征的返回值 如:0 结果是第一个字符为0的各个子列表 :return:", "name": "splitDataSet", "signature": "def splitDataSet(dataSet, axis, value)" }, { "docstring": "选择最优特征, Gain(D,g) = Ent(D) - SUM(|Dv|/|D|)*Ent(Dv) :param dataSet: 数...
4
stack_v2_sparse_classes_30k_train_000658
Implement the Python class `DecisionEnt` described below. Class description: Implement the DecisionEnt class. Method signatures and docstrings: - def splitDataSet(dataSet, axis, value): 按照给定特征划分数据集 :param dataSet: 待划分的数据集 :param axis: 划分数据集的特征 如:0 :param value: 特征的返回值 如:0 结果是第一个字符为0的各个子列表 :return: - def chooseBestFea...
Implement the Python class `DecisionEnt` described below. Class description: Implement the DecisionEnt class. Method signatures and docstrings: - def splitDataSet(dataSet, axis, value): 按照给定特征划分数据集 :param dataSet: 待划分的数据集 :param axis: 划分数据集的特征 如:0 :param value: 特征的返回值 如:0 结果是第一个字符为0的各个子列表 :return: - def chooseBestFea...
42b82bab46e00dfbdd6b66a3581f35d62f12d3de
<|skeleton|> class DecisionEnt: def splitDataSet(dataSet, axis, value): """按照给定特征划分数据集 :param dataSet: 待划分的数据集 :param axis: 划分数据集的特征 如:0 :param value: 特征的返回值 如:0 结果是第一个字符为0的各个子列表 :return:""" <|body_0|> def chooseBestFeatureToSplit(self, dataSet): """选择最优特征, Gain(D,g) = Ent(D) - SUM(|Dv...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecisionEnt: def splitDataSet(dataSet, axis, value): """按照给定特征划分数据集 :param dataSet: 待划分的数据集 :param axis: 划分数据集的特征 如:0 :param value: 特征的返回值 如:0 结果是第一个字符为0的各个子列表 :return:""" retDataSet = [] for featVec in dataSet: if featVec[axis] == value: reducedFeatVec = fe...
the_stack_v2_python_sparse
决策树/DecisionTree/ShannonEntropy.py
LiuX666/Machin_learning
train
0
058247bfe20f7d32a0080121ecf6f7fe92003dc0
[ "my_grid = grid_setup(self.rp, ng=4)\nmy_data = fv.FV2d(my_grid)\nbc = bc_setup(self.rp)[0]\nmy_data.register_var('density', bc)\nmy_data.create()\nself.cc_data = my_data\nif self.rp.get_param('particles.do_particles') == 1:\n n_particles = self.rp.get_param('particles.n_particles')\n particle_generator = sel...
<|body_start_0|> my_grid = grid_setup(self.rp, ng=4) my_data = fv.FV2d(my_grid) bc = bc_setup(self.rp)[0] my_data.register_var('density', bc) my_data.create() self.cc_data = my_data if self.rp.get_param('particles.do_particles') == 1: n_particles = sel...
Simulation
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Simulation: def initialize(self): """Initialize the grid and variables for advection and set the initial conditions for the chosen problem.""" <|body_0|> def substep(self, myd): """take a single substep in the RK timestepping starting with the conservative state defi...
stack_v2_sparse_classes_36k_train_021970
1,846
permissive
[ { "docstring": "Initialize the grid and variables for advection and set the initial conditions for the chosen problem.", "name": "initialize", "signature": "def initialize(self)" }, { "docstring": "take a single substep in the RK timestepping starting with the conservative state defined as part ...
2
null
Implement the Python class `Simulation` described below. Class description: Implement the Simulation class. Method signatures and docstrings: - def initialize(self): Initialize the grid and variables for advection and set the initial conditions for the chosen problem. - def substep(self, myd): take a single substep i...
Implement the Python class `Simulation` described below. Class description: Implement the Simulation class. Method signatures and docstrings: - def initialize(self): Initialize the grid and variables for advection and set the initial conditions for the chosen problem. - def substep(self, myd): take a single substep i...
f91789a319caa98dfbc3f496e9953756e6ee3ca9
<|skeleton|> class Simulation: def initialize(self): """Initialize the grid and variables for advection and set the initial conditions for the chosen problem.""" <|body_0|> def substep(self, myd): """take a single substep in the RK timestepping starting with the conservative state defi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Simulation: def initialize(self): """Initialize the grid and variables for advection and set the initial conditions for the chosen problem.""" my_grid = grid_setup(self.rp, ng=4) my_data = fv.FV2d(my_grid) bc = bc_setup(self.rp)[0] my_data.register_var('density', bc) ...
the_stack_v2_python_sparse
pyro/advection_fv4/simulation.py
python-hydro/pyro2
train
202
e57bcd00437420e1587ad9161c5f0376240d42d8
[ "ans = [[]]\nfor n in nums:\n new_ans = []\n for l in ans:\n for i in range(len(l) + 1):\n new_ans.append(l[:i] + [n] + l[i:])\n print(i, l, new_ans)\n if i < len(l) and l[i] == n:\n print('skip')\n break\n ans = new_ans\nreturn ans", ...
<|body_start_0|> ans = [[]] for n in nums: new_ans = [] for l in ans: for i in range(len(l) + 1): new_ans.append(l[:i] + [n] + l[i:]) print(i, l, new_ans) if i < len(l) and l[i] == n: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ans = [[]] ...
stack_v2_sparse_classes_36k_train_021971
2,807
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permuteUnique", "signature": "def permuteUnique(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permuteUnique", "signature": "def permuteUnique(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_019370
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]] - def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]] - def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class So...
f3fc71f344cd758cfce77f16ab72992c99ab288e
<|skeleton|> class Solution: def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" ans = [[]] for n in nums: new_ans = [] for l in ans: for i in range(len(l) + 1): new_ans.append(l[:i] + [n] + l[i:]) ...
the_stack_v2_python_sparse
47_permutations2.py
jennyChing/leetCode
train
2
84123323e36d291c029dfec05bf31edac7ee1d2a
[ "self.SetStartDate(month=10, day=8, year=2013)\nself.SetEndDate(month=10, day=17, year=2013)\nself.SetCash(startingCash=100000)\nif self.StartDate.year != 2013 or self.StartDate.month != 10 or self.StartDate.day != 8:\n raise AssertionError(f'Start date was incorrect! Expected 10/8/2013 Recieved {self.StartDate}...
<|body_start_0|> self.SetStartDate(month=10, day=8, year=2013) self.SetEndDate(month=10, day=17, year=2013) self.SetCash(startingCash=100000) if self.StartDate.year != 2013 or self.StartDate.month != 10 or self.StartDate.day != 8: raise AssertionError(f'Start date was incorre...
Regression algorithm that makes use of PythonNet kwargs
NamedArgumentsRegression
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NamedArgumentsRegression: """Regression algorithm that makes use of PythonNet kwargs""" def Initialize(self): """Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.""" <|body_0|> def On...
stack_v2_sparse_classes_36k_train_021972
2,980
permissive
[ { "docstring": "Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.", "name": "Initialize", "signature": "def Initialize(self)" }, { "docstring": "OnData event is the primary entry point for your algorithm. Eac...
2
null
Implement the Python class `NamedArgumentsRegression` described below. Class description: Regression algorithm that makes use of PythonNet kwargs Method signatures and docstrings: - def Initialize(self): Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algor...
Implement the Python class `NamedArgumentsRegression` described below. Class description: Regression algorithm that makes use of PythonNet kwargs Method signatures and docstrings: - def Initialize(self): Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algor...
b33dd3bc140e14b883f39ecf848a793cf7292277
<|skeleton|> class NamedArgumentsRegression: """Regression algorithm that makes use of PythonNet kwargs""" def Initialize(self): """Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.""" <|body_0|> def On...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NamedArgumentsRegression: """Regression algorithm that makes use of PythonNet kwargs""" def Initialize(self): """Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.""" self.SetStartDate(month=10, day=8, ...
the_stack_v2_python_sparse
Algorithm.Python/NamedArgumentsRegression.py
Capnode/Algoloop
train
87
b2b57eae3dd6257e454da629dc88a142b8609890
[ "token = {'email': email, 'operation': operation, 'key': key}\nif more:\n if not isinstance(more, types.DictType):\n raise TypeError('Expecting a dict')\n token.update(more)\nreturn base64.b64encode(json.dumps(token))", "try:\n confirm_data = json.loads(base64.b64decode(token))\n try:\n ...
<|body_start_0|> token = {'email': email, 'operation': operation, 'key': key} if more: if not isinstance(more, types.DictType): raise TypeError('Expecting a dict') token.update(more) return base64.b64encode(json.dumps(token)) <|end_body_0|> <|body_start_1...
Response status codes.
ConfirmationToken
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfirmationToken: """Response status codes.""" def generate(email, operation, key, more=None): """Returns a Base64 encoded string containing the confirmation data.""" <|body_0|> def process(token): """Process confirmation token and, if valid, extract respective ...
stack_v2_sparse_classes_36k_train_021973
2,194
permissive
[ { "docstring": "Returns a Base64 encoded string containing the confirmation data.", "name": "generate", "signature": "def generate(email, operation, key, more=None)" }, { "docstring": "Process confirmation token and, if valid, extract respective info.", "name": "process", "signature": "d...
2
stack_v2_sparse_classes_30k_train_006083
Implement the Python class `ConfirmationToken` described below. Class description: Response status codes. Method signatures and docstrings: - def generate(email, operation, key, more=None): Returns a Base64 encoded string containing the confirmation data. - def process(token): Process confirmation token and, if valid...
Implement the Python class `ConfirmationToken` described below. Class description: Response status codes. Method signatures and docstrings: - def generate(email, operation, key, more=None): Returns a Base64 encoded string containing the confirmation data. - def process(token): Process confirmation token and, if valid...
0df3033320619d787aab6c81c8445bdd9fb58a9b
<|skeleton|> class ConfirmationToken: """Response status codes.""" def generate(email, operation, key, more=None): """Returns a Base64 encoded string containing the confirmation data.""" <|body_0|> def process(token): """Process confirmation token and, if valid, extract respective ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConfirmationToken: """Response status codes.""" def generate(email, operation, key, more=None): """Returns a Base64 encoded string containing the confirmation data.""" token = {'email': email, 'operation': operation, 'key': key} if more: if not isinstance(more, types.D...
the_stack_v2_python_sparse
yaccounts/utils.py
andrecrt/django-yaccounts
train
0
3b0401d4e87768b1f6e20eb4f30eefb933cefd9e
[ "self.function = function\nself.var = var\nself.finite_support = np.isfinite(support)\nself.support = support / np.sqrt(self.var)", "if self.finite_support:\n return self.support * bw\nelse:\n\n def f(x):\n return self.evaluate(x, bw=bw) - atol\n try:\n xtol = 0.001\n ans = brentq(f,...
<|body_start_0|> self.function = function self.var = var self.finite_support = np.isfinite(support) self.support = support / np.sqrt(self.var) <|end_body_0|> <|body_start_1|> if self.finite_support: return self.support * bw else: def f(x): ...
Kernel
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Kernel: def __init__(self, function, var=1, support=3): """Initialize a new kernel function. function: callable, numpy.arr -> numpy.arr, should integrate to 1 expected_value : peak, typically 0 support: support of the function. Example ------- >>> from scipy.special import gamma >>> # No...
stack_v2_sparse_classes_36k_train_021974
10,297
permissive
[ { "docstring": "Initialize a new kernel function. function: callable, numpy.arr -> numpy.arr, should integrate to 1 expected_value : peak, typically 0 support: support of the function. Example ------- >>> from scipy.special import gamma >>> # Normalized function of x >>> def exp(x, dims=1): ... normalization = ...
3
stack_v2_sparse_classes_30k_train_002831
Implement the Python class `Kernel` described below. Class description: Implement the Kernel class. Method signatures and docstrings: - def __init__(self, function, var=1, support=3): Initialize a new kernel function. function: callable, numpy.arr -> numpy.arr, should integrate to 1 expected_value : peak, typically 0...
Implement the Python class `Kernel` described below. Class description: Implement the Kernel class. Method signatures and docstrings: - def __init__(self, function, var=1, support=3): Initialize a new kernel function. function: callable, numpy.arr -> numpy.arr, should integrate to 1 expected_value : peak, typically 0...
0f7611ee2f7d534b68dd36c8c34900f100e9a8c7
<|skeleton|> class Kernel: def __init__(self, function, var=1, support=3): """Initialize a new kernel function. function: callable, numpy.arr -> numpy.arr, should integrate to 1 expected_value : peak, typically 0 support: support of the function. Example ------- >>> from scipy.special import gamma >>> # No...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Kernel: def __init__(self, function, var=1, support=3): """Initialize a new kernel function. function: callable, numpy.arr -> numpy.arr, should integrate to 1 expected_value : peak, typically 0 support: support of the function. Example ------- >>> from scipy.special import gamma >>> # Normalized funct...
the_stack_v2_python_sparse
KDEpy/kernel_funcs.py
tommyod/KDEpy
train
502
5128d21897591fcb97daa2913be1c0a109d8c41e
[ "res = super(ProductConfigSession, self).get_session_search_domain(product_tmpl_id=product_tmpl_id, state=state, parent_id=parent_id)\nif 'website_id' in self._context:\n public_user_id = request.env.ref('base.public_user').id\n res.append(('website', '=', True))\n if request.env.uid == public_user_id:\n ...
<|body_start_0|> res = super(ProductConfigSession, self).get_session_search_domain(product_tmpl_id=product_tmpl_id, state=state, parent_id=parent_id) if 'website_id' in self._context: public_user_id = request.env.ref('base.public_user').id res.append(('website', '=', True)) ...
ProductConfigSession
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductConfigSession: def get_session_search_domain(self, product_tmpl_id, state='draft', parent_id=None): """Add website relevant arguments to the standard search domain""" <|body_0|> def get_session_vals(self, product_tmpl_id, parent_id=None): """Add website releva...
stack_v2_sparse_classes_36k_train_021975
2,409
no_license
[ { "docstring": "Add website relevant arguments to the standard search domain", "name": "get_session_search_domain", "signature": "def get_session_search_domain(self, product_tmpl_id, state='draft', parent_id=None)" }, { "docstring": "Add website relevant arguments to the session create values", ...
2
stack_v2_sparse_classes_30k_train_005980
Implement the Python class `ProductConfigSession` described below. Class description: Implement the ProductConfigSession class. Method signatures and docstrings: - def get_session_search_domain(self, product_tmpl_id, state='draft', parent_id=None): Add website relevant arguments to the standard search domain - def ge...
Implement the Python class `ProductConfigSession` described below. Class description: Implement the ProductConfigSession class. Method signatures and docstrings: - def get_session_search_domain(self, product_tmpl_id, state='draft', parent_id=None): Add website relevant arguments to the standard search domain - def ge...
5a235827896e6d7bff420f85228d7609715a2efb
<|skeleton|> class ProductConfigSession: def get_session_search_domain(self, product_tmpl_id, state='draft', parent_id=None): """Add website relevant arguments to the standard search domain""" <|body_0|> def get_session_vals(self, product_tmpl_id, parent_id=None): """Add website releva...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProductConfigSession: def get_session_search_domain(self, product_tmpl_id, state='draft', parent_id=None): """Add website relevant arguments to the standard search domain""" res = super(ProductConfigSession, self).get_session_search_domain(product_tmpl_id=product_tmpl_id, state=state, parent_i...
the_stack_v2_python_sparse
website_product_configurator/models/product_config.py
AULODE/somafish_2019
train
1
e1503bdc515cff30f2d36cedff0c87f37cd12b73
[ "Bar.__init__(self, w, h)\nself.character = character\nself._colour = MP_BLUE", "self._base.fill(DARK_PURPLE)\nratio = self.character.curr_mp / self.character.max_mp\nnew_w = int(ratio * self._w)\nself._top = pg.Surface((new_w, self._h))\nself._top.fill(self._colour)" ]
<|body_start_0|> Bar.__init__(self, w, h) self.character = character self._colour = MP_BLUE <|end_body_0|> <|body_start_1|> self._base.fill(DARK_PURPLE) ratio = self.character.curr_mp / self.character.max_mp new_w = int(ratio * self._w) self._top = pg.Surface((ne...
Class for drawing party members' MP bars in battle.
MPBar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MPBar: """Class for drawing party members' MP bars in battle.""" def __init__(self, w, h, character): """Class constructor for MP bars. args: character: Character object; specifies the character associated with the bar colour: colour tuple; colour of the bar""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_021976
3,427
no_license
[ { "docstring": "Class constructor for MP bars. args: character: Character object; specifies the character associated with the bar colour: colour tuple; colour of the bar", "name": "__init__", "signature": "def __init__(self, w, h, character)" }, { "docstring": "Updates the bar based on current M...
2
stack_v2_sparse_classes_30k_train_002967
Implement the Python class `MPBar` described below. Class description: Class for drawing party members' MP bars in battle. Method signatures and docstrings: - def __init__(self, w, h, character): Class constructor for MP bars. args: character: Character object; specifies the character associated with the bar colour: ...
Implement the Python class `MPBar` described below. Class description: Class for drawing party members' MP bars in battle. Method signatures and docstrings: - def __init__(self, w, h, character): Class constructor for MP bars. args: character: Character object; specifies the character associated with the bar colour: ...
e86420c145c1d929649ac5d4c98a4d1b75e218a7
<|skeleton|> class MPBar: """Class for drawing party members' MP bars in battle.""" def __init__(self, w, h, character): """Class constructor for MP bars. args: character: Character object; specifies the character associated with the bar colour: colour tuple; colour of the bar""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MPBar: """Class for drawing party members' MP bars in battle.""" def __init__(self, w, h, character): """Class constructor for MP bars. args: character: Character object; specifies the character associated with the bar colour: colour tuple; colour of the bar""" Bar.__init__(self, w, h) ...
the_stack_v2_python_sparse
src/entities/bar.py
nuclearkittens/ot-projekti
train
0
fe6f208cddc84bea8d5bca52e0bc3c6d2764cfcc
[ "tests = ['KIF.test1', 'KIF.test2']\nexpected = 'NAME:test1|test2'\nself.assertEqual(test_runner.get_kif_test_filter(tests), expected)", "tests = ['KIF.test1', 'KIF.test2']\nexpected = '-NAME:test1|test2'\nself.assertEqual(test_runner.get_kif_test_filter(tests, invert=True), expected)" ]
<|body_start_0|> tests = ['KIF.test1', 'KIF.test2'] expected = 'NAME:test1|test2' self.assertEqual(test_runner.get_kif_test_filter(tests), expected) <|end_body_0|> <|body_start_1|> tests = ['KIF.test1', 'KIF.test2'] expected = '-NAME:test1|test2' self.assertEqual(test_ru...
Tests for test_runner.get_kif_test_filter.
GetKIFTestFilterTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetKIFTestFilterTest: """Tests for test_runner.get_kif_test_filter.""" def test_correct(self): """Ensures correctness of filter.""" <|body_0|> def test_correct_inverted(self): """Ensures correctness of inverted filter.""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_021977
19,298
permissive
[ { "docstring": "Ensures correctness of filter.", "name": "test_correct", "signature": "def test_correct(self)" }, { "docstring": "Ensures correctness of inverted filter.", "name": "test_correct_inverted", "signature": "def test_correct_inverted(self)" } ]
2
stack_v2_sparse_classes_30k_train_003809
Implement the Python class `GetKIFTestFilterTest` described below. Class description: Tests for test_runner.get_kif_test_filter. Method signatures and docstrings: - def test_correct(self): Ensures correctness of filter. - def test_correct_inverted(self): Ensures correctness of inverted filter.
Implement the Python class `GetKIFTestFilterTest` described below. Class description: Tests for test_runner.get_kif_test_filter. Method signatures and docstrings: - def test_correct(self): Ensures correctness of filter. - def test_correct_inverted(self): Ensures correctness of inverted filter. <|skeleton|> class Get...
4896f732fc747dfdcfcbac3d442f2d2d42df264a
<|skeleton|> class GetKIFTestFilterTest: """Tests for test_runner.get_kif_test_filter.""" def test_correct(self): """Ensures correctness of filter.""" <|body_0|> def test_correct_inverted(self): """Ensures correctness of inverted filter.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetKIFTestFilterTest: """Tests for test_runner.get_kif_test_filter.""" def test_correct(self): """Ensures correctness of filter.""" tests = ['KIF.test1', 'KIF.test2'] expected = 'NAME:test1|test2' self.assertEqual(test_runner.get_kif_test_filter(tests), expected) def ...
the_stack_v2_python_sparse
ios/build/bots/scripts/test_runner_test.py
Samsung/Castanets
train
58
a6f8effbb72cbea1226d1c5b87cb71ab79e3bea4
[ "inputs, outputs = equation.split('->')\ninput_dims, output_dims = (inputs.split(','), outputs.split(','))\nassert len(input_dims) <= 2, 'Only support at most two inputs'\nassert len(output_dims) == 1, 'Only support single output'\noutput_dim = output_dims[0]\nreturn (input_dims, output_dim)", "dim_char_set = set...
<|body_start_0|> inputs, outputs = equation.split('->') input_dims, output_dims = (inputs.split(','), outputs.split(',')) assert len(input_dims) <= 2, 'Only support at most two inputs' assert len(output_dims) == 1, 'Only support single output' output_dim = output_dims[0] ...
EinsumDims
[ "BSD-3-Clause", "BSD-2-Clause", "LicenseRef-scancode-secret-labs-2011", "LicenseRef-scancode-generic-cla", "BSL-1.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EinsumDims: def parse_equation(cls, equation: str) -> Tuple[List[str], str]: """Parse the einsum equation str to input dim chars and output dim char""" <|body_0|> def parse_dims(cls, input_dims: List[str], output_dim: str) -> 'EinsumDims': """Parse the dims and extra...
stack_v2_sparse_classes_36k_train_021978
6,665
permissive
[ { "docstring": "Parse the einsum equation str to input dim chars and output dim char", "name": "parse_equation", "signature": "def parse_equation(cls, equation: str) -> Tuple[List[str], str]" }, { "docstring": "Parse the dims and extract the contracting, batch, and free dimensions for the left a...
2
stack_v2_sparse_classes_30k_train_002888
Implement the Python class `EinsumDims` described below. Class description: Implement the EinsumDims class. Method signatures and docstrings: - def parse_equation(cls, equation: str) -> Tuple[List[str], str]: Parse the einsum equation str to input dim chars and output dim char - def parse_dims(cls, input_dims: List[s...
Implement the Python class `EinsumDims` described below. Class description: Implement the EinsumDims class. Method signatures and docstrings: - def parse_equation(cls, equation: str) -> Tuple[List[str], str]: Parse the einsum equation str to input dim chars and output dim char - def parse_dims(cls, input_dims: List[s...
a6f7dd4707ac116c0f5fb5f44f42429f38d23ab4
<|skeleton|> class EinsumDims: def parse_equation(cls, equation: str) -> Tuple[List[str], str]: """Parse the einsum equation str to input dim chars and output dim char""" <|body_0|> def parse_dims(cls, input_dims: List[str], output_dim: str) -> 'EinsumDims': """Parse the dims and extra...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EinsumDims: def parse_equation(cls, equation: str) -> Tuple[List[str], str]: """Parse the einsum equation str to input dim chars and output dim char""" inputs, outputs = equation.split('->') input_dims, output_dims = (inputs.split(','), outputs.split(',')) assert len(input_dims...
the_stack_v2_python_sparse
torch/distributed/_tensor/ops/basic_strategy.py
pytorch/pytorch
train
77,092
7c1c547e719c3209dd5e08480cf91d5339a48537
[ "self.driver.get('https://work.weixin.qq.com/wework_admin/frame#apps')\ncookies = self.driver.get_cookies()\nwith shelve.open('cookies') as db:\n db['cookie'] = cookies\nfor cookie in cookies:\n self.driver.add_cookie(cookie)\nself.driver.refresh()", "cookies = []\nwith shelve.open('cookies') as db:\n db...
<|body_start_0|> self.driver.get('https://work.weixin.qq.com/wework_admin/frame#apps') cookies = self.driver.get_cookies() with shelve.open('cookies') as db: db['cookie'] = cookies for cookie in cookies: self.driver.add_cookie(cookie) self.driver.refresh()...
TestHgwarts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestHgwarts: def test_getCookies(self): """获取cookies""" <|body_0|> def test_saveCookies(self): """保存cookies到shelve中""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.driver.get('https://work.weixin.qq.com/wework_admin/frame#apps') cookies...
stack_v2_sparse_classes_36k_train_021979
1,112
no_license
[ { "docstring": "获取cookies", "name": "test_getCookies", "signature": "def test_getCookies(self)" }, { "docstring": "保存cookies到shelve中", "name": "test_saveCookies", "signature": "def test_saveCookies(self)" } ]
2
stack_v2_sparse_classes_30k_train_015171
Implement the Python class `TestHgwarts` described below. Class description: Implement the TestHgwarts class. Method signatures and docstrings: - def test_getCookies(self): 获取cookies - def test_saveCookies(self): 保存cookies到shelve中
Implement the Python class `TestHgwarts` described below. Class description: Implement the TestHgwarts class. Method signatures and docstrings: - def test_getCookies(self): 获取cookies - def test_saveCookies(self): 保存cookies到shelve中 <|skeleton|> class TestHgwarts: def test_getCookies(self): """获取cookies""...
eb3d3aabb8706a0ba649061e5f1aebfb307c5b1d
<|skeleton|> class TestHgwarts: def test_getCookies(self): """获取cookies""" <|body_0|> def test_saveCookies(self): """保存cookies到shelve中""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestHgwarts: def test_getCookies(self): """获取cookies""" self.driver.get('https://work.weixin.qq.com/wework_admin/frame#apps') cookies = self.driver.get_cookies() with shelve.open('cookies') as db: db['cookie'] = cookies for cookie in cookies: sel...
the_stack_v2_python_sparse
WebUITest/实战课程/test_case01.py
sunyanfen1995/HGWZ_syf
train
0
426c05bde6c29282b64aa6bebe82bbd251694892
[ "if n == 1:\n return 0\nif n == 2:\n return 2\ndp_list = [n for n in range(n + 1)]\ndp_list[1] = 0\nfor i in range(3, n + 1):\n j = 1\n list = []\n while j <= i // 2:\n if i % j == 0:\n list.append(j)\n j += 1\n check_list = []\n for each in list:\n check_list.ap...
<|body_start_0|> if n == 1: return 0 if n == 2: return 2 dp_list = [n for n in range(n + 1)] dp_list[1] = 0 for i in range(3, n + 1): j = 1 list = [] while j <= i // 2: if i % j == 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minSteps(self, n): """:type n: int :rtype: int""" <|body_0|> def minSteps2(self, n): """:type n: int :rtype: int""" <|body_1|> def minSteps3(self, n): """:type n: int :rtype: int""" <|body_2|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_36k_train_021980
1,290
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "minSteps", "signature": "def minSteps(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "minSteps2", "signature": "def minSteps2(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "minSteps3", ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSteps(self, n): :type n: int :rtype: int - def minSteps2(self, n): :type n: int :rtype: int - def minSteps3(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSteps(self, n): :type n: int :rtype: int - def minSteps2(self, n): :type n: int :rtype: int - def minSteps3(self, n): :type n: int :rtype: int <|skeleton|> class Solution...
4105e18050b15fc0409c75353ad31be17187dd34
<|skeleton|> class Solution: def minSteps(self, n): """:type n: int :rtype: int""" <|body_0|> def minSteps2(self, n): """:type n: int :rtype: int""" <|body_1|> def minSteps3(self, n): """:type n: int :rtype: int""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minSteps(self, n): """:type n: int :rtype: int""" if n == 1: return 0 if n == 2: return 2 dp_list = [n for n in range(n + 1)] dp_list[1] = 0 for i in range(3, n + 1): j = 1 list = [] while...
the_stack_v2_python_sparse
minSteps.py
NeilWangziyu/Leetcode_py
train
2
e58c19fe5cdd33cd9cab1b8585cf8011a5950bb9
[ "if len(strs) == 1:\n return strs[0]\nelif len(strs) == 0:\n return ''\nlongest = ''\nsize = 0\nj = 0\nwhile j < len(strs[0]) and j < len(strs[1]):\n if strs[0][j] == strs[1][j]:\n size += 1\n else:\n break\n j += 1\nlongest = strs[0][:size]\nfor i in range(2, len(strs)):\n j = 0\n ...
<|body_start_0|> if len(strs) == 1: return strs[0] elif len(strs) == 0: return '' longest = '' size = 0 j = 0 while j < len(strs[0]) and j < len(strs[1]): if strs[0][j] == strs[1][j]: size += 1 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" <|body_0|> def longestCommonPrefix2(self, strs): """Vertical scanning algorithm.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(strs) == 1: re...
stack_v2_sparse_classes_36k_train_021981
1,783
no_license
[ { "docstring": ":type strs: List[str] :rtype: str", "name": "longestCommonPrefix", "signature": "def longestCommonPrefix(self, strs)" }, { "docstring": "Vertical scanning algorithm.", "name": "longestCommonPrefix2", "signature": "def longestCommonPrefix2(self, strs)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefix2(self, strs): Vertical scanning algorithm.
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefix2(self, strs): Vertical scanning algorithm. <|skeleton|> class Solution: def...
b7e92f9a7c4d6652d4901b189f51063ce5520653
<|skeleton|> class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" <|body_0|> def longestCommonPrefix2(self, strs): """Vertical scanning algorithm.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" if len(strs) == 1: return strs[0] elif len(strs) == 0: return '' longest = '' size = 0 j = 0 while j < len(strs[0]) and j < len(strs[1]): ...
the_stack_v2_python_sparse
leetcode/easy/longest_common_prefix.py
abkunal/Data-Structures-and-Algorithms
train
2
8d02b1173ee9efcb235d80fa04868c83971d0df3
[ "super().__init__()\nimport sklearn\nimport sklearn.linear_model\nself.model = sklearn.linear_model.BayesianRidge", "specs = super(BayesianRidge, cls).getInputSpecification()\nspecs.description = 'The \\\\xmlNode{BayesianRidge} is Bayesian Ridge regression.\\n It estimates a probabilistic m...
<|body_start_0|> super().__init__() import sklearn import sklearn.linear_model self.model = sklearn.linear_model.BayesianRidge <|end_body_0|> <|body_start_1|> specs = super(BayesianRidge, cls).getInputSpecification() specs.description = 'The \\xmlNode{BayesianRidge} is B...
Bayesian ARD regression
BayesianRidge
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BayesianRidge: """Bayesian ARD regression""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method to get a reference to a class that speci...
stack_v2_sparse_classes_36k_train_021982
7,228
permissive
[ { "docstring": "Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for...
3
null
Implement the Python class `BayesianRidge` described below. Class description: Bayesian ARD regression Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecification(cls): Method to get a reference ...
Implement the Python class `BayesianRidge` described below. Class description: Bayesian ARD regression Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecification(cls): Method to get a reference ...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class BayesianRidge: """Bayesian ARD regression""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method to get a reference to a class that speci...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BayesianRidge: """Bayesian ARD regression""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" super().__init__() import sklearn import sklearn.linear_model self.model = sklearn.linear_model...
the_stack_v2_python_sparse
ravenframework/SupervisedLearning/ScikitLearn/LinearModel/BayesianRidge.py
idaholab/raven
train
201
a4989dd2ed22b287f2fe0543d3888aa50fbeed93
[ "query = Exercise.get_query(info)\nif author:\n user = UserModel.find_by_username(author)\n return query.order_by(ExerciseModel.name.desc()).filter(ExerciseModel.author == user.id).all()\nreturn query.all()", "query = Exercise.get_query(info)\nif id:\n return query.filter(ExerciseModel.id == id).first()\...
<|body_start_0|> query = Exercise.get_query(info) if author: user = UserModel.find_by_username(author) return query.order_by(ExerciseModel.name.desc()).filter(ExerciseModel.author == user.id).all() return query.all() <|end_body_0|> <|body_start_1|> query = Exerci...
Query
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Query: def resolve_exercises(root, info, author=None): """Return a list of all exercises. Search by author: A user's username.""" <|body_0|> def resolve_exercise(root, info, id=None, name=None, desc=None): """Return a single exercise by id.""" <|body_1|> <|e...
stack_v2_sparse_classes_36k_train_021983
1,111
no_license
[ { "docstring": "Return a list of all exercises. Search by author: A user's username.", "name": "resolve_exercises", "signature": "def resolve_exercises(root, info, author=None)" }, { "docstring": "Return a single exercise by id.", "name": "resolve_exercise", "signature": "def resolve_exe...
2
stack_v2_sparse_classes_30k_train_015278
Implement the Python class `Query` described below. Class description: Implement the Query class. Method signatures and docstrings: - def resolve_exercises(root, info, author=None): Return a list of all exercises. Search by author: A user's username. - def resolve_exercise(root, info, id=None, name=None, desc=None): ...
Implement the Python class `Query` described below. Class description: Implement the Query class. Method signatures and docstrings: - def resolve_exercises(root, info, author=None): Return a list of all exercises. Search by author: A user's username. - def resolve_exercise(root, info, id=None, name=None, desc=None): ...
f0056da32453fce0a9dece90508fcdcad8cc905b
<|skeleton|> class Query: def resolve_exercises(root, info, author=None): """Return a list of all exercises. Search by author: A user's username.""" <|body_0|> def resolve_exercise(root, info, id=None, name=None, desc=None): """Return a single exercise by id.""" <|body_1|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Query: def resolve_exercises(root, info, author=None): """Return a list of all exercises. Search by author: A user's username.""" query = Exercise.get_query(info) if author: user = UserModel.find_by_username(author) return query.order_by(ExerciseModel.name.desc(...
the_stack_v2_python_sparse
stronk/schemas/exercise/query.py
not-monday/stronk-backend
train
3
bac7eb9694e74420e2190ac4dda1dc34118be6d1
[ "connected_indexes = []\nfor i in reversed(range(0, idx)):\n if row[i] == 1:\n connected_indexes.append(i)\n else:\n break\nfor i in range(idx, len(row)):\n if row[i] == 1:\n connected_indexes.append(i)\n else:\n break\nreturn connected_indexes", "opens = [i for i in pre_tu...
<|body_start_0|> connected_indexes = [] for i in reversed(range(0, idx)): if row[i] == 1: connected_indexes.append(i) else: break for i in range(idx, len(row)): if row[i] == 1: connected_indexes.append(i) ...
Percolation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Percolation: def expand_check(self, idx, row): """to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes that is directly linked to tunnel connecting point""" <|body_0|> def isPercolate(self,...
stack_v2_sparse_classes_36k_train_021984
3,374
no_license
[ { "docstring": "to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes that is directly linked to tunnel connecting point", "name": "expand_check", "signature": "def expand_check(self, idx, row)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_train_011188
Implement the Python class `Percolation` described below. Class description: Implement the Percolation class. Method signatures and docstrings: - def expand_check(self, idx, row): to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes...
Implement the Python class `Percolation` described below. Class description: Implement the Percolation class. Method signatures and docstrings: - def expand_check(self, idx, row): to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes...
143422321cbc3715ca08f6c3af8f960a55887ced
<|skeleton|> class Percolation: def expand_check(self, idx, row): """to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes that is directly linked to tunnel connecting point""" <|body_0|> def isPercolate(self,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Percolation: def expand_check(self, idx, row): """to check the valid tunnel connecting in this row starting from the tunnel point from last tunnel then expand the tunnel to all the indexes that is directly linked to tunnel connecting point""" connected_indexes = [] for i in reversed(ra...
the_stack_v2_python_sparse
QuickProjects/Algorithm/p01_percolation.py
jxie0755/Learning_Python
train
0
61d45856e9086d995d36a317c86d342465370442
[ "assert isinstance(display_fn_name, str), '\"display_fn_name\" must be provided as a string.'\nactive_identifying_session_ctx = self.sess.get_context()\ndisplay_subcontext = IdentifyingContext(display_fn_name=display_fn_name, **kwargs)\nreturn active_identifying_session_ctx.merging_context('display_', display_subco...
<|body_start_0|> assert isinstance(display_fn_name, str), '"display_fn_name" must be provided as a string.' active_identifying_session_ctx = self.sess.get_context() display_subcontext = IdentifyingContext(display_fn_name=display_fn_name, **kwargs) return active_identifying_session_ctx.me...
provides functionality for saving figures to file. from pyphoplacecellanalysis.General.Pipeline.Stages.Display import PipelineWithDisplaySavingMixin
PipelineWithDisplaySavingMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PipelineWithDisplaySavingMixin: """provides functionality for saving figures to file. from pyphoplacecellanalysis.General.Pipeline.Stages.Display import PipelineWithDisplaySavingMixin""" def build_display_context_for_session(self, display_fn_name: str, **kwargs) -> 'IdentifyingContext': ...
stack_v2_sparse_classes_36k_train_021985
34,127
permissive
[ { "docstring": "builds a new display context for the session out of kwargs Usage: curr_active_pipeline.build_display_context_for_session(display_fn_name='DecodedEpochSlices', epochs='replays', decoder='long_results_obj')", "name": "build_display_context_for_session", "signature": "def build_display_cont...
4
stack_v2_sparse_classes_30k_train_003857
Implement the Python class `PipelineWithDisplaySavingMixin` described below. Class description: provides functionality for saving figures to file. from pyphoplacecellanalysis.General.Pipeline.Stages.Display import PipelineWithDisplaySavingMixin Method signatures and docstrings: - def build_display_context_for_session...
Implement the Python class `PipelineWithDisplaySavingMixin` described below. Class description: provides functionality for saving figures to file. from pyphoplacecellanalysis.General.Pipeline.Stages.Display import PipelineWithDisplaySavingMixin Method signatures and docstrings: - def build_display_context_for_session...
212399d826284b394fce8894ff1a93133aef783f
<|skeleton|> class PipelineWithDisplaySavingMixin: """provides functionality for saving figures to file. from pyphoplacecellanalysis.General.Pipeline.Stages.Display import PipelineWithDisplaySavingMixin""" def build_display_context_for_session(self, display_fn_name: str, **kwargs) -> 'IdentifyingContext': ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PipelineWithDisplaySavingMixin: """provides functionality for saving figures to file. from pyphoplacecellanalysis.General.Pipeline.Stages.Display import PipelineWithDisplaySavingMixin""" def build_display_context_for_session(self, display_fn_name: str, **kwargs) -> 'IdentifyingContext': """builds...
the_stack_v2_python_sparse
src/pyphoplacecellanalysis/General/Pipeline/Stages/Display.py
CommanderPho/pyPhoPlaceCellAnalysis
train
1
f74071a4c84e8dbae94651f159150cbbf7475626
[ "if not t1:\n return t2\nelif not t2:\n return t1\nelse:\n t1.val += t2.val\n t1.left = self.mergeTrees(t1.left, t2.left)\n t1.right = self.mergeTrees(t1.right, t2.right)\n return t1", "if not t1:\n return t2\nelif not t2:\n return t1\ntraverse_stack = [(t1, t2)]\nwhile traverse_stack:\n ...
<|body_start_0|> if not t1: return t2 elif not t2: return t1 else: t1.val += t2.val t1.left = self.mergeTrees(t1.left, t2.left) t1.right = self.mergeTrees(t1.right, t2.right) return t1 <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTrees(self, t1, t2): """:type t1: TreeNode :type t2: TreeNode :rtype: TreeNode 时间复杂度: O(n) 空间复杂度: O(n)""" <|body_0|> def mergeTreesIter(self, t1, t2): """时间复杂度: O(n) 空间复杂度: O(n)""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n...
stack_v2_sparse_classes_36k_train_021986
1,793
no_license
[ { "docstring": ":type t1: TreeNode :type t2: TreeNode :rtype: TreeNode 时间复杂度: O(n) 空间复杂度: O(n)", "name": "mergeTrees", "signature": "def mergeTrees(self, t1, t2)" }, { "docstring": "时间复杂度: O(n) 空间复杂度: O(n)", "name": "mergeTreesIter", "signature": "def mergeTreesIter(self, t1, t2)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTrees(self, t1, t2): :type t1: TreeNode :type t2: TreeNode :rtype: TreeNode 时间复杂度: O(n) 空间复杂度: O(n) - def mergeTreesIter(self, t1, t2): 时间复杂度: O(n) 空间复杂度: O(n)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTrees(self, t1, t2): :type t1: TreeNode :type t2: TreeNode :rtype: TreeNode 时间复杂度: O(n) 空间复杂度: O(n) - def mergeTreesIter(self, t1, t2): 时间复杂度: O(n) 空间复杂度: O(n) <|skelet...
8853f85214ac88db024d26e228f1848dd5acd933
<|skeleton|> class Solution: def mergeTrees(self, t1, t2): """:type t1: TreeNode :type t2: TreeNode :rtype: TreeNode 时间复杂度: O(n) 空间复杂度: O(n)""" <|body_0|> def mergeTreesIter(self, t1, t2): """时间复杂度: O(n) 空间复杂度: O(n)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTrees(self, t1, t2): """:type t1: TreeNode :type t2: TreeNode :rtype: TreeNode 时间复杂度: O(n) 空间复杂度: O(n)""" if not t1: return t2 elif not t2: return t1 else: t1.val += t2.val t1.left = self.mergeTrees(t1.left, t2....
the_stack_v2_python_sparse
617-MergeTwoBinaryTrees/MergeTwoBinaryTrees.py
cqxmzhc/my_leetcode_solutions
train
2
3c1a63bb7f983fe9682c749ecd2c5f7c8cafbec9
[ "if scale not in ('linear', 'log'):\n raise ValueError('invalid parameter scale: %s' % scale)\nself.name = name\nself.min_value = min_value\nself.max_value = max_value\nself.scale = scale", "if self.scale == 'linear':\n return random.uniform(self.min_value, self.max_value)\nelse:\n log_min_value = math.l...
<|body_start_0|> if scale not in ('linear', 'log'): raise ValueError('invalid parameter scale: %s' % scale) self.name = name self.min_value = min_value self.max_value = max_value self.scale = scale <|end_body_0|> <|body_start_1|> if self.scale == 'linear': ...
An audio transform parameter with min and max value.
AudioTransformParameter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AudioTransformParameter: """An audio transform parameter with min and max value.""" def __init__(self, name, min_value, max_value, scale): """Initialize an AudioTransformParameter. Args: name: The name of the parameter. Should be the same as the name of the parameter passed to sox. m...
stack_v2_sparse_classes_36k_train_021987
9,154
permissive
[ { "docstring": "Initialize an AudioTransformParameter. Args: name: The name of the parameter. Should be the same as the name of the parameter passed to sox. min_value: The minimum value of the parameter, a float. max_value: The maximum value of the parameter, a float. scale: 'linear' or 'log', the scale with wh...
2
null
Implement the Python class `AudioTransformParameter` described below. Class description: An audio transform parameter with min and max value. Method signatures and docstrings: - def __init__(self, name, min_value, max_value, scale): Initialize an AudioTransformParameter. Args: name: The name of the parameter. Should ...
Implement the Python class `AudioTransformParameter` described below. Class description: An audio transform parameter with min and max value. Method signatures and docstrings: - def __init__(self, name, min_value, max_value, scale): Initialize an AudioTransformParameter. Args: name: The name of the parameter. Should ...
548dc4e2e6a8e3ac65e1921bd94fe589d661d47b
<|skeleton|> class AudioTransformParameter: """An audio transform parameter with min and max value.""" def __init__(self, name, min_value, max_value, scale): """Initialize an AudioTransformParameter. Args: name: The name of the parameter. Should be the same as the name of the parameter passed to sox. m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AudioTransformParameter: """An audio transform parameter with min and max value.""" def __init__(self, name, min_value, max_value, scale): """Initialize an AudioTransformParameter. Args: name: The name of the parameter. Should be the same as the name of the parameter passed to sox. min_value: The...
the_stack_v2_python_sparse
magenta/models/onsets_frames_transcription/audio_transform.py
magenta/magenta
train
4,142
15a8faea643011472c446cfaae6fb06ba43d6b87
[ "hops = validated_data.pop('recipe_hops')\nmalts = validated_data.pop('recipe_malts')\nuser = validated_data.pop('user')\nreturn Recipe.objects.create_recipe(user, validated_data, malts, hops)", "instance.recipe_name = validated_data.get('recipe_name', instance.recipe_name)\ninstance.recipe_style = validated_data...
<|body_start_0|> hops = validated_data.pop('recipe_hops') malts = validated_data.pop('recipe_malts') user = validated_data.pop('user') return Recipe.objects.create_recipe(user, validated_data, malts, hops) <|end_body_0|> <|body_start_1|> instance.recipe_name = validated_data.get...
Serialization class for all your yummy recipes.
RecipeSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecipeSerializer: """Serialization class for all your yummy recipes.""" def create(self, validated_data): """Create the recipe and all related data""" <|body_0|> def update(self, instance, validated_data): """Update a recipe. This will clear all previous malts/ho...
stack_v2_sparse_classes_36k_train_021988
3,077
permissive
[ { "docstring": "Create the recipe and all related data", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "Update a recipe. This will clear all previous malts/hops and replace them with a new list", "name": "update", "signature": "def update(self, insta...
2
stack_v2_sparse_classes_30k_train_008970
Implement the Python class `RecipeSerializer` described below. Class description: Serialization class for all your yummy recipes. Method signatures and docstrings: - def create(self, validated_data): Create the recipe and all related data - def update(self, instance, validated_data): Update a recipe. This will clear ...
Implement the Python class `RecipeSerializer` described below. Class description: Serialization class for all your yummy recipes. Method signatures and docstrings: - def create(self, validated_data): Create the recipe and all related data - def update(self, instance, validated_data): Update a recipe. This will clear ...
6d0a31f021755425d420394d84aa7250f86f5ebe
<|skeleton|> class RecipeSerializer: """Serialization class for all your yummy recipes.""" def create(self, validated_data): """Create the recipe and all related data""" <|body_0|> def update(self, instance, validated_data): """Update a recipe. This will clear all previous malts/ho...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RecipeSerializer: """Serialization class for all your yummy recipes.""" def create(self, validated_data): """Create the recipe and all related data""" hops = validated_data.pop('recipe_hops') malts = validated_data.pop('recipe_malts') user = validated_data.pop('user') ...
the_stack_v2_python_sparse
brew_journal/recipies/serializers.py
moonboy13/brew-journal
train
0
e84165a17541cbf3a18d2b082add8111bfb290e9
[ "unindexed_sentences = SubtitleReader.__get_list_of_sentences(file_path)\nsegments = SubtitleReader.__get_time_stamped_segments(unindexed_sentences, sentences)\nreturn segments", "f = open(file_path)\nsentences = []\ncurrent_sentence = {}\nfor line in f:\n line.rstrip()\n if re.match('\\\\d{2}:\\\\d{2}:\\\\...
<|body_start_0|> unindexed_sentences = SubtitleReader.__get_list_of_sentences(file_path) segments = SubtitleReader.__get_time_stamped_segments(unindexed_sentences, sentences) return segments <|end_body_0|> <|body_start_1|> f = open(file_path) sentences = [] current_sente...
Class was created to aid views that need to process srt files in activities such as transcription and shadowing.
SubtitleReader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubtitleReader: """Class was created to aid views that need to process srt files in activities such as transcription and shadowing.""" def read_file(file_path, sentences=False): """Processes the file by calling helper function, return a list of timestamped words :param file_path: :pa...
stack_v2_sparse_classes_36k_train_021989
4,663
no_license
[ { "docstring": "Processes the file by calling helper function, return a list of timestamped words :param file_path: :param sentences: :return:", "name": "read_file", "signature": "def read_file(file_path, sentences=False)" }, { "docstring": "# Get a list of all the sentences from file and its ti...
4
null
Implement the Python class `SubtitleReader` described below. Class description: Class was created to aid views that need to process srt files in activities such as transcription and shadowing. Method signatures and docstrings: - def read_file(file_path, sentences=False): Processes the file by calling helper function,...
Implement the Python class `SubtitleReader` described below. Class description: Class was created to aid views that need to process srt files in activities such as transcription and shadowing. Method signatures and docstrings: - def read_file(file_path, sentences=False): Processes the file by calling helper function,...
174c8c6c9ecb2905830832419e9c332b4d8b13df
<|skeleton|> class SubtitleReader: """Class was created to aid views that need to process srt files in activities such as transcription and shadowing.""" def read_file(file_path, sentences=False): """Processes the file by calling helper function, return a list of timestamped words :param file_path: :pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubtitleReader: """Class was created to aid views that need to process srt files in activities such as transcription and shadowing.""" def read_file(file_path, sentences=False): """Processes the file by calling helper function, return a list of timestamped words :param file_path: :param sentences...
the_stack_v2_python_sparse
CreeTutorBackEnd/common_to_apps/subtitle_readers.py
EdTeKLA/Cree-Tutor
train
0
6bafca1176eb8fe22e24008acd3c17c798b4e9ad
[ "axs = subplots(len(xs), 2, imgsize=imgsize, figsize=figsize)\nfor i, (x, y) in enumerate(zip(xs, ys)):\n x.show(ax=axs[i, 0], **kwargs)\n y.show(ax=axs[i, 1], **kwargs)\nplt.tight_layout()", "title = 'Input / Prediction / Target'\naxs = subplots(len(xs), 3, imgsize=imgsize, figsize=figsize, title=title, we...
<|body_start_0|> axs = subplots(len(xs), 2, imgsize=imgsize, figsize=figsize) for i, (x, y) in enumerate(zip(xs, ys)): x.show(ax=axs[i, 0], **kwargs) y.show(ax=axs[i, 1], **kwargs) plt.tight_layout() <|end_body_0|> <|body_start_1|> title = 'Input / Prediction / T...
`ItemList` suitable for `Image` to `Image` tasks.
ImageImageList
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageImageList: """`ItemList` suitable for `Image` to `Image` tasks.""" def show_xys(self, xs, ys, imgsize: int=4, figsize: Optional[Tuple[int, int]]=None, **kwargs): """Show the `xs` (inputs) and `ys`(targets) on a figure of `figsize`.""" <|body_0|> def show_xyzs(self, ...
stack_v2_sparse_classes_36k_train_021990
23,540
permissive
[ { "docstring": "Show the `xs` (inputs) and `ys`(targets) on a figure of `figsize`.", "name": "show_xys", "signature": "def show_xys(self, xs, ys, imgsize: int=4, figsize: Optional[Tuple[int, int]]=None, **kwargs)" }, { "docstring": "Show `xs` (inputs), `ys` (targets) and `zs` (predictions) on a ...
2
stack_v2_sparse_classes_30k_train_000105
Implement the Python class `ImageImageList` described below. Class description: `ItemList` suitable for `Image` to `Image` tasks. Method signatures and docstrings: - def show_xys(self, xs, ys, imgsize: int=4, figsize: Optional[Tuple[int, int]]=None, **kwargs): Show the `xs` (inputs) and `ys`(targets) on a figure of `...
Implement the Python class `ImageImageList` described below. Class description: `ItemList` suitable for `Image` to `Image` tasks. Method signatures and docstrings: - def show_xys(self, xs, ys, imgsize: int=4, figsize: Optional[Tuple[int, int]]=None, **kwargs): Show the `xs` (inputs) and `ys`(targets) on a figure of `...
141e873e42eb5e40665d20349f4b8e9a267ba1c4
<|skeleton|> class ImageImageList: """`ItemList` suitable for `Image` to `Image` tasks.""" def show_xys(self, xs, ys, imgsize: int=4, figsize: Optional[Tuple[int, int]]=None, **kwargs): """Show the `xs` (inputs) and `ys`(targets) on a figure of `figsize`.""" <|body_0|> def show_xyzs(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageImageList: """`ItemList` suitable for `Image` to `Image` tasks.""" def show_xys(self, xs, ys, imgsize: int=4, figsize: Optional[Tuple[int, int]]=None, **kwargs): """Show the `xs` (inputs) and `ys`(targets) on a figure of `figsize`.""" axs = subplots(len(xs), 2, imgsize=imgsize, figsi...
the_stack_v2_python_sparse
fastai/vision/data.py
jantic/DeOldify
train
17,137
24de685695a38fe580ff96bbc2b7326f3a706915
[ "self.cloud_vtk_points = vtk.vtkPoints()\nself.cloud_vtk_polydata = vtk.vtkPolyData()\nself.cloud_octree = vtk.vtkOctreePointLocator()\nself.cloud_color = vtk.vtkUnsignedCharArray()\nself.cloud_actor = vtk.vtkActor()\nself.v_filter = vtk.vtkVertexGlyphFilter()\nself.mapper = vtk.vtkPolyDataMapper()", "self.np_clo...
<|body_start_0|> self.cloud_vtk_points = vtk.vtkPoints() self.cloud_vtk_polydata = vtk.vtkPolyData() self.cloud_octree = vtk.vtkOctreePointLocator() self.cloud_color = vtk.vtkUnsignedCharArray() self.cloud_actor = vtk.vtkActor() self.v_filter = vtk.vtkVertexGlyphFilter() ...
Cloud
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cloud: def __init__(self): """初始化变量""" <|body_0|> def initialize_car(self, path): """载入点云数据""" <|body_1|> def build_car(self): """汽车点云染色""" <|body_2|> def color_points(self, cloud_clipped_points): """对被切割点染色""" <|body...
stack_v2_sparse_classes_36k_train_021991
4,869
no_license
[ { "docstring": "初始化变量", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "载入点云数据", "name": "initialize_car", "signature": "def initialize_car(self, path)" }, { "docstring": "汽车点云染色", "name": "build_car", "signature": "def build_car(self)" }, { ...
4
stack_v2_sparse_classes_30k_train_020817
Implement the Python class `Cloud` described below. Class description: Implement the Cloud class. Method signatures and docstrings: - def __init__(self): 初始化变量 - def initialize_car(self, path): 载入点云数据 - def build_car(self): 汽车点云染色 - def color_points(self, cloud_clipped_points): 对被切割点染色
Implement the Python class `Cloud` described below. Class description: Implement the Cloud class. Method signatures and docstrings: - def __init__(self): 初始化变量 - def initialize_car(self, path): 载入点云数据 - def build_car(self): 汽车点云染色 - def color_points(self, cloud_clipped_points): 对被切割点染色 <|skeleton|> class Cloud: ...
2f18e869bcc2dfb118da69f02a5e231ff2602a68
<|skeleton|> class Cloud: def __init__(self): """初始化变量""" <|body_0|> def initialize_car(self, path): """载入点云数据""" <|body_1|> def build_car(self): """汽车点云染色""" <|body_2|> def color_points(self, cloud_clipped_points): """对被切割点染色""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cloud: def __init__(self): """初始化变量""" self.cloud_vtk_points = vtk.vtkPoints() self.cloud_vtk_polydata = vtk.vtkPolyData() self.cloud_octree = vtk.vtkOctreePointLocator() self.cloud_color = vtk.vtkUnsignedCharArray() self.cloud_actor = vtk.vtkActor() sel...
the_stack_v2_python_sparse
wind_planes.py
baobaotang0/new_outline
train
0
0b36f9e436908596d4923f6c3e8aa69bdf535968
[ "if has_permissions(request, self, 'delete'):\n super(OwnerModel, obj).delete(*args, **kwargs)\nelse:\n messages.warning(request, 'You do not have the Permission to delete Item #%s' % obj.pk)", "if not self.pk:\n if request:\n self.access_control_list = isinstance(self.access_control_list, dict) o...
<|body_start_0|> if has_permissions(request, self, 'delete'): super(OwnerModel, obj).delete(*args, **kwargs) else: messages.warning(request, 'You do not have the Permission to delete Item #%s' % obj.pk) <|end_body_0|> <|body_start_1|> if not self.pk: if reque...
For access control purposes, We have a base class that will be extended inorder to have site/person based filtering and data hiding.
OwnerModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OwnerModel: """For access control purposes, We have a base class that will be extended inorder to have site/person based filtering and data hiding.""" def delete(self, request=None, *args, **kwargs): """Override delete for the object, making sure that the current user has the permiss...
stack_v2_sparse_classes_36k_train_021992
5,128
no_license
[ { "docstring": "Override delete for the object, making sure that the current user has the permission to delete this object", "name": "delete", "signature": "def delete(self, request=None, *args, **kwargs)" }, { "docstring": "if is not a new object, lets go through the drill: check if user is sup...
2
null
Implement the Python class `OwnerModel` described below. Class description: For access control purposes, We have a base class that will be extended inorder to have site/person based filtering and data hiding. Method signatures and docstrings: - def delete(self, request=None, *args, **kwargs): Override delete for the ...
Implement the Python class `OwnerModel` described below. Class description: For access control purposes, We have a base class that will be extended inorder to have site/person based filtering and data hiding. Method signatures and docstrings: - def delete(self, request=None, *args, **kwargs): Override delete for the ...
c2a55848c1dee14bd3eec75ac93810fe5e4f049b
<|skeleton|> class OwnerModel: """For access control purposes, We have a base class that will be extended inorder to have site/person based filtering and data hiding.""" def delete(self, request=None, *args, **kwargs): """Override delete for the object, making sure that the current user has the permiss...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OwnerModel: """For access control purposes, We have a base class that will be extended inorder to have site/person based filtering and data hiding.""" def delete(self, request=None, *args, **kwargs): """Override delete for the object, making sure that the current user has the permission to delete...
the_stack_v2_python_sparse
uhai/core/models.py
Jaramba/Wellness
train
0
e7d766f34572154b7a0fec27fef9cf801aa40c0f
[ "super(BiSeNetHead, self).__init__()\nif is_aux:\n self.conv_3x3 = ConvBnRelu(in_planes, 256, 3, 1, 1, norm_layer=norm_layer, Conv2d=Conv2d)\nelse:\n self.conv_3x3 = ConvBnRelu(in_planes, 64, 3, 1, 1, norm_layer=norm_layer, Conv2d=Conv2d)\nif is_aux:\n self.conv_1x1 = nn.Conv2d(256, out_planes, kernel_size...
<|body_start_0|> super(BiSeNetHead, self).__init__() if is_aux: self.conv_3x3 = ConvBnRelu(in_planes, 256, 3, 1, 1, norm_layer=norm_layer, Conv2d=Conv2d) else: self.conv_3x3 = ConvBnRelu(in_planes, 64, 3, 1, 1, norm_layer=norm_layer, Conv2d=Conv2d) if is_aux: ...
BiSeNetHead module.
BiSeNetHead
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BiSeNetHead: """BiSeNetHead module.""" def __init__(self, in_planes, out_planes, scale, is_aux=False, norm_layer='BN', Conv2d=nn.Conv2d): """Create BiSeNetHead. :param in_planes: input channels :param out_planes: output channels :param scale: scale factor. :param is_aux: whether use ...
stack_v2_sparse_classes_36k_train_021993
9,350
permissive
[ { "docstring": "Create BiSeNetHead. :param in_planes: input channels :param out_planes: output channels :param scale: scale factor. :param is_aux: whether use aux weight. :param norm_layer: type of norm layer. :param Conv2d: type of conv layer.", "name": "__init__", "signature": "def __init__(self, in_p...
2
stack_v2_sparse_classes_30k_train_013410
Implement the Python class `BiSeNetHead` described below. Class description: BiSeNetHead module. Method signatures and docstrings: - def __init__(self, in_planes, out_planes, scale, is_aux=False, norm_layer='BN', Conv2d=nn.Conv2d): Create BiSeNetHead. :param in_planes: input channels :param out_planes: output channel...
Implement the Python class `BiSeNetHead` described below. Class description: BiSeNetHead module. Method signatures and docstrings: - def __init__(self, in_planes, out_planes, scale, is_aux=False, norm_layer='BN', Conv2d=nn.Conv2d): Create BiSeNetHead. :param in_planes: input channels :param out_planes: output channel...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class BiSeNetHead: """BiSeNetHead module.""" def __init__(self, in_planes, out_planes, scale, is_aux=False, norm_layer='BN', Conv2d=nn.Conv2d): """Create BiSeNetHead. :param in_planes: input channels :param out_planes: output channels :param scale: scale factor. :param is_aux: whether use ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BiSeNetHead: """BiSeNetHead module.""" def __init__(self, in_planes, out_planes, scale, is_aux=False, norm_layer='BN', Conv2d=nn.Conv2d): """Create BiSeNetHead. :param in_planes: input channels :param out_planes: output channels :param scale: scale factor. :param is_aux: whether use aux weight. :...
the_stack_v2_python_sparse
zeus/networks/pytorch/customs/bisenet.py
huawei-noah/xingtian
train
308
c971cb1e0e7b9b07e6904e3d57f5607543dad4bc
[ "d = inspector.DefaultFields(a=5)\nself.assertEqual(('{foo}', '.*'), d['foo'])\nself.assertEqual(5, d['a'])\nself.assertTrue('nothing' in d)", "f = inspector.DefaultFormatter()\nself.assertEqual(('{nothing}', '.*'), f.SPECIAL_FIELDS['nothing'])\nself.assertEqual('foo_{bar}_{Y:04d}_{nothing}', f.expand_format('foo...
<|body_start_0|> d = inspector.DefaultFields(a=5) self.assertEqual(('{foo}', '.*'), d['foo']) self.assertEqual(5, d['a']) self.assertTrue('nothing' in d) <|end_body_0|> <|body_start_1|> f = inspector.DefaultFormatter() self.assertEqual(('{nothing}', '.*'), f.SPECIAL_FIEL...
Test inspector support classes
InspectorSupportClass
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InspectorSupportClass: """Test inspector support classes""" def testDefaultFields(self): """default dict that returns generic match""" <|body_0|> def testDefaultFormatter(self): """formatter that returns generics""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_021994
7,654
no_license
[ { "docstring": "default dict that returns generic match", "name": "testDefaultFields", "signature": "def testDefaultFields(self)" }, { "docstring": "formatter that returns generics", "name": "testDefaultFormatter", "signature": "def testDefaultFormatter(self)" } ]
2
null
Implement the Python class `InspectorSupportClass` described below. Class description: Test inspector support classes Method signatures and docstrings: - def testDefaultFields(self): default dict that returns generic match - def testDefaultFormatter(self): formatter that returns generics
Implement the Python class `InspectorSupportClass` described below. Class description: Test inspector support classes Method signatures and docstrings: - def testDefaultFields(self): default dict that returns generic match - def testDefaultFormatter(self): formatter that returns generics <|skeleton|> class Inspector...
a0bf5e682fb917bb707b4f66787b0ecb860efce1
<|skeleton|> class InspectorSupportClass: """Test inspector support classes""" def testDefaultFields(self): """default dict that returns generic match""" <|body_0|> def testDefaultFormatter(self): """formatter that returns generics""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InspectorSupportClass: """Test inspector support classes""" def testDefaultFields(self): """default dict that returns generic match""" d = inspector.DefaultFields(a=5) self.assertEqual(('{foo}', '.*'), d['foo']) self.assertEqual(5, d['a']) self.assertTrue('nothing'...
the_stack_v2_python_sparse
unit_tests/test_Inspector.py
spacepy/dbprocessing
train
4
47bf3fdd9d8cafef8d71a5ae66f1061ae59e707a
[ "super().__init__(**attrs)\nself.value = value\nself.padding = padding\nself.width = real_length(value) + self.padding", "value_style = self.get_style('value')\nlines = break_line(value_style(self.padding * ' ' + self.value), self.width)\nreturn list(lines) or ['']" ]
<|body_start_0|> super().__init__(**attrs) self.value = value self.padding = padding self.width = real_length(value) + self.padding <|end_body_0|> <|body_start_1|> value_style = self.get_style('value') lines = break_line(value_style(self.padding * ' ' + self.value), self...
Unselectable text object
Label
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Label: """Unselectable text object""" def __init__(self, value: str='', padding: int=0, **attrs: Any) -> None: """Set up object""" <|body_0|> def get_lines(self) -> list[str]: """Get lines of object""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_021995
29,898
no_license
[ { "docstring": "Set up object", "name": "__init__", "signature": "def __init__(self, value: str='', padding: int=0, **attrs: Any) -> None" }, { "docstring": "Get lines of object", "name": "get_lines", "signature": "def get_lines(self) -> list[str]" } ]
2
stack_v2_sparse_classes_30k_train_006510
Implement the Python class `Label` described below. Class description: Unselectable text object Method signatures and docstrings: - def __init__(self, value: str='', padding: int=0, **attrs: Any) -> None: Set up object - def get_lines(self) -> list[str]: Get lines of object
Implement the Python class `Label` described below. Class description: Unselectable text object Method signatures and docstrings: - def __init__(self, value: str='', padding: int=0, **attrs: Any) -> None: Set up object - def get_lines(self) -> list[str]: Get lines of object <|skeleton|> class Label: """Unselecta...
05ddaf41fd8de11c7300a8ba125eddf9e1ee1131
<|skeleton|> class Label: """Unselectable text object""" def __init__(self, value: str='', padding: int=0, **attrs: Any) -> None: """Set up object""" <|body_0|> def get_lines(self) -> list[str]: """Get lines of object""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Label: """Unselectable text object""" def __init__(self, value: str='', padding: int=0, **attrs: Any) -> None: """Set up object""" super().__init__(**attrs) self.value = value self.padding = padding self.width = real_length(value) + self.padding def get_lines(...
the_stack_v2_python_sparse
pytermgui/widgets/base.py
ekapujiw2002/pytermgui
train
0
94736cac4d6c768c63c9559b9aa8c9750fc4b0a6
[ "this_verbose_string, this_abbrev_string = model_interpretation.model_component_to_string(component_type_string=model_interpretation.CLASS_COMPONENT_TYPE_STRING, target_class=TARGET_CLASS, layer_name=LAYER_NAME, neuron_indices=NEURON_INDICES, channel_index=CHANNEL_INDEX)\nself.assertTrue(this_verbose_string == CLAS...
<|body_start_0|> this_verbose_string, this_abbrev_string = model_interpretation.model_component_to_string(component_type_string=model_interpretation.CLASS_COMPONENT_TYPE_STRING, target_class=TARGET_CLASS, layer_name=LAYER_NAME, neuron_indices=NEURON_INDICES, channel_index=CHANNEL_INDEX) self.assertTrue(...
Each method is a unit test for model_interpretation.py.
ModelInterpretationTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelInterpretationTests: """Each method is a unit test for model_interpretation.py.""" def test_model_component_to_string_class(self): """Ensures correct output from model_component_to_string. In this case, the component is an output class.""" <|body_0|> def test_model_...
stack_v2_sparse_classes_36k_train_021996
2,860
permissive
[ { "docstring": "Ensures correct output from model_component_to_string. In this case, the component is an output class.", "name": "test_model_component_to_string_class", "signature": "def test_model_component_to_string_class(self)" }, { "docstring": "Ensures correct output from model_component_to...
3
null
Implement the Python class `ModelInterpretationTests` described below. Class description: Each method is a unit test for model_interpretation.py. Method signatures and docstrings: - def test_model_component_to_string_class(self): Ensures correct output from model_component_to_string. In this case, the component is an...
Implement the Python class `ModelInterpretationTests` described below. Class description: Each method is a unit test for model_interpretation.py. Method signatures and docstrings: - def test_model_component_to_string_class(self): Ensures correct output from model_component_to_string. In this case, the component is an...
1835a71ababb7ad7e47bfa19e62948d466559d56
<|skeleton|> class ModelInterpretationTests: """Each method is a unit test for model_interpretation.py.""" def test_model_component_to_string_class(self): """Ensures correct output from model_component_to_string. In this case, the component is an output class.""" <|body_0|> def test_model_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelInterpretationTests: """Each method is a unit test for model_interpretation.py.""" def test_model_component_to_string_class(self): """Ensures correct output from model_component_to_string. In this case, the component is an output class.""" this_verbose_string, this_abbrev_string = mo...
the_stack_v2_python_sparse
gewittergefahr/deep_learning/model_interpretation_test.py
thunderhoser/GewitterGefahr
train
29
e6c83c663fafdfaa0c3d8f3cb43f84f4ae1e97f3
[ "terms = self.flatten()\nif len(terms) == 1:\n return simplify_if_possible(terms[0])\nelse:\n return Sum([simplify_if_possible(term) for term in terms]).flatten()", "terms = []\nfor term in self:\n if isinstance(term, Sum):\n terms += list(term)\n elif isinstance(term, Expression) and len(term)...
<|body_start_0|> terms = self.flatten() if len(terms) == 1: return simplify_if_possible(terms[0]) else: return Sum([simplify_if_possible(term) for term in terms]).flatten() <|end_body_0|> <|body_start_1|> terms = [] for term in self: if isinst...
A Sum acts just like a list in almost all regards, except that this code can tell it is a Sum using isinstance(), and we add useful methods such as simplify(). Because of this: * You can index into a sum like a list, as in term = sum[0]. * You can iterate over a sum with "for term in sum:". * You can convert a sum to a...
Sum
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sum: """A Sum acts just like a list in almost all regards, except that this code can tell it is a Sum using isinstance(), and we add useful methods such as simplify(). Because of this: * You can index into a sum like a list, as in term = sum[0]. * You can iterate over a sum with "for term in sum:...
stack_v2_sparse_classes_36k_train_021997
9,240
permissive
[ { "docstring": "This is the starting point for the task you need to perform. It removes unnecessary nesting and applies the associative law.", "name": "simplify", "signature": "def simplify(self)" }, { "docstring": "Simplifies nested sums.", "name": "flatten", "signature": "def flatten(s...
2
stack_v2_sparse_classes_30k_train_009028
Implement the Python class `Sum` described below. Class description: A Sum acts just like a list in almost all regards, except that this code can tell it is a Sum using isinstance(), and we add useful methods such as simplify(). Because of this: * You can index into a sum like a list, as in term = sum[0]. * You can it...
Implement the Python class `Sum` described below. Class description: A Sum acts just like a list in almost all regards, except that this code can tell it is a Sum using isinstance(), and we add useful methods such as simplify(). Because of this: * You can index into a sum like a list, as in term = sum[0]. * You can it...
4fbac9f751a990b567c5ceb67384440ee528dbd0
<|skeleton|> class Sum: """A Sum acts just like a list in almost all regards, except that this code can tell it is a Sum using isinstance(), and we add useful methods such as simplify(). Because of this: * You can index into a sum like a list, as in term = sum[0]. * You can iterate over a sum with "for term in sum:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sum: """A Sum acts just like a list in almost all regards, except that this code can tell it is a Sum using isinstance(), and we add useful methods such as simplify(). Because of this: * You can index into a sum like a list, as in term = sum[0]. * You can iterate over a sum with "for term in sum:". * You can ...
the_stack_v2_python_sparse
labs/lab0/algebra.py
AdamSpannbauer/mit6034
train
1
41930511464d501e34aef5e0ab72a94c4f786d2e
[ "for k in filter_munge:\n if k in params and params[k] in ['true', '1']:\n params[k] = 'True'\n if k in params and params[k] in ['false', '0']:\n params[k] = 'False'\nreturn params", "filter_class = self.get_filter_class(view, queryset)\nfilter_munge = getattr(view, 'filter_munge', ())\nparams...
<|body_start_0|> for k in filter_munge: if k in params and params[k] in ['true', '1']: params[k] = 'True' if k in params and params[k] in ['false', '0']: params[k] = 'False' return params <|end_body_0|> <|body_start_1|> filter_class = self...
MktFilterBackend
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MktFilterBackend: def munge_params(self, filter_munge, params): """Cast some more things as truthful.""" <|body_0|> def filter_queryset(self, request, queryset, view): """Overriding DRF in order to munging the incoming params. It will only munge fields that are in th...
stack_v2_sparse_classes_36k_train_021998
1,040
permissive
[ { "docstring": "Cast some more things as truthful.", "name": "munge_params", "signature": "def munge_params(self, filter_munge, params)" }, { "docstring": "Overriding DRF in order to munging the incoming params. It will only munge fields that are in the filter_munge tuple on the view, other fiel...
2
stack_v2_sparse_classes_30k_train_001458
Implement the Python class `MktFilterBackend` described below. Class description: Implement the MktFilterBackend class. Method signatures and docstrings: - def munge_params(self, filter_munge, params): Cast some more things as truthful. - def filter_queryset(self, request, queryset, view): Overriding DRF in order to ...
Implement the Python class `MktFilterBackend` described below. Class description: Implement the MktFilterBackend class. Method signatures and docstrings: - def munge_params(self, filter_munge, params): Cast some more things as truthful. - def filter_queryset(self, request, queryset, view): Overriding DRF in order to ...
5fa5400a447f2e905372d4c8eba6d959d22d4f3e
<|skeleton|> class MktFilterBackend: def munge_params(self, filter_munge, params): """Cast some more things as truthful.""" <|body_0|> def filter_queryset(self, request, queryset, view): """Overriding DRF in order to munging the incoming params. It will only munge fields that are in th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MktFilterBackend: def munge_params(self, filter_munge, params): """Cast some more things as truthful.""" for k in filter_munge: if k in params and params[k] in ['true', '1']: params[k] = 'True' if k in params and params[k] in ['false', '0']: ...
the_stack_v2_python_sparse
mkt/api/filters.py
sarvex/zamboni
train
0
885dedc6f6d6c765ac8a5d36eaf0d8adf4612b4d
[ "rev, cur = (None, head)\nwhile cur:\n rev, rev.next, cur = (cur, rev, cur.next)\nreturn rev", "if not head or not head.next:\n return head\nrev = self.reverseListRecursive(head.next)\nhead.next.next = head\nhead.next = None\nreturn rev" ]
<|body_start_0|> rev, cur = (None, head) while cur: rev, rev.next, cur = (cur, rev, cur.next) return rev <|end_body_0|> <|body_start_1|> if not head or not head.next: return head rev = self.reverseListRecursive(head.next) head.next.next = head ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head): """offical solution: https://leetcode.com/problems/reverse-linked-list/solution/ :type head: ListNode :rtype: ListNode""" <|body_0|> def reverseListRecursive(self, head): """offical solution: https://leetcode.com/problems/revers...
stack_v2_sparse_classes_36k_train_021999
1,219
no_license
[ { "docstring": "offical solution: https://leetcode.com/problems/reverse-linked-list/solution/ :type head: ListNode :rtype: ListNode", "name": "reverseList", "signature": "def reverseList(self, head)" }, { "docstring": "offical solution: https://leetcode.com/problems/reverse-linked-list/solution/...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): offical solution: https://leetcode.com/problems/reverse-linked-list/solution/ :type head: ListNode :rtype: ListNode - def reverseListRecursive(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): offical solution: https://leetcode.com/problems/reverse-linked-list/solution/ :type head: ListNode :rtype: ListNode - def reverseListRecursive(self, ...
2526f8c0dec7101123123740e146ee4081e979ee
<|skeleton|> class Solution: def reverseList(self, head): """offical solution: https://leetcode.com/problems/reverse-linked-list/solution/ :type head: ListNode :rtype: ListNode""" <|body_0|> def reverseListRecursive(self, head): """offical solution: https://leetcode.com/problems/revers...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(self, head): """offical solution: https://leetcode.com/problems/reverse-linked-list/solution/ :type head: ListNode :rtype: ListNode""" rev, cur = (None, head) while cur: rev, rev.next, cur = (cur, rev, cur.next) return rev def reverseL...
the_stack_v2_python_sparse
242. Reverse Linked List.py
zhangpengGenedock/leetcode_python
train
1