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
19423963567
# -*- coding: utf-8 -*- """ Created on Tue Oct 23 19:44:34 2018 @author: whockei1 """ import numpy as np, matplotlib.pyplot as plt, random, json, pickle, datetime, copy, socket, math from scipy.stats import sem import matplotlib.colors as colors from scipy.ndimage import gaussian_filter as gauss # for smoothing ratem...
whock3/ratterdam
Beltway_Project/ratterdam_PermutationTests.py
ratterdam_PermutationTests.py
py
16,496
python
en
code
0
github-code
36
35603667971
import pika import ssl import json class Dev: def __init__(self): ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) ssl_context.set_ciphers('ECDHE+AESGCM:!ECDSA') url = f"amqps://ryanl:842684265santos@b-b86d75fd-5111-4c3c-b62c-b999e666760a.mq.us-east-1.amazonaws.com:5671" paramet...
ryanbsdeveloper/opensource-chat
modules/chat/dev.py
dev.py
py
993
python
en
code
2
github-code
36
26771615241
#!/usr/bin/python3 """ Display the id of a Github user using Github's API """ import requests import sys def get_hub(): """ Get the id of the user using their personal access token password """ req = requests.get("https://api.github.com/user", auth=(sys.argv[1], sys.argv[2])) print(...
Alouie412/holbertonschool-higher_level_programming
0x11-python-network_1/10-my_github.py
10-my_github.py
py
385
python
en
code
0
github-code
36
18832494510
from collections import defaultdict class Solution: def isAnagram(self, s: str, t: str) -> bool: history = defaultdict(int) for c in s: history[c] += 1 for c in t: history[c] -= 1 for v in history.values(): if v != 0: return Fal...
parkjuida/leetcode
python/valid_anagram.py
valid_anagram.py
py
434
python
en
code
0
github-code
36
6383195963
def process_basic_information(model, data): data["MinCoeff"] = model.MinCoeff data["MaxCoeff"] = model.MaxCoeff data["MinBound"] = model.MinBound data["MaxBound"] = model.MaxBound data["MinRHS"] = model.MinRHS data["MaxRHS"] = model.MaxRHS data["MaxQCCoeff"] = model.MaxQCCoeff data["Min...
Gurobi/gurobi-modelanalyzer
src/gurobi_modelanalyzer/basic_analyzer.py
basic_analyzer.py
py
1,218
python
en
code
11
github-code
36
39151761897
import io import json import logging from fdk import response def handler(ctx, data: io.BytesIO = None): name = "World" try: body = json.loads(data.getvalue()) name = body.get("name") except (Exception, ValueError) as ex: logging.getLogger().info('error parsing json payload: ' + s...
wlloyduw/SAAF
jupyter_workspace/platforms/oracle/hello_world/func.py
func.py
py
576
python
en
code
25
github-code
36
22460147801
import zipper import arcpy try: # Inputs dir = arcpy.GetParameterAsText(0) zipfile = arcpy.GetParameterAsText(1) mode = arcpy.GetParameterAsText(2) shape_zipper = zipper.ShapefileZipper() # Create Class Instance result = shape_zipper.zip_shapefile_directory(input_dir=dir, output_zipfile=zipfi...
igrasshoff/zip-shapefiles
ScriptToolZipDirShapefiles.py
ScriptToolZipDirShapefiles.py
py
613
python
en
code
3
github-code
36
11360707561
import sys sys.stdin = open('단조.txt') T = int(input()) for tc in range(1, T+1): N = int(input()) data = list(map(int, input().split())) tmp = [] lis = [] a = 2 result = -1 for i in range(len(data)): for j in range(1+i, len(data)): tmp.append(data[i]*data[j]) for ...
Jade-KR/TIL
04_algo/수업/0903/단조.py
단조.py
py
582
python
en
code
0
github-code
36
75001876582
# Given a list of student grades in the format: # records - "[name]: [grade]" # find the student with the highest avg grade # all students have different avgs # no spaces in names # each grade is an int # output = "John" def solution(records): # init gradebook dict {"student_name": {total: num, entries: num, "...
stkirk/algorithm-practice
assessments/db2_gradebook.py
db2_gradebook.py
py
2,002
python
en
code
0
github-code
36
10222533594
''' Created on Nov 04, 2015 5:49:26 PM @author: cx what I do: i parse the freebase dump lines readed by FreebaseDumpReader what's my input: what's my output: ''' import json class FreebaseDumpParserC(object): def __init__(self): self.TypeEdge = "<http://rdf.freebase.com/ns/type....
xiaozhuyfk/AMA
query_processor/FreebaseDumpParser.py
FreebaseDumpParser.py
py
6,212
python
en
code
0
github-code
36
39416108196
#genral tree implementation class Tree: Root=None toSearch=None locy=0 def __init__(self): self.Root=Node(int(input("enter the value of root node"))) def insert(self,value,i): if self.Root==None: self.Root=Node(value) return while True: p...
USAMAWIZARD/datastructure
Python/Tree/Linked List implementation/Binnary Tree/Binnary Search Tree/Binnary search Tree.py
Binnary search Tree.py
py
1,727
python
en
code
1
github-code
36
21491336327
import tensorflow as tf import random from tensorflow.contrib import rnn from tensorflow.examples.tutorials.mnist import input_data #from cell import ConvLSTMCell timesteps=28 batch_size=128 total_step=10000 class Minist(object): def __init__(self, timesteps=0, batch_size=0,total_step=0, learning_rate=1): ...
amaltarifa100/AutoNew
prepareNetwork.py
prepareNetwork.py
py
6,693
python
en
code
0
github-code
36
9411931518
# Primary game file import sys, pygame from pygame.locals import * display_surf = pygame.display.set_mode((800, 600)) pygame.display.set_caption('Hello Pygame World!') def run(): """This allows for the running of the game from outside the package""" print("Started trying to run") # main game loop whil...
mlansari/ShellShockClone
ShellShockClone/game.py
game.py
py
460
python
en
code
0
github-code
36
12369223367
"""Add viewed column to batch_job Revision ID: b23863a37642 Revises: 72a8672de06b Create Date: 2018-12-31 17:13:54.564192 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'b23863a37642' down_revision = '72a8672de06b' branch_labels = None depends_on = None def ...
golharam/NGS360-FlaskApp
migrations/versions/b23863a37642_add_viewed_column_to_batch_job.py
b23863a37642_add_viewed_column_to_batch_job.py
py
802
python
en
code
3
github-code
36
39112326593
import torch from torch.utils.data import TensorDataset, DataLoader, RandomSampler from transformers import AutoTokenizer from sklearn.model_selection import train_test_split ''' Read the data from a pre-processed CADEC dataset and process them into a format compatible with BERT ''' class DataProcessor(): """ ...
allepalma/Text-mining-project
bert_data_creation.py
bert_data_creation.py
py
10,521
python
en
code
0
github-code
36
3146953868
from setuptools import setup, find_packages from os import path DIR = path.abspath(path.dirname(__file__)) description = """SharePy will handle authentication for your SharePoint Online/O365 site, allowing you to make straightforward HTTP requests from Python. It extends the commonly used Requests module, meaning tha...
JonathanHolvey/sharepy
setup.py
setup.py
py
1,452
python
en
code
165
github-code
36
30695862500
def solve(feet): # 1 foot = 12 inch inch = feet * 12 # 1 mile = 5280 feet mile = feet / 5280 # 1 mile = 3 yard yard = mile * 3 print(inch) print(mile) print(yard) solve(int(input("Enter foot to convert to inch, yard and mile: ")))
nooruddin-rahmani/python-tasks
15-Distance_Units.py
15-Distance_Units.py
py
276
python
en
code
1
github-code
36
27768921922
import pandas as pd from bs4 import BeautifulSoup import requests import random import time url='https://www.tianyancha.com/search?base=bj' headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36'} response = requests.get(url,headers=heade...
kshsky/PycharmProjects
case/crawler/TianYanCha.py
TianYanCha.py
py
3,711
python
en
code
0
github-code
36
2791422043
import numpy as np GRAV = -9.8 R_COEF_TABLE = np.array([0.73, 0.73, -0.92]) # restitution coefficient of table class Tracker: prediction = None def __init__(self, dt): raise NotImplementedError() def update(self, z_measured, dt): raise NotImplementedError() def get_state(self, dt=...
carlos-cardoso/robot-skills
kalman_tracker/src/python_tracker.py
python_tracker.py
py
7,735
python
en
code
23
github-code
36
39430381428
import unittest from helpers import FakeReader, a_wait import grole class TestEncoding(unittest.TestCase): def setUp(self): self.req = grole.Request() self.req.data = b'{"foo": "bar"}' def test_body(self): self.assertEqual(self.req.body(), '{"foo": "bar"}') def test_json(self): ...
witchard/grole
test/test_request.py
test_request.py
py
2,226
python
en
code
5
github-code
36
6817402374
from keras.applications.vgg16 import preprocess_input from keras.preprocessing.image import ImageDataGenerator # models from keras.applications.vgg16 import VGG16 from keras.models import Model # clustering and dimension reduction # from sklearn.cluster import KMeans from sklearn.decomposition import PCA ...
AnmolGarg98/KNN_image-classification
KNN_VGG16_pretrained_features.py
KNN_VGG16_pretrained_features.py
py
6,453
python
en
code
0
github-code
36
73349078504
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.Create...
IlyaSergeev/taxi_service
TaxiService/migrations/0001_initial.py
0001_initial.py
py
1,872
python
en
code
0
github-code
36
18050194084
# food restaurant delivery order ={ "client": "John Doe", "item": "Salad", "quantity":8, "price":15.00 } order["total"]=order["price"]*order["quantity"] if order["quantity"]>7: order["price"]*=0.8 #offer 20% discount for orders from 8 pcs order["total"]=order["price"]*order["quantity"] print ...
jvasea1990/dictionaries
food restaurant delivery.py
food restaurant delivery.py
py
895
python
en
code
0
github-code
36
9360337388
import fire from flask import Flask, jsonify, request from flask_cors import CORS from flask_restful import Resource, Api from graph_knn import load_entity_knn, load_multi_knn class Knn(Resource): def __init__(self, **kwargs): self.knn = kwargs['knn'] def post(self): json_data = request.get_...
graph-embeddings/pbg-helper
knn-graph-viewer/back/api.py
api.py
py
4,457
python
en
code
21
github-code
36
36656977883
def read_polynomial(num_variables, degree): """ Reads a multilinear polynomial from the user. Args: num_variables (int): The number of variables in the polynomial. degree (int): The degree of the polynomial. Returns: A list containing the coefficients of the monomials in the po...
shivamsinoliyainfinity/Polynomial_restrictor
trial2.py
trial2.py
py
2,771
python
en
code
0
github-code
36
10579988765
#a = 4678678678 #b = 4678678678 #import numpy as np #a = np.int64(a) #b = np.int64(b) #c = a + b #print(2**32 - 1) def shuffle_seed(array): import numpy as np a = np.random.randint(0,4294967296, dtype=np.int64) np.random.seed(a) shuffle_seed = np.random.permutation(array) return shuffle_seed, a ar...
lightarum/my_first_project
project_0/test.py
test.py
py
467
python
en
code
4
github-code
36
16490037129
#!/usr/bin/env python # coding: utf-8 # In[7]: import pandas as pd body_df = pd.read_csv('./body.csv') # In[8]: # Q1. 전체데이터의 수축기혈압(최고) - 이완기혈압(최저)의 평균을 구해보세요. # In[24]: result = (body_df['수축기혈압(최고) : mmHg']-body_df['이완기혈압(최저) : mmHg']).mean() print(result) # In[9]: # Q2. 50~59세의 신장평균을 구해보세요 # In[32]...
polkmn222/Statistic-Python
0622/대한민국 체력장 데이터.py
대한민국 체력장 데이터.py
py
3,145
python
ko
code
0
github-code
36
73118844584
import socket my_dict = {"python": "питон", "very": "очень", "like": "нравится"} class TcpServer: def __init__(self, host, port): self.host = host self.port = port self._socket = None self._runnning = False def run(self): self._socket = socket.socket(socket.AF_INET, ...
IlyaOrlov/PythonCourse2.0_September23
Practice/achernov/module_13/task_1_server.py
task_1_server.py
py
1,395
python
en
code
2
github-code
36
10256295781
import ast import json import cv2 from deepface import DeepFace from django.contrib.auth import login, logout from django.contrib.auth.decorators import login_required from django.contrib.auth.mixins import UserPassesTestMixin from django.db import connections from django.db.utils import ProgrammingError from django.h...
lekarus/SQLQueries
web_app/app/views.py
views.py
py
12,185
python
en
code
0
github-code
36
21414967137
from colour import Color import cv2 as cv2 import numpy as np a= input('enter a color=') b = Color(a) c = b.hsl d = tuple(255*x for x in c) print(d) print(list(d)) img = cv2.imread('color.png') hsl1 = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) green = np.uint8([[list(d)]]) hsv_green = cv2.cvtColor(green,cv2.COLOR_BGR2HSV) ...
DESK-webdev/team_webdev
img_pros/star_4.py
star_4.py
py
657
python
en
code
0
github-code
36
12982777466
import h5py import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.ndimage import gaussian_filter1d from scipy.ndimage.morphology import distance_transform_edt from scipy.stats import linregress from skimage.future import graph from skimage.measure import regionprops from sklearn.linear_model...
kreshuklab/drosophila_embryo_cells
scripts/predict_fate.py
predict_fate.py
py
8,815
python
en
code
0
github-code
36
25715720301
from functools import partial from typing import Dict, Callable from squirrel.driver.msgpack import MessagepackDriver from squirrel.serialization import MessagepackSerializer from squirrel.store import SquirrelStore from squirrel.iterstream import IterableSource, Composable import numpy as np N_SAMPLES = 2500 MAX_VA...
merantix-momentum/gnn-bvp-solver
gnn_bvp_solver/preprocessing/split_and_normalize.py
split_and_normalize.py
py
7,373
python
en
code
12
github-code
36
43362574911
from collections import deque def bfs_shortest_path(adj_matrix, src, dest): dist = [float('inf')] * n dist[src] = 0 q = deque() q.append(src) while q: curr = q.popleft() if curr == dest: return dist[dest] for neighbor in range(n): if adj_matrix[c...
slayzerg01/yandex-training-3.0
36/task36.py
task36.py
py
635
python
en
code
0
github-code
36
22356028668
import pickle import json import sys from sklearn.feature_extraction.text import CountVectorizer # Loading the saved model loaded_model = pickle.load(open('C:/Users/abhis/OneDrive/Desktop/UsingSpawn/logreg_model.pkl', 'rb')) # Loading the CountVectorizer vocabulary loaded_vec = CountVectorizer(vocabulary=pickle.loa...
abtyagi15/Automatic-Ticket-Classification
classify.py
classify.py
py
1,499
python
en
code
0
github-code
36
37012746527
from collections import deque from typing import List class Solution: @staticmethod def maxSlidingWindow(nums: List[int], k: int) -> List[int]: if not nums or len(nums) < k: raise ValueError() window = deque() res = [] for i in range(len(nums)): while w...
Manu87DS/Solutions-To-Problems
LeetCode/Python Solutions/Sliding Window Maximum/sliding.py
sliding.py
py
1,559
python
en
code
null
github-code
36
22292471973
''' 동빈나 럭키 스트레이트 입력예제 123402 답 LUCKY 7755 답 READY ''' s=input() n=len(s) left=s[:n//2] right=s[n//2:] left_sum=sum([int(i) for i in left]) right_sum=sum([int(i) for i in right]) if left_sum==right_sum: print('LUCKY') else: print('READY') # 답 n=input() x=len(n) summary=0 for i in range(x//2): summary...
98hyun/algorithm
implement/b_20.py
b_20.py
py
472
python
en
code
0
github-code
36
17952993717
# -*- coding: utf-8 -*- """ Created on Fri Jun 14 13:57:29 2019 @author: Witold Klimczyk # ICEM foil = Airfoil(filein = r'E:\propeller\mh_airofils\mh117/mh117.txt', t = 0.001, chord = 0.2) foil.runFluent(15,.2,1)# # XFOIL foil2 = Airfoil(ftype = 'XFOIL', filein = r'E:\AIRFOIL\airfoils/naca0012.txt', t = 0.001, chord ...
Witekklim/propellerDesign
airfoil.py
airfoil.py
py
30,685
python
en
code
1
github-code
36
41068970621
import matplotlib.pyplot as plt import random import matplotlib from matplotlib import font_manager import numpy as np # 设置图片大小及像素 plt.figure(figsize=(20, 8), dpi=80) # 设置中文 my_font = font_manager.FontProperties( fname='/System/Library/Fonts/Hiragino Sans GB.ttc') # 生成数据 x = range(0, 120) random.seed(10) # 生成随机种子...
XiongZhouR/python-of-learning
matplotlib/plot_1.py
plot_1.py
py
1,047
python
zh
code
1
github-code
36
72221051305
''' Problem :- Vaccine Production Platform :- Codechef Link :- https://www.codechef.com/DEC20B/problems/VACCINE1 Problem statement :- Increasing COVID cases have created panic amongst the people of Chefland, so the government is starting to push for production of a vaccine. It has to report to the media abou...
ELLIPSIS009/100-Days-Coding-Challenge
Day_4/Vaccine Production/vaccine.py
vaccine.py
py
1,216
python
en
code
0
github-code
36
10993947420
import sys, os, argparse, yaml from datasets.config.config import data_analysis_parameters import cv2 as cv import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.cbook as cbook def analysis_kitti(args): # Load the data flow_volume = [] masks = [] height,...
sushlokshah/new_approach
general_file/analysis.py
analysis.py
py
2,885
python
en
code
0
github-code
36
11352712717
import json import requests import random def filmes_assistidos_json(): with open('../DadosJSON/filmesAssistidos.json', 'r') as json_file: dados = json.load(json_file) return dados def preferencias_json(): with open('../DadosJSON/preferencias.json', 'r') as json_file: dados = json.load(...
CassioFig/Sistema-Recomendacao
backend/recomendacao.py
recomendacao.py
py
4,167
python
pt
code
1
github-code
36
72835791463
import sqlite3 import click from flask import current_app, g from flask.cli import with_appcontext def get_db(): if 'db' not in g: g.db = sqlite3.connect( current_app.config['DATABASE'], detect_types=sqlite3.PARSE_DECLTYPES ) g.db.row_factory = sqlite3.Row ...
yukoga/flask_sample_001
flaskr/db.py
db.py
py
794
python
en
code
0
github-code
36
70562902825
import configparser import os class AWSAnmeldung(): def __init__(self,benutzer,account): self.benutzer = benutzer self.account = account configName = "credentials" configPfad = os.path.join("/","home",self.benutzer,".aws",configName) self.config = configparser.ConfigParser(...
charlenebertz/fhb-ws1516-sysint
target/dist/fhb-ws1516-sysint-1.0.dev0/build/lib/config.py
config.py
py
911
python
de
code
0
github-code
36
32752270722
import tempfile import unittest import pytest from os import environ from os.path import join, isdir, getmtime from time import time from selenium.webdriver.common.timeouts import Timeouts from selenium.common.exceptions import TimeoutException from tbselenium import common as cm from tbselenium.test import TBB_PATH f...
webfp/tor-browser-selenium
tbselenium/test/test_tbdriver.py
test_tbdriver.py
py
5,565
python
en
code
483
github-code
36
29739664502
from random import randrange class Game: def init(self): self.distance = 230 self.shots = 0 self.running = True self.club = False self.choice = False def set_username(self): self.username = input('welcome to niggaboy golf. Enter your username: ') return s...
Syncxv/golf-uni-assignment
golf-game.py
golf-game.py
py
2,933
python
en
code
0
github-code
36
2999426198
''' deleteLater() # 在代码执行完之后删除对象 ''' ################################ # PyQt5中文网 - PyQt5全套视频教程 # # https://www.PyQt5.cn/ # # 主讲: 村长 # ################################ from PyQt5.Qt import * import sys class Window(QWidget): def __init__(self): super().__init__() ...
litteprience/pyqt5-210401
first/1.4对象删除.py
1.4对象删除.py
py
1,893
python
zh
code
0
github-code
36
37635067200
# Given the coordinates of two rectilinear rectangles in a 2D plane, return the total area covered by the two rectangles. # The first rectangle is defined by its bottom-left corner (ax1, ay1) and its top-right corner (ax2, ay2). # The second rectangle is defined by its bottom-left corner (bx1, by1) and its top-right ...
sunnyyeti/Leetcode-solutions
223. Rectangle Area.py
223. Rectangle Area.py
py
1,093
python
en
code
0
github-code
36
41924896443
import sys import sqlite3 from orders_management import* #menu for managing customer class order_menu(): def __init__(self): self.running = None self.active_detail = orders_manage() def run_menu(self,choice): if choice == 1: order_date = input("please enter th...
henrymlongroad/computing-coursework.exe
Implementation/order_menu.py
order_menu.py
py
3,649
python
en
code
0
github-code
36
7677909103
from controller import Robot, Motor, DistanceSensor import numpy as np from collections import deque # import opencv import cv2 as cv MAX_SPEED = 47.6 WHEEL_RADIUS = 21 INF = float('inf') class ChaseFoodState: def __init__(self, r): self.r=r def check_transition(self): if self.r.has_bum...
Polifack/Subsummed-Architecture-Webots
controllers/khepera4_controller/khepera4_controller.py
khepera4_controller.py
py
13,750
python
en
code
0
github-code
36
19389873266
import sqlite3 insert() def insert(cur,name,adress,phone,email): try: cur.execute(''' INSERT INTO Contact (name,adress,phone,email) VALUES (?,?,?,?) ''',(name,adress,phone,email)) print('Sucess: The contact:',(name,adress,phone,email),'has been added to the database') except: ...
Mysticboi/Contact_Database
test.py
test.py
py
1,625
python
en
code
0
github-code
36
28066573272
n = int(input()) data = list(map(int, input().split())) data.sort() rest = 0 sum = 0 if n == 1: print(data[0]) else: for i in range(n): sum += data[i] + rest rest += data[i] print(sum)
hwanginbeom/algorithm_study
1.algorithm_question/1.greedy/1. ATM_Seonyeong.py
1. ATM_Seonyeong.py
py
198
python
en
code
3
github-code
36
43041165646
import logging import os import snyk # Set up logger logger = logging.getLogger(__name__) logger.setLevel(os.getenv("LOG_LEVEL", default="INFO")) def get_org_admins(org): """ Returns a list of org admins :param org: the org object :return: a list of org admins """ logger.debug("Getting list ...
snyk-playground/snyk-org-slackbot
snyk_slackbot/api.py
api.py
py
4,589
python
en
code
0
github-code
36
16046372668
"""Pakcage Metadata.""" import pathlib from setuptools import setup # The directory containing this file HERE = pathlib.Path(__file__).parent # The text of the README file README = (HERE / "README.md").read_text() # This call to setup() does all the work setup( name="bank-of-england", version="0.0.1", de...
ronaldocpontes/bank-of-england
setup.py
setup.py
py
1,019
python
en
code
2
github-code
36
11602597643
import streamlit as st import time import re import chardet import pandas as pd import numpy as np import geopandas as gpd import matplotlib.pyplot as plt from matplotlib.patches import ConnectionPatch from functools import wraps from shapely.geometry import Point def main(): if 'run' not in st.session_state: ...
spiritdncyer/region-divsion-streamlit
demo-regionDiv.py
demo-regionDiv.py
py
21,686
python
en
code
0
github-code
36
74928155943
from tkinter import * master = Tk() cv_width = 300 cv_height = 300 def diagonal_square(i, a): # i = represents the squares position on a diagonal line; a = size of the square canvas.create_rectangle(i*a, i*a, a+i*a, a+i*a, fill = "purple") canvas = Canvas(width=cv_width, height=cv_height) canvas.pack() def di...
greenfox-zerda-lasers/tamasc
week-04/day-3/litte_squares.py
litte_squares.py
py
486
python
en
code
0
github-code
36
73087528423
# -*- coding: utf-8 -*- # @Author: ahmedkammorah # @Date: 2019-04-04 15:54:42 # @Last Modified by: Ahmed kammorah # @Last Modified time: 2019-04-08 22:58:45 from enum import Enum import json from MainService.main.email_provider_connector import RESPONSE_STATE from MainService.main.ak_ep_services import AKEmailSe...
AhmedKammorah/AKEmailService
MainService/main/ak_main_email_service.py
ak_main_email_service.py
py
5,942
python
en
code
0
github-code
36
955800912
pkgname = "python-snowballstemmer" pkgver = "2.2.0" pkgrel = 0 build_style = "python_module" hostmakedepends = ["python-setuptools"] depends = ["python"] pkgdesc = "Snowball stemming library collection for Python" maintainer = "q66 <q66@chimera-linux.org>" license = "BSD-3-Clause" url = "https://github.com/shibukawa/sn...
chimera-linux/cports
main/python-snowballstemmer/template.py
template.py
py
544
python
en
code
119
github-code
36
24938208176
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # filename: tietuku.py # modified: 2019-03-30 """ 贴图库 api 类 """ __all__ = [ "TietukuClient", ] import os import time from io import BytesIO from .base import BaseClient from .utils import get_links_cache_json, save_links_cache_json from ..utils.log import cout...
pkuyouth/pkuyouth-html-coder
htmlcoder/core/client/tietuku.py
tietuku.py
py
4,184
python
en
code
5
github-code
36
7870451227
from datetime import datetime import requests from bs4 import BeautifulSoup from uk_bin_collection.uk_bin_collection.common import * from uk_bin_collection.uk_bin_collection.get_bin_data import \ AbstractGetBinDataClass # import the wonderful Beautiful Soup and the URL grabber class CouncilClass(AbstractGetBinDa...
robbrad/UKBinCollectionData
uk_bin_collection/uk_bin_collection/councils/WiganBoroughCouncil.py
WiganBoroughCouncil.py
py
3,612
python
en
code
51
github-code
36
16442806200
# from utils.txt_file_ops import * from utils.Database_conn import * from object.base_class import * from loguru import logger from tabulate import tabulate from datetime import datetime class Subject: def __init__(self, sub_id='', sub_name=''): self.__sub_id = sub_id self.__sub_name = sub_name ...
thanhtugn/python_core_thanhtugn
Lesson_14/object/subject.py
subject.py
py
5,166
python
en
code
1
github-code
36
5877766545
# -*- coding:utf-8 -*- """ 说明: 这里实现了单篇文章和专栏的爬取。 article 根据article_id发起网络请求,返回的json文件中包含文章的基本信息和文章主体内容,解析文章的基本信息生成一个msg 字典对象,再将文章主体解析成BeautifulSoup对象,连同msg字典一起交给document模块下的Article解析并保存成markdown文件。 根据专栏id获得专栏下的文章所有文章id后,逐一看成是单一的文章,由article爬取。 """ from zhihu_spider.util import net, document from zhihu_spider....
Arlenelalala/ArxivPaper
zhihu_spider/article/__init__.py
__init__.py
py
4,672
python
en
code
7
github-code
36
70571115625
import unittest import logging import pdb import random def binary_search_recursive(l, value, low=0, high=None): """Return True if value is in sorted list l.""" if high is None: high = len(l) - 1 if high < low: return False middle = (low + high) / 2 #logging.warning("Searching fo...
charlax/IntroductionToAlgorithms
Chapter2/exercise-2.3-4.py
exercise-2.3-4.py
py
1,869
python
en
code
4
github-code
36
74289510182
import re # regex from animius.Utils import sentence_to_index class Parse: @staticmethod def cornell_cleanup(sentence): # clean up html tags sentence = re.sub(r'<.*?>', '', sentence.lower()) # clean up \n and \r return sentence.replace('\n', '').replace('\r', '') @stati...
gundamMC/animius
animius/Chatbot/ParseData.py
ParseData.py
py
4,106
python
en
code
16
github-code
36
43051538216
import numpy as np import networkx as nx import random as pr import matplotlib.pyplot as pl import pp import time import copy import sys import os import PIL from Tkinter import * import tkFileDialog import tkSimpleDialog import tkMessageBox from fomite_ABM import * from math import * from PIL import Image from PIL imp...
malhayashi/childcarefomites
fomite_ABM_GUI.py
fomite_ABM_GUI.py
py
23,870
python
en
code
0
github-code
36
19715634890
import networkx as nx from networkx.algorithms import isomorphism import argparse import pickle from tqdm import tqdm """get nx graphs from remapped_fp_file""" def get_single_subgraph_nx(frequent_subgraph_lines): ''' create graph from gSpan data format ''' graph_id = frequent_subgraph_lines[0].stri...
MikeWangWZHL/Schema_Composition
gSpan_official/gSpan6/filter_mined_graph.py
filter_mined_graph.py
py
4,396
python
en
code
1
github-code
36
2723556029
#!/usr/bin/python3 import images import os import time import random # Replace RPG starter project with this code when new instructions are live images.title() time.sleep(5) os.system("clear") steel_count = 0 iron_count = 0 tin_count = 0 pewter_count = 0 def showInstructions(): # print a main menu and the comma...
chadkellum/mycode
project2rpg.py
project2rpg.py
py
18,358
python
en
code
0
github-code
36
952551392
pkgname = "libice" pkgver = "1.1.1" pkgrel = 0 build_style = "gnu_configure" hostmakedepends = [ "pkgconf", "automake", "libtool", "xorg-util-macros", "xtrans", ] makedepends = ["xorgproto", "xtrans"] pkgdesc = "Inter Client Exchange (ICE) library for X" maintainer = "q66 <q66@chimera-linux.org>" li...
chimera-linux/cports
main/libice/template.py
template.py
py
641
python
en
code
119
github-code
36
15452563301
from base import VisBase from helper import get_heat_map import os import matplotlib.pyplot as plt from matplotlib.patches import Rectangle import torch import torch.nn.functional as F import math import numpy as np import matplotlib as mpl from mpl_toolkits.axes_grid1 import make_axes_locatable from mpl_toolkits.axes_...
hackerekcah/ESRelation
vis_proj/vis_proj.py
vis_proj.py
py
13,438
python
en
code
0
github-code
36
11045304899
from datetime import datetime, timedelta from functools import reduce from django import db from django.conf import settings from django.db import models from django.db.models import Sum from django.contrib.auth import get_user_model from jalali_date import date2jalali from dmo.models import DmoDay, Dmo User = get_us...
mohsen-hassani-org/teamche
todo_list/models.py
models.py
py
6,959
python
en
code
0
github-code
36
35048984657
import os # Directory containing the captured video files video_directory = "captured_video" # Function to rename files with sequential names def rename_files(directory): if not os.path.exists(directory): print(f"Directory '{directory}' does not exist.") return file_list = os.listdir(director...
LandonDoyle7599/CS5510-Assignment2
renameFiles.py
renameFiles.py
py
1,064
python
en
code
0
github-code
36
37738454658
__docformat__ = 'restructuredtext en' from collections import OrderedDict import six from six import string_types from geoid.util import isimplify from geoid.civick import GVid from geoid import parse_to_gvid from dateutil import parser from sqlalchemy import event from sqlalchemy import Column as SAColumn, Integer, U...
CivicSpleen/ambry
ambry/orm/partition.py
partition.py
py
48,749
python
en
code
5
github-code
36
10261032869
# from multiprocessing import Process, Queue from queue import Queue import threading from crawler.reviewCrawler import ReviewCrawler from crawler.userCrawler import UserCrawler import json from GameListCrawler import getGameList import time from utils.redisUtis import RedisUtil from utils.sqlUtils import dbconnector ...
Alex1997222/dataming-on-steam
SteamCrawler/main.py
main.py
py
4,442
python
en
code
2
github-code
36
31187142575
def reverse(L, a): n = len(L) if a < n//2: L[a], L[-1-a] = L[-1-a], L[a] reverse(L, a+1) L = list(input()) # 문자열을 입력받아 리스트로 변환 reverse(L, 0) print(''.join(str(x) for x in L)) #재귀적으로 리스트 뒤집기를 한다면 양끝단 -> 그다음 -> 그다음 -> ... -> 가운데 순으로 #reverse를 호출하고, 결과값은 역순으로 나온다. #재귀적 리스트 뒤집기의 바닥 조건은 a < n//2 이다. a가 n//2보다 크거나 같...
Ha3To/2022_2nd
python_workspace/Reverse_Str_Recursion.py
Reverse_Str_Recursion.py
py
543
python
ko
code
0
github-code
36
12485539130
num = int(input()) odd_sum = 0 max_odd = -999999999999999 min_odd = 999999999999999 even_sum = 0 max_even = -999999999999999 min_even = 999999999999999 for i in range(1, num + 1): in_num = float(input()) if i % 2 != 0: odd_sum += in_num if in_num > max_odd: max_odd ...
SimeonTsvetanov/Coding-Lessons
SoftUni Lessons/Python Development/Python Basics April 2019/Lessons and Problems/11 - For Loop Exercise/03. Odd Even Position .py
03. Odd Even Position .py
py
1,054
python
en
code
9
github-code
36
25947439528
import os import sqlite3 from datetime import datetime, timedelta import telebot bot = telebot.TeleBot(os.getenv("BOT_TOKEN")) memes_chat_id = int(os.getenv("MEMES_CHAT_ID")) flood_thread_id = int(os.getenv("FLOOD_THREAD_ID", 1)) memes_thread_id = int(os.getenv("MEMES_THREAD_ID", 1)) conn = sqlite3.connect("memes.db...
dzaytsev91/tachanbot
cron_job_memes_count.py
cron_job_memes_count.py
py
1,239
python
en
code
2
github-code
36
6084390921
# is unique: Implement an algorithm to determine # if a string has all unique characters. What if you # cannot use additional data structures? # since we check if characters in a string are not duplicated # we can use a boolean hash map to check if that character # already exists def is_unique(string): # ASCII -...
phuclinh9802/data_structures_algorithms
chapter 1/1_1.py
1_1.py
py
1,011
python
en
code
0
github-code
36
12573577450
def based(n, b, k): a = [0] * k if n < 0: return 0 if b <= 1: return 1 x = n counter = 0 while n >= b: q = n / b t = n - q * b a[counter] = t n = q counter += 1 a[counter] = n final_num = "" for i in range(counter): h = ...
AG-Systems/programming-problems
google-foobar/hey_i_already_did_that.py
hey_i_already_did_that.py
py
1,896
python
en
code
10
github-code
36
18903357112
from abc import ABCMeta from json import dumps from logging import getLogger from uchicagoldrtoolsuite import log_aware from ..materialsuite import MaterialSuite __author__ = "Brian Balsamo, Tyler Danstrom" __email__ = "balsamo@uchicago.edu, tdanstrom@uchicago.edu" __company__ = "The University of Chicago ...
uchicago-library/uchicagoldr-toolsuite
uchicagoldrtoolsuite/bit_level/lib/structures/abc/accessioncontainer.py
accessioncontainer.py
py
7,200
python
en
code
0
github-code
36
8757599845
# -*- coding: utf-8 -*- from odoo import models, fields, api, _ from odoo.exceptions import AccessError class OFSaleConfiguration(models.TransientModel): _inherit = 'sale.config.settings' of_deposit_product_categ_id_setting = fields.Many2one( 'product.category', string=u"(OF) Catégorie des a...
odof/openfire
of_sale/models/sale_config_settings.py
sale_config_settings.py
py
10,803
python
en
code
3
github-code
36
24801071982
import numpy as np from scipy import spatial import matplotlib.pyplot as plt def fft_smoothing(coords): #TODO: More relevant procedure required signal = coords[:,0] + 1j*coords[:,1] # FFT and frequencies fft = np.fft.fft(signal) freq = np.fft.fftfreq(signal.shape[-1]) # filter cu...
aron0093/cytopath
cytopath/plotting_functions/plot_alignment.py
plot_alignment.py
py
5,486
python
en
code
10
github-code
36
22365841878
from django import forms from .models import UserProfile class UserProfileForm(forms.ModelForm): class Meta: model = UserProfile exclude = ['user'] def __init__(self, *args, **kwargs): """ Add placeholders and classes, remove auto-generated labels and set autofocus on ...
folarin-ogungbemi/Gosip-Bookstore
profiles/forms.py
forms.py
py
1,120
python
en
code
1
github-code
36
23713128222
#!/usr/bin/env python # -*- coding:utf-8 -*- import yaml from yaml.loader import SafeLoader import subprocess import netifaces import argparse import os import time import fcntl '''yaml if_list: - ipaddr: 10.90.3.37 prefix: 24 mac: 52:54:84:11:00:00 gateway: 10.90.3.1 - ipaddr: 192.168.100.254 ...
adamxiao/adamxiao.github.io
openstack/asserts/kylin-vr.py
kylin-vr.py
py
7,510
python
en
code
0
github-code
36
15136620120
import time import warnings import mmcv import torch from mmcv.runner import RUNNERS, IterBasedRunner, IterLoader, get_host_info @RUNNERS.register_module() class MultiTaskIterBasedRunner(IterBasedRunner): def train(self, data_loader, **kwargs): self.model.train() self.mode = 'train' sel...
CVIU-CSU/PSSNet
mmseg/core/runners/multi_task_iterbased_runner.py
multi_task_iterbased_runner.py
py
3,324
python
en
code
1
github-code
36
43951125487
test_cases = int(input()) all_times = [] displayed_time = 0 for test in range(test_cases): current_time = int(input()) all_times.append(current_time) # even number of presses means watch is still running if test_cases % 2 != 0: print("still running") # odd number means we have to add up all the times # ...
EthanCloin/kattis_solutions
Stopwatch/stopwatch.py
stopwatch.py
py
648
python
en
code
0
github-code
36
26590188131
import imp from ecs import World, Entity from coolClasses import * def entityAtPos(world : World, x, y, *Components) -> list[Entity]: testPos = Posistion(x,y) entitys = [] for i in world.getView(Posistion, *Components): pos = i.getComponent(Posistion) if pos == testPos: entitys....
FisherSTA/BrokenSeal
helpers.py
helpers.py
py
348
python
en
code
0
github-code
36
6061528518
# -*- coding: utf-8 -*- """ Created on Thu Mar 12 16:12:53 2020 @author: Monik """ import os, tifffile import numpy as np import matplotlib.pyplot as plt import SOFI2_0_fromMatlab as sofi2 #%% helper functions def where_max(a): print(a.shape) return np.unravel_index(np.argmax(a, axis=None), a.shape) #%% rea...
pawlowska/SOFI2-Python-Warsaw
SOFI2_demo.py
SOFI2_demo.py
py
1,760
python
en
code
0
github-code
36
37977450402
import unittest import sys sys.path.insert(1, '..') import easy_gui class GUI(easy_gui.EasyGUI): def __init__(self): self.geometry('300x300') self.date = self.add_widget('date') self.add_widget(type='button', text='Print Date', command_func=self.print_date) def print_date(sel...
zachbateman/easy_gui
tests/test_datepicker.py
test_datepicker.py
py
519
python
en
code
1
github-code
36
37463181641
import Dataset as datos import matplotlib.pyplot as plt import numpy as np import os df_ventas = datos.get_df_ventas() resample_meses = datos.get_resample_meses() facturacion_por_juego = datos.get_facturacion_por_juego() cantidad_ventas_por_juego = datos.get_cantidad_ventas_por_juego() #--------------------...
matinoseda/CPT-datos-ventas
Estadísticas Juegos.py
Estadísticas Juegos.py
py
5,685
python
es
code
0
github-code
36
25796455279
import itertools import numpy as np import collections import tensorflow as tf from PIL import Image from keras.models import Model, load_model from keras import backend as K from integrations.diagnosis_nn.diagnosisNN import DiagnosisNN from neural_network.models import NeuralNetwork from neural_network.nn_manager.G...
AkaG/inz_retina
integrations/diagnosis_nn/DiagnosisQuery.py
DiagnosisQuery.py
py
1,527
python
en
code
0
github-code
36
75097728425
import h5py import numpy as np import os import matplotlib.pyplot as plt from imblearn.over_sampling import SMOTE import random # A simple example of what SMOTE data generation might look like... # Grab the data path=os.path.join(os.getcwd() , 'batch_train_223.h5') file = h5py.File(path, 'r') keys = file.keys() sampl...
emilyjcosta5/datachallenge2
train/testSMOTE.py
testSMOTE.py
py
2,466
python
en
code
1
github-code
36
34684043114
#!/usr/bin/env python3 from collections import deque def search(lines, pattern, history=5): previous_lines = deque(maxlen=history) for i in lines: if pattern in i: yield i, previous_lines previous_lines.append(i) if __name__ == '__main__': with open(r'somefile.txt') as f: ...
kelify/WorkProgram
CookBook-python3/c01/01.py
01.py
py
468
python
en
code
0
github-code
36
14061601965
import binascii import json import logging import cv2 import numpy as np import requests VIDEO_UPLOAD_URL = 'http://video-fs.like.video/upload_video.php' IMAGE_UPLOAD_URL = 'http://img-fs.like.video/FileuploadDownload/upload_img.php' logger = logging.getLogger(__name__) def upload_video(video_bytes): files = {...
ThreeBucks/model-deploy
src/utils/cdn_utils.py
cdn_utils.py
py
3,379
python
en
code
0
github-code
36
37943750143
import signal import sys import math import time class _Getch: """Gets a single character from standard input. Does not echo to the screen.""" def __init__(self): try: self.impl = _GetchWindows() except ImportError: self.impl = _GetchUnix() def __call__(self): ...
spectechular/RaspberryPi_16x2_write_message
lcd_test.py
lcd_test.py
py
1,636
python
en
code
0
github-code
36
6811793818
from random import random import numpy as np import time from math import * import os import sys sys.setrecursionlimit(10**6) clusters = [] visible_cells = [] class Cluster: def __init__(self,m,n): # Get the dimensions of the grid self.rows = m self.cols = n self.visited_map = np.z...
Luckykantnayak/uav-project-2
performance_check.py
performance_check.py
py
8,208
python
en
code
0
github-code
36
20940437621
from collections import OrderedDict import torch def anchor_offset_to_midpoint_offset(anchor_offset: torch.Tensor, anchors: torch.Tensor): b, n, h, w = anchors.shape num_anchors = int(n/4) # prediction has 6 * num_anchors in dim=1 (they are concatenated) we reshape # for easier handling (same for anch...
Simon128/pytorch-ml-models
models/oriented_rcnn/encodings.py
encodings.py
py
5,317
python
en
code
0
github-code
36
37099800243
import pandas as pd import pickle from data import DATA_FILENAME, to_days_since_1998, datetime def parse_date(string_value: str) -> int: try: return datetime.datetime.strptime(string_value.strip(), '%d/%m/%Y').date() except ValueError: return None COLUMNS = ['ibovespa'] df = pd.read_csv(DATA...
fernando7jr/py-ibov-regression
ibov.py
ibov.py
py
1,795
python
pt
code
0
github-code
36
34274019963
import time import multiprocessing as mp def show_current_time(): while True: t = time.strftime("%H:%M:%S") print("Текущее время:", t) time.sleep(1) def show_message(): while True: print("(* ^ ω ^)") time.sleep(3) if __name__ == "__main__": p1 = mp.Process(target=s...
Surikat226/Python-grade
async_run.py
async_run.py
py
645
python
ru
code
0
github-code
36
11892380680
# Uses python3 import sys import random def partition3(a, l, r): #Whole idea is to compare if the ith element is larger than the last element. #If yes, then we swap it. This will automatically make sure that equal elements as the first one will be in the middle. x = a[l] j = l end = r ...
bandiatindra/DataStructures-and-Algorithms
Week 4/Improving Quick Sort.py
Improving Quick Sort.py
py
1,430
python
en
code
3
github-code
36
8444325228
# class s_(object): import functools import numbers import operator import numpy import cupy from cupy._creation import from_data from cupy._manipulation import join class AxisConcatenator(object): """Translates slice objects to concatenation along an axis. For detailed documentation on usage, see :func:`...
cupy/cupy
cupy/_indexing/generate.py
generate.py
py
18,125
python
en
code
7,341
github-code
36
6108135387
from django.db import models from django.utils.translation import gettext_lazy as _ from solo.models import SingletonModel class Configuration(SingletonModel): tenant = models.CharField(max_length=255, help_text="Welkin organization name.") instance = models.CharField( max_length=255, help_text="The e...
Lightmatter/django-welkin
django_welkin/models/configuration.py
configuration.py
py
1,152
python
en
code
1
github-code
36