Skip to content

CLN: Rename __p___parent, clean-up gtag, _factory and __rings__#1467

Merged
jorisvandenbossche merged 1 commit intoshapely:mainfrom
mwtoews:un-dunder
Aug 14, 2022
Merged

CLN: Rename __p___parent, clean-up gtag, _factory and __rings__#1467
jorisvandenbossche merged 1 commit intoshapely:mainfrom
mwtoews:un-dunder

Conversation

@mwtoews
Copy link
Copy Markdown
Member

@mwtoews mwtoews commented Aug 8, 2022

This was partially discussed in #983 to rename a few variables. But also clean-up variables that are no longer used with shapely-2.

  • Rename __p___parent to make it "private", and generally avoid non-standard dunder names. Another consideration is to rename it to __parent to enable name mangling for sub classes, see docs Private Variable and Reserved classes of identifiers. Another consideration is with __del__, "Python guarantees that globals whose name begins with a single underscore are deleted from their module before other globals are deleted", implying that a double underscore variable would be deleted last.
  • Remove unused _factory, which was formerly a callable that returned instances of Shapely geometries, i.e. geom_factory
  • Remove unused __rings__, which was another former structure

@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 2816629751

  • -2 of 10 (80.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.8%) to 83.546%

Changes Missing Coverage Covered Lines Changed/Added Lines %
shapely/geometry/base.py 4 5 80.0%
shapely/geometry/polygon.py 4 5 80.0%
Totals Coverage Status
Change from base Build 2816491075: -0.8%
Covered Lines: 2163
Relevant Lines: 2589

💛 - Coveralls

@coveralls
Copy link
Copy Markdown

coveralls commented Aug 8, 2022

Pull Request Test Coverage Report for Build 2842997416

  • 8 of 9 (88.89%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.009%) to 84.309%

Changes Missing Coverage Covered Lines Changed/Added Lines %
shapely/geometry/base.py 4 5 80.0%
Totals Coverage Status
Change from base Build 2816491075: 0.009%
Covered Lines: 2074
Relevant Lines: 2460

💛 - Coveralls

@mwtoews
Copy link
Copy Markdown
Member Author

mwtoews commented Aug 8, 2022

I'm tempted to also clean-up _gtag and def gtag(self) in this PR too. However, the later is public:

>>> from shapely.geometry import Point
>>> g = Point(0,1).buffer(1)
>>> g.interiors.gtag()
-7868044578161086364

@jorisvandenbossche
Copy link
Copy Markdown
Member

I'm tempted to also clean-up _gtag and def gtag(self) in this PR too. However, the later is public:

I would personally fine with just removing it in shapely 2.0 (without having first deprecated it, we can list it in the whatsnew under the breaking changes). I would be surprised if many people are using this?

@mwtoews mwtoews changed the title Rename __p___parent, clean-up _factory and __rings__ Rename __p___parent, clean-up gtag, _factory and __rings__ Aug 11, 2022
@mwtoews
Copy link
Copy Markdown
Member Author

mwtoews commented Aug 11, 2022

Ok, I've update this to remove _gtag and gtag(). From what I see in shapely-1.8, this was used with shapely/geometry/proxy.py with the CachingGeometryProxy class, which was removed with #961. (Previous CI errors were unrelated, and are now fixed upstream.)

@jorisvandenbossche jorisvandenbossche changed the title Rename __p___parent, clean-up gtag, _factory and __rings__ CLN: Rename __p___parent, clean-up gtag, _factory and __rings__ Aug 14, 2022
@jorisvandenbossche jorisvandenbossche merged commit 0ac0d53 into shapely:main Aug 14, 2022
@jorisvandenbossche
Copy link
Copy Markdown
Member

Thanks!

@mwtoews mwtoews deleted the un-dunder branch August 17, 2022 21:48
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.

3 participants