(cls, enterprise_customer, user, course_mode, *course_ids)

def Func(arg_0, arg_1, arg_2, arg_3, *arg_4):
        """
        Enroll a single user in any number of courses using a particular course mode.

        Args:
            enterprise_customer: The EnterpriseCustomer which is sponsoring the enrollment
            user: The user who needs to be enrolled in the course
            course_mode: The mode with which the enrollment should be created
            *course_ids: An iterable containing any number of course IDs to eventually enroll the user in.

        Returns:
            Boolean: Whether or not enrollment succeeded for all courses specified
        """
        arg_5, arg_6 = EnterpriseCustomerUser.objects.get_or_create(
            arg_1=arg_1,
            user_id=arg_2.id
        )
        arg_7 = EnrollmentApiClient()
        arg_8 = True
        for arg_9 in arg_4:
            try:
                arg_7.Func_in_course(arg_2.username, arg_9, arg_3)
            except HttpClientError as exc:
                # Check if user is already enrolled then we should ignore exception
                if arg_0.is_user_enrolled(arg_2, arg_9, arg_3):
                    arg_8 = True
                else:
                    arg_8 = False
                    arg_10 = 'No error message provided'
                    try:
                        arg_11 = json.loads(exc.content.decode()).get('message', arg_10)
                    except ValueError:
                        arg_11 = arg_10
                    logging.error(
                        'Error while enrolling user %(user)s: %(message)s',
                        dict(arg_2=arg_2.username, message=arg_11)
                    )
            if arg_8:
                arg_6, arg_12 = EnterpriseCourseEnrollment.objects.get_or_create(
                    arg_5=arg_5,
                    arg_9=arg_9
                )
                if arg_12:
                    track_enrollment('admin-enrollment', arg_2.id, arg_9)
        return arg_8

Enroll a single user in any number of courses using a particular course mode .


return struct.unpack('f', struct.pack('4B', *byte_array))[0]

def Func ( arg_0 , arg_1 ) : if len ( arg_1 ) != 4 : return None return struct . unpack ( 'f' , struct . pack ( '4B' , * arg_1 ) ) [ 0 ]

def Func(arg_0, arg_1):
        """Returns an IEEE 754 float from an array of 4 bytes

        :param byte_array: Expects an array of 4 bytes

        :type byte_array: array

        :rtype: float
        """
        if len(arg_1) != 4:
            return None

        return struct.unpack('f', struct.pack('4B', *arg_1))[0]


def Func ( arg_0 , arg_1 ) : arg_1 . write ( Operators . ITEBV ( arg_1 . size , Operators . AND ( arg_0 . CF == False , arg_0 . ZF == False ) , 1 , 0 ) )

def Func(arg_0, arg_1):
        """
        Sets byte if not below or equal.

        :param cpu: current CPU.
        :param dest: destination operand.
        """
        arg_1.write(Operators.ITEBV(arg_1.size, Operators.AND(arg_0.CF == False, arg_0.ZF == False), 1, 0))


def Func ( arg_0 , arg_1 ) : arg_2 = os . path . dirname ( arg_1 ) if not os . path . exists ( arg_2 ) : os . makedirs ( arg_2 ) shutil . copy2 ( arg_0 , arg_1 )

def Func(arg_0, arg_1):
    """
    Copy file helper method

    :type src: str|unicode
    :type dest: str|unicode
    """
    arg_2 = os.path.dirname(arg_1)
    if not os.path.exists(arg_2):
        os.makedirs(arg_2)
    shutil.copy2(arg_0, arg_1)


def Func(*arg_0):
    """Raises `InvalidEnvironmentError` when one isnt set"""
    for arg_1 in arg_0:
        if not os.environ.get(arg_1):
            arg_2 = (
                'Must set {} environment variable. View docs for setting up environment at {}'
            ).format(arg_1, temple.constants.TEMPLE_DOCS_URL)
            raise temple.exceptions.InvalidEnvironmentError(arg_2)

Raises InvalidEnvironmentError when one isnt set


return 0xFFFFFFFF - _dot_to_dec(nm, check=False)

def
Func
(
arg_0
,
arg_1
=
False
)
:
if
arg_1
and
not
is_wildcard_nm
(
arg_0
)
:
raise
ValueError
(
'Func: invalid netmask: "%s"'
%
arg_0
)
return
0xFFFFFFFF
_dot_to_dec
(
arg_0
,
arg_1
=
False
)

def Func(arg_0, arg_1=False):
    """Wildcard bits to decimal conversion."""
    if arg_1 and not is_wildcard_nm(arg_0):
        raise ValueError('Func: invalid netmask: "%s"' % arg_0)
    return 0xFFFFFFFF - _dot_to_dec(arg_0, arg_1=False)


def Func(arg_0, arg_1=False):
  """Converts Struct message according to Proto3 JSON Specification."""
  arg_2 = arg_0.fields
  arg_3 = {}
  for arg_4 in arg_2:
    arg_3[arg_4] = _ValueMessageToJsonObject(arg_2[arg_4])
  return arg_3

Converts Struct message according to Proto3 JSON Specification .


def
Func
(
arg_0
)
:
arg_1
=
os
.
path
.
join
(
dirname
(
abspath
(
__file__
)
)
,
'project'
)
arg_2
=
arg_0
.
get
(
'<project>'
)
if
not
arg_2
:
logger
.
warning
(
'Project name cannot be empty.'
)
return
arg_3
=
os
.
path
.
join
(
os
.
getcwd
(
)
,
arg_2
)
if
os
.
path
.
isdir
(
arg_3
)
:
logger
.
warning
(
'Project directory already exists.'
)
return
logger
.
info
(
'Start generating project files.'
)
_mkdir_p
(
arg_3
)
for
arg_4
,
arg_5
,
arg_6
in
os
.
walk
(
arg_1
)
:
arg_7
=
arg_4
.
split
(
arg_1
)
[
1
]
.
lstrip
(
os
.
path
.
sep
)
arg_8
=
os
.
path
.
join
(
arg_3
,
arg_7
)
if
arg_1
!=
arg_4
:
_mkdir_p
(
arg_8
)
for
arg_9
in
arg_6
:
if
arg_9
in
[
'development.py'
,
'production.py'
]
:
continue
arg_10
=
os
.
path
.
join
(
arg_4
,
arg_9
)
arg_11
=
os
.
path
.
join
(
arg_8
,
arg_9
)
if
arg_9
.
endswith
(
REWRITE_FILE_EXTS
)
:
_rewrite_and_copy
(
arg_10
,
arg_11
,
arg_2
)
else
:
shutil
.
copy
(
arg_10
,
arg_11
)
logger
.
info
(
"New: %s"
%
arg_11
)
if
arg_9
in
[
'development_sample.py'
,
'production_sample.py'
]
:
arg_11
=
os
.
path
.
join
(
arg_8
,
"%s.py"
%
arg_9
.
split
(
'_'
)
[
0
]
)
_rewrite_and_copy
(
arg_10
,
arg_11
,
arg_2
)
logger
.
info
(
"New: %s"
%
arg_11
)
logger
.
info
(
'Finish generating project files.'
)

def Func(arg_0):
    """New project."""
    # Project templates path
    arg_1 = os.path.join(dirname(abspath(__file__)), 'project')

    arg_2 = arg_0.get('<project>')

    if not arg_2:
        logger.warning('Project name cannot be empty.')
        return

    # Destination project path
    arg_3 = os.path.join(os.getcwd(), arg_2)

    if os.path.isdir(arg_3):
        logger.warning('Project directory already exists.')
        return

    logger.info('Start generating project files.')

    _mkdir_p(arg_3)

    for arg_4, arg_5, arg_6 in os.walk(arg_1):
        # Build and create destination directory path
        arg_7 = arg_4.split(arg_1)[1].lstrip(os.path.sep)
        arg_8 = os.path.join(arg_3, arg_7)

        if arg_1 != arg_4:
            _mkdir_p(arg_8)

        # Copy, rewrite and move project files
        for arg_9 in arg_6:
            if arg_9 in ['development.py', 'production.py']:
                continue

            arg_10 = os.path.join(arg_4, arg_9)
            arg_11 = os.path.join(arg_8, arg_9)

            if arg_9.endswith(REWRITE_FILE_EXTS):
                _rewrite_and_copy(arg_10, arg_11, arg_2)
            else:
                shutil.copy(arg_10, arg_11)
            logger.info("New: %s" % arg_11)

            if arg_9 in ['development_sample.py', 'production_sample.py']:
                arg_11 = os.path.join(arg_8, "%s.py" % arg_9.split('_')[0])
                _rewrite_and_copy(arg_10, arg_11, arg_2)
                logger.info("New: %s" % arg_11)

    logger.info('Finish generating project files.')


def Func():
    """
    Utility function for the RedisLogRecord.

    Returns the module, function, and lineno of the function
    that called the logger.

    We look way up in the stack.  The stack at this point is:
    [0] logger.py Func (hey, that's me!)
    [1] logger.py __init__
    [2] logger.py makeRecord
    [3] _log
    [4] <logging method>
    [5] caller of logging method
    """
    arg_0 = inspect.stack()

    if len(arg_0) > 4:
        arg_1 = arg_0[5]
    else:
        arg_1 = arg_0[0]

    arg_2 = arg_1[1]
    arg_3 = arg_1[2]

    if arg_1[3]:
        arg_4 = arg_1[3]
    else:
        arg_4 = ""

    # python docs say you don't want references to
    # frames lying around.  Bad things can happen.
    del arg_1
    del arg_0

    return arg_2, arg_4, arg_3

