Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
juga
sbws
Commits
f41f9134
Commit
f41f9134
authored
Oct 23, 2018
by
juga
Browse files
Implement get method in State
parent
cf4fe8a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
sbws/util/state.py
View file @
f41f9134
...
@@ -63,6 +63,13 @@ class State:
...
@@ -63,6 +63,13 @@ class State:
self
.
_state
=
self
.
_read
()
self
.
_state
=
self
.
_read
()
return
self
.
_state
.
__len__
()
return
self
.
_state
.
__len__
()
def
get
(
self
,
key
):
if
not
isinstance
(
key
,
str
):
raise
TypeError
(
'Keys must be strings. %s is a %s'
%
(
key
,
type
(
key
)))
self
.
_state
=
self
.
_read
()
return
self
.
_state
.
get
(
key
)
def
__getitem__
(
self
,
key
):
def
__getitem__
(
self
,
key
):
if
not
isinstance
(
key
,
str
):
if
not
isinstance
(
key
,
str
):
raise
TypeError
(
raise
TypeError
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment