Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
Nuovo sito
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gruppo Web
Nuovo sito
Commits
02b48162
Commit
02b48162
authored
Nov 04, 2023
by
shadMod
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename row_list() with get_table_rows() to get all table rows
now get_list_version() return sort list
parent
b1eee15e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
19 deletions
+27
-19
uitwww/src/download/compile_download.py
uitwww/src/download/compile_download.py
+27
-19
No files found.
uitwww/src/download/compile_download.py
View file @
02b48162
...
@@ -28,8 +28,11 @@ class UbuntuRelease:
...
@@ -28,8 +28,11 @@ class UbuntuRelease:
self
.
ignore_lts
=
ignore_lts
self
.
ignore_lts
=
ignore_lts
self
.
ignore_interim
=
ignore_interim
self
.
ignore_interim
=
ignore_interim
@
property
def
get_table_rows
(
self
,
only_data
:
bool
=
True
):
def
row_list
(
self
)
->
list
:
"""
:param only_data: to check you want to ignore the table header
"""
# get requests
# get requests
res
=
requests
.
get
(
self
.
path_url
)
res
=
requests
.
get
(
self
.
path_url
)
# check requests status code
# check requests status code
...
@@ -38,37 +41,42 @@ class UbuntuRelease:
...
@@ -38,37 +41,42 @@ class UbuntuRelease:
raise
Exception
(
f"Error requests - status:
{
status
}
"
)
raise
Exception
(
f"Error requests - status:
{
status
}
"
)
# get all table rows
# get all table rows
table_rows
=
html
.
fromstring
(
res
.
content
).
xpath
(
'//pre//text()'
)
table_rows
=
html
.
fromstring
(
res
.
content
).
xpath
(
'//pre//text()'
)
# if only_data is True ignore table header
if
only_data
is
True
:
return
table_rows
[
8
:]
# else get all table
return
table_rows
@
property
def
get_list_version
(
self
)
->
list
:
# init clean row and row_list
# init clean row and row_list
row
=
[]
row
=
[]
row_list
=
[]
row_list
=
[]
# get table_rows without header
# get table_rows without header
for
val
in
table_rows
[
8
:]
:
for
val
in
self
.
get_table_rows
()
:
val
=
val
.
strip
()
val
=
val
.
strip
()
if
val
:
if
val
:
if
'Ubuntu '
not
in
val
:
if
'Ubuntu '
not
in
val
:
row
.
append
(
val
.
replace
(
"/"
,
""
))
row
.
append
(
val
.
replace
(
"/"
,
""
))
else
:
else
:
row
.
append
(
val
)
row
.
append
(
val
)
row_list
.
append
(
row
)
row
=
[]
return
row_list
@
property
if
len
(
row
)
==
2
:
def
get_list_version
(
self
)
->
dict
:
if
not
row
[
0
].
split
(
"."
)[
0
].
isnumeric
():
data
=
{
"latest"
:
[],
"lts"
:
[]}
continue
for
row
in
self
.
row_list
:
if
not
row
[
0
].
split
(
"."
)[
0
].
isnumeric
():
if
'LTS'
in
row
[
1
]:
continue
typology
=
"LTS"
if
'LTS'
in
row
[
1
]:
else
:
name
=
row
[
1
].
split
(
"("
)[
1
].
replace
(
")"
,
""
)
typology
=
"interim"
short
=
name
.
split
()[
0
].
lower
()
data
[
'lts'
].
append
((
row
[
0
],
short
,
name
))
else
:
name
=
row
[
1
].
split
(
"("
)[
1
].
replace
(
")"
,
""
)
name
=
row
[
1
].
split
(
"("
)[
1
].
replace
(
")"
,
""
)
short
=
name
.
split
()[
0
].
lower
()
short
=
name
.
split
()[
0
].
lower
()
data
[
'latest'
].
append
((
row
[
0
],
short
,
name
))
row_list
.
append
((
row
[
0
],
short
,
name
,
typology
))
return
data
row
=
[]
# the lambda is just out of scruple
return
sorted
(
row_list
,
key
=
lambda
x
:
x
[
0
],
reverse
=
True
)
class
CompileVersion
:
class
CompileVersion
:
...
...
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