Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apachedex
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
apachedex
Commits
489bb108
Commit
489bb108
authored
Apr 14, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Toward Python3: floor division
parent
5c4d3570
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
apachedex/__init__.py
apachedex/__init__.py
+6
-6
No files found.
apachedex/__init__.py
View file @
489bb108
...
...
@@ -26,7 +26,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
__future__
import
print_function
from
__future__
import
print_function
,
division
from
cgi
import
escape
from
collections
import
defaultdict
,
Counter
from
datetime
import
datetime
,
timedelta
,
date
...
...
@@ -810,7 +810,7 @@ def _asWeekString(timestamp):
offset
=
date
(
year
,
month
,
1
).
timetuple
().
tm_yday
-
2
_month_offset_cache
[
key
]
=
offset
day_of_year
=
day
+
offset
day
-=
day_of_year
-
(
day_of_year
/
7
*
7
)
day
-=
day_of_year
-
(
day_of_year
/
/
7
*
7
)
if
day
<
1
:
month
-=
1
day
+=
calendar
.
monthrange
(
year
,
month
)[
1
]
...
...
@@ -819,11 +819,11 @@ def _asWeekString(timestamp):
def
_weekStringAsQuarterString
(
timestamp
):
year
,
month
,
_
=
timestamp
.
split
(
'/'
)
return
'%s/%02i'
%
(
year
,
(
int
(
month
)
-
1
)
/
3
*
3
+
1
)
return
'%s/%02i'
%
(
year
,
(
int
(
month
)
-
1
)
/
/
3
*
3
+
1
)
def
_roundWeek
(
dt
):
day_of_year
=
dt
.
timetuple
().
tm_yday
return
dt
-
timedelta
(
day_of_year
-
((
day_of_year
-
1
)
/
7
*
7
+
1
))
return
dt
-
timedelta
(
day_of_year
-
((
day_of_year
-
1
)
/
/
7
*
7
+
1
))
def
_getWeekCoefficient
(
dt
):
if
dt
.
month
!=
12
:
...
...
@@ -842,10 +842,10 @@ def _as6HourString(timestamp):
dt_date
,
hour
,
_
=
dt
.
split
(
':'
,
2
)
day
,
month
,
year
=
dt_date
.
split
(
'/'
)
return
'%s/%02i/%s %02i'
%
(
year
,
MONTH_VALUE_DICT
[
month
],
day
,
int
(
hour
)
/
6
*
6
)
int
(
hour
)
/
/
6
*
6
)
def
_round6Hour
(
dt
):
return
dt
.
replace
(
hour
=
dt
.
hour
/
6
*
6
)
return
dt
.
replace
(
hour
=
dt
.
hour
/
/
6
*
6
)
def
_hourAsWeekString
(
timestamp
):
dt
=
datetime
.
strptime
(
timestamp
,
'%Y/%m/%d %H'
)
...
...
Write
Preview
Markdown
is supported
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