Skip to content

Commit

Permalink
Merge pull request #11 from 3dem/devel
Browse files Browse the repository at this point in the history
Release 0.1.3
  • Loading branch information
delarosatrevin authored Nov 14, 2024
2 parents 072883d + 077eb9b commit bc0114d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion emtools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
# *
# **************************************************************************

__version__ = '0.1.2'
__version__ = '0.1.3'

3 changes: 2 additions & 1 deletion emtools/metadata/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def iterTable(self, tableName, **kwargs):
limit: limit to this number of elements
classes: read column names from a 'classes' table
"""
query = f"SELECT * FROM {tableName}"
where = kwargs.get('where', '1')
query = f"SELECT * FROM {tableName} WHERE {where}"

if 'start' in kwargs and 'limit' not in kwargs:
kwargs['limit'] = -1
Expand Down
4 changes: 1 addition & 3 deletions emtools/pwx/monitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,11 @@ def __init__(self, SetClass, filename, *args, **kwargs):
self._filename = filename
self.lastUpdate = None
self.streamClosed = None
self.inputCount = 0 # Count all input elements

# Black list some items to not be monitored again
# We are not interested in the items but just skip them from
# the processing
blacklist = kwargs.get('blacklist', None)
blacklist = kwargs.get('blacklist', [])
if blacklist:
for item in blacklist:
self[item.getObjId()] = True
Expand All @@ -140,7 +139,6 @@ def update(self):
setInstance = self._SetClass(filename=self._filename)
setInstance.loadAllProperties()
for item in setInstance.iterItems():
self.inputCount += 1
iid = item.getObjId()
if iid not in self:
itemClone = item.clone()
Expand Down
11 changes: 11 additions & 0 deletions emtools/utils/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# **************************************************************************

from datetime import datetime
from functools import wraps

from .pretty import Pretty

Expand Down Expand Up @@ -51,3 +52,13 @@ def __enter__(self):

def __exit__(self, type, value, traceback):
self.toc(self.message)

@staticmethod
def timeit(func):
@wraps(func)
def wrap(*args, **kw):
t = Timer()
result = func(*args, **kw)
t.toc(f"Function {func.__name__} took: ")
return result
return wrap

0 comments on commit bc0114d

Please sign in to comment.