Package: yutils
YutilsA Python utility package written by Yuval Arbelmodule  baseyutils.basemodule  connyutils.connmodule  exceptionsyutils.exceptionsmodule  mlyutils.mlmodule  queriesyutils.queriesmodule  toolsyutils.toolsfunction  match_arabic_nls_langyutils.match_arabic_nls_langmodule  attribute_dictyutils.base.attribute_dictmodule  generic_objectyutils.base.generic_objectmodule  input_checkeryutils.base.input_checkermodule  list_containeryutils.base.list_containermodule  pretty_printeryutils.base.pretty_printermodule  updating_dictyutils.base.updating_dictobject  AttributeDictyutils.base.attribute_dict.AttributeDictobject  GenericObjectyutils.base.generic_object.GenericObjectA generic object you can easily use for your scripts, with a pprint and a str/repr for easy printing


    :param object_name: The name for your object!
    :type object_name: strfunction  dict_to_generic_objectyutils.base.generic_object.dict_to_generic_objectConverts a dictionary (recursively) to a GenericObject, with keys as attributes.

:param dictionary: dictionary to convert (key-values will be converted to attribute-values)
:type dictionary: dict
:param object_name: a name for your new object's type
:type object_name: str
:return: GenericObject objectobject  InputCheckeryutils.base.input_checker.InputCheckerBase object for making a Python object more static-typed.
    It is useful for checking __init__ argument inputs (type and content).

    Type check is defined by _INPUT_TYPES class constant. (see yutils.tools.check_object_type for usage)
    Option check is defined by _INPUT_OPTIONS class constant.

    This also:
        - creates self._inputs as the inputs dict given, as an AttributeDict.
        - adds each input in inputs as an attribute to your object.

    :param inputs: your __init__ inputs, can be anything you wish to check

    :raises: yutils.exceptions.WrongDatatype if any input is not of the specified type, defined by _INPUT_TYPES
             yutils.exceptions.InputError if any input is not one of the options, defined by _INPUT_OPTIONSobject  ListContaineryutils.base.list_container.ListContainerAn object that wraps a list, allowing you to use your object as a list and configure it as you wish.


    :param _list: the original list you wish to keep in the backbone of your object
    :type _list: list
    :param _objects_type: a plural name for your objects in your ListContainer! This is for printing your object.
                          For Example:
                          >>> class Students(ListContainer):
                          >>>     def __init__(self):
                          >>>         super(Students, self).__init__([], 'students')
    :type _objects_type: strobject  PrintableObjectyutils.base.pretty_printer.PrintableObjectAn object you can derive from, that has a pprint method - printing all set attributesobject  DictValueListyutils.base.updating_dict.DictValueListInitialize self.  See help(type(self)) for accurate signature.object  UpdatingDictyutils.base.updating_dict.UpdatingDictInitialize self.  See help(type(self)) for accurate signature.module  sql_connection_detailsyutils.conn.sql_connection_detailsobject  ConnectionDetailsyutils.conn.sql_connection_details.ConnectionDetailsInitialize self.  See help(type(self)) for accurate signature.object  ElasticConnectionDetailsyutils.conn.sql_connection_details.ElasticConnectionDetailsInitialize self.  See help(type(self)) for accurate signature.object  MSSQLConnectionDetailsyutils.conn.sql_connection_details.MSSQLConnectionDetailsInitialize self.  See help(type(self)) for accurate signature.object  MySQLConnectionDetailsyutils.conn.sql_connection_details.MySQLConnectionDetailsInitialize self.  See help(type(self)) for accurate signature.object  OracleConnectionDetailsyutils.conn.sql_connection_details.OracleConnectionDetailsInitialize self.  See help(type(self)) for accurate signature.module  exceptionsyutils.exceptions.exceptionsobject  CodeMistakeyutils.exceptions.exceptions.CodeMistakeGets raised to find mistakes when writing code


    :param mistake_string: an error message explaining why this was raised
    :type mistake_string: strobject  InputErroryutils.exceptions.exceptions.InputErrorGets raised when the input wasn't as expected (e.g. isn't a valid option)


    :param error_string: an error message explaining the InputError
    :type error_string: strobject  MissingAttributeyutils.exceptions.exceptions.MissingAttributeGets raised when an attribute was expected in a certain class


    :param class_object: the object itself that is missing an attribute
    :type class_object: object
    :param attribute_name: the name of the attribute that is missing
    :type attribute_name: strobject  MissingInputyutils.exceptions.exceptions.MissingInputGets raised when an input was expected in a certain class but not received


    :param class_object: the object itself that is missing an attribute
    :type class_object: object
    :param attribute_name: the name of the attribute that is missing
    :type attribute_name: strobject  UncaughtEndCaseyutils.exceptions.exceptions.UncaughtEndCaseGets raised to catch unexpected cases in the future


    :param explanation: an optional string to explain the end case.
                        Default: 'An uncaught end case was found. Check it out!'
    :type explanation: strobject  UserCancellationyutils.exceptions.exceptions.UserCancellationGets raised when a user chooses to cancel an operation, and you wish the program to abort.


    :param operation_name: (optional) the operation the user chose to cancel
    :type operation_name: (optional) strobject  WrongDatatypeyutils.exceptions.exceptions.WrongDatatypeGets raised when something isn't the right datatype as was expected


    :param name: object name
    :type name: str
    :param expectation: expected type
    :type expectation: type or str
    :param reality: the object's actual type
    :type reality: type or strobject  WrongInputDatatypeyutils.exceptions.exceptions.WrongInputDatatypeGets raised when an input argument isn't the right datatype as was expected


    :param name: object name
    :type name: str
    :param expectation: expected type
    :type expectation: type or str
    :param reality: the object's actual type
    :type reality: type or strobject  YutilsExceptionyutils.exceptions.exceptions.YutilsExceptionInitialize self.  See help(type(self)) for accurate signature.module  classificationyutils.ml.classificationmodule  featuresyutils.ml.featuresmodule  linear_regressionyutils.ml.linear_regressionmodule  ml_baseyutils.ml.ml_basemodule  regressionyutils.ml.regressionobject  LogisticRegressionyutils.ml.classification.LogisticRegressionobject  LogisticRegressionOptimizedClassifieryutils.ml.classification.LogisticRegressionOptimizedClassifierobject  MultiClassClassificationyutils.ml.classification.MultiClassClassificationobject  FeatureNormalizeryutils.ml.features.FeatureNormalizerNormalizes features for a ML object

    :param info: info to normalize, across column axis (normalizes each column by different normalization data)
    :type info:object  LinearRegressionyutils.ml.linear_regression.LinearRegressionNot written yet...

    :param training_data:
    :param training_results:
    :param learning_rate:
    :param iterations:
    :param normalize_data:
    :param verbose:object  NormalEquationyutils.ml.linear_regression.NormalEquationNot explained yet...

    :param training_data:
    :param training_results:
    :param assess_for_warning:
    :param verbose:object  MLObjectyutils.ml.ml_base.MLObjectBase object for making a Python object more static-typed.
    It is useful for checking __init__ argument inputs (type and content).

    Type check is defined by _INPUT_TYPES class constant. (see yutils.tools.check_object_type for usage)
    Option check is defined by _INPUT_OPTIONS class constant.

    This also:
        - creates self._inputs as the inputs dict given, as an AttributeDict.
        - adds each input in inputs as an attribute to your object.

    :param inputs: your __init__ inputs, can be anything you wish to check

    :raises: yutils.exceptions.WrongDatatype if any input is not of the specified type, defined by _INPUT_TYPES
             yutils.exceptions.InputError if any input is not one of the options, defined by _INPUT_OPTIONSfunction  create_data_from_text_fileyutils.ml.ml_base.create_data_from_text_fileobject  Regressionyutils.ml.regression.Regressionmodule  db_connectionyutils.queries.db_connectionmodule  oracle_field_list_formatyutils.queries.oracle_field_list_formatmodule  db_connectionyutils.queries.db_connection.db_connectionmodule  fetchersyutils.queries.db_connection.fetchersobject  DBConnectionyutils.queries.db_connection.db_connection.DBConnectionWraps a connection to a DB, for executing SQL queries, using given connection_details.


    :param connection_details: Details for connection to the wanted DB
    :type: connection_details: yutils.conn.sql_connection_details.ConnectionDetails
    :param verbose: If to print warnings or not
    :type verbose: boolmodule  base_fetcheryutils.queries.db_connection.fetchers.base_fetchermodule  elasticyutils.queries.db_connection.fetchers.elasticmodule  mssqlyutils.queries.db_connection.fetchers.mssqlmodule  mysqlyutils.queries.db_connection.fetchers.mysqlmodule  oracleyutils.queries.db_connection.fetchers.oracleobject  ElasticSearchFetcheryutils.queries.db_connection.fetchers.elastic.ElasticSearchFetcherobject  MSSQLFetcheryutils.queries.db_connection.fetchers.mssql.MSSQLFetcherobject  MySQLFetcheryutils.queries.db_connection.fetchers.mysql.MySQLFetcherobject  OracleFetcheryutils.queries.db_connection.fetchers.oracle.OracleFetcherfunction  format_oracle_field_listyutils.queries.oracle_field_list_format.format_oracle_field_listTakes a list that can be more than 999 values long, and wraps them in SQL OR clauses.
This is useful because Oracle can only accept lists 1000 values long.

:param field_name: the name of the column you are querying
:type field_name: str
:param value_list: list of your values to format into the query
:type value_list: list of str

:return: formatted string containing your new WHERE clause
:rtype: unicodemodule  case_conversionsyutils.tools.case_conversionsmodule  filesyutils.tools.filesmodule  listyutils.tools.listmodule  numpy_toolsyutils.tools.numpy_toolsmodule  pretty_printyutils.tools.pretty_printmodule  stryutils.tools.strmodule  xlsx_creatoryutils.tools.xlsx_creatorfunction  check_object_typeyutils.tools.check_object_typeThis checks the types of an object using a certain syntax:
Lets say we have an object_to_check and the types_to_validate.
The object_to_check is the object

:param object_to_check: the object you wish to check its type, and raise an exception should its type not be correct
:type object_to_check: ....that's what we're here for....
:param types_to_validate: defines the wanted types for the object to check:
:type types_to_validate:
            type - checks that object_to_check is of that type
                    Example: float will make sure object_to_check is a float
            list of types - checks that object_to_check is one of the types in the list
                    Example: [int, float] will make sure object_to_check is either an int or a float
            tuple of types - checks hierarchically:
                                checks that object_to_check is of the type of the first item,
                                then checks that each item in object_to_check is of the type of the second item,
                                etc.
                             Remember, all types in the tuple except the last must support indexing.
                    Example: (list, str) will make sure object_to_check is a list of strings
                             (tuple, [int, float]) will make sure object_to_check is a tuple of either ints or floats
            dict - checks that object_to_check is an object. It's type is defined by key 'type',
                   with other keys to be checked as the object's attributes.
                    Example: {'type': Person, 'age': int} will make sure object_to_check is a Person object,
                             with an 'age' attribute that is an int.
            All values can have as many recursive dimensions as wanted.
