# Yutils
>A Python utility package written by Yuval Arbel
## module base
>yutils.base
## module conn
>yutils.conn
## module exceptions
>yutils.exceptions
## module ml
>yutils.ml
## module queries
>yutils.queries
## module tools
>yutils.tools
## function match_arabic_nls_lang
>yutils.match_arabic_nls_lang
### module attribute_dict
>yutils.base.attribute_dict
### module generic_object
>yutils.base.generic_object
### module input_checker
>yutils.base.input_checker
### module list_container
>yutils.base.list_container
### module pretty_printer
>yutils.base.pretty_printer
### module updating_dict
>yutils.base.updating_dict
#### object AttributeDict
>yutils.base.attribute_dict.AttributeDict
#### object GenericObject
>yutils.base.generic_object.GenericObject
A 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: str
#### function dict_to_generic_object
>yutils.base.generic_object.dict_to_generic_object
Converts 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 object
#### object InputChecker
>yutils.base.input_checker.InputChecker
Base 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_OPTIONS
#### object ListContainer
>yutils.base.list_container.ListContainer
An 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: str
#### object PrintableObject
>yutils.base.pretty_printer.PrintableObject
An object you can derive from, that has a pprint method - printing all set attributes
#### object DictValueList
>yutils.base.updating_dict.DictValueList
Initialize self. See help(type(self)) for accurate signature.
#### object UpdatingDict
>yutils.base.updating_dict.UpdatingDict
Initialize self. See help(type(self)) for accurate signature.
### module sql_connection_details
>yutils.conn.sql_connection_details
#### object ConnectionDetails
>yutils.conn.sql_connection_details.ConnectionDetails
Initialize self. See help(type(self)) for accurate signature.
#### object ElasticConnectionDetails
>yutils.conn.sql_connection_details.ElasticConnectionDetails
Initialize self. See help(type(self)) for accurate signature.
#### object MSSQLConnectionDetails
>yutils.conn.sql_connection_details.MSSQLConnectionDetails
Initialize self. See help(type(self)) for accurate signature.
#### object MySQLConnectionDetails
>yutils.conn.sql_connection_details.MySQLConnectionDetails
Initialize self. See help(type(self)) for accurate signature.
#### object OracleConnectionDetails
>yutils.conn.sql_connection_details.OracleConnectionDetails
Initialize self. See help(type(self)) for accurate signature.
### module exceptions
>yutils.exceptions.exceptions
#### object CodeMistake
>yutils.exceptions.exceptions.CodeMistake
Gets raised to find mistakes when writing code
:param mistake_string: an error message explaining why this was raised
:type mistake_string: str
#### object InputError
>yutils.exceptions.exceptions.InputError
Gets 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: str
#### object MissingAttribute
>yutils.exceptions.exceptions.MissingAttribute
Gets 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: str
#### object MissingInput
>yutils.exceptions.exceptions.MissingInput
Gets 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: str
#### object UncaughtEndCase
>yutils.exceptions.exceptions.UncaughtEndCase
Gets 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: str
#### object UserCancellation
>yutils.exceptions.exceptions.UserCancellation
Gets 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) str
#### object WrongDatatype
>yutils.exceptions.exceptions.WrongDatatype
Gets 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 str
#### object WrongInputDatatype
>yutils.exceptions.exceptions.WrongInputDatatype
Gets 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 str
#### object YutilsException
>yutils.exceptions.exceptions.YutilsException
Initialize self. See help(type(self)) for accurate signature.
### module classification
>yutils.ml.classification
### module features
>yutils.ml.features
### module linear_regression
>yutils.ml.linear_regression
### module ml_base
>yutils.ml.ml_base
### module regression
>yutils.ml.regression
#### object LogisticRegression
>yutils.ml.classification.LogisticRegression
#### object LogisticRegressionOptimizedClassifier
>yutils.ml.classification.LogisticRegressionOptimizedClassifier
#### object MultiClassClassification
>yutils.ml.classification.MultiClassClassification
#### object FeatureNormalizer
>yutils.ml.features.FeatureNormalizer
Normalizes features for a ML object
:param info: info to normalize, across column axis (normalizes each column by different normalization data)
:type info:
#### object LinearRegression
>yutils.ml.linear_regression.LinearRegression
Not written yet...
:param training_data:
:param training_results:
:param learning_rate:
:param iterations:
:param normalize_data:
:param verbose:
#### object NormalEquation
>yutils.ml.linear_regression.NormalEquation
Not explained yet...
:param training_data:
:param training_results:
:param assess_for_warning:
:param verbose:
#### object MLObject
>yutils.ml.ml_base.MLObject
Base 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_OPTIONS
#### function create_data_from_text_file
>yutils.ml.ml_base.create_data_from_text_file
#### object Regression
>yutils.ml.regression.Regression
### module db_connection
>yutils.queries.db_connection
### module oracle_field_list_format
>yutils.queries.oracle_field_list_format
#### module db_connection
>yutils.queries.db_connection.db_connection
#### module fetchers
>yutils.queries.db_connection.fetchers
##### object DBConnection
>yutils.queries.db_connection.db_connection.DBConnection
Wraps 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: bool
##### module base_fetcher
>yutils.queries.db_connection.fetchers.base_fetcher
##### module elastic
>yutils.queries.db_connection.fetchers.elastic
##### module mssql
>yutils.queries.db_connection.fetchers.mssql
##### module mysql
>yutils.queries.db_connection.fetchers.mysql
##### module oracle
>yutils.queries.db_connection.fetchers.oracle
###### object ElasticSearchFetcher
>yutils.queries.db_connection.fetchers.elastic.ElasticSearchFetcher
###### object MSSQLFetcher
>yutils.queries.db_connection.fetchers.mssql.MSSQLFetcher
###### object MySQLFetcher
>yutils.queries.db_connection.fetchers.mysql.MySQLFetcher
###### object OracleFetcher
>yutils.queries.db_connection.fetchers.oracle.OracleFetcher
#### function format_oracle_field_list
>yutils.queries.oracle_field_list_format.format_oracle_field_list
Takes 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: unicode
### module case_conversions
>yutils.tools.case_conversions
### module files
>yutils.tools.files
### module list
>yutils.tools.list
### module numpy_tools
>yutils.tools.numpy_tools
### module pretty_print
>yutils.tools.pretty_print
### module str
>yutils.tools.str
### module xlsx_creator
>yutils.tools.xlsx_creator
### function check_object_type
>yutils.tools.check_object_type
This 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 equivilence
>yutils.tools.equivilence
Divides 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_case
>yutils.tools.case_conversions.camel_back_to_snake_case
Turns a camelBack word to a snake_case word
:param camel_back_word: wordInCamelCase
:return: a_word_in_snake_case
#### function camel_case_to_snake_case
>yutils.tools.case_conversions.camel_case_to_snake_case
Turns a CamelCase word to a snake_case word
:param camel_case_word: AWordInCamelCase
:return: a_word_in_snake_case
#### function snake_case_to_camel_back
>yutils.tools.case_conversions.snake_case_to_camel_back
Turns a snake_case word to a camelBack word
:param snake_case_word: a_word_in_snake_case
:return: wordInCamelCase
#### function snake_case_to_camel_case
>yutils.tools.case_conversions.snake_case_to_camel_case
Turns a snake_case word to a CamelCase word
:param snake_case_word: a_word_in_snake_case
:return: AWordInCamelCase
#### function get_file_length
>yutils.tools.files.get_file_length
This 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: int
#### function recursive_glob
>yutils.tools.files.recursive_glob
Returns 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 str
#### function save_file
>yutils.tools.files.save_file
This 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: unicode
#### function make_list
>yutils.tools.list.make_list
#### function repr_list
>yutils.tools.list.repr_list
Returns 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: unicode
#### function get_indices_containing_all_substrings
>yutils.tools.numpy_tools.get_indices_containing_all_substrings
#### function is_iterable
>yutils.tools.numpy_tools.is_iterable
#### function magic
>yutils.tools.numpy_tools.magic
Implementation taken from https://stackoverflow.com/questions/47834140/numpy-equivalent-of-matlabs-magic
from user: user6655984
#### function normalize_array
>yutils.tools.numpy_tools.normalize_array
#### function r2c
>yutils.tools.numpy_tools.r2c
#### function to_array
>yutils.tools.numpy_tools.to_array
#### function pprint_dict
>yutils.tools.pretty_print.pprint_dict
Prints 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: None
#### function pprint_list
>yutils.tools.pretty_print.pprint_list
Prints a list in an easy, short way.
:param list_to_print: the list you wish to print
:type list_to_print: list
:return: None
#### function turn_numeric
>yutils.tools.str.turn_numeric
Turns 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 found
#### object XLSXCreator
>yutils.tools.xlsx_creator.XLSXCreator
A 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: unicode
#### function create_xlsx
>yutils.tools.xlsx_creator.create_xlsx
Creates 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: unicode
#### function get_next_column
>yutils.tools.xlsx_creator.get_next_column
#### function get_next_letter
>yutils.tools.xlsx_creator.get_next_letter
#### function table_to_str
>yutils.tools.xlsx_creator.table_to_str
matrix 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
Raw data
{
"_id": null,
"home_page": "https://github.com/yuvalarbel",
"name": "yutils",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "utils,utilities,queries,ml,tools",
"author": "Yuval Arbel",
"author_email": "yuval@arbels.net",
"download_url": "https://files.pythonhosted.org/packages/43/55/7db28d26eb899d8ed4106c4f73d23b0bd3f86c885f4ce47413264d843af5/yutils-1.4.0.tar.gz",
"platform": null,
"description": "# Yutils\n>A Python utility package written by Yuval Arbel\n\n## module base\n>yutils.base\n\n## module conn\n>yutils.conn\n\n## module exceptions\n>yutils.exceptions\n\n## module ml\n>yutils.ml\n\n## module queries\n>yutils.queries\n\n## module tools\n>yutils.tools\n\n## function match_arabic_nls_lang\n>yutils.match_arabic_nls_lang\n\n### module attribute_dict\n>yutils.base.attribute_dict\n\n### module generic_object\n>yutils.base.generic_object\n\n### module input_checker\n>yutils.base.input_checker\n\n### module list_container\n>yutils.base.list_container\n\n### module pretty_printer\n>yutils.base.pretty_printer\n\n### module updating_dict\n>yutils.base.updating_dict\n\n#### object AttributeDict\n>yutils.base.attribute_dict.AttributeDict\n\n\n\n#### object GenericObject\n>yutils.base.generic_object.GenericObject\n\n A generic object you can easily use for your scripts, with a pprint and a str/repr for easy printing\n \n\n :param object_name: The name for your object!\n :type object_name: str\n \n#### function dict_to_generic_object\n>yutils.base.generic_object.dict_to_generic_object\n\n Converts a dictionary (recursively) to a GenericObject, with keys as attributes.\n\n :param dictionary: dictionary to convert (key-values will be converted to attribute-values)\n :type dictionary: dict\n :param object_name: a name for your new object's type\n :type object_name: str\n :return: GenericObject object\n \n\n\n#### object InputChecker\n>yutils.base.input_checker.InputChecker\n\n\n Base object for making a Python object more static-typed.\n It is useful for checking __init__ argument inputs (type and content).\n\n Type check is defined by _INPUT_TYPES class constant. (see yutils.tools.check_object_type for usage)\n Option check is defined by _INPUT_OPTIONS class constant.\n\n This also:\n - creates self._inputs as the inputs dict given, as an AttributeDict.\n - adds each input in inputs as an attribute to your object.\n\n :param inputs: your __init__ inputs, can be anything you wish to check\n\n :raises: yutils.exceptions.WrongDatatype if any input is not of the specified type, defined by _INPUT_TYPES\n yutils.exceptions.InputError if any input is not one of the options, defined by _INPUT_OPTIONS\n \n\n\n#### object ListContainer\n>yutils.base.list_container.ListContainer\n\n An object that wraps a list, allowing you to use your object as a list and configure it as you wish.\n \n\n :param _list: the original list you wish to keep in the backbone of your object\n :type _list: list\n :param _objects_type: a plural name for your objects in your ListContainer! This is for printing your object.\n For Example:\n >>> class Students(ListContainer):\n >>> def __init__(self):\n >>> super(Students, self).__init__([], 'students')\n :type _objects_type: str\n \n\n\n#### object PrintableObject\n>yutils.base.pretty_printer.PrintableObject\n\n An object you can derive from, that has a pprint method - printing all set attributes\n \n\n\n#### object DictValueList\n>yutils.base.updating_dict.DictValueList\n\nInitialize self. See help(type(self)) for accurate signature.\n#### object UpdatingDict\n>yutils.base.updating_dict.UpdatingDict\n\nInitialize self. See help(type(self)) for accurate signature.\n\n\n\n\n### module sql_connection_details\n>yutils.conn.sql_connection_details\n\n#### object ConnectionDetails\n>yutils.conn.sql_connection_details.ConnectionDetails\n\nInitialize self. See help(type(self)) for accurate signature.\n#### object ElasticConnectionDetails\n>yutils.conn.sql_connection_details.ElasticConnectionDetails\n\nInitialize self. See help(type(self)) for accurate signature.\n#### object MSSQLConnectionDetails\n>yutils.conn.sql_connection_details.MSSQLConnectionDetails\n\nInitialize self. See help(type(self)) for accurate signature.\n#### object MySQLConnectionDetails\n>yutils.conn.sql_connection_details.MySQLConnectionDetails\n\nInitialize self. See help(type(self)) for accurate signature.\n#### object OracleConnectionDetails\n>yutils.conn.sql_connection_details.OracleConnectionDetails\n\nInitialize self. See help(type(self)) for accurate signature.\n\n\n\n\n### module exceptions\n>yutils.exceptions.exceptions\n\n#### object CodeMistake\n>yutils.exceptions.exceptions.CodeMistake\n\n Gets raised to find mistakes when writing code\n \n\n :param mistake_string: an error message explaining why this was raised\n :type mistake_string: str\n \n#### object InputError\n>yutils.exceptions.exceptions.InputError\n\n Gets raised when the input wasn't as expected (e.g. isn't a valid option)\n \n\n :param error_string: an error message explaining the InputError\n :type error_string: str\n \n#### object MissingAttribute\n>yutils.exceptions.exceptions.MissingAttribute\n\n Gets raised when an attribute was expected in a certain class\n \n\n :param class_object: the object itself that is missing an attribute\n :type class_object: object\n :param attribute_name: the name of the attribute that is missing\n :type attribute_name: str\n \n#### object MissingInput\n>yutils.exceptions.exceptions.MissingInput\n\n Gets raised when an input was expected in a certain class but not received\n \n\n :param class_object: the object itself that is missing an attribute\n :type class_object: object\n :param attribute_name: the name of the attribute that is missing\n :type attribute_name: str\n \n#### object UncaughtEndCase\n>yutils.exceptions.exceptions.UncaughtEndCase\n\n Gets raised to catch unexpected cases in the future\n \n\n :param explanation: an optional string to explain the end case.\n Default: 'An uncaught end case was found. Check it out!'\n :type explanation: str\n \n#### object UserCancellation\n>yutils.exceptions.exceptions.UserCancellation\n\n Gets raised when a user chooses to cancel an operation, and you wish the program to abort.\n \n\n :param operation_name: (optional) the operation the user chose to cancel\n :type operation_name: (optional) str\n \n#### object WrongDatatype\n>yutils.exceptions.exceptions.WrongDatatype\n\n Gets raised when something isn't the right datatype as was expected\n \n\n :param name: object name\n :type name: str\n :param expectation: expected type\n :type expectation: type or str\n :param reality: the object's actual type\n :type reality: type or str\n \n#### object WrongInputDatatype\n>yutils.exceptions.exceptions.WrongInputDatatype\n\n Gets raised when an input argument isn't the right datatype as was expected\n \n\n :param name: object name\n :type name: str\n :param expectation: expected type\n :type expectation: type or str\n :param reality: the object's actual type\n :type reality: type or str\n \n#### object YutilsException\n>yutils.exceptions.exceptions.YutilsException\n\nInitialize self. See help(type(self)) for accurate signature.\n\n\n\n\n### module classification\n>yutils.ml.classification\n\n### module features\n>yutils.ml.features\n\n### module linear_regression\n>yutils.ml.linear_regression\n\n### module ml_base\n>yutils.ml.ml_base\n\n### module regression\n>yutils.ml.regression\n\n#### object LogisticRegression\n>yutils.ml.classification.LogisticRegression\n\n#### object LogisticRegressionOptimizedClassifier\n>yutils.ml.classification.LogisticRegressionOptimizedClassifier\n\n#### object MultiClassClassification\n>yutils.ml.classification.MultiClassClassification\n\n\n\n#### object FeatureNormalizer\n>yutils.ml.features.FeatureNormalizer\n\n\n Normalizes features for a ML object\n\n :param info: info to normalize, across column axis (normalizes each column by different normalization data)\n :type info:\n \n\n\n#### object LinearRegression\n>yutils.ml.linear_regression.LinearRegression\n\n\n Not written yet...\n\n :param training_data:\n :param training_results:\n :param learning_rate:\n :param iterations:\n :param normalize_data:\n :param verbose:\n \n#### object NormalEquation\n>yutils.ml.linear_regression.NormalEquation\n\n\n Not explained yet...\n\n :param training_data:\n :param training_results:\n :param assess_for_warning:\n :param verbose:\n \n\n\n#### object MLObject\n>yutils.ml.ml_base.MLObject\n\n\n Base object for making a Python object more static-typed.\n It is useful for checking __init__ argument inputs (type and content).\n\n Type check is defined by _INPUT_TYPES class constant. (see yutils.tools.check_object_type for usage)\n Option check is defined by _INPUT_OPTIONS class constant.\n\n This also:\n - creates self._inputs as the inputs dict given, as an AttributeDict.\n - adds each input in inputs as an attribute to your object.\n\n :param inputs: your __init__ inputs, can be anything you wish to check\n\n :raises: yutils.exceptions.WrongDatatype if any input is not of the specified type, defined by _INPUT_TYPES\n yutils.exceptions.InputError if any input is not one of the options, defined by _INPUT_OPTIONS\n \n#### function create_data_from_text_file\n>yutils.ml.ml_base.create_data_from_text_file\n\n\n\n#### object Regression\n>yutils.ml.regression.Regression\n\n\n\n\n\n### module db_connection\n>yutils.queries.db_connection\n\n### module oracle_field_list_format\n>yutils.queries.oracle_field_list_format\n\n#### module db_connection\n>yutils.queries.db_connection.db_connection\n\n#### module fetchers\n>yutils.queries.db_connection.fetchers\n\n##### object DBConnection\n>yutils.queries.db_connection.db_connection.DBConnection\n\n Wraps a connection to a DB, for executing SQL queries, using given connection_details.\n \n\n :param connection_details: Details for connection to the wanted DB\n :type: connection_details: yutils.conn.sql_connection_details.ConnectionDetails\n :param verbose: If to print warnings or not\n :type verbose: bool\n \n\n\n##### module base_fetcher\n>yutils.queries.db_connection.fetchers.base_fetcher\n\n##### module elastic\n>yutils.queries.db_connection.fetchers.elastic\n\n##### module mssql\n>yutils.queries.db_connection.fetchers.mssql\n\n##### module mysql\n>yutils.queries.db_connection.fetchers.mysql\n\n##### module oracle\n>yutils.queries.db_connection.fetchers.oracle\n\n###### object ElasticSearchFetcher\n>yutils.queries.db_connection.fetchers.elastic.ElasticSearchFetcher\n\n\n\n###### object MSSQLFetcher\n>yutils.queries.db_connection.fetchers.mssql.MSSQLFetcher\n\n\n\n###### object MySQLFetcher\n>yutils.queries.db_connection.fetchers.mysql.MySQLFetcher\n\n\n\n###### object OracleFetcher\n>yutils.queries.db_connection.fetchers.oracle.OracleFetcher\n\n\n\n\n\n\n\n#### function format_oracle_field_list\n>yutils.queries.oracle_field_list_format.format_oracle_field_list\n\n Takes a list that can be more than 999 values long, and wraps them in SQL OR clauses.\n This is useful because Oracle can only accept lists 1000 values long.\n\n :param field_name: the name of the column you are querying\n :type field_name: str\n :param value_list: list of your values to format into the query\n :type value_list: list of str\n\n :return: formatted string containing your new WHERE clause\n :rtype: unicode\n \n\n\n\n\n### module case_conversions\n>yutils.tools.case_conversions\n\n### module files\n>yutils.tools.files\n\n### module list\n>yutils.tools.list\n\n### module numpy_tools\n>yutils.tools.numpy_tools\n\n### module pretty_print\n>yutils.tools.pretty_print\n\n### module str\n>yutils.tools.str\n\n### module xlsx_creator\n>yutils.tools.xlsx_creator\n\n### function check_object_type\n>yutils.tools.check_object_type\n\n This checks the types of an object using a certain syntax:\n Lets say we have an object_to_check and the types_to_validate.\n The object_to_check is the object\n\n :param object_to_check: the object you wish to check its type, and raise an exception should its type not be correct\n :type object_to_check: ....that's what we're here for....\n :param types_to_validate: defines the wanted types for the object to check:\n :type types_to_validate:\n type - checks that object_to_check is of that type\n Example: float will make sure object_to_check is a float\n list of types - checks that object_to_check is one of the types in the list\n Example: [int, float] will make sure object_to_check is either an int or a float\n tuple of types - checks hierarchically:\n checks that object_to_check is of the type of the first item,\n then checks that each item in object_to_check is of the type of the second item,\n etc.\n Remember, all types in the tuple except the last must support indexing.\n Example: (list, str) will make sure object_to_check is a list of strings\n (tuple, [int, float]) will make sure object_to_check is a tuple of either ints or floats\n dict - checks that object_to_check is an object. It's type is defined by key 'type',\n with other keys to be checked as the object's attributes.\n Example: {'type': Person, 'age': int} will make sure object_to_check is a Person object,\n with an 'age' attribute that is an int.\n All values can have as many recursive dimensions as wanted.\n :param input_name: Do not use, this is for recursive inner use.\n\n More examples\n Lets say we create:\n\n integer = 13\n unicode_str = u'foo'\n int_list = list(range(10))\n input_object = MyObject()\n input_object.num = 3\n input_object.lis = [1, 'bar']\n input_object.3dlist = [[(1, 2, 3), (1, 1, 1)], [('a', 'b', 'c'), [7, 8, 9]]]\n\n We can send:\n check_object_type(integer, int)\n check_object_type(unicode_str, unicode)\n check_object_type(int_list, (list, int))\n check_object_type(input_object, {'type': MyObject,\n 'num': int,\n 'lis': (list, [int, str]),\n '3dlist': (list, list, [tuple, list], [int, str, unicode])\n })\n\n :raises:\n Because of invalid inputs:\n yutils.exceptions.CodeMistake - When no 'type' key is found (for when types_to_validate is a dict)\n yutils.exceptions.WrongDatatype - When no type type is found when isinstance-ing an object's type\n Exceptions raised by check:\n yutils.exceptions.WrongInputDatatype - When the type is not correct during validation\n yutils.exceptions.MissingInput - When an attribute is missing (for when types_to_validate is a dict)\n \n### function equivilence\n>yutils.tools.equivilence\n\n Divides an iterator to groups, based on the function's result of every item in the iterator.\n Returns dict of lists.\n\n Example:\n >>> equivilence(range(10), lambda x: x % 3)\n >>>out>>> {0: [0, 3, 6, 9],\n >>>out>>> 1: [1, 4, 7],\n >>>out>>> 2: [2, 5, 8]}\n\n :param iterator: an iterator you wish to run on and divide into groups\n :type iterator: iterator\n :param func: a function to activate on each iterator item - its result decides the return dict's keys.\n :type func: function\n\n :rtype: dict of lists (lists are groups of original iterator)\n \n#### function camel_back_to_snake_case\n>yutils.tools.case_conversions.camel_back_to_snake_case\n\n Turns a camelBack word to a snake_case word\n\n :param camel_back_word: wordInCamelCase\n :return: a_word_in_snake_case\n \n#### function camel_case_to_snake_case\n>yutils.tools.case_conversions.camel_case_to_snake_case\n\n Turns a CamelCase word to a snake_case word\n\n :param camel_case_word: AWordInCamelCase\n :return: a_word_in_snake_case\n \n#### function snake_case_to_camel_back\n>yutils.tools.case_conversions.snake_case_to_camel_back\n\n Turns a snake_case word to a camelBack word\n\n :param snake_case_word: a_word_in_snake_case\n :return: wordInCamelCase\n \n#### function snake_case_to_camel_case\n>yutils.tools.case_conversions.snake_case_to_camel_case\n\n Turns a snake_case word to a CamelCase word\n\n :param snake_case_word: a_word_in_snake_case\n :return: AWordInCamelCase\n \n\n\n#### function get_file_length\n>yutils.tools.files.get_file_length\n\n This function gets a file path and returns its length without reading it\n\n :param file_path: path to return length of\n :type file_path: str\n :return: file length (in bytes)\n :rtype: int\n \n#### function recursive_glob\n>yutils.tools.files.recursive_glob\n\n Returns a list of all files in directory including sub-directories.\n\n :param dir_name: Dir name to glob recursively on\n :type dir_name: str\n :param ignore_hidden: if to ignore hidden files (that start with '.')\n :type ignore_hidden: bool\n\n :return: list of all files in the dir_name\n :rtype: list of str\n \n#### function save_file\n>yutils.tools.files.save_file\n\n This function saves the file content to the destination dir (defaulted to \".\") as base_name + extension,\n but adds a counter if needed.\n\n :param content: the content of the file\n :type content: str\n :param file_base_name: the future file name without extension\n :type file_base_name: str\n :param extension: the file name extension (for example: 'xlsx')\n :type extension: str\n :param dest_dir: where to save the file\n Default: current directory\n :type dest_dir: str\n\n :return: full file path file was saved to\n :rtype: unicode\n \n\n\n#### function make_list\n>yutils.tools.list.make_list\n\n#### function repr_list\n>yutils.tools.list.repr_list\n\n Returns an iterator as a string, representing the list.\n :param iterator: the iterator you wish to represent as a list\n :type iterator: iterator\n :return: representation of your iterator as a list\n :rtype: unicode\n \n\n\n#### function get_indices_containing_all_substrings\n>yutils.tools.numpy_tools.get_indices_containing_all_substrings\n\n#### function is_iterable\n>yutils.tools.numpy_tools.is_iterable\n\n#### function magic\n>yutils.tools.numpy_tools.magic\n\n Implementation taken from https://stackoverflow.com/questions/47834140/numpy-equivalent-of-matlabs-magic\n from user: user6655984\n \n#### function normalize_array\n>yutils.tools.numpy_tools.normalize_array\n\n#### function r2c\n>yutils.tools.numpy_tools.r2c\n\n#### function to_array\n>yutils.tools.numpy_tools.to_array\n\n\n\n#### function pprint_dict\n>yutils.tools.pretty_print.pprint_dict\n\n Prints a dict in a very pretty way!\n\n :param dictionary: your dict to print\n :type dictionary: dict\n :param long_value_limit: when a dict value exceeds this limit, it won't be printed\n Default: 120\n :type long_value_limit: int\n :param long_value_filler: A filler to print instead of a long value, must have {type} and {length} fields!\n Default: '<Long {type} object with repr length {length}>'\n :type long_value_filler: str\n :return: None\n \n#### function pprint_list\n>yutils.tools.pretty_print.pprint_list\n\n Prints a list in an easy, short way.\n\n :param list_to_print: the list you wish to print\n :type list_to_print: list\n :return: None\n \n\n\n#### function turn_numeric\n>yutils.tools.str.turn_numeric\n\n Turns a string into either an int or a float\n\n :param string: a string to assess\n :type string: str\n\n :rtype: str or float\n\n :raises: TypeError if no type was found\n \n\n\n#### object XLSXCreator\n>yutils.tools.xlsx_creator.XLSXCreator\n\n\n A class to create an XLSX file from a table.\n It will format the table inside an actual excel's table, according to each field's width.\n\n :param headers: The fields of the table (headers)\n :type headers: list of unicode\n :param table: The table\n :type table: matrix - list of lists of the same lengths (cells may be any datatype)\n :param output_path: The path where to save the excel\n :type output_path: unicode\n \n#### function create_xlsx\n>yutils.tools.xlsx_creator.create_xlsx\n\n Creates an XLSX file from a table.\n It will format the table inside an actual excel's table, according to each field's width.\n\n :param headers: The fields of the table (headers)\n :type headers: list of unicode\n :param table: The table\n :type table: matrix - list of lists of the same lengths (cells may be any datatype)\n :param output_path: The path where to save the excel\n :type output_path: unicode\n \n#### function get_next_column\n>yutils.tools.xlsx_creator.get_next_column\n\n#### function get_next_letter\n>yutils.tools.xlsx_creator.get_next_letter\n\n#### function table_to_str\n>yutils.tools.xlsx_creator.table_to_str\n\n matrix good for the function xlsxwriter.Worksheet.add_table(['data': table))\n :param table: matrix - list of lists of the same lengths (cells may be any datatype)\n :return: fully string matrix",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python utility package written by Yuval Arbel",
"version": "1.4.0",
"split_keywords": [
"utils",
"utilities",
"queries",
"ml",
"tools"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "43557db28d26eb899d8ed4106c4f73d23b0bd3f86c885f4ce47413264d843af5",
"md5": "b41109ea188dfc9b45d6e4a869ca77fb",
"sha256": "6ccee8af12301fda001e48b7e948c59a7c7fcbdc156e2a4c1668b0dd6475e240"
},
"downloads": -1,
"filename": "yutils-1.4.0.tar.gz",
"has_sig": false,
"md5_digest": "b41109ea188dfc9b45d6e4a869ca77fb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 89829,
"upload_time": "2023-01-29T21:57:49",
"upload_time_iso_8601": "2023-01-29T21:57:49.562570Z",
"url": "https://files.pythonhosted.org/packages/43/55/7db28d26eb899d8ed4106c4f73d23b0bd3f86c885f4ce47413264d843af5/yutils-1.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-29 21:57:49",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "yutils"
}