Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
name: test (Python ${{ matrix.python-version }})
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"
- name: Install tox
Expand Down
29 changes: 3 additions & 26 deletions github/Branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ def replace_team_push_restrictions(self, *teams):
"""
:calls: `PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams <https://docs.github.com/en/rest/reference/repos#branches>`_
:teams: list of strings (team slugs)

we want this version
"""
assert all(isinstance(element, str) for element in teams), teams
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: Dear reviewer, you probably want to expand the diffs around the "we want this" so you can verify that the {replace,remove}_team_push_restrictions versions that we want to keep are indeed valid syntax


Expand All @@ -484,39 +486,14 @@ def remove_team_push_restrictions(self, *teams):
"""
:calls: `DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams <https://docs.github.com/en/rest/reference/repos#branches>`_
:teams: list of strings (team slugs)
we want this one :lolsob:
"""
assert all(isinstance(element, str) for element in teams), teams

headers, data = self._requester.requestJsonAndCheck(
"DELETE", f"{self.protection_url}/restrictions/teams", input=teams
)

def replace_team_push_restrictions(self, *teams):
"""
:calls: `PUT /repos/:owner/:repo/branches/:branch/protection/restrictions/teams <https://developer.github.com/v3/repos/branches>`_
:teams: list of strings (team slugs)
"""
assert all(isinstance(element, (str, unicode)) or isinstance(element, (str, unicode)) for element in teams), teams

headers, data = self._requester.requestJsonAndCheck(
"PUT",
self.protection_url + "/restrictions/teams",
input=teams
)

def remove_team_push_restrictions(self, *teams):
"""
:calls: `DELETE /repos/:owner/:repo/branches/:branch/protection/restrictions/teams <https://developer.github.com/v3/repos/branches>`_
:teams: list of strings (team slugs)
"""
assert all(isinstance(element, (str, unicode)) or isinstance(element, (str, unicode)) for element in teams), teams

headers, data = self._requester.requestJsonAndCheck(
"DELETE",
self.protection_url + "/restrictions/teams",
input=teams
)

def remove_push_restrictions(self):
"""
:calls: `DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions <https://docs.github.com/en/rest/reference/repos#branches>`_
Expand Down
14 changes: 6 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
[tox]
envlist =
lint,
py{36,37,38,39,310},
py{38,39,310},
docs

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38, docs, lint
3.9: py39
3.8: py38
3.9: py39, docs, lint
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: python 3.9 is what we use in ghconf-runner. That is only known current user of this code.

So we lint, docs, and typecheck on that

3.10: py310

[testenv]
deps = -rtest-requirements.txt
commands = pytest --cov=github --cov-report=xml {posargs}

[testenv:lint]
basepython = python3.8
basepython = python3.9
skip_install = true
deps =
types-jwt
Expand All @@ -31,7 +29,7 @@ commands =
mypy github tests

[testenv:docs]
basepython = python3.8
basepython = python3.9
skip_install = true
deps = -rrequirements.txt
commands = sphinx-build doc build
Expand All @@ -42,6 +40,6 @@ select = C,E,F,W
ignore = E266, E501, W503

[mypy]
python_version = 3.8
python_version = 3.9
ignore_missing_imports = True
namespace_packages = True
Loading