mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #5778 from tk0miya/refactor_six.integer_types
refactor: Replace six.integer_types by int
This commit is contained in:
commit
cf5b3b61e9
@ -17,7 +17,7 @@ from collections import OrderedDict
|
|||||||
from os import path, getenv
|
from os import path, getenv
|
||||||
from typing import Any, NamedTuple, Union
|
from typing import Any, NamedTuple, Union
|
||||||
|
|
||||||
from six import text_type, integer_types
|
from six import text_type
|
||||||
|
|
||||||
from sphinx.deprecation import RemovedInSphinx30Warning, RemovedInSphinx40Warning
|
from sphinx.deprecation import RemovedInSphinx30Warning, RemovedInSphinx40Warning
|
||||||
from sphinx.errors import ConfigError, ExtensionError
|
from sphinx.errors import ConfigError, ExtensionError
|
||||||
@ -224,7 +224,7 @@ class Config:
|
|||||||
(name, name + '.key=value'))
|
(name, name + '.key=value'))
|
||||||
elif isinstance(defvalue, list):
|
elif isinstance(defvalue, list):
|
||||||
return value.split(',')
|
return value.split(',')
|
||||||
elif isinstance(defvalue, integer_types):
|
elif isinstance(defvalue, int):
|
||||||
try:
|
try:
|
||||||
return int(value)
|
return int(value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
@ -12,8 +12,6 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from six import integer_types
|
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
# For type annotation
|
# For type annotation
|
||||||
from typing import Any, Dict, IO, List, Match, Union # NOQA
|
from typing import Any, Dict, IO, List, Match, Union # NOQA
|
||||||
@ -95,7 +93,7 @@ def dumps(obj, key=False):
|
|||||||
return 'null'
|
return 'null'
|
||||||
elif obj is True or obj is False:
|
elif obj is True or obj is False:
|
||||||
return obj and 'true' or 'false'
|
return obj and 'true' or 'false'
|
||||||
elif isinstance(obj, integer_types + (float,)): # type: ignore
|
elif isinstance(obj, (int, float)):
|
||||||
return str(obj)
|
return str(obj)
|
||||||
elif isinstance(obj, dict):
|
elif isinstance(obj, dict):
|
||||||
return '{%s}' % ','.join(sorted('%s:%s' % (
|
return '{%s}' % ','.join(sorted('%s:%s' % (
|
||||||
|
Loading…
Reference in New Issue
Block a user