mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 01:52:56 +01:00
Streamline Python file headers somewhat
- Add coding statement
- Import all modules in one line where possible
- Order: __future__, typing, plain imports, from imports,
janware modules
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
862a5dbc95
commit
428692ea3a
21 changed files with 50 additions and 40 deletions
|
|
@ -1,17 +1,16 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
from typing import List, Type, Union, TypeVar
|
from typing import List, Type, Union, TypeVar
|
||||||
import abc
|
import inspect, sys, re, abc, argparse
|
||||||
import argparse
|
|
||||||
from abc import ABC
|
|
||||||
from argparse import ArgumentParser, _SubParsersAction
|
from argparse import ArgumentParser, _SubParsersAction
|
||||||
import inspect, sys, re
|
|
||||||
|
|
||||||
from jwutils import log
|
from jwutils import log
|
||||||
|
|
||||||
# full blown example of one level of nested subcommands
|
# full blown example of one level of nested subcommands
|
||||||
# git -C project remote -v show -n myremote
|
# git -C project remote -v show -n myremote
|
||||||
|
|
||||||
class Cmd(ABC): # export
|
class Cmd(abc.ABC): # export
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
async def run(self, args):
|
async def run(self, args):
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,8 @@
|
||||||
import os
|
# -*- coding: utf-8 -*-
|
||||||
import sys
|
|
||||||
import argparse
|
|
||||||
import importlib
|
|
||||||
import inspect
|
|
||||||
import re
|
|
||||||
import pickle
|
|
||||||
import asyncio
|
|
||||||
from argparse import ArgumentParser
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
import cProfile
|
from typing import Optional
|
||||||
|
import os, sys, argparse, importlib, inspect, re, pickle, asyncio, cProfile
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
import jwutils
|
import jwutils
|
||||||
from jwutils.log import *
|
from jwutils.log import *
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import glob
|
|
||||||
import sys
|
|
||||||
from pathlib import Path, PosixPath
|
|
||||||
from typing import Optional, Dict, cast
|
from typing import Optional, Dict, cast
|
||||||
|
import os, re, glob, sys
|
||||||
|
from pathlib import Path, PosixPath
|
||||||
|
|
||||||
from jwutils import stree
|
from jwutils import stree
|
||||||
from .stree.StringTree import StringTree
|
from .stree.StringTree import StringTree
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
class CppState: # export
|
class CppState: # export
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import jwutils.log
|
import jwutils.log
|
||||||
|
|
||||||
class Object(object): # export
|
class Object(object): # export
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from enum import Enum, Flag, auto
|
from enum import Enum, Flag, auto
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import os
|
|
||||||
import io
|
import os, io, sys, traceback
|
||||||
import sys
|
|
||||||
import traceback
|
|
||||||
from fcntl import fcntl, F_GETFL, F_SETFL
|
from fcntl import fcntl, F_GETFL, F_SETFL
|
||||||
|
|
||||||
class RedirectStdIO: # export
|
class RedirectStdIO: # export
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
from abc import ABC, abstractmethod
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Dict, Callable
|
from typing import Dict, Callable
|
||||||
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
_handled_signals: Dict[int, Callable] = {}
|
_handled_signals: Dict[int, Callable] = {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from .log import *
|
from .log import *
|
||||||
|
|
||||||
class StopWatch: # export
|
class StopWatch: # export
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import re, shlex
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import re, shlex
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
from ..log import *
|
from ..log import *
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
|
|
||||||
from ..Process import Process as ProcessBase
|
from ..Process import Process as ProcessBase
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from ..Signals import Signals as SignalsBase
|
from ..Signals import Signals as SignalsBase
|
||||||
|
|
||||||
class Signals(SignalsBase):
|
class Signals(SignalsBase):
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# >> -------------------------- generated by python-tools.sh >>
|
# >> -------------------------- generated by python-tools.sh >>
|
||||||
from jwutils.asyncio.Process import Process
|
from jwutils.asyncio.Process import Process
|
||||||
# << -------------------------- generated by python-tools.sh <<
|
# << -------------------------- generated by python-tools.sh <<
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import io
|
import io, os, re, textwrap, json, csv
|
||||||
import os, re, textwrap, json, csv
|
|
||||||
from tabulate import tabulate # type: ignore
|
from tabulate import tabulate # type: ignore
|
||||||
|
|
||||||
from jwutils.log import *
|
from jwutils.log import *
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,8 @@ from typing import Optional, Any
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
from ...log import *
|
|
||||||
|
|
||||||
from .DataType import DataType
|
from .DataType import DataType
|
||||||
|
from ...log import *
|
||||||
|
|
||||||
class Column(abc.ABC): # export
|
class Column(abc.ABC): # export
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from ...log import *
|
|
||||||
from enum import Enum, auto
|
from enum import Enum, auto
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
from ...log import *
|
||||||
|
|
||||||
class Id(Enum):
|
class Id(Enum):
|
||||||
Integer = auto()
|
Integer = auto()
|
||||||
SmallInteger = auto()
|
SmallInteger = auto()
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
from typing import List, Tuple, Optional, Any
|
from typing import List, Tuple, Optional, Any
|
||||||
|
|
@ -6,6 +8,7 @@ import sys, re, io, syslog, inspect
|
||||||
|
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from . import misc
|
from . import misc
|
||||||
|
|
||||||
# --- python 2 / 3 compatibility stuff
|
# --- python 2 / 3 compatibility stuff
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
import os, errno
|
# -*- coding: utf-8 -*-
|
||||||
import atexit
|
|
||||||
import tempfile
|
import os, errno, atexit, tempfile, filecmp, inspect, importlib, re
|
||||||
import filecmp
|
|
||||||
import inspect
|
|
||||||
import importlib
|
|
||||||
import re
|
|
||||||
|
|
||||||
from typing import Set, Iterable
|
from typing import Set, Iterable
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Created on 26 May 2013
|
Created on 26 May 2013
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, List, Optional, Union
|
from typing import Any, List, Optional, Union
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from jwutils.stree.StringTree import *
|
from jwutils.stree.StringTree import *
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue