File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,23 +119,18 @@ private static int GetFieldSizeLimit(CodeContext/*!*/ context) {
119119
120120 [ Documentation ( @"Delete the name/dialect mapping associated with a string name.\n
121121 csv.unregister_dialect(name)" ) ]
122- public static void unregister_dialect ( CodeContext /*!*/ context ,
123- string name ) {
122+ public static void unregister_dialect ( CodeContext /*!*/ context , string name ) {
124123 DialectRegistry dialects = GetDialects ( context ) ;
125- if ( name == null || ! dialects . ContainsKey ( name ) )
126- throw MakeError ( "unknown dialect" ) ;
127-
128- if ( dialects . ContainsKey ( name ) )
129- dialects . Remove ( name ) ;
124+ if ( name is not null && dialects . Remove ( name ) ) return ;
125+ throw MakeError ( "unknown dialect" ) ;
130126 }
131127
132128 [ Documentation ( @"Return the dialect instance associated with name.
133129 dialect = csv.get_dialect(name)" ) ]
134130 public static object get_dialect ( CodeContext /*!*/ context , string name ) {
135131 DialectRegistry dialects = GetDialects ( context ) ;
136- if ( name == null || ! dialects . ContainsKey ( name ) )
137- throw MakeError ( "unknown dialect" ) ;
138- return dialects [ name ] ;
132+ if ( name is not null && dialects . TryGetValue ( name , out var value ) ) return value ;
133+ throw MakeError ( "unknown dialect" ) ;
139134 }
140135
141136 [ Documentation ( @"Return a list of all know dialect names
You can’t perform that action at this time.
0 commit comments