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
12040736872
def main(): while True: try: fraction = input("Fraction: ") print (gauge(convert(fraction))) break except (ValueError, ZeroDivisionError): continue def convert(fraction): fraction = fraction.split("/") fraction[0], fraction[1] = int(fraction[0...
shivang1209-dot/CS50P
pset5/test_fuel/fuel.py
fuel.py
py
665
python
en
code
0
github-code
36
21518376045
from __future__ import division import scipy.optimize import numpy as np import json import re import cv2 _BLACK = (0, 0, 0) _RED = (0, 0, 255) _BLUE = (255, 0, 0) _PURPLE = (204, 0, 153) _ORANGE = (51, 153, 255) _LBROWN = (0, 153, 230) keypoint_colors = { '1': _RED, '2': _RED, '3': _RED, '4': _RED, '5': _RED, ...
egoodman92/semi-supervised-surgery
MULTITASK_FILES/KEYPOINTS_FILES/surgery-hand-detection-new/scripts/filter_bootstrap.py
filter_bootstrap.py
py
8,359
python
en
code
0
github-code
36
34075769652
#!/usr/bin/env python from sense_hat import SenseHat sense_obj = SenseHat() red = (255,0,0) green = (0,255,9) blue = (0,0,255) while True: sense_obj.show_message("Life is Beautiful!", text_colour=red, back_colour=green)
akshaynawale/PiSense
sense_hat/show_text.py
show_text.py
py
227
python
en
code
0
github-code
36
2434152222
from funcs import * import numpy as np import matplotlib.pyplot as plt counter = lambda List, isPositive: sum(List) if isPositive else N - sum(List) # Выборка N = 1000 # Class 0 mu_0 = 190 sigma_0 = 10 basketballers = np.random.normal(mu_0, sigma_0, N) # Class 1 mu_1 = 173 sigma_1 = 12 footballers = np.random.norma...
shulayonok/ML4
main.py
main.py
py
2,654
python
en
code
0
github-code
36
2926954909
import pandas as pd import numpy as np from multiprocessing.pool import ThreadPool from multiprocessing import cpu_count import operator from collections import OrderedDict import itertools import time from sklearn.metrics import accuracy_score import visualization visuals = visualization.Visualization() ...
aditya-srikanth/Data-Mining-Assignment-3
LOF.py
LOF.py
py
5,514
python
en
code
0
github-code
36
12370764901
import sys sys.setrecursionlimit(10000) n , m , k = map(int, input().split()) # n = 행 M = 열 array = [[0]*m for _ in range(n)] check = [[0]*m for _ in range(n)] dx = [-1, 1, 0, 0] dy = [0, 0, -1, 1] for i in range(k): x , y , x1, y1 = map(int, input().split()) # x 열 y 행 for i in range(y, y1): for j in ...
hwangstone1/Algorithm_repository
Algorithm_DFS&BFS/DFS_exercise_7.py
DFS_exercise_7.py
py
963
python
en
code
0
github-code
36
34761412830
import sys, os import subprocess import json from typing import Union from random import random import web3 from web3 import Web3 from web3._utils.threads import Timeout from solcx import compile_files from eth_utils import decode_hex # Project modules from TextColor.color import bcolors MGMT_CONTRACT_DB_NAME = 'dat...
acid9reen/bas
utils.py
utils.py
py
11,123
python
en
code
0
github-code
36
26409261579
class Solution: def distributeCandies(self, n: int, limit: int) -> int: #第一个孩子可能得到的糖果数i min(n,limit) #第二个孩子可能得到的糖果数j min(n-i,limit) #第三个孩子可能得到的糖果数k n-i-j count = 0 for i in range(min(n,limit)+1): for j in range(min(n-i,limit)+1): k = n-i-j ...
lpjjj1222/leetcode-notebook
2928. Distribute Candies Among Children 1.py
2928. Distribute Candies Among Children 1.py
py
495
python
zh
code
0
github-code
36
37952156492
from math import sqrt from itertools import product import numpy as np from scipy.special import factorial as fact from functools import lru_cache # The interaction matrix in desired basis # U^{spherical}_{m1 m2 m3 m4} = \sum_{k=0}^{2l} F_k angular_matrix_element(l, k, m1, m2, m3, m4) # H = \frac{1}{2} \sum_{ijkl,\si...
romerogroup/CondensedMatter_Jupyter
code/minimulti/electron/U_matrix.py
U_matrix.py
py
19,979
python
en
code
7
github-code
36
71940065385
# Define the Rosenbrock function with parameters a=1 and b=100 def rosenbrock(x, y): return (x-1)**2 + 10 * (y - x**2)**2 # Set parameters a = 1 b = 10 alpha = 0.004 u = [-0.75, 0.7] # Initialize mold with a dummy value mold = 10**100 mnew = rosenbrock(u[0], u[1]) # Steepest Descent Algorithm while mnew<mold: ...
KuffDeSchmull/comp_sci_unilu
table41_ros.py
table41_ros.py
py
1,031
python
en
code
0
github-code
36
10017544829
from core.celery import app from celery import Celery import json import subprocess import os from .models import Node, Offer from django.utils import timezone import tempfile import redis from .serializers import NodeSerializer, OfferSerializer import calendar import datetime import requests from api.serializers impor...
golemfactory/golem-stats-backend
stats-backend/api2/tasks.py
tasks.py
py
17,630
python
en
code
1
github-code
36
20101978227
import cache import timer import lora import websockets import asyncio import threading import keyboard import timestamp def thread_function(): while (not cache.stop_thread): timer.countdown(cache.t) def thread_function_killer(): while (not cache.stop_thread): record = keyboa...
juliogcm/lorawan-flow
websocket_client/client.py
client.py
py
3,331
python
en
code
0
github-code
36
74001078184
from permute import recursive # @recursive def test_single(depth: int) -> int: if depth == 10: return 0 return test_single(depth+1) + 1 def sum_results(results: list[int]) -> int: result: int = 0 for r in results: result += r return result @recursive def test_branching(depth: i...
LQR471814/permute
example.py
example.py
py
501
python
en
code
0
github-code
36
43104980518
''' Minimum Multiple Given a collection C1 of ‘n’ positive integers and a number ‘m’ write a C program to find the minimum multiple of m in C1. If no such multiple exist in C1 then print ‘No multiple found’ For example, if there are seven elements 23, 24, 25, 12, 6, 7, 11 and m is 3 then the output should be 6. Input...
Sasank123k/problem-of-the-day
2021-12-18.py
2021-12-18.py
py
965
python
en
code
0
github-code
36
34234807737
class Employee: raise_amount = 1.04 num_emps = 0 def __init__(self, first, last, pay): self.first = first self.last = last self.pay = pay self.email = first + '.' + last + '@company.com' Employee.num_emps += 1 def fullname(self): return...
latiful-hassan/OOP
staticmethods.py
staticmethods.py
py
1,980
python
en
code
0
github-code
36
41230462018
import numpy as np import matplotlib.pyplot as plt from pathlib import Path from SnapOptimizer.optimization.snap_optimizer import SNAPGateOptimizer2Qubits, SNAPGateOptimizerStatePreparation from SnapOptimizer.optimization.snap_pulse_optimizer import SNAPPulseOptimizer import SnapOptimizer.qubit_gates as qubit_gates fr...
Paulsson99/SnapOptimizer
SnapOptimizer/optimization/automation.py
automation.py
py
5,537
python
en
code
0
github-code
36
41539002397
#!/usr/bin/python # Imports ### System import os import argparse ### Python import numpy as np import cv2 as cv from tqdm.auto import tqdm import matplotlib.pyplot as plt ### Pytorch import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F ### TODO: Use WandB, Pytorch Lightning...
Aryan-Garg/Image-Forgery-Detection
transfer_learning.py
transfer_learning.py
py
13,826
python
en
code
0
github-code
36
27029688469
import torch import numpy as np import torch.nn as nn class PositionalEncoding1D(nn.Module): def __init__(self, num_pos_feats=64, temperature=10000, normalize=False, scale=None): """ :param channels: The last dimension of the tensor you want to apply pos emb to. """ super().__init__...
ViTAE-Transformer/DeepSolo
adet/layers/pos_encoding.py
pos_encoding.py
py
3,339
python
en
code
177
github-code
36
20760678532
from re import T from django.db import models from machine.computations.examples import victorious_payment from django.contrib.postgres.fields import ArrayField # Create your models here. class Machine(models.Model): def empty_list(): return list() # identificar la maquina que estamos usando na...
montenegrop/casinoGames
machine/models.py
models.py
py
1,286
python
en
code
0
github-code
36
15760194327
import glob import os import sys try: sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % ( sys.version_info.major, sys.version_info.minor, 'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0]) except IndexError: pass import carla import random import time ...
hchoi256/carla-research-project
Learning_Tasks/LT1/vehicle_camera.py
vehicle_camera.py
py
3,348
python
en
code
1
github-code
36
21185857238
import pygame from time import time import os ## OPTIONS LIEES A L'AFFICHAGE screen_width, screen_height = 1280, 720 # taille de la fenetre show_interface = False # afficher le classement ticks_per_second = 60 # nombre de mise à jour par seconde empty_ground_color = (210, 210, 210) # couleur d'une terre inoccup...
JonathanOll/Pixel-War-Simulator
options.py
options.py
py
1,495
python
fr
code
0
github-code
36
28508158291
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('home', '0019_auto_20150312_1008'), ] operations = [ migrations.CreateModel( name='LinkCategory', fie...
micahlagrange/rmlsa.com
rmlsa/home/migrations/0020_linkcategory_weblink.py
0020_linkcategory_weblink.py
py
1,164
python
en
code
0
github-code
36
75086618662
from dronekit import connect,LocationGlobalRelative,APIException,VehicleMode import time import socket import math import cv2, imutils, socket import numpy as np import base64 import cv2, imutils import numpy as np import base64 import torch def arm_and_takeoff(aTargetAltitude): """ Arms vehicle ...
RahulHKumar/autonomous_drone_monocular_cam_pixhawk
dro_vel.py
dro_vel.py
py
2,854
python
en
code
0
github-code
36
8827399963
from __future__ import absolute_import, division, print_function from collections import OrderedDict import flask from flask import current_app, request class APIEndpoint(object): MIN_API_VERSION = 3 LATEST_API_VERSION = 3 HEADER_PREFIX = "application/vnd.marv.v" def __init__(self, name, func, url_...
ternaris/marv
marv_webapi/tooling.py
tooling.py
py
3,760
python
en
code
3
github-code
36
5791008757
#client.py import time import socket import _thread as thread from time import sleep import connHandle # socket wrapper class class sockW: def __init__ (self, sock, ipAddr): self.sock = sock self.ipAddr = ipAddr def get_ip_addr(self): return self.ipAddr def get_sock(self): ...
RiceShelley/RPI_Cluster
clusterCtl/multiClient/client.py
client.py
py
2,099
python
en
code
0
github-code
36
10830099515
import tkinter as tk import json from api import functions class window(tk.Tk): def __init__(self): super().__init__() self.geometry('767x445') self.title('Get daily news') self.funcs = functions() def main_window(self): # Creating required labels and frame title = tk.Label(self, text="Get news", font="...
PingalPie/news-application
gui.py
gui.py
py
3,053
python
en
code
0
github-code
36
74144288102
from django.core.management.base import BaseCommand import os from importlib import import_module from django.conf import settings from django.core.management import call_command from newapp.utils import get_app_template_path, get_app_templates APP_TEMPLATES = [ x.get('name') for x in get_app_templates() ] class Com...
freezmeinster/django-newapp
newapp/management/commands/newapp.py
newapp.py
py
2,670
python
en
code
0
github-code
36
71239927463
''' Author - Imanpal Singh <imanpalsingh@gmail.com> GUI application for twitter sentiment analysis Date created : - 02-07-2019 Date modified : - 03-07-2019 ''' #importing requierd libraries import numpy as np import pandas as pd from nltk.corpus import stopwords from nltk.stem.porter import PorterStemmer...
imanpalsingh/twitter-sentiment-analysis
GUI.py
GUI.py
py
3,692
python
en
code
1
github-code
36
13780351709
import sys from collections import deque def div_area(q): while q: r, c = q.popleft() for x, y in [[r + 1, c], [r - 1, c], [r, c + 1], [r, c - 1]]: if 0<= x < n and 0<= y < m: if area[x][y] == 0: area[x][y] = -1 q.append([x, y]) ...
Yangseyeon/BOJ
03. Gold/2638.py
2638.py
py
1,281
python
en
code
0
github-code
36
27029634669
import copy import logging import os.path as osp import numpy as np import torch from fvcore.common.file_io import PathManager from PIL import Image from pycocotools import mask as maskUtils from detectron2.data import detection_utils as utils from detectron2.data import transforms as T from detectron2.data.dataset_m...
ViTAE-Transformer/DeepSolo
adet/data/dataset_mapper.py
dataset_mapper.py
py
6,846
python
en
code
177
github-code
36
23381324856
vocabulary = [] with open('Voca_01.txt', 'r', encoding='utf-8') as file: for line in file: line = line.strip() # Loại bỏ khoảng trắng dư thừa từ đầu và cuối dòng if not line: continue # Bỏ qua dòng trống # Tách thông tin từ dòng sử dụng dấu ngoặc đơn (') và dấu ngo...
nguyenbuitk/python-tutorial
search_vocabulary/test_split_strip.py
test_split_strip.py
py
1,000
python
vi
code
0
github-code
36
22398051842
import sys import cv2 import numpy as np from os import listdir PY3 = sys.version_info[0] == 3 #Define the parameters SIZE = 32 CLASS_NUMBER = 6 #Read the traffic sign dataset and store the dataset and labels into a list def load_traffic_dataset(): dataset = [] labels = [] for sign_type in range(CLASS_NU...
nabil053/Bangladeshi-Traffic-Sign-Detection-And-Recognition-System
classification.py
classification.py
py
3,647
python
en
code
0
github-code
36
24788953369
import sys # 북동남서 dir_y = [-1, 0, 1, 0] dir_x = [0, 1, 0, -1] # 대각선들 오른쪽 위부터 시계 diagonal_y = [-1, 1, 1, -1] diagonal_x = [1, 1, -1, -1] N, M, K, C = list(map(int, sys.stdin.readline().strip().split())) trees = [None] * N killer = [[0] * N for _ in range(N)] for i in range(N): trees[i] = list(map(int, sys.stdin.r...
inhyeokJeon/AALGGO
Python/codetree/47.py
47.py
py
3,407
python
en
code
0
github-code
36
25189150116
# -*- coding: utf-8 -*- # # # TheVirtualBrain-Scientific Package. This package holds all simulators, and # analysers necessary to run brain-simulations. You can use it stand alone or # in conjunction with TheVirtualBrain-Framework Package. See content of the # documentation-folder for more details. See also http://www...
suraj1074/tvb-library
tvb/tests/library/simulator/monitor_transforms_test.py
monitor_transforms_test.py
py
7,125
python
en
code
null
github-code
36
4703541196
#!/usr/bin/env python3 import rospy import sounddevice as sd import numpy as np import queue import sys import sounddevice as sd from audio_universal.msg import AudioData ''' ~output_device: use `python3 -m sounddevice` to get device list, numerical device ID or case-insensitive substrings is ok. ~channels: 1 ~refresh...
jsbyysheng/ros_audio_universal
scripts/audio_play.py
audio_play.py
py
2,867
python
en
code
0
github-code
36
37989827251
""" Steps to run: python insured_info_scraper.py <account number> Eg: python insured_info_scraper.py 20011 Program written in Python 3 Program Output: 1 file: Insured_Info_<account_num>.json - json file that contains the insured info details Program Description: Progam first fetches the ASP login page paramters - _...
tebbythomas/Freelance_Projects
Web_Data_Extraction_Projects/J10_Finance_Pro_Insured_Info_Scraper/Insured_Info/insured_info_scraper.py
insured_info_scraper.py
py
6,297
python
en
code
1
github-code
36
19699984534
#!/usr/bin/env python # -*- coding: utf-8 -*- import base_classes as bc from struct import pack, unpack # FPGA Instruments KERRIGAN = { 'nickname' : 'kerrigan', 'name' : 'Xilinx Virtex 5', 'address' : 0x55, } # I2C Instruments CHEN = { 'nickname' : 'ch...
kitmonisit/microlab-instruments
microlab_instruments/microlab_instruments.py
microlab_instruments.py
py
12,995
python
en
code
1
github-code
36
5001168268
import json import os import boto3 import logging logger = logging.getLogger() logger.setLevel(logging.INFO) dynamodb = boto3.resource("dynamodb") def lambda_handler(event, context): logger.info(f"EVENT: {event}") statistics_table_name = os.environ["STATISTICS_TABLE_NAME"] statistics_table = dynamodb.Ta...
HeNeos/SportsAnalyticsPlatform
services/dynamodb/runtime/lambda_function.py
lambda_function.py
py
4,924
python
en
code
0
github-code
36
5544666629
import urllib.request import datetime import json # 返回一个月内的cf场数和上/掉分情况 def get_CF_ContestCount(name): apiUrl = "https://codeforces.com/api/user.rating?handle=" + name try: page = urllib.request.urlopen(apiUrl, timeout=2000) s = page.read().decode('utf-8') contestsData = json.loads(s)['...
Linzecong/LPOJ
CrawlingServer/CodeForceContestCounter.py
CodeForceContestCounter.py
py
1,067
python
en
code
216
github-code
36
39871891033
# -*- coding: UTF-8 -*- ''' Created on 2022年1月19日 @author: automan ''' class Language(object): clanguage = { 'PV_01_01' : "通知方法设定", 'PV_01_02' : "通知 OFF/ON", 'PV_01_03' : "通知", 'PV_01_04' : "尚无配对的太阳能板。请先完成装置的配对。", 'PV_01_05' : "...
panda109/tsfm
app/main/language.py
language.py
py
3,797
python
zh
code
0
github-code
36
32443531446
import imdb import json from tqdm import tqdm ia = imdb.IMDb() DATA_NEEDED = False with open("./imdb/movie_title-id.json", "r") as data: current_data = json.load(data) with open('./movie_titles_list.json', "r") as movie_list: movies = json.load(movie_list) if DATA_NEEDED: for i in tqdm(range(0, len(mov...
Shreneken/movie-data-getter
imdb/imdb_id.py
imdb_id.py
py
824
python
en
code
0
github-code
36
70489042024
from unittest.mock import MagicMock from uuid import uuid4 import pytest from pytest import raises from pydantic import ValidationError from api.exceptions import InvalidParameterError from api.schemas.output import ( ConsultaProcessoOutput, ExtractDataOutput, ExtractDataSecondInstanceOutput, StatusS...
BrunoPisaneschi/JusBrasil
tests/unit/api/schemas/test_output.py
test_output.py
py
4,369
python
pt
code
0
github-code
36
26094620258
import google import firebase_admin from firebase_admin import credentials from firebase_admin import firestore import base64 keyPath = '../firestoreKEY.json' def initializeDb(path): cred = credentials.Certificate(path) firebase_admin.initialize_app(cred) db = firestore.client() return db def strin...
16francej/firestoredemo
RecieveImage.py
RecieveImage.py
py
1,190
python
en
code
0
github-code
36
73603683305
from os.path import join from django.shortcuts import render from random import randint, randrange from physics import physics_classes_functions as ucf from physics import variety_lists as vl def list_callable_functions(): """returns list of all modules in this file This function MUST remain in this file to wo...
devjolt/eqg
physics/d_electricity/dbc_emf_and_internal_resistance.py
dbc_emf_and_internal_resistance.py
py
6,642
python
en
code
0
github-code
36
29858390178
import time import pickle from pathlib import Path from os.path import splitext import json from tensorflow.keras.wrappers.scikit_learn import KerasClassifier # ASReview dependencies from asreview.review import ReviewSimulate, ReviewOracle, MinimalReview from asreview.utils import text_to_features from asreview.types...
syuanuvt/automated-systematic-review
asreview/review/factory.py
factory.py
py
9,549
python
en
code
null
github-code
36
6432536009
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import apps.users.models class Migration(migrations.Migration): dependencies = [ ('users', '0005_auto_20180802_1614'), ] operations = [ migrations.AlterModelManagers( nam...
eashme/Django-backend
Hello_Server/apps/users/migrations/0006_auto_20180802_1723.py
0006_auto_20180802_1723.py
py
449
python
en
code
1
github-code
36
9148386910
#coding=utf-8 """ 这是一个关于QQ模拟(QListView的使用)的例子--模型定义! 文章链接:http://www.xdbcb8.com/archives/701.html """ import random import Random_Name from PyQt5.QtCore import QAbstractListModel, Qt, QModelIndex, QVariant, QSize from PyQt5.QtGui import QIcon, QFont class ListModel(QAbstractListModel): ''' 自定义模型 ''' ...
redmorningcn/PyQT5Example
PyQt5All/PyQt535、36、37/ListModel.py
ListModel.py
py
3,281
python
zh
code
1
github-code
36
17929378111
#!/usr/bin/python3 import multiprocessing import matplotlib.pyplot as plt from matplotlib.widgets import Slider, Button, RadioButtons import math import time def points(): import sys for line in open("input.txt"): line = line.replace("position=", "").replace("velocity=", "").replace(' ', '').replace('...
Easimer/advent-of-code-2018
day10/day10.py
day10.py
py
1,643
python
en
code
0
github-code
36
74329290664
# import pytest from schemaql.helpers.fileio import read_yaml from schemaql.connectors.snowflake import SnowflakeConnector from schemaql.connectors.bigquery import BigQueryConnector class TestConnections(object): def _get_connection(self, connection_name): connections_file = "connections.yml" con...
clausherther/schemaql-core
test/integration/test_connections.py
test_connections.py
py
1,089
python
en
code
0
github-code
36
25759790506
import os from datetime import datetime dir = os.path.dirname(os.getcwd()+'/users/') print(dir) try: os.stat(dir) except: os.mkdir(dir) print('make directory') all_users = {} for f in os.listdir(os.getcwd()): if f.endswith(".csv"): split = str(f).split('_') code = split[1] pr...
gunarto90/twitter-stream
iterate user id.py
iterate user id.py
py
1,564
python
en
code
1
github-code
36
18233237825
class Define: def __init__(self, traffic_demand: int, holding_time: int, total_traffic: int, max_route: int, avg_repaired_time: int, node_size: int, shape: float, scale: float): self.traffic_demand = traffic_demand self.holding_time = holding_time self.total_traffic = total_...
shugonta/simulatorV2
define.py
define.py
py
503
python
en
code
0
github-code
36
21628945974
# VoiceOver language choices VOICEOVER_LANGUAGE_CHOICES = [ ("en", "English"), ("hi", "Hindi"), ("as", "Assamese"), ("bn", "Bengali"), ("brx", "Bodo"), ("doi", "Dogri"), ("gu", "Gujarati"), ("kn", "Kannada"), ("ks", "Kashmiri"), ("gom", "Konkani"), ("mai", "Maithi...
AI4Bharat/Chitralekha-Backend
backend/voiceover/metadata.py
metadata.py
py
982
python
en
code
18
github-code
36
28492416311
from django.shortcuts import render, HttpResponse from django.conf import settings from rest_framework.decorators import api_view from rest_framework.response import Response import random from .models import Planet from .serializers import PlanetSerializer from api.serializers import GenericSerializer from api.vie...
yitchee/The-Clone-Wars-API
api/planets/views.py
views.py
py
1,971
python
en
code
0
github-code
36
17453307389
import os import csv import random import pandas as pd def trainval_split(root, suffix, save_dir): content = [] num = 0 suf_root = os.path.join(root, suffix) for slide in os.listdir(suf_root): slide_dir = os.path.join(suf_root, slide) for subslide in os.listdir(slide_dir): ...
yida2311/OSCC_SF
dataset/data_split.py
data_split.py
py
1,418
python
en
code
0
github-code
36
70617927783
# Speech Brain Viewer app # to accompany Hamilton, Oganian, Hall, and Chang, Cell 2021 # https://doi.org/10.1016/j.cell.2021.07.019 # # Viewer created by Liberty Hamilton, 2021 # Email liberty.hamilton@austin.utexas.edu with questions # import scipy.io import numpy as np import dash import dash_core_components as dc...
libertyh/SpeechCortex
app.py
app.py
py
24,899
python
en
code
2
github-code
36
18924218055
from selenium import webdriver from selenium.webdriver.common.by import By import time class SwitchToWindow(): def test(self): baseUrl = "https://letskodeit.teachable.com/pages/practice" driver = webdriver.Firefox() driver.maximize_window() driver.get(baseUrl) # Find paren...
PacktPublishing/-Selenium-WebDriver-With-Python-3.x---Novice-To-Ninja-v-
CODES/S23 - Selenium WebDriver -_ Switch Window And IFrames/1_switch-to-window.py
1_switch-to-window.py
py
847
python
en
code
11
github-code
36
26673906311
import glob import os import shutil import os.path from os import path # Constants CE_DIR = "ce" CE_FILTER_DIR = "ce_filter" def cleanup(directory): if path.exists(directory): shutil.rmtree(directory) os.mkdir(directory) def main(): cleanup(CE_FILTER_DIR) ce_files = sorted(glob.glob(f"{CE_...
nyfd/m118
ce-filter.py
ce-filter.py
py
547
python
en
code
0
github-code
36
10495517316
from django.test import TestCase, RequestFactory from djlotrek.request_utils import get_host_url class RequestUtilsTestCase(TestCase): def test_get_host_url(self): """ get_host_url function retrieve request object and return host url when request object is not None """ req...
lotrekagency/djlotrek
tests/test_request_utils.py
test_request_utils.py
py
797
python
en
code
7
github-code
36
14716003738
from sqlalchemy import create_engine, text, MetaData, Table, Column, Integer, String, select engine = create_engine('postgresql://postgres:1@localhost/news_db') meta = MetaData() students = Table( 'students', meta, Column('id', Integer, primary_key=True), Column('first_name', String), Column('last_na...
devabsaitov/self_study
sqlalchemy_lesson/Basic/7_using_aliases.py
7_using_aliases.py
py
494
python
en
code
0
github-code
36
38251884357
from django.db import models all_pages = [] # Just switched to keeping it in-memory. No real need for a model here. # class Page(models.Model): # top = models.TextField(blank=True, null=True) # middle_link = models.TextField(blank=True, null=True) # middle_html = models.TextField(blank=True, null=True) #...
skoczen/skoczen
project/apps/resume/models.py
models.py
py
4,868
python
en
code
1
github-code
36
8729618404
#This script will format all images in a given directory to the same size and to gray scale using OpenCV from scipy import ndimage, misc import numpy as np import cv2 as cv from os import listdir #Iterate throuh the training image directory and sub folders img_directory= "/home/paok/Documents/FaceRecognition/trainImage...
PAOK-2001/FaceRecognition
Trainer_auxfiles/imageFormater.py
imageFormater.py
py
1,359
python
en
code
0
github-code
36
15316070011
from rng import RNG from exceptions import InvalidValue import time #Blum Blum Shub Generator class BBS(RNG): def __init__(self, seed = int(time.time()), moduo = 429497053): RNG.__init__(self, seed) if(seed<0): raise InvalidValue("seed") if(moduo<=0): raise Invali...
MihailoTim/Pseudo-Random-Number-Generators
code/bbs.py
bbs.py
py
1,723
python
en
code
0
github-code
36
21841983047
# -*- coding: utf-8 -*- """ Created on Wed Jan 6 16:57:05 2016 A file that contains steppers based on Scovel's method at various orders. Details of the mathematical background an some example usages can be found in Chapters 4 and 6 of Simulating Hamiltonian Dynamics. @author: rpoolman """ import numpy as np import...
Rhys314/Simulating_Hamiltonian_Dynamics
Steppers/scovel.py
scovel.py
py
16,278
python
en
code
0
github-code
36
25578129495
class Solution: def removeKdigits(self, num: str, k: int) -> str: #if k is equal to our larger than the length of num, return '0' if len(num) <= k: return '0' for i in range(k): j = 1 while j < len(num): #greedy algorithm. Remove t...
korynewton/code-challenges
leetcode/RemoveKDigits/solution.py
solution.py
py
1,281
python
en
code
0
github-code
36
9140513276
class bebida: Agua = True Gas = "w" Sabor = "x" Colorantes = "y" Temperatura = "z" def __init__ (self,a,b,c,d): self.Gas = a self.Sabor = b self.Colorantes = c self.Temperatura = d cocacola = bebida("Con gas", "Sabor cola", "con colorantes...
Briusx/Inicializador
inicializador bebidas.py
inicializador bebidas.py
py
696
python
en
code
0
github-code
36
30161042149
a = str(input('Digit your full name: ')).upper().strip() b = a.split() count = 0 for i in b: if i == "SILVA": print('Your name contains "SILVA" ') count += 1 if count != 0: break if count == 0: print('Your name does not contain "SILVA" ')
RodolfoCRS/Python
025 - Looking for a string inside another.py
025 - Looking for a string inside another.py
py
283
python
en
code
0
github-code
36
34619647140
import datetime import json import random import requests import numpy as np import pandas as pd from pkg_resources import resource_filename class DataWrangler: def __init__(self, wallet, start, end): self.wallet = wallet self.start = start self.end = end self.profit = None ...
karolow/currency-wallet
currency_wallet/utils/utils.py
utils.py
py
3,114
python
en
code
0
github-code
36
70190123945
from tech_news.database import search_news from datetime import datetime # Requisito 6 def search_by_title(title): find = search_news( {"title": {"$regex": f"{title}", "$options": "i"}} ) return [(item["title"], item["url"]) for item in find] # Requisito 7 def search_by_date(date): try: ...
mabiiak/tech-news
tech_news/analyzer/search_engine.py
search_engine.py
py
1,103
python
en
code
0
github-code
36
37217485047
def max_sum(A, left, right): # A[left], ..., A[right] 중 최대 구간 합 리턴 # 아래 3줄의 수행시간: c(상수) if left == right: return A[left] m = (left + right) // 2 # 아래 2줄의 수행시간: 2T(n/2) L = max_sum(A, left, m) # 수행시간: T(n/2) R = max_sum(A, m + 1, right) # 수행시간: T(n/2) # 아래 14줄의 수행시간: O(n) ...
shinyewon/Assignment
Algorithm/최대 구간 합.py
최대 구간 합.py
py
1,791
python
ko
code
0
github-code
36
7749021941
import sys import os from Bio.Blast import NCBIWWW from Bio.Blast.Applications import NcbiblastxCommandline from Bio.Blast import NCBIXML from Bio import SeqIO E_VALUE_THRESH = 10 RESULTS_XML = "results.xml" PROT_DB = "swissprot" NUC_DB = "nt" if len (sys.argv) != 5: print("Invalid params: 1) In file path - 2) O...
jpalacci/bio
src/ex2.py
ex2.py
py
1,987
python
en
code
0
github-code
36
20233922637
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: """ 思路一:dfs+深度优先计算 """ def rob(self, root) -> int: def dfs(root): if not root: return...
geroge-gao/Algorithm
LeetCode/python/337_打家劫舍3.py
337_打家劫舍3.py
py
654
python
en
code
26
github-code
36
3300025718
from exif_service import ExifService from ai_service import AiService import base64 import os class ImageService: def __init__(self, app, initial_path, ai_enabled=True): self.directory = initial_path self.app = app self.ai_enabled = ai_enabled self.exif_service = ExifService() ...
tim0-12432/photo-analyzer
backend/image_service.py
image_service.py
py
2,127
python
en
code
0
github-code
36
28524876545
def divided_diff(x, y): n = len(x) coefficients = [] for i in range(n): coefficients.append(y[i]) for j in range(1, n): for i in range(n-1, j-1, -1): coefficients[i] = (coefficients[i] - coefficients[i-1]) / (x[i] - x[i-j]) return coefficients def newton_interpolation(...
umang27102001/AssignmentsMCA
assignmentNM/.py/assignment6A.py
assignment6A.py
py
898
python
en
code
0
github-code
36
22753766688
"""Deep_acsauto package definition""" from setuptools import setup, find_packages from __init__ import __version__ # Read long description from file with open("README.md", "r") as fh: LONG_DESCRIPTION = fh.read() setup( name="DeepACSA", version=__version__, description=( "Anatomical cross-se...
maxull/Sharples-Lab
DeepACSA/DeepACSA-main/setup.py
setup.py
py
1,552
python
en
code
2
github-code
36
8209880971
import os import shutil import tarfile from colcon_bundle.verb import logger from colcon_bundle.verb.utilities import \ update_shebang def create_workspace_overlay(install_base: str, workspace_staging_path: str, overlay_path: str): """ Create over...
rotu/colcon-bundle
colcon_bundle/verb/_overlay_utilities.py
_overlay_utilities.py
py
3,108
python
en
code
null
github-code
36
40706528029
import random # Shows the player what grades they could still possibly win (show them everytime before they make a choice) def showAvailableGrades(): print("Here are the remaining final grades that you could receive: ") for grades in originalPapers: print(grades, "%") # Shows the player what 'papers' they could s...
AlvinNgo123/GradeOrNoGrade
game.py
game.py
py
5,543
python
en
code
0
github-code
36
74713864745
from UM.Application import Application from UM.Logger import Logger from cura.CuraApplication import CuraApplication from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState from PyQt5.QtNetwork import QHttpMultiPart, QHttpPart, QNetworkRequest, QNetworkAccessManager, QNetworkReply from PyQt5.QtCore ...
criscola/G-Gen
misc/zip/Cura-master/cura/PrinterOutput/NetworkedPrinterOutputDevice.py
NetworkedPrinterOutputDevice.py
py
14,072
python
en
code
1
github-code
36
24304392906
import numpy import matplotlib import matplotlib.pyplot as plt from scipy.spatial import distance from copy import deepcopy filename1 = 'normal.txt' filename2 = 'unbalanced.txt' def readData(filename): xc = [] yc = [] coords = [xc, yc] with open(filename,'r') as f: for line in f: x, y = line.split() xc.ap...
nyuseinova/K-Means-Clustering
kMeans.py
kMeans.py
py
3,806
python
en
code
0
github-code
36
72514606824
import logging import os import sys import tempfile import warnings from contextlib import contextmanager from collections import defaultdict from datetime import datetime, timedelta, timezone from itertools import chain from subprocess import CalledProcessError from urllib.parse import urljoin, urlsplit, urlunsplit ...
ossobv/keystone-light
keystone_light/__init__.py
__init__.py
py
37,297
python
en
code
0
github-code
36
30540305178
#!/usr/bin/env python3 import requests import pandas as pd import json import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) # Our endpoint URL endpoint = "http://universities.hipolabs.com/search?country=Canada" def report_to_csv(api_url): # Making a GET request to the endpoint ...
samsheriff/seccomp-proj-api
main.py
main.py
py
1,463
python
en
code
0
github-code
36
25238456
#1110번 n = input().zfill(2) temp = str(n) count = 0 while True: a = str(sum(map(int, temp))).zfill(2) count += 1 if temp[1] + a[1] == n: break temp = temp[1] + a[1] print(count) # 다른 사람꺼 돚거. 이 사람은 몫과 나머지를 이용했다. # def main(): # init_num = int(input()) # cur_num = init_num # count = 0...
kmgyu/baekJoonPractice
etc/add cycle.py
add cycle.py
py
625
python
ko
code
0
github-code
36
37401395031
import numpy as np np.random.seed(1234) from functions import * # ------ NETWORK ARCH ------ # # Layers = 2 (1 hidden layer) # Epochs = 300 # LR = # SGD = BATCH # Loss = MSE (with added 1/2) # Hyper parameters numer_of_epoch = 300 learning_rate_1 = 0.01 learning_rate_2 = 0.1 # Data x = np.array([...
javiabellan/deep-learning
DL framework from sctrach --> javia repo/Python/nn.py
nn.py
py
1,302
python
en
code
31
github-code
36
4304799902
import os import pickle def save_data(data, path): with open(path, 'wb') as file: pickle.dump(data, file) def load_data(path): if not os.path.exists(path): raise Exception('File has not been found') with open(path, 'rb') as file: return pickle.load(file)
EgorDm/TextSummarization
datasets/utils.py
utils.py
py
295
python
en
code
0
github-code
36
25951213667
import streamlit as st import pickle import numpy as np import pandas as pd movies_data = pickle.load(open('./books/movies.pkl','rb')) similarities = pickle.load(open('./books/movie_similarities.pkl','rb')) movies_df = pd.DataFrame(movies_data) movies_title = movies_df['title'].values def recommend(movie): movi...
bheemisme/movie-recommendar-system
app.py
app.py
py
797
python
en
code
0
github-code
36
41610031938
import json with open("players.json", 'r') as file: data=json.load(file) p1=data['player'] d={} for wkr in p1: for k,v in wkr.items(): if k=="role" and v=="Wicket-keeper": print("There is one wicket-keeper in a BTeam:", k,v)
tangellamudimanisha/BTeam
wicket-keeper.py
wicket-keeper.py
py
270
python
en
code
0
github-code
36
72170811625
#Dazarus Chapman import math class Triangle: def __init__(self, base, height): self.set_base(base) self.set_height(height) def set_base(self, b): if b > 0: self.base = float(b) else: print("Base must be greater than 0.") def set_height(self, heig...
DAILYCODI/Fall-2023-Systems-Programming-Class
SPLabs/Lab4/triangle_dazarus_chapman.py
triangle_dazarus_chapman.py
py
1,578
python
en
code
0
github-code
36
74649258984
#!/usr/bin/env python # -*- coding: UTF-8 -*- from rocketmq.client import Producer,Message from utils.my_logger import logger import time import re def push(num): tt = re.findall('^\d{13}', str(time.time()).replace('.', ''))[0] print(type(tt)) producer = Producer('PID-001') producer.set_namesrv_addr('1...
iospeng/python
pycharm_demo/pythonProject2/test_cases/mqpush.py
mqpush.py
py
1,275
python
en
code
0
github-code
36
39263585193
'''Faça um programa que calcule o mostre a média aritmética de N notas.''' qnt_notas = int(input("Informe quantas notas deseja inserir: ")) contador = 1 soma = 0 while contador <= qnt_notas: nota = float(input("Informe a nota: ")) contador += 1 soma += nota media = soma / qnt_notas print(media)
jessica-lemes/exercicios-python
Ex. 24 EstruturaDeRepeticao.py
Ex. 24 EstruturaDeRepeticao.py
py
317
python
pt
code
0
github-code
36
1970589964
#!/usr/bin/env python3 import sys from enum import Enum class Layout: def __init__(self, filename): width = 0 self._data = [] with open(filename, 'r') as infile: for line in (line.rstrip() for line in infile.readlines()): if width == 0: widt...
koeleck/aoc
11/solve.py
solve.py
py
4,840
python
en
code
0
github-code
36
14992218159
import calendar from requests_html import HTMLSession c = calendar.TextCalendar(calendar.SUNDAY) url_list = [] for x in range(2020,2021): for y in range(1,13): for z in c.itermonthdays(x,y): if z != 0: if y < 10: month = '0'+str(y) else: ...
KJS89/Wuduplz
Web mining/data_mining/trending_word_getter.py
trending_word_getter.py
py
1,511
python
en
code
2
github-code
36
32577431418
#!/usr/bin/env python # Resequence back bone files for sequential load in PyMOL # Warning: Modifies file names! import os seq_orig_labeled = os.listdir(os.getcwd()) seq_zero_labeled = [] def reseq(): for so in seq_orig_labeled: if len(so.split('-')) == 3 and '-1.pdb' in so: so_ini = so.split...
mzhKU/PyEnzyme-Screening
res-seq.py
res-seq.py
py
694
python
en
code
4
github-code
36
74478447143
import random import pygame from pygame.locals import QUIT from pelota import* from Raqueta import* pygame.mixer.init() VENTANA_HORI = 1200 VENTANA_VERT = 600 FPS = 160 BLANCO = (255, 255, 255) NEGRO = (0, 0, 0) fondo= pygame.image.load("fondo.png") pantalla = pygame.display.set_mode((VENTA...
luis10dsn/Pong
Pong/main.py
main.py
py
2,513
python
es
code
0
github-code
36
37426403903
''' Obtención de la matriz identidad de 4 x 4 ''' #INICIO ''' Generación de la matriz de ceros ''' I = [[0 for k in range (4)] for j in range (4)] ''' Generación de los elementos de la diagonal principal transformandolos en unos ''' for k in range(4): I[k][k] = 1 ''' Despliegue de la matriz identidad ...
AlejandroPaniagua/AlexProjPy
matrizIdentidad.py
matrizIdentidad.py
py
436
python
es
code
0
github-code
36
36395547481
from selenium import webdriver from selenium.webdriver.common.keys import Keys from datetime import datetime import time class InstagramBot: def __init__(self, username, password): self.username = username self.password = password self.bot = webdriver.Firefox() self.cont =...
matheusleps/InstaBot
instabot.py
instabot.py
py
6,262
python
pt
code
0
github-code
36
27941619917
import gc import itertools import multiprocessing as mp from math import ceil import numpy as np import pandas as pd from scipy.sparse import csr_matrix from scipy.sparse import issparse from SEMITONES._utils import _chunk_indices from SEMITONES._utils import _linreg_get_beta from SEMITONES._utils import _permute fro...
ohlerlab/SEMITONES
src/SEMITONES/enrichment_scoring.py
enrichment_scoring.py
py
16,684
python
en
code
8
github-code
36
9645302628
''' Find sum of all primes below N. ''' from datetime import datetime import math import itertools def summationOfPrimes(N): sum = 0 #initialize prime number array, number corresponding to index is a prime if value is True (except first 2) primeArray = [True for i in range(N+1)] number = 2 ...
bikram-gill/code
solutions/projectEuler/python/P0010-SummationOfPrimes.py
P0010-SummationOfPrimes.py
py
1,217
python
en
code
1
github-code
36
27095189897
from django.urls import path from .views import register, login,home, task_edit,task_delete, filter_period_view,logout urlpatterns =[ path("register/", register, name='register'), path('', login, name='login'), path('logout/', logout, name='logout' ), path('home/', home, name='home'), path('task...
cavidanhasanli/Planner_project
planner_app/urls.py
urls.py
py
507
python
en
code
1
github-code
36
26579559940
''' Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit. ''' class Solution(): def maxProfit(self,prices): if not...
msencer/leetcode-solutions
easy/python/MaxProfit.py
MaxProfit.py
py
717
python
en
code
5
github-code
36
12366385422
#!/usr/bin/env ccp4-python """ Created on 2 Feb 2015 @author: jmht """ import logging import os import shutil import sys import uuid from ample.util import ample_util, mtz_util try: from mrbump.parsers import parse_shelxe except ImportError: mrbumpd = os.path.join(os.environ['CCP4'], "share", "mrbump", "inc...
rigdenlab/ample
ample/util/shelxe.py
shelxe.py
py
5,172
python
en
code
6
github-code
36
43380221313
import openai def interact_with_chatgpt_prova(user, system, API_KEY, maxContent, creativita): openai.api_key = API_KEY response = openai.ChatCompletion.create( model="gpt-3.5-turbo-16k", messages=[ {"role": "system", "content": system}, {"role": "user", "cont...
Rfusar/dashboard
dashboard/interazioneGPT/connGPT.py
connGPT.py
py
678
python
it
code
0
github-code
36