def Func(arg_0, arg_1='auto', arg_2=None):
        """ Sets the class_weight of the classifier to match y """

        if arg_1 is None:
            arg_3 = None

            try:
                arg_0.clf.set_params(arg_1=arg_3)
            except ValueError:
                pass

        elif arg_1 == 'auto':
            arg_4 = np.bincount(arg_2)
            arg_5 = np.nonzero(arg_4)[0]
            arg_4 = arg_4 / float(arg_4.sum())
            arg_3 = dict(zip(arg_5[::-1], arg_4[arg_5]))

            try:
                arg_0.clf.set_params(arg_1=arg_3)
            except ValueError:
                import warnings
                warnings.warn(
                    "Tried to set class_weight, but failed. The classifier "
                    "probably doesn't support it")


(df, column: str, value=None,  column_value=None)

def Func(arg_0, arg_1: arg_2, arg_3=None,  arg_4=None):
    """
    Can fill NaN values from a column with a given value or a column

    ---

    ### Parameters

    - `column` (*str*): name of column you want to fill
    - `value`: NaN will be replaced by this value
    - `column_value`: NaN will be replaced by value from this column

    *NOTE*: You must set either the 'value' parameter or the 'column_value' parameter

    ---

    ### Example

    **Input**

    | variable |   wave  |  year    | my_value |
    |:--------:|:-------:|:--------:|:--------:|
    |   toto   |  wave 1 |  2014    |  300     |
    |   toto   |  wave 1 |  2015    |          |
    |   toto   |  wave 1 |  2016    |  450     |

    ```cson
    Func:
      column: 'my_value'
      value: 0
    ```

    **Output**

    | variable |   wave  |  year    | my_value |
    |:--------:|:-------:|:--------:|:--------:|
    |   toto   |  wave 1 |  2014    |  300     |
    |   toto   |  wave 1 |  2015    |    0     |
    |   toto   |  wave 1 |  2016    |  450     |
    """
    if arg_1 not in arg_0.columns:
        arg_0[arg_1] = nan

    if arg_3 is not None and arg_4 is not None:
        raise ValueError('You cannot set both the parameters value and column_value')

    if arg_3 is not None:
        arg_0[arg_1] = arg_0[arg_1].Func(arg_3)

    if arg_4 is not None:
        if arg_4 not in arg_0.columns:
            raise ValueError(f'"{column_value}" is not a valid column name')
        arg_0[arg_1] = arg_0[arg_1].Func(arg_0[arg_4])

    return arg_0

Can fill NaN values from a column with a given value or a column

    ---

    ### Parameters

    - `column` (*str*): name of column you want to fill
    - `value`: NaN will be replaced by this value
    - `column_value`: NaN will be replaced by value from this column

    *NOTE*: You must set either the 'value' parameter or the 'column_value' parameter

    ---

    ### Example

    **Input**

    | variable |   wave  |  year    | my_value |
    |:--------:|:-------:|:--------:|:--------:|
    |   toto   |  wave 1 |  2014    |  300     |
    |   toto   |  wave 1 |  2015    |          |
    |   toto   |  wave 1 |  2016    |  450     |

    ```cson
    fillna:
      column: 'my_value'
      value: 0
    ```

    **Output**

    | variable |   wave  |  year    | my_value |
    |:--------:|:-------:|:--------:|:--------:|
    |   toto   |  wave 1 |  2014    |  300     |
    |   toto   |  wave 1 |  2015    |    0     |
    |   toto   |  wave 1 |  2016    |  450     |


def Func(arg_0):
    """
    Add up a list of freq counts to get the total counts.
    """
    arg_1 = np.zeros_like(arg_0[0])
    for arg_2 in arg_0:
        arg_1 += arg_2
    return arg_1

Add up a list of freq counts to get the total counts .


def Func ( ) : arg_0 = { } for arg_1 in range ( gdal . GetDriverCount ( ) ) : arg_2 = gdal . GetDriver ( arg_1 ) arg_0 [ arg_2 . ShortName ] = arg_2 . GetMetadata ( ) return arg_0

def Func():
    """Returns a dictionary of enabled GDAL Driver metadata keyed by the
    'ShortName' attribute.
    """
    arg_0 = {}
    for arg_1 in range(gdal.GetDriverCount()):
        arg_2 = gdal.GetDriver(arg_1)
        arg_0[arg_2.ShortName] = arg_2.GetMetadata()
    return arg_0

Returns a dictionary of enabled GDAL Driver metadata keyed by the ShortName attribute .


def Func ( arg_0 , arg_1 ) : arg_2 = CouplingMap ( ) arg_2 . graph = arg_0 . graph . Func ( arg_1 ) for arg_4 in arg_1 : if arg_4 not in arg_2 . physical_qubits : arg_2 . add_physical_qubit ( arg_4 ) return arg_2

def Func(arg_0, arg_1):
        """Return a CouplingMap object for a Func of self.

        nodelist (list): list of integer node labels
        """
        arg_2 = CouplingMap()
        arg_2.graph = arg_0.graph.Func(arg_1)
        for arg_4 in arg_1:
            if arg_4 not in arg_2.physical_qubits:
                arg_2.add_physical_qubit(arg_4)
        return arg_2

Return a CouplingMap object for a subgraph of self.

        nodelist (list): list of integer node labels

Return a CouplingMap object for a subgraph of self .


def Func(arg_0, arg_1):
        """
        Calculate the enthalpy of the package at the specified temperature, in
        case the material is coal.

        :param T: [°C] temperature

        :returns: [kWh] enthalpy
        """

        arg_2 = 0  # kg
        arg_3 = 0  # kg
        arg_4 = 0  # kg
        arg_5 = 0  # kg
        arg_6 = 0  # kg

        arg_7 = 0.0  # kWh/h
        for arg_8 in arg_0.material.compounds:
            arg_9 = arg_0.material.get_compound_index(arg_8)
            if stoich.element_mass_fraction(arg_8, 'C') == 1.0:
                arg_2 += arg_0._compound_masses[arg_9]
            elif stoich.element_mass_fraction(arg_8, 'H') == 1.0:
                arg_3 += arg_0._compound_masses[arg_9]
            elif stoich.element_mass_fraction(arg_8, 'O') == 1.0:
                arg_4 += arg_0._compound_masses[arg_9]
            elif stoich.element_mass_fraction(arg_8, 'N') == 1.0:
                arg_5 += arg_0._compound_masses[arg_9]
            elif stoich.element_mass_fraction(arg_8, 'S') == 1.0:
                arg_6 += arg_0._compound_masses[arg_9]
            else:
                arg_10 = thermo.H(arg_8, arg_1, arg_0._compound_masses[arg_9])
                arg_7 += arg_10

        arg_11 = arg_12 + arg_13 + arg_14 + arg_15 + arg_16  # kg/h
        arg_12 = arg_2 / arg_11
        arg_13 = arg_3 / arg_11
        arg_14 = arg_4 / arg_11
        arg_15 = arg_5 / arg_11
        arg_16 = arg_6 / arg_11

        arg_17 = coals.DafHTy()
        arg_7 = arg_17.calculate(arg_1=arg_1+273.15, arg_12=arg_12, arg_13=arg_13, arg_14=arg_14, arg_15=arg_15,
                             arg_16=arg_16) / 3.6e6  # kWh/kg
        arg_18 = arg_17.calculate(arg_1=298.15, arg_12=arg_12, arg_13=arg_13, arg_14=arg_14, arg_15=arg_15,
                                arg_16=arg_16) / 3.6e6  # kWh/kg
        arg_19 = arg_7 - arg_18 + arg_0._DH298  # kWh/kg
        arg_19 *= arg_11  # kWh

        arg_7 += arg_19

        return arg_7

Calculate the enthalpy of the package at the specified temperature in case the material is coal .


(self, task_id, executable, *args, **kwargs)

def Func(arg_0, arg_1, arg_2, *arg_3, **arg_4):
        """Handle the actual submission of the task to the executor layer.

        If the app task has the executors attributes not set (default=='all')
        the task is launched on a randomly selected executor from the
        list of executors. This behavior could later be updated to support
        binding to executors based on user specified criteria.

        If the app task specifies a particular set of executors, it will be
        targeted at those specific executors.

        Args:
            task_id (uuid string) : A uuid string that uniquely identifies the task
            executable (callable) : A callable object
            args (list of positional args)
            kwargs (arbitrary keyword arguments)

        Returns:
            Future that tracks the execution of the submitted executable
        """
        arg_0.tasks[arg_1]['time_submitted'] = datetime.datetime.now()

        arg_6, arg_7 = arg_0.memoizer.check_memo(arg_1, arg_0.tasks[arg_1])
        if arg_6:
            logger.info("Reusing cached result for task {}".format(arg_1))
            return arg_7

        arg_8 = arg_0.tasks[arg_1]["executor"]
        try:
            arg_9 = arg_0.executors[arg_8]
        except Exception:
            logger.exception("Task {} requested invalid executor {}: config is\n{}".format(arg_1, arg_8, arg_0._config))

        if arg_0.monitoring is not None and arg_0.monitoring.resource_monitoring_enabled:
            arg_2 = arg_0.monitoring.monitor_wrapper(arg_2, arg_1,
                                                         arg_0.monitoring.monitoring_hub_url,
                                                         arg_0.run_id,
                                                         arg_0.monitoring.resource_monitoring_interval)

        with arg_0.submitter_lock:
            arg_10 = arg_9.submit(arg_2, *arg_3, **arg_4)
        arg_0.tasks[arg_1]['status'] = States.launched
        if arg_0.monitoring is not None:
            arg_11 = arg_0._create_task_log_info(arg_1, 'lazy')
            arg_0.monitoring.send(MessageType.TASK_INFO, arg_11)

        arg_10.retries_left = arg_0._config.retries - \
            arg_0.tasks[arg_1]['fail_count']
        logger.info("Task {} launched on executor {}".format(arg_1, arg_9.label))
        return arg_10

Handle the actual submission of the task to the executor layer .


def Func():
    """Patch threading and psycopg2 modules for green threads."""
    # don't Func twice.
    if arg_0:
        return
    arg_0[True] = True

    from gevent.monkey import patch_all, saved
    if ('threading' in sys.modules) and ('threading' not in saved):
        import warnings
        warnings.warn('threading module loaded before patching!')
    patch_all()

    try:
        # Use psycopg2 by default
        import psycopg2
        del psycopg2
    except ImportError:
        # Fallback to psycopg2cffi if required (eg: pypy)
        from psycopg2cffi import compat
        compat.register()

    from psycogreen.gevent import patch_psycopg
    patch_psycopg()

Patch threading and psycopg2 modules for green threads .


def Func ( arg_0 ) : arg_1 = subprocess . Popen ( arg_0 , stderr = subprocess . STDOUT , stdout = subprocess . PIPE ) arg_2 = arg_1 . communicate ( ) return arg_2

def Func(arg_0):
    """ call the command as sps """
    arg_1 = subprocess.Popen(
        arg_0,
        stderr=subprocess.STDOUT,
        stdout=subprocess.PIPE
        )
    arg_2 = arg_1.communicate()
    return arg_2


(self, request, tree_id, item_id, direction)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """Moves item up or down by swapping 'sort_order' field values of neighboring items."""
        arg_5 = MODEL_TREE_ITEM_CLASS._default_manager.get(pk=arg_3)
        if arg_4 == 'up':
            arg_6 = 'sort_order'
        else:
            arg_6 = '-sort_order'

        arg_7 = MODEL_TREE_ITEM_CLASS._default_manager.filter(
            parent=arg_5.parent,
            tree=arg_5.tree
        ).order_by(arg_6)

        arg_8 = None
        for arg_9 in arg_7:
            if arg_9 != arg_5:
                arg_8 = arg_9
            else:
                break

        if arg_8 is not None:
            arg_10 = arg_5.sort_order
            arg_11 = arg_8.sort_order

            arg_5.sort_order = arg_11
            arg_8.sort_order = arg_10

            arg_5.save()
            arg_8.save()

        return HttpResponseRedirect('../../')

Moves item up or down by swapping sort_order field values of neighboring items .


def Func(arg_0, arg_1, arg_2, arg_3):
        """set the pixel but convert the color before."""
        if arg_3 is None:
            return
        arg_3 = arg_0._convert_color_to_rrggbb(arg_3)
        arg_0._set_pixel(arg_1, arg_2, arg_3)

set the pixel but convert the color before .


def Func ( arg_0 , arg_1 , arg_2 = [ ] ) : for arg_3 in arg_2 : classImplements ( arg_3 , arg_0 ) component . provideAdapter ( factory = arg_1 , adapts = [ arg_0 ] , provides = IDriver )

def Func(arg_0, arg_1, arg_2=[]):
    """ Register driver adapter used by page object"""
    for arg_3 in arg_2:
        classImplements(arg_3, arg_0)

    component.provideAdapter(factory=arg_1, adapts=[arg_0], provides=IDriver)


def Func(arg_0, arg_1, arg_2):
        '''
        Creates a recording surface for the bot to draw on

        :param size: The width and height of bot
        '''
        arg_0.frame = arg_2
        arg_3, arg_4 = arg_1
        arg_5 = cairo.RecordingSurface(cairo.CONTENT_COLOR_ALPHA, (0, 0, arg_3, arg_4))

        arg_6 = cairo.Context(arg_5)
        return arg_6


def Func ( arg_0 , arg_1 , arg_2 ) : if not arg_0 . _subscriptions . get ( arg_1 ) : arg_0 . _subscriptions [ arg_1 ] = set ( ) arg_0 . _subscriptions [ arg_1 ] = arg_0 . _subscriptions [ arg_1 ] . union ( arg_2 )

def Func(arg_0, arg_1, arg_2):
        '''Subscribe to event for given bet ids.'''
        if not arg_0._subscriptions.get(arg_1):
            arg_0._subscriptions[arg_1] = set()
        arg_0._subscriptions[arg_1] = arg_0._subscriptions[arg_1].union(arg_2)


def Func(arg_0):
        """ Save repository .pyrepinfo to disk. """
        # open file
        arg_1 = os.path.join(arg_0.__path, ".pyrepinfo")
        try:
            arg_2 = open(arg_1, 'wb')
        except Exception as e:
            raise Exception("unable to open repository info for saving (%s)"%e)
        # Func repository
        try:
            pickle.dump( arg_0, arg_2, protocol=2 )
        except Exception as e:
            arg_2.flush()
            os.fsync(arg_2.fileno())
            arg_2.close()
            raise Exception( "Unable to Func repository info (%s)"%e )
        finally:
            arg_2.flush()
            os.fsync(arg_2.fileno())
            arg_2.close()
        # Func timestamp
        arg_3 = os.path.join(arg_0.__path, ".pyrepstate")
        try:
            arg_0.__state = ("%.6f"%time.time()).encode()
            with open(arg_3, 'wb') as fdtime:
                fdtime.write( arg_0.__state )
                fdtime.flush()
                os.fsync(fdtime.fileno())
        except Exception as e:
            raise Exception("unable to open repository time stamp for saving (%s)"%e)


def Func ( arg_0 , arg_1 ) : arg_0 . get_conn ( ) . transferOperations ( ) . cancel ( name = arg_1 ) . execute ( num_retries = arg_0 . num_retries )

def Func(arg_0, arg_1):
        """
        Cancels an transfer operation in Google Storage Transfer Service.

        :param operation_name: Name of the transfer operation.
        :type operation_name: str
        :rtype: None
        """
        arg_0.get_conn().transferOperations().cancel(name=arg_1).execute(num_retries=arg_0.num_retries)

Cancels an transfer operation in Google Storage Transfer Service .


def Func ( arg_0 ) : arg_1 = itertools . dropwhile ( lambda x : x != arg_0 , arg_0 . xml_parent . xml_children ) next ( arg_1 ) return arg_1

def Func(arg_0):
    '''
    Yields elements and text which have the same parent as elem, but come afterward in document order
    '''
    arg_1 = itertools.dropwhile(lambda x: x != arg_0, arg_0.xml_parent.xml_children)
    next(arg_1) #Skip the element itself
    return arg_1

Yields elements and text which have the same parent as elem but come afterward in document order


def Func ( arg_0 , arg_1 ) : if hasattr ( arg_0 . database . obj , 'close_all' ) : arg_0 . database . close_all ( )

def Func(arg_0, arg_1):
        """Close all connections."""
        if hasattr(arg_0.database.obj, 'close_all'):
            arg_0.database.close_all()


def Func ( arg_0 , arg_1 ) : for arg_2 in arg_1 . file_last_changed : arg_0 . query ( errors . ImportError ) . filter ( errors . ImportError . filename == arg_2 ) . delete ( ) for arg_3 , arg_4 in six . iteritems ( arg_1 . import_errors ) : arg_0 . add ( errors . ImportError ( arg_3 = arg_3 , arg_4 = arg_4 ) ) arg_0 . commit ( )

def Func(arg_0, arg_1):
        """
        For the DAGs in the given DagBag, record any associated import errors and clears
        errors for files that no longer have them. These are usually displayed through the
        Airflow UI so that users know that there are issues parsing DAGs.

        :param session: session for ORM operations
        :type session: sqlalchemy.orm.session.Session
        :param dagbag: DagBag containing DAGs with import errors
        :type dagbag: airflow.models.DagBag
        """
        # Clear the errors of the processed files
        for arg_2 in arg_1.file_last_changed:
            arg_0.query(errors.ImportError).filter(
                errors.ImportError.filename == arg_2
            ).delete()

        # Add the errors of the processed files
        for arg_3, arg_4 in six.iteritems(arg_1.import_errors):
            arg_0.add(errors.ImportError(
                arg_3=arg_3,
                arg_4=arg_4))
        arg_0.commit()

For the DAGs in the given DagBag record any associated import errors and clears errors for files that no longer have them . These are usually displayed through the Airflow UI so that users know that there are issues parsing DAGs .


async def Func(arg_0, arg_1, arg_2: arg_3):
        """ Plays the queue from a specific point. Disregards tracks before the index. """
        arg_4 = arg_0.bot.lavalink.players.get(arg_1.guild.id)

        if arg_2 < 1:
            return await arg_1.send('Invalid specified index.')

        if len(arg_4.queue) < arg_2:
            return await arg_1.send('This index exceeds the queue\'s length.')

        await arg_4.play_at(arg_2-1)

Plays the queue from a specific point . Disregards tracks before the index .


def Func ( ) : from django . utils . module_loading import Func_modules from dddp . api import API Func_modules ( 'ddp' , register_to = API ) return API

def Func():
    """Import all `ddp` submodules from `settings.INSTALLED_APPS`."""
    from django.utils.module_loading import Func_modules
    from dddp.api import API
    Func_modules('ddp', register_to=API)
    return API

Import all ddp submodules from settings . INSTALLED_APPS .


def Func ( arg_0 , arg_1 = None , arg_2 = None ) : if arg_2 is None : arg_2 = [ ] if arg_1 is not None : print colored ( arg_0 , arg_1 , arg_2 = arg_2 ) else : if len ( arg_2 ) > 0 : print colored ( arg_0 , "white" , arg_2 = arg_2 ) else : print arg_0

def Func(arg_0, arg_1=None, arg_2=None):
		"""
		Print a message if the class attribute 'verbose' is enabled

		Args:
			message (str): Message to print
		"""
		if arg_2 is None:
			arg_2 = []
		if arg_1 is not None:
			print colored(arg_0, arg_1, arg_2=arg_2)
		else:
			if len(arg_2) > 0:
				print colored(arg_0, "white", arg_2=arg_2)
			else:
				print arg_0

Print a message if the class attribute verbose is enabled


(self, name, targetUrl, resource, event,
               filter=None, secret=None, **request_parameters)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
               arg_5=None, arg_6=None, **arg_7):
        """Create a webhook.

        Args:
            name(basestring): A user-friendly name for this webhook.
            targetUrl(basestring): The URL that receives POST requests for
                each event.
            resource(basestring): The resource type for the webhook.
            event(basestring): The event type for the webhook.
            filter(basestring): The filter that defines the webhook scope.
            secret(basestring): The secret used to generate payload signature.
            **request_parameters: Additional request parameters (provides
                support for parameters that may be added in the future).

        Returns:
            Webhook: A Webhook object with the details of the Funcd webhook.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.

        """
        check_type(arg_1, basestring, may_be_none=False)
        check_type(arg_2, basestring, may_be_none=False)
        check_type(arg_3, basestring, may_be_none=False)
        check_type(arg_4, basestring, may_be_none=False)
        check_type(arg_5, basestring)
        check_type(arg_6, basestring)

        arg_8 = dict_from_items_with_values(
            arg_7,
            arg_1=arg_1,
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=arg_4,
            arg_5=arg_5,
            arg_6=arg_6,
        )

        # API request
        arg_9 = arg_0._session.post(API_ENDPOINT, json=arg_8)

        # Return a webhook object Funcd from the response JSON data
        return arg_0._object_factory(OBJECT_TYPE, arg_9)

Create a webhook.

        Args:
            name(basestring): A user-friendly name for this webhook.
            targetUrl(basestring): The URL that receives POST requests for
                each event.
            resource(basestring): The resource type for the webhook.
            event(basestring): The event type for the webhook.
            filter(basestring): The filter that defines the webhook scope.
            secret(basestring): The secret used to generate payload signature.
            **request_parameters: Additional request parameters (provides
                support for parameters that may be added in the future).

        Returns:
            Webhook: A Webhook object with the details of the created webhook.

        Raises:
            TypeError: If the parameter types are incorrect.
            ApiError: If the Webex Teams cloud returns an error.


return self._mc_client._delete(url=self._build_path(store_id, 'carts', cart_id, 'lines', line_id))

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Delete a cart.

        :param store_id: The store id.
        :type store_id: :py:class:`str`
        :param cart_id: The id for the cart.
        :type cart_id: :py:class:`str`
        :param line_id: The id for the line item of a cart.
        :type line_id: :py:class:`str`
        """
        arg_0.store_id = arg_1
        arg_0.cart_id = arg_2
        arg_0.line_id = arg_3
        return arg_0._mc_client._Func(url=arg_0._build_path(arg_1, 'carts', arg_2, 'lines', arg_3))


def Func(arg_0, arg_1):
    """Keep track of sequence and make sure time goes forward

    Check if the current record is the beginning of a new sequence
    A new sequence starts in 2 cases:

    1. The sequence id changed (if there is a sequence id field)
    2. The reset field is 1 (if there is a reset field)

    Note that if there is no sequenceId field or resetId field then the entire
    dataset is technically one big sequence. The function will not return True
    for the first record in this case. This is Ok because it is important to
    detect new sequences only when there are multiple sequences in the file.
    """

    # Get current sequence id (if any)
    arg_2 = False
    arg_3 = (arg_1[arg_0._sequenceIdIdx]
                  if arg_0._sequenceIdIdx is not None else None)
    if arg_3 != arg_0._currSequence:
      # verify that the new sequence didn't show up before
      if arg_3 in arg_0._sequences:
        raise Exception('Broken sequence: %s, record: %s' % \
                        (arg_3, arg_1))

      # add the finished sequence to the set of sequence
      arg_0._sequences.add(arg_0._currSequence)
      arg_0._currSequence = arg_3

      # Verify that the reset is consistent (if there is one)
      if arg_0._resetIdx:
        assert arg_1[arg_0._resetIdx] == 1
      arg_2 = True

    else:
      # Check the reset
      arg_5 = False
      if arg_0._resetIdx:
        arg_5 = arg_1[arg_0._resetIdx]
        if arg_5 == 1:
          arg_2 = True

    # If it's still the same old sequence make sure the time flows forward
    if not arg_2:
      if arg_0._timeStampIdx and arg_0._currTime is not None:
        arg_6 = arg_1[arg_0._timeStampIdx]
        if arg_6 < arg_0._currTime:
          raise Exception('No time travel. Early timestamp for record: %s' % arg_1)

    if arg_0._timeStampIdx:
      arg_0._currTime = arg_1[arg_0._timeStampIdx]


def Func ( arg_0 , arg_1 : arg_2 . Any ) -> logging . Logger : if arg_0 . logger is not None : return arg_0 . logger elif hasattr ( arg_1 , "logger" ) and isinstance ( arg_1 . logger , logging . Logger ) : return arg_1 . logger elif hasattr ( arg_1 , "log" ) and isinstance ( arg_1 . log , logging . Logger ) : return arg_1 . log return _LOGGER

def Func(arg_0, arg_1: arg_2.Any) -> logging.Logger:
        """Get logger for log calls.

        :param instance: Owner class instance. Filled only if instance created, else None.
        :type instance: typing.Optional[owner]
        :return: logger instance
        :rtype: logging.Logger
        """
        if arg_0.logger is not None:  # pylint: disable=no-else-return
            return arg_0.logger
        elif hasattr(arg_1, "logger") and isinstance(arg_1.logger, logging.Logger):
            return arg_1.logger
        elif hasattr(arg_1, "log") and isinstance(arg_1.log, logging.Logger):
            return arg_1.log
        return _LOGGER


def Func(arg_0, arg_1):
        """Run all the passes on a QuantumCircuit

        Args:
            circuit (QuantumCircuit): circuit to transform via all the registered passes

        Returns:
            QuantumCircuit: Transformed circuit.
        """
        arg_2 = arg_1.name
        arg_3 = circuit_to_dag(arg_1)
        del arg_1
        for arg_4 in arg_0.working_list:
            for arg_5 in arg_4:
                arg_3 = arg_0._do_pass(arg_5, arg_3, arg_4.options)
        arg_1 = dag_to_circuit(arg_3)
        arg_1.name = arg_2
        return arg_1


def Func(arg_0):
    """Convert XML string into etree.Element."""
    try:
        return etree.XML(arg_0)
    except Exception:
        # TODO:
        # ExpatError: reference to invalid character number: line 1, column 62
        # litmus fails, when xml is used instead of lxml
        # 18. propget............... FAIL (PROPFIND on `/temp/litmus/prop2':
        #   Could not read status line: connection was closed by server)
        # text = <ns0:high-unicode xmlns:ns0="http://example.com/neon/litmus/">��
        #   </ns0:high-unicode>
        #        t2 = text.encode("utf8")
        #        return etree.XML(t2)
        _logger.error(
            "Error parsing XML string. "
            "If lxml is not available, and unicode is involved, then "
            "installing lxml _may_ solve this issue."
        )
        _logger.error("XML source: {}".format(arg_0))
        raise

Convert XML string into etree . Element .


return '<script type="text/javascript" src="{src}"></script>'.format(
        src=url)

def Func(arg_0):
    '''
    Output a script tag to a js file.
    '''

    if not arg_0.startswith('http://') and not arg_0[:1] == '/':
        #add media_url for relative paths
        arg_0 = settings.STATIC_URL + arg_0

    return '<script type="text/javascript" src="{src}"></script>'.format(
        src=arg_0)


(data=None, fn=None, thread_count=None, **kwargs)

def Func ( arg_0 = None , arg_1 = None , arg_2 = None , ** arg_3 ) : def apply_fn ( arg_4 , arg_5 , arg_0 , arg_3 ) : arg_4 [ arg_5 ] = arg_1 ( arg_0 , ** arg_3 ) if arg_2 is None : arg_4 = [ None ] * len ( arg_0 ) arg_6 = [ ] for arg_5 , arg_7 in enumerate ( arg_0 ) : arg_8 = threading . Thread ( name = 'threading_and_return' , target = apply_fn , args = ( arg_4 , arg_5 , arg_7 , arg_3 ) ) arg_8 . start ( ) arg_6 . append ( arg_8 ) else : arg_9 = np . linspace ( 0 , len ( arg_0 ) , arg_2 + 1 ) arg_9 = np . round ( arg_9 ) . astype ( int ) arg_4 = [ None ] * arg_2 arg_6 = [ ] for arg_5 in range ( arg_2 ) : arg_8 = threading . Thread ( name = 'threading_and_return' , target = apply_fn , args = ( arg_4 , arg_5 , arg_0 [ arg_9 [ arg_5 ] : arg_9 [ arg_5 + 1 ] ] , arg_3 ) ) arg_8 . start ( ) arg_6 . append ( arg_8 ) for arg_8 in arg_6 : arg_8 . join ( ) if arg_2 is None : try : return np . asarray ( arg_4 ) except Exception : return arg_4 else : return np . concatenate ( arg_4 )

def Func(arg_0=None, arg_1=None, arg_2=None, **arg_3):
    """Process a batch of data by given function by threading.

    Usually be used for data augmentation.

    Parameters
    -----------
    data : numpy.array or others
        The data to be processed.
    thread_count : int
        The number of threads to use.
    fn : function
        The function for data processing.
    more args : the args for `fn`
        Ssee Examples below.

    Examples
    --------
    Process images.

    >>> images, _, _, _ = tl.files.load_cifar10_dataset(shape=(-1, 32, 32, 3))
    >>> images = tl.prepro.Func(images[0:32], tl.prepro.zoom, zoom_range=[0.5, 1])

    Customized image preprocessing function.

    >>> def distort_img(x):
    >>>     x = tl.prepro.flip_axis(x, axis=0, is_random=True)
    >>>     x = tl.prepro.flip_axis(x, axis=1, is_random=True)
    >>>     x = tl.prepro.crop(x, 100, 100, is_random=True)
    >>>     return x
    >>> images = tl.prepro.Func(images, distort_img)

    Process images and masks together (Usually be used for image segmentation).

    >>> X, Y --> [batch_size, row, col, 1]
    >>> data = tl.prepro.Func([_ for _ in zip(X, Y)], tl.prepro.zoom_multi, zoom_range=[0.5, 1], is_random=True)
    data --> [batch_size, 2, row, col, 1]
    >>> X_, Y_ = data.transpose((1,0,2,3,4))
    X_, Y_ --> [batch_size, row, col, 1]
    >>> tl.vis.save_image(X_, 'images.png')
    >>> tl.vis.save_image(Y_, 'masks.png')

    Process images and masks together by using ``thread_count``.

    >>> X, Y --> [batch_size, row, col, 1]
    >>> data = tl.prepro.Func(X, tl.prepro.zoom_multi, 8, zoom_range=[0.5, 1], is_random=True)
    data --> [batch_size, 2, row, col, 1]
    >>> X_, Y_ = data.transpose((1,0,2,3,4))
    X_, Y_ --> [batch_size, row, col, 1]
    >>> tl.vis.save_image(X_, 'after.png')
    >>> tl.vis.save_image(Y_, 'before.png')

    Customized function for processing images and masks together.

    >>> def distort_img(data):
    >>>    x, y = data
    >>>    x, y = tl.prepro.flip_axis_multi([x, y], axis=0, is_random=True)
    >>>    x, y = tl.prepro.flip_axis_multi([x, y], axis=1, is_random=True)
    >>>    x, y = tl.prepro.crop_multi([x, y], 100, 100, is_random=True)
    >>>    return x, y

    >>> X, Y --> [batch_size, row, col, channel]
    >>> data = tl.prepro.Func([_ for _ in zip(X, Y)], distort_img)
    >>> X_, Y_ = data.transpose((1,0,2,3,4))

    Returns
    -------
    list or numpyarray
        The processed results.

    References
    ----------
    - `python queue <https://pymotw.com/2/Queue/index.html#module-Queue>`__
    - `run with limited queue <http://effbot.org/librarybook/queue.htm>`__

    """

    def apply_fn(arg_4, arg_5, arg_0, arg_3):
        arg_4[arg_5] = arg_1(arg_0, **arg_3)

    if arg_2 is None:
        arg_4 = [None] * len(arg_0)
        arg_6 = []
        # for i in range(len(data)):
        #     t = threading.Thread(name='threading_and_return', target=apply_fn, args=(results, i, data[i], kwargs))
        for arg_5, arg_7 in enumerate(arg_0):
            arg_8 = threading.Thread(name='threading_and_return', target=apply_fn, args=(arg_4, arg_5, arg_7, arg_3))
            arg_8.start()
            arg_6.append(arg_8)
    else:
        arg_9 = np.linspace(0, len(arg_0), arg_2 + 1)
        arg_9 = np.round(arg_9).astype(int)
        arg_4 = [None] * arg_2
        arg_6 = []
        for arg_5 in range(arg_2):
            arg_8 = threading.Thread(
                name='threading_and_return', target=apply_fn, args=(arg_4, arg_5, arg_0[arg_9[arg_5]:arg_9[arg_5 + 1]], arg_3)
            )
            arg_8.start()
            arg_6.append(arg_8)

    for arg_8 in arg_6:
        arg_8.join()

    if arg_2 is None:
        try:
            return np.asarray(arg_4)
        except Exception:
            return arg_4
    else:
        return np.concatenate(arg_4)

Process a batch of data by given function by threading.

    Usually be used for data augmentation.

    Parameters
    -----------
    data : numpy.array or others
        The data to be processed.
    thread_count : int
        The number of threads to use.
    fn : function
        The function for data processing.
    more args : the args for `fn`
        Ssee Examples below.

    Examples
    --------
    Process images.

    >>> images, _, _, _ = tl.files.load_cifar10_dataset(shape=(-1, 32, 32, 3))
    >>> images = tl.prepro.threading_data(images[0:32], tl.prepro.zoom, zoom_range=[0.5, 1])

    Customized image preprocessing function.

    >>> def distort_img(x):
    >>>     x = tl.prepro.flip_axis(x, axis=0, is_random=True)
    >>>     x = tl.prepro.flip_axis(x, axis=1, is_random=True)
    >>>     x = tl.prepro.crop(x, 100, 100, is_random=True)
    >>>     return x
    >>> images = tl.prepro.threading_data(images, distort_img)

    Process images and masks together (Usually be used for image segmentation).

    >>> X, Y --> [batch_size, row, col, 1]
    >>> data = tl.prepro.threading_data([_ for _ in zip(X, Y)], tl.prepro.zoom_multi, zoom_range=[0.5, 1], is_random=True)
    data --> [batch_size, 2, row, col, 1]
    >>> X_, Y_ = data.transpose((1,0,2,3,4))
    X_, Y_ --> [batch_size, row, col, 1]
    >>> tl.vis.save_image(X_, 'images.png')
    >>> tl.vis.save_image(Y_, 'masks.png')

    Process images and masks together by using ``thread_count``.

    >>> X, Y --> [batch_size, row, col, 1]
    >>> data = tl.prepro.threading_data(X, tl.prepro.zoom_multi, 8, zoom_range=[0.5, 1], is_random=True)
    data --> [batch_size, 2, row, col, 1]
    >>> X_, Y_ = data.transpose((1,0,2,3,4))
    X_, Y_ --> [batch_size, row, col, 1]
    >>> tl.vis.save_image(X_, 'after.png')
    >>> tl.vis.save_image(Y_, 'before.png')

    Customized function for processing images and masks together.

    >>> def distort_img(data):
    >>>    x, y = data
    >>>    x, y = tl.prepro.flip_axis_multi([x, y], axis=0, is_random=True)
    >>>    x, y = tl.prepro.flip_axis_multi([x, y], axis=1, is_random=True)
    >>>    x, y = tl.prepro.crop_multi([x, y], 100, 100, is_random=True)
    >>>    return x, y

    >>> X, Y --> [batch_size, row, col, channel]
    >>> data = tl.prepro.threading_data([_ for _ in zip(X, Y)], distort_img)
    >>> X_, Y_ = data.transpose((1,0,2,3,4))

    Returns
    -------
    list or numpyarray
        The processed results.

    References
    ----------
    - `python queue <https://pymotw.com/2/Queue/index.html#module-Queue>`__
    - `run with limited queue <http://effbot.org/librarybook/queue.htm>`__

Process a batch of data by given function by threading .


def Func(arg_0, arg_1: arg_2):
        """Auxiliary method to send an assert"""
        assert isinstance(arg_1, arg_2)
        arg_3 = translate_to_smtlib(arg_1)
        arg_0._send('(assert %s)' % arg_3)


def Func ( arg_0 , arg_1 , arg_2 ) : with gzip . open ( '%s.gz' % arg_0 . path , 'wt' ) if arg_0 . gz else open ( arg_0 . path , 'w' ) as file : json . dump ( list ( zip ( arg_2 , arg_1 ) ) , file )

def Func(arg_0, arg_1, arg_2):
        '''
        Reads dataset to csv.

        :param X: dataset as list of dict.
        :param y: labels.
        '''
        with gzip.open('%s.gz' % arg_0.path, 'wt') if arg_0.gz else open(
                arg_0.path, 'w') as file:
            json.dump(list(zip(arg_2, arg_1)), file)


(typ, rawtext, etext, lineno, inliner,
                  options={}, content=[])

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 , arg_5 = { } , arg_6 = [ ] ) : arg_7 = arg_4 . document . settings . env arg_8 = arg_7 . get_domain ( 'py' ) . role ( 'obj' ) ( 'obj' , arg_1 , arg_2 , arg_3 , arg_4 , arg_5 , arg_6 ) arg_9 = arg_8 [ 0 ] [ 0 ] arg_10 = get_import_prefixes_from_env ( arg_7 ) try : arg_11 , arg_12 , arg_13 = import_by_name ( arg_9 [ 'reftarget' ] , arg_10 ) except ImportError : arg_6 = arg_9 [ 0 ] arg_8 [ 0 ] [ 0 ] = nodes . emphasis ( arg_1 , arg_6 [ 0 ] . astext ( ) , classes = arg_6 [ 'classes' ] ) return arg_8

def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
                  arg_5={}, arg_6=[]):
    """Smart linking role.

    Expands to ':obj:`text`' if `text` is an object that can be imported;
    otherwise expands to '*text*'.
    """
    arg_7 = arg_4.document.settings.env
    arg_8 = arg_7.get_domain('py').role('obj')(
        'obj', arg_1, arg_2, arg_3, arg_4, arg_5, arg_6)
    arg_9 = arg_8[0][0]

    arg_10 = get_import_prefixes_from_env(arg_7)
    try:
        arg_11, arg_12, arg_13 = import_by_name(arg_9['reftarget'], arg_10)
    except ImportError:
        arg_6 = arg_9[0]
        arg_8[0][0] = nodes.emphasis(arg_1, arg_6[0].astext(),
                                 classes=arg_6['classes'])
    return arg_8


def Func ( arg_0 , Func ) : _set_params ( arg_0 . ode_obj , 'StopERP' , Func , arg_0 . ADOF + arg_0 . LDOF )

def Func(arg_0, Func):
        '''Set the ERP values for this object's DOF limits.

        Parameters
        ----------
        stop_erps : float or sequence of float
            An ERP value to set on all degrees of freedom limits, or a list
            containing one such value for each degree of freedom limit.
        '''
        _set_params(arg_0.ode_obj, 'StopERP', Func, arg_0.ADOF + arg_0.LDOF)

Set the ERP values for this object s DOF limits .


return NODE_HIGHLIGHT in graph.node[node]

def Func ( arg_0 : arg_1 , arg_2 : arg_3 ) -> bool : return NODE_HIGHLIGHT in arg_0 . node [ arg_2 ]

def Func(arg_0: arg_1, arg_2: arg_3) -> bool:
    """Returns if the given node is highlighted.

    :param graph: A BEL graph
    :param node: A BEL node
    :type node: tuple
    :return: Does the node contain highlight information?
    :rtype: bool
    """
    return NODE_HIGHLIGHT in arg_0.node[arg_2]

Returns if the given node is highlighted .


def Func(arg_0):
    """Tags all submodules for a new Func.

    Ensures that git tags, as well as the version.py files in each submodule, agree and that the
    new version is strictly greater than the current version. Will fail if the new version
    is not an increment (following PEP 440). Creates a new git tag and commit.
    """
    check_new_version(arg_0)
    set_new_version(arg_0)
    commit_new_version(arg_0)
    set_git_tag(arg_0)

Tags all submodules for a new release.

    Ensures that git tags, as well as the version.py files in each submodule, agree and that the
    new version is strictly greater than the current version. Will fail if the new version
    is not an increment (following PEP 440). Creates a new git tag and commit.


def Func(arg_0):
        """Start resolving the SRV record.
        """
        arg_1 = arg_0.settings["dns_resolver"] # pylint: disable=W0621
        arg_0._set_state("resolving-srv")
        arg_0.event(ResolvingSRVEvent(arg_0._dst_name, arg_0._dst_service))
        arg_1.resolve_srv(arg_0._dst_name, arg_0._dst_service, "tcp",
                                                    callback = arg_0._got_srv)


def Func ( arg_0 , arg_1 , arg_2 ) : from . import context , parse as uxpathparse if hasattr ( arg_1 , 'compute' ) : arg_1 = arg_1 . compute ( arg_0 ) arg_2 = next ( string_arg ( arg_0 , arg_2 ) , '' ) arg_3 = uxpathparse ( arg_2 ) for arg_4 in arg_1 : arg_5 = arg_0 . copy ( arg_4 = arg_4 ) yield from arg_3 . compute ( arg_5 )

def Func(arg_0, arg_1, arg_2):
    '''
    Yields the result of applying an expression to each item in the input sequence.

    * seq: input sequence
    * expr: expression to be converted to string, then dynamically evaluated for each item on the sequence to produce the result
    '''
    from . import context, parse as uxpathparse

    if hasattr(arg_1, 'compute'):
        arg_1 = arg_1.compute(arg_0)

    arg_2 = next(string_arg(arg_0, arg_2), '')

    arg_3 = uxpathparse(arg_2)
    for arg_4 in arg_1:
        arg_5 = arg_0.copy(arg_4=arg_4)
        yield from arg_3.compute(arg_5)

Yields the result of applying an expression to each item in the input sequence .


(
        cplist,
        liststartindex=None,
        maxobjects=None,
        nworkers=NCPUS,
        fast_mode=False,
        findercmap='gray_r',
        finderconvolve=None,
        deredden_object=True,
        custom_bandpasses=None,
        gaia_submit_timeout=10.0,
        gaia_submit_tries=3,
        gaia_max_timeout=180.0,
        gaia_mirror=None,
        complete_query_later=True,
        lclistpkl=None,
        nbrradiusarcsec=60.0,
        maxnumneighbors=5,
        plotdpi=100,
        findercachedir='~/.astrobase/stamp-cache',
        verbose=True
)

def Func(
        arg_0,
        arg_1=None,
        arg_2=None,
        arg_3=arg_4,
        arg_5=False,
        arg_6='gray_r',
        arg_7=None,
        arg_8=True,
        arg_9=None,
        arg_10=10.0,
        arg_11=3,
        arg_12=180.0,
        arg_13=None,
        arg_14=True,
        arg_15=None,
        arg_16=60.0,
        arg_17=5,
        arg_18=100,
        arg_19='~/.astrobase/stamp-cache',
        arg_20=True
):
    '''
    This updates objectinfo for a list of checkplots.

    Useful in cases where a previous round of GAIA/finderchart/external catalog
    acquisition failed. This will preserve the following keys in the checkplots
    if they exist:

    comments
    varinfo
    objectinfo.objecttags

    Parameters
    ----------

    cplist : list of str
        A list of checkplot pickle file names to update.

    liststartindex : int
        The index of the input list to start working at.

    maxobjects : int
        The maximum number of objects to process in this run. Use this with
        `liststartindex` to effectively distribute working on a large list of
        input checkplot pickles over several sessions or machines.

    nworkers : int
        The number of parallel workers that will work on the checkplot
        update process.

    fast_mode : bool or float
        This runs the external catalog operations in a "fast" mode, with short
        timeouts and not trying to hit external catalogs that take a long time
        to respond. See the docstring for
        `checkplot.pkl_utils._pkl_finder_objectinfo` for details on how this
        works. If this is True, will run in "fast" mode with default timeouts (5
        seconds in most cases). If this is a float, will run in "fast" mode with
        the provided timeout value in seconds.

    findercmap : str or matplotlib.cm.Colormap object

    findercmap : str or matplotlib.cm.ColorMap object
        The Colormap object to use for the finder chart image.

    finderconvolve : astropy.convolution.Kernel object or None
        If not None, the Kernel object to use for convolving the finder image.

    deredden_objects : bool
        If this is True, will use the 2MASS DUST service to get extinction
        coefficients in various bands, and then try to deredden the magnitudes
        and colors of the object already present in the checkplot's objectinfo
        dict.

    custom_bandpasses : dict
        This is a dict used to provide custom bandpass definitions for any
        magnitude measurements in the objectinfo dict that are not automatically
        recognized by the `varclass.starfeatures.color_features` function. See
        its docstring for details on the required format.

    gaia_submit_timeout : float
        Sets the timeout in seconds to use when submitting a request to look up
        the object's information to the GAIA service. Note that if `fast_mode`
        is set, this is ignored.

    gaia_submit_tries : int
        Sets the maximum number of times the GAIA services will be contacted to
        obtain this object's information. If `fast_mode` is set, this is
        ignored, and the services will be contacted only once (meaning that a
        failure to respond will be silently ignored and no GAIA data will be
        added to the checkplot's objectinfo dict).

    gaia_max_timeout : float
        Sets the timeout in seconds to use when waiting for the GAIA service to
        respond to our request for the object's information. Note that if
        `fast_mode` is set, this is ignored.

    gaia_mirror : str
        This sets the GAIA mirror to use. This is a key in the
        `services.gaia.GAIA_URLS` dict which defines the URLs to hit for each
        mirror.

    complete_query_later : bool
        If this is True, saves the state of GAIA queries that are not yet
        complete when `gaia_max_timeout` is reached while waiting for the GAIA
        service to respond to our request. A later call for GAIA info on the
        same object will attempt to pick up the results from the existing query
        if it's completed. If `fast_mode` is True, this is ignored.

    lclistpkl : dict or str
        If this is provided, must be a dict resulting from reading a catalog
        produced by the `lcproc.catalogs.make_lclist` function or a str path
        pointing to the pickle file produced by that function. This catalog is
        used to find neighbors of the current object in the current light curve
        collection. Looking at neighbors of the object within the radius
        specified by `nbrradiusarcsec` is useful for light curves produced by
        instruments that have a large pixel scale, so are susceptible to
        blending of variability and potential confusion of neighbor variability
        with that of the actual object being looked at. If this is None, no
        neighbor lookups will be performed.

    nbrradiusarcsec : float
        The radius in arcseconds to use for a search conducted around the
        coordinates of this object to look for any potential confusion and
        blending of variability amplitude caused by their proximity.

    maxnumneighbors : int
        The maximum number of neighbors that will have their light curves and
        magnitudes noted in this checkplot as potential blends with the target
        object.

    plotdpi : int
        The resolution in DPI of the plots to generate in this function
        (e.g. the finder chart, etc.)

    findercachedir : str
        The path to the astrobase cache directory for finder chart downloads
        from the NASA SkyView service.

    verbose : bool
        If True, will indicate progress and warn about potential problems.

    Returns
    -------

    list of str
        Paths to the updated checkplot pickle file.

    '''

    # work around the Darwin segfault after fork if no network activity in
    # main thread bug: https://bugs.python.org/issue30385#msg293958
    if sys.platform == 'darwin':
        import requests
        requests.get('http://captive.apple.com/hotspot-detect.html')

    # handle the start and end indices
    if (arg_1 is not None) and (arg_2 is None):
        arg_0 = arg_0[arg_1:]

    elif (arg_1 is None) and (arg_2 is not None):
        arg_0 = arg_0[:arg_2]

    elif (arg_1 is not None) and (arg_2 is not None):
        arg_0 = (
            arg_0[arg_1:arg_1+arg_2]
        )

    arg_21 = [(x, {'fast_mode':arg_5,
                  'findercmap':arg_6,
                  'finderconvolve':arg_7,
                  'deredden_object':arg_8,
                  'custom_bandpasses':arg_9,
                  'gaia_submit_timeout':arg_10,
                  'gaia_submit_tries':arg_11,
                  'gaia_max_timeout':arg_12,
                  'gaia_mirror':arg_13,
                  'complete_query_later':arg_14,
                  'lclistpkl':arg_15,
                  'nbrradiusarcsec':arg_16,
                  'maxnumneighbors':arg_17,
                  'plotdpi':arg_18,
                  'findercachedir':arg_19,
                  'verbose':arg_20}) for x in arg_0]

    arg_22 = []
    arg_23 = []

    with ProcessPoolExecutor(max_workers=arg_3) as executor:
        arg_22 = executor.map(cp_objectinfo_worker, arg_21)

    arg_23 = [x for x in arg_22]

    executor.shutdown()
    return arg_23

This updates objectinfo for a list of checkplots .


def Func(arg_0, arg_1):
        """
        Retrieve a plugin of desired class, KeyError raised otherwise
        """
        logger.debug("Searching for plugin: %s", arg_1)
        arg_2 = [plugin for plugin in arg_0.plugins.values() if isinstance(plugin, arg_1)]
        if arg_2:
            if len(arg_2) > 1:
                logger.debug(
                    "More then one plugin of type %s found. Using first one.",
                    arg_1)
            return arg_2[-1]
        else:
            raise KeyError("Requested plugin type not found: %s" % arg_1)

Retrieve a plugin of desired class KeyError raised otherwise


return HttpResponseRedirect(path + shift)

def Func(*arg_0, **arg_1):
    """Fixes Admin contrib redirects compatibility problems
    introduced in Django 1.4 by url handling changes.

    """
    arg_2 = arg_0[0].path
    arg_3 = '../'

    if 'delete' in arg_2:
        # Weird enough 'delete' is not handled by TreeItemAdmin::response_change().
        arg_3 += '../'
    elif 'history' in arg_2:
        if 'item_id' not in arg_1:
            # Encountered request from history page to return to tree layout page.
            arg_3 += '../'

    return HttpResponseRedirect(arg_2 + arg_3)

Fixes Admin contrib redirects compatibility problems introduced in Django 1 . 4 by url handling changes .


def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
.
get_query_ns
(
)
!=
MUC_OWNER_NS
:
raise
ValueError
(
"Bad result namespace"
)
arg_2
=
arg_1
.
get_query
(
)
arg_3
=
for
arg_4
in
xml_element_ns_iter
(
arg_2
.
children
,
DATAFORM_NS
)
:
arg_3
=
Form
(
arg_4
)
break
if
not
arg_3
:
raise
ValueError
(
"No form received"
)
arg_0
.
configuration_form
=
arg_3
arg_0
.
handler
.
configuration_form_received
(
arg_3
)

def Func(arg_0, arg_1):
        """
        Process successful result of a room configuration form request.

        :Parameters:
            - `stanza`: the stanza received.
        :Types:
            - `stanza`: `Presence`
        """
        if arg_1.get_query_ns() != MUC_OWNER_NS:
            raise ValueError("Bad result namespace") # TODO: ProtocolError
        arg_2 = arg_1.get_query()
        arg_3 = None
        for arg_4 in xml_element_ns_iter(arg_2.children, DATAFORM_NS):
            arg_3 = Form(arg_4)
            break
        if not arg_3:
            raise ValueError("No form received") # TODO: ProtocolError
        arg_0.configuration_form = arg_3
        arg_0.handler.configuration_form_received(arg_3)

Process successful result of a room configuration form request .


def Func ( arg_0 ) : Func = None arg_0 . features if arg_0 . feat_type is FeatureTypes . framesync : arg_0 . _compute_framesync_times ( ) Func = arg_0 . _framesync_times elif arg_0 . feat_type is FeatureTypes . est_beatsync : Func = arg_0 . _est_beatsync_times elif arg_0 . feat_type is FeatureTypes . ann_beatsync : Func = arg_0 . _ann_beatsync_times return Func

def Func(arg_0):
        """This getter returns the frame times, for the corresponding type of
        features."""
        Func = None
        # Make sure we have already computed the features
        arg_0.features
        if arg_0.feat_type is FeatureTypes.framesync:
            arg_0._compute_framesync_times()
            Func = arg_0._framesync_times
        elif arg_0.feat_type is FeatureTypes.est_beatsync:
            Func = arg_0._est_beatsync_times
        elif arg_0.feat_type is FeatureTypes.ann_beatsync:
            Func = arg_0._ann_beatsync_times

        return Func

This getter returns the frame times for the corresponding type of features .


def
Func
(
arg_0
,
*
arg_1
,
**
arg_2
)
:
if
arg_1
:
arg_3
=
str
(
arg_1
)
.
lstrip
(
'('
)
.
rstrip
(
',)'
)
if
arg_2
:
arg_4
=
', '
.
join
(
[
str
(
i
)
.
lstrip
(
'('
)
.
rstrip
(
')'
)
.
replace
(
', '
,
': '
)
for
i
in
[
(
k
,
arg_2
[
k
]
)
for
k
in
sorted
(
arg_2
.
keys
(
)
)
]
]
)
if
arg_1
and
arg_2
:
return
arg_3
+
', '
+
arg_4
elif
arg_1
:
return
arg_3
elif
arg_2
:
return
arg_4
else
:
return
''

def Func(arg_0, *arg_1, **arg_2):
        """Helper to convert the given args and kwargs into a string."""
        if arg_1:
            arg_3 = str(arg_1).lstrip('(').rstrip(',)')
        if arg_2:
            arg_4 = ', '.join([str(i).lstrip('(').rstrip(')').replace(', ',': ') for i in [
                    (k,arg_2[k]) for k in sorted(arg_2.keys())]])

        if arg_1 and arg_2:
            return arg_3 + ', ' + arg_4
        elif arg_1:
            return arg_3
        elif arg_2:
            return arg_4
        else:
            return ''

Helper to convert the given args and kwargs into a string .


def
Func
(
arg_0
,
arg_1
=
False
)
:
arg_2
=
StringIO
(
)
arg_3
=
[
]
arg_4
=
[
]
arg_5
=
False
arg_6
=
iter
(
arg_0
)
arg_7
=
False
for
arg_8
in
arg_6
:
if
arg_8
in
COMBINATORS
:
if
arg_7
:
arg_2
.
write
(
constants
.
OPERATOR_NEGATION
)
val
=
arg_2
.
getvalue
(
)
reset_stringio
(
arg_2
)
if
not
arg_5
and
not
len
(
val
)
:
raise
ValueError
(
'Unexpected %s.'
%
arg_8
)
if
len
(
val
)
:
arg_3
.
append
(
parse_segment
(
val
)
)
arg_4
.
append
(
COMBINATORS
[
arg_8
]
)
elif
arg_8
==
constants
.
GROUP_BEGIN
:
if
arg_2
.
tell
(
)
:
raise
ValueError
(
'Unexpected %s'
%
arg_8
)
seg
=
Func
(
arg_6
,
True
)
if
arg_7
:
seg
=
UnarySegmentCombinator
(
seg
)
arg_3
.
append
(
seg
)
arg_5
=
True
continue
elif
arg_8
==
constants
.
GROUP_END
:
val
=
arg_2
.
getvalue
(
)
if
not
arg_2
.
tell
(
)
or
not
arg_1
:
raise
ValueError
(
'Unexpected %s'
%
arg_8
)
arg_3
.
append
(
parse_segment
(
val
)
)
return
combine
(
arg_3
,
arg_4
)
elif
arg_8
==
constants
.
OPERATOR_NEGATION
and
not
arg_2
.
tell
(
)
:
arg_7
=
True
continue
else
:
if
arg_7
:
arg_2
.
write
(
constants
.
OPERATOR_NEGATION
)
if
arg_5
:
raise
ValueError
(
'Unexpected %s'
%
arg_8
)
arg_2
.
write
(
arg_8
)
arg_7
=
False
arg_5
=
False
else
:
if
arg_1
:
raise
ValueError
(
'Expected %s.'
%
constants
.
GROUP_END
)
if
not
arg_5
:
arg_3
.
append
(
parse_segment
(
arg_2
.
getvalue
(
)
)
)
return
combine
(
arg_3
,
arg_4
)

def Func(arg_0, arg_1=False):
    """Return objects representing segments."""
    arg_2 = StringIO()

    # The segments we're building, and the combinators used to combine them.
    # Note that after this is complete, this should be true:
    # len(segments) == len(combinators) + 1
    # Thus we can understand the relationship between segments and combinators
    # like so:
    #  s1 (c1) s2 (c2) s3 (c3) where sN are segments and cN are combination
    # functions.
    # TODO: Figure out exactly where the querystring died and post cool
    # error messages about it.
    arg_3 = []
    arg_4 = []

    # A flag dictating if the last character we processed was a group.
    # This is used to determine if the next character (being a combinator)
    # is allowed to
    arg_5 = False

    # The recursive nature of this function relies on keeping track of the
    # state of iteration.  This iterator will be passed down to recursed calls.
    arg_6 = iter(arg_0)

    # Detection for exclamation points.  only matters for this situation:
    # foo=bar&!(bar=baz)
    arg_7 = False

    for arg_8 in arg_6:
        if arg_8 in COMBINATORS:

            if arg_7:
                arg_2.write(constants.OPERATOR_NEGATION)

            # The string representation of our segment.
            val = arg_2.getvalue()
            reset_stringio(arg_2)

            if not arg_5 and not len(val):
                raise ValueError('Unexpected %s.' % arg_8)

            # When a group happens, the previous value is empty.
            if len(val):
                arg_3.append(parse_segment(val))

            arg_4.append(COMBINATORS[arg_8])

        elif arg_8 == constants.GROUP_BEGIN:
            # Recursively go into the next group.

            if arg_2.tell():
                raise ValueError('Unexpected %s' % arg_8)

            seg = Func(arg_6, True)

            if arg_7:
                seg = UnarySegmentCombinator(seg)

            arg_3.append(seg)

            # Flag that the last entry was a grouping, so that we don't panic
            # when the next character is a logical combinator
            arg_5 = True
            continue

        elif arg_8 == constants.GROUP_END:
            # Build the segment for anything remaining, and then combine
            # all the segments.
            val = arg_2.getvalue()

            # Check for unbalanced parens or an empty thing: foo=bar&();bar=baz
            if not arg_2.tell() or not arg_1:
                raise ValueError('Unexpected %s' % arg_8)

            arg_3.append(parse_segment(val))
            return combine(arg_3, arg_4)

        elif arg_8 == constants.OPERATOR_NEGATION and not arg_2.tell():
            arg_7 = True
            continue

        else:
            if arg_7:
                arg_2.write(constants.OPERATOR_NEGATION)
            if arg_5:
                raise ValueError('Unexpected %s' % arg_8)
            arg_2.write(arg_8)

        arg_7 = False
        arg_5 = False
    else:
        # Check and see if the iterator exited early (unbalanced parens)
        if arg_1:
            raise ValueError('Expected %s.' % constants.GROUP_END)

        if not arg_5:
            # Add the final segment.
            arg_3.append(parse_segment(arg_2.getvalue()))

    # Everything completed normally, combine all the segments into one
    # and return them.
    return combine(arg_3, arg_4)


return self.hhash.encrypt(value,
            salt_size=self.salt_size, rounds=self.rounds)

def Func ( arg_0 , arg_1 ) : arg_1 = arg_0 . transform_value ( arg_1 ) return arg_0 . hhash . encrypt ( arg_1 , salt_size = arg_0 . salt_size , rounds = arg_0 . rounds )

def Func(arg_0, arg_1):
        """Convert the python value for storage in the database."""
        arg_1 = arg_0.transform_value(arg_1)
        return arg_0.hhash.encrypt(arg_1,
            salt_size=arg_0.salt_size, rounds=arg_0.rounds)

Convert the python value for storage in the database .


def Func ( arg_0 , arg_1 , arg_2 ) : if arg_2 is True : arg_0 . widget . set ( arg_1 , arg_1 ) elif arg_2 is False : del arg_0 . widget . attrib [ arg_1 ] else : arg_0 . widget . set ( arg_1 , str ( arg_2 ) )

def Func(arg_0, arg_1, arg_2):
        """ Default handler for those not explicitly defined """
        if arg_2 is True:
            arg_0.widget.set(arg_1, arg_1)
        elif arg_2 is False:
            del arg_0.widget.attrib[arg_1]
        else:
            arg_0.widget.set(arg_1, str(arg_2))


return self.fetch_json(
            uri_path=self.base_uri,
            query_params=query_params or {}
        )

def Func ( arg_0 , arg_1 = None ) : return arg_0 . fetch_json ( uri_path = arg_0 . base_uri , arg_1 = arg_1 or { } )

def Func(arg_0, arg_1=None):
        '''
        Get all information for this Label. Returns a dictionary of values.
        '''
        return arg_0.fetch_json(
            uri_path=arg_0.base_uri,
            arg_1=arg_1 or {}
        )

Get all information for this Label . Returns a dictionary of values .


def Func(arg_0, arg_1):
        """
        Invalidate httpBL cache for IP address

        :param ip: ipv4 IP address
        """

        if arg_0._use_cache:
            arg_2 = arg_0._make_cache_key(arg_1)
            arg_0._cache.delete(arg_2, version=arg_0._cache_version)


def Func ( arg_0 : arg_1 ) -> ReaderForm : while True : arg_2 = _read_next ( arg_0 ) if arg_2 is arg_0 . eof : return arg_0 . eof if arg_2 is COMMENT or isinstance ( arg_2 , Comment ) : continue return arg_2

def Func(arg_0: arg_1) -> ReaderForm:
    """Read the next full form from the input stream, consuming any
    reader comments completely."""
    while True:
        arg_2 = _read_next(arg_0)
        if arg_2 is arg_0.eof:
            return arg_0.eof
        if arg_2 is COMMENT or isinstance(arg_2, Comment):
            continue
        return arg_2

Read the next full form from the input stream consuming any reader comments completely .


return self.exclude_data_files(package, src_dir, files)

def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = ( arg_0 . package_data . get ( '' , [ ] ) + arg_0 . package_data . get ( arg_1 , [ ] ) ) arg_4 = arg_0 . manifest_files . get ( arg_1 , [ ] ) [ : ] for arg_5 in arg_3 : arg_4 . extend ( glob ( os . path . join ( arg_2 , convert_path ( arg_5 ) ) ) ) return arg_0 . exclude_data_files ( arg_1 , arg_2 , arg_4 )

def Func(arg_0, arg_1, arg_2):
        """Return filenames for package's data files in 'src_dir'"""
        arg_3 = (arg_0.package_data.get('', [])
                 + arg_0.package_data.get(arg_1, []))
        arg_4 = arg_0.manifest_files.get(arg_1, [])[:]
        for arg_5 in arg_3:
            # Each pattern has to be converted to a platform-specific path
            arg_4.extend(glob(os.path.join(arg_2, convert_path(arg_5))))
        return arg_0.exclude_data_files(arg_1, arg_2, arg_4)

