File tree Expand file tree Collapse file tree 6 files changed +44
-33
lines changed Expand file tree Collapse file tree 6 files changed +44
-33
lines changed Original file line number Diff line number Diff line change 16
16
import unittest
17
17
import tempfile
18
18
from collections import namedtuple
19
+
19
20
from zxtools import hobeta
20
- from zxtools import safe_parse_args
21
+ from zxtools .common import safe_parse_args
22
+
21
23
from mock import patch
22
24
23
25
Original file line number Diff line number Diff line change 19
19
from mock import patch
20
20
21
21
from zxtools import zeus2txt
22
- from zxtools import safe_parse_args
22
+ from zxtools . common import safe_parse_args
23
23
24
24
25
25
Original file line number Diff line number Diff line change 7
7
# Licensed under the BSD 3-Clause license.
8
8
# See LICENSE file in the project root for full license information.
9
9
#
10
- """Global constants and templates are here"""
11
-
12
- import sys
13
- import logging
10
+ """Global constants"""
14
11
15
12
__version__ = '1.0.23'
16
13
CHUNK_SIZE = 512 * 1024 # 512 KBytes
17
-
18
-
19
- def safe_parse_args (parser , args ):
20
- """Safely parse arguments"""
21
- try :
22
- options = parser .parse_args (args )
23
- if len (args ) == 0 :
24
- raise ValueError
25
- except ValueError :
26
- parser .print_help ()
27
- sys .exit (0 )
28
-
29
- return options
30
-
31
-
32
- def default_main (parser ):
33
- """ Default entry point implementation """
34
- args = safe_parse_args (parser , sys .argv [1 :])
35
- if args .verbose :
36
- logging .basicConfig (level = logging .DEBUG )
37
-
38
- if hasattr (args , 'func' ):
39
- args .func (args )
40
-
41
- return args
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ # Copyright (c) 2016 Kirill V. Lyadvinsky
5
+ # http://www.codeatcpp.com
6
+ # Licensed under the BSD 3-Clause license.
7
+ # See LICENSE file in the project root for full license information.
8
+ #
9
+ """ Common functions """
10
+
11
+ import sys
12
+ import logging
13
+
14
+
15
+ def safe_parse_args (parser , args ):
16
+ """Safely parse arguments"""
17
+ try :
18
+ options = parser .parse_args (args )
19
+ if len (args ) == 0 :
20
+ raise ValueError
21
+ except ValueError :
22
+ parser .print_help ()
23
+ sys .exit (0 )
24
+
25
+ return options
26
+
27
+
28
+ def default_main (parser ):
29
+ """ Default entry point implementation """
30
+ args = safe_parse_args (parser , sys .argv [1 :])
31
+ if args .verbose :
32
+ logging .basicConfig (level = logging .DEBUG )
33
+
34
+ if hasattr (args , 'func' ):
35
+ args .func (args )
36
+
37
+ return args
Original file line number Diff line number Diff line change 16
16
import argparse
17
17
18
18
from zxtools import CHUNK_SIZE
19
- from zxtools import default_main
19
+ from zxtools . common import default_main
20
20
21
21
HEADER_FMT = '<8sBHHBBH'
22
22
Header = namedtuple (
Original file line number Diff line number Diff line change 14
14
import io
15
15
16
16
from zxtools import CHUNK_SIZE
17
- from zxtools import default_main
17
+ from zxtools . common import default_main
18
18
19
19
CODE_ALIGN_WIDTH = 35
20
20
You can’t perform that action at this time.
0 commit comments