Skip to content

Commit

Permalink
Adds six into install_requires set and sorts each file's imports with…
Browse files Browse the repository at this point in the history
… the isort package.
  • Loading branch information
b4oshany authored and davilima6 committed Jan 30, 2018
1 parent c0e95ac commit 0b0a230
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 22 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ New features:

Bug fixes:

- Imports are Python3 compatible
- Imports are Python3 compatible.
Adds six into install_requires set and sorts each file's imports with the isort package.
[b4oshany]


Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from setuptools import setup
from setuptools import find_packages
from setuptools import setup

import sys

version = '1.1.3.dev0'
Expand Down Expand Up @@ -53,6 +54,7 @@ def indent(line):
'robotsuite', # not a direct dependency, but required for convenience
'selenium',
'setuptools',
'six',
'zope.component',
'zope.configuration',
'zope.i18n',
Expand Down
12 changes: 7 additions & 5 deletions src/plone/app/robotframework/content.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# -*- coding: utf-8 -*-
from datetime import datetime
import os

from Products.CMFCore.utils import getToolByName
from plone.app.robotframework.config import HAS_BLOBS
from plone.app.robotframework.config import HAS_DEXTERITY
from plone.app.robotframework.config import HAS_DEXTERITY_RELATIONS
from plone.app.robotframework.remote import RemoteLibrary
from plone.app.robotframework.utils import disableCSRFProtection
from plone.i18n.normalizer.interfaces import IURLNormalizer
from plone.uuid.interfaces import IUUID
from Products.CMFCore.utils import getToolByName
from zope.component import ComponentLookupError
from zope.component import getUtility
from zope.component import queryUtility
Expand All @@ -18,6 +16,10 @@
from zope.globalrequest import getRequest
from zope.lifecycleevent import ObjectModifiedEvent

import os
import six


if HAS_DEXTERITY:
from plone.app.textfield.value import RichTextValue

Expand Down Expand Up @@ -137,10 +139,10 @@ def create_content(self, *args, **kwargs):
if widget and name in kwargs:
if not IFromUnicode.providedBy(field):
value = kwargs[name]
elif isinstance(kwargs[name], unicode):
elif isinstance(kwargs[name], six.text_type):
value = kwargs[name]
else:
value = unicode(str(kwargs[name]), 'utf-8',
value = six.text_type(str(kwargs[name]), 'utf-8',
errors='ignore')
converter = IDataConverter(widget)
dm = queryMultiAdapter((content, field), IDataManager)
Expand Down
9 changes: 7 additions & 2 deletions src/plone/app/robotframework/pybabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def populate(self):
if self._value or self._comments:
self._setter(self._value, self._comments.value)
try:
parts = map(unicode.lower, self._value)
parts = map(six.text_type.lower, self._value)
index = parts.index('translate')
comments = []
for part in filter(lambda x: x.startswith('default='), self._value):
Expand All @@ -19,10 +19,15 @@ def populate(self):
except IndexError:
pass

import robot
import robot.parsing.tablepopulators
import six


robot.parsing.tablepopulators.StepPopulator.populate = populate

import robot




def extract_robot(fileobj, keywords, comment_tags, options):
Expand Down
11 changes: 7 additions & 4 deletions src/plone/app/robotframework/saucelabs.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# -*- coding: utf-8 -*-
import re
import os
import base64
from robot.libraries.BuiltIn import BuiltIn
from six.moves.http_client import HTTPConnection

import base64
import os
import re


try:
import json
json # pyflakes
except ImportError:
import simplejson as json

from robot.libraries.BuiltIn import BuiltIn

USERNAME_ACCESS_KEY = re.compile('^(http|https):\/\/([^:]+):([^@]+)@')

Expand Down
11 changes: 6 additions & 5 deletions src/plone/app/robotframework/server.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# -*- coding: utf-8 -*-
from plone.app.robotframework.remote import RemoteLibrary
from six.moves.xmlrpc_client import ServerProxy
from six.moves.xmlrpc_server import SimpleXMLRPCServer

import argparse
import logging
import select
import os
import pkg_resources
import select
import sys
import time
from six.moves.xmlrpc_client import ServerProxy
from six.moves.xmlrpc_server import SimpleXMLRPCServer

import pkg_resources

try:
pkg_resources.get_distribution('watchdog')
Expand All @@ -19,7 +21,6 @@
from plone.app.robotframework.reload import Watcher
HAS_RELOAD = True

from plone.app.robotframework.remote import RemoteLibrary

HAS_DEBUG_MODE = False
HAS_VERBOSE_CONSOLE = False
Expand Down
13 changes: 9 additions & 4 deletions src/plone/app/robotframework/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
re-usable resources of plone.app.robotframework.
"""
from Acquisition import aq_base
from Products.MailHost.interfaces import IMailHost
from plone.app.robotframework.autologin import AutoLogin
from plone.app.robotframework.content import Content
from plone.app.robotframework.genericsetup import GenericSetup
Expand All @@ -15,27 +14,33 @@
from plone.app.robotframework.remote import RemoteLibraryLayer
from plone.app.robotframework.server import Zope2ServerRemote
from plone.app.robotframework.users import Users
from plone.app.testing import applyProfile
from plone.app.testing import FunctionalTesting
from plone.app.testing import IntegrationTesting
from plone.app.testing import PLONE_FIXTURE
from plone.app.testing import PloneSandboxLayer
from plone.app.testing import applyProfile
from plone.app.testing import ploneSite
from plone.testing import Layer
from plone.testing import z2
from Products.MailHost.interfaces import IMailHost
from robot.libraries.BuiltIn import BuiltIn
from zope.component import getSiteManager
from zope.configuration import xmlconfig

import os
import pkg_resources
import six
import sys


try:
pkg_resources.get_distribution('collective.js.speakjs')
except pkg_resources.DistributionNotFound:
HAS_SPEAKJS = False
else:
HAS_SPEAKJS = True
from robot.libraries.BuiltIn import BuiltIn




class SimplePublicationLayer(Layer):
Expand Down Expand Up @@ -152,7 +157,7 @@ def _get_robot_variable(self, name):
"""
if getattr(BuiltIn(), '_context', None) is not None:
value = BuiltIn().get_variable_value('${%s}' % name, [])
if isinstance(value, str) or isinstance(value, unicode):
if isinstance(value, str) or isinstance(value, six.text_type):
return value.split(',')
else:
return value
Expand Down

0 comments on commit 0b0a230

Please sign in to comment.