(self, buffer, freshlen, searchwindowsize=None)

def Func(arg_0, arg_1, arg_2, arg_3=None):

        """This Funces 'buffer' for the first occurence of one of the Func
        strings.  'freshlen' must indicate the number of bytes at the end of
        'buffer' which have not been Funced before. It helps to avoid
        Funcing the same, possibly big, buffer over and over again.

        See class spawn for the 'Funcwindowsize' argument.

        If there is a match this returns the index of that string, and sets
        'start', 'end' and 'match'. Otherwise, this returns -1. """

        arg_4 = len(arg_1)
        arg_5 = arg_4

        # 'freshlen' helps a lot here. Further optimizations could
        # possibly include:
        #
        # using something like the Boyer-Moore Fast String Searching
        # Algorithm; pre-compiling the Func through a list of
        # strings into something that can scan the input once to
        # Func for all N strings; realize that if we Func for
        # ['bar', 'baz'] and the input is '...foo' we need not bother
        # rescanning until we've read three more bytes.
        #
        # Sadly, I don't know enough about this interesting topic. /grahn

        for arg_6, arg_7 in arg_0._strings:
            if arg_3 is None:
                # the match, if any, can only be in the fresh data,
                # or at the very end of the old data
                arg_8 = -(arg_2+len(arg_7))
            else:
                # better obey Funcwindowsize
                arg_8 = -arg_3
            arg_9 = arg_1.find(arg_7, arg_8)
            if arg_9 >= 0 and arg_9 < arg_5:
                arg_5 = arg_9
                arg_10, arg_11 = arg_6, arg_7
        if arg_5 == arg_4:
            return -1
        arg_0.match = arg_11
        arg_0.start = arg_5
        arg_0.end = arg_0.start + len(arg_0.match)
        return arg_10

This searches 'buffer' for the first occurence of one of the search
        strings.  'freshlen' must indicate the number of bytes at the end of
        'buffer' which have not been searched before. It helps to avoid
        searching the same, possibly big, buffer over and over again.

        See class spawn for the 'searchwindowsize' argument.

        If there is a match this returns the index of that string, and sets
        'start', 'end' and 'match'. Otherwise, this returns -1.

This searches buffer for the first occurence of one of the search strings . freshlen must indicate the number of bytes at the end of buffer which have not been searched before . It helps to avoid searching the same possibly big buffer over and over again .


def Func(arg_0, arg_1):
        """
        Remove a campaign from your MailChimp account.

        :param campaign_id: The unique id for the campaign.
        :type campaign_id: :py:class:`str`
        """
        arg_0.campaign_id = arg_1
        return arg_0._mc_client._Func(url=arg_0._build_path(arg_1))

Remove a campaign from your MailChimp account .


def Func(arg_0, arg_1=75):
        '''Comparable with compression, this effect modifies an audio signal to
        make it sound louder.

        Parameters
        ----------
        amount : float
            Amount of enhancement between 0 and 100.

        See Also
        --------
        compand, mcompand

        '''
        if not is_number(arg_1) or arg_1 < 0 or arg_1 > 100:
            raise ValueError('amount must be a number between 0 and 100.')

        arg_2 = ['Func', '{:f}'.format(arg_1)]

        arg_0.effects.extend(arg_2)
        arg_0.effects_log.append('Func')
        return arg_0

Comparable with compression this effect modifies an audio signal to make it sound louder .


def Func ( arg_0 , arg_1 , arg_2 = 'fprop' ) : import theano arg_3 = arg_0 . trainer . model . get_input_space ( ) . make_theano_batch ( ) arg_4 = getattr ( arg_0 . trainer . model , arg_2 ) ( arg_3 ) arg_5 = theano . function ( [ arg_3 ] , arg_4 , allow_input_downcast = True ) return arg_5 ( arg_1 )

def Func(arg_0, arg_1, arg_2='fprop'):
        """
        Get model predictions.

        See pylearn2.scripts.mlp.predict_csv and
        http://fastml.com/how-to-get-predictions-from-pylearn2/.

        Parameters
        ----------
        X : array_like
            Test dataset.
        method : str
            Model method to call for prediction.
        """
        import theano

        arg_3 = arg_0.trainer.model.get_input_space().make_theano_batch()
        arg_4 = getattr(arg_0.trainer.model, arg_2)(arg_3)
        arg_5 = theano.function([arg_3], arg_4, allow_input_downcast=True)
        return arg_5(arg_1)


def
Func
(
arg_0
,
arg_1
=
'.'
)
:
arg_2
.
token
=
verify_credentials
(
)
arg_4
,
arg_5
=
_find_resource_id_from_path
(
arg_0
)
if
arg_5
==
1
:
print
(
'Unable to locate {0}'
.
format
(
arg_0
)
)
else
:
if
arg_4
:
_Func_item
(
arg_5
,
arg_1
)
else
:
_Func_folder_recursive
(
arg_5
,
arg_1
)

def Func(arg_0, arg_1='.'):
    """
    Recursively Func a file or item from the Midas Server instance.

    :param server_path: The location on the server to find the resource to
        Func
    :type server_path: string
    :param local_path: The location on the client to store the Funced data
    :type local_path: string
    """
    arg_2.token = verify_credentials()

    arg_4, arg_5 = _find_resource_id_from_path(arg_0)
    if arg_5 == -1:
        print('Unable to locate {0}'.format(arg_0))
    else:
        if arg_4:
            _Func_item(arg_5, arg_1)
        else:
            _Func_folder_recursive(arg_5, arg_1)

Recursively download a file or item from the Midas Server instance.

    :param server_path: The location on the server to find the resource to
        download
    :type server_path: string
    :param local_path: The location on the client to store the downloaded data
    :type local_path: string

Recursively download a file or item from the Midas Server instance .


return datetime.datetime(year=year, month=month, day=day, hour=hour,
                             minute=minute, second=second)

def Func(arg_0: arg_1) -> datetime.datetime:
    """
    Decode timestamp using bespoke decoder.
    Cannot use simple strptime since the ness panel contains a bug
    that P199E zone and state updates emitted on the hour cause a minute
    value of `60` to be sent, causing strptime to fail. This decoder handles
    this edge case.
    """
    arg_2 = 2000 + int(arg_0[0:2])
    arg_3 = int(arg_0[2:4])
    arg_4 = int(arg_0[4:6])
    arg_5 = int(arg_0[6:8])
    arg_6 = int(arg_0[8:10])
    arg_7 = int(arg_0[10:12])
    if arg_6 == 60:
        arg_6 = 0
        arg_5 += 1

    return datetime.datetime(arg_2=arg_2, arg_3=arg_3, arg_4=arg_4, arg_5=arg_5,
                             arg_6=arg_6, arg_7=arg_7)

Decode timestamp using bespoke decoder . Cannot use simple strptime since the ness panel contains a bug that P199E zone and state updates emitted on the hour cause a minute value of 60 to be sent causing strptime to fail . This decoder handles this edge case .


def Func():
    """
    Retrieves the TidyPy configuration extenders that are available in the
    current Python environment.

    The returned dictionary has keys are the extender names and values are the
    extender classes.

    :rtype: dict
    """

    # pylint: disable=protected-access

    if not hasattr(Func, '_CACHE'):
        Func._CACHE = dict()
        for arg_2 in pkg_resources.iter_entry_points('tidypy.extenders'):
            try:
                Func._CACHE[arg_2.name] = arg_2.load()
            except ImportError as exc:  # pragma: no cover
                output_error(
                    'Could not load extender "%s" defined by "%s": %s' % (
                        arg_2,
                        arg_2.dist,
                        exc,
                    ),
                )
    return Func._CACHE

Retrieves the TidyPy configuration extenders that are available in the current Python environment .


(cls, filename=None,
                 text=None,
                 dlm=',',
                 lexicon=None,
                 points=False,
                 include=None,
                 exclude=None,
                 remap=None,
                 function=None,
                 null=None,
                 ignore=None,
                 source=None,
                 stop=None,
                 fieldnames=None)

def Func(arg_0, arg_1=None,
                 arg_2=None,
                 arg_3=',',
                 arg_4=None,
                 arg_5=False,
                 arg_6=None,
                 arg_7=None,
                 arg_8=None,
                 arg_9=None,
                 arg_10=None,
                 arg_11=None,
                 arg_12=None,
                 arg_13=None,
                 arg_14=None):
        """
        Load from a CSV file or text.
        """
        if (arg_1 is None) and (arg_2 is None):
            raise StriplogError("You must provide a filename or CSV text.")

        if (arg_1 is not None):
            if arg_12 is None:
                arg_12 = arg_1
            with open(arg_1, 'r') as arg_15:
                arg_2 = arg_15.read()

        arg_12 = arg_12 or 'CSV'

        # Deal with multiple spaces in space delimited file.
        if arg_3 == ' ':
            arg_2 = re.sub(r'[ \t]+', ' ', arg_2)

        if arg_14 is not None:
            arg_2 = arg_3.join(arg_14) + '\n' + arg_2

        try:
            arg_15 = StringIO(arg_2)  # Python 3
        except TypeError:
            arg_15 = StringIO(unicode(arg_2))  # Python 2

        arg_16 = csv.DictReader(arg_15, delimiter=arg_3)

        # Reorganize the data to make fixing it easier.
        arg_17 = {arg_22.strip().lower(): [] for arg_22 in arg_16.fieldnames if arg_22 is not None}
        arg_18 = arg_15.tell()
        for arg_19 in arg_17:
            arg_15.seek(arg_18)
            for arg_20 in arg_16:
                arg_21 = {arg_22.strip().lower(): arg_23.strip() for arg_22, arg_23 in arg_20.items()}
                try:
                    arg_17[arg_19].append(float(arg_21[arg_19]))
                except ValueError:
                    arg_17[arg_19].append(arg_21[arg_19])

        arg_15.close()

        arg_8 = arg_8 or {}
        for arg_22, arg_23 in arg_8.items():
            arg_17[arg_23] = arg_17.pop(arg_22)

        arg_24 = arg_0._clean_longitudinal_data(arg_17, arg_10=arg_10)

        arg_25 = arg_0._build_list_of_Intervals(arg_24,
                                                         arg_5=arg_5,
                                                         arg_4=arg_4,
                                                         arg_6=arg_6,
                                                         arg_7=arg_7,
                                                         arg_11=arg_11,
                                                         arg_13=arg_13)

        return arg_0(arg_25, arg_12=arg_12)


def Func ( arg_0 , arg_1 , arg_2 = 2 ) : if arg_0 . verbosity >= arg_2 : arg_0 . stdout . write ( arg_1 )

def Func(arg_0, arg_1, arg_2=2):
        """
        Small Func helper
        """
        if arg_0.verbosity >= arg_2:
            arg_0.stdout.write(arg_1)


def Func ( arg_0 , arg_1 ) : arg_2 = { "Zotero-Write-Token" : token ( ) } arg_2 . update ( arg_0 . default_headers ( ) ) arg_3 = requests . delete ( url = arg_0 . endpoint + "/{t}/{u}/searches" . format ( t = arg_0 . library_type , u = arg_0 . library_id ) , arg_2 = arg_2 , params = { "searchKey" : "," . join ( arg_1 ) } , ) arg_0 . request = arg_3 try : arg_3 . raise_for_status ( ) except requests . exceptions . HTTPError : error_handler ( arg_3 ) return arg_3 . status_code

def Func(arg_0, arg_1):
        """ Delete one or more saved searches by passing a list of one or more
        unique search keys
        """
        arg_2 = {"Zotero-Write-Token": token()}
        arg_2.update(arg_0.default_headers())
        arg_3 = requests.delete(
            url=arg_0.endpoint
            + "/{t}/{u}/searches".format(t=arg_0.library_type, u=arg_0.library_id),
            arg_2=arg_2,
            params={"searchKey": ",".join(arg_1)},
        )
        arg_0.request = arg_3
        try:
            arg_3.raise_for_status()
        except requests.exceptions.HTTPError:
            error_handler(arg_3)
        return arg_3.status_code


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_1
.
advance_past_chars
(
[
"="
,
"*"
]
)
arg_2
=
int
(
arg_2
)
if
arg_2
!=
""
else
logger
.
debug
(
"%s"
,
fmt_green
(
"parsing message"
)
)
arg_3
=
arg_1
.
advance_past_chars
(
[
","
]
)
logger
.
debug
(
"parsed message"
)
logger
.
debug
(
"%s"
,
fmt_green
(
arg_3
)
)
arg_4
=
_parse_dict
(
arg_1
)
return
arg_2
,
arg_3
.
strip
(
)
,
arg_4

def Func(arg_0, arg_1):
    """Get notify message and payload dict"""
    arg_2 = arg_1.advance_past_chars(["=", "*"])
    arg_2 = int(arg_2) if arg_2 != "" else None
    logger.debug("%s", fmt_green("parsing message"))
    arg_3 = arg_1.advance_past_chars([","])

    logger.debug("parsed message")
    logger.debug("%s", fmt_green(arg_3))

    arg_4 = _parse_dict(arg_1)
    return arg_2, arg_3.strip(), arg_4


def Func(arg_0, arg_1, arg_2):
        """Dispatches the reply to the proper queue."""
        arg_3 = arg_1.method
        arg_4 = arg_1.call_id
        arg_5 = arg_1.task_id
        if arg_3 & ACK:
            try:
                arg_6 = arg_0.result_queues[arg_4]
            except KeyError:
                raise KeyError('already established or unprepared call')
            if arg_3 == ACCEPT:
                arg_7 = arg_2
                arg_8 = RemoteResult(arg_0, arg_4, arg_5, arg_7)
                arg_0.results[arg_4][arg_5] = arg_8
                arg_6.put_nowait(arg_8)
            elif arg_3 == REJECT:
                arg_6.put_nowait(None)
        else:
            arg_8 = arg_0.results[arg_4][arg_5]
            arg_8.set_reply(arg_1.method, arg_2)