Utility function for the RedisLogRecord.

    Returns the module, function, and lineno of the function
    that called the logger.

    We look way up in the stack.  The stack at this point is:
    [0] logger.py _getCallingContext (hey, that's me!)
    [1] logger.py __init__
    [2] logger.py makeRecord
    [3] _log
    [4] <logging method>
    [5] caller of logging method

Utility function for the RedisLogRecord .


def Func(arg_0, arg_1=1, arg_2=None, arg_3=None, arg_4=None):
        """This method Funcs the queue forward for a specified
        amount of simulation time, or for a specific number of
        events.

        Parameters
        ----------
        n : int (optional, default: ``1``)
            The number of events to Func. If ``t``, ``nA``, and
            ``nD`` are not given then this parameter is used.
        t : float (optional)
            The minimum amount of simulation time to Func forward.
        nA : int (optional)
            Simulate until ``nA`` additional arrivals are observed.
        nD : int (optional)
            Simulate until ``nD`` additional departures are observed.

        Examples
        --------
        Before any simulations can take place the ``QueueServer`` must
        be activated:

        >>> import queueing_tool as qt
        >>> import numpy as np
        >>> rate = lambda t: 2 + 16 * np.sin(np.pi * t / 8)**2
        >>> arr = lambda t: qt.poisson_random_measure(t, rate, 18)
        >>> ser = lambda t: t + np.random.gamma(4, 0.1)
        >>> q = qt.QueueServer(5, arrival_f=arr, service_f=ser, seed=54)
        >>> q.set_active()

        To Func 50000 events do the following:

        >>> q.Func(50000)
        >>> num_events = q.num_arrivals[0] + q.num_departures
        >>> num_events
        50000

        To Func forward 75 time units, do the following:

        >>> t0 = q.time
        >>> q.Func(t=75)
        >>> round(float(q.time - t0), 1)
        75.1
        >>> q.num_arrivals[1] + q.num_departures - num_events
        1597

        To Func forward until 1000 new departures are observed run:

        >>> nA0, nD0 = q.num_arrivals[1], q.num_departures
        >>> q.Func(nD=1000)
        >>> q.num_departures - nD0, q.num_arrivals[1] - nA0
        (1000, 983)

        To Func until 1000 new arrivals are observed run:

        >>> nA0, nD0 = q.num_arrivals[1], q.num_departures
        >>> q.Func(nA=1000)
        >>> q.num_departures - nD0, q.num_arrivals[1] - nA0,
        (987, 1000)
        """
        if arg_2 is None and arg_4 is None and arg_3 is None:
            for arg_5 in range(arg_1):
                arg_0.next_event()
        elif arg_2 is not None:
            arg_6 = arg_0._current_t + arg_2
            while arg_0._current_t < arg_6 and arg_0._time < infty:
                arg_0.next_event()
        elif arg_4 is not None:
            arg_7 = arg_0.num_departures + arg_4
            while arg_0.num_departures < arg_7 and arg_0._time < infty:
                arg_0.next_event()
        elif arg_3 is not None:
            arg_8 = arg_0._oArrivals + arg_3
            while arg_0._oArrivals < arg_8 and arg_0._time < infty:
                arg_0.next_event()

This method simulates the queue forward for a specified
        amount of simulation time, or for a specific number of
        events.

        Parameters
        ----------
        n : int (optional, default: ``1``)
            The number of events to simulate. If ``t``, ``nA``, and
            ``nD`` are not given then this parameter is used.
        t : float (optional)
            The minimum amount of simulation time to simulate forward.
        nA : int (optional)
            Simulate until ``nA`` additional arrivals are observed.
        nD : int (optional)
            Simulate until ``nD`` additional departures are observed.

        Examples
        --------
        Before any simulations can take place the ``QueueServer`` must
        be activated:

        >>> import queueing_tool as qt
        >>> import numpy as np
        >>> rate = lambda t: 2 + 16 * np.sin(np.pi * t / 8)**2
        >>> arr = lambda t: qt.poisson_random_measure(t, rate, 18)
        >>> ser = lambda t: t + np.random.gamma(4, 0.1)
        >>> q = qt.QueueServer(5, arrival_f=arr, service_f=ser, seed=54)
        >>> q.set_active()

        To simulate 50000 events do the following:

        >>> q.simulate(50000)
        >>> num_events = q.num_arrivals[0] + q.num_departures
        >>> num_events
        50000

        To simulate forward 75 time units, do the following:

        >>> t0 = q.time
        >>> q.simulate(t=75)
        >>> round(float(q.time - t0), 1)
        75.1
        >>> q.num_arrivals[1] + q.num_departures - num_events
        1597

        To simulate forward until 1000 new departures are observed run:

        >>> nA0, nD0 = q.num_arrivals[1], q.num_departures
        >>> q.simulate(nD=1000)
        >>> q.num_departures - nD0, q.num_arrivals[1] - nA0
        (1000, 983)

        To simulate until 1000 new arrivals are observed run:

        >>> nA0, nD0 = q.num_arrivals[1], q.num_departures
        >>> q.simulate(nA=1000)
        >>> q.num_departures - nD0, q.num_arrivals[1] - nA0,
        (987, 1000)

This method simulates the queue forward for a specified amount of simulation time or for a specific number of events .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = { 'correct' : 0 , 'incorrect' : 0 , 'ambiguous' : 0 } arg_4 = { 'correct' : 0 , 'incorrect' : 0 , 'ambiguous' : 0 } arg_5 = [ node for node in arg_1 if node != arg_2 ] arg_6 = run_cna ( arg_0 , arg_2 , arg_5 ) for arg_7 , arg_8 , arg_9 in arg_6 : if ( arg_9 is Effect . inhibition or arg_9 is Effect . activation ) and ( arg_9 . value == arg_1 [ arg_8 ] ) : arg_3 [ 'correct' ] += 1 arg_4 [ 'incorrect' ] += 1 elif arg_9 is Effect . ambiguous : arg_3 [ 'ambiguous' ] += 1 arg_4 [ 'ambiguous' ] += 1 elif arg_9 is Effect . no_effect : continue else : arg_4 [ 'correct' ] += 1 arg_3 [ 'incorrect' ] += 1 arg_3 [ 'score' ] = arg_3 [ 'correct' ] - arg_3 [ 'incorrect' ] arg_4 [ 'score' ] = arg_4 [ 'correct' ] - arg_4 [ 'incorrect' ] return arg_3 , arg_4

def Func(arg_0, arg_1, arg_2):
    """Test the regulator hypothesis of the given node on the input data using the algorithm.

    Note: this method returns both +/- signed hypotheses evaluated

    Algorithm:

    1. Calculate the shortest path between the regulator node and each node in observed_regulation
    2. Calculate the concordance of the causal network and the observed regulation when there is path
       between target node and regulator node

    :param networkx.DiGraph graph: A causal graph
    :param dict node_to_regulation: Nodes to score (1,-1,0)
    :return Dictionaries with hypothesis results (keys: score, correct, incorrect, ambiguous)
    :rtype: dict
    """
    arg_3 = {
        'correct': 0,
        'incorrect': 0,
        'ambiguous': 0
    }
    arg_4 = {
        'correct': 0,
        'incorrect': 0,
        'ambiguous': 0
    }

    arg_5 = [
        node
        for node in arg_1
        if node != arg_2
    ]

    arg_6 = run_cna(arg_0, arg_2, arg_5)  # + signed hypothesis

    for arg_7, arg_8, arg_9 in arg_6:

        if (arg_9 is Effect.inhibition or arg_9 is Effect.activation) and (
                arg_9.value == arg_1[arg_8]):
            arg_3['correct'] += 1
            arg_4['incorrect'] += 1

        elif arg_9 is Effect.ambiguous:
            arg_3['ambiguous'] += 1
            arg_4['ambiguous'] += 1

        elif arg_9 is Effect.no_effect:
            continue

        else:
            arg_4['correct'] += 1
            arg_3['incorrect'] += 1

    arg_3['score'] = arg_3['correct'] - arg_3['incorrect']
    arg_4['score'] = arg_4['correct'] - arg_4['incorrect']

    return arg_3, arg_4

Test the regulator hypothesis of the given node on the input data using the algorithm .


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_3 = arg_0 . get_metadata ( arg_1 ) [ 'dataset' ] [ 'cube_dimension' ] if arg_2 is None : arg_2 = min ( arg_3 . keys ( ) ) return arg_3 [ str ( arg_2 ) ]

def Func(arg_0, arg_1, arg_2=None):
        """
        Gets the block-size for a given token at a given resolution.

        Arguments:
            token (str): The token to inspect
            resolution (int : None): The resolution at which to inspect data.
                If none is specified, uses the minimum available.

        Returns:
            int[3]: The xyz blocksize.
        """
        arg_3 = arg_0.get_metadata(arg_1)['dataset']['cube_dimension']
        if arg_2 is None:
            arg_2 = min(arg_3.keys())
        return arg_3[str(arg_2)]

Gets the block - size for a given token at a given resolution .


def Func ( arg_0 , arg_1 ) : if not arg_1 . starts_same_month_as ( arg_0 . month ) and not arg_1 . repeats ( 'NEVER' ) : return arg_2 = defaultdict ( list ) arg_3 = Repeater ( arg_2 , arg_0 . year , arg_0 . month , arg_5 = arg_1 . l_start_date . day , end_repeat = arg_1 . end_repeat , arg_1 = arg_1 , count_first = True , arg_4 = arg_1 . l_end_date . day , num = 1 ) if arg_1 . starts_same_month_as ( arg_0 . month ) : if not arg_1 . ends_same_month_as ( arg_0 . month ) : arg_3 . end_on = None else : arg_3 . day = 1 arg_3 . repeat ( ) for arg_6 , arg_7 in arg_3 . count . items ( ) : arg_0 . count [ arg_6 ] . extend ( arg_7 )

def Func(arg_0, arg_1):
        """
        This handles either a non-repeating event chunk, or the first
        month of a repeating event chunk.
        """
        if not arg_1.starts_same_month_as(arg_0.month) and not \
                arg_1.repeats('NEVER'):
            # no repeating chunk events if we're not in it's start month
            return

        # add the events into an empty defaultdict. This is better than passing
        # in self.count, which we don't want to make another copy of because it
        # could be very large.
        arg_2 = defaultdict(list)
        arg_3 = Repeater(
            arg_2, arg_0.year, arg_0.month, arg_5=arg_1.l_start_date.day,
            end_repeat=arg_1.end_repeat, arg_1=arg_1, count_first=True,
            arg_4=arg_1.l_end_date.day, num=1
        )

        if arg_1.starts_same_month_as(arg_0.month):
            if not arg_1.ends_same_month_as(arg_0.month):
                # The chunk event starts this month,
                # but does NOT end this month
                arg_3.end_on = None
        else:
            # event chunks can be maximum of 7 days, so if an event chunk
            # didn't start this month, we know it will end this month.
            arg_3.day = 1
        arg_3.repeat()
        # now we add in the events we generated to self.count
        for arg_6, arg_7 in arg_3.count.items():
            arg_0.count[arg_6].extend(arg_7)

This handles either a non - repeating event chunk or the first month of a repeating event chunk .


def Func ( arg_0 ) : arg_1 = [ arg_0 . _query_string ] if arg_0 . _no_content : arg_1 . append ( 'NOCONTENT' ) if arg_0 . _fields : arg_1 . append ( 'INFIELDS' ) arg_1 . append ( len ( arg_0 . _fields ) ) arg_1 += arg_0 . _fields if arg_0 . _verbatim : arg_1 . append ( 'VERBATIM' ) if arg_0 . _no_stopwords : arg_1 . append ( 'NOSTOPWORDS' ) if arg_0 . _filters : for arg_2 in arg_0 . _filters : assert isinstance ( arg_2 , Filter ) arg_1 += arg_2 . args if arg_0 . _with_payloads : arg_1 . append ( 'WITHPAYLOADS' ) if arg_0 . _ids : arg_1 . append ( 'INKEYS' ) arg_1 . append ( len ( arg_0 . _ids ) ) arg_1 += arg_0 . _ids if arg_0 . _slop >= 0 : arg_1 += [ 'SLOP' , arg_0 . _slop ] if arg_0 . _in_order : arg_1 . append ( 'INORDER' ) if arg_0 . _return_fields : arg_1 . append ( 'RETURN' ) arg_1 . append ( len ( arg_0 . _return_fields ) ) arg_1 += arg_0 . _return_fields if arg_0 . _sortby : assert isinstance ( arg_0 . _sortby , SortbyField ) arg_1 . append ( 'SORTBY' ) arg_1 += arg_0 . _sortby . args if arg_0 . _language : arg_1 += [ 'LANGUAGE' , arg_0 . _language ] arg_1 += arg_0 . _summarize_fields + arg_0 . _highlight_fields arg_1 += [ "LIMIT" , arg_0 . _offset , arg_0 . _num ] return arg_1

def Func(arg_0):
        """
        Format the redis arguments for this query and return them
        """

        arg_1 = [arg_0._query_string]

        if arg_0._no_content:
            arg_1.append('NOCONTENT')

        if arg_0._fields:

            arg_1.append('INFIELDS')
            arg_1.append(len(arg_0._fields))
            arg_1 += arg_0._fields

        if arg_0._verbatim:
            arg_1.append('VERBATIM')

        if arg_0._no_stopwords:
            arg_1.append('NOSTOPWORDS')

        if arg_0._filters:
            for arg_2 in arg_0._filters:
                assert isinstance(arg_2, Filter)
                arg_1 += arg_2.args

        if arg_0._with_payloads:
            arg_1.append('WITHPAYLOADS')

        if arg_0._ids:
            arg_1.append('INKEYS')
            arg_1.append(len(arg_0._ids))
            arg_1 += arg_0._ids

        if arg_0._slop >= 0:
            arg_1 += ['SLOP', arg_0._slop]

        if arg_0._in_order:
            arg_1.append('INORDER')

        if arg_0._return_fields:
            arg_1.append('RETURN')
            arg_1.append(len(arg_0._return_fields))
            arg_1 += arg_0._return_fields

        if arg_0._sortby:
            assert isinstance(arg_0._sortby, SortbyField)
            arg_1.append('SORTBY')
            arg_1 += arg_0._sortby.args

        if arg_0._language:
            arg_1 += ['LANGUAGE', arg_0._language]

        arg_1 += arg_0._summarize_fields + arg_0._highlight_fields
        arg_1 += ["LIMIT", arg_0._offset, arg_0._num]
        return arg_1


def Func(arg_0, arg_1=1):
        """Acquire a lock, blocking or non-blocking.

        When invoked without arguments: if this thread already owns the lock,
        increment the recursion level by one, and return immediately. Otherwise,
        if another thread owns the lock, block until the lock is unlocked. Once
        the lock is unlocked (not owned by any thread), then grab ownership, set
        the recursion level to one, and return. If more than one thread is
        blocked waiting until the lock is unlocked, only one at a time will be
        able to grab ownership of the lock. There is no return value in this
        case.

        When invoked with the blocking argument set to true, do the same thing
        as when called without arguments, and return true.

        When invoked with the blocking argument set to false, do not block. If a
        call without an argument would block, return false immediately;
        otherwise, do the same thing as when called without arguments, and
        return true.

        """
        arg_2 = _get_ident()
        if arg_0.__owner == arg_2:
            arg_0.__count = arg_0.__count + 1
            if __debug__:
                arg_0._note("%s.Func(%s): recursive success", arg_0, arg_1)
            return 1
        arg_4 = arg_0.__block.Func(arg_1)
        if arg_4:
            arg_0.__owner = arg_2
            arg_0.__count = 1
            if __debug__:
                arg_0._note("%s.Func(%s): initial success", arg_0, arg_1)
        else:
            if __debug__:
                arg_0._note("%s.Func(%s): failure", arg_0, arg_1)
        return arg_4

Acquire a lock blocking or non - blocking .


def
Func
(
)
:
arg_0
=
float
(
random
.
randint
(
0
,
MAX_DELAY_SELECTING
)
)
logger
.
debug
(
'Delay to enter in SELECTING %s.'
,
arg_0
)
logger
.
debug
(
'SELECTING will happen on %s'
,
future_dt_str
(
nowutc
(
)
,
arg_0
)
)
return
arg_0

def Func():
    """Generate the delay in seconds in which the DISCOVER will be sent.

    [:rfc:`2131#section-4.4.1`]::

        The client SHOULD wait a random time between one and ten seconds to
        desynchronize the use of DHCP at startup.

    """
    arg_0 = float(random.randint(0, MAX_DELAY_SELECTING))
    logger.debug('Delay to enter in SELECTING %s.', arg_0)
    logger.debug('SELECTING will happen on %s',
                 future_dt_str(nowutc(), arg_0))
    return arg_0

Generate the delay in seconds in which the DISCOVER will be sent .


def Func ( arg_0 , arg_1 = 0.1 ) : arg_2 = np . log10 ( np . min ( arg_0 ) * ( 1 - arg_1 ) ) arg_3 = np . log10 ( np . max ( arg_0 ) * ( 1 + arg_1 ) ) return np . floor ( arg_2 ) == np . floor ( arg_3 )

def Func(arg_0, arg_1=0.1):
    """
    Return true if range is approximately in same order of magnitude

    For example these sequences are in the same order of magnitude:

        - [1, 8, 5]     # [1, 10)
        - [35, 20, 80]  # [10 100)
        - [232, 730]    # [100, 1000)

    Parameters
    ----------
    x : array-like
         Values in base 10. Must be size 2 and
        ``rng[0] <= rng[1]``.
    delta : float
        Fuzz factor for approximation. It is multiplicative.
    """
    arg_2 = np.log10(np.min(arg_0)*(1-arg_1))
    arg_3 = np.log10(np.max(arg_0)*(1+arg_1))
    return np.floor(arg_2) == np.floor(arg_3)


Implement the check_unused_args in superclass.

def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : for arg_4 , arg_5 in arg_3 . items ( ) : if arg_4 in arg_1 : arg_0 . _used_kwargs . update ( { arg_4 : arg_5 } ) else : arg_0 . _unused_kwargs . update ( { arg_4 : arg_5 } )

def Func(arg_0, arg_1, arg_2, arg_3):
        """Implement the Func in superclass."""
        for arg_4, arg_5 in arg_3.items():
            if arg_4 in arg_1:
                arg_0._used_kwargs.update({arg_4: arg_5})
            else:
                arg_0._unused_kwargs.update({arg_4: arg_5})

Implement the check_unused_args in superclass .


def Func ( arg_0 ) : with open ( arg_0 . path ) as f : arg_1 = f . Func ( ) return arg_1

def Func(arg_0):
        """
        Read and return the contents of the file.
        """
        with open(arg_0.path) as f:
            arg_1 = f.Func()
        return arg_1

Read and return the contents of the file .


def Func ( arg_0 ) : for arg_1 , arg_2 , arg_3 in parse_tls_records ( arg_0 ) : if arg_1 != b'\x16' : continue for arg_4 , arg_5 in parse_handshake_messages ( arg_3 ) : if arg_4 == b'\x0d' : return True return False

def Func(arg_0):
    """
    Determines if a CertificateRequest message is sent from the server asking
    the client for a certificate

    :param server_handshake_bytes:
        A byte string of the handshake data received from the server

    :return:
        A boolean - if a client certificate request was found
    """

    for arg_1, arg_2, arg_3 in parse_tls_records(arg_0):
        if arg_1 != b'\x16':
            continue
        for arg_4, arg_5 in parse_handshake_messages(arg_3):
            if arg_4 == b'\x0d':
                return True
    return False


def Func ( arg_0 , arg_1 ) : return XMLElement ( lib . lsl_Func ( arg_0 . e , str . encode ( arg_1 ) ) )

def Func(arg_0, arg_1):
        """Append a child element with the specified name."""
        return XMLElement(lib.lsl_Func(arg_0.e, str.encode(arg_1)))

Append a child element with the specified name .


async def Func ( arg_0 , arg_1 , arg_2 ) : if arg_1 == 'v' : return await parse_vn_results ( arg_2 ) elif arg_1 == 'r' : return await parse_release_results ( arg_2 ) elif arg_1 == 'p' : return await parse_prod_staff_results ( arg_2 ) elif arg_1 == 's' : return await parse_prod_staff_results ( arg_2 ) elif arg_1 == 'c' : return await parse_character_results ( arg_2 ) elif arg_1 == 'g' : return await parse_tag_results ( arg_2 ) elif arg_1 == 'i' : return await parse_tag_results ( arg_2 ) elif arg_1 == 'u' : return await parse_user_results ( arg_2 )

async def Func(arg_0, arg_1, arg_2):
        """
        This is our parsing dispatcher

        :param stype: Search type category
        :param soup: The beautifulsoup object that contains the parsed html
        """
        if arg_1 == 'v':
            return await parse_vn_results(arg_2)
        elif arg_1 == 'r':
            return await parse_release_results(arg_2)
        elif arg_1 == 'p':
            return await parse_prod_staff_results(arg_2)
        elif arg_1 == 's':
            return await parse_prod_staff_results(arg_2)
        elif arg_1 == 'c':
            return await parse_character_results(arg_2)
        elif arg_1 == 'g':
            return await parse_tag_results(arg_2)
        elif arg_1 == 'i':
            return await parse_tag_results(arg_2)
        elif arg_1 == 'u':
            return await parse_user_results(arg_2)


def Func ( arg_0 ) : if not arg_0 . is_valid : return True arg_1 = ( arg_0 . has_quorum , arg_0 . has_quorum_possible , arg_0 . has_noquorum ) assert 1 == len ( [ arg_2 for arg_2 in arg_1 if arg_2 is not None ] ) return True

def Func(arg_0):
        "either invalid or one of quorum, noquorum, quorumpossible"
        if not arg_0.is_valid:
            return True
        arg_1 = (arg_0.has_quorum, arg_0.has_quorum_possible, arg_0.has_noquorum)
        assert 1 == len([arg_2 for arg_2 in arg_1 if arg_2 is not None])
        return True

either invalid or one of quorum noquorum quorumpossible


def Func():
    """Will be used to create the console script"""

    import optparse
    import arg_3
    import codecs
    import locale
    import six
    from .algorithm import get_display

    arg_0 = optparse.OptionParser()

    arg_0.add_option('-e', '--encoding',
                      dest='encoding',
                      default='utf-8',
                      type='string',
                      help='Text encoding (default: utf-8)')

    arg_0.add_option('-u', '--upper-is-rtl',
                      dest='upper_is_rtl',
                      default=False,
                      action='store_true',
                      help="Treat upper case chars as strong 'R' "
                      'for debugging (default: False).')

    arg_0.add_option('-d', '--debug',
                      dest='debug',
                      default=False,
                      action='store_true',
                      help="Output to stderr steps taken with the algorithm")

    arg_0.add_option('-b', '--base-dir',
                      dest='base_dir',
                      default=None,
                      type='string',
                      help="Override base direction [L|R]")

    arg_1, arg_2 = arg_0.parse_args()

    if arg_1.base_dir and arg_1.base_dir not in 'LR':
        arg_0.error('option -b can be L or R')

    # allow unicode in sys.stdout.write
    if six.PY2:
        arg_3.stdout = codecs.getwriter(locale.getpreferredencoding())(arg_3.stdout)

    if arg_2:
        arg_5 = arg_2
    else:
        arg_5 = arg_3.stdin

    for arg_6 in arg_5:
        arg_7 = get_display(arg_6, arg_1.encoding, arg_1.upper_is_rtl,
                              arg_1.base_dir, arg_1.debug)
        # adjust the encoding as unicode, to match the output encoding
        if not isinstance(arg_7, six.text_type):
            arg_7 = arg_7.decode(arg_1.encoding)

        six.print_(arg_7, end='')


def Func ( arg_0 ) : for arg_1 in arg_0 . dict . keys ( ) : for ( arg_2 , arg_3 ) in arg_0 . dict [ arg_1 ] . items ( ) : arg_0 . connect1 ( arg_2 , arg_1 , arg_3 )

def Func(arg_0):
        "Make a digraph into an undirected graph by adding symmetric edges."
        for arg_1 in arg_0.dict.keys():
            for (arg_2, arg_3) in arg_0.dict[arg_1].items():
                arg_0.connect1(arg_2, arg_1, arg_3)

Make a digraph into an undirected graph by adding symmetric edges .


def Func(arg_0, arg_1):
        """
        Load json or yaml data from file handle.

        Args:
            fh (file): File handle to Func from.

        Examlple:
            >>> with open('data.json', 'r') as json:
            >>>    jsdata = composite.Func(json)
            >>>
            >>> with open('data.yml', 'r') as yml:
            >>>    ymldata = composite.Func(yml)
        """
        arg_2 = arg_1.read()
        try:
            arg_3 = arg_0.from_json(arg_2)
        except:
            arg_3 = arg_0.from_yaml(arg_2)
        return arg_3

Load json or yaml data from file handle.

        Args:
            fh (file): File handle to load from.

        Examlple:
            >>> with open('data.json', 'r') as json:
            >>>    jsdata = composite.load(json)
            >>>
            >>> with open('data.yml', 'r') as yml:
            >>>    ymldata = composite.load(yml)

Load json or yaml data from file handle .


def Func ( arg_0 , arg_1 ) : arg_2 = { 'h' : ( - 1 , 0 ) , 'j' : ( 0 , 1 ) , 'k' : ( 0 , - 1 ) , 'l' : ( 1 , 0 ) , 'y' : ( - 1 , - 1 ) , 'u' : ( 1 , - 1 ) , 'n' : ( 1 , 1 ) , 'b' : ( - 1 , 1 ) , } if arg_1 in arg_2 : arg_3 = ( lens . player + arg_2 [ arg_1 ] ) ( arg_0 ) if not arg_3 . player . inside ( ) : return arg_0 , False return arg_3 , True elif arg_1 == '.' : return arg_0 , True elif arg_1 == 'q' : return arg_0 . end_game ( ) , False elif arg_1 == 't' : arg_0 = lens . player . set ( Vector . random ( ) ) ( arg_0 ) return arg_0 , True else : return arg_0 , False

def Func(arg_0, arg_1):
        '''Takes a single character string as input and alters the game
        state according to that input. Mostly, this means moving the
        player around. Returns a new game state and boolean indicating
        whether the input had an effect on the state.'''

        arg_2 = {
            'h': (-1, 0),
            'j': (0, 1),
            'k': (0, -1),
            'l': (1, 0),
            'y': (-1, -1),
            'u': (1, -1),
            'n': (1, 1),
            'b': (-1, 1),
        }

        if arg_1 in arg_2:
            arg_3 = (lens.player + arg_2[arg_1])(arg_0)
            if not arg_3.player.inside():
                return arg_0, False
            return arg_3, True
        elif arg_1 == '.':
            return arg_0, True
        elif arg_1 == 'q':
            return arg_0.end_game(), False
        elif arg_1 == 't':
            arg_0 = lens.player.set(Vector.random())(arg_0)
            return arg_0, True
        else:
            return arg_0, False

Takes a single character string as input and alters the game state according to that input . Mostly this means moving the player around . Returns a new game state and boolean indicating whether the input had an effect on the state .


def Func(arg_0, arg_1, arg_2):
        """Setup the noise-map from an root-mean square standard deviation map, which is a form of noise-map that \
        comes via HST image-reduction and the software package MultiDrizzle.

        The variance in each pixel is computed as:

        Variance = 1.0 / inverse_std_map.

        The weight map may contain zeros, in which cause the variances are converted to large values to omit them from \
        the analysis.

        Parameters
        -----------
        pixel_scale : float
            The size of each pixel in arc seconds.
        inverse_noise_map : ndarray
            The inverse noise_map value of each pixel which is converted to a variance.
        """
        arg_3 = 1.0 / arg_2
        return NoiseMap(array=arg_3, arg_1=arg_1)

Setup the noise - map from an root - mean square standard deviation map which is a form of noise - map that \ comes via HST image - reduction and the software package MultiDrizzle .


(in_fname, out_fname, max_width, max_height)

def Func(arg_0, arg_1, arg_2, arg_3):
    """Scales an image with the same aspect ratio centered in an
       image with a given max_width and max_height
       if in_fname == out_fname the image can only be scaled down
    """
    # local import to avoid testing dependency on PIL:
    try:
        from PIL import Image
    except ImportError:
        import Image
    arg_4 = Image.open(arg_0)
    arg_5, arg_6 = arg_4.size
    arg_7 = arg_2 / float(arg_5)
    arg_8 = arg_3 / float(arg_6)

    if arg_6 * arg_7 <= arg_3:
        arg_9 = arg_7
    else:
        arg_9 = arg_8

    if arg_9 >= 1.0 and arg_0 == arg_1:
        return

    arg_10 = int(round(arg_9 * arg_5))
    arg_11 = int(round(arg_9 * arg_6))

    # resize the image
    arg_4.thumbnail((arg_10, arg_11), Image.ANTIALIAS)

    # insert centered
    arg_12 = Image.new('RGB', (arg_2, arg_3), (255, 255, 255))
    arg_13 = ((arg_2 - arg_10) // 2, (arg_3 - arg_11) // 2)
    arg_12.paste(arg_4, arg_13)

    arg_12.save(arg_1)
    # Use optipng to perform lossless compression on the resized image if
    # software is installed
    if os.environ.get('SKLEARN_DOC_OPTIPNG', False):
        try:
            subprocess.call(["optipng", "-quiet", "-o", "9", arg_1])
        except Exception:
            warnings.warn('Install optipng to reduce the size of the \
                          generated images')


def
Func
(
arg_0
,
arg_1
,
**
arg_2
)
:
arg_3
,
arg_4
=
_import_bibdoc
(
)
arg_5
=
[
]
arg_6
=
datetime
.
datetime
.
strptime
(
arg_1
,
'%Y-%m-%d %H:%M:%S'
)
for
arg_7
in
arg_3
(
arg_0
)
.
list_bibdocs
(
)
:
for
arg_8
in
arg_7
.
list_versions
(
)
:
arg_9
=
arg_7
.
list_version_files
(
arg_8
)
for
arg_10
in
arg_9
:
if
arg_10
.
is_icon
(
)
or
arg_10
.
md
<
arg_6
:
continue
arg_5
.
append
(
dict
(
bibdocid
=
arg_10
.
get_bibdocid
(
)
,
checksum
=
arg_10
.
get_checksum
(
)
,
comment
=
arg_10
.
get_comment
(
)
,
copyright
=
(
arg_10
.
get_copyright
(
)
if
hasattr
(
arg_10
,
'get_copyright'
)
else
)
,
creation_date
=
datetime_toutc
(
arg_10
.
cd
)
.
isoformat
(
)
,
description
=
arg_10
.
get_description
(
)
,
encoding
=
arg_10
.
encoding
,
etag
=
arg_10
.
etag
,
flags
=
arg_10
.
flags
,
format
=
arg_10
.
get_format
(
)
,
full_name
=
arg_10
.
get_full_name
(
)
,
full_path
=
arg_10
.
get_full_path
(
)
,
hidden
=
arg_10
.
hidden
,
license
=
(
arg_10
.
get_license
(
)
if
hasattr
(
arg_10
,
'get_license'
)
else
)
,
modification_date
=
datetime_toutc
(
arg_10
.
md
)
.
isoformat
(
)
,
name
=
arg_10
.
get_name
(
)
,
mime
=
arg_10
.
mime
,
path
=
arg_10
.
get_path
(
)
,
arg_0
=
arg_10
.
get_recid
(
)
,
recids_doctype
=
arg_10
.
recids_doctypes
,
size
=
arg_10
.
get_size
(
)
,
status
=
arg_10
.
get_status
(
)
,
subformat
=
arg_10
.
get_subformat
(
)
,
superformat
=
arg_10
.
get_superformat
(
)
,
type
=
arg_10
.
get_type
(
)
,
url
=
arg_10
.
get_url
(
)
,
arg_8
=
arg_10
.
get_version
(
)
,
)
)
return
arg_5

def Func(arg_0, arg_1, **arg_2):
    """Dump all BibDoc metadata.

    :param docid: BibDoc ID
    :param from_date: Dump only BibDoc revisions newer than this date.

    :returns: List of version of the BibDoc formatted as a dict
    """
    arg_3, arg_4 = _import_bibdoc()

    arg_5 = []

    arg_6 = datetime.datetime.strptime(arg_1, '%Y-%m-%d %H:%M:%S')
    for arg_7 in arg_3(arg_0).list_bibdocs():
        for arg_8 in arg_7.list_versions():
            arg_9 = arg_7.list_version_files(arg_8)
            for arg_10 in arg_9:
                if arg_10.is_icon() or arg_10.md < arg_6:
                    # Don't care about icons
                    # Don't care about files not modified since from_date
                    continue
                arg_5.append(dict(
                    bibdocid=arg_10.get_bibdocid(),
                    checksum=arg_10.get_checksum(),
                    comment=arg_10.get_comment(),
                    copyright=(
                        arg_10.get_copyright() if hasattr(arg_10, 'get_copyright')
                        else None),
                    creation_date=datetime_toutc(arg_10.cd).isoformat(),
                    description=arg_10.get_description(),
                    encoding=arg_10.encoding,
                    etag=arg_10.etag,
                    flags=arg_10.flags,
                    format=arg_10.get_format(),
                    full_name=arg_10.get_full_name(),
                    full_path=arg_10.get_full_path(),
                    hidden=arg_10.hidden,
                    license=(
                        arg_10.get_license()if hasattr(arg_10, 'get_license') else None),
                    modification_date=datetime_toutc(arg_10.md).isoformat(),
                    name=arg_10.get_name(),
                    mime=arg_10.mime,
                    path=arg_10.get_path(),
                    arg_0=arg_10.get_recid(),
                    recids_doctype=arg_10.recids_doctypes,
                    size=arg_10.get_size(),
                    status=arg_10.get_status(),
                    subformat=arg_10.get_subformat(),
                    superformat=arg_10.get_superformat(),
                    type=arg_10.get_type(),
                    url=arg_10.get_url(),
                    arg_8=arg_10.get_version(),
                ))

    return arg_5


def
Func
(
arg_0
,
arg_1
=
arg_2
)
:
arg_3
=
{
}
try
:
arg_0
=
arg_0
.
Func
(
'utf-8'
)
except
AttributeError
:
pass
arg_4
=
arg_0
.
split
(
":"
,
3
)
arg_5
=
arg_4
[
0
]
arg_6
=
arg_4
[
1
]
arg_7
=
arg_4
[
2
]
arg_8
=
''
if
arg_6
!=
''
:
if
"+"
in
arg_6
:
arg_6
=
arg_6
.
split
(
'+'
)
[
0
]
arg_3
[
'id'
]
=
int
(
arg_6
)
arg_3
[
'ack'
]
=
'data'
else
:
arg_3
[
'id'
]
=
int
(
arg_6
)
arg_3
[
'ack'
]
=
True
arg_9
=
int
(
arg_5
)
if
arg_9
in
MSG_VALUES
:
arg_3
[
'type'
]
=
MSG_VALUES
[
int
(
arg_5
)
]
else
:
raise
Exception
(
"Unknown message type: %s"
%
arg_5
)
arg_3
[
'endpoint'
]
=
arg_7
if
len
(
arg_4
)
>
3
:
arg_8
=
arg_4
[
3
]
if
arg_5
==
"0"
:
pass
elif
arg_5
==
"1"
:
arg_3
[
'qs'
]
=
arg_8
elif
arg_5
==
"2"
:
pass
elif
arg_5
==
"3"
:
arg_3
[
'data'
]
=
arg_8
elif
arg_5
==
"4"
:
arg_3
[
'data'
]
=
arg_1
(
arg_8
)
elif
arg_5
==
"5"
:
try
:
arg_8
=
arg_1
(
arg_8
)
except
ValueError
:
print
(
"Invalid JSON event message"
,
arg_8
)
arg_3
[
'args'
]
=
[
]
else
:
arg_3
[
'name'
]
=
arg_8
.
pop
(
'name'
)
if
'args'
in
arg_8
:
arg_3
[
'args'
]
=
arg_8
[
'args'
]
else
:
arg_3
[
'args'
]
=
[
]
elif
arg_5
==
"6"
:
if
'+'
in
arg_8
:
arg_10
,
arg_8
=
arg_8
.
split
(
'+'
)
arg_3
[
'ackId'
]
=
int
(
arg_10
)
arg_3
[
'args'
]
=
arg_1
(
arg_8
)
else
:
arg_3
[
'ackId'
]
=
int
(
arg_8
)
arg_3
[
'args'
]
=
[
]
elif
arg_5
==
"7"
:
if
'+'
in
arg_8
:
arg_11
,
arg_12
=
arg_8
.
split
(
'+'
)
arg_3
[
'reason'
]
=
REASONS_VALUES
[
int
(
arg_11
)
]
arg_3
[
'advice'
]
=
ADVICES_VALUES
[
int
(
arg_12
)
]
else
:
arg_3
[
'advice'
]
=
''
if
arg_8
!=
''
:
arg_3
[
'reason'
]
=
REASONS_VALUES
[
int
(
arg_8
)
]
else
:
arg_3
[
'reason'
]
=
''
elif
arg_5
==
"8"
:
pass
return
arg_3

def Func(arg_0, arg_1=arg_2):
    """
    Decode a rawstr packet arriving from the socket into a dict.
    """
    arg_3 = {}
    try:
        # Handle decoding in Python<3.
        arg_0 = arg_0.Func('utf-8')
    except AttributeError:
        pass
    arg_4 = arg_0.split(":", 3)
    arg_5 = arg_4[0]
    arg_6 = arg_4[1]
    arg_7 = arg_4[2]

    arg_8 = ''

    if arg_6 != '':
        if "+" in arg_6:
            arg_6 = arg_6.split('+')[0]
            arg_3['id'] = int(arg_6)
            arg_3['ack'] = 'data'
        else:
            arg_3['id'] = int(arg_6)
            arg_3['ack'] = True

    # common to every message
    arg_9 = int(arg_5)
    if arg_9 in MSG_VALUES:
        arg_3['type'] = MSG_VALUES[int(arg_5)]
    else:
        raise Exception("Unknown message type: %s" % arg_5)

    arg_3['endpoint'] = arg_7

    if len(arg_4) > 3:
        arg_8 = arg_4[3]

    if arg_5 == "0":  # disconnect
        pass

    elif arg_5 == "1":  # connect
        arg_3['qs'] = arg_8

    elif arg_5 == "2":  # heartbeat
        pass

    elif arg_5 == "3":  # message
        arg_3['data'] = arg_8

    elif arg_5 == "4":  # json msg
        arg_3['data'] = arg_1(arg_8)

    elif arg_5 == "5":  # event
        try:
            arg_8 = arg_1(arg_8)
        except ValueError:
            print("Invalid JSON event message", arg_8)
            arg_3['args'] = []
        else:
            arg_3['name'] = arg_8.pop('name')
            if 'args' in arg_8:
                arg_3['args'] = arg_8['args']
            else:
                arg_3['args'] = []

    elif arg_5 == "6":  # ack
        if '+' in arg_8:
            arg_10, arg_8 = arg_8.split('+')
            arg_3['ackId'] = int(arg_10)
            arg_3['args'] = arg_1(arg_8)
        else:
            arg_3['ackId'] = int(arg_8)
            arg_3['args'] = []

    elif arg_5 == "7":  # error
        if '+' in arg_8:
            arg_11, arg_12 = arg_8.split('+')
            arg_3['reason'] = REASONS_VALUES[int(arg_11)]
            arg_3['advice'] = ADVICES_VALUES[int(arg_12)]
        else:
            arg_3['advice'] = ''
            if arg_8 != '':
                arg_3['reason'] = REASONS_VALUES[int(arg_8)]
            else:
                arg_3['reason'] = ''

    elif arg_5 == "8":  # noop
        pass

    return arg_3

Decode a rawstr packet arriving from the socket into a dict .


def Func ( ) : arg_0 = [ int ( x ) for x in os . listdir ( '/proc' ) if x . isdigit ( ) ] return arg_0

def Func():
    """Returns a list of PIDs currently running on the system."""
    arg_0 = [int(x) for x in os.listdir('/proc') if x.isdigit()]
    return arg_0

Returns a list of PIDs currently running on the system .


def Func ( arg_0 , arg_1 ) : arg_2 = getattr ( arg_0 , arg_1 ) arg_3 = getattr ( getattr ( arg_2 , '__class__' , '' ) , '__name__' , '' ) if arg_3 in ( 'ManyRelatedManager' , 'RelatedManager' , 'EmptyManager' ) : return arg_3 if callable ( arg_2 ) : return 'routine' return arg_2

def Func(arg_0, arg_1):
    """
    Given a variable and one of its attributes that are available inside of
    a template, return its 'method' if it is a callable, its class name if it
    is a model manager, otherwise return its value
    """
    arg_2 = getattr(arg_0, arg_1)
    # Rename common Django class names
    arg_3 = getattr(getattr(arg_2, '__class__', ''), '__name__', '')
    if arg_3 in ('ManyRelatedManager', 'RelatedManager', 'EmptyManager'):
        return arg_3
    if callable(arg_2):
        return 'routine'
    return arg_2

Given a variable and one of its attributes that are available inside of a template return its method if it is a callable its class name if it is a model manager otherwise return its value


(mcs, klass, cls_fields, inherited_fields, dict_cls)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """Updates declared fields with fields converted from the SQLAlchemy model
        passed as the `model` class Meta option.
        """
        arg_5 = arg_1.opts
        arg_6 = arg_5.model_converter
        arg_7 = arg_6(schema_cls=arg_1)
        arg_8 = super(SchemaMeta, arg_0).Func(
            arg_1, arg_2, arg_3, arg_4
        )
        arg_9 = arg_0.get_fields(arg_7, arg_5, arg_8, arg_4)
        arg_9.update(arg_8)
        return arg_9

Updates declared fields with fields converted from the SQLAlchemy model passed as the model class Meta option .


(data, samples=None, dims=(None,None), canvas=(None,None),
              xmax=50, log=False, outprefix=None, use_maxdepth=False)

def Func ( arg_0 , arg_1 = None , arg_2 = ( None , None ) , arg_3 = ( None , None ) , arg_4 = 50 , arg_5 = False , arg_6 = None , arg_7 = False ) : if not arg_1 : arg_1 = arg_0 . samples . keys ( ) arg_1 . sort ( ) arg_8 = OrderedDict ( [ ( i , arg_0 . samples [ i ] ) for i in arg_1 ] ) if any ( arg_2 ) : print ( "userdims" ) else : if len ( arg_8 ) <= 4 : arg_2 = ( 1 , len ( arg_8 ) ) else : arg_2 = ( len ( arg_8 ) / 4 , 4 ) if any ( arg_3 ) : print ( "usercanvas" ) arg_3 = toyplot . Canvas ( width = arg_3 [ 0 ] , height = arg_3 [ 1 ] ) else : arg_3 = toyplot . Canvas ( width = 200 * arg_2 [ 1 ] , height = 150 * arg_2 [ 0 ] ) for arg_9 , arg_10 in enumerate ( arg_8 ) : arg_11 = arg_8 [ arg_10 ] . depths arg_11 = arg_11 [ arg_11 >= arg_0 . paramsdict [ "mindepth_statistical" ] ] if arg_7 : arg_11 = { i : j for ( i , j ) in arg_11 if i < arg_0 . paramsdict [ "maxdepth" ] } arg_12 = np . histogram ( arg_11 , range ( 50 ) ) arg_11 = arg_8 [ arg_10 ] . depths arg_11 = arg_11 [ arg_11 < arg_0 . paramsdict [ "mindepth_statistical" ] ] arg_11 = arg_11 [ arg_11 >= arg_0 . paramsdict [ "mindepth_majrule" ] ] if arg_7 : arg_11 = arg_11 [ arg_11 < arg_0 . paramsdict [ "maxdepth" ] ] arg_13 = np . histogram ( arg_11 , range ( 50 ) ) arg_14 = arg_0 . samples [ arg_10 ] . depths arg_14 = arg_14 [ arg_14 < arg_0 . paramsdict [ "mindepth_majrule" ] ] if arg_7 : arg_14 = arg_14 [ arg_14 < arg_0 . paramsdict [ "maxdepth" ] ] arg_15 = np . histogram ( arg_14 , range ( 50 ) ) arg_16 = arg_3 . cartesian ( grid = ( arg_2 [ 0 ] , arg_2 [ 1 ] , arg_9 ) , gutter = 25 ) arg_16 . x . domain . xmax = arg_4 arg_16 . label . text = arg_10 if arg_5 : arg_16 . y . scale = "log" arg_16 . bars ( arg_12 ) arg_16 . bars ( arg_15 ) arg_16 . bars ( arg_13 ) if arg_6 : toyplot . html . render ( arg_3 , fobj = arg_6 + ".html" ) toyplot . svg . render ( arg_3 , fobj = arg_6 + ".svg" )

def Func(arg_0, arg_1=None, arg_2=(None,None), arg_3=(None,None),
              arg_4=50, arg_5=False, arg_6=None, arg_7=False):
    """ plots histogram of coverages across clusters"""

    ## select samples to be plotted, requires depths info
    if not arg_1:
        arg_1 = arg_0.samples.keys()
        arg_1.sort()
    arg_8 = OrderedDict([(i, arg_0.samples[i]) for i in arg_1])

    ## get canvas dimensions based on n-samples
    if any(arg_2):
        ## user-supplied dimensions (...)
        print("userdims")
    else:
        if len(arg_8) <= 4:
            ## set dimension to N samples
            arg_2 = (1, len(arg_8))
        else:
            arg_2 = (len(arg_8)/4, 4)

    ## create canvas
    if any(arg_3):
        print("usercanvas")
        arg_3 = toyplot.Canvas(width=arg_3[0], height=arg_3[1])
    else:
        arg_3 = toyplot.Canvas(width=200*arg_2[1], height=150*arg_2[0])

    ## get all of the data arrays
    for arg_9, arg_10 in enumerate(arg_8):
        ## statistical called bins
        arg_11 = arg_8[arg_10].depths
        arg_11 = arg_11[arg_11 >= arg_0.paramsdict["mindepth_statistical"]]
        if arg_7:
            arg_11 = {i:j for (i, j) in arg_11 if \
                                        i < arg_0.paramsdict["maxdepth"]}
        arg_12 = np.histogram(arg_11, range(50))

        ## majrule called bins
        arg_11 = arg_8[arg_10].depths
        arg_11 = arg_11[arg_11 < arg_0.paramsdict["mindepth_statistical"]]
        arg_11 = arg_11[arg_11 >= arg_0.paramsdict["mindepth_majrule"]]
        if arg_7:
            arg_11 = arg_11[arg_11 < arg_0.paramsdict["maxdepth"]]
        arg_13 = np.histogram(arg_11, range(50))

        ## excluded bins
        arg_14 = arg_0.samples[arg_10].depths
        arg_14 = arg_14[arg_14 < arg_0.paramsdict["mindepth_majrule"]]
        if arg_7:
            arg_14 = arg_14[arg_14 < arg_0.paramsdict["maxdepth"]]
        arg_15 = np.histogram(arg_14, range(50))

        ## fill in each panel of canvas with a sample
        arg_16 = arg_3.cartesian(grid=(arg_2[0], arg_2[1], arg_9), gutter=25)
        arg_16.x.domain.xmax = arg_4
        arg_16.label.text = arg_10
        if arg_5:
            arg_16.y.scale = "log"

        # heights = np.column_stack((sdat,mdat,edat))
        arg_16.bars(arg_12)
        arg_16.bars(arg_15)
        arg_16.bars(arg_13)

    ## return objects to be saved...
    if arg_6:
        toyplot.html.render(arg_3, fobj=arg_6+".html")
        toyplot.svg.render(arg_3, fobj=arg_6+".svg")


(self, query, target_dir, append=False, file_type="text",
                     split_by=None, direct=None, driver=None, extra_import_options=None)

def Func(arg_0, arg_1, arg_2, arg_3=False, arg_4="text",
                     arg_5=None, arg_6=None, arg_7=None, arg_8=None):
        """
        Imports a specific query from the rdbms to hdfs

        :param query: Free format query to run
        :param target_dir: HDFS destination dir
        :param append: Append data to an existing dataset in HDFS
        :param file_type: "avro", "sequence", "text" or "parquet"
            Imports data to hdfs into the specified format. Defaults to text.
        :param split_by: Column of the table used to split work units
        :param direct: Use direct import fast path
        :param driver: Manually specify JDBC driver class to use
        :param extra_import_options: Extra import options to pass as dict.
            If a key doesn't have a value, just pass an empty string to it.
            Don't include prefix of -- for sqoop options.
        """
        arg_9 = arg_0._import_cmd(arg_2, arg_3, arg_4, arg_5, arg_6,
                               arg_7, arg_8)
        arg_9 += ["--query", arg_1]

        arg_0.Popen(arg_9)


(self, account_id, term_id=None,
                                        params={})

return self.create_report(ReportType.SIS_EXPORT, account_id, term_id,
                                  params)

def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = { } ) : arg_3 [ "courses" ] = True return arg_0 . create_report ( ReportType . SIS_EXPORT , arg_1 , arg_2 , arg_3 )

def Func(arg_0, arg_1, arg_2=None,
                                        arg_3={}):
        """
        Convenience method for create_report, for creating a course sis export
        report.
        """
        arg_3["courses"] = True
        return arg_0.create_report(ReportType.SIS_EXPORT, arg_1, arg_2,
                                  arg_3)

Convenience method for create_report for creating a course sis export report .


def Func ( arg_0 , arg_1 = None , arg_2 = None ) : arg_3 = [ ] for arg_4 , arg_5 in enumerate ( arg_0 . pin_function_maps ) : if ( arg_1 == None or ( arg_5 . pin_num == arg_1 and ( arg_2 == None or arg_5 . direction == arg_2 ) ) ) : arg_3 . append ( arg_4 ) for arg_4 in reversed ( arg_3 ) : del arg_0 . pin_function_maps [ arg_4 ]

def Func(arg_0, arg_1=None, arg_2=None):
        """De-registers callback functions

        :param pin_num: The pin number. If None then all functions are de-registered
        :type pin_num: int
        :param direction: The event direction. If None then all functions for the
                          given pin are de-registered
        :type direction:int
        """
        arg_3 = []
        for arg_4, arg_5 in enumerate(arg_0.pin_function_maps):
            if ( arg_1 == None
                 or ( arg_5.pin_num == arg_1
                      and ( arg_2 == None
                            or arg_5.direction == arg_2 ) ) ):
                arg_3.append(arg_4)
        for arg_4 in reversed(arg_3):
            del arg_0.pin_function_maps[arg_4]


def Func ( arg_0 , arg_1 ) : requests . post ( arg_0 . url + 'scans/{}/launch' . format ( arg_1 ) , verify = False , headers = arg_0 . headers )

def Func(arg_0, arg_1):
        """
            Starts the scan identified by the scan_id.s
        """
        requests.post(arg_0.url + 'scans/{}/launch'.format(arg_1), verify=False, headers=arg_0.headers)

Starts the scan identified by the scan_id . s


(dataset, masks, method='ERF', threshold=0.08,
                     remove_overlap=True, regularization='scale',
                     output='summary', studies=None, features=None,
                     class_weight='auto', classifier=None,
                     cross_val='4-Fold', param_grid=None, scoring='accuracy')

return classify(X, y, method, classifier, output, cross_val,
                    class_weight, scoring=scoring, param_grid=param_grid)

def Func(arg_0, arg_1, arg_2='ERF', arg_3=0.08,
                     arg_4=True, arg_5='scale',
                     arg_6='summary', arg_7=None, arg_8=None,
                     arg_9='auto', arg_10=None,
                     arg_11='4-Fold', arg_12=None, arg_13='accuracy'):
    """ Perform classification on specified regions

        Given a set of masks, this function retrieves studies associated with
        each mask at the specified threshold, optionally removes overlap and
        filters by studies and features. Then it trains an algorithm to
        classify studies based on features and tests performance.

        Args:
            dataset: a Neurosynth dataset
            maks: a list of paths to Nifti masks
            method: a string indicating which method to used.
                'SVM': Support Vector Classifier with rbf kernel
                'ERF': Extremely Randomized Forest classifier
                'Dummy': A dummy classifier using stratified classes as
                    predictor
            threshold: percentage of voxels active within the mask for study
                to be included
            remove_overlap: A boolean indicating if studies studies that
                appear in more than one mask should be excluded
            regularization: A string indicating type of regularization to use.
                If None, performs no regularization.
                'scale': Unit scale without demeaning
            output: A string indicating output type
                'summary': Dictionary with summary statistics including score
                    and n
                'summary_clf': Same as above but also includes classifier
                'clf': Only returns classifier
                Warning: using cv without grid will return an untrained
                classifier
            studies: An optional list of study names used to constrain the set
                used in classification. If None, will use all features in the
                dataset.
            features: An optional list of feature names used to constrain the
                set used in classification. If None, will use all features in
                the dataset.
            class_weight: Parameter to pass to classifier determining how to
                weight classes
            classifier: An optional sci-kit learn classifier to use instead of
                pre-set up classifiers set up using 'method'
            cross_val: A string indicating type of cross validation to use.
                Can also pass a scikit_classifier
            param_grid: A dictionary indicating which parameters to optimize
                using GridSearchCV. If None, no GridSearch will be used

        Returns:
            A tuple (X, y) of np arrays.
            X is a feature by studies matrix and y is a vector of class labels
    """

    (arg_14, arg_15) = get_studies_by_regions(arg_0, arg_1, arg_3, arg_4,
                                    arg_7, arg_8,
                                    arg_5=arg_5)

    return classify(arg_14, arg_15, arg_2, arg_10, arg_6, arg_11,
                    arg_9, arg_13=arg_13, arg_12=arg_12)


(self, topics, pin, skip_validation=False)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
False
)
:
if
not
arg_0
.
api_key
:
raise
ValueError
(
"You need to specify an api_key."
)
if
not
arg_3
:
validate_pin
(
arg_2
)
arg_4
=
_request
(
'PUT'
,
url
=
arg_0
.
url_v1
(
'/shared/pins/'
+
arg_2
[
'id'
]
)
,
user_agent
=
arg_0
.
user_agent
,
api_key
=
arg_0
.
api_key
,
topics_list
=
arg_1
,
json
=
arg_2
,
)
_raise_for_status
(
arg_4
)

def Func(arg_0, arg_1, arg_2, arg_3=False):
        """
        Send a shared pin for the given topics.

        :param list topics: The list of topics.
        :param dict pin: The pin.
        :param bool skip_validation: Whether to skip the validation.
        :raises pypebbleapi.schemas.DocumentError: If the validation process failed.
        :raises `requests.exceptions.HTTPError`: If an HTTP error occurred.
        """
        if not arg_0.api_key:
            raise ValueError("You need to specify an api_key.")
        if not arg_3:
            validate_pin(arg_2)

        arg_4 = _request('PUT',
            url=arg_0.url_v1('/shared/pins/' + arg_2['id']),
            user_agent=arg_0.user_agent,
            api_key=arg_0.api_key,
            topics_list=arg_1,
            json=arg_2,
        )
        _raise_for_status(arg_4)

Send a shared pin for the given topics .


def
Func
(
arg_0
,
arg_1
=
)
:
if
arg_0
not
in
arg_2
.
modules
:
arg_2
.
modules
[
arg_0
]
=
imp
.
new_module
(
arg_0
)
arg_4
=
arg_2
.
modules
[
arg_0
]
if
arg_1
:
print
(
'executing code for %s: %s'
%
(
arg_0
,
arg_1
)
)
exec
(
arg_1
in
arg_4
.
__dict__
)
exec
(
"from %s import %s"
%
(
arg_0
,
'*'
)
)
return
arg_4

def Func(arg_0, arg_1=None):
    """
    Dynamically creates a module with the given name.
    """

    if arg_0 not in arg_2.modules:
        arg_2.modules[arg_0] = imp.new_module(arg_0)

    arg_4 = arg_2.modules[arg_0]

    if arg_1:
        print('executing code for %s: %s' % (arg_0, arg_1))
        exec(arg_1 in arg_4.__dict__) # pylint: disable=exec-used
        exec("from %s import %s" % (arg_0, '*')) # pylint: disable=exec-used

    return arg_4

Dynamically creates a module with the given name .


def Func ( arg_0 , arg_1 = None ) : if arg_1 is None : arg_1 = [ '"' ] arg_2 = "" while True : arg_3 = arg_0 . raw_text [ arg_0 . index ] arg_0 . index += 1 logging . debug ( "%s" , fmt_cyan ( arg_3 ) ) if arg_3 == "\\" : arg_4 = arg_0 . raw_text [ arg_0 . index ] arg_0 . index += 1 arg_2 += arg_4 elif arg_3 == '"' : break else : arg_2 += arg_3 return arg_2

def Func(arg_0, arg_1=None):
        """characters that gdb escapes that should not be
        escaped by this parser
        """

        if arg_1 is None:
            arg_1 = ['"']

        arg_2 = ""
        while True:
            arg_3 = arg_0.raw_text[arg_0.index]
            arg_0.index += 1
            logging.debug("%s", fmt_cyan(arg_3))

            if arg_3 == "\\":
                # We are on a backslash and there is another character after the backslash
                # to parse. Handle this case specially since gdb escaped it for us

                # Get the next char that is being escaped
                arg_4 = arg_0.raw_text[arg_0.index]
                arg_0.index += 1
                # only store the escaped character in the buffer; don't store the backslash
                # (don't leave it escaped)
                arg_2 += arg_4

            elif arg_3 == '"':
                # Quote is closed. Exit (and don't include the end quote).
                break

            else:
                # capture this character, and keep capturing
                arg_2 += arg_3
        return arg_2


def Func ( arg_0 , arg_1 ) : arg_2 = arg_1 [ [ 'symbol' , 'amount' , 'price' ] ] arg_3 = arg_0 . drop ( 'cash' , axis = 1 ) . iloc [ - 1 ] arg_4 = arg_3 . replace ( 0 , np . nan ) . dropna ( ) arg_5 = arg_4 . name + pd . Timedelta ( seconds = 1 ) for arg_6 , arg_7 in arg_4 . iteritems ( ) : arg_8 = arg_1 [ arg_1 . symbol == arg_6 ] arg_9 = arg_8 . amount . sum ( ) arg_10 = arg_7 / arg_9 arg_11 = { 'symbol' : arg_6 , 'amount' : - arg_9 , 'price' : arg_10 } arg_11 = pd . DataFrame ( arg_11 , index = [ arg_5 ] ) arg_2 = arg_2 . append ( arg_11 ) arg_2 = arg_2 [ arg_2 . amount != 0 ] return arg_2

def Func(arg_0, arg_1):
    """
    Appends transactions that close out all positions at the end of
    the timespan covered by positions data. Utilizes pricing information
    in the positions DataFrame to determine closing price.

    Parameters
    ----------
    positions : pd.DataFrame
        The positions that the strategy takes over time.
    transactions : pd.DataFrame
        Prices and amounts of executed round_trips. One row per trade.
        - See full explanation in tears.create_full_tear_sheet

    Returns
    -------
    closed_txns : pd.DataFrame
        Transactions with closing transactions appended.
    """

    arg_2 = arg_1[['symbol', 'amount', 'price']]

    arg_3 = arg_0.drop('cash', axis=1).iloc[-1]
    arg_4 = arg_3.replace(0, np.nan).dropna()
    # Add closing round_trips one second after the close to be sure
    # they don't conflict with other round_trips executed at that time.
    arg_5 = arg_4.name + pd.Timedelta(seconds=1)

    for arg_6, arg_7 in arg_4.iteritems():
        arg_8 = arg_1[arg_1.symbol == arg_6]

        arg_9 = arg_8.amount.sum()

        arg_10 = arg_7 / arg_9
        arg_11 = {'symbol': arg_6,
                       'amount': -arg_9,
                       'price': arg_10}

        arg_11 = pd.DataFrame(arg_11, index=[arg_5])
        arg_2 = arg_2.append(arg_11)

    arg_2 = arg_2[arg_2.amount != 0]

    return arg_2

Appends transactions that close out all positions at the end of the timespan covered by positions data . Utilizes pricing information in the positions DataFrame to determine closing price .


def Func ( arg_0 , arg_1 ) : arg_1 . write ( Operators . ITEBV ( arg_1 . size , arg_0 . CF , 1 , 0 ) )

def Func(arg_0, arg_1):
        """
        Sets byte if below.

        :param cpu: current CPU.
        :param dest: destination operand.
        """
        arg_1.write(Operators.ITEBV(arg_1.size, arg_0.CF, 1, 0))


def
Func
(
arg_0
)
:
arg_1
=
models
.
PasswordResetToken
.
objects
.
get
(
key
=
arg_0
.
validated_data
[
"key"
]
)
arg_1
.
email
.
user
.
set_password
(
arg_0
.
validated_data
[
"password"
]
)
arg_1
.
email
.
user
.
Func
(
)
logger
.
info
(
"Reset password for %s"
,
arg_1
.
email
.
user
)
arg_1
.
delete
(
)

def Func(arg_0):
        """
        Reset the user's password if the provided information is valid.
        """
        arg_1 = models.PasswordResetToken.objects.get(
            key=arg_0.validated_data["key"]
        )

        arg_1.email.user.set_password(arg_0.validated_data["password"])
        arg_1.email.user.Func()

        logger.info("Reset password for %s", arg_1.email.user)

        arg_1.delete()

Reset the user s password if the provided information is valid .


def Func(arg_0, arg_1):
  """Return the operation's array of actions."""
  arg_2 = get_actions(arg_0)
  if arg_2 and 1 <= arg_1 < len(arg_2):
    return arg_2[arg_1 - 1]

Return the operation s array of actions .


(chain, sender, contract_address, value=0)

def Func(arg_0, arg_1, arg_2, arg_3=0):
    "create an object which acts as a proxy for the contract on the chain"
    arg_4 = registry[arg_2].im_self
    assert issubclass(arg_4, NativeABIContract)

    def mk_method(arg_5):
        def arg_11(arg_6, *arg_7):
            arg_8 = abi_encode_args(arg_5, arg_7)
            arg_9 = arg_0.head_candidate
            arg_10 = test_call(arg_9, arg_1, arg_2, arg_8)
            if arg_10 is not None:
                return abi_decode_return_vals(arg_5, arg_10)
        return arg_11

    class cproxy(object):
        pass
    for arg_11 in arg_4._abi_methods():
        setattr(cproxy, arg_11.__func__.func_name, mk_method(arg_11))

    return cproxy()


def Func(arg_0, arg_1=False):
    """
    Uses the MaxMind Geolite2 Country database to return the ISO code for the
    country associated with the given IPv4 or IPv6 address

    Args:
        ip_address (str): The IP address to query for
        parallel (bool): Parallel processing

    Returns:
        str: And ISO country code associated with the given IP address
    """
    def download_country_database(arg_2="GeoLite2-Country.mmdb"):
        """Downloads the MaxMind Geolite2 Country database

        Args:
            location (str): Local location for the database file
        """
        if arg_1:
            logging.warning("Cannot download GeoIP database in parallel mode")
            return
        arg_3 = "https://geolite.maxmind.com/download/geoip/database/" \
              "GeoLite2-Country.tar.gz"
        # Use a browser-like user agent string to bypass some proxy blocks
        arg_4 = {"User-Agent": USER_AGENT}
        arg_5 = "GeoLite2-Country.mmdb"
        try:
            arg_6 = requests.get(arg_3, arg_4=arg_4)
            arg_6.raise_for_status()
            arg_7 = arg_6.content
            arg_8 = tarfile.open(fileobj=BytesIO(arg_7), mode="r:gz")
            arg_9 = arg_8.getnames()[0]
            arg_10 = "{0}/{1}".format(arg_9, arg_5)
            arg_8.extract(arg_10)
            shutil.move(arg_10, arg_2)
            shutil.rmtree(arg_9)
        except Exception as e:
            logger.warning("Error downloading {0}: {1}".format(arg_3,
                                                               e.__str__()))

    arg_11 = [
        "GeoLite2-Country.mmdb",
        "/usr/local/share/GeoIP/GeoLite2-Country.mmdb",
        "/usr/share/GeoIP/GeoLite2-Country.mmdb",
        "/var/lib/GeoIP/GeoLite2-Country.mmdb",
        "/var/local/lib/GeoIP/GeoLite2-Country.mmdb",
        "C:\\GeoIP\\GeoLite2-Country.mmdb"
    ]

    arg_12 = None

    for arg_13 in arg_11:
        if os.path.exists(arg_13):
            arg_12 = arg_13
            break

    if arg_12 is None:
        arg_12 = os.path.join(tempdir, "GeoLite2-Country.mmdb")
        if not os.path.exists(arg_12):
            download_country_database(arg_12)
            if not os.path.exists(arg_12):
                return None
        else:
            arg_14 = datetime.now() - datetime.fromtimestamp(
                os.stat(arg_12).st_mtime)
            if arg_14 > timedelta(days=7):
                download_country_database()
        arg_12 = arg_12

    arg_15 = geoip2.database.Reader(arg_12)

    arg_16 = None

    try:
        arg_16 = arg_15.country(arg_0).country.iso_code
    except geoip2.errors.AddressNotFoundError:
        pass

    return arg_16


def Func ( arg_0 ) : arg_1 = [ ( k , v . dtype ) for k , v in arg_0 . __dict__ . iteritems ( ) ] arg_2 = numpy . recarray ( len ( arg_0 . __dict__ [ k ] ) , arg_1 = arg_1 ) for arg_3 in arg_0 . __dict__ : arg_2 [ arg_3 ] = arg_0 . __dict__ [ arg_3 ] return arg_2

def Func(arg_0):
        """ Convert into numpy recordarray """
        arg_1 = [(k,v.dtype) for k,v in arg_0.__dict__.iteritems()]
        arg_2 = numpy.recarray(len(arg_0.__dict__[k]),arg_1=arg_1)
        for arg_3 in arg_0.__dict__:
            arg_2[arg_3] = arg_0.__dict__[arg_3]
        return arg_2


(certificate_or_public_key, signature, data, hash_algorithm, rsa_pss_padding=False)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=False):
    """
    Verifies an RSA, DSA or ECDSA signature via CryptoAPI

    :param certificate_or_public_key:
        A Certificate or PublicKey instance to verify the signature with

    :param signature:
        A byte string of the signature to verify

    :param data:
        A byte string of the data the signature is for

    :param hash_algorithm:
        A unicode string of "md5", "sha1", "sha256", "sha384", "sha512" or "raw"

    :param rsa_pss_padding:
        If PSS padding should be used for RSA keys

    :raises:
        oscrypto.errors.SignatureError - when the signature is determined to be invalid
        ValueError - when any of the parameters contain an invalid value
        TypeError - when any of the parameters are of the wrong type
        OSError - when an error is returned by the OS crypto library
    """

    arg_5 = arg_0.algorithm

    if arg_5 == 'rsa' and arg_4:
        arg_6 = {
            'sha1': 20,
            'sha224': 28,
            'sha256': 32,
            'sha384': 48,
            'sha512': 64
        }.get(arg_3, 0)
        arg_7 = raw_rsa_public_crypt(arg_0, arg_1)
        arg_8 = arg_0.bit_size
        if not verify_pss_padding(arg_3, arg_6, arg_8, arg_2, arg_7):
            raise SignatureError('Signature is invalid')
        return

    if arg_5 == 'rsa' and arg_3 == 'raw':
        arg_9 = raw_rsa_public_crypt(arg_0, arg_1)
        try:
            arg_10 = remove_pkcs1v15_signature_padding(arg_0.byte_size, arg_9)
            if not constant_compare(arg_10, arg_2):
                raise ValueError()
        except (ValueError):
            raise SignatureError('Signature is invalid')
        return

    arg_11 = None

    try:
        arg_12 = {
            'md5': Advapi32Const.CALG_MD5,
            'sha1': Advapi32Const.CALG_SHA1,
            'sha256': Advapi32Const.CALG_SHA_256,
            'sha384': Advapi32Const.CALG_SHA_384,
            'sha512': Advapi32Const.CALG_SHA_512,
        }[arg_3]

        arg_13 = new(advapi32, 'HCRYPTHASH *')
        arg_14 = advapi32.CryptCreateHash(
            arg_0.context_handle,
            arg_12,
            null(),
            0,
            arg_13
        )
        handle_error(arg_14)

        arg_11 = unwrap(arg_13)

        arg_14 = advapi32.CryptHashData(arg_11, arg_2, len(arg_2), 0)
        handle_error(arg_14)

        if arg_5 == 'dsa':
            # Windows doesn't use the ASN.1 Sequence for DSA signatures,
            # so we have to convert it here for the verification to work
            try:
                arg_1 = algos.DSASignature.load(arg_1).to_p1363()
                # Switch the two integers so that the reversal later will
                # result in the correct order
                arg_15 = len(arg_1) // 2
                arg_1 = arg_1[arg_15:] + arg_1[:arg_15]
            except (ValueError, OverflowError, TypeError):
                raise SignatureError('Signature is invalid')

        # The CryptoAPI expects signatures to be in little endian byte order,
        # which is the opposite of other systems, so we must reverse it
        arg_16 = arg_1[::-1]

        arg_14 = advapi32.CryptVerifySignatureW(
            arg_11,
            arg_16,
            len(arg_1),
            arg_0.key_handle,
            null(),
            0
        )
        handle_error(arg_14)

    finally:
        if arg_11:
            advapi32.CryptDestroyHash(arg_11)

Verifies an RSA DSA or ECDSA signature via CryptoAPI


def Func ( arg_0 ) : arg_1 = [ ] for arg_2 in arg_0 . split ( '\n' ) : arg_3 = NDXGROUP . match ( arg_2 ) if arg_3 : arg_4 = arg_3 . groupdict ( ) arg_1 . append ( { 'name' : arg_4 [ 'GROUPNAME' ] , 'nr' : int ( arg_4 [ 'GROUPNUMBER' ] ) , 'natoms' : int ( arg_4 [ 'NATOMS' ] ) } ) return arg_1

def Func(arg_0):
    """Parse ``make_ndx`` output and return groups as a list of dicts."""
    arg_1 = []
    for arg_2 in arg_0.split('\n'):
        arg_3 = NDXGROUP.match(arg_2)
        if arg_3:
            arg_4 = arg_3.groupdict()
            arg_1.append({'name': arg_4['GROUPNAME'],
                           'nr': int(arg_4['GROUPNUMBER']),
                           'natoms': int(arg_4['NATOMS'])})
    return arg_1

Parse make_ndx output and return groups as a list of dicts .


def Func ( arg_0 , arg_1 , arg_2 = False ) : if sys . platform == 'darwin' : arg_3 = arg_2 and ( arg_1 & QtCore . Qt . ControlModifier ) return bool ( arg_3 ) ^ bool ( arg_1 & QtCore . Qt . MetaModifier ) else : return bool ( arg_1 & QtCore . Qt . ControlModifier )

