Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ament_mypy] Export typing information #487

Open
wants to merge 1 commit into
base: rolling
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions ament_mypy/ament_mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from xml.sax.saxutils import escape
from xml.sax.saxutils import quoteattr

import mypy.api # type: ignore
import mypy.api


def main(argv: List[str] = sys.argv[1:]) -> int:
Expand Down Expand Up @@ -148,11 +148,11 @@ def _generate_mypy_report(paths: List[str],
mypy_argv.append('--show-error-context')
mypy_argv.append('--show-column-numbers')
mypy_argv += paths
res = mypy.api.run(mypy_argv) # type: Tuple[str, str, int]
res = mypy.api.run(mypy_argv)
return res


def _get_xunit_content(errors: List[Match],
def _get_xunit_content(errors: List[Match[str]],
testname: str,
filenames: List[str],
elapsed: float) -> str:
Expand Down Expand Up @@ -231,7 +231,7 @@ def _get_files(paths: List[str]) -> List[str]:
return [os.path.normpath(f) for f in files]


def _get_errors(report_string: str) -> List[Match]:
def _get_errors(report_string: str) -> List[Match[str]]:
return list(re.finditer(r'^(?P<filename>([a-zA-Z]:)?([^:])+):((?P<lineno>\d+):)?((?P<colno>\d+):)?\ (?P<type>error|warning|note):\ (?P<msg>.*)$', report_string, re.MULTILINE)) # noqa: E501


Expand Down
Empty file added ament_mypy/ament_mypy/py.typed
Empty file.
3 changes: 2 additions & 1 deletion ament_mypy/ament_mypy/pytest_marker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from _pytest.config import Config


def pytest_configure(config):
def pytest_configure(config: Config) -> None:
config.addinivalue_line(
'markers', 'mypy: marks tests checking for mypy compliance')