- 先 Fork 感兴趣项目,即
dmlc/gluon-cv
- Clone 到本地,
git clone [email protected]:YimianDai/gluon-cv.git
- 添加源项目
dmlc/gluon-cv
作为upstream
源,git remote add upstream https://github.com/dmlc/gluon-cv.git
- 禁止直接向
upstream
源 push,因为我们不是 dmlc 的人,没有 push 的权限,要提交代码必须通过 Pull Request,git remote set-url --push upstream no_push
- 创建并切换到本地的新分支
fixMixSoftmaxCrossEntropyLoss
,git checkout -b fixMixSoftmaxCrossEntropyLoss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.parse | |
send_message_url = urllib.parse.urljoin(configs.remote.union.private_apis.msg_service.url, 'message/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect, re | |
def varname(p): | |
for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]: | |
m = re.search(r'\bvarname\s*\(\s*([A-Za-z_][A-Za-z0-9_]*)\s*\)', line) | |
if m: | |
return m.group(1) | |
if __name__ == '__main__': | |
spam = 42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
可以从类型使用 GeneratorType: | |
>>> import types | |
>>> types.GeneratorType | |
<class 'generator'> | |
>>> gen = (i for i in range(10)) | |
>>> isinstance(gen, types.GeneratorType) | |
True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
import base64 | |
import rsa | |
from Crypto.Cipher import AES | |
from Crypto.PublicKey import RSA | |
from pyDes import des, CBC, PAD_PKCS5 | |
from Crypto.Cipher import DES3 | |
import hashlib | |
import hmac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 增加一个字段 | |
ALTER TABLE people ADD COLUMN name VARCHAR(100) DEFAULT NULL COMMENT '姓名' | |
# 增加多个字段 | |
alter table test add (c1 char(1),c2 char(1)); --正确,add支持多列 | |
alter table test add column (c1 char(1),c2 char(1)); --正确 | |
alter table test add c1 char(1),add c2 char(1); --正确 | |
--修改多列 | |
alter table test change c1 c3 char(1),change c2 c4 char(1); --正确 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 在 PEP448 中,有个新的语法可以实现,并且在 python3.5 中支持了该语法,合并代码如下 | |
z = {**x, **y} | |
# 如果您还没有使用 Python 3.5,或者需要编写向后兼容的代码,并且您希望在单个表达式中运行,则最有效的方法是将其放在一个函数中 | |
def merge_two_dicts(x, y): | |
"""Given two dicts, merge them into a new dict as a shallow copy.""" | |
z = x.copy() | |
z.update(y) |
NewerOlder