seq_id
stringlengths
4
11
text
stringlengths
113
2.92M
repo_name
stringlengths
4
125
sub_path
stringlengths
3
214
file_name
stringlengths
3
160
file_ext
stringclasses
18 values
file_size_in_byte
int64
113
2.92M
program_lang
stringclasses
1 value
lang
stringclasses
93 values
doc_type
stringclasses
1 value
stars
int64
0
179k
dataset
stringclasses
3 values
pt
stringclasses
78 values
31940091773
import click from utils import _prepare_files_for_conversion from parser_xml import _parse_xml @click.command() @click.argument("infile") @click.argument("outfile") @click.argument("tag") @click.argument("xpathfile") @click.option("--encoding",\ help="Enter this flag if you have a encoding") def parser_main...
rajathn8/pyxmlparser
main.py
main.py
py
1,041
python
en
code
null
github-code
1
33458260426
import os import re import sys import time import pygame from pygame.locals import ( K_BACKSPACE, K_DOWN, K_END, K_ESCAPE, K_F1, K_F2, K_F5, K_F6, K_F7, K_HOME, K_KP_ENTER, K_KP_MINUS, K_KP_PLUS, K_LALT, K_LEFT, K_LSHIFT, K_RALT, K_RETURN, K_R...
soundmud/soundrts
soundrts/clientmenu.py
clientmenu.py
py
9,294
python
en
code
37
github-code
1
694899804
import asyncio import re from collections import deque from typing import Any, AsyncGenerator, List import aiohttp import yddg.constants as const import yddg.custom_types as T async def download_file(session: aiohttp.ClientSession, url: str, path: str) -> bytes: download_url = "" api...
gofff/yddg
yddg/api_tasks.py
api_tasks.py
py
3,418
python
en
code
0
github-code
1
6033557274
import asyncio """ ASYNCIO EVENT """ async def waiter(i: int, event: asyncio.Event) -> None: print(f"Waiter {i} waititng for event to happen") await event.wait() print(f"Waiter {i} is dont waiting") async def main() -> None: event = asyncio.Event() waiter_tasks = [asyncio.create_task(waiter(i,...
EvgeniiTitov/coding-practice
coding_practice/concurrency/asyncio/chapter_presentation/example_10_1.py
example_10_1.py
py
533
python
en
code
1
github-code
1
1268510105
from Player import Player import time import math # Model for connect four game against minimax AI with alpha beta pruning # Takes too long for any board size bigger than 4x4 x_size = 4 y_size = 4 class ConnectFourModel: board = [] turn = Player.RED def __init__(self): self.board = [[None for x ...
ericyzhou/ConnectFourMinimax
ConnectFourModel.py
ConnectFourModel.py
py
6,458
python
en
code
0
github-code
1
32158726807
#!/usr/bin/env python3 import os import random import argparse import itertools import subprocess homedir = os.getcwd() + '/gpg-home' keyserver = 'hkp://keys.fedoraproject.org' fields = { 'pub': 'Public key', 'crt': 'X.509 certificate', 'crs': 'X.509 certificate and private key available', 'sub': 'S...
Mortal/gpg-scc
gpg-scc.py
gpg-scc.py
py
6,067
python
en
code
0
github-code
1
10467836667
import time import random import re from lib import utils from lib.utils import log from lib.command import adb class Prepare: def _connect_device(self, url=None): if url: adb.connect(url) while True: time.sleep(1) # 判断设备是否连上 device = adb.get_devic...
Nemo1122/AppiumDemo
lib/prepare.py
prepare.py
py
2,147
python
en
code
0
github-code
1
73033935393
# -*- coding: utf-8 -*- ''' General management functions for salt, tools like seeing what hosts are up and what hosts are down ''' # Import python libs from __future__ import absolute_import, print_function import os import operator import re import subprocess import tempfile import time # Import 3rd-party libs from ...
shineforever/ops
salt/salt/runners/manage.py
manage.py
py
16,103
python
en
code
9
github-code
1
5550341640
import requests import urllib.request import os import time def run(url): headers = {'User-Agent': 'Mozilla/5.0'} folder_path = 'img' if (os.path.exists(folder_path) == False): os.makedirs(folder_path) #Create folder for index in range(0, 100): html = requests.get(url, headers = header...
don6105/OCR-Captcha-Recognition
download_img.py
download_img.py
py
638
python
en
code
0
github-code
1
18489368074
import logging from logging.handlers import SysLogHandler import sys import platform BOLD = "\033[1m" RESET = "\033[0m" DEFAULT_VIRA_URL = "https://jira-vira.volvocars.biz" # This goes to Per-Ola "PeO" Robertsson logging account PAPERTRAIL_HOST = "logs5.papertrailapp.com" PAPERTRAIL_PORT = 14852 def get_os_identif...
peorobertsson/vira
src/vira/vira_base.py
vira_base.py
py
1,178
python
en
code
1
github-code
1
23672427789
from __future__ import annotations # Should become unnecessary in Python 3.10 from typing import Tuple, Union, List from sage.all import var, diff, Matrix, Rational, I, Expression from .riemannian import RiemChart from .base import Chart from .tensor import Tensor, Form class CplxChart(Chart): """ Class fo...
deroshkin/SageManifolds
manifolds/complex.py
complex.py
py
14,652
python
en
code
0
github-code
1
3527055623
import importlib from pathlib import Path from typing import Any, List, Tuple import numpy as np import torch from torchvision import transforms from torchvision.datasets import ImageFolder def load_variable(variable_name: str, path: Path) -> Any: spec = importlib.util.spec_from_file_location(variable_name, pa...
milySW/NNResearchAPI
src/utils/loaders.py
loaders.py
py
2,438
python
en
code
0
github-code
1
42744810414
#!/usr/bin/env python # coding: utf-8 # In[137]: import pandas as pd # # SERIES # In[138]: #to make series # In[139]: s = pd.Series(["Ali","Hamza","Zeeshan","Faiz","Adnan","Sabir"]) s # In[140]: Products = pd.Series(["Rio","Prince","Sooper","Gala","Chocolato","Oreo","Rite"]) Products # In[141]: Subj...
shahmeerrajput/WorkOnTensorflowNmpyPandas
pandasPractice.py
pandasPractice.py
py
6,358
python
en
code
0
github-code
1
1536426036
from fastapi import APIRouter from kollector.api.controller_implementation.form_schema_controller_implementation import ( FormSchemaControllerImplementation, ) from kollector.application.entities.formSchema.form_schema_request import ( FormSchemaRequest, ) from kollector.application.repositories.form_schema_re...
frankmaina/kollector
kollector/api/controllers/form_schema_controller.py
form_schema_controller.py
py
979
python
en
code
0
github-code
1
8158961248
import unittest from airdrop import findEntities from networkgenerator.generator import Generator import pandas as pd class TestMultipleAirdrops(unittest.TestCase): def test_findMultipleEntities(self): g = Generator() airdropAmount1 = 777 recipients1 = g.getExistingAddresses(20) ...
etherclust/etherclust
test/test_multiple_airdrops.py
test_multiple_airdrops.py
py
4,104
python
en
code
26
github-code
1
11003184327
class Solution: def subdomainVisits(self, cpdomains: List[str]) -> List[str]: def store_key(lookup, string, value): if string not in lookup: lookup[string] = value else: lookup[string] += value contain = {} for item in cpdomains: ...
peaqi/mock
Python/811. Subdomain Visit Count/solution.py
solution.py
py
871
python
en
code
0
github-code
1
7459181953
import sys sys.stdin = open('input.txt') def across_remove(list, temp_idx): # 주사위 전개도 리스트, 주사위 밑면or윗면 인덱스 if temp_idx == 0 or temp_idx == 5: new_list = list[1:5] return new_list elif temp_idx == 1 or temp_idx == 3: new_list = list[0] + list[2] + list[4] + list[5] return new_li...
coolihans/TIL
Algorithms/boj/boj-IM/2116_주사위쌓기/오현규.py
오현규.py
py
2,071
python
km
code
0
github-code
1
13826202137
import csv from collections import defaultdict import tkinter from tkinter import filedialog # 读取种别码文件 def get_seed_code(): seed = defaultdict(int) with open('D:\\2020\\GitHub\\Compiler_Theory\\src\\test.csv', 'r', encoding='UTF-8') as f: k = csv.reader(f) for i in k: seed[str(i[0]...
NianZheChao/Compiler_Theory
src/lexical_analysis.py
lexical_analysis.py
py
11,696
python
en
code
0
github-code
1
42438951950
user_info={ 'name':'raj', 'age':19, 'movie':['kgf','rrr','mca'], 'song':['humnava','let me'] } # # add data # user_info['music']=['song1','song2'] # print(user_info) #out-->{'name': 'raj', 'age': 19, 'movie': ['kgf', 'rrr', 'mca'], 'song': ['humnava', 'let me'],'music': ['song1', 'song2']} ...
rjsnhk/week2-Python-Cipherschools
class119-add.delete.dictionary-cipherschool.py
class119-add.delete.dictionary-cipherschool.py
py
586
python
en
code
7
github-code
1
741149054
""" Title: Checks if year is a leap year Author: akashroshan135 Date: 22-Jan-2021 """ # int is used to typecast the string input into an integer # input is used to accept string input data year = int(input("Enter year to be checked : ")) if (year % 4 == 0 and year % 100 != 0 or year % 400 == 0): print(year, "is a lea...
Deepa-chinnu/python-lab
Practice programs/leapyear.py
leapyear.py
py
369
python
en
code
0
github-code
1
24486139344
import sys import math def getCookies(sideN,rad): if rad*2 > sideN: return 0,0 anzahl = (int(sideN / (rad*2)) **2) cookie = (rad**2) * math.pi return anzahl,(sideN * sideN - ( cookie * anzahl)) side,diameter=3,1 #1 = 2 side,diameter=12,3 #2 = 4 side,diameter=12,6 #3 = 0 side,diameter=12,5 #4 ...
mw197hub/codingame
easy/Should Bakers be Frugal/main.py
main.py
py
660
python
de
code
0
github-code
1
2919677752
from turtle import Turtle, Screen movement = [100, 10, 100, 10] positions = [90, 180, 270, 270] screen = Screen() tim = Turtle() # tim.hideturtle() tim.speed("slowest") tim.fillcolor("red") tim.begin_fill() for num in range(4): tim.forward(movement[num]) tim.setheading(positions[num]) tim.en...
acourage369/100-Days-of-Python-Code-
DAY 1/Try.py
Try.py
py
819
python
en
code
0
github-code
1
15968803277
import numpy as np from scipy import stats import termcolor import typing from typing import Any class Sample: def __init__(self, n : int, sigma : float, a : float): self.n = n self.sigma = sigma self.a = a self._data = None @property def data(self): i...
AndrewOmelnitsky/da_labs
lab_1/main.py
main.py
py
14,722
python
en
code
0
github-code
1
25325637322
from unittest import TestCase import pandas as pd from utils import * from tree import * class Test_tree(TestCase): """Classe de tests de certaines fonctionnalités de l'arbre de décision - Calcul de l'entropie d'une partition - Calcul du gain d'un partitionnement - Détermination d'un meilleur partiti...
nderousseaux/projet-ia
src/tree_test.py
tree_test.py
py
2,382
python
en
code
0
github-code
1
72340343394
# -*- coding: utf-8 -*- from django.views.generic import DetailView from django.http import FileResponse, HttpResponse from main.views.base import ClientView, LegalView from common.utils import get_client_ip from portfolios.models import LivePortfolio from statements.chart_configs import ChartData from statements.model...
zakvan2022/Betasmartz
statements/views.py
views.py
py
5,785
python
en
code
1
github-code
1
38243926625
from selenium import webdriver import requests from webdriver_manager.chrome import ChromeDriverManager import time import pandas as pd import numpy as np from bs4 import BeautifulSoup as bs from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.supp...
SORDAS-R/seleniumdynamicscraper
updated scraper.py
updated scraper.py
py
9,323
python
en
code
0
github-code
1
40898171065
import sys sys.stdin = open('input.txt') input = sys.stdin.readline # 여기부터 제출해야 한다. N, M = map(int, input().split()) list_result = [] for number in range(N, M+1): number_str = str(number) temp = 1 for i in number_str: temp = temp * int(i) list_result.append(temp) print(sum(list_result))
boogleboogle/baekjoon
etc/prime/2.py
2.py
py
339
python
en
code
0
github-code
1
13840892147
from pymtl3 import * from pymtl3.stdlib.ifcs import RecvIfcRTL, SendIfcRTL, GiveIfcRTL, GetIfcRTL from pymtl3.stdlib.basic_rtl import Mux from pymtl3.stdlib.queues import PipeQueueRTL from pymtl3.stdlib.mem import mk_mem_msg, MemMasterIfcRTL, MemMsgType from pymtl3.stdlib.basic_rtl import Reg, RegEn, RegEnRst class S...
shenjiangqiu/pymtl_project
satacc/utils/mem_oparator.py
mem_oparator.py
py
6,143
python
en
code
0
github-code
1
25368682702
import requests TIMESERIES_URL = "https://pomber.github.io/covid19/timeseries.json" CONFIRMED_KEY = "confirmed" DEATHS_KEY = "deaths" DATE_KEY = "date" COUNTRY_KEY = "country" HUNDREDTH_DATE_KEY = "hundredth_date" HUNDREDTH_INDEX_KEY = "hundredth_idx" DEATHS_DATE_KEY = "deaths_date" DEATHS_INDEX_KEY = "deaths_idx" ...
gusmd/brasilcovid
data_provider.py
data_provider.py
py
1,759
python
en
code
0
github-code
1
17481347063
from math import ceil, sqrt def memodict(f): """ Memoization decorator for a function taking a single argument """ class memodict(dict): def __missing__(self, key): ret = self[key] = f(key) return ret return memodict().__getitem__ @memodict def is_prime(n): if n < 2: retur...
pussinboot/euler-solutions
euler_27.py
euler_27.py
py
738
python
en
code
0
github-code
1
10025869581
from menu import Menu from explorer.handler import Explorer import os working_dir = os.getcwd() apps_folder = "apps" def main(): path = os.path.join(working_dir, apps_folder) folders = Explorer.getData(path) Menu.loop(folders) if __name__ == "__main__": main()
JakubKorytko/python-apps
main.py
main.py
py
281
python
en
code
0
github-code
1
40328041610
from app import app import logging, os from logging.handlers import TimedRotatingFileHandler from config import PORT, LOG_PATH app.logger.setLevel(logging.INFO) formatter = logging.Formatter( "[%(asctime)s]-[%(module)s:%(lineno)d]-[%(levelname)s]-[%(thread)d] - %(message)s") handler = TimedRotatingFileHandle...
Hehahei/rs-interpretation-Backend
run.py
run.py
py
709
python
en
code
0
github-code
1
74003827873
#Worked with Aaron Roberts import pandas as pd import numpy as np df = pd.read_csv('./dd-comment-profile.csv') chars = ('$', '%', '*', '<div>', '</div>', 'FREE', 'app', 'check out my page', '<', '>', '@', '=', '#', '&', '!', '.com') comments = [] for text in df['comment_msg']: clean_text = str(text) for cha...
INFO3401/problem-set-8-backup-nathan-duffy
Problem_Set_8/dataWrangling.py
dataWrangling.py
py
633
python
en
code
0
github-code
1
9301856086
import csv, mindwave, time, datetime, os def check_device(): command = "find /dev/ -name rfcomm*" result = os.popen(command).read() items = result.split('\n') items.remove('') check = -999 for i in range(len(items)): if int(items[i][-1]) > check: check = int(items[i][-1]) ...
danielhankim/JaiGuruDevaOhm
notebooks/data_analysis/recorder.py
recorder.py
py
1,883
python
en
code
0
github-code
1
8523232894
from __future__ import annotations import logging.config import typing as T import geopandas as gpd import geoviews as gv import holoviews as hv import numpy as np import numpy.typing as npt import numpy_indexed as npi import pandas as pd import shapely import xarray as xr logger = logging.getLogger(__name__) GLOBA...
ec-jrc/Thalassa
thalassa/utils.py
utils.py
py
11,086
python
en
code
16
github-code
1
413587757
# encoding: utf-8 from cloudify import ctx from cloudify.exceptions import NonRecoverableError from cloudify.state import ctx_parameters as inputs def get_interface_from_ip_addr_output(ip_addr_output, ip_address): ctx.logger.info(ip_address) lines = ip_addr_output.split('\n') for line in lines: ...
kbijakowski/docker_sfc_blueprint
scripts/process_docker_network_interface.py
process_docker_network_interface.py
py
1,507
python
en
code
6
github-code
1
32166396176
import os from pathlib import Path from typing import Iterable, Iterator, List, Set from isort.settings import Config def find( paths: Iterable[str], config: Config, skipped: List[str], broken: List[str] ) -> Iterator[str]: """Fines and provides an iterator for all Python source files defined in paths.""" ...
PyCQA/isort
isort/files.py
files.py
py
1,589
python
en
code
6,145
github-code
1
5724726271
# Import libraries from typing import Dict, Any from algosdk import transaction from algosdk.v2client import algod import json # Connect new client to testnet algod_address = "https://testnet-api.algonode.cloud" algod_token = "7fqaktd2q36pesas8fnsk300b8csbnqus7e0da606ome9alf99f" headers = { "X-API-Key":a...
mohsen-el/ECO5037S_FinalExam
atomic_transfer.py
atomic_transfer.py
py
3,220
python
en
code
0
github-code
1
6607525263
import xml.etree.ElementTree as ET class Parser: def __init__(self, filename): # xml files now stored in 'network_xmls' directory: filepath = "./network_xmls/" + filename self.root = ET.parse(filepath).getroot() self.sections = [child for child in self.root] self.nodes, sel...
nickmagginas/4th_Year_Project_FINAL
gym_network/envs/Parser.py
Parser.py
py
2,197
python
en
code
9
github-code
1
13426497553
import cv2 import numpy as np from mathutils import Matrix, Quaternion from geometry import W_PT as landmarks from geometry import line_idx, vertex from visualize import draw_landmarks, project_pts_quat_tvec, read_csv def plot_lines(img, pts, line_idx): img = np.ones_like(img) * 255 img = np.asarray(img, dty...
willer94/lava1302
test_lines.py
test_lines.py
py
1,512
python
en
code
0
github-code
1
15276074297
import os import boto3 from botocore.exceptions import ClientError ddb = boto3.resource('dynamodb') def handler(event, context): data_id = event.get('id') data = event.get('data') try: tableName = os.environ['STORAGE_DATA_NAME'] table = ddb.Table(tableName) table.put_item(Item={ ...
alex-coda-13/awsproject
amplify/backend/function/storeData/src/index.py
index.py
py
492
python
en
code
0
github-code
1
71680502434
import os def get_files(target): files = [] for i in os.listdir(target): if not i.startswith('.'): path = os.path.join(target, i) if os.path.isdir(path): files.extend(get_files(path)) elif os.path.isfile(path) and path.endswith('.java'): ...
Chenrt-ggx/MipsCompiler
Resource/Scripts/ImportCheck.py
ImportCheck.py
py
1,003
python
en
code
16
github-code
1
40794199952
from aiohttp import web from hashlib import sha256 from internal.database.errors import ErrorDatabase from internal.container import DI_DATABASE_CLIENT, DI_LOGGER from app.constants import APP_CONTAINER from app.native.users import ( MessageCreateUser, MessageCreatedUser, ErrorLoginAlreadyExists, ) async...
Ovsienko023/Scrum
api/app/native/users/users.py
users.py
py
1,440
python
en
code
2
github-code
1
70738746273
#!/usr/bin/env python # Class taking in integers (seconds and meters), converting them to their higher units, if needed, # and adding a string to the end with units and returning the values class TimeDisFormat: def __init__(self, total_dur, step_dur, total_dis, step_dis): self.total_dur = total_dur ...
AaronNolan/ParkAtDCU-Python
src/ca377/maps/Scripts/time_func.py
time_func.py
py
2,505
python
en
code
1
github-code
1
74255146594
import os running = True os.chdir("sys") # const root = os.getcwd() # commands def pwd(silent = False): dir = os.getcwd().replace(root, "") if dir == "": if silent == False: print("/") return "/" else: if silent == False: print(dir) return dir def ...
Ccode-archives/term-os
os.py
os.py
py
1,025
python
en
code
0
github-code
1
19611108928
class EventManage: def __init__(self): self.handlers = dict() self.events = [] def register(self, event, handler): if not event in self.handlers: self.handlers[event] = [] if not handler in self.handlers[event]: self.handlers[event].append(h...
FinnStokes/orpheus
event.py
event.py
py
2,846
python
en
code
0
github-code
1
38091110411
def Gini(y_true, y_pred): assert y_true.shape == y_pred.shape n_samples = y_true.shape[0] arr = np.array([y_true, y_pred]).transpose() true_order = arr[arr[:,0].argsort()][::-1,0] pred_order = arr[arr[:,1].argsort()][::-1,0] fd = open('order.txt','w') for i,j in zip(y_true,y_pred...
stylianos-kampakis/adan
metrics/gini.py
gini.py
py
1,218
python
en
code
0
github-code
1
24485606724
import sys import time,math nameList = ['test1.txt','test2.txt','test3.txt','test4.txt', 'test5.txt','test6.txt','test7.txt','test8.txt'] time_1 = time.time() #name = "test1.txt" #datei = open(name,'r') #for zeile in datei: # print(zeile[:-1]) class Point(): x,y = 0,0 def __init__(self, x=0, y=0):self.x...
mw197hub/codingame
Practice AI/Code vs Zombies/steuerung.py
steuerung.py
py
773
python
en
code
0
github-code
1
16974389660
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # JTSK-350112 # a5_6.py # Shun-Lung Chang # sh.chang@jacobs-university.de import subprocess import csv if __name__ == '__main__': # make x (between -5 and 5) and x square x = [i for i in range(-5, 6, 1)] x_square = [i ** 2 for i in x] # crea...
slchangtw/Advanced_Programming_in_Python_Jacobs
assignment_5/plotting.py
plotting.py
py
775
python
en
code
0
github-code
1
24640386808
#!/usr/bin/env python3 import re input_file = 'inputs/day6' def process(given): with open(given) as f: infile = f.readlines() infile = [x.strip() for x in infile] return infile def f_or(given): found_letters = [0] * 26 count = 0 for i in given: for j in i: found_le...
xInferno/AdventOfCode
AOC2020/day6.py
day6.py
py
1,494
python
en
code
0
github-code
1
44469966593
import gtk class PyApp(gtk.Window): def __init__(self): super(PyApp, self).__init__() self.color = [0, 0, 0] self.set_title("ToggleButtons") self.resize(350, 240) self.set_position(gtk.WIN_POS_CENTER) self.connect("destroy", gtk.main_quit) red = gt...
rong11417/PyGTK_demo
toggleArea.py
toggleArea.py
py
1,825
python
en
code
2
github-code
1
42385278293
from AutomationToolsLib import AutomationPreferences, Logging import requests from datetime import datetime from getpass import getuser import pathlib import os def GetPreferences(*args): userPrefs = {} for item in args: userPrefs.update(AutomationPreferences(item)) return userPrefs def Filepath...
danengh/Python
Patch_Automation/patchserver_backup.py
patchserver_backup.py
py
2,585
python
en
code
8
github-code
1
71255365154
from flask import Flask, render_template, request, url_for, redirect import joblib import numpy as np from text_proc import text_process app = Flask(__name__) #creating flask app with unique name model = joblib.load(open('NB1.joblib','rb')) posts = {} #global variable and 0 is unique post_id @app.route('/') ...
aravind-14-dev/Movie_Review_Spoiler_Detector
src/Flask_App/app.py
app.py
py
1,675
python
en
code
0
github-code
1
6286298741
import pprint from PyPDF2 import PdfFileReader, PdfFileMerger import PyPDF2 from os import walk if __name__ == '__main__': filenames = next(walk("."), (None, None, []))[2] infiles = [] print("searching...") for name in filenames: #print(name[-4:]) if(name[-4:]==".pdf"): ...
Pobulus/pdf-fixer
fix-titles.py
fix-titles.py
py
1,070
python
en
code
0
github-code
1
72432015395
import cv2 import numpy as np import matplotlib.pyplot as plt # Load the image img = cv2.imread('liberty.jpeg') # Convert the image to grayscale gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # Perform Harris corner detection dst = cv2.cornerHarris(gray, 2, 3, 0.04) # Deep copy the original image for Harris corners i...
keemo01/Graphics
lab9/detect.py
detect.py
py
1,752
python
en
code
0
github-code
1
74280167712
#!/usr/bin/env python # coding: utf-8 # In[23]: from typing import Optional, Callable, Tuple, List, NoReturn from functools import partial, reduce import matplotlib.pyplot as plt import matplotlib.image as img import numpy as np import cv2 as cv import PIL as pil import importlib # In[4]: # User-defined funct...
gmagannaDevelop/MorphoImg
Open_Close.py
Open_Close.py
py
7,416
python
en
code
0
github-code
1
24203767352
# Webcrawler.py import sys import urllib.request import html import io # print message def std_log(msg): print(msg) # retrieve URL def get_page(url, log): try: page = urllib.request.urlopen(url) except urllib.URLError: log("Error retrieving: " + url) return '' body = page.r...
sylabtechnologies/October_test
WebCrawl.py
WebCrawl.py
py
463
python
en
code
0
github-code
1
40962752489
import os import csv # Lists candidates = [] votes = [] candidate_dict = {} unique_candidates = [] # Create function to apply to the voter data def election_results(candidates, votes): # Identify unique candidates for row in candidates: if row not in unique_candidates: unique_candida...
szerpa17/python-challenge
PyPoll/main.py
main.py
py
2,404
python
en
code
0
github-code
1
5875796761
from typing import Callable, Dict, Set, Tuple import re from scipy.spatial import distance Point = Tuple[int, int, int] def get_input(filename: str) -> str: with open(filename, "r") as f: contents = f.read() return contents def parse_input(challenge_input: str) -> Dict[int, Set[Point]]: scanner...
IgnacioGoldchluk/aoc2021
aoc_2021/aoc_2021_19.py
aoc_2021_19.py
py
875
python
en
code
0
github-code
1
39146157825
# coding: utf-8 """ BioLink API API integration layer for linked biological objects. __Source:__ https://github.com/biolink/biolink-api/ # noqa: E501 OpenAPI spec version: 1.1.14 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 impor...
ManuJazz/biolink-python-client
swagger_client/models/abstract_property_value.py
abstract_property_value.py
py
4,618
python
en
code
0
github-code
1
22307121078
import json import re from json import JSONEncoder from SPARQLWrapper import SPARQLWrapper, JSON from executor.query import general_query_dbpedia, general_query_fuseki, get_thumbnails dbpedia_enpoint = 'http://dbpedia.org/sparql' fuseki_endpoint = 'http://localhost:3030/Data/query' class CountryInfo(object): js...
ninggar17/CountryOfTheWorld
executor/query_executor.py
query_executor.py
py
5,298
python
en
code
0
github-code
1
71009674913
""" This is a script that trains 2D U-Nets in the XY, YZ and XZ direction from scratch Usage: python train.py --method 2D """ """ Necessary libraries """ import argparse import datetime import torch import torch.optim as optim import os from torch.utils.data import DataLoader from data.datasets i...
JorisRoels/ensemble-unets
train/train_models_supervised.py
train_models_supervised.py
py
10,142
python
en
code
3
github-code
1
6804293307
from django.conf.urls import url, include from rest_framework import routers, serializers, viewsets from .models import Tricycle from rest_framework.authentication import SessionAuthentication from . import views # Routers provide an easy way of automatically determining the URL conf. router = routers.DefaultRouter()...
olliswe/osusu-backend
osusu_system/urls.py
urls.py
py
956
python
en
code
0
github-code
1
21400034242
from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied from django.shortcuts import render, get_object_or_404, redirect from django.views.generic import ListView from rest_framework import generics from news.forms import AddingNewsForm, NewsCommentForm, LikeForm f...
i1gr/django_proj_ignat
news/views.py
views.py
py
3,788
python
en
code
0
github-code
1
4273686649
from mathutils.geometry import box_pack_2d def get_nester(method): return rect_pack_custom if method == 'CCOR' else rect_pack_bpy class Page: """Container for several Islands""" __slots__ = ('islands', 'name', 'image_path') def __init__(self, num=1, islands=None): self.islands = islands or l...
Precognist/Export-Paper-Model-from-Blender
nesting.py
nesting.py
py
2,099
python
en
code
null
github-code
1
8020218940
from configs import * from utils import * from flask import Flask app = Flask(__name__) @app.route('/', methods=['POST']) def main(): #Ações que devem ser realizadas pelos comandos ##################################################################### #Videoke - Listas Prontas ######...
arthurAttili/videokeTutu-Demo
main.py
main.py
py
6,365
python
en
code
0
github-code
1
18599510116
"""User and Feedback models detailed.""" from flask_sqlalchemy import SQLAlchemy from sqlalchemy.orm import backref db = SQLAlchemy() def connect_db(app): """Connect to the database.""" db.app = app db.init_app(app) class Pinned(db.Model): """Connetion of a pinner and the pinned person.""" ...
Jared-Glenn/Roomz
models.py
models.py
py
4,001
python
en
code
0
github-code
1
8921533127
#show data from table : data (id,rate) import sqlite3 con = sqlite3.connect("mydb.db") #connect to database mydb or create mydb sql = 'select * from data' result = con.execute(sql) #read database table to memory #print(result) for cols in result: print(cols) print(cols[0]) print(cols[1]) print('-----...
pitakkraiphet/IoTwithPython
exDB3.py
exDB3.py
py
402
python
en
code
0
github-code
1
12781344181
#Function takes an item from list and prints one after another with comma and space + and before last item spam = ['apples', 'bananas', 'tofu', 'cats'] def PrintWithComas(spam): stored = "" for number in range(1, len(spam)): stored += spam[number-1] + ", " if number == len(spam)-1: ...
Luksos9/LearningThroughDoing
automateboringstuff/someSimplePrograms/CommaCode.py
CommaCode.py
py
408
python
en
code
0
github-code
1
3153081064
# program for area and peri of circle using static method import math class circle: @classmethod def pival(cls): cls.pi=round(math.pi,2) def getval(self): self.r=int(input("enter the value of radius: ")) self.pival() class calcu: @staticmethod def calc(obj)...
sanjay7709/python
oops/class/cl14.py
cl14.py
py
522
python
en
code
0
github-code
1
27766064583
import sqlite3 GROUPS_TABLE_SQL = """ CREATE TABLE IF NOT EXISTS groups ( group_id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, UNIQUE(name) ) """ DATAS_TABLE_SQL = """ CREATE TABLE IF NOT EXISTS datas ( data_id INTEGER PRIMARY KEY AUTOINCREMENT, group_id INTEGER, name TEXT, data BLOB, ...
yaamai/test-python-fuse-sqlite3
db.py
db.py
py
3,654
python
en
code
0
github-code
1
18565855623
from libnn import * import csv import copy import operator def sort_table(table, cols): """ sort a table by multiple columns table: a list of lists (or tuple of tuples) where each inner list represents a row cols: a list (or tuple) specifying the column numbers to sort by ...
leojenns/AI_practicals
neural network/nn/iris.py
iris.py
py
2,306
python
en
code
0
github-code
1
15222570199
from sklearn.metrics.pairwise import pairwise_distances from modules.word_embedding import WordEmbedding from modules.utils.text_util import split_to_sentences from modules.similarity_checker import SimilarityChecker class SectionAssigner: @staticmethod def assign_section(sentences: [str], wikipedia: dict, w...
chandraseta/paparazzi-id
modules/section_assigner.py
section_assigner.py
py
2,436
python
en
code
2
github-code
1
22824547956
# encoding: utf-8 import ast from IPython.display import display, HTML from ipywidgets import widgets from Appearance import LayoutSytle from SearchFiles import FindFiles, RefineJson, ApplyFilters _lt = LayoutSytle() class BuildFilterPanel: def __init__(self, path): self._css = """ <style> ...
Antonio-Jr/Interface-Jupyter-Notebook
FilterPanel.py
FilterPanel.py
py
12,434
python
en
code
0
github-code
1
41654448506
import tensorflow as tf from PIL import Image import keras from keras.datasets import mnist from keras.layers import Dense, Dropout from keras.models import Sequential from keras.optimizers import Adam, SGD from keras.callbacks import EarlyStopping import matplotlib.pyplot as plt from keras.preprocessing import image ...
wasi-9274/DL_Directory
DL_Projects/Project/model1.py
model1.py
py
1,994
python
en
code
0
github-code
1
40892231544
# Python program to implement a basic Pong game from turtle import Screen, Turtle from paddle import Paddle from ball import Ball from score_keeper import ScoreBoard PADDLE_RIGHT_X = 390 PADDLE_LEFT_X = -390 # Create the screen screen = Screen() screen.title("Python Pong Game") screen.bgcolor("black") screen.setup(wi...
hornet33/myPythonLearnings
02Intermediate/Day 22/pongGame.py
pongGame.py
py
2,626
python
en
code
0
github-code
1
21907432885
""" Demo the model at test time """ import os import pickle import yaml import numpy as np from utils import load_data, get_wide_deep_model, process_data, parse_cli_args def main(): """Main block of code. Loads the data, model and vectoriser and shows a demo""" args = parse_cli_args() os.environ['TF_CPP_...
caledezma/wide_deep_model
model_demo.py
model_demo.py
py
1,494
python
en
code
3
github-code
1
10874814756
# https://practice.geeksforgeeks.org/problems/smallest-subarray-with-sum-greater-than-x5651/1# # see Dhruv Goyel's video for this. # https://www.geeksforgeeks.org/minimum-length-subarray-sum-greater-given-value/ class Solution: def sb(self, a, n, x): ans=n+1 l ,r= 0,0 sum=0 while r <...
sunny-khatik/Love-Babbar-Sheet-Codes
SmallestSubarrayWithGreaterSum.py
SmallestSubarrayWithGreaterSum.py
py
549
python
en
code
2
github-code
1
27425370623
## John Saraya CIS261 Wk5CourseProjectPt2 Using Lists and Dictionaries to Store and Retrieve Data ## Create a new function that will input and return the from date and to date for the hours worked and is called inside the loop. This should be the first function called. Dates must be in the format mm/dd/yyyy. ## Sto...
saintsfan1775/CourseProjectPt2
CourseProjectPt2.py
CourseProjectPt2.py
py
3,722
python
en
code
0
github-code
1
6933962146
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import copy import torch import numpy as np from tqdm import tqdm from sklearn.metrics import classification_report, accuracy_score device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') best_model = None best_accuracy = 0.0 best_epoch = 0 class ...
huashen218/convxai
convxai/writing_models/trainers/diversity_trainer/trainer.py
trainer.py
py
3,430
python
en
code
9
github-code
1
32174632956
# © 2016 Danimar Ribeiro <danimaribeiro@gmail.com>, Trustcode # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import re import io import base64 import logging import hashlib from lxml import etree from datetime import datetime from pytz import timezone from odoo import api, fields, models, _ from ...
Trust-Code/odoo-brasil
l10n_br_eletronic_document/models/nfe.py
nfe.py
py
47,793
python
pt
code
178
github-code
1
1469751618
import cv2 as cv import numpy as np class rwVideo: def __init__(self,root,nameVideo="Video",guardar=False) -> None: self.cap = cv.VideoCapture(root) if type(root) == int: if not self.cap.isOpened(): print("No se pudo abrir la camara") ex...
JosueCordero/AI_VisionArtificial_Collection
Artificial_Vision/canny.py
canny.py
py
2,787
python
en
code
0
github-code
1
41976992958
import awkward as ak import numpy as np import onnxruntime as ort import vector from numba import jit vector.register_awkward() import torch from torch import nn from torch_geometric.nn.conv import DynamicEdgeConv from torch_geometric.nn.pool import avg_pool_x import workflows.SUEP_utils as SUEP_utils def SSDMetho...
SUEPPhysics/SUEPCoffea_dask
workflows/ML_utils.py
ML_utils.py
py
11,231
python
en
code
3
github-code
1
11153323906
import time from src.app import get_logger logger = get_logger(__name__) class CacheMemoryService: def __init__(self): logger.info("INIT") self._values = {} def set_value(self, key: str, value: object, ttl_in_seconds: int = 0) -> bool: if ttl_in_seconds < 0: return False...
escoteirando/escoteirando_fastapi
src/services/cache_memory_service.py
cache_memory_service.py
py
690
python
en
code
0
github-code
1
32874288502
""" Link: https://onlinejudge.org/index.php?option=onlinejudge&Itemid=8&page=show_problem&problem=40 Time complexity: O(T * V ^ 3) V: num currency money Space complexity: O(T * V ^ 3) Author: Nguyen Duc Hieu """ NEG_INF = -int(1e10) def floyd_warshall(graph): V = len(graph) for k in range(V): for i in...
hieuducnguyen/BigOCourse
11_floyd_warshall/3_arbitrage.py
3_arbitrage.py
py
1,325
python
en
code
2
github-code
1
8275516082
import numpy as np import pytest from mpol import coordinates, gridding from mpol.constants import * # cache an instantiated gridder for future imaging ops @pytest.fixture def gridder(mock_visibility_data): uu, vv, weight, data_re, data_im = mock_visibility_data return gridding.Gridder( cell_size=0....
shawn194/MPoL
test/gridder_dataset_export_test.py
gridder_dataset_export_test.py
py
1,172
python
en
code
null
github-code
1
37395196651
#ekleme fonkisyonu okey #görüntüleme ve tablo fonksiyonu gerek import mysql.connector from os import system, name from getpass import getpass from time import sleep def ekle(): print("İsim: ",end="") isim = input() print("Soyisim: ",end="") soyisim = input() print("Yaş: ",end="") yas = input()...
melihakay/python-deneme
Rehber/ana.py
ana.py
py
2,494
python
tr
code
0
github-code
1
6983073298
import os from card_prep import Card from card_prep import RunCard from card_prep import GetCardInfo import test import z_Components import yaml import subprocess import os import sys import argparse import shlex import datetime import importlib #========================================================================...
cbitterfield/JobCard3
src/z_JobRun.py
z_JobRun.py
py
5,043
python
en
code
0
github-code
1
22098035447
#!/bin/python3 import subprocess import optparse import re import colored from colored import fg, bg, attr from colored import stylize from scapy import all as scapy from scapy.all import srp,Ether,ARP,conf,send,arping,IP,sniff,sys def main (): print_banner() (ip) = get_arguments() arp...
JosephIsedowo/LAN-scan
ispy.py
ispy.py
py
1,536
python
en
code
0
github-code
1
26426361017
from collections import defaultdict, deque import math def solution(progresses, speeds): answer = [] pre = -1 for p,s in zip(progresses, speeds): now = math.ceil((100-p)/s) if now > pre: pre = now answer.append(1) else: answer[-1] += 1 return answer
dohui-son/Python-Algorithms
programmers/p기능개발_2.py
p기능개발_2.py
py
314
python
en
code
0
github-code
1
12926090390
"""empty message Revision ID: 14a31a096ca4 Revises: cded1b6a4595 Create Date: 2023-06-28 22:09:16.157596 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = '14a31a096ca4' down_revision = 'cded1b6a4595' branch_labels = None depends_on = None def upgrade(): # #...
NotNoneX/Flask-QA
migrations/versions/14a31a096ca4_.py
14a31a096ca4_.py
py
1,056
python
en
code
0
github-code
1
27437551021
import json import os import platform as os_platform import shutil import subprocess import sys import time import wx global compiler_logs compiler_logs = '' def scrollToEnd(txtCtrl): if os_platform.system() != 'Darwin': txtCtrl.SetInsertionPoint(-1) txtCtrl.ShowPosition(txtCtrl.Get...
thiagoralves/OpenPLC_Editor
editor/arduino/builder.py
builder.py
py
26,510
python
en
code
307
github-code
1
33501478142
import numpy as np import matplotlib.pyplot as plt #If using termux import subprocess import shlex x = [1,2,3,4,2,1] #Assuming length of x(n) and h(n) as same N = len(x) def h(N): h = [] for i in range(N): out = 0; if i >= 0: out = out+((-0.5)**i) if i-2 >= 0: out = out+((-0.5)**(i-2)) h.append(out) ...
Sivanidevarapalli26/EE3025_IDP
Assignment-1/Codes/ee18btech11012.py
ee18btech11012.py
py
1,353
python
en
code
0
github-code
1
29247972051
#!/usr/bin/env python from comm.mapper import Mapper from comm import comm class PCD2JPG(Mapper): def __init__(self): Mapper.__init__(self, ["pcd"], [comm.PointCloudMessage], "jpg", comm.MultiChannelImageMessage) def func(self, xyz_bgr): _, bgr ...
joschu/python
jds_image_proc/scripts/comm_pcd2jpg.py
comm_pcd2jpg.py
py
391
python
en
code
8
github-code
1
24203918166
n = int(input('Кол-во друзей: ')) k = int(input('Кол-во долговых расписок: ')) money = [] for _ in range(n): money.append(0) for receipt in range(k): print() print(receipt + 1, 'расписка') debtor = int(input('Кому: ')) creditor = int(input('От кого: ')) how_money = int(input('Сколько: ')) ...
AL0RIAN/Python-Basic
Module16/09_friends/main.py
main.py
py
550
python
ru
code
0
github-code
1
30792529610
import cv2,os from pywidgets.kivy.Img.__origin import * from pycv2.img.utils import * from pycv2.img.drawing.box import * def donothing(*args,**kwrgs):pass FILE_PATH=os.path.dirname(__file__) CRITERIA = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 10, 1.0) REMOVEDBACKGROUND=cv2.imread(os.path.join(FILE_PATH,"ic...
Emam546/pywidgets
pywidgets/kivy/Img/__Img_viewers.py
__Img_viewers.py
py
4,996
python
en
code
1
github-code
1
39809108328
import numpy as np def unitStep(x, t): if x > t: return 1 return 0 def perceptronLearn(inputs, outputs, w, a, th): epochs = 30 numInstances = inputs.shape[0] numInputs = inputs.shape[1] for j in range(0, epochs): flag = False print("Epoch : ", j+1) for i in ra...
flick-23/SEM-6
AL_ML LAB/TW3A/TW3A.py
TW3A.py
py
1,672
python
en
code
17
github-code
1
17469809829
# import class file from Mahasiswa import Mahasiswa # deklarasi kelas crud class Crud: # atribute private __list = [] # list of objek mahasiswa # konstruktor def __init__(self): self.__list = [] # method create: membuat objek mahasiswa def create(self, nim, nama, pro...
Azzahrasth/LATIHAN1DPBO2023
Python/program/Crud.py
Crud.py
py
2,177
python
id
code
0
github-code
1
11131276745
# 네이버 오픈 API 이용하기 import requests client_id = "ObR7t_ig_MksARWbtN86" client_secret = "RH_A6LmYyr" headers = {"X-Naver-Client-Id": client_id, "X-Naver-Client-Secret": client_secret} start = 1 for idx in range(10): start_num = start + (idx * 100) URL = ( "https://openapi.naver.com/v1/search/shop.json...
hayeong25/Python_Soldesk
rpa/crawl/requests1/8_openapi1.py
8_openapi1.py
py
579
python
en
code
0
github-code
1
11966906240
from django import forms from .models import Ficha, Review, Assignment, FichaImage, get_default_start_date from django.contrib.admin.widgets import AdminDateWidget, AdminTimeWidget from django.forms import modelformset_factory from django.core.exceptions import ValidationError class AssignmentForm(forms.ModelForm): ...
s0lci700/FPPT16
Fichas/forms.py
forms.py
py
4,988
python
en
code
1
github-code
1