A library for commented out code detection
Project description
commented out code
This library can detect both inline or block commented out code.
It sends rpc to the server which uses LSTM model to predict commented out code. The server runs on my school data center, and will be migrated to a private machine.
Only support c/c++ now. More language support is about to come
How to use
sample code
text = '''
void DropoutLayer::updateB(){
int num = this->numUnit;
//cout<<"Error!!!!!!!!!!!!!!!!in DropoutLayer!!!!!!!"<<endl;
if (this->z == NULL){ // embeddings
// gradB += dE_dy, because y = b
iXpY( num , this->dE_dy, gradBiases + bidx );
return;
}
if (fprime != dummy){
// dy_dz = f', evaluated at y
( * this->fprime)(this->y, this->dy_dz, num);
// dE_dz = dE_dy .* dy_dz
pointwise_dot(this->dE_dy, this->dy_dz, this->dE_dz, num);
//cout<<"dropout backward"<<endl;
for( int i = 0; i < num; ++i){
this->dE_dz[i] *= this->indicator[i];
}
}// else if fprime == softmaxprime{
// do nothing, because we assume dE_dz is given by softmax
//}
// ReLUPrime(float * y, float * dy_dz, int n);
}
'''
print(client.search(text, 'cpp')) # return OrderedDict object, key is line_number, value is the commented code itself
# output
# OrderedDict([(4, 'cout<<"Error!!!!!!!!!!!!!!!!in DropoutLayer!!!!!!!"<<endl;'),
# (19, 'cout<<"dropout backward"<<endl;'),
# (26, 'else if fprime == softmaxprime{'),
# (29, '}'),
# (31, 'ReLUPrime(float * y, float * dy_dz, int n);')])
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file commented_out_code-0.0.5.tar.gz
.
File metadata
- Download URL: commented_out_code-0.0.5.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0db30e15e9077e4c635a221906df4a46dd6bfe5579034ec3faf50ea7ee1620d |
|
MD5 | 78a0bcfa8b3eb0c23fcf11fbe952c903 |
|
BLAKE2b-256 | bf34cd734581942bd5c6db1e248328e93f6acab57fd8dc3f361990e4c6cb1753 |
File details
Details for the file commented_out_code-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: commented_out_code-0.0.5-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b919593f51471d2a3daeda6a000bd1926fa51f236979522e320f43515fbdb4f |
|
MD5 | e3217fb36c76f0d5095072f628c7b55b |
|
BLAKE2b-256 | 70d13b6731d3ce64ec9a3120318f064301f6c5e51e4c24cb22cfb7f81b02279b |