canederli


Namecanederli JSON
Version 0.0.17 PyPI version JSON
download
home_page
SummarySimple tools to quickly get the names of multiple variables out of the lines of code where they are defined.
upload_time2023-08-27 22:35:11
maintainer
docs_urlNone
authortms1991
requires_python
license
keywords hardcode variables names labels strings list multiline
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            

<div style="text-align:center">
	<img src="https://raw.githubusercontent.com/tommasosansone91/canederli/main/images/canederli2.png" style="width:100%;" align="middle" alt="cover of Canaderli python package" >
</div>

<br>

*Stop labelling variables by enclosing every one of them in quotes.<br>
Get your hands dirty with a big copypaste just once.*

This package contains the function 'canederlist' 

i.e. 

Comma <br>
And <br>
NEwline <br>
Delimited <br>
Elements <br>
Reformatted as <br>
LIst of <br>
STrings <br>

which allows to reformat a multiline string containing words separated by commas into a list of strings.

This is useful when we have hardcoded a list of variables and we want to quickly get a list of their names as strings.

canederlist spares us from copypasting 

```
print(var1, var2, ..., var100)
```
and manually add quotes around each variable, like this

```
print("var1", "var2", ..., "var100")
```


usage
-----

The list of variables (i.e. not the variable containing the list, the hardcoded list of variables) must be copied and pasted as argument of canederlist(), enclosed in triple quotes (""").

The function canederlist will remove 
 - multiple spaces (double or more, but not single spaces)
 - newline characters
 - triple points ...
 - (if selected in the input) round () and square [] parentheses
 - (if selected in the input) single spaces
and split the remaining elements separated by commas into a list of strings.


example
-------

```
from canederli import canederlist
columns = [ names, 
            descriptions, 
            x_coordinates, 
            y_coordinates ]

columns_labels = canederlist("""
 names, 
            descriptions, 
            x_coordinates, 
            y_coordinates 
""")

print(columns_labels)
print(columns)
```
```
['names', 'descriptions', 'x_coordinates', 'y_coordinates']
...

```

example removing parentheses
----------------------------

```

from canederli import canederlist
columns = [ names, 
            descriptions, 
            x_coordinates, 
            y_coordinates ]

columns_labels = canederlist("""
 names, 
            descriptions, 
            x_coordinates, 
            y_coordinates ]
