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
44ce3455
Commit
44ce3455
authored
2 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Typing: SQLAlchemy 1.4 má svůj vlastní plugin do MyPy
... chodí zase jinak mizerně než ten původní.
parent
a3133d54
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.mypy.ini
+1
-1
1 addition, 1 deletion
.mypy.ini
constraints.txt
+1
-0
1 addition, 0 deletions
constraints.txt
mo/db.py
+2
-12
2 additions, 12 deletions
mo/db.py
setup.py
+1
-1
1 addition, 1 deletion
setup.py
with
5 additions
and
14 deletions
.mypy.ini
+
1
−
1
View file @
44ce3455
[mypy]
plugins
=
sql
mypy
plugins
=
sql
alchemy.ext.mypy.plugin
python_executable
=
venv/bin/python3
This diff is collapsed.
Click to expand it.
constraints.txt
+
1
−
0
View file @
44ce3455
...
...
@@ -38,6 +38,7 @@ requests==2.28.1
six==1.16.0
SQLAlchemy==1.4.40
sqlalchemy-stubs==0.4
sqlalchemy2-stubs==0.0.2a25
tomli==2.0.1
types-bleach==5.0.3
types-Flask-SQLAlchemy==2.5.9
...
...
This diff is collapsed.
Click to expand it.
mo/db.py
+
2
−
12
View file @
44ce3455
...
...
@@ -8,7 +8,7 @@ import locale
import
os
import
re
from
sqlalchemy
import
\
Boolean
,
Column
,
DateTime
,
ForeignKey
,
Integer
,
String
,
Text
,
UniqueConstraint
,
\
Boolean
,
Column
,
DateTime
,
Enum
,
ForeignKey
,
Integer
,
String
,
Text
,
UniqueConstraint
,
\
text
,
func
,
\
create_engine
,
inspect
,
select
from
sqlalchemy.engine
import
Engine
...
...
@@ -20,23 +20,13 @@ from sqlalchemy.ext.declarative import declarative_base
from
sqlalchemy.sql.expression
import
CTE
from
sqlalchemy.sql.functions
import
ReturnTypeFromArgs
from
sqlalchemy.sql.sqltypes
import
Numeric
from
typing
import
Optional
,
List
,
Tuple
from
typing
import
Any
,
Optional
,
List
,
Tuple
import
mo
import
mo.config
as
config
from
mo.place_level
import
place_levels
,
PlaceLevel
from
mo.util_format
import
timeformat_short
,
timedelta
,
time_and_timedelta
# HACK: Work-around for https://github.com/dropbox/sqlalchemy-stubs/issues/114
from
typing
import
TYPE_CHECKING
,
TypeVar
,
Type
,
Any
if
TYPE_CHECKING
:
from
sqlalchemy.sql.type_api
import
TypeEngine
T
=
TypeVar
(
'
T
'
)
class
Enum
(
TypeEngine
[
T
]):
def
__init__
(
self
,
enum
:
Type
[
T
],
**
kwargs
:
Any
)
->
None
:
...
else
:
from
sqlalchemy
import
Enum
# Funkce f_unaccent je definovaná v db.ddl, naučme Alchymii volat ji:
class
f_unaccent
(
ReturnTypeFromArgs
):
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
44ce3455
...
...
@@ -47,7 +47,7 @@ setuptools.setup(
'
python-poppler
'
,
'
pyzbar
'
,
'
requests
'
,
'
sqlalchemy
'
,
'
sqlalchemy
[mypy]
'
,
'
uwsgidecorators
'
,
# Používáme pro vývoj, ale aby je pylsp našel, musí být ve stejném virtualenvu
# jako ostatní knihovny.
...
...
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