Skip to content

Commit

Permalink
*hotfix linters,pro-commit-hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman-Zhirovskis committed Jun 29, 2023
1 parent e6663d4 commit bf1c054
Show file tree
Hide file tree
Showing 26 changed files with 144 additions and 347 deletions.
21 changes: 17 additions & 4 deletions backend/users/.flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
[flake8]
ignore = E203, E231, E266, E501, W503, F403, F401
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4,B9
max-line-length = 100
extend-ignore =
# assignment lambda to variable - okay
E731,
# unnecessary variable assignment before return statement.
R504,

per-file-ignores =
# imported but unused
__init__.py: F401,
#just for project git workflow
admin.py: F401,

exclude =
venv
**migrations**
__init__.py

11 changes: 5 additions & 6 deletions backend/users/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
files: 'backend/users*'
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.3.0
hooks:
- id: black
args: [--skip-string-normalization, --line-length=100, backend/users]
language_version: python3.11

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
- repo: https://github.com/pycqa/flake8.git
rev: 6.0.0
hooks:
- id: flake8
args: [--config=backend/users/.flake8, backend/users]
language_version: python3.11
- id: flake8
args: [--config, backend/users/.flake8]
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('administrator', '0001_initial'),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('administrator', '0002_remove_admin_date_joined'),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
('common', '0002_alter_contacttype_options_alter_country_id_and_more'),
('administrator', '0003_remove_admin_last_login'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class Migration(migrations.Migration):

dependencies = [
('customer', '0004_alter_customeruser_managers'),
('administrator', '0004_alter_adminpermission_options_and_more'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class Migration(migrations.Migration):

dependencies = [
('customer', '0004_alter_customeruser_managers'),
('developer', '0006_company_is_banned'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('administrator', '0006_companymoderate_companyusermoderate_customermoderate_and_more'),
]
Expand Down
28 changes: 16 additions & 12 deletions backend/users/backend/administrator/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class Meta(BasePermission.Meta):


class AdminPermissionMixin(BasePermissionMixin):
"""asdasd"""

def has_perm(self, perm, obj=None):
if self.is_active and self.is_superuser:
return True
Expand Down Expand Up @@ -57,6 +59,8 @@ class Meta(BaseGroup.Meta):


class AdminManager(UserManager):
"""asda"""

def _create_admin_user(self, username, email, phone, password, **extra_fields):
if not username:
raise ValueError("The given username must be set")
Expand Down Expand Up @@ -139,42 +143,42 @@ class Meta:

class CustomerModerate(BaseModerate):
customer = models.ForeignKey(
CustomerUser, on_delete=models.CASCADE, related_name='moderate_reasons'
CustomerUser, on_delete=models.CASCADE, related_name="moderate_reasons"
)
admin = models.ForeignKey(Admin, on_delete=models.SET_NULL, null=True)

def __str__(self):
return f"{self.customer}: {self.reason}"

class Meta:
db_table = 'customer_moderate_reasons'
verbose_name = _('Customer moderate reason')
verbose_name_plural = _('Customers moderate reasons')
db_table = "customer_moderate_reasons"
verbose_name = _("Customer moderate reason")
verbose_name_plural = _("Customers moderate reasons")


class CompanyUserModerate(BaseModerate):
company_user = models.ForeignKey(
CompanyUser, on_delete=models.CASCADE, related_name='moderate_reasons'
CompanyUser, on_delete=models.CASCADE, related_name="moderate_reasons"
)
admin = models.ForeignKey(Admin, on_delete=models.SET_NULL, null=True)

def __str__(self):
return f"{self.company_user}: {self.reason}"

class Meta:
db_table = 'developer_moderate_reasons'
verbose_name = _('Developer moderate reason')
verbose_name_plural = _('Developers moderate reasons')
db_table = "developer_moderate_reasons"
verbose_name = _("Developer moderate reason")
verbose_name_plural = _("Developers moderate reasons")


class CompanyModerate(BaseModerate):
company = models.ForeignKey(Company, on_delete=models.CASCADE, related_name='moderate_reasons')
company = models.ForeignKey(Company, on_delete=models.CASCADE, related_name="moderate_reasons")
admin = models.ForeignKey(Admin, on_delete=models.SET_NULL, null=True)

def __str__(self):
return f"{self.company}: {self.reason}"

class Meta:
db_table = 'company_moderate_reasons'
verbose_name = _('Company moderate reason')
verbose_name_plural = _('Company moderate reasons')
db_table = "company_moderate_reasons"
verbose_name = _("Company moderate reason")
verbose_name_plural = _("Company moderate reasons")
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class Meta:


class CompanyRetrieveSerializer(serializers.ModelSerializer):

employers = DeveloperRetrieveSerializer(many=True, read_only=True)

class Meta:
Expand Down
1 change: 0 additions & 1 deletion backend/users/backend/common/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('common', '0001_initial'),
]
Expand Down
1 change: 0 additions & 1 deletion backend/users/backend/customer/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('customer', '0001_initial'),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('customer', '0002_remove_customeruser_date_joined'),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
('customer', '0003_remove_customeruser_last_login'),
]
Expand Down
5 changes: 1 addition & 4 deletions backend/users/backend/customer/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.urls import path
from rest_framework.routers import DefaultRouter

from customer.views.v1.auth_view import CustomerAuthView
from customer.views.v1 import account_views
Expand Down Expand Up @@ -37,9 +36,7 @@
),
path(
"friends_requests/",
customer_friend_view.ListRetrieveAcceptRejectAddFriendsView.as_view(
{"get": "list"}
),
customer_friend_view.ListRetrieveAcceptRejectAddFriendsView.as_view({"get": "list"}),
name="list-friends-requests",
),
path(
Expand Down
1 change: 0 additions & 1 deletion backend/users/backend/developer/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('developer', '0001_initial'),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('developer', '0002_remove_companyuser_date_joined'),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
('common', '0002_alter_contacttype_options_alter_country_id_and_more'),
('developer', '0003_remove_companyuser_last_login'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
('developer', '0004_alter_company_options_alter_companycontact_options_and_more'),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('developer', '0005_alter_companyuser_managers'),
]
Expand Down
Loading

0 comments on commit bf1c054

Please sign in to comment.