Chapter folders renamed

This commit is contained in:
Karan Solanki
2021-08-13 11:44:51 +05:30
parent d9f3f5b159
commit 1eb709f83a
211 changed files with 0 additions and 0 deletions
@@ -0,0 +1,4 @@
from .mycalculator import add, subtract
from .myrandom import random_1d, random_2d
from .advcalc.advcalculator import sqrt, log, ln
@@ -0,0 +1 @@
#empty
@@ -0,0 +1,14 @@
# advcalculator.py with sqrt,log and ln functions
import math
def sqrt(x):
"""This function takes square root of a number"""
return math.sqrt(x)
def log(x):
"""This function returns log of base 10"""
return math.log(x,10)
def ln(x):
"""This function returns log of base 2"""
return math.log(x,2)
@@ -0,0 +1,9 @@
# mycalculator.py with add and subtract functions
def add(x, y):
"""This function adds two numbers"""
return x + y
def subtract(x, y):
"""This function subtracts two numbers"""
return x - y
@@ -0,0 +1,14 @@
# myrandom.py with default and custom random functions
import random
def random_1d():
"""This function get a random number between 0 and 9"""
return random.randint(0,9)
def random_2d():
"""This function get a random number between 10 and 99"""
return random.randint(10,99)
def get_random(lower, upper):
"""This function get a random number between lower and upper"""
return random.randint(lower,upper)
@@ -0,0 +1,19 @@
Copyright (c) 2016 The Python Packaging Authority (PyPA)
Permission is hereby granted, free of charge, to any person obtaining a copy of
self software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and self permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,10 @@
include pyproject.toml
# Include the README
include *.md
# Include the license file
include LICENSE.txt
# Include the data files
recursive-include data *
@@ -0,0 +1,5 @@
# A sample package project
![Python Logo](https://www.python.org/static/community_logos/python-logo.png "Sample inline image")
A sample project to build a package and then deploy it using different approaches
@@ -0,0 +1 @@
#empty file for GitHub upload
+1
View File
@@ -0,0 +1 @@
#empty file for GitHub upload
@@ -0,0 +1,4 @@
from .mycalculator import add, subtract
from .myrandom import random_1d, random_2d
from .advcalc.advcalculator import sqrt, log, ln
@@ -0,0 +1 @@
#empty
@@ -0,0 +1,14 @@
# advcalculator.py with sqrt,log and ln functions
import math
def sqrt(x):
"""This function takes square root of a number"""
return math.sqrt(x)
def log(x):
"""This function returns log of base 10"""
return math.log(x,10)
def ln(x):
"""This function returns log of base 2"""
return math.log(x,2)
@@ -0,0 +1,9 @@
# mycalculator.py with add and subtract functions
def add(x, y):
"""This function adds two numbers"""
return x + y
def subtract(x, y):
"""This function subtracts two numbers"""
return x - y
@@ -0,0 +1,14 @@
# myrandom.py with default and custom random functions
import random
def random_1d():
"""This function get a random number between 0 and 9"""
return random.randint(0,9)
def random_2d():
"""This function get a random number between 10 and 99"""
return random.randint(10,99)
def get_random(lower, upper):
"""This function get a random number between lower and upper"""
return random.randint(lower,upper)
@@ -0,0 +1,16 @@
Metadata-Version: 1.2
Name: masifutilv2
Version: 0.1.0
Summary: A sample package for illustration purposes
Home-page: http://pypi.python.org/pypi/PackageName/
Author: Muhammad Asif
Author-email: ma@example.com
License: LICENSE.txt
Description: # A sample package project
![Python Logo](https://www.python.org/static/community_logos/python-logo.png "Sample inline image")
A sample project to build a package and then deploy it using different approaches
Platform: UNKNOWN
Requires-Python: >=3.5, <4
@@ -0,0 +1,14 @@
LICENSE.txt
MANIFEST.in
README.md
setup.cfg
setup.py
masifutil/__init__.py
masifutil/mycalculator.py
masifutil/myrandom.py
masifutil/advcalc/__init__.py
masifutil/advcalc/advcalculator.py
masifutilv2.egg-info/PKG-INFO
masifutilv2.egg-info/SOURCES.txt
masifutilv2.egg-info/dependency_links.txt
masifutilv2.egg-info/top_level.txt
@@ -0,0 +1,2 @@
masifutil
masifutil/advcalc
@@ -0,0 +1,4 @@
[metadata]
# This includes the license file(s) in the wheel.
# https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file
license_files = LICENSE.txt
+16
View File
@@ -0,0 +1,16 @@
from setuptools import setup
setup(
name='masifutilv2',
version='0.1.0',
author='Muhammad Asif',
author_email='ma@example.com',
packages=['masifutil','masifutil/advcalc'],
python_requires='>=3.5, <4',
url='http://pypi.python.org/pypi/PackageName/',
license='LICENSE.txt',
description='A sample package for illustration purposes',
long_description=open('README.md').read(),
install_requires=[
],
)
@@ -0,0 +1 @@
#empty file for GitHub upload
+27
View File
@@ -0,0 +1,27 @@
# mypkgmain0.py with absolute imports
import masifutil.mycalculator as calc
import masifutil.myrandom as rand
import masifutil.advcalc.advcalculator as acalc
def my_main():
""" This is a main function which generates two random numbers and then apply calculator functions on them """
x = rand.random_2d()
y = rand.random_1d()
sum = calc.add(x,y)
diff = calc.subtract(x,y)
sroot = acalc.sqrt(x)
log10x = acalc.log(x)
log2x = acalc.ln(x)
print("x = {}, y = {}".format(x, y))
print("sum is {}".format(sum))
print("diff is {}".format(diff))
print("square root is {}".format(sroot))
print("log base of 10 is {}".format(log10x))
print("log base of 2 is {}".format(log2x))
""" This is executed only if the special variable '__name__' is set as main"""
if __name__ == "__main__":
my_main()
+27
View File
@@ -0,0 +1,27 @@
# mypkgmain1.py with main function
from masifutil import mycalculator as calc
from masifutil import myrandom as rand
from masifutil.advcalc import advcalculator as acalc
def my_main():
""" This is a main function which generates two random numbers and then apply calculator functions on them """
x = rand.random_2d()
y = rand.random_1d()
sum = calc.add(x,y)
diff = calc.subtract(x,y)
sroot = acalc.sqrt(x)
log10x = acalc.log(x)
log2x = acalc.ln(x)
print("x = {}, y = {}".format(x, y))
print("sum is {}".format(sum))
print("diff is {}".format(diff))
print("square root is {}".format(sroot))
print("log base of 10 is {}".format(log10x))
print("log base of 2 is {}".format(log2x))
""" This is executed only if the special variable '__name__' is set as main"""
if __name__ == "__main__":
my_main()
+25
View File
@@ -0,0 +1,25 @@
# pkgmain2.py with with main function
import masifutil
def my_main():
""" This is a main function which generates two random numbers and then apply calculator functions on them """
x = masifutil.random_2d()
y = masifutil.random_1d()
sum = masifutil.add(x,y)
diff = masifutil.subtract(x,y)
sroot = masifutil.sqrt(x)
log10x = masifutil.log(x)
log2x = masifutil.ln(x)
print("x = {}, y = {}".format(x, y))
print("sum is {}".format(sum))
print("diff is {}".format(diff))
print("square root is {}".format(sroot))
print("log base of 10 is {}".format(log10x))
print("log base of 2 is {}".format(log2x))
""" This is executed only if the special variable '__name__' is set as main"""
if __name__ == "__main__":
my_main()