mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 21:30:12 +01:00
Switch to a mypy fork that handles imports (#823)
I'm seeing if I can upstream thundergolfer/bazel-mypy-integration#43, but we can also point at my fork for the time being. This should resolve conflicts with mypy treating imports as non-hermetic, creating inconsistent behavior if packages are/aren't installed locally.
This commit is contained in:
@@ -27,6 +27,7 @@ py_binary(
|
||||
|
||||
mypy_test(
|
||||
name = "pr_comments_mypy_test",
|
||||
include_imports = True,
|
||||
deps = [":pr_comments"],
|
||||
)
|
||||
|
||||
@@ -49,6 +50,7 @@ py_binary(
|
||||
|
||||
mypy_test(
|
||||
name = "update_label_access_mypy_test",
|
||||
include_imports = True,
|
||||
deps = [":update_label_access"],
|
||||
)
|
||||
|
||||
|
||||
@@ -14,9 +14,8 @@ import os
|
||||
from typing import Dict, Generator, Optional, Tuple
|
||||
|
||||
# https://pypi.org/project/gql/
|
||||
# gql is missing type annotations, so disable checking on around it.
|
||||
import gql # type: ignore
|
||||
import gql.transport.requests # type: ignore
|
||||
import gql
|
||||
import gql.transport.requests
|
||||
|
||||
_ENV_TOKEN = "GITHUB_ACCESS_TOKEN"
|
||||
|
||||
@@ -53,7 +52,7 @@ class Client(object):
|
||||
url="https://api.github.com/graphql",
|
||||
headers={"Authorization": "bearer %s" % parsed_args.access_token},
|
||||
)
|
||||
self._client = gql.Client(transport=transport)
|
||||
self._client = gql.Client(transport=transport) # type: ignore
|
||||
|
||||
def execute(self, query: str) -> Dict:
|
||||
"""Runs a query."""
|
||||
|
||||
@@ -16,7 +16,7 @@ from typing import List, Optional, Set
|
||||
|
||||
# https://github.com/PyGithub/PyGithub
|
||||
# GraphQL is preferred, but falling back to pygithub for unsupported mutations.
|
||||
import github # type: ignore
|
||||
import github
|
||||
|
||||
from github_tools import github_helpers
|
||||
|
||||
@@ -114,18 +114,18 @@ def _update_team(
|
||||
|
||||
This switches to pygithub because GraphQL lacks equivalent mutation support.
|
||||
"""
|
||||
gh_team = gh.get_organization(_ORG).get_team_by_slug(_TEAM)
|
||||
gh_team = gh.get_organization(_ORG).get_team_by_slug(_TEAM) # type: ignore
|
||||
add_members = org_members - team_members
|
||||
if add_members:
|
||||
print("Adding members: %s" % ", ".join(add_members))
|
||||
for member in add_members:
|
||||
gh_team.add_membership(gh.get_user(member))
|
||||
gh_team.add_membership(gh.get_user(member)) # type: ignore
|
||||
|
||||
remove_members = team_members - org_members
|
||||
if remove_members:
|
||||
print("Removing members: %s" % ", ".join(remove_members))
|
||||
for member in remove_members:
|
||||
gh_team.remove_membership(gh.get_user(member))
|
||||
gh_team.remove_membership(gh.get_user(member)) # type: ignore
|
||||
|
||||
|
||||
def main() -> None:
|
||||
@@ -136,7 +136,7 @@ def main() -> None:
|
||||
org_members = _load_org_members(client)
|
||||
team_members = _load_team_members(client)
|
||||
if org_members != team_members:
|
||||
gh = github.Github(parsed_args.access_token)
|
||||
gh = github.Github(parsed_args.access_token) # type: ignore
|
||||
_update_team(gh, org_members, team_members)
|
||||
print("Done!")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user