You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: cannot format checkgo.py: INTERNAL ERROR: Black produced code that is not equivalent to the source.
importreimportrequestsimportplatformfromcansiiimportCAnsiiascdefbanner_gopher():
returnc.blue(
""" ,_---~~~~~----._ _,,_,*^____ _____``*g*""*, / __/ /' ^. / \\\\ ^@q f [ @f | @)) | | @)) l 0 _/ \\`/ \\\\~____ / __\\\\_____\\\\\\\\ | _l__l_ I } [______] I ] | | | | ] ~ ~ | | | | | """
)
# Plataformas a la cual se podran descargarPLATFORM= {
"Darwin", # MacOs"Windows",# NT"Linux", # :)"Source"
}
classCheckgo:
@classmethoddef_check_platform(cls):
for_linux=platform.platform().split("-")[0]
iffor_linuxinPLATFORM:
return"linux"# Asi con los demas que faltan, por falta de equipos# no podre testearlos, por ahora solo en linux# ...@classmethoddefdownload_go_version(cls, version):
"""Descarga le version de golang expecificada Args: version que llega desde get_latest_go_version """dl_url=f"https://go.dev{version}"filename=f"Checkgo-{version.split("/")[-1]}"try:
response=requests.get(dl_url)
response.raise_for_status()
withopen(filename, "wb") asf:
f.write(response.content)
print(
f"¡La versión {version} de Go se ha descargado con éxito como {filename}!"
)
exceptrequests.RequestExceptionase:
print(f"Error al descargar la versión {version} de Go:", e)
@classmethoddefget_latest_go_version(cls):
url="https://go.dev/dl/"try:
plataforma=cls._check_platform()
response=requests.get(url)
response.raise_for_status()
# Utilizar expresiones regulares para extraer los enlaces de descargamatch=re.findall(r'href="(/dl/go\d+\.\d+\.\d+\.%s-amd64\.tar\.gz)"'%plataforma, response.text)
ifmatch:
latest_version=match[0]
print("Última versión encontrada:", latest_version)
returnlatest_versionelse:
print("No se pudo encontrar la última versión de Go.")
exceptrequests.RequestExceptionase:
print("Error al obtener la última versión de Go:", e)
defmain():
latest_version=Checkgo.get_latest_go_version()
iflatest_version:
print("Última versión de Go:", latest_version)
Checkgo.download_go_version(latest_version)
if__name__=="__main__":
main()
And run it with these arguments:
$ black file.py --target-version py39
The resulting error is:
[ cannot format file.py: INTERNAL ERROR: ...](error: cannot format checkgo.py: INTERNAL ERROR: Black produced code that is not equivalent to the source. Please report a bug on https://github.com/psf/black/issues. This diff might be helpful: /tmp/blk_1v6_6j0v.log)
Expected behavior
Environment
black, 24.4.0 (compiled: yes)
Python 3.12.2 Red Hat 13.2.1-6 linux
Additional context
The text was updated successfully, but these errors were encountered:
error: cannot format checkgo.py: INTERNAL ERROR: Black produced code that is not equivalent to the source.
And run it with these arguments:
The resulting error is:
Expected behavior
Environment
Additional context
The text was updated successfully, but these errors were encountered: