Library is inconsistent with its documentation and some methods just do not work
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
Bắt đầu với GhApi.get_content trong ghapi/core.py và so sánh chữ ký get_content(path) của nó với repos.get_content(owner, repo, path, ref) trong tài liệu được liên kết. Tái hiện cả hai ví dụ, sau đó xác minh rằng chữ ký công khai, cách sử dụng được ghi trong tài liệu và hành vi tra cứu nội dung được hỗ trợ khớp với nhau mà không xuất hiện KeyError hoặc TypeError như đã nêu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
from ghapi.all import GhApi
gh_api = GhApi()
gh_api.get_content("https://github.com/Ark-kun/pipeline_components/blob/47f3621344c884666a926c8a15d77562f1cc5e0a/components/XGBoost/Train/component.yaml")
KeyError Traceback (most recent call last)
<ipython-input-10-f6314c774e4a> in <module>
----> 1 gh_api.get_content("https://github.com/Ark-kun/pipeline_components/blob/47f3621344c884666a926c8a15d77562f1cc5e0a/components/XGBoost/Train/component.yaml")
/opt/conda/lib/python3.7/site-packages/ghapi/core.py in get_content(self, path)
222 @patch
223 def get_content(self:GhApi, path):
--> 224 res = self.repos.get_content(path)
225 return base64.b64decode(res.content)
226
/opt/conda/lib/python3.7/site-packages/ghapi/core.py in __call__(self, headers, *args, **kwargs)
61 route_p,query_p,data_p = [{p:kwargs[p] for p in o if p in kwargs}
62 for o in (self.route_ps,self.params,d)]
---> 63 return self.client(self.path, self.verb, headers=headers, route=route_p, query=query_p, data=data_p)
64
65 def __str__(self): return f'{self.tag}.{self.name}{signature(self)}\n{self.doc_url}'
/opt/conda/lib/python3.7/site-packages/ghapi/core.py in __call__(self, path, verb, headers, route, query, data)
107 for k,v in route.items(): route[k] = quote(str(route[k]))
108 res,self.recv_hdrs = urlsend(path, verb, headers=headers or None, debug=self.debug, return_headers=True,
--> 109 route=route or None, query=query or None, data=data or None)
110 if 'X-RateLimit-Remaining' in self.recv_hdrs:
111 newlim = self.recv_hdrs['X-RateLimit-Remaining']
/opt/conda/lib/python3.7/site-packages/fastcore/net.py in urlsend(url, verb, headers, route, query, data, json_data, return_json, return_headers, debug)
204 return_json=True, return_headers=False, debug=None):
205 "Send request with `urlrequest`, converting result to json if `return_json`"
--> 206 req = urlrequest(url, verb, headers, route=route, query=query, data=data, json_data=json_data)
207 if debug: debug(req)
208
/opt/conda/lib/python3.7/site-packages/fastcore/net.py in urlrequest(url, verb, headers, route, query, data, json_data)
187 def urlrequest(url, verb, headers=None, route=None, query=None, data=None, json_data=True):
188 "`Request` for `url` with optional route params replaced by `route`, plus `query` string, and post `data`"
--> 189 if route: url = url.format(**route)
190 if query: url += '?' + urlencode(query)
191 if isinstance(data,dict): data = (json.dumps if json_data else urlencode)(data).encode('ascii')
KeyError: 'repo'
This does not work either:
gh_api.get_content("Ark-kun", "pipeline_components", "/components/XGBoost/Train/component.yaml", "47f3621344c884666a926c8a15d77562f1cc5e0a")
ipython-input-12-c8d271a17611> in <module>
----> 1 gh_api.get_content("Ark-kun", "pipeline_components", "/components/XGBoost/Train/component.yaml", "47f3621344c884666a926c8a15d77562f1cc5e0a")
TypeError: get_content() takes 2 positional arguments but 5 were given
Parameters:
help(gh_api.get_content)
# get_content(path) method of ghapi.core.GhApi instance
but in documentation:
repos.get_content(owner, repo, path, ref): Get repository content
- Ngôn ngữ chính
- Python
- Star
- 687
- Fork
- 69
- Merge trung bình
- 1 phút
- Pull request đã merge (30 ngày)
- 2
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của AnswerDotAI/ghapi
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
AnswerDotAI/ghapi#158 ·
-
Small fix needed to enable GHES Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
AnswerDotAI/ghapi#120 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
AnswerDotAI/ghapi#208 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
AnswerDotAI/ghapi#201 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
AnswerDotAI/ghapi#186 ·
Tất cả issue của AnswerDotAI/ghapi
Issue tương tự
-
agent-ready documentation needs-triage
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
Add https://search.jeremyh.xyz/ Đang mởinstance instance add
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
searxng/searx-instances#939 · 1 bình luận ·
-
area-deployment area-integrations triage:bot-seen
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 86/100