return activity[[i for i in ACTIVITY_COLUMN_ORDER if i in activity.columns]]

def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 . _get_request ( arg_0 . _activity_endpoint ( arg_1 , arg_2 ) ) . json ( ) arg_4 = pd . DataFrame ( arg_3 [ 'RIDE' ] [ 'SAMPLES' ] ) arg_4 = arg_4 . rename ( columns = ACTIVITY_COLUMN_TRANSLATION ) arg_4 . index = pd . to_timedelta ( arg_4 . time , unit = 's' ) arg_4 . drop ( 'time' , axis = 1 , inplace = True ) return arg_4 [ [ arg_6 for arg_6 in ACTIVITY_COLUMN_ORDER if arg_6 in arg_4 . columns ] ]

def Func(arg_0, arg_1, arg_2):
        """Actually do the request for activity filename
        This call is slow and therefore this method is memory cached.

        Keyword arguments:
        athlete -- Full name of athlete
        filename -- filename of request activity (e.g. \'2015_04_29_09_03_16.json\')
        """
        arg_3 = arg_0._get_request(arg_0._activity_endpoint(arg_1, arg_2)).json()

        arg_4 = pd.DataFrame(arg_3['RIDE']['SAMPLES'])
        arg_4 = arg_4.rename(columns=ACTIVITY_COLUMN_TRANSLATION)

        arg_4.index = pd.to_timedelta(arg_4.time, unit='s')
        arg_4.drop('time', axis=1, inplace=True)

        return arg_4[[arg_6 for arg_6 in ACTIVITY_COLUMN_ORDER if arg_6 in arg_4.columns]]

Actually do the request for activity filename This call is slow and therefore this method is memory cached .


def Func ( arg_0 ) : arg_1 = ColorList . copy ( arg_0 ) _list . Func ( arg_1 ) return arg_1

def Func(arg_0):
        """
        Returns a Funcd copy of the list.
        """
        arg_1 = ColorList.copy(arg_0)
        _list.Func(arg_1)
        return arg_1


def Func(arg_0, arg_1):
        """
        Delete a specified anomaly alert tag and its scheduled query

        This method makes 3 requests:

            * One to get the associated scheduled_query_id
            * One to Func the alert
            * One to Func get scheduled query

        :param tag_id: The tag ID to Func
        :type tag_id: str

        :raises: This will raise a
            :class:`ServerException <logentries_api.exceptions.ServerException>`
            if there is an error from Logentries
        """
        arg_2 = [tag for tag in arg_0.list_tags() if tag.get('id') == arg_1]

        if len(arg_2) < 1:
            return

        arg_3 = arg_2[0].get('scheduled_query_id')

        arg_4 = 'https://logentries.com/rest/{account_id}/api/tags/{tag_id}'

        arg_0._api_Func(
            url=arg_4.format(
                account_id=arg_0.account_id,
                arg_1=arg_1
            )
        )
        arg_5 = 'https://logentries.com/rest/{account_id}/api/scheduled_queries/{query_id}'

        arg_0._api_Func(
            url=arg_5.format(
                account_id=arg_0.account_id,
                arg_3=arg_3
            )
        )

Delete a specified anomaly alert tag and its scheduled query

        This method makes 3 requests:

            * One to get the associated scheduled_query_id
            * One to delete the alert
            * One to delete get scheduled query

        :param tag_id: The tag ID to delete
        :type tag_id: str

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


def Func(arg_0, arg_1):
        """Scan options related to one command and enrich _opt_cmds."""
        arg_2 = arg_0.sections_list(arg_1)
        arg_3 = arg_0._opt_cmds[arg_1] if arg_1 else arg_0._opt_bare
        for arg_4 in reversed(arg_2):
            for arg_5, arg_6 in arg_0._conf[arg_4].def_.items():
                if not arg_6.cmd_arg:
                    continue
                if arg_5 not in arg_3:
                    arg_3[arg_5] = arg_4
                else:
                    warnings.warn(
                        'Command <{0}>: {1}.{2} shadowed by {3}.{2}'.format(
                            arg_1, arg_4, arg_5, arg_3[arg_5]),
                        error.LoamWarning, stacklevel=4)

Scan options related to one command and enrich _opt_cmds .


def
Func
(
arg_0
)
:
arg_1
=
bytearray
(
arg_0
.
stream
.
read
(
rawvlr
.
VLR_HEADER_SIZE
)
)
arg_2
=
rawvlr
.
RawVLRHeader
.
from_buffer
(
arg_1
)
arg_3
=
arg_0
.
stream
.
read
(
)
logger
.
debug
(
"Read: {} MBytes of waveform_record"
.
format
(
len
(
arg_3
)
/
10
**
6
)
)
return
arg_2
,
arg_3

def Func(arg_0):
        """ reads and returns the waveform vlr header, waveform record
        """
        # This is strange, the spec says, waveform data packet is in a EVLR
        #  but in the 2 samples I have its a VLR
        # but also the 2 samples have a wrong user_id (LAS_Spec instead of LASF_Spec)
        arg_1 = bytearray(arg_0.stream.read(rawvlr.VLR_HEADER_SIZE))
        arg_2 = rawvlr.RawVLRHeader.from_buffer(arg_1)
        arg_3 = arg_0.stream.read()
        logger.debug(
            "Read: {} MBytes of waveform_record".format(len(arg_3) / 10 ** 6)
        )

        return arg_2, arg_3

reads and returns the waveform vlr header waveform record


(self, file_path, folder_id=None, sha1=None, httponly=False)

def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = None , arg_4 = False ) : arg_5 = arg_0 . upload_link ( arg_2 = arg_2 , arg_3 = arg_3 , arg_4 = arg_4 ) arg_6 = arg_5 [ 'url' ] with open ( arg_1 , 'rb' ) as f : arg_7 = requests . post ( arg_6 , files = { 'Func' : f } ) . json ( ) arg_0 . _check_status ( arg_7 ) return arg_7 [ 'result' ]

def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=False):
        """Calls upload_link request to get valid url, then it makes a post request with given file to be uploaded.
        No need to call upload_link explicitly since Func calls it.

        Note:
            If folder_id is not provided, the file will be uploaded to ``Home`` folder.

        Args:
            file_path (str): full path of the file to be uploaded.
            folder_id (:obj:`str`, optional): folder-ID to upload to.
            sha1 (:obj:`str`, optional): expected sha1 If sha1 of uploaded file doesn't match this value, upload fails.
            httponly (:obj:`bool`, optional): If this is set to true, use only http upload links.

        Returns:
            dict: dictionary containing uploaded file info. ::

                {
                    "content_type": "application/zip",
                    "id": "0yiQTPzi4Y4",
                    "name": 'favicons.zip',
                    "sha1": 'f2cb05663563ec1b7e75dbcd5b96d523cb78d80c',
                    "size": '24160',
                    "url": 'https://openload.co/f/0yiQTPzi4Y4/favicons.zip'
                 }

        """

        arg_5 = arg_0.upload_link(arg_2=arg_2, arg_3=arg_3, arg_4=arg_4)
        arg_6 = arg_5['url']

        with open(arg_1, 'rb') as f:
            arg_7 = requests.post(arg_6, files={'Func': f}).json()

        arg_0._check_status(arg_7)
        return arg_7['result']

Calls upload_link request to get valid url, then it makes a post request with given file to be uploaded.
        No need to call upload_link explicitly since upload_file calls it.

        Note:
            If folder_id is not provided, the file will be uploaded to ``Home`` folder.

        Args:
            file_path (str): full path of the file to be uploaded.
            folder_id (:obj:`str`, optional): folder-ID to upload to.
            sha1 (:obj:`str`, optional): expected sha1 If sha1 of uploaded file doesn't match this value, upload fails.
            httponly (:obj:`bool`, optional): If this is set to true, use only http upload links.

        Returns:
            dict: dictionary containing uploaded file info. ::

                {
                    "content_type": "application/zip",
                    "id": "0yiQTPzi4Y4",
                    "name": 'favicons.zip',
                    "sha1": 'f2cb05663563ec1b7e75dbcd5b96d523cb78d80c',
                    "size": '24160',
                    "url": 'https://openload.co/f/0yiQTPzi4Y4/favicons.zip'
                 }

Calls upload_link request to get valid url then it makes a post request with given file to be uploaded . No need to call upload_link explicitly since upload_file calls it .


def Func ( arg_0 ) : def add_subdir ( arg_1 , arg_2 ) : arg_3 = os . path . join ( arg_1 , arg_2 ) for arg_4 , arg_5 , arg_6 in os . walk ( arg_3 ) : for arg_7 in arg_6 : arg_8 = os . path . join ( arg_1 , arg_2 , arg_7 ) if os . path . isfile ( arg_8 ) : arg_9 = os . path . relpath ( arg_4 , arg_8 ) arg_10 = os . path . join ( arg_9 , arg_7 ) zip_file . write ( arg_8 , arg_10 ) for arg_2 in arg_5 : add_subdir ( arg_3 , arg_2 ) arg_11 = BytesIO ( ) arg_12 = tempfile . mkdtemp ( ) try : save_output ( arg_0 , arg_12 ) with zipfile . ZipFile ( arg_11 , 'w' , zipfile . ZIP_DEFLATED ) as zip_file : for arg_13 , arg_14 , arg_15 in os . walk ( arg_12 ) : for arg_16 in arg_15 : arg_17 = os . path . join ( arg_13 , arg_16 ) if os . path . isfile ( arg_17 ) : arg_18 = os . path . join ( os . path . relpath ( arg_13 , arg_12 ) , arg_16 ) zip_file . write ( arg_17 , arg_18 ) for arg_19 in arg_14 : arg_20 = os . path . join ( arg_13 , arg_19 ) if os . path . isdir ( arg_20 ) : zip_file . write ( arg_20 , arg_19 ) add_subdir ( arg_13 , arg_19 ) finally : shutil . rmtree ( arg_12 ) return arg_11 . getvalue ( )

def Func(arg_0):
    """
    Creates a zip file of parsed report output

    Args:
        results (OrderedDict): The parsed results

    Returns:
        bytes: zip file bytes
    """
    def add_subdir(arg_1, arg_2):
        arg_3 = os.path.join(arg_1, arg_2)
        for arg_4, arg_5, arg_6 in os.walk(arg_3):
            for arg_7 in arg_6:
                arg_8 = os.path.join(arg_1, arg_2, arg_7)
                if os.path.isfile(arg_8):
                    arg_9 = os.path.relpath(arg_4, arg_8)
                    arg_10 = os.path.join(arg_9, arg_7)
                    zip_file.write(arg_8, arg_10)
            for arg_2 in arg_5:
                add_subdir(arg_3, arg_2)

    arg_11 = BytesIO()
    arg_12 = tempfile.mkdtemp()
    try:
        save_output(arg_0, arg_12)
        with zipfile.ZipFile(arg_11, 'w', zipfile.ZIP_DEFLATED) as zip_file:
            for arg_13, arg_14, arg_15 in os.walk(arg_12):
                for arg_16 in arg_15:
                    arg_17 = os.path.join(arg_13, arg_16)
                    if os.path.isfile(arg_17):
                        arg_18 = os.path.join(os.path.relpath(arg_13, arg_12),
                                               arg_16)
                        zip_file.write(arg_17, arg_18)
                for arg_19 in arg_14:
                    arg_20 = os.path.join(arg_13, arg_19)
                    if os.path.isdir(arg_20):
                        zip_file.write(arg_20, arg_19)
                        add_subdir(arg_13, arg_19)
    finally:
        shutil.rmtree(arg_12)

    return arg_11.getvalue()


def Func ( arg_0 ) : if arg_0 . _inventory is not None : return arg_0 . _inventory arg_0 . _inventory = arg_0 . resolver . getMetadata ( ) return arg_0 . _inventory

def Func(arg_0):
        """ Request the api endpoint to retrieve information about the inventory

        :return: Main Collection
        :rtype: Collection
        """
        if arg_0._inventory is not None:
            return arg_0._inventory

        arg_0._inventory = arg_0.resolver.getMetadata()
        return arg_0._inventory


def Func ( arg_0 , arg_1 : arg_2 . Alt ) -> [ ast . stmt ] : arg_4 = [ arg_0 . visit ( arg_5 ) for arg_5 in arg_1 . ptlist ] for arg_5 in arg_4 : if not isinstance ( arg_5 , ast . expr ) : break else : return ast . BoolOp ( ast . Or ( ) , arg_4 ) arg_6 = ast . Try ( [ ] , [ ast . ExceptHandler ( ast . Name ( 'AltTrue' , ast . Load ( ) ) , None , [ ast . Pass ( ) ] ) ] , [ ] , [ ] ) arg_7 = [ ast . Raise ( ast . Call ( ast . Name ( 'AltTrue' , ast . Load ( ) ) , [ ] , [ ] , None , None ) , None ) ] arg_8 = [ ast . ExceptHandler ( ast . Name ( 'AltFalse' , ast . Load ( ) ) , None , [ ast . Pass ( ) ] ) ] arg_0 . in_try += 1 for arg_5 in arg_1 . ptlist : arg_6 . body . append ( ast . Try ( arg_0 . _clause ( arg_0 . visit ( arg_5 ) ) + arg_7 , arg_8 , [ ] , [ ] ) ) arg_0 . in_try -= 1 arg_6 . body . append ( arg_0 . __exit_scope ( ) ) return [ arg_6 ]

