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
e20cc79a39f64264daf119aa31d195a2aa7528df
[ "self.minheap = []\nself.size = k\nfor i in nums:\n self.add(i)", "if len(self.minheap) < self.size:\n heapq.heappush(self.minheap, val)\nelif self.minheap[0] < val:\n heapq.heappop(self.minheap)\n heapq.heappush(self.minheap, val)\nreturn self.minheap[0]" ]
<|body_start_0|> self.minheap = [] self.size = k for i in nums: self.add(i) <|end_body_0|> <|body_start_1|> if len(self.minheap) < self.size: heapq.heappush(self.minheap, val) elif self.minheap[0] < val: heapq.heappop(self.minheap) ...
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.minheap = [] self.size = k for i in n...
stack_v2_sparse_classes_36k_train_032700
722
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_015374
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
89316f5260996d4cacba0d42182026387add1ef9
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.minheap = [] self.size = k for i in nums: self.add(i) def add(self, val): """:type val: int :rtype: int""" if len(self.minheap) < self.size: heapq...
the_stack_v2_python_sparse
leetcode/KthlargestwithMinHeap.py
changlongG/Algorithms
train
0
670668abdddc2dd770e06293ba3a94900b38cf06
[ "nd_names = states_df.columns\nord_nodes = [BayesNode(k, nd_names[k]) for k in range(len(nd_names))]\nbnet = BayesNet(set(ord_nodes))\nself.is_quantum = is_quantum\nself.bnet = bnet\nself.states_df = states_df\nself.ord_nodes = ord_nodes\nif not vtx_to_states:\n bnet.learn_nd_state_names(states_df)\nelse:\n b...
<|body_start_0|> nd_names = states_df.columns ord_nodes = [BayesNode(k, nd_names[k]) for k in range(len(nd_names))] bnet = BayesNet(set(ord_nodes)) self.is_quantum = is_quantum self.bnet = bnet self.states_df = states_df self.ord_nodes = ord_nodes if not v...
Learning a Bayesian Network is usually done in two steps (1) learning the structure (i.e. the graph or skeleton) (2) learning the parameters ( i.e., the pots). NetStrucLner (Net Structure Learner) is a super class for all classes that learn the structure of a net based on empirical data about states given in a pandas d...
NetStrucLner
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetStrucLner: """Learning a Bayesian Network is usually done in two steps (1) learning the structure (i.e. the graph or skeleton) (2) learning the parameters ( i.e., the pots). NetStrucLner (Net Structure Learner) is a super class for all classes that learn the structure of a net based on empiric...
stack_v2_sparse_classes_36k_train_032701
3,273
permissive
[ { "docstring": "Constructor Parameters ---------- is_quantum : bool states_df : pandas.DataFrame vtx_to_states : dict[str, list[str]] A dictionary mapping each node name to a list of its state names. This information will be stored in self.bnet. If vtx_to_states=None, constructor will learn vtx_to_states from s...
2
stack_v2_sparse_classes_30k_train_009396
Implement the Python class `NetStrucLner` described below. Class description: Learning a Bayesian Network is usually done in two steps (1) learning the structure (i.e. the graph or skeleton) (2) learning the parameters ( i.e., the pots). NetStrucLner (Net Structure Learner) is a super class for all classes that learn ...
Implement the Python class `NetStrucLner` described below. Class description: Learning a Bayesian Network is usually done in two steps (1) learning the structure (i.e. the graph or skeleton) (2) learning the parameters ( i.e., the pots). NetStrucLner (Net Structure Learner) is a super class for all classes that learn ...
5b4a3055ea14c2ee9c80c339f759fe2b9c8c51e2
<|skeleton|> class NetStrucLner: """Learning a Bayesian Network is usually done in two steps (1) learning the structure (i.e. the graph or skeleton) (2) learning the parameters ( i.e., the pots). NetStrucLner (Net Structure Learner) is a super class for all classes that learn the structure of a net based on empiric...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NetStrucLner: """Learning a Bayesian Network is usually done in two steps (1) learning the structure (i.e. the graph or skeleton) (2) learning the parameters ( i.e., the pots). NetStrucLner (Net Structure Learner) is a super class for all classes that learn the structure of a net based on empirical data about...
the_stack_v2_python_sparse
learning/NetStrucLner.py
artiste-qb-net/quantum-fog
train
95
27f5f1f1b7a38544d0a826d763b46b74f1f9330b
[ "if row is None:\n results = self._calculate_row(feature_resource)\n try:\n results = zip(*results)\n except TypeError:\n results = [tuple([results])]\n rows = []\n status = []\n for j in results:\n row = tuple(feature_resource)\n if isinstance(j, list) is True:\n ...
<|body_start_0|> if row is None: results = self._calculate_row(feature_resource) try: results = zip(*results) except TypeError: results = [tuple([results])] rows = [] status = [] for j in results: ...
Generates rows to be placed into the uncached tables
WorkDirRows
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkDirRows: """Generates rows to be placed into the uncached tables""" def construct_row(self, feature, feature_resource, row=None): """If row is nothing a feature is calculated otherwise the row is formated in the workdir table format @param: feature - @param: feature_resource - @p...
stack_v2_sparse_classes_36k_train_032702
22,952
permissive
[ { "docstring": "If row is nothing a feature is calculated otherwise the row is formated in the workdir table format @param: feature - @param: feature_resource - @param: row - row for a workdir table (default: None) @return: rows", "name": "construct_row", "signature": "def construct_row(self, feature, f...
3
stack_v2_sparse_classes_30k_train_011268
Implement the Python class `WorkDirRows` described below. Class description: Generates rows to be placed into the uncached tables Method signatures and docstrings: - def construct_row(self, feature, feature_resource, row=None): If row is nothing a feature is calculated otherwise the row is formated in the workdir tab...
Implement the Python class `WorkDirRows` described below. Class description: Generates rows to be placed into the uncached tables Method signatures and docstrings: - def construct_row(self, feature, feature_resource, row=None): If row is nothing a feature is calculated otherwise the row is formated in the workdir tab...
be337668b090de83a5b539b0e89b0ea8292166da
<|skeleton|> class WorkDirRows: """Generates rows to be placed into the uncached tables""" def construct_row(self, feature, feature_resource, row=None): """If row is nothing a feature is calculated otherwise the row is formated in the workdir table format @param: feature - @param: feature_resource - @p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkDirRows: """Generates rows to be placed into the uncached tables""" def construct_row(self, feature, feature_resource, row=None): """If row is nothing a feature is calculated otherwise the row is formated in the workdir table format @param: feature - @param: feature_resource - @param: row - r...
the_stack_v2_python_sparse
source/bqfeature/bq/features/controllers/TablesInterface.py
UCSB-VRL/bisqueUCSB
train
40
a649a01280390c08cca32d35e574d5a16db8f9d5
[ "try:\n keywords = request.GET.get('keywords', None)\n if keywords is not None:\n keywords = keywords.strip()\n query_project = Project.objects.filter(title__icontains=keywords).order_by('id')\n paginator = StandardResultsSetPagination()\n project_list = paginator.paginate_queryset...
<|body_start_0|> try: keywords = request.GET.get('keywords', None) if keywords is not None: keywords = keywords.strip() query_project = Project.objects.filter(title__icontains=keywords).order_by('id') paginator = StandardResultsSetPaginatio...
QueryProjectView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueryProjectView: def get(self, request, *args, **kwargs): """/api/v1/project/query :param request: :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, *args, **kwargs): """根据项目名称查询 :param request: :param args: :param kwargs: :return:""" ...
stack_v2_sparse_classes_36k_train_032703
3,643
no_license
[ { "docstring": "/api/v1/project/query :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": "post", "signature": "def post(sel...
2
stack_v2_sparse_classes_30k_train_004466
Implement the Python class `QueryProjectView` described below. Class description: Implement the QueryProjectView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): /api/v1/project/query :param request: :param args: :param kwargs: :return: - def post(self, request, *args, **kwargs): 根据...
Implement the Python class `QueryProjectView` described below. Class description: Implement the QueryProjectView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): /api/v1/project/query :param request: :param args: :param kwargs: :return: - def post(self, request, *args, **kwargs): 根据...
6b9b809c4a3d12dac0fe188d52ce351147c27857
<|skeleton|> class QueryProjectView: def get(self, request, *args, **kwargs): """/api/v1/project/query :param request: :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, *args, **kwargs): """根据项目名称查询 :param request: :param args: :param kwargs: :return:""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QueryProjectView: def get(self, request, *args, **kwargs): """/api/v1/project/query :param request: :param args: :param kwargs: :return:""" try: keywords = request.GET.get('keywords', None) if keywords is not None: keywords = keywords.strip() ...
the_stack_v2_python_sparse
api/views/project.py
loveqx/devops-api
train
0
eba94bc2d5c5c8474948afec4ef725809f540735
[ "self.row = 0\nself.col = -1\nself.matrix = vec2d", "if self.hasNext():\n self.col += 1\n return self.matrix[self.row][self.col]\nelse:\n return None", "if self.row >= len(self.matrix):\n return False\nif self.col >= len(self.matrix[self.row]) - 1:\n self.row += 1\n while self.row < len(self.m...
<|body_start_0|> self.row = 0 self.col = -1 self.matrix = vec2d <|end_body_0|> <|body_start_1|> if self.hasNext(): self.col += 1 return self.matrix[self.row][self.col] else: return None <|end_body_1|> <|body_start_2|> if self.row >= l...
Vector2D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_032704
795
no_license
[ { "docstring": "Initialize your data structure here. :type vec2d: List[List[int]]", "name": "__init__", "signature": "def __init__(self, vec2d)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext",...
3
null
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool <|skeleton|> class V...
15f012927dc34b5d751af6633caa5e8882d26ff7
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" self.row = 0 self.col = -1 self.matrix = vec2d def next(self): """:rtype: int""" if self.hasNext(): self.col += 1 return sel...
the_stack_v2_python_sparse
python/251.Flatten2DVector.py
MaxPoon/Leetcode
train
15
c31bf061e8642b93daaa97ddbba78fc092ae8cbc
[ "self.__frameData = []\n_cfg = ConfigData.ConfigData()\n_path = _cfg.GetYVectorFilePath() + filename + '/' + str(frame) + '.yvector'\nwith open(_path) as f:\n for line in f.xreadlines():\n self.__frameData.append(line[:-1].split(','))\n_len = len(self.__frameData)\ndel self.__frameData[_len - 1]\ndel self...
<|body_start_0|> self.__frameData = [] _cfg = ConfigData.ConfigData() _path = _cfg.GetYVectorFilePath() + filename + '/' + str(frame) + '.yvector' with open(_path) as f: for line in f.xreadlines(): self.__frameData.append(line[:-1].split(',')) _len = l...
获取每帧的特征提取
GetSingleFrameSampling
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetSingleFrameSampling: """获取每帧的特征提取""" def getFrameFileData(self, frame, filename): """获取文件数据""" <|body_0|> def GetSingleSampling(self, frame, filename, region, unit): """获取一个帧的特征提取,以字符串形式输出""" <|body_1|> <|end_skeleton|> <|body_start_0|> self....
stack_v2_sparse_classes_36k_train_032705
1,491
no_license
[ { "docstring": "获取文件数据", "name": "getFrameFileData", "signature": "def getFrameFileData(self, frame, filename)" }, { "docstring": "获取一个帧的特征提取,以字符串形式输出", "name": "GetSingleSampling", "signature": "def GetSingleSampling(self, frame, filename, region, unit)" } ]
2
null
Implement the Python class `GetSingleFrameSampling` described below. Class description: 获取每帧的特征提取 Method signatures and docstrings: - def getFrameFileData(self, frame, filename): 获取文件数据 - def GetSingleSampling(self, frame, filename, region, unit): 获取一个帧的特征提取,以字符串形式输出
Implement the Python class `GetSingleFrameSampling` described below. Class description: 获取每帧的特征提取 Method signatures and docstrings: - def getFrameFileData(self, frame, filename): 获取文件数据 - def GetSingleSampling(self, frame, filename, region, unit): 获取一个帧的特征提取,以字符串形式输出 <|skeleton|> class GetSingleFrameSampling: ""...
42ba71e5c134295c54d22cda73dd03af3af739e4
<|skeleton|> class GetSingleFrameSampling: """获取每帧的特征提取""" def getFrameFileData(self, frame, filename): """获取文件数据""" <|body_0|> def GetSingleSampling(self, frame, filename, region, unit): """获取一个帧的特征提取,以字符串形式输出""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetSingleFrameSampling: """获取每帧的特征提取""" def getFrameFileData(self, frame, filename): """获取文件数据""" self.__frameData = [] _cfg = ConfigData.ConfigData() _path = _cfg.GetYVectorFilePath() + filename + '/' + str(frame) + '.yvector' with open(_path) as f: fo...
the_stack_v2_python_sparse
VideoSampling/GetSingleFrameSampling.py
oneApple/NewNetWorkDepartMent
train
1
4a566a17a251ee6f7b954408180f6f00046edef1
[ "try:\n member = await get_data_from_req(self.request).spaces.update_member(space_id, member_id, data)\nexcept ResourceNotFoundError:\n raise NotFound\nreturn json_response(member)", "try:\n await get_data_from_req(self.request).spaces.remove_member(space_id, member_id)\nexcept ResourceNotFoundError:\n ...
<|body_start_0|> try: member = await get_data_from_req(self.request).spaces.update_member(space_id, member_id, data) except ResourceNotFoundError: raise NotFound return json_response(member) <|end_body_0|> <|body_start_1|> try: await get_data_from_req...
SpaceMemberView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpaceMemberView: async def patch(self, space_id: int, member_id: Union[int, str], /, data: UpdateMemberRequest) -> Union[r200[UpdateMemberResponse], r404]: """Update a member. Changes the roles of the space member. Status Codes: 200: Successful operation 404: User not found""" <|...
stack_v2_sparse_classes_36k_train_032706
4,595
permissive
[ { "docstring": "Update a member. Changes the roles of the space member. Status Codes: 200: Successful operation 404: User not found", "name": "patch", "signature": "async def patch(self, space_id: int, member_id: Union[int, str], /, data: UpdateMemberRequest) -> Union[r200[UpdateMemberResponse], r404]" ...
2
null
Implement the Python class `SpaceMemberView` described below. Class description: Implement the SpaceMemberView class. Method signatures and docstrings: - async def patch(self, space_id: int, member_id: Union[int, str], /, data: UpdateMemberRequest) -> Union[r200[UpdateMemberResponse], r404]: Update a member. Changes ...
Implement the Python class `SpaceMemberView` described below. Class description: Implement the SpaceMemberView class. Method signatures and docstrings: - async def patch(self, space_id: int, member_id: Union[int, str], /, data: UpdateMemberRequest) -> Union[r200[UpdateMemberResponse], r404]: Update a member. Changes ...
1d17d2ba570cf5487e7514bec29250a5b368bb0a
<|skeleton|> class SpaceMemberView: async def patch(self, space_id: int, member_id: Union[int, str], /, data: UpdateMemberRequest) -> Union[r200[UpdateMemberResponse], r404]: """Update a member. Changes the roles of the space member. Status Codes: 200: Successful operation 404: User not found""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpaceMemberView: async def patch(self, space_id: int, member_id: Union[int, str], /, data: UpdateMemberRequest) -> Union[r200[UpdateMemberResponse], r404]: """Update a member. Changes the roles of the space member. Status Codes: 200: Successful operation 404: User not found""" try: ...
the_stack_v2_python_sparse
virtool/spaces/api.py
virtool/virtool
train
45
c3d62925118f0efa5ad6e18c967e9e15892c5fdc
[ "data = request.GET.get('search_data')\nlogger.info('系统参数配置列表,搜索数据:{}'.format(data))\ntry:\n if data:\n search_data = {}\n data = eval(data)\n for key, value in data.items():\n if bool(key) and bool(value):\n search_data[key] = data[key]\n roles = VersionForP...
<|body_start_0|> data = request.GET.get('search_data') logger.info('系统参数配置列表,搜索数据:{}'.format(data)) try: if data: search_data = {} data = eval(data) for key, value in data.items(): if bool(key) and bool(value): ...
@Author: 朱孟彤 @desc: 版本号相关接口
VersionApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VersionApi: """@Author: 朱孟彤 @desc: 版本号相关接口""" def get(self, request): """项目的版本号配置,列表和搜索 :param request: :return:""" <|body_0|> def post(self, request): """新增项目的版本号配置 :param request: :return:""" <|body_1|> def put(self, request): """更改项目的版本号配置...
stack_v2_sparse_classes_36k_train_032707
18,561
no_license
[ { "docstring": "项目的版本号配置,列表和搜索 :param request: :return:", "name": "get", "signature": "def get(self, request)" }, { "docstring": "新增项目的版本号配置 :param request: :return:", "name": "post", "signature": "def post(self, request)" }, { "docstring": "更改项目的版本号配置 :param request: :return:", ...
3
stack_v2_sparse_classes_30k_train_017148
Implement the Python class `VersionApi` described below. Class description: @Author: 朱孟彤 @desc: 版本号相关接口 Method signatures and docstrings: - def get(self, request): 项目的版本号配置,列表和搜索 :param request: :return: - def post(self, request): 新增项目的版本号配置 :param request: :return: - def put(self, request): 更改项目的版本号配置 :param request...
Implement the Python class `VersionApi` described below. Class description: @Author: 朱孟彤 @desc: 版本号相关接口 Method signatures and docstrings: - def get(self, request): 项目的版本号配置,列表和搜索 :param request: :return: - def post(self, request): 新增项目的版本号配置 :param request: :return: - def put(self, request): 更改项目的版本号配置 :param request...
c6e9c2f5aa0c9c42e023050f30176007214431ed
<|skeleton|> class VersionApi: """@Author: 朱孟彤 @desc: 版本号相关接口""" def get(self, request): """项目的版本号配置,列表和搜索 :param request: :return:""" <|body_0|> def post(self, request): """新增项目的版本号配置 :param request: :return:""" <|body_1|> def put(self, request): """更改项目的版本号配置...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VersionApi: """@Author: 朱孟彤 @desc: 版本号相关接口""" def get(self, request): """项目的版本号配置,列表和搜索 :param request: :return:""" data = request.GET.get('search_data') logger.info('系统参数配置列表,搜索数据:{}'.format(data)) try: if data: search_data = {} ...
the_stack_v2_python_sparse
PlatApp/RestFulForApp/BaseRestFul.py
QGuten/First_Try
train
0
cc0b36428e21a392ba04c6f31e97140d306df458
[ "self.IO = IO\nself.GR = GR\nself.PF_MLI = PF_MLI\nself.CF_MLI = CF_MLI\nself.ltp_inc = ltp_inc\nself.max_weight = max_weight\nself.ltp_bins = int(window / defaultclock.dt)\nSpikeMonitor.__init__(self, IO)", "if len(spikes):\n mli_inds = PF_MLI_LTP.postsynaptic_indexes(spikes, self.CF_MLI)\n gr_inds = PF_ML...
<|body_start_0|> self.IO = IO self.GR = GR self.PF_MLI = PF_MLI self.CF_MLI = CF_MLI self.ltp_inc = ltp_inc self.max_weight = max_weight self.ltp_bins = int(window / defaultclock.dt) SpikeMonitor.__init__(self, IO) <|end_body_0|> <|body_start_1|> ...
Implements additive LTP on PF-MLI synapses driven by CF activity
PF_MLI_LTP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PF_MLI_LTP: """Implements additive LTP on PF-MLI synapses driven by CF activity""" def __init__(self, IO, GR, PF_MLI, CF_MLI, ltp_inc, max_weight, window=50 * ms): """IO: NeuronGroup of inferior olive neurons GR: NeuronGroup of granule cells PF_MLI: Synapses object of PF-MLI synapses...
stack_v2_sparse_classes_36k_train_032708
5,461
no_license
[ { "docstring": "IO: NeuronGroup of inferior olive neurons GR: NeuronGroup of granule cells PF_MLI: Synapses object of PF-MLI synapses CF_MLI: Synapses object of CF-MLI synapses ltp_inc: the additive constant to increment PF-MLI synapses by window: the time window to depress PF-PKJ synapses for GR spikes that pr...
2
stack_v2_sparse_classes_30k_train_000003
Implement the Python class `PF_MLI_LTP` described below. Class description: Implements additive LTP on PF-MLI synapses driven by CF activity Method signatures and docstrings: - def __init__(self, IO, GR, PF_MLI, CF_MLI, ltp_inc, max_weight, window=50 * ms): IO: NeuronGroup of inferior olive neurons GR: NeuronGroup of...
Implement the Python class `PF_MLI_LTP` described below. Class description: Implements additive LTP on PF-MLI synapses driven by CF activity Method signatures and docstrings: - def __init__(self, IO, GR, PF_MLI, CF_MLI, ltp_inc, max_weight, window=50 * ms): IO: NeuronGroup of inferior olive neurons GR: NeuronGroup of...
6579a4d9636332267d0f26d8d4c8226e4fecf85d
<|skeleton|> class PF_MLI_LTP: """Implements additive LTP on PF-MLI synapses driven by CF activity""" def __init__(self, IO, GR, PF_MLI, CF_MLI, ltp_inc, max_weight, window=50 * ms): """IO: NeuronGroup of inferior olive neurons GR: NeuronGroup of granule cells PF_MLI: Synapses object of PF-MLI synapses...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PF_MLI_LTP: """Implements additive LTP on PF-MLI synapses driven by CF activity""" def __init__(self, IO, GR, PF_MLI, CF_MLI, ltp_inc, max_weight, window=50 * ms): """IO: NeuronGroup of inferior olive neurons GR: NeuronGroup of granule cells PF_MLI: Synapses object of PF-MLI synapses CF_MLI: Syna...
the_stack_v2_python_sparse
neuron_models/cf_learning.py
blennon/research
train
0
13b6f1708e8eae4a0ba73b4f17ad4ffdc0d265f1
[ "place = PlaceTrend(date_begin=None, date_end=None)\nprovinces = place.get_provinces()\nreturn provinces", "assert re.match('\\\\w{2,10}省$', province), 'the format of province is wrong ,the right format such as \"广东省\" '\nplace = PlaceTrend(date_begin=None, date_end=None)\ncitys = place.get_citys(province)\nretur...
<|body_start_0|> place = PlaceTrend(date_begin=None, date_end=None) provinces = place.get_provinces() return provinces <|end_body_0|> <|body_start_1|> assert re.match('\\w{2,10}省$', province), 'the format of province is wrong ,the right format such as "广东省" ' place = PlaceTrend(...
PositiongParent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PositiongParent: def get_all_province(self) -> list: """获取可以监测的省份 :return 省份列表 [广东省,广西省.....]""" <|body_0|> def get_all_city(self, province: str) -> list: """获取该省份下可以监测的城市 :return 城市列表""" <|body_1|> def get_all_place(self, province: str, city: str) -> li...
stack_v2_sparse_classes_36k_train_032709
1,525
no_license
[ { "docstring": "获取可以监测的省份 :return 省份列表 [广东省,广西省.....]", "name": "get_all_province", "signature": "def get_all_province(self) -> list" }, { "docstring": "获取该省份下可以监测的城市 :return 城市列表", "name": "get_all_city", "signature": "def get_all_city(self, province: str) -> list" }, { "docstri...
3
stack_v2_sparse_classes_30k_train_000345
Implement the Python class `PositiongParent` described below. Class description: Implement the PositiongParent class. Method signatures and docstrings: - def get_all_province(self) -> list: 获取可以监测的省份 :return 省份列表 [广东省,广西省.....] - def get_all_city(self, province: str) -> list: 获取该省份下可以监测的城市 :return 城市列表 - def get_all_...
Implement the Python class `PositiongParent` described below. Class description: Implement the PositiongParent class. Method signatures and docstrings: - def get_all_province(self) -> list: 获取可以监测的省份 :return 省份列表 [广东省,广西省.....] - def get_all_city(self, province: str) -> list: 获取该省份下可以监测的城市 :return 城市列表 - def get_all_...
5e34873cd13950dd3b5dc6341aad144522af0eae
<|skeleton|> class PositiongParent: def get_all_province(self) -> list: """获取可以监测的省份 :return 省份列表 [广东省,广西省.....]""" <|body_0|> def get_all_city(self, province: str) -> list: """获取该省份下可以监测的城市 :return 城市列表""" <|body_1|> def get_all_place(self, province: str, city: str) -> li...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PositiongParent: def get_all_province(self) -> list: """获取可以监测的省份 :return 省份列表 [广东省,广西省.....]""" place = PlaceTrend(date_begin=None, date_end=None) provinces = place.get_provinces() return provinces def get_all_city(self, province: str) -> list: """获取该省份下可以监测的城市 :r...
the_stack_v2_python_sparse
spyderpro/function/people_function/_positioning_parent.py
LianZS/spyderpro
train
8
ccbe48d5b49a060038f846c1e0daf778fb293263
[ "hashmap = dict()\nfor x in nums:\n hashmap[x] = hashmap.get(x, 0) + 1\nresult = []\nfor k in hashmap:\n if hashmap[k] == 2:\n result.append(k)\nreturn result", "result = []\nfor i in range(len(nums)):\n index = abs(nums[i]) - 1\n if nums[index] < 0:\n result.append(abs(nums[i]))\n nu...
<|body_start_0|> hashmap = dict() for x in nums: hashmap[x] = hashmap.get(x, 0) + 1 result = [] for k in hashmap: if hashmap[k] == 2: result.append(k) return result <|end_body_0|> <|body_start_1|> result = [] for i in range...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDuplicates(self, nums): """哈希表 :param list[int] nums: :return: list[int]""" <|body_0|> def findDuplicates2(self, nums): """1. 找到数字i时,将位置i-1处的数字翻转为负数。 2. 如果位置i-1 上的数字已经为负,则i是出现两次的数字。 :param list[int] nums: :return: list[int]""" <|body_1|> <|...
stack_v2_sparse_classes_36k_train_032710
1,543
no_license
[ { "docstring": "哈希表 :param list[int] nums: :return: list[int]", "name": "findDuplicates", "signature": "def findDuplicates(self, nums)" }, { "docstring": "1. 找到数字i时,将位置i-1处的数字翻转为负数。 2. 如果位置i-1 上的数字已经为负,则i是出现两次的数字。 :param list[int] nums: :return: list[int]", "name": "findDuplicates2", "si...
2
stack_v2_sparse_classes_30k_train_009947
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicates(self, nums): 哈希表 :param list[int] nums: :return: list[int] - def findDuplicates2(self, nums): 1. 找到数字i时,将位置i-1处的数字翻转为负数。 2. 如果位置i-1 上的数字已经为负,则i是出现两次的数字。 :param...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicates(self, nums): 哈希表 :param list[int] nums: :return: list[int] - def findDuplicates2(self, nums): 1. 找到数字i时,将位置i-1处的数字翻转为负数。 2. 如果位置i-1 上的数字已经为负,则i是出现两次的数字。 :param...
837957ea22aa07ce28a6c23ea0419bd2011e1f88
<|skeleton|> class Solution: def findDuplicates(self, nums): """哈希表 :param list[int] nums: :return: list[int]""" <|body_0|> def findDuplicates2(self, nums): """1. 找到数字i时,将位置i-1处的数字翻转为负数。 2. 如果位置i-1 上的数字已经为负,则i是出现两次的数字。 :param list[int] nums: :return: list[int]""" <|body_1|> <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findDuplicates(self, nums): """哈希表 :param list[int] nums: :return: list[int]""" hashmap = dict() for x in nums: hashmap[x] = hashmap.get(x, 0) + 1 result = [] for k in hashmap: if hashmap[k] == 2: result.append(k) ...
the_stack_v2_python_sparse
华为题库/数组中重复的数据.py
2226171237/Algorithmpractice
train
0
583831e75af3bcc0eb02847a81b3def88139a26a
[ "self.head = head\ncheckPointer = head\nself.llLength = 0\nwhile checkPointer:\n self.llLength += 1\n checkPointer = checkPointer.next", "pointer = self.head\nfor i in range(1, randint(1, self.llLength)):\n pointer = pointer.next\nreturn pointer.val" ]
<|body_start_0|> self.head = head checkPointer = head self.llLength = 0 while checkPointer: self.llLength += 1 checkPointer = checkPointer.next <|end_body_0|> <|body_start_1|> pointer = self.head for i in range(1, randint(1, self.llLength)): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """Returns a random node's value. :rtype: int""" ...
stack_v2_sparse_classes_36k_train_032711
1,107
no_license
[ { "docstring": "@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode", "name": "__init__", "signature": "def __init__(self, head)" }, { "docstring": "Returns a random node's value. :rtype: int", "name": "g...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode - def getRan...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode - def getRan...
5deff070bb9f6b19a1cfc0a6086ac155496fbb78
<|skeleton|> class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """Returns a random node's value. :rtype: int""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" self.head = head checkPointer = head self.llLength = 0 while checkPointer: s...
the_stack_v2_python_sparse
lc_linked_list_random_node.py
vincentt117/coding_challenge
train
1
6308c615f1eaf57354b82a4af1a81cc9abd796b1
[ "self.__function = function\nself.__args = args\nself.__kwargs = kwargs\nself.__status = False\nself.__thread = False\nself.__lock = _thread.allocate_lock()", "self.__lock.acquire()\nself.__status = True\nif not self.__thread:\n self.__thread = True\n _thread.start_new_thread(self.__run, ())\nself.__lock.re...
<|body_start_0|> self.__function = function self.__args = args self.__kwargs = kwargs self.__status = False self.__thread = False self.__lock = _thread.allocate_lock() <|end_body_0|> <|body_start_1|> self.__lock.acquire() self.__status = True if n...
Mille_Timer(function, *args, **kwargs) -> Mille Timer
Mille_Timer
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mille_Timer: """Mille_Timer(function, *args, **kwargs) -> Mille Timer""" def __init__(self, function, *args, **kwargs): """Initialize the Mille_Timer object.""" <|body_0|> def start(self): """Start the Mille_Timer object.""" <|body_1|> def stop(self)...
stack_v2_sparse_classes_36k_train_032712
3,709
permissive
[ { "docstring": "Initialize the Mille_Timer object.", "name": "__init__", "signature": "def __init__(self, function, *args, **kwargs)" }, { "docstring": "Start the Mille_Timer object.", "name": "start", "signature": "def start(self)" }, { "docstring": "Stop the Mille_Timer object....
4
stack_v2_sparse_classes_30k_train_008513
Implement the Python class `Mille_Timer` described below. Class description: Mille_Timer(function, *args, **kwargs) -> Mille Timer Method signatures and docstrings: - def __init__(self, function, *args, **kwargs): Initialize the Mille_Timer object. - def start(self): Start the Mille_Timer object. - def stop(self): St...
Implement the Python class `Mille_Timer` described below. Class description: Mille_Timer(function, *args, **kwargs) -> Mille Timer Method signatures and docstrings: - def __init__(self, function, *args, **kwargs): Initialize the Mille_Timer object. - def start(self): Start the Mille_Timer object. - def stop(self): St...
d097ca0ad6a6aee2180d32dce6a3322621f655fd
<|skeleton|> class Mille_Timer: """Mille_Timer(function, *args, **kwargs) -> Mille Timer""" def __init__(self, function, *args, **kwargs): """Initialize the Mille_Timer object.""" <|body_0|> def start(self): """Start the Mille_Timer object.""" <|body_1|> def stop(self)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Mille_Timer: """Mille_Timer(function, *args, **kwargs) -> Mille Timer""" def __init__(self, function, *args, **kwargs): """Initialize the Mille_Timer object.""" self.__function = function self.__args = args self.__kwargs = kwargs self.__status = False self....
the_stack_v2_python_sparse
recipes/Python/502238_Aens_Time/recipe-502238.py
betty29/code-1
train
0
ea00a492226e7fdd85c43a7aaac4543a7d627f5f
[ "strfpn = 'simple.test-myversion1:ascii:mydb#1'\nfpn = ccm.FourPartName(strfpn)\nassert fpn.name == 'simple.test'\nassert fpn.version == 'myversion1'\nassert fpn.type == 'ascii'\nassert fpn.instance == 'mydb#1'\nassert strfpn == str(fpn)\nassert strfpn == fpn.objectname", "strfpn = 'simple test.ext - myversion1 :...
<|body_start_0|> strfpn = 'simple.test-myversion1:ascii:mydb#1' fpn = ccm.FourPartName(strfpn) assert fpn.name == 'simple.test' assert fpn.version == 'myversion1' assert fpn.type == 'ascii' assert fpn.instance == 'mydb#1' assert strfpn == str(fpn) assert s...
Unit test case for testing four part name of a ccm project
FourPartNameTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FourPartNameTest: """Unit test case for testing four part name of a ccm project""" def testSimpleFourPartNameParsing(self): """Test the parsing of a simple four part name""" <|body_0|> def testSpacesFourPartNameParsing(self): """Test the parsing of a four part na...
stack_v2_sparse_classes_36k_train_032713
5,649
no_license
[ { "docstring": "Test the parsing of a simple four part name", "name": "testSimpleFourPartNameParsing", "signature": "def testSimpleFourPartNameParsing(self)" }, { "docstring": "Test the parsing of a four part name that contains spaces", "name": "testSpacesFourPartNameParsing", "signature...
6
stack_v2_sparse_classes_30k_train_013507
Implement the Python class `FourPartNameTest` described below. Class description: Unit test case for testing four part name of a ccm project Method signatures and docstrings: - def testSimpleFourPartNameParsing(self): Test the parsing of a simple four part name - def testSpacesFourPartNameParsing(self): Test the pars...
Implement the Python class `FourPartNameTest` described below. Class description: Unit test case for testing four part name of a ccm project Method signatures and docstrings: - def testSimpleFourPartNameParsing(self): Test the parsing of a simple four part name - def testSpacesFourPartNameParsing(self): Test the pars...
f458a4ce83f74d603362fe6b71eaa647ccc62fee
<|skeleton|> class FourPartNameTest: """Unit test case for testing four part name of a ccm project""" def testSimpleFourPartNameParsing(self): """Test the parsing of a simple four part name""" <|body_0|> def testSpacesFourPartNameParsing(self): """Test the parsing of a four part na...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FourPartNameTest: """Unit test case for testing four part name of a ccm project""" def testSimpleFourPartNameParsing(self): """Test the parsing of a simple four part name""" strfpn = 'simple.test-myversion1:ascii:mydb#1' fpn = ccm.FourPartName(strfpn) assert fpn.name == 's...
the_stack_v2_python_sparse
buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccm_4pn.py
anagovitsyn/oss.FCL.sftools.dev.build
train
0
082d127377253de077469e704d5fff2dde4b68c6
[ "d = {i: i ** 2 for i in range(0, 10)}\nrecord = [n]\nwhile n != 1:\n new_n = 0\n while n != 0:\n new_n += d[n % 10]\n n //= 10\n if new_n in record:\n return False\n else:\n record.append(new_n)\n n = new_n\nreturn True", "def new_number(n):\n total = 0\n whil...
<|body_start_0|> d = {i: i ** 2 for i in range(0, 10)} record = [n] while n != 1: new_n = 0 while n != 0: new_n += d[n % 10] n //= 10 if new_n in record: return False else: record.appe...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isHappy(self, n): """:type n: int :rtype: bool""" <|body_0|> def isHappy2(self, n): """:type n: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> d = {i: i ** 2 for i in range(0, 10)} record = [n] while n...
stack_v2_sparse_classes_36k_train_032714
1,123
no_license
[ { "docstring": ":type n: int :rtype: bool", "name": "isHappy", "signature": "def isHappy(self, n)" }, { "docstring": ":type n: int :rtype: bool", "name": "isHappy2", "signature": "def isHappy2(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_011985
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHappy(self, n): :type n: int :rtype: bool - def isHappy2(self, n): :type n: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHappy(self, n): :type n: int :rtype: bool - def isHappy2(self, n): :type n: int :rtype: bool <|skeleton|> class Solution: def isHappy(self, n): """:type n: in...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def isHappy(self, n): """:type n: int :rtype: bool""" <|body_0|> def isHappy2(self, n): """:type n: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isHappy(self, n): """:type n: int :rtype: bool""" d = {i: i ** 2 for i in range(0, 10)} record = [n] while n != 1: new_n = 0 while n != 0: new_n += d[n % 10] n //= 10 if new_n in record: ...
the_stack_v2_python_sparse
random/happy_number.py
hwc1824/LeetCodeSolution
train
0
06cf7d943386aae8856e2ed875a8becd2816a943
[ "if len(prices) < 2:\n return 0\ndp = [[0 for _ in range(2)] for _ in range(len(prices))]\ndp[0][0] = 0\ndp[0][1] = -prices[0]\nfor i in range(1, len(prices)):\n dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0])\n dp[i][1] = max(dp[i - 1][1], -prices[i])\nreturn dp[-1][0]", "if len(prices) < 2:\n ...
<|body_start_0|> if len(prices) < 2: return 0 dp = [[0 for _ in range(2)] for _ in range(len(prices))] dp[0][0] = 0 dp[0][1] = -prices[0] for i in range(1, len(prices)): dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0]) dp[i][1] = max(dp[i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """最大股票收益 dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0]) dp[i][1] = max(dp[i - 1][1], -prices[i]) :param prices: :return:""" <|body_0|> def maxProfit1(self, prices: List[int]) -> int: """空间优化 :param pri...
stack_v2_sparse_classes_36k_train_032715
1,849
no_license
[ { "docstring": "最大股票收益 dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0]) dp[i][1] = max(dp[i - 1][1], -prices[i]) :param prices: :return:", "name": "maxProfit", "signature": "def maxProfit(self, prices: List[int]) -> int" }, { "docstring": "空间优化 :param prices: :return:", "name": "maxPro...
2
stack_v2_sparse_classes_30k_train_010088
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 最大股票收益 dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0]) dp[i][1] = max(dp[i - 1][1], -prices[i]) :param prices: :return: - de...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 最大股票收益 dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0]) dp[i][1] = max(dp[i - 1][1], -prices[i]) :param prices: :return: - de...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """最大股票收益 dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0]) dp[i][1] = max(dp[i - 1][1], -prices[i]) :param prices: :return:""" <|body_0|> def maxProfit1(self, prices: List[int]) -> int: """空间优化 :param pri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices: List[int]) -> int: """最大股票收益 dp[i][0] = max(dp[i - 1][1] + prices[i], dp[i - 1][0]) dp[i][1] = max(dp[i - 1][1], -prices[i]) :param prices: :return:""" if len(prices) < 2: return 0 dp = [[0 for _ in range(2)] for _ in range(len(prices))...
the_stack_v2_python_sparse
datastructure/dp_exercise/MaxProfit.py
yinhuax/leet_code
train
0
b958414938ae9c1d9dff5805e3af523dad365175
[ "try:\n from bs4 import BeautifulSoup\nexcept ImportError:\n raise ValueError('Could not import python packages. Please install it with `pip install beautifulsoup4`. ')\ntry:\n _ = BeautifulSoup('<html><body>Parser builder library test.</body></html>', **kwargs)\nexcept Exception as e:\n raise ValueErro...
<|body_start_0|> try: from bs4 import BeautifulSoup except ImportError: raise ValueError('Could not import python packages. Please install it with `pip install beautifulsoup4`. ') try: _ = BeautifulSoup('<html><body>Parser builder library test.</body></html>',...
Loader that loads ReadTheDocs documentation directory dump.
ReadTheDocsLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadTheDocsLoader: """Loader that loads ReadTheDocs documentation directory dump.""" def __init__(self, path: str, encoding: Optional[str]=None, errors: Optional[str]=None, **kwargs: Optional[Any]): """Initialize path.""" <|body_0|> def load(self) -> List[Document]: ...
stack_v2_sparse_classes_36k_train_032716
2,094
no_license
[ { "docstring": "Initialize path.", "name": "__init__", "signature": "def __init__(self, path: str, encoding: Optional[str]=None, errors: Optional[str]=None, **kwargs: Optional[Any])" }, { "docstring": "Load documents.", "name": "load", "signature": "def load(self) -> List[Document]" } ...
2
stack_v2_sparse_classes_30k_train_014478
Implement the Python class `ReadTheDocsLoader` described below. Class description: Loader that loads ReadTheDocs documentation directory dump. Method signatures and docstrings: - def __init__(self, path: str, encoding: Optional[str]=None, errors: Optional[str]=None, **kwargs: Optional[Any]): Initialize path. - def lo...
Implement the Python class `ReadTheDocsLoader` described below. Class description: Loader that loads ReadTheDocs documentation directory dump. Method signatures and docstrings: - def __init__(self, path: str, encoding: Optional[str]=None, errors: Optional[str]=None, **kwargs: Optional[Any]): Initialize path. - def lo...
b7aaa920a52613e3f1f04fa5cd7568ad37302d11
<|skeleton|> class ReadTheDocsLoader: """Loader that loads ReadTheDocs documentation directory dump.""" def __init__(self, path: str, encoding: Optional[str]=None, errors: Optional[str]=None, **kwargs: Optional[Any]): """Initialize path.""" <|body_0|> def load(self) -> List[Document]: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReadTheDocsLoader: """Loader that loads ReadTheDocs documentation directory dump.""" def __init__(self, path: str, encoding: Optional[str]=None, errors: Optional[str]=None, **kwargs: Optional[Any]): """Initialize path.""" try: from bs4 import BeautifulSoup except Impor...
the_stack_v2_python_sparse
openai/venv/lib/python3.10/site-packages/langchain/document_loaders/readthedocs.py
henrymendez/garage
train
0
f6a2d84c6c26292b2622a9487cde697bf4f90517
[ "if self.action in ['retrieve', 'list', 'add_view']:\n permission_classes = [AllowAny]\nelse:\n permission_classes = [IsAdminUser]\nreturn [permission() for permission in permission_classes]", "queryset = super().get_queryset()\nif self.request.user.is_authenticated and self.request.user.is_staff:\n retu...
<|body_start_0|> if self.action in ['retrieve', 'list', 'add_view']: permission_classes = [AllowAny] else: permission_classes = [IsAdminUser] return [permission() for permission in permission_classes] <|end_body_0|> <|body_start_1|> queryset = super().get_queryse...
Provide all methods for manage Story.
StoryViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StoryViewSet: """Provide all methods for manage Story.""" def get_permissions(self): """Instantiates and returns the list of permissions that this view requires.""" <|body_0|> def get_queryset(self): """Customize the queryset according to the current user.""" ...
stack_v2_sparse_classes_36k_train_032717
3,643
no_license
[ { "docstring": "Instantiates and returns the list of permissions that this view requires.", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "Customize the queryset according to the current user.", "name": "get_queryset", "signature": "def get_queryse...
4
stack_v2_sparse_classes_30k_train_002934
Implement the Python class `StoryViewSet` described below. Class description: Provide all methods for manage Story. Method signatures and docstrings: - def get_permissions(self): Instantiates and returns the list of permissions that this view requires. - def get_queryset(self): Customize the queryset according to the...
Implement the Python class `StoryViewSet` described below. Class description: Provide all methods for manage Story. Method signatures and docstrings: - def get_permissions(self): Instantiates and returns the list of permissions that this view requires. - def get_queryset(self): Customize the queryset according to the...
617f6c990845d233efa64c9f0b309f5afef17590
<|skeleton|> class StoryViewSet: """Provide all methods for manage Story.""" def get_permissions(self): """Instantiates and returns the list of permissions that this view requires.""" <|body_0|> def get_queryset(self): """Customize the queryset according to the current user.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StoryViewSet: """Provide all methods for manage Story.""" def get_permissions(self): """Instantiates and returns the list of permissions that this view requires.""" if self.action in ['retrieve', 'list', 'add_view']: permission_classes = [AllowAny] else: pe...
the_stack_v2_python_sparse
apps/story/views.py
patate-et-cornichon/patateetcornichon-api
train
3
e7a1209972b3effdd905a692fbd251690bb9b1b8
[ "sender = super()._get_sender(mlist, msg, msgdata)\nif msgdata.get('verp', False):\n log.debug('VERPing %s', msg.get('message-id'))\n recipient = msgdata['recipient']\n sender_mailbox, sender_domain = split_email(sender)\n recipient_mailbox, recipient_domain = split_email(recipient)\n if recipient_do...
<|body_start_0|> sender = super()._get_sender(mlist, msg, msgdata) if msgdata.get('verp', False): log.debug('VERPing %s', msg.get('message-id')) recipient = msgdata['recipient'] sender_mailbox, sender_domain = split_email(sender) recipient_mailbox, recipie...
Mixin for VERP functionality. This works by overriding the base class's _get_sender() method to return the VERP'd envelope sender. It expects the individual recipient's address to be squirreled away in the message metadata.
VERPMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VERPMixin: """Mixin for VERP functionality. This works by overriding the base class's _get_sender() method to return the VERP'd envelope sender. It expects the individual recipient's address to be squirreled away in the message metadata.""" def _get_sender(self, mlist, msg, msgdata): ...
stack_v2_sparse_classes_36k_train_032718
3,636
no_license
[ { "docstring": "Return the recipient's address VERP encoded in the sender. :param mlist: The mailing list being delivered to. :type mlist: `IMailingList` :param msg: The original message being delivered. :type msg: `Message` :param msgdata: Additional message metadata for this delivery. :type msgdata: dictionar...
2
null
Implement the Python class `VERPMixin` described below. Class description: Mixin for VERP functionality. This works by overriding the base class's _get_sender() method to return the VERP'd envelope sender. It expects the individual recipient's address to be squirreled away in the message metadata. Method signatures a...
Implement the Python class `VERPMixin` described below. Class description: Mixin for VERP functionality. This works by overriding the base class's _get_sender() method to return the VERP'd envelope sender. It expects the individual recipient's address to be squirreled away in the message metadata. Method signatures a...
7edf8148e34b9f73ca6433ceb43a1770f4fa32c1
<|skeleton|> class VERPMixin: """Mixin for VERP functionality. This works by overriding the base class's _get_sender() method to return the VERP'd envelope sender. It expects the individual recipient's address to be squirreled away in the message metadata.""" def _get_sender(self, mlist, msg, msgdata): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VERPMixin: """Mixin for VERP functionality. This works by overriding the base class's _get_sender() method to return the VERP'd envelope sender. It expects the individual recipient's address to be squirreled away in the message metadata.""" def _get_sender(self, mlist, msg, msgdata): """Return th...
the_stack_v2_python_sparse
libs/Mailman/mailman/mta/verp.py
masomel/py-import-analysis
train
1
c3e4d59f2675a4c6c25e67ed6e09ae55142033c1
[ "time_string = self._GetRowValue(query_hash, row, value_name)\nif time_string is None:\n return None\ndate_time = dfdatetime_time_elements.TimeElements()\ndate_time.CopyFromDateTimeString(time_string)\nreturn date_time", "query_hash = hash(query)\nevent_data = KodiVideoEventData()\nevent_data.filename = self._...
<|body_start_0|> time_string = self._GetRowValue(query_hash, row, value_name) if time_string is None: return None date_time = dfdatetime_time_elements.TimeElements() date_time.CopyFromDateTimeString(time_string) return date_time <|end_body_0|> <|body_start_1|> ...
SQLite parser plugin for Kodi videos database files. The Kodi videos database file is typically stored in: MyVideos.db
KodiMyVideosPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KodiMyVideosPlugin: """SQLite parser plugin for Kodi videos database files. The Kodi videos database file is typically stored in: MyVideos.db""" def _GetDateTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row. Args: query_hash (int): hash ...
stack_v2_sparse_classes_36k_train_032719
8,988
permissive
[ { "docstring": "Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced the row. row (sqlite3.Row): row. value_name (str): name of the value. Returns: dfdatetime.CocoaTime: date and time value or None if not available.", "name...
2
stack_v2_sparse_classes_30k_train_007442
Implement the Python class `KodiMyVideosPlugin` described below. Class description: SQLite parser plugin for Kodi videos database files. The Kodi videos database file is typically stored in: MyVideos.db Method signatures and docstrings: - def _GetDateTimeRowValue(self, query_hash, row, value_name): Retrieves a date a...
Implement the Python class `KodiMyVideosPlugin` described below. Class description: SQLite parser plugin for Kodi videos database files. The Kodi videos database file is typically stored in: MyVideos.db Method signatures and docstrings: - def _GetDateTimeRowValue(self, query_hash, row, value_name): Retrieves a date a...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class KodiMyVideosPlugin: """SQLite parser plugin for Kodi videos database files. The Kodi videos database file is typically stored in: MyVideos.db""" def _GetDateTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row. Args: query_hash (int): hash ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KodiMyVideosPlugin: """SQLite parser plugin for Kodi videos database files. The Kodi videos database file is typically stored in: MyVideos.db""" def _GetDateTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row. Args: query_hash (int): hash of the query,...
the_stack_v2_python_sparse
plaso/parsers/sqlite_plugins/kodi.py
log2timeline/plaso
train
1,506
b6d87621a4424a994a6b9e1f360dcab5c6438f8c
[ "self.url = url\nself.content = []\nself.spider_path = []\nif static:\n self.static_web_spider()\nelse:\n self.time_step = time_step\n self.scroll_time = scroll_time\n self.dynamic_web_spider()", "driver = webdriver.Firefox(executable_path='src/geckodriver')\ndriver.get(self.url)\nfor i in range(int(s...
<|body_start_0|> self.url = url self.content = [] self.spider_path = [] if static: self.static_web_spider() else: self.time_step = time_step self.scroll_time = scroll_time self.dynamic_web_spider() <|end_body_0|> <|body_start_1|> ...
Tree_spider will automatically get html from a given url. If the website is dynamic, argument static should be False. Then Tree_spider will use selenium to simulate browser (Firefox) to get html from dynamic website.
Tree_spider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tree_spider: """Tree_spider will automatically get html from a given url. If the website is dynamic, argument static should be False. Then Tree_spider will use selenium to simulate browser (Firefox) to get html from dynamic website.""" def __init__(self, url, static=True, time_step=0.2, scro...
stack_v2_sparse_classes_36k_train_032720
3,777
no_license
[ { "docstring": ":param url: the url of website that going to be crawled :param static: If website is dynamic website like IGN, static should be False :param time_step: scroll the page every 0.2 second in order to load the whole dynamic website :param scroll_time: total scroll time. For example, scroll_time is 3...
5
stack_v2_sparse_classes_30k_train_017683
Implement the Python class `Tree_spider` described below. Class description: Tree_spider will automatically get html from a given url. If the website is dynamic, argument static should be False. Then Tree_spider will use selenium to simulate browser (Firefox) to get html from dynamic website. Method signatures and do...
Implement the Python class `Tree_spider` described below. Class description: Tree_spider will automatically get html from a given url. If the website is dynamic, argument static should be False. Then Tree_spider will use selenium to simulate browser (Firefox) to get html from dynamic website. Method signatures and do...
60594e87175e68fc2953b7045628e3fa7b8c259c
<|skeleton|> class Tree_spider: """Tree_spider will automatically get html from a given url. If the website is dynamic, argument static should be False. Then Tree_spider will use selenium to simulate browser (Firefox) to get html from dynamic website.""" def __init__(self, url, static=True, time_step=0.2, scro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tree_spider: """Tree_spider will automatically get html from a given url. If the website is dynamic, argument static should be False. Then Tree_spider will use selenium to simulate browser (Firefox) to get html from dynamic website.""" def __init__(self, url, static=True, time_step=0.2, scroll_time=300):...
the_stack_v2_python_sparse
src/util.py
tuosun98/Steam-game-reviews-DSCI510
train
0
7ab4c02a258c75c71d36646af7990d9d92d6a655
[ "gtk.Fixed.__init__(self)\nself._lst_labels = [u'λ<sub>b</sub>:', u'π<sub>Q</sub>:', u'π<sub>E</sub>:']\nself._dtc_data_controller = controller\nself._hardware_id = kwargs['hardware_id']\nself._subcategory_id = kwargs['subcategory_id']\nself._lblModel = ramstk.RAMSTKLabel('', tooltip=_(u'The assessment model used t...
<|body_start_0|> gtk.Fixed.__init__(self) self._lst_labels = [u'λ<sub>b</sub>:', u'π<sub>Q</sub>:', u'π<sub>E</sub>:'] self._dtc_data_controller = controller self._hardware_id = kwargs['hardware_id'] self._subcategory_id = kwargs['subcategory_id'] self._lblModel = ramstk....
Display Hardware assessment results attribute data in the RAMSTK Work Book. The Hardware assessment result view displays all the assessment results for the selected hardware item. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stress methods. The attributes of a Hardware asse...
AssessmentResults
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssessmentResults: """Display Hardware assessment results attribute data in the RAMSTK Work Book. The Hardware assessment result view displays all the assessment results for the selected hardware item. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stre...
stack_v2_sparse_classes_36k_train_032721
35,514
permissive
[ { "docstring": "Initialize an instance of the Hardware assessment result view. :param controller: the hardware data controller instance. :type controller: :class:`ramstk.hardware.Controller.HardwareBoMDataController` :param int hardware_id: the hardware ID of the currently selected hardware item. :param int sub...
4
stack_v2_sparse_classes_30k_train_015782
Implement the Python class `AssessmentResults` described below. Class description: Display Hardware assessment results attribute data in the RAMSTK Work Book. The Hardware assessment result view displays all the assessment results for the selected hardware item. This includes, currently, results for MIL-HDBK-217FN2 pa...
Implement the Python class `AssessmentResults` described below. Class description: Display Hardware assessment results attribute data in the RAMSTK Work Book. The Hardware assessment result view displays all the assessment results for the selected hardware item. This includes, currently, results for MIL-HDBK-217FN2 pa...
488ffed8b842399ddcae93007de6c6f1dda23d05
<|skeleton|> class AssessmentResults: """Display Hardware assessment results attribute data in the RAMSTK Work Book. The Hardware assessment result view displays all the assessment results for the selected hardware item. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AssessmentResults: """Display Hardware assessment results attribute data in the RAMSTK Work Book. The Hardware assessment result view displays all the assessment results for the selected hardware item. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stress methods. T...
the_stack_v2_python_sparse
src/ramstk/gui/gtk/workviews/components/Component.py
JmiXIII/ramstk
train
0
f1c4c0d942bd6af416c893bc13fd5b7352aebe21
[ "self.value = value\nself.identifier = identifier\nself.hint = hint", "hint = self.hint\nif isinstance(hint, type):\n type_hint = hint.__name__\nelif hint == ():\n type_hint = \"'no type'\"\nelif isinstance(hint, tuple):\n type_hint = ', '.join([type_.__name__ for type_ in hint])\nelse:\n type_hint = ...
<|body_start_0|> self.value = value self.identifier = identifier self.hint = hint <|end_body_0|> <|body_start_1|> hint = self.hint if isinstance(hint, type): type_hint = hint.__name__ elif hint == (): type_hint = "'no type'" elif isinstanc...
An argument or value is not of the specified type. `DoxhooksTypeError` extends `DoxhooksDataError`. Magic Methods ------------- __str__ Override `DoxhooksDataError.__str__` to compose a message.
DoxhooksTypeError
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DoxhooksTypeError: """An argument or value is not of the specified type. `DoxhooksTypeError` extends `DoxhooksDataError`. Magic Methods ------------- __str__ Override `DoxhooksDataError.__str__` to compose a message.""" def __init__(self, value, identifier, hint): """Initialise the e...
stack_v2_sparse_classes_36k_train_032722
10,728
permissive
[ { "docstring": "Initialise the error with parameters of the error message. The `DoxhooksTypeError` constructor overrides the `DoxhooksDataError` constructor with parameters of the error message. Parameters ---------- value The value that caused the error. identifier : str An identifier that the user associates ...
2
stack_v2_sparse_classes_30k_train_011376
Implement the Python class `DoxhooksTypeError` described below. Class description: An argument or value is not of the specified type. `DoxhooksTypeError` extends `DoxhooksDataError`. Magic Methods ------------- __str__ Override `DoxhooksDataError.__str__` to compose a message. Method signatures and docstrings: - def ...
Implement the Python class `DoxhooksTypeError` described below. Class description: An argument or value is not of the specified type. `DoxhooksTypeError` extends `DoxhooksDataError`. Magic Methods ------------- __str__ Override `DoxhooksDataError.__str__` to compose a message. Method signatures and docstrings: - def ...
8cb346fb1830a24af5640b948a85a578cc905db6
<|skeleton|> class DoxhooksTypeError: """An argument or value is not of the specified type. `DoxhooksTypeError` extends `DoxhooksDataError`. Magic Methods ------------- __str__ Override `DoxhooksDataError.__str__` to compose a message.""" def __init__(self, value, identifier, hint): """Initialise the e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DoxhooksTypeError: """An argument or value is not of the specified type. `DoxhooksTypeError` extends `DoxhooksDataError`. Magic Methods ------------- __str__ Override `DoxhooksDataError.__str__` to compose a message.""" def __init__(self, value, identifier, hint): """Initialise the error with par...
the_stack_v2_python_sparse
doxhooks/errors.py
nre/Doxhooks
train
1
520f7af5b9edd656b45ceec1f489f717575ae2a3
[ "super(VideoSessionManager, self).__init__()\nself.getters.update({'assignment': 'get_foreign_key', 'date_completed': 'get_time', 'date_started': 'get_time', 'user': 'get_foreign_key', 'video': 'get_foreign_key'})\nself.setters.update({'date_completed': 'set_time', 'date_started': 'set_time'})\nself.my_django_model...
<|body_start_0|> super(VideoSessionManager, self).__init__() self.getters.update({'assignment': 'get_foreign_key', 'date_completed': 'get_time', 'date_started': 'get_time', 'user': 'get_foreign_key', 'video': 'get_foreign_key'}) self.setters.update({'date_completed': 'set_time', 'date_started': ...
Manage VideoSessions in the Power Reg system
VideoSessionManager
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoSessionManager: """Manage VideoSessions in the Power Reg system""" def __init__(self): """constructor""" <|body_0|> def create(self, auth_token, assignment): """Create a new VideoSession object. @param auth_token The authentication token of the acting user @...
stack_v2_sparse_classes_36k_train_032723
6,633
permissive
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Create a new VideoSession object. @param auth_token The authentication token of the acting user @type auth_token facade.models.AuthToken @param assignment FK for an assignment @type assignment ...
5
null
Implement the Python class `VideoSessionManager` described below. Class description: Manage VideoSessions in the Power Reg system Method signatures and docstrings: - def __init__(self): constructor - def create(self, auth_token, assignment): Create a new VideoSession object. @param auth_token The authentication token...
Implement the Python class `VideoSessionManager` described below. Class description: Manage VideoSessions in the Power Reg system Method signatures and docstrings: - def __init__(self): constructor - def create(self, auth_token, assignment): Create a new VideoSession object. @param auth_token The authentication token...
a59457bc37f0501aea1f54d006a6de94ff80511c
<|skeleton|> class VideoSessionManager: """Manage VideoSessions in the Power Reg system""" def __init__(self): """constructor""" <|body_0|> def create(self, auth_token, assignment): """Create a new VideoSession object. @param auth_token The authentication token of the acting user @...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VideoSessionManager: """Manage VideoSessions in the Power Reg system""" def __init__(self): """constructor""" super(VideoSessionManager, self).__init__() self.getters.update({'assignment': 'get_foreign_key', 'date_completed': 'get_time', 'date_started': 'get_time', 'user': 'get_fo...
the_stack_v2_python_sparse
vod_aws/managers/video_session_manager.py
ninemoreminutes/openassign-server
train
0
c69634bd8c4fb735a84aa5372bad10da12fba4be
[ "movie_obj = Movie(movie_id=movie_id, movie_title=movie_title, movie_type=movie_type, movie_description=movie_description)\ntry:\n self._repository.insert(movie_obj)\nexcept RepositoryException as e:\n Session.set_message(e.message)\n return False\nreturn True", "movie = self._repository.select_by_id(mov...
<|body_start_0|> movie_obj = Movie(movie_id=movie_id, movie_title=movie_title, movie_type=movie_type, movie_description=movie_description) try: self._repository.insert(movie_obj) except RepositoryException as e: Session.set_message(e.message) return False ...
MovieController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovieController: def store(self, movie_id, movie_title, movie_type, movie_description): """Store a new movie Time complexity: O(1) Input: instance - an object Output: True - success False - failure Raises:""" <|body_0|> def update(self, movie_id, movie_title='', movie_type='...
stack_v2_sparse_classes_36k_train_032724
4,064
permissive
[ { "docstring": "Store a new movie Time complexity: O(1) Input: instance - an object Output: True - success False - failure Raises:", "name": "store", "signature": "def store(self, movie_id, movie_title, movie_type, movie_description)" }, { "docstring": "Update a movie by id Time complexity: O(1)...
3
stack_v2_sparse_classes_30k_train_010146
Implement the Python class `MovieController` described below. Class description: Implement the MovieController class. Method signatures and docstrings: - def store(self, movie_id, movie_title, movie_type, movie_description): Store a new movie Time complexity: O(1) Input: instance - an object Output: True - success Fa...
Implement the Python class `MovieController` described below. Class description: Implement the MovieController class. Method signatures and docstrings: - def store(self, movie_id, movie_title, movie_type, movie_description): Store a new movie Time complexity: O(1) Input: instance - an object Output: True - success Fa...
9496cb63594dcf1cc2cec8650b8eee603f85fdab
<|skeleton|> class MovieController: def store(self, movie_id, movie_title, movie_type, movie_description): """Store a new movie Time complexity: O(1) Input: instance - an object Output: True - success False - failure Raises:""" <|body_0|> def update(self, movie_id, movie_title='', movie_type='...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MovieController: def store(self, movie_id, movie_title, movie_type, movie_description): """Store a new movie Time complexity: O(1) Input: instance - an object Output: True - success False - failure Raises:""" movie_obj = Movie(movie_id=movie_id, movie_title=movie_title, movie_type=movie_type, ...
the_stack_v2_python_sparse
fundamentals-of-programming/labs/lab_5-11/controller/movie.py
vampy/university
train
1
416a5c535c5e982ff5c2c298e30c932670c3f604
[ "super().__init__(name='policy_value_network')\nif not isinstance(num_actions, int):\n raise ValueError(f'num_actions must be of type int, but was of type {type(num_actions)}.')\nself._policy_layer = snt.Sequential([snt.Linear(hidden_size), activation, snt.Linear(num_actions)])\nself._value_layer = snt.Sequentia...
<|body_start_0|> super().__init__(name='policy_value_network') if not isinstance(num_actions, int): raise ValueError(f'num_actions must be of type int, but was of type {type(num_actions)}.') self._policy_layer = snt.Sequential([snt.Linear(hidden_size), activation, snt.Linear(num_acti...
A network with linear layers, for policy and value respectively.
PolicyValueHead
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PolicyValueHead: """A network with linear layers, for policy and value respectively.""" def __init__(self, num_actions: int, hidden_size: int=256, activation=tf.nn.relu): """Initializes the PolicyValueHead module. Args: num_actions: Number of actions in discrete action space. hidden_...
stack_v2_sparse_classes_36k_train_032725
1,702
no_license
[ { "docstring": "Initializes the PolicyValueHead module. Args: num_actions: Number of actions in discrete action space. hidden_size: Size of hidden layers (between input and output layers). activation: Activation function to be used by this module (between hidden and output layers). Raises: ValueError: If shapes...
2
stack_v2_sparse_classes_30k_train_017491
Implement the Python class `PolicyValueHead` described below. Class description: A network with linear layers, for policy and value respectively. Method signatures and docstrings: - def __init__(self, num_actions: int, hidden_size: int=256, activation=tf.nn.relu): Initializes the PolicyValueHead module. Args: num_act...
Implement the Python class `PolicyValueHead` described below. Class description: A network with linear layers, for policy and value respectively. Method signatures and docstrings: - def __init__(self, num_actions: int, hidden_size: int=256, activation=tf.nn.relu): Initializes the PolicyValueHead module. Args: num_act...
1c2b2768f2c5996c8cc998d0271f3857949bdaeb
<|skeleton|> class PolicyValueHead: """A network with linear layers, for policy and value respectively.""" def __init__(self, num_actions: int, hidden_size: int=256, activation=tf.nn.relu): """Initializes the PolicyValueHead module. Args: num_actions: Number of actions in discrete action space. hidden_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PolicyValueHead: """A network with linear layers, for policy and value respectively.""" def __init__(self, num_actions: int, hidden_size: int=256, activation=tf.nn.relu): """Initializes the PolicyValueHead module. Args: num_actions: Number of actions in discrete action space. hidden_size: Size of...
the_stack_v2_python_sparse
ftw/tf/networks/policy_value.py
RaoulDrake/ftw
train
3
18cbed40f7a46a466e5fda0df9700bbde38ecdc9
[ "super().__init__()\nself.conv = nn.Conv1d(in_channels=embedding_size, out_channels=filter_num, kernel_size=window_size, padding=padding)\nself.relu = nn.ReLU()\nself.max_pool = nn.MaxPool1d(kernel_size=max_sentence_length - window_size + 1 + padding * 2)", "c = self.relu(self.conv(x))\nc_hat = self.max_pool(c).s...
<|body_start_0|> super().__init__() self.conv = nn.Conv1d(in_channels=embedding_size, out_channels=filter_num, kernel_size=window_size, padding=padding) self.relu = nn.ReLU() self.max_pool = nn.MaxPool1d(kernel_size=max_sentence_length - window_size + 1 + padding * 2) <|end_body_0|> <|b...
仅仅实现了一个 CNN 部分
CNNLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CNNLayer: """仅仅实现了一个 CNN 部分""" def __init__(self, embedding_size: int, filter_num: int, window_size: int, max_sentence_length: int, padding: int=0): """通过一个本模块后,我们对每个句子(用 N 表示句子数)得到了 filters_nums 个特征 :param embedding_size: 词向量维度 :param filter_num: 卷积个数(几个滤波器) :param window_size: 窗口大小...
stack_v2_sparse_classes_36k_train_032726
6,607
no_license
[ { "docstring": "通过一个本模块后,我们对每个句子(用 N 表示句子数)得到了 filters_nums 个特征 :param embedding_size: 词向量维度 :param filter_num: 卷积个数(几个滤波器) :param window_size: 窗口大小,对应论文中的 h :param padding: 两边填充 :param max_sentence_length: 每个句子有多少单词(已经根据这个参数进行了填充或截断),对应论文中的 n", "name": "__init__", "signature": "def __init__(self, embed...
2
stack_v2_sparse_classes_30k_train_020956
Implement the Python class `CNNLayer` described below. Class description: 仅仅实现了一个 CNN 部分 Method signatures and docstrings: - def __init__(self, embedding_size: int, filter_num: int, window_size: int, max_sentence_length: int, padding: int=0): 通过一个本模块后,我们对每个句子(用 N 表示句子数)得到了 filters_nums 个特征 :param embedding_size: 词向量维...
Implement the Python class `CNNLayer` described below. Class description: 仅仅实现了一个 CNN 部分 Method signatures and docstrings: - def __init__(self, embedding_size: int, filter_num: int, window_size: int, max_sentence_length: int, padding: int=0): 通过一个本模块后,我们对每个句子(用 N 表示句子数)得到了 filters_nums 个特征 :param embedding_size: 词向量维...
29dc4aa0ebd3f610135ceb88f62634b4597b564a
<|skeleton|> class CNNLayer: """仅仅实现了一个 CNN 部分""" def __init__(self, embedding_size: int, filter_num: int, window_size: int, max_sentence_length: int, padding: int=0): """通过一个本模块后,我们对每个句子(用 N 表示句子数)得到了 filters_nums 个特征 :param embedding_size: 词向量维度 :param filter_num: 卷积个数(几个滤波器) :param window_size: 窗口大小...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CNNLayer: """仅仅实现了一个 CNN 部分""" def __init__(self, embedding_size: int, filter_num: int, window_size: int, max_sentence_length: int, padding: int=0): """通过一个本模块后,我们对每个句子(用 N 表示句子数)得到了 filters_nums 个特征 :param embedding_size: 词向量维度 :param filter_num: 卷积个数(几个滤波器) :param window_size: 窗口大小,对应论文中的 h :pa...
the_stack_v2_python_sparse
task02/modules/cnn.py
yjqiang/nlp-beginner
train
2
0d2305cd39b47e2c0c04713de03dec7a2d38176d
[ "args = self._base_args_copy()\nargs += ['-p', project.filename]\nargs += ['-c', config.name]\nargs += ['--verbose']\nreturn args", "super(UbuildBuilder, self)._run_builder(project, config)\nargs = self._construct_ubuild_args(project, config)\nif not ubuild(args):\n raise BuildError('Failed to build {}'.format...
<|body_start_0|> args = self._base_args_copy() args += ['-p', project.filename] args += ['-c', config.name] args += ['--verbose'] return args <|end_body_0|> <|body_start_1|> super(UbuildBuilder, self)._run_builder(project, config) args = self._construct_ubuild_ar...
UbuildBuilder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UbuildBuilder: def _construct_ubuild_args(self, project, config): """Build the arguments list for passing to ubuild""" <|body_0|> def _run_builder(self, project, config): """Call the ubuild module to perform the actual build.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_032727
762
no_license
[ { "docstring": "Build the arguments list for passing to ubuild", "name": "_construct_ubuild_args", "signature": "def _construct_ubuild_args(self, project, config)" }, { "docstring": "Call the ubuild module to perform the actual build.", "name": "_run_builder", "signature": "def _run_buil...
2
stack_v2_sparse_classes_30k_train_020964
Implement the Python class `UbuildBuilder` described below. Class description: Implement the UbuildBuilder class. Method signatures and docstrings: - def _construct_ubuild_args(self, project, config): Build the arguments list for passing to ubuild - def _run_builder(self, project, config): Call the ubuild module to p...
Implement the Python class `UbuildBuilder` described below. Class description: Implement the UbuildBuilder class. Method signatures and docstrings: - def _construct_ubuild_args(self, project, config): Build the arguments list for passing to ubuild - def _run_builder(self, project, config): Call the ubuild module to p...
bff2d8c9e5e1ead4018f63098c1adea0e0c28184
<|skeleton|> class UbuildBuilder: def _construct_ubuild_args(self, project, config): """Build the arguments list for passing to ubuild""" <|body_0|> def _run_builder(self, project, config): """Call the ubuild module to perform the actual build.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UbuildBuilder: def _construct_ubuild_args(self, project, config): """Build the arguments list for passing to ubuild""" args = self._base_args_copy() args += ['-p', project.filename] args += ['-c', config.name] args += ['--verbose'] return args def _run_buil...
the_stack_v2_python_sparse
adk/tools/packages/workspace_builders/ubuild_builder.py
litterstar7/Qualcomm_BT_Audio
train
4
c6279cc21a1ec016804560794bfa1e8dcda9b4d6
[ "for data_type in subquery['forecast']:\n if kwargs['result'] == 1:\n sub_context_block[data_type]['value'] = sub_context_block[data_type]['value'].cumsum()\n if kwargs['forecast'] == 0 and data_type == 'Actual':\n sub_context_block[data_type]['value'].loc[sub_context_block[data_type]['v...
<|body_start_0|> for data_type in subquery['forecast']: if kwargs['result'] == 1: sub_context_block[data_type]['value'] = sub_context_block[data_type]['value'].cumsum() if kwargs['forecast'] == 0 and data_type == 'Actual': sub_context_block[data_ty...
Manager create necessary table information for indicator.
ValueRowManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValueRowManager: """Manager create necessary table information for indicator.""" def result_handler(self, sub_context_block, kwargs, subquery): """Method for monthly or cumulative values representation.""" <|body_0|> def indicator_handler(self, df_block, kwargs, subquery...
stack_v2_sparse_classes_36k_train_032728
1,983
no_license
[ { "docstring": "Method for monthly or cumulative values representation.", "name": "result_handler", "signature": "def result_handler(self, sub_context_block, kwargs, subquery)" }, { "docstring": "Calculate indicator row values.", "name": "indicator_handler", "signature": "def indicator_h...
3
stack_v2_sparse_classes_30k_train_017152
Implement the Python class `ValueRowManager` described below. Class description: Manager create necessary table information for indicator. Method signatures and docstrings: - def result_handler(self, sub_context_block, kwargs, subquery): Method for monthly or cumulative values representation. - def indicator_handler(...
Implement the Python class `ValueRowManager` described below. Class description: Manager create necessary table information for indicator. Method signatures and docstrings: - def result_handler(self, sub_context_block, kwargs, subquery): Method for monthly or cumulative values representation. - def indicator_handler(...
b8f2a377ca2f0f55ddf2b1ace05402d2dfacf4cd
<|skeleton|> class ValueRowManager: """Manager create necessary table information for indicator.""" def result_handler(self, sub_context_block, kwargs, subquery): """Method for monthly or cumulative values representation.""" <|body_0|> def indicator_handler(self, df_block, kwargs, subquery...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValueRowManager: """Manager create necessary table information for indicator.""" def result_handler(self, sub_context_block, kwargs, subquery): """Method for monthly or cumulative values representation.""" for data_type in subquery['forecast']: if kwargs['result'] == 1: ...
the_stack_v2_python_sparse
indicator/calc_value_indicator.py
diagon555/KPI-presentation
train
0
9900dc120c93a8f245c2be866bca42c710bb7cd4
[ "self.skew_detection_config = skew_detection_config\nself.drift_detection_config = drift_detection_config\nself.explanation_config = explanation_config\nself._config_for_bp = False", "training_dataset = None\nif self.skew_detection_config is not None:\n training_dataset = gca_model_monitoring.ModelMonitoringOb...
<|body_start_0|> self.skew_detection_config = skew_detection_config self.drift_detection_config = drift_detection_config self.explanation_config = explanation_config self._config_for_bp = False <|end_body_0|> <|body_start_1|> training_dataset = None if self.skew_detectio...
_ObjectiveConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ObjectiveConfig: def __init__(self, skew_detection_config: Optional['gca_model_monitoring._SkewDetectionConfig']=None, drift_detection_config: Optional['gca_model_monitoring._DriftDetectionConfig']=None, explanation_config: Optional['gca_model_monitoring._ExplanationConfig']=None): """B...
stack_v2_sparse_classes_36k_train_032729
17,467
permissive
[ { "docstring": "Base class for ObjectiveConfig. Args: skew_detection_config (_SkewDetectionConfig): Optional. An instance of _SkewDetectionConfig. drift_detection_config (_DriftDetectionConfig): Optional. An instance of _DriftDetectionConfig. explanation_config (_ExplanationConfig): Optional. An instance of _Ex...
2
stack_v2_sparse_classes_30k_train_014253
Implement the Python class `_ObjectiveConfig` described below. Class description: Implement the _ObjectiveConfig class. Method signatures and docstrings: - def __init__(self, skew_detection_config: Optional['gca_model_monitoring._SkewDetectionConfig']=None, drift_detection_config: Optional['gca_model_monitoring._Drif...
Implement the Python class `_ObjectiveConfig` described below. Class description: Implement the _ObjectiveConfig class. Method signatures and docstrings: - def __init__(self, skew_detection_config: Optional['gca_model_monitoring._SkewDetectionConfig']=None, drift_detection_config: Optional['gca_model_monitoring._Drif...
76b95b92c1d3b87c72d754d8c02b1bca652b9a27
<|skeleton|> class _ObjectiveConfig: def __init__(self, skew_detection_config: Optional['gca_model_monitoring._SkewDetectionConfig']=None, drift_detection_config: Optional['gca_model_monitoring._DriftDetectionConfig']=None, explanation_config: Optional['gca_model_monitoring._ExplanationConfig']=None): """B...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _ObjectiveConfig: def __init__(self, skew_detection_config: Optional['gca_model_monitoring._SkewDetectionConfig']=None, drift_detection_config: Optional['gca_model_monitoring._DriftDetectionConfig']=None, explanation_config: Optional['gca_model_monitoring._ExplanationConfig']=None): """Base class for ...
the_stack_v2_python_sparse
google/cloud/aiplatform/model_monitoring/objective.py
googleapis/python-aiplatform
train
418
77e3d562df9d9fcbfa5e8058db904decf2df2dba
[ "for i in self._inOrderGen(self.root):\n if re.match(str(string), i[0].treestr()):\n yield i[1]", "def generate(root):\n if root:\n yield list(generate(root.left))\n yield (root.key.treestr(), root.val, root.height)\n yield list(generate(root.right))\nreturn str(list(generate(sel...
<|body_start_0|> for i in self._inOrderGen(self.root): if re.match(str(string), i[0].treestr()): yield i[1] <|end_body_0|> <|body_start_1|> def generate(root): if root: yield list(generate(root.left)) yield (root.key.treestr(), roo...
Attribute_Date_AVL
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Attribute_Date_AVL: def simsearch(self, string): """Simple similarity search for Date tree Time complexity: O(n)""" <|body_0|> def treestr(self): """Returns string of nested lists(with custom Date treestr) that can be used to build the tree""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_032730
9,078
no_license
[ { "docstring": "Simple similarity search for Date tree Time complexity: O(n)", "name": "simsearch", "signature": "def simsearch(self, string)" }, { "docstring": "Returns string of nested lists(with custom Date treestr) that can be used to build the tree", "name": "treestr", "signature": ...
3
stack_v2_sparse_classes_30k_train_018480
Implement the Python class `Attribute_Date_AVL` described below. Class description: Implement the Attribute_Date_AVL class. Method signatures and docstrings: - def simsearch(self, string): Simple similarity search for Date tree Time complexity: O(n) - def treestr(self): Returns string of nested lists(with custom Date...
Implement the Python class `Attribute_Date_AVL` described below. Class description: Implement the Attribute_Date_AVL class. Method signatures and docstrings: - def simsearch(self, string): Simple similarity search for Date tree Time complexity: O(n) - def treestr(self): Returns string of nested lists(with custom Date...
ec7d6fc488f7b82c35a073fe3ea374de2aa0b16a
<|skeleton|> class Attribute_Date_AVL: def simsearch(self, string): """Simple similarity search for Date tree Time complexity: O(n)""" <|body_0|> def treestr(self): """Returns string of nested lists(with custom Date treestr) that can be used to build the tree""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Attribute_Date_AVL: def simsearch(self, string): """Simple similarity search for Date tree Time complexity: O(n)""" for i in self._inOrderGen(self.root): if re.match(str(string), i[0].treestr()): yield i[1] def treestr(self): """Returns string of nested...
the_stack_v2_python_sparse
CEP Y3/Unit 2.10 Final Project/cds_attributetrees.py
HTY2003/CEP-Stuff
train
0
64bfede34314aee498c898eedce8aac282af522f
[ "print_info('Creating kafka producer')\ntry:\n self.kafka_producer = KafkaProducer(**configs)\nexcept KafkaError as exc:\n print_error('kafka producer - Exception during connecting to broker - {}'.format(exc))", "partition = kwargs.get('partition', None)\nheaders = kwargs.get('headers', None)\ntimestamp = k...
<|body_start_0|> print_info('Creating kafka producer') try: self.kafka_producer = KafkaProducer(**configs) except KafkaError as exc: print_error('kafka producer - Exception during connecting to broker - {}'.format(exc)) <|end_body_0|> <|body_start_1|> partition =...
This class contains all kafka producer methods
WarriorKafkaProducer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WarriorKafkaProducer: """This class contains all kafka producer methods""" def __init__(self, **configs): """Create kafka producer object""" <|body_0|> def send_messages(self, topic, value=None, **kwargs): """Publish messages to the desired topic Arguments: topic...
stack_v2_sparse_classes_36k_train_032731
11,178
permissive
[ { "docstring": "Create kafka producer object", "name": "__init__", "signature": "def __init__(self, **configs)" }, { "docstring": "Publish messages to the desired topic Arguments: topic(str): topic name to publish messages partition(int): partition nubmer key(str): key name value(str): message t...
2
null
Implement the Python class `WarriorKafkaProducer` described below. Class description: This class contains all kafka producer methods Method signatures and docstrings: - def __init__(self, **configs): Create kafka producer object - def send_messages(self, topic, value=None, **kwargs): Publish messages to the desired t...
Implement the Python class `WarriorKafkaProducer` described below. Class description: This class contains all kafka producer methods Method signatures and docstrings: - def __init__(self, **configs): Create kafka producer object - def send_messages(self, topic, value=None, **kwargs): Publish messages to the desired t...
685761cf044182ec88ce86a942d4be1e150a1256
<|skeleton|> class WarriorKafkaProducer: """This class contains all kafka producer methods""" def __init__(self, **configs): """Create kafka producer object""" <|body_0|> def send_messages(self, topic, value=None, **kwargs): """Publish messages to the desired topic Arguments: topic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WarriorKafkaProducer: """This class contains all kafka producer methods""" def __init__(self, **configs): """Create kafka producer object""" print_info('Creating kafka producer') try: self.kafka_producer = KafkaProducer(**configs) except KafkaError as exc: ...
the_stack_v2_python_sparse
warrior/Framework/ClassUtils/kafka_utils_class.py
warriorframework/warriorframework
train
25
f5d80cc6a801e905af28630f91ba6ad41eb5e76c
[ "if not self.rig.node().hasAttr('shapeInfo'):\n self.rig.node().addAttr('shapeInfo', dt='string')\n self.rig.node().shapeInfo.set('{}')\nif not self.rig.built_successfully():\n return\ndata_sets = list()\nfor node in self.rig.control_org().getChildren(ad=True, type='transform'):\n if node.name().startsw...
<|body_start_0|> if not self.rig.node().hasAttr('shapeInfo'): self.rig.node().addAttr('shapeInfo', dt='string') self.rig.node().shapeInfo.set('{}') if not self.rig.built_successfully(): return data_sets = list() for node in self.rig.control_org().getCh...
This is an example only plugin showing what a process plugin might be used for. In this case, we're going to snapshot all the NurbsCurve shape nodes within the rig and store that information in a string attribute allowing us to re-apply the sames post build. This mechanism allows a rigger to make control shape adjustme...
ShapeStoreProcess
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShapeStoreProcess: """This is an example only plugin showing what a process plugin might be used for. In this case, we're going to snapshot all the NurbsCurve shape nodes within the rig and store that information in a string attribute allowing us to re-apply the sames post build. This mechanism a...
stack_v2_sparse_classes_36k_train_032732
5,865
permissive
[ { "docstring": "This is called before the control rig is destroyed, so we will store all the control information here. :return:", "name": "snapshot", "signature": "def snapshot(self)" }, { "docstring": "This is called after the entire rig has been built, so we will attempt to re-apply the shape ...
2
stack_v2_sparse_classes_30k_train_020835
Implement the Python class `ShapeStoreProcess` described below. Class description: This is an example only plugin showing what a process plugin might be used for. In this case, we're going to snapshot all the NurbsCurve shape nodes within the rig and store that information in a string attribute allowing us to re-apply...
Implement the Python class `ShapeStoreProcess` described below. Class description: This is an example only plugin showing what a process plugin might be used for. In this case, we're going to snapshot all the NurbsCurve shape nodes within the rig and store that information in a string attribute allowing us to re-apply...
5b034fc76150dcc613e69d08d0d807c5461c265b
<|skeleton|> class ShapeStoreProcess: """This is an example only plugin showing what a process plugin might be used for. In this case, we're going to snapshot all the NurbsCurve shape nodes within the rig and store that information in a string attribute allowing us to re-apply the sames post build. This mechanism a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShapeStoreProcess: """This is an example only plugin showing what a process plugin might be used for. In this case, we're going to snapshot all the NurbsCurve shape nodes within the rig and store that information in a string attribute allowing us to re-apply the sames post build. This mechanism allows a rigge...
the_stack_v2_python_sparse
crab/plugins/processes/shapes.py
mikemalinowski/crab
train
25
19b68af59ed76a5ab7098f5499dada678b3c939c
[ "size = len(nums)\nif size == 0:\n return 0\nreturn self.__helper(nums, k + 1) - self.__helper(nums, k)", "size = len(nums)\nif size == 0:\n return 0\nl = 0\nr = size\nwhile l < r:\n mid = l + (r - l) // 2\n if nums[mid] >= k:\n r = mid\n else:\n assert nums[mid] < k\n l = mid ...
<|body_start_0|> size = len(nums) if size == 0: return 0 return self.__helper(nums, k + 1) - self.__helper(nums, k) <|end_body_0|> <|body_start_1|> size = len(nums) if size == 0: return 0 l = 0 r = size while l < r: mid...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getNumberOfK(self, nums, k): """:type nums: list[int] :type k: int :rtype: int""" <|body_0|> def __helper(self, nums, k): """返回大于等于 k 的第一个数的索引 :param nums: :param k: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> size = len(n...
stack_v2_sparse_classes_36k_train_032733
1,431
no_license
[ { "docstring": ":type nums: list[int] :type k: int :rtype: int", "name": "getNumberOfK", "signature": "def getNumberOfK(self, nums, k)" }, { "docstring": "返回大于等于 k 的第一个数的索引 :param nums: :param k: :return:", "name": "__helper", "signature": "def __helper(self, nums, k)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getNumberOfK(self, nums, k): :type nums: list[int] :type k: int :rtype: int - def __helper(self, nums, k): 返回大于等于 k 的第一个数的索引 :param nums: :param k: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getNumberOfK(self, nums, k): :type nums: list[int] :type k: int :rtype: int - def __helper(self, nums, k): 返回大于等于 k 的第一个数的索引 :param nums: :param k: :return: <|skeleton|> cla...
4c57462cbaa365b07341bb6ed20d21a4f0389f33
<|skeleton|> class Solution: def getNumberOfK(self, nums, k): """:type nums: list[int] :type k: int :rtype: int""" <|body_0|> def __helper(self, nums, k): """返回大于等于 k 的第一个数的索引 :param nums: :param k: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getNumberOfK(self, nums, k): """:type nums: list[int] :type k: int :rtype: int""" size = len(nums) if size == 0: return 0 return self.__helper(nums, k + 1) - self.__helper(nums, k) def __helper(self, nums, k): """返回大于等于 k 的第一个数的索引 :param n...
the_stack_v2_python_sparse
codes/python/56-数字在排序数组中出现的次数(解法2).py
lxyxl0216/sword-for-offer-solution
train
0
04a2d68b4ba3b006910f369f3bd9dcad443e68b9
[ "process = state[:state.rfind('_')]\nif process in cls.processes:\n return process\nreturn ''", "if state[:state.rfind('_')] in cls.processes or state == 'idle':\n return True\nreturn False", "object_methods = [method_name for method_name in dir(obj) if callable(getattr(obj, method_name))]\ncategories = [...
<|body_start_0|> process = state[:state.rfind('_')] if process in cls.processes: return process return '' <|end_body_0|> <|body_start_1|> if state[:state.rfind('_')] in cls.processes or state == 'idle': return True return False <|end_body_1|> <|body_star...
Configuration for robot state machine to handle SAP EWM warehouse orders.
RobotEWMConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RobotEWMConfig: """Configuration for robot state machine to handle SAP EWM warehouse orders.""" def get_process_type(cls, state: str) -> str: """Get process type for the state.""" <|body_0|> def is_new_work_state(cls, state: str) -> bool: """Identify if request f...
stack_v2_sparse_classes_36k_train_032734
15,806
permissive
[ { "docstring": "Get process type for the state.", "name": "get_process_type", "signature": "def get_process_type(cls, state: str) -> str" }, { "docstring": "Identify if request for work has to be created with requestnewwho parameter set.", "name": "is_new_work_state", "signature": "def i...
3
stack_v2_sparse_classes_30k_train_020678
Implement the Python class `RobotEWMConfig` described below. Class description: Configuration for robot state machine to handle SAP EWM warehouse orders. Method signatures and docstrings: - def get_process_type(cls, state: str) -> str: Get process type for the state. - def is_new_work_state(cls, state: str) -> bool: ...
Implement the Python class `RobotEWMConfig` described below. Class description: Configuration for robot state machine to handle SAP EWM warehouse orders. Method signatures and docstrings: - def get_process_type(cls, state: str) -> str: Get process type for the state. - def is_new_work_state(cls, state: str) -> bool: ...
80be05b5bc81a5e3ffd89279e2f49023bd71b478
<|skeleton|> class RobotEWMConfig: """Configuration for robot state machine to handle SAP EWM warehouse orders.""" def get_process_type(cls, state: str) -> str: """Get process type for the state.""" <|body_0|> def is_new_work_state(cls, state: str) -> bool: """Identify if request f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RobotEWMConfig: """Configuration for robot state machine to handle SAP EWM warehouse orders.""" def get_process_type(cls, state: str) -> str: """Get process type for the state.""" process = state[:state.rfind('_')] if process in cls.processes: return process re...
the_stack_v2_python_sparse
python-modules/robcoewmtypes/robcoewmtypes/statemachine_config.py
SAP/ewm-cloud-robotics
train
29
3e8201cad357ce1b1cb72cc9c60be3fef88fa4f2
[ "if self.config is not None:\n cfg = self.config\n for key in LARGE_ARTEFACTS:\n if key in cfg and hasattr(self._nested_detector, key):\n cfg[key] = getattr(self._nested_detector, key)\n preprocess_at_init = getattr(self._nested_detector, 'preprocess_at_init', True)\n cfg['x_ref_prepro...
<|body_start_0|> if self.config is not None: cfg = self.config for key in LARGE_ARTEFACTS: if key in cfg and hasattr(self._nested_detector, key): cfg[key] = getattr(self._nested_detector, key) preprocess_at_init = getattr(self._nested_detec...
A mixin class containing methods related to a drift detector's configuration dictionary.
DriftConfigMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DriftConfigMixin: """A mixin class containing methods related to a drift detector's configuration dictionary.""" def get_config(self) -> dict: """Get the detector's configuration dictionary. Returns ------- The detector's configuration dictionary.""" <|body_0|> def from_...
stack_v2_sparse_classes_36k_train_032735
8,321
permissive
[ { "docstring": "Get the detector's configuration dictionary. Returns ------- The detector's configuration dictionary.", "name": "get_config", "signature": "def get_config(self) -> dict" }, { "docstring": "Instantiate a drift detector from a fully resolved (and validated) config dictionary. Param...
4
stack_v2_sparse_classes_30k_train_014960
Implement the Python class `DriftConfigMixin` described below. Class description: A mixin class containing methods related to a drift detector's configuration dictionary. Method signatures and docstrings: - def get_config(self) -> dict: Get the detector's configuration dictionary. Returns ------- The detector's confi...
Implement the Python class `DriftConfigMixin` described below. Class description: A mixin class containing methods related to a drift detector's configuration dictionary. Method signatures and docstrings: - def get_config(self) -> dict: Get the detector's configuration dictionary. Returns ------- The detector's confi...
4a1b4f74a8590117965421e86c2295bff0f33e89
<|skeleton|> class DriftConfigMixin: """A mixin class containing methods related to a drift detector's configuration dictionary.""" def get_config(self) -> dict: """Get the detector's configuration dictionary. Returns ------- The detector's configuration dictionary.""" <|body_0|> def from_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DriftConfigMixin: """A mixin class containing methods related to a drift detector's configuration dictionary.""" def get_config(self) -> dict: """Get the detector's configuration dictionary. Returns ------- The detector's configuration dictionary.""" if self.config is not None: ...
the_stack_v2_python_sparse
alibi_detect/base.py
SeldonIO/alibi-detect
train
1,922
db12ec198b267c4877cd03b3ec3b3659c70de6c0
[ "super(AlmostAllFeatureExtractor, self).__init__(src_paths, dst_dir)\nlogger = logging.getLogger('AlmostAllFeatureExtractor')\nlogger.setLevel(logging.DEBUG)\nlogging.basicConfig()\nself.logger = logger\npass", "self.logger.info('extract starts')\nst = time.time()\nself._delete_old_data()\nuser_log_paths = glob.g...
<|body_start_0|> super(AlmostAllFeatureExtractor, self).__init__(src_paths, dst_dir) logger = logging.getLogger('AlmostAllFeatureExtractor') logger.setLevel(logging.DEBUG) logging.basicConfig() self.logger = logger pass <|end_body_0|> <|body_start_1|> self.logger...
Almost All Feature Extractor Feature Extractor extracts labeled feature from the validated json log with the following format. --- y_1,x_01,x_02,...,x_0d y_2,x_11,x_12,...,x_1d ... y_n,x_n1,x_n2,...,x_nd --- features are ordered in 1. applaunch features - MFU ranking with dimension of K which is the number of applicati...
AlmostAllFeatureExtractor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlmostAllFeatureExtractor: """Almost All Feature Extractor Feature Extractor extracts labeled feature from the validated json log with the following format. --- y_1,x_01,x_02,...,x_0d y_2,x_11,x_12,...,x_1d ... y_n,x_n1,x_n2,...,x_nd --- features are ordered in 1. applaunch features - MFU ranking...
stack_v2_sparse_classes_36k_train_032736
26,322
no_license
[ { "docstring": "Arguments: - `src_paths`: source paths in which logs of a user are assembled to one file. - `dst_dir`: distination directory", "name": "__init__", "signature": "def __init__(self, src_paths=BasicFeatureExtractor.src_paths, dst_dir=dst_dir)" }, { "docstring": "extract feature from...
3
null
Implement the Python class `AlmostAllFeatureExtractor` described below. Class description: Almost All Feature Extractor Feature Extractor extracts labeled feature from the validated json log with the following format. --- y_1,x_01,x_02,...,x_0d y_2,x_11,x_12,...,x_1d ... y_n,x_n1,x_n2,...,x_nd --- features are ordered...
Implement the Python class `AlmostAllFeatureExtractor` described below. Class description: Almost All Feature Extractor Feature Extractor extracts labeled feature from the validated json log with the following format. --- y_1,x_01,x_02,...,x_0d y_2,x_11,x_12,...,x_1d ... y_n,x_n1,x_n2,...,x_nd --- features are ordered...
e3268f0f7ff4f5a4a68931e28c483184bbf8e926
<|skeleton|> class AlmostAllFeatureExtractor: """Almost All Feature Extractor Feature Extractor extracts labeled feature from the validated json log with the following format. --- y_1,x_01,x_02,...,x_0d y_2,x_11,x_12,...,x_1d ... y_n,x_n1,x_n2,...,x_nd --- features are ordered in 1. applaunch features - MFU ranking...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlmostAllFeatureExtractor: """Almost All Feature Extractor Feature Extractor extracts labeled feature from the validated json log with the following format. --- y_1,x_01,x_02,...,x_0d y_2,x_11,x_12,...,x_1d ... y_n,x_n1,x_n2,...,x_nd --- features are ordered in 1. applaunch features - MFU ranking with dimensi...
the_stack_v2_python_sparse
external_attachements/src/data_management/extractor/almost_all_feature_extractor.py
khalilhajji/discovering_user_habbits_from_smartphone_logs
train
0
c8c853392ee573013a8b6c0d0da6c010fde2b69b
[ "if 'git_uri' not in self.user_params:\n raise ValueError(f'{self.__class__.__name__} instance has no source (no git_uri in user params)')\nreturn source.GitSource(provider='git', uri=self.user_params['git_uri'], provider_params={'git_commit': self.user_params.get('git_ref'), 'git_commit_depth': self.user_params...
<|body_start_0|> if 'git_uri' not in self.user_params: raise ValueError(f'{self.__class__.__name__} instance has no source (no git_uri in user params)') return source.GitSource(provider='git', uri=self.user_params['git_uri'], provider_params={'git_commit': self.user_params.get('git_ref'), 'g...
Task parameters (coming from CLI arguments).
TaskParams
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskParams: """Task parameters (coming from CLI arguments).""" def source(self) -> source.Source: """Source for the input files the task will operate on (e.g. a git repo).""" <|body_0|> def from_cli_args(cls, args: dict): """Create a TaskParams instance from CLI ...
stack_v2_sparse_classes_36k_train_032737
4,580
permissive
[ { "docstring": "Source for the input files the task will operate on (e.g. a git repo).", "name": "source", "signature": "def source(self) -> source.Source" }, { "docstring": "Create a TaskParams instance from CLI arguments.", "name": "from_cli_args", "signature": "def from_cli_args(cls, ...
2
stack_v2_sparse_classes_30k_train_019360
Implement the Python class `TaskParams` described below. Class description: Task parameters (coming from CLI arguments). Method signatures and docstrings: - def source(self) -> source.Source: Source for the input files the task will operate on (e.g. a git repo). - def from_cli_args(cls, args: dict): Create a TaskPara...
Implement the Python class `TaskParams` described below. Class description: Task parameters (coming from CLI arguments). Method signatures and docstrings: - def source(self) -> source.Source: Source for the input files the task will operate on (e.g. a git repo). - def from_cli_args(cls, args: dict): Create a TaskPara...
0ed6e07d848db7090332a18ef8ace3585dd314ac
<|skeleton|> class TaskParams: """Task parameters (coming from CLI arguments).""" def source(self) -> source.Source: """Source for the input files the task will operate on (e.g. a git repo).""" <|body_0|> def from_cli_args(cls, args: dict): """Create a TaskParams instance from CLI ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskParams: """Task parameters (coming from CLI arguments).""" def source(self) -> source.Source: """Source for the input files the task will operate on (e.g. a git repo).""" if 'git_uri' not in self.user_params: raise ValueError(f'{self.__class__.__name__} instance has no sou...
the_stack_v2_python_sparse
atomic_reactor/tasks/common.py
fr34k8/atomic-reactor
train
1
23721ffe77c1012c5535614b99606f88b78dbb7d
[ "assert False, logger.error('Joint generator not functional')\nself.config = config\nself.is_sub_model = is_sub_model\nself.step = 0\nself.stage = stage\nself.train = self.stage == 'train'\nself.teacher_forcing = teacher_forcing\nself.word_embedding = word_embedding\nassert self.stage in ['train', 'test', 'val', 'i...
<|body_start_0|> assert False, logger.error('Joint generator not functional') self.config = config self.is_sub_model = is_sub_model self.step = 0 self.stage = stage self.train = self.stage == 'train' self.teacher_forcing = teacher_forcing self.word_embeddi...
@NOT FUNCTIONAL! @brief: The conditional generator. In the first edition, let's assume the image embedding vector is conditioned to generate the text, and the text vector is conditioned to generate the image (we have more options though) @components: def __init__ def build_models
joint_generator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class joint_generator: """@NOT FUNCTIONAL! @brief: The conditional generator. In the first edition, let's assume the image embedding vector is conditioned to generate the text, and the text vector is conditioned to generate the image (we have more options though) @components: def __init__ def build_mod...
stack_v2_sparse_classes_36k_train_032738
15,550
no_license
[ { "docstring": "@brief: The initialization of the model. we use a config file to store the information of configuration", "name": "__init__", "signature": "def __init__(self, config, stage='train', is_sub_model=True, teacher_forcing=True, word_embedding=None)" }, { "docstring": "@brief: build th...
2
stack_v2_sparse_classes_30k_train_005801
Implement the Python class `joint_generator` described below. Class description: @NOT FUNCTIONAL! @brief: The conditional generator. In the first edition, let's assume the image embedding vector is conditioned to generate the text, and the text vector is conditioned to generate the image (we have more options though) ...
Implement the Python class `joint_generator` described below. Class description: @NOT FUNCTIONAL! @brief: The conditional generator. In the first edition, let's assume the image embedding vector is conditioned to generate the text, and the text vector is conditioned to generate the image (we have more options though) ...
71bf42b89308b56113c12096d2280c02abad9e84
<|skeleton|> class joint_generator: """@NOT FUNCTIONAL! @brief: The conditional generator. In the first edition, let's assume the image embedding vector is conditioned to generate the text, and the text vector is conditioned to generate the image (we have more options though) @components: def __init__ def build_mod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class joint_generator: """@NOT FUNCTIONAL! @brief: The conditional generator. In the first edition, let's assume the image embedding vector is conditioned to generate the text, and the text vector is conditioned to generate the image (we have more options though) @components: def __init__ def build_models""" d...
the_stack_v2_python_sparse
model/network.py
WilsonWangTHU/gan_playground
train
0
1ff5cf19221fcaf3017c0cc3f48325da8afe2ce5
[ "args = entity_parser.parse_args()\npage = args['page']\nper_page = args['per_page']\nsort_order = args['order']\nif per_page > 100:\n per_page = 100\ndescending = sort_order == 'desc'\nstart = per_page * (page - 1)\nstop = start + per_page\nkwargs = {'start': start, 'stop': stop, 'descending': descending, 'sess...
<|body_start_0|> args = entity_parser.parse_args() page = args['page'] per_page = args['per_page'] sort_order = args['order'] if per_page > 100: per_page = 100 descending = sort_order == 'desc' start = per_page * (page - 1) stop = start + per_p...
SeriesSeasonsAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SeriesSeasonsAPI: def get(self, show_id, session): """Get seasons by show ID""" <|body_0|> def delete(self, show_id, session): """Deletes all seasons of a show""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = entity_parser.parse_args() ...
stack_v2_sparse_classes_36k_train_032739
47,001
permissive
[ { "docstring": "Get seasons by show ID", "name": "get", "signature": "def get(self, show_id, session)" }, { "docstring": "Deletes all seasons of a show", "name": "delete", "signature": "def delete(self, show_id, session)" } ]
2
stack_v2_sparse_classes_30k_train_017671
Implement the Python class `SeriesSeasonsAPI` described below. Class description: Implement the SeriesSeasonsAPI class. Method signatures and docstrings: - def get(self, show_id, session): Get seasons by show ID - def delete(self, show_id, session): Deletes all seasons of a show
Implement the Python class `SeriesSeasonsAPI` described below. Class description: Implement the SeriesSeasonsAPI class. Method signatures and docstrings: - def get(self, show_id, session): Get seasons by show ID - def delete(self, show_id, session): Deletes all seasons of a show <|skeleton|> class SeriesSeasonsAPI: ...
ea95ff60041beaea9aacbc2d93549e3a6b981dc5
<|skeleton|> class SeriesSeasonsAPI: def get(self, show_id, session): """Get seasons by show ID""" <|body_0|> def delete(self, show_id, session): """Deletes all seasons of a show""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SeriesSeasonsAPI: def get(self, show_id, session): """Get seasons by show ID""" args = entity_parser.parse_args() page = args['page'] per_page = args['per_page'] sort_order = args['order'] if per_page > 100: per_page = 100 descending = sort_o...
the_stack_v2_python_sparse
flexget/components/series/api.py
BrutuZ/Flexget
train
1
70ff702a6c0d7164c49ff4deff2e6722f477ebf2
[ "loss_input = self._user_power_curve_input()\nif not loss_input:\n return\nwind_resource, weights = self.wind_resource_from_input()\npower_curve = self.input_power_curve\nif (wind_resource <= power_curve.cutin_wind_speed).all():\n msg = 'All wind speeds for site {} are below the wind speed cutin ({} m/s). No ...
<|body_start_0|> loss_input = self._user_power_curve_input() if not loss_input: return wind_resource, weights = self.wind_resource_from_input() power_curve = self.input_power_curve if (wind_resource <= power_curve.cutin_wind_speed).all(): msg = 'All wind s...
Mixin class for :class:`reV.SAM.generation.AbstractSamWind`. Warnings -------- Using this class for anything except as a mixin for :class:`~reV.SAM.generation.AbstractSamWind` may result in unexpected results and/or errors.
PowerCurveLossesMixin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PowerCurveLossesMixin: """Mixin class for :class:`reV.SAM.generation.AbstractSamWind`. Warnings -------- Using this class for anything except as a mixin for :class:`~reV.SAM.generation.AbstractSamWind` may result in unexpected results and/or errors.""" def add_power_curve_losses(self): ...
stack_v2_sparse_classes_36k_train_032740
40,707
permissive
[ { "docstring": "Adjust power curve in SAM config file to account for losses. This function reads the information in the ``reV_power_curve_losses`` key of the ``sam_sys_inputs`` dictionary and computes a new power curve that accounts for the loss percentage specified from that input. If no power curve loss info ...
6
null
Implement the Python class `PowerCurveLossesMixin` described below. Class description: Mixin class for :class:`reV.SAM.generation.AbstractSamWind`. Warnings -------- Using this class for anything except as a mixin for :class:`~reV.SAM.generation.AbstractSamWind` may result in unexpected results and/or errors. Method ...
Implement the Python class `PowerCurveLossesMixin` described below. Class description: Mixin class for :class:`reV.SAM.generation.AbstractSamWind`. Warnings -------- Using this class for anything except as a mixin for :class:`~reV.SAM.generation.AbstractSamWind` may result in unexpected results and/or errors. Method ...
497bb7d172197e09a9e14b1b1ca891b8c828b80a
<|skeleton|> class PowerCurveLossesMixin: """Mixin class for :class:`reV.SAM.generation.AbstractSamWind`. Warnings -------- Using this class for anything except as a mixin for :class:`~reV.SAM.generation.AbstractSamWind` may result in unexpected results and/or errors.""" def add_power_curve_losses(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PowerCurveLossesMixin: """Mixin class for :class:`reV.SAM.generation.AbstractSamWind`. Warnings -------- Using this class for anything except as a mixin for :class:`~reV.SAM.generation.AbstractSamWind` may result in unexpected results and/or errors.""" def add_power_curve_losses(self): """Adjust ...
the_stack_v2_python_sparse
reV/losses/power_curve.py
NREL/reV
train
53
5cef97412c72d1c86070c90020e5b4a598009787
[ "fast = slow = head\nwhile fast and fast.next:\n fast = fast.next.next\n slow = slow.next\n if fast == slow:\n slow = head\n while slow != fast:\n slow = slow.next\n fast = fast.next\n return slow\nreturn None", "slow = head\nfast = head.next\nwhile fast and fas...
<|body_start_0|> fast = slow = head while fast and fast.next: fast = fast.next.next slow = slow.next if fast == slow: slow = head while slow != fast: slow = slow.next fast = fast.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def detectCycle(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def detectCycle_v2(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> fast = slow = head while f...
stack_v2_sparse_classes_36k_train_032741
2,800
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "detectCycle", "signature": "def detectCycle(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "detectCycle_v2", "signature": "def detectCycle_v2(self, head)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def detectCycle(self, head): :type head: ListNode :rtype: ListNode - def detectCycle_v2(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def detectCycle(self, head): :type head: ListNode :rtype: ListNode - def detectCycle_v2(self, head): :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: def ...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def detectCycle(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def detectCycle_v2(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def detectCycle(self, head): """:type head: ListNode :rtype: ListNode""" fast = slow = head while fast and fast.next: fast = fast.next.next slow = slow.next if fast == slow: slow = head while slow != fast: ...
the_stack_v2_python_sparse
src/lt_142.py
oxhead/CodingYourWay
train
0
a562f0fd7ff8c80c17e6b9c408c4d19cfc868a2f
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('raykatz_nedg_gaudiosi', 'raykatz_nedg_gaudiosi')\nurl = 'https://data.cityofboston.gov/resource/crime.json'\nresponse = urllib.request.urlopen(url).read().decode('utf-8')\nresult = json.loads(response)\n...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('raykatz_nedg_gaudiosi', 'raykatz_nedg_gaudiosi') url = 'https://data.cityofboston.gov/resource/crime.json' response = urllib.request.urlopen(url)....
crime
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class crime: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happeni...
stack_v2_sparse_classes_36k_train_032742
4,605
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
null
Implement the Python class `crime` described below. Class description: Implement the crime 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, endTime=None): Cr...
Implement the Python class `crime` described below. Class description: Implement the crime 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, endTime=None): Cr...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class crime: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happeni...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class crime: 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('raykatz_nedg_gaudiosi', 'raykatz_nedg_gaudios...
the_stack_v2_python_sparse
raykatz_nedg_gaudiosi/crime.py
ROODAY/course-2017-fal-proj
train
3
4eebcdbd096b1a340fe95da36da02a835cef770a
[ "stream_data = dict(get_data(stream))\nsheet = list(stream_data.keys())[0] if len(stream_data) == 1 else None\nif sheet is None or sheet != 'Data':\n raise ParseError('XLS parse error - spreadsheet should contain one sheet named `Data`')\nstream_data = stream_data[sheet]\nheaders = stream_data[0]\ndata = []\ntry...
<|body_start_0|> stream_data = dict(get_data(stream)) sheet = list(stream_data.keys())[0] if len(stream_data) == 1 else None if sheet is None or sheet != 'Data': raise ParseError('XLS parse error - spreadsheet should contain one sheet named `Data`') stream_data = stream_data[...
XLSParser
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XLSParser: def parse(self, stream, media_type=None, parser_context=None): """Parses the incoming bytestream as XLS and return resulting data""" <|body_0|> def _json_loads(self, val): """Attempt to load the value as json""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_032743
3,110
permissive
[ { "docstring": "Parses the incoming bytestream as XLS and return resulting data", "name": "parse", "signature": "def parse(self, stream, media_type=None, parser_context=None)" }, { "docstring": "Attempt to load the value as json", "name": "_json_loads", "signature": "def _json_loads(self...
2
null
Implement the Python class `XLSParser` described below. Class description: Implement the XLSParser class. Method signatures and docstrings: - def parse(self, stream, media_type=None, parser_context=None): Parses the incoming bytestream as XLS and return resulting data - def _json_loads(self, val): Attempt to load the...
Implement the Python class `XLSParser` described below. Class description: Implement the XLSParser class. Method signatures and docstrings: - def parse(self, stream, media_type=None, parser_context=None): Parses the incoming bytestream as XLS and return resulting data - def _json_loads(self, val): Attempt to load the...
85102bb41aa0d558a3fa088e4fd6f51613599ad0
<|skeleton|> class XLSParser: def parse(self, stream, media_type=None, parser_context=None): """Parses the incoming bytestream as XLS and return resulting data""" <|body_0|> def _json_loads(self, val): """Attempt to load the value as json""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XLSParser: def parse(self, stream, media_type=None, parser_context=None): """Parses the incoming bytestream as XLS and return resulting data""" stream_data = dict(get_data(stream)) sheet = list(stream_data.keys())[0] if len(stream_data) == 1 else None if sheet is None or sheet ...
the_stack_v2_python_sparse
orchestrator/core/orc_server/backup/utils/xls.py
g2-inc/openc2-oif-orchestrator
train
1
7340da8e9ddd2ab4fcb9b8103c88967cab920cda
[ "if self.disk_template in constants.DTS_INT_MIRROR:\n return 2\nelse:\n return 1", "for d in self.disks:\n d[constants.IDISK_TYPE] = self.disk_template\ndisk_space = gmi.ComputeDiskSize(self.disks)\nreturn {'name': self.name, 'disk_template': self.disk_template, 'group_name': self.group_name, 'tags': sel...
<|body_start_0|> if self.disk_template in constants.DTS_INT_MIRROR: return 2 else: return 1 <|end_body_0|> <|body_start_1|> for d in self.disks: d[constants.IDISK_TYPE] = self.disk_template disk_space = gmi.ComputeDiskSize(self.disks) return {...
An instance allocation request.
IAReqInstanceAlloc
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IAReqInstanceAlloc: """An instance allocation request.""" def RequiredNodes(self): """Calculates the required nodes based on the disk_template.""" <|body_0|> def GetRequest(self, cfg): """Requests a new instance. The checks for the completeness of the opcode must...
stack_v2_sparse_classes_36k_train_032744
29,971
permissive
[ { "docstring": "Calculates the required nodes based on the disk_template.", "name": "RequiredNodes", "signature": "def RequiredNodes(self)" }, { "docstring": "Requests a new instance. The checks for the completeness of the opcode must have already been done.", "name": "GetRequest", "sign...
3
stack_v2_sparse_classes_30k_train_014576
Implement the Python class `IAReqInstanceAlloc` described below. Class description: An instance allocation request. Method signatures and docstrings: - def RequiredNodes(self): Calculates the required nodes based on the disk_template. - def GetRequest(self, cfg): Requests a new instance. The checks for the completene...
Implement the Python class `IAReqInstanceAlloc` described below. Class description: An instance allocation request. Method signatures and docstrings: - def RequiredNodes(self): Calculates the required nodes based on the disk_template. - def GetRequest(self, cfg): Requests a new instance. The checks for the completene...
456ea285a7583183c2c8e5bcffe9006ec8a9d658
<|skeleton|> class IAReqInstanceAlloc: """An instance allocation request.""" def RequiredNodes(self): """Calculates the required nodes based on the disk_template.""" <|body_0|> def GetRequest(self, cfg): """Requests a new instance. The checks for the completeness of the opcode must...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IAReqInstanceAlloc: """An instance allocation request.""" def RequiredNodes(self): """Calculates the required nodes based on the disk_template.""" if self.disk_template in constants.DTS_INT_MIRROR: return 2 else: return 1 def GetRequest(self, cfg): ...
the_stack_v2_python_sparse
lib/masterd/iallocator.py
ganeti/ganeti
train
465
788b4e5e41538470f9af98cb2da9c30eab75a6cc
[ "self.scraper_class = scraper_class\nself.output_errors_only = output_errors_only\nif checks:\n self.checks = checks\nelse:\n self.checks = (CheckBaseURL,)", "errors = 0\nfor check_class in self.checks:\n if check_class(self.scraper_class).run_check():\n errors += 1" ]
<|body_start_0|> self.scraper_class = scraper_class self.output_errors_only = output_errors_only if checks: self.checks = checks else: self.checks = (CheckBaseURL,) <|end_body_0|> <|body_start_1|> errors = 0 for check_class in self.checks: ...
ScraperChecker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScraperChecker: def __init__(self, scraper_class, checks=None, output_errors_only=True): """A class for checking the quality of a Scraper Class. :param output_errors_only: (optional) Boolean. :param scraper_class: A :class:`ScraperBase` subclass.""" <|body_0|> def run_checks...
stack_v2_sparse_classes_36k_train_032745
1,650
permissive
[ { "docstring": "A class for checking the quality of a Scraper Class. :param output_errors_only: (optional) Boolean. :param scraper_class: A :class:`ScraperBase` subclass.", "name": "__init__", "signature": "def __init__(self, scraper_class, checks=None, output_errors_only=True)" }, { "docstring"...
2
stack_v2_sparse_classes_30k_train_017974
Implement the Python class `ScraperChecker` described below. Class description: Implement the ScraperChecker class. Method signatures and docstrings: - def __init__(self, scraper_class, checks=None, output_errors_only=True): A class for checking the quality of a Scraper Class. :param output_errors_only: (optional) Bo...
Implement the Python class `ScraperChecker` described below. Class description: Implement the ScraperChecker class. Method signatures and docstrings: - def __init__(self, scraper_class, checks=None, output_errors_only=True): A class for checking the quality of a Scraper Class. :param output_errors_only: (optional) Bo...
13d9c9d11cf4fc3afc4ae52ac439ee4fec926ba3
<|skeleton|> class ScraperChecker: def __init__(self, scraper_class, checks=None, output_errors_only=True): """A class for checking the quality of a Scraper Class. :param output_errors_only: (optional) Boolean. :param scraper_class: A :class:`ScraperBase` subclass.""" <|body_0|> def run_checks...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScraperChecker: def __init__(self, scraper_class, checks=None, output_errors_only=True): """A class for checking the quality of a Scraper Class. :param output_errors_only: (optional) Boolean. :param scraper_class: A :class:`ScraperBase` subclass.""" self.scraper_class = scraper_class s...
the_stack_v2_python_sparse
lgsf/scrapers/checks.py
DemocracyClub/LGSF
train
4
cdf48beee0cf678ba991e5d51490a58e1dc3767e
[ "self.root = root\nself._id = ''\nself.name = ''\nself.slide_details = ''\nself.lesson = Lesson(self._id, self.name)\nself.slides = []\nself.build()", "slides = self.slide_details.get()\nself.lesson._id = self._id.get()\nself.lesson.name = self.name.get()\nself.lesson.published = published\nfor slide in slides:\n...
<|body_start_0|> self.root = root self._id = '' self.name = '' self.slide_details = '' self.lesson = Lesson(self._id, self.name) self.slides = [] self.build() <|end_body_0|> <|body_start_1|> slides = self.slide_details.get() self.lesson._id = self...
This class is responsible for providing a GUI through which a user can create a lesson.
LessonCreate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LessonCreate: """This class is responsible for providing a GUI through which a user can create a lesson.""" def __init__(self, root): """Construct create lesson window. @param {tkinter object} root @return {void}""" <|body_0|> def save(self, published=False): """...
stack_v2_sparse_classes_36k_train_032746
3,308
no_license
[ { "docstring": "Construct create lesson window. @param {tkinter object} root @return {void}", "name": "__init__", "signature": "def __init__(self, root)" }, { "docstring": "Save the lesson object to the lesson store once populated with the users data. @return {void}", "name": "save", "si...
3
stack_v2_sparse_classes_30k_train_008926
Implement the Python class `LessonCreate` described below. Class description: This class is responsible for providing a GUI through which a user can create a lesson. Method signatures and docstrings: - def __init__(self, root): Construct create lesson window. @param {tkinter object} root @return {void} - def save(sel...
Implement the Python class `LessonCreate` described below. Class description: This class is responsible for providing a GUI through which a user can create a lesson. Method signatures and docstrings: - def __init__(self, root): Construct create lesson window. @param {tkinter object} root @return {void} - def save(sel...
775c2972bc7dad77831321489c0a884bd01c458d
<|skeleton|> class LessonCreate: """This class is responsible for providing a GUI through which a user can create a lesson.""" def __init__(self, root): """Construct create lesson window. @param {tkinter object} root @return {void}""" <|body_0|> def save(self, published=False): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LessonCreate: """This class is responsible for providing a GUI through which a user can create a lesson.""" def __init__(self, root): """Construct create lesson window. @param {tkinter object} root @return {void}""" self.root = root self._id = '' self.name = '' sel...
the_stack_v2_python_sparse
lesson_create/view.py
taylorrees/studybook
train
0
9f5e8d6bcd491bd52a6ba17842dacf17a58fa550
[ "if self.shell is None:\n return None\nreturn self.shell.user_ns", "if self.shell is None:\n\n class EmptyClass:\n\n def __init__(self):\n self.user_ns = {}\n self.shell = EmptyClass()\nfor k, v in context.items():\n self.shell.user_ns[k] = v", "res = MagicClassWithHelpers._parser_...
<|body_start_0|> if self.shell is None: return None return self.shell.user_ns <|end_body_0|> <|body_start_1|> if self.shell is None: class EmptyClass: def __init__(self): self.user_ns = {} self.shell = EmptyClass() ...
Provides some functions reused in others classes inherited from *Magics*. The class should not be registered as it is but should be used as an ancestor for another class. It can be registered this way:: def register_file_magics(): from IPython import get_ipython ip = get_ipython() ip.register_magics(MagicFile)
MagicClassWithHelpers
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MagicClassWithHelpers: """Provides some functions reused in others classes inherited from *Magics*. The class should not be registered as it is but should be used as an ancestor for another class. It can be registered this way:: def register_file_magics(): from IPython import get_ipython ip = get...
stack_v2_sparse_classes_36k_train_032747
3,075
permissive
[ { "docstring": "return the context or None", "name": "Context", "signature": "def Context(self)" }, { "docstring": "add context to the class, mostly for debug purpose @param context dictionary", "name": "add_context", "signature": "def add_context(self, context)" }, { "docstring"...
4
null
Implement the Python class `MagicClassWithHelpers` described below. Class description: Provides some functions reused in others classes inherited from *Magics*. The class should not be registered as it is but should be used as an ancestor for another class. It can be registered this way:: def register_file_magics(): f...
Implement the Python class `MagicClassWithHelpers` described below. Class description: Provides some functions reused in others classes inherited from *Magics*. The class should not be registered as it is but should be used as an ancestor for another class. It can be registered this way:: def register_file_magics(): f...
860ec5b9a53bae4fc616076c0b52dbe2a1153d30
<|skeleton|> class MagicClassWithHelpers: """Provides some functions reused in others classes inherited from *Magics*. The class should not be registered as it is but should be used as an ancestor for another class. It can be registered this way:: def register_file_magics(): from IPython import get_ipython ip = get...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MagicClassWithHelpers: """Provides some functions reused in others classes inherited from *Magics*. The class should not be registered as it is but should be used as an ancestor for another class. It can be registered this way:: def register_file_magics(): from IPython import get_ipython ip = get_ipython() ip...
the_stack_v2_python_sparse
src/pyquickhelper/ipythonhelper/magic_class.py
Pandinosaurus/pyquickhelper
train
0
9e228db3324cd172bbea850b528bb89d8db00247
[ "self.val = int(x)\nself.next = next\nself.random = random", "res, node = ([], self)\nwhile node:\n rand = node.random.val if node.random else None\n res.append([node.val, rand])\n node = node.next\nreturn res" ]
<|body_start_0|> self.val = int(x) self.next = next self.random = random <|end_body_0|> <|body_start_1|> res, node = ([], self) while node: rand = node.random.val if node.random else None res.append([node.val, rand]) node = node.next r...
Node
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Node: def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None): """Provided by LeetCode.""" <|body_0|> def _path(self): """Used for testing. Returns the path of the linked list. Each element is the node's value, and the value of it's random node.""" ...
stack_v2_sparse_classes_36k_train_032748
1,851
no_license
[ { "docstring": "Provided by LeetCode.", "name": "__init__", "signature": "def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None)" }, { "docstring": "Used for testing. Returns the path of the linked list. Each element is the node's value, and the value of it's random node.", "name...
2
stack_v2_sparse_classes_30k_train_017713
Implement the Python class `Node` described below. Class description: Implement the Node class. Method signatures and docstrings: - def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None): Provided by LeetCode. - def _path(self): Used for testing. Returns the path of the linked list. Each element is the no...
Implement the Python class `Node` described below. Class description: Implement the Node class. Method signatures and docstrings: - def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None): Provided by LeetCode. - def _path(self): Used for testing. Returns the path of the linked list. Each element is the no...
c6d600bc74afd14e00d4f0ffed40696192b229c3
<|skeleton|> class Node: def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None): """Provided by LeetCode.""" <|body_0|> def _path(self): """Used for testing. Returns the path of the linked list. Each element is the node's value, and the value of it's random node.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Node: def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None): """Provided by LeetCode.""" self.val = int(x) self.next = next self.random = random def _path(self): """Used for testing. Returns the path of the linked list. Each element is the node's value...
the_stack_v2_python_sparse
python/Monthly/Feb2021/listrandompointerdeepcopy.py
Hilldrupca/LeetCode
train
0
80efd3ed992ac764b7badc68fdbb04fd18549805
[ "if not isinstance(data, np.ndarray) or len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nif data.shape[1] < 2:\n raise ValueError('data must contain multiple data points')\nd, n = data.shape\nself.mean = np.mean(data, axis=1, keepdims=True)\nX_mean = data - self.mean\nself.cov = np....
<|body_start_0|> if not isinstance(data, np.ndarray) or len(data.shape) != 2: raise TypeError('data must be a 2D numpy.ndarray') if data.shape[1] < 2: raise ValueError('data must contain multiple data points') d, n = data.shape self.mean = np.mean(data, axis=1, ke...
represents a Multivariate Normal distribution
MultiNormal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiNormal: """represents a Multivariate Normal distribution""" def __init__(self, data): """* data is a numpy.ndarray of shape (d, n) containing the data set: - n is the number of data points - d is the number of dimensions in each data point * If data is not a 2D numpy.ndarray, ra...
stack_v2_sparse_classes_36k_train_032749
2,405
no_license
[ { "docstring": "* data is a numpy.ndarray of shape (d, n) containing the data set: - n is the number of data points - d is the number of dimensions in each data point * If data is not a 2D numpy.ndarray, raise a TypeError with the message data must be a 2D numpy.ndarray * If n is less than 2, raise a ValueError...
2
null
Implement the Python class `MultiNormal` described below. Class description: represents a Multivariate Normal distribution Method signatures and docstrings: - def __init__(self, data): * data is a numpy.ndarray of shape (d, n) containing the data set: - n is the number of data points - d is the number of dimensions i...
Implement the Python class `MultiNormal` described below. Class description: represents a Multivariate Normal distribution Method signatures and docstrings: - def __init__(self, data): * data is a numpy.ndarray of shape (d, n) containing the data set: - n is the number of data points - d is the number of dimensions i...
8ad4c2594ff78b345dbd92e9d54d2a143ac4071a
<|skeleton|> class MultiNormal: """represents a Multivariate Normal distribution""" def __init__(self, data): """* data is a numpy.ndarray of shape (d, n) containing the data set: - n is the number of data points - d is the number of dimensions in each data point * If data is not a 2D numpy.ndarray, ra...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiNormal: """represents a Multivariate Normal distribution""" def __init__(self, data): """* data is a numpy.ndarray of shape (d, n) containing the data set: - n is the number of data points - d is the number of dimensions in each data point * If data is not a 2D numpy.ndarray, raise a TypeErr...
the_stack_v2_python_sparse
math/0x06-multivariate_prob/multinormal.py
jorgezafra94/holbertonschool-machine_learning
train
1
d7c3cf82b70fcafc7a62d9e3984dbc2b9db9f933
[ "queue = QueueCache.get_from_params(params)\ntry:\n with ServerLogger.hide_output():\n queue.status(params['job_id'])\nexcept (tej.JobNotFound, tej.QueueDoesntExist):\n pass\nelse:\n return params\ndirectory = self.interpreter.filePool.create_directory(prefix='vt_tmp_shelljob_').name\nsource = urlli...
<|body_start_0|> queue = QueueCache.get_from_params(params) try: with ServerLogger.hide_output(): queue.status(params['job_id']) except (tej.JobNotFound, tej.QueueDoesntExist): pass else: return params directory = self.interpret...
Submits a shell script.
SubmitShellJob
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubmitShellJob: """Submits a shell script.""" def job_start(self, params): """Creates a temporary job with the given source, upload and submit it.""" <|body_0|> def job_set_results(self, params): """Gets stderr and stdout.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_032750
19,579
permissive
[ { "docstring": "Creates a temporary job with the given source, upload and submit it.", "name": "job_start", "signature": "def job_start(self, params)" }, { "docstring": "Gets stderr and stdout.", "name": "job_set_results", "signature": "def job_set_results(self, params)" } ]
2
null
Implement the Python class `SubmitShellJob` described below. Class description: Submits a shell script. Method signatures and docstrings: - def job_start(self, params): Creates a temporary job with the given source, upload and submit it. - def job_set_results(self, params): Gets stderr and stdout.
Implement the Python class `SubmitShellJob` described below. Class description: Submits a shell script. Method signatures and docstrings: - def job_start(self, params): Creates a temporary job with the given source, upload and submit it. - def job_set_results(self, params): Gets stderr and stdout. <|skeleton|> class...
9b42ca9b3550b599467b0c7dfa56f57bbd97a4f2
<|skeleton|> class SubmitShellJob: """Submits a shell script.""" def job_start(self, params): """Creates a temporary job with the given source, upload and submit it.""" <|body_0|> def job_set_results(self, params): """Gets stderr and stdout.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubmitShellJob: """Submits a shell script.""" def job_start(self, params): """Creates a temporary job with the given source, upload and submit it.""" queue = QueueCache.get_from_params(params) try: with ServerLogger.hide_output(): queue.status(params['j...
the_stack_v2_python_sparse
vistrails/packages/tej/init.py
MaritimeResearchInstituteNetherlands/VisTrails
train
0
c16bff94f801433e3cce914c023117f47059cdf5
[ "bill = self.get_object()\ncustomer = User.objects.get(profile__phone_no=bill.customer_no)\nif self.request.user == customer or self.request.user.store == bill.store:\n return self.request.user\nelse:\n return None", "context = super(BillDetailView, self).get_context_data(**kwargs)\nreferer = self.request.M...
<|body_start_0|> bill = self.get_object() customer = User.objects.get(profile__phone_no=bill.customer_no) if self.request.user == customer or self.request.user.store == bill.store: return self.request.user else: return None <|end_body_0|> <|body_start_1|> ...
Individual bill details
BillDetailView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BillDetailView: """Individual bill details""" def test_func(self): """Only allows the customer and the store of the bill to access the details""" <|body_0|> def get_context_data(self, **kwargs): """1) Checks if the user is coming from the notifications page. 2) I...
stack_v2_sparse_classes_36k_train_032751
6,404
no_license
[ { "docstring": "Only allows the customer and the store of the bill to access the details", "name": "test_func", "signature": "def test_func(self)" }, { "docstring": "1) Checks if the user is coming from the notifications page. 2) If the user is coming from the notifications page, check the `pk` ...
2
stack_v2_sparse_classes_30k_train_015308
Implement the Python class `BillDetailView` described below. Class description: Individual bill details Method signatures and docstrings: - def test_func(self): Only allows the customer and the store of the bill to access the details - def get_context_data(self, **kwargs): 1) Checks if the user is coming from the not...
Implement the Python class `BillDetailView` described below. Class description: Individual bill details Method signatures and docstrings: - def test_func(self): Only allows the customer and the store of the bill to access the details - def get_context_data(self, **kwargs): 1) Checks if the user is coming from the not...
76f16616073ecc101fbbbe9fe49173b9638f597c
<|skeleton|> class BillDetailView: """Individual bill details""" def test_func(self): """Only allows the customer and the store of the bill to access the details""" <|body_0|> def get_context_data(self, **kwargs): """1) Checks if the user is coming from the notifications page. 2) I...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BillDetailView: """Individual bill details""" def test_func(self): """Only allows the customer and the store of the bill to access the details""" bill = self.get_object() customer = User.objects.get(profile__phone_no=bill.customer_no) if self.request.user == customer or se...
the_stack_v2_python_sparse
bills/views.py
mayankkushal/go-green-v1
train
2
0e5802b0c29271bac19e6bef6d1ab89b247a6dd7
[ "if n == 1 or n == 0:\n return n\na, b = (1, 2)\nfor _ in range(2, n):\n tmp = a + b\n a = b\n b = tmp\nreturn b", "if n == 0 or n == 1:\n return n\na = [1, 2]\nfor i in range(2, n):\n a.append(a[i - 1] + a[i - 2])\nreturn a[-1]", "if n == 1 or n == 0:\n return n\nif n == 2:\n return 2\n...
<|body_start_0|> if n == 1 or n == 0: return n a, b = (1, 2) for _ in range(2, n): tmp = a + b a = b b = tmp return b <|end_body_0|> <|body_start_1|> if n == 0 or n == 1: return n a = [1, 2] for i in ran...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def climbStairs(self, n): """:type n: int :rtype: int""" <|body_0|> def dynamic_method(self, n): """和上面用斐波那契数列方法本质是一样的 :param n: :return:""" <|body_1|> def recursive_method(self, n): """这个方法超时了 :param n: :return:""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_032752
1,078
permissive
[ { "docstring": ":type n: int :rtype: int", "name": "climbStairs", "signature": "def climbStairs(self, n)" }, { "docstring": "和上面用斐波那契数列方法本质是一样的 :param n: :return:", "name": "dynamic_method", "signature": "def dynamic_method(self, n)" }, { "docstring": "这个方法超时了 :param n: :return:"...
3
stack_v2_sparse_classes_30k_train_015602
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n): :type n: int :rtype: int - def dynamic_method(self, n): 和上面用斐波那契数列方法本质是一样的 :param n: :return: - def recursive_method(self, n): 这个方法超时了 :param n: :return...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n): :type n: int :rtype: int - def dynamic_method(self, n): 和上面用斐波那契数列方法本质是一样的 :param n: :return: - def recursive_method(self, n): 这个方法超时了 :param n: :return...
f71118e8e05d4bcdcfb2dfc42187c73961b8b926
<|skeleton|> class Solution: def climbStairs(self, n): """:type n: int :rtype: int""" <|body_0|> def dynamic_method(self, n): """和上面用斐波那契数列方法本质是一样的 :param n: :return:""" <|body_1|> def recursive_method(self, n): """这个方法超时了 :param n: :return:""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def climbStairs(self, n): """:type n: int :rtype: int""" if n == 1 or n == 0: return n a, b = (1, 2) for _ in range(2, n): tmp = a + b a = b b = tmp return b def dynamic_method(self, n): """和上面用斐波那契数...
the_stack_v2_python_sparse
leetcode-algorithms/070. Climbing Stairs/solution.py
bbruceyuan/algorithms-and-oj
train
11
e37b3879bddef56f193cab10594f322ce4b27499
[ "self.credentials = credentials\nself.project_id = project_id\nself.region = region\nself.config = terrascript.Terrascript()\nself.config += terrascript.provider.google(credentials=self.credentials, project=self.project_id, region=self.region)\nwith open('main.tf.json', 'w') as main_config:\n json.dump(self.conf...
<|body_start_0|> self.credentials = credentials self.project_id = project_id self.region = region self.config = terrascript.Terrascript() self.config += terrascript.provider.google(credentials=self.credentials, project=self.project_id, region=self.region) with open('main....
This class defines automates the spinning up of Google Cloud Instances
GoogleCloud
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GoogleCloud: """This class defines automates the spinning up of Google Cloud Instances""" def __init__(self, credentials, project_id, region): """args: credentials: Path to the credentials json file project_id: project_id of your project in GCP region: region of your GCP project""" ...
stack_v2_sparse_classes_36k_train_032753
3,926
permissive
[ { "docstring": "args: credentials: Path to the credentials json file project_id: project_id of your project in GCP region: region of your GCP project", "name": "__init__", "signature": "def __init__(self, credentials, project_id, region)" }, { "docstring": "args: name: name of the compute instan...
4
null
Implement the Python class `GoogleCloud` described below. Class description: This class defines automates the spinning up of Google Cloud Instances Method signatures and docstrings: - def __init__(self, credentials, project_id, region): args: credentials: Path to the credentials json file project_id: project_id of yo...
Implement the Python class `GoogleCloud` described below. Class description: This class defines automates the spinning up of Google Cloud Instances Method signatures and docstrings: - def __init__(self, credentials, project_id, region): args: credentials: Path to the credentials json file project_id: project_id of yo...
cc4765bed880ad38a02505834f63df39e0815328
<|skeleton|> class GoogleCloud: """This class defines automates the spinning up of Google Cloud Instances""" def __init__(self, credentials, project_id, region): """args: credentials: Path to the credentials json file project_id: project_id of your project in GCP region: region of your GCP project""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GoogleCloud: """This class defines automates the spinning up of Google Cloud Instances""" def __init__(self, credentials, project_id, region): """args: credentials: Path to the credentials json file project_id: project_id of your project in GCP region: region of your GCP project""" self.c...
the_stack_v2_python_sparse
syft/grid/autoscale/gcloud.py
tudorcebere/PySyft
train
2
f301aab6605856e4497f2ab543147222cff3e6e2
[ "notes = Note.objects.order_by(F('published').desc(), F('created').desc()).prefetch_related(Prefetch('subjects', queryset=Locator.objects.order_by('notesubject__sequence')))\nif self.series:\n notes = notes.filter(series=self.series)\nif self.kwargs.get('drafts') and self.request.user.is_authenticated:\n seri...
<|body_start_0|> notes = Note.objects.order_by(F('published').desc(), F('created').desc()).prefetch_related(Prefetch('subjects', queryset=Locator.objects.order_by('notesubject__sequence'))) if self.series: notes = notes.filter(series=self.series) if self.kwargs.get('drafts') and self...
Get notes as the main query set with correct visibility and ordering. (Includes SeriesRequiredMixin hence also acquires series from request.)
NotesMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotesMixin: """Get notes as the main query set with correct visibility and ordering. (Includes SeriesRequiredMixin hence also acquires series from request.)""" def get_queryset(self, **kwargs): """Acquire the relevant series and return the notes in that series.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_032754
12,479
no_license
[ { "docstring": "Acquire the relevant series and return the notes in that series.", "name": "get_queryset", "signature": "def get_queryset(self, **kwargs)" }, { "docstring": "Add the series to the context.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" ...
2
stack_v2_sparse_classes_30k_train_010656
Implement the Python class `NotesMixin` described below. Class description: Get notes as the main query set with correct visibility and ordering. (Includes SeriesRequiredMixin hence also acquires series from request.) Method signatures and docstrings: - def get_queryset(self, **kwargs): Acquire the relevant series an...
Implement the Python class `NotesMixin` described below. Class description: Get notes as the main query set with correct visibility and ordering. (Includes SeriesRequiredMixin hence also acquires series from request.) Method signatures and docstrings: - def get_queryset(self, **kwargs): Acquire the relevant series an...
0075ea457f764cbb67acecb584e927bf58d2e7a8
<|skeleton|> class NotesMixin: """Get notes as the main query set with correct visibility and ordering. (Includes SeriesRequiredMixin hence also acquires series from request.)""" def get_queryset(self, **kwargs): """Acquire the relevant series and return the notes in that series.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotesMixin: """Get notes as the main query set with correct visibility and ordering. (Includes SeriesRequiredMixin hence also acquires series from request.)""" def get_queryset(self, **kwargs): """Acquire the relevant series and return the notes in that series.""" notes = Note.objects.ord...
the_stack_v2_python_sparse
linotak/notes/views.py
pdc/linotak
train
0
77b3858c687b0a5fb341028860e723b4317f972b
[ "self._device_key = config.get(CONF_DEVICE_KEY)\nself._event = config.get(CONF_EVENT)\nself._password = config.get(CONF_PASSWORD)\nself._salt = config.get(CONF_SALT)", "title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)\nif self._password:\n send_encrypted(self._device_key, self._password, self._salt, title, m...
<|body_start_0|> self._device_key = config.get(CONF_DEVICE_KEY) self._event = config.get(CONF_EVENT) self._password = config.get(CONF_PASSWORD) self._salt = config.get(CONF_SALT) <|end_body_0|> <|body_start_1|> title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT) if self._...
Implementation of the notification service for Simplepush.
SimplePushNotificationService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimplePushNotificationService: """Implementation of the notification service for Simplepush.""" def __init__(self, config): """Initialize the Simplepush notification service.""" <|body_0|> def send_message(self, message='', **kwargs): """Send a message to a Simpl...
stack_v2_sparse_classes_36k_train_032755
1,785
permissive
[ { "docstring": "Initialize the Simplepush notification service.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Send a message to a Simplepush user.", "name": "send_message", "signature": "def send_message(self, message='', **kwargs)" } ]
2
null
Implement the Python class `SimplePushNotificationService` described below. Class description: Implementation of the notification service for Simplepush. Method signatures and docstrings: - def __init__(self, config): Initialize the Simplepush notification service. - def send_message(self, message='', **kwargs): Send...
Implement the Python class `SimplePushNotificationService` described below. Class description: Implementation of the notification service for Simplepush. Method signatures and docstrings: - def __init__(self, config): Initialize the Simplepush notification service. - def send_message(self, message='', **kwargs): Send...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class SimplePushNotificationService: """Implementation of the notification service for Simplepush.""" def __init__(self, config): """Initialize the Simplepush notification service.""" <|body_0|> def send_message(self, message='', **kwargs): """Send a message to a Simpl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimplePushNotificationService: """Implementation of the notification service for Simplepush.""" def __init__(self, config): """Initialize the Simplepush notification service.""" self._device_key = config.get(CONF_DEVICE_KEY) self._event = config.get(CONF_EVENT) self._passw...
the_stack_v2_python_sparse
homeassistant/components/simplepush/notify.py
BenWoodford/home-assistant
train
11
683859b8ebbb5d83222e3e406b7333fa266a277e
[ "t = [0.1, 0.2, a]\nres = fn.diag(t)\nassert fn.get_interface(res) == interface\nassert fn.allclose(res, onp.diag([0.1, 0.2, 0.5]))", "t = np.array([0.1, 0.2, 0.3])\nres = fn.diag(t)\nassert isinstance(res, np.ndarray)\nassert fn.allclose(res, onp.diag([0.1, 0.2, 0.3]))\nres = fn.diag(t, k=1)\nassert fn.allclose(...
<|body_start_0|> t = [0.1, 0.2, a] res = fn.diag(t) assert fn.get_interface(res) == interface assert fn.allclose(res, onp.diag([0.1, 0.2, 0.5])) <|end_body_0|> <|body_start_1|> t = np.array([0.1, 0.2, 0.3]) res = fn.diag(t) assert isinstance(res, np.ndarray) ...
Tests for the diag function
TestDiag
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDiag: """Tests for the diag function""" def test_sequence(self, a, interface): """Test that a sequence is automatically converted into a diagonal tensor""" <|body_0|> def test_array(self): """Test that a NumPy array is automatically converted into a diagonal ...
stack_v2_sparse_classes_36k_train_032756
47,600
permissive
[ { "docstring": "Test that a sequence is automatically converted into a diagonal tensor", "name": "test_sequence", "signature": "def test_sequence(self, a, interface)" }, { "docstring": "Test that a NumPy array is automatically converted into a diagonal tensor", "name": "test_array", "sig...
5
null
Implement the Python class `TestDiag` described below. Class description: Tests for the diag function Method signatures and docstrings: - def test_sequence(self, a, interface): Test that a sequence is automatically converted into a diagonal tensor - def test_array(self): Test that a NumPy array is automatically conve...
Implement the Python class `TestDiag` described below. Class description: Tests for the diag function Method signatures and docstrings: - def test_sequence(self, a, interface): Test that a sequence is automatically converted into a diagonal tensor - def test_array(self): Test that a NumPy array is automatically conve...
0c1c805fd5dfce465a8955ee3faf81037023a23e
<|skeleton|> class TestDiag: """Tests for the diag function""" def test_sequence(self, a, interface): """Test that a sequence is automatically converted into a diagonal tensor""" <|body_0|> def test_array(self): """Test that a NumPy array is automatically converted into a diagonal ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDiag: """Tests for the diag function""" def test_sequence(self, a, interface): """Test that a sequence is automatically converted into a diagonal tensor""" t = [0.1, 0.2, a] res = fn.diag(t) assert fn.get_interface(res) == interface assert fn.allclose(res, onp....
the_stack_v2_python_sparse
artifacts/old_dataset_versions/original_commits_backup/pennylane/pennylane#1081/before/test_functions.py
MattePalte/Bugs-Quantum-Computing-Platforms
train
4
90924ca0af879fb01271742ad4796a6646ae5b7e
[ "project_id, board_id = util.project_or_object(project, board, section_name=DOCK_NAME_MESSAGE_BOARD)\ndata = {'subject': subject, 'status': status}\nif content is not None:\n data['content'] = content\nif category is not None:\n data['category_id'] = int(category)\nurl = self.CREATE_URL.format(base_url=self.u...
<|body_start_0|> project_id, board_id = util.project_or_object(project, board, section_name=DOCK_NAME_MESSAGE_BOARD) data = {'subject': subject, 'status': status} if content is not None: data['content'] = content if category is not None: data['category_id'] = int(...
Messages
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Messages: def create(self, subject, content=None, status='active', category=None, project=None, board=None): """Create a new Message object. Either a project ID and MessageBoard ID must be given or just a MessageBoard object. :param subject: the subject (title) of this message :type subj...
stack_v2_sparse_classes_36k_train_032757
6,252
permissive
[ { "docstring": "Create a new Message object. Either a project ID and MessageBoard ID must be given or just a MessageBoard object. :param subject: the subject (title) of this message :type subject: str :param content: the content (body) of this message. Can be HTML. :type content: str :param status: the status o...
4
stack_v2_sparse_classes_30k_train_011692
Implement the Python class `Messages` described below. Class description: Implement the Messages class. Method signatures and docstrings: - def create(self, subject, content=None, status='active', category=None, project=None, board=None): Create a new Message object. Either a project ID and MessageBoard ID must be gi...
Implement the Python class `Messages` described below. Class description: Implement the Messages class. Method signatures and docstrings: - def create(self, subject, content=None, status='active', category=None, project=None, board=None): Create a new Message object. Either a project ID and MessageBoard ID must be gi...
bece72d06b91de0e33afd2181c59b895dbe7ae1f
<|skeleton|> class Messages: def create(self, subject, content=None, status='active', category=None, project=None, board=None): """Create a new Message object. Either a project ID and MessageBoard ID must be given or just a MessageBoard object. :param subject: the subject (title) of this message :type subj...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Messages: def create(self, subject, content=None, status='active', category=None, project=None, board=None): """Create a new Message object. Either a project ID and MessageBoard ID must be given or just a MessageBoard object. :param subject: the subject (title) of this message :type subject: str :para...
the_stack_v2_python_sparse
basecampy3/endpoints/messages.py
phistrom/basecampy3
train
34
0134d263001470822ad18f2a2184130c073b56ee
[ "start = max(start1, start2)\nend = min(end1, end2)\nif start > end:\n return (None, None)\nreturn (start, end)", "for row in rows:\n for key_start_date, key_end_date in keys:\n if key_start_date not in [self._key_start_date, self._key_end_date]:\n row[key_start_date] = self._date2int(row[...
<|body_start_0|> start = max(start1, start2) end = min(end1, end2) if start > end: return (None, None) return (start, end) <|end_body_0|> <|body_start_1|> for row in rows: for key_start_date, key_end_date in keys: if key_start_date not in ...
A helper class for joining data sets with date intervals.
Type2JoinHelper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Type2JoinHelper: """A helper class for joining data sets with date intervals.""" def _intersect(start1, end1, start2, end2): """Returns the intersection of two intervals. Returns (None,None) if the intersection is empty. :param int start1: The start date of the first interval. :param...
stack_v2_sparse_classes_36k_train_032758
4,436
permissive
[ { "docstring": "Returns the intersection of two intervals. Returns (None,None) if the intersection is empty. :param int start1: The start date of the first interval. :param int end1: The end date of the first interval. :param int start2: The start date of the second interval. :param int end2: The end date of th...
4
stack_v2_sparse_classes_30k_val_000054
Implement the Python class `Type2JoinHelper` described below. Class description: A helper class for joining data sets with date intervals. Method signatures and docstrings: - def _intersect(start1, end1, start2, end2): Returns the intersection of two intervals. Returns (None,None) if the intersection is empty. :param...
Implement the Python class `Type2JoinHelper` described below. Class description: A helper class for joining data sets with date intervals. Method signatures and docstrings: - def _intersect(start1, end1, start2, end2): Returns the intersection of two intervals. Returns (None,None) if the intersection is empty. :param...
542e4d1dc974dad60f4e338a334c932a40b45ee2
<|skeleton|> class Type2JoinHelper: """A helper class for joining data sets with date intervals.""" def _intersect(start1, end1, start2, end2): """Returns the intersection of two intervals. Returns (None,None) if the intersection is empty. :param int start1: The start date of the first interval. :param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Type2JoinHelper: """A helper class for joining data sets with date intervals.""" def _intersect(start1, end1, start2, end2): """Returns the intersection of two intervals. Returns (None,None) if the intersection is empty. :param int start1: The start date of the first interval. :param int end1: Th...
the_stack_v2_python_sparse
etlt/helper/Type2JoinHelper.py
PyETLT/etlt
train
1
cbc91a97ce80a3fe4bc7a9fa14fb844f3a4cd2f2
[ "self.device_id = device_id\nself.rule_id = rule_id\nself.timestamp_start = APIHelper.RFC3339DateTime(timestamp_start) if timestamp_start else None\nself.timestamp_end = APIHelper.RFC3339DateTime(timestamp_end) if timestamp_end else None\nself.message = message\nself.comment = comment\nself.description = descriptio...
<|body_start_0|> self.device_id = device_id self.rule_id = rule_id self.timestamp_start = APIHelper.RFC3339DateTime(timestamp_start) if timestamp_start else None self.timestamp_end = APIHelper.RFC3339DateTime(timestamp_end) if timestamp_end else None self.message = message ...
Implementation of the 'AlertItem' model. An alert generated for a device based on a rule. Attributes: device_id (int): The id of the device the alert was generated for. rule_id (int): The id of the rule the alert is based on. timestamp_start (datetime): The timestamp when the alert began. The timestamp is in the time z...
AlertItem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlertItem: """Implementation of the 'AlertItem' model. An alert generated for a device based on a rule. Attributes: device_id (int): The id of the device the alert was generated for. rule_id (int): The id of the rule the alert is based on. timestamp_start (datetime): The timestamp when the alert ...
stack_v2_sparse_classes_36k_train_032759
3,801
permissive
[ { "docstring": "Constructor for the AlertItem class", "name": "__init__", "signature": "def __init__(self, device_id=None, rule_id=None, timestamp_start=None, timestamp_end=None, message=None, comment=None, description=None, details=None)" }, { "docstring": "Creates an instance of this model fro...
2
stack_v2_sparse_classes_30k_train_001151
Implement the Python class `AlertItem` described below. Class description: Implementation of the 'AlertItem' model. An alert generated for a device based on a rule. Attributes: device_id (int): The id of the device the alert was generated for. rule_id (int): The id of the rule the alert is based on. timestamp_start (d...
Implement the Python class `AlertItem` described below. Class description: Implementation of the 'AlertItem' model. An alert generated for a device based on a rule. Attributes: device_id (int): The id of the device the alert was generated for. rule_id (int): The id of the rule the alert is based on. timestamp_start (d...
6835ee1f6a667b5c7827c5248391081f06b75513
<|skeleton|> class AlertItem: """Implementation of the 'AlertItem' model. An alert generated for a device based on a rule. Attributes: device_id (int): The id of the device the alert was generated for. rule_id (int): The id of the rule the alert is based on. timestamp_start (datetime): The timestamp when the alert ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlertItem: """Implementation of the 'AlertItem' model. An alert generated for a device based on a rule. Attributes: device_id (int): The id of the device the alert was generated for. rule_id (int): The id of the rule the alert is based on. timestamp_start (datetime): The timestamp when the alert began. The ti...
the_stack_v2_python_sparse
greenbyteapi/models/alert_item.py
charlie9578/greenbyte-api-sdk
train
0
387f43812e7915303ce56c77a28359ebf732f746
[ "self.page = page\nself.url = url\nself.history = history\nself.header = {'Accept': 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'Accept-Language': 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3', 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'Keep-Alive': '30',...
<|body_start_0|> self.page = page self.url = url self.history = history self.header = {'Accept': 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'Accept-Language': 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3', 'Accept-Charset': 'ISO-8859-1,...
A thread responsible for checking one URL. After checking the page, it will die.
LinkCheckThread
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkCheckThread: """A thread responsible for checking one URL. After checking the page, it will die.""" def __init__(self, page, url, history, http_ignores, day) -> None: """Initializer.""" <|body_0|> def get_delay(cls, name: str) -> float: """Determine delay fro...
stack_v2_sparse_classes_36k_train_032760
25,993
permissive
[ { "docstring": "Initializer.", "name": "__init__", "signature": "def __init__(self, page, url, history, http_ignores, day) -> None" }, { "docstring": "Determine delay from class attribute. Store the last call for a given hostname with an offset of 6 seconds to ensure there are no more than 10 ca...
3
stack_v2_sparse_classes_30k_train_000936
Implement the Python class `LinkCheckThread` described below. Class description: A thread responsible for checking one URL. After checking the page, it will die. Method signatures and docstrings: - def __init__(self, page, url, history, http_ignores, day) -> None: Initializer. - def get_delay(cls, name: str) -> float...
Implement the Python class `LinkCheckThread` described below. Class description: A thread responsible for checking one URL. After checking the page, it will die. Method signatures and docstrings: - def __init__(self, page, url, history, http_ignores, day) -> None: Initializer. - def get_delay(cls, name: str) -> float...
5c01e6bfcd328bc6eae643e661f1a0ae57612808
<|skeleton|> class LinkCheckThread: """A thread responsible for checking one URL. After checking the page, it will die.""" def __init__(self, page, url, history, http_ignores, day) -> None: """Initializer.""" <|body_0|> def get_delay(cls, name: str) -> float: """Determine delay fro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinkCheckThread: """A thread responsible for checking one URL. After checking the page, it will die.""" def __init__(self, page, url, history, http_ignores, day) -> None: """Initializer.""" self.page = page self.url = url self.history = history self.header = {'Acce...
the_stack_v2_python_sparse
scripts/weblinkchecker.py
wikimedia/pywikibot
train
432
73eb9de748e1e504846b654b92369ae7f00c1e55
[ "if not s:\n return 0\nhead = 0\ntail = 0\nres = 1\nn = len(s)\nwhile tail + 1 < n:\n tail += 1\n if s[tail] not in s[head:tail]:\n res = max(tail - head + 1, res)\n else:\n while s[tail] in s[head:tail]:\n head += 1\nreturn res", "if not s:\n return 0\ndic = {}\nres = 0\ni...
<|body_start_0|> if not s: return 0 head = 0 tail = 0 res = 1 n = len(s) while tail + 1 < n: tail += 1 if s[tail] not in s[head:tail]: res = max(tail - head + 1, res) else: while s[tail] in s[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """首先想到暴力解法,嵌套的遍历找到所有字符串时间复杂度n**2, 对于每一个字符串利用hashset遍历一次看是否有重复字符,时间复杂度n 整体时间复杂度n**3 空间复杂度:m大小的hashset,所有可能出现的字符 :param s: :return:""" <|body_0|> def lengthOfLongestSubstring_v2(self, s): """滑动窗口+哈希表 :param s: :return:"...
stack_v2_sparse_classes_36k_train_032761
2,241
no_license
[ { "docstring": "首先想到暴力解法,嵌套的遍历找到所有字符串时间复杂度n**2, 对于每一个字符串利用hashset遍历一次看是否有重复字符,时间复杂度n 整体时间复杂度n**3 空间复杂度:m大小的hashset,所有可能出现的字符 :param s: :return:", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, s)" }, { "docstring": "滑动窗口+哈希表 :param s: :return:", "name": ...
2
stack_v2_sparse_classes_30k_train_005590
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): 首先想到暴力解法,嵌套的遍历找到所有字符串时间复杂度n**2, 对于每一个字符串利用hashset遍历一次看是否有重复字符,时间复杂度n 整体时间复杂度n**3 空间复杂度:m大小的hashset,所有可能出现的字符 :param s: :return: - def lengt...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): 首先想到暴力解法,嵌套的遍历找到所有字符串时间复杂度n**2, 对于每一个字符串利用hashset遍历一次看是否有重复字符,时间复杂度n 整体时间复杂度n**3 空间复杂度:m大小的hashset,所有可能出现的字符 :param s: :return: - def lengt...
f1bbd6b3197cd9ac4f0d35a37539c11b02272065
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """首先想到暴力解法,嵌套的遍历找到所有字符串时间复杂度n**2, 对于每一个字符串利用hashset遍历一次看是否有重复字符,时间复杂度n 整体时间复杂度n**3 空间复杂度:m大小的hashset,所有可能出现的字符 :param s: :return:""" <|body_0|> def lengthOfLongestSubstring_v2(self, s): """滑动窗口+哈希表 :param s: :return:"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLongestSubstring(self, s): """首先想到暴力解法,嵌套的遍历找到所有字符串时间复杂度n**2, 对于每一个字符串利用hashset遍历一次看是否有重复字符,时间复杂度n 整体时间复杂度n**3 空间复杂度:m大小的hashset,所有可能出现的字符 :param s: :return:""" if not s: return 0 head = 0 tail = 0 res = 1 n = len(s) whi...
the_stack_v2_python_sparse
offer/动态规划/48. 最长不含重复字符的字符串/lengthOfLongestSubstring.py
guohaoyuan/algorithms-for-work
train
2
f34e291d37e57dc602c62d47000df76508559087
[ "self.mostVotedByTime = dict()\nself.mostVoted = dict()\nmaxVotes = 0\nperson = 0\nfor i, t in enumerate(times):\n if persons[i] not in self.mostVoted.keys():\n self.mostVoted[persons[i]] = 1\n else:\n self.mostVoted[persons[i]] += 1\n if maxVotes <= self.mostVoted[persons[i]]:\n maxVo...
<|body_start_0|> self.mostVotedByTime = dict() self.mostVoted = dict() maxVotes = 0 person = 0 for i, t in enumerate(times): if persons[i] not in self.mostVoted.keys(): self.mostVoted[persons[i]] = 1 else: self.mostVoted[per...
TopVotedCandidate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" <|body_0|> def q(self, t): """:type t: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.mostVotedByTime = dict() ...
stack_v2_sparse_classes_36k_train_032762
2,534
no_license
[ { "docstring": ":type persons: List[int] :type times: List[int]", "name": "__init__", "signature": "def __init__(self, persons, times)" }, { "docstring": ":type t: int :rtype: int", "name": "q", "signature": "def q(self, t)" } ]
2
null
Implement the Python class `TopVotedCandidate` described below. Class description: Implement the TopVotedCandidate class. Method signatures and docstrings: - def __init__(self, persons, times): :type persons: List[int] :type times: List[int] - def q(self, t): :type t: int :rtype: int
Implement the Python class `TopVotedCandidate` described below. Class description: Implement the TopVotedCandidate class. Method signatures and docstrings: - def __init__(self, persons, times): :type persons: List[int] :type times: List[int] - def q(self, t): :type t: int :rtype: int <|skeleton|> class TopVotedCandi...
4d7e675c795c841f99ca95b8b60c4995bcb632fb
<|skeleton|> class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" <|body_0|> def q(self, t): """:type t: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" self.mostVotedByTime = dict() self.mostVoted = dict() maxVotes = 0 person = 0 for i, t in enumerate(times): if persons[i] not in self.mostVot...
the_stack_v2_python_sparse
911_Online Election.py
stephenchenxj/myLeetCode
train
0
e45bdd713e59a6b642a30c1d31923a205e1b1325
[ "momentum = kwargs.pop('momentum', 0.9)\nupdate_vars = tf.trainable_variables()\nreturn tf.train.MomentumOptimizer(self.learning_rate_placeholder, momentum, use_nesterov=False).minimize(self.model.loss, var_list=update_vars)", "learning_rate_patience = kwargs.pop('learning_rate_patience', 10)\nlearning_rate_decay...
<|body_start_0|> momentum = kwargs.pop('momentum', 0.9) update_vars = tf.trainable_variables() return tf.train.MomentumOptimizer(self.learning_rate_placeholder, momentum, use_nesterov=False).minimize(self.model.loss, var_list=update_vars) <|end_body_0|> <|body_start_1|> learning_rate_pa...
모멘텀 알고리즘을 포함한 경사 하강 optimizer 클래스.
MomentumOptimizer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MomentumOptimizer: """모멘텀 알고리즘을 포함한 경사 하강 optimizer 클래스.""" def _optimize_op(self, **kwargs): """경사 하강 업데이트를 위한 tf.train.MomentumOptimizer.minimize Op. :param kwargs: dict, optimizer의 추가 인자. - momentum: float, 모멘텀 계수. :return tf.Operation.""" <|body_0|> def _update_learn...
stack_v2_sparse_classes_36k_train_032763
2,122
no_license
[ { "docstring": "경사 하강 업데이트를 위한 tf.train.MomentumOptimizer.minimize Op. :param kwargs: dict, optimizer의 추가 인자. - momentum: float, 모멘텀 계수. :return tf.Operation.", "name": "_optimize_op", "signature": "def _optimize_op(self, **kwargs)" }, { "docstring": "성능 평가 점수 상에 개선이 없을 때, 현 학습률 값을 업데이트함. :param...
2
stack_v2_sparse_classes_30k_train_017260
Implement the Python class `MomentumOptimizer` described below. Class description: 모멘텀 알고리즘을 포함한 경사 하강 optimizer 클래스. Method signatures and docstrings: - def _optimize_op(self, **kwargs): 경사 하강 업데이트를 위한 tf.train.MomentumOptimizer.minimize Op. :param kwargs: dict, optimizer의 추가 인자. - momentum: float, 모멘텀 계수. :return t...
Implement the Python class `MomentumOptimizer` described below. Class description: 모멘텀 알고리즘을 포함한 경사 하강 optimizer 클래스. Method signatures and docstrings: - def _optimize_op(self, **kwargs): 경사 하강 업데이트를 위한 tf.train.MomentumOptimizer.minimize Op. :param kwargs: dict, optimizer의 추가 인자. - momentum: float, 모멘텀 계수. :return t...
af58878beb9f94ba4d6afd628ddb0a6ac6c41746
<|skeleton|> class MomentumOptimizer: """모멘텀 알고리즘을 포함한 경사 하강 optimizer 클래스.""" def _optimize_op(self, **kwargs): """경사 하강 업데이트를 위한 tf.train.MomentumOptimizer.minimize Op. :param kwargs: dict, optimizer의 추가 인자. - momentum: float, 모멘텀 계수. :return tf.Operation.""" <|body_0|> def _update_learn...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MomentumOptimizer: """모멘텀 알고리즘을 포함한 경사 하강 optimizer 클래스.""" def _optimize_op(self, **kwargs): """경사 하강 업데이트를 위한 tf.train.MomentumOptimizer.minimize Op. :param kwargs: dict, optimizer의 추가 인자. - momentum: float, 모멘텀 계수. :return tf.Operation.""" momentum = kwargs.pop('momentum', 0.9) ...
the_stack_v2_python_sparse
source/optimizer/MomentumOptimizer.py
mmecoco/Workshop_AI
train
0
2f3a43ab7610f3425b5a914020cd5e9b7bb41dd5
[ "ContextLemmatizer.__init__(self, context_to_lemmatize, backoff)\nself.include = include\nself._context_to_tag = context_to_lemmatize if context_to_lemmatize else {}", "from cltk.tag.pos import POSTag\ntagger = POSTag('latin')\ntokens = ' '.join(tokens)\ntags = tagger.tag_ngram_123_backoff(tokens)\ntags = [tag[1]...
<|body_start_0|> ContextLemmatizer.__init__(self, context_to_lemmatize, backoff) self.include = include self._context_to_tag = context_to_lemmatize if context_to_lemmatize else {} <|end_body_0|> <|body_start_1|> from cltk.tag.pos import POSTag tagger = POSTag('latin') to...
Lemmatizer that combines context with POS-tagging based on training data. Subclasses define context. The code for _train closely follows ContextTagger in https://github.com/nltk/nltk/blob/develop/nltk/tag/sequential.py This lemmatizer is included here as proof of concept that lemma disambiguation can be made based on t...
ContextPOSLemmatizer
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContextPOSLemmatizer: """Lemmatizer that combines context with POS-tagging based on training data. Subclasses define context. The code for _train closely follows ContextTagger in https://github.com/nltk/nltk/blob/develop/nltk/tag/sequential.py This lemmatizer is included here as proof of concept ...
stack_v2_sparse_classes_36k_train_032764
23,254
permissive
[ { "docstring": "Setup ContextPOSLemmatizer(). :param context_to_lemmatize: List of tuples of the form (TOKEN, LEMMA); this should be 'gold standard' data that can be used to train on a given context, e.g. unigrams, bigrams, etc. :param include: List of tokens to include, all other tokens return None from choose...
4
stack_v2_sparse_classes_30k_train_004301
Implement the Python class `ContextPOSLemmatizer` described below. Class description: Lemmatizer that combines context with POS-tagging based on training data. Subclasses define context. The code for _train closely follows ContextTagger in https://github.com/nltk/nltk/blob/develop/nltk/tag/sequential.py This lemmatize...
Implement the Python class `ContextPOSLemmatizer` described below. Class description: Lemmatizer that combines context with POS-tagging based on training data. Subclasses define context. The code for _train closely follows ContextTagger in https://github.com/nltk/nltk/blob/develop/nltk/tag/sequential.py This lemmatize...
085420eaed7055fbcb311714eebb67861fd1b241
<|skeleton|> class ContextPOSLemmatizer: """Lemmatizer that combines context with POS-tagging based on training data. Subclasses define context. The code for _train closely follows ContextTagger in https://github.com/nltk/nltk/blob/develop/nltk/tag/sequential.py This lemmatizer is included here as proof of concept ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContextPOSLemmatizer: """Lemmatizer that combines context with POS-tagging based on training data. Subclasses define context. The code for _train closely follows ContextTagger in https://github.com/nltk/nltk/blob/develop/nltk/tag/sequential.py This lemmatizer is included here as proof of concept that lemma di...
the_stack_v2_python_sparse
cltk/lemmatize/latin/backoff.py
jerryfrancis-97/cltk
train
1
fbb76fddb17bdf935ccb515f2bad2025f2391a9e
[ "self.comm = comm\nself.model = model\nself.auto_copy = auto_copy\nif auto_copy:\n self.copy_aero_mesh()\nreturn", "for body in self.model.bodies:\n aero_id = np.arange(1, body.get_num_struct_nodes() + 1)\n body.initialize_aero_nodes(body.struct_X, aero_id)\nreturn self" ]
<|body_start_0|> self.comm = comm self.model = model self.auto_copy = auto_copy if auto_copy: self.copy_aero_mesh() return <|end_body_0|> <|body_start_1|> for body in self.model.bodies: aero_id = np.arange(1, body.get_num_struct_nodes() + 1) ...
NullAerodynamicSolver
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NullAerodynamicSolver: def __init__(self, comm, model, auto_copy=False): """This class provides the functionality that FUNtoFEM expects from an aerodynamic solver, except no aerodynamics is performed here. All solver interface routines we just do nothing and those methods come from the s...
stack_v2_sparse_classes_36k_train_032765
45,431
permissive
[ { "docstring": "This class provides the functionality that FUNtoFEM expects from an aerodynamic solver, except no aerodynamics is performed here. All solver interface routines we just do nothing and those methods come from the super class SolverInterface Parameters ---------- comm: MPI.comm MPI communicator mod...
2
null
Implement the Python class `NullAerodynamicSolver` described below. Class description: Implement the NullAerodynamicSolver class. Method signatures and docstrings: - def __init__(self, comm, model, auto_copy=False): This class provides the functionality that FUNtoFEM expects from an aerodynamic solver, except no aero...
Implement the Python class `NullAerodynamicSolver` described below. Class description: Implement the NullAerodynamicSolver class. Method signatures and docstrings: - def __init__(self, comm, model, auto_copy=False): This class provides the functionality that FUNtoFEM expects from an aerodynamic solver, except no aero...
4c11b61397100f9d8b455f7d20cf3b507a15c1e9
<|skeleton|> class NullAerodynamicSolver: def __init__(self, comm, model, auto_copy=False): """This class provides the functionality that FUNtoFEM expects from an aerodynamic solver, except no aerodynamics is performed here. All solver interface routines we just do nothing and those methods come from the s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NullAerodynamicSolver: def __init__(self, comm, model, auto_copy=False): """This class provides the functionality that FUNtoFEM expects from an aerodynamic solver, except no aerodynamics is performed here. All solver interface routines we just do nothing and those methods come from the super class Sol...
the_stack_v2_python_sparse
funtofem/interface/test_solver.py
gjkennedy/funtofem
train
0
b6d751bee3e871bce59453d32b8c4bb19b1aa645
[ "self.parser = reqparse.RequestParser()\nself.parser.add_argument('name')\nself.parser.add_argument('token')\nsuper(CtaStrategyStop, self).__init__()", "args = self.parser.parse_args()\ntoken = args['token']\nname = 'strategyHedge_syt'\nengine = me.getApp('CtaStrategy')\nif not name:\n engine.stopAll()\nelse:\...
<|body_start_0|> self.parser = reqparse.RequestParser() self.parser.add_argument('name') self.parser.add_argument('token') super(CtaStrategyStop, self).__init__() <|end_body_0|> <|body_start_1|> args = self.parser.parse_args() token = args['token'] name = 'strate...
停止策略
CtaStrategyStop
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CtaStrategyStop: """停止策略""" def __init__(self): """初始化""" <|body_0|> def post(self): """订阅""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.parser = reqparse.RequestParser() self.parser.add_argument('name') self.parser.add_ar...
stack_v2_sparse_classes_36k_train_032766
24,002
permissive
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "订阅", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_020528
Implement the Python class `CtaStrategyStop` described below. Class description: 停止策略 Method signatures and docstrings: - def __init__(self): 初始化 - def post(self): 订阅
Implement the Python class `CtaStrategyStop` described below. Class description: 停止策略 Method signatures and docstrings: - def __init__(self): 初始化 - def post(self): 订阅 <|skeleton|> class CtaStrategyStop: """停止策略""" def __init__(self): """初始化""" <|body_0|> def post(self): """订阅"""...
c316649161086da2543d39bf0455d0f793cdd08f
<|skeleton|> class CtaStrategyStop: """停止策略""" def __init__(self): """初始化""" <|body_0|> def post(self): """订阅""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CtaStrategyStop: """停止策略""" def __init__(self): """初始化""" self.parser = reqparse.RequestParser() self.parser.add_argument('name') self.parser.add_argument('token') super(CtaStrategyStop, self).__init__() def post(self): """订阅""" args = self.par...
the_stack_v2_python_sparse
WebTrader/webServer.py
webclinic017/riskBacktestingPlatform
train
0
dc56a785b396db4c4aa8f21e42f29f82600d7095
[ "if not root:\n return None\nstack = []\nstack.append(root)\nstring = ''\nwhile len(stack) != 0:\n node = stack.pop()\n if not node:\n string += 'N '\n else:\n string += str(node.val) + ' '\n if node.right or node.left:\n stack.append(node.right)\n stack.append...
<|body_start_0|> if not root: return None stack = [] stack.append(root) string = '' while len(stack) != 0: node = stack.pop() if not node: string += 'N ' else: string += str(node.val) + ' ' ...
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_032767
2,146
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:...
85415872711c7c4b646f71ba44b5ef9200c03f5e
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return None stack = [] stack.append(root) string = '' while len(stack) != 0: node = stack.pop() if not no...
the_stack_v2_python_sparse
449.py
ninini976/yf_leetcode_problems
train
0
4685d1a18814c82150870909f3aa70f954e21be9
[ "super().__init__(device=device, quantize=False, min_transformers_version='4.12.3')\nself.pipeline = pipeline('text-classification', model='cardiffnlp/twitter-roberta-base-sentiment', device=self.device_to_id(), **kwargs)\nself.mapping = {'LABEL_0': 'NEGATIVE', 'LABEL_1': 'NEUTRAL', 'LABEL_2': 'POSITIVE'}", "str_...
<|body_start_0|> super().__init__(device=device, quantize=False, min_transformers_version='4.12.3') self.pipeline = pipeline('text-classification', model='cardiffnlp/twitter-roberta-base-sentiment', device=self.device_to_id(), **kwargs) self.mapping = {'LABEL_0': 'NEGATIVE', 'LABEL_1': 'NEUTRAL'...
interface to Sentiment Analyzer
SentimentAnalyzer
[ "Apache-2.0", "CC-BY-NC-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentimentAnalyzer: """interface to Sentiment Analyzer""" def __init__(self, device=None, **kwargs): """``` ImageCaptioner constructor Args: device(str): device to use (e.g., 'cuda', 'cpu') ```""" <|body_0|> def predict(self, texts: Union[str, list], return_all_scores=Fal...
stack_v2_sparse_classes_36k_train_032768
2,245
permissive
[ { "docstring": "``` ImageCaptioner constructor Args: device(str): device to use (e.g., 'cuda', 'cpu') ```", "name": "__init__", "signature": "def __init__(self, device=None, **kwargs)" }, { "docstring": "``` Performs sentiment analysis This method accepts a list of texts and predicts their senti...
3
stack_v2_sparse_classes_30k_train_018623
Implement the Python class `SentimentAnalyzer` described below. Class description: interface to Sentiment Analyzer Method signatures and docstrings: - def __init__(self, device=None, **kwargs): ``` ImageCaptioner constructor Args: device(str): device to use (e.g., 'cuda', 'cpu') ``` - def predict(self, texts: Union[s...
Implement the Python class `SentimentAnalyzer` described below. Class description: interface to Sentiment Analyzer Method signatures and docstrings: - def __init__(self, device=None, **kwargs): ``` ImageCaptioner constructor Args: device(str): device to use (e.g., 'cuda', 'cpu') ``` - def predict(self, texts: Union[s...
ab03ae68053b727cb8907e08c35f265531d1cb3a
<|skeleton|> class SentimentAnalyzer: """interface to Sentiment Analyzer""" def __init__(self, device=None, **kwargs): """``` ImageCaptioner constructor Args: device(str): device to use (e.g., 'cuda', 'cpu') ```""" <|body_0|> def predict(self, texts: Union[str, list], return_all_scores=Fal...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SentimentAnalyzer: """interface to Sentiment Analyzer""" def __init__(self, device=None, **kwargs): """``` ImageCaptioner constructor Args: device(str): device to use (e.g., 'cuda', 'cpu') ```""" super().__init__(device=device, quantize=False, min_transformers_version='4.12.3') se...
the_stack_v2_python_sparse
ktrain/text/sentiment/core.py
amaiya/ktrain
train
1,217
1de01e443900874fadb022cb8d4337c11d378ad5
[ "assert 0.0 <= cutmix_prob <= 1.0, 'cutmix_prob should be between 0.0 and 1.0'\nsuper().__init__()\nself.cutmix_prob = cutmix_prob\nself.mixup = MixUp(alpha=mixup_alpha, label_smoothing=label_smoothing, num_classes=num_classes)\nself.cutmix = CutMix(alpha=cutmix_alpha, label_smoothing=label_smoothing, num_classes=n...
<|body_start_0|> assert 0.0 <= cutmix_prob <= 1.0, 'cutmix_prob should be between 0.0 and 1.0' super().__init__() self.cutmix_prob = cutmix_prob self.mixup = MixUp(alpha=mixup_alpha, label_smoothing=label_smoothing, num_classes=num_classes) self.cutmix = CutMix(alpha=cutmix_alpha...
Stochastically applies either MixUp or CutMix to the input video.
MixVideo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MixVideo: """Stochastically applies either MixUp or CutMix to the input video.""" def __init__(self, cutmix_prob: float=0.5, mixup_alpha: float=1.0, cutmix_alpha: float=1.0, label_smoothing: float=0.0, num_classes: int=400): """Args: cutmix_prob (float): Probability of using CutMix. ...
stack_v2_sparse_classes_36k_train_032769
7,161
permissive
[ { "docstring": "Args: cutmix_prob (float): Probability of using CutMix. MixUp will be used with probability 1 - cutmix_prob. If cutmix_prob is 0, then MixUp is always used. If cutmix_prob is 1, then CutMix is always used. mixup_alpha (float): MixUp alpha value. cutmix_alpha (float): CutMix alpha value. label_sm...
2
stack_v2_sparse_classes_30k_train_016213
Implement the Python class `MixVideo` described below. Class description: Stochastically applies either MixUp or CutMix to the input video. Method signatures and docstrings: - def __init__(self, cutmix_prob: float=0.5, mixup_alpha: float=1.0, cutmix_alpha: float=1.0, label_smoothing: float=0.0, num_classes: int=400):...
Implement the Python class `MixVideo` described below. Class description: Stochastically applies either MixUp or CutMix to the input video. Method signatures and docstrings: - def __init__(self, cutmix_prob: float=0.5, mixup_alpha: float=1.0, cutmix_alpha: float=1.0, label_smoothing: float=0.0, num_classes: int=400):...
16f2abf2f8aa174915316007622bbb260215dee8
<|skeleton|> class MixVideo: """Stochastically applies either MixUp or CutMix to the input video.""" def __init__(self, cutmix_prob: float=0.5, mixup_alpha: float=1.0, cutmix_alpha: float=1.0, label_smoothing: float=0.0, num_classes: int=400): """Args: cutmix_prob (float): Probability of using CutMix. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MixVideo: """Stochastically applies either MixUp or CutMix to the input video.""" def __init__(self, cutmix_prob: float=0.5, mixup_alpha: float=1.0, cutmix_alpha: float=1.0, label_smoothing: float=0.0, num_classes: int=400): """Args: cutmix_prob (float): Probability of using CutMix. MixUp will be...
the_stack_v2_python_sparse
pytorchvideo/transforms/mix.py
xchani/pytorchvideo
train
0
fb8950ec16af1f232f6be7b3262e0b8da5413090
[ "super(Application, self).__init__(master)\nself.grid()\nself.create_widgets()", "Label(self, text='Укажите ваш любимый жанр кино.').grid(row=0, column=0, sticky=W)\nLabel(self, text='Выберите ровно 1:').grid(row=1, column=0, sticky=W)\nself.favorite = StringVar()\nself.favorite.set(None)\nRadiobutton(self, text=...
<|body_start_0|> super(Application, self).__init__(master) self.grid() self.create_widgets() <|end_body_0|> <|body_start_1|> Label(self, text='Укажите ваш любимый жанр кино.').grid(row=0, column=0, sticky=W) Label(self, text='Выберите ровно 1:').grid(row=1, column=0, sticky=W) ...
GUI-Приложение, позволяющее выбрать только один жанр
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """GUI-Приложение, позволяющее выбрать только один жанр""" def __init__(self, master): """Инициализируем рамку""" <|body_0|> def create_widgets(self): """Создает элементы, с помощью которых пользователь будет выбирать""" <|body_1|> def u...
stack_v2_sparse_classes_36k_train_032770
2,726
no_license
[ { "docstring": "Инициализируем рамку", "name": "__init__", "signature": "def __init__(self, master)" }, { "docstring": "Создает элементы, с помощью которых пользователь будет выбирать", "name": "create_widgets", "signature": "def create_widgets(self)" }, { "docstring": "Обновляет...
3
stack_v2_sparse_classes_30k_train_015031
Implement the Python class `Application` described below. Class description: GUI-Приложение, позволяющее выбрать только один жанр Method signatures and docstrings: - def __init__(self, master): Инициализируем рамку - def create_widgets(self): Создает элементы, с помощью которых пользователь будет выбирать - def updat...
Implement the Python class `Application` described below. Class description: GUI-Приложение, позволяющее выбрать только один жанр Method signatures and docstrings: - def __init__(self, master): Инициализируем рамку - def create_widgets(self): Создает элементы, с помощью которых пользователь будет выбирать - def updat...
5c3342fca0ad705a7719770894ee2480b62bf593
<|skeleton|> class Application: """GUI-Приложение, позволяющее выбрать только один жанр""" def __init__(self, master): """Инициализируем рамку""" <|body_0|> def create_widgets(self): """Создает элементы, с помощью которых пользователь будет выбирать""" <|body_1|> def u...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Application: """GUI-Приложение, позволяющее выбрать только один жанр""" def __init__(self, master): """Инициализируем рамку""" super(Application, self).__init__(master) self.grid() self.create_widgets() def create_widgets(self): """Создает элементы, с помощью ...
the_stack_v2_python_sparse
Chapter_10/movie_chooser2.py
BlackJin1/FirstProgramm
train
0
a63d3728fdaa2cbdf96e6a4fbb7197237db32968
[ "context = {'ingestion_request_id': ingestion_request_id}\ntry:\n ingestion_request = models.IngestionRequest.objects.get(pk=ingestion_request_id)\nexcept models.IngestionRequest.DoesNotExist:\n return redirect('/data_cube_manager/ingestion/subset')\nfiltering_options = {key: getattr(ingestion_request, key) f...
<|body_start_0|> context = {'ingestion_request_id': ingestion_request_id} try: ingestion_request = models.IngestionRequest.objects.get(pk=ingestion_request_id) except models.IngestionRequest.DoesNotExist: return redirect('/data_cube_manager/ingestion/subset') filt...
Status page for an ingestion request
CheckIngestionRequestStatus
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckIngestionRequestStatus: """Status page for an ingestion request""" def get(self, request, ingestion_request_id): """Check the status of an ingestion request and update the model Returns a rendered html response containing a non-editable form displaying the ingestion request data...
stack_v2_sparse_classes_36k_train_032771
19,958
permissive
[ { "docstring": "Check the status of an ingestion request and update the model Returns a rendered html response containing a non-editable form displaying the ingestion request data, instructions, and a progress bar.", "name": "get", "signature": "def get(self, request, ingestion_request_id)" }, { ...
2
stack_v2_sparse_classes_30k_train_020274
Implement the Python class `CheckIngestionRequestStatus` described below. Class description: Status page for an ingestion request Method signatures and docstrings: - def get(self, request, ingestion_request_id): Check the status of an ingestion request and update the model Returns a rendered html response containing ...
Implement the Python class `CheckIngestionRequestStatus` described below. Class description: Status page for an ingestion request Method signatures and docstrings: - def get(self, request, ingestion_request_id): Check the status of an ingestion request and update the model Returns a rendered html response containing ...
ef50e918df89313f130d735e7cb7c0a069da410e
<|skeleton|> class CheckIngestionRequestStatus: """Status page for an ingestion request""" def get(self, request, ingestion_request_id): """Check the status of an ingestion request and update the model Returns a rendered html response containing a non-editable form displaying the ingestion request data...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CheckIngestionRequestStatus: """Status page for an ingestion request""" def get(self, request, ingestion_request_id): """Check the status of an ingestion request and update the model Returns a rendered html response containing a non-editable form displaying the ingestion request data, instruction...
the_stack_v2_python_sparse
apps/data_cube_manager/views/ingestion.py
ceos-seo/data_cube_ui
train
47
6fdbd4f2ac1a5749953d0d38515d4b7fdf53b04b
[ "super().__init__(n_head, n_feat, dropout_rate)\nself.zero_triu = zero_triu\nself.linear_pos = nn.Linear(n_feat, n_feat, bias_attr=False)\nself.pos_bias_u = paddle.create_parameter(shape=(self.h, self.d_k), dtype='float32', default_initializer=paddle.nn.initializer.XavierUniform())\nself.pos_bias_v = paddle.create_...
<|body_start_0|> super().__init__(n_head, n_feat, dropout_rate) self.zero_triu = zero_triu self.linear_pos = nn.Linear(n_feat, n_feat, bias_attr=False) self.pos_bias_u = paddle.create_parameter(shape=(self.h, self.d_k), dtype='float32', default_initializer=paddle.nn.initializer.XavierUni...
Multi-Head Attention layer with relative position encoding (old version). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate. zero_triu (bool): Wheth...
LegacyRelPositionMultiHeadedAttention
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LegacyRelPositionMultiHeadedAttention: """Multi-Head Attention layer with relative position encoding (old version). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of feat...
stack_v2_sparse_classes_36k_train_032772
13,512
permissive
[ { "docstring": "Construct an RelPositionMultiHeadedAttention object.", "name": "__init__", "signature": "def __init__(self, n_head, n_feat, dropout_rate, zero_triu=False)" }, { "docstring": "Compute relative positional encoding. Args: x(Tensor): Input tensor (batch, head, time1, time2). Returns:...
3
null
Implement the Python class `LegacyRelPositionMultiHeadedAttention` described below. Class description: Multi-Head Attention layer with relative position encoding (old version). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of ...
Implement the Python class `LegacyRelPositionMultiHeadedAttention` described below. Class description: Multi-Head Attention layer with relative position encoding (old version). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of ...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class LegacyRelPositionMultiHeadedAttention: """Multi-Head Attention layer with relative position encoding (old version). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of feat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LegacyRelPositionMultiHeadedAttention: """Multi-Head Attention layer with relative position encoding (old version). Details can be found in https://github.com/espnet/espnet/pull/2816. Paper: https://arxiv.org/abs/1901.02860 Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout...
the_stack_v2_python_sparse
paddlespeech/t2s/modules/transformer/attention.py
anniyanvr/DeepSpeech-1
train
0
0a5c9dc448b7c035fc8fa798f2834cfafa6134e5
[ "while True:\n yield c\npass", "gna = GNA.LinearCongruentialGenerator(seed=seed)\nwhile True:\n u1 = gna.next()\n u2 = gna.next()\n Z = math.sqrt(-2 * math.log(u1))\n if Z1:\n Z *= math.cos(2 * math.pi * u2)\n else:\n Z *= math.sin(2 * math.pi * u2)\n yield (media + desvio_padra...
<|body_start_0|> while True: yield c pass <|end_body_0|> <|body_start_1|> gna = GNA.LinearCongruentialGenerator(seed=seed) while True: u1 = gna.next() u2 = gna.next() Z = math.sqrt(-2 * math.log(u1)) if Z1: Z *=...
Classe responsável pela geração de variáveis aleatórias.
FGVA
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FGVA: """Classe responsável pela geração de variáveis aleatórias.""" def Constante(c): """Criador de um gerador de valores constante. @param c: valor constante a ser retornada pelo gerador. @return: um gerador de valores constantes""" <|body_0|> def Normal(media, desvio_...
stack_v2_sparse_classes_36k_train_032773
3,436
no_license
[ { "docstring": "Criador de um gerador de valores constante. @param c: valor constante a ser retornada pelo gerador. @return: um gerador de valores constantes", "name": "Constante", "signature": "def Constante(c)" }, { "docstring": "Criador de um gerador de valores seguindo uma distribuição norma...
5
stack_v2_sparse_classes_30k_train_005525
Implement the Python class `FGVA` described below. Class description: Classe responsável pela geração de variáveis aleatórias. Method signatures and docstrings: - def Constante(c): Criador de um gerador de valores constante. @param c: valor constante a ser retornada pelo gerador. @return: um gerador de valores consta...
Implement the Python class `FGVA` described below. Class description: Classe responsável pela geração de variáveis aleatórias. Method signatures and docstrings: - def Constante(c): Criador de um gerador de valores constante. @param c: valor constante a ser retornada pelo gerador. @return: um gerador de valores consta...
f914f50ab02f222b13aa35ae2dc0be30ba309925
<|skeleton|> class FGVA: """Classe responsável pela geração de variáveis aleatórias.""" def Constante(c): """Criador de um gerador de valores constante. @param c: valor constante a ser retornada pelo gerador. @return: um gerador de valores constantes""" <|body_0|> def Normal(media, desvio_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FGVA: """Classe responsável pela geração de variáveis aleatórias.""" def Constante(c): """Criador de um gerador de valores constante. @param c: valor constante a ser retornada pelo gerador. @return: um gerador de valores constantes""" while True: yield c pass def ...
the_stack_v2_python_sparse
src/Simulador/FGVA.py
cesarecorrea94/MeS.py
train
0
1169bf240529f94428de44cebaa6591999db49b8
[ "super(DyEmb, self).__init__()\nself.fnames = fnames\nself.max_idxs = max_idxs\nself.embedding_size = embedding_size\nself.use_cuda = use_cuda\nself.embeddings = nn.ModuleList([Meta_Embedding(max_idx + 1, self.embedding_size) for max_idx in self.max_idxs.values()])", "concat_embeddings = []\nfor i, key in enumera...
<|body_start_0|> super(DyEmb, self).__init__() self.fnames = fnames self.max_idxs = max_idxs self.embedding_size = embedding_size self.use_cuda = use_cuda self.embeddings = nn.ModuleList([Meta_Embedding(max_idx + 1, self.embedding_size) for max_idx in self.max_idxs.values...
DyEmb
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DyEmb: def __init__(self, fnames, max_idxs, embedding_size=4, use_cuda=True): """fnames: feature names max_idxs: array of max_idx of each feature embedding_size: size of embedding dropout: prob for dropout, set None if no dropout method: 'avg' or 'sum' use_cuda: bool, True for gpu or Fal...
stack_v2_sparse_classes_36k_train_032774
9,497
permissive
[ { "docstring": "fnames: feature names max_idxs: array of max_idx of each feature embedding_size: size of embedding dropout: prob for dropout, set None if no dropout method: 'avg' or 'sum' use_cuda: bool, True for gpu or False for cpu", "name": "__init__", "signature": "def __init__(self, fnames, max_idx...
2
stack_v2_sparse_classes_30k_train_010176
Implement the Python class `DyEmb` described below. Class description: Implement the DyEmb class. Method signatures and docstrings: - def __init__(self, fnames, max_idxs, embedding_size=4, use_cuda=True): fnames: feature names max_idxs: array of max_idx of each feature embedding_size: size of embedding dropout: prob ...
Implement the Python class `DyEmb` described below. Class description: Implement the DyEmb class. Method signatures and docstrings: - def __init__(self, fnames, max_idxs, embedding_size=4, use_cuda=True): fnames: feature names max_idxs: array of max_idx of each feature embedding_size: size of embedding dropout: prob ...
2969ed6c740d04283aa54af4e2c267cb980c96fe
<|skeleton|> class DyEmb: def __init__(self, fnames, max_idxs, embedding_size=4, use_cuda=True): """fnames: feature names max_idxs: array of max_idx of each feature embedding_size: size of embedding dropout: prob for dropout, set None if no dropout method: 'avg' or 'sum' use_cuda: bool, True for gpu or Fal...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DyEmb: def __init__(self, fnames, max_idxs, embedding_size=4, use_cuda=True): """fnames: feature names max_idxs: array of max_idx of each feature embedding_size: size of embedding dropout: prob for dropout, set None if no dropout method: 'avg' or 'sum' use_cuda: bool, True for gpu or False for cpu""" ...
the_stack_v2_python_sparse
Application/audience expansion/model.py
easezyc/deep-transfer-learning
train
801
c233744f76c41f9d82f1afcc9bce35d9a86f836b
[ "def deal_with_debate(debate, meeting_section=None):\n debate_section = orm.Section.objects.create(title=debate.title, parent=meeting_section, instance=debate.instance, level=0, lft=0, rght=0, tree_id=0)\n for speech in debate.speech_set.all():\n speech.section = debate_section\n speech.save()\n...
<|body_start_0|> def deal_with_debate(debate, meeting_section=None): debate_section = orm.Section.objects.create(title=debate.title, parent=meeting_section, instance=debate.instance, level=0, lft=0, rght=0, tree_id=0) for speech in debate.speech_set.all(): speech.section ...
Migration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def deal_with_debate(debate, meeting_section=None)...
stack_v2_sparse_classes_36k_train_032775
14,216
no_license
[ { "docstring": "Write your forwards methods here.", "name": "forwards", "signature": "def forwards(self, orm)" }, { "docstring": "Write your backwards methods here.", "name": "backwards", "signature": "def backwards(self, orm)" } ]
2
stack_v2_sparse_classes_30k_train_017200
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here.
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here. <|skeleton|> class Migration: def forwards(self,...
ff5f41ba62f50060641b0d5955e2be96b559321b
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Migration: def forwards(self, orm): """Write your forwards methods here.""" def deal_with_debate(debate, meeting_section=None): debate_section = orm.Section.objects.create(title=debate.title, parent=meeting_section, instance=debate.instance, level=0, lft=0, rght=0, tree_id=0) ...
the_stack_v2_python_sparse
speeches/south_migrations/0024_create_sections_from_meetings_and_debates.py
KohoVolit/sayit.parldata.eu
train
1
f5de43e4ee5fb189bcbfceb7e487bd84451c45ec
[ "print('Нужно ввести метод для поиска нового локатора (id/xpath...) !!!')\nglobal method\nwhile True:\n for cmd in ['Quit - Закрыть и не добавлять данные', 'YES - Добавить данные']:\n print(' %s - %s' % (cmd[:1], cmd))\n cmd = input('Пожалуйста, введите команду (Q/Y) ').upper()[:1]\n if cmd == 'Q':...
<|body_start_0|> print('Нужно ввести метод для поиска нового локатора (id/xpath...) !!!') global method while True: for cmd in ['Quit - Закрыть и не добавлять данные', 'YES - Добавить данные']: print(' %s - %s' % (cmd[:1], cmd)) cmd = input('Пожалуйста, в...
DataBaseInterface
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataBaseInterface: def set_method(self, table_name: str, key: str): """Запись метода для поиска локатора в таблицу :param table_name: название таблицы :param key: ключ (название элемента) :rtype str :return: метод для поиска локатора""" <|body_0|> def set_value(self, table_n...
stack_v2_sparse_classes_36k_train_032776
2,667
no_license
[ { "docstring": "Запись метода для поиска локатора в таблицу :param table_name: название таблицы :param key: ключ (название элемента) :rtype str :return: метод для поиска локатора", "name": "set_method", "signature": "def set_method(self, table_name: str, key: str)" }, { "docstring": "Запись знач...
2
stack_v2_sparse_classes_30k_train_006811
Implement the Python class `DataBaseInterface` described below. Class description: Implement the DataBaseInterface class. Method signatures and docstrings: - def set_method(self, table_name: str, key: str): Запись метода для поиска локатора в таблицу :param table_name: название таблицы :param key: ключ (название элем...
Implement the Python class `DataBaseInterface` described below. Class description: Implement the DataBaseInterface class. Method signatures and docstrings: - def set_method(self, table_name: str, key: str): Запись метода для поиска локатора в таблицу :param table_name: название таблицы :param key: ключ (название элем...
3eabb10c2aff74c4808bd0476c2622c01e491350
<|skeleton|> class DataBaseInterface: def set_method(self, table_name: str, key: str): """Запись метода для поиска локатора в таблицу :param table_name: название таблицы :param key: ключ (название элемента) :rtype str :return: метод для поиска локатора""" <|body_0|> def set_value(self, table_n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataBaseInterface: def set_method(self, table_name: str, key: str): """Запись метода для поиска локатора в таблицу :param table_name: название таблицы :param key: ключ (название элемента) :rtype str :return: метод для поиска локатора""" print('Нужно ввести метод для поиска нового локатора (id/...
the_stack_v2_python_sparse
mobileAutoTestsBasicFramework/model/database_model/database_interface.py
Yelisey/testsAppPy
train
0
9fa6c0d4f132f0be7c7556c0df79074321a0411d
[ "super(FastRCNN, self).__init__()\nself.classifier = classifier\nself.cls_layer = nn.Linear(4096, n_class)\nself.reg_layer = nn.Linear(4096, n_class * 4)\nnormal_init(self.cls_layer, mean=0, stddev=0.001)\nnormal_init(self.reg_layer, mean=0, stddev=0.01)\nself.n_class = n_class\nself.roi_size = roi_size\nself.spati...
<|body_start_0|> super(FastRCNN, self).__init__() self.classifier = classifier self.cls_layer = nn.Linear(4096, n_class) self.reg_layer = nn.Linear(4096, n_class * 4) normal_init(self.cls_layer, mean=0, stddev=0.001) normal_init(self.reg_layer, mean=0, stddev=0.01) ...
FastRCNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FastRCNN: def __init__(self, n_class, roi_size, spatial_scale, classifier): """function description: 将rpn网络提供的roi"投射"到vgg16的featuremap上, 进行相应的切割并maxpooling(RoI maxpooling), 再将其展开从2d变为1d,投入两个fc层,然后再分别带入两个分支fc层,作为cls和reg的输出 :param n_class: 分类的总数 :param roi_size: RoIPooling2D之后的维度 :param sp...
stack_v2_sparse_classes_36k_train_032777
2,637
no_license
[ { "docstring": "function description: 将rpn网络提供的roi\"投射\"到vgg16的featuremap上, 进行相应的切割并maxpooling(RoI maxpooling), 再将其展开从2d变为1d,投入两个fc层,然后再分别带入两个分支fc层,作为cls和reg的输出 :param n_class: 分类的总数 :param roi_size: RoIPooling2D之后的维度 :param spatial_scale: roi(rpn推荐的区域-原图上的区域)投射在feature map后需要缩小的比例, 这个个人感觉应该对应感受野大小 :param class...
2
stack_v2_sparse_classes_30k_train_005455
Implement the Python class `FastRCNN` described below. Class description: Implement the FastRCNN class. Method signatures and docstrings: - def __init__(self, n_class, roi_size, spatial_scale, classifier): function description: 将rpn网络提供的roi"投射"到vgg16的featuremap上, 进行相应的切割并maxpooling(RoI maxpooling), 再将其展开从2d变为1d,投入两个f...
Implement the Python class `FastRCNN` described below. Class description: Implement the FastRCNN class. Method signatures and docstrings: - def __init__(self, n_class, roi_size, spatial_scale, classifier): function description: 将rpn网络提供的roi"投射"到vgg16的featuremap上, 进行相应的切割并maxpooling(RoI maxpooling), 再将其展开从2d变为1d,投入两个f...
b4fb6ff7af6c9f906eabd836c6727ab7d9f18576
<|skeleton|> class FastRCNN: def __init__(self, n_class, roi_size, spatial_scale, classifier): """function description: 将rpn网络提供的roi"投射"到vgg16的featuremap上, 进行相应的切割并maxpooling(RoI maxpooling), 再将其展开从2d变为1d,投入两个fc层,然后再分别带入两个分支fc层,作为cls和reg的输出 :param n_class: 分类的总数 :param roi_size: RoIPooling2D之后的维度 :param sp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FastRCNN: def __init__(self, n_class, roi_size, spatial_scale, classifier): """function description: 将rpn网络提供的roi"投射"到vgg16的featuremap上, 进行相应的切割并maxpooling(RoI maxpooling), 再将其展开从2d变为1d,投入两个fc层,然后再分别带入两个分支fc层,作为cls和reg的输出 :param n_class: 分类的总数 :param roi_size: RoIPooling2D之后的维度 :param spatial_scale: r...
the_stack_v2_python_sparse
nets/fast_rcnn.py
xiguanlezz/Faster-RCNN
train
13
b5773deb1210f2b601be84ad429209722783a316
[ "with self.Session() as session:\n if stream_id is not None:\n s = session.scalars(Stream.select(session.user_or_token).where(Stream.id == stream_id)).first()\n if s is None:\n return self.error(f'Could not retrieve stream with ID {stream_id}.')\n return self.success(data=s)\n ...
<|body_start_0|> with self.Session() as session: if stream_id is not None: s = session.scalars(Stream.select(session.user_or_token).where(Stream.id == stream_id)).first() if s is None: return self.error(f'Could not retrieve stream with ID {stream_i...
StreamHandler
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StreamHandler: def get(self, stream_id=None): """--- single: description: Retrieve a stream tags: - streams parameters: - in: path name: filter_id required: true schema: type: integer responses: 200: content: application/json: schema: SingleStream 400: content: application/json: schema: ...
stack_v2_sparse_classes_36k_train_032778
8,804
permissive
[ { "docstring": "--- single: description: Retrieve a stream tags: - streams parameters: - in: path name: filter_id required: true schema: type: integer responses: 200: content: application/json: schema: SingleStream 400: content: application/json: schema: Error multiple: description: Retrieve all streams tags: -...
4
null
Implement the Python class `StreamHandler` described below. Class description: Implement the StreamHandler class. Method signatures and docstrings: - def get(self, stream_id=None): --- single: description: Retrieve a stream tags: - streams parameters: - in: path name: filter_id required: true schema: type: integer re...
Implement the Python class `StreamHandler` described below. Class description: Implement the StreamHandler class. Method signatures and docstrings: - def get(self, stream_id=None): --- single: description: Retrieve a stream tags: - streams parameters: - in: path name: filter_id required: true schema: type: integer re...
161d3532ba3ba059446addcdac58ca96f39e9636
<|skeleton|> class StreamHandler: def get(self, stream_id=None): """--- single: description: Retrieve a stream tags: - streams parameters: - in: path name: filter_id required: true schema: type: integer responses: 200: content: application/json: schema: SingleStream 400: content: application/json: schema: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StreamHandler: def get(self, stream_id=None): """--- single: description: Retrieve a stream tags: - streams parameters: - in: path name: filter_id required: true schema: type: integer responses: 200: content: application/json: schema: SingleStream 400: content: application/json: schema: Error multiple...
the_stack_v2_python_sparse
skyportal/handlers/api/stream.py
skyportal/skyportal
train
80
697041b720df1090f140541e32552ce907a3e02f
[ "A, B = (set([0]), set(graph[0]))\ni = 1\nwhile i < len(graph):\n if i in A or any((node in B for node in graph[i])):\n A.add(i)\n B.update(graph[i])\n else:\n B.add(i)\n A.update(graph[i])\n i += 1\n if A & B:\n return False\nreturn True", "states = {}\nfor node in ...
<|body_start_0|> A, B = (set([0]), set(graph[0])) i = 1 while i < len(graph): if i in A or any((node in B for node in graph[i])): A.add(i) B.update(graph[i]) else: B.add(i) A.update(graph[i]) i +=...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isBipartite_2(self, graph: List[List[int]]) -> bool: """将节点i和其连接点集graph[i],依次添加到不同的两个集合,这两个集合不应该相交! TODO: 解答错误""" <|body_0|> def isBipartite(self, graph: List[List[int]]) -> bool: """记录节点属于集合A还是集合B""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_032779
3,274
no_license
[ { "docstring": "将节点i和其连接点集graph[i],依次添加到不同的两个集合,这两个集合不应该相交! TODO: 解答错误", "name": "isBipartite_2", "signature": "def isBipartite_2(self, graph: List[List[int]]) -> bool" }, { "docstring": "记录节点属于集合A还是集合B", "name": "isBipartite", "signature": "def isBipartite(self, graph: List[List[int]]) ...
2
stack_v2_sparse_classes_30k_train_001727
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBipartite_2(self, graph: List[List[int]]) -> bool: 将节点i和其连接点集graph[i],依次添加到不同的两个集合,这两个集合不应该相交! TODO: 解答错误 - def isBipartite(self, graph: List[List[int]]) -> bool: 记录节点属于集合A...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBipartite_2(self, graph: List[List[int]]) -> bool: 将节点i和其连接点集graph[i],依次添加到不同的两个集合,这两个集合不应该相交! TODO: 解答错误 - def isBipartite(self, graph: List[List[int]]) -> bool: 记录节点属于集合A...
4732fb80710a08a715c3e7080c394f5298b8326d
<|skeleton|> class Solution: def isBipartite_2(self, graph: List[List[int]]) -> bool: """将节点i和其连接点集graph[i],依次添加到不同的两个集合,这两个集合不应该相交! TODO: 解答错误""" <|body_0|> def isBipartite(self, graph: List[List[int]]) -> bool: """记录节点属于集合A还是集合B""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isBipartite_2(self, graph: List[List[int]]) -> bool: """将节点i和其连接点集graph[i],依次添加到不同的两个集合,这两个集合不应该相交! TODO: 解答错误""" A, B = (set([0]), set(graph[0])) i = 1 while i < len(graph): if i in A or any((node in B for node in graph[i])): A.add(i) ...
the_stack_v2_python_sparse
.leetcode/785.判断二分图.py
xiaoruijiang/algorithm
train
0
bd9567adb5d9eea689f47afbbf8733a5aeb6d267
[ "self.end_time = end_time\nself.error_message = error_message\nself.execution_start_time_usecs = execution_start_time_usecs\nself.files_processed = files_processed\nself.map_done_time_usecs = map_done_time_usecs\nself.map_input_bytes = map_input_bytes\nself.mappers_spawned = mappers_spawned\nself.num_map_outputs = ...
<|body_start_0|> self.end_time = end_time self.error_message = error_message self.execution_start_time_usecs = execution_start_time_usecs self.files_processed = files_processed self.map_done_time_usecs = map_done_time_usecs self.map_input_bytes = map_input_bytes s...
Implementation of the 'MapReduceInstance_RunInfo' model. TODO: type description here. Attributes: end_time (long|int): Time when map redcue job completed. error_message (string): If this run failed, then error message for failure. execution_start_time_usecs (long|int): Time (in usecs) when job was picked up for executi...
MapReduceInstance_RunInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MapReduceInstance_RunInfo: """Implementation of the 'MapReduceInstance_RunInfo' model. TODO: type description here. Attributes: end_time (long|int): Time when map redcue job completed. error_message (string): If this run failed, then error message for failure. execution_start_time_usecs (long|int...
stack_v2_sparse_classes_36k_train_032780
6,787
permissive
[ { "docstring": "Constructor for the MapReduceInstance_RunInfo class", "name": "__init__", "signature": "def __init__(self, end_time=None, error_message=None, execution_start_time_usecs=None, files_processed=None, map_done_time_usecs=None, map_input_bytes=None, mappers_spawned=None, num_map_outputs=None,...
2
stack_v2_sparse_classes_30k_train_003527
Implement the Python class `MapReduceInstance_RunInfo` described below. Class description: Implementation of the 'MapReduceInstance_RunInfo' model. TODO: type description here. Attributes: end_time (long|int): Time when map redcue job completed. error_message (string): If this run failed, then error message for failur...
Implement the Python class `MapReduceInstance_RunInfo` described below. Class description: Implementation of the 'MapReduceInstance_RunInfo' model. TODO: type description here. Attributes: end_time (long|int): Time when map redcue job completed. error_message (string): If this run failed, then error message for failur...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class MapReduceInstance_RunInfo: """Implementation of the 'MapReduceInstance_RunInfo' model. TODO: type description here. Attributes: end_time (long|int): Time when map redcue job completed. error_message (string): If this run failed, then error message for failure. execution_start_time_usecs (long|int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MapReduceInstance_RunInfo: """Implementation of the 'MapReduceInstance_RunInfo' model. TODO: type description here. Attributes: end_time (long|int): Time when map redcue job completed. error_message (string): If this run failed, then error message for failure. execution_start_time_usecs (long|int): Time (in u...
the_stack_v2_python_sparse
cohesity_management_sdk/models/map_reduce_instance_run_info.py
cohesity/management-sdk-python
train
24
57ce33e2220b93272686d53ce7fc3ad0fbab6886
[ "self.config = ConfigUtil.ConfigUtil()\nself.config.loadConfigData()\nself.actuator = ActuatorData.ActuatorData()\nself.actuator.setName('Temperature Actuator Data')\nself.actuatorAdapter = MultiActuatorAdapter.MultiActuatorAdapter()\nself.smtpConnector = SmtpClientConnector.MyClass()", "if type(sensor_data) != S...
<|body_start_0|> self.config = ConfigUtil.ConfigUtil() self.config.loadConfigData() self.actuator = ActuatorData.ActuatorData() self.actuator.setName('Temperature Actuator Data') self.actuatorAdapter = MultiActuatorAdapter.MultiActuatorAdapter() self.smtpConnector = SmtpC...
This class is responsible for Managing the SensorData instance This class reads a SensorData instance and then changes an ActuatorData instance as required, and then proceeds to Actuate using the ActuatorAdapter
SensorDataManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SensorDataManager: """This class is responsible for Managing the SensorData instance This class reads a SensorData instance and then changes an ActuatorData instance as required, and then proceeds to Actuate using the ActuatorAdapter""" def __init__(self): """Constructor""" <...
stack_v2_sparse_classes_36k_train_032781
3,774
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Function to handle and parse the data stored in an SensorData instance Takes a sensorData instance and the mail body string as input", "name": "handleSensorData", "signature": "def hand...
3
null
Implement the Python class `SensorDataManager` described below. Class description: This class is responsible for Managing the SensorData instance This class reads a SensorData instance and then changes an ActuatorData instance as required, and then proceeds to Actuate using the ActuatorAdapter Method signatures and d...
Implement the Python class `SensorDataManager` described below. Class description: This class is responsible for Managing the SensorData instance This class reads a SensorData instance and then changes an ActuatorData instance as required, and then proceeds to Actuate using the ActuatorAdapter Method signatures and d...
dfd5fd8c757cae8b1306ae3e4eb2cfc9bf124fee
<|skeleton|> class SensorDataManager: """This class is responsible for Managing the SensorData instance This class reads a SensorData instance and then changes an ActuatorData instance as required, and then proceeds to Actuate using the ActuatorAdapter""" def __init__(self): """Constructor""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SensorDataManager: """This class is responsible for Managing the SensorData instance This class reads a SensorData instance and then changes an ActuatorData instance as required, and then proceeds to Actuate using the ActuatorAdapter""" def __init__(self): """Constructor""" self.config = ...
the_stack_v2_python_sparse
apps/labs/module04/SensorDataManager.py
mnk400/iot-device
train
0
dca124a6c768faea689a05d8c1dffc3f670b8467
[ "super(DecoderBlock, self).__init__()\nself.mha1 = MultiHeadAttention(dm, h)\nself.mha2 = MultiHeadAttention(dm, h)\nself.dense_hidden = tf.keras.layers.Dense(units=hidden, activation='relu')\nself.dense_output = tf.keras.layers.Dense(units=dm)\nself.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\ns...
<|body_start_0|> super(DecoderBlock, self).__init__() self.mha1 = MultiHeadAttention(dm, h) self.mha2 = MultiHeadAttention(dm, h) self.dense_hidden = tf.keras.layers.Dense(units=hidden, activation='relu') self.dense_output = tf.keras.layers.Dense(units=dm) self.layernorm1...
Class representation of a decoder block for a transformer
DecoderBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderBlock: """Class representation of a decoder block for a transformer""" def __init__(self, dm, h, hidden, drop_rate=0.1): """dm: Dimensionality of the model h: Number of heads hidden: Number of hidden units in the fully connected layer drop_rate: Dropout rate""" <|body_...
stack_v2_sparse_classes_36k_train_032782
2,892
no_license
[ { "docstring": "dm: Dimensionality of the model h: Number of heads hidden: Number of hidden units in the fully connected layer drop_rate: Dropout rate", "name": "__init__", "signature": "def __init__(self, dm, h, hidden, drop_rate=0.1)" }, { "docstring": "x: tensor of shape (batch, target_seq_le...
2
stack_v2_sparse_classes_30k_train_004180
Implement the Python class `DecoderBlock` described below. Class description: Class representation of a decoder block for a transformer Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): dm: Dimensionality of the model h: Number of heads hidden: Number of hidden units in the fully c...
Implement the Python class `DecoderBlock` described below. Class description: Class representation of a decoder block for a transformer Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): dm: Dimensionality of the model h: Number of heads hidden: Number of hidden units in the fully c...
2757c8526290197d45a4de33cda71e686ddcbf1c
<|skeleton|> class DecoderBlock: """Class representation of a decoder block for a transformer""" def __init__(self, dm, h, hidden, drop_rate=0.1): """dm: Dimensionality of the model h: Number of heads hidden: Number of hidden units in the fully connected layer drop_rate: Dropout rate""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecoderBlock: """Class representation of a decoder block for a transformer""" def __init__(self, dm, h, hidden, drop_rate=0.1): """dm: Dimensionality of the model h: Number of heads hidden: Number of hidden units in the fully connected layer drop_rate: Dropout rate""" super(DecoderBlock, ...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/8-transformer_decoder_block.py
95ktsmith/holbertonschool-machine_learning
train
0
33f01f6a41f63f4a22c9c3457d71ed2d44853e5e
[ "super(InTriggerRegion, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._actor = actor\nself._min_x = min_x\nself._max_x = max_x\nself._min_y = min_y\nself._max_y = max_y", "new_status = py_trees.common.Status.RUNNING\nlocation = CarlaDataProvider.get_location(self._actor)...
<|body_start_0|> super(InTriggerRegion, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._actor = actor self._min_x = min_x self._max_x = max_x self._min_y = min_y self._max_y = max_y <|end_body_0|> <|body_start_1|> n...
This class contains the trigger region (condition) of a scenario
InTriggerRegion
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InTriggerRegion: """This class contains the trigger region (condition) of a scenario""" def __init__(self, actor, min_x, max_x, min_y, max_y, name='TriggerRegion'): """Setup trigger region (rectangle provided by [min_x,min_y] and [max_x,max_y]""" <|body_0|> def update(se...
stack_v2_sparse_classes_36k_train_032783
25,380
permissive
[ { "docstring": "Setup trigger region (rectangle provided by [min_x,min_y] and [max_x,max_y]", "name": "__init__", "signature": "def __init__(self, actor, min_x, max_x, min_y, max_y, name='TriggerRegion')" }, { "docstring": "Check if the _actor location is within trigger region", "name": "upd...
2
stack_v2_sparse_classes_30k_train_006262
Implement the Python class `InTriggerRegion` described below. Class description: This class contains the trigger region (condition) of a scenario Method signatures and docstrings: - def __init__(self, actor, min_x, max_x, min_y, max_y, name='TriggerRegion'): Setup trigger region (rectangle provided by [min_x,min_y] a...
Implement the Python class `InTriggerRegion` described below. Class description: This class contains the trigger region (condition) of a scenario Method signatures and docstrings: - def __init__(self, actor, min_x, max_x, min_y, max_y, name='TriggerRegion'): Setup trigger region (rectangle provided by [min_x,min_y] a...
1d3e8339f8e60f7bdcaefeff49ec238b1746b047
<|skeleton|> class InTriggerRegion: """This class contains the trigger region (condition) of a scenario""" def __init__(self, actor, min_x, max_x, min_y, max_y, name='TriggerRegion'): """Setup trigger region (rectangle provided by [min_x,min_y] and [max_x,max_y]""" <|body_0|> def update(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InTriggerRegion: """This class contains the trigger region (condition) of a scenario""" def __init__(self, actor, min_x, max_x, min_y, max_y, name='TriggerRegion'): """Setup trigger region (rectangle provided by [min_x,min_y] and [max_x,max_y]""" super(InTriggerRegion, self).__init__(name...
the_stack_v2_python_sparse
srunner/scenariomanager/atomic_scenario_behavior.py
chauvinSimon/scenario_runner
train
2
7effc7c8715224ecc8e03e5a3a3ba5c3d36b2db8
[ "self.logger = logging.getLogger(__name__)\nself.username = username\nself.url = url\nself.automatic_login_url = urljoin(self.url, AUTOMATIC_LOGIN_POSTFIX)\nself.interactive_login_url = urljoin(self.url, INTERACTIVE_LOGIN_POSTFIX)\nif not interactive and (username is None or password is None):\n return\nif usern...
<|body_start_0|> self.logger = logging.getLogger(__name__) self.username = username self.url = url self.automatic_login_url = urljoin(self.url, AUTOMATIC_LOGIN_POSTFIX) self.interactive_login_url = urljoin(self.url, INTERACTIVE_LOGIN_POSTFIX) if not interactive and (usern...
HTTP Resolwe Authentication for Request object. :param str username: user's email :param str password: user's password :param str url: Resolwe server address :param str cookies: user's sessionid and csrftoken cookies
ResAuth
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResAuth: """HTTP Resolwe Authentication for Request object. :param str username: user's email :param str password: user's password :param str url: Resolwe server address :param str cookies: user's sessionid and csrftoken cookies""" def __init__(self, username: Optional[str]=None, password: O...
stack_v2_sparse_classes_36k_train_032784
20,535
permissive
[ { "docstring": "Authenticate user on Resolwe server.", "name": "__init__", "signature": "def __init__(self, username: Optional[str]=None, password: Optional[str]=None, url: str=DEFAULT_URL, interactive: bool=False)" }, { "docstring": "Attempt to perform automatic SAML login. :returns: authentica...
4
stack_v2_sparse_classes_30k_train_006750
Implement the Python class `ResAuth` described below. Class description: HTTP Resolwe Authentication for Request object. :param str username: user's email :param str password: user's password :param str url: Resolwe server address :param str cookies: user's sessionid and csrftoken cookies Method signatures and docstr...
Implement the Python class `ResAuth` described below. Class description: HTTP Resolwe Authentication for Request object. :param str username: user's email :param str password: user's password :param str url: Resolwe server address :param str cookies: user's sessionid and csrftoken cookies Method signatures and docstr...
eecd829f3a4bd2868493486f91f198ae0f449830
<|skeleton|> class ResAuth: """HTTP Resolwe Authentication for Request object. :param str username: user's email :param str password: user's password :param str url: Resolwe server address :param str cookies: user's sessionid and csrftoken cookies""" def __init__(self, username: Optional[str]=None, password: O...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResAuth: """HTTP Resolwe Authentication for Request object. :param str username: user's email :param str password: user's password :param str url: Resolwe server address :param str cookies: user's sessionid and csrftoken cookies""" def __init__(self, username: Optional[str]=None, password: Optional[str]=...
the_stack_v2_python_sparse
src/resdk/resolwe.py
genialis/resolwe-bio-py
train
4
a66d7e55d9d8a0d1ef4be039653a7afbe3d3ed21
[ "self.relaxed = relaxed\nself.structType = structType\nself.interstitType = interstitType\nself.cellDims = cellDims\nself.runCalcs = runCalcs", "cellStr = '_'.join([str(x) for x in self.cellDims])\noutObj = refDataStruct.getSelfInterstitialPlaneWaveStruct(self.structType, self.interstitType, self.relaxed, cellStr...
<|body_start_0|> self.relaxed = relaxed self.structType = structType self.interstitType = interstitType self.cellDims = cellDims self.runCalcs = runCalcs <|end_body_0|> <|body_start_1|> cellStr = '_'.join([str(x) for x in self.cellDims]) outObj = refDataStruct.ge...
Defines a type of interstitial independent of element and method used.
InterstitialType
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterstitialType: """Defines a type of interstitial independent of element and method used.""" def __init__(self, relaxed, structType, interstitType, cellDims, runCalcs): """Description of function Args: relaxed: str, unrelaxed/relaxed_constant_p/relaxed_constant_v structType: str, t...
stack_v2_sparse_classes_36k_train_032785
5,576
no_license
[ { "docstring": "Description of function Args: relaxed: str, unrelaxed/relaxed_constant_p/relaxed_constant_v structType: str, the base crystal type (hcp/bcc/fcc) interstitType: str describing the deformation (e.g. octahedral) cellDims: iter(3 element), number of unit cells in each direction runCalcs: Bool, Wheth...
2
null
Implement the Python class `InterstitialType` described below. Class description: Defines a type of interstitial independent of element and method used. Method signatures and docstrings: - def __init__(self, relaxed, structType, interstitType, cellDims, runCalcs): Description of function Args: relaxed: str, unrelaxed...
Implement the Python class `InterstitialType` described below. Class description: Defines a type of interstitial independent of element and method used. Method signatures and docstrings: - def __init__(self, relaxed, structType, interstitType, cellDims, runCalcs): Description of function Args: relaxed: str, unrelaxed...
8469a51c1580b923ca35a56811e92c065b424d68
<|skeleton|> class InterstitialType: """Defines a type of interstitial independent of element and method used.""" def __init__(self, relaxed, structType, interstitType, cellDims, runCalcs): """Description of function Args: relaxed: str, unrelaxed/relaxed_constant_p/relaxed_constant_v structType: str, t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InterstitialType: """Defines a type of interstitial independent of element and method used.""" def __init__(self, relaxed, structType, interstitType, cellDims, runCalcs): """Description of function Args: relaxed: str, unrelaxed/relaxed_constant_p/relaxed_constant_v structType: str, the base cryst...
the_stack_v2_python_sparse
gen_basis_helpers/job_utils/interstit_helpers.py
RFogarty1/plato_gen_basis_helpers
train
3
7353c6d9d00e879cdbfdee5e340d9f3b6c4bacda
[ "if self.power == 1 and (not self.is_conjugated()) and self.is_transposed():\n return PowerMatrixGate.T(self, inplace=inplace)\nelse:\n return PowerMatrixGate.conj(self, inplace=inplace)", "if self.power == 1 and self.is_conjugated() and (not self.is_transposed()):\n return PowerMatrixGate.conj(self, inp...
<|body_start_0|> if self.power == 1 and (not self.is_conjugated()) and self.is_transposed(): return PowerMatrixGate.T(self, inplace=inplace) else: return PowerMatrixGate.conj(self, inplace=inplace) <|end_body_0|> <|body_start_1|> if self.power == 1 and self.is_conjugated...
SelfAdjointUnitaryGate
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelfAdjointUnitaryGate: def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: """Apply conjugation to self.matrix().""" <|body_0|> def T(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: """Apply transposition to self.matrix().""" <|body_1|...
stack_v2_sparse_classes_36k_train_032786
31,759
permissive
[ { "docstring": "Apply conjugation to self.matrix().", "name": "conj", "signature": "def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate" }, { "docstring": "Apply transposition to self.matrix().", "name": "T", "signature": "def T(self, *, inplace: bool=False) -> SelfAdjointUn...
3
stack_v2_sparse_classes_30k_train_010938
Implement the Python class `SelfAdjointUnitaryGate` described below. Class description: Implement the SelfAdjointUnitaryGate class. Method signatures and docstrings: - def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: Apply conjugation to self.matrix(). - def T(self, *, inplace: bool=False) -> SelfAdj...
Implement the Python class `SelfAdjointUnitaryGate` described below. Class description: Implement the SelfAdjointUnitaryGate class. Method signatures and docstrings: - def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: Apply conjugation to self.matrix(). - def T(self, *, inplace: bool=False) -> SelfAdj...
42f2998a059e5615dce6ccdbf7ae6dc4954bbce9
<|skeleton|> class SelfAdjointUnitaryGate: def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: """Apply conjugation to self.matrix().""" <|body_0|> def T(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: """Apply transposition to self.matrix().""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SelfAdjointUnitaryGate: def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: """Apply conjugation to self.matrix().""" if self.power == 1 and (not self.is_conjugated()) and self.is_transposed(): return PowerMatrixGate.T(self, inplace=inplace) else: ...
the_stack_v2_python_sparse
hybridq/gate/property.py
jsmarsha11/hybridq-nasa
train
0
4056743ea5fa42f82439e8c8c0ab8eb0d8410d83
[ "logger.debug('Get repo: %s/%s permissions for team %s', namespace_name, repository_name, teamname)\nrole = model.get_repo_role_for_team(teamname, namespace_name, repository_name)\nreturn role.to_dict()", "new_permission = request.get_json()\nlogger.debug('Setting permission to: %s for team %s', new_permission['r...
<|body_start_0|> logger.debug('Get repo: %s/%s permissions for team %s', namespace_name, repository_name, teamname) role = model.get_repo_role_for_team(teamname, namespace_name, repository_name) return role.to_dict() <|end_body_0|> <|body_start_1|> new_permission = request.get_json() ...
Resource for managing individual team permissions.
RepositoryTeamPermission
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RepositoryTeamPermission: """Resource for managing individual team permissions.""" def get(self, namespace_name, repository_name, teamname): """Fetch the permission for the specified team.""" <|body_0|> def put(self, namespace_name, repository_name, teamname): ""...
stack_v2_sparse_classes_36k_train_032787
8,862
permissive
[ { "docstring": "Fetch the permission for the specified team.", "name": "get", "signature": "def get(self, namespace_name, repository_name, teamname)" }, { "docstring": "Update the existing team permission.", "name": "put", "signature": "def put(self, namespace_name, repository_name, team...
3
stack_v2_sparse_classes_30k_train_013800
Implement the Python class `RepositoryTeamPermission` described below. Class description: Resource for managing individual team permissions. Method signatures and docstrings: - def get(self, namespace_name, repository_name, teamname): Fetch the permission for the specified team. - def put(self, namespace_name, reposi...
Implement the Python class `RepositoryTeamPermission` described below. Class description: Resource for managing individual team permissions. Method signatures and docstrings: - def get(self, namespace_name, repository_name, teamname): Fetch the permission for the specified team. - def put(self, namespace_name, reposi...
e400a0c22c5f89dd35d571654b13d262b1f6e3b3
<|skeleton|> class RepositoryTeamPermission: """Resource for managing individual team permissions.""" def get(self, namespace_name, repository_name, teamname): """Fetch the permission for the specified team.""" <|body_0|> def put(self, namespace_name, repository_name, teamname): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RepositoryTeamPermission: """Resource for managing individual team permissions.""" def get(self, namespace_name, repository_name, teamname): """Fetch the permission for the specified team.""" logger.debug('Get repo: %s/%s permissions for team %s', namespace_name, repository_name, teamname...
the_stack_v2_python_sparse
endpoints/api/permission.py
quay/quay
train
2,363
c62b12a839f4f1e3fd0300a39c350181e8f54eaf
[ "parser = VisParser()\ntree = parser.parse(vis_expr)\nsecret_tree = SecretVisTree(tree.root, vis_expr, secret=secret)\nsecret_tree.compute_shares()\nSecretVisTreeEncryptor._encrypt_secret_shares(secret_tree.root, key_container, leaf_class)\nreturn secret_tree.print_shares(encrypted=True)", "if node.type == NodeTy...
<|body_start_0|> parser = VisParser() tree = parser.parse(vis_expr) secret_tree = SecretVisTree(tree.root, vis_expr, secret=secret) secret_tree.compute_shares() SecretVisTreeEncryptor._encrypt_secret_shares(secret_tree.root, key_container, leaf_class) return secret_tree.p...
Logic for dealing with secret sharing according to visibility labels, this includes encrypting and decrypting shares: To encrypt: Build it from an existing visibility tree with a chosen secret to share. Then it is possible to call encrypt on the visibility tree to encrypt the shares under corresponding attributes. This...
SecretVisTreeEncryptor
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecretVisTreeEncryptor: """Logic for dealing with secret sharing according to visibility labels, this includes encrypting and decrypting shares: To encrypt: Build it from an existing visibility tree with a chosen secret to share. Then it is possible to call encrypt on the visibility tree to encry...
stack_v2_sparse_classes_36k_train_032788
24,145
permissive
[ { "docstring": "Arguments: vis_expr - (string) vis_expr to be parsed and shares created secret - (bytestring) the secret to be shared key_container - (Keytor) key_id for the particular algorithm and key_object to look up keys. Throws PKILookupError if the algorithm or attribute is not present for that particula...
4
null
Implement the Python class `SecretVisTreeEncryptor` described below. Class description: Logic for dealing with secret sharing according to visibility labels, this includes encrypting and decrypting shares: To encrypt: Build it from an existing visibility tree with a chosen secret to share. Then it is possible to call ...
Implement the Python class `SecretVisTreeEncryptor` described below. Class description: Logic for dealing with secret sharing according to visibility labels, this includes encrypting and decrypting shares: To encrypt: Build it from an existing visibility tree with a chosen secret to share. Then it is possible to call ...
eb61250886e51647bd1edb6d8f4fa7f83eb0bc81
<|skeleton|> class SecretVisTreeEncryptor: """Logic for dealing with secret sharing according to visibility labels, this includes encrypting and decrypting shares: To encrypt: Build it from an existing visibility tree with a chosen secret to share. Then it is possible to call encrypt on the visibility tree to encry...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SecretVisTreeEncryptor: """Logic for dealing with secret sharing according to visibility labels, this includes encrypting and decrypting shares: To encrypt: Build it from an existing visibility tree with a chosen secret to share. Then it is possible to call encrypt on the visibility tree to encrypt the shares...
the_stack_v2_python_sparse
pace/encryption/visibility/secret_vis_tree.py
Global-localhost/PACE-python
train
0
8ac9f8f9d927ebde91f4997c243e4d86a77c005f
[ "sex_string = self.sex\nif sex_string == '1':\n return 'male'\nelif sex_string == '2':\n return 'female'\nelse:\n return 'unknown'", "phenotype = self.phenotype\nif phenotype == '1':\n return False\nelif phenotype == '2':\n return True\nelse:\n return False" ]
<|body_start_0|> sex_string = self.sex if sex_string == '1': return 'male' elif sex_string == '2': return 'female' else: return 'unknown' <|end_body_0|> <|body_start_1|> phenotype = self.phenotype if phenotype == '1': retur...
PedigreeHumanMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PedigreeHumanMixin: def sex_human(self): """Return a human readable string for the sex.""" <|body_0|> def is_affected(self): """Boolean for telling if the sample is affected.""" <|body_1|> <|end_skeleton|> <|body_start_0|> sex_string = self.sex ...
stack_v2_sparse_classes_36k_train_032789
632
permissive
[ { "docstring": "Return a human readable string for the sex.", "name": "sex_human", "signature": "def sex_human(self)" }, { "docstring": "Boolean for telling if the sample is affected.", "name": "is_affected", "signature": "def is_affected(self)" } ]
2
stack_v2_sparse_classes_30k_train_016491
Implement the Python class `PedigreeHumanMixin` described below. Class description: Implement the PedigreeHumanMixin class. Method signatures and docstrings: - def sex_human(self): Return a human readable string for the sex. - def is_affected(self): Boolean for telling if the sample is affected.
Implement the Python class `PedigreeHumanMixin` described below. Class description: Implement the PedigreeHumanMixin class. Method signatures and docstrings: - def sex_human(self): Return a human readable string for the sex. - def is_affected(self): Boolean for telling if the sample is affected. <|skeleton|> class P...
20f2521306492722fc035b5db18927578f1eae4a
<|skeleton|> class PedigreeHumanMixin: def sex_human(self): """Return a human readable string for the sex.""" <|body_0|> def is_affected(self): """Boolean for telling if the sample is affected.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PedigreeHumanMixin: def sex_human(self): """Return a human readable string for the sex.""" sex_string = self.sex if sex_string == '1': return 'male' elif sex_string == '2': return 'female' else: return 'unknown' def is_affected(s...
the_stack_v2_python_sparse
puzzle/models/mixins.py
J35P312/PuzzleWin
train
1
cb9c86f5e3f00ad8afaa3ec6519bd594a10e3fae
[ "variation_id = variation['_id']\nidentifier = valid_result.identifier\ntoken_type = valid_result.classification_token.token_type\ntoken_type_l = token_type.lower()\nvrs_ref_allele_seq = None\nif 'uncertain' in token_type_l:\n warnings = ['Ambiguous regions cannot be normalized']\nelif 'range' not in token_type_...
<|body_start_0|> variation_id = variation['_id'] identifier = valid_result.identifier token_type = valid_result.classification_token.token_type token_type_l = token_type.lower() vrs_ref_allele_seq = None if 'uncertain' in token_type_l: warnings = ['Ambiguous r...
Class for represnting VRSATILE objects
ToVRSATILE
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ToVRSATILE: """Class for represnting VRSATILE objects""" def get_variation_descriptor(self, label: str, variation: Dict, valid_result: ValidationResult, _id: str, warnings: List, gene: Optional[str]=None) -> Tuple[VariationDescriptor, List]: """Return variation descriptor and warning...
stack_v2_sparse_classes_36k_train_032790
3,637
permissive
[ { "docstring": "Return variation descriptor and warnings :param str label: Initial input query :param Dict variation: VRS variation object :param ValidationResult valid_result: Valid result for query :param str _id: _id field for variation descriptor :param List warnings: List of warnings :param Optional[str] g...
2
stack_v2_sparse_classes_30k_train_015376
Implement the Python class `ToVRSATILE` described below. Class description: Class for represnting VRSATILE objects Method signatures and docstrings: - def get_variation_descriptor(self, label: str, variation: Dict, valid_result: ValidationResult, _id: str, warnings: List, gene: Optional[str]=None) -> Tuple[VariationD...
Implement the Python class `ToVRSATILE` described below. Class description: Class for represnting VRSATILE objects Method signatures and docstrings: - def get_variation_descriptor(self, label: str, variation: Dict, valid_result: ValidationResult, _id: str, warnings: List, gene: Optional[str]=None) -> Tuple[VariationD...
4614e6dd0b3b5612d48f1e69be4e1476977aafba
<|skeleton|> class ToVRSATILE: """Class for represnting VRSATILE objects""" def get_variation_descriptor(self, label: str, variation: Dict, valid_result: ValidationResult, _id: str, warnings: List, gene: Optional[str]=None) -> Tuple[VariationDescriptor, List]: """Return variation descriptor and warning...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ToVRSATILE: """Class for represnting VRSATILE objects""" def get_variation_descriptor(self, label: str, variation: Dict, valid_result: ValidationResult, _id: str, warnings: List, gene: Optional[str]=None) -> Tuple[VariationDescriptor, List]: """Return variation descriptor and warnings :param str ...
the_stack_v2_python_sparse
variation/to_vrsatile.py
cancervariants/variation-normalization
train
4
d6362758649634a60deb35074ced6840a9586ab6
[ "super().__init__(**kwargs)\nself.options = Options()\nself.options.add_experimental_option('prefs', DOWNLOAD_PREFERENCES)\nself.options.add_argument(HEADLESS_OPTIONS['headless'])\nself.options.add_argument(HEADLESS_OPTIONS['window_size'])\nself.driver = webdriver.Chrome(desired_capabilities=BINARY_LOCATION, chrome...
<|body_start_0|> super().__init__(**kwargs) self.options = Options() self.options.add_experimental_option('prefs', DOWNLOAD_PREFERENCES) self.options.add_argument(HEADLESS_OPTIONS['headless']) self.options.add_argument(HEADLESS_OPTIONS['window_size']) self.driver = webdri...
DspAdvisorKhoj
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DspAdvisorKhoj: def __init__(self, **kwargs): """This constructor sets up the required settings for the Headless Selenium Chrome browser. :param kwargs: Keyword arguments""" <|body_0|> def parse(self, response, **kwargs): """This function will loop through the Dictio...
stack_v2_sparse_classes_36k_train_032791
3,665
no_license
[ { "docstring": "This constructor sets up the required settings for the Headless Selenium Chrome browser. :param kwargs: Keyword arguments", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "This function will loop through the Dictionary and gets the Response from...
2
stack_v2_sparse_classes_30k_train_008194
Implement the Python class `DspAdvisorKhoj` described below. Class description: Implement the DspAdvisorKhoj class. Method signatures and docstrings: - def __init__(self, **kwargs): This constructor sets up the required settings for the Headless Selenium Chrome browser. :param kwargs: Keyword arguments - def parse(se...
Implement the Python class `DspAdvisorKhoj` described below. Class description: Implement the DspAdvisorKhoj class. Method signatures and docstrings: - def __init__(self, **kwargs): This constructor sets up the required settings for the Headless Selenium Chrome browser. :param kwargs: Keyword arguments - def parse(se...
946e1c35b785bfc3ea31d5903e021d4bc99fe302
<|skeleton|> class DspAdvisorKhoj: def __init__(self, **kwargs): """This constructor sets up the required settings for the Headless Selenium Chrome browser. :param kwargs: Keyword arguments""" <|body_0|> def parse(self, response, **kwargs): """This function will loop through the Dictio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DspAdvisorKhoj: def __init__(self, **kwargs): """This constructor sets up the required settings for the Headless Selenium Chrome browser. :param kwargs: Keyword arguments""" super().__init__(**kwargs) self.options = Options() self.options.add_experimental_option('prefs', DOWNLO...
the_stack_v2_python_sparse
FundRatingAMCFiles/fund_rating_file_extraction/fund_rating_file_extraction/spiders/dsp.py
pavithra-ft/ft-automation
train
0
25becb4e524fe382bd8575e62ff27f91f71b5e6f
[ "Frame.__init__(self)\nself.master.title('Blackjack')\nself.grid()\nself._hitButton = Button(self, text='Hit', command=self._hit)\nself._hitButton.grid(row=0, column=0)\nself._passButton = Button(self, text='Pass', command=self._pass)\nself._passButton.grid(row=0, column=1)\nself._newGameButton = Button(self, text=...
<|body_start_0|> Frame.__init__(self) self.master.title('Blackjack') self.grid() self._hitButton = Button(self, text='Hit', command=self._hit) self._hitButton.grid(row=0, column=0) self._passButton = Button(self, text='Pass', command=self._pass) self._passButton.g...
BlackjackGUI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlackjackGUI: def __init__(self): """Sets up the window and widgets and instantiates the data model.""" <|body_0|> def _newGame(self): """Instantiates the model and refreshes the GUI.""" <|body_1|> def _hit(self): """Hits the player in the data m...
stack_v2_sparse_classes_36k_train_032792
4,167
no_license
[ { "docstring": "Sets up the window and widgets and instantiates the data model.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Instantiates the model and refreshes the GUI.", "name": "_newGame", "signature": "def _newGame(self)" }, { "docstring": "Hits...
4
stack_v2_sparse_classes_30k_train_001513
Implement the Python class `BlackjackGUI` described below. Class description: Implement the BlackjackGUI class. Method signatures and docstrings: - def __init__(self): Sets up the window and widgets and instantiates the data model. - def _newGame(self): Instantiates the model and refreshes the GUI. - def _hit(self): ...
Implement the Python class `BlackjackGUI` described below. Class description: Implement the BlackjackGUI class. Method signatures and docstrings: - def __init__(self): Sets up the window and widgets and instantiates the data model. - def _newGame(self): Instantiates the model and refreshes the GUI. - def _hit(self): ...
a955c48d3c7209ed61c08f2e950da1967d730c1d
<|skeleton|> class BlackjackGUI: def __init__(self): """Sets up the window and widgets and instantiates the data model.""" <|body_0|> def _newGame(self): """Instantiates the model and refreshes the GUI.""" <|body_1|> def _hit(self): """Hits the player in the data m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlackjackGUI: def __init__(self): """Sets up the window and widgets and instantiates the data model.""" Frame.__init__(self) self.master.title('Blackjack') self.grid() self._hitButton = Button(self, text='Hit', command=self._hit) self._hitButton.grid(row=0, colu...
the_stack_v2_python_sparse
WA170 - Programming with Python/WA170_exercise_solutions/9781111822705_Solutions_ch09/Ch_09_Projects/9.4/blackjackgui.py
janesferr/WADD-Courses
train
3
d0c44c99119ac2e02260ff2f0b0d23a3c6d45be4
[ "super().__init__()\nself.temperature = np.sqrt(input_channels)\nself.key_projection = nn.Linear(input_channels, input_channels, bias=False)\nself.value_projection = nn.Linear(input_channels, input_channels, bias=False)\nnn.init.xavier_normal_(self.key_projection.weight)\nnn.init.xavier_normal_(self.value_projectio...
<|body_start_0|> super().__init__() self.temperature = np.sqrt(input_channels) self.key_projection = nn.Linear(input_channels, input_channels, bias=False) self.value_projection = nn.Linear(input_channels, input_channels, bias=False) nn.init.xavier_normal_(self.key_projection.weig...
The co-attention network for MHCADDI model.
CoAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoAttention: """The co-attention network for MHCADDI model.""" def __init__(self, input_channels: int, output_channels: int, dropout: float=0.1): """Instantiate the co-attention network. :param input_channels: The number of atom features. :param output_channels: The number of output ...
stack_v2_sparse_classes_36k_train_032793
25,672
no_license
[ { "docstring": "Instantiate the co-attention network. :param input_channels: The number of atom features. :param output_channels: The number of output features. :param dropout: Dropout probability.", "name": "__init__", "signature": "def __init__(self, input_channels: int, output_channels: int, dropout:...
3
stack_v2_sparse_classes_30k_train_012051
Implement the Python class `CoAttention` described below. Class description: The co-attention network for MHCADDI model. Method signatures and docstrings: - def __init__(self, input_channels: int, output_channels: int, dropout: float=0.1): Instantiate the co-attention network. :param input_channels: The number of ato...
Implement the Python class `CoAttention` described below. Class description: The co-attention network for MHCADDI model. Method signatures and docstrings: - def __init__(self, input_channels: int, output_channels: int, dropout: float=0.1): Instantiate the co-attention network. :param input_channels: The number of ato...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class CoAttention: """The co-attention network for MHCADDI model.""" def __init__(self, input_channels: int, output_channels: int, dropout: float=0.1): """Instantiate the co-attention network. :param input_channels: The number of atom features. :param output_channels: The number of output ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CoAttention: """The co-attention network for MHCADDI model.""" def __init__(self, input_channels: int, output_channels: int, dropout: float=0.1): """Instantiate the co-attention network. :param input_channels: The number of atom features. :param output_channels: The number of output features. :pa...
the_stack_v2_python_sparse
generated/test_AstraZeneca_chemicalx.py
jansel/pytorch-jit-paritybench
train
35
7d00943a696010b12dadccb1b2ba06c27fda9849
[ "self.a = 6378137\nself.b = 6356752.3142\nself.f = 0.00335281067183099\nself.ecc = 0.08181919092890633\nself.e2 = 0.006694380004260828\nself.secEcc = 0.08209443803685426\nself.secEccSqr = 0.006739496756586904\nself.mu = 398600441800000.0\nself.omega = 7.292115e-05\nself.J2 = 0.001082629989\nself.J3 = -2.53881e-06\n...
<|body_start_0|> self.a = 6378137 self.b = 6356752.3142 self.f = 0.00335281067183099 self.ecc = 0.08181919092890633 self.e2 = 0.006694380004260828 self.secEcc = 0.08209443803685426 self.secEccSqr = 0.006739496756586904 self.mu = 398600441800000.0 s...
Geodetic and related coordinate transforms
Geodesy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Geodesy: """Geodetic and related coordinate transforms""" def __init__(self): """WGS-84 constants""" <|body_0|> def geodetic2ECEF(self, latitude: float, longitude: float, altitude: float) -> vector: """@ rc : float""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_032794
2,460
permissive
[ { "docstring": "WGS-84 constants", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "@ rc : float", "name": "geodetic2ECEF", "signature": "def geodetic2ECEF(self, latitude: float, longitude: float, altitude: float) -> vector" } ]
2
stack_v2_sparse_classes_30k_train_010965
Implement the Python class `Geodesy` described below. Class description: Geodetic and related coordinate transforms Method signatures and docstrings: - def __init__(self): WGS-84 constants - def geodetic2ECEF(self, latitude: float, longitude: float, altitude: float) -> vector: @ rc : float
Implement the Python class `Geodesy` described below. Class description: Geodetic and related coordinate transforms Method signatures and docstrings: - def __init__(self): WGS-84 constants - def geodetic2ECEF(self, latitude: float, longitude: float, altitude: float) -> vector: @ rc : float <|skeleton|> class Geodesy...
f5713f9ed9a24c1382875d8ebdec00100f39e3a5
<|skeleton|> class Geodesy: """Geodetic and related coordinate transforms""" def __init__(self): """WGS-84 constants""" <|body_0|> def geodetic2ECEF(self, latitude: float, longitude: float, altitude: float) -> vector: """@ rc : float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Geodesy: """Geodetic and related coordinate transforms""" def __init__(self): """WGS-84 constants""" self.a = 6378137 self.b = 6356752.3142 self.f = 0.00335281067183099 self.ecc = 0.08181919092890633 self.e2 = 0.006694380004260828 self.secEcc = 0.08...
the_stack_v2_python_sparse
Python/src/polynomialfiltering/Geodesy.py
lintondf/MorrisonPolynomialFiltering
train
0
a0cf17b65302483f6916874da90581afc6713806
[ "self.init_config(app)\nif app.config['SENTRY_DSN'] is None:\n return\nself.install_handler(app)\napp.extensions['invenio-logging-sentry'] = self", "for k in dir(config):\n if k.startswith('LOGGING_SENTRY') or k.startswith('SENTRY_DSN'):\n app.config.setdefault(k, getattr(config, k))", "from raven....
<|body_start_0|> self.init_config(app) if app.config['SENTRY_DSN'] is None: return self.install_handler(app) app.extensions['invenio-logging-sentry'] = self <|end_body_0|> <|body_start_1|> for k in dir(config): if k.startswith('LOGGING_SENTRY') or k.start...
Invenio-Logging extension for Sentry.
InvenioLoggingSentry
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvenioLoggingSentry: """Invenio-Logging extension for Sentry.""" def init_app(self, app): """Flask application initialization.""" <|body_0|> def init_config(self, app): """Initialize configuration.""" <|body_1|> def install_handler(self, app): ...
stack_v2_sparse_classes_36k_train_032795
3,539
no_license
[ { "docstring": "Flask application initialization.", "name": "init_app", "signature": "def init_app(self, app)" }, { "docstring": "Initialize configuration.", "name": "init_config", "signature": "def init_config(self, app)" }, { "docstring": "Install log handler.", "name": "in...
3
null
Implement the Python class `InvenioLoggingSentry` described below. Class description: Invenio-Logging extension for Sentry. Method signatures and docstrings: - def init_app(self, app): Flask application initialization. - def init_config(self, app): Initialize configuration. - def install_handler(self, app): Install l...
Implement the Python class `InvenioLoggingSentry` described below. Class description: Invenio-Logging extension for Sentry. Method signatures and docstrings: - def init_app(self, app): Flask application initialization. - def init_config(self, app): Initialize configuration. - def install_handler(self, app): Install l...
54eb34c7e1594cc50a5347ba93e12a991ba8b7f3
<|skeleton|> class InvenioLoggingSentry: """Invenio-Logging extension for Sentry.""" def init_app(self, app): """Flask application initialization.""" <|body_0|> def init_config(self, app): """Initialize configuration.""" <|body_1|> def install_handler(self, app): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InvenioLoggingSentry: """Invenio-Logging extension for Sentry.""" def init_app(self, app): """Flask application initialization.""" self.init_config(app) if app.config['SENTRY_DSN'] is None: return self.install_handler(app) app.extensions['invenio-loggin...
the_stack_v2_python_sparse
.virtualenvs/invenio/lib/python2.7/site-packages/invenio_logging/sentry.py
N03/invenio
train
0
bb49219ea05f2f189cb85232ba346895c5f707fc
[ "self.app_restore_progress_monitor_subtask_path = app_restore_progress_monitor_subtask_path\nself.child_restore_app_params_vec = child_restore_app_params_vec\nself.last_finished_log_backup_start_time_usecs = last_finished_log_backup_start_time_usecs\nself.restore_app_params = restore_app_params", "if dictionary i...
<|body_start_0|> self.app_restore_progress_monitor_subtask_path = app_restore_progress_monitor_subtask_path self.child_restore_app_params_vec = child_restore_app_params_vec self.last_finished_log_backup_start_time_usecs = last_finished_log_backup_start_time_usecs self.restore_app_params ...
Implementation of the 'RestoreAppTaskStateProto' model. TODO: type description here. Attributes: app_restore_progress_monitor_subtask_path (string): The Pulse task path to the application restore task sub tree. If the application restore has to wait on other tasks (for example, a SQL db restore may wait for a tail log ...
RestoreAppTaskStateProto
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestoreAppTaskStateProto: """Implementation of the 'RestoreAppTaskStateProto' model. TODO: type description here. Attributes: app_restore_progress_monitor_subtask_path (string): The Pulse task path to the application restore task sub tree. If the application restore has to wait on other tasks (fo...
stack_v2_sparse_classes_36k_train_032796
3,935
permissive
[ { "docstring": "Constructor for the RestoreAppTaskStateProto class", "name": "__init__", "signature": "def __init__(self, app_restore_progress_monitor_subtask_path=None, child_restore_app_params_vec=None, last_finished_log_backup_start_time_usecs=None, restore_app_params=None)" }, { "docstring":...
2
null
Implement the Python class `RestoreAppTaskStateProto` described below. Class description: Implementation of the 'RestoreAppTaskStateProto' model. TODO: type description here. Attributes: app_restore_progress_monitor_subtask_path (string): The Pulse task path to the application restore task sub tree. If the application...
Implement the Python class `RestoreAppTaskStateProto` described below. Class description: Implementation of the 'RestoreAppTaskStateProto' model. TODO: type description here. Attributes: app_restore_progress_monitor_subtask_path (string): The Pulse task path to the application restore task sub tree. If the application...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RestoreAppTaskStateProto: """Implementation of the 'RestoreAppTaskStateProto' model. TODO: type description here. Attributes: app_restore_progress_monitor_subtask_path (string): The Pulse task path to the application restore task sub tree. If the application restore has to wait on other tasks (fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RestoreAppTaskStateProto: """Implementation of the 'RestoreAppTaskStateProto' model. TODO: type description here. Attributes: app_restore_progress_monitor_subtask_path (string): The Pulse task path to the application restore task sub tree. If the application restore has to wait on other tasks (for example, a ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/restore_app_task_state_proto.py
cohesity/management-sdk-python
train
24
6bf00dcef6bb9cca25219a2bcd0ccad0008d24f1
[ "super().__init__(model_config)\nself.model = model\nself.epoch = epoch\nself.pipeline_id = pipeline_id\nmodel.eval()", "model_and_info = model_util.load_from_checkpoint_and_adjust(config, path_to_checkpoint)\nif model_and_info.model is None or model_and_info.checkpoint_epoch is None:\n logging.warning(f'Could...
<|body_start_0|> super().__init__(model_config) self.model = model self.epoch = epoch self.pipeline_id = pipeline_id model.eval() <|end_body_0|> <|body_start_1|> model_and_info = model_util.load_from_checkpoint_and_adjust(config, path_to_checkpoint) if model_and_...
Pipeline for inference from a single model on classification tasks.
ScalarInferencePipeline
[ "MIT", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScalarInferencePipeline: """Pipeline for inference from a single model on classification tasks.""" def __init__(self, model: BaseModelOrDataParallelModel, model_config: ScalarModelBase, epoch: int, pipeline_id: int) -> None: """:param model: Model recovered from the checkpoint. :para...
stack_v2_sparse_classes_36k_train_032797
10,504
permissive
[ { "docstring": ":param model: Model recovered from the checkpoint. :param model_config: Model configuration information. :param epoch: Epoch of the checkpoint which was recovered. :param pipeline_id: ID for this pipeline (useful for ensembles). :return:", "name": "__init__", "signature": "def __init__(s...
3
stack_v2_sparse_classes_30k_test_000906
Implement the Python class `ScalarInferencePipeline` described below. Class description: Pipeline for inference from a single model on classification tasks. Method signatures and docstrings: - def __init__(self, model: BaseModelOrDataParallelModel, model_config: ScalarModelBase, epoch: int, pipeline_id: int) -> None:...
Implement the Python class `ScalarInferencePipeline` described below. Class description: Pipeline for inference from a single model on classification tasks. Method signatures and docstrings: - def __init__(self, model: BaseModelOrDataParallelModel, model_config: ScalarModelBase, epoch: int, pipeline_id: int) -> None:...
12b496093097ef48d5ac8880985c04918d7f76fe
<|skeleton|> class ScalarInferencePipeline: """Pipeline for inference from a single model on classification tasks.""" def __init__(self, model: BaseModelOrDataParallelModel, model_config: ScalarModelBase, epoch: int, pipeline_id: int) -> None: """:param model: Model recovered from the checkpoint. :para...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScalarInferencePipeline: """Pipeline for inference from a single model on classification tasks.""" def __init__(self, model: BaseModelOrDataParallelModel, model_config: ScalarModelBase, epoch: int, pipeline_id: int) -> None: """:param model: Model recovered from the checkpoint. :param model_confi...
the_stack_v2_python_sparse
InnerEye/ML/pipelines/scalar_inference.py
MaxCodeXTC/InnerEye-DeepLearning
train
1
74740fad7b96eeb46118e5d97bf81abef5df8f6e
[ "super().__init__(coordinator, device, 'extra', 'Extra meter', f'extra_{dev_type}')\nself._type = dev_type\nself._attr_name = f'Extra {dev_type}'", "if self.coordinator.data.extra_meter is None:\n return None\nreturn getattr(self.coordinator.data.extra_meter, f'_{self._type}', None)" ]
<|body_start_0|> super().__init__(coordinator, device, 'extra', 'Extra meter', f'extra_{dev_type}') self._type = dev_type self._attr_name = f'Extra {dev_type}' <|end_body_0|> <|body_start_1|> if self.coordinator.data.extra_meter is None: return None return getattr(se...
The Youless extra meter value sensor (s0).
ExtraMeterSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtraMeterSensor: """The Youless extra meter value sensor (s0).""" def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str) -> None: """Instantiate an extra meter sensor.""" <|body_0|> def get_sensor(self) -> YoulessSensor | None: ...
stack_v2_sparse_classes_36k_train_032798
11,812
permissive
[ { "docstring": "Instantiate an extra meter sensor.", "name": "__init__", "signature": "def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str) -> None" }, { "docstring": "Get the sensor for providing the value.", "name": "get_sensor", "signature": "...
2
null
Implement the Python class `ExtraMeterSensor` described below. Class description: The Youless extra meter value sensor (s0). Method signatures and docstrings: - def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str) -> None: Instantiate an extra meter sensor. - def get_sensor(s...
Implement the Python class `ExtraMeterSensor` described below. Class description: The Youless extra meter value sensor (s0). Method signatures and docstrings: - def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str) -> None: Instantiate an extra meter sensor. - def get_sensor(s...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ExtraMeterSensor: """The Youless extra meter value sensor (s0).""" def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str) -> None: """Instantiate an extra meter sensor.""" <|body_0|> def get_sensor(self) -> YoulessSensor | None: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExtraMeterSensor: """The Youless extra meter value sensor (s0).""" def __init__(self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str, dev_type: str) -> None: """Instantiate an extra meter sensor.""" super().__init__(coordinator, device, 'extra', 'Extra meter', f'extra_{dev_ty...
the_stack_v2_python_sparse
homeassistant/components/youless/sensor.py
home-assistant/core
train
35,501
1e55f46ba2cf43aa4c74a0c43072c0448095f921
[ "testName = 'test_validatePolygon'\ntry:\n log.print_test_begin(testName)\n x_coords = np.asarray([550, 455, 491, 609, 645])\n y_coords = np.asarray([450, 519, 631, 631, 510])\n try:\n sc.Polygon(x_coords, y_coords)\n except ValueError as e:\n pass\n log.print_test_success(testName)\...
<|body_start_0|> testName = 'test_validatePolygon' try: log.print_test_begin(testName) x_coords = np.asarray([550, 455, 491, 609, 645]) y_coords = np.asarray([450, 519, 631, 631, 510]) try: sc.Polygon(x_coords, y_coords) except ...
TestCalculations_Polygon
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCalculations_Polygon: def test_validatePolygon(self): """Does invalid polygon coordinates raise a ValueError exception?""" <|body_0|> def test_setPolyArea(self): """Is the Polygon Area calculated correctly?""" <|body_1|> def test_setPolyCentroid(self...
stack_v2_sparse_classes_36k_train_032799
4,814
permissive
[ { "docstring": "Does invalid polygon coordinates raise a ValueError exception?", "name": "test_validatePolygon", "signature": "def test_validatePolygon(self)" }, { "docstring": "Is the Polygon Area calculated correctly?", "name": "test_setPolyArea", "signature": "def test_setPolyArea(sel...
4
stack_v2_sparse_classes_30k_train_017776
Implement the Python class `TestCalculations_Polygon` described below. Class description: Implement the TestCalculations_Polygon class. Method signatures and docstrings: - def test_validatePolygon(self): Does invalid polygon coordinates raise a ValueError exception? - def test_setPolyArea(self): Is the Polygon Area c...
Implement the Python class `TestCalculations_Polygon` described below. Class description: Implement the TestCalculations_Polygon class. Method signatures and docstrings: - def test_validatePolygon(self): Does invalid polygon coordinates raise a ValueError exception? - def test_setPolyArea(self): Is the Polygon Area c...
6a5bfbb459f5a1309fdace4e38b44e8274c497db
<|skeleton|> class TestCalculations_Polygon: def test_validatePolygon(self): """Does invalid polygon coordinates raise a ValueError exception?""" <|body_0|> def test_setPolyArea(self): """Is the Polygon Area calculated correctly?""" <|body_1|> def test_setPolyCentroid(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCalculations_Polygon: def test_validatePolygon(self): """Does invalid polygon coordinates raise a ValueError exception?""" testName = 'test_validatePolygon' try: log.print_test_begin(testName) x_coords = np.asarray([550, 455, 491, 609, 645]) y_co...
the_stack_v2_python_sparse
testCalculations/polygon.py
sativa/SPEED
train
0