def Func ( arg_0 ) : if os . path . isdir ( arg_0 ) : arg_1 = discover ( arg_0 ) else : arg_1 = [ arg_0 ] for arg_0 in arg_1 : arg_2 = os . path . basename ( os . path . splitext ( arg_0 ) [ 0 ] ) imp . load_source ( arg_2 , arg_0 )

def Func(arg_0):
    """
    Load a spec from a given path, discovering specs if a directory is given.

    """

    if os.path.isdir(arg_0):
        arg_1 = discover(arg_0)
    else:
        arg_1 = [arg_0]

    for arg_0 in arg_1:
        arg_2 = os.path.basename(os.path.splitext(arg_0)[0])
        imp.load_source(arg_2, arg_0)

Load a spec from a given path discovering specs if a directory is given .


def Func(arg_0, arg_1):
        """Extracts storage flags for data in `data_dict`
        if they were not specified in `flags_dict`.

        See :const:`~pypet.storageservice.HDF5StorageService.TYPE_FLAG_MAPPING`
        for how to store different types of data per default.

        """
        for arg_2, arg_3 in arg_0.items():
            if not arg_2 in arg_1:
                arg_4 = type(arg_3)
                if (arg_4 is np.ndarray or arg_4 is dict) and len(arg_3) == 0:
                        # Empty containers are stored as an Array
                        # No need to ask for tuple or list, because they are always
                        # stored as arrays.
                        arg_1[arg_2] = HDF5StorageService.ARRAY
                        continue
                else:
                    try:
                        arg_1[arg_2] = HDF5StorageService.TYPE_FLAG_MAPPING[arg_4]
                    except KeyError:
                        raise pex.NoSuchServiceError('I cannot store `%s`, I do not understand the'
                                                     'type `%s`.' % (arg_2, str(arg_4)))

Extracts storage flags for data in data_dict if they were not specified in flags_dict .


return self.apply(func, pure, state).unwrap()

def Func(arg_0, arg_1):
        # type: (S) -> List[B]
        '''Returns a list of all the foci within `state`.

        Requires kind Fold. This method will raise TypeError if the
        optic has no way to get any foci.
        '''
        if not arg_0._is_kind(Fold):
            raise TypeError('Must be an instance of Fold to .Func()')

        arg_2 = lambda a: Const([])
        arg_3 = lambda a: Const([a])
        return arg_0.apply(arg_3, arg_2, arg_1).unwrap()

Returns a list of all the foci within state .


return str(header) if PY2 else bytes(header)

def Func ( arg_0 ) : arg_1 = bytearray ( 1 ) arg_2 = bytearray ( 2 ) arg_1 [ 0 ] = 0x20 arg_2 [ 0 ] = arg_0 . session arg_2 [ 1 ] = arg_0 . resultCode arg_1 . extend ( FuncLength ( len ( arg_2 ) ) ) arg_1 . extend ( arg_2 ) arg_0 . Funcd = arg_1 return str ( arg_1 ) if PY2 else bytes ( arg_1 )

def Func(arg_0):
        '''
        Encode and store a CONNACK control packet.
        '''

        arg_1       = bytearray(1)
        arg_2    = bytearray(2)
        arg_1[0]    = 0x20
        arg_2[0] = arg_0.session
        arg_2[1] = arg_0.resultCode
        arg_1.extend(FuncLength(len(arg_2)))
        arg_1.extend(arg_2)
        arg_0.Funcd = arg_1
        return str(arg_1) if PY2 else bytes(arg_1)

Encode and store a CONNACK control packet .


def Func(arg_0, arg_1, arg_2=None):
    """Calculate the distances from inputPattern to all stored patterns. All
    distances are between 0.0 and 1.0

    :param inputPattern The pattern from which distances to all other patterns
        are calculated

    :param distanceNorm Degree of the distance norm
    """
    if arg_2 is None:
      arg_2 = arg_0.distanceNorm

    # Sparse memory
    if arg_0.useSparseMemory:
      if arg_0._protoSizes is None:
        arg_0._protoSizes = arg_0._Memory.rowSums()
      arg_4 = arg_0._Memory.rightVecSumAtNZ(arg_1)
      arg_5 = arg_1.sum()

      if arg_0.distanceMethod == "rawOverlap":
        arg_6 = arg_1.sum() - arg_4
      elif arg_0.distanceMethod == "pctOverlapOfInput":
        arg_6 = arg_5 - arg_4
        if arg_5 > 0:
          arg_6 /= arg_5
      elif arg_0.distanceMethod == "pctOverlapOfProto":
        arg_4 /= arg_0._protoSizes
        arg_6 = 1.0 - arg_4
      elif arg_0.distanceMethod == "pctOverlapOfLarger":
        arg_7 = numpy.maximum(arg_0._protoSizes, arg_5)
        if arg_7.all() > 0:
          arg_4 /= arg_7
        arg_6 = 1.0 - arg_4
      elif arg_0.distanceMethod == "norm":
        arg_6 = arg_0._Memory.vecLpDist(arg_0.distanceNorm, arg_1)
        arg_8 = arg_6.max()
        if arg_8 > 0:
          arg_6 /= arg_8
      else:
        raise RuntimeError("Unimplemented distance method %s" %
          arg_0.distanceMethod)

    # Dense memory
    else:
      if arg_0.distanceMethod == "norm":
        arg_6 = numpy.power(numpy.abs(arg_0._M - arg_1), arg_0.distanceNorm)
        arg_6 = arg_6.sum(1)
        arg_6 = numpy.power(arg_6, 1.0/arg_0.distanceNorm)
        arg_6 /= arg_6.max()
      else:
        raise RuntimeError ("Not implemented yet for dense storage....")

    return arg_6

Calculate the distances from inputPattern to all stored patterns . All distances are between 0 . 0 and 1 . 0


return [self._i2p(i, j) for i in ind for j in ['z', 'y', 'x', 'a']]

def Func ( arg_0 , arg_1 ) : arg_1 = arg_0 . _vps ( listify ( arg_1 ) ) return [ arg_0 . _i2p ( arg_2 , arg_3 ) for arg_2 in arg_1 for arg_3 in [ 'z' , 'y' , 'x' , 'a' ] ]

def Func(arg_0, arg_1):
        """ Get position and radius of one or more particles """
        arg_1 = arg_0._vps(listify(arg_1))
        return [arg_0._i2p(arg_2, arg_3) for arg_2 in arg_1 for arg_3 in ['z', 'y', 'x', 'a']]


(_context, code, symbol, format,
                       currency_digits=True, decimal_quantization=True,
                       name='')

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 = True , arg_5 = True , arg_6 = '' ) : arg_0 . action ( discriminator = ( 'currency' , arg_6 , arg_1 ) , callable = _register_currency , args = ( arg_6 , arg_1 , arg_2 , arg_3 , arg_4 , arg_5 ) )

def Func(arg_0, arg_1, arg_2, arg_3,
                       arg_4=True, arg_5=True,
                       arg_6=''):
        """Handle Func subdirectives."""
        arg_0.action(
            discriminator=('currency', arg_6, arg_1),
            callable=_register_currency,
            args=(arg_6, arg_1, arg_2, arg_3, arg_4,
                  arg_5)
            )


def Func ( arg_0 ) : arg_1 = [ ] for arg_2 in ds_config . audio_exts : arg_1 += glob . glob ( os . path . join ( arg_0 , ds_config . audio_dir , "*" + arg_2 ) ) utils . ensure_dir ( os . path . join ( arg_0 , ds_config . features_dir ) ) utils . ensure_dir ( os . path . join ( arg_0 , ds_config . estimations_dir ) ) utils . ensure_dir ( os . path . join ( arg_0 , ds_config . references_dir ) ) arg_3 = [ ] for arg_4 in arg_1 : arg_3 . append ( FileStruct ( arg_4 ) ) arg_3 = sorted ( arg_3 , key = lambda file_struct : file_struct . audio_file ) return arg_3

def Func(arg_0):
    """Gets the files of the given dataset."""
    # Get audio files
    arg_1 = []
    for arg_2 in ds_config.audio_exts:
        arg_1 += glob.glob(
            os.path.join(arg_0, ds_config.audio_dir, "*" + arg_2))

    # Make sure directories exist
    utils.ensure_dir(os.path.join(arg_0, ds_config.features_dir))
    utils.ensure_dir(os.path.join(arg_0, ds_config.estimations_dir))
    utils.ensure_dir(os.path.join(arg_0, ds_config.references_dir))

    # Get the file structs
    arg_3 = []
    for arg_4 in arg_1:
        arg_3.append(FileStruct(arg_4))

    # Sort by audio file name
    arg_3 = sorted(arg_3,
                          key=lambda file_struct: file_struct.audio_file)

    return arg_3


(leapfrog_step_state: LeapFrogStepState,
                  step_size: FloatTensor, target_log_prob_fn: PotentialFn,
                  kinetic_energy_fn: PotentialFn
                 )

return LeapFrogStepState(state, state_grads, momentum), LeapFrogStepExtras(
      target_log_prob, state_extra, kinetic_energy, kinetic_energy_extra)

def Func ( arg_0 : arg_1 , arg_2 : arg_3 , arg_4 : arg_5 , arg_6 : arg_5 ) -> Tuple [ arg_1 , LeapFrogStepExtras ] : arg_7 = arg_0 . state arg_8 = arg_0 . state_grads arg_9 = arg_0 . momentum arg_2 = maybe_broadcast_structure ( arg_2 , arg_7 ) arg_7 = tf . nest . map_structure ( tf . convert_to_tensor , arg_7 ) arg_9 = tf . nest . map_structure ( tf . convert_to_tensor , arg_9 ) arg_7 = tf . nest . map_structure ( tf . convert_to_tensor , arg_7 ) if arg_8 is None : arg_10 , arg_10 , arg_8 = call_and_grads ( arg_4 , arg_7 ) else : arg_8 = tf . nest . map_structure ( tf . convert_to_tensor , arg_8 ) arg_9 = tf . nest . map_structure ( lambda m , sg , s : m + 0.5 * sg * s , arg_9 , arg_8 , arg_2 ) arg_11 , arg_12 , arg_13 = call_and_grads ( arg_6 , arg_9 ) arg_7 = tf . nest . map_structure ( lambda x , mg , s : x + mg * s , arg_7 , arg_13 , arg_2 ) arg_14 , arg_15 , arg_8 = call_and_grads ( arg_4 , arg_7 ) arg_9 = tf . nest . map_structure ( lambda m , sg , s : m + 0.5 * sg * s , arg_9 , arg_8 , arg_2 ) return arg_1 ( arg_7 , arg_8 , arg_9 ) , LeapFrogStepExtras ( arg_14 , arg_15 , arg_11 , arg_12 )

def Func(arg_0: arg_1,
                  arg_2: arg_3, arg_4: arg_5,
                  arg_6: arg_5
                 ) -> Tuple[arg_1, LeapFrogStepExtras]:
  """Leapfrog `TransitionOperator`.

  Args:
    Func_state: LeapFrogStepState.
    step_size: Step size, structure broadcastable to the `target_log_prob_fn`
      state.
    target_log_prob_fn: Target log prob fn.
    kinetic_energy_fn: Kinetic energy fn.

  Returns:
    Func_state: LeapFrogStepState.
    Func_extras: LeapFrogStepExtras.
  """
  arg_7 = arg_0.state
  arg_8 = arg_0.state_grads
  arg_9 = arg_0.momentum
  arg_2 = maybe_broadcast_structure(arg_2, arg_7)

  arg_7 = tf.nest.map_structure(tf.convert_to_tensor, arg_7)
  arg_9 = tf.nest.map_structure(tf.convert_to_tensor, arg_9)
  arg_7 = tf.nest.map_structure(tf.convert_to_tensor, arg_7)

  if arg_8 is None:
    arg_10, arg_10, arg_8 = call_and_grads(arg_4, arg_7)
  else:
    arg_8 = tf.nest.map_structure(tf.convert_to_tensor, arg_8)

  arg_9 = tf.nest.map_structure(lambda m, sg, s: m + 0.5 * sg * s, arg_9,
                                   arg_8, arg_2)

  arg_11, arg_12, arg_13 = call_and_grads(
      arg_6, arg_9)

  arg_7 = tf.nest.map_structure(lambda x, mg, s: x + mg * s, arg_7,
                                arg_13, arg_2)

  arg_14, arg_15, arg_8 = call_and_grads(
      arg_4, arg_7)

  arg_9 = tf.nest.map_structure(lambda m, sg, s: m + 0.5 * sg * s, arg_9,
                                   arg_8, arg_2)

  return arg_1(arg_7, arg_8, arg_9), LeapFrogStepExtras(
      arg_14, arg_15, arg_11, arg_12)

Leapfrog `TransitionOperator`.

  Args:
    leapfrog_step_state: LeapFrogStepState.
    step_size: Step size, structure broadcastable to the `target_log_prob_fn`
      state.
    target_log_prob_fn: Target log prob fn.
    kinetic_energy_fn: Kinetic energy fn.

  Returns:
    leapfrog_step_state: LeapFrogStepState.
    leapfrog_step_extras: LeapFrogStepExtras.


(times,
                        mags,
                        mingap=4.0,
                        normto='globalmedian',
                        magsarefluxes=False,
                        debugmode=False)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
4.0
,
arg_3
=
'globalmedian'
,
arg_4
=
False
,
arg_5
=
False
)
:
arg_6
,
arg_7
=
find_lc_timegroups
(
arg_0
,
arg_2
=
arg_2
)
arg_8
=
np
.
isfinite
(
arg_1
)
if
any
(
arg_8
)
:
arg_9
=
np
.
median
(
arg_1
[
arg_8
]
)
for
arg_10
,
arg_11
in
enumerate
(
arg_7
)
:
arg_8
=
np
.
isfinite
(
arg_1
[
arg_11
]
)
arg_12
=
np
.
median
(
(
arg_1
[
arg_11
]
)
[
arg_8
]
)
if
arg_4
:
arg_1
[
arg_11
]
=
arg_1
[
arg_11
]
/
arg_12
else
:
arg_1
[
arg_11
]
=
arg_1
[
arg_11
]
arg_12
if
arg_5
:
LOGDEBUG
(
'group %s: elems %s, '
'finite elems %s, median mag %s'
%
(
arg_10
,
len
(
arg_1
[
arg_11
]
)
,
len
(
arg_8
)
,
arg_12
)
)
if
isinstance
(
arg_3
,
str
)
and
arg_3
==
'globalmedian'
:
if
arg_4
:
arg_1
=
arg_1
*
arg_9
else
:
arg_1
=
arg_1
+
arg_9
elif
isinstance
(
arg_3
,
float
)
:
if
arg_4
:
arg_1
=
arg_1
*
arg_3
else
:
arg_1
=
arg_1
+
arg_3
return
arg_0
,
arg_1
else
:
LOGERROR
(
'measurements are all nan!'
)
return
,

def Func(arg_0,
                        arg_1,
                        arg_2=4.0,
                        arg_3='globalmedian',
                        arg_4=False,
                        arg_5=False):
    '''This normalizes the magnitude time-series to a specified value.

    This is used to normalize time series measurements that may have large time
    gaps and vertical offsets in mag/flux measurement between these
    'timegroups', either due to instrument changes or different filters.

    NOTE: this works in-place! The mags array will be replaced with normalized
    mags when this function finishes.

    Parameters
    ----------

    times,mags : array-like
        The times (assumed to be some form of JD) and mags (or flux)
        measurements to be normalized.

    mingap : float
        This defines how much the difference between consecutive measurements is
        allowed to be to consider them as parts of different timegroups. By
        default it is set to 4.0 days.

    normto : {'globalmedian', 'zero'} or a float
        Specifies the normalization type::

          'globalmedian' -> norms each mag to the global median of the LC column
          'zero'         -> norms each mag to zero
          a float        -> norms each mag to this specified float value.

    magsarefluxes : bool
        Indicates if the input `mags` array is actually an array of flux
        measurements instead of magnitude measurements. If this is set to True,
        then:

        - if `normto` is 'zero', then the median flux is divided from each
          observation's flux value to yield normalized fluxes with 1.0 as the
          global median.

        - if `normto` is 'globalmedian', then the global median flux value
          across the entire time series is multiplied with each measurement.

        - if `norm` is set to a `float`, then this number is multiplied with the
          flux value for each measurement.

    debugmode : bool
        If this is True, will print out verbose info on each timegroup found.

    Returns
    -------

    times,normalized_mags : np.arrays
        Normalized magnitude values after normalization. If normalization fails
        for some reason, `times` and `normalized_mags` will both be None.

    '''

    arg_6, arg_7 = find_lc_timegroups(arg_0,
                                             arg_2=arg_2)

    # find all the non-nan indices
    arg_8 = np.isfinite(arg_1)

    if any(arg_8):

        # find the global median
        arg_9 = np.median(arg_1[arg_8])

        # go through the groups and normalize them to the median for
        # each group
        for arg_10, arg_11 in enumerate(arg_7):

            arg_8 = np.isfinite(arg_1[arg_11])

            # find this timegroup's median mag and normalize the mags in
            # it to this median
            arg_12 = np.median((arg_1[arg_11])[arg_8])

            if arg_4:
                arg_1[arg_11] = arg_1[arg_11]/arg_12
            else:
                arg_1[arg_11] = arg_1[arg_11] - arg_12

            if arg_5:
                LOGDEBUG('group %s: elems %s, '
                         'finite elems %s, median mag %s' %
                         (arg_10,
                          len(arg_1[arg_11]),
                          len(arg_8),
                          arg_12))

        # now that everything is normalized to 0.0, add the global median
        # offset back to all the mags and write the result back to the dict
        if isinstance(arg_3, str) and arg_3 == 'globalmedian':

            if arg_4:
                arg_1 = arg_1 * arg_9
            else:
                arg_1 = arg_1 + arg_9

        # if the normto is a float, add everything to that float and return
        elif isinstance(arg_3, float):

            if arg_4:
                arg_1 = arg_1 * arg_3
            else:
                arg_1 = arg_1 + arg_3

        # anything else just returns the normalized mags as usual
        return arg_0, arg_1

    else:
        LOGERROR('measurements are all nan!')
        return None, None

This normalizes the magnitude time - series to a specified value .


def Func(arg_0, arg_1):
        """
        Ensure the authentication token for the given auth method is still valid.

        Args:
            auth (Auth): authentication type to check

        Raises:
            .SkypeAuthException: if Skype auth is required, and the current token has expired and can't be renewed
        """
        if arg_1 in (arg_0.Auth.SkypeToken, arg_0.Auth.Authorize):
            if "skype" not in arg_0.tokenExpiry or datetime.now() >= arg_0.tokenExpiry["skype"]:
                if not hasattr(arg_0, "getSkypeToken"):
                    raise SkypeAuthException("Skype token expired, and no password specified")
                arg_0.getSkypeToken()
        elif arg_1 == arg_0.Auth.RegToken:
            if "reg" not in arg_0.tokenExpiry or datetime.now() >= arg_0.tokenExpiry["reg"]:
                arg_0.getRegToken()

Ensure the authentication token for the given auth method is still valid .


(self, redirect_uri, client_id, client_secret,
                              code, callback, fields=None)

def Func(arg_0, arg_1, arg_2, arg_3,
                              arg_4, arg_5, arg_6=None):
      """Handles the login for the Facebook user, returning a user object.

      Example usage::

          class FacebookGraphLoginHandler(LoginHandler, tornado.auth.FacebookGraphMixin):
            @tornado.web.asynchronous
            def get(self):
                if self.get_argument("code", False):
                    self.Func(
                      redirect_uri='/auth/facebookgraph/',
                      client_id=self.settings["facebook_api_key"],
                      client_secret=self.settings["facebook_secret"],
                      code=self.get_argument("code"),
                      callback=self.async_callback(
                        self._on_login))
                    return
                self.authorize_redirect(redirect_uri='/auth/facebookgraph/',
                                        client_id=self.settings["facebook_api_key"],
                                        extra_params={"scope": "read_stream,offline_access"})

            def _on_login(self, user):
              log.error(user)
              self.finish()

      """
      arg_7 = httpclient.AsyncHTTPClient()
      arg_8 = {
        "redirect_uri": arg_1,
        "code": arg_4,
        "client_id": arg_2,
        "client_secret": arg_3,
      }

      #fields = set(['id', 'name', 'first_name', 'last_name',
      #              'locale', 'picture', 'link'])
      #if extra_fields: fields.update(extra_fields)
      if arg_6:
          arg_6 = arg_6.split(',')

      arg_7.fetch(arg_0._oauth_request_token_url(**arg_8),
          arg_0.async_callback(arg_0._on_access_token, arg_1, arg_2,
                              arg_3, arg_5, arg_6))

Handles the login for the Facebook user, returning a user object.

      Example usage::

          class FacebookGraphLoginHandler(LoginHandler, tornado.auth.FacebookGraphMixin):
            @tornado.web.asynchronous
            def get(self):
                if self.get_argument("code", False):
                    self.get_authenticated_user(
                      redirect_uri='/auth/facebookgraph/',
                      client_id=self.settings["facebook_api_key"],
                      client_secret=self.settings["facebook_secret"],
                      code=self.get_argument("code"),
                      callback=self.async_callback(
                        self._on_login))
                    return
                self.authorize_redirect(redirect_uri='/auth/facebookgraph/',
                                        client_id=self.settings["facebook_api_key"],
                                        extra_params={"scope": "read_stream,offline_access"})

            def _on_login(self, user):
              log.error(user)
              self.finish()

Handles the login for the Facebook user returning a user object .


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """
        Openat SystemCall - Similar to open system call except dirfd argument
        when path contained in buf is relative, dirfd is referred to set the relative path
        Special value AT_FDCWD set for dirfd to set path relative to current directory

        :param dirfd: directory file descriptor to refer in case of relative path at buf
        :param buf: address of zero-terminated pathname
        :param flags: file access bits
        :param mode: file permission mode
        """

        arg_5 = arg_0.current.read_string(arg_2)
        arg_1 = ctypes.c_int32(arg_1).value

        if os.path.isabs(arg_5) or arg_1 == arg_0.FCNTL_FDCWD:
            return arg_0.sys_open(arg_2, arg_3, arg_4)

        try:
            arg_6 = arg_0._get_fd(arg_1)
        except FdError as e:
            logger.info("openat: Not valid file descriptor. Returning EBADF")
            return -e.err

        if not isinstance(arg_6, Directory):
            logger.info("openat: Not directory descriptor. Returning ENOTDIR")
            return -errno.ENOTDIR

        arg_7 = arg_6.name

        arg_5 = os.path.join(arg_7, arg_5)
        try:
            arg_8 = arg_0._sys_open_get_file(arg_5, arg_3)
            logger.debug(f"Opening file {filename} for real fd {f.fileno()}")
        except IOError as e:
            logger.info(f"Could not open file {filename}. Reason: {e!s}")
            return -e.errno if e.errno is not None else -errno.EINVAL

        return arg_0._open(arg_8)

Openat SystemCall - Similar to open system call except dirfd argument when path contained in buf is relative dirfd is referred to set the relative path Special value AT_FDCWD set for dirfd to set path relative to current directory


def Func(arg_0, arg_1, arg_2, **arg_3):
        """Makes a Facebook API REST request.

        We automatically include the Facebook API key and signature, but
        it is the callers responsibility to include 'session_key' and any
        other required arguments to the method.

        The available Facebook methods are documented here:
        http://wiki.developers.facebook.com/index.php/API

        Here is an example for the stream.get() method::

            class MainHandler(tornado.web.RequestHandler,
                              tornado.auth.FacebookMixin):
                @tornado.web.authenticated
                @tornado.web.asynchronous
                def get(self):
                    self.Func(
                        method="stream.get",
                        callback=self.async_callback(self._on_stream),
                        session_key=self.current_user["session_key"])

                def _on_stream(self, stream):
                    if stream is None:
                       # Not authorized to read the stream yet?
                       self.redirect(self.authorize_redirect("read_stream"))
                       return
                    self.render("stream.html", stream=stream)

        """
        arg_0.require_setting("facebook_api_key", "Facebook Connect")
        arg_0.require_setting("facebook_secret", "Facebook Connect")
        if not arg_1.startswith("facebook."):
            arg_1 = "facebook." + arg_1
        arg_3["api_key"] = arg_0.settings["facebook_api_key"]
        arg_3["v"] = "1.0"
        arg_3["method"] = arg_1
        arg_3["call_id"] = str(long(time.time() * 1e6))
        arg_3["format"] = "json"
        arg_3["sig"] = arg_0._signature(arg_3)
        arg_4 = "http://api.facebook.com/restserver.php?" + \
            urllib.urlencode(arg_3)
        arg_5 = httpclient.AsyncHTTPClient()
        arg_5.fetch(arg_4, arg_2=arg_0.async_callback(
            arg_0._parse_response, arg_2))

Makes a Facebook API REST request.

        We automatically include the Facebook API key and signature, but
        it is the callers responsibility to include 'session_key' and any
        other required arguments to the method.

        The available Facebook methods are documented here:
        http://wiki.developers.facebook.com/index.php/API

        Here is an example for the stream.get() method::

            class MainHandler(tornado.web.RequestHandler,
                              tornado.auth.FacebookMixin):
                @tornado.web.authenticated
                @tornado.web.asynchronous
                def get(self):
                    self.facebook_request(
                        method="stream.get",
                        callback=self.async_callback(self._on_stream),
                        session_key=self.current_user["session_key"])

                def _on_stream(self, stream):
                    if stream is None:
                       # Not authorized to read the stream yet?
                       self.redirect(self.authorize_redirect("read_stream"))
                       return
                    self.render("stream.html", stream=stream)


def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
in
arg_0
.
chains
:
delattr
(
arg_0
.
chains
,
arg_1
)
else
:
raise
ValueError
(
"Chain with this name not found"
)

def Func(arg_0, arg_1):
        """
        Remove chain from current shelve file

        Args:
            name: chain name
        """

        if arg_1 in arg_0.chains:
            delattr(arg_0.chains, arg_1)
        else:
            raise ValueError("Chain with this name not found")


def Func ( arg_0 ) : while not LWLink . the_queue . empty ( ) : arg_0 . _send_reliable_message ( LWLink . the_queue . get_nowait ( ) )

def Func(arg_0):
        """If the queue is not empty, process the queue."""
        while not LWLink.the_queue.empty():
            arg_0._send_reliable_message(LWLink.the_queue.get_nowait())

If the queue is not empty process the queue .


def Func(arg_0):
  """ Parses, validates, and executes command-line options;

  On success: Performs requested operation and exits program normally

  On Error:   Dumps exception/error info in JSON format to stdout and exits the
              program with non-zero status.
  """

  # -----------------------------------------------------------------
  # Parse command line options
  #
  arg_1 = OptionParser()
  arg_1.set_usage("%prog [options] --description='{json object with args}'\n" + \
                   "%prog [options] --descriptionFromFile='{filename}'\n" + \
                   "%prog [options] --showSchema")

  arg_1.add_option("--description", dest = "description",
    help = "Tells ExpGenerator to generate an experiment description.py and " \
           "permutations.py file using the given JSON formatted experiment "\
           "description string.")

  arg_1.add_option("--descriptionFromFile", dest = 'descriptionFromFile',
    help = "Tells ExpGenerator to open the given filename and use it's " \
           "contents as the JSON formatted experiment description.")

  arg_1.add_option("--claDescriptionTemplateFile",
    dest = 'claDescriptionTemplateFile',
    default = 'claDescriptionTemplate.tpl',
    help = "The file containing the template description file for " \
           " ExpGenerator [default: %default]")

  arg_1.add_option("--showSchema",
                    action="store_true", dest="showSchema",
                    help="Prints the JSON schemas for the --description arg.")

  arg_1.add_option("--version", dest = 'version', default='v2',
    help = "Generate the permutations file for this version of hypersearch."
            " Possible choices are 'v1' and 'v2' [default: %default].")

  arg_1.add_option("--outDir",
                    dest = "outDir", default=None,
                    help = "Where to generate experiment. If not specified, " \
                           "then a temp directory will be created"
                    )
  (arg_2, arg_3) = arg_1.parse_args(arg_0)

  #print("OPTIONS=%s" % (str(options)))

  # -----------------------------------------------------------------
  # Check for unprocessed args
  #
  if len(arg_3) > 0:
    raise _InvalidCommandArgException(
      _makeUsageErrorStr("Unexpected command-line args: <%s>" % \
                         (' '.join(arg_3),), arg_1.get_usage()))

  # -----------------------------------------------------------------
  # Check for use of mutually-exclusive options
  #
  arg_4 = filter(lambda x: getattr(arg_2, x) != None,
                         ('description', 'showSchema'))
  if len(arg_4) > 1:
    raise _InvalidCommandArgException(
      _makeUsageErrorStr(("The specified command options are " + \
                          "mutually-exclusive: %s") % (arg_4,),
                          arg_1.get_usage()))

  # -----------------------------------------------------------------
  # Process requests
  #
  if arg_2.showSchema:
    _handleShowSchemaOption()

  elif arg_2.description:
    _handleDescriptionOption(arg_2.description, arg_2.outDir,
           arg_1.get_usage(), hsVersion=arg_2.version,
           claDescriptionTemplateFile = arg_2.claDescriptionTemplateFile)

  elif arg_2.descriptionFromFile:
    _handleDescriptionFromFileOption(arg_2.descriptionFromFile,
          arg_2.outDir, arg_1.get_usage(), hsVersion=arg_2.version,
          claDescriptionTemplateFile = arg_2.claDescriptionTemplateFile)

  else:
    raise _InvalidCommandArgException(
      _makeUsageErrorStr("Error in validating command options. No option "
                         "provided:\n", arg_1.get_usage()))

Parses validates and executes command - line options ;


def Func(*arg_0: arg_1) -> Callable:
    """decorator to store messages that are handled by a checker method"""

    def store_messages(arg_2):
        arg_2.checks_msgs = arg_0
        return arg_2

    return store_messages


def Func(arg_0, arg_1, arg_2, arg_3):
    """Transform a QuantumChannel to the Choi representation."""
    if arg_0 == 'Choi':
        return arg_1
    if arg_0 == 'Operator':
        return _from_operator('Choi', arg_1, arg_2, arg_3)
    if arg_0 == 'SuperOp':
        return _superopFunc(arg_1, arg_2, arg_3)
    if arg_0 == 'Kraus':
        return _krausFunc(arg_1, arg_2, arg_3)
    if arg_0 == 'Chi':
        return _chiFunc(arg_1, arg_2, arg_3)
    if arg_0 == 'PTM':
        arg_1 = _ptm_to_superop(arg_1, arg_2, arg_3)
        return _superopFunc(arg_1, arg_2, arg_3)
    if arg_0 == 'Stinespring':
        return _stinespringFunc(arg_1, arg_2, arg_3)
    raise QiskitError('Invalid QuantumChannel {}'.format(arg_0))

Transform a QuantumChannel to the Choi representation .


def Func ( arg_0 , ** arg_1 ) : arg_2 = core . stft ( arg_0 ) arg_3 = decompose . hpss ( arg_2 , ** arg_1 ) [ 1 ] arg_4 = util . fix_length ( core . istft ( arg_3 , dtype = arg_0 . dtype ) , len ( arg_0 ) ) return arg_4

def Func(arg_0, **arg_1):
    '''Extract Func elements from an audio time-series.

    Parameters
    ----------
    y : np.ndarray [shape=(n,)]
        audio time series
    kwargs : additional keyword arguments.
        See `librosa.decompose.hpss` for details.

    Returns
    -------
    y_Func : np.ndarray [shape=(n,)]
        audio time series of just the Func portion

    See Also
    --------
    hpss : Separate harmonic and Func components
    harmonic : Extract only the harmonic component
    librosa.decompose.hpss : HPSS for spectrograms

    Examples
    --------
    >>> # Extract Func component
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> y_Func = librosa.effects.Func(y)

    >>> # Use a margin > 1.0 for greater Func separation
    >>> y_Func = librosa.effects.Func(y, margin=3.0)

    '''

    # Compute the STFT matrix
    arg_2 = core.stft(arg_0)

    # Remove harmonics
    arg_3 = decompose.hpss(arg_2, **arg_1)[1]

    # Invert the STFT
    arg_4 = util.fix_length(core.istft(arg_3, dtype=arg_0.dtype), len(arg_0))

    return arg_4

Extract percussive elements from an audio time-series.

    Parameters
    ----------
    y : np.ndarray [shape=(n,)]
        audio time series
    kwargs : additional keyword arguments.
        See `librosa.decompose.hpss` for details.

    Returns
    -------
    y_percussive : np.ndarray [shape=(n,)]
        audio time series of just the percussive portion

    See Also
    --------
    hpss : Separate harmonic and percussive components
    harmonic : Extract only the harmonic component
    librosa.decompose.hpss : HPSS for spectrograms

    Examples
    --------
    >>> # Extract percussive component
    >>> y, sr = librosa.load(librosa.util.example_audio_file())
    >>> y_percussive = librosa.effects.percussive(y)

    >>> # Use a margin > 1.0 for greater percussive separation
    >>> y_percussive = librosa.effects.percussive(y, margin=3.0)

Extract percussive elements from an audio time - series .


def Func(arg_0, arg_1):
        """Get the activity of a bug in HTML format.

        :param bug_id: bug identifier
        """
        arg_2 = {
            arg_0.PBUG_ID: arg_1
        }

        arg_3 = arg_0.call(arg_0.CGI_BUG_ACTIVITY, arg_2)

        return arg_3

Get the activity of a bug in HTML format .


def Func ( arg_0 , arg_1 , arg_2 ) : arg_0 . log = arg_3 arg_0 . source = arg_1 . readlines ( ) arg_5 = "" . join ( arg_0 . source ) compile ( arg_5 , arg_2 , "exec" ) arg_0 . stream = TokenStream ( StringIO ( arg_5 ) ) arg_0 . filename = arg_2 arg_0 . all = None arg_0 . future_imports = set ( ) arg_0 . _accumulated_decorators = [ ] return arg_0 . Func_module ( )

def Func(arg_0, arg_1, arg_2):
        """Parse the given file-like object and return its Module object."""
        arg_0.log = arg_3
        arg_0.source = arg_1.readlines()
        arg_5 = "".join(arg_0.source)
        # This may raise a SyntaxError:
        compile(arg_5, arg_2, "exec")
        arg_0.stream = TokenStream(StringIO(arg_5))
        arg_0.filename = arg_2
        arg_0.all = None
        arg_0.future_imports = set()
        arg_0._accumulated_decorators = []
        return arg_0.Func_module()

Parse the given file - like object and return its Module object .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_0
.
_lock
.
acquire_write
(
)
try
:
assert
arg_2
.
get
(
"token"
)
is
assert
arg_2
.
get
(
"expire"
)
is
,
"Use timeout instead of expire"
assert
arg_1
and
"/"
in
arg_1
arg_3
=
arg_1
arg_1
=
normalize_lock_root
(
arg_1
)
arg_2
[
"root"
]
=
arg_1
arg_4
=
float
(
arg_2
.
get
(
"timeout"
)
)
if
arg_4
is
:
arg_4
=
LockStorageDict
.
LOCK_TIME_OUT_DEFAULT
elif
arg_4
<
0
or
arg_4
>
LockStorageDict
.
LOCK_TIME_OUT_MAX
:
arg_4
=
LockStorageDict
.
LOCK_TIME_OUT_MAX
arg_2
[
"timeout"
]
=
arg_4
arg_2
[
"expire"
]
=
time
.
time
(
)
+
arg_4
validate_lock
(
arg_2
)
arg_5
=
generate_lock_token
(
)
arg_2
[
"token"
]
=
arg_5
arg_0
.
_dict
[
arg_5
]
=
arg_2
arg_7
=
"URL2TOKEN:{}"
.
format
(
arg_1
)
if
arg_7
not
in
arg_0
.
_dict
:
arg_0
.
_dict
[
arg_7
]
=
[
arg_5
]
else
:
arg_8
=
arg_0
.
_dict
[
arg_7
]
arg_8
.
append
(
arg_5
)
arg_0
.
_dict
[
arg_7
]
=
arg_8
arg_0
.
_flush
(
)
_logger
.
debug
(
"LockStorageDict.set({!r}): {}"
.
format
(
arg_3
,
lock_string
(
arg_2
)
)
)
return
arg_2
finally
:
arg_0
.
_lock
.
release
(
)

def Func(arg_0, arg_1, arg_2):
        """Create a direct lock for a resource path.

        path:
            Normalized path (utf8 encoded string, no trailing '/')
        lock:
            lock dictionary, without a token entry
        Returns:
            New unique lock token.: <lock

        **Note:** the lock dictionary may be modified on return:

        - lock['root'] is ignored and set to the normalized <path>
        - lock['timeout'] may be normalized and shorter than requested
        - lock['token'] is added
        """
        arg_0._lock.acquire_write()
        try:
            # We expect only a lock definition, not an existing lock
            assert arg_2.get("token") is None
            assert arg_2.get("expire") is None, "Use timeout instead of expire"
            assert arg_1 and "/" in arg_1

            # Normalize root: /foo/bar
            arg_3 = arg_1
            arg_1 = normalize_lock_root(arg_1)
            arg_2["root"] = arg_1

            # Normalize timeout from ttl to expire-date
            arg_4 = float(arg_2.get("timeout"))
            if arg_4 is None:
                arg_4 = LockStorageDict.LOCK_TIME_OUT_DEFAULT
            elif arg_4 < 0 or arg_4 > LockStorageDict.LOCK_TIME_OUT_MAX:
                arg_4 = LockStorageDict.LOCK_TIME_OUT_MAX

            arg_2["timeout"] = arg_4
            arg_2["expire"] = time.time() + arg_4

            validate_lock(arg_2)

            arg_5 = generate_lock_token()
            arg_2["token"] = arg_5

            # Store lock
            arg_0._dict[arg_5] = arg_2

            # Store locked path reference
            arg_7 = "URL2TOKEN:{}".format(arg_1)
            if arg_7 not in arg_0._dict:
                arg_0._dict[arg_7] = [arg_5]
            else:
                # Note: Shelve dictionary returns copies, so we must reassign
                # values:
                arg_8 = arg_0._dict[arg_7]
                arg_8.append(arg_5)
                arg_0._dict[arg_7] = arg_8
            arg_0._flush()
            _logger.debug(
                "LockStorageDict.set({!r}): {}".format(arg_3, lock_string(arg_2))
            )
            return arg_2
        finally:
            arg_0._lock.release()