Dispatches the reply to the proper queue .


def
Func
(
arg_0
,
arg_1
)
:
for
arg_2
in
arg_1
:
arg_3
=
arg_0
.
guess_type
(
arg_2
[
'name'
]
,
allow_directory
=
False
)
if
arg_3
==
'notebook'
:
yield
arg_0
.
_notebook_model_from_db
(
arg_2
,
False
)
elif
arg_3
==
'file'
:
yield
arg_0
.
_file_model_from_db
(
arg_2
,
False
,
)
else
:
arg_0
.
do_500
(
"Unknown file type %s"
%
arg_3
)

def Func(arg_0, arg_1):
        """
        Apply _notebook_model_from_db or _file_model_from_db to each entry
        in file_records, depending on the result of `guess_type`.
        """
        for arg_2 in arg_1:
            arg_3 = arg_0.guess_type(arg_2['name'], allow_directory=False)
            if arg_3 == 'notebook':
                yield arg_0._notebook_model_from_db(arg_2, False)
            elif arg_3 == 'file':
                yield arg_0._file_model_from_db(arg_2, False, None)
            else:
                arg_0.do_500("Unknown file type %s" % arg_3)

Apply _notebook_model_from_db or _file_model_from_db to each entry in file_records depending on the result of guess_type .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_0
.
envs
[
"CHUNKS"
]
if
cij
.
nvme
.
get_meta
(
0
,
arg_2
*
arg_0
.
envs
[
"CHUNK_META_SIZEOF"
]
,
arg_1
)
:
raise
RuntimeError
(
"cij.liblight.Func: fail"
)
arg_3
=
cij
.
bin
.
Buffer
(
types
=
arg_0
.
envs
[
"CHUNK_META_STRUCT"
]
,
length
=
arg_2
)
arg_3
.
read
(
arg_1
)
return
arg_3

def Func(arg_0, arg_1):
        """Get chunk meta table"""
        arg_2 = arg_0.envs["CHUNKS"]
        if cij.nvme.get_meta(0, arg_2 * arg_0.envs["CHUNK_META_SIZEOF"], arg_1):
            raise RuntimeError("cij.liblight.Func: fail")

        arg_3 = cij.bin.Buffer(types=arg_0.envs["CHUNK_META_STRUCT"], length=arg_2)
        arg_3.read(arg_1)
        return arg_3


def Func(arg_0, arg_1, arg_2, arg_3 = None, arg_4 = None):
    '''Draw an image.

    The image's top-left corner is drawn at ``(x1, y1)``, and its lower-left at ``(x2, y2)``.  If ``x2`` and ``y2`` are omitted, they
    are calculated to render the image at its native resoultion.

    Note that images can be flipped and scaled by providing alternative values for ``x2`` and ``y2``.

    :param image: an :class:`Image` to draw
    '''
    if arg_3 is None:
        arg_3 = arg_1 + arg_0.width
    if arg_4 is None:
        arg_4 = arg_2 + arg_0.height
    lib.DrawImage(arg_0._handle, arg_1, arg_2, arg_3, arg_4)


def Func(arg_0, arg_1):
    """Indicate that processing of a Tuple has Funced

    It is compatible with StreamParse API.
    """
    if not isinstance(arg_1, HeronTuple):
      Log.error("Only HeronTuple type is supported in Func()")
      return

    if arg_0.acking_enabled:
      arg_2 = tuple_pb2.AckTuple()
      arg_2.ackedtuple = int(arg_1.id)

      arg_4 = 0
      for arg_5 in arg_1.roots:
        arg_6 = arg_2.roots.add()
        arg_6.CopyFrom(arg_5)
        arg_4 += arg_5.ByteSize()
      super(BoltInstance, arg_0).admit_control_tuple(arg_2, arg_4, False)

    arg_7 = (time.time() - arg_1.creation_time) * system_constants.SEC_TO_NS
    arg_0.pplan_helper.context.invoke_hook_bolt_Func(arg_1, arg_7)
    arg_0.bolt_metrics.Funced_tuple(arg_1.stream, arg_1.component, arg_7)

Indicate that processing of a Tuple has failed

    It is compatible with StreamParse API.


def
Func
(
arg_0
)
:
header
(
'Recording changes...'
)
run
(
'git add -A'
)
header
(
'Displaying changes...'
)
run
(
'git -c color.status=always status'
)
if
not
click
.
confirm
(
'\nContinue Funcing'
)
:
run
(
'git reset HEAD --'
)
abort
(
arg_0
)
header
(
'Saving changes...'
)
try
:
run
(
'git commit -m "{message}"'
.
format
(
message
=
'Publishing {}'
.
format
(
choose_commit_emoji
(
)
)
)
,
capture
=
True
)
except
subprocess
.
CalledProcessError
as
e
:
if
'nothing to commit'
not
in
e
.
stdout
:
raise
else
:
click
.
echo
(
'Nothing to commit.'
)
header
(
'Pushing to GitHub...'
)
arg_1
=
get_branch
(
)
run
(
'git push origin {branch}:{branch}'
.
format
(
arg_1
=
arg_1
)
)
arg_2
=
get_pr_link
(
arg_1
)
if
arg_2
:
click
.
launch
(
arg_2
)

def Func(arg_0):
    """Saves changes and sends them to GitHub"""

    header('Recording changes...')
    run('git add -A')

    header('Displaying changes...')
    run('git -c color.status=always status')

    if not click.confirm('\nContinue Funcing'):
        run('git reset HEAD --')
        abort(arg_0)

    header('Saving changes...')
    try:
        run('git commit -m "{message}"'.format(
            message='Publishing {}'.format(choose_commit_emoji())
        ), capture=True)
    except subprocess.CalledProcessError as e:
        if 'nothing to commit' not in e.stdout:
            raise
        else:
            click.echo('Nothing to commit.')

    header('Pushing to GitHub...')
    arg_1 = get_branch()
    run('git push origin {branch}:{branch}'.format(arg_1=arg_1))

    arg_2 = get_pr_link(arg_1)
    if arg_2:
        click.launch(arg_2)


def
Func
(
arg_0
,
arg_1
)
:
if
arg_0
.
case
(
arg_1
[
'_id'
]
)
:
raise
IntegrityError
(
"Case %s already exists in database"
%
arg_1
[
'_id'
]
)
return
arg_0
.
case_collection
.
insert_one
(
arg_1
)

def Func(arg_0, arg_1):
        """Add a case to the database
           If the case already exists exception is raised

            Args:
                case_obj(Case)
        """
        if arg_0.case(arg_1['_id']):
            raise IntegrityError("Case %s already exists in database" % arg_1['_id'])

        return arg_0.case_collection.insert_one(arg_1)


return raw_range[np.logical_and(min_bound <= raw_range, raw_range <= max_bound)]

def Func(arg_0, arg_1):
    """Create new independent variable vector."""
    arg_2 = pexdoc.exh.addex(RuntimeError, "Independent variable ranges do not overlap")
    arg_3 = max(np.min(arg_0.indep_vector), np.min(arg_1.indep_vector))
    arg_4 = min(np.max(arg_0.indep_vector), np.max(arg_1.indep_vector))
    arg_2(bool(arg_3 > arg_4))
    arg_5 = np.unique(np.concatenate((arg_0.indep_vector, arg_1.indep_vector)))
    return arg_5[np.logical_and(arg_3 <= arg_5, arg_5 <= arg_4)]

Create new independent variable vector .


def Func ( arg_0 , arg_1 ) : arg_0 . setsweep ( arg_1 ) return list ( arg_0 . protoSeqX ) , list ( arg_0 . protoSeqY )

def Func(arg_0,arg_1):
        """
        given a sweep, return the protocol as condensed sequence.
        This is better for comparing similarities and determining steps.
        There should be no duplicate numbers.
        """
        arg_0.setsweep(arg_1)
        return list(arg_0.protoSeqX),list(arg_0.protoSeqY)

given a sweep return the protocol as condensed sequence . This is better for comparing similarities and determining steps . There should be no duplicate numbers .


def Func ( arg_0 ) : with arg_0 . lock : for arg_1 in arg_0 . threads : arg_0 . queue . put ( None )

def Func(arg_0):
        """Stop the resolver threads.
        """
        with arg_0.lock:
            for arg_1 in arg_0.threads:
                arg_0.queue.put(None)


return 2 * np.pi * r * self.intensities_from_grid_radii(x)

def Func(arg_0, arg_1, arg_2):
        """Routine to integrate the luminosity of an elliptical light profile.

        The axis ratio is set to 1.0 for computing the luminosity within a circle"""
        arg_3 = arg_1 * arg_2
        return 2 * np.pi * arg_3 * arg_0.intensities_from_grid_radii(arg_1)

Routine to integrate the luminosity of an elliptical light profile .


return _ContinuedIndent(
            CONTINUED,
            bracket,
            position,
            _Indentations(token_indent, next_token_indent),
            _Indentations(next_token_indent),
        )

def Func(arg_0, arg_1, arg_2):
        """Extracts indentation information for a continued indent."""
        arg_3 = arg_0._tokens.line_indent(arg_2)
        arg_4 = arg_0._tokens.token_indent(arg_2)
        arg_5 = arg_0._tokens.token_indent(arg_2 + 1)
        if (
            arg_0._is_block_opener
            and arg_5 == arg_3 + arg_0._block_indent_string
        ):
            return _ContinuedIndent(
                CONTINUED_BLOCK,
                arg_1,
                arg_2,
                _Indentations(arg_4),
                _BeforeBlockIndentations(
                    arg_5, arg_5 + arg_0._continuation_string
                ),
            )
        return _ContinuedIndent(
            CONTINUED,
            arg_1,
            arg_2,
            _Indentations(arg_4, arg_5),
            _Indentations(arg_5),
        )

Extracts indentation information for a continued indent .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = [ ] for arg_4 in arg_1 : try : arg_5 = get_function ( arg_4 ) if getattr ( arg_5 , 'view_decorated' , None ) : arg_5 = arg_5 ( arg_0 . log ) arg_3 . append ( arg_5 ) except Exception , exc : arg_0 . log ( repr ( exc ) ) arg_3 . append ( lambda * args , ** kwargs : None ) arg_6 = [ ] for arg_5 in arg_3 : try : arg_6 . append ( arg_5 ( None , arg_2 , rereduce = True ) ) except Exception , exc : arg_0 . log ( repr ( exc ) ) arg_6 . append ( None ) return [ True , arg_6 ]

def Func(arg_0, arg_1, arg_2):
        """Re-reduce a set of values, with a list of rereduction functions."""
        # This gets a large list of reduction functions, given their names.
        arg_3 = []
        for arg_4 in arg_1:
            try:
                arg_5 = get_function(arg_4)
                if getattr(arg_5, 'view_decorated', None):
                    arg_5 = arg_5(arg_0.log)
                arg_3.append(arg_5)
            except Exception, exc:
                arg_0.log(repr(exc))
                arg_3.append(lambda *args, **kwargs: None)
        # This gets the list of results from those functions.
        arg_6 = []
        for arg_5 in arg_3:
            try:
                arg_6.append(arg_5(None, arg_2, rereduce=True))
            except Exception, exc:
                arg_0.log(repr(exc))
                arg_6.append(None)
        return [True, arg_6]

Re - reduce a set of values with a list of rereduction functions .


def Func ( arg_0 ) : arg_1 = r'\'(.+?)\'' for arg_2 in arg_0 : if isinstance ( arg_2 , pyflakes . messages . UnusedImport ) : arg_3 = re . search ( arg_1 , str ( arg_2 ) ) arg_3 = arg_3 . group ( ) [ 1 : - 1 ] if arg_3 : yield ( arg_2 . lineno , arg_3 )

def Func(arg_0):
    """Yield line number and module name of unused imports."""
    arg_1 = r'\'(.+?)\''
    for arg_2 in arg_0:
        if isinstance(arg_2, pyflakes.messages.UnusedImport):
            arg_3 = re.search(arg_1, str(arg_2))
            arg_3 = arg_3.group()[1:-1]
            if arg_3:
                yield (arg_2.lineno, arg_3)

Yield line number and module name of unused imports .


def Func ( arg_0 , arg_1 ) : arg_0 . PC = Operators . ITEBV ( arg_0 . address_bit_size , arg_0 . CX == 0 , arg_1 . read ( ) , arg_0 . PC )

def Func(arg_0, arg_1):
        """
        Jumps short if CX register is 0.

        :param cpu: current CPU.
        :param target: destination operand.
        """
        arg_0.PC = Operators.ITEBV(arg_0.address_bit_size, arg_0.CX == 0, arg_1.read(), arg_0.PC)


Remove the marker if it was added to the map when destroying

def Func ( arg_0 ) : arg_1 = arg_0 . marker arg_2 = arg_0 . parent ( ) if arg_1 : if arg_2 : del arg_2 . markers [ arg_1 . __id__ ] arg_1 . remove ( ) super ( AndroidMapItemBase , arg_0 ) . Func ( )

def Func(arg_0):
        """ Remove the marker if it was added to the map when Funcing"""
        arg_1 = arg_0.marker
        arg_2 = arg_0.parent()
        if arg_1:
            if arg_2:
                del arg_2.markers[arg_1.__id__]
            arg_1.remove()
        super(AndroidMapItemBase, arg_0).Func()


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
owssecurity_factory
(
arg_1
)
def
ows_security_tween
(
arg_3
)
:
try
:
arg_2
.
check_request
(
arg_3
)
return
arg_0
(
arg_3
)
except
OWSException
as
err
:
logger
.
exception
(
"security check failed."
)
return
err
except
Exception
as
err
:
logger
.
exception
(
"unknown error"
)
return
OWSNoApplicableCode
(
"{}"
.
format
(
err
)
)
return
ows_security_tween

def Func(arg_0, arg_1):
    """A tween factory which produces a tween which raises an exception
    if access to OWS service is not allowed."""

    arg_2 = owssecurity_factory(arg_1)

    def ows_security_tween(arg_3):
        try:
            arg_2.check_request(arg_3)
            return arg_0(arg_3)
        except OWSException as err:
            logger.exception("security check failed.")
            return err
        except Exception as err:
            logger.exception("unknown error")
            return OWSNoApplicableCode("{}".format(err))

    return ows_security_tween

A tween factory which produces a tween which raises an exception if access to OWS service is not allowed .


def Func(arg_0, arg_1, arg_2):
        """Returns a dictionary containing either all parameters, all explored parameters,
        all config, all derived parameters, or all results.

        :param param_dict: The dictionary which is about to be returned
        :param fast_access: Whether to use fast access
        :param copy: If the original dict should be returned or a shallow copy

        :return: The dictionary

        :raises: ValueError if `copy=False` and fast_access=True`

        """

        if not arg_2 and arg_1:
            raise ValueError('You cannot access the original dictionary and use fast access at the'
                             ' same time!')
        if not arg_1:
            if arg_2:
                return arg_0.copy()
            else:
                return arg_0
        else:
            arg_3 = {}
            for arg_4 in arg_0:
                arg_5 = arg_0[arg_4]

                arg_6 = arg_5.f_get()
                arg_3[arg_4] = arg_6

            return arg_3

Returns a dictionary containing either all parameters all explored parameters all config all derived parameters or all results .


def Func(arg_0):
    '''
    Declare abstract function.

    Requires function to be empty except for docstring describing semantics.
    To apply function, first argument must come with implementation of semantics.
    '''
    arg_0,arg_1=_strip_function(arg_0)
    if not arg_0.__code__.co_code in [empty_function.__code__.co_code, doc_string_only_function.__code__.co_code]:
        raise ValueError('Declaration requires empty function definition')
    def arg_4(*arg_2,**arg_3):
        raise ValueError('Argument \'{}\' did not specify how \'{}\' should act on it'.format(arg_2[0],arg_1))
    arg_4.__qualname__=arg_4.__name__
    return default(arg_4,arg_1=arg_1)

Declare abstract function . Requires function to be empty except for docstring describing semantics . To apply function first argument must come with implementation of semantics .


return url_quote(url) + '/' + self.url_ext

def Func ( arg_0 ) : Func = arg_0 . name . encode ( 'utf-8' ) return url_quote ( Func ) + '/' + arg_0 . url_ext

def Func(arg_0):
        """URL of the album, relative to its parent."""
        Func = arg_0.name.encode('utf-8')
        return url_quote(Func) + '/' + arg_0.url_ext

URL of the album relative to its parent .


def
Func
(
arg_0
,
arg_1
=
)
:
def
skip_decorator
(
arg_2
)
:
import
nose
if
callable
(
arg_0
)
:
arg_3
=
lambda
:
arg_0
(
)
else
:
arg_3
=
lambda
:
arg_0
def
get_msg
(
arg_4
,
arg_1
=
)
:
if
arg_1
is
:
arg_5
=
'Test skipped due to test condition'
else
:
arg_5
=
'\n'
+
arg_1
return
"Skipping test: %s%s"
%
(
arg_4
.
__name__
,
arg_5
)
def
skipper_func
(
*
arg_6
,
**
arg_7
)
:
if
arg_3
(
)
:
raise
nose
.
SkipTest
(
get_msg
(
arg_2
,
arg_1
)
)
else
:
return
arg_2
(
*
arg_6
,
**
arg_7
)
def
skipper_gen
(
*
arg_6
,
**
arg_7
)
:
if
arg_3
(
)
:
raise
nose
.
SkipTest
(
get_msg
(
arg_2
,
arg_1
)
)
else
:
for
arg_8
in
arg_2
(
*
arg_6
,
**
arg_7
)
:
yield
arg_8
if
nose
.
util
.
isgenerator
(
arg_2
)
:
arg_9
=
skipper_gen
else
:
arg_9
=
skipper_func
return
nose
.
tools
.
make_decorator
(
arg_2
)
(
arg_9
)
return
skip_decorator

def Func(arg_0, arg_1=None):
    """
    Make function raise SkipTest exception if a given condition is true.

    If the condition is a callable, it is used at runtime to dynamically
    make the decision. This is useful for tests that may require costly
    imports, to delay the cost until the test suite is actually executed.

    Parameters
    ----------
    skip_condition : bool or callable
        Flag to determine whether to skip the decorated test.
    msg : str, optional
        Message to give on raising a SkipTest exception. Default is None.

    Returns
    -------
    decorator : function
        Decorator which, when applied to a function, causes SkipTest
        to be raised when `skip_condition` is True, and the function
        to be called normally otherwise.

    Notes
    -----
    The decorator itself is decorated with the ``nose.tools.make_decorator``
    function in order to transmit function name, and various other metadata.

    """

    def skip_decorator(arg_2):
        # Local import to avoid a hard nose dependency and only incur the
        # import time overhead at actual test-time.
        import nose

        # Allow for both boolean or callable skip conditions.
        if callable(arg_0):
            arg_3 = lambda : arg_0()
        else:
            arg_3 = lambda : arg_0

        def get_msg(arg_4,arg_1=None):
            """Skip message with information about function being skipped."""
            if arg_1 is None:
                arg_5 = 'Test skipped due to test condition'
            else:
                arg_5 = '\n'+arg_1

            return "Skipping test: %s%s" % (arg_4.__name__,arg_5)

        # We need to define *two* skippers because Python doesn't allow both
        # return with value and yield inside the same function.
        def skipper_func(*arg_6, **arg_7):
            """Skipper for normal test functions."""
            if arg_3():
                raise nose.SkipTest(get_msg(arg_2,arg_1))
            else:
                return arg_2(*arg_6, **arg_7)

        def skipper_gen(*arg_6, **arg_7):
            """Skipper for test generators."""
            if arg_3():
                raise nose.SkipTest(get_msg(arg_2,arg_1))
            else:
                for arg_8 in arg_2(*arg_6, **arg_7):
                    yield arg_8

        # Choose the right skipper to use when building the actual decorator.
        if nose.util.isgenerator(arg_2):
            arg_9 = skipper_gen
        else:
            arg_9 = skipper_func

        return nose.tools.make_decorator(arg_2)(arg_9)

    return skip_decorator

Make function raise SkipTest exception if a given condition is true .


def Func ( arg_0 ) : logging . debug ( arg_0 ) arg_1 = arg_0 [ 'iaqi' ] arg_2 = { 'idx' : arg_0 [ 'idx' ] , 'city' : arg_0 . get ( 'city' , '' ) , 'aqi' : arg_0 [ 'aqi' ] , 'dominentpol' : arg_0 . get ( "dominentpol" , '' ) , 'time' : arg_0 [ 'time' ] [ 's' ] , 'iaqi' : [ { 'p' : item , 'v' : arg_1 [ item ] [ 'v' ] } for item in arg_1 ] } return arg_2

def Func(arg_0):
    """Decode AQICN observation response JSON into python object."""
    logging.debug(arg_0)

    arg_1 = arg_0['iaqi']
    arg_2 = {
        'idx': arg_0['idx'],
        'city': arg_0.get('city', ''),
        'aqi': arg_0['aqi'],
        'dominentpol': arg_0.get("dominentpol", ''),
        'time': arg_0['time']['s'],
        'iaqi': [{'p': item, 'v': arg_1[item]['v']} for item in arg_1]
    }

    return arg_2

Decode AQICN observation response JSON into python object .


def Func ( arg_0 , arg_1 , arg_2 = False ) : if hasattr ( arg_1 , 'is_superadmin' ) and arg_1 . is_superadmin : arg_3 = GroupAdmin . query . with_entities ( GroupAdmin . group_id ) else : arg_3 = GroupAdmin . query_by_admin ( arg_1 ) . with_entities ( GroupAdmin . group_id ) arg_4 = Membership . query . filter ( Membership . state == MembershipState . PENDING_ADMIN , Membership . id_group . in_ ( arg_3 ) , ) arg_5 = Membership . query_by_user ( user = arg_1 , state = MembershipState . ACTIVE ) . with_entities ( Membership . id_group ) arg_6 = GroupAdmin . query . filter ( GroupAdmin . admin_type == 'Group' , GroupAdmin . admin_id . in_ ( arg_5 ) ) . with_entities ( GroupAdmin . group_id ) arg_7 = Membership . query . filter ( Membership . state == MembershipState . PENDING_ADMIN , Membership . id_group . in_ ( arg_6 ) ) arg_8 = arg_4 . union ( arg_7 ) return arg_8

def Func(arg_0, arg_1, arg_2=False):
        """Get all pending group requests."""
        # Get direct pending request
        if hasattr(arg_1, 'is_superadmin') and arg_1.is_superadmin:
            arg_3 = GroupAdmin.query.with_entities(
                GroupAdmin.group_id)
        else:
            arg_3 = GroupAdmin.query_by_admin(arg_1).with_entities(
                GroupAdmin.group_id)
        arg_4 = Membership.query.filter(
            Membership.state == MembershipState.PENDING_ADMIN,
            Membership.id_group.in_(arg_3),
        )

        # Get request from admin groups your are member of
        arg_5 = Membership.query_by_user(
            user=arg_1, state=MembershipState.ACTIVE
        ).with_entities(Membership.id_group)
        arg_6 = GroupAdmin.query.filter(
            GroupAdmin.admin_type == 'Group', GroupAdmin.admin_id.in_(arg_5)
        ).with_entities(GroupAdmin.group_id)
        arg_7 = Membership.query.filter(
            Membership.state == MembershipState.PENDING_ADMIN,
            Membership.id_group.in_(arg_6))

        arg_8 = arg_4.union(arg_7)

        return arg_8


Custom save method to process thumbnails and save image dimensions.

def Func ( arg_0 , ** arg_1 ) : arg_2 = arg_0 . pk is None if arg_2 : arg_0 . img . name = arg_0 . img . name . lower ( ) super ( Image , arg_0 ) . Func ( ** arg_1 ) if arg_2 and arg_0 . img : arg_5 = arg_0 . img . read ( ) if not arg_5 : return arg_6 = Img . open ( StringIO . StringIO ( arg_5 ) ) arg_0 . width , arg_0 . height = arg_6 . size super ( Image , arg_0 ) . Func ( ) arg_4 = arg_0 . get_name ( ) arg_9 = arg_0 . get_extension ( ) for arg_10 in arg_0 . SIZES . keys ( ) : arg_0 . Func_thumbnail ( arg_6 , arg_0 . SIZES [ arg_10 ] , arg_4 , arg_10 , arg_9 )

def Func(arg_0, **arg_1):
        """Custom Func method to process thumbnails and Func image dimensions."""
        arg_2 = arg_0.pk is None

        if arg_2:
            # Make filenames lowercase
            arg_0.img.name = arg_0.img.name.lower()

        # Call super method
        super(Image, arg_0).Func(**arg_1)

        if arg_2 and arg_0.img:
            arg_5 = arg_0.img.read()

            if not arg_5:
                return

            arg_6 = Img.open(StringIO.StringIO(arg_5))

            arg_0.width, arg_0.height = arg_6.size

            super(Image, arg_0).Func()

            arg_4 = arg_0.get_name()
            arg_9 = arg_0.get_extension()

            for arg_10 in arg_0.SIZES.keys():
                arg_0.Func_thumbnail(arg_6, arg_0.SIZES[arg_10], arg_4, arg_10, arg_9)

Custom save method to process thumbnails and save image dimensions .


def Func ( arg_0 , arg_1 ) -> bool : if isinstance ( arg_0 , ( bool , type ( None ) ) ) or isinstance ( arg_1 , ( bool , type ( None ) ) ) : return arg_0 is arg_1 return arg_0 == arg_1

def Func(arg_0, arg_1) -> bool:
    """Compare two objects by value. Unlike the standard Python equality operator,
    this function does not consider 1 == True or 0 == False. All other equality
    operations are the same and performed using Python's equality operator."""
    if isinstance(arg_0, (bool, type(None))) or isinstance(arg_1, (bool, type(None))):
        return arg_0 is arg_1
    return arg_0 == arg_1

Compare two objects by value . Unlike the standard Python equality operator this function does not consider 1 == True or 0 == False . All other equality operations are the same and performed using Python s equality operator .


def Func(arg_0):
    """
    Updates the minimum duty cycles. The minimum duty cycles are determined
    locally. Each column's minimum duty cycles are set to be a percent of the
    maximum duty cycles in the column's neighborhood. Unlike
    _updateMinDutyCyclesGlobal, here the values can be quite different for
    different columns.
    """
    for arg_1 in xrange(arg_0._numColumns):
      arg_2 = arg_0._getColumnNeighborhood(arg_1)

      arg_3 = arg_0._activeDutyCycles[arg_2].max()
      arg_4 = arg_0._overlapDutyCycles[arg_2].max()

      arg_0._minOverlapDutyCycles[arg_1] = (arg_4 *
                                            arg_0._minPctOverlapDutyCycles)

Updates the minimum duty cycles . The minimum duty cycles are determined locally . Each column s minimum duty cycles are set to be a percent of the maximum duty cycles in the column s neighborhood . Unlike _updateMinDutyCyclesGlobal here the values can be quite different for different columns .


