flow.record 3.16.dev1__tar.gz → 3.16.dev2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flow_record-3.16.dev1/flow.record.egg-info → flow_record-3.16.dev2}/PKG-INFO +1 -1
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/fieldtypes/__init__.py +13 -2
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/version.py +2 -2
- {flow_record-3.16.dev1 → flow_record-3.16.dev2/flow.record.egg-info}/PKG-INFO +1 -1
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_fieldtypes.py +77 -3
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/COPYRIGHT +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/LICENSE +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/MANIFEST.in +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/README.md +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/examples/filesystem.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/examples/passivedns.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/examples/records.json +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/examples/tcpconn.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/__init__.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/__init__.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/archive.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/avro.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/broker.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/csvfile.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/duckdb.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/elastic.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/jsonfile.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/line.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/mongo.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/split.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/splunk.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/sqlite.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/stream.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/text.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/adapter/xlsx.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/base.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/exceptions.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/fieldtypes/credential.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/fieldtypes/net/__init__.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/fieldtypes/net/ip.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/fieldtypes/net/ipv4.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/fieldtypes/net/tcp.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/fieldtypes/net/udp.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/jsonpacker.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/packer.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/selector.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/stream.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/tools/__init__.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/tools/geoip.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/tools/rdump.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/utils.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow/record/whitelist.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow.record.egg-info/SOURCES.txt +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow.record.egg-info/dependency_links.txt +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow.record.egg-info/entry_points.txt +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow.record.egg-info/requires.txt +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/flow.record.egg-info/top_level.txt +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/pyproject.toml +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/setup.cfg +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/__init__.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/_utils.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/docs/Makefile +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/docs/conf.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/docs/index.rst +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/selector_explain_example.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/standalone_test.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_avro.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_avro_adapter.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_compiled_selector.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_csv_adapter.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_deprecations.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_elastic_adapter.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_fieldtype_ip.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_json_packer.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_json_record_adapter.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_multi_timestamp.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_packer.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_rdump.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_record.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_record_adapter.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_record_descriptor.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_regression.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_selector.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_splunk_adapter.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/test_sqlite_duckdb_adapter.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tests/utils_inspect.py +0 -0
- {flow_record-3.16.dev1 → flow_record-3.16.dev2}/tox.ini +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: flow.record
|
|
3
|
-
Version: 3.16.
|
|
3
|
+
Version: 3.16.dev2
|
|
4
4
|
Summary: A library for defining and creating structured data (called records) that can be streamed to disk or piped to other tools that use flow.record
|
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
|
6
6
|
License: Affero General Public License v3
|
|
@@ -663,7 +663,7 @@ class path(pathlib.PurePath, FieldType):
|
|
|
663
663
|
#
|
|
664
664
|
# This construction works around that by converting all path parts
|
|
665
665
|
# to strings first.
|
|
666
|
-
args = (str(arg) for arg in args)
|
|
666
|
+
args = tuple(str(arg) for arg in args)
|
|
667
667
|
elif isinstance(path_part, pathlib.PurePosixPath):
|
|
668
668
|
cls = posix_path
|
|
669
669
|
elif _is_windowslike_path(path_part):
|
|
@@ -671,7 +671,7 @@ class path(pathlib.PurePath, FieldType):
|
|
|
671
671
|
# like path separator (\).
|
|
672
672
|
cls = windows_path
|
|
673
673
|
if not PY_312:
|
|
674
|
-
args = (str(arg) for arg in args)
|
|
674
|
+
args = tuple(str(arg) for arg in args)
|
|
675
675
|
elif _is_posixlike_path(path_part):
|
|
676
676
|
# This handles any custom PurePath based implementations that don't have a
|
|
677
677
|
# windows like path separator (\).
|
|
@@ -684,13 +684,24 @@ class path(pathlib.PurePath, FieldType):
|
|
|
684
684
|
obj = super().__new__(cls)
|
|
685
685
|
else:
|
|
686
686
|
obj = cls._from_parts(args)
|
|
687
|
+
|
|
688
|
+
obj._empty_path = False
|
|
689
|
+
if not args or args == ("",):
|
|
690
|
+
obj._empty_path = True
|
|
687
691
|
return obj
|
|
688
692
|
|
|
689
693
|
def __eq__(self, other: Any) -> bool:
|
|
690
694
|
if isinstance(other, str):
|
|
691
695
|
return str(self) == other or self == self.__class__(other)
|
|
696
|
+
if self._empty_path:
|
|
697
|
+
return isinstance(other, self.__class__) and other._empty_path
|
|
692
698
|
return super().__eq__(other)
|
|
693
699
|
|
|
700
|
+
def __str__(self) -> str:
|
|
701
|
+
if self._empty_path:
|
|
702
|
+
return ""
|
|
703
|
+
return super().__str__()
|
|
704
|
+
|
|
694
705
|
def __repr__(self) -> str:
|
|
695
706
|
return repr(str(self))
|
|
696
707
|
|
|
@@ -12,5 +12,5 @@ __version__: str
|
|
|
12
12
|
__version_tuple__: VERSION_TUPLE
|
|
13
13
|
version_tuple: VERSION_TUPLE
|
|
14
14
|
|
|
15
|
-
__version__ = version = '3.16.
|
|
16
|
-
__version_tuple__ = version_tuple = (3, 16, '
|
|
15
|
+
__version__ = version = '3.16.dev2'
|
|
16
|
+
__version_tuple__ = version_tuple = (3, 16, 'dev2')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: flow.record
|
|
3
|
-
Version: 3.16.
|
|
3
|
+
Version: 3.16.dev2
|
|
4
4
|
Summary: A library for defining and creating structured data (called records) that can be streamed to disk or piped to other tools that use flow.record
|
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
|
6
6
|
License: Affero General Public License v3
|
|
@@ -11,7 +11,7 @@ from datetime import datetime, timedelta, timezone
|
|
|
11
11
|
import pytest
|
|
12
12
|
|
|
13
13
|
import flow.record.fieldtypes
|
|
14
|
-
from flow.record import RecordDescriptor, RecordReader, RecordWriter
|
|
14
|
+
from flow.record import RecordDescriptor, RecordReader, RecordWriter, fieldtypes
|
|
15
15
|
from flow.record.fieldtypes import (
|
|
16
16
|
PY_312,
|
|
17
17
|
TYPE_POSIX,
|
|
@@ -617,8 +617,8 @@ def test_path():
|
|
|
617
617
|
assert r.value is None
|
|
618
618
|
|
|
619
619
|
r = TestRecord("")
|
|
620
|
-
assert str(r.value) == "
|
|
621
|
-
assert r.value == "
|
|
620
|
+
assert str(r.value) == ""
|
|
621
|
+
assert r.value == ""
|
|
622
622
|
|
|
623
623
|
if os.name == "nt":
|
|
624
624
|
native_path_str = windows_path_str
|
|
@@ -1132,5 +1132,79 @@ def test_command_failed() -> None:
|
|
|
1132
1132
|
command(b"failed")
|
|
1133
1133
|
|
|
1134
1134
|
|
|
1135
|
+
@pytest.mark.parametrize(
|
|
1136
|
+
"path_cls",
|
|
1137
|
+
[
|
|
1138
|
+
fieldtypes.posix_path,
|
|
1139
|
+
fieldtypes.windows_path,
|
|
1140
|
+
fieldtypes.path,
|
|
1141
|
+
],
|
|
1142
|
+
)
|
|
1143
|
+
def test_empty_path(path_cls) -> None:
|
|
1144
|
+
# initialize with empty string
|
|
1145
|
+
p1 = path_cls("")
|
|
1146
|
+
assert p1 == ""
|
|
1147
|
+
assert p1._empty_path
|
|
1148
|
+
assert str(p1) == ""
|
|
1149
|
+
assert p1 != path_cls(".")
|
|
1150
|
+
|
|
1151
|
+
# initialize without any arguments
|
|
1152
|
+
p2 = path_cls()
|
|
1153
|
+
assert p2 == ""
|
|
1154
|
+
assert p2._empty_path
|
|
1155
|
+
assert str(p2) == ""
|
|
1156
|
+
assert p2 != path_cls(".")
|
|
1157
|
+
|
|
1158
|
+
assert p1 == p2
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
def test_empty_path_different_types() -> None:
|
|
1162
|
+
assert fieldtypes.posix_path("") != fieldtypes.windows_path("")
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
def test_record_empty_path() -> None:
|
|
1166
|
+
TestRecord = RecordDescriptor(
|
|
1167
|
+
"test/path",
|
|
1168
|
+
[
|
|
1169
|
+
("path", "value"),
|
|
1170
|
+
],
|
|
1171
|
+
)
|
|
1172
|
+
|
|
1173
|
+
r = TestRecord()
|
|
1174
|
+
assert r.value is None
|
|
1175
|
+
assert repr(r) == "<test/path value=None>"
|
|
1176
|
+
|
|
1177
|
+
r = TestRecord("")
|
|
1178
|
+
assert r.value == ""
|
|
1179
|
+
assert repr(r) == "<test/path value=''>"
|
|
1180
|
+
|
|
1181
|
+
|
|
1182
|
+
def test_empty_path_serialization(tmp_path) -> None:
|
|
1183
|
+
TestRecord = RecordDescriptor(
|
|
1184
|
+
"test/path",
|
|
1185
|
+
[
|
|
1186
|
+
("path", "value"),
|
|
1187
|
+
],
|
|
1188
|
+
)
|
|
1189
|
+
|
|
1190
|
+
# Test path value=None serialization
|
|
1191
|
+
p_tmp_records = tmp_path / "none_path"
|
|
1192
|
+
with RecordWriter(p_tmp_records) as writer:
|
|
1193
|
+
record = TestRecord()
|
|
1194
|
+
writer.write(record)
|
|
1195
|
+
with RecordReader(p_tmp_records) as reader:
|
|
1196
|
+
for record in reader:
|
|
1197
|
+
assert record.value is None
|
|
1198
|
+
|
|
1199
|
+
# Test path value="" serialization
|
|
1200
|
+
p_tmp_records = tmp_path / "empty_str"
|
|
1201
|
+
with RecordWriter(p_tmp_records) as writer:
|
|
1202
|
+
record = TestRecord("")
|
|
1203
|
+
writer.write(record)
|
|
1204
|
+
with RecordReader(p_tmp_records) as reader:
|
|
1205
|
+
for record in reader:
|
|
1206
|
+
assert record.value == ""
|
|
1207
|
+
|
|
1208
|
+
|
|
1135
1209
|
if __name__ == "__main__":
|
|
1136
1210
|
__import__("standalone_test").main(globals())
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|