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:
Jan Lindemann 2025-07-10 05:14:06 +02:00
commit 428692ea3a
21 changed files with 50 additions and 40 deletions

View file

@ -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):

View file

@ -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 *

View file

@ -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

View file

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
class CppState: # export
def __init__(self):

View file

@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
import jwutils.log
class Object(object): # export

View file

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import annotations
from abc import ABC, abstractmethod
from enum import Enum, Flag, auto

View file

@ -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

View file

@ -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] = {}

View file

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from .log import *
class StopWatch: # export

View file

@ -1,5 +1,6 @@
import re, shlex
# -*- coding: utf-8 -*-
import re, shlex
from collections import namedtuple
from ..log import *

View file

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
from abc import abstractmethod
from ..Process import Process as ProcessBase

View file

@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
import asyncio
from ..Signals import Signals as SignalsBase
class Signals(SignalsBase):

View file

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
# >> -------------------------- generated by python-tools.sh >>
from jwutils.asyncio.Process import Process
# << -------------------------- generated by python-tools.sh <<

View file

@ -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 *

View file

@ -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

View file

@ -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()

View file

@ -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

View file

@ -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

View file

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
'''
Created on 26 May 2013

View file

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import annotations
from typing import Any, List, Optional, Union

View file

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
import os
from jwutils.stree.StringTree import *