mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Use isort
[isort](https://isort.readthedocs.io/en/latest/) sorts your Python imports so you don't have to. This makes sure that imports are always where they should be and prevents issues like duplicated imports and merge conflicts. Using pre-commit, this can be done automatically without any manual steps. Depends on #9.
This commit is contained in:
@@ -10,3 +10,15 @@ repos:
|
||||
rev: v1.3.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
|
||||
# Python import formatting
|
||||
- repo: https://github.com/asottile/seed-isort-config
|
||||
rev: v1.9.3
|
||||
hooks:
|
||||
- id: seed-isort-config
|
||||
|
||||
- repo: https://github.com/timothycrosley/isort
|
||||
rev: 4.3.21-2
|
||||
hooks:
|
||||
- id: isort
|
||||
additional_dependencies: ["toml"]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import sys
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.abspath('.'))
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
|
||||
import requests
|
||||
|
||||
# sys.path.insert(1, 'lib/')
|
||||
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
import cgi
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, '../')
|
||||
from config import Config
|
||||
|
||||
sys.path.insert(0, '../')
|
||||
|
||||
|
||||
class Frontend():
|
||||
"""Dynamic frontend display functions"""
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
import sys
|
||||
import sqlite3
|
||||
import sys
|
||||
|
||||
# sys.path.insert(1, '../')
|
||||
from config import Config
|
||||
|
||||
db_pointer = Config().catalogue_db
|
||||
|
||||
|
||||
|
||||
7
main.py
7
main.py
@@ -2,11 +2,10 @@
|
||||
import sys
|
||||
|
||||
from config import Config
|
||||
from lib.library import Catalogue
|
||||
from lib.pyShelf import InitFiles
|
||||
from lib.pyShelf import BookServer
|
||||
from lib.pyShelf import BookDisplay
|
||||
from lib.display import Frontend
|
||||
from lib.library import Catalogue
|
||||
from lib.pyShelf import BookDisplay, BookServer, InitFiles
|
||||
|
||||
# sys.path.insert(1, 'lib/')
|
||||
|
||||
config = Config() # Get configuration settings
|
||||
|
||||
10
pyproject.toml
Normal file
10
pyproject.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
[tool.isort]
|
||||
force_grid_wrap = 0
|
||||
include_trailing_comma = true
|
||||
line_length = 88
|
||||
multi_line_output = 3
|
||||
use_parentheses = true
|
||||
# NOTE: the known_third_party setting is managed by
|
||||
# seed-isort-config and should not be modified directly.
|
||||
# Any changes made to this setting will be overwritten.
|
||||
known_third_party = ["PIL", "bs4", "requests"]
|
||||
@@ -1,2 +1,3 @@
|
||||
import sys
|
||||
|
||||
sys.path.insert(1, '../lib/')
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
from lib.pyShelf import BookDisplay, BookServer
|
||||
from lib.display import Frontend
|
||||
from lib.pyShelf import BookDisplay, BookServer
|
||||
|
||||
sys.path.insert(0, '../lib')
|
||||
sys.path.insert(1, '../')
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import unittest
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
# sys.path.insert(1, '../')
|
||||
from lib.storage import Storage
|
||||
|
||||
|
||||
Reference in New Issue
Block a user