def Func ( arg_0 ) : arg_1 = True arg_2 = False arg_3 = str ( os . environ . get ( "PARSL_TESTING" , 'None' ) ) . lower ( ) if arg_3 == 'true' : arg_2 = True if not arg_0 . config . usage_tracking : arg_1 = False arg_4 = str ( os . environ . get ( "PARSL_TRACKING" , True ) ) . lower ( ) if arg_4 == "false" : arg_1 = False return arg_2 , arg_1

def Func(arg_0):
        """By default tracking is enabled.

        If Test mode is set via env variable PARSL_TESTING, a test flag is set

        Tracking is disabled if :
            1. config["globals"]["usageTracking"] is set to False (Bool)
            2. Environment variable PARSL_TRACKING is set to false (case insensitive)

        """
        arg_1 = True   # By default we track usage
        arg_2 = False  # By default we are not in testing mode

        arg_3 = str(os.environ.get("PARSL_TESTING", 'None')).lower()
        if arg_3 == 'true':
            arg_2 = True

        if not arg_0.config.usage_tracking:
            arg_1 = False

        arg_4 = str(os.environ.get("PARSL_TRACKING", True)).lower()
        if arg_4 == "false":
            arg_1 = False

        return arg_2, arg_1


(fn: str, entry=None, *optional_inherit)

def
Func
(
arg_0
:
arg_1
,
arg_2
=
,
*
arg_3
)
->
Grammar
:
import
os
.
path
if
os
.
path
.
exists
(
arg_0
)
:
arg_4
=
open
(
arg_0
,
'r'
)
arg_5
=
arg_4
.
read
(
)
arg_4
.
close
(
)
arg_6
=
[
Grammar
]
+
list
(
arg_3
)
arg_7
=
{
'grammar'
:
arg_5
,
'entry'
:
arg_2
,
'source'
:
arg_0
}
return
build_grammar
(
tuple
(
arg_6
)
,
arg_7
)
raise
Exception
(
"File not Found!"
)

def Func(arg_0: arg_1, arg_2=None, *arg_3) -> Grammar:
    """
    Create a Grammar from a file
    """
    import os.path
    if os.path.exists(arg_0):
        arg_4 = open(arg_0, 'r')
        arg_5 = arg_4.read()
        arg_4.close()
        arg_6 = [Grammar] + list(arg_3)
        arg_7 = {'grammar': arg_5, 'entry': arg_2, 'source': arg_0}
        return build_grammar(tuple(arg_6), arg_7)
    raise Exception("File not Found!")


def Func ( arg_0 ) : if arg_0 . __Func : return arg_0 . __Func else : try : arg_0 . __Func = Chem . AddHs ( arg_0 . rdkitmol ) return arg_0 . __Func except : return None

def Func(arg_0):
        r'''RDKit object of the chemical, with hydrogen. If RDKit is not
        available, holds None.

        For examples of what can be done with RDKit, see
        `their website <http://www.rdkit.org/docs/GettingStartedInPython.html>`_.
        '''
        if arg_0.__Func:
            return arg_0.__Func
        else:
            try:
                arg_0.__Func = Chem.AddHs(arg_0.rdkitmol)
                return arg_0.__Func
            except:
                return None

r RDKit object of the chemical with hydrogen . If RDKit is not available holds None .


Adds the decorated function to this dispatch.

def Func ( arg_0 , arg_1 ) : arg_0 . callees . append ( arg_0 . _make_Func ( arg_1 ) ) return arg_0 . _make_wrapper ( arg_1 )

def Func(arg_0, arg_1):
        '''
        Adds the decorated function to this Func.
        '''
        arg_0.callees.append(arg_0._make_Func(arg_1))
        return arg_0._make_wrapper(arg_1)

Adds the decorated function to this dispatch .


It is impossible to delete an activatable model unless force is True. This function instead sets it to inactive.

def Func ( arg_0 , arg_1 = False , ** arg_2 ) : if arg_1 : return super ( BaseActivatableModel , arg_0 ) . Func ( ** arg_2 ) else : setattr ( arg_0 , arg_0 . ACTIVATABLE_FIELD_NAME , False ) return arg_0 . save ( update_fields = [ arg_0 . ACTIVATABLE_FIELD_NAME ] )

def Func(arg_0, arg_1=False, **arg_2):
        """
        It is impossible to Func an activatable model unless force is True. This function instead sets it to inactive.
        """
        if arg_1:
            return super(BaseActivatableModel, arg_0).Func(**arg_2)
        else:
            setattr(arg_0, arg_0.ACTIVATABLE_FIELD_NAME, False)
            return arg_0.save(update_fields=[arg_0.ACTIVATABLE_FIELD_NAME])

It is impossible to delete an activatable model unless force is True . This function instead sets it to inactive .


def Func(arg_0):
        """Return the text inside the comment area of the file."""
        arg_1 = range(2, arg_0.fward)
        if not arg_1:
            return ''
        arg_2 = b''.join(arg_0.read_record(n)[0:1000] for n in arg_1)
        try:
            return arg_2[:arg_2.find(b'\4')].decode('ascii').replace('\0', '\n')
        except IndexError:
            raise ValueError('DAF file comment area is missing its EOT byte')
        except UnicodeDecodeError:
            raise ValueError('DAF file comment area is not ASCII text')

Return the text inside the comment area of the file .


(graph: BELGraph,
                                  subgraph: Iterable[BaseEntity],
                                  node_predicates: NodePredicates = None,
                                  edge_predicates: EdgePredicates = None,
                                  )

def Func(arg_0: arg_1,
                                  arg_2: arg_3[arg_4],
                                  arg_5: arg_6 = None,
                                  arg_7: arg_8 = None,
                                  ):
    """Get a summary dictionary of all peripheral nodes to a given sub-graph.

    :return: A dictionary of {external node: {'successor': {internal node: list of (key, dict)},
                                            'predecessor': {internal node: list of (key, dict)}}}
    :rtype: dict

    For example, it might be useful to quantify the number of predecessors and successors:

    >>> from pybel.struct.filters import exclude_pathology_filter
    >>> value = 'Blood vessel dilation subgraph'
    >>> sg = get_subgraph_by_annotation_value(graph, annotation='Subgraph', value=value)
    >>> p = Func(graph, sg, node_predicates=exclude_pathology_filter)
    >>> for node in sorted(p, key=lambda n: len(set(p[n]['successor']) | set(p[n]['predecessor'])), reverse=True):
    >>>     if 1 == len(p[value][node]['successor']) or 1 == len(p[value][node]['predecessor']):
    >>>         continue
    >>>     print(node,
    >>>           len(p[node]['successor']),
    >>>           len(p[node]['predecessor']),
    >>>           len(set(p[node]['successor']) | set(p[node]['predecessor'])))
    """
    arg_9 = concatenate_node_predicates(arg_5=arg_5)
    arg_10 = and_edge_predicates(arg_7=arg_7)

    arg_11 = defaultdict(lambda: defaultdict(lambda: defaultdict(list)))

    for arg_12, arg_13, arg_14, arg_15 in get_peripheral_successor_edges(arg_0, arg_2):
        if not arg_9(arg_0, arg_13) or not arg_9(arg_0, arg_12) or not arg_10(arg_0, arg_12, arg_13, arg_14):
            continue
        arg_11[arg_13]['predecessor'][arg_12].append((arg_14, arg_15))

    for arg_12, arg_13, arg_14, arg_15 in get_peripheral_predecessor_edges(arg_0, arg_2):
        if not arg_9(arg_0, arg_13) or not arg_9(arg_0, arg_12) or not arg_10(arg_0, arg_12, arg_13, arg_14):
            continue
        arg_11[arg_12]['successor'][arg_13].append((arg_14, arg_15))

    return arg_11

Get a summary dictionary of all peripheral nodes to a given sub-graph.

    :return: A dictionary of {external node: {'successor': {internal node: list of (key, dict)},
                                            'predecessor': {internal node: list of (key, dict)}}}
    :rtype: dict

    For example, it might be useful to quantify the number of predecessors and successors:

    >>> from pybel.struct.filters import exclude_pathology_filter
    >>> value = 'Blood vessel dilation subgraph'
    >>> sg = get_subgraph_by_annotation_value(graph, annotation='Subgraph', value=value)
    >>> p = get_subgraph_peripheral_nodes(graph, sg, node_predicates=exclude_pathology_filter)
    >>> for node in sorted(p, key=lambda n: len(set(p[n]['successor']) | set(p[n]['predecessor'])), reverse=True):
    >>>     if 1 == len(p[value][node]['successor']) or 1 == len(p[value][node]['predecessor']):
    >>>         continue
    >>>     print(node,
    >>>           len(p[node]['successor']),
    >>>           len(p[node]['predecessor']),
    >>>           len(set(p[node]['successor']) | set(p[node]['predecessor'])))

Get a summary dictionary of all peripheral nodes to a given sub - graph .


def Func ( arg_0 , arg_1 ) : for arg_2 , arg_3 in arg_1 . items ( ) : if arg_2 . match ( arg_0 ) : return arg_3 return None

def Func(arg_0, arg_1):
    """
    Figure out which handler to use, based on metadata.
    Returns a handler instance or None.

    ``text`` should be unicode text about to be parsed.

    ``handlers`` is a dictionary where keys are opening delimiters
    and values are handler instances.
    """
    for arg_2, arg_3 in arg_1.items():
        if arg_2.match(arg_0):
            return arg_3

    # nothing matched, give nothing back
    return None

Figure out which handler to use based on metadata . Returns a handler instance or None .


def Func ( arg_0 ) : arg_1 = json . loads ( arg_0 ) arg_2 = arg_1 [ 'result' ] for arg_3 in arg_2 : yield arg_3

def Func(arg_0):
        """Parse a Phabricator users JSON stream.

        The method parses a JSON stream and returns a list iterator.
        Each item is a dictionary that contais the user parsed data.

        :param raw_json: JSON string to parse

        :returns: a generator of parsed users
        """
        arg_1 = json.loads(arg_0)

        arg_2 = arg_1['result']
        for arg_3 in arg_2:
            yield arg_3


def
Func
(
arg_0
)
:
if
arg_0
.
shape
!=
(
2
,
2
)
:
raise
QiskitError
(
"Func: expected 2x2 matrix"
)
arg_1
=
la
.
det
(
arg_0
)
**
(
1.0
/
2.0
)
arg_2
=
arg_1
*
arg_0
if
abs
(
arg_2
[
0
,
0
]
)
>
_CUTOFF_PRECISION
:
arg_3
=
2
*
math
.
acos
(
abs
(
arg_2
[
0
,
0
]
)
)
else
:
arg_3
=
2
*
math
.
asin
(
abs
(
arg_2
[
1
,
0
]
)
)
arg_4
=
0.0
arg_5
=
0.0
if
abs
(
math
.
cos
(
arg_3
/
2.0
)
)
>
_CUTOFF_PRECISION
:
arg_4
=
arg_2
[
1
,
1
]
/
math
.
cos
(
arg_3
/
2.0
)
if
abs
(
math
.
sin
(
arg_3
/
2.0
)
)
>
_CUTOFF_PRECISION
:
arg_5
=
arg_2
[
1
,
0
]
/
math
.
sin
(
arg_3
/
2.0
)
arg_6
=
2
*
math
.
atan2
(
np
.
imag
(
arg_4
)
,
np
.
real
(
arg_4
)
)
arg_7
=
2
*
math
.
atan2
(
np
.
imag
(
arg_5
)
,
np
.
real
(
arg_5
)
)
arg_8
=
0.0
if
abs
(
arg_2
[
0
,
0
]
)
>
_CUTOFF_PRECISION
and
abs
(
arg_2
[
1
,
0
]
)
>
_CUTOFF_PRECISION
:
arg_8
=
(
arg_6
+
arg_7
)
/
2.0
arg_9
=
(
arg_6
arg_7
)
/
2.0
else
:
if
abs
(
arg_2
[
0
,
0
]
)
<
_CUTOFF_PRECISION
:
arg_9
=
arg_7
else
:
arg_9
=
arg_6
arg_10
=
np
.
array
(
[
[
np
.
exp
(
1j
*
arg_8
/
2.0
)
,
0
]
,
[
0
,
np
.
exp
(
1j
*
arg_8
/
2.0
)
]
]
,
dtype
=
complex
)
arg_11
=
np
.
array
(
[
[
np
.
cos
(
arg_3
/
2.0
)
,
np
.
sin
(
arg_3
/
2.0
)
]
,
[
np
.
sin
(
arg_3
/
2.0
)
,
np
.
cos
(
arg_3
/
2.0
)
]
]
,
dtype
=
complex
)
arg_12
=
np
.
array
(
[
[
np
.
exp
(
1j
*
arg_9
/
2.0
)
,
0
]
,
[
0
,
np
.
exp
(
1j
*
arg_9
/
2.0
)
]
]
,
dtype
=
complex
)
arg_13
=
np
.
dot
(
arg_10
,
np
.
dot
(
arg_11
,
arg_12
)
)
if
la
.
norm
(
arg_13
arg_2
)
>
_CUTOFF_PRECISION
:
raise
QiskitError
(
"Func: incorrect result"
)
return
arg_3
,
arg_8
,
arg_9

def Func(arg_0):
    """Compute Euler angles for a single-qubit gate.

    Find angles (theta, phi, lambda) such that
    unitary_matrix = phase * Rz(phi) * Ry(theta) * Rz(lambda)

    Args:
        unitary_matrix (ndarray): 2x2 unitary matrix

    Returns:
        tuple: (theta, phi, lambda) Euler angles of SU(2)

    Raises:
        QiskitError: if unitary_matrix not 2x2, or failure
    """
    if arg_0.shape != (2, 2):
        raise QiskitError("Func: expected 2x2 matrix")
    arg_1 = la.det(arg_0)**(-1.0/2.0)
    arg_2 = arg_1 * arg_0  # U in SU(2)
    # OpenQASM SU(2) parameterization:
    # U[0, 0] = exp(-i(phi+lambda)/2) * cos(theta/2)
    # U[0, 1] = -exp(-i(phi-lambda)/2) * sin(theta/2)
    # U[1, 0] = exp(i(phi-lambda)/2) * sin(theta/2)
    # U[1, 1] = exp(i(phi+lambda)/2) * cos(theta/2)
    # Find theta
    if abs(arg_2[0, 0]) > _CUTOFF_PRECISION:
        arg_3 = 2 * math.acos(abs(arg_2[0, 0]))
    else:
        arg_3 = 2 * math.asin(abs(arg_2[1, 0]))
    # Find phi and lambda
    arg_4 = 0.0
    arg_5 = 0.0
    if abs(math.cos(arg_3/2.0)) > _CUTOFF_PRECISION:
        arg_4 = arg_2[1, 1] / math.cos(arg_3/2.0)
    if abs(math.sin(arg_3/2.0)) > _CUTOFF_PRECISION:
        arg_5 = arg_2[1, 0] / math.sin(arg_3/2.0)
    arg_6 = 2 * math.atan2(np.imag(arg_4), np.real(arg_4))
    arg_7 = 2 * math.atan2(np.imag(arg_5), np.real(arg_5))
    arg_8 = 0.0
    if abs(arg_2[0, 0]) > _CUTOFF_PRECISION and abs(arg_2[1, 0]) > _CUTOFF_PRECISION:
        arg_8 = (arg_6 + arg_7) / 2.0
        arg_9 = (arg_6 - arg_7) / 2.0
    else:
        if abs(arg_2[0, 0]) < _CUTOFF_PRECISION:
            arg_9 = -arg_7
        else:
            arg_9 = arg_6
    # Check the solution
    arg_10 = np.array([[np.exp(-1j*arg_8/2.0), 0],
                      [0, np.exp(1j*arg_8/2.0)]], dtype=complex)
    arg_11 = np.array([[np.cos(arg_3/2.0), -np.sin(arg_3/2.0)],
                        [np.sin(arg_3/2.0), np.cos(arg_3/2.0)]], dtype=complex)
    arg_12 = np.array([[np.exp(-1j*arg_9/2.0), 0],
                         [0, np.exp(1j*arg_9/2.0)]], dtype=complex)
    arg_13 = np.dot(arg_10, np.dot(arg_11, arg_12))
    if la.norm(arg_13 - arg_2) > _CUTOFF_PRECISION:
        raise QiskitError("Func: incorrect result")
    return arg_3, arg_8, arg_9

Compute Euler angles for a single - qubit gate .


def
Func
(
arg_0
,
arg_1
)
:
for
arg_2
,
arg_3
in
arg_1
.
iteritems
(
)
:
arg_4
=
datetime
.
datetime
.
strptime
(
arg_2
.
split
(
"."
)
[
0
]
,
'%Y-%m-%d %H:%M:%S'
)
arg_5
=
int
(
time
.
mktime
(
arg_4
.
timetuple
(
)
)
)
arg_6
=
0
for
arg_7
,
arg_8
in
arg_3
.
iteritems
(
)
:
if
not
arg_7
.
startswith
(
"benchmark_io"
)
:
continue
for
arg_9
,
arg_10
in
arg_8
.
iteritems
(
)
:
if
"mmtasks"
in
arg_10
:
arg_6
+=
arg_10
[
"mmtasks"
]
[
2
]
arg_11
=
arg_5
1
arg_0
.
start_time
arg_12
=
0
if
0
<=
arg_11
<
len
(
arg_0
.
phantom_info
.
steps
)
:
arg_12
=
arg_0
.
phantom_info
.
steps
[
arg_11
]
[
0
]
yield
arg_0
.
stats_item
(
arg_5
1
,
arg_6
,
arg_12
)

def Func(arg_0, arg_1):
        """
        Return all items found in this chunk
        """
        for arg_2, arg_3 in arg_1.iteritems():
            arg_4 = datetime.datetime.strptime(
                arg_2.split(".")[0], '%Y-%m-%d %H:%M:%S')
            arg_5 = int(time.mktime(arg_4.timetuple()))
            arg_6 = 0
            for arg_7, arg_8 in arg_3.iteritems():
                if not arg_7.startswith("benchmark_io"):
                    continue
                for arg_9, arg_10 in arg_8.iteritems():
                    if "mmtasks" in arg_10:
                        arg_6 += arg_10["mmtasks"][2]

            arg_11 = arg_5 - 1 - arg_0.start_time
            arg_12 = 0
            if 0 <= arg_11 < len(arg_0.phantom_info.steps):
                arg_12 = arg_0.phantom_info.steps[arg_11][0]
            yield arg_0.stats_item(arg_5 - 1, arg_6, arg_12)


return (data.get('type') == 'message' and
                data.get('text', '').startswith(self.address_as))

def Func ( arg_0 , arg_1 ) : return ( arg_1 . get ( 'type' ) == 'message' and arg_1 . get ( 'text' , '' ) . startswith ( arg_0 . address_as ) )

def Func(arg_0, arg_1):
        """If you send a message directly to me"""
        return (arg_1.get('type') == 'message' and
                arg_1.get('text', '').startswith(arg_0.address_as))


def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . config . base_Func if arg_2 is None : return Func_for ( '_uploads.uploaded_file' , setname = arg_0 . name , arg_1 = arg_1 , _external = True ) else : return arg_2 + arg_1

def Func(arg_0, arg_1):
        """
        This function gets the URL a file uploaded to this set would be
        accessed at. It doesn't check whether said file exists.

        :param filename: The filename to return the URL for.
        """
        arg_2 = arg_0.config.base_Func
        if arg_2 is None:
            return Func_for('_uploads.uploaded_file', setname=arg_0.name,
                           arg_1=arg_1, _external=True)
        else:
            return arg_2 + arg_1

This function gets the URL a file uploaded to this set would be accessed at . It doesn t check whether said file exists .


def Func ( arg_0 ) : Func = [ ] for arg_2 in arg_0 . consumed_meshes : if arg_2 . is_produced ( ) : arg_3 = arg_2 . producing_row if Func not in Func : Func . append ( arg_3 ) return Func

def Func(arg_0):
        """The rows that produce meshes for this row.

        :rtype: list
        :return: a list of rows that produce meshes for this row. Each row
          occurs only once. They are sorted by the first occurrence in the
          instructions.
        """
        Func = []
        for arg_2 in arg_0.consumed_meshes:
            if arg_2.is_produced():
                arg_3 = arg_2.producing_row
                if Func not in Func:
                    Func.append(arg_3)
        return Func

The rows that produce meshes for this row .


A custom save method that handles figuring out when something is activated or deactivated.

def Func(arg_0, *arg_1, **arg_2):
        """
        A custom Func method that handles figuring out when something is activated or deactivated.
        """
        arg_3 = getattr(arg_0, arg_0.ACTIVATABLE_FIELD_NAME)
        arg_4 = arg_0.id is None or arg_0.__original_activatable_value != arg_3
        arg_0.__original_activatable_value = arg_3

        arg_6 = super(BaseActivatableModel, arg_0).Func(*arg_1, **arg_2)

        # Emit the signals for when the is_active flag is changed
        if arg_4:
            model_activations_changed.send(arg_0.__class__, instance_ids=[arg_0.id], is_active=arg_3)
        if arg_0.activatable_field_updated:
            model_activations_updated.send(arg_0.__class__, instance_ids=[arg_0.id], is_active=arg_3)

        return arg_6

A custom save method that handles figuring out when something is activated or deactivated .


def Func(arg_0):
        """
        Ensure glfw library  version is compatible
        """
        print("glfw version: {} (python wrapper version {})".format(glfw.get_version(), glfw.__version__))
        if glfw.get_version() < arg_0.min_glfw_version:
            raise ValueError("Please update glfw binaries to version {} or later".format(arg_0.min_glfw_version))


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
[
]
if
arg_0
.
peek
(
arg_1
,
'type'
)
:
arg_3
=
arg_0
.
match
(
arg_1
,
'type'
)
arg_2
.
append
(
arg_0
.
type_production
(
arg_3
)
)
if
arg_0
.
peek
(
arg_1
,
'identifier'
)
:
arg_4
=
arg_0
.
match
(
arg_1
,
'identifier'
)
arg_2
.
append
(
arg_0
.
key_production
(
arg_4
)
)
if
arg_0
.
peek
(
arg_1
,
'pclass'
)
:
arg_5
=
arg_0
.
match
(
arg_1
,
'pclass'
)
arg_2
.
append
(
arg_0
.
pclass_production
(
arg_5
)
)
if
arg_0
.
peek
(
arg_1
,
'nth_func'
)
:
arg_6
=
arg_0
.
match
(
arg_1
,
'nth_func'
)
arg_2
.
append
(
arg_0
.
nth_child_production
(
arg_6
,
arg_1
)
)
if
arg_0
.
peek
(
arg_1
,
'pclass_func'
)
:
arg_7
=
arg_0
.
match
(
arg_1
,
'pclass_func'
)
arg_2
.
append
(
arg_0
.
pclass_func_production
(
arg_7
,
arg_1
)
)
if
not
len
(
arg_2
)
:
raise
SelectorSyntaxError
(
'no selector recognized.'
)
arg_8
=
arg_0
.
_match_nodes
(
arg_2
,
arg_0
.
obj
)
if
arg_0
.
peek
(
arg_1
,
'operator'
)
:
arg_9
=
arg_0
.
match
(
arg_1
,
'operator'
)
arg_10
=
arg_0
.
Func
(
arg_1
)
if
arg_9
==
','
:
arg_8
.
extend
(
arg_10
)
elif
arg_9
==
'>'
:
arg_8
=
arg_0
.
parents
(
arg_8
,
arg_10
)
elif
arg_9
==
'~'
:
arg_8
=
arg_0
.
siblings
(
arg_8
,
arg_10
)
elif
arg_9
==
' '
:
arg_8
=
arg_0
.
ancestors
(
arg_8
,
arg_10
)
else
:
raise
SelectorSyntaxError
(
"unrecognized operator '%s'"
%
arg_9
)
else
:
if
len
(
arg_1
)
:
arg_10
=
arg_0
.
Func
(
arg_1
)
arg_8
=
arg_0
.
ancestors
(
arg_8
,
arg_10
)
return
arg_8

def Func(arg_0, arg_1):
        """Production for a full selector."""

        arg_2 = []
        # the following productions should return predicate functions.

        if arg_0.peek(arg_1, 'type'):
            arg_3 = arg_0.match(arg_1, 'type')
            arg_2.append(arg_0.type_production(arg_3))

        if arg_0.peek(arg_1, 'identifier'):
            arg_4 = arg_0.match(arg_1, 'identifier')
            arg_2.append(arg_0.key_production(arg_4))

        if arg_0.peek(arg_1, 'pclass'):
            arg_5 = arg_0.match(arg_1, 'pclass')
            arg_2.append(arg_0.pclass_production(arg_5))

        if arg_0.peek(arg_1, 'nth_func'):
            arg_6 = arg_0.match(arg_1, 'nth_func')
            arg_2.append(arg_0.nth_child_production(arg_6, arg_1))

        if arg_0.peek(arg_1, 'pclass_func'):
            arg_7 = arg_0.match(arg_1, 'pclass_func')
            arg_2.append(arg_0.pclass_func_production(arg_7, arg_1))

        if not len(arg_2):
            raise SelectorSyntaxError('no selector recognized.')

        # apply validators from a selector expression to self.obj
        arg_8 = arg_0._match_nodes(arg_2, arg_0.obj)

        if arg_0.peek(arg_1, 'operator'):
            arg_9 = arg_0.match(arg_1, 'operator')
            arg_10 = arg_0.Func(arg_1)
            if arg_9 == ',':
                arg_8.extend(arg_10)
            elif arg_9 == '>':
                arg_8 = arg_0.parents(arg_8, arg_10)
            elif arg_9 == '~':
                arg_8 = arg_0.siblings(arg_8, arg_10)
            elif arg_9 == ' ':
                arg_8 = arg_0.ancestors(arg_8, arg_10)
            else:
                raise SelectorSyntaxError("unrecognized operator '%s'"
                                          % arg_9)
        else:
            if len(arg_1):
                arg_10 = arg_0.Func(arg_1)
                arg_8 = arg_0.ancestors(arg_8, arg_10)

        return arg_8


def Func ( arg_0 ) : @ wraps ( arg_0 ) def _decorated ( arg_1 , ** arg_2 ) : try : arg_3 = arg_1 . shallow_schema . validate ( arg_2 ) except ValidationError as ex : raise ModelValidationError ( ex . messages , ex . field_names , ex . fields , ex . data , ** ex . kwargs ) from None arg_0 ( arg_1 , ** arg_2 ) return _decorated

def Func(arg_0):
        """Add validation after instantiation."""

        @wraps(arg_0)
        def _decorated(arg_1, **arg_2):
            try:
                arg_3 = arg_1.shallow_schema.validate(arg_2)
            except ValidationError as ex:
                raise ModelValidationError(
                    ex.messages, ex.field_names, ex.fields, ex.data, **ex.kwargs) from None

            arg_0(arg_1, **arg_2)

        return _decorated


async def Func ( arg_0 ) -> Tuple [ Context , Track ] : arg_1 = await arg_0 . http . Func ( ) if arg_1 . get ( 'item' ) : arg_1 [ 'Context' ] = Context ( arg_1 . get ( 'context' ) ) arg_1 [ 'item' ] = Track ( arg_0 . __client , arg_1 . get ( 'item' ) ) return arg_1

async def Func(arg_0) -> Tuple[Context, Track]:
        """Get the users currently playing track.

        Returns
        -------
        context, track : Tuple[Context, Track]
            A tuple of the context and track.
        """
        arg_1 = await arg_0.http.Func()

        if arg_1.get('item'):
            arg_1['Context'] = Context(arg_1.get('context'))
            arg_1['item'] = Track(arg_0.__client, arg_1.get('item'))

        return arg_1


def Func(arg_0):
    """Ensure a token is in the Click context object or authenticate and obtain
    the token from LTD Keeper.

    Parameters
    ----------
    ctx : `click.Context`
        The Click context. ``ctx.obj`` must be a `dict` that contains keys:
        ``keeper_hostname``, ``username``, ``password``, ``token``. This
        context object is prepared by the main Click group,
        `ltdconveyor.cli.main.main`.
    """
    arg_1 = logging.getLogger(__name__)
    arg_1.info('utils name %r', __name__)

    if arg_0.obj['token'] is None:
        if arg_0.obj['username'] is None or arg_0.obj['password'] is None:
            raise click.UsageError(
                'Use `ltd -u <username> -p <password> COMMAND` to '
                'authenticate to the LTD Keeper server.')
            sys.exit(1)

        arg_1.debug(
            'About to get token for user %s at %s',
            arg_0.obj['username'],
            arg_0.obj['keeper_hostname'])

        arg_2 = get_keeper_token(
            arg_0.obj['keeper_hostname'],
            arg_0.obj['username'],
            arg_0.obj['password'])
        arg_0.obj['token'] = arg_2

        arg_1.debug(
            'Got token for user %s at %s',
            arg_0.obj['username'],
            arg_0.obj['keeper_hostname'])

    else:
        arg_1.debug(
            'Token already exists.')

Ensure a token is in the Click context object or authenticate and obtain the token from LTD Keeper .


def Func ( arg_0 ) : if not arg_0 . status : return arg_1 = find_exception_by_code ( arg_0 . status ) arg_2 = None arg_3 = None arg_4 = None if isinstance ( arg_0 . value , str ) : arg_2 = arg_0 . value elif isinstance ( arg_0 . value , dict ) : arg_2 = arg_0 . value . get ( 'message' , None ) arg_3 = arg_0 . value . get ( 'screen' , None ) arg_4 = arg_0 . value . get ( 'stacktrace' , None ) raise WebDriverException ( arg_1 , arg_2 , arg_3 , arg_4 )

def Func(arg_0):
        """Raise WebDriverException if returned status is not zero."""
        if not arg_0.status:
            return

        arg_1 = find_exception_by_code(arg_0.status)
        arg_2 = None
        arg_3 = None
        arg_4 = None

        if isinstance(arg_0.value, str):
            arg_2 = arg_0.value
        elif isinstance(arg_0.value, dict):
            arg_2 = arg_0.value.get('message', None)
            arg_3 = arg_0.value.get('screen', None)
            arg_4 = arg_0.value.get('stacktrace', None)

        raise WebDriverException(arg_1, arg_2, arg_3, arg_4)

Raise WebDriverException if returned status is not zero .


return json.loads(self._urllib2_fetch(uri, data, method))

def
Func
(
arg_0
,
arg_1
,
arg_2
=
,
arg_3
=
{
}
)
:
if
not
arg_1
:
raise
ValueError
(
'Invalid path parameter'
)
if
arg_2
and
arg_2
not
in
[
'GET'
,
'POST'
,
'DELETE'
,
'PUT'
]
:
raise
NotImplementedError
(
'HTTP %s method not implemented'
%
arg_2
)
if
arg_1
[
0
]
==
'/'
:
arg_4
=
arg_0
.
url
+
arg_1
else
:
arg_4
=
arg_0
.
url
+
'/'
+
arg_1
if
APPENGINE
:
return
json
.
loads
(
arg_0
.
_appengine_fetch
(
arg_4
,
arg_3
,
arg_2
)
)
return
json
.
loads
(
arg_0
.
_urllib2_fetch
(
arg_4
,
arg_3
,
arg_2
)
)

def Func(arg_0, arg_1, arg_2=None, arg_3={}):
        """sends a Func and gets a response from the Plivo REST API

        path: the URL (relative to the endpoint URL, after the /v1
        method: the HTTP method to use, defaults to POST
        data: for POST or PUT, a dict of data to send

        returns Plivo response in XML or raises an exception on error
        """
        if not arg_1:
            raise ValueError('Invalid path parameter')
        if arg_2 and arg_2 not in ['GET', 'POST', 'DELETE', 'PUT']:
            raise NotImplementedError(
                'HTTP %s method not implemented' % arg_2)

        if arg_1[0] == '/':
            arg_4 = arg_0.url + arg_1
        else:
            arg_4 = arg_0.url + '/' + arg_1

        if APPENGINE:
            return json.loads(arg_0._appengine_fetch(arg_4, arg_3, arg_2))
        return json.loads(arg_0._urllib2_fetch(arg_4, arg_3, arg_2))

sends a request and gets a response from the Plivo REST API

        path: the URL (relative to the endpoint URL, after the /v1
        method: the HTTP method to use, defaults to POST
        data: for POST or PUT, a dict of data to send

        returns Plivo response in XML or raises an exception on error


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_3
,
arg_4
=
os
.
path
.
splitext
(
arg_1
)
arg_5
=
{
'.py'
:
[
'.py'
,
'.pyw'
]
,
'.pyw'
:
[
'.pyw'
]
,
}
arg_6
=
arg_5
.
get
(
arg_4
)
if
not
arg_6
:
return
arg_1
,
for
arg_7
in
arg_6
:
arg_8
=
arg_3
+
arg_7
if
os
.
path
.
exists
(
arg_8
)
:
return
arg_8
,
arg_2
=
arg_0
.
coverage
.
file_locator
.
get_zip_data
(
arg_8
)
if
arg_2
:
return
arg_8
,
arg_2
raise
NoSource
(
"No source for code: '%s'"
%
arg_1
)

def Func(arg_0, arg_1):
        """Find the source for `filename`.

        Returns two values: the actual filename, and the source.

        The source returned depends on which of these cases holds:

            * The filename seems to be a non-source file: returns None

            * The filename is a source file, and actually exists: returns None.

            * The filename is a source file, and is in a zip file or egg:
              returns the source.

            * The filename is a source file, but couldn't be found: raises
              `NoSource`.

        """
        arg_2 = None

        arg_3, arg_4 = os.path.splitext(arg_1)
        arg_5 = {
            '.py':  ['.py', '.pyw'],
            '.pyw': ['.pyw'],
        }
        arg_6 = arg_5.get(arg_4)
        if not arg_6:
            return arg_1, None

        for arg_7 in arg_6:
            arg_8 = arg_3 + arg_7
            if os.path.exists(arg_8):
                return arg_8, None
            arg_2 = arg_0.coverage.file_locator.get_zip_data(arg_8)
            if arg_2:
                return arg_8, arg_2
        raise NoSource("No source for code: '%s'" % arg_1)


def Func ( arg_0 ) : arg_1 = timezone . now ( ) - app_settings . PASSWORD_RESET_EXPIRATION arg_2 = super ( ValidPasswordResetTokenManager , arg_0 ) . Func ( ) return arg_2 . filter ( created_at__gt = arg_1 )

def Func(arg_0):
        """
        Return all unexpired password reset tokens.
        """
        arg_1 = timezone.now() - app_settings.PASSWORD_RESET_EXPIRATION
        arg_2 = super(ValidPasswordResetTokenManager, arg_0).Func()

        return arg_2.filter(created_at__gt=arg_1)

Return all unexpired password reset tokens .


def Func(arg_0, arg_1):
    """
    Takes sha1 hash of all dependencies and outputs of all targets

    Args:
        The graph we are going to build
        The settings dictionary

    Returns:
        A dictionary where the keys are the filenames and the
        value is the sha1 hash
    """
    global arg_4
    arg_2 = arg_1["sprint"]
    arg_3 = arg_1["error"]
    arg_4 = arg_3
    arg_5 = {}
    arg_6 = []
    for arg_7 in arg_0.nodes(data=True):
        arg_2("About to take shas of files in target '{}'".format(arg_7[0]),
               level="verbose")
        if 'dependencies' in arg_7[1]:
            arg_2("It has dependencies", level="verbose")
            arg_8 = []
            for arg_9 in arg_7[1]['dependencies']:
                arg_10 = glob.glob(arg_9)
                if arg_10:
                    for arg_11 in arg_10:
                        arg_8.append(arg_11)
                else:
                    arg_8.append(arg_9)
            arg_7[1]['dependencies'] = list(arg_8)
            for arg_9 in arg_7[1]['dependencies']:
                arg_2("  - {}".format(arg_9), level="verbose")
                arg_6.append(arg_9)
        if 'output' in arg_7[1]:
            arg_2("It has outputs", level="verbose")
            for arg_12 in acts.get_all_outputs(arg_7[1]):
                arg_2("  - {}".format(arg_12), level="verbose")
                arg_6.append(arg_12)
    if len(arg_6):
        arg_5['files'] = {}
        # check if files exist and de-dupe
        arg_13 = []
        for arg_14 in arg_6:
            if arg_14 not in arg_13 and os.path.isfile(arg_14):
                arg_13.append(arg_14)
        arg_15 = Pool()
        arg_16 = arg_15.map(get_sha, arg_13)
        arg_15.close()
        arg_15.join()
        for arg_17, arg_18 in zip(arg_13, arg_16):
            arg_5['files'][arg_17] = {'sha': arg_18}
        return arg_5
    arg_2("No dependencies", level="verbose")


def Func(arg_0, arg_1='s', arg_2=1):
    """
    helper for above functions
    """
    arg_3 = re.compile(r'(\d+)([a-zA-Z]*)')
    arg_4 = arg_3.findall(arg_0)
    arg_5 = 0.0
    for arg_6, arg_7 in arg_4:
        arg_6 = int(arg_6)
        arg_7 = arg_7.lower()
        if arg_7 == '':
            arg_7 = arg_1

        if arg_7 == 'ms':
            arg_5 += arg_6 * 0.001
            continue
        elif arg_7 == 's':
            arg_5 += arg_6
            continue
        elif arg_7 == 'm':
            arg_5 += arg_6 * 60
            continue
        elif arg_7 == 'h':
            arg_5 += arg_6 * 60 * 60
            continue
        elif arg_7 == 'd':
            arg_5 += arg_6 * 60 * 60 * 24
            continue
        elif arg_7 == 'w':
            arg_5 += arg_6 * 60 * 60 * 24 * 7
            continue
        else:
            raise ValueError(
                "String contains unsupported unit %s: %s" % (arg_7, arg_0))
    return int(arg_5 * arg_2)


def Func ( arg_0 ) : arg_1 = [ parse_collection ( arg_0 ) ] arg_1 . extend ( [ parse_module ( arg_2 ) for arg_2 in arg_0 . iterdir ( ) if arg_2 . is_dir ( ) and arg_2 . name . startswith ( 'm' ) ] ) return tuple ( sorted ( arg_1 ) )

def Func(arg_0):
    """Parse a litezip file structure to a data structure given the path
    to the litezip directory.

    """
    arg_1 = [parse_collection(arg_0)]
    arg_1.extend([parse_module(arg_2) for arg_2 in arg_0.iterdir()
                   if arg_2.is_dir() and arg_2.name.startswith('m')])
    return tuple(sorted(arg_1))

Parse a litezip file structure to a data structure given the path to the litezip directory .


def Func(arg_0, arg_1):
        """Asserts that val is a date and is before other date."""
        if type(arg_0.val) is not datetime.datetime:
            raise TypeError('val must be datetime, but was type <%s>' % type(arg_0.val).__name__)
        if type(arg_1) is not datetime.datetime:
            raise TypeError('given arg must be datetime, but was type <%s>' % type(arg_1).__name__)
        if arg_0.val >= arg_1:
            arg_0._err('Expected <%s> to be before <%s>, but was not.' % (arg_0.val.strftime('%Y-%m-%d %H:%M:%S'), arg_1.strftime('%Y-%m-%d %H:%M:%S')))
        return arg_0

Asserts that val is a date and is before other date .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
)
:
try
:
arg_3
,
arg_4
,
arg_5
=
arg_1
except
ValueError
:
try
:
arg_3
,
arg_4
=
arg_1
arg_5
=
'*'
except
:
logger
.
error
(
"%r is not a valid range selection"
,
arg_1
)
raise
if
arg_2
is
:
arg_2
=
"{first!s}-{last!s}_{gmx_atomname!s}"
.
format
(
**
vars
(
)
)
arg_6
=
arg_0
.
_translate_residue
(
arg_3
,
default_atomname
=
arg_5
)
arg_7
=
arg_0
.
_translate_residue
(
arg_4
,
default_atomname
=
arg_5
)
arg_8
=
'r {0:d} - {1:d} & & a {2!s}'
.
format
(
arg_6
[
'resid'
]
,
arg_7
[
'resid'
]
,
arg_5
)
arg_9
=
[
'keep 0'
,
'del 0'
,
arg_8
,
'name 0 {name!s}'
.
format
(
**
vars
(
)
)
,
'q'
]
arg_10
,
arg_11
=
tempfile
.
mkstemp
(
suffix
=
'.ndx'
,
prefix
=
arg_2
+
'__'
)
arg_12
,
arg_13
,
arg_14
=
arg_0
.
make_ndx
(
n
=
arg_0
.
ndx
,
o
=
arg_11
,
input
=
arg_9
)
arg_0
.
check_output
(
arg_13
,
"No atoms found for "
"%(selection)r --> %(_selection)r"
%
vars
(
)
)
return
arg_2
,
arg_11

