fix: fix count order

This commit is contained in:
Alexandre Teles 2023-03-26 18:57:30 -03:00
parent 2f64118d1a
commit c21f557ed7
No known key found for this signature in database
GPG Key ID: DB1C7FA46B1007F0
7 changed files with 7 additions and 240 deletions

View File

@ -1,59 +0,0 @@
name: "CodeQL"
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
schedule:
- cron: '21 13 * * 3'
workflow_dispatch:
env:
default_branch: dev
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ env.default_branch }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ];
then pip install -r requirements.txt;
fi
echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
setup-python-dependencies: false
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"

View File

@ -3,8 +3,6 @@ name: Build dev branch
on:
push:
branches: [ "dev" ]
schedule:
- cron: '24 9 * * 6'
workflow_dispatch:
env:

View File

@ -1,70 +0,0 @@
name: Build a feature branch
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch'
required: true
default: ''
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_TAG: ${{ github.sha }}
jobs:
security_checks:
runs-on: ubuntu-latest
name: Security check
steps:
- uses: actions/checkout@v2
- name: Security Checks (PyCharm Security)
uses: tonybaloney/pycharm-security@master
with:
path: .
build:
needs: security_checks
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Dockerfile
id: checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- name: Setup QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=${{ startsWith(github.ref, 'refs/heads/main') }}
suffix=-${{ github.sha }}
- name: Build Docker image
id: build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64/v8
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@ -3,8 +3,6 @@ name: Build and Publish Docker Image
on:
push:
branches: [ main ]
schedule:
- cron: '24 9 * * 6'
workflow_dispatch:
env:

View File

@ -1,26 +0,0 @@
name: MyPy Type Checking
on:
push:
paths:
- '*.py'
jobs:
mypy:
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.10.8
architecture: x64
- name: Checkout
uses: actions/checkout@v1
- name: Install mypy
run: pip install mypy
- name: Run mypy
uses: sasanquaneuf/mypy-github-action@releases/v1
with:
checkName: 'mypy'
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

View File

@ -1,65 +0,0 @@
on:
pull_request:
branches: [ "main", "dev" ]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_TAG: ${{ github.sha }}
jobs:
security_checks:
runs-on: ubuntu-latest
name: Security check
steps:
- uses: actions/checkout@v2
- name: Security Checks (PyCharm Security)
uses: tonybaloney/pycharm-security@master
with:
path: .
build:
needs: security_checks
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Dockerfile
id: checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- name: Setup QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=${{ startsWith(github.ref, 'refs/heads/main') }}
suffix=-${{ github.sha }}
- name: Build Docker image
id: build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64/v8
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@ -21,14 +21,9 @@ for key in db.scan_iter("*"):
votes[entry["cid"]] = 1
raw_votes: str = pformat(votes)
sorted_votes: str = pformat(sorted(votes))
sorted_votes: str = pformat(sorted(votes, key=votes.get, reverse=True))
text: list = [
'Raw votes:\n\n',
raw_votes,
'\n\nSorted votes:\n\n',
sorted_votes
]
text: list = ["Raw votes:\n\n", raw_votes, "\n\nSorted votes:\n\n", sorted_votes]
with open("votes.txt", "w") as f:
f.writelines(text)
@ -36,22 +31,18 @@ with open("votes.txt", "w") as f:
payload: dict = {
"description": "ReVanced Poll Results",
"sections": [
{"name": "Raw Votes", "syntax": "autodetect", "contents": raw_votes},
{
"name": "Raw Votes",
"name": "Sorted Votes (higher first)",
"syntax": "autodetect",
"contents": raw_votes
"contents": sorted_votes,
},
{
"name": "Sorted Votes",
"syntax": "autodetect",
"contents": sorted_votes
}
]
],
}
headers = {
"Content-Type": "application/json",
"X-Auth-Token": os.environ["PASTE_EE_KEY"]
"X-Auth-Token": os.environ["PASTE_EE_KEY"],
}
response: dict = requests.post(paste_url, json=payload, headers=headers).json()