Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions parcels/compilation/codegenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import math
import random
import warnings
from abc import ABC
from copy import copy

import cgen as c
Expand Down Expand Up @@ -412,7 +411,7 @@ def visit_Assign(self, node):
return node


class KernelGenerator(ABC, ast.NodeVisitor):
class KernelGenerator(ast.NodeVisitor):
"""Code generator class that translates simple Python kernel functions into C functions.

Works by populating and accessing the `ccode` attribute on nodes in the Python AST.
Expand Down
2 changes: 1 addition & 1 deletion parcels/particle.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __init__(self, pclass):
self.variables = [v for v in self.variables if v.is64bit()] + [v for v in self.variables if not v.is64bit()]

def __repr__(self):
return f"PType<{self.name}>::{self.variables}"
return f"{type(self).__name__}(pclass={self.name})"

def __getitem__(self, item):
for v in self.variables:
Expand Down
3 changes: 2 additions & 1 deletion parcels/tools/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@
particles = [repr(pset[i]) for i in range(7)] + ["..."]

out = f"""<{type(pset).__name__}>
fieldset : {pset.fieldset}
fieldset :
{textwrap.indent(repr(pset.fieldset), " " * 8)}

Check warning on line 119 in parcels/tools/_helpers.py

View check run for this annotation

Codecov / codecov/patch

parcels/tools/_helpers.py#L119

Added line #L119 was not covered by tests
pclass : {pset.pclass}
repeatdt : {pset.repeatdt}
# particles: {len(pset)}
Expand Down
5 changes: 5 additions & 0 deletions tests/test_reprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ def test_check_indentation():
assert not valid_indentation(invalid)


def test_particletype_repr():
kwargs = dict(pclass=parcels.JITParticle)
assert_simple_repr(parcels.particle.ParticleType, kwargs)


def test_grid_repr():
"""Test arguments are in the repr of a Grid object"""
kwargs = dict(
Expand Down
Loading