-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* require ruamel * added base module * added from_dict and to_dict to Time * bug fix: bad dep name * added to_dict to Message * added basic test_to_dict
- Loading branch information
1 parent
0439492
commit b4277ca
Showing
6 changed files
with
69 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from .base import Time | ||
from .msg import Constant, ConstantValue, Field, MsgFormat | ||
from .srv import SrvFormat | ||
from .action import ActionFormat | ||
from .package import Package, PackageDatabase | ||
from .bag import Time | ||
from .format import FormatDatabase | ||
from .type_db import TypeDatabase, Message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
__all__ = ('Time',) | ||
|
||
from typing import Dict, Any | ||
|
||
import attr | ||
|
||
|
||
@attr.s(frozen=True, slots=True) | ||
class Time: | ||
secs: int = attr.ib() | ||
nsecs: int = attr.ib() | ||
|
||
@staticmethod | ||
def from_dict(d: Dict[str, Any]) -> 'Time': | ||
return Time(d['secs'], d['nsecs']) | ||
|
||
def to_dict(self) -> Dict[str, int]: | ||
return {'secs': self.secs, | ||
'nsecs': self.nsecs} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters