curry.utility.encoding module

Encoding of Curry identifiers.

curry.utility.encoding.best(prefix, thing, disallow, limit=40)[source]

Choose the best name for something.

This is more art than science. Every name must be unique and must be a valid Python identifier. Names should be as short and easy to read as possible. Some context (i.e., the module or package name) is helpful unless the name gets too long. Names need not be deterministic.

curry.utility.encoding.clean(s, dot_as_us=True)[source]

Clean up a string by encoding or removing illegal characters.

curry.utility.encoding.encode(name, prefix='', disallow={})[source]

Encode a Curry name into an alphanumeric identifier.

Parameters:
  • name – The Curry identifier to encode.

  • disallow – A container of disallowed names.

Returns:

A string holding the encoded identifier.

curry.utility.encoding.isaCurryIdentifier(basename)[source]

Indicates whether the given string is a valid Curry identifier. Legal identifiers are 1) strings not beginning with a number where each character is alphanumeric or an underscore; and 2) strings comprising only non-alphanumeric, non-underscore, non-whitespace characters.

curry.utility.encoding.symbolToFilename(name)[source]

Makes the given symbol name into a valid UNIX filename.