精华内容
下载资源
问答
  • Python warnings.warn怎么用?Python warnings.warn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块warnings的用法示例。在下文中一共展示了warn...

    本文整理汇总了Python中warnings.warn方法的典型用法代码示例。如果您正苦于以下问题:Python warnings.warn方法的具体用法?Python warnings.warn怎么用?Python warnings.warn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块warnings的用法示例。

    在下文中一共展示了warnings.warn方法的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

    示例1: check_app_config_entries_dont_start_with_script_name

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def check_app_config_entries_dont_start_with_script_name(self):

    """Check for App config with sections that repeat script_name."""

    for sn, app in cherrypy.tree.apps.items():

    if not isinstance(app, cherrypy.Application):

    continue

    if not app.config:

    continue

    if sn == '':

    continue

    sn_atoms = sn.strip('/').split('/')

    for key in app.config.keys():

    key_atoms = key.strip('/').split('/')

    if key_atoms[:len(sn_atoms)] == sn_atoms:

    warnings.warn(

    'The application mounted at %r has config '

    'entries that start with its script name: %r' % (sn,

    key))

    开发者ID:cherrypy,项目名称:cherrypy,代码行数:19,

    示例2: check_site_config_entries_in_app_config

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def check_site_config_entries_in_app_config(self):

    """Check for mounted Applications that have site-scoped config."""

    for sn, app in cherrypy.tree.apps.items():

    if not isinstance(app, cherrypy.Application):

    continue

    msg = []

    for section, entries in app.config.items():

    if section.startswith('/'):

    for key, value in entries.items():

    for n in ('engine.', 'server.', 'tree.', 'checker.'):

    if key.startswith(n):

    msg.append('[%s] %s = %s' %

    (section, key, value))

    if msg:

    msg.insert(0,

    'The application mounted at %r contains the '

    'following config entries, which are only allowed '

    'in site-wide config. Move them to a [global] '

    'section and pass them to cherrypy.config.update() '

    'instead of tree.mount().' % sn)

    warnings.warn(os.linesep.join(msg))

    开发者ID:cherrypy,项目名称:cherrypy,代码行数:24,

    示例3: get_app

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def get_app(self, app=None):

    """Obtain a new (decorated) WSGI app to hook into the origin server."""

    if app is None:

    app = cherrypy.tree

    if self.validate:

    try:

    from wsgiref import validate

    except ImportError:

    warnings.warn(

    'Error importing wsgiref. The validator will not run.')

    else:

    # wraps the app in the validator

    app = validate.validator(app)

    return app

    开发者ID:cherrypy,项目名称:cherrypy,代码行数:18,

    示例4: pipe_fopen

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def pipe_fopen(command, mode, background=True):

    if mode not in ["rb", "r"]:

    raise RuntimeError("Now only support input from pipe")

    p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)

    def background_command_waiter(command, p):

    p.wait()

    if p.returncode != 0:

    warnings.warn("Command \"{0}\" exited with status {1}".format(

    command, p.returncode))

    _thread.interrupt_main()

    if background:

    thread = threading.Thread(target=background_command_waiter,

    args=(command, p))

    # exits abnormally if main thread is terminated .

    thread.daemon = True

    thread.start()

    else:

    background_command_waiter(command, p)

    return p.stdout

    开发者ID:funcwj,项目名称:kaldi-python-io,代码行数:24,

    示例5: fprop

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def fprop(self, x, y, **kwargs):

    if self.attack is not None:

    x = x, self.attack(x)

    else:

    x = x,

    # Catching RuntimeError: Variable -= value not supported by tf.eager.

    try:

    y -= self.smoothing * (y - 1. / tf.cast(y.shape[-1], tf.float32))

    except RuntimeError:

    y.assign_sub(self.smoothing * (y - 1. / tf.cast(y.shape[-1],

    tf.float32)))

    logits = [self.model.get_logits(x, **kwargs) for x in x]

    loss = sum(

    softmax_cross_entropy_with_logits(labels=y,

    logits=logit)

    for logit in logits)

    warnings.warn("LossCrossEntropy is deprecated, switch to "

    "CrossEntropy. LossCrossEntropy may be removed on "

    "or after 2019-03-06.")

    return loss

    开发者ID:StephanZheng,项目名称:neural-fingerprinting,代码行数:24,

    示例6: to_categorical

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def to_categorical(y, num_classes=None):

    """

    Converts a class vector (integers) to binary class matrix.

    This is adapted from the Keras function with the same name.

    :param y: class vector to be converted into a matrix

    (integers from 0 to num_classes).

    :param num_classes: num_classes: total number of classes.

    :return: A binary matrix representation of the input.

    """

    y = np.array(y, dtype='int').ravel()

    if not num_classes:

    num_classes = np.max(y) + 1

    warnings.warn("FutureWarning: the default value of the second"

    "argument in function \"to_categorical\" is deprecated."

    "On 2018-9-19, the second argument"

    "will become mandatory.")

    n = y.shape[0]

    categorical = np.zeros((n, num_classes))

    categorical[np.arange(n), y] = 1

    return categorical

    开发者ID:StephanZheng,项目名称:neural-fingerprinting,代码行数:22,

    示例7: _get_logits_name

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def _get_logits_name(self):

    """

    Looks for the name of the layer producing the logits.

    :return: name of layer producing the logits

    """

    softmax_name = self._get_softmax_name()

    softmax_layer = self.model.get_layer(softmax_name)

    if not isinstance(softmax_layer, Activation):

    # In this case, the activation is part of another layer

    return softmax_name

    if hasattr(softmax_layer, 'inbound_nodes'):

    warnings.warn(

    "Please update your version to keras >= 2.1.3; "

    "support for earlier keras versions will be dropped on "

    "2018-07-22")

    node = softmax_layer.inbound_nodes[0]

    else:

    node = softmax_layer._inbound_nodes[0]

    logits_name = node.inbound_layers[0].name

    return logits_name

    开发者ID:StephanZheng,项目名称:neural-fingerprinting,代码行数:26,

    示例8: model_loss

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def model_loss(y, model, mean=True):

    """

    Define loss of TF graph

    :param y: correct labels

    :param model: output of the model

    :param mean: boolean indicating whether should return mean of loss

    or vector of losses for each input of the batch

    :return: return mean of loss if True, otherwise return vector with per

    sample loss

    """

    warnings.warn('This function is deprecated.')

    op = model.op

    if op.type == "Softmax":

    logits, = op.inputs

    else:

    logits = model

    out = softmax_cross_entropy_with_logits(logits=logits, labels=y)

    if mean:

    out = reduce_mean(out)

    return out

    开发者ID:StephanZheng,项目名称:neural-fingerprinting,代码行数:24,

    示例9: infer_devices

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def infer_devices(devices=None):

    """

    Returns the list of devices that multi-replica code should use.

    :param devices: list of string device names, e.g. ["/GPU:0"]

    If the user specifies this, `infer_devices` checks that it is

    valid, and then uses this user-specified list.

    If the user does not specify this, infer_devices uses:

    - All available GPUs, if there are any

    - CPU otherwise

    """

    if devices is None:

    devices = get_available_gpus()

    if len(devices) == 0:

    warnings.warn("No GPUS, running on CPU")

    # Set device to empy string, tf will figure out whether to use

    # XLA or not, etc., automatically

    devices = [""]

    else:

    assert len(devices) > 0

    for device in devices:

    assert isinstance(device, str), type(device)

    return devices

    开发者ID:StephanZheng,项目名称:neural-fingerprinting,代码行数:24,

    示例10: enable_receiving

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def enable_receiving(self):

    """

    Switch the monitor into listing mode.

    Connect to the event source and receive incoming events. Only after

    calling this method, the monitor listens for incoming events.

    .. note::

    This method is implicitly called by :meth:`__iter__`. You don't

    need to call it explicitly, if you are iterating over the

    monitor.

    .. deprecated:: 0.16

    Will be removed in 1.0. Use :meth:`start()` instead.

    """

    import warnings

    warnings.warn('Will be removed in 1.0. Use Monitor.start() instead.',

    DeprecationWarning)

    self.start()

    开发者ID:mbusb,项目名称:multibootusb,代码行数:22,

    示例11: from_sys_path

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def from_sys_path(cls, context, sys_path): #pragma: no cover

    """

    .. versionchanged:: 0.4

    Raise :exc:`NoSuchDeviceError` instead of returning ``None``, if

    no device was found for ``sys_path``.

    .. versionchanged:: 0.5

    Raise :exc:`DeviceNotFoundAtPathError` instead of

    :exc:`NoSuchDeviceError`.

    .. deprecated:: 0.18

    Use :class:`Devices.from_sys_path` instead.

    """

    import warnings

    warnings.warn(

    'Will be removed in 1.0. Use equivalent Devices method instead.',

    DeprecationWarning,

    stacklevel=2

    )

    return Devices.from_sys_path(context, sys_path)

    开发者ID:mbusb,项目名称:multibootusb,代码行数:20,

    示例12: traverse

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def traverse(self):

    """

    Traverse all parent devices of this device from bottom to top.

    Return an iterable yielding all parent devices as :class:`Device`

    objects, *not* including the current device. The last yielded

    :class:`Device` is the top of the device hierarchy.

    .. deprecated:: 0.16

    Will be removed in 1.0. Use :attr:`ancestors` instead.

    """

    import warnings

    warnings.warn(

    'Will be removed in 1.0. Use Device.ancestors instead.',

    DeprecationWarning,

    stacklevel=2

    )

    return self.ancestors

    开发者ID:mbusb,项目名称:multibootusb,代码行数:20,

    示例13: __iter__

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def __iter__(self):

    """

    Iterate over the names of all properties defined for this device.

    Return a generator yielding the names of all properties of this

    device as unicode strings.

    .. deprecated:: 0.21

    Will be removed in 1.0. Access properties with Device.properties.

    """

    import warnings

    warnings.warn(

    'Will be removed in 1.0. Access properties with Device.properties.',

    DeprecationWarning,

    stacklevel=2

    )

    return self.properties.__iter__()

    开发者ID:mbusb,项目名称:multibootusb,代码行数:19,

    示例14: __getitem__

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def __getitem__(self, prop):

    """

    Get the given property from this device.

    ``prop`` is a unicode or byte string containing the name of the

    property.

    Return the property value as unicode string, or raise a

    :exc:`~exceptions.KeyError`, if the given property is not defined

    for this device.

    .. deprecated:: 0.21

    Will be removed in 1.0. Access properties with Device.properties.

    """

    import warnings

    warnings.warn(

    'Will be removed in 1.0. Access properties with Device.properties.',

    DeprecationWarning,

    stacklevel=2

    )

    return self.properties.__getitem__(prop)

    开发者ID:mbusb,项目名称:multibootusb,代码行数:23,

    示例15: asint

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def asint(self, prop):

    """

    Get the given property from this device as integer.

    ``prop`` is a unicode or byte string containing the name of the

    property.

    Return the property value as integer. Raise a

    :exc:`~exceptions.KeyError`, if the given property is not defined

    for this device, or a :exc:`~exceptions.ValueError`, if the property

    value cannot be converted to an integer.

    .. deprecated:: 0.21

    Will be removed in 1.0. Use Device.properties.asint() instead.

    """

    import warnings

    warnings.warn(

    'Will be removed in 1.0. Use Device.properties.asint instead.',

    DeprecationWarning,

    stacklevel=2

    )

    return self.properties.asint(prop)

    开发者ID:mbusb,项目名称:multibootusb,代码行数:24,

    示例16: fit

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def fit(self, inputs, outputs, weights=None, override=False):

    """

    Fit model.

    Args:

    inputs (list/Array): List/Array of input training objects.

    outputs (list/Array): List/Array of output values

    (supervisory signals).

    weights (list/Array): List/Array of weights. Default to None,

    i.e., unweighted.

    override (bool): Whether to calculate the feature vectors

    from given inputs. Default to False. Set to True if

    you want to retrain the model with a different set of

    training inputs.

    """

    if self._xtrain is None or override:

    xtrain = self.describer.describe_all(inputs)

    else:

    warnings.warn("Feature vectors retrieved from cache "

    "and input training objects ignored. "

    "To override the old cache with feature vectors "

    "of new training objects, set override=True.")

    xtrain = self._xtrain

    self.model.fit(xtrain, outputs, weights)

    self._xtrain = xtrain

    开发者ID:materialsvirtuallab,项目名称:mlearn,代码行数:27,

    示例17: predict

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def predict(self, inputs, override=False):

    """

    Predict outputs with fitted model.

    Args:

    inputs (list/Array): List/Array of input testing objects.

    override (bool): Whether to calculate the feature

    vectors from given inputs. Default to False. Set to True

    if you want to test the model with a different set of

    testing inputs.

    Returns:

    Predicted output array from inputs.

    """

    if self._xtest is None or override:

    xtest = self.describer.describe_all(inputs)

    else:

    warnings.warn("Feature vectors retrieved from cache "

    "and input testing objects ignored. "

    "To override the old cache with feature vectors "

    "of new testing objects, set override=True.")

    xtest = self._xtest

    self._xtest = xtest

    return self.model.predict(xtest)

    开发者ID:materialsvirtuallab,项目名称:mlearn,代码行数:26,

    示例18: rc

    ​点赞 6

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def rc():

    '''

    config.rc() yields the data imported from the Neuropythy rc file, if any.

    '''

    if config._rc is None:

    # First: We check to see if we have been given a custom nptyhrc file:

    npythyrc_path = os.path.expanduser('~/.npythyrc')

    if 'NPYTHYRC' in os.environ:

    npythyrc_path = os.path.expanduser(os.path.expandvars(os.environ['NPYTHYRC']))

    # the default config:

    if os.path.isfile(npythyrc_path):

    try:

    config._rc = loadrc(npythyrc_path)

    config._rc['npythyrc_loaded'] = True

    except Exception as err:

    warnings.warn('Could not load neuropythy RC file: %s' % npythyrc_path)

    config._rc = {'npythyrc_loaded':False,

    'npythyrc_error': err}

    else:

    config._rc = {'npythyrc_loaded':False}

    config._rc['npythyrc'] = npythyrc_path

    return config._rc

    开发者ID:noahbenson,项目名称:neuropythy,代码行数:24,

    示例19: __setitem__

    ​点赞 5

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def __setitem__(self, key, value):

    if key not in self.agents or self.agents[key] is None:

    self.agents[key] = value

    if value is None:

    warnings.warn("Trying to set the value of key {} to None.".

    format(key), RuntimeWarning)

    else:

    pass

    # this fails the tests at the moment, so we need to debug

    # it is the tests that have a problem!

    # raise KeyError("The key \"{}\" already exists in the registry"

    # .format(key))

    开发者ID:gcallah,项目名称:indras_net,代码行数:14,

    示例20: _configure_logging

    ​点赞 5

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def _configure_logging(level=logging.INFO):

    logging.addLevelName(logging.DEBUG, 'Debug:')

    logging.addLevelName(logging.INFO, 'Info:')

    logging.addLevelName(logging.WARNING, 'Warning!')

    logging.addLevelName(logging.CRITICAL, 'Critical!')

    logging.addLevelName(logging.ERROR, 'Error!')

    logging.basicConfig(format='%(levelname)s %(message)s', level=logging.INFO)

    if not sys.warnoptions:

    import warnings

    warnings.simplefilter("ignore")

    # TODO hack to get rid of deprecation warning that appeared allthough filters

    # are set to ignore. Is there a more sane way?

    warnings.warn = lambda *args, **kwargs: None

    开发者ID:mme,项目名称:vergeml,代码行数:17,

    示例21: add_member

    ​点赞 5

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def add_member(self, login):

    """Add ``login`` to this team.

    :returns: bool

    """

    warnings.warn(

    'This is no longer supported by the GitHub API, see '

    'https://developer.github.com/changes/2014-09-23-one-more-week'

    '-before-the-add-team-member-api-breaking-change/',

    DeprecationWarning)

    url = self._build_url('members', login, base_url=self._api)

    return self._boolean(self._put(url), 204, 404)

    开发者ID:kislyuk,项目名称:aegea,代码行数:14,

    示例22: remove_member

    ​点赞 5

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def remove_member(self, login):

    """Remove ``login`` from this team.

    :param str login: (required), login of the member to remove

    :returns: bool

    """

    warnings.warn(

    'This is no longer supported by the GitHub API, see '

    'https://developer.github.com/changes/2014-09-23-one-more-week'

    '-before-the-add-team-member-api-breaking-change/',

    DeprecationWarning)

    url = self._build_url('members', login, base_url=self._api)

    return self._boolean(self._delete(url), 204, 404)

    开发者ID:kislyuk,项目名称:aegea,代码行数:15,

    示例23: _cleanup

    ​点赞 5

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def _cleanup(cls, name, warn_message):

    _rmtree(name)

    _warnings.warn(warn_message, _ResourceWarning)

    开发者ID:kislyuk,项目名称:aegea,代码行数:5,

    示例24: isotropic_powerspectrum

    ​点赞 5

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def isotropic_powerspectrum(*args, **kwargs): # pragma: no cover

    """

    Deprecated function. See isotropic_power_spectrum doc

    """

    import warnings

    msg = "This function has been renamed and will disappear in the future."\

    +" Please use isotropic_power_spectrum instead"

    warnings.warn(msg, Warning)

    return isotropic_power_spectrum(*args, **kwargs)

    开发者ID:xgcm,项目名称:xrft,代码行数:11,

    示例25: isotropic_crossspectrum

    ​点赞 5

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def isotropic_crossspectrum(*args, **kwargs): # pragma: no cover

    """

    Deprecated function. See isotropic_cross_spectrum doc

    """

    import warnings

    msg = "This function has been renamed and will disappear in the future."\

    +" Please use isotropic_cross_spectrum instead"

    warnings.warn(msg, Warning)

    return isotropic_cross_spectrum(*args, **kwargs)

    开发者ID:xgcm,项目名称:xrft,代码行数:11,

    示例26: check_skipped_app_config

    ​点赞 5

    # 需要导入模块: import warnings [as 别名]

    # 或者: from warnings import warn [as 别名]

    def check_skipped_app_config(self):

    """Check for mounted Applications that have no config."""

    for sn, app in cherrypy.tree.apps.items():

    if not isinstance(app, cherrypy.Application):

    continue

    if not app.config:

    msg = 'The Application mounted at %r has an empty config.' % sn

    if self.global_config_contained_paths:

    msg += (' It looks like the config you passed to '

    'cherrypy.config.update() contains application-'

    'specific sections. You must explicitly pass '

    'application config via '

    'cherrypy.tree.mount(..., config=app_config)')

    warnings.warn(msg)

    return

    开发者ID:cherrypy,项目名称:cherrypy,代码行数:17,

    注:本文中的warnings.warn方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。

    展开全文
  • Python logger.warn怎么用?Python logger.warn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块pip.log.logger的用法示例。在下文中一共展...

    本文整理汇总了Python中pip.log.logger.warn方法的典型用法代码示例。如果您正苦于以下问题:Python logger.warn方法的具体用法?Python logger.warn怎么用?Python logger.warn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块pip.log.logger的用法示例。

    在下文中一共展示了logger.warn方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

    示例1: switch

    ​点赞 3

    # 需要导入模块: from pip.log import logger [as 别名]

    # 或者: from pip.log.logger import warn [as 别名]

    def switch(self, dest, url, rev_options):

    repo_config = os.path.join(dest, self.dirname, 'hgrc')

    config = ConfigParser.SafeConfigParser()

    try:

    config.read(repo_config)

    config.set('paths', 'default', url)

    config_file = open(repo_config, 'w')

    config.write(config_file)

    config_file.close()

    except (OSError, ConfigParser.NoSectionError):

    e = sys.exc_info()[1]

    logger.warn(

    'Could not switch Mercurial repository to %s: %s'

    % (url, e))

    else:

    call_subprocess([self.cmd, 'update', '-q'] + rev_options, cwd=dest)

    开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:18,

    示例2: check_rev_options

    ​点赞 3

    # 需要导入模块: from pip.log import logger [as 别名]

    # 或者: from pip.log.logger import warn [as 别名]

    def check_rev_options(self, rev, dest, rev_options):

    """Check the revision options before checkout to compensate that tags

    and branches may need origin/ as a prefix.

    Returns the SHA1 of the branch or tag if found.

    """

    revisions = self.get_refs(dest)

    origin_rev = 'origin/%s' % rev

    if origin_rev in revisions:

    # remote branch

    return [revisions[origin_rev]]

    elif rev in revisions:

    # a local tag or branch name

    return [revisions[rev]]

    else:

    logger.warn("Could not find a tag or branch '%s', assuming commit." % rev)

    return rev_options

    开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:19,

    示例3: get_info

    ​点赞 3

    # 需要导入模块: from pip.log import logger [as 别名]

    # 或者: from pip.log.logger import warn [as 别名]

    def get_info(self, location):

    """Returns (url, revision), where both are strings"""

    assert not location.rstrip('/').endswith(self.dirname), 'Bad directory: %s' % location

    output = call_subprocess(

    [self.cmd, 'info', location], show_stdout=False, extra_environ={'LANG': 'C'})

    match = _svn_url_re.search(output)

    if not match:

    logger.warn('Cannot determine URL of svn checkout %s' % display_path(location))

    logger.info('Output that cannot be parsed: \n%s' % output)

    return None, None

    url = match.group(1).strip()

    match = _svn_revision_re.search(output)

    if not match:

    logger.warn('Cannot determine revision of svn checkout %s' % display_path(location))

    logger.info('Output that cannot be parsed: \n%s' % output)

    return url, None

    return url, match.group(1)

    开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:19,

    示例4: _copy_file

    ​点赞 3

    # 需要导入模块: from pip.log import logger [as 别名]

    # 或者: from pip.log.logger import warn [as 别名]

    def _copy_file(filename, location, content_type, link):

    copy = True

    download_location = os.path.join(location, link.filename)

    if os.path.exists(download_location):

    response = ask_path_exists(

    'The file %s exists. (i)gnore, (w)ipe, (b)ackup ' %

    display_path(download_location), ('i', 'w', 'b'))

    if response == 'i':

    copy = False

    elif response == 'w':

    logger.warn('Deleting %s' % display_path(download_location))

    os.remove(download_location)

    elif response == 'b':

    dest_file = backup_dir(download_location)

    logger.warn('Backing up %s to %s'

    % (display_path(download_location), display_path(dest_file)))

    shutil.move(download_location, dest_file)

    if copy:

    shutil.copy(filename, download_location)

    logger.notify('Saved %s' % display_path(download_location))

    开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:22,

    示例5: check_compatibility

    ​点赞 3

    # 需要导入模块: from pip.log import logger [as 别名]

    # 或者: from pip.log.logger import warn [as 别名]

    def check_compatibility(version, name):

    """

    Raises errors or warns if called with an incompatible Wheel-Version.

    Pip should refuse to install a Wheel-Version that's a major series

    ahead of what it's compatible with (e.g 2.0 > 1.1); and warn when

    installing a version only minor version ahead (e.g 1.2 > 1.1).

    version: a 2-tuple representing a Wheel-Version (Major, Minor)

    name: name of wheel or package to raise exception about

    :raises UnsupportedWheel: when an incompatible Wheel-Version is given

    """

    if not version:

    raise UnsupportedWheel(

    "%s is in an unsupported or invalid wheel" % name

    )

    if version[0] > VERSION_COMPATIBLE[0]:

    raise UnsupportedWheel(

    "%s's Wheel-Version (%s) is not compatible with this version "

    "of pip" % (name, '.'.join(map(str, version)))

    )

    elif version > VERSION_COMPATIBLE:

    logger.warn('Installing from a newer Wheel-Version (%s)'

    % '.'.join(map(str, version)))

    开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:27,

    示例6: add_filename_to_pth

    ​点赞 3

    # 需要导入模块: from pip.log import logger [as 别名]

    # 或者: from pip.log.logger import warn [as 别名]

    def add_filename_to_pth(self, filename):

    path = os.path.dirname(filename)

    dest = filename + '.pth'

    if path not in self.paths():

    logger.warn('Adding .pth file %s, but it is not on sys.path' % display_path(dest))

    if not self.simulate:

    if os.path.exists(dest):

    f = open(dest)

    lines = f.readlines()

    f.close()

    if lines and not lines[-1].endswith('\n'):

    lines[-1] += '\n'

    lines.append(filename + '\n')

    else:

    lines = [filename + '\n']

    f = open(dest, 'wb')

    f.writelines(lines)

    f.close()

    开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:20,

    示例7: check_rev_options

    ​点赞 3

    # 需要导入模块: from pip.log import logger [as 别名]

    # 或者: from pip.log.logger import warn [as 别名]

    def check_rev_options(self, rev, dest, rev_options):

    """Check the revision options before checkout to compensate that tags

    and branches may need origin/ as a prefix.

    Returns the SHA1 of the branch or tag if found.

    """

    revisions = self.get_tag_revs(dest)

    revisions.update(self.get_branch_revs(dest))

    origin_rev = 'origin/%s' % rev

    if origin_rev in revisions:

    # remote branch

    return [revisions[origin_rev]]

    elif rev in revisions:

    # a local tag or branch name

    return [revisions[rev]]

    else:

    logger.warn("Could not find a tag or branch '%s', assuming commit." % rev)

    return rev_options

    开发者ID:jwvanderbeck,项目名称:krpcScripts,代码行数:20,

    示例8: _copy_file

    ​点赞 3

    # 需要导入模块: from pip.log import logger [as 别名]

    # 或者: from pip.log.logger import warn [as 别名]

    def _copy_file(filename, location, content_type, link):

    copy = True

    download_location = os.path.join(location, link.filename)

    if os.path.exists(download_location):

    response = ask_path_exists(

    'The file %s exists. (i)gnore, (w)ipe, (b)ackup ' %

    display_path(download_location), ('i', 'w', 'b'))

    if response == 'i':

    copy = False

    elif response == 'w':

    logger.warn('Deleting %s' % display_path(download_location))

    os.remove(download_location)

    elif response == 'b':

    dest_file = backup_dir(download_location)

    logger.warn('Backing up %s to %s'

    % (display_path(download_location), display_path(dest_file)))

    shutil.move(download_location, dest_file)

    if copy:

    shutil.copy(filename, download_location)

    logger.indent -= 2

    logger.notify('Saved %s' % display_path(download_location))

    开发者ID:jwvanderbeck,项目名称:krpcScripts,代码行数:23,

    示例9: remove_filename_from_pth

    ​点赞 3

    # 需要导入模块: from pip.log import logger [as 别名]

    # 或者: from pip.log.logger import warn [as 别名]

    def remove_filename_from_pth(self, filename):

    for pth in self.pth_files():

    f = open(pth, 'r')

    lines = f.readlines()

    f.close()

    new_lines = [

    l for l in lines if l.strip() != filename]

    if lines != new_lines:

    logger.info('Removing reference to %s from .pth file %s'

    % (display_path(filename), display_path(pth)))

    if not [line for line in new_lines if line]:

    logger.info('%s file would be empty: deleting' % display_path(pth))

    if not self.simulate:

    os.unlink(pth)

    else:

    if not self.simulate:

    f = open(pth, 'wb')

    f.writelines(new_lines)

    f.close()

    return

    logger.warn('Cannot find a reference to %s in any .pth file' % display_path(filename))

    开发者ID:jwvanderbeck,项目名称:krpcScripts,代码行数:23,

    注:本文中的pip.log.logger.warn方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。

    展开全文
  • Xshell监控warn日志

    2019-07-08 20:47:38
    但是这些日志,可能在不同的服务器上,怎么统一管理进行监控呢?那么就用到了Xshell Xshell ;远程连接服务器,强大的安全终端模拟软件。今天就只聊查看服务器上动态更新的错误警告日志 为啥Xshell? 其实我...

    应用场景:

    系统在用户的使用过程中,多少有些错误信息,异常报错等,这些不能给用户造成困惑

    所以警告或错误统一在日志中记录下来,方便维护人员对系统进行优化和修改。

    但是这些日志,可能在不同的服务器上,怎么统一管理进行监控呢?那么就用到了Xshell

    Xshell ;远程连接服务器,强大的安全终端模拟软件。今天就只聊查看服务器上动态更新的错误警告日志

    为啥用Xshell?

    其实我目前也就用了这一个:据说它可以保证数据在传输过程中的安全,这就涉及到了网络协议:Xshell支持Telnet,ssh 协议

    安全——两个协议:

    【前言】

    我们常见的是http (hypertext transfer protocol,超文本传输协议),是在客户端和web服务器端常见的一种通过加头加尾,到去头去尾的一个过程,建立连接-发送请求-响应请求-关闭连接,以这样的过程让双方可以进行很好的通信。但是这样简单的传输,如果有中间想要窃取信息的人,就可以直接获取到数据。

    【Telnet(teletype network)】是远程的传输协议 Telnet协议 

    怎么解释远程:我们应该都有通过别人的电脑,远程登录自己的电脑,可以在别人的电脑上操作自己的电脑的经历,那么这个过程,就要是你的和对方的电脑都有Telnet协议,才可以建立连接。

    远程登录的过程中,知道远程主机IP地址-知道登录口令

    实际应用:这就是我们通过自己电脑的Xshell,连接远程服务器的时候,要输入IP的步骤

    但是Telnet较为简单,单他在传输信息的过程中,都是用明文传送的,包括输入的登录口令,有一定的安全隐患,所以在Telnet基础上,引入的下面的协议

    【SSH(Secure shell)】在本地主机可远程服务器间进行加密传输数据

    怎么加密:加密方式有两种,对称加密,非对称加密

    目前了解的对称加密:加密方,和解密方用同一个东西进行加密,解密(让我想到电视剧中地下党在传递信息的时候,用一种药水在纸上写字,但是别人看不出来,只有用同一种药水浸泡后才可以看到,也许是一样的道理)

    非对称加密:加密方,和解密方用不同一个东西进行加密,解密(还是上面的例子;用药水写字的纸要用火烤才可以显示出来)

    具体怎么做的呢:

    SSH的工作机制大体是:本地客户端发送一个连接请求到远程的服务端,服务端检查申请的包和IP地址再发送密钥给SSH客户端,本地再将密钥发回给服务端,到此为止,连接建立。

    启动SSH服务器后,sshd进程运行并在默认的22端口进行监听。安全验证方式:基于口令的安全验证(账号密码),也有可能受到中间人攻击

    实际应用:上面提到的基于口令的验证方式,大概就是我们在使用Xshell在输入了IP建立了远程连接之后,需要输入如下内容:

    接下来就要输入密码了,但在输入密码的时候我们有连个选择:1、密码  2、公钥

    这就是另一种安全验证方式:

    基于密钥的安全验证,就是提供一对密钥,把公钥放在需要访问的服务器上,如果连接到SSH服务器上,客户端就会向服务器发出请求,请求用密钥进行安全验证,服务器收到请求之后,先在改服务器的主目录下寻找公钥,然后把它和发送过来的公钥进行比较。如果两个密钥一致,服务器就用公钥加密“质询”并把它发送给客户端。客户端收到“质询”之后就可以用私钥解密再把它发给服务器端。基于这种方式,相对比较安全。

    这个是用用户名,密码登录成功后的提示:上面是通过telnet建立连接后的内容,红框中是通过SSH建立口令验证方式登录成功后,提示连接时间from我的主机ip (没有用密钥尝试过,还不太清楚可以参考博客SSH协议详解)

     

    展开全文
  • PTA L1-005 考试座位号 出现 warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]怎么解决查了好多,原因都不太一样 每个 PAT 考生在参加考试...
  • 我是maven多模块项目,有以下几个子项目 ...虽然是个WARN,不影响程序运行,但是我一直想找出来哪里出问题了,tomcat怎么就会去扫描一个不存在lib目录下的jar呢。 ps:tomcat是spring boot内置的容器
  • [Element Warn]please pass correct props!

    千次阅读 2019-12-08 14:11:12
    一个页面了两个el-form。form2了校验,因此每一个form-item都写了prop,但是form1没有写。结果怎么提交都不对,把form1的prop都加上就解决啦。

    一个页面用了两个el-form。form2用了校验,因此每一个form-item都写了prop,但是form1没有写。结果怎么提交都不对,把form1的prop都加上就解决啦。
    在这里插入图片描述

    展开全文
  • Android Log是怎么用

    千次阅读 2011-04-11 09:23:00
    在Android群里,经常会有人问我,Android Log是怎么用的,今天我就把从网上以及SDK里东拼西凑过来,让大家先一睹为快,希望对大家入门Android Log有一定的帮助. android.util.Log常用的方法有以下5个:...
  • 循环出来之后报错怎么解决: 代码是这样的 <img alt="image" src="https://img-blog.csdnimg.cn/img_convert/9d544e95475cf569c1c38d48779dc619.png" /></p> <ul><li> </li></ul> <p><img alt=...
  • log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" org.hibernate.MappingException: ...
  • Hibernate: insert into company_img (company_id, img, rank, title) values (?...)2018-11-19 09:48:55.190 WARN 4384 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 1064...
  • <div><p>在执行npm install 时报: npm WARN deprecated autoprefixer-loader.2.0: Please use postcss-...知道怎么什么问题的谢谢指导啦</p><p>该提问来源于开源项目:shinygang/Vue-cnodejs</p></div>
  • log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. 2015-9-18 13:15:22 org.apache.catalina.core....
  • 解决vue v-for 遍历循环时key值报错的问题一 、问题如下:[Vue warn] Avoid using non-primitive value as key, use string/number value instead.non-primitive表示的是对象这里的[Vue warn]是指不要对象或是数组...
  • 1 主键自增id设置不合理引发的bug首先,我检查了一下应用管理页面,发现资源没有完,GC也正常,程序正在嗖嗖的跑呢,那怎么会没有今天的数据呢?看了下日志,error.log里面并没有今天的日志,warn.log里面有sql...
  • 如题,我打包一个python程序,import 的包比较多,打包过程也没报错,pyinstaller -D 打包为目录时程序可以执行,-F打包成单个文件,运行就崩溃掉, ...哪位有经验的同学帮忙看下怎么破,不甚感激。。。
  • <div><p>cat /var/log/udp2raw.log [2018-12-20 10:54:46][WARN] -a has not been set, make sure you have added ...不知道怎么解决啊。。</p><p>该提问来源于开源项目:hongwenjun/WinKcp_Launcher</p></div>
  • Tomcat运行java项目时报错,的maven管理,里面的java包和类都能找到,在maven里,哪位大神给看看是什么原因呀,要怎么处理,=WARN = [localhost-startStop-1 06/25 08:00:21] =&gt;=&gt;=&gt; ...
  • curl访问后台报错

    2021-01-01 23:59:41
    (2)实体映射怎么配置呢,在工程的sql中没有blog_tag表,我是按照你文档中的建表的。然后也建立了news_tag表 (3)curl -X post http://127.0.0.1:9400/tag_group -d 'name=java'访问后台...
  • [17/05/09 18:19:35] [warn] 获取消息失败,当前失败次数: 1 [17/05/09 18:20:36] [warn] 获取消息失败,当前失败次数: 2 [17/05/09 18:21:37] [warn] 获取消息失败,当前失败次数: 3 [17/05/09 ...
  • 控制台报的错误是这样的:[Vue warn]: Do not mount Vue to or - mount to normal elements instead.我的 v2.5.17 的版本, 不支持new Vue({el:'body',data:{msg:'welcome vue'}});{{msg}}报错如下:版本不支持了...
  • 怎么将 ``` let onConversationListUpdated = function (event) { console.log("收到离线消息!"); console.log(event.data); console.log(event.data[i].lastMessage.messageForShow);// 包含 ...
  • <p>function sortByKey(array, key){<!-- -->  return array.sort(function(a,b){<!-- -->  var x = a[key];  var y =...为什么一直报vue.js:634 [Vue warn]: Error in ... 怎么解决?</p>
  • 2009-04-16 19:28:05,709 WARN [org.hibernate.util.JDBCExceptionReporter] - , SQLState: 42000> 2009-04-16 19:28:05,712 ERROR [org.hibernate.util.JDBCExceptionReporter] - ; check the manual that ...
  • 12:21:30.904 [main] WARN org.springframework.context.annotation.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.spring...
  • 控制台信息: ``` "G:\IntelliJ IDEA 2019.3.3\jbr\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -...
  • npm WARN optional dep failed, continuing fsevents@0.3.8 \ > spawn-sync@1.0.13 postinstall E:\project2\shijuan\node_modules\node-sass\node_modules\sas modules\spawn-sync > node postinstall \ > ...
  • level的模式的详细说明,请看zap官方文档 info: info模式,无错误的堆栈信息,只输出信息debug:debug模式,有错误的堆栈详细信息warn:warn模式error: error模式,有错误的堆栈详细信息dpanic: dpanic模式panic: panic模式...
  • 2019-12-20 21:07:05.962 WARN 7776 --- [nio-8087-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Failed to write ...
  • <div><p>[2017-11-23 02:56:23][WARN]huge packet,data len=1365 (>1350).strongly suggested to set a smaller mtu ...这个mtu需要怎么解决。</p><p>该提问来源于开源项目:wangyu-/UDPspeeder</p></div>

空空如也

空空如也

1 2 3 4 5 ... 8
收藏数 149
精华内容 59
关键字:

warn怎么用