- 博客(181)
- 资源 (11)
- 收藏
- 关注

翻译 Why use @classmethod?
Posted on Jul 20, 2017 by doesitmatterWhy use @classmethod?本文从一个网站转载,做了适应 优快云 blog 的排版。原文点击标题
2018-12-03 20:26:22
211
原创 【Python】(Essential decorator) 类级装饰器相关行为(暂时找不到合适的词描述)
code snippet"""filename: try-decorator.py"""class AsyncClient: def event(self, fn): def wrapper(self, *args, **kwargs): return fn(self, *args, **kwargs) return wrapperclass Handler: sio = AsyncClient() @sio.ev
2021-09-29 17:16:17
251
原创 【Python】(Essential Marshmallow) Marshmallow Nested post_load behaviour
Essential Marshmallow - Nested post_load behaviournested_and_load.py:from typing import Anyfrom marshmallow import Schemafrom marshmallow import fieldsfrom marshmallow import post_loaddef evlove(val, type_): if type_ == 'int': return i
2021-09-05 14:33:46
310
转载 【Python】Python’s super() considered super!
Deep Thoughts by Raymond HettingerRuminations on Computers, Programming and Life原文链接 ????Overview@[toc](Overview)Search OrderPractical AdviceHow to Incorporate a Non-cooperative ClassComplete Example – Just for FunNotes and ReferencesAcknowledgements
2021-07-01 17:14:53
465
翻译 【Python】使用混合类(Mixin)多重继承反直觉的一面与正确的使用方式
原标题:Mixins and Python原文链接 ????OverviewPython 支持一种简单类型的多重继承,它允许创建 Mixins。Mixins 是一种类,用于将额外的属性和方法“混合(mix in)”到一个类中。这允许您以组合风格创建类。Mixins 是一个非常棒的概念,但我经常发现人们错误地使用它们会导致一些错误。我经常看到像下面这样使用 Mixin:class Mixin1(object): def test(self): print "Mix
2021-06-30 11:18:39
1083
原创 【Python】使用 pandas 的 `groupby` + `collections.Count` 统计(TopK)词频
前几天 review 一份 统计词频 的代码,提了一些优化建议,觉得对写 Python 经验还比较少的同学应该有帮助,所以这边记录一下。Overview提交的代码最终结果Reference提交的代码def word_frequency(data, top): """ 生成top20词频词语 """ if data is None or data.empty: return None # ...some code... # 统计词频 df_res = .
2021-06-21 10:36:53
727
翻译 Streaming MapReduce — Ray v2.0.0.dev0 - What is Ray?
⚠️ [Ray Summit 2021 | June 22-24 | Virtual & Free]Join the global Ray community at Ray Summit 2021 to learn about new Ray features and hear how users are scaling machine learning applications with Ray!Streaming MapReduce¶This document walks throu.
2021-06-06 17:28:42
333
原创 【Python】concurrency best practice for HTTP (RESTful) API - 草稿 10%
【Python】concurrency best practice-- for HTTP (RESTful) APIOverview【Python】concurrency best practiceconcurrent.furture.ThreadPoolExecutordie threadreusable code - mapUsage Examples - N/AReferenceconcurrent.furture.ThreadPoolExecutorN/Adie threaddeta
2021-05-14 10:57:54
136
原创 使用 docker/docker-compose 将《流畅的Python》(fluent python) CH17-futures > countries > flags 部署在本地服务器
使用 docker/docker-compose 将《流畅的Python》的 flags 图片部署在本地服务器Overview使用 docker/docker-compose 将《流畅的Python》的 flags 图片部署在本地服务器问题 问题《流畅的 Python》 一书的第 17...
2021-02-03 14:51:45
297
原创 【Python】了解 Python 多重继承 -- MRO
Overivew查看 Python 类的继承体系多重继承jReference查看 Python 类的继承体系查看 datetime.date 的继承体系>>> import datetime>>> datetime.date.__mro__Out:(datetime.date, object)查看 datetime.datetime 的继承体系>>> datetime.datetime.__mro__Out:(datet
2021-02-01 12:19:32
161
原创 【pandas】解决怎么对 pandas.DataFrame UPSERT(update & insert) 另一个 DataFrame 问题
Overview问题Solution两种 Solution解释两种 Solution 的不同之处完整的 solutionReference问题你想要对用一个 pandas.DataFrame 数据,对原来的一个 pandas.DataFrame 进行 UPSERT 更新,I am looking for an elegant way to append all the rows from one DataFrame to another DataFrame (both DataFrames hav
2020-12-24 13:48:14
1529
原创 【Python】One-Liner 一行Python代码解决实际问题
这篇博客不定期更新,一些可以通过一行代码解决实际问题的案例。Overviewdate 转 datetimeReferencedate 转 datetime注:>>> from datetime import date>>> from datetime import datetime普通的写法:>>> date_ = date.today() # line (1)>>> date_datetime.date
2020-11-26 18:52:57
419
原创 【Python】(Pdb) breakpoint 调试
Overviewpython pdb使用总结ReferencePython pdb调试Reference ???? python_pdb断点调试常用命令在需要断点调试的地方,加上:import pdb;pdb.set_trace() (Python 3.7+) breckpoint()h:打印当前版本pdb可用的命令,如果需要查询某个命令,可以输入 h [command]l:列出当前将要运行的代码块n:让程序运行下一行,如果当前语句有一个函数调用,用’n’是不会进入被调用的函数体中的s
2020-11-23 16:16:58
1304
原创 【Python】(requests-mock)(pytest)requests-mock 在 pytest 中的使用与细节
Overview基本使用有无 params 区别Reference基本使用import pytestimport requestsdef test_requests_mock(requests_mock): requests_mock.get('http://demo.com', text='data') assert requests.get('http://demo.com').text == 'data'https://requests-mock.readthe
2020-11-02 15:27:53
1114
原创 【PostgreSQL】postgresql 快速上手(适合已有SQL 基础工程师查看)-- 完成度:0%
OverviewPostgreSQL 内部命令创建数据库用户创建数据库数据库用户权限PostgreSQL 命令行命令PostgreSQL 的 SQL 语句ReferencePostgreSQL 内部命令\h:查看SQL命令的解释,比如 \h select。\?:查看psql命令列表。\l:列出所有数据库。\c: [database_name]:连接其他数据库。\d:列出当前数据库的所有表格。\d [table_name]:列出某一张表格的结构。\du:列出所有用户。\e:打开文本编辑器
2020-09-17 12:03:26
517
原创 【Leetcode】54. Spiral Matrix -- 我想到了逆时针动 matrix 而不动指针,我知道 zip 可以转置矩阵,但是我却没有写出 one-liner
我想到了逆时针动 matrix 而不动指针,我知道 zip 可以转置矩阵,但是我却没有写出 one-liner ????Overviewleetcode#54. Spiral MatrixOne-Liner简化逆时针旋转辅助函数递归简化one-linerReferenceleetcode#54. Spiral Matrix【描述】:Given a matrix of m x n elements (m rows, n columns), return all elements of the mat
2020-08-15 13:18:45
249
原创 【Leetcode】单调栈问题--739.DailyTemperatures;769.MaxChunksToMakeSorted;84.LargestRectangleinHistogram;85
Desc: n/aOverview单调栈《程序员代码面试指南》CH1-栈与队列 -- 单调栈结构Leetcode#739. Daily TemperaturesLeetcode#769. Max Chunks To Make SortedLeetcode#?. Max Chunks To Make Sorted IILeetcode#84. Largest Rectangle in HistogramLeetcode#85. Maximal Rectangle相关数据结构与算法Reference单调栈
2020-08-10 20:10:19
219
原创 【Leetcode】997. Find the Town Judge(找到小镇法官) - 社会名流问题
Desc: N/AOverview社会名流问题997. Find the Town JudgeReference社会名流问题接下来的这个例子是算法设计中的一个常见习题,这是一个不需要扫描所有数据(或者绝大部分)就能得到解答的很好例子。在n个人中,有一个被所有人知道但却不知道别人的人,这个人被定义为社会名流。现在的问题是如果存在,试找出社会名流。你可以使用的唯一方式是询问:“对不起,请问你知道某某人吗?”(假定所有回答都正确,甚至这位社会名流也将回答。)我们的目标是将问题的数目最小化。由于有 n(
2020-08-06 23:08:39
519
原创 【Leetcode】二进制解法题目整理(包括与、或、XOR逻辑运算) - 更新中
Overview注:草稿,题目细节内容待更新。1342. Number of Steps to Reduce a Number to Zero1356. Sort Integers by The Number of 1 Bits1374. Generate a String With Characters That Have Odd Counts注:草稿,题目细节内容待更新。1342. Number of Steps to Reduce a Number to Zero2020/07/22Giv
2020-07-27 14:38:38
671
原创 【Leetcode】可以一行(One-Liner)Python代码解决的 Leetcode 问题 - 掌握 Python 高阶函数
Overview高阶函数reduce1281. Subtract the Product and Sum of Digits of an Integerreduce 的典型用法自己实现 `sum` 功能的函数使用匿名函数 lambda 实现阶乘 N!N!N!1486. XOR Operation in an Array反转字符串sorted1356. Sort Integers by The Number of 1 Bitsall844. Backspace String Compareany - N/Af
2020-07-23 10:59:47
788
原创 【Leetcode】二叉树问题整理笔记 之 遍历取值变体问题
Overview二叉树定义897. Increasing Order Search Tree - 增序二叉搜索树二叉树定义# Definition for a binary tree node.class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right897. Inc
2020-07-12 15:31:29
222
原创 【Python】反转字符串的很多很多种方法及部分解算法题应用
Desc: n/aOverview1. 反转字符串1.1 切片法1.2 reverse 函数1.3 高阶函数 reduce1.4 递归1.5 堆栈1.6 语言特性无关的 for 循环1.7 列表推导表达式2. 解题应用2.1 判断回文字符串2.2 反转字符串中的单词(word)Reference1. 反转字符串1.1 切片法def reverse_string1(s: str) -> str: return s[::-1]1.2 reverse 函数a.def reverse
2020-06-11 16:40:13
285
原创 【分布式爬虫】scrapy_redis enhance - 支持配置使用redis-server上不同的数据库
Desc: scrapy_redis1 默认(仓库)只支持 redis server 上的 db=0 数据库,对此做 enhanceOverview前言EnhanceUsage安装 enhance 后的代码在 scrapy 项目中使用Reference - N/A前言scrapy_redis1 默认(仓库)只支持 redis server 上的 db=0 数据库2,对此做 enhance...
2020-04-30 10:00:56
560
原创 【docker】阿里云镜像加速
desc: n/aOverview1. 安装 docker2. 镜像加速2.1 注册账号2.2 进入镜像加速页面2.3 (服务器)主机配置加速Reference - N/A1. 安装 dockerDocker CE 镜像源站2. 镜像加速2.1 注册账号搜索入口然后注册。2.2 进入镜像加速页面2.3 (服务器)主机配置加速Reference - N/An/a...
2020-04-24 21:31:11
359
原创 【SQLAlchemy】SQLAlchemy合集
OverviewORM 入门 - N/ASQLAlchemy 基本使用 - N/A常见问题MySQL 数据库UnicodeEncodeError 'latin-1'Reference - N/AORM 入门 - N/ASQLAlchemy 基本使用 - N/A常见问题MySQL 数据库UnicodeEncodeError ‘latin-1’issue:UnicodeEncod...
2020-04-24 11:59:29
196
原创 【Docker】【MySQL】(Ubuntu) Access denied for user '<user>'@'172.17.0.1'(using password: YES)
Overview问题:环境说明SolutionReference - N/A问题:使用 $ mysql 或 mysql-workbench 或 navicat15 连接本机的 docker-mysql 出现如下错误:Access denied for user '<user>'@'172.17.0.1'(using password: YES)外部图片连接备份:http...
2020-04-24 09:21:34
4376
原创 【程序设计】【Python】面向方面编程(Aspect-oriented programming)- 注:未完成
desc: n/aOverviewFinish MEReferencehttps://en.wikipedia.org/wiki/Cross-cutting_concern????https://en.wanweibaike.com/wiki-Cross-cutting%20concernFinish MEReferenceN/A
2020-04-21 11:07:59
268
原创 【程序设计】【python】dispatch - 注:未完成
desc: n/aOverviewTemplate method patternExampleDjango Dispatch in ViewDispatch in ScrapyReferenceTemplate method patternhttps://en.wikipedia.org/wiki/Template_method_pattern????https://en.wanweiba...
2020-04-21 11:04:21
724
原创 scrapy loop until universe collapses 程序设计
OverviewScrapy 整体架构loop until universe collapsesReferenceScrapy 整体架构图片外链地址备份:https://i.loli.net/2020/04/17/xjmnhgAU9akrQZ7.pngloop until universe collapsesReference《Learning Scrapy》 - 知识点:...
2020-04-19 13:41:26
391
1
原创 使用 selenium 定点自动播放昨晚 17 点的《新闻联播》
selenium; flash player; python使用 selenium 自动播放昨晚 17 点的《新闻联播》???? GitHub: play-on-clock/cctv13_newOverview源码说明Reference - N/A源码 细节待补充。说明2020/04/03上面的源码内只实现了自动播放(包括在 chrome 中 enable flash ...
2020-04-03 09:54:22
1068
转载 memtester4.3.0 方法与 ARM A53 移植
Overview前言详解函数memtester-4.3.0 版本方法test_stuck_address目的(原理)时间花销ARM A53移植版本方法test_random_value目的(原理)时间花销ARM A53移植版本方法test_walkbits1_comparison/test_walkbits0_comparison目的(原理)时间花销ARM A53移植版本方法test_seqinc...
2020-03-31 16:32:37
1897
转载 不用工具直接从微软官网下载Win10正式版ISO镜像的技巧
转自 https://editor.youkuaiyun.com/md?articleId=105160780发表于2018年12月25日 23:21:24由MS酋长我们在重装Win10系统时需要用到ISO镜像,并且微软官网也有专门的“下载 Windows 10”页面,但问题是,你打开该页面后会发现,微软并没有直接提供Win10 ISO镜像下载,而是提供了《微软Windows10易升》和《Media ...
2020-03-28 14:28:04
5873
2
转载 2019 年 12 个最好的桌面软件自动化测试工具(注:原文未翻译)
???? 12 Best Automation Tools for Testing Desktop Apps in 2019This post is frequently updated. Last updated: 14 Jun, 2019Although the demand for desktop app testing is not growing as fast as mobile an...
2020-03-27 10:09:34
3704
原创 【嵌入式LINUX】mount mtd part with ubi filesystem for test write/read of Flash
使用 ubi 文件系统挂载 mtd 分区用于做 Flash 的读写测试Overviewubifs挂载命令测试 Flash 脚本示例以 jffs2 文件系统挂载问题提示擦除块相关错误的Referenceubifs挂载命令$ flash_eraseall /dev/mtd8 # 也可能你的命令是 `flash_erase /dev/mtd8`$ ubiattach /dev/u...
2020-03-20 10:06:38
895
原创 【实用工具】(Linux)(htop)htop 的安装与使用
Overview安装使用 APT 安装无 root 权限安装使用 - N/A安装使用 APT 安装$ sudo apt install htop无 root 权限安装$ git clone --depth=1 https://github.com/hishamhm/htop.git$ cd htop$ ./autogen.sh && ./configure --...
2020-03-18 17:26:23
620
原创 【Leetcode】#Easy# 双指针解决数组问题
Overview674. Longest Continuous Increasing Subsequence830. Positions of Large GroupsReference674. Longest Continuous Increasing Subsequencesolved at 2019.12.25Given an unsorted array of integers, ...
2019-12-25 17:17:43
314
原创 【LINUX】Effective Ubuntu
Overview1. Chrome/Chromium1.1 代码字体渲染问题1.2 鼠标滚轮滑动问题2. Typora2.1 字体渲染问题Reference自从真正地将 Ubuntu 系统作为主机工作机之后,确实感受到了和 Windows 的细节上的差距。不过没有什么是解决不了的,如果有 —— 那一定是因为不知道怎么解决 ????1. Chrome/Chromium浏览器是电脑使用中最重要...
2019-11-06 19:03:46
271
原创 编写 Albert 翻译插件之选中拷贝到粘贴板
Overview实现选中(Enter)复制到粘贴板ClipActionReference - n/a这一篇接着上篇:编写 Albert 翻译插件之功能升级 实现选中翻译结果拷贝到粘贴板!实现选中(Enter)复制到粘贴板代码已经更新到 github 上: 只需要使用 ClipAction 即可:--- youdao-fanyi/youdao_translate.p...
2019-11-06 11:51:38
302
SQLAlchemy Tutorial
2019-05-05
百度翻译API-Python3-demo
2019-03-15
CustomizedPack.tar.xz
2019-01-30
Typora--Windows版64位
2017-12-02
《linux/UNIX系统编程手册》书上daemon章节测试实例代码(及简化)
2017-08-29
Linux防火墙
2017-07-12
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人