Skip to content

Commit

Permalink
(#641) Removed last remaining _repr_specification references.
Browse files Browse the repository at this point in the history
This closes with #641.
  • Loading branch information
trevorbaca committed Jul 31, 2017
1 parent 9048106 commit a075ec9
Showing 1 changed file with 19 additions and 34 deletions.
53 changes: 19 additions & 34 deletions abjad/tools/systemtools/StorageFormatAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ def _dispatch_formatting(
as_storage_format=as_storage_format,
)
return list(pieces)
elif not as_storage_format and (
hasattr(self._client, '_repr_specification') or
elif (not as_storage_format and
hasattr(self._client, '_get_format_specification')
):
pieces = self._format_specced_object(
Expand Down Expand Up @@ -303,29 +302,19 @@ def _get_formatting_keywords(self, as_storage_format=True):
kwargs_names = spec.storage_format_kwargs_names
text = spec.storage_format_text
else:
spec = getattr(self._client, '_repr_specification', None)
if spec:
#print('REPR', type(self._client), getattr(self._client, 'name', None))
via = '_repr_specification'
args_values = spec.positional_argument_values
is_bracketed = spec.is_bracketed
is_indented = spec.is_indented
kwargs_names = spec.keyword_argument_names
text = spec.repr_text
else:
spec = self.format_specification
via = '_get_format_specification()'
args_values = spec.repr_args_values
if args_values is None:
args_values = spec.storage_format_args_values
is_bracketed = spec.repr_is_bracketed
is_indented = spec.repr_is_indented
kwargs_names = spec.repr_kwargs_names
if kwargs_names is None:
kwargs_names = spec.storage_format_kwargs_names
text = spec.repr_text
if text is None:
text = spec.storage_format_text
spec = self.format_specification
via = '_get_format_specification()'
args_values = spec.repr_args_values
if args_values is None:
args_values = spec.storage_format_args_values
is_bracketed = spec.repr_is_bracketed
is_indented = spec.repr_is_indented
kwargs_names = spec.repr_kwargs_names
if kwargs_names is None:
kwargs_names = spec.storage_format_kwargs_names
text = spec.repr_text
if text is None:
text = spec.storage_format_text
if kwargs_names is None:
kwargs_names = self.signature_keyword_names
if args_values is None:
Expand Down Expand Up @@ -592,11 +581,7 @@ def get_import_statements(self):
return tuple(sorted(import_statements))

def get_repr_format(self):
assert (
'_repr_specification' in dir(self._client) or
hasattr(self._client, '_repr_specification') or
hasattr(self._client, '_get_format_specification')
)
assert hasattr(self._client, '_get_format_specification')
pieces = self._format_specced_object(
as_storage_format=False,
)
Expand All @@ -606,8 +591,8 @@ def get_repr_keyword_dict(self):
from abjad.tools import systemtools
names = self.specification.repr_kwargs_names
if names is None:
specification = getattr(self.client, '_repr_specification',
systemtools.StorageFormatSpecification(self.client))
specification = systemtools.StorageFormatSpecification(
self.client)
names = specification.keyword_argument_names or ()
keyword_dict = {}
for name in names:
Expand All @@ -618,8 +603,8 @@ def get_repr_positional_values(self):
from abjad.tools import systemtools
values = self.specification.repr_args_values
if values is None:
specification = getattr(self.client, '_repr_specification',
systemtools.StorageFormatSpecification(self.client))
specification = systemtools.StorageFormatSpecification(
self.client)
values = specification.positional_argument_values or ()
return tuple(values)

Expand Down

0 comments on commit a075ec9

Please sign in to comment.