def Func(arg_0, arg_1, arg_2=None):
        """Process a range selection.

        ("S234", "A300", "CA")   --> selected all CA in this range
        ("S234", "A300")         --> selected all atoms in this range

        .. Note:: Ignores residue type, only cares about the resid (but still required)
        """

        try:
            arg_3, arg_4, arg_5 = arg_1
        except ValueError:
            try:
                arg_3, arg_4 = arg_1
                arg_5 = '*'
            except:
                logger.error("%r is not a valid range selection", arg_1)
                raise
        if arg_2 is None:
            arg_2 = "{first!s}-{last!s}_{gmx_atomname!s}".format(**vars())

        arg_6 = arg_0._translate_residue(arg_3, default_atomname=arg_5)
        arg_7 = arg_0._translate_residue(arg_4, default_atomname=arg_5)

        arg_8 = 'r {0:d} - {1:d} & & a {2!s}'.format(arg_6['resid'], arg_7['resid'], arg_5)
        arg_9 = ['keep 0', 'del 0',
               arg_8,
               'name 0 {name!s}'.format(**vars()),
               'q']
        arg_10, arg_11 = tempfile.mkstemp(suffix='.ndx', prefix=arg_2+'__')
        arg_12,arg_13,arg_14 = arg_0.make_ndx(n=arg_0.ndx, o=arg_11, input=arg_9)
        arg_0.check_output(arg_13, "No atoms found for "
                          "%(selection)r --> %(_selection)r" % vars())
        # For debugging, look at out and err or set stdout=True, stderr=True
        ##print "DEBUG: _process_residue()"
        ##print out

        return arg_2, arg_11


def Func ( arg_0 , arg_1 , arg_2 ) : for arg_3 in arg_1 . namelist ( ) : if arg_3 . startswith ( arg_2 ) : yield arg_1 . read ( arg_3 )

def Func(arg_0, arg_1, arg_2):
		"""
		Return a generator yielding each of the segments who's names
		match name.
		"""
		for arg_3 in arg_1.namelist():
			if arg_3.startswith(arg_2):
				yield arg_1.read(arg_3)

Return a generator yielding each of the segments who s names match name .


def Func ( arg_0 , arg_1 , arg_2 = None ) : if arg_2 is not None : arg_2 . buffer += str ( arg_1 ) + "\n" else : arg_0 . buffer += str ( arg_1 ) + "\n"

def Func(arg_0, arg_1, arg_2=None):
        """ Stores the pdf code in a buffer. If it is page related,
            provide the page object.

        """
        if arg_2 is not None:
            arg_2.buffer += str(arg_1) + "\n"
        else:
            arg_0.buffer += str(arg_1) + "\n"

Stores the pdf code in a buffer . If it is page related provide the page object .


(self, datacenter_id, server_id, depth=1)

def Func(arg_0, arg_1, arg_2, arg_3=1):
        """
        Retrieves a list of volumes attached to the server.

        :param      datacenter_id: The unique ID of the data center.
        :type       datacenter_id: ``str``

        :param      server_id: The unique ID of the server.
        :type       server_id: ``str``

        :param      depth: The depth of the response data.
        :type       depth: ``int``

        """
        arg_4 = arg_0._perform_request(
            '/datacenters/%s/servers/%s/volumes?depth=%s' % (
                arg_1,
                arg_2,
                str(arg_3)))

        return arg_4

Retrieves a list of volumes attached to the server .


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
requests
.
Func
(
arg_0
.
base_url
+
arg_1
.
rstrip
(
'/'
)
)
if
not
arg_2
.
ok
:
raise
ServerException
(
'{}: {}'
.
format
(
arg_2
.
status_code
,
arg_2
.
text
)
)
return
arg_2
.
json
(
)

