小编ron*_*akg的帖子

请勿将entry_points安装为可执行文件

我正在尝试创建一个自己的包.包非常简单,它有一个python模块和一个bash脚本.我想把它们都安装好,/usr/local/bin以便它们可以直接执行.

这是我的setup.py档案:

from setuptools import setup

setup(
    name='deploy',
    .
    .
    .
    install_requires=['pyyaml', 'cot', 'jsonschema'],
    entry_points={
        'console_scripts': [
            'cloud_config = cloud_config:main',
        ],
    },
    scripts=['deploy.sh'],
)
Run Code Online (Sandbox Code Playgroud)

以下是输出的摘录pip install ...:

running install_scripts
    copying build/scripts-2.7/deploy.sh -> /usr/local/lib/python2.7.10/bin
    changing mode of /usr/local/lib/python2.7.10/bin/deploy.sh to 755
    Installing cloud_config script to /usr/local/lib/python2.7.10/bin
Run Code Online (Sandbox Code Playgroud)

有了这个,我无法直接调用python或bash脚本.

有任何想法吗?

编辑:我运行pipUbuntu 16.04.1机器.只是尝试在Ubuntu 14.04机器上安装相同的包,行为是预期的.cloud_config.py并且deploy.sh都安装到了/usr/local/bin,我可以从系统的任何地方调用它们.

python bash pip setup.py

13
推荐指数
1
解决办法
1814
查看次数

How can I show errors/warnings above the documentation in the mouse hover popup?

When I hover my mouse over an error/warning in VSCode, the documentation for that item appears by default. To actually check the error, I need to scroll down. Is there a way to show the error/warning above the documentation by giving it a higher priority?

Example: The documentation for Response is shown by default (1st screenshot). But I'm interested in the error, which is visible only after I scroll down (2nd screenshot).

在此输入图像描述

在此输入图像描述

documentation hover visual-studio-code

10
推荐指数
1
解决办法
631
查看次数

列表搜索中的快速字符串

使用Python 3,我有一个包含超过100,000个字符串(list1)的列表,每个字符串最多300个字符.我还有一个包含超过900万个子串的列表(list2) - 我想计算list2中子串的元素数量.例如,

list1 = ['cat', 'caa', 'doa', 'oat']
list2 = ['at', 'ca', 'do']
Run Code Online (Sandbox Code Playgroud)

我希望函数返回(映射到list2):

[2, 2, 1]
Run Code Online (Sandbox Code Playgroud)

通常,这非常简单,只需要很少.但是,由于列表的大小,我有效率问题.我想找到返回该计数器列表的最快方法.

我已经尝试过列表推导,生成器,地图,各种循环,我还没有找到一种快速的方法来完成这项简单的任务.理论上什么是完成这个目标的最快方法,最好O(len(list2))是快速采取措施?

python string performance list

6
推荐指数
1
解决办法
1048
查看次数

jQuery fadeIn fadeOut使页面滚动

我有wordpress启用的网站,我想创建一个功能块.这个特色区块的特色文章将陆续褪色.我把它用在工作fadeInfadeOutjQuery的的API,但是,有与执行问题.

这是我的代码 -

var count=0;
var sticky_count=<?php echo count($sticky);?>;

jQuery(document).ready(featured_block);

function featured_block() {   
    jQuery(".featured" + count % sticky_count).delay(5000).fadeOut(callback);
}

function callback() {
    count++;
    jQuery(".featured" + count % sticky_count).fadeIn().delay(5000);
    jQuery(".featured" + count % sticky_count).fadeOut(callback);
}
Run Code Online (Sandbox Code Playgroud)

fadeIn- fadeOut直到用户导航到页面底部的效果是工作的罚款.当用户位于页面底部时,当淡入淡出切换发生时,整个页面会向上滚动.

您可以在http://www.ronakg.com上看到这一点

请告知我如何避免页面滚动.

编辑:以下是HTML代码的样子 -

<div class="featured0">
    ...
</div>

<div class="featured1" style="display:none">
    ...
</div>

...
Run Code Online (Sandbox Code Playgroud)

jquery scroll fadeout fadein

5
推荐指数
1
解决办法
1815
查看次数

如何将 Github 代码所有者文件仅限于特定分支?

我正在使用Github 上的CODEOWNERS文件来设置基于文件/文件夹的自动拉取请求审阅者。该系统运行良好,审阅者会自动添加到拉取请求中。

但是,我想仅针对发布分支而不是针对私有分支来限制此设置。当一个私有分支从发布分支中移除时,它也会获取CODEOWNERS文件,然后所有“拉取请求的自动审查者”设置。

有没有办法确保CODEOWNERS文件仅适用于特定分支?或者确保这个特定文件根本不会同步到其他分支的方法?

github

5
推荐指数
1
解决办法
2604
查看次数

什么是$ VIM,我在哪里找到它?

同样,我怎么找到$VIMRUNTIME

yum install vim-X11 vim-common vim-enhanced vim-minimal在CentOS 6.3上安装了vim

vim

3
推荐指数
1
解决办法
1062
查看次数