-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Analysis API #116
base: master
Are you sure you want to change the base?
Analysis API #116
Conversation
tests/test_analysis.py
Outdated
@@ -0,0 +1,52 @@ | |||
from carto.analysis import AnalysisClient | |||
|
|||
def test_analysis(api_key_auth_client_usr): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
|
||
ANSI_ESCAPE = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]') | ||
|
||
def uncolored(text): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
attrib = ''.join([Color.COLORS[a] for a in attrib]) | ||
return attrib + str(text) + Color.END | ||
|
||
ANSI_ESCAPE = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines after class or function definition, found 1
def enable_colors(mode): | ||
Color.enabled = mode | ||
|
||
def colored(attrib, text): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
@@ -0,0 +1,39 @@ | |||
import re | |||
|
|||
class Color: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
] | ||
|
||
|
||
def update(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too many blank lines (2)
@staticmethod | ||
def print(*args): | ||
print(*args) | ||
@staticmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 1 blank line, found 0
|
||
TASK_GROUP = 'analysis' # we have always one task group named analysis | ||
|
||
class DefaultOutput: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
carto/analysis.py
Outdated
) | ||
res = self.auth_client.send(url, 'GET', headers=HEADERS) | ||
logs = self.auth_client.get_response_data(res, False) | ||
if not logs is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test for object identity should be 'is not'
'accept': 'application/json' | ||
} | ||
|
||
class AnalysisClient(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
The higher level API is not Python 2 compatible at the moment |
For consistency with other APIs I think it'll be better to rename |
if self.summary is None: | ||
return '' | ||
if self.type == 'now': | ||
return 'C:{c} S:{s} F:{f} L:{l} Q:{q} R:{r}'.format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for being an uninvited guest, but how about using a cartocolor palette instead?? :)
This provides an interface to the in-the-works Analysis API