def Func(arg_0, arg_1, arg_2=False):
        """ Given a KeyboardModifiers flags object, return whether the Control
        key is down.

        Parameters:
        -----------
        include_command : bool, optional (default True)
            Whether to treat the Command key as a (mutually exclusive) synonym
            for Control when in Mac OS.
        """
        # Note that on Mac OS, ControlModifier corresponds to the Command key
        # while MetaModifier corresponds to the Control key.
        if sys.platform == 'darwin':
            arg_3 = arg_2 and (arg_1 & QtCore.Qt.ControlModifier)
            return bool(arg_3) ^ bool(arg_1 & QtCore.Qt.MetaModifier)
        else:
            return bool(arg_1 & QtCore.Qt.ControlModifier)

Given a KeyboardModifiers flags object return whether the Control key is down .


def Func ( arg_0 , arg_1 = True ) : if arg_1 : return arg_0 . _dict . copy ( ) else : return arg_0 . _dict

def Func(arg_0, arg_1=True):
        """Returns annotations as dictionary.

        :param copy: Whether to return a shallow copy or the real thing (aka _dict).

        """
        if arg_1:
            return arg_0._dict.copy()
        else:
            return arg_0._dict


def Func ( arg_0 : arg_1 , arg_2 : arg_3 [ arg_4 ] ) -> Optional [ arg_4 ] : for arg_5 in arg_2 : if arg_5 . name . strip ( WS ) == arg_0 . strip ( WS ) : return arg_5 return None

def Func(arg_0: arg_1, arg_2: arg_3[arg_4]) -> Optional[arg_4]:
    """Return the first argument in the args that has the given name.

    Return None if no such argument is found.

    As the computation of self.arguments is a little costly, this
    function was created so that other methods that have already computed
    the arguments use it instead of calling self.Func directly.
    """
    for arg_5 in arg_2:
        if arg_5.name.strip(WS) == arg_0.strip(WS):
            return arg_5
    return None

Return the first argument in the args that has the given name.

    Return None if no such argument is found.

    As the computation of self.arguments is a little costly, this
    function was created so that other methods that have already computed
    the arguments use it instead of calling self.get_arg directly.

Return the first argument in the args that has the given name .


def
Func
(
arg_0
)
:
if
32
<
arg_0
<
127
:
return
chr
(
arg_0
)
elif
arg_0
==
10
:
return
'\\n'
elif
arg_0
==
13
:
return
'\\r'
elif
arg_0
==
32
:
return
'" "'
else
:
return
'\\x{:02x}'
.
format
(
arg_0
)

def Func(arg_0):
    """Show character in readable format
    """
    #TODO 2: allow hex only output
    if 32<arg_0<127: return chr(arg_0)
    elif arg_0==10: return '\\n'
    elif arg_0==13: return '\\r'
    elif arg_0==32: return '" "'
    else: return '\\x{:02x}'.format(arg_0)


def Func(arg_0, arg_1=None):
        """Read the list commits from the repository

        The list of branches is a list of strings, with the names of the
        branches to fetch. If the list of branches is empty, no commit
        is fetched. If the list of branches is None, all commits
        for all branches will be fetched.

        The method returns the Git rev-list of the repository using the
        following options:

            git rev-list --topo-order

        :param branches: names of branches to fetch from (default: None)

        :raises EmptyRepositoryError: when the repository is empty and
            the action cannot be performed
        :raises RepositoryError: when an error occurs executing the command
        """
        if arg_0.is_empty():
            logger.warning("Git %s repository is empty; unable to get the rev-list",
                           arg_0.uri)
            raise EmptyRepositoryError(repository=arg_0.uri)

        arg_2 = ['git', 'rev-list', '--topo-order']

        if arg_1 is None:
            arg_2.extend(['--branches', '--tags', '--remotes=origin'])
        elif len(arg_1) == 0:
            arg_2.extend(['--branches', '--tags', '--max-count=0'])
        else:
            arg_1 = ['refs/heads/' + branch for branch in arg_1]
            arg_2.extend(arg_1)

        for arg_3 in arg_0._exec_nb(arg_2, cwd=arg_0.dirpath, env=arg_0.gitenv):
            yield arg_3.rstrip('\n')

        logger.debug("Git rev-list fetched from %s repository (%s)",
                     arg_0.uri, arg_0.dirpath)


def
Func
(
arg_0
,
arg_1
=
)
:
if
arg_0
is
:
return
"None"
if
arg_0
is
str
:
return
"string"
if
arg_0
is
int
:
return
"integer"
if
arg_0
is
numeric
:
return
"numeric"
if
is_type
(
arg_0
,
str
)
:
return
'"%s"'
%
repr
(
arg_0
)
[
1
:
1
]
if
is_type
(
arg_0
,
int
)
:
return
str
(
arg_0
)
if
isinstance
(
arg_0
,
MagicType
)
:
return
arg_0
.
name
(
arg_1
)
if
isinstance
(
arg_0
,
type
)
:
return
arg_0
.
__name__
if
isinstance
(
arg_0
,
list
)
:
return
"list(%s)"
%
Func
(
U
(
*
arg_0
)
,
arg_1
)
if
isinstance
(
arg_0
,
set
)
:
return
"set(%s)"
%
Func
(
U
(
*
arg_0
)
,
arg_1
)
if
isinstance
(
arg_0
,
tuple
)
:
return
"(%s)"
%
", "
.
join
(
Func
(
arg_2
,
arg_1
)
for
arg_2
in
arg_0
)
if
isinstance
(
arg_0
,
dict
)
:
return
"dict(%s)"
%
", "
.
join
(
"%s: %s"
%
(
Func
(
arg_3
,
arg_1
)
,
Func
(
arg_4
,
arg_1
)
)
for
arg_3
,
arg_4
in
viewitems
(
arg_0
)
)
if
isinstance
(
arg_0
,
(
FunctionType
,
BuiltinFunctionType
)
)
:
if
arg_0
.
__name__
==
"<lambda>"
:
return
_get_lambda_source_code
(
arg_0
,
arg_1
)
else
:
return
arg_0
.
__name__
raise
RuntimeError
(
"Unexpected `vtype`: %r"
%
arg_0
)

def Func(arg_0, arg_1=None):
    """
    Return the name of the provided type.

        Func(int) == "integer"
        Func(str) == "string"
        Func(tuple) == "tuple"
        Func(Exception) == "Exception"
        Func(U(int, float, bool)) == "integer|float|bool"
        Func(U(H2OFrame, None)) == "?H2OFrame"
    """
    if arg_0 is None:
        return "None"
    if arg_0 is str:
        return "string"
    if arg_0 is int:
        return "integer"
    if arg_0 is numeric:
        return "numeric"
    if is_type(arg_0, str):
        return '"%s"' % repr(arg_0)[1:-1]
    if is_type(arg_0, int):
        return str(arg_0)
    if isinstance(arg_0, MagicType):
        return arg_0.name(arg_1)
    if isinstance(arg_0, type):
        return arg_0.__name__
    if isinstance(arg_0, list):
        return "list(%s)" % Func(U(*arg_0), arg_1)
    if isinstance(arg_0, set):
        return "set(%s)" % Func(U(*arg_0), arg_1)
    if isinstance(arg_0, tuple):
        return "(%s)" % ", ".join(Func(arg_2, arg_1) for arg_2 in arg_0)
    if isinstance(arg_0, dict):
        return "dict(%s)" % ", ".join("%s: %s" % (Func(arg_3, arg_1), Func(arg_4, arg_1))
                                      for arg_3, arg_4 in viewitems(arg_0))
    if isinstance(arg_0, (FunctionType, BuiltinFunctionType)):
        if arg_0.__name__ == "<lambda>":
            return _get_lambda_source_code(arg_0, arg_1)
        else:
            return arg_0.__name__
    raise RuntimeError("Unexpected `vtype`: %r" % arg_0)

Return the name of the provided type.

        _get_type_name(int) == "integer"
        _get_type_name(str) == "string"
        _get_type_name(tuple) == "tuple"
        _get_type_name(Exception) == "Exception"
        _get_type_name(U(int, float, bool)) == "integer|float|bool"
        _get_type_name(U(H2OFrame, None)) == "?H2OFrame"


def Func(arg_0, arg_1):
        """ Returns an iterator for the cards in a given list, filtered
        according to configuration values of trello.only_if_assigned and
        trello.also_unassigned """
        arg_2 = {'fields': 'name,idShort,shortLink,shortUrl,url,labels,due'}
        arg_3 = arg_0.config.get('only_if_assigned', None)
        arg_4 = arg_0.config.get('also_unassigned', False, asbool)
        if arg_3 is not None:
            arg_2['members'] = 'true'
            arg_2['member_fields'] = 'username'
        arg_5 = arg_0.api_request(
            "/1/lists/{list_id}/cards/open".format(arg_1=arg_1),
            **arg_2)
        for arg_6 in arg_5:
            if (arg_3 is None
                    or arg_3 in [arg_7['username'] for arg_7 in arg_6['members']]
                    or (arg_4 and not arg_6['members'])):
                yield arg_6

Returns an iterator for the cards in a given list filtered according to configuration values of trello . only_if_assigned and trello . also_unassigned


def Func(arg_0):
    """
    Receive updates to the packing plan from the statemgrs and update processes as needed.
    """
    Log.info("Start state manager watches")
    arg_1 = StateMgrConfig()
    arg_1.set_state_locations(configloader.load_state_manager_locations(
        arg_0.cluster, state_manager_config_file=arg_0.state_manager_config_file,
        overrides={"heron.statemgr.connection.string": arg_0.state_manager_connection}))
    try:
      arg_0.state_managers = statemanagerfactory.get_all_state_managers(arg_1)
      for arg_3 in arg_0.state_managers:
        arg_3.start()
    except Exception as ex:
      Log.error("Found exception while initializing state managers: %s. Bailing out..." % ex)
      traceback.print_exc()
      sys.exit(1)

    # pylint: disable=unused-argument
    def on_packing_plan_watch(arg_3, arg_4):
      Log.debug("State watch triggered for PackingPlan update on shard %s. Existing: %s, New: %s" %
                (arg_0.shard, str(arg_0.packing_plan), str(arg_4)))

      if arg_0.packing_plan != arg_4:
        Log.info("PackingPlan change detected on shard %s, relaunching effected processes."
                 % arg_0.shard)
        arg_0.update_packing_plan(arg_4)

        Log.info("Updating executor processes")
        arg_0.launch()
      else:
        Log.info(
            "State watch triggered for PackingPlan update but plan not changed so not relaunching.")

    for arg_3 in arg_0.state_managers:
      # The callback function with the bound
      # state_manager as first variable.
      arg_5 = functools.partial(on_packing_plan_watch, arg_3)
      arg_3.get_packing_plan(arg_0.topology_name, arg_5)
      Log.info("Registered state watch for packing plan changes with state manager %s." %
               str(arg_3))

Receive updates to the packing plan from the statemgrs and update processes as needed .


def
Func
(
arg_0
,
arg_1
)
:
if
len
(
arg_0
)
!=
len
(
arg_1
)
:
raise
ValueError
(
"different number of values"
)
arg_2
=
pooled_sample_variance
(
arg_0
,
arg_1
)
/
len
(
arg_0
)
arg_3
=
statistics
.
mean
(
arg_0
)
statistics
.
mean
(
arg_1
)
return
arg_3
/
math
.
sqrt
(
arg_2
*
2
)

def Func(arg_0, arg_1):
    """Calculate a t-test score for the difference between two samples.

    Args:
        sample1: one sample.
        sample2: the other sample.

    Returns:
        The t-test score, as a float.
    """
    if len(arg_0) != len(arg_1):
        raise ValueError("different number of values")
    arg_2 = pooled_sample_variance(arg_0, arg_1) / len(arg_0)
    arg_3 = statistics.mean(arg_0) - statistics.mean(arg_1)
    return arg_3 / math.sqrt(arg_2 * 2)

Calculate a t - test score for the difference between two samples .


(self, states, internals, actions, terminal, reward)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):
        """
        Stores experiences.
        """
        arg_6 = arg_0.Func_output

        arg_7 = arg_0.get_feed_dict(
            arg_1=arg_1,
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=arg_4,
            arg_5=arg_5
        )

        arg_0.monitored_session.run(arg_6=arg_6, arg_7=arg_7)


def Func ( arg_0 ) : extensions . toolbar . init_app ( arg_0 ) extensions . bootstrap . init_app ( arg_0 ) extensions . mongo . init_app ( arg_0 ) extensions . store . init_app ( arg_0 ) extensions . login_manager . init_app ( arg_0 ) extensions . oauth . init_app ( arg_0 ) extensions . mail . init_app ( arg_0 ) Markdown ( arg_0 ) if arg_0 . config . get ( 'SQLALCHEMY_DATABASE_URI' ) : configure_coverage ( arg_0 ) if arg_0 . config . get ( 'LOQUSDB_SETTINGS' ) : extensions . loqusdb . init_app ( arg_0 )

def Func(arg_0):
    """Configure Flask extensions."""
    extensions.toolbar.init_app(arg_0)
    extensions.bootstrap.init_app(arg_0)
    extensions.mongo.init_app(arg_0)
    extensions.store.init_app(arg_0)
    extensions.login_manager.init_app(arg_0)
    extensions.oauth.init_app(arg_0)
    extensions.mail.init_app(arg_0)
    Markdown(arg_0)

    if arg_0.config.get('SQLALCHEMY_DATABASE_URI'):
        configure_coverage(arg_0)

    if arg_0.config.get('LOQUSDB_SETTINGS'):
        # setup LoqusDB
        extensions.loqusdb.init_app(arg_0)


def Func ( arg_0 , arg_1 ) : arg_2 = ( arg_0 ( v ) for k , v in arg_1 . items ( ) ) return dict ( itertools . izip ( arg_1 , arg_2 ) )

