Skip to content

Annotate celery/fixups#7399

Merged
auvipy merged 2 commits intocelery:masterfrom
Kludex:annotate/celery/fixups
Apr 12, 2022
Merged

Annotate celery/fixups#7399
auvipy merged 2 commits intocelery:masterfrom
Kludex:annotate/celery/fixups

Conversation

@Kludex
Copy link
Copy Markdown
Contributor

@Kludex Kludex commented Apr 3, 2022

else:
_verify_django_version(django)
return DjangoFixup(app).install()
return None
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Be consistent in return statements. Either all return statements in a function should return an expression, or none of them should. If any return statement returns an expression, any return statements where no value is returned should explicitly state this as return

https://peps.python.org/pep-0008/#programming-recommendations

It's either this or # type: ignore[return]. I'm not attached to any option.

@Kludex Kludex marked this pull request as ready for review April 3, 2022 06:03
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2022

Codecov Report

Merging #7399 (7667ae3) into master (1ccd887) will decrease coverage by 0.04%.
The diff coverage is 77.77%.

@@            Coverage Diff             @@
##           master    #7399      +/-   ##
==========================================
- Coverage   89.30%   89.26%   -0.05%     
==========================================
  Files         138      138              
  Lines       16762    16772      +10     
  Branches     2451     2453       +2     
==========================================
+ Hits        14969    14971       +2     
- Misses       1561     1568       +7     
- Partials      232      233       +1     
Flag Coverage Δ
unittests 89.25% <77.77%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
celery/fixups/django.py 88.88% <77.77%> (-5.15%) ⬇️
celery/backends/asynchronous.py 67.09% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1ccd887...7667ae3. Read the comment docs.

@auvipy auvipy self-requested a review April 3, 2022 06:55
@Kludex Kludex mentioned this pull request Apr 3, 2022
@lgtm-com
Copy link
Copy Markdown

lgtm-com bot commented Apr 3, 2022

This pull request fixes 1 alert when merging 7667ae3 into 1ccd887 - view on LGTM.com

fixed alerts:

  • 1 for Non-exception in 'except' clause

self._worker_fixup = value

def on_import_modules(self, **kwargs):
def on_import_modules(self, **kwargs: Any) -> None:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am reluctant to use Any type

Copy link
Copy Markdown
Contributor Author

@Kludex Kludex Apr 12, 2022

Choose a reason for hiding this comment

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

I can see that... It's not like I'm a big fan of it as well...

Comments being against those will not be productive, if you have a suggestion of which type to add there, it can be more helpful.

As you added Seth's blog post as an argument of not using Any, I just want to let you know that urllib3 does have them:

➜  src git:(main) pwd
/Users/marcelotryle/Development/fork/urllib3/src
➜  src git:(main) grep -r "Any"
./urllib3/util/ssltransport.py:    Any,
./urllib3/util/ssltransport.py:    def __exit__(self, *_: Any) -> None:
./urllib3/util/ssltransport.py:    def read(self, len: int = 1024, buffer: Optional[Any] = None) -> Union[int, bytes]:
./urllib3/util/request.py:from typing import IO, TYPE_CHECKING, Any, AnyStr, Dict, List, Optional, Union
./urllib3/util/request.py:    body: Any, pos: Optional[_TYPE_BODY_POSITION]
./urllib3/util/request.py:def rewind_body(body: IO[AnyStr], body_pos: _TYPE_BODY_POSITION) -> None:
./urllib3/util/retry.py:    Any,
./urllib3/util/retry.py:    def new(self, **kw: Any) -> "Retry":
./urllib3/util/url.py:        # Anything other than '..', should be appended to the output
./urllib3/util/ssl_match_hostname.py:from typing import TYPE_CHECKING, Any, Match, Optional, Tuple, Union
./urllib3/util/ssl_match_hostname.py:    dn: Any, hostname: str, max_wildcards: int = 1
./urllib3/__init__.py:from typing import Any, Mapping, Optional, TextIO, Type, Union
./urllib3/__init__.py:    json: Optional[Any] = None,
./urllib3/poolmanager.py:    Any,
./urllib3/poolmanager.py:    key_class: Type[PoolKey], request_context: Dict[str, Any]
./urllib3/poolmanager.py:        **connection_pool_kw: Any,
./urllib3/poolmanager.py:        def dispose_func(p: Any) -> None:
./urllib3/poolmanager.py:        request_context: Optional[Dict[str, Any]] = None,
./urllib3/poolmanager.py:        pool_kwargs: Optional[Dict[str, Any]] = None,
./urllib3/poolmanager.py:        self, request_context: Dict[str, Any]
./urllib3/poolmanager.py:        self, pool_key: PoolKey, request_context: Dict[str, Any]
./urllib3/poolmanager.py:        self, url: str, pool_kwargs: Optional[Dict[str, Any]] = None
./urllib3/poolmanager.py:    def _merge_pool_kwargs(self, override: Optional[Dict[str, Any]]) -> Dict[str, Any]:
./urllib3/poolmanager.py:        Any keys in the override dictionary with a value of ``None`` are
./urllib3/poolmanager.py:        self, method: str, url: str, redirect: bool = True, **kw: Any
./urllib3/poolmanager.py:        **connection_pool_kw: Any,
./urllib3/poolmanager.py:        pool_kwargs: Optional[Dict[str, Any]] = None,
./urllib3/poolmanager.py:        self, method: str, url: str, redirect: bool = True, **kw: Any
./urllib3/poolmanager.py:def proxy_from_url(url: str, **kw: Any) -> ProxyManager:
./urllib3/response.py:    Any,
./urllib3/response.py:    def json(self) -> Any:
./urllib3/response.py:        ResponseCls: Type["HTTPResponse"], r: _HttplibHTTPResponse, **response_kw: Any
./urllib3/contrib/securetransport.py:    Any,
./urllib3/contrib/securetransport.py:        client_key_passphrase: Any,
./urllib3/contrib/securetransport.py:    *args: Any,
./urllib3/contrib/securetransport.py:    **kwargs: Any,
./urllib3/contrib/securetransport.py:    def check_hostname(self, value: Any) -> None:
./urllib3/contrib/securetransport.py:    def set_ciphers(self, ciphers: Any) -> None:
./urllib3/contrib/socks.py:from typing import Any, Dict, Mapping, Optional
./urllib3/contrib/socks.py:    _TYPE_SOCKS_OPTIONS = Dict[str, Any]  # type: ignore[misc, assignment]
./urllib3/contrib/socks.py:        self, _socks_options: _TYPE_SOCKS_OPTIONS, *args: Any, **kwargs: Any
./urllib3/contrib/socks.py:        extra_kw: Dict[str, Any] = {}
./urllib3/contrib/socks.py:        **connection_pool_kw: Any,
./urllib3/contrib/pyopenssl.py:from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
./urllib3/contrib/pyopenssl.py:    def recv(self, *args: Any, **kwargs: Any) -> bytes:
./urllib3/contrib/pyopenssl.py:    def recv_into(self, *args: Any, **kwargs: Any) -> int:
./urllib3/contrib/pyopenssl.py:    def getpeercert(self, binary_form: bool = False) -> Dict[str, List[Any]]:
./urllib3/contrib/_securetransport/low_level.py:from typing import Any, List, Optional, Tuple, Type
./urllib3/contrib/_securetransport/low_level.py:def _cf_dictionary_from_tuples(tuples: List[Tuple[Any, Any]]) -> CFDictionary:
./urllib3/connection.py:    Any,
./urllib3/connection.py:_TYPE_BODY = Union[bytes, IO[Any], Iterable[bytes], str]
./urllib3/_request_methods.py:from typing import Any, Dict, Mapping, Optional, Sequence, Tuple, Union
./urllib3/_request_methods.py:        **kw: Any,
./urllib3/_request_methods.py:        json: Optional[Any] = None,
./urllib3/_request_methods.py:        **urlopen_kw: Any,
./urllib3/_request_methods.py:        extra_kw: Dict[str, Any] = {"headers": headers}
./urllib3/_request_methods.py:        extra_kw: Dict[str, Any] = {"headers": {}}
./urllib3/connectionpool.py:from typing import TYPE_CHECKING, Any, Mapping, Optional, Type, TypeVar, Union, overload
./urllib3/connectionpool.py:        **conn_kw: Any,
./urllib3/connectionpool.py:        self.pool: Optional[queue.LifoQueue[Any]] = self.QueueCls(maxsize)
./urllib3/connectionpool.py:        **httplib_request_kw: Any,
./urllib3/connectionpool.py:        **response_kw: Any,
./urllib3/connectionpool.py:        **conn_kw: Any,
./urllib3/connectionpool.py:def connection_from_url(url: str, **kw: Any) -> HTTPConnectionPool:

@auvipy auvipy merged commit de65e6a into celery:master Apr 12, 2022
@auvipy
Copy link
Copy Markdown
Member

auvipy commented Apr 12, 2022

OK let's go with some of them

@Kludex
Copy link
Copy Markdown
Contributor Author

Kludex commented Apr 12, 2022

Thanks 👍

I'll try to spend more time on each Any to see if I can do better on the next ones. 👍

@Kludex Kludex deleted the annotate/celery/fixups branch April 12, 2022 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants