From ad5f2b65a729b1aab34b8a7c570a8c59bb42443e Mon Sep 17 00:00:00 2001 From: Jinglei Ren Date: Wed, 6 Sep 2017 23:53:52 +0800 Subject: [PATCH] Rename lib to persper, and remove direct sys.path setting in notebooks --- notebooks/apache_devrank.ipynb | 3 -- notebooks/call_graph_cpp.ipynb | 10 +++-- notebooks/commit_graph_demo.ipynb | 3 -- notebooks/fs_patch_classification.ipynb | 2 - notebooks/jira_issue_classification.ipynb | 2 - notebooks/linux_kernel.ipynb | 12 ++++-- notebooks/process_fs_patch.ipynb | 13 ++++--- notebooks/process_jira_issue.ipynb | 4 -- notebooks/test_processor.ipynb | 6 +-- notebooks/weight_opt.ipynb | 37 ++++++++++++++----- {lib => persper}/__init__.py | 0 {lib => persper}/classifier.py | 0 {lib => persper}/extractor.py | 0 {lib => persper}/graphs/__init__.py | 0 {lib => persper}/graphs/call_commit_graph.py | 0 .../graphs/call_graph/__init__.py | 0 {lib => persper}/graphs/call_graph/c.py | 0 {lib => persper}/graphs/call_graph/cpp.py | 0 {lib => persper}/graphs/call_graph/java.py | 0 {lib => persper}/graphs/call_graph/utils.py | 0 {lib => persper}/graphs/commit_graph.py | 0 {lib => persper}/graphs/cpp_tools.py | 0 {lib => persper}/graphs/detect_change.py | 0 {lib => persper}/graphs/devrank.py | 0 {lib => persper}/graphs/git_tools.py | 0 {lib => persper}/graphs/pagerank.py | 0 {lib => persper}/graphs/parse_patch.py | 0 {lib => persper}/graphs/patch_parser.py | 0 {lib => persper}/graphs/processor.py | 0 {lib => persper}/graphs/ruby_tools.py | 0 {lib => persper}/graphs/srcml.py | 0 {lib => persper}/graphs/write_graph_to_dot.py | 0 {lib => persper}/labeler.py | 0 33 files changed, 54 insertions(+), 38 deletions(-) rename {lib => persper}/__init__.py (100%) rename {lib => persper}/classifier.py (100%) rename {lib => persper}/extractor.py (100%) rename {lib => persper}/graphs/__init__.py (100%) rename {lib => persper}/graphs/call_commit_graph.py (100%) rename {lib => persper}/graphs/call_graph/__init__.py (100%) rename {lib => persper}/graphs/call_graph/c.py (100%) rename {lib => persper}/graphs/call_graph/cpp.py (100%) rename {lib => persper}/graphs/call_graph/java.py (100%) rename {lib => persper}/graphs/call_graph/utils.py (100%) rename {lib => persper}/graphs/commit_graph.py (100%) rename {lib => persper}/graphs/cpp_tools.py (100%) rename {lib => persper}/graphs/detect_change.py (100%) rename {lib => persper}/graphs/devrank.py (100%) rename {lib => persper}/graphs/git_tools.py (100%) rename {lib => persper}/graphs/pagerank.py (100%) rename {lib => persper}/graphs/parse_patch.py (100%) rename {lib => persper}/graphs/patch_parser.py (100%) rename {lib => persper}/graphs/processor.py (100%) rename {lib => persper}/graphs/ruby_tools.py (100%) rename {lib => persper}/graphs/srcml.py (100%) rename {lib => persper}/graphs/write_graph_to_dot.py (100%) rename {lib => persper}/labeler.py (100%) diff --git a/notebooks/apache_devrank.ipynb b/notebooks/apache_devrank.ipynb index cb3a22a9dc3..ada7697b849 100644 --- a/notebooks/apache_devrank.ipynb +++ b/notebooks/apache_devrank.ipynb @@ -23,9 +23,6 @@ "outputs": [], "source": [ "# import dependencies and set default alpha value\n", - "import sys\n", - "if '../lib' not in sys.path: sys.path.append('../lib')\n", - "\n", "import math\n", "import pickle\n", "import pprint\n", diff --git a/notebooks/call_graph_cpp.ipynb b/notebooks/call_graph_cpp.ipynb index 5eeaa77356e..3bb1f4e87ef 100644 --- a/notebooks/call_graph_cpp.ipynb +++ b/notebooks/call_graph_cpp.ipynb @@ -4,14 +4,12 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, "outputs": [], "source": [ - "import sys\n", - "if '../lib' not in sys.path: sys.path.append('../lib')\n", - "\n", "import numpy as np\n", "from lxml import etree\n", "from numpy import linalg as LA\n", @@ -75,6 +73,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, @@ -236,6 +235,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, @@ -287,6 +287,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, @@ -299,6 +300,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, @@ -311,6 +313,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, @@ -323,6 +326,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": true, "deletable": true, "editable": true }, diff --git a/notebooks/commit_graph_demo.ipynb b/notebooks/commit_graph_demo.ipynb index 7d6ba7e9ae1..f02badcdf43 100644 --- a/notebooks/commit_graph_demo.ipynb +++ b/notebooks/commit_graph_demo.ipynb @@ -6,9 +6,6 @@ "metadata": {}, "outputs": [], "source": [ - "import sys\n", - "sys.path.append('../lib')\n", - "\n", "from graphs.commit_graph import draw_commit_graph" ] }, diff --git a/notebooks/fs_patch_classification.ipynb b/notebooks/fs_patch_classification.ipynb index 0490f53b75f..7a7c4e8b95b 100644 --- a/notebooks/fs_patch_classification.ipynb +++ b/notebooks/fs_patch_classification.ipynb @@ -15,8 +15,6 @@ }, "outputs": [], "source": [ - "import sys\n", - "sys.path.append('../lib')\n", "import classifier\n", "from classifier import binary_bug, multi_patch_type, limited_patch_type, only_bug_filter, stem, lemmatize\n", "from sklearn.svm import LinearSVC\n", diff --git a/notebooks/jira_issue_classification.ipynb b/notebooks/jira_issue_classification.ipynb index 231f4ffe87e..0e81155301d 100644 --- a/notebooks/jira_issue_classification.ipynb +++ b/notebooks/jira_issue_classification.ipynb @@ -8,8 +8,6 @@ }, "outputs": [], "source": [ - "import sys\n", - "sys.path.append('../lib')\n", "import classifier\n", "from classifier import binary_bug, multi_patch_type, limited_patch_type, only_bug_filter, stem, lemmatize\n", "from sklearn.svm import LinearSVC\n", diff --git a/notebooks/linux_kernel.ipynb b/notebooks/linux_kernel.ipynb index 31cd88d5258..ee26fd27e7c 100644 --- a/notebooks/linux_kernel.ipynb +++ b/notebooks/linux_kernel.ipynb @@ -4,14 +4,12 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, "outputs": [], "source": [ - "import sys\n", - "if '../lib' not in sys.path: sys.path.append('../lib')\n", - "\n", "import glob\n", "import pdb\n", "import cProfile\n", @@ -28,6 +26,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, @@ -47,6 +46,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, @@ -62,6 +62,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, @@ -77,6 +78,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, @@ -91,6 +93,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": true, "deletable": true, "editable": true }, @@ -145,6 +148,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, @@ -157,6 +161,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, @@ -169,6 +174,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": true, "deletable": true, "editable": true }, diff --git a/notebooks/process_fs_patch.ipynb b/notebooks/process_fs_patch.ipynb index 8576d95c88a..da6f236da6d 100644 --- a/notebooks/process_fs_patch.ipynb +++ b/notebooks/process_fs_patch.ipynb @@ -14,13 +14,12 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": true, "deletable": true, "editable": true }, "outputs": [], "source": [ - "import sys\n", - "sys.path.append('../lib')\n", "import extractor" ] }, @@ -28,6 +27,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": true, "deletable": true, "editable": true }, @@ -61,6 +61,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": true, "deletable": true, "editable": true }, @@ -80,14 +81,12 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, "outputs": [], "source": [ - "import sys\n", - "if '../lib' not in sys.path: sys.path.append('../lib')\n", - "\n", "from git import Commit\n", "from graphs.patch_parser import PatchParser\n", "\n", @@ -134,6 +133,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": true, "deletable": true, "editable": true }, @@ -162,6 +162,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": true, "deletable": true, "editable": true }, @@ -188,6 +189,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": true, "deletable": true, "editable": true }, @@ -211,6 +213,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": true, "deletable": true, "editable": true }, diff --git a/notebooks/process_jira_issue.ipynb b/notebooks/process_jira_issue.ipynb index a405c86b16c..f16fab7bc67 100644 --- a/notebooks/process_jira_issue.ipynb +++ b/notebooks/process_jira_issue.ipynb @@ -8,8 +8,6 @@ }, "outputs": [], "source": [ - "import sys\n", - "sys.path.append('../lib')\n", "import extractor" ] }, @@ -98,8 +96,6 @@ "outputs": [], "source": [ "# import the labeler lib\n", - "import sys\n", - "sys.path.append('../lib')\n", "import labeler\n", "from labeler import apache_type" ] diff --git a/notebooks/test_processor.ipynb b/notebooks/test_processor.ipynb index d9d5bafaa52..8c695fbf2c7 100644 --- a/notebooks/test_processor.ipynb +++ b/notebooks/test_processor.ipynb @@ -4,14 +4,12 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, "outputs": [], "source": [ - "import sys\n", - "if '../lib' not in sys.path: sys.path.append('../lib')\n", - "\n", "from graphs.processor import Processor\n", "\n", "p = Processor('../repos/linux-kernel')" @@ -21,6 +19,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "deletable": true, "editable": true }, @@ -33,6 +32,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": true, "deletable": true, "editable": true }, diff --git a/notebooks/weight_opt.ipynb b/notebooks/weight_opt.ipynb index 7dd12106233..c3c7f047460 100644 --- a/notebooks/weight_opt.ipynb +++ b/notebooks/weight_opt.ipynb @@ -22,7 +22,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "scrolled": false + }, "outputs": [], "source": [ "import numpy as np\n", @@ -50,7 +52,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "scrolled": false + }, "outputs": [], "source": [ "lower_bound = [1, 1, 1, 1] # Min of each weight\n", @@ -78,7 +82,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "scrolled": false + }, "outputs": [], "source": [ "from pyswarm import pso\n", @@ -92,7 +98,9 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "collapsed": true + }, "source": [ "## Persper-specific processing" ] @@ -107,7 +115,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true, + "scrolled": true + }, "outputs": [], "source": [ "import pickle\n", @@ -127,11 +138,12 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true, + "scrolled": true + }, "outputs": [], "source": [ - "import sys\n", - "sys.path.append('../lib')\n", "import labeler\n", "from labeler import apache_type\n", "\n", @@ -164,7 +176,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true, + "scrolled": true + }, "outputs": [], "source": [ "def get_commit_type(datasets, repo_name):\n", @@ -183,7 +198,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "scrolled": false + }, "outputs": [], "source": [] } diff --git a/lib/__init__.py b/persper/__init__.py similarity index 100% rename from lib/__init__.py rename to persper/__init__.py diff --git a/lib/classifier.py b/persper/classifier.py similarity index 100% rename from lib/classifier.py rename to persper/classifier.py diff --git a/lib/extractor.py b/persper/extractor.py similarity index 100% rename from lib/extractor.py rename to persper/extractor.py diff --git a/lib/graphs/__init__.py b/persper/graphs/__init__.py similarity index 100% rename from lib/graphs/__init__.py rename to persper/graphs/__init__.py diff --git a/lib/graphs/call_commit_graph.py b/persper/graphs/call_commit_graph.py similarity index 100% rename from lib/graphs/call_commit_graph.py rename to persper/graphs/call_commit_graph.py diff --git a/lib/graphs/call_graph/__init__.py b/persper/graphs/call_graph/__init__.py similarity index 100% rename from lib/graphs/call_graph/__init__.py rename to persper/graphs/call_graph/__init__.py diff --git a/lib/graphs/call_graph/c.py b/persper/graphs/call_graph/c.py similarity index 100% rename from lib/graphs/call_graph/c.py rename to persper/graphs/call_graph/c.py diff --git a/lib/graphs/call_graph/cpp.py b/persper/graphs/call_graph/cpp.py similarity index 100% rename from lib/graphs/call_graph/cpp.py rename to persper/graphs/call_graph/cpp.py diff --git a/lib/graphs/call_graph/java.py b/persper/graphs/call_graph/java.py similarity index 100% rename from lib/graphs/call_graph/java.py rename to persper/graphs/call_graph/java.py diff --git a/lib/graphs/call_graph/utils.py b/persper/graphs/call_graph/utils.py similarity index 100% rename from lib/graphs/call_graph/utils.py rename to persper/graphs/call_graph/utils.py diff --git a/lib/graphs/commit_graph.py b/persper/graphs/commit_graph.py similarity index 100% rename from lib/graphs/commit_graph.py rename to persper/graphs/commit_graph.py diff --git a/lib/graphs/cpp_tools.py b/persper/graphs/cpp_tools.py similarity index 100% rename from lib/graphs/cpp_tools.py rename to persper/graphs/cpp_tools.py diff --git a/lib/graphs/detect_change.py b/persper/graphs/detect_change.py similarity index 100% rename from lib/graphs/detect_change.py rename to persper/graphs/detect_change.py diff --git a/lib/graphs/devrank.py b/persper/graphs/devrank.py similarity index 100% rename from lib/graphs/devrank.py rename to persper/graphs/devrank.py diff --git a/lib/graphs/git_tools.py b/persper/graphs/git_tools.py similarity index 100% rename from lib/graphs/git_tools.py rename to persper/graphs/git_tools.py diff --git a/lib/graphs/pagerank.py b/persper/graphs/pagerank.py similarity index 100% rename from lib/graphs/pagerank.py rename to persper/graphs/pagerank.py diff --git a/lib/graphs/parse_patch.py b/persper/graphs/parse_patch.py similarity index 100% rename from lib/graphs/parse_patch.py rename to persper/graphs/parse_patch.py diff --git a/lib/graphs/patch_parser.py b/persper/graphs/patch_parser.py similarity index 100% rename from lib/graphs/patch_parser.py rename to persper/graphs/patch_parser.py diff --git a/lib/graphs/processor.py b/persper/graphs/processor.py similarity index 100% rename from lib/graphs/processor.py rename to persper/graphs/processor.py diff --git a/lib/graphs/ruby_tools.py b/persper/graphs/ruby_tools.py similarity index 100% rename from lib/graphs/ruby_tools.py rename to persper/graphs/ruby_tools.py diff --git a/lib/graphs/srcml.py b/persper/graphs/srcml.py similarity index 100% rename from lib/graphs/srcml.py rename to persper/graphs/srcml.py diff --git a/lib/graphs/write_graph_to_dot.py b/persper/graphs/write_graph_to_dot.py similarity index 100% rename from lib/graphs/write_graph_to_dot.py rename to persper/graphs/write_graph_to_dot.py diff --git a/lib/labeler.py b/persper/labeler.py similarity index 100% rename from lib/labeler.py rename to persper/labeler.py