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 types as _types
|
||||
import inspect as _inspect
|
||||
|
||||
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
|
||||
if "__dict__" in referrer and "__weakref__" in 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
|
||||
|
||||
for key, value in referrer.items():
|
||||
|
@ -169,13 +168,13 @@ def replace_all_refs(replace_from: Any, replace_to: Any) -> Any:
|
|||
# CELLTYPE
|
||||
elif isinstance(referrer, _CELLTYPE):
|
||||
|
||||
def proxy0(data):
|
||||
def _proxy0(data):
|
||||
def proxy1():
|
||||
return data
|
||||
|
||||
return proxy1
|
||||
|
||||
proxy = proxy0(replace_to)
|
||||
proxy = _proxy0(replace_to)
|
||||
newcell = proxy.__closure__[0]
|
||||
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):
|
||||
localsmap = {}
|
||||
for key in ["code", "globals", "name", "defaults", "closure"]:
|
||||
orgattr = getattr(referrer, "__{}__".format(key))
|
||||
orgattr = getattr(referrer, f"__{key}__")
|
||||
if orgattr is replace_from:
|
||||
localsmap[key] = replace_to
|
||||
else:
|
||||
|
@ -196,7 +195,6 @@ def replace_all_refs(replace_from: Any, replace_to: Any) -> Any:
|
|||
# OTHER (IN DEBUG, SEE WHAT IS NOT SUPPORTED).
|
||||
else:
|
||||
logging.debug(f"{referrer} is not supported.")
|
||||
pass
|
||||
|
||||
if hit is False:
|
||||
raise AttributeError(f"Object '{replace_from}' not found")
|
||||
|
|
|
@ -49,7 +49,7 @@ class HikkaException:
|
|||
|
||||
@classmethod
|
||||
def from_exc_info(
|
||||
self,
|
||||
cls,
|
||||
exc_type: object,
|
||||
exc_value: Exception,
|
||||
tb: traceback.TracebackException,
|
||||
|
|
|
@ -881,10 +881,7 @@ class HikkaConfigMod(loader.Module):
|
|||
if isinstance(mod, loader.Library):
|
||||
type_ = "library"
|
||||
else:
|
||||
if getattr(mod, "__origin__", None) == "<core>":
|
||||
type_ = True
|
||||
else:
|
||||
type_ = False
|
||||
type_ = getattr(mod, "__origin__", None) == "<core>"
|
||||
|
||||
await self.inline__configure(form, args, obj_type=type_)
|
||||
return
|
||||
|
|
|
@ -340,15 +340,7 @@ class UpdaterMod(loader.Module):
|
|||
return
|
||||
|
||||
if "DYNO" in os.environ:
|
||||
msg_obj = await utils.answer(
|
||||
msg_obj,
|
||||
self.strings("heroku_update"),
|
||||
reply_markup={
|
||||
"text": "📂 Preparing files...",
|
||||
"action": "answer",
|
||||
"text": "🕧 Wait. Update is processing",
|
||||
},
|
||||
)
|
||||
msg_obj = await utils.answer(msg_obj, self.strings("heroku_update"))
|
||||
await self.process_restart_message(msg_obj)
|
||||
try:
|
||||
nosave = "--no-save" in utils.get_args_raw(msg_obj)
|
||||
|
@ -374,11 +366,7 @@ class UpdaterMod(loader.Module):
|
|||
else:
|
||||
remote = repo.create_remote("heroku", url)
|
||||
|
||||
await utils.run_sync(
|
||||
remote.push,
|
||||
refspec="HEAD:refs/heads/master",
|
||||
kwargs={"force": True},
|
||||
)
|
||||
await utils.run_sync(remote.push, refspec="HEAD:refs/heads/master")
|
||||
await utils.answer(
|
||||
msg_obj,
|
||||
self.strings("heroku_update_done_nothing_to_push"),
|
||||
|
|
Loading…
Reference in New Issue