Skip to content

Commit

Permalink
Microrefactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
inbalboa committed Aug 12, 2023
1 parent c73b26e commit 8ee6c44
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
1 change: 1 addition & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ exclude = ["pymstodo/__init__.py"]
fix = true
show-fixes = true
target-version = "py38"
line-length = 120

[isort]
combine-as-imports = true
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ lint:
@python3 -m ruff check "$(CURDIR)"
@python3 -m mypy --ignore-missing-imports --strict pymstodo

check:
@printf "==> checking the working tree... "
@sh -c 'if [ -z "$\(git status --porcelain=v1)" ]; then printf "clean\n"; else printf "working tree is dirty, please, commit changes\n" && false; fi'

tag:
@printf "==> tagging...\n"
@git tag -a "v$(TAG)" -m "Release $(TAG)"

pub:
@printf "==> git push...\n"
@git tag -a "v$(TAG)" -m "Release $(TAG)"
@printf "==> pushing...\n"
@git push --atomic origin master "v$(TAG)"

docs_gen:
Expand All @@ -28,8 +31,8 @@ win_tz:
@printf "==> getting windows time zones...\n"
@python3 update_win_tz.py

run: lint tag pub
run: lint check tag pub docs
@printf "\nPublished at %s\n\n" "`date`"

.DEFAULT_GOAL := run
.PHONY: lint tag pub docs win_tz run
.PHONY: lint check tag pub docs win_tz run
35 changes: 35 additions & 0 deletions inc.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/gawk -f

BEGIN{

printf("%s\n", i)
}

function inc(s, a, len1, len2, len3, head, tail)
{
split(s, a, ".")

len1 = length(a)
if(len1==0)
return -1
else if(len1==1)
return s+1

len2 = length(a[len1])
len3 = length(a[len1]+1)

head = join(a, 1, len1-1)
tail = sprintf("%0*d", len2, (a[len1]+1)%(10^len2))

if(len2==len3)
return head "." tail
else
return inc(head) "." tail
}

function join(a, x, y, s)
{
for(i=x; i<y; i++)
s = s a[i] "."
return s a[y]
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def find_version():
setuptools.setup(
name='pymstodo',
version=find_version(),
author='Sergey Shlyapugin',
author='Serhiy Shliapuhin',
author_email='shlyapugin@gmail.com',
description='Microsoft To Do API client',
long_description=long_description(),
Expand Down

0 comments on commit 8ee6c44

Please sign in to comment.