0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +01:00

style(flake8): enable B010 (#12424)

* style(flake8): enable B010

* Ignore mypy
This commit is contained in:
Guido Iaquinti 2022-10-26 04:11:46 -04:00 committed by GitHub
parent 05c511670d
commit 4d724c1edc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 4 deletions

View File

@ -13,7 +13,6 @@ ignore=
B001, # Do not use bare `except:`.
B006, # Do not use mutable data structures for argument defaults.
B011, # Do not call assert False since python -O removes these calls
B010, # Do not call setattr with a constant attribute value, it is not any safer than normal property access.
B017, # assertRaises(Exception): should be considered evil
B019, # Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks.
B024, # ClickhouseFunnelBase is an abstract base class, but it has no abstract methods. Remember to use @abstractmethod, @abstractclassmethod and/or @abstractproperty decorators.

View File

@ -35,7 +35,7 @@ class PersonalAPIKeySerializerCreateOnly(serializers.ModelSerializer):
value = generate_random_token_personal()
secure_value = hash_key_value(value)
personal_api_key = PersonalAPIKey.objects.create(user=user, secure_value=secure_value, **validated_data)
setattr(personal_api_key, "_value", value)
personal_api_key._value = value # type: ignore
return personal_api_key

View File

@ -147,7 +147,7 @@ class AutoProjectMiddleware:
user.current_organization_id = actual_item_team.organization_id
user.save()
# Information for POSTHOG_APP_CONTEXT
setattr(request, "switched_team", current_team.id)
request.switched_team = current_team.id # type: ignore
class CHQueries:

View File

@ -34,7 +34,7 @@ class ElementGroupManager(models.Manager):
)
for element in elements:
element.group = group
setattr(element, "pk", None)
element.pk = None
Element.objects.bulk_create(elements)
return group