Skip to content

Commit 7426bc7

Browse files
authored
Auto sort imports (#73)
1 parent 754726e commit 7426bc7

File tree

12 files changed

+222
-63
lines changed

12 files changed

+222
-63
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[flake8]
22
max-line-length = 88
33
extend-ignore = E203
4+
exclude = .git,__pycache__,build,.venv/

.github/workflows/code-quality.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,17 @@ on:
88
pull_request:
99
types: [ assigned, opened, synchronize, reopened ]
1010
jobs:
11-
formatting-check:
12-
name: Formatting Check
13-
runs-on: ubuntu-latest
14-
steps:
15-
- uses: actions/checkout@v3
16-
- uses: psf/black@stable
17-
with:
18-
jupyter: true
19-
linting-check:
20-
name: Linting Check
11+
check:
12+
name: Format and Lint Checks
2113
runs-on: ubuntu-latest
2214
steps:
2315
- uses: actions/checkout@v3
2416
- uses: actions/setup-python@v4
2517
with:
26-
python-version: "3.10"
18+
python-version: '3.10'
19+
cache: 'pip'
2720
- run: python -m pip install --upgrade pip
28-
- run: python -m pip install .
29-
- run: python -m pip install --upgrade flake8
30-
- run: python -m flake8 . --exclude build/
21+
- run: python -m pip install .[dev]
22+
- run: python -m flake8 .
23+
- run: python -m isort . --check-only --diff
24+
- run: python -m black . --check --diff

.gitignore

Lines changed: 161 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,166 @@
1-
/build/
2-
*.egg-info
3-
*.pyc
4-
/.idea/
51
/data/
62
/outputs/
7-
__pycache__
83
/lightglue/weights/
9-
lightglue/_flash/
104
*-checkpoint.ipynb
115
*.pth
6+
7+
# Byte-compiled / optimized / DLL files
8+
__pycache__/
9+
*.py[cod]
10+
*$py.class
11+
12+
# C extensions
13+
*.so
14+
15+
# Distribution / packaging
16+
.Python
17+
build/
18+
develop-eggs/
19+
dist/
20+
downloads/
21+
eggs/
22+
.eggs/
23+
lib/
24+
lib64/
25+
parts/
26+
sdist/
27+
var/
28+
wheels/
29+
share/python-wheels/
30+
*.egg-info/
31+
.installed.cfg
32+
*.egg
33+
MANIFEST
34+
35+
# PyInstaller
36+
# Usually these files are written by a python script from a template
37+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
38+
*.manifest
39+
*.spec
40+
41+
# Installer logs
42+
pip-log.txt
43+
pip-delete-this-directory.txt
44+
45+
# Unit test / coverage reports
46+
htmlcov/
47+
.tox/
48+
.nox/
49+
.coverage
50+
.coverage.*
51+
.cache
52+
nosetests.xml
53+
coverage.xml
54+
*.cover
55+
*.py,cover
56+
.hypothesis/
57+
.pytest_cache/
58+
cover/
59+
60+
# Translations
61+
*.mo
62+
*.pot
63+
64+
# Django stuff:
65+
*.log
66+
local_settings.py
67+
db.sqlite3
68+
db.sqlite3-journal
69+
70+
# Flask stuff:
71+
instance/
72+
.webassets-cache
73+
74+
# Scrapy stuff:
75+
.scrapy
76+
77+
# Sphinx documentation
78+
docs/_build/
79+
80+
# PyBuilder
81+
.pybuilder/
82+
target/
83+
84+
# Jupyter Notebook
85+
.ipynb_checkpoints
86+
87+
# IPython
88+
profile_default/
89+
ipython_config.py
90+
91+
# pyenv
92+
# For a library or package, you might want to ignore these files since the code is
93+
# intended to run in multiple environments; otherwise, check them in:
94+
# .python-version
95+
96+
# pipenv
97+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
98+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
99+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
100+
# install all needed dependencies.
101+
#Pipfile.lock
102+
103+
# poetry
104+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105+
# This is especially recommended for binary packages to ensure reproducibility, and is more
106+
# commonly ignored for libraries.
107+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108+
#poetry.lock
109+
110+
# pdm
111+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112+
#pdm.lock
113+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114+
# in version control.
115+
# https://pdm.fming.dev/#use-with-ide
116+
.pdm.toml
117+
118+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
119+
__pypackages__/
120+
121+
# Celery stuff
122+
celerybeat-schedule
123+
celerybeat.pid
124+
125+
# SageMath parsed files
126+
*.sage.py
127+
128+
# Environments
129+
.env
130+
.venv
131+
env/
132+
venv/
133+
ENV/
134+
env.bak/
135+
venv.bak/
136+
137+
# Spyder project settings
138+
.spyderproject
139+
.spyproject
140+
141+
# Rope project settings
142+
.ropeproject
143+
144+
# mkdocs documentation
145+
/site
146+
147+
# mypy
148+
.mypy_cache/
149+
.dmypy.json
150+
dmypy.json
151+
152+
# Pyre type checker
153+
.pyre/
154+
155+
# pytype static type analyzer
156+
.pytype/
157+
158+
# Cython debug symbols
159+
cython_debug/
160+
161+
# PyCharm
162+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
163+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
164+
# and can be added to the global gitignore or merged into this file. For a more nuclear
165+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
166+
.idea/

benchmark.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# Benchmark script for LightGlue on real images
2-
from pathlib import Path
32
import argparse
4-
import matplotlib.pyplot as plt
5-
from collections import defaultdict
63
import time
4+
from collections import defaultdict
5+
from pathlib import Path
6+
7+
import matplotlib.pyplot as plt
78
import numpy as np
89
import torch
10+
import torch._dynamo
911

1012
from lightglue import LightGlue, SuperPoint
1113
from lightglue.utils import load_image
12-
import torch._dynamo
1314

1415
torch.set_grad_enabled(False)
1516

lightglue/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1+
from .disk import DISK # noqa
12
from .lightglue import LightGlue # noqa
23
from .superpoint import SuperPoint # noqa
3-
from .disk import DISK # noqa
44
from .utils import match_pair # noqa

lightglue/disk.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
from types import SimpleNamespace
2+
3+
import kornia
14
import torch
25
import torch.nn as nn
3-
import kornia
4-
from types import SimpleNamespace
6+
57
from .utils import ImagePreprocessor
68

79

lightglue/lightglue.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import warnings
12
from pathlib import Path
23
from types import SimpleNamespace
3-
import warnings
4+
from typing import Callable, List, Optional, Tuple
5+
46
import numpy as np
57
import torch
6-
from torch import nn
78
import torch.nn.functional as F
8-
from typing import Optional, List, Callable, Tuple
9+
from torch import nn
910

1011
try:
1112
from flash_attn.modules.mha import FlashCrossAttention

lightglue/superpoint.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444

4545
import torch
4646
from torch import nn
47+
4748
from .utils import ImagePreprocessor
4849

4950

lightglue/utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import collections.abc as collections
12
from pathlib import Path
2-
import torch
3-
import kornia
3+
from types import SimpleNamespace
4+
from typing import Callable, List, Optional, Tuple, Union
5+
46
import cv2
7+
import kornia
58
import numpy as np
6-
from typing import Union, List, Optional, Callable, Tuple
7-
import collections.abc as collections
8-
from types import SimpleNamespace
9+
import torch
910

1011

1112
class ImagePreprocessor:

lightglue/viz2d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"""
77

88
import matplotlib
9-
import matplotlib.pyplot as plt
109
import matplotlib.patheffects as path_effects
10+
import matplotlib.pyplot as plt
1111
import numpy as np
1212
import torch
1313

0 commit comments

Comments
 (0)