Return filenames for package s data files in src_dir


def Func(arg_0, arg_1):
        """ Pulls tasks from the incoming tasks 0mq pipe onto the internal
        pending task queue

        Parameters:
        -----------
        kill_event : threading.Event
              Event to let the thread know when it is time to die.
        """
        logger.info("[TASK PULL THREAD] starting")
        arg_2 = zmq.Poller()
        arg_2.register(arg_0.task_incoming, zmq.POLLIN)

        # Send a registration message
        arg_3 = arg_0.create_reg_message()
        logger.debug("Sending registration message: {}".format(arg_3))
        arg_0.task_incoming.send(arg_3)
        arg_4 = time.time()
        arg_5 = time.time()
        arg_6 = 0

        arg_7 = 1

        while not arg_1.is_set():
            time.sleep(LOOP_SLOWDOWN)
            arg_8 = arg_0.ready_worker_queue.qsize()
            arg_9 = arg_0.pending_task_queue.qsize()

            logger.debug("[TASK_PULL_THREAD] ready workers:{}, pending tasks:{}".format(arg_8,
                                                                                arg_9))

            if time.time() > arg_4 + arg_0.heartbeat_period:
                arg_0.heartbeat()
                arg_4 = time.time()

            if arg_9 < arg_0.max_queue_size and arg_8 > 0:
                logger.debug("[TASK_PULL_THREAD] Requesting tasks: {}".format(arg_8))
                arg_3 = ((arg_8).to_bytes(4, "little"))
                arg_0.task_incoming.send(arg_3)

            arg_10 = dict(arg_2.poll(timeout=arg_7))

            if arg_0.task_incoming in arg_10 and arg_10[arg_0.task_incoming] == zmq.POLLIN:
                arg_11, arg_12 = arg_0.task_incoming.recv_multipart()
                arg_13 = pickle.loads(arg_12)
                arg_5 = time.time()

                if arg_13 == 'STOP':
                    logger.critical("[TASK_PULL_THREAD] Received stop request")
                    arg_1.set()
                    break

                elif arg_13 == HEARTBEAT_CODE:
                    logger.debug("Got heartbeat from interchange")

                else:
                    # Reset timer on receiving message
                    arg_7 = 1
                    arg_6 += len(arg_13)
                    logger.debug("[TASK_PULL_THREAD] Got tasks: {} of {}".format([arg_14['task_id'] for arg_14 in arg_13],
                                                                                arg_6))
                    for arg_15 in arg_13:
                        arg_0.pending_task_queue.put(arg_15)
            else:
                logger.debug("[TASK_PULL_THREAD] No incoming tasks")
                # Limit poll duration to heartbeat_period
                # heartbeat_period is in s vs poll_timer in ms
                arg_7 = min(arg_0.heartbeat_period * 1000, arg_7 * 2)

                # Only check if no messages were received.
                if time.time() > arg_5 + arg_0.heartbeat_threshold:
                    logger.critical("[TASK_PULL_THREAD] Missing contact with interchange beyond heartbeat_threshold")
                    arg_1.set()
                    logger.critical("[TASK_PULL_THREAD] Exiting")
                    break


