Skip to content

Commit

Permalink
ENH/DOC: Remove log.py and all references to it. Update docstrings.
Browse files Browse the repository at this point in the history
* DOC:lower_convex_hull.py: Remove logger import from log.py.

* DOC:lower_convex_hull.py/calculate.py/model.py/log.py: Remove log.py and all references to it.
  • Loading branch information
Olivia Higgins authored and bocklund committed Aug 2, 2017
1 parent 4240729 commit 6ad41e6
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 33 deletions.
6 changes: 3 additions & 3 deletions pycalphad/core/cache.py
Expand Up @@ -42,7 +42,7 @@ def _make_key(args, kwds, typed,
kwd_mark = (object(),),
fasttypes = {int, str, frozenset, type(None)},
sorted=sorted, tuple=tuple, type=type, len=len):
'Make a cache key from optionally typed positional and keyword arguments'
"Make a cache key from optionally typed positional and keyword arguments."
key = args
if kwds:
sorted_items = sorted(kwds.items())
Expand Down Expand Up @@ -168,12 +168,12 @@ def wrapper(*args, **kwds):
return result

def cache_info():
"""Report cache statistics"""
"Report cache statistics."
with lock:
return _CacheInfo(stats[HITS], stats[MISSES], maxsize, len(cache))

def cache_clear():
"""Clear the cache and cache statistics"""
"Clear the cache and cache statistics."
with lock:
cache.clear()
root = nonlocal_root[0]
Expand Down
6 changes: 2 additions & 4 deletions pycalphad/core/calculate.py
Expand Up @@ -13,7 +13,6 @@
from pycalphad.core.cache import cacheit
from pycalphad.core.phase_rec import PhaseRecord, PhaseRecord_from_cython, PhaseRecord_from_compiledmodel
from pycalphad.core.compiled_model import CompiledModel
from pycalphad.log import logger
import pycalphad.variables as v
from sympy import Symbol
import numpy as np
Expand Down Expand Up @@ -452,9 +451,8 @@ def calculate(dbf, comps, phases, mode=None, output='GM', fake_points=False, bro
# we can't build the specified phase because the
# specified components aren't found in every sublattice
# we'll just skip it
logger.warning("""Suspending specified phase %s due to
some sublattices containing only unspecified components""",
phase_name)
warnings.warn("""Suspending specified phase {} due to
some sublattices containing only unspecified components""".format(phase_name))
continue
if points_dict[phase_name] is None:
maximum_internal_dof = max(maximum_internal_dof, sum(len(x) for x in mod.constituents))
Expand Down
6 changes: 3 additions & 3 deletions pycalphad/core/equilibrium.py
Expand Up @@ -26,12 +26,12 @@


class EquilibriumError(Exception):
"Exception related to calculation of equilibrium"
"Exception related to calculation of equilibrium."
pass


class ConditionError(EquilibriumError):
"Exception related to equilibrium conditions"
"Exception related to equilibrium conditions."
pass


Expand All @@ -47,7 +47,7 @@ def _adjust_conditions(conds):


def _merge_property_slices(properties, chunk_grid, slices, conds_keys, results):
"Merge back together slices of 'properties'"
"Merge back together slices of 'properties'."
for prop_slice, prop_arr in zip(chunk_grid, results):
if not isinstance(prop_arr, Dataset):
print('Error: {}'.format(prop_arr))
Expand Down
1 change: 0 additions & 1 deletion pycalphad/core/lower_convex_hull.py
Expand Up @@ -3,7 +3,6 @@
equilibrium calculation.
"""
from __future__ import print_function
from pycalphad.log import logger
from pycalphad.core.cartesian import cartesian
from pycalphad.core.constants import MIN_SITE_FRACTION
from .hyperplane import hyperplane
Expand Down
3 changes: 2 additions & 1 deletion pycalphad/io/database.py
@@ -1,4 +1,5 @@
"""The database module provides support for reading and writing data types
"""
The database module provides support for reading and writing data types
associated with structured thermodynamic/kinetic data.
"""
from tinydb import TinyDB
Expand Down
3 changes: 2 additions & 1 deletion pycalphad/io/tdb.py
@@ -1,4 +1,5 @@
"""The tdb module provides support for reading and writing databases in
"""
The tdb module provides support for reading and writing databases in
Thermo-Calc TDB format.
"""

Expand Down
18 changes: 0 additions & 18 deletions pycalphad/log.py

This file was deleted.

2 changes: 0 additions & 2 deletions pycalphad/model.py
Expand Up @@ -8,7 +8,6 @@
from tinydb import where
import pycalphad.variables as v
from pycalphad.core.constants import MIN_SITE_FRACTION
from pycalphad.log import logger
import numpy as np
from collections import OrderedDict

Expand Down Expand Up @@ -66,7 +65,6 @@ def __init__(self, dbe, comps, phase_name, parameters=None):
self.site_ratios = phase.sublattices
for sublattice in phase.constituents:
self.components |= set(sublattice).intersection(possible_comps)
logger.debug('Model of %s has components %s', self.phase_name, self.components)
# Verify that this phase is still possible to build
for sublattice in phase.constituents:
if len(set(sublattice).intersection(self.components)) == 0:
Expand Down

0 comments on commit 6ad41e6

Please sign in to comment.