{"id":22680181,"url":"https://github.com/coderooz/my_simple_functions","last_synced_at":"2025-08-08T16:05:33.445Z","repository":{"id":241264619,"uuid":"777572969","full_name":"coderooz/My_simple_functions","owner":"coderooz","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-25T04:30:22.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T14:36:24.392Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coderooz.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-26T05:23:16.000Z","updated_at":"2024-07-10T07:04:54.000Z","dependencies_parsed_at":"2024-05-23T07:48:00.082Z","dependency_job_id":"01bd1eba-4fa5-4fb1-9c7d-28040cfc72f8","html_url":"https://github.com/coderooz/My_simple_functions","commit_stats":null,"previous_names":["coderooz/my_simple_functions"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderooz%2FMy_simple_functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderooz%2FMy_simple_functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderooz%2FMy_simple_functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderooz%2FMy_simple_functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderooz","download_url":"https://codeload.github.com/coderooz/My_simple_functions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246193156,"owners_count":20738450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-09T19:12:38.976Z","updated_at":"2025-03-29T13:43:22.152Z","avatar_url":"https://github.com/coderooz.png","language":"Python","readme":"# Personal EveryDay Usage Functions\r\n\r\n## Project Author Details: \r\n- \u003cb\u003eName\u003c/b\u003e: \u003cem\u003eRanit Saha\u003c/em\u003e\r\n- \u003cb\u003eCode Name\u003c/b\u003e: \u003cem\u003eCodezees\u003c/em\u003e\r\n- \u003cb\u003eGuthub Profile\u003c/b\u003e: \u003cem\u003ehttps://github.com/Codezees\u003c/em\u003e\r\n\r\n\r\n## Contents:\r\n\r\n1. [Project Info](#project_info)\r\n2. [Project Files](#project_files)\r\n3. [Files Description](#project_file_description)\r\n\r\n## \u003ca id='project_info'\u003eProject Info\u003c/a\u003e\r\n\u003cp\u003eThis is just a personal project where I make classes and fuctions that will help me do certain task more effectiely rather that re-codig them again and again.\u003c/p\u003e\r\n\r\n## \u003ca id='project_files'\u003eProject Files\u003c/a\u003e\r\n\u003cb\u003e\u003cem\u003eProject Files are:-\u003c/em\u003e\u003c/b\u003e\r\n- [AsyncHandler](#asyncHandler_file)\r\n- [DataHandler](#dataHandler_file)\r\n- [DbSqliteHandler](#dbsqlithandler_file)\r\n- [Filehandler](#fileHandler_file)\r\n- [HtmlScraper](#htmlScraper_file)\r\n- [Requester](#requester_file)\r\n\r\n## \u003ca id='project_file_description'\u003eFiles Description\u003c/a\u003e\r\n\u003cb\u003e\u003cem\u003eFile Descriptions\u003c/em\u003e\u003c/b\u003e\r\n\r\n### \u003ca  href = '' id='asyncHandler_file'\u003eAsyncHandler\u003c/a\u003e\r\n\u003cp\u003eThe file \u003cb\u003eAsyncHandler\u003c/b\u003e encases a class called \u003ccode\u003eAsyncHandler()\u003c/code\u003e. This class is used to do task asuncronuslly.\u003c/p\u003e\r\n\r\n### \u003ca  href = '' id='dataHandler_file'\u003eDataHandler\u003c/a\u003e\r\n\u003cp\u003eThe file \u003cb\u003eDataHandler\u003c/b\u003e encases a class called \u003ccode\u003eDataHandler()\u003c/code\u003e. This class is used to menial tasks that usually require rewriting of a lot of code. \r\n\r\nThis class is used for handleling data related tasks\r\n\u003c/p\u003e\r\n\r\n\u003cb\u003e\u003cem\u003eFunctions of the class:-\u003c/em\u003e\u003c/b\u003e\r\n- \u003ccode\u003etimestamp\u003c/code\u003e: Returns the date and time in the specified format.\r\n        \r\n```\r\ndata = timestamp(given_time, format= \"%Y-%m-%d %H:%M:%S\", time_zone=None, normalize:str='sec')\r\nprint(data)\r\n#output:  \r\n```\r\n\r\n### \u003ca  href = '' id='dbsqlithandler_file'\u003eDbSqliteHandler\u003c/a\u003e\r\n\u003cp\u003eThe file \u003cb\u003eDbSqliteHandler\u003c/b\u003e encases a class called \u003ccode\u003eDbSqliteHandler\u003c/code\u003e. This class is used creating and managing SQLITE3 databases.\r\n\r\n- \u003cb\u003eInitializaton of database\u003c/b\u003e:\r\nWhen initalizing the database, on emust provide the desired database name. If the database existes, the class will just connect it else if the the database doesnot exist, then the database will be created and connectionn will be established.\r\n    ````\r\n    import DbSqliteHandler\r\n    dbConn = DbSqliteHandler('db_name.db')\r\n    ````\r\n- \u003cb\u003e\u003ccode\u003ecreate()\u003c/code\u003e\u003c/b\u003e: \r\nIf the database is created newly, then the database will require a table to function properly, or else the db will just remain as file in the system.\r\nSo to create a table we need to use the class method called \u003ccode\u003ecreateTb()\u003c/code\u003e.\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    tb_name = 'table_1'\r\n    columns = ['col1', 'col2']\r\n    ## or you can specify the datatype like this.\r\n    columns = ['col1 TEXT', 'col2 INT']\r\n    dbConn.createTb(tb_name, columns)\r\n    ```\r\n    The method also comes with the feature of adding data along side creating the table raher than writing a special code for it and also comes with the feature to ```primary key``` while creating the table.\r\n\r\n    ```\r\n    col = ['col1', 'col2']\r\n    data = ['data1', 'data2']\r\n    dbConn.createTb(tbName, columns=col, insertData=data, addId=False, idKey='id')\r\n    ```\r\n- \u003cb\u003e\u003ccode\u003einsert\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003ejson_insert\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003efetch\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003egetCount\u003c/code\u003e\u003c/b\u003e: This method counts the number of rows in the specified table. This method also allows or count with special queries like `col1='tofu'`. \r\n    - Parameter:\r\n        - `table_name` : Takes the name of table.\r\n        - `query` : Takes the search query. Default is `''` meaning, there is no search parameter and will count all the rows in the table.   \r\n    - Returns: `int` \r\n    - Usage:\r\n    ```\r\n    query = \"col1='tofu'\"\r\n    num = dbconn.getCount(table_name, query)\r\n    print(num) ##prints out the number of row with col1 value as tofu.\r\n    ```\r\n- \u003cb\u003e\u003ccode\u003eupdate\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003edelTb\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003erenameTb\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003egetTb\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003egetTbData\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003eexecute\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003ealterTb\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003egetColumnNames\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003eget_table_info\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003emodifyColumns\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003echeckIndex\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003egetIndexes\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003eaddIndex\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003edelIndex\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003ecleanTb\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003eaddColumn\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003erenameColumn\u003c/code\u003e\u003c/b\u003e:\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003eremoveColumn\u003c/code\u003e\u003c/b\u003e: Removes a column from the specified table.\r\n    - Parameter:\r\n    - Usage:\r\n    ```\r\n    \r\n    ```\r\n- \u003cb\u003e\u003ccode\u003eclose_connection\u003c/code\u003e\u003c/b\u003e:This method for to close  all the connections made to the db and also end the session.\r\n\r\n\r\n\r\n### \u003ca href='' id='fileHandler_file'\u003eFilehandler\u003c/a\u003e\r\n\u003cp\u003eThe file \u003cb\u003eFilehandler\u003c/b\u003e encases a class called \u003ccode\u003eFilehandler\u003c/code\u003e. This class is used for writing \u0026 reading file related tasks. \r\n\r\n- \u003cb\u003eInitialization\u003c/b\u003e: The initiallization is a simple process. To use it , just add `FileHandler.func_name()` and it will work. \u003cem\u003eExamples are below.\u003c/em\u003e\r\n- \u003cb\u003eClass methods\u003c/b\u003e: The class method are as follows:\r\n    - \u003cb\u003e`getFiles()`\u003c/b\u003e: Gets the list for files and folder in the specified folder.\r\n        - \u003cb\u003eParameter\u003c/b\u003e: \r\n            - `file_path`: Takes the path of the folder that needs to be looked into.\r\n            - `catg` : This parameter takes either 1 or 2, where 1 means to only look for files whereas 2 means to lik for directories. Default is 0. Which means both.\r\n        - \u003cb\u003eReturn\u003c/b\u003e: `list`\r\n        - \u003cb\u003eUsage\u003c/b\u003e:\r\n        ```\r\n        folder_path = './test_folder' #folder present in the current directory.\r\n        fi = getFiles(folder_path) # for both files and folder.\r\n        print(fi) #output: [file1.txt, dir1, ....] \r\n        ```\r\n    - \u003cb\u003e`get_only_filename()`\u003c/b\u003e:\r\n    - \u003cb\u003e`getFileCatg()`\u003c/b\u003e:\r\n    - \u003cb\u003e`splitFileName()`\u003c/b\u003e:\r\n    - \u003cb\u003e`getExtention()`\u003c/b\u003e:\r\n    - \u003cb\u003e`read()`\u003c/b\u003e:\r\n    - \u003cb\u003e`write()`\u003c/b\u003e: This function is to write files and add contents to it.\r\n        - \u003cb\u003eParameter\u003c/b\u003e:\r\n            - `file_name` : The name of the file.\r\n            - `data`: The data to be written to the file.\r\n            - `separator`: Optional separator to append after the data.\r\n        - \u003cb\u003eUsage\u003c/b\u003e:\r\n        ```\r\n            data = 'This is Hello World File.' #file contents\r\n            fileName = 'test.txt' # the file name\r\n            FileHandler.write()\r\n        ``` \r\n    - \u003cb\u003e`write_over()`\u003c/b\u003e:\r\n         - \u003cb\u003eParameter\u003c/b\u003e:\r\n            - `file_name` : The name of the file.\r\n            - `data`: The data to be written to the file.\r\n            - `separator`: Optional separator to append after the data.\r\n        - \u003cb\u003eUsage\u003c/b\u003e:\r\n        ```\r\n            data = 'This is Hello World File.' #file contents\r\n            fileName = 'test.txt' # the file name\r\n            FileHandler.write()\r\n        ```\r\n    - \u003cb\u003e`read_csv()`\u003c/b\u003e:\r\n         - \u003cb\u003eParameter\u003c/b\u003e:\r\n            - `file_name` : The name of the file.\r\n            - `data`: The data to be written to the file.\r\n            - `separator`: Optional separator to append after the data.\r\n        - \u003cb\u003eUsage\u003c/b\u003e:\r\n        ```\r\n            data = 'This is Hello World File.' #file contents\r\n            fileName = 'test.txt' # the file name\r\n            FileHandler.write()\r\n        ```\r\n    - \u003cb\u003e`write_csv()`\u003c/b\u003e:\r\n         - \u003cb\u003eParameter\u003c/b\u003e:\r\n            - `file_name` : The name of the file.\r\n            - `data`: The data to be written to the file.\r\n            - `separator`: Optional separator to append after the data.\r\n        - \u003cb\u003eUsage\u003c/b\u003e:\r\n        ```\r\n            data = 'This is Hello World File.' #file contents\r\n            fileName = 'test.txt' # the file name\r\n            FileHandler.write()\r\n        ```\r\n    - \u003cb\u003e`read_excel()`\u003c/b\u003e:\r\n         - \u003cb\u003eParameter\u003c/b\u003e:\r\n            - `file_name` : The name of the file.\r\n            - `data`: The data to be written to the file.\r\n            - `separator`: Optional separator to append after the data.\r\n        - \u003cb\u003eUsage\u003c/b\u003e:\r\n        ```\r\n            data = 'This is Hello World File.' #file contents\r\n            fileName = 'test.txt' # the file name\r\n            FileHandler.write()\r\n        ```\r\n    - \u003cb\u003e`write_excel()`\u003c/b\u003e:\r\n         - \u003cb\u003eParameter\u003c/b\u003e:\r\n            - `file_name` : The name of the file.\r\n            - `data`: The data to be written to the file.\r\n            - `separator`: Optional separator to append after the data.\r\n        - \u003cb\u003eUsage\u003c/b\u003e:\r\n        ```\r\n            data = 'This is Hello World File.' #file contents\r\n            fileName = 'test.txt' # the file name\r\n            FileHandler.write()\r\n        ```\r\n    - \u003cb\u003e`read_pdf()`\u003c/b\u003e: This function reads and returns the text values of the pdf.\r\n            - \u003cb\u003eParameter\u003c/b\u003e:\r\n                - `file_name` : The name of the file.\r\n            - \u003cb\u003eUsage\u003c/b\u003e:\r\n            ```\r\n                fileName = 'test.pdf' # the file name\r\n                FileHandler.read_pdf()\r\n            ```\r\n\r\n\r\n### \u003ca href='' id='htmlScraper_file'\u003eHtmlScraper\u003c/a\u003e\r\n\u003cp\u003eThe file \u003cb\u003eHtmlScraper\u003c/b\u003e encases a class called \u003ccode\u003eHtmlScraper\u003c/code\u003e. This class is used to scraping HTML webpages with the help of \u003ccode\u003eRequester\u003c/code\u003e class along with beautifulSoup. \r\n\r\n### \u003ca href='' id='requester_file'\u003eRequester\u003c/a\u003e\r\n\u003cp\u003eThe file \u003cb\u003eRequester\u003c/b\u003e encases a class called \u003ccode\u003eRequester\u003c/code\u003e. This class is used to request related tasks.\r\n\r\n\r\n##\r\n\r\n\r\n\r\n\r\n\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderooz%2Fmy_simple_functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderooz%2Fmy_simple_functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderooz%2Fmy_simple_functions/lists"}