VarWizard
- Introduction
VarWizard is a language model-based tool to help generate more meaningful variable names in source code than the original version. It supports 10 programming languages: c, cpp, java, javascript, go, python, php, c_sharp, ruby, rust.
- Installation
You can easily install this package by the command
pip install varwizard
-
Usage
- Command-line
You can use VarWizard by running the command
varwizard [--model-name {bloom-560m, codet5-base} (default: bloom-560m)]
--input INPUT --lang {c,cpp,java,php,go,javascript,ruby,rust,python,c_sharp}
[--output-path OUTPUT_PATH (default: None)] [--max-input-len MAX_INPUT_LEN (default: 400)]
[--device DEVICE (default: cpu)] [--penalty-alpha PENALTY_ALPHA (default: 0.6)] [--top-k TOP_K (default: 4)] [--max-new-tokens MAX_NEW_TOKENS (default: 100)]
Details for each argument can be found by
varwizard --help
-
Python API
Another way is to Python methods. Here is a simple example of VarWizard.
from varwizard import VarWizard
model = VarWizard(model_name = "codet5-base")
code = """
function chunkData(str, chunk) {
var chunk = [];
var length = str.length;
var i = 0;
for (; i < length; i += chunk) {
if (i + chunk < length) {
chunk.push(str.substring(i, i + chunk));
} else {
chunk.push(str.substring(i, length));
}
}
return chunk;
}
"""
print(model.make_new_code(code, 'javascript', device = 'cuda:0'))
VarWizard produces the output
function chunkData(str, chunk) {
var chunk = [];
var length = str.length;
var i = 0;
for (; i < length; i += chunk) {
if (i + chunk < length) {
chunk.push(str.substring(i, i + chunk));
} else {
chunk.push(str.substring(i, length));
}
}
return chunk;
}
- Playground: You can play at the link: https://varwizard.loca.lt. At the first time to access, you may need to enter: 4.193.50.237
- Examples
There are some examples for varWizard's usage. We can navigate to the folder $examples$ and then go to any subfolder to run the script.
Metadata
Release files for varwizard 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| varwizard-0.2.2.tar.gz | 1.1 MB | Without provenance | Details for varwizard-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| varwizard-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for varwizard-0.2.2-py3-none-any.whl |
Total release size: 2.2 MB
Release files / varwizard-0.2.2.tar.gz
| Download URL | varwizard-0.2.2.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a00466ad12299a2cb07a85b9436d5c2cd45cbd4acebc042250c206589528b564
|
|
BLAKE2b-256 checksum How to use checksums |
7fd6ae9bc48ddd0eae0e3b39e5837e4aa803ad9c924eb08035cf6c85079017a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.9.16 Linux/5.15.0-1037-azure
|
Release files / varwizard-0.2.2-py3-none-any.whl
| Download URL | varwizard-0.2.2-py3-none-any.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c40f397a269e8cac531397719a2391b57398886ee417153109db26d5f16624aa
|
|
BLAKE2b-256 checksum How to use checksums |
65ae05b48221e8f370cc5ce59b214956a2e804351baffa4799ffe68ec5d581f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.9.16 Linux/5.15.0-1037-azure
|
Security for varwizard 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.