data_structures module
- class data_structures.FIFO(inf=1, capacity=0)
Bases:
Queue
You Can Use This Insted Of Queue. All Methods Of Queue Are Available Here.
- class data_structures.LIFO(inf=1, capacity=0)
Bases:
Stack
You Can Use This Insted Of Stack. All Methods Of Stack Are Available Here.
- class data_structures.PyshaDict
Bases:
dict
Thats Just Normal Dictionary Just With 2 Or 3 More Option. PyshaDict Operators : * ~myDict # Returns Dictionary Inverse * myDict - “elem” # Returns Dicionary With Removed “elem” Key.
- property inverse
You Can Get inverse Of A Dictionary. For Example Dict -> {“nickname”:”MrMegaExpert”}, Inverse -> {“MrMegaExpert”:”nickname”} You Can Set And Change Dicitonary In Inverse Mode ! You Can Get Inverse Of A Dictionary In 2 Ways : * myDict.inverse * ~myDict
- class data_structures.PyshaList(iterable=(), /)
Bases:
list
PyshaList That Have Some Advanteges To Normal List.
- count_deep(tar)
Deep Count. If You Pass A list Of String, It Will Check If The tar ( Argument That Passed To This Function ) Is Inside The list itself or is inside the elements of list or not. If you pass a list with complex dimentions it will count inside of all of elements even insidest element ! and it will count it for you.
- lshift(times)
Left Shift In Times That You Specify
- static make_array(dimentions)
Make Array In Complex Dimentions. You Can Use This Method Like :
`PyshaList.make_array([1,2,4,5,4,32])`
- rshift(times)
Right Shift In Times That You Specify
- set_array(dimentions, value)
Set Array In Complex Dimentions. You Can Use This Method Like :
` array = PyshaList.make_array([1,2,4,5,4,32]) # Just A Complex Array array.set_array([0,2,4,0,4,3],"test") `
Or Like This :`array[0,2,4,0,4,3] = "test"`
Cool, Right ? :)
- shift_index(index, left_shift=True, how_many=1)
You Can Shift Your Array Better That Just lshift And rshift Methods. You Can Define Which Index To Shift, Type Of Shift ( left or right ) And how_many To Shift.
Arguments : * index, # Index That You Want To Shift * left_shift=True, # Left Or Right Shift That You Can Specifiy. Default Is Left Shift * how_many=1 # How Many Shifts That You Want. Default Is One
- class data_structures.PyshaString
Bases:
str
In PyshaString You Have Lots Of Methods To Do Some Things.
- exists(data_to_search: list, line_start=-1, line_end=-1, start_index=-1, end_index=-1)
This Function Will Check If A List Of Strings Exists In Another String. In Specific Part Of It Or Not. It Will Get a Part Of String And Will Check It With A List Of Strings.
Args : * data_to_replace -> A List Of Data That You Want To Check If Exists In Another String.
line_start -> Line Start Number ( Starts With 0 )
line_end -> Line End Number ( Starts With 0 )
start_index -> Start Index Number ( Starts With 0 )
end_index -> End Index Number ( Starts With 0 )
- find_first(data_to_search: list, return_type=<class 'int'>)
In This Function You Can Search That an String Contains Some Other String From A List.
Args : * data_to_search -> Strings That You Want To Search For. For Example
Search In List : [” “, “:”, “,”] And If Your String Is “Hello, Im Arshia” It will Return 5 Thats Index Of “,”. If Your String Is “Arshia:Hey” It Will Return 6 Thats Index Of “:”.
- return_type -> You Can pass int To Return Index Of Found String. Or Pass Other
Things Like str To Return Found String.
- find_last(data_to_search: list, return_type=<class 'int'>)
This Function Is Exactly find_first But It Will Return Last Index Of Found String.
Args : * data_to_search -> Strings That You Want To Search For. For Example
Search In List : [” “, “:”, “,”] And If Your String Is “Hello, Im Arshia” It will Return 10 Thats Index Of ” “. If Your String Is “Arshia:Hey” It Will Return 6 Thats Index Of “:”.
- return_type -> You Can pass int To Return Index Of Found String. Or Pass Other
Things Like str To Return Found String.
- inside(data_to_search: ~data_structures.ListOrDict, search_mode='key', return_type=<class 'bool'>)
In This Function You Can Search That If A String Exists In Dict ( Or Inside Of All Elements ). Or If A String Exists In List And All Of Its Elements.
Args : * data_to_search -> Data That Wanted To Search In That. For Example
Search In List : [“test”, “some”, “Hello World”] Or Search In dict : {“test”: “Hello World”, “some”: “Hello World”} -> ( search_mode must be “value” or “both” in dict input ) if string is Hello It Will Return True !
- search_mode -> If You Passed A Dictionary You Can Choose Between “key” Or “value”
Or “all”/”both” To Search In Both Of Them. It Does Not Do Anything If You Passed A List.
- return_type -> If You Passed A Dictionary You Can Choose Between bool and dict or …
if you pass bool, it will return True or False If It Finds Your String. if you pass dict, it will return a dict with key and value of found element. if you pass pass anything else, it will return oposite of search_mode. For Example If You passed “key” And You Found Your String, It Will Return “value”.
- replace_array(data_to_replace: list, replace_with: ListOrString)
In This Function You Can Replace An Array With Another Array ! ( in a string ). Its Possible That You Replace An Array Of String With A Single String Too.
Args : * data_to_replace -> Data That You Wanted To Be Replaced For Example If Data Is
[“Hello”, “World”] And replace_with Argument Is [“Hi”, “There”] All Of “Hello” And “World” Will Be Replaced With “Hi” And “There”.
replace_with -> Described In data_to_replace Argument.
- replace_dict(data_to_replace: dict)
This Is replace_array But You Can Pass Dictionary To Replace With.
Args : * data_to_replace -> A Dictionary Of Data To Replace. For Example
{“Hello”: “Hi”, “World”: “There”} Will Replace “Hello” With “Hi” And “World” With “There”. ( All Of String )
- replace_with_escape(string_to_find, to_replace, escape_char='\\', remove_escapes=False)
This Function Will Replace Any String That You Want But You Can Define Some Parts Not To Replace With Define Escapes !
Args : * string_to_find -> String That You Want To Search For In String.
to_replace -> String That You Want To Be Replaced With string_to_find.
escape_char -> Escape Character That You Want To Define. ( Default Is Character )
- remove_escapes -> You Can Define That After Replacing, Escape Characters Should Remove
Or Not. ( Default Is False )