def Func(arg_0):
        """
        Load the existing systemjs manifest and remove any entries that no longer
        exist on the storage.
        """
        # backup the original name
        arg_1 = arg_0.manifest_name

        # load the custom bundle manifest
        arg_0.manifest_name = arg_0.systemjs_manifest_name
        arg_3 = arg_0.load_manifest()
        # reset the manifest name
        arg_0.manifest_name = arg_1

        # check that the files actually exist, if not, remove them from the manifest
        for arg_4, arg_5 in arg_3.copy().items():
            if not arg_0.exists(arg_4) or not arg_0.exists(arg_5):
                del arg_3[arg_4]
        return arg_3

Load the existing systemjs manifest and remove any entries that no longer exist on the storage .


def Func ( arg_0 , arg_1 ) : arg_2 = isinstance ( arg_0 , np . ndarray ) if arg_2 : arg_0 = list ( arg_0 ) arg_3 = np . concatenate ( ( np . array ( [ 0 ] ) , np . cumsum ( split_integer ( len ( arg_0 ) , length = arg_1 ) ) ) ) arg_4 = [ arg_0 [ arg_3 [ i ] : arg_3 [ i + 1 ] ] for i in range ( arg_1 ) ] if arg_2 : arg_4 = [ np . array ( sl ) for sl in arg_4 ] return arg_4

def Func(arg_0,arg_1):
    '''
    Subdivide list into N lists
    '''
    arg_2 = isinstance(arg_0,np.ndarray)
    if arg_2:
        arg_0=list(arg_0)
    arg_3=np.concatenate((np.array([0]),np.cumsum(split_integer(len(arg_0),length=arg_1))))
    arg_4=[arg_0[arg_3[i]:arg_3[i+1]] for i in range(arg_1)]
    if arg_2:
        arg_4=[np.array(sl) for sl in arg_4]
    return arg_4


def Func ( arg_0 , arg_1 = "" ) : arg_2 = NamedTemporaryFile ( delete = False , suffix = arg_1 ) . name arg_0 . path ( arg_2 ) return arg_2

def Func(arg_0, arg_1=""):
        """Saves the dump in a temporary file and returns its path.

        .. warning:: The user of this method is responsible for deleting this
                     file to save space on the hard drive.
                     If you only need a file object for a short period of time
                     you can use the method :meth:`temporary_file`.

        :param str extension: the ending ot the file name e.g. ``".png"``
        :return: a path to the temporary file
        :rtype: str
        """
        arg_2 = NamedTemporaryFile(delete=False, suffix=arg_1).name
        arg_0.path(arg_2)
        return arg_2

Saves the dump in a temporary file and returns its path .


def
Func
(
arg_0
,
arg_1
)
:
if
not
isinstance
(
arg_1
,
EventHandler
)
:
raise
TypeError
,
"Not an EventHandler"
with
arg_0
.
lock
:
if
arg_1
in
arg_0
.
handlers
:
return
arg_0
.
handlers
.
append
(
arg_1
)
arg_0
.
_update_handlers
(
)

def Func(arg_0, arg_1):
        """Add a handler object.

        :Parameters:
            - `handler`: the object providing event handler methods
        :Types:
            - `handler`: `EventHandler`
        """
        if not isinstance(arg_1, EventHandler):
            raise TypeError, "Not an EventHandler"
        with arg_0.lock:
            if arg_1 in arg_0.handlers:
                return
            arg_0.handlers.append(arg_1)
            arg_0._update_handlers()


def Func(arg_0, arg_1=None):
        """
        Retrieves the issues in the collection.

        :param sortby: the properties to sort the issues by
        :type sortby: list(str)
        :rtype: list(tidypy.Issue)
        """

        arg_0._ensure_cleaned_issues()
        return arg_0._sort_issues(arg_0._cleaned_issues, arg_1)

Retrieves the issues in the collection .


def Func(arg_0):
        """
        Configure handling of command line arguments.
        """
        arg_0.add_logging_argument()
        arg_0.parser.add_argument('-a', '--api-host', dest='api_host', action='store', metavar="api_host",
                                 help='{0} API host endpoint'.format(arg_0.product_name))
        arg_0.parser.add_argument('-e', '--email', dest='email', action='store', metavar="e_mail",
                                 help='e-mail that has access to the {0} account'.format(arg_0.product_name))
        arg_0.parser.add_argument('-t', '--api-token', dest='api_token', required=False, action='store',
                                 metavar="api_token",
                                 help='API token for given e-mail that has access to the {0} account'.format(
                                     arg_0.product_name))
        arg_0.parser.add_argument('-z', '--curl', dest='curl', required=False, action='store_true', default=False,
                                 help='Output the corresponding curl command line and exit')

Configure handling of command line arguments .


def Func ( arg_0 , arg_1 ) : arg_2 = [ i for i , j in enumerate ( bytearray ( arg_1 [ : 4 ] ) ) if j == 0 ] if arg_2 == [ 0 , 1 , 2 ] : return "UTF-32BE" elif arg_2 == [ 0 , 2 ] : return "UTF-16BE" elif arg_2 == [ 1 , 2 , 3 ] : return "UTF-32LE" elif arg_2 == [ 1 , 3 ] : return "UTF-16LE" else : return "UTF-8"

def Func(arg_0, arg_1):
        """
        Determine which Unicode encoding the JSON text sample is encoded with

        RFC4627 (http://www.ietf.org/rfc/rfc4627.txt) suggests that the encoding of JSON text can be determined
        by checking the pattern of NULL bytes in first 4 octets of the text.
        :param sample: a sample of at least 4 bytes of the JSON text
        :return: the most likely encoding of the JSON text
        """
        arg_2 = [i for i, j in enumerate(bytearray(arg_1[:4])) if j == 0]
        if arg_2 == [0, 1, 2]:
            return "UTF-32BE"
        elif arg_2 == [0, 2]:
            return "UTF-16BE"
        elif arg_2 == [1, 2, 3]:
            return "UTF-32LE"
        elif arg_2 == [1, 3]:
            return "UTF-16LE"
        else:
            return "UTF-8"


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
arg_0
.
regions
[
_RECORD_SENSOR
]
arg_4
=
arg_0
.
regions
[
_L1_SPATIAL_POOLER
]
arg_5
=
arg_0
.
regions
[
_L1_TEMPORAL_MEMORY
]
arg_6
=
arg_0
.
regions
[
_L1_CLASSIFIER
]
arg_7
=
arg_0
.
regions
[
_L2_SPATIAL_POOLER
]
arg_8
=
arg_0
.
regions
[
_L2_TEMPORAL_MEMORY
]
arg_9
=
arg_0
.
regions
[
_L2_CLASSIFIER
]
arg_10
=
[
]
arg_11
=
[
]
arg_12
=
arg_13
=
arg_14
=
0.0
arg_15
=
0.0
for
arg_16
in
xrange
(
arg_1
)
:
arg_0
.
run
(
1
)
arg_17
=
float
(
arg_3
.
getOutputData
(
"actValueOut"
)
[
0
]
)
arg_18
=
arg_6
.
getOutputData
(
"actualValues"
)
arg_19
=
arg_6
.
getOutputData
(
"probabilities"
)
arg_20
=
arg_18
[
arg_19
.
argmax
(
)
]
if
arg_12
is
not
:
arg_14
+=
math
.
fabs
(
arg_12
arg_17
)
arg_12
=
arg_20
arg_21
=
arg_9
.
getOutputData
(
"actualValues"
)
arg_22
=
arg_9
.
getOutputData
(
"probabilities"
)
arg_23
=
arg_21
[
arg_22
.
argmax
(
)
]
if
arg_13
is
not
:
arg_15
+=
math
.
fabs
(
arg_13
arg_17
)
arg_13
=
arg_23
arg_24
=
arg_5
.
getOutputData
(
"anomalyScore"
)
[
0
]
arg_25
=
arg_8
.
getOutputData
(
"anomalyScore"
)
[
0
]
arg_2
.
writerow
(
(
arg_16
,
arg_17
,
arg_12
,
arg_24
,
arg_13
,
arg_25
)
)
arg_26
=
arg_5
.
getOutputData
(
"topDownOut"
)
.
nonzero
(
)
[
0
]
arg_10
=
copy
.
deepcopy
(
arg_26
)
arg_27
=
arg_8
.
getOutputData
(
"topDownOut"
)
.
nonzero
(
)
[
0
]
arg_11
=
copy
.
deepcopy
(
arg_27
)
if
arg_1
>
1
:
print
"L1 ave abs class. error: %f"
%
(
arg_14
/
(
arg_1
1
)
)
print
"L2 ave abs class. error: %f"
%
(
arg_15
/
(
arg_1
1
)
)

def Func(arg_0, arg_1, arg_2):
  """
  Runs specified Network writing the ensuing anomaly
  scores to writer.

  @param network: The Network instance to be run
  @param writer: A csv.writer used to write to output file.
  """
  arg_3 = arg_0.regions[_RECORD_SENSOR]
  arg_4 = arg_0.regions[_L1_SPATIAL_POOLER]
  arg_5 = arg_0.regions[_L1_TEMPORAL_MEMORY]
  arg_6 = arg_0.regions[_L1_CLASSIFIER]

  arg_7 = arg_0.regions[_L2_SPATIAL_POOLER]
  arg_8 = arg_0.regions[_L2_TEMPORAL_MEMORY]
  arg_9 = arg_0.regions[_L2_CLASSIFIER]

  arg_10 = []
  arg_11 = []

  arg_12 = None
  arg_13 = None
  arg_14 = 0.0
  arg_15 = 0.0
  for arg_16 in xrange(arg_1):
    # Run the network for a single iteration
    arg_0.run(1)

    arg_17 = float(arg_3.getOutputData("actValueOut")[0])

    arg_18 = arg_6.getOutputData("actualValues")
    arg_19 = arg_6.getOutputData("probabilities")
    arg_20 = arg_18[arg_19.argmax()]
    if arg_12 is not None:
      arg_14 += math.fabs(arg_12 - arg_17)
    arg_12 = arg_20

    arg_21 = arg_9.getOutputData("actualValues")
    arg_22 = arg_9.getOutputData("probabilities")
    arg_23 = arg_21[arg_22.argmax()]
    if arg_13 is not None:
      arg_15 += math.fabs(arg_13 - arg_17)
    arg_13 = arg_23

    arg_24 = arg_5.getOutputData("anomalyScore")[0]
    arg_25 = arg_8.getOutputData("anomalyScore")[0]

    # Write record number, actualInput, and anomaly scores
    arg_2.writerow((arg_16, arg_17, arg_12, arg_24, arg_13, arg_25))

    # Store the predicted columns for the next timestep
    arg_26 = arg_5.getOutputData("topDownOut").nonzero()[0]
    arg_10 = copy.deepcopy(arg_26)
    #
    arg_27 = arg_8.getOutputData("topDownOut").nonzero()[0]
    arg_11 = copy.deepcopy(arg_27)

  # Output absolute average error for each level
  if arg_1 > 1:
    print "L1 ave abs class. error: %f" % (arg_14 / (arg_1 - 1))
    print "L2 ave abs class. error: %f" % (arg_15 / (arg_1 - 1))

Runs specified Network writing the ensuing anomaly scores to writer .


def
Func
(
arg_0
)
:
assert
not
arg_0
.
has_Funced
(
)
,
"called Func() on an active GeventLoop"
arg_0
.
_stop_event
=
Event
(
)
arg_0
.
_greenlet
=
gevent
.
spawn
(
arg_0
.
_loop
)

def Func(arg_0):
        """
        Starts the loop. Calling a running loop is an error.
        """
        assert not arg_0.has_Funced(), "called Func() on an active GeventLoop"
        arg_0._stop_event = Event()
        # note that we don't use safe_greenlets.spawn because we take care of it in _loop by ourselves
        arg_0._greenlet = gevent.spawn(arg_0._loop)

Starts the loop . Calling a running loop is an error .


(
        self,
        fullname: str,
        loader_state: Mapping[str, str],
        path_stats: Mapping[str, int],
        module: types.ModuleType,
    )

def Func(
        arg_0,
        arg_1: arg_2,
        arg_3: arg_4[arg_2, arg_2],
        arg_5: arg_4[arg_2, arg_6],
        arg_7: arg_8.ModuleType,
    ):
        """Load and execute a cached Basilisp module."""
        arg_10 = arg_3["filename"]
        arg_11 = arg_3["cache_filename"]

        with timed(
            lambda duration: logger.debug(
                f"Loaded cached Basilisp module '{fullname}' in {duration / 1000000}ms"
            )
        ):
            logger.debug(f"Checking for cached Basilisp module '{fullname}''")
            arg_12 = arg_0.get_data(arg_11)
            arg_13 = _get_basilisp_bytecode(
                arg_1, arg_5["mtime"], arg_5["size"], arg_12
            )
            compiler.compile_bytecode(
                arg_13,
                compiler.GeneratorContext(arg_10=arg_10),
                compiler.PythonASTOptimizer(),
                arg_7,
            )

