Skip to content

Commit 7904691

Browse files
authored
Merge pull request #11 from zmx27/fix-flake8-configtraits
style: fix flake8 errors for configtraits.py
2 parents 554a92c + 7bedcce commit 7904691

File tree

1 file changed

+14
-34
lines changed

1 file changed

+14
-34
lines changed

src/diffpy/srxconfutils/configtraits.py

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,59 +15,32 @@
1515
configurations file, parse arguments from command lines, and also parse
1616
arguments passed from method/function calling inside python.
1717
18-
This one is similar to ConfigBase but use Traits, so every option (self.*option* is a trait)
19-
20-
Note: for python 2.6, argparse and orderedDict is required, install them with easy_install
18+
This one is similar to ConfigBase but use Traits, so every option
19+
(self.*option* is a trait) can be observed and have a GUI interface.
2120
"""
2221

23-
import argparse
24-
import os
25-
import re
26-
import sys
27-
from configparser import ConfigParser
28-
from functools import partial
29-
3022
from traits.api import (
3123
Array,
3224
Bool,
3325
CFloat,
3426
CInt,
3527
Directory,
3628
Enum,
37-
Event,
3829
File,
39-
Float,
4030
HasTraits,
41-
Instance,
42-
Int,
4331
List,
44-
Property,
45-
Range,
46-
Str,
4732
String,
48-
cached_property,
49-
on_trait_change,
5033
)
51-
from traitsui.api import Group, Item, View
5234

5335
from diffpy.srxconfutils.config import ConfigBase
54-
from diffpy.srxconfutils.tools import (
55-
StrConv,
56-
_configPropertyR,
57-
_configPropertyRad,
58-
_configPropertyRW,
59-
opt2Str,
60-
str2bool,
61-
str2Opt,
62-
)
6336

6437

6538
class ConfigBaseTraits(HasTraits, ConfigBase):
6639
"""_optdatalist_default, _optdatalist are metadata used to
6740
initialize the options, see below for examples.
6841
69-
options presents in --help (in cmd), config file, headers have same order as
70-
in these list, so arrange them in right order here.
42+
options presents in --help (in cmd), config file, headers have
43+
same order as in these list, so arrange them in right order here.
7144
7245
optional args to control if the options presents in args, config file or
7346
file header
@@ -165,7 +138,10 @@ class ConfigBaseTraits(HasTraits, ConfigBase):
165138
"sec": "Control",
166139
"config": "n",
167140
"header": "n",
168-
"h": "create a config file according to default or current values",
141+
"h": (
142+
"create a config file according to "
143+
"default or current values"
144+
),
169145
"d": "",
170146
},
171147
],
@@ -269,8 +245,12 @@ class ConfigBaseTraits(HasTraits, ConfigBase):
269245
"config": "f",
270246
"tt": "array",
271247
"l": "Mask edges",
272-
"h": "mask the edge pixels, first four means the number of pixels masked in each edge \
273-
(left, right, top, bottom), the last one is the radius of a region masked around the corner",
248+
"h": (
249+
"mask the edge pixels, first four means "
250+
"the number of pixels masked in each edge "
251+
"(left, right, top, bottom), the last one is the "
252+
"radius of a region masked around the corner"
253+
),
274254
"n": 5,
275255
"d": [10, 10, 10, 10, 100],
276256
},

0 commit comments

Comments
 (0)