从枚举类使用成员“值”和“等于”时,我从pylint收到以下错误:“代码”:“无成员”“消息”:““元组”的实例没有“值”成员”版本:pylint 2.3.1 astroid 2.2.5 Python 3.6.3
The code is executed as expected. I am just wondering if there might be something I am doing wrong (I am not a pro python programmer), or if there is a more "pythonic" way to achieve the same result:
from enum import Enum
class DefaultEnum(Enum):
def __new__(self,val,_name,_type):
obj = object.__new__(self)
obj._value_ = val
obj._publicName = _name
obj._type = _type
return obj
def __str__(self):
return self._publicName
def equals(self,_string):
return _string == str(self)
class GlobalEnum(DefaultEnum):
TRUE …Run Code Online (Sandbox Code Playgroud) 我已经设置了一个elasticsearch/kibana docker 配置,我想使用节点的@elastic/elasticsearch 客户端从docker 容器内部连接到elasticsearch。然而,连接“超时”。
该项目的灵感来自帕特里克·特里斯特:https ://blog.patricktriest.com/text-search-docker-elasticsearch/
不过,我做了一些修改,以便连接 kibana、使用更新的 ES 映像和新的 elasticsearch 节点客户端。
我正在使用以下 docker-compose 文件:
version: "3"
services:
api:
container_name: mp-backend
build: .
ports:
- "3000:3000"
- "9229:9229"
environment:
- NODE_ENV=local
- ES_HOST=elasticsearch
- PORT=3000
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.5.1
container_name: elasticsearch
environment:
- node.name=elasticsearch
- cluster.name=es-docker-cluster
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "http.cors.allow-origin=*"
- "http.cors.enabled=true"
- "http.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization"
- "http.cors.allow-credentials=true"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data01:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- elastic
kibana:
image: docker.elastic.co/kibana/kibana:7.5.1 …Run Code Online (Sandbox Code Playgroud)