Skip to content

Commit

Permalink
added descriptors
Browse files Browse the repository at this point in the history
  • Loading branch information
Brisinger committed Aug 13, 2023
1 parent 4835d9d commit 58e7042
Show file tree
Hide file tree
Showing 10 changed files with 784 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
.vscode
src/__pycache__/*.pyc
src/pyBootCamp/__pycache__/*.cpython-310.pyc
src/pyBootCamp/__pycache__/*.pyc
src/djangoProject/portfolio/env
.pylintrc
152 changes: 151 additions & 1 deletion src/djangoProject/portfolio/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,154 @@
asgiref==3.5.2
astroid==2.12.12
click==8.1.3
dill==0.3.6
Django==4.1.2
Flask==2.2.2
isort==5.10.1
itsdangerous==2.1.2
Jinja2==3.1.2
lazy-object-proxy==1.8.0
MarkupSafe==2.1.1
mccabe==0.7.0
platformdirs==2.5.4
pycodestyle==2.9.1
pydocstyle==6.1.1
pylint==2.15.5
pyobjc==8.5.1
pyobjc-core==8.5.1
pyobjc-framework-Accessibility==8.5.1
pyobjc-framework-Accounts==8.5.1
pyobjc-framework-AddressBook==8.5.1
pyobjc-framework-AdServices==8.5.1
pyobjc-framework-AdSupport==8.5.1
pyobjc-framework-AppleScriptKit==8.5.1
pyobjc-framework-AppleScriptObjC==8.5.1
pyobjc-framework-ApplicationServices==8.5.1
pyobjc-framework-AppTrackingTransparency==8.5.1
pyobjc-framework-AudioVideoBridging==8.5.1
pyobjc-framework-AuthenticationServices==8.5.1
pyobjc-framework-AutomaticAssessmentConfiguration==8.5.1
pyobjc-framework-Automator==8.5.1
pyobjc-framework-AVFoundation==8.5.1
pyobjc-framework-AVKit==8.5.1
pyobjc-framework-BusinessChat==8.5.1
pyobjc-framework-CalendarStore==8.5.1
pyobjc-framework-CallKit==8.5.1
pyobjc-framework-CFNetwork==8.5.1
pyobjc-framework-ClassKit==8.5.1
pyobjc-framework-CloudKit==8.5.1
pyobjc-framework-Cocoa==8.5.1
pyobjc-framework-Collaboration==8.5.1
pyobjc-framework-ColorSync==8.5.1
pyobjc-framework-Contacts==8.5.1
pyobjc-framework-ContactsUI==8.5.1
pyobjc-framework-CoreAudio==8.5.1
pyobjc-framework-CoreAudioKit==8.5.1
pyobjc-framework-CoreBluetooth==8.5.1
pyobjc-framework-CoreData==8.5.1
pyobjc-framework-CoreHaptics==8.5.1
pyobjc-framework-CoreLocation==8.5.1
pyobjc-framework-CoreMedia==8.5.1
pyobjc-framework-CoreMediaIO==8.5.1
pyobjc-framework-CoreMIDI==8.5.1
pyobjc-framework-CoreML==8.5.1
pyobjc-framework-CoreMotion==8.5.1
pyobjc-framework-CoreServices==8.5.1
pyobjc-framework-CoreSpotlight==8.5.1
pyobjc-framework-CoreText==8.5.1
pyobjc-framework-CoreWLAN==8.5.1
pyobjc-framework-CryptoTokenKit==8.5.1
pyobjc-framework-DeviceCheck==8.5.1
pyobjc-framework-DictionaryServices==8.5.1
pyobjc-framework-DiscRecording==8.5.1
pyobjc-framework-DiscRecordingUI==8.5.1
pyobjc-framework-DiskArbitration==8.5.1
pyobjc-framework-DVDPlayback==8.5.1
pyobjc-framework-EventKit==8.5.1
pyobjc-framework-ExceptionHandling==8.5.1
pyobjc-framework-ExecutionPolicy==8.5.1
pyobjc-framework-ExternalAccessory==8.5.1
pyobjc-framework-FileProvider==8.5.1
pyobjc-framework-FileProviderUI==8.5.1
pyobjc-framework-FinderSync==8.5.1
pyobjc-framework-FSEvents==8.5.1
pyobjc-framework-GameCenter==8.5.1
pyobjc-framework-GameController==8.5.1
pyobjc-framework-GameKit==8.5.1
pyobjc-framework-GameplayKit==8.5.1
pyobjc-framework-ImageCaptureCore==8.5.1
pyobjc-framework-IMServicePlugIn==8.5.1
pyobjc-framework-InputMethodKit==8.5.1
pyobjc-framework-InstallerPlugins==8.5.1
pyobjc-framework-InstantMessage==8.5.1
pyobjc-framework-Intents==8.5.1
pyobjc-framework-IOSurface==8.5.1
pyobjc-framework-iTunesLibrary==8.5.1
pyobjc-framework-KernelManagement==8.5.1
pyobjc-framework-LatentSemanticMapping==8.5.1
pyobjc-framework-LaunchServices==8.5.1
pyobjc-framework-libdispatch==8.5.1
pyobjc-framework-LinkPresentation==8.5.1
pyobjc-framework-LocalAuthentication==8.5.1
pyobjc-framework-MapKit==8.5.1
pyobjc-framework-MediaAccessibility==8.5.1
pyobjc-framework-MediaLibrary==8.5.1
pyobjc-framework-MediaPlayer==8.5.1
pyobjc-framework-MediaToolbox==8.5.1
pyobjc-framework-Metal==8.5.1
pyobjc-framework-MetalKit==8.5.1
pyobjc-framework-MetalPerformanceShaders==8.5.1
pyobjc-framework-MetalPerformanceShadersGraph==8.5.1
pyobjc-framework-MLCompute==8.5.1
pyobjc-framework-ModelIO==8.5.1
pyobjc-framework-MultipeerConnectivity==8.5.1
pyobjc-framework-NaturalLanguage==8.5.1
pyobjc-framework-NetFS==8.5.1
pyobjc-framework-Network==8.5.1
pyobjc-framework-NetworkExtension==8.5.1
pyobjc-framework-NotificationCenter==8.5.1
pyobjc-framework-OpenDirectory==8.5.1
pyobjc-framework-OSAKit==8.5.1
pyobjc-framework-OSLog==8.5.1
pyobjc-framework-PassKit==8.5.1
pyobjc-framework-PencilKit==8.5.1
pyobjc-framework-Photos==8.5.1
pyobjc-framework-PhotosUI==8.5.1
pyobjc-framework-PreferencePanes==8.5.1
pyobjc-framework-PushKit==8.5.1
pyobjc-framework-Quartz==8.5.1
pyobjc-framework-QuickLookThumbnailing==8.5.1
pyobjc-framework-ReplayKit==8.5.1
pyobjc-framework-SafariServices==8.5.1
pyobjc-framework-SceneKit==8.5.1
pyobjc-framework-ScreenSaver==8.5.1
pyobjc-framework-ScreenTime==8.5.1
pyobjc-framework-ScriptingBridge==8.5.1
pyobjc-framework-SearchKit==8.5.1
pyobjc-framework-Security==8.5.1
pyobjc-framework-SecurityFoundation==8.5.1
pyobjc-framework-SecurityInterface==8.5.1
pyobjc-framework-ServiceManagement==8.5.1
pyobjc-framework-Social==8.5.1
pyobjc-framework-SoundAnalysis==8.5.1
pyobjc-framework-Speech==8.5.1
pyobjc-framework-SpriteKit==8.5.1
pyobjc-framework-StoreKit==8.5.1
pyobjc-framework-SyncServices==8.5.1
pyobjc-framework-SystemConfiguration==8.5.1
pyobjc-framework-SystemExtensions==8.5.1
pyobjc-framework-UniformTypeIdentifiers==8.5.1
pyobjc-framework-UserNotifications==8.5.1
pyobjc-framework-UserNotificationsUI==8.5.1
pyobjc-framework-VideoSubscriberAccount==8.5.1
pyobjc-framework-VideoToolbox==8.5.1
pyobjc-framework-Virtualization==8.5.1
pyobjc-framework-Vision==8.5.1
pyobjc-framework-WebKit==8.5.1
pyttsx3==2.90
snowballstemmer==2.2.0
sqlparse==0.4.3
pip>=22.3
tomli==2.0.1
tomlkit==0.11.6
Werkzeug==2.2.2
wrapt==1.14.1
192 changes: 192 additions & 0 deletions src/pyBootCamp/11_practice07.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
# module to explore super object.


class A:
"""Class used as base class.
Attributes:
----------
val (int): Integer class based attribute.
Methods:
--------
__str__() : Instance overriding string method returning the name of the class.
"""
# class attribute
val = 10

def __str__(self) -> str:
"""Returns the name of the class.
Returns:
-------
qualified name of the class as string.
"""
return self.__class__.__qualname__


class B(A):
"""Class deriving from A.
Attributes:
-----------
val (int): Integer class based attribute.
Methods:
--------
__str__() : Instance overriding string method returning the name of the class.
"""
val = 2

def __str__(self) -> str:
"""Returns the name of the class.
Returns:
--------
The qualified name of the class as a string.
"""
return self.__class__.__qualname__


class C(A):
"""Class deriving from A.
Attributes:
-----------
val (int): Integer class based attribute.
Methods:
--------
__str__() : Instance overriding string method returning the name of the class.
"""
val = 1

def __str__(self) -> str:
"""Returns the name of the class.
Returns:
--------
The qualified name of the class as a string.
"""
return self.__class__.__qualname__


class X(A):
"""Class deriving from A.
Attributes:
-----------
val (int): Integer class based attribute.
Methods:
--------
__str__() : Instance overriding string method returning the name of the class.
"""
val = 1

def __str__(self) -> str:
"""Returns the name of the class.
Returns:
--------
The qualified name of the class as a string.
"""
return self.__class__.__qualname__


class Y(X):
"""Class deriving from X.
Attributes:
-----------
val (int): Integer class based attribute.
Methods:
--------
__str__() : Instance overriding string method returning the name of the class.
"""
val = 3

def __str__(self) -> str:
"""Returns the name of the class.
Returns:
--------
The qualified name of the class as a string.
"""
return self.__class__.__qualname__


class Z(Y, X):
"""Class deriving from Y and X.
Attributes:
-----------
val (int): Integer class based attribute.
Methods:
--------
__str__() : Instance overriding string method returning the name of the class.
"""
val = 5

def __str__(self) -> str:
"""Returns the name of the class.
Returns:
--------
The qualified name of the class as a string.
"""
return self.__class__.__qualname__


class D(C, Z, B):
"""Class deriving from B and C.
Attributes:
-----------
val (int): Integer class based attribute.
"""
val = 5



if __name__=="__main__":
a = A()
b = B()
c = C()
d = D()
print("Class:",d)
print(f"Method resolution order: {D.__mro__}")
print(f"Is object of {d} an instance of {a}: {isinstance(b, A)}")
print(f"Is object of {d} a subtype of itself: {issubclass(type(d), D)}")

_super = super(C, d)
print(f"Type of _super is {_super}, method resolution order: {type(_super).__mro__}")
print(f"The val attribute: {_super.val}")

_super = super(D, d)
print(f"Type of _super is {_super}, method resolution order: {type(_super).__mro__}")
print(f"The val attribute: {_super.val}")

_super = super(B, d)
print(f"The type of _super is {_super.__thisclass__}, the object or type of super's second argument is {_super.__self__} and {_super.__self_class__}")

_super = super(D)
print(f"The type of _super is {_super.__thisclass__}, the object or type of super's second argument is {_super.__self__} and {_super.__self_class__}")

D.parent = _super
print(f"The type of _super is {d.parent.__thisclass__}, the object or type of super's second argument is {d.parent.__self__} and {d.parent.__self_class__}")
Loading

0 comments on commit 58e7042

Please sign in to comment.