@@ -327,7 +327,7 @@ def _get_valid_stypes(stypes: Union[list[str], set[str]]) -> _List[str]:
327327 """Returns only stypes in allowed list
328328 Fastest if stypes size is small"""
329329 allowed_stypes = ["EST" , "APR" , "NEQ" ]
330- stypes = set (stypes ) if not isinstance (stypes , set ) else stypes
330+ stypes = set (stypes ) if not isinstance (stypes , set ) else stypes # Convert to set if not one.
331331 ok_stypes = sorted (stypes .intersection (allowed_stypes ), key = allowed_stypes .index ) # need EST to always be first
332332 if len (ok_stypes ) != len (stypes ):
333333 not_ok_stypes = stypes .difference (allowed_stypes )
@@ -544,12 +544,17 @@ def _get_snx_vector(
544544 if isinstance (path_or_bytes , str ):
545545 path = path_or_bytes
546546 snx_bytes = _gn_io .common .path2bytes (path )
547- # TODO Removed this very broken code path, not sure what happened
548- # elif isinstance(path_or_bytes, list):
549- # path, stypes, format, verbose = path_or_bytes
550- # snx_bytes = _gn_io.common.path2bytes(path)
551- else :
547+ # Very weird code path, should be removed if possible
548+ elif isinstance (path_or_bytes , list ):
549+ _logging .error (
550+ f"path_or_bytes was a list! Using legacy code path. Please update this! Input values: { path_or_bytes } "
551+ )
552+ path , stypes , format , verbose = path_or_bytes
553+ snx_bytes = _gn_io .common .path2bytes (path )
554+ elif isinstance (path_or_bytes , bytes ):
552555 snx_bytes = path_or_bytes
556+ else :
557+ raise ValueError (f"Unexpected type for path_or_bytes: { type (path_or_bytes )} . Value: { path_or_bytes } " )
553558
554559 if snx_header == {}:
555560 snx_header = _get_snx_header (
@@ -560,7 +565,9 @@ def _get_snx_vector(
560565 "Indices are likely inconsistent between ESTIMATE and APRIORI in the EMR AC files hence files might be parsed incorrectly"
561566 )
562567
568+ _logging .info (f"Passing stypes through SType validator: { stypes } . Input path if available: { path } " )
563569 stypes = _get_valid_stypes (stypes ) # EST is always first as APR may have skips
570+ _logging .info (f"STypes after validator: { stypes } . Input path if available: { path } " )
564571
565572 extracted = _snx_extract (snx_bytes = snx_bytes , stypes = stypes , obj_type = "VECTOR" , verbose = verbose )
566573 if extracted is None :
0 commit comments