Skip to content
View pyeden's full-sized avatar
🤒
Out sick
🤒
Out sick
  • 重庆赛力斯新能源汽车设计院
  • 中国.重庆

Block or report pyeden

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
pyeden/README.md

Hi,I'm Future Deng! 👋

Python全栈开发工程师

logo

  • 🔭 现在就职于 赛力斯重庆新能源设计院有限公司
  • 👋 岗位职责
    • 主导自动化测试平台研发
    • 主导设计自动化测试平台软件架构
    • 主导整车功能测试自动化测试方案开发
    • 主导ADS智能辅助驾驶自动化测试方案开发
  • 🌱 工作中常用技术栈
    • Python、Golang、c++
    • React、Vue、Angular
  • ⚡ 研究方向:
    • Python Web 服务器开发
    • Python 自动化测试开发
    • Python 大数据分析开发
    • Python NLP自然语言处理算法开发
    • Python 图像识别、检查算法开发

Follow Me

个人博客 Github

Show Code

from abc import ABC, abstractmethod

class Validator(ABC):
    """
    使用python描述器来验证名字是不是“future.deng”
    """

    def __set_name__(self, owner, name):
        self.private_name = '_' + name

    def __get__(self, obj, objtype=None):
        return getattr(obj, self.private_name)

    def __set__(self, obj, value):
        self.validate(value)
        setattr(obj, self.private_name, value)

    @abstractmethod
    def validate(self, value):
        pass


class ValidatorName(Validator):
    """
    使用类继承的方式实现validate方法
    """
    def __init__(self, is_validator_name=True):
        self.is_validator_name = is_validator_name

    def validate(self, value):
        if self.is_validator_name:
            if value != 'Future Deng':
                raise ValueError("Future Deng 的私人代码,必须传入'Future Deng' 才能被实例化")


class PythonWebEngineer:

    name = ValidatorName(is_validator_name=True)

    def __init__(self, name):
        self.name = name
        self.age = 28
        self.role = "Python Engineer"
        self.language_spoken = ["zh_CN", "en_US"]
        self.skill = ["Python", "React", "Golang"]


if __name__ == '__main__':
    me = PythonWebEngineer('Future Deng')
    me.name
    
# 输出结果
# Future Deng

#   me = PythonWebEngineer('Future Dengsss')
#   me.name

# 若是传入错误的值 'Future Dengsss'
"""
  File "/Users/futuredeng/opt/backendxh/dsz.py", line 161, in validate
    raise ValueError("Future Deng 的私人代码,必须传入'Future Deng' 才能被实例化")
ValueError: Future Deng 的私人代码,必须传入'Future Deng' 才能被实例化
"""

Pinned Loading

  1. FastAPI-demo FastAPI-demo Public

    Python3.7 + FastAPI + MySQL + Redis + Tortoise-orm + aerich 这是一个各种教程的集合体,持续踩坑中

    Python 235 66

  2. Airtest Airtest Public

    Forked from AirtestProject/Airtest

    UI Automation Framework for Games and Apps

    HTML 1

  3. django django Public

    Forked from django/django

    The Web framework for perfectionists with deadlines.

    Python 1

  4. frp frp Public

    Forked from fatedier/frp

    A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.

    Go 1

  5. funNLP funNLP Public

    Forked from fighting41love/funNLP

    中英文敏感词、语言检测、中外手机/电话归属地/运营商查询、名字推断性别、手机号抽取、身份证抽取、邮箱抽取、中日文人名库、中文缩写库、拆字词典、词汇情感值、停用词、反动词表、暴恐词表、繁简体转换、英文模拟中文发音、汪峰歌词生成器、职业名称词库、同义词库、反义词库、否定词库、汽车品牌词库、汽车零件词库、连续英文切割、各种中文词向量、公司名字大全、古诗词库、IT词库、财经词库、成语词库、地名词库、…

    Python 1

  6. gin gin Public

    Forked from gin-gonic/gin

    Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin.

    Go 1