Skip to content

Commit

Permalink
Remove unused (dead) code
Browse files Browse the repository at this point in the history
Usage of urlencode was removed in 302d13b.

Usage of hybridmethod was removed in 5e77919.
  • Loading branch information
pgiraud authored and rjuju committed Aug 14, 2024
1 parent 459068f commit bc7cd65
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 36 deletions.
27 changes: 0 additions & 27 deletions powa/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,3 @@ def __init__(self, getter):

def __get__(self, instance, owner):
return self.getter(owner)


class hybridmethod(object):
"""
Decorator allowing to define method which behaves differently
if called at the instance or at the class level.
"""

def __init__(self, class_method=None, instance_method=None):
self._class_method = class_method
self._instance_method = instance_method or class_method

def instance_method(self, instance_method):
"""Setter for the instance method."""
self._instance_method = instance_method
return self

def class_method(self, class_method):
"""Setter for class method."""
self._class_method = class_method
return self

def __get__(self, instance, owner):
if instance is None:
return self._class_method.__get__(owner, owner.__class__)
else:
return self._instance_method.__get__(instance, owner)
5 changes: 0 additions & 5 deletions powa/dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,6 @@ def initialize(self, datasource=None, params=None):

@classmethod
def to_json(cls):
"""
to_json is an hybridmethod, the goal is to provide two different
implementations when it is used as a class (DataSource) or as
an instance (Widget).
"""
return {
'data_url': cls.data_url,
'name': cls.__name__,
Expand Down
4 changes: 0 additions & 4 deletions powa/ui_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
from powa.json import JSONEncoder
from tornado.options import options
from tornado.web import HTTPError
try:
from urllib import urlencode # py2
except ImportError:
from urllib.parse import urlencode # py3


def version(_):
Expand Down

0 comments on commit bc7cd65

Please sign in to comment.