Coverage for pygeodesy/streprs.py : 96%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
'''
# all public contants, classes and functions
'''(INTERNAL) Helper for C{fstr}, C{pairs}, C{reprs} and C{strs} ''' else: t = '[%s]%s' % ('%.*', '|'.join(_EeFfGg)) raise _IsNotError(t, fmt=fmt, Error=ValueError)
# corner case testLcc lon0=-96.0 t.rstrip('0').endswith('.')): else: raise _IsNotError('scalar', floats=o)
'''Make a valid name of alphanumeric and OKd characters.
@param name: The original name (C{str}). @keyword OKd: Other acceptable characters (C{str}). @keyword sub: Substitute for invalid charactes (C{str}).
@return: The modified name (C{str}).
@note: Leading and trailing whitespace characters are removed and intermediate whitespace characters are coalesced and substituted. '''
'''Get instance attributes as I{name=value} strings, with floats handled like L{fstr}.
@param inst: The instance (any C{type}). @param names: The attribute names (C{str}s). @keyword kwds: Keyword argument for function L{pairs}, except C{B{Nones}=True} to in-/exclude missing or attributes with a C{None} I{value}.
@return: A C{tuple(B{C{sep}}.join(t) for t in zip(I{names}, reprs(I{values}, ...)))} of C{str}s. '''
'''Return easting, northing string representations.
@param easting: Easting from false easting (C{meter}). @param northing: Northing from from false northing (C{meter}). @param prec: Precision in number of digits (C{int}). @param extras: Optional leading items (C{str}s).
@return: B{C{extras}} + 2-Tuple C{(eastingStr, northingStr)}.
@raise ValueError: Invalid B{C{prec}}. ''' except IndexError: raise ValueError('%s invalid: %r' % ('prec', prec)) '%0*d' % (w, int(northing * p10)))
'''Convert floats to string, optionally stripped of trailing zero decimals.
@param floats: List, sequence, tuple, etc. (C{scalar}s or C{scalar}). @keyword prec: The C{float} precision, number of decimal digits (0..9). Trailing zero decimals are stripped if B{C{prec}} is positive, but kept for negative B{C{prec}} values. @keyword fmt: Optional, float format (C{str}). @keyword ints: Optionally, remove the decimal dot (C{bool}). @keyword sep: Separator joining the B{C{floats}} (C{str}).
@return: The C{B{sep}.join(strs(B{floats}, ...)} string or a single C{strs((B{floats},), ...)} if B{C{floats}} is C{scalar} (C{str}). '''
'''Strip trailing zero decimals from a C{float} string.
@param efstr: Float with or without exponent (C{str}).
@return: Float (C{str}). '''
'''Return the string representation of an instantion.
@param inst: The instance (any C{type}). @param args: Optional positional arguments. @keyword kwds: Optional keyword arguments.
@return: Representation (C{str}). '''
'''Convert items to I{name=value} strings, with floats handled like L{fstr}.
@param items: Name-value pairs (C{dict} or 2-{tuple}s of any C{type}s). @keyword prec: The C{float} precision, number of decimal digits (0..9). Trailing zero decimals are stripped if B{C{prec}} is positive, but kept for negative B{C{prec}} values. @keyword fmt: Optional, float format (C{str}). @keyword ints: Optionally, remove the decimal dot (C{bool}). @keyword sep: Separator joining I{names} and I{values} (C{str}).
@return: A C{tuple(B{C{sep}}.join(t) for t in zip(I{names}, reprs(I{values}, ...)))} of C{str}s. ''' except (TypeError, ValueError): raise _IsNotError('dict', '2-tuples', items=items)
'''Convert objects to C{repr} strings, with floats handled like L{fstr}.
@param objs: List, sequence, tuple, etc. (any C{type}s). @keyword prec: The C{float} precision, number of decimal digits (0..9). Trailing zero decimals are stripped if B{C{prec}} is positive, but kept for negative B{C{prec}} values. @keyword fmt: Optional, float format (C{str}). @keyword ints: Optionally, remove the decimal dot (C{bool}).
@return: A C{tuple(map(fstr|repr, B{objs}))} of C{str}s. '''
'''Convert objects to C{str} strings, with floats handled like L{fstr}.
@param objs: List, sequence, tuple, etc. (any C{type}s). @keyword prec: The C{float} precision, number of decimal digits (0..9). Trailing zero decimals are stripped if B{C{prec}} is positive, but kept for negative B{C{prec}} values. @keyword fmt: Optional, float format (C{str}). @keyword ints: Optionally, remove the decimal dot (C{bool}).
@return: A C{tuple(map(fstr|str, B{objs}))} of C{str}s. '''
'''Return the string representation of an invokation.
@param name: Function, method or class name (C{str}). @param args: Optional positional arguments. @keyword kwds: Optional keyword arguments.
@return: Representation (C{str}). '''
# **) MIT License # # Copyright (C) 2016-2020 -- mrJean1 at Gmail -- All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. |