Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Owo Sugiana
/
opensipkd-hitung
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7437dc53
authored
Jun 30, 2020
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Tambah class Row dan FullDateTimeVar
1 parent
68a4c64e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
0 deletions
CHANGES.txt
opensipkd/string/__init__.py
opensipkd/string/row.py
CHANGES.txt
View file @
7437dc5
0.1.7 2020-06-29
----------------
- Baru, class Row untuk list satu baris yang memiliki nama kolom
- Baru, class FullDateTimeVar
0.1.6 2020-05-03
----------------
- Baru, class TransactionID untuk pembuatan Nomor Transaksi Pemda (NTP)
...
...
opensipkd/string/__init__.py
View file @
7437dc5
...
...
@@ -157,6 +157,24 @@ class DateTimeVar(FixLength):
self
.
get_int
(
'second'
))
class
FullDateTimeVar
(
FixLength
):
def
__init__
(
self
):
FixLength
.
__init__
(
self
,
[
[
'year'
,
4
,
'N'
],
[
'month'
,
2
,
'N'
],
[
'day'
,
2
,
'N'
],
[
'hour'
,
2
,
'N'
],
[
'minute'
,
2
,
'N'
],
[
'second'
,
2
,
'N'
],
])
def
get_value
(
self
):
return
datetime
(
self
.
get_int
(
'year'
),
self
.
get_int
(
'month'
),
self
.
get_int
(
'day'
),
self
.
get_int
(
'hour'
),
self
.
get_int
(
'minute'
),
self
.
get_int
(
'second'
))
class
TimeVar
(
FixLength
):
def
__init__
(
self
):
FixLength
.
__init__
(
self
,
[
...
...
opensipkd/string/row.py
0 → 100644
View file @
7437dc5
class
Row
(
object
):
def
__init__
(
self
,
fieldnames
):
self
.
fieldnames
=
fieldnames
self
.
values
=
dict
()
for
name
in
fieldnames
:
self
.
values
[
name
]
=
''
self
.
count
=
len
(
fieldnames
)
def
__setitem__
(
self
,
name
,
value
):
self
.
values
[
name
]
=
value
def
__getitem__
(
self
,
name
):
return
self
.
values
[
name
]
def
__iter__
(
self
):
self
.
index
=
0
return
self
def
__next__
(
self
):
if
self
.
index
==
self
.
count
:
raise
StopIteration
index
=
self
.
index
self
.
index
+=
1
name
=
self
.
fieldnames
[
index
]
return
self
[
name
]
Write
Preview
Markdown
is supported
Attach a file
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 post a comment