コード例 #1
0
def create(tournament, match, **params):
    """Create a new attachment for the specific match."""
    return api.fetch_and_parse(
        "POST",
        "tournaments/%s/matches/%s/attachments" % (tournament, match),
        "match_attachment",
        **params)
コード例 #2
0
ファイル: participants.py プロジェクト: rookes/pychallonge
def create(tournament, name, **params):
    """Add a participant to a tournament."""
    params.update({"name": name})

    return api.fetch_and_parse("POST",
                               "tournaments/%s/participants" % tournament,
                               "participant", **params)
コード例 #3
0
def finalize(tournament, **params):
    """Finalize a tournament that has had all match scores submitted,
    rendering its results permanent.

    """
    return api.fetch_and_parse("POST", "tournaments/%s/finalize" % tournament,
                               **params)
コード例 #4
0
def start(tournament, **params):
    """Start a tournament, opening up matches for score reporting.

    The tournament must have at least 2 participants.

    """
    return api.fetch_and_parse("POST", "tournaments/%s/start" % tournament,
                               **params)
コード例 #5
0
ファイル: participants.py プロジェクト: ZEDGR/pychallonge
def create(tournament, name, **params):
    """Add a participant to a tournament."""
    params.update({"name": name})

    return api.fetch_and_parse(
        "POST",
        "tournaments/%s/participants" % tournament,
        "participant",
        **params)
コード例 #6
0
def open_for_predictions(tournament, **params):
    """Open predictions for a tournament

    Sets the state of the tournament to start accepting predictions.
    'prediction_method' must be set to 1 (exponential scoring) or 2 (linear scoring) to use this option.

    """
    return api.fetch_and_parse(
        "POST", "tournaments/%s/open_for_predictions" % tournament, **params)
コード例 #7
0
def create(name, url, tournament_type="single elimination", **params):
    """Create a new tournament."""
    params.update({
        "name": name,
        "url": url,
        "tournament_type": tournament_type,
    })

    return api.fetch_and_parse("POST", "tournaments", "tournament", **params)
コード例 #8
0
def reset(tournament, **params):
    """Reset a tournament, clearing all of its scores and attachments.

    You can then add/remove/edit participants before starting the
    tournament again.

    """
    return api.fetch_and_parse("POST", "tournaments/%s/reset" % tournament,
                               **params)
コード例 #9
0
ファイル: tournaments.py プロジェクト: AJAnderson/pychallonge
def create(name, url, tournament_type="single elimination", **params):
    """Create a new tournament."""
    params.update({
        "name": name,
        "url": url,
        "tournament_type": tournament_type,
    })

    return api.fetch_and_parse("POST", "tournaments", "tournament", **params)
コード例 #10
0
ファイル: tournaments.py プロジェクト: gregJOE/ChallengeTio
def create(name, url, tournament_type="single elimination", **params):
    """Create a new tournament."""
    params.update({
        "name": name,
        "url": url,
        "tournament_type": tournament_type,
	"sequential_pairings": "true",
	"show_rounds": "true",
    })

    return api.fetch_and_parse("POST", "tournaments", "tournament", **params)
コード例 #11
0
def process_check_ins(tournament, **params):
    """This should be invoked after a tournament's
    check-in window closes before the tournament is started.

    1) Marks participants who have not checked in as inactive.
    2) Moves inactive participants to bottom seeds (ordered by original seed).
    3) Transitions the tournament state from 'checking_in' to 'checked_in'

    """
    return api.fetch_and_parse("POST",
                               "tournaments/%s/process_check_ins" % tournament,
                               **params)
コード例 #12
0
def abort_check_in(tournament, **params):
    """When your tournament is in a 'checking_in' or 'checked_in' state,
    there's no way to edit the tournament's start time (start_at)
    or check-in duration (check_in_duration).
    You must first abort check-in, then you may edit those attributes.

    1) Makes all participants active and clears their checked_in_at times.
    2) Transitions the tournament state from 'checking_in' or 'checked_in' to 'pending'

    """
    return api.fetch_and_parse("POST",
                               "tournaments/%s/abort_check_in" % tournament,
                               **params)
コード例 #13
0
ファイル: participants.py プロジェクト: ZEDGR/pychallonge
def bulk_add(tournament, names, **params):
    """Bulk add participants to a tournament (up until it is started).

    :param tournament: the tournament's name or id
    :param names: the names of the participants
    :type tournament: int or string
    :type names: list or tuple
    :return: each participants info
    :rtype: a list of dictionaries

    """
    params.update({"name": names})

    return api.fetch_and_parse(
        "POST",
        "tournaments/%s/participants/bulk_add" % tournament,
        "participants[]",
        **params)
コード例 #14
0
def bulk_add(tournament, names, **params):
    """Bulk add participants to a tournament (up until it is started).

    :param tournament: the tournament's name or id
    :param names: the names of the participants
    :type tournament: int or string
    :type names: list or tuple
    :return: each participants info
    :rtype: a list of dictionaries

    """
    params.update({"name": names})

    return api.fetch_and_parse(
        "POST",
        "tournaments/%s/participants/bulk_add" % tournament,
        "participants[]",
        **params)
コード例 #15
0
def show(tournament, match_id, **params):
    """Retrieve a single match record for a tournament."""
    return api.fetch_and_parse(
        "GET", "tournaments/%s/matches/%s" % (tournament, match_id), **params)
コード例 #16
0
def index(tournament, **params):
    """Retrieve a tournament's match list."""
    return api.fetch_and_parse("GET", "tournaments/%s/matches" % tournament,
                               **params)
コード例 #17
0
ファイル: participants.py プロジェクト: rookes/pychallonge
def show(tournament, participant_id):
    """Retrieve a single participant record for a tournament."""
    return api.fetch_and_parse(
        "GET", "tournaments/%s/participants/%s" % (tournament, participant_id))
コード例 #18
0
ファイル: participants.py プロジェクト: rookes/pychallonge
def index(tournament):
    """Retrieve a tournament's participant list."""
    return api.fetch_and_parse("GET",
                               "tournaments/%s/participants" % tournament)
コード例 #19
0
def show(tournament, match, attachment):
    """Retrieve a single match attachment record."""
    return api.fetch_and_parse(
        "GET",
        "tournaments/%s/matches/%s/attachments/%s" % (tournament, match, attachment))
コード例 #20
0
def index(tournament, match):
    """Retrieve a set of attachments created for a specific match."""
    return api.fetch_and_parse(
        "GET",
        "tournaments/%s/matches/%s/attachments" % (tournament, match))
コード例 #21
0
ファイル: matches.py プロジェクト: maxwasserman/pychallonge
def show(tournament, match_id, **params):
    """Retrieve a single match record for a tournament."""
    return api.fetch_and_parse(
        "GET",
        "tournaments/%s/matches/%s" % (tournament, match_id),
        **params)
コード例 #22
0
ファイル: matches.py プロジェクト: maxwasserman/pychallonge
def index(tournament, **params):
    """Retrieve a tournament's match list."""
    return api.fetch_and_parse(
        "GET",
        "tournaments/%s/matches" % tournament,
        **params)
コード例 #23
0
ファイル: tournaments.py プロジェクト: AJAnderson/pychallonge
def show(tournament):
    """Retrieve a single tournament record created with your account."""
    return api.fetch_and_parse("GET", "tournaments/%s" % tournament)
コード例 #24
0
def index(**params):
    """Retrieve a set of tournaments created with your account."""
    return api.fetch_and_parse("GET", "tournaments", **params)
コード例 #25
0
def show(tournament, **params):
    """Retrieve a single tournament record created with your account."""
    return api.fetch_and_parse("GET", "tournaments/%s" % tournament, **params)
コード例 #26
0
ファイル: participants.py プロジェクト: ZEDGR/pychallonge
def show(tournament, participant_id):
    """Retrieve a single participant record for a tournament."""
    return api.fetch_and_parse(
        "GET",
        "tournaments/%s/participants/%s" % (tournament, participant_id))
コード例 #27
0
ファイル: participants.py プロジェクト: ZEDGR/pychallonge
def index(tournament):
    """Retrieve a tournament's participant list."""
    return api.fetch_and_parse(
        "GET",
        "tournaments/%s/participants" % tournament)
コード例 #28
0
ファイル: tournaments.py プロジェクト: AJAnderson/pychallonge
def index(**params):
    """Retrieve a set of tournaments created with your account."""
    return api.fetch_and_parse("GET", "tournaments", **params)