CodeSync: Bootstrapping Code-Text Pretrained Language Model to Detect Inconsistency Between Code and Comment
CodeSync Package
CodeSync is trained on top of encoder-decoder model to learn from code-text pairs. It is a tool that uses for automated detection to identify inconsistencies between code and docstrings, and generates comprehensive summary sentence to replace the old ones.
Usage Scenario
Installation
Install the dependencies:
pip -r install requirements.txt
Inference
Since CodeSync is a Python package, users can use it by inference function.
from CodeSync.utils import inference
Parameters:
- input_file_path (str): the file path that contains source code if users want to check all the functions in there.
- raw_code (str): a sequence of source code if
input_file_pathis not given. - language (str, required): the programming language. We support 10 popular programming languages such as Java, JavaScript, Python, Ruby, Rust, Golang, C#, C++, C, and PHP.
- output_file_path (str): if
input_file_pathis given, the results from our tool will be written in this path; otherwise, they will be printed on the screen.
Example
from CodeSync.utils import inference
code = """
def inject_func_as_unbound_method(class_, func, method_name=None):
# This is actually quite simple
if method_name is None:
method_name = get_funcname(func)
setattr(class_, method_name, func)
def e(message, exit_code=None):
# Print an error log message.
print_log(message, YELLOW, BOLD)
if exit_code is not None:
sys.exit(exit_code)
"""
inference(raw_code=code, language='python')
>>> Your code snippet function: inject_func_as_unbound_method
Results:
UNMATCH!
Recommended docstring: Inject a function as an unbound method.
-------------
Your code snippet function: e
Results:
MATCH!
Reference
More details can be found in our paper. If you use this code or our package, please consider citing us:
@article{codesync,
title={Bootstrapping Code-Text Pretrained Language Model to Detect Inconsistency Between Code and Comment},
author={},
journal={},
pages={},
year={2023}
}
Contact us
If you have any questions, comments or suggestions, please do not hesitate to contact us.
- Website: fpt-aicenter
- Email: support.ailab@fpt.com
License
Metadata
Release files for codeSync-tool 0.1.1
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 |
|---|---|---|---|---|
| codeSync-tool-0.1.1.tar.gz | 12.0 kB | Without provenance | Details for codeSync-tool-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| codeSync_tool-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for codeSync_tool-0.1.1-py3-none-any.whl |
Total release size: 23.1 kB
Release files / codeSync-tool-0.1.1.tar.gz
| Download URL | codeSync-tool-0.1.1.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f38348b46f881bbe85f01d9b1fc61cb24f24f5c83e26f0e59df354a27276d06
|
|
BLAKE2b-256 checksum How to use checksums |
269fece2be41234f3a690fb12fec788f287771e6d19a3700665648975fc9c9d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.16
|
Release files / codeSync_tool-0.1.1-py3-none-any.whl
| Download URL | codeSync_tool-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4148c967488c53ae0572fb2ace170c237f371451df980093658a1919e6378a33
|
|
BLAKE2b-256 checksum How to use checksums |
bf7c1d878973570927b99ea239ec1d906fcf6f1e8089bf5a441237126df449a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.16
|
Security for codeSync-tool 0.1.1
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.