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
72559305256
#!/usr/bin/env python3 #demo 2 using Vga_drive class driver #with added colour theme switching #By Mike Cook January 2019 import time, random from vga_drive import Vga_drive #1024 x 768 @ 57Hz settings: 128 x 64 characters #800 x 600 @ 75Hz settings: 100 x 50 characters #640 x 480 @ 69Hz settings: 80 x 40 characters ...
Grumpy-Mike/Mikes-Pi-Bakery
In_A_Spin/Part 3/VGA/Python/vga_demo2.py
vga_demo2.py
py
2,492
python
en
code
71
github-code
90
42584345949
from sqlalchemy import ForeignKey from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.dialects.postgresql import UUID from geoalchemy2 import Geometry from geonature.utils.env import DB from geonature.utils.utilssqlalchemy import ( serializable, geoserializable, Gene...
Khanh-Chau/Dossier_2018
cmt_explicatif_SFT/backend/models.py
models.py
py
5,174
python
fr
code
0
github-code
90
32956733730
#!/usr/bin/env python # coding: utf-8 # In[1]: from splinter import Browser from bs4 import BeautifulSoup as soup import pandas as pd # In[2]: executable_path = {'executable_path':'/Users/justinberry/Downloads/chromedriver'} browser = Browser('chrome', **executable_path) # In[3]: url = 'https://mars.nasa.go...
juberr/Mission-to-Mars
Mission_to_Mars_Challenge.py
Mission_to_Mars_Challenge.py
py
3,543
python
en
code
0
github-code
90
21183133816
from rest_framework import routers from Institute import views from django.urls import path from rest_framework.urlpatterns import format_suffix_patterns urlpatterns = [ path('Institute/CreateInstitute', views.createInstitute), path('Institute/listInstitute', views.listedInstitute), path('Institute/Upda...
Funread/funread
funread_backend/Institute/urls.py
urls.py
py
684
python
en
code
0
github-code
90
71774382698
import argparse import logging from pathlib import Path import numpy as np import wandb from datasets import load_from_disk from transformers import ( AutoModelForSeq2SeqLM, AutoTokenizer, DataCollatorForSeq2Seq, Seq2SeqTrainer, Seq2SeqTrainingArguments, ) from evaluate_summ import compute_summ_me...
amazon-science/background-summaries
src/train.py
train.py
py
4,412
python
en
code
0
github-code
90
33731131011
#!/usr/bin/env python3 # please add the target episode_url at the start of this code, example: import requests import urllib import execjs import sys import json import re import sys from bs4 import BeautifulSoup as Soup def doRequest(url): return requests.get(url, cookies={'RI': '0'}) def getImageInfo(episode_...
KeepLearningFromSideProject/scheduler
scripts/get_images.py
get_images.py
py
2,462
python
en
code
1
github-code
90
37589102032
# Written by Eric Martin for COMP9021 from random import choice, seed try: for_seed = int(input('Feed seed if desired: ')) except ValueError: for_seed = 0 seed(for_seed) dice = 4, 6, 8, 12, 20 chosen_dice = choice(dice) nb_of_simulations_to_display = 5 hypotheses_probabilities = dict.fromkeys(dice, 0.2) ou...
marey/UNSW_COMP9021
03.exercies/19.Bayes rule/bayes_rule.py
bayes_rule.py
py
2,809
python
en
code
8
github-code
90
21743224101
#!/usr/bin/env python3 from glob import glob from setuptools import find_packages, setup setup(name='find_substrings', version='1.0', description='Script to find all substrings of given input string', author='Ilia Zenkov', packages=find_packages('src'), package_dir={'': 'src'}, p...
IliaZenkov/python-package-continuous-integration
setup.py
setup.py
py
421
python
en
code
0
github-code
90
21825422345
from Workspace.WorkspaceClient import Workspace import json wsid = 16962 upa = '16962/3' upa2 = '16962/23' ws = Workspace('https://ci.kbase.us/services/ws') d = ws.get_workspace_info({'id': wsid}) with open('get_workspace_info.json', 'w') as f: f.write(json.dumps(d)) d = ws.list_objects({'ids': [wsid]}) with open...
scanon/NarrativeIndexer
scripts/grab.py
grab.py
py
620
python
en
code
0
github-code
90
8028799704
import context import tensorflow as tf from deepswarm.backends import Dataset, TFKerasBackend from deepswarm.deepswarm import DeepSwarm # Load CIFAR-10 dataset cifar10 = tf.keras.datasets.cifar10 (x_train, y_train), (x_test, y_test) = cifar10.load_data() # Convert class vectors to binary class matrices y_train = tf.k...
Pattio/DeepSwarm
examples/cifar10.py
cifar10.py
py
1,286
python
en
code
309
github-code
90
17954579599
from matplotlib.ticker import (MultipleLocator, AutoMinorLocator) from pathlib import Path from pandas import read_csv, concat from DataPlot.data_processing import main from DataPlot.data_processing.Data_classify import state_classify, season_classify, Seasons import pandas as pd import matplotlib.ticker import numpy a...
Alex870521/DataPlot
DataPlot/scripts/diurnal_pattern.py
diurnal_pattern.py
py
2,932
python
en
code
1
github-code
90
27634286437
# _*_ coding:utf-8 _*_ import numpy as np import matplotlib.pyplot as plt from disposeData import * from sklearn.datasets import load_digits from sklearn.model_selection import learning_curve, ShuffleSplit from sklearn.naive_bayes import GaussianNB, MultinomialNB, BernoulliNB def demoOne(): X = np.array([[-1, -1]...
Manfestain/MLcombat
Bayes/withSklearn.py
withSklearn.py
py
3,114
python
en
code
1
github-code
90
38335410330
#!/usr/bin/python #-*- coding: UTF-8 -*- # BK Equation solver # Heikki Mäntysaari <heikki.mantysaari@jyu.fi>, 2011 # FT given datafile from k space to r space # Data is given in form # ktsqr N(ktsqr) # N(r) = r^2/(2\pi) \int d^2k exp(-i k.r) N(k) # As N(k)=N(ktsqr), # N(r) = r^2 \int dk k J_0(kr) N(k) # Filename is g...
hejajama/bk_momspace
plot_r.py
plot_r.py
py
1,200
python
en
code
0
github-code
90
5168614252
"""Vehicle model""" from app.db.database import Base from sqlalchemy import Column, String, ForeignKey from uuid import uuid4 class Vehicle(Base): """Vehicle class""" __tablename__ = "vehicles" id = Column(String(50), primary_key=True, default=uuid4, autoincrement=False) license_plate = Column(Strin...
dimiten/Car-workshop
app/vehicles/models/vehicle.py
vehicle.py
py
807
python
en
code
0
github-code
90
5572047002
from urllib import parse SAMPLE_URLS = ['http://mysite.com:80/demo/index.aspx', 'https://my-site.bg', 'https://mysite.bg/demo/search?id=22o#go', 'https://mysite:80/demo/index.aspx', 'somesite.com:80/search?', 'https/mysite.bg?id=2', 'http://softuni.bg/', 'https://softu...
VLD62/PythonWeb
03-HTTP-Protocol/Lab/02.Validate_url.py
02.Validate_url.py
py
1,574
python
en
code
1
github-code
90
26903746843
def geldige_zet(zet): output = False if len(zet) == 2 and ord('a') <= ord(zet[0]) <= ord('h') and int(zet[1]) <= 8: output = True elif len(zet) == 3 and ord('a') <= ord(zet[1]) <= ord('h') and int(zet[2]) <= 8 and zet[0] in ('K', 'T', 'D', 'L', 'P'): output = True return output def geld...
xander27481/informatica5
11 - Tuples/Schaakverslag.py
Schaakverslag.py
py
540
python
en
code
0
github-code
90
13173957406
from PyQt4.QtCore import * from PyQt4.QtGui import * import qgis.gui import qgis.core from ui.wdgSezCaratteristicheArchitettoniche_ui import Ui_Form from AutomagicallyUpdater import * class SezCaratteristicheArchitettoniche(QWidget, MappingOne2One, Ui_Form): def __init__(self, parent=None): QWidget.__init__(self...
faunalia/rt_omero
SezCaratteristicheArchitettoniche.py
SezCaratteristicheArchitettoniche.py
py
1,524
python
en
code
0
github-code
90
40178318489
from flask_jwt_extended import jwt_required, get_jwt_identity from flask import jsonify, request, current_app from app.models.user_model import UserModel from sqlalchemy.exc import IntegrityError from psycopg2.errors import UniqueViolation from app.exc import UserNotFound @jwt_required() def put_user_controller(): ...
Kenzie-Academy-Brasil-Developers/q3-sprint6-autenticacao-e-autorizacao-brunotetzner
app/controllers/put_user_controller.py
put_user_controller.py
py
960
python
en
code
0
github-code
90
33141972589
import sqlite3 import spiderBlog from flask import Flask, render_template, redirect, request app = Flask(__name__) # 首页信息 @app.route('/') @app.route('/index') def index(): conn = sqlite3.connect("blogDatabases") # 博客数量 for itemBlog in conn.cursor().execute("select count(*) from blogMsg"): print(...
pepsi-wyl/spider
app.py
app.py
py
2,179
python
en
code
1
github-code
90
46548959483
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @File : settings.py @Time : 2021/01/17 15:30:05 @Author : GuoRuilong @Version : 1.0 @Contact : firelong.guo@hotmail.com @Desc : None ''' # here put the import lib class Settings(): """存储《Alien Invasion》的所有设置的类""" def __init__(self): ...
gcc-coder/alien_invasion
settings.py
settings.py
py
788
python
en
code
0
github-code
90
14508434125
import numpy as np import psutil import rosgraph import rospy from ros_statistics_msgs.msg import NodeStatistics class NodeMonitor(object): """ Tracks process statistics of a PID. """ def __init__(self, name, uri, pid): """ :param str name: the registered node name :param str uri: th...
osrf/rosprofiler
src/rosprofiler/node_monitor.py
node_monitor.py
py
3,283
python
en
code
7
github-code
90
30003148705
# the IF keyword name = input("enter name: ") age = input("enter ur age:") if name == 'franklin' and age >= str(12): # if statement is ussed as a condition statement print("hello franklin") elif age < str(12): print('are not alice kiddo') else: print("done") # else Statements # An if clause can optionally ...
Franklin-tech01/python
automate the boring stuff python cousre/part2 (flow control with python)/flow control.py
flow control.py
py
1,815
python
en
code
1
github-code
90
23056304478
import numpy as np import scipy.stats as stats from python.cdf_coverage import cdf_coverage def test__true_density_has_uniform_coverage(): n_fail = 0 for _ in range(10): np.random.seed(12345) n_grid = 1001 n_test = 73 z_grid = np.linspace(-5,5,n_grid) z_test = np.random...
lee-group-cmu/cdetools
python/tests/test_cdf_coverage.py
test_cdf_coverage.py
py
605
python
en
code
10
github-code
90
28135301630
# Who : Roytravel # When : 2020.05.12 # Why : To check traffic in the vehicle named YF SONATA # How : Use pandas framework to handling matrix data # What : Analysis Tool # Where : Hacking and Countermeasure Response Lab import os import pandas as pd class DataFrame(object): def __i...
roytravel/Cybersecurity
08. CAN/can_dataframe_handler.py
can_dataframe_handler.py
py
2,544
python
en
code
0
github-code
90
15446364421
# # Computes the number of root finding iterations # Author: Frank Wefers (fwefers@fwefers.de) # import numpy as np from rootfinding import * from trajectory import * np.set_printoptions(precision=20, suppress=True) c = 343 t = np.linspace(-10, 10, 20*340) if False: # Dual car pass-by v = 30 # Source vel...
fwefers/publications-daga2017
Code/findNumIterations.py
findNumIterations.py
py
3,202
python
en
code
0
github-code
90
25588573714
from __future__ import print_function import datetime import json import os import sys import time import traceback import jwt import requests _GITHUB_API_PREFIX = "https://api.github.com" _GITHUB_REPO = "grpc/grpc" _GITHUB_APP_ID = 22338 _INSTALLATION_ID = 519109 _ACCESS_TOKEN_CACHE = None _ACCESS_TOKEN_FETCH_RETR...
grpc/grpc
tools/run_tests/python_utils/check_on_pr.py
check_on_pr.py
py
6,807
python
en
code
39,468
github-code
90
23630006153
#!/usr/bin/env python import csv import sys import re import math from parser_utility import * def main(): lift_off_time = 120.0 csv_gpsr_fileobj = open('gpsr_s_nav_tlm.csv', "rt", encoding="utf-8") csv_dm_fileobj = open('refine_log_nspo.csv', "rt", encoding="utf-8") out_file_name = "" if len(sys.ar...
ultype/Next-simulation
utilities/log_parser/combine_result_dm_and_gpsr_log.py
combine_result_dm_and_gpsr_log.py
py
3,744
python
en
code
0
github-code
90
13842457302
import threading import time import logging logging.basicConfig(level=logging.DEBUG, format='(%(threadName)-10s) %(message)s') def daemon(): logging.debug('Starting') time.sleep(2) logging.debug('Exiting') d = threading.Thread(name='daemon', target=daemon) d.setDaemon(True) def non...
Xayiide/Threading
PCA/Python/Daemons/daemon2.py
daemon2.py
py
759
python
en
code
0
github-code
90
261992375
import contextlib import logging from collections.abc import Sequence from types import TracebackType from elasticsearch import Elasticsearch from sqlalchemy.orm import Session from app.data_access import repositories from app.data_access.models import Place as PlaceModel from app.data_access.models import PlacesToEa...
xlurio/gee
app/data_access/unit_of_work.py
unit_of_work.py
py
3,438
python
en
code
0
github-code
90
19272009785
# the 'sed' function ''' def copyFileReplaceText(patternStr, replaceStr, fromFilename, toFilename): tryIt(open, fromFilename, "Error in opening FROM file") tryIt(open, toFilename, "Error in opening TO file") fromFile = open(fromFilename) # get content from the file toFile = open(toFilename, 'w') #...
statisticallyfit/Python
pythonlanguagetutorials/PythonTutorial/AllenBDowney_ThinkPython2/exercises/Exercise14.1_filerepl.py
Exercise14.1_filerepl.py
py
1,782
python
en
code
0
github-code
90
10150114808
import tensorflow as tf Input_Node = 588 Output_Node = 2 Layer1_Node = 500 def get_weight_varible(shape, regularizer): weight = tf.get_variable( "weight", shape, initializer=tf.truncated_normal_initializer(stddev=0.01) ) if(regularizer is not None): tf.add_to_collection( ...
SagacitySucura/Machine_Learning
full_connected/mnist_inference.py
mnist_inference.py
py
1,056
python
en
code
0
github-code
90
18438510679
import sys input = lambda: sys.stdin.readline().rstrip() import math N, M = map(int, input().split()) def find(x): if parents[x] < 0: return x else: parents[x] = find(parents[x]) return parents[x] def union(x,y): x = find(x) y = find(y) if x == y: return if p...
Aasthaengg/IBMdataset
Python_codes/p03108/s836132160.py
s836132160.py
py
900
python
en
code
0
github-code
90
23751911578
import discord from discord.ext import menus from ...util import SetupVars from ..embed import Embed class Warns(menus.Menu): def __init__(self, bot, timeout, channel): super().__init__(timeout=timeout) self.bot = bot self.channel = channel async def send_initial_message(self, ctx, c...
Pagasis/yondaime-hokage
minato_namikaze/bot_files/lib/classes/setup/warns.py
warns.py
py
2,093
python
en
code
null
github-code
90
29008739245
import json import gzip import redis import sys def main(): db = redis.Redis(host='localhost', port=6379, db=1) with gzip.open('../artist.json.gz', 'r') as f: for i,line in enumerate(f): info = json.loads(line.decode()) if 'tags' in info: db.set(info['name'], inf...
aikuma0130/NLP100
Chapter7/63/kvs_construction.py
kvs_construction.py
py
445
python
en
code
0
github-code
90
29702441832
# 写文件 with open(r'F:\黑马Python21期基础班\Crack_Wifi\dict.txt','w') as file: # 循环生成6位数字密码 # rangeList = [0, 1, 2, 3, 4, 5 ,6, 7, 8, 9] for i in range(10000): a = '1994'+str(i).zfill(4) # print(a) file.write(a + '\n') file.flush() print('生成完成!')
Bngzifei/PythonNotes
学习路线/1.python基础/Crack_Wifi/9.生成密码字典.py
9.生成密码字典.py
py
296
python
en
code
1
github-code
90
18406093489
class UnionFindTree: def __init__(self, n): self.nodes = [-1] * n #根にサイズを負の値で格納する。 def find(self, i): if self.nodes[i] < 0: #値が負の場合は根 return i else: self.nodes[i] = self.find(self.nodes[i]) #縮約 return self.nodes[i] def union(self, i, j): i...
Aasthaengg/IBMdataset
Python_codes/p03044/s627797280.py
s627797280.py
py
1,200
python
ja
code
0
github-code
90
8739005521
import itertools import numpy as np import torch from torch import nn # 从历史销售数据中,利用1D卷积,提取时序特征 # 并将此时序特征作为当前订单的部分输入 class HistoryFeature(nn.Module): def __init__(self, input_shape, out_channels, ks, ds, output_size, dropout=0.1): """ input_shape: [730*17], 前者为天数,后者为每天各票价等级的销售量 out_channels...
PeppaBaby/Airline-Mutli-Task-Learning
modules/HistoryFeature.py
HistoryFeature.py
py
2,495
python
zh
code
1
github-code
90
18323292599
from collections import defaultdict n=int(input()) d=list(map(int,input().split())) mod=998244353 if d[0]!=0: print(0) exit() dd=defaultdict(lambda:0) for di in d: dd[di]+=1 if dd[0]>1: print(0) exit() ans=1 for i in set(dd.keys()): if i==0: continue ans*=(dd[i-1]**...
Aasthaengg/IBMdataset
Python_codes/p02866/s007328287.py
s007328287.py
py
345
python
en
code
0
github-code
90
11831781750
import tkinter as tk import matplotlib.pyplot as plt import numpy as np import torch from PIL import ImageTk, Image from tkinter.filedialog import askopenfilename import cv2 import os import json from PIL import ImageDraw def ic_detect(): "insert file" filepath = askopenfilename( filety...
jovincc/ObjectDetection
FYP.py
FYP.py
py
8,507
python
en
code
0
github-code
90
26376442354
#!/usr/bin/env python # coding: utf-8 top = '.' out = 'build' from waflib import Utils import imp def waftool(name): return imp.load_module('waf_' + name, *imp.find_module(name, ['./latticetester/waftools'])) version = waftool('version') compiler = waftool('compiler') deps = waftool('deps') def options(ctx): ...
umontreal-simul/latnetbuilder
wscript
wscript
5,211
python
en
code
15
github-code
90
17922189306
#!/usr/bin/env python import os from trackutil.confutil import get_config from trackutil.ioutil import jsondump, jsonload from trackutil.pathutil import mkdir, get_datafiles_in_dir from trackutil.pathutil import get_storyline_module_dir from trackutil.logger import LOG, INFO def bucketize(): ''' This functio...
shiguangwang/storyline
storyline/bucketize.py
bucketize.py
py
2,895
python
en
code
0
github-code
90
18441332489
a,b,q = map(int, input().split()) s = [int(input()) for i in range(a)] t = [int(input()) for i in range(b)] import bisect for i in range(q): s2 = 10**12 t2 = 10**12 qq = int(input()) sp = bisect.bisect(s,qq) tp = bisect.bisect(t,qq) s1 = s[sp-1] if sp <a: s2 = s[sp] t1 = t[tp...
Aasthaengg/IBMdataset
Python_codes/p03112/s250676557.py
s250676557.py
py
593
python
en
code
0
github-code
90
9512412647
from __future__ import annotations from timeit import default_timer as timer import numpy as np import matplotlib.pyplot as plt class Parser: instructions = None def __init__(self, day: int): input_file = open(f"input_{day}.txt", 'r') input_lines = [line.strip().split(' ') for line in input...
iptch/2023-advent-of-code
DHE/day18_graphic.py
day18_graphic.py
py
4,348
python
en
code
2
github-code
90
70388779818
#################### # Simulation Constants #################### # Number of simulations NUMBER_OF_SIMULATIONS = 2 # Directories OUT_DIR = 'out' PLOT_DIR = 'plot' ROUTE_DIR = 'route' CFG_DIR = 'cfg' TL_DIR = 'traffic-lights' TL_FILE = 'traffic_light' # Simulation X_OPTION = 'time' Y_OPTION = 'meanWaitingTime' OUTPUT...
lorenzocesconetto/sumo-traffic
sumoTools/Constants.py
Constants.py
py
2,023
python
en
code
0
github-code
90
72758834538
n = int(input()) for i in range(n): s = input() s = s.lower() #l_alp = list(alp) # for z in range(len(alp)//2): # if alp[z] == alp[-1-z]: # print("#%d YES" %(i+1)) # break # else: # print("#%d NO" %(i+1)) size = len(s) for j in range(size//2): ...
chlendyd7/Algorithm
inflearn/파이썬 알고리즘 문제풀이(코딩테스트 대비)/섹션 3/1. 회문 문자열 검사/AA.py
AA.py
py
699
python
ko
code
0
github-code
90
44570488626
from urllib import response import apikey import requests API_KEY = apikey.api_key() Base_url ="http://api.openweathermap.org/data/2.5/weather" while True : city_name = input("Enter a City Name : ") user_need = input("Type to get specific information about : weather / main / wind...
SnehaG24/Weather_Fetcher
ExperimentCode.py
ExperimentCode.py
py
1,249
python
en
code
0
github-code
90
22402946443
""" Sandbox """ #!/usr/bin/env python3 import numpy as np import matplotlib.pylab as plt import scipy from scipy.stats import chi2 def symdiff(): """ Symbolic diff """ from sympy import exp from sympy import log from sympy import sqrt from sympy import symbols from sympy import diff s = symbols("s") ...
chutsu/yac
scripts/sandbox.py
sandbox.py
py
2,721
python
en
code
34
github-code
90
16340523031
from flask_restful import Resource, reqparse from flask_jwt import jwt_required from models.item import ItemModel class ItemList(Resource): def get(self): return {"items": [item.json() for item in ItemModel.query.all()]} # connection = sqlite3.connect("data.db") # cursor = connection.curso...
pbohora/flask-app
api/resources/item.py
item.py
py
2,521
python
en
code
0
github-code
90
18279416009
h,n = map(int,input().split()) P = [] M = [] for i in range(n): p,m = map(int,input().split()) P.append(p) M.append(m) dp=[[999999999]*(h+1) for _ in range(n+1)] dp[0][0] = 0 for i in range(n): for j in range(h+1): dp[i+1][j] = min(dp[i+1][j],dp[i][j]) dp[i+1][min(j+P[i],h)] = mi...
Aasthaengg/IBMdataset
Python_codes/p02787/s648326017.py
s648326017.py
py
382
python
en
code
0
github-code
90
15604509513
#helloworld #secgrado.py #Algoritmo che risolve equazioni di secondo grado nella forma "aX^2+bX+c=0". import math #Libreria "math" (matematica) a = input("Inserisci il valore dell'incognita di secondo grado: ") #Input dell'incognita a = int(a) #Cast al tipo "int" (intero) b = input("Inserisci il valore dell'incognit...
RuggieroB/helloworld
secgrado.py
secgrado.py
py
2,529
python
it
code
1
github-code
90
7040606689
import pygame BOARD_COLOR = (150, 150, 200) def game_board(screen): pygame.draw.line(screen, (35, 9, 56), (0, 0), (0, 400), 5) pygame.draw.line(screen, (35, 9, 56), (100, 0), (100, 400), 5) pygame.draw.line(screen, (35, 9, 56), (200, 0), (200, 400), 5) pygame.draw.line(screen, (35, 9, 56), (300, 0), (...
seth174/2048-game
gui.py
gui.py
py
3,455
python
en
code
0
github-code
90
6906211527
from django.contrib.auth.models import User from django.db import models class UserProfile(models.Model): ROLE_CHOICES = ( ('SA', 'Super Admin'), ('AD', 'Admin'), ('US', 'User'), ) user = models.OneToOneField(User, on_delete=models.CASCADE) role = models.CharField(ma...
Pratik-Sondawale/CRUD-for-Vehicle-management-Django
CRUD for Vehicle management Django/vehicle_management/user_management/models.py
models.py
py
416
python
en
code
0
github-code
90
21307196538
from pwn import * # pip install pwntools import json import codecs import base64 from Crypto.Util.number import bytes_to_long, long_to_bytes from helper import * if __name__ == '__main__': r = remote('socket.cryptohack.org', 13377, level='debug') for _ in range(100): received = json_receive(r) ...
samoersnaes/cryptohack
general/misc/encoding/s13377helper.py
s13377helper.py
py
1,018
python
en
code
1
github-code
90
9534718194
import re from twisted.python import usage from ConfigParser import SafeConfigParser class Options(usage.Options): optParameters = [['config', 'c', './config.ini']] #---------------------------------------------------------------------------# # A custom class to read config files #--------------------------------...
frellwan/SciFy-Pi
Serial/df1/utilities.py
utilities.py
py
8,495
python
en
code
0
github-code
90
18033996549
x, y = map(int, input().split()) ans = 0 x2 = -x y2 = -y L = [y - x, y - x2, y2 - x, y2 - x2] Labs = [abs(y - x), abs(y - x2), abs(y2 - x), abs(y2 - x2)] ans += min(Labs) i = L.index(min(Labs)) if i == 1 or i == 2: ans += 1 elif i == 3: ans += 2 print(ans)
Aasthaengg/IBMdataset
Python_codes/p03838/s645945993.py
s645945993.py
py
265
python
en
code
0
github-code
90
11164234044
import tkinter as tk import subprocess import os class Menu(tk.Tk): def sound(self): cmd = "pkill -9 -f soundtest.py" os.system(cmd) cmd = "python3 /home/user/tools/soundtest.py" subprocess.Popen(cmd.split(" "), shell=False) #cmd = "pkill -9 -f ffplay" #os.system(cm...
VerEnderT/InfoKasten
xtk/menu.py
menu.py
py
3,424
python
en
code
0
github-code
90
40026433026
class Solution(object): def rob(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums)==0: return 0 dp=list() for n in nums: if len(dp)==0: dp.append(n) elif len(dp)==1: dp.append...
lanpartis/LeetCodePractice
198.py
198.py
py
423
python
en
code
0
github-code
90
18247133319
import scipy.misc N, M = map(int, input().split()) ansN = 0 ansM = 0 if N != 1: ansN = N*(N-1)/2 if M != 1: ansM = M*(M-1)/2 ans = int(ansN+ansM) print(ans)
Aasthaengg/IBMdataset
Python_codes/p02729/s635158976.py
s635158976.py
py
165
python
en
code
0
github-code
90
27176913811
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def main(A: set, B: set, C: set, D: set) -> str: U = set("abcdefghijklmnopqrstuvwxyz") X: set = (A.intersection(C).union(B.intersection(C))) nB: set = U.difference(B) Y: set = (A.intersection(nB).union(D.difference(C))) return f"X = {X}\nY = {Y}...
sa1vador777/BSE10
task_individual.py
task_individual.py
py
540
python
en
code
0
github-code
90
35985176155
import numpy as np import matplotlib.pyplot as plt times=np.linspace(0,500,10000) omega_1 = 0.1 #Rabi frequency of the driving field E_g=[] E_e=[] for i in times: T=500 delta = -1+2*i/T # detuning of the |g>-|e> transition sigmax = np.array([[0, 1], [1, 0]]) sigamz = np.array([[1, 0],...
zzh-cycling/Quantum_computation
eigenenergy_calculation.py
eigenenergy_calculation.py
py
745
python
en
code
2
github-code
90
13090580775
from math import floor class TreeNode: def __init__(self, data): self.right = None self.data = data self.left = None class Solution: def inorderTraversal(self, root, inTrav): if (root): self.inorderTraversal(root.left, inTrav) inTrav.append(root.data) ...
magdumsuraj07/data-structures-algorithms
questions/love_babbar_DSA_sheet/binary_search_tree/207_merge-two-BST.py
207_merge-two-BST.py
py
1,867
python
en
code
0
github-code
90
38039868019
# pgm is for binary sorting gaja=-1 def search(shilpa,f): l=0 u=d while l<u: mid=(l+u)//2 if shilpa[mid]==f: globals()['gaja']=mid return 1 else: if shilpa[mid]<f: l=mid+1 el...
hemapython/2ndnewlife
46.py
46.py
py
563
python
en
code
0
github-code
90
39573856736
""" Utils functions for the memory two step task data munging Functions: create_sub_dict(subnum,df) create_fit_df(subnum,df) create_sub_background_df(sub_dict,subnum,df) create_sub_sliders_df(sub_dict,subnum,df) create_state1_sorted_sliders(sub_dict,subnum,df) create_state2_sorted_sliders(sub_dict,subnum,df) create_sta...
cdm-lab/mb-cog-maps-paper
src/utils/utils.py
utils.py
py
12,840
python
en
code
2
github-code
90
73498882215
import unittest from unittest.mock import Mock, MagicMock from typing import Any, DefaultDict, Set, Callable from queue import Queue from collections import defaultdict from python_ledbox.events import Event, Signal, MouseEvent as ME, EventManager class TestEvents(unittest.TestCase): def setUp(self): """...
felixulmn/python_ledbox
tests/events/test_Events.py
test_Events.py
py
2,979
python
en
code
0
github-code
90
40641353574
import itertools import sys from datetime import datetime from datetime import timedelta import pandas as pd from scrapers_bots import * from storage_functions import * username = sys.argv[1] password = sys.argv[2] followed_list_path = sys.argv[3] following_list_path = sys.argv[4] unfollowed_list_path = sys.argv[4] d...
lebro-23/SocialMediaBots
Unfollower/run_unfollow_users.py
run_unfollow_users.py
py
3,936
python
en
code
3
github-code
90
40429588700
# Laajenna ohjelmaa siten, että mukana on kulje-metodi, joka saa parametrinaan tuntimäärän. # Metodi kasvattaa kuljettua matkaa sen verran kuin auto on tasaisella vauhdilla annetussa tuntimäärässä edennyt. # Esimerkki: auto-olion tämänhetkinen kuljettu matka on 2000 km. Nopeus on 60 km/h. # Metodikutsu auto.kulje(1.5) ...
elenabli/kokeilut
Moduuli9/3.py
3.py
py
1,332
python
fi
code
0
github-code
90
22207488508
""" # Definition for a Node. class Node(object): def __init__(self, val, children): self.val = val self.children = children """ class Solution(object): def levelOrder(self, root): """ :type root: Node :rtype: List[List[int]] """ res = [] que = coll...
Eurus-Holmes/LCED
N-ary Tree Level Order Traversal.py
N-ary Tree Level Order Traversal.py
py
766
python
en
code
11
github-code
90
17110366218
import time import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm import torch import torch.nn as nn import torch.optim as optim from torchvision.utils import make_grid from ..model.pix2pix import Generator, Discriminator device = torch.device('cuda') patch = (1, 32, 32) lr = 0.0002 beta1 = 0.5 be...
project-flooming/Flooming-DeepLearning
train/pix2pix_train.py
pix2pix_train.py
py
3,895
python
en
code
1
github-code
90
42680812198
import cv2 from libs.number_recog import NumberRecog recog = NumberRecog('puzzles/example.png') number_extracts = recog.getRegions() for extract in number_extracts: path = 'numbers/%i.png' % (extract.getPosition()[1] + 1) cv2.imwrite(path, extract.getImage())
Flythe/sudoku-solver
create_number_files.py
create_number_files.py
py
273
python
en
code
0
github-code
90
34838402254
# Dependencies import serial import serial.tools.list_ports # Class class SerialPython: # Class members _selected_port = '' _ports = [] _ser = 0 def __init__(self, select='COM0') -> None: ''' Manually selects the Serial port ''' self._selected_port = select pass def ...
DIEGOVZK/ICDT
UI/src/Serialport.py
Serialport.py
py
1,605
python
en
code
2
github-code
90
70978696616
from access_db import get_pa_animal # ------------------------- UTILS ------------------------- # # Function to delete tuples inside a list and convert to a list def dissolve_inTuple(dest_array, orig_array): for item in orig_array: dest_array.append(item) # Function to join in a list tuples that contain...
carlosperales95/LabResourcer
utils.py
utils.py
py
1,240
python
en
code
0
github-code
90
28790827645
import pandas as pd import numpy as np df = pd.read_csv("googleplaystore.csv") def correction_row_10472(df): col_ls = list(df.columns) row_10472 = np.where(df.Size == "1,000+")[0][0] for i in range(len(col_ls[2:])): df[col_ls[len(col_ls) - (i + 1)]][row_10472] = df[col_ls[len(col_ls) - (i + ...
sciucca8/Python_PracticeAndMore
Data_Engeneering/Google_PlayStore/DB_Rating_Cleaning.py
DB_Rating_Cleaning.py
py
651
python
en
code
0
github-code
90
18069617529
import bisect import copy import heapq import math import sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) sys.setrecursionlimit(500...
Aasthaengg/IBMdataset
Python_codes/p04034/s843410277.py
s843410277.py
py
699
python
en
code
0
github-code
90
7172360277
#Створи власний Шутер from pygame import * from random import randint mixer.init() mixer.music.load("space.ogg") from time import time as timer fire_sound = mixer.Sound("fire.ogg") img_back ="galaxy.jpg" img_rocket = "rocket.png" life = 3 font.init() font1 = font.SysFont("Arial", 80) font2 = font.SysFont("Arial", 40...
Whyfe/shoter_game-
shooter_game.py
shooter_game.py
py
5,168
python
en
code
0
github-code
90
4950888187
from django.contrib import admin from django.contrib.auth import admin as auth_admin from django.contrib.auth import get_user_model from django.utils.translation import gettext_lazy as _ from thewings_backend.users.forms import UserAdminChangeForm, UserAdminCreationForm from django.contrib.auth.admin import UserAdmin ...
An-Tran-2001/The_Wings_0.1.0
thewings_backend/users/admin/user.py
user.py
py
1,933
python
en
code
1
github-code
90
6560648822
#!/usr/bin/env python3 import os import sys import re try: import rust_demangler except ImportError: print("WARN: rust_demangler not installed, skipping demangle", file=sys.stderr) def error(msg): print(msg, file=sys.stderr) def demangle(name: str): try: return rust_demangler.demangle(name...
seungjulee/secret-md-substrate
standalone/pruntime/scripts/check-instructions.py
check-instructions.py
py
5,789
python
en
code
5
github-code
90
18160690169
str = input() text = input() ans = len(text) for i in range(len(str) - len(text) + 1): dif = 0 for j in range(len(text)): if not str[i+j] == text[j]: dif += 1 ans = min(ans, dif) print(ans)
Aasthaengg/IBMdataset
Python_codes/p02571/s547922972.py
s547922972.py
py
222
python
en
code
0
github-code
90
5824234418
Lista_articulos = [] switch = True while switch == True: print("NEGOCIO DE FERRRETERIA") print("\n MENU \n") print("\n1.-REGISTRAR UNA VENTA\n") print("\n2.-CONSULTAR VENTA\n") print("\n3.-SALIR \n") eleccion = int(input("\nIngresa la opccion que deses realizar: ")) if elec...
CristianGarcia7236/Estructura-de-datos-
Evidencia 1 Progra #3.py
Evidencia 1 Progra #3.py
py
2,287
python
es
code
0
github-code
90
16656447471
''' Common functions need to be used in the project i.e.: confusion matrix, labeling, plot of results, error measure ''' import numpy as np import matplotlib.pyplot as plt import itertools from sklearn import metrics def readFile(path): import numpy as np file = np.genfromtxt(path,delimiter=',') feature...
whosyourfarmer/machine_learning
Classification/CommonClf.py
CommonClf.py
py
4,362
python
en
code
0
github-code
90
18469668949
n=int(input()) a=[int(input()) for _ in range(n)] flag=0 for aa in a: if aa%2==1: flag=1 if flag==0: print("second") else: print("first") ###1個 #111 #奇数ならfirst 偶数ならsecond ###2個 #111 #111 #奇数奇数ならfirst #11 #11 #偶数偶数ならsecond #
Aasthaengg/IBMdataset
Python_codes/p03197/s448075453.py
s448075453.py
py
296
python
ja
code
0
github-code
90
37615859464
import sys import irc.bot import requests request_number = 0 now_song = 0 song_name = [] userlist = [] class TwitchBot(irc.bot.SingleServerIRCBot): def __init__(self, username, client_id, token, channel): self.client_id = client_id self.token = token self.channel = '#' + ch...
kur0numa/chat_bot
djmax_request_bot.py
djmax_request_bot.py
py
7,662
python
ko
code
0
github-code
90
33769439227
# write your Python code here according to the instructions ## import the csv module import csv def get_csv_data(filepath): """ Opens the file at filepath, reads the data using the csv module's DictReader, converts that data to a regular list containing a dictionary for each row of data in the CSV file ...
seanjkk/data-science-21
assignment-1/solution.py
solution.py
py
7,211
python
en
code
0
github-code
90
31188704335
# -*- coding: utf-8 -*- """ Created on Sun Apr 28 14:03:03 2019 @author: Somil """ from colordescriptor import ColorDescriptor import argparse import glob import cv2 ap = argparse.ArgumentParser() ap.add_argument("-d", "--dataset", required = True, help = "Path to the directory that contains the image...
cw-somil/Image-Search-Engine
ime.py
ime.py
py
1,006
python
en
code
0
github-code
90
31430616103
import io import os import json import sys from PIL import Image, ImageSequence import numpy as np gif_black_pixel = [4, 2, 4] black_pixel = [0, 0, 0] white_pixel = [255, 255, 255] letters = "bcefghjkmpqrtvwxy2346789" golden = {} for filename in os.listdir("golden"): if not filename.endswith(".png"): cont...
z3dd1cu5/1p3a-signin
vcode.py
vcode.py
py
3,342
python
en
code
0
github-code
90
28542468017
import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn import GCNConv, global_add_pool, global_mean_pool, global_max_pool, global_sort_pool, BatchNorm class GCN(torch.nn.Module): def __init__(self, in_channels, hidden_channels, out_channels, num_layers, dropout)...
cosmina98/PhD
2022/Oct/OGN_multi_class_protein/gcn.py
gcn.py
py
1,123
python
en
code
0
github-code
90
18296021379
X=int(input()) ans=0 for i in range(X,10**5+100): cond=True for j in range(2,int(i**0.5)+1): if i%j==0: cond=False break if cond: ans=i break print(ans)
Aasthaengg/IBMdataset
Python_codes/p02819/s196104745.py
s196104745.py
py
213
python
en
code
0
github-code
90
32782271167
#!/usr/bin/python from distutils.core import setup, Extension module2 = Extension('lvasrmodule', sources = ['lvasrmodule.c'], library_dirs=['/usr/lib64'], libraries=['lv_lvspeechport','python2.6'], include_dirs=['/usr/include']) setup(name='lvasrmodule', version='1.0', description = 'Python Interface for LumenVox ...
wolfpaulus/lumenvox-python-bridge-sre
setup.py
setup.py
py
350
python
en
code
2
github-code
90
11172912140
from django.contrib.auth.models import User from django.forms.formsets import formset_factory from django.template.defaultfilters import slugify from django.test import Client from mock import patch from rapidsms.contrib.locations.models import LocationType, Location from survey.forms.location_details import LocationDe...
unicefuganda/mics
survey/tests/views/test_location_hierarchy_view.py
test_location_hierarchy_view.py
py
14,444
python
en
code
2
github-code
90
28239463724
from JSONToYAML import start_time1, end_time1 def TimeToTask(start, end): return (end - start) * 100 t1 = TimeToTask(start_time1, end_time1) print("Время выполнение первой программы: ", t1) from Dop1 import start_time2, end_time2 t2 = TimeToTask(start_time2, end_time2) print("Время выполнение второй программы: "...
BushmelevKostya/ITMO
Информатика/лаб4/lab4/Dop3.py
Dop3.py
py
549
python
ru
code
0
github-code
90
72555424298
import queue import threading import time from invesalius import constants from invesalius.pubsub import pub as Publisher class SerialPortConnection(threading.Thread): def __init__(self, com_port, baud_rate, serial_port_queue, event, sleep_nav): """ Thread created to communicate using the serial...
invesalius/invesalius3
invesalius/data/serial_port_connection.py
serial_port_connection.py
py
3,240
python
en
code
536
github-code
90
41683575242
import getopt import math import os import sys from PIL import Image, ImageSequence m_name = 'picjoint' m_version = 'v0.01' directions = ['TB', 'BT', 'LR', 'RL'] file_types = ['.jpeg', '.jpg', '.png', '.gif', '.webp','.apng'] image_modes = ['1', 'L', 'P', 'RGB', 'RGBA', 'CMYK'] message_help = '%s %s usage:' % (m_na...
Delsart/picjoint
index.py
index.py
py
7,552
python
en
code
3
github-code
90
38875602607
# # @lc app=leetcode id=141 lang=python3 # # [141] Linked List Cycle # # @lc code=start # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def hasCycle(self, head: ListNode) -> bool: if head is None or head.n...
dtr-beast/Data-Structures-and-Algorithms
LeetCode/Python/141.linked-list-cycle.py
141.linked-list-cycle.py
py
700
python
en
code
0
github-code
90
42890137087
# -*- coding: utf-8 -*- """ Created on Wed Dec 15 13:31:16 2021 @author: WINDOWS 10 """ import json import pyarrow.lib as _lib import matplotlib.pyplot as plt import numpy as np import pandas as pd import streamlit as st f = open ("C:\\Users\\WINDOWS 10\\Kuliah\\kode_negara_lengkap.json") file_json = ...
NashifAdham/UAS
tes.py
tes.py
py
6,463
python
id
code
0
github-code
90
35830743338
# -*- coding:utf-8 -*- import xml.etree.ElementTree as et import os import shutil def get_file_id(file_name): return "_".join(file_name.split("_")[0:2]) def filter_deviation(): deviation_list = ["007_05", "008_03", "029_16", "048_13", "057_01", "072_04", "077_14", "080_03", "121_09", "...
Panda96/RBPMI
preprocess/spliter.py
spliter.py
py
6,842
python
en
code
0
github-code
90
18313861459
N = int(input()) ad = {} status = {} edge=[] for n in range(N): ad[n+1]=set([]) status[n+1] = -1 for n in range(N-1): a,b = list(map(int,input().split())) edge.append((a,b)) ad[a].add(b) ad[b].add(a) color = set([]) parent = [0] * (N+1) ans={} #BFS from collections import deque sta...
Aasthaengg/IBMdataset
Python_codes/p02850/s329267653.py
s329267653.py
py
903
python
en
code
0
github-code
90
74785351337
class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def reverseBetween(self, head, m, n): if(head==None): return firstPoint = None toReturn=head for i in range(m - 1): firstPoint = head head =...
codejigglers/leetcodes
Reverse_Linked_List_II.py
Reverse_Linked_List_II.py
py
1,152
python
en
code
0
github-code
90
23083500300
import random random.seed() lletra = random.choice("ABCDEFGHIJKLMNOPQRSTUVWXYZ") print(lletra) paraula = input("Paraula: ") llista = [] c = 0 punts = 0 while lletra != paraula[0] or paraula not in llista: llista.append(paraula) paraula = input("Paraula: ") for i in llista: while c < len(i): c += 1 ...
mgarcia003/Programacio
UF1/diccionaris 2/ex4.py
ex4.py
py
406
python
ca
code
0
github-code
90
7023269562
## @package datatypes # This module defines zappy classes ## ## EPITECH PROJECT, 2022 ## zappy [WSL: Ubuntu] ## File description: ## datatypes.py ## import server_action as sa import server_get as sg import communication as com import uuid from time import time # class for a creature class Creature: # Enum to d...
Chasfory/Zappy
zappy_ai/datatypes.py
datatypes.py
py
3,383
python
en
code
0
github-code
90
18279448292
from time import sleep from pyautogui import press,click from webbrowser import open from urllib.parse import quote from termcolor import colored from people import people from utils import * # Function stolen (but adapted) from pywhatkit https://github.com/Ankit404butfound/PyWhatKit def instantmsg(phone_no: str, mess...
jramosss/diffuser
main.py
main.py
py
1,268
python
en
code
1
github-code
90
73442668455
import os import sys import random import math import re import time import numpy as np import tensorflow as tf import matplotlib import matplotlib.pyplot as plt import matplotlib.patches as patches import utils import visualize from visualize import display_images import model as modellib from model import log # Ro...
priyanka-chaudhary/flood_level_instance
test/pred/vis_res.py
vis_res.py
py
6,535
python
en
code
1
github-code
90