Giter Club home page Giter Club logo

Comments (5)

MarshalX avatar MarshalX commented on June 24, 2024 1

more clear indents :

def is_record_type(model: t.Union[ModelBase, dict], types_module) -> bool:
    # for now, records in the Main class only. could be broken late
    if not hasattr(types_module, 'Main'):
        return False

    if isinstance(model, dict):  # custom (extended) record
        return types_module.Main._type == model.get('$type')

    return types_module.Main._type == model._type

from atproto.

joelghill avatar joelghill commented on June 24, 2024 1

Thanks! I'll take another crack at this tomorrow if I have time.

Do you have guidelines on the formatting, listing, unit test, etc? I see you're using Black and Ruff?

from atproto.

MarshalX avatar MarshalX commented on June 24, 2024

wow. looks of course legit due to invalid isinstance() logic except how it should work

i think it should be:

def is_record_type(model: t.Union[ModelBase, dict], types_module) -> bool:
    # for now records in Main. could be broken late
    if hasattr(types_module, 'Main'):
        if isinstance(model, RecordModelBase):
            return types_module.Main._type == model._type
        if isinstance(model, dict):  # custom record
            return types_module.Main._type == model.get('$type')

    return False

we don't rly support unknown records from custom lexicons at all we case we don't know this custom lexicon... by "custom record" i mean an extended version of the base record (described by official lexicons). extended with additional fields, for example

from atproto.

MarshalX avatar MarshalX commented on June 24, 2024

Thanks! I'll take another crack at this tomorrow if I have time.

Do you have guidelines on the formatting, listing, unit test, etc? I see you're using Black and Ruff?

Not yet. All that you need is poetry run black . and poetry run ruff . --fix (of course after poetry install)

from atproto.

MarshalX avatar MarshalX commented on June 24, 2024

fixed in v0.0.18

from atproto.

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.