Metadata-Version: 2.1
Name: unicorefw
Version: 0.1.1
Summary: A versatile Python library for utility functions similar to Underscore.js
Home-page: https://github.com/unicorefw/unicore-py
Author: Kenny Ngo
Author-email: kenny@unicorefw.org
License: UNKNOWN
Description: # UnicoreFW-py - Unicore Framework in Python
        * * *
        Overview
        --------
        UnicoreFW-PY, a part of UnicoreFW.org is a Python-based framework based on UnderscoreJS, designed to offer a comprehensive set of utilities and functional programming tools. This framework is equipped with command-line capabilities that allow users to execute example scripts, parse custom command-line arguments, and integrate powerful utility methods for various use cases. The goal of UnicoreFW is to provide security, performance, and ease of use for developers looking to build and maintain Python applications.
        
        
        Features
        --------
            
        *   **Flexible Test Execution**: Run example scripts through the command line for rapid prototyping and testing.
        *   **Utility Functions**: Includes a robust set of utility methods for functional programming, string manipulation, and more.
        *   **Secure Execution**: Built-in security measures to safely execute code and handle user inputs.
        
        
        Installation
        ------------
        
        1.  Clone the repository:
            
                git clone https://github.com/unicorefw/unicorfw-py.git
                cd unicore-py
            
        2.  Ensure Python 3.x is installed on your system.
            
        3.  Install any required dependencies (if applicable):
            
                pip install -r requirements.txt
        
        
        Directory Structure
        -------------------
        
            project_root_dir/
            ├── src/
            │   └── unicorefw.py
            ├── examples/
            │   └── test.py
            └── README.md
        
        
        Quick Start Guide
        -----------------
        
            from unicorefw import _
              
              # Example usage
              result = (
                  _([1, 2, 3, 4, 5])
                  .map(lambda x: x * 2)
                  .filter(lambda x: x > 5)
                  .value()
              )
              print(result)  # Output: [6, 8, 10]
              
              # Static function usage
              template = "Name: <%= name %>, Age: <%= age %>"
              context = {"name": "Alice", "age": 25}
              print(_.template(template, context))  # Output: "Name: Alice, Age: 25"
        
        Documention
        ------------
         Please see `docs/guide.md` for more information.
        
        **PYTHON IMPLEMENTATION**
        * * *
        This class, `unicore`, provides a wide range of utility functions for working with arrays, objects, and strings. Here's a summary of what each method does:
        
        **Array Functions:**
        
        - `map(array, func)`: Applies a function to each element of an array and returns a new array.
        - `filter(array, func)`: Filters elements in an array based on a predicate function.
        - `reduce(array, func, initial=None)`: Reduces the array to a single value using the provided function.
        - `find(array, func)`: Finds the first element in the array that matches a predicate function.
        - `uniq(array)`: Removes duplicates from an array.
        - `flatten(array, depth=float('inf'))`: Flattens a nested array into a one-dimensional array.
        - `first(array, n=1)`: Returns the first n elements of an array.
        - `last(array, n=1)`: Returns the last n elements of an array.
        - `compact(array)`: Removes falsey values from an array.
        - `without(array, *values)`: Returns an array excluding all provided values.
        - `range(start, stop=None, step=1)`: Generates a range of numbers.
        - `intersection(*arrays)`: Returns an array of values common to all arrays.
        - `difference(array, *others)`: Returns values from the first array not present in others.
        - `groupBy(array, key_func)`: Groups array elements by the result of a function.
        - `sortBy(array, key_func)`: Sorts an array by a function or key.
        - `sample(array, n=1)`: Returns a random sample from an array.
        - `zip(*arrays)`: Combines multiple arrays into an array of tuples.
        - `unzip(array_of_tuples)`: Separates tuples into arrays.
        
        **Object Functions:**
        
        - `keys(obj)`: Returns the keys of a dictionary.
        - `values(obj)`: Returns the values of a dictionary.
        - `extend(obj, *sources)`: Extends an object by copying properties from sources.
        - `clone(obj)`: Creates a shallow copy of an object.
        - `has(obj, key)`: Checks if an object has a given property key.
        - `defaults(obj, defaults)`: Assigns default properties to an object if they are missing.
        - `invert(obj)`: Inverts an object's keys and values.
        
        **Type Checking Functions:**
        
        - `isString(obj)`: Checks if an object is a string.
        - `isNumber(obj)`: Checks if an object is a number.
        - `isArray(obj)`: Checks if an object is a list.
        - `isObject(obj)`: Checks if an object is a dictionary.
        - `isFunction(obj)`: Checks if an object is callable.
        - `isBoolean(obj)`: Checks if an object is a boolean.
        - `isDate(obj)`: Checks if an object is a date object.
        - `isRegExp(obj)`: Checks if an object is a regular expression.
        - `isError(obj)`: Checks if an object is an error instance.
        - `isNull(obj)`: Checks if an object is None.
        - `isUndefined(obj)`: Checks if an object is undefined.
        - `isFinite(obj)`: Checks if an object is a finite number.
        - `isNaN(obj)`: Checks if an object is NaN.
        - `isMap(obj)`: Checks if an object is a map.
        - `isSet(obj)`: Checks if an object is a set.
        
        **Utility Functions:**
        
        - `identity(value)`: Returns the given value unchanged.
        - `times(n, func)`: Calls a function n times.
        - `uniqueId(prefix="")`: Generates a unique identifier with an optional prefix.
        - `escape(string)`: Escapes HTML characters in a string.
        - `unescape(string)`: Unescapes HTML characters in a string.
        - `now()`: Returns the current timestamp.
        - `memoize(func)`: Caches the results of function calls.
        - `bind(func, context, *args)`: Binds a function to a context, optionally pre-filling arguments.
        - `partial(func, *partial_args)`: Partially applies arguments to a function.
        - `throttle(func, wait)`: Throttles a function to be called at most once every wait milliseconds.
        - `debounce(func, wait)`: Debounces a function to only be called after wait milliseconds.
        - `once(func)`: Ensures a function is only called once.
        - `after(times, func)`: Returns a function that will only run after it's been called a specified number of times.
        - `compose(*funcs)`: Composes multiple functions to execute in sequence.
        - `invoke(array, func_name, *args)`: Calls a method on each item in an array.
        - `matches(attrs)`: Returns a function that checks if an object matches key-value pairs.
        - `allKeys(obj)`: Returns all keys of an object, including inherited ones
        
        
        Security Considerations
        -----------------------
        
        *   **Safe Execution**: The framework ensures that code execution is sandboxed and limited in scope to avoid unwanted side effects.
        *   **Input Validation**: Command-line inputs are validated to prevent invalid or malicious commands.
            
        
        Contributing
        ------------
        
        We welcome contributions to UnicoreFW! Please follow these steps:
        
        1.  Fork the repository.
        2.  Create a feature branch.
        3.  Submit a pull request with a detailed description of your changes.
            
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
