Skip to content

Commit

Permalink
black format + ruff lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jonwright committed Oct 31, 2023
1 parent 62dfc87 commit 778c232
Show file tree
Hide file tree
Showing 79 changed files with 9,278 additions and 7,639 deletions.
296 changes: 182 additions & 114 deletions ImageD11/ImageD11_file_series.py

Large diffs are not rendered by default.

19 changes: 11 additions & 8 deletions ImageD11/ImageD11_thread.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


from __future__ import print_function

# ImageD11_v1.0 Software for beamline ID11
Expand All @@ -20,29 +18,34 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 0211-1307 USA

try:
import Queue
pass
except:
# python 3?
import queue as Queue
pass

import threading

# global stop_now
stop_now = False


class ImageD11_thread(threading.Thread):
""" Add a stopping mechanism for unhandled exceptions """
"""Add a stopping mechanism for unhandled exceptions"""

def __init__(self, myname="ImageD11_thread"):
self.myname=myname
self.myname = myname
threading.Thread.__init__(self)

def run(self):
global stop_now
try:
self.ImageD11_run()
except:
stop_now = True
raise

def ImageD11_stop_now(self):
global stop_now
if stop_now:
print( "Got a stop in",self.myname)
print("Got a stop in", self.myname)
return stop_now
24 changes: 15 additions & 9 deletions ImageD11/ImageD11options.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import os, logging

# Try to manage the options coming and going to the different scripts
Expand All @@ -8,42 +7,49 @@
#
# Previously we had "optparse", this becomes "argparse" for later pythons
#
# The idea is to use something like gooey or argparseui which hook to
# The idea is to use something like gooey or argparseui which hook to
# the parsers _actions list to see what can be offered.
#
# We define a few "types" corresponding to ImageD11 known filetypes to
# We define a few "types" corresponding to ImageD11 known filetypes to
# help when identifying what an optiong is so we could hook up plotting
# and editing to the different entities


class FileType(object):
def __init__(self, mode='r'):
assert mode in 'rw'
def __init__(self, mode="r"):
assert mode in "rw"
self._mode = mode

def __call__(self, string):
if 'r' in self._mode:
if not os.path.exists( string ):
if "r" in self._mode:
if not os.path.exists(string):
logging.error("File %s not found", string)
return string


class ParameterFileType(FileType):
pass


class ColumnFileType(FileType):
pass


class UbiFileType(FileType):
pass


class ImageFileType(FileType):
pass


class SplineFileType(FileType):
pass


class GvectorFileType(FileType):
pass


class HdfFileType(FileType):
pass


9 changes: 3 additions & 6 deletions ImageD11/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""

__version__ = "2.0.0"
__author__ = 'Jon Wright',
__author_email__ = '[email protected]'



__version__ = "2.0.0"
__author__ = ("Jon Wright",)
__author_email__ = "[email protected]"
Loading

0 comments on commit 778c232

Please sign in to comment.