Home | Trees | Indices | Help |
|
---|
|
1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 """ 4 This module contains tools for consistent naming of classes. 5 """ 6 7 # Copyright (C) 2008-2009 Martin Sandve Alnes and Simula Resarch Laboratory 8 # 9 # This file is part of SyFi. 10 # 11 # SyFi is free software: you can redistribute it and/or modify 12 # it under the terms of the GNU General Public License as published by 13 # the Free Software Foundation, either version 2 of the License, or 14 # (at your option) any later version. 15 # 16 # SyFi is distributed in the hope that it will be useful, 17 # but WITHOUT ANY WARRANTY; without even the implied warranty of 18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 # GNU General Public License for more details. 20 # 21 # You should have received a copy of the GNU General Public License 22 # along with SyFi. If not, see <http://www.gnu.org/licenses/>. 23 # 24 # First added: 2008-08-12 25 # Last changed: 2009-04-23 26 27 import re 28 import hashlib 2931 if len(name) > max_name_length: 32 name = hashlib.md5(name).hexdigest().lower() 33 return prefix + name3436 #return "%s_%s_%d" % (element.family, element.cell, element.degree) 37 s = repr(element).strip() 38 s = re.sub("[^\w]", "_", s) 39 s = re.sub("_+", "_", s) 40 s = s.strip("_") 41 return s42 45 4850 m = integral.measure() 51 prefix = "%s_integral_%s" % (m.domain_type(), m.domain_id()) 52 return short_name(prefix, form_name)5355 if options.code.form.name: 56 form_name = options.code.form.name 57 else: 58 checksum = hashlib.md5(repr(form) + repr(options)) 59 form_name = checksum.hexdigest().lower() 60 61 return short_name("form_", form_name)62
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Jun 11 11:34:34 2012 | http://epydoc.sourceforge.net |