Coder Social home page Coder Social logo

Comments (4)

clarete avatar clarete commented on June 14, 2024

Hi, thank you so much for your report!

The problem here is that the curses function is not prepared to deal with modules. We would see exactly the same problem if you were trying to curse anything on os for example.

Probably, raising a TypeError saying that modules are not welcome would be enough, since you can still patch them without cursing them. Forbidden Fruit actually uses this technique to provide the hide_from_dir parameter in the curse function: https://github.com/clarete/forbiddenfruit/blob/master/forbiddenfruit/__init__.py#L64

What do you think?

from forbiddenfruit.

jonathaneunice avatar jonathaneunice commented on June 14, 2024

My preference would be for the simplest API possible, so a caller doesn't need different behavior to change a module's attributes or a class's. That is, to have curse() check wether the given klass is really a module, and if so, patching it the simpler way hide_from_dir does. One-stop shopping!

from forbiddenfruit.

clarete avatar clarete commented on June 14, 2024

That makes a lot of sense and I have the tests! :)

from forbiddenfruit.

thedrow avatar thedrow commented on June 14, 2024

But how do we make sure this is done globally?

from forbiddenfruit.

Related Issues (20)

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.