:param input_name: Do not use, this is for recursive inner use.

More examples
Lets say we create:

integer = 13
unicode_str = u'foo'
int_list = list(range(10))
input_object = MyObject()
input_object.num = 3
input_object.lis = [1, 'bar']
input_object.3dlist = [[(1, 2, 3), (1, 1, 1)], [('a', 'b', 'c'), [7, 8, 9]]]

We can send:
check_object_type(integer, int)
check_object_type(unicode_str, unicode)
check_object_type(int_list, (list, int))
check_object_type(input_object, {'type': MyObject,
                                 'num': int,
                                 'lis': (list, [int, str]),
                                 '3dlist': (list, list, [tuple, list], [int, str, unicode])
                                 })

:raises:
         Because of invalid inputs:
            yutils.exceptions.CodeMistake - When no 'type' key is found (for when types_to_validate is a dict)
            yutils.exceptions.WrongDatatype - When no type type is found when isinstance-ing an object's type
         Exceptions raised by check:
            yutils.exceptions.WrongInputDatatype - When the type is not correct during validation
            yutils.exceptions.MissingInput - When an attribute is missing (for when types_to_validate is a dict)function  equivilenceyutils.tools.equivilenceDivides an iterator to groups, based on the function's result of every item in the iterator.
Returns dict of lists.

Example:
    >>> equivilence(range(10), lambda x: x % 3)
    >>>out>>> {0: [0, 3, 6, 9],
    >>>out>>>  1: [1, 4, 7],
    >>>out>>>  2: [2, 5, 8]}

:param iterator: an iterator you wish to run on and divide into groups
:type iterator: iterator
:param func: a function to activate on each iterator item - its result decides the return dict's keys.
:type func: function

:rtype: dict of lists (lists are groups of original iterator)function  camel_back_to_snake_caseyutils.tools.case_conversions.camel_back_to_snake_caseTurns a camelBack word to a snake_case word

:param camel_back_word: wordInCamelCase
:return: a_word_in_snake_casefunction  camel_case_to_snake_caseyutils.tools.case_conversions.camel_case_to_snake_caseTurns a CamelCase word to a snake_case word

