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

menu flag fire #249

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
# Thanks https://www.reddit.com/r/learnpython/comments/rr6y69/comment/hqeqt68/?utm_source=share&utm_medium=web2x&context=3
ignore = E203, W503, E501

max-line-length = 88
max-complexity = 39
extend-ignore = E203
12 changes: 12 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
# Thanks https://black.readthedocs.io/en/stable/integrations/github_actions.html
name: Lint (black)

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/[email protected]
4 changes: 0 additions & 4 deletions freezing/web/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import os
import os.path

from flask import Flask, session, g

from freezing.model import init_model, meta
Expand All @@ -25,7 +22,6 @@
alt_scoring,
tribes,
)
from freezing.web.utils import auth

# Register our blueprints

Expand Down
10 changes: 5 additions & 5 deletions freezing/web/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ def init_logging(loglevel: int = logging.INFO, color: bool = False):
logging.root,
]

for l in loggers:
if l is logging.root:
l.setLevel(logging.DEBUG)
for logger in loggers:
if logger is logging.root:
logger.setLevel(logging.DEBUG)
else:
l.setLevel(logging.INFO)
l.addHandler(ch)
logger.setLevel(logging.INFO)
logger.addHandler(ch)
4 changes: 2 additions & 2 deletions freezing/web/data.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""
Functions for interacting with the datastore and the strava apis.
"""

from __future__ import division, unicode_literals
import re
import logging

from instagram import InstagramAPIError, InstagramClientError

from polyline.codec import PolylineCodec

from sqlalchemy import and_
from geoalchemy import WKTSpatialElement
Expand All @@ -29,7 +29,7 @@
Team,
)

from freezing.web import app, config
from freezing.web import config
from freezing.web.autolog import log
from freezing.web.exc import (
InvalidAuthorizationToken,
Expand Down
2 changes: 2 additions & 0 deletions freezing/web/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@
<li><a href="/pointless/generic/londonbridge">London Bridge Rides</a></li>
<li><a href="/pointless/arlington">Loopy for Arlington</a></li>
<li><a href="https://www.bikearlingtonforum.com/forums/topic/meh-diocrity-pointless-prize-2/">Meh-diocrity</a></li>
<li><a href="/pointless/hashtag/fire">Fire</a></li>
<li><a href="/pointless/hashtag/flag">Flag</a></li>
<li><a href="/pointless/opmdays">Michigander Snow Day Rides</a></li>
<li><a href="/pointless/hashtag/monuments">Monuments and Memorials</a></li>
<!-- li><a href="/pointless/hashtag/oldGeorge">Old Georgetown Bike Lane</a></li -->
Expand Down
1 change: 1 addition & 0 deletions freezing/web/utils/auth.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Some authentication-related utility functions/classes.
"""

import logging
from functools import wraps, update_wrapper
from datetime import timedelta
Expand Down
5 changes: 1 addition & 4 deletions freezing/web/utils/dates.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import pytz

from datetime import datetime
from dateutil import parser as date_parser

from freezing.web import app, config
from freezing.web import config


def parse_competition_timestamp(ts):
Expand Down
2 changes: 0 additions & 2 deletions freezing/web/utils/genericboard.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import decimal
import os
import enum
from datetime import datetime
from typing import List, Dict, Any, Tuple

import yaml

from marshmallow import fields
from marshmallow_enum import EnumField

from freezing.model import meta
from freezing.model.msg import BaseSchema, BaseMessage
Expand Down
2 changes: 0 additions & 2 deletions freezing/web/utils/gviz_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
class DataTableException(Exception):
"""The general exception object thrown by DataTable."""

pass


class DataTableJSONEncoder(json.JSONEncoder):
"""JSON encoder that handles date/time/datetime objects correctly."""
Expand Down
1 change: 0 additions & 1 deletion freezing/web/utils/hashboard.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import decimal
import os
from typing import List

Expand Down
3 changes: 2 additions & 1 deletion freezing/web/utils/insta.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""
Utility functions for working with images.
"""

import os
import urllib
import shutil

from instagram.client import InstagramAPI
from freezing.web import app, exc
from freezing.web import exc
from freezing.web.config import config

THUMBNAIL_DIMS = (150, 150)
Expand Down
1 change: 0 additions & 1 deletion freezing/web/utils/wktutils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re
from decimal import Decimal
from collections import namedtuple

_point_rx = re.compile("^POINT\((.+)\)$")
Expand Down
12 changes: 8 additions & 4 deletions freezing/web/views/alt_scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
from freezing.model import meta

from freezing.web import config
from freezing.web.views.shared_sql import *
from freezing.web.views.shared_sql import (
team_sleaze_query,
team_segment_query,
indiv_freeze_query,
)


blueprint = Blueprint("alt_scoring", __name__)
Expand All @@ -18,9 +22,9 @@
def team_riders():
q = text(
"""
select b.name, count(a.athlete_id) as ride_days from daily_scores a join teams b
on a.team_id = b.id where a.distance > 1 and b.leaderboard_exclude=0 group by a.team_id order by ride_days desc;
"""
select b.name, count(a.athlete_id) as ride_days from daily_scores a join teams b
on a.team_id = b.id where a.distance > 1 and b.leaderboard_exclude=0 group by a.team_id order by ride_days desc;
"""
)
team_riders = [
(x["name"], x["ride_days"]) for x in meta.scoped_session().execute(q).fetchall()
Expand Down
6 changes: 2 additions & 4 deletions freezing/web/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@
import json

import arrow
import geojson
from flask import Blueprint, jsonify, request
import pytz
from sqlalchemy import text
from stravalib import unithelper as uh

from freezing.model import meta
from freezing.model.orm import RidePhoto, Ride, RideTrack, Athlete

from freezing.web import app, config
from freezing.web import config
from freezing.web.autolog import log
from freezing.web.serialize import RidePhotoSchema
from freezing.web.utils import auth, dates
from freezing.web.utils import auth
from freezing.web.utils.wktutils import parse_linestring

blueprint = Blueprint("api", __name__)
Expand Down
3 changes: 2 additions & 1 deletion freezing/web/views/chartdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

@author: hans
"""

import json
import copy
from collections import defaultdict
from datetime import datetime, timedelta

from flask import current_app, request, Blueprint, jsonify
from flask import current_app, Blueprint, jsonify

from sqlalchemy import text
from dateutil import rrule
Expand Down
1 change: 0 additions & 1 deletion freezing/web/views/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

@author: hans
"""
from datetime import timedelta

from flask import (
render_template,
Expand Down
2 changes: 1 addition & 1 deletion freezing/web/views/people.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import date, timedelta
from datetime import timedelta
from datetime import datetime

from flask import render_template, Blueprint, abort
Expand Down
7 changes: 2 additions & 5 deletions freezing/web/views/photos.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import math
from datetime import date, timedelta
from datetime import datetime

from flask import render_template, Blueprint, app, send_file, request
from sqlalchemy import text
from flask import render_template, Blueprint, send_file, request

from freezing.model import meta
from freezing.model.orm import Team, Athlete, RidePhoto, Ride
from freezing.model.orm import RidePhoto, Ride

from freezing.web import config
from freezing.web.utils import insta
Expand Down
8 changes: 3 additions & 5 deletions freezing/web/views/pointless.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import os
import operator
from datetime import date, datetime, timezone
from datetime import datetime, timezone
from collections import defaultdict
import re

from flask import render_template, Blueprint, abort, redirect, url_for
from flask import render_template, Blueprint, abort
from sqlalchemy import text
import yaml

from freezing.model import meta
from freezing.web.config import config
Expand Down Expand Up @@ -280,7 +278,7 @@ def ross_hill_loop():
@blueprint.route("/coffeeride")
def coffeeride():
year = datetime.now().year
tdata = _get_hashtag_tdata("coffeeride".format(year), "coffeeride", 2)
tdata = _get_hashtag_tdata("coffeeride{}".format(year), "coffeeride", 2)
return render_template(
"pointless/coffeeride.html", data={"tdata": tdata, "year": year}
)
Expand Down
Loading
Loading