| Total Complexity | 4 |
| Total Lines | 18 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | import fnmatch |
||
| 10 | class ListPackagesAction(Action): |
||
| 11 | def run(self, repo, api_token, per_page=1000, filename_filter=None): |
||
| 12 | values = {'repo': repo, 'api_token': api_token} |
||
| 13 | url = URL % values |
||
| 14 | params = {'per_page': per_page} |
||
| 15 | |||
| 16 | response = requests.get(url, params=params) |
||
| 17 | data = response.json() |
||
| 18 | |||
| 19 | if not filename_filter: |
||
| 20 | return data |
||
| 21 | |||
| 22 | result = [] |
||
| 23 | for item in data: |
||
| 24 | if fnmatch.fnmatch(item['filename'], filename_filter): |
||
| 25 | result.append(item) |
||
| 26 | |||
| 27 | return result |
||
| 28 |