Create a direct lock for a resource path .


def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
is
:
return
arg_0
is
if
isinstance
(
arg_1
,
_primitive_type
)
:
return
arg_0
==
arg_1
if
arg_1
is
str
:
return
isinstance
(
arg_0
,
_str_type
)
if
arg_1
is
int
:
return
isinstance
(
arg_0
,
_int_type
)
if
arg_1
is
numeric
:
return
isinstance
(
arg_0
,
_num_type
)
if
isinstance
(
arg_1
,
MagicType
)
:
return
arg_1
.
check
(
arg_0
)
if
isinstance
(
arg_1
,
type
)
:
return
isinstance
(
arg_0
,
arg_1
)
if
isinstance
(
arg_1
,
list
)
:
arg_2
=
U
(
*
arg_1
)
return
isinstance
(
arg_0
,
list
)
and
all
(
Func
(
arg_3
,
arg_2
)
for
arg_3
in
arg_0
)
if
isinstance
(
arg_1
,
set
)
:
arg_2
=
U
(
*
arg_1
)
return
isinstance
(
arg_0
,
set
)
and
all
(
Func
(
arg_3
,
arg_2
)
for
arg_3
in
arg_0
)
if
isinstance
(
arg_1
,
tuple
)
:
return
(
isinstance
(
arg_0
,
tuple
)
and
len
(
arg_1
)
==
len
(
arg_0
)
and
all
(
Func
(
arg_0
[
arg_4
]
,
arg_1
[
arg_4
]
)
for
arg_4
in
range
(
len
(
arg_1
)
)
)
)
if
isinstance
(
arg_1
,
dict
)
:
arg_5
=
U
(
*
viewitems
(
arg_1
)
)
return
isinstance
(
arg_0
,
dict
)
and
all
(
Func
(
arg_6
,
arg_5
)
for
arg_6
in
viewitems
(
arg_0
)
)
if
isinstance
(
arg_1
,
(
FunctionType
,
BuiltinFunctionType
)
)
:
return
arg_1
(
arg_0
)
raise
RuntimeError
(
"Ivalid type %r in Func()"
%
arg_1
)

def Func(arg_0, arg_1):
    """
    Return True if the variable is of the specified type, and False otherwise.

    :param var: variable to check
    :param vtype: expected variable's type
    """
    if arg_1 is None:
        return arg_0 is None
    if isinstance(arg_1, _primitive_type):
        return arg_0 == arg_1
    if arg_1 is str:
        return isinstance(arg_0, _str_type)
    if arg_1 is int:
        return isinstance(arg_0, _int_type)
    if arg_1 is numeric:
        return isinstance(arg_0, _num_type)
    if isinstance(arg_1, MagicType):
        return arg_1.check(arg_0)
    if isinstance(arg_1, type):
        # ``vtype`` is a name of the class, or a built-in type such as "list", "tuple", etc
        return isinstance(arg_0, arg_1)
    if isinstance(arg_1, list):
        # ``vtype`` is a list literal
        arg_2 = U(*arg_1)
        return isinstance(arg_0, list) and all(Func(arg_3, arg_2) for arg_3 in arg_0)
    if isinstance(arg_1, set):
        # ``vtype`` is a set literal
        arg_2 = U(*arg_1)
        return isinstance(arg_0, set) and all(Func(arg_3, arg_2) for arg_3 in arg_0)
    if isinstance(arg_1, tuple):
        # ``vtype`` is a tuple literal
        return (isinstance(arg_0, tuple) and len(arg_1) == len(arg_0) and
                all(Func(arg_0[arg_4], arg_1[arg_4]) for arg_4 in range(len(arg_1))))
    if isinstance(arg_1, dict):
        # ``vtype`` is a dict literal
        arg_5 = U(*viewitems(arg_1))
        return isinstance(arg_0, dict) and all(Func(arg_6, arg_5) for arg_6 in viewitems(arg_0))
    if isinstance(arg_1, (FunctionType, BuiltinFunctionType)):
        return arg_1(arg_0)
    raise RuntimeError("Ivalid type %r in Func()" % arg_1)

Return True if the variable is of the specified type and False otherwise .


return cls.at_time(cls._localize(when), daily, target)

def Func ( arg_0 , arg_1 , arg_2 ) : arg_3 = datetime . timedelta ( days = 1 ) arg_4 = datetime . datetime . combine ( datetime . date . today ( ) , arg_1 ) if arg_4 < now ( ) : arg_4 += arg_3 return arg_0 . at_time ( arg_0 . _localize ( arg_4 ) , arg_3 , arg_2 )

def Func(arg_0, arg_1, arg_2):
        """
        Schedule a command to run at a specific time each day.
        """
        arg_3 = datetime.timedelta(days=1)
        # convert when to the next datetime matching this time
        arg_4 = datetime.datetime.combine(datetime.date.today(), arg_1)
        if arg_4 < now():
            arg_4 += arg_3
        return arg_0.at_time(arg_0._localize(arg_4), arg_3, arg_2)

Schedule a command to run at a specific time each day .


def Func ( arg_0 , arg_1 , arg_2 , arg_3 ) : arg_0 . api . sub ( arg_1 , arg_2 , * arg_3 )

def Func(arg_0, arg_1, arg_2, arg_3):
        """DDP sub handler."""
        arg_0.api.sub(arg_1, arg_2, *arg_3)


def Func ( arg_0 , arg_1 ) : arg_2 , arg_3 = os . path . split ( arg_1 ) if '*' in arg_3 : return arg_2 + '/' else : return arg_1

def Func(arg_0, arg_1):
    """Returns a directory or file path to be the target for "gsutil cp".

    If the filename contains a wildcard, then the target path must
    be a directory in order to ensure consistency whether the source pattern
    contains one or multiple files.

    Args:
      local_file_path: A full path terminating in a file or a file wildcard.

    Returns:
      The path to use as the "gsutil cp" target.
    """

    arg_2, arg_3 = os.path.split(arg_1)
    if '*' in arg_3:
      return arg_2 + '/'
    else:
      return arg_1

Returns a directory or file path to be the target for gsutil cp .


"""\SELECT combined_row.url, row_to_json(combined_row) FROM (  SELECT "code", "version", "name", "url", "is_valid_for_publication"  FROM licenses) AS combined_row"""

def Func():
    """Obtain the licenses in a dictionary form, keyed by url."""
    with db_connect() as db_conn:
        with db_conn.cursor() as cursor:
            cursor.execute("""\
SELECT combined_row.url, row_to_json(combined_row) FROM (
  SELECT "code", "version", "name", "url", "is_valid_for_publication"
  FROM licenses) AS combined_row""")
            arg_0 = {r[0]: r[1] for r in cursor.fetchall()}
    return arg_0

Obtain the licenses in a dictionary form keyed by url .


def Func(arg_0):
    """Escape the error, and wrap it in a span with class ``error-message``"""
    arg_1 = formencode.htmlfill.escape_formatter(arg_0)
    return u'{0}'.format(arg_1)

Escape the error and wrap it in a span with class error - message


def
Func
(
arg_0
)
:
print
(
"%-46s %19s %12s"
%
(
"File Name"
,
"Modified    "
,
"Size"
)
)
for
arg_1
in
arg_0
.
filelist
:
arg_2
=
"%d-%02d-%02d %02d:%02d:%02d"
%
arg_1
.
date_time
[
:
6
]
print
(
"%-46s %s %12d"
%
(
arg_1
.
filename
,
arg_2
,
arg_1
.
file_size
)
)

def Func(arg_0):
        """Print a table of contents for the RAR file."""
        print("%-46s %19s %12s" % ("File Name", "Modified    ", "Size"))
        for arg_1 in arg_0.filelist:
            arg_2 = "%d-%02d-%02d %02d:%02d:%02d" % arg_1.date_time[:6]
            print("%-46s %s %12d" % (
                arg_1.filename, arg_2, arg_1.file_size))

Print a table of contents for the RAR file .


def Func(arg_0, arg_1):
        """
        This method stops an I2C_READ_CONTINUOUSLY operation for the i2c device address specified.

        :param address: address of i2c device
        """
        arg_2 = [arg_1, arg_0.I2C_STOP_READING]
        arg_0._command_handler.send_sysex(arg_0._command_handler.I2C_REQUEST, arg_2)

This method stops an I2C_READ_CONTINUOUSLY operation for the i2c device address specified .


def
Func
(
arg_0
,
**
arg_1
)
:
print
'Generating the Record Collection...\n'
arg_0
[
'index_original'
]
=
arg_0
.
index
arg_0
.
reset_index
(
drop
=
True
,
inplace
=
True
)
if
pd
.
__version__
>=
'0.15.0'
:
arg_2
=
arg_0
.
T
.
to_dict
(
orient
=
'series'
)
else
:
arg_2
=
arg_0
.
T
.
to_dict
(
outtype
=
'series'
)
arg_3
=
[
load_record
(
item
,
arg_1
)
for
item
in
arg_2
.
items
(
)
]
return
arg_3

def Func(arg_0, **arg_1):
    '''
    Generates a list of Record objects given a DataFrame.
    Each Record instance has a series attribute which is a pandas.Series of the same attributes
    in the DataFrame.
    Optional data can be passed in through kwargs which will be included by the name of each object.

    parameters
    ----------
    df : pandas.DataFrame
    kwargs : alternate arguments to be saved by name to the series of each object

    Returns
    -------
    collection : list
        list of Record objects where each Record represents one row from a dataframe

    Examples
    --------
    This is how we generate a Record Collection from a DataFrame.

    >>> import pandas as pd
    >>> import turntable
    >>>
    >>> df = pd.DataFrame({'Artist':"""Michael Jackson, Pink Floyd, Whitney Houston, Meat Loaf,
        Eagles, Fleetwood Mac, Bee Gees, AC/DC""".split(', '),
    >>> 'Album' :"""Thriller, The Dark Side of the Moon, The Bodyguard, Bat Out of Hell,
        Their Greatest Hits (1971-1975), Rumours, Saturday Night Fever, Back in Black""".split(', ')})
    >>> collection = turntable.press.Func(df, my_favorite_record = 'nevermind')
    >>> record = collection[0]
    >>> print record.series

    '''

    print 'Generating the Record Collection...\n'

    arg_0['index_original'] = arg_0.index
    arg_0.reset_index(drop=True, inplace=True)

    if pd.__version__ >= '0.15.0':
        arg_2 = arg_0.T.to_dict(orient='series')
    else:
        arg_2 = arg_0.T.to_dict(outtype='series')

    arg_3 = [load_record(item, arg_1) for item in arg_2.items()]
    return arg_3

Generates a list of Record objects given a DataFrame.
    Each Record instance has a series attribute which is a pandas.Series of the same attributes
    in the DataFrame.
    Optional data can be passed in through kwargs which will be included by the name of each object.

    parameters
    ----------
    df : pandas.DataFrame
    kwargs : alternate arguments to be saved by name to the series of each object

    Returns
    -------
    collection : list
        list of Record objects where each Record represents one row from a dataframe

    Examples
    --------
    This is how we generate a Record Collection from a DataFrame.

    >>> import pandas as pd
    >>> import turntable
    >>>
    >>> df = pd.DataFrame({'Artist':"""Michael Jackson, Pink Floyd, Whitney Houston, Meat Loaf,
        Eagles, Fleetwood Mac, Bee Gees, AC/DC""".split(', '),
    >>> 'Album' :"""Thriller, The Dark Side of the Moon, The Bodyguard, Bat Out of Hell,
        Their Greatest Hits (1971-1975), Rumours, Saturday Night Fever, Back in Black""".split(', ')})
    >>> collection = turntable.press.build_collection(df, my_favorite_record = 'nevermind')
    >>> record = collection[0]
    >>> print record.series

Generates a list of Record objects given a DataFrame . Each Record instance has a series attribute which is a pandas . Series of the same attributes in the DataFrame . Optional data can be passed in through kwargs which will be included by the name of each object .


def Func(arg_0):
        """Get Offer Price and Currency.

        Return price according to the following process:

        * If product has a sale return Sales Price, otherwise,
        * Return Price, otherwise,
        * Return lowest offer price, otherwise,
        * Return None.

        :return:
            A tuple containing:

                1. Float representation of price.
                2. ISO Currency code (string).
        """
        arg_1 = arg_0._safe_get_element_text(
            'Offers.Offer.OfferListing.SalePrice.Amount')
        if arg_1:
            arg_2 = arg_0._safe_get_element_text(
                'Offers.Offer.OfferListing.SalePrice.CurrencyCode')
        else:
            arg_1 = arg_0._safe_get_element_text(
                'Offers.Offer.OfferListing.Price.Amount')
            if arg_1:
                arg_2 = arg_0._safe_get_element_text(
                    'Offers.Offer.OfferListing.Price.CurrencyCode')
            else:
                arg_1 = arg_0._safe_get_element_text(
                    'OfferSummary.LowestNewPrice.Amount')
                arg_2 = arg_0._safe_get_element_text(
                    'OfferSummary.LowestNewPrice.CurrencyCode')
        if arg_1:
            return float(arg_1) / 100, arg_2
        else:
            return None, None


def Func ( ) : for arg_0 in settings . INSTALLED_APPS : arg_1 = import_module ( arg_0 ) try : arg_2 = copy . copy ( arg_3 . _registry ) import_module ( '{}.registered_blocks' . format ( arg_0 ) ) except : arg_3 . _registry = arg_2 if module_has_submodule ( arg_1 , 'registered_blocks' ) : raise

def Func():
    """
    Auto-discover INSTALLED_APPS registered_blocks.py modules and fail
    silently when not present. This forces an import on them thereby
    registering their blocks.

    This is a near 1-to-1 copy of how django's admin application registers
    models.
    """

    for arg_0 in settings.INSTALLED_APPS:
        arg_1 = import_module(arg_0)
        # Attempt to import the app's sizedimage module.
        try:
            arg_2 = copy.copy(
                arg_3._registry
            )
            import_module('{}.registered_blocks'.format(arg_0))
        except:
            # Reset the block_registry to the state before the last
            # import as this import will have to reoccur on the next request
            # and this could raise NotRegistered and AlreadyRegistered
            # exceptions (see django ticket #8245).
            arg_3._registry = arg_2

            # Decide whether to bubble up this error. If the app just
            # doesn't have a stuff module, we can ignore the error
            # attempting to import it, otherwise we want it to bubble up.
            if module_has_submodule(arg_1, 'registered_blocks'):
                raise

Auto - discover INSTALLED_APPS registered_blocks . py modules and fail silently when not present . This forces an import on them thereby registering their blocks .


def Func ( arg_0 ) : for arg_1 in itertools . chain ( arg_0 . input_expectations , arg_0 . output_expectations , arg_0 . transforms ) : if arg_1 . event_type == DagsterEventType . STEP_FAILURE : return arg_1 . step_Func

def Func(arg_0):
        '''Returns the failing step's data that happened during this solid's execution, if any'''
        for arg_1 in itertools.chain(
            arg_0.input_expectations, arg_0.output_expectations, arg_0.transforms
        ):
            if arg_1.event_type == DagsterEventType.STEP_FAILURE:
                return arg_1.step_Func

Returns the failing step s data that happened during this solid s execution if any


def Func ( arg_0 , arg_1 , arg_2 ) : for arg_3 in arg_2 [ arg_1 . filename ] : if arg_1 == arg_3 : return arg_3

def Func(arg_0, arg_1, arg_2):
        '''Helper function for retrieving a particular entry from the prefix trees'''
        for arg_3 in arg_2[arg_1.filename]:
            if arg_1 == arg_3:
                return arg_3


def
Func
(
arg_0
,
arg_1
)
:
if
arg_1
.
id
not
in
arg_0
.
Func_ids
:
return
try
:
arg_0
.
Funcs
[
arg_1
.
id
]
=
Node
(
arg_1
.
id
,
arg_1
.
location
.
lon
,
arg_1
.
location
.
lat
,
{
t
.
k
:
t
.
v
for
t
in
arg_1
.
tags
}
)
except
o
.
InvalidLocationError
:
logging
.
debug
(
'InvalidLocationError at Func %s'
,
arg_1
.
id
)

def Func(arg_0, arg_1):
        """Process each Func."""
        if arg_1.id not in arg_0.Func_ids:
            return

        try:
            arg_0.Funcs[arg_1.id] =\
              Node(arg_1.id,
                   arg_1.location.lon,
                   arg_1.location.lat,
                   {t.k: t.v for t in arg_1.tags})
        except o.InvalidLocationError:
            logging.debug('InvalidLocationError at Func %s', arg_1.id)


(self, cmd, show_stdout=True, cwd=None,
                    raise_on_returncode=True,
                    command_level=logging.DEBUG, command_desc=None,
                    extra_environ=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
True
,
arg_3
=
,
arg_4
=
True
,
arg_5
=
arg_6
.
DEBUG
,
arg_8
=
,
arg_9
=
)
:
arg_1
=
[
arg_0
.
name
]
+
arg_1
try
:
return
call_subprocess
(
arg_1
,
arg_2
,
arg_3
,
arg_4
,
arg_5
,
arg_8
,
arg_9
)
except
OSError
as
e
:
if
e
.
errno
==
errno
.
ENOENT
:
raise
BadCommand
(
'Cannot find command %r'
%
arg_0
.
name
)
else
:
raise

def Func(arg_0, arg_1, arg_2=True, arg_3=None,
                    arg_4=True,
                    arg_5=arg_6.DEBUG, arg_8=None,
                    arg_9=None):
        """
        Run a VCS subcommand
        This is simply a wrapper around call_subprocess that adds the VCS
        command name, and checks that the VCS is available
        """
        arg_1 = [arg_0.name] + arg_1
        try:
            return call_subprocess(arg_1, arg_2, arg_3,
                                   arg_4, arg_5,
                                   arg_8, arg_9)
        except OSError as e:
            # errno.ENOENT = no such file or directory
            # In other words, the VCS executable isn't available
            if e.errno == errno.ENOENT:
                raise BadCommand('Cannot find command %r' % arg_0.name)
            else:
                raise

Run a VCS subcommand This is simply a wrapper around call_subprocess that adds the VCS command name and checks that the VCS is available


def Func ( arg_0 , arg_1 , arg_2 ) : try : arg_3 = arg_0 . _get_menu_handle ( arg_1 , arg_2 , False ) if arg_3 . AXEnabled : return 1 except LdtpServerException : pass return 0

def Func(arg_0, arg_1, arg_2):
        """
        Verify a menu item is enabled

        @param window_name: Window name to look for, either full name,
        LDTP's name convention, or a Unix glob.
        @type window_name: string
        @param object_name: Object name to look for, either full name,
        LDTP's name convention, or a Unix glob. Or menu heirarchy
        @type object_name: string

        @return: 1 on success.
        @rtype: integer
        """
        try:
            arg_3 = arg_0._get_menu_handle(arg_1, arg_2,
                                                False)
            if arg_3.AXEnabled:
                return 1
        except LdtpServerException:
            pass
        return 0


return _colmean((y_predicted - y_actual).abs())

def Func ( arg_0 , arg_1 , arg_2 = None ) : ModelBase . _check_targets ( arg_0 , arg_1 ) return _colmean ( ( arg_1 - arg_0 ) . abs ( ) )

def Func(arg_0, arg_1, arg_2=None):
    """
    Mean absolute error regression loss.

    :param y_actual: H2OFrame of actual response.
    :param y_predicted: H2OFrame of predicted response.
    :param weights: (Optional) sample weights
    :returns: mean absolute error loss (best is 0.0).
    """
    ModelBase._check_targets(arg_0, arg_1)
    return _colmean((arg_1 - arg_0).abs())


def Func(arg_0, arg_1):
    """
    Performs some environment checks prior to the program's execution
    """
    if not git.exists():
        click.secho('You must have git installed to use yld.', fg='red')
        sys.exit(1)

    if not os.path.isdir('.git'):
        click.secho('You must cd into a git repository to use yld.', fg='red')
        sys.exit(1)

    if not git.is_committed():
        click.secho('You must commit or stash your work before proceeding.',
                    fg='red')
        sys.exit(1)

    if arg_0 is None and arg_1 is None:
        click.secho('You must specify either a target or a label.', fg='red')
        sys.exit(1)

Performs some environment checks prior to the program s execution


def Func ( arg_0 , arg_1 ) : if isinstance ( arg_1 , str ) : return arg_1 elif isinstance ( arg_1 , datetime ) : return arg_1 . strftime ( '%Y-%m-%dT%H:%M:%S.%fZ' ) else : return None

def Func(arg_0, arg_1):
    """Makes sure we have proper ISO 8601 time.

    :param time: either already ISO 8601 a string or datetime.datetime
    :returns: ISO 8601 time
    :rtype: str

    """
    if isinstance(arg_1, str):
      return arg_1
    elif isinstance(arg_1, datetime):
      return arg_1.strftime('%Y-%m-%dT%H:%M:%S.%fZ')
    else:
      return None

Makes sure we have proper ISO 8601 time .


def Func ( arg_0 : arg_1 ) -> arg_1 : arg_2 = max ( nx . weakly_connected_components ( arg_0 ) , key = len ) return subgraph ( arg_0 , arg_2 )

def Func(arg_0: arg_1) -> arg_1:
    """Get the giant component of a graph."""
    arg_2 = max(nx.weakly_connected_components(arg_0), key=len)
    return subgraph(arg_0, arg_2)


def Func(arg_0, arg_1):
        """ May be used to compress PDF files. Code is more readable
            for testing and inspection if not compressed. Requires a boolean. """
        if isinstance(arg_1, bool):
            arg_0.compression = arg_1
        else:
            raise Exception(
                TypeError, "%s is not a valid option for compression" % arg_1)

May be used to compress PDF files . Code is more readable for testing and inspection if not compressed . Requires a boolean .


def Func(arg_0, arg_1, arg_2=1):
        """Retrieve a raw HTML question and all it's information.

        :param question_id: question identifier
        :param page: page to retrieve
        """
        arg_3 = urijoin(arg_0.base_url, arg_0.HTML_QUESTION, arg_1)
        arg_4 = {
            'page': arg_2,
            'sort': arg_0.ORDER_HTML
        }

        arg_5 = arg_0.fetch(arg_3, payload=arg_4)
        return arg_5.text

Retrieve a raw HTML question and all it s information .


def Func ( arg_0 ) : if isinstance ( arg_0 [ 0 ] , ( tuple , list , ndarray ) ) : return tupleize ( arg_0 [ 0 ] ) elif isinstance ( arg_0 [ 0 ] , Iterable ) and not isinstance ( arg_0 [ 0 ] , str ) : return tupleize ( list ( arg_0 [ 0 ] ) ) else : return tuple ( arg_0 )

def Func(arg_0):
    """
    Coerce a list of arguments to a tuple.

    Parameters
    ----------
    args : tuple or nested tuple
        Pack arguments into a tuple, converting ((,...),) or (,) -> (,)
    """
    if isinstance(arg_0[0], (tuple, list, ndarray)):
        return tupleize(arg_0[0])
    elif isinstance(arg_0[0], Iterable) and not isinstance(arg_0[0], str):
        # coerce any iterable into a list before calling tupleize (Python 3 compatibility)
        return tupleize(list(arg_0[0]))
    else:
        return tuple(arg_0)


def Func ( arg_0 , * arg_1 , ** arg_2 ) : arg_3 = heimdallDevice ( arg_2 . get ( 'device' , None ) ) arg_2 [ 'width' ] = arg_2 . get ( 'width' , None ) or arg_3 . width arg_2 [ 'height' ] = arg_2 . get ( 'height' , None ) or arg_3 . height arg_2 [ 'user_agent' ] = arg_2 . get ( 'user_agent' , None ) or arg_3 . user_agent arg_4 = screenshot ( arg_0 , ** arg_2 ) if arg_2 . get ( 'optimize' ) : arg_5 = Image . open ( arg_4 . path ) arg_5 . Func ( arg_4 . path , optimize = True ) return arg_4

def Func(arg_0, *arg_1, **arg_2):
    """ Parse the options, set defaults and then fire up PhantomJS. """

    arg_3 = heimdallDevice(arg_2.get('device', None))

    arg_2['width'] = arg_2.get('width', None) or arg_3.width
    arg_2['height'] = arg_2.get('height', None) or arg_3.height
    arg_2['user_agent'] = arg_2.get('user_agent', None) or arg_3.user_agent

    arg_4 = screenshot(arg_0, **arg_2)

    if arg_2.get('optimize'):
        arg_5 = Image.open(arg_4.path)
        arg_5.Func(arg_4.path, optimize=True)

    return arg_4

Parse the options set defaults and then fire up PhantomJS .


def Func ( arg_0 ) : for arg_1 , arg_2 in zip ( arg_0 . layers , arg_0 . _hidden_outputs ) : arg_0 . training_monitors . append ( ( 'mean(%s)' % ( arg_1 . name ) , abs ( arg_2 ) . mean ( ) ) )

def Func(arg_0):
        """
        Monitoring the outputs of each layer.
        Useful for troubleshooting convergence problems.
        """
        for arg_1, arg_2 in zip(arg_0.layers, arg_0._hidden_outputs):
            arg_0.training_monitors.append(('mean(%s)' % (arg_1.name), abs(arg_2).mean()))

Monitoring the outputs of each layer . Useful for troubleshooting convergence problems .


(self, size="150", axis=None, padding=None)

return self._constructor(rdd, shape=self.shape, split=self.split,
                                 dtype=self.dtype, plan=self.plan, padding=self.padding, ordered=self._ordered)

def Func(arg_0, arg_1="150", arg_2=None, arg_3=None):
        """
        Split values of distributed array into chunks.

        Transforms an underlying pair RDD of (key, value) into
        records of the form: (key, chunk id), (chunked value).
        Here, chunk id is a tuple identifying the chunk and
        chunked value is a subset of the data from each original value,
        that has been divided along the specified dimensions.

        Parameters
        ----------
        size : str or tuple or int
            If str, the average size (in KB) of the chunks in all value dimensions.
            If int or tuple, an explicit specification of the number chunks in
            each value dimension.

        axis : tuple, optional, default=None
            One or more axes to estimate chunks for, if provided any
            other axes will use one chunk.

        padding: tuple or int, default = None
            Number of elements per dimension that will overlap with the adjacent chunk.
            If a tuple, specifies padding along each chunked dimension; if a int, same
            padding will be applied to all chunked dimensions.
        """
        if arg_0.split == len(arg_0.shape) and arg_3 is None:
            arg_0._rdd = arg_0._rdd.map(lambda kv: (kv[0]+(0,), array(kv[1], ndmin=1)))
            arg_0._shape = arg_0._shape + (1,)
            arg_0._plan = (1,)
            arg_0._padding = array([0])
            return arg_0

        arg_8 = arg_0._rdd
        arg_0._plan, arg_0._padding = arg_0.getplan(arg_1, arg_2, arg_3)

        if any([arg_9 + arg_10 > arg_11 for arg_9, arg_10, arg_11 in zip(arg_0.plan, arg_0.padding, arg_0.vshape)]):
            raise ValueError("Chunk sizes %s plus padding sizes %s cannot exceed value dimensions %s along any axis"
                             % (tuple(arg_0.plan), tuple(arg_0.padding), tuple(arg_0.vshape)))

        if any([arg_9 > arg_10 for arg_9, arg_10 in zip(arg_0.padding, arg_0.plan)]):
            raise ValueError("Padding sizes %s cannot exceed chunk sizes %s along any axis"
                             % (tuple(arg_0.padding), tuple(arg_0.plan)))

        arg_12 = arg_0.getslices(arg_0.plan, arg_0.padding, arg_0.vshape)
        arg_13 = list(product(*[list(enumerate(s)) for s in arg_12]))
        arg_14 = [list(zip(*s)) for s in arg_13]

        def Func(arg_15):
            arg_16, arg_17 = arg_15[0], arg_15[1]
            for (arg_18, arg_19) in arg_14:
                if type(arg_16) is int:
                    arg_16 = (arg_16,)
                yield arg_16 + arg_18, arg_17[arg_19]

        arg_8 = arg_8.flatMap(Func)
        return arg_0._constructor(arg_8, shape=arg_0.shape, split=arg_0.split,
                                 dtype=arg_0.dtype, plan=arg_0.plan, arg_3=arg_0.padding, ordered=arg_0._ordered)

Split values of distributed array into chunks .


return column.ColumnStringArrow(sl.bytes, sl.indices, sl.length, sl.offset, string_sequence=sl)

def Func ( arg_0 ) : arg_1 = _to_string_sequence ( arg_0 ) . capitalize ( ) return column . ColumnStringArrow ( arg_1 . bytes , arg_1 . indices , arg_1 . length , arg_1 . offset , string_sequence = arg_1 )

def Func(arg_0):
    """Capitalize the first letter of a string sample.

    :returns: an expression containing the capitalized strings.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.capitalize()
    Expression = Func(text)
    Length: 5 dtype: str (expression)
    ---------------------------------
    0    Something
    1  Very pretty
    2    Is coming
    3          Our
    4         Way.
    """
    arg_1 = _to_string_sequence(arg_0).capitalize()
    return column.ColumnStringArrow(arg_1.bytes, arg_1.indices, arg_1.length, arg_1.offset, string_sequence=arg_1)

Capitalize the first letter of a string sample.

    :returns: an expression containing the capitalized strings.

    Example:

    >>> import vaex
    >>> text = ['Something', 'very pretty', 'is coming', 'our', 'way.']
    >>> df = vaex.from_arrays(text=text)
    >>> df
      #  text
      0  Something
      1  very pretty
      2  is coming
      3  our
      4  way.

    >>> df.text.str.capitalize()
    Expression = str_capitalize(text)
    Length: 5 dtype: str (expression)
    ---------------------------------
    0    Something
    1  Very pretty
    2    Is coming
    3          Our
    4         Way.

Capitalize the first letter of a string sample .


def Func(arg_0, arg_1):
        """ All package info for given package """

        if arg_1 not in arg_0.Func_cache:
            arg_2 = 'https://pypi.python.org/pypi/%s/json' % arg_1

            try:
                logging.getLogger('requests').setLevel(logging.WARN)
                arg_3 = requests.get(arg_2)
                arg_3.raise_for_status()

                arg_0.Func_cache[arg_1] = simplejson.loads(arg_3.text)

            except Exception as e:
                log.debug('Could not get package info from %s: %s', arg_2, e)
                arg_0.Func_cache[arg_1] = None

        return arg_0.Func_cache[arg_1]


def Func ( arg_0 , arg_1 = None , ** arg_2 ) : arg_1 = arg_1 and _as_dict ( arg_1 ) or { } for arg_3 in arg_1 , arg_2 : for arg_4 , arg_5 in arg_3 . items ( ) : if isinstance ( arg_5 , dict ) : arg_6 = arg_0 [ arg_4 ] for arg_7 , arg_8 in arg_5 . items ( ) : if arg_8 is None : arg_6 . pop ( arg_7 , None ) else : arg_6 [ arg_7 ] = arg_8 else : set_one ( arg_0 , arg_4 , arg_5 )

def Func(arg_0, arg_1=None, **arg_2):
    """Update sections in a Project description"""
    arg_1 = arg_1 and _as_dict(arg_1) or {}
    for arg_3 in arg_1, arg_2:
        for arg_4, arg_5 in arg_3.items():
            if isinstance(arg_5, dict):
                # Only for dicts, merge instead of overwriting
                arg_6 = arg_0[arg_4]
                for arg_7, arg_8 in arg_5.items():
                    if arg_8 is None:
                        arg_6.pop(arg_7, None)
                    else:
                        arg_6[arg_7] = arg_8
            else:
                set_one(arg_0, arg_4, arg_5)


def Func ( arg_0 ) : arg_1 = [ ] while arg_0 . pos < len ( arg_0 . field ) : if arg_0 . field [ arg_0 . pos ] in arg_0 . LWS : arg_0 . pos += 1 elif arg_0 . field [ arg_0 . pos ] == '(' : arg_0 . commentlist . append ( arg_0 . getcomment ( ) ) elif arg_0 . field [ arg_0 . pos ] == '[' : arg_1 . append ( arg_0 . Funcliteral ( ) ) elif arg_0 . field [ arg_0 . pos ] == '.' : arg_0 . pos += 1 arg_1 . append ( '.' ) elif arg_0 . field [ arg_0 . pos ] in arg_0 . atomends : break else : arg_1 . append ( arg_0 . getatom ( ) ) return '' . join ( arg_1 )

def Func(arg_0):
        """Get the complete domain name from an address."""
        arg_1 = []
        while arg_0.pos < len(arg_0.field):
            if arg_0.field[arg_0.pos] in arg_0.LWS:
                arg_0.pos += 1
            elif arg_0.field[arg_0.pos] == '(':
                arg_0.commentlist.append(arg_0.getcomment())
            elif arg_0.field[arg_0.pos] == '[':
                arg_1.append(arg_0.Funcliteral())
            elif arg_0.field[arg_0.pos] == '.':
                arg_0.pos += 1
                arg_1.append('.')
            elif arg_0.field[arg_0.pos] in arg_0.atomends:
                break
            else: arg_1.append(arg_0.getatom())
        return ''.join(arg_1)

Get the complete domain name from an address .


def Func ( arg_0 , arg_1 , arg_2 ) : if not arg_0 . doc_name_set : arg_1 . name = arg_2 arg_0 . doc_name_set = True return True else : raise CardinalityError ( 'Document::Name' )

def Func(arg_0, arg_1, arg_2):
        """Sets the document name.
        Raises CardinalityError if already defined.
        """
        if not arg_0.doc_name_set:
            arg_1.name = arg_2
            arg_0.doc_name_set = True
            return True
        else:
            raise CardinalityError('Document::Name')

Sets the document name . Raises CardinalityError if already defined .


def Func ( arg_0 ) -> dict : arg_1 = { 'response' : { 'shouldEndSession' : False , 'outputSpeech' : { 'type' : 'PlainText' , 'text' : arg_0 . content } , 'card' : { 'type' : 'Simple' , 'content' : arg_0 . content } } } return arg_1

def Func(arg_0) -> dict:
        """Returns Amazon Alexa compatible state of the PlainText instance.

        Creating Amazon Alexa response blank with populated "outputSpeech" and
        "card sections.

        Returns:
            response: Amazon Alexa representation of PlainText state.
        """
        arg_1 = {
            'response': {
                'shouldEndSession': False,
                'outputSpeech': {
                    'type': 'PlainText',
                    'text': arg_0.content},
                'card': {
                    'type': 'Simple',
                    'content': arg_0.content
                }
            }
        }

        return arg_1

Returns Amazon Alexa compatible state of the PlainText instance .


def Func(arg_0):
        """
            Checks if any timeout for the requests to DigitalOcean is required.
            To set a timeout, use the REQUEST_TIMEOUT_ENV_VAR environment
            variable.
        """
        arg_1 = os.environ.get(REQUEST_TIMEOUT_ENV_VAR)
        if arg_1:
            try:
                return float(arg_1)
            except:
                arg_0._log.error('Failed parsing the request read timeout of '
                                '"%s". Please use a valid float number!' %
                                        arg_1)
        return None

Checks if any timeout for the requests to DigitalOcean is required . To set a timeout use the REQUEST_TIMEOUT_ENV_VAR environment variable .


def Func ( arg_0 ) : arg_1 = pgmagick . VPathList ( ) for arg_2 in arg_0 : arg_2 = pgmagick . PathMovetoAbs ( pgmagick . Coordinate ( arg_2 [ 0 ] , arg_2 [ 1 ] ) ) arg_1 . append ( arg_2 ) return arg_1

def Func(arg_0):
    """convert from 'list' or 'tuple' object to pgmagick.VPathList.

    :type input_obj: list or tuple
    """
    arg_1 = pgmagick.VPathList()
    for arg_2 in arg_0:
        # FIXME
        arg_2 = pgmagick.PathMovetoAbs(pgmagick.Coordinate(arg_2[0], arg_2[1]))
        arg_1.append(arg_2)
    return arg_1

convert from list or tuple object to pgmagick . VPathList .


(self, modelID, modelParams, modelParamsHash, results,
                         completed, completionReason, matured, numRecords)

def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
                         arg_5, arg_6, arg_7, arg_8):
    """Record or update the results for a model. This is called by the
    HSW whenever it gets results info for another model, or updated results
    on a model that is still running.

    The first time this is called for a given modelID, the modelParams will
    contain the params dict for that model and the modelParamsHash will contain
    the hash of the params. Subsequent updates of the same modelID will
    have params and paramsHash values of None (in order to save overhead).

    The Hypersearch object should save these results into it's own working
    memory into some table, which it then uses to determine what kind of
    new models to create next time createModels() is called.

    Parameters:
    ----------------------------------------------------------------------
    modelID:        ID of this model in models table
    modelParams:    params dict for this model, or None if this is just an update
                    of a model that it already previously reported on.

                    See the comments for the createModels() method for a
                    description of this dict.

    modelParamsHash:  hash of the modelParams dict, generated by the worker
                    that put it into the model database.
    results:        tuple containing (allMetrics, optimizeMetric). Each is a
                    dict containing metricName:result pairs. .
                    May be none if we have no results yet.
    completed:      True if the model has completed evaluation, False if it
                      is still running (and these are online results)
    completionReason: One of the ClientJobsDAO.CMPL_REASON_XXX equates
    matured:        True if this model has matured. In most cases, once a
                    model matures, it will complete as well. The only time a
                    model matures and does not complete is if it's currently
                    the best model and we choose to keep it running to generate
                    predictions.
    numRecords:     Number of records that have been processed so far by this
                      model.
    """
    if arg_4 is None:
      arg_9 = None
    else:
      arg_9 = arg_4[1].values()[0]

    # Update our database.
    arg_10 = arg_0._resultsDB.update(arg_1=arg_1,
                arg_2=arg_2,arg_3=arg_3,
                arg_9=arg_9, arg_5=arg_5,
                arg_6=arg_6, arg_7=arg_7,
                arg_8=arg_8)

    # Log message.
    arg_0.logger.debug('Received progress on model %d: completed: %s, '
                      'cmpReason: %s, numRecords: %d, errScore: %s' ,
                      arg_1, arg_5, arg_6, arg_8, arg_10)

    # Log best so far.
    (arg_11, arg_12) = arg_0._resultsDB.bestModelIdAndErrScore()
    arg_0.logger.debug('Best err score seen so far: %s on model %s' % \
                     (arg_12, arg_11))

Record or update the results for a model . This is called by the HSW whenever it gets results info for another model or updated results on a model that is still running .


def Func ( arg_0 , ** arg_1 ) : if isinstance ( arg_0 , dict ) : arg_0 . Func ( arg_1 ) else : arg_0 . __dict__ . Func ( arg_1 ) return arg_0

def Func(arg_0, **arg_1):
    """Update a dict, or an object with slots, according to `entries` dict.

    >>> Func({'a': 1}, a=10, b=20)
    {'a': 10, 'b': 20}
    >>> Func(Struct(a=1), a=10, b=20)
    Struct(a=10, b=20)
    """
    if isinstance(arg_0, dict):
        arg_0.Func(arg_1)
    else:
        arg_0.__dict__.Func(arg_1)
    return arg_0

Update a dict, or an object with slots, according to `entries` dict.

    >>> update({'a': 1}, a=10, b=20)
    {'a': 10, 'b': 20}
    >>> update(Struct(a=1), a=10, b=20)
    Struct(a=10, b=20)

Update a dict or an object with slots according to entries dict .


return _MinidomXmlToObject.convert_response_to_feeds(
            response,
            partial(
                _ServiceBusManagementXmlSerializer.xml_to_metrics,
                object_type=MetricRollups
            )
        )

def Func(arg_0, arg_1, arg_2, arg_3):
        '''
        This operation gets rollup data for Service Bus metrics topic.
        Rollup data includes the time granularity for the telemetry aggregation as well as
        the retention settings for each time granularity.

        name:
            Name of the service bus namespace.
        topic_name:
            Name of the service bus queue in this namespace.
        metric:
            name of a supported metric
        '''
        arg_4 = arg_0._perform_get(
            arg_0._get_get_metrics_rollup_topic_path(arg_1, arg_2, arg_3),
            None)

        return _MinidomXmlToObject.convert_response_to_feeds(
            arg_4,
            partial(
                _ServiceBusManagementXmlSerializer.xml_to_metrics,
                object_type=MetricRollups
            )
        )

This operation gets rollup data for Service Bus metrics topic . Rollup data includes the time granularity for the telemetry aggregation as well as the retention settings for each time granularity .


def
Func
(
arg_0
)
:
if
arg_0
.
code
:
raise
HolviError
(
"Orders cannot be updated"
)
arg_1
=
arg_0
.
to_holvi_dict
(
)
arg_1
.
update
(
{
'pool'
:
arg_0
.
api
.
connection
.
pool
}
)
arg_2
=
six
.
u
(
arg_0
.
api
.
base_url
+
"order/"
)
arg_3
=
arg_0
.
api
.
connection
.
make_post
(
arg_2
,
arg_1
)
arg_4
=
arg_3
[
"details_uri"
]
.
split
(
"/"
)
[
2
]
return
(
arg_3
[
"checkout_uri"
]
,
arg_0
.
api
.
get_order
(
arg_4
)
)

def Func(arg_0):
        """Saves this order to Holvi, returns a tuple with the order itself and checkout_uri"""
        if arg_0.code:
            raise HolviError("Orders cannot be updated")
        arg_1 = arg_0.to_holvi_dict()
        arg_1.update({
            'pool': arg_0.api.connection.pool
        })
        arg_2 = six.u(arg_0.api.base_url + "order/")
        arg_3 = arg_0.api.connection.make_post(arg_2, arg_1)
        arg_4 = arg_3["details_uri"].split("/")[-2]  # Maybe slightly ugly but I don't want to basically reimplement all but uri formation of the api method
        return (arg_3["checkout_uri"], arg_0.api.get_order(arg_4))

Saves this order to Holvi returns a tuple with the order itself and checkout_uri


def Func(arg_0, arg_1):
        """Explores the parameter according to the iterable.

        Raises ParameterLockedException if the parameter is locked.
        Raises TypeError if the parameter does not support the data,
        the types of the data in the iterable are not the same as the type of the default value,
        or the parameter has already an exploration range.

        Note that the parameter will iterate over the whole iterable once and store
        the individual data values into a tuple. Thus, the whole exploration range is
        explicitly stored in memory.

        :param explore_iterable: An iterable specifying the exploration range

        For example:

        >>> param.Func([3.0,2.0,1.0])
        >>> param.f_get_range()
        (3.0, 2.0, 1.0)

        :raises TypeError,ParameterLockedException

        """
        if arg_0.v_locked:
            raise pex.ParameterLockedException('Parameter `%s` is locked!' % arg_0.v_full_name)

        if arg_0.f_has_range():
            raise TypeError('Your parameter `%s` is already explored, '
                            'cannot Func it further!' % arg_0._name)

        if arg_0._data is None:
            raise TypeError('Your parameter `%s` has no default value, please specify one '
                            'via `f_set` before exploration. ' % arg_0.v_full_name)

        arg_2 = arg_0._data_sanity_checks(arg_1)

        arg_0.Funcd_range = arg_2
        arg_0.Funcd = True
        arg_0.f_lock()

Explores the parameter according to the iterable.

        Raises ParameterLockedException if the parameter is locked.
        Raises TypeError if the parameter does not support the data,
        the types of the data in the iterable are not the same as the type of the default value,
        or the parameter has already an exploration range.

        Note that the parameter will iterate over the whole iterable once and store
        the individual data values into a tuple. Thus, the whole exploration range is
        explicitly stored in memory.

        :param explore_iterable: An iterable specifying the exploration range

        For example:

        >>> param._explore([3.0,2.0,1.0])
        >>> param.f_get_range()
        (3.0, 2.0, 1.0)

        :raises TypeError,ParameterLockedException

Explores the parameter according to the iterable .


return (
            (
                'WITH insdata AS ('
                '{insert} ON CONFLICT {conflict_target} DO UPDATE'
                ' SET {pk_column} = NULL WHERE FALSE RETURNING {returning})'
                ' SELECT * FROM insdata UNION ALL'
                ' SELECT {returning} FROM {table} WHERE {where_clause} LIMIT 1;'
            ).format(
                insert=sql,
                conflict_target=conflict_target,
                pk_column=self.qn(self.query.model._meta.pk.column),
                returning=returning,
                table=self.query.objs[0]._meta.db_table,
                where_clause=where_clause
            ),
            params
        )

def Func(arg_0, arg_1, arg_2, arg_3):
        """Rewrites a formed SQL INSERT query to include
        the ON CONFLICT DO NOTHING clause."""

        # build the conflict target, the columns to watch
        # for conflicts
        arg_4 = arg_0._build_conflict_target()

        arg_5 = ' AND '.join([
            '{0} = %s'.format(arg_0._format_field_name(field_name))
            for field_name in arg_0.query.conflict_target
        ])

        arg_6 = [
            arg_0._format_field_value(field_name)
            for field_name in arg_0.query.conflict_target
        ]

        arg_2 = arg_2 + tuple(arg_6)

        # this looks complicated, and it is, but it is for a reason... a normal
        # ON CONFLICT DO NOTHING doesn't return anything if the row already exists
        # so we do DO UPDATE instead that never executes to lock the row, and then
        # select from the table in case we're dealing with an existing row..
        return (
            (
                'WITH insdata AS ('
                '{insert} ON CONFLICT {conflict_target} DO UPDATE'
                ' SET {pk_column} = NULL WHERE FALSE RETURNING {returning})'
                ' SELECT * FROM insdata UNION ALL'
                ' SELECT {returning} FROM {table} WHERE {where_clause} LIMIT 1;'
            ).format(
                insert=arg_1,
                arg_4=arg_4,
                pk_column=arg_0.qn(arg_0.query.model._meta.pk.column),
                arg_3=arg_3,
                table=arg_0.query.objs[0]._meta.db_table,
                arg_5=arg_5
            ),
            arg_2
        )

Rewrites a formed SQL INSERT query to include the ON CONFLICT DO NOTHING clause .


def Func ( arg_0 , arg_1 , arg_2 = True ) : if isinstance ( arg_0 . main_dictionnary , dict ) and isinstance ( arg_1 , dict ) : for arg_3 , arg_4 in arg_1 . items ( ) : if arg_2 : if arg_3 in arg_0 . main_dictionnary : arg_0 . main_dictionnary [ arg_4 ] = arg_0 . main_dictionnary . pop ( arg_3 ) else : arg_6 = { } for arg_7 in arg_0 . main_dictionnary : if arg_3 in arg_7 : arg_6 . update ( { arg_7 : arg_4 [ : - 1 ] + arg_7 . split ( arg_3 ) [ - 1 ] } ) arg_0 . main_dictionnary = Dict ( arg_0 . main_dictionnary ) . Func ( arg_6 , True ) return arg_0 . main_dictionnary return None

def Func(arg_0, arg_1, arg_2=True):
        """
        Rename the given keys from the given dictionary.

        :param key_to_rename:
            The key(s) to rename.
            Expected format: :code:`{old:new}`
        :type key_to_rename: dict

        :param strict:
            Tell us if we have to rename the exact index or
            the index which looks like the given key(s)

        :return: The well formatted dict.
        :rtype: dict|None
        """

        if isinstance(arg_0.main_dictionnary, dict) and isinstance(arg_1, dict):
            # * The given main directory is a dictionnary.
            # and
            # * The given key to rename is a dictionnary.

            for arg_3, arg_4 in arg_1.items():
                # We loop through the key to raname.

                if arg_2:
                    # The strict method is activated.
                    if arg_3 in arg_0.main_dictionnary:
                        # The old key is in the main dictionnary.

                        # We initiate the new with the old and remove the old content.
                        arg_0.main_dictionnary[arg_4] = arg_0.main_dictionnary.pop(arg_3)
                else:
                    # The strict method is not activated.

                    # We initiate the elements to rename.
                    arg_6 = {}

                    for arg_7 in arg_0.main_dictionnary:
                        # We loop throught the indexes of the main dictionnary.

                        if arg_3 in arg_7:
                            # The old key is into the index name.

                            # We append the index name and the new index to our
                            # local list to rename.
                            arg_6.update({arg_7: arg_4[:-1] + arg_7.split(arg_3)[-1]})

                    # We run this method against the local list to rename in order
                    # to rename the element.
                    arg_0.main_dictionnary = Dict(arg_0.main_dictionnary).Func(
                        arg_6, True
                    )

            # We return the final list.
            return arg_0.main_dictionnary

        # * The given main directory is not a dictionnary.
        # or
        # * The given key to rename is not a dictionnary.

        # We return None.
        return None

Rename the given keys from the given dictionary .


(self, source, destination, recursive=False, use_sudo=False)

def
Func
(
arg_0
,
arg_1
,
arg_2
,
arg_3
=
False
,
arg_4
=
False
)
:
arg_5
=
arg_4
and
run_as_root
or
arg_0
.
run
arg_6
=
'-r '
if
arg_3
else
''
arg_5
(
'/bin/cp {0}{1} {2}'
.
format
(
arg_6
,
quote
(
arg_1
)
,
quote
(
arg_2
)
)
)

def Func(arg_0, arg_1, arg_2, arg_3=False, arg_4=False):
        """
        Copy a file or directory
        """
        arg_5 = arg_4 and run_as_root or arg_0.run
        arg_6 = '-r ' if arg_3 else ''
        arg_5('/bin/cp {0}{1} {2}'.format(arg_6, quote(arg_1), quote(arg_2)))


def Func ( arg_0 , arg_1 ) : arg_2 = shlex . split ( arg_1 , posix = arg_0 . posix_lex ) if not arg_0 . posix_lex : arg_2 = [ arg_0 . _remove_quotes ( x ) for x in arg_2 ] return arg_2

def Func(arg_0, arg_1):
        """Split a line into arguments using shlex and a dequoting routine."""

        arg_2 = shlex.split(arg_1, posix=arg_0.posix_lex)
        if not arg_0.posix_lex:
            arg_2 = [arg_0._remove_quotes(x) for x in arg_2]

        return arg_2

Split a line into arguments using shlex and a dequoting routine .


'Time Stamp:      %s\nUTC Time:        %s\n'

def Func(arg_0, arg_1):
    """
    Translates any information that can be determined from the
    x_trans_id and sends that to the context.io_manager's stdout.

    See :py:mod:`swiftly.cli.trans` for context usage information.

    See :py:class:`CLITrans` for more information.
    """
    with arg_0.io_manager.with_stdout() as fp:
        arg_2 = get_trans_id_time(arg_1)
        arg_3 = arg_1[34:]
        arg_4 = 'X-Trans-Id:      ' + arg_1 + '\n'
        if not arg_2:
            arg_4 += 'Time Stamp:      None, old style id with no time ' \
                'embedded\nUTC Time:        None, old style id with no time ' \
                'embedded\n'
        else:
            arg_4 += 'Time Stamp:      %s\nUTC Time:        %s\n' % (
                arg_2,
                time.strftime(
                    '%a %Y-%m-%d %H:%M:%S UTC', time.gmtime(arg_2)))
        arg_4 += 'Additional Info: ' + arg_3 + '\n'
        fp.write(arg_4)
        fp.flush()

Translates any information that can be determined from the x_trans_id and sends that to the context . io_manager s stdout .


