forked from OSGeo/grass
-
Notifications
You must be signed in to change notification settings - Fork 0
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
E722 #21
Merged
Merged
E722 #21
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* updated E722 * updated .flake8 * Update v.unpack.py
* updated E722 * updates * updates --------- Co-authored-by: Anna Petrasova <[email protected]>
Dereference after null check
For both active and inactive raster mask, show the name of the raster which is used (or would be used) for the mask. This will allow tools like r.mask or GUI to do lower-level operations with or around mask without a need to know about defaults or user mechanism to change the name. I'm repurposing the existing 'name' (full_name) key which is now always set (as opposed to being null when no mask is present) as the 'present' boolean key already has the information on the mask presence. I'm renaming full_name to name because that creates a simpler interface (which is whole point of outputting full name as opposed to two keys to get name and mapset).
* document performance issue * address code review * Apply suggestions from code review Co-authored-by: Markus Neteler <[email protected]> * consistent recommendation * remove leftover dot --------- Co-authored-by: Markus Neteler <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This color table uses the color ramp from the srtm_plus color table for terrain to create colors for relative elevation (spread over the range of elevations in a raster map) rather than absolute elevation in meters. This applies srtm colors in a way similar to the way the elevation color table applies them. This color table is especially useful in creating nice looking elevation maps and shading relief maps.
While the message functions (fatal, warning, message, info, debug, verbose, percent) have env parameter, grass.script was not consistently passing the env parameter to these functions. This fixes all the clear cases in functions which themselves have env (but does not touch any which don't have it where the fix needs to be more complex). These functions can now be called and produce these messages even for non-global sessions.
…ble files (#4563) * style: Sort packages in Vagrantfile * style: Sort configure flags in package.nix * style: Sort .gunittest.cfg * style: Sort Travis build files * style: Sort python optional_requirements.txt * style: Sort configure flags in GitHub workflows * style: Sort packages and configure flags for binder * style: Sort packages, configure flags, cmake flags and wget downloads in Dockerfiles * style: Sort configure flags in Vagrant script * style: Sort svn author name files with linux sort command * style: Sort contributors.csv and contributors_extra.csv * style: Sort rpm package spec * style: Sort packages and configure flags in mswindows build scripts * style: Sort macosx build script Readme * style: Sort singularity file * Apply changes from https://src.fedoraproject.org/rpms/grass/blob/rawhide/f/grass.spec
* grass.pygrass.rpc.base: Add typing annotations for lock and conn * grass.pygrass.rpc.base: Use context manager for lock in dummy_server * grass.pygrass.rpc.base: Use context manager for threadLock in RPCServerBase * grass.pygrass.rpc.base: Remove release lock in context manager * grass.pygrass.rpc.base: Add more typing annotations * grass.pygrass.rpc.base: Check for None to satisfy mypy type checking * grass.pygrass.rpc.base: Remove release lock in context managers, as they would be released when unlocked (RuntimeError: release unlocked lock) * grass.pygrass.rpc.base: Sort imports * grass.temporal.c_libraries_interface: Use context manager for lock in c_library_server * grass.temporal.c_libraries_interface: Add typing annotations for lock and conn * grass.pygrass.rpc.base: Change date of file header * grass.pygrass.rpc.base: Update docs of conn argument to mention that it is a multiprocessing.Connection object obtained from multiprocessing.Pipe * grass.temporal.c_libraries_interface: Change date of file header * grass.pygrass.rpc: Sort imports * grass.temporal.c_libraries_interface: Sort imports * Update docs of conn argument to mention that it is a multiprocessing.Connection object obtained from multiprocessing.Pipe * grass.pygrass.messages: Sort imports * Update docs of conn argument to mention that it is a multiprocessing.connection.Connection object obtained from multiprocessing.Pipe * grass.pygrass.rpc: Use context manager to acquire and release the lock * Fix typo in python/grass/pygrass/messages/testsuite/test_pygrass_messages_doctests.py * grass.pygrass.messages: Fix typo in message_server * grass.pygrass.messages: Missing "IMPORTANT" message type in message_server * grass.pygrass.messages: Add return type to get_msgr * grass.pygrass.messages: Add types to signatures in Messenger class and rest of file * grass.pygrass.messages: Use context manager for acquiring the lock in message_server() * grass.pygrass.messages: Add types to message_types to track missing conditions * grass.pygrass.messages: Extract message only for message_types where the variable is used * grass.pygrass.messages: Add parameter descriptions to percent(self, n, d, s) * grass.pygrass.messages: Initialize Messenger fields without setting them to None * grass.pygrass.messages: Fix typo * grass.pygrass.messages: Change date of file header
ogsf: fix possible overflow errors in gsd modules In a lot of places, `(255 << 24)` which causes integer overflow and positive number gets converted to negative number. We were then assigning this to an unsigned integer in multiple places, which does conversion in a different way. For example: If we do unsigned int x = -20, `UINT_MAX + 1 - 20` is assigned to x. I do not think that's what is intended when we do `ktrans = (255 << 24)`. Fix instances of that, by using an unsigned int literal over int literal. This issue was found using cppcheck tool. Signed-off-by: Mohan Yelugoti <[email protected]>
fix resource leak issue Co-authored-by: Shubham Vasudeo Desai <[email protected]>
ogsf: fix possible overflow errors in gvld module We were doing `(255 << 24)` which causes integer overflow and positive number gets converted to negative number. We were then assigning this to an unsigned integer in multiple places, which does conversion in a different way. For example: If we do unsigned int x = -20, `UINT_MAX + 1 - 20` is assigned to x. I do not think that's what is intended when we do `ktrans = (255 << 24)`. Fix instances of that, by using an unsigned int literal over int literal. This issue was found using cppcheck tool. Signed-off-by: Mohan Yelugoti <[email protected]>
ogsf: fix possible overflow errors in gsd_wire In a code, we were doing `(255 << 24)` which causes integer overflow and positive number gets converted to negative number. We were then assigning this to an unsigned integer in multiple places, which does conversion in a different way. For example: If we do `unsigned int x = -20`, `UINT_MAX + 1 - 20` is assigned to x. I do not think that's what is intended when we do with `ktrans = (255 << 24)`. Fix instances of that, by using an `unsigned int literal` over `int literal`. This issue was found using cppcheck tool. Signed-off-by: Mohan Yelugoti <[email protected]>
…ion header (#4658) To allow to download ZIP file. Server response headers which indicating ZIP file: content-type: application/octet-stream content-disposition: attachment; filename=natural_earth_dataset.zip Fix download Natural Earth Dataset in WGS84 from the server URL https://zenodo.org/records/13370131/files/natural_earth_dataset.zip
doc: i.albedo and r.li manual HTML fixes This PR removes the unneeded header of the `r.li.html` metapage. Additionally: - style fix in `i.albedo.html`
Use Rast_mask_status in r.report and r.kappa to get the name and state.
…ndom.surface) (#4634) Use Rast_mask_status instead of hardcoded name MASK for r.surf.contour, r.random.cells, and r.random.surface. Raster mask if present, is loaded in a special way in these tools. After this change, the name of the mask is retrieved from the library (that's the important part) and the library is at the same time used to test the presence of the mask (as opposed to testing presence of raster directly, but that's just more convenient rather than conceptual). The change in r.random.surface code switching the if and else branches is to make it easier to write and more consistent with the other two.
Avoid hardcoded MASK by using the Rast_mask_status function. The rest of the logic stays the same so mask is read just as the plain raster map is read. Documentation is updated to use 'raster mask' instead of 'MASK'.
Fix Resource Leak issue
Extracting the tarball will with this create a containing directory named 'grass-x.y.z', where x, y, z stands for major, minor, micro/patch version.
* allow r-flag and zones * add test for r-flag and zones * use region env only with zones * use region env for r3.univar * Update docstring
* Added test script for r.buffer * Corrected input map and added tearDown method to delete temp maps * Added pre commit fixes * Added resolution for feedback * Tweaked the last test and used f string * Update raster/r.buffer/testsuite/test_buffer.py Reduced the region of the test Co-authored-by: Anna Petrasova <[email protected]> * Corrected redudancy * Streamlined output map initialization --------- Co-authored-by: Anna Petrasova <[email protected]>
Enable use of external libraries in GRASS libraries.
* i.vi: Add ndwi color table to output * Changed the min max values when setting the color table --------- Co-authored-by: Corey White <[email protected]>
…all (#4650) lib/gis: Fix out of scope memory access error in file_name() When execution takes else path, pname, a pointer, is set to point to a local variable array which has limited scope. This same pointer is accessed outside of the block containing the local variable, essentially creating a scenario where we are accessing memory outside its score, which is undefined behavior. Move the variable array out of the loop, so that it has the same scope as pname. This was found using cppcheck tool. Signed-off-by: Mohan Yelugoti <[email protected]>
Currently, there is no sign either from GitHub issues or grass-dev archive that many people are using CRAY code which was introduced 25 years ago. As part of fixing a bug, we found that it was hard to find reference materials related to CRAY, due to it being old and not in usage anymore. For this reason, deprecate CRAY code and corresponding complexity that comes with it. Signed-off-by: Mohan Yelugoti <[email protected]>
Fix regression introduced by 8dced26.
* CI(deps): Update ruff to v0.7.3 * style: Ignore PYI066 on non-stub files. Doesn't seem idiomatic and not understood by Pyright. * style: Fix split-static-string (SIM905) Ruff rule: https://docs.astral.sh/ruff/rules/split-static-string/ * style: Ignore subclass-builtin (FURB189) in two files, as expected change is not guaranteed to be equivalent --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Edouard Choinière <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
v.import: Fixed E722 bare except (https://github.com/OSGeo/grass/pull/4614[)](https://github.com/a0x8o/grass/commit/6e5643d2b91372acc1a0106400670b61b41f1eb9)
CI(deps): Lock file maintenance (https://github.com/OSGeo/grass/pull/4564[)](https://github.com/a0x8o/grass/commit/86497131a7d1999936d380d1f57870e87690b9db)
v.unpack: Fixed bare 'except' (https://github.com/OSGeo/grass/pull/4616[)](https://github.com/a0x8o/grass/commit/9be02eeba6bfd198acb46aacf522f676fcd90fa2)
wxGUI: Fixed bare 'except' in nviz/ (https://github.com/OSGeo/grass/pull/4613[)](https://github.com/a0x8o/grass/commit/9581ca185bf001301f3907fd3f1ca6da09e9e287)
arohanajit and petrasovaa authored last week
lib/ogsf: Dereference after null check in gvl2.c (https://github.com/OSGeo/grass/pull/4588[)](https://github.com/a0x8o/grass/commit/528763fb33ed7c696ea7fa19505b5d9ad02fb62e)
v.report: Updated instance checks (https://github.com/OSGeo/grass/pull/4618[)](https://github.com/a0x8o/grass/commit/00f51c9e7c22b9643de2b472bc4f6ef4296ceb90)
r.mask.status: Always output name of the mask (https://github.com/OSGeo/grass/pull/4531[)](https://github.com/a0x8o/grass/commit/ba0a4951958b20b0c1fca339c4fa92714095bacc)
r.buildvrt: document performance issues with external data (https://github.com/OSGeo/grass/pull/4441[)](https://github.com/a0x8o/grass/commit/f9f01e1e40ab9eb8a28fd91717178935946e6606)
ninsbl and neteler authored 5 days ago
db.out.ogr: Removed unused variable (https://github.com/OSGeo/grass/pull/4617[)](https://github.com/a0x8o/grass/commit/d5a87229ae30cf04ff90f7cfcdc923ec0afa5a36)
CI(deps): Update softprops/action-gh-release action to v2.0.9 (OSGeo#4624
CI(deps): Update docker/dockerfile Docker tag to v1.11 (https://github.com/OSGeo/grass/pull/4621[)](https://github.com/a0x8o/grass/commit/3f0b69fdf56879fcd35d36da51c0227765948dca)
r.in.wms: Removed bare 'except' and repositioned imports (https://github.com/OSGeo/grass/pull/4622[)](https://github.com/a0x8o/grass/commit/7d9bbac1f28a6e5f093e4bac55f6b0d6c7227272)
lib: Add new SRTM_percent color table (https://github.com/OSGeo/grass/pull/4608[)](https://github.com/a0x8o/grass/commit/4385b2650bcc5432080b29756c855ba0a05d6036)
r.in.wms: Replace long-deprecated np.arrayrange alias with `np.aran…
grass.script: Pass environment to message functions (https://github.com/OSGeo/grass/pull/4630[)](https://github.com/a0x8o/grass/commit/cb3d12b490528b595729589e373887bc5a5923a6)
CI(deps): Update ruff to v0.7.2 (https://github.com/OSGeo/grass/pull/4631[)](https://github.com/a0x8o/grass/commit/0824e8842edde3af2588d3865d12ba67493666f0)
style: Sort package lists, configure options, and other various sorta…
python: Add typing to RPC server and Messenger (https://github.com/OSGeo/grass/pull/4639[)](https://github.com/a0x8o/grass/commit/35ebcb33a3275f335f6a86b283e8d5a65676a4e7)
CI: add expat dependency to macOS runner (https://github.com/OSGeo/grass/pull/4646[)](https://github.com/a0x8o/grass/commit/d4bb783424e1799a3306f26e413dcfaa148de9bc)
CI(deps): Update DeterminateSystems/nix-installer-action action to v15 (
CI(deps): Lock file maintenance (https://github.com/OSGeo/grass/pull/4643[)](https://github.com/a0x8o/grass/commit/847944e18e8c11f412e41c7767424f8ced6dbb3f)
lib/vector/Vlib: Fix Resource Leak issues in break_polygons.c (OSGeo#4612
v.delaunay: Fix Resource Leak issues in in_out.c (https://github.com/OSGeo/grass/pull/4625[)](https://github.com/a0x8o/grass/commit/0ad65e4ebd336ca43e21be8f1b38980552da3836)
lib/ogsf: Fix resource leak issue in gsd_img_tif.c (https://github.com/OSGeo/grass/pull/4626[)](https://github.com/a0x8o/grass/commit/7d878593c3fa3e8009e394097876a8a0812c13ec)
r.viewshed: address -Wunused-value warnings (https://github.com/OSGeo/grass/pull/4609[)](https://github.com/a0x8o/grass/commit/baf93a5c43e36363d2698440fcd419f07d3eb59b)
CI(deps): Update mamba-org/setup-micromamba action to v2.0.1 (OSGeo#4648
lib/ogsf: fix possible overflow errors in gsd_surf.c (https://github.com/OSGeo/grass/pull/4635[)](https://github.com/a0x8o/grass/commit/f7537c41c00dbf9f5e5253aca412c1e4100d4a99)
lib/vector/Vlib: Fix resource leak issue in clean_nodes.c (https://github.com/OSGeo/grass/pull/4627[)](https://github.com/a0x8o/grass/commit/4854f491a00d482bfaad1817113c39f4b90fb06f)
lib/ogsf: fix possible overflow errors in gvld.c (https://github.com/OSGeo/grass/pull/4637[)](https://github.com/a0x8o/grass/commit/c1d855738a428be4d55a7dfbae7f97c3ed0c3f05)
lib/ogsf: fix possible overflow errors in gsd_wire.c (https://github.com/OSGeo/grass/pull/4636[)](https://github.com/a0x8o/grass/commit/206cabcbb7275debed2bcdd9c1a3869ab58552fc)
v.info: add json output for columns (https://github.com/OSGeo/grass/pull/4590[)](https://github.com/a0x8o/grass/commit/039183d9be2c1baf6e63fc07f6554fe6c2a06276)
GUI: fix for Python3.13 (https://github.com/OSGeo/grass/pull/4653[)](https://github.com/a0x8o/grass/commit/f15230d4268166d050086fcf44d2959eed545f58)
r.colors.out: Add JSON support (https://github.com/OSGeo/grass/pull/4555[)](https://github.com/a0x8o/grass/commit/760d763d9ee991a43d9ed34e1a37d15a5bf3f19b)