{ "info": { "author": "Dhamodharan Karuppuswamy", "author_email": "dhamodharanrk@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "\n# MrSnippets\n\nA complete collection of common code snippets\n\n## Getting Started\n\nTo get started install the package using below command on your machine.\n\n`pip install MrSnippets`\n\nSample Usage,\n\n from MrSnippets.helpers import *\n print(get_numbers_from_string('1a2b3e'))\n\n## Helper Module\n\nIts an collection of commonly used functions to minimize the code and time.\n\n#### List of supported functions,\n- get_clean_text(string:str)\n- get_numbers_from_string(string:str)\n- get_alpha_from_string(string:str)\n- get_string_from_html(soup)\n- join_string(source_list:list, separator:str='')\n- compare_string(string_one,string_two)\n- get_clean_list(list_x:list)\n- compare_list(first:list, second:list)\n- find_list_duplicates(list:list)\n- get_clean_dict(dict:dict)\n- modify_jsondata(abbreviations_dict:dict,target_dict:dict)\n- refine_name(name:str)\n- split_name(name_string:str,reverse_it:bool=False,**kwargs)\n\n\n## Soup Wrapper\n\nIts an simple implementation of css selector using Beautifulsoup. The selectors are stright forward and simple.\n\nThere are list of pre-defined selector functions. For example selecting a single element from chunk as follows.\n\n from MrSnippets.soup_wrapper import *\n name = get_element(html_chunk,'div','class','people_name')\n name = get_element_by_tag(html_chunk,'
')\n\n\n#### List of fucntions supported now,\n\n- get_element(soup, tag=\"div\", attributeName='class', attributeValue='profile')\n- get_elements(soup, tag=\"div\", attributeName='class', attributeValue='profiles')\n- get_element_by_tag(soup,selector_string:str)\n- get_elements_by_tag(soup,selector_string:str)\n- get_sibling_text(soup, child:str, sibling:str, contains_string:str, sibling_type=\"prev|next\")\n- extract_hyper_link(soup_chunk,patterns:list,**kwargs)\n- extract_social_links(self, html_source)\n- extract_vcard_link(soup_chunk,**kwargs)\n- extract_image_link(soup_chunk,**kwargs)\n- extract_vcard_data(vcard_text:str)\n- extract_meta_data(self, html_source)\n- extract_email_addresses(string)\n- extract_phone_numbers(html_chunk)\n\n## Mongo Wrapper\nIts an collection of commonly used functions to minimize the code and time for mongo related operations.\n\nTo Setup the Client IP do follow the below steps,\n\nEnter Below piece of code\n\n1. **from MrSnippets.mongo_wrapper import MONGO_CLIENT_IP**\n2. Now, **CTRL + Right Click** on **MONGO_CLIENT_IP**\n3. Update this *'xx.xx.xx.xxx'* to Your IP (195.16.20.335:27017)\n\n`MONGO_CLIENT_IP = 'xx.xx.xx.xxx:27017'`\n\npost update we will something like this,\n\n`MONGO_CLIENT_IP = '195.16.20.335:27017'`\n\n#### List of fucntions supported now,\n\n- get_mongo_client(database_name, collection_name)\n- list_db()\n- list_collections(db:str)\n- get_summarize(db:str,collection:str)\n- get_sample(db:str,collection:str,query_by:str,value:str,limit:int=1)\n- update_record(connection:dict,query_by:str,query_by_value,data:dict)\n- create_index(connection:dict,index_attributes:list,ascending:bool=True)\n- update_attribute(connection:dict,query_by:str,query_by_value,data:dict,attributes:list)\n\n## MySQL Wrapper\n\nIts an collection of commonly used functions to minimize the code and time for MySQL related operations.\n\n#### List of fucntions supported now,\n\n- get_mysql_client(host_ip, username, pwd,db_name)\n- query_actions(connection_obj, query, query_type)\n\nExample usage,\n\n###### get_mysql_client\n\n from MrSnippets.mysql_wrapper import *\n\tconn = get_mysql_client('190.10.30.160', 'root', 'password', 'profile')\n\n## SQL Wrapper\n\nIts an collection of commonly used functions to minimize the code and time for SQL related operations.\n\n#### List of fucntions supported now,\n\n- get_sql_client(server_ip,database,userName,pwd)\n- query_actions(db_object, query, query_type)\n- insert_records(connection_obj, table_data:dict, data_dict: dict, unique_columns:list)\n\nExample usage,\n\n###### sql_insert_records\n\n from MrSnippets.mysql_wrapper import *\n db_object = get_sql_client('195.16.40.82', 'SampleDB', 'root', 'password')\n sample_data = {'name':'dharan','phone_no':'023456789'}\n table_meta = {'db_name':'informationSystem','table_name':'contactInfo'}\n insert_records(db_object, table_data:dict, sample_data, [\"phone_no\"])\n\n## Web Client\n\nIts an collection of commonly used function for inracting on Internet\n\n#### List of fucntions supported now,\n\n- get_user_agent(**kwargs)\n- extract_domain_name(url)\n- downloader(url,dir,file_name,extension)\n- get_response(url, response_type, attempt=0, **kwargs)\n\navailable arguments for this function\n\n data = kwargs.get('data',{})\n\tparams = kwargs.get('params',{})\n timeout = kwargs.get('time_out', 60)\n verify = kwargs.get('verify', True)\n method = kwargs.get('method', None)\n domain = kwargs.get('domain', '')\n headers = kwargs.get('headers',{})\n allow_redirects = kwargs.get('allow_redirects', True)\n proxy = kwargs.get('proxy', True)\n stream = kwargs.get('stream', False)\n dom_parser = kwargs.get('dom_parser','html5lib')\n\nSample Usage:\n\n response = get_response(url,'json',method='post', data = payload, headers=headers, timeout=100, verify=False)\n\n## Natural Language Processing\n\nCollection of functions to minimize the code and time for NLP related operations.\n\n#### List of fucntions supported now,\n\n- clean_my_html(html_source)\n- get_top_keywords(self, html_source)\n- get_word_frequency(html_source, search_words)\n- get_tokenized(string:str,ignore_stopwords:bool=False)\n- get_lemmatize_data(tokens:list)\n- get_standardize_words(tokens:list,lookup_dict:dict)\n- generate_ngrams(tokens:list,n)\n\n```python\nsearch_words = ['programmer','dhamodharanrk']\nfrequency = get_word_frequency(html_source, search_words)\nsearch_words = {'name': 'john,ram', 'brand': 'apple,nokia,samsung'}\nfrequency = get_word_frequency(html_source, search_words)\nlookup_dict = {'rt':'Retweet', 'dm':'direct message', \"awsm\" : \"awesome\", \"luv\" :\"love\"}\nstandardize_words = get_standardize_words(tokens,lookup_dict )\n```\n\n## Image Processing\n\nCollection of functions to minimize the code and time for image processing tasks\n\n#### List of fucntions supported now,\n- adjust_brightness(input_image, output_image, factor)\n- adjust_contrast(input_image, output_image, factor)\n- adjust_sharpness(input_image, output_image, factor)\n- resize_image(input_image_path,output_image_path,size)\n- scale_image(input_image_path,output_image_path,width=None,height=None)\n- black_and_white(input_image_path,output_image_path)\n- rotateImage(image_path, degrees_to_rotate, saved_location)\n- flipImage(image_path, saved_location,direction)\n- cropImage(image_path, coords, saved_location)\n\n## Misc Functions\n\nCollection of functions to minimize the code and time for day to day tasks\n\n#### List of fucntions supported now,\n\n- read_text_file(file_name)\n- write_text_file(filepath, filename, content)\n- write_csv_file(filepath,filename,content:dict,headers:list)\n- get_base64Image(encoded_data,path_to_store,file_name)\n- get_city_list()\n- get_state_list()\n- get_city_info_obj()\n- get_sizeof(num, suffix='o')\n- get_current_user()\n- get_parsed_url(url_to_parse)\n- get_filename(file_name)\n- move_to(source,destination,filename)\n- copy_to(source,destination,filename)\n- list_files(diretory,ext:str='')\n\n\n### Prerequisites\n\nNothing but a basic knowlege of python\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](https://github.com/dhamodharanrk/MrSnippets/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.\n\n## Authors\n\n* **Dhamodharan** - (https://github.com/dhamodharanrk)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n\n## Required Libraries\n- beautifulsoup4>=4.3.3\n- PyMySQL>=0.9.3\n- pymongo>=3.8.0\n- user_agent>=0.1.9\n- ftfy>=5.5.1\n- tldextract>=2.2.1\n- bleach>=3.1.0\n- python-csv>=0.0.11\n- requests>=2.18.4\n- html5lib>=1.0b10\n- pytest-shutil>=1.6.0\n- Pillow>=2.2.1\n- pyodbc>=4.0.26\n\n## Acknowledgments\n\n* This module has been actively developed.\n* More and more features will be realised on upcomming days.\n* This entire code is based on my experiance and scenarios crossed. Door open for any suggestions.\n* Active contributors are welcome\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dhamodharanrk/MrSnippets", "keywords": "", "license": "BSD 2-Clause", "maintainer": "", "maintainer_email": "", "name": "MrSnippets", "package_url": "https://pypi.org/project/MrSnippets/", "platform": "", "project_url": "https://pypi.org/project/MrSnippets/", "project_urls": { "Homepage": "https://github.com/dhamodharanrk/MrSnippets" }, "release_url": "https://pypi.org/project/MrSnippets/1.1.1/", "requires_dist": [ "beautifulsoup4 (>=4.3.3)", "PyMySQL (>=0.9.3)", "pymongo (>=3.8.0)", "user-agent (>=0.1.9)", "ftfy (>=5.5.1)", "tldextract (>=2.2.1)", "bleach (>=3.1.0)", "requests (>=2.18.4)", "html5lib (>=1.0b10)", "pytest-shutil (>=1.6.0)", "Pillow (>=2.2.1)", "fuzzywuzzy (>=0.17.0)" ], "requires_python": "", "summary": "A complete collection of common code snippets", "version": "1.1.1" }, "last_serial": 5414254, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "b75e810924425e039e503d790997aba8", "sha256": "aea6990963f5ffecf81350ad77bfaaa365d36dc3fcd1e88820e8d3ccc0f81a99" }, "downloads": -1, "filename": "MrSnippets-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b75e810924425e039e503d790997aba8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5199, "upload_time": "2019-05-07T08:41:04", "url": "https://files.pythonhosted.org/packages/20/fe/2a49a518d9d96d3ae2a0970345223da5476b845c3856a8fbe51e7d832ad0/MrSnippets-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b458e0df29ec47442618c9813a60ccf2", "sha256": "2fd74d789d9ba334cda9e6b3d322b5952255475f697b268975bcc2ef8cc7fb74" }, "downloads": -1, "filename": "MrSnippets-1.0.0.tar.gz", "has_sig": false, "md5_digest": "b458e0df29ec47442618c9813a60ccf2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3859, "upload_time": "2019-05-07T08:41:06", "url": "https://files.pythonhosted.org/packages/f6/e3/5809aa4adda7a45c6679ad3732b359c7dea53325dcdece9e33ac1b3a3074/MrSnippets-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "0d9ae1895ce6b7ca799575282bb9a16e", "sha256": "6e72ee0d7e2ffac0d6db3422e86d2f7de1f55ac9e83ce52be03597f91949f141" }, "downloads": -1, "filename": "MrSnippets-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0d9ae1895ce6b7ca799575282bb9a16e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7722, "upload_time": "2019-05-07T10:41:04", "url": "https://files.pythonhosted.org/packages/01/ae/e8af3f6cf2fc147936d6d2d6880643bef2cada6aab11ffbf3583da619c60/MrSnippets-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8ae948f52759e77861fe7baf8248b5c8", "sha256": "c732b7b76794a1bcbece1c522301e6532f25ff68c6f1a7ff66918390d55e94ce" }, "downloads": -1, "filename": "MrSnippets-1.0.1.tar.gz", "has_sig": false, "md5_digest": "8ae948f52759e77861fe7baf8248b5c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5804, "upload_time": "2019-05-07T10:41:06", "url": "https://files.pythonhosted.org/packages/b1/6e/f898e4bcf1a10fb16909c95bc855b01777d15af18eefde97b249583a44c6/MrSnippets-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "c4c789dfe28c638abb1625c050d5d84f", "sha256": "53da046dded315b010b8802b67167451c8cec29a284cc7cc79c01f54a5d81928" }, "downloads": -1, "filename": "MrSnippets-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "c4c789dfe28c638abb1625c050d5d84f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 13524, "upload_time": "2019-05-15T12:36:31", "url": "https://files.pythonhosted.org/packages/d4/f0/ec979a49a008d9dccd93efec8ed52b60971c8b864a09e08fb1b9cfada4e0/MrSnippets-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8b860dac2e89318465ac84694ef414e0", "sha256": "cb2a6900bf7f23fefa86cdc3f7a50f084a80acf2005bd21dd571d91e752497d8" }, "downloads": -1, "filename": "MrSnippets-1.1.0.tar.gz", "has_sig": false, "md5_digest": "8b860dac2e89318465ac84694ef414e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10551, "upload_time": "2019-05-15T12:36:33", "url": "https://files.pythonhosted.org/packages/f4/2b/52bf2ccd7ce3c27030ee62706bc924e0d75889ca5d3b4ce1423a795b162c/MrSnippets-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "ab2f2288b1488a6b3c605b308be418dd", "sha256": "a6d1f93a8d3c14e2fef574ca89b5f4b7fb274778842c7d0ef9ed144173b82ed9" }, "downloads": -1, "filename": "MrSnippets-1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ab2f2288b1488a6b3c605b308be418dd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17966, "upload_time": "2019-06-18T09:42:37", "url": "https://files.pythonhosted.org/packages/01/8d/e8259d699f2a8a5437506d6603beda7f8c5e4f4a109df351133a79984099/MrSnippets-1.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5068b8108b94fc17cbdd5c0b22874410", "sha256": "69494d34c544600b420cbceaddb467657c822f0687536f7d5bdc22ab2e76043b" }, "downloads": -1, "filename": "MrSnippets-1.1.1.tar.gz", "has_sig": false, "md5_digest": "5068b8108b94fc17cbdd5c0b22874410", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14956, "upload_time": "2019-06-18T09:42:39", "url": "https://files.pythonhosted.org/packages/8a/fe/154d311bd9c696f9fe84d39e4137a1f02f1a65ae5d7a1611a845b9adce2f/MrSnippets-1.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ab2f2288b1488a6b3c605b308be418dd", "sha256": "a6d1f93a8d3c14e2fef574ca89b5f4b7fb274778842c7d0ef9ed144173b82ed9" }, "downloads": -1, "filename": "MrSnippets-1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ab2f2288b1488a6b3c605b308be418dd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17966, "upload_time": "2019-06-18T09:42:37", "url": "https://files.pythonhosted.org/packages/01/8d/e8259d699f2a8a5437506d6603beda7f8c5e4f4a109df351133a79984099/MrSnippets-1.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5068b8108b94fc17cbdd5c0b22874410", "sha256": "69494d34c544600b420cbceaddb467657c822f0687536f7d5bdc22ab2e76043b" }, "downloads": -1, "filename": "MrSnippets-1.1.1.tar.gz", "has_sig": false, "md5_digest": "5068b8108b94fc17cbdd5c0b22874410", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14956, "upload_time": "2019-06-18T09:42:39", "url": "https://files.pythonhosted.org/packages/8a/fe/154d311bd9c696f9fe84d39e4137a1f02f1a65ae5d7a1611a845b9adce2f/MrSnippets-1.1.1.tar.gz" } ] }