본문 바로가기

전체 글

(245)
Awesome machine-learning on source-code https://github.com/src-d/awesome-machine-learning-on-source-code 소스코드 기계학습과 관련된 논문 및 학회 정보를 얻을 수 있다.
python - cyclomatic complexity 모듈 (lizard) 프로그램 언어 별 Cyclomatic complexity, LOC, Parameter Number를 계산해주는 Python 모듈인 lizard를 소개한다.C/C++ 언어의 경우에도 헤더 파싱을 안하더라도 간결하게 계산할 수 있어 도움이 많이 될듯 하다. https://github.com/terryyin/lizard 1. 설치 pip install lizard 2. 사용법 lizard [options] [PATH or FILE] [PATH] ... 옵션 없이 실행하면, 해당 폴더를 포함하여 하부 폴더에 있는 소스코드에 대한 분석을 수행한다.-m : Modified CC를 계산함(switch / case 문은 1로 계산함)-X, --xml : 결과를 xml로 저장함.--csv : 결과를 csv로 저장함.-H..
python clang - ast 트리 출력하기 ast_dump.py import sys import clang.cindex def traverse(n, i=0): print(' ' * i, end="") print(n.kind, end="") print(" : ", end="") print(n.spelling, end="") print("") for c in n.get_children(): traverse(c, i=i+1) def main(afile): #clang.cindex.Config.set_library_file('C:/Program Files (x86)/LLVM/bin/libclang.dll') index = clang.cindex.Index.create() translation_unit = index.parse(afile, ['-x', '..
python-clang : 인클루드 파일 파싱 하기 예제 cindex-includes.py #===- cindex-includes.py - cindex/Python Inclusion Graph -----*- python -*--===# # # The LLVM Compiler Infrastructure # # This file is distributed under the University of Illinois Open Source # License. See LICENSE.TXT for details. # #===------------------------------------------------------------------------===# """ A simple command line tool for dumping a Graphviz descriptio..
python-clang 설정관련 Ubuntu 18.04 64bit 작업중... 1. libclang.so 못찾을때 ppiazi@ppiazi-VirtualBox:~/work/clang-example$ python3 cindex-includes.py sample.cpp Traceback (most recent call last): File "/home/ppiazi/.local/lib/python3.6/site-packages/clang/cindex.py", line 4129, in get_cindex_library library = cdll.LoadLibrary(self.get_filename()) File "/home/ppiazi/miniconda3/lib/python3.6/ctypes/__init__.py", line 426, in L..
FIR 관련 이미지
docx template로 작업하기 예제 코드 워드 문서 템플릿에 원하는 내용을 넣어 저장해보자. 사용하는 python 모듈은 다음과 같다. - https://pypi.python.org/pypi/docx-mailmerge 소스코드 from mailmerge import MailMerge template = "template.docx" document = MailMerge(template) print(document.get_merge_fields()) source = """ int main(int argc, char **argv) { printf("Hello World"); return 0; } """ document.merge( DR_Title = "Test Deviation Report", DR_Reviewer = "Joohyun Lee", DR..
catex :: 소스코드 특정 위치 지정하여 출력하는 유틸리티 cat / head / tail / less 등을 사용하면 타켓 파일의 특정 위치를 출력할 수 있다. 하지만, 파일의 중간 지점을 지정하여, 원하는 블럭 만큼 출력하는 유틸리티가 없어 직접 만들었다. 특히 인풋으로 타켓 파일 / 라인 위치 / Upper Bound / Lower Bound 지정한 csv 파일을 인풋으로 주면, 일괄 출력을 할 수 있도록 하였다. 기본적인 출력 모습은 아래와 같다. 아래 위치에 소스코드를 확인할 수 있다.https://github.com/ppiazi/catex