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

Pre-Condensation 0 Builder ABC class #461

Closed
wants to merge 2 commits into from
Closed

Pre-Condensation 0 Builder ABC class #461

wants to merge 2 commits into from

Conversation

Gorkowski
Copy link
Collaborator

@Gorkowski Gorkowski commented May 29, 2024

Changes Implemented:

  • BuilderABC Class:
    The BuilderABC class abstracts common methods for building classes into an Abstract Base Class, such as check_keys, set_parameters, pre_build_check, and build. This ensures consistency and reusability across different builder classes. For example, the vapor pressure builder and factory have been updated to utilize BuilderABC, removing code duplication.

  • Input Handling (convert_units):
    The convert_units function in input handling has been improved to manage non-multiplicative unit conversions. An additional parameter value was added to support conversions, such as temperature, which are not simple scaling by multiplication.

Example usage, from the Future, for how mixin's are used to add methods dynamically to builders.

class SurfaceStrategyMolarBuilder(
    BuilderABC,
    BuilderDensityMixin,
    BuilderSurfaceTensionMixin,
    BuilderMolarMassMixin
):
    """Builder class for SurfaceStrategyMolar objects.

    Methods:
    --------
    - set_surface_tension(surface_tension, surface_tension_units): Set the
        surface tension of the particle in N/m. Default units are 'N/m'.
    - set_density(density, density_units): Set the density of the particle in
        kg/m^3. Default units are 'kg/m^3'.
    - set_molar_mass(molar_mass, molar_mass_units): Set the molar mass of the
        particle in kg/mol. Default units are 'kg/mol'.
    - set_parameters(params): Set the parameters of the SurfaceStrategyMolar
        object from a dictionary including optional units.
    - build(): Validate and return the SurfaceStrategyMolar object.
    """

    def __init__(self):
        required_parameters = ['surface_tension', 'density', 'molar_mass']
        BuilderABC.__init__(self, required_parameters)
        BuilderSurfaceTensionMixin.__init__(self)
        BuilderDensityMixin.__init__(self)
        BuilderMolarMassMixin.__init__(self)

Copy link

github-actions bot commented May 29, 2024

PR Preview Action v1.4.7
🚀 Deployed preview to https://uncscode.github.io/particula/pr-preview/pr-461/
on branch gh-pages at 2024-05-29 00:42 UTC

@Gorkowski
Copy link
Collaborator Author

@ngmahfouz <500

@Gorkowski Gorkowski marked this pull request as ready for review May 29, 2024 00:42
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.

@Gorkowski Gorkowski mentioned this pull request May 29, 2024
@Gorkowski Gorkowski enabled auto-merge May 29, 2024 00:59
@Gorkowski Gorkowski requested review from ngmahfouz and ngam May 29, 2024 00:59
@Gorkowski Gorkowski self-assigned this May 29, 2024
@Gorkowski Gorkowski added the next prototype for v1 label May 29, 2024
@Gorkowski Gorkowski added this to the v0.1.0 milestone May 29, 2024
@Gorkowski Gorkowski closed this Jun 8, 2024
auto-merge was automatically disabled June 8, 2024 00:26

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next prototype for v1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant