Skip to content

Sadhiin/setup issue and github action failed #93

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

Merged
merged 9 commits into from
Oct 25, 2024
8 changes: 7 additions & 1 deletion .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ jobs:
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v1
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install .
- name: Install pypa/build
run: >-
python -m
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/run_black_and_isort.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install .
pip install black isort
- name: Run black and isort
run: |
python -m black easyPythonpi/*
python -m isort easyPythonpi/*

4 changes: 3 additions & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v3
Expand All @@ -21,6 +21,8 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install .
pip install regex
- name: Run tests
Expand Down
166 changes: 164 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,168 @@
# prevents all pycaches from being added
# prevents all pycaches from being added
__pycache__
easyPythonpi/__pycache__
build
dist
easyPythonpi.egg.info
easyPythonpi.egg.info

__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
24 changes: 24 additions & 0 deletions easyPythonpi/methods/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,27 @@ def arrayrev(array:'list')->'list':

return reversed_array


def fast_arrayrev(array: 'list') -> 'list':
"""
Reverses the elements of the input list.

Parameters:
array (list): The list to be reversed.

Returns:
list: A new list containing the elements of the input list in reverse order.

Steps:
1. The function takes a single argument, `array`, which is expected to be a list.
2. It uses Python's slicing feature to reverse the list:
- The slice notation `array[::-1]` means:
- Start[start::] from the end [:end:] of the list (indicated by the negative step)[start : end : -1].
- Move backwards through the list.
- The result is a new list that contains the elements of `array` in reverse order.
3. The reversed list is stored in the variable `reversed_array`.
4. Finally, the function returns `reversed_array`, which is the reversed version of the input list.
source: https://www.geeksforgeeks.org/python-reversed-vs-1-which-one-is-faster/
"""
reversed_array = array[::-1]
return reversed_array
55 changes: 35 additions & 20 deletions easyPythonpi/methods/linkedlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,56 @@
#-*- coding: utf-8 -*-


#Linked list
def create_node(data:'int')->'list':
class node:
def __init__(self,data):
self.data=data
self.next=None
a=node(data)
#Linked list

class Node:
def __init__(self,data):
self.data=data
self.next=None

def create_node(data:'int')->'Node':
a=Node(data)
return a


# to link a node with another node
def node_link(a:'int',b:'int'):
def node_link(a:'Node', b:'Node'):
a.next=b
b.next=None
#a=node(data1)


# to count number of nodes
def count_node(head:'node')->'int':


# to count number of nodes
def count_node(head:'Node')->'int':
count=0
if head is None:
return 0
return count
else:
temp=head
count=0
while(temp!=None):
count=count+1
temp=temp.next
return count
count=count+1
temp=temp.next
return count

# to diplay a linked list whose header node is passed as an argument.
def display_nodes(head:'node')->'int':
def display_nodes(head:'Node')->None:
t=head
while t is not None:
print(t.data,"->",end="")
t=t.next
print("NULL")

# re revrese a lined list
def revrese_lined_list(head: 'Node')->'Node':
prev = None
# a -> b -> c -> d -> e -> f -> g -> h -> None
current = head
while current is not None:
next = current.next # b -> c -> d -> so one...

current.next = prev # a -> None
prev = current # b -> a -> None
current = next # c -> d -> e -> f -> g -> h -> None
head=prev # h -> g -> f -> e -> d -> c -> b -> a -> None

return head
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
numpy >= 1.19.5
requests >= 2.25.1
Loading
Loading