Giter VIP home page Giter VIP logo

abcmeta's Introduction

Hi!

My name is Mort; I'm a passionate software engineer and open-source enthusiast with a deep interest in GNU/Linux. My love for coding is evident in every line of the code I write, and I never shy away from a challenge.

Mort's GitHub stats Top Langs

Feel free to contact me by [email protected]

abcmeta's People

Contributors

kyleking avatar mortymacs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

abcmeta's Issues

PR: Catch Multiple Errors

Would you be open to a PR that catches multiple errors and prints them all at once?

I was thinking that instead of the raise AttributeError(), the errors could be collected and then raised at the end

abcmeta/abcmeta/__init__.py

Lines 157 to 187 in 4fef29b

# Make sure the derived class has implemented the abstract method.
if name not in cls.__dict__:
raise AttributeError(
"Derived class '{}' has not implemented '{}' method of the"
" parent class '{}'.".format(
cls.__name__, name, cls.__base__.__name__
)
)
derived_method = getattr(cls, name)
# Get methods signatures.
*obj_method_signature, obj_method_signature_str = _get_signature(obj)
*derived_method_signature, derived_method_signature_str = _get_signature(
derived_method
)
# Compare signatures.
diff = _compare_signatures(
obj_method_signature_str, derived_method_signature_str
)
# Raise signature error.
if diff:
diff_details = _compare_signatures_details(
obj_method_signature, derived_method_signature
)
raise AttributeError(
"Signature of the derived method is not the same as parent"
" class:\r\n{}".format(_prepare_text_to_raise(diff, diff_details))
)

Could be modified like this:

errors = []
for name, obj in vars(cls.__base__).items():
    ...
    if name not in cls.__dict__:
        errors.append(
            "Derived class '{}' has not implemented '{}' method of the"
            " parent class '{}'.".format(
                cls.__name__, name, cls.__base__.__name__
            )
        )
        continue
    ...
if errors:
    raise AttributeError("\n\n".join(errors))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.