Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
timeit.timeit 方法的装饰器?
我正在尝试编写一个简单的时间装饰器来测量函数所花费的时间 然而 下面的代码给出了我们的递归错误 它出什么问题了 import timeit def measure func def wrapper func name func name s
python
decorator
pythondecorators
timeit
如何在 React Redux 应用程序中使用装饰器?
我正在使用 React Redux 创建简单的应用程序 我想使用装饰器在我的组件中注入一些方法 我在其他项目中看到了类似的代码 import React Component from react import connect from re
javascript
ReactJS
ECMAScript6
decorator
redux
更改函数体内函数的属性?
我正在尝试创建一个函数来记录它被调用的次数 并且我希望信息保留在函数本身内部 我尝试创建一个包装器 如下所示 def keep count f f count 0 functools wraps f def wrapped f args k
python
function
python3x
decorator
如何创建装饰器以延迟初始化属性
我想创建一个像属性一样工作的装饰器 只是它仅调用装饰函数一次 并且在后续调用中始终返回第一次调用的结果 一个例子 def SomeClass object LazilyInitializedProperty def foo self pri
python
decorator
descriptor
lazyinitialization
Now.sh 构建中断的原因是:当前未启用对实验性语法“decorators-legacy”的支持
预期的 添加后decko 对装饰器的支持 以及添加对experimetalDecoractors in my tsconfig js并使用 babel plugin proposal decorators in 包 json My now
javascript
ReactJS
decorator
babeljs
Nextjs
如何创建一个能够包装实例、类和静态方法的Python类装饰器?
我想创建一个Python类装饰器 这将能够无缝包装类可能具有的所有方法类型 实例 类和静态 这是我现在的代码 其中破坏它的部分已注释 def wrapItUp method def wrapped args kwargs print Thi
python
Reflection
decorator
instrumentation
Ruby 中的装饰器(从 Python 迁移)
我今天从 Python 的角度学习 Ruby 我完全无法解决的一件事是装饰器的等效项 为了简化事情 我尝试复制一个简单的 Python 装饰器 usr bin env python import math def document f de
python
ruby
decorator
Python 动态装饰器 - 为什么有这么多换行?
所以我对 Python 装饰器还是有点陌生 我以前用过它们 但我从未制作过自己的装饰器 我正在阅读本教程 http www siafoo net article 68 run time tranformations 那个特定的段落 我似乎不
python
decorator
TypeScript 编译中的实验装饰器警告
我收到警告 对装饰器的实验性支持是一项在未来版本中可能会发生变化的功能 设置 experimentalDecorators 选项 以删除此警告 即使我的 tsconfig json 中的compilerOptions具有以下设置 emitD
typescript
decorator
VisualStudioCode
装饰者的奇怪之处
我想制作一个装饰器来捕获异常并充分记录它们 def logger foo try print foo except Exception as e print e logger def d return 2 2 if name main d
python
decorator
NestJs 中所有装饰器的 Eslint 错误“已定义但从未使用”警告
我正在为一个项目使用 NestJs 框架 今天发现EsLint发现了587个错误的问题 所有装饰器都会生成此错误 warning IsBoolean is defined but never used typescript eslint n
typescript
NESTJS
eslint
decorator
typescriptdecorator
如何使用 Reflection API 在 TypeScript 中获取数组项类型?
我在 TypeScript 中有以下小类 其中装饰了一些公共字段 class Company dataMember public name string dataMember public people Person class Perso
Arrays
Reflection
typescript
decorator
Python 装饰器有哪些常见用途? [关闭]
Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 虽然我喜欢将自己视为一名相当有能力的 Python 程序员 但我从未理解过的语言的一个方面是装饰器 我知道它们是什么 表面上 我读过 St
python
decorator
检查函数是否被调用为装饰器
在下面的最小示例中decorate被调用两次 第一次使用 decorate 第二个通过正常函数调用decorate bar def decorate func print func name return func decorate def
python
python3x
decorator
pythondecorators
GNU Makefiles 中是否有类似 python 装饰器的机制?
我发现自己在 Makefile 中声明 GNU make 目标是假的两种可能性之间有点左右为难 一是一次性宣布所有假货 PHONY targ1 targ2 targ3 targ1 targ2 targ3 其优点是 对我来说 更具可读性并且更
makefile
decorator
gnumake
如何将附加参数传递给 TypeScript 中的属性装饰器?
我有一个简单的类 它的属性有物业装饰师 https github com Microsoft TypeScript Handbook blob master pages Decorators md property decorators应用
typescript
decorator
如何通过flask.Blueprint.route装饰器传递类的自身?
我正在使用 Flask 和 Python 2 7 编写网站的后端 但遇到了一些问题 我喜欢使用类来封装我的函数 它使我的事情变得整洁并帮助我保持一切模块化 不过 我遇到的一个问题是 flask 用于路由的装饰器不保留 self 变量 我使用
python
decorator
Flask
Python @precondition / @postcondition 用于成员函数 - 如何?
我试图在类的成员函数返回的值上使用 postcondition 装饰器 如下所示 def out gt0 retval inval assert retval gt 0 Return value lt 0 class foo object
python
decorator
React-MobX 错误:“decorators”插件需要“decoratorsBeforeExport”选项,其值必须是布尔值
我收到以下错误 如果您从 Babylon Babel 6 迁移或想要使用旧的装饰器提案 则应该使用 decorators legacy 插件而不是 decorators 包 json babel plugin proposal decora
ReactJS
decorator
mobxreact
«
1
2
3
4
5
6
7
8
...10
»