@@ -51,27 +51,27 @@ def _canonical_name(alias):
5151 alias_to_canonical .update ({pname : pname for pname in _COMPILERS })
5252 return alias_to_canonical .get (alias , None )
5353
54- def _get_compiler (compiler_name ):
54+ def _get_compiler (category ):
5555 """
56- _get_compiler must only be used after the compilers have been
56+ _get_compiler must only be used after the CategoryCompilers have been
5757 registered. It will automatically create a compiler for any unknown
58- ``compiler_name .``
58+ ``category .``
5959 """
60- if compiler_name is None :
60+ if category is None :
6161 if None not in _COMPILERS :
6262 _COMPILERS [None ] = CategoryCompiler (None , None )
6363 return _COMPILERS [None ]
6464
65- canonical_name = _canonical_name (compiler_name )
65+ canonical_name = _canonical_name (category )
6666 # create a new compiler if none exists
6767 if canonical_name is None :
68- canonical_name = compiler_name
69- _COMPILERS [compiler_name ] = CategoryCompiler (None , compiler_name )
68+ canonical_name = category
69+ _COMPILERS [category ] = CategoryCompiler (None , category )
7070 return _COMPILERS [canonical_name ]
7171
7272def _register_compiler_plugin (plugin ):
7373 DUPLICATE_ERROR = CategoryCompilerRegistrationError (
74- f"The name { plugin .name } has been reserved by another compiler "
74+ f"The category ' { plugin .name } ' has been reserved by another plugin "
7575 )
7676 if plugin .name in _COMPILERS or plugin .name in _ALIASES :
7777 raise DUPLICATE_ERROR
@@ -93,15 +93,15 @@ def _register_compiler_plugin(plugin):
9393# the loading of the compiler by using a proxy object.
9494
9595class _CategoryCompilerProxy :
96- def __init__ (self , compiler_name ):
97- self .compiler_name = compiler_name
96+ def __init__ (self , category ):
97+ self .category = category
9898
9999 @property
100100 def _proxy (self ):
101- canonical_name = _canonical_name (self .compiler_name )
101+ canonical_name = _canonical_name (self .category )
102102 if canonical_name is None :
103- raise RuntimeError ("No compiler registered for "
104- f"'{ self .compiler_name } '" )
103+ raise RuntimeError ("No CategoryCompiler registered for "
104+ f"'{ self .category } '" )
105105 return _get_compiler (canonical_name )
106106
107107 @property
@@ -111,17 +111,17 @@ def named_objs(self):
111111 def __call__ (self , * args , ** kwargs ):
112112 return self ._proxy (* args , ** kwargs )
113113
114- def compiler_for (compiler_name ):
114+ def compiler_for (category ):
115115 """Delayed compiler calling.
116116
117117 Use this when you need to use a compiler as the loader for a parameter.
118118
119119 Parameters
120120 ----------
121- compiler_name : str
122- the name of the compiler to use
121+ category : str
122+ the category to use (:class:`.CategoryCompiler` name or alias)
123123 """
124- return _CategoryCompilerProxy (compiler_name )
124+ return _CategoryCompilerProxy (category )
125125
126126
127127### Registering builder plugins and user-facing register_plugins ###########
@@ -143,7 +143,7 @@ def _get_registration_names(plugin):
143143 return ordered_names
144144
145145def _register_builder_plugin (plugin ):
146- compiler = _get_compiler (plugin .compiler_name )
146+ compiler = _get_compiler (plugin .category )
147147 for name in _get_registration_names (plugin ):
148148 compiler .register_builder (plugin , name )
149149
0 commit comments