1
0
mirror of https://github.com/bspeice/metrik synced 2024-11-05 06:58:12 -05:00

Didn't think 2.7/3.x compatibility would be this bad...

This commit is contained in:
Bradlee Speice 2016-08-08 23:18:00 -04:00
parent f9caa2555a
commit 52eaa4b663
5 changed files with 40 additions and 18 deletions

View File

@ -0,0 +1,19 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyCompatibilityInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ourVersions">
<value>
<list size="6">
<item index="0" class="java.lang.String" itemvalue="2.7" />
<item index="1" class="java.lang.String" itemvalue="3.1" />
<item index="2" class="java.lang.String" itemvalue="3.2" />
<item index="3" class="java.lang.String" itemvalue="3.3" />
<item index="4" class="java.lang.String" itemvalue="3.4" />
<item index="5" class="java.lang.String" itemvalue="3.5" />
</list>
</value>
</option>
</inspection_tool>
</profile>
</component>

View File

@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>

View File

@ -48,7 +48,10 @@
<ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" /> <ConfirmationsSetting value="0" id="Remove" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" default="true" assert-keyword="false" jdk-15="false" project-jdk-name="Python 3.5.1+ (/usr/bin/python3)" project-jdk-type="Python SDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" default="false" assert-keyword="false" jdk-15="false" project-jdk-name="Python 2.7.12 (/usr/bin/python2)" project-jdk-type="Python SDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
<component name="PythonCompatibilityInspectionAdvertiser">
<option name="version" value="1" />
</component>
</project> </project>

View File

@ -2,15 +2,11 @@ import requests
from luigi import Task, Parameter from luigi import Task, Parameter
from pyquery import PyQuery as pq from pyquery import PyQuery as pq
import logging import logging
try:
from urllib.parse import quote_plus
from html.parser import HTMLParser
except ImportError:
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from urllib import quote_plus from six.moves.urllib.parse import quote_plus
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from HTMLParser import HTMLParser from six.moves.html_parser import HTMLParser
from six import PY2
class BloombergEquityInfo(Task): class BloombergEquityInfo(Task):
@ -20,15 +16,11 @@ class BloombergEquityInfo(Task):
@staticmethod @staticmethod
def retrieve_info(bbg_code, user_agent): def retrieve_info(bbg_code, user_agent):
class EquityInfoParser(HTMLParser): class EquityInfoParser(HTMLParser):
def __init__(self, keys): def __init__(self, keys):
# This call isn't safe because python 2 HTMLParser is an if PY2:
# old-style class HTMLParser.__init__(self)
try: else:
super(EquityInfoParser, self).__init__() super(EquityInfoParser, self).__init__()
except TypeError:
pass
self.keys = keys self.keys = keys
self.records = {k: None for k in keys} self.records = {k: None for k in keys}
self.do_record = {k: False for k in keys} self.do_record = {k: False for k in keys}

View File

@ -10,7 +10,8 @@ setup(
install_requires=[ install_requires=[
'pyquery >= 1.2.13', 'pyquery >= 1.2.13',
'luigi >= 2.2.0', 'luigi >= 2.2.0',
'requests >= 2.9.1' 'requests >= 2.9.1',
'six >= 1.10.0'
], ],
setup_requires=[ setup_requires=[
'pytest_runner' 'pytest_runner'