Skip to content

Commit

Permalink
Merge branch 'master' of github.com:oasis-open/cti-taxii-client into …
Browse files Browse the repository at this point in the history
…zrush-master
  • Loading branch information
emmanvg committed Feb 9, 2021
2 parents 5baec70 + 1135ca4 commit 1a1c400
Show file tree
Hide file tree
Showing 12 changed files with 147 additions and 81 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/python-ci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: cti-taxii-client test harness
on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]

name: Python ${{ matrix.python-version }} Build
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install and update essential dependencies
run: |
pip install -U pip setuptools
pip install tox-gh-actions
pip install codecov
- name: Test with Tox
run: |
tox
- name: Upload coverage information to Codecov
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
20 changes: 13 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
sha: v0.9.2
rev: v3.4.0
hooks:
- id: trailing-whitespace
- id: check-merge-conflict
- repo: https://github.com/PyCQA/flake8
rev: 3.8.4
hooks:
- id: flake8
name: Check project styling
args:
- --max-line-length=160
- id: check-merge-conflict
- repo: https://github.com/FalconSocial/pre-commit-python-sorter
sha: b57843b0b874df1d16eb0bef00b868792cb245c2
- repo: https://github.com/PyCQA/isort
rev: 5.7.0
hooks:
- id: python-import-sorter
args:
- --diff
- id: isort
name: Sort python imports (shows diff)
args: ["-c", "--diff"]
- id: isort
name: Sort python imports (fixes files)
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ above <#currentMaintainers>`__. Please send general questions about Open
Repository participation to OASIS Staff at repository-admin@oasis-open.org and
any specific CLA-related questions to repository-cla@oasis-open.org.

.. |Build_Status| image:: https://travis-ci.org/oasis-open/cti-taxii-client.svg?branch=master
:target: https://travis-ci.org/oasis-open/cti-taxii-client
.. |Build_Status| image:: https://github.com/oasis-open/cti-taxii-client/workflows/cti-taxii-client%20test%20harness/badge.svg
:target: https://github.com/oasis-open/cti-taxii-client/actions?query=workflow%3A%22cti-taxii-client+test+harness%22
.. |Coverage| image:: https://codecov.io/gh/oasis-open/cti-taxii-client/branch/master/graph/badge.svg
:target: https://codecov.io/gh/oasis-open/cti-taxii-client
.. |Version| image:: https://img.shields.io/pypi/v/taxii2-client.svg?maxAge=3600
Expand Down
10 changes: 0 additions & 10 deletions docs/api/api_reference.rst

This file was deleted.

49 changes: 49 additions & 0 deletions docs/api/taxii2client.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
API Reference
=============

This section of documentation contains information on all of the classes and
functions in the ``taxii2client`` API, as given by the package's docstrings.

Subpackages
-----------

.. toctree::
:maxdepth: 4

taxii2client.v20
taxii2client.v21

Submodules
----------

taxii2client.common module
**************************

.. automodule:: taxii2client.common
:members:
:undoc-members:
:show-inheritance:

taxii2client.exceptions module
******************************

.. automodule:: taxii2client.exceptions
:members:
:undoc-members:
:show-inheritance:

taxii2client.version module
***************************

.. automodule:: taxii2client.version
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: taxii2client
:members:
:undoc-members:
:show-inheritance:
10 changes: 10 additions & 0 deletions docs/api/taxii2client.v20.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
taxii2client.v20 package
========================

Module contents
---------------

.. automodule:: taxii2client.v20
:members:
:undoc-members:
:show-inheritance:
10 changes: 10 additions & 0 deletions docs/api/taxii2client.v21.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
taxii2client.v21 package
========================

Module contents
---------------

.. automodule:: taxii2client.v21
:members:
:undoc-members:
:show-inheritance:
7 changes: 4 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ currently supports the current services:
- Get Object Manifests
- Get Object Versions (2.1 only)

API Reference
=============
Table of Contents
=================

.. toctree::
:maxdepth: 3

api/api_reference
api/taxii2client
contributing

Indices and tables
==================
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def get_long_description():
'Topic :: Security',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
keywords='taxii taxii2 client json cti cyber threat intelligence',
packages=find_packages(exclude=['*.test']),
Expand Down
11 changes: 6 additions & 5 deletions taxii2client/v20/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@

def as_pages(func, start=0, per_request=0, *args, **kwargs):
"""Creates a generator for TAXII 2.0 endpoints that support pagination.
Args:
func (callable): A v20 function call that supports paged requests.
Currently Get Objects and Get Manifest.
start (int): The starting point for the page request. Default 0.
per_request (int): How many items per request. Default 0.
Args:
func (callable): A v20 function call that supports paged requests.
Currently Get Objects and Get Manifest.
start (int): The starting point for the page request. Default 0.
per_request (int): How many items per request. Default 0.
Use args or kwargs to pass filter information or other arguments required to make the call.
"""
Expand Down
54 changes: 19 additions & 35 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,51 +1,35 @@
[tox]
envlist = py35,py36,py37,py38,pycodestyle,isort-check,packaging
envlist = py36,py37,py38,py39,packaging,pre-commit-check

[testenv]
deps =
-U
tox
pytest
pytest-cov
coverage
responses
-U
tox
pytest
pytest-cov
coverage
responses
commands =
pytest --cov=taxii2client taxii2client/test/ --cov-report term-missing
pytest --cov=taxii2client taxii2client/test/ --cov-report term-missing

passenv = CI TRAVIS TRAVIS_*
passenv = GITHUB_*

[testenv:pycodestyle]
[testenv:packaging]
deps =
flake8
pycodestyle
commands =
pip check
pycodestyle ./taxii2client
flake8 ./taxii2client

[pycodestyle]
max-line-length=160
exclude=taxii2client/__init__.py

[flake8]
max-line-length=160
exclude=taxii2client/__init__.py

[testenv:isort-check]
deps = isort
twine
commands =
isort taxii2client --df
isort taxii2client -c
python setup.py sdist bdist_wheel --universal
twine check dist/*

[testenv:packaging]
[testenv:pre-commit-check]
deps =
readme_renderer
pre-commit
commands =
python setup.py check -r -s
pre-commit run --all-files

[travis]
[gh-actions]
python =
3.5: py35
3.6: py36
3.7: py37
3.8: py38, pycodestyle, isort-check, packaging
3.8: py38
3.9: py39, packaging, pre-commit-check

0 comments on commit 1a1c400

Please sign in to comment.