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
71223086435
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2021/9/12 11:23 # @Author : 1823218990@qq.com # @File : thread_performance # @Software: Pycharm """ functinon pass: Starting tests non_threaded (1 iters) 0.000001 seconds threaded (1 threads) 0.000110 seconds Iterations complete non_threaded (2 iters) ...
FYPYTHON/PathOfStudy
python/thread_process/多线程实现/thread_performance.py
thread_performance.py
py
2,798
python
en
code
0
github-code
1
3861729203
#!/usr/bin/env python # coding: utf-8 # # Converting categorical columns to binary # In[ ]: import os import pandas as pd dir=os.getcwd() new_dir=dir[:-4]+'\data' df9=pd.read_csv(new_dir+"\DB_1.csv") df9['Winner']=(df9['Winner']==df9['Team1'])*1 df9['Toss_won']=(df9['Toss_won']==df9['Team1'])*1 df9['Decision']=(df9[...
pragalbh-dev/IPL-Winner-Prediction
src/categorical_to_binary.py
categorical_to_binary.py
py
386
python
en
code
0
github-code
1
27939278885
class Solution: def fourSum(self, nums: List[int], target: int) -> List[List[int]]: nums.sort() n = len(nums) res = [] for i in range(n-3): if i > 0 and nums[i] == nums[i-1]: continue if nums[i] + nums[i+1] + nums[i+2] + nums[i+3] > target: ...
yash-codes02/Leetcode-Solutions
4Sum.py
4Sum.py
py
1,480
python
en
code
0
github-code
1
73348033634
import rospy from geometry_msgs.msg import PoseStamped, Point from gazebo_msgs.msg import ModelStates, ModelState class RealStatesSubPub(object): def __init__(self, agent_names): self.agent_names = agent_names self.real_agent_pose_stamped_subs = {} self.all_agents_prev_pose_stamped = {} ...
krishna-bala/ballbot_clone
src/ballbot_real/src/ballbot_real/utils/real_state_sub_pub.py
real_state_sub_pub.py
py
4,001
python
en
code
0
github-code
1
43408204768
from user.serialize import serialize_user_basic def plustag_serialize(plustag): return { 'id': plustag.pk, 'user_receiver_plus': serialize_user_basic(plustag.user_receive_plus) if plustag.user_receive_plus else None, 'user_send_plus': serialize_user_basic(plustag.user_send_plus) if plustag....
tpvt99/new-social-network-backend
plustag/serialize.py
serialize.py
py
1,386
python
en
code
1
github-code
1
2736655443
''' https://www.codewars.com/kata/54d7660d2daf68c619000d95/python ''' import math import functools def convert_fracts(lst): lcm = lambda a, b : abs(a*b) // math.gcd(a, b) tmp_list = list(map(lambda x : x[1] ,list(lst))) lcm_num = functools.reduce(lcm,tmp_list) return list(map(lambda x : [x[0] * lcm_num...
SzybkiRabarbar/CodeWars
2022-03/2022-03-22Common Denominators.py
2022-03-22Common Denominators.py
py
2,125
python
en
code
0
github-code
1
4945479177
from django.contrib import admin from django.urls import path from .views import TopView, ClothingDetail, ClothingRegister, ClothingDelete, ClothingUpdate, ClothingList, signupfunc, loginfunc, logoutfunc, form, forecast urlpatterns = [ path('signup/', signupfunc, name='signup'), path('login/', loginfunc, name...
kibachi02/morningleader
morning/urls.py
urls.py
py
968
python
en
code
0
github-code
1
18263639584
from sqlalchemy.exc import InvalidRequestError import logging from multiprocessing import cpu_count, Pool from pathlib import Path from bitglitter.config.palettemodels import Palette from bitglitter.config.readmodels.streamread import StreamRead from bitglitter.read.process_state.videoframegenerator import video_fram...
MarkMichon1/BitGlitter-Python
bitglitter/read/process_state/framereadhandler.py
framereadhandler.py
py
11,681
python
en
code
10
github-code
1
25278056510
import numpy as np from . import utils def init(): _gaug2013night = "".join( [ "@article{gaug2013night," "title={Night Sky Background Analysis for the " "Cherenkov Telescope Array using the Atmoscope instrument}," "author={Gaug, Markus and others}," ...
cherenkov-plenoscope/photon_spectra
photon_spectra/nsb_la_palma_2013_benn.py
nsb_la_palma_2013_benn.py
py
2,712
python
en
code
0
github-code
1
30262927884
import random from logging import getLogger import torch logger = getLogger(__name__) def set_seed(seed: int = 0) -> None: # set seed random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed_all(seed) torch.backends.cudnn.deterministic = True logger.info("Finished setting up seed.")...
yiskw713/pytorch_template
src/libs/seed.py
seed.py
py
321
python
en
code
22
github-code
1
30405538314
# 84. Largest Rectangle in Histogram # Hard # Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram. # Input: heights = [2,1,5,6,2,3] # Output: 10 # Explanation: The above is a histogram where width of eac...
akarsh1995/advent-of-code
src/leetcode/lc_84.py
lc_84.py
py
1,064
python
en
code
0
github-code
1
74491954273
import os import signal import subprocess class ShellUtil(object): """ - run shell command. - see also `bage_util.SshUtil` """ @staticmethod def kill_processes(cmd): p = subprocess.Popen(['ps', '-ef'], stdout=subprocess.PIPE) out, _err = p.communicate() for line in out...
bage79/nlp4kor
bage_utils/shell_util.py
shell_util.py
py
999
python
en
code
50
github-code
1
21763797469
import streamlit as st # Function predicts house prices using the regression pipeline #Credit to Ulrike Riemenschneider for providing the format for this # page - link to repo at https://github.com/URiem/heritage-housing-PP5 def predict_price(X_live, features, sale_price_pipeline): # from live data, subset feat...
sonetto104/CI-PP5-Peter-Regan-Heritage-Housing-Project
src/machine_learning/predictive_analysis_ui.py
predictive_analysis_ui.py
py
1,409
python
en
code
0
github-code
1
41129675056
# -*- coding: utf-8 -*- import scrapy from jiandan.items import JiandanItem class ArticleSpider(scrapy.Spider): name = 'article' allowed_domain = 'i.jandan.net' start_urls = ['http://i.jandan.net/'] def parse(self, response): url_list = response.xpath("//h2[@class='thetitle']/a/@href").extrac...
xxllea/Spider-Work
jiandan/jiandan/spiders/article.py
article.py
py
1,352
python
en
code
0
github-code
1
75140687072
import sys import time import pyotp import pyperclip def run(token: str ='', _continue: bool=False): if token == '': with open('secret', 'r') as fin: token = fin.read().splitlines()[0] totp = pyotp.TOTP(token) if _continue: print('This program will continue copy totp code to clipboard,\npress Control+C to...
KunoiSayami/simple-totp-paste
totp.py
totp.py
py
803
python
en
code
1
github-code
1
26584511593
# pylint: disable=protected-access import logging from datetime import datetime from odoo import http, models, fields, SUPERUSER_ID, _ from odoo.http import request _logger = logging.getLogger(__name__) def get_invoice_values(data: dict) -> dict: """Prepares the values for the invoice creation. * Company: ...
calyx-servicios/account-invoicing
cx_api_invoice_payments/controllers/main.py
main.py
py
14,672
python
en
code
0
github-code
1
36972729466
# Import OpenCV2 for image processing import cv2 import os import time ##from twilio.rest import Client import RPi.GPIO as GPIO import RPi.GPIO as GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) IR=19 LASER=17 IN5=23 IN6=24 IN7=25 IN8=8 RED = 2 #Associate pin 23 to TRIG GREEN ...
9ightcor3/Camouflage-Multifunctional-Bot
face_recognition.py
face_recognition.py
py
5,321
python
en
code
0
github-code
1
9450769007
from datetime import datetime, timedelta from airflow import DAG from airflow.operators.bash import BashOperator default_args = { 'owner': 'airflow', 'depends_on_past': False, 'start_date': datetime(2023, 5, 6), 'retries': 0 } dag = DAG( 'workSample_bash', default_args=default_args, descri...
yyk722/riskThinkingWorkSample
airflow/dags/worksample_bash.py
worksample_bash.py
py
781
python
en
code
0
github-code
1
31478942286
from pygame import sprite, transform, image, font, event class Gui(sprite.Group): def __init__(self, rect_size): super().__init__() self.heart_sprites = sprite.Group() self.bomb_sprites = sprite.Group() self.rect_size = rect_size self.hp = 5 self.bomb = 5 se...
Rogozhin-Dmitry/lyceum_project_2
gui_file.py
gui_file.py
py
2,964
python
en
code
0
github-code
1
38748247827
#!/usr/bin/python3.2 import sys import os import re import subprocess import logging import optparse logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s') def main(): logging.info('Switching to master branch') for e in sys.argv: print (e) #output,_...
mikelemus27/lemus-code
antlr4/antlr4Test/antlr4.py
antlr4.py
py
868
python
en
code
0
github-code
1
33721404472
import sys,os,socket,time,select server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) server_socket.bind(("",8801)) server_socket.listen(5) nb_open = 0 # Create list of potential readers and place connection socket in # first position socket_list = [server_socket] first = True while first or nb_open ...
gando537/L2-Systeme-Python
TD/TD7/TD_7_4.py
TD_7_4.py
py
1,305
python
en
code
0
github-code
1
16675681390
""" 实现生成cookie 的脚本 1,创建gen_gsxt_cookies.py文件,在其中创建GenGsxtCookie的类 2,实现一个方法,用于把一套代理IP,User-Agent,Cookie绑定在一起的信息放到Redis的list中 随机获取一个User-Agent 随机获取一个代理IP 获取request的session对象 把User-Agent,通过请求头,设置给session对象 把代理IP,通过proxies,设置给session对象 使用session对象,发送请求,获取需要的cookie信息 把代理IP ,User-Agent,Cookie放到字典...
luopeixiong/python-test
爬虫项目/scrapy项目/dishonest_失信人/dishonest/spiders/get_gsxt_cookies.py
get_gsxt_cookies.py
py
5,913
python
zh
code
null
github-code
1
34744796145
from typing import * class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def inorderTraversal(self, root: Optional[TreeNode]) -> List[int]: # 如果为空 if not root: return [] ...
PorterZhang2021/LeetCode
7.二叉树/一刷归档/7.二叉树的递归遍历-中序-栈.py
7.二叉树的递归遍历-中序-栈.py
py
1,152
python
zh
code
0
github-code
1
36061801140
import math def encryption(s): s = s.replace(" ", "") L = len(s) rows = int(math.sqrt(L)) columns = rows if rows * rows >= L else rows + 1 result = "" for c in range(columns): result += s[c::columns] + " " return result
arfazkhan/HackerRank
Encryption.py
Encryption.py
py
271
python
en
code
0
github-code
1
72680595875
from .cart import Cart import json from django.shortcuts import render, HttpResponse, redirect, get_object_or_404 from django.contrib import messages from django.contrib.auth.models import User from django.http import HttpResponseRedirect from django.views.generic import View import time from math import ceil from .mod...
Fahad-CSE16/SellOrBuy
product/views.py
views.py
py
11,500
python
en
code
0
github-code
1
73376081633
import os import sys import pickle import argparse import numpy as np import matplotlib.pyplot as plt from scipy import stats from scipy.optimize import curve_fit from scipy.optimize import least_squares import math from matplotlib import cm from matplotlib.ticker import LinearLocator from mpl_toolkits.mplot3d import ...
zhaoxs1121/IRL
functions.py
functions.py
py
9,339
python
en
code
0
github-code
1
26579440946
# Needed for random.sample import random #Require users to login before accessing this page if not auth.is_logged_in(): redirect(auth.settings.login_url) def index(): """ Returns a list of all studies associated with the user """ studies = db((db.study.id == db.participant.study) & ( db....
Zaxim/qollate
controllers/user.py
user.py
py
22,774
python
en
code
0
github-code
1
35878967311
''' ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄ ▄▄▄▄ ▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌ ▄█░░░░▌ ▐░░░░░░░░░▌ ▐░░░░░░░░░▌ ▐░▌ ▐░█▀▀▀▀▀▀▀█░▌ ▀▀▀▀▀▀▀▀▀█░▌▐░▌ ▐░▌▐░░▌▐░░▌ ▐░█░█▀▀▀▀▀█░▌▐░█░█▀▀▀▀▀█░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ...
bksahu/Lazy100
Lazy100.py
Lazy100.py
py
7,191
python
en
code
1
github-code
1
19511514367
""" Created on Oct 19, 2017 @author: ionut """ import sqlite3 def get_config(): """Return dict of key-value from config table""" conn = sqlite3.connect("openexcavator.db") cursor = conn.cursor() cursor.execute("SELECT key,value FROM config") config = {} rows = cursor.fetchall() for row i...
BWiebe1/openexcavator
openexcavator/database.py
database.py
py
3,315
python
en
code
4
github-code
1
5934931034
from fastapi import APIRouter, status, Depends from fastapi.responses import JSONResponse from sqlalchemy.orm import Session from slugify import slugify from schemas import BlogRequest from schemas import BlogOut from models import Blog from database import db_dependency blog_router = APIRouter(prefix='/blog', tags=...
slvler/fast-api
routers/blog.py
blog.py
py
2,618
python
en
code
0
github-code
1
38425988516
import datetime from django.core.cache import cache from django.db.models import Q from common import keys, errors from social.models import Swiped, Friend from swiper import config from user.models import User def get_recd_list(user): now = datetime.datetime.now() max_brith_year = now.year - user.profile.m...
cy777/swiper
social/logic.py
logic.py
py
2,477
python
en
code
0
github-code
1
29370143691
"""ohmydog URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based...
bautimercado/oh-my-dog
ohmydog/ohmydog/urls.py
urls.py
py
2,566
python
es
code
0
github-code
1
8320557537
#! /usr/bin/env python3 import re from functools import partial DEFAULT_ENCODING = "utf-8" def pre_repl(self, p, match): string = match.group()[2:-1] # Rule: ${var} #print("Found: {0:s}".format(string)) if ":" in string: filename = string.split(":")[1] + ".html" self.create_pag...
lmlwci0m/gen-scripts
htmlgen.py
htmlgen.py
py
3,626
python
en
code
0
github-code
1
40550943081
class Matrix(object): def __init__(self, matrix_string): self.matrix = matrix_string.split('\n') for row_string in self.matrix: row_index = self.matrix.index(row_string) row_array = row_string.split(' ') for string_entry in row_array: col_index = row_array.index(string_entry) int_entry = int(strin...
noltron000/exercisms
matrix/matrix.py
matrix.py
py
636
python
en
code
0
github-code
1
41746158595
# nums = # nums = [12,28,83,4,25,26,25,2,25,25,25,12] nums = [5,1,3,5,10,7,4,9,2,8] target = 15 if sum(nums) < target: print(0) # nums.sort() l = 0 n = len(nums) r = n - 1 length = n mini_len = n pre = [nums[0]]*(n) for i in range(1,n): pre[i]= pre[i-1]+ nums[i] print(pre) while l < r: diff = pre[r] - pre...
aniketwattamwar/Leetcode
miniSizaSubarraySum.py
miniSizaSubarraySum.py
py
805
python
en
code
0
github-code
1
38895038351
from tkinter import * import math import random from definitions import * root = Tk() root.geometry("800x800+30+30") after_id = None stations = [] trains = [] stations_dict = {"Комсомольская":3, "Курская":6, "Таганская":8, "Павелецкая":11, "Добрынинская": 13, "Октябрьская":14, "Парк культуры":17, ...
lisa-356/case_metro
case_metro.py
case_metro.py
py
2,213
python
en
code
0
github-code
1
6047800825
#!/usr/bin/env python3 """Convert an HTTP url to the SSH equivalent and clone the repo.""" import sys import subprocess def is_ssh(uri): """Check if URI is a git SSH URI.""" return uri.split('@')[-1] == 'git' def to_ssh(uri): """convert a URI to an SSH URI.""" ssh_uri = uri.split('://')[-1].split('...
nick96/git-scripts
git_ssh_clone.py
git_ssh_clone.py
py
741
python
en
code
0
github-code
1
39999918194
'''Build the vocabulary for the yelp dataset''' import json from collections import Counter # stop words are words that occur very frequently, # and that don't seem to carry information # about the quality of the review. # we decide to keep 'not', for example, as negation is an important info. # I also keep ! which...
cbernet/maldives
yelp/yelp_vocabulary.py
yelp_vocabulary.py
py
2,865
python
en
code
3
github-code
1
33971192494
import attr from swh.core.utils import decode_with_escape from swh.storage import get_storage from swh.storage.tests.test_postgresql import db_transaction def headers_to_db(git_headers): return [[key, decode_with_escape(value)] for key, value in git_headers] def test_revision_extra_header_in_metadata(swh_stora...
SoftwareHeritage/swh-storage
swh/storage/tests/test_revision_bw_compat.py
test_revision_bw_compat.py
py
1,342
python
en
code
6
github-code
1
39202685667
import dash from dash.dependencies import Input, Output, State import dash_core_components as dcc import dash_bootstrap_components as dbc import dash_table import dash_html_components as html from app.models import Wineset from app.plotlydash.results import Result from app import mongo import math def get_log(value, ...
gmendonc/winescrapper
mvp/app/plotlydash/dashboard.py
dashboard.py
py
4,756
python
en
code
0
github-code
1
31900476143
def strtoint(word): integer = '' list_int = '1234567890' check = 0 for leter in word: if leter in list_int: integer += leter else: if leter == 'l': integer += '1' elif leter == 'o' or leter == 'O': integer += '0' ...
nanatkim/urisolutions
strings/1287.py
1287.py
py
762
python
en
code
0
github-code
1
5603732938
#!/usr/bin/env python3 from itertools import product, permutations, combinations, combinations_with_replacement import heapq from collections import deque, defaultdict, Counter import bisect import sys def input(): return sys.stdin.readline().rstrip() def is_prime(x): # 素数判定 LIMIT = int(x ** 0.5) for i...
yuu246/Atcoder_ABC
ABC/ABC297/D/main.py
main.py
py
1,276
python
en
code
0
github-code
1
16906652773
import amino from tabulate import tabulate from src.utils import Login from src.utils import Communities from src.utils import Chats from src.scripts.raid_box import RaidBox from src.scripts.activity_box import ActivityBox from src.scripts.profile_box import ProfileBox from src.scripts.chat_box import ChatBox...
TheCuteOwl/Amino-Boxes-But-Better
src/service.py
service.py
py
2,768
python
en
code
1
github-code
1
199318416
import socketserver import xmltodict import dicttoxml import json import xml.parsers.expat import ast HOSTNAME = 'localhost' PORT = 8182 class MyTCPHandler(socketserver.StreamRequestHandler): def handle(self): print(f'connection received: {self.client_address}') data = self.rfile.readline().st...
Vadim-212/python-itstep-dz
dz8_(20.02.20)/server.py
server.py
py
1,106
python
en
code
0
github-code
1
1926384493
import add_parent_path # PyFlakesIgnore import copy import logging import assertions from StringIO import StringIO class AssertTestingHelper(object): def __init__(self,b_raise_exception=True): self.b_raise_exception = b_raise_exception def install_hooks(self): self._orig_assert_logger ...
giltayar/Python-Exercises
tests/assert_testing_helper.py
assert_testing_helper.py
py
1,326
python
en
code
4
github-code
1
37440181439
# Author : Bryce Xu # Time : 2020/1/17 # Function: import torch import torch.nn as nn import torch.nn.functional as F class BasicConv(nn.Module): def __init__(self, in_planes, out_planes, kernel_size, stride=1, padding=0, dilation=1, groups=1, relu=True, bn=True, bias=False): super(BasicConv, self).__ini...
brycexu/SAA
Few-Shot Classification/SAAM.py
SAAM.py
py
3,960
python
en
code
1
github-code
1
38760269349
import streamlit as st from deta import Deta DETA_KEY="c05lph41_umJvMdPncrzTfw3dLRynCV8Fb8cQYEaq" deta=Deta(DETA_KEY) db=deta.Base("perlengkapan_db") st.title("Danbox") st.header("PERALATAN") st.subheader('Perlengkapan Laboratorium') from PIL import Image import streamlit as st pilihan = st.selectbox( 'Piliha...
erlandesvarapramedya/Deployment-Danbox
pages/3_Peralatan.py
3_Peralatan.py
py
3,968
python
en
code
0
github-code
1
32023785821
import pandas as pd import matplotlib import matplotlib.pyplot as plt from matplotlib import rcParams from matplotlib import style import datetime from os import path style.use('ggplot') rcParams.update({'font.size': 9}) fig, ax = plt.subplots(sharex=True, figsize=(8.5, 4.8)) fig_size = plt.rcParams["figure.figsize"] ...
nshahr/Data-Visualization
U.S._Natural_Gas_Exports_and_Re-Exports_by_Country.py
U.S._Natural_Gas_Exports_and_Re-Exports_by_Country.py
py
1,194
python
en
code
0
github-code
1
20496503504
""" Authors: Federico Vaggi License: MIT Source: https://bitbucket.org/FedericoV/numpy-tip-complex-modeling/ Source: https://github.com/numfocus/python-benchmarks/blob/master/arc_distance/arc_distance_python.py """ from parakeet import jit, testing_helpers import numpy as np from math import * n = 10 a = np.random...
iskandr/parakeet
test/algorithms/test_arc_distance.py
test_arc_distance.py
py
2,658
python
en
code
232
github-code
1
14921838958
from webium.driver import get_driver from webium.driver import close_driver from Login import loginpage from selenium.webdriver.support.ui import Select import time from creds import admin_login, admin_password import random from random import choice from string import digits from navigation_bar import Navigat...
6196511/GoDo-AutoTests-Python-with-Selenium
Tests Marketing Hub-Channels/test_GODO-327-341 Add new channel (Channel name only)-2channels same channel name.py
test_GODO-327-341 Add new channel (Channel name only)-2channels same channel name.py
py
4,374
python
en
code
0
github-code
1
42999625869
''' Problem 21 | Merge Two Sorted Lists https://leetcode.com/problems/merge-two-sorted-lists/ ''' class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Opt...
davijit868/Programming-Solutions
Data Structures/Linked Lists/Merge Two Sorted Lists.py
Merge Two Sorted Lists.py
py
1,019
python
en
code
2
github-code
1
70721287074
# -*- coding: utf-8 -*- """ Created on Wed May 8 14:10:24 2019 @author: iremn """ import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from tflearn.data_utils import image_preloader import numpy as np X, Y = image_preloader('dataset', image_shape=(256, 256), mode='fol...
iremnurk/Universite-BitirmeProjesi-DerinOgrenme-YuzTanima
03modelEgitim.py
03modelEgitim.py
py
2,661
python
en
code
0
github-code
1
16751302675
"""RedLogo PERSONAL GPU fan speed curve tuning project on Linux Ubuntu, GPU: GTX 1080 Ti""" import matplotlib.pyplot as plt import numpy as np old_profile_temperature = np.array([]) old_profile_fan_speed = np.array([]) new_profile_temperature = np.array([]) new_profile_fan_speed = np.array([]) fan_speed_curve_file_cu...
redlogo/Linux-Ubuntu-GPU-fan-speed-curve-control
GPU-fan-control-tune-curve.py
GPU-fan-control-tune-curve.py
py
1,777
python
en
code
1
github-code
1
42214484809
#!/usr/bin/env python # coding: utf-8 import copy import logging import numpy as np import os import pandas as pd import random import sys from tarquinia.experiments import get_results from tarquinia.model_selection import MeasureStratifiedKFold, \ FragmentStratifiedKFold, kfold_...
dariomalchiodi/JAS-Tarquinia-classification
experiments/JAS/experiments-with-dim-reduction.py
experiments-with-dim-reduction.py
py
6,585
python
en
code
0
github-code
1
70983117153
from django.http import JsonResponse class InvalidToken(BaseException): def __init__(self, message='Invalid token', code=401): self.message = message self.code = code super().__init__(self.message) def handleError(self): response = { 'result': False, ...
tranlong58/django_mysql_project
tts/exceptions/InvalidToken.py
InvalidToken.py
py
579
python
en
code
0
github-code
1
5344438377
from collections import UserDict from datetime import datetime import re import csv # ************************* CLASSES ************************* class Field (): def __init__(self, value) -> None: self.value = value def __str__(self) -> str: return str(self.value) def __repr__(s...
GievskiyIgor/GoIT_lesson_12
PhoneBook_classes.py
PhoneBook_classes.py
py
6,683
python
en
code
0
github-code
1
4693870026
from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager from time import sleep from itertools import product from string import ascii_uppercase from difflib import SequenceMatcher import json base_url = "https://www.oscaro.es/" browser = webdriver.Chrome(ChromeDriverManager().install()...
IllicLanthresh/random-stuff
matricula selenium database.py
matricula selenium database.py
py
3,786
python
en
code
0
github-code
1
37811907070
from micarraylib.arraycoords.core import micarray from micarraylib.arraycoords import array_shapes_raw from micarraylib.arraycoords.array_shapes_utils import _polar2cart import pytest import numpy as np def test_micarray_init(): arr = micarray(array_shapes_raw.cube2l_raw, "cartesian", None, "foo") assert arr...
micarraylib/micarraylib
tests/test_arraycoords_core.py
test_arraycoords_core.py
py
2,263
python
en
code
12
github-code
1
73176146915
# Demo of the bi-directional communication of generators in Python def generator(seq_len): x = 0 while x < seq_len: # Return our data values to the user of the generator as normal # But we can also receive values back from the user to modify our # generator sequence jump_size = ...
complexbear/tinkering
Dojo/SendYield/demo.py
demo.py
py
1,065
python
en
code
0
github-code
1
17780386462
"""fixed category model Revision ID: 35b0f0000908 Revises: 6cfa0419ad9a Create Date: 2021-10-08 11:51:06.628030 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '35b0f0000908' down_revision = '6cfa0419ad9a' branch_labels = None depends_on = None def upgrade():...
ywakili18/HIITdontQUIT
migrations/versions/35b0f0000908_fixed_category_model.py
35b0f0000908_fixed_category_model.py
py
872
python
en
code
2
github-code
1
14618555086
#!/usr/bin/env python3 import argparse import os import pickle import MultiProcess def main(): parser = argparse.ArgumentParser(description="Will test mulitple resolution and return the resolution that give a the file size closer to the goad file size"); parser.add_argument('outputDir', type=str, help='path ...
xmar/360Transformations
transformation/Scripts/client.py
client.py
py
2,600
python
en
code
68
github-code
1
70832737314
# Дано число. Вывести на экран название дня недели, который соответствует # этому номеру. #!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys if __name__ == '__main__': n = input("Number of the day of the week") n = int(n) if n == 1: print("Monday") elif n== 2: p...
hubieva-a/lab4
1.py
1.py
py
718
python
ru
code
0
github-code
1
1346226818
import torch.utils.data as data from PIL import Image import os import pickle as dill import numpy as np import torch from torch.utils.data import TensorDataset class GetDataset(): def __init__(self, data_root, unseen_index, val_split): with open(os.path.join(data_root, 'af_normal_data_processed.pkl'), 'r...
Neronjust2017/DANN_ECG
data_loader.py
data_loader.py
py
2,724
python
en
code
0
github-code
1
16705263320
#!/usr/bin/python3 """Square model""" from models.base import Base from models.rectangle import Rectangle class Square(Rectangle): """Square class inherits from Rectangle""" def __init__(self, size, x=0, y=0, id=None): self.size = size Rectangle.__init__(self, size, size, x, y, id) @prop...
triplee12/alx-higher_level_programming
0x0C-python-almost_a_circle/models/square.py
square.py
py
1,582
python
en
code
0
github-code
1
26728719706
import math import os import random import re import warnings from typing import Dict, List, Tuple, Union import cv2 import numpy as np import torch import torch.distributed as dist import torch.multiprocessing as mp import torch.optim as optim from torch import nn from torch.nn.parallel import DistributedDataParallel...
tattaka/unsupervised-hdr-imaging
unsupervised_hdr/core.py
core.py
py
15,835
python
en
code
8
github-code
1
12600495568
import shutil import subprocess import os, sys from utils import Platforms, fsl_assert, Stages, ShaderTarget, StageFlags, ShaderBinary, fsl_platform_assert import tempfile, struct fsl_basepath = os.path.dirname(__file__) _config = { Platforms.DIRECT3D11: ('FSL_COMPILER_FXC', 'fxc.exe'), Platforms.DIRECT3D12: ...
ConfettiFX/The-Forge
Common_3/Tools/ForgeShadingLanguage/compilers.py
compilers.py
py
9,468
python
en
code
4,045
github-code
1
21659920607
# from guardctl.misc.util import dget import yaml from guardctl.model.kinds.Pod import Pod from guardctl.model.kinds.Node import Node from guardctl.model.kinds.Service import Service from guardctl.model.kinds.PriorityClass import PriorityClass from guardctl.model.system.Scheduler import Scheduler # def test_dget_ok(): ...
afcarl/kubectl-val
tests/test_util.py
test_util.py
py
2,992
python
en
code
0
github-code
1
15779411139
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # # Import data provided by Towne et al. and perform Spectral-POD # # # # do it in Python and train yourself # # ...
licia13/project-polimi
projects/SpectralPOD/spod-python/old_py/towne_data2.py
towne_data2.py
py
4,981
python
en
code
0
github-code
1
2383138508
from flask_restful_swagger_2 import Schema class arg_set(Schema): type = "object" additionalProperties: True description = ( "Defines an object schema for a collection of uniquely named arguments" "(argument set) as input to processes.") class process_description(Schema): type = "obj...
bgoesswe/dataid_openeo
reference_back_end/gateway/_old/models.py
models.py
py
5,831
python
en
code
1
github-code
1
72921401315
from datetime import date from django.conf import settings from edc_sync_data_report.classes import ClientCollectSummaryData from edc_sync_data_report.classes.notification import Notification from edc_sync_data_report.classes.summary_data import SummaryData def send_sync_report(): sender = Notification() se...
botswana-harvard/edc-sync-data-report
edc_sync_data_report/tasks.py
tasks.py
py
884
python
en
code
0
github-code
1
28686394204
import math #Using the formula of combination and defining combination# def comb(n,k): return math.factorial(n)/(math.factorial(k)*math.factorial(n-k)) Run = True while Run: #Control-Flow run_or_stop = str(input("Still want to run in next calculation? (Y/N): ")) if run_or_stop == 'N': Run = Fals...
Kunvuthi/pythonlearningprojects
Python Projects/Statistics Calculator/binomial_distribution_calculator.py
binomial_distribution_calculator.py
py
701
python
en
code
1
github-code
1
32236134247
import os import requests class Join: def __init__(self): self.headers = None self.request = requests self.base_url = f"https://api.join.com/v1" self.response = None def create_headers(self): self.headers = { "Accept": "application/json", ...
AliyaKhabirova/Recruitment-
src/join.py
join.py
py
508
python
en
code
0
github-code
1
1905685024
import sys from pymongo import MongoClient from datetime import datetime, timedelta import numpy as np import pandas as pd import matplotlib.pyplot as plt import psycopg2 as pg2 from psycopg2.errors import UniqueViolation def run_pipe(print_count=1000): """ Converts a mongoDB open on localhost:27017 to a post...
Greenford/tdcj
src/pgpipe.py
pgpipe.py
py
9,224
python
en
code
0
github-code
1
19719510621
#!/usr/bin/env python3 import sys from functools import partial from simplifier import setUp from common import adbSetValue, adbGetValue, alternator """ adb -s __DEVICE__ shell settings put system accelerometer_rotation 0 adb -s __DEVICE__ shell settings get system user_rotation adb -s __DEVICE__ shell settings put sy...
qbalsdon/talos
python/flip.py
flip.py
py
1,904
python
en
code
4
github-code
1
8779484892
""" Merge the classified reviews with their original data as well as zip code and CBSA data """ import pandas as pd import code_reviews as cr import code_chains as cc def main(): data_directory = '../../Data/' crosswalks_directory = data_directory + 'crosswalks/' infile = data_directory + 'reviews_0to500...
roesler-stan/Yelp-Assimilation
scraping_cleaning/merge.py
merge.py
py
5,615
python
en
code
1
github-code
1
16803284319
#!/usr/bin/python import numpy as np import matplotlib.pyplot as plt from scipy.integrate import odeint def f(y, t, params): P, lamb = y # unpack current values of y r, M, alpha, z0, z1 = params # unpack parameters derivs = [P, -r*lamb] # list of dy/dt=f functions return derivs # Paramete...
oscarram/Optimal-Harvesting
Numerical_Solutions/InitialPythonSimulations/NumericalODE.py
NumericalODE.py
py
1,381
python
en
code
0
github-code
1
12414836968
string = input("Give me a phrase:") string_up = 0 string_lo = 0 for i in string: if i.isupper(): string_up += 1 if i.islower(): string_lo += 1 print("The number of uppercase letters in your phrase is:", string_up) print("The number of lowercase letters in your phrase is:", string_lo) ...
mahmednisar/ThinkPython
Programs/pytonbd/lowerupper.py
lowerupper.py
py
335
python
en
code
0
github-code
1
4914466088
from typing import List, Dict import networkx as nx def best_route(G: nx.Graph, start_node: int) -> List[int]: if G is None or start_node not in G.nodes: return None for node in G.nodes(): if 'depth' not in G.nodes[node]: G.nodes[node]['depth'] = 0 if 'full' not in G.nodes[...
andreza-vilar/Teoria-dos-Grafos
EP01/src/Q04.py
Q04.py
py
1,348
python
en
code
0
github-code
1
37712716186
# 假设'#'就像键盘的退格键,这意味着'a#bc#d'实际上是‘bd' # 您的任务是处理带有'#'符号的字符串 ''' 'abc#d##c' ==> 'ac' 'abc##d#####' ==> '' '#####' ==> '' '' ==> '' ''' def clean_string(s): li = list(s) time = li.count('#') for i in range(time): site = li.index('#') del li[site] if site -1<0: pass e...
fyp858585/codewars
codewars_code/codewars69.Backspaces in string6kyu.py
codewars69.Backspaces in string6kyu.py
py
699
python
en
code
0
github-code
1
29542314624
command = "" started = False while True: command = input("> ").lower() if command == 'start': if started: print('Car is already started') else: started = True print('Car started...') elif command == 'stop': if not star...
muktidj/python-with-mosh
mosh/card-game.py
card-game.py
py
702
python
en
code
0
github-code
1
20581426977
# mongoDB使用案例 import pymongo client = pymongo.MongoClient(host='127.0.0.1', port=27017, username="root", password="123456", authSource="test", authMechanism='SCRAM-SHA-1') # 获取数据库 db = client['test'] # 获取集合 # collection = db['aaa'] # 或 # collection = db.aaa for i in db.aaa.find({'by': '菜鸟教程'}): print("data = %s" ...
qugemingzizhemefeijin/python-study
ylspideraction/chapter04/_005mongodb.py
_005mongodb.py
py
1,207
python
zh
code
1
github-code
1
1058797528
import mtbot.protocol as p from hashlib import sha1 from base64 import b64encode from time import time # Class for seqnums # And Packetbuffer later class Seqnum: """docstring for Seqnum. Managing mt seqnums""" def __init__(self): self.seqs = {} self.next = p.seqnum_initial def pop(s...
Lejo1/mtmodule
mtbot/botpackage.py
botpackage.py
py
4,096
python
en
code
1
github-code
1
18857578139
# the open() function returns an object representing the file. # python assigns this object to file_object # the keyword with closes the file once access to it is no longer needed # this reads entire file: with open('goals.txt') as file_object: contents = file_object.read() print(contents.rstrip()) print('\n ~ ~ ~ ~ ...
bethanybeachbum/python_bigdata
MutinyVC/file_reader.py
file_reader.py
py
682
python
en
code
0
github-code
1
25088177569
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jul 2 18:44:36 2020 @author: czhang """ # this is to create B0 map from 3D phases of 3D fully sampled images. ## delete h5 variables import h5py import numpy as np import torch from fastMRI.data import transforms from training_utils import helpers fr...
chaopingzhang/qRIM
preprocess/B0mapping.py
B0mapping.py
py
1,945
python
en
code
5
github-code
1
7417438363
import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import torch import torch.nn as nn import torch.optim as optim from pathlib import Path from .model import EncoderModel, DecoderModel class Modelrunner(): def __init__(self, model_def, load_latest = False ): self...
REPLICA-Collective-Rep/DATECentral
model/modelrunner.py
modelrunner.py
py
7,009
python
en
code
0
github-code
1
37519609074
# -*- coding: utf-8 -*- from ucloud.core.typesystem import schema, fields from ucloud.services.vpc.schemas import models """ VPC API Schema """ """ API: UpdateSubnetAttribute 更新子网信息 """ class UpdateSubnetAttributeRequestSchema(schema.RequestSchema): """ UpdateSubnetAttribute - 更新子网信息 """ ...
yufeiminds/ucloud-sdk-python2
ucloud/services/vpc/schemas/apis.py
apis.py
py
15,298
python
en
code
null
github-code
1
71483145635
from i18nfield.strings import LazyI18nString from pretix.base.email import get_email_context from pretix.base.i18n import language from pretix.base.models import Event, InvoiceAddress, Order, User from pretix.base.services.mail import SendMailException, mail from pretix.base.services.tasks import ProfiledEventTask from...
bockstaller/pretix-batch-emailer
pretix_batch_emailer/tasks.py
tasks.py
py
2,256
python
en
code
0
github-code
1
74843208033
arr = [] for i in range(9): arr = arr + list(map(int, input().split())) print(max(arr)) print((arr.index(max(arr)) // 9 + 1), (arr.index(max(arr)) % 9 + 1)) arr1 = [] for i in range(9): arr1.append(list(map(int, input().split()))) maxN = -1 mi = 0 mj = 0 for i in range(len(arr1)): for j in range(len(arr...
ChungO5/Backjoon
2차원 배열/2566.py
2566.py
py
456
python
en
code
0
github-code
1
40797678122
from cx_Freeze import setup, Executable exe=Executable( script="client.py", ) includefiles=["config.txt"] includes=[] excludes=[] packages=['requests'] setup( version = "1.1", description = "No Description", author = "Name", name = "App name", options = {'build_exe': {'excludes':exc...
Ovsienko023/VTerminale
Application-VT/client/setup.py
setup.py
py
972
python
en
code
2
github-code
1
24589467623
import os import json g = { "max-processes": 128, "output-size": 16, "compile-time": 5000, "compile-memory": 256, "mem-bonus": { }, "time-bonus": { }, "enabled": ['.c', '.cpp', '.py'], } def loadConfig(): global g try: with open(os.path.dirname(__file__) + '/config....
taoky/OJSandbox
config.py
config.py
py
761
python
en
code
3
github-code
1
9927108927
# coding: utf-8 # In[89]: import tarfile import xml.etree.ElementTree as ET import tqdm import codecs # In[87]: members = [] tar = tarfile.open("unlabeled.tar.gz", "r:gz") outfile = codecs.open("unlabeled.txt", 'w', 'utf-8') for member in tar: f = tar.extractfile(member) if f is None: con...
peteykun/NLU-Assignment3
tar2txt.py
tar2txt.py
py
874
python
en
code
0
github-code
1
21402710703
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/11/30 14:47 # @Author : qingping.niu # @File : StartTime.py # @desc : import os,time,datetime import uiautomator2 as u2 def getdevices(): devices = [] result = os.popen("adb devices").readlines() result.reverse() try: for l...
nqping/MyToolkit
Quality/StartTime.py
StartTime.py
py
1,098
python
en
code
0
github-code
1
73631959395
"""Utility file to seed kindred database from Native-Land data""" from sqlalchemy import func from models import Tribe, Language, connect_to_db, db from routes import app import json def json_reader(file_path): """Opens & loads json files""" with open(file_path) as file: json_dict = json.load(file) return js...
bsmejkal/kindred-culture
seed.py
seed.py
py
1,824
python
en
code
0
github-code
1
31486116618
from numpy import linspace from xspec import * from cstat_deviation import * import matplotlib.pyplot as plt import numpy as np def compute_deviation(file_name): """ This function computes the cstat deviation from an xcm file Args: file_name (.xcm): xcm file Returns: the cstat d...
Lucas-Dfr/CrossCorrelationSearch-v1
model_selection/model_selection.py
model_selection.py
py
2,421
python
en
code
0
github-code
1
5216154869
import pygame import time import random pygame.init() white = (255, 255, 255) black = (0, 0, 0) red = (255, 0, 0) blue = (0, 0, 255) dis_width = 800 dis_height = 600 dis = pygame.display.set_mode((dis_width, dis_height)) pygame.display.set_caption('collect the trash') background = pygame.image.load("natureback...
evanse10/Shehacks2021
game.py
game.py
py
5,694
python
en
code
0
github-code
1
72357287713
import beneath from config import SUBREDDIT from generators import posts, comments with open("schemas/post.graphql", "r") as file: POSTS_SCHEMA = file.read() with open("schemas/comment.graphql", "r") as file: COMMENTS_SCHEMA = file.read() def make_table_name(subreddit, kind): name = subreddit.replace("...
beneath-hq/beneath
examples/reddit/main.py
main.py
py
1,323
python
en
code
75
github-code
1
39157907847
# http://localhost:3000/objects import requests url = "localhost:3000/objects" payload = "{\n \"id\": 5,\n \"item\": \"The Fiancés\",\n \"artist\": \"Pierre Auguste Renoir\",\n \"collection\": \"Wallraf–Richartz Museum, Cologne, Germany\",\n \"date\": \"1868\"\n }" headers = { ...
mustafaakgul/python-guide
src/32-restful_api/local_db_hitting.py
local_db_hitting.py
py
471
python
en
code
0
github-code
1
27689203044
import discord import yaml with open("data/users.yaml", "r") as ymlfile: users = yaml.load(ymlfile, Loader=yaml.BaseLoader) def find(ctx, typ): for i in users[typ]: if str(i) == str(ctx.message.author): return True return False async def check_admin(ctx): if find(...
Kattulel/DisneyBot
config/usercontrol.py
usercontrol.py
py
513
python
en
code
1
github-code
1
23885295653
from functools import partial from numbers import Number from typing import Iterable import numpy as np from ...mat_gen import zeros from ...node import Node from .base import ( _assemble_wout, _compute_error, _initialize_readout, _prepare_inputs_for_learning, _split_and_save_wout, readout_for...
reservoirpy/reservoirpy
reservoirpy/nodes/readouts/lms.py
lms.py
py
4,648
python
en
code
296
github-code
1
71509372195
import time import datetime def convert_mil(ms): """Converts a time in milliseconds from midnight format into a compatible time format of HH:MM:SS, currently the time provided in milliseconds is floored to avoid having times in the future. """ # Floor the results to avoid rounding errors for secon...
gnu-user/finance-research
scripts/util.py
util.py
py
2,825
python
en
code
1
github-code
1