Skip to content

Commit 34fab3f

Browse files
author
Teddy Reed
authored
Use with_metaclass instead of __metaclass__ (osquery#45)
1 parent 10c1c53 commit 34fab3f

File tree

7 files changed

+10
-12
lines changed

7 files changed

+10
-12
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ cache:
66
python:
77
- 2.6
88
- 2.7
9-
- 3.2
109
- 3.3
1110
- 3.4
1211
- 3.6

osquery/config_plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
from __future__ import unicode_literals
1212

1313
from abc import ABCMeta, abstractmethod
14+
from future.utils import with_metaclass
1415

1516
from osquery.extensions.ttypes import ExtensionResponse, ExtensionStatus
1617
from osquery.plugin import BasePlugin
1718

18-
class ConfigPlugin(BasePlugin):
19+
class ConfigPlugin(with_metaclass(ABCMeta, BasePlugin)):
1920
"""All config plugins should inherit from ConfigPlugin"""
20-
__metaclass__ = ABCMeta
2121

2222
def call(self, context):
2323
"""Internal routing for this plugin type.

osquery/logger_plugin.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
from __future__ import unicode_literals
1313

1414
from abc import ABCMeta, abstractmethod
15+
from future.utils import with_metaclass
1516

1617
from osquery.extensions.ttypes import ExtensionResponse, ExtensionStatus
1718
from osquery.plugin import BasePlugin
1819

19-
class LoggerPlugin(BasePlugin):
20+
21+
class LoggerPlugin(with_metaclass(ABCMeta, BasePlugin)):
2022
"""All logger plugins should inherit from LoggerPlugin"""
21-
__metaclass__ = ABCMeta
2223

2324
_use_glog_message = "Use Glog for status logging"
2425
_invalid_action_message = "Not a valid logger plugin action"

osquery/management.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import argparse
1212
import logging
1313
import os
14-
import shutil
1514
import socket
1615
import subprocess
1716
import sys
@@ -98,7 +97,7 @@ def open(self, timeout=2, interval=0.01):
9897
try:
9998
self.connection.open()
10099
return
101-
except:
100+
except Exception:
102101
time.sleep(interval)
103102
delay += interval
104103
self.instance.kill()

osquery/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
from __future__ import unicode_literals
1212

1313
from abc import ABCMeta, abstractmethod
14+
from future.utils import with_metaclass
1415

1516
from osquery.singleton import Singleton
1617

17-
class BasePlugin(Singleton):
18+
class BasePlugin(with_metaclass(ABCMeta, Singleton)):
1819
"""All osquery plugins should inherit from BasePlugin"""
19-
__metaclass__ = ABCMeta
2020

2121
@abstractmethod
2222
def call(self, context):

osquery/table_plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
from abc import ABCMeta, abstractmethod
1414
from builtins import str
1515
from collections import namedtuple
16+
from future.utils import with_metaclass
1617
import json
1718
import logging
1819

1920
from osquery.extensions.ttypes import ExtensionResponse, ExtensionStatus
2021
from osquery.plugin import BasePlugin
2122

22-
class TablePlugin(BasePlugin):
23+
class TablePlugin(with_metaclass(ABCMeta, BasePlugin)):
2324
"""All table plugins should inherit from TablePlugin"""
24-
__metaclass__ = ABCMeta
2525

2626
_no_action_message = "Table plugins must include a request action"
2727

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ def run(self):
109109
"Programming Language :: Python :: 2.6",
110110
"Programming Language :: Python :: 2.7",
111111
"Programming Language :: Python :: 3",
112-
"Programming Language :: Python :: 3.2",
113112
"Programming Language :: Python :: 3.3",
114113
"Programming Language :: Python :: 3.4",
115114
"Programming Language :: Python :: 3.6",

0 commit comments

Comments
 (0)