:param camel_case_word: AWordInCamelCase
:return: a_word_in_snake_casefunction  snake_case_to_camel_backyutils.tools.case_conversions.snake_case_to_camel_backTurns a snake_case word to a camelBack word

:param snake_case_word: a_word_in_snake_case
:return: wordInCamelCasefunction  snake_case_to_camel_caseyutils.tools.case_conversions.snake_case_to_camel_caseTurns a snake_case word to a CamelCase word

:param snake_case_word: a_word_in_snake_case
:return: AWordInCamelCasefunction  get_file_lengthyutils.tools.files.get_file_lengthThis function gets a file path and returns its length without reading it

:param file_path: path to return length of
:type file_path: str
:return: file length (in bytes)
:rtype: intfunction  recursive_globyutils.tools.files.recursive_globReturns a list of all files in directory including sub-directories.

:param dir_name: Dir name to glob recursively on
:type dir_name: str
:param ignore_hidden: if to ignore hidden files (that start with '.')
:type ignore_hidden: bool

:return: list of all files in the dir_name
:rtype: list of strfunction  save_fileyutils.tools.files.save_fileThis function saves the file content to the destination dir (defaulted to ".") as base_name + extension,
but adds a counter if needed.

:param content: the content of the file
:type content: str
:param file_base_name: the future file name without extension
:type file_base_name: str
:param extension: the file name extension (for example: 'xlsx')
:type extension: str
:param dest_dir: where to save the file
                 Default: current directory
:type dest_dir: str

:return: full file path file was saved to
:rtype: unicodefunction  make_listyutils.tools.list.make_listfunction  repr_listyutils.tools.list.repr_listReturns an iterator as a string, representing the list.
:param iterator: the iterator you wish to represent as a list
:type iterator: iterator
:return: representation of your iterator as a list
:rtype: unicodefunction  get_indices_containing_all_substringsyutils.tools.numpy_tools.get_indices_containing_all_substringsfunction  is_iterableyutils.tools.numpy_tools.is_iterablefunction  magicyutils.tools.numpy_tools.magicImplementation taken from https://stackoverflow.com/questions/47834140/numpy-equivalent-of-matlabs-magic
from user: user6655984function  normalize_arrayyutils.tools.numpy_tools.normalize_arrayfunction  r2cyutils.tools.numpy_tools.r2cfunction  to_arrayyutils.tools.numpy_tools.to_arrayfunction  pprint_dictyutils.tools.pretty_print.pprint_dictPrints a dict in a very pretty way!

:param dictionary: your dict to print
:type dictionary: dict
:param long_value_limit: when a dict value exceeds this limit, it won't be printed
                         Default: 120
:type long_value_limit: int
:param long_value_filler: A filler to print instead of a long value, must have {type} and {length} fields!
                          Default: '<Long {type} object with repr length {length}>'
:type long_value_filler: str
:return: Nonefunction  pprint_listyutils.tools.pretty_print.pprint_listPrints a list in an easy, short way.

:param list_to_print: the list you wish to print
:type list_to_print: list
:return: Nonefunction  turn_numericyutils.tools.str.turn_numericTurns a string into either an int or a float

:param string: a string to assess
:type string: str

:rtype: str or float

:raises: TypeError if no type was foundobject  XLSXCreatoryutils.tools.xlsx_creator.XLSXCreatorA class to create an XLSX file from a table.
    It will format the table inside an actual excel's table, according to each field's width.

    :param headers: The fields of the table (headers)
    :type headers: list of unicode
    :param table: The table
    :type table: matrix - list of lists of the same lengths (cells may be any datatype)
    :param output_path: The path where to save the excel
    :type output_path: unicodefunction  create_xlsxyutils.tools.xlsx_creator.create_xlsxCreates an XLSX file from a table.
It will format the table inside an actual excel's table, according to each field's width.

:param headers: The fields of the table (headers)
:type headers: list of unicode
:param table: The table
:type table: matrix - list of lists of the same lengths (cells may be any datatype)
:param output_path: The path where to save the excel
:type output_path: unicodefunction  get_next_columnyutils.tools.xlsx_creator.get_next_columnfunction  get_next_letteryutils.tools.xlsx_creator.get_next_letterfunction  table_to_stryutils.tools.xlsx_creator.table_to_strmatrix good for the function xlsxwriter.Worksheet.add_table(['data': table))
:param table: matrix - list of lists of the same lengths (cells may be any datatype)
:return: fully string matrix