def Func(arg_0, arg_1: arg_2.Alt) -> [ast.stmt]:
        """Generates python code for alternatives.

        try:
            try:
                <code for clause>  #raise AltFalse when alternative is False
                raise AltTrue()
            except AltFalse:
                pass
            return False
        except AltTrue:
            pass
        """
        arg_4 = [arg_0.visit(arg_5) for arg_5 in arg_1.ptlist]
        for arg_5 in arg_4:
            if not isinstance(arg_5, ast.expr):
                break
        else:
            return ast.BoolOp(ast.Or(), arg_4)
        arg_6 = ast.Try([], [ast.ExceptHandler(
            ast.Name('AltTrue', ast.Load()), None, [ast.Pass()])], [], [])
        arg_7 = [ast.Raise(ast.Call(
            ast.Name('AltTrue', ast.Load()), [], [], None, None), None)]
        arg_8 = [ast.ExceptHandler(
            ast.Name('AltFalse', ast.Load()), None, [ast.Pass()])]
        arg_0.in_try += 1
        for arg_5 in arg_1.ptlist:
            arg_6.body.append(
                ast.Try(arg_0._clause(arg_0.visit(arg_5)) + arg_7,
                        arg_8, [], []))
        arg_0.in_try -= 1
        arg_6.body.append(arg_0.__exit_scope())
        return [arg_6]

Generates python code for alternatives .


(P=None, Psat=None, phi_l=None, phi_g=None, gamma=None, Poynting=1)

'Input must consist of one set from (P, Psat, phi_l, \phi_g, gamma), (P, Psat, gamma), (phi_l, phi_g), (P, Psat)'

def Func(arg_0=None, arg_1=None, arg_2=None, arg_3=None, arg_4=None, arg_5=1):
    r'''Calculates the equilibrium K-value assuming Raoult's law,
    or an equation of state model, or an activity coefficient model,
    or a combined equation of state-activity model.

    The calculation procedure will use the most advanced approach with the
    provided inputs:

        * If `P`, `Psat`, `phi_l`, `phi_g`, and `gamma` are provided, use the
          combined approach.
        * If `P`, `Psat`, and `gamma` are provided, use the modified Raoult's
          law.
        * If `phi_l` and `phi_g` are provided, use the EOS only method.
        * If `P` and `Psat` are provided, use Raoult's law.

    Definitions:

    .. math::
        K_i=\frac{y_i}{x_i}

    Raoult's law:

    .. math::
        K_i = \frac{P_{i}^{sat}}{P}

    Activity coefficient, no EOS (modified Raoult's law):

    .. math::
        K_i = \frac{\gamma_i P_{i}^{sat}}{P}

    Equation of state only:

    .. math::
        K_i = \frac{\phi_i^l}{\phi_i^v} = \frac{f_i^l}{f_i^v}

    Combined approach (liquid reference fugacity coefficient is normally
    calculated the saturation pressure for it as a pure species; vapor fugacity
    coefficient calculated normally):

    .. math::
        K_i = \frac{\gamma_i P_i^{sat} \phi_i^{l,ref}}{\phi_i^v P}

    Combined approach, with Poynting Correction Factor (liquid molar volume in
    the integral is for i as a pure species only):

    .. math::
        K_i = \frac{\gamma_i P_i^{sat} \phi_i^{l, ref} \exp\left[\frac{
        \int_{P_i^{sat}}^P V_i^l dP}{RT}\right]}{\phi_i^v P}

    Parameters
    ----------
    P : float
        System pressure, optional
    Psat : float
        Vapor pressure of species i, [Pa]
    phi_l : float
        Fugacity coefficient of species i in the liquid phase, either
        at the system conditions (EOS-only case) or at the saturation pressure
        of species i as a pure species (reference condition for the combined
        approach), optional [-]
    phi_g : float
        Fugacity coefficient of species i in the vapor phase at the system
        conditions, optional [-]
    gamma : float
        Activity coefficient of species i in the liquid phase, optional [-]
    Poynting : float
        Poynting correction factor, optional [-]

    Returns
    -------
    K : float
        Equilibrium K value of component i, calculated with an approach
        depending on the provided inputs [-]

    Notes
    -----
    The Poynting correction factor is normally simplified as follows, due to
    a liquid's low pressure dependency:

    .. math::
        K_i = \frac{\gamma_i P_i^{sat} \phi_i^{l, ref} \exp\left[\frac{V_l
        (P-P_i^{sat})}{RT}\right]}{\phi_i^v P}

    Examples
    --------
    Raoult's law:

    >>> Func(101325, 3000.)
    0.029607698001480384

    Modified Raoult's law:

    >>> Func(P=101325, Psat=3000, gamma=0.9)
    0.026646928201332347

    EOS-only approach:

    >>> Func(phi_l=1.6356, phi_g=0.88427)
    1.8496613025433408

    Gamma-phi combined approach:

    >>> Func(P=1E6, Psat=1938800, phi_l=1.4356, phi_g=0.88427, gamma=0.92)
    2.8958055544121137

    Gamma-phi combined approach with a Poynting factor:

    >>> Func(P=1E6, Psat=1938800, phi_l=1.4356, phi_g=0.88427, gamma=0.92,
    ... Poynting=0.999)
    2.8929097488577016

    References
    ----------
    .. [1] Gmehling, Jurgen, Barbel Kolbe, Michael Kleiber, and Jurgen Rarey.
       Chemical Thermodynamics for Process Simulation. 1st edition. Weinheim:
       Wiley-VCH, 2012.
    .. [2] Skogestad, Sigurd. Chemical and Energy Process Engineering. 1st
       edition. Boca Raton, FL: CRC Press, 2008.
    '''
    try:
        if arg_4:
            if arg_2:
                return arg_4*arg_1*arg_2*arg_5/(arg_3*arg_0)
            return arg_4*arg_1*arg_5/arg_0
        elif arg_2:
            return arg_2/arg_3
        return arg_1/arg_0
    except TypeError:
        raise Exception('Input must consist of one set from (P, Psat, phi_l, \
phi_g, gamma), (P, Psat, gamma), (phi_l, phi_g), (P, Psat)')

r'''Calculates the equilibrium K-value assuming Raoult's law,
    or an equation of state model, or an activity coefficient model,
    or a combined equation of state-activity model.

    The calculation procedure will use the most advanced approach with the
    provided inputs:

        * If `P`, `Psat`, `phi_l`, `phi_g`, and `gamma` are provided, use the
          combined approach.
        * If `P`, `Psat`, and `gamma` are provided, use the modified Raoult's
          law.
        * If `phi_l` and `phi_g` are provided, use the EOS only method.
        * If `P` and `Psat` are provided, use Raoult's law.

    Definitions:

    .. math::
        K_i=\frac{y_i}{x_i}

    Raoult's law:

    .. math::
        K_i = \frac{P_{i}^{sat}}{P}

    Activity coefficient, no EOS (modified Raoult's law):

    .. math::
        K_i = \frac{\gamma_i P_{i}^{sat}}{P}

    Equation of state only:

    .. math::
        K_i = \frac{\phi_i^l}{\phi_i^v} = \frac{f_i^l}{f_i^v}

    Combined approach (liquid reference fugacity coefficient is normally
    calculated the saturation pressure for it as a pure species; vapor fugacity
    coefficient calculated normally):

    .. math::
        K_i = \frac{\gamma_i P_i^{sat} \phi_i^{l,ref}}{\phi_i^v P}

    Combined approach, with Poynting Correction Factor (liquid molar volume in
    the integral is for i as a pure species only):

    .. math::
        K_i = \frac{\gamma_i P_i^{sat} \phi_i^{l, ref} \exp\left[\frac{
        \int_{P_i^{sat}}^P V_i^l dP}{RT}\right]}{\phi_i^v P}

    Parameters
    ----------
    P : float
        System pressure, optional
    Psat : float
        Vapor pressure of species i, [Pa]
    phi_l : float
        Fugacity coefficient of species i in the liquid phase, either
        at the system conditions (EOS-only case) or at the saturation pressure
        of species i as a pure species (reference condition for the combined
        approach), optional [-]
    phi_g : float
        Fugacity coefficient of species i in the vapor phase at the system
        conditions, optional [-]
    gamma : float
        Activity coefficient of species i in the liquid phase, optional [-]
    Poynting : float
        Poynting correction factor, optional [-]

    Returns
    -------
    K : float
        Equilibrium K value of component i, calculated with an approach
        depending on the provided inputs [-]

    Notes
    -----
    The Poynting correction factor is normally simplified as follows, due to
    a liquid's low pressure dependency:

    .. math::
        K_i = \frac{\gamma_i P_i^{sat} \phi_i^{l, ref} \exp\left[\frac{V_l
        (P-P_i^{sat})}{RT}\right]}{\phi_i^v P}

    Examples
    --------
    Raoult's law:

    >>> K_value(101325, 3000.)
    0.029607698001480384

    Modified Raoult's law:

    >>> K_value(P=101325, Psat=3000, gamma=0.9)
    0.026646928201332347

    EOS-only approach:

    >>> K_value(phi_l=1.6356, phi_g=0.88427)
    1.8496613025433408

    Gamma-phi combined approach:

    >>> K_value(P=1E6, Psat=1938800, phi_l=1.4356, phi_g=0.88427, gamma=0.92)
    2.8958055544121137

    Gamma-phi combined approach with a Poynting factor:

    >>> K_value(P=1E6, Psat=1938800, phi_l=1.4356, phi_g=0.88427, gamma=0.92,
    ... Poynting=0.999)
    2.8929097488577016

    References
    ----------
    .. [1] Gmehling, Jurgen, Barbel Kolbe, Michael Kleiber, and Jurgen Rarey.
       Chemical Thermodynamics for Process Simulation. 1st edition. Weinheim:
       Wiley-VCH, 2012.
    .. [2] Skogestad, Sigurd. Chemical and Energy Process Engineering. 1st
       edition. Boca Raton, FL: CRC Press, 2008.

r Calculates the equilibrium K - value assuming Raoult s law or an equation of state model or an activity coefficient model or a combined equation of state - activity model .


def Func ( arg_0 , arg_1 ) : arg_2 = None for arg_3 in arg_1 : if type ( arg_3 ) is c_ast . For : return arg_0 . Func ( arg_3 ) or arg_3 else : arg_2 = arg_2 or arg_0 . Func ( arg_3 ) return arg_2

def Func(arg_0, arg_1):
        """Return inner most for loop in loop nest"""
        arg_2 = None
        for arg_3 in arg_1:
            if type(arg_3) is c_ast.For:
                return arg_0.Func(arg_3) or arg_3
            else:
                arg_2 = arg_2 or arg_0.Func(arg_3)
        return arg_2


def Func(arg_0, arg_1, arg_2=False):
        """This forwards signal to sink"""
        assert isinstance(arg_1, Eventful), f'{sink.__class__.__name__} is not Eventful'
        arg_0._forwards[arg_1] = arg_2


return [get_item(item) for item in iterable]

def
Func
(
arg_0
,
arg_1
)
:
def
get_item
(
arg_2
)
:
if
isinstance
(
arg_2
,
int
)
:
return
arg_0
[
arg_2
]
elif
isinstance
(
arg_2
,
string_types
)
:
return
arg_0
.
get_by_id
(
arg_2
)
elif
arg_2
in
arg_0
:
return
arg_2
else
:
raise
TypeError
(
"item in iterable cannot be '%s'"
%
type
(
arg_2
)
)
if
not
isinstance
(
arg_1
,
list
)
:
arg_1
=
[
arg_1
]
return
[
get_item
(
arg_2
)
for
arg_2
in
arg_1
]

def Func(arg_0, arg_1):
        """
        Get a list of members using several different ways of indexing

        Parameters
        ----------
        iterable : list (if not, turned into single element list)
            list where each element is either int (referring to an index in
            in this DictList), string (a id of a member in this DictList) or
            member of this DictList for pass-through

        Returns
        -------
        list
            a list of members
        """
        def get_item(arg_2):
            if isinstance(arg_2, int):
                return arg_0[arg_2]
            elif isinstance(arg_2, string_types):
                return arg_0.get_by_id(arg_2)
            elif arg_2 in arg_0:
                return arg_2
            else:
                raise TypeError("item in iterable cannot be '%s'" % type(arg_2))

        if not isinstance(arg_1, list):
            arg_1 = [arg_1]
        return [get_item(arg_2) for arg_2 in arg_1]


def Func(arg_0, arg_1):
    """ Save the model in the given directory.

    :param FuncModelDir: (string)
         Absolute directory path for saving the model. This directory should
         only be used to store a Funcd model. If the directory does not exist,
         it will be created automatically and populated with model data. A
         pre-existing directory will only be accepted if it contains previously
         Funcd model data. If such a directory is given, the full contents of
         the directory will be deleted and replaced with current model data.
    """
    arg_2 = arg_0._getLogger()
    arg_2.debug("(%s) Creating local checkpoint in %r...",
                       arg_0, arg_1)

    arg_3 = arg_0._getModelPickleFilePath(arg_1)

    # Clean up old Funcd state, if any
    if os.path.exists(arg_1):
      if not os.path.isdir(arg_1):
        raise Exception(("Existing filesystem entry <%s> is not a model"
                         " checkpoint -- refusing to delete (not a directory)") \
                          % arg_1)
      if not os.path.isfile(arg_3):
        raise Exception(("Existing filesystem entry <%s> is not a model"
                         " checkpoint -- refusing to delete"\
                         " (%s missing or not a file)") % \
                          (arg_1, arg_3))

      shutil.rmtree(arg_1)

    # Create a new directory for saving state
    arg_0.__makeDirectoryFromAbsolutePath(arg_1)

    with open(arg_3, 'wb') as modelPickleFile:
      arg_2.debug("(%s) Pickling Model instance...", arg_0)

      pickle.dump(arg_0, modelPickleFile, protocol=pickle.HIGHEST_PROTOCOL)

      arg_2.debug("(%s) Finished pickling Model instance", arg_0)

    # Tell the model to Func extra data, if any, that's too big for pickling
    arg_0._serializeExtraData(extraDataDir=arg_0._getModelExtraDataDir(arg_1))

    arg_2.debug("(%s) Finished creating local checkpoint", arg_0)

    return

Save the model in the given directory.

    :param saveModelDir: (string)
         Absolute directory path for saving the model. This directory should
         only be used to store a saved model. If the directory does not exist,
         it will be created automatically and populated with model data. A
         pre-existing directory will only be accepted if it contains previously
         saved model data. If such a directory is given, the full contents of
         the directory will be deleted and replaced with current model data.


def
Func
(
arg_0
,
arg_1
,
arg_2
=
)
:
log
.
debug
(
"Looking for vpid on {0}"
,
arg_1
)
arg_2
=
arg_2
or
arg_0
.
session
.
http
.
get
(
arg_1
)
arg_3
=
arg_0
.
mediator_re
.
search
(
arg_2
.
text
)
arg_4
=
arg_3
and
parse_json
(
arg_3
.
group
(
1
)
,
schema
=
arg_0
.
mediator_schema
)
return
arg_4

def Func(arg_0, arg_1, arg_2=None):
        """
        Find the Video Packet ID in the HTML for the provided URL

        :param url: URL to download, if res is not provided.
        :param res: Provide a cached version of the HTTP response to search
        :type url: string
        :type res: requests.Response
        :return: Video Packet ID for a Programme in iPlayer
        :rtype: string
        """
        log.debug("Looking for vpid on {0}", arg_1)
        # Use pre-fetched page if available
        arg_2 = arg_2 or arg_0.session.http.get(arg_1)
        arg_3 = arg_0.mediator_re.search(arg_2.text)
        arg_4 = arg_3 and parse_json(arg_3.group(1), schema=arg_0.mediator_schema)
        return arg_4


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
log
.
debug
(
'Save access token %r'
,
arg_1
)
arg_0
.
_tokensetter
(
arg_1
,
arg_2
)

def Func(arg_0, arg_1, arg_2):
        """Save access token to database.

        A tokensetter is required, which accepts a token and request
        parameters::

            def tokensetter(token, request):
                access_token = Token(
                    client=request.client,
                    user=request.user,
                    token=token['oauth_token'],
                    secret=token['oauth_token_secret'],
                    realms=token['oauth_authorized_realms'],
                )
                return access_token.save()
        """
        log.debug('Save access token %r', arg_1)
        arg_0._tokensetter(arg_1, arg_2)


(key, token, user_id, action_id="", current_time=None)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = "" , arg_4 = None ) : if not arg_1 : return False try : arg_5 = base64 . urlsafe_b64decode ( arg_1 ) arg_6 = int ( arg_5 . split ( DELIMITER ) [ - 1 ] ) except ( TypeError , ValueError , binascii . Error ) : return False if arg_4 is None : arg_4 = time . time ( ) if arg_4 - arg_6 > DEFAULT_TIMEOUT_SECS : return False arg_7 = generate_token ( arg_0 , arg_2 , arg_3 = arg_3 , when = arg_6 ) if len ( arg_1 ) != len ( arg_7 ) : return False arg_8 = 0 for arg_9 , arg_10 in zip ( bytearray ( arg_1 ) , bytearray ( arg_7 ) ) : arg_8 |= arg_9 ^ arg_10 return not arg_8

def Func(arg_0, arg_1, arg_2, arg_3="", arg_4=None):
    """Validates that the given token authorizes the user for the action.

    Tokens are invalid if the time of issue is too old or if the token
    does not match what generateToken outputs (i.e. the token was forged).

    Args:
        key: secret key to use.
        token: a string of the token generated by generateToken.
        user_id: the user ID of the authenticated user.
        action_id: a string identifier of the action they requested
                   authorization for.

    Returns:
        A boolean - True if the user is authorized for the action, False
        otherwise.
    """
    if not arg_1:
        return False
    try:
        arg_5 = base64.urlsafe_b64decode(arg_1)
        arg_6 = int(arg_5.split(DELIMITER)[-1])
    except (TypeError, ValueError, binascii.Error):
        return False
    if arg_4 is None:
        arg_4 = time.time()
    # If the token is too old it's not valid.
    if arg_4 - arg_6 > DEFAULT_TIMEOUT_SECS:
        return False

    # The given token should match the generated one with the same time.
    arg_7 = generate_token(arg_0, arg_2, arg_3=arg_3,
                                    when=arg_6)
    if len(arg_1) != len(arg_7):
        return False

    # Perform constant time comparison to avoid timing attacks
    arg_8 = 0
    for arg_9, arg_10 in zip(bytearray(arg_1), bytearray(arg_7)):
        arg_8 |= arg_9 ^ arg_10
    return not arg_8

Validates that the given token authorizes the user for the action .


def
Func
(
arg_0
)
:
if
not
len
(
arg_0
.
log
)
:
raise
RuntimeError
(
'Nothing executed'
)
try
:
arg_1
=
[
l
for
l
in
arg_0
.
log
if
l
[
1
]
!=
0
]
return
arg_1
[
1
]
[
2
]
except
IndexError
:
return
'no last error'

def Func(arg_0):
        """Get the output of the last command exevuted."""
        if not len(arg_0.log):
            raise RuntimeError('Nothing executed')

        try:
            arg_1 = [l for l in arg_0.log if l[1] != 0]

            return arg_1[-1][2]
        except IndexError:
            # odd case where there were no errors
            #TODO
            return 'no last error'

Get the output of the last command exevuted .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
logger
.
info
(
"Func: Jumping to: %r:%r"
,
arg_1
.
read
(
)
,
arg_2
.
read
(
)
)
arg_0
.
CS
=
arg_1
.
read
(
)
arg_0
.
PC
=
arg_2
.
read
(
)

def Func(arg_0, arg_1, arg_2):
        """
        We are just going to ignore the CS selector for now.
        """
        logger.info("Func: Jumping to: %r:%r", arg_1.read(), arg_2.read())
        arg_0.CS = arg_1.read()
        arg_0.PC = arg_2.read()

We are just going to ignore the CS selector for now .


def Func(arg_0):
  """
  Make the plot with photometry performance predictions.

  :argument args: command line arguments
  """
  arg_1=np.linspace(3.0,20.0,171)

  arg_2 = arg_0['vmini']

  arg_3=arg_1-gminvFromVmini(arg_2)

  if arg_0['eom']:
      arg_4 = gMagnitudeErrorEoM(arg_1)
      arg_5 = bpMagnitudeErrorEoM(arg_1, arg_2)
      arg_6 = rpMagnitudeErrorEoM(arg_1, arg_2)
      arg_7 = (1.0-4,0.1)
  else:
      arg_4 = gMagnitudeError(arg_1)
      arg_5 = bpMagnitudeError(arg_1, arg_2)
      arg_6 = rpMagnitudeError(arg_1, arg_2)
      arg_7 = (1.0-4,1)

  arg_8=plt.figure(figsize=(10,6.5))

  if (arg_0['vmagAbscissa']):
    plt.semilogy(arg_3, arg_4, 'k', label='$\\sigma_G$')
    plt.semilogy(arg_3, arg_5, 'b', label='$\\sigma_{G_\\mathrm{BP}}$'+' for $(V-I)={0}$'.format(arg_2))
    plt.semilogy(arg_3, arg_6, 'r', label='$\\sigma_{G_\\mathrm{RP}}$'+' for $(V-I)={0}$'.format(arg_2))
    plt.xlim((6,20))
    #plt.ylim(yminmax)
    plt.legend(loc=0)
    plt.xlabel('$V$ [mag]')
  else:
    arg_9=arg_8.add_subplot(111)
    plt.semilogy(arg_1, arg_4, 'k', label='$\\sigma_G$')
    plt.semilogy(arg_1, arg_5, 'b', label='$\\sigma_{G_\\mathrm{BP}}$'+' for $(V-I)={0}$'.format(arg_2))
    plt.semilogy(arg_1, arg_6, 'r', label='$\\sigma_{G_\\mathrm{RP}}$'+' for $(V-I)={0}$'.format(arg_2))
    plt.xlim((6,20))
    #plt.ylim(yminmax)
    plt.legend(loc=0)
    plt.xlabel('$G$ [mag]')

  plt.xticks(np.arange(6,20,2))
  arg_9 = plt.gca().yaxis
  #ax.set_major_formatter(matplotlib.ticker.ScalarFormatter())
  #plt.ticklabel_format(axis='y',style='plain')
  plt.grid(which='both')
  plt.ylabel('Photometric error [mag]')
  if arg_0['eom']:
      plt.title('End-of-mission mean photometry: sky averaged errors for $(V-I)={0}$'.format(arg_2), fontsize=14)
  else:
      plt.title('Single-FoV-transit photometry: sky averaged errors for $(V-I)={0}$'.format(arg_2), fontsize=14)

  arg_10 = 'PhotometricErrors'
  if (arg_0['pdfOutput']):
    plt.savefig(arg_10+'.pdf')
  elif (arg_0['pngOutput']):
    plt.savefig(arg_10+'.png')
  else:
    plt.show()

Make the plot with photometry performance predictions .


def Func ( arg_0 , arg_1 = None ) : if arg_0 . startswith ( 'gs://' ) : return _Func_from_gcs ( arg_0 , arg_1 ) else : return open ( arg_0 , 'r' )

def Func(arg_0, arg_1=None):
  """Load a file from either local or gcs.

  Args:
    file_path: The target file path, which should have the prefix 'gs://' if
               to be loaded from gcs.
    credentials: Optional credential to be used to load the file from gcs.

  Returns:
    A python File object if loading file from local or a StringIO object if
    loading from gcs.
  """
  if arg_0.startswith('gs://'):
    return _Func_from_gcs(arg_0, arg_1)
  else:
    return open(arg_0, 'r')


async def Func(arg_0) -> Message:
        """
        Receive ASGI websocket messages, ensuring valid state transitions.
        """
        if arg_0.client_state == WebSocketState.CONNECTING:
            arg_1 = await arg_0._Func()
            arg_2 = arg_1["type"]
            assert arg_2 == "websocket.connect"
            arg_0.client_state = WebSocketState.CONNECTED
            return arg_1
        elif arg_0.client_state == WebSocketState.CONNECTED:
            arg_1 = await arg_0._Func()
            arg_2 = arg_1["type"]
            assert arg_2 in {"websocket.Func", "websocket.disconnect"}
            if arg_2 == "websocket.disconnect":
                arg_0.client_state = WebSocketState.DISCONNECTED
            return arg_1
        else:
            raise RuntimeError(
                'Cannot call "Func" once a disconnect message has been Funcd.'
            )

Receive ASGI websocket messages ensuring valid state transitions .


def Func ( arg_0 ) -> dict : arg_1 = { } arg_1 [ 'type' ] = 'postBack' arg_1 [ 'title' ] = arg_0 . name arg_1 [ 'value' ] = arg_0 . callback = arg_0 . callback return arg_1

def Func(arg_0) -> dict:
        """Returns MS Bot Framework compatible state of the Button instance.

        Creates MS Bot Framework CardAction (button) with postBack value return.

        Returns:
            control_json: MS Bot Framework representation of Button state.
        """
        arg_1 = {}
        arg_1['type'] = 'postBack'
        arg_1['title'] = arg_0.name
        arg_1['value'] = arg_0.callback = arg_0.callback
        return arg_1

Returns MS Bot Framework compatible state of the Button instance .


return configparser.RawConfigParser.read(self, filename, **kwargs)

def Func ( arg_0 , arg_1 ) : arg_2 = { } if sys . version_info >= ( 3 , 2 ) : arg_2 [ 'encoding' ] = "utf-8" return configparser . RawConfigParser . Func ( arg_0 , arg_1 , ** arg_2 )

def Func(arg_0, arg_1):
        """Read a filename as UTF-8 configuration data."""
        arg_2 = {}
        if sys.version_info >= (3, 2):
            arg_2['encoding'] = "utf-8"
        return configparser.RawConfigParser.Func(arg_0, arg_1, **arg_2)

Read a filename as UTF - 8 configuration data .


return (
        init + len(update)
            if isinstance(init, int) else
        init + update
    )

def Func ( arg_0 , arg_1 ) : return ( arg_0 + len ( arg_1 ) if isinstance ( arg_0 , int ) else arg_0 + arg_1 )

def Func(arg_0, arg_1):
    """
    Generic Func function.

    .. code-block:: python

        # Simplest Form
        >>> a = 'this' + ' '
        >>> b = 'that'
        >>> c = functools.reduce(Func, a, b)
        >>> c
        'this that'

        # The type of the initial value determines output type.
        >>> a = 5
        >>> b = Hello
        >>> c = functools.reduce(Func, a, b)
        >>> c
        10

    :param init:  Initial Value
    :param update: Value to accumulate

    :return: Combined Values
    """
    return (
        arg_0 + len(arg_1)
            if isinstance(arg_0, int) else
        arg_0 + arg_1
    )

Generic accumulator function.

    .. code-block:: python

        # Simplest Form
        >>> a = 'this' + ' '
        >>> b = 'that'
        >>> c = functools.reduce(accumulator, a, b)
        >>> c
        'this that'

        # The type of the initial value determines output type.
        >>> a = 5
        >>> b = Hello
        >>> c = functools.reduce(accumulator, a, b)
        >>> c
        10

    :param init:  Initial Value
    :param update: Value to accumulate

    :return: Combined Values


def
Func
(
arg_0
)
:
try
:
arg_1
=
arg_0
.
ec2
.
Func
(
CidrBlock
=
'10.0.0.0/16'
,
AmazonProvidedIpv6CidrBlock
=
False
,
)
except
Exception
as
e
:
logger
.
error
(
"{}\n"
.
format
(
e
)
)
raise
e
arg_2
=
arg_0
.
ec2
.
create_internet_gateway
(
)
arg_2
.
attach_to_vpc
(
VpcId
=
arg_1
.
vpc_id
)
arg_0
.
internet_gateway
=
arg_2
.
id
arg_3
=
arg_0
.
config_route_table
(
arg_1
,
arg_2
)
arg_0
.
route_table
=
arg_3
.
id
arg_4
=
arg_0
.
client
.
describe_availability_zones
(
)
for
arg_5
,
arg_6
in
enumerate
(
arg_4
[
'AvailabilityZones'
]
)
:
if
arg_6
[
'State'
]
==
"available"
:
arg_7
=
arg_1
.
create_subnet
(
CidrBlock
=
'10.0.{}.0/20'
.
format
(
16
*
arg_5
)
,
AvailabilityZone
=
arg_6
[
'ZoneName'
]
)
arg_7
.
meta
.
client
.
modify_subnet_attribute
(
SubnetId
=
arg_7
.
id
,
MapPublicIpOnLaunch
=
{
"Value"
:
True
}
)
arg_3
.
associate_with_subnet
(
SubnetId
=
arg_7
.
id
)
arg_0
.
sn_ids
.
append
(
arg_7
.
id
)
else
:
logger
.
info
(
"{} unavailable"
.
format
(
arg_6
[
'ZoneName'
]
)
)
arg_0
.
security_group
(
arg_1
)
arg_0
.
vpc_id
=
arg_1
.
id
return
arg_1

def Func(arg_0):
        """Create and configure VPC

        We create a VPC with CIDR 10.0.0.0/16, which provides up to 64,000 instances.

        We attach a subnet for each availability zone within the region specified in the
        config. We give each subnet an ip range like 10.0.X.0/20, which is large enough
        for approx. 4000 instances.

        Security groups are configured in function security_group.
        """

        try:
            # We use a large VPC so that the cluster can get large
            arg_1 = arg_0.ec2.Func(
                CidrBlock='10.0.0.0/16',
                AmazonProvidedIpv6CidrBlock=False,
            )
        except Exception as e:
            # This failure will cause a full abort
            logger.error("{}\n".format(e))
            raise e

        # Attach internet gateway so that our cluster can
        # talk to the outside internet
        arg_2 = arg_0.ec2.create_internet_gateway()
        arg_2.attach_to_vpc(VpcId=arg_1.vpc_id)  # Returns None
        arg_0.internet_gateway = arg_2.id

        # Create and configure route table to allow proper traffic
        arg_3 = arg_0.config_route_table(arg_1, arg_2)
        arg_0.route_table = arg_3.id

        # Get all avaliability zones
        arg_4 = arg_0.client.describe_availability_zones()

        # go through AZs and set up a subnet per
        for arg_5, arg_6 in enumerate(arg_4['AvailabilityZones']):
            if arg_6['State'] == "available":

                # Create a large subnet (4000 max nodes)
                arg_7 = arg_1.create_subnet(
                    CidrBlock='10.0.{}.0/20'.format(16 * arg_5), AvailabilityZone=arg_6['ZoneName']
                )

                # Make subnet accessible
                arg_7.meta.client.modify_subnet_attribute(
                    SubnetId=arg_7.id, MapPublicIpOnLaunch={"Value": True}
                )

                arg_3.associate_with_subnet(SubnetId=arg_7.id)
                arg_0.sn_ids.append(arg_7.id)
            else:
                logger.info("{} unavailable".format(arg_6['ZoneName']))
        # Security groups
        arg_0.security_group(arg_1)
        arg_0.vpc_id = arg_1.id
        return arg_1


def Func(arg_0, arg_1=None, arg_2=True):
        """Load a JSON data file into the internal JSON data dictionary.

        Current internal data will be overwritten.
        If no file path is provided, the stored data file path will be used.

        Args:
            filePath (Optional[str]): A relative or absolute path to a
                '.json' file. Defaults to None.
            updatePath (Optional[bool]): Specifies whether or not to update
                the stored data file path. Defaults to True.

        """
        if not arg_1:
            arg_1 = arg_0.filePath
        if not os.path.isfile(arg_1):
            raise FileNotFoundError("Data file '%s' does not exist." % (arg_1))
        else:
            print("Importing existing data file '%s' ... " % (arg_1), end="", flush=True)
            with open(arg_1, "r") as q:
                arg_3 = q.read()
            print("Imported!")
            arg_0.data = json.loads(arg_3)
            if arg_2:
                arg_0.filePath = arg_1

Load a JSON data file into the internal JSON data dictionary .


def
Func
(
arg_0
=
,
arg_1
=
False
)
:
arg_2
=
new
(
CoreFoundation
,
'CFArrayRef *'
)
arg_3
=
Security
.
SecTrustCopyAnchorCertificates
(
arg_2
)
handle_sec_error
(
arg_3
)
arg_4
=
unwrap
(
arg_2
)
arg_5
=
{
}
arg_6
=
{
}
arg_7
=
'2.5.29.37.0'
arg_8
=
(
set
(
)
,
set
(
)
)
arg_9
=
CoreFoundation
.
CFArrayGetCount
(
arg_4
)
for
arg_10
in
range
(
0
,
arg_9
)
:
arg_11
=
CoreFoundation
.
CFArrayGetValueAtIndex
(
arg_4
,
arg_10
)
arg_12
,
arg_13
=
_cert_details
(
arg_11
)
arg_5
[
arg_13
]
=
arg_12
CoreFoundation
.
CFRelease
(
arg_4
)
for
arg_14
in
[
SecurityConst
.
kSecTrustSettingsDomainUser
,
SecurityConst
.
kSecTrustSettingsDomainAdmin
]
:
arg_15
=
new
(
CoreFoundation
,
'CFArrayRef *'
)
arg_3
=
Security
.
SecTrustSettingsCopyCertificates
(
arg_14
,
arg_15
)
if
arg_3
==
SecurityConst
.
errSecNoTrustSettings
:
continue
handle_sec_error
(
arg_3
)
arg_16
=
unwrap
(
arg_15
)
arg_9
=
CoreFoundation
.
CFArrayGetCount
(
arg_16
)
for
arg_10
in
range
(
0
,
arg_9
)
:
arg_11
=
CoreFoundation
.
CFArrayGetValueAtIndex
(
arg_16
,
arg_10
)
arg_17
=
new
(
CoreFoundation
,
'CFArrayRef *'
)
arg_3
=
Security
.
SecTrustSettingsCopyTrustSettings
(
arg_11
,
arg_14
,
arg_17
)
if
arg_3
==
SecurityConst
.
errSecItemNotFound
:
continue
if
arg_3
==
SecurityConst
.
errSecInvalidTrustSettings
:
arg_12
,
arg_13
=
_cert_details
(
arg_11
)
if
arg_13
in
arg_5
:
_cert_callback
(
arg_0
,
arg_5
[
arg_13
]
,
'invalid trust settings'
)
del
arg_5
[
arg_13
]
continue
handle_sec_error
(
arg_3
)
arg_18
=
unwrap
(
arg_17
)
arg_19
=
set
(
)
arg_20
=
set
(
)
arg_21
=
CoreFoundation
.
CFArrayGetCount
(
arg_18
)
for
arg_22
in
range
(
0
,
arg_21
)
:
arg_23
=
CoreFoundation
.
CFArrayGetValueAtIndex
(
arg_18
,
arg_22
)
arg_24
=
CFHelpers
.
cf_dictionary_to_dict
(
arg_23
)
arg_25
=
arg_24
.
get
(
'kSecTrustSettingsPolicy'
,
{
}
)
.
get
(
'SecPolicyOid'
,
arg_7
)
arg_26
=
arg_24
.
get
(
'kSecTrustSettingsResult'
,
1
)
arg_27
=
arg_26
!=
0
and
arg_26
!=
3
if
arg_27
:
arg_19
.
add
(
arg_25
)
else
:
arg_20
.
add
(
arg_25
)
arg_12
,
arg_13
=
_cert_details
(
arg_11
)
if
arg_7
in
arg_20
:
if
arg_13
in
arg_5
:
_cert_callback
(
arg_0
,
arg_5
[
arg_13
]
,
'explicitly distrusted'
)
del
arg_5
[
arg_13
]
else
:
if
arg_7
in
arg_19
:
arg_19
=
set
(
[
arg_7
]
)
arg_6
[
arg_13
]
=
(
arg_19
,
arg_20
)
CoreFoundation
.
CFRelease
(
arg_18
)
CoreFoundation
.
CFRelease
(
arg_16
)
arg_28
=
[
]
for
arg_13
in
arg_5
:
if
not
arg_1
:
_cert_callback
(
arg_0
,
arg_5
[
arg_13
]
,
)
arg_29
=
arg_6
.
get
(
arg_13
,
arg_8
)
arg_28
.
append
(
(
arg_5
[
arg_13
]
,
arg_29
[
0
]
,
arg_29
[
1
]
)
)
return
arg_28

def Func(arg_0=None, arg_1=False):
    """
    Extracts trusted CA certificates from the OS X trusted root keychain.

    :param cert_callback:
        A callback that is called once for each certificate in the trust store.
        It should accept two parameters: an asn1crypto.x509.Certificate object,
        and a reason. The reason will be None if the certificate is being
        exported, otherwise it will be a unicode string of the reason it won't.

    :param callback_only_on_failure:
        A boolean - if the callback should only be called when a certificate is
        not exported.

    :raises:
        OSError - when an error is returned by the OS crypto library

    :return:
        A list of 3-element tuples:
         - 0: a byte string of a DER-encoded certificate
         - 1: a set of unicode strings that are OIDs of purposes to trust the
              certificate for
         - 2: a set of unicode strings that are OIDs of purposes to reject the
              certificate for
    """

    arg_2 = new(CoreFoundation, 'CFArrayRef *')
    arg_3 = Security.SecTrustCopyAnchorCertificates(arg_2)
    handle_sec_error(arg_3)

    arg_4 = unwrap(arg_2)

    arg_5 = {}
    arg_6 = {}

    arg_7 = '2.5.29.37.0'
    arg_8 = (set(), set())

    arg_9 = CoreFoundation.CFArrayGetCount(arg_4)
    for arg_10 in range(0, arg_9):
        arg_11 = CoreFoundation.CFArrayGetValueAtIndex(arg_4, arg_10)
        arg_12, arg_13 = _cert_details(arg_11)
        arg_5[arg_13] = arg_12

    CoreFoundation.CFRelease(arg_4)

    for arg_14 in [SecurityConst.kSecTrustSettingsDomainUser, SecurityConst.kSecTrustSettingsDomainAdmin]:
        arg_15 = new(CoreFoundation, 'CFArrayRef *')
        arg_3 = Security.SecTrustSettingsCopyCertificates(arg_14, arg_15)
        if arg_3 == SecurityConst.errSecNoTrustSettings:
            continue
        handle_sec_error(arg_3)

        arg_16 = unwrap(arg_15)

        arg_9 = CoreFoundation.CFArrayGetCount(arg_16)
        for arg_10 in range(0, arg_9):
            arg_11 = CoreFoundation.CFArrayGetValueAtIndex(arg_16, arg_10)

            arg_17 = new(CoreFoundation, 'CFArrayRef *')
            arg_3 = Security.SecTrustSettingsCopyTrustSettings(arg_11, arg_14, arg_17)

            # In OS X 10.11, this value started being seen. From the comments in
            # the Security Framework Reference, the lack of any settings should
            # indicate "always trust this certificate"
            if arg_3 == SecurityConst.errSecItemNotFound:
                continue

            # If the trust settings for a certificate are invalid, we need to
            # assume the certificate should not be trusted
            if arg_3 == SecurityConst.errSecInvalidTrustSettings:
                arg_12, arg_13 = _cert_details(arg_11)
                if arg_13 in arg_5:
                    _cert_callback(
                        arg_0,
                        arg_5[arg_13],
                        'invalid trust settings'
                    )
                    del arg_5[arg_13]
                continue

            handle_sec_error(arg_3)

            arg_18 = unwrap(arg_17)

            arg_19 = set()
            arg_20 = set()
            arg_21 = CoreFoundation.CFArrayGetCount(arg_18)
            for arg_22 in range(0, arg_21):
                arg_23 = CoreFoundation.CFArrayGetValueAtIndex(arg_18, arg_22)
                arg_24 = CFHelpers.cf_dictionary_to_dict(arg_23)

                # No policy OID means the trust result is for all purposes
                arg_25 = arg_24.get('kSecTrustSettingsPolicy', {}).get('SecPolicyOid', arg_7)

                # 0 = kSecTrustSettingsResultInvalid
                # 1 = kSecTrustSettingsResultTrustRoot
                # 2 = kSecTrustSettingsResultTrustAsRoot
                # 3 = kSecTrustSettingsResultDeny
                # 4 = kSecTrustSettingsResultUnspecified
                arg_26 = arg_24.get('kSecTrustSettingsResult', 1)
                arg_27 = arg_26 != 0 and arg_26 != 3

                if arg_27:
                    arg_19.add(arg_25)
                else:
                    arg_20.add(arg_25)

            arg_12, arg_13 = _cert_details(arg_11)

            # If rejected for all purposes, we don't export the certificate
            if arg_7 in arg_20:
                if arg_13 in arg_5:
                    _cert_callback(
                        arg_0,
                        arg_5[arg_13],
                        'explicitly distrusted'
                    )
                    del arg_5[arg_13]
            else:
                if arg_7 in arg_19:
                    arg_19 = set([arg_7])
                arg_6[arg_13] = (arg_19, arg_20)

            CoreFoundation.CFRelease(arg_18)

        CoreFoundation.CFRelease(arg_16)

    arg_28 = []
    for arg_13 in arg_5:
        if not arg_1:
            _cert_callback(arg_0, arg_5[arg_13], None)
        arg_29 = arg_6.get(arg_13, arg_8)
        arg_28.append((arg_5[arg_13], arg_29[0], arg_29[1]))
    return arg_28

Extracts trusted CA certificates from the OS X trusted root keychain .


return self._sort_course_modes([mode for mode in modes if mode['slug'] not in EXCLUDED_COURSE_MODES])

def Func ( arg_0 , arg_1 ) : arg_2 = arg_0 . get_course_details ( arg_1 ) arg_3 = arg_2 . get ( 'course_modes' , [ ] ) return arg_0 . _sort_course_modes ( [ arg_4 for arg_4 in arg_3 if arg_4 [ 'slug' ] not in EXCLUDED_COURSE_MODES ] )

def Func(arg_0, arg_1):
        """
        Query the Enrollment API for the specific course modes that are available for the given course_id.

        Arguments:
            course_id (str): The string value of the course's unique identifier

        Returns:
            list: A list of course mode dictionaries.

        """
        arg_2 = arg_0.get_course_details(arg_1)
        arg_3 = arg_2.get('course_modes', [])
        return arg_0._sort_course_modes([arg_4 for arg_4 in arg_3 if arg_4['slug'] not in EXCLUDED_COURSE_MODES])

Query the Enrollment API for the specific course modes that are available for the given course_id .


def Func(arg_0, arg_1):
    """
    Download a file or folder from the S3-like service.

    If REMOTE_PATH has a trailing slash it is considered to be a folder, e.g.: "s3://my-bucket/my-folder/". In this
    case, LOCAL_PATH must be a folder as well. The files and subfolder structure in REMOTE_PATH are copied to
    LOCAL_PATH.

    If REMOTE_PATH does not have a trailing slash, it is considered to be a file, and LOCAL_PATH should be a file as
    well.
    """
    arg_2 = STORAGES['s3']()
    arg_3 = s3conf.S3Conf(arg_2=arg_2)
    arg_3.Func(arg_0, arg_1)

Download a file or folder from the S3 - like service .


def Func ( arg_0 , * arg_1 , ** arg_2 ) : arg_3 = super ( S3Connection , arg_0 ) . Func ( * arg_1 , ** arg_2 ) if arg_3 : mimicdb . backend . sadd ( tpl . connection , arg_3 . name ) return arg_3

def Func(arg_0, *arg_1, **arg_2):
        """Add the bucket to MimicDB after successful creation.
        """
        arg_3 = super(S3Connection, arg_0).Func(*arg_1, **arg_2)

        if arg_3:
            mimicdb.backend.sadd(tpl.connection, arg_3.name)

        return arg_3

Add the bucket to MimicDB after successful creation .


(graph: BELGraph, key: str, cutoff: Optional[float] = None,
                          use_ambiguous: bool = False)

def Func(arg_0: arg_1, arg_2: arg_3, arg_4: arg_5[arg_6] = None,
                          arg_7: arg_8 = False) -> arg_6:
    """Calculates network-wide concordance.

    Assumes data already annotated with given key

    :param graph: A BEL graph
    :param key: The node data dictionary key storing the logFC
    :param cutoff: The optional logFC cutoff for significance
    :param use_ambiguous: Compare to ambiguous edges as well
    """
    arg_9, arg_10, arg_11, arg_12 = Func_helper(arg_0, arg_2, arg_4=arg_4)

    try:
        return arg_9 / (arg_9 + arg_10 + (arg_11 if arg_7 else 0))
    except ZeroDivisionError:
        return -1.0


def
Func
(
arg_0
,
arg_1
=
False
)
:
for
arg_2
,
arg_3
in
_FILE_READERS
:
if
arg_3
(
arg_0
)
:
with
arg_2
(
arg_0
)
as
f
:
parse_config
(
f
,
arg_1
=
arg_1
)
return
raise
IOError
(
'Unable to open file: {}'
.
format
(
arg_0
)
)

def Func(arg_0, arg_1=False):
  """Parse a Gin config file.

  Args:
    config_file: The path to a Gin config file.
    skip_unknown: A boolean indicating whether unknown configurables and imports
      should be skipped instead of causing errors (alternatively a list of
      configurable names to skip if unknown). See `parse_config` for additional
      details.

  Raises:
    IOError: If `config_file` cannot be read using any register file reader.
  """
  for arg_2, arg_3 in _FILE_READERS:
    if arg_3(arg_0):
      with arg_2(arg_0) as f:
        parse_config(f, arg_1=arg_1)
        return
  raise IOError('Unable to open file: {}'.format(arg_0))


def Func(arg_0, arg_1="sha256", **arg_2):
    """
    Create a certificate request.

    Arguments: pkey   - The key to associate with the request
               digest - Digestion method to use for signing, default is sha256
               **name - The name of the subject of the request, possible
                        arguments are:
                          C     - Country name
                          ST    - State or province name
                          L     - Locality name
                          O     - Organization name
                          OU    - Organizational unit name
                          CN    - Common name
                          emailAddress - E-mail address
    Returns:   The certificate request in an X509Req object
    """
    arg_3 = crypto.X509Req()
    arg_4 = arg_3.get_subject()

    for arg_5, arg_6 in arg_2.items():
        setattr(arg_4, arg_5, arg_6)

    arg_3.set_pubkey(arg_0)
    arg_3.sign(arg_0, arg_1)
    return arg_3


return dt.is_integer or dt.base_dtype == tf.bool

def
Func
(
arg_0
)
:
if
not
_is_known_dtype
(
arg_0
)
:
raise
TypeError
(
"Unrecognized dtype: {}"
.
format
(
arg_0
.
name
)
)
return
arg_0
.
is_integer
or
arg_0
.
base_dtype
==
tf
.
bool

def Func(arg_0):
  """Helper returning True if dtype.is_integer or is `bool`."""
  if not _is_known_dtype(arg_0):
    raise TypeError("Unrecognized dtype: {}".format(arg_0.name))
  return arg_0.is_integer or arg_0.base_dtype == tf.bool

Helper returning True if dtype . is_integer or is bool .


def
Func
(
arg_0
)
:
arg_1
=
platform
.
system
(
)
.
lower
(
)
if
arg_1
==
"darwin"
:
os
.
system
(
"open \""
+
arg_0
+
"\""
)
if
arg_1
==
"linux"
:
arg_2
=
"xdg-open \""
+
arg_0
+
"\"&"
os
.
system
(
arg_2
)
if
arg_1
==
"windows"
:
os
.
system
(
"start \""
+
arg_0
+
"\""
)

def Func(arg_0):
    """Open document by the default handler of the OS, could be a url opened by a browser, a text file by an editor etc"""
    arg_1 = platform.system().lower()
    if arg_1 == "darwin":
        os.system("open \"" + arg_0 + "\"")
    if arg_1 == "linux":
        arg_2 = "xdg-open \"" + arg_0 + "\"&"
        os.system(arg_2)
    if arg_1 == "windows":
        os.system("start \"" + arg_0 + "\"")

Open document by the default handler of the OS could be a url opened by a browser a text file by an editor etc


(self, model, tol=0.001, max_iters=999, verbose=True)

def Func(arg_0, arg_1, arg_2=0.001, arg_3=999, arg_4=True):
        """
        Runs EM iterations

        :param model: Normalization model (1: Gene->Allele->Isoform, 2: Gene->Isoform->Allele, 3: Gene->Isoform*Allele, 4: Gene*Isoform*Allele)
        :param tol: Tolerance for termination
        :param max_iters: Maximum number of iterations until termination
        :param verbose: Display information on how EM is Funcning
        :return: Nothing (as it performs in-place operations)
        """
        arg_5 = np.seterr(all='raise')
        np.seterr(under='ignore')
        if arg_4:
            print
            print "Iter No  Time (hh:mm:ss)    Total change (TPM)  "
            print "-------  ---------------  ----------------------"
        arg_6 = 0
        arg_7 = 1000000.0
        arg_8 = time.time()
        arg_9 = 1000000.0 * arg_2
        while arg_7 > arg_9 and arg_6 < arg_3:
            arg_10 = arg_0.get_allelic_expression().sum(axis=0)
            arg_10 *= (1000000.0 / arg_10.sum())
            arg_0.update_allelic_expression(arg_1=arg_1)
            arg_11 = arg_0.get_allelic_expression().sum(axis=0)
            arg_11 *= (1000000.0 / arg_11.sum())
            arg_12 = np.abs(arg_11 - arg_10)
            arg_7 = arg_12.sum()
            arg_6 += 1
            if arg_4:
                arg_13 = time.time()
                arg_14, arg_15 = divmod(int(arg_13 - arg_8), 60)
                arg_16, arg_17 = divmod(arg_14, 60)
                print " %5d      %4d:%02d:%02d     %9.1f / 1000000" % (arg_6, arg_16, arg_17, arg_15, arg_7)

Runs EM iterations

        :param model: Normalization model (1: Gene->Allele->Isoform, 2: Gene->Isoform->Allele, 3: Gene->Isoform*Allele, 4: Gene*Isoform*Allele)
        :param tol: Tolerance for termination
        :param max_iters: Maximum number of iterations until termination
        :param verbose: Display information on how EM is running
        :return: Nothing (as it performs in-place operations)


(self, institute, case, user, link, hpo_term=None,
                      omim_term=None, is_group=False)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5=None,
                      arg_6=None, arg_7=False):
        """Add a new phenotype term to a case

            Create a phenotype term and event with the given information

            Args:
                institute (Institute): A Institute object
                case (Case): Case object
                user (User): A User object
                link (str): The url to be used in the event
                hpo_term (str): A hpo id
                omim_term (str): A omim id
                is_group (bool): is phenotype term a group?

        """
        arg_8 = []
        try:
            if arg_5:
                arg_8 = [arg_5]
            elif arg_6:
                LOG.debug("Fetching info for mim term {0}".format(arg_6))
                arg_9 = arg_0.disease_term(arg_6)
                if arg_9:
                    for arg_5 in arg_9.get('hpo_terms', []):
                        arg_8.append(arg_5)
            else:
                raise ValueError('Must supply either hpo or omim term')
        except ValueError as e:
            ## TODO Should ve raise a more proper exception here?
            raise e

        arg_10 = set(term['phenotype_id'] for term in
                             arg_2.get('phenotype_terms', []))

        arg_11 = arg_2
        arg_12 = []
        for arg_5 in arg_8:
            LOG.debug("Fetching info for hpo term {0}".format(arg_5))
            arg_13 = arg_0.hpo_term(arg_5)
            if arg_13 is None:
                raise ValueError("Hpo term: %s does not exist in database" % arg_5)

            arg_14 = arg_13['_id']
            arg_15 = arg_13['description']
            if arg_14 not in arg_10:
                arg_16 = dict(arg_14=arg_14, feature=arg_15)
                arg_12.append(arg_16)

                LOG.info("Creating event for adding phenotype term for case"
                            " {0}".format(arg_2['display_name']))

                arg_0.create_event(
                    arg_1=arg_1,
                    arg_2=arg_2,
                    arg_3=arg_3,
                    arg_4=arg_4,
                    category='case',
                    verb='Func',
                    subject=arg_2['display_name'],
                    content=arg_14
                )

            if arg_7:
                arg_11 = arg_0.case_collection.find_one_and_update(
                    {'_id': arg_2['_id']},
                    {
                        '$addToSet': {
                            'phenotype_terms': {'$each': arg_12},
                            'phenotype_groups': {'$each': arg_12},
                        },
                    },
                    return_document=pymongo.ReturnDocument.AFTER
                )
            else:
                arg_11 = arg_0.case_collection.find_one_and_update(
                    {'_id': arg_2['_id']},
                    {
                        '$addToSet': {
                            'phenotype_terms': {'$each': arg_12},
                        },
                    },
                    return_document=pymongo.ReturnDocument.AFTER
                )

        LOG.debug("Case updated")
        return arg_11


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = U3Gate ( arg_0 , arg_1 , arg_2 ) if abs ( arg_3 . params [ 0 ] % ( 2.0 * math . pi ) ) < _CUTOFF_PRECISION : arg_3 = U1Gate ( arg_3 . params [ 0 ] + arg_3 . params [ 1 ] + arg_3 . params [ 2 ] ) if isinstance ( arg_3 , U3Gate ) : if abs ( ( arg_3 . params [ 0 ] - math . pi / 2 ) % ( 2.0 * math . pi ) ) < _CUTOFF_PRECISION : arg_3 = U2Gate ( arg_3 . params [ 1 ] , arg_3 . params [ 2 ] + ( arg_3 . params [ 0 ] - math . pi / 2 ) ) if abs ( ( arg_3 . params [ 0 ] + math . pi / 2 ) % ( 2.0 * math . pi ) ) < _CUTOFF_PRECISION : arg_3 = U2Gate ( arg_3 . params [ 1 ] + math . pi , arg_3 . params [ 2 ] - math . pi + ( arg_3 . params [ 0 ] + math . pi / 2 ) ) if isinstance ( arg_3 , U1Gate ) and abs ( arg_3 . params [ 0 ] % ( 4.0 * math . pi ) ) < _CUTOFF_PRECISION : arg_3 = IdGate ( ) return arg_3

def Func(arg_0, arg_1, arg_2):
    """Return the gate u1, u2, or u3 implementing U with the fewest pulses.

    The returned gate implements U exactly, not up to a global phase.

    Args:
        theta, phi, lam: input Euler rotation angles for a general U gate

    Returns:
        Gate: one of IdGate, U1Gate, U2Gate, U3Gate.
    """
    arg_3 = U3Gate(arg_0, arg_1, arg_2)
    # Y rotation is 0 mod 2*pi, so the gate is a u1
    if abs(arg_3.params[0] % (2.0 * math.pi)) < _CUTOFF_PRECISION:
        arg_3 = U1Gate(arg_3.params[0] + arg_3.params[1] + arg_3.params[2])
    # Y rotation is pi/2 or -pi/2 mod 2*pi, so the gate is a u2
    if isinstance(arg_3, U3Gate):
        # theta = pi/2 + 2*k*pi
        if abs((arg_3.params[0] - math.pi / 2) % (2.0 * math.pi)) < _CUTOFF_PRECISION:
            arg_3 = U2Gate(arg_3.params[1],
                          arg_3.params[2] + (arg_3.params[0] - math.pi / 2))
        # theta = -pi/2 + 2*k*pi
        if abs((arg_3.params[0] + math.pi / 2) % (2.0 * math.pi)) < _CUTOFF_PRECISION:
            arg_3 = U2Gate(arg_3.params[1] + math.pi,
                          arg_3.params[2] - math.pi + (arg_3.params[0] + math.pi / 2))
    # u1 and lambda is 0 mod 4*pi so gate is nop
    if isinstance(arg_3, U1Gate) and abs(arg_3.params[0] % (4.0 * math.pi)) < _CUTOFF_PRECISION:
        arg_3 = IdGate()
    return arg_3

Return the gate u1 u2 or u3 implementing U with the fewest pulses .


def
Func
(
arg_0
,
arg_1
)
:
arg_1
(
"Cleaning patterns %s"
,
arg_0
.
paved
.
Func
.
patterns
)
for
arg_2
in
arg_0
.
paved
.
Func
.
dirs
:
arg_1
(
"Cleaning in %s"
,
arg_2
)
for
arg_3
in
arg_0
.
paved
.
Func
.
patterns
:
for
arg_4
in
arg_2
.
walkfiles
(
arg_3
)
:
arg_4
.
remove
(
)

def Func(arg_0, arg_1):
    """Clean up extra files littering the source tree.

    options.paved.Func.dirs: directories to search recursively
    options.paved.Func.patterns: patterns to search for and remove
    """
    arg_1("Cleaning patterns %s", arg_0.paved.Func.patterns)
    for arg_2 in arg_0.paved.Func.dirs:
        arg_1("Cleaning in %s", arg_2)
        for arg_3 in arg_0.paved.Func.patterns:
            for arg_4 in arg_2.walkfiles(arg_3):
                arg_4.remove()

Clean up extra files littering the source tree.

    options.paved.clean.dirs: directories to search recursively
    options.paved.clean.patterns: patterns to search for and remove

Clean up extra files littering the source tree .


def Func ( arg_0 ) : if not arg_0 . is_output ( ) : return arg_1 = len ( arg_0 . _write_buff ) if arg_1 == 0 : return encodeVarint ( arg_0 . _fd . write , arg_1 , True ) for arg_2 in arg_0 . _write_buff : arg_3 = arg_2 . SerializeToString ( ) encodeVarint ( arg_0 . _fd . write , len ( arg_3 ) , True ) arg_0 . _fd . write ( arg_3 ) arg_0 . _write_buff = [ ]

def Func(arg_0):
        """Write down buffer to the file."""
        if not arg_0.is_output():
            return

        arg_1 = len(arg_0._write_buff)
        if arg_1 == 0:
            return

        encodeVarint(arg_0._fd.write, arg_1, True)

        for arg_2 in arg_0._write_buff:
            arg_3 = arg_2.SerializeToString()
            encodeVarint(arg_0._fd.write, len(arg_3), True)
            arg_0._fd.write(arg_3)

        arg_0._write_buff = []


def Func(arg_0):
        """ Start the worker processes.

        TODO: Move task receiving to a thread
        """
        Func = time.time()
        arg_0._kill_event = threading.Event()

        arg_0.procs = {}
        for arg_4 in range(arg_0.worker_count):
            arg_5 = multiprocessing.Process(target=worker, args=(arg_4,
                                                             arg_0.uid,
                                                             arg_0.pending_task_queue,
                                                             arg_0.pending_result_queue,
                                                             arg_0.ready_worker_queue,
                                                         ))
            arg_5.start()
            arg_0.procs[arg_4] = arg_5

        logger.debug("Manager synced with workers")

        arg_0._task_puller_thread = threading.Thread(target=arg_0.pull_tasks,
                                                    args=(arg_0._kill_event,))
        arg_0._result_pusher_thread = threading.Thread(target=arg_0.push_results,
                                                      args=(arg_0._kill_event,))
        arg_0._task_puller_thread.start()
        arg_0._result_pusher_thread.start()

        logger.info("Loop start")

        # TODO : Add mechanism in this loop to stop the worker pool
        # This might need a multiprocessing event to signal back.
        arg_0._kill_event.wait()
        logger.critical("[MAIN] Received kill event, terminating worker processes")

        arg_0._task_puller_thread.join()
        arg_0._result_pusher_thread.join()
        for arg_8 in arg_0.procs:
            arg_0.procs[arg_8].terminate()
            logger.critical("Terminating worker {}:{}".format(arg_0.procs[arg_8],
                                                              arg_0.procs[arg_8].is_alive()))
            arg_0.procs[arg_8].join()
            logger.debug("Worker:{} joined successfully".format(arg_0.procs[arg_8]))

        arg_0.task_incoming.close()
        arg_0.result_outgoing.close()
        arg_0.context.term()
        arg_9 = time.time() - Func
        logger.info("process_worker_pool ran for {} seconds".format(arg_9))
        return


def Func ( ) : arg_0 = [ ] try : arg_1 = subprocess . check_output ( [ 'nmcli' , 'device' , 'show' ] ) arg_1 = arg_1 . decode ( 'utf-8' ) for arg_2 in arg_1 . split ( '\n' ) : if 'DNS' in arg_2 : arg_3 = r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" for arg_4 in re . findall ( arg_3 , arg_2 ) : arg_0 . append ( arg_4 ) except FileNotFoundError : pass return arg_0

def Func():
    """
        Returns the configured DNS servers with the use f nmcli.
    """
    arg_0 = []
    try:
        arg_1 = subprocess.check_output(['nmcli', 'device', 'show'])
        arg_1 = arg_1.decode('utf-8')

        for arg_2 in arg_1.split('\n'):
            if 'DNS' in arg_2:
                arg_3 = r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"
                for arg_4 in re.findall(arg_3, arg_2):
                    arg_0.append(arg_4)
    except FileNotFoundError:
        pass
    return arg_0

Returns the configured DNS servers with the use f nmcli .


def Func ( arg_0 , arg_1 , arg_2 ) : try : arg_3 = dict ( arg_0 = arg_0 , arg_1 = arg_1 , arg_2 = arg_2 ) arg_4 = _pybossa_req ( 'post' , 'project' , payload = arg_3 ) if arg_4 . get ( 'id' ) : return Project ( arg_4 ) else : return arg_4 except : raise

def Func(arg_0, arg_1, arg_2):
    """Create a project.

    :param name: PYBOSSA Project Name
    :type name: string
    :param short_name: PYBOSSA Project short name or slug
    :type short_name: string
    :param description: PYBOSSA Project description
    :type decription: string
    :returns: True -- the response status code

    """
    try:
        arg_3 = dict(arg_0=arg_0, arg_1=arg_1,
                       arg_2=arg_2)
        arg_4 = _pybossa_req('post', 'project', payload=arg_3)
        if arg_4.get('id'):
            return Project(arg_4)
        else:
            return arg_4
    except:  # pragma: no cover
        raise


(
    ctx: GeneratorContext, node: HostField, is_assigning: bool = False
)

return GeneratedPyAST(
        node=ast.Attribute(
            value=target_ast.node,
            attr=munge(node.field),
            ctx=ast.Store() if is_assigning else ast.Load(),
        ),
        dependencies=target_ast.dependencies,
    )

def Func ( arg_0 : arg_1 , arg_2 : arg_3 , arg_4 : arg_5 = False ) -> GeneratedPyAST : assert arg_2 . op == NodeOp . HOST_FIELD arg_6 = gen_py_ast ( arg_0 , arg_2 . target ) return GeneratedPyAST ( arg_2 = ast . Attribute ( value = arg_6 . node , attr = munge ( arg_2 . field ) , arg_0 = ast . Store ( ) if arg_4 else ast . Load ( ) , ) , dependencies = arg_6 . dependencies , )

def Func(
    arg_0: arg_1, arg_2: arg_3, arg_4: arg_5 = False
) -> GeneratedPyAST:
    """Generate a Python AST node for Python interop property access."""
    assert arg_2.op == NodeOp.HOST_FIELD

    arg_6 = gen_py_ast(arg_0, arg_2.target)

    return GeneratedPyAST(
        arg_2=ast.Attribute(
            value=arg_6.node,
            attr=munge(arg_2.field),
            arg_0=ast.Store() if arg_4 else ast.Load(),
        ),
        dependencies=arg_6.dependencies,
    )

Generate a Python AST node for Python interop property access .


def Func(arg_0):
    """
    The CPython version of ``fromutc`` checks that the input is a ``datetime``
    object and that ``self`` is attached as its ``tzinfo``.
    """
    @wraps(arg_0)
    def fromutc(arg_1, arg_2):
        if not isinstance(arg_2, datetime):
            raise TypeError("fromutc() requires a datetime argument")
        if arg_2.tzinfo is not arg_1:
            raise ValueError("dt.tzinfo is not self")

        return arg_0(arg_1, arg_2)

    return fromutc

The CPython version of fromutc checks that the input is a datetime object and that self is attached as its tzinfo .


def Func ( ) : arg_0 = get_stream_enc ( sys . stdin ) if not arg_0 or arg_0 == 'ascii' : try : arg_0 = locale . getpreferredencoding ( ) except Exception : pass return arg_0 or sys . Func ( )

def Func():
    """Return IPython's guess for the default encoding for bytes as text.

    Asks for stdin.encoding first, to match the calling Terminal, but that
    is often None for subprocesses.  Fall back on locale.getpreferredencoding()
    which should be a sensible platform default (that respects LANG environment),
    and finally to sys.Func() which is the most conservative option,
    and usually ASCII.
    """
    arg_0 = get_stream_enc(sys.stdin)
    if not arg_0 or arg_0=='ascii':
        try:
            # There are reports of getpreferredencoding raising errors
            # in some cases, which may well be fixed, but let's be conservative here.
            arg_0 = locale.getpreferredencoding()
        except Exception:
            pass
    return arg_0 or sys.Func()

Return IPython's guess for the default encoding for bytes as text.

    Asks for stdin.encoding first, to match the calling Terminal, but that
    is often None for subprocesses.  Fall back on locale.getpreferredencoding()
    which should be a sensible platform default (that respects LANG environment),
    and finally to sys.getdefaultencoding() which is the most conservative option,
    and usually ASCII.

Return IPython s guess for the default encoding for bytes as text .


def Func(arg_0):
  """ Build extra args map """
  # Check parameters
  arg_1 = arg_0['component_parallelism']
  arg_2 = arg_0['runtime_config']
  arg_3 = arg_0['container_number']
  # Users need to provide either (component-parallelism || container_number) or runtime-config
  if (arg_1 and arg_2) or (arg_3 and arg_2):
    raise Exception(
        "(component-parallelism or container_num) and runtime-config " +
        "can't be updated at the same time")

  arg_4 = {}

  arg_5 = True
  if arg_1:
    arg_4.update({'component_parallelism': arg_1})
    arg_5 = False

  if arg_3:
    arg_4.update({'container_number': arg_3})
    arg_5 = False

  if arg_2:
    arg_4.update({'runtime_config': arg_2})
    arg_5 = False

  if arg_5:
    raise Exception(
        "Missing arguments --component-parallelism or --runtime-config or --container-number")

  if arg_0['dry_run']:
    arg_4.update({'dry_run': True})
    if 'dry_run_format' in arg_0:
      arg_4.update({'dry_run_format': arg_0["dry_run_format"]})

  return arg_4


def Func ( arg_0 , arg_1 = None , ** arg_2 ) : if not arg_0 . pretty : return None if arg_1 : arg_3 = open ( arg_1 , 'w' ) else : arg_3 = StringIO ( ) arg_4 = UnicodeWriter ( arg_3 , ** arg_2 ) arg_4 . writerow ( arg_0 . field_names ) for arg_5 in arg_0 : arg_4 . writerow ( arg_5 ) if arg_1 : arg_3 . close ( ) return CsvResultDescriptor ( arg_1 ) else : return arg_3 . getvalue ( )

def Func(arg_0, arg_1=None, **arg_2):
        """Generates results in comma-separated form.  Write to ``filename``
        if given. Any other parameter will be passed on to ``Func.writer``.

        :param filename: if given, the CSV will be written to filename.

        Any additional keyword arguments will be passsed
        through to ``Func.writer``.
        """
        if not arg_0.pretty:
            return None  # no results
        if arg_1:
            arg_3 = open(arg_1, 'w')
        else:
            arg_3 = StringIO()
        arg_4 = UnicodeWriter(arg_3, **arg_2)
        arg_4.writerow(arg_0.field_names)
        for arg_5 in arg_0:
            arg_4.writerow(arg_5)
        if arg_1:
            arg_3.close()
            return CsvResultDescriptor(arg_1)
        else:
            return arg_3.getvalue()

Generates results in comma-separated form.  Write to ``filename``
        if given. Any other parameter will be passed on to ``csv.writer``.

        :param filename: if given, the CSV will be written to filename.

        Any additional keyword arguments will be passsed
        through to ``csv.writer``.

Generates results in comma - separated form . Write to filename if given . Any other parameter will be passed on to csv . writer .


(self, institute, case, user, link, category, verb,
                     subject, level='specific', variant=None, content=None,
                     panel=None)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6,
                     arg_7, arg_8='specific', arg_9=None, arg_10=None,
                     arg_11=None):
        """Create a Event with the parameters given.

        Arguments:
            institute (dict): A institute
            case (dict): A case
            user (dict): A User
            link (str): The url to be used in the event
            category (str): case or variant
            verb (str): What type of event
            subject (str): What is operated on
            level (str): 'specific' or 'global'. Default is 'specific'
            variant (dict): A variant
            content (str): The content of the comment

        Returns:
            event(dict): The inserted event
        """
        arg_9 = arg_9 or {}
        arg_12 = dict(
            arg_1=arg_1['_id'],
            arg_2=arg_2['_id'],
            user_id=arg_3['_id'],
            user_name=arg_3['name'],
            arg_4=arg_4,
            arg_5=arg_5,
            arg_6=arg_6,
            arg_7=arg_7,
            arg_8=arg_8,
            variant_id=arg_9.get('variant_id'),
            arg_10=arg_10,
            arg_11=arg_11,
            created_at=datetime.now(),
            updated_at=datetime.now(),
        )

        LOG.debug("Saving Event")
        arg_0.event_collection.insert_one(arg_12)
        LOG.debug("Event Saved")
        return arg_12

Create a Event with the parameters given .


def Func ( arg_0 ) : if arg_0 . client is not None : return arg_0 . client arg_1 = arg_0 . extras if arg_1 . get ( 'ssl' , False ) : arg_1 . update ( { 'ssl_cert_reqs' : CERT_NONE } ) arg_0 . client = MongoClient ( arg_0 . uri , ** arg_1 ) return arg_0 . client

def Func(arg_0):
        """
        Fetches PyMongo Client
        """
        if arg_0.client is not None:
            return arg_0.client

        # Mongo Connection Options dict that is unpacked when passed to MongoClient
        arg_1 = arg_0.extras

        # If we are using SSL disable requiring certs from specific hostname
        if arg_1.get('ssl', False):
            arg_1.update({'ssl_cert_reqs': CERT_NONE})

        arg_0.client = MongoClient(arg_0.uri, **arg_1)

        return arg_0.client


return [target.getParam(getattr(ode, 'Param{}{}'.format(param, s)))
            for s in ['', '2', '3'][:dof]]

def Func ( arg_0 , arg_1 , arg_2 ) : return [ arg_0 . getParam ( getattr ( ode , 'Param{}{}' . format ( arg_1 , arg_3 ) ) ) for arg_3 in [ '' , '2' , '3' ] [ : arg_2 ] ]

def Func(arg_0, arg_1, arg_2):
    '''Get the given param from each of the DOFs for a joint.'''
    return [arg_0.getParam(getattr(ode, 'Param{}{}'.format(arg_1, arg_3)))
            for arg_3 in ['', '2', '3'][:arg_2]]

Get the given param from each of the DOFs for a joint .


def Func(arg_0, arg_1 = None):
    """Method decorator generator for decorating event handlers.

    To be used on `TimeoutHandler` subclass methods only.

    :Parameters:
        - `interval`: interval (in seconds) before the method will be called.
        - `recurring`: When `True`, the handler will be called each `interval`
          seconds, when `False` it will be called only once. If `True`,
          then the handler should return the next interval or `None` if it
          should not be called again.
    :Types:
        - `interval`: `float`
        - `recurring`: `bool`
    """
    def decorator(arg_2):
        """The decorator"""
        arg_2._pyxmpp_timeout = arg_0
        arg_2._pyxmpp_recurring = arg_1
        return arg_2
    return decorator

Method decorator generator for decorating event handlers .


def Func(arg_0, arg_1):
        '''Create a folder in the storage service pointed by the given path.

        Args:
            path (str): The path of the folder to be created

        Returns:
            None

        Raises:
            StorageArgumentException: Invalid arguments
            StorageForbiddenException: Server response code 403
            StorageNotFoundException: Server response code 404
            StorageException: other 400-600 error codes
        '''

        arg_0.__validate_storage_path(arg_1, projects_allowed=False)
        arg_2 = arg_0.get_parent(arg_1)
        arg_0.api_client.create_folder(arg_1.split('/')[-1], arg_2['uuid'])

Create a folder in the storage service pointed by the given path .


def Func(arg_0, arg_1=arg_2.AlgorithmTypes.regression):
    """
    Feed in an essay set to get feature vector and classifier
    essays must be an essay set object
    additional array is an optional argument that can specify
    a numpy array of values to add in
    returns a trained FeatureExtractor object and a trained classifier
    """
    arg_5 = feature_extractor.FeatureExtractor()
    arg_5.initialize_dictionaries(arg_0)

    arg_6 = arg_5.gen_feats(arg_0)

    arg_7 = numpy.asarray(arg_0._score, dtype=numpy.int)
    if len(arg_2.f7(list(arg_7)))>5:
        arg_1 = arg_2.AlgorithmTypes.regression
    else:
        arg_1 = arg_2.AlgorithmTypes.classification

    arg_8,arg_9 = get_algorithms(arg_1)

    arg_10=get_cv_error(arg_9,arg_6,arg_0._score)

    try:
        arg_8.fit(arg_6, arg_7)
    except ValueError:
        log.exception("Not enough classes (0,1,etc) in sample.")
        arg_7[0]=1
        arg_7[1]=0
        arg_8.fit(arg_6, arg_7)

    return arg_5, arg_8, arg_10


def Func ( arg_0 , arg_1 ) : arg_1 = arg_1 or arg_0 . coverage . data . measured_files ( ) arg_2 = arg_0 . coverage . file_locator arg_0 . code_units = code_unit_factory ( arg_1 , arg_2 ) if arg_0 . config . include : arg_4 = prep_patterns ( arg_0 . config . include ) arg_5 = [ ] for arg_6 in arg_0 . code_units : for arg_7 in arg_4 : if fnmatch . fnmatch ( arg_6 . filename , arg_7 ) : arg_5 . append ( arg_6 ) break arg_0 . code_units = arg_5 if arg_0 . config . omit : arg_4 = prep_patterns ( arg_0 . config . omit ) arg_5 = [ ] for arg_6 in arg_0 . code_units : for arg_7 in arg_4 : if fnmatch . fnmatch ( arg_6 . filename , arg_7 ) : break else : arg_5 . append ( arg_6 ) arg_0 . code_units = arg_5 arg_0 . code_units . sort ( )

def Func(arg_0, arg_1):
        """Find the code units we'll report on.

        `morfs` is a list of modules or filenames.

        """
        arg_1 = arg_1 or arg_0.coverage.data.measured_files()
        arg_2 = arg_0.coverage.file_locator
        arg_0.code_units = code_unit_factory(arg_1, arg_2)

        if arg_0.config.include:
            arg_4 = prep_patterns(arg_0.config.include)
            arg_5 = []
            for arg_6 in arg_0.code_units:
                for arg_7 in arg_4:
                    if fnmatch.fnmatch(arg_6.filename, arg_7):
                        arg_5.append(arg_6)
                        break
            arg_0.code_units = arg_5

        if arg_0.config.omit:
            arg_4 = prep_patterns(arg_0.config.omit)
            arg_5 = []
            for arg_6 in arg_0.code_units:
                for arg_7 in arg_4:
                    if fnmatch.fnmatch(arg_6.filename, arg_7):
                        break
                else:
                    arg_5.append(arg_6)
            arg_0.code_units = arg_5

        arg_0.code_units.sort()


Returns the distance between two points.

return sqrt(pow(x1-x0, 2) + pow(y1-y0, 2))

def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : return sqrt ( pow ( arg_2 - arg_0 , 2 ) + pow ( arg_3 - arg_1 , 2 ) )

def Func(arg_0, arg_1, arg_2, arg_3):
    """ Returns the Func between two points.
    """
    return sqrt(pow(arg_2-arg_0, 2) + pow(arg_3-arg_1, 2))

Returns the distance between two points .


def
Func
(
arg_0
,
arg_1
=
)
:
arg_2
=
arg_0
.
get_current_thumbprint
(
arg_1
=
arg_1
)
or
{
}
arg_3
=
arg_0
.
get_previous_thumbprint
(
arg_1
=
arg_1
)
or
{
}
if
arg_0
.
verbose
:
print
(
'Current thumbprint:'
)
pprint
(
arg_2
,
indent
=
4
)
print
(
'Previous thumbprint:'
)
pprint
(
arg_3
,
indent
=
4
)
arg_4
=
list
(
iter_dict_differences
(
arg_2
,
arg_3
)
)
if
arg_0
.
verbose
:
print
(
'Differences:'
)
pprint
(
arg_4
,
indent
=
4
)
arg_5
=
get_component_order
(
[
k
for
k
,
(
_
,
_
)
in
arg_4
]
)
if
arg_0
.
verbose
:
print
(
'component_order:'
)
pprint
(
arg_5
,
indent
=
4
)
arg_6
=
list
(
get_deploy_funcs
(
arg_5
,
arg_2
,
arg_3
)
)
return
arg_5
,
arg_6

def Func(arg_0, arg_1=None):
        """
        Calculates the components functions that need to be executed for a deployment.
        """

        arg_2 = arg_0.get_current_thumbprint(arg_1=arg_1) or {}
        arg_3 = arg_0.get_previous_thumbprint(arg_1=arg_1) or {}

        if arg_0.verbose:
            print('Current thumbprint:')
            pprint(arg_2, indent=4)
            print('Previous thumbprint:')
            pprint(arg_3, indent=4)

        arg_4 = list(iter_dict_differences(arg_2, arg_3))
        if arg_0.verbose:
            print('Differences:')
            pprint(arg_4, indent=4)
        arg_5 = get_component_order([k for k, (_, _) in arg_4])
        if arg_0.verbose:
            print('component_order:')
            pprint(arg_5, indent=4)
        arg_6 = list(get_deploy_funcs(arg_5, arg_2, arg_3))

        return arg_5, arg_6

Calculates the components functions that need to be executed for a deployment .


def Func ( arg_0 , arg_1 = 'utf-8' ) : if not isinstance ( arg_0 , string_types ) : arg_0 = text_type ( arg_0 ) if isinstance ( arg_0 , text_type ) : arg_0 = arg_0 . encode ( arg_1 ) return text_type ( url_quote ( arg_0 ) )

def Func(arg_0, arg_1='utf-8'):
    """URL escapes a single bytestring or unicode string with the
    given charset if applicable to URL safe quoting under all rules
    that need to be considered under all supported Python versions.

    If non strings are provided they are converted to their unicode
    representation first.
    """
    if not isinstance(arg_0, string_types):
        arg_0 = text_type(arg_0)
    if isinstance(arg_0, text_type):
        arg_0 = arg_0.encode(arg_1)
    return text_type(url_quote(arg_0))

URL escapes a single bytestring or unicode string with the given charset if applicable to URL safe quoting under all rules that need to be considered under all supported Python versions .


(self, augseq, queue_source, queue_result, seedval)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 ) : np . random . seed ( arg_4 ) random . seed ( arg_4 ) arg_1 . reseed ( arg_4 ) ia . seed ( arg_4 ) arg_5 = False while not arg_5 : try : arg_6 = arg_2 . get ( timeout = 0.1 ) arg_7 = pickle . loads ( arg_6 ) if arg_7 is None : arg_5 = True arg_2 . put ( pickle . dumps ( None , protocol = - 1 ) ) else : arg_8 = arg_1 . augment_batch ( arg_7 ) arg_6 = pickle . dumps ( arg_8 , protocol = - 1 ) arg_3 . put ( arg_6 ) except QueueEmpty : time . sleep ( 0.01 ) arg_3 . put ( pickle . dumps ( None , protocol = - 1 ) ) time . sleep ( 0.01 )

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """
        Augment endlessly images in the source queue.

        This is a worker function for that endlessly queries the source queue (input batches),
        augments batches in it and sends the result to the output queue.

        """
        np.random.seed(arg_4)
        random.seed(arg_4)
        arg_1.reseed(arg_4)
        ia.seed(arg_4)

        arg_5 = False

        while not arg_5:
            # wait for a new batch in the source queue and load it
            try:
                arg_6 = arg_2.get(timeout=0.1)
                arg_7 = pickle.loads(arg_6)
                if arg_7 is None:
                    arg_5 = True
                    # put it back in so that other workers know that the loading queue is finished
                    arg_2.put(pickle.dumps(None, protocol=-1))
                else:
                    arg_8 = arg_1.augment_batch(arg_7)

                    # send augmented batch to output queue
                    arg_6 = pickle.dumps(arg_8, protocol=-1)
                    arg_3.put(arg_6)
            except QueueEmpty:
                time.sleep(0.01)

        arg_3.put(pickle.dumps(None, protocol=-1))
        time.sleep(0.01)

Augment endlessly images in the source queue .


def Func(arg_0, arg_1):
    """
    Return the sum of vehicle hours in a particular day by route type.
    """

    arg_2 = arg_0.get_suitable_date_for_daily_extract()
    arg_3 = (" SELECT * , SUM(end_time_ds - start_time_ds)/3600 as vehicle_hours_type"
             " FROM"
             " (SELECT * FROM day_trips as q1"
             " INNER JOIN"
             " (SELECT route_I, type FROM routes) as q2"
             " ON q1.route_I = q2.route_I"
             " WHERE type = {route_type}"
             " AND date = '{day}')".format(arg_2=arg_2, arg_1=arg_1))
    arg_4 = arg_0.execute_custom_query_pandas(arg_3)
    return arg_4['vehicle_hours_type'].item()

Return the sum of vehicle hours in a particular day by route type .


def Func(arg_0, arg_1):
    """Creates a layer from its config.

    This method is the reverse of `get_config`, capable of instantiating the
    same layer from the config dictionary.

    Args:
      config: A Python dictionary, typically the output of `get_config`.

    Returns:
      layer: A layer instance.
    """
    arg_1 = arg_1.copy()
    arg_2 = [
        'kernel_posterior_fn',
        'kernel_posterior_tensor_fn',
        'kernel_prior_fn',
        'kernel_divergence_fn',
        'bias_posterior_fn',
        'bias_posterior_tensor_fn',
        'bias_prior_fn',
        'bias_divergence_fn',
    ]
    for arg_3 in arg_2:
      arg_4 = arg_1[arg_3]
      arg_5 = arg_1.pop(arg_3 + '_type')
      if arg_4 is not None:
        arg_1[arg_3] = tfp_layers_util.deserialize_function(
            arg_4,
            arg_5=arg_5)
    return arg_0(**arg_1)


def Func ( arg_0 , arg_1 ) : if arg_1 : os . rename ( arg_0 , arg_1 ) else : os . unlink ( arg_0 ) if arg_1 in TEMP_FILES : TEMP_FILES . remove ( arg_0 )

def Func(arg_0, arg_1):
  '''Atomically rename and clean tempfile'''
  if arg_1:
    os.rename(arg_0, arg_1)
  else:
    os.unlink(arg_0)

  if arg_1 in TEMP_FILES:
    TEMP_FILES.remove(arg_0)


def Func ( arg_0 , arg_1 ) : arg_2 = arg_1 . get ( 'schema' , colander . MappingSchema ( ) ) if not isinstance ( arg_2 , colander . Schema ) : arg_2 = arg_2 ( ) arg_2 = arg_2 . clone ( ) for arg_3 in arg_0 . schema_transformers : arg_2 = arg_3 ( arg_2 , arg_1 ) return arg_2

def Func(arg_0, arg_1):
        """
        Extract schema from view args and transform it using
        the pipeline of schema transformers

        :param args:
            Arguments from the view decorator.

        :rtype: colander.MappingSchema()
        :returns: View schema cloned and transformed
        """

        arg_2 = arg_1.get('schema', colander.MappingSchema())
        if not isinstance(arg_2, colander.Schema):
            arg_2 = arg_2()
        arg_2 = arg_2.clone()
        for arg_3 in arg_0.schema_transformers:
            arg_2 = arg_3(arg_2, arg_1)
        return arg_2


def
Func
(
arg_0
,
arg_1
=
arg_2
.
stdout
)
:
if
arg_0
.
_args
and
arg_0
.
_args
.
verbose
>
2
:
pprint
(
arg_0
.
results
)
for
arg_4
,
arg_5
in
arg_0
.
results
[
'dimensions'
]
.
items
(
)
:
print
(
"{}D layer condition:"
.
format
(
arg_4
)
,
file
=
arg_1
)
for
arg_6
,
arg_7
in
sorted
(
arg_5
[
'caches'
]
.
items
(
)
)
:
print
(
arg_6
+
": "
,
end
=
''
,
file
=
arg_1
)
if
arg_7
[
'lt'
]
is
sympy
.
true
:
print
(
"unconditionally fulfilled"
,
file
=
arg_1
)
else
:
if
arg_7
[
'eq'
]
is
:
print
(
"{}"
.
format
(
arg_7
[
'lt'
]
)
,
file
=
arg_1
)
elif
type
(
arg_7
[
'eq'
]
)
is
not
list
:
print
(
"{}"
.
format
(
arg_7
[
'eq'
]
)
,
file
=
arg_1
)
else
:
for
arg_8
in
arg_7
[
'eq'
]
:
for
arg_9
,
arg_10
in
arg_8
.
items
(
)
:
print
(
"{} <= {}"
.
format
(
arg_9
,
arg_10
)
,
file
=
arg_1
)

def Func(arg_0, arg_1=arg_2.stdout):
        """Report generated model in human readable form."""
        if arg_0._args and arg_0._args.verbose > 2:
            pprint(arg_0.results)

        for arg_4, arg_5 in arg_0.results['dimensions'].items():
            print("{}D layer condition:".format(arg_4), file=arg_1)
            for arg_6, arg_7 in sorted(arg_5['caches'].items()):
                print(arg_6+": ", end='', file=arg_1)
                if arg_7['lt'] is sympy.true:
                    print("unconditionally fulfilled", file=arg_1)
                else:
                    if arg_7['eq'] is None:
                        print("{}".format(arg_7['lt']), file=arg_1)
                    elif type(arg_7['eq']) is not list:
                        print("{}".format(arg_7['eq']), file=arg_1)
                    else:
                        for arg_8 in arg_7['eq']:
                            for arg_9, arg_10 in arg_8.items():
                                print("{} <= {}".format(arg_9, arg_10), file=arg_1)

Report generated model in human readable form .


def Func(arg_0, arg_1, arg_2=None):
        """
        In-place multiplication

        :param multiplier: A matrix or vector to be multiplied
        :param axis: The dim along which 'multiplier' is multiplied
        :return: Nothing (as it performs in-place operations)
        """
        if arg_0.finalized:
            if arg_1.ndim == 1:
                if arg_2 == 0:  # multiplier is np.array of length |haplotypes|
                    raise NotImplementedError('The method is not yet implemented for the axis.')
                elif arg_2 == 1:  # multiplier is np.array of length |loci|
                    arg_3 = len(arg_1)
                    arg_4 = lil_matrix((arg_3, arg_3))
                    arg_4.setdiag(arg_1)
                    for arg_5 in xrange(arg_0.shape[1]):
                        arg_0.data[arg_5] = arg_0.data[arg_5] * arg_4
                elif arg_2 == 2:  # multiplier is np.array of length |reads|
                    for arg_5 in xrange(arg_0.shape[1]):
                        arg_0.data[arg_5].data *= arg_1[arg_0.data[arg_5].indices]
                else:
                    raise RuntimeError('The axis should be 0, 1, or 2.')
            elif arg_1.ndim == 2:
                if arg_2 == 0:  # multiplier is sp.sparse matrix of shape |reads| x |haplotypes|
                    for arg_5 in xrange(arg_0.shape[1]):
                        arg_0.data[arg_5].data *= arg_1[arg_0.data[arg_5].indices, arg_5]
                elif arg_2 == 1:  # multiplier is sp.sparse matrix of shape |reads| x |loci|
                    for arg_5 in xrange(arg_0.shape[1]):
                        arg_0.data[arg_5] = arg_0.data[arg_5].Func(arg_1)
                elif arg_2 == 2:  # multiplier is np.matrix of shape |haplotypes| x |loci|
                    for arg_5 in xrange(arg_0.shape[1]):
                        arg_7 = arg_1[arg_5, :]
                        arg_7 = arg_7.ravel()
                        arg_0.data[arg_5].data *= arg_7.repeat(np.diff(arg_0.data[arg_5].indptr))
                else:
                    raise RuntimeError('The axis should be 0, 1, or 2.')
            elif isinstance(arg_1, Sparse3DMatrix):  # multiplier is Sparse3DMatrix object
                    for arg_5 in xrange(arg_0.shape[1]):
                        arg_0.data[arg_5] = arg_0.data[arg_5].Func(arg_1.data[arg_5])
            else:
                raise RuntimeError('The multiplier should be 1, 2 dimensional numpy array or a Sparse3DMatrix object.')
        else:
            raise RuntimeError('The original matrix must be finalized.')


return val in ['true', 'on', 'yes', True]

def Func ( arg_0 ) : if isinstance ( arg_0 , str ) : arg_0 = arg_0 . lower ( ) return arg_0 in [ 'true' , 'on' , 'yes' , True ]

def Func(arg_0):
    """
    Helper function to turn a string representation of "true" into
    boolean True.
    """
    if isinstance(arg_0, str):
        arg_0 = arg_0.lower()

    return arg_0 in ['true', 'on', 'yes', True]

Helper function to turn a string representation of true into boolean True .


(cls, likelihoodsDict, minLikelihoodThreshold,
                                 maxPredictionsPerStep)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_4 = ( None , None ) for ( arg_5 , arg_6 ) in arg_1 . items ( ) : if len ( arg_1 ) <= 1 : break if arg_4 [ 0 ] is None or arg_6 >= arg_4 [ 1 ] : if arg_4 [ 0 ] is not None and arg_4 [ 1 ] < arg_2 : del arg_1 [ arg_4 [ 0 ] ] arg_4 = ( arg_5 , arg_6 ) elif arg_6 < arg_2 : del arg_1 [ arg_5 ] arg_1 = dict ( sorted ( arg_1 . iteritems ( ) , key = itemgetter ( 1 ) , reverse = True ) [ : arg_3 ] ) return arg_1

def Func(arg_0, arg_1, arg_2,
                                 arg_3):
    """Remove entries with 0 likelihood or likelihood less than
    minLikelihoodThreshold, but don't leave an empty dict.
    """
    arg_4 = (None, None)
    for (arg_5, arg_6) in arg_1.items():
      if len(arg_1) <= 1:
        break
      if arg_4[0] is None or arg_6 >= arg_4[1]:
        if arg_4[0] is not None and arg_4[1] < arg_2:
          del arg_1[arg_4[0]]
        arg_4 = (arg_5, arg_6)
      elif arg_6 < arg_2:
        del arg_1[arg_5]
    # Limit the number of predictions to include.
    arg_1 = dict(sorted(arg_1.iteritems(),
                                  key=itemgetter(1),
                                  reverse=True)[:arg_3])
    return arg_1

Remove entries with 0 likelihood or likelihood less than minLikelihoodThreshold but don t leave an empty dict .


(self, from_date=DEFAULT_DATETIME,
                 offset=None, max_contents=MAX_CONTENTS)

def
Func
(
arg_0
,
arg_1
=
arg_2
,
arg_3
=
,
arg_4
=
arg_5
)
:
arg_6
=
arg_0
.
RCONTENTS
+
'/'
+
arg_0
.
MSEARCH
arg_7
=
arg_1
.
strftime
(
"%Y-%m-%d %H:%M"
)
arg_8
=
arg_0
.
VCQL
%
{
'date'
:
arg_7
}
arg_9
=
{
arg_0
.
PCQL
:
arg_8
,
arg_0
.
PLIMIT
:
arg_4
,
arg_0
.
PEXPAND
:
arg_0
.
PANCESTORS
}
if
arg_3
:
arg_9
[
arg_0
.
PSTART
]
=
arg_3
for
arg_11
in
arg_0
.
_call
(
arg_6
,
arg_9
)
:
yield
arg_11

def Func(arg_0, arg_1=arg_2,
                 arg_3=None, arg_4=arg_5):
        """Get the Func of a repository.

        This method returns an iterator that manages the pagination
        over Func. Take into account that the seconds of `from_date`
        parameter will be ignored because the API only works with
        hours and minutes.

        :param from_date: fetch the Func updated since this date
        :param offset: fetch the Func starting from this offset
        :param limit: maximum number of Func to fetch per request
        """
        arg_6 = arg_0.RCONTENTS + '/' + arg_0.MSEARCH

        # Set confluence query parameter (cql)
        arg_7 = arg_1.strftime("%Y-%m-%d %H:%M")
        arg_8 = arg_0.VCQL % {'date': arg_7}

        # Set parameters
        arg_9 = {
            arg_0.PCQL: arg_8,
            arg_0.PLIMIT: arg_4,
            arg_0.PEXPAND: arg_0.PANCESTORS
        }

        if arg_3:
            arg_9[arg_0.PSTART] = arg_3

        for arg_11 in arg_0._call(arg_6, arg_9):
            yield arg_11

Get the contents of a repository.

        This method returns an iterator that manages the pagination
        over contents. Take into account that the seconds of `from_date`
        parameter will be ignored because the API only works with
        hours and minutes.

        :param from_date: fetch the contents updated since this date
        :param offset: fetch the contents starting from this offset
        :param limit: maximum number of contents to fetch per request


def Func(arg_0, arg_1):
    """
    If the value is ``None``, fail validation.

    :param str config_val: The env var value.
    :param EnvironmentVariable evar: The EVar object we are validating
        a value for.
    :raises: ValueError if the config value is None.
    """
    if arg_0 is None:
        raise ValueError(
            "Value for environment variable '{evar_name}' can't "
            "be empty.".format(evar_name=arg_1.name))
    return arg_0


def Func ( arg_0 , arg_1 = None ) : if arg_1 is None : assert len ( arg_0 . fields ) > 0 arg_1 = arg_0 . fields [ 0 ] . numRecords - 1 assert ( all ( arg_2 . numRecords > arg_1 for arg_2 in arg_0 . fields ) ) arg_3 = [ arg_2 . values [ arg_1 ] for arg_2 in arg_0 . fields ] return arg_3

def Func(arg_0, arg_1=None):
    """Returns the nth record"""

    if arg_1 is None:
      assert len(arg_0.fields)>0
      arg_1 = arg_0.fields[0].numRecords-1

    assert (all(arg_2.numRecords>arg_1 for arg_2 in arg_0.fields))

    arg_3 = [arg_2.values[arg_1] for arg_2 in arg_0.fields]

    return arg_3