""",1)  # <--- this is the same as setting optional parameter rm_parentheses=True

print(columns_labels)
print(columns)
```
```
['names', 'descriptions', 'x_coordinates', 'y_coordinates']
...
```


long case example
------------------


```
var_1 = 42
var_2 = "Hello, world!"
var_3 = 3.14
var_4 = [1, 2, 3]
var_5 = {"name": "Mario", "age": 30}
var_6 = True
var_7 = (10, 20, 30)
var_8 = None
var_9 = 5.67
var_10 = "Python is fantastic!"
var_11 = [5, 10, 15]
var_12 = {"language": "Python", "level": "advanced"}
var_13 = False
var_14 = (1.5, 2.5, 3.5)
var_15 = "OpenAI is doing great things!"
var_16 = 12345
var_17 = "This is a test."
var_18 = [True, False]
var_19 = {"color": "blue", "shape": "circle"}
var_20 = 7.89
var_21 = ["a", "b", "c"]
var_22 = (100, 200, 300)
var_23 = 987654321
var_24 = "This is another string."
var_25 = {"animal": "cat", "age": 5}
var_26 = None
var_27 = 2.71828
var_28 = [7, 14, 21]
var_29 = "Python makes everything simpler!"
var_30 = ("x", "y", "z")
var_31 = True
var_32 = {"name": "Alice", "city": "Rome"}
var_33 = 4.567
var_34 = 111
var_35 = "I'm learning a lot with OpenAI!"
var_36 = [3.5, 7.2, 10.9]
var_37 = ("pen", "pencil", "eraser")
var_38 = False
var_39 = {"fruit": "apple", "color": "red"}
var_40 = 9.81
var_41 = ["alpha", "beta", "gamma"]
var_42 = (42, 84, 126)
var_43 = 55555
var_44 = "This sentence has five words."
var_45 = {"instrument": "guitar", "type": "acoustic"}
var_46 = None
var_47 = 3.14159
var_48 = [2, 4, 6]
var_49 = "Python is powerful and efficient!"
var_50 = ("one", "two", "three")
var_51 = True
var_52 = {"name": "Luca", "language": "Italian"}
var_53 = 2.345
var_54 = 987
var_55 = "OpenAI is changing the game!"
var_56 = [1.1, 2.2, 3.3]
var_57 = ("a", "b", "c")
var_58 = False
var_59 = {"element": "gold", "atomic number": 79}
var_60 = 6.626e-34
var_61 = ["plane", "train", "car"]
var_62 = (50, 100, 150)
var_63 = 777777
var_64 = "Knowledge is power."
var_65 = {"profession": "doctor", "specialty": "surgery"}
var_66 = None
var_67 = 9.12345
var_68 = [8, 16, 24]
var_69 = "GPT-3.5 is amazing!"
var_70 = ("one", "two", "three")
var_71 = True
var_72 = {"name": "Laura", "age": 25}
var_73 = 1.2345
var_74 = 654
var_75 = "Python opens new possibilities!"
var_76 = [4.4, 5.5, 6.6]
var_77 = ("A", "B", "C")
var_78 = False
var_79 = {"color": "green", "plant": "tree"}
var_80 = 299792458
var_81 = ["Monday", "Tuesday", "Wednesday"]
var_82 = (70, 140, 210)
var_83 = 333333
var_84 = "This is just an example."
var_85 = {"instrument": "piano", "type": "digital"}
var_86 = None
var_87 = 7.77777
var_88 = [6, 12, 18]
var_89 = "Python makes everything more interesting!"
var_90 = ("A", "B", "C")
var_91 = True
var_92 = {"name": "Mark", "language": "Spanish"}
var_93 = 8.765
var_94 = 123
var_95 = "OpenAI is transforming technologies!"
var_96 = [7.7, 8.8, 9.9]
var_97 = ("one", "two", "three")
var_98 = False
var_99 = {"city": "Paris", "country": "France"}
var_100 = 42.195

print(canederlist(""" var_78,
var_79,
var_80,
var_81,
var_82,
var_83,
var_84,
var_85,
var_86,
var_87,
var_88,
var_89,
var_90,
var_91,
var_92,
var_93,
var_94
"""))

print([
    var_78,
    var_79,
    var_80,
    var_81,
    var_82,
    var_83,
    var_84,
    var_85,
    var_86,
    var_87,
    var_88,
    var_89,
    var_90,
    var_91,
    var_92,
    var_93,
    var_94
])

```

```
['var_78', 'var_79', 'var_80', 'var_81', 'var_82', 'var_83', 'var_84', 'var_85', 'var_86', 'var_87', 'var_88', 'var_89', 'var_90', 'var_91', 'var_92', 'var_93', 'var_94']

[False, {'color': 'green', 'plant': 'tree'}, 299792458, ['Monday', 'Tuesday', 'Wednesday'], (70, 140, 210), 333333, 'This is just an example.', {'instrument': 'piano', 'type': 'digital'}, None, 7.77777, [6, 12, 18], 'Python makes everything more interesting!', ('A', 'B', 'C'), True, {'name': 'Mark', 'language': 'Spanish'}, 8.765, 123]

```




            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "canederli",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "hardcode,variables,names,labels,strings,list,multiline",
    "author": "tms1991",
    "author_email": "<youremail@email.com>",
    "download_url": "https://files.pythonhosted.org/packages/fc/98/c2615602f9b5b7d757e2b90ff2cea5a80d275a550e7edb7def7f1fdd0975/canederli-0.0.17.tar.gz",
    "platform": null,
    "description": "\n\n<div style=\"text-align:center\">\n\t<img src=\"https://raw.githubusercontent.com/tommasosansone91/canederli/main/images/canederli2.png\" style=\"width:100%;\" align=\"middle\" alt=\"cover of Canaderli python package\" >\n</div>\n\n<br>\n\n*Stop labelling variables by enclosing every one of them in quotes.<br>\nGet your hands dirty with a big copypaste just once.*\n\nThis package contains the function 'canederlist' \n\ni.e. \n\nComma <br>\nAnd <br>\nNEwline <br>\nDelimited <br>\nElements <br>\nReformatted as <br>\nLIst of <br>\nSTrings <br>\n\nwhich allows to reformat a multiline string containing words separated by commas into a list of strings.\n\nThis is useful when we have hardcoded a list of variables and we want to quickly get a list of their names as strings.\n\ncanederlist spares us from copypasting \n\n```\nprint(var1, var2, ..., var100)\n```\nand manually add quotes around each variable, like this\n\n```\nprint(\"var1\", \"var2\", ..., \"var100\")\n```\n\n\nusage\n-----\n\nThe list of variables (i.e. not the variable containing the list, the hardcoded list of variables) must be copied and pasted as argument of canederlist(), enclosed in triple quotes (\"\"\").\n\nThe function canederlist will remove \n - multiple spaces (double or more, but not single spaces)\n - newline characters\n - triple points ...\n - (if selected in the input) round () and square [] parentheses\n - (if selected in the input) single spaces\nand split the remaining elements separated by commas into a list of strings.\n\n\nexample\n-------\n\n```\nfrom canederli import canederlist\ncolumns = [ names, \n            descriptions, \n            x_coordinates, \n            y_coordinates ]\n\ncolumns_labels = canederlist(\"\"\"\n names, \n            descriptions, \n            x_coordinates, \n            y_coordinates \n\"\"\")\n\nprint(columns_labels)\nprint(columns)\n```\n```\n['names', 'descriptions', 'x_coordinates', 'y_coordinates']\n...\n\n```\n\nexample removing parentheses\n----------------------------\n\n```\n\nfrom canederli import canederlist\ncolumns = [ names, \n            descriptions, \n            x_coordinates, \n            y_coordinates ]\n\ncolumns_labels = canederlist(\"\"\"\n names, \n            descriptions, \n            x_coordinates, \n            y_coordinates ]\n\"\"\",1)  # <--- this is the same as setting optional parameter rm_parentheses=True\n\nprint(columns_labels)\nprint(columns)\n```\n```\n['names', 'descriptions', 'x_coordinates', 'y_coordinates']\n...\n```\n\n\nlong case example\n------------------\n\n\n```\nvar_1 = 42\nvar_2 = \"Hello, world!\"\nvar_3 = 3.14\nvar_4 = [1, 2, 3]\nvar_5 = {\"name\": \"Mario\", \"age\": 30}\nvar_6 = True\nvar_7 = (10, 20, 30)\nvar_8 = None\nvar_9 = 5.67\nvar_10 = \"Python is fantastic!\"\nvar_11 = [5, 10, 15]\nvar_12 = {\"language\": \"Python\", \"level\": \"advanced\"}\nvar_13 = False\nvar_14 = (1.5, 2.5, 3.5)\nvar_15 = \"OpenAI is doing great things!\"\nvar_16 = 12345\nvar_17 = \"This is a test.\"\nvar_18 = [True, False]\nvar_19 = {\"color\": \"blue\", \"shape\": \"circle\"}\nvar_20 = 7.89\nvar_21 = [\"a\", \"b\", \"c\"]\nvar_22 = (100, 200, 300)\nvar_23 = 987654321\nvar_24 = \"This is another string.\"\nvar_25 = {\"animal\": \"cat\", \"age\": 5}\nvar_26 = None\nvar_27 = 2.71828\nvar_28 = [7, 14, 21]\nvar_29 = \"Python makes everything simpler!\"\nvar_30 = (\"x\", \"y\", \"z\")\nvar_31 = True\nvar_32 = {\"name\": \"Alice\", \"city\": \"Rome\"}\nvar_33 = 4.567\nvar_34 = 111\nvar_35 = \"I'm learning a lot with OpenAI!\"\nvar_36 = [3.5, 7.2, 10.9]\nvar_37 = (\"pen\", \"pencil\", \"eraser\")\nvar_38 = False\nvar_39 = {\"fruit\": \"apple\", \"color\": \"red\"}\nvar_40 = 9.81\nvar_41 = [\"alpha\", \"beta\", \"gamma\"]\nvar_42 = (42, 84, 126)\nvar_43 = 55555\nvar_44 = \"This sentence has five words.\"\nvar_45 = {\"instrument\": \"guitar\", \"type\": \"acoustic\"}\nvar_46 = None\nvar_47 = 3.14159\nvar_48 = [2, 4, 6]\nvar_49 = \"Python is powerful and efficient!\"\nvar_50 = (\"one\", \"two\", \"three\")\nvar_51 = True\nvar_52 = {\"name\": \"Luca\", \"language\": \"Italian\"}\nvar_53 = 2.345\nvar_54 = 987\nvar_55 = \"OpenAI is changing the game!\"\nvar_56 = [1.1, 2.2, 3.3]\nvar_57 = (\"a\", \"b\", \"c\")\nvar_58 = False\nvar_59 = {\"element\": \"gold\", \"atomic number\": 79}\nvar_60 = 6.626e-34\nvar_61 = [\"plane\", \"train\", \"car\"]\nvar_62 = (50, 100, 150)\nvar_63 = 777777\nvar_64 = \"Knowledge is power.\"\nvar_65 = {\"profession\": \"doctor\", \"specialty\": \"surgery\"}\nvar_66 = None\nvar_67 = 9.12345\nvar_68 = [8, 16, 24]\nvar_69 = \"GPT-3.5 is amazing!\"\nvar_70 = (\"one\", \"two\", \"three\")\nvar_71 = True\nvar_72 = {\"name\": \"Laura\", \"age\": 25}\nvar_73 = 1.2345\nvar_74 = 654\nvar_75 = \"Python opens new possibilities!\"\nvar_76 = [4.4, 5.5, 6.6]\nvar_77 = (\"A\", \"B\", \"C\")\nvar_78 = False\nvar_79 = {\"color\": \"green\", \"plant\": \"tree\"}\nvar_80 = 299792458\nvar_81 = [\"Monday\", \"Tuesday\", \"Wednesday\"]\nvar_82 = (70, 140, 210)\nvar_83 = 333333\nvar_84 = \"This is just an example.\"\nvar_85 = {\"instrument\": \"piano\", \"type\": \"digital\"}\nvar_86 = None\nvar_87 = 7.77777\nvar_88 = [6, 12, 18]\nvar_89 = \"Python makes everything more interesting!\"\nvar_90 = (\"A\", \"B\", \"C\")\nvar_91 = True\nvar_92 = {\"name\": \"Mark\", \"language\": \"Spanish\"}\nvar_93 = 8.765\nvar_94 = 123\nvar_95 = \"OpenAI is transforming technologies!\"\nvar_96 = [7.7, 8.8, 9.9]\nvar_97 = (\"one\", \"two\", \"three\")\nvar_98 = False\nvar_99 = {\"city\": \"Paris\", \"country\": \"France\"}\nvar_100 = 42.195\n\nprint(canederlist(\"\"\" var_78,\nvar_79,\nvar_80,\nvar_81,\nvar_82,\nvar_83,\nvar_84,\nvar_85,\nvar_86,\nvar_87,\nvar_88,\nvar_89,\nvar_90,\nvar_91,\nvar_92,\nvar_93,\nvar_94\n\"\"\"))\n\nprint([\n    var_78,\n    var_79,\n    var_80,\n    var_81,\n    var_82,\n    var_83,\n    var_84,\n    var_85,\n    var_86,\n    var_87,\n    var_88,\n    var_89,\n    var_90,\n    var_91,\n    var_92,\n    var_93,\n    var_94\n])\n\n```\n\n```\n['var_78', 'var_79', 'var_80', 'var_81', 'var_82', 'var_83', 'var_84', 'var_85', 'var_86', 'var_87', 'var_88', 'var_89', 'var_90', 'var_91', 'var_92', 'var_93', 'var_94']\n\n[False, {'color': 'green', 'plant': 'tree'}, 299792458, ['Monday', 'Tuesday', 'Wednesday'], (70, 140, 210), 333333, 'This is just an example.', {'instrument': 'piano', 'type': 'digital'}, None, 7.77777, [6, 12, 18], 'Python makes everything more interesting!', ('A', 'B', 'C'), True, {'name': 'Mark', 'language': 'Spanish'}, 8.765, 123]\n\n```\n\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Simple tools to quickly get the names of multiple variables out of the lines of code where they are defined.",
    "version": "0.0.17",
    "project_urls": null,
    "split_keywords": [
        "hardcode",
        "variables",
        "names",
        "labels",
        "strings",
        "list",
        "multiline"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "de160dbaace671d56fbb9cc9ae8009f1eb622f2a45d3888d86dbb7c1409db942",
                "md5": "ef5b2e51585383d52d68d18e55c327c5",
                "sha256": "c2015afa257b5b927f3ffbba8ec373e3fc90a947f3871d3e703a3ef34c7c1c81"
            },
            "downloads": -1,
            "filename": "canederli-0.0.17-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ef5b2e51585383d52d68d18e55c327c5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5239,
            "upload_time": "2023-08-27T22:35:09",
            "upload_time_iso_8601": "2023-08-27T22:35:09.853849Z",
            "url": "https://files.pythonhosted.org/packages/de/16/0dbaace671d56fbb9cc9ae8009f1eb622f2a45d3888d86dbb7c1409db942/canederli-0.0.17-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fc98c2615602f9b5b7d757e2b90ff2cea5a80d275a550e7edb7def7f1fdd0975",
                "md5": "31c64199293b05d719e90a4b3f0eac2d",
                "sha256": "b899c8219941c10711e1f8a0fdf6555821c4c20edd781d07785803edaae41850"
            },
            "downloads": -1,
            "filename": "canederli-0.0.17.tar.gz",
            "has_sig": false,
            "md5_digest": "31c64199293b05d719e90a4b3f0eac2d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5091,
            "upload_time": "2023-08-27T22:35:11",
            "upload_time_iso_8601": "2023-08-27T22:35:11.521421Z",
            "url": "https://files.pythonhosted.org/packages/fc/98/c2615602f9b5b7d757e2b90ff2cea5a80d275a550e7edb7def7f1fdd0975/canederli-0.0.17.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-27 22:35:11",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "canederli"
}
        
Elapsed time: 0.10867s