Skip to content

Commit

Permalink
completeness script: convert to errbot
Browse files Browse the repository at this point in the history
  • Loading branch information
DonHaul committed Sep 11, 2024
1 parent 86dbb7e commit ad4888d
Show file tree
Hide file tree
Showing 14 changed files with 289 additions and 100 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/build_and_release.yaml

This file was deleted.

129 changes: 129 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
#lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: name-tests-test
args: [ --pytest-test-first ]
exclude: '^(?!factories/)'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.2
hooks:
- id: ruff
args: [ --fix, --unsafe-fixes ]
- id: ruff-format
2 changes: 1 addition & 1 deletion CERN_Root_Certification_Authority_2.pem
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ B6tY2HMZbAZ3TKQRb/bRyUigM9DniKWeXkeL/0Nsno+XbcpAqLjtVIRwCg6jTLUi
+OqoWtgbgweBlfO0/3GMnVGMAmI4FlhH2oWKWQgWdgr0Wgh9K05VcxSpJ87/zjhb
MQn/bEojWmp6eUppPaqNFcELvud41qoe6hLsOYQVUQ1sHi7n6ouhg4BAbwS2iyD2
uiA6FHTCeLreFGUzs5osPKiz3GE5D6V9she9xIQ=
-----END CERTIFICATE-----
-----END CERTIFICATE-----
24 changes: 0 additions & 24 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# completness-check
# completness-check
Empty file added __init__.py
Empty file.
9 changes: 9 additions & 0 deletions arxiv_completeness.plug
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Core]
Name = ArxivCompleteness
Module = arxiv_completeness

[Documentation]
Description = This will warn us about the arxiv completeness

[Python]
Version = 3
36 changes: 36 additions & 0 deletions arxiv_completeness.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from datetime import date, datetime, timedelta

from errbot import BotPlugin, arg_botcmd

from lib import arxiv_completness_check_script

TODAY = date.today()
if TODAY.weekday() == 0:
DEFAULT_FROM_DATE = TODAY - timedelta(days=3)
else:
DEFAULT_FROM_DATE = TODAY - timedelta(days=1)


class ArxivCompleteness(BotPlugin):
"""
Arxiv Completeness Errbot Plugin
"""

@arg_botcmd("--from-date", dest="from_date", type=str, default=None)
@arg_botcmd("--to-date", dest="to_date", type=str, default=None)
def arxiv(self, msg, from_date, to_date):
"""
Command that retrieves information regarding the harvesting between two dates
"""
if from_date is not None:
from_date = datetime.strptime(from_date, "%d-%m-%Y").date()
else:
from_date = DEFAULT_FROM_DATE
if to_date is not None:
to_date = datetime.strptime(to_date, "%d-%m-%Y").date()
else:
to_date = TODAY

yield "Arxiv Completeness Check may take some time, please be patient"
yield arxiv_completness_check_script.completeness_check(from_date, to_date)
Empty file added lib/__init__.py
Empty file.
Loading

0 comments on commit ad4888d

Please sign in to comment.