Commit 60364e1e authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Removed mi default defaults. #313

parent 6dee8979
Pipeline #72475 passed with stages
in 34 minutes and 24 seconds
......@@ -82,27 +82,27 @@ class KeycloakAuthenticator(bravado_requests_client.Authenticator):
class ApiStatistics(mi.MSection):
nentries = mi.Quantity(
type=int,
type=int, default=0,
description='Number queries entries')
last_response_nentries = mi.Quantity(
type=int,
type=int, default=0,
description='Number of entries loaded in the last api call')
last_response_data_size = mi.Quantity(
type=int, unit=mi.units.bytes,
type=int, unit=mi.units.bytes, default=0,
description='Bytes loaded in the last api call')
loaded_data_size = mi.Quantity(
type=int, unit=mi.units.bytes,
type=int, unit=mi.units.bytes, default=0,
description='Bytes loaded from this query')
loaded_nentries = mi.Quantity(
type=int,
type=int, default=0,
description='Number of downloaded entries')
napi_calls = mi.Quantity(
type=int,
type=int, default=0,
description='Number of made api calls')
def __repr__(self):
......
......@@ -441,7 +441,7 @@ class EntryMetadata(metainfo.MSection):
a_search=Search(many_and='append', derived=_only_atoms))
n_atoms = metainfo.Quantity(
type=int, categories=[DomainMetadata],
type=int, categories=[DomainMetadata], default=0,
description='The number of atoms in the entry\'s material',
a_search=Search())
......
......@@ -189,20 +189,20 @@ class DFTMetadata(MSection):
a_search=Search())
n_geometries = Quantity(
type=int, description='Number of unique geometries.',
type=int, default=0, description='Number of unique geometries.',
a_search=Search(metric_name='geometries', metric='sum'))
n_calculations = Quantity(
type=int,
type=int, default=0,
description='Number of single configuration calculation sections',
a_search=Search(metric_name='calculations', metric='sum'))
n_total_energies = Quantity(
type=int, description='Number of total energy calculations',
type=int, default=0, description='Number of total energy calculations',
a_search=Search(metric_name='total_energies', metric='sum'))
n_quantities = Quantity(
type=int, description='Number of metainfo quantities parsed from the entry.',
type=int, default=0, description='Number of metainfo quantities parsed from the entry.',
a_search=Search(metric='sum', metric_name='quantities'))
quantities = Quantity(
......
......@@ -110,7 +110,7 @@ class OptimadeEntry(MSection):
''')
nelements = Quantity(
type=int,
type=int, default=0,
links=optimade_links('h.6.2.2'),
a_search=Search(),
a_optimade=Optimade(query=True, entry=True),
......@@ -200,7 +200,7 @@ class OptimadeEntry(MSection):
''')
nsites = Quantity(
type=int,
type=int, default=0,
links=optimade_links('h.6.2.11'),
a_search=Search(),
a_optimade=Optimade(query=True, entry=True), description='''
......
......@@ -1810,15 +1810,6 @@ class Quantity(Property):
if self.synonym_for is not None:
self._synonym = self.m_parent.all_quantities[self.synonym_for]
if self.type == int and self.is_scalar and self.default is None:
self.default = 0
if self.type == float and self.is_scalar and self.default is None:
self.default = 0.0
if self.type == bool and self.is_scalar and self.default is None:
self.default = False
# replace the quantity implementation with an optimized version for the most
# primitive quantities if applicable
is_primitive = not self.synonym_for and not self.derived
......
......@@ -602,16 +602,16 @@ class TestM1:
assert copy.systems[0].m_parent_index == 0
assert copy.systems[0].m_parent_sub_section is run.systems[0].m_parent_sub_section
def test_default_defaults(self):
def test_not_default_defaults(self):
class TestSection(MSection):
int_quantity = Quantity(type=int)
float_quantity = Quantity(type=float)
bool_quantity = Quantity(type=bool)
section = TestSection()
assert section.int_quantity == 0
assert section.float_quantity == 0.0
assert section.bool_quantity is False
assert section.int_quantity is None
assert section.float_quantity is None
assert section.bool_quantity is None
class TestDatatypes:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment