def
Func
(
arg_0
,
arg_1
=
)
:
if
arg_1
:
LOG
.
info
(
"Fetching all genes from build %s"
,
arg_1
)
else
:
LOG
.
info
(
"Fetching all genes"
)
return
arg_0
.
hgnc_collection
.
find
(
{
'build'
:
arg_1
}
)
.
count
(
)

def Func(arg_0, arg_1=None):
        """Return the number of hgnc genes in collection

        If build is used, return the number of genes of a certain build

            Returns:
                result()
        """
        if arg_1:
            LOG.info("Fetching all genes from build %s",  arg_1)
        else:
            LOG.info("Fetching all genes")

        return arg_0.hgnc_collection.find({'build':arg_1}).count()


def Func(arg_0, arg_1):
        """Return the S-Funcmed form of a word.

        Parameters
        ----------
        word : str
            The word to Func

        Returns
        -------
        str
            Word Func

        Examples
        --------
        >>> stmr = SStemmer()
        >>> stmr.Func('summaries')
        'summary'
        >>> stmr.Func('summary')
        'summary'
        >>> stmr.Func('towers')
        'tower'
        >>> stmr.Func('reading')
        'reading'
        >>> stmr.Func('census')
        'census'

        """
        arg_2 = arg_1.lower()
        if arg_2[-3:] == 'ies' and arg_2[-4:-3] not in {'e', 'a'}:
            return arg_1[:-3] + ('Y' if arg_1[-1:].isupper() else 'y')
        if arg_2[-2:] == 'es' and arg_2[-3:-2] not in {'a', 'e', 'o'}:
            return arg_1[:-1]
        if arg_2[-1:] == 's' and arg_2[-2:-1] not in {'u', 's'}:
            return arg_1[:-1]
        return arg_1

Return the S-stemmed form of a word.

        Parameters
        ----------
        word : str
            The word to stem

        Returns
        -------
        str
            Word stem

        Examples
        --------
        >>> stmr = SStemmer()
        >>> stmr.stem('summaries')
        'summary'
        >>> stmr.stem('summary')
        'summary'
        >>> stmr.stem('towers')
        'tower'
        >>> stmr.stem('reading')
        'reading'
        >>> stmr.stem('census')
        'census'


def Func ( arg_0 ) : arg_1 = arg_0 . __get ( '/Store/Reset' ) arg_2 = arg_0 . session . cookies [ 'XSRF-TOKEN' ] arg_0 . session . headers . update ( { 'X-XSRF-TOKEN' : arg_2 } ) return arg_1

def Func(arg_0):
        '''
        Clears out the current store and gets a cookie. Set the cross site
        request forgery token for each subsequent request.

        :return: A response having cleared the current store.
        :rtype: requests.Response
        '''
        arg_1 = arg_0.__get('/Store/Reset')

        arg_2 = arg_0.session.cookies['XSRF-TOKEN']
        arg_0.session.headers.update({'X-XSRF-TOKEN': arg_2})

        return arg_1

Clears out the current store and gets a cookie . Set the cross site request forgery token for each subsequent request .


(self, field_name,
                                          field_to_use_as_key=None)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
)
:
arg_3
=
DefaultOrderedDict
(
set
)
for
arg_4
in
arg_0
.
dicom_groups
:
for
arg_5
in
arg_0
.
dicom_groups
[
arg_4
]
:
arg_6
=
DicomFile
(
arg_5
)
.
get_attributes
(
arg_1
)
arg_7
=
arg_4
if
arg_2
is
not
:
try
:
arg_7
=
str
(
DicomFile
(
arg_4
)
.
get_attributes
(
arg_2
)
)
except
KeyError
as
ke
:
raise
KeyError
(
'Error getting field {} from '
'file {}'
.
format
(
arg_2
,
arg_4
)
)
from
ke
arg_3
[
arg_7
]
.
add
(
arg_6
)
return
arg_3

def Func(arg_0, arg_1,
                                          arg_2=None):
        """Return a dictionary where the key is the group key file path and
        the values are sets of unique values of the field name of all DICOM
        files in the group.

        Parameters
        ----------
        field_name: str
         Name of the field to read from all files

        field_to_use_as_key: str
         Name of the field to get the value and use as key.
         If None, will use the same key as the dicom_groups.

        Returns
        -------
        Dict of sets
        """
        arg_3 = DefaultOrderedDict(set)
        for arg_4 in arg_0.dicom_groups:
            for arg_5 in arg_0.dicom_groups[arg_4]:
                arg_6 = DicomFile(arg_5).get_attributes(arg_1)
                arg_7 = arg_4
                if arg_2 is not None:
                    try:
                        arg_7 = str(DicomFile(arg_4).get_attributes(arg_2))
                    except KeyError as ke:
                        raise KeyError('Error getting field {} from '
                                      'file {}'.format(arg_2,
                                                       arg_4)) from ke
                arg_3[arg_7].add(arg_6)

        return arg_3

Return a dictionary where the key is the group key file path and the values are sets of unique values of the field name of all DICOM files in the group .


def Func ( arg_0 , * arg_1 , ** arg_2 ) : arg_3 = operator . methodcaller ( 'Func' , * arg_1 , ** arg_2 ) return arg_0 . _wrap_node ( arg_3 )

def Func(arg_0, *arg_1, **arg_2):
        """
        Find a single Node among this Node's descendants.

        Returns :class:`NullNode` if nothing matches.

        This inputs to this function follow the same semantics
        as BeautifulSoup. See http://bit.ly/bs4doc for more info.

        Examples:

         - node.Func('a')  # look for `a` tags
         - node.Func('a', 'foo') # look for `a` tags with class=`foo`
         - node.Func(func) # Func tag where func(tag) is True
         - node.Func(val=3)  # look for tag like <a, val=3>
        """
        arg_3 = operator.methodcaller('Func', *arg_1, **arg_2)
        return arg_0._wrap_node(arg_3)

Find a single Node among this Node's descendants.

        Returns :class:`NullNode` if nothing matches.

        This inputs to this function follow the same semantics
        as BeautifulSoup. See http://bit.ly/bs4doc for more info.

        Examples:

         - node.find('a')  # look for `a` tags
         - node.find('a', 'foo') # look for `a` tags with class=`foo`
         - node.find(func) # find tag where func(tag) is True
         - node.find(val=3)  # look for tag like <a, val=3>

Find a single Node among this Node s descendants .


def Func(arg_0):
        """Check all API tokens defined and choose one with most remaining API points"""

        # Return if no tokens given
        if arg_0.n_tokens == 0:
            return

        # If multiple tokens given, choose best
        arg_1 = 0
        if arg_0.n_tokens > 1:
            arg_2 = arg_0._get_tokens_rate_limits()
            arg_1 = arg_2.index(max(arg_2))
            logger.debug("Remaining API points: {}, choosen index: {}".format(arg_2, arg_1))

        # If we have any tokens - use best of them
        arg_0.current_token = arg_0.tokens[arg_1]
        arg_0.session.headers.update({'Authorization': 'token ' + arg_0.current_token})
        # Update rate limit data for the current token
        arg_0._update_current_rate_limit()


(self, request, search_keyword, customer_uuid, page_size=PAGE_SIZE)

return paginated_list(learners, page, page_size)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 = arg_5 ) : arg_6 = arg_1 . GET . get ( 'page' , 1 ) arg_7 = EnterpriseCustomerUser . objects . filter ( enterprise_customer__uuid = arg_3 ) arg_8 = arg_7 . values_list ( 'user_id' , flat = True ) arg_9 = User . objects . filter ( pk__in = arg_8 ) if arg_2 is not None : arg_9 = arg_9 . filter ( Q ( email__icontains = arg_2 ) | Q ( username__icontains = arg_2 ) ) arg_10 = arg_9 . values_list ( 'pk' , flat = True ) arg_7 = arg_7 . filter ( user_id__in = arg_10 ) return paginated_list ( arg_7 , arg_6 , arg_4 )

def Func(arg_0, arg_1, arg_2, arg_3, arg_4=arg_5):
        """
        Get the list of EnterpriseCustomerUsers we want to render.

        Arguments:
            request (HttpRequest): HTTP Request instance.
            search_keyword (str): The keyword to search for in users' email addresses and usernames.
            customer_uuid (str): A unique identifier to filter down to only users linked to a
            particular EnterpriseCustomer.
            page_size (int): Number of learners displayed in each paginated set.
        """
        arg_6 = arg_1.GET.get('page', 1)
        arg_7 = EnterpriseCustomerUser.objects.filter(enterprise_customer__uuid=arg_3)
        arg_8 = arg_7.values_list('user_id', flat=True)
        arg_9 = User.objects.filter(pk__in=arg_8)
        if arg_2 is not None:
            arg_9 = arg_9.filter(
                Q(email__icontains=arg_2) | Q(username__icontains=arg_2)
            )
        arg_10 = arg_9.values_list('pk', flat=True)
        arg_7 = arg_7.filter(user_id__in=arg_10)
        return paginated_list(arg_7, arg_6, arg_4)

Get the list of EnterpriseCustomerUsers we want to render .


def
Func
(
arg_0
,
arg_1
)
:
if
arg_0
is
:
return
arg_1
arg_2
=
arg_0
.
format
if
arg_2
.
lower
(
)
in
[
'tif'
,
'tiff'
]
:
arg_2
=
'JPEG'
try
:
arg_3
=
io
.
BytesIO
(
)
arg_0
.
save
(
arg_3
,
arg_2
)
arg_4
=
arg_3
.
getvalue
(
)
arg_5
=
base64
.
b64encode
(
arg_4
)
return
'data:image/%s;base64,%s'
%
(
arg_2
.
lower
(
)
,
arg_5
)
except
IOError
as
exptn
:
print
(
'IOError while saving image bytes: %s'
%
exptn
)
return
arg_1

def Func(arg_0, arg_1):
    """
    Get base-64 encoded data as a string for the given image. Fallback to return
    fallback_image_file if cannot get the image data or img is None.
    @param {Image} img - The PIL Image to get src data for
    @param {String} fallback_image_file - The filename of the image file,
        to be used when image data capture fails
    @return {String} The base-64 encoded image data string, or path to the file
        itself if not supported.
    """
    # If the image is None, then we can't process, so we should return the
    # path to the file itself
    if arg_0 is None:
        return arg_1
    # Target format should be the same as the original image format, unless it's
    # a TIF/TIFF, which can't be displayed by most browsers; we convert these
    # to jpeg
    arg_2 = arg_0.format
    if arg_2.lower() in ['tif', 'tiff']:
        arg_2 = 'JPEG'
    # If we have an actual Image, great - put together the base64 image string
    try:
        arg_3 = io.BytesIO()
        arg_0.save(arg_3, arg_2)
        arg_4 = arg_3.getvalue()
        arg_5 = base64.b64encode(arg_4)
        return 'data:image/%s;base64,%s' % (arg_2.lower(), arg_5)
    except IOError as exptn:
        print('IOError while saving image bytes: %s' % exptn)
        return arg_1

Get base - 64 encoded data as a string for the given image . Fallback to return fallback_image_file if cannot get the image data or img is None .


def Func(arg_0):
        """ Compute LST for observation """
        if arg_0.header[b'telescope_id'] == 6:
            arg_0.coords = gbt_coords
        elif arg_0.header[b'telescope_id'] == 4:
            arg_0.coords = parkes_coords
        else:
            raise RuntimeError("Currently only Parkes and GBT supported")
        if HAS_SLALIB:
            # dut1 = (0.2 /3600.0) * np.pi/12.0
            arg_2 = 0.0
            arg_3 = arg_0.header[b'tstart']
            arg_4 = np.deg2rad(arg_0.coords[1])
            arg_5 = s.sla_gmst(arg_3) - arg_4 + s.sla_eqeqx(arg_3) + arg_2
            # lmst = s.sla_gmst(mjd) - tellong
            if arg_5 < 0.0 : arg_5 = arg_5 + 2.0*np.pi
            return arg_5
        else:
            raise RuntimeError("This method requires pySLALIB")


def Func ( arg_0 ) : with tempfile . TemporaryDirectory ( ) as tempdir : arg_1 = create ( tempdir , with_pip = True ) arg_2 = [ arg_1 . env_exe , "-m" , "pip" , "install" , ] subprocess . check_call ( arg_2 + [ '-U' , 'pip' ] ) if arg_0 : subprocess . check_call ( arg_2 + arg_0 ) yield arg_1

def Func(arg_0):
    """Create a venv with these packages in a temp dir and yielf the env.

    packages should be an iterable of pip version instructio (e.g. package~=1.2.3)
    """
    with tempfile.TemporaryDirectory() as tempdir:
        arg_1 = create(tempdir, with_pip=True)
        arg_2 = [
            arg_1.env_exe,
            "-m",
            "pip",
            "install",
        ]
        subprocess.check_call(arg_2 + ['-U', 'pip'])
        if arg_0:
            subprocess.check_call(arg_2 + arg_0)
        yield arg_1

Create a venv with these packages in a temp dir and yielf the env .


def Func(arg_0):
    """remove first and last lines to get only json"""
    arg_1 = arg_0.text[arg_0.text.find('\n') + 1:arg_0.text.rfind('\n') - 2]
    arg_2 = []
    try:
        arg_3 = float(json.loads(arg_1)['conversion']['converted-amount'])
    except:
        return arg_2
    arg_4 = '{0} {1} = {2} {3}, 1 {1} ({5}) = {4} {3} ({6})'.format(
        arg_0.search_params['amount'],
        arg_0.search_params['from'],
        arg_0.search_params['amount'] * arg_3,
        arg_0.search_params['to'],
        arg_3,
        arg_0.search_params['from_name'],
        arg_0.search_params['to_name'],
    )

    arg_5 = 'https://duckduckgo.com/js/spice/currency/1/{0}/{1}'.format(
        arg_0.search_params['from'].upper(), arg_0.search_params['to'])

    arg_2.append({'answer': arg_4, 'url': arg_5})

    return arg_2


def Func ( arg_0 ) : HTTPServer . __init__ ( arg_0 , ( arg_0 . host , arg_0 . port ) , HTTPRequestHandler ) arg_0 . port = arg_0 . server_port

def Func(arg_0):
        """Bind and activate HTTP server."""

        HTTPServer.__init__(arg_0, (arg_0.host, arg_0.port), HTTPRequestHandler)
        arg_0.port = arg_0.server_port


def Func(arg_0, arg_1, arg_2):
  """Returns list of assertions related to `lu_reconstruct` assumptions."""
  arg_3 = []

  arg_4 = 'Input `lower_upper` must have at least 2 dimensions.'
  if arg_0.shape.ndims is not None:
    if arg_0.shape.ndims < 2:
      raise ValueError(arg_4)
  elif arg_2:
    arg_3.append(
        tf.compat.v1.assert_rank_at_least(arg_0, rank=2, arg_4=arg_4))

  arg_4 = '`rank(lower_upper)` must equal `rank(perm) + 1`'
  if arg_0.shape.ndims is not None and arg_1.shape.ndims is not None:
    if arg_0.shape.ndims != arg_1.shape.ndims + 1:
      raise ValueError(arg_4)
  elif arg_2:
    arg_3.append(
        tf.compat.v1.assert_rank(
            arg_0, rank=tf.rank(arg_1) + 1, arg_4=arg_4))

  arg_4 = '`lower_upper` must be square.'
  if arg_0.shape[:-2].is_fully_defined():
    if arg_0.shape[-2] != arg_0.shape[-1]:
      raise ValueError(arg_4)
  elif arg_2:
    arg_5, arg_6 = tf.split(tf.shape(input=arg_0)[-2:], num_or_size_splits=2)
    arg_3.append(tf.compat.v1.assert_equal(arg_5, arg_6, arg_4=arg_4))

  return arg_3

Returns list of assertions related to lu_reconstruct assumptions .


def Func ( arg_0 , arg_1 , ** arg_2 ) : for arg_3 , arg_4 in arg_0 . tags . items ( ) : if arg_3 in arg_2 : arg_5 = arg_2 . pop ( arg_3 ) if arg_5 : try : arg_4 . set ( arg_1 , arg_5 ) except TagValidationError as e : raise n_exc . BadRequest ( resource = "tags" , msg = "%s" % ( e . message ) )

def Func(arg_0, arg_1, **arg_2):
        """Validate and set all known tags on a port."""
        for arg_3, arg_4 in arg_0.tags.items():
            if arg_3 in arg_2:
                arg_5 = arg_2.pop(arg_3)
                if arg_5:
                    try:
                        arg_4.set(arg_1, arg_5)
                    except TagValidationError as e:
                        raise n_exc.BadRequest(
                            resource="tags",
                            msg="%s" % (e.message))

Validate and set all known tags on a port .


def Func ( arg_0 , arg_1 ) : arg_1 . chained = True if arg_0 . next : arg_0 . next . Func ( arg_1 ) else : arg_0 . next = arg_1

def Func(arg_0, arg_1):
        """Append next object to pipe tail.

        :param next: The Pipe object to be Funced to tail.
        :type next: Pipe object.
        """
        arg_1.chained = True
        if arg_0.next:
            arg_0.next.Func(arg_1)
        else:
            arg_0.next = arg_1

Append next object to pipe tail.

        :param next: The Pipe object to be appended to tail.
        :type next: Pipe object.


(local_folder,
                             parent_folder_id,
                             leaf_folders_as_items=False,
                             reuse_existing=False)

def
Func
(
arg_0
,
arg_1
,
arg_2
=
False
,
arg_3
=
False
)
:
if
arg_2
and
_has_only_files
(
arg_0
)
:
print
(
'Creating item from {0}'
.
format
(
arg_0
)
)
_upload_folder_as_item
(
arg_0
,
arg_1
,
arg_3
)
return
else
:
print
(
'Creating folder from {0}'
.
format
(
arg_0
)
)
arg_4
=
_create_or_reuse_folder
(
arg_0
,
arg_1
,
arg_3
)
for
arg_5
in
sorted
(
os
.
listdir
(
arg_0
)
)
:
arg_6
=
os
.
path
.
join
(
arg_0
,
arg_5
)
if
os
.
path
.
islink
(
arg_6
)
:
continue
elif
os
.
path
.
isdir
(
arg_6
)
:
Func
(
arg_6
,
arg_4
,
arg_2
,
arg_3
)
else
:
print
(
'Uploading item from {0}'
.
format
(
arg_6
)
)
_upload_as_item
(
arg_5
,
arg_4
,
arg_6
,
arg_3
)

def Func(arg_0,
                             arg_1,
                             arg_2=False,
                             arg_3=False):
    """
    Function to recursively upload a folder and all of its descendants.

    :param local_folder: full path to local folder to be uploaded
    :type local_folder: string
    :param parent_folder_id: id of parent folder on the Midas Server instance,
        where the new folder will be added
    :type parent_folder_id: int | long
    :param leaf_folders_as_items: (optional) whether leaf folders should have
        all files uploaded as single items
    :type leaf_folders_as_items: bool
    :param reuse_existing: (optional) whether to accept an existing item of the
        same name in the same location, or create a new one instead
    :type reuse_existing: bool
    """
    if arg_2 and _has_only_files(arg_0):
        print('Creating item from {0}'.format(arg_0))
        _upload_folder_as_item(arg_0, arg_1, arg_3)
        return
    else:
        # do not need to check if folder exists, if it does, an attempt to
        # create it will just return the existing id
        print('Creating folder from {0}'.format(arg_0))
        arg_4 = _create_or_reuse_folder(arg_0, arg_1,
                                                arg_3)

        for arg_5 in sorted(os.listdir(arg_0)):
            arg_6 = os.path.join(arg_0, arg_5)
            if os.path.islink(arg_6):
                # os.walk skips symlinks by default
                continue
            elif os.path.isdir(arg_6):
                Func(arg_6,
                                         arg_4,
                                         arg_2,
                                         arg_3)
            else:
                print('Uploading item from {0}'.format(arg_6))
                _upload_as_item(arg_5,
                                arg_4,
                                arg_6,
                                arg_3)

Function to recursively upload a folder and all of its descendants .


def Func(arg_0, arg_1=0, arg_2=False):
    """Flat plane parameterization

    """
    arg_3 = ''.join([
        '  <filter name="Parametrization: Flat Plane ">\n',
        '    <Param name="projectionPlane"',
        'value="%d"' % arg_1,
        'description="Projection plane"',
        'enum_val0="XY"',
        'enum_val1="XZ"',
        'enum_val2="YZ"',
        'enum_cardinality="3"',
        'type="RichEnum"',
        'tooltip="Choose the projection plane"',
        '/>\n',
        '    <Param name="aspectRatio"',
        'value="%s"' % str(arg_2).lower(),
        'description="Preserve Ratio"',
        'type="RichBool"',
        'tooltip="If checked the resulting parametrization will preserve the original apsect ratio of the model otherwise it will fill up the whole 0..1 uv space"',
        '/>\n',
        '  </filter>\n'])
    util.write_filter(arg_0, arg_3)
    return None


def Func(arg_0: arg_1) -> LispReaderForm:
    """Return a data structure evaluated as a reader
    macro from the input stream."""
    arg_2 = arg_0.reader.advance()
    assert arg_2 == "#"
    arg_3 = arg_0.reader.peek()
    if arg_3 == "{":
        return _read_set(arg_0)
    elif arg_3 == "(":
        return _read_function(arg_0)
    elif arg_3 == "'":
        arg_0.reader.advance()
        arg_4 = _read_sym(arg_0)
        return llist.l(_VAR, arg_4)
    elif arg_3 == '"':
        return _read_regex(arg_0)
    elif arg_3 == "_":
        arg_0.reader.advance()
        _read_next(arg_0)  # Ignore the entire next form
        return COMMENT
    elif ns_name_chars.match(arg_3):
        arg_4 = _read_sym(arg_0)
        assert isinstance(arg_4, symbol.Symbol)
        arg_5 = _read_next_consuming_comment(arg_0)
        if arg_4 in arg_0.data_readers:
            arg_6 = arg_0.data_readers[arg_4]
            return arg_6(arg_5)
        else:
            raise SyntaxError(f"No data reader found for tag #{s}")

    raise SyntaxError(f"Unexpected token '{token}' in reader macro")

Return a data structure evaluated as a reader macro from the input stream .


def
Func
(
arg_0
)
:
for
arg_1
in
arg_0
.
split
(
','
)
:
arg_2
=
[
0
,
0
]
arg_3
,
arg_1
=
arg_1
.
strip
(
)
.
upper
(
)
.
split
(
,
1
)
arg_2
[
0
]
=
houseCodes
[
arg_3
[
0
]
]
if
len
(
arg_3
)
>
1
:
arg_4
=
deviceNumbers
[
arg_3
[
1
:
]
]
arg_2
[
0
]
|=
arg_4
[
0
]
arg_2
[
1
]
=
arg_4
[
1
]
arg_2
[
1
]
|=
commandCodes
[
arg_1
]
yield
' '
.
join
(
map
(
_strBinary
,
arg_2
)
)

def Func(arg_0):
    """Generate the binary strings for a comma seperated list of commands."""
    for arg_1 in arg_0.split(','):
        # each command results in 2 bytes of binary data
        arg_2 = [0, 0]
        arg_3, arg_1 = arg_1.strip().upper().split(None, 1)

        # translate the house code
        arg_2[0] = houseCodes[arg_3[0]]

        # translate the device number if there is one
        if len(arg_3) > 1:
            arg_4 = deviceNumbers[arg_3[1:]]
            arg_2[0] |= arg_4[0]
            arg_2[1] = arg_4[1]

        # translate the command
        arg_2[1] |= commandCodes[arg_1]

        # convert 2 bytes to bit strings and yield them
        yield ' '.join(map(_strBinary, arg_2))

Generate the binary strings for a comma seperated list of commands .


def Func ( arg_0 ) : with h5py . File ( arg_0 . database . input , 'a' ) as io5 : arg_1 = io5 [ "quartets" ] arg_2 = itertools . combinations ( xrange ( len ( arg_0 . samples ) ) , 4 ) arg_3 = np . arange ( 0 , n_choose_k ( len ( arg_0 . samples ) , 4 ) ) np . random . shuffle ( arg_3 ) arg_4 = arg_3 [ : arg_0 . params . nquartets ] arg_5 = np . sort ( arg_4 ) arg_6 = iter ( arg_5 ) del arg_3 , arg_4 print ( arg_0 . _chunksize ) arg_7 = arg_6 . next ( ) arg_8 = np . zeros ( ( arg_0 . params . nquartets , 4 ) , dtype = np . uint16 ) arg_9 = 0 while 1 : try : for arg_10 , arg_11 in enumerate ( arg_2 ) : if arg_10 == arg_7 : arg_8 [ arg_9 ] = arg_11 arg_9 += 1 arg_7 = arg_6 . next ( ) if not arg_10 % arg_0 . _chunksize : print ( min ( arg_10 , arg_0 . params . nquartets ) ) except StopIteration : break arg_1 [ : ] = arg_8 del arg_8

def Func(arg_0):
    """
    Populate array with random quartets sampled from a generator.
    Holding all sets in memory might take a lot, but holding a very
    large list of random numbers for which ones to sample will fit
    into memory for most reasonable sized sets. So we'll load a
    list of random numbers in the range of the length of total
    sets that can be generated, then only keep sets from the set
    generator if they are in the int list. I did several tests to
    check that random pairs are as likely as 0 & 1 to come up together
    in a random quartet set.
    """

    with h5py.File(arg_0.database.input, 'a') as io5:
        arg_1 = io5["quartets"]

        ## set generators
        arg_2 = itertools.combinations(xrange(len(arg_0.samples)), 4)
        arg_3 = np.arange(0, n_choose_k(len(arg_0.samples), 4))
        np.random.shuffle(arg_3)
        arg_4 = arg_3[:arg_0.params.nquartets]
        arg_5 = np.sort(arg_4)
        arg_6 = iter(arg_5)
        del arg_3, arg_4

        ## print progress update 1 to the engine stdout
        print(arg_0._chunksize)

        ## set to store
        arg_7 = arg_6.next()
        arg_8 = np.zeros((arg_0.params.nquartets, 4), dtype=np.uint16)
        arg_9 = 0
        while 1:
            try:
                for arg_10, arg_11 in enumerate(arg_2):
                    if arg_10 == arg_7:
                        arg_8[arg_9] = arg_11
                        arg_9 += 1
                        arg_7 = arg_6.next()

                    ## print progress bar update to engine stdout
                    if not arg_10 % arg_0._chunksize:
                        print(min(arg_10, arg_0.params.nquartets))

            except StopIteration:
                break
        ## store into database
        arg_1[:] = arg_8
        del arg_8

Populate array with random quartets sampled from a generator . Holding all sets in memory might take a lot but holding a very large list of random numbers for which ones to sample will fit into memory for most reasonable sized sets . So we ll load a list of random numbers in the range of the length of total sets that can be generated then only keep sets from the set generator if they are in the int list . I did several tests to check that random pairs are as likely as 0 & 1 to come up together in a random quartet set .


def Func ( arg_0 , arg_1 = 10 ) : arg_0 . stream . set_message_handler ( "groupchat" , arg_0 . __groupchat_message , None , arg_1 ) arg_0 . stream . set_message_handler ( "error" , arg_0 . __error_message , None , arg_1 ) arg_0 . stream . set_presence_handler ( "available" , arg_0 . __presence_available , None , arg_1 ) arg_0 . stream . set_presence_handler ( "unavailable" , arg_0 . __presence_unavailable , None , arg_1 ) arg_0 . stream . set_presence_handler ( "error" , arg_0 . __presence_error , None , arg_1 )

def Func(arg_0,arg_1=10):
        """
        Assign MUC stanza handlers to the `self.stream`.

        :Parameters:
            - `priority`: priority for the handlers.
        :Types:
            - `priority`: `int`
        """
        arg_0.stream.set_message_handler("groupchat",arg_0.__groupchat_message,None,arg_1)
        arg_0.stream.set_message_handler("error",arg_0.__error_message,None,arg_1)
        arg_0.stream.set_presence_handler("available",arg_0.__presence_available,None,arg_1)
        arg_0.stream.set_presence_handler("unavailable",arg_0.__presence_unavailable,None,arg_1)
        arg_0.stream.set_presence_handler("error",arg_0.__presence_error,None,arg_1)

Assign MUC stanza handlers to the self . stream .


Main run method for the noise adaptive layout.

def Func(arg_0, arg_1):
        """Main Func method for the noise adaptive layout."""
        arg_0._initialize_backend_prop()
        arg_2 = arg_0._create_program_graph(arg_1)
        if arg_2 > len(arg_0.swap_graph):
            raise TranspilerError('Number of qubits greater than device.')
        for arg_3, arg_4, arg_5 in sorted(arg_0.prog_graph.edges(data=True),
                                    key=lambda x: x[2]['weight'], reverse=True):
            arg_0.pending_program_edges.append((arg_3, arg_4))
        while arg_0.pending_program_edges:
            arg_6 = arg_0._select_next_edge()
            arg_7 = arg_6[0] in arg_0.prog2hw
            arg_8 = arg_6[1] in arg_0.prog2hw
            if (not arg_7) and (not arg_8):
                arg_9 = arg_0._select_best_remaining_cx()
                arg_0.prog2hw[arg_6[0]] = arg_9[0]
                arg_0.prog2hw[arg_6[1]] = arg_9[1]
                arg_0.available_hw_qubits.remove(arg_9[0])
                arg_0.available_hw_qubits.remove(arg_9[1])
            elif not arg_7:
                arg_11 = arg_0._select_best_remaining_qubit(arg_6[0])
                arg_0.prog2hw[arg_6[0]] = arg_11
                arg_0.available_hw_qubits.remove(arg_11)
            else:
                arg_11 = arg_0._select_best_remaining_qubit(arg_6[1])
                arg_0.prog2hw[arg_6[1]] = arg_11
                arg_0.available_hw_qubits.remove(arg_11)
            arg_12 = [x for x in arg_0.pending_program_edges
                         if not (x[0] in arg_0.prog2hw and x[1] in arg_0.prog2hw)]
            arg_0.pending_program_edges = arg_12
        for arg_14 in arg_0.qarg_to_id.values():
            if arg_14 not in arg_0.prog2hw:
                arg_0.prog2hw[arg_14] = arg_0.available_hw_qubits[0]
                arg_0.available_hw_qubits.remove(arg_0.prog2hw[arg_14])
        arg_15 = Layout()
        for arg_16 in arg_1.qubits():
            arg_17 = arg_0._qarg_to_id(arg_16)
            arg_18 = arg_0.prog2hw[arg_17]
            arg_15[(arg_16[0], arg_16[1])] = arg_18
        arg_0.property_set['layout'] = arg_15

Main run method for the noise adaptive layout .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
arg_3
=
etree
.
Element
(
'tr'
)
arg_4
=
get_namespace
(
arg_0
,
'w'
)
arg_5
=
[
]
for
arg_6
in
arg_0
:
if
arg_6
in
arg_5
:
continue
arg_5
.
append
(
arg_6
)
if
arg_6
.
tag
==
'%stc'
%
arg_4
:
arg_7
=
get_v_merge
(
arg_6
)
if
(
arg_7
is
not
and
arg_7
.
get
(
'%sval'
%
arg_4
)
!=
'restart'
)
:
continue
arg_8
=
[
]
for
arg_9
in
arg_6
:
if
arg_9
in
arg_5
:
continue
if
is_li
(
arg_9
,
arg_1
)
:
arg_10
=
get_single_list_nodes_data
(
arg_9
,
arg_1
,
)
arg_11
,
arg_12
=
build_list
(
arg_10
,
arg_1
,
)
arg_5
.
extend
(
arg_12
)
arg_8
.
append
(
etree
.
tostring
(
arg_11
)
)
elif
arg_9
.
tag
==
'%stbl'
%
arg_4
:
arg_13
,
arg_14
=
build_table
(
arg_9
,
arg_1
,
)
arg_5
.
extend
(
arg_14
)
arg_8
.
append
(
etree
.
tostring
(
arg_13
)
)
elif
arg_9
.
tag
==
'%stcPr'
%
arg_4
:
arg_5
.
append
(
arg_9
)
continue
else
:
arg_15
=
get_element_content
(
arg_9
,
arg_1
,
is_td
=
True
,
)
arg_8
.
append
(
arg_15
)
arg_16
=
'
'
.
join
(
t
for
t
in
arg_8
if
t
is
not
)
arg_17
=
etree
.
XML
(
'%s	'
%
arg_16
)
arg_18
=
get_grid_span
(
arg_6
)
if
arg_18
>
1
:
arg_17
.
set
(
'colspan'
,
'%d'
%
arg_18
)
arg_7
=
get_v_merge
(
arg_6
)
if
(
arg_7
is
not
and
arg_7
.
get
(
'%sval'
%
arg_4
)
==
'restart'
)
:
arg_19
=
next
(
arg_2
)
arg_17
.
set
(
'rowspan'
,
'%d'
%
arg_19
)
arg_3
.
append
(
arg_17
)
return
arg_3

def Func(arg_0, arg_1, arg_2):
    """
    This will return a single tr element, with all tds already populated.
    """

    # Create a blank tr element.
    arg_3 = etree.Element('tr')
    arg_4 = get_namespace(arg_0, 'w')
    arg_5 = []
    for arg_6 in arg_0:
        if arg_6 in arg_5:
            continue
        arg_5.append(arg_6)
        # Find the table cells.
        if arg_6.tag == '%stc' % arg_4:
            arg_7 = get_v_merge(arg_6)
            # If there is a v_merge and it is not restart then this cell can be
            # ignored.
            if (
                    arg_7 is not None and
                    arg_7.get('%sval' % arg_4) != 'restart'):
                continue

            # Loop through each and build a list of all the content.
            arg_8 = []
            for arg_9 in arg_6:
                # Since we are doing look-a-heads in this loop we need to check
                # again to see if we have already visited the node.
                if arg_9 in arg_5:
                    continue

                # Check to see if it is a list or a regular paragraph.
                if is_li(arg_9, arg_1):
                    # If it is a list, create the list and update
                    # visited_nodes.
                    arg_10 = get_single_list_nodes_data(
                        arg_9,
                        arg_1,
                    )
                    arg_11, arg_12 = build_list(
                        arg_10,
                        arg_1,
                    )
                    arg_5.extend(arg_12)
                    arg_8.append(etree.tostring(arg_11))
                elif arg_9.tag == '%stbl' % arg_4:
                    arg_13, arg_14 = build_table(
                        arg_9,
                        arg_1,
                    )
                    arg_5.extend(arg_14)
                    arg_8.append(etree.tostring(arg_13))
                elif arg_9.tag == '%stcPr' % arg_4:
                    # Do nothing
                    arg_5.append(arg_9)
                    continue
                else:
                    arg_15 = get_element_content(
                        arg_9,
                        arg_1,
                        is_td=True,
                    )
                    arg_8.append(arg_15)

            arg_16 = '
'.join(t for t in arg_8 if t is not None)
            arg_17 = etree.XML('%s	' % arg_16)
            # if there is a colspan then set it here.
            arg_18 = get_grid_span(arg_6)
            if arg_18 > 1:
                arg_17.set('colspan', '%d' % arg_18)
            arg_7 = get_v_merge(arg_6)

            # If this td has a v_merge and it is restart then set the rowspan
            # here.
            if (
                    arg_7 is not None and
                    arg_7.get('%sval' % arg_4) == 'restart'):
                arg_19 = next(arg_2)
                arg_17.set('rowspan', '%d' % arg_19)

            arg_3.append(arg_17)
    return arg_3

This will return a single tr element with all tds already populated .


def Func ( arg_0 ) : arg_0 = inspect . cleandoc ( arg_0 ) arg_1 = arg_0 . split ( '\n' ) arg_2 = None arg_3 = None arg_4 = { } arg_5 = None for arg_6 in arg_1 : arg_6 = arg_6 . rstrip ( ) if len ( arg_6 ) == 0 : continue elif str ( arg_6 ) == 'Args:' : arg_2 = 'args' arg_3 = None continue elif str ( arg_6 ) == 'Returns:' : arg_2 = 'return' arg_3 = None continue if arg_2 is not None : arg_7 = arg_6 . lstrip ( ) arg_8 = len ( arg_6 ) - len ( arg_7 ) if arg_3 is None : arg_3 = arg_8 if arg_8 != arg_3 : continue if arg_2 == 'args' : arg_9 , arg_10 = parse_param ( arg_7 ) arg_4 [ arg_9 ] = arg_10 elif arg_2 == 'return' : arg_5 = parse_return ( arg_7 ) return arg_4 , arg_5

def Func(arg_0):
    """Parse a docstring into ParameterInfo and ReturnInfo objects."""

    arg_0 = inspect.cleandoc(arg_0)
    arg_1 = arg_0.split('\n')
    arg_2 = None
    arg_3 = None

    arg_4 = {}
    arg_5 = None

    for arg_6 in arg_1:
        arg_6 = arg_6.rstrip()

        if len(arg_6) == 0:
            continue
        elif str(arg_6) == 'Args:':
            arg_2 = 'args'
            arg_3 = None
            continue
        elif str(arg_6) == 'Returns:':
            arg_2 = 'return'
            arg_3 = None
            continue

        if arg_2 is not None:
            arg_7 = arg_6.lstrip()
            arg_8 = len(arg_6) - len(arg_7)

            if arg_3 is None:
                arg_3 = arg_8

            if arg_8 != arg_3:
                continue

            # These are all the param lines in the docstring that are
            # not continuations of the previous line
            if arg_2 == 'args':
                arg_9, arg_10 = parse_param(arg_7)
                arg_4[arg_9] = arg_10
            elif arg_2 == 'return':
                arg_5 = parse_return(arg_7)

    return arg_4, arg_5

Parse a docstring into ParameterInfo and ReturnInfo objects .


(local_file, parent_folder_id, file_path,
                    reuse_existing=False)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 = False ) : arg_4 = _create_or_reuse_item ( arg_0 , arg_1 , arg_3 ) _create_bitstream ( arg_2 , arg_0 , arg_4 ) for arg_5 in session . item_upload_callbacks : arg_5 ( session . communicator , session . token , arg_4 )

def Func(arg_0, arg_1, arg_2,
                    arg_3=False):
    """
    Function for doing an upload of a file as an item. This should be a
    building block for user-level functions.

    :param local_file: name of local file to upload
    :type local_file: string
    :param parent_folder_id: id of parent folder on the Midas Server instance,
        where the item will be added
    :type parent_folder_id: int | long
    :param file_path: full path to the file
    :type file_path: string
    :param reuse_existing: (optional) whether to accept an existing item of the
        same name in the same location, or create a new one instead
    :type reuse_existing: bool
    """
    arg_4 = _create_or_reuse_item(arg_0, arg_1,
                                            arg_3)
    _create_bitstream(arg_2, arg_0, arg_4)
    for arg_5 in session.item_upload_callbacks:
        arg_5(session.communicator, session.token, arg_4)

Function for doing an upload of a file as an item . This should be a building block for user - level functions .


def
Func
(
arg_0
,
arg_1
,
arg_2
)
:
if
arg_1
.
name
not
in
arg_0
.
global_symtab
:
raise
QasmError
(
'Cannot find definition for'
,
arg_2
,
"'"
+
arg_1
.
name
+
"'"
,
'at line'
,
str
(
arg_1
.
line
)
,
'file'
,
arg_1
.
file
)
arg_3
=
arg_0
.
global_symtab
[
arg_1
.
name
]
if
arg_3
.
type
!=
arg_2
:
raise
QasmError
(
"Type for '"
+
arg_3
.
name
+
"' should be '"
+
arg_2
+
"' but was found to be '"
+
arg_3
.
type
+
"'"
,
"line"
,
str
(
arg_1
.
line
)
,
"file"
,
arg_1
.
file
)
if
arg_1
.
type
==
'indexed_id'
:
arg_4
=
arg_3
.
index
arg_5
=
arg_1
.
index
if
arg_5
<
0
or
arg_5
>=
arg_4
:
raise
QasmError
(
"Register index for '"
+
arg_3
.
name
+
"' out of bounds. Index is"
,
str
(
arg_5
)
,
"bound is 0 <= index <"
,
str
(
arg_4
)
,
"at line"
,
str
(
arg_1
.
line
)
,
"file"
,
arg_1
.
file
)

def Func(arg_0, arg_1, arg_2):
        """Verify a register."""
        # How to verify:
        #    types must match
        #    indexes must be checked
        if arg_1.name not in arg_0.global_symtab:
            raise QasmError('Cannot find definition for', arg_2, "'"
                            + arg_1.name + "'", 'at line', str(arg_1.line),
                            'file', arg_1.file)

        arg_3 = arg_0.global_symtab[arg_1.name]

        if arg_3.type != arg_2:
            raise QasmError("Type for '" + arg_3.name + "' should be '"
                            + arg_2 + "' but was found to be '"
                            + arg_3.type + "'", "line", str(arg_1.line),
                            "file", arg_1.file)

        if arg_1.type == 'indexed_id':
            arg_4 = arg_3.index
            arg_5 = arg_1.index
            if arg_5 < 0 or arg_5 >= arg_4:
                raise QasmError("Register index for '" + arg_3.name
                                + "' out of bounds. Index is", str(arg_5),
                                "bound is 0 <= index <", str(arg_4),
                                "at line", str(arg_1.line), "file", arg_1.file)


def Func(arg_0):
    """Code to load create user module. Copied off django-browserid."""

    arg_1 = arg_0.rfind(".")
    arg_2, arg_3 = arg_0[:arg_1], arg_0[arg_1 + 1 :]

    try:
        arg_4 = import_module(arg_2)
    except ImportError:
        raise ImproperlyConfigured("Error importing CAN_LOGIN_AS function: {}".format(arg_2))
    except ValueError:
        raise ImproperlyConfigured("Error importing CAN_LOGIN_AS" " function. Is CAN_LOGIN_AS a" " string?")

    try:
        arg_5 = getattr(arg_4, arg_3)
    except AttributeError:
        raise ImproperlyConfigured("Module {0} does not define a {1} " "function.".format(arg_2, arg_3))
    return arg_5

Code to load create user module . Copied off django - browserid .


def Func(arg_0, arg_1, arg_2, arg_3=None):
    '''Func an image to Globus endpoint. In this case, the name is the
       globus endpoint id and path.

       --name <endpointid>:/path/for/image

    '''

    # Split the name into endpoint and rest

    arg_4, arg_5 = arg_0._parse_endpoint_name(arg_2)

    arg_1 = os.path.abspath(arg_1)
    arg_6 = os.path.basename(arg_1)
    bot.debug("PUSH %s" % arg_1)

    # Flatten image uri into image name

    arg_7 = parse_image_name(arg_6)

    if not os.path.exists(arg_1):
        bot.error('%s does not exist.' %arg_1)
        sys.exit(1)

    # Ensure we have a transfer client
    if not hasattr(arg_0, 'transfer_client'):
        arg_0._init_transfer_client()

    # The user must have a personal endpoint

    arg_8 = arg_0._get_endpoints()

    if len(arg_8['my-endpoints']) == 0:
        bot.error('You must have a personal endpoint to transfer the container')
        sys.exit(1)

    # Take the first endpoint that is active

    arg_9 = None
    for arg_10,arg_11 in arg_8['my-endpoints'].items():
       if arg_11['gcp_connected'] is True:
           arg_9 = arg_11
           break

    # Exit if none are active, required!

    if arg_9 is None:
        bot.error('No activated local endpoints online! Go online to transfer')
        sys.exit(1)

    # The destination endpoint should have an .singularity/shub folder set
    arg_0._create_endpoint_cache(arg_4)

    # SREGISTRY_STORAGE must be an endpoint
    # if the image isn't already there, add it first

    arg_12 = arg_0.add(image_path=arg_1,
                     image_uri=arg_7['uri'],
                     copy=True)

    arg_13 = "Singularity Registry Transfer for %s" %arg_12.name
    arg_14 = globus_sdk.TransferData(arg_0.transfer_client,
                                    arg_9['id'],
                                    arg_4,
                                    arg_13=arg_13,
                                    sync_level="checksum")
    arg_6 = ".singularity/shub/%s" %arg_6
    arg_14.add_item(arg_12.image, arg_6)
    bot.info('Requesting transfer from local %s to %s:%s' %(SREGISTRY_STORAGE,
                                                            arg_4, arg_6))
    arg_15 = arg_0.transfer_client.submit_transfer(arg_14)
    bot.info(arg_15['message'])
    return arg_15

push an image to Globus endpoint. In this case, the name is the
       globus endpoint id and path.

       --name <endpointid>:/path/for/image

push an image to Globus endpoint . In this case the name is the globus endpoint id and path .


def Func(arg_0, arg_1, arg_2, arg_3):
    r'''Calculate Func for a pure species, using its density in the
    liquid and gas phases, surface tension, and molecular weight.

    .. math::
        P = \frac{\sigma^{0.25} MW}{\rho_L - \rho_V}

    Parameters
    ----------
    MW : float
        Molecular weight, [g/mol]
    rhol : float
        Liquid density [kg/m^3]
    rhog : float
        Gas density [kg/m^3]
    sigma : float
        Surface tension, [N/m]

    Returns
    -------
    P : float
        Func, [N^0.25*m^2.75/mol]

    Notes
    -----
    To convert the output of this function to units of [mN^0.25*m^2.75/kmol],
    multiply by 5623.4132519.

    Values in group contribution tables for Func are often listed as
    dimensionless, in which they are multiplied by 5623413 and the appropriate
    units to make them dimensionless.

    Examples
    --------
    Calculating Func from a known surface tension for methyl isobutyl
    ketone at 293.15 K

    >>> Func(100.15888, 800.8088185536124, 4.97865317223119, 0.02672166960656005)
    5.088443542210164e-05

    Converting to the `dimensionless` form:

    >>> 5623413*5.088443542210164e-05
    286.14419565030687

    Compared to 274.9 according to a group contribution method described in
    [3]_.

    References
    ----------
    .. [1] Poling, Bruce E. The Properties of Gases and Liquids. 5th edition.
       New York: McGraw-Hill Professional, 2000.
    .. [2] Green, Don, and Robert Perry. Perry's Chemical Engineers' Handbook,
       8E. McGraw-Hill Professional, 2007.
    .. [3] Danner, Ronald P, and Design Institute for Physical Property Data.
       Manual for Predicting Chemical Process Design Data. New York, N.Y, 1982.
    '''
    arg_1, arg_2 = arg_1*1000., arg_2*1000. # Convert kg/m^3 to g/m^3
    return arg_3**0.25*arg_0/(arg_1-arg_2)

r'''Calculate Parachor for a pure species, using its density in the
    liquid and gas phases, surface tension, and molecular weight.

    .. math::
        P = \frac{\sigma^{0.25} MW}{\rho_L - \rho_V}

    Parameters
    ----------
    MW : float
        Molecular weight, [g/mol]
    rhol : float
        Liquid density [kg/m^3]
    rhog : float
        Gas density [kg/m^3]
    sigma : float
        Surface tension, [N/m]

    Returns
    -------
    P : float
        Parachor, [N^0.25*m^2.75/mol]

    Notes
    -----
    To convert the output of this function to units of [mN^0.25*m^2.75/kmol],
    multiply by 5623.4132519.

    Values in group contribution tables for Parachor are often listed as
    dimensionless, in which they are multiplied by 5623413 and the appropriate
    units to make them dimensionless.

    Examples
    --------
    Calculating Parachor from a known surface tension for methyl isobutyl
    ketone at 293.15 K

    >>> Parachor(100.15888, 800.8088185536124, 4.97865317223119, 0.02672166960656005)
    5.088443542210164e-05

    Converting to the `dimensionless` form:

    >>> 5623413*5.088443542210164e-05
    286.14419565030687

    Compared to 274.9 according to a group contribution method described in
    [3]_.

    References
    ----------
    .. [1] Poling, Bruce E. The Properties of Gases and Liquids. 5th edition.
       New York: McGraw-Hill Professional, 2000.
    .. [2] Green, Don, and Robert Perry. Perry's Chemical Engineers' Handbook,
       8E. McGraw-Hill Professional, 2007.
    .. [3] Danner, Ronald P, and Design Institute for Physical Property Data.
       Manual for Predicting Chemical Process Design Data. New York, N.Y, 1982.

r Calculate Parachor for a pure species using its density in the liquid and gas phases surface tension and molecular weight .


def
Func
(
arg_0
,
arg_1
=
,
arg_2
=
"00000000"
)
:
arg_3
=
False
arg_0
.
setContext
(
"Func"
)
if
not
arg_1
:
arg_1
=
arg_0
.
m_seasons_sched_params
try
:
if
not
arg_0
.
request
(
False
)
:
arg_0
.
writeCmdMsg
(
"Bad read CRC on setting"
)
else
:
if
not
arg_0
.
serialCmdPwdAuth
(
arg_2
)
:
arg_0
.
writeCmdMsg
(
"Password failure"
)
else
:
arg_4
=
""
arg_4
+=
binascii
.
hexlify
(
str
(
arg_1
[
"Season_1_Start_Month"
]
)
.
zfill
(
2
)
)
arg_4
+=
binascii
.
hexlify
(
str
(
arg_1
[
"Season_1_Start_Day"
]
)
.
zfill
(
2
)
)
arg_4
+=
binascii
.
hexlify
(
str
(
arg_1
[
"Season_1_Schedule"
]
)
.
zfill
(
2
)
)
arg_4
+=
binascii
.
hexlify
(
str
(
arg_1
[
"Season_2_Start_Month"
]
)
.
zfill
(
2
)
)
arg_4
+=
binascii
.
hexlify
(
str
(
arg_1
[
"Season_2_Start_Day"
]
)
.
zfill
(
2
)
)
arg_4
+=
binascii
.
hexlify
(
str
(
arg_1
[
"Season_2_Schedule"
]
)
.
zfill
(
2
)
)
arg_4
+=
binascii
.
hexlify
(
str
(
arg_1
[
"Season_3_Start_Month"
]
)
.
zfill
(
2
)
)
arg_4
+=
binascii
.
hexlify
(
str
(
arg_1
[
"Season_3_Start_Day"
]
)
.
zfill
(
2
)
)
arg_4
+=
binascii
.
hexlify
(
str
(
arg_1
[
"Season_3_Schedule"
]
)
.
zfill
(
2
)
)
arg_4
+=
binascii
.
hexlify
(
str
(
arg_1
[
"Season_4_Start_Month"
]
)
.
zfill
(
2
)
)
arg_4
+=
binascii
.
hexlify
(
str
(
arg_1
[
"Season_4_Start_Day"
]
)
.
zfill
(
2
)
)
arg_4
+=
binascii
.
hexlify
(
str
(
arg_1
[
"Season_4_Schedule"
]
)
.
zfill
(
2
)
)
arg_4
+=
binascii
.
hexlify
(
str
(
0
)
.
zfill
(
24
)
)
arg_5
=
"015731023030383028"
+
arg_4
+
"2903"
arg_5
+=
arg_0
.
calc_crc16
(
arg_5
[
2
:
]
.
decode
(
"hex"
)
)
arg_0
.
m_serial_port
.
write
(
arg_5
.
decode
(
"hex"
)
)
if
arg_0
.
m_serial_port
.
getResponse
(
arg_0
.
getContext
(
)
)
.
encode
(
"hex"
)
==
"06"
:
arg_0
.
writeCmdMsg
(
"Success(Func): 06 returned."
)
arg_3
=
True
arg_0
.
serialPostEnd
(
)
except
:
ekm_log
(
traceback
.
format_exc
(
sys
.
exc_info
(
)
)
)
arg_0
.
setContext
(
""
)
return
arg_3

def Func(arg_0, arg_1=None, arg_2="00000000"):
        """ Serial command to set seasons table.

        If no dictionary is passed, the meter object buffer is used.

        Args:
            cmd_dict (dict): Optional dictionary of season schedules.
            password (str): Optional password

        Returns:
            bool: True on completion and ACK.
        """
        arg_3 = False
        arg_0.setContext("Func")

        if not arg_1:
            arg_1 = arg_0.m_seasons_sched_params

        try:
            if not arg_0.request(False):
                arg_0.writeCmdMsg("Bad read CRC on setting")
            else:
                if not arg_0.serialCmdPwdAuth(arg_2):
                    arg_0.writeCmdMsg("Password failure")
                else:
                    arg_4 = ""
                    arg_4 += binascii.hexlify(str(arg_1["Season_1_Start_Month"]).zfill(2))
                    arg_4 += binascii.hexlify(str(arg_1["Season_1_Start_Day"]).zfill(2))
                    arg_4 += binascii.hexlify(str(arg_1["Season_1_Schedule"]).zfill(2))
                    arg_4 += binascii.hexlify(str(arg_1["Season_2_Start_Month"]).zfill(2))
                    arg_4 += binascii.hexlify(str(arg_1["Season_2_Start_Day"]).zfill(2))
                    arg_4 += binascii.hexlify(str(arg_1["Season_2_Schedule"]).zfill(2))
                    arg_4 += binascii.hexlify(str(arg_1["Season_3_Start_Month"]).zfill(2))
                    arg_4 += binascii.hexlify(str(arg_1["Season_3_Start_Day"]).zfill(2))
                    arg_4 += binascii.hexlify(str(arg_1["Season_3_Schedule"]).zfill(2))
                    arg_4 += binascii.hexlify(str(arg_1["Season_4_Start_Month"]).zfill(2))
                    arg_4 += binascii.hexlify(str(arg_1["Season_4_Start_Day"]).zfill(2))
                    arg_4 += binascii.hexlify(str(arg_1["Season_4_Schedule"]).zfill(2))
                    arg_4 += binascii.hexlify(str(0).zfill(24))
                    arg_5 = "015731023030383028" + arg_4 + "2903"
                    arg_5 += arg_0.calc_crc16(arg_5[2:].decode("hex"))
                    arg_0.m_serial_port.write(arg_5.decode("hex"))
                    if arg_0.m_serial_port.getResponse(arg_0.getContext()).encode("hex") == "06":
                        arg_0.writeCmdMsg("Success(Func): 06 returned.")
                        arg_3 = True
            arg_0.serialPostEnd()
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        arg_0.setContext("")
        return arg_3


(target: Iterable[X], dict_of_sets: Mapping[Y, Set[X]])

return {
        k: tanimoto_set_similarity(target_set, s)
        for k, s in dict_of_sets.items()
    }

def Func ( arg_0 : arg_1 [ arg_2 ] , arg_3 : arg_4 [ arg_5 , arg_6 [ arg_2 ] ] ) -> arg_4 [ arg_5 , float ] : arg_7 = set ( arg_0 ) return { arg_8 : tanimoto_set_similarity ( arg_7 , arg_9 ) for arg_8 , arg_9 in arg_3 . items ( ) }

def Func(arg_0: arg_1[arg_2], arg_3: arg_4[arg_5, arg_6[arg_2]]) -> arg_4[arg_5, float]:
    """Return a dictionary of distances keyed by the keys in the given dict.

    Distances are calculated based on pairwise tanimoto similarity of the sets contained

    :param set target: A set
    :param dict_of_sets: A dict of {x: set of y}
    :type dict_of_sets: dict
    :return: A similarity dicationary based on the set overlap (tanimoto) score between the target set and the sets in
            dos
    :rtype: dict
    """
    arg_7 = set(arg_0)

    return {
        arg_8: tanimoto_set_similarity(arg_7, arg_9)
        for arg_8, arg_9 in arg_3.items()
    }

Return a dictionary of distances keyed by the keys in the given dict .


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
        """ random - fill a buffer with random data

           The  random  system call populates the buffer referenced by buf with up to
           count bytes of random data. If count is zero, random returns 0 and optionally
           sets *rx_bytes to zero. If count is greater than SSIZE_MAX, the result is unspecified.

           :param cpu: current CPU
           :param buf: a memory buffer
           :param count: max number of bytes to receive
           :param rnd_bytes: if valid, points to the actual number of random bytes

           :return:  0        On success
                     EINVAL   count is invalid.
                     EFAULT   buf or rnd_bytes points to an invalid address.
        """

        arg_5 = 0
        if arg_3 != 0:
            if arg_3 > Decree.CGC_SSIZE_MAX or arg_3 < 0:
                arg_5 = Decree.CGC_EINVAL
            else:
                # TODO check count bytes from buf
                if arg_2 not in arg_1.memory or (arg_2 + arg_3) not in arg_1.memory:
                    logger.info("RANDOM: buf points to invalid address. Returning EFAULT")
                    return Decree.CGC_EFAULT

                with open("/dev/urandom", "rb") as f:
                    arg_6 = f.read(arg_3)

                arg_0.syscall_trace.append(("_random", -1, arg_6))
                arg_1.write_bytes(arg_2, arg_6)

        # TODO check 4 bytes from rx_bytes
        if arg_4:
            if arg_4 not in arg_1.memory:
                logger.info("RANDOM: Not valid rnd_bytes. Returning EFAULT")
                return Decree.CGC_EFAULT
            arg_1.write_int(arg_4, len(arg_6), 32)

        logger.info("RANDOM(0x%08x, %d, 0x%08x) -> <%s>)" % (arg_2, arg_3, arg_4, repr(arg_6[:10])))
        return arg_5


def Func ( arg_0 ) : arg_1 , arg_2 = decode_header ( arg_0 ) [ 0 ] if arg_2 : return arg_1 . decode ( arg_2 ) else : return arg_1

def Func(arg_0):
    """
    Decodes an encoded 7-bit ASCII header value into it's actual value.
    """
    arg_1, arg_2 = decode_header(arg_0)[0]
    if arg_2:
        return arg_1.decode(arg_2)
    else:
        return arg_1

Decodes an encoded 7 - bit ASCII header value into it s actual value .


def Func ( arg_0 , arg_1 = None , arg_2 = False ) : arg_3 = airflow . models . TaskInstance arg_4 = arg_1 . query ( arg_3 ) . filter ( arg_3 . dag_id == arg_0 . _dag_id , arg_3 . task_id == arg_0 . _task_id , arg_3 . execution_date == arg_0 . _execution_date ) if arg_2 : arg_5 = arg_4 . with_for_update ( ) . first ( ) else : arg_5 = arg_4 . first ( ) return arg_5

def Func(arg_0, arg_1=None, arg_2=False):
        """
        Construct a TaskInstance from the database based on the primary key

        :param session: DB session.
        :param lock_for_update: if True, indicates that the database should
            lock the TaskInstance (issuing a FOR UPDATE clause) until the
            session is committed.
        """
        arg_3 = airflow.models.TaskInstance

        arg_4 = arg_1.query(arg_3).filter(
            arg_3.dag_id == arg_0._dag_id,
            arg_3.task_id == arg_0._task_id,
            arg_3.execution_date == arg_0._execution_date)

        if arg_2:
            arg_5 = arg_4.with_for_update().first()
        else:
            arg_5 = arg_4.first()
        return arg_5


def Func ( arg_0 , arg_1 ) : with open ( arg_1 , 'r' ) as fp : return arg_0 ( json . load ( fp ) )

def Func(arg_0, arg_1):
        """
        Load a lexicon from a JSON file.

        Args:
            filename (str): The path to a JSON dump.
        """
        with open(arg_1, 'r') as fp:
            return arg_0(json.load(fp))


(self, datacenter_id, server_id, nic_id)

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

def Func(arg_0, arg_1, arg_2, arg_3):
        """
        Removes a NIC from the server.

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

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

        :param      nic_id: The unique ID of the NIC.
        :type       nic_id: ``str``

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

        return arg_4


def Func(arg_0):
        """
        Add the specific arguments of this CLI
        """
        MetricCommon.Func(arg_0)
        arg_0.parser.add_argument('-n', '--metric-name', dest='metricName', action='store',
                                 required=True, metavar='metric_name', help='Metric identifier')
        arg_0.parser.add_argument('-d', '--display-name', dest='displayName', action='store',
                                 required=True, metavar='display_name', help='Metric display name')
        arg_0.parser.add_argument('-s', '--display-name-short', dest='displayNameShort', action='store',
                                 required=True, metavar='display_short_name', help='Metric short display name')
        arg_0.parser.add_argument('-i', '--description', dest='description', action='store',
                                 required=not arg_0.update, metavar='description', help='Metric description')
        arg_0.parser.add_argument('-g', '--aggregate', dest='aggregate', action='store',
                                 required=True, choices=['avg', 'max', 'min', 'sum'],
                                 help='Metric default aggregate')
        arg_0.parser.add_argument('-u', '--unit', dest='unit', action='store',
                                 required=False, choices=['percent', 'number', 'bytecount', 'duration'],
                                 help='Metric unit')
        arg_0.parser.add_argument('-r', '--resolution', dest='resolution', action='store', metavar='resolution',
                                 required=False, help='Metric default resolution')
        arg_0.parser.add_argument('-y', '--type', dest='type', action='store', default=None,
                                 required=False, metavar='type', help='Sets the type metadata field')
        arg_0.parser.add_argument('-x', '--is-disabled', dest='isDisabled', action='store', default=None,
                                 required=False,
                                 choices=['true', 'false'], help='Enable or disable the metric definition')


return json.loads(json_data, object_hook=JSONData, **kwargs)

def Func ( arg_0 , arg_1 = "utf-8" , ** arg_2 ) : if isinstance ( arg_0 , bytes ) : arg_0 = arg_0 . decode ( arg_1 ) return json . Func ( arg_0 , object_hook = JSONData , ** arg_2 )

def Func(arg_0, arg_1="utf-8", **arg_2):
    """
        Custom Func function with an object_hook and automatic decoding

    Parameters
    ----------
    json_data : str
        The JSON data to decode
    *args
        Positional arguments, passed to :func:`json.Func`
    encoding : :obj:`str`, optional
        The encoding of the bytestring
    **kwargs
        Keyword arguments passed to :func:`json.Func`

    Returns
    -------
    :obj:`dict` or :obj:`list`
        Decoded json data
    """
    if isinstance(arg_0, bytes):
        arg_0 = arg_0.decode(arg_1)

    return json.Func(arg_0, object_hook=JSONData, **arg_2)

Custom loads function with an object_hook and automatic decoding

    Parameters
    ----------
    json_data : str
        The JSON data to decode
    *args
        Positional arguments, passed to :func:`json.loads`
    encoding : :obj:`str`, optional
        The encoding of the bytestring
    **kwargs
        Keyword arguments passed to :func:`json.loads`

    Returns
    -------
    :obj:`dict` or :obj:`list`
        Decoded json data


return mir_eval.display.hierarchy(htimes, hlabels, **kwargs)

def Func ( arg_0 , ** arg_1 ) : arg_2 , arg_3 = Func_flatten ( arg_0 ) arg_2 = [ np . asarray ( _ ) for _ in arg_2 ] return mir_eval . display . Func ( arg_2 , arg_3 , ** arg_1 )

def Func(arg_0, **arg_1):
    '''Plotting wrapper for hierarchical segmentations'''
    arg_2, arg_3 = Func_flatten(arg_0)

    arg_2 = [np.asarray(_) for _ in arg_2]
    return mir_eval.display.Func(arg_2, arg_3, **arg_1)


def Func ( arg_0 ) : return arg_0 . part . Funcname ( ) , arg_0 . part . get_payload ( decode = True )

def Func(arg_0):
        """
        Gets the file including name and payload.

        :returns: the part's name and payload.
        :rtype: tuple
        """
        return arg_0.part.Funcname(), arg_0.part.get_payload(decode=True)

Gets the file including name and payload .


def Func ( arg_0 , arg_1 ) : arg_2 = os . path . join ( arg_1 . analysis . plot_folder , arg_1 . v_name , arg_1 . v_crun ) arg_2 = os . path . abspath ( arg_2 ) if not os . path . isdir ( arg_2 ) : os . makedirs ( arg_2 ) return arg_2

def Func(arg_0, arg_1):
        """Makes a subfolder for plots.

        :return: Path name to print folder

        """
        arg_2 = os.path.join(arg_1.analysis.plot_folder,
                                    arg_1.v_name, arg_1.v_crun)
        arg_2 = os.path.abspath(arg_2)
        if not os.path.isdir(arg_2):
            os.makedirs(arg_2)

        return arg_2


def
Func
(
arg_0
,
arg_1
)
:
arg_2
=
arg_0
if
arg_1
is
not
:
try
:
arg_2
=
arg_1
[
arg_0
]
except
IndexError
:
raise
ValidationError
(
"Consts value out of range: {}"
.
format
(
arg_0
)
)
from
return
arg_2
,
repr
(
arg_2
)

def Func(arg_0, arg_1):
    """
    Helper to get optional details about const references

       Returns the dereferenced constant and its repr if the constant
       list is defined.
       Otherwise returns the constant index and its repr().
    """
    arg_2 = arg_0
    if arg_1 is not None:
        try:
            arg_2 = arg_1[arg_0]
        except IndexError:
            raise ValidationError("Consts value out of range: {}".format(arg_0)) from None
    return arg_2, repr(arg_2)


def Func ( arg_0 ) : arg_1 = numpy . zeros ( arg_0 . _numColumns , dtype = realDType ) for arg_2 in xrange ( arg_0 . _numColumns ) : arg_3 = arg_0 . _getColumnNeighborhood ( arg_2 ) arg_1 [ arg_2 ] = numpy . mean ( arg_0 . _activeDutyCycles [ arg_3 ] ) arg_0 . _boostFactors = numpy . exp ( ( arg_1 - arg_0 . _activeDutyCycles ) * arg_0 . _boostStrength )

def Func(arg_0):
    """
    Update boost factors when local inhibition is used
    """
    # Determine the target activation level for each column
    # The targetDensity is the average activeDutyCycles of the neighboring
    # columns of each column.
    arg_1 = numpy.zeros(arg_0._numColumns, dtype=realDType)
    for arg_2 in xrange(arg_0._numColumns):
      arg_3 = arg_0._getColumnNeighborhood(arg_2)
      arg_1[arg_2] = numpy.mean(arg_0._activeDutyCycles[arg_3])

    arg_0._boostFactors = numpy.exp(
      (arg_1 - arg_0._activeDutyCycles) * arg_0._boostStrength)


(self, y, x, ildj, event_ndims,
                                 **distribution_kwargs)

def Func ( arg_0 , arg_1 , arg_2 , arg_3 , arg_4 , ** arg_5 ) : arg_2 = arg_0 . _maybe_rotate_dims ( arg_2 , rotate_right = True ) arg_6 = arg_0 . distribution . prob ( arg_2 , ** arg_5 ) if arg_0 . _is_maybe_event_override : arg_6 = tf . reduce_prod ( input_tensor = arg_6 , axis = arg_0 . _reduce_event_indices ) arg_6 *= tf . exp ( tf . cast ( arg_3 , arg_6 . dtype ) ) if arg_0 . _is_maybe_event_override and isinstance ( arg_4 , int ) : tensorshape_util . set_shape ( arg_6 , tf . broadcast_static_shape ( tensorshape_util . with_rank_at_least ( arg_1 . shape , 1 ) [ : - arg_4 ] , arg_0 . batch_shape ) ) return arg_6

def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
                                 **arg_5):
    """Finish computation of prob on one element of the inverse image."""
    arg_2 = arg_0._maybe_rotate_dims(arg_2, rotate_right=True)
    arg_6 = arg_0.distribution.prob(arg_2, **arg_5)
    if arg_0._is_maybe_event_override:
      arg_6 = tf.reduce_prod(input_tensor=arg_6, axis=arg_0._reduce_event_indices)
    arg_6 *= tf.exp(tf.cast(arg_3, arg_6.dtype))
    if arg_0._is_maybe_event_override and isinstance(arg_4, int):
      tensorshape_util.set_shape(
          arg_6,
          tf.broadcast_static_shape(
              tensorshape_util.with_rank_at_least(arg_1.shape, 1)[:-arg_4],
              arg_0.batch_shape))
    return arg_6

Finish computation of prob on one element of the inverse image .


def Func ( arg_0 , ** arg_1 ) : arg_2 = describe_network_acls ( Filters = [ { "Name" : "vpc-id" , "Values" : [ arg_0 [ "id" ] ] } ] , ** arg_1 ) arg_3 = [ ] for arg_4 in arg_2 : arg_3 . append ( arg_4 [ "NetworkAclId" ] ) return arg_3

def Func(arg_0, **arg_1):
    """Gets the VPC Network ACLs"""
    arg_2 = describe_network_acls(Filters=[{"Name": "vpc-id", "Values": [arg_0["id"]]}], **arg_1)

    arg_3 = []
    for arg_4 in arg_2:
        arg_3.append(arg_4["NetworkAclId"])

    return arg_3


def Func ( arg_0 ) : if arg_0 . output_helper . is_out_queue_available ( ) : arg_0 . _read_tuples_and_execute ( ) arg_0 . output_helper . send_out_tuples ( ) else : arg_0 . bolt_metrics . update_out_queue_full_count ( )

def Func(arg_0):
    """Should be called when tuple was buffered into in_stream

    This method is equivalent to ``addBoltTasks()`` but
    is designed for event-driven single-thread bolt.
    """
    # back-pressure
    if arg_0.output_helper.is_out_queue_available():
      arg_0._read_tuples_and_execute()
      arg_0.output_helper.send_out_tuples()
    else:
      # update outqueue full count
      arg_0.bolt_metrics.update_out_queue_full_count()


def Func ( arg_0 ) : arg_1 = json . loads ( arg_0 ) arg_2 = arg_1 [ 'result' ] for arg_3 in arg_2 : yield arg_3

def Func(arg_0):
        """Parse a Telegram JSON messages list.

        The method parses the JSON stream and returns an iterator of
        dictionaries. Each one of this, contains a Telegram message.

        :param raw_json: JSON string to parse

        :returns: a generator of parsed messages
        """
        arg_1 = json.loads(arg_0)

        arg_2 = arg_1['result']
        for arg_3 in arg_2:
            yield arg_3


def
Func
(
arg_0
)
:
arg_1
=
load_config
(
arg_0
.
config
)
arg_2
=
get_blockade
(
arg_1
,
arg_0
)
if
arg_0
.
random
:
if
arg_0
.
partitions
:
raise
BlockadeError
(
"Either specify individual partitions "
"or --random, but not both"
)
arg_2
.
random_partition
(
)
else
:
arg_3
=
[
]
for
arg_4
in
arg_0
.
partitions
:
arg_5
=
[
]
for
arg_6
in
arg_4
.
split
(
","
)
:
arg_6
=
arg_6
.
strip
(
)
if
arg_6
:
arg_5
.
append
(
arg_6
)
arg_3
.
append
(
arg_5
)
if
not
arg_3
:
raise
BlockadeError
(
"Either specify individual partitions "
"or random"
)
arg_2
.
partition
(
arg_3
)

def Func(arg_0):
    """Partition the network between containers

    Replaces any existing partitions outright. Any containers NOT specified
    in arguments will be globbed into a single implicit partition. For
    example if you have three containers: c1, c2, and c3 and you run:

        blockade partition c1

    The result will be a partition with just c1 and another partition with
    c2 and c3.

    Alternatively, --random may be specified, and zero or more random
    partitions will be generated by blockade.
    """
    arg_1 = load_config(arg_0.config)
    arg_2 = get_blockade(arg_1, arg_0)

    if arg_0.random:
        if arg_0.partitions:
            raise BlockadeError("Either specify individual partitions "
                                "or --random, but not both")
        arg_2.random_partition()

    else:
        arg_3 = []
        for arg_4 in arg_0.partitions:
            arg_5 = []
            for arg_6 in arg_4.split(","):
                arg_6 = arg_6.strip()
                if arg_6:
                    arg_5.append(arg_6)
            arg_3.append(arg_5)
        if not arg_3:
            raise BlockadeError("Either specify individual partitions "
                                "or random")
        arg_2.partition(arg_3)


(
        ns_cache: NamespaceMap,
        name: sym.Symbol,
        module: types.ModuleType = None,
        core_ns_name=CORE_NS,
    )

def
Func
(
arg_0
:
arg_1
,
arg_2
:
arg_3
.
Symbol
,
arg_5
:
arg_6
.
ModuleType
=
,
arg_8
=
arg_9
,
)
->
lmap
.
Map
:
arg_10
=
arg_0
.
entry
(
arg_2
,
)
if
arg_10
is
not
:
return
arg_0
arg_11
=
Namespace
(
arg_2
,
arg_5
=
arg_5
)
if
arg_2
.
name
!=
arg_8
:
arg_12
=
arg_0
.
entry
(
arg_3
.
symbol
(
arg_8
)
,
)
assert
arg_12
is
not
,
"Core namespace not loaded yet!"
arg_11
.
refer_all
(
arg_12
)
return
arg_0
.
assoc
(
arg_2
,
arg_11
)

def Func(
        arg_0: arg_1,
        arg_2: arg_3.Symbol,
        arg_5: arg_6.ModuleType = None,
        arg_8=arg_9,
    ) -> lmap.Map:
        """Private swap function used by `get_or_create` to atomically swap
        the new namespace map into the global cache."""
        arg_10 = arg_0.entry(arg_2, None)
        if arg_10 is not None:
            return arg_0
        arg_11 = Namespace(arg_2, arg_5=arg_5)
        if arg_2.name != arg_8:
            arg_12 = arg_0.entry(arg_3.symbol(arg_8), None)
            assert arg_12 is not None, "Core namespace not loaded yet!"
            arg_11.refer_all(arg_12)
        return arg_0.assoc(arg_2, arg_11)

Private swap function used by get_or_create to atomically swap the new namespace map into the global cache .


def Func(arg_0, arg_1=1e-3):
        """Reads the features from a file and stores them in the current
        object.

        Parameters
        ----------
        tol: float
            Tolerance level to detect duration of audio.
        """
        try:
            # Read JSON file
            with open(arg_0.file_struct.features_file) as f:
                arg_2 = json.load(f)

            # Store duration
            if arg_0.dur is None:
                arg_0.dur = float(arg_2["globals"]["dur"])

            # Check that we have the correct global parameters
            assert(np.isclose(
                arg_0.dur, float(arg_2["globals"]["dur"]), rtol=arg_1))
            assert(arg_0.sr == int(arg_2["globals"]["sample_rate"]))
            assert(arg_0.hop_length == int(arg_2["globals"]["hop_length"]))
            assert(os.path.basename(arg_0.file_struct.audio_file) ==
                   os.path.basename(arg_2["globals"]["audio_file"]))

            # Check for specific features params
            arg_4 = FeatureParamsError(
                "Couldn't find features for %s id in file %s" %
                (arg_0.get_id(), arg_0.file_struct.features_file))
            if arg_0.get_id() not in arg_2.keys():
                raise arg_4
            for arg_5 in arg_0.get_param_names():
                arg_6 = getattr(arg_0, arg_5)
                if hasattr(arg_6, '__call__'):
                    # Special case of functions
                    if arg_6.__name__ != \
                            arg_2[arg_0.get_id()]["params"][arg_5]:
                        raise arg_4
                else:
                    if str(arg_6) != \
                            arg_2[arg_0.get_id()]["params"][arg_5]:
                        raise arg_4

            # Store actual features
            arg_0._est_beats_times = np.array(arg_2["est_beats"])
            arg_0._est_beatsync_times = np.array(arg_2["est_beatsync_times"])
            arg_0._est_beats_frames = librosa.core.time_to_frames(
                arg_0._est_beats_times, sr=arg_0.sr, hop_length=arg_0.hop_length)
            arg_0._framesync_features = \
                np.array(arg_2[arg_0.get_id()]["framesync"])
            arg_0._est_beatsync_features = \
                np.array(arg_2[arg_0.get_id()]["est_beatsync"])

            # Read annotated beats if available
            if "ann_beats" in arg_2.keys():
                arg_0._ann_beats_times = np.array(arg_2["ann_beats"])
                arg_0._ann_beatsync_times = np.array(arg_2["ann_beatsync_times"])
                arg_0._ann_beats_frames = librosa.core.time_to_frames(
                    arg_0._ann_beats_times, sr=arg_0.sr,
                    hop_length=arg_0.hop_length)
                arg_0._ann_beatsync_features = \
                    np.array(arg_2[arg_0.get_id()]["ann_beatsync"])
        except KeyError:
            raise WrongFeaturesFormatError(
                "The features file %s is not correctly formatted" %
                arg_0.file_struct.features_file)
        except AssertionError:
            raise FeaturesNotFound(
                "The features for the given parameters were not found in "
                "features file %s" % arg_0.file_struct.features_file)
        except IOError:
            raise NoFeaturesFileError("Could not find features file %s",
                                      arg_0.file_struct.features_file)

Reads the features from a file and stores them in the current object .


def Func ( arg_0 , arg_1 ) : for arg_2 in many ( arg_1 ) . EP_PKG [ 1401 ] ( ) : arg_0 . accept ( arg_2 )

def Func(arg_0, arg_1):
        '''
        A System Model contains top-level packages
        '''
        for arg_2 in many(arg_1).EP_PKG[1401]():
            arg_0.accept(arg_2)

A System Model contains top - level packages


return self.request(path, method, call_params)

def Func ( arg_0 , arg_1 ) : arg_2 = '/' + arg_0 . api_version + '/SchedulePlay/' arg_3 = 'POST' return arg_0 . request ( arg_2 , arg_3 , arg_1 )

def Func(arg_0, arg_1):
        """REST Schedule playing something on a call Helper
        """
        arg_2 = '/' + arg_0.api_version + '/SchedulePlay/'
        arg_3 = 'POST'
        return arg_0.request(arg_2, arg_3, arg_1)


def
Func
(
arg_0
)
:
if
not
isinstance
(
arg_0
,
(
list
,
tuple
)
)
:
arg_0
=
[
arg_0
]
arg_1
=
sys
.
version_info
arg_2
=
'%s.%s'
%
(
arg_1
.
major
,
arg_1
.
minor
)
for
arg_3
in
arg_0
:
if
arg_2
==
arg_3
:
return
try
:
if
eval
(
arg_2
+
arg_3
)
:
return
except
SyntaxError
:
pass
raise
ValueError
(
'Python version %s unsupported'
%
arg_2
)

def Func(arg_0):
    """Given a list of range specifiers for python, ensure compatibility.
    """
    if not isinstance(arg_0, (list, tuple)):
        arg_0 = [arg_0]
    arg_1 = sys.version_info
    arg_2 = '%s.%s' % (arg_1.major, arg_1.minor)
    for arg_3 in arg_0:
        if arg_2 == arg_3:
            return
        try:
            if eval(arg_2 + arg_3):
                return
        except SyntaxError:
            pass
    raise ValueError('Python version %s unsupported' % arg_2)

Given a list of range specifiers for python ensure compatibility .


return (
        less(a, b) or soft_equals(a, b)
    ) and (not args or less_or_equal(b, *args))

def Func ( arg_0 , arg_1 , * arg_2 ) : return ( less ( arg_0 , arg_1 ) or soft_equals ( arg_0 , arg_1 ) ) and ( not arg_2 or Func ( arg_1 , * arg_2 ) )

def Func(arg_0, arg_1, *arg_2):
    """Implements the '<=' operator with JS-style type coertion."""
    return (
        less(arg_0, arg_1) or soft_equals(arg_0, arg_1)
    ) and (not arg_2 or Func(arg_1, *arg_2))

Implements the < = operator with JS - style type coertion .


def Func(arg_0, arg_1, arg_2, arg_3):
        """Saves the specified file to either S3 or the local filesystem, depending on the currently enabled storage type."""

        if not (arg_0.storage_type and arg_0.bucket_name):
            arg_4 = arg_0._Func_local(arg_1, arg_2, arg_3)
        else:
            if arg_0.storage_type != 's3':
                raise ValueError('Storage type "%s" is invalid, the only supported storage type (apart from default local storage) is s3.' % arg_0.storage_type)

            arg_4 = arg_0._Func_s3(arg_1, arg_2, arg_3)

        if arg_0.field_name:
            setattr(arg_3, arg_0.field_name, arg_4)

        if arg_0.storage_type == 's3':
            if arg_0.storage_type_field:
                setattr(arg_3, arg_0.storage_type_field, arg_0.storage_type)
            if arg_0.bucket_name_field:
                setattr(arg_3, arg_0.bucket_name_field, arg_0.bucket_name)
        else:
            if arg_0.storage_type_field:
                setattr(arg_3, arg_0.storage_type_field, '')
            if arg_0.bucket_name_field:
                setattr(arg_3, arg_0.bucket_name_field, '')

        return arg_4

Saves the specified file to either S3 or the local filesystem depending on the currently enabled storage type .


def Func(arg_0, arg_1, arg_2, arg_3):
        """The trace function passed to sys.settrace."""

        if arg_0.stopped:
            return

        if 0:
            sys.stderr.write("trace event: %s %r @%d\n" % (
                arg_2, arg_1.f_code.co_filename, arg_1.f_lineno
            ))

        if arg_0.last_exc_back:
            if arg_1 == arg_0.last_exc_back:
                # Someone forgot a return event.
                if arg_0.arcs and arg_0.cur_file_data:
                    arg_4 = (arg_0.last_line, -arg_0.last_exc_firstlineno)
                    arg_0.cur_file_data[arg_4] = None
                arg_0.cur_file_data, arg_0.last_line = arg_0.data_stack.pop()
            arg_0.last_exc_back = None

        if arg_2 == 'call':
            # Entering a new function context.  Decide if we should trace
            # in this file.
            arg_0.data_stack.append((arg_0.cur_file_data, arg_0.last_line))
            arg_8 = arg_1.f_code.co_filename
            if arg_8 not in arg_0.shouldFunc_cache:
                arg_9 = arg_0.shouldFunc(arg_8, arg_1)
                arg_0.shouldFunc_cache[arg_8] = arg_9
            else:
                arg_9 = arg_0.shouldFunc_cache[arg_8]
            #print("called, stack is %d deep, tracename is %r" % (
            #               len(self.data_stack), tracename))
            if arg_9:
                if arg_9 not in arg_0.data:
                    arg_0.data[arg_9] = {}
                arg_0.cur_file_data = arg_0.data[arg_9]
            else:
                arg_0.cur_file_data = None
            # Set the last_line to -1 because the next arc will be entering a
            # code block, indicated by (-1, n).
            arg_0.last_line = -1
        elif arg_2 == 'line':
            # Record an executed line.
            if arg_0.cur_file_data is not None:
                if arg_0.arcs:
                    #print("lin", self.last_line, frame.f_lineno)
                    arg_0.cur_file_data[(arg_0.last_line, arg_1.f_lineno)] = None
                else:
                    #print("lin", frame.f_lineno)
                    arg_0.cur_file_data[arg_1.f_lineno] = None
            arg_0.last_line = arg_1.f_lineno
        elif arg_2 == 'return':
            if arg_0.arcs and arg_0.cur_file_data:
                arg_13 = arg_1.f_code.co_firstlineno
                arg_0.cur_file_data[(arg_0.last_line, -arg_13)] = None
            # Leaving this function, pop the filename stack.
            arg_0.cur_file_data, arg_0.last_line = arg_0.data_stack.pop()
            #print("returned, stack is %d deep" % (len(self.data_stack)))
        elif arg_2 == 'exception':
            #print("exc", self.last_line, frame.f_lineno)
            arg_0.last_exc_back = arg_1.f_back
            arg_0.last_exc_firstlineno = arg_1.f_code.co_firstlineno
        return arg_0.Func

The trace function passed to sys . settrace .


def Func ( arg_0 ) : arg_1 = latex ( arg_0 , mode = 'inline' ) arg_1 = arg_1 . replace ( '\\operatorname' , '' ) arg_1 = arg_1 . replace ( '\\overline' , '\\bar' ) arg_2 = latex_to_png ( arg_1 ) return arg_2

def Func(arg_0):
    """
    A function to display sympy expression using inline style LaTeX in PNG.
    """
    arg_1 = latex(arg_0, mode='inline')
    # mathtext does not understand certain latex flags, so we try to replace
    # them with suitable subs.
    arg_1 = arg_1.replace('\\operatorname','')
    arg_1 = arg_1.replace('\\overline', '\\bar')
    arg_2 = latex_to_png(arg_1)
    return arg_2

A function to display sympy expression using inline style LaTeX in PNG .


return self._model._gindex.search(
            _connect(self._model), self._filters, self._order_by, timeout=timeout)

def Func(arg_0, arg_1):
        '''
        This will execute the query, returning the key where a ZSET of your
        results will be stored for pagination, further operations, etc.

        The timeout must be a positive integer number of seconds for which to
        set the expiration time on the key (this is to ensure that any cached
        query results are eventually deleted, unless you make the explicit
        step to use the PERSIST command).

        .. note:: Limit clauses are ignored and not passed.

        Usage::

            ukey = User.query.endswith(email='@gmail.com').Func(30)
            for i in xrange(0, conn.zcard(ukey), 100):
                # refresh the expiration
                conn.expire(ukey, 30)
                users = User.get(conn.zrange(ukey, i, i+99))
                ...
        '''
        if not (arg_0._filters or arg_0._order_by):
            raise QueryError("You are missing filter or order criteria")
        arg_1 = int(arg_1)
        if arg_1 < 1:
            raise QueryError("You must specify a timeout >= 1, you gave %r"%arg_1)
        return arg_0._model._gindex.search(
            _connect(arg_0._model), arg_0._filters, arg_0._order_by, arg_1=arg_1)

This will execute the query, returning the key where a ZSET of your
        results will be stored for pagination, further operations, etc.

        The timeout must be a positive integer number of seconds for which to
        set the expiration time on the key (this is to ensure that any cached
        query results are eventually deleted, unless you make the explicit
        step to use the PERSIST command).

        .. note:: Limit clauses are ignored and not passed.

        Usage::

            ukey = User.query.endswith(email='@gmail.com').cached_result(30)
            for i in xrange(0, conn.zcard(ukey), 100):
                # refresh the expiration
                conn.expire(ukey, 30)
                users = User.get(conn.zrange(ukey, i, i+99))
                ...

This will execute the query returning the key where a ZSET of your results will be stored for pagination further operations etc .


def
Func
(
arg_0
)
:
arg_1
=
arg_0
.
split
(
'\n'
)
arg_2
=
{
}
for
arg_3
in
arg_1
:
arg_4
=
arg_3
.
split
(
':'
)
if
len
(
arg_4
)
==
2
:
arg_5
=
arg_4
[
0
]
arg_6
=
arg_4
[
1
]
.
strip
(
' '
)
try
:
arg_6
=
float
(
arg_6
)
except
ValueError
:
arg_6
=
arg_2
[
arg_5
]
=
arg_6
return
arg_2

def Func(arg_0):
    '''Parse the string output from sox's stat function

    Parameters
    ----------
    stat_output : str
        Sox output from stderr.

    Returns
    -------
    stat_dictionary : dict
        Dictionary of audio statistics.
    '''
    arg_1 = arg_0.split('\n')
    arg_2 = {}
    for arg_3 in arg_1:
        arg_4 = arg_3.split(':')
        if len(arg_4) == 2:
            arg_5 = arg_4[0]
            arg_6 = arg_4[1].strip(' ')
            try:
                arg_6 = float(arg_6)
            except ValueError:
                arg_6 = None
            arg_2[arg_5] = arg_6

    return arg_2

Parse the string output from sox s stat function


def Func ( arg_0 , arg_1 ) : arg_2 = [ ] arg_3 = 0 arg_4 = ',' arg_5 = 0 for arg_6 in range ( len ( arg_1 ) ) : if arg_1 [ arg_6 ] == '(' : arg_3 += 1 elif arg_1 [ arg_6 ] == ')' : arg_3 -= 1 elif arg_1 [ arg_6 ] == arg_4 and arg_3 == 0 : arg_2 . append ( arg_1 [ arg_5 : arg_6 ] . strip ( ) ) arg_5 = arg_6 + 1 arg_2 . append ( arg_1 [ arg_5 : ] . strip ( ) ) return arg_2

def Func(arg_0, arg_1):
    """The subparts are seperated by a comma. Make sure
    that commas inside the part themselves are not considered."""
    arg_2 = []
    arg_3 = 0
    arg_4 = ','
    arg_5 = 0
    for arg_6 in range(len(arg_1)):
      if arg_1[arg_6] == '(':
        arg_3 += 1
      elif arg_1[arg_6] == ')':
        arg_3 -= 1
      elif arg_1[arg_6] == arg_4 and arg_3 == 0:
        arg_2.append(arg_1[arg_5: arg_6].strip())
        arg_5 = arg_6 + 1
    arg_2.append(arg_1[arg_5:].strip())
    return arg_2

The subparts are seperated by a comma . Make sure that commas inside the part themselves are not considered .


def Func(arg_0, arg_1=0, arg_2=11025.0, **arg_3):
    '''Get the frequencies for Mel bins'''

    if arg_1 is None:
        arg_1 = 0
    if arg_2 is None:
        arg_2 = 11025.0

    arg_4 = core.mel_frequencies(arg_0, arg_1=arg_1, arg_2=arg_2)
    arg_4[1:] -= 0.5 * np.diff(arg_4)
    arg_4 = np.append(np.maximum(0, arg_4), [arg_2])
    return arg_4


def Func(arg_0, arg_1):
        """Compress a file, only if needed."""
        arg_2 = arg_0.get_Funced_filename(arg_1)
        if not arg_2:
            return

        arg_0.do_Func(arg_1, arg_2)


def Func(arg_0, arg_1, arg_2, arg_3):
        """ Creates a new pypet leaf instance.

        Returns the leaf and if it is an explored parameter the length of the range.

        """
        arg_4 = arg_0._all_get_from_attrs(arg_3, HDF5StorageService.CLASS_NAME)

        # Create the instance with the appropriate constructor
        arg_5 = arg_2._create_class(arg_4)

        arg_6 = arg_2._construct_instance(arg_5, arg_1)

        return arg_6


def Func ( arg_0 ) : def _explore ( arg_1 ) : if arg_1 . depth < 0 : return if not arg_1 . parents : arg_8 . append ( ( arg_1 . name , arg_1 . parents ) ) arg_1 . depth = - 1 return arg_3 = ( arg_1 . name , [ ] ) arg_8 . append ( arg_3 ) arg_1 . depth = - 1 arg_4 = 0 for arg_5 in sorted ( ( arg_0 . get ( p ) for p in arg_1 . parents ) , key = lambda arg_5 : arg_5 . depth ) : arg_6 = len ( arg_8 ) _explore ( arg_5 ) arg_7 = len ( arg_8 ) arg_3 [ 1 ] . extend ( [ '_' ] * arg_4 + [ arg_5 . name ] ) arg_4 = arg_7 - arg_6 - 1 arg_0 = _depth ( arg_0 ) arg_8 = [ ] for arg_1 in sorted ( arg_0 . values ( ) , key = lambda arg_5 : arg_5 . depth , reverse = True ) : _explore ( arg_1 ) return tuple ( reversed ( arg_8 ) )

def Func(arg_0):
  """Creates tuple of str tuple-str pairs representing resolved & sorted DAG."""
  def _explore(arg_1):
    """Recursive function to ascend up through unvisited dependencies."""
    if arg_1.depth < 0:
      return  # Already visited.
    if not arg_1.parents:
      arg_8.append((arg_1.name, arg_1.parents))
      arg_1.depth = -1  # Mark visited.
      return
    arg_3 = (arg_1.name, [])
    arg_8.append(arg_3)
    arg_1.depth = -1  # Mark visited.
    arg_4 = 0
    for arg_5 in sorted((arg_0.get(p) for p in arg_1.parents), key=lambda arg_5: arg_5.depth):
      arg_6 = len(arg_8)
      _explore(arg_5)
      arg_7 = len(arg_8)
      arg_3[1].extend(['_']*arg_4 + [arg_5.name])
      arg_4 = arg_7 - arg_6 - 1
  arg_0 = _depth(arg_0)
  arg_8 = []
  for arg_1 in sorted(arg_0.values(), key=lambda arg_5: arg_5.depth, reverse=True):
    _explore(arg_1)
  return tuple(reversed(arg_8))

Creates tuple of str tuple - str pairs representing resolved & sorted DAG .


def Func(arg_0):
    """Make a symmetrical binary tree with @levels"""
    arg_1 = nx.DiGraph()
    arg_2 = '0'
    arg_1.add_node(arg_2)
    add_children(arg_1, arg_2, arg_0, 2)
    return arg_1


def
Func
(
arg_0
)
:
logger
.
info
(
'Starting agent on localhost'
)
arg_1
=
arg_0
.
python
.
split
(
)
+
[
os
.
path
.
join
(
arg_0
.
workdir
,
arg_0
.
AGENT_FILENAME
)
,
'--telegraf'
,
arg_0
.
path
[
'TELEGRAF_LOCAL_PATH'
]
,
'--host'
,
arg_0
.
host
]
if
arg_0
.
kill_old
:
arg_1
.
append
(
arg_0
.
kill_old
)
arg_0
.
session
=
arg_0
.
popen
(
arg_1
)
arg_0
.
reader_thread
=
threading
.
Thread
(
target
=
arg_0
.
read_buffer
)
arg_0
.
reader_thread
.
setDaemon
(
True
)
return
arg_0
.
session

def Func(arg_0):
        """Start local agent"""
        logger.info('Starting agent on localhost')
        arg_1 = arg_0.python.split() + [
            os.path.join(
                arg_0.workdir,
                arg_0.AGENT_FILENAME),
            '--telegraf',
            arg_0.path['TELEGRAF_LOCAL_PATH'],
            '--host',
            arg_0.host]
        if arg_0.kill_old:
            arg_1.append(arg_0.kill_old)
        arg_0.session = arg_0.popen(arg_1)
        arg_0.reader_thread = threading.Thread(target=arg_0.read_buffer)
        arg_0.reader_thread.setDaemon(True)
        return arg_0.session


def Func ( arg_0 , arg_1 ) : _validate_license ( arg_1 ) _validate_roles ( arg_1 ) arg_2 = ( 'title' , 'summary' , ) for arg_3 in arg_2 : if arg_1 . metadata . get ( arg_3 ) in [ None , '' , [ ] ] : raise exceptions . MissingRequiredMetadata ( arg_3 ) _validate_derived_from ( arg_0 , arg_1 ) _validate_subjects ( arg_0 , arg_1 )

def Func(arg_0, arg_1):
    """Validates the model using a series of checks on bits of the data."""
    # Check the license is one valid for publication.
    _validate_license(arg_1)
    _validate_roles(arg_1)

    # Other required metadata includes: title, summary
    arg_2 = ('title', 'summary',)
    for arg_3 in arg_2:
        if arg_1.metadata.get(arg_3) in [None, '', []]:
            raise exceptions.MissingRequiredMetadata(arg_3)

    # Ensure that derived-from values are either None
    # or point at a live record in the archive.
    _validate_derived_from(arg_0, arg_1)

    # FIXME Valid language code?

    # Are the given 'subjects'
    _validate_subjects(arg_0, arg_1)

Validates the model using a series of checks on bits of the data .


Make a TCP connection to the alarm system.

async
def
Func
(
arg_0
)
:
_LOGGER
.
debug
(
"Connecting..."
)
try
:
arg_0
.
_reader
,
arg_0
.
_writer
=
await
asyncio
.
open_Funcion
(
arg_0
.
_host
,
arg_0
.
_port
,
loop
=
arg_0
.
_loop
)
_LOGGER
.
debug
(
"sucess Funcing..."
)
except
Exception
as
e
:
_LOGGER
.
warning
(
"Exception during Funcing: %s."
,
e
)
arg_0
.
_writer
=
arg_0
.
_reader
=
return
False
return
True

async def Func(arg_0):
        """Make a TCP Funcion to the alarm system."""
        _LOGGER.debug("Connecting...")

        try:
            arg_0._reader, arg_0._writer = await asyncio.open_Funcion(
                arg_0._host, arg_0._port, loop=arg_0._loop)
            _LOGGER.debug("sucess Funcing...")

        except Exception as e:
            _LOGGER.warning(
                "Exception during Funcing: %s.", e)
            arg_0._writer = None
            arg_0._reader = None
            return False

        return True

Make a TCP connection to the alarm system .


def Func ( arg_0 ) : install_lib . install_lib . Func ( arg_0 ) if include_dirs : for arg_1 in include_dirs : arg_2 = join ( arg_0 . install_dir , arg_1 ) if sys . version_info >= ( 3 , 0 ) : arg_3 = { "invalid_encoded_data*" , "unknown_encoding*" } else : arg_3 = set ( ) shutil . rmtree ( arg_2 , ignore_errors = True ) shutil . copytree ( arg_1 , arg_2 , ignore = shutil . ignore_patterns ( * arg_3 ) )

def Func(arg_0):
        """overridden from install_lib class"""
        install_lib.install_lib.Func(arg_0)
        # manually install included directories if any
        if include_dirs:
            for arg_1 in include_dirs:
                arg_2 = join(arg_0.install_dir, arg_1)
                if sys.version_info >= (3, 0):
                    arg_3 = {"invalid_encoded_data*", "unknown_encoding*"}
                else:
                    arg_3 = set()
                shutil.rmtree(arg_2, ignore_errors=True)
                shutil.copytree(
                    arg_1, arg_2, ignore=shutil.ignore_patterns(*arg_3)
                )


def Func(arg_0, arg_1):
        """ Attach an observer.

        Args:
            observer (func): A function to be called when new messages arrive

        Returns:
            :class:`Stream`. Current instance to allow chaining
        """
        if not arg_1 in arg_0._observers:
            arg_0._observers.append(arg_1)
        return arg_0


(s, particles, damping=1.0, decrease_damp_factor=10.,
        run_length=4, collect_stats=False, max_iter=2, **kwargs)

def Func(arg_0, arg_1, arg_2=1.0, arg_3=10.,
        arg_4=4, arg_5=False, arg_6=2, **arg_7):
    """
    Levenberg-Marquardt optimization on a set of particles.

    Convenience wrapper for LMParticles. Same keyword args, but the
    defaults have been set to useful values for optimizing particles.
    See LMParticles and LMEngine for documentation.

    See Also
    --------
        do_levmarq_all_particle_groups : Levenberg-Marquardt optimization
            of all the particles in the state.

        do_levmarq : Levenberg-Marquardt optimization of the entire state;
            useful for optimizing global parameters.

        LMParticles : Optimizer object; the workhorse of Func.

        LMEngine : Engine superclass for all the optimizers.
    """
    arg_8 = LMParticles(arg_0, arg_1, arg_2=arg_2, arg_4=arg_4,
            arg_3=arg_3, arg_6=arg_6,
            **arg_7)
    arg_8.do_run_2()
    if arg_5:
        return arg_8.get_termination_stats()

Levenberg-Marquardt optimization on a set of particles.

    Convenience wrapper for LMParticles. Same keyword args, but the
    defaults have been set to useful values for optimizing particles.
    See LMParticles and LMEngine for documentation.

    See Also
    --------
        do_levmarq_all_particle_groups : Levenberg-Marquardt optimization
            of all the particles in the state.

        do_levmarq : Levenberg-Marquardt optimization of the entire state;
            useful for optimizing global parameters.

        LMParticles : Optimizer object; the workhorse of do_levmarq_particles.

        LMEngine : Engine superclass for all the optimizers.

Levenberg - Marquardt optimization on a set of particles .


def Func ( arg_0 , arg_1 ) : if not arg_0 . only_blame_patterns : return True for arg_2 in arg_0 . only_blame_patterns : if arg_2 . match ( arg_1 ) : return True return False

def Func(arg_0, arg_1):
        '''Given a filepath, and a list of regex patterns, this function returns true
        if filepath matches any one of those patterns'''
        if not arg_0.only_blame_patterns:
            return True

        for arg_2 in arg_0.only_blame_patterns:
            if arg_2.match(arg_1):
                return True
        return False

Given a filepath and a list of regex patterns this function returns true if filepath matches any one of those patterns


def
Func
(
arg_0
,
arg_1
)
:
if
not
arg_1
:
raise
TypeError
(
'engine must be a valid object'
)
arg_2
=
arg_1
(
arg_0
)
arg_3
=
(
'activate'
,
'disable'
)
if
not
all
(
[
hasattr
(
arg_2
,
arg_4
)
for
arg_4
in
arg_3
]
)
:
raise
NotImplementedError
(
'engine must implementent the '
'required methods'
)
arg_0
.
mock_engine
=
arg_2
if
arg_0
.
active
:
arg_0
.
mock_engine
.
activate
(
)

def Func(arg_0, arg_1):
        """
        Sets a custom mock engine, replacing the built-in one.

        This is particularly useful if you want to replace the built-in
        HTTP traffic mock interceptor engine with your custom one.

        For mock engine implementation details, see `pook.MockEngine`.

        Arguments:
            engine (pook.MockEngine): custom mock engine to use.
        """
        if not arg_1:
            raise TypeError('engine must be a valid object')

        # Instantiate mock engine
        arg_2 = arg_1(arg_0)

        # Validate minimum viable interface
        arg_3 = ('activate', 'disable')
        if not all([hasattr(arg_2, arg_4) for arg_4 in arg_3]):
            raise NotImplementedError('engine must implementent the '
                                      'required methods')

        # Use the custom mock engine
        arg_0.mock_engine = arg_2

        # Enable mock engine, if needed
        if arg_0.active:
            arg_0.mock_engine.activate()

Sets a custom mock engine replacing the built - in one .


def Func(arg_0,arg_1,arg_2):
		''' It will return the google url to be searched'''
		arg_3='+'.join(arg_1)
		arg_4='https://www.google.co.in/search?q='
		arg_2=arg_2.split(" ")
		arg_5='+'.join(arg_2)
		arg_6=arg_4+arg_3+arg_5
		#print url
		return arg_6


def Func ( arg_0 , arg_1 , ** arg_2 ) : arg_3 = arg_0 . request ( 'PUT' , '/v1/' + arg_1 , json = arg_2 ) return arg_3 . addCallback ( arg_0 . _handle_response , check_cas = True )

def Func(arg_0, arg_1, **arg_2):
        """
        Write data to Vault. Returns the JSON-decoded response.
        """
        arg_3 = arg_0.request('PUT', '/v1/' + arg_1, json=arg_2)
        return arg_3.addCallback(arg_0._handle_response, check_cas=True)

Write data to Vault . Returns the JSON - decoded response .


def Func ( arg_0 , arg_1 = None ) : if arg_1 is None : arg_2 = du . parser . parse ( arg_0 ) else : arg_2 = dt . datetime . strftime ( arg_0 , arg_1 ) return arg_2

def Func(arg_0, arg_1=None):
    """
    Return a datetime oject from a string, with optional time format.

    Parameters
    ----------
    datetime : str
        Date-time as string in any sensible format.
    time_format : datetime str (optional)
        String describing the datetime format. If missing uses
        dateutil.parser to guess time format.
    """
    if arg_1 is None:
        arg_2 = du.parser.parse(arg_0)
    else:
        arg_2 = dt.datetime.strftime(arg_0, arg_1)
    return arg_2

Return a datetime oject from a string with optional time format .


def Func(arg_0):
        """Return the string representation of the job description XML."""
        arg_1 = arg_0.as_element()
        indent(arg_1)
        arg_2 = ET.Func(arg_1, encoding="utf-8")
        # Now remove the tokens used to order the attributes.
        arg_2 = re.sub(r'_[A-Z]_','',arg_2)
        arg_2 = '<?xml version="1.0" encoding="utf-8"?>\n' + arg_2
        return arg_2

Return the string representation of the job description XML .


def
Func
(
arg_0
,
arg_1
)
:
TaskProjects
(
arg_0
)
.
execute
(
)
arg_2
=
TaskEnrich
(
arg_0
,
arg_1
=
arg_1
)
try
:
arg_2
.
execute
(
)
logging
.
info
(
"Loading enriched data finished!"
)
except
Exception
as
e
:
logging
.
error
(
str
(
e
)
)
sys
.
exit
(
1
)

def Func(arg_0, arg_1):
    """Execute the enrich phase for a given backend section

    :param config: a Mordred config object
    :param backend_section: the backend section where the enrich phase is executed
    """

    TaskProjects(arg_0).execute()
    arg_2 = TaskEnrich(arg_0, arg_1=arg_1)
    try:
        arg_2.execute()
        logging.info("Loading enriched data finished!")
    except Exception as e:
        logging.error(str(e))
        sys.exit(-1)


def
Func
(
arg_0
)
:
try
:
arg_1
=
arg_0
.
__consume
(
)
except
DXParserNoTokens
:
return
if
arg_1
.
equals
(
'component'
)
:
arg_2
=
arg_0
.
__consume
(
)
.
value
(
)
if
not
arg_0
.
__consume
(
)
.
equals
(
'value'
)
:
raise
DXParseError
(
'field: "value" expected'
)
arg_3
=
arg_0
.
__consume
(
)
.
value
(
)
try
:
arg_0
.
currentobject
[
'components'
]
[
arg_2
]
=
arg_3
except
KeyError
:
arg_0
.
currentobject
[
'components'
]
=
{
arg_2
:
arg_3
}
else
:
raise
DXParseError
(
'field: '
+
str
(
arg_1
)
+
' not recognized.'
)

def Func(arg_0):
        """Level-2 parser for a DX field object.

        pattern:
        object "site map 1" class field
        component "positions" value 1
        component "connections" value 2
        component "data" value 3
        """
        try:
            arg_1 = arg_0.__consume()
        except DXParserNoTokens:
            return

        if arg_1.equals('component'):
            arg_2 = arg_0.__consume().value()
            if not arg_0.__consume().equals('value'):
                raise DXParseError('field: "value" expected')
            arg_3 = arg_0.__consume().value()
            try:
                arg_0.currentobject['components'][arg_2] = arg_3
            except KeyError:
                arg_0.currentobject['components'] = {arg_2:arg_3}
        else:
            raise DXParseError('field: '+str(arg_1)+' not recognized.')

Level - 2 parser for a DX field object .


def
Func
(
arg_0
)
:
arg_1
=
[
"GET %s HTTP/1.1"
%
(
"/room/%s/live.json"
%
arg_0
.
factory
.
get_stream
(
)
.
get_room_id
(
)
)
]
arg_2
=
arg_0
.
factory
.
get_stream
(
)
.
get_connection
(
)
.
get_headers
(
)
for
arg_3
in
arg_2
:
arg_1
.
append
(
"%s: %s"
%
(
arg_3
,
arg_2
[
arg_3
]
)
)
arg_1
.
append
(
"Host: streaming.campfirenow.com"
)
arg_0
.
transport
.
write
(
"\r\n"
.
join
(
arg_1
)
+
"\r\n\r\n"
)
arg_0
.
factory
.
get_stream
(
)
.
set_protocol
(
arg_0
)

def Func(arg_0):
        """ Called when a connection is made, and used to send out headers """

        arg_1 = [
            "GET %s HTTP/1.1" % ("/room/%s/live.json" % arg_0.factory.get_stream().get_room_id())
        ]

        arg_2 = arg_0.factory.get_stream().get_connection().get_headers()
        for arg_3 in arg_2:
            arg_1.append("%s: %s" % (arg_3, arg_2[arg_3]))

        arg_1.append("Host: streaming.campfirenow.com")

        arg_0.transport.write("\r\n".join(arg_1) + "\r\n\r\n")
        arg_0.factory.get_stream().set_protocol(arg_0)

Called when a connection is made and used to send out headers