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
3f87d591ee606b1e2201e262d93f1728cd9e5f31
LukasL97/shop-4-me
/back-flask/api/request.py
UTF-8
19,369
2.546875
3
[ "MIT" ]
permissive
import flask from flask import Response, make_response, jsonify from api.http_status import OK, BAD_REQUEST, UNAUTHORIZED, UNPROCESSABLE_ENTITY, NOT_FOUND from model.exception import UserSessionIdNotFoundError, ObjectIdNotFoundError, UnauthorizedAccessError, \ UnexpectedRequestStatusError, UnexpectedUserTypeError,...
true
271868f1563a6845e663ea2408a405e46e440290
JackZhouSz/Image-deblur-using-image-pairs
/Affiliated/auxiliary.py
UTF-8
2,297
2.640625
3
[]
no_license
import numpy as np import cv2 as cv import sys import os import matplotlib.pyplot as plt sys.path.append(os.path.dirname(__file__)) from Kernel_Estimation import kernel_estimation from Deconvolution.Deconv import deconv def kernel_write(kernel, name, savedir): plt.imshow(kernel) plt.colorbar() fig = plt.g...
true
b7a800b97be0fde05fcd285a2d104cb667c5209e
luiznaac/systems-and-network-security
/src/cipher/cipher.py
UTF-8
1,302
2.78125
3
[]
no_license
import sys import io from CipherInterface import CipherInterface from symmetric.CesarCipher import CesarCipher from symmetric.VernamCipher import VernamCipher options = { '-c': 'cipher', '-d': 'decipher', } CIPHERTYPE = 1 USEROPTION = 2 USERKEY = 4 INPUTTEXT = 5 OUTPUTTEXT = 6 def main(): cipher = get...
true
456fda71ef5fa82c845bf1a555511aa89651c0d4
mahin884/constraint_satisfaction_problems
/tests/test_consistency.py
UTF-8
6,232
2.828125
3
[ "MIT", "Python-2.0" ]
permissive
import random import unittest import csp class TestConsistency(unittest.TestCase): def setUp(self): colors = {"red", "green"} names = {"wa", "nt", "q", "nsw", "v", "sa", "t"} self.name_to_variable_map = csp.Variable.from_names_to_equal_domain(names, colors) const1 = csp.Constraint...
true
b68eeee3bff457755768f371d784a3ae751fabab
michael-bateman/python-codingbat
/string-1/make_tags.py
UTF-8
225
4.09375
4
[]
no_license
def make_tags(tag, word): tagopen = "<" + tag + ">" tagclose = "</" + tag + ">" return tagopen + word + tagclose tag = raw_input("Enter a tag (ex. p): ") word = raw_input("Enter a string: ") print(make_tags(tag,word))
true
11c68cc470be2b7ecf221195bf695533d01ea281
Vasilic-Maxim/LeetCode-Problems
/problems/113. Path Sum II/1 - DFS [Top-Bottom].py
UTF-8
808
3.359375
3
[]
no_license
from typing import List class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: """ Time: O(n) Space: O(log (n)) or O(n) """ def pathSum(self, root: TreeNode, target_sum: int) -> List[List[i...
true
ece0cd7978fa2065d0161b5d633a34e32c629d44
hupantingxue/advancedpython
/thread/multi_threading.py
UTF-8
523
3.171875
3
[ "Apache-2.0" ]
permissive
#-*- coding: utf-8 -*- from threading import Thread import time def loop(idx, nsec): print("start loop", idx, " at ", time.ctime()) time.sleep(nsec) print("start loop", idx, " at ", time.ctime()) def main(): print("Process start at ", time.ctime()) thread0 = Thread(target=loop, args=(0, 4)) th...
true
54e4225dc0b2452cb5e1d2fdedf54f4c03540491
DevianNighthawk/kingstart
/pndora/pndora.py
UTF-8
1,077
3.203125
3
[]
no_license
import pandas as pd import os class EmptyStringError(Exception): def __init__(self,str_arg,message="Filename is not provided try again"): self.str_arg=str_arg self.message = message super().__init__(self.message) def read_data(filename): ret = None #print("==========") #print(os.path.isfile(filename)) isF...
true
deac38d72d0d457b661c4d9fe41d5893af8321a8
DTDevelop/ProjectEuler
/Problems11-20/Problem17.py
UTF-8
3,543
4.59375
5
[]
no_license
""" Number letter counts Problem 17 """ # NAME DICTIONARIES ones = {1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine'} tens = {10: 'ten', 11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen', 16: 'sixteen', 17: 'seventeen', 18: 'eighteen', 1...
true
3b0ef2e224c015f194cdf78756a6b2f1237e40dd
bacasable34/formation-python-scripts-exemples
/cartes.py
UTF-8
704
3.765625
4
[]
no_license
#! /usr/bin/env python3 # programme cartes.py def couleur(numcoul): if numcoul == 1: return("pique") elif numcoul == 2: return("coeur") elif numcoul == 3: return("trèfle") elif numcoul == 4: return("carreau") def valeur(numval): if numval == 14: return("as")...
true
a0ac26ea1a64a5f04cf64fc82fddfd0307291acd
brenard/eesyvpnweb
/eesyvpnweb/templates/helpers.py
UTF-8
493
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- import os import random import datetime def random_sequence(length): return [random.random() for idx in xrange(0, length)] def relative_path(ctx, abs_path): return os.path.relpath(abs_path, ctx.req.path) def expire_date(date): if date > datetime.datetime.now() and date < datetime...
true
343cabdda00a0f59faa7eddf65636f319865bfc6
killa1218/sense2guass
/utils/visializeEmb.py
UTF-8
1,890
2.59375
3
[ "MIT" ]
permissive
# coding=utf8 import sys import os.path as path sys.path.append(path.abspath(path.join(path.dirname(path.realpath(__file__)), path.pardir))) import random import numpy as np import pickle as pk import numpy as np import matplotlib.pyplot as plt from vocab import Vocab from mpl_toolkits.mplot3d import Axes3D from uti...
true
176b6facf35cee14471f83e607517395a7034edb
kirean/field_planner
/field_planner.py
UTF-8
2,771
3.109375
3
[]
no_license
#!/usr/bin/env python import argparse import sys TEMPLATE_FIELD = "{\"type\":\"polyline\",\"latLngs\":[{\"lat\":%s,\"lng\":%s},{\"lat\":%s,\"lng\":%s},{\"lat\":%s,\"lng\":%s},{\"lat\":%s,\"lng\":%s}],\"color\":\"#a24ac3\"}" TEMPLATE_LINK = "{\"type\":\"polyline\",\"latLngs\":[{\"lat\":%s,\"lng\":%s},{\"lat\":%s,\"lng\...
true
03a25ab521fc841db3286f8fdec313cf85706ae0
the-fanan/python-algorithms-practice
/tutorial/dsap-rance-d-necaise/advanced-linked-lists-pad.py
UTF-8
235
2.796875
3
[]
no_license
#Python Algorithms and Data Structures # Doubly linked lists - reverse printing and efficient insertions class DListNode : def __init__(self, data ): self.data = data self.next = None self.prev = None # Cricular linked lists
true
83219cbcfc63bca57beeb4acedec728c56d4b927
sharadm20/python-excersise
/daily_coding_problem/problem_3.py
UTF-8
772
4.15625
4
[]
no_license
"""Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well. For example, the input [3, 4, -1, 1] should give 2. The input [1, 2,...
true
e54ac9593c4a95e82a15bb948153b9bfd7a8f526
smilezjw/LeetCode
/P132_Palindrome Partitioning II/Palindrome Partitioning II.py
UTF-8
1,705
3.4375
3
[]
no_license
# coding=utf8 __author__ = 'smilezjw' class Solution: # Time Limit Exceed def minCut_dfs(self, s): Solution.res = 2 ** 31 - 1 self.partition(s, 0) return Solution.res def partition(self, s, cut): if len(s) == 0: Solution.res = min(Solution.res, cut - 1) ...
true
3c9ee0f3dc24585fee3a7fc8f7a3c024ac9c5cf3
abulka/Pythonista
/Examples/Animation/AnalogClock.py
UTF-8
1,399
3.296875
3
[ "BSD-3-Clause" ]
permissive
''' A simple analog clock made of ShapeNodes. ''' from scene import * from math import pi, sin, cos from datetime import datetime class Clock (Scene): def setup(self): r = min(self.size)/2 * 0.9 circle = ui.Path.oval(0, 0, r*2, r*2) circle.line_width = 6 shadow = ('black', 0, 0, 15) self.face = ShapeNode(c...
true
f75387c3643d868cbe2547454d6b6dc2486ce773
SFrinking/NER-visualisationHistoricalDutch
/RunModel_on_folder.py
UTF-8
3,310
2.6875
3
[]
no_license
#!/usr/bin/python # This scripts loads a pretrained model and a raw .txt files. It then performs sentence splitting and tokenization and passes # the input sentences to the model for tagging. Prints the tokens and the tags in a CoNLL format to stdout # Usage: python RunModel_on_folder.py modelPath inputPath # Usage: py...
true
04d843a1c9e3df1e02f8114ec49d0a1a86f6f3fb
trevor403/GBA-Pokemon-Hacking
/gbahackpkmn/trainers/trainerclasses.py
UTF-8
635
2.796875
3
[]
no_license
from gbahackpkmn.strings import StringList class TrainerClasses(): def __init__(self, rom): self.rom = rom trainerclasstable = rom.metadata['trainerclasstable'] self.numberoftrainerclasses = rom.metadata['numtrainerclasses'] self._names = StringList(rom, trainerclasstable, 13,...
true
5f50358517d37a731351907d4de83b3bfed60415
szg7044315/Spider4
/demo_threading_lock.py
UTF-8
1,220
3.625
4
[]
no_license
''' Python 3.X threading 模块演示 Demo threading 锁同步机制 当注释掉 self.lock.acquire() 和 self.lock.release() 后运行代码会发现最后的 count 为 467195 等,并发问题。 当保留 self.lock.acquire() 和 self.lock.release() 后运行代码会发现最后的 count 为 1000000,锁机制保证了并发。 ''' import threading from threading import Thread class LockThread(Thread): count = 0 ...
true
fd7675203b2e72978086f899ddbe8babb666e1dd
tgoel5884/twoc-python
/Day1/program5.py
UTF-8
625
3.484375
3
[]
no_license
a=int(input("Enter score by player 1: ")) b=int(input("Enter score by player 2: ")) c=int(input("Enter score by player 3: ")) print("Strike rate of player 1: ",a*100/60) print("Strike rate of player 2: ",b*100/60) print("Strike rate of player 3: ",c*100/60) print("Score of player 1 if 60 more balls is played : ",...
true
4bd9380d38765ba35fee90b40fc5310e60a1db52
langrenzhang/laowangwork
/test/shai_tingting.py
UTF-8
1,435
3.109375
3
[]
no_license
#coding=utf-8 ''' ''' import xlrd from pyExcelerator import * #下面是读和处理数据 data = xlrd.open_workbook('10.2.xls') table = data.sheets()[0] #通过索引顺序获取第一个工作表 #a = table.row_values(1) a = table.col_values(1) #获取列 a = list(set(a)) #去重 print type(a) print len(a) #a2 = tabl...
true
7755db8414075cad3454592f87f5210dc262360a
taltil/ReminderBot
/SQLManger.py
UTF-8
2,955
2.984375
3
[]
no_license
import sqlite3 class SQLManger(object): def __init__(self): self.conn, self.cur= self.open_connection() if self.is_empty(): self.id = 1 else: self.id = self.__last_id() def open_connection(self): conn = sqlite3.connect('reminderDB') cur = conn.c...
true
b71a42fa6d1238cdfc23f3329260a9e780895ecf
ogarnica/Casa
/robot.py
UTF-8
326
3.828125
4
[]
no_license
import turtle turtle.setup(1000, 700) t = turtle.Pen() t.pensize(5) t.speed(20) t.penup() t.goto(-490, -340) t.pendown() def movimiento(): t.forward(995) t.left(90) t.forward(5) t.left(90) t.forward(995) t.right(90) t.forward(5) t.right(90) for x in range(100): movimiento() turtle....
true
d3954d54179f241f75a37f73b9432b6d88db22db
AngieAnahi/TareaPython
/Modulo2/Soluciones_Visual/cesar.py
UTF-8
1,312
3.953125
4
[ "Apache-2.0" ]
permissive
print("Problema Encriptación Cesar:") def comprobar_positivo(num) : if k > 0 : return True return False def codigo_ceaser(text, abc) : list_texto = list(text.lower()) encriptado = list() for index,valor in enumerate(list_texto) : if list_texto[index] == ",": e...
true
21974b182ce0604f29cfdc1853cc744a11ec0b6f
pavoli/checkIO
/sendgrid/stressfull_subject.py
UTF-8
986
3.71875
4
[]
no_license
# -*- coding: utf-8 -*- __author__ = 'p.olifer' """ The function should recognise if a subject line is stressful. A stressful subject line means that all letters are uppercase, and/or ends by at least 3 exclamation marks and/or contains at least one of the following “red” words "help", "asap", "urgent". Any of those "...
true
b300e7d4ead51a22b819f0bc0978bc4dc5cd3675
sonamk15/Basic_python
/sort3.py
UTF-8
364
3.296875
3
[]
no_license
# a = [12,0,39,50,1] # first = a[0] # i = 0 # j = 1 # while i < len(a): # if a[i] < first: # tmp = a[i] # a[i] = a[j] # a[j] = tmp # i += 1 # print(a) a=[12,0,39,50,1] i=0 while i<len(a): key=i j=i+1 while j<len(a): if a[key]>a[j]: key=j j+=1 ...
true
9eede4ddce3a090e54387af93275dfe37f2c0a10
quangbk2010/UsedCar
/Code/Task1.py
UTF-8
8,803
2.8125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Oct 24 21:22:47 2017 @author: user """ import numpy as np import pandas as pd import tensorflow as tf from sklearn.preprocessing import OneHotEncoder import matplotlib.pyplot as plt import time import argparse import os # Read training data from csv train file...
true
5cd34e23b8d05934ace060235993a54336a9447a
futureopen/njt_schedule_aggregator
/app.py
UTF-8
1,823
2.6875
3
[]
no_license
from flask import Flask, render_template import njt_scraper import tabulate app = Flask(__name__) TO_N_ARLINGTON = [ 'http://mybusnow.njtransit.com/bustime/wireless/html/eta.jsp?route=40&direction=Kearny&id=30969&showAllBusses=on', 'http://mybusnow.njtransit.com/bustime/wireless/html/eta.jsp?route=30&dire...
true
ee597271af3f2188e1472518c8053111665ccd50
somayejalilii/somayejalili_finalpythonproject
/admin.py
UTF-8
3,122
3.078125
3
[]
no_license
import csv from loger import file_logger, file_logger2 class Ticket: """ In this class, the possibility of purchasing tickets and calculating the price is done with the discount and edit list of tickets listings """ def __init__(self, id_ticket, discount_code, name_event, expdate_event, time_event...
true
65885529f4276391b9f4eae7fde8538da964b32b
bradyz/sandbox
/challenges/ut_acm_9_9/terminated.py
UTF-8
948
3
3
[]
no_license
from queue import Queue def bfs(x, y, ex, ey, g, n): q = Queue() v = set() q.put((x, y, n // 2)) v.add((x, y)) while not q.empty(): x, y, z = q.get() if x == ex and y == ey: return "ESCAPED" for dx in range(-1, 2): for dy in range(-1, 2): ...
true
96e80f86d176ac8f08f6a385d2d8d4193e4f6281
Meghagupta658/NATURAL-LANGUAGE-PROCESSING
/NLP_NamedEntity.py
UTF-8
176
2.953125
3
[]
no_license
import nltk para = "Krishna Apra Garden is my sweet home" words = nltk.word_tokenize(para) tagged_word = nltk.pos_tag(words) namedEnt =nltk.ne_chunk(tagged_word) namedEnt.draw()
true
231bc7284aeee706eb5f3e44fc98829a58798e83
yunqingjia/cs4476
/PS1/PS1Q4.py
UTF-8
3,175
2.9375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import cv2 from skimage import io class Prob4(): def __init__(self): """Load input color image indoor.png and outdoor.png here as class variables.""" ###### START CODE HERE ###### self.imin = io.imread('indoor.png') self.imout = io...
true
23246555bb8147c91a1cb407a966603dcaf94b3b
bajarno/torcs-driver
/evolution/mutate.py
UTF-8
766
2.546875
3
[]
no_license
import tensorflow as tf import numpy as np def mutate(input_path, output_path, mean, std): sess = tf.InteractiveSession() init = tf.global_variables_initializer() model = tf.keras.models.load_model(input_path) weights = model.weights for var in weights: sess.run(init) matrix = ses...
true
cb0ff87afbdf02b8741103b84a481357a580b615
Bakkes/steammarket
/src/SteamMarketAPI.py
UTF-8
799
3
3
[]
no_license
''' Created on Aug 29, 2013 @author: Bakkes ''' import requests import re class MarketItem: def __init__(self, appid, item_name): self.appid = appid self.item_name = item_name def get_sell_count(self): return MarketItem._get_sell_count(self.appid, self.item_name) ...
true
3a90614b8234b5f9ddfcd4be2fc918271fa795f5
afcarl/intuition
/tests/api/test_datafeed.py
UTF-8
9,643
2.5625
3
[ "Apache-2.0" ]
permissive
''' Tests for intuition.api.datafeed ''' import unittest from nose.tools import raises, ok_, eq_, nottest import random import pytz import datetime as dt import pandas as pd import intuition.api.datafeed as datafeed from intuition.data.universe import Market from intuition.errors import InvalidDatafeed import dna.test...
true
fecdf895dee1a031214b6c2e4afb7de12eeb0782
colbeseder/codingChallenges
/wordsearch.py
UTF-8
2,650
4.03125
4
[]
no_license
''' Efficiently find start and end coordinates for words in a wordsearch Sample output: {'c': ((0, 0), (0, 0)), 'car': ((0, 0), (0, 2)), 'carpet': ((0, 0), (0, 5)), 'cat': ((0, 0), (2, 0))} ''' class WordsearchSolver(): vectors = [ (+1, 0 ), # right > ...
true
449685325938956bbba89a8ee70ea85b2b3805df
biomed-bioinformatics-bootcamp/bmes-t580-2019-coursework-rra42
/Module06/wizard_user.py
UTF-8
4,235
3.75
4
[ "MIT" ]
permissive
import wizard_code from wizard_code import Creature,Wizard,IceWizard,ORCS,ELF,FireWizard,Dwarf # imports each class from the code with # class definitions import random # imports random for random choice of villains try: # this try is here to import a code as a shoretened version of the name just for practice impo...
true
0ad7580706380136ff9aa286e9ae89a0c60a4150
kellyseeme/pythonexample
/514/client.py
UTF-8
303
2.53125
3
[]
no_license
#!/usr/bin/env python import socket HOST = '192.168.1.60' PORT = 9999 s = socket.socket() s.connect((HOST,PORT)) while True: # s = socket.socket() # s.connect((HOST,PORT)) kel = raw_input('>>>') s.sendall(kel + '\n') print s.recv(1024) if kel == 'exit': break s.close()
true
365c51d903761ad88ab30c4b38b24634de345088
madelynmmacdonald/probability_calculator
/prob_calculator.py
UTF-8
2,671
3.328125
3
[ "MIT" ]
permissive
import copy import random class Hat: def __init__(self, **kwargs): # init the hat, and create a list for the hat w/ a variable # of kwargs self.contents = [] self.not_in_hat = [] for key, value in kwargs.items(): for i in range(0, value): self.contents.a...
true
d00ddb954d4d454822a8218539f4df4643f10ac9
bartleatham/Duplicate_jpg
/Date_dup.py
UTF-8
5,650
2.953125
3
[]
no_license
#! /usr/bin/env python import argparse import os import sys import datetime import shutil import hashlib from PIL import Image ######################################### ###First find all .jpg files and move them to ./year/date folders def find_and_move(src_dir): for i in src_dir: if os.path.exists(i): ...
true
74f8fbeb3e40afdcb079c2b70a3f4b56235844ae
abalkin/tz
/tz/tools.py
UTF-8
655
2.953125
3
[ "MIT" ]
permissive
import itertools from datetime import datetime def pairs(iterable): a, b = itertools.tee(iterable) next(b, None) return zip(a, b) if hasattr(datetime, 'fold'): def enfold(dt, fold=1): return dt.replace(fold=fold) else: class _DatetimeWithFold(datetime): __slots__ = () @p...
true
2b1a6ce4562977b5c9afc0328cf7f603989d2b04
noa21-meet/meetyl1
/facebook.py
UTF-8
3,027
3.203125
3
[]
no_license
users=[] posts=[] comments=[] username='noa' password='123' ''' random=0 while random==0: try_username=input('what is your username?') try_password=input('what is your password?') if try_username==username and try_password==password: random=1 print('welcome!!!') else: print('try again please!') ''' class...
true
a35c3acda4ac3ebecabfc317380baefa8853ab8d
gahlawat36/Sentiment_Analysis
/app.py
UTF-8
876
3.15625
3
[]
no_license
# importing Flask and other modules from flask import Flask, request, render_template from prediction import predictions app = Flask(__name__) # A decorator used to tell the application # which URL is associated function @app.route('/', methods=["GET", "POST"]) def gfg(): if request.method == "POST": # ...
true
ab6874d694bb9980117ed772416d02e4437e0662
theladyjaye/pycloud
/pycloud/utils/collections.py
UTF-8
948
2.75
3
[]
no_license
""" Both AttributeDict and AliasDict were inspired by: https://github.com/fabric/fabric/blob/master/fabric/utils.py """ class AttributeDict(dict): def __getattr__(self, key): try: return self[key] except KeyError: raise AttributeError(key) def __setattr__(self, key, va...
true
ef2ee3708d6b5e0d44538846dc4478de15bbd7a1
amolbais05/python-practice
/input.py
UTF-8
87
3.8125
4
[]
no_license
n = 3; print("Your Entered {} ".format(n)) for i in range(1,n+1): print(i,end="")
true
ada3833327437eb7bcc48706b94bdf1ff7497774
berkayucerr/tfexercises
/track_with_hsv_filter.py
UTF-8
2,094
2.8125
3
[]
no_license
import argparse import imutils import cv2 # construct the argument parse and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-v", "--video", help="path to the (optional) video file") args = vars(ap.parse_args()) #greenLower = (29, 86, 6) #greenUpper = (64, 255, 255) blueLower = (110, 50, 50) bl...
true
1827fb94ff1f90765c285baeebb1a949e29cfb21
ravali231/UITestingpython
/Linksandscreenshotnlogger.py
UTF-8
1,405
2.609375
3
[]
no_license
import time import logging from selenium import webdriver from selenium.webdriver.common.keys import Keys from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.by import By """ driver = webdriver.Chrome(ChromeDriverManager().install()) driver.maximize_window() #links driver.get("ht...
true
98cc729ea9c6684f2075c8a01307589b8603fdf4
ismail-a/WiFiSurveyScripts
/mergeCSV.py
UTF-8
1,022
3.078125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ merge AP lists CSV (Point id, Datetime, BSSID, SSID, RSSI, Channel) and Coordinates CSV (Point id, X, Y, Direction) assuming Point id as a key columnn. Usage: ./mergeCSV.py aps.csv coordinates.csv > wifi_survey.csv """ import sys import csv args = sys.argv coordinat...
true
98e11f664989a4cb9439a5b124c05435f6967fb9
barjinderpaul/Programming
/python/number_system.py
UTF-8
311
3.765625
4
[]
no_license
#number conversion #decimal to binary num = 25 bin_num = bin(num) print(bin_num) print(bin_num[2:]) #binary to decimal binary = 0b11001 print(binary) #decimal to octal : num = 25 num_oct = oct(num) print(num_oct) #decimal to hex : num = 25 num_hex = hex(num) print(num_hex) #hex to decimal : print(0x19)
true
164f8b0ebadb7a91e4bdd4e8a8893ec843eb9f98
elPintozo/Python3.x
/herencia.py
UTF-8
996
3.84375
4
[]
no_license
class Animal(): @property def terrestre(self): return True; class Felino(Animal): @property def garras_retractiles(self): return True; def cazar(self): print("EL felino caza") class Mascota: def __init__(self, nombre): self.nombre = nombre def mostrar_nombre(self):##funcion override * print("El no...
true
6b94f566a57d727ec9cc614b144897cccbb31967
zlolwi/kdt_sm2
/AH/mqtt.py
UTF-8
1,936
2.53125
3
[]
no_license
import paho.mqtt.client as mqtt import multiprocessing as mp task_queue = mp.Queue() # 콜백 함수 정의하기 # (mqttc.connect를 잘 되면) 서버 연결이 잘되면 on_connect 실행 (이벤트가 발생하면 호출) def on_connect(client, userdata, flags, rc): print("rc: " + str(rc)) # 브로커에게 메시지가 도착하면 on_message 실행 (이벤트가 발생하면 호출) def on_message(client, obj, msg): ...
true
31da6cfeb4344448b6fb1e41a4a118253c77cda0
pradyumn014/NeuralArchitectureSearch
/project_dir/nodes/max_pool_block.py
UTF-8
853
2.703125
3
[]
no_license
import torch.nn as nn from node import node class max_pool_block(nn.Module, node): def __init__(self, in_channels, in_h, in_w, kernel_size, padding = 0, stride = 1): super(max_pool_block, self).__init__() node.__init__(self, (in_channels, in_h, in_w)) self.kernel_size = kernel_size ...
true
14bd7d85fcf1aa401c9a8dca85d6c7a0be8ff930
adamjbradley/wavelets_STP
/preprocess.py
UTF-8
6,037
3.5
4
[]
no_license
""" File name: preprocess.py author: Sheng Yang Date Created: 2021/04/12 This file read in the original data, convert open, close, high, low, and trade volume at each minute to wavelet coefficients, and store the coefficients At each timestamp, the former window = 240 many minutes are considered, and the following lag...
true
5ce27cc33ebb8c2d7a82b23a012349fe06db0b23
PhuocBan/master
/Vietnamese Context-Sensitive Malicious Spelling Error Correction/SETUP/Thí nghiệm/Thí nghiệm 2/data/TN2.py
UTF-8
3,687
2.84375
3
[]
no_license
import xlsxwriter import pickle from sklearn.metrics import classification_report import numpy as np workbook = xlsxwriter.Workbook('TN1.xlsx') worksheet = workbook.add_worksheet() worksheet.set_column('A:T', 100000) def to_label(int_label): if int_label == 0: return 'CLEAN' elif int_lab...
true
53c5d05d700636e3bb080f17088f88b58d190d22
BrandonLMorris/auacm-cli
/tests/competition_tests.py
UTF-8
3,910
2.71875
3
[ "MIT" ]
permissive
"""Tests related to competitions""" # pylint: disable=invalid-name, import-error, no-name-in-module import unittest, auacm from mocks import MockResponse, COMPETITIONS_RESPONSE, COMPETITION_DETAIL from unittest.mock import patch class CompetitionTests(unittest.TestCase): """Tests related to competitions""" ...
true
74fc24036fe39402192f2feb3c4bf5edeca41333
hashtag-ai/smart_hedging
/source_code/main12.py
UTF-8
3,427
2.640625
3
[]
no_license
# Smart Hedging Main Routine import os import pandas as pd import matplotlib.pyplot as plt import scipy.cluster.hierarchy as shc from sklearn.cluster import AgglomerativeClustering import numpy as np wdir = os.getcwd() datadir = os.path.join(wdir,"data\TPC") fas133_data_filename = "/fas133_data_20200430....
true
7635872a13ab89ca6fa38f0712abce0bd8b2e9aa
linzzz98/MarkerSfM
/opensfm/commands/results.py
UTF-8
4,944
2.578125
3
[ "BSD-2-Clause" ]
permissive
import logging import time import networkx as nx from networkx.algorithms import bipartite import numpy as np try: import matplotlib.pyplot as plt except: pass from opensfm import dataset from opensfm import matching logger = logging.getLogger(__name__) class Command: name = 'results' help = "returns...
true
13a9579237737f3745e82c0867c276681f74291e
soumyardash/SemEval2020-Task4
/Subtask_A/model.py
UTF-8
1,707
2.78125
3
[]
no_license
import torch import torch.nn as nn from transformers import RobertaModel class CVEclassifier(nn.Module): def __init__(self, freeze_roberta = False, hidden_dropout_prob=0.1, num_labels=1): super(CVEclassifier, self).__init__() #Instantiating BERT model object self.roberta_layer = RobertaMo...
true
40cf7799ce63be9518d8da5ba3501d191fa02096
dringakn/ROSExamples
/script/quadrotor.py
UTF-8
8,690
2.921875
3
[ "MIT" ]
permissive
import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib.animation import FuncAnimation from time import time class Quadrotor: def __init__(self, m=0.65, Ix=0.0075, Iy=0.0075, Iz=0.013, Ir=6e-5, L=0.23, Kf=3.13e-5, Km=7.5e-7,...
true
e9065bb22ed39c028f1c461c528f47caf03eeefa
mi-ph/advent-2020
/18-operation-order/program.py
UTF-8
3,408
3.703125
4
[]
no_license
def isSymbol(char): return (char >= '0' and char <= '9') or char == '+' or char == '*' def operate(n, op, n2): if op == '+': return n + n2 else: return n * n2 def evaluate(puzzle): i = 0 LHS = 0 op = '+' while i < len(puzzle): if puzzle[i] == '(': j = 1 ...
true
ff35451785c5d42da5b5a40898965b6ec8ea9062
kraszor/Hackaton_PiKNIk
/batch_2/finanseiobiektowosc.py
UTF-8
1,213
3.375
3
[]
no_license
import pandas as pd data_frame = pd.read_csv("faktura_do_zad_Python_15.10_21.00.csv", delimiter=";", names=["nazwa_produktu", "cena_netto", "VAT", "narzut"]) def formula(price, tax, markup): correct_price = (float(price) * 0.01) * \ (1 + (flo...
true
af95d8f08454d74087dff147c50f427118c8aae8
Yush1nk1m/Study_Python
/list_in.py
UTF-8
106
3.5625
4
[]
no_license
# 리스트를 선언합니다. array = [i ** 2 for i in range(0, 20, 2)] # 출력합니다. print(array)
true
0e97402cc6f777627b12eeea42d6d21a64a0f178
regygu/hello
/hello2.py
UTF-8
221
3.5625
4
[]
no_license
#!/usr/bin/env python3 import sys arglist = sys.argv def lenght_of_arglist(arglist): return len(arglist) if lenght_of_arglist(arglist) == 1: print("Hello World") else: print("Hello " + arglist[1])
true
145d1e89cc205584ede4478c792fcb131239aaac
Seonmi-Hwang/study
/Python/LAB3/Q7.py
UTF-8
140
3.234375
3
[]
no_license
score = [30, 32, 40, 50, 60, 70, 80, 90] sum = 0 for s in score : sum += s print("sum = {}, avg = {}".format(sum, sum / len(score)))
true
1bafd8d3d19ef2a0ab434e211c03659fd476d22d
ankitsri98/Library-Management-System
/Student.py
UTF-8
5,660
3.03125
3
[]
no_license
from datetime import* class student: def __init__(self,name,add): self.Name=name self.address=add def Assign_Book(self,sid,bid): flag = 0 flag1 = 0 flag2 = 0 with open('students.txt','r') as b: All_Data=b.readlines() #All_Data is a List ...
true
587c629cc5f618126cc512b8bc2e0dfea4796be6
daniellopes04/uva-py-solutions
/list1/696 - How Many Knights.py
UTF-8
794
3.53125
4
[]
no_license
# -*- coding: UTF-8 -*- def solve(n, m): if (n > m): n, m = m, n if (n == 1): return m if (n == 2): ans = int((m / 4)) * 4 if ((m % 4) == 0): return ans else: if((m % 4) > 1): return ans + 4 else: r...
true
7e3db3d92df44d4265c6300b9267a6e5d4041299
TanishaProgramer/Python
/lambda1.py
UTF-8
73
3.015625
3
[]
no_license
def myfunc(n): return lambda a :a*n*n res = myfunc(4) print(res(1))
true
2ee228ac0fc4f015851535cacf6179590e2563ed
Amaror/CL
/Analyser.py
UTF-8
1,125
3.046875
3
[]
no_license
import re import numpy as np txtPath = "English-w2v-skip-10-11.txt" readnumber = 27972 #Number until the reader reads entries out of the file. Set in place to prevent decoding errors. processnumber = 100 #Number of entries compared with each other. To prevent performance problems. def verteilung(wlist, vlist): wv...
true
6c06d964449c3120c66b68ba16a85ad49b7cdbda
rrampage/udacity-code
/cs373/Exam/12.py
UTF-8
5,307
4
4
[]
no_license
# cs373 ; Exam ; 12 # ------------------- # Background Information # # In this problem, you will build a planner that helps a robot # find the shortest way in a warehouse filled with boxes # that he has to pick up and deliver to a drop zone. #For example: # #warehouse = [[ 1, 2, 3], # [ 0, 0, 0], # ...
true
8a81f82d895ad8cc873d0b2ec82495d61ebb29d9
inda18plusplus/ggerholm-compiler
/compiler/lexer.py
UTF-8
1,428
2.609375
3
[]
no_license
from rply import LexerGenerator class Lexer(object): def __init__(self): self.lexer = LexerGenerator() def _add_tokens(self): self.lexer.add('PRINT', r'print') self.lexer.add('INPUT', r'input') self.lexer.add('OPEN_PAREN', r'\(') self.lexer.add('CLOSE_PAREN', r'\)') ...
true
ff071ff7f1215e440470c9ffb2e126ddf64e58d6
natandias/Python_CursoEmVideo
/061_PA_while.py
UTF-8
574
4.03125
4
[]
no_license
pt = int(input("Digite o primeiro termo da PA: ")) razao = int(input("Digite a razão da PA: ")) i=0 termos_pa = [] termo = pt while i<10: i+=1 termos_pa.append(termo) termo += razao print ("\nDez primeiros termos da PA: ") for k in termos_pa: print (k, end = ' ') mais = int(input('''\n\nDeseja im...
true
05c39295707dfe16590f4aaf0be714b732c60645
Belize22/Ceten
/InventoryButton.py
UTF-8
1,727
3.421875
3
[]
no_license
from Button import Button import pygame import math class InventoryButton(Button): # Triangle, then circle respectively. DISABLED_COLOR_SCHEME = [(80, 80, 80), (150, 150, 150)] ENABLED_COLOR_SCHEME = [(0, 0, 0), (180, 180, 180)] def __init__(self, screen, position, orientation): super().__in...
true
2ea284903c808e485c90a7ce1dbd727047c7f6ee
peter-woyzbun/fellowsweep
/fellowsweep/minesweeper/state_updater.py
UTF-8
6,292
3.375
3
[]
no_license
import copy import scipy.ndimage import numpy as np class StateUpdater(object): """ Class for updating the 'states' - what cells should be revealed - of a minesweeper game. Parameters ---------- board : numpy array An array describing the minesweeper game. existing_cell_stat...
true
79faecaf792151f3edd4d4f20318630aa6b196fd
GongFuXiong/leetcode
/interview/meituan_interview/interview_2.py
UTF-8
2,270
4.03125
4
[]
no_license
''' 题目描述: 有一款叫做空间回廊的游戏,游戏中有着n个房间依次相连,如图,1号房间可以走到2号房间,以此类推,n号房间可以走到1号房间。 这个游戏的最终目的是为了在这些房间中留下尽可能多的烙印,在每个房间里留下烙印所花费的法力值是不相同的,已知他共有m点法力值,这些法力是不可恢复的。 小明刚接触这款游戏,所以只会耿直的玩,所以他的每一个行动都是可以预料的: 1. 一开始小明位于1号房间。 2. 如果他剩余的法力能在当前的房间中留下一个烙印,那么他就会毫不犹豫的花费法力值。 3. 无论是否留下了烙印,下一个时刻他都会进入下一个房间,如果当前位于i房间,则会进入i+1房间,如果在n号房间则会进入1号房间。 4...
true
ffeb25493600874640e971a54db55e088749e5d2
johnli1029/Tweet-Authorization-Categorizer
/archive/multiclass_logistic.py
UTF-8
3,357
2.734375
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 math import re import nltk as nlp from nltk.corpus import stopwords from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from sklearn.feature_extraction...
true
cbfb79d9579a8c6e304d3b8e1527ef791141181f
GeonwooVincentKim/Python_OpenCV_MiniProject
/Main/Numpy/NumpyTEST.py
UTF-8
136
2.640625
3
[]
no_license
import cv2 img = cv2.imread('../../img/blank_500.jpg') type(img) print(img.ndim) print(img.shape) print(img.dtype) print(img.itemsize)
true
25e70c23bc109715d54e4c17e33837e2452de77a
ISISComputingGroup/reflectometer_sim
/src/parameters.py
UTF-8
5,379
3.265625
3
[]
no_license
""" Parameters that the user would interact with """ class BeamlineParameter(object): """ General beamline parameter that can be set. Subclass must implement _calc_move to decide what to do with the value that is set. """ def __init__(self, name, sim=False, init=None): if sim: ...
true
ceecb2037f518279840afc924c39f8bda2203f9a
wintertims/side_projects
/blackjack_player_vs_computer/Deck.py
UTF-8
1,515
4.4375
4
[]
no_license
''' "Deck.py" - contains a "Deck" and "Card" class. When a new deck is made, the deck will be filled with 52 unique "Card" class objects. Each card contains a "name", "value", and "suit" attribute. An example of a card: "card.name = "Jack" "card.value = "10" "card.suit" = "Diamonds" A de...
true
7a7e4444d1382ee6ab0bd82c100ccdef37c2e46c
Aryamant21/PythonCodes
/Turlt_with_ListenersEvents/main.py
UTF-8
582
3.359375
3
[]
no_license
from turtle import Turtle, Screen, forward def move_forward(): tim.forward(50) def turn_right() : tim.right(10) def turn_left() : tim.left(10) def turn_bk() : tim.bk(50) def clear(): tim.clear() tim.penup() tim.home() tim.pendown() tim = Turtle() screen = Scr...
true
264052661560f62e303131eb2ca16d3035a15d2a
davek44/utility
/citemelike.py
UTF-8
3,248
2.75
3
[]
no_license
#!/usr/bin/env python from optparse import OptionParser import urllib2 import pdb, re, math, random ################################################################################ # citemelike.py # # Choose a random paper from my citeulike account to read. #############################################################...
true
411f1f2daf65ae57bcb54f82caa0fffeed900d2c
ryanCoeurs/pyplus
/class6/2b.py
UTF-8
864
3.15625
3
[]
no_license
""" 2b. Create a Python module named 'my_funcs.py'. In this file create two functions: function1 should read the YAML file you created in exercise 2a and return the corresponding data structure; function2 should handle the output printing of the ARP entries (in other words, create a separate function that handles all p...
true
91ad26a6ff0e49357d9cee7654bc9ef2eab750da
rachel6854/Python-Projects
/python_basics_exercises/multiplication_table_easy.py
UTF-8
110
4.09375
4
[]
no_license
num=int(input("Please enter integer")) for i in range(11): print(str(i)+" x "+str(num)+" = "+str(num*i))
true
4c910cd163940882591ae6d093313be2ef296e2f
pnkj007/Car-Racing-Game
/carracing.py
UTF-8
6,692
2.78125
3
[]
no_license
import pygame import time import random import cx_Freeze pygame.init() crash_sound = pygame.mixer.Sound("crash.wav") pygame.mixer.music.load("Jazz_In_Paris.wav") display_width = 800 display_height = 600 red = (200,0,0) black = (0,0,0) white = (255,255,255) block_color = (53,115,255) green = (0,200,0) bright_red =...
true
8c8bb6545d0c8c25807ea628006ed82b4f7e7cde
zlohner/genevariants
/model/genevariants.py
UTF-8
5,882
2.671875
3
[]
no_license
import pandas as pd import numpy as np import pdb from keras.models import Sequential from keras.optimizers import SGD from keras.layers import Dense, Dropout from keras.utils import to_categorical from sklearn.model_selection import StratifiedKFold from sklearn.metrics import roc_auc_score, classification_report ...
true
17a0a146fc53de7fee71b7aa7e2dc79410ffe778
laszlokiraly/LearningAlgorithms
/ch03/hashtable.py
UTF-8
1,232
3.828125
4
[ "MIT" ]
permissive
""" Hashtable to store (key, value) pairs in a fixed hashtable using hash() % N as hash code. This table can replace values associated with a given key, but if two keys attempt to use the same location, a RuntimeError is raised. Not able to handle collisions. Do not use this for production code! ...
true
b083269252cc21e9a6aadd6d686becdf61b7dfb6
Ten-4/Questions
/solution.py
UTF-8
1,127
2.890625
3
[]
no_license
def coin_solver(coins,n): if len(coins) == 0: return -1 coins.sort() if n == 0: return 1 if len(coins) == 0 and n != 0: return 0 H = { (0,1) : 1 } for num in xrange(0,n+1): for val in coins: if (num,val) not in H: continue for val2 in coins: if val2 >= val: ...
true
28c01035603dc930bb5aabdf8e0f4bdbca91a2b1
igorMatsunaga/simplesChatBot
/aula02.py
UTF-8
816
3.21875
3
[]
no_license
# coding=utf-8 from tkinter import * root = Tk() def click(event=None): send = 'Você ' + a.get() text.insert(END, '\n' + send) if(a.get() == 'oi'): text.insert(END, '\n' + 'Bot:Oi, tudo bem?') elif(a.get() == 'olá'): text.insert(END, '\n' + 'Bot:Olá, tudo bem?') elif(a.get() == '...
true
561160a311ff12ecd26ae58d865513bcd1835b54
beejal/audio_genomics
/audio_genomics_0.3.py
UTF-8
4,977
3.109375
3
[]
no_license
#audio_genomics_0.3.py #author:beejal #updated:053017 ''' programs takes an ncbi accession number and converts each nucleotide to an audible frequency. the entire sequence is saved to a sound.wav file. ''' def main(): intro() sequence_location=2 emailaddress='me@me.com' database='nucleotide' ide...
true
84585b49ffb4c5622658f926bfc76ee6dceac2c0
hatchways/team-acorn
/server/resources/user_update_name.py
UTF-8
701
2.515625
3
[]
no_license
from flask_restful import Resource, reqparse from flask_jwt_extended import ( create_access_token, jwt_required, get_jwt_identity) import datetime from models.user_model import UserModel class UserUpdateName(Resource): @jwt_required def post(self): parser = reqparse.RequestParser() parser....
true
199d7c9696d1a6df1f43b27cebe1372732e08a9d
meloLeeAnthony/PythonLearn
/22-TensorFlow神经网络/09feed_dict参数的使用.py
UTF-8
522
2.640625
3
[]
no_license
import tensorflow as tf a = tf.placeholder(tf.float32) b = tf.placeholder(tf.float32) c = a + b cc = tf.add(a, b) x = tf.placeholder(tf.float32, None) y = x * 20 + 100 # 开启session会话 with tf.Session() as sess: c_value = sess.run(c, feed_dict={a: 20, b: 30}) print('c_value:', c_value) cc_value = sess.run(cc...
true
ba8486cdf8058d6c61c5227f0e3728a29a357e05
wusanpi825117918/study
/Day02/p_00格式化字符串.py
UTF-8
270
4.03125
4
[]
no_license
''' 格式 化字符串 ''' print(1) print(1,2,3,4) a = 1 b = 2.1123 c = 'hello' s = 'a = %d b = %f c = %s' % (a,b,c) s += ' -- world' print(s) s = f'a = {a} b = {b} c = {c}' print(s) s = 'a = {0:5d} b = {1:.2f} c = {0}'.format(a,b,c) print(s)
true
47f42226cb4ea9a521f7eb3186710f68956f6fc9
naresh242/computer-vision
/imageToText.py
UTF-8
875
2.6875
3
[]
no_license
''' Created on Oct 18, 2016 @author: NA347632 ''' import sys import requests import pytesseract from PIL import Image from PIL import ImageFilter from StringIO import StringIO import cv2 def process_image(url): image = _get_image(url) image=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY) cv2.imshow(...
true
341b9286e582b125b2863208a28bd5037ca9a6c4
elenamoron/TFG
/lpbc/app/script.py
UTF-8
770
2.546875
3
[]
no_license
import requests import json json_data=open('id_profesional.json').read() data = json.loads(json_data) def chunks(l, n): # For item i in a range that is a length of l, for i in range(0, len(l), n): # Create an index range for l of n items: yield l[i:i+n] for chunk in data: chun...
true
1a8da481f302c470831d0f0f3f12c406d668a85b
MakarVS/GeekBrains_Algorithms_Python
/Lesson_8/Check/les8/les8_task3_depth_first_search.py
UTF-8
2,273
3.765625
4
[]
no_license
''' 3. Написать программу, которая обходит не взвешенный ориентированный граф без петель, в котором все вершины связаны, по алгоритму поиска в глубину (Depth-First Search). Примечания: a. граф должен храниться в виде списка смежности; b. генерация графа выполняется в отдельной функции, которая принимает на вход число ...
true
4fbb2daba95db3865224460fe468bdf3c7a1462e
jeannefukumaru/multilingual-bert-as-service
/benchmark/proc_xnli_test.py
UTF-8
492
2.765625
3
[ "MIT" ]
permissive
import pandas as pd import jsonlines import json from config import config with jsonlines.open(config['raw_datafile']) as reader: data = [obj for obj in reader] df = pd.DataFrame(data) sentences1 = df['sentence1'] sentences2 = df['sentence2'] all_sentences = sentences1.append(sentences2).tolist() assert len(...
true
55a881cc46ea305ad801fd45d8c1605df70227e2
victorkaplunov/job_stat
/PythonAnywhereAPI.py
UTF-8
1,043
2.59375
3
[ "MIT" ]
permissive
"""Reload application script for GitHub Actions.""" import requests import os username = 'clingon' TOKEN = os.getenv('PA_TOKEN') headers = {'Authorization': f'Token {TOKEN}'} base_url = f'https://www.pythonanywhere.com/api/v0/user/{username}/' # Get first console ID response = requests.get(base_url + 'consoles/', h...
true
9f1813ca72ddc376790055e7ce4ac4c138fc7f82
thekevinscott/AudioData
/tests/test_shuffle_chunks.py
UTF-8
310
2.90625
3
[ "MIT" ]
permissive
import pytest import random from ..AudioData.utils import shuffle_chunks random.seed(1) def test_it_does_not_shuffle(): files = ['a', 'b', 'c'] assert shuffle_chunks(files, False) == files def test_it_shuffles(): files = ['a', 'b', 'c'] assert shuffle_chunks(files, True) == ['c','b','a']
true
96aa90884d04961bc505a695a45f02eeab0ea608
raylu/ykill
/update_costs.py
UTF-8
2,314
2.625
3
[]
no_license
#!/usr/bin/env python3 from decimal import Decimal import sys import requests import db rs = requests.session() def get_prices(): r = rs.get('https://crest-tq.eveonline.com/market/prices/') items = r.json()['items'] for item in items: # averagePrice updates faster but some items (AT ships) don't have one pri...
true
89bdaf67cbf318a03ed7afa366d5feddf8320da6
matrix231993/cursopython2021
/TAREA_PYTHON/TAREA_PYTHON_1/ejercicio11.py
UTF-8
348
4.4375
4
[]
no_license
#EJERCICIO 11.-Escribir un programa que lea un año indicar si es bisiesto. Nota: un año es bisiesto si es un número divisible por 4, pero no si es divisible por 100, excepto que también sea divisible por 400. año=int(input("ingrese el año:")) if año%4==0 and año%100!=0 or año%400==0: print("bisiesto") else: ...
true