zytlib


Namezytlib JSON
Version 0.3.342 PyPI version JSON
download
home_pagehttps://github.com/Bertie97/pyctlib/tree/main/pyctlib
SummaryThis is A foundamental package containing some basic self-designed functions and types for Project PyCTLib.
upload_time2023-05-12 10:21:13
maintainer
docs_urlNone
authorAll contributors of PyCTLib
requires_python
licenseMIT Licence
keywords pip zytlib
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyctlib
## Introduction

Package [`pyctlib`](https://github.com/Bertie97/pyctlib/tree/main/pyctlib) is the fundamental package for project [`PyCTLib`](https://github.com/Bertie97/pyctlib), a powerful toolkit for python development. This package provides basic functions for fast `python v3.6+` programming. It provides easy communication with the inputs and outputs for the operating systems. It provides quick try-catch function `touch`, useful types like `vector`, timing tools like `timethis` and `scope` as long as manipulation of file path, reading & writing of text/binary files and command line tools. 

## Installation

This package can be installed by `pip install pyctlib` or moving the source code to the directory of python libraries (the source code can be downloaded on [github](https://github.com/Bertie97/pyctlib) or [PyPI](https://pypi.org/project/pyctlib/)). 

```shell
pip install pyctlib
```

## Basic Types

### vector

`vector` is an improved implement of `list` for python. In addition to original function for `list`, it has the following advanced usage:

```python
In [1]: from pyctlib.basictype import vector                                         

In [2]: a = vector([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])                                  

In [3]: a.map(lambda x: x * 2)                                                       
Out[3]: [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]

In [4]: a.filter(lambda x: x % 2 == 0)                                               
Out[4]: [2, 4, 6, 8, 10]

In [5]: a.all(lambda x: x > 1)                                                       
Out[5]: False

In [6]: a.any(lambda x: x == 2)                                                      
Out[6]: True

In [7]: a[a > 7] = 7                                                                 

In [8]: a                                                                            
Out[8]: [1, 2, 3, 4, 5, 6, 7, 7, 7, 7]

In [9]: a.reduce(lambda x, y: x + y)                                                 
Out[9]: 49

In [10]: a.index(lambda x: x % 4 == 0)                                               
Out[10]: 3
```

## File Management

## Timing Tools

### `scope`

```python
>>> from pyctlib import scope, jump
>>> with scope("name1"):
...     print("timed1")
...
timed1
[name1 takes 0.000048s]
>>> with scope("name2"), jump:
...     print("timed2")
...
>>>
```

### `timethis`

```python
>>> from pyctlib import timethis
>>> @timethis
... def func(): print('timed')
... 
>>> func()
timed
[func takes 0.000050s]
```

## Touch function

```python
>>> from pyctlib import touch
>>> touch(lambda: 1/0, 'error')
'error'
>>> touch('a')
>>> a = 4
>>> touch('a')
4
```



## Acknowledgment

@Yiteng Zhang, Yuncheng Zhou: Developers


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Bertie97/pyctlib/tree/main/pyctlib",
    "name": "zytlib",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pip,zytlib",
    "author": "All contributors of PyCTLib",
    "author_email": "zytfdu@icloud.com",
    "download_url": "",
    "platform": "any",
    "description": "# pyctlib\n## Introduction\n\nPackage [`pyctlib`](https://github.com/Bertie97/pyctlib/tree/main/pyctlib) is the fundamental package for project [`PyCTLib`](https://github.com/Bertie97/pyctlib), a powerful toolkit for python development. This package provides basic functions for fast `python v3.6+` programming. It provides easy communication with the inputs and outputs for the operating systems. It provides quick try-catch function `touch`, useful types like `vector`, timing tools like `timethis` and `scope` as long as manipulation of file path, reading & writing of text/binary files and command line tools. \n\n## Installation\n\nThis package can be installed by `pip install pyctlib` or moving the source code to the directory of python libraries (the source code can be downloaded on [github](https://github.com/Bertie97/pyctlib) or [PyPI](https://pypi.org/project/pyctlib/)). \n\n```shell\npip install pyctlib\n```\n\n## Basic Types\n\n### vector\n\n`vector` is an improved implement of `list` for python. In addition to original function for `list`, it has the following advanced usage:\n\n```python\nIn [1]: from pyctlib.basictype import vector                                         \n\nIn [2]: a = vector([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])                                  \n\nIn [3]: a.map(lambda x: x * 2)                                                       \nOut[3]: [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]\n\nIn [4]: a.filter(lambda x: x % 2 == 0)                                               \nOut[4]: [2, 4, 6, 8, 10]\n\nIn [5]: a.all(lambda x: x > 1)                                                       \nOut[5]: False\n\nIn [6]: a.any(lambda x: x == 2)                                                      \nOut[6]: True\n\nIn [7]: a[a > 7] = 7                                                                 \n\nIn [8]: a                                                                            \nOut[8]: [1, 2, 3, 4, 5, 6, 7, 7, 7, 7]\n\nIn [9]: a.reduce(lambda x, y: x + y)                                                 \nOut[9]: 49\n\nIn [10]: a.index(lambda x: x % 4 == 0)                                               \nOut[10]: 3\n```\n\n## File Management\n\n## Timing Tools\n\n### `scope`\n\n```python\n>>> from pyctlib import scope, jump\n>>> with scope(\"name1\"):\n...     print(\"timed1\")\n...\ntimed1\n[name1 takes 0.000048s]\n>>> with scope(\"name2\"), jump:\n...     print(\"timed2\")\n...\n>>>\n```\n\n### `timethis`\n\n```python\n>>> from pyctlib import timethis\n>>> @timethis\n... def func(): print('timed')\n... \n>>> func()\ntimed\n[func takes 0.000050s]\n```\n\n## Touch function\n\n```python\n>>> from pyctlib import touch\n>>> touch(lambda: 1/0, 'error')\n'error'\n>>> touch('a')\n>>> a = 4\n>>> touch('a')\n4\n```\n\n\n\n## Acknowledgment\n\n@Yiteng Zhang, Yuncheng Zhou: Developers\n\n",
    "bugtrack_url": null,
    "license": "MIT Licence",
    "summary": "This is A foundamental package containing some basic self-designed functions and types for Project PyCTLib.",
    "version": "0.3.342",
    "project_urls": {
        "Homepage": "https://github.com/Bertie97/pyctlib/tree/main/pyctlib"
    },
    "split_keywords": [
        "pip",
        "zytlib"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0cd2c7853b71e0455c3046c189f3bf0aef75525443ede0317ec919906e17718c",
                "md5": "8b1fdd7acdd093899ddda8e51063bbef",
                "sha256": "b9b851b2617a9083b7233d56737a68c80092b0df1f3e0e43a59630d65a8adca4"
            },
            "downloads": -1,
            "filename": "zytlib-0.3.342-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8b1fdd7acdd093899ddda8e51063bbef",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 75001,
            "upload_time": "2023-05-12T10:21:13",
            "upload_time_iso_8601": "2023-05-12T10:21:13.660078Z",
            "url": "https://files.pythonhosted.org/packages/0c/d2/c7853b71e0455c3046c189f3bf0aef75525443ede0317ec919906e17718c/zytlib-0.3.342-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-12 10:21:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Bertie97",
    "github_project": "pyctlib",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "zytlib"
}
        
Elapsed time: 0.06405s