Skip to content
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

Cleaned up stuff, and a new simplify_string transform #55

Merged
merged 9 commits into from
May 21, 2018

Conversation

ErikBjare
Copy link
Member

@ErikBjare ErikBjare commented Apr 10, 2018

  • Added simplify_string transform + test
  • Added q2_function decorator for registering query functions
  • Improved typing
  • Misc cleanup + PEP8 stuff + readability + used pytest.raises where appropriate in tests
  • Bumped version number
  • Added q2_find_bucket to avoid hardcoding bucket IDs in queries
  • Added q2_filter_keyvals_regex

TODO

@ghost ghost assigned ErikBjare Apr 10, 2018
@ghost ghost added the review label Apr 10, 2018
@codecov-io
Copy link

codecov-io commented Apr 10, 2018

Codecov Report

Merging #55 into master will decrease coverage by 1.48%.
The diff coverage is 75.94%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #55      +/-   ##
==========================================
- Coverage   96.46%   94.98%   -1.49%     
==========================================
  Files          29       30       +1     
  Lines        1075     1136      +61     
  Branches      160      168       +8     
==========================================
+ Hits         1037     1079      +42     
- Misses         16       34      +18     
- Partials       22       23       +1
Impacted Files Coverage Δ
aw_transform/heartbeats.py 95.45% <100%> (ø) ⬆️
aw_transform/simplify.py 100% <100%> (ø)
aw_transform/__init__.py 100% <100%> (ø) ⬆️
aw_core/__about__.py 100% <100%> (ø) ⬆️
aw_transform/filter_keyvals.py 78.94% <42.85%> (-21.06%) ⬇️
aw_analysis/query2_functions.py 80% <71.69%> (-12.86%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 69f52ca...14957bc. Read the comment docs.

@ErikBjare ErikBjare changed the title Dev/queryclean Cleaned up stuff, and a new simplify_string transform Apr 10, 2018


@q2_function
def q2_query_bucket(datastore: Datastore, namespace: dict, bucketname: str) -> List[Event]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace: TNamespace

def q2_query_bucket_eventcount(datastore: Datastore, namespace: dict, bucketname: str):

@q2_function
def q2_query_bucket_eventcount(datastore: Datastore, namespace: dict, bucketname: str) -> int:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace: TNamespace



@q2_function
def q2_filter_keyvals(datastore: Datastore, namespace: dict, events: list, key: str, *vals) -> List[Event]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace: TNamespace

def q2_exclude_keyvals(datastore: Datastore, namespace: dict, events: list, key: str, *vals):

@q2_function
def q2_exclude_keyvals(datastore: Datastore, namespace: dict, events: list, key: str, *vals) -> List[Event]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace: TNamespace

def q2_filter_period_intersect(datastore: Datastore, namespace: dict, events: list, filterevents: list):

@q2_function
def q2_filter_period_intersect(datastore: Datastore, namespace: dict, events: list, filterevents: list) -> List[Event]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace: TNamespace



@q2_function
def q2_merge_events_by_keys(datastore: Datastore, namespace: dict, events: list, *keys) -> List[Event]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace: TNamespace



@q2_function
def q2_sort_by_timestamp(datastore: Datastore, namespace: dict, events: list) -> List[Event]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace: TNamespace

def q2_sort_by_duration(datastore: Datastore, namespace: dict, events: list):

@q2_function
def q2_sort_by_duration(datastore: Datastore, namespace: dict, events: list) -> List[Event]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace: TNamespace

def q2_split_url_events(datastore: Datastore, namespace: dict, events: list):

@q2_function
def q2_split_url_events(datastore: Datastore, namespace: dict, events: list) -> List[Event]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace: TNamespace

_verify_variable_is_type(events, list)
return split_url_events(events)


@q2_function
def q2_simplify_window_titles(datastore: Datastore, namespace: dict, events: list, key: str) -> List[Event]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace: TNamespace

@ErikBjare
Copy link
Member Author

Made the final fixes and I'm just going to go ahead and merge this. Some pretty good stuff imho!

@ErikBjare ErikBjare merged commit 7aab2e7 into master May 21, 2018
@ghost ghost removed the review label May 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants