Skip to content

Commit 77a5a8e

Browse files
committed
ci/cd fix 3: fixed ruff checks + CORS_ALLOWED_ORIGINS
1 parent 12db51d commit 77a5a8e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+604
-966
lines changed

backend/backend/asgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
from django.core.asgi import get_asgi_application
1313

14-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "backend.settings")
1515

1616
application = get_asgi_application()

backend/backend/settings.py

Lines changed: 163 additions & 161 deletions
Large diffs are not rendered by default.

backend/backend/urls.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ def metrics_view(_request):
2626
path("admin/", admin.site.urls),
2727
path("silk/", include("silk.urls", namespace="silk")),
2828
path("metrics", metrics_view),
29-
3029
# API Documentation
3130
path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
3231
path("api/docs/", SpectacularSwaggerView.as_view(url_name="schema"), name="swagger-ui"),
3332
path("api/redoc/", SpectacularRedocView.as_view(url_name="schema"), name="redoc"),
34-
3533
# Host-based routing via Traefik; include without extra path prefixes
3634
path("", include("search.urls")),
3735
path("", include("processor.urls")),

backend/backend/wsgi.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from django.core.wsgi import get_wsgi_application
44

5-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
5+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "backend.settings")
66

77
application = get_wsgi_application()
8-

backend/core/apps.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33

44
class CoreConfig(AppConfig):
5-
default_auto_field = 'django.db.models.BigAutoField'
6-
name = 'core'
7-
verbose_name = 'Core Services'
5+
default_auto_field = "django.db.models.BigAutoField"
6+
name = "core"
7+
verbose_name = "Core Services"

backend/core/domain/__init__.py

Lines changed: 47 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -47,57 +47,54 @@
4747

4848
__all__ = [
4949
# Resume entities
50-
'Resume',
51-
'PersonalInfo',
52-
'Contact',
53-
'ContactLinks',
54-
'Demographics',
55-
'Location',
56-
'WorkAuthorization',
57-
'ProfessionalProfile',
58-
'Preferences',
59-
'EmploymentHistoryItem',
60-
'EmploymentDuration',
61-
'CompanyInfo',
62-
'KeyPoint',
63-
'Technology',
64-
'Skill',
65-
'Project',
66-
'InstitutionInfo',
67-
'Coursework',
68-
'EducationExtra',
69-
'EducationItem',
70-
'Course',
71-
'Certification',
72-
'Award',
73-
'ScientificContribution',
74-
'Language',
75-
'LanguageProficiency',
76-
'EmbeddingVector',
77-
'WorkMode',
78-
'EmploymentType',
79-
'EducationStatus',
80-
'AwardType',
81-
'PublicationType',
82-
50+
"Resume",
51+
"PersonalInfo",
52+
"Contact",
53+
"ContactLinks",
54+
"Demographics",
55+
"Location",
56+
"WorkAuthorization",
57+
"ProfessionalProfile",
58+
"Preferences",
59+
"EmploymentHistoryItem",
60+
"EmploymentDuration",
61+
"CompanyInfo",
62+
"KeyPoint",
63+
"Technology",
64+
"Skill",
65+
"Project",
66+
"InstitutionInfo",
67+
"Coursework",
68+
"EducationExtra",
69+
"EducationItem",
70+
"Course",
71+
"Certification",
72+
"Award",
73+
"ScientificContribution",
74+
"Language",
75+
"LanguageProficiency",
76+
"EmbeddingVector",
77+
"WorkMode",
78+
"EmploymentType",
79+
"EducationStatus",
80+
"AwardType",
81+
"PublicationType",
8382
# Processing
84-
'ProcessingResult',
85-
'ProcessingMetadata',
86-
'EmbeddingTextData',
87-
83+
"ProcessingResult",
84+
"ProcessingMetadata",
85+
"EmbeddingTextData",
8886
# Review
89-
'ReviewResult',
90-
'SectionFeedback',
91-
'ReviewCriteria',
92-
'REVIEW_CRITERIA',
93-
87+
"ReviewResult",
88+
"SectionFeedback",
89+
"ReviewCriteria",
90+
"REVIEW_CRITERIA",
9491
# Search
95-
'VectorHit',
96-
'ResumeSearchResult',
97-
'SearchRequest',
98-
'SearchResponse',
99-
'SearchType',
100-
'SearchFilters',
101-
'FilterOption',
102-
'FilterOptionsResult',
92+
"VectorHit",
93+
"ResumeSearchResult",
94+
"SearchRequest",
95+
"SearchResponse",
96+
"SearchType",
97+
"SearchFilters",
98+
"FilterOption",
99+
"FilterOptionsResult",
103100
]

backend/core/domain/resume.py

Lines changed: 56 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class Location(BaseModel):
5959
state: str | None = None
6060
country: str | None = None
6161

62+
6263
class ContactLinks(BaseModel):
6364
telegram: str | None = None
6465
linkedin: str | None = None
@@ -89,19 +90,19 @@ class PersonalInfo(BaseModel):
8990
contact: Contact
9091
demographics: Demographics | None = None
9192

92-
@model_validator(mode='before')
93+
@model_validator(mode="before")
9394
@classmethod
9495
def accept_legacy_demographics(cls, v: dict):
95-
if isinstance(v, dict) and ('current_location' in v or 'work_authorization' in v):
96-
demo = v.get('demographics') or {}
97-
if 'current_location' in v and 'current_location' not in demo:
98-
demo['current_location'] = v.pop('current_location')
99-
if 'work_authorization' in v and 'work_authorization' not in demo:
100-
demo['work_authorization'] = v.pop('work_authorization')
101-
v['demographics'] = demo
102-
if isinstance(v, dict) and 'links' in v.get('contact', {}):
103-
links = v['contact'].pop('links')
104-
v['contact']['links'] = links
96+
if isinstance(v, dict) and ("current_location" in v or "work_authorization" in v):
97+
demo = v.get("demographics") or {}
98+
if "current_location" in v and "current_location" not in demo:
99+
demo["current_location"] = v.pop("current_location")
100+
if "work_authorization" in v and "work_authorization" not in demo:
101+
demo["work_authorization"] = v.pop("work_authorization")
102+
v["demographics"] = demo
103+
if isinstance(v, dict) and "links" in v.get("contact", {}):
104+
links = v["contact"].pop("links")
105+
v["contact"]["links"] = links
105106
return v
106107

107108

@@ -111,6 +112,7 @@ class JobPreferences(BaseModel):
111112
work_modes: list[WorkMode] = Field(default_factory=list)
112113
salary: str | None = None
113114

115+
114116
class CompanyInfo(BaseModel):
115117
name: str
116118
url: str | None = None
@@ -145,24 +147,24 @@ class EmploymentHistoryItem(BaseModel):
145147
key_points: list[KeyPoint] = Field(default_factory=list)
146148
technologies: list[Technology] = Field(default_factory=list)
147149

148-
@model_validator(mode='before')
150+
@model_validator(mode="before")
149151
@classmethod
150152
def accept_legacy_employment(cls, v: dict):
151-
if 'company' in v and isinstance(v['company'], str):
152-
v['company'] = {"name": v['company']}
153-
if 'tech_stack' in v and 'technologies' not in v:
154-
v['technologies'] = v.pop('tech_stack')
155-
if 'start_date' in v or 'end_date' in v or 'date_format' in v or 'duration_months' in v:
156-
v['duration'] = {
157-
'date_format': v.pop('date_format', 'MM.YYYY'),
158-
'start': v.pop('start_date', ''),
159-
'end': v.pop('end_date', ''),
160-
'duration_months': v.pop('duration_months', 0),
153+
if "company" in v and isinstance(v["company"], str):
154+
v["company"] = {"name": v["company"]}
155+
if "tech_stack" in v and "technologies" not in v:
156+
v["technologies"] = v.pop("tech_stack")
157+
if "start_date" in v or "end_date" in v or "date_format" in v or "duration_months" in v:
158+
v["duration"] = {
159+
"date_format": v.pop("date_format", "MM.YYYY"),
160+
"start": v.pop("start_date", ""),
161+
"end": v.pop("end_date", ""),
162+
"duration_months": v.pop("duration_months", 0),
161163
}
162-
if 'key_points' in v:
163-
v['key_points'] = [kp if isinstance(kp, dict) else {'text': kp} for kp in v['key_points']]
164-
if 'technologies' in v:
165-
v['technologies'] = [t if isinstance(t, dict) else {'name': t} for t in v['technologies']]
164+
if "key_points" in v:
165+
v["key_points"] = [kp if isinstance(kp, dict) else {"text": kp} for kp in v["key_points"]]
166+
if "technologies" in v:
167+
v["technologies"] = [t if isinstance(t, dict) else {"name": t} for t in v["technologies"]]
166168
return v
167169

168170

@@ -172,15 +174,15 @@ class Project(BaseModel):
172174
technologies: list[Technology] = Field(default_factory=list)
173175
key_points: list[KeyPoint] = Field(default_factory=list)
174176

175-
@model_validator(mode='before')
177+
@model_validator(mode="before")
176178
@classmethod
177179
def accept_legacy_project(cls, v: dict):
178-
if 'tech_stack' in v and 'technologies' not in v:
179-
v['technologies'] = v.pop('tech_stack')
180-
if 'technologies' in v:
181-
v['technologies'] = [t if isinstance(t, dict) else {'name': t} for t in v['technologies']]
182-
if 'key_points' in v:
183-
v['key_points'] = [kp if isinstance(kp, dict) else {'text': kp} for kp in v['key_points']]
180+
if "tech_stack" in v and "technologies" not in v:
181+
v["technologies"] = v.pop("tech_stack")
182+
if "technologies" in v:
183+
v["technologies"] = [t if isinstance(t, dict) else {"name": t} for t in v["technologies"]]
184+
if "key_points" in v:
185+
v["key_points"] = [kp if isinstance(kp, dict) else {"text": kp} for kp in v["key_points"]]
184186
return v
185187

186188

@@ -207,19 +209,19 @@ class EducationItem(BaseModel):
207209
coursework: list[Coursework] = Field(default_factory=list)
208210
extras: list[EducationExtra] = Field(default_factory=list)
209211

210-
@model_validator(mode='before')
212+
@model_validator(mode="before")
211213
@classmethod
212214
def accept_legacy_education(cls, v: dict):
213-
if 'institution' in v and isinstance(v['institution'], str):
214-
v['institution'] = {'name': v['institution']}
215-
if 'start_date' in v and 'start' not in v:
216-
v['start'] = v.pop('start_date')
217-
if 'end_date' in v and 'end' not in v:
218-
v['end'] = v.pop('end_date')
219-
if 'coursework' in v:
220-
v['coursework'] = [c if isinstance(c, dict) else {'text': c} for c in v['coursework']]
221-
if 'extras' in v:
222-
v['extras'] = [e if isinstance(e, dict) else {'text': e} for e in v['extras']]
215+
if "institution" in v and isinstance(v["institution"], str):
216+
v["institution"] = {"name": v["institution"]}
217+
if "start_date" in v and "start" not in v:
218+
v["start"] = v.pop("start_date")
219+
if "end_date" in v and "end" not in v:
220+
v["end"] = v.pop("end_date")
221+
if "coursework" in v:
222+
v["coursework"] = [c if isinstance(c, dict) else {"text": c} for c in v["coursework"]]
223+
if "extras" in v:
224+
v["extras"] = [e if isinstance(e, dict) else {"text": e} for e in v["extras"]]
223225
return v
224226

225227

@@ -247,11 +249,11 @@ class LanguageProficiency(BaseModel):
247249
self_assessed: str
248250
cefr: str
249251

250-
@model_validator(mode='before')
252+
@model_validator(mode="before")
251253
@classmethod
252254
def accept_legacy_language(cls, v: dict):
253-
if isinstance(v, dict) and isinstance(v.get('language'), str):
254-
v['language'] = {'name': v['language']}
255+
if isinstance(v, dict) and isinstance(v.get("language"), str):
256+
v["language"] = {"name": v["language"]}
255257
return v
256258

257259

@@ -301,16 +303,16 @@ class Resume(BaseModel):
301303
awards: list[Award] = Field(default_factory=list)
302304
scientific_contributions: list[ScientificContribution] = Field(default_factory=list)
303305

304-
@model_validator(mode='before')
306+
@model_validator(mode="before")
305307
@classmethod
306308
def accept_legacy_profile(cls, v: dict):
307-
if 'professional_profile' not in v and ('summary' in v or 'preferences' in v):
308-
v['professional_profile'] = {
309-
'summary': v.pop('summary', None),
310-
'preferences': v.pop('preferences', None),
309+
if "professional_profile" not in v and ("summary" in v or "preferences" in v):
310+
v["professional_profile"] = {
311+
"summary": v.pop("summary", None),
312+
"preferences": v.pop("preferences", None),
311313
}
312-
if 'skills' in v:
313-
v['skills'] = [s if isinstance(s, dict) else {'name': s} for s in v['skills']]
314+
if "skills" in v:
315+
v["skills"] = [s if isinstance(s, dict) else {"name": s} for s in v["skills"]]
314316
return v
315317

316318
def years_of_experience(self) -> float:

0 commit comments

Comments
 (0)