def Func ( ) : try : from invenio . dbquery import run_sql except ImportError : from invenio . legacy . dbquery import run_sql return run_sql

def Func():
    """Import ``run_sql``."""
    try:
        from invenio.dbquery import run_sql
    except ImportError:
        from invenio.legacy.dbquery import run_sql
    return run_sql


def Func(arg_0):
    """Splicing URLs according to video ID to get video details"""
    # from js
    arg_1 = [""] * 256
    for arg_2, arg_3 in enumerate(arg_1):
        arg_4 = arg_2
        for arg_5 in range(8):
            arg_4 = -306674912 ^ unsigned_right_shitf(arg_4, 1) if 1 & arg_4 else unsigned_right_shitf(arg_4, 1)
        arg_1[arg_2] = arg_4

    def tmp():
        arg_6 = random.random()
        arg_7 = "/video/urls/v/1/toutiao/mp4/{video_id}?r={random_num}".format(arg_0=arg_0,
                                                                              random_num=str(arg_6)[2:])
        arg_8 = arg_11 = arg_10 = -1
        arg_5, arg_9 = 0, len(arg_7)
        while arg_5 < arg_9:
            arg_8 = ord(arg_7[arg_5])
            arg_5 += 1
            if arg_8 < 128:
                arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ arg_8)]
            else:
                if arg_8 < 2048:
                    arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (192 | arg_8 >> 6 & 31))]
                    arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (128 | 63 & arg_8))]
                else:
                    if 55296 <= arg_8 < 57344:
                        arg_8 = (1023 & arg_8) + 64
                        arg_5 += 1
                        arg_11 = 1023 & arg_4.url(arg_5)
                        arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (240 | arg_8 >> 8 & 7))]
                        arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (128 | arg_8 >> 2 & 63))]
                        arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (128 | arg_11 >> 6 & 15 | (3 & arg_8) << 4))]
                        arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (128 | 63 & arg_11))]
                    else:
                        arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (224 | arg_8 >> 12 & 15))]
                        arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (128 | arg_8 >> 6 & 63))]
                        arg_10 = unsigned_right_shitf(arg_10, 8) ^ arg_1[255 & (arg_10 ^ (128 | 63 & arg_8))]

        return "https://ib.365yg.com{path}&s={param}".format(arg_7=arg_7, param=unsigned_right_shitf(arg_10 ^ -1, 0))

    while 1:
        arg_12 = tmp()
        if arg_12.split("=")[-1][0] != "-":  # 参数s不能为负数
            return arg_12


def Func(arg_0, arg_1, arg_2):
    """List existing reliable dictionaries.

    List existing reliable dictionaries and respective schema for given application and service.

    :param application_name: Name of the application.
    :type application_name: str
    :param service_name: Name of the service.
    :type service_name: str
    """
    arg_3 = Cluster.from_sfclient(arg_0)
    arg_4 = arg_3.get_application(arg_1).get_service(arg_2)
    for arg_5 in arg_4.get_dictionaries():
        print(arg_5.name)


(rec, tag, ind1='', ind2='', subfields=[],
                     controlfield_value='')

def Func ( arg_0 , arg_1 , arg_2 = '' , arg_3 = '' , arg_4 = [ ] , arg_5 = '' ) : if arg_5 : arg_6 = etree . Element ( "controlfield" , attrib = { "tag" : arg_1 , } ) arg_6 . text = unicode ( arg_5 ) else : arg_6 = etree . Element ( "datafield" , attrib = { "tag" : arg_1 , "ind1" : arg_2 , "ind2" : arg_3 , } ) for arg_8 , arg_9 in arg_4 : arg_10 = etree . SubElement ( arg_6 , "subfield" , attrib = { "code" : arg_8 } ) arg_10 . text = arg_9 arg_0 . append ( arg_6 ) return arg_0

def Func(arg_0, arg_1, arg_2='', arg_3='', arg_4=[],
                     arg_5=''):
    """Add a MARCXML datafield as a new child to a XML document."""
    if arg_5:
        arg_6 = etree.Element("controlfield",
                            attrib={
                                "tag": arg_1,
                            })
        arg_6.text = unicode(arg_5)
    else:
        arg_6 = etree.Element("datafield",
                            attrib={
                                "tag": arg_1,
                                "ind1": arg_2,
                                "ind2": arg_3,
                            })
        for arg_8, arg_9 in arg_4:
            arg_10 = etree.SubElement(arg_6, "subfield", attrib={"code": arg_8})
            arg_10.text = arg_9
    arg_0.append(arg_6)
    return arg_0

Add a MARCXML datafield as a new child to a XML document .


Extract a member from the archive to the current working directory,
           using its full name. Its file information is extracted as accurately
           as possible. `member' may be a filename or a RarInfo object. You can
           specify a different directory using `path'.

def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = None ) : if isinstance ( arg_1 , RarInfo ) : arg_1 = arg_1 . filename if arg_2 is None : arg_2 = os . getcwd ( ) arg_0 . _Func_members ( [ arg_1 ] , arg_2 , arg_3 ) return os . path . join ( arg_2 , arg_1 )

def Func(arg_0, arg_1, arg_2=None, arg_3=None):
        """Extract a member from the archive to the current working directory,
           using its full name. Its file information is Funced as accurately
           as possible. `member' may be a filename or a RarInfo object. You can
           specify a different directory using `path'.
        """
        if isinstance(arg_1, RarInfo):
            arg_1 = arg_1.filename

        if arg_2 is None:
            arg_2 = os.getcwd()

        arg_0._Func_members([arg_1], arg_2, arg_3)
        return os.path.join(arg_2, arg_1)

Extract a member from the archive to the current working directory using its full name . Its file information is extracted as accurately as possible . member may be a filename or a RarInfo object . You can specify a different directory using path .


def Func ( arg_0 , arg_1 ) : for arg_2 in arg_0 . checkers : if arg_2 . enabled : arg_3 = arg_2 . check ( arg_1 ) if arg_3 : return arg_3 return arg_0 . get_handler_by_name ( 'normal' )

def Func(arg_0, arg_1):
        """Find a handler for the line_info by trying checkers."""
        for arg_2 in arg_0.checkers:
            if arg_2.enabled:
                arg_3 = arg_2.check(arg_1)
                if arg_3:
                    return arg_3
        return arg_0.get_handler_by_name('normal')

Find a handler for the line_info by trying checkers .


def Func ( arg_0 , arg_1 ) : arg_2 = gridlib . GridTableMessage ( arg_0 , gridlib . GRIDTABLE_REQUEST_VIEW_GET_VALUES ) arg_1 . ProcessTableMessage ( arg_2 )

def Func(arg_0, arg_1):
        "Update all displayed values"
        # This sends an event to the grid table to update all of the values
        arg_2 = gridlib.GridTableMessage(arg_0,
                                    gridlib.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
        arg_1.ProcessTableMessage(arg_2)


def Func ( arg_0 , arg_1 ) : arg_2 = np . where ( arg_0 > arg_1 ) [ 0 ] arg_2 = np . concatenate ( ( [ 0 ] , arg_2 ) ) arg_3 = arg_2 [ : - 1 ] - arg_2 [ 1 : ] + 1 return arg_2 [ np . where ( arg_3 ) [ 0 ] + 1 ]

def Func(arg_0,arg_1):
    """return a list of Is where the data first crosses above threshold."""
    arg_2=np.where(arg_0>arg_1)[0]
    arg_2=np.concatenate(([0],arg_2))
    arg_3=arg_2[:-1]-arg_2[1:]+1
    return arg_2[np.where(arg_3)[0]+1]

return a list of Is where the data first crosses above threshold .


def Func(arg_0, arg_1, arg_2):
        """Parse a single command.

        Parameters
        ----------
        source : `str`
            The full source of the tex document.
        start_index : `int`
            Character index in ``source`` where the command begins.

        Returns
        -------
        parsed_command : `ParsedCommand`
            The parsed command from the source at the given index.
        """
        arg_3 = []

        # Index of the parser in the source
        arg_4 = arg_2

        for arg_5 in arg_0.elements:
            arg_6 = arg_5['bracket']
            arg_7 = arg_0._brackets[arg_6]

            # Find the opening bracket.
            arg_8 = None
            arg_9 = None
            for arg_10, arg_11 in enumerate(arg_1[arg_4:], start=arg_4):
                if arg_11 == arg_5['bracket']:
                    arg_8 = arg_10
                    break
                elif arg_11 == '\n':
                    # No starting bracket on the line.
                    if arg_5['required'] is True:
                        # Try to parse a single single-word token after the
                        # command, like '\input file'
                        arg_12 = arg_0._parse_whitespace_argument(
                            arg_1[arg_4:],
                            arg_0.name)
                        return ParsedCommand(
                            arg_0.name,
                            [{'index': arg_5['index'],
                              'name': arg_5['name'],
                              'content': arg_12.strip()}],
                            arg_2,
                            arg_1[arg_2:arg_10])
                    else:
                        # Give up on finding an optional element
                        break

            # Handle cases when the opening bracket is never found.
            if arg_8 is None and arg_5['required'] is False:
                # Optional element not found. Continue to next element,
                # not advancing the running_index of the parser.
                continue
            elif arg_8 is None and arg_5['required'] is True:
                arg_13 = ('Parsing command {0} at index {1:d}, '
                           'did not detect element {2:d}'.format(
                               arg_0.name,
                               arg_2,
                               arg_5['index']))
                raise CommandParserError(arg_13)

            # Find the closing bracket, keeping track of the number of times
            # the same type of bracket was opened and closed.
            arg_14 = 1
            for arg_10, arg_11 in enumerate(arg_1[arg_8 + 1:],
                                  start=arg_8 + 1):
                if arg_11 == arg_6:
                    arg_14 += 1
                elif arg_11 == arg_7:
                    arg_14 -= 1

                if arg_14 == 0:
                    arg_9 = arg_10
                    break

            if arg_14 > 0:
                arg_13 = ('Parsing command {0} at index {1:d}, '
                           'did not find closing bracket for required '
                           'command element {2:d}'.format(
                               arg_0.name,
                               arg_2,
                               arg_5['index']))
                raise CommandParserError(arg_13)

            # Package the parsed element's content.
            arg_15 = arg_1[arg_8 + 1:arg_9]
            arg_16 = {
                'index': arg_5['index'],
                'name': arg_5['name'],
                'content': arg_15.strip()
            }
            arg_3.append(arg_16)

            arg_4 = arg_9 + 1

        arg_17 = arg_1[arg_2:arg_4]
        arg_18 = ParsedCommand(arg_0.name, arg_3,
                                       arg_2, arg_17)
        return arg_18


def Func ( arg_0 ) : arg_1 = Chem . MolFromSmiles ( arg_0 , sanitize = False ) arg_1 = Standardizer ( ) . standardize ( arg_1 ) arg_2 = TautomerCanonicalizer ( ) . canonicalize ( arg_1 ) return Chem . MolToSmiles ( arg_2 , isomericSmiles = True )

def Func(arg_0):
    """Return a standardized canonical tautomer SMILES string given a SMILES string.

    Note: This is a convenience function for quickly standardizing and finding the canonical tautomer for a single
    SMILES string. It is more efficient to use the :class:`~molvs.standardize.Standardizer` class directly when working
    with many molecules or when custom options are needed.

    :param string smiles: The SMILES for the molecule.
    :returns: The SMILES for the standardize canonical tautomer.
    :rtype: string.
    """
    # Skip sanitize as standardize does this anyway
    arg_1 = Chem.MolFromSmiles(arg_0, sanitize=False)
    arg_1 = Standardizer().standardize(arg_1)
    arg_2 = TautomerCanonicalizer().canonicalize(arg_1)
    return Chem.MolToSmiles(arg_2, isomericSmiles=True)

Return a standardized canonical tautomer SMILES string given a SMILES string .


def Func ( arg_0 , arg_1 ) : try : return arg_0 . s3 . head_object ( Bucket = arg_1 . bucket , Key = arg_1 . path ) except BotoClient . ClientError as e : if e . response [ 'ResponseMetadata' ] [ 'HTTPStatusCode' ] == 404 : return None else : raise e

def Func(arg_0, arg_1):
    '''Get the s3 object with the S3 URL. Return None if not exist.'''
    try:
      return arg_0.s3.head_object(Bucket=arg_1.bucket, Key=arg_1.path)
    except BotoClient.ClientError as e:
      if e.response['ResponseMetadata']['HTTPStatusCode'] == 404:
        return None
      else:
        raise e

Get the s3 object with the S3 URL . Return None if not exist .


(returns, positions, transactions,
                          unadjusted_returns=None, estimate_intraday='infer',
                          return_fig=False)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
,
arg_4
=
'infer'
,
arg_5
=
False
)
:
arg_1
=
utils
.
check_intraday
(
arg_4
,
arg_0
,
arg_1
,
arg_2
)
arg_6
=
6
if
arg_3
is
not
else
4
arg_7
=
plt
.
figure
(
figsize
=
(
14
,
arg_6
*
6
)
)
arg_8
=
gridspec
.
GridSpec
(
arg_6
,
3
,
wspace
=
0.5
,
hspace
=
0.5
)
arg_9
=
plt
.
subplot
(
arg_8
[
0
,
:
]
)
arg_10
=
plt
.
subplot
(
arg_8
[
1
,
:
]
,
sharex
=
arg_9
)
arg_11
=
plt
.
subplot
(
arg_8
[
2
,
:
]
)
arg_12
=
plt
.
subplot
(
arg_8
[
3
,
:
]
)
plotting
.
plot_turnover
(
arg_0
,
arg_2
,
arg_1
,
arg_15
=
arg_9
)
plotting
.
plot_daily_volume
(
arg_0
,
arg_2
,
arg_15
=
arg_10
)
try
:
plotting
.
plot_daily_turnover_hist
(
arg_2
,
arg_1
,
arg_15
=
arg_11
)
except
ValueError
:
warnings
.
warn
(
'Unable to generate turnover plot.'
,
UserWarning
)
plotting
.
plot_txn_time_hist
(
arg_2
,
arg_15
=
arg_12
)
if
arg_3
is
not
:
arg_13
=
plt
.
subplot
(
arg_8
[
4
,
:
]
)
plotting
.
plot_slippage_sweep
(
arg_3
,
arg_1
,
arg_2
,
arg_15
=
arg_13
)
arg_14
=
plt
.
subplot
(
arg_8
[
5
,
:
]
)
plotting
.
plot_slippage_sensitivity
(
arg_3
,
arg_1
,
arg_2
,
arg_15
=
arg_14
)
for
arg_15
in
arg_7
.
axes
:
plt
.
setp
(
arg_15
.
get_xticklabels
(
)
,
visible
=
True
)
if
arg_5
:
return
arg_7

def Func(arg_0, arg_1, arg_2,
                          arg_3=None, arg_4='infer',
                          arg_5=False):
    """
    Generate a number of plots for analyzing a strategy's transactions.

    Plots: turnover, daily volume, and a histogram of daily volume.

    Parameters
    ----------
    returns : pd.Series
        Daily returns of the strategy, noncumulative.
         - See full explanation in create_full_tear_sheet.
    positions : pd.DataFrame
        Daily net position values.
         - See full explanation in create_full_tear_sheet.
    transactions : pd.DataFrame
        Prices and amounts of executed trades. One row per trade.
         - See full explanation in create_full_tear_sheet.
    unadjusted_returns : pd.Series, optional
        Daily unadjusted returns of the strategy, noncumulative.
        Will plot additional swippage sweep analysis.
         - See pyfolio.plotting.plot_swippage_sleep and
           pyfolio.plotting.plot_slippage_sensitivity
    estimate_intraday: boolean or str, optional
        Approximate returns for intraday strategies.
        See description in create_full_tear_sheet.
    return_fig : boolean, optional
        If True, returns the figure that was plotted on.
    """

    arg_1 = utils.check_intraday(arg_4, arg_0,
                                     arg_1, arg_2)

    arg_6 = 6 if arg_3 is not None else 4

    arg_7 = plt.figure(figsize=(14, arg_6 * 6))
    arg_8 = gridspec.GridSpec(arg_6, 3, wspace=0.5, hspace=0.5)
    arg_9 = plt.subplot(arg_8[0, :])
    arg_10 = plt.subplot(arg_8[1, :], sharex=arg_9)
    arg_11 = plt.subplot(arg_8[2, :])
    arg_12 = plt.subplot(arg_8[3, :])

    plotting.plot_turnover(
        arg_0,
        arg_2,
        arg_1,
        arg_15=arg_9)

    plotting.plot_daily_volume(arg_0, arg_2, arg_15=arg_10)

    try:
        plotting.plot_daily_turnover_hist(arg_2, arg_1,
                                          arg_15=arg_11)
    except ValueError:
        warnings.warn('Unable to generate turnover plot.', UserWarning)

    plotting.plot_txn_time_hist(arg_2, arg_15=arg_12)

    if arg_3 is not None:
        arg_13 = plt.subplot(arg_8[4, :])
        plotting.plot_slippage_sweep(arg_3,
                                     arg_1,
                                     arg_2,
                                     arg_15=arg_13
                                     )
        arg_14 = plt.subplot(arg_8[5, :])
        plotting.plot_slippage_sensitivity(arg_3,
                                           arg_1,
                                           arg_2,
                                           arg_15=arg_14
                                           )
    for arg_15 in arg_7.axes:
        plt.setp(arg_15.get_xticklabels(), visible=True)

    if arg_5:
        return arg_7

Generate a number of plots for analyzing a strategy s transactions .


def Func ( arg_0 , arg_1 , * arg_2 ) : arg_2 = list_or_args ( arg_1 , arg_2 ) arg_3 = { } arg_4 = { } for arg_5 in arg_2 : arg_6 = arg_0 . get_server_name ( arg_5 ) arg_3 [ arg_6 ] = arg_3 . get ( arg_6 , [ ] ) arg_3 [ arg_6 ] . append ( arg_5 ) for arg_6 , arg_7 in iteritems ( arg_3 ) : arg_8 = arg_0 . connections [ arg_6 ] . Func ( arg_7 ) arg_4 . update ( dict ( zip ( arg_7 , arg_8 ) ) ) arg_9 = [ ] for arg_5 in arg_2 : arg_9 . append ( arg_4 . get ( arg_5 , None ) ) return arg_9

def Func(arg_0, arg_1, *arg_2):
        """
        Returns a list of values ordered identically to ``keys``
        """
        arg_2 = list_or_args(arg_1, arg_2)
        arg_3 = {}
        arg_4 = {}
        for arg_5 in arg_2:
            arg_6 = arg_0.get_server_name(arg_5)
            arg_3[arg_6] = arg_3.get(arg_6, [])
            arg_3[arg_6].append(arg_5)
        for arg_6, arg_7 in iteritems(arg_3):
            arg_8 = arg_0.connections[arg_6].Func(arg_7)
            arg_4.update(dict(zip(arg_7, arg_8)))
        arg_9 = []
        for arg_5 in arg_2:
            arg_9.append(arg_4.get(arg_5, None))
        return arg_9

Returns a list of values ordered identically to keys


return request.data.get(key, request.query_params.get(key, default))

def Func ( arg_0 , arg_1 , arg_2 = None ) : if arg_0 . method in [ 'GET' , 'DELETE' ] : return arg_0 . query_params . get ( arg_1 , arg_0 . data . get ( arg_1 , arg_2 ) ) return arg_0 . data . get ( arg_1 , arg_0 . query_params . get ( arg_1 , arg_2 ) )

def Func(arg_0, arg_1, arg_2=None):
    """
    Get the value in the request, either through query parameters or posted data, from a key.

    :param request: The request from which the value should be gotten.
    :param key: The key to use to get the desired value.
    :param default: The backup value to use in case the input key cannot help us get the value.
    :return: The value we're looking for.
    """
    if arg_0.method in ['GET', 'DELETE']:
        return arg_0.query_params.get(arg_1, arg_0.data.get(arg_1, arg_2))
    return arg_0.data.get(arg_1, arg_0.query_params.get(arg_1, arg_2))

Get the value in the request either through query parameters or posted data from a key .


def Func ( arg_0 , arg_1 , arg_2 = False ) : if arg_2 or not path . isfile ( arg_0 . file ) : with open ( arg_0 . file , "w" , encoding = "utf-8" , newline = "\n" ) as file : if arg_1 and isinstance ( arg_1 , str ) : file . Func ( arg_1 ) else : with open ( arg_0 . file , "a" , encoding = "utf-8" , newline = "\n" ) as file : if arg_1 and isinstance ( arg_1 , str ) : file . Func ( arg_1 )

def Func(arg_0, arg_1, arg_2=False):
        """
        Write or append data into the given file path.

        :param data_to_Func: The data to Func.
        :type data_to_Func: str

        :param overFunc:
            Tell us if we have to overFunc the
            content of the file we are working with.
        :type overFunc: bool
        """

        if arg_2 or not path.isfile(arg_0.file):
            # * We have to overFunc the file data.
            # or
            # * The file path does not already exist.

            with open(arg_0.file, "w", encoding="utf-8", newline="\n") as file:
                # We prepare the file for writting.

                if arg_1 and isinstance(arg_1, str):
                    # * A data  to Func is given.
                    # and
                    # * The data to Func is a string

                    # We Func the string into the file.
                    file.Func(arg_1)
        else:
            # * We do not have to overFunc the file data.
            # or
            # * The file path does already exist.

            with open(arg_0.file, "a", encoding="utf-8", newline="\n") as file:
                # We prepare the file for append writting.

                if arg_1 and isinstance(arg_1, str):
                    # * A data  to Func is given.
                    # and
                    # * The data to Func is a string

                    # We append the string into the file.
                    file.Func(arg_1)

Write or append data into the given file path.

        :param data_to_write: The data to write.
        :type data_to_write: str

        :param overwrite:
            Tell us if we have to overwrite the
            content of the file we are working with.
        :type overwrite: bool

Write or append data into the given file path .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
arg_0
.
table
(
arg_1
)
.
get
(
arg_2
=
arg_2
)
if
arg_3
is
:
raise
KeyError
(
'Could not find {} with eid {}.'
.
format
(
arg_1
,
arg_2
)
)
return
arg_3

def Func(arg_0, arg_1, arg_2):
        """Return the element in `table_name` with Object ID `eid`.
        If None is found will raise a KeyError exception.

        Parameters
        ----------
        table_name: str
            The name of the table to look in.

        eid: int
            The Object ID of the element to look for.

        Returns
        -------
        elem: tinydb.database.Element

        Raises
        ------
        KeyError
            If the element with ID `eid` is not found.
        """
        arg_3 = arg_0.table(arg_1).get(arg_2=arg_2)
        if arg_3 is None:
            raise KeyError('Could not find {} with eid {}.'.format(arg_1, arg_2))

        return arg_3

Return the element in table_name with Object ID eid . If None is found will raise a KeyError exception .


(self, file_,
                           media_type=None,
                           media_category=None,
                           chunked=None,
                           size_limit=None,
                           **params)

async def Func(arg_0, arg_1,
                           arg_2=None,
                           arg_3=None,
                           arg_4=None,
                           arg_5=None,
                           **arg_6):
        """
            upload a media on twitter

        Parameters
        ----------
        file_ : str or pathlib.Path or file
            Path to the file or file object
        media_type : str, optional
            mime type of the media
        media_category : str, optional
            Twitter's media category of the media, must be used with
            ``media_type``
        chunked : bool, optional
            If True, force the use of the chunked upload for the media
        size_limit : int, optional
            If set, the media will be sent using a multipart upload if
            its size is over ``size_limit`` bytes
        params : dict
            parameters used when making the request

        Returns
        -------
        .data_processing.PeonyResponse
            Response of the request
        """
        if isinstance(arg_1, str):
            arg_7 = urlparse(arg_1)
            if arg_7.scheme.startswith('http'):
                arg_8 = await arg_0._session.get(arg_1)
            else:
                arg_9 = urlparse(arg_1).path.strip(" \"'")
                arg_8 = await utils.execute(open(arg_9, 'rb'))
        elif hasattr(arg_1, 'read') or isinstance(arg_1, bytes):
            arg_8 = arg_1
        else:
            raise TypeError("Func input must be a file object or a "
                            "filename or binary data or an aiohttp request")

        arg_10 = await utils.get_size(arg_8)
        if arg_4 is not None:
            arg_11 = False
        else:
            arg_11 = await arg_0._size_test(arg_10, arg_5)

        if isinstance(arg_8, aiohttp.ClientResponse):
            # send the content of the response
            arg_8 = arg_8.content

        if arg_4 or (arg_11 and arg_4 is None):
            arg_12 = arg_8, arg_10, arg_1, arg_2, arg_3
            arg_13 = await arg_0._chunked_upload(*arg_12, **arg_6)
        else:
            arg_13 = await arg_0.upload.media.upload.post(arg_8=arg_8,
                                                           **arg_6)

        if not hasattr(arg_1, 'read') and not getattr(arg_8, 'closed', True):
            arg_8.close()

        return arg_13


def Func(arg_0, arg_1, arg_2):
    """ Writes a report from multiple samples.

    Parameters
    ----------
    storage_dic : dict or :py:class:`OrderedDict`
        Storage containing the trimming statistics. See :py:func:`parse_log`
        for its generation.
    output_file : str
        Path where the output file will be generated.
    sample_id : str
        Id or name of the current sample.
    """

    with open(arg_1, "w") as fh, open(".report.json", "w") as json_rep:

        # Write header
        fh.write("Sample,Total length,Total trimmed,%,5end Trim,3end Trim,"
                 "bad_reads\\n")

        # Write contents
        for arg_3, arg_4 in arg_0.items():
            fh.write("{},{}\\n".format(
                arg_3, ",".join([str(arg_5) for arg_5 in arg_4.values()])))

            arg_6 = {
                "tableRow": [{
                    "sample": arg_2,
                    "data": [
                        {"header": "trimmed",
                         "value": arg_4["total_trim_perc"],
                         "table": "qc",
                         "columnBar": True},
                    ]
                }],
                "plotData": [{
                    "sample": arg_2,
                    "data": {
                        "sparkline": arg_4["clean_len"]
                    }
                }],
                "badReads": arg_4["bad_reads"]
            }
            json_rep.write(json.dumps(arg_6, separators=(",", ":")))


def Func(arg_0):
        """
        Re-calculates the position of the Label.
        """
        # Convenience variables
        arg_1,arg_2 = arg_0.size
        arg_3,arg_4 = arg_0.pos

        # Label position
        arg_0._label.anchor_x = "left"
        arg_0._label.x = arg_3+arg_1/2.+arg_1
        arg_0._label.y = arg_4+arg_2/2.+arg_2*.15
        arg_0._label._update()

Re - calculates the position of the Label .


Return a new Streamlet by applying map_function to each element of this Streamlet.

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

def Func(arg_0, arg_1):
    """Return a new Streamlet by applying Func_function to each element of this Streamlet.
    """
    from heronpy.streamlet.impl.Funcbolt import MapStreamlet
    arg_2 = MapStreamlet(arg_1, arg_0)
    arg_0._add_child(arg_2)
    return arg_2

Return a new Streamlet by applying map_function to each element of this Streamlet .


def
Func
(
arg_0
,
arg_1
)
:
if
isinstance
(
arg_1
,
string_types
)
or
hasattr
(
arg_1
,
"id"
)
:
warn
(
"need to pass in a list"
)
arg_1
=
[
arg_1
]
for
arg_2
in
arg_1
:
if
arg_2
.
id
not
in
arg_0
.
groups
:
LOGGER
.
warning
(
"%r not in %r. Ignored."
,
arg_2
,
arg_0
)
else
:
arg_0
.
groups
.
remove
(
arg_2
)
arg_2
.
_model
=

def Func(arg_0, arg_1):
        """Remove groups from the model.

        Members of each group are not removed
        from the model (i.e. metabolites, reactions, and genes in the group
        stay in the model after any groups containing them are removed).

        Parameters
        ----------
        group_list : list
            A list of `cobra.Group` objects to remove from the model.
        """

        if isinstance(arg_1, string_types) or \
                hasattr(arg_1, "id"):
            warn("need to pass in a list")
            arg_1 = [arg_1]

        for arg_2 in arg_1:
            # make sure the group is in the model
            if arg_2.id not in arg_0.groups:
                LOGGER.warning("%r not in %r. Ignored.", arg_2, arg_0)
            else:
                arg_0.groups.remove(arg_2)
                arg_2._model = None


def Func ( arg_0 , arg_1 = 'horizontal' ) : assert arg_1 in [ 'horizontal' , 'vertical' ] if arg_1 == 'horizontal' : return np . flip ( arg_0 , axis = 1 ) else : return np . flip ( arg_0 , axis = 0 )

def Func(arg_0, arg_1='horizontal'):
    """Flip an image horizontally or vertically.

    Args:
        img (ndarray): Image to be flipped.
        direction (str): The flip direction, either "horizontal" or "vertical".

    Returns:
        ndarray: The flipped image.
    """
    assert arg_1 in ['horizontal', 'vertical']
    if arg_1 == 'horizontal':
        return np.flip(arg_0, axis=1)
    else:
        return np.flip(arg_0, axis=0)

Flip an image horizontally or vertically .


def Func(arg_0):
        """
        Installs Vagrant from the most recent package available from their homepage.
        """
        from burlap.system import get_arch, distrib_family
        arg_1 = arg_0.local_renderer
        arg_2 = urlopen(arg_1.env.download_url).read()
        print(len(arg_2))
        arg_3 = DOWNLOAD_LINK_PATTERN.findall(arg_2)
        print(arg_3)
        arg_4 = get_arch() # e.g. 'x86_64'
        arg_5 = distrib_family()
        if arg_5 == DEBIAN:
            arg_6 = '.deb'
            arg_3 = [match for match in arg_3 if match.endswith(arg_6) and arg_4 in match]
            print('matches:', arg_3)
            assert arg_3, "No matches found."
            assert len(arg_3) == 1, "Too many matches found: %s" % (', '.join(arg_3))
            arg_1.env.final_download_url = arg_3[0]
            arg_1.env.local_filename = '/tmp/vagrant%s' % arg_6
            arg_1.run('wget -O {local_filename} {final_download_url}')
            arg_1.sudo('dpkg -i {local_filename}')
        else:
            raise NotImplementedError('Unsupported family: %s' % arg_5)

Installs Vagrant from the most recent package available from their homepage .


return cls(date.year, date.month, date.day,
                   time.hour, time.minute, time.second, time.microsecond,
                   time.tzinfo)

def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
if
not
isinstance
(
arg_1
,
_date_class
)
:
raise
TypeError
(
"date argument must be a date instance"
)
if
not
isinstance
(
arg_2
,
_time_class
)
:
raise
TypeError
(
"time argument must be a time instance"
)
return
arg_0
(
arg_1
.
year
,
arg_1
.
month
,
arg_1
.
day
,
arg_2
.
hour
,
arg_2
.
minute
,
arg_2
.
second
,
arg_2
.
microsecond
,
arg_2
.
tzinfo
)

def Func(arg_0, arg_1, arg_2):
        "Construct a datetime from a given date and a given time."
        if not isinstance(arg_1, _date_class):
            raise TypeError("date argument must be a date instance")
        if not isinstance(arg_2, _time_class):
            raise TypeError("time argument must be a time instance")
        return arg_0(arg_1.year, arg_1.month, arg_1.day,
                   arg_2.hour, arg_2.minute, arg_2.second, arg_2.microsecond,
                   arg_2.tzinfo)

Construct a datetime from a given date and a given time .


def Func(arg_0, arg_1=False, arg_2=None):
        """Purge the stash from all keys
        """
        arg_0._assert_valid_stash()

        if not arg_1:
            raise GhostError(
                "The `force` flag must be provided to perform a stash Func. "
                "I mean, you don't really want to just delete everything "
                "without precautionary measures eh?")

        audit(
            storage=arg_0._storage.db_path,
            action='PURGE',
            message=json.dumps(dict()))

        for arg_3 in arg_0.list(arg_2=arg_2):
            arg_0.delete(arg_3)


return "{}${}".format(
            self._derive_checksum(self.masterkey), aes.encrypt(self.masterkey)
        )

def Func ( arg_0 ) : if not arg_0 . unlocked ( ) : raise WalletLocked arg_1 = AESCipher ( arg_0 . password ) return "{}${}" . format ( arg_0 . _derive_checksum ( arg_0 . masterkey ) , arg_1 . encrypt ( arg_0 . masterkey ) )

def Func(arg_0):
        """ Obtain the encrypted masterkey

            .. note:: The encrypted masterkey is checksummed, so that we can
                figure out that a provided password is correct or not. The
                checksum is only 4 bytes long!
        """
        if not arg_0.unlocked():
            raise WalletLocked
        arg_1 = AESCipher(arg_0.password)
        return "{}${}".format(
            arg_0._derive_checksum(arg_0.masterkey), arg_1.encrypt(arg_0.masterkey)
        )


Render data with template, return html unicodes.
        parameters
          template   str  the template's filename
          data       dict the data to render

def Func ( arg_0 , arg_1 , ** arg_2 ) : arg_3 = arg_0 . global_data . copy ( ) arg_3 . update ( arg_2 ) try : arg_4 = arg_0 . env . get_template ( arg_1 ) . Func ( ** arg_3 ) except TemplateNotFound : raise JinjaTemplateNotFound return arg_4

def Func(arg_0, arg_1, **arg_2):
        """Render data with template, return html unicodes.
        parameters
          template   str  the template's filename
          data       dict the data to Func
        """
        # make a copy and update the copy
        arg_3 = arg_0.global_data.copy()
        arg_3.update(arg_2)

        try:
            arg_4 = arg_0.env.get_template(arg_1).Func(**arg_3)
        except TemplateNotFound:
            raise JinjaTemplateNotFound
        return arg_4

Render data with template return html unicodes . parameters template str the template s filename data dict the data to render


(script, voxel=1.0, offset=0.0, merge_vert=True,
                       discretize=False, multisample=False, thicken=False)

