-
-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
style: address flake8 e402 warning in the codebase #3354
Changes from 3 commits
40b60a4
c8ab468
ea17773
9a36b7e
7030bd1
b55f997
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file I'm ok with. |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file I'm ok with. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ | |
import string | ||
from shutil import copy | ||
|
||
from grass.script import core | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
|
@@ -25,8 +27,6 @@ | |
0, os.path.abspath(os.path.join(os.environ["GISBASE"], "etc", "python", "grass")) | ||
) | ||
|
||
from grass.script import core | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might not behave successfully. Is there a way to know if it imports well, and not only wrapped inside a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ran GRASS GIS, accessed the interactive terminal, entered the Python shell within that environment, and executed the import statement without encountering any errors. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact, I see that this file is for generating docs (sphinx). Does someone know how to trigger it to check it? I know that the docs are built daily on an OSGeo server |
||
footer_tmpl = string.Template( | ||
r""" | ||
{% block footer %}<hr class="header"> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is most probably fine. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,12 +30,11 @@ | |
from grass.grassdb.checks import is_location_valid | ||
from grass.script.setup import set_gui_path | ||
|
||
set_gui_path() | ||
|
||
from core.debug import Debug | ||
from core.gthread import gThread | ||
from gui_core.wrap import Button, StaticText | ||
|
||
set_gui_path() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Has there been a careful analysis of what is needed for |
||
|
||
# TODO: labels (and descriptions) translatable? | ||
LOCATIONS = [ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file I'm ok with. |
echoix marked this conversation as resolved.
Show resolved
Hide resolved
|
echoix marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,16 @@ | |
|
||
import socket | ||
import grass.script as grass | ||
import numpy as Numeric | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know it was there before, but probably a new PR for this, but it is almost an universal convention across all Python code that numpy is imported as np, like Probably someone from this repo can jump in. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is just some very old practice carried over. Just change that. |
||
|
||
from time import sleep | ||
from math import pi, floor | ||
from urllib.error import HTTPError | ||
from http.client import HTTPException | ||
from xml.etree.ElementTree import ParseError | ||
from wms_base import GetEpsg, GetSRSParamVal, WMSBase | ||
from wms_cap_parsers import WMTSCapabilitiesTree, OnEarthCapabilitiesTree | ||
from srs import Srs | ||
|
||
try: | ||
from osgeo import gdal | ||
|
@@ -30,22 +38,8 @@ | |
) | ||
) | ||
|
||
import numpy as Numeric | ||
|
||
Numeric.arrayrange = Numeric.arange | ||
|
||
from math import pi, floor | ||
|
||
from urllib.error import HTTPError | ||
from http.client import HTTPException | ||
|
||
from xml.etree.ElementTree import ParseError | ||
|
||
from wms_base import GetEpsg, GetSRSParamVal, WMSBase | ||
|
||
from wms_cap_parsers import WMTSCapabilitiesTree, OnEarthCapabilitiesTree | ||
from srs import Srs | ||
|
||
|
||
class WMSDrv(WMSBase): | ||
def _download(self): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if that's not from this PR, this doesn't sound right, and quite ambiguous (the alias's name)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've noticed that across our codebase, there is a consistent use of the alias grass for the core module. Given that this pattern is present in around 51 files, it might be worth discussing whether we want to maintain this convention or consider a more descriptive alias.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this was introduced when transitioning form a single-file package called grass(.script?) to multiple files (modules). Functions in original grass or something like that were moved core and grass or grass.script got new functions. grass.script.core then became what grass once was. These imports were the least intrusive change, so it was implemented that way. This was in the pre-v7-times on Subversion trunk, but it was propagated sufficiently through the code base at the time of v7 release that it became a standard for v7. We came up with
grass.script as gs
as a better practice, but didn't go back (yet) to replace all occurrences ofcore as grass
.