body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
56a0c97df9633746bffcd591ba27a59c87916a8652620a430570ff364dc0c92d
def get_loaded_plugins() -> Set[Plugin]: '\n :说明:\n\n 获取当前已导入的所有插件。\n\n :返回:\n\n - ``Set[Plugin]``\n ' return set(plugins.values())
:说明: 获取当前已导入的所有插件。 :返回: - ``Set[Plugin]``
nonebot/plugin/__init__.py
get_loaded_plugins
SK-415/nonebot2
1,757
python
def get_loaded_plugins() -> Set[Plugin]: '\n :说明:\n\n 获取当前已导入的所有插件。\n\n :返回:\n\n - ``Set[Plugin]``\n ' return set(plugins.values())
def get_loaded_plugins() -> Set[Plugin]: '\n :说明:\n\n 获取当前已导入的所有插件。\n\n :返回:\n\n - ``Set[Plugin]``\n ' return set(plugins.values())<|docstring|>:说明: 获取当前已导入的所有插件。 :返回: - ``Set[Plugin]``<|endoftext|>
384fce58d23c7fdbd7ceeb0187ae279a00929d0109e71b4bad8e6d526a2066c5
def require(name: str) -> Optional[Export]: '\n :说明:\n\n 获取一个插件的导出内容\n\n :参数:\n\n * ``name: str``: 插件名,与 ``load_plugin`` 参数一致。如果为 ``load_plugins`` 导入的插件,则为文件(夹)名。\n\n :返回:\n\n - ``Optional[Export]``\n ' plugin = (get_plugin(name) or load_plugin(name)) return (plugin.export if plug...
:说明: 获取一个插件的导出内容 :参数: * ``name: str``: 插件名,与 ``load_plugin`` 参数一致。如果为 ``load_plugins`` 导入的插件,则为文件(夹)名。 :返回: - ``Optional[Export]``
nonebot/plugin/__init__.py
require
SK-415/nonebot2
1,757
python
def require(name: str) -> Optional[Export]: '\n :说明:\n\n 获取一个插件的导出内容\n\n :参数:\n\n * ``name: str``: 插件名,与 ``load_plugin`` 参数一致。如果为 ``load_plugins`` 导入的插件,则为文件(夹)名。\n\n :返回:\n\n - ``Optional[Export]``\n ' plugin = (get_plugin(name) or load_plugin(name)) return (plugin.export if plug...
def require(name: str) -> Optional[Export]: '\n :说明:\n\n 获取一个插件的导出内容\n\n :参数:\n\n * ``name: str``: 插件名,与 ``load_plugin`` 参数一致。如果为 ``load_plugins`` 导入的插件,则为文件(夹)名。\n\n :返回:\n\n - ``Optional[Export]``\n ' plugin = (get_plugin(name) or load_plugin(name)) return (plugin.export if plug...
022e034a79dcfd9ed3bb3a71e4dbbbe08574ef11bd41d12d0d5ec484c6bcdfff
@property def export(self) -> Export: '\n - **类型**: ``Export``\n - **说明**: 插件内定义的导出内容\n ' return getattr(self.module, '__export__', Export())
- **类型**: ``Export`` - **说明**: 插件内定义的导出内容
nonebot/plugin/__init__.py
export
SK-415/nonebot2
1,757
python
@property def export(self) -> Export: '\n - **类型**: ``Export``\n - **说明**: 插件内定义的导出内容\n ' return getattr(self.module, '__export__', Export())
@property def export(self) -> Export: '\n - **类型**: ``Export``\n - **说明**: 插件内定义的导出内容\n ' return getattr(self.module, '__export__', Export())<|docstring|>- **类型**: ``Export`` - **说明**: 插件内定义的导出内容<|endoftext|>
ce652caa00280b5eee0a89b56dcdfedc07771300338f97029e2aff460d419999
@property def matcher(self) -> Set[Type[Matcher]]: '\n - **类型**: ``Set[Type[Matcher]]``\n - **说明**: 插件内定义的 ``Matcher``\n ' return _plugin_matchers.get(self.name, set())
- **类型**: ``Set[Type[Matcher]]`` - **说明**: 插件内定义的 ``Matcher``
nonebot/plugin/__init__.py
matcher
SK-415/nonebot2
1,757
python
@property def matcher(self) -> Set[Type[Matcher]]: '\n - **类型**: ``Set[Type[Matcher]]``\n - **说明**: 插件内定义的 ``Matcher``\n ' return _plugin_matchers.get(self.name, set())
@property def matcher(self) -> Set[Type[Matcher]]: '\n - **类型**: ``Set[Type[Matcher]]``\n - **说明**: 插件内定义的 ``Matcher``\n ' return _plugin_matchers.get(self.name, set())<|docstring|>- **类型**: ``Set[Type[Matcher]]`` - **说明**: 插件内定义的 ``Matcher``<|endoftext|>
51d1d4117a066b6aa72f4a8b80340d4e1646d7467b791ebb772879101d073660
def __init__(self, cmd: Union[(str, Tuple[(str, ...)])], **kwargs): '\n :参数:\n\n * ``cmd: Union[str, Tuple[str, ...]]``: 命令前缀\n * ``**kwargs``: 其他传递给 ``on_command`` 的参数默认值,参考 `on_command <#on-command-cmd-rule-none-aliases-none-kwargs>`_\n ' self.basecmd: Tuple[(str, ...)] = ((cmd...
:参数: * ``cmd: Union[str, Tuple[str, ...]]``: 命令前缀 * ``**kwargs``: 其他传递给 ``on_command`` 的参数默认值,参考 `on_command <#on-command-cmd-rule-none-aliases-none-kwargs>`_
nonebot/plugin/__init__.py
__init__
SK-415/nonebot2
1,757
python
def __init__(self, cmd: Union[(str, Tuple[(str, ...)])], **kwargs): '\n :参数:\n\n * ``cmd: Union[str, Tuple[str, ...]]``: 命令前缀\n * ``**kwargs``: 其他传递给 ``on_command`` 的参数默认值,参考 `on_command <#on-command-cmd-rule-none-aliases-none-kwargs>`_\n ' self.basecmd: Tuple[(str, ...)] = ((cmd...
def __init__(self, cmd: Union[(str, Tuple[(str, ...)])], **kwargs): '\n :参数:\n\n * ``cmd: Union[str, Tuple[str, ...]]``: 命令前缀\n * ``**kwargs``: 其他传递给 ``on_command`` 的参数默认值,参考 `on_command <#on-command-cmd-rule-none-aliases-none-kwargs>`_\n ' self.basecmd: Tuple[(str, ...)] = ((cmd...
af620a0f71f3850eb31a73ad47dd8ca4f3cd2156f96681e45c37f630cd123c51
def command(self, cmd: Union[(str, Tuple[(str, ...)])], **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个新的命令。\n\n :参数:\n\n * ``cmd: Union[str, Tuple[str, ...]]``: 命令前缀\n * ``**kwargs``: 其他传递给 ``on_command`` 的参数,将会覆盖命令组默认值\n\n :返回:\n\n - ``Type[Matcher]``\n ...
:说明: 注册一个新的命令。 :参数: * ``cmd: Union[str, Tuple[str, ...]]``: 命令前缀 * ``**kwargs``: 其他传递给 ``on_command`` 的参数,将会覆盖命令组默认值 :返回: - ``Type[Matcher]``
nonebot/plugin/__init__.py
command
SK-415/nonebot2
1,757
python
def command(self, cmd: Union[(str, Tuple[(str, ...)])], **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个新的命令。\n\n :参数:\n\n * ``cmd: Union[str, Tuple[str, ...]]``: 命令前缀\n * ``**kwargs``: 其他传递给 ``on_command`` 的参数,将会覆盖命令组默认值\n\n :返回:\n\n - ``Type[Matcher]``\n ...
def command(self, cmd: Union[(str, Tuple[(str, ...)])], **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个新的命令。\n\n :参数:\n\n * ``cmd: Union[str, Tuple[str, ...]]``: 命令前缀\n * ``**kwargs``: 其他传递给 ``on_command`` 的参数,将会覆盖命令组默认值\n\n :返回:\n\n - ``Type[Matcher]``\n ...
14063a37bd2d739e80ab531c4540f9d2eeac231ac13521132f6467d9d790d8f7
def shell_command(self, cmd: Union[(str, Tuple[(str, ...)])], **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个新的命令。\n\n :参数:\n\n * ``cmd: Union[str, Tuple[str, ...]]``: 命令前缀\n * ``**kwargs``: 其他传递给 ``on_shell_command`` 的参数,将会覆盖命令组默认值\n\n :返回:\n\n - ``Type[Matche...
:说明: 注册一个新的命令。 :参数: * ``cmd: Union[str, Tuple[str, ...]]``: 命令前缀 * ``**kwargs``: 其他传递给 ``on_shell_command`` 的参数,将会覆盖命令组默认值 :返回: - ``Type[Matcher]``
nonebot/plugin/__init__.py
shell_command
SK-415/nonebot2
1,757
python
def shell_command(self, cmd: Union[(str, Tuple[(str, ...)])], **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个新的命令。\n\n :参数:\n\n * ``cmd: Union[str, Tuple[str, ...]]``: 命令前缀\n * ``**kwargs``: 其他传递给 ``on_shell_command`` 的参数,将会覆盖命令组默认值\n\n :返回:\n\n - ``Type[Matche...
def shell_command(self, cmd: Union[(str, Tuple[(str, ...)])], **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个新的命令。\n\n :参数:\n\n * ``cmd: Union[str, Tuple[str, ...]]``: 命令前缀\n * ``**kwargs``: 其他传递给 ``on_shell_command`` 的参数,将会覆盖命令组默认值\n\n :返回:\n\n - ``Type[Matche...
4d2e69a2823b9ec78c296c6d63cf884183f7a7e59052b312d94881594dcc1430
def __init__(self, **kwargs): '\n :说明:\n\n 创建一个事件响应器组合,参数为默认值,与 ``on`` 一致\n ' self.matchers: List[Type[Matcher]] = [] '\n :类型: ``List[Type[Matcher]]``\n :说明: 组内事件响应器列表\n ' self.base_kwargs: Dict[(str, Any)] = kwargs '\n - **类型**: ``Dict[str, Any]``\...
:说明: 创建一个事件响应器组合,参数为默认值,与 ``on`` 一致
nonebot/plugin/__init__.py
__init__
SK-415/nonebot2
1,757
python
def __init__(self, **kwargs): '\n :说明:\n\n 创建一个事件响应器组合,参数为默认值,与 ``on`` 一致\n ' self.matchers: List[Type[Matcher]] = [] '\n :类型: ``List[Type[Matcher]]``\n :说明: 组内事件响应器列表\n ' self.base_kwargs: Dict[(str, Any)] = kwargs '\n - **类型**: ``Dict[str, Any]``\...
def __init__(self, **kwargs): '\n :说明:\n\n 创建一个事件响应器组合,参数为默认值,与 ``on`` 一致\n ' self.matchers: List[Type[Matcher]] = [] '\n :类型: ``List[Type[Matcher]]``\n :说明: 组内事件响应器列表\n ' self.base_kwargs: Dict[(str, Any)] = kwargs '\n - **类型**: ``Dict[str, Any]``\...
53e7069f71f8b1aa872e061617514347acf9cfd805122a7c23aae4be4baf9078
def on(self, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个基础事件响应器,可自定义类型。\n\n :参数:\n\n * ``type: str``: 事件响应器类型\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``permission: Optional[Permission]``: 事件响应权限\n * ``handlers: Optional[List[Union[T...
:说明: 注册一个基础事件响应器,可自定义类型。 :参数: * ``type: str``: 事件响应器类型 * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则 * ``permission: Optional[Permission]``: 事件响应权限 * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表 * ``temp: bool``: 是否为临时事件响应器(仅执行一次) * ``priority: int``: 事件响应器优先级 * ``bloc...
nonebot/plugin/__init__.py
on
SK-415/nonebot2
1,757
python
def on(self, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个基础事件响应器,可自定义类型。\n\n :参数:\n\n * ``type: str``: 事件响应器类型\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``permission: Optional[Permission]``: 事件响应权限\n * ``handlers: Optional[List[Union[T...
def on(self, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个基础事件响应器,可自定义类型。\n\n :参数:\n\n * ``type: str``: 事件响应器类型\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``permission: Optional[Permission]``: 事件响应权限\n * ``handlers: Optional[List[Union[T...
7a4ece578bff4e6e8d6c0a77cf545d58f3ec21f84720f3bff4549365fd07a4ab
def on_metaevent(self, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个元事件响应器。\n\n :参数:\n\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表\n * ``temp: bool``: 是否为临时事件响应器(仅执行一次)\n *...
:说明: 注册一个元事件响应器。 :参数: * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则 * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表 * ``temp: bool``: 是否为临时事件响应器(仅执行一次) * ``priority: int``: 事件响应器优先级 * ``block: bool``: 是否阻止事件向更低优先级传递 * ``state: Optional[T_State]``: 默认 state * ``state_fac...
nonebot/plugin/__init__.py
on_metaevent
SK-415/nonebot2
1,757
python
def on_metaevent(self, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个元事件响应器。\n\n :参数:\n\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表\n * ``temp: bool``: 是否为临时事件响应器(仅执行一次)\n *...
def on_metaevent(self, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个元事件响应器。\n\n :参数:\n\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表\n * ``temp: bool``: 是否为临时事件响应器(仅执行一次)\n *...
9ee4fbac9a30ba229d7637d2eb35af1c247959c614155e97528d9ba1bb0b1941
def on_message(self, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器。\n\n :参数:\n\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``permission: Optional[Permission]``: 事件响应权限\n * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表\n ...
:说明: 注册一个消息事件响应器。 :参数: * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则 * ``permission: Optional[Permission]``: 事件响应权限 * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表 * ``temp: bool``: 是否为临时事件响应器(仅执行一次) * ``priority: int``: 事件响应器优先级 * ``block: bool``: 是否阻止事件向更低优先级传递 * ``st...
nonebot/plugin/__init__.py
on_message
SK-415/nonebot2
1,757
python
def on_message(self, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器。\n\n :参数:\n\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``permission: Optional[Permission]``: 事件响应权限\n * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表\n ...
def on_message(self, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器。\n\n :参数:\n\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``permission: Optional[Permission]``: 事件响应权限\n * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表\n ...
1cb41e8cf2850ae45ae91bef4aeaed42b4033b0610f36896508094b91d7cc04a
def on_notice(self, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个通知事件响应器。\n\n :参数:\n\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表\n * ``temp: bool``: 是否为临时事件响应器(仅执行一次)\n * `...
:说明: 注册一个通知事件响应器。 :参数: * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则 * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表 * ``temp: bool``: 是否为临时事件响应器(仅执行一次) * ``priority: int``: 事件响应器优先级 * ``block: bool``: 是否阻止事件向更低优先级传递 * ``state: Optional[T_State]``: 默认 state * ``state_fa...
nonebot/plugin/__init__.py
on_notice
SK-415/nonebot2
1,757
python
def on_notice(self, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个通知事件响应器。\n\n :参数:\n\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表\n * ``temp: bool``: 是否为临时事件响应器(仅执行一次)\n * `...
def on_notice(self, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个通知事件响应器。\n\n :参数:\n\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表\n * ``temp: bool``: 是否为临时事件响应器(仅执行一次)\n * `...
47964eda0692099479485a818e89fa1e679706e8aec480f5d8d2061c5442dc21
def on_request(self, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个请求事件响应器。\n\n :参数:\n\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表\n * ``temp: bool``: 是否为临时事件响应器(仅执行一次)\n * ...
:说明: 注册一个请求事件响应器。 :参数: * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则 * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表 * ``temp: bool``: 是否为临时事件响应器(仅执行一次) * ``priority: int``: 事件响应器优先级 * ``block: bool``: 是否阻止事件向更低优先级传递 * ``state: Optional[T_State]``: 默认 state * ``state_fa...
nonebot/plugin/__init__.py
on_request
SK-415/nonebot2
1,757
python
def on_request(self, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个请求事件响应器。\n\n :参数:\n\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表\n * ``temp: bool``: 是否为临时事件响应器(仅执行一次)\n * ...
def on_request(self, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个请求事件响应器。\n\n :参数:\n\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表\n * ``temp: bool``: 是否为临时事件响应器(仅执行一次)\n * ...
a12f86a4a42d99bee9ae52e5485e471ff809a7546acf1cec3b515fa0b62c9172
def on_startswith(self, msg: Union[(str, Tuple[(str, ...)])], **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。\n\n :参数:\n\n * ``msg: Union[str, Tuple[str, ...]]``: 指定消息开头内容\n * ``ignorecase: bool``: 是否忽略大小写\n * ``rule: Optional[Union[Ru...
:说明: 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。 :参数: * ``msg: Union[str, Tuple[str, ...]]``: 指定消息开头内容 * ``ignorecase: bool``: 是否忽略大小写 * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则 * ``permission: Optional[Permission]``: 事件响应权限 * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表 * ...
nonebot/plugin/__init__.py
on_startswith
SK-415/nonebot2
1,757
python
def on_startswith(self, msg: Union[(str, Tuple[(str, ...)])], **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。\n\n :参数:\n\n * ``msg: Union[str, Tuple[str, ...]]``: 指定消息开头内容\n * ``ignorecase: bool``: 是否忽略大小写\n * ``rule: Optional[Union[Ru...
def on_startswith(self, msg: Union[(str, Tuple[(str, ...)])], **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容开头时响应。\n\n :参数:\n\n * ``msg: Union[str, Tuple[str, ...]]``: 指定消息开头内容\n * ``ignorecase: bool``: 是否忽略大小写\n * ``rule: Optional[Union[Ru...
ad46f561473c046b295576fe9db33feeca8269513973d859b79269026e2fbc57
def on_endswith(self, msg: Union[(str, Tuple[(str, ...)])], **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。\n\n :参数:\n\n * ``msg: Union[str, Tuple[str, ...]]``: 指定消息结尾内容\n * ``ignorecase: bool``: 是否忽略大小写\n * ``rule: Optional[Union[Rule...
:说明: 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。 :参数: * ``msg: Union[str, Tuple[str, ...]]``: 指定消息结尾内容 * ``ignorecase: bool``: 是否忽略大小写 * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则 * ``permission: Optional[Permission]``: 事件响应权限 * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表 * ...
nonebot/plugin/__init__.py
on_endswith
SK-415/nonebot2
1,757
python
def on_endswith(self, msg: Union[(str, Tuple[(str, ...)])], **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。\n\n :参数:\n\n * ``msg: Union[str, Tuple[str, ...]]``: 指定消息结尾内容\n * ``ignorecase: bool``: 是否忽略大小写\n * ``rule: Optional[Union[Rule...
def on_endswith(self, msg: Union[(str, Tuple[(str, ...)])], **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器,并且当消息的**文本部分**以指定内容结尾时响应。\n\n :参数:\n\n * ``msg: Union[str, Tuple[str, ...]]``: 指定消息结尾内容\n * ``ignorecase: bool``: 是否忽略大小写\n * ``rule: Optional[Union[Rule...
a716562ba2ce7402f5e5e681e32ede2cec0516be1f0b0c953433b090a9c903a3
def on_keyword(self, keywords: Set[str], **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。\n\n :参数:\n\n * ``keywords: Set[str]``: 关键词列表\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``permission: Optional[Permission]``: 事件响应权限...
:说明: 注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。 :参数: * ``keywords: Set[str]``: 关键词列表 * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则 * ``permission: Optional[Permission]``: 事件响应权限 * ``handlers: Optional[List[Union[T_Handler, Handler]]]``: 事件处理函数列表 * ``temp: bool``: 是否为临时事件响应器(仅执行一次) * ``priority: int``: ...
nonebot/plugin/__init__.py
on_keyword
SK-415/nonebot2
1,757
python
def on_keyword(self, keywords: Set[str], **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。\n\n :参数:\n\n * ``keywords: Set[str]``: 关键词列表\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``permission: Optional[Permission]``: 事件响应权限...
def on_keyword(self, keywords: Set[str], **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器,并且当消息纯文本部分包含关键词时响应。\n\n :参数:\n\n * ``keywords: Set[str]``: 关键词列表\n * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则\n * ``permission: Optional[Permission]``: 事件响应权限...
ec492e04ecdc7c38402b718d1ce1fc095e2669064fb2f3b7fb6551ada8065b3d
def on_command(self, cmd: Union[(str, Tuple[(str, ...)])], aliases: Optional[Set[Union[(str, Tuple[(str, ...)])]]]=None, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器,并且当消息以指定命令开头时响应。\n\n 命令匹配规则参考: `命令形式匹配 <rule.html#command-command>`_\n\n :参数:\n\n * ``cmd: Union[str,...
:说明: 注册一个消息事件响应器,并且当消息以指定命令开头时响应。 命令匹配规则参考: `命令形式匹配 <rule.html#command-command>`_ :参数: * ``cmd: Union[str, Tuple[str, ...]]``: 指定命令内容 * ``aliases: Optional[Set[Union[str, Tuple[str, ...]]]]``: 命令别名 * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则 * ``permission: Optional[Permission]``: 事件响应权限 ...
nonebot/plugin/__init__.py
on_command
SK-415/nonebot2
1,757
python
def on_command(self, cmd: Union[(str, Tuple[(str, ...)])], aliases: Optional[Set[Union[(str, Tuple[(str, ...)])]]]=None, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器,并且当消息以指定命令开头时响应。\n\n 命令匹配规则参考: `命令形式匹配 <rule.html#command-command>`_\n\n :参数:\n\n * ``cmd: Union[str,...
def on_command(self, cmd: Union[(str, Tuple[(str, ...)])], aliases: Optional[Set[Union[(str, Tuple[(str, ...)])]]]=None, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器,并且当消息以指定命令开头时响应。\n\n 命令匹配规则参考: `命令形式匹配 <rule.html#command-command>`_\n\n :参数:\n\n * ``cmd: Union[str,...
1b552dfb5158c6b87aa30032ba7b66db8942cc15f9f61bf51a92367f3f87d0f7
def on_shell_command(self, cmd: Union[(str, Tuple[(str, ...)])], aliases: Optional[Set[Union[(str, Tuple[(str, ...)])]]]=None, parser: Optional[ArgumentParser]=None, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个支持 ``shell_like`` 解析参数的命令消息事件响应器。\n\n 与普通的 ``on_command`` 不同的是,在添加 ``parser`` 参数...
:说明: 注册一个支持 ``shell_like`` 解析参数的命令消息事件响应器。 与普通的 ``on_command`` 不同的是,在添加 ``parser`` 参数时, 响应器会自动处理消息。 并将用户输入的原始参数列表保存在 ``state["argv"]``, ``parser`` 处理的参数保存在 ``state["args"]`` 中 :参数: * ``cmd: Union[str, Tuple[str, ...]]``: 指定命令内容 * ``aliases: Optional[Set[Union[str, Tuple[str, ...]]]]``: 命令别名 * ``parser:...
nonebot/plugin/__init__.py
on_shell_command
SK-415/nonebot2
1,757
python
def on_shell_command(self, cmd: Union[(str, Tuple[(str, ...)])], aliases: Optional[Set[Union[(str, Tuple[(str, ...)])]]]=None, parser: Optional[ArgumentParser]=None, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个支持 ``shell_like`` 解析参数的命令消息事件响应器。\n\n 与普通的 ``on_command`` 不同的是,在添加 ``parser`` 参数...
def on_shell_command(self, cmd: Union[(str, Tuple[(str, ...)])], aliases: Optional[Set[Union[(str, Tuple[(str, ...)])]]]=None, parser: Optional[ArgumentParser]=None, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个支持 ``shell_like`` 解析参数的命令消息事件响应器。\n\n 与普通的 ``on_command`` 不同的是,在添加 ``parser`` 参数...
b57984492b10abe67195d58cc69330bf7ebfb4e79baf01fa043bc87b7cbbe69a
def on_regex(self, pattern: str, flags: Union[(int, re.RegexFlag)]=0, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器,并且当消息匹配正则表达式时响应。\n\n 命令匹配规则参考: `正则匹配 <rule.html#regex-regex-flags-0>`_\n\n :参数:\n\n * ``pattern: str``: 正则表达式\n * ``flags: Union[int, re.RegexF...
:说明: 注册一个消息事件响应器,并且当消息匹配正则表达式时响应。 命令匹配规则参考: `正则匹配 <rule.html#regex-regex-flags-0>`_ :参数: * ``pattern: str``: 正则表达式 * ``flags: Union[int, re.RegexFlag]``: 正则匹配标志 * ``rule: Optional[Union[Rule, T_RuleChecker]]``: 事件响应规则 * ``permission: Optional[Permission]``: 事件响应权限 * ``handlers: Optional[List[Union[T_H...
nonebot/plugin/__init__.py
on_regex
SK-415/nonebot2
1,757
python
def on_regex(self, pattern: str, flags: Union[(int, re.RegexFlag)]=0, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器,并且当消息匹配正则表达式时响应。\n\n 命令匹配规则参考: `正则匹配 <rule.html#regex-regex-flags-0>`_\n\n :参数:\n\n * ``pattern: str``: 正则表达式\n * ``flags: Union[int, re.RegexF...
def on_regex(self, pattern: str, flags: Union[(int, re.RegexFlag)]=0, **kwargs) -> Type[Matcher]: '\n :说明:\n\n 注册一个消息事件响应器,并且当消息匹配正则表达式时响应。\n\n 命令匹配规则参考: `正则匹配 <rule.html#regex-regex-flags-0>`_\n\n :参数:\n\n * ``pattern: str``: 正则表达式\n * ``flags: Union[int, re.RegexF...
dcb4d18dc9635ac99353c3e0eb70d69238b37e796b9cc051d61b5667c691bfdc
def bark_alpha(fs): '\n Returns the alpha parameter corresponding to a Bark scale.\n ' return ((0.8517 * np.sqrt(np.arctan(((0.06583 * fs) / 1000.0)))) - 0.1916)
Returns the alpha parameter corresponding to a Bark scale.
lib/sigproc/freqwarp.py
bark_alpha
qingyundou/tacotron_qdou
2
python
def bark_alpha(fs): '\n \n ' return ((0.8517 * np.sqrt(np.arctan(((0.06583 * fs) / 1000.0)))) - 0.1916)
def bark_alpha(fs): '\n \n ' return ((0.8517 * np.sqrt(np.arctan(((0.06583 * fs) / 1000.0)))) - 0.1916)<|docstring|>Returns the alpha parameter corresponding to a Bark scale.<|endoftext|>
b4937b5b45334b82bc8050f504069b78157a53330b7480d1c94c1fd0b6099a2a
def erb_alpha(fs): '\n Returns the alpha parameter corresponding to an ERB scale.\n ' return ((0.5941 * np.sqrt(np.arctan(((0.1418 * fs) / 1000.0)))) + 0.03237)
Returns the alpha parameter corresponding to an ERB scale.
lib/sigproc/freqwarp.py
erb_alpha
qingyundou/tacotron_qdou
2
python
def erb_alpha(fs): '\n \n ' return ((0.5941 * np.sqrt(np.arctan(((0.1418 * fs) / 1000.0)))) + 0.03237)
def erb_alpha(fs): '\n \n ' return ((0.5941 * np.sqrt(np.arctan(((0.1418 * fs) / 1000.0)))) + 0.03237)<|docstring|>Returns the alpha parameter corresponding to an ERB scale.<|endoftext|>
116cee98c22ce4218515b77c4f7580b7c687778257d3a93e3ad5786e6b841a89
def loghspec2fwcep(C, fs, order=(- 1)): '\n From https://github.com/covarep/covarep/blob/master/envelope/hspec2fwcep.m\n ' if (len(C.shape) > 1): FWCEP = np.zeros((C.shape[0], (1 + order))) for n in range(C.shape[0]): FWCEP[(n, :)] = loghspec2fwcep(C[(n, :)], fs, order) ...
From https://github.com/covarep/covarep/blob/master/envelope/hspec2fwcep.m
lib/sigproc/freqwarp.py
loghspec2fwcep
qingyundou/tacotron_qdou
2
python
def loghspec2fwcep(C, fs, order=(- 1)): '\n \n ' if (len(C.shape) > 1): FWCEP = np.zeros((C.shape[0], (1 + order))) for n in range(C.shape[0]): FWCEP[(n, :)] = loghspec2fwcep(C[(n, :)], fs, order) return FWCEP dftlen = ((len(C) - 1) * 2) if (order == (- 1)): ...
def loghspec2fwcep(C, fs, order=(- 1)): '\n \n ' if (len(C.shape) > 1): FWCEP = np.zeros((C.shape[0], (1 + order))) for n in range(C.shape[0]): FWCEP[(n, :)] = loghspec2fwcep(C[(n, :)], fs, order) return FWCEP dftlen = ((len(C) - 1) * 2) if (order == (- 1)): ...
d4b898cd5d58528e16081c937665dfc71042060fcfb4c2641b32bd26c7c96f03
def fwcep2loghspec(fwcep, fs, dftlen): '\n From https://github.com/covarep/covarep/blob/master/envelope/fwcep2hspec.m\n ' if (len(fwcep.shape) > 1): C = np.zeros((fwcep.shape[0], (int((dftlen / 2)) + 1))) for n in range(C.shape[0]): C[(n, :)] = fwcep2loghspec(fwcep[(n, :)], fs,...
From https://github.com/covarep/covarep/blob/master/envelope/fwcep2hspec.m
lib/sigproc/freqwarp.py
fwcep2loghspec
qingyundou/tacotron_qdou
2
python
def fwcep2loghspec(fwcep, fs, dftlen): '\n \n ' if (len(fwcep.shape) > 1): C = np.zeros((fwcep.shape[0], (int((dftlen / 2)) + 1))) for n in range(C.shape[0]): C[(n, :)] = fwcep2loghspec(fwcep[(n, :)], fs, dftlen) return C freqlin = ((fs * np.arange((int((dftlen / 2)...
def fwcep2loghspec(fwcep, fs, dftlen): '\n \n ' if (len(fwcep.shape) > 1): C = np.zeros((fwcep.shape[0], (int((dftlen / 2)) + 1))) for n in range(C.shape[0]): C[(n, :)] = fwcep2loghspec(fwcep[(n, :)], fs, dftlen) return C freqlin = ((fs * np.arange((int((dftlen / 2)...
8505052e03ed5363441f3229530d199b5cbde50a62265cd62502bf594f3f2ee5
def linbnd2fwbnd(X, fs, dftlen, nbbnds): '\n Split the spectral data X into mel-bands\n ' freqlin = ((fs * np.arange((int((dftlen / 2)) + 1))) / dftlen) freqmel = (((0.5 * fs) * sp.lin2mel(freqlin)) / sp.lin2mel((0.5 * fs))) Z = np.zeros((X.shape[0], nbbnds)) for t in np.arange(X.shape[0]): ...
Split the spectral data X into mel-bands
lib/sigproc/freqwarp.py
linbnd2fwbnd
qingyundou/tacotron_qdou
2
python
def linbnd2fwbnd(X, fs, dftlen, nbbnds): '\n \n ' freqlin = ((fs * np.arange((int((dftlen / 2)) + 1))) / dftlen) freqmel = (((0.5 * fs) * sp.lin2mel(freqlin)) / sp.lin2mel((0.5 * fs))) Z = np.zeros((X.shape[0], nbbnds)) for t in np.arange(X.shape[0]): Y = np.interp(freqlin, freqmel, X[...
def linbnd2fwbnd(X, fs, dftlen, nbbnds): '\n \n ' freqlin = ((fs * np.arange((int((dftlen / 2)) + 1))) / dftlen) freqmel = (((0.5 * fs) * sp.lin2mel(freqlin)) / sp.lin2mel((0.5 * fs))) Z = np.zeros((X.shape[0], nbbnds)) for t in np.arange(X.shape[0]): Y = np.interp(freqlin, freqmel, X[...
49c6166583a55d8ac794f040af94ac3cee810a76ecce2791d733259d729cf63e
def freq2fwspecidx(freq, fs, nbbnds, dftlen=4096): '\n Retrieve the closest index to a frequency in frequency-warped spectrum.\n ' FF = ((fs * np.arange((int((dftlen / 2)) + 1))) / float(dftlen)) fwFF = linbnd2fwbnd(FF[(np.newaxis, :)], fs, dftlen, nbbnds) return np.min(np.where((fwFF > freq))[1])
Retrieve the closest index to a frequency in frequency-warped spectrum.
lib/sigproc/freqwarp.py
freq2fwspecidx
qingyundou/tacotron_qdou
2
python
def freq2fwspecidx(freq, fs, nbbnds, dftlen=4096): '\n \n ' FF = ((fs * np.arange((int((dftlen / 2)) + 1))) / float(dftlen)) fwFF = linbnd2fwbnd(FF[(np.newaxis, :)], fs, dftlen, nbbnds) return np.min(np.where((fwFF > freq))[1])
def freq2fwspecidx(freq, fs, nbbnds, dftlen=4096): '\n \n ' FF = ((fs * np.arange((int((dftlen / 2)) + 1))) / float(dftlen)) fwFF = linbnd2fwbnd(FF[(np.newaxis, :)], fs, dftlen, nbbnds) return np.min(np.where((fwFF > freq))[1])<|docstring|>Retrieve the closest index to a frequency in frequency-war...
3cc0417d87130a184a2440968dccae83259e225dbba7f09df02314f8ac7c0bff
def fwbnd2linbnd(Z, fs, dftlen, smooth=False): '\n Reconstruct spectral data from mel-bands\n ' nbbnds = Z.shape[1] freqlin = ((fs * np.arange((int((dftlen / 2)) + 1))) / dftlen) freqmel = (((0.5 * fs) * sp.lin2mel(freqlin)) / sp.lin2mel((0.5 * fs))) X = np.zeros((Z.shape[0], (int((dftlen / 2)...
Reconstruct spectral data from mel-bands
lib/sigproc/freqwarp.py
fwbnd2linbnd
qingyundou/tacotron_qdou
2
python
def fwbnd2linbnd(Z, fs, dftlen, smooth=False): '\n \n ' nbbnds = Z.shape[1] freqlin = ((fs * np.arange((int((dftlen / 2)) + 1))) / dftlen) freqmel = (((0.5 * fs) * sp.lin2mel(freqlin)) / sp.lin2mel((0.5 * fs))) X = np.zeros((Z.shape[0], (int((dftlen / 2)) + 1))) for t in np.arange(X.shape[...
def fwbnd2linbnd(Z, fs, dftlen, smooth=False): '\n \n ' nbbnds = Z.shape[1] freqlin = ((fs * np.arange((int((dftlen / 2)) + 1))) / dftlen) freqmel = (((0.5 * fs) * sp.lin2mel(freqlin)) / sp.lin2mel((0.5 * fs))) X = np.zeros((Z.shape[0], (int((dftlen / 2)) + 1))) for t in np.arange(X.shape[...
63a11ee9449ad8741586bc5071fa6cdf97201786f66a9b6777116984dbebf6ec
def inf_generator(iterable): 'Allows training with DataLoaders in a single infinite loop:\n\t\tfor i, (x, y) in enumerate(inf_generator(train_loader)):\n\t' iterator = iterable.__iter__() while True: try: (yield iterator.__next__()) except StopIteration: iterator = it...
Allows training with DataLoaders in a single infinite loop: for i, (x, y) in enumerate(inf_generator(train_loader)):
lib/utils.py
inf_generator
JurijsNazarovs/panel_me_ode
6
python
def inf_generator(iterable): 'Allows training with DataLoaders in a single infinite loop:\n\t\tfor i, (x, y) in enumerate(inf_generator(train_loader)):\n\t' iterator = iterable.__iter__() while True: try: (yield iterator.__next__()) except StopIteration: iterator = it...
def inf_generator(iterable): 'Allows training with DataLoaders in a single infinite loop:\n\t\tfor i, (x, y) in enumerate(inf_generator(train_loader)):\n\t' iterator = iterable.__iter__() while True: try: (yield iterator.__next__()) except StopIteration: iterator = it...
8f88fb5b9b6c731cbe6c9c8a3f2636546f0c6620db89c57c99d9474dbe095868
@torch.jit.script_method def tokenize(self, input: str) -> List[Tuple[(str, int, int)]]: '\n Process a single line of raw inputs into tokens, it supports\n two input formats:\n 1) a single text\n 2) a token\n\n Returns a list of tokens with start and end indices in original input....
Process a single line of raw inputs into tokens, it supports two input formats: 1) a single text 2) a token Returns a list of tokens with start and end indices in original input.
pytext/torchscript/tokenizer/tokenizer.py
tokenize
z-a-f/pytext
6,199
python
@torch.jit.script_method def tokenize(self, input: str) -> List[Tuple[(str, int, int)]]: '\n Process a single line of raw inputs into tokens, it supports\n two input formats:\n 1) a single text\n 2) a token\n\n Returns a list of tokens with start and end indices in original input....
@torch.jit.script_method def tokenize(self, input: str) -> List[Tuple[(str, int, int)]]: '\n Process a single line of raw inputs into tokens, it supports\n two input formats:\n 1) a single text\n 2) a token\n\n Returns a list of tokens with start and end indices in original input....
a47f5570dbc066d12452832dd8c7dd7b35aa82969d3c520bed401df444fe6628
@torch.jit.script_method def tokenize(self, raw_token: str) -> List[Tuple[(str, int, int)]]: "\n This tokenizers splits a raw_token into its constituent words by splitting\n the raw_token on space. This function handle multiple spaces between\n words too.\n Note:\n torch scripting...
This tokenizers splits a raw_token into its constituent words by splitting the raw_token on space. This function handle multiple spaces between words too. Note: torch scripting doesn't support try-except and since re.finditer uses try in its implemetation regex based tokenization is not supported.
pytext/torchscript/tokenizer/tokenizer.py
tokenize
z-a-f/pytext
6,199
python
@torch.jit.script_method def tokenize(self, raw_token: str) -> List[Tuple[(str, int, int)]]: "\n This tokenizers splits a raw_token into its constituent words by splitting\n the raw_token on space. This function handle multiple spaces between\n words too.\n Note:\n torch scripting...
@torch.jit.script_method def tokenize(self, raw_token: str) -> List[Tuple[(str, int, int)]]: "\n This tokenizers splits a raw_token into its constituent words by splitting\n the raw_token on space. This function handle multiple spaces between\n words too.\n Note:\n torch scripting...
913f107537524f9cfe4d247d659146b3451c1c07fdac43b9f0c84b2143805cab
def run(self): 'Run command.' onnx_script = os.path.realpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tools/mypy-onnx.py')) returncode = subprocess.call([sys.executable, onnx_script]) sys.exit(returncode)
Run command.
setup.py
run
yihonglyu/onnx
12,820
python
def run(self): onnx_script = os.path.realpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tools/mypy-onnx.py')) returncode = subprocess.call([sys.executable, onnx_script]) sys.exit(returncode)
def run(self): onnx_script = os.path.realpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tools/mypy-onnx.py')) returncode = subprocess.call([sys.executable, onnx_script]) sys.exit(returncode)<|docstring|>Run command.<|endoftext|>
28e635c98a3156e38f25f9f9fc6f2d5cdb3e22f7787561d86e0fe22f908eea0a
def test_abc_abstract(self): '\n One cannot instantiate `TradeStrategy` itself.\n ' with pytest.raises(TypeError): TradeStrategy()
One cannot instantiate `TradeStrategy` itself.
tests/strategy/test_abc.py
test_abc_abstract
shishaboy/epymetheus
0
python
def test_abc_abstract(self): '\n \n ' with pytest.raises(TypeError): TradeStrategy()
def test_abc_abstract(self): '\n \n ' with pytest.raises(TypeError): TradeStrategy()<|docstring|>One cannot instantiate `TradeStrategy` itself.<|endoftext|>
53d4a2b528e00493adfe6f84eb56f15ef511b13b661228b55d8ff539ffcc5353
def test_abc_nologic(self): '\n One cannot instantiate strategy without logic.\n ' with pytest.raises(TypeError): StrategyWithoutLogic()
One cannot instantiate strategy without logic.
tests/strategy/test_abc.py
test_abc_nologic
shishaboy/epymetheus
0
python
def test_abc_nologic(self): '\n \n ' with pytest.raises(TypeError): StrategyWithoutLogic()
def test_abc_nologic(self): '\n \n ' with pytest.raises(TypeError): StrategyWithoutLogic()<|docstring|>One cannot instantiate strategy without logic.<|endoftext|>
afc83dcc852fc44d96a6b43f926936127a3a2c5f3cc218c9744689f82f22d6ab
def load_data(self, data_dir=None, use_apple2orange=False, use_summer2winter_yosemite=False, use_horse2zebra=False, use_monet2photo=False, use_cezanne2photo=False, use_ukiyoe2photo=False, use_vangogh2photo=False, use_maps=False, use_cityscapes=False, use_facades=False, use_iphone2dslr_flower=False, batch_size=32): ...
Load data to train the model Args: data_dir (str, optional): string representing the directory to load data from. Defaults to ``None`` use_apple2orange (bool, optional): use the apple2orange dataset to train the model. Defaults to ``False`` use_summer2winter_yosemite (bool, optional): use the summer2winter...
simplegan/gan/cyclegan.py
load_data
grohith327/EasyGAN
23
python
def load_data(self, data_dir=None, use_apple2orange=False, use_summer2winter_yosemite=False, use_horse2zebra=False, use_monet2photo=False, use_cezanne2photo=False, use_ukiyoe2photo=False, use_vangogh2photo=False, use_maps=False, use_cityscapes=False, use_facades=False, use_iphone2dslr_flower=False, batch_size=32): ...
def load_data(self, data_dir=None, use_apple2orange=False, use_summer2winter_yosemite=False, use_horse2zebra=False, use_monet2photo=False, use_cezanne2photo=False, use_ukiyoe2photo=False, use_vangogh2photo=False, use_maps=False, use_cityscapes=False, use_facades=False, use_iphone2dslr_flower=False, batch_size=32): ...
ebe9d30a3628ff54fc5234951793cbecd51755d766f7f3486e8e6b9f80c9a19b
def get_sample(self, data=None, n_samples=1, save_dir=None): 'View sample of the data\n\n Args:\n data (tf.data object): dataset to load samples from\n n_samples (int, optional): number of samples to load. Defaults to ``1``\n save_dir (str, optional): directory to save the sa...
View sample of the data Args: data (tf.data object): dataset to load samples from n_samples (int, optional): number of samples to load. Defaults to ``1`` save_dir (str, optional): directory to save the sample images. Defaults to ``None`` Return: ``None`` if save_dir is ``not None``, otherwise returns ...
simplegan/gan/cyclegan.py
get_sample
grohith327/EasyGAN
23
python
def get_sample(self, data=None, n_samples=1, save_dir=None): 'View sample of the data\n\n Args:\n data (tf.data object): dataset to load samples from\n n_samples (int, optional): number of samples to load. Defaults to ``1``\n save_dir (str, optional): directory to save the sa...
def get_sample(self, data=None, n_samples=1, save_dir=None): 'View sample of the data\n\n Args:\n data (tf.data object): dataset to load samples from\n n_samples (int, optional): number of samples to load. Defaults to ``1``\n save_dir (str, optional): directory to save the sa...
9c5e49e0f9beb3d7850ee8bcb5807bcb1eb8212f9a45576bc539dec0cd74e107
def discriminator(self): 'Discriminator module for CycleGAN. Use it as a regular TensorFlow 2.0 Keras Model.\n\n Return:\n A tf.keras model \n ' kernel_initializer = self.config['kernel_initializer'] kernel_size = self.config['kernel_size'] disc_channels = self.config['disc_cha...
Discriminator module for CycleGAN. Use it as a regular TensorFlow 2.0 Keras Model. Return: A tf.keras model
simplegan/gan/cyclegan.py
discriminator
grohith327/EasyGAN
23
python
def discriminator(self): 'Discriminator module for CycleGAN. Use it as a regular TensorFlow 2.0 Keras Model.\n\n Return:\n A tf.keras model \n ' kernel_initializer = self.config['kernel_initializer'] kernel_size = self.config['kernel_size'] disc_channels = self.config['disc_cha...
def discriminator(self): 'Discriminator module for CycleGAN. Use it as a regular TensorFlow 2.0 Keras Model.\n\n Return:\n A tf.keras model \n ' kernel_initializer = self.config['kernel_initializer'] kernel_size = self.config['kernel_size'] disc_channels = self.config['disc_cha...
7d3a0d79afc8b4de951a016a5a3ad5417a75b8490db6b5d6d76a32d537f51435
def __load_model(self): '\n Call build model to initialize the two generators and discriminators\n\n Note: Forward and backward GANs have the same architecture\n ' (self.gen_model_g, self.gen_model_f) = (self.generator(), self.generator()) (self.disc_model_x, self.disc_model_y) = (self....
Call build model to initialize the two generators and discriminators Note: Forward and backward GANs have the same architecture
simplegan/gan/cyclegan.py
__load_model
grohith327/EasyGAN
23
python
def __load_model(self): '\n Call build model to initialize the two generators and discriminators\n\n Note: Forward and backward GANs have the same architecture\n ' (self.gen_model_g, self.gen_model_f) = (self.generator(), self.generator()) (self.disc_model_x, self.disc_model_y) = (self....
def __load_model(self): '\n Call build model to initialize the two generators and discriminators\n\n Note: Forward and backward GANs have the same architecture\n ' (self.gen_model_g, self.gen_model_f) = (self.generator(), self.generator()) (self.disc_model_x, self.disc_model_y) = (self....
b16628b74a9a0813785109f0256105374155cedcd606a28a5afe1a084d2963b4
def fit(self, trainA=None, trainB=None, testA=None, testB=None, epochs=150, gen_g_optimizer='Adam', gen_f_optimizer='Adam', disc_x_optimizer='Adam', disc_y_optimizer='Adam', verbose=1, gen_g_learning_rate=0.0002, gen_f_learning_rate=0.0002, disc_x_learning_rate=0.0002, disc_y_learning_rate=0.0002, beta_1=0.5, tensorboa...
Function to train the model Args: trainA (tf.data object): training data A trainB (tf.data object): training data B testA (tf.data object): testing data A testB (tf.data object): testing data B epochs (int, optional): number of epochs to train the model. Defaults to ``150`` gen_g_optimizer (str...
simplegan/gan/cyclegan.py
fit
grohith327/EasyGAN
23
python
def fit(self, trainA=None, trainB=None, testA=None, testB=None, epochs=150, gen_g_optimizer='Adam', gen_f_optimizer='Adam', disc_x_optimizer='Adam', disc_y_optimizer='Adam', verbose=1, gen_g_learning_rate=0.0002, gen_f_learning_rate=0.0002, disc_x_learning_rate=0.0002, disc_y_learning_rate=0.0002, beta_1=0.5, tensorboa...
def fit(self, trainA=None, trainB=None, testA=None, testB=None, epochs=150, gen_g_optimizer='Adam', gen_f_optimizer='Adam', disc_x_optimizer='Adam', disc_y_optimizer='Adam', verbose=1, gen_g_learning_rate=0.0002, gen_f_learning_rate=0.0002, disc_x_learning_rate=0.0002, disc_y_learning_rate=0.0002, beta_1=0.5, tensorboa...
3a28295b2579eadebbfc4e5eaed8528088b45718a17b106ca9efb2e965702e62
def generate_samples(self, test_ds=None, save_dir=None): 'Generate samples using the trained model\n\n Args:\n test_ds (tf.data object): test data object used to generate samples`\n save_dir (str, optional): directory to save the generated images. Defaults to ``None``\n\n Return:...
Generate samples using the trained model Args: test_ds (tf.data object): test data object used to generate samples` save_dir (str, optional): directory to save the generated images. Defaults to ``None`` Return: returns ``None`` if save_dir is ``not None``, otherwise returns a numpy array with generated sa...
simplegan/gan/cyclegan.py
generate_samples
grohith327/EasyGAN
23
python
def generate_samples(self, test_ds=None, save_dir=None): 'Generate samples using the trained model\n\n Args:\n test_ds (tf.data object): test data object used to generate samples`\n save_dir (str, optional): directory to save the generated images. Defaults to ``None``\n\n Return:...
def generate_samples(self, test_ds=None, save_dir=None): 'Generate samples using the trained model\n\n Args:\n test_ds (tf.data object): test data object used to generate samples`\n save_dir (str, optional): directory to save the generated images. Defaults to ``None``\n\n Return:...
e44a108d6e66f6957e63883a8df751d1d40320cd9faaee1728ccb8cdc1b83f1c
def simMetaData(self, dataKey): 'Produces a dictionary of metadata for the given datakey. Meta data consists of:\n - dataKey (string)\n - includesInitial (bool)\n - numComponents (int)\n - numFrames (int)\n - nodeData (bool): True if node data\n - el...
Produces a dictionary of metadata for the given datakey. Meta data consists of: - dataKey (string) - includesInitial (bool) - numComponents (int) - numFrames (int) - nodeData (bool): True if node data - elmtData (bool): True if element data - grainData (bool): True if grain data - shape ...
fepx.py
simMetaData
MechMicroMan/DefDAP-allan
0
python
def simMetaData(self, dataKey): 'Produces a dictionary of metadata for the given datakey. Meta data consists of:\n - dataKey (string)\n - includesInitial (bool)\n - numComponents (int)\n - numFrames (int)\n - nodeData (bool): True if node data\n - el...
def simMetaData(self, dataKey): 'Produces a dictionary of metadata for the given datakey. Meta data consists of:\n - dataKey (string)\n - includesInitial (bool)\n - numComponents (int)\n - numFrames (int)\n - nodeData (bool): True if node data\n - el...
43a3556e00ce836cf10afe2d46784d4ae12d80ce95f7c65b74a2241106fa7b3a
def constructVtkMesh(self): 'Create VTK mesh using initial (undeformaed) node positions\n\n Returns:\n vtkUnstructuredGrid: VTK mesh\n ' CON_ORDER = [0, 2, 4, 9, 1, 3, 5, 6, 7, 8] ELMT_TYPE = 24 points = vtk.vtkPoints() for coord in self.nodePos: points.InsertNextPoi...
Create VTK mesh using initial (undeformaed) node positions Returns: vtkUnstructuredGrid: VTK mesh
fepx.py
constructVtkMesh
MechMicroMan/DefDAP-allan
0
python
def constructVtkMesh(self): 'Create VTK mesh using initial (undeformaed) node positions\n\n Returns:\n vtkUnstructuredGrid: VTK mesh\n ' CON_ORDER = [0, 2, 4, 9, 1, 3, 5, 6, 7, 8] ELMT_TYPE = 24 points = vtk.vtkPoints() for coord in self.nodePos: points.InsertNextPoi...
def constructVtkMesh(self): 'Create VTK mesh using initial (undeformaed) node positions\n\n Returns:\n vtkUnstructuredGrid: VTK mesh\n ' CON_ORDER = [0, 2, 4, 9, 1, 3, 5, 6, 7, 8] ELMT_TYPE = 24 points = vtk.vtkPoints() for coord in self.nodePos: points.InsertNextPoi...
9a145c840c6f8b675acfd8439bd648fc2589953ba890f9f23505bdb4c279a7a8
def calcGradient(self, inDataKey, outDataKey): 'Calculate gradient of simulation data wrt initial coordinates\n\n Args:\n inDataKey (string): Sim data key to caluclate gradient of\n outDataKey (string): Sim data key to store result\n ' self._validateSimDataKey(inDataKey, fiel...
Calculate gradient of simulation data wrt initial coordinates Args: inDataKey (string): Sim data key to caluclate gradient of outDataKey (string): Sim data key to store result
fepx.py
calcGradient
MechMicroMan/DefDAP-allan
0
python
def calcGradient(self, inDataKey, outDataKey): 'Calculate gradient of simulation data wrt initial coordinates\n\n Args:\n inDataKey (string): Sim data key to caluclate gradient of\n outDataKey (string): Sim data key to store result\n ' self._validateSimDataKey(inDataKey, fiel...
def calcGradient(self, inDataKey, outDataKey): 'Calculate gradient of simulation data wrt initial coordinates\n\n Args:\n inDataKey (string): Sim data key to caluclate gradient of\n outDataKey (string): Sim data key to store result\n ' self._validateSimDataKey(inDataKey, fiel...
d91ce2454fc0c8d7b84078f7c85ca49c36121086740ec3299b315d060ceb71dc
def nodeToElmtData(self, inDataKey, outDataKey): 'Convert node data to element data using VTK framework\n\n Args:\n inDataKey (string): Sim data key to convert\n outDataKey (string): Sim data key to store result\n ' self._validateSimDataKey(inDataKey, fieldType='node') si...
Convert node data to element data using VTK framework Args: inDataKey (string): Sim data key to convert outDataKey (string): Sim data key to store result
fepx.py
nodeToElmtData
MechMicroMan/DefDAP-allan
0
python
def nodeToElmtData(self, inDataKey, outDataKey): 'Convert node data to element data using VTK framework\n\n Args:\n inDataKey (string): Sim data key to convert\n outDataKey (string): Sim data key to store result\n ' self._validateSimDataKey(inDataKey, fieldType='node') si...
def nodeToElmtData(self, inDataKey, outDataKey): 'Convert node data to element data using VTK framework\n\n Args:\n inDataKey (string): Sim data key to convert\n outDataKey (string): Sim data key to store result\n ' self._validateSimDataKey(inDataKey, fieldType='node') si...
ade003bcb46244f1b313479b03ba4eaf3b2e3e7242fb84a9db962fd4d2785ad4
def calcGrainAverage(self, inDataKey, outDataKey=None): 'Calculate grain avergae of elemnet data.\n\n Args:\n inDataKey (str): Data key of input data\n outDataKey (None, optional): Data key to save data to. If none given then the data is returned from the function\n\n Returns:\n ...
Calculate grain avergae of elemnet data. Args: inDataKey (str): Data key of input data outDataKey (None, optional): Data key to save data to. If none given then the data is returned from the function Returns: Array: Grain average data or nothing if outDataKey specified.
fepx.py
calcGrainAverage
MechMicroMan/DefDAP-allan
0
python
def calcGrainAverage(self, inDataKey, outDataKey=None): 'Calculate grain avergae of elemnet data.\n\n Args:\n inDataKey (str): Data key of input data\n outDataKey (None, optional): Data key to save data to. If none given then the data is returned from the function\n\n Returns:\n ...
def calcGrainAverage(self, inDataKey, outDataKey=None): 'Calculate grain avergae of elemnet data.\n\n Args:\n inDataKey (str): Data key of input data\n outDataKey (None, optional): Data key to save data to. If none given then the data is returned from the function\n\n Returns:\n ...
035fb3b6cab5c366c8dc58f38c2b6d43c1cc76b66da548785fedca73685816d8
def writeVTU(self, fileName, frameNums, outputs, times=None, useInitialNodePos=True): 'Write data out to VTK compatible files. Files are output to the data directory.\n\n Args:\n fileName (string): Base name of output files.\n frameNums (lst(int)): The simlation frames to output. Either...
Write data out to VTK compatible files. Files are output to the data directory. Args: fileName (string): Base name of output files. frameNums (lst(int)): The simlation frames to output. Either an integer for a single frame, a list of ints for many or -1 for all. 0 is intial and 1 is f...
fepx.py
writeVTU
MechMicroMan/DefDAP-allan
0
python
def writeVTU(self, fileName, frameNums, outputs, times=None, useInitialNodePos=True): 'Write data out to VTK compatible files. Files are output to the data directory.\n\n Args:\n fileName (string): Base name of output files.\n frameNums (lst(int)): The simlation frames to output. Either...
def writeVTU(self, fileName, frameNums, outputs, times=None, useInitialNodePos=True): 'Write data out to VTK compatible files. Files are output to the data directory.\n\n Args:\n fileName (string): Base name of output files.\n frameNums (lst(int)): The simlation frames to output. Either...
ee83ee3389efffe280c61c9be3595852c89fef6ae633acb47f77cd85df84ec02
@staticmethod def combineFiles(baseDir, inDirs, outDir): 'Combine output files from multiple simulations. If a simulation was run in smaller parts\n\n Args:\n baseDir (string): Base directory of whole simulation. No trailing slash\n inDirs (List(string)): List of simulation directory na...
Combine output files from multiple simulations. If a simulation was run in smaller parts Args: baseDir (string): Base directory of whole simulation. No trailing slash inDirs (List(string)): List of simulation directory names to combine (baseDir/inDir). No trailing slash outDir (s...
fepx.py
combineFiles
MechMicroMan/DefDAP-allan
0
python
@staticmethod def combineFiles(baseDir, inDirs, outDir): 'Combine output files from multiple simulations. If a simulation was run in smaller parts\n\n Args:\n baseDir (string): Base directory of whole simulation. No trailing slash\n inDirs (List(string)): List of simulation directory na...
@staticmethod def combineFiles(baseDir, inDirs, outDir): 'Combine output files from multiple simulations. If a simulation was run in smaller parts\n\n Args:\n baseDir (string): Base directory of whole simulation. No trailing slash\n inDirs (List(string)): List of simulation directory na...
5d670f745e29c0129732a92bd464e34e1296092676ff3ce29417a4e70721511b
@property def elmtGrain(self): 'Returns an array of grain IDs for elements in the surface (note grain IDs are 1 based)\n ' return self.mesh.elmtGrain[self.elmtIDs]
Returns an array of grain IDs for elements in the surface (note grain IDs are 1 based)
fepx.py
elmtGrain
MechMicroMan/DefDAP-allan
0
python
@property def elmtGrain(self): '\n ' return self.mesh.elmtGrain[self.elmtIDs]
@property def elmtGrain(self): '\n ' return self.mesh.elmtGrain[self.elmtIDs]<|docstring|>Returns an array of grain IDs for elements in the surface (note grain IDs are 1 based)<|endoftext|>
90fbd8e1bd023e7a03c5ce281f04bfb2bec5bd59b535be04fe3f8c54cfefcbd3
@property def grainIDs(self): 'Returns an array of grain IDs included in the surface\n ' return np.unique(self.elmtGrain)
Returns an array of grain IDs included in the surface
fepx.py
grainIDs
MechMicroMan/DefDAP-allan
0
python
@property def grainIDs(self): '\n ' return np.unique(self.elmtGrain)
@property def grainIDs(self): '\n ' return np.unique(self.elmtGrain)<|docstring|>Returns an array of grain IDs included in the surface<|endoftext|>
fe8efef3779253baa1622033c906eaed90b552cba0cfb38b18022a68b48c5b12
@property def elmtGrainLayer(self): 'Returns an array of grain IDs for elements in the surface (note grain IDs are 1 based)\n ' return self.mesh.elmtGrain[self.elmtIDsLayer]
Returns an array of grain IDs for elements in the surface (note grain IDs are 1 based)
fepx.py
elmtGrainLayer
MechMicroMan/DefDAP-allan
0
python
@property def elmtGrainLayer(self): '\n ' return self.mesh.elmtGrain[self.elmtIDsLayer]
@property def elmtGrainLayer(self): '\n ' return self.mesh.elmtGrain[self.elmtIDsLayer]<|docstring|>Returns an array of grain IDs for elements in the surface (note grain IDs are 1 based)<|endoftext|>
bce3be24ae236e9f08a05ec0c69b05cc0c2dfcadf10a446b718d37120bbc68fe
@property def grainIDsLayer(self): 'Returns an array of grain IDs included in the surface\n ' return np.unique(self.elmtGrainLayer)
Returns an array of grain IDs included in the surface
fepx.py
grainIDsLayer
MechMicroMan/DefDAP-allan
0
python
@property def grainIDsLayer(self): '\n ' return np.unique(self.elmtGrainLayer)
@property def grainIDsLayer(self): '\n ' return np.unique(self.elmtGrainLayer)<|docstring|>Returns an array of grain IDs included in the surface<|endoftext|>
3c602cf35775e43ca261e10b893b528d473e5464a5c24652595f94567109d935
def uniform_weights(x, x_mask): 'Return uniform weights over non-masked x (a sequence of vectors).\n\n Args:\n x: batch * len * hdim\n x_mask: batch * len (1 for padding, 0 for true)\n Output:\n x_avg: batch * hdim\n ' alpha = torch.ones(x.size(0), x.size(1)) if x.data.is_cuda:...
Return uniform weights over non-masked x (a sequence of vectors). Args: x: batch * len * hdim x_mask: batch * len (1 for padding, 0 for true) Output: x_avg: batch * hdim
drqa/reader/layers.py
uniform_weights
litian6363/DrQA
4,500
python
def uniform_weights(x, x_mask): 'Return uniform weights over non-masked x (a sequence of vectors).\n\n Args:\n x: batch * len * hdim\n x_mask: batch * len (1 for padding, 0 for true)\n Output:\n x_avg: batch * hdim\n ' alpha = torch.ones(x.size(0), x.size(1)) if x.data.is_cuda:...
def uniform_weights(x, x_mask): 'Return uniform weights over non-masked x (a sequence of vectors).\n\n Args:\n x: batch * len * hdim\n x_mask: batch * len (1 for padding, 0 for true)\n Output:\n x_avg: batch * hdim\n ' alpha = torch.ones(x.size(0), x.size(1)) if x.data.is_cuda:...
c623ab4873d68c938d03feb384eb8266117a7249aaece3796a793369d6666b69
def weighted_avg(x, weights): 'Return a weighted average of x (a sequence of vectors).\n\n Args:\n x: batch * len * hdim\n weights: batch * len, sum(dim = 1) = 1\n Output:\n x_avg: batch * hdim\n ' return weights.unsqueeze(1).bmm(x).squeeze(1)
Return a weighted average of x (a sequence of vectors). Args: x: batch * len * hdim weights: batch * len, sum(dim = 1) = 1 Output: x_avg: batch * hdim
drqa/reader/layers.py
weighted_avg
litian6363/DrQA
4,500
python
def weighted_avg(x, weights): 'Return a weighted average of x (a sequence of vectors).\n\n Args:\n x: batch * len * hdim\n weights: batch * len, sum(dim = 1) = 1\n Output:\n x_avg: batch * hdim\n ' return weights.unsqueeze(1).bmm(x).squeeze(1)
def weighted_avg(x, weights): 'Return a weighted average of x (a sequence of vectors).\n\n Args:\n x: batch * len * hdim\n weights: batch * len, sum(dim = 1) = 1\n Output:\n x_avg: batch * hdim\n ' return weights.unsqueeze(1).bmm(x).squeeze(1)<|docstring|>Return a weighted average ...
12376e4cff8416cc11c5746cb2c051c2f9e574afc7f782e866560cec8dac0291
def forward(self, x, x_mask): 'Encode either padded or non-padded sequences.\n\n Can choose to either handle or ignore variable length sequences.\n Always handle padding in eval.\n\n Args:\n x: batch * len * hdim\n x_mask: batch * len (1 for padding, 0 for true)\n O...
Encode either padded or non-padded sequences. Can choose to either handle or ignore variable length sequences. Always handle padding in eval. Args: x: batch * len * hdim x_mask: batch * len (1 for padding, 0 for true) Output: x_encoded: batch * len * hdim_encoded
drqa/reader/layers.py
forward
litian6363/DrQA
4,500
python
def forward(self, x, x_mask): 'Encode either padded or non-padded sequences.\n\n Can choose to either handle or ignore variable length sequences.\n Always handle padding in eval.\n\n Args:\n x: batch * len * hdim\n x_mask: batch * len (1 for padding, 0 for true)\n O...
def forward(self, x, x_mask): 'Encode either padded or non-padded sequences.\n\n Can choose to either handle or ignore variable length sequences.\n Always handle padding in eval.\n\n Args:\n x: batch * len * hdim\n x_mask: batch * len (1 for padding, 0 for true)\n O...
13cb7ae33767ad694210226c2c78358812cda998bf8faa63ad06841f92189672
def _forward_unpadded(self, x, x_mask): 'Faster encoding that ignores any padding.' x = x.transpose(0, 1) outputs = [x] for i in range(self.num_layers): rnn_input = outputs[(- 1)] if (self.dropout_rate > 0): rnn_input = F.dropout(rnn_input, p=self.dropout_rate, training=self....
Faster encoding that ignores any padding.
drqa/reader/layers.py
_forward_unpadded
litian6363/DrQA
4,500
python
def _forward_unpadded(self, x, x_mask): x = x.transpose(0, 1) outputs = [x] for i in range(self.num_layers): rnn_input = outputs[(- 1)] if (self.dropout_rate > 0): rnn_input = F.dropout(rnn_input, p=self.dropout_rate, training=self.training) rnn_output = self.rnns[i]...
def _forward_unpadded(self, x, x_mask): x = x.transpose(0, 1) outputs = [x] for i in range(self.num_layers): rnn_input = outputs[(- 1)] if (self.dropout_rate > 0): rnn_input = F.dropout(rnn_input, p=self.dropout_rate, training=self.training) rnn_output = self.rnns[i]...
7371674c83287ce2dac3cc76c823e8f86f5198c07c05e29363520cc25f3a65f2
def _forward_padded(self, x, x_mask): 'Slower (significantly), but more precise, encoding that handles\n padding.\n ' lengths = x_mask.data.eq(0).long().sum(1).squeeze() (_, idx_sort) = torch.sort(lengths, dim=0, descending=True) (_, idx_unsort) = torch.sort(idx_sort, dim=0) lengths = ...
Slower (significantly), but more precise, encoding that handles padding.
drqa/reader/layers.py
_forward_padded
litian6363/DrQA
4,500
python
def _forward_padded(self, x, x_mask): 'Slower (significantly), but more precise, encoding that handles\n padding.\n ' lengths = x_mask.data.eq(0).long().sum(1).squeeze() (_, idx_sort) = torch.sort(lengths, dim=0, descending=True) (_, idx_unsort) = torch.sort(idx_sort, dim=0) lengths = ...
def _forward_padded(self, x, x_mask): 'Slower (significantly), but more precise, encoding that handles\n padding.\n ' lengths = x_mask.data.eq(0).long().sum(1).squeeze() (_, idx_sort) = torch.sort(lengths, dim=0, descending=True) (_, idx_unsort) = torch.sort(idx_sort, dim=0) lengths = ...
a65110fdce0f4929d753158013b0421f4478b0388cefdd79dfb6ca8ea9325632
def forward(self, x, y, y_mask): '\n Args:\n x: batch * len1 * hdim\n y: batch * len2 * hdim\n y_mask: batch * len2 (1 for padding, 0 for true)\n Output:\n matched_seq: batch * len1 * hdim\n ' if self.linear: x_proj = self.linear(x.view((-...
Args: x: batch * len1 * hdim y: batch * len2 * hdim y_mask: batch * len2 (1 for padding, 0 for true) Output: matched_seq: batch * len1 * hdim
drqa/reader/layers.py
forward
litian6363/DrQA
4,500
python
def forward(self, x, y, y_mask): '\n Args:\n x: batch * len1 * hdim\n y: batch * len2 * hdim\n y_mask: batch * len2 (1 for padding, 0 for true)\n Output:\n matched_seq: batch * len1 * hdim\n ' if self.linear: x_proj = self.linear(x.view((-...
def forward(self, x, y, y_mask): '\n Args:\n x: batch * len1 * hdim\n y: batch * len2 * hdim\n y_mask: batch * len2 (1 for padding, 0 for true)\n Output:\n matched_seq: batch * len1 * hdim\n ' if self.linear: x_proj = self.linear(x.view((-...
02cb33613cf4e1b4b5c1b2e35d7d7c58a3e60432d7f1957f5d272e47ef3fa78f
def forward(self, x, y, x_mask): '\n Args:\n x: batch * len * hdim1\n y: batch * hdim2\n x_mask: batch * len (1 for padding, 0 for true)\n Output:\n alpha = batch * len\n ' Wy = (self.linear(y) if (self.linear is not None) else y) xWy = x.bmm(...
Args: x: batch * len * hdim1 y: batch * hdim2 x_mask: batch * len (1 for padding, 0 for true) Output: alpha = batch * len
drqa/reader/layers.py
forward
litian6363/DrQA
4,500
python
def forward(self, x, y, x_mask): '\n Args:\n x: batch * len * hdim1\n y: batch * hdim2\n x_mask: batch * len (1 for padding, 0 for true)\n Output:\n alpha = batch * len\n ' Wy = (self.linear(y) if (self.linear is not None) else y) xWy = x.bmm(...
def forward(self, x, y, x_mask): '\n Args:\n x: batch * len * hdim1\n y: batch * hdim2\n x_mask: batch * len (1 for padding, 0 for true)\n Output:\n alpha = batch * len\n ' Wy = (self.linear(y) if (self.linear is not None) else y) xWy = x.bmm(...
339e1d7b8fc198b37895c32d327e9ff604f3c061cb586ad2ef18d9015cccd8c6
def forward(self, x, x_mask): '\n Args:\n x: batch * len * hdim\n x_mask: batch * len (1 for padding, 0 for true)\n Output:\n alpha: batch * len\n ' x_flat = x.view((- 1), x.size((- 1))) scores = self.linear(x_flat).view(x.size(0), x.size(1)) scores....
Args: x: batch * len * hdim x_mask: batch * len (1 for padding, 0 for true) Output: alpha: batch * len
drqa/reader/layers.py
forward
litian6363/DrQA
4,500
python
def forward(self, x, x_mask): '\n Args:\n x: batch * len * hdim\n x_mask: batch * len (1 for padding, 0 for true)\n Output:\n alpha: batch * len\n ' x_flat = x.view((- 1), x.size((- 1))) scores = self.linear(x_flat).view(x.size(0), x.size(1)) scores....
def forward(self, x, x_mask): '\n Args:\n x: batch * len * hdim\n x_mask: batch * len (1 for padding, 0 for true)\n Output:\n alpha: batch * len\n ' x_flat = x.view((- 1), x.size((- 1))) scores = self.linear(x_flat).view(x.size(0), x.size(1)) scores....
c8d8253b60ecc53db340219a67a5026ccde6627abf446eb47adf1d2f4eb12f57
def arity(function): '\n Return the arity of a function\n\n :param function: function\n :type function: ``function``\n\n :return: arity of the function\n :rtype: ``int``\n ' return len(inspect.getargspec(function).args)
Return the arity of a function :param function: function :type function: ``function`` :return: arity of the function :rtype: ``int``
testplan/common/utils/callable.py
arity
apretori-tic/testplan
0
python
def arity(function): '\n Return the arity of a function\n\n :param function: function\n :type function: ``function``\n\n :return: arity of the function\n :rtype: ``int``\n ' return len(inspect.getargspec(function).args)
def arity(function): '\n Return the arity of a function\n\n :param function: function\n :type function: ``function``\n\n :return: arity of the function\n :rtype: ``int``\n ' return len(inspect.getargspec(function).args)<|docstring|>Return the arity of a function :param function: function :typ...
6e72f345a7cd1218c95b5cf0fd936baacbccedea43f0e59067c448ecae07dbc0
def getargspec(callable_): '\n Return an Argspec for any callable object\n\n :param callable_: a callable object\n :type callable_: ``callable``\n\n :return: argspec for the callable\n :rtype: ``inspect.ArgSpec``\n ' if callable(callable_): if (inspect.ismethod(callable_) or inspect.is...
Return an Argspec for any callable object :param callable_: a callable object :type callable_: ``callable`` :return: argspec for the callable :rtype: ``inspect.ArgSpec``
testplan/common/utils/callable.py
getargspec
apretori-tic/testplan
0
python
def getargspec(callable_): '\n Return an Argspec for any callable object\n\n :param callable_: a callable object\n :type callable_: ``callable``\n\n :return: argspec for the callable\n :rtype: ``inspect.ArgSpec``\n ' if callable(callable_): if (inspect.ismethod(callable_) or inspect.is...
def getargspec(callable_): '\n Return an Argspec for any callable object\n\n :param callable_: a callable object\n :type callable_: ``callable``\n\n :return: argspec for the callable\n :rtype: ``inspect.ArgSpec``\n ' if callable(callable_): if (inspect.ismethod(callable_) or inspect.is...
f6c72358fdc01eea6af401d89b1335fdfa2be61e6ccd664a8737d05ff2c8794c
def update_wrapper(wrapper, wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=functools.WRAPPER_UPDATES): '\n Update a wrapper function to look like the wrapped function.\n\n :param wrapper: Function to be updated.\n :type wrapper: ``func``\n :param wrapped: Original function.\n :type wrapped: ``func``\...
Update a wrapper function to look like the wrapped function. :param wrapper: Function to be updated. :type wrapper: ``func`` :param wrapped: Original function. :type wrapped: ``func`` :param assigned: Tuple naming the attributes assigned directly from the wrapped function to the wrapper function (defa...
testplan/common/utils/callable.py
update_wrapper
apretori-tic/testplan
0
python
def update_wrapper(wrapper, wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=functools.WRAPPER_UPDATES): '\n Update a wrapper function to look like the wrapped function.\n\n :param wrapper: Function to be updated.\n :type wrapper: ``func``\n :param wrapped: Original function.\n :type wrapped: ``func``\...
def update_wrapper(wrapper, wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=functools.WRAPPER_UPDATES): '\n Update a wrapper function to look like the wrapped function.\n\n :param wrapper: Function to be updated.\n :type wrapper: ``func``\n :param wrapped: Original function.\n :type wrapped: ``func``\...
8f9ff76b15674f396ca30a365b7f7fde2a49d2cc2d47c14efc0f60e23ae1a07f
def wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=functools.WRAPPER_UPDATES): '\n Custom wraps function that uses the backported ``update_wrapper``.\n\n Also sets ``wrapper_of`` attribute for code highlighting, for methods that\n are decorated for the first time.\n ' def _inner(wrapper): ...
Custom wraps function that uses the backported ``update_wrapper``. Also sets ``wrapper_of`` attribute for code highlighting, for methods that are decorated for the first time.
testplan/common/utils/callable.py
wraps
apretori-tic/testplan
0
python
def wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=functools.WRAPPER_UPDATES): '\n Custom wraps function that uses the backported ``update_wrapper``.\n\n Also sets ``wrapper_of`` attribute for code highlighting, for methods that\n are decorated for the first time.\n ' def _inner(wrapper): ...
def wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=functools.WRAPPER_UPDATES): '\n Custom wraps function that uses the backported ``update_wrapper``.\n\n Also sets ``wrapper_of`` attribute for code highlighting, for methods that\n are decorated for the first time.\n ' def _inner(wrapper): ...
32e0f7bcbf17ef84c75cbf0ec61df110c4b931314c7692261e09bf151e134eb0
@staticmethod def phase_from_date(date: datetime.date, time_of_day: Optional[TimeOfDay]) -> Optional[int]: '\n Get the phase index value for a given date and time of day (AM/PM).\n\n :param date: the date of the price phase.\n :param time_of_day: the time of day for the price phase.\n\n ...
Get the phase index value for a given date and time of day (AM/PM). :param date: the date of the price phase. :param time_of_day: the time of day for the price phase. :returns: either the phase index or ``None`` if this is a sunday.
stalkbroker/models/_ticker.py
phase_from_date
peake100/stalkbroker-py
0
python
@staticmethod def phase_from_date(date: datetime.date, time_of_day: Optional[TimeOfDay]) -> Optional[int]: '\n Get the phase index value for a given date and time of day (AM/PM).\n\n :param date: the date of the price phase.\n :param time_of_day: the time of day for the price phase.\n\n ...
@staticmethod def phase_from_date(date: datetime.date, time_of_day: Optional[TimeOfDay]) -> Optional[int]: '\n Get the phase index value for a given date and time of day (AM/PM).\n\n :param date: the date of the price phase.\n :param time_of_day: the time of day for the price phase.\n\n ...
04c1ed5cf7f4daaa1d9bda724b6691729adad7f24c039ae18c1fdff8066d82d5
@staticmethod def phase_from_datetime(dt: datetime.datetime) -> Optional[int]: '\n Get the phase index value for a given datetime.\n\n :param dt: the date of the price phase.\n\n :returns: either the phase index or ``None`` if this is a sunday.\n ' if (dt.hour < 12): time_of_...
Get the phase index value for a given datetime. :param dt: the date of the price phase. :returns: either the phase index or ``None`` if this is a sunday.
stalkbroker/models/_ticker.py
phase_from_datetime
peake100/stalkbroker-py
0
python
@staticmethod def phase_from_datetime(dt: datetime.datetime) -> Optional[int]: '\n Get the phase index value for a given datetime.\n\n :param dt: the date of the price phase.\n\n :returns: either the phase index or ``None`` if this is a sunday.\n ' if (dt.hour < 12): time_of_...
@staticmethod def phase_from_datetime(dt: datetime.datetime) -> Optional[int]: '\n Get the phase index value for a given datetime.\n\n :param dt: the date of the price phase.\n\n :returns: either the phase index or ``None`` if this is a sunday.\n ' if (dt.hour < 12): time_of_...
e5073c6e9fcc6c62bc982304990ad3671cafafadc008694e1ec29cfc33fe7641
@staticmethod def phase_name(phase: int) -> str: '\n Return the name to use in reports for a given price phase.\n\n :param phase: the index of the price phase. Use ``-1`` for sunday.\n\n :returns: phase name.\n ' if (phase == (- 1)): return "Daisey's Deal" day = (phase //...
Return the name to use in reports for a given price phase. :param phase: the index of the price phase. Use ``-1`` for sunday. :returns: phase name.
stalkbroker/models/_ticker.py
phase_name
peake100/stalkbroker-py
0
python
@staticmethod def phase_name(phase: int) -> str: '\n Return the name to use in reports for a given price phase.\n\n :param phase: the index of the price phase. Use ``-1`` for sunday.\n\n :returns: phase name.\n ' if (phase == (- 1)): return "Daisey's Deal" day = (phase //...
@staticmethod def phase_name(phase: int) -> str: '\n Return the name to use in reports for a given price phase.\n\n :param phase: the index of the price phase. Use ``-1`` for sunday.\n\n :returns: phase name.\n ' if (phase == (- 1)): return "Daisey's Deal" day = (phase //...
9ecda71066be83c0121543de60ad0d0e5af6fbce36774c2d4efabac95dcacc0d
def for_date(self, date: datetime.date, time_of_day: Optional[TimeOfDay]) -> PhaseInfo: '\n Return the phase info for a given date described by this ticker.\n\n :param date: the date of the desired phase info.\n :param time_of_day: the time of day (AM/PM of the desired phase info).\n ...
Return the phase info for a given date described by this ticker. :param date: the date of the desired phase info. :param time_of_day: the time of day (AM/PM of the desired phase info). Can be ``None`` if this is a sunday.
stalkbroker/models/_ticker.py
for_date
peake100/stalkbroker-py
0
python
def for_date(self, date: datetime.date, time_of_day: Optional[TimeOfDay]) -> PhaseInfo: '\n Return the phase info for a given date described by this ticker.\n\n :param date: the date of the desired phase info.\n :param time_of_day: the time of day (AM/PM of the desired phase info).\n ...
def for_date(self, date: datetime.date, time_of_day: Optional[TimeOfDay]) -> PhaseInfo: '\n Return the phase info for a given date described by this ticker.\n\n :param date: the date of the desired phase info.\n :param time_of_day: the time of day (AM/PM of the desired phase info).\n ...
818f71acd6311ef7272b48cb97e66fb88d33e3a059135707665ffc6baa9b8a4e
def set_price(self, price: int, date: datetime.date, time_of_day: Optional[TimeOfDay]) -> None: '\n Set the price for a phase in the week described by the date and time of day.\n\n :param price: Turnip price to set.\n :param date: The date this price occurred on.\n :param time_of_day: Th...
Set the price for a phase in the week described by the date and time of day. :param price: Turnip price to set. :param date: The date this price occurred on. :param time_of_day: The time of day this price occurred on. Can be ``None`` if this is a sunday
stalkbroker/models/_ticker.py
set_price
peake100/stalkbroker-py
0
python
def set_price(self, price: int, date: datetime.date, time_of_day: Optional[TimeOfDay]) -> None: '\n Set the price for a phase in the week described by the date and time of day.\n\n :param price: Turnip price to set.\n :param date: The date this price occurred on.\n :param time_of_day: Th...
def set_price(self, price: int, date: datetime.date, time_of_day: Optional[TimeOfDay]) -> None: '\n Set the price for a phase in the week described by the date and time of day.\n\n :param price: Turnip price to set.\n :param date: The date this price occurred on.\n :param time_of_day: Th...
ac80fdce54e477529c2c185d7a728d3260c828e0844d72c1e939051a405fc2d5
async def _validate_input(data: dict[(str, Any)]) -> tuple[(str, str)]: 'Validate the user input allows us to connect.' bond = Bond(data[CONF_HOST], data[CONF_ACCESS_TOKEN]) try: hub = BondHub(bond) (await hub.setup(max_devices=1)) except ClientConnectionError as error: raise Inp...
Validate the user input allows us to connect.
homeassistant/components/bond/config_flow.py
_validate_input
xonestonex/core
1
python
async def _validate_input(data: dict[(str, Any)]) -> tuple[(str, str)]: bond = Bond(data[CONF_HOST], data[CONF_ACCESS_TOKEN]) try: hub = BondHub(bond) (await hub.setup(max_devices=1)) except ClientConnectionError as error: raise InputValidationError('cannot_connect') from error ...
async def _validate_input(data: dict[(str, Any)]) -> tuple[(str, str)]: bond = Bond(data[CONF_HOST], data[CONF_ACCESS_TOKEN]) try: hub = BondHub(bond) (await hub.setup(max_devices=1)) except ClientConnectionError as error: raise InputValidationError('cannot_connect') from error ...
b23bbea8734f8b5718a52859d0cd34e1ad58f164c33f6e369101c6f98f20b705
def __init__(self) -> None: 'Initialize config flow.' self._discovered: dict[(str, str)] = {}
Initialize config flow.
homeassistant/components/bond/config_flow.py
__init__
xonestonex/core
1
python
def __init__(self) -> None: self._discovered: dict[(str, str)] = {}
def __init__(self) -> None: self._discovered: dict[(str, str)] = {}<|docstring|>Initialize config flow.<|endoftext|>
a91dcf3ffc4d6d211ee3d860a1e6f06ab4e85a065e4db1ca6087715659d352f9
async def _async_try_automatic_configure(self) -> None: 'Try to auto configure the device.\n\n Failure is acceptable here since the device may have been\n online longer then the allowed setup period, and we will\n instead ask them to manually enter the token.\n ' bond = Bond(self._di...
Try to auto configure the device. Failure is acceptable here since the device may have been online longer then the allowed setup period, and we will instead ask them to manually enter the token.
homeassistant/components/bond/config_flow.py
_async_try_automatic_configure
xonestonex/core
1
python
async def _async_try_automatic_configure(self) -> None: 'Try to auto configure the device.\n\n Failure is acceptable here since the device may have been\n online longer then the allowed setup period, and we will\n instead ask them to manually enter the token.\n ' bond = Bond(self._di...
async def _async_try_automatic_configure(self) -> None: 'Try to auto configure the device.\n\n Failure is acceptable here since the device may have been\n online longer then the allowed setup period, and we will\n instead ask them to manually enter the token.\n ' bond = Bond(self._di...
84e8f8302ea353550cbb6ef7b249bf4c4277702abd5a8ec912a6140e1ee54da2
async def async_step_zeroconf(self, discovery_info: DiscoveryInfoType) -> dict[(str, Any)]: 'Handle a flow initialized by zeroconf discovery.' name: str = discovery_info[CONF_NAME] host: str = discovery_info[CONF_HOST] bond_id = name.partition('.')[0] (await self.async_set_unique_id(bond_id)) se...
Handle a flow initialized by zeroconf discovery.
homeassistant/components/bond/config_flow.py
async_step_zeroconf
xonestonex/core
1
python
async def async_step_zeroconf(self, discovery_info: DiscoveryInfoType) -> dict[(str, Any)]: name: str = discovery_info[CONF_NAME] host: str = discovery_info[CONF_HOST] bond_id = name.partition('.')[0] (await self.async_set_unique_id(bond_id)) self._abort_if_unique_id_configured({CONF_HOST: host...
async def async_step_zeroconf(self, discovery_info: DiscoveryInfoType) -> dict[(str, Any)]: name: str = discovery_info[CONF_NAME] host: str = discovery_info[CONF_HOST] bond_id = name.partition('.')[0] (await self.async_set_unique_id(bond_id)) self._abort_if_unique_id_configured({CONF_HOST: host...
70e90043db9f72c5429d5db6cf2ec101508d6226a8fd9eee6325f14ff67317a1
async def async_step_confirm(self, user_input: (dict[(str, Any)] | None)=None) -> dict[(str, Any)]: 'Handle confirmation flow for discovered bond hub.' errors = {} if (user_input is not None): if (CONF_ACCESS_TOKEN in self._discovered): return self.async_create_entry(title=self._discover...
Handle confirmation flow for discovered bond hub.
homeassistant/components/bond/config_flow.py
async_step_confirm
xonestonex/core
1
python
async def async_step_confirm(self, user_input: (dict[(str, Any)] | None)=None) -> dict[(str, Any)]: errors = {} if (user_input is not None): if (CONF_ACCESS_TOKEN in self._discovered): return self.async_create_entry(title=self._discovered[CONF_NAME], data={CONF_ACCESS_TOKEN: self._disco...
async def async_step_confirm(self, user_input: (dict[(str, Any)] | None)=None) -> dict[(str, Any)]: errors = {} if (user_input is not None): if (CONF_ACCESS_TOKEN in self._discovered): return self.async_create_entry(title=self._discovered[CONF_NAME], data={CONF_ACCESS_TOKEN: self._disco...
c27d66c7d62c0781d030df0859da684d89e839a266ce23a1a884025353bb6d61
async def async_step_user(self, user_input: (dict[(str, Any)] | None)=None) -> dict[(str, Any)]: 'Handle a flow initialized by the user.' errors = {} if (user_input is not None): try: (bond_id, hub_name) = (await _validate_input(user_input)) except InputValidationError as error: ...
Handle a flow initialized by the user.
homeassistant/components/bond/config_flow.py
async_step_user
xonestonex/core
1
python
async def async_step_user(self, user_input: (dict[(str, Any)] | None)=None) -> dict[(str, Any)]: errors = {} if (user_input is not None): try: (bond_id, hub_name) = (await _validate_input(user_input)) except InputValidationError as error: errors['base'] = error.base ...
async def async_step_user(self, user_input: (dict[(str, Any)] | None)=None) -> dict[(str, Any)]: errors = {} if (user_input is not None): try: (bond_id, hub_name) = (await _validate_input(user_input)) except InputValidationError as error: errors['base'] = error.base ...
eafb7e9533312c22fb986e74494c32179da60e5e8444063e1069f015a5b985e4
def __init__(self, base: str): 'Initialize with error base.' super().__init__() self.base = base
Initialize with error base.
homeassistant/components/bond/config_flow.py
__init__
xonestonex/core
1
python
def __init__(self, base: str): super().__init__() self.base = base
def __init__(self, base: str): super().__init__() self.base = base<|docstring|>Initialize with error base.<|endoftext|>
e60003f9a30c5e059f87f05b16f076d31cfec9bd2962aad742215fda170b10e4
def __init__(self, key, nxt=None): 'Initialize the SLLNode.\n\n Args:\n key (T): the key of this node.\n value(V): the payload of this node.\n nxt (Optional[Node]): the next node of this node.\n ' self._key: T = key self._next: Optional[SLLNode] = nxt
Initialize the SLLNode. Args: key (T): the key of this node. value(V): the payload of this node. nxt (Optional[Node]): the next node of this node.
ads/fundamentals/_nodes.py
__init__
Aminul-Momin/Algorithms_and_Data_Structures
0
python
def __init__(self, key, nxt=None): 'Initialize the SLLNode.\n\n Args:\n key (T): the key of this node.\n value(V): the payload of this node.\n nxt (Optional[Node]): the next node of this node.\n ' self._key: T = key self._next: Optional[SLLNode] = nxt
def __init__(self, key, nxt=None): 'Initialize the SLLNode.\n\n Args:\n key (T): the key of this node.\n value(V): the payload of this node.\n nxt (Optional[Node]): the next node of this node.\n ' self._key: T = key self._next: Optional[SLLNode] = nxt<|docstrin...
aa0c10ab8a7e99950d5c0266fd759efff479f87176ed7782e0ab55a7139bb30f
def __init__(self, key, nxt=None, prev=None): 'Initialize the DLLNode.\n\n Args:\n key (T): the key of this node.\n value(V): the payload of this node.\n nxt (Optional[Node]): the next node of this node.\n prev (Optional[Node]): the previous node of this node.\n ...
Initialize the DLLNode. Args: key (T): the key of this node. value(V): the payload of this node. nxt (Optional[Node]): the next node of this node. prev (Optional[Node]): the previous node of this node.
ads/fundamentals/_nodes.py
__init__
Aminul-Momin/Algorithms_and_Data_Structures
0
python
def __init__(self, key, nxt=None, prev=None): 'Initialize the DLLNode.\n\n Args:\n key (T): the key of this node.\n value(V): the payload of this node.\n nxt (Optional[Node]): the next node of this node.\n prev (Optional[Node]): the previous node of this node.\n ...
def __init__(self, key, nxt=None, prev=None): 'Initialize the DLLNode.\n\n Args:\n key (T): the key of this node.\n value(V): the payload of this node.\n nxt (Optional[Node]): the next node of this node.\n prev (Optional[Node]): the previous node of this node.\n ...
304925143c9ae2f9320eb7db4dca1a37fa29beb56eb3dabada651c7a05aeee77
def _plot_foil(foil, N_sections=21, N_points=50, geometry='airfoils', flatten=False, ax=None): 'Plot a FoilGeometry in 3D.' if (ax is None): (fig, ax) = _create_3d_axes() ax.set_proj_type('ortho') independent_plot = True else: independent_plot = False sa = (1 - np.cos(np....
Plot a FoilGeometry in 3D.
source/figures/paraglider/geometry/canopy/examples/generate_canopy_examples.py
_plot_foil
pfheatwole/thesis
0
python
def _plot_foil(foil, N_sections=21, N_points=50, geometry='airfoils', flatten=False, ax=None): if (ax is None): (fig, ax) = _create_3d_axes() ax.set_proj_type('ortho') independent_plot = True else: independent_plot = False sa = (1 - np.cos(np.linspace((np.pi / 2), 0, N_p...
def _plot_foil(foil, N_sections=21, N_points=50, geometry='airfoils', flatten=False, ax=None): if (ax is None): (fig, ax) = _create_3d_axes() ax.set_proj_type('ortho') independent_plot = True else: independent_plot = False sa = (1 - np.cos(np.linspace((np.pi / 2), 0, N_p...
9ea0e1b01e55c5da45bae6b9a5b73de638d813205de36eb196b5e8fd2517d4c4
def __init__(self, username, password, **kwargs): "\n\n :param username: Login username\n :param password: Login password\n :param kwargs: See below\n\n :Keyword Arguments:\n - **auto_patch**: Patch the api objects to match the public API. Default: False\n - **drop_...
:param username: Login username :param password: Login password :param kwargs: See below :Keyword Arguments: - **auto_patch**: Patch the api objects to match the public API. Default: False - **drop_incompat_key**: Remove api object keys that is not in the public API. Default: False - **timeout**: Timeout i...
client.py
__init__
tomLamprecht/PepperNaoInstagram
1
python
def __init__(self, username, password, **kwargs): "\n\n :param username: Login username\n :param password: Login password\n :param kwargs: See below\n\n :Keyword Arguments:\n - **auto_patch**: Patch the api objects to match the public API. Default: False\n - **drop_...
def __init__(self, username, password, **kwargs): "\n\n :param username: Login username\n :param password: Login password\n :param kwargs: See below\n\n :Keyword Arguments:\n - **auto_patch**: Patch the api objects to match the public API. Default: False\n - **drop_...
2039222bdf7c9887ff9f9ab339bd2dcd47e666fc966709bd1fc88c00637ee9bb
@property def settings(self): 'Helper property that extracts the settings that you should cache\n in addition to username and password.' return {'uuid': self.uuid, 'device_id': self.device_id, 'ad_id': self.ad_id, 'cookie': self.cookie_jar.dump(), 'created_ts': int(time.time())}
Helper property that extracts the settings that you should cache in addition to username and password.
client.py
settings
tomLamprecht/PepperNaoInstagram
1
python
@property def settings(self): 'Helper property that extracts the settings that you should cache\n in addition to username and password.' return {'uuid': self.uuid, 'device_id': self.device_id, 'ad_id': self.ad_id, 'cookie': self.cookie_jar.dump(), 'created_ts': int(time.time())}
@property def settings(self): 'Helper property that extracts the settings that you should cache\n in addition to username and password.' return {'uuid': self.uuid, 'device_id': self.device_id, 'ad_id': self.ad_id, 'cookie': self.cookie_jar.dump(), 'created_ts': int(time.time())}<|docstring|>Helper proper...
83817bd62452b0a46da2ec05f66c1937c87d41e8f915be9106e1d39564da1325
@property def user_agent(self): 'Returns the useragent string that the client is currently using.' return (Constants.USER_AGENT_FORMAT % {'app_version': self.app_version, 'android_version': self.android_version, 'android_release': self.android_release, 'brand': self.phone_manufacturer, 'device': self.phone_devi...
Returns the useragent string that the client is currently using.
client.py
user_agent
tomLamprecht/PepperNaoInstagram
1
python
@property def user_agent(self): return (Constants.USER_AGENT_FORMAT % {'app_version': self.app_version, 'android_version': self.android_version, 'android_release': self.android_release, 'brand': self.phone_manufacturer, 'device': self.phone_device, 'model': self.phone_model, 'dpi': self.phone_dpi, 'resolution'...
@property def user_agent(self): return (Constants.USER_AGENT_FORMAT % {'app_version': self.app_version, 'android_version': self.android_version, 'android_release': self.android_release, 'brand': self.phone_manufacturer, 'device': self.phone_device, 'model': self.phone_model, 'dpi': self.phone_dpi, 'resolution'...
e30ec1cf5487a942059600990f9611d3cf4e0bea72e8be63324b3496a8e14a8b
@user_agent.setter def user_agent(self, value): 'Override the useragent string with your own' mobj = re.search(Constants.USER_AGENT_EXPRESSION, value) if (not mobj): raise ValueError('User-agent specified does not fit format required: {0!s}'.format(Constants.USER_AGENT_EXPRESSION)) self.app_vers...
Override the useragent string with your own
client.py
user_agent
tomLamprecht/PepperNaoInstagram
1
python
@user_agent.setter def user_agent(self, value): mobj = re.search(Constants.USER_AGENT_EXPRESSION, value) if (not mobj): raise ValueError('User-agent specified does not fit format required: {0!s}'.format(Constants.USER_AGENT_EXPRESSION)) self.app_version = mobj.group('app_version') self.andr...
@user_agent.setter def user_agent(self, value): mobj = re.search(Constants.USER_AGENT_EXPRESSION, value) if (not mobj): raise ValueError('User-agent specified does not fit format required: {0!s}'.format(Constants.USER_AGENT_EXPRESSION)) self.app_version = mobj.group('app_version') self.andr...
384aceffa46d75903fb6c6c0eb2854865f4717ea2f4f66a8a877f82d75ec6599
@staticmethod def generate_useragent(**kwargs): '\n Helper method to generate a useragent string based on device parameters\n\n :param kwargs:\n - **app_version**\n - **android_version**\n - **android_release**\n - **brand**\n - **device**\n ...
Helper method to generate a useragent string based on device parameters :param kwargs: - **app_version** - **android_version** - **android_release** - **brand** - **device** - **model** - **dpi** - **resolution** - **chipset** :return: A compatible user agent string
client.py
generate_useragent
tomLamprecht/PepperNaoInstagram
1
python
@staticmethod def generate_useragent(**kwargs): '\n Helper method to generate a useragent string based on device parameters\n\n :param kwargs:\n - **app_version**\n - **android_version**\n - **android_release**\n - **brand**\n - **device**\n ...
@staticmethod def generate_useragent(**kwargs): '\n Helper method to generate a useragent string based on device parameters\n\n :param kwargs:\n - **app_version**\n - **android_version**\n - **android_release**\n - **brand**\n - **device**\n ...
fb8f3004382d5d44eff7ee0916817bded8491320c4974f561fe2b6a478e5cf2b
@staticmethod def validate_useragent(value): '\n Helper method to validate a useragent string for format correctness\n\n :param value:\n :return:\n ' mobj = re.search(Constants.USER_AGENT_EXPRESSION, value) if (not mobj): raise ValueError('User-agent specified does not fi...
Helper method to validate a useragent string for format correctness :param value: :return:
client.py
validate_useragent
tomLamprecht/PepperNaoInstagram
1
python
@staticmethod def validate_useragent(value): '\n Helper method to validate a useragent string for format correctness\n\n :param value:\n :return:\n ' mobj = re.search(Constants.USER_AGENT_EXPRESSION, value) if (not mobj): raise ValueError('User-agent specified does not fi...
@staticmethod def validate_useragent(value): '\n Helper method to validate a useragent string for format correctness\n\n :param value:\n :return:\n ' mobj = re.search(Constants.USER_AGENT_EXPRESSION, value) if (not mobj): raise ValueError('User-agent specified does not fi...
426ba99f077e924968b623cdf39b08330da0f1cfef7b0e0053e436a44319e83d
@property def csrftoken(self): "The client's current csrf token" return self.get_cookie_value('csrftoken')
The client's current csrf token
client.py
csrftoken
tomLamprecht/PepperNaoInstagram
1
python
@property def csrftoken(self): return self.get_cookie_value('csrftoken')
@property def csrftoken(self): return self.get_cookie_value('csrftoken')<|docstring|>The client's current csrf token<|endoftext|>
0931e8ce8b8af6fa3ba561e6a8037dfa52c4ab108682da5a47b08472e0c35bb2
@property def token(self): 'For compatibility. Equivalent to :meth:`csrftoken`' return self.csrftoken
For compatibility. Equivalent to :meth:`csrftoken`
client.py
token
tomLamprecht/PepperNaoInstagram
1
python
@property def token(self): return self.csrftoken
@property def token(self): return self.csrftoken<|docstring|>For compatibility. Equivalent to :meth:`csrftoken`<|endoftext|>
cedbc26aee56cf51b4c4068041247f08d4f1769c6d9c34160001ff9e22052b7f
@property def authenticated_user_id(self): 'The current authenticated user id' return self.get_cookie_value('ds_user_id')
The current authenticated user id
client.py
authenticated_user_id
tomLamprecht/PepperNaoInstagram
1
python
@property def authenticated_user_id(self): return self.get_cookie_value('ds_user_id')
@property def authenticated_user_id(self): return self.get_cookie_value('ds_user_id')<|docstring|>The current authenticated user id<|endoftext|>
3349772fe7640ba7f820cf47c7f0f30eeb98d4ed138c510483844ba63d3ab527
@property def authenticated_user_name(self): 'The current authenticated user name' return self.get_cookie_value('ds_user')
The current authenticated user name
client.py
authenticated_user_name
tomLamprecht/PepperNaoInstagram
1
python
@property def authenticated_user_name(self): return self.get_cookie_value('ds_user')
@property def authenticated_user_name(self): return self.get_cookie_value('ds_user')<|docstring|>The current authenticated user name<|endoftext|>
a0b64c86a867b7ef0a6b0d87bdc2c8d6b4c986dcb73be9f33a87f40f815e8004
@property def phone_id(self): 'Current phone ID. For use in certain functions.' return self.generate_uuid(return_hex=False, seed=self.device_id)
Current phone ID. For use in certain functions.
client.py
phone_id
tomLamprecht/PepperNaoInstagram
1
python
@property def phone_id(self): return self.generate_uuid(return_hex=False, seed=self.device_id)
@property def phone_id(self): return self.generate_uuid(return_hex=False, seed=self.device_id)<|docstring|>Current phone ID. For use in certain functions.<|endoftext|>
e959dcbba9957b29e07d3aa2be4b172f488a661146391face8e11a6e70948f75
@property def timezone_offset(self): 'Timezone offset in seconds. For use in certain functions.' return int(round((datetime.now() - datetime.utcnow()).total_seconds()))
Timezone offset in seconds. For use in certain functions.
client.py
timezone_offset
tomLamprecht/PepperNaoInstagram
1
python
@property def timezone_offset(self): return int(round((datetime.now() - datetime.utcnow()).total_seconds()))
@property def timezone_offset(self): return int(round((datetime.now() - datetime.utcnow()).total_seconds()))<|docstring|>Timezone offset in seconds. For use in certain functions.<|endoftext|>
3a8563cc19095655bb6ec52c70134c76e05856ef67205feb1b46dced2e75fb03
@property def cookie_jar(self): "The client's cookiejar instance." return self.opener.cookie_jar
The client's cookiejar instance.
client.py
cookie_jar
tomLamprecht/PepperNaoInstagram
1
python
@property def cookie_jar(self): return self.opener.cookie_jar
@property def cookie_jar(self): return self.opener.cookie_jar<|docstring|>The client's cookiejar instance.<|endoftext|>
677d7a3ae079474098a8de057db1d90f0535961714ed93f5e2c6b5b3fa4de2e9
@property def radio_type(self): 'For use in certain endpoints' return 'wifi-none'
For use in certain endpoints
client.py
radio_type
tomLamprecht/PepperNaoInstagram
1
python
@property def radio_type(self): return 'wifi-none'
@property def radio_type(self): return 'wifi-none'<|docstring|>For use in certain endpoints<|endoftext|>
cec2b1319c75645e6fa7214057affe8fb94055e81eb93662f7461d0ff979225f
def _generate_signature(self, data): '\n Generates the signature for a data string\n\n :param data: content to be signed\n :return:\n ' return hmac.new(self.signature_key.encode('utf-8'), data.encode('utf-8'), digestmod=hashlib.sha256).hexdigest()
Generates the signature for a data string :param data: content to be signed :return:
client.py
_generate_signature
tomLamprecht/PepperNaoInstagram
1
python
def _generate_signature(self, data): '\n Generates the signature for a data string\n\n :param data: content to be signed\n :return:\n ' return hmac.new(self.signature_key.encode('utf-8'), data.encode('utf-8'), digestmod=hashlib.sha256).hexdigest()
def _generate_signature(self, data): '\n Generates the signature for a data string\n\n :param data: content to be signed\n :return:\n ' return hmac.new(self.signature_key.encode('utf-8'), data.encode('utf-8'), digestmod=hashlib.sha256).hexdigest()<|docstring|>Generates the signature ...
88a8e8845d5a49b71cbe5c498942d9a41783903f1932b54c7aa4ad54effa9a4f
@classmethod def generate_uuid(cls, return_hex=False, seed=None): '\n Generate uuid\n\n :param return_hex: Return in hex format\n :param seed: Seed value to generate a consistent uuid\n :return:\n ' if seed: m = hashlib.md5() m.update(seed.encode('utf-8')) ...
Generate uuid :param return_hex: Return in hex format :param seed: Seed value to generate a consistent uuid :return:
client.py
generate_uuid
tomLamprecht/PepperNaoInstagram
1
python
@classmethod def generate_uuid(cls, return_hex=False, seed=None): '\n Generate uuid\n\n :param return_hex: Return in hex format\n :param seed: Seed value to generate a consistent uuid\n :return:\n ' if seed: m = hashlib.md5() m.update(seed.encode('utf-8')) ...
@classmethod def generate_uuid(cls, return_hex=False, seed=None): '\n Generate uuid\n\n :param return_hex: Return in hex format\n :param seed: Seed value to generate a consistent uuid\n :return:\n ' if seed: m = hashlib.md5() m.update(seed.encode('utf-8')) ...
faad4f6890213df3f2a9672997078c324adf1b0cdaf0ebaa75fe249e2c22d0e7
@classmethod def generate_deviceid(cls, seed=None): '\n Generate an android device ID\n\n :param seed: Seed value to generate a consistent device ID\n :return:\n ' return 'android-{0!s}'.format(cls.generate_uuid(True, seed)[:16])
Generate an android device ID :param seed: Seed value to generate a consistent device ID :return:
client.py
generate_deviceid
tomLamprecht/PepperNaoInstagram
1
python
@classmethod def generate_deviceid(cls, seed=None): '\n Generate an android device ID\n\n :param seed: Seed value to generate a consistent device ID\n :return:\n ' return 'android-{0!s}'.format(cls.generate_uuid(True, seed)[:16])
@classmethod def generate_deviceid(cls, seed=None): '\n Generate an android device ID\n\n :param seed: Seed value to generate a consistent device ID\n :return:\n ' return 'android-{0!s}'.format(cls.generate_uuid(True, seed)[:16])<|docstring|>Generate an android device ID :param seed...
6d616cad124dea7e97ed7c8d3aa9d37acc958d74247ce67e6d8f73a3bf5e5920
def generate_adid(self, seed=None): '\n Generate an Advertising ID based on the login username since\n the Google Ad ID is a personally identifying but resettable ID.\n\n :return:\n ' modified_seed = (seed or self.authenticated_user_name or self.username) if modified_seed: ...
Generate an Advertising ID based on the login username since the Google Ad ID is a personally identifying but resettable ID. :return:
client.py
generate_adid
tomLamprecht/PepperNaoInstagram
1
python
def generate_adid(self, seed=None): '\n Generate an Advertising ID based on the login username since\n the Google Ad ID is a personally identifying but resettable ID.\n\n :return:\n ' modified_seed = (seed or self.authenticated_user_name or self.username) if modified_seed: ...
def generate_adid(self, seed=None): '\n Generate an Advertising ID based on the login username since\n the Google Ad ID is a personally identifying but resettable ID.\n\n :return:\n ' modified_seed = (seed or self.authenticated_user_name or self.username) if modified_seed: ...
d06e1f7e1946c1216beeff5a97b3992a7a5886b88b9ac968c3d9e5235d3ba59e
@staticmethod def _read_response(response): '\n Extract the response body from a http response.\n\n :param response:\n :return:\n ' if (response.info().get('Content-Encoding') == 'gzip'): buf = BytesIO(response.read()) res = gzip.GzipFile(fileobj=buf).read().decode('u...
Extract the response body from a http response. :param response: :return:
client.py
_read_response
tomLamprecht/PepperNaoInstagram
1
python
@staticmethod def _read_response(response): '\n Extract the response body from a http response.\n\n :param response:\n :return:\n ' if (response.info().get('Content-Encoding') == 'gzip'): buf = BytesIO(response.read()) res = gzip.GzipFile(fileobj=buf).read().decode('u...
@staticmethod def _read_response(response): '\n Extract the response body from a http response.\n\n :param response:\n :return:\n ' if (response.info().get('Content-Encoding') == 'gzip'): buf = BytesIO(response.read()) res = gzip.GzipFile(fileobj=buf).read().decode('u...
ad83b27e9e0f037d9bd503794f7d4044982dc9eeaf147f2912075123bf8b9a28
def _call_api(self, endpoint, params=None, query=None, return_response=False, unsigned=False, version='v1'): "\n Calls the private api.\n\n :param endpoint: endpoint path that should end with '/', example 'discover/explore/'\n :param params: POST parameters\n :param query: GET url query ...
Calls the private api. :param endpoint: endpoint path that should end with '/', example 'discover/explore/' :param params: POST parameters :param query: GET url query parameters :param return_response: return the response instead of the parsed json object :param unsigned: use post params as-is without signing :param v...
client.py
_call_api
tomLamprecht/PepperNaoInstagram
1
python
def _call_api(self, endpoint, params=None, query=None, return_response=False, unsigned=False, version='v1'): "\n Calls the private api.\n\n :param endpoint: endpoint path that should end with '/', example 'discover/explore/'\n :param params: POST parameters\n :param query: GET url query ...
def _call_api(self, endpoint, params=None, query=None, return_response=False, unsigned=False, version='v1'): "\n Calls the private api.\n\n :param endpoint: endpoint path that should end with '/', example 'discover/explore/'\n :param params: POST parameters\n :param query: GET url query ...
6d813bea4a77434703d8cb6c9f6a1c76503cf2f6fcfecb7616986ca7bf71c01c
def make_derived_maps_for_site(site_name: str, output_root: Path) -> None: 'Generate derived maps for `site_name`.\n\n These maps will be put in the directory `<output_root>/<site_name>`.\n ' initial_dir = os.getcwd() try: os.chdir((output_root / site_name)) except FileNotFoundError: ...
Generate derived maps for `site_name`. These maps will be put in the directory `<output_root>/<site_name>`.
dem-derived/make_derived_layers.py
make_derived_maps_for_site
lanecodes/agrosuccess-data
0
python
def make_derived_maps_for_site(site_name: str, output_root: Path) -> None: 'Generate derived maps for `site_name`.\n\n These maps will be put in the directory `<output_root>/<site_name>`.\n ' initial_dir = os.getcwd() try: os.chdir((output_root / site_name)) except FileNotFoundError: ...
def make_derived_maps_for_site(site_name: str, output_root: Path) -> None: 'Generate derived maps for `site_name`.\n\n These maps will be put in the directory `<output_root>/<site_name>`.\n ' initial_dir = os.getcwd() try: os.chdir((output_root / site_name)) except FileNotFoundError: ...
ce5b96767775b857108c709eb5f085d5ffb63aef2070edae1c779de0b676f5d1
def _make_soil_maps_for_site(site_name: str, output_root: Path) -> None: 'Generate uniform soil maps for named site.\n\n Uses hydrologically correct DEM for site as a template to ensure resulting\n soil map has the correct dimensions and geographical projection.\n ' initial_dir = os.getcwd() output...
Generate uniform soil maps for named site. Uses hydrologically correct DEM for site as a template to ensure resulting soil map has the correct dimensions and geographical projection.
dem-derived/make_derived_layers.py
_make_soil_maps_for_site
lanecodes/agrosuccess-data
0
python
def _make_soil_maps_for_site(site_name: str, output_root: Path) -> None: 'Generate uniform soil maps for named site.\n\n Uses hydrologically correct DEM for site as a template to ensure resulting\n soil map has the correct dimensions and geographical projection.\n ' initial_dir = os.getcwd() output...
def _make_soil_maps_for_site(site_name: str, output_root: Path) -> None: 'Generate uniform soil maps for named site.\n\n Uses hydrologically correct DEM for site as a template to ensure resulting\n soil map has the correct dimensions and geographical projection.\n ' initial_dir = os.getcwd() output...
3995bcdd8abf26ed5e74e497cfa809e7a31290f383d989f871139b420a4fc0c6
def select_polynomial_degree(n_samples: int=100, noise: float=5): '\n\tSimulate data from a polynomial model and use cross-validation to select the best fitting degree\n\n\tParameters\n\t----------\n\tn_samples: int, default=100\n\t\tNumber of samples to generate\n\n\tnoise: float, default = 5\n\t\tNoise level to s...
Simulate data from a polynomial model and use cross-validation to select the best fitting degree Parameters ---------- n_samples: int, default=100 Number of samples to generate noise: float, default = 5 Noise level to simulate in responses
exercises/perform_model_selection.py
select_polynomial_degree
AlonViz/IML.HUJI
0
python
def select_polynomial_degree(n_samples: int=100, noise: float=5): '\n\tSimulate data from a polynomial model and use cross-validation to select the best fitting degree\n\n\tParameters\n\t----------\n\tn_samples: int, default=100\n\t\tNumber of samples to generate\n\n\tnoise: float, default = 5\n\t\tNoise level to s...
def select_polynomial_degree(n_samples: int=100, noise: float=5): '\n\tSimulate data from a polynomial model and use cross-validation to select the best fitting degree\n\n\tParameters\n\t----------\n\tn_samples: int, default=100\n\t\tNumber of samples to generate\n\n\tnoise: float, default = 5\n\t\tNoise level to s...
d111a0049a50b2b992b62f1b9db14b1be77765d110cae6f47ebf7ff1dd9a5806
def select_regularization_parameter(n_samples: int=50, n_evaluations: int=500): "\n\tUsing sklearn's diabetes dataset use cross-validation to select the best fitting regularization parameter\n\tvalues for Ridge and Lasso regressions\n\n\tParameters\n\t----------\n\tn_samples: int, default=50\n\t\tNumber of samples ...
Using sklearn's diabetes dataset use cross-validation to select the best fitting regularization parameter values for Ridge and Lasso regressions Parameters ---------- n_samples: int, default=50 Number of samples to generate n_evaluations: int, default = 500 Number of regularization parameter values to...
exercises/perform_model_selection.py
select_regularization_parameter
AlonViz/IML.HUJI
0
python
def select_regularization_parameter(n_samples: int=50, n_evaluations: int=500): "\n\tUsing sklearn's diabetes dataset use cross-validation to select the best fitting regularization parameter\n\tvalues for Ridge and Lasso regressions\n\n\tParameters\n\t----------\n\tn_samples: int, default=50\n\t\tNumber of samples ...
def select_regularization_parameter(n_samples: int=50, n_evaluations: int=500): "\n\tUsing sklearn's diabetes dataset use cross-validation to select the best fitting regularization parameter\n\tvalues for Ridge and Lasso regressions\n\n\tParameters\n\t----------\n\tn_samples: int, default=50\n\t\tNumber of samples ...