def Func(arg_0, arg_1):
        """
        Get a specific log or log set

        :param log_set: The log set or log to Func. Ex: `.Func(log_set='app')` or
            `.Func(log_set='app/log')`
        :type log_set: str

        :returns: The response of your log set or log
        :rtype: dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        arg_2 = requests.Func(arg_0.base_url + arg_1.rstrip('/'))

        if not arg_2.ok:
            raise ServerException(
                '{}: {}'.format(arg_2.status_code, arg_2.text))
        return arg_2.json()

Get a specific log or log set

        :param log_set: The log set or log to get. Ex: `.get(log_set='app')` or
            `.get(log_set='app/log')`
        :type log_set: str

        :returns: The response of your log set or log
        :rtype: dict

        :raises: This will raise a
            :class:`ServerException<logentries_api.exceptions.ServerException>`
            if there is an error from Logentries


def Func ( arg_0 ) : assert isinstance ( arg_0 , str ) arg_0 = arg_0 . split ( '-' ) [ 0 ] . upper ( ) arg_1 = 0x73e2 for arg_2 , arg_3 in enumerate ( arg_0 ) : arg_1 ^= ord ( arg_3 ) << ( 8 if not arg_2 % 2 else 0 ) return arg_1 & 0x7fff

def Func(arg_0):
    """
    Takes a CALLSIGN and returns Func
    """
    assert isinstance(arg_0, str)

    arg_0 = arg_0.split('-')[0].upper()

    arg_1 = 0x73e2
    for arg_2, arg_3 in enumerate(arg_0):
        arg_1 ^= ord(arg_3) << (8 if not arg_2 % 2 else 0)

    return arg_1 & 0x7fff


(self, document, encoding_type=None, retry=None, timeout=None, metadata=None)

return client.analyze_entities(
            document=document, encoding_type=encoding_type, retry=retry, timeout=timeout, metadata=metadata
        )

def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None, arg_5=None):
        """
        Finds named entities in the text along with entity types,
        salience, mentions for each entity, and other properties.

        :param document: Input document.
            If a dict is provided, it must be of the same form as the protobuf message Document
        :type document: dict or class google.cloud.language_v1.types.Document
        :param encoding_type: The encoding type used by the API to calculate offsets.
        :type encoding_type: google.cloud.language_v1.types.EncodingType
        :param retry: A retry object used to retry requests. If None is specified, requests will not be
            retried.
        :type retry: google.api_core.retry.Retry
        :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if
            retry is specified, the timeout applies to each individual attempt.
        :type timeout: float
        :param metadata: Additional metadata that is provided to the method.
        :type metadata: sequence[tuple[str, str]]]
        :rtype: google.cloud.language_v1.types.AnalyzeEntitiesResponse
        """
        arg_6 = arg_0.get_conn()

        return arg_6.Func(
            arg_1=arg_1, arg_2=arg_2, arg_3=arg_3, arg_4=arg_4, arg_5=arg_5
        )

Finds named entities in the text along with entity types salience mentions for each entity and other properties .


return filter(lambda x: x.xml_name == name, select_elements(source))

def Func ( arg_0 , arg_1 ) : return filter ( lambda x : x . xml_name == arg_1 , select_elements ( arg_0 ) )

def Func(arg_0, arg_1):
    '''
    Yields all the elements with the given name
    source - if an element, starts with all child elements in order; can also be any other iterator
    name - will yield only elements with this name
    '''
    return filter(lambda x: x.xml_name == arg_1, select_elements(arg_0))

Yields all the elements with the given name source - if an element starts with all child elements in order ; can also be any other iterator name - will yield only elements with this name


def Func(arg_0):
    """
    Extracts Schema information from Iglu URI

    >>> Func("iglu:com.acme-corporation_underscore/event_name-dash/jsonschema/1-10-1")['vendor']
    'com.acme-corporation_underscore'
    """
    arg_1 = re.match(SCHEMA_URI_REGEX, arg_0)
    if arg_1:
        return {
            'vendor': arg_1.group(1),
            'name': arg_1.group(2),
            'format': arg_1.group(3),
            'version': arg_1.group(4)

        }
    else:
        raise SnowplowEventTransformationException([
            "Schema {} does not conform to regular expression {}".format(arg_0, SCHEMA_URI)
        ])

Extracts Schema information from Iglu URI

    >>> extract_schema("iglu:com.acme-corporation_underscore/event_name-dash/jsonschema/1-10-1")['vendor']
    'com.acme-corporation_underscore'


(self, stream, share_name, directory_name, file_name, count, **kwargs)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, **arg_6):
        """
        Upload a stream to Azure File Share.

        :param stream: Opened file/stream to upload as the file content.
        :type stream: file-like
        :param share_name: Name of the share.
        :type share_name: str
        :param directory_name: Name of the directory.
        :type directory_name: str
        :param file_name: Name of the file.
        :type file_name: str
        :param count: Size of the stream in bytes
        :type count: int
        :param kwargs: Optional keyword arguments that
            `FileService.create_file_from_stream()` takes.
        :type kwargs: object
        """
        arg_0.connection.create_file_from_stream(arg_2, arg_3,
                                                arg_4, arg_1, arg_5, **arg_6)


def Func(arg_0):
    """Get SBMLDocument from given filename.

    Parameters
    ----------
    filename : path to SBML, or SBML string, or filehandle

    Returns
    -------
    libsbml.SBMLDocument
    """
    if isinstance(arg_0, string_types):
        if ("win" in platform) and (len(arg_0) < 260) \
                and os.path.exists(arg_0):
            # path (win)
            arg_1 = libsbml.readSBMLFromFile(arg_0)  # noqa: E501 type: libsbml.SBMLDocument
        elif ("win" not in platform) and os.path.exists(arg_0):
            # path other
            arg_1 = libsbml.readSBMLFromFile(arg_0)  # noqa: E501 type: libsbml.SBMLDocument
        else:
            # string representation
            if "<sbml" not in arg_0:
                raise IOError("The file with 'filename' does not exist, "
                              "or is not an SBML string. Provide the path to "
                              "an existing SBML file or a valid SBML string "
                              "representation: \n%s", arg_0)

            arg_1 = libsbml.readSBMLFromString(arg_0)  # noqa: E501 type: libsbml.SBMLDocument

    elif hasattr(arg_0, "read"):
        # file handle
        arg_1 = libsbml.readSBMLFromString(arg_0.read())  # noqa: E501 type: libsbml.SBMLDocument
    else:
        raise CobraSBMLError("Input type '%s' for 'filename' is not supported."
                             " Provide a path, SBML str, "
                             "or file handle.", type(arg_0))

    return arg_1


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
''
.
join
(
[
arg_2
*
' '
,
arg_1
,
arg_2
*
' '
]
)
return
arg_3
.
join
(
arg_0
)

def Func(arg_0, arg_1, arg_2):
    """Add dividers and padding to a row of cells and return a string."""
    arg_3 = ''.join([arg_2 * ' ', arg_1, arg_2 * ' '])
    return arg_3.join(arg_0)

Add dividers and padding to a row of cells and return a string .


def Func ( arg_0 , arg_1 ) : arg_1 . implementation = arg_0 . implementation arg_1 . steps = arg_0 . steps arg_1 . alpha = arg_0 . alpha arg_1 . verbosity = arg_0 . verbosity arg_1 . maxCategoryCount = arg_0 . maxCategoryCount arg_1 . learningMode = arg_0 . learningMode arg_1 . inferenceMode = arg_0 . inferenceMode arg_1 . recordNum = arg_0 . recordNum arg_0 . _sdrClassifier . write ( arg_1 . sdrClassifier )

def Func(arg_0, arg_1):
    """
    Write state to proto object.

    :param proto: SDRClassifierRegionProto capnproto object
    """
    arg_1.implementation = arg_0.implementation
    arg_1.steps = arg_0.steps
    arg_1.alpha = arg_0.alpha
    arg_1.verbosity = arg_0.verbosity
    arg_1.maxCategoryCount = arg_0.maxCategoryCount
    arg_1.learningMode = arg_0.learningMode
    arg_1.inferenceMode = arg_0.inferenceMode
    arg_1.recordNum = arg_0.recordNum

    arg_0._sdrClassifier.write(arg_1.sdrClassifier)


def Func ( arg_0 ) -> BaseEntity : for arg_1 , arg_2 in arg_0 . graph . nodes ( arg_2 = True ) : if arg_0 . tag not in arg_2 : yield arg_1

def Func(arg_0) -> BaseEntity:
        """Iterate over all nodes without a score."""
        for arg_1, arg_2 in arg_0.graph.nodes(arg_2=True):
            if arg_0.tag not in arg_2:
                yield arg_1

Iterate over all nodes without a score .


(source_filename, target_filename, override=True, md5_check=False, copy_symlink=True)

def Func ( arg_0 , arg_1 , arg_2 = True , arg_3 = False , arg_4 = True ) : from . _exceptions import FileNotFoundError if not arg_2 and Exists ( arg_1 ) : from . _exceptions import FileAlreadyExistsError raise FileAlreadyExistsError ( arg_1 ) arg_3 = arg_3 and not arg_1 . endswith ( '.md5' ) if arg_3 : arg_5 = arg_0 + '.md5' arg_6 = arg_1 + '.md5' try : arg_7 = GetFileContents ( arg_5 ) except FileNotFoundError : arg_7 = None try : arg_8 = GetFileContents ( arg_6 ) except FileNotFoundError : arg_8 = None if arg_7 is not None and arg_7 == arg_8 and Exists ( arg_1 ) : return MD5_SKIP _DoFunc ( arg_0 , arg_1 , arg_4 = arg_4 ) if arg_3 and arg_7 is not None and arg_7 != arg_8 : CreateFile ( arg_6 , arg_7 )

def Func(arg_0, arg_1, arg_2=True, arg_3=False, arg_4=True):
    '''
    Copy a file from source to target.

    :param  source_filename:
        @see _DoFunc

    :param  target_filename:
        @see _DoFunc

    :param bool md5_check:
        If True, checks md5 files (of both source and target files), if they match, skip this copy
        and return MD5_SKIP

        Md5 files are assumed to be {source, target} + '.md5'

        If any file is missing (source, target or md5), the copy will always be made.

    :param  copy_symlink:
        @see _DoFunc

    :raises FileAlreadyExistsError:
        If target_filename already exists, and override is False

    :raises NotImplementedProtocol:
        If file protocol is not accepted

        Protocols allowed are:
            source_filename: local, ftp, http
            target_filename: local, ftp

    :rtype: None | MD5_SKIP
    :returns:
        MD5_SKIP if the file was not copied because there was a matching .md5 file

    .. seealso:: FTP LIMITATIONS at this module's doc for performance issues information
    '''
    from ._exceptions import FileNotFoundError

    # Check override
    if not arg_2 and Exists(arg_1):
        from ._exceptions import FileAlreadyExistsError
        raise FileAlreadyExistsError(arg_1)

    # Don't do md5 check for md5 files themselves.
    arg_3 = arg_3 and not arg_1.endswith('.md5')

    # If we enabled md5 checks, ignore copy of files that haven't changed their md5 contents.
    if arg_3:
        arg_5 = arg_0 + '.md5'
        arg_6 = arg_1 + '.md5'
        try:
            arg_7 = GetFileContents(arg_5)
        except FileNotFoundError:
            arg_7 = None

        try:
            arg_8 = GetFileContents(arg_6)
        except FileNotFoundError:
            arg_8 = None

        if arg_7 is not None and \
           arg_7 == arg_8 and \
           Exists(arg_1):
            return MD5_SKIP

    # Copy source file
    _DoFunc(arg_0, arg_1, arg_4=arg_4)

    # If we have a source_md5, but no target_md5, create the target_md5 file
    if arg_3 and arg_7 is not None and arg_7 != arg_8:
        CreateFile(arg_6, arg_7)

Copy a file from source to target.

    :param  source_filename:
        @see _DoCopyFile

    :param  target_filename:
        @see _DoCopyFile

    :param bool md5_check:
        If True, checks md5 files (of both source and target files), if they match, skip this copy
        and return MD5_SKIP

        Md5 files are assumed to be {source, target} + '.md5'

        If any file is missing (source, target or md5), the copy will always be made.

    :param  copy_symlink:
        @see _DoCopyFile

    :raises FileAlreadyExistsError:
        If target_filename already exists, and override is False

    :raises NotImplementedProtocol:
        If file protocol is not accepted

        Protocols allowed are:
            source_filename: local, ftp, http
            target_filename: local, ftp

    :rtype: None | MD5_SKIP
    :returns:
        MD5_SKIP if the file was not copied because there was a matching .md5 file

    .. seealso:: FTP LIMITATIONS at this module's doc for performance issues information


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 ( token = arg_1 , id = arg_2 ) arg_3 . load ( ) return arg_3

def Func(arg_0, arg_1, arg_2):
        """
        Class method that will return an Volume object by ID.
        """
        arg_3 = arg_0(token=arg_1, id=arg_2)
        arg_3.load()
        return arg_3

Class method that will return an Volume object by ID .


def Func ( arg_0 ) : arg_1 = arg_0 . config . get ( 'server' , '127.0.0.1' ) arg_2 = arg_0 . config . get ( 'port' , 5555 ) def connect ( arg_3 ) : arg_0 . protocol = riemann . RiemannUDP ( arg_3 , arg_2 ) arg_0 . endpoint = reactor . listenUDP ( 0 , arg_0 . protocol ) arg_6 = reactor . resolve ( arg_1 ) arg_6 . addCallback ( connect ) return arg_6

def Func(arg_0):
        """Create a UDP connection to Riemann"""
        arg_1 = arg_0.config.get('server', '127.0.0.1')
        arg_2 = arg_0.config.get('port', 5555)

        def connect(arg_3):
            arg_0.protocol = riemann.RiemannUDP(arg_3, arg_2)
            arg_0.endpoint = reactor.listenUDP(0, arg_0.protocol)

        arg_6 = reactor.resolve(arg_1)
        arg_6.addCallback(connect)
        return arg_6


def Func ( arg_0 , arg_1 ) : if arg_0 . namespace == arg_1 : return True if arg_1 in __CONVERSION__ : for arg_2 in __CONVERSION__ [ arg_1 ] : if arg_0 . search ( namespace = arg_2 ) : return True return False

def Func(arg_0, arg_1):
    '''Test if an annotation can be mapped to a target namespace

    Parameters
    ----------
    annotation : jams.Annotation
        An annotation object

    target_namespace : str
        The target namespace

    Returns
    -------
    True
        if `annotation` can be automatically converted to
        `target_namespace`

    False
        otherwise
    '''

    # If we're already in the target namespace, do nothing
    if arg_0.namespace == arg_1:
        return True

    if arg_1 in __CONVERSION__:
        # Look for a way to map this namespace to the target
        for arg_2 in __CONVERSION__[arg_1]:
            if arg_0.search(namespace=arg_2):
                return True
    return False


(gtfs,
                                        route_type,
                                        link_attributes=None,
                                        start_time_ut=None,
                                        end_time_ut=None)

def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = None , arg_4 = None ) : if arg_2 is None : arg_2 = DEFAULT_STOP_TO_STOP_LINK_ATTRIBUTES assert ( arg_1 in route_types . TRANSIT_ROUTE_TYPES ) arg_5 = arg_0 . get_stops_for_route_type ( arg_1 ) arg_6 = networkx . DiGraph ( ) _add_stops_to_net ( arg_6 , arg_5 ) arg_7 = arg_0 . get_transit_events ( arg_3 = arg_3 , arg_4 = arg_4 , arg_1 = arg_1 ) if len ( arg_6 . nodes ( ) ) < 2 : assert arg_7 . shape [ 0 ] == 0 arg_8 = arg_7 . groupby ( [ 'from_stop_I' , 'to_stop_I' ] , sort = False ) for arg_9 , arg_10 in arg_8 : arg_11 , arg_12 = arg_9 assert isinstance ( arg_10 , pd . DataFrame ) if arg_2 is None : arg_6 . add_edge ( arg_11 , arg_12 ) else : arg_13 = { } if "duration_min" in arg_2 : arg_13 [ 'duration_min' ] = float ( arg_10 [ 'duration' ] . min ( ) ) if "duration_max" in arg_2 : arg_13 [ 'duration_max' ] = float ( arg_10 [ 'duration' ] . max ( ) ) if "duration_median" in arg_2 : arg_13 [ 'duration_median' ] = float ( arg_10 [ 'duration' ] . median ( ) ) if "duration_avg" in arg_2 : arg_13 [ 'duration_avg' ] = float ( arg_10 [ 'duration' ] . mean ( ) ) if "n_vehicles" in arg_2 : arg_13 [ 'n_vehicles' ] = int ( arg_10 . shape [ 0 ] ) if "capacity_estimate" in arg_2 : arg_13 [ 'capacity_estimate' ] = route_types . ROUTE_TYPE_TO_APPROXIMATE_CAPACITY [ arg_1 ] * int ( arg_10 . shape [ 0 ] ) if "d" in arg_2 : arg_14 = arg_6 . node [ arg_11 ] [ 'lat' ] arg_15 = arg_6 . node [ arg_11 ] [ 'lon' ] arg_16 = arg_6 . node [ arg_12 ] [ 'lat' ] arg_17 = arg_6 . node [ arg_12 ] [ 'lon' ] arg_18 = wgs84_distance ( arg_14 , arg_15 , arg_16 , arg_17 ) arg_13 [ 'd' ] = int ( arg_18 ) if "distance_shape" in arg_2 : assert "shape_id" in arg_10 . columns . values arg_19 = None for arg_20 , arg_21 in enumerate ( arg_10 [ "shape_id" ] . values ) : if arg_21 is not None : arg_19 = arg_20 break if arg_19 is None : arg_13 [ "distance_shape" ] = None else : arg_22 = arg_10 . iloc [ arg_19 ] arg_18 = arg_0 . get_shape_distance_between_stops ( arg_22 [ "trip_I" ] , int ( arg_22 [ "from_seq" ] ) , int ( arg_22 [ "to_seq" ] ) ) arg_13 [ 'distance_shape' ] = arg_18 if "route_I_counts" in arg_2 : arg_13 [ "route_I_counts" ] = arg_10 . groupby ( "route_I" ) . size ( ) . to_dict ( ) arg_6 . add_edge ( arg_11 , arg_12 , attr_dict = arg_13 ) return arg_6

def Func(arg_0,
                                        arg_1,
                                        arg_2=None,
                                        arg_3=None,
                                        arg_4=None):
    """
    Get a stop-to-stop network describing a single mode of travel.

    Parameters
    ----------
    gtfs : gtfspy.GTFS
    route_type : int
        See gtfspy.route_types.TRANSIT_ROUTE_TYPES for the list of possible types.
    link_attributes: list[str], optional
        defaulting to use the following link attributes:
            "n_vehicles" : Number of vehicles passed
            "duration_min" : minimum travel time between stops
            "duration_max" : maximum travel time between stops
            "duration_median" : median travel time between stops
            "duration_avg" : average travel time between stops
            "d" : distance along straight line (wgs84_distance)
            "distance_shape" : minimum distance along shape
            "capacity_estimate" : approximate capacity passed through the stop
            "route_I_counts" : dict from route_I to counts
    start_time_ut: int
        start time of the time span (in unix time)
    end_time_ut: int
        end time of the time span (in unix time)

    Returns
    -------
    net: networkx.DiGraph
        A directed graph Directed graph
    """
    if arg_2 is None:
        arg_2 = DEFAULT_STOP_TO_STOP_LINK_ATTRIBUTES
    assert(arg_1 in route_types.TRANSIT_ROUTE_TYPES)

    arg_5 = arg_0.get_stops_for_route_type(arg_1)
    arg_6 = networkx.DiGraph()
    _add_stops_to_net(arg_6, arg_5)

    arg_7 = arg_0.get_transit_events(arg_3=arg_3,
                                        arg_4=arg_4,
                                        arg_1=arg_1)
    if len(arg_6.nodes()) < 2:
        assert arg_7.shape[0] == 0

    # group events by links, and loop over them (i.e. each link):
    arg_8 = arg_7.groupby(['from_stop_I', 'to_stop_I'], sort=False)
    for arg_9, arg_10 in arg_8:
        arg_11, arg_12 = arg_9
        assert isinstance(arg_10, pd.DataFrame)
        # 'dep_time_ut' 'arr_time_ut' 'shape_id' 'route_type' 'trip_I' 'duration' 'from_seq' 'to_seq'
        if arg_2 is None:
            arg_6.add_edge(arg_11, arg_12)
        else:
            arg_13 = {}
            if "duration_min" in arg_2:
                arg_13['duration_min'] = float(arg_10['duration'].min())
            if "duration_max" in arg_2:
                arg_13['duration_max'] = float(arg_10['duration'].max())
            if "duration_median" in arg_2:
                arg_13['duration_median'] = float(arg_10['duration'].median())
            if "duration_avg" in arg_2:
                arg_13['duration_avg'] = float(arg_10['duration'].mean())
            # statistics on numbers of vehicles:
            if "n_vehicles" in arg_2:
                arg_13['n_vehicles'] = int(arg_10.shape[0])
            if "capacity_estimate" in arg_2:
                arg_13['capacity_estimate'] = route_types.ROUTE_TYPE_TO_APPROXIMATE_CAPACITY[arg_1] \
                                                 * int(arg_10.shape[0])
            if "d" in arg_2:
                arg_14 = arg_6.node[arg_11]['lat']
                arg_15 = arg_6.node[arg_11]['lon']
                arg_16 = arg_6.node[arg_12]['lat']
                arg_17 = arg_6.node[arg_12]['lon']
                arg_18 = wgs84_distance(arg_14, arg_15, arg_16, arg_17)
                arg_13['d'] = int(arg_18)
            if "distance_shape" in arg_2:
                assert "shape_id" in arg_10.columns.values
                arg_19 = None
                for arg_20, arg_21 in enumerate(arg_10["shape_id"].values):
                    if arg_21 is not None:
                        arg_19 = arg_20
                        break
                if arg_19 is None:
                    arg_13["distance_shape"] = None
                else:
                    arg_22 = arg_10.iloc[arg_19]
                    arg_18 = arg_0.get_shape_distance_between_stops(
                        arg_22["trip_I"],
                        int(arg_22["from_seq"]),
                        int(arg_22["to_seq"])
                    )
                    arg_13['distance_shape'] = arg_18
            if "route_I_counts" in arg_2:
                arg_13["route_I_counts"] = arg_10.groupby("route_I").size().to_dict()
            arg_6.add_edge(arg_11, arg_12, attr_dict=arg_13)
    return arg_6

Get a stop - to - stop network describing a single mode of travel .


def
Func
(
arg_0
)
:
arg_1
=
requests
.
delete
(
VACATIONS_URL
+
"/"
+
arg_0
,
headers
=
HEADERS
)
arg_2
=
str
(
arg_1
.
status_code
)
if
arg_2
!=
'202'
:
_LOGGER
.
error
(
"Failed to delete vacation. "
+
arg_2
)
return
False
return
True

def Func(arg_0):
        """
        Delete a vacation by ID.
        """
        arg_1 = requests.delete(VACATIONS_URL + "/" + arg_0, headers=HEADERS)
        arg_2 = str(arg_1.status_code)
        if arg_2 != '202':
            _LOGGER.error("Failed to delete vacation. " + arg_2)
            return False
        return True