def Func(arg_0, arg_1=1.0, arg_2=0.0, arg_3=True,
                       arg_4=False, arg_5=False, arg_6=False):
    """ Create a new mesh that is a resampled version of the current one.

    The resampling is done by building a uniform volumetric representation
    where each voxel contains the signed distance from the original surface.
    The resampled surface is reconstructed using the marching cube algorithm
    over this volume.

    Args:
        script: the FilterScript object or script filename to write
            the filter to.
        voxel (float): voxel (cell) size for resampling. Smaller cells give
            better precision at a higher computational cost. Remember that
            halving the cell size means that you build a volume 8 times larger.
        offset (float): offset amount of the created surface (i.e. distance of
            the created surface from the original one). If offset is zero, the
            created surface passes on the original mesh itself. Values greater
            than zero mean an external surface (offset), and lower than zero
            mean an internal surface (inset). In practice this value is the
            threshold passed to the Marching Cube algorithm to extract the
            isosurface from the distance field representation.
        merge_vert (bool): if True the mesh generated by MC will be cleaned by
            unifying vertices that are almost coincident.
        discretize (bool): if True the position of the intersected edge of the
            marching cube grid is not computed by linear interpolation, but it
            is placed in fixed middle position. As a consequence the resampled
            object will look severely aliased by a stairstep appearance. Useful
            only for simulating the output of 3D printing devices.
        multisample (bool): if True the distance field is more accurately
            compute by multisampling the volume (7 sample for each voxel). Much
            slower but less artifacts.
        thicken (bool): if True, you have to choose a non zero Offset and a
            double surface is built around the original surface, inside and
            outside. Is useful to convert thin floating surfaces into solid,
            thick meshes.

    Layer stack:
        Creates 1 new layer 'Offset mesh'
        Current layer is changed to new layer

    MeshLab versions:
        2016.12
        1.3.4BETA
    """
    arg_7 = ''.join([
        '  <filter name="Uniform Mesh Resampling">\n',
        '    <Param name="CellSize" ',
        'value="{}" '.format(arg_1),
        'description="Precision" ',
        'min="0" ',
        'max="100" ',
        'type="RichAbsPerc" ',
        '/>\n',
        '    <Param name="Offset" ',
        'value="{}" '.format(arg_2),
        'description="Offset" ',
        'min="-100" ',
        'max="100" ',
        'type="RichAbsPerc" ',
        '/>\n',
        '    <Param name="mergeCloseVert" ',
        'value="{}" '.format(str(arg_3).lower()),
        'description="Clean Vertices" ',
        'type="RichBool" ',
        '/>\n',
        '    <Param name="discretize" ',
        'value="{}" '.format(str(arg_4).lower()),
        'description="Discretize" ',
        'type="RichBool" ',
        '/>\n',
        '    <Param name="multisample" ',
        'value="{}" '.format(str(arg_5).lower()),
        'description="Multisample" ',
        'type="RichBool" ',
        '/>\n',
        '    <Param name="absDist" ',
        'value="{}" '.format(str(arg_6).lower()),
        'description="Absolute Distance" ',
        'type="RichBool" ',
        '/>\n',
        '  </filter>\n'])
    util.write_filter(arg_0, arg_7)
    if isinstance(arg_0, FilterScript):
        arg_0.add_layer('Offset mesh')
    return None

Create a new mesh that is a resampled version of the current one .


(lcc_server,
                center_ra,
                center_decl,
                radiusarcmin=5.0,
                result_visibility='unlisted',
                email_when_done=False,
                collections=None,
                columns=None,
                filters=None,
                sortspec=None,
                samplespec=None,
                limitspec=None,
                download_data=True,
                outdir=None,
                maxtimeout=300.0,
                refresh=15.0)

def Func(arg_0,
                arg_1,
                arg_2,
                arg_3=5.0,
                arg_4='unlisted',
                arg_5=False,
                arg_6=None,
                arg_7=None,
                arg_8=None,
                arg_9=None,
                arg_10=None,
                arg_11=None,
                arg_12=True,
                arg_13=None,
                arg_14=300.0,
                arg_15=15.0):

    '''This runs a cone-search query.

    Parameters
    ----------

    lcc_server : str
        This is the base URL of the LCC-Server to talk to.  (e.g. for HAT, use:
        https://data.hatsurveys.org)

    center_ra,center_decl : float
        These are the central coordinates of the search to conduct. These can be
        either decimal degrees of type float, or sexagesimal coordinates of type
        str:

        - OK: 290.0, 45.0
        - OK: 15:00:00 +45:00:00
        - OK: 15 00 00.0 -45 00 00.0
        - NOT OK: 290.0 +45:00:00
        - NOT OK: 15:00:00 45.0

    radiusarcmin : float
        This is the search radius to use for the cone-search. This is in
        arcminutes. The maximum radius you can use is 60 arcminutes = 1 degree.

    result_visibility : {'private', 'unlisted', 'public'}
        This sets the visibility of the dataset produced from the search
        result::

               'private' -> the dataset and its products are not visible or
                            accessible by any user other than the one that
                            created the dataset.

               'unlisted' -> the dataset and its products are not visible in the
                             list of public datasets, but can be accessed if the
                             dataset URL is known

               'public' -> the dataset and its products are visible in the list
                           of public datasets and can be accessed by anyone.

    email_when_done : bool
        If True, the LCC-Server will email you when the search is complete. This
        will also set `download_data` to False. Using this requires an
        LCC-Server account and an API key tied to that account.

    collections : list of str or None
        This is a list of LC collections to search in. If this is None, all
        collections will be searched.

    columns : list of str or None
        This is a list of columns to return in the results. Matching objects'
        object IDs, RAs, DECs, and links to light curve files will always be
        returned so there is no need to specify these columns. If None, only
        these columns will be returned: 'objectid', 'ra', 'decl', 'lcfname'

    filters : str or None
        This is an SQL-like string to use to filter on database columns in the
        LCC-Server's collections. To see the columns available for a search,
        visit the Collections tab in the LCC-Server's browser UI. The filter
        operators allowed are::

            lt      -> less than
            gt      -> greater than
            ge      -> greater than or equal to
            le      -> less than or equal to
            eq      -> equal to
            ne      -> not equal to
            ct      -> contains text
            isnull  -> column value is null
            notnull -> column value is not null

        You may use the `and` and `or` operators between filter specifications
        to chain them together logically.

        Example filter strings::

            "(propermotion gt 200.0) and (sdssr lt 11.0)"
            "(dered_jmag_kmag gt 2.0) and (aep_000_stetsonj gt 10.0)"
            "(gaia_status ct 'ok') and (propermotion gt 300.0)"
            "(simbad_best_objtype ct 'RR') and (dered_sdssu_sdssg lt 0.5)"

    sortspec : tuple of two strs or None
        If not None, this should be a tuple of two items::

            ('column to sort by', 'asc|desc')

        This sets the column to sort the results by. For Func, the
        default column and sort order are 'dist_arcsec' and 'asc', meaning the
        distance from the search center in ascending order.

    samplespec : int or None
        If this is an int, will indicate how many rows from the initial search
        result will be uniformly random sampled and returned.

    limitspec : int or None
        If this is an int, will indicate how many rows from the initial search
        result to return in total.

        `sortspec`, `samplespec`, and `limitspec` are applied in this order:

            sample -> sort -> limit

    download_data : bool
        This sets if the accompanying data from the search results will be
        downloaded automatically. This includes the data table CSV, the dataset
        pickle file, and a light curve ZIP file. Note that if the search service
        indicates that your query is still in progress, this function will block
        until the light curve ZIP file becomes available. The maximum wait time
        in seconds is set by maxtimeout and the refresh interval is set by
        refresh.

        To avoid the wait block, set download_data to False and the function
        will write a pickle file to `~/.astrobase/lccs/query-[setid].pkl`
        containing all the information necessary to retrieve these data files
        later when the query is done. To do so, call the
        `retrieve_dataset_files` with the path to this pickle file (it will be
        returned).

    outdir : str or None
        If this is provided, sets the output directory of the downloaded dataset
        files. If None, they will be downloaded to the current directory.

    maxtimeout : float
        The maximum time in seconds to wait for the LCC-Server to respond with a
        result before timing out. You can use the `retrieve_dataset_files`
        function to get results later as needed.

    refresh : float
        The time to wait in seconds before pinging the LCC-Server to see if a
        search query has completed and dataset result files can be downloaded.

    Returns
    -------

    tuple
        Returns a tuple with the following elements::

            (search result status dict,
             search result CSV file path,
             search result LC ZIP path)

    '''

    # turn the input into a param dict

    arg_16 = '%.5f %.5f %.1f' % (arg_1, arg_2, arg_3)
    arg_17 = {
        'coords':arg_16
    }

    if arg_6:
        arg_17['collections'] = arg_6
    if arg_7:
        arg_17['columns'] = arg_7
    if arg_8:
        arg_17['filters'] = arg_8
    if arg_9:
        arg_17['sortspec'] = json.dumps([arg_9])
    if arg_10:
        arg_17['samplespec'] = int(arg_10)
    if arg_11:
        arg_17['limitspec'] = int(arg_11)

    arg_17['visibility'] = arg_4
    arg_17['emailwhendone'] = arg_5

    # we won't wait for the LC ZIP to complete if email_when_done = True
    if arg_5:
        arg_12 = False

    # check if we have an API key already
    arg_18, arg_19, arg_20 = check_existing_apikey(arg_0)

    # if not, get a new one
    if not arg_18:
        arg_19, arg_20 = get_new_apikey(arg_0)

    # hit the server
    arg_21 = '%s/api/conesearch' % arg_0

    arg_22 = submit_post_searchquery(arg_21, arg_17, arg_19)

    # check the status of the search
    arg_23 = arg_22[0]

    # now we'll check if we want to download the data
    if arg_12:

        if arg_23 == 'ok':

            LOGINFO('query complete, downloading associated data...')
            arg_24, arg_25, arg_26 = retrieve_dataset_files(arg_22,
                                                     arg_13=arg_13,
                                                     arg_19=arg_19)

            if arg_26:
                return arg_22[1], arg_24, arg_25, arg_26
            else:
                return arg_22[1], arg_24, arg_25

        elif arg_23 == 'background':

            LOGINFO('query is not yet complete, '
                    'waiting up to %.1f minutes, '
                    'updates every %s seconds (hit Ctrl+C to cancel)...' %
                    (arg_14/60.0, arg_15))

            arg_27 = 0.0

            while arg_27 < arg_14:

                try:

                    time.sleep(arg_15)
                    arg_24, arg_25, arg_26 = retrieve_dataset_files(arg_22,
                                                             arg_13=arg_13,
                                                             arg_19=arg_19)

                    if (arg_24 and os.path.exists(arg_24) and
                        arg_25 and os.path.exists(arg_25)):

                        LOGINFO('all dataset products collected')
                        return arg_22[1], arg_24, arg_25

                    arg_27 = arg_27 + arg_15

                except KeyboardInterrupt:

                    LOGWARNING('abandoned wait for downloading data')
                    return arg_22[1], None, None

            LOGERROR('wait timed out.')
            return arg_22[1], None, None

        else:

            LOGERROR('could not download the data for this query result')
            return arg_22[1], None, None

    else:

        return arg_22[1], None, None

This runs a cone-search query.

    Parameters
    ----------

    lcc_server : str
        This is the base URL of the LCC-Server to talk to.  (e.g. for HAT, use:
        https://data.hatsurveys.org)

    center_ra,center_decl : float
        These are the central coordinates of the search to conduct. These can be
        either decimal degrees of type float, or sexagesimal coordinates of type
        str:

        - OK: 290.0, 45.0
        - OK: 15:00:00 +45:00:00
        - OK: 15 00 00.0 -45 00 00.0
        - NOT OK: 290.0 +45:00:00
        - NOT OK: 15:00:00 45.0

    radiusarcmin : float
        This is the search radius to use for the cone-search. This is in
        arcminutes. The maximum radius you can use is 60 arcminutes = 1 degree.

    result_visibility : {'private', 'unlisted', 'public'}
        This sets the visibility of the dataset produced from the search
        result::

               'private' -> the dataset and its products are not visible or
                            accessible by any user other than the one that
                            created the dataset.

               'unlisted' -> the dataset and its products are not visible in the
                             list of public datasets, but can be accessed if the
                             dataset URL is known

               'public' -> the dataset and its products are visible in the list
                           of public datasets and can be accessed by anyone.

    email_when_done : bool
        If True, the LCC-Server will email you when the search is complete. This
        will also set `download_data` to False. Using this requires an
        LCC-Server account and an API key tied to that account.

    collections : list of str or None
        This is a list of LC collections to search in. If this is None, all
        collections will be searched.

    columns : list of str or None
        This is a list of columns to return in the results. Matching objects'
        object IDs, RAs, DECs, and links to light curve files will always be
        returned so there is no need to specify these columns. If None, only
        these columns will be returned: 'objectid', 'ra', 'decl', 'lcfname'

    filters : str or None
        This is an SQL-like string to use to filter on database columns in the
        LCC-Server's collections. To see the columns available for a search,
        visit the Collections tab in the LCC-Server's browser UI. The filter
        operators allowed are::

            lt      -> less than
            gt      -> greater than
            ge      -> greater than or equal to
            le      -> less than or equal to
            eq      -> equal to
            ne      -> not equal to
            ct      -> contains text
            isnull  -> column value is null
            notnull -> column value is not null

        You may use the `and` and `or` operators between filter specifications
        to chain them together logically.

        Example filter strings::

            "(propermotion gt 200.0) and (sdssr lt 11.0)"
            "(dered_jmag_kmag gt 2.0) and (aep_000_stetsonj gt 10.0)"
            "(gaia_status ct 'ok') and (propermotion gt 300.0)"
            "(simbad_best_objtype ct 'RR') and (dered_sdssu_sdssg lt 0.5)"

    sortspec : tuple of two strs or None
        If not None, this should be a tuple of two items::

            ('column to sort by', 'asc|desc')

        This sets the column to sort the results by. For cone_search, the
        default column and sort order are 'dist_arcsec' and 'asc', meaning the
        distance from the search center in ascending order.

    samplespec : int or None
        If this is an int, will indicate how many rows from the initial search
        result will be uniformly random sampled and returned.

    limitspec : int or None
        If this is an int, will indicate how many rows from the initial search
        result to return in total.

        `sortspec`, `samplespec`, and `limitspec` are applied in this order:

            sample -> sort -> limit

    download_data : bool
        This sets if the accompanying data from the search results will be
        downloaded automatically. This includes the data table CSV, the dataset
        pickle file, and a light curve ZIP file. Note that if the search service
        indicates that your query is still in progress, this function will block
        until the light curve ZIP file becomes available. The maximum wait time
        in seconds is set by maxtimeout and the refresh interval is set by
        refresh.

        To avoid the wait block, set download_data to False and the function
        will write a pickle file to `~/.astrobase/lccs/query-[setid].pkl`
        containing all the information necessary to retrieve these data files
        later when the query is done. To do so, call the
        `retrieve_dataset_files` with the path to this pickle file (it will be
        returned).

    outdir : str or None
        If this is provided, sets the output directory of the downloaded dataset
        files. If None, they will be downloaded to the current directory.

    maxtimeout : float
        The maximum time in seconds to wait for the LCC-Server to respond with a
        result before timing out. You can use the `retrieve_dataset_files`
        function to get results later as needed.

    refresh : float
        The time to wait in seconds before pinging the LCC-Server to see if a
        search query has completed and dataset result files can be downloaded.

    Returns
    -------

    tuple
        Returns a tuple with the following elements::

            (search result status dict,
             search result CSV file path,
             search result LC ZIP path)


(key_name,
               stash,
               passphrase,
               backend)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
arg_1
=
_get_stash
(
arg_3
,
arg_1
,
arg_2
)
try
:
click
.
echo
(
'Unlocking key...'
)
arg_1
.
unlock
(
arg_0
=
arg_0
)
click
.
echo
(
'Key unlocked successfully'
)
except
GhostError
as
ex
:
sys
.
exit
(
ex
)

def Func(arg_0,
               arg_1,
               arg_2,
               arg_3):
    """Unlock a key to allow it to be modified, deleted or purged

    `KEY_NAME` is the name of the key to unlock
    """
    arg_1 = _get_stash(arg_3, arg_1, arg_2)

    try:
        click.echo('Unlocking key...')
        arg_1.unlock(arg_0=arg_0)
        click.echo('Key unlocked successfully')
    except GhostError as ex:
        sys.exit(ex)

Unlock a key to allow it to be modified deleted or purged


(watchFolder='../abfs/',reAnalyze=False,rebuildSite=False,
           keepGoing=True,matching=False)

def
Func
(
arg_0
=
'../abfs/'
,
arg_1
=
False
,
arg_2
=
False
,
arg_3
=
True
,
arg_4
=
False
)
:
arg_5
=
[
]
while
True
:
print
(
)
arg_6
=
[
]
for
arg_7
in
glob
.
glob
(
arg_0
+
"/*.abf"
)
:
arg_8
=
os
.
path
.
basename
(
arg_7
)
.
replace
(
".abf"
,
""
)
if
not
arg_7
in
arg_5
:
if
os
.
path
.
exists
(
arg_7
.
replace
(
".abf"
,
".rsv"
)
)
:
continue
if
arg_4
and
not
arg_4
in
arg_7
:
continue
arg_5
.
append
(
arg_7
)
if
os
.
path
.
exists
(
os
.
path
.
dirname
(
arg_7
)
+
"/swhlab4/"
+
os
.
path
.
basename
(
arg_7
)
.
replace
(
".abf"
,
"_info.pkl"
)
)
and
arg_1
==
False
:
print
(
"already analyzed"
,
os
.
path
.
basename
(
arg_7
)
)
if
arg_2
:
arg_6
.
append
(
arg_8
)
else
:
handleNewABF
(
arg_7
)
arg_6
.
append
(
arg_8
)
if
len
(
arg_6
)
:
print
(
" -- rebuilding index page"
)
indexing
.
genIndex
(
os
.
path
.
dirname
(
arg_7
)
,
forceIDs
=
arg_6
)
if
not
arg_3
:
return
for
arg_9
in
range
(
50
)
:
print
(
'.'
,
end
=
''
)
time
.
sleep
(
.2
)

def Func(arg_0='../abfs/',arg_1=False,arg_2=False,
           arg_3=True,arg_4=False):
    """
    continuously monitor a folder for new abfs and try to analyze them.
    This is intended to watch only one folder, but can run multiple copies.
    """
    arg_5=[]

    while True:
        print()
        arg_6=[]
        for arg_7 in glob.glob(arg_0+"/*.abf"):
            arg_8=os.path.basename(arg_7).replace(".abf","")
            if not arg_7 in arg_5:
                if os.path.exists(arg_7.replace(".abf",".rsv")): #TODO: or something like this
                    continue
                if arg_4 and not arg_4 in arg_7:
                    continue
                arg_5.append(arg_7)
                if os.path.exists(os.path.dirname(arg_7)+"/swhlab4/"+os.path.basename(arg_7).replace(".abf","_info.pkl")) and arg_1==False:
                    print("already analyzed",os.path.basename(arg_7))
                    if arg_2:
                        arg_6.append(arg_8)
                else:
                    handleNewABF(arg_7)
                    arg_6.append(arg_8)
        if len(arg_6):
            print(" -- rebuilding index page")
            indexing.genIndex(os.path.dirname(arg_7),forceIDs=arg_6)
        if not arg_3:
            return
        for arg_9 in range(50):
            print('.',end='')
            time.sleep(.2)

continuously monitor a folder for new abfs and try to analyze them . This is intended to watch only one folder but can run multiple copies .


(tar_name, file_paths, output_dir='.', prefix='')

def Func(arg_0, arg_1, arg_2='.', arg_3=''):
    """
    Creates a tarball from a group of files

    :param str tar_name: Name of tarball
    :param list[str] file_paths: Absolute file paths to include in the tarball
    :param str output_dir: Output destination for tarball
    :param str prefix: Optional prefix for files in tarball
    """
    with tarfile.open(os.path.join(arg_2, arg_0), 'w:gz') as f_out:
        for arg_4 in arg_1:
            if not arg_4.startswith('/'):
                raise ValueError('Path provided is relative not absolute.')
            arg_5 = arg_3 + os.path.basename(arg_4)
            f_out.add(arg_4, arg_5=arg_5)


def Func ( arg_0 ) : if arg_0 . data is not None : if arg_0 . _pvpc_mean_daily is None : arg_0 . _pvpc_mean_daily = arg_0 . data [ 'data' ] . resample ( 'D' ) . mean ( ) if arg_0 . _pvpc_mean_monthly is None : arg_0 . _pvpc_mean_monthly = arg_0 . data [ 'data' ] . resample ( 'MS' ) . mean ( ) return arg_0 . _pvpc_mean_daily , arg_0 . _pvpc_mean_monthly

def Func(arg_0):
        """Obtiene los dataframes de los datos de PVPC con resampling diario y mensual."""
        if arg_0.data is not None:
            if arg_0._pvpc_mean_daily is None:
                arg_0._pvpc_mean_daily = arg_0.data['data'].resample('D').mean()
            if arg_0._pvpc_mean_monthly is None:
                arg_0._pvpc_mean_monthly = arg_0.data['data'].resample('MS').mean()
        return arg_0._pvpc_mean_daily, arg_0._pvpc_mean_monthly

Obtiene los dataframes de los datos de PVPC con resampling diario y mensual .


def Func(arg_0, arg_1, arg_2):
        """Checks if the parameter considers two values as equal.

        This is important for the trajectory in case of merging. In case you want to delete
        duplicate parameter points, the trajectory needs to know when two parameters
        are equal. Since equality is not always implemented by values handled by
        parameters in the same way, the parameters need to judge whether their values are equal.

        The straightforward example here is a numpy array.
        Checking for equality of two numpy arrays yields
        a third numpy array containing truth values of a piecewise comparison.
        Accordingly, the parameter could judge two numpy arrays equal if ALL of the numpy
        array elements are equal.

        In this BaseParameter class values are considered to be equal if they obey
        the function :func:`~pypet.utils.comparisons.nested_equal`.
        You might consider implementing a different equality comparison in your subclass.

        :raises: TypeError: If both values are not supported by the parameter.

        """
        if arg_0.f_supports(arg_1) != arg_0.f_supports(arg_2):
            return False

        if not arg_0.f_supports(arg_1) and not arg_0.f_supports(arg_2):
            raise TypeError('I do not support the types of both inputs (`%s` and `%s`), '
                            'therefore I cannot judge whether '
                            'the two are equal.' % (str(type(arg_1)), str(type(arg_2))))

        if not arg_0._values_of_same_type(arg_1, arg_2):
            return False

        return comparisons.nested_equal(arg_1, arg_2)

Checks if the parameter considers two values as equal .


def Func ( arg_0 ) : for arg_1 , arg_2 in arg_0 . items ( ) : if not arg_2 . is_closed ( ) : arg_2 . close ( )

def Func(arg_0):
        """Disconnect from all databases"""
        for arg_1, arg_2 in arg_0.items():
            if not arg_2.is_closed():
                arg_2.close()


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

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

Class method that will return a Firewall object by ID .


def Func ( arg_0 , * arg_1 , ** arg_2 ) : for arg_3 , arg_4 in arg_0 . plugins : arg_5 = None try : arg_5 = arg_4 ( * arg_1 , ** arg_2 ) if arg_5 is not None : for arg_6 in arg_5 : yield arg_6 except ( KeyboardInterrupt , SystemExit ) : raise except : arg_7 = sys . exc_info ( ) yield Failure ( * arg_7 ) continue

def Func(arg_0, *arg_1, **arg_2):
        """Call all plugins, yielding each item in each non-None result.
        """
        for arg_3, arg_4 in arg_0.plugins:
            arg_5 = None
            try:
                arg_5 = arg_4(*arg_1, **arg_2)
                if arg_5 is not None:
                    for arg_6 in arg_5:
                        yield arg_6
            except (KeyboardInterrupt, SystemExit):
                raise
            except:
                arg_7 = sys.exc_info()
                yield Failure(*arg_7)
                continue

Call all plugins yielding each item in each non - None result .


def Func(arg_0):
        """Run lines of code in IPythonApp.exec_lines in the user's namespace."""
        if not arg_0.exec_lines:
            return
        try:
            arg_0.log.debug("Running code from IPythonApp.exec_lines...")
            for arg_1 in arg_0.exec_lines:
                try:
                    arg_0.log.info("Running code in user namespace: %s" %
                                  arg_1)
                    arg_0.shell.run_cell(arg_1, store_history=False)
                except:
                    arg_0.log.warn("Error in executing line in user "
                                  "namespace: %s" % arg_1)
                    arg_0.shell.showtraceback()
        except:
            arg_0.log.warn("Unknown error in handling IPythonApp.exec_lines:")
            arg_0.shell.showtraceback()

Run lines of code in IPythonApp . exec_lines in the user s namespace .


def Func(arg_0, arg_1):
    """Adds images to the last article"""

    arg_2 = arg_0.obj

    header('Looking for the latest article...')
    arg_3 = find_last_article(arg_2['CONTENT_DIR'])
    if not arg_3:
        return click.secho('No articles.', fg='red')
    click.echo(os.path.basename(arg_3))

    header('Looking for images...')
    arg_4 = list(sorted(find_images(arg_1)))
    if not arg_4:
        return click.secho('Found no images.', fg='red')

    for arg_5 in arg_4:
        click.secho(arg_5, fg='green')

    if not click.confirm('\nAdd these images to the latest article'):
        abort(arg_2)

    arg_6 = os.path.join('{filename}', IMAGES_PATH)
    arg_7 = os.path.join(arg_2['CONTENT_DIR'], IMAGES_PATH)
    os.makedirs(arg_7, exist_ok=True)

    header('Processing images...')
    arg_8 = []
    for arg_5 in arg_4:
        arg_9 = os.path.basename(arg_5).replace(' ', '-').lower()
        arg_8.append(os.path.join(arg_6, arg_9))
        arg_10 = os.path.join(arg_7, arg_9)
        print(arg_5, arg_10)
        import_image(arg_5, arg_10)

    arg_11 = '\n'
    for arg_12 in arg_8:
        arg_12 = arg_12.replace('\\', '/')
        arg_11 += '\n![image description]({})\n'.format(arg_12)

    header('Adding to article: {}'.format(arg_3))
    with click.open_file(arg_3, 'a') as f:
        f.write(arg_11)
    click.launch(arg_3)


def Func ( arg_0 ) : if exists ( arg_0 . filepath ) : arg_1 = open ( arg_0 . filepath ) . read ( ) . decode ( charset ) else : arg_1 = "" try : arg_2 = toml . loads ( arg_1 ) except toml . TomlSyntaxError : raise ConfigSyntaxError return arg_2

def Func(arg_0):
        """Func config, return a dict"""

        if exists(arg_0.filepath):
            arg_1 = open(arg_0.filepath).read().decode(charset)
        else:
            arg_1 = ""

        try:
            arg_2 = toml.loads(arg_1)
        except toml.TomlSyntaxError:
            raise ConfigSyntaxError

        return arg_2


def Func(arg_0):
        """Validates Status information. Raises errors for required
        properties."""
        if not arg_0.id:
            arg_1 = "No 'id' in Status for request '{}'"
            raise ValidationError(arg_1.format(arg_0.url))

        if not arg_0.status:
            arg_1 = "No 'status' in Status for request '{}'"
            raise ValidationError(arg_1.format(arg_0.url))

        if arg_0.total_count is None:
            arg_1 = "No 'total_count' in Status for request '{}'"
            raise ValidationError(arg_1.format(arg_0.url))

        if arg_0.success_count is None:
            arg_1 = "No 'success_count' in Status for request '{}'"
            raise ValidationError(arg_1.format(arg_0.url))

        if arg_0.failure_count is None:
            arg_1 = "No 'failure_count' in Status for request '{}'"
            raise ValidationError(arg_1.format(arg_0.url))

        if arg_0.pending_count is None:
            arg_1 = "No 'pending_count' in Status for request '{}'"
            raise ValidationError(arg_1.format(arg_0.url))

        if len(arg_0.successes) != arg_0.success_count:
            arg_1 = "Found successes={}, but success_count={} in status '{}'"
            raise ValidationError(arg_1.format(arg_0.successes,
                                             arg_0.success_count,
                                             arg_0.id))

        if len(arg_0.pendings) != arg_0.pending_count:
            arg_1 = "Found pendings={}, but pending_count={} in status '{}'"
            raise ValidationError(arg_1.format(arg_0.pendings,
                                             arg_0.pending_count,
                                             arg_0.id))

        if len(arg_0.failures) != arg_0.failure_count:
            arg_1 = "Found failures={}, but failure_count={} in status '{}'"
            raise ValidationError(arg_1.format(arg_0.failures,
                                             arg_0.failure_count,
                                             arg_0.id))

        if (arg_0.success_count + arg_0.pending_count + arg_0.failure_count !=
                arg_0.total_count):
            arg_1 = ("(success_count={} + pending_count={} + "
                   "failure_count={}) != total_count={} in status '{}'")
            raise ValidationError(arg_1.format(arg_0.success_count,
                                             arg_0.pending_count,
                                             arg_0.failure_count,
                                             arg_0.total_count,
                                             arg_0.id))

Validates Status information . Raises errors for required properties .


def Func ( arg_0 = None , arg_1 = None , arg_2 = None ) : if arg_2 is None : arg_2 = datetime . timedelta ( days = 1 ) if arg_0 is None : arg_0 = datetime . datetime . now ( ) while arg_0 < arg_1 : yield arg_0 arg_0 += arg_2

def Func(arg_0=None, arg_1=None, arg_2=None):
	"""
	Much like the built-in function range, but works with dates

	>>> range_items = Func(
	...     datetime.datetime(2005,12,21),
	...     datetime.datetime(2005,12,25),
	... )
	>>> my_range = tuple(range_items)
	>>> datetime.datetime(2005,12,21) in my_range
	True
	>>> datetime.datetime(2005,12,22) in my_range
	True
	>>> datetime.datetime(2005,12,25) in my_range
	False
	"""
	if arg_2 is None:
		arg_2 = datetime.timedelta(days=1)
	if arg_0 is None:
		arg_0 = datetime.datetime.now()
	while arg_0 < arg_1:
		yield arg_0
		arg_0 += arg_2

Much like the built-in function range, but works with dates

	>>> range_items = date_range(
	...     datetime.datetime(2005,12,21),
	...     datetime.datetime(2005,12,25),
	... )
	>>> my_range = tuple(range_items)
	>>> datetime.datetime(2005,12,21) in my_range
	True
	>>> datetime.datetime(2005,12,22) in my_range
	True
	>>> datetime.datetime(2005,12,25) in my_range
	False

Much like the built - in function range but works with dates


(self, message, fh=None, prefix="[warn]:", suffix="...")

def Func ( arg_0 , arg_1 , arg_2 = None , arg_3 = "[warn]:" , arg_4 = "..." ) : arg_5 = arg_3 + arg_1 + arg_4 arg_2 = arg_2 or sys . stdout if arg_2 is sys . stdout : termcolor . cprint ( arg_5 , color = "yellow" ) else : arg_2 . write ( arg_5 ) pass

def Func(arg_0, arg_1, arg_2=None, arg_3="[warn]:", arg_4="..."):
        """
        print warn type message,
        if file handle is `sys.stdout`, print color message

        :param str message: message to print
        :param file fh: file handle,default is `sys.stdout`
        :param str prefix: message prefix,default is `[warn]`
        :param str suffix: message suffix ,default is `...`
        :return: None
        """

        arg_5 = arg_3 + arg_1 + arg_4
        arg_2 = arg_2 or sys.stdout

        if arg_2 is sys.stdout:
            termcolor.cprint(arg_5, color="yellow")
        else:
            arg_2.write(arg_5)

        pass

print warn type message if file handle is sys . stdout print color message


def Func(arg_0, arg_1, arg_2=None):
    """Check whether a function argument is specified.

    This function can follow ``check_function()`` in an SCT chain and verifies whether an argument is specified.
    If you want to go on and check whether the argument was correctly specified, you can can continue chaining with
    ``has_equal_value()`` (value-based check) or ``has_equal_ast()`` (AST-based check)

    This function can also follow ``check_function_def()`` or ``check_lambda_function()`` to see if arguments have been
    specified.

    Args:
        name (str): the name of the argument for which you want to check it is specified. This can also be
            a number, in which case it refers to the positional arguments. Named argumetns take precedence.
        missing_msg (str): If specified, this overrides an automatically generated feedback message in case
            the student did specify the argument.
        state (State): State object that is passed from the SCT Chain (don't specify this).

    :Examples:

        Student and solution code::

            import numpy as np
            arr = np.array([1, 2, 3, 4, 5])
            np.mean(arr)

        SCT::

            # Verify whether arr was correctly set in np.mean
            # has_equal_value() checks the value of arr, used to set argument a
            Ex().check_function('numpy.mean').Func('a').has_equal_value()

            # Verify whether arr was correctly set in np.mean
            # has_equal_ast() checks the expression used to set argument a
            Ex().check_function('numpy.mean').Func('a').has_equal_ast()

        Student and solution code::

            def my_power(x):
                print("calculating sqrt...")
                return(x * x)

        SCT::

            Ex().check_function_def('my_power').multi(
                Func('x') # will fail if student used y as arg
                Func(0)   # will still pass if student used y as arg
            )

    """
    if arg_2 is None:
        arg_2 = "Did you specify the {{part}}?"

    if arg_1 in ["*args", "**kwargs"]:  # for check_function_def
        return check_part(arg_0, arg_1, arg_1, arg_2=arg_2)
    else:
        if isinstance(arg_1, list):  # dealing with args or kwargs
            if arg_1[0] == "args":
                arg_3 = "{} argument passed as a variable length argument".format(
                    get_ord(arg_1[1] + 1)
                )
            else:
                arg_3 = "argument `{}`".format(arg_1[1])
        else:
            arg_3 = (
                "{} argument".format(get_ord(arg_1 + 1))
                if isinstance(arg_1, int)
                else "argument `{}`".format(arg_1)
            )
        return check_part_index(arg_0, "args", arg_1, arg_3, arg_2=arg_2)

Check whether a function argument is specified.

    This function can follow ``check_function()`` in an SCT chain and verifies whether an argument is specified.
    If you want to go on and check whether the argument was correctly specified, you can can continue chaining with
    ``has_equal_value()`` (value-based check) or ``has_equal_ast()`` (AST-based check)

    This function can also follow ``check_function_def()`` or ``check_lambda_function()`` to see if arguments have been
    specified.

    Args:
        name (str): the name of the argument for which you want to check it is specified. This can also be
            a number, in which case it refers to the positional arguments. Named argumetns take precedence.
        missing_msg (str): If specified, this overrides an automatically generated feedback message in case
            the student did specify the argument.
        state (State): State object that is passed from the SCT Chain (don't specify this).

    :Examples:

        Student and solution code::

            import numpy as np
            arr = np.array([1, 2, 3, 4, 5])
            np.mean(arr)

        SCT::

            # Verify whether arr was correctly set in np.mean
            # has_equal_value() checks the value of arr, used to set argument a
            Ex().check_function('numpy.mean').check_args('a').has_equal_value()

            # Verify whether arr was correctly set in np.mean
            # has_equal_ast() checks the expression used to set argument a
            Ex().check_function('numpy.mean').check_args('a').has_equal_ast()

        Student and solution code::

            def my_power(x):
                print("calculating sqrt...")
                return(x * x)

        SCT::

            Ex().check_function_def('my_power').multi(
                check_args('x') # will fail if student used y as arg
                check_args(0)   # will still pass if student used y as arg
            )

Check whether a function argument is specified .


(filename, prefix='', offset=0, max_num=0)

def Func ( arg_0 , arg_1 = '' , arg_2 = 0 , arg_3 = 0 ) : arg_4 = 0 arg_5 = [ ] with open ( arg_0 , 'r' ) as f : for arg_6 in range ( arg_2 ) : f . readline ( ) for arg_7 in f : if arg_3 > 0 and arg_4 >= arg_3 : break arg_5 . append ( arg_1 + arg_7 . rstrip ( '\n' ) ) arg_4 += 1 return arg_5

def Func(arg_0, arg_1='', arg_2=0, arg_3=0):
    """Load a text file and parse the content as a list of strings.

    Args:
        filename (str): Filename.
        prefix (str): The prefix to be inserted to the begining of each item.
        offset (int): The offset of lines.
        max_num (int): The maximum number of lines to be read,
            zeros and negatives mean no limitation.

    Returns:
        list[str]: A list of strings.
    """
    arg_4 = 0
    arg_5 = []
    with open(arg_0, 'r') as f:
        for arg_6 in range(arg_2):
            f.readline()
        for arg_7 in f:
            if arg_3 > 0 and arg_4 >= arg_3:
                break
            arg_5.append(arg_1 + arg_7.rstrip('\n'))
            arg_4 += 1
    return arg_5

Load a text file and parse the content as a list of strings .


(msg, msg_nocr, section, co, lasti=-1, start_line=-1,
                end_line=None, relative_pos=False, highlight='light',
                start_offset=0, end_offset=None)

return disassemble_bytes(msg, msg_nocr, co.co_code, lasti, co.co_firstlineno,
                             start_line, end_line, relative_pos,
                        co.co_varnames, co.co_names, co.co_consts,
                        co.co_cellvars, co.co_freevars,
                        dict(findlinestarts(co)), highlight,
                        start_offset=start_offset, end_offset=end_offset)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=-1, arg_5=-1,
                arg_6=None, arg_7=False, arg_8='light',
                arg_9=0, arg_10=None):
    """Disassemble a code object."""
    return Func_bytes(arg_0, arg_1, arg_3.co_code, arg_4, arg_3.co_firstlineno,
                             arg_5, arg_6, arg_7,
                        arg_3.co_varnames, arg_3.co_names, arg_3.co_consts,
                        arg_3.co_cellvars, arg_3.co_freevars,
                        dict(findlinestarts(arg_3)), arg_8,
                        arg_9=arg_9, arg_10=arg_10)


This method starts the thread that continuously runs to receive and interpret
        messages coming from Firmata. This must be the last method in this file
        It also checks the deque for messages to be sent to Firmata.

def Func(arg_0):
        """
        This method starts the thread that continuously Funcs to receive and interpret
        messages coming from Firmata. This must be the last method in this file
        It also checks the deque for messages to be sent to Firmata.
        """
        # To add a command to the command dispatch table, append here.
        arg_0.command_dispatch.update({arg_0.REPORT_VERSION: [arg_0.report_version, 2]})
        arg_0.command_dispatch.update({arg_0.REPORT_FIRMWARE: [arg_0.report_firmware, 1]})
        arg_0.command_dispatch.update({arg_0.ANALOG_MESSAGE: [arg_0.analog_message, 2]})
        arg_0.command_dispatch.update({arg_0.DIGITAL_MESSAGE: [arg_0.digital_message, 2]})
        arg_0.command_dispatch.update({arg_0.ENCODER_DATA: [arg_0.encoder_data, 3]})
        arg_0.command_dispatch.update({arg_0.SONAR_DATA: [arg_0.sonar_data, 3]})
        arg_0.command_dispatch.update({arg_0.STRING_DATA: [arg_0._string_data, 2]})
        arg_0.command_dispatch.update({arg_0.I2C_REPLY: [arg_0.i2c_reply, 2]})
        arg_0.command_dispatch.update({arg_0.CAPABILITY_RESPONSE: [arg_0.capability_response, 2]})
        arg_0.command_dispatch.update({arg_0.PIN_STATE_RESPONSE: [arg_0.pin_state_response, 2]})
        arg_0.command_dispatch.update({arg_0.ANALOG_MAPPING_RESPONSE: [arg_0.analog_mapping_response, 2]})
        arg_0.command_dispatch.update({arg_0.STEPPER_DATA: [arg_0.stepper_version_response, 2]})

        while not arg_0.is_stopped():
            if len(arg_0.pymata.command_deque):
                # get next byte from the deque and process it
                arg_1 = arg_0.pymata.command_deque.popleft()

                # this list will be populated with the received data for the command
                arg_2 = []

                # process sysex commands
                if arg_1 == arg_0.START_SYSEX:
                    # next char is the actual sysex command
                    # wait until we can get data from the deque
                    while len(arg_0.pymata.command_deque) == 0:
                        pass
                    arg_3 = arg_0.pymata.command_deque.popleft()
                    # retrieve the associated command_dispatch entry for this command
                    arg_4 = arg_0.command_dispatch.get(arg_3)

                    # get a "pointer" to the method that will process this command
                    arg_5 = arg_4[0]

                    # now get the rest of the data excluding the END_SYSEX byte
                    arg_6 = False
                    while not arg_6:
                        # wait for more data to arrive
                        while len(arg_0.pymata.command_deque) == 0:
                            pass
                        arg_1 = arg_0.pymata.command_deque.popleft()
                        if arg_1 != arg_0.END_SYSEX:
                            arg_2.append(arg_1)
                        else:
                            arg_6 = True

                            # invoke the method to process the command
                            arg_5(arg_2)
                            # go to the beginning of the loop to process the next command
                    continue

                # is this a command byte in the range of 0x80-0xff - these are the non-sysex messages

                elif 0x80 <= arg_1 <= 0xff:
                    # look up the method for the command in the command dispatch table
                    # for the digital reporting the command value is modified with port number
                    # the handler needs the port to properly process, so decode that from the command and
                    # place in command_data
                    if 0x90 <= arg_1 <= 0x9f:
                        arg_7 = arg_1 & 0xf
                        arg_2.append(arg_7)
                        arg_1 = 0x90
                    # the pin number for analog data is embedded in the command so, decode it
                    elif 0xe0 <= arg_1 <= 0xef:
                        arg_8 = arg_1 & 0xf
                        arg_2.append(arg_8)
                        arg_1 = 0xe0
                    else:
                        pass

                    arg_4 = arg_0.command_dispatch.get(arg_1)

                    # this calls the method retrieved from the dispatch table
                    arg_5 = arg_4[0]

                    # get the number of parameters that this command provides
                    arg_9 = arg_4[1]

                    # look at the number of args that the selected method requires
                    # now get that number of bytes to pass to the called method
                    for arg_10 in range(arg_9):
                        while len(arg_0.pymata.command_deque) == 0:
                            pass
                        arg_1 = arg_0.pymata.command_deque.popleft()
                        arg_2.append(arg_1)
                        # go execute the command with the argument list
                    arg_5(arg_2)

                    # go to the beginning of the loop to process the next command
                    continue
            else:
                time.sleep(.1)

This method starts the thread that continuously runs to receive and interpret messages coming from Firmata . This must be the last method in this file It also checks the deque for messages to be sent to Firmata .


def Func ( arg_0 ) : arg_1 = { } arg_1 [ 'gerp' ] = parse_conservation ( arg_0 , 'dbNSFP_GERP___RS' ) arg_1 [ 'phast' ] = parse_conservation ( arg_0 , 'dbNSFP_phastCons100way_vertebrate' ) arg_1 [ 'phylop' ] = parse_conservation ( arg_0 , 'dbNSFP_phyloP100way_vertebrate' ) return arg_1

def Func(arg_0):
    """Parse the conservation predictors

        Args:
            variant(dict): A variant dictionary

        Returns:
            conservations(dict): A dictionary with the conservations
    """
    arg_1 = {}

    arg_1['gerp'] = parse_conservation(
                                            arg_0,
                                            'dbNSFP_GERP___RS'
                                        )
    arg_1['phast'] = parse_conservation(
                                            arg_0,
                                            'dbNSFP_phastCons100way_vertebrate'
                                        )
    arg_1['phylop'] = parse_conservation(
                                            arg_0,
                                            'dbNSFP_phyloP100way_vertebrate'
                                        )
    return arg_1


def Func ( arg_0 ) : if arg_0 . _data is not None : arg_1 = { 'data' : ObjectTable ( data = { 'data' : [ arg_0 . _data ] } ) } if arg_0 . f_has_range ( ) : arg_1 [ 'explored_data' ] = ObjectTable ( data = { 'data' : arg_0 . _explored_range } ) arg_0 . _locked = True return arg_1

def Func(arg_0):
        """Returns a dictionary of formatted data understood by the storage service.

        The data is put into an :class:`~pypet.parameter.ObjectTable` named 'data'.
        If the parameter is explored, the exploration range is also put into another table
        named 'explored_data'.

        :return: Dictionary containing the data and optionally the exploration range.

        """
        if arg_0._data is not None:
            arg_1 = {'data': ObjectTable(data={'data': [arg_0._data]})}

        if arg_0.f_has_range():
            arg_1['explored_data'] = ObjectTable(data={'data': arg_0._explored_range})

        arg_0._locked = True

        return arg_1

Returns a dictionary of formatted data understood by the storage service .


(self, start_time, end_time, strict=False)

def Func(arg_0, arg_1, arg_2, arg_3=False):
        '''
        Trim all the annotations inside the jam and return as a new `JAMS`
        object.

        See `Annotation.Func` for details about how the annotations
        are Funcmed.

        This operation is also documented in the jam-level sandbox
        with a list keyed by ``JAMS.sandbox.Func`` containing a tuple for each
        jam-level Func of the form ``(start_time, end_time)``.

        This function also copies over all of the file metadata from the
        original jam.

        Note: Funcming does not affect the duration of the jam, i.e. the value
        of ``JAMS.file_metadata.duration`` will be the same for the original
        and Funcmed jams.

        Parameters
        ----------
        start_time : float
            The desired start time for the Funcmed annotations in seconds.
        end_time
            The desired end time for Funcmed annotations in seconds. Must be
            greater than ``start_time``.
        strict : bool
            When ``False`` (default) observations that lie at the boundaries of
            the Funcming range (see `Annotation.Func` for details), will have
            their time and/or duration adjusted such that only the part of the
            observation that lies within the Func range is kept. When ``True``
            such observations are discarded and not included in the Funcmed
            annotation.

        Returns
        -------
        jam_Funcmed : JAMS
            The Funcmed jam with Funcmed annotations, returned as a new JAMS
            object.

        '''
        # Make sure duration is set in file metadata
        if arg_0.file_metadata.duration is None:
            raise JamsError(
                'Duration must be set (jam.file_metadata.duration) before '
                'Funcming can be performed.')

        # Make sure start and end times are within the file start/end times
        if not (0 <= arg_1 <= arg_2 <= float(
                arg_0.file_metadata.duration)):
            raise ParameterError(
                'start_time and end_time must be within the original file '
                'duration ({:f}) and end_time cannot be smaller than '
                'start_time.'.format(float(arg_0.file_metadata.duration)))

        # Create a new jams
        arg_4 = JAMS(arg_5=None,
                           file_metadata=arg_0.file_metadata,
                           sandbox=arg_0.sandbox)

        # Func annotations
        arg_4.annotations = arg_0.annotations.Func(
            arg_1, arg_2, arg_3=arg_3)

        # Document jam-level Func in top level sandbox
        if 'Func' not in arg_4.sandbox.keys():
            arg_4.sandbox.update(
                Func=[{'start_time': arg_1, 'end_time': arg_2}])
        else:
            arg_4.sandbox.Func.append(
                {'start_time': arg_1, 'end_time': arg_2})

        return arg_4

Trim all the annotations inside the jam and return as a new `JAMS`
        object.

        See `Annotation.trim` for details about how the annotations
        are trimmed.

        This operation is also documented in the jam-level sandbox
        with a list keyed by ``JAMS.sandbox.trim`` containing a tuple for each
        jam-level trim of the form ``(start_time, end_time)``.

        This function also copies over all of the file metadata from the
        original jam.

        Note: trimming does not affect the duration of the jam, i.e. the value
        of ``JAMS.file_metadata.duration`` will be the same for the original
        and trimmed jams.

        Parameters
        ----------
        start_time : float
            The desired start time for the trimmed annotations in seconds.
        end_time
            The desired end time for trimmed annotations in seconds. Must be
            greater than ``start_time``.
        strict : bool
            When ``False`` (default) observations that lie at the boundaries of
            the trimming range (see `Annotation.trim` for details), will have
            their time and/or duration adjusted such that only the part of the
            observation that lies within the trim range is kept. When ``True``
            such observations are discarded and not included in the trimmed
            annotation.

        Returns
        -------
        jam_trimmed : JAMS
            The trimmed jam with trimmed annotations, returned as a new JAMS
            object.

Trim all the annotations inside the jam and return as a new JAMS object .


def Func ( arg_0 , arg_1 ) : if arg_0 . start <= arg_1 <= arg_0 . end : return 0 else : return min ( abs ( arg_0 . start - arg_1 ) , abs ( arg_0 . end - arg_1 ) )

def Func(arg_0, arg_1):
        '''Returns the distance from the point to the interval. Zero if the point lies inside the interval.'''
        if arg_0.start <= arg_1 <= arg_0.end:
            return 0
        else:
            return min(abs(arg_0.start - arg_1), abs(arg_0.end - arg_1))

Returns the distance from the point to the interval . Zero if the point lies inside the interval .


(
    array, array_affine, geometries, inverted=False, clip_buffer=0
)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = False , arg_4 = 0 ) : arg_5 = [ ] for arg_6 in arg_2 : arg_7 = to_shape ( arg_6 [ "geometry" ] ) if arg_7 . is_empty : continue if arg_7 . geom_type == "GeometryCollection" : arg_8 = unary_union ( [ g . buffer ( arg_4 ) for g in arg_7 ] ) else : arg_8 = arg_7 . buffer ( arg_4 ) if not arg_8 . is_empty : arg_5 . append ( arg_8 ) if arg_5 : if arg_0 . ndim == 2 : return ma . masked_array ( arg_0 , geometry_mask ( arg_5 , arg_0 . shape , arg_1 , invert = arg_3 ) ) elif arg_0 . ndim == 3 : arg_9 = geometry_mask ( arg_5 , ( arg_0 . shape [ 1 ] , arg_0 . shape [ 2 ] ) , arg_1 , invert = arg_3 ) return ma . masked_array ( arg_0 , arg_9 = np . stack ( ( arg_9 for arg_10 in arg_0 ) ) ) else : arg_11 = False if arg_3 else True return ma . masked_array ( arg_0 , arg_9 = np . full ( arg_0 . shape , arg_11 , dtype = bool ) )

def Func(
    arg_0, arg_1, arg_2, arg_3=False, arg_4=0
):
    """
    Clip input array with a vector list.

    Parameters
    ----------
    array : array
        input raster data
    array_affine : Affine
        Affine object describing the raster's geolocation
    geometries : iterable
        iterable of dictionaries, where every entry has a 'geometry' and
        'properties' key.
    inverted : bool
        invert clip (default: False)
    clip_buffer : integer
        buffer (in pixels) geometries before clipping

    Returns
    -------
    clipped array : array
    """
    # buffer input geometries and clean up
    arg_5 = []
    for arg_6 in arg_2:
        arg_7 = to_shape(arg_6["geometry"])
        if arg_7.is_empty:
            continue
        if arg_7.geom_type == "GeometryCollection":
            # for GeometryCollections apply buffer to every subgeometry
            # and make union
            arg_8 = unary_union([
                g.buffer(arg_4) for g in arg_7])
        else:
            arg_8 = arg_7.buffer(arg_4)
        if not arg_8.is_empty:
            arg_5.append(arg_8)

    # mask raster by buffered geometries
    if arg_5:
        if arg_0.ndim == 2:
            return ma.masked_array(
                arg_0, geometry_mask(
                    arg_5, arg_0.shape, arg_1,
                    invert=arg_3))
        elif arg_0.ndim == 3:
            arg_9 = geometry_mask(
                arg_5, (arg_0.shape[1], arg_0.shape[2]),
                arg_1, invert=arg_3)
            return ma.masked_array(
                arg_0, arg_9=np.stack((arg_9 for arg_10 in arg_0)))

    # if no geometries, return unmasked array
    else:
        arg_11 = False if arg_3 else True
        return ma.masked_array(
            arg_0, arg_9=np.full(arg_0.shape, arg_11, dtype=bool))


return render(request, self.template, context)

def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 . _build_context ( arg_1 , arg_2 ) arg_4 = ManageLearnersForm ( user = arg_1 . user , enterprise_customer = arg_3 [ arg_0 . ContextParameters . ENTERPRISE_CUSTOMER ] ) arg_3 . update ( { arg_0 . ContextParameters . MANAGE_LEARNERS_FORM : arg_4 } ) return render ( arg_1 , arg_0 . template , arg_3 )

def Func(arg_0, arg_1, arg_2):
        """
        Handle GET request - render linked learners list and "Link learner" form.

        Arguments:
            request (django.http.request.HttpRequest): Request instance
            customer_uuid (str): Enterprise Customer UUID

        Returns:
            django.http.response.HttpResponse: HttpResponse
        """
        arg_3 = arg_0._build_context(arg_1, arg_2)
        arg_4 = ManageLearnersForm(
            user=arg_1.user,
            enterprise_customer=arg_3[arg_0.ContextParameters.ENTERPRISE_CUSTOMER]
        )
        arg_3.update({arg_0.ContextParameters.MANAGE_LEARNERS_FORM: arg_4})

        return render(arg_1, arg_0.template, arg_3)

Handle GET request - render linked learners list and Link learner form .


def Func(arg_0):
    '''This validates if an API key for the specified LCC-Server is available.

    API keys are stored using the following file scheme::

        ~/.astrobase/lccs/apikey-domain.of.lccserver.org

    e.g. for the HAT LCC-Server at https://data.hatsurveys.org::

        ~/.astrobase/lccs/apikey-https-data.hatsurveys.org

    Parameters
    ----------

    lcc_server : str
        The base URL of the LCC-Server for which the existence of API keys will
        be checked.

    Returns
    -------

    (apikey_ok, apikey_str, expiry) : tuple
        The returned tuple contains the status of the API key, the API key
        itself if present, and its expiry date if present.

    '''

    arg_1 = os.path.expanduser('~')
    arg_2 = os.path.join(arg_1,
                              '.astrobase',
                              'lccs',
                              'apikey-%s' % arg_0.replace(
                                  'https://',
                                  'https-'
                              ).replace(
                                  'http://',
                                  'http-'
                              ))

    if os.path.exists(arg_2):

        # check if this file is readable/writeable by user only
        arg_3 = oct(os.stat(arg_2)[stat.ST_MODE])

        if arg_3 == '0100600' or arg_3 == '0o100600':

            with open(arg_2) as infd:
                arg_4, arg_5 = infd.read().strip('\n').split()

            # get today's datetime
            arg_6 = datetime.now(utc)

            if sys.version_info[:2] < (3,7):
                # this hideous incantation is required for lesser Pythons
                arg_7 = datetime.strptime(
                    arg_5.replace('Z',''),
                    '%Y-%m-%dT%H:%M:%S.%f'
                ).replace(tzinfo=utc)
            else:
                arg_7 = datetime.fromisoformat(arg_5.replace('Z','+00:00'))

            if arg_6 > arg_7:
                LOGERROR('API key has expired. expiry was on: %s' % arg_5)
                return False, arg_4, arg_5
            else:
                return True, arg_4, arg_5

        else:
            LOGWARNING('The API key file %s has bad permissions '
                       'and is insecure, not reading it.\n'
                       '(you need to chmod 600 this file)'
                       % arg_2)

            return False, None, None
    else:
        LOGWARNING('No LCC-Server API key '
                   'found in: {apikeyfile}'.format(apikeyfile=arg_2))

        return False, None, None

This validates if an API key for the specified LCC - Server is available .


return self.indices_to_global_iterator({
            symbol_pos_int(var_name): end-1 for var_name, start, end, incr in self._loop_stack
        })

def Func(arg_0):
        """Return global iterator with last iteration number"""
        return arg_0.indices_to_global_iterator({
            symbol_pos_int(arg_1): arg_3-1 for arg_1, arg_2, arg_3, arg_4 in arg_0._loop_stack
        })


def
Func
(
arg_0
,
arg_1
,
arg_2
=
True
,
**
arg_3
)
:
if
'id'
not
in
arg_0
or
not
arg_0
[
'id'
]
:
raise
Exception
(
'No source dataset ID found. '
'Please instantiate the Dataset '
'object with an ID.'
)
if
isinstance
(
arg_1
,
Dataset
)
:
arg_4
=
arg_1
.
id
else
:
arg_4
=
arg_1
arg_5
=
DatasetMigration
.
create
(
source_id
=
arg_0
[
'id'
]
,
arg_4
=
arg_4
,
**
arg_3
)
if
arg_2
:
arg_5
.
follow
(
)
return
arg_5

def Func(arg_0, arg_1, arg_2=True, **arg_3):
        """
        Migrate the data from this dataset to a target dataset.

        Valid optional kwargs include:

        * source_params
        * target_fields
        * include_errors
        * commit_mode

        """
        if 'id' not in arg_0 or not arg_0['id']:
            raise Exception(
                'No source dataset ID found. '
                'Please instantiate the Dataset '
                'object with an ID.')

        # Target can be provided as a Dataset, or as an ID.
        if isinstance(arg_1, Dataset):
            arg_4 = arg_1.id
        else:
            arg_4 = arg_1

        arg_5 = DatasetMigration.create(
            source_id=arg_0['id'],
            arg_4=arg_4,
            **arg_3)

        if arg_2:
            arg_5.follow()

        return arg_5

Migrate the data from this dataset to a target dataset .


def Func ( arg_0 , arg_1 ) : if arg_0 . _data is not None : for arg_2 in arg_0 . _data [ "volumes" ] : if arg_2 [ "id" ] == arg_1 : return arg_2

def Func(arg_0, arg_1):
        """Returns a specific volume"""
        if arg_0._data is not None:
            for arg_2 in arg_0._data["volumes"]:
                if arg_2["id"] == arg_1:
                    return arg_2


return self._load_data(
            self.COURSES_ENDPOINT,
            resource_id=course_id,
            many=False
        )

def Func ( arg_0 , arg_1 ) : return arg_0 . _load_data ( arg_0 . COURSES_ENDPOINT , resource_id = arg_1 , many = False )

def Func(arg_0, arg_1):
        """
        Return the details of a single course by id - not a course run id.

        Args:
            course_id (str): The unique id for the course in question.

        Returns:
            dict: Details of the course in question.

        """
        return arg_0._load_data(
            arg_0.COURSES_ENDPOINT,
            resource_id=arg_1,
            many=False
        )

Return the details of a single course by id - not a course run id .