Skip to content

Commit e74c263

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent b69497f commit e74c263

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

ipyparallel/controller/dictdb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
# Copyright (c) IPython Development Team.
3737
# Distributed under the terms of the Modified BSD License.
3838
import copy
39-
from copy import deepcopy
40-
from datetime import datetime
4139
import fnmatch
4240
import re
41+
from copy import deepcopy
42+
from datetime import datetime
4343

4444
from traitlets import Dict, Float, Integer, Unicode
4545
from traitlets.config.configurable import LoggingConfigurable

ipyparallel/controller/sqlitedb.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ def _convert_timestamp(s):
100100
"""Adapt text timestamp to datetime"""
101101
return ensure_timezone(dateutil_parse(s))
102102

103+
103104
def _regexp(expr, item):
104105
"""sqlite callback function for performing a regex operation"""
105106
reg = re.compile(expr)
106107
return reg.match(item) is not None
107108

109+
108110
# -----------------------------------------------------------------------------
109111
# SQLiteDB class
110112
# -----------------------------------------------------------------------------

ipyparallel/tests/test_db.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
# Copyright (c) IPython Development Team.
44
# Distributed under the terms of the Modified BSD License.
5+
import fnmatch
56
import logging
67
import os
8+
import re
79
import tempfile
810
import time
911
from datetime import datetime, timedelta
1012
from unittest import TestCase
11-
import fnmatch
12-
import re
1313

1414
import pytest
1515
from jupyter_client.session import Session
@@ -155,18 +155,17 @@ def test_find_records_regex(self):
155155
hist = self.db.get_history()
156156

157157
pattern = "^.+_.$"
158-
ref = [msg_id for msg_id in hist if re.match(pattern,msg_id)]
158+
ref = [msg_id for msg_id in hist if re.match(pattern, msg_id)]
159159
recs = self.db.find_records({'msg_id': {'$regex': pattern}}, ["msg_id"])
160160
found = [r['msg_id'] for r in recs]
161161
assert set(ref) == set(found)
162162

163163
pattern = "^.+_1[0-9]$"
164-
ref = [msg_id for msg_id in hist if re.match(pattern,msg_id)]
164+
ref = [msg_id for msg_id in hist if re.match(pattern, msg_id)]
165165
recs = self.db.find_records({'msg_id': {'$regex': pattern}}, ["msg_id"])
166166
found = [r['msg_id'] for r in recs]
167167
assert set(ref) == set(found)
168168

169-
170169
def test_get_history(self):
171170
msg_ids = self.db.get_history()
172171
latest = datetime(1984, 1, 1).replace(tzinfo=utc)

0 commit comments

Comments
 (0)