Welcome to genutils’s documentation!

Contents:

Release Notes

**Release 0.3.0

  • module numbers renamed to tbnumbers
  • property based tests added

Release 0.2.0a1

  • New module numbers.
  • numbers.is_odd()
  • numbers.is_even()

Release 0.1.3

  • Set up Documentation.
  • Package structure simplified.

Release 0.1.1

  • Set up Travis.

Release 0.1

First small step.

  • Basic functions for handling of string / bytes encodings.

API Reference

genutils.strings

Some functions helping with string encoding and decoding.

genutils.strings.to_bytes(str_or_bytes, encoding='utf-8)')[source]

Take argument and return as bytes.

Parameters:
  • str_or_bytes (str or bytes) – argument to encode.
  • encoding – the encoding to use if argument is of type str
Returns:

argument as bytes

Return type:

bytes

genutils.strings.to_str(str_or_bytes, encoding='utf-8')[source]

Take argument and return as unicode string.

Parameters:
  • str_or_bytes (str or bytes) – argument to decode.
  • encoding – the encoding to use if argument is of type bytes
Returns:

argument as unicode string.

Return type:

str

genutils.tbnumbers

Some utilities related to numbers.

genutils.tbnumbers.is_even(num)[source]

Is num even?

Parameters:num (int) – number to check.
Returns:True if num is even.
Return type:boolean
Raises:TypeError if num is not an int.
genutils.tbnumbers.is_odd(num)[source]

Is num odd?

Parameters:num (int) – number to check.
Returns:True if num is odd.
Return type:boolean
Raises:TypeError if num is not an int.

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2015 Stefan Braun

Indices and tables