\\r\\n
Search
\\r\\n
')\n __M_writer(django_mako_plus.ExpressionPostProcessor(self)(msg))\n __M_writer('
\\r\\n
\\r\\n
\\r\\n')\n return ''\n finally:\n context.caller_stack._pop_frame()\n\n\ndef render_right_content(context,**pageargs):\n __M_caller = context.caller_stack._push_frame()\n try:\n def right_content():\n return render_right_content(context)\n __M_writer = context.writer()\n __M_writer('\\r\\n\\r\\n')\n return ''\n finally:\n context.caller_stack._pop_frame()\n\n\n\"\"\"\n__M_BEGIN_METADATA\n{\"filename\": \"C:/Users/Isaac/intexsite/portal/templates/search.html\", \"uri\": \"search.html\", \"source_encoding\": \"utf-8\", \"line_map\": {\"29\": 0, \"47\": 1, \"52\": 3, \"57\": 6, \"62\": 39, \"72\": 3, \"78\": 3, \"84\": 4, \"90\": 4, \"96\": 8, \"107\": 8, \"108\": 9, \"109\": 10, \"110\": 12, \"111\": 12, \"112\": 19, \"113\": 19, \"114\": 26, \"115\": 26, \"121\": 41, \"127\": 41, \"133\": 127}}\n__M_END_METADATA\n\"\"\"\n","sub_path":"portal/templates/__dmpcache__/search.html.py","file_name":"search.html.py","file_ext":"py","file_size_in_byte":6091,"program_lang":"python","lang":"en","doc_type":"code","dataset":"code-starcoder2","pt":"68"}
+{"seq_id":"196585914","text":"print(\"This Program is for generating a time update in html file to append from this script\")\nimport datetime\nimport os\nimport webbrowser\n\"\"\"\nlast_updated = datetime.datetime.now()\nx = f'Last Updated on :{last_updated}'\nwith open(\"file.txt\", 'a') as file:\n file.write(x)\n file.close()\n\"\"\"\nf = open('file.txt','r+')\nx = datetime.datetime.now()\nlines = f.readlines() # read old content\nf.seek(0) # go back to the beginning of the file\nf.write(str(x)) # write new content at the beginning\nfor line in lines: # write old content after new\n f.write(line)\n f.close()","sub_path":"date generatot.py","file_name":"date generatot.py","file_ext":"py","file_size_in_byte":576,"program_lang":"python","lang":"en","doc_type":"code","dataset":"code-starcoder2","pt":"68"}
+{"seq_id":"38415157","text":"import sys\nfrom pdfminer.converter import TextConverter\nfrom pdfminer.pdfdocument import PDFDocument\nfrom pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter\nfrom pdfminer.pdfpage import PDFPage\nfrom pdfminer.pdfparser import PDFParser\n\ndef read_body(f):\n parser = PDFParser(f)\n document = PDFDocument(parser)\n if not document.is_extractable:\n print(f'このPDF文書はテキスト抽出できません')\n return\n\n resource_manager = PDFResourceManager()\n device = TextConverter(resource_manager, sys.stdout, codec='utf-8')\n interpreter = PDFPageInterpreter(resource_manager, device)\n for i, page in enumerate(PDFPage.create_pages(document), 1):\n print(f\"ページ: {i} {'=' * 32}\")\n interpreter.process_page(page)\n print()\n\n device.close()\n\ndef usage():\n if len(sys.argv) < 2:\n print(f'{__file__} の後にPDFファイルを指定してください')\n sys.exit(0)\n\ndef main():\n with open(sys.argv[1], 'rb') as f:\n read_body(f)\n\nif __name__ == '__main__':\n usage()\n main()\n","sub_path":"hino system(自然言語処理)/1_テキストデータ収集/参考まで/read_pdf_body.py","file_name":"read_pdf_body.py","file_ext":"py","file_size_in_byte":1079,"program_lang":"python","lang":"en","doc_type":"code","dataset":"code-starcoder2","pt":"68"}
+{"seq_id":"31231531","text":"import docker\n\n\ndocker_file_path = '/home/ubuntu/vaibhav'\ntag_name = 'vaibhavkholase/vaibhavtest'\ncontainer_name= 'mypytest'\nclient = docker.from_env()\n\nprint(\"Start Building your docker image...\")\n##### Building an Image form given DockerFile##########\nclient.images.build(path=docker_file_path,tag=tag_name)\n\nimage = client.images.get(tag_name)\nprint(image.short_id)\n\nprint(\"pushing image...\")\n\naauth_config ={\n 'username':'vaibhavkholase',\n 'password':'devops123'\n }\n\n###using authentication pushing docker image\nclient.images.push('vaibhavkholase/vaibhavtest', tag='latest', auth_config=aauth_config)\nprint(\"pushing of an image is done.\")\n# Check if image is already present at local server\nif \"docker image inspect vaibhavkholase/vaibhavtest >/dev/null 2>&1 && echo yes || echo NO = 'yes'\":\n print(\"Docker image is already exist\")\n\nelse: \n print(\"pulling imgae to local machine\")\n client.images.pull('vaibhavkholase/vaibhavtest')\n\n\nprint(\"Now running new container from the local image\")\nclient.containers.run('vaibhavkholase/vaibhavtest',detach=True,ports={'80/tcp' : 80})\nprint(\"'Congrtas', you have successfully deployed your python web application\")\n\n","sub_path":"main.py","file_name":"main.py","file_ext":"py","file_size_in_byte":1212,"program_lang":"python","lang":"en","doc_type":"code","dataset":"code-starcoder2","pt":"68"}
+{"seq_id":"418594235","text":"def Ques9(n):\n if(n>9):\n Rev_num = 0\n while(n>0):\n remainder = n%10\n Rev_num = (Rev_num*10) + remainder\n n = n //10\n return Rev_num\n print(\"Not a two digit number\")\n\nnum = int(input(\"Enter your number: \"))\nif (num>9):\n print(\"Reverse of \",num,\"is: \", Ques9(num))\nelse:\n print(\"Enter 2 digit number\")\n ","sub_path":"Ques8.py","file_name":"Ques8.py","file_ext":"py","file_size_in_byte":371,"program_lang":"python","lang":"en","doc_type":"code","dataset":"code-starcoder2","pt":"68"}
+{"seq_id":"604586347","text":"\"\"\"\n4. Employee Class\n Write a class named Employee that holds the following data about an employee in attributes: \n name, ID number, department, and job title.\n Once you have written the class, write a program that creates three Employee objects to\n hold the following data:\n\nName ID Number Department Job Title\nSusan Meyers 47899 Accounting Vice President\nMark Jones 39119 IT Programmer\nJoy Rogers 81774 Manufacturing Engineer\n\nThe program should store this data in the three objects and then display the data for each\nemployee on the screen.\n\"\"\"\n\n# Employee class\nclass Employee:\n # __init__ creates an Employee object with Name,\n # ID_number, department, and job title attributes\n def __init__(self, name, id_num, dept, title):\n self.__name = name\n self.__id_number = id_num\n self.__department = dept\n self.__job_title = title\n \n # __str__ method displays the values in each attribute\n # for the Employee object\n def __str__(self):\n return f'Employee Name: {self.__name}\\n' \\\n f'Employee ID Number: {self.__id_number}\\n' \\\n f'Employee Department: {self.__department}\\n' \\\n f'Employee Job Title: {self.__job_title}'\n\n def set_name(self, name):\n self.__name = name\n \n def set_id_number(self, id_num):\n self.__id_number = id_num\n \n def set_department(self, dept):\n self.__department = dept\n \n def set_job_title(self, title):\n self.__job_title = title\n \n def get_name(self):\n return self.__name\n \n def get_id_number(self):\n return self.__id_number\n \n def get_department(self):\n return self.__department\n\n def get_job_title(self):\n return self.__job_title\n\n# main function creates 3 Employee objects from a dictionary,\n# then displays their data\ndef main():\n # list holding each employee\n employee_list = []\n \n # dictionary holding all employee data\n employee_data = {\n 1 : {\n 'name' : 'Susan Meyers',\n 'id_num' : 47899,\n 'dept' : 'Accounting',\n 'title' : 'Vice President'\n },\n 2 : {\n 'name' : 'Mark Jones',\n 'id_num' : 39119,\n 'dept' : 'IT',\n 'title' : 'Programmer'\n },\n 3 : {\n 'name' : 'Joy Rogers',\n 'id_num' : 81774,\n 'dept' : 'Manufacturing',\n 'title' : 'Engineer'\n }\n }\n\n # loop through each dictionary of employee data\n # and create Employee objects\n for i in range(1,4):\n employee = Employee(\n employee_data[i]['name'],\n employee_data[i]['id_num'],\n employee_data[i]['dept'],\n employee_data[i]['title']\n )\n\n # add employee to employee_list\n employee_list.append(employee)\n \n # loop through each employee in employee_list\n # and display all of their data\n for emp in employee_list:\n print(emp)\n print() # print extra blank line for readability\n\n# call main function\n#main()","sub_path":"Class_Practice_Exercises/Classes/Classes_Exercises_4.py","file_name":"Classes_Exercises_4.py","file_ext":"py","file_size_in_byte":3160,"program_lang":"python","lang":"en","doc_type":"code","dataset":"code-starcoder2","pt":"68"}
+{"seq_id":"302788491","text":"import requests\nfrom nltk.corpus import stopwords\nimport re\nimport nltk\nimport newspaper\nfrom nltk.stem import SnowballStemmer\nfrom html2text import html2text\n\n\nclass WebService:\n\n def __init__(self):\n pass\n\n async def tokenize_sentence(self, data):\n \"\"\"\n :criteria: expects a dictionary of this structure:\n \"\"\"\n tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')\n html = tokenizer.tokenize(data)\n sentences = []\n for data in html:\n sentence_data = dict()\n sentence_data['html'] = data\n sentence_data['text'] = html2text(data)\n sentence_data['ml_techniques_found'] = []\n sentence_data['reg_techniques_found'] = []\n sentences.append(sentence_data)\n return sentences\n\n async def tokenize(self, s):\n \"\"\"Function to remove stopwords from a sentence and return a list of words to match\"\"\"\n word_list = re.findall(r'\\w+', s.lower())\n filtered_words = [word for word in word_list if word not in stopwords.words('english')]\n \"\"\"Perform NLP Lemmatization and Stemming methods\"\"\"\n lemmed = []\n stemmer = SnowballStemmer('english')\n for i in filtered_words:\n lemmed.append(stemmer.stem(str(i)))\n return ' '.join(lemmed)\n\n @classmethod\n async def remove_html_markup_and_found(self, s):\n tag = False\n quote = False\n out = \"\"\n for c in s:\n if c == '<' and not quote:\n tag = True\n elif c == '>' and not quote:\n tag = False\n elif (c == '\"' or c == \"'\") and tag:\n quote = not quote\n elif not tag:\n out = out + c\n sep = '!FOUND:'\n out = out.split(sep, 1)[0]\n return out\n\n async def get_url(self, url, returned_format=None):\n if returned_format == 'html':\n print('[!] HTML support is being refactored. Currently data is being returned plaintext')\n r = requests.get(url)\n\n b = newspaper.fulltext(r.text)\n if b:\n text = str(b).replace('\\n', '