Skip to content

Commit

Permalink
Rename UserType->CustomType
Browse files Browse the repository at this point in the history
  • Loading branch information
drdavella committed Jul 25, 2017
1 parent 2b90d9e commit a813f6c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions asdf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# ----------------------------------------------------------------------------

if _ASDF_SETUP_ is False:
__all__ = ['AsdfFile', 'UserType', 'AsdfExtension',
__all__ = ['AsdfFile', 'CustomType', 'AsdfExtension',
'Stream', 'open', 'test', 'commands',
'ValidationError']

Expand All @@ -35,7 +35,7 @@
raise ImportError("asdf requires numpy")

from .asdf import AsdfFile
from .asdftypes import UserType
from .asdftypes import CustomType
from .extension import AsdfExtension
from .stream import Stream
from . import commands
Expand Down
2 changes: 1 addition & 1 deletion asdf/asdftypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ class AsdfType(ExtensionType):

@six.add_metaclass(ExtensionTypeMeta)
@six.add_metaclass(util.InheritDocstrings)
class UserType(ExtensionType):
class CustomType(ExtensionType):
"""
Base class for all user-defined types. Unlike classes that inherit
AsdfType, classes that inherit this class will *not* automatically be added
Expand Down
4 changes: 2 additions & 2 deletions asdf/tests/test_asdftypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def __init__(self, c=None, d=None):
self.c = c
self.d = d

class CustomFlowType(asdftypes.UserType):
class CustomFlowType(asdftypes.CustomType):
version = '1.1.0'
name = 'custom_flow'
organization = 'nowhere.org'
Expand Down Expand Up @@ -331,7 +331,7 @@ def __init__(self, c=None, d=None):
self.c = c
self.d = d

class CustomFlowType(asdftypes.UserType):
class CustomFlowType(asdftypes.CustomType):
version = '1.1.0'
supported_versions = [(1,0,0), (1,1,0)]
name = 'custom_flow'
Expand Down
8 changes: 4 additions & 4 deletions docs/asdf/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Supporting new types in asdf is easy. There are three pieces needed:

1. A YAML Schema file for each new type.

2. A Python class (inheriting from `asdf.UserType`) for each new
2. A Python class (inheriting from `asdf.CustomType`) for each new
user-defined type.

3. A Python class to define an "extension" to ASDF, which is a set of
Expand Down Expand Up @@ -33,7 +33,7 @@ First, the YAML Schema, defining the type as a pair of integers:
maxItems: 2
...
Then, the Python implementation. See the `asdf.UserType` and
Then, the Python implementation. See the `asdf.CustomType` and
`asdf.AsdfExtension` documentation for more information::

import os
Expand All @@ -43,7 +43,7 @@ Then, the Python implementation. See the `asdf.UserType` and

import fractions

class FractionType(asdf.UserType):
class FractionType(asdf.CustomType):
name = 'fraction'
organization = 'nowhere.org'
version = (1, 0, 0)
Expand Down Expand Up @@ -83,7 +83,7 @@ values in an ASDF file. This feature is used internally so a schema
can specify the required datatype of an array.

To support custom validation keywords, set the ``validators`` member
of a ``UserType`` subclass to a dictionary where the keys are the
of a ``CustomType`` subclass to a dictionary where the keys are the
validation keyword name and the values are validation functions. The
validation functions are of the same form as the validation functions
in the underlying ``jsonschema`` library, and are passed the following
Expand Down

0 comments on commit a813f6c

Please sign in to comment.