小编Sam*_*dek的帖子

Ncurses 6.0编译错误 - 错误:预期')'在'int'之前

问题描述

试图在Ubuntu 16.04 LTS上安装ncurses 6.0失败,出现编译错误:

In file included from ./curses.priv.h:325:0,
                 from ../ncurses/lib_gen.c:19:
_24273.c:843:15: error: expected ‘)’ before ‘int’
../include/curses.h:1631:56: note: in definition of macro ‘mouse_trafo’
#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
                                                    ^
Makefile:962: recipe for target '../objects/lib_gen.o' failed
make[1]: *** [../objects/lib_gen.o] Error 1
make[1]: Leaving directory '/home/netsamir/Sofware/Tmux/ncurses-6.0/ncurses'
Makefile:113: recipe for target 'all' failed
make: *** [all] Error 2
Run Code Online (Sandbox Code Playgroud)

组态

netsamir@octopus:~/Sofware/Tmux/ncurses-6.0$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04 LTS
Release:    16.04
Codename:   xenial

netsamir@octopus:~/Sofware/Tmux/ncurses-6.0$ gcc --version
gcc (Ubuntu …
Run Code Online (Sandbox Code Playgroud)

ncurses

22
推荐指数
2
解决办法
1万
查看次数

pytest.fixture函数不能使用``yield``.而是编写并返回一个内部函数/生成器,让消费者调用并迭代它:

我正在尝试使用pytest为我的Django项目运行selenium并执行fixture fix/teardown.

我试图遵循最佳实践使用,yield但我收到一个错误:

--- ERROR at setup of test_browsing_check --- 
pytest.fixture functions cannot use ``yield``. Instead write and return an inner function/generator and let the consumer call and iterate over it.:

@pytest.fixture(scope="module")
def browser(request):
    selenium = webdriver.Firefox()
    selenium .implicitly_wait(3)
    yield selenium
    selenium.quit()
Run Code Online (Sandbox Code Playgroud)

你知道它为什么不起作用吗?

然后,我使用了另一个运行良好的代码

@pytest.fixture(scope="module")
def browser(request):
    selenium = webdriver.Firefox()
    selenium.implicitly_wait(3)
    def teardown():
        selenium.quit()
    request.addfinalizer(teardown)
    return selenium
Run Code Online (Sandbox Code Playgroud)

但不建议使用此方法:

此方法仍然完全受支持,但建议从2.10开始产量,因为它被认为更简单,更好地描述了自然代码流.

关于版本的说明:

$ python -V
$ Python 3.5.2 :: Anaconda 4.2.0 (64-bit)

$ django-admin version
$ 1.10.3

$ …
Run Code Online (Sandbox Code Playgroud)

selenium pytest-django

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

Perl:提取域名

提取URL的域名

还有一个解析URL的请求,但我发现了许多不完整或理论上的例子.我想肯定有一些在perl中工作的东西.

我有以下网址:

https://vimdoc.sourceforge.net/htmldoc/pattern.html
http://linksyssmartwifi.com/ui/1.0.1.1001/dynamic/login.html
http://www.catonmat.net/download/perl1line.txt
https://github.com/robbyrussell/oh-my-zsh/wiki/Cheatsheet
https://drive.google.com/drive/u/0/folders/0B5jNDUmF2eUJuSnM
http://www.gnu.org/software/coreutils/manual/coreutils.html
http://www.catonmat.net/download/perl1line.txt
https://feedly.com/i/my
http://vimhelp.appspot.com/
https://git-scm.com/doc
https://read.amazon.com/
https://github.com/netsamir/following
https://scotch.io/
https://servicios.dgi.gub.uy/
https://sourcemaking.com/
https://stackedit.io/editor
https://stripe.com/be
https://toolbelt.heroku.com/
https://training.github.com/
https://vimeo.com/54505525
https://vimeo.com/tag:drew+neil
https://web.whatsapp.com/
https://www.ctan.org/
https://www.eff.org/
https://www.mybeluga.com/
https://www.solveforx.com/
https://www.symynd.com/
https://www.symynd.com/#
https://www.tizen.org/
http://workforall.net/CDS-Credit-default-Swaps.html#Credit_Default_Swaps_CDS
Run Code Online (Sandbox Code Playgroud)

尝试仅提取域名.例如:

linksyssmartwifi.com
amazon.com
github.com
Run Code Online (Sandbox Code Playgroud)

我曾尝试使用Perl和Vim,但无法完成任务.我的最佳近似值如下

 perl -pe 's!(^https?\://.*[\.](.+\..+?)/.*$)!$1 -- [$2] !g' all_urls_sorted.txt
Run Code Online (Sandbox Code Playgroud)

其中一些被正确解析(见[]),其他不是:

   https://sites.google.com/site/steveyegge2/singleton-considered-stupid -- [google.com] 
https://sourcemaking.com/
https://stackedit.io/editor
https://stripe.com/be
https://toolbelt.heroku.com/ -- [heroku.com] 
https://training.github.com/ -- [github.com] 
https://vimeo.com/54505525
https://vimeo.com/tag:drew+neil
https://web.whatsapp.com/ -- [whatsapp.com] 
https://wiki.haskell.org/GHC -- [haskell.org] 
Run Code Online (Sandbox Code Playgroud)

正如我的测试显示的那样,直接从//(以https?://开头)的URL被排除在外.

如果你知道如何解决这个问题,我会非常高兴.

谢谢

regex url perl

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

标签 统计

ncurses ×1

perl ×1

pytest-django ×1

regex ×1

selenium ×1

url ×1