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 typing import List, Type, Union, TypeVar
|
||||
import abc
|
||||
import argparse
|
||||
from abc import ABC
|
||||
import inspect, sys, re, abc, argparse
|
||||
from argparse import ArgumentParser, _SubParsersAction
|
||||
import inspect, sys, re
|
||||
|
||||
from jwutils import log
|
||||
|
||||
# full blown example of one level of nested subcommands
|
||||
# git -C project remote -v show -n myremote
|
||||
|
||||
class Cmd(ABC): # export
|
||||
class Cmd(abc.ABC): # export
|
||||
|
||||
@abc.abstractmethod
|
||||
async def run(self, args):
|
||||
|
|
|
|||
|
|
@ -1,15 +1,8 @@
|
|||
import os
|
||||
import sys
|
||||
import argparse
|
||||
import importlib
|
||||
import inspect
|
||||
import re
|
||||
import pickle
|
||||
import asyncio
|
||||
from argparse import ArgumentParser
|
||||
from typing import Optional
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import cProfile
|
||||
from typing import Optional
|
||||
import os, sys, argparse, importlib, inspect, re, pickle, asyncio, cProfile
|
||||
from argparse import ArgumentParser
|
||||
|
||||
import jwutils
|
||||
from jwutils.log import *
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import re
|
||||
import glob
|
||||
import sys
|
||||
from pathlib import Path, PosixPath
|
||||
from typing import Optional, Dict, cast
|
||||
import os, re, glob, sys
|
||||
from pathlib import Path, PosixPath
|
||||
|
||||
from jwutils import stree
|
||||
from .stree.StringTree import StringTree
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
class CppState: # export
|
||||
|
||||
def __init__(self):
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import jwutils.log
|
||||
|
||||
class Object(object): # export
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import annotations
|
||||
from abc import ABC, abstractmethod
|
||||
from enum import Enum, Flag, auto
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import io
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
import os, io, sys, traceback
|
||||
from fcntl import fcntl, F_GETFL, F_SETFL
|
||||
|
||||
class RedirectStdIO: # export
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
from abc import ABC, abstractmethod
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from typing import Dict, Callable
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
_handled_signals: Dict[int, Callable] = {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from .log import *
|
||||
|
||||
class StopWatch: # export
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import re, shlex
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re, shlex
|
||||
from collections import namedtuple
|
||||
|
||||
from ..log import *
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from abc import abstractmethod
|
||||
|
||||
from ..Process import Process as ProcessBase
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import asyncio
|
||||
|
||||
from ..Signals import Signals as SignalsBase
|
||||
|
||||
class Signals(SignalsBase):
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# >> -------------------------- generated by python-tools.sh >>
|
||||
from jwutils.asyncio.Process import Process
|
||||
# << -------------------------- generated by python-tools.sh <<
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import io
|
||||
import os, re, textwrap, json, csv
|
||||
import io, os, re, textwrap, json, csv
|
||||
from tabulate import tabulate # type: ignore
|
||||
|
||||
from jwutils.log import *
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@ from typing import Optional, Any
|
|||
|
||||
import abc
|
||||
|
||||
from ...log import *
|
||||
|
||||
from .DataType import DataType
|
||||
from ...log import *
|
||||
|
||||
class Column(abc.ABC): # export
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from ...log import *
|
||||
from enum import Enum, auto
|
||||
from datetime import datetime
|
||||
|
||||
from ...log import *
|
||||
|
||||
class Id(Enum):
|
||||
Integer = auto()
|
||||
SmallInteger = auto()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from typing import List, Tuple, Optional, Any
|
||||
|
|
@ -6,6 +8,7 @@ import sys, re, io, syslog, inspect
|
|||
|
||||
from os.path import basename
|
||||
from datetime import datetime
|
||||
|
||||
from . import misc
|
||||
|
||||
# --- python 2 / 3 compatibility stuff
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
import os, errno
|
||||
import atexit
|
||||
import tempfile
|
||||
import filecmp
|
||||
import inspect
|
||||
import importlib
|
||||
import re
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os, errno, atexit, tempfile, filecmp, inspect, importlib, re
|
||||
|
||||
from typing import Set, Iterable
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
Created on 26 May 2013
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, List, Optional, Union
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
|
||||
from jwutils.stree.StringTree import *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue