Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
372e57ed
Commit
372e57ed
authored
1 year ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Import: Funkce na výpis varování
parent
4a70ecf5
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/imports.py
+13
-4
13 additions, 4 deletions
mo/imports.py
with
13 additions
and
4 deletions
mo/imports.py
+
13
−
4
View file @
372e57ed
...
@@ -76,16 +76,25 @@ class Import:
...
@@ -76,16 +76,25 @@ class Import:
self
.
to_log
=
[]
self
.
to_log
=
[]
self
.
user
=
user
self
.
user
=
user
def
error
(
self
,
msg
:
str
)
->
Any
:
def
_format_message
(
self
,
msg
:
str
)
->
str
:
if
self
.
line_number
>
0
:
if
self
.
line_number
>
0
:
if
self
.
row_name
:
if
self
.
row_name
:
msg
=
f
"
Řádek
{
self
.
line_number
}
(
{
self
.
row_name
}
):
{
msg
}
"
return
f
"
Řádek
{
self
.
line_number
}
(
{
self
.
row_name
}
):
{
msg
}
"
else
:
else
:
msg
=
f
"
Řádek
{
self
.
line_number
}
:
{
msg
}
"
return
f
"
Řádek
{
self
.
line_number
}
:
{
msg
}
"
return
msg
def
error
(
self
,
msg
:
str
)
->
Any
:
msg
=
self
.
_format_message
(
msg
)
self
.
errors
.
append
(
msg
)
self
.
errors
.
append
(
msg
)
logger
.
info
(
'
Import:
>
> %s
'
,
msg
)
logger
.
info
(
'
Import:
E
> %s
'
,
msg
)
return
None
# Kdyby bylo otypováno správně jako -> None, při volání by si mypy stěžoval
return
None
# Kdyby bylo otypováno správně jako -> None, při volání by si mypy stěžoval
def
warning
(
self
,
msg
:
str
)
->
None
:
msg
=
self
.
_format_message
(
msg
)
self
.
warnings
.
append
(
msg
)
logger
.
info
(
'
Import: W> %s
'
,
msg
)
def
parse_user_id
(
self
,
user_id_str
:
str
)
->
Optional
[
int
]:
def
parse_user_id
(
self
,
user_id_str
:
str
)
->
Optional
[
int
]:
if
user_id_str
==
""
:
if
user_id_str
==
""
:
return
self
.
error
(
'
Chybí ID uživatele
'
)
return
self
.
error
(
'
Chybí ID uživatele
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment