Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Test replacing inspect.getargspec
  • Loading branch information
spaceone committed Dec 16, 2018
1 parent 8effbdb commit bdcecce
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion circuits/core/handlers.py
Expand Up @@ -2,7 +2,7 @@
This module define the @handler decorator/function and the HandlesType type.
"""
from collections import Callable
from inspect import getargspec
from circuits.tools import getargspec


def handler(*names, **kwargs):
Expand Down
6 changes: 6 additions & 0 deletions circuits/tools/__init__.py
Expand Up @@ -3,6 +3,7 @@
circuits.tools contains a standard set of tools for circuits. These
tools are installed as executables with a prefix of "circuits."
"""
import inspect as _inspect
from functools import wraps
from warnings import warn, warn_explicit

Expand All @@ -23,6 +24,11 @@ def tryimport(modules, obj=None, message=None):
warn(message)


def getargspec(func):
getargs = _inspect.getfullargspec if hasattr(_inspect, 'getfullargspec') else _inspect.getargspec
return getargs(func)[:4]


def walk(x, f, d=0, v=None):
if not v:
v = set()
Expand Down
2 changes: 1 addition & 1 deletion circuits/web/controllers.py
Expand Up @@ -5,9 +5,9 @@
import json
from collections import Callable
from functools import update_wrapper
from inspect import getargspec

from circuits.core import BaseComponent, handler
from circuits.tools import getargspec

from . import tools
from .errors import forbidden, httperror, notfound, redirect
Expand Down
2 changes: 1 addition & 1 deletion examples/circ.py
Expand Up @@ -13,7 +13,6 @@
"""
import os
import sys
from inspect import getargspec
from optparse import OptionParser
from re import compile as compile_regex
from select import select
Expand All @@ -24,6 +23,7 @@

from circuits import Component, __version__ as systemVersion, handler
from circuits.net.sockets import TCPClient, connect
from circuits.tools import getargspec
from circuits.protocols.irc import (
ERR_NICKNAMEINUSE, ERR_NOMOTD, IRC, JOIN, NICK, PART, PRIVMSG, QUIT,
RPL_ENDOFMOTD, USER, Message, request,
Expand Down

0 comments on commit bdcecce

Please sign in to comment.