Skip to content

BUG: Messy print statements #36

@fletchapin

Description

@fletchapin
  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of wwtp_configuration.


Description

I tried to set up intelligent __repr__() functions in every class, but the new lines are not organized well. As a result, the print statements using the package are very messy.

Expected Behavior

The print statement should represent the cleanest possible text equivalent of the configuration graph.

Reproduction

>>> json_path= tests/data/node.json
>>> print(JSONParser(json_path).initialize_network())
<wwtp_configuration.node.Network id:ParentNetwork input_contents:None output_contents:None tags:{} nodes:{'WWTP': <wwtp_configuration.node.Facility id:WWTP input_contents:ContentsType.UntreatedSewage output_contents:ContentsType.TreatedSewage elevation:1 meter flow_rate:(None, <Quantity(68, 'MGD')>, <Quantity(24, 'MGD')>) tags:{} nodes:{'Digester': <wwtp_configuration.node.Digestion id:Digester input_contents:[<ContentsType.WasteActivatedSludge: 12>, <ContentsType.PrimarySludge: 10>] output_contents:ContentsType.Biogas num_units:2 volume:None flow_rate:(None, None, None) digester_type:DigesterType.Anaerobic tags:{'Digester1Level': <wwtp_configuration.utils.Tag id:Digester1Level units:gallon tag_type:TagType.Level source_unit_id:1 dest_unit_id:None totalized:False contents:ContentsType.SludgeBlend>
, 'Digester2Level': <wwtp_configuration.utils.Tag id:Digester2Level units:gallon tag_type:TagType.Level source_unit_id:2 dest_unit_id:None totalized:False contents:ContentsType.SludgeBlend>
}>
, 'Cogenerator': <wwtp_configuration.node.Cogeneration id:Cogenerator input_contents:[<ContentsType.Biogas: 6>, <ContentsType.NaturalGas: 7>] output_contents:[<ContentsType.Biogas: 6>, <ContentsType.NaturalGas: 7>] num_units:1 gen_capacity:(None, None, None) tags:{}>
} connections:{'GasToCogen': <wwtp_configuration.connection.Pipe id:GasToCogen contents:ContentsType.Biogas source:Digester destination:Cogenerator flow_rate:(None, None, None) pressure:(None, None, None) heating_values:(<Quantity(600, 'british_thermal_unit / foot ** 3')>, <Quantity(700, 'british_thermal_unit / foot ** 3')>) diameter:None friction_coeff:None tags:{'CombinedDigesterGasFlow': <wwtp_configuration.utils.Tag id:CombinedDigesterGasFlow units:foot ** 3 / minute tag_type:TagType.Flow source_unit_id:total dest_unit_id:total totalized:False contents:ContentsType.Biogas>
} bidirectional:False exit_point:None entry_point:None>
}>
, 'PowerGrid': <wwtp_configuration.node.Network id:PowerGrid input_contents:[<ContentsType.Electricity: 18>, <ContentsType.NaturalGas: 7>] output_contents:[<ContentsType.Electricity: 18>, <ContentsType.NaturalGas: 7>] tags:{} nodes:{} connections:{}>
} connections:{'ElectricityToWWTP': <wwtp_configuration.connection.Wire id:ElectricityToWWTP contents:ContentsType.Electricity source:PowerGrid destination:WWTP tags:{'GridElectricityConsumption': <wwtp_configuration.utils.Tag id:GridElectricityConsumption units:hour * kilowatt tag_type:TagType.Flow source_unit_id:total dest_unit_id:total totalized:False contents:ContentsType.Electricity>
} bidirectional:False exit_point:None entry_point:None>
}>

Environment

Ubuntu 20.04 with latest version of wwtp-configuration

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageStill needs to be assigned to the correct party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions