Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libmtime
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
icon-libraries
libmtime
Commits
8f3781c3
Commit
8f3781c3
authored
8 months ago
by
Sergey Kosukhin
Browse files
Options
Downloads
Patches
Plain Diff
Reduce namespace pollution in Python modules
parent
a6dc4e63
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!43
Update python build
Pipeline
#75813
passed
8 months ago
Stage: test
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-1
1 addition, 1 deletion
.gitignore
python/Makefile.am
+6
-5
6 additions, 5 deletions
python/Makefile.am
python/mtime/_mtime.py
+46
-48
46 additions, 48 deletions
python/mtime/_mtime.py
with
53 additions
and
54 deletions
.gitignore
+
1
−
1
View file @
8f3781c3
...
...
@@ -75,7 +75,7 @@ __pycache__/
/**/doc/doxygen-doc/
# Install stage files
/**/python/
mtime/
.install/
/**/python/.install/
# Test stage files
*.py[cod]
...
...
This diff is collapsed.
Click to expand it.
python/Makefile.am
+
6
−
5
View file @
8f3781c3
...
...
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-3-Clause
#
install_tmpdir
=
mtime/
.install
install_tmpdir
=
.install
pkgpython_PYTHON
=
mtime/__init__.py
nodist_pkgpython_PYTHON
=
$(
install_tmpdir
)
/_mtime.py
...
...
@@ -13,10 +13,11 @@ mtime___mtime_la_LDFLAGS = -shared -avoid-version -module
mtime___mtime_la_LIBADD
=
$(
top_builddir
)
/src/libmtime_c.la
$(install_tmpdir)/_mtime.py
:
mtime/_mtime.py
$(
MKDIR_P
)
$(
@D
)
&&
sed
"s,^SOFILE = None
$$
,SOFILE = '
$(
DESTDIR
)$(
pkgpyexecdir
)
/__mtime
$(
acx_modext
)
',"
$<
>
$@
install-data-hook
:
rm
-rf
$(
install_tmpdir
)
$(
MKDIR_P
)
$(
@D
)
&&
{
\
$(
SED
)
-n
'1,/^# SET-SOFILE-BEGIN-TAG$$/p'
$<
;
\
echo
'__SOFILE = "
$(
DESTDIR
)$(
pkgpyexecdir
)
/__mtime
$(
acx_modext
)
"'
;
\
$(
SED
)
-n
'/^# SET-SOFILE-END-TAG$$/,$$p'
$<
;
\
}>
$@
# overrides to make regular compilations also use libtool
COMPILE
=
$(
LIBTOOL
)
$(
AM_V_lt
)
--tag
=
CC
$(
AM_LIBTOOLFLAGS
)
\
...
...
This diff is collapsed.
Click to expand it.
python/mtime/_mtime.py
+
46
−
48
View file @
8f3781c3
...
...
@@ -27,17 +27,15 @@ from ctypes import (
create_string_buffer
,
)
SOFILE
=
None
if
SOFILE
is
None
:
import
os
SOFILE
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
"
.libs
"
,
"
__mtime.so
"
,
)
libmtime
=
cdll
.
LoadLibrary
(
SOFILE
)
# SET-SOFILE-BEGIN-TAG
# This will be removed during the installation:
__os
=
__import__
(
"
os
"
)
__SOFILE
=
__os
.
path
.
join
(
__os
.
path
.
dirname
(
__os
.
path
.
abspath
(
__file__
)),
"
.libs
"
,
"
__mtime.so
"
)
del
__os
# SET-SOFILE-END-TAG
__mtime
=
cdll
.
LoadLibrary
(
__SOFILE
)
# @package mtime_calendar
# @brief Provides the calendar to the users, abstracting the different
...
...
@@ -112,7 +110,7 @@ max_calendar_str_len = c_int(32).value
# @param[in] ct the calendar type
# ct shoud be of class CALENDAR_TYPE.
#
setCalendar
=
lib
mtime
.
initCalendar
setCalendar
=
__
mtime
.
initCalendar
setCalendar
.
argtypes
=
[
CALENDAR_TYPE
]
setCalendar
.
restype
=
None
...
...
@@ -120,7 +118,7 @@ setCalendar.restype = None
# @brief called to discard the selected calendar type
#
# Usage example: resetCalendar();
resetCalendar
=
lib
mtime
.
freeCalendar
resetCalendar
=
__
mtime
.
freeCalendar
resetCalendar
.
argtype
=
[
None
]
resetCalendar
.
restype
=
None
...
...
@@ -136,7 +134,7 @@ resetCalendar.restype = None
# - 3 (year_of_360_days)
#
# @return an integer denoting the calendar in use
getCalendarType
=
lib
mtime
.
getCalendarType
getCalendarType
=
__
mtime
.
getCalendarType
getCalendarType
.
argtype
=
[
None
]
getCalendarType
.
restype
=
CALENDAR_TYPE
...
...
@@ -148,7 +146,7 @@ getCalendarType.restype = CALENDAR_TYPE
# (out will now contain the Calendar type in human readable form)
#
# @param[out] string the calendar type verbose
my_calendarToString
=
lib
mtime
.
calendarToString
my_calendarToString
=
__
mtime
.
calendarToString
my_calendarToString
.
argtype
=
[
c_char_p
]
my_calendarToString
.
restype
=
None
...
...
@@ -185,7 +183,7 @@ class _julianday(Structure):
# @param[in] ms an integer denoting the actual milli seconds of a
# day
# @return ret_julianday a pointer of type(julianday)
newJulianDay
=
lib
mtime
.
newJulianDay
newJulianDay
=
__
mtime
.
newJulianDay
newJulianDay
.
argtypes
=
[
c_long
,
c_long
]
newJulianDay
.
restype
=
POINTER
(
_julianday
)
...
...
@@ -195,7 +193,7 @@ newJulianDay.restype = POINTER(_julianday)
# USAGE example: deallocateJulianDay(jd);
#
# @param my_julianday a pointer of type(julianday)
deallocateJulianDay
=
lib
mtime
.
deallocateJulianDay
deallocateJulianDay
=
__
mtime
.
deallocateJulianDay
deallocateJulianDay
.
argtype
=
[
POINTER
(
_julianday
)]
deallocateJulianDay
.
restype
=
None
...
...
@@ -209,7 +207,7 @@ deallocateJulianDay.restype = None
# converted to a string
# @param[in] str string where Julian day verbose is written
# @param[out] str the Julian day verbose
my_juliandayToString
=
lib
mtime
.
juliandayToString
my_juliandayToString
=
__
mtime
.
juliandayToString
my_juliandayToString
.
argtype
=
[
POINTER
(
_julianday
),
c_char_p
]
my_juliandayToString
.
restype
=
None
...
...
@@ -243,7 +241,7 @@ class _date(Structure):
#
# @param[in] string an ISO 8601 conforming date string
# @return ret_date a pointer of type(_date)
newDate
=
lib
mtime
.
newDate
newDate
=
__
mtime
.
newDate
newDate
.
argtype
=
[
c_char_p
]
newDate
.
restype
=
POINTER
(
_date
)
...
...
@@ -253,7 +251,7 @@ newDate.restype = POINTER(_date)
# USAGE example: deallocateDate(d);
#
# @param[in] my_date a pointer of type(_date)
deallocateDate
=
lib
mtime
.
deallocateDate
deallocateDate
=
__
mtime
.
deallocateDate
deallocateDate
.
argtype
=
[
POINTER
(
_date
)]
deallocateDate
.
restype
=
None
...
...
@@ -267,7 +265,7 @@ deallocateDate.restype = None
# string
# @param[in] str string where Date verbose is written
# @param[out] str the Date verbose
my_dateToString
=
lib
mtime
.
dateToString
my_dateToString
=
__
mtime
.
dateToString
my_dateToString
.
argtype
=
[
POINTER
(
_date
),
c_char_p
]
my_dateToString
.
restype
=
None
...
...
@@ -300,17 +298,17 @@ class _time(Structure):
]
newTime
=
lib
mtime
.
newTime
newTime
=
__
mtime
.
newTime
newTime
.
argtype
=
[
c_char_p
]
newTime
.
restype
=
POINTER
(
_time
)
deallocateTime
=
lib
mtime
.
deallocateTime
deallocateTime
=
__
mtime
.
deallocateTime
deallocateTime
.
argtype
=
[
POINTER
(
_time
)]
deallocateTime
.
restype
=
None
my_timeToString
=
lib
mtime
.
timeToString
my_timeToString
=
__
mtime
.
timeToString
my_timeToString
.
argtype
=
[
POINTER
(
_time
),
c_char_p
]
my_timeToString
.
restype
=
None
...
...
@@ -390,27 +388,27 @@ class _datetime(Structure):
"""
newDateTime
=
lib
mtime
.
newDateTime
newDateTime
=
__
mtime
.
newDateTime
newDateTime
.
argtype
=
[
c_char_p
]
newDateTime
.
restype
=
POINTER
(
_datetime
)
newdatetimefromraw
=
lib
mtime
.
newRawDateTime
newdatetimefromraw
=
__
mtime
.
newRawDateTime
newdatetimefromraw
.
argtype
=
[
c_long
,
c_int
,
c_int
,
c_int
,
c_int
,
c_int
,
c_int
]
newdatetimefromraw
.
restype
=
POINTER
(
_datetime
)
newdatetimefromconstructandcopy
=
lib
mtime
.
constructAndCopyDateTime
newdatetimefromconstructandcopy
=
__
mtime
.
constructAndCopyDateTime
newdatetimefromconstructandcopy
.
argtype
=
[
POINTER
(
_datetime
)]
newdatetimefromconstructandcopy
.
restype
=
POINTER
(
_datetime
)
deallocateDateTime
=
lib
mtime
.
deallocateDateTime
deallocateDateTime
=
__
mtime
.
deallocateDateTime
deallocateDateTime
.
argtype
=
[
POINTER
(
_datetime
)]
deallocateDateTime
.
restype
=
None
my_datetimeToString
=
lib
mtime
.
datetimeToString
my_datetimeToString
=
__
mtime
.
datetimeToString
my_datetimeToString
.
argtype
=
[
POINTER
(
_datetime
),
c_char_p
]
my_datetimeToString
.
restype
=
None
...
...
@@ -421,32 +419,32 @@ def datetimeToString(dt):
return
name
.
value
replaceDatetime
=
lib
mtime
.
replaceDatetime
replaceDatetime
=
__
mtime
.
replaceDatetime
replaceDatetime
.
argtype
=
[
POINTER
(
_datetime
),
POINTER
(
_datetime
)]
replaceDatetime
.
restype
=
POINTER
(
_datetime
)
compareDatetime
=
lib
mtime
.
compareDatetime
compareDatetime
=
__
mtime
.
compareDatetime
compareDatetime
.
argtype
=
[
POINTER
(
_datetime
),
POINTER
(
_datetime
)]
compareDatetime
.
restype
=
c_int
getNoOfDaysInMonthDateTime
=
lib
mtime
.
getNoOfDaysInMonthDateTime
getNoOfDaysInMonthDateTime
=
__
mtime
.
getNoOfDaysInMonthDateTime
getNoOfDaysInMonthDateTime
.
argtype
=
[
POINTER
(
_datetime
)]
getNoOfDaysInMonthDateTime
.
restype
=
c_int
getNoOfDaysInYearDateTime
=
lib
mtime
.
getNoOfDaysInYearDateTime
getNoOfDaysInYearDateTime
=
__
mtime
.
getNoOfDaysInYearDateTime
getNoOfDaysInYearDateTime
.
argtype
=
[
POINTER
(
_datetime
)]
getNoOfDaysInYearDateTime
.
restype
=
c_int
getDayOfYearFromDateTime
=
lib
mtime
.
getDayOfYearFromDateTime
getDayOfYearFromDateTime
=
__
mtime
.
getDayOfYearFromDateTime
getDayOfYearFromDateTime
.
argtype
=
[
POINTER
(
_datetime
)]
getDayOfYearFromDateTime
.
restype
=
c_int
getJulianDayFromDateTime
=
lib
mtime
.
getJulianDayFromDateTime
getJulianDayFromDateTime
=
__
mtime
.
getJulianDayFromDateTime
getJulianDayFromDateTime
.
argtype
=
[
POINTER
(
_datetime
),
POINTER
(
_julianday
)]
getJulianDayFromDateTime
.
restype
=
POINTER
(
_julianday
)
...
...
@@ -477,17 +475,17 @@ class _timedelta(Structure):
]
newTimeDelta
=
lib
mtime
.
newTimeDelta
newTimeDelta
=
__
mtime
.
newTimeDelta
newTimeDelta
.
argtype
=
[
c_char_p
]
newTimeDelta
.
restype
=
POINTER
(
_timedelta
)
deallocateTimeDelta
=
lib
mtime
.
deallocateTimeDelta
deallocateTimeDelta
=
__
mtime
.
deallocateTimeDelta
deallocateTimeDelta
.
argtype
=
[
POINTER
(
_timedelta
)]
deallocateTimeDelta
.
restype
=
None
addTimeDeltaToDateTime
=
lib
mtime
.
addTimeDeltaToDateTime
addTimeDeltaToDateTime
=
__
mtime
.
addTimeDeltaToDateTime
addTimeDeltaToDateTime
.
argtype
=
[
POINTER
(
_datetime
),
POINTER
(
_timedelta
),
...
...
@@ -496,7 +494,7 @@ addTimeDeltaToDateTime.argtype = [
addTimeDeltaToDateTime
.
restype
=
POINTER
(
_datetime
)
my_timedeltaToString
=
lib
mtime
.
timedeltaToString
my_timedeltaToString
=
__
mtime
.
timedeltaToString
my_timedeltaToString
.
argtype
=
[
POINTER
(
_timedelta
),
c_char_p
]
my_timedeltaToString
.
restype
=
c_char_p
...
...
@@ -511,7 +509,7 @@ class _divisionquotienttimespan(Structure):
_fields_
=
[(
"
quotient
"
,
c_long
),
(
"
remainder_in_ms
"
,
c_long
)]
divideDatetimeDifferenceInSeconds
=
lib
mtime
.
divideDatetimeDifferenceInSeconds
divideDatetimeDifferenceInSeconds
=
__
mtime
.
divideDatetimeDifferenceInSeconds
divideDatetimeDifferenceInSeconds
.
argtype
=
[
POINTER
(
_datetime
),
POINTER
(
_datetime
),
...
...
@@ -557,21 +555,21 @@ class _event(Structure):
]
newEvent
=
lib
mtime
.
newEvent
newEvent
=
__
mtime
.
newEvent
newEvent
.
argtype
=
[
c_char_p
,
c_char_p
,
c_char_p
,
c_char_p
,
c_char_p
]
newEvent
.
restype
=
POINTER
(
_event
)
deallocateEvent
=
lib
mtime
.
deallocateEvent
deallocateEvent
=
__
mtime
.
deallocateEvent
deallocateEvent
.
argtype
=
[
POINTER
(
_event
)]
deallocateEvent
.
restype
=
None
isCurrentEventActive
=
lib
mtime
.
isCurrentEventActive
isCurrentEventActive
=
__
mtime
.
isCurrentEventActive
isCurrentEventActive
.
argtype
=
[
POINTER
(
_event
),
POINTER
(
_datetime
)]
isCurrentEventActive
.
restype
=
c_bool
my_eventToString
=
lib
mtime
.
eventToString
my_eventToString
=
__
mtime
.
eventToString
my_eventToString
.
argtype
=
[
POINTER
(
_event
),
c_char_p
]
my_eventToString
.
restype
=
c_char_p
...
...
@@ -604,18 +602,18 @@ class _eventgroup(Structure):
]
newEventGroup
=
lib
mtime
.
newEventGroup
newEventGroup
=
__
mtime
.
newEventGroup
newEventGroup
.
argtype
=
[
c_char_p
]
newEventGroup
.
restype
=
POINTER
(
_eventgroup
)
deallocateEventGroup
=
lib
mtime
.
deallocateEventGroup
deallocateEventGroup
=
__
mtime
.
deallocateEventGroup
deallocateEventGroup
.
argtype
=
[
POINTER
(
_eventgroup
)]
deallocateEventGroup
.
restype
=
None
addNewEventToEventGroup
=
lib
mtime
.
addNewEventToEventGroup
addNewEventToEventGroup
=
__
mtime
.
addNewEventToEventGroup
addNewEventToEventGroup
.
argType
=
[
POINTER
(
_event
),
POINTER
(
_eventgroup
)]
addNewEventToEventGroup
.
resType
=
c_bool
removeEventFromEventGroup
=
lib
mtime
.
removeEventFromEventGroup
removeEventFromEventGroup
=
__
mtime
.
removeEventFromEventGroup
removeEventFromEventGroup
.
argType
=
[
c_char_p
,
POINTER
(
_eventgroup
)]
removeEventFromEventGroup
.
resType
=
c_bool
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