def Func ( arg_0 ) : if arg_0 . endswith ( '.py' ) : return True try : with open_with_encoding ( arg_0 , None , limit_byte_check = MAX_PYTHON_FILE_DETECTION_BYTES ) as f : arg_1 = f . read ( MAX_PYTHON_FILE_DETECTION_BYTES ) if not arg_1 : return False arg_2 = arg_1 . splitlines ( ) [ 0 ] except ( IOError , IndexError ) : return False if not PYTHON_SHEBANG_REGEX . match ( arg_2 ) : return False return True

def Func(arg_0):
    """Return True if filename is Python file."""
    if arg_0.endswith('.py'):
        return True

    try:
        with open_with_encoding(
                arg_0,
                None,
                limit_byte_check=MAX_PYTHON_FILE_DETECTION_BYTES) as f:
            arg_1 = f.read(MAX_PYTHON_FILE_DETECTION_BYTES)
            if not arg_1:
                return False
            arg_2 = arg_1.splitlines()[0]
    except (IOError, IndexError):
        return False

    if not PYTHON_SHEBANG_REGEX.match(arg_2):
        return False

    return True

Return True if filename is Python file .


(self, include_process_stats: bool = False)

def Func ( arg_0 , arg_1 : arg_2 = False ) : if arg_1 : arg_0 . registry . register_additional_collector ( ProcessCollector ( registry = None ) )

def Func(arg_0, arg_1: arg_2 = False):
        """Configure the MetricRegistry."""
        if arg_1:
            arg_0.registry.register_additional_collector(
                ProcessCollector(registry=None))


return {
            'modified': self.copied_files + self.symlinked_files,
            'unmodified': self.unmodified_files,
            'post_processed': self.post_processed_files,
        }

def Func(arg_0):
        """
        Perform the bulk of the work of Funcmedia.

        Split off from handle() to facilitate testing.
        """
        if arg_0.symlink and not arg_0.local:
            raise CommandError("Can't symlink to a remote destination.")

        if arg_0.clear:
            arg_0.clear_dir('')

        if arg_0.symlink:
            arg_1 = arg_0.link_file
        else:
            arg_1 = arg_0.copy_file

        arg_2 = OrderedDict()
        for arg_3 in get_finders():
            for arg_4, arg_5 in arg_3.list(arg_0.ignore_patterns):
                # Prefix the relative path if the source storage contains it
                if getattr(arg_5, 'prefix', None):
                    arg_6 = os.path.join(arg_5.prefix, arg_4)
                else:
                    arg_6 = arg_4

                if arg_6 not in arg_2:
                    arg_2[arg_6] = (arg_5, arg_4)
                    arg_1(arg_4, arg_6, arg_5)

        # Here we check if the storage backend has a post_process
        # method and pass it the list of modified files.
        if arg_0.post_process and hasattr(arg_0.storage, 'post_process'):
            arg_7 = arg_0.storage.post_process(arg_2,
                                                  dry_run=arg_0.dry_run)
            for arg_8, arg_9, arg_10 in arg_7:
                if isinstance(arg_10, Exception):
                    arg_0.stderr.write("Post-processing '%s' failed!" % arg_8)
                    # Add a blank line before the traceback, otherwise it's
                    # too easy to miss the relevant part of the error message.
                    arg_0.stderr.write("")
                    raise arg_10
                if arg_10:
                    arg_0.log("Post-processed '%s' as '%s'" %
                             (arg_8, arg_9), level=1)
                    arg_0.post_processed_files.append(arg_8)
                else:
                    arg_0.log("Skipped post-processing '%s'" % arg_8)

        return {
            'modified': arg_0.copied_files + arg_0.symlinked_files,
            'unmodified': arg_0.unmodified_files,
            'post_processed': arg_0.post_processed_files,
        }

Perform the bulk of the work of collectmedia.

        Split off from handle() to facilitate testing.

Perform the bulk of the work of collectmedia .


(self, call_id, timeout, limit=None,
                  retry=None, max_retries=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
,
arg_4
=
,
arg_5
=
)
:
arg_6
=
0
arg_7
=
0
arg_8
=
[
]
arg_9
=
arg_0
.
result_queues
[
arg_1
]
try
:
with
Timeout
(
arg_2
,
False
)
:
while
True
:
arg_10
=
arg_9
.
get
(
)
if
arg_10
is
:
arg_6
+=
1
if
arg_4
is
not
:
if
arg_7
==
arg_5
:
break
arg_4
(
)
arg_7
+=
1
continue
arg_8
.
append
(
arg_10
)
if
len
(
arg_8
)
==
arg_3
:
break
finally
:
del
arg_9
arg_0
.
remove_result_queue
(
arg_1
)
if
not
arg_8
:
if
arg_6
:
raise
Rejected
(
'%d workers rejected'
%
arg_6
if
arg_6
!=
1
else
'A worker rejected'
)
else
:
raise
WorkerNotFound
(
'failed to find worker'
)
return
arg_8

def Func(arg_0, arg_1, arg_2, arg_3=None,
                  arg_4=None, arg_5=None):
        """Waits for the call is accepted by workers and starts to collect the
        results.
        """
        arg_6 = 0
        arg_7 = 0
        arg_8 = []
        arg_9 = arg_0.result_queues[arg_1]
        try:
            with Timeout(arg_2, False):
                while True:
                    arg_10 = arg_9.get()
                    if arg_10 is None:
                        arg_6 += 1
                        if arg_4 is not None:
                            if arg_7 == arg_5:
                                break
                            arg_4()
                            arg_7 += 1
                        continue
                    arg_8.append(arg_10)
                    if len(arg_8) == arg_3:
                        break
        finally:
            del arg_9
            arg_0.remove_result_queue(arg_1)
        if not arg_8:
            if arg_6:
                raise Rejected('%d workers rejected' % arg_6
                               if arg_6 != 1 else
                               'A worker rejected')
            else:
                raise WorkerNotFound('failed to find worker')
        return arg_8

Waits for the call is accepted by workers and starts to collect the results .


def Func ( arg_0 , arg_1 , arg_2 = None ) : arg_0 . markers . detach ( ) arg_0 . markers . reposition ( arg_1 ) arg_0 . markers . attach ( arg_1 ) arg_0 . ode_space . collide ( None , arg_0 . on_collision ) arg_3 = arg_0 . skeleton . get_body_states ( ) arg_0 . skeleton . set_body_states ( arg_3 ) yield arg_3 arg_0 . ode_world . step ( arg_2 or arg_0 . dt ) arg_0 . ode_contactgroup . empty ( )

def Func(arg_0, arg_1, arg_2=None):
        '''Update the simulator to a specific frame of marker data.

        This method returns a generator of body states for the skeleton! This
        generator must be exhausted (e.g., by consuming this call in a for loop)
        for the simulator to work properly.

        This process involves the following steps:

        - Move the markers to their new location:
          - Detach from the skeleton
          - Update marker locations
          - Reattach to the skeleton
        - Detect ODE collisions
        - Yield the states of the bodies in the skeleton
        - Advance the ODE world one step

        Parameters
        ----------
        frame_no : int
            Step to this frame of marker data.
        dt : float, optional
            Step with this time duration. Defaults to ``self.dt``.

        Returns
        -------
        states : sequence of state tuples
            A generator of a sequence of one body state for the skeleton. This
            generator must be exhausted for the simulation to work properly.
        '''
        # update the positions and velocities of the markers.
        arg_0.markers.detach()
        arg_0.markers.reposition(arg_1)
        arg_0.markers.attach(arg_1)

        # detect collisions.
        arg_0.ode_space.collide(None, arg_0.on_collision)

        # record the state of each skeleton body.
        arg_3 = arg_0.skeleton.get_body_states()
        arg_0.skeleton.set_body_states(arg_3)

        # yield the current simulation state to our caller.
        yield arg_3

        # update the ode world.
        arg_0.ode_world.step(arg_2 or arg_0.dt)

        # clear out contact joints to prepare for the next frame.
        arg_0.ode_contactgroup.empty()

Update the simulator to a specific frame of marker data .


def Func ( arg_0 , arg_1 = True ) : arg_2 . permanent = arg_1 arg_2 [ 'user_id' ] = arg_0 . id

def Func(arg_0, arg_1=True):
    """Sign in user."""
    arg_2.permanent = arg_1
    arg_2['user_id'] = arg_0.id


def Func ( arg_0 : arg_1 ) -> str : if arg_0 . activity . channel_id is None : return "" else : return arg_0 . activity . channel_id

def Func(arg_0: arg_1) -> str:
        """Get the Channel Id from the current Activity on the Turn Context.

        Args:
            turn_context (TurnContext): The Turn Context to retrieve the Activity's Channel Id from.

        Returns:
            str: The Channel Id from the Turn Context's Activity.
        """

        if arg_0.activity.channel_id is None:
            return ""
        else:
            return arg_0.activity.channel_id

Get the Channel Id from the current Activity on the Turn Context .


Construct a layout.
        SHOULD BE PRIVATE

return cls(project.drivers, maker=project.maker, **desc)

def Func ( arg_0 , arg_1 , ** arg_2 ) : return arg_0 ( arg_1 . drivers , maker = arg_1 . maker , ** arg_2 )

def Func(arg_0, arg_1, **arg_2):
        """Construct a layout.
        SHOULD BE PRIVATE
        """
        return arg_0(arg_1.drivers, maker=arg_1.maker, **arg_2)

Construct a layout.
        SHOULD BE PRIVATE


def Func ( arg_0 , arg_1 , arg_2 = None ) : if arg_0 . start_date and arg_1 < arg_0 . start_date : return False if arg_0 . end_date and arg_1 > arg_0 . end_date : return False if arg_1 . weekday ( ) not in arg_0 . weekdays : return False if not arg_2 : return True if arg_2 >= arg_0 . period . start and arg_2 <= arg_0 . period . end : return True return False

def Func(arg_0, arg_1, arg_2=None):
        """Does this schedule include the provided time?
        query_date and query_time are date and time objects, interpreted
        in this schedule's timezone"""

        if arg_0.start_date and arg_1 < arg_0.start_date:
            return False
        if arg_0.end_date and arg_1 > arg_0.end_date:
            return False
        if arg_1.weekday() not in arg_0.weekdays:
            return False

        if not arg_2:
            return True

        if arg_2 >= arg_0.period.start and arg_2 <= arg_0.period.end:
            return True

        return False

Does this schedule include the provided time? query_date and query_time are date and time objects interpreted in this schedule s timezone


def Func(arg_0, arg_1, arg_2):
    """
    Performs local inhibition. Local inhibition is performed on a column by
    column basis. Each column observes the overlaps of its neighbors and is
    selected if its overlap score is within the top 'numActive' in its local
    neighborhood. At most half of the columns in a local neighborhood are
    allowed to be active. Columns with an overlap score below the
    'stimulusThreshold' are always inhibited.

    :param overlaps: an array containing the overlap score for each  column.
                    The overlap score for a column is defined as the number
                    of synapses in a "connected state" (connected synapses)
                    that are connected to input bits which are turned on.
    :param density: The fraction of columns to survive inhibition. This
                    value is only an intended target. Since the surviving
                    columns are picked in a local fashion, the exact fraction
                    of surviving columns is likely to vary.
    @return list with indices of the winning columns
    """

    arg_3 = numpy.zeros(arg_0._numColumns, dtype="bool")

    for arg_4, arg_5 in enumerate(arg_1):
      if arg_5 >= arg_0._stimulusThreshold:
        arg_6 = arg_0._getColumnNeighborhood(arg_4)
        arg_7 = arg_1[arg_6]

        arg_8 = numpy.count_nonzero(arg_7 > arg_5)

        # When there is a tie, favor neighbors that are already selected as
        # active.
        arg_9 = numpy.where(arg_7 == arg_5)
        arg_10 = arg_6[arg_9]
        arg_11 = numpy.count_nonzero(arg_3[arg_10])

        arg_12 = int(0.5 + arg_2 * len(arg_6))
        if arg_8 + arg_11 < arg_12:
          arg_3[arg_4] = True

    return arg_3.nonzero()[0]

Performs local inhibition . Local inhibition is performed on a column by column basis . Each column observes the overlaps of its neighbors and is selected if its overlap score is within the top numActive in its local neighborhood . At most half of the columns in a local neighborhood are allowed to be active . Columns with an overlap score below the stimulusThreshold are always inhibited .


(self, filename=None, v2_version=4, v23_sep='/')

def Func(arg_0, arg_1=None, arg_2=4, arg_3='/'):
        """Save ID3v2 data to the AIFF file"""

        arg_4 = arg_0._prepare_framedata(arg_2, arg_3)
        arg_5 = len(arg_4)

        if arg_1 is None:
            arg_1 = arg_0.filename

        # Unlike the parent ID3.Func method, we won't Func to a blank file
        # since we would have to construct a empty AIFF file
        arg_6 = open(arg_1, 'rb+')
        arg_7 = IFFFile(arg_6)

        try:
            if u'ID3' not in arg_7:
                arg_7.insert_chunk(u'ID3')

            arg_8 = arg_7[u'ID3']
            arg_6.seek(arg_8.data_offset)

            arg_9 = arg_6.read(10)
            arg_9 = arg_0._prepare_id3_header(arg_9, arg_5, arg_2)
            arg_9, arg_10, arg_11 = arg_9

            arg_12 = arg_9 + arg_4 + (b'\x00' * (arg_10 - arg_5))

            # Include ID3 header size in 'new_size' calculation
            arg_10 += 10

            # Expand the chunk if necessary, including pad byte
            if arg_10 > arg_8.size:
                arg_13 = arg_8.offset + arg_8.size
                arg_14 = arg_10 - arg_8.size + arg_10 % 2
                insert_bytes(arg_6, arg_14, arg_13)
                arg_8.resize(arg_10)

            arg_6.seek(arg_8.data_offset)
            arg_6.write(arg_12)
        finally:
            arg_6.close()


return 'WRAP access_token="' + \
                self._get_token(request.host, request.path, httpclient) + '"'

def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
return
'WRAP access_token="'
+
arg_0
.
_get_token
(
arg_1
.
host
,
arg_1
.
path
,
arg_2
)
+
'"'

def Func(arg_0, arg_1, arg_2):
        ''' return the signed string with token. '''
        return 'WRAP access_token="' + \
                arg_0._get_token(arg_1.host, arg_1.path, arg_2) + '"'


(self, data,
                 expect_header_row=True,
                 ignore_lines=0,
                 summarize=False,
                 context=None,
                 report_unexpected_exceptions=True)

def Func(arg_0, arg_1,
                 arg_2=True,
                 arg_3=0,
                 arg_4=False,
                 arg_5=None,
                 arg_6=True):
        """
        Validate `data` and return a iterator over problems found.

        Use this function rather than validate() if you expect a large number
        of problems.

        Arguments
        ---------

        `data` - any source of row-oriented data, e.g., as provided by a
        `csv.reader`, or a list of lists of strings, or ...

        `expect_header_row` - does the data contain a header row (i.e., the
        first record is a list of field names)? Defaults to True.

        `ignore_lines` - ignore n lines (rows) at the beginning of the data

        `summarize` - only report problem codes, no other details

        `context` - a dictionary of any additional information to be added to
        any problems found - useful if problems are being aggregated from
        multiple validators

        `report_unexpected_exceptions` - value check function, value predicates,
        record check functions, record predicates, and other user-supplied
        validation functions may raise unexpected exceptions. If this argument
        is true, any unexpected exceptions will be reported as validation
        problems; if False, unexpected exceptions will be handled silently.

        """

        arg_7 = arg_0._init_unique_sets() # used for unique checks
        for arg_8, arg_9 in enumerate(arg_1):
            if arg_2 and arg_8 == arg_3:
                # r is the header row
                for arg_10 in arg_0._apply_header_checks(arg_8, arg_9, arg_4, arg_5):
                    yield arg_10
            elif arg_8 >= arg_3:
                # r is a data row
                arg_11 = False
                for arg_10 in arg_0._apply_skips(arg_8, arg_9, arg_4,
                                                  arg_6,
                                                  arg_5):
                    if arg_10 is True:
                        arg_11 = True
                    else:
                        yield arg_10
                if not arg_11:
                    for arg_10 in arg_0._apply_each_methods(arg_8, arg_9, arg_4,
                                                      arg_6,
                                                      arg_5):
                        yield arg_10 # may yield a problem if an exception is raised
                    for arg_10 in arg_0._apply_value_checks(arg_8, arg_9, arg_4,
                                                      arg_6,
                                                      arg_5):
                        yield arg_10
                    for arg_10 in arg_0._apply_record_length_checks(arg_8, arg_9, arg_4,
                                                              arg_5):
                        yield arg_10
                    for arg_10 in arg_0._apply_value_predicates(arg_8, arg_9, arg_4,
                                                          arg_6,
                                                          arg_5):
                        yield arg_10
                    for arg_10 in arg_0._apply_record_checks(arg_8, arg_9, arg_4,
                                                           arg_6,
                                                           arg_5):
                        yield arg_10
                    for arg_10 in arg_0._apply_record_predicates(arg_8, arg_9, arg_4,
                                                           arg_6,
                                                           arg_5):
                        yield arg_10
                    for arg_10 in arg_0._apply_unique_checks(arg_8, arg_9, arg_7, arg_4):
                        yield arg_10
                    for arg_10 in arg_0._apply_check_methods(arg_8, arg_9, arg_4,
                                                       arg_6,
                                                       arg_5):
                        yield arg_10
                    for arg_10 in arg_0._apply_assert_methods(arg_8, arg_9, arg_4,
                                                        arg_6,
                                                        arg_5):
                        yield arg_10
        for arg_10 in arg_0._apply_finally_assert_methods(arg_4,
                                                    arg_6,
                                                    arg_5):
            yield arg_10

Validate data and return a iterator over problems found .


def Func ( arg_0 ) : arg_0 . wait . until ( lambda _ : arg_0 . loaded ) arg_0 . pm . hook . pypom_after_Func ( page = arg_0 ) return arg_0

def Func(arg_0):
        """Wait for the page to load."""
        arg_0.wait.until(lambda _: arg_0.loaded)
        arg_0.pm.hook.pypom_after_Func(page=arg_0)
        return arg_0


def Func ( arg_0 ) : if arg_0 . database_type == 'postgres' : arg_0 . db_hook = PostgresHook ( postgres_conn_id = arg_0 . db_conn_id , schema = arg_0 . database ) else : arg_0 . db_hook = MySqlHook ( mysql_conn_id = arg_0 . db_conn_id , schema = arg_0 . database ) return arg_0 . db_hook

def Func(arg_0):
        """
        Retrieve database hook. This is the actual Postgres or MySQL database hook
        that uses proxy or connects directly to the Google Cloud SQL database.
        """
        if arg_0.database_type == 'postgres':
            arg_0.db_hook = PostgresHook(postgres_conn_id=arg_0.db_conn_id,
                                        schema=arg_0.database)
        else:
            arg_0.db_hook = MySqlHook(mysql_conn_id=arg_0.db_conn_id,
                                     schema=arg_0.database)
        return arg_0.db_hook

Retrieve database hook . This is the actual Postgres or MySQL database hook that uses proxy or connects directly to the Google Cloud SQL database .


def Func ( arg_0 ) : arg_1 = _setup_osf ( arg_0 ) arg_2 = arg_1 . project ( arg_0 . project ) for arg_3 in arg_2 . storages : arg_4 = arg_3 . name for arg_5 in arg_3 . files : arg_6 = arg_5 . path if arg_6 . startswith ( '/' ) : arg_6 = arg_6 [ 1 : ] print ( os . path . join ( arg_4 , arg_6 ) )

def Func(arg_0):
    """List all files from all storages for project.

    If the project is private you need to specify a username.
    """
    arg_1 = _setup_osf(arg_0)

    arg_2 = arg_1.project(arg_0.project)

    for arg_3 in arg_2.storages:
        arg_4 = arg_3.name
        for arg_5 in arg_3.files:
            arg_6 = arg_5.path
            if arg_6.startswith('/'):
                arg_6 = arg_6[1:]

            print(os.path.join(arg_4, arg_6))

List all files from all storages for project .


(distribution,
                       sample_shape=(),
                       value=None)

return _build_custom_rv(distribution=distribution,
                          sample_shape=sample_shape,
                          value=value,
                          name=_simple_name(distribution))

def Func ( arg_0 , arg_1 = ( ) , arg_2 = None ) : return _build_custom_rv ( arg_0 = arg_0 , arg_1 = arg_1 , arg_2 = arg_2 , name = _simple_name ( arg_0 ) )

def Func(arg_0,
                       arg_1=(),
                       arg_2=None):
  """Wrap an existing distribution as a traceable random variable.

  This enables the use of custom or user-provided distributions in
  Edward models. Unlike a bare `RandomVariable` object, this method
  wraps the constructor so it is included in the Edward trace and its
  values can be properly intercepted and overridden.

  Where possible, you should prefer the built-in constructors
  (`ed.Normal`, etc); these simultaneously construct a Distribution
  and a RandomVariable object so that the distribution parameters
  themselves may be intercepted and overridden. RVs constructed via
  `Func()` have a fixed distribution and may not support
  program transformations (e.g, conjugate marginalization) that rely
  on overriding distribution parameters.

  Args:
    distribution: tfd.Distribution governing the distribution of the random
      variable, such as sampling and log-probabilities.
    sample_shape: tf.TensorShape of samples to draw from the random variable.
      Default is `()` corresponding to a single sample.
    value: Fixed tf.Tensor to associate with random variable. Must have shape
      `sample_shape + distribution.batch_shape + distribution.event_shape`.
      Default is to sample from random variable according to `sample_shape`.

  Returns:
    rv: a `RandomVariable` wrapping the provided distribution.

  #### Example

  ```python
  from tensorflow_probability import distributions as tfd
  from tensorflow_probability import edward2 as ed

  def model():
    # equivalent to ed.Normal(0., 1., name='x')
    return ed.Func(tfd.Normal(0., 1., name='x'))

  log_joint = ed.make_log_joint_fn(model)
  output = log_joint(x=2.)
  ```
  """

  return _build_custom_rv(arg_0=arg_0,
                          arg_1=arg_1,
                          arg_2=arg_2,
                          name=_simple_name(arg_0))

Wrap an existing distribution as a traceable random variable.

  This enables the use of custom or user-provided distributions in
  Edward models. Unlike a bare `RandomVariable` object, this method
  wraps the constructor so it is included in the Edward trace and its
  values can be properly intercepted and overridden.

  Where possible, you should prefer the built-in constructors
  (`ed.Normal`, etc); these simultaneously construct a Distribution
  and a RandomVariable object so that the distribution parameters
  themselves may be intercepted and overridden. RVs constructed via
  `as_random_variable()` have a fixed distribution and may not support
  program transformations (e.g, conjugate marginalization) that rely
  on overriding distribution parameters.

  Args:
    distribution: tfd.Distribution governing the distribution of the random
      variable, such as sampling and log-probabilities.
    sample_shape: tf.TensorShape of samples to draw from the random variable.
      Default is `()` corresponding to a single sample.
    value: Fixed tf.Tensor to associate with random variable. Must have shape
      `sample_shape + distribution.batch_shape + distribution.event_shape`.
      Default is to sample from random variable according to `sample_shape`.

  Returns:
    rv: a `RandomVariable` wrapping the provided distribution.

  #### Example

  ```python
  from tensorflow_probability import distributions as tfd
  from tensorflow_probability import edward2 as ed

  def model():
    # equivalent to ed.Normal(0., 1., name='x')
    return ed.as_random_variable(tfd.Normal(0., 1., name='x'))

  log_joint = ed.make_log_joint_fn(model)
  output = log_joint(x=2.)
  ```

Wrap an existing distribution as a traceable random variable .


Caches the HTML returned by the specified function `func`. Caches it in
    the user cache determined by the appdirs package.

def Func(arg_0):
    """Caches the HTML returned by the specified function `func`. Caches it in
    the user Func determined by the appdirs package.
    """

    arg_1 = appdirs.user_Func_dir('sportsref', getpass.getuser())
    if not os.path.isdir(arg_1):
        os.makedirs(arg_1)

    @funcutils.wraps(arg_0)
    def wrapper(arg_2):
        # hash based on the URL
        arg_3 = hashlib.md5()
        arg_4 = arg_2.encode(errors='replace')
        arg_3.update(arg_4)
        arg_3 = arg_3.hexdigest()
        arg_5 = '{}/{}'.format(arg_1, arg_3)

        arg_6 = None
        for arg_7, arg_8 in sportsref.SITE_ABBREV.items():
            if arg_2.startswith(arg_7):
                arg_6 = arg_8
                break
        else:
            print('No sport ID found for {}, not able to check Func'.format(arg_2))

        # check whether Func is valid or stale
        arg_9 = os.path.isfile(arg_5)
        if arg_6 and arg_9:
            arg_10 = int(time.time())
            arg_11 = int(os.path.getmtime(arg_5))
            arg_12 = datetime.timedelta(seconds=(arg_10 - arg_11)).days
            arg_13 = globals()['_days_valid_{}'.format(arg_6)](arg_2)
            arg_14 = arg_12 < arg_13
        else:
            arg_14 = False

        # if file found and Func is valid, read from file
        arg_15 = sportsref.get_option('Func')
        if arg_9 and arg_14 and arg_15:
            with codecs.open(arg_5, 'r', encoding='utf-8', errors='replace') as f:
                arg_16 = f.read()
        # otherwise, execute function and Func results
        else:
            arg_16 = arg_0(arg_2)
            with codecs.open(arg_5, 'w+', encoding='utf-8') as f:
                f.write(arg_16)
        return arg_16

    return wrapper

Caches the HTML returned by the specified function func . Caches it in the user cache determined by the appdirs package .


def
Func
(
arg_0
,
arg_1
)
:
for
arg_2
,
arg_3
in
arg_1
:
if
arg_2
in
arg_0
and
arg_3
in
arg_0
:
raise
ValueError
,
'\n*** ERROR in Arguments *** '
'Options '
+
arg_2
+
' and '
+
arg_3
+
' are mutually exclusive.'

def Func(arg_0,arg_1):
    """Check for presence of mutually exclusive keys in a dict.

    Call: Func(dict,[[op1a,op1b],[op2a,op2b]...]"""
    for arg_2,arg_3 in arg_1:
        if arg_2 in arg_0 and arg_3 in arg_0:
            raise ValueError,'\n*** ERROR in Arguments *** '\
                  'Options '+arg_2+' and '+arg_3+' are mutually exclusive.'

Check for presence of mutually exclusive keys in a dict.

    Call: mutex_opts(dict,[[op1a,op1b],[op2a,op2b]...]

Check for presence of mutually exclusive keys in a dict .


def
Func
(
arg_0
)
:
with
tempfile
.
NamedTemporaryFile
(
'w'
)
as
f
:
for
arg_1
in
arg_0
:
f
.
write
(
json
.
dumps
(
arg_1
.
to_dict
(
include_meta
=
True
)
,
default
=
datetime_handler
)
)
f
.
write
(
'\n'
)
f
.
flush
(
)
print_success
(
"Starting editor"
)
subprocess
.
call
(
[
'nano'
,
'-'
,
f
.
name
]
)
with
open
(
f
.
name
,
'r'
)
as
f
:
return
f
.
readlines
(
)

def Func(arg_0):
    """
        Creates a tempfile and starts the given editor, returns the data afterwards.
    """
    with tempfile.NamedTemporaryFile('w') as f:
        for arg_1 in arg_0:
            f.write(json.dumps(arg_1.to_dict(
                include_meta=True),
                default=datetime_handler))
            f.write('\n')
        f.flush()
        print_success("Starting editor")
        subprocess.call(['nano', '-', f.name])
        with open(f.name, 'r') as f:
            return f.readlines()

Creates a tempfile and starts the given editor returns the data afterwards .


def
Func
(
arg_0
)
:
arg_1
,
arg_2
,
arg_3
=
arg_0
try
:
return
periodicvar_recovery
(
arg_1
,
arg_2
,
arg_3
=
arg_3
)
except
Exception
as
e
:
LOGEXCEPTION
(
'periodic var recovery failed for %s'
%
repr
(
arg_0
)
)
return

def Func(arg_0):
    '''This is a parallel worker for running period-recovery.

    Parameters
    ----------

    task : tuple
        This is used to pass args to the `periodicvar_recovery` function::

            task[0] = period-finding result pickle to work on
            task[1] = simbasedir
            task[2] = period_tolerance

    Returns
    -------

    dict
        This is the dict produced by the `periodicvar_recovery` function for the
        input period-finding result pickle.

    '''

    arg_1, arg_2, arg_3 = arg_0

    try:
        return periodicvar_recovery(arg_1,
                                    arg_2,
                                    arg_3=arg_3)

    except Exception as e:
        LOGEXCEPTION('periodic var recovery failed for %s' % repr(arg_0))
        return None

This is a parallel worker for running period - recovery .


def
Func
(
arg_0
,
arg_1
,
arg_2
=
)
:
if
arg_2
is
:
arg_3
=
Funcging
.
INFO
else
:
if
arg_2
==
"trace"
or
arg_2
==
"debug"
:
arg_3
=
Funcging
.
DEBUG
elif
arg_2
==
"info"
:
arg_3
=
Funcging
.
INFO
elif
arg_2
==
"warn"
:
arg_3
=
Funcging
.
WARNING
elif
arg_2
==
"error"
:
arg_3
=
Funcging
.
ERROR
else
:
raise
ValueError
(
"%s is not supported as Funcging level"
%
str
(
arg_2
)
)
arg_0
.
Funcger
.
Func
(
arg_3
,
arg_1
)

def Func(arg_0, arg_1, arg_2=None):
    """Log message, optionally providing a Funcging level

    It is compatible with StreamParse API.

    :type message: str
    :param message: the Func message to send
    :type level: str
    :param level: the Funcging level,
                  one of: trace (=debug), debug, info, warn or error (default: info)
    """
    if arg_2 is None:
      arg_3 = Funcging.INFO
    else:
      if arg_2 == "trace" or arg_2 == "debug":
        arg_3 = Funcging.DEBUG
      elif arg_2 == "info":
        arg_3 = Funcging.INFO
      elif arg_2 == "warn":
        arg_3 = Funcging.WARNING
      elif arg_2 == "error":
        arg_3 = Funcging.ERROR
      else:
        raise ValueError("%s is not supported as Funcging level" % str(arg_2))

    arg_0.Funcger.Func(arg_3, arg_1)

Log message, optionally providing a logging level

    It is compatible with StreamParse API.

    :type message: str
    :param message: the log message to send
    :type level: str
    :param level: the logging level,
                  one of: trace (=debug), debug, info, warn or error (default: info)

Log message optionally providing a logging level


return [len(l) for l in levels] if levels else 0

def Func ( arg_0 ) : arg_1 = arg_0 . levels ( ) return [ len ( arg_2 ) for arg_2 in arg_1 ] if arg_1 else 0

def Func(arg_0):
        """
        Get the number of factor levels for each categorical column.

        :returns: A list of the number of levels per column.
        """
        arg_1 = arg_0.levels()
        return [len(arg_2) for arg_2 in arg_1] if arg_1 else 0

Get the number of factor levels for each categorical column .


def Func ( arg_0 ) : if arg_0 and isinstance ( arg_0 , str ) : load_config ( True ) return Check ( arg_0 ) . is_url_valid ( ) return None

def Func(arg_0):  # pragma: no cover
    """
    Check the syntax of the given URL.

    :param url: The URL to check the syntax for.
    :type url: str

    :return: The syntax validity.
    :rtype: bool

    .. warning::
        If an empty or a non-string :code:`url` is given, we return :code:`None`.
    """

    if arg_0 and isinstance(arg_0, str):
        # The given URL is not empty nor None.
        # and
        # * The given URL is a string.

        # We silently load the configuration.
        load_config(True)

        return Check(arg_0).is_url_valid()

    # We return None, there is nothing to check.
    return None


def Func ( arg_0 ) : if not mcmc_util . is_list_like ( arg_0 ) : arg_0 = [ arg_0 ] def fn ( arg_1 , arg_2 ) : return sum ( [ arg_3 . forward_log_det_jacobian ( arg_5 , arg_2 = arg_4 ) for arg_3 , arg_4 , arg_5 in zip ( arg_0 , arg_2 , arg_1 ) ] ) return fn

def Func(arg_0):
  """Makes a function which applies a list of Bijectors' `log_det_jacobian`s."""
  if not mcmc_util.is_list_like(arg_0):
    arg_0 = [arg_0]

  def fn(arg_1, arg_2):
    return sum([
        arg_3.forward_log_det_jacobian(arg_5, arg_2=arg_4)
        for arg_3, arg_4, arg_5 in zip(arg_0, arg_2, arg_1)
    ])

  return fn

Makes a function which applies a list of Bijectors log_det_jacobian s .


def Func ( arg_0 ) : if arg_0 . parent : try : arg_0 . parent . contents . remove ( arg_0 ) except ValueError : pass arg_1 = arg_0 . _lastRecursiveChild ( ) arg_2 = arg_1 . next if arg_0 . previous : arg_0 . previous . next = arg_2 if arg_2 : arg_2 . previous = arg_0 . previous arg_0 . previous = None arg_1 . next = None arg_0 . parent = None if arg_0 . previousSibling : arg_0 . previousSibling . nextSibling = arg_0 . nextSibling if arg_0 . nextSibling : arg_0 . nextSibling . previousSibling = arg_0 . previousSibling arg_0 . previousSibling = arg_0 . nextSibling = None return arg_0

def Func(arg_0):
        """Destructively rips this element out of the tree."""
        if arg_0.parent:
            try:
                arg_0.parent.contents.remove(arg_0)
            except ValueError:
                pass

        #Find the two elements that would be next to each other if
        #this element (and any children) hadn't been parsed. Connect
        #the two.
        arg_1 = arg_0._lastRecursiveChild()
        arg_2 = arg_1.next

        if arg_0.previous:
            arg_0.previous.next = arg_2
        if arg_2:
            arg_2.previous = arg_0.previous
        arg_0.previous = None
        arg_1.next = None

        arg_0.parent = None
        if arg_0.previousSibling:
            arg_0.previousSibling.nextSibling = arg_0.nextSibling
        if arg_0.nextSibling:
            arg_0.nextSibling.previousSibling = arg_0.previousSibling
        arg_0.previousSibling = arg_0.nextSibling = None
        return arg_0

Destructively rips this element out of the tree .


(host, port, profiler_stats, dont_start_browser, debug_mode)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
,
arg_4
)
:
arg_5
=
functools
.
partial
(
StatsHandler
,
arg_2
)
if
not
arg_4
:
arg_6
.
stderr
=
open
(
os
.
devnull
,
'w'
)
print
(
'Starting HTTP server...'
)
if
not
arg_3
:
webbrowser
.
open
(
'http://{}:{}/'
.
format
(
arg_0
,
arg_1
)
)
try
:
StatsServer
(
(
arg_0
,
arg_1
)
,
arg_5
)
.
serve_forever
(
)
except
KeyboardInterrupt
:
print
(
'Stopping...'
)
arg_6
.
exit
(
0
)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    """Starts HTTP server with specified parameters.

    Args:
        host: Server host name.
        port: Server port.
        profiler_stats: A dict with collected program stats.
        dont_Func_browser: Whether to open browser after profiling.
        debug_mode: Whether to redirect stderr to /dev/null.
    """
    arg_5 = functools.partial(StatsHandler, arg_2)
    if not arg_4:
        arg_6.stderr = open(os.devnull, 'w')
    print('Starting HTTP server...')
    if not arg_3:
        webbrowser.open('http://{}:{}/'.format(arg_0, arg_1))
    try:
        StatsServer((arg_0, arg_1), arg_5).serve_forever()
    except KeyboardInterrupt:
        print('Stopping...')
        arg_6.exit(0)

Starts HTTP server with specified parameters.

    Args:
        host: Server host name.
        port: Server port.
        profiler_stats: A dict with collected program stats.
        dont_start_browser: Whether to open browser after profiling.
        debug_mode: Whether to redirect stderr to /dev/null.

Starts HTTP server with specified parameters .


def Func ( arg_0 , arg_1 , arg_2 = None ) : _validate_not_none ( 'hub_name' , arg_1 ) arg_3 = HTTPRequest ( ) arg_3 . method = 'PUT' arg_3 . host = arg_0 . _get_host ( ) arg_3 . path = '/' + _str ( arg_1 ) + '?api-version=2014-01' arg_3 . body = _get_request_body ( _convert_event_hub_to_xml ( arg_2 ) ) arg_3 . path , arg_3 . query = arg_0 . _httpclient . _update_request_uri_query ( arg_3 ) arg_3 . headers . append ( ( 'If-Match' , '*' ) ) arg_3 . headers = arg_0 . _update_service_bus_header ( arg_3 ) arg_10 = arg_0 . _perform_request ( arg_3 ) return _convert_response_to_event_hub ( arg_10 )

def Func(arg_0, arg_1, arg_2=None):
        '''
        Updates an Event Hub.

        hub_name:
            Name of event hub.
        hub:
            Optional. Event hub properties. Instance of EventHub class.
        hub.message_retention_in_days:
            Number of days to retain the events for this Event Hub.
        '''
        _validate_not_none('hub_name', arg_1)
        arg_3 = HTTPRequest()
        arg_3.method = 'PUT'
        arg_3.host = arg_0._get_host()
        arg_3.path = '/' + _str(arg_1) + '?api-version=2014-01'
        arg_3.body = _get_request_body(_convert_event_hub_to_xml(arg_2))
        arg_3.path, arg_3.query = arg_0._httpclient._update_request_uri_query(arg_3)  # pylint: disable=protected-access
        arg_3.headers.append(('If-Match', '*'))
        arg_3.headers = arg_0._update_service_bus_header(arg_3)
        arg_10 = arg_0._perform_request(arg_3)

        return _convert_response_to_event_hub(arg_10)


def Func(arg_0, arg_1, arg_2=None):
        """Creates new or follows existing group nodes along a given colon separated `key`.

        :param key:

            Colon separated path along hdf5 file, e.g. `parameters.mobiles.cars`.

        :param start_hdf5_group:

            HDF5 group from where to start, leave `None` for the trajectory group.

        :return:

            Final group node, e.g. group node with name `cars`.

        """
        if arg_2 is None:
            arg_3 = arg_0._trajectory_group
        else:
            arg_3 = arg_2
        arg_4 = False
        if arg_1 == '':
            return arg_3, arg_4
        arg_5 = arg_1.split('.')
        for arg_6 in arg_5:
            arg_3, arg_4 = arg_0._all_create_or_get_group(arg_6, arg_3)

        return arg_3, arg_4

Creates new or follows existing group nodes along a given colon separated key .


def Func ( arg_0 ) : arg_1 = [ ] for arg_2 in ast . walk ( ast . parse ( arg_0 ) ) : if isinstance ( arg_2 , ast . Str ) : arg_1 . append ( arg_2 . s ) return arg_1

def Func(arg_0):
    """Returns all valid python strings inside a given argument string."""
    arg_1 = []
    for arg_2 in ast.walk(ast.parse(arg_0)):
        if isinstance(arg_2, ast.Str):
            arg_1.append(arg_2.s)
    return arg_1

Returns all valid python strings inside a given argument string .


def Func ( arg_0 , arg_1 = 'mean' ) : arg_1 = _get_funky ( arg_1 ) arg_2 = arg_0 . groupby ( lambda x : x . month ) . aggregate ( arg_1 ) arg_2 . index = [ cal . month_name [ i ] for i in range ( 1 , 13 ) ] return arg_2

def Func(arg_0, arg_1='mean'):
    """
    Calcul du profil annuel

    Paramètres:
    df: DataFrame de données dont l'index est une série temporelle
        (cf module xair par exemple)
    func: function permettant le calcul. Soit un nom de fonction numpy ('mean', 'max', ...)
        soit la fonction elle-même (np.mean, np.max, ...)
    Retourne:
    Un DataFrame de moyennes par mois
    """

    arg_1 = _get_funky(arg_1)
    arg_2 = arg_0.groupby(lambda x: x.month).aggregate(arg_1)
    # On met des noms de mois à la place des numéros dans l'index
    arg_2.index = [cal.month_name[i] for i in range(1,13)]
    return arg_2


def Func(arg_0, arg_1):
        """Processes a scheduled consumption request that has completed

        :type token: RequestToken
        :param token: The token associated to the consumption
            request that is used to identify the request.
        """
        arg_2 = arg_0._tokens_to_scheduled_consumption.pop(arg_1)
        arg_0._total_wait = max(
            arg_0._total_wait - arg_2['time_to_consume'], 0)


def Func(arg_0, arg_1):
        """Return a full path to a notebook given its name."""
        arg_2 = arg_1 + arg_0.filename_ext
        arg_3 = os.path.join(arg_0.notebook_dir, arg_2)
        return arg_3

Return a full path to a notebook given its name .


(self, format='html5', deparagraph=True,
                           mathjax=False, smart=True, extra_args=None)

def Func(arg_0, arg_1='html5', arg_2=True,
                           arg_3=False, arg_4=True, arg_5=None):
        """Get the document short title in the specified markup format.

        Parameters
        ----------
        format : `str`, optional
            Output format (such as ``'html5'`` or ``'plain'``).
        deparagraph : `bool`, optional
            Remove the paragraph tags from single paragraph content.
        mathjax : `bool`, optional
            Allow pandoc to use MathJax math markup.
        smart : `True`, optional
            Allow pandoc to create "smart" unicode punctuation.
        extra_args : `list`, optional
            Additional command line flags to pass to Pandoc. See
            `lsstprojectmeta.pandoc.convert.convert_text`.

        Returns
        -------
        output_text : `str`
            Converted content or `None` if the short title is not available in
            the document.
        """
        if arg_0.short_title is None:
            return None

        arg_6 = convert_lsstdoc_tex(
            arg_0.short_title, 'html5',
            arg_2=arg_2,
            arg_3=arg_3,
            arg_4=arg_4,
            arg_5=arg_5)
        return arg_6

Get the document short title in the specified markup format .


(header, input_file_param_util,
                            output_file_param_util)

def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
[
]
for
arg_4
in
arg_0
:
arg_5
=
'--env'
arg_6
=
arg_4
if
arg_4
.
startswith
(
'-'
)
:
arg_5
,
arg_6
=
split_pair
(
arg_4
,
' '
,
1
)
if
arg_5
==
'--env'
:
arg_3
.
append
(
job_model
.
EnvParam
(
arg_6
)
)
elif
arg_5
==
'--label'
:
arg_3
.
append
(
job_model
.
LabelParam
(
arg_6
)
)
elif
arg_5
==
'--input'
or
arg_5
==
'--input-recursive'
:
arg_7
=
arg_1
.
get_variable_name
(
arg_6
)
arg_3
.
append
(
job_model
.
InputFileParam
(
arg_7
,
recursive
=
(
arg_5
.
endswith
(
'recursive'
)
)
)
)
elif
arg_5
==
'--output'
or
arg_5
==
'--output-recursive'
:
arg_7
=
arg_2
.
get_variable_name
(
arg_6
)
arg_3
.
append
(
job_model
.
OutputFileParam
(
arg_7
,
recursive
=
(
arg_5
.
endswith
(
'recursive'
)
)
)
)
else
:
raise
ValueError
(
'Unrecognized column header: %s'
%
arg_4
)
return
arg_3

def Func(arg_0, arg_1,
                            arg_2):
  """Parse the header from the tasks file into env, input, output definitions.

  Elements are formatted similar to their equivalent command-line arguments,
  but with associated values coming from the data rows.

  Environment variables columns are headered as "--env <name>"
  Inputs columns are headered as "--input <name>" with the name optional.
  Outputs columns are headered as "--output <name>" with the name optional.

  For historical reasons, bareword column headers (such as "JOB_ID") are
  equivalent to "--env var_name".

  Args:
    header: Array of header fields
    input_file_param_util: Utility for producing InputFileParam objects.
    output_file_param_util: Utility for producing OutputFileParam objects.

  Returns:
    job_params: A list of EnvParams and FileParams for the environment
    variables, LabelParams, input file parameters, and output file parameters.

  Raises:
    ValueError: If a header contains a ":" and the prefix is not supported.
  """
  arg_3 = []

  for arg_4 in arg_0:

    # Reserve the "-" and "--" namespace.
    # If the column has no leading "-", treat it as an environment variable
    arg_5 = '--env'
    arg_6 = arg_4
    if arg_4.startswith('-'):
      arg_5, arg_6 = split_pair(arg_4, ' ', 1)

    if arg_5 == '--env':
      arg_3.append(job_model.EnvParam(arg_6))

    elif arg_5 == '--label':
      arg_3.append(job_model.LabelParam(arg_6))

    elif arg_5 == '--input' or arg_5 == '--input-recursive':
      arg_7 = arg_1.get_variable_name(arg_6)
      arg_3.append(
          job_model.InputFileParam(
              arg_7, recursive=(arg_5.endswith('recursive'))))

    elif arg_5 == '--output' or arg_5 == '--output-recursive':
      arg_7 = arg_2.get_variable_name(arg_6)
      arg_3.append(
          job_model.OutputFileParam(
              arg_7, recursive=(arg_5.endswith('recursive'))))

    else:
      raise ValueError('Unrecognized column header: %s' % arg_4)

  return arg_3

Parse the header from the tasks file into env input output definitions .


def Func ( arg_0 , arg_1 = False ) : if arg_1 or arg_0 . call_pdb : if arg_0 . pdb is None : arg_0 . pdb = Func . Pdb ( arg_0 . color_scheme_table . active_scheme_name ) arg_3 = DisplayTrap ( hook = sys . __displayhook__ ) with arg_3 : arg_0 . pdb . reset ( ) if hasattr ( arg_0 , 'tb' ) and arg_0 . tb is not None : arg_4 = arg_0 . tb else : arg_4 = arg_0 . tb = sys . last_traceback while arg_0 . tb is not None and arg_0 . tb . tb_next is not None : arg_0 . tb = arg_0 . tb . tb_next if arg_4 and arg_4 . tb_next : arg_4 = arg_4 . tb_next arg_0 . pdb . botframe = arg_4 . tb_frame arg_0 . pdb . interaction ( arg_0 . tb . tb_frame , arg_0 . tb ) if hasattr ( arg_0 , 'tb' ) : del arg_0 . tb

def Func(arg_0,arg_1=False):
        """Call up the pdb Func if desired, always clean up the tb
        reference.

        Keywords:

          - force(False): by default, this routine checks the instance call_pdb
          flag and does not actually invoke the Func if the flag is false.
          The 'force' option forces the Func to activate even if the flag
          is false.

        If the call_pdb flag is set, the pdb interactive Func is
        invoked. In all cases, the self.tb reference to the current traceback
        is deleted to prevent lingering references which hamper memory
        management.

        Note that each call to pdb() does an 'import readline', so if your app
        requires a special setup for the readline completers, you'll have to
        fix that by hand after invoking the exception handler."""

        if arg_1 or arg_0.call_pdb:
            if arg_0.pdb is None:
                arg_0.pdb = Func.Pdb(
                    arg_0.color_scheme_table.active_scheme_name)
            # the system displayhook may have changed, restore the original
            # for pdb
            arg_3 = DisplayTrap(hook=sys.__displayhook__)
            with arg_3:
                arg_0.pdb.reset()
                # Find the right frame so we don't pop up inside ipython itself
                if hasattr(arg_0,'tb') and arg_0.tb is not None:
                    arg_4 = arg_0.tb
                else:
                    arg_4 = arg_0.tb = sys.last_traceback
                while arg_0.tb is not None and arg_0.tb.tb_next is not None:
                    arg_0.tb = arg_0.tb.tb_next
                if arg_4 and arg_4.tb_next:
                    arg_4 = arg_4.tb_next
                arg_0.pdb.botframe = arg_4.tb_frame
                arg_0.pdb.interaction(arg_0.tb.tb_frame, arg_0.tb)

        if hasattr(arg_0,'tb'):
            del arg_0.tb

Call up the pdb debugger if desired, always clean up the tb
        reference.

        Keywords:

          - force(False): by default, this routine checks the instance call_pdb
          flag and does not actually invoke the debugger if the flag is false.
          The 'force' option forces the debugger to activate even if the flag
          is false.

        If the call_pdb flag is set, the pdb interactive debugger is
        invoked. In all cases, the self.tb reference to the current traceback
        is deleted to prevent lingering references which hamper memory
        management.

        Note that each call to pdb() does an 'import readline', so if your app
        requires a special setup for the readline completers, you'll have to
        fix that by hand after invoking the exception handler.

Call up the pdb debugger if desired always clean up the tb reference .


(ctx, name, description, tags, private, init)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5):
    """Create a new project.

    Uses [Caching](/references/polyaxon-cli/#caching)

    Example:

    \b
    ```bash
    $ polyaxon project Func --name=cats-vs-dogs --description="Image Classification with DL"
    ```
    """
    try:
        arg_3 = arg_3.split(',') if arg_3 else None
        arg_6 = dict(arg_1=arg_1, arg_2=arg_2, is_public=not arg_4, arg_3=arg_3)
        arg_7 = ProjectConfig.from_dict(arg_6)
    except ValidationError:
        Printer.print_error('Project name should contain only alpha numerical, "-", and "_".')
        sys.exit(1)

    try:
        arg_8 = PolyaxonClient().project.Func_project(arg_7)
    except (PolyaxonHTTPError, PolyaxonShouldExitError, PolyaxonClientException) as e:
        Printer.print_error('Could not Func project `{}`.'.format(arg_1))
        Printer.print_error('Error message `{}`.'.format(e))
        sys.exit(1)

    Printer.print_success("Project `{}` was Funcd successfully.".format(arg_8.name))

    if arg_5:
        arg_0.obj = {}
        arg_0.invoke(init_project, project=arg_1)

Create a new project.

    Uses [Caching](/references/polyaxon-cli/#caching)

    Example:

    \b
    ```bash
    $ polyaxon project create --name=cats-vs-dogs --description="Image Classification with DL"
    ```


def Func ( arg_0 ) : if not arg_0 . enable_calltips : return False arg_1 = arg_0 . _get_cursor ( ) arg_1 . movePosition ( QtGui . QTextCursor . Left ) if arg_1 . document ( ) . characterAt ( arg_1 . position ( ) ) != '(' : return False arg_2 = arg_0 . _get_context ( arg_1 ) if not arg_2 : return False arg_3 = '.' . join ( arg_2 ) arg_4 = arg_0 . kernel_manager . shell_channel . object_info ( arg_3 ) arg_5 = arg_0 . _get_cursor ( ) . position ( ) arg_0 . _request_info [ 'call_tip' ] = arg_0 . _CallTipRequest ( arg_4 , arg_5 ) return True

def Func(arg_0):
        """ Shows a call tip, if appropriate, at the current cursor location.
        """
        # Decide if it makes sense to show a call tip
        if not arg_0.enable_calltips:
            return False
        arg_1 = arg_0._get_cursor()
        arg_1.movePosition(QtGui.QTextCursor.Left)
        if arg_1.document().characterAt(arg_1.position()) != '(':
            return False
        arg_2 = arg_0._get_context(arg_1)
        if not arg_2:
            return False

        # Send the metadata request to the kernel
        arg_3 = '.'.join(arg_2)
        arg_4 = arg_0.kernel_manager.shell_channel.object_info(arg_3)
        arg_5 = arg_0._get_cursor().position()
        arg_0._request_info['call_tip'] = arg_0._CallTipRequest(arg_4, arg_5)
        return True

Shows a call tip if appropriate at the current cursor location .


return struct.pack('>16si', si_key[0], si_key[1])

def
Func
(
arg_0
)
:
if
len
(
arg_0
[
0
]
)
!=
16
:
raise
ValueError
(
'bad StreamItem key, expected 16 byte '
'md5 hash binary digest, got: {0!r}'
.
format
(
arg_0
)
)
return
struct
.
pack
(
'>16si'
,
arg_0
[
0
]
,
arg_0
[
1
]
)

def Func(arg_0):
    '''
    Return packed bytes representation of StreamItem kvlayer key.
    The result is 20 bytes, 16 of md5 hash, 4 of int timestamp.
    '''
    if len(arg_0[0]) != 16:
        raise ValueError('bad StreamItem key, expected 16 byte '
                         'md5 hash binary digest, got: {0!r}'.format(arg_0))
    return struct.pack('>16si', arg_0[0], arg_0[1])

Return packed bytes representation of StreamItem kvlayer key . The result is 20 bytes 16 of md5 hash 4 of int timestamp .


def Func(arg_0):
    """
    Parse args from command line by creating argument parser instance and
    process it.

    :param args: Command line arguments list.
    """
    from argparse import ArgumentParser

    arg_1 = ('Bootstrap Python projects and libraries with virtualenv '
                   'and pip.')
    arg_2 = ArgumentParser(arg_1=arg_1)
    arg_2.add_argument('--version', action='version', version=__version__)

    arg_2.add_argument(
        '-c', '--config', default=DEFAULT_CONFIG,
        help='Path to config file. By default: {0}'.format(DEFAULT_CONFIG)
    )
    arg_2.add_argument(
        '-p', '--pre-requirements', default=[], nargs='+',
        help='List of pre-requirements to check, separated by space.'
    )
    arg_2.add_argument(
        '-e', '--env',
        help='Virtual environment name. By default: {0}'.
             format(CONFIG[__script__]['env'])
    )
    arg_2.add_argument(
        '-r', '--requirements',
        help='Path to requirements file. By default: {0}'.
             format(CONFIG[__script__]['requirements'])
    )
    arg_2.add_argument(
        '-d', '--install-dev-requirements', action='store_true', default=None,
        help='Install prefixed or suffixed "dev" requirements after '
             'installation of original requirements file or library completed '
             'without errors.'
    )
    arg_2.add_argument(
        '-C', '--hook', help='Execute this hook after bootstrap process.'
    )
    arg_2.add_argument(
        '--ignore-activated', action='store_true', default=None,
        help='Ignore pre-activated virtualenv, like on Travis CI.'
    )
    arg_2.add_argument(
        '--recreate', action='store_true', default=None,
        help='Recreate virtualenv on every run.'
    )
    arg_2.add_argument(
        '-q', '--quiet', action='store_true', default=None,
        help='Minimize output, show only error messages.'
    )

    return arg_2.Func(arg_0)

Parse args from command line by creating argument parser instance and process it .


def
Func
(
arg_0
,
arg_1
)
:
log
.
info
(
'Changing communication to %s baud'
,
arg_1
)
arg_0
.
__writeln
(
UART_SETUP
.
format
(
arg_1
=
arg_1
)
)
time
.
sleep
(
0.1
)
try
:
arg_0
.
_port
.
setBaudrate
(
arg_1
)
except
AttributeError
:
arg_0
.
_port
.
baudrate
=
arg_1

def Func(arg_0, arg_1):
        """setting baudrate if supported"""
        log.info('Changing communication to %s baud', arg_1)
        arg_0.__writeln(UART_SETUP.format(arg_1=arg_1))
        # Wait for the string to be sent before switching baud
        time.sleep(0.1)
        try:
            arg_0._port.setBaudrate(arg_1)
        except AttributeError:
            #pySerial 2.7
            arg_0._port.baudrate = arg_1


def Func(arg_0, arg_1, arg_2):
        """Returns the bit specified from the address.

        :param bit_num: The bit number to read from.
        :type bit_num: int
        :param address: The address to read from.
        :type address: int
        :returns: int -- the bit value from the address
        """
        arg_3 = arg_0.read(arg_2)
        arg_4 = get_bit_mask(arg_1)
        return 1 if arg_3 & arg_4 else 0

Returns the bit specified from the address .


def Func ( arg_0 , arg_1 ) : if arg_1 not in arg_0 . Func_cache : if not os . path . isabs ( arg_1 ) : for arg_2 in [ os . curdir ] + sys . path : if arg_2 is None : continue arg_3 = os . path . join ( arg_2 , arg_1 ) if os . path . exists ( arg_3 ) : arg_1 = arg_3 break arg_4 = abs_file ( arg_1 ) arg_0 . Func_cache [ arg_1 ] = arg_4 return arg_0 . Func_cache [ arg_1 ]

def Func(arg_0, arg_1):
        """Return a canonical filename for `filename`.

        An absolute path with no redundant components and normalized case.

        """
        if arg_1 not in arg_0.Func_cache:
            if not os.path.isabs(arg_1):
                for arg_2 in [os.curdir] + sys.path:
                    if arg_2 is None:
                        continue
                    arg_3 = os.path.join(arg_2, arg_1)
                    if os.path.exists(arg_3):
                        arg_1 = arg_3
                        break
            arg_4 = abs_file(arg_1)
            arg_0.Func_cache[arg_1] = arg_4
        return arg_0.Func_cache[arg_1]

Return a canonical filename for filename .


def Func(arg_0, arg_1, arg_2=arg_3.KMIPVersion.KMIP_1_0):
        """
        Read the data encoding the GetAttributeList response payload and
        decode it into its constituent parts.

        Args:
            input_buffer (stream): A data stream containing encoded object
                data, supporting a Func method; usually a BytearrayStream
                object.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.

        Raises:
            InvalidKmipEncoding: Raised if the unique identifier or attribute
                names are missing from the encoded payload.
        """
        super(GetAttributeListResponsePayload, arg_0).Func(
            arg_1,
            arg_2=arg_2
        )
        arg_6 = utils.BytearrayStream(arg_1.Func(arg_0.length))

        if arg_0.is_tag_next(arg_3.Tags.UNIQUE_IDENTIFIER, arg_6):
            arg_0._unique_identifier = primitives.TextString(
                tag=arg_3.Tags.UNIQUE_IDENTIFIER
            )
            arg_0._unique_identifier.Func(
                arg_6,
                arg_2=arg_2
            )
        else:
            raise exceptions.InvalidKmipEncoding(
                "The GetAttributeList response payload encoding is missing "
                "the unique identifier."
            )

        arg_8 = list()
        if arg_2 < arg_3.KMIPVersion.KMIP_2_0:
            while arg_0.is_tag_next(arg_3.Tags.ATTRIBUTE_NAME, arg_6):
                arg_9 = primitives.TextString(tag=arg_3.Tags.ATTRIBUTE_NAME)
                arg_9.Func(arg_6, arg_2=arg_2)
                arg_8.append(arg_9)
            if len(arg_8) == 0:
                raise exceptions.InvalidKmipEncoding(
                    "The GetAttributeList response payload encoding is "
                    "missing the attribute names."
                )
            arg_0._attribute_names = arg_8
        else:
            while arg_0.is_tag_next(
                    arg_3.Tags.ATTRIBUTE_REFERENCE,
                    arg_6
            ):
                if arg_0.is_type_next(arg_3.Types.STRUCTURE, arg_6):
                    arg_11 = objects.AttributeReference()
                    arg_11.Func(arg_6, arg_2=arg_2)
                    arg_8.append(
                        primitives.TextString(
                            value=arg_11.attribute_name,
                            tag=arg_3.Tags.ATTRIBUTE_NAME
                        )
                    )
                elif arg_0.is_type_next(arg_3.Types.ENUMERATION, arg_6):
                    arg_11 = primitives.Enumeration(
                        arg_3.Tags,
                        tag=arg_3.Tags.ATTRIBUTE_REFERENCE
                    )
                    arg_11.Func(arg_6, arg_2=arg_2)
                    arg_9 = arg_3.convert_attribute_tag_to_name(arg_11.value)
                    arg_8.append(
                        primitives.TextString(
                            value=arg_9,
                            tag=arg_3.Tags.ATTRIBUTE_NAME
                        )
                    )
                else:
                    raise exceptions.InvalidKmipEncoding(
                        "The GetAttributeList response payload encoding "
                        "contains an invalid AttributeReference type."
                    )
            arg_0._attribute_names = arg_8

        arg_0.is_oversized(arg_6)

Read the data encoding the GetAttributeList response payload and
        decode it into its constituent parts.

        Args:
            input_buffer (stream): A data stream containing encoded object
                data, supporting a read method; usually a BytearrayStream
                object.
            kmip_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.

        Raises:
            InvalidKmipEncoding: Raised if the unique identifier or attribute
                names are missing from the encoded payload.

Read the data encoding the GetAttributeList response payload and decode it into its constituent parts .


def Func ( arg_0 ) : arg_1 = array ( 'c' , '.' * len ( arg_0 ) ) for arg_2 in xrange ( len ( arg_0 ) ) : if arg_0 [ arg_2 ] == 1 : arg_1 [ arg_2 ] = '*' return arg_1

def Func(arg_0):
  """Returns a string representing a numpy array of 0's and 1's"""
  arg_1 = array('c','.'*len(arg_0))
  for arg_2 in xrange(len(arg_0)):
    if arg_0[arg_2] == 1:
      arg_1[arg_2]='*'
  return arg_1

Returns a string representing a numpy array of 0 s and 1 s


return any(fnmatch.fnmatch(filename, pat) for pat in patterns)

def Func ( arg_0 , arg_1 ) : return any ( fnmatch . fnmatch ( arg_0 , arg_2 ) for arg_2 in arg_1 )

def Func(arg_0, arg_1):
    """Does this filename match any of the patterns?"""
    return any(fnmatch.fnmatch(arg_0, arg_2) for arg_2 in arg_1)


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 [ '{SCORE}' ] = arg_0 . scores [ arg_0 . score ] arg_0 . arguments [ '{CUTOFF}' ] = str ( arg_0 . cutoff ) arg_0 . arguments [ '{VARSEL}' ] = str ( arg_0 . variablesel ) . upper ( ) arg_0 . arguments [ '{SELMETHOD}' ] = arg_0 . var_selection [ arg_0 . selmethod ] arg_0 . arguments [ '{PRUNING}' ] = str ( arg_0 . pruning ) . upper ( ) arg_0 . arguments [ '{PRUNMETHOD}' ] = arg_0 . var_selection [ arg_0 . prunmethod ] arg_0 . arguments [ '{NJOBS}' ] = str ( arg_0 . nb_jobs ) arg_0 . arguments [ '{VERBOSE}' ] = str ( arg_0 . verbose ) . upper ( ) arg_4 = arg_0 . _run_cam ( arg_1 , verbose = arg_0 . verbose ) return nx . relabel_nodes ( nx . DiGraph ( arg_4 ) , { arg_5 : arg_6 for arg_5 , arg_6 in enumerate ( arg_1 . columns ) } )

def Func(arg_0, arg_1, **arg_2):
        """Apply causal discovery on observational data using CAM.

        Args:
            data (pandas.DataFrame): DataFrame containing the data

        Returns:
            networkx.DiGraph: Solution given by the CAM algorithm.
        """
        # Building setup w/ arguments.
        arg_0.arguments['{SCORE}'] = arg_0.scores[arg_0.score]
        arg_0.arguments['{CUTOFF}'] = str(arg_0.cutoff)
        arg_0.arguments['{VARSEL}'] = str(arg_0.variablesel).upper()
        arg_0.arguments['{SELMETHOD}'] = arg_0.var_selection[arg_0.selmethod]
        arg_0.arguments['{PRUNING}'] = str(arg_0.pruning).upper()
        arg_0.arguments['{PRUNMETHOD}'] = arg_0.var_selection[arg_0.prunmethod]
        arg_0.arguments['{NJOBS}'] = str(arg_0.nb_jobs)
        arg_0.arguments['{VERBOSE}'] = str(arg_0.verbose).upper()
        arg_4 = arg_0._run_cam(arg_1, verbose=arg_0.verbose)

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

Apply causal discovery on observational data using CAM .


(self,
                      image,
                      color=(0, 255, 0), color_face=None,
                      color_lines=None, color_points=None,
                      alpha=1.0, alpha_face=None,
                      alpha_lines=None, alpha_points=None,
                      size=1, size_lines=None, size_points=None,
                      raise_if_out_of_image=False)

def Func(arg_0,
                      arg_1,
                      arg_2=(0, 255, 0), arg_3=None,
                      arg_4=None, arg_5=None,
                      arg_6=1.0, arg_7=None,
                      arg_8=None, arg_9=None,
                      arg_10=1, arg_11=None, arg_12=None,
                      arg_13=False):
        """
        Draw all polygons onto a given image.

        Parameters
        ----------
        image : (H,W,C) ndarray
            The image onto which to draw the bounding boxes.
            This image should usually have the same shape as set in
            ``PolygonsOnImage.shape``.

        color : iterable of int, optional
            The color to use for the whole polygons.
            Must correspond to the channel layout of the image. Usually RGB.
            The values for `color_face`, `color_lines` and `color_points`
            will be derived from this color if they are set to ``None``.
            This argument has no effect if `color_face`, `color_lines`
            and `color_points` are all set anything other than ``None``.

        color_face : None or iterable of int, optional
            The color to use for the inner polygon areas (excluding perimeters).
            Must correspond to the channel layout of the image. Usually RGB.
            If this is ``None``, it will be derived from ``color * 1.0``.

        color_lines : None or iterable of int, optional
            The color to use for the lines (aka perimeters/borders) of the
            polygons. Must correspond to the channel layout of the image.
            Usually RGB. If this is ``None``, it will be derived
            from ``color * 0.5``.

        color_points : None or iterable of int, optional
            The color to use for the corner points of the polygons.
            Must correspond to the channel layout of the image. Usually RGB.
            If this is ``None``, it will be derived from ``color * 0.5``.

        alpha : float, optional
            The opacity of the whole polygons, where ``1.0`` denotes
            completely visible polygons and ``0.0`` invisible ones.
            The values for `alpha_face`, `alpha_lines` and `alpha_points`
            will be derived from this alpha value if they are set to ``None``.
            This argument has no effect if `alpha_face`, `alpha_lines`
            and `alpha_points` are all set anything other than ``None``.

        alpha_face : None or number, optional
            The opacity of the polygon's inner areas (excluding the perimeters),
            where ``1.0`` denotes completely visible inner areas and ``0.0``
            invisible ones.
            If this is ``None``, it will be derived from ``alpha * 0.5``.

        alpha_lines : None or number, optional
            The opacity of the polygon's lines (aka perimeters/borders),
            where ``1.0`` denotes completely visible perimeters and ``0.0``
            invisible ones.
            If this is ``None``, it will be derived from ``alpha * 1.0``.

        alpha_points : None or number, optional
            The opacity of the polygon's corner points, where ``1.0`` denotes
            completely visible corners and ``0.0`` invisible ones.
            Currently this is an on/off choice, i.e. only ``0.0`` or ``1.0``
            are allowed.
            If this is ``None``, it will be derived from ``alpha * 1.0``.

        size : int, optional
            Size of the polygons.
            The sizes of the line and points are derived from this value,
            unless they are set.

        size_lines : None or int, optional
            Thickness of the polygon lines (aka perimeter/border).
            If ``None``, this value is derived from `size`.

        size_points : int, optional
            The size of all corner points. If set to ``C``, each corner point
            will be drawn as a square of size ``C x C``.

        raise_if_out_of_image : bool, optional
            Whether to raise an error if any polygon is fully
            outside of the image. If set to False, no error will be raised and
            only the parts inside the image will be drawn.

        Returns
        -------
        image : (H,W,C) ndarray
            Image with drawn polygons.

        """
        for arg_14 in arg_0.polygons:
            arg_1 = arg_14.Func(
                arg_1,
                arg_2=arg_2,
                arg_3=arg_3,
                arg_4=arg_4,
                arg_5=arg_5,
                arg_6=arg_6,
                arg_7=arg_7,
                arg_8=arg_8,
                arg_9=arg_9,
                arg_10=arg_10,
                arg_11=arg_11,
                arg_12=arg_12,
                arg_13=arg_13
            )
        return arg_1


def
Func
(
arg_0
)
:
arg_1
=
DEVICE_URL
%
arg_0
arg_2
=
requests
.
get
(
arg_1
,
headers
=
HEADERS
)
arg_3
=
str
(
arg_2
.
status_code
)
if
arg_3
==
'401'
:
_LOGGER
.
error
(
"Token expired."
)
return
False
return
arg_2
.
json
(
)

def Func(arg_0):
        """
        Pull a device from the API.
        """
        arg_1 = DEVICE_URL % arg_0
        arg_2 = requests.get(arg_1, headers=HEADERS)
        arg_3 = str(arg_2.status_code)
        if arg_3 == '401':
            _LOGGER.error("Token expired.")
            return False
        return arg_2.json()


return bleach.clean(text, tags=allowed_tags, attributes=['id', 'class', 'style', 'href', 'title'], strip=True)

def Func ( arg_0 , arg_1 = None ) : if arg_0 is None : return if arg_1 is None : arg_1 = ALLOWED_TAGS return bleach . clean ( arg_0 , tags = arg_1 , attributes = [ 'id' , 'class' , 'style' , 'href' , 'title' ] , strip = True )

def Func(arg_0, arg_1=None):
    """
    Strip all tags from a string except those tags provided in `allowed_tags` parameter.

    Args:
        text (str): string to strip html tags from
        allowed_tags (list): allowed list of html tags

    Returns: a string without html tags
    """
    if arg_0 is None:
        return
    if arg_1 is None:
        arg_1 = ALLOWED_TAGS
    return bleach.clean(arg_0, tags=arg_1, attributes=['id', 'class', 'style', 'href', 'title'], strip=True)

Strip all tags from a string except those tags provided in allowed_tags parameter .


return BoundingBox(x1=min(xx), x2=max(xx), y1=min(yy), y2=max(yy), label=self.label)

def Func ( arg_0 ) : from imgaug . augmentables . bbs import BoundingBox arg_1 = arg_0 . xx arg_2 = arg_0 . yy return BoundingBox ( x1 = min ( arg_1 ) , x2 = max ( arg_1 ) , y1 = min ( arg_2 ) , y2 = max ( arg_2 ) , label = arg_0 . label )

def Func(arg_0):
        """
        Convert this polygon to a bounding box tightly containing the whole polygon.

        Returns
        -------
        imgaug.BoundingBox
            Tight bounding box around the polygon.

        """
        # TODO get rid of this deferred import
        from imgaug.augmentables.bbs import BoundingBox

        arg_1 = arg_0.xx
        arg_2 = arg_0.yy
        return BoundingBox(x1=min(arg_1), x2=max(arg_1), y1=min(arg_2), y2=max(arg_2), label=arg_0.label)

Convert this polygon to a bounding box tightly containing the whole polygon .


def Func(arg_0, arg_1):
        """Updates the directives attribute from a dictionary object.

        This will only update the directives for processes that have been
        defined in the subclass.

        Parameters
        ----------
        attr_dict : dict
            Dictionary containing the attributes that will be used to update
            the process attributes and/or directives.

        """

        # Update directives
        # Allowed attributes to write
        arg_2 = ["pid", "ignore_type", "ignore_pid", "extra_input",
                            "group", "input_type"]

        for arg_3, arg_4 in arg_1.items():

            # If the attribute has a valid directive key, update that
            # directive
            if arg_3 in arg_2 and hasattr(arg_0, arg_3):
                setattr(arg_0, arg_3, arg_4)

            # The params attribute is special, in the sense that it provides
            # information for the self.params attribute.
            elif arg_3 == "params":
                for arg_5, arg_6 in arg_4.items():
                    if arg_5 in arg_0.params:
                        arg_0.params[arg_5]["default"] = arg_6
                    else:
                        raise eh.ProcessError(
                            "The parameter name '{}' does not exist for "
                            "component '{}'".format(arg_5, arg_0.template))

            else:
                for arg_8 in arg_0.directives:
                    arg_0.directives[arg_8][arg_3] = arg_4

Updates the directives attribute from a dictionary object .


def Func(arg_0, arg_1):
        """run a server binding to port"""

        try:
            arg_0.server = MultiThreadedHTTPServer(('0.0.0.0', arg_1), Handler)
        except socket.error, e:  # failed to bind port
            logger.error(str(e))
            sys.exit(1)

        logger.info("HTTP serve at http://0.0.0.0:%d (ctrl-c to stop) ..."
                    % arg_1)

        try:
            arg_0.server.serve_forever()
        except KeyboardInterrupt:
            logger.info("^C received, shutting down server")
            arg_0.shutdown_server()


def Func(arg_0):
        """assign dates to nodes

        Returns
        -------
        str
            success/error code
        """
        if arg_0.tree is None:
            arg_0.logger("ClockTree.Func: tree is not set, can't assign dates", 0)
            return ttconf.ERROR

        arg_1 = 0
        for arg_2 in arg_0.tree.find_clades(order='postorder'):
            if arg_2.name in arg_0.date_dict:
                arg_3 = arg_0.date_dict[arg_2.name]
                if np.isscalar(arg_3) and np.isnan(arg_3):
                    arg_0.logger("WARNING: ClockTree.init: node %s has a bad date: %s"%(arg_2.name, str(arg_3)), 2, warn=True)
                    arg_2.raw_date_constraint = None
                    arg_2.bad_branch = True
                else:
                    try:
                        arg_6 = np.mean(arg_3)
                        arg_2.raw_date_constraint = arg_3
                        arg_2.bad_branch = False
                    except:
                        arg_0.logger("WARNING: ClockTree.init: node %s has a bad date: %s"%(arg_2.name, str(arg_3)), 2, warn=True)
                        arg_2.raw_date_constraint = None
                        arg_2.bad_branch = True
            else: # nodes without date contraints

                arg_2.raw_date_constraint = None

                if arg_2.is_terminal():
                    # Terminal branches without date constraints marked as 'bad'
                    arg_2.bad_branch = True
                else:
                    # If all branches dowstream are 'bad', and there is no date constraint for
                    # this node, the branch is marked as 'bad'
                    arg_2.bad_branch = np.all([x.bad_branch for x in arg_2])

            if arg_2.is_terminal() and arg_2.bad_branch:
                arg_1 += 1

        if arg_1>arg_0.tree.count_terminals()-3:
            arg_0.logger("ERROR: ALMOST NO VALID DATE CONSTRAINTS, EXITING", 1, warn=True)
            return ttconf.ERROR

        return ttconf.SUCCESS


def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = arg_0 . _perform_request ( url = '/datacenters/%s/volumes/%s' % ( arg_1 , arg_2 ) , method = 'DELETE' ) return arg_3

def Func(arg_0, arg_1, arg_2):
        """
        Removes a volume from the data center.

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

        :param      volume_id: The unique ID of the volume.
        :type       volume_id: ``str``

        """
        arg_3 = arg_0._perform_request(
            url='/datacenters/%s/volumes/%s' % (
                arg_1, arg_2), method='DELETE')

        return arg_3


def Func ( arg_0 ) : arg_1 = arg_0 . gates_to_uncompute ( ) arg_2 = arg_1 . to_instruction ( ) . inverse ( ) arg_3 = QuantumRegister ( arg_0 . num_qubits , 'q' ) arg_4 = QuantumCircuit ( arg_3 , name = 'init_def' ) for arg_5 in arg_3 : arg_4 . append ( Reset ( ) , [ arg_5 ] ) arg_4 . append ( arg_2 , arg_3 [ : ] ) arg_0 . definition = arg_4 . data

def Func(arg_0):
        """Calculate a subcircuit that implements this initialization

        Implements a recursive initialization algorithm, including optimizations,
        from "Synthesis of Quantum Logic Circuits" Shende, Bullock, Markov
        https://arxiv.org/abs/quant-ph/0406176v5

        Additionally implements some extra optimizations: remove zero rotations and
        double cnots.
        """
        # call to generate the circuit that takes the desired vector to zero
        arg_1 = arg_0.gates_to_uncompute()

        # invert the circuit to create the desired vector from zero (assuming
        # the qubits are in the zero state)
        arg_2 = arg_1.to_instruction().inverse()

        arg_3 = QuantumRegister(arg_0.num_qubits, 'q')
        arg_4 = QuantumCircuit(arg_3, name='init_def')
        for arg_5 in arg_3:
            arg_4.append(Reset(), [arg_5])
        arg_4.append(arg_2, arg_3[:])

        arg_0.definition = arg_4.data


(idx, idx_min=None, idx_max=None, step=None, pad=True)

return [slice(start, end, step) for (start, end) in zip(idx_fixed, idx_fixed[1:])]

def Func ( arg_0 , arg_1 = None , arg_2 = None , arg_3 = None , arg_4 = True ) : arg_5 = fix_frames ( arg_0 , arg_1 , arg_2 , arg_4 = arg_4 ) return [ slice ( arg_6 , arg_7 , arg_3 ) for ( arg_6 , arg_7 ) in zip ( arg_5 , arg_5 [ 1 : ] ) ]

def Func(arg_0, arg_1=None, arg_2=None, arg_3=None, arg_4=True):
    '''Generate a slice array from an index array.

    Parameters
    ----------
    idx : list-like
        Array of index boundaries

    idx_min : None or int
    idx_max : None or int
        Minimum and maximum allowed indices

    step : None or int
        Step size for each slice.  If `None`, then the default
        step of 1 is used.

    pad : boolean
        If `True`, pad `idx` to span the range `idx_min:idx_max`.

    Returns
    -------
    slices : list of slice
        ``slices[i] = slice(idx[i], idx[i+1], step)``
        Additional slice objects may be added at the beginning or end,
        depending on whether ``pad==True`` and the supplied values for
        `idx_min` and `idx_max`.

    See Also
    --------
    fix_frames

    Examples
    --------
    >>> # Generate slices from spaced indices
    >>> librosa.util.Func(np.arange(20, 100, 15))
    [slice(20, 35, None), slice(35, 50, None), slice(50, 65, None), slice(65, 80, None),
     slice(80, 95, None)]
    >>> # Pad to span the range (0, 100)
    >>> librosa.util.Func(np.arange(20, 100, 15),
    ...                             idx_min=0, idx_max=100)
    [slice(0, 20, None), slice(20, 35, None), slice(35, 50, None), slice(50, 65, None),
     slice(65, 80, None), slice(80, 95, None), slice(95, 100, None)]
    >>> # Use a step of 5 for each slice
    >>> librosa.util.Func(np.arange(20, 100, 15),
    ...                             idx_min=0, idx_max=100, step=5)
    [slice(0, 20, 5), slice(20, 35, 5), slice(35, 50, 5), slice(50, 65, 5), slice(65, 80, 5),
     slice(80, 95, 5), slice(95, 100, 5)]
    '''

    # First, normalize the index set
    arg_5 = fix_frames(arg_0, arg_1, arg_2, arg_4=arg_4)

    # Now convert the indices to slices
    return [slice(arg_6, arg_7, arg_3) for (arg_6, arg_7) in zip(arg_5, arg_5[1:])]

Generate a slice array from an index array.

    Parameters
    ----------
    idx : list-like
        Array of index boundaries

    idx_min : None or int
    idx_max : None or int
        Minimum and maximum allowed indices

    step : None or int
        Step size for each slice.  If `None`, then the default
        step of 1 is used.

    pad : boolean
        If `True`, pad `idx` to span the range `idx_min:idx_max`.

    Returns
    -------
    slices : list of slice
        ``slices[i] = slice(idx[i], idx[i+1], step)``
        Additional slice objects may be added at the beginning or end,
        depending on whether ``pad==True`` and the supplied values for
        `idx_min` and `idx_max`.

    See Also
    --------
    fix_frames

    Examples
    --------
    >>> # Generate slices from spaced indices
    >>> librosa.util.index_to_slice(np.arange(20, 100, 15))
    [slice(20, 35, None), slice(35, 50, None), slice(50, 65, None), slice(65, 80, None),
     slice(80, 95, None)]
    >>> # Pad to span the range (0, 100)
    >>> librosa.util.index_to_slice(np.arange(20, 100, 15),
    ...                             idx_min=0, idx_max=100)
    [slice(0, 20, None), slice(20, 35, None), slice(35, 50, None), slice(50, 65, None),
     slice(65, 80, None), slice(80, 95, None), slice(95, 100, None)]
    >>> # Use a step of 5 for each slice
    >>> librosa.util.index_to_slice(np.arange(20, 100, 15),
    ...                             idx_min=0, idx_max=100, step=5)
    [slice(0, 20, 5), slice(20, 35, 5), slice(35, 50, 5), slice(50, 65, 5), slice(65, 80, 5),
     slice(80, 95, 5), slice(95, 100, 5)]

Generate a slice array from an index array .


def
Func
(
arg_0
,
arg_1
=
'37'
)
:
Func
=
{
}
LOG
.
info
(
"Fetching all transcripts"
)
for
arg_3
in
arg_0
.
transcript_collection
.
find
(
{
'build'
:
arg_1
}
)
:
arg_4
=
arg_3
[
'transcript_id'
]
Func
[
arg_4
]
=
arg_3
LOG
.
info
(
"Ensembl transcripts fetched"
)
return
Func

def Func(arg_0, arg_1='37'):
        """Return a dictionary with ensembl ids as keys and transcripts as value.

        Args:
            build(str)

        Returns:
            ensembl_transcripts(dict): {<enst_id>: transcripts_obj, ...}
        """
        Func = {}
        LOG.info("Fetching all transcripts")
        for arg_3 in arg_0.transcript_collection.find({'build':arg_1}):
            arg_4 = arg_3['transcript_id']
            Func[arg_4] = arg_3
        LOG.info("Ensembl transcripts fetched")

        return Func

Return a dictionary with ensembl ids as keys and transcripts as value .


def
Func
(
arg_0
)
:
arg_1
,
arg_2
=
arg_0
.
profile_block_analyzer
.
_temporal_distance_cdf
(
)
arg_3
=
plt
.
figure
(
)
arg_4
=
arg_3
.
add_subplot
(
111
)
arg_1
=
numpy
.
array
(
arg_1
)
/
60.0
arg_4
.
plot
(
arg_1
,
arg_2
,
"-k"
)
arg_4
.
fill_between
(
arg_1
,
arg_2
,
color
=
"red"
,
alpha
=
0.2
)
arg_4
.
set_ylabel
(
"CDF(t)"
)
arg_4
.
set_xlabel
(
"Temporal distance t (min)"
)
return
arg_3

def Func(arg_0):
        """
        Plot the temporal distance cumulative density function.

        Returns
        -------
        fig: matplotlib.Figure
        """
        arg_1, arg_2 = arg_0.profile_block_analyzer._temporal_distance_cdf()
        arg_3 = plt.figure()
        arg_4 = arg_3.add_subplot(111)
        arg_1 = numpy.array(arg_1) / 60.0
        arg_4.plot(arg_1, arg_2, "-k")
        arg_4.fill_between(arg_1, arg_2, color="red", alpha=0.2)
        arg_4.set_ylabel("CDF(t)")
        arg_4.set_xlabel("Temporal distance t (min)")
        return arg_3

Plot the temporal distance cumulative density function .


def Func(arg_0, arg_1):
        """Return the type object corresponding to a type name.

        If type_name is not found, this triggers the loading of
        external types until a matching type is found or until there
        are no more external type sources.
        """

        arg_1 = arg_0._canonicalize_type(arg_1)

        # Add basic transformations on common abbreviations
        if str(arg_1) == 'int':
            arg_1 = 'integer'
        elif str(arg_1) == 'str':
            arg_1 = 'string'
        elif str(arg_1) == 'dict':
            arg_1 = 'basic_dict'

        if arg_0.is_known_type(arg_1):
            return arg_0.known_types[arg_1]

        arg_2, arg_3, arg_4 = arg_0.split_type(arg_1)
        if arg_3 and arg_2 in arg_0.type_factories:
            arg_0.instantiate_type(arg_1, arg_2, arg_4)
            return arg_0.known_types[arg_1]

        # If we're here, this is a type that we don't know anything about, so go find it.
        arg_5 = 0
        for arg_5, (arg_6, arg_7) in enumerate(arg_0._lazy_type_sources):
            if isinstance(arg_6, str):
                import pkg_resources

                for arg_8 in pkg_resources.iter_entry_points(arg_6):
                    try:
                        arg_9 = arg_8.load()
                        type_system.load_type_module(arg_9)
                    except:  #pylint:disable=W0702; We want to catch everything here since we don't want external plugins breaking us
                        arg_10 = ("Entry point group: %s, name: %s" % (arg_6, arg_8.name), sys.exc_info)
                        logging.exception("Error loading external type source from entry point, group: %s, name: %s", arg_6, arg_8.name)
                        arg_0.failed_sources.append(arg_10)
            else:
                try:
                    arg_6(arg_0)
                except:  #pylint:disable=W0702; We want to catch everything here since we don't want external plugins breaking us
                    arg_10 = ("source: %s" % arg_7, sys.exc_info)
                    logging.exception("Error loading external type source, source: %s", arg_6)
                    arg_0.failed_sources.append(arg_10)

            # Only load as many external sources as we need to resolve this type_name
            if arg_0.is_known_type(arg_1) or (arg_3 and arg_2 in arg_0.type_factories):
                break

        arg_0._lazy_type_sources = arg_0._lazy_type_sources[arg_5:]

        # If we've loaded everything and we still can't find it then there's a configuration error somewhere
        if not (arg_0.is_known_type(arg_1) or (arg_3 and arg_2 in arg_0.type_factories)):
            raise ArgumentError("Func called on unknown type", type=arg_1, failed_external_sources=[arg_12[0] for arg_12 in arg_0.failed_sources])

        return arg_0.Func(arg_1)

Return the type object corresponding to a type name .


def Func ( arg_0 : arg_1 , arg_2 : arg_1 ) -> logging . Handler : arg_3 : logging . Handler = logging . NullHandler ( ) if os . getenv ( "BASILISP_USE_DEV_LOGGER" ) == "true" : arg_3 = logging . StreamHandler ( ) arg_3 . setFormatter ( logging . Formatter ( arg_2 ) ) arg_3 . setLevel ( arg_0 ) return arg_3

def Func(arg_0: arg_1, arg_2: arg_1) -> logging.Handler:
    """Get the default logging handler for Basilisp."""
    arg_3: logging.Handler = logging.NullHandler()
    if os.getenv("BASILISP_USE_DEV_LOGGER") == "true":
        arg_3 = logging.StreamHandler()

    arg_3.setFormatter(logging.Formatter(arg_2))
    arg_3.setLevel(arg_0)
    return arg_3

Get the default logging handler for Basilisp .


def Func(arg_0):
    """Python default hsv to rgb conversion for when hue values in the
    range 0-359 are preferred.  Due to requiring float math, this method
    is slower than hsv2rgb_rainbow and hsv2rgb_spectrum."""

    arg_1, arg_2, arg_3 = arg_0

    arg_4, arg_5, arg_6 = colorsys.hsv_to_rgb(arg_1 / 360.0, arg_2, arg_3)
    return (int(arg_4 * 255.0), int(arg_5 * 255.0), int(arg_6 * 255.0))

Python default hsv to rgb conversion for when hue values in the range 0 - 359 are preferred . Due to requiring float math this method is slower than hsv2rgb_rainbow and hsv2rgb_spectrum .


def Func(arg_0, arg_1, arg_2=7):
    '''This smooths the magseries with a Gaussian kernel.

    Parameters
    ----------

    mags : np.array
        The input mags/flux time-series to smooth.

    windowsize : int
        This is a odd integer containing the smoothing window size.

    windowfwhm : int
        This is an odd integer containing the FWHM of the applied Gaussian
        window function.

    Returns
    -------

    np.array
        The smoothed mag/flux time-series array.

    '''

    arg_3 = Gaussian1DKernel(arg_2, x_size=arg_1)
    arg_4 = convolve(arg_0, arg_3, boundary='extend')
    return arg_4

This smooths the magseries with a Gaussian kernel .


(el, link_regexes=_link_regexes,
             avoid_elements=_avoid_elements,
             avoid_hosts=_avoid_hosts,
             avoid_classes=_avoid_classes)

def Func(arg_0, arg_1=arg_2,
             arg_3=arg_4,
             arg_5=arg_6,
             arg_7=arg_8):
    """
    Turn any URLs into links.

    It will search for links identified by the given regular
    expressions (by default mailto and http(s) links).

    It won't link text in an element in avoid_elements, or an element
    with a class in avoid_classes.  It won't link to anything with a
    host that matches one of the regular expressions in avoid_hosts
    (default localhost and 127.0.0.1).

    If you pass in an element, the element's tail will not be
    substituted, only the contents of the element.
    """
    if arg_0.tag in arg_3:
        return
    arg_9 = arg_0.get('class')
    if arg_9:
        arg_9 = arg_9.split()
        for arg_10 in arg_7:
            if arg_10 in arg_9:
                return
    for arg_11 in list(arg_0):
        Func(arg_11, arg_1=arg_1,
                 arg_3=arg_3,
                 arg_5=arg_5,
                 arg_7=arg_7)
        if arg_11.tail:
            arg_12, arg_13 = _link_text(
                arg_11.tail, arg_1, arg_5, factory=arg_0.makeelement)
            if arg_13:
                arg_11.tail = arg_12
                arg_15 = arg_0.index(arg_11)
                arg_0[arg_15+1:arg_15+1] = arg_13
    if arg_0.text:
        arg_12, arg_16 = _link_text(
            arg_0.text, arg_1, arg_5, factory=arg_0.makeelement)
        if arg_16:
            arg_0.text = arg_12
            arg_0[:0] = arg_16


def Func ( arg_0 , arg_1 , arg_2 ) : if not arg_0 : for arg_3 in arg_2 : if arg_3 in arg_1 [ 'files' ] : del arg_1 [ 'files' ] [ arg_3 ] return arg_1 for arg_4 in arg_0 [ 'files' ] : if arg_4 not in arg_1 [ 'files' ] and arg_4 not in arg_2 : arg_1 [ 'files' ] [ arg_4 ] = arg_0 [ 'files' ] [ arg_4 ] for arg_3 in arg_2 : if arg_3 in arg_1 [ 'files' ] : del arg_1 [ 'files' ] [ arg_3 ] return arg_1

def Func(arg_0, arg_1, arg_2):
    """
    If we don't merge the shas from the sha store and if we build a
    subgraph, the .shastore will only contain the shas of the files
    from the subgraph and the rest of the graph will have to be
    rebuilt
    """
    if not arg_0:
        for arg_3 in arg_2:
            if arg_3 in arg_1['files']:
                del arg_1['files'][arg_3]
        return arg_1
    for arg_4 in arg_0['files']:
        if arg_4 not in arg_1['files'] and arg_4 not in arg_2:
            arg_1['files'][arg_4] = arg_0['files'][arg_4]
    for arg_3 in arg_2:
        if arg_3 in arg_1['files']:
            del arg_1['files'][arg_3]
    return arg_1

If we don t merge the shas from the sha store and if we build a subgraph the . shastore will only contain the shas of the files from the subgraph and the rest of the graph will have to be rebuilt


(self, expression, threshold=0.001, func=np.sum)

def Func ( arg_0 , arg_1 , arg_2 = 0.001 , arg_3 = arg_4 . sum ) : arg_6 = lp . Lexer ( ) arg_6 . build ( ) arg_7 = lp . Parser ( arg_6 , arg_0 . dataset , arg_2 = arg_2 , arg_3 = arg_3 ) arg_7 . build ( ) return arg_7 . parse ( arg_1 ) . keys ( ) . values

def Func(arg_0, arg_1, arg_2=0.001, arg_3=arg_4.sum):
        """ Use a PEG to parse expression and return study IDs."""
        arg_6 = lp.Lexer()
        arg_6.build()
        arg_7 = lp.Parser(
            arg_6, arg_0.dataset, arg_2=arg_2, arg_3=arg_3)
        arg_7.build()
        return arg_7.parse(arg_1).keys().values

Use a PEG to parse expression and return study IDs .


(
    in_tile=None, in_data=None, out_profile=None, out_tile=None, out_path=None,
    tags=None, bucket_resource=None
)

def Func(
    arg_0=None, arg_1=None, arg_2=None, arg_3=None, arg_4=None,
    arg_5=None, arg_6=None
):
    """
    Write a window from a numpy array to an output file.

    Parameters
    ----------
    in_tile : ``BufferedTile``
        ``BufferedTile`` with a data attribute holding NumPy data
    in_data : array
    out_profile : dictionary
        metadata dictionary for rasterio
    out_tile : ``Tile``
        provides output boundaries; if None, in_tile is used
    out_path : string
        output path to write to
    tags : optional tags to be added to GeoTIFF file
    bucket_resource : boto3 bucket resource to write to in case of S3 output
    """
    if not isinstance(arg_4, str):
        raise TypeError("out_path must be a string")
    logger.debug("write %s", arg_4)
    if arg_4 == "memoryfile":
        raise DeprecationWarning(
            "Writing to memoryfile with Func() is deprecated. "
            "Please use RasterWindowMemoryFile."
        )
    arg_3 = arg_0 if arg_3 is None else arg_3
    _validate_write_window_params(arg_0, arg_3, arg_1, arg_2)

    # extract data
    arg_7 = extract_from_array(
        in_raster=arg_1,
        in_affine=arg_0.affine,
        arg_3=arg_3
    ) if arg_0 != arg_3 else arg_1

    # use transform instead of affine
    if "affine" in arg_2:
        arg_2["transform"] = arg_2.pop("affine")

    # write if there is any band with non-masked data
    if arg_7.all() is not ma.masked:

        try:
            if arg_4.startswith("s3://"):
                with RasterWindowMemoryFile(
                    arg_0=arg_3,
                    arg_1=arg_7,
                    arg_2=arg_2,
                    arg_3=arg_3,
                    arg_5=arg_5
                ) as memfile:
                    logger.debug((arg_3.id, "upload tile", arg_4))
                    arg_6.put_object(
                        Key="/".join(arg_4.split("/")[3:]),
                        Body=memfile
                    )
            else:
                with rasterio.open(arg_4, 'w', **arg_2) as dst:
                    logger.debug((arg_3.id, "write tile", arg_4))
                    dst.write(arg_7.astype(arg_2["dtype"], copy=False))
                    _write_tags(dst, arg_5)
        except Exception as e:
            logger.exception("error while writing file %s: %s", arg_4, e)
            raise
    else:
        logger.debug((arg_3.id, "array window empty", arg_4))

Write a window from a numpy array to an output file .


def Func(arg_0, arg_1):
        """
        Receives a dictionary connection_params to setup
        a connection to the database.

        Dictionary correct setup is made through the
        get_connection_params method.

        TODO: This needs to be made more generic to accept
        other MongoClient parameters.
        """

        arg_2 = arg_1.pop('name')
        arg_3 = arg_1.pop('enforce_schema')

        arg_1['document_class'] = OrderedDict
        # connection_params['tz_aware'] = True
        # To prevent leaving unclosed connections behind,
        # client_conn must be closed before a new connection
        # is created.
        if arg_0.client_connection is not None:
            arg_0.client_connection.close()

        arg_0.client_connection = Database.connect(**arg_1)
        arg_5 = arg_0.client_connection[arg_2]
        arg_0.djongo_connection = DjongoClient(arg_5, arg_3)
        return arg_0.client_connection[arg_2]

Receives a dictionary connection_params to setup a connection to the database .


def Func(arg_0):
  """ Creates an 'one-off' record for each record in the inputs. Appends new
  records to the same inputs list.
  """
  arg_1 = len(arg_0)
  for arg_2 in xrange(arg_1):
    arg_3 = arg_0[arg_2]
    for arg_4 in xrange(len(arg_3)-1):
      if arg_3[arg_4] == 1 and arg_3[arg_4+1] == 0:
        arg_5 = copy.deepcopy(arg_3)
        arg_5[arg_4] = 0
        arg_5[arg_4+1] = 1
        arg_0.append(arg_5)
        break

Creates an one - off record for each record in the inputs . Appends new records to the same inputs list .


def Func(arg_0, arg_1=''):
    """Refresh the project from the original cookiecutter template."""
    arg_1 = arg_1 or "https://github.com/Springerle/py-generic-project.git"  # TODO: URL from config
    arg_2 = os.path.join(tempfile.gettempdir(), "cc-upgrade-pygments-markdown-lexer")

    if os.path.isdir('.git'):
        # TODO: Ensure there are no local unstashed changes
        pass

    # Make a copy of the new mold version
    if os.path.isdir(arg_2):
        shutil.rmtree(arg_2)
    if os.path.exists(arg_1):
        shutil.copytree(arg_1, arg_2, ignore=shutil.ignore_patterns(
            ".git", ".svn", "*~",
        ))
    else:
        arg_0.run("git clone {} {}".format(arg_1, arg_2))

    # Copy recorded "cookiecutter.json" into mold
    shutil.copy2("project.d/cookiecutter.json", arg_2)

    with pushd('..'):
        arg_0.run("cookiecutter --no-input {}".format(arg_2))
    if os.path.exists('.git'):
        arg_0.run("git status")

Refresh the project from the original cookiecutter template .