Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PyFastANI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Larralde
PyFastANI
Commits
f74fa347
Commit
f74fa347
authored
3 years ago
by
Martin Larralde
Browse files
Options
Downloads
Patches
Plain Diff
Implement `__getstate__` and `__setstate__` for `Hit` and `MinimizerInfo`
parent
2642ca11
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pyfastani/_fastani.pyi
+5
-1
5 additions, 1 deletion
pyfastani/_fastani.pyi
pyfastani/_fastani.pyx
+12
-0
12 additions, 0 deletions
pyfastani/_fastani.pyx
with
17 additions
and
1 deletion
pyfastani/_fastani.pyi
+
5
−
1
View file @
f74fa347
import
typing
import
typing
from
typing
import
Generic
,
List
,
Union
,
Iterable
,
TypeVar
from
typing
import
Generic
,
List
,
Union
,
Iterable
,
Tuple
,
TypeVar
N
=
TypeVar
(
"
N
"
)
N
=
TypeVar
(
"
N
"
)
Seq
=
Union
[
str
,
bytes
,
bytearray
,
memoryview
]
Seq
=
Union
[
str
,
bytes
,
bytearray
,
memoryview
]
...
@@ -54,6 +54,8 @@ class Hit(Generic[N]):
...
@@ -54,6 +54,8 @@ class Hit(Generic[N]):
def
__init__
(
self
,
name
:
N
,
identity
:
float
,
matches
:
int
,
fragments
:
int
):
...
def
__init__
(
self
,
name
:
N
,
identity
:
float
,
matches
:
int
,
fragments
:
int
):
...
def
__repr__
(
self
)
->
str
:
...
def
__repr__
(
self
)
->
str
:
...
def
__eq__
(
self
,
other
:
object
)
->
bool
:
...
def
__eq__
(
self
,
other
:
object
)
->
bool
:
...
def
__getstate__
(
self
)
->
Tuple
[
N
,
float
,
int
,
int
]:
...
def
__setstate__
(
self
,
state
:
Tuple
[
N
,
float
,
int
,
int
])
->
None
:
...
@property
@property
def
name
(
self
)
->
N
:
...
def
name
(
self
)
->
N
:
...
@property
@property
...
@@ -68,6 +70,8 @@ class MinimizerInfo:
...
@@ -68,6 +70,8 @@ class MinimizerInfo:
def
__init__
(
self
,
hash
:
int
,
sequence_id
:
int
,
window_position
:
int
):
...
def
__init__
(
self
,
hash
:
int
,
sequence_id
:
int
,
window_position
:
int
):
...
def
__repr__
(
self
)
->
str
:
...
def
__repr__
(
self
)
->
str
:
...
def
__eq__
(
self
,
other
:
object
)
->
bool
:
...
def
__eq__
(
self
,
other
:
object
)
->
bool
:
...
def
__getstate__
(
self
)
->
Tuple
[
int
,
int
,
int
]:
...
def
__setstate__
(
self
,
state
:
Tuple
[
int
,
int
,
int
])
->
None
:
...
@property
@property
def
hash
(
self
)
->
int
:
...
def
hash
(
self
)
->
int
:
...
@property
@property
...
...
This diff is collapsed.
Click to expand it.
pyfastani/_fastani.pyx
+
12
−
0
View file @
f74fa347
...
@@ -900,6 +900,12 @@ cdef class Hit:
...
@@ -900,6 +900,12 @@ cdef class Hit:
and
self
.
identity
==
other
.
identity
and
self
.
identity
==
other
.
identity
)
)
def
__getstate__
(
self
):
return
self
.
name
,
self
.
matches
,
self
.
fragments
,
self
.
identity
def
__setstate__
(
self
,
state
):
self
.
name
,
self
.
matches
,
self
.
fragments
,
self
.
identity
=
state
cdef
class
MinimizerInfo
:
cdef
class
MinimizerInfo
:
"""
The information about a single minimizer.
"""
The information about a single minimizer.
...
@@ -936,6 +942,12 @@ cdef class MinimizerInfo:
...
@@ -936,6 +942,12 @@ cdef class MinimizerInfo:
and
self
.
window_position
==
other
.
window_position
and
self
.
window_position
==
other
.
window_position
)
)
def
__getstate__
(
self
):
return
self
.
hash
,
self
.
sequence_id
,
self
.
window_position
def
__setstate__
(
self
,
state
):
self
.
hash
,
self
.
sequence_id
,
self
.
window_position
=
state
# --- Methods ------------------------------------------------------------
# --- Methods ------------------------------------------------------------
@staticmethod
@staticmethod
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment