Skip to content

Commit

Permalink
Merge branch 'devel' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
emirkmo committed Mar 7, 2022
2 parents f28fb62 + 6d3e15d commit 988dae0
Show file tree
Hide file tree
Showing 49 changed files with 4,589 additions and 5,873 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ charset = utf-8

# Python source files
[*.py]
indent_style = tab
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
Expand All @@ -20,7 +20,7 @@ insert_final_newline = true

# Code documentation
[*.rst]
indent_style = tab
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
push:
branches: [master, devel]
tags: 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
pull_request_target:
branches: [master, devel]
schedule:
- cron: '0 6 1 * *' # once a month in the morning
Expand All @@ -19,19 +19,21 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
persist-credentials: true

- name: Setup Python 3.7
- name: Setup Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: 3.8

- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-py3.7-${{ hashFiles('requirements.txt') }}
key: ${{ runner.os }}-pip-py3.8-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-py3.7-
${{ runner.os }}-pip-py3.8-
${{ runner.os }}-pip-
- name: Install dependencies
Expand All @@ -55,7 +57,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8]
python-version: [3.8]
include:
- os: ubuntu-latest
pippath: ~/.cache/pip
Expand Down Expand Up @@ -112,9 +114,11 @@ jobs:
pip install codecov pytest-cov
- name: Testing
continue-on-error: true
run: pytest --cov

- name: Upload coverage
continue-on-error: true
uses: codecov/codecov-action@v1
with:
env_vars: OS,PYTHON
Expand Down Expand Up @@ -144,18 +148,18 @@ jobs:
- name: Git LFS Pull
run: git lfs pull

- name: Setup Python 3.7
- name: Setup Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: 3.8

- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-py3.7-${{ hashFiles('requirements.txt') }}
key: ${{ runner.os }}-pip-py3.8-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-py3.7-
${{ runner.os }}-pip-py3.8-
${{ runner.os }}-pip-
- name: Install dependencies
Expand Down
10 changes: 4 additions & 6 deletions flows/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# flake8: noqa

"""
FLOWS pipeline package
"""
from .photometry import photometry
from .catalogs import download_catalog
from .visibility import visibility
from .config import load_config

from .version import get_version

__version__ = get_version(pep440=False)
105 changes: 53 additions & 52 deletions flows/aadc_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,55 +13,56 @@
import psycopg2 as psql
from psycopg2.extras import DictCursor
import getpass
from .config import load_config

#--------------------------------------------------------------------------------------------------
class AADC_DB(object): # pragma: no cover
"""
Connection to the central TASOC database.
Attributes:
conn (`psycopg2.Connection` object): Connection to PostgreSQL database.
cursor (`psycopg2.Cursor` object): Cursor to use in database.
"""

def __init__(self, username=None, password=None):
"""
Open connection to central TASOC database.
If ``username`` or ``password`` is not provided or ``None``,
the user will be prompted for them.
Parameters:
username (string or None, optional): Username for AADC database.
password (string or None, optional): Password for AADC database.
"""

config = load_config()

if username is None:
username = config.get('database', 'username', fallback=None)
if username is None:
default_username = getpass.getuser()
username = input('Username [%s]: ' % default_username)
if username == '':
username = default_username

if password is None:
password = config.get('database', 'password', fallback=None)
if password is None:
password = getpass.getpass('Password: ')

# Open database connection:
self.conn = psql.connect('host=10.28.0.127 user=' + username + ' password=' + password + ' dbname=db_aadc')
self.cursor = self.conn.cursor(cursor_factory=DictCursor)

def close(self):
self.cursor.close()
self.conn.close()

def __enter__(self):
return self

def __exit__(self, *args, **kwargs):
self.close()
from tendrils.utils import load_config


# --------------------------------------------------------------------------------------------------
class AADC_DB(object): # pragma: no cover
"""
Connection to the central TASOC database.
Attributes:
conn (`psycopg2.Connection` object): Connection to PostgreSQL database.
cursor (`psycopg2.Cursor` object): Cursor to use in database.
"""

def __init__(self, username=None, password=None):
"""
Open connection to central TASOC database.
If ``username`` or ``password`` is not provided or ``None``,
the user will be prompted for them.
Parameters:
username (string or None, optional): Username for AADC database.
password (string or None, optional): Password for AADC database.
"""

config = load_config()

if username is None:
username = config.get('database', 'username', fallback=None)
if username is None:
default_username = getpass.getuser()
username = input('Username [%s]: ' % default_username)
if username == '':
username = default_username

if password is None:
password = config.get('database', 'password', fallback=None)
if password is None:
password = getpass.getpass('Password: ')

# Open database connection:
self.conn = psql.connect('host=10.28.0.127 user=' + username + ' password=' + password + ' dbname=db_aadc')
self.cursor = self.conn.cursor(cursor_factory=DictCursor)

def close(self):
self.cursor.close()
self.conn.close()

def __enter__(self):
return self

def __exit__(self, *args, **kwargs):
self.close()
12 changes: 0 additions & 12 deletions flows/api/__init__.py

This file was deleted.

124 changes: 0 additions & 124 deletions flows/api/catalogs.py

This file was deleted.

Loading

0 comments on commit 988dae0

Please sign in to comment.