@@ -54,7 +54,7 @@ class Str(Unicode):
5454traits .DictStrStr = DictStrStr
5555
5656
57- class BaseFile (BaseUnicode ):
57+ class File (BaseUnicode ):
5858 """ Defines a trait whose value must be the name of a file.
5959 """
6060
@@ -96,14 +96,11 @@ def __init__(self,
9696 if exists :
9797 self .info_text = 'an existing file name'
9898
99- super (BaseFile , self ).__init__ (value , ** metadata )
99+ super (File , self ).__init__ (value , ** metadata )
100100
101101 def validate (self , object , name , value ):
102- """ Validates that a specified value is valid for this trait.
103-
104- Note: The 'fast validator' version performs this check in C.
105- """
106- validated_value = super (BaseFile , self ).validate (object , name , value )
102+ """ Validates that a specified value is valid for this trait."""
103+ validated_value = super (File , self ).validate (object , name , value )
107104 if not self .exists :
108105 return validated_value
109106 elif os .path .isfile (value ):
@@ -117,53 +114,12 @@ def validate(self, object, name, value):
117114 self .error (object , name , value )
118115
119116
120- class File (BaseFile ):
121- """
122- Defines a trait whose value must be the name of a file.
123- Disables the default C-level fast validator.
124- """
125-
126- def __init__ (self ,
127- value = '' ,
128- filter = None ,
129- auto_set = False ,
130- entries = 0 ,
131- exists = False ,
132- ** metadata ):
133- """ Creates a File trait.
134-
135- Parameters
136- ----------
137- value : string
138- The default value for the trait
139- filter : string
140- A wildcard string to filter filenames in the file dialog box used by
141- the attribute trait editor.
142- auto_set : boolean
143- Indicates whether the file editor updates the trait value after
144- every key stroke.
145- exists : boolean
146- Indicates whether the trait value must be an existing file or
147- not.
148-
149- Default Value
150- -------------
151- *value* or ''
152- """
153- # if not exists:
154- # # Define the C-level fast validator to use:
155- # fast_validate = (11, str)
156-
157- super (File , self ).__init__ (value , filter , auto_set , entries , exists ,
158- ** metadata )
159-
160-
161117# -------------------------------------------------------------------------------
162- # 'BaseDirectory' and ' Directory' traits:
118+ # 'Directory' trait
163119# -------------------------------------------------------------------------------
164120
165121
166- class BaseDirectory (BaseUnicode ):
122+ class Directory (BaseUnicode ):
167123 """
168124 Defines a trait whose value must be the name of a directory.
169125 """
@@ -177,7 +133,7 @@ def __init__(self,
177133 entries = 0 ,
178134 exists = False ,
179135 ** metadata ):
180- """ Creates a BaseDirectory trait.
136+ """ Creates a Directory trait.
181137
182138 Parameters
183139 ----------
@@ -201,13 +157,10 @@ def __init__(self,
201157 if exists :
202158 self .info_text = 'an existing directory name'
203159
204- super (BaseDirectory , self ).__init__ (value , ** metadata )
160+ super (Directory , self ).__init__ (value , ** metadata )
205161
206162 def validate (self , object , name , value ):
207- """ Validates that a specified value is valid for this trait.
208-
209- Note: The 'fast validator' version performs this check in C.
210- """
163+ """ Validates that a specified value is valid for this trait."""
211164 if isinstance (value , (str , bytes )):
212165 if not self .exists :
213166 return value
@@ -222,44 +175,6 @@ def validate(self, object, name, value):
222175 self .error (object , name , value )
223176
224177
225- class Directory (BaseDirectory ):
226- """
227- Defines a trait whose value must be the name of a directory.
228- Disables the default C-level fast validator.
229- """
230-
231- def __init__ (self ,
232- value = '' ,
233- auto_set = False ,
234- entries = 0 ,
235- exists = False ,
236- ** metadata ):
237- """ Creates a Directory trait.
238-
239- Parameters
240- ----------
241- value : string
242- The default value for the trait
243- auto_set : boolean
244- Indicates whether the directory editor updates the trait value
245- after every key stroke.
246- exists : boolean
247- Indicates whether the trait value must be an existing directory or
248- not.
249-
250- Default Value
251- -------------
252- *value* or ''
253- """
254- # Define the C-level fast validator to use if the directory existence
255- # test is not required:
256- # if not exists:
257- # self.fast_validate = (11, str)
258-
259- super (Directory , self ).__init__ (value , auto_set , entries , exists ,
260- ** metadata )
261-
262-
263178# lists of tuples
264179# each element consists of :
265180# - uncompressed (tuple[0]) extension
0 commit comments