Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
poezio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Maxime Buquet
poezio
Commits
4fae01c0
Commit
4fae01c0
authored
May 28, 2020
by
mathieui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mypy: type more strictly common.py
parent
eb0f24c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
poezio/common.py
poezio/common.py
+12
-10
No files found.
poezio/common.py
View file @
4fae01c0
...
...
@@ -14,7 +14,7 @@ from datetime import (
timezone
,
)
from
pathlib
import
Path
from
typing
import
Dict
,
List
,
Optional
,
Tuple
,
Union
from
typing
import
Dict
,
List
,
Optional
,
Tuple
,
Union
,
Any
import
os
import
subprocess
...
...
@@ -44,7 +44,7 @@ def _get_output_of_command(command: str) -> Optional[List[str]]:
return
None
def
_is_in_path
(
command
:
str
,
return_abs_path
=
False
)
->
Union
[
bool
,
str
]:
def
_is_in_path
(
command
:
str
,
return_abs_path
:
bool
=
False
)
->
Union
[
bool
,
str
]:
"""
Check if *command* is in the $PATH or not.
...
...
@@ -111,10 +111,12 @@ def get_os_info() -> str:
stdout
=
subprocess
.
PIPE
,
close_fds
=
True
)
process
.
wait
()
output
=
process
.
stdout
.
readline
().
decode
(
'utf-8'
).
strip
()
# some distros put n/a in places, so remove those
output
=
output
.
replace
(
'n/a'
,
''
).
replace
(
'N/A'
,
''
)
return
output
if
process
.
stdout
is
not
None
:
out
=
process
.
stdout
.
readline
().
decode
(
'utf-8'
).
strip
()
# some distros put n/a in places, so remove those
out
=
out
.
replace
(
'n/a'
,
''
).
replace
(
'N/A'
,
''
)
return
out
return
''
# lsb_release executable not available, so parse files
for
distro_name
in
DISTRO_INFO
:
...
...
@@ -287,7 +289,7 @@ def shell_split(st: str) -> List[str]:
return
ret
def
find_argument
(
pos
:
int
,
text
:
str
,
quoted
=
True
)
->
int
:
def
find_argument
(
pos
:
int
,
text
:
str
,
quoted
:
bool
=
True
)
->
int
:
"""
Split an input into a list of arguments, return the number of the
argument selected by pos.
...
...
@@ -342,7 +344,7 @@ def _find_argument_unquoted(pos: int, text: str) -> int:
return
argnum
+
1
def
parse_str_to_secs
(
duration
=
''
)
->
int
:
def
parse_str_to_secs
(
duration
:
str
=
''
)
->
int
:
"""
Parse a string of with a number of d, h, m, s.
...
...
@@ -370,7 +372,7 @@ def parse_str_to_secs(duration='') -> int:
return
result
def
parse_secs_to_str
(
duration
=
0
)
->
str
:
def
parse_secs_to_str
(
duration
:
int
=
0
)
->
str
:
"""
Do the reverse operation of :py:func:`parse_str_to_secs`.
...
...
@@ -457,7 +459,7 @@ def format_gaming_string(infos: Dict[str, str]) -> str:
return
name
def
safeJID
(
*
args
,
**
kwargs
)
->
JID
:
def
safeJID
(
*
args
:
Any
,
**
kwargs
:
Any
)
->
JID
:
"""
Construct a :py:class:`slixmpp.JID` object from a string.
...
...
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