kopia lustrzana https://github.com/halcy/Mastodon.py
Merge pull request #394 from aitorres/aitorres/wrap-unpacking-statement
[minor] Remove "unpacking" + commented `print` statementpull/397/head
commit
b16b811ef5
|
@ -30,7 +30,6 @@ import os
|
||||||
import sys
|
import sys
|
||||||
sys.path.insert(0, os.path.abspath('../'))
|
sys.path.insert(0, os.path.abspath('../'))
|
||||||
autodoc_member_order = 'bysource'
|
autodoc_member_order = 'bysource'
|
||||||
# print(sys.path)
|
|
||||||
|
|
||||||
# Add any Sphinx extension module names here, as strings. They can be
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||||
|
|
|
@ -533,7 +533,6 @@ class Mastodon():
|
||||||
# and we basically always want it
|
# and we basically always want it
|
||||||
for key in param_keys:
|
for key in param_keys:
|
||||||
if key in ['min_id', 'max_id', 'since_id']:
|
if key in ['min_id', 'max_id', 'since_id']:
|
||||||
print("Unpacking", key)
|
|
||||||
params[key] = self.__unpack_id(params[key], dateconv = dateconv, listify = False)
|
params[key] = self.__unpack_id(params[key], dateconv = dateconv, listify = False)
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
|
@ -209,7 +209,6 @@ def try_cast(t, value, retry = True, union_specializer = None):
|
||||||
* Trying once again to AttribAccessDict as a fallback
|
* Trying once again to AttribAccessDict as a fallback
|
||||||
Gives up and returns as-is if none of the above work.
|
Gives up and returns as-is if none of the above work.
|
||||||
"""
|
"""
|
||||||
#print("Cast attempt: ", value, "to", t)
|
|
||||||
if value is None: # None early out
|
if value is None: # None early out
|
||||||
return value
|
return value
|
||||||
t = resolve_type(t)
|
t = resolve_type(t)
|
||||||
|
@ -271,7 +270,6 @@ def try_cast(t, value, retry = True, union_specializer = None):
|
||||||
else:
|
else:
|
||||||
value = t(value)
|
value = t(value)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
#print("Failed to cast", value, "to", t, ":", e)
|
|
||||||
if retry and isinstance(value, dict):
|
if retry and isinstance(value, dict):
|
||||||
value = try_cast(AttribAccessDict, value, False, union_specializer)
|
value = try_cast(AttribAccessDict, value, False, union_specializer)
|
||||||
return value
|
return value
|
||||||
|
@ -334,19 +332,16 @@ def try_cast_recurse(t, value, union_specializer=None):
|
||||||
# Failures are silently ignored. We care about maximum not breaking here.
|
# Failures are silently ignored. We care about maximum not breaking here.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
#print("Type casted", value, "to", t)
|
|
||||||
if real_issubclass(value.__class__, AttribAccessDict) or real_issubclass(value.__class__, PaginatableList) or real_issubclass(value.__class__, NonPaginatableList) or real_issubclass(value.__class__, MaybeSnowflakeIdType):
|
if real_issubclass(value.__class__, AttribAccessDict) or real_issubclass(value.__class__, PaginatableList) or real_issubclass(value.__class__, NonPaginatableList) or real_issubclass(value.__class__, MaybeSnowflakeIdType):
|
||||||
save_type = t
|
save_type = t
|
||||||
if real_type is not None and use_real_type:
|
if real_type is not None and use_real_type:
|
||||||
save_type = real_type
|
save_type = real_type
|
||||||
#print("And trying to add _mastopy_type as ", save_type)
|
|
||||||
try:
|
try:
|
||||||
# Unsure how robust this is - to be evaluated
|
# Unsure how robust this is - to be evaluated
|
||||||
value._mastopy_type = repr(save_type).replace("mastodon.return_types.", "").replace("mastodon.types_base.", "")
|
value._mastopy_type = repr(save_type).replace("mastodon.return_types.", "").replace("mastodon.types_base.", "")
|
||||||
if value._mastopy_type.startswith("<class '") and value._mastopy_type.endswith("'>"):
|
if value._mastopy_type.startswith("<class '") and value._mastopy_type.endswith("'>"):
|
||||||
value._mastopy_type = value._mastopy_type[8:-2]
|
value._mastopy_type = value._mastopy_type[8:-2]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
#print("Failed to set _mastopy_type:", e)
|
|
||||||
# Failures are silently ignored. We care about maximum not breaking here.
|
# Failures are silently ignored. We care about maximum not breaking here.
|
||||||
pass
|
pass
|
||||||
return value
|
return value
|
||||||
|
|
|
@ -34,7 +34,6 @@ class Mastodon(Internals):
|
||||||
version_str = self.__normalize_version_string(self.__instance()["version"])
|
version_str = self.__normalize_version_string(self.__instance()["version"])
|
||||||
self.version_check_worked = True
|
self.version_check_worked = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
|
||||||
# instance() was added in 1.1.0, so our best guess is 1.0.0.
|
# instance() was added in 1.1.0, so our best guess is 1.0.0.
|
||||||
version_str = "1.0.0"
|
version_str = "1.0.0"
|
||||||
self.version_check_worked = False
|
self.version_check_worked = False
|
||||||
|
|
Ładowanie…
Reference in New Issue