Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.1.3 #11

Merged
merged 5 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading