def Func ( arg_0 , arg_1 , arg_2 = False ) : arg_0 . description = arg_1 [ 'description' ] if arg_2 : arg_0 . _index_start , arg_0 . _index_end = arg_1 [ 'active_range' ] arg_0 . _length_unfiltered = arg_0 . _index_end - arg_0 . _index_start if 'renamed_columns' in arg_1 : for arg_7 , arg_8 in arg_1 [ 'renamed_columns' ] : arg_0 . _rename ( arg_7 , arg_8 ) for arg_9 , arg_10 in arg_1 [ 'functions' ] . items ( ) : arg_0 . add_function ( arg_9 , vaex . serialize . from_dict ( arg_10 ) ) if 'column_names' in arg_1 : arg_0 . column_names = [ ] arg_0 . virtual_columns = collections . OrderedDict ( ) for arg_9 , arg_10 in arg_1 [ 'virtual_columns' ] . items ( ) : arg_0 [ arg_9 ] = arg_0 . _expr ( arg_10 ) arg_0 . column_names = arg_1 [ 'column_names' ] else : arg_0 . virtual_columns = collections . OrderedDict ( ) for arg_9 , arg_10 in arg_1 [ 'virtual_columns' ] . items ( ) : arg_0 [ arg_9 ] = arg_0 . _expr ( arg_10 ) arg_0 . variables = arg_1 [ 'variables' ] import astropy arg_14 = { key : astropy . units . Unit ( arg_10 ) for key , arg_10 in arg_1 [ "units" ] . items ( ) } arg_0 . units . update ( arg_14 ) for arg_9 , arg_15 in arg_1 [ 'selections' ] . items ( ) : if arg_15 is None : arg_16 = None else : arg_16 = selections . selection_from_dict ( arg_15 ) arg_0 . set_selection ( arg_16 , arg_9 = arg_9 )

def Func(arg_0, arg_1, arg_2=False):
        """Sets the internal state of the df

        Example:

        >>> import vaex
        >>> df = vaex.from_scalars(x=1, y=2)
        >>> df
          #    x    y        r
          0    1    2  2.23607
        >>> df['r'] = (df.x**2 + df.y**2)**0.5
        >>> state = df.state_get()
        >>> state
        {'active_range': [0, 1],
        'column_names': ['x', 'y', 'r'],
        'description': None,
        'descriptions': {},
        'functions': {},
        'renamed_columns': [],
        'selections': {'__filter__': None},
        'ucds': {},
        'units': {},
        'variables': {},
        'virtual_columns': {'r': '(((x ** 2) + (y ** 2)) ** 0.5)'}}
        >>> df2 = vaex.from_scalars(x=3, y=4)
        >>> df2.Func(state)  # now the virtual functions are 'copied'
        >>> df2
          #    x    y    r
          0    3    4    5

        :param state: dict as returned by :meth:`DataFrame.state_get`.
        :param bool use_active_range: Whether to use the active range or not.
        """
        arg_0.description = arg_1['description']
        if arg_2:
            arg_0._index_start, arg_0._index_end = arg_1['active_range']
        arg_0._length_unfiltered = arg_0._index_end - arg_0._index_start
        if 'renamed_columns' in arg_1:
            for arg_7, arg_8 in arg_1['renamed_columns']:
                arg_0._rename(arg_7, arg_8)
        for arg_9, arg_10 in arg_1['functions'].items():
            arg_0.add_function(arg_9, vaex.serialize.from_dict(arg_10))
        if 'column_names' in arg_1:
            # we clear all columns, and add them later on, since otherwise self[name] = ... will try
            # to rename the columns (which is unsupported for remote dfs)
            arg_0.column_names = []
            arg_0.virtual_columns = collections.OrderedDict()
            for arg_9, arg_10 in arg_1['virtual_columns'].items():
                arg_0[arg_9] = arg_0._expr(arg_10)
                # self._save_assign_expression(name)
            arg_0.column_names = arg_1['column_names']
        else:
            # old behaviour
            arg_0.virtual_columns = collections.OrderedDict()
            for arg_9, arg_10 in arg_1['virtual_columns'].items():
                arg_0[arg_9] = arg_0._expr(arg_10)
        arg_0.variables = arg_1['variables']
        import astropy  # TODO: make this dep optional?
        arg_14 = {key: astropy.units.Unit(arg_10) for key, arg_10 in arg_1["units"].items()}
        arg_0.units.update(arg_14)
        for arg_9, arg_15 in arg_1['selections'].items():
            # TODO: make selection use the vaex.serialize framework
            if arg_15 is None:
                arg_16 = None
            else:
                arg_16 = selections.selection_from_dict(arg_15)
            arg_0.set_selection(arg_16, arg_9=arg_9)

Sets the internal state of the df

        Example:

        >>> import vaex
        >>> df = vaex.from_scalars(x=1, y=2)
        >>> df
          #    x    y        r
          0    1    2  2.23607
        >>> df['r'] = (df.x**2 + df.y**2)**0.5
        >>> state = df.state_get()
        >>> state
        {'active_range': [0, 1],
        'column_names': ['x', 'y', 'r'],
        'description': None,
        'descriptions': {},
        'functions': {},
        'renamed_columns': [],
        'selections': {'__filter__': None},
        'ucds': {},
        'units': {},
        'variables': {},
        'virtual_columns': {'r': '(((x ** 2) + (y ** 2)) ** 0.5)'}}
        >>> df2 = vaex.from_scalars(x=3, y=4)
        >>> df2.state_set(state)  # now the virtual functions are 'copied'
        >>> df2
          #    x    y    r
          0    3    4    5

        :param state: dict as returned by :meth:`DataFrame.state_get`.
        :param bool use_active_range: Whether to use the active range or not.


def Func(arg_0):
    """ Retrieves the current results and updates the model's record in
    the Model database.
    """

    # -----------------------------------------------------------------------
    # Get metrics
    arg_1 = arg_0._getMetrics()

    # -----------------------------------------------------------------------
    # Extract report metrics that match the requested report REs
    arg_2 = dict([(k,arg_1[k]) for k in arg_0._reportMetricLabels])

    # -----------------------------------------------------------------------
    # Extract the report item that matches the optimize key RE
    # TODO cache optimizedMetricLabel sooner
    arg_1 = arg_0._getMetrics()
    arg_3 = dict()
    if arg_0._optimizeKeyPattern is not None:
      arg_3[arg_0._optimizedMetricLabel] = \
                                      arg_1[arg_0._optimizedMetricLabel]

    # -----------------------------------------------------------------------
    # Update model results
    arg_5 = json.dumps((arg_1 , arg_3))
    arg_0._jobsDAO.modelUpdateResults(arg_0._modelID,  arg_5=arg_5,
                              metricValue=arg_3.values()[0],
                              numRecords=(arg_0._currentRecordIndex + 1))

    arg_0._logger.debug(
      "Model Results: modelID=%s; numRecords=%s; results=%s" % \
        (arg_0._modelID, arg_0._currentRecordIndex + 1, arg_5))

    return

Retrieves the current results and updates the model s record in the Model database .


def Func(arg_0):
        # type: () -> MultisigAddress
        """
        Returns the new multisig address.

        Note that you can continue to add digests after extracting an
        address; the next address will use *all* of the digests that
        have been added so far.
        """
        if not arg_0._digests:
            raise ValueError(
                'Must call ``add_digest`` at least once '
                'before calling ``Func``.',
            )

        if not arg_0._address:
            arg_1 = [0] * HASH_LENGTH
            arg_0._sponge.squeeze(arg_1)

            arg_0._address = MultisigAddress.from_trits(
                arg_1,
                digests=arg_0._digests[:],
            )

        return arg_0._address


def Func ( arg_0 , * arg_1 ) : if os . path . exists ( arg_0 ) : return os . makedirs ( arg_0 , * arg_1 )

def Func(arg_0, *arg_1):
    '''Like os.makedirs but keeps quiet if path already exists'''
    if os.path.exists(arg_0):
        return

    os.makedirs(arg_0, *arg_1)

Like os . makedirs but keeps quiet if path already exists


def Func ( arg_0 , arg_1 ) : if isinstance ( arg_1 , int ) : arg_2 = arg_6 ( arg_1 ) elif isinstance ( arg_1 , basestring ) : arg_2 = arg_1 else : arg_2 = arg_1 [ 'id' ] arg_3 = arg_0 . _task_data_key ( ) arg_4 = arg_0 . data . get ( arg_3 , { } ) arg_5 = arg_4 . get ( arg_6 ( arg_2 ) , { } ) arg_4 [ arg_6 ( arg_2 ) ] = arg_5 return arg_5

def Func(arg_0, arg_1):
        """Returns task data from local data.

        Args:
            task:
                `int`. Asana task number.
        """

        if isinstance(arg_1, int):
            arg_2 = arg_6(arg_1)
        elif isinstance(arg_1, basestring):
            arg_2 = arg_1
        else:
            arg_2 = arg_1['id']

        arg_3 = arg_0._task_data_key()
        arg_4 = arg_0.data.get(arg_3, {})

        arg_5 = arg_4.get(arg_6(arg_2), {})
        arg_4[arg_6(arg_2)] = arg_5
        return arg_5


(self, package_name=None, create_package_dir=False, dry_run=False)

def Func(arg_0, arg_1=None, arg_2=False, arg_3=False):
        """Determine paths automatically and a little intelligently"""

        # Give preference to the environment variable here as it will not
        # derefrence sym links
        arg_0.project_dir = Path(os.getenv('PWD') or os.getcwd())

        # Try and work out the project name
        arg_5 = arg_0.get_distribution()
        if arg_5:
            # Get name from setup.py
            arg_0.project_name = arg_5.get_name()
        else:
            # ...failing that, use the current directory name
            arg_0.project_name = arg_0.project_dir.name

        # Descend into the 'src' directory to find the package
        # if necessary
        if os.path.isdir(arg_0.project_dir / "src"):
            arg_7 = arg_0.project_dir / "src"
        else:
            arg_7 = arg_0.project_dir

        arg_8 = False
        if not arg_1:
            # Lets try and work out the package_name from the project_name
            arg_1 = arg_0.project_name.replace("-", "_")

            # Now do some fuzzy matching
            def get_matches(arg_9):
                arg_10 = [n for n in os.listdir(arg_7) if os.path.isdir(arg_7 / n)]
                return difflib.get_close_matches(arg_9, arg_10, n=1, cutoff=0.8)

            arg_11 = get_matches(arg_1)

            # If no matches, try removing the first part of the package name
            # (e.g. django-guardian becomes guardian)
            if not arg_11 and "_" in arg_1:
                arg_12 = "_".join(arg_1.split("_")[1:])
                arg_11 = get_matches(arg_12)

            if not arg_11:
                if arg_2:
                    arg_13 = arg_7 / arg_1
                    # Gets set to true even during dry run
                    arg_8 = True
                    if not arg_3:
                        print("Creating package directory at %s" % arg_13)
                        os.mkdir(arg_13)
                    else:
                        print("Would have created package directory at %s" % arg_13)
                else:
                    raise CommandError("Could not guess the package name. Specify it using --name.")
            else:
                arg_1 = arg_11[0]

        arg_0.package_name = arg_1
        arg_0.package_dir = arg_7 / arg_1

        if not os.path.exists(arg_0.package_dir) and not arg_8:
            raise CommandError("Package directory did not exist at %s. Perhaps specify it using --name" % arg_0.package_dir)


def Func ( arg_0 ) : arg_1 = arg_0 . get_version ( ) arg_2 = re . compile ( r'[^\d.]+' ) return arg_2 . sub ( '' , arg_1 ) . strip ( '.' )

def Func(arg_0):
        '''obtain the shory geoserver version
        '''
        arg_1 = arg_0.get_version()
        arg_2 = re.compile(r'[^\d.]+')
        return arg_2.sub('', arg_1).strip('.')


def Func(arg_0):
        """Disable event loop integration with PyQt4.

        This merely sets PyOS_InputHook to NULL.
        """
        if arg_0._apps.has_key(arg_2):
            arg_0._apps[arg_2]._in_event_loop = False
        arg_0.clear_inputhook()

Disable event loop integration with PyQt4 .


def Func():
    """Find and load the build backend"""
    # Add in-tree backend directories to the front of sys.path.
    arg_0 = os.environ.get('PEP517_BACKEND_PATH')
    if arg_0:
        arg_1 = arg_0.split(os.pathsep)
        arg_2.path[:0] = arg_1

    arg_4 = os.environ['PEP517_BUILD_BACKEND']
    arg_5, arg_6, arg_7 = arg_4.partition(':')
    try:
        arg_8 = import_module(arg_5)
    except ImportError:
        raise BackendUnavailable(traceback.format_exc())

    if arg_0:
        if not any(
            contained_in(arg_8.__file__, arg_3)
            for arg_3 in arg_1
        ):
            raise BackendInvalid("Backend was not loaded from backend-path")

    if arg_7:
        for arg_9 in arg_7.split('.'):
            arg_8 = getattr(arg_8, arg_9)
    return arg_8


