Giter Site home page Giter Site logo

bisque's People

Contributors

lmmx avatar pre-commit-ci[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar

bisque's Issues

Introduce Pydantic models to `elements`

Convert object representations of data models to Pydantic data models, using custom classes where necessary (e.g. for str subclasses representing strings that need to be coercible)

Parameterise `.find()` with data models rather than kwargs

The paradigm shift involved with introducing Pydantic could involve changing the form of element addressing.

  • The built tree is used with a find() method that takes a tag name and other kwargs
  • The results of a given find() call are chained to produce nested find()
  • Functional Python is an antipattern (in GvR's informal style guide)
  • Functional Python is also overly verbose and ad-hoc for highly nested tag access
  • Data models can be highly nested and could be used to produce the same result which turns the kwargs into an object representing the nested path

Review I think this is actually already implemented with SoupStrainer?

Make a shallow class interface

To resolve the circular import dependency, put the runtime types in the data model and access them by reference on self rather than directly from the module namespace (requiring lazy import hacks).

Demo in interface-separation-example

  • Introduce type table
  • Factor out all individual classes in clear hierarchical modules

Ensure no plain uses of `AttributeValueWithCharsetSubstitution` after Pydantic conversion

Part of #3 in bisque.element.attributes

The class AttributeValueWithCharsetSubstitution cannot be used on its own (it has no fields). If it's used on its own in the original code, it would create a str because it subclassed it. Now it can only do that if it has a known first field with which to create the __str__ representation.

If you do need to introduce fields, this would effectively prepend fields [thru dataclass inheritance] to the ContentMetaAttributeValue subclass, so that would need to instead inherit a base (i.e. we'd need to duplicate AttributeValueWithCharsetSubstitution_BASE as a base, and then add the field to the regularly named AttributeValueWithCharsetSubstitution so as to preserve its behaviour)

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.