schema_salad.utils

Module Contents

Functions

add_dictlist(di, key, val)

aslist(thing)

Wrap single items and lists.

flatten(thing[, ltypes])

onWindows()

convert_to_dict(j4)

json_dump(obj, fp, **kwargs)

Force use of unicode.

json_dumps(obj, **kwargs)

Force use of unicode.

stdout()

Build a replacement for sys.stdout that allow for writing binary data.

yaml_no_ts()

Get a YAML loader that won't parse timestamps into datetime objects.

Attributes

ContextType

DocumentType

DocumentOrStrType

FieldType

MandatoryResolveType

ResolveType

ResolvedRefType

IdxResultType

IdxType

CacheType

FetcherCallableType

AttachmentsType

schema_salad.utils.ContextType
schema_salad.utils.DocumentType
schema_salad.utils.DocumentOrStrType
schema_salad.utils.FieldType
schema_salad.utils.MandatoryResolveType
schema_salad.utils.ResolveType
schema_salad.utils.ResolvedRefType
schema_salad.utils.IdxResultType
schema_salad.utils.IdxType
schema_salad.utils.CacheType
schema_salad.utils.FetcherCallableType
schema_salad.utils.AttachmentsType
schema_salad.utils.add_dictlist(di, key, val)
Parameters:
  • di (Dict[Any, Any]) –

  • key (Any) –

  • val (Any) –

Return type:

None

schema_salad.utils.aslist(thing)

Wrap single items and lists.

Return lists unchanged.

Parameters:

thing (Any) –

Return type:

MutableSequence[Any]

schema_salad.utils.flatten(thing, ltypes=(list, tuple))
Parameters:
  • thing (Any) –

  • ltypes (Any) –

Return type:

Any

schema_salad.utils.onWindows()
Return type:

bool

schema_salad.utils.convert_to_dict(j4)
Parameters:

j4 (Any) –

Return type:

Any

schema_salad.utils.json_dump(obj, fp, **kwargs)

Force use of unicode.

Parameters:
  • obj (Any) –

  • fp (IO[str]) –

  • kwargs (Any) –

Return type:

None

schema_salad.utils.json_dumps(obj, **kwargs)

Force use of unicode.

Parameters:

obj (Any) –

Return type:

str

schema_salad.utils.stdout()

Build a replacement for sys.stdout that allow for writing binary data.

Return type:

io.BufferedWriter

schema_salad.utils.yaml_no_ts()

Get a YAML loader that won’t parse timestamps into datetime objects.

Such datetime objects can’t be easily dumped into JSON.

Return type:

ruamel.yaml.main.YAML