blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
d4705d200ae0c1f9afeb641e3b0d194df711e406
Clay317/Python-Fun
/left_join_pandas.py
UTF-8
288
2.625
3
[]
no_license
import pandas as pd pc = pd.read_csv(r"<path to main file>") hm = pd.read_csv(r"<path to file we want to join>") join = pd.merge(left=pc,right=hm,how='left', indicator=True, left_on='person_identifier', right_on='person_identifier') join.head() join.to_csv(r"<path to destination>")
true
3d16e0c3fe3faf4f99e18827c5ce7b09d4b08585
Comyn-Echo/leeCode
/opengl入门/plotlib/main.py
UTF-8
5,592
2.59375
3
[]
no_license
from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * import numpy as np import axis import figure import plot IS_PERSPECTIVE = False # 透视投影,因为现在是绘制数据分析图,不用这玩意 VIEW = np.array([-1.1, 1.1, -1.1, 1.1, 0, 20.0]) # 视景体的left/right/bottom/top/near/far六个面 SCALE_K = np.array([1.0, 1.0, 1.0]) # 模型缩放比例 ...
true
8c0e967670ad7d56e99a422b9827db3e6ff45d1e
ChubYury/wc_start
/server/markup/views.py
UTF-8
750
2.578125
3
[ "MIT" ]
permissive
from django.views.generic import TemplateView from composable_views.mixins.url_build import UrlBuilderMixin class PageTemplate(UrlBuilderMixin, TemplateView): """ Retreives current path from the root, and renders an apropriate template. If path is ends with `.html` - this means that a markup develope...
true
b7a2901dd28c2b8c75780f2b21da9e563b376b0b
kz2d/python_project
/jupiter/NN.py
UTF-8
3,113
2.640625
3
[]
no_license
from math import exp import random class NN: def __init__(self,cof, inpNeuron, outpNeyron, *shadowNeyron ):#горизонт- входящие вертикаль- выходящие self.coficent=cof d=[inpNeuron,*shadowNeyron,outpNeyron] self.wes=[self.ArrayS(d[i]+1,d[i+1]) for i in range(len(d)-1)] self....
true
82053dc8a243883159a9e8e857c34cf69e1c1a93
vincentmanna/Introprogramming-Labs
/pi.py
UTF-8
293
3.8125
4
[]
no_license
def main(): import math n = int(input("Enter a number: ")) total=0 for i in range(1,n): total += (-1)**(i+1)*((1.0/(i+i+1))) value = 4*(1-total) print(value) #subtracting xx = (math.pi - value) print('Lets see how close we are to pi:', xx) main()
true
2cc28701b35728f1e96c275d1f2015af97aed233
caroAlvim/seguranca_informacao
/src/RegistroAcesso.py
UTF-8
635
3.125
3
[]
no_license
import os import stat def registrar_acesso(email, date_and_hour): # Criar o arquivo Acesso arquivo = open("acesso.txt", "a") os.chmod("acesso.txt", stat.S_IRWXU) # Escreve no arquivo, email e data e hora arquivo.write(email + "\n") arquivo.write(str(date_and_hour) + ...
true
e8bdd64f6ace40bed4af7c44b409f8ec9f5f101c
Jim-Holmstroem/KeyboardMPC
/keyboardmpc.py
UTF-8
788
2.859375
3
[]
no_license
import Tkinter as tk import itertools as it import pyglet import pygame pygame.init() import os SAMPLE_DIRECTORY = 'samples/' sorted_keys = "qwertyuiop[]asdfghjkl;'zxcvbnm,./1234567890-=QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?" samples = sorted([ os.path.join(SAMPLE_DIRECTORY, f) for f in os.listdir(SAMPLE_DIRECTORY) if ...
true
ceaa0fc09eb01b61a000d7e824c687590f7d90aa
sheffie/Dataquest-Projects
/Proj10 - exploring data via sqlite/area.py
UTF-8
354
2.84375
3
[]
no_license
import sqlite3 import pandas as pd import math conn = sqlite3.connect('factbook.db') query_water = "select SUM(area_water) from facts where area_land > 0" area_water = conn.execute(query_water).fetchone() query_land = "select SUM(area_land) from facts where area_land > 0" area_land = conn.execute(query_land).fetchone()...
true
b2ad124916df558adaccf67f362e5fff4ccb0885
JannaKim/PS
/z수업용문제/10886_cute.py
UTF-8
169
3.515625
4
[]
no_license
n =int(input()) vote= [0]*2 for _ in range(n): a= int(input()) vote[a]+=1 if vote[0]>vote[1]: print('Junhee is not cute!') else: print('Junhee is cute!')
true
75d44acfb004c015832e1ad3426a905f11dc1d9f
dylan-lee94/time-series-analysis
/value_at_risk/functions.py
UTF-8
151
2.6875
3
[ "MIT" ]
permissive
#%% import numpy as np def VAR(r,alpha): return -np.quantile(r,alpha) def CVAR(r,alpha): return -np.mean(r[r <= np.quantile(r,alpha)])
true
f11f66fd52959331035b773c56223ea8f753d65d
seb5666/graph_neural_networks
/svm.py
UTF-8
2,116
2.6875
3
[]
no_license
from utils import load_data import numpy as np from sklearn.svm import SVC dataset = 'pubmed' adj, features, y_train, y_val, y_test, train_mask, val_mask, test_mask = load_data(dataset) num_nodes = adj.shape[0] num_features = features.shape[1] num_classes = y_train.shape[1] print(y_train.shape) print(train_mask.sh...
true
534c587d5b0f919479ad4240603d370f516de644
mrbod/pycan
/pycan/biscan_conv.py
UTF-8
408
2.546875
3
[]
no_license
#!/usr/bin/env python import sys from pycan import canmsg canmsg.format_set(canmsg.FORMAT_BICAN) def convert(f): for L in f: try: m = canmsg.CanMsg.from_biscan(L) yield m except Exception as e: sys.stderr.write(str(e) + '\n') def main(): try: for m ...
true
b58b00eb7e75be82275e64f9b96dddaf958746a8
nilavann/HackerRank
/Python/Errors and Exceptions Challenges/Incorrect Regex.py
UTF-8
145
2.828125
3
[]
no_license
#!/bin/python3 import re for _ in range( int( input())): try: print( bool( re.compile( input()))) except: print( "False")
true
03da6ea5473fb28d0d00842eddd0ed24b3ebf9e9
jrfalou/UdacityRL
/Navigation/time_analysis.py
UTF-8
1,600
2.703125
3
[]
no_license
from enum import Enum import datetime class RunType(Enum): unknown = 0 full_training = 1 memory_add = 2 memory_sample = 3 memory_sample_random = 4 agent_act = 5 agent_learn = 6 agent_q_targets = 7 agent_q_expected = 8 agent_loss = 9 agent_backward = 10 agent_optimize = 1...
true
f1c34e075853ba0ef6f8b1c2e5f1d0d828ff0e2a
cemzafer/mytest
/passwd.py
UTF-8
241
2.796875
3
[]
no_license
#!/usr/bin/python import re mylist = [] avalue = '' fh = open('/etc/passwd','r') for k in fh: avalue = re.match(r'root',k,re.M|re.I) if avalue: print(k) mylist.append(k) svalue = mylist[0].split(':') print(svalue[4]) fh.close()
true
4bf6045e03704540cd8545d637d48dceabc75422
andrewjprice/rapidking
/burak_deniz_task1_hw7_mod1.py
UTF-8
2,084
2.78125
3
[]
no_license
#!/usr/bin/env python3 #This module was codded by Burak Deniz for team Rapid King import sys, os def control(): counter = 1 while counter < 100: print (" ") LD = str(input("Left Dashboard swich (1/0) ?")) print ("L.D. Swich = " + LD) print (" ") RD = str(input("Rig...
true
9f27db8609338a87744a9ab2a147d47f322f7075
laganossi/GeckoBot
/Code/Src/Visual/PiCamera/IMGprocessing.py
UTF-8
3,983
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Jan 15 16:29:41 2019 @author: mustapha IMG -> (detect_apriltags) -> aprilresult aprilresult -> (extract_position) -> fpos, tpos aprilresult -> (extract_alpha) -> alpha, eps fpos, tpos, alpha, eps -> (calc_pose) -> pose """ import cv2 import apriltag import numpy as np f...
true
cee94bde6552779a8db25445bb2a26ff0eb72847
TejasPhutane/ROS_Projects
/rrc_2wheel_robot/scripts/L_pattern_path.py
UTF-8
6,783
2.84375
3
[]
no_license
#!/usr/bin/env python import rospy from geometry_msgs.msg import Twist from nav_msgs.msg import Odometry from math import pow,atan2,sqrt from sensor_msgs.msg import Range from tf.transformations import euler_from_quaternion import math PI = 3.14 class CleaningRobot(): def __init__(self): #Initializing RO...
true
5293d816ecf9db9b7545e14c633369c32ac8dbd9
nmoore32/Python-Workbook
/4 Functions/exercise104.py
UTF-8
1,415
4.4375
4
[]
no_license
## # Functions the convert between hexadecimal and decimal integers. # ## Converts a hexadecimal digit to a decimal integer. # @param h the hexadecimal string to convert # @return the resulting integer def hex2int(h): # If the hexidecimal and decimal representations are the same, return int(h) if "0" <= h <= "...
true
62b95afa54b993354293b0635ce3948792267928
bgroveben/nhlpy
/nhlpy/schedule.py
UTF-8
1,596
2.5625
3
[ "MIT" ]
permissive
import requests import json from .constants import BASE_URL class Schedule: def today(self, id=None): self.id = id if self.id == None: response = requests.get('%s/schedule' % (BASE_URL)) self.data = response.json() del self.data['copyright'] return ...
true
98fa386e919cd2e0d826205e1b2cf2bc96141fd5
nkchangliu/puzzles
/leetcode/trap_rain_water.py
UTF-8
929
3.734375
4
[]
no_license
def rain_water(lst): return trap_water(lst, 0, len(lst) - 1) def trap_water(lst, start, end): if start + 1 >= end: return 0 high_l, high_h = find_highest_two(lst, start, end) return trap_water(lst, start, high_l) + trap_water(lst, high_h, end) + amount_between(lst, high_l, high_h) def find_h...
true
54ee5fcdcbf53feb9e171c45da9b6acc6ddfadfc
boyps/canbus_sniffer_gui
/Utils/Utilities.py
UTF-8
2,743
2.65625
3
[]
no_license
import platform import pickle import gzip import os import PySide GPS_FILE = 'gps.log' CAMERA_FILE = 'video.mp4' CAN_FILE = 'extracted.csv' OUTPUT_FOLDER = 'log_files/' __version__ = "1.0" # Get information string about the project def get_about(): return """<b>CANBUS Analyzer GUI</b> v{} <p>Copy...
true
146b12ecbca69de05d154934dd79dd8dffc20dc0
gfkw/dend-project-1
/create_tables.py
UTF-8
1,824
3.015625
3
[]
no_license
import psycopg2 from sql_queries import create_table_queries, drop_table_queries def create_database(): """This function will connect to Postgres server and create the sparkify database. If the dabase already exists, then it will be dropped and recreated. """ # connect to default database conn = p...
true
b1565ed0213d774237611c12607b3bd4dc47e1a2
DTRx719/bronxbet
/tools/listing_gen.py
UTF-8
498
3.21875
3
[]
no_license
import csv TEMPLATE = '''<li> <div class='listing-name'>{name}</div> <div>{address}</div> <div>{city}, {state}</div> <a href="tel:{phone}">{phone}</a> </li>''' with open('listings.csv') as csvfile: reader = csv.DictReader(csvfile) for row in reader: if not row['Business Name']: continue prin...
true
e24e24d9f26b62785373e93d8b5943cb5cfb0299
olivierbonaventure/PFO
/syllabus/python/sumn.py
UTF-8
157
3.984375
4
[]
no_license
# Somme des n premiers naturels def sumn(n): if(n==0): return(0) return(n+sumn(n-1)) print(sumn(1)) # affiche 1 print(sumn(3)) # affiche 6
true
76d791b3279bd7322ea6981561da94de3c56bc95
liangxiaoxuan/Algorithm-training
/Leetcode/Python/easy/11_13_1_Remove Element.py
UTF-8
1,116
4.15625
4
[]
no_license
# Given an array nums and a value val, remove all instances of that value in-place and return the new length. # Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. # the order of elements can be changed. It doesn't matter what you leave beyond ...
true
c9f51d912322daeebe12c46528193a306f6541ab
rp-pwright/fsq
/fsq/install.py
UTF-8
5,376
2.671875
3
[]
no_license
# fsq -- a python library for manipulating and introspecting FSQ queues # @author: Matthew Story <matt.story@axial.net> # # fsq/enqueue.py -- provides queue (un)install functions: install, uninstall # # fsq is all unicode internally, if you pass in strings, # they will be explicitly coerced to unicode. # # This...
true
8672009466c8e889a56cc01f0412c0b853db5277
thecoldstone/Rectangular-Partition-Surveillance
/Search/Algorithms/astar.py
UTF-8
1,667
3.3125
3
[]
no_license
from Search.node import * from Search.guard import * class AStar: """ A Star Algorithm """ def __init__(self, start, nr): self.start = start self.nr = nr def solve(self, target): """ :param target: in our case target equals number_of_guards >= (number_of_rectang...
true
f4fb52cb9d3c7277cd9a86fd9670f7db0511ddb5
AdriBird/SiteWeb
/projet HTML fini/Exercices/Conditions/exercice25.py
UTF-8
127
3.1875
3
[]
no_license
def age (a): if a >= 18: print ("Bonjour, vous êtes majeur. ") else: print ("Bonjour, tu es mineur. ")
true
fb9f1256e127c52f0fd7ba25738fe4bd2d659daa
smuhit/2020-advent-code
/day-17/solver.py
UTF-8
3,423
3.25
3
[]
no_license
data = open('input.txt').read().split('\n') # Part 1 active_cubes = set() for y, row in enumerate(data): for x, char in enumerate(row): if char == '#': active_cubes.add((x, y, 0)) def active_surrounding(active, x, y, z): count = 0 for x1 in range(x - 1, x + 2): for y1 in rang...
true
0bcce72d2213901d1dded6972f87fcefa3dade8f
pombredanne/perfect-hash
/examples/C-1/mk_rnd_keys.py
UTF-8
286
2.90625
3
[ "BSD-3-Clause" ]
permissive
import sys import string from random import choice, randint def key(): return ''.join(choice(string.ascii_uppercase) for i in range(randint(1, 8))) N = int(sys.argv[1]) result = set() while len(result) < N: result.add(key()) for k in result: print(k)
true
1b68e3281d75657e32ff6d0c343b6763ab37d417
TylerD1800/Hello-World
/SnakePYGAME.py
UTF-8
5,948
3.265625
3
[]
no_license
import pygame,sys,random,time from pygame.locals import * #Setup pygames# pygame.init() #Setup the window# WINDOWWIDTH = 400 WINDOWHEIGHT = 400 windowSurface = pygame.display.set_mode( (WINDOWWIDTH,WINDOWHEIGHT), 0, 32 ) pygame.display.set_caption('Snake') mainClock = pygame.time.Clock() #Direction Variable...
true
28d70a05664691499a83587c2c9c9437e3b31bb0
wangj383/control_flow_lab
/exercises/exercise-3.py
UTF-8
724
4.875
5
[]
no_license
# exercise-03 Calculate Dog Years # Write the code that: # 1. Prompts the user to enter a dog's age in human years like this: # Input a dog's age in human years: # 2. Calculates the equivalent dog years, where: # - The first two years count as 10 years each # - Any remaining years count as 7 years each...
true
0f6c50b050fa1893a9127eb48112b4df0ff460b6
deepsinghsodhi/python-OOPS-assignments
/Python_module/cat and dog/Cats and Dogs game.py
UTF-8
2,143
4.8125
5
[]
no_license
''' Cats and Dogs game =============================================================================== Create a program that will play the “cats and dogs” game with the user. The game works like this: Randomly generate a 4-digit number. Ask the user to guess a 4-digit number. For every dig...
true
f17e06c2fed2752e53d62e26d9f6f094e1888d55
simenkristoff/tdt4113_datateknologi
/project_2 rock scissors paper/players/sequential_player.py
UTF-8
853
3.59375
4
[]
no_license
""" The Sequential Player class """ from project_2.action import Action from project_2.players.player import Player class Sequential(Player): """ The player Sequential chooses an action in sequence of "rock", "scissors", "paper" """ # Initializes first index: 'rock' last_index: int = 0 def en...
true
92e74da6e224bd81de0dbcaf22d8873823240c45
michaelpdunlap/Immuta_Connection_Conversion
/ProjectSourceExtractor.py
UTF-8
10,648
2.546875
3
[]
no_license
################################# # # # Project Source # # Extractor # # # # By: Mike Dunlap, Immuta CSA # # Born On: 8/27/2021 # # # ################################# # Purpose # ...
true
503a840dd26af25c2ca6bd143ca70471f93f4285
pxue/empireofcode
/crystal_row.py
UTF-8
601
3.34375
3
[]
no_license
def check_line(line): p = line[0] for x in line[1:]: if x == p: return False p = x return True if __name__ == '__main__': # These "asserts" using only for self-checking and not necessary for auto-testing assert check_line(["X", "Z", "X"]) == True assert...
true
71fe06967cb5aab6a4e6a2b3ba60a79e48caaf09
gavrikman/fileManager
/main.py
UTF-8
5,002
3.375
3
[]
no_license
import sys import os from core import create_file, create_folder, get_list, delete, copy_file, save_info, change_dir def info(): print('Неверный формат ввода. Повторите команду') print('Для получения списка команд и формата ввода, введите "help"') save_info('Start') try: command = sys.argv...
true
7695c7bfee7dbf2b9f4aa686a7f89d92497d8863
VardgesManukyan/Python-learning
/String/Str Practice.py
UTF-8
1,489
3.625
4
[]
no_license
# 1. # Write a Python program to get a string made of the first 2 and the last 2 chars from a given a string. # If the string length is less than 2, return instead of the empty string. # Sample String : 'w3resource' # Expected Result : 'w3ce' # Skzbi 2 tarery + Verji 2 tarery s="barev" a=s[:2] v=s[-2:] print(a+v) # ...
true
63fd801e7b4b8e155f231f49608e990144cb7c25
husney/Universidad_Python__Python__Django__Html__Css__Flask__Postgres
/Archivos/archivos.py
UTF-8
1,227
3.53125
4
[]
no_license
"""try: miArchivo = open("MiArchivo.txt", "w") miArchivo.write("Estoy agregando texto al arcihvo") except Exception as ex: print("Error", ex) print(type(ex)) finally: miArchivo.close() try: lectura = open("MiArchivo.txt", "r") print("Leyendo...") print(lectura.read()) except Exception a...
true
84be63f3f1bfdb9fc8c25474cb39666aa5c86017
RoboJackets/robocup-firmware
/control/src/robocup/motion-control/VelocityKalmanTuner/LinearDynamicsGains.py
UTF-8
2,966
2.90625
3
[ "Apache-2.0" ]
permissive
import numpy as np class LinearDynamicsGains: """ A class in charge of storing, returning, and verifying gains for LinearDynamics """ def __init__(self, A_k, B_k, H_k, D_k, x_init): self.x_init = x_init self.A_k = A_k self.B_k = B_k self.H_k = H_k self.D_k ...
true
0c687799a1938b1b6e064d01ede8a38145fee064
bingzgxsm/PythonCode
/第13章/Listing_13-1.py
UTF-8
572
3.1875
3
[]
no_license
# Listing_13-1 # Copyright Warren & Carter Sande, 2013 # Released under MIT license http://www.opensource.org/licenses/mit-license.php # Version $version ---------------------------- # Creating and using a function # Define a function def printMyAddress(): print "Warren Sande" ...
true
c5e9893b2546efde5e35fa468940a82081b9a8fd
FahimArman/pytorch_sung_kim
/pytorch_sk_06.py
UTF-8
1,109
3.40625
3
[]
no_license
import torch from torch import nn from torch import tensor from torch import sigmoid import torch.nn.functional as F import torch.optim as optim x_data = tensor([[1.0],[2.0],[3.0],[4.0]]) y_data = tensor([[0.0],[0.0],[1.0],[1.0]]) class Model(torch.nn.Module): def __init__(self): super(Model,self).__init__() se...
true
bb4c66c88bf426db1aaca238abad801963832d71
PulkitSingla/Business_Analyst
/Functions_basics.py
UTF-8
3,466
4.3125
4
[]
no_license
integer = -20 abs(integer) print('Absolute value of -20 is:', abs(integer)) # floating number floating = -20.83 print('Absolute value of -20.83 is:', abs(floating)) # all(): It returns true if all items passed in iterable object are true. # Otherwise, it returns False. # This fxn accepts an iterable obje...
true
db2ff62ac500f2bf972251221950b6a7893944e1
SpencerStaub/NLP_Final
/preprocessing/Final_v7.py
UTF-8
10,943
2.78125
3
[]
no_license
import numpy as np import pandas as pd from nltk.corpus import reuters import spacy import os import matplotlib.pyplot as plt from spacy.language import Language from spacy.tokens import Span import pprint import itertools import re import pke import string from nltk.corpus import stopwords from summari...
true
1e9450804d1ebf6a7656d337031ba0e2619b43ed
jlbouche/ShoutCollector
/main_app/models.py
UTF-8
1,406
2.71875
3
[]
no_license
from django.db import models # Import the reverse function from django.urls import reverse #import datetime from datetime import date #Tuple to be called in any models up here: TIMES = ( ('M', 'Morning'), ('A', 'Afternoon'), ('E', 'Evening') ) class Dragon(models.Model): name = models.CharField(max_le...
true
2619d32053bed927ab5fce0d62775fa511ffb2c4
Lihsayuri/DungeonsOfInsper
/classe_arqueiro.py
UTF-8
1,277
2.765625
3
[]
no_license
import pygame import random from ClasseInimigo import Inimigo from parametros import HEIGHT, WIDTH, CHAR_WIDTH, GRAVITY, STILL, GROUND, ATTACK_char from classe_flecha import Flecha class Arqueiro(Inimigo): '''Classe do primeiro inimigo e definição de suas movimentações.''' def __init__(self, assets, groups):...
true
696e36b4fcfcc3f1b6ce73ff35aaa87a86042b9b
lalym/learn2
/while2.py
UTF-8
404
4.1875
4
[]
no_license
def find_person(name, mylist): while True: if (name in mylist): print((name), "есть в списке.") else: print("Этого имени нет в списке.") break mylist = ["Вася", "Маша", "Петя", "Валера", "Саша", "Даша"] name = input("Введите имя: ").capitalize() find_pers...
true
6101fcebdb9a7749a87de9d1fb428eeacc62925f
harihara0072/Distibuted-Systems-Lab-1
/server.py
UTF-8
3,903
3.140625
3
[]
no_license
#Name: Hari Hara Kummi Nakshatrala #import all the packages import socket from threading import Thread from tkinter import * import time import datetime #global variables declaration host = '' port = 80 #global declaration of http format messages post = "POST /" http = "HTTP/1.1 \n" host_name = "Host:"...
true
e68a88b2894d959d93f89ca7b81dc9b7865bce0a
Aliaksandr-Strr/Django_test-driven_development
/functional_tests.py
UTF-8
1,505
3.109375
3
[]
no_license
from selenium import webdriver from selenium.webdriver.common.keys import Keys import time import unittest class NewVisitorTest(unittest.TestCase): """Тест нового посетителя""" def setUp(self): """Установка""" self.browser = webdriver.Firefox() def tearDown(self): """Демонтаж""" ...
true
9072306485a95fc0847bd14b97b79b66bb9dff17
yashmrsawant/simplex
/generate_lp.py
UTF-8
1,688
2.640625
3
[]
no_license
z1 = 1.3 z2 = 1.4 numberOfFiles = 35 for i in range(numberOfFiles): filename1 = 'files/input' + str(i) + '.lp' filename2 = 'files/input' + str(i) + '.in' filename3 = 'files/input' + str(i) + '.int' n = i with open(filename1, 'w') as file: file.write("Maximize\n\t") file.write("obj: ") for j in range(n + 2...
true
164b61f5d8b21843d6ff8ef91809bd213fe4a098
Matthijs-utf8/2048_game_AI
/2048_Game_and_AI_3.0.py
UTF-8
12,305
3.8125
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Jun 12 13:13:01 2019 @author: Matthijs Schrage """ import random from numpy import transpose, array, any #import numpy as np class Game(): def __init__(self, config): self.config = config #Make transpose and reverse function for the right, ...
true
02601d684d72597db1590bc8d8720e14eeeeece6
BLHofn/E-commerce_product_review_emotion_analysis_system
/jd_mdcomments/crawl_data.py
UTF-8
4,832
2.640625
3
[]
no_license
#!/usr/bin/env python3.7.0 # -*- coding: utf-8 -*- # @Time : 2020/4/8 13:56 # @Author : XiaShengSheng # @FileName: crawl_data.py # @Software: PyCharm import re import requests import json import csv import time import pymysql # 数据库配置文件 print('正在尝试连接到mysql服务器...') db = pymysql.connect(host='localhost', user='root',...
true
0db214e44b85a5bc94efd96cbf484ad949dfddf0
ajamanjain/AI-with-WhiteHat-Junior
/8: Multiplication table.py
UTF-8
487
4.5
4
[]
no_license
# Write your code here # Step 1: Get the user input num = int(input("Enter the integer no. to get the table of : ")) # Step 2: Initialize variable 'i' with value '1' i = 1 # Step 3: Execute a 'while' loop 10 times while i<11: # Step 4: Multiply the 'num' variable with 'i' variable and store in 'multiply' variabl...
true
6994cde2e97c125fcd2c7314d60f82afa13d06ce
wattaihei/ProgrammingContest
/AtCoder/PAST3/probL.py
UTF-8
2,482
2.75
3
[]
no_license
import sys input = sys.stdin.readline import heapq as hp INF = 10**15 N = int(input()) Store = [list(map(int, input().split()))[1:] for _ in range(N)] M = int(input()) A = list(map(int, input().split())) q1 = [] # 一番前に入ってる(価値, 棚) q2 = [] # 2番目 NowOn = [[INF]*2 for k in range(N)] # 棚iで今見せているind for n in range(N): ...
true
6eaca7b936278229e00cef9edfff17c2fa66054f
abn/deepdiff
/deepdiff/deepdiff.py
UTF-8
15,393
3.46875
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import datetime import difflib import json from decimal import Decimal from sys import version from six import string_types, binary_type py3 = version[0] == '3' if py3: from builtins import int basestring = str numbers ...
true
1ff02640db9082be27f042f5018067a620bd8bef
iamjoshbinder/gamechanger-ml
/gamechangerml/scripts/get_wiki_descriptions.py
UTF-8
984
3.140625
3
[ "MIT" ]
permissive
## pip install wikipedia import wikipedia from datetime import date import pandas as pd import argparse def lookup_wiki_summary(query): try: return wikipedia.summary(query).replace("\n", "") except: print(f"Could not retrieve description for {query}") return "" if __name__ == '__main__...
true
518075071982328bc5ca99e3577fd7bd5221a966
lucblassel/MSR_discovery
/bin/makeAllUniqueFunctions.py
UTF-8
4,392
3.015625
3
[]
no_license
#!/usr/bin/env python3 import os import json RAW = { "AA": "A", "AC": "C", "AG": "G", "AT": "T", "CA": "A", "CC": "C", "CG": "G", "CT": "T", "GA": "A", "GC": "C", "GG": "G", "GT": "T", "TA": "A", "TC": "C", "TG": "G", "TT": "T", } HPC = { "AA": ".", ...
true
46cd7dfa2d250fdf4aa6d8604f183cea3a9e7c47
c2921707677/test
/pyTest/before/c2.py
UTF-8
213
3.140625
3
[]
no_license
import re s = 'ABC3425D92' def convert(value): matched = value.group() if matched >= '6': return '9' else: return '0' r = re.sub('\d', convert, s) r1 = re.match('\w{3}', s) print(r1.group()) print(r)
true
b275e5a4cb0a9d64b88c599925141567d1805fc4
SciCatProject/scitacean
/src/scitacean/_internal/orcid.py
UTF-8
1,008
2.890625
3
[ "BSD-3-Clause" ]
permissive
# SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2023 SciCat Project (https://github.com/SciCatProject/scitacean) """Validator for ORCIDs. Based on https://support.orcid.org/hc/en-us/articles/360006897674-Structure-of-the-ORCID-Identifier """ def orcid_checksum(orcid_id: str) -> str: total = 0 for c ...
true
d201ecc0010e344e2a8b2431e2a6727d529afdad
garciacastano09/pycourse
/modules/mod_06_threading.py
UTF-8
5,585
3.953125
4
[]
no_license
#-*- coding: utf-8 -*- u""" MOD: Threading and GIL """ import threading #=============================================================================== # - This module provides a high-level interface for working with threads. # - It relies on low-level 'thread' module. #============================================...
true
f53c999f9f87d069a6a4d933f01c92fa9b8dec5a
allyshoww/python-exercicios
/3-EstruturaRepeticao/ex1.py
UTF-8
185
4.125
4
[]
no_license
n1 = float(input("Informe uma nota: ")) if n1 >= 0 and n1 <= 10: print("Nota correta") while n1 < 1 or n1 > 10: print("Nota incorreta") print(input("Informe uma nota: "))
true
0cd9cc7d6e631c19d70b433c199428055cad8950
99nagaraj99/flask_machine_learning_model
/resources/xor_predict.py
UTF-8
3,143
2.765625
3
[]
no_license
""" API for authentication validation """ from flask import request from flask_restful import Resource from flask_restful_swagger_2 import swagger from operations.neural_network.xor.xor_pred import predict_xor_output from flask_api import status from shared.internal_status import StatusCodes as SC, ErrorMessages as EM ...
true
405d18a1e4d02322c9f60dd1999214bde1b7ffdd
Cyufei87/LeetCode_Solutions
/Algorithms/1-50/p_09.py
UTF-8
387
3.25
3
[]
no_license
# Palindrome Number class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x < 0: return False x = -x s = str(x) l = len(s) half = l/2 ok = True for i in range(half+1): ...
true
49f4be0bb5f6a74d9aab9d97a0ce27550d4b016b
sergeherman/sergeherman.github.io
/CES111/test_customer_order.py
UTF-8
1,042
3.234375
3
[]
no_license
import pytest def check_customer(customers_dict, customer_number): """Verify that the data for one customer number stored in the customers dictionary is correct. Parameters customers_dict: a dictionary that contains customer data customer_number: the customer number of the customer that...
true
1706880790ca2c03133680e437e7ad41542bb1c1
NTUT-109AB8011/crawler
/exercise/learn_python_dm2039/ch14/ch14_27.py
UTF-8
135
2.953125
3
[]
no_license
# ch14_27.py fn = 'out14_27.txt' x = 100 with open(fn, 'w') as file_Obj: file_Obj.write(str(x)) # 使用str(x)輸出
true
3240cc45e3c8c8ec195748f4a1f3e340d20674a0
guidsantos/exPython
/while/exWhile3.py
UTF-8
395
4.5
4
[]
no_license
# 3) [Deitel, Deitel]Escreva um programa que leia o valor do lado de um quadrado e então imprima o quadrado com asteriscos. # Seu programa deve funcionar com quadrados de todos os tamanhos entre 1 e 29 num = int(input('Insira o tamanho do quadrado de 1 a 29: ')) if 1 <= num <= 29: print(f'Quadrado de tamanho {num...
true
70ab6c93e5107bcd2c9b79aac6af1cbc81cab427
vibhootiagrawal/python_course
/size.py
UTF-8
512
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Feb 4 22:35:07 2019 @author: Education """ import os from PIL import Image '''img = Image.open("20170211_220907.jpg") img.save("img.png") #to change the format of a image img.show()''' fileList = os.listdir("D:/forsk") for image in fileList: ...
true
1062765ce414f5130301d3a145324c7e2850efb2
pachuc/HM
/manatee.py
UTF-8
7,763
2.828125
3
[]
no_license
import pygame import os import math from pygame.locals import * from arena import * from corridor import * from Player import * from geometry import * BLACK = (0, 0, 0) width = height = 800 BORDER_WIDTH = 70 BLACK = ( 0, 0, 0) WHITE = (255, 255, 255) BLUE = ( 0, 0, 255) GREEN = ( 0, 255, 0) RED = (255, ...
true
d1e6c00dff38571d5ca6b3dd89c6c3acedfde029
hal00alex/BooksInPython
/JimmyCoates.py
UTF-8
417
3.640625
4
[ "MIT" ]
permissive
import random def main(): print "Hello Master\n" jimmyAssassin = "" index = random.randint(0,100) #based on the books. He has a 30 % to ignore his program completely #change 30 to a higher number if you want to include the times when he ignores his program paritially. if (index < 30): jimmyAssassin = "Y...
true
e567feb729459144137902d7b1e3eb0c4c8ccbec
akhilrazdan/cryptopals
/src/set2/challenge_9.py
UTF-8
769
3.609375
4
[]
no_license
# Inspired from https://joshfrogers.co.uk/cryptopals-set2-ex1/ def pkcs7_pad(input: bytes, block_size: int) -> bytes: #assert len(input) <= padded_length, "input should be <= padded len" difference_in_padding = block_size - (len(input) % block_size) output = b"" output += input output += bytes((ch...
true
b16666528d3516f3719e468b3feaf1db26872fcc
robinrob/python
/practice/counting_bag/counting_bag.py
UTF-8
831
3.5
4
[]
no_license
from generator import Generator from my_exceptions import EmptyBagException class CountingBag: def __init__(self, items): self.items = {} for item in items: if not item in self.items.keys(): self.items[item] = 1 else: self.items[item] += 1...
true
cfe9fbec951efe4fbccd1c7b647f16da4a326a27
JamesAdamHughes/StravaAwards
/service/ConfigService.py
UTF-8
416
2.671875
3
[]
no_license
import ConfigParser import os config = ConfigParser.RawConfigParser() def read(path): config.read(path) def getConfigVar(value, section='development'): enviroment = os.getenv('ENVIROMENT') print '[config] loading enviroment ' + str(enviroment) return config.get(enviroment, value) def addSectionAndVa...
true
805adb43054a4fbe326231bf913d68d06f34c96e
Usefmuq/our-blockchain
/api.py
UTF-8
5,440
2.609375
3
[]
no_license
from flask import Flask, request, jsonify from blockchain import Blockchain, Block, Transaction import requests import pickle import json def load(): try: with open("blockchain.dat", "rb") as file: chain = pickle.load(file) return chain except FileNotFoundError: print("Did ...
true
5983047739566e2a51205275dfa2ab737d35ddde
rlhodgson/Assignments
/COSC121/Lab 9/print_word_counts.py
UTF-8
691
3.71875
4
[]
no_license
def print_word_counts(filename): """Prints the word followed by its occurence from a given filename, printed one word per line follwed by the count in alphabetical order""" import re input_file = open(filename, 'r') source_string = input_file.read().lower() input_file.close() ...
true
6ea64287803a8d8231515c9a67db402f8bcd299a
xinghc/PythonMachineLearning
/ch2/rVMSummaryStats.py
UTF-8
1,797
2.71875
3
[]
no_license
__author__ = 'mike_bowles' try: import urllib.request as urllib2 except ImportError: import urllib2 import sys import numpy as np target_url = ( "https://archive.ics.uci.edu/ml/machine-learning-databases/undocumented/connectionist-bench/sonar/sonar.all-data" ) data = urllib2.urlopen(target_url) xList = [] lab...
true
703e7da201a0609d27f434fe22dbc64e26352a43
aquachain/aquachain-tk
/aquachaintk/themed.py
UTF-8
2,347
2.84375
3
[]
no_license
#!/usr/bin/env python3 ''' re-usable themed.py aerth waz here ''' from tkinter import Frame, Label, Button, Entry from aquachaintk.vsframe import VSFrame class ThemedFrame(Frame): def __init__(self, parent, noscrollbox=False, app=None, *args, **kw): Frame.__init__(self, parent, *args, **kw) self.c...
true
ca6af6bdd77d7f99265ef0e5ce9e06cffc1ea1b2
MarcianoPazinatto/TrabalhosdePython
/Aula8_tuplas/aula8.py
UTF-8
549
4
4
[]
no_license
nome='marciano' ' ' 'Pazinatto' print((nome).count('a'))#conta quantos caracteres tem print((nome).lower())#diminui os carácteres print((nome).upper())#aumenta os carácteres print((nome).split(' '))#remove o que for colocado dentro dos parênteses print((nome).strip()) print((nome).capitalize())#deixa o primeiro cará...
true
b0d92ebbb14ea1ea637e675f04992ae99d03a353
yunpengb/Py_Dev_Suite
/1.PythonBasic_Train/2.06/2.py
UTF-8
87
3.09375
3
[]
no_license
a = 1 a += 2 print a a = 1 a *= 2 print a a = 1 a -= 2 print a a = 10 a /= 2 print a
true
202850991dec87f5de7cb2a31d666fb265b6f4b6
Fanner487/fyp-image-testing
/scan/thread_example.py
UTF-8
452
2.65625
3
[ "MIT" ]
permissive
import threading import time from processing.qr import get_qr_code from processing.scan import scan_image def worker(file): """thread worker function""" # time.sleep(0.5) print 'Thread for: ' + image scan_image(file) get_qr_code(file) # print image return images = ['phone1', 'phone2', 'ph...
true
72c8818cebf928e40d9cf781aa75bbfdbbbdced5
rjjjava/PycharmProjects
/deep-rl-master/ddpg/ddpg.py
UTF-8
10,647
2.671875
3
[ "MIT" ]
permissive
""" Implementation of DDPG - Deep Deterministic Policy Gradient Algorithm and hyperparameter details can be found here: http://arxiv.org/pdf/1509.02971v2.pdf The algorithm is tested on the Pendulum-v0 OpenAI gym task and developed with Tensorflow Authors: Patrick Emami Shusen Wang """ import tensorflow as tf...
true
93540dc94255fd688b75f53202a26f8678549aac
acvilla/Sundial-Beta
/.closet/jython.configurator.efr32/1.0.0.201606231656-435/pyradioconfig/pycalcmodel/core/common.py
UTF-8
3,383
3.015625
3
[]
no_license
import variable from enum import Enum import ast __all__ = [ 'get_xml_str_values', 'cast_value_from_xml', 'get_dummy_var_value' ] DUMMY_VAR_VALUE = { bool : False, complex : 0j, float : 0.0, int : 0, long : 0L, str : '', } def get_xml_str_values(is_ar...
true
a3cbf778d696c00f24846776002e49974fd03600
yunhui21/CB_Ai_NLP
/Python_300_exm/061-070_listSlicing.py
UTF-8
743
4
4
[]
no_license
# 061-070_listSlicing.py # 061 price = ['20180728', 100,130,140,150,160,170] print('061:', price[1:]) # 062 nums = [1,2,3,4,5,6,7,8,9,10] print('062:', nums[::2]) # 063 print('063:', nums[1::2]) # 064 nums = [1,2,3,4,5] print('064:', nums[::-1]) # 065 interest = ['삼성전자', 'LG전자', 'Naver'] print('065:', interest[0],...
true
d96016fa65945d3ea791c7f300a6ebe463cabf7c
hukkelas/gan
/dcgan.py
UTF-8
5,715
2.640625
3
[]
no_license
import tensorflow as tf from operations import fully_connected, deconv2d, conv2d, lrelu from tensorflow.examples.tutorials.mnist import input_data import math import numpy as np from utils import save_image import time class DCGAN: def __init__(self, X_train): self.images = input_data.read_data_sets('MNIST_data/...
true
8ce73ca59572a6883210abe9d723ca4778a17fca
bowling8/projects
/practice/python/numpy/linearAlgebra.py
UTF-8
300
2.609375
3
[]
no_license
#!/usr/bin/env python3 import numpy as np from fractions import Fraction u = np.array([[-4, -5], [5, 6]]) v = np.array([[6, -7], [-6, 13]]) v = v.astype('object') #print(np.linalg.solve(A, B)) #print(np.matmul(u,v)) #print((np.eye(3, dtype = int))) print(np.linalg.inv(u)) print(np.linalg.inv(v))
true
3459a3005fbbb01bbcfaa9b9a28398e102eedfcc
bespontoff/checkio
/solutions/Codeship/88th_puzzle.py
UTF-8
2,762
3.734375
4
[]
no_license
#!/home/bespontoff/PycharmProjects/checkio/venv/bin/checkio --domain=py run 88th-puzzle # p.quote-source { float: right; font-size: 10px; }Dr. Emmett Brown: If my calculations are correct, when this baby hits 88 miles per hour... you're gonna see some serious shit. # # === # # Marty McFly: He...
true
25d7a13bd32835a75a6cea4b0898fca3d68c8190
liam-middlebrook/math-island
/LevelEditor.py
UTF-8
6,061
3.03125
3
[ "MIT" ]
permissive
#!/usr/bin/env python import sys import os import argparse import itertools from fractions import Fraction as Frac try: # Python 3 from tkinter import * from tkinter import filedialog except ImportError: # Python 2 from Tkinter import * import tkFileDialog as filedialog from level import Level...
true
4a469bfb6a17ee1a1ce123a7a5ef9ae6c900f19c
cms-analysis/flavourresponse
/flavourresponse/matrixinversion.py
UTF-8
3,638
3.125
3
[]
no_license
import ROOT import numpy as np class MatrixInversion: """ This class handles all steps necessary to perform the matrix inversion method. :type zones: list[str] :type flavours: list[str] :type _plots: dict[ROOT.TH1] :type _print_results: bool """ zones = ['1Q', '3C', '4B', '2G'] flavours = ['uds', 'c', 'b',...
true
ce59ad18cfadd6e0f8eb4d82ae1e45e6bc1683ae
liulixiang1988/easy-apigateway
/utils/redis_helper.py
UTF-8
894
2.546875
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- import redis import settings __all__ = ['RedisHelper'] class RedisHelper(object): """ redis 连接助手 """ _client = None def __init__(self): if RedisHelper._client is None: self._create_redis_client() @classmethod def get_cli...
true
b727e6b4fda46e46d784fe6ecb35b16978a3adba
liyougeng/crosslstm
/vocab.py
UTF-8
3,378
2.578125
3
[]
no_license
import json from os import path as osp import pickle as pkl from config import * def buildVocab(force=False, sp='train'): vocab_file = "./sentdata/train_vocab.pkl" if (not force) and osp.exists(vocab_file): with open(vocab_file, 'r') as fd: return pkl.load(fd) file_a...
true
9626c5f2335e957d82c608f2735a86cb87512efa
zy967/algorithm008-class02
/Week_01/26_RemoveDuplicates.py
UTF-8
250
3.03125
3
[]
no_license
class Solution: def removeDuplicates(self, nums: list) -> int: count= 0 for j in range(1, len(nums)): if nums[j] != nums[count]: count += 1 nums[count] = nums[j] return count+1
true
905e1ca6275a0acbb3595dea798b042ed5afe8e3
kamyu104/LeetCode-Solutions
/Python/nested-list-weight-sum-ii.py
UTF-8
760
3.25
3
[ "MIT" ]
permissive
# Time: O(n) # Space: O(h) class Solution(object): def depthSumInverse(self, nestedList): """ :type nestedList: List[NestedInteger] :rtype: int """ def depthSumInverseHelper(list, depth, result): if len(result) < depth + 1: result.append(0) ...
true
f29b4d9646553427cd5a335f2146f3436e35e20e
publu/dialecto
/unigram/spanish_tweet_filter.py
UTF-8
11,667
3.125
3
[]
no_license
from nltk.tokenize import TweetTokenizer from nltk import ngrams import csv import os import pickle import random from itertools import islice class tweet_classifier: def __init__(self): """ The init function does the following functions: 1. Creates an nltk tweet tokenizer object ...
true
42f62bb1d3282f1f459e1b2e135aa3b103a4b401
alexanderhickes/Dream-Analysis
/dream_analysis/Full_Application/Fralysis/test/test_input_output.py
UTF-8
929
2.78125
3
[]
no_license
from Fralysis.InputOutput import InputOutput def test_send_message(): message = "This is a test" in_out = InputOutput(interface_type=InputOutput.INTERFACE_TYPE_SIMPLE) print("this is me testing....\n") assert in_out.write_message(message=message) def test_read_message(): I...
true
6f705e077995c6a6cd5d0e49f852851db4864043
SalmonTheWise/math
/hw7_1.py
UTF-8
193
3
3
[]
no_license
__author__ = 'salmon-the-wise' a = [1, 5, 11, 12] b = 7 def closest_gene(gen, pos): n = [abs(i-pos) for i in gen] idx = n.index(min(n)) return gen[idx] print(closest_gene(a, b))
true
e06f24480eb0e587d4cbbf1699a9c050f6127569
building-energy/epw
/tests/test_epw.py
UTF-8
1,127
2.75
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import unittest from epw import epw from pprint import pprint import pandas as pd class TestEpw(unittest.TestCase): # OBJECT CREATION def test_epw___init__(self): a=epw() self.assertIsInstance(a,epw) print(a) def test_epw_read(self): a=epw() ...
true
49e126ee3c3f8badd9cea988464450e1b22399ac
alstat/tito
/assets/api/flask_tito.py
UTF-8
1,321
2.734375
3
[]
no_license
from flask import Flask from flask import jsonify from flask import request import json from functions import handle_zip, train, analyze # HOST AND PORT HOST = '127.0.0.1' PORT = 5000 app = Flask(__name__) @app.route("/zip_file", methods = ["POST"]) def get_zip_file(): """ Port for Handling ...
true
3c83a045d2e705d6d79328f6dd314b6c01e8d332
sanyiss/Computer_Vision
/【乐学偶得出品】【ComputerVision】3.【霍夫变换Hough_Transform】Hough_Transform_Example.py
UTF-8
1,468
2.96875
3
[]
no_license
# 乐学偶得 版权所有 主讲人 :William 公众号:乐学Fintech 官网:lexueoude.com import numpy as np from skimage.transform import hough_line, hough_line_peaks from skimage.feature import canny from skimage import data import matplotlib.pyplot as plt from matplotlib import cm # hard coding our image using numpy image = np.zeros((200, 200)) #...
true
54b6e066041605a38e893b5fc123d1eec8976fd4
AdamZhouSE/pythonHomework
/Code/CodeRecords/2741/49405/292009.py
UTF-8
189
2.921875
3
[]
no_license
a = eval(input()) a.sort() n = len(a) ans = 0 for i in range(n): l = 1 for j in range(i + 1, n): if a[j] == a[j - 1] + 1: l += 1 ans = max(ans, l) print(ans)
true
5ef21f4cb3215629fec26fe166a10e9cc62f90ec
skiry/University
/Fundamentals of Programming/!Generic Program/Domain/Stire.py
UTF-8
595
3.34375
3
[]
no_license
from Domain.Entity import Entity class Stire(Entity): def __init__(self, id, titlu, continut, autor): super().__init__(id) self.__titlu = titlu self.__continut = continut self.__autor = autor def getTitlu(self): return self.__titlu def getContinut(self): r...
true