Load and execute a cached Basilisp module .


return job_model.Resources(
      min_cores=args.min_cores,
      min_ram=args.min_ram,
      machine_type=args.machine_type,
      disk_size=args.disk_size,
      disk_type=args.disk_type,
      boot_disk_size=args.boot_disk_size,
      preemptible=args.preemptible,
      image=args.image,
      regions=args.regions,
      zones=args.zones,
      logging=logging,
      logging_path=None,
      service_account=args.service_account,
      scopes=args.scopes,
      keep_alive=args.keep_alive,
      cpu_platform=args.cpu_platform,
      network=args.network,
      subnetwork=args.subnetwork,
      use_private_address=args.use_private_address,
      accelerator_type=args.accelerator_type,
      accelerator_count=args.accelerator_count,
      nvidia_driver_version=args.nvidia_driver_version,
      timeout=timeout,
      log_interval=log_interval,
      ssh=args.ssh)

def Func(arg_0):
  """Extract job-global resources requirements from input args.

  Args:
    args: parsed command-line arguments

  Returns:
    Resources object containing the requested resources for the job
  """
  arg_1 = param_util.build_logging_param(
      arg_0.logging) if arg_0.logging else None
  arg_2 = param_util.timeout_in_seconds(arg_0.timeout)
  arg_3 = param_util.log_interval_in_seconds(arg_0.log_interval)

  return job_model.Resources(
      min_cores=arg_0.min_cores,
      min_ram=arg_0.min_ram,
      machine_type=arg_0.machine_type,
      disk_size=arg_0.disk_size,
      disk_type=arg_0.disk_type,
      boot_disk_size=arg_0.boot_disk_size,
      preemptible=arg_0.preemptible,
      image=arg_0.image,
      regions=arg_0.regions,
      zones=arg_0.zones,
      arg_1=arg_1,
      logging_path=None,
      service_account=arg_0.service_account,
      scopes=arg_0.scopes,
      keep_alive=arg_0.keep_alive,
      cpu_platform=arg_0.cpu_platform,
      network=arg_0.network,
      subnetwork=arg_0.subnetwork,
      use_private_address=arg_0.use_private_address,
      accelerator_type=arg_0.accelerator_type,
      accelerator_count=arg_0.accelerator_count,
      nvidia_driver_version=arg_0.nvidia_driver_version,
      arg_2=arg_2,
      arg_3=arg_3,
      ssh=arg_0.ssh)

Extract job - global resources requirements from input args .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_1
(
site
=
arg_0
)
logger
.
debug
(
'Registering %r with %r'
,
arg_2
,
arg_0
)
arg_3
=
arg_0
.
__previews
.
setdefault
(
arg_2
.
module
,
{
}
)
arg_3
[
arg_1
.
__name__
]
=
arg_2

def Func(arg_0, arg_1):
        """
        Adds a preview to the index.
        """
        arg_2 = arg_1(site=arg_0)
        logger.debug('Registering %r with %r', arg_2, arg_0)
        arg_3 = arg_0.__previews.setdefault(arg_2.module, {})
        arg_3[arg_1.__name__] = arg_2


def Func(arg_0):
        """
        Return a dict of column name and column type based on self.schema if not None.
        """
        arg_1 = []
        if isinstance(arg_0.schema, string_types):
            arg_1 = json.loads(arg_0.schema)
        elif isinstance(arg_0.schema, list):
            arg_1 = arg_0.schema
        elif arg_0.schema is not None:
            arg_0.log.warn('Using default schema due to unexpected type.'
                          'Should be a string or list.')

        arg_2 = {}
        try:
            arg_2 = {col['name']: col['type'] for col in arg_1}
        except KeyError:
            arg_0.log.warn('Using default schema due to missing name or type. Please '
                          'refer to: https://cloud.google.com/bigquery/docs/schemas'
                          '#specifying_a_json_schema_file')
        return arg_2

Return a dict of column name and column type based on self . schema if not None .


def Func ( arg_0 , arg_1 , arg_2 = True ) : arg_3 = arg_0 . getSchema ( ) arg_4 = arg_3 . new_message ( ) arg_0 . write ( arg_4 ) if arg_2 : arg_4 . write_packed ( arg_1 ) else : arg_4 . write ( arg_1 )

def Func(arg_0, arg_1, arg_2=True):
    """
    Write serialized object to file.

    :param f: output file
    :param packed: If true, will pack contents.
    """
    # Get capnproto schema from instance
    arg_3 = arg_0.getSchema()

    # Construct new message, otherwise refered to as `proto`
    arg_4 = arg_3.new_message()

    # Populate message w/ `write()` instance method
    arg_0.write(arg_4)

    # Finally, write to file
    if arg_2:
      arg_4.write_packed(arg_1)
    else:
      arg_4.write(arg_1)


return obj.msg("%s is %s." % (what, val))

def
Func
(
arg_0
,
arg_1
=
)
:
arg_2
=
show_onoff
(
arg_0
.
debugger
.
settings
[
arg_0
.
name
]
)
if
not
arg_1
:
arg_1
=
arg_0
.
name
return
arg_0
.
msg
(
"%s is %s."
%
(
arg_1
,
arg_2
)
)

def Func(arg_0, arg_1=None):
    """Generic subcommand showing a boolean-valued debugger setting.
    'obj' is generally a subcommand that has 'name' and
    'debugger.setting' attributes."""
    arg_2 = show_onoff(arg_0.debugger.settings[arg_0.name])
    if not arg_1: arg_1 = arg_0.name
    return arg_0.msg("%s is %s." % (arg_1, arg_2))

Generic subcommand showing a boolean - valued debugger setting . obj is generally a subcommand that has name and debugger . setting attributes .


def Func ( arg_0 , arg_1 , arg_2 = None ) : if arg_2 is None : arg_2 = arg_0 . _schema arg_3 = arg_2 [ 'properties' ] for arg_4 , arg_5 in arg_1 . items ( ) : if arg_4 not in arg_3 : continue try : arg_6 = arg_3 [ arg_4 ] [ 'type' ] except KeyError : arg_6 = None if arg_6 == 'integer' and not isinstance ( arg_5 , int ) : arg_5 = int ( arg_5 ) elif arg_6 == 'boolean' and not isinstance ( arg_5 , bool ) : arg_5 = arg_5 == '1' arg_1 [ arg_4 ] = arg_5 return arg_1

def Func(arg_0, arg_1, arg_2=None):
        """
        Loops over item and performs type casting
        according to supplied schema fragment
        """
        if arg_2 is None:
            arg_2 = arg_0._schema
        arg_3 = arg_2['properties']
        for arg_4, arg_5 in arg_1.items():
            if arg_4 not in arg_3:
                continue
            try:
                arg_6 = arg_3[arg_4]['type']
            except KeyError:
                arg_6 = None
            if arg_6 == 'integer' and not isinstance(arg_5, int):
                arg_5 = int(arg_5)
            elif arg_6 == 'boolean' and not isinstance(arg_5, bool):
                arg_5 = arg_5 == '1'
            arg_1[arg_4] = arg_5
        return arg_1


def Func ( arg_0 ) : if WINDOWS : arg_1 = os . path . normpath ( _get_win_folder ( "CSIDL_LOCAL_APPDATA" ) ) arg_1 = os . path . join ( arg_1 , arg_0 , "Cache" ) elif sys . platform == "darwin" : arg_1 = os . path . expanduser ( "~/Library/Caches" ) arg_1 = os . path . join ( arg_1 , arg_0 ) else : arg_1 = os . getenv ( "XDG_CACHE_HOME" , os . path . expanduser ( "~/.cache" ) ) arg_1 = os . path . join ( arg_1 , arg_0 ) return arg_1

def Func(arg_0):
    r"""
    Return full path to the user-specific cache dir for this application.

        "appname" is the name of application.

    Typical user cache directories are:
        Mac OS X:   ~/Library/Caches/<AppName>
        Unix:       ~/.cache/<AppName> (XDG default)
        Windows:      C:\Users\<username>\AppData\Local\<AppName>\Cache

    On Windows the only suggestion in the MSDN docs is that local settings go
    in the `CSIDL_LOCAL_APPDATA` directory. This is identical to the
    non-roaming app data dir (the default returned by `user_data_dir`). Apps
    typically put cache data somewhere *under* the given dir here. Some
    examples:
        ...\Mozilla\Firefox\Profiles\<ProfileName>\Cache
        ...\Acme\SuperApp\Cache\1.0

    OPINION: This function appends "Cache" to the `CSIDL_LOCAL_APPDATA` value.
    """
    if WINDOWS:
        # Get the base path
        arg_1 = os.path.normpath(_get_win_folder("CSIDL_LOCAL_APPDATA"))

        # Add our app name and Cache directory to it
        arg_1 = os.path.join(arg_1, arg_0, "Cache")
    elif sys.platform == "darwin":
        # Get the base path
        arg_1 = os.path.expanduser("~/Library/Caches")

        # Add our app name to it
        arg_1 = os.path.join(arg_1, arg_0)
    else:
        # Get the base path
        arg_1 = os.getenv("XDG_CACHE_HOME", os.path.expanduser("~/.cache"))

        # Add our app name to it
        arg_1 = os.path.join(arg_1, arg_0)

    return arg_1

r Return full path to the user - specific cache dir for this application .


def Func ( arg_0 , arg_1 ) : arg_2 = binascii . unhexlify ( arg_1 ) with warnings . catch_warnings ( ) : warnings . simplefilter ( "ignore" ) arg_3 = arg_0 . cipher . decrypt ( arg_2 ) . decode ( 'ascii' ) arg_4 = json . loads ( arg_3 ) return arg_4

def Func(arg_0, arg_1):
        """The exact opposite of _encrypt
        """
        arg_2 = binascii.unhexlify(arg_1)
        with warnings.catch_warnings():
            warnings.simplefilter("ignore")
            arg_3 = arg_0.cipher.decrypt(
                arg_2).decode('ascii')
        arg_4 = json.loads(arg_3)
        return arg_4


(self, analytes=None, filt=True,
                     stat_fns={},
                     eachtrace=True)

def Func ( arg_0 , arg_1 = None , arg_2 = True , arg_3 = { } , arg_4 = True ) : if arg_1 is None : arg_1 = arg_0 . analytes elif isinstance ( arg_1 , str ) : arg_1 = [ arg_1 ] arg_0 . stats = Bunch ( ) arg_0 . stats [ 'analytes' ] = arg_1 with warnings . catch_warnings ( ) : warnings . simplefilter ( "ignore" , category = RuntimeWarning ) for arg_6 , arg_7 in arg_3 . items ( ) : arg_0 . stats [ arg_6 ] = [ ] for arg_8 in arg_1 : arg_9 = arg_0 . filt . grab_filt ( arg_2 , arg_8 ) arg_10 = nominal_values ( arg_0 . focus [ arg_8 ] ) if arg_4 : arg_11 = [ ] for arg_12 in np . arange ( arg_0 . n ) + 1 : arg_11 . append ( arg_7 ( arg_10 [ arg_9 & ( arg_0 . ns == arg_12 ) ] ) ) arg_0 . stats [ arg_6 ] . append ( arg_11 ) else : arg_0 . stats [ arg_6 ] . append ( arg_7 ( arg_10 [ arg_9 ] ) ) arg_0 . stats [ arg_6 ] = np . array ( arg_0 . stats [ arg_6 ] ) return

def Func(arg_0, arg_1=None, arg_2=True,
                     arg_3={},
                     arg_4=True):
        """
        Calculate sample statistics

        Returns samples, analytes, and arrays of statistics
        of shape (samples, analytes). Statistics are calculated
        from the 'focus' data variable, so output depends on how
        the data have been processed.

        Parameters
        ----------
        analytes : array_like
            List of analytes to calculate the statistic on
        filt : bool or str
            The filter to apply to the data when calculating sample statistics.
                bool: True applies filter specified in filt.switches.
                str: logical string specifying a partucular filter
        stat_fns : dict
            Dict of {name: function} pairs. Functions that take a single
            array_like input, and return a single statistic. Function should
            be able to cope with NaN values.
        eachtrace : bool
            True: per - ablation statistics
            False: whole sample statistics

        Returns
        -------
        None
        """
        if arg_1 is None:
                arg_1 = arg_0.analytes
        elif isinstance(arg_1, str):
            arg_1 = [arg_1]

        arg_0.stats = Bunch()
        arg_0.stats['analytes'] = arg_1

        with warnings.catch_warnings():
            warnings.simplefilter("ignore", category=RuntimeWarning)
            for arg_6, arg_7 in arg_3.items():
                arg_0.stats[arg_6] = []
                for arg_8 in arg_1:
                    arg_9 = arg_0.filt.grab_filt(arg_2, arg_8)
                    arg_10 = nominal_values(arg_0.focus[arg_8])
                    if arg_4:
                        arg_11 = []
                        for arg_12 in np.arange(arg_0.n) + 1:
                            arg_11.append(arg_7(arg_10[arg_9 & (arg_0.ns == arg_12)]))
                        arg_0.stats[arg_6].append(arg_11)
                    else:
                        arg_0.stats[arg_6].append(arg_7(arg_10[arg_9]))
                arg_0.stats[arg_6] = np.array(arg_0.stats[arg_6])
        return


