def Func ( arg_0 , arg_1 , arg_2 = 3 , arg_3 = True ) : assert arg_2 >= 1 arg_1 = arg_1 . strip ( os . extsep ) arg_4 = list ( ) for arg_5 in range ( 1 , arg_2 + 1 ) : arg_6 = os . path . sep . join ( [ "*" ] * arg_5 ) arg_7 = os . path . join ( arg_0 , os . extsep . join ( [ arg_6 , arg_1 ] ) ) arg_4 += glob . glob ( arg_7 ) if arg_3 : arg_4 . sort ( ) return arg_4

def Func(arg_0, arg_1, arg_2=3, arg_3=True):
    """Naive depth-search into a directory for files with a given extension.

    Parameters
    ----------
    in_dir : str
        Path to search.
    ext : str
        File extension to match.
    depth : int
        Depth of directories to search.
    sort : bool
        Sort the list alphabetically

    Returns
    -------
    matched : list
        Collection of matching file paths.

    Examples
    --------
    >>> jams.util.Func('Audio', 'wav')
    ['Audio/LizNelson_Rainfall/LizNelson_Rainfall_MIX.wav',
     'Audio/LizNelson_Rainfall/LizNelson_Rainfall_RAW/LizNelson_Rainfall_RAW_01_01.wav',
     'Audio/LizNelson_Rainfall/LizNelson_Rainfall_RAW/LizNelson_Rainfall_RAW_02_01.wav',
     ...
     'Audio/Phoenix_ScotchMorris/Phoenix_ScotchMorris_STEMS/Phoenix_ScotchMorris_STEM_02.wav',
     'Audio/Phoenix_ScotchMorris/Phoenix_ScotchMorris_STEMS/Phoenix_ScotchMorris_STEM_03.wav',
    'Audio/Phoenix_ScotchMorris/Phoenix_ScotchMorris_STEMS/Phoenix_ScotchMorris_STEM_04.wav']

    """
    assert arg_2 >= 1
    arg_1 = arg_1.strip(os.extsep)
    arg_4 = list()
    for arg_5 in range(1, arg_2+1):
        arg_6 = os.path.sep.join(["*"]*arg_5)
        arg_7 = os.path.join(arg_0, os.extsep.join([arg_6, arg_1]))
        arg_4 += glob.glob(arg_7)

    if arg_3:
        arg_4.sort()
    return arg_4

Naive depth-search into a directory for files with a given extension.

    Parameters
    ----------
    in_dir : str
        Path to search.
    ext : str
        File extension to match.
    depth : int
        Depth of directories to search.
    sort : bool
        Sort the list alphabetically

    Returns
    -------
    matched : list
        Collection of matching file paths.

    Examples
    --------
    >>> jams.util.find_with_extension('Audio', 'wav')
    ['Audio/LizNelson_Rainfall/LizNelson_Rainfall_MIX.wav',
     'Audio/LizNelson_Rainfall/LizNelson_Rainfall_RAW/LizNelson_Rainfall_RAW_01_01.wav',
     'Audio/LizNelson_Rainfall/LizNelson_Rainfall_RAW/LizNelson_Rainfall_RAW_02_01.wav',
     ...
     'Audio/Phoenix_ScotchMorris/Phoenix_ScotchMorris_STEMS/Phoenix_ScotchMorris_STEM_02.wav',
     'Audio/Phoenix_ScotchMorris/Phoenix_ScotchMorris_STEMS/Phoenix_ScotchMorris_STEM_03.wav',
    'Audio/Phoenix_ScotchMorris/Phoenix_ScotchMorris_STEMS/Phoenix_ScotchMorris_STEM_04.wav']

Naive depth - search into a directory for files with a given extension .


def Func ( arg_0 ) : arg_1 = [ ] for arg_2 in arg_0 : arg_2 = arg_2 . strip ( ) if len ( arg_2 ) < 1 : if len ( arg_1 ) > 0 : yield "\n" . join ( arg_1 ) arg_1 = [ ] else : arg_1 . append ( arg_2 ) if len ( arg_1 ) > 0 : yield "\n" . join ( arg_1 )

def Func (arg_0):
    """
    segment the raw text into paragraphs
    """
    arg_1 = []

    for arg_2 in arg_0:
        arg_2 = arg_2.strip()

        if len(arg_2) < 1:
            if len(arg_1) > 0:
                yield "\n".join(arg_1)
                arg_1 = []
        else:
            arg_1.append(arg_2)

    if len(arg_1) > 0:
        yield "\n".join(arg_1)


(
    app: web.Application, module=None, url_prefix: str=None, name_prefix: str=None
)

def Func(
    arg_0: arg_1.Application, arg_3=None, arg_4: arg_5=None, arg_6: arg_5=None
):
    """Context manager which yields a function for adding multiple routes from a given module.

    Example:

    .. code-block:: python

        # myapp/articles/views.py
        async def list_articles(request):
            return web.Response(b'article list...')

        async def create_article(request):
            return web.Response(b'created article...')

    .. code-block:: python

        # myapp/app.py
        from myapp.articles import views

        with Func(app, url_prefix='/api/', name_prefix='articles') as route:
            route('GET', '/articles/', views.list_articles)
            route('POST', '/articles/', views.create_article)

        app.router['articles.list_articles'].url()  # /api/articles/

    If you prefer, you can also pass module and handler names as strings.

    .. code-block:: python

        with Func(app, module='myapp.articles.views',
                               url_prefix='/api/', name_prefix='articles') as route:
            route('GET', '/articles/', 'list_articles')
            route('POST', '/articles/', 'create_article')

    :param app: Application to add routes to.
    :param module: Import path to module (str) or module object which contains the handlers.
    :param url_prefix: Prefix to prepend to all route paths.
    :param name_prefix: Prefix to prepend to all route names.
    """
    if isinstance(arg_3, (arg_5, bytes)):
        arg_3 = importlib.import_module(arg_3)

    def add_route(arg_7, arg_8, arg_9, arg_10=None):
        """
        :param str method: HTTP method.
        :param str path: Path for the route.
        :param handler: A handler function or a name of a handler function contained
            in `module`.
        :param str name: Name for the route. If `None`, defaults to the handler's
            function name.
        """
        if isinstance(arg_9, (arg_5, bytes)):
            if not arg_3:
                raise ValueError(
                    'Must pass module to Func if passing handler name strings.'
                )
            arg_10 = arg_10 or arg_9
            arg_9 = getattr(arg_3, arg_9)
        else:
            arg_10 = arg_10 or arg_9.__name__
        arg_8 = make_path(arg_8, arg_4)
        arg_10 = '.'.join((arg_6, arg_10)) if arg_6 else arg_10
        return arg_0.router.add_route(arg_7, arg_8, arg_9, arg_10=arg_10)
    yield add_route

Context manager which yields a function for adding multiple routes from a given module.

    Example:

    .. code-block:: python

        # myapp/articles/views.py
        async def list_articles(request):
            return web.Response(b'article list...')

        async def create_article(request):
            return web.Response(b'created article...')

    .. code-block:: python

        # myapp/app.py
        from myapp.articles import views

        with add_route_context(app, url_prefix='/api/', name_prefix='articles') as route:
            route('GET', '/articles/', views.list_articles)
            route('POST', '/articles/', views.create_article)

        app.router['articles.list_articles'].url()  # /api/articles/

    If you prefer, you can also pass module and handler names as strings.

    .. code-block:: python

        with add_route_context(app, module='myapp.articles.views',
                               url_prefix='/api/', name_prefix='articles') as route:
            route('GET', '/articles/', 'list_articles')
            route('POST', '/articles/', 'create_article')

    :param app: Application to add routes to.
    :param module: Import path to module (str) or module object which contains the handlers.
    :param url_prefix: Prefix to prepend to all route paths.
    :param name_prefix: Prefix to prepend to all route names.

Context manager which yields a function for adding multiple routes from a given module .


(data_list, stats_to_calculate=['mean', 'std'], percentiles_to_calculate=[])

def Func(arg_0, arg_1=['mean', 'std'], arg_2=[]):
  """
  Calculate statistics for given data.

  :param list data_list: List of floats
  :param list stats_to_calculate: List of strings with statistics to calculate. Supported stats are defined in constant stats_to_numpy_method_map
  :param list percentiles_to_calculate: List of floats that defined which percentiles to calculate.
  :return: tuple of dictionaries containing calculated statistics and percentiles
  """
  arg_3 = {
      'mean': numpy.mean,
      'avg': numpy.mean,
      'std': numpy.std,
      'standard_deviation': numpy.std,
      'median': numpy.median,
      'min': numpy.amin,
      'max': numpy.amax
  }
  arg_4 = {}
  arg_5 = {}
  if len(arg_0) == 0:
    return arg_4, arg_5
  for arg_6 in arg_1:
    if arg_6 in arg_3.keys():
      arg_4[arg_6] = arg_3[arg_6](arg_0)
    else:
      logger.error("Unsupported stat : " + str(arg_6))
  for arg_7 in arg_2:
    if isinstance(arg_7, float) or isinstance(arg_7, int):
      arg_5[arg_7] = numpy.percentile(arg_0, arg_7)
    else:
      logger.error("Unsupported percentile requested (should be int or float): " + str(arg_7))
  return arg_4, arg_5


def Func ( arg_0 , arg_1 ) : if not isinstance ( arg_1 , OctaveUserClass ) or not arg_1 . _attrs : return dict ( ) arg_2 = [ ] arg_3 = [ ] for arg_4 in arg_1 . _attrs : arg_2 . append ( ( str ( arg_4 ) , object ) ) arg_3 . append ( getattr ( arg_1 , arg_4 ) ) arg_5 = np . array ( [ tuple ( arg_3 ) ] , arg_2 ) return MatlabObject ( arg_5 , arg_1 . _name )

def Func(arg_0, arg_1):
        """Convert to a value to send to Octave."""
        if not isinstance(arg_1, OctaveUserClass) or not arg_1._attrs:
            return dict()
        # Bootstrap a MatlabObject from scipy.io
        # From https://github.com/scipy/scipy/blob/93a0ea9e5d4aba1f661b6bb0e18f9c2d1fce436a/scipy/io/matlab/mio5.py#L435-L443
        # and https://github.com/scipy/scipy/blob/93a0ea9e5d4aba1f661b6bb0e18f9c2d1fce436a/scipy/io/matlab/mio5_params.py#L224
        arg_2 = []
        arg_3 = []
        for arg_4 in arg_1._attrs:
            arg_2.append((str(arg_4), object))
            arg_3.append(getattr(arg_1, arg_4))
        arg_5 = np.array([tuple(arg_3)], arg_2)
        return MatlabObject(arg_5, arg_1._name)


def Func ( arg_0 ) : def _ ( * arg_1 , ** arg_2 ) : arg_3 = getattr ( settings , 'TEMPLATE_DEBUG' , False ) return arg_0 ( * arg_1 , ** arg_2 ) if arg_3 else '' return _

def Func(arg_0):
    """Decorated function is a no-op if TEMPLATE_DEBUG is False"""
    def _(*arg_1, **arg_2):
        arg_3 = getattr(settings, 'TEMPLATE_DEBUG', False)
        return arg_0(*arg_1, **arg_2) if arg_3 else ''
    return _

Decorated function is a no - op if TEMPLATE_DEBUG is False


return requests.get(self._url, data=self._data, headers=self._headers, auth=(self._email, self._api_token))

def Func ( arg_0 ) : return requests . get ( arg_0 . _url , data = arg_0 . _data , headers = arg_0 . _headers , auth = ( arg_0 . _email , arg_0 . _api_token ) )

def Func(arg_0):
        """
        HTTP Get Request
        """
        return requests.get(arg_0._url, data=arg_0._data, headers=arg_0._headers, auth=(arg_0._email, arg_0._api_token))


def
Func
(
arg_0
,
arg_1
=
)
:
arg_2
=
arg_0
.
_query_queued
(
'COUNT(*) AS count'
,
arg_1
=
arg_1
)
return
arg_2
[
0
]
.
count

def Func(arg_0, arg_1=None):
        """ Return an approximate number of queued tasks in the queue. """
        arg_2 = arg_0._query_queued('COUNT(*) AS count', arg_1=arg_1)
        return arg_2[0].count

Return an approximate number of queued tasks in the queue .


return nx.relabel_nodes(nx.DiGraph(results),
                                {idx: i for idx, i in enumerate(data.columns)})

def Func ( arg_0 , arg_1 , arg_2 ) : arg_0 . arguments [ '{VERBOSE}' ] = str ( arg_0 . verbose ) . upper ( ) arg_0 . arguments [ '{SCORE}' ] = arg_0 . score arg_0 . arguments [ '{BETA}' ] = str ( arg_0 . beta ) arg_0 . arguments [ '{OPTIM}' ] = str ( arg_0 . optim ) . upper ( ) arg_0 . arguments [ '{ALPHA}' ] = str ( arg_0 . alpha ) arg_4 = DataFrame ( list ( nx . edges ( arg_2 ) ) , columns = [ "from" , "to" ] ) arg_5 = DataFrame ( list ( nx . edges ( nx . DiGraph ( DataFrame ( - nx . adj_matrix ( arg_2 , weight = None ) . to_dense ( ) + 1 , columns = list ( arg_2 . nodes ( ) ) , index = list ( arg_2 . nodes ( ) ) ) ) ) ) , columns = [ "from" , "to" ] ) arg_6 = arg_0 . _run_bnlearn ( arg_1 , arg_4 = arg_4 , arg_5 = arg_5 , verbose = arg_0 . verbose ) return nx . relabel_nodes ( nx . DiGraph ( arg_6 ) , { arg_7 : arg_8 for arg_7 , arg_8 in enumerate ( arg_1 . columns ) } )

def Func(arg_0, arg_1, arg_2):
        """Run the algorithm on an undirected graph.

        Args:
            data (pandas.DataFrame): DataFrame containing the data
            graph (networkx.Graph): Skeleton of the graph to orient

        Returns:
            networkx.DiGraph: Solution on the given skeleton.

        """
        # Building setup w/ arguments.
        arg_0.arguments['{VERBOSE}'] = str(arg_0.verbose).upper()
        arg_0.arguments['{SCORE}'] = arg_0.score
        arg_0.arguments['{BETA}'] = str(arg_0.beta)
        arg_0.arguments['{OPTIM}'] = str(arg_0.optim).upper()
        arg_0.arguments['{ALPHA}'] = str(arg_0.alpha)

        arg_4 = DataFrame(list(nx.edges(arg_2)), columns=["from", "to"])
        arg_5 = DataFrame(list(nx.edges(nx.DiGraph(DataFrame(-nx.adj_matrix(arg_2, weight=None).to_dense() + 1,
                                                                 columns=list(arg_2.nodes()),
                                                                 index=list(arg_2.nodes()))))), columns=["from", "to"])
        arg_6 = arg_0._run_bnlearn(arg_1, arg_4=arg_4,
                                   arg_5=arg_5, verbose=arg_0.verbose)

        return nx.relabel_nodes(nx.DiGraph(arg_6),
                                {arg_7: arg_8 for arg_7, arg_8 in enumerate(arg_1.columns)})

Run the algorithm on an undirected graph .


return self._make_response(nonce, salt, iteration_count)

def
Func
(
arg_0
,
Func
)
:
if
not
Func
:
logger
.
debug
(
"Empty challenge"
)
return
Failure
(
"bad-challenge"
)
if
arg_0
.
_server_first_message
:
return
arg_0
.
_final_challenge
(
Func
)
arg_2
=
SERVER_FIRST_MESSAGE_RE
.
match
(
Func
)
if
not
arg_2
:
logger
.
debug
(
"Bad challenge syntax: {0!r}"
.
format
(
Func
)
)
return
Failure
(
"bad-challenge"
)
arg_0
.
_server_first_message
=
Func
arg_4
=
arg_2
.
group
(
"mext"
)
if
arg_4
:
logger
.
debug
(
"Unsupported extension received: {0!r}"
.
format
(
arg_4
)
)
return
Failure
(
"bad-challenge"
)
arg_5
=
arg_2
.
group
(
"nonce"
)
if
not
arg_5
.
startswith
(
arg_0
.
_c_nonce
)
:
logger
.
debug
(
"Nonce does not start with our nonce"
)
return
Failure
(
"bad-challenge"
)
arg_6
=
arg_2
.
group
(
"salt"
)
try
:
arg_6
=
a2b_base64
(
arg_6
)
except
ValueError
:
logger
.
debug
(
"Bad base64 encoding for salt: {0!r}"
.
format
(
arg_6
)
)
return
Failure
(
"bad-challenge"
)
arg_7
=
arg_2
.
group
(
"iteration_count"
)
try
:
arg_7
=
int
(
arg_7
)
except
ValueError
:
logger
.
debug
(
"Bad iteration_count: {0!r}"
.
format
(
arg_7
)
)
return
Failure
(
"bad-challenge"
)
return
arg_0
.
_make_response
(
arg_5
,
arg_6
,
arg_7
)

def Func(arg_0, Func):
        """Process a challenge and return the response.

        :Parameters:
            - `challenge`: the challenge from server.
        :Types:
            - `challenge`: `bytes`

        :return: the response or a failure indicator.
        :returntype: `sasl.Response` or `sasl.Failure`
        """
        # pylint: disable=R0911
        if not Func:
            logger.debug("Empty challenge")
            return Failure("bad-challenge")

        if arg_0._server_first_message:
            return arg_0._final_challenge(Func)

        arg_2 = SERVER_FIRST_MESSAGE_RE.match(Func)
        if not arg_2:
            logger.debug("Bad challenge syntax: {0!r}".format(Func))
            return Failure("bad-challenge")

        arg_0._server_first_message = Func

        arg_4 = arg_2.group("mext")
        if arg_4:
            logger.debug("Unsupported extension received: {0!r}".format(arg_4))
            return Failure("bad-challenge")

        arg_5 = arg_2.group("nonce")
        if not arg_5.startswith(arg_0._c_nonce):
            logger.debug("Nonce does not start with our nonce")
            return Failure("bad-challenge")

        arg_6 = arg_2.group("salt")
        try:
            arg_6 = a2b_base64(arg_6)
        except ValueError:
            logger.debug("Bad base64 encoding for salt: {0!r}".format(arg_6))
            return Failure("bad-challenge")

        arg_7 = arg_2.group("iteration_count")
        try:
            arg_7 = int(arg_7)
        except ValueError:
            logger.debug("Bad iteration_count: {0!r}".format(arg_7))
            return Failure("bad-challenge")

        return arg_0._make_response(arg_5, arg_6, arg_7)

Process a challenge and return the response .


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

