Download:
child 145:9c65d66fcda1
parent 143:8bf724bad83b
144:e9e0737e1b6e
Anton Shestakov <av6@dwimlabs.net>, Sun, 17 Jul 2016 05:10:35 +0800
utils: a small module for shared functions, the first of them is rel()

4 файлов изменено, 11 вставок(+), 10 удалений(-) [+]
candolint/utils.py file | annotate | diff | comparison | revisions
checker.py file | annotate | diff | comparison | revisions
incoming.py file | annotate | diff | comparison | revisions
viewer.py file | annotate | diff | comparison | revisions
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/candolint/utils.py Sun Jul 17 05:10:35 2016 +0800
@@ -0,0 +1,8 @@
+from __future__ import absolute_import
+
+
+from os.path import abspath, dirname, join
+
+
+def rel(*parts):
+ return abspath(join(dirname(dirname(__file__)), *parts))
--- a/checker.py Sun Jul 17 01:15:16 2016 +0800
+++ b/checker.py Sun Jul 17 05:10:35 2016 +0800
@@ -11,8 +11,7 @@
import yaml
-
-rel = lambda *x: os.path.abspath(os.path.join(os.path.dirname(__file__), *x))
+from candolint.utils import rel
def run_ignore_codes(fn, args, codes):
--- a/incoming.py Sun Jul 17 01:15:16 2016 +0800
+++ b/incoming.py Sun Jul 17 05:10:35 2016 +0800
@@ -2,7 +2,6 @@
from __future__ import absolute_import
import logging
-import os
import re
import sys
from argparse import ArgumentParser, FileType
@@ -12,9 +11,7 @@
from tornado.escape import json_encode
from candolint.models import database, Project, Change, Check
-
-
-rel = lambda *x: os.path.abspath(os.path.join(os.path.dirname(__file__), *x))
+from candolint.utils import rel
def parse_timestamp(value):
--- a/viewer.py Sun Jul 17 01:15:16 2016 +0800
+++ b/viewer.py Sun Jul 17 05:10:35 2016 +0800
@@ -2,7 +2,6 @@
from __future__ import absolute_import
import logging
-import os
from tornado.ioloop import IOLoop
from tornado.options import define, options
@@ -11,9 +10,7 @@
from candolint import uimodules
from candolint.handlers import IndexHandler, ProjectHandler, CheckHandler, StatusHandler, ErrorHandler
from candolint.models import database
-
-
-rel = lambda *x: os.path.abspath(os.path.join(os.path.dirname(__file__), *x))
+from candolint.utils import rel
define('listen', metavar='IP', default='127.0.0.1')