Skip to content

Commit

Permalink
Add examples and docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
justgigio committed Nov 8, 2023
1 parent 3642c7c commit 4f3216d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 46 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,45 +47,3 @@ jobs:
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[![codecov](https://codecov.io/gh/justgigio/awesome-git-mosaic/graph/badge.svg?token=0ON0YL8EAH)](https://codecov.io/gh/justgigio/awesome-git-mosaic)
![build](https://github.com/justgigio/awesome-git-mosaic/actions/workflows/build.yml/badge.svg)
[![PyPI version](https://badge.fury.io/py/awesome-git-mosaic.svg)](https://badge.fury.io/py/awesome-git-mosaic)
![Python Versions](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue)
![License](https://img.shields.io/pypi/l/awesome-git-mosaic)
![build](https://github.com/justgigio/awesome-git-mosaic/actions/workflows/build.yml/badge.svg)
[![codecov](https://codecov.io/gh/justgigio/awesome-git-mosaic/graph/badge.svg?token=0ON0YL8EAH)](https://codecov.io/gh/justgigio/awesome-git-mosaic)
[![Documentation Status](https://readthedocs.org/projects/awesome-git-mosaic/badge/?version=latest)](https://awesome-git-mosaic.readthedocs.io/en/latest/?badge=latest)

# awesome-git-mosaic
Expand Down
2 changes: 1 addition & 1 deletion src/awesome_git_mosaic/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

def main():
if len(sys.argv) > 1:
write(sys.argv[1], 45, 1, True)
write(sys.argv[1], 45, 1, True, True)
else:
print("You need to give something to write")

Expand Down
28 changes: 27 additions & 1 deletion src/awesome_git_mosaic/usecases/write_mosaic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ def __init__(
git_gateway: GitGateway = None,
modify_file: ModifyFile = None,
):
"""
Class wich will get calculated timestamps, make commits and pushes
:param git_mosaic_adapter: The adapater wich convert pixels to timestamp, defaults to GitMosaicAdapter
:type git_mosaic_adapter: GitMosaicAdapter, optional
:param git_gateway: The gateway wich will perform git actions, defaults to GitGateway
:type git_gateway: GitGateway, optional
:param modify_file: The usecase wich make files modifications to commit, defaults to ModifyFile
:type modify_file: ModifyFile, optional
"""
self.git_mosaic_adapter = git_mosaic_adapter or GitMosaicAdapter()
self.git_gateway = git_gateway or GitGateway()
self.modify_file = modify_file or ModifyFile()
Expand All @@ -25,11 +35,27 @@ def write(
background: bool = False,
inverted: bool = False,
):
"""
Perform commits and pushes, writing the message on mosaic
:param message: The massage that will be written
:type message: str
:param strength: How many commits each pixel will have, defaults to 15
:type strength: int, optional
:param multiply: How many times the message will be written consecutively, defaults to 1
:type multiply: int, optional
:param with_spaces: if it will be spaces between the characters, defaults to True
:type with_spaces: bool, optional
:param background: if it will have bacjaground or not, defaults to False
:type background: bool, optional
:param inverted: if it will be inverted or not, defaults to False
:type inverted: bool, optional
"""
timestamps: list[datetime] = []
if background:
bgstr = " " * (len(message) * multiply)
timestamps += self.git_mosaic_adapter.output(
bgstr, datetime.today(), with_spaces, True
bgstr, None, with_spaces, True
)

for _ in range(strength):
Expand Down

0 comments on commit 4f3216d

Please sign in to comment.