def Func(arg_0, arg_1=False):
        """
        Read a value from the stack and increment the stack pointer.

        :param force: whether to ignore memory permissions
        :return: Value read
        """
        arg_2 = arg_0.read_int(arg_0.STACK, arg_1=arg_1)
        arg_0.STACK += arg_0.address_bit_size // 8
        return arg_2

Read a value from the stack and increment the stack pointer .


def Func ( arg_0 ) : arg_1 = arg_0 . pop ( 'log_level' , None ) arg_2 = arg_0 . pop ( 'log_folder' , 'logs' ) arg_3 = arg_0 . pop ( 'logger_names' , '' ) if arg_1 is None : arg_1 = arg_0 . pop ( 'log_levels' , logging . INFO ) arg_4 = arg_0 . pop ( 'log_multiproc' , True ) if not isinstance ( arg_3 , ( tuple , list ) ) : arg_3 = [ arg_3 ] if not isinstance ( arg_1 , ( tuple , list ) ) : arg_1 = [ arg_1 ] if len ( arg_1 ) == 1 : arg_1 = [ arg_1 [ 0 ] for _ in arg_3 ] arg_5 = copy . deepcopy ( LOGGING_DICT ) arg_6 = [ '' ] if not arg_4 : for arg_7 in list ( arg_5 . keys ( ) ) : if arg_7 . startswith ( 'multiproc_' ) : del arg_5 [ arg_7 ] else : arg_6 . append ( 'multiproc_' ) for arg_8 in arg_6 : for arg_9 in arg_5 [ arg_8 + 'handlers' ] . values ( ) : if 'filename' in arg_9 : arg_10 = os . path . join ( arg_2 , arg_9 [ 'filename' ] ) arg_10 = os . path . normpath ( arg_10 ) arg_9 [ 'filename' ] = arg_10 arg_5 [ arg_8 + 'loggers' ] = { } arg_11 = arg_5 [ arg_8 + 'loggers' ] for arg_12 , arg_13 in enumerate ( arg_3 ) : arg_11 [ arg_13 ] = { 'level' : arg_1 [ arg_12 ] , 'handlers' : list ( arg_5 [ arg_8 + 'handlers' ] . keys ( ) ) } arg_0 [ 'log_config' ] = arg_5

def Func(arg_0):
    """ Helper function to turn the simple logging kwargs into a `log_config`."""
    arg_1 = arg_0.pop('log_level', None)
    arg_2 = arg_0.pop('log_folder', 'logs')
    arg_3 = arg_0.pop('logger_names', '')
    if arg_1 is None:
        arg_1 = arg_0.pop('log_levels', logging.INFO)
    arg_4 = arg_0.pop('log_multiproc', True)

    if not isinstance(arg_3, (tuple, list)):
        arg_3 = [arg_3]
    if not isinstance(arg_1, (tuple, list)):
        arg_1 = [arg_1]
    if len(arg_1) == 1:
        arg_1 = [arg_1[0] for _ in arg_3]

    # We don't want to manipulate the original dictionary
    arg_5 = copy.deepcopy(LOGGING_DICT)
    arg_6 = ['']
    if not arg_4:
        for arg_7 in list(arg_5.keys()):
            if arg_7.startswith('multiproc_'):
                del arg_5[arg_7]
    else:
        arg_6.append('multiproc_')

    # Add all handlers to all loggers
    for arg_8 in arg_6:
        for arg_9 in arg_5[arg_8 + 'handlers'].values():
            if 'filename' in arg_9:
                arg_10 = os.path.join(arg_2, arg_9['filename'])
                arg_10 = os.path.normpath(arg_10)
                arg_9['filename'] = arg_10
        arg_5[arg_8 + 'loggers'] = {}
        arg_11 = arg_5[arg_8 + 'loggers']
        for arg_12, arg_13 in enumerate(arg_3):
            arg_11[arg_13] = {
                'level': arg_1[arg_12],
                'handlers': list(arg_5[arg_8 + 'handlers'].keys())
            }

    arg_0['log_config'] = arg_5

Helper function to turn the simple logging kwargs into a log_config .


def Func ( arg_0 , arg_1 , arg_2 = False ) : arg_3 = Q ( ) for arg_4 , arg_5 in iteritems ( arg_1 ) : try : arg_6 = arg_5 . split ( "," ) if len ( arg_6 ) > 0 : arg_7 = Q ( ) for arg_5 in arg_6 : arg_7 |= Q ( ** { arg_4 : arg_5 } ) arg_3 &= arg_7 except AttributeError : arg_3 &= Q ( ** { arg_4 : arg_5 } ) if arg_2 : arg_0 = arg_0 . exclude ( arg_3 ) else : arg_0 = arg_0 . filter ( arg_3 ) return arg_0

def Func(arg_0, arg_1, arg_2=False):
    """
    Filter queryset based on keywords.
    Support for multiple-selected parent values.
    """
    arg_3 = Q()
    for arg_4, arg_5 in iteritems(arg_1):
        try:
            arg_6 = arg_5.split(",")
            if len(arg_6) > 0:
                arg_7 = Q()
                for arg_5 in arg_6:
                    arg_7 |= Q(**{arg_4: arg_5})
                arg_3 &= arg_7
        except AttributeError:
            # value can be a bool
            arg_3 &= Q(**{arg_4: arg_5})
    if arg_2:
        arg_0 = arg_0.exclude(arg_3)
    else:
        arg_0 = arg_0.filter(arg_3)
    return arg_0

Filter queryset based on keywords . Support for multiple - selected parent values .


def
Func
(
arg_0
)
:
if
arg_0
[
"conf"
]
[
"VERBOSE"
]
:
cij
.
emph
(
"rnr:trun::enter"
)
arg_0
[
"stamp"
]
[
"begin"
]
=
int
(
time
.
time
(
)
)
arg_1
=
0
for
arg_2
in
arg_0
[
"hooks"
]
[
"enter"
]
:
arg_1
=
script_run
(
arg_0
,
arg_2
)
if
arg_1
:
break
if
arg_0
[
"conf"
]
[
"VERBOSE"
]
:
cij
.
emph
(
"rnr:trun::enter { rcode: %r }"
%
arg_1
,
arg_1
)
return
arg_1

def Func(arg_0):
    """Triggers when entering the given testrun"""

    if arg_0["conf"]["VERBOSE"]:
        cij.emph("rnr:trun::enter")

    arg_0["stamp"]["begin"] = int(time.time())     # Record start timestamp

    arg_1 = 0
    for arg_2 in arg_0["hooks"]["enter"]:     # ENTER-hooks
        arg_1 = script_run(arg_0, arg_2)
        if arg_1:
            break

    if arg_0["conf"]["VERBOSE"]:
        cij.emph("rnr:trun::enter { rcode: %r }" % arg_1, arg_1)

    return arg_1


def
Func
(
arg_0
,
arg_1
)
:
if
type
(
arg_1
)
is
list
:
return
[
arg_0
.
Func
(
arg_2
)
for
arg_2
in
arg_1
]
arg_3
=
arg_0
.
_pin_mapping
.
get
(
arg_1
,
)
if
arg_3
:
return
arg_0
.
_Func
(
arg_3
)
else
:
raise
KeyError
(
'Requested pin is not mapped: %s'
%
arg_1
)

def Func(arg_0, arg_1):
        """Gets the `ahio.PortType` this pin was set to.

        If you're developing a driver, implement _Func(self, pin)

        @arg pin the pin you want to see the mode
        @returns the `ahio.PortType` the pin is set to

        @throw KeyError if pin isn't mapped.
        """
        if type(arg_1) is list:
            return [arg_0.Func(arg_2) for arg_2 in arg_1]

        arg_3 = arg_0._pin_mapping.get(arg_1, None)
        if arg_3:
            return arg_0._Func(arg_3)
        else:
            raise KeyError('Requested pin is not mapped: %s' % arg_1)

Gets the `ahio.PortType` this pin was set to.

        If you're developing a driver, implement _pin_type(self, pin)

        @arg pin the pin you want to see the mode
        @returns the `ahio.PortType` the pin is set to

        @throw KeyError if pin isn't mapped.

Gets the ahio . PortType this pin was set to .


def Func ( arg_0 ) -> bool : if arg_0 . read_eof ( ) : return True arg_0 . _stream . save_context ( ) while not arg_0 . read_eof ( ) : arg_0 . _stream . incpos ( ) return arg_0 . _stream . validate_context ( )

def Func(arg_0) -> bool:
        """Consume all the stream. Same as EOF in BNF."""
        if arg_0.read_eof():
            return True
        # TODO: read ALL
        arg_0._stream.save_context()
        while not arg_0.read_eof():
            arg_0._stream.incpos()
        return arg_0._stream.validate_context()

Consume all the stream . Same as EOF in BNF .


def
Func
(
arg_0
,
arg_1
)
:
arg_0
.
lock
.
acquire
(
)
try
:
arg_2
=
arg_1
.
get_error
(
)
arg_3
=
arg_2
.
xpath_eval
(
"e:*"
,
{
"e"
:
"jabber:iq:auth:error"
}
)
if
arg_3
:
arg_3
=
arg_3
[
0
]
.
name
else
:
arg_3
=
arg_2
.
get_condition
(
)
.
name
raise
LegacyAuthenticationError
(
"Authentication error condition: %s"
%
(
arg_3
,
)
)
finally
:
arg_0
.
lock
.
release
(
)

def Func(arg_0,arg_1):
        """Handle legacy authentication error.

        [client only]"""
        arg_0.lock.acquire()
        try:
            arg_2=arg_1.get_error()
            arg_3=arg_2.xpath_eval("e:*",{"e":"jabber:iq:auth:error"})
            if arg_3:
                arg_3=arg_3[0].name
            else:
                arg_3=arg_2.get_condition().name
            raise LegacyAuthenticationError("Authentication error condition: %s"
                        % (arg_3,))
        finally:
            arg_0.lock.release()


(self, share_name, directory_name=None, **kwargs)

return self.connection.list_directories_and_files(share_name,
                                                          directory_name,
                                                          **kwargs)

def Func ( arg_0 , arg_1 , arg_2 = None , ** arg_3 ) : return arg_0 . connection . Func ( arg_1 , arg_2 , ** arg_3 )

def Func(arg_0, arg_1, arg_2=None, **arg_3):
        """
        Return the list of directories and files stored on a Azure File Share.

        :param share_name: Name of the share.
        :type share_name: str
        :param directory_name: Name of the directory.
        :type directory_name: str
        :param kwargs: Optional keyword arguments that
            `FileService.Func()` takes.
        :type kwargs: object
        :return: A list of files and directories
        :rtype: list
        """
        return arg_0.connection.Func(arg_1,
                                                          arg_2,
                                                          **arg_3)

Return the list of directories and files stored on a Azure File Share.

        :param share_name: Name of the share.
        :type share_name: str
        :param directory_name: Name of the directory.
        :type directory_name: str
        :param kwargs: Optional keyword arguments that
            `FileService.list_directories_and_files()` takes.
        :type kwargs: object
        :return: A list of files and directories
        :rtype: list

Return the list of directories and files stored on a Azure File Share .


def
Func
(
arg_0
,
arg_1
)
:
arg_0
.
_anything_done
=
True
logger
.
debug
(
"Func() called"
)
arg_1
.
quit
(
)

def Func(arg_0, arg_1):
        """Stops the loop after the time specified in the `loop` call.
        """
        arg_0._anything_done = True
        logger.debug("Func() called")
        arg_1.quit()

Stops the loop after the time specified in the loop call .


def Func ( arg_0 , arg_1 ) : if not os . path . isabs ( arg_1 ) : arg_1 = os . path . join ( arg_0 , arg_1 ) return os . path . abspath ( arg_1 )

def Func(arg_0, arg_1):
    """
    Canonicalizes a path relative to a given working directory.  That
    is, the path, if not absolute, is interpreted relative to the
    working directory, then converted to absolute form.

    :param cwd: The working directory.
    :param path: The path to canonicalize.

    :returns: The absolute path.
    """

    if not os.path.isabs(arg_1):
        arg_1 = os.path.join(arg_0, arg_1)

    return os.path.abspath(arg_1)

Canonicalizes a path relative to a given working directory . That is the path if not absolute is interpreted relative to the working directory then converted to absolute form .


def Func ( ** arg_0 ) : arg_1 = dict ( izip_longest ( info_fields , [ None ] ) ) arg_1 . update ( arg_0 ) return arg_1

def Func(**arg_0):
    """Make an object info dict with all fields present."""
    arg_1 = dict(izip_longest(info_fields, [None]))
    arg_1.update(arg_0)
    return arg_1

Make an object info dict with all fields present .


def
Func
(
arg_0
)
->
float
:
if
not
arg_0
.
done_chomping
(
)
:
raise
ValueError
(
'algorithm has not yet completed'
)
return
arg_0
.
graph
.
nodes
[
arg_0
.
target_node
]
[
arg_0
.
tag
]

def Func(arg_0) -> float:
        """Return the final score for the target node.

        :return: The final score for the target node
        """
        if not arg_0.done_chomping():
            raise ValueError('algorithm has not yet completed')

        return arg_0.graph.nodes[arg_0.target_node][arg_0.tag]

Return the final score for the target node .