Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if not line:
return None
res.append(line)
return ''.join(res), lang
with io.open(include_path, 'r', encoding='utf-8') as _:
return _.read(), lang
# pylint: disable=too-many-instance-attributes
class Project(object):
"""
Banana banana
"""
formatted_signal = Signal()
def __init__(self):
self.output = None
self.tree = None
self.change_tracker = None
self.output_format = None
self.include_paths = None
self.extensions = {}
self.tag_validators = {}
self.link_resolver = None
self.incremental = False
self.database = None
self.config = None
self.project_name = None
self.project_version = None
self.sitemap_path = None
self.app = app
if self.app.incremental:
self.__all_pages = self.__load_private(
'pages-%s.p' % self.project.sanitized_name)
else:
self.__all_pages = {}
self.__placeholders = {}
self.root = None
self.__dep_map = project.dependency_map
self.__fill_dep_map()
cmark.hotdoc_to_ast(u'', self)
self.__extensions = {}
self.resolve_placeholder_signal = Signal(optimized=True)
self.list_override_pages_signal = Signal(optimized=True)
self.update_signal = Signal()
self.resolving_symbol_signal = Signal()
def __init__(self, private_folder):
self.comment_added_signal = Signal()
self.__comments = OrderedDict()
self.__symbols = OrderedDict()
self.__aliased = defaultdict(list)
self.__aliases = OrderedDict()
self.__private_folder = private_folder or '/tmp'
from hotdoc.utils.signals import Signal
def dict_to_html_attrs(dict_):
"""
Banana banana
"""
res = ' '.join('%s="%s"' % (k, v) for k, v in dict_.items())
return res
class Link:
"""
Banana banana
"""
resolving_title_signal = Signal()
def __init__(self, ref, title, id_, mandatory=False):
self.ref = None
self._title = None
# Whether the link should be always resolved when true and a warning
# otherwise
self.__mandatory = mandatory
# Ensure we warn only once for a unresolved mandatory link
self.__warned = False
if title:
self._title = str(title)
if ref:
self.ref = str(ref)
self.id_ = id_
def __init__(self, database):
self.__links = {}
self.__doc_db = database
self.get_link_signal = Signal()
self.resolving_link_signal = Signal(optimized=True)
self._ordering = [InterfaceSymbol, ClassSymbol, ConstructorSymbol,
MethodSymbol, ClassMethodSymbol, FunctionSymbol,
FunctionMacroSymbol, SignalSymbol, PropertySymbol,
StructSymbol, VFunctionSymbol, EnumSymbol,
ConstantSymbol, ExportedVariableSymbol, AliasSymbol,
CallbackSymbol]
self._docstring_formatter = self._make_docstring_formatter()
self._current_page = None
self.extra_assets = None
self.add_anchors = False
self.number_headings = False
self.writing_page_signal = Signal()
self.formatting_page_signal = Signal()
self.formatting_symbol_signal = Signal()
self._order_by_parent = False
self.__cache_dir = os.path.join(self.extension.app.private_folder,
'cache')
self.__page_transform = etree.XSLT(XSLT_PAGE_TRANSFORM)
def test_connect_func(self):
"""Banana Banana"""
called = []
def func(arg, extra_arg):
"""Banana Banana"""
self.assertEqual(arg, 1)
self.assertEqual(extra_arg, "extra")
called.append(True)
signal = Signal()
signal.connect(func, "extra")
signal(1)
self.assertEqual(called, [True])
self.extra_asset_folders = OrderedSet()
self.extra_assets = {}
if dependency_map is None:
self.dependency_map = {}
else:
self.dependency_map = dependency_map
if os.name == 'nt':
self.datadir = os.path.join(
os.path.dirname(__file__), '..', 'share')
else:
self.datadir = "/usr/share"
self.formatted_signal = Signal()
self.written_out_signal = Signal()
self.is_toplevel = False
self.__all_pages = self.__load_private(
'pages-%s.p' % self.project.sanitized_name)
else:
self.__all_pages = {}
self.__placeholders = {}
self.root = None
self.__dep_map = project.dependency_map
self.__fill_dep_map()
cmark.hotdoc_to_ast(u'', self)
self.__extensions = {}
self.resolve_placeholder_signal = Signal(optimized=True)
self.list_override_pages_signal = Signal(optimized=True)
self.update_signal = Signal()
self.resolving_symbol_signal = Signal()
self.subprojects = {}
self.extra_asset_folders = OrderedSet()
self.extra_assets = {}
if dependency_map is None:
self.dependency_map = {}
else:
self.dependency_map = dependency_map
if os.name == 'nt':
self.datadir = os.path.join(
os.path.dirname(__file__), '..', 'share')
else:
self.datadir = "/usr/share"
self.formatted_signal = Signal()
self.written_out_signal = Signal()
self.is_toplevel = False