Changeset - 05406c312342
[Not reviewed]
default
0 5 0
Mads Kiilerich (mads) - 5 years ago 2021-01-14 21:44:53
mads@kiilerich.com
Grafted from: 060202bcf691
pytype: add Python type annotations where necessary to guide pytype

Mute pytype warnings:

File "kallithea/lib/auth.py", line 142, in _cached_perms_data: No attribute 'DEFAULT_USER_ID' on module 'kallithea' [module-attr]
File "kallithea/lib/vcs/backends/base.py", line 73, in ...: No attribute '...' on BaseRepository [attribute-error]
File "kallithea/lib/vcs/backends/base.py", line 405, in ...: No attribute '...' on BaseChangeset [attribute-error]
File "kallithea/tests/api/api_base.py", line 2397, in test_api_get_changeset: No attribute 'TEST_REVISION' on _BaseTestApi [attribute-error]
File "kallithea/tests/api/api_base.py", line 2445, in test_api_get_pullrequest: No attribute 'TEST_PR_DST' on _BaseTestApi [attribute-error]
File "kallithea/tests/api/api_base.py", line 2445, in test_api_get_pullrequest: No attribute 'TEST_PR_SRC' on _BaseTestApi [attribute-error]
File "kallithea/tests/api/api_base.py", line 2467, in test_api_get_pullrequest: No attribute 'TEST_PR_REVISIONS' on _BaseTestApi [attribute-error]
File "kallithea/tests/api/api_base.py", line 67, in api_call: No attribute 'app' on _BaseTestApi [attribute-error]
File "kallithea/tests/base.py", line 154, in log_user: No attribute 'app' on TestController [attribute-error]
File "kallithea/tests/base.py", line 169, in _get_logged_user: No attribute '_logged_username' on TestController [attribute-error]
5 files changed with 24 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/__init__.py
Show inline comments
 
@@ -44,6 +44,7 @@ BACKENDS = {
 

	
 
CELERY_APP = celery.Celery()  # needed at import time but is lazy and can be configured later
 

	
 
DEFAULT_USER_ID: int  # set by setup_configuration
 
CONFIG = {}  # set to tg.config when TG app is initialized and calls app_cfg
 

	
 
# URL prefix for non repository related links - must start with `/`
kallithea/lib/vcs/backends/base.py
Show inline comments
 
@@ -11,6 +11,7 @@
 

	
 
import datetime
 
import itertools
 
from typing import Sequence
 

	
 
from kallithea.lib.vcs.backends import get_backend
 
from kallithea.lib.vcs.conf import settings
 
@@ -51,8 +52,12 @@ class BaseRepository(object):
 
        ``tags``
 
            tags as list of changesets
 
    """
 
    scm = None
 
    DEFAULT_BRANCH_NAME = None
 
    DEFAULT_BRANCH_NAME: str  # assigned in subclass
 
    scm: str  # assigned in subclass
 
    path: str  # assigned in subclass __init__
 
    revisions: Sequence[str]  # LazyProperty in subclass
 
    _empty: bool  # property in subclass
 

	
 
    EMPTY_CHANGESET = '0' * 40
 

	
 
    def __init__(self, repo_path, create=False, **kwargs):
 
@@ -367,6 +372,9 @@ class BaseChangeset(object):
 
            otherwise; trying to access this attribute while there is no
 
            changesets would raise ``EmptyRepositoryError``
 
    """
 
    message: str  # LazyProperty in subclass
 
    date: datetime.datetime  # LazyProperty in subclass
 

	
 
    def __str__(self):
 
        return '<%s at %s:%s>' % (self.__class__.__name__, self.revision,
 
            self.short_id)
kallithea/tests/api/api_base.py
Show inline comments
 
@@ -20,9 +20,11 @@ import os
 
import random
 
import re
 
import string
 
from typing import Sized
 

	
 
import mock
 
import pytest
 
from webtest import TestApp
 

	
 
from kallithea.lib import ext_json
 
from kallithea.lib.auth import AuthUser
 
@@ -86,8 +88,14 @@ def make_repo_group(name=TEST_REPO_GROUP
 

	
 

	
 
class _BaseTestApi(object):
 
    REPO = None
 
    REPO_TYPE = None
 
    app: TestApp  # assigned by app_fixture in subclass TestController mixin
 
    # assigned in subclass:
 
    REPO: str
 
    REPO_TYPE: str
 
    TEST_REVISION: str
 
    TEST_PR_SRC: str
 
    TEST_PR_DST: str
 
    TEST_PR_REVISIONS: Sized
 

	
 
    @classmethod
 
    def setup_class(cls):
kallithea/tests/base.py
Show inline comments
 
@@ -138,6 +138,8 @@ class NullHandler(logging.Handler):
 

	
 
class TestController(object):
 
    """Pytest-style test controller"""
 
    app: TestApp  # assigned by app_fixture
 
    _logged_username: str  # assigned by log_user
 

	
 
    # Note: pytest base classes cannot have an __init__ method
 

	
scripts/deps.py
Show inline comments
 
@@ -93,6 +93,7 @@ time
 
traceback
 
traitlets
 
types
 
typing
 
urllib
 
urlobject
 
uuid
0 comments (0 inline, 0 general)