Skip to content

Added sorting by attribute to read command #378

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

Merged
merged 2 commits into from
Jan 16, 2022

Conversation

abey79
Copy link
Owner

@abey79 abey79 commented Jan 16, 2022

Description

The read command can now sort geometries by layers based on attribute. For example, this sorts geometries by stroke color:

vpype read --attr stroke input.svg ...

Multiple attributes can be provided, in which case one layer will be created for each unique combination of attribute:

vpype read --attr stroke --attr stroke-width input.svg ...

Fixes #35

Other changes:

Checklist

  • feature/fix implemented
  • code formatting ok (black and isort)
  • mypy returns no error
  • tests added/updated and pytest succeeds
  • documentation added/updated
    • command docstring and option/argument help
    • README.md updated (Feature Overview)
    • CHANGELOG.md updated
    • added new command to reference.rst
    • RTD doc updated and building with no error (make clean && make html in docs/)

- added vpype.read_svg_by_attribute() to read SVG sorting geometries by attribute(s)
- multiple refactoring in vpype/io.py
- added `--attr` option to `read` command to enable sorty by attribute
- `read` now use single-layer mode when `--layer` is used, even if `--single-layer` is not used (fixes #36)
- updated tests
@codecov
Copy link

codecov bot commented Jan 16, 2022

Codecov Report

Merging #378 (8c65860) into master (13fe6a5) will increase coverage by 0.17%.
The diff coverage is 95.53%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #378      +/-   ##
==========================================
+ Coverage   92.55%   92.72%   +0.17%     
==========================================
  Files          53       53              
  Lines        4457     4534      +77     
  Branches      621      636      +15     
==========================================
+ Hits         4125     4204      +79     
+ Misses        222      220       -2     
  Partials      110      110              
Impacted Files Coverage Δ
tests/test_commands.py 98.95% <ø> (ø)
vpype/io.py 80.30% <92.85%> (+1.98%) ⬆️
tests/test_files.py 98.23% <100.00%> (+0.50%) ⬆️
vpype_cli/cli.py 75.72% <100.00%> (+1.15%) ⬆️
vpype_cli/read.py 94.87% <100.00%> (+7.37%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 13fe6a5...8c65860. Read the comment docs.

- added cookbook section
- improved coverage of the `read` command
- changelog updated
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@abey79 abey79 merged commit 8b70225 into master Jan 16, 2022
@abey79 abey79 deleted the feature-read-group-by-attribute branch January 16, 2022 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

read: --layer X should imply --single-layer (instead of being ignored) Classify lines by colour into layers (read)
1 participant