Skip to content

Commit

Permalink
[LOG-10930] Python upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Dri0m committed Jun 8, 2021
1 parent 458a86c commit 13a33b3
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion muskrat/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.5'
__version__ = '1.1.0'
10 changes: 6 additions & 4 deletions muskrat/producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
" Author: Scott Griffin
"
"""
from __future__ import absolute_import
from six.moves import range
try: import simplejson as json
except ImportError: import json

import Queue
import six.moves.queue
import threading
from datetime import datetime

Expand Down Expand Up @@ -88,7 +90,7 @@ def __init__(self, **kwargs):
@property
def s3conn(self):
if self._s3conn is None:
self._s3conn = boto.connect_s3( self.config.s3_key, self.config.s3_secret, host=self.config.s3_host )
self._s3conn = boto.connect_s3( self.config.s3_key, self.config.s3_secret, host=self.config.s3_host, calling_format=boto.s3.connection.OrdinaryCallingFormat)
return self._s3conn

@property
Expand Down Expand Up @@ -153,7 +155,7 @@ def run(self):
msg, s3key = self.queue.get( True, self.timeout )
s3key.set_contents_from_string( msg )
self.queue.task_done()
except Queue.Empty:
except six.moves.queue.Empty:
#queue.get() timeout will cause this exception and mean we are done
#with our messages, so exit the thread.
pass
Expand All @@ -169,7 +171,7 @@ class ThreadedS3Producer( S3Producer ):
Defaults to a thread pool of 20 threads.
"""
def __init__(self, *args, **kwargs):
self.queue = Queue.Queue()
self.queue = six.moves.queue.Queue()
self.num_threads = kwargs.pop( 'num_threads', 20 )
self.threads = []
super( ThreadedS3Producer, self ).__init__( **kwargs )
Expand Down
1 change: 1 addition & 0 deletions muskrat/rmqconsumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
" underlying RabbitMQ connection interface for receiving messages.
"
"""
from __future__ import absolute_import
import exceptions
from collections import defaultdict
from functools import wraps
Expand Down
1 change: 1 addition & 0 deletions muskrat/s3consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
" that consumer's state.
"
"""
from __future__ import absolute_import
import os
import time

Expand Down
1 change: 1 addition & 0 deletions muskrat/tests/test_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
" TODO - Implement RabbitMQ producer and Kafka
"
"""
from __future__ import absolute_import
import unittest
import re
import os
Expand Down
1 change: 1 addition & 0 deletions muskrat/tests/test_rmqconsumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
" Last Updated: xx/xx/xx
"
"""
from __future__ import absolute_import
import unittest
from os import path
import json
Expand Down
1 change: 1 addition & 0 deletions muskrat/tests/test_s3consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
" These tests assume that config.py exists withing
"
"""
from __future__ import absolute_import
import unittest
import os
import tempfile
Expand Down
5 changes: 3 additions & 2 deletions muskrat/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
" Common routines for muskrat.
"
"""
from __future__ import absolute_import
import imp
import os

Expand All @@ -30,8 +31,8 @@ def config_loader( config ):
d.__file__ = config

try:
execfile(config, d.__dict__)
except IOError, e:
exec(compile(open(config, "rb").read(), config, 'exec'), d.__dict__)
except IOError as e:
e.strerror = 'Unable to load configuration file (%s)' % e.strerror
raise

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pika==0.9.8
pika==1.1.0
boto==2.48.0
boto3==1.17.57
botocore==1.20.57
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
" Author: Scott Griffin
"
"""
from __future__ import absolute_import
from setuptools import setup
from muskrat import __version__

Expand Down

0 comments on commit 13a33b3

Please sign in to comment.