test

Python学习week4

五迷三道 提交于 2020-02-08 22:50:14
装饰器:本质是函数,用来装饰其他的函数,为其它函数添加附加功能。 原则:不能改变被装饰函数的源代码和调用方式。 1、函数即‘变量’,定义一个函数相当于把函数体赋值给函数名,匿名函数相当于只有函数体没有函数名 def func1(): print('in the function') func2=func1 #和普通的整数赋值一样:a=2 b=a print(b) func2() 2、高阶函数 3、嵌套函数 装饰器=高阶函数+嵌套函数 高阶函数: 1、把一个函数名当作实参传递给另外一个函数;(在不修改被装饰函数源代码的情况下为其添加功能) 2、返回值中包含函数名。(不修改函数的调用方式) import time def bar(): time.sleep(2) print('in the bar') def timer(func): start_time=time.time() func() stop_time=time.time() print('the time of running is %s'%(stop_time-start_time)) timer(bar) 输出: in the bar the time of running is 2.0002079010009766 函数执行计时器 import time def bar(): time.sleep(2) print(

Nginx(2)---搭建一个静态web服务

北城以北 提交于 2020-02-08 21:56:52
1.配置文件语法及参数说明:nginx.conf worker_processes 1; #工作进程多少个 events { worker_connections 1024; #连接数 } http { include mime.types; default_type application/octet-stream; sendfile on; #资源从硬盘->内核态-应用态-网卡,开启之后:硬盘->内核态-网卡 keepalive_timeout 65; #长连接超时时间 #配置一个具体的站点server server { #端口 listen 8079; #域名 server_name www.bluedarkni.com; #站点资源根目录 server中配置则所有location共享 root /website/test; #站点资源位置 location / { index index.html; } location /error { #alias 别名,匹配location的资源路径使用alias的值作为根 alias /website/test; index error.html; } } } {}属于配置块,其他的是参数以及参数值,注意以;结尾。可以使用./nginx -t 查看配置文件语法是否正确 2.配置一个静态站点: 上诉配置文件中的http-

Bug:No module named 'pytest'

a 夏天 提交于 2020-02-08 18:35:13
在测试模型时遇到Bug:No module named ‘pytest’ 我的场景:pycharm下运行一个测试深度学习模型的python代码。我的代码名称为test_exp.py 出现bug的原因 :.py文件的开头出现了test这个单词。 之所以是强调开头,是因为我重新尝试了一下model_test的文件名,是可以通过运行的 注意是test这个整体,如果是testr,testpp等等都是不会报错的 直接使用test这个单词是不会出错的,这也是我觉得神奇的地方。也就是test.py是OK的。 解决办法: 把文件名开头的test换掉,或者放到后面去即可,或者直接改成test 具体原因 更深层的原因,为什么那么命名会出现这些问题呢,为啥pytest就冒出来了呢?我暂时也还不知道,等以后知道了再来记录吧 来源: CSDN 作者: qq_41936559 链接: https://blog.csdn.net/qq_41936559/article/details/104226013

Spring

青春壹個敷衍的年華 提交于 2020-02-08 16:59:53
Spring 一、概述: 以下概述内容拷自w3cschool Spring 是最受欢迎的企业级 Java 应用程序开发框架,数以百万的来自世界各地的开发人员使用 Spring 框架来创建性能好、易于测试、可重用的代码。 Spring 框架是一个开源的 Java 平台,它最初是由 Rod Johnson 编写的,并且于 2003 年 6 月首次在 Apache 2.0 许可下发布。 Spring 是轻量级的框架,其基础版本只有 2 MB 左右的大小。 Spring 框架的核心特性是可以用于开发任何 Java 应用程序,但是在 Java EE 平台上构建 web 应用程序是需要扩展的。 Spring 框架的目标是使 J2EE 开发变得更容易使用,通过启用基于 POJO 编程模型来促进良好的编程实践。 两大重点: 1.依赖注入(DI) Spring 最认同的技术是控制反转的依赖注入(DI)模式。控制反转(IoC)是一个通用的概念,它可以用许多不同的方式去表达,依赖注入仅仅是控制反转的一个具体的例子。 当编写一个复杂的 Java 应用程序时,应用程序类应该尽可能的独立于其他的 Java 类来增加这些类可重用可能性,当进行单元测试时,可以使它们独立于其他类进行测试。依赖注入(或者有时被称为配线)有助于将这些类粘合在一起,并且在同一时间让它们保持独立。 到底什么是依赖注入

test

被刻印的时光 ゝ 提交于 2020-02-08 14:11:42
test 来源: https://www.cnblogs.com/andotstudio/p/12283157.html

0208不断的发起冲锋

本小妞迷上赌 提交于 2020-02-08 12:33:43
简直要被自己笑死,竟然把函数写在了主函数里面就说为啥老报错,这里不能定义函数,有时候会有一些基本的东西没有注意到,要细心 这个小测试是为了试验 sort 本身内置函数 和 cmp比较有区别吗,事实证明,只要内部的 比较顺序一样,cmp和内置函数一样的 #include<iostream> #include<vector> #include<map> #include<algorithm> using namespace std; //函数定义一定要在主函数之外 bool cmp(const vector<int> &a,const vector<int> &b) { return a[1]>b[1]; } int main() { vector<vector<int>> test={{101,40,32},{31,43,5},{42,4,123}}; sort(test.begin(),test.end()); for(auto i:test) { cout<<"i[0]"<<i[0]<<"i[1]"<<i[1]<<"i[2]"<<i[2]<<endl; } sort(test.begin(),test.end(),[](const vector<int> &a,const vector<int> &b){return a[1]>b[1];}); for(auto i:test)

【小伟哥AI之路】Rasa之训练集与验证集评测指标及问题

会有一股神秘感。 提交于 2020-02-08 09:36:54
本文主题:Rasa之训练集与验证集评测指标 在刚刚接触nlp自然语言处理这块,调试中,想到需要有测试集进行协调对比。 自动拆分nlu数据为训练集和测试集 rasa data split nlu 测试集数据验证制定nlu模型进行测试 rasa test nlu -u train_test_split/test_data.md --model models/nlu-20180323-145833.tar.gz If you don’t want to create a separate test set, you can still estimate how well your model generalises using cross-validation. To do this, add the flag --cross-validation : 如果不想创建单独的测试集,仍然可以使用交叉验证来估计模型的泛化程度。--cross-validation 此过程不会生成模型,会直接输入结果 rasa test nlu -u data/nlu.md --config config.yml --cross-validation 扩展参数 -f 为层叠划分,系统默认为5层(怎么理解?每次把数据分成5份,为1/5测试集,依次作为测试推理5次,取结果) rasa test nlu -u data

ecshop操作数据库类

橙三吉。 提交于 2020-02-08 09:17:49
ECShop v2.7.2没有使用一些开源的数据库操作类,比如adodb或者PEAR,而是封装了自己的实现。这样做的好处是实现非常轻量,只有一个文件,27Kb,大大减小了分发包的文件大小。另外,当网站需要做memcached缓存时,也可以很方便的实现。当然,这样做的后果就是数据库的选择非常狭窄,无法实现其它的非MySQL数据库。 ECShop的数据操作类文件是includes/cls_mysql.php,类名是cls_mysql。该类主要提供了下面 一些比较有用的方法: getAll ($sql)和 getAllCached ($sql, $cached = 'FILEFIRST'):获取所有记录。 getRow ($sql, $limited = false)和 getRowCached ($sql, $cached = 'FILEFIRST'):获取单行记录。 getCol ($sqlse)和 getColCached ($sql, $cached = 'FILEFIRST'):获取某栏位的所有值。 getOne ($sql, $limited = false)和 getOneCached ($sql, $cached = 'FILEFIRST'):获取单个数值。 query ($sql):执行数据库查询。 autoExecute ($table, $field_values,

Kaggle | IEEE Fraud Detection(Data Processing and Simplest Model)

寵の児 提交于 2020-02-08 06:29:14
IEEE Fraud Detection - Data Processing and Simplest Model In this section we will do some data cleaning jobs, which is necessary before we build our models. We have seen the distributions of all kinds of features in the last passage, so now we can process the data with the knowledge we got from the visual charts. 1 Prepare the Data 1.1 Import and Merge the Data import pandas as pd import numpy as np import matplotlib . pyplot as plt import seaborn as sns import altair as alt import warnings import time warnings . filterwarnings ( 'ignore' ) PATH = 'E:/kaggle/ieee-fraud-detection/' tran_tr = pd

ipv4保留地址

青春壹個敷衍的年華 提交于 2020-02-08 05:39:04
曾经以为保留地址下面三类.原来使用中还有很多的. A类 10.0.0.0--10.255.255.255 B类 172.16.0.0--172.31.255.255 C类 192.168.0.0--192.168.255.255 Address Block Name RFC 0.0.0.0/8 "This host on this network" [RFC1122], section 3.2.1.3 10.0.0.0/8 Private-Use [RFC1918] 100.64.0.0/10 Shared Address Space [RFC6598] 127.0.0.0/8 Loopback [RFC1122], section 3.2.1.3 169.254.0.0/16 Link Local [RFC3927] 172.16.0.0/12 Private-Use [RFC1918] 192.0.0.0/24[2] IETF Protocol Assignments [RFC6890], section 2.1 192.0.0.0/29 IPv4 Service Continuity Prefix [RFC7335] 192.0.0.8/32 IPv4 dummy address [RFC7600] 192.0.0.9/32 Port Control Protocol