当前位置: 首页 > news >正文

廉江市住房和城乡建设局网站多语言网站系统

廉江市住房和城乡建设局网站,多语言网站系统,2021年免费的网站有哪些,做网站用什么字体最明显概述 对于程序员来讲#xff0c;成为顶级开源项目的贡献者是一件有意义的事#xff0c;当然#xff0c;这也绝非易事。如果你正从事人工智能有关的工作#xff0c;那么你一定了解诸如Google Tensorflow#xff0c;Facebook Pytorch这样的开源项目。下面我们就说一说如何成…概述 对于程序员来讲成为顶级开源项目的贡献者是一件有意义的事当然这也绝非易事。如果你正从事人工智能有关的工作那么你一定了解诸如Google TensorflowFacebook Pytorch这样的开源项目。下面我们就说一说如何成为这些顶级的开源项目的Contributor。 准备 1.首先你必须成为github的使用者并已经熟悉了github上托管代码的基本逻辑。 2.对于顶级的开源项目一般需要你去签署一份Contributor License Agreement(简称CLA)例如Tensorflow项目个人签署TF individual CLA公司签署TF corporate CLAPytorch中的部分项目则需要签署Facebook CLA这样你的代码才允许被接收。 3.让你编写的代码风格更规范一般的开源项目都要求为Google Python Style即使是Pytorch都是遵循该规范更不要说Google自家的Tensorflow了。 4.你贡献的代码往往由类或者函数构成(文档贡献除外)因此你需要单元测试程序它和代码注释一样是代码共享过程中必不可少的一部分。没有它即使你的代码正确无误也不会被merge最终还是会被要求提供单元测试脚本。 5.很多开源项目要求你的每个py脚本都要以许可证书开头比如Tensorflow这是它的python许可证书示例: Python license example当然这很简单。 # Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an AS IS BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # 工具 接下来我们将介绍相关工具的使用它能够有效的帮助我们来完成贡献前的准备工作比如代码规范和单元测试等。 代码规范工具 为了满足代码满足Google Style的要求我们首先需要一个代码规范检测工具这里我们使用官方推荐的pylint。 安装: pip install pylint使用: # 使用pylint检测脚本代码默认将按照PEP8标准 # 这里我们需要指定配置文件即按照Google Style标准 # myfile.py代表你写好的python脚本文件 pylint --rcfilepylintrc myfile.pypylintrc内容请参照: pylintrc 又因为我们初始写的代码往往随意性过强可能直接用pylint需要修改的地方太多可能对你幼小的心灵造成重创因此这里也带来很多开源项目推荐的另外一款工具black它能够直接帮你修改代码中出现的基本问题(仍然存在很多问题无法被判定需要使用pylint检测)。 安装: pip install black使用: # 这里的-l代表代码的每行最大长度 # 默认是88但是Google Style要求为80 # 因此这里指定为80 black myfile.py -l 80代码样式示例: def my_op(tensor_in, other_tensor_in, my_param, other_param0.5,output_collections(), nameNone):My operation that adds two tensors with given coefficients.Args:tensor_in: Tensor, input tensor.other_tensor_in: Tensor, same shape as tensor_in, other input tensor.my_param: float, coefficient for tensor_in.other_param: float, coefficient for other_tensor_in.output_collections: tuple of strings, name of the collection tocollect result of this op.name: string, name of the operation.Returns:Tensor of same shape as tensor_in, sum of input values with coefficients.Example: my_op([1., 2.], [3., 4.], my_param0.5, other_param0.6,output_collections[MY_OPS], nameadd_t1t2)[2.3, 3.4]with tf.name_scope(name or my_op):tensor_in tf.convert_to_tensor(tensor_in)other_tensor_in tf.convert_to_tensor(other_tensor_in)result my_param * tensor_in other_param * other_tensor_intf.add_to_collection(output_collections, result)return result output my_op(t1, t2, my_param0.5, other_param0.6,output_collections[MY_OPS], nameadd_t1t2)单元测试工具 ·单元测试对于团队开发十分重要是检验代码质量的重要依据因此你的每一份完整的代码都要配备单元测试脚本。这里我们使用python主流的单元测试工具unittest。 · 安装: pip install unittest使用: 这里只去演示核心的使用方法更具体的内容请参照unittest文档 # 导入unittest工具包 import unittest# 我们首先要建立一个测试类它将包含你所有需要进行测试的函数 # 这个类不使用__init__(self)但可以使用setUp(self)来定义公有部分 # 它需要继承unittest.TestCase, 类名往往也建议以Test开头 class TestStringMethods(unittest.TestCase):# 类的里面依次是你需要进行测试的函数# 这些函数建议以test_开头# 这些函数一般情况不设置参数而是直接在函数中具体化需要的参数# 当然你也可以设置原始的参数然后在外部具体化参数并调用该函数# 在测试函数中必须存在assert...来断定测试结果# 常用的assert...包括: assertEqual, assertTrue, assertFalse,# assertRaises, assertIn, assertNotIn, assertIs, assertIsNot...def test_upper(self,):# 使用assertEqual判断两个字符串是否相等self.assertEqual(foo.upper(), FOO,)def test_isupper(self,):# 使用assertTrue/False断定条件为真/假self.assertTrue(FOO.isupper())self.assertFalse(Foo.isupper())def test_split(self,):# 设定任意输入s hello world# 使用assertIn断定列表包含关系self.assertIn(s.split(), [[hello, world]],)# 注意这里with self.assertRaises来断定异常with self.assertRaises(TypeError):s.split(asd)# 这里是主函数如果使用python运行该脚本测试则必须存在 # 如果使用pytest(后面会介绍)则可以省略 if __name__ __main__:# 使用unittest.main运行所有继承unittest.TestCase的类unittest.main()装饰器的使用: unittest最常使用方法之一就是类/函数的装饰器。 # 对于一些特殊需要强制跳过的测试的类/函数使用下方装饰器但你必须说明原因 # unittest.skip(长得太帅不需要测试给我跳过)# 如果条件为真则该测试被强制跳过。比如检测GPU是否可用 # unittest.skipIf(TEST_CUDA, CUDA available)# 除非条件为真否则该测试被强制跳过。比如: 检测某些依赖包是否安装 # unittest.skipUnless(has_unittest, unittest dependencies are not installed)# 函数异常测试的表达方式函数出现异常则测试通过比之前说的内部异常粒度更大 # unittest.expectedFailureimport torch try:import unittest except ImportError:has_unittest False else:has_unittest Trueif torch.cuda.is_available():TEST_CUDA True else:TEST_CUDA False# 条件为真不跳过 unittest.skipUnless(has_unittest, unittest dependencies are not installed) # 条件为真跳过条件为假不跳过 unittest.skipIf(TEST_CUDA, CUDA available) class TestStringMethods(unittest.TestCase):def test_upper(self,):self.assertEqual(foo.upper(), FOO,)unittest.skip(长得太帅不需要测试给我跳过)def test_isupper(self,):self.assertTrue(FOO.isupper())self.assertFalse(Foo.isupper())unittest.expectedFailuredef test_split(self,):s hello worldself.assertIn(s.split(), [[hello, world]],)# 这里预计抛出异常但实际没有异常本质上这也算一种异常# 可以使用unittest.expectedFailurewith self.assertRaises(TypeError):s.split(ZMZ)if __name__ __main__:unittest.main()运行你的测试脚本: # 建议使用pytest执行测试脚本你的python中往往自带这个工具包 # 这时你不必写下主函数并且他的输出形式更美观 pytest test_myfile.py输出效果: test session starts platform linux -- Python 3.7.3, pytest-5.0.1, py-1.8.0, pluggy-0.12.0 rootdir: /root plugins: remotedata-0.3.1, celery-4.3.0, doctestplus-0.3.0, arraydiff-0.3, openfiles-0.3.2 collected 3 itemstest_myfile.py sx. [100%] 1 passed, 1 skipped, 1 xfailed in 0.34 seconds 真实单元测试脚本请参考Pytorch Tests和Tensorflow Tests 过程 在准备成为贡献者之前要确保你已经能够熟练使用该项目。进而明确你要贡献源码的类型是Fix Bug还是Implement New Feature(实现新特性)。当然对一个新手贡献者来讲Fix Bug是你的不二选择。除非你已经通过自己的实践明确了要做贡献的具体内容否则建议你需要遵循以下步骤: 第一步 从开源项目的Github Issues中寻找open的问题这里是Tensorflow Issues, Pytorch Issues仔细阅读大家提出的问题这将帮你在寻找问题上节约大量时间同时你可以在讨论区看到有关技术的讨论或已经提交的PR进一步明确自己是否应该参与该问题的解决。(有很多开源项目的issue会带有contributions welcome的标签可以优先看一看。) 第二步 当你明确了自己要解决的问题在正式写代码之前你需要fork这个开源项目到你自己的Github仓库然后再将该仓库clone到自己指定的服务器上这样最后你才可以提交PR。 # 例如: git clone https://github.com/AITutorials/tensorflow.git到这里你可以通过git remote -v发现我们只与自己远程仓库进行了连接(origin/master)。 此时我们还需要与开源项目的远程仓库建立连接(upstream/master) # 以tensorflow为例建立连接 git remote add upstream https://github.com/tensorflow/tensorflow.git# 查看到upstream git remote -v然后你就需要建立一个自己的分支当然你可以先查看一下远程的分支情况 # 查看远程分支 git branch -a# 创建自己的远程分支cnsync git checkout -b cnsync第三步 通过第二步你已经拿到了项目的源码并创建了自己分支这时就要开始你的表演coding review你之前准备的代码规范工具和单元测试工具将派上用场。 第四步 提交代码你的代码并在github中创建一个PR。 # 把内容添加到暂存区 git add .# 提交更改的内容 git commit -m 添加你的改变说明# push到自己的远程仓库 git push origin cnsync注意这里虽然你只push到了自己的远程仓库但其实你的远程仓库和源项目的仓库是连接的。也就是说此时你可以通过操作自己的远程仓库决定是否将创建一个源项目的PR(这些过程可以在你刚刚fork的项目页面中实现包括填写PR的title和comment有时你也需要在title中添加一个标记如[Draft]/[WIP]/[RFR]等等)。 第五步: 耐心的等待如果你是PR是一个Ready For Review的状态它将很快进入自动化测试的流程以及评委会的介入不久后你将收到一些反馈你的代码方案可能被采纳可能需要更多的修改或测试。
文章转载自:
http://www.morning.bpmtj.cn.gov.cn.bpmtj.cn
http://www.morning.mgnrc.cn.gov.cn.mgnrc.cn
http://www.morning.xgzwj.cn.gov.cn.xgzwj.cn
http://www.morning.rdymd.cn.gov.cn.rdymd.cn
http://www.morning.pfgln.cn.gov.cn.pfgln.cn
http://www.morning.pcngq.cn.gov.cn.pcngq.cn
http://www.morning.rwfj.cn.gov.cn.rwfj.cn
http://www.morning.jhxdj.cn.gov.cn.jhxdj.cn
http://www.morning.xjqkh.cn.gov.cn.xjqkh.cn
http://www.morning.kjsft.cn.gov.cn.kjsft.cn
http://www.morning.jnhhc.cn.gov.cn.jnhhc.cn
http://www.morning.frtb.cn.gov.cn.frtb.cn
http://www.morning.ldsgm.cn.gov.cn.ldsgm.cn
http://www.morning.srmdr.cn.gov.cn.srmdr.cn
http://www.morning.jqbmj.cn.gov.cn.jqbmj.cn
http://www.morning.rkzb.cn.gov.cn.rkzb.cn
http://www.morning.rjmg.cn.gov.cn.rjmg.cn
http://www.morning.nj-ruike.cn.gov.cn.nj-ruike.cn
http://www.morning.cpfbg.cn.gov.cn.cpfbg.cn
http://www.morning.qgxnw.cn.gov.cn.qgxnw.cn
http://www.morning.wqpsf.cn.gov.cn.wqpsf.cn
http://www.morning.fjgwg.cn.gov.cn.fjgwg.cn
http://www.morning.hpspr.com.gov.cn.hpspr.com
http://www.morning.mrttc.cn.gov.cn.mrttc.cn
http://www.morning.pnbls.cn.gov.cn.pnbls.cn
http://www.morning.mxxsq.cn.gov.cn.mxxsq.cn
http://www.morning.mwzt.cn.gov.cn.mwzt.cn
http://www.morning.jpydf.cn.gov.cn.jpydf.cn
http://www.morning.sjjq.cn.gov.cn.sjjq.cn
http://www.morning.rdxp.cn.gov.cn.rdxp.cn
http://www.morning.zrjzc.cn.gov.cn.zrjzc.cn
http://www.morning.tbkqs.cn.gov.cn.tbkqs.cn
http://www.morning.rbqlw.cn.gov.cn.rbqlw.cn
http://www.morning.lwcqh.cn.gov.cn.lwcqh.cn
http://www.morning.ggqcg.cn.gov.cn.ggqcg.cn
http://www.morning.rxhs.cn.gov.cn.rxhs.cn
http://www.morning.wnjwb.cn.gov.cn.wnjwb.cn
http://www.morning.jkfyt.cn.gov.cn.jkfyt.cn
http://www.morning.wjqyt.cn.gov.cn.wjqyt.cn
http://www.morning.rsqpc.cn.gov.cn.rsqpc.cn
http://www.morning.swkzr.cn.gov.cn.swkzr.cn
http://www.morning.xsszn.cn.gov.cn.xsszn.cn
http://www.morning.zmpsl.cn.gov.cn.zmpsl.cn
http://www.morning.mrncd.cn.gov.cn.mrncd.cn
http://www.morning.fndfn.cn.gov.cn.fndfn.cn
http://www.morning.pcwzb.cn.gov.cn.pcwzb.cn
http://www.morning.ljhnn.cn.gov.cn.ljhnn.cn
http://www.morning.rpth.cn.gov.cn.rpth.cn
http://www.morning.zmpsl.cn.gov.cn.zmpsl.cn
http://www.morning.wpspf.cn.gov.cn.wpspf.cn
http://www.morning.mstrb.cn.gov.cn.mstrb.cn
http://www.morning.gnlyq.cn.gov.cn.gnlyq.cn
http://www.morning.fhsgw.cn.gov.cn.fhsgw.cn
http://www.morning.npbnc.cn.gov.cn.npbnc.cn
http://www.morning.drmbh.cn.gov.cn.drmbh.cn
http://www.morning.whclz.cn.gov.cn.whclz.cn
http://www.morning.gediba.com.gov.cn.gediba.com
http://www.morning.bsghk.cn.gov.cn.bsghk.cn
http://www.morning.yrdt.cn.gov.cn.yrdt.cn
http://www.morning.jsmyw.cn.gov.cn.jsmyw.cn
http://www.morning.rnht.cn.gov.cn.rnht.cn
http://www.morning.0dirty.cn.gov.cn.0dirty.cn
http://www.morning.ddfp.cn.gov.cn.ddfp.cn
http://www.morning.dgmjm.cn.gov.cn.dgmjm.cn
http://www.morning.yksf.cn.gov.cn.yksf.cn
http://www.morning.dhrbj.cn.gov.cn.dhrbj.cn
http://www.morning.gktds.cn.gov.cn.gktds.cn
http://www.morning.lbbrw.cn.gov.cn.lbbrw.cn
http://www.morning.tsdjj.cn.gov.cn.tsdjj.cn
http://www.morning.cwqrj.cn.gov.cn.cwqrj.cn
http://www.morning.jjhng.cn.gov.cn.jjhng.cn
http://www.morning.bwjws.cn.gov.cn.bwjws.cn
http://www.morning.nfpkx.cn.gov.cn.nfpkx.cn
http://www.morning.zkqsc.cn.gov.cn.zkqsc.cn
http://www.morning.httzf.cn.gov.cn.httzf.cn
http://www.morning.ttnfc.cn.gov.cn.ttnfc.cn
http://www.morning.ybyln.cn.gov.cn.ybyln.cn
http://www.morning.lsssx.cn.gov.cn.lsssx.cn
http://www.morning.fcxt.cn.gov.cn.fcxt.cn
http://www.morning.fengnue.com.gov.cn.fengnue.com
http://www.tj-hxxt.cn/news/278231.html

相关文章:

  • 哈尔滨自助建站软件做视频广告在哪个网站能够赚钱
  • 课程介绍网站建设ppt模板有什么网站可以做微信支付
  • 网上有兼职做数据网站网站建设与营销经验
  • 微网站自助建站后台网站建设与管理找工作
  • 高性能网站开发wordpress生成tags页面
  • 网站首页做30个关键词重庆网站建设业务招聘
  • 手把手教你做网站7wordpress 网银支付宝
  • 购物网站开发需求文档互联网个人信用信息服务平台
  • 阿里云备案网站名称北京网站建设公司现状
  • 怎么做创意短视频网站做网站用什么软件语言
  • 南京网站设南京网站设计计哪里有好网站设计
  • 重庆建设网站哪家好wordpress主题免刷新
  • 网页设计链接怎么做免费seo视频教学
  • 惠州网站优化建设中超最新积分榜
  • 营销推广网站推广方案住宅设计网站推荐
  • 山西建设机械网站高校思政网站建设意义
  • 无锡建设执业资格注册中心网站呼和浩特网络公司
  • h5平台网站开发服装网站建设美丽
  • 做网站时怎么更改区域内的图片做政务网站
  • 网站排名推广全球十大it外包公司排名
  • 网站开发工程师薪资网站建设开发计入二级科目明细
  • 竞价推广怎么样巩义网站优化
  • 西宁知名网站制作公司做网站建设的前景
  • 永宝网站建设招聘信息讨债公司 做网站
  • 国内十大旅游网站排名分销平台软件
  • 企业网站后台管理企业建站公司案例
  • 开封网站建设公司排名免费推广平台
  • 徐州市 两学一做网站江苏太平洋建设集团官方网站
  • dede 网站打开自动加html网站后台管理系统使用方法
  • 毕业设计网站做几个页面如何查看一个网站的域名解析