/usr/lib/python2.7/dist-packages/ufl/classes.py is in python-ufl 2017.2.0.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | # -*- coding: utf-8 -*-
# flake8: noqa
"""This file is useful for external code like tests and form compilers,
since it enables the syntax "from ufl.classes import CellFacetooBar" for getting
implementation details not exposed through the default ufl namespace.
It also contains functionality used by algorithms for dealing with groups
of classes, and for mapping types to different handler functions."""
# Copyright (C) 2008-2016 Martin Sandve Alnæs
#
# This file is part of UFL.
#
# UFL is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# UFL is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with UFL. If not, see <http://www.gnu.org/licenses/>.
#
# Modified by Anders Logg, 2009.
# Modified by Kristian B. Oelgaard, 2011
# Modified by Andrew T. T. McRae, 2014
# This will be populated part by part below
__all__ = []
from ufl.utils.py23 import as_native_strings
# Import all submodules, triggering execution of the ufl_type class
# decorator for each Expr class.
# Base classes of Expr type hierarchy
import ufl.core.expr
import ufl.core.terminal
import ufl.core.operator
# Terminal types
import ufl.constantvalue
import ufl.argument
import ufl.coefficient
import ufl.geometry
# Operator types
import ufl.indexed
import ufl.indexsum
import ufl.variable
import ufl.tensors
import ufl.algebra
import ufl.tensoralgebra
import ufl.mathfunctions
import ufl.differentiation
import ufl.conditional
import ufl.restriction
import ufl.exprcontainers
import ufl.referencevalue
# Make sure we import exproperators which attaches special functions
# to Expr
from ufl import exproperators as __exproperators
# Make sure to import modules with new Expr subclasses here!
# Collect all classes in sets automatically classified by some properties
all_ufl_classes = set(ufl.core.expr.Expr._ufl_all_classes_)
abstract_classes = set(c for c in all_ufl_classes if c._ufl_is_abstract_)
ufl_classes = set(c for c in all_ufl_classes if not c._ufl_is_abstract_)
terminal_classes = set(c for c in all_ufl_classes if c._ufl_is_terminal_)
nonterminal_classes = set(c for c in all_ufl_classes if not c._ufl_is_terminal_)
__all__ += [
"all_ufl_classes",
"abstract_classes",
"ufl_classes",
"terminal_classes",
"nonterminal_classes",
]
def populate_namespace_with_expr_classes(namespace):
"""Export all Expr subclasses into the namespace under their natural name."""
names = []
classes = ufl.core.expr.Expr._ufl_all_classes_
for cls in classes:
class_name = cls.__name__
namespace[class_name] = cls
names.append(class_name)
return names
__all__ += populate_namespace_with_expr_classes(locals())
# Semi-automated imports of non-expr classes:
def populate_namespace_with_module_classes(mod, loc):
"""Export the classes that submodules list in __all_classes__."""
names = mod.__all_classes__
for name in names:
loc[name] = getattr(mod, name)
return names
import ufl.cell # noqa E401
__all__ += populate_namespace_with_module_classes(ufl.cell, locals())
import ufl.finiteelement # noqa E401
__all__ += populate_namespace_with_module_classes(ufl.finiteelement, locals())
import ufl.domain # noqa E401
__all__ += populate_namespace_with_module_classes(ufl.domain, locals())
import ufl.functionspace # noqa E401
__all__ += populate_namespace_with_module_classes(ufl.functionspace, locals())
import ufl.core.multiindex # noqa E401
__all__ += populate_namespace_with_module_classes(ufl.core.multiindex, locals())
import ufl.argument # noqa E401
__all__ += populate_namespace_with_module_classes(ufl.argument, locals())
import ufl.measure # noqa E401
__all__ += populate_namespace_with_module_classes(ufl.measure, locals())
import ufl.integral # noqa E401
__all__ += populate_namespace_with_module_classes(ufl.integral, locals())
import ufl.form # noqa E401
__all__ += populate_namespace_with_module_classes(ufl.form, locals())
import ufl.equation # noqa E401
__all__ += populate_namespace_with_module_classes(ufl.equation, locals())
__all__ = as_native_strings(__all__)
|