def Func ( ) : from importlib import import_module from django . apps import apps from django . utils . module_loading import module_has_submodule for arg_0 in apps . get_app_configs ( ) : try : arg_1 = copy . copy ( arg_3 . _sizedimage_registry ) arg_2 = copy . copy ( arg_3 . _filter_registry ) import_module ( '%s.versatileimagefield' % arg_0 . name ) except Exception : arg_3 . _sizedimage_registry = arg_1 arg_3 . _filter_registry = arg_2 if module_has_submodule ( arg_0 . module , 'versatileimagefield' ) : raise

def Func():
    """
    Discover versatileimagefield.py modules.

    Iterate over django.apps.get_app_configs() and discover
    versatileimagefield.py modules.
    """
    from importlib import import_module
    from django.apps import apps
    from django.utils.module_loading import module_has_submodule

    for arg_0 in apps.get_app_configs():
        # Attempt to import the app's module.

        try:
            arg_1 = copy.copy(
                arg_3._sizedimage_registry
            )
            arg_2 = copy.copy(
                arg_3._filter_registry
            )
            import_module('%s.versatileimagefield' % arg_0.name)
        except Exception:
            # Reset the versatileimagefield_registry to the state before the
            # last import as this import will have to reoccur on the next
            # request and this could raise NotRegistered and AlreadyRegistered
            # exceptions (see django ticket #8245).
            arg_3._sizedimage_registry = \
                arg_1
            arg_3._filter_registry = \
                arg_2

            # Decide whether to bubble up this error. If the app just
            # doesn't have the module in question, we can ignore the error
            # attempting to import it, otherwise we want it to bubble up.
            if module_has_submodule(arg_0.module, 'versatileimagefield'):
                raise

Discover versatileimagefield . py modules .


def Func(arg_0):
    """
    A helper function to look up license object information

    Use names from: https://api.github.com/licenses
    """
    arg_1 = None

    if arg_0 in ('MIT', 'MIT License'):
        arg_1 = {
            'URL': 'https://api.github.com/licenses/mit',
            'name': 'MIT'
        }
    elif arg_0 in ('BSD 2-clause "Simplified" License'):
        arg_1 = {
            'URL': 'https://api.github.com/licenses/bsd-2-clause',
            'name': 'BSD-2-Clause'
        }
    elif arg_0 in ('BSD 3-clause "New" or "Revised" License'):
        arg_1 = {
            'URL': 'https://api.github.com/licenses/bsd-3-clause',
            'name': 'BSD-3-Clause'
        }
    elif arg_0 in ('Apache License 2.0'):
        arg_1 = {
            'URL': 'https://api.github.com/licenses/apache-2.0',
            'name': 'Apache-2.0'
        }
    elif arg_0 in ('GNU General Public License v2.1'):
        arg_1 = {
            'URL': 'https://api.github.com/licenses/gpl-2.1',
            'name': 'GPL-2.1'
        }
    elif arg_0 in ('GNU General Public License v2.0'):
        arg_1 = {
            'URL': 'https://api.github.com/licenses/gpl-2.0',
            'name': 'GPL-2.0'
        }
    elif arg_0 in ('GNU Lesser General Public License v2.1'):
        arg_1 = {
            'URL': 'https://api.github.com/licenses/lgpl-2.1',
            'name': 'LGPL-2.1'
        }
    elif arg_0 in ('GNU General Public License v3.0'):
        arg_1 = {
            'URL': 'https://api.github.com/licenses/gpl-3.0',
            'name': 'GPL-3.0'
        }
    elif arg_0 in ('GNU Lesser General Public License v3.0'):
        arg_1 = {
            'URL': 'https://api.github.com/licenses/lgpl-3.0',
            'name': 'LGPL-3.0'
        }
    elif arg_0 in ('Eclipse Public License 1.0'):
        arg_1 = {
            'URL': 'https://api.github.com/licenses/epl-1.0',
            'name': 'EPL-1.0',
        }
    elif arg_0 in ('Mozilla Public License 2.0'):
        arg_1 = {
            'URL': 'https://api.github.com/licenses/mpl-2.0',
            'name': 'MPL-2.0',
        }
    elif arg_0 in ('The Unlicense'):
        arg_1 = {
            'URL': 'https://api.github.com/licenses/unlicense',
            'name': 'Unlicense',
        }
    elif arg_0 in ('GNU Affero General Public License v3.0'):
        arg_1 = {
            'URL': 'https://api.github.com/licenses/agpl-3.0',
            'name': 'AGPL-3.0',
        }
    elif arg_0 in ('Eclipse Public License 2.0'):
        arg_1 = {
            'URL': 'https://api.github.com/licenses/epl-2.0',
            'name': 'EPL-2.0',
        }

    if arg_1 is None:
        logger.warn('I dont understand the license: %s', arg_0)
        raise ValueError('Aborting!')

    return arg_1


def Func ( arg_0 , arg_1 , arg_2 ) : arg_0 . assert_package_exists ( ) if not arg_0 . package_verif_set : arg_0 . package_verif_set = True arg_1 . package . verif_code = arg_2 else : raise CardinalityError ( 'Package::VerificationCode' )

def Func(arg_0, arg_1, arg_2):
        """Sets the package verification code, if not already set.
        code - A string.
        Raises CardinalityError if already defined.
        Raises OrderError if no package previously defined.
        """
        arg_0.assert_package_exists()
        if not arg_0.package_verif_set:
            arg_0.package_verif_set = True
            arg_1.package.verif_code = arg_2
        else:
            raise CardinalityError('Package::VerificationCode')

Sets the package verification code if not already set . code - A string . Raises CardinalityError if already defined . Raises OrderError if no package previously defined .


def Func(arg_0: arg_1, arg_2: arg_1, arg_3: arg_1) -> arg_1:
    """
    Calculate the Funcynolds number.

    :param L: [m] surface characteristic length.
    :param v: [m/s] fluid velocity relative to the object.
    :param nu: [m2/s] fluid kinematic viscosity.

    :returns: float
    """

    return arg_2 * arg_0 / arg_3

Calculate the Reynolds number.

    :param L: [m] surface characteristic length.
    :param v: [m/s] fluid velocity relative to the object.
    :param nu: [m2/s] fluid kinematic viscosity.

    :returns: float


def Func ( arg_0 , arg_1 = ( ) , arg_2 = None ) : arg_1 = arg_1 or arg_0 . size + ( len ( arg_0 ) , ) arg_3 = arg_0 . ds . GetRasterBand ( 1 ) arg_4 = ImageDriver ( 'MEM' ) arg_5 = arg_4 . raster ( arg_4 . ShortName , arg_1 , arg_3 . DataType ) arg_5 . sref = arg_0 . GetProjection ( ) arg_5 . affine = arg_2 or tuple ( arg_0 . affine ) arg_7 = arg_3 . GetColorTable ( ) for arg_8 in arg_5 : if arg_0 . nodata is not None : arg_8 . SetNoDataValue ( arg_0 . nodata ) if arg_7 : arg_8 . SetColorTable ( arg_7 ) return arg_5

def Func(arg_0, arg_1=(), arg_2=None):
        """Derive Func Raster instances.

        Keyword args:
        size -- tuple of image size (width, height)
        affine -- AffineTransform or six-tuple of geotransformation values
        """
        arg_1 = arg_1 or arg_0.size + (len(arg_0),)
        arg_3 = arg_0.ds.GetRasterBand(1)
        arg_4 = ImageDriver('MEM')
        arg_5 = arg_4.raster(arg_4.ShortName, arg_1, arg_3.DataType)
        arg_5.sref = arg_0.GetProjection()
        arg_5.affine = arg_2 or tuple(arg_0.affine)
        arg_7 = arg_3.GetColorTable()
        for arg_8 in arg_5:
            if arg_0.nodata is not None:
                arg_8.SetNoDataValue(arg_0.nodata)
            if arg_7:
                arg_8.SetColorTable(arg_7)
        return arg_5

Derive new Raster instances.

        Keyword args:
        size -- tuple of image size (width, height)
        affine -- AffineTransform or six-tuple of geotransformation values


def Func(arg_0, arg_1):
    '''
    converts top results from mash screen txt output to json format

    Parameters
    ----------
    mash_output: str
        this is a string that stores the path to this file, i.e, the name of
        the file
    sample_id: str
        sample name

    '''
    logger.info("Reading file : {}".format(arg_0))
    arg_2 = open(arg_0)

    arg_3 = {}
    arg_4 = []
    arg_5 = {}

    logger.info("Generating dictionary and list to pre-process the final json")
    for arg_6 in arg_2:
        arg_7 = arg_6.split("\t")
        arg_8 = arg_7[0]
        # shared_hashes = tab_split[1]
        arg_9 = arg_7[2]
        # p_value = tab_split[3]
        arg_10 = arg_7[4]
        # query-comment should not exist here and it is irrelevant

        # here identity is what in fact interests to report to json but
        # median_multiplicity also is important since it gives an rough
        # estimation of the coverage depth for each plasmid.
        # Plasmids should have higher coverage depth due to their increased
        # copy number in relation to the chromosome.
        arg_3[arg_10] = [arg_8, arg_9]
        arg_4.append(float(arg_9))

    arg_11 = open(" ".join(arg_0.split(".")[:-1]) + ".json", "w")

    # median cutoff is twice the median of all median_multiplicity values
    # reported by mash screen. In the case of plasmids, since the database
    # has 9k entries and reads shouldn't have that many sequences it seems ok...
    if len(arg_4) > 0:
        # this statement assures that median_list has indeed any entries
        arg_12 = median(arg_4)
        logger.info("Generating final json to dump to a file")
        for arg_13, arg_14 in arg_3.items():
            # estimated copy number
            arg_15 = int(float(arg_14[1]) / arg_12)
            # assure that plasmid as at least twice the median coverage depth
            if float(arg_14[1]) > arg_12:
                arg_5["_".join(arg_13.split("_")[0:3])] = [
                    round(float(arg_14[0]),2),
                    arg_15
                ]
        logger.info(
            "Exported dictionary has {} entries".format(len(arg_5)))
    else:
        # if no entries were found raise an error
        logger.error("No matches were found using mash screen for the queried reads")

    arg_11.write(json.dumps(arg_5))
    arg_11.close()

    arg_18 = {
        "tableRow": [{
            "sample": arg_1,
            "data": [{
                "header": "Mash Screen",
                "table": "plasmids",
                "patlas_mashscreen": arg_5,
                "value": len(arg_5)
            }]
        }],
    }

    with open(".report.json", "w") as json_report:
        json_report.write(json.dumps(arg_18, separators=(",", ":")))


def
Func
(
arg_0
,
arg_1
,
arg_2
=
)
:
arg_3
,
arg_4
=
struct
.
calcsize
(
'>cQ'
)
,
arg_0
.
digest
.
digest_size
arg_5
=
'>cQ%ds%ds'
%
(
len
(
arg_1
)
arg_3
arg_4
,
arg_4
)
try
:
arg_6
,
arg_7
,
arg_8
,
arg_9
=
struct
.
unpack
(
arg_5
,
arg_1
)
except
struct
.
error
:
raise
BadSignature
(
'Signature is not valid'
)
if
arg_6
!=
arg_0
.
version
:
raise
BadSignature
(
'Signature version not supported'
)
if
arg_2
is
not
:
if
isinstance
(
arg_2
,
datetime
.
timedelta
)
:
arg_2
=
arg_2
.
total_seconds
(
)
arg_10
=
abs
(
time
.
time
(
)
arg_7
)
if
arg_10
>
arg_2
+
_MAX_CLOCK_SKEW
:
raise
SignatureExpired
(
'Signature age %s > %s seconds'
%
(
arg_10
,
arg_2
)
)
try
:
arg_0
.
signature
(
arg_1
[
:
arg_4
]
)
.
verify
(
arg_9
)
except
InvalidSignature
:
raise
BadSignature
(
'Signature "%s" does not match'
%
binascii
.
b2a_base64
(
arg_9
)
)
return
arg_8

def Func(arg_0, arg_1, arg_2=None):
        """
        Retrieve original value and check it wasn't signed more
        than max_age seconds ago.

        :type signed_value: bytes
        :type ttl: int | datetime.timedelta
        """
        arg_3, arg_4 = struct.calcsize('>cQ'), arg_0.digest.digest_size
        arg_5 = '>cQ%ds%ds' % (len(arg_1) - arg_3 - arg_4, arg_4)
        try:
            arg_6, arg_7, arg_8, arg_9 = struct.unpack(arg_5, arg_1)
        except struct.error:
            raise BadSignature('Signature is not valid')
        if arg_6 != arg_0.version:
            raise BadSignature('Signature version not supported')
        if arg_2 is not None:
            if isinstance(arg_2, datetime.timedelta):
                arg_2 = arg_2.total_seconds()
            # Check timestamp is not older than ttl
            arg_10 = abs(time.time() - arg_7)
            if arg_10 > arg_2 + _MAX_CLOCK_SKEW:
                raise SignatureExpired('Signature age %s > %s seconds' % (arg_10,
                                                                          arg_2))
        try:
            arg_0.signature(arg_1[:-arg_4]).verify(arg_9)
        except InvalidSignature:
            raise BadSignature(
                'Signature "%s" does not match' % binascii.b2a_base64(arg_9))
        return arg_8

Retrieve original value and check it wasn t signed more than max_age seconds ago .


(self, project_id, model_name, version_name)

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Sets a version to be the default. Blocks until finished.
        """
        arg_4 = 'projects/{}/models/{}/versions/{}'.format(
            arg_1, arg_2, arg_3)
        arg_5 = arg_0._mlengine.projects().models().versions().setDefault(
            name=arg_4, body={})

        try:
            arg_6 = arg_5.execute()
            arg_0.log.info('Successfully set version: %s to default', arg_6)
            return arg_6
        except HttpError as e:
            arg_0.log.error('Something went wrong: %s', e)
            raise

Sets a version to be the default . Blocks until finished .


def Func(arg_0):
        '''Use a closure so that draw attributes can be saved'''
        arg_1 = arg_0.fill
        arg_2 = arg_0.stroke
        arg_3 = arg_0.strokewidth

        def _render(arg_4):
            '''
            At the moment this is based on cairo.

            TODO: Need to work out how to move the cairo specific
                  bits somewhere else.
            '''
            # Go to initial point (CORNER or CENTER):
            arg_5 = arg_0._call_transform_mode(arg_0._transform)

            if arg_1 is None and arg_2 is None:
                # Fixes _bug_FillStrokeNofillNostroke.bot
                return

            arg_4.set_matrix(arg_5)
            # Run the path commands on the cairo context:
            arg_0._traverse(arg_4)
            # Matrix affects stroke, so we need to reset it:
            arg_4.set_matrix(cairo.Matrix())

            if arg_1 is not None and arg_2 is not None:
                if arg_2[3] < 1:
                    # Draw onto intermediate surface so that stroke
                    # does not overlay fill
                    arg_4.push_group()

                    arg_4.set_source_rgba(*arg_1)
                    arg_4.fill_preserve()

                    arg_6 = arg_4.stroke_extents()
                    arg_4.set_source_rgba(*arg_2)
                    arg_4.set_operator(cairo.OPERATOR_SOURCE)
                    arg_4.set_line_width(arg_3)
                    arg_4.stroke()

                    arg_4.pop_group_to_source()
                    arg_4.paint()
                else:
                    # Fast path if no alpha in stroke
                    arg_4.set_source_rgba(*arg_1)
                    arg_4.fill_preserve()

                    arg_4.set_source_rgba(*arg_2)
                    arg_4.set_line_width(arg_3)
                    arg_4.stroke()
            elif arg_1 is not None:
                arg_4.set_source_rgba(*arg_1)
                arg_4.fill()
            elif arg_2 is not None:
                arg_4.set_source_rgba(*arg_2)
                arg_4.set_line_width(arg_3)
                arg_4.stroke()

        return _render


(self, msg, stuff_to_load, *args, **kwargs)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
*
arg_3
,
**
arg_4
)
:
arg_5
=
True
try
:
arg_5
=
arg_0
.
_srvc_opening_routine
(
'r'
,
arg_4
=
arg_4
)
if
arg_1
==
pypetconstants
.
TRAJECTORY
:
arg_0
.
_trj_Func_trajectory
(
arg_2
,
*
arg_3
,
**
arg_4
)
elif
arg_1
==
pypetconstants
.
LEAF
:
arg_0
.
_prm_Func_parameter_or_result
(
arg_2
,
*
arg_3
,
**
arg_4
)
elif
arg_1
==
pypetconstants
.
GROUP
:
arg_0
.
_grp_Func_group
(
arg_2
,
*
arg_3
,
**
arg_4
)
elif
arg_1
==
pypetconstants
.
TREE
:
arg_0
.
_tree_Func_sub_branch
(
arg_2
,
*
arg_3
,
**
arg_4
)
elif
arg_1
==
pypetconstants
.
LIST
:
arg_0
.
_srvc_Func_several_items
(
arg_2
,
*
arg_3
,
**
arg_4
)
else
:
raise
pex
.
NoSuchServiceError
(
'I do not know how to handle `%s`'
%
arg_1
)
except
pt
.
NoSuchNodeError
as
exc
:
arg_0
.
_logger
.
error
(
'Failed Funcing  `%s`'
%
str
(
arg_2
)
)
raise
pex
.
DataNotInStorageError
(
repr
(
exc
)
)
except
:
arg_0
.
_logger
.
error
(
'Failed Funcing  `%s`'
%
str
(
arg_2
)
)
raise
finally
:
arg_0
.
_srvc_closing_routine
(
arg_5
)

def Func(arg_0, arg_1, arg_2, *arg_3, **arg_4):
        """Loads a particular item from disk.

        The storage service always accepts these parameters:

        :param trajectory_name: Name of current trajectory and name of top node in hdf5 file.

        :param trajectory_index:

            If no `trajectory_name` is provided, you can specify an integer index.
            The trajectory at the index position in the hdf5 file is considered to Funced.
            Negative indices are also possible for reverse indexing.

        :param filename: Name of the hdf5 file

        The following messages (first argument msg) are understood and the following arguments
        can be provided in combination with the message:

            * :const:`pypet.pypetconstants.TRAJECTORY` ('TRAJECTORY')

                Loads a trajectory.

                :param stuff_to_Func: The trajectory

                :param as_new: Whether to Func trajectory as new

                :param Func_parameters: How to Func parameters and config

                :param Func_derived_parameters: How to Func derived parameters

                :param Func_results: How to Func results

                :param force: Force Func in case there is a pypet version mismatch

                You can specify how to Func the parameters, derived parameters and results
                as follows:

                :const:`pypet.pypetconstants.LOAD_NOTHING`: (0)

                    Nothing is Funced

                :const:`pypet.pypetconstants.LOAD_SKELETON`: (1)

                    The skeleton including annotations are Funced, i.e. the items are empty.
                    Non-empty items in RAM are left untouched.

                :const:`pypet.pypetconstants.LOAD_DATA`: (2)

                    The whole data is Funced.
                    Only empty or in RAM non-existing instance are filled with the
                    data found on disk.

                :const:`pypet.pypetconstants.OVERWRITE_DATA`: (3)

                    The whole data is Funced.
                    If items that are to be Funced are already in RAM and not empty,
                    they are emptied and new data is Funced from disk.

            * :const:`pypet.pypetconstants.LEAF` ('LEAF')

                Loads a parameter or result.

                :param stuff_to_Func: The item to be Funced

                :param Func_data: How to Func data

                :param Func_only:

                    If you Func a result, you can partially Func it and ignore the
                    rest of the data. Just specify the name of the data you want to Func.
                    You can also provide a list,
                    for example `Func_only='spikes'`, `Func_only=['spikes','membrane_potential']`.

                    Issues a warning if items cannot be found.

                :param Func_except:

                    If you Func a result you can partially Func in and specify items
                    that should NOT be Funced here. You cannot use `Func_except` and
                    `Func_only` at the same time.

            * :const:`pypet.pyetconstants.GROUP`

                Loads a group a node (comment and annotations)

                :param recursive:

                    Recursively Funcs everything below

                :param Func_data:

                    How to Func stuff if ``recursive=True``
                    accepted values as above for Funcing the trajectory

                :param max_depth:

                    Maximum depth in case of recursion. `None` for no limit.

            * :const:`pypet.pypetconstants.TREE` ('TREE')

                Loads a whole subtree

                :param stuff_to_Func: The parent node (!) not the one where Funcing starts!

                :param child_name: Name of child node that should be Funced

                :param recursive: Whether to Func recursively the subtree below child

                :param Func_data:

                    How to Func stuff, accepted values as above for Funcing the trajectory

                :param max_depth:

                    Maximum depth in case of recursion. `None` for no limit.

                :param trajectory: The trajectory object

            * :const:`pypet.pypetconstants.LIST` ('LIST')

                Analogous to :ref:`storing lists <store-lists>`

        :raises:

            NoSuchServiceError if message or data is not understood

            DataNotInStorageError if data to be Funced cannot be found on disk

        """
        arg_5 = True
        try:

            arg_5 = arg_0._srvc_opening_routine('r', arg_4=arg_4)

            if arg_1 == pypetconstants.TRAJECTORY:
                arg_0._trj_Func_trajectory(arg_2, *arg_3, **arg_4)

            elif arg_1 == pypetconstants.LEAF:
                arg_0._prm_Func_parameter_or_result(arg_2, *arg_3, **arg_4)

            elif arg_1 == pypetconstants.GROUP:
                arg_0._grp_Func_group(arg_2, *arg_3, **arg_4)

            elif arg_1 == pypetconstants.TREE:
                arg_0._tree_Func_sub_branch(arg_2, *arg_3, **arg_4)

            elif arg_1 == pypetconstants.LIST:
                arg_0._srvc_Func_several_items(arg_2, *arg_3, **arg_4)

            else:
                raise pex.NoSuchServiceError('I do not know how to handle `%s`' % arg_1)

        except pt.NoSuchNodeError as exc:
            arg_0._logger.error('Failed Funcing  `%s`' % str(arg_2))
            raise pex.DataNotInStorageError(repr(exc))
        except:
            arg_0._logger.error('Failed Funcing  `%s`' % str(arg_2))
            raise
        finally:
            arg_0._srvc_closing_routine(arg_5)

Loads a particular item from disk.

        The storage service always accepts these parameters:

        :param trajectory_name: Name of current trajectory and name of top node in hdf5 file.

        :param trajectory_index:

            If no `trajectory_name` is provided, you can specify an integer index.
            The trajectory at the index position in the hdf5 file is considered to loaded.
            Negative indices are also possible for reverse indexing.

        :param filename: Name of the hdf5 file

        The following messages (first argument msg) are understood and the following arguments
        can be provided in combination with the message:

            * :const:`pypet.pypetconstants.TRAJECTORY` ('TRAJECTORY')

                Loads a trajectory.

                :param stuff_to_load: The trajectory

                :param as_new: Whether to load trajectory as new

                :param load_parameters: How to load parameters and config

                :param load_derived_parameters: How to load derived parameters

                :param load_results: How to load results

                :param force: Force load in case there is a pypet version mismatch

                You can specify how to load the parameters, derived parameters and results
                as follows:

                :const:`pypet.pypetconstants.LOAD_NOTHING`: (0)

                    Nothing is loaded

                :const:`pypet.pypetconstants.LOAD_SKELETON`: (1)

                    The skeleton including annotations are loaded, i.e. the items are empty.
                    Non-empty items in RAM are left untouched.

                :const:`pypet.pypetconstants.LOAD_DATA`: (2)

                    The whole data is loaded.
                    Only empty or in RAM non-existing instance are filled with the
                    data found on disk.

                :const:`pypet.pypetconstants.OVERWRITE_DATA`: (3)

                    The whole data is loaded.
                    If items that are to be loaded are already in RAM and not empty,
                    they are emptied and new data is loaded from disk.

            * :const:`pypet.pypetconstants.LEAF` ('LEAF')

                Loads a parameter or result.

                :param stuff_to_load: The item to be loaded

                :param load_data: How to load data

                :param load_only:

                    If you load a result, you can partially load it and ignore the
                    rest of the data. Just specify the name of the data you want to load.
                    You can also provide a list,
                    for example `load_only='spikes'`, `load_only=['spikes','membrane_potential']`.

                    Issues a warning if items cannot be found.

                :param load_except:

                    If you load a result you can partially load in and specify items
                    that should NOT be loaded here. You cannot use `load_except` and
                    `load_only` at the same time.

            * :const:`pypet.pyetconstants.GROUP`

                Loads a group a node (comment and annotations)

                :param recursive:

                    Recursively loads everything below

                :param load_data:

                    How to load stuff if ``recursive=True``
                    accepted values as above for loading the trajectory

                :param max_depth:

                    Maximum depth in case of recursion. `None` for no limit.

            * :const:`pypet.pypetconstants.TREE` ('TREE')

                Loads a whole subtree

                :param stuff_to_load: The parent node (!) not the one where loading starts!

                :param child_name: Name of child node that should be loaded

                :param recursive: Whether to load recursively the subtree below child

                :param load_data:

                    How to load stuff, accepted values as above for loading the trajectory

                :param max_depth:

                    Maximum depth in case of recursion. `None` for no limit.

                :param trajectory: The trajectory object

            * :const:`pypet.pypetconstants.LIST` ('LIST')

                Analogous to :ref:`storing lists <store-lists>`

        :raises:

            NoSuchServiceError if message or data is not understood

            DataNotInStorageError if data to be loaded cannot be found on disk


def Func ( arg_0 , arg_1 = arg_2 . NoParam , arg_4 = None ) : if arg_4 is None : arg_4 = sys . argv arg_5 = [ arg_0 ] if isinstance ( arg_0 , six . string_types ) else arg_0 arg_6 = len ( arg_4 ) - 1 for arg_7 , arg_8 in enumerate ( arg_4 ) : for arg_9 in arg_5 : if arg_8 == arg_9 : if arg_7 < arg_6 : arg_10 = arg_4 [ arg_7 + 1 ] return arg_10 elif arg_8 . startswith ( arg_9 + '=' ) : arg_10 = '=' . join ( arg_8 . split ( '=' ) [ 1 : ] ) return arg_10 arg_10 = arg_1 return arg_10

def Func(arg_0, arg_1=arg_2.NoParam, arg_4=None):
    """
    Get the value of a keyword argument specified on the command line.

    Values can be specified as `<key> <value>` or `<key>=<value>`

    Args:
        key (str or tuple): string or tuple of strings. Each key should be
            prefixed with two hyphens (i.e. `--`)
        default (Optional[object]): value to return if not specified
        argv (Optional[list]): overrides `sys.argv` if specified

    Returns:
        str: value : the value specified after the key. It they key is
            specified multiple times, then the first value is returned.

    TODO:
        - [ ] Can we handle the case where the value is a list of long paths?
        - [ ] Should we default the first or last specified instance of the flag.

    Example:
        >>> import ubelt as ub
        >>> argv = ['--ans', '42', '--quest=the grail', '--ans=6', '--bad']
        >>> assert ub.Func('--spam', argv=argv) == ub.NoParam
        >>> assert ub.Func('--quest', argv=argv) == 'the grail'
        >>> assert ub.Func('--ans', argv=argv) == '42'
        >>> assert ub.Func('--bad', argv=argv) == ub.NoParam
        >>> assert ub.Func(('--bad', '--bar'), argv=argv) == ub.NoParam

    Example:
        >>> # Test fix for GH Issue #41
        >>> import ubelt as ub
        >>> argv = ['--path=/path/with/k=3']
        >>> ub.Func('--path', argv=argv) == '/path/with/k=3'
    """
    if arg_4 is None:  # nocover
        arg_4 = sys.argv

    arg_5 = [arg_0] if isinstance(arg_0, six.string_types) else arg_0
    arg_6 = len(arg_4) - 1
    for arg_7, arg_8 in enumerate(arg_4):
        for arg_9 in arg_5:
            if arg_8 == arg_9:
                if arg_7 < arg_6:
                    arg_10 = arg_4[arg_7 + 1]
                    return arg_10
            elif arg_8.startswith(arg_9 + '='):
                arg_10 = '='.join(arg_8.split('=')[1:])
                return arg_10
    arg_10 = arg_1
    return arg_10

Get the value of a keyword argument specified on the command line.

    Values can be specified as `<key> <value>` or `<key>=<value>`

    Args:
        key (str or tuple): string or tuple of strings. Each key should be
            prefixed with two hyphens (i.e. `--`)
        default (Optional[object]): value to return if not specified
        argv (Optional[list]): overrides `sys.argv` if specified

    Returns:
        str: value : the value specified after the key. It they key is
            specified multiple times, then the first value is returned.

    TODO:
        - [ ] Can we handle the case where the value is a list of long paths?
        - [ ] Should we default the first or last specified instance of the flag.

    Example:
        >>> import ubelt as ub
        >>> argv = ['--ans', '42', '--quest=the grail', '--ans=6', '--bad']
        >>> assert ub.argval('--spam', argv=argv) == ub.NoParam
        >>> assert ub.argval('--quest', argv=argv) == 'the grail'
        >>> assert ub.argval('--ans', argv=argv) == '42'
        >>> assert ub.argval('--bad', argv=argv) == ub.NoParam
        >>> assert ub.argval(('--bad', '--bar'), argv=argv) == ub.NoParam

    Example:
        >>> # Test fix for GH Issue #41
        >>> import ubelt as ub
        >>> argv = ['--path=/path/with/k=3']
        >>> ub.argval('--path', argv=argv) == '/path/with/k=3'

Get the value of a keyword argument specified on the command line .


def
Func
(
arg_0
,
arg_1
)
:
if
not
arg_1
.
startswith
(
'@'
)
:
return
arg_1
arg_2
=
arg_1
.
split
(
',-'
)
try
:
arg_3
=
int
(
arg_2
[
1
]
)
except
:
raise
ValueError
(
"Malformed timezone string."
)
return
arg_0
.
load_name
(
arg_3
)

def Func(arg_0, arg_1):
        """
        Parse strings as returned from the Windows registry into the time zone
        name as defined in the registry.

        >>> from dateutil.tzwin import tzres
        >>> tzr = tzres()
        >>> print(tzr.Func('@tzres.dll,-251'))
        'Dateline Daylight Time'
        >>> print(tzr.Func('Eastern Standard Time'))
        'Eastern Standard Time'

        :param tzname_str:
            A timezone name string as returned from a Windows registry key.

        :return:
            Returns the localized timezone string from tzres.dll if the string
            is of the form `@tzres.dll,-offset`, else returns the input string.
        """
        if not arg_1.startswith('@'):
            return arg_1

        arg_2 = arg_1.split(',-')
        try:
            arg_3 = int(arg_2[1])
        except:
            raise ValueError("Malformed timezone string.")

        return arg_0.load_name(arg_3)

Parse strings as returned from the Windows registry into the time zone
        name as defined in the registry.

        >>> from dateutil.tzwin import tzres
        >>> tzr = tzres()
        >>> print(tzr.name_from_string('@tzres.dll,-251'))
        'Dateline Daylight Time'
        >>> print(tzr.name_from_string('Eastern Standard Time'))
        'Eastern Standard Time'

        :param tzname_str:
            A timezone name string as returned from a Windows registry key.

        :return:
            Returns the localized timezone string from tzres.dll if the string
            is of the form `@tzres.dll,-offset`, else returns the input string.

Parse strings as returned from the Windows registry into the time zone name as defined in the registry .


(params, w_name, scope_name, inputs, layers, weights, names)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
,
arg_5
,
arg_6
)
:
print
(
'Converting adaptive_avg_pool2d...'
)
if
arg_6
==
'short'
:
arg_7
=
'APOL'
+
random_string
(
4
)
elif
arg_6
==
'keep'
:
arg_7
=
arg_1
else
:
arg_7
=
arg_1
+
str
(
random
.
random
(
)
)
arg_8
=
keras
.
layers
.
GlobalMaxPooling2D
(
data_format
=
'channels_first'
,
name
=
arg_7
)
arg_4
[
arg_2
]
=
arg_8
(
arg_4
[
arg_3
[
0
]
]
)
def
target_layer
(
arg_9
)
:
import
keras
return
keras
.
backend
.
expand_dims
(
arg_9
)
arg_10
=
keras
.
layers
.
Lambda
(
target_layer
,
name
=
arg_7
+
'E'
)
arg_4
[
arg_2
]
=
arg_10
(
arg_4
[
arg_2
]
)
arg_4
[
arg_2
]
=
arg_10
(
arg_4
[
arg_2
]
)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6):
    """
    Convert Func layer.

    Args:
        params: dictionary with layer parameters
        w_name: name prefix in state_dict
        scope_name: pytorch scope name
        inputs: pytorch node inputs
        layers: dictionary with keras tensors
        weights: pytorch state_dict
        names: use short names for keras layers
    """
    print('Converting adaptive_avg_pool2d...')

    if arg_6 == 'short':
        arg_7 = 'APOL' + random_string(4)
    elif arg_6 == 'keep':
        arg_7 = arg_1
    else:
        arg_7 = arg_1 + str(random.random())

    arg_8 = keras.layers.GlobalMaxPooling2D(data_format='channels_first', name=arg_7)
    arg_4[arg_2] = arg_8(arg_4[arg_3[0]])

    def target_layer(arg_9):
        import keras
        return keras.backend.expand_dims(arg_9)

    arg_10 = keras.layers.Lambda(target_layer, name=arg_7 + 'E')
    arg_4[arg_2] = arg_10(arg_4[arg_2])  # double expand dims
    arg_4[arg_2] = arg_10(arg_4[arg_2])

Convert convert_adaptive_max_pool2d layer.

    Args:
        params: dictionary with layer parameters
        w_name: name prefix in state_dict
        scope_name: pytorch scope name
        inputs: pytorch node inputs
        layers: dictionary with keras tensors
        weights: pytorch state_dict
        names: use short names for keras layers

Convert convert_adaptive_max_pool2d layer .


def
Func
(
*
arg_0
,
**
arg_1
)
:
arg_2
=
client
.
Func
(
)
if
arg_2
:
print_user
(
arg_2
)
else
:
print
(
'You are not logged-in.'
)

def Func(*arg_0, **arg_1):
    """
    Prints information about the current user.
    Assumes the user is already logged-in.
    """
    arg_2 = client.Func()

    if arg_2:
        print_user(arg_2)
    else:
        print('You are not logged-in.')

Prints information about the current user . Assumes the user is already logged - in .


(x, sample_axis=0, keepdims=False, name=None)

def Func ( arg_0 , arg_1 = 0 , arg_2 = False , arg_3 = None ) : with tf . compat . v1 . name_scope ( arg_3 , 'Func' , values = [ arg_0 , arg_1 ] ) : return coFunc ( arg_0 , y = None , arg_1 = arg_1 , event_axis = None , arg_2 = arg_2 )

def Func(arg_0, arg_1=0, arg_2=False, arg_3=None):
  """Estimate Func using samples.

  Given `N` samples of scalar valued random variable `X`, Func may
  be estimated as

  ```none
  Var[X] := N^{-1} sum_{n=1}^N (X_n - Xbar) Conj{(X_n - Xbar)}
  Xbar := N^{-1} sum_{n=1}^N X_n
  ```

  ```python
  x = tf.random_normal(shape=(100, 2, 3))

  # var[i, j] is the sample Func of the (i, j) batch member of x.
  var = tfp.stats.Func(x, sample_axis=0)
  ```

  Notice we divide by `N` (the numpy default), which does not create `NaN`
  when `N = 1`, but is slightly biased.

  Args:
    x:  A numeric `Tensor` holding samples.
    sample_axis: Scalar or vector `Tensor` designating axis holding samples, or
      `None` (meaning all axis hold samples).
      Default value: `0` (leftmost dimension).
    keepdims:  Boolean.  Whether to keep the sample axis as singletons.
    name: Python `str` name prefixed to Ops created by this function.
          Default value: `None` (i.e., `'Func'`).

  Returns:
    var: A `Tensor` of same `dtype` as the `x`, and rank equal to
      `rank(x) - len(sample_axis)`
  """
  with tf.compat.v1.name_scope(arg_3, 'Func', values=[arg_0, arg_1]):
    return coFunc(
        arg_0, y=None, arg_1=arg_1, event_axis=None, arg_2=arg_2)

Estimate variance using samples.

  Given `N` samples of scalar valued random variable `X`, variance may
  be estimated as

  ```none
  Var[X] := N^{-1} sum_{n=1}^N (X_n - Xbar) Conj{(X_n - Xbar)}
  Xbar := N^{-1} sum_{n=1}^N X_n
  ```

  ```python
  x = tf.random_normal(shape=(100, 2, 3))

  # var[i, j] is the sample variance of the (i, j) batch member of x.
  var = tfp.stats.variance(x, sample_axis=0)
  ```

  Notice we divide by `N` (the numpy default), which does not create `NaN`
  when `N = 1`, but is slightly biased.

  Args:
    x:  A numeric `Tensor` holding samples.
    sample_axis: Scalar or vector `Tensor` designating axis holding samples, or
      `None` (meaning all axis hold samples).
      Default value: `0` (leftmost dimension).
    keepdims:  Boolean.  Whether to keep the sample axis as singletons.
    name: Python `str` name prefixed to Ops created by this function.
          Default value: `None` (i.e., `'variance'`).

  Returns:
    var: A `Tensor` of same `dtype` as the `x`, and rank equal to
      `rank(x) - len(sample_axis)`


def Func ( arg_0 ) : arg_1 = yield from arg_0 . __session . get ( arg_0 . fsapi_device_url , timeout = arg_0 . timeout ) arg_2 = yield from arg_1 . text ( encoding = 'utf-8' ) arg_3 = objectify . fromstring ( arg_2 ) return arg_3 . webfsapi . text

def Func(arg_0):
        """Parse the fsapi endpoint from the device url."""
        arg_1 = yield from arg_0.__session.get(arg_0.fsapi_device_url, timeout = arg_0.timeout)
        arg_2 = yield from arg_1.text(encoding='utf-8')
        arg_3 = objectify.fromstring(arg_2)
        return arg_3.webfsapi.text

Parse the fsapi endpoint from the device url .


(
    categorical_param, name="embed_check_categorical_event_shape")

def Func(
    arg_0, arg_1="Func"):
  """Embeds checks that categorical distributions don't have too many classes.

  A categorical-type distribution is one which, e.g., returns the class label
  rather than a one-hot encoding.  E.g., `Categorical(probs)`.

  Since distributions output samples in the same dtype as the parameters, we
  must ensure that casting doesn't lose precision. That is, the
  `parameter.dtype` implies a maximum number of classes. However, since shape is
  `int32` and categorical variables are presumed to be indexes into a `Tensor`,
  we must also ensure that the number of classes is no larger than the largest
  possible `int32` index, i.e., `2**31-1`.

  In other words the number of classes, `K`, must satisfy the following
  condition:

  ```python
  K <= min(
      int(2**31 - 1),  # Largest float as an index.
      {
          tf.float16: int(2**11),   # Largest int as a float16.
          tf.float32: int(2**24),
          tf.float64: int(2**53),
      }.get(dtype_util.base_dtype(categorical_param.dtype), 0))
  ```

  Args:
    categorical_param: Floating-point `Tensor` representing parameters of
      distribution over categories. The rightmost shape is presumed to be the
      number of categories.
    name: A name for this operation (optional).

  Returns:
    categorical_param: Input `Tensor` with appropriate assertions embedded.

  Raises:
    TypeError: if `categorical_param` has an unknown `dtype`.
    ValueError: if we can statically identify `categorical_param` as being too
      large (for being closed under int32/float casting).
  """
  with tf.name_scope(arg_1):
    arg_2 = tf.convert_to_tensor(value=arg_0, arg_1="categorical_param")
    # The size must not exceed both of:
    # - The largest possible int32 (since categorical values are presumed to be
    #   indexes into a Tensor).
    # - The largest possible integer exactly representable under the given
    #   floating-point dtype (since we need to cast to/from).
    #
    # The chosen floating-point thresholds are 2**(1 + mantissa_bits).
    # For more details, see:
    # https://en.wikipedia.org/wiki/Floating-point_arithmetic#Internal_representation
    arg_3 = dtype_util.base_dtype(arg_2.dtype)
    arg_4 = (
        _largest_integer_by_dtype(arg_3)
        if dtype_util.is_floating(arg_3) else 0)
    if arg_4 is 0:
      raise TypeError("Unable to validate size of unrecognized dtype "
                      "({}).".format(dtype_util.name(arg_3)))
    try:
      arg_5 = tensorshape_util.with_rank_at_least(arg_2.shape, 1)
    except ValueError:
      raise ValueError("A categorical-distribution parameter must have "
                       "at least 1 dimension.")
    arg_6 = tf.compat.dimension_value(arg_5[-1])
    if arg_6 is not None:
      if arg_6 < 2:
        raise ValueError("A categorical-distribution parameter must have at "
                         "least 2 events.")
      if arg_6 > arg_4:
        raise ValueError("Number of classes exceeds `dtype` precision, i.e., "
                         "{} implies shape ({}) cannot exceed {}.".format(
                             dtype_util.name(arg_3), arg_6,
                             arg_4))
      return arg_2
    else:
      arg_6 = tf.shape(input=arg_2, out_type=tf.int64, arg_1="x_shape")[-1]
      return with_dependencies([
          assert_util.assert_rank_at_least(
              arg_2,
              1,
              message=("A categorical-distribution parameter must have "
                       "at least 1 dimension.")),
          assert_util.assert_greater_equal(
              tf.shape(input=arg_2)[-1],
              2,
              message=("A categorical-distribution parameter must have at "
                       "least 2 events.")),
          assert_util.assert_less_equal(
              arg_6,
              tf.convert_to_tensor(arg_4, dtype=tf.int64),
              message="Number of classes exceeds `dtype` precision, "
              "i.e., {} dtype cannot exceed {} shape.".format(
                  dtype_util.name(arg_3), arg_4)),
      ], arg_2)

Embeds checks that categorical distributions don t have too many classes .


return '%s%s%s' % (urlparse.urljoin(self.dsn, url), name,
                           self.NAME_EXTENSION)

def Func ( arg_0 , arg_1 , arg_2 = None ) : if not arg_1 . endswith ( arg_0 . URL_SEPERATOR ) : arg_1 = arg_1 + arg_0 . URL_SEPERATOR if arg_2 is None : arg_2 = '' return '%s%s%s' % ( urlparse . urljoin ( arg_0 . dsn , arg_1 ) , arg_2 , arg_0 . NAME_EXTENSION )

def Func(arg_0, arg_1, arg_2=None):
        """
        Method that constructs a full url with the given url and the
        snapshot name.

        Example:
        full_url = Func('/users', '1')
        full_url => 'http://firebase.localhost/users/1.json'
        """
        if not arg_1.endswith(arg_0.URL_SEPERATOR):
            arg_1 = arg_1 + arg_0.URL_SEPERATOR
        if arg_2 is None:
            arg_2 = ''
        return '%s%s%s' % (urlparse.urljoin(arg_0.dsn, arg_1), arg_2,
                           arg_0.NAME_EXTENSION)

Method that constructs a full url with the given url and the
        snapshot name.

        Example:
        full_url = _build_endpoint_url('/users', '1')
        full_url => 'http://firebase.localhost/users/1.json'

Method that constructs a full url with the given url and the snapshot name .


def Func(arg_0):
        """Process a brotli stream.
        """
        print('addr  hex{:{}s}binary context explanation'.format(
            '', arg_0.width-10))
        print('Stream header'.center(60, '-'))
        arg_0.windowSize = arg_0.verboseRead(WindowSizeAlphabet())
        print('Metablock header'.center(60, '='))
        arg_0.ISLAST = False
        arg_0.output = bytearray()
        while not arg_0.ISLAST:
            arg_0.ISLAST = arg_0.verboseRead(
                BoolCode('LAST', description="Last block"))
            if arg_0.ISLAST:
                if arg_0.verboseRead(
                    BoolCode('EMPTY', description="Empty block")): break
            if arg_0.metablockLength(): continue
            if not arg_0.ISLAST and arg_0.uncompressed(): continue
            print('Block type descriptors'.center(60, '-'))
            arg_0.numberOfBlockTypes = {}
            arg_0.currentBlockCounts = {}
            arg_0.blockTypeCodes = {}
            arg_0.blockCountCodes = {}
            for arg_8 in (L,I,D): arg_0.blockType(arg_8)
            print('Distance code parameters'.center(60, '-'))
            arg_0.NPOSTFIX, arg_0.NDIRECT = arg_0.verboseRead(DistanceParamAlphabet())
            arg_0.readLiteralContextModes()
            print('Context maps'.center(60, '-'))
            arg_0.cmaps = {}
            #keep the number of each kind of prefix tree for the last loop
            arg_12 = {I: arg_0.numberOfBlockTypes[I]}
            for arg_8 in (L,D):
                arg_12[arg_8] = arg_0.contextMap(arg_8)
            print('Prefix code lists'.center(60, '-'))
            arg_0.prefixCodes = {}
            for arg_8 in (L,I,D):
                arg_0.readPrefixArray(arg_8, arg_12[arg_8])
            arg_0.metablock()


def
Func
(
arg_0
)
:
if
os
.
path
.
exists
(
arg_0
.
managed_path
)
:
logging
.
debug
(
'Repo {} already exists'
.
format
(
arg_0
.
remote_path
)
)
return
logging
.
info
(
'Initiating clone of local repo {}'
.
format
(
arg_0
.
remote_path
)
)
arg_1
=
parent_dir
(
arg_0
.
managed_path
)
if
not
os
.
path
.
exists
(
arg_1
)
:
os
.
makedirs
(
arg_1
)
with
git_error_handling
(
)
:
git
.
Repo
.
clone_from
(
arg_0
.
assemble_remote_path
(
)
,
arg_0
.
managed_path
)

def Func(arg_0):
        """Given a Dusty repo object, clone the remote into Dusty's local repos
        directory if it does not already exist."""
        if os.path.exists(arg_0.managed_path):
            logging.debug('Repo {} already exists'.format(arg_0.remote_path))
            return

        logging.info('Initiating clone of local repo {}'.format(arg_0.remote_path))

        arg_1 = parent_dir(arg_0.managed_path)
        if not os.path.exists(arg_1):
            os.makedirs(arg_1)
        with git_error_handling():
            git.Repo.clone_from(arg_0.assemble_remote_path(), arg_0.managed_path)

Given a Dusty repo object clone the remote into Dusty s local repos directory if it does not already exist .


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_4 = ( arg_0 [ "modelConfig" ] [ "modelParams" ] [ "sensorParams" ] [ "encoders" ] ) for arg_5 in arg_4 . itervalues ( ) : if arg_5 is not None : if arg_5 [ "type" ] == "RandomDistributedScalarEncoder" : arg_6 = max ( arg_3 , ( arg_2 - arg_1 ) / arg_5 . pop ( "numBuckets" ) ) arg_4 [ "c1" ] [ "resolution" ] = arg_6

def Func(arg_0, arg_1, arg_2, arg_3):
  """
  Given model params, figure out the correct parameters for the
  RandomDistributed encoder. Modifies params in place.
  """
  arg_4 = (
    arg_0["modelConfig"]["modelParams"]["sensorParams"]["encoders"]
  )

  for arg_5 in arg_4.itervalues():
    if arg_5 is not None:
      if arg_5["type"] == "RandomDistributedScalarEncoder":
        arg_6 = max(arg_3,
                         (arg_2 - arg_1) / arg_5.pop("numBuckets")
                        )
        arg_4["c1"]["resolution"] = arg_6

Given model params figure out the correct parameters for the RandomDistributed encoder . Modifies params in place .


def Func ( arg_0 ) : if arg_0 . _cfg_path and os . path . isfile ( arg_0 . _cfg_path ) : if arg_0 . run_as_user : subprocess . call ( [ 'sudo' , 'rm' , arg_0 . _cfg_path ] , close_fds = True ) else : os . remove ( arg_0 . _cfg_path )

def Func(arg_0):
        """
        A callback that should be called when this is done running.
        """
        if arg_0._cfg_path and os.path.isfile(arg_0._cfg_path):
            if arg_0.run_as_user:
                subprocess.call(['sudo', 'rm', arg_0._cfg_path], close_fds=True)
            else:
                os.remove(arg_0._cfg_path)

A callback that should be called when this is done running .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
try
:
return
json
.
loads
(
arg_2
)
except
:
raise
optparse
.
OptionValueError
(
"Option %s: invalid dict value: %r"
%
(
arg_1
,
arg_2
)
)

def Func(arg_0, arg_1, arg_2):
    '''Take json as dictionary parameter'''
    try:
      return json.loads(arg_2)
    except:
      raise optparse.OptionValueError("Option %s: invalid dict value: %r" % (arg_1, arg_2))


return [itemParse(i, full=False) for i in rc['auctionInfo']]

def Func ( arg_0 , arg_1 ) : arg_2 = 'GET' arg_3 = 'trade/status' if not isinstance ( arg_1 , ( list , tuple ) ) : arg_1 = ( arg_1 , ) arg_1 = ( str ( arg_6 ) for arg_6 in arg_1 ) arg_4 = { 'tradeIds' : ',' . join ( arg_1 ) } arg_5 = arg_0 . __request__ ( arg_2 , arg_3 , arg_4 = arg_4 ) return [ itemParse ( arg_6 , full = False ) for arg_6 in arg_5 [ 'auctionInfo' ] ]

def Func(arg_0, arg_1):
        """Return trade status.

        :params trade_id: Trade id.
        """
        arg_2 = 'GET'
        arg_3 = 'trade/status'

        if not isinstance(arg_1, (list, tuple)):
            arg_1 = (arg_1,)
        arg_1 = (str(arg_6) for arg_6 in arg_1)
        arg_4 = {'tradeIds': ','.join(arg_1)}  # multiple trade_ids not tested
        arg_5 = arg_0.__request__(arg_2, arg_3, arg_4=arg_4)
        return [itemParse(arg_6, full=False) for arg_6 in arg_5['auctionInfo']]


def Func(arg_0, arg_1, arg_2, arg_3):
        """Include unknown fields after dumping.

        Unknown fields are added with no processing at all.

        Args:
            valid_data (dict or list): data collected and returned by ``dump()``.
            many (bool): if True, data and original_data are a list.
            original_data (object or list): object passed to ``dump()`` in the
                first place.

        Returns:
            dict: the same ``valid_data`` extended with the unknown attributes.

        Inspired by https://github.com/marshmallow-code/marshmallow/pull/595.
        """
        if arg_2:
            for arg_4, arg_5 in enumerate(arg_1):
                arg_6 = set(arg_3[arg_4].__dict__) - set(arg_1[arg_4])
                for arg_7 in arg_6:
                    arg_1[arg_4][arg_7] = getattr(arg_3[arg_4], arg_7)
        else:
            arg_6 = set(arg_3.__dict__) - set(arg_1)
            for arg_7 in arg_6:
                arg_1[arg_7] = getattr(arg_3, arg_7)

        return arg_1


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = [ annotation for annotation in arg_0 if annotation . type_uri == arg_1 ] arg_2 = min ( [ len ( arg_3 ) , arg_2 ] ) if arg_2 == 0 : return None else : return arg_3 [ arg_2 - 1 ]

def Func(arg_0, arg_1, arg_2):
    """ Annotation filtering filter

    :param annotations: List of annotations
    :type annotations: [AnnotationResource]
    :param type_uri: URI Type on which to filter
    :type type_uri: str
    :param number: Number of the annotation to return
    :type number: int
    :return: Annotation(s) matching the request
    :rtype: [AnnotationResource] or AnnotationResource
    """
    arg_3 = [
        annotation
        for annotation in arg_0
        if annotation.type_uri == arg_1
    ]
    arg_2 = min([len(arg_3), arg_2])
    if arg_2 == 0:
        return None
    else:
        return arg_3[arg_2-1]


def Func ( arg_0 ) : arg_0 = os . path . abspath ( arg_0 ) with _backends_lock : if arg_0 not in arg_1 : arg_1 [ arg_0 ] = _MultiprocessStorageBackend ( arg_0 ) return arg_1 [ arg_0 ]

def Func(arg_0):
    """A helper method to get or create a backend with thread locking.

    This ensures that only one backend is used per-file per-process, so that
    thread and process locks are appropriately shared.

    Args:
        filename: The full path to the credential storage file.

    Returns:
        An instance of :class:`_MultiprocessStorageBackend`.
    """
    arg_0 = os.path.abspath(arg_0)

    with _backends_lock:
        if arg_0 not in arg_1:
            arg_1[arg_0] = _MultiprocessStorageBackend(arg_0)
        return arg_1[arg_0]

A helper method to get or create a backend with thread locking .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
np
.
array
(
arg_0
)
arg_3
=
len
(
arg_2
)
if
arg_1
<=
0.
:
raise
ValueError
(
"order must be > 0"
)
arg_4
=
sum
(
abs
(
arg_2
)
**
2.
)
/
arg_3
arg_5
=
arg_4
*
2.
*
arg_3
arg_6
=
np
.
zeros
(
arg_3
,
dtype
=
complex
)
arg_7
=
np
.
zeros
(
arg_3
,
dtype
=
complex
)
for
arg_8
in
range
(
0
,
arg_3
)
:
arg_6
[
arg_8
]
=
arg_2
[
arg_8
]
arg_7
[
arg_8
]
=
arg_2
[
arg_8
]
arg_9
=
np
.
zeros
(
1
,
dtype
=
complex
)
arg_9
[
0
]
=
1
arg_10
=
np
.
zeros
(
arg_1
,
dtype
=
complex
)
arg_11
=
1.
arg_12
=
np
.
zeros
(
arg_1
+
1
)
arg_12
[
0
]
=
arg_4
for
arg_13
in
range
(
0
,
arg_1
)
:
arg_14
=
arg_6
[
1
:
]
arg_15
=
arg_7
[
0
:
1
]
arg_16
=
2.
*
np
.
dot
(
arg_15
.
conj
(
)
.
transpose
(
)
,
arg_14
)
arg_5
=
np
.
dot
(
arg_14
.
conj
(
)
.
transpose
(
)
,
arg_14
)
arg_5
+=
np
.
dot
(
arg_15
,
arg_15
.
conj
(
)
.
transpose
(
)
)
arg_10
[
arg_13
]
=
arg_16
/
arg_5
arg_6
=
arg_14
+
arg_10
[
arg_13
]
*
arg_15
arg_7
=
arg_15
+
arg_10
[
arg_13
]
.
conj
(
)
.
transpose
(
)
*
arg_14
arg_9
.
resize
(
len
(
arg_9
)
+
1
)
arg_9
=
arg_9
+
arg_10
[
arg_13
]
*
np
.
flipud
(
arg_9
)
.
conjugate
(
)
arg_12
[
arg_13
+
1
]
=
(
1
arg_10
[
arg_13
]
.
conj
(
)
.
transpose
(
)
*
arg_10
[
arg_13
]
)
*
arg_12
[
arg_13
]
return
arg_9
,
arg_12
[
1
]
,
arg_10

def Func(arg_0, arg_1):
    """This version is 10 times faster than arburg, but the output rho is not correct.

    returns [1 a0,a1, an-1]

    """
    arg_2 = np.array(arg_0)
    arg_3 = len(arg_2)

    if arg_1 <= 0.:
        raise ValueError("order must be > 0")

    # Initialisation
    # ------ rho, den
    arg_4 = sum(abs(arg_2)**2.) / arg_3  # Eq 8.21 [Marple]_
    arg_5 = arg_4 * 2. * arg_3

    # ------ backward and forward errors
    arg_6 = np.zeros(arg_3, dtype=complex)
    arg_7 = np.zeros(arg_3, dtype=complex)
    for arg_8 in range(0, arg_3):  #eq 8.11
        arg_6[arg_8] = arg_2[arg_8]
        arg_7[arg_8] = arg_2[arg_8]

    # AR order to be stored
    arg_9 = np.zeros(1, dtype=complex)
    arg_9[0] = 1
    # ---- rflection coeff to be stored
    arg_10 = np.zeros(arg_1, dtype=complex)

    arg_11 = 1.
    arg_12 = np.zeros(arg_1+1)
    arg_12[0] = arg_4

    for arg_13 in range(0, arg_1):
        #print m
        # Calculate the next order reflection (parcor) coefficient
        arg_14 = arg_6[1:]
        arg_15 = arg_7[0:-1]
        #print efp, ebp
        arg_16 = -2.* np.dot(arg_15.conj().transpose(),  arg_14)
        arg_5 = np.dot(arg_14.conj().transpose(),  arg_14)
        arg_5 += np.dot(arg_15,  arg_15.conj().transpose())
        arg_10[arg_13] = arg_16 / arg_5

        # Update the forward and backward prediction errors
        arg_6 = arg_14 + arg_10[arg_13] * arg_15
        arg_7 = arg_15 + arg_10[arg_13].conj().transpose() * arg_14

        # Update the AR coeff.
        arg_9.resize(len(arg_9)+1)
        arg_9 = arg_9 + arg_10[arg_13] * np.flipud(arg_9).conjugate()

        # Update the prediction error
        arg_12[arg_13+1] = (1 - arg_10[arg_13].conj().transpose()*arg_10[arg_13]) * arg_12[arg_13]
        #print 'REF', ref, num, den
    return arg_9, arg_12[-1], arg_10

This version is 10 times faster than arburg but the output rho is not correct .


def Func ( arg_0 ) : arg_1 = OrderedDict ( [ ( "clean_len" , 0 ) , ( "total_trim" , 0 ) , ( "total_trim_perc" , 0 ) , ( "5trim" , 0 ) , ( "3trim" , 0 ) , ( "bad_reads" , 0 ) ] ) with open ( arg_0 ) as fh : for arg_2 in fh : arg_3 = [ int ( x ) for x in arg_2 . strip ( ) . split ( ) [ - 4 : ] ] if not arg_3 [ 0 ] : arg_1 [ "bad_reads" ] += 1 arg_1 [ "5trim" ] += arg_3 [ 1 ] arg_1 [ "3trim" ] += arg_3 [ 3 ] arg_1 [ "total_trim" ] += arg_3 [ 1 ] + arg_3 [ 3 ] arg_1 [ "clean_len" ] += arg_3 [ 0 ] arg_4 = arg_1 [ "clean_len" ] + arg_1 [ "total_trim" ] if arg_4 : arg_1 [ "total_trim_perc" ] = round ( ( arg_1 [ "total_trim" ] / arg_4 ) * 100 , 2 ) else : arg_1 [ "total_trim_perc" ] = 0 return arg_1

def Func(arg_0):
    """Retrieves some statistics from a single Trimmomatic log file.

    This function parses Trimmomatic's log file and stores some trimming
    statistics in an :py:class:`OrderedDict` object. This object contains
    the following keys:

        - ``clean_len``: Total length after trimming.
        - ``total_trim``: Total trimmed base pairs.
        - ``total_trim_perc``: Total trimmed base pairs in percentage.
        - ``5trim``: Total base pairs trimmed at 5' end.
        - ``3trim``: Total base pairs trimmed at 3' end.

    Parameters
    ----------
    log_file : str
        Path to trimmomatic log file.

    Returns
    -------
    x : :py:class:`OrderedDict`
        Object storing the trimming statistics.

    """

    arg_1 = OrderedDict([
        # Total length after trimming
        ("clean_len", 0),
        # Total trimmed base pairs
        ("total_trim", 0),
        # Total trimmed base pairs in percentage
        ("total_trim_perc", 0),
        # Total trimmed at 5' end
        ("5trim", 0),
        # Total trimmed at 3' end
        ("3trim", 0),
        # Bad reads (completely trimmed)
        ("bad_reads", 0)
    ])

    with open(arg_0) as fh:

        for arg_2 in fh:
            # This will split the log fields into:
            # 0. read length after trimming
            # 1. amount trimmed from the start
            # 2. last surviving base
            # 3. amount trimmed from the end
            arg_3 = [int(x) for x in arg_2.strip().split()[-4:]]

            if not arg_3[0]:
                arg_1["bad_reads"] += 1

            arg_1["5trim"] += arg_3[1]
            arg_1["3trim"] += arg_3[3]
            arg_1["total_trim"] += arg_3[1] + arg_3[3]
            arg_1["clean_len"] += arg_3[0]

        arg_4 = arg_1["clean_len"] + arg_1["total_trim"]

        if arg_4:
            arg_1["total_trim_perc"] = round(
                (arg_1["total_trim"] / arg_4) * 100, 2)
        else:
            arg_1["total_trim_perc"] = 0

    return arg_1

Retrieves some statistics from a single Trimmomatic log file .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
False
arg_3
=
{
}
def
parse_add_single_option
(
arg_4
)
:
if
"="
in
arg_4
:
arg_5
,
arg_6
=
arg_4
.
split
(
"="
,
1
)
arg_6
=
arg_6
.
replace
(
'"'
,
''
)
else
:
arg_5
=
arg_4
arg_6
=
True
if
" "
in
arg_5
or
not
arg_0
.
OPTION_NAME_RE
.
match
(
arg_5
)
:
raise
InvalidOptionNameError
(
"%s is not valid option name."
%
arg_5
)
if
arg_0
.
strict_mode
:
for
arg_7
,
arg_8
in
arg_0
.
OPTIONS_SPEC
:
if
arg_5
.
lower
(
)
==
arg_7
:
if
arg_8
and
arg_6
is
True
:
raise
MissingMandatoryOptionValueError
(
"%s is missing mandatory value."
%
arg_5
)
break
else
:
raise
UnknownOptionNameError
(
"%s is unrecognized option name."
%
arg_5
)
if
arg_5
not
in
arg_3
:
arg_3
[
arg_5
]
=
[
]
arg_3
[
arg_5
]
.
append
(
arg_6
)
arg_9
=
0
arg_10
=
1
for
arg_10
,
arg_11
in
enumerate
(
arg_1
)
:
if
arg_11
==
'"'
:
arg_2
=
not
arg_2
if
arg_2
:
continue
if
arg_11
==
","
:
arg_4
=
arg_1
[
arg_9
:
arg_10
]
parse_add_single_option
(
arg_4
)
arg_9
=
arg_10
+
1
if
arg_9
+
1
!=
arg_10
:
arg_4
=
arg_1
[
arg_9
:
]
parse_add_single_option
(
arg_4
)
if
arg_2
:
raise
InvalidOptionsError
(
"Unbalanced quotes."
)
return
arg_3

def Func(arg_0, arg_1):
        """Parses ssh options string."""
        arg_2 = False
        arg_3 = {}

        def parse_add_single_option(arg_4):
            """Parses and validates a single option, and adds it to parsed_options field."""
            if "=" in arg_4:
                arg_5, arg_6 = arg_4.split("=", 1)
                arg_6 = arg_6.replace('"', '')
            else:
                arg_5 = arg_4
                arg_6 = True
            if " " in arg_5 or not arg_0.OPTION_NAME_RE.match(arg_5):
                raise InvalidOptionNameError("%s is not valid option name." % arg_5)
            if arg_0.strict_mode:
                for arg_7, arg_8 in arg_0.OPTIONS_SPEC:
                    if arg_5.lower() == arg_7:
                        if arg_8 and arg_6 is True:
                            raise MissingMandatoryOptionValueError("%s is missing mandatory value." % arg_5)
                        break
                else:
                    raise UnknownOptionNameError("%s is unrecognized option name." % arg_5)
            if arg_5 not in arg_3:
                arg_3[arg_5] = []
            arg_3[arg_5].append(arg_6)

        arg_9 = 0
        arg_10 = 1  # Need to be set for empty options strings
        for arg_10, arg_11 in enumerate(arg_1):
            if arg_11 == '"':  # only double quotes are allowed, no need to care about single quotes
                arg_2 = not arg_2
            if arg_2:
                continue
            if arg_11 == ",":
                arg_4 = arg_1[arg_9:arg_10]
                parse_add_single_option(arg_4)
                arg_9 = arg_10 + 1
                # Data begins after the first space
        if arg_9 + 1 != arg_10:
            arg_4 = arg_1[arg_9:]
            parse_add_single_option(arg_4)
        if arg_2:
            raise InvalidOptionsError("Unbalanced quotes.")
        return arg_3


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_0
.
Func_node
(
arg_1
)
if
arg_2
is
:
raise
KeyError
(
'No object named %s in the file'
%
arg_1
)
if
hasattr
(
arg_2
,
'attrs'
)
:
if
'pandas_type'
in
arg_2
.
attrs
:
return
arg_0
.
_read_group
(
arg_2
)
return
arg_0
.
_read_array
(
arg_2
)

def Func(arg_0, arg_1):
        """
        Retrieve pandas object or group of Numpy ndarrays
        stored in file

        Parameters
        ----------
        key : object

        Returns
        -------
        obj : type of object stored in file
        """
        arg_2 = arg_0.Func_node(arg_1)
        if arg_2 is None:
            raise KeyError('No object named %s in the file' % arg_1)

        if hasattr(arg_2, 'attrs'):
            if 'pandas_type' in arg_2.attrs:
                return arg_0._read_group(arg_2)

        return arg_0._read_array(arg_2)


def Func ( arg_0 , arg_1 , ** arg_2 ) : if arg_1 . method == 'GET' : arg_3 = arg_0 . controller . cached_request ( arg_1 ) if arg_3 : return arg_0 . build_response ( arg_1 , arg_3 , from_cache = True ) arg_1 . headers . update ( arg_0 . controller . conditional_headers ( arg_1 ) ) arg_4 = super ( CacheControlAdapter , arg_0 ) . Func ( arg_1 , ** arg_2 ) return arg_4

def Func(arg_0, arg_1, **arg_2):
        """
        Send a request. Use the request information to see if it
        exists in the cache and cache the response if we need to and can.
        """
        if arg_1.method == 'GET':
            arg_3 = arg_0.controller.cached_request(arg_1)
            if arg_3:
                return arg_0.build_response(arg_1, arg_3,
                                           from_cache=True)

            # check for etags and add headers if appropriate
            arg_1.headers.update(
                arg_0.controller.conditional_headers(arg_1)
            )

        arg_4 = super(CacheControlAdapter, arg_0).Func(arg_1, **arg_2)

        return arg_4

Send a request . Use the request information to see if it exists in the cache and cache the response if we need to and can .


(returns, txn_daily, simulate_starting_capital,
                           backtest_starting_capital, impact=0.1)

def Func(arg_0, arg_1, arg_2,
                           arg_3, arg_4=0.1):
    """
    Applies quadratic volumeshare slippage model to daily returns based
    on the proportion of the observed historical daily bar dollar volume
    consumed by the strategy's trades. Scales the size of trades based
    on the ratio of the starting capital we wish to test to the starting
    capital of the passed backtest data.

    Parameters
    ----------
    returns : pd.Series
        Time series of daily returns.
    txn_daily : pd.Series
        Daily transaciton totals, closing price, and daily volume for
        each traded name. See price_volume_daily_txns for more details.
    simulate_starting_capital : integer
        capital at which we want to test
    backtest_starting_capital: capital base at which backtest was
        origionally run. impact: See Zipline volumeshare slippage model
    impact : float
        Scales the size of the slippage penalty.

    Returns
    -------
    adj_returns : pd.Series
        Slippage penalty adjusted daily returns.
    """

    arg_5 = arg_2 / arg_3
    arg_6 = abs(arg_5 * arg_1.amount)
    arg_7 = arg_1.price * arg_6
    arg_8 = arg_6 / arg_1.volume

    arg_9 = arg_8**2 \
        * arg_4 * arg_7

    arg_10 = arg_9.resample('D').sum()
    arg_10 = arg_10.reindex(arg_0.index).fillna(0)

    # Since we are scaling the numerator of the penalties linearly
    # by capital base, it makes the most sense to scale the denominator
    # similarly. In other words, since we aren't applying compounding to
    # simulate_traded_shares, we shouldn't apply compounding to pv.
    arg_11 = ep.cum_returns(
        arg_0, starting_value=arg_3) * arg_5

    arg_12 = arg_0 - (arg_10 / arg_11)

    return arg_12

Applies quadratic volumeshare slippage model to daily returns based on the proportion of the observed historical daily bar dollar volume consumed by the strategy s trades . Scales the size of trades based on the ratio of the starting capital we wish to test to the starting capital of the passed backtest data .


def Func(arg_0, arg_1):
        """
        Create ContentMetadataItemTransmision models for the given content metadata items.
        """
        # pylint: disable=invalid-name
        arg_2 = apps.get_model(
            'integrated_channel',
            'ContentMetadataItemTransmission'
        )
        arg_3 = []
        for arg_4, arg_5 in arg_1.items():
            arg_3.append(
                arg_2(
                    enterprise_customer=arg_0.enterprise_configuration.enterprise_customer,
                    integrated_channel_code=arg_0.enterprise_configuration.channel_code(),
                    arg_4=arg_4,
                    arg_5=arg_5
                )
            )
        arg_2.objects.bulk_create(arg_3)

Create ContentMetadataItemTransmision models for the given content metadata items .


def Func ( arg_0 ) : arg_0 . quit . set ( ) while sorted ( [ arg_0 . pool [ arg_1 ] . is_alive ( ) for arg_1 in xrange ( len ( arg_0 . pool ) ) ] ) [ - 1 ] : time . sleep ( 1 ) try : while not arg_0 . task_queue . empty ( ) : arg_0 . task_queue . get ( timeout = 0.1 ) arg_0 . task_queue . close ( ) arg_0 . feeder . join ( ) except Exception as ex : logger . info ( ex )

def Func(arg_0):
        """
        Say the workers to finish their jobs and quit.
        """
        arg_0.quit.set()
        # yapf:disable
        while sorted([
                arg_0.pool[arg_1].is_alive()
                for arg_1 in xrange(len(arg_0.pool))])[-1]:
            time.sleep(1)
        # yapf:enable
        try:
            while not arg_0.task_queue.empty():
                arg_0.task_queue.get(timeout=0.1)
            arg_0.task_queue.close()
            arg_0.feeder.join()
        except Exception as ex:
            logger.info(ex)

Say the workers to finish their jobs and quit .


async
def
Func
(
arg_0
)
:
arg_1
,
arg_2
=
await
asyncio
.
get_event_loop
(
)
.
create_datagram_endpoint
(
QRebootProtocol
,
local_addr
=
(
arg_0
,
0
)
,
allow_broadcast
=
True
,
reuse_address
=
True
,
)
LOG
.
info
(
"Sending Func on %s"
,
arg_0
)
arg_2
.
send_Func
(
)

async def Func(arg_0):
    """ async function to Func QTM cameras """
    arg_1, arg_2 = await asyncio.get_event_loop().create_datagram_endpoint(
        QRebootProtocol,
        local_addr=(arg_0, 0),
        allow_broadcast=True,
        reuse_address=True,
    )

    LOG.info("Sending Func on %s", arg_0)
    arg_2.send_Func()


def
Func
(
arg_0
=
False
,
arg_1
=
False
)
:
arg_2
=
np
.
linspace
(
1
,
np
.
log10
(
20.0
)
,
100
)
arg_3
=
OrderedDict
(
[
(
'K0V'
,
(
5.58
,
0.87
)
)
,
(
'G5V'
,
(
4.78
,
0.74
)
)
,
(
'G0V'
,
(
4.24
,
0.67
)
)
,
(
'F5V'
,
(
3.50
,
0.50
)
)
,
(
'F0V'
,
(
2.98
,
0.38
)
)
,
(
'RC'
,
(
0.8
,
1.0
)
)
]
)
arg_4
=
{
}
arg_5
=
plt
.
figure
(
figsize
=
(
10
,
6.5
)
)
arg_6
=
plt
.
gca
(
)
for
arg_7
in
arg_3
.
keys
(
)
:
arg_8
=
arg_3
[
arg_7
]
[
0
]
+
5.0
*
arg_2
+
10.0
arg_9
=
(
arg_8
>
14
)
&
(
arg_8
<
16
)
arg_10
=
arg_8
+
gminvFromVmini
(
arg_3
[
arg_7
]
[
1
]
)
arg_11
=
parallaxErrorSkyAvg
(
arg_10
,
arg_3
[
arg_7
]
[
1
]
)
arg_12
=
arg_11
*
10
**
arg_2
/
1000.0
plt
.
loglog
(
10
**
arg_2
,
arg_12
,
'--k'
,
lw
=
1
)
plt
.
loglog
(
10
**
arg_2
[
arg_9
]
,
arg_12
[
arg_9
]
,
'-'
,
label
=
arg_7
)
plt
.
xlim
(
0.1
,
20.0
)
plt
.
ylim
(
0.001
,
0.5
)
plt
.
text
(
0.9
,
0.05
,
'Colours indicate $14<V<16$'
,
horizontalalignment
=
'right'
,
verticalalignment
=
'bottom'
,
transform
=
arg_6
.
transAxes
)
plt
.
legend
(
loc
=
2
)
plt
.
xlabel
(
'distance [kpc]'
)
plt
.
ylabel
(
'$\\sigma_\\varpi/\\varpi$'
)
plt
.
grid
(
which
=
'both'
)
if
(
args
[
'pdfOutput'
]
)
:
plt
.
savefig
(
'RelativeParallaxErrorsVsDist.pdf'
)
elif
(
args
[
'pngOutput'
]
)
:
plt
.
savefig
(
'RelativeParallaxErrorsVsDist.png'
)
else
:
plt
.
show
(
)

def Func(arg_0=False, arg_1=False):
  """
  Plot relative parallax errors as a function of distance for stars of a given spectral type.

  Parameters
  ----------

  args - command line arguments
  """
  arg_2 = np.linspace(-1,np.log10(20.0),100)
  arg_3=OrderedDict([('K0V',(5.58,0.87)), ('G5V',(4.78,0.74)), ('G0V',(4.24,0.67)),
    ('F5V',(3.50,0.50)), ('F0V',(2.98,0.38)), ('RC',(0.8,1.0))])
  arg_4={}

  arg_5=plt.figure(figsize=(10,6.5))
  arg_6=plt.gca()

  for arg_7 in arg_3.keys():
    arg_8=arg_3[arg_7][0]+5.0*arg_2+10.0
    arg_9=(arg_8>14) & (arg_8<16)
    arg_10=arg_8+gminvFromVmini(arg_3[arg_7][1])
    arg_11=parallaxErrorSkyAvg(arg_10,arg_3[arg_7][1])
    arg_12=arg_11*10**arg_2/1000.0
    plt.loglog(10**arg_2, arg_12,'--k',lw=1)
    plt.loglog(10**arg_2[arg_9], arg_12[arg_9],'-',label=arg_7)
  plt.xlim(0.1,20.0)
  plt.ylim(0.001,0.5)
  plt.text(0.9, 0.05,'Colours indicate $14<V<16$',
     horizontalalignment='right',
     verticalalignment='bottom',
     transform = arg_6.transAxes)
  plt.legend(loc=2)
  plt.xlabel('distance [kpc]')
  plt.ylabel('$\\sigma_\\varpi/\\varpi$')
  plt.grid(which='both')

  if (args['pdfOutput']):
    plt.savefig('RelativeParallaxErrorsVsDist.pdf')
  elif (args['pngOutput']):
    plt.savefig('RelativeParallaxErrorsVsDist.png')
  else:
    plt.show()

Plot relative parallax errors as a function of distance for stars of a given spectral type .


return name.startswith('.') or platform_hidden(full_path)

def Func ( arg_0 ) : arg_1 = os . path . abspath ( arg_0 ) arg_2 = os . path . basename ( arg_1 ) def no ( arg_0 ) : return False arg_3 = globals ( ) . get ( 'Func_' + platform . system ( ) , no ) return arg_2 . startswith ( '.' ) or arg_3 ( arg_1 )

def Func(arg_0):
	"""
	Check whether a file is presumed hidden, either because
	the pathname starts with dot or because the platform
	indicates such.
	"""
	arg_1 = os.path.abspath(arg_0)
	arg_2 = os.path.basename(arg_1)

	def no(arg_0):
		return False
	arg_3 = globals().get('Func_' + platform.system(), no)
	return arg_2.startswith('.') or arg_3(arg_1)

Check whether a file is presumed hidden either because the pathname starts with dot or because the platform indicates such .


def
Func
(
arg_0
,
arg_1
)
:
if
not
isinstance
(
arg_1
,
integer_types
)
:
raise
TypeError
(
"depth must be an integer"
)
_lib
.
SSL_CTX_Func
(
arg_0
.
_context
,
arg_1
)

def Func(arg_0, arg_1):
        """
        Set the maximum depth for the certificate chain verification that shall
        be allowed for this Context object.

        :param depth: An integer specifying the verify depth
        :return: None
        """
        if not isinstance(arg_1, integer_types):
            raise TypeError("depth must be an integer")

        _lib.SSL_CTX_Func(arg_0._context, arg_1)

Set the maximum depth for the certificate chain verification that shall be allowed for this Context object .


def Func ( arg_0 ) : arg_1 = Popen ( arg_0 . command , stdout = PIPE , stderr = PIPE , shell = True ) ( arg_2 , arg_3 ) = arg_1 . communicate ( ) if arg_1 . returncode != 0 : return arg_0 . _decode_output ( arg_3 ) return arg_0 . _decode_output ( arg_2 )

def Func(arg_0):
        """
        Execute the given command.

        :return: The output of the command.
        :rtype: str
        """

        # We initiate a process and parse the command to it.
        arg_1 = Popen(arg_0.command, stdout=PIPE, stderr=PIPE, shell=True)

        # We communicate the command and get the output and the error.
        (arg_2, arg_3) = arg_1.communicate()

        if arg_1.returncode != 0:  # pragma: no cover
            # The return code is different to 0.

            # We return the decoded error.
            return arg_0._decode_output(arg_3)

        # The return code (or exit code if you prefer) if equal to 0.

        # We return the decoded output of the Funcd command.
        return arg_0._decode_output(arg_2)


def Func ( arg_0 , arg_1 = "\t" , arg_2 = arg_3 . stdout ) : for arg_5 in arg_0 : print ( * arg_5 , arg_1 = arg_1 , arg_2 = arg_2 )

def Func(arg_0, arg_1="\t", arg_2=arg_3.stdout):
    """stupidly print an iterable of iterables in TSV format"""
    for arg_5 in arg_0:
        print(*arg_5, arg_1=arg_1, arg_2=arg_2)


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = [ arg_9 for arg_9 in arg_0 . ancestors ( arg_1 ) if ( arg_2 and arg_9 [ 'line_type' ] == arg_2 ) or ( not arg_2 and not arg_9 [ 'parents' ] ) ] or [ arg_1 ] for arg_4 in arg_3 : arg_4 [ 'line_status' ] = 'Funcd' arg_5 = arg_0 . descendants ( arg_4 ) for arg_6 in arg_5 : arg_6 [ 'line_status' ] = 'Funcd' arg_7 = arg_0 . ancestors ( arg_4 ) for arg_8 in arg_7 : if len ( [ arg_9 for arg_9 in arg_8 [ 'children' ] if arg_9 [ 'line_status' ] != 'Funcd' ] ) == 0 : arg_8 [ 'line_status' ] = 'Funcd'

def Func(arg_0, arg_1, arg_2=None):
        """
        Marks line_data and all of its associated feature's 'line_status' as 'Funcd', does not actually Func the line_data from the data structure.
        The write function checks the 'line_status' when writing the gff file.
        Find the root parent of line_data of type root_type, Func all of its descendants.
        If the root parent has a parent with no children after the Func, Func the root parent's parent recursively.

        :param line_data:
        :param root_type:
        :return:
        """
        arg_3 = [arg_9 for arg_9 in arg_0.ancestors(arg_1) if (arg_2 and arg_9['line_type'] == arg_2) or (not arg_2 and not arg_9['parents'])] or [arg_1]
        for arg_4 in arg_3:
            arg_4['line_status'] = 'Funcd'
            arg_5 = arg_0.descendants(arg_4)
            for arg_6 in arg_5:
                arg_6['line_status'] = 'Funcd'
            arg_7 = arg_0.ancestors(arg_4) # BFS, so we will process closer ancestors first
            for arg_8 in arg_7:
                if len([arg_9 for arg_9 in arg_8['children'] if arg_9['line_status'] != 'Funcd']) == 0: # if all children of a root_ancestor is Funcd
                    # Func this root_ancestor
                    arg_8['line_status'] = 'Funcd'

Marks line_data and all of its associated feature's 'line_status' as 'removed', does not actually remove the line_data from the data structure.
        The write function checks the 'line_status' when writing the gff file.
        Find the root parent of line_data of type root_type, remove all of its descendants.
        If the root parent has a parent with no children after the remove, remove the root parent's parent recursively.

        :param line_data:
        :param root_type:
        :return:

Marks line_data and all of its associated feature s line_status as removed does not actually remove the line_data from the data structure . The write function checks the line_status when writing the gff file . Find the root parent of line_data of type root_type remove all of its descendants . If the root parent has a parent with no children after the remove remove the root parent s parent recursively .


def Func(arg_0, arg_1, arg_2=None):
  """Convert a vector size to a matrix size."""
  if isinstance(arg_0, (float, int, np.generic, np.ndarray)):
    arg_3 = (-1 + np.sqrt(1 + 8 * arg_0)) / 2.
    if float(int(arg_3)) != arg_3:
      raise ValueError("Vector length is not a triangular number.")
    return int(arg_3)
  else:
    with tf.name_scope(arg_2 or "Func") as arg_2:
      arg_3 = (-1. + tf.sqrt(1 + 8. * tf.cast(arg_0, dtype=tf.float32))) / 2.
      if arg_1:
        with tf.control_dependencies([
            assert_util.assert_equal(
                tf.cast(tf.cast(arg_3, dtype=tf.int32), dtype=tf.float32),
                arg_3,
                message="Vector length is not a triangular number")
        ]):
          arg_3 = tf.identity(arg_3)
      return tf.cast(arg_3, arg_0.dtype)

Convert a vector size to a matrix size .


def
Func
(
arg_0
)
:
arg_1
=
arg_0
.
local_renderer
arg_2
=
{
}
arg_3
=
[
'ALLOW_CELERY'
,
'DJANGO_SETTINGS_MODULE'
]
for
arg_4
in
arg_3
:
arg_2
[
arg_4
]
=
arg_5
.
environ
.
get
(
arg_4
)
try
:
if
arg_1
.
env
.
local_project_dir
:
sys
.
path
.
insert
(
0
,
arg_1
.
env
.
local_project_dir
)
arg_5
.
environ
[
'ALLOW_CELERY'
]
=
'0'
arg_5
.
environ
[
'DJANGO_SETTINGS_MODULE'
]
=
arg_1
.
format
(
arg_1
.
env
.
settings_module
)
try
:
import
django
django
.
setup
(
)
except
AttributeError
:
pass
arg_7
=
arg_0
.
get_settings
(
)
try
:
from
django
.
contrib
import
staticfiles
from
django
.
conf
import
arg_7
as
_settings
if
arg_7
is
not
:
for
arg_8
,
arg_9
in
arg_7
.
__dict__
.
items
(
)
:
setattr
(
_settings
,
arg_8
,
arg_9
)
else
:
raise
ImportError
except
(
ImportError
,
RuntimeError
)
:
print
(
'Unable to load settings.'
)
traceback
.
print_exc
(
)
finally
:
for
arg_4
,
arg_10
in
arg_2
.
items
(
)
:
if
arg_10
is
:
del
arg_5
.
environ
[
arg_4
]
else
:
arg_5
.
environ
[
arg_4
]
=
arg_10
return
arg_7

def Func(arg_0):
        """
        Loads Django settings for the current site and sets them so Django internals can be run.
        """
        arg_1 = arg_0.local_renderer

        # Save environment variables so we can restore them later.
        arg_2 = {}
        arg_3 = ['ALLOW_CELERY', 'DJANGO_SETTINGS_MODULE']
        for arg_4 in arg_3:
            arg_2[arg_4] = arg_5.environ.get(arg_4)

        try:

            # Allow us to import local app modules.
            if arg_1.env.local_project_dir:
                sys.path.insert(0, arg_1.env.local_project_dir)

            #TODO:remove this once bug in django-celery has been fixed
            arg_5.environ['ALLOW_CELERY'] = '0'

#             print('settings_module:', r.format(r.env.settings_module))
            arg_5.environ['DJANGO_SETTINGS_MODULE'] = arg_1.format(arg_1.env.settings_module)
#             os.environ['CELERY_LOADER'] = 'django'
#             os.environ['SITE'] = r.genv.SITE or r.genv.default_site
#             os.environ['ROLE'] = r.genv.ROLE or r.genv.default_role

            # In Django >= 1.7, fixes the error AppRegistryNotReady: Apps aren't loaded yet
            # Disabling, in Django >= 1.10, throws exception:
            # RuntimeError: Model class django.contrib.contenttypes.models.ContentType
            # doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
#             try:
#                 from django.core.wsgi import get_wsgi_application
#                 application = get_wsgi_application()
#             except (ImportError, RuntimeError):
#                 raise
#                 print('Unable to get wsgi application.')
#                 traceback.print_exc()

            # In Django >= 1.7, fixes the error AppRegistryNotReady: Apps aren't loaded yet
            try:
                import django
                django.setup()
            except AttributeError:
                # This doesn't exist in Django < 1.7, so ignore it.
                pass

            # Load Django settings.
            arg_7 = arg_0.get_settings()
            try:
                from django.contrib import staticfiles
                from django.conf import arg_7 as _settings

                # get_settings() doesn't raise ImportError but returns None instead
                if arg_7 is not None:
                    for arg_8, arg_9 in arg_7.__dict__.items():
                        setattr(_settings, arg_8, arg_9)
                else:
                    raise ImportError
            except (ImportError, RuntimeError):
                print('Unable to load settings.')
                traceback.print_exc()

        finally:
            # Restore environment variables.
            for arg_4, arg_10 in arg_2.items():
                if arg_10 is None:
                    del arg_5.environ[arg_4]
                else:
                    arg_5.environ[arg_4] = arg_10

        return arg_7

Loads Django settings for the current site and sets them so Django internals can be run .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_2 + '/' + os . path . basename ( arg_1 ) if os . path . dirname ( arg_1 ) != arg_2 : try : shutil . copyfile ( arg_1 , arg_3 ) os . chmod ( arg_3 , 0o777 ) except OSError as e : raise FileCopyException ( e , arg_0 . hostname ) return arg_3

def Func(arg_0, arg_1, arg_2):
        ''' If the source files dirpath is the same as dest_dir, a copy
        is not necessary, and nothing is done. Else a copy is made.

        Args:
            - source (string) : Path to the source file
            - dest_dir (string) : Path to the directory to which the files is to be copied

        Returns:
            - destination_path (String) : Absolute path of the destination file

        Raises:
            - FileCopyException : If file copy failed.
        '''

        arg_3 = arg_2 + '/' + os.path.basename(arg_1)

        # Only attempt to copy if the target dir and source dir are different
        if os.path.dirname(arg_1) != arg_2:
            try:
                shutil.copyfile(arg_1, arg_3)
                os.chmod(arg_3, 0o777)

            except OSError as e:
                raise FileCopyException(e, arg_0.hostname)

        return arg_3

If the source files dirpath is the same as dest_dir a copy is not necessary and nothing is done . Else a copy is made .


Calls consume_function for each element of this streamlet. This function returns nothing

def Func ( arg_0 , arg_1 ) : from heronpy . streamlet . impl . Funcbolt import ConsumeStreamlet arg_2 = ConsumeStreamlet ( arg_1 , arg_0 ) arg_0 . _add_child ( arg_2 ) return

def Func(arg_0, arg_1):
    """Calls Func_function for each element of this streamlet. This function returns nothing
    """
    from heronpy.streamlet.impl.Funcbolt import ConsumeStreamlet
    arg_2 = ConsumeStreamlet(arg_1, arg_0)
    arg_0._add_child(arg_2)
    return

Calls consume_function for each element of this streamlet . This function returns nothing


def Func(arg_0, arg_1):
    """
    This function creates a 2d gaussian kernel with the standard deviation
    denoted by sigma

    :param dim: integer denoting a side (1-d) of gaussian kernel
    :param sigma: floating point indicating the standard deviation

    :returns: a numpy 2d array
    """

    # check if the dimension is odd
    if arg_0 % 2 == 0:
        raise ValueError("Kernel dimension should be odd")

    # initialize the kernel
    arg_2 = np.zeros((arg_0, arg_0), dtype=np.float16)

    # calculate the center point
    arg_3 = arg_0/2

    # calculate the variance
    arg_4 = arg_1 ** 2

    # calculate the normalization coefficeint
    arg_5 = 1. / (2 * arg_4)

    # create the kernel
    for arg_6 in range(0, arg_0):
        for arg_7 in range(0, arg_0):
            arg_8 = abs(arg_6 - arg_3)
            arg_9 = abs(arg_7 - arg_3)
            arg_10 = arg_8**2 + arg_9**2
            arg_11 = 2*arg_4

            arg_2[arg_6,arg_7] = arg_5 * np.exp(-1. * arg_10/arg_11)

    return arg_2/sum(sum(arg_2))


return self._perform_get(
            '/' + self.subscription_id + '/certificates/' + _str(thumbprint),
            SubscriptionCertificate)

def Func ( arg_0 , arg_1 ) : _validate_not_none ( 'thumbprint' , arg_1 ) return arg_0 . _perform_get ( '/' + arg_0 . subscription_id + '/certificates/' + _str ( arg_1 ) , SubscriptionCertificate )

def Func(arg_0, arg_1):
        '''
        The Get Management Certificate operation retrieves information about
        the management certificate with the specified thumbprint. Management
        certificates, which are also known as subscription certificates,
        authenticate clients attempting to connect to resources associated
        with your Windows Azure subscription.

        thumbprint:
            The thumbprint value of the certificate.
        '''
        _validate_not_none('thumbprint', arg_1)
        return arg_0._perform_get(
            '/' + arg_0.subscription_id + '/certificates/' + _str(arg_1),
            SubscriptionCertificate)

The Get Management Certificate operation retrieves information about the management certificate with the specified thumbprint . Management certificates which are also known as subscription certificates authenticate clients attempting to connect to resources associated with your Windows Azure subscription .