Skip to content
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

Enforce private instantiation and inheritance through metaclass #1043

Merged
merged 1 commit into from
May 6, 2019

Conversation

ankitkumarr
Copy link
Member

@ankitkumarr ankitkumarr commented May 6, 2019

Issue: #1021

Added two new metaclasses:

  1. Final: Ensures that no class can inherit the class using the metaclass
  2. NoPublicConstructor: Ensures that no object of the class using the metaclass can be directly created. This metaclass derives from Final, also ensuring 1

Copy link
Member

@oremanj oremanj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this generally looks good! Just a couple of comments

newsfragments/1021.misc.rst Outdated Show resolved Hide resolved
trio/tests/test_util.py Outdated Show resolved Hide resolved
@ankitkumarr ankitkumarr force-pushed the add-private-metaclass branch from adefacb to 4b2b0d3 Compare May 6, 2019 20:34
@codecov
Copy link

codecov bot commented May 6, 2019

Codecov Report

Merging #1043 into master will decrease coverage by 0.08%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #1043      +/-   ##
==========================================
- Coverage   99.53%   99.45%   -0.09%     
==========================================
  Files         102      102              
  Lines       12287    12317      +30     
  Branches      915      916       +1     
==========================================
+ Hits        12230    12250      +20     
- Misses         36       43       +7     
- Partials       21       24       +3
Impacted Files Coverage Δ
trio/tests/test_util.py 100% <100%> (ø) ⬆️
trio/_core/_exceptions.py 100% <100%> (ø) ⬆️
trio/_core/tests/test_run.py 99.86% <100%> (-0.14%) ⬇️
trio/_util.py 95.28% <100%> (-4.72%) ⬇️
trio/_core/_run.py 99.7% <100%> (ø) ⬆️
trio/_core/tests/test_ki.py 99.02% <0%> (-0.98%) ⬇️

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.

2 participants