repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
madpin/renthub
location/app/mappings/InterestPoints.py
<filename>location/app/mappings/InterestPoints.py import os from urllib import parse from herepy import ( PlacesApi, RoutingApi, RouteMode, GeocoderApi, ) import schemas def get_website(place): if('contacts' not in place): return None for contact in place['contacts']: if('www'...
madpin/renthub
main/app/models.py
from typing import Optional, List import sqlalchemy from sqlmodel import SQLModel, Field, Relationship from datetime import date, datetime # ############################################################################# # Links class ListingFacilityLink(SQLModel, table=True): listing_id: int = Field( forei...
madpin/renthub
old/main_old/app/models.py
from sqlalchemy import ( Table, Column, ForeignKey, Boolean, Integer, String, Float, DateTime ) from sqlalchemy.orm import relationship from sqlalchemy.sql.sqltypes import Date from database import Base from datetime import datetime listings_facilities = Table( 'listings_facilities', Base.metadata, ...
madpin/renthub
old/main_old/alembic/versions/cda240ae1ea5_first_tables.py
"""first tables Revision ID: cda240ae1ea5 Revises: <KEY> Create Date: 2021-10-31 23:47:10.313256 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'cda240ae1ea5' down_revision = '<KEY>' branch_labels = None depends_on = None def upgrade(): # ### commands au...
madpin/renthub
main/app/main.py
<filename>main/app/main.py from pathlib import Path from typing import List import asyncio import requests from fastapi import Depends, FastAPI, Request, HTTPException, APIRouter from fastapi.responses import HTMLResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates from...
madpin/renthub
location/app/mappings/route.py
<reponame>madpin/renthub import os from urllib import parse from fastapi.logger import logger from herepy import ( PlacesApi, RoutingApi, RouteMode, GeocoderApi, RoutingResponseV8, ) import schemas def get_route_raw(routes_dict): logger.debug(routes_dict) response = routes_dict.get('r...
madpin/renthub
old/rentcrud/alembic/versions/01b6c8ce3965_initial3.py
"""initial3 Revision ID: 01b6c8ce3965 Revises: <PASSWORD> Create Date: 2021-11-01 04:29:57.210756 """ from alembic import op import sqlalchemy as sa import sqlmodel # revision identifiers, used by Alembic. revision = '01b6c8ce3965' down_revision = '<PASSWORD>' branch_labels = None depends_on = None def upgrade():...
madpin/renthub
old/rentcrud/app/database.py
from sqlalchemy.ext.asyncio import create_async_engine # from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker # from sqlalchemy.ext.asyncio import AsyncSession from sqlmodel.ext.asyncio.session import AsyncSession # SQLALCHEMY_DATABASE_URL = "sqlite:///./sql_app.db" SQLALCHEMY...
madpin/renthub
old/rentcrud/alembic/versions/9d9a746dbfd7_initial2.py
"""initial2 Revision ID: 9d9a<PASSWORD>dbfd7 Revises: <PASSWORD> Create Date: 2021-11-01 04:28:38.426261 """ from alembic import op import sqlalchemy as sa import sqlmodel # revision identifiers, used by Alembic. revision = '9d9a746db<PASSWORD>' down_revision = 'a<PASSWORD>' branch_labels = None depends_on = None ...
madpin/renthub
notification/app/schemas.py
import os from typing import List, Optional import datetime from pydantic import BaseModel class TelegramImageUrl(BaseModel): url: str caption: str = '' class TelegramMessage(BaseModel): message: str chat_id: str = os.getenv('TG_ADMIN_CHAT_ID') timeout: int = 10 disable_web_page_preview: bo...
madpin/renthub
main/app/database.py
# from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, Session # SQLALCHEMY_DATABASE_URL = "sqlite:///./sql_app.db" SQLALCHEMY_DATABASE_URL = "postgresql://postgres:post...
madpin/renthub
main/app/alembic/versions/8c61ffcb32e6_initial_3.py
<reponame>madpin/renthub<gh_stars>0 """Initial 3 Revision ID: 8c61ffcb32e6 Revises: 4bee0e2ca37f Create Date: 2021-11-14 00:31:29.584714 """ from alembic import op import sqlalchemy as sa import sqlmodel # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = '4bee0e2ca37f' branch_labels = None ...
madpin/renthub
main/app/loop.py
from datetime import datetime import dateutil.parser import json import requests from requests.models import to_key_val_list from sqlmodel import Field, Session, SQLModel, create_engine, select from fastapi.logger import logger from database import engine from models import Listing, Facility, Image, InterestPoint,...
madpin/renthub
old/rentcrud/alembic/versions/a57c89b47e7b_initial.py
"""initial Revision ID: a57c89b47e7b Revises: Create Date: 2021-11-01 04:27:56.134285 """ from alembic import op import sqlalchemy as sa import sqlmodel # revision identifiers, used by Alembic. revision = 'a57c89b47e7b' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands...
madpin/renthub
main/app/alembic/versions/de84556d9e2a_initial_8.py
<reponame>madpin/renthub<filename>main/app/alembic/versions/de84556d9e2a_initial_8.py """Initial 8 Revision ID: de<PASSWORD>d<PASSWORD>a Revises: a<PASSWORD> Create Date: 2021-11-14 02:57:59.511295 """ from alembic import op import sqlalchemy as sa import sqlmodel # revision identifiers, used by Alembic. revision =...
madpin/renthub
old/main_old/alembic/versions/52a4c736df24_images.py
"""Images Revision ID: <KEY> Revises: <KEY> Create Date: 2021-11-08 21:17:43.704391 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = '<KEY>' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alem...
madpin/renthub
main/app/api_calls.py
import requests try: response = requests.get('http://daft:8000/search_result') response.raise_for_status() # Additional code will only run if the request is successful except requests.exceptions.HTTPError as error: print(error)
madpin/renthub
location/app/points.py
from schemas import Point indeed = Point(lat=53.34545621516955, long=-6.231801040391591) bank_house = Point(lat=53.34347027177946, long=-6.276045630904159)
madpin/renthub
old/main_old/alembic/versions/1038f05634e6_images_2.py
"""images 2 Revision ID: 1038f05634e6 Revises: <PASSWORD> Create Date: 2021-11-08 21:19:25.145728 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = '1038f05634e6' down_revision = '<PASSWORD>' branch_labels = None depends_...
madpin/renthub
old/main_old/alembic/versions/94c2f18b742c_distances_2.py
<filename>old/main_old/alembic/versions/94c2f18b742c_distances_2.py """Distances 2 Revision ID: 94c2f18b742c Revises: <PASSWORD> Create Date: 2021-10-31 23:55:43.580559 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = '<PASSWORD>' branch_...
madpin/renthub
main/app/alembic/versions/0101e666f4e9_initial_5.py
"""Initial 5 Revision ID: 0101e666f4e9 Revises: 6c98e82ae2b5 Create Date: 2021-11-14 01:40:19.792380 """ from alembic import op import sqlalchemy as sa import sqlmodel # revision identifiers, used by Alembic. revision = '0101e666f4e9' down_revision = '6c98e82ae2b5' branch_labels = None depends_on = None def upgra...
madpin/renthub
old/rentcrud/alembic/versions/819871403219_initial4.py
"""initial4 Revision ID: 819871403219 Revises: <PASSWORD> Create Date: 2021-11-01 04:34:08.506090 """ from alembic import op import sqlalchemy as sa import sqlmodel # revision identifiers, used by Alembic. revision = '819871403219' down_revision = '<PASSWORD>' branch_labels = None depends_on = None def upgrade():...
madpin/renthub
main/app/alembic/versions/a8810e4a9ace_initial_7.py
<gh_stars>0 """Initial 7 Revision ID: a8810e4a9ace Revises: <PASSWORD> Create Date: 2021-11-14 02:33:09.091191 """ from alembic import op import sqlalchemy as sa import sqlmodel from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = 'a8810e4a9ace' down_revision = '<PASSWORD>' ...
madpin/renthub
old/main_old/app/crud.py
<gh_stars>0 from sqlalchemy import select from sqlalchemy.ext.asyncio import AsyncSession import models, schemas async def get_user(db: AsyncSession, user_id: int): return await db.query(models.User).filter(models.User.id == user_id).first() async def get_user_by_email(db: AsyncSession, email: str): # retu...
madpin/renthub
old/main_old/alembic/versions/1a289167affe_distances.py
"""Distances Revision ID: 1a289167affe Revises: <KEY> Create Date: 2021-10-31 23:52:46.651398 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '1a289167affe' down_revision = '<KEY>' branch_labels = None depends_on = None def upgrade(): # ### commands auto ...
madpin/renthub
main/app/alembic/versions/d63ccd5484d7_initial.py
"""Initial Revision ID: d63ccd5484d7 Revises: Create Date: 2021-11-14 00:28:55.123695 """ from alembic import op import sqlalchemy as sa import sqlmodel # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto g...
madpin/renthub
old/rentcrud/app/main.py
from typing import List from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import joinedload, selectinload from sqlalchemy import select from models import Song, Listing, Image, SongRead, ListingRead # from ...
madpin/renthub
location/app/main.py
<filename>location/app/main.py import os from pathlib import Path from pydantic.errors import ExtraError import uvicorn from typing import List, Optional from fastapi import FastAPI, File, UploadFile from fastapi.responses import HTMLResponse from herepy import ( PlacesApi, RoutingApi, RouteMode, Geoc...
madpin/renthub
provider_daft/app/mappings/listing_details.py
<reponame>madpin/renthub import json import re import hashlib import requests from dateutil import parser from nums_from_string import get_nums from bs4 import BeautifulSoup import schemas def int_from_str(text_, default_for_none=None): numbers = re.findall("\d+", text_) if(len(numbers) == 0): retur...
madpin/renthub
old/main_old/alembic/versions/76c5c92496ea_improved_listings.py
"""Improved Listings Revision ID: 76c5c92496ea Revises: <PASSWORD> Create Date: 2021-11-08 21:34:17.068563 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = '76c5c92496ea' down_revision = '<PASSWORD>' branch_labels = None...
madpin/renthub
main/app/alembic/versions/2be8e05a6a4f_initial_6.py
<reponame>madpin/renthub<filename>main/app/alembic/versions/2be8e05a6a4f_initial_6.py """Initial 6 Revision ID: 2<PASSWORD> Revises: <PASSWORD> Create Date: 2021-11-14 01:41:31.599029 """ from alembic import op import sqlalchemy as sa import sqlmodel # revision identifiers, used by Alembic. revision = '2<PASSWORD>'...
madpin/renthub
old/main_old/app/main.py
<gh_stars>0 from typing import List from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from sqlalchemy.exc import IntegrityError # import models as models import crud as crud import schemas as schemas from database import get_db # models.Base.metadata.create_all(bind=engine) # Hop...
madpin/renthub
main/app/alembic/versions/6c98e82ae2b5_initial_4.py
<reponame>madpin/renthub<gh_stars>0 """Initial 4 Revision ID: 6c98e82ae2b5 Revises: <KEY> Create Date: 2021-11-14 00:39:11.321233 """ from alembic import op import sqlalchemy as sa import sqlmodel # revision identifiers, used by Alembic. revision = '6c98e82ae2b5' down_revision = '<KEY>' branch_labels = None depends...
madpin/renthub
main/app/alembic/versions/4bee0e2ca37f_initial_2.py
<filename>main/app/alembic/versions/4bee0e2ca37f_initial_2.py<gh_stars>0 """Initial 2 Revision ID: 4bee0e2ca37f Revises: <PASSWORD> Create Date: 2021-11-14 00:29:04.234694 """ from alembic import op import sqlalchemy as sa import sqlmodel # revision identifiers, used by Alembic. revision = '4bee0e2ca37f' down_revis...
madpin/renthub
old/main_old/alembic/versions/5eeb5b496362_improved_listings_2.py
"""Improved Listings 2 Revision ID: <KEY> Revises: 76c5c<PASSWORD> Create Date: 2021-11-08 21:39:20.267455 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = '76c5c92496ea' branch_labels = None depends_on = None def upgrade(): # ### c...
madpin/renthub
old/main_old/alembic/versions/a531e7c78fbe_create_inital_tables.py
<gh_stars>0 """create inital tables Revision ID: a531e7c78fbe Revises: Create Date: 2021-10-31 23:32:37.346693 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = 'a531e7c78fbe' down_revision = None branch_labels = None de...
madpin/renthub
old/rentcrud/app/models.py
from typing import Optional, List from sqlmodel import SQLModel, Field, Relationship class SongBase(SQLModel): name: str artist: str year: Optional[int] = None class Song(SongBase, table=True): id: int = Field(primary_key=True) class SongRead(SongBase): id: int class SongCreate(SongBase): ...
madpin/renthub
old/main_old/alembic/versions/ae656d76b2f1_distances_4.py
<gh_stars>0 """distances 4 Revision ID: <KEY> Revises: 94c2<PASSWORD>42c Create Date: 2021-11-01 00:00:44.703478 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = '94c2f18b742c' branch_labels = None depends_on = None def upgrade(): #...
madpin/renthub
old/rentcrud/alembic/versions/7343c5f48f99_initial4.py
<reponame>madpin/renthub<filename>old/rentcrud/alembic/versions/7343c5f48f99_initial4.py<gh_stars>0 """initial4 Revision ID: 7343c5f48f99 Revises: 01b6c8ce3965 Create Date: 2021-11-01 04:32:05.270719 """ from alembic import op import sqlalchemy as sa import sqlmodel # revision identifiers, used by Alembic. revision...
madpin/renthub
notification/app/main.py
<filename>notification/app/main.py<gh_stars>0 import os from pathlib import Path import uvicorn from typing import List, Optional from fastapi import FastAPI, File, UploadFile from fastapi.responses import HTMLResponse from custom_logger import CustomizeLogger import telegram import schemas config_path=Path(__file__...
madpin/renthub
provider_daft/app/main.py
# import logging from pathlib import Path from enum import Enum import uvicorn from fastapi import FastAPI from custom_logger import CustomizeLogger import schemas from mappings.daft_listings import get_daft_search_result from mappings.listing_details import get_listing_details # logger = logging.getLogger(__name_...
funky23exe/habitat-sim
examples/demo_runner.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import multiprocessing import os import random import time from enum import Enum import numpy as np from PIL import Image from set...
vivamoto/challenges
longest_word/longest_word.py
""" Longest Word Have the function LongestWord(sen) take the sen parameter being passed and return the largest word in the string. If there are two or more words that are the same length, return the first word from the string with that length. Ignore punctuation and assume sen will not be empty. Examples Input: "fun...
vivamoto/challenges
codeland_username_validation/codeland_username_validation.py
""" Codeland Username Validation Have the function CodelandUsernameValidation(str) take the str parameter being passed and determine if the string is a valid username according to the following rules: 1. The username is between 4 and 25 characters. 2. It must start with a letter. 3. It can only contain letters, numbe...
vivamoto/challenges
questions_marks/question_marks.py
""" Questions Marks Have the function QuestionsMarks(str) take the str string parameter, which will contain single digit numbers, letters, and question marks, and check if there are exactly 3 question marks between every pair of two numbers that add up to 10. If so, then your program should return the string true, ot...
vivamoto/challenges
min_window_substring/min_window_substring.py
""":cvar Title: React Button Toggle Difficulty: Easy Solutions: 4327 Maximum Score: 10 Description: For this challenge you will be editing a small React application. React Button Toggle We provided some simple React template code. Your goal is to modify the component so that you can properly toggle the button to s...
vivamoto/challenges
first_factorial/first_factorial.py
""" First Factorial Have the function FirstFactorial(num) take the num parameter being passed and return the factorial of it. For example: if num = 4, then your program should return (4 * 3 * 2 * 1) = 24. For the test cases, the range will be between 1 and 18 and the input will always be an integer. Examples Input: 4...
vivamoto/challenges
find_intersection/find_intersection.py
<gh_stars>0 """ Find Intersection Have the function FindIntersection(strArr) read the array of strings stored in strArr which will contain 2 elements: the first element will represent a list of comma-separated numbers sorted in ascending order, the second element will represent a second list of comma-separated numbers...
vivamoto/challenges
first_reverse/first_reverse.py
""" First Reverse Have the function FirstReverse(str) take the str parameter being passed and return the string in reversed order. For example: if the input string is "<NAME>" then your program should return the string "sredoC dna dlroW olleH". Examples Input: "<NAME>" Output: etybredoc Input: "I Love Code" Output: ...
vivamoto/challenges
permutation/permutation.py
<gh_stars>0 """ Permutation Step Difficulty: Medium Maximum Score: 10 Description: For this challenge you will determine the next greatest number using the same numbers of a given argument. Have the function PermutationStep(num) take the num parameter being passed and return the next number greater than num using the...
vivamoto/challenges
tree_constructor/tree_constructor.py
""" Tree Constructor Difficulty: Medium Maximum Score: 10 Description: For this challenge you will determine if an array of integer pairs can form a binary tree properly. Have the function TreeConstructor(strArr) take the array of strings stored in strArr, which will contain pairs of integers in the following format:...
raman325/sensor.radarr_upcoming_media
custom_components/radarr_upcoming_media/sensor.py
""" Home Assistant component to feed the Upcoming Media Lovelace card with Radarr upcoming releases. https://github.com/raman325/sensor.radarr_upcoming_media https://github.com/custom-cards/upcoming-media-card """ from datetime import date, datetime, timedelta import logging from aiopyarr.exceptions import ArrExcep...
M3nin0/geo-knowledge-hub-rt
geo-metadata-previewer/geo_metadata_previewer/config.py
<filename>geo-metadata-previewer/geo_metadata_previewer/config.py # -*- coding: utf-8 -*- # # Copyright (C) 2022 GEO Secretariat. # # GEO-Metadata-Previewer is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see LICENSE file for more # details. """Geospatial metadata previ...
M3nin0/geo-knowledge-hub-rt
geo-metadata-previewer/geo_metadata_previewer/__init__.py
# -*- coding: utf-8 -*- # # Copyright (C) 2022 GEO Secretariat. # # GEO-Metadata-Previewer is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see LICENSE file for more # details. """Geospatial metadata previewer support for the GEO Knowledge Hub""" from .ext import GEOMet...
juancruzgassoloncan/Udacity-Robo-nanodegree
src/rover/project/code/decision_back.py
<reponame>juancruzgassoloncan/Udacity-Robo-nanodegree<gh_stars>1-10 import numpy as np import time import copy from helper import * # This is where you can build a decision tree for determining throttle, brake and steer # def rad2deg(rad): # return (rad * 180.0) / np.pi # # # def deg2rad(deg): # return (deg *...
juancruzgassoloncan/Udacity-Robo-nanodegree
src/rover/project/code/decision.py
import numpy as np from rover_sates import * from state_machine import * # This is where you can build a decision tree for determining throttle, brake and steer # commands based on the output of the perception_step() function def decision_step(Rover, machine): if Rover.nav_angles is not None: machine.ru...
juancruzgassoloncan/Udacity-Robo-nanodegree
src/rover/project/code/perception.py
<gh_stars>1-10 import numpy as np import cv2 # Identify pixels above the threshold # Threshold of RGB > 160 does a nice job of identifying ground pixels only def color_thresh_hsv(img, low_thresh=(20, 85, 85), high_thresh=(35, 255, 255), inv=False, roi=None): img_hsv = cv2.cvtColor(img, cv2.COLOR_RGB2HSV) ma...
juancruzgassoloncan/Udacity-Robo-nanodegree
src/rover/project/code/rover_sates.py
# -*- coding: utf-8 -*- from helper import * import time class Stop(object): def __init__(self, rover, brake=5): self.rover = rover self.brake = brake self.rover.steer = 0 self.start_time = self.rover.total_time def __str__(self): return 'Stop' def delay(self, sec...
juancruzgassoloncan/Udacity-Robo-nanodegree
src/rover/project/code/helper.py
import numpy as np def rad2deg(rad): return (rad * 180.0) / np.pi def deg2rad(deg): return (deg * np.pi) / 180.0 def distance_to_rock(Rover): if Rover.rock_dists is not None: if len(Rover.rock_dists): return np.min(Rover.rock_dists) else: return 0 else: ...
juancruzgassoloncan/Udacity-Robo-nanodegree
src/rover/ex_2/warp_perspect.py
<reponame>juancruzgassoloncan/Udacity-Robo-nanodegree<gh_stars>1-10 import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import cv2 image_name = '../data/IMG/robocam_2017_10_03_15_35_32_475.jpg' image = mpimg.imread(image_name) def perspect_transform(img, src, dst): # Get transfo...
juancruzgassoloncan/Udacity-Robo-nanodegree
src/rover/ex_4/extra_functions.py
import numpy as np import cv2 import matplotlib.image as mpimg def perspect_transform(img, src, dst): # Get transform matrix using cv2.getPerspectivTransform() M = cv2.getPerspectiveTransform(src, dst) # Warp image using cv2.warpPerspective() # keep same size as input image warped = cv2.warpPersp...
juancruzgassoloncan/Udacity-Robo-nanodegree
src/rover/project/code/state_machine.py
<gh_stars>1-10 # -*- coding: utf-8 -*- from time import sleep class state_machine(object): def __init__(self, machine, *args): self.machine = machine self.state_stack = list(args) self.current_state = self.state_stack[0] self.current_state.run() # self.next_state = '' ...
moerwald/download-images-via-google-search
main.py
<filename>main.py import argparse import json import itertools import logging import re import os import uuid import sys from urllib.request import urlopen, Request from bs4 import BeautifulSoup def configure_logging(): logger = logging.getLogger() logger.setLevel(logging.DEBUG) handler = logging.StreamH...
bharadwaj-raju/island
Island3DRender.py
import sys import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def normalize_land_water(data, threshold=0.1): res = [[0 for i in range(len(data))] for j in range(len(data))] for idv, vline in enumerate(data): for idh, hcell in enumerate(vline): if hcell >= threshold: ...
bharadwaj-raju/island
IslandRender.py
<filename>IslandRender.py import png import io from PIL import Image import argparse import json import os import sys def normalize_land_water(data, threshold=0.1): res = [[0 for i in range(len(data))] for j in range(len(data))] for idv, vline in enumerate(data): for idh, hcell in enumerate(vline): if hcell >=...
fantopop/post-production-scripts
Session info to table/modules/html.py
<reponame>fantopop/post-production-scripts #!/usr/bin/python tab = ' ' class Tag(): def __init__(self, name, HTML): self.name = name self.HTML = HTML def __enter__(self): self.HTML.content += tab * self.HTML.indent + '<' + self.name + '>\n' self.HTML.indent += 1 def __ex...
fantopop/post-production-scripts
Correct edl/make_dict.py
#!/usr/bin/env python3 """ This script creates dictionary and writes it to the .json file for use by correct_edl.py script. """ import json import sys from os import path # Dictionary with strings to be replaced. d = {} d[','] = '_' d['/'] = '_' d[' A'] = 'A' d[' B'] = 'B' d[' C'] = 'C' # Scene names from shooting...
fantopop/post-production-scripts
Correct edl/Correct EDL.app/Contents/Resources/Scripts/correct_edl.py
<reponame>fantopop/post-production-scripts #!/usr/bin/env python3 """ This script replaces strings in *FROM CLIP NAME field of the EDL, accroding to the dictionary from the .json file. Corrected EDL is written to the new file, with '.corrected' added to the filename. """ # Constants from_clip_name = '*FROM CLIP NAME: ...
fantopop/post-production-scripts
Session info to table/macOS app/Tracks to Table/tracks_to_table.py
<filename>Session info to table/macOS app/Tracks to Table/tracks_to_table.py #!/usr/bin/python """ tracks_to_table.py Author: <NAME> https://github.com/fantopop/post-production-scripts Special thanks to <NAME> for HTML.py module for generating HTML tables. http://www.decalage.info/python/html This scripts converts ....
fantopop/post-production-scripts
Rename mixer files/rename_mixer_files.py
<filename>Rename mixer files/rename_mixer_files.py #!/usr/bin/env python3.6 """ This script renames files from format: 05-5-160928_1009.wav to: 1009_05-5-160928.wav where: 1009: recording time, 05-5: channel number, 160928: date. This was done to group files by takes (recording time). """ import r...
fantopop/post-production-scripts
Filter edl tracks/filter_tracks.py
<filename>Filter edl tracks/filter_tracks.py<gh_stars>10-100 #!/usr/bin/env python3 ''' Filter events in EDL with matching track name. It can be used to filter video or audio events. Example usage: python filter_tracks path/to/sample.edl -t V -f 24 Dependencies: timecode, edl ''' import argparse from os import path ...
fantopop/post-production-scripts
Session info to table/modules/table.py
<reponame>fantopop/post-production-scripts<filename>Session info to table/modules/table.py<gh_stars>10-100 #!/usr/bin/python # -*- coding: iso-8859-1 -*- """ HTML.py - v0.04 2009-07-28 <NAME> This module provides a few classes to easily generate HTML code such as tables and lists. Project website: http://www....
lmawalker/bpnet
bpnet/BPNet.py
import os from kipoi_utils.data_utils import get_dataset_item, numpy_collate_concat from kipoi_utils.utils import unique_list import keras.backend as K import matplotlib.ticker as ticker from bpnet.functions import softmax from genomelake.extractors import FastaExtractor from keras.models import load_model from collect...
lmawalker/bpnet
setup.py
<filename>setup.py #!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup, find_packages requirements = [ "argh", "attr", "related", "cloudpickle>=1.0.0", "concise==0.6.7", "deepexplain", # ml "gin-config", "keras==2.2.4", "scikit-learn", # "tensorflow...
iskander-akhmetov/WIM-Summarization
GreedSum.py
<filename>GreedSum.py import argparse from sklearn.feature_extraction.text import TfidfVectorizer import numpy as np def greed_sum(text, num_sent, min_df=1, max_df=1.0): #fit a TFIDF vectorizer vectorizer = TfidfVectorizer(min_df=min_df, max_df=max_df) vectorizer.fit(text) #get ...
singh4java/python-core
conversationBot.py
<gh_stars>0 from chatterbot import ChatBot from chatterbot.trainers import ListTrainer import os from termcolor import colored colors = {'G': 'grey', 'R': 'red', 'GR': 'green', 'Y': 'yellow', 'B': 'blue', 'M': 'magenta', 'C': 'cyan', 'W': 'white'} print('------Color List-------') print(colors) x = input('Sel...
KeithCes/cipherCreator
main.py
<filename>main.py """Copyright (c) 2017 * <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, d...
mariusavram91/python_collection
fizzbuzz.py
<filename>fizzbuzz.py #!/usr/bin/python3 import unittest ''' Write a program that: for multiples of three returns “Fizz” instead of the number and for the multiples of five returns “Buzz”. For numbers which are multiples of both three and five returns “FizzBuzz”. For the rest it returns the number. ''' def fizzbuzz...
mariusavram91/python_collection
1_multiples_of_3_and_5.py
#!/usr/bin/python3 import unittest ''' Problem 1: https://projecteuler.net/problem=1 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. Correct answer: 233168 ''' def sum_3_or_5_m...
mariusavram91/python_collection
binary_tree_search.py
#!/usr/bin/python3 import unittest class Node: def __init__(self, number): self.number = number self.left = None self.right = None def count_nodes_in_longest_unique_path(tree): return len(find_longest_unique_path(tree, [], 0, [])) def find_all_paths(tree): if tree is None: ...
mariusavram91/python_collection
sequence_in_array.py
<gh_stars>0 #!/usr/bin/python3 import unittest ''' Given an array of ints, return True if the sequence.. 1, 3, 4 .. appears in the array somewhere. ''' def array_has_134(array): for i in range(len(array)-2): if array[i] == 1 and array[i+1] == 3 and array[i+2] == 4: return True return Fals...
mariusavram91/python_collection
sum_numbers_in_array.py
#!/usr/bin/python3 import time import unittest ''' Write a program which returns a pair of numbers from a given array that sum up to a given number. Assume the list is sorted and it has integers. ''' def solution(list, sum): low = 0 high = len(list) - 1 while low < high: current_sum = list[low]...
mariusavram91/python_collection
process_mad_lib.py
#!/usr/bin/python3 # Let's put it all together. Write code for the function process_madlib, which # takes in a string "madlib" and returns the string "processed", where each # instance of "NOUN" is replaced with a random noun and each instance of "VERB" # is replaced with a random verb. You're free to change what the ...
mariusavram91/python_collection
2_even_fibonacci_numbers.py
#!/usr/bin/python3 import unittest ''' Problem 2: https://projecteuler.net/problem=2 Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence ...
alekm/hambot
hambot.py
import time import json from turtle import done import discord import logging from discord.ext import commands, tasks import random intents = discord.Intents( guilds=True, members=True, messages=True, reactions=True ) bot = discord.Bot( description="Hambot", intents=intents, ) #logging.basicC...
alekm/hambot
modules/dxcc.py
""" DXCC Prefix Lookup extension for qrm --- Copyright (C) 2019-2020 classabbyamp, 0x5c (as lookup.py) Copyright (C) 2021 classabbyamp, 0x5c SPDX-License-Identifier: LiLiQ-Rplus-1.1 Modified by N4OG 2022 - converted to slash command """ import threading from pathlib import Path from ctyparser import BigCty from dis...
alekm/hambot
modules/misc.py
<reponame>alekm/hambot import time import discord from discord.ext import commands from datetime import datetime, timedelta from discord.commands import ( # Importing the decorator that makes slash commands. slash_command, ) ''' TODO: - Oof counter - Make this server specific ''' class MiscCog(commands.Cog): ...
alekm/hambot
modules/setstatus.py
from discord.ext import commands, tasks import discord import random statuses = [ '7.200', '14.313', '3.927', '3.860' ] class StatusCog(commands.Cog): def __init__(self, bot): self.bot = bot @commands.Cog.listener() a...
alekm/hambot
modules/utils/embed.py
import discord from discord.ext import commands class EmbedCog(commands.Cog): def __init__(self, bot): self.bot = bot def generate(self, **kwargs): title = '' description = '' footer = '' if 'title' in kwargs: title = kwargs['title'] if 'descriptio...
alekm/hambot
onlinelookup/callook.py
""" Callook Callsign Lookup Author: <NAME>, AB3NJ Uses Callook's API to retreive information on callsigns """ import json import os.path from urllib import request, error from . import olerror, olresult # importorator __all__ = ['CallookLookup'] def prettify(name): names = name.split() ...
alekm/hambot
modules/lookup.py
import importlib import os import time from datetime import datetime from pathlib import Path import discord import requests from ctyparser import BigCty from discord.commands import \ slash_command # Importing the decorator that makes slash commands. from discord.ext import commands, tasks from onlinelookup impo...
feruzfauzi/variable-type-tools
fonts/ttf2woff.py
#!python3 import sys, re, os, json from fontTools.ttLib import TTFont from collections import OrderedDict fontsdir = os.path.dirname(sys.argv[0]) infont = outfont = None fontExtension = re.compile(r'\.[ot]tf', re.I) allAxes = {} def getName(ttf, nameID): return [n for n in ttf['name'].names if n.nameID==nameID...
movermeyer/mls
mls.py
# coding=utf-8 """ Unicode-like storage for multiple language mutations. """ from locale import getlocale, getdefaultlocale, locale_alias from six import text_type, u, PY2 __all__ = ["mls", "MultiLingualString"] def _get_system_locale(): """ Returns current (or default) system locale. """ return getl...
movermeyer/mls
setup.py
#!/usr/bin/env python from os.path import dirname, abspath, join from setuptools import setup here = abspath(dirname(__file__)) readme = open(join(here, "README.rst")) setup( name="mls", version="1.2.2", py_modules=["mls"], url="https://github.com/rembish/mls", license="BSD", author="<NAME>", ...
movermeyer/mls
tests.py
#!/usr/bin/env python # coding=utf-8 from locale import LC_ALL, setlocale from six import u, text_type, PY3 from unittest import TestCase as BaseTestCase, main from mls import mls class TestCase(BaseTestCase): def setUp(self): setlocale(LC_ALL, "en_US.UTF-8") def test_translate_to(self): s =...
robputt796/netizenship
venv/lib/python3.7/site-packages/netizenship.py
<reponame>robputt796/netizenship<gh_stars>1-10 #!/usr/bin/python3 """Tool to automatically check the membership of a given username in popular websites. Inspired by: https://github.com/thelinuxchoice/userrecon/blob/master/userrecon.sh MIT License Copyright (c) 2020 <NAME> """ import requests from termcolor import...
ignatowski/u-test
server/u_test/html_parser_bs4.py
import sys from bs4 import BeautifulSoup from .models import Customer, Account, Statement from typing import List class HtmlParserBs4: """A class used to parse html to objects.""" def __init__(self) -> None: pass def parse_customers_html_to_objects(self, customers_html: str, username: str) -> L...
ignatowski/u-test
server/u_test/api.py
from http import client, cookies from urllib import request, parse class Api: """A class used to make http requests.""" base_url = 'test.unnax.com' base_login = '/login' customer_url = 'http://test.unnax.com/customer' account_url = 'http://test.unnax.com/account' statement_url = 'http://test...
ignatowski/u-test
server/u_test/api_r.py
<filename>server/u_test/api_r.py import requests class ApiR: """A class used to make http requests.""" login_url = 'http://test.unnax.com/login' customer_url = 'http://test.unnax.com/customer' account_url = 'http://test.unnax.com/account' statement_url = 'http://test.unnax.com/statements/' ...
ignatowski/u-test
server/u_test/printer.py
import sys, os, datetime, re from .models import Account, Customer, Statement from typing import List class Printer: "A class to print accounts, customers, and statements." tab_size = 4 def __init__(self, accounts: List[Account], customers: List[Customer]) -> None: """Iterate over and print acc...