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
37320137463
from projects.generalize_ising_model.tools.utils import save_file,ks_test from projects.phi.tools.utils import load_matrix from projects.phi.utils import * import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt main_path = '/home/brainlab/Desktop/Popiel/Ising_HCP/' parcels = ['Aud', 'CinguloOperc...
jrudascas/brain_lab
projects/phi/HCP_Ising/find_tpm_tstar.py
find_tpm_tstar.py
py
1,348
python
en
code
2
github-code
13
22249719026
""" to convert pickle file from python 2 to python 3 this script should be run with python 2 """ from __future__ import print_function import argparse import os import pickle from _data_io import ITCExperiment parser = argparse.ArgumentParser() parser.add_argument("--exper_info_dir", type=str, default="05.exper_info...
nguyentrunghai/bayesian_itc_racemic
scripts/run_convert_exper_info.py
run_convert_exper_info.py
py
1,856
python
en
code
0
github-code
13
70361346899
##Make Data # #take background picture #choose random number of objects between MIN_OBJ_PLACED and MAX_OBJ_PLACED #paste objects to background and monitor/log their location and size #save new picture #save picture location and each object bbox(xmin,ymin,xmAx,ymAx) and class number to txt file # # print("xxx : ...
amielf/RakerOne
Trash-Classifier/dataGen.py
dataGen.py
py
9,753
python
en
code
0
github-code
13
33287870398
import string # tipo de dato: numero = 3 print("El tipo es: " + str(type(numero))) # tamaño del dato print(len("es un texto")) # 11 print(len("345345")) # 6 print(len([34, 564, 23])) # 3 #string nombre = "marianito" print(nombre[0]) # p print(nombre[1:3]) # ep print(nombre[-1]) # e #recorrer string 1 #nombre2 = "pe...
lorena112233/pythonDay1
opStrings.py
opStrings.py
py
1,880
python
es
code
0
github-code
13
72660402577
def testing_while(): i = 1 while i<100: print(i) i += 1 if i == 30: print("breaking ... while") break def testing_color_for(): colors = ["white", "red", "blue"] for color in colors: print(color) if color == "blue": print("for will break whe the its color blue") break else: print("Contin...
lmokto/CoursePythonSummer
Fundamentals/iterations1.py
iterations1.py
py
590
python
en
code
0
github-code
13
3658383992
"""Задача 2. 15 баллов Тема Dict Написать программу, которая подсчитывает количество символов в строке и формирует dict в котором key = буква, value= количество их в слове: Входная строка : 'Hillel school' Результат : {'H': 1, 'i': 1, 'l': 3, 'e': 1, ' ': 1, 's': 1, 'c': 1, 'h': 1, 'o': 2}""" # ask the user to e...
artiushenkoartem/hillel_hw_4_python
hillel_leson_4_task_2.py
hillel_leson_4_task_2.py
py
864
python
ru
code
0
github-code
13
36322787583
from PIL import Image,ImageGrab import time,pyautogui initcolor=(255,255,255,255) time.sleep(5) while 1: time.sleep(2) box = (200,500,300,600) img = ImageGrab.grab(box) img = img.load() color =img[50,50] if color==initcolor: print('kadun',time.time()) pyautogui.click(58, 703, ...
initialencounter/code
Python/卡顿检测/虎牙.py
虎牙.py
py
444
python
en
code
0
github-code
13
37488902771
# -*- coding: utf-8 -*- """ Created on Mon Mar 13 10:53:35 2017 @author: tih """ # ----------------------------- Method 1 -------------------------------- import pandas as pd # Define the start en enddate Startdate = '2016-12-01' Enddate = '2016-12-31' # Define the daily date range Dates = pd.date_ran...
Olsthoorn/IHE-python-course-2017
exercises/Mar14/Tim_Hessels/2_Variable_Names.py
2_Variable_Names.py
py
1,418
python
en
code
5
github-code
13
22890598259
import sys import pandas as pd # Input binding elements from shell input_file = sys.argv[1] input_type = input_file.split(".")[-1] input_len = len(input_file.split("/")) assert input_type == "tab", "input file for found binding elements should be in tab format" assert input_len != 1, "full path to an input file is req...
JellisLab/translatome-neurodevo
binding_elements/conservation_cleaning/prepare_elements_bed.py
prepare_elements_bed.py
py
1,924
python
en
code
2
github-code
13
30687396295
''' Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Input: [-2,1,-3,4,-1,2,1,-5,4], Output: 6 Explanation: [4,-1,2,1] has the largest sum = 6. ''' ''' Intuition: At first, I think the sub problem should look like: ma...
kevinsu628/study-note
leetcode-notes/easy/array/53_maximum_subarray.py
53_maximum_subarray.py
py
2,079
python
en
code
0
github-code
13
6627740499
import collections from abc import ABC from typing import Tuple, List, Dict import numpy as np class StepInformationProvider(ABC): """ This class calculates certain values which are used frequently in reward generators. A single instance of this class can be shared between a set of (sub)generators to...
NeoExtended/gym-gathering
gym_gathering/rewards/base_reward_generator.py
base_reward_generator.py
py
9,960
python
en
code
1
github-code
13
9064571234
# Assignment 4. Sage Hourihan import hashlib, os # Creating a function to collect input on the file name def filename(): file = input("Type file name: ") return file def get_hash_of_binary_file_contents (file_path, algorithm = 'MD5'): """This function will read and hash the contents of a file. ...
SageHourihan/File-hasher
hash.py
hash.py
py
1,454
python
en
code
0
github-code
13
35594106928
""" 1.11. Naming a Slice slice(start, stop, step)创建了一个分割器 slice.indices(len)限定stop的长度 """ li = range(20) # res0和res1等价 res0 = li[slice(1, 15)] res1 = li[1 : 15] #print(res) #print(li[SLICE]) sl = slice(1, 10, 2) #print(sl.start, sl.stop, sl.step) # s = "HelloWorld" sl.indices(len(s)) """ 1.12. Determining the ...
hanhansoul/PythonCookbook
sec_chapter01/chpt11.py
chpt11.py
py
6,773
python
en
code
0
github-code
13
270861704
from glob import glob def get_activations(model, model_inputs, print_shape_only=False, layer_name=None): import keras.backend as K print('----- activations -----') activations = [] inp = model.input model_multi_inputs_cond = True if not isinstance(inp, list): # only one input! let's w...
akash13singh/lstm_anomaly_thesis
print_activations.py
print_activations.py
py
2,053
python
en
code
221
github-code
13
7313219835
MOD = 998244353 n = int(input()) cards = [list(map(int, input().split())) for _ in range(n)] dp = [[0, 0] for _ in range(n)] dp[0] = [1, 1] for i in range(1, n): for pre in range(2): for nex in range(2): if cards[i - 1][pre] != cards[i][nex]: # 前のカードのオモテウラが違うなら dp[i][nex] += d...
sugimotoyuuki/kyopro
contest/ABC/291/d.py
d.py
py
536
python
en
code
0
github-code
13
34003249107
from products.models import mobiles # print(len(mobiles)) # print([mob.get("name") for mob in mobiles]) # print([mob.get("brand") for mob in mobiles]) # mobiles.sort(key=lambda m:m.get("price"),reverse=True) # print(mobiles) # costly_mobiles=max(mobiles,key=lambda m:m.get("price")) # print(costly_mobiles) # cheap=min(...
mhdsulaimzed/Pycharm-Practice
pythonDjango/products/views.py
views.py
py
473
python
en
code
0
github-code
13
1955094724
"""Module with grid utils""" import numpy as np def read_grid(file_path): """Read grid from file""" return np.loadtxt(file_path, delimiter=",", dtype=int) def get_grid_size(grid): """Get grid size""" return len(grid) def get_grid_min_path_sum(grid): """Get grid minimum path sum""" size = g...
KubiakJakub01/ProjectEuler
src/utils/grid/grid.py
grid.py
py
1,126
python
en
code
0
github-code
13
6820648365
""" Title: Driver Description: For running the NEML drivers Author: Janzen Choi """ # Libraries from neml import drivers from moga_neml.helper.experiment import NEML_FIELD_CONVERSION from moga_neml.helper.general import BlockPrint from moga_neml.optimise.curve import Curve from moga_ne...
ACME-MG/moga_neml
moga_neml/optimise/driver.py
driver.py
py
4,042
python
en
code
0
github-code
13
71984728017
#SWEA 문제 해결 기본 5176번 이진탐색 ''' 1-N까지의 자연수를 이진탐색 트리에 저장 이진탐색 트리의 특성을 이용해서 풀어보기 2**n 으로 커지는 개수 특성 ''' import sys sys.stdin = open("input.txt", "r") def inorder(node): global order if node != 0: # visit inorder(tree[node][0]) order.append(node) inorder(tree[node][1]) T = int(inpu...
euneuneunseok/TIL
SWEA/SWEA기본_5176_이진탐색_Tree.py
SWEA기본_5176_이진탐색_Tree.py
py
1,796
python
ko
code
0
github-code
13
73857262096
# -*- coding: utf-8 -*- """ Created on Tue Jan 29 11:52:05 2013 @author: Radek """ from Tkinter import * hlavni=Tk() hodnota=IntVar() hodnota.set(100) def Nastav(value): l["text"]=str(value) w = Scale(from_=0, to=1000, variable=hodnota,command=Nastav, label="Stupnice") w.pack() l= Label(hla...
AskoldH/PRG
Stejskal's notes/79 Tkinter - Scale.py
79 Tkinter - Scale.py
py
567
python
cs
code
0
github-code
13
20415362392
import time import pandas as pd from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys if __name__...
przemekdan1/Forbes-web-scraping
scrapeData.py
scrapeData.py
py
5,222
python
pl
code
0
github-code
13
35472669763
from django.test import TestCase, Client from django.contrib.auth import get_user_model from http import HTTPStatus from posts.models import Post, Group User = get_user_model() class PostURLTest(TestCase): @classmethod def setUpClass(cls) -> None: super().setUpClass() cls.user = User.objec...
Stanislav-Gutnikov/hw04_tests
yatube/posts/tests/test_urls.py
test_urls.py
py
3,867
python
ru
code
0
github-code
13
37296086175
# Sky Hoffert # Utility stuff for ENEE623 Project. import socket import sys import threading PORT_TX_TO_CH = 5000 PORT_CH_TO_RX = 5001 Fs = 44100 def Log(s, end="\n"): sys.stdout.write(s) sys.stdout.write(end) sys.stdout.flush() def ConstellationToXY(c): xs = [] ys = [] for pt in c: ...
skyhoffert/ENEE623_Project
util.py
util.py
py
385
python
en
code
0
github-code
13
29860363860
from ..database.db import Database from .AiModel import ChatGPT import json class ChapterModel(): def fetch_all(story_id): db = Database.open() chapters = db.execute("SELECT * FROM chapter WHERE story_id = ? ORDER BY id", (story_id,)).fetchall() return chapters def fetch_one(id): ...
lundchristian/flask_api_v3
src/model/ChapterModel.py
ChapterModel.py
py
2,180
python
en
code
0
github-code
13
70061782099
import socket import sys Dict = {} #1. Insertion and update #(a) The HTTP request method should be POST and the value to be inserted (or #updated) constitutes the content body. There should also be a Content #Length header indicating the number of bytes in the content body. #(b) The server should respond with a 200 O...
Deunitato/CS2105_Assignments
cs2105_assignment_1/test/WebServer-A0185403J.py
WebServer-A0185403J.py
py
5,437
python
en
code
0
github-code
13
42045283758
#!/usr/bin/env python3 import sys import heapq import collections sys.setrecursionlimit(10 ** 8) read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines H, W, T = map(int, readline().split()) grid = [] start = goal = None for r in range(H): s = readline().decode("u...
keijak/comp-pub
atcoder/abc020/C/main.py
main.py
py
1,562
python
en
code
0
github-code
13
37199477605
import numpy as np import pandas as pd import random as rand from tqdm import tqdm from collections import Counter # ====================================================================================================================== class Node: def __init__(self, data): self.data = data self.le...
hbatta/self-organizing-data-structures
source.py
source.py
py
10,052
python
en
code
0
github-code
13
40306968202
import tkinter as tk from tkinter import simpledialog from tkinter import filedialog import numpy as np import tables as pt class PlotElement(tk.Frame): def __init__(self, masterFrame, spwnd, r_var, val, comment, color, plot): super().__init__(masterFrame.frame, highlightthickness=1, highlightbackground=...
optotekhnika/pySpectrRPi
plotlistwnd.py
plotlistwnd.py
py
5,161
python
en
code
0
github-code
13
38263786866
import scrapy import csv import traceback from bs4 import BeautifulSoup ship_file = open('equasis_ship', 'w') ship_csv = csv.writer(ship_file, delimiter = ",") company_file = open('equasis_company', 'w') company_csv = csv.writer(company_file, delimiter = ",") ship_cols = [ "IMO number :", "Name of ship :", "Call ...
niccdias/scrapers
equasis/equasis_ship.py
equasis_ship.py
py
3,302
python
en
code
1
github-code
13
18346268089
user_agent_name = 'Python HTTP Server' # server_ip = 'amadeus.local' server_ip = '192.168.43.29' ports = range(8080, 8090) import console args = console.process_args() if 'port' in args.keys(): ports = [args['port']] + list(ports)
aeirya/homework-winter2021
network/hw1/q3/py/args.py
args.py
py
254
python
en
code
0
github-code
13
20985346392
import re import openpyxl # Define the log file path log_file_path = "" # Define the Excel file path excel_file_path = "extract-excel.xlsx" # Regular expression for extracting date and time datetime_pattern = r'(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})' # Assuming datetime format is YYYY-MM-DD HH:MM:SS #...
Thanushbj7/LogToExcel
final_extract.py
final_extract.py
py
4,200
python
en
code
0
github-code
13
456861560
N=int(raw_input()) a=(raw_input()).split() b=[] s=[] for i in a: b.append(int(i)) for i in range(0,len(b)): s1=0 s2=0 c1=0 c2=0 for j in range(i+1,len(b)): s1=s1+b[j] c1=c1+1 if(c1>0): s1=int(s1/(c1)) for k in range(0,i+1): s2=s2+b[k] c2=c2+1 ...
chanduvenkyteju/pythonprogramming
equal avg of 2 arrays .py
equal avg of 2 arrays .py
py
427
python
en
code
0
github-code
13
31003301926
from django.urls import path from . import views urlpatterns = [ path('', views.goal_list, name='goal_list'), path('add/', views.goal_add, name='goal_add'), path('<slug:slug>/detail/', views.goal_detail, name='goal_detail'), path('<slug:slug>/edit/', views.goal_edit, name='goal_edit'), path('<slug...
alex1the1great/Roadmap
roadmap/urls.py
urls.py
py
519
python
en
code
0
github-code
13
73011552978
from os import getenv # if env is prod read from env vars else read from local file cred_dct = {} ENV = getenv("ENV") check_env = getenv("ORACLE_HOST") if check_env: cred_dct["HOST"] = check_env cred_dct["USERNAME"] = getenv("ORACLE_USER") cred_dct["PASSWORD"] = getenv("ORACLE_PASS") cred_dct["SID"] =...
sktrinh12/dm-sar-view
backend/app/credentials.py
credentials.py
py
908
python
en
code
0
github-code
13
21850272952
import os import multiprocessing as mp import matplotlib.pyplot as plt import matplotlib.colors as mcolors import cartopy.crs as ccrs import cartowik.conventions as ccv import cartowik.decorations as cde import cartowik.naturalearth as cne import cartowik.shadedrelief as csr import absplots as apl import pismx.open #...
juseg/cordillera
movies/anim_cordillera_dual.py
anim_cordillera_dual.py
py
7,310
python
en
code
0
github-code
13
74718310736
import os from copy import deepcopy from decimal import Decimal from typing import Optional, Dict, Tuple, List, Set from dataclasses import dataclass, field import boto3 import marshy from boto3.dynamodb.conditions import Not as DynNot, ConditionBase, Key from botocore.exceptions import ClientError from marshy.types i...
tofarr/persisty
persisty/impl/dynamodb/dynamodb_table_store.py
dynamodb_table_store.py
py
22,182
python
en
code
1
github-code
13
20165630869
''' Created on Sep 27, 2017 @author: uhuhuh ''' # Is this how "Class" work??? # Centers the program window from Tkinter import * class center: #init and receives master widget def __init__(self, master=None): self.update_idletasks() w = self.winfo_screenwidth() ...
wfSeg/pythonlearning
GUItutorial/TkinterLearning/CenterClass.py
CenterClass.py
py
551
python
en
code
0
github-code
13
1191072852
#!/usr/local/bin/python # SlidingWindow.py import wx class SlidingWindow(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, parent, title = title, size = (1000, 800)) self.topPacketNum = 20 self.BottomPacketNum = 20 self.ID_TIMER = 1 self.windowSize = 5 self.sendStrategy = "GoBackN"...
wuzhaoxi/ComputerNetworksHW4
SlidingWindow.py
SlidingWindow.py
py
7,800
python
en
code
0
github-code
13
73476387538
import sys class Graph: def __init__(self, vertices_count, adj_matrix): self.vertices_count = vertices_count self.graph = adj_matrix def dijkstra(self, start): visited = [False for _ in range(self.vertices_count)] distance = [sys.maxsize for _ in range(self.vertices_count)] ...
lapakota/combinatorial_algorithms
3_dijkstra/python/dijkstra.py
dijkstra.py
py
2,968
python
en
code
1
github-code
13
24580335214
from django import urls from django.urls import path from .views import ( doctor_dash_view, doctor_profile_view, doctor_patient_view, doctor_search_view, doctor_appointment_view, doctor_schedule_view, doctor_schedule_week_view, doctor_support_view, doctor_support_success_view, ...
reskillamericans/Medical-Aid-Group1-BE
doctor/urls.py
urls.py
py
1,374
python
en
code
1
github-code
13
5929728626
from tkinter import N, E, W, S, StringVar, Tk from tkinter import ttk def calculate(): global feet value = float(feet.get()) meters.set(f"{int(0.3048 * value):.2f}") root = Tk() root.title("Feet to Meters") mainframe = ttk.Frame(root, padding="3 3 12 12") mainframe.grid(column=0, row=0, sticky=(N, W, E...
NaveenRaphael/NPTEL_CS108-2023
Week 12/tkinter_feet2m.py
tkinter_feet2m.py
py
1,032
python
en
code
0
github-code
13
24823680495
import numpy as np import pywt from statsmodels.robust import mad def window_smooth(x, window_len=11, window='hanning'): """Smoothing the data using a window with requested size. This method is based on the convolution of a scaled window with the signal. The signal is prepared by introducing reflected copies ...
KienMN/GR-Curve-Unit-Breakdown
unit_breakdown/smoothing_functions.py
smoothing_functions.py
py
2,890
python
en
code
1
github-code
13
33767526996
import ctypes c_uint32 = ctypes.c_uint32 c_uint16 = ctypes.c_uint16 c_uint8 = ctypes.c_uint8 MAX_BYTES = 56 class HABPacketImageSeqStart(ctypes.LittleEndianStructure): name = "HABPacketImageSeqStart" _pack_ = 1 _fields_ = [ ("packetType", c_uint16), ("...
wb9coy/HAB_WebServer
python/packetDefs.py
packetDefs.py
py
857
python
en
code
1
github-code
13
7931825596
# https://web-programmist.ru/news/2/2.jpg # Простите но мой максимум породии интерфейса вот он from tkinter import * from tkinter.ttk import Combobox root = Tk() root.title("Практическая работа 12 №1") root.geometry("1000x800+450+100") root.resizable(height=False, width=False) zagalovok = Label(root, text='Параметры ...
PavelFedkov/Proj_1sem_Fedkov
PZ_12_var26/PZ_12_1.py
PZ_12_1.py
py
2,668
python
ru
code
0
github-code
13
17034562414
# Author: Evan Wiederspan <evanw@alleninstitute.org> import unittest import numpy as np from itertools import permutations from aicsimageprocessing.alignMajor import ( align_major, get_align_angles, get_major_minor_axis, angle_between, ) class TestAlignMajor(unittest.TestCase): def setUp(self): ...
AllenCellModeling/aicsimageprocessing
aicsimageprocessing/tests/test_AlignMajor.py
test_AlignMajor.py
py
4,491
python
en
code
2
github-code
13
7956280471
# Dependencies from flask import Flask, render_template, jsonify, redirect import pymongo from pymongo import MongoClient import scrape_mars # Flask setup app = Flask(__name__) conn = "mongodb://rc:C00k1eBaba@ds143245.mlab.com:43245/heroku_n5qzr3nx" # client = MongoClient("mongodb://localhost:27017") # conn = 'mongo...
ruchichandra/Mission-to-Mars
app.py
app.py
py
905
python
en
code
0
github-code
13
42596663924
import requests import string print ("Vul een wachtwoord in om te checken") pwd = input() # Een online woordenlijst met zwakke wachtwoorden die ik online heb gevonden. In de laatste regel van deze snippet word gekeken of het ingvulde # wachtwoord in de lijst voorkomst. pwd_lijst = requests.get('https://raw.githubuse...
rouwens/S2-Applicatie
Oefen challanges/Password checker/password_checker.py
password_checker.py
py
1,558
python
nl
code
0
github-code
13
30140438590
from functools import wraps from flask import request import logging from flask_restful import Resource, abort from app.app import socketio, api from app.models import * logger = logging.getLogger(__name__) ####################### # API Decorators ####################### def authenticate_api(func): @wraps(func) ...
xtream1101/scraper-monitor
app/api.py
api.py
py
8,957
python
en
code
0
github-code
13
25736029151
#!/usr/bin/env python3 #coding: utf-8 import openai from openai import OpenAI import json import tiktoken import random import cgi import sys import random from image_generation import get_image_for_line from sound_generation import get_audio_for_line prompts = list() # OPENAI SETUP # path to file with authentica...
ufal/didaktikon
exponat/sekce/pribehy/story.py
story.py
py
10,366
python
en
code
0
github-code
13
285339285
class colorborder(object): def _init_(self): self.R self.C self.visited self.finalColor def colorBorder(self, grid, r0, c0, color): self.R = len(grid) self.C = len(grid[0]) self.finalColor = color self.visited = [[False for y in range(self.C)...
soniaarora/Algorithms-Practice
Solved in Python/LeetCode/arrays/colorBorder.py
colorBorder.py
py
1,623
python
en
code
0
github-code
13
15725729270
#!/usr/bin/env python3 # -*- coding:utf-8 -*- #1-1 sampleFile = open("sample.txt", "r") rsampleFile = sampleFile.read() sampleFile.close() pun=[',','?','0','1','2','-','/','\n','"','.' ] for a in pun: rsampleFile=rsampleFile.replace(a," ")#移除標點符號與換行 wordList = rsampleFile.split(" ") sampleWordList = [ ] for h i...
PeterWolf-tw/ESOE-CS101-2016
homework01_b05505052.py
homework01_b05505052.py
py
805
python
en
code
15
github-code
13
16007323850
import os import code import time import torch from collections import namedtuple import nimblephysics as nimble from solver.envs.rigidbody3d.sapien_viewer import SapienViewer from sapien.core import Pose import numpy as np import cv2 import gym.spaces import transforms3d.euler import transforms3d.quaternions from solv...
haosulab/RPG
solver/envs/rigidbody3d/rigid3d_simulator.py
rigid3d_simulator.py
py
5,235
python
en
code
18
github-code
13
986372030
import re from django.conf import settings from django.core.management.base import BaseCommand from openpyxl import load_workbook from painter.models import Card class Command(BaseCommand): help = ('Clears the database of cards, then fills it with the contents of one or' + ' more specified XLSX file...
adam-thomas/imperial-painter
painter/importers/import_cards.py
import_cards.py
py
9,933
python
en
code
0
github-code
13
3072227515
import datetime import mohawk import pytest from django.conf import settings from django.utils import timezone from freezegun import freeze_time from rest_framework import status from rest_framework.reverse import reverse from rest_framework.test import APIClient from activitystream.authentication import NO_CREDENTIALS...
uktrade/directory-cms
tests/activitystream/test_views.py
test_views.py
py
5,226
python
en
code
5
github-code
13
7885920830
#!/usr/bin/env python """ Run representative cases with varying number of representative weeks. """ import json import logging import os import time from collections import OrderedDict import matplotlib.pyplot as plt import pandas as pd from pkg_resources import resource_filename import progressbar from misc.SDH_Con...
energyville/modesto
misc/RepresentativePeriodsMILP/runOpt.py
runOpt.py
py
10,353
python
en
code
13
github-code
13
41162987976
print('-'*20) print('Sequencia de Fibonacci') print('-'*20) n = int(input('Quantos numeros deseja ver: ')) t1 = 0 t2 = 1 print('{} - {} '.format(t1, t2), end='') c = 3 while c <= n: t3 = t1 + t2 print(' - {}'.format(t3), end='') t1 = t2 t2 = t3 c += 1 print('FIM!')
Pauloa90/Python
ex063.py
ex063.py
py
288
python
en
code
0
github-code
13
42704016445
import time from usrf_grove import USRF from machine import Pin Sensor = USRF(pin = 5, echo_timeout_us = 1000000) Relay = Pin(15, Pin.OUT) while (True): time.sleep_ms(5) Dist = Sensor.distance_cm() if Dist < 10: Relay.on() time.sleep(2) else: Relay.off()
ffich/Ganimede
10_Python/020_Sensors/30_UltrasonicRF/us_rf.py
us_rf.py
py
301
python
en
code
1
github-code
13
74176773139
# -*- coding: utf-8 -*- """ Created on Wed Sep 26 09:15:18 2018 @author: gregz """ import numpy as np from astropy.io import fits filenames = [line.rstrip('\n').split() for line in open('/work/03730/gregz/maverick/test_2.dat', 'r')] ext = 'extracted_spectrum' fitslist = [] cnt = 0 for filename in filenames: F ...
grzeimann/Panacea
strip_ext_multi.py
strip_ext_multi.py
py
660
python
en
code
8
github-code
13
22101876812
int1 = 100 counter=0 while (int1 >= 100 and int1 < 1000): if (int1 % 17 == 0): int1+=1 print(int1) counter+=1 else: int1+=1 print("\n",counter, "3 digit numbers are divisable by 17")
JLevins189/Python
Labs/Lab2/Ex5Q7.py
Ex5Q7.py
py
229
python
en
code
0
github-code
13
36275454447
N=int(input()) s={} for _ in range(N): si=input() if si in s: s[si]+=1 else: s[si]=1 M=int(input()) t={} for _ in range(M): ti=input() if ti in t: t[ti]+=1 else: t[ti]=1 ans=0 for word in s.keys(): if word in t: ans = max(ans, s[word]-t[word]) e...
syagi/atcoder_training
ant/2-4/2-4-2-2_abc091b.py
2-4-2-2_abc091b.py
py
368
python
en
code
0
github-code
13
9235305448
import sys import pandas as pd def main(): if len(sys.argv) is not 4: print("argv: all_csv_path pos_csv_path neg_csv_path") sys.exit(1) all_csv_path = sys.argv[1] pos_csv_path = sys.argv[2] neg_csv_path = sys.argv[3] df_all = pd.read_csv(all_csv_path) df_pos = pd.read_csv(pos_...
tsaiid/femh-dicom
generate-negative-csv.py
generate-negative-csv.py
py
539
python
en
code
2
github-code
13
17056480534
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class MybankCreditSceneprodDataUploadModel(object): def __init__(self): self._app_seqno = None self._data_config = None self._data_content = None self._org_code = None ...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/MybankCreditSceneprodDataUploadModel.py
MybankCreditSceneprodDataUploadModel.py
py
2,955
python
en
code
241
github-code
13
4791202068
#!/usr/bin/python # -*- coding: utf-8 -*- class Solution(object): def __init__(self, word1: str, word2: str) -> None: self.word1 = word1 self.word2 = word2 self.minStep = 0 self.data = [None for _ in range(len(word1))] def findSmallestModification(self): ""...
LeroyK111/BasicAlgorithmSet
代码实现算法/edit-distance.py
edit-distance.py
py
1,246
python
en
code
1
github-code
13
14239030837
from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch import torch.nn as nn import thumt.utils as utils from thumt.modules.module import Module from thumt.modules.dmb.affine import Affine class FeedForward(Module): def __init__(self, input_siz...
THUNLP-MT/Transformer-DMB
thumt/modules/dmb/feed_forward.py
feed_forward.py
py
2,714
python
en
code
1
github-code
13
73913807696
#!/usr/bin/python3 from __future__ import print_function from dronekit import connect, VehicleMode import numpy as np import cv2 import cv2.aruco as aruco import sys, time, math, _thread, argparse connection_string = "/dev/ttyACM0" baud_rate = 57600 #1678 -> 10 deg #1507 -> Neutral #1186 -> -30 deg #-------------(de...
ekaratst/deep-stall-landing-using-image-processing
fixed-wing/experiment/test/run-deepstall-bytime.py
run-deepstall-bytime.py
py
3,957
python
en
code
0
github-code
13
26246857271
import json import sqlite3 from flask import Flask, jsonify, request, Response from flask_cors import CORS app = Flask(__name__) CORS(app) todos = [{ "id": 1, "title": 'todo1', "completed": True }, { "id": 2, "title": 'todo2', "completed": False }] dbname = "data.db" def to_response(data, ...
Faye6155/Final
app/app.py
app.py
py
2,219
python
en
code
0
github-code
13
36580374013
from argparse import ArgumentParser from src.encoder.binary_arithmetic_encoder import BinaryArithmeticEncoder if __name__ == "__main__": parser = ArgumentParser() parser.add_argument('--file', type=str, help="Path to file to encode") parser.add_argument('--probabilities', type=str, help='Path to file with...
Dymasik/BinaryArithmeticEncoder
src/main.py
main.py
py
1,111
python
en
code
0
github-code
13
17669049940
# Idea is to use a monotonic queue with stores numbers in decreasing order. We can use this to our advantage # as the max element for every sub list will the first element of the queue however we will nee to maintain this # state of the queue. Whenever we add a num to the queue we need to check if that num is less than...
SharmaManjul/DS-Algo
LeetCode/Blind75/SlidingWindow/slidingWindowMaximum.py
slidingWindowMaximum.py
py
1,432
python
en
code
0
github-code
13
35540506180
# This script uses Pandas and Bokeh to provide a line graph based off large amounts of data. # Data is read in through a CSV file and plots X vs Y based off column titles. # # To install Pandas: $ pip3 install pandas # To install Bokeh: $ pip3 install bokeh # importing bokeh and pandas from bokeh.plotting impor...
ejrach/my-python-utilities
SpreadsheetUtilities/DataVisualizationLine/app.py
app.py
py
916
python
en
code
0
github-code
13
13955892385
# export TF_CPP_MIN_LOG_LEVEL=2 (Ignore warnings) # 25 Sep 2017 # Daniel Kho # Seungmin Lee # GDO number # initial variable: w&b # Learning rate # Sample size # ====> shape of regression from __future__ import print_function from decimal import * from tensorflow.contrib.learn.python import SKCompat ...
skho513/Big-Data-Analytics-for-IoT-enabled-Manufacturing
DataAnalysis.py
DataAnalysis.py
py
20,816
python
en
code
0
github-code
13
6515271495
import turtle import time b=time.time() turtle.speed(30) turtle.bgcolor("black") turtle.hideturtle() for i in range(1): for c in ("red","green","pink","orange"): turtle.color(c) turtle.pensize(2) turtle.lt(12) for i in range(10): turtle.fd(5) turtle.lt(150)...
Arryn21/Codes
New1.py
New1.py
py
428
python
en
code
0
github-code
13
31201673288
import copy from st2tests import DbTestCase from st2common.models.db.datastore import KeyValuePairDB from st2common.persistence.datastore import KeyValuePair from st2reactor.rules import datatransform PAYLOAD = {'k1': 'v1', 'k2': 'v2'} PAYLOAD_WITH_KVP = copy.copy(PAYLOAD) PAYLOAD_WITH_KVP.update({'k5': '{{system.k...
gtmanfred/st2
st2reactor/tests/unit/test_data_transform.py
test_data_transform.py
py
1,988
python
en
code
null
github-code
13
6312830354
import cx_Oracle import requests, json import datetime import time import yaml from config.config import * DATE_FORMAT = '%Y-%m-%d' API_KEY = api_key MIN_DATE = '2015-01-01' SORT_BY = 'primary_release_date.asc' LANGUAGE = 'en' DISCOVER_URL = 'https://api.themoviedb.org/3/discover/movie' ID_URL = 'https://api.themovie...
chasefarmer2808/ReposiMovie-API
jobs/populate.py
populate.py
py
3,001
python
en
code
0
github-code
13
7631374202
# S[1] 메모리 114328 KB 시간 112 ms import sys input = sys.stdin.readline N = int(input()) arr = [list(input().strip()) for _ in range(N)] visited = [[False for _ in range(N)] for _ in range(N)] complex = [] def bfs(i, j): queue = [(i, j)] visited[i][j] = True cnt = 0 while queue: x, y = queue.p...
nuuuri/algorithm
그래프/BOJ_2667.py
BOJ_2667.py
py
802
python
en
code
0
github-code
13
41431624822
from django.shortcuts import render, redirect, get_object_or_404, reverse from gestion_de_mascotas.models import Perro_perdido, Perro_en_adopcion, Perro, Perro_encontrado, Entrada, Libreta_sanitaria, Registro_vacuna, Servicio_veterinario, Vacuna from .forms import Perro_perdido_form, Perro_en_adopcion_form, Send_email_...
FacuLede/oh_my_dog
oh_my_dog/gestion_de_mascotas/views.py
views.py
py
30,336
python
es
code
0
github-code
13
436864211
import csv from core_data_modules.cleaners import Codes from core_data_modules.data_models.code_scheme import CodeTypes class AnalysisConfiguration(object): def __init__(self, dataset_name, raw_field, coded_field, code_scheme): self.dataset_name = dataset_name self.raw_field = raw_field s...
AfricasVoices/CoreDataModules
core_data_modules/analysis/analysis_utils.py
analysis_utils.py
py
13,451
python
en
code
0
github-code
13
43175535789
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 from reporting.utils import extract_date from rapidsms.contrib.apps.handlers import KeywordHandler from rwanda.models import PregnantPerson, PreBirthReport class PreBirthReportHandler(KeywordHandler): """ """ keyword = "mrep" def must_register(sel...
oluka/mapping_rapidsms
apps/rwanda/handlers/pre_birth_report.py
pre_birth_report.py
py
1,312
python
en
code
3
github-code
13
27556852490
from django.contrib.staticfiles.testing import StaticLiveServerTestCase from pyvirtualdisplay import Display from selenium import webdriver from selenium.common.exceptions import TimeoutException from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as ec from selenium....
atadych/pentacon-refinery-platform
refinery/selenium_testing/utils.py
utils.py
py
1,849
python
en
code
0
github-code
13
32371634987
# -*- coding: utf-8 -*- """ Created on Sat Dec 22 11:08:27 2018 @author: Basha """ import os import pandas as pd from sklearn import tree from sklearn import model_selection from sklearn import ensemble #This is what we introduced here. #returns current working directory os.getcwd() #changes workin...
dsbasha/NOV-2018
Supervised Learning/Calssification Algorithms/monster_adaboost.py
monster_adaboost.py
py
1,619
python
en
code
0
github-code
13
71804424018
# Author : codechamp27 # Code Licensed under the Apache License, Version 2.0 # takes a number and checks if it is unique or not num = int(input("Enter a number : ")) matched = False for i in range(0, 10): count = 0 copy = num while copy > 0: d = copy % 10 if d == i: count = cou...
codechamp2006/Python-11
uniquenumber.py
uniquenumber.py
py
489
python
en
code
0
github-code
13
42409733221
def SIMPLE_XOR(l, r): for i in range(l, r + 1): for j in range(i + 1, r + 1): for k in range(j + 1, r + 1): temp = i ^ j ^ k if temp >= l and temp <= r: s = set([i, j, k, temp]) if len(s) == 4: return...
ZicsX/CP-Solutions
Simple_XOR.py
Simple_XOR.py
py
500
python
en
code
0
github-code
13
8295180121
from django.shortcuts import render #from .models import HashFunction from .forms import HashInputForm from .utils import calculate_hashes def calculator_page_view(request, *args, **kwargs): context = {} text_var_name = 'text' text_to_hash = request.GET.get(key=text_var_name) #returns an empty str...
NotSirius-A/Hash-calculator-website
hash_calculators/views.py
views.py
py
607
python
en
code
0
github-code
13
18348845110
from django.urls import path from . import views urlpatterns = [ path("", views.index, name='home'), path("main", views.index), path("blogs", views.blogs, name='blogs'), path("blogs/<int:id>", views.blog_details, name='blog_details'), # path("tarifler",views.tarifler,name="tarifler"), ...
hermannKonyar/Blog_Django
blog/urls.py
urls.py
py
460
python
en
code
2
github-code
13
6791989210
# CENG 487 Assignment1 by # DoğukanÇiftçi # StudentId: 230201071 # October 2021 from mat3d import * class oobject : def __init__(self, position,vertices,matrix_stack): self.position = position self.vertices = vertices self.matrix_stack=matrix_stack def applyMatrixToVertices(self...
dogukanjackson/ComputerGraphics
DoğukanÇiftçi_assignment3/DoğukanÇiftçi_assignment3/oobject.py
oobject.py
py
859
python
en
code
0
github-code
13
39312087746
from distutils.core import setup from Cython.Build import cythonize from distutils.extension import Extension from Cython.Distutils import build_ext import numpy as np ext_modules=[ Extension("subroutine_cython", ["subroutine_cython.pyx"], libraries=["m"], extra_compile_ar...
mgalcode/CLEAN-Capon-3C
subroutine_cython_setup.py
subroutine_cython_setup.py
py
596
python
en
code
7
github-code
13
71946784338
#!/usr/bin/env python # coding: utf-8 # # Basic Calulator # ***Importing required liabraries*** # In[1]: from tkinter import * # ***Defining finctions*** # In[2]: def btnClick(numbers): global operator operator = operator + str(numbers) text_input.set(operator) # In[3]: def btnClearDisplay(): ...
aniketkulye/Python_tkinter_Calculators
Basic Calculator.py
Basic Calculator.py
py
4,154
python
en
code
0
github-code
13
41857484210
# -*- coding: utf-8 -*- """ @author: Valerie Desnoux with improvements by Andrew Smith contributors: Jean-Francois Pittet, Jean-Baptiste Butet, Pascal Berteau, Matt Considine Version 8 September 2021 ------------------------------------------------------------------------ reconstruction on an image from the de...
mconsidine/Digital_SHG
Solex_recon.py
Solex_recon.py
py
24,677
python
en
code
1
github-code
13
42952575036
from MindSphere import MindSphere mindsphere = MindSphere(app_Name=None, app_Version=None, tenant=None, gateway_URL=None, client_ID=None, client_Secret=None ) assetId...
unifgabsantos/MindSphere
main.py
main.py
py
432
python
en
code
1
github-code
13
41163065986
jogador = dict() partidas = list() sum = 0 jogador['nome'] = str(input('Digite o nome do Jogador: ')) n = int(input(f'Quantas partidas {jogador["nome"]} jogou: ')) for x in range(0, n): partidas.append(int(input(f'Quantos gols na partida {x+1}? '))) jogador['gols'] = partidas for x in jogador['gols']: sum +=...
Pauloa90/Python
ex093.py
ex093.py
py
419
python
pt
code
0
github-code
13
19064178176
from dataclasses import dataclass @dataclass class CustomQueue: items: list MAXSIZE: int x_values = set() def xSet(self) -> set: if not self.x_values: for items in self.items: self.x_values.add(items.pos[0]) return self.x_values def removeX(self, x...
TajTelesford/ColorMatrixApplication
CustomQueue.py
CustomQueue.py
py
2,102
python
en
code
0
github-code
13
24704010564
#! /usr/local/python_anaconda/bin/python3.4 from Bio import SeqIO from Bio import AlignIO from Bio import Alphabet from Bio.Alphabet import IUPAC import collections from file_utilities import check_filename import pandas as pd import textwrap from collections import Counter from itertools import product from phyVirus...
SternLabTAU/SternLab
seqFileAnalyzer.py
seqFileAnalyzer.py
py
22,174
python
en
code
1
github-code
13
41420692659
""" TP3 réalisé le 28/11/2022 Par Saglibene Lilian et Glemet Augustin Objectif : Créer une fonction si la lettre proposé par l'utilisateur est dans le mot recherché """ def verif_lettre(lettre_prop, solution): lettre_sol=list(solution) list_indice=[-1 for i in range(len(lettre_sol))] for...
Lilian2588/Python
TP3/verification_lettre.py
verification_lettre.py
py
469
python
fr
code
0
github-code
13
74675240656
import pytest import numpy as np from mstk.topology.geometry import * def test_grow_particle(): xyz1 = np.array([0, 0, 0]) xyz2 = np.array([0, 1, 0]) print(grow_particle(xyz1, xyz2, 2, np.pi * 0.1)) def test_cluster(): elements = list(range(10)) bonds = [(7, 1), (1, 0), (3, 4), (5, 6), (4, 7)] ...
z-gong/mstk
tests/topology/test_geometry.py
test_geometry.py
py
645
python
en
code
7
github-code
13
30361575522
#! /usr/bin/env python3.3 import urllib.request,urllib.parse from package.game_time import GameDateGenerator, TimeGenerator from package.resp_parser import ResponseParser from package.request_api import RequestParamBuilder, RequestParameters,\ RequestTokenExtractor ''' The class VenueChecker checks for available...
cjjavellana/bcourt-poller
package/venue_checker.py
venue_checker.py
py
3,077
python
en
code
0
github-code
13
23027312132
import logging import random import numpy as np import kaldi_io_py def make_batchset(data, batch_size, max_length_in, max_length_out, num_batches=0, batch_sort_key='shuffle', min_batch_size=1): """Make batch set from json dictionary :param dict data: dictionary loaded from data.json :...
Gastron/espnet-old-speaker-aware
espnet/tts/tts_utils.py
tts_utils.py
py
5,511
python
en
code
0
github-code
13
71292812178
from rest_framework.test import APITestCase from rest_framework import status from course_service.models import Course from user_service.models import * from django.urls import reverse from rest_framework_simplejwt.tokens import RefreshToken from django.utils.http import urlencode from password_generator import Passw...
chukaibejih/smart_learn
course_service/tests/test_course.py
test_course.py
py
6,151
python
en
code
21
github-code
13
70368843859
from flask import Flask, render_template, request from difflib import SequenceMatcher app = Flask(__name__) @app.get("/") def form_get(): return render_template('input.html') @app.post("/output.html") def form_post(): left_text = request.form.get('left_box') right_text = request.form.get('rig...
yangbranden/SuperSimplePlagiarismChecker
PlagiarismChecker.py
PlagiarismChecker.py
py
865
python
en
code
0
github-code
13
73953888656
import requests import json with open("./default_table.json", "r") as f: body = json.load(f) response = requests.post( url="http://localhost:3000/api/savetable", json = body ) print("status code", response.status_code) print(response.content)
erietz/periodic-table
scripts/default_table/default_table.py
default_table.py
py
274
python
en
code
0
github-code
13
37263088031
import maya.api.OpenMaya as om def getDependNode(name): try: selection_list = om.MSelectionList() selection_list.add(name) return selection_list.getDependNode(0) except: om.MGlobal.displayError('No object matches or more than one object matches name: {0}'.format(name)) ...
asheiwa/ah_maya_api
ah-maya-api/learn/mayaAPI_basics.py
mayaAPI_basics.py
py
3,306
python
en
code
0
github-code
13
32617702735
import os,json,shutil class Colors: fail = '\033[91m' ; good = '\033[92m' ; end = '\033[0m' # TODO: work on Tables() class Tables: def __init__(self,tableName:str): self.__thisDir = os.path.dirname(__file__)+'/tables/' self.__tableName = tableName.strip() self.__tableDir = self.__thisDir+se...
anthony16t/mystorage
mystorage/__init__.py
__init__.py
py
9,956
python
en
code
0
github-code
13