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
27253207979
import pandas as pd import numpy as np s1 = pd.Series([1, 2, 3], index=list('ABC')) s2 = pd.Series([4, 5, 6], index=list('BCD')) s1 + s2 df1 = pd.DataFrame(np.arange(1, 13).reshape(3, 4), index=list('abc'), columns=list('ABCD')) df1 - s1 df2 = pd.DataFrame(np.arange(1, 13).reshape(4, 3), index=list('bcde'), columns=li...
FunkyungJz/Some-thing-interesting-for-me
量化投资书/量化投资以Python为工具/ch11/05.py
05.py
py
1,379
python
en
code
null
github-code
13
6874596416
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import pdb import math import numpy as np class Conv_spa(nn.Module): def __init__(self, C_in, C_out, kernel_size, stride, padding, bias): super(Conv_spa, self).__init__() self.op = nn.Sequential( ...
lyuxianqiang/LFLL-DCU
MainNet_unrolling_all.py
MainNet_unrolling_all.py
py
10,304
python
en
code
5
github-code
13
43173787289
# Django from django.conf import settings from django.http import HttpResponse, Http404 from django.contrib.auth.decorators import login_required # Mapnik import mapnik from copy import deepcopy map_cache = None class MapCache(object): def __init__(self,mapfile,srs): self.map = mapnik.Map(1,1) m...
oluka/mapping_rapidsms
apps/Map/mapnik_engine.py
mapnik_engine.py
py
1,600
python
en
code
3
github-code
13
25339743644
#!/usr/bin/python3.4 import ev3dev.ev3 as ev3 from time import sleep from os import system import signal # Toggle debug output DEBUG = False # Set initial state state = "LINE" # TURN, LINE, STOP progress = "INIT" # INIT, EXEC, DONE direction = 'U' # U, D, L, R # Define inputs btn = ev3.Button...
mathiaslyngbye/ev3control
backup/kenil_pid_test.py
kenil_pid_test.py
py
6,713
python
en
code
0
github-code
13
546325586
import pandas as pd url_csv01 = "./data/all_url_title_text.csv" url_csv02 = "./data/all_url_bin.csv" def del_same_url_and_save(new_sub_csv, url_bin): post = pd.read_csv(new_sub_csv) img_bin = pd.read_csv(url_bin) print(len(post)) print(len(img_bin)) post.drop_duplicates(['url'], keep='first', inp...
Comprehensive-Design-Team-9/Web_Crawler
del_same_url.py
del_same_url.py
py
636
python
en
code
0
github-code
13
36949721866
#!/usr/bin/env python import pygame pygame.init() RES = (160, 120) FPS = 30 clock = pygame.Clock() screen = pygame.display.set_mode(RES, pygame.RESIZABLE) pygame.display._set_autoresize(False) # MAIN LOOP done = False i = 0 j = 0 while not done: for event in pygame.event.get(): if event.type == pygam...
pygame-community/pygame-ce
examples/resizing_new.py
resizing_new.py
py
1,115
python
en
code
517
github-code
13
74564377938
#!/usr/bin/env python # -*- coding: ISO-8859-1 -*- """ web server. __author__ = "Valentin Kuznetsov" """ from __future__ import print_function from builtins import str as newstr, bytes, map from future.utils import viewitems, viewvalues # system modules import collections import json import os import pprint import s...
dmwm/WMCore
src/python/WMCore/ReqMgr/Web/ReqMgrService.py
ReqMgrService.py
py
32,238
python
en
code
44
github-code
13
21928387763
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def hasPathSum(self, root: Optional[TreeNode], targetSum: int) -> bool: if not root: ...
dyabk/competitive-programming
LeetCode/path_sum.py
path_sum.py
py
854
python
en
code
0
github-code
13
31238902889
def homework_9(bag_size, items): # 請同學記得把檔案名稱改成自己的學號(ex.1104813.py) # depth first search / breadth first search + backtracking mount=len(items) visit={} #節點(價值,重量) for a in range(bag_size+1): visit[(0,a)]=0 ...
daniel880423/Member_System
file/hw9/1100415/hw9_s1100415_0.py
hw9_s1100415_0.py
py
1,035
python
en
code
0
github-code
13
31218023004
import boto3 ec2_resource = boto3.resource("ec2") x = ec2_resource.create_instances(ImageId = 'ami-0cff7528ff583bf9a', InstanceType = 't2.micro', MaxCount = 1, MinCount = 1,#change counts to add multiple TagSpecifications = [ { 'Resourc...
Dwood99/Python-99
code/Start_and_stop_ec2(In_progress).py
Start_and_stop_ec2(In_progress).py
py
1,689
python
en
code
0
github-code
13
17039587334
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayEbppIndustryGovHealthcodeQueryModel(object): def __init__(self): self._biz_info = None self._biz_type = None self._city_code = None @property def biz_info(s...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AlipayEbppIndustryGovHealthcodeQueryModel.py
AlipayEbppIndustryGovHealthcodeQueryModel.py
py
1,862
python
en
code
241
github-code
13
43262129572
def main(): ans = 0 if M % MOD9: kn = pow(K, N, MOD9-1) ans = pow(M, kn, MOD9) return print(ans) if __name__ == '__main__': N, K, M = map(int, input().split()) MOD9 = 998244353 main()
Shirohi-git/AtCoder
abc221-/abc228_e.py
abc228_e.py
py
227
python
en
code
2
github-code
13
33924399913
BOT_NAME = 'bbr' SPIDER_MODULES = ['bbr.spiders'] NEWSPIDER_MODULE = 'bbr.spiders' FEED_EXPORT_ENCODING = 'utf-8' LOG_LEVEL = 'ERROR' DOWNLOAD_DELAY = 0 USER_AGENT="Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36" ROBOTSTXT_OBEY = True ITEM_PIPELINES...
SimeonYS/bbr
bbr/settings.py
settings.py
py
362
python
en
code
0
github-code
13
72103051539
#!/usr/bin/env python """Batch parser that extracts and prints out results for given log files.""" import os, sys, glob import argparse, itertools # do some parallel computing #from joblib import Parallel, delayed ############### # Constants ############### BYTE_PER_GB = 1024*1024*1024.0 KB_PER_GB = 1024*1024.0 MS...
xvz/graph-processing
benchmark/parsers/batch-parser.py
batch-parser.py
py
10,947
python
en
code
23
github-code
13
14393294259
from flask import Flask, request, jsonify from flask_sqlalchemy import SQLAlchemy from flask_marshmallow import Marshmallow from sqlalchemy import create_engine, Column, Integer, String from sqlalchemy.orm import scoped_session, sessionmaker from sqlalchemy.ext.declarative import declarative_base # Flask app initial...
Yyrii/Flask_sqlalchemy-api
app.py
app.py
py
4,638
python
en
code
0
github-code
13
40201057613
from medienverwaltungweb.tests import * from medienverwaltungweb.tests.functional import * log = logging.getLogger(__name__) class TestPersonController(TestController): def setUp(self): TestController.setUp(self) self.bruce = model.Person() self.bruce.name = u"Bruce Schneier" meta....
dummy3k/medienverwaltung
medienverwaltungweb/medienverwaltungweb/tests/functional/test_person.py
test_person.py
py
4,970
python
en
code
4
github-code
13
30163188029
from htutil import file import json from pathlib import Path import toml import os def template_make(raw: str, cfg: dict) -> str: for d in cfg: raw = raw.replace(cfg[d], '${'+d+'}') return raw def main(): for dir_in in os.listdir('in'): path_in = Path('in') / dir_in raw = file.r...
117503445/goframe_template
script/template_make/main.py
main.py
py
587
python
en
code
1
github-code
13
851444214
#!/bin/python3.6 import subprocess, json,sys from socket import gethostname as hostname from os import listdir from logqueue import queuethis from etcdput import etcdput as put from etcdgetpy import etcdget as get from etcddel import etcddel as dels from os.path import getmtime def putzpool(leader,myhost): perfmon ...
YousefAllam221b/PaceDev
putzpool.py
putzpool.py
py
10,386
python
en
code
0
github-code
13
11071332753
from PyQt5.QtWidgets import QLabel, QVBoxLayout, QHBoxLayout, QFrame, QGroupBox, QSlider, QSpinBox, QTextEdit, QDockWidget, QGridLayout from PyQt5.QtCore import Qt from MainGUI.Layout.ImageInforShow import imageInfor from ImageProcessingAction.LabelModel.labelModel import imageShowManager def helpInforShow(var): ...
ChengLongDeng/MedicalImageProcessingTool
MainGUI/Layout/InformationShowManager.py
InformationShowManager.py
py
4,170
python
en
code
0
github-code
13
26535652986
from sklearn.cluster import KMeans import numpy as np from sklearn import datasets import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap iris = datasets.load_iris() ##------- wybieramy 2 pierwsze zmienne --------- X = iris.data[:, :2] y = iris.target kmeans = KMeans(n_clusters...
Ralfik555/Course_DS
jdsz2-materialy-python/ML/4_knn_kmeans/kmeans.py
kmeans.py
py
2,696
python
en
code
0
github-code
13
11159677732
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # python版本3.7 import re import urllib.request import urllib.error import urllib.parse from Crypto.Cipher import AES import base64 import codecs import requests import json headers = { # 请求头部 'User-Agent': 'Mozilla/5.0 (X11; Fedora; Linux x86_64) App...
Jinbo-He/PythonBIgQuiz
music163.py
music163.py
py
4,117
python
zh
code
0
github-code
13
10722512196
from charms.reactive import ( hook, when, only_once, is_state ) import os.path as path from charmhelpers.core import hookenv, host from charmhelpers.core.templating import render from shell import shell # ./lib/nginxlib import nginxlib # ./lib/wordpresslib.py import wordpresslib config = hookenv.con...
adam-stokes/juju-charm-wordpress-hhvm
reactive/wordpress.py
wordpress.py
py
1,349
python
en
code
0
github-code
13
18848050032
import datetime class Employee: def __init__(self, name, age, salary, employment_date): self.name = str(name) self.age = int(age) self.salary = int(salary) self.employment_date = int(employment_date) def get_working_years(self): return (datetime.date.today().year - self.employment_date) def __str__(self...
sarah-am/python
classes_task.py
classes_task.py
py
2,347
python
en
code
0
github-code
13
70696625299
import cv2 img = cv2.imread("Tut1_itachi_uchiha.jpg") # shows image height and width print(img.shape) w, h = 1000, 600 # resize image imgResize = cv2.resize(img, (w, h)) print(imgResize.shape) # crop image # h , w imgCropped = img[300:470, 1100:1280] # after cropped if we have to resize imag...
anant-harryfan/Python_basic_to_advance
PythonTuts/Python_other_tuts/murtaza_workshop/open-cv/Tut3_Crop_and_Resize_Images.py
Tut3_Crop_and_Resize_Images.py
py
663
python
en
code
0
github-code
13
16508287934
import sys import pandas as pd import sqlite3 from sqlalchemy import create_engine def load_data(messages_filepath, categories_filepath): """This function load the data from disk and return data frame merge and return a data frame Args: messages_filepath ([string]): Path to the message file ...
tmbothe/disaster-response-pipeline-project
data/process_data.py
process_data.py
py
2,933
python
en
code
0
github-code
13
11612162443
import os class BehaviourHandler: def build_speechlet_response(self, card_title, speech_output, reprompt_text, should_end_session): return { 'outputSpeech': { 'type': 'PlainText', 'text': speech_output }, 'card': { 'type'...
fibonascii/cloud-automation
lambda/alexa-skill-lod-rest/behaviour_handlers.py
behaviour_handlers.py
py
974
python
en
code
0
github-code
13
39279261866
import matplotlib.pyplot as plt import numpy as np from pyautocad import Autocad, APoint import math class Node: def __init__(self, x, y, fx, fy, s, disx, disy, dx, dy,mz): self.x = x self.y = y self.fx = fx self.fy = fy self.s = s self.disx=disx self.disy=disy self.dx =...
ShivamGautam98/AnalyseIT
AnalyseIT.py
AnalyseIT.py
py
14,540
python
en
code
1
github-code
13
809709057
from django.urls import path from books.views import BooksViewSet books_create_list = BooksViewSet.as_view({ "post": "create", "get": "list", } ) books_detail = BooksViewSet.as_view({ 'get': 'retrieve', 'put': 'update', 'patch': 'partial_update', 'delete': 'destroy' }) urlpatterns = [ path...
Adoniswalker/books_publisher
books/urls.py
urls.py
py
432
python
en
code
1
github-code
13
40961254112
import os from glob import glob from setuptools import setup package_name = 'turtlebot3_controller' setup( name=package_name, version='0.0.0', packages=[package_name], data_files=[ ('share/ament_index/resource_index/packages', ['resource/' + package_name]), ('share/' + pack...
ThomasMarcal/Projet-A4
ROS - Robot Operating System/turtlebot3_controller/setup.py
setup.py
py
1,272
python
en
code
0
github-code
13
15481907671
import string import random from core.utils import Generator class Main(Generator): name = 'Alphabet match upper case with lowercase' years = [4, 5] directions = 'Incercuiti bulina literei scrise de mana care corespunde cu litera scrisa de tipar' template = 'generators/alphabet_match_upper_lower.html'...
opencbsoft/kids-worksheet-generator
application/core/generators/alphabet_match_upper_lower.py
alphabet_match_upper_lower.py
py
1,173
python
en
code
1
github-code
13
25413274883
#!/usr/bin/env python3 ''' Purpose: Read a MGIReferences sample file, and for samples that have empty extracted text, locate their PDF and extract the text from it, and save that as their extracted text in the sample file. No changes to the text except for remov...
nidak21/MGIreferences
sdGetExtText.py
sdGetExtText.py
py
6,657
python
en
code
0
github-code
13
2089427942
''' Python utilities for the MDL ''' import subprocess #Function for serial port configuration using GPIO def gpioconfig(port,RSmode,duplex,resistors,bias): ''' MDL serial port configuration port - /dev/ttyMAXn RSmode - 'RS485' or 'RS232' duplex - 'full' or 'half' resistors - 1 or 0 bias - ...
dyacon/pyMDL
pymdl/utilities/__init__.py
__init__.py
py
1,330
python
en
code
0
github-code
13
10583180951
n=input("enter a string : ") letter = "T" res = len([ele for ele in n.split() if letter in ele]) print("Count of words that starts with T : " + str(res)) #other process ''' a=input("enter the string") def words(string): count=0 for word in string: if word[0]=='T': ...
Mrudula1807/Python-Programming-
count words begins with t.py
count words begins with t.py
py
603
python
en
code
0
github-code
13
1122833123
import numpy as np from flask import Flask,request ,jsonify ,render_template import pickle import sklearn from werkzeug.debug import console app = Flask(__name__) model = pickle.load(open('randomforest.h5' , 'rb')) @app.route('/') def home(): return render_template('Demo2.html') @app.route('/y...
SmartPracticeschool/llSPS-INT-2868-University-Admission-Prediction
app.py
app.py
py
669
python
en
code
0
github-code
13
41835046810
# from PIL import Image import argparse import os import sys import cv2 import numpy as np import math import json from PIL import Image, ImageDraw, ImageFont import matplotlib.pyplot as plt def draw_ocr_box_txt(image, boxes): h, w = image.height, image.width img_left = image.copy() im...
oszn/syntxt
draw/drboex.py
drboex.py
py
1,605
python
en
code
0
github-code
13
22556884739
import matplotlib.pyplot as plt import numpy as np import random class Data: def __init__(self): self.X = None self.Y = None self.dist_batches = None self.bin_labels = None def random_normal(self, size, distance, one_hot=False): """ Generate two groups of data points fr...
xiawang/TF_Related
data_generator.py
data_generator.py
py
4,297
python
en
code
0
github-code
13
38046943078
# AUTHOR: Marcin.Wolter@cern.ch # CREATED: 20 March 2008 # # 23 Nov 2010: cleaning up (Noel Dawe) from AthenaCommon.Logging import logging from AthenaCommon.AlgSequence import AlgSequence from AthenaCommon.SystemOfUnits import * from AthenaCommon.Constants import * from AthenaCommon.AppMgr import ToolSvc import ...
rushioda/PIXELVALID_athena
athena/Trigger/TrigAlgorithms/TrigTauDiscriminant/python/TrigTauDiscriGetter.py
TrigTauDiscriGetter.py
py
5,781
python
en
code
1
github-code
13
35988603500
import requests from bs4 import BeautifulSoup import re import numpy as np import pandas as pd url = 'https://www.tripadvisor.in/Hotels-g297667-Jaisalmer_Jaisalmer_District_Rajasthan-Hotels.html' resp = requests.get(url) html = resp.text soup = BeautifulSoup(html,'lxml') #print soup hotel_name = [app.contents[0] for ...
gauravr1993/data-analysis
Draft/trip.py
trip.py
py
1,299
python
en
code
0
github-code
13
23607483262
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/7/3 13:13 # @Author : xiezheng # @Site : # @File : process_txt.py import os txt_path = "./log.txt" for line in open(txt_path, 'r'): line = line.strip()
CN1Ember/feathernet_mine
quan_table/insightface_v2/insightface_data/process_txt.py
process_txt.py
py
232
python
en
code
1
github-code
13
23148905325
from __future__ import print_function # (at top of module) from PyQt5.QtCore import Qt from superqt import * from PyQt5.QtWidgets import ( QCheckBox, ) ORIENTATION = Qt.Horizontal class FeatureSlider: def __init__(self, parent, name, min, max, check_box_value_changed, slider_value_changed ,is_feature_slid...
Knightbomb8/Spotify-Testing
src/featureSlider.py
featureSlider.py
py
1,065
python
en
code
0
github-code
13
32799546821
import enum class AnswerForVApp(object): def __init__(self, type_msg, type_content, status): self.type_msg = type_msg self.type_content = type_content self.status = status self.display_str = None class MsgType(enum.Enum): INFO = 0 ANSWER = 1 NOTIF = 2 ...
EVOLVED-5G/ImmersionNetApp
src/python/network/msg/MsgUtils.py
MsgUtils.py
py
544
python
en
code
0
github-code
13
21672641389
import asyncio import json import sys import zmq import zmq.asyncio from distributed_algorithms.wave_algorithm import Wave __author__ = 'christopher@levire.com' zmq.asyncio.install() ctx = zmq.asyncio.Context() class Worker: def __init__(self, name): self.zmocket = ctx.socket(zmq.PULL) self...
christ0pher/distributed-algorithms-python
worker.py
worker.py
py
1,618
python
en
code
0
github-code
13
29636260156
# -*- coding: utf-8 -*- import jinja2 import json import os import re import webapp2 jinja_env = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.dirname(__file__))) def get_gradegroup_by_id(prob_id): if re.match('^(LV|EE|LT)\.[^\.]+\.[0-9]+\.[7-9].*',prob_id): return '9' else: ...
kapsitis/linen-tracer-682
problembase-reports-taskgroups.py
problembase-reports-taskgroups.py
py
7,498
python
en
code
0
github-code
13
74562955538
""" _InsertRunStreamDone_ Oracle implementation of InsertRunStreamDone Insert RunStreamDone record into Tier0 Data Service """ from WMCore.Database.DBFormatter import DBFormatter class InsertRunStreamDone(DBFormatter): def execute(self, binds, conn = None, transaction = False): sql = """MERGE INTO ru...
dmwm/T0
src/python/T0/WMBS/Oracle/T0DataSvc/InsertRunStreamDone.py
InsertRunStreamDone.py
py
670
python
en
code
6
github-code
13
74907143697
import cv2 as cv import numpy as np alpha = 0.3 beta = 80 imgpath = "../../resource/chapter3/1.jpg" img1 = cv.imread(imgpath) img2 = cv.imread(imgpath) def updateAlpah(x): global alpha, img1, img2 alpha = cv.getTrackbarPos("alpha", "image") alpha = alpha * 0.01 img1 = np.uint8(np.clip((alpha * img2 +...
codezzzsleep/records2.1
robot-and-vision/test/chapter3/demo12.py
demo12.py
py
742
python
en
code
0
github-code
13
13107388184
# -*- coding: utf-8 -*- """ Created on Tue Jul 26 15:10:00 2022 @author: intan """ from tensorflow.keras.layers import LSTM,Dense,Dropout,Embedding,Bidirectional from tensorflow.keras import Input,Sequential import matplotlib.pyplot as plt class ModelDevelopment: def simple_MD_model(self,input_shape,vocab_size,...
intan7/Multiclass-Article-Classification
Multiclass_Article_Classification_module.py
Multiclass_Article_Classification_module.py
py
1,093
python
en
code
0
github-code
13
28808560409
import numpy as np import matplotlib.pyplot as plotGraph from scipy.stats import multivariate_normal from mpl_toolkits.mplot3d import Axes3D np.random.seed(47) # Given parameters samples = 10000 features = 4 num_labels = 2 priors = [0.35, 0.65] matrix_mean = np.ones(shape=(num_labels, features)) matrix_mean[0, :] = [...
KashS28/ECE5644-Assignments
Assignment 1/q1b.py
q1b.py
py
2,891
python
en
code
0
github-code
13
70073819219
from controller import Supervisor MAXIMUM_TIME = 3*60*1000 SPENT_TIME = 0 EPS = 0.2 def getPoints(dist): poi_points = 0 for j in range(10): if dist < EPS*(j+1): poi_points += 1 return poi_points referee = Supervisor() timestep = int(referee.getBasicTimeStep()) robot_node = referee.ge...
cesc-folch/pal-webots-competition-organizer
controllers/contest_manager/contest_manager.py
contest_manager.py
py
1,949
python
en
code
0
github-code
13
2371531040
from system.core.load import Control import system.core.my_utils as my class Invest_guide(Control) : def _auto(self) : self.DB = self.db('stocks') self.bid = self.parm[0] try : self.snd = self.parm[1] except IndexError : self.snd = None self.board = 'h_'+self.bid+'_...
comphys/YHDOCU
apps/stocks/control/boards/invest_guide.py
invest_guide.py
py
22,401
python
ko
code
0
github-code
13
1290347407
import heapq import sys input = sys.stdin.readline heap = [] for _ in range(int(input())): k = int(input()) if k == 0: try: print(-1*heapq.heappop(heap)) except: print(0) else: heapq.heappush(heap,-k)
junhaalee/Algorithm
solved/백준/11279/11279.py
11279.py
py
263
python
en
code
0
github-code
13
42706902820
import datetime import requests from bs4 import BeautifulSoup # https://www.learncodewithmike.com/2020/02/python-beautifulsoup-web-scraper.html def crawl_stock_info(stockCodes, isAddName=True): result = [] for code in stockCodes: response = requests.get(f'https://invest.cnyes.com/twstock/TWS/{code}')...
YueLung/django_backend
apps/line/module/crawl.py
crawl.py
py
2,955
python
en
code
0
github-code
13
37973780458
include.block ( "AmdcMGM/AmdcMGM_jobOptions.py" ) #-------------------------------------------------------------- # AmdcMGM #-------------------------------------------------------------- from AmdcMGM.AmdcMGMConf import AmdcDumpGeoModel topSequence += AmdcDumpGeoModel( "AmdcDumpGeoModel00" ) theAmdcDumpGeoModel00 = t...
rushioda/PIXELVALID_athena
athena/MuonSpectrometer/Amdcsimrec/AmdcMGM/share/AmdcMGM_jobOptions.py
AmdcMGM_jobOptions.py
py
1,722
python
en
code
1
github-code
13
14903945028
# Python version 3.7.6 import os # Variable to hold command shlcmd = "" # Loop condition to check if command is not equals to exit and executes command while (shlcmd != "exit"): # Command from user is stored here shlcmd = input('/myshell:') # Result of execution of command is stored here stdout = os.popen(...
Gbolly007/AdvancedPython
Assignment1/Number1.py
Number1.py
py
536
python
en
code
0
github-code
13
13014852183
from functools import lru_cache import httpx import pandas as pd @lru_cache() def _code_id_map_em() -> dict: """ 东方财富-股票和市场代码 http://quote.eastmoney.com/center/gridlist.html#hs_a_board :return: 股票和市场代码 :rtype: dict """ url = "http://80.push2.eastmoney.com/api/qt/clist/get" params = { ...
albertandking/aklite
src/aklite/stock/stock_hist_em.py
stock_hist_em.py
py
6,725
python
en
code
1
github-code
13
34803066698
import asyncio, random import os, io, gettext import time from hangupsbot.utils import strip_quotes, text_to_segments from hangupsbot.commands import command import appdirs ### NOTAS ### @command.register def recuerda(bot, event, *args): """Guarda un mensaje en la libreta de notas\nUso: <bot> recuerda [nota]""" ...
Pyrus01/Hangupsfork
hangupsbot/commands/notas.py
notas.py
py
1,866
python
es
code
0
github-code
13
38850158445
import turtle as t def makeSquare(posX=228, posY=297, angle=0, cucolor="brown"): if cucolor == "blue": t.color("dodger blue") else: t.color("saddle brown") t.goto(posX,posY) t.begin_fill() for i in range(4): t.forward(100) t.right(90) t.end_fill() print("hi"...
LunaDEV-net/23-1_Python-course
pfd-airplane/fakeSky.py
fakeSky.py
py
605
python
de
code
1
github-code
13
32449443239
import os from flask import Flask, render_template from alexandria.extensions import db, migrate, bcrypt, login_manager from alexandria.models import users, documentlinks def create_app(config_setting='dev'): """An application factory, as explained here: http://flask.pocoo.org/docs/patterns/appfactories/...
ianblu1/alexandria
alexandria/app.py
app.py
py
2,115
python
en
code
0
github-code
13
35452354883
#! /usr/bin/python __author__ = "Isa Bostan" __email__ = "isabostan@gmail.com" __status__ = "Assignment" import cv2 import numpy as np source = cv2.imread("sample.jpg") cropping = False cv2.namedWindow("Window") x1, y1, x2, y2 = 0, 0, 0, 0 def mouse_cropping(event, x, y, flags, userdata): try: global x...
rockcastle/My-OpenCV-Assignments
Assignment_2_Create_a_Face_Annotation_Tool/assingment-mouse.py
assingment-mouse.py
py
1,849
python
en
code
1
github-code
13
39640300024
import asyncio import socket import sys import time from threading import Thread from textwrap import dedent from discord import Client, User from addresses import login_address from db import add_user, clear_users, get_users, remove_user from secrets import secrets if '--debug' in sys.argv: __DEBUG__ ...
ReticentIris/Maple-Alert
bot.py
bot.py
py
2,704
python
en
code
0
github-code
13
42441173856
import time is_error_now = False valArray = [] maxSize = 24 def AddValue(val): nowt = time.time() itm = (nowt, val) valArray.append(itm) if len(valArray) > maxSize: del(valArray[0]) def Length(): return len(valArray) def Get(idx): return valArray[idx] ...
yorkwoo/pico_display
pico_lcd/valarray.py
valarray.py
py
1,968
python
en
code
0
github-code
13
28638049383
import os import random import time import traceback from concurrent import futures from google.auth.exceptions import DefaultCredentialsError import grpc import google.oauth2.id_token import google.auth.transport.requests import google.auth.transport.grpc # import google.auth.credentials.Credentials # from google.a...
cc4i/boutique-on-cloudrun
demo/src/recommendationservice/recommendation_server.py
recommendation_server.py
py
5,115
python
en
code
1
github-code
13
32212187820
import heapq import sys INF=int(1e9) T=int(sys.stdin.readline()) def dij(start): distance = [INF] * (n + 1) que=[] heapq.heappush(que,[0,start]) distance[start]=0 while que: d,check=heapq.heappop(que) if distance[check]<d: continue for i in graph[check]: ...
BlueScreenMaker/333_Algorithm
백업/220604~230628/BackJoon/9370.py
9370.py
py
1,194
python
en
code
0
github-code
13
39660720004
import pandas as pd import numpy as np import config import process_survey as ps # Load survey data to memory hh = ps.load_data(config.household_file) person = ps.load_data(config.person_file) # Add household records to person file person_hh = ps.join_hh2per(person, hh) # Create instances of summary class perhh = ps...
psrc/travel-studies
2014/region/summary/scripts/household.py
household.py
py
818
python
en
code
5
github-code
13
31767509299
import os # os.environ['CUDA_LAUNCH_BLOCKING'] = '1' import gc import time import torch import numpy as np import torch.nn as nn import torch.backends.cudnn as cudnn import torch.utils.data as data from torch.optim import lr_scheduler from torch.utils.data import ConcatDataset from dataset import SynthText, TotalText,...
D641593/MixNet
train_mixNet.py
train_mixNet.py
py
14,341
python
en
code
26
github-code
13
12523090780
from json import dump, dumps from os import path as os_path from sys import path as sys_path from django.conf import settings # ------------------------------------------------------------------------------ current = os_path.dirname(os_path.realpath(__file__)) parent = os_path.dirname(current) parent_parent = os_pat...
abrahamprz/zenclick
chromebooks_report/management/commands/local_test.py
local_test.py
py
3,733
python
en
code
0
github-code
13
4927001451
''' Created on May 20, 2021 @author: mvelasco ''' import pdb import numpy as np from optimalTransports import Empirical_Measure, Probability_Measure, Optimal_Transport_Finder, Weighted_Voronoi_Diagram from optimalTransports import dist, two_d_uniform_density,two_d_uniform_sample_q from minEntropyDistFinder import norm...
mauricio-velasco/min-cross-entropy
Figures.py
Figures.py
py
3,397
python
en
code
0
github-code
13
37090946773
""" Compute dengue risk from vector suitability. Author: Jacopo Margutti (jmargutti@redcross.nl) Date: 22-03-2021 """ import pandas as pd import numpy as np import datetime from dateutil import relativedelta import logging def compute_risk(df, adm_divisions, num_months_ahead=3, correction_leadtime=None): # add N ...
rodekruis/IBF-dengue-model
mosquito_model/src/mosquito_model/compute_risk.py
compute_risk.py
py
4,013
python
en
code
1
github-code
13
29008362960
from pytube import YouTube url = input('Digite a url do Youtube: ') video = YouTube(url) #baixa vídeos video.streams.get_lowest_resolution().download( output_path = r"C:\Users\Kurumí\Desktop\SLA LSLSLSLSLSSLLSLSLSLSLS", filename = video.title ) #baixa áudios video.streams.filter(only_audio=True).firs...
antoniohenrick/python_intensivao_ufpa
baixar_videos_youtube.py
baixar_videos_youtube.py
py
464
python
en
code
0
github-code
13
21293413259
team_name = input() games_count = int(input()) w_game = 0 d_game = 0 l_game = 0 total_score = 0 if games_count == 0: print(f"{team_name} hasn't played any games during this season.") elif games_count != 0: for i in range(1, games_count + 1): result = input() if result == "W": w_g...
SJeliazkova/SoftUni
Programming-Basic-Python/Exams/Exam_6_7_July_2019/05. Football Tournament.py
05. Football Tournament.py
py
769
python
en
code
0
github-code
13
38661731819
import unittest from array import array class ArrayTests(unittest.TestCase): def test_array(self) -> None: """array is like list [] but only stores data of a single type, represented by a typecode. Array is used to store data more compactly. """ # array of signed integer...
damonallison/python-examples
tests/stdlib/test_array.py
test_array.py
py
494
python
en
code
0
github-code
13
31857032501
import rhinoscriptsyntax as rs def unlockCurves(): curves = rs.ObjectsByType(4) if not curves: print("0 Curves were found") return False intCount = rs.UnlockObjects(curves) print("Unlocked {} Curves").format(intCount) unlockCurves()
octav1an/rhino-macros
Lock_Unlock/UnlockCurves.py
UnlockCurves.py
py
245
python
en
code
0
github-code
13
28596456710
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 18 17:58:21 2021 @author: Dartoon """ import numpy as np import astropy.io.fits as pyfits import matplotlib.pyplot as plt from ID_list import ID_list import glob from tools import read_string_list, read_info, cal_oreination f = open("material/ID...
dartoon/my_code
projects/2021_dual_AGN/analyze/print_propose_table.py
print_propose_table.py
py
9,493
python
en
code
0
github-code
13
71970244497
#Code starts here #Function to compress string def compress(word): word=word.lower() mist=[] l=0 while(l<len(word)): m=word[l] j=0 while(l<len(word) and word[l]==m): j=j+1 l=l+1 mist.append(m) mist.append(str(j)) re...
bhattbhavesh91/GA_Sessions
python_guided_project/oct_batch_challenge/python/p4.py
p4.py
py
356
python
en
code
32
github-code
13
21550383682
import uuid; import re; import math; import copy; import os; import configparser; class lt2circuiTikz: lastASCfile = None; reIsHdr = re.compile(r'[\s]*Version 4[\s]+', flags=re.IGNORECASE); reIsSym = re.compile(r'[\s]*SymbolType[\s]+(.*)$', flags=re.IGNORECASE);# ASY file symbol type definit...
ckuhlmann/lt2circuitikz
lt2ti.py
lt2ti.py
py
97,776
python
en
code
80
github-code
13
17453285125
from pygame import * from random import randint # фонова музика mixer.init() mixer.music.load('the.trail.mp3') mixer.music.play() # шрифти і написи font.init() score_text = font.Font(None, 36) score = 0 lost_text = font.Font(None, 36) lost = 0 lose_text = font.Font(None, 36) win_text = font.Font(None, 36) win_wid...
KasopiDaNir/shooter.witcher
main.py
main.py
py
4,437
python
uk
code
0
github-code
13
17049688284
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class CarModel(object): def __init__(self): self._brand_name = None self._config_name = None self._engine_desc = None self._family_short_name = None self._gear_b...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/CarModel.py
CarModel.py
py
7,161
python
en
code
241
github-code
13
22245928917
from PyQt5 import QtWidgets, uic from mainwindow import Ui_MainWindow from login_screen import Ui_login_window from errorbox import Ui_errorbox from messagebox import Ui_messagebox from contract_insert import Ui_contract_insert from supplier_insert import Ui_supplier_insert from product_insert import Ui_product_insert ...
svyatoslavkorshunov/lab
lab8_python/lab8.py
lab8.py
py
23,644
python
en
code
0
github-code
13
37364390553
from django.db import models from tag.models import Tag from hemontika_api import LANGUAGE_CHOICES from hemontika_api.utils import COUNTRY_CHOICES, REGION_CHOICES, DISTRICT_CHOICES from django.conf import settings # create your models here def unique_user_path(instance, filename): return "videos/musics/_{}_{}".f...
Subhra264/hemontika
backend_server/src/music/models.py
models.py
py
1,229
python
en
code
0
github-code
13
9440092349
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from PIL import Image,ImageFile from glob import glob import os import cairosvg from tqdm import tqdm from utils import create_path, filetype from sys import argv def img_converter(path, old_name): if filetype(old_name) in ['ASCII', 'HTML', 'MS', 'PC', 'RIFF', 'exp...
piyushjaingoda/National-Flag-Recognition-using-Machine-Learning-Techniques
web_scraping/data_transformation.py
data_transformation.py
py
1,281
python
en
code
3
github-code
13
32054691015
import pygame import math import random pygame.init() sw = 800 # ширина экрана sh = 800 # высота экрана bg = pygame.image.load('starbg.png') # фон playerRocket = pygame.image.load('spaceRocket.png') # корабль star = pygame.image.load('star.png') # взрыв asteroid50 = pygame.image.load('ast...
Anastas20/Animation
Астероиды.py
Астероиды.py
py
12,925
python
en
code
0
github-code
13
28349834903
class Solution: def numSubarrayBoundedMax(self, nums: List[int], left: int, right: int) -> int: st=[0] n=len(nums) lefti=[-1]*n if nums[0]<left or nums[0]>right: lefti[0]=0 for i in range(1,n): if nums[i]>right or nums[i]<left: ...
saurabhjain17/leetcode-coding-questions
0795-number-of-subarrays-with-bounded-maximum/0795-number-of-subarrays-with-bounded-maximum.py
0795-number-of-subarrays-with-bounded-maximum.py
py
1,120
python
en
code
1
github-code
13
26522875674
from os import environ as env from dotenv import find_dotenv, load_dotenv owners_key = "owners" trucks_key = "trucks" loads_key = "loads" ALGORITHMS = ["RS256"] ENV_FILE = find_dotenv() if ENV_FILE: load_dotenv(ENV_FILE) CLIENT_ID = env.get("AUTH0_CLIENT_ID") CLIENT_SECRET = env.get("AUTH0_CLIENT_SECRET") DOMA...
chenste-osu/truckerapi
constants.py
constants.py
py
387
python
en
code
1
github-code
13
43083744812
# # @lc app=leetcode.cn id=1905 lang=python3 # # [1905] 统计子岛屿 # # @lc code=start class Solution: def countSubIslands(self, grid1: List[List[int]], grid2: List[List[int]]) -> int: # 得到矩阵的行和列 m, n = len(grid1), len(grid1[0]) directions = [(-1, 0), (1, 0), (0, -1), (0, 1)] # dfs,搜索一片岛...
Guo-xuejian/leetcode-practice
1905.统计子岛屿.py
1905.统计子岛屿.py
py
1,110
python
en
code
1
github-code
13
19057407356
#! /usr/bin/env python3 # https://www.searchenginejournal.com/seo-tasks-automate-with-python/351050/ # https://github.com/sethblack/python-seo-analyzer/ from seoanalyzer import analyze # output = analyze(site, sitemap) siteA = "https://www.google.com/" analysisA = analyze(siteA) print(analysisA)
jakewilliami/scripts
python/seo.py
seo.py
py
301
python
en
code
3
github-code
13
17038667354
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.GPSLocationInfo import GPSLocationInfo class AlipayCommerceTransportTaxiDrivermachineBindModel(object): def __init__(self): self._car_no = None self._city_cod...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AlipayCommerceTransportTaxiDrivermachineBindModel.py
AlipayCommerceTransportTaxiDrivermachineBindModel.py
py
5,377
python
en
code
241
github-code
13
73644147859
from collections import deque import sys li = [] li = deque(li) for _ in range(int(sys.stdin.readline())): n = list(sys.stdin.readline().split()) x = n[0] if x == 'push': li.append(n[1]) elif x == 'pop': if li: s = li.popleft() print(s) else: ...
tenedict/Algorithm
Algorithm/baekjun/S4/큐.py
큐.py
py
668
python
en
code
1
github-code
13
25176253517
import pandas as pd from matplotlib import pyplot as plt import seaborn as sns # Carreguem el dataset sencer rahan_csv = pd.read_csv('dataset/Rahan.csv', delimiter=';') rahan_csv = rahan_csv.iloc[:,:-2] abrasan_csv = pd.read_csv('dataset/TabrizPollution/Abrasan.csv', delimiter=';') bashumal_csv = pd.read_csv('dataset/...
1462731/APC-Practica1-Regressio
data_description.py
data_description.py
py
1,663
python
ca
code
0
github-code
13
5990853298
# coding: utf-8 # In[ ]: # Listing sheets of Excel spreadsheets with pandas # Import pandas import pandas as pd # Assign spreadsheet filename: file file = 'd.xlsx' # Load spreadsheet: xl xl = pd.ExcelFile(file) # Print sheet names print(xl.sheet_names) # In[ ]: # Importing sheets of Excel spreadsheets with pa...
IgorKnez/Python
Importing Excel files with Pandas.py
Importing Excel files with Pandas.py
py
1,328
python
en
code
0
github-code
13
73643783057
# Ejercicio 525: Calcular la suma de 2 números. Si la suma está entre 15 y 30, retornar 20. def calcular_suma(a, b): suma = a + b if suma in range(15, 31): return 20 return suma operando_1 = 13 operando_2 = 30 print(calcular_suma(operando_1, operando_2)) operando_1 = 13 operando_2 = 15 pri...
Fhernd/PythonEjercicios
Parte001/ex525_suma_numeros_enteros.py
ex525_suma_numeros_enteros.py
py
364
python
es
code
126
github-code
13
8115154472
#! /usr/bin/env python # -*- coding: utf-8 -*- """ change units per EM """ import os, sys, re import argparse from fontTools.ttLib import TTFont from fontTools.misc.transform import Transform from fontTools.pens.transformPen import TransformPen from fontTools.pens.t2CharStringPen import T2CharStringPen # https://www...
derwind/misc_scripts
change_upm.py
change_upm.py
py
12,265
python
en
code
0
github-code
13
71253496657
import sys import torch from segmentation_models_pytorch.utils.meter import AverageValueMeter from tqdm import tqdm as tqdm class SWEpoch: def __init__(self, model, loss, metrics, stage_name, device='cpu', verbose=True): """[summary] Args: model ([type]): [description] l...
CIVA-Lab/U-SE-ResNet-for-Cell-Tracking-Challenge
SW/train_codes/trainer.py
trainer.py
py
4,861
python
en
code
2
github-code
13
18235090394
from mongoengine import connect, disconnect from mongoengine.connection import _connections from multiprocessing import current_process from config import Config from db.models.results import Results import os import logging log = logging.getLogger(__name__) class Db: Results = None def __init__(self, createCl...
bcgov/OCWA
microservices/validateApi/db/db.py
db.py
py
1,288
python
en
code
10
github-code
13
21493565407
import os import sys from dataclasses import dataclass import numpy as np import pandas as pd from sklearn.compose import ColumnTransformer from sklearn.impute import SimpleImputer from sklearn.pipeline import Pipeline from sklearn.preprocessing import OrdinalEncoder from sklearn.preprocessing import StandardScaler ...
devkegovind/Credit_Card_Default_Prediction
src/components/data_transformation.py
data_transformation.py
py
4,534
python
en
code
0
github-code
13
18082088569
from guietta import _, Gui, Quit, ___, III, HS, VS, HSeparator, VSeparator, QFileDialog from guietta import Empty, Exceptions, P, PG import os import subprocess import re import cdio import pycdio import numpy as np import math from qtpy.QtGui import QFont from qtpy.QtWidgets import QComboBox from time import strfti...
zray007/Diagnostics-via-Disk
diagnostics_via_disk.py
diagnostics_via_disk.py
py
11,774
python
en
code
4
github-code
13
15872517293
import regex as re import numpy as np ALL_CELL_RE = re.compile( r""" \s+CELL\|\sVector\sa\s\[angstrom\]: \s+(?P<xx>[\s-]\d+\.\d+) \s+(?P<xy>[\s-]\d+\.\d+) \s+(?P<xz>[\s-]\d+\.\d+) \s+\|a\|\s+=\s+\S+ \n \s+CELL\|\sVector\sb\s\[angstrom\]: \s+(?P<yx>[\s-]\d+\.\d+) \s+(?P<yy>[\s...
ruihao69/cp2kdata
cp2kdata/block_parser/cells.py
cells.py
py
1,018
python
en
code
null
github-code
13
39031717302
# Dynamic programming solution ''' Algorithm : for cells in 1st row & column, path is unidirectional hence minimum path sum will be simply adding min sum till previous cell in same row/column to current cell weight. Then for each remaining cell, we will calculate minimum possible path from that cell by adding min ...
sarvesh10491/Leetcode
Pattern_Based/8_Minimum_Path_Sum.py
8_Minimum_Path_Sum.py
py
1,226
python
en
code
0
github-code
13
31141524883
import os import glob from clawpack.clawutil import data try: CLAW = os.environ['CLAW'] except: raise Exception("*** Must first set CLAW enviornment variable") # Scratch directory for storing topo and dtopo files: scratch_dir = os.path.join(CLAW, 'geoclaw', 'scratch') def make_setrun(config): """Passes t...
jpw37/tsunamibayes
tsunamibayes/setrun.py
setrun.py
py
12,657
python
en
code
9
github-code
13
26785040293
import numpy as np class LinearRegression: def __init__(self,learning_rate=0.01,n_iters=100): print(learning_rate) self.lr = learning_rate self.n_iters = n_iters self.weights=None self.bias=None def fit(self,X,y): m,n = X.shape self.weights = np.z...
NilayGaitonde/Algorithms
LinearRegression/linearRegression.py
linearRegression.py
py
725
python
en
code
1
github-code
13
19526236700
import pygame, pygame.font, pygame.event, pygame.draw, string from pygame.locals import * import numbers MAX_PASSWORD_LENGTH = 8 IB_RETURN = 0xC000 IB_BACKSPACE = 0xC001 IB_ESCAPE = 0xC002 IB_DELETE = 0XC03 IB_LARROW = 0XC04 IB_RARROW = 0XC05 def get_key(): ''' Return unicode char and handle bac...
teddysback/vnc_c2Py3
vnc_wrap/fun/input_box.py
input_box.py
py
4,604
python
en
code
0
github-code
13
29859952397
import datetime import os from collections import defaultdict from pathlib import Path from intelmq.lib.bot import OutputBot class FileOutputBot(OutputBot): """Write events to a file""" _file = None encoding_errors_mode = 'strict' file: str = "/opt/intelmq/var/lib/bots/file-output/events.txt" # TODO...
certtools/intelmq
intelmq/bots/outputs/file/output.py
output.py
py
4,058
python
en
code
856
github-code
13