def Func(arg_0, arg_1):
        """
        Jumps short if parity.

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


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_1
.
cursor
(
)
if
arg_0
.
tabledef
is
:
return
if
not
arg_0
.
tabledef
.
startswith
(
'CREATE'
)
:
arg_2
.
execute
(
'CREATE TABLE IF NOT EXISTS %s %s'
%
(
arg_0
.
table
,
arg_0
.
tabledef
)
)
else
:
arg_2
.
execute
(
arg_0
.
tabledef
)
arg_1
.
commit
(
)

def Func(arg_0, arg_1):
        """Make table definitions"""
        # Make cursor
        arg_2 = arg_1.cursor()
        # Drop table if it already exists, to be recreated.  This
        # could in the future abort if table already exists, and not
        # recreate it from scratch.
        #cur.execute('''DROP TABLE IF EXISTS %s'''%self.table)
        #conn.commit()
        if arg_0.tabledef is None:
            return
        if not arg_0.tabledef.startswith('CREATE'):
            # "normal" table creation.
            arg_2.execute('CREATE TABLE IF NOT EXISTS %s %s'
                        % (arg_0.table, arg_0.tabledef)
                        )
        else:
            # When tabledef contains the full CREATE statement (for
            # virtual tables).
            arg_2.execute(arg_0.tabledef)
        arg_1.commit()


(rho, title="", figsize=None, color=None)

def
Func
(
arg_0
,
arg_1
=
""
,
arg_2
=
,
arg_3
=
)
:
if
not
HAS_MATPLOTLIB
:
raise
ImportError
(
'Must have Matplotlib installed.'
)
arg_0
=
_validate_input_state
(
arg_0
)
if
arg_2
is
:
arg_2
=
(
7
,
5
)
arg_4
=
int
(
np
.
log2
(
len
(
arg_0
)
)
)
arg_5
=
list
(
map
(
lambda
x
:
x
.
to_label
(
)
,
pauli_group
(
arg_4
)
)
)
arg_6
=
list
(
map
(
lambda
x
:
np
.
real
(
np
.
trace
(
np
.
dot
(
x
.
to_matrix
(
)
,
arg_0
)
)
)
,
pauli_group
(
arg_4
)
)
)
arg_7
=
len
(
arg_6
)
if
arg_3
is
:
arg_3
=
"#648fff"
arg_8
=
np
.
arange
(
arg_7
)
arg_9
=
0.5
arg_10
,
arg_11
=
plt
.
subplots
(
arg_2
=
arg_2
)
arg_11
.
grid
(
zorder
=
0
,
linewidth
=
1
,
linestyle
=
'--'
)
arg_11
.
bar
(
arg_8
,
arg_6
,
arg_9
,
arg_3
=
arg_3
,
zorder
=
2
)
arg_11
.
axhline
(
linewidth
=
1
,
arg_3
=
'k'
)
arg_11
.
set_ylabel
(
'Expectation value'
,
fontsize
=
14
)
arg_11
.
set_xticks
(
arg_8
)
arg_11
.
set_yticks
(
[
1
,
0.5
,
0
,
0.5
,
1
]
)
arg_11
.
set_xticklabels
(
arg_5
,
fontsize
=
14
,
rotation
=
70
)
arg_11
.
set_xlabel
(
'Pauli'
,
fontsize
=
14
)
arg_11
.
set_ylim
(
[
1
,
1
]
)
arg_11
.
set_facecolor
(
'#eeeeee'
)
for
arg_12
in
arg_11
.
xaxis
.
get_major_ticks
(
)
+
arg_11
.
yaxis
.
get_major_ticks
(
)
:
arg_12
.
label
.
set_fontsize
(
14
)
arg_11
.
set_title
(
arg_1
,
fontsize
=
16
)
plt
.
close
(
arg_10
)
return
arg_10

def Func(arg_0, arg_1="", arg_2=None, arg_3=None):
    """Plot the paulivec representation of a quantum state.

    Plot a bargraph of the mixed state rho over the pauli matrices

    Args:
        rho (ndarray): Numpy array for state vector or density matrix
        title (str): a string that represents the plot title
        figsize (tuple): Figure size in inches.
        color (list or str): Color of the expectation value bars.
    Returns:
         matplotlib.Figure: The matplotlib.Figure of the visualization
    Raises:
        ImportError: Requires matplotlib.
    """
    if not HAS_MATPLOTLIB:
        raise ImportError('Must have Matplotlib installed.')
    arg_0 = _validate_input_state(arg_0)
    if arg_2 is None:
        arg_2 = (7, 5)
    arg_4 = int(np.log2(len(arg_0)))
    arg_5 = list(map(lambda x: x.to_label(), pauli_group(arg_4)))
    arg_6 = list(map(lambda x: np.real(np.trace(np.dot(x.to_matrix(), arg_0))),
                      pauli_group(arg_4)))
    arg_7 = len(arg_6)
    if arg_3 is None:
        arg_3 = "#648fff"

    arg_8 = np.arange(arg_7)  # the x locations for the groups
    arg_9 = 0.5  # the width of the bars
    arg_10, arg_11 = plt.subplots(arg_2=arg_2)
    arg_11.grid(zorder=0, linewidth=1, linestyle='--')
    arg_11.bar(arg_8, arg_6, arg_9, arg_3=arg_3, zorder=2)
    arg_11.axhline(linewidth=1, arg_3='k')
    # add some text for labels, title, and axes ticks
    arg_11.set_ylabel('Expectation value', fontsize=14)
    arg_11.set_xticks(arg_8)
    arg_11.set_yticks([-1, -0.5, 0, 0.5, 1])
    arg_11.set_xticklabels(arg_5, fontsize=14, rotation=70)
    arg_11.set_xlabel('Pauli', fontsize=14)
    arg_11.set_ylim([-1, 1])
    arg_11.set_facecolor('#eeeeee')
    for arg_12 in arg_11.xaxis.get_major_ticks()+arg_11.yaxis.get_major_ticks():
        arg_12.label.set_fontsize(14)
    arg_11.set_title(arg_1, fontsize=16)
    plt.close(arg_10)
    return arg_10

Plot the paulivec representation of a quantum state .


def Func(arg_0, arg_1):
        """Asserts that val is string or iterable and starts with prefix."""
        if arg_1 is None:
            raise TypeError('given prefix arg must not be none')
        if isinstance(arg_0.val, str_types):
            if not isinstance(arg_1, str_types):
                raise TypeError('given prefix arg must be a string')
            if len(arg_1) == 0:
                raise ValueError('given prefix arg must not be empty')
            if not arg_0.val.startswith(arg_1):
                arg_0._err('Expected <%s> to start with <%s>, but did not.' % (arg_0.val, arg_1))
        elif isinstance(arg_0.val, Iterable):
            if len(arg_0.val) == 0:
                raise ValueError('val must not be empty')
            arg_2 = next(iter(arg_0.val))
            if arg_2 != arg_1:
                arg_0._err('Expected %s to start with <%s>, but did not.' % (arg_0.val, arg_1))
        else:
            raise TypeError('val is not a string or iterable')
        return arg_0

Asserts that val is string or iterable and starts with prefix .


async
def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
logging
.
getLogger
(
__name__
)
async
with
arg_1
.
get
(
arg_0
)
as
response
:
arg_2
.
info
(
'Downloading %r'
,
arg_0
)
return
await
response
.
text
(
)

async def Func(arg_0, arg_1):
    """Asynchronously request a URL and get the encoded text content of the
    body.

    Parameters
    ----------
    url : `str`
        URL to download.
    session : `aiohttp.ClientSession`
        An open aiohttp session.

    Returns
    -------
    content : `str`
        Content downloaded from the URL.
    """
    arg_2 = logging.getLogger(__name__)
    async with arg_1.get(arg_0) as response:
        # aiohttp decodes the content to a Python string
        arg_2.info('Downloading %r', arg_0)
        return await response.text()

Asynchronously request a URL and get the encoded text content of the body .


(df, *, column: str, decimals: int, new_column: str = None)

def Func(arg_0, *, arg_1: arg_2, arg_3: arg_4, arg_5: arg_2 = None):
    """
    Round each value of a column

    ---

    ### Parameters

    *mandatory :*
    - `column` (*str*): name of the column to round
    - `decimals` (*int*): number of decimal to keeep

    *optional :*
    - `new_column` (*str*): name of the new column to create.
      By default, no new column will be created and `column` will be replaced

    ---

    ### Example

    ** Input**

    ENTITY|VALUE_1|VALUE_2
    :-----:|:-----:|:-----:
    A|-1.512|-1.504
    A|0.432|0.14

    ```cson
    Func:
      column: 'VALUE_1'
      decimals:1
      new_column: 'Pika'
    ```

    **Output**

    ENTITY|VALUE_1|VALUE_2|Pika
    :-----:|:-----:|:-----:|:-----:
    A|-1.512|-1.504|-1.5
    A|0.432|0.14|0.4
    """
    arg_5 = arg_5 or arg_1
    arg_0[arg_5] = arg_0[arg_1].round(arg_3)
    return arg_0

Round each value of a column

    ---

    ### Parameters

    *mandatory :*
    - `column` (*str*): name of the column to round
    - `decimals` (*int*): number of decimal to keeep

    *optional :*
    - `new_column` (*str*): name of the new column to create.
      By default, no new column will be created and `column` will be replaced

    ---

    ### Example

    ** Input**

    ENTITY|VALUE_1|VALUE_2
    :-----:|:-----:|:-----:
    A|-1.512|-1.504
    A|0.432|0.14

    ```cson
    round_values:
      column: 'VALUE_1'
      decimals:1
      new_column: 'Pika'
    ```

    **Output**

    ENTITY|VALUE_1|VALUE_2|Pika
    :-----:|:-----:|:-----:|:-----:
    A|-1.512|-1.504|-1.5
    A|0.432|0.14|0.4


def Func ( arg_0 , arg_1 ) : if arg_0 . buff : return arg_0 . buff elif arg_0 . multifile : return arg_0 . file_root + "_%03d" % arg_1 + arg_0 . file_ext else : return arg_0 . filename

def Func(arg_0, arg_1):
        """
        If filename was used output a filename, along with multifile
        numbered filenames will be used.

        If buff was specified it is returned.

        :return: Output buff or filename.
        """
        if arg_0.buff:
            return arg_0.buff
        elif arg_0.multifile:
            return arg_0.file_root + "_%03d" % arg_1 + arg_0.file_ext
        else:
            return arg_0.filename

If filename was used output a filename along with multifile numbered filenames will be used .


(
            self, secret_resource_name, secret_value_resource_name, name, value=None, custom_headers=None, raw=False, **operation_config)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
=
,
arg_5
=
,
arg_6
=
False
,
**
arg_7
)
:
arg_8
=
models
.
SecretValueResourceDescription
(
arg_3
=
arg_3
,
arg_4
=
arg_4
)
arg_9
=
arg_0
.
Func
.
metadata
[
'url'
]
arg_10
=
{
'secretResourceName'
:
arg_0
.
_serialize
.
url
(
"secret_resource_name"
,
arg_1
,
'str'
,
skip_quote
=
True
)
,
'secretValueResourceName'
:
arg_0
.
_serialize
.
url
(
"secret_value_resource_name"
,
arg_2
,
'str'
,
skip_quote
=
True
)
}
arg_9
=
arg_0
.
_client
.
format_url
(
arg_9
,
**
arg_10
)
arg_11
=
{
}
arg_11
[
'api-version'
]
=
arg_0
.
_serialize
.
query
(
"self.api_version"
,
arg_0
.
api_version
,
'str'
)
arg_12
=
{
}
arg_12
[
'Accept'
]
=
'application/json'
arg_12
[
'Content-Type'
]
=
'application/json; charset=utf-8'
if
arg_5
:
arg_12
.
update
(
arg_5
)
arg_13
=
arg_0
.
_serialize
.
body
(
arg_8
,
'SecretValueResourceDescription'
)
arg_14
=
arg_0
.
_client
.
put
(
arg_9
,
arg_11
,
arg_12
,
arg_13
)
arg_15
=
arg_0
.
_client
.
send
(
arg_14
,
stream
=
False
,
**
arg_7
)
if
arg_15
.
status_code
not
in
[
200
,
201
,
202
]
:
raise
models
.
FabricErrorException
(
arg_0
.
_deserialize
,
arg_15
)
arg_16
=
if
arg_15
.
status_code
==
200
:
arg_16
=
arg_0
.
_deserialize
(
'SecretValueResourceDescription'
,
arg_15
)
if
arg_15
.
status_code
==
201
:
arg_16
=
arg_0
.
_deserialize
(
'SecretValueResourceDescription'
,
arg_15
)
if
arg_6
:
arg_17
=
ClientRawResponse
(
arg_16
,
arg_15
)
return
arg_17
return
arg_16

def Func(
            arg_0, arg_1, arg_2, arg_3, arg_4=None, arg_5=None, arg_6=False, **arg_7):
        """Adds the specified value as a new version of the specified secret
        resource.

        Creates a new value of the specified secret resource. The name of the
        value is typically the version identifier. Once created the value
        cannot be changed.

        :param secret_resource_name: The name of the secret resource.
        :type secret_resource_name: str
        :param secret_value_resource_name: The name of the secret resource
         value which is typically the version identifier for the value.
        :type secret_value_resource_name: str
        :param name: Version identifier of the secret value.
        :type name: str
        :param value: The actual value of the secret.
        :type value: str
        :param dict custom_headers: headers that will be added to the request
        :param bool raw: returns the direct response alongside the
         deserialized response
        :param operation_config: :ref:`Operation configuration
         overrides<msrest:optionsforoperations>`.
        :return: SecretValueResourceDescription or ClientRawResponse if
         raw=true
        :rtype: ~azure.servicefabric.models.SecretValueResourceDescription or
         ~msrest.pipeline.ClientRawResponse
        :raises:
         :class:`FabricErrorException<azure.servicefabric.models.FabricErrorException>`
        """
        arg_8 = models.SecretValueResourceDescription(arg_3=arg_3, arg_4=arg_4)

        # Construct URL
        arg_9 = arg_0.Func.metadata['url']
        arg_10 = {
            'secretResourceName': arg_0._serialize.url("secret_resource_name", arg_1, 'str', skip_quote=True),
            'secretValueResourceName': arg_0._serialize.url("secret_value_resource_name", arg_2, 'str', skip_quote=True)
        }
        arg_9 = arg_0._client.format_url(arg_9, **arg_10)

        # Construct parameters
        arg_11 = {}
        arg_11['api-version'] = arg_0._serialize.query("self.api_version", arg_0.api_version, 'str')

        # Construct headers
        arg_12 = {}
        arg_12['Accept'] = 'application/json'
        arg_12['Content-Type'] = 'application/json; charset=utf-8'
        if arg_5:
            arg_12.update(arg_5)

        # Construct body
        arg_13 = arg_0._serialize.body(arg_8, 'SecretValueResourceDescription')

        # Construct and send request
        arg_14 = arg_0._client.put(arg_9, arg_11, arg_12, arg_13)
        arg_15 = arg_0._client.send(arg_14, stream=False, **arg_7)

        if arg_15.status_code not in [200, 201, 202]:
            raise models.FabricErrorException(arg_0._deserialize, arg_15)

        arg_16 = None

        if arg_15.status_code == 200:
            arg_16 = arg_0._deserialize('SecretValueResourceDescription', arg_15)
        if arg_15.status_code == 201:
            arg_16 = arg_0._deserialize('SecretValueResourceDescription', arg_15)

        if arg_6:
            arg_17 = ClientRawResponse(arg_16, arg_15)
            return arg_17

        return arg_16

Adds the specified value as a new version of the specified secret resource .


def
Func
(
)
:
arg_0
=
IBMQ
.
backends
(
)
arg_1
=
[
]
arg_2
=
[
]
for
arg_3
in
arg_0
:
if
arg_3
.
name
(
)
not
in
arg_2
and
not
arg_3
.
configuration
(
)
.
simulator
:
arg_1
.
append
(
arg_3
)
arg_2
.
append
(
arg_3
.
name
(
)
)
if
not
arg_1
:
raise
QiskitError
(
'No backends available.'
)
return
arg_1

def Func():
    """Gets the unique backends that are available.

    Returns:
        list: Unique available backends.

    Raises:
        QiskitError: No backends available.
    """
    arg_0 = IBMQ.backends()
    arg_1 = []
    arg_2 = []
    for arg_3 in arg_0:
        if arg_3.name() not in arg_2 and not arg_3.configuration().simulator:
            arg_1.append(arg_3)
            arg_2.append(arg_3.name())
    if not arg_1:
        raise QiskitError('No backends available.')
    return arg_1

Gets the unique backends that are available .


def
Func
(
arg_0
,
arg_1
)
:
from
numpy_sugar
.
linalg
import
Func
as
_Func
try
:
arg_2
=
_Func
(
arg_0
,
arg_1
)
except
LinAlgError
:
arg_3
=
"Could not converge to solve Ax=y."
arg_3
+=
" Setting x to zero."
warnings
.
warn
(
arg_3
,
RuntimeWarning
)
arg_2
=
zeros
(
arg_0
.
shape
[
0
]
)
return
arg_2

def Func(arg_0, arg_1):
    """
    Robust solve Ax=y.
    """
    from numpy_sugar.linalg import Func as _Func

    try:
        arg_2 = _Func(arg_0, arg_1)
    except LinAlgError:
        arg_3 = "Could not converge to solve Ax=y."
        arg_3 += " Setting x to zero."
        warnings.warn(arg_3, RuntimeWarning)
        arg_2 = zeros(arg_0.shape[0])

    return arg_2


(value_and_gradients_function, val_left, val_right, val_trial, f_lim,
           active=None)

return _bisect(value_and_gradients_function, bisect_args, f_lim)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
           arg_5=None):
  """Squeezes a bracketing interval containing the minimum.

  Given an interval which brackets a minimum and a point in that interval,
  finds a smaller nested interval which also brackets the minimum. If the
  supplied point does not lie in the bracketing interval, the current interval
  is returned.

  The following description is given in terms of individual points evaluated on
  a line function to be minimized. Note, however, the implementation also
  accepts batches of points allowing to minimize multiple line functions at
  once. See details on the docstring of `value_and_gradients_function` below.

  The requirement of the interval bracketing a minimum is expressed through the
  opposite slope conditions. Assume the left end point is 'a', the right
  end point is 'b', the function to be minimized is 'f' and the derivative is
  'df'. The Func procedure relies on the following conditions being satisfied:

  '''
    f(a) <= f(0) + epsilon   (1)
    df(a) < 0                (2)
    df(b) > 0                (3)
  '''

  In the first condition, epsilon is a small positive constant. The condition
  demands that the function at the left end point be not much bigger than the
  starting point (i.e. 0). This is an easy to satisfy condition because by
  assumption, we are in a direction where the function value is decreasing.
  The second and third conditions together demand that there is at least one
  zero of the derivative in between a and b.

  In addition to the interval, the Func algorithm requires a third point to
  be supplied. Usually, this point would lie within the interval [a, b]. If the
  point is outside this interval, the current interval is returned. If the
  point lies within the interval, the behaviour of the function and derivative
  value at this point is used to squeeze the original interval in a manner that
  preserves the opposite slope conditions.

  For further details of this component, see the procedure U0-U3 on page 123 of
  the [Hager and Zhang (2006)][2] article.

  Note that this function does not explicitly verify whether the opposite slope
  conditions are satisfied for the supplied interval. It is assumed that this
  is so.

  Args:
    value_and_gradients_function: A Python callable that accepts a real scalar
      tensor and returns an object that can be converted to a namedtuple.
      The namedtuple should have fields 'f' and 'df' that correspond to scalar
      tensors of real dtype containing the value of the function and its
      derivative at that point. The other namedtuple fields, if present,
      should be tensors or sequences (possibly nested) of tensors.
      In usual optimization application, this function would be generated by
      projecting the multivariate objective function along some specific
      direction. The direction is determined by some other procedure but should
      be a descent direction (i.e. the derivative of the projected univariate
      function must be negative at 0.).
      Alternatively, the function may represent the batching of `n` such line
      functions (e.g. projecting a single multivariate objective function along
      `n` distinct directions at once) accepting n points as input, i.e. a
      tensor of shape [n], and the fields 'f' and 'df' in the returned
      namedtuple should each be a tensor of shape [n], with the corresponding
      function values and derivatives at the input points.
    val_left: Return value of value_and_gradients_function at the left
      end point of the bracketing interval (labelles 'a' above).
    val_right: Return value of value_and_gradients_function at the right
      end point of the bracketing interval (labelles 'b' above).
    val_trial: Return value of value_and_gradients_function at the trial point
      to be used to shrink the interval (labelled 'c' above).
    f_lim: real `Tensor` of shape [n]. The function value threshold for
      the approximate Wolfe conditions to be checked for each batch member.
    active: optional boolean `Tensor` of shape [n]. Relevant in batching mode
      only, indicates batch members on which the Func procedure should be
      applied. On non-active members the current left/right interval is returned
      unmodified.

  Returns:
    A namedtuple containing the following fields:
      iteration: An int32 scalar `Tensor`. The number of iterations performed
        by the bisect algorithm.
      stopped: A boolean `Tensor` of shape [n]. True for those batch members
        where the bisection algorithm terminated.
      failed: A boolean `Tensor` of shape [n]. True for those batch members
        where an error was encountered.
      num_evals: An int32 scalar `Tensor`. The number of times the objective
        function was evaluated.
      left: Return value of value_and_gradients_function at the Funcd left
        end point of the interval found.
      right: Return value of value_and_gradients_function at the Funcd right
        end point of the interval found.
  """
  # We should only Func if the trial point is within the interval.
  arg_6 = (arg_1.x < arg_3.x) & (arg_3.x < arg_2.x)
  if arg_5 is not None:
    arg_6 = arg_6 & arg_5

  # The new point is a valid left end point if it has negative slope
  # and the value at the point is not too large.
  arg_7 = (arg_3.df < 0) & (arg_3.f <= arg_4)

  # If the trial point has a negative slope but the value at that point
  # is too high, bisect can narrow down an interval between the current left
  # and the trial point.
  arg_8 = arg_6 & (arg_3.df < 0) & (arg_3.f > arg_4)

  # Note that if `~valid_left` it is because either:
  # - the slope at the trial point is positive, so it is a valid right
  #   point, or
  # - the needs_bisect condition is true.
  # In both cases we want to keep the current left and replace right
  # with the trial point.
  arg_9 = val_where(arg_6 & arg_7, arg_3, arg_1)
  arg_10 = val_where(arg_6 & ~arg_7, arg_3, arg_2)

  arg_11 = _IntermediateResult(
      iteration=tf.convert_to_tensor(value=0),
      stopped=~arg_8,
      failed=tf.zeros_like(arg_6),  # i.e. all false.
      num_evals=tf.convert_to_tensor(value=0),
      arg_9=arg_9,
      arg_10=arg_10)
  return _bisect(arg_0, arg_11, arg_4)

Squeezes a bracketing interval containing the minimum.

  Given an interval which brackets a minimum and a point in that interval,
  finds a smaller nested interval which also brackets the minimum. If the
  supplied point does not lie in the bracketing interval, the current interval
  is returned.

  The following description is given in terms of individual points evaluated on
  a line function to be minimized. Note, however, the implementation also
  accepts batches of points allowing to minimize multiple line functions at
  once. See details on the docstring of `value_and_gradients_function` below.

  The requirement of the interval bracketing a minimum is expressed through the
  opposite slope conditions. Assume the left end point is 'a', the right
  end point is 'b', the function to be minimized is 'f' and the derivative is
  'df'. The update procedure relies on the following conditions being satisfied:

  '''
    f(a) <= f(0) + epsilon   (1)
    df(a) < 0                (2)
    df(b) > 0                (3)
  '''

  In the first condition, epsilon is a small positive constant. The condition
  demands that the function at the left end point be not much bigger than the
  starting point (i.e. 0). This is an easy to satisfy condition because by
  assumption, we are in a direction where the function value is decreasing.
  The second and third conditions together demand that there is at least one
  zero of the derivative in between a and b.

  In addition to the interval, the update algorithm requires a third point to
  be supplied. Usually, this point would lie within the interval [a, b]. If the
  point is outside this interval, the current interval is returned. If the
  point lies within the interval, the behaviour of the function and derivative
  value at this point is used to squeeze the original interval in a manner that
  preserves the opposite slope conditions.

  For further details of this component, see the procedure U0-U3 on page 123 of
  the [Hager and Zhang (2006)][2] article.

  Note that this function does not explicitly verify whether the opposite slope
  conditions are satisfied for the supplied interval. It is assumed that this
  is so.

  Args:
    value_and_gradients_function: A Python callable that accepts a real scalar
      tensor and returns an object that can be converted to a namedtuple.
      The namedtuple should have fields 'f' and 'df' that correspond to scalar
      tensors of real dtype containing the value of the function and its
      derivative at that point. The other namedtuple fields, if present,
      should be tensors or sequences (possibly nested) of tensors.
      In usual optimization application, this function would be generated by
      projecting the multivariate objective function along some specific
      direction. The direction is determined by some other procedure but should
      be a descent direction (i.e. the derivative of the projected univariate
      function must be negative at 0.).
      Alternatively, the function may represent the batching of `n` such line
      functions (e.g. projecting a single multivariate objective function along
      `n` distinct directions at once) accepting n points as input, i.e. a
      tensor of shape [n], and the fields 'f' and 'df' in the returned
      namedtuple should each be a tensor of shape [n], with the corresponding
      function values and derivatives at the input points.
    val_left: Return value of value_and_gradients_function at the left
      end point of the bracketing interval (labelles 'a' above).
    val_right: Return value of value_and_gradients_function at the right
      end point of the bracketing interval (labelles 'b' above).
    val_trial: Return value of value_and_gradients_function at the trial point
      to be used to shrink the interval (labelled 'c' above).
    f_lim: real `Tensor` of shape [n]. The function value threshold for
      the approximate Wolfe conditions to be checked for each batch member.
    active: optional boolean `Tensor` of shape [n]. Relevant in batching mode
      only, indicates batch members on which the update procedure should be
      applied. On non-active members the current left/right interval is returned
      unmodified.

  Returns:
    A namedtuple containing the following fields:
      iteration: An int32 scalar `Tensor`. The number of iterations performed
        by the bisect algorithm.
      stopped: A boolean `Tensor` of shape [n]. True for those batch members
        where the bisection algorithm terminated.
      failed: A boolean `Tensor` of shape [n]. True for those batch members
        where an error was encountered.
      num_evals: An int32 scalar `Tensor`. The number of times the objective
        function was evaluated.
      left: Return value of value_and_gradients_function at the updated left
        end point of the interval found.
      right: Return value of value_and_gradients_function at the updated right
        end point of the interval found.

Squeezes a bracketing interval containing the minimum .


def Func ( arg_0 , arg_1 = True ) : arg_2 = { } for arg_3 in arg_0 : if arg_3 . value : arg_2 [ arg_3 . key ] = arg_3 . value elif arg_3 . serialized_value : if topology_pb2 . JAVA_SERIALIZED_VALUE == arg_3 . type : arg_5 = _convert_java_value ( arg_3 , arg_1 = arg_1 ) if arg_5 is not None : arg_2 [ arg_3 . key ] = arg_5 else : arg_2 [ arg_3 . key ] = _raw_value ( arg_3 ) return arg_2

def Func(arg_0, arg_1=True):
  """
  converts pb kvs to dict
  """
  arg_2 = {}
  for arg_3 in arg_0:
    if arg_3.value:
      arg_2[arg_3.key] = arg_3.value
    elif arg_3.serialized_value:
      # add serialized_value support for python values (fixme)

      # is this a serialized java object
      if topology_pb2.JAVA_SERIALIZED_VALUE == arg_3.type:
        arg_5 = _convert_java_value(arg_3, arg_1=arg_1)
        if arg_5 is not None:
          arg_2[arg_3.key] = arg_5
      else:
        arg_2[arg_3.key] = _raw_value(arg_3)
  return arg_2


def Func ( arg_0 ) : if arg_0 . _fp + arg_0 . _tn == 0 : return float ( 'NaN' ) return arg_0 . _fp / ( arg_0 . _fp + arg_0 . _tn )

def Func(arg_0):
        r"""Return fall-out.

        Fall-out is defined as :math:`\frac{fp}{fp + tn}`

        AKA false positive rate (FPR)

        Cf. https://en.wikipedia.org/wiki/Information_retrieval#Fall-out

        Returns
        -------
        float
            The fall-out of the confusion table

        Example
        -------
        >>> ct = ConfusionTable(120, 60, 20, 30)
        >>> ct.Func()
        0.25

        """
        if arg_0._fp + arg_0._tn == 0:
            return float('NaN')
        return arg_0._fp / (arg_0._fp + arg_0._tn)

r"""Return fall-out.

        Fall-out is defined as :math:`\frac{fp}{fp + tn}`

        AKA false positive rate (FPR)

        Cf. https://en.wikipedia.org/wiki/Information_retrieval#Fall-out

        Returns
        -------
        float
            The fall-out of the confusion table

        Example
        -------
        >>> ct = ConfusionTable(120, 60, 20, 30)
        >>> ct.fallout()
        0.25


def Func ( arg_0 ) : arg_1 = textwrap . dedent ( getattr ( arg_0 , '__doc__' , '' ) ) if not arg_1 : return None arg_2 = arg_1 . strip ( ) . split ( '\n\n' , 1 ) try : arg_3 = arg_2 [ 1 ] except IndexError : arg_3 = None return Docstring ( arg_2 [ 0 ] , arg_3 )

def Func(arg_0):
    """
    Splits the docstring of the given value into it's summary and body.

    :returns: a 2-tuple of the format ``(summary, body)``
    """
    arg_1 = textwrap.dedent(getattr(arg_0, '__doc__', ''))
    if not arg_1:
        return None

    arg_2 = arg_1.strip().split('\n\n', 1)
    try:
        arg_3 = arg_2[1]
    except IndexError:
        arg_3 = None

    return Docstring(arg_2[0], arg_3)

Splits the docstring of the given value into it s summary and body .


return [
            GithubComponentVersion(
                '', t[0], t[1], self.name, cache_key=_createCacheKey('tag', t[0], t[1], self.name)
            ) for t in self._getTags()
        ]

def Func ( arg_0 ) : return [ GithubComponentVersion ( '' , arg_1 [ 0 ] , arg_1 [ 1 ] , arg_0 . name , cache_key = _createCacheKey ( 'tag' , arg_1 [ 0 ] , arg_1 [ 1 ] , arg_0 . name ) ) for arg_1 in arg_0 . _getTags ( ) ]

def Func(arg_0):
        ''' return a list of GithubComponentVersion objects for all tags
        '''
        return [
            GithubComponentVersion(
                '', arg_1[0], arg_1[1], arg_0.name, cache_key=_createCacheKey('tag', arg_1[0], arg_1[1], arg_0.name)
            ) for arg_1 in arg_0._getTags()
        ]


return ' RETURNING %s' % qn(self.query.model._meta.pk.attname)

def
Func
(
arg_0
)
:
arg_1
=
arg_0
.
connection
.
ops
.
quote_name
return
' RETURNING %s'
%
arg_1
(
arg_0
.
query
.
model
.
_meta
.
pk
.
attname
)

def Func(arg_0):
        """Builds the RETURNING part of the query."""

        arg_1 = arg_0.connection.ops.quote_name
        return ' RETURNING %s' % arg_1(arg_0.query.model._meta.pk.attname)

Builds the RETURNING part of the query .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
False
)
:
arg_3
=
arg_2
and
run_as_root
or
arg_0
.
run
with
arg_0
.
settings
(
hide
(
'running'
,
'stdout'
)
,
warn_only
=
True
)
:
arg_4
=
arg_3
(
'stat -c %%U "%(path)s"'
%
locals
(
)
)
if
arg_4
.
failed
and
'stat: illegal option'
in
arg_4
:
return
arg_3
(
'stat -f %%Su "%(path)s"'
%
locals
(
)
)
return
arg_4

def Func(arg_0, arg_1, arg_2=False):
        """
        Get the owner name of a file or directory.
        """
        arg_3 = arg_2 and run_as_root or arg_0.run
        # I'd prefer to use quiet=True, but that's not supported with older
        # versions of Fabric.
        with arg_0.settings(hide('running', 'stdout'), warn_only=True):
            arg_4 = arg_3('stat -c %%U "%(path)s"' % locals())
            if arg_4.failed and 'stat: illegal option' in arg_4:
                # Try the BSD version of stat
                return arg_3('stat -f %%Su "%(path)s"' % locals())
            return arg_4

Get the owner name of a file or directory .


def Func(arg_0):
    """Wrapper function that first configures logging and starts a single run afterwards."""
    _configure_niceness(arg_0)
    _configure_logging(arg_0)
    arg_1 = arg_0['result_queue']
    arg_2 = _sigint_handling_single_run(arg_0)
    arg_1.put(arg_2)
    arg_1.close()

Wrapper function that first configures logging and starts a single run afterwards .


def Func ( ) : arg_0 = settings . engine with arg_0 . connect ( ) as connection : context . configure ( connection = connection , transaction_per_migration = True , target_metadata = target_metadata , compare_type = COMPARE_TYPE , ) with context . begin_transaction ( ) : context . run_migrations ( )

def Func():
    """Run migrations in 'online' mode.

    In this scenario we need to create an Engine
    and associate a connection with the context.

    """
    arg_0 = settings.engine

    with arg_0.connect() as connection:
        context.configure(
            connection=connection,
            transaction_per_migration=True,
            target_metadata=target_metadata,
            compare_type=COMPARE_TYPE,
        )

        with context.begin_transaction():
            context.run_migrations()


def Func ( arg_0 , arg_1 , arg_2 ) : return os . path . expanduser ( os . path . expandvars ( arg_0 . get ( arg_1 , arg_2 ) ) )

def Func(arg_0, arg_1, arg_2):
          """Return option as an expanded path."""
          return os.path.expanduser(os.path.expandvars(arg_0.get(arg_1, arg_2)))


def Func ( arg_0 , arg_1 , arg_2 = 0.002 , arg_3 = 9 ) : arg_4 = np . arange ( 0.0 , 1.0 , arg_2 ) arg_5 = npdigitize ( arg_0 , arg_4 ) arg_6 , arg_7 = [ ] , [ ] for arg_8 in npunique ( arg_5 ) : arg_9 = arg_5 == arg_8 arg_10 = arg_0 [ arg_9 ] arg_11 = arg_1 [ arg_9 ] if arg_9 . size > arg_3 : arg_6 . append ( npmedian ( arg_10 ) ) arg_7 . append ( npmedian ( arg_11 ) ) return np . array ( arg_6 ) , np . array ( arg_7 )

def Func(arg_0, arg_1, arg_2=0.002, arg_3=9):
    '''
    This bins the phased mag series using the given binsize.

    '''

    arg_4 = np.arange(0.0, 1.0, arg_2)
    arg_5 = npdigitize(arg_0, arg_4)

    arg_6, arg_7 = [], []

    for arg_8 in npunique(arg_5):

        arg_9 = arg_5 == arg_8
        arg_10 = arg_0[arg_9]
        arg_11 = arg_1[arg_9]
        if arg_9.size > arg_3:
            arg_6.append(npmedian(arg_10))
            arg_7.append(npmedian(arg_11))

    return np.array(arg_6), np.array(arg_7)

This bins the phased mag series using the given binsize .


def Func(arg_0, arg_1):
        """ When we get an event from js, lookup the node and invoke the
        action on the enaml node.

        """
        arg_2 = json.loads(arg_1)
        log.debug(f'Update from js: {change}')

        # Lookup the node
        arg_3 = arg_2.get('ref')
        if not arg_3:
            return
        arg_4 = arg_0.viewer.xpath('//*[@ref=$ref]', arg_3=arg_3)
        if not arg_4:
            return  # Unknown node
        arg_5 = arg_4[0]

        # Trigger the change on the enaml node
        if arg_2.get('type') and arg_2.get('name'):
            if arg_2['type'] == 'event':
                arg_6 = getattr(arg_5, arg_2['name'])
                arg_6()
            elif arg_2['type'] == 'update':
                # Trigger the update
                setattr(arg_5, arg_2['name'], arg_2['value'])
        else:
            log.warning(f"Unhandled event {self} {node}: {change}")

When we get an event from js lookup the node and invoke the action on the enaml node .


(self, msg, stuff_to_store, *args, **kwargs)

def Func(arg_0, arg_1, arg_2, *arg_3, **arg_4):
        """ Stores a particular item to disk.

        The storage service always accepts these parameters:

        :param trajectory_name: Name or current trajectory and name of top node in hdf5 file

        :param filename: Name of the hdf5 file

        :param file_title: If file needs to be created, assigns a title to the file.

        The following messages (first argument msg) are understood and the following arguments
        can be provided in combination with the message:

            * :const:`pypet.pypetconstants.PREPARE_MERGE` ('PREPARE_MERGE'):

                Called to prepare a trajectory for merging, see also 'MERGE' below.

                Will also be called if merging cannot happen within the same hdf5 file.
                Stores already enlarged parameters and updates meta information.

                :param stuff_to_Func: Trajectory that is about to be extended by another one

                :param changed_parameters:

                    List containing all parameters that were enlarged due to merging

                :param old_length:

                    Old length of trajectory before merge

            * :const:`pypet.pypetconstants.MERGE` ('MERGE')

                Note that before merging within HDF5 file, the storage service will be called
                with msg='PREPARE_MERGE' before, see above.

                Raises a ValueError if the two trajectories are not Funcd within the very
                same hdf5 file. Then the current trajectory needs to perform the merge slowly
                item by item.

                Merges two trajectories, parameters are:

                :param stuff_to_Func: The trajectory data is merged into

                :param other_trajectory_name: Name of the other trajectory

                :param rename_dict:

                    Dictionary containing the old result and derived parameter names in the
                    other trajectory and their new names in the current trajectory.

                :param move_nodes:

                    Whether to move the nodes from the other to the current trajectory

                :param delete_trajectory:

                    Whether to delete the other trajectory after merging.

            * :const:`pypet.pypetconstants.BACKUP` ('BACKUP')

                :param stuff_to_Func: Trajectory to be backed up

                :param backup_filename:

                    Name of file where to Func the backup. If None the backup file will be in
                    the same folder as your hdf5 file and named 'backup_XXXXX.hdf5'
                    where 'XXXXX' is the name of your current trajectory.

            * :const:`pypet.pypetconstants.TRAJECTORY` ('TRAJECTORY')

                Stores the whole trajectory

                :param stuff_to_Func: The trajectory to be Funcd

                :param only_init:

                    If you just want to initialise the Func. If yes, only meta information about
                    the trajectory is Funcd and none of the nodes/leaves within the trajectory.

                :param Func_data:

                    How to Func data, the following settings are understood:

                     :const:`pypet.pypetconstants.STORE_NOTHING`: (0)

                        Nothing is Funcd

                    :const:`pypet.pypetconstants.STORE_DATA_SKIPPING`: (1)

                        Data of not already Funcd nodes is Funcd

                    :const:`pypet.pypetconstants.STORE_DATA`: (2)

                        Data of all nodes is Funcd. However, existing data on disk is left
                        untouched.

                    :const:`pypet.pypetconstants.OVERWRITE_DATA`: (3)

                        Data of all nodes is Funcd and data on disk is overwritten.
                        May lead to fragmentation of the HDF5 file. The user is adviced
                        to recompress the file manually later on.

            * :const:`pypet.pypetconstants.SINGLE_RUN` ('SINGLE_RUN')

                :param stuff_to_Func: The trajectory

                :param Func_data: How to Func data see above

                :param Func_final: If final meta info should be Funcd

            * :const:`pypet.pypetconstants.LEAF`

                Stores a parameter or result

                Note that everything that is supported by the storage service and that is
                Funcd to disk will be perfectly recovered.
                For instance, you Func a tuple of numpy 32 bit integers, you will get a tuple
                of numpy 32 bit integers after loading independent of the platform!

                :param stuff_to_sore: Result or parameter to Func

                    In order to determine what to Func, the function '_Func' of the parameter or
                    result is called. This function returns a dictionary with name keys and data to
                    Func as values. In order to determine how to Func the data, the storage flags
                    are considered, see below.

                    The function '_Func' has to return a dictionary containing values only from
                    the following objects:

                        * python natives (int, long, str, bool, float, complex),

                        *
                            numpy natives, arrays and matrices of type np.int8-64, np.uint8-64,
                            np.float32-64, np.complex, np.str

                        *

                            python lists and tuples of the previous types
                            (python natives + numpy natives and arrays)
                            Lists and tuples are not allowed to be nested and must be
                            homogeneous, i.e. only contain data of one particular type.
                            Only integers, or only floats, etc.

                        *

                            python dictionaries of the previous types (not nested!), data can be
                            heterogeneous, keys must be strings. For example, one key-value-pair
                            of string and int and one key-value pair of string and float, and so
                            on.

                        * pandas DataFrames_

                        * :class:`~pypet.parameter.ObjectTable`

                    .. _DataFrames: http://pandas.pydata.org/pandas-docs/dev/dsintro.html#dataframe

                    The keys from the '_Func' dictionaries determine how the data will be named
                    in the hdf5 file.

                :param Func_data:

                    How to Func the data, see above for a descitpion.

                :param Func_flags: Flags describing how to Func data.

                        :const:`~pypet.HDF5StorageService.ARRAY` ('ARRAY')

                            Store stuff as array

                        :const:`~pypet.HDF5StorageService.CARRAY` ('CARRAY')

                            Store stuff as carray

                        :const:`~pypet.HDF5StorageService.TABLE` ('TABLE')

                            Store stuff as pytable

                        :const:`~pypet.HDF5StorageService.DICT` ('DICT')

                            Store stuff as pytable but reconstructs it later as dictionary
                            on loading

                        :const:`~pypet.HDF%StorageService.FRAME` ('FRAME')

                            Store stuff as pandas data frame

                    Storage flags can also be provided by the parameters and results themselves
                    if they implement a function '_Func_flags' that returns a dictionary
                    with the names of the data to Func as keys and the flags as values.

                    If no storage flags are provided, they are automatically inferred from the
                    data. See :const:`pypet.HDF5StorageService.TYPE_FLAG_MAPPING` for the mapping
                    from type to flag.

                :param overwrite:

                    Can be used if parts of a leaf should be replaced. Either a list of
                    HDF5 names or `True` if this should account for all.

            * :const:`pypet.pypetconstants.DELETE` ('DELETE')

                Removes an item from disk. Empty group nodes, results and non-explored
                parameters can be removed.

                :param stuff_to_Func: The item to be removed.

                :param delete_only:

                    Potential list of parts of a leaf node that should be deleted.

                :param remove_from_item:

                    If `delete_only` is used, whether deleted nodes should also be erased
                    from the leaf nodes themseleves.

                :param recursive:

                    If you want to delete a group node you can recursively delete all its
                    children.

            * :const:`pypet.pypetconstants.GROUP` ('GROUP')

                :param stuff_to_Func: The group to Func

                :param Func_data: How to Func data

                :param recursive: To recursively load everything below.

                :param max_depth:

                    Maximum depth in case of recursion. `None` for no limit.

            * :const:`pypet.pypetconstants.TREE`

                Stores a single node or a full subtree

                :param stuff_to_Func: Node to Func

                :param Func_data: How to Func data

                :param recursive: Whether to Func recursively the whole sub-tree

                :param max_depth:

                    Maximum depth in case of recursion. `None` for no limit.

            * :const:`pypet.pypetconstants.DELETE_LINK`

                Deletes a link from hard drive

                :param name: The full colon separated name of the link

            * :const:`pypet.pypetconstants.LIST`

                .. _Func-lists:

                Stores several items at once

                :param stuff_to_Func:

                    Iterable whose items are to be Funcd. Iterable must contain tuples,
                    for example `[(msg1,item1,arg1,kwargs1),(msg2,item2,arg2,kwargs2),...]`

            * :const:`pypet.pypetconstants.ACCESS_DATA`

                Requests and manipulates data within the storage.
                Storage must be open.

                :param stuff_to_Func:

                    A colon separated name to the data path

                :param item_name:

                    The name of the data item to interact with

                :param request:

                    A functional request in form of a string

                :param args:

                    Positional arguments passed to the reques

                :param kwargs:

                    Keyword arguments passed to the request

            * :const:`pypet.pypetconstants.OPEN_FILE`

                Opens the HDF5 file and keeps it open

                :param stuff_to_Func: ``None``

            * :const:`pypet.pypetconstants.CLOSE_FILE`

                Closes an HDF5 file that was kept open, must be open before.

                :param stuff_to_Func: ``None``

            * :const:`pypet.pypetconstants.FLUSH`

                Flushes an open file, must be open before.

                :param stuff_to_Func: ``None``

        :raises: NoSuchServiceError if message or data is not understood

        """
        arg_5 = True
        try:

            arg_5 = arg_0._srvc_opening_routine('a', arg_1, arg_4)

            if arg_1 == pypetconstants.MERGE:
                arg_0._trj_merge_trajectories(*arg_3, **arg_4)

            elif arg_1 == pypetconstants.BACKUP:
                arg_0._trj_backup_trajectory(arg_2, *arg_3, **arg_4)

            elif arg_1 == pypetconstants.PREPARE_MERGE:
                arg_0._trj_prepare_merge(arg_2, *arg_3, **arg_4)

            elif arg_1 == pypetconstants.TRAJECTORY:
                arg_0._trj_Func_trajectory(arg_2, *arg_3, **arg_4)

            elif arg_1 == pypetconstants.SINGLE_RUN:
                arg_0._srn_Func_single_run(arg_2, *arg_3, **arg_4)

            elif arg_1 in pypetconstants.LEAF:
                arg_0._prm_Func_parameter_or_result(arg_2, *arg_3, **arg_4)

            elif arg_1 == pypetconstants.DELETE:
                arg_0._all_delete_parameter_or_result_or_group(arg_2, *arg_3, **arg_4)

            elif arg_1 == pypetconstants.GROUP:
                arg_0._grp_Func_group(arg_2, *arg_3, **arg_4)

            elif arg_1 == pypetconstants.TREE:
                arg_0._tree_Func_sub_branch(arg_2, *arg_3, **arg_4)

            elif arg_1 == pypetconstants.DELETE_LINK:
                arg_0._lnk_delete_link(arg_2, *arg_3, **arg_4)

            elif arg_1 == pypetconstants.LIST:
                arg_0._srvc_Func_several_items(arg_2, *arg_3, **arg_4)

            elif arg_1 == pypetconstants.ACCESS_DATA:
                return arg_0._hdf5_interact_with_data(arg_2, *arg_3, **arg_4)

            elif arg_1 == pypetconstants.OPEN_FILE:
                arg_5 = False  # Wee need to keep the file open to allow later interaction
                arg_0._keep_open = True
                arg_0._node_processing_timer.active = False # This might be open quite long
                # so we don't want to display horribly long opening times

            elif arg_1 == pypetconstants.CLOSE_FILE:
                arg_5 = True  # Simply conduct the closing routine afterwards
                arg_0._keep_open = False

            elif arg_1 == pypetconstants.FLUSH:
                arg_0._hdf5file.flush()

            else:
                raise pex.NoSuchServiceError('I do not know how to handle `%s`' % arg_1)

        except:
            arg_0._logger.error('Failed storing `%s`' % str(arg_2))
            raise
        finally:
            arg_0._srvc_closing_routine(arg_5)

Stores a particular item to disk.

        The storage service always accepts these parameters:

        :param trajectory_name: Name or current trajectory and name of top node in hdf5 file

        :param filename: Name of the hdf5 file

        :param file_title: If file needs to be created, assigns a title to the file.

        The following messages (first argument msg) are understood and the following arguments
        can be provided in combination with the message:

            * :const:`pypet.pypetconstants.PREPARE_MERGE` ('PREPARE_MERGE'):

                Called to prepare a trajectory for merging, see also 'MERGE' below.

                Will also be called if merging cannot happen within the same hdf5 file.
                Stores already enlarged parameters and updates meta information.

                :param stuff_to_store: Trajectory that is about to be extended by another one

                :param changed_parameters:

                    List containing all parameters that were enlarged due to merging

                :param old_length:

                    Old length of trajectory before merge

            * :const:`pypet.pypetconstants.MERGE` ('MERGE')

                Note that before merging within HDF5 file, the storage service will be called
                with msg='PREPARE_MERGE' before, see above.

                Raises a ValueError if the two trajectories are not stored within the very
                same hdf5 file. Then the current trajectory needs to perform the merge slowly
                item by item.

                Merges two trajectories, parameters are:

                :param stuff_to_store: The trajectory data is merged into

                :param other_trajectory_name: Name of the other trajectory

                :param rename_dict:

                    Dictionary containing the old result and derived parameter names in the
                    other trajectory and their new names in the current trajectory.

                :param move_nodes:

                    Whether to move the nodes from the other to the current trajectory

                :param delete_trajectory:

                    Whether to delete the other trajectory after merging.

            * :const:`pypet.pypetconstants.BACKUP` ('BACKUP')

                :param stuff_to_store: Trajectory to be backed up

                :param backup_filename:

                    Name of file where to store the backup. If None the backup file will be in
                    the same folder as your hdf5 file and named 'backup_XXXXX.hdf5'
                    where 'XXXXX' is the name of your current trajectory.

            * :const:`pypet.pypetconstants.TRAJECTORY` ('TRAJECTORY')

                Stores the whole trajectory

                :param stuff_to_store: The trajectory to be stored

                :param only_init:

                    If you just want to initialise the store. If yes, only meta information about
                    the trajectory is stored and none of the nodes/leaves within the trajectory.

                :param store_data:

                    How to store data, the following settings are understood:

                     :const:`pypet.pypetconstants.STORE_NOTHING`: (0)

                        Nothing is stored

                    :const:`pypet.pypetconstants.STORE_DATA_SKIPPING`: (1)

                        Data of not already stored nodes is stored

                    :const:`pypet.pypetconstants.STORE_DATA`: (2)

                        Data of all nodes is stored. However, existing data on disk is left
                        untouched.

                    :const:`pypet.pypetconstants.OVERWRITE_DATA`: (3)

                        Data of all nodes is stored and data on disk is overwritten.
                        May lead to fragmentation of the HDF5 file. The user is adviced
                        to recompress the file manually later on.

            * :const:`pypet.pypetconstants.SINGLE_RUN` ('SINGLE_RUN')

                :param stuff_to_store: The trajectory

                :param store_data: How to store data see above

                :param store_final: If final meta info should be stored

            * :const:`pypet.pypetconstants.LEAF`

                Stores a parameter or result

                Note that everything that is supported by the storage service and that is
                stored to disk will be perfectly recovered.
                For instance, you store a tuple of numpy 32 bit integers, you will get a tuple
                of numpy 32 bit integers after loading independent of the platform!

                :param stuff_to_sore: Result or parameter to store

                    In order to determine what to store, the function '_store' of the parameter or
                    result is called. This function returns a dictionary with name keys and data to
                    store as values. In order to determine how to store the data, the storage flags
                    are considered, see below.

                    The function '_store' has to return a dictionary containing values only from
                    the following objects:

                        * python natives (int, long, str, bool, float, complex),

                        *
                            numpy natives, arrays and matrices of type np.int8-64, np.uint8-64,
                            np.float32-64, np.complex, np.str

                        *

                            python lists and tuples of the previous types
                            (python natives + numpy natives and arrays)
                            Lists and tuples are not allowed to be nested and must be
                            homogeneous, i.e. only contain data of one particular type.
                            Only integers, or only floats, etc.

                        *

                            python dictionaries of the previous types (not nested!), data can be
                            heterogeneous, keys must be strings. For example, one key-value-pair
                            of string and int and one key-value pair of string and float, and so
                            on.

                        * pandas DataFrames_

                        * :class:`~pypet.parameter.ObjectTable`

                    .. _DataFrames: http://pandas.pydata.org/pandas-docs/dev/dsintro.html#dataframe

                    The keys from the '_store' dictionaries determine how the data will be named
                    in the hdf5 file.

                :param store_data:

                    How to store the data, see above for a descitpion.

                :param store_flags: Flags describing how to store data.

                        :const:`~pypet.HDF5StorageService.ARRAY` ('ARRAY')

                            Store stuff as array

                        :const:`~pypet.HDF5StorageService.CARRAY` ('CARRAY')

                            Store stuff as carray

                        :const:`~pypet.HDF5StorageService.TABLE` ('TABLE')

                            Store stuff as pytable

                        :const:`~pypet.HDF5StorageService.DICT` ('DICT')

                            Store stuff as pytable but reconstructs it later as dictionary
                            on loading

                        :const:`~pypet.HDF%StorageService.FRAME` ('FRAME')

                            Store stuff as pandas data frame

                    Storage flags can also be provided by the parameters and results themselves
                    if they implement a function '_store_flags' that returns a dictionary
                    with the names of the data to store as keys and the flags as values.

                    If no storage flags are provided, they are automatically inferred from the
                    data. See :const:`pypet.HDF5StorageService.TYPE_FLAG_MAPPING` for the mapping
                    from type to flag.

                :param overwrite:

                    Can be used if parts of a leaf should be replaced. Either a list of
                    HDF5 names or `True` if this should account for all.

            * :const:`pypet.pypetconstants.DELETE` ('DELETE')

                Removes an item from disk. Empty group nodes, results and non-explored
                parameters can be removed.

                :param stuff_to_store: The item to be removed.

                :param delete_only:

                    Potential list of parts of a leaf node that should be deleted.

                :param remove_from_item:

                    If `delete_only` is used, whether deleted nodes should also be erased
                    from the leaf nodes themseleves.

                :param recursive:

                    If you want to delete a group node you can recursively delete all its
                    children.

            * :const:`pypet.pypetconstants.GROUP` ('GROUP')

                :param stuff_to_store: The group to store

                :param store_data: How to store data

                :param recursive: To recursively load everything below.

                :param max_depth:

                    Maximum depth in case of recursion. `None` for no limit.

            * :const:`pypet.pypetconstants.TREE`

                Stores a single node or a full subtree

                :param stuff_to_store: Node to store

                :param store_data: How to store data

                :param recursive: Whether to store recursively the whole sub-tree

                :param max_depth:

                    Maximum depth in case of recursion. `None` for no limit.

            * :const:`pypet.pypetconstants.DELETE_LINK`

                Deletes a link from hard drive

                :param name: The full colon separated name of the link

            * :const:`pypet.pypetconstants.LIST`

                .. _store-lists:

                Stores several items at once

                :param stuff_to_store:

                    Iterable whose items are to be stored. Iterable must contain tuples,
                    for example `[(msg1,item1,arg1,kwargs1),(msg2,item2,arg2,kwargs2),...]`

            * :const:`pypet.pypetconstants.ACCESS_DATA`

                Requests and manipulates data within the storage.
                Storage must be open.

                :param stuff_to_store:

                    A colon separated name to the data path

                :param item_name:

                    The name of the data item to interact with

                :param request:

                    A functional request in form of a string

                :param args:

                    Positional arguments passed to the reques

                :param kwargs:

                    Keyword arguments passed to the request

            * :const:`pypet.pypetconstants.OPEN_FILE`

                Opens the HDF5 file and keeps it open

                :param stuff_to_store: ``None``

            * :const:`pypet.pypetconstants.CLOSE_FILE`

                Closes an HDF5 file that was kept open, must be open before.

                :param stuff_to_store: ``None``

            * :const:`pypet.pypetconstants.FLUSH`

                Flushes an open file, must be open before.

                :param stuff_to_store: ``None``

        :raises: NoSuchServiceError if message or data is not understood


def Func(arg_0):
  """Loads a description file and returns it as a module.

  descriptionPyPath: path of description.py file to load
  """
  global g_descriptionImportCount

  if not os.path.isfile(arg_0):
    raise RuntimeError(("Experiment description file %s does not exist or " + \
                        "is not a file") % (arg_0,))

  arg_1 = imp.load_source("pf_description%d" % g_descriptionImportCount,
                        arg_0)
  g_descriptionImportCount += 1

  if not hasattr(arg_1, "descriptionInterface"):
    raise RuntimeError("Experiment description file %s does not define %s" % \
                       (arg_0, "descriptionInterface"))

  if not isinstance(arg_1.descriptionInterface, exp_description_api.DescriptionIface):
    raise RuntimeError(("Experiment description file %s defines %s but it " + \
                        "is not DescriptionIface-based") % \
                            (arg_0, name))

  return arg_1

Loads a description file and returns it as a module .


def Func(arg_0):
        """Detects if lock client was forked.

        Forking is detected by comparing the PID of the current
        process with the stored PID.

        """
        if arg_0._pid is None:
            arg_0._pid = os.getpid()
        if arg_0._context is not None:
            arg_2 = os.getpid()
            if arg_2 != arg_0._pid:
                arg_0._logger.debug('Fork detected: My pid `%s` != os pid `%s`. '
                                   'Restarting connection.' % (str(arg_0._pid), str(arg_2)))
                arg_0._context = None
                arg_0._pid = arg_2


(random_draw_parts,
                  state_parts,
                  drift_parts,
                  step_size_parts,
                  volatility_parts,
                  name=None)

def Func(arg_0,
                  arg_1,
                  arg_2,
                  arg_3,
                  arg_4,
                  arg_5=None):
  """Applies one step of Euler-Maruyama method.

  Generates proposal of the form:

  ```python
  tfd.Normal(loc=state_parts + _get_drift(state_parts, ...),
             scale=tf.sqrt(step_size * volatility_fn(current_state)))
  ```

  `_get_drift(state_parts, ..)` is a diffusion drift value at `state_parts`.

  Args:
    random_draw_parts: Python `list` of `Tensor`s containing the value(s) of the
      random perturbation variable(s). Must broadcast with the shape of
      `state_parts`.
    state_parts: Python `list` of `Tensor`s representing the current
      state(s) of the Markov chain(s).
    drift_parts: Python `list` of `Tensor`s representing value of the drift
      `_get_drift(*state_parts, ..)`. Must broadcast with the shape of
      `state_parts`.
    step_size_parts: Python `list` of `Tensor`s representing the step size for
      the Euler-Maruyama method. Must broadcast with the shape of
      `state_parts`.  Larger step sizes lead to faster progress, but
      too-large step sizes make rejection exponentially more likely. When
      possible, it's often helpful to match per-variable step sizes to the
      standard deviations of the target distribution in each variable.
    volatility_parts: Python `list` of `Tensor`s representing the value of
      `volatility_fn(*state_parts)`. Must broadcast with the shape of
      `state_parts`.
    name: Python `str` name prefixed to Ops created by this function.
      Default value: `None` (i.e., 'malaFunc').

  Returns:
    proposed_state_parts: Tensor or Python list of `Tensor`s representing the
      state(s) of the Markov chain(s) at each result step. Has same shape as
      input `current_state_parts`.
  """
  with tf.compat.v1.name_scope(arg_5, 'malaFunc', [
      arg_0, arg_1, arg_2, arg_3,
      arg_4
  ]):
    arg_6 = []
    for arg_7, arg_8, arg_9, arg_10, arg_11 in zip(
        arg_0,
        arg_1,
        arg_2,
        arg_3,
        arg_4):
      arg_12 = arg_8 + arg_9 + arg_11 * tf.sqrt(arg_10) * arg_7
      arg_6.append(arg_12)

    return arg_6

Applies one step of Euler-Maruyama method.

  Generates proposal of the form:

  ```python
  tfd.Normal(loc=state_parts + _get_drift(state_parts, ...),
             scale=tf.sqrt(step_size * volatility_fn(current_state)))
  ```

  `_get_drift(state_parts, ..)` is a diffusion drift value at `state_parts`.

  Args:
    random_draw_parts: Python `list` of `Tensor`s containing the value(s) of the
      random perturbation variable(s). Must broadcast with the shape of
      `state_parts`.
    state_parts: Python `list` of `Tensor`s representing the current
      state(s) of the Markov chain(s).
    drift_parts: Python `list` of `Tensor`s representing value of the drift
      `_get_drift(*state_parts, ..)`. Must broadcast with the shape of
      `state_parts`.
    step_size_parts: Python `list` of `Tensor`s representing the step size for
      the Euler-Maruyama method. Must broadcast with the shape of
      `state_parts`.  Larger step sizes lead to faster progress, but
      too-large step sizes make rejection exponentially more likely. When
      possible, it's often helpful to match per-variable step sizes to the
      standard deviations of the target distribution in each variable.
    volatility_parts: Python `list` of `Tensor`s representing the value of
      `volatility_fn(*state_parts)`. Must broadcast with the shape of
      `state_parts`.
    name: Python `str` name prefixed to Ops created by this function.
      Default value: `None` (i.e., 'mala_euler_method').

  Returns:
    proposed_state_parts: Tensor or Python list of `Tensor`s representing the
      state(s) of the Markov chain(s) at each result step. Has same shape as
      input `current_state_parts`.

Applies one step of Euler - Maruyama method .


(self, datacenter_id, server_id, cdrom_id)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
)
:
arg_4
=
'{ "id": "'
+
arg_3
+
'" }'
arg_5
=
arg_0
.
_perform_request
(
url
=
'/datacenters/%s/servers/%s/cdroms'
%
(
arg_1
,
arg_2
)
,
method
=
'POST'
,
arg_4
=
arg_4
)
return
arg_5

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Attaches a CDROM to a server.

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

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

        :param      cdrom_id: The unique ID of the CDROM.
        :type       cdrom_id: ``str``

        """
        arg_4 = '{ "id": "' + arg_3 + '" }'

        arg_5 = arg_0._perform_request(
            url='/datacenters/%s/servers/%s/cdroms' % (
                arg_1,
                arg_2),
            method='POST',
            arg_4=arg_4)

        return arg_5


return [shapely.geometry.Point(point).distance(other)
                for point in self.coords]

def Func(arg_0, arg_1, arg_2=None):
        """
        Compute the minimal distance between each point on self and other.

        Parameters
        ----------
        other : tuple of number \
                or imgaug.augmentables.kps.Keypoint \
                or imgaug.augmentables.LineString
            Other object to which to compute the distances.

        default
            Value to return if `other` contains no points.

        Returns
        -------
        list of float
            Distances to `other` or `default` if not distance could be computed.

        """
        import shapely.geometry
        from .kps import Keypoint

        if isinstance(arg_1, Keypoint):
            arg_1 = shapely.geometry.Point((arg_1.x, arg_1.y))
        elif isinstance(arg_1, LineString):
            if len(arg_1.coords) == 0:
                return arg_2
            elif len(arg_1.coords) == 1:
                arg_1 = shapely.geometry.Point(arg_1.coords[0, :])
            else:
                arg_1 = shapely.geometry.LineString(arg_1.coords)
        elif isinstance(arg_1, tuple):
            assert len(arg_1) == 2
            arg_1 = shapely.geometry.Point(arg_1)
        else:
            raise ValueError(
                ("Expected Keypoint or LineString or tuple (x,y), "
                 + "got type %s.") % (type(arg_1),))

        return [shapely.geometry.Point(arg_3).distance(arg_1)
                for arg_3 in arg_0.coords]

Compute the minimal distance between each point on self and other .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = controllers . Func_export ( store , arg_0 , arg_1 , arg_2 ) if request . method == 'GET' : return arg_3 else : arg_4 = request . form . to_dict ( ) arg_5 = set_submission_objects ( arg_4 ) arg_6 = store . get_open_Func_submission ( current_user . email , arg_0 ) arg_7 = store . add_to_submission ( arg_6 [ '_id' ] , arg_5 ) return redirect ( url_for ( 'cases.Func_submissions' , arg_0 = arg_0 ) )

def Func(arg_0, arg_1, arg_2):
    """Build a clinVar submission form for a variant."""
    arg_3 = controllers.Func_export(store, arg_0, arg_1, arg_2)
    if request.method == 'GET':
        return arg_3
    else: #POST
        arg_4 = request.form.to_dict()
        arg_5 = set_submission_objects(arg_4) # A tuple of submission objects (variants and casedata objects)

        # Add submission data to an open Func submission object,
        # or create a new if no open submission is found in database
        arg_6 = store.get_open_Func_submission(current_user.email, arg_0)
        arg_7 = store.add_to_submission(arg_6['_id'], arg_5)

        # Redirect to Func submissions handling page, and pass it the updated_submission_object
        return redirect(url_for('cases.Func_submissions', arg_0=arg_0))

Build a clinVar submission form for a variant .


def Func ( arg_0 , arg_1 ) : for arg_2 in arg_1 : arg_3 = open ( arg_2 , 'r' ) try : arg_0 . add_bpmn_xml ( ET . parse ( arg_3 ) , arg_2 = arg_2 ) finally : arg_3 . close ( )

def Func(arg_0, arg_1):
        """
        Add all filenames in the given list to the parser's set.
        """
        for arg_2 in arg_1:
            arg_3 = open(arg_2, 'r')
            try:
                arg_0.add_bpmn_xml(ET.parse(arg_3), arg_2=arg_2)
            finally:
                arg_3.close()

Add all filenames in the given list to the parser s set .


def Func(arg_0, arg_1, arg_2):
        """Call a method.

        :param method: method to call
        :param params: dict with the HTTP parameters needed to call
            the given method

        :raises ConduitError: when an error is returned by the server
        """
        arg_3 = arg_0.URL % {'base': arg_0.base_url, 'method': arg_1}

        # Conduit and POST parameters
        arg_2['__conduit__'] = {'token': arg_0.api_token}

        arg_4 = {
            'params': json.dumps(arg_2, sort_keys=True),
            'output': 'json',
            '__conduit__': True
        }

        logger.debug("Phabricator Conduit client requests: %s params: %s",
                     arg_1, str(arg_4))

        arg_5 = arg_0.fetch(arg_3, payload=arg_4, arg_1=HttpClient.POST, verify=False)

        # Check for possible Conduit API errors
        arg_6 = arg_5.json()

        if arg_6['error_code']:
            raise ConduitError(error=arg_6['error_info'],
                               code=arg_6['error_code'])

        return arg_5.text


(self, features=None, expression=None, mask=None,
                    peaks=None, frequency_threshold=0.001,
                    activation_threshold=0.0, func=np.sum, return_type='ids',
                    r=6
                    )

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None,
                    arg_4=None, arg_5=0.001,
                    arg_6=0.0, arg_7=arg_8.sum, arg_10='ids',
                    arg_11=6
                    ):
        """ Get IDs or data for studies that meet specific criteria.

        If multiple criteria are passed, the set intersection is returned. For
        example, passing expression='emotion' and mask='my_mask.nii.gz' would
        return only those studies that are associated with emotion AND report
        activation within the voxels indicated in the passed image.

        Args:
            ids (list): A list of IDs of studies to retrieve.
            features (list or str): The name of a feature, or a list of
                features, to use for selecting studies.
            expression (str): A string expression to pass to the PEG for study
                retrieval.
            mask: the mask image (see Masker documentation for valid data
                types).
            peaks (ndarray or list): Either an n x 3 numpy array, or a list of
                lists or tuples (e.g., [(-10, 22, 14)]) specifying the world
                (x/y/z) coordinates of the target location(s).
            frequency_threshold (float): For feature-based or expression-based
                selection, the threshold for selecting studies--i.e., the
                cut-off for a study to be included. Must be a float in range
                [0, 1].
            activation_threshold (int or float): For mask-based selection,
                threshold for a study to be included based on amount of
                activation displayed. If an integer, represents the absolute
                number of voxels that must be active within the mask in order
                for a study to be selected. If a float, it represents the
                proportion of voxels that must be active.
            func (Callable): The function to use when aggregating over the list
                of features. See documentation in FeatureTable.get_ids() for a
                full explanation. Only used for feature- or expression-based
                selection.
            return_type (str): A string specifying what data to return. Valid
                options are:
                'ids': returns a list of IDs of selected studies.
                'images': returns a voxel x study matrix of data for all
                selected studies.
                'weights': returns a dict where the keys are study IDs and the
                values are the computed weights. Only valid when performing
                feature-based selection.
            r (int): For peak-based selection, the distance cut-off (in mm)
                for inclusion (i.e., only studies with one or more activations
                within r mm of one of the passed foci will be returned).

        Returns:
            When return_type is 'ids' (default), returns a list of IDs of the
            selected studies. When return_type is 'data', returns a 2D numpy
            array, with voxels in rows and studies in columns. When return_type
            is 'weights' (valid only for expression-based selection), returns
            a dict, where the keys are study IDs, and the values are the
            computed weights.

        Examples
        --------
        Select all studies tagged with the feature 'emotion':

            >>> ids = dataset.Func(features='emotion')

        Select all studies that activate at least 20% of voxels in an amygdala
        mask, and retrieve activation data rather than IDs:

            >>> data = dataset.Func(mask='amygdala_mask.nii.gz',
                threshold=0.2, return_type='images')

        Select studies that report at least one activation within 12 mm of at
        least one of three specific foci:

            >>> ids = dataset.Func(peaks=[[12, -20, 30], [-26, 22, 22],
                                                [0, 36, -20]], r=12)

        """
        arg_12 = []

        # Feature-based selection
        if arg_1 is not None:
            # Need to handle weights as a special case, because we can't
            # retrieve the weights later using just the IDs.
            if arg_10 == 'weights':
                if arg_2 is not None or arg_3 is not None or \
                        arg_4 is not None:
                    raise ValueError(
                        "return_type cannot be 'weights' when feature-based "
                        "search is used in conjunction with other search "
                        "modes.")
                return arg_0.feature_table.get_ids(
                    arg_1, arg_5, arg_7, get_weights=True)
            else:
                arg_12.append(arg_0.feature_table.get_ids(
                    arg_1, arg_5, arg_7))

        # Logical expression-based selection
        if arg_2 is not None:
            arg_13 = arg_0.feature_table.get_ids_by_expression(
                arg_2, arg_5, arg_7)
            arg_12.append(list(arg_13))

        # Mask-based selection
        if arg_3 is not None:
            arg_3 = arg_0.masker.mask(arg_3, in_global_mask=True).astype(bool)
            arg_14 = arg_8.sum(arg_3)
            arg_15 = arg_0.image_table.data.T.dot(arg_3).astype(float)
            if isinstance(arg_6, float):
                arg_15 /= arg_14
            arg_16 = arg_8.where(arg_15 > arg_6)[0]
            arg_12.append([arg_0.image_table.ids[arg_17] for arg_17 in arg_16])

        # Peak-based selection
        if arg_4 is not None:
            arg_11 = float(arg_11)
            arg_18 = set()
            for arg_19 in arg_4:
                arg_20 = arg_8.array(arg_19, dtype=float)
                arg_21 = arg_0.activations['x']
                arg_22 = arg_0.activations['y']
                arg_23 = arg_0.activations['z']
                arg_24 = arg_8.sqrt(arg_8.square(arg_21 - arg_20[0]) + arg_8.square(arg_22 - arg_20[1]) +
                                arg_8.square(arg_23 - arg_20[2]))
                arg_25 = arg_8.where((arg_24 > 5.5) & (arg_24 < 6.5))[0]
                arg_26 = arg_24[arg_25]
                arg_18 |= set(arg_0.activations[arg_24 <= arg_11]['id'].unique())
            arg_12.append(arg_18)

        # Get intersection of all sets
        arg_27 = list(reduce(lambda arg_21, arg_22: set(arg_21) & set(arg_22), arg_12))

        if arg_10 == 'ids':
            return arg_27
        elif arg_10 == 'data':
            return arg_0.get_image_data(arg_27)

Get IDs or data for studies that meet specific criteria.

        If multiple criteria are passed, the set intersection is returned. For
        example, passing expression='emotion' and mask='my_mask.nii.gz' would
        return only those studies that are associated with emotion AND report
        activation within the voxels indicated in the passed image.

        Args:
            ids (list): A list of IDs of studies to retrieve.
            features (list or str): The name of a feature, or a list of
                features, to use for selecting studies.
            expression (str): A string expression to pass to the PEG for study
                retrieval.
            mask: the mask image (see Masker documentation for valid data
                types).
            peaks (ndarray or list): Either an n x 3 numpy array, or a list of
                lists or tuples (e.g., [(-10, 22, 14)]) specifying the world
                (x/y/z) coordinates of the target location(s).
            frequency_threshold (float): For feature-based or expression-based
                selection, the threshold for selecting studies--i.e., the
                cut-off for a study to be included. Must be a float in range
                [0, 1].
            activation_threshold (int or float): For mask-based selection,
                threshold for a study to be included based on amount of
                activation displayed. If an integer, represents the absolute
                number of voxels that must be active within the mask in order
                for a study to be selected. If a float, it represents the
                proportion of voxels that must be active.
            func (Callable): The function to use when aggregating over the list
                of features. See documentation in FeatureTable.get_ids() for a
                full explanation. Only used for feature- or expression-based
                selection.
            return_type (str): A string specifying what data to return. Valid
                options are:
                'ids': returns a list of IDs of selected studies.
                'images': returns a voxel x study matrix of data for all
                selected studies.
                'weights': returns a dict where the keys are study IDs and the
                values are the computed weights. Only valid when performing
                feature-based selection.
            r (int): For peak-based selection, the distance cut-off (in mm)
                for inclusion (i.e., only studies with one or more activations
                within r mm of one of the passed foci will be returned).

        Returns:
            When return_type is 'ids' (default), returns a list of IDs of the
            selected studies. When return_type is 'data', returns a 2D numpy
            array, with voxels in rows and studies in columns. When return_type
            is 'weights' (valid only for expression-based selection), returns
            a dict, where the keys are study IDs, and the values are the
            computed weights.

        Examples
        --------
        Select all studies tagged with the feature 'emotion':

            >>> ids = dataset.get_studies(features='emotion')

        Select all studies that activate at least 20% of voxels in an amygdala
        mask, and retrieve activation data rather than IDs:

            >>> data = dataset.get_studies(mask='amygdala_mask.nii.gz',
                threshold=0.2, return_type='images')

        Select studies that report at least one activation within 12 mm of at
        least one of three specific foci:

            >>> ids = dataset.get_studies(peaks=[[12, -20, 30], [-26, 22, 22],
                                                [0, 36, -20]], r=12)

Get IDs or data for studies that meet specific criteria .


def Func(arg_0, arg_1, arg_2, *arg_3):
    """Log 'msg % args' at level 'level' once per 'n' times.

    Logs the 1st call, (N+1)st call, (2N+1)st call,  etc.
    Not threadsafe.

    Args:
    level: The level at which to log.
    msg: The message to be logged.
    n: The number of times this should be called before it is logged.
    *args: The args to be substituted into the msg.
    """
    arg_4 = _GetNextLogCountPerToken(_GetFileAndLine())
    log_if(arg_0, arg_1, not (arg_4 % arg_2), *arg_3)

Log msg % args at level level once per n times .