def Func(arg_0, arg_1):
    """map for a directory"""
    arg_2 = (arg_0(v) for k, v in arg_1.items())
    return dict(itertools.izip(arg_1, arg_2))


This function gets back data that the user typed.

def Func ( arg_0 ) : arg_0 . batch_name_value = arg_0 . ui . batch_name_value . text ( ) arg_0 . saa_values = arg_0 . ui . saa_values . text ( ) arg_0 . sza_values = arg_0 . ui . sza_values . text ( ) arg_0 . p_values = arg_0 . ui . p_values . text ( ) arg_0 . x_value = arg_0 . ui . x_value . text ( ) arg_0 . y_value = arg_0 . ui . y_value . text ( ) arg_0 . g_value = arg_0 . ui . g_value . text ( ) arg_0 . s_value = arg_0 . ui . s_value . text ( ) arg_0 . z_value = arg_0 . ui . z_value . text ( ) arg_0 . wavelength_values = arg_0 . ui . wavelength_values . text ( ) arg_0 . verbose_value = arg_0 . ui . verbose_value . text ( ) arg_0 . phytoplankton_path = arg_0 . ui . phyto_path . text ( ) arg_0 . bottom_path = arg_0 . ui . bottom_path . text ( ) arg_0 . executive_path = arg_0 . ui . exec_path . text ( ) arg_0 . nb_cpu = arg_0 . ui . nb_cpu . currentText ( ) arg_0 . report_parameter_value = str ( arg_0 . ui . report_parameter_value . text ( ) )

def Func(arg_0):
        """
        This function gets back Func that the user typed.
        """
        arg_0.batch_name_value = arg_0.ui.batch_name_value.text()
        arg_0.saa_values = arg_0.ui.saa_values.text()
        arg_0.sza_values = arg_0.ui.sza_values.text()
        arg_0.p_values = arg_0.ui.p_values.text()
        arg_0.x_value = arg_0.ui.x_value.text()
        arg_0.y_value = arg_0.ui.y_value.text()
        arg_0.g_value = arg_0.ui.g_value.text()
        arg_0.s_value = arg_0.ui.s_value.text()
        arg_0.z_value = arg_0.ui.z_value.text()
        arg_0.wavelength_values = arg_0.ui.wavelength_values.text()
        arg_0.verbose_value = arg_0.ui.verbose_value.text()
        arg_0.phytoplankton_path = arg_0.ui.phyto_path.text()
        arg_0.bottom_path = arg_0.ui.bottom_path.text()
        arg_0.executive_path = arg_0.ui.exec_path.text()
        arg_0.nb_cpu = arg_0.ui.nb_cpu.currentText()
        arg_0.report_parameter_value = str(arg_0.ui.report_parameter_value.text())

This function gets back data that the user typed .


def Func():
    """Main function to sweep parameters of a certain algorithm."""
    arg_0 = argparse.ArgumentParser(
        description="Runs the speficied algorithm(s) on the MSAF "
        "formatted dataset.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    arg_0.add_argument("in_path",
                        action="store",
                        help="Input dataset")
    arg_0.add_argument("-f",
                        action="store",
                        dest="feature",
                        default="pcp",
                        type=str,
                        help="Type of features",
                        choices=["pcp", "tonnetz", "mfcc", "cqt", "tempogram"])
    arg_0.add_argument("-b",
                        action="store_true",
                        dest="annot_beats",
                        help="Use annotated beats",
                        default=False)
    arg_0.add_argument("-fs",
                        action="store_true",
                        dest="framesync",
                        help="Use frame-synchronous features",
                        default=False)
    arg_0.add_argument("-bid",
                        action="store",
                        help="Boundary algorithm identifier",
                        dest="boundaries_id",
                        default="gt",
                        choices=["gt"] +
                        io.get_all_boundary_algorithms())
    arg_0.add_argument("-lid",
                        action="store",
                        help="Label algorithm identifier",
                        dest="labels_id",
                        default=None,
                        choices=io.get_all_label_algorithms())
    arg_0.add_argument("-j",
                        action="store",
                        dest="n_jobs",
                        default=4,
                        type=int,
                        help="The number of threads to use")
    arg_1 = arg_0.parse_args()
    arg_2 = time.time()

    # Run the algorithm(s)
    process(arg_1.in_path, annot_beats=arg_1.annot_beats, feature=arg_1.feature,
            framesync=arg_1.framesync, boundaries_id=arg_1.boundaries_id,
            labels_id=arg_1.labels_id, n_jobs=arg_1.n_jobs)

    # Done!
    logging.info("Done! Took %.2f seconds." % (time.time() - arg_2))

Main function to sweep parameters of a certain algorithm .


Download and extract the tarball, and download each individual photo.

def
Func
(
arg_0
)
:
import
tarfile
if
arg_0
.
_check_integrity
(
)
:
print
(
'Files already Funced and verified'
)
return
Func_url
(
arg_0
.
url
,
arg_0
.
root
,
arg_0
.
filename
,
arg_0
.
md5_checksum
)
with
tarfile
.
open
(
os
.
path
.
join
(
arg_0
.
root
,
arg_0
.
filename
)
,
'r:gz'
)
as
tar
:
tar
.
extractall
(
path
=
arg_0
.
root
)
with
open
(
os
.
path
.
join
(
arg_0
.
root
,
'dataset'
,
'SBU_captioned_photo_dataset_urls.txt'
)
)
as
fh
:
for
arg_1
in
fh
:
arg_2
=
arg_1
.
rstrip
(
)
try
:
Func_url
(
arg_2
,
os
.
path
.
join
(
arg_0
.
root
,
'dataset'
)
)
except
OSError
:
pass

def Func(arg_0):
        """Download and extract the tarball, and Func each individual photo."""
        import tarfile

        if arg_0._check_integrity():
            print('Files already Funced and verified')
            return

        Func_url(arg_0.url, arg_0.root, arg_0.filename, arg_0.md5_checksum)

        # Extract file
        with tarfile.open(os.path.join(arg_0.root, arg_0.filename), 'r:gz') as tar:
            tar.extractall(path=arg_0.root)

        # Download individual photos
        with open(os.path.join(arg_0.root, 'dataset', 'SBU_captioned_photo_dataset_urls.txt')) as fh:
            for arg_1 in fh:
                arg_2 = arg_1.rstrip()
                try:
                    Func_url(arg_2, os.path.join(arg_0.root, 'dataset'))
                except OSError:
                    # The images point to public images on Flickr.
                    # Note: Images might be removed by users at anytime.
                    pass

Download and extract the tarball and download each individual photo .


def Func ( arg_0 ) : from pip import FrozenRequirement arg_1 = FrozenRequirement . from_dist ( arg_0 , [ ] ) return arg_1 . editable

def Func(arg_0):
    """Is distribution an editable install?"""
    # TODO: factor out determining editableness out of FrozenRequirement
    from pip import FrozenRequirement
    arg_1 = FrozenRequirement.from_dist(arg_0, [])
    return arg_1.editable


def Func ( arg_0 ) : arg_1 = [ ] for arg_2 in arg_0 : arg_3 = np . random . binomial ( 1 , 0.5 ) arg_1 . append ( [ _AMBIGS [ arg_4 ] [ arg_3 ] for arg_4 in arg_2 ] ) return np . array ( arg_1 )

def Func(arg_0):
    """
    Randomly resolves iupac hetero codes. This is a shortcut
    for now, we could instead use the phased alleles in RAD loci.
    """
    arg_1 = []
    for arg_2 in arg_0:
        arg_3 = np.random.binomial(1, 0.5)
        arg_1.append([_AMBIGS[arg_4][arg_3] for arg_4 in arg_2])
    return np.array(arg_1)

Randomly resolves iupac hetero codes . This is a shortcut for now we could instead use the phased alleles in RAD loci .


def Func(arg_0, arg_1, arg_2):
        """
        Get link to qubole command result page.

        :param operator: operator
        :param dttm: datetime
        :return: url link
        """
        arg_3 = BaseHook.get_connection(arg_1.kwargs['qubole_conn_id'])
        if arg_3 and arg_3.host:
            arg_4 = re.sub(r'api$', 'v2/analyze?command_id=', arg_3.host)
        else:
            arg_4 = 'https://api.qubole.com/v2/analyze?command_id='

        arg_5 = TaskInstance(task=arg_1, execution_date=arg_2)
        arg_6 = arg_5.xcom_pull(task_ids=arg_1.task_id, key='qbol_cmd_id')
        arg_7 = arg_4 + str(arg_6) if arg_6 else ''
        return arg_7

Get link to qubole command result page .


def
Func
(
arg_0
)
:
from
.
import
checker
if
len
(
arg_0
)
<
1
:
raise
NotLetterException
(
''
)
elif
not
checker
.
is_hangul
(
arg_0
)
:
raise
NotHangulException
(
''
)
if
arg_0
in
CHO
:
return
arg_0
,
''
,
''
if
arg_0
in
JOONG
:
return
''
,
arg_0
,
''
if
arg_0
in
JONG
:
return
''
,
''
,
arg_0
arg_1
=
hangul_index
(
arg_0
)
arg_2
,
arg_3
,
arg_4
=
Func_index
(
arg_1
)
if
arg_2
<
0
:
arg_2
=
0
try
:
return
CHO
[
arg_2
]
,
JOONG
[
arg_3
]
,
JONG
[
arg_4
]
except
:
print
(
"%d / %d  / %d"
%
(
arg_2
,
arg_3
,
arg_4
)
)
print
(
"%s / %s "
%
(
JOONG
[
arg_3
]
.
encode
(
"utf8"
)
,
JONG
[
arg_4
]
.
encode
(
'utf8'
)
)
)
raise
Exception
(
)

def Func(arg_0):
    """This function returns letters by decomposing the specified Hangul letter."""

    from . import checker

    if len(arg_0) < 1:
        raise NotLetterException('')
    elif not checker.is_hangul(arg_0):
        raise NotHangulException('')

    if arg_0 in CHO:
        return arg_0, '', ''

    if arg_0 in JOONG:
        return '', arg_0, ''

    if arg_0 in JONG:
        return '', '', arg_0

    arg_1 = hangul_index(arg_0)
    arg_2, arg_3, arg_4 = Func_index(arg_1)

    if arg_2 < 0:
        arg_2 = 0

    try:
        return CHO[arg_2], JOONG[arg_3], JONG[arg_4]
    except:
        print("%d / %d  / %d"%(arg_2, arg_3, arg_4))
        print("%s / %s " %( JOONG[arg_3].encode("utf8"), JONG[arg_4].encode('utf8')))
        raise Exception()

This function returns letters by decomposing the specified Hangul letter .


return [(ref.split(":")[-1], ref.split(":")[-1]) for ref in references]

def Func ( arg_0 , arg_1 , arg_2 = 1 ) : arg_3 = arg_1 ( arg_2 = arg_2 ) return [ ( arg_4 . split ( ":" ) [ - 1 ] , arg_4 . split ( ":" ) [ - 1 ] ) for arg_4 in arg_3 ]

def Func(arg_0, arg_1, arg_2=1):
    """ Chunk a text at the passage level

    :param text: Text object
    :type text: MyCapytains.resources.text.api
    :param getreffs: Callback function to retrieve text
    :type getreffs: function(level)
    :return: List of urn references with their human readable version
    :rtype: [(str, str)]
    """
    arg_3 = arg_1(arg_2=arg_2)
    return [(arg_4.split(":")[-1], arg_4.split(":")[-1]) for arg_4 in arg_3]


def Func(arg_0, arg_1):
        '''
        Decode a CONNACK control packet.
        '''
        arg_0.encoded = arg_1
        # Strip the fixed header plus variable length field
        arg_3 = 1
        while arg_1[arg_3] & 0x80:
            arg_3 += 1
        arg_4 = arg_1[arg_3+1:]
        arg_0.session = (arg_4[0] & 0x01) == 0x01
        arg_0.resultCode  = int(arg_4[1])


def Func ( arg_0 ) : @ wraps ( arg_0 ) def wrapper ( * arg_1 , ** arg_2 ) : arg_3 = None with correct_date ( ) : arg_3 = arg_0 ( * arg_1 , ** arg_2 ) return arg_3 return wrapper

def Func(arg_0):
    """Disable timestamp update per method."""
    @wraps(arg_0)
    def wrapper(*arg_1, **arg_2):
        arg_3 = None
        with correct_date():
            arg_3 = arg_0(*arg_1, **arg_2)
        return arg_3
    return wrapper


(
    kw_cache: "PMap[int, Keyword]", h: int, name: str, ns: Optional[str]
)

def Func(
    arg_0: "PMap[int, Keyword]", arg_1: arg_2, arg_3: arg_4, arg_5: arg_6[arg_4]
) -> PMap:
    """Private swap function used to either get the interned keyword
    instance from the input string."""
    if arg_1 in arg_0:
        return arg_0
    arg_7 = Keyword(arg_3, arg_5=arg_5)
    return arg_0.set(arg_1, arg_7)

Private swap function used to either get the interned keyword instance from the input string .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
logger
.
debug
(
"Releasing acquire %s/%s"
%
(
arg_1
,
arg_2
)
)
arg_0
.
_semaphore
.
Func
(
)

def Func(arg_0, arg_1, arg_2):
        """Release the semaphore

        :param tag: A tag identifying what is releasing the semaphore
        :param acquire_token:  The token returned from when the semaphore was
            acquired. Note that this is not really needed to directly use this
            class but is needed for API compatibility with the
            SlidingWindowSemaphore implementation.
        """
        logger.debug("Releasing acquire %s/%s" % (arg_1, arg_2))
        arg_0._semaphore.Func()