|
def | __init__ (self, name) |
|
def | internalCalculating (self, dataDict, buf) |
|
def | precalculate (self, result, metricName) |
|
def | __init__ (self, names) |
|
def | retForMultiNames (self, retDict, metricName) |
|
def | sortElementsByMetric (self, elements, metricName) |
|
def | selectElementsByMetric (self, elements, metricName, metricLimitMax, metricLimitMin) |
|
Definition at line 27 of file MetricContentSize.py.
◆ __init__()
def algorithms.MetricContentSize.MetricContentSize.__init__ |
( |
|
self, |
|
|
|
name |
|
) |
| |
◆ internalCalculating()
def algorithms.MetricContentSize.MetricContentSize.internalCalculating |
( |
|
self, |
|
|
|
dataDict, |
|
|
|
buf |
|
) |
| |
Definition at line 42 of file MetricContentSize.py.
42 def internalCalculating(self, dataDict, buf):
43 if type(buf)
is types.StringType:
45 if type(buf)
is types.UnicodeType:
47 if unicodedata.category(ch)
in self.CHAR_CATEGORIES_LIST:
48 dataDict[
"validCharsCount"] += 1
49 dataDict[
"count"] += 1
◆ precalculate()
def algorithms.MetricContentSize.MetricContentSize.precalculate |
( |
|
self, |
|
|
|
result, |
|
|
|
metricName |
|
) |
| |
Definition at line 56 of file MetricContentSize.py.
56 def precalculate(self, result, metricName):
57 ret = {
"count": 0,
"percent": 0,
"validCharsCount": 0}
58 for key
in result.tags:
59 if type(result.tags[key])
is types.DictType
and "data" in result.tags[key]:
60 if type(result.tags[key][
"data"])
in types.StringTypes:
61 self.internalCalculating(ret, result.tags[key][
"data"])
62 elif type(result.tags[key][
"data"])
is types.ListType:
63 for buf
in result.tags[key][
"data"]:
64 self.internalCalculating(ret, buf)
66 ret[
"percent"] = ret[
"validCharsCount"] * 100 / ret[
"count"]
67 ret = self.retForMultiNames(ret, metricName)
◆ CHAR_CATEGORIES_LIST
list algorithms.MetricContentSize.MetricContentSize.CHAR_CATEGORIES_LIST = ['Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nd', 'Nl', 'No'] |
|
static |
The documentation for this class was generated from the following file: