π
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from dataclasses import dataclass | |
| from math import sqrt | |
| @dataclass | |
| class Position: | |
| x: float = 0.0 | |
| y: float = 0.0 | |
| def distance_to(self, other): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [tool.poetry] | |
| name = "artifacts" | |
| version = "0.1.0" | |
| description = "" | |
| authors = ["Akarsh Jain <akarsh.1995.02@gmail.com>"] | |
| [tool.poetry.dependencies] | |
| python = "^3.7" | |
| beorouting = { path = "./beorouting-0.1.1.tar.gz" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| description: This is the sample code file | |
| requirements: | |
| - gmail | |
| files: | |
| foo.py: | | |
| import os | |
| bar.py: | | |
| def helloworld(): | |
| print('helloworld') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| sample_text = 'Python is a programming language that lets you work quickly ' \ | |
| 'and integrate systems more effectively' | |
| substring = 'integrate' | |
| # search() function searches the string for a match, and returns a Match | |
| # object if there is a match. | |
| if re.search(substring, sample_text): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import shutil | |
| from pathlib import Path | |
| #General File Type Extentions | |
| exts = { | |
| "Applications": ['.exe'], | |
| "Code": ['.py','.java','.c'], | |
| "Music": ['.mp3','.ogg','.wav'], | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import zipfile | |
| # create zipfile object by passing path of zip file | |
| zip_file_object = zipfile.ZipFile(input("Enter zip file path")) | |
| # to list items present inside the zip | |
| contents = zip_file_object.namelist() | |
| output_folder_path = input("Enter path where the zip is to be extracted") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| import json | |
| from io import StringIO | |
| default_csv_text = '''album,year,US_peak_chart_post | |
| The White Stripes,1999,- | |
| De Stijl,2000,- | |
| White Blood Cells,2001,61''' | |
| # convert csv to json function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| from pathlib import Path | |
| default_text = ("Please contact us at contact-helloworld@pysnippets.com for " | |
| "further information." | |
| " You can also give feedback at pysnippets@tp.com" | |
| " another email: pysnippets@instagram.com") | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pathlib import Path | |
| import subprocess | |
| from flask import Flask, request | |
| import sys | |
| current_dir = Path(__file__).parent | |
| image_fetch_script_path = current_dir.joinpath('random_image_fetch.py') | |
| save_dir = current_dir.joinpath('random_images') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SIZE_THUMBS = (75, 75) | |
| FROM_DIR = 'images' | |
| TO_DIR = 'thumbs' | |
| if __name__ == '__main__': | |
| import os | |
| if not os.path.exists(TO_DIR): | |
| os.mkdir(TO_DIR) |
OlderNewer