cppvecstring


Namecppvecstring JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/cppvecstring
SummaryC++ string vector for Python
upload_time2024-09-07 01:06:17
maintainerNone
docs_urlNone
authorJohannes Fischer
requires_pythonNone
licenseMIT
keywords c++ vector
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# C++ string vector for Python

### Tested against Windows 10 / Python 3.11 / Anaconda / C++ 20 - MSVC

### pip install cppvecstring

### Cython and a C++ compiler must be installed!

```PY
from cppvecstring import CppVectorStr
import numpy as np

with open(r"C:\androidcsvdata.csv",mode='rb') as f:
    mystrings=f.read().splitlines()[:1500]
c=CppVectorStr(mystrings)
print(len(c))
print(c)
del c[0]
print(c)
del c[[0,1,2,3]]
print(c)
print(c.nparray)
resultre1=c.re_finditer(b'samsung')
resultre2=c.re_findall(b'samsung.{1,20}')
resultre3=c.re_match(b'samsung')
resultre4=c.re_fullmatch(b'samsung')
resultre5=c.re_search(b'samsung')
resultre6=c.re_split(b'samsung')
result2=c.find(b'samsung')
result3=c.find_first_not_of(b"abcdefghijklmnopqrstuvwxyz ")
result4=c.find_first_of(b"abcdefghijklmnopqrstuvwxyz ")
result3=c.find_last_not_of(b"abcdefghijklmnopqrstuvwxyz ")
result4=c.find_last_of(b"abcdefghijklmnopqrstuvwxyz ")
c[0]=b'xxxxxxxxxxxxxx'
c[90:98]=b'xxxxxxxxxxxxxx'
print(c[0])
print(b'xxxxxxxxxxxxxx' in c)
c.insert(2,b'yyyyy')
print(b'yyyyy' in c)
print(c.index(b'yyyyy'))
print(c)
print(c[5:10])
resultre1=c.re_finditer(b'samsung',line_to_results=False)
resultre2=c.re_findall(b'samsung.{1,20}',line_to_results=False)
resultre3=c.re_match(b'samsung',line_to_results=False)
resultre4=c.re_fullmatch(b'samsung',line_to_results=False)
resultre5=c.re_search(b'samsung',line_to_results=False)
resultre6=c.re_split(b'samsung',line_to_results=False)
print(c.index_all(b'xxxxxxxxxxxxxx'))
gi=c.group_items()
print(c.pop(1))
spli=c.split_at_index([2, 4, 6, 10])
spli=c.split_at_value(b'xxxxxxxxxxxxxx')
c.extend([b'aaaaaaaaaaa',b'bbbbbbbbbbbbbb'])
c.extend_save([b'aaaaaaaaaaa','aaaaaaaaaaa','aaaaaaaaaaa',b'bbbbbbbbbbbbbb','xxxxxxxxx','hhhhhhh',444.333])
c.extend_save_with_conversion([b'aaaaaaaaaaa','aaaaaaaaaaa','aaaaaaaaaaa',b'bbbbbbbbbbbbbb','xxxxxxxxx','hhhhhhh',444.333])

print(c.count(b'aaaaaaaaaaa'))
print(c.reverse())
cc=(c.copy())
print(cc)
cc.clear()
print(cc)
print(cc.empty())
print(c.to_list())
print(c.to_tuple())
print(c.to_set())

my_results_apply_as_c_function = []
my_results_apply_as_c_pyfunction = []
my_results_apply_as_c_function_nogil = []


def apply_as_c_function(a):
    my_results_apply_as_c_function.append(a.startswith(b'xxx'))


def apply_as_c_pyfunction(a):
    my_results_apply_as_c_pyfunction.append(a.startswith(b'xxx'))


def apply_function(a):
    return a.startswith(b'xxx')


def apply_as_c_function_nogil(a):
    my_results_apply_as_c_function_nogil.append(a.startswith(b'xxx'))  # might not release the gil

results1 = c.apply_function(apply_function)
print(results1)
c.apply_as_c_function(apply_as_c_function)
print(my_results_apply_as_c_function)
c.apply_as_c_pyfunction(apply_as_c_pyfunction)
print(my_results_apply_as_c_pyfunction)
c.apply_as_c_function_nogil(apply_as_c_function_nogil)
print(my_results_apply_as_c_function_nogil)


```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/cppvecstring",
    "name": "cppvecstring",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "c++, vector",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/de/b7/e5c8d69284ad80a4988bf89c6b96d1e8b31c321298ae96dc993029372232/cppvecstring-0.10.tar.gz",
    "platform": null,
    "description": "\r\n# C++ string vector for Python\r\n\r\n### Tested against Windows 10 / Python 3.11 / Anaconda / C++ 20 - MSVC\r\n\r\n### pip install cppvecstring\r\n\r\n### Cython and a C++ compiler must be installed!\r\n\r\n```PY\r\nfrom cppvecstring import CppVectorStr\r\nimport numpy as np\r\n\r\nwith open(r\"C:\\androidcsvdata.csv\",mode='rb') as f:\r\n    mystrings=f.read().splitlines()[:1500]\r\nc=CppVectorStr(mystrings)\r\nprint(len(c))\r\nprint(c)\r\ndel c[0]\r\nprint(c)\r\ndel c[[0,1,2,3]]\r\nprint(c)\r\nprint(c.nparray)\r\nresultre1=c.re_finditer(b'samsung')\r\nresultre2=c.re_findall(b'samsung.{1,20}')\r\nresultre3=c.re_match(b'samsung')\r\nresultre4=c.re_fullmatch(b'samsung')\r\nresultre5=c.re_search(b'samsung')\r\nresultre6=c.re_split(b'samsung')\r\nresult2=c.find(b'samsung')\r\nresult3=c.find_first_not_of(b\"abcdefghijklmnopqrstuvwxyz \")\r\nresult4=c.find_first_of(b\"abcdefghijklmnopqrstuvwxyz \")\r\nresult3=c.find_last_not_of(b\"abcdefghijklmnopqrstuvwxyz \")\r\nresult4=c.find_last_of(b\"abcdefghijklmnopqrstuvwxyz \")\r\nc[0]=b'xxxxxxxxxxxxxx'\r\nc[90:98]=b'xxxxxxxxxxxxxx'\r\nprint(c[0])\r\nprint(b'xxxxxxxxxxxxxx' in c)\r\nc.insert(2,b'yyyyy')\r\nprint(b'yyyyy' in c)\r\nprint(c.index(b'yyyyy'))\r\nprint(c)\r\nprint(c[5:10])\r\nresultre1=c.re_finditer(b'samsung',line_to_results=False)\r\nresultre2=c.re_findall(b'samsung.{1,20}',line_to_results=False)\r\nresultre3=c.re_match(b'samsung',line_to_results=False)\r\nresultre4=c.re_fullmatch(b'samsung',line_to_results=False)\r\nresultre5=c.re_search(b'samsung',line_to_results=False)\r\nresultre6=c.re_split(b'samsung',line_to_results=False)\r\nprint(c.index_all(b'xxxxxxxxxxxxxx'))\r\ngi=c.group_items()\r\nprint(c.pop(1))\r\nspli=c.split_at_index([2, 4, 6, 10])\r\nspli=c.split_at_value(b'xxxxxxxxxxxxxx')\r\nc.extend([b'aaaaaaaaaaa',b'bbbbbbbbbbbbbb'])\r\nc.extend_save([b'aaaaaaaaaaa','aaaaaaaaaaa','aaaaaaaaaaa',b'bbbbbbbbbbbbbb','xxxxxxxxx','hhhhhhh',444.333])\r\nc.extend_save_with_conversion([b'aaaaaaaaaaa','aaaaaaaaaaa','aaaaaaaaaaa',b'bbbbbbbbbbbbbb','xxxxxxxxx','hhhhhhh',444.333])\r\n\r\nprint(c.count(b'aaaaaaaaaaa'))\r\nprint(c.reverse())\r\ncc=(c.copy())\r\nprint(cc)\r\ncc.clear()\r\nprint(cc)\r\nprint(cc.empty())\r\nprint(c.to_list())\r\nprint(c.to_tuple())\r\nprint(c.to_set())\r\n\r\nmy_results_apply_as_c_function = []\r\nmy_results_apply_as_c_pyfunction = []\r\nmy_results_apply_as_c_function_nogil = []\r\n\r\n\r\ndef apply_as_c_function(a):\r\n    my_results_apply_as_c_function.append(a.startswith(b'xxx'))\r\n\r\n\r\ndef apply_as_c_pyfunction(a):\r\n    my_results_apply_as_c_pyfunction.append(a.startswith(b'xxx'))\r\n\r\n\r\ndef apply_function(a):\r\n    return a.startswith(b'xxx')\r\n\r\n\r\ndef apply_as_c_function_nogil(a):\r\n    my_results_apply_as_c_function_nogil.append(a.startswith(b'xxx'))  # might not release the gil\r\n\r\nresults1 = c.apply_function(apply_function)\r\nprint(results1)\r\nc.apply_as_c_function(apply_as_c_function)\r\nprint(my_results_apply_as_c_function)\r\nc.apply_as_c_pyfunction(apply_as_c_pyfunction)\r\nprint(my_results_apply_as_c_pyfunction)\r\nc.apply_as_c_function_nogil(apply_as_c_function_nogil)\r\nprint(my_results_apply_as_c_function_nogil)\r\n\r\n\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "C++ string vector for Python",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/cppvecstring"
    },
    "split_keywords": [
        "c++",
        " vector"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a040f6a15d563fc9cd09ff30d5f2c5c86b2ccd585d22ff97e7d684f839f0bcf",
                "md5": "1bce71146361a89ad02098e4a54cd6c4",
                "sha256": "ca257cbe71c749a760034054915e9aa8f7e655af989a384e2ef4f394061cd7f7"
            },
            "downloads": -1,
            "filename": "cppvecstring-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1bce71146361a89ad02098e4a54cd6c4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 30149,
            "upload_time": "2024-09-07T01:06:16",
            "upload_time_iso_8601": "2024-09-07T01:06:16.360057Z",
            "url": "https://files.pythonhosted.org/packages/2a/04/0f6a15d563fc9cd09ff30d5f2c5c86b2ccd585d22ff97e7d684f839f0bcf/cppvecstring-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "deb7e5c8d69284ad80a4988bf89c6b96d1e8b31c321298ae96dc993029372232",
                "md5": "7075552746a05a2587b98df317f7989b",
                "sha256": "c79ee2a0edd8125816358e7b714559e4ff4e826d172cbfe63b8938ff9e84b815"
            },
            "downloads": -1,
            "filename": "cppvecstring-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "7075552746a05a2587b98df317f7989b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 29516,
            "upload_time": "2024-09-07T01:06:17",
            "upload_time_iso_8601": "2024-09-07T01:06:17.715105Z",
            "url": "https://files.pythonhosted.org/packages/de/b7/e5c8d69284ad80a4988bf89c6b96d1e8b31c321298ae96dc993029372232/cppvecstring-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-07 01:06:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "cppvecstring",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "cppvecstring"
}
        
Elapsed time: 0.29902s