def Func ( arg_0 ) : for arg_1 in chain ( [ arg_0 ] , arg_0 . metabolites , arg_0 . reactions , arg_0 . genes ) : arg_1 . id = _escape_str_id ( arg_1 . id ) arg_0 . repair ( ) arg_3 = _GeneEscaper ( ) for arg_4 , arg_5 in iteritems ( get_compiled_gene_reaction_rules ( arg_0 ) ) : if arg_5 is not None : arg_4 . _gene_reaction_rule = ast2str ( arg_3 . visit ( arg_5 ) )

def Func(arg_0):
    """makes all ids SBML compliant"""
    for arg_1 in chain([arg_0],
                   arg_0.metabolites,
                   arg_0.reactions,
                   arg_0.genes):
        arg_1.id = _escape_str_id(arg_1.id)
    arg_0.repair()
    arg_3 = _GeneEscaper()
    for arg_4, arg_5 in iteritems(get_compiled_gene_reaction_rules(arg_0)):
        if arg_5 is not None:
            arg_4._gene_reaction_rule = ast2str(arg_3.visit(arg_5))


(batch_shape, max_doublings, step_size, seed=None,
                              name=None)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = None , arg_4 = None ) : with tf . compat . v1 . name_scope ( arg_4 , 'left_doubling_increments' , [ arg_0 , arg_1 , arg_2 ] ) : arg_2 = tf . convert_to_tensor ( value = arg_2 ) arg_5 = arg_2 . dtype . base_dtype arg_6 = tf . concat ( ( [ arg_1 + 1 ] , arg_0 ) , axis = 0 ) arg_7 = distributions . Bernoulli ( 0.5 , arg_5 = arg_5 ) . sample ( sample_shape = arg_6 , arg_3 = arg_3 ) arg_8 = tf . cast ( 2 ** tf . range ( 0 , arg_1 + 1 ) , arg_5 = arg_5 ) arg_9 = tf . concat ( ( [ arg_1 + 1 ] , tf . ones_like ( arg_0 ) ) , axis = 0 ) arg_8 = tf . reshape ( arg_8 , shape = arg_9 ) arg_10 = arg_8 * arg_2 arg_11 = tf . cumsum ( arg_10 * arg_7 , exclusive = True , axis = 0 ) return arg_11 , arg_10

def Func(arg_0, arg_1, arg_2, arg_3=None,
                              arg_4=None):
  """Computes the doubling increments for the left end point.

  The doubling procedure expands an initial interval to find a superset of the
  true slice. At each doubling iteration, the interval width is doubled to
  either the left or the right hand side with equal probability.
  If, initially, the left end point is at `L(0)` and the width of the
  interval is `w(0)`, then the left end point and the width at the
  k-th iteration (denoted L(k) and w(k) respectively) are given by the following
  recursions:

  ```none
  w(k) = 2 * w(k-1)
  L(k) = L(k-1) - w(k-1) * X_k, X_k ~ Bernoulli(0.5)
  or, L(0) - L(k) = w(0) Sum(2^i * X(i+1), 0 <= i < k)
  ```

  This function computes the sequence of `L(0)-L(k)` and `w(k)` for k between 0
  and `max_doublings` independently for each chain.

  Args:
    batch_shape: Positive int32 `tf.Tensor`. The batch shape.
    max_doublings: Scalar positive int32 `tf.Tensor`. The maximum number of
      doublings to consider.
    step_size: A real `tf.Tensor` with shape compatible with [num_chains].
      The size of the initial interval.
    seed: (Optional) positive int. The random seed. If None, no seed is set.
    name: Python `str` name prefixed to Ops created by this function.
      Default value: `None` (i.e., 'find_slice_bounds').

  Returns:
    left_increments: A tensor of shape (max_doublings+1, batch_shape). The
      relative position of the left end point after the doublings.
    widths: A tensor of shape (max_doublings+1, ones_like(batch_shape)). The
      widths of the intervals at each stage of the doubling.
  """
  with tf.compat.v1.name_scope(arg_4, 'left_doubling_increments',
                               [arg_0, arg_1, arg_2]):

    arg_2 = tf.convert_to_tensor(value=arg_2)
    arg_5 = arg_2.dtype.base_dtype
    # Output shape of the left increments tensor.
    arg_6 = tf.concat(([arg_1 + 1], arg_0), axis=0)
    # A sample realization of X_k.
    arg_7 = distributions.Bernoulli(0.5, arg_5=arg_5).sample(
        sample_shape=arg_6, arg_3=arg_3)

    # The widths of the successive intervals. Starts with 1.0 and ends with
    # 2^max_doublings.
    arg_8 = tf.cast(2 ** tf.range(0, arg_1+1), arg_5=arg_5)
    # Output shape of the `widths` tensor.
    arg_9 = tf.concat(([arg_1 + 1],
                              tf.ones_like(arg_0)), axis=0)
    arg_8 = tf.reshape(arg_8, shape=arg_9)
    # Widths shape is [max_doublings + 1, 1, 1, 1...].
    arg_10 = arg_8 * arg_2

    # Take the cumulative sum of the left side increments in slice width to give
    # the resulting distance from the inital lower bound.
    arg_11 = tf.cumsum(arg_10 * arg_7, exclusive=True, axis=0)
    return arg_11, arg_10

Computes the doubling increments for the left end point .


return res if -2 < res < 2 else (res < 0) - (res > 0)

def Func(arg_0, arg_1):
    # type: (int, int) -> int
    """
    Adds two individual trits together.

    The result is always a single trit.
    """
    arg_2 = arg_0 + arg_1
    return arg_2 if -2 < arg_2 < 2 else (arg_2 < 0) - (arg_2 > 0)


def Func ( arg_0 ) : @ functools . wraps ( arg_0 ) def func_wrapped ( * arg_1 , ** arg_2 ) : with get_next_interceptor ( ) as interceptor : return interceptor ( arg_0 , * arg_1 , ** arg_2 ) return func_wrapped

def Func(arg_0):
  """Decorator that wraps `func` so that its execution is intercepted.

  The wrapper passes `func` to the interceptor for the current thread.

  If there is no next interceptor, we perform an "immediate" call to `func`.
  That is, `func` terminates without forwarding its execution to another
  interceptor.

  Args:
    func: Function to wrap.

  Returns:
    The decorated function.
  """
  @functools.wraps(arg_0)
  def func_wrapped(*arg_1, **arg_2):
    with get_next_interceptor() as interceptor:
      return interceptor(arg_0, *arg_1, **arg_2)

  return func_wrapped

Decorator that wraps func so that its execution is intercepted .


(self, gas, _ignored_, value, in_offset, in_size, out_offset, out_size)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 , arg_5 , arg_6 , arg_7 ) : arg_0 . world . start_transaction ( 'Func' , address = arg_0 . address , data = arg_0 . read_buffer ( arg_4 , arg_5 ) , caller = arg_0 . address , arg_3 = arg_3 , arg_1 = arg_1 ) raise StartTx ( )

def Func(arg_0, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7):
        """Message-call into this account with alternative account's code"""
        arg_0.world.start_transaction('Func',
                                     address=arg_0.address,
                                     data=arg_0.read_buffer(arg_4, arg_5),
                                     caller=arg_0.address,
                                     arg_3=arg_3,
                                     arg_1=arg_1)
        raise StartTx()

Message - call into this account with alternative account s code


Feed output of one command to the next and return final output
  Returns string output of chained application of commands.

return {
      'command': command,
      'stdout': stdout_builder.result()
  }

def
Func
(
arg_0
)
:
arg_1
=
' | '
.
join
(
map
(
lambda
x
:
' '
.
join
(
x
)
,
arg_0
)
)
arg_2
=
functools
.
reduce
(
pipe
,
[
]
+
arg_0
)
arg_3
=
proc
.
async_stdout_builder
(
arg_2
)
arg_2
.
wait
(
)
return
{
'command'
:
arg_1
,
'stdout'
:
arg_3
.
result
(
)
}

def Func(arg_0):
  """
  Feed output of one command to the next and return final output
  Returns string output of Funced application of commands.
  """
  arg_1 = ' | '.join(map(lambda x: ' '.join(x), arg_0))
  arg_2 = functools.reduce(pipe, [None] + arg_0)
  arg_3 = proc.async_stdout_builder(arg_2)
  arg_2.wait()
  return {
      'command': arg_1,
      'stdout': arg_3.result()
  }

Feed output of one command to the next and return final output Returns string output of chained application of commands .


def Func(arg_0):
    "we expect foo=bar"

    if not len(arg_0):
        return NoopQuerySegment()

    arg_1 = QuerySegment()

    # First we need to split the segment into key/value pairs.  This is done
    # by attempting to split the sequence for each equality comparison.  Then
    # discard any that did not split properly.  Then chose the smallest key
    # (greedily chose the first comparator we encounter in the string)
    # followed by the smallest value (greedily chose the largest comparator
    # possible.)

    # translate into [('=', 'foo=bar')]
    arg_2 = zip(constants.OPERATOR_EQUALITIES, itertools.repeat(arg_0))
    # Translate into [('=', ['foo', 'bar'])]
    arg_2 = map(lambda x: (x[0], x[1].split(x[0], 1)), arg_2)
    # Remove unsplit entries and translate into [('=': ['foo', 'bar'])]
    # Note that the result from this stage is iterated over twice.
    arg_2 = list(filter(lambda x: len(x[1]) > 1, arg_2))
    # Get the smallest key and use the length of that to remove other items
    arg_3 = len(min((x[1][0] for x in arg_2), arg_5=len))
    arg_2 = filter(lambda x: len(x[1][0]) == arg_3, arg_2)

    # Get the smallest value length. thus we have the earliest key and the
    # smallest value.
    arg_4, (arg_5, arg_6) = min(arg_2, arg_5=lambda x: len(x[1][1]))

    arg_5, arg_7 = parse_directive(arg_5)
    if arg_7:
        arg_4 = constants.OPERATOR_EQUALITY_FALLBACK
        arg_1.directive = arg_7

    # Process negation.  This comes in both foo.not= and foo!= forms.
    arg_8 = arg_5.split(constants.SEP_PATH)
    arg_9 = arg_8[-1]

    # Check for !=
    if arg_9.endswith(constants.OPERATOR_NEGATION):
        arg_9 = arg_9[:-1]
        arg_1.negated = not arg_1.negated

    # Check for foo.not=
    if arg_9 == constants.PATH_NEGATION:
        arg_8.pop(-1)
        arg_1.negated = not arg_1.negated

    arg_1.values = arg_6.split(constants.SEP_VALUE)

    # Check for suffixed operators (foo.gte=bar).  Prioritize suffixed
    # entries over actual equality checks.
    if arg_8[-1] in constants.OPERATOR_SUFFIXES:

        # The case where foo.gte<=bar, which obviously makes no sense.
        if arg_4 not in constants.OPERATOR_FALLBACK:
            raise ValueError(
                'Both path-style operator and equality style operator '
                'provided.  Please provide only a single style operator.')

        arg_1.operator = constants.OPERATOR_SUFFIX_MAP[arg_8[-1]]
        arg_8.pop(-1)
    else:
        arg_1.operator = constants.OPERATOR_EQUALITY_MAP[arg_4]

    if not len(arg_8):
        raise ValueError('No attribute navigation path provided.')

    arg_1.path = arg_8

    return arg_1


def
Func
(
arg_0
)
:
arg_1
,
arg_2
=
_import_bibdoc
(
)
try
:
arg_2
(
arg_0
)
.
list_all_files
(
)
except
Exception
:
click
.
secho
(
"BibDoc {0} failed Func."
.
format
(
arg_0
)
,
fg
=
'red'
)

def Func(arg_0):
    """Check bibdocs."""
    arg_1, arg_2 = _import_bibdoc()

    try:
        arg_2(arg_0).list_all_files()
    except Exception:
        click.secho("BibDoc {0} failed Func.".format(arg_0), fg='red')


def Func ( arg_0 ) : arg_1 = None try : arg_1 = Security . SecCertificateCopyData ( arg_0 ) arg_2 = CFHelpers . cf_data_to_bytes ( arg_1 ) arg_3 = hashlib . sha1 ( arg_2 ) . digest ( ) return ( arg_2 , arg_3 ) finally : if arg_1 is not None : CoreFoundation . CFRelease ( arg_1 )

def Func(arg_0):
    """
    Return the certificate and a hash of it

    :param cert_pointer:
        A SecCertificateRef

    :return:
        A 2-element tuple:
         - [0]: A byte string of the SHA1 hash of the cert
         - [1]: A byte string of the DER-encoded contents of the cert
    """

    arg_1 = None

    try:
        arg_1 = Security.SecCertificateCopyData(arg_0)
        arg_2 = CFHelpers.cf_data_to_bytes(arg_1)
        arg_3 = hashlib.sha1(arg_2).digest()

        return (arg_2, arg_3)

    finally:
        if arg_1 is not None:
            CoreFoundation.CFRelease(arg_1)