Skip to content

Commit 57d9d02

Browse files
committed
Improve some more doctstrings
1 parent b60f88a commit 57d9d02

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

pygccxml/utils/utils.py

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Distributed under the Boost Software License, Version 1.0.
44
# See http://www.boost.org/LICENSE_1_0.txt
55

6-
"""defines logger classes and few convenience methods, not related to the
6+
"""Defines logger classes and few convenience methods, not related to the
77
declarations tree"""
88

99
import os
@@ -21,11 +21,9 @@ def is_str(s):
2121

2222

2323
def _create_logger_(name):
24-
"""implementation details"""
24+
"""Implementation detail, creates a logger."""
2525
logger = logging.getLogger(name)
2626
handler = logging.StreamHandler()
27-
# handler.setFormatter( logging.Formatter( os.linesep + '%(levelname)s
28-
# %(message)s' ) )
2927
handler.setFormatter(logging.Formatter('%(levelname)s %(message)s'))
3028
logger.addHandler(handler)
3129
logger.setLevel(logging.INFO)
@@ -34,10 +32,10 @@ def _create_logger_(name):
3432

3533
class loggers:
3634

37-
"""class-namespace, defines few loggers classes, used in the project"""
35+
"""Class-namespace, defines few loggers classes, used in the project"""
3836

3937
cxx_parser = _create_logger_('pygccxml.cxx_parser')
40-
"""logger for C++ parser functionality
38+
"""Logger for C++ parser functionality
4139
4240
If you set this logger level to DEBUG, you will be able to see the exact
4341
command line, used to invoke GCC-XML and errors that occures during XML
@@ -48,11 +46,11 @@ class loggers:
4846

4947
pdb_reader = _create_logger_('pygccxml.pdb_reader')
5048
"""
51-
logger for MS .pdb file reader functionality
49+
Logger for MS .pdb file reader functionality
5250
"""
5351

5452
queries_engine = _create_logger_('pygccxml.queries_engine')
55-
"""logger for query engine functionality.
53+
"""Logger for query engine functionality.
5654
5755
If you set this logger level to DEBUG, you will be able to see what queries
5856
you do against declarations tree, measure performance and may be even to
@@ -61,7 +59,7 @@ class loggers:
6159
"""
6260

6361
declarations_cache = _create_logger_('pygccxml.declarations_cache')
64-
"""logger for declarations tree cache functionality
62+
"""Logger for declarations tree cache functionality
6563
6664
If you set this logger level to DEBUG, you will be able to see what is
6765
exactly happens, when you read the declarations from cache file. You will
@@ -70,14 +68,14 @@ class loggers:
7068
"""
7169

7270
root = logging.getLogger('pygccxml')
73-
"""root logger exists for your convenience only"""
71+
"""Root logger exists for your convenience only"""
7472

7573
all = [root, cxx_parser, queries_engine, declarations_cache, pdb_reader]
76-
"""contains all logger classes, defined by the class"""
74+
"""Contains all logger classes, defined by the class"""
7775

7876

7977
def remove_file_no_raise(file_name):
80-
"""removes file from disk, if exception is raised, it silently
78+
"""Removes file from disk, if exception is raised, it silently
8179
ignores it"""
8280
try:
8381
if os.path.exists(file_name):
@@ -89,10 +87,10 @@ def remove_file_no_raise(file_name):
8987

9088

9189
def create_temp_file_name(suffix, prefix=None, dir=None):
92-
"""small convenience function that creates temporal file.
90+
"""Small convenience function that creates temporary files.
9391
94-
This function is a wrapper aroung Python built-in
95-
function - tempfile.mkstemp
92+
This function is a wrapper around the Python built-in
93+
function tempfile.mkstemp
9694
"""
9795
if not prefix:
9896
prefix = tempfile.gettempprefix()
@@ -103,12 +101,12 @@ def create_temp_file_name(suffix, prefix=None, dir=None):
103101

104102

105103
def normalize_path(some_path):
106-
"""return os.path.normpath( os.path.normcase( some_path ) )"""
104+
"""Return os.path.normpath(os.path.normcase(some_path))"""
107105
return os.path.normpath(os.path.normcase(some_path))
108106

109107

110108
def contains_parent_dir(fpath, dirs):
111-
"""returns bool( filter( lambda dir: fpath.startswith( dir ), dirs ) )
109+
"""Returns bool(filter(lambda dir: fpath.startswith(dir), dirs))
112110
precondition: dirs and fpath should be normalize_path'ed before calling
113111
this function
114112
"""
@@ -117,7 +115,7 @@ def contains_parent_dir(fpath, dirs):
117115

118116

119117
def get_architecture():
120-
"""returns computer architecture: 32 or 64.
118+
"""Returns computer architecture: 32 or 64.
121119
122120
The guess is based on maxint.
123121
"""
@@ -135,7 +133,7 @@ def get_architecture():
135133
# Thanks to Michele Simionato, for it
136134
class cached(property):
137135

138-
'Convert a method into a cached attribute'
136+
"""Convert a method into a cached attribute"""
139137

140138
def __init__(self, method):
141139
private = '_' + method.__name__
@@ -198,7 +196,7 @@ def name_of(cls, enum_numeric_value):
198196

199197
class native_compiler:
200198

201-
"""provides information about the compiler, which was used to build the
199+
"""Provides information about the compiler, which was used to build the
202200
Python executable"""
203201

204202
@staticmethod

0 commit comments

Comments
 (0)