mirror of https://github.com/coddrago/Heroku
Deepsource fixes
parent
8b632fdbd2
commit
9d88819cb5
|
@ -61,7 +61,6 @@ from .translations import Strings, Translator
|
||||||
|
|
||||||
import gc as _gc
|
import gc as _gc
|
||||||
import types as _types
|
import types as _types
|
||||||
import inspect as _inspect
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -120,7 +119,7 @@ def replace_all_refs(replace_from: Any, replace_to: Any) -> Any:
|
||||||
# THIS CODE HERE IS TO DEAL WITH DICTPROXY TYPES
|
# THIS CODE HERE IS TO DEAL WITH DICTPROXY TYPES
|
||||||
if "__dict__" in referrer and "__weakref__" in referrer:
|
if "__dict__" in referrer and "__weakref__" in referrer:
|
||||||
for cls in _gc.get_referrers(referrer):
|
for cls in _gc.get_referrers(referrer):
|
||||||
if _inspect.isclass(cls) and cls.__dict__ == referrer:
|
if inspect.isclass(cls) and cls.__dict__ == referrer:
|
||||||
break
|
break
|
||||||
|
|
||||||
for key, value in referrer.items():
|
for key, value in referrer.items():
|
||||||
|
@ -169,13 +168,13 @@ def replace_all_refs(replace_from: Any, replace_to: Any) -> Any:
|
||||||
# CELLTYPE
|
# CELLTYPE
|
||||||
elif isinstance(referrer, _CELLTYPE):
|
elif isinstance(referrer, _CELLTYPE):
|
||||||
|
|
||||||
def proxy0(data):
|
def _proxy0(data):
|
||||||
def proxy1():
|
def proxy1():
|
||||||
return data
|
return data
|
||||||
|
|
||||||
return proxy1
|
return proxy1
|
||||||
|
|
||||||
proxy = proxy0(replace_to)
|
proxy = _proxy0(replace_to)
|
||||||
newcell = proxy.__closure__[0]
|
newcell = proxy.__closure__[0]
|
||||||
replace_all_refs(referrer, newcell)
|
replace_all_refs(referrer, newcell)
|
||||||
|
|
||||||
|
@ -183,7 +182,7 @@ def replace_all_refs(replace_from: Any, replace_to: Any) -> Any:
|
||||||
elif isinstance(referrer, _types.FunctionType):
|
elif isinstance(referrer, _types.FunctionType):
|
||||||
localsmap = {}
|
localsmap = {}
|
||||||
for key in ["code", "globals", "name", "defaults", "closure"]:
|
for key in ["code", "globals", "name", "defaults", "closure"]:
|
||||||
orgattr = getattr(referrer, "__{}__".format(key))
|
orgattr = getattr(referrer, f"__{key}__")
|
||||||
if orgattr is replace_from:
|
if orgattr is replace_from:
|
||||||
localsmap[key] = replace_to
|
localsmap[key] = replace_to
|
||||||
else:
|
else:
|
||||||
|
@ -196,7 +195,6 @@ def replace_all_refs(replace_from: Any, replace_to: Any) -> Any:
|
||||||
# OTHER (IN DEBUG, SEE WHAT IS NOT SUPPORTED).
|
# OTHER (IN DEBUG, SEE WHAT IS NOT SUPPORTED).
|
||||||
else:
|
else:
|
||||||
logging.debug(f"{referrer} is not supported.")
|
logging.debug(f"{referrer} is not supported.")
|
||||||
pass
|
|
||||||
|
|
||||||
if hit is False:
|
if hit is False:
|
||||||
raise AttributeError(f"Object '{replace_from}' not found")
|
raise AttributeError(f"Object '{replace_from}' not found")
|
||||||
|
|
|
@ -49,7 +49,7 @@ class HikkaException:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_exc_info(
|
def from_exc_info(
|
||||||
self,
|
cls,
|
||||||
exc_type: object,
|
exc_type: object,
|
||||||
exc_value: Exception,
|
exc_value: Exception,
|
||||||
tb: traceback.TracebackException,
|
tb: traceback.TracebackException,
|
||||||
|
|
|
@ -881,10 +881,7 @@ class HikkaConfigMod(loader.Module):
|
||||||
if isinstance(mod, loader.Library):
|
if isinstance(mod, loader.Library):
|
||||||
type_ = "library"
|
type_ = "library"
|
||||||
else:
|
else:
|
||||||
if getattr(mod, "__origin__", None) == "<core>":
|
type_ = getattr(mod, "__origin__", None) == "<core>"
|
||||||
type_ = True
|
|
||||||
else:
|
|
||||||
type_ = False
|
|
||||||
|
|
||||||
await self.inline__configure(form, args, obj_type=type_)
|
await self.inline__configure(form, args, obj_type=type_)
|
||||||
return
|
return
|
||||||
|
|
|
@ -340,15 +340,7 @@ class UpdaterMod(loader.Module):
|
||||||
return
|
return
|
||||||
|
|
||||||
if "DYNO" in os.environ:
|
if "DYNO" in os.environ:
|
||||||
msg_obj = await utils.answer(
|
msg_obj = await utils.answer(msg_obj, self.strings("heroku_update"))
|
||||||
msg_obj,
|
|
||||||
self.strings("heroku_update"),
|
|
||||||
reply_markup={
|
|
||||||
"text": "📂 Preparing files...",
|
|
||||||
"action": "answer",
|
|
||||||
"text": "🕧 Wait. Update is processing",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
await self.process_restart_message(msg_obj)
|
await self.process_restart_message(msg_obj)
|
||||||
try:
|
try:
|
||||||
nosave = "--no-save" in utils.get_args_raw(msg_obj)
|
nosave = "--no-save" in utils.get_args_raw(msg_obj)
|
||||||
|
@ -374,11 +366,7 @@ class UpdaterMod(loader.Module):
|
||||||
else:
|
else:
|
||||||
remote = repo.create_remote("heroku", url)
|
remote = repo.create_remote("heroku", url)
|
||||||
|
|
||||||
await utils.run_sync(
|
await utils.run_sync(remote.push, refspec="HEAD:refs/heads/master")
|
||||||
remote.push,
|
|
||||||
refspec="HEAD:refs/heads/master",
|
|
||||||
kwargs={"force": True},
|
|
||||||
)
|
|
||||||
await utils.answer(
|
await utils.answer(
|
||||||
msg_obj,
|
msg_obj,
|
||||||
self.strings("heroku_update_done_nothing_to_push"),
|
self.strings("heroku_update_done_nothing_to_push"),
|
||||||
|
|
Loading…
Reference in New Issue