blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
76c448ad494346f9cf44a903e875c66d36950a91 | Python | Jeffreyyao/pitft | /pitft_pixel_nav.py | UTF-8 | 949 | 3.125 | 3 | [] | no_license | from pitft_setup import *
import gpiozero
import os
import time
pixel_size = 10
width = 135
height = 240
x = 0
y = 0
btnUp = gpiozero.Button(23)
btnDown = gpiozero.Button(24)
black = color565(0,0,0)
white = color565(255,255,255)
def drawPixel(x,y,color):
display.fill_rectangle(x,y,pixel_size,pixel_size,color)
... | true |
81d71ec4b918bb16714258306e5bf625e7388e7c | Python | elopez515/python-challenge | /PyBank/main.py | UTF-8 | 2,835 | 3.734375 | 4 | [] | no_license | import os
import csv
#Path to collecet data form our Resources folder
budgets_csv = os.path.join("Resources", "budget_data.csv")
#read in the csv file
with open(budgets_csv, 'r') as csv_file:
# Split the data on commas
csv_reader = csv.reader(csv_file, delimiter=',')
#Read the header row first
csv_h... | true |
78d8d631a652b383a75e8131295ea1d666158d78 | Python | angwhen/mcm-2018b | /correlate_all_speakers_country_pop.py | UTF-8 | 3,358 | 2.734375 | 3 | [] | no_license | import pickle
import matplotlib.pyplot as plt
import numpy as np
all_speakers_dict = pickle.load(open("all_speakers_dict.p","rb"))
lang_pop_dict = pickle.load(open("lang_pop_dict.p","rb"))
l1_speakers_num_dict = {}
l2_speakers_num_dict = {}
lang_pop_2010_num_dict = {}
country_langs = lang_pop_dict.keys()
# print co... | true |
16712d060a4a7ca330935cd9a459b9a39cb8c479 | Python | SHINE1607/coding | /dynamic_programming/end_game.py | UTF-8 | 1,023 | 3.53125 | 4 | [] | no_license | # GIven some denominations of coins arranged in an order, we have to play a game to optimally maximze the score
# if 2 playes alternatievely make the selection
# the objective is to maximize the profit of player 1
from collections import defaultdict
def end_game(n, coins):
dp = defaultdict(lambda : [(-1, -1)]*... | true |
78993f860185e2c66757be50d569e8c6de74658e | Python | qbitkit/qbitkit | /qbitkit/anneal/eigensolver.py | UTF-8 | 3,279 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | from dwave.plugins.qiskit import DWaveMinimumEigensolver as __dwmes__
from qiskit.aqua.algorithms import NumPyMinimumEigensolver as __npmes__
from qbitkit.anneal.embed import composite as __ec__
class Solve:
def get_solver(self='DWaveMinimumEigensolver'):
"""Get a D-Wave MinimumEigensolver, or NumPyMinimu... | true |
1b9c7792373175f27ec443c6c5b9b04bec35dd4c | Python | EduardoHidalgoGarcia/ApplicationtoResearch_Fellowship_NOVA_SBE_2019 | /BigDataMethods/Exercises_AWS/sparkml/SparkML.py | UTF-8 | 7,431 | 2.75 | 3 | [] | no_license |
# Added libraries.
from pyspark.sql import SparkSession
from pyspark.sql.functions import *
from pyspark.sql.window import Window
import numpy as np
pd.set_option('display.max_columns', 60)
defun = spark.read.csv('s3://daniel-sharp/decesos/defun_2016.csv', header =True)
causas = spark.read.csv('s3://daniel-sharp/d... | true |
eb552f2f855962a0e7c26cf004734cb727910e52 | Python | miseminger/py-samples | /adaptationgrowthcurves.py | UTF-8 | 3,928 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 1 10:19:10 2019
@author: miseminger
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_excel('/Users/miseminger/Documents/celladaptationtracking.xlsx', sheet_name='Sheet1') #reads the whole excel file into memory
df['hours'] = np.na... | true |
1adf6356bc1cbafa881d2640517f67629ac3efd3 | Python | mikaelho/syncx | /tests/test_manager.py | UTF-8 | 1,801 | 2.75 | 3 | [
"Unlicense"
] | permissive | from types import SimpleNamespace
from syncx import manage
from syncx import tag
from syncx.manager import Manager
from syncx.manager import ManagerInterface
from syncx.serializer import JsonSerializer
from syncx.serializer import YamlSerializer
def test_get_serializer():
assert Manager.get_serializer('foo') is ... | true |
dd20bebc0f687c25e89a44d74846ba0116523a4d | Python | CPSC-SMC/MathModeling | /Experimental/Accel.py | UTF-8 | 2,045 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Accelerometer app data
@author: sbroad
"""
import numpy as np
import matplotlib.pyplot as plt
class Accelerometer:
def __init__(self, filename):
self.filename = filename
self.load_data()
def load_data(self, filename = ""):
if len(filename) > 0:
... | true |
b1d5514d9cfe38b30fed4ab15c3f7994095cd28f | Python | cruzer1310/Python | /ordereddict.py | UTF-8 | 340 | 3.40625 | 3 | [] | no_license | from collections import OrderedDict
n = int(input())
dic={}
dic=OrderedDict()
for x in range(n):
item,space,price = input().rpartition(" ")
#print(f"item : {item} price : {price}")
if item in dic:
dic[item]=dic[item]+int(price)
else:
dic[item]=int(price)
for x in dic:
... | true |
f163b43a6dceecae3e5f1e6bc338da21947af975 | Python | sravanareddy/appinventor | /identify_similar.py | UTF-8 | 4,829 | 2.578125 | 3 | [] | no_license | from __future__ import division
import ujson
from collections import defaultdict
import time
import networkx as nx
import numpy as np
import sys
from annoy import AnnoyIndex
from sklearn.datasets import load_svmlight_file
import argparse
import codecs
def get_slices(project_vectors, project_names, sliceprop, sliceinde... | true |
576706e992f4ff31ea3b180601eb5059388ad212 | Python | Eugeneifes/viasat | /ivi_parser.py | UTF-8 | 3,185 | 2.6875 | 3 | [] | no_license | #-*- coding: utf-8 -*-
from BeautifulSoup import BeautifulSoup
import urllib2
import re
import sqlite3 as db
from pymongo import MongoClient
"""
conn = db.connect('ivi.db')
cursor = conn.cursor()
"""
'''SQLite connection'''
"""
cursor.execute("drop table films")
cursor.execute("drop table series")
cursor.execute(... | true |
4f5dd0ba80d04c2ad8abf1c374ff95a1871d970d | Python | Davidhw/AlgorithmsPractice | /binarySearchTree.py | UTF-8 | 5,608 | 3.3125 | 3 | [] | no_license |
class Node(object):
def __init__(self,key,parent=None,left=None,right=None):
self.key = key
self.parent = parent
self.left = left
self.right = right
def __repr__(self):
root = self.getRoot()
dist = str(self.distFromTop(root))
k = str(self.key)
... | true |
ab1259d09e128a9f2826528e5c2c35bce6e992a1 | Python | tushar-semwal/openAI-gym | /test.py | UTF-8 | 292 | 2.71875 | 3 | [] | no_license | import gym
from gym import spaces
env = gym.make('CartPole-v0')
#print(env.action_space)
obs = env.observation_space
print(obs[0])
print(env.observation_space.high)
print(env.observation_space.low)
space = spaces.Discrete(8)
x = space.sample()
assert space.contains(x)
assert space.n==8
| true |
4f8819d4ad705f97e372ebb899c4595ba1362cdb | Python | Jurmakk/Informatika | /Python uloha lodky.py | UTF-8 | 3,199 | 3.21875 | 3 | [] | no_license | from tkinter import *
import random
master= Tk()
canvas_width = 800
canvas_height = 600
w = Canvas(master, width = canvas_width, height = canvas_height)#
w.pack()
def pozadie():
w.create_rectangle(0,300,800,600, fill="darkblue")
w.create_rectangle(0,0,800,300, fill="white")
def mesiac():
... | true |
8cfc0669dcd8e0663fe8ccd837244fb361cb0fc5 | Python | joaojunior/hackerrank | /combinations/combinations.py | UTF-8 | 622 | 3.234375 | 3 | [
"MIT"
] | permissive | from typing import List
class Solution:
def combine(self, n: int, k: int) -> List[List[int]]:
self.result = []
self.n = n
self.k = k
self.current_combination = []
self.generate_combination(1)
return self.result
def generate_combination(self, i: int):
if... | true |
ccaeab24bee6982147a8e82f592b81bfd7abb841 | Python | ravishdussaruth/deployer | /utils/system.py | UTF-8 | 2,439 | 3.765625 | 4 | [
"MIT"
] | permissive | import os
import shutil
class System:
def __init__(self):
pass
def _create_command(self, commands: list) -> str:
"""
Concatenating commands to form a string.
:param commands: list
:returns: str
"""
return ' && '.join(commands)
def _run_command(s... | true |
7f7faa7527d9a0c06805a44889d8f25f8062a5ec | Python | Skorpionmaf/PA | /lab3/foglio3_1.py | UTF-8 | 2,552 | 3.625 | 4 | [] | no_license | import math
class Figure:
'''The class it's used for implemet the lessthan method __lt__ equal for all figures'''
def __init__(self, sortType = 'a'):
if sortType != 'a' and sortType != 'p':
raise Exception('Invalid argument: sortType must be a or p, default = a')
self._sortType = so... | true |
56d934a7b0a2f2de17e516bd355c0dd2aced3eec | Python | sauravtom/1729 | /core/faceslide.py | UTF-8 | 2,310 | 2.78125 | 3 | [] | no_license |
import sys
import os
import subprocess
def main(video_file):
video_filename = video_file.split('/')[-1]
video_filename_no_ext = video_filename.split('.')[-1]
#converting the video to 1x1 frames
#os.system("ffmpeg -i %s -r 1 -f image2 -s 1x1 dump/frames/image-%%07d.png"%(video_file))
num_arr =[]
prev_prev_ppp ... | true |
743c85cfd3143aefacda762d35bad08b6608f7f3 | Python | SORDAS-R/VisionProject | /working_human_search.py | UTF-8 | 1,090 | 2.96875 | 3 | [] | no_license | #this program searches for a human face, it prints 'searching' unitil it finds a face then it post a window
import numpy as np
import cv2
def initial_win():
cap = cv2.VideoCapture(0)
ret, frame = cap.read()
cv2.imwrite("img.jpg", frame)
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_... | true |
a2b9cf28f05bb34fcd520a37fc640c9754e30e56 | Python | bwstarr19/turbo-couscous | /benchmarking/project.py | UTF-8 | 5,284 | 2.546875 | 3 | [] | no_license | """A CLI for generating simulated data from TomoPy phantoms."""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import logging
import click
import tomopy
import numpy as np
import matplotlib.pyplot as plt
logger = logging.getLogger(__name__)
@c... | true |
444e2ac2cccbe9743f91e14e7b18542091058eb2 | Python | vitthalpadwal/Python_Program | /hackerrank/preparation_kit/search/balanced_forest.py | UTF-8 | 6,015 | 3.875 | 4 | [] | no_license | """
Greg has a tree of nodes containing integer data. He wants to insert a node with some non-zero integer value somewhere into the tree. His goal is to be able to cut two edges and have the values of each of the three new trees sum to the same amount. This is called a balanced forest. Being frugal, the data value he i... | true |
c080994bb79c8b6a4b05865fd2ae89ee4ea76ac8 | Python | felix0040/gittest | /iteration.py | UTF-8 | 4,554 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os
from Canvas import Line
a = os.listdir("d:\\TMP")
print a
with open("d:\\TMP\\isup.log") as f:
try:
while True:
line = next(f)
print line
except StopIteration:
pass
liter = [1,2,3,"abc", 'cde', 'efr']
itermList = iter(liter)
while True:
... | true |
c1d3087080ed125d6d7d8b016978f24ea2fcb11b | Python | 93jpark/solve_kattis | /Akcija.py | UTF-8 | 370 | 3.125 | 3 | [] | no_license | # Problem ID:akcija
n = int(input())
d = n//3
list = []
sum = 0
for x in range(0, n):
list.append(int(input()))
list.sort()
list.reverse()
#print(list)
#print(list)
for x in range(0, n):
if x%3 == 2:
if x!=0:
list[x] = 0
else:
#print(list)
for x in list:
... | true |
9705efb067ff3080254c8bfe74f3f3a8b4b17c6c | Python | HarshCasper/Rotten-Scripts | /Python/Valid_Phone_Number_Extractor/valid_phone_number_extractor.py | UTF-8 | 2,888 | 3.421875 | 3 | [
"MIT"
] | permissive | import re
import argparse
parser = argparse.ArgumentParser(
description="Find mobile or phone numbers from input text file."
)
# list of cli arguments/flags
parser.add_argument("--mobile", "-m", help="Extract mobile numbers only.")
parser.add_argument("--phone", "-p", help="Extract Phone Numbers only.")
parser.ad... | true |
c3045183094956c64d482dc1c301975382c8d2bd | Python | Dawyer/Code | /problems/LeetCode/LeetCode6-Z字形变换.py | UTF-8 | 393 | 3.484375 | 3 | [] | no_license | def convert(s,numRows):
if numRows == 1:
return s
rows = ['\n']*min(numRows,len(s))
godown=False
currow=0
for c in s:
rows[currow] += c
if currow == 0 or currow == numRows-1:
godown = not godown
if godown:
currow += 1
else:
... | true |
abb8dbbe69e0d1b94358a46e039b9d77df18bc64 | Python | ntmagda/Scraper | /ImageRecognition/preparing_database.py | UTF-8 | 983 | 2.875 | 3 | [] | no_license | from __future__ import division
import cv2
import numpy as np
import os
def get_images_list_from_databse(database_path, format):
for dir_path, dirs, files in os.walk(database_path):
files = list(filter(lambda x: x.endswith(format), files))
return files
def read_image(file_path):
img = cv2.im... | true |
db9c3a7201c5a699d43bb60110a081fedbc17539 | Python | bartimusprimed/SPiT | /Stacker/Management/Registers/Registers.py | UTF-8 | 781 | 2.71875 | 3 | [] | no_license | from Stacker.Management.Registers.Register import Register as R
from collections import OrderedDict
class Registers:
def __init__(self):
self.registers = OrderedDict(
set([("EIP", R.EIP),
("EBP", R.EBP),
("ESP", R.ESP),
("EAX", R.EAX),
("EBX", ... | true |
e6165fe1d517095c21ba5d8c5e4be82030395a00 | Python | zzz136454872/leetcode | /StreamChecker.py | UTF-8 | 1,858 | 3.6875 | 4 | [] | no_license | from typing import List
class Trie:
def __init__(self):
self.next = [None for i in range(26)]
self.have = False
def l2i(a):
return ord(a) - ord('a')
class StreamChecker:
def __init__(self, words: List[str]):
self.log = Trie()
self.maxLen = 0
self.queue = ''
... | true |
577673f343f4325c708f85cd162b82bdf8842293 | Python | kduy410/FaceRecognition | /graph.py | UTF-8 | 1,381 | 3.09375 | 3 | [] | no_license | import os
import numpy as np
from matplotlib import pyplot as plt
class Graph:
def __init__(self, path):
self.path = str(path)
self.array = []
self.sub_coordinates = []
def graph(self):
if os.path.exists(self.path) and self.path.endswith('.log'):
with open(self.p... | true |
9a8b0a19c8ddf3c3cb952ea746273a5ad983beec | Python | bladejun/Recommend_System_Pytorch | /utils/Evaluator.py | UTF-8 | 5,078 | 2.6875 | 3 | [] | no_license | import math
import time
import torch
import numpy as np
from collections import OrderedDict
from utils.Tools import RunningAverage as AVG
class Evaluator:
def __init__(self, eval_pos, eval_target, item_popularity, top_k):
self.top_k = top_k if isinstance(top_k, list) else [top_k]
self.max_k = max... | true |
a1a615a2ffb3ef3b57b242fe8a004fa0391ec9a7 | Python | nataliejian/learning | /AIOT課程_支持向量機SVM_MachineLearning/svm.py | UTF-8 | 770 | 2.765625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import seaborn
from sklearn.linear_model import LinearRegression
from scipy import stats
import pylab as pl
seaborn.set()
from sklearn.datasets.samples_generator import make_blobs
X, y = make_blobs(n_samples=50, centers=2, random_state=0, cluster_std=0.60)
x... | true |
f005456f9880bf454d438b912dfceb3b19e0f6ce | Python | fluttercode9/pp1 | /01-TypesAndVariables/27.py | UTF-8 | 178 | 3.8125 | 4 | [] | no_license | #gcd(A,b)
import math
a = int(input("podaj pierwsza liczbe"))
b = int(input("podaj druga liczbe"))
gcd = math.gcd(a,b)
print (f"najwiekszy wspolny dzielnik to: {gcd}")
| true |
180b995b493629bec84b3c5ff08a4e71a725b9e8 | Python | xubojoy/python-study | /python/s14/var.py | UTF-8 | 562 | 3.265625 | 3 | [] | no_license |
name = input('name:')
age = input('age:')
userInfo = '''
---------------- welcome ''' + name + '''-----------
name:'''+name+'''
age:''' + age
userInfo1 = '''
---------------- welcome %s -----------
name:%s
age:%s
''' % (name,name,age)
userInfo2 = '''
---------------- welcome {_userName} -----------
name:{_userNam... | true |
3b2581dfe3174ff7ab2ccf75b02c243dc749d8fa | Python | DerfOh/School-Programming-Projects | /Python/sevens.py | UTF-8 | 105 | 3.484375 | 3 | [] | no_license | print 'Place\t\tNumbers'
place = 0
for num in range(100, 0, -7):
place += 1
print place, '\t\t', num
| true |
a160b6132e208bf87be2f4d918fef831b7331e7a | Python | wanghan79/2020_Python | /郭美缊2018012960/zuoye1.py | UTF-8 | 401 | 3.109375 | 3 | [] | no_license | import random
import string
import types
def zuoye1():
print(random.uniform(10,20))#浮点型
print(random.random())
number=[]#列表收集随机数
newlist=[]
for i in range(0,100):#生成100个数以供筛选
num = random.randint(0,500)#整型
number.append(num)
print(number)
#筛选大于200的数
positive_list = [n for n in number if n > 200]... | true |
7e50ac9ea511ade2b1ad771cb2c135c4b5247018 | Python | samparsons213/nn-fv | /lstm_entropy_optimisation.py | UTF-8 | 17,358 | 2.921875 | 3 | [] | no_license | import datetime
import os
import numpy as np
from scipy.optimize import minimize
from scipy.stats import multivariate_normal
import matplotlib.pyplot as plt
import csv
import tensorflow as tf
from pathlib2 import Path
from timeit import default_timer as timer
from DataClass import Data
from LSTMModel import LSTM
def g... | true |
b8b26d804c0eab3a99c3c15cf2cd2b940607e98b | Python | kuan1/test-python | /100days/04-公约数.py | UTF-8 | 387 | 4.3125 | 4 | [] | no_license | '''
输入两个正整数计算最大公约数和最小工倍数
'''
x = int(input('请输入整数:'))
y = int(input('请输入整数:'))
if x > y:
(x, y) = (y, x)
for factor in range(x, 0, -1):
if x % factor == 0 and y % factor == 0:
print(f'{x}和{y}的最大公约数:{factor}')
print(f'{x}和{y}的最小公倍数:{x * y // factor}')
break
| true |
02af8b71787a5f3d0edc1d02d6a737b5a8420c2e | Python | clairellesage/speech-tagger | /app.py | UTF-8 | 2,067 | 2.59375 | 3 | [] | no_license | import sys
import os
from audioSegmentation import speakerDiarization as sD
import psycopg2
import numpy
from io import StringIO
filename = sys.argv[1]
def runSD(splitFile):
speakerDiarization = sD(filename, 0, mtSize=2.0, mtStep=0.1, stWin=0.05, LDAdim=35, PLOT=False)
insertIntoDB(filename, speakerDiarization[0]... | true |
18f285f98e075704e2b0f394e3503fa60104cdce | Python | venki19/pythontoto | /PycharmProjects/Myfirstproject/object_inheretence.py | UTF-8 | 1,182 | 3.703125 | 4 | [] | no_license | class Computer:
def __init__(self, ram, memory, processor):
self.ram = ram
self.memory = memory
self.processor = processor
def getspecs(self):
print('Please enter details')
self.ram = input("Enter ram size")
self.memory = input("Enter memory")
self.proce... | true |
66aeb171f5b66349c2ea63e69b4cca21bd8461e1 | Python | wilsonvodka01/primer_app_flask | /herencia_templates.py | UTF-8 | 512 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route('/user/')
@app.route('/user/<name>')
def user(name='alexander'):
age = 19
my_list = [1,2,3,4]
return render_template('index.html', nombre=name, age = age, list = my_list)
@app.... | true |
6ca236eabd3d6d24c9973bcd080ec51c5fddd3d6 | Python | rtanubra/interesting_algos | /Permutation/print_permute.py | UTF-8 | 2,631 | 3.921875 | 4 | [] | no_license | """
inputs:
1. start: current index
2. characters: array of choices - as a string for now.
3. number_perm: specific selection number to permutate to
outputs:
1. a list of possible permutations
Pseudocode - main:
implement nCr possibilities
feed each nCr possibilities and 'permutate_string in... | true |
003ff7f652220e30c608d9e4b77180818f1ea92d | Python | sanskrit-lexicon/PWK | /pwkissues/issue91/test3.py | UTF-8 | 2,731 | 3.640625 | 4 | [] | no_license | # coding=utf-8
"""test3.py see readme.txt for usage
"""
from __future__ import print_function
import sys,re,codecs
# def f(x,y,z): that's the way Python function definitions start
def read_lines(filein):
# Notice the indentation
# there's a lot packed into the next line.
# We could say:
# open file named fi... | true |
80ad4b660c5965034aa48c7d814fe5c02a6cf838 | Python | masoodfaisal/python-for-beginners | /string_functions.py | UTF-8 | 2,003 | 4.5 | 4 | [] | no_license | # This program will showcase some of the string functions
favourite_music = "KPop Rocks"
print(f"The original string is: {favourite_music}")
favourite_music_upper = favourite_music.upper()
print(f"The upper case versions is: {favourite_music_upper}")
favourite_music_lower = favourite_music.lower()
print(f"The lower ... | true |
21c400649ac9a31cba3234221a8080d1cdcfde2a | Python | tongbc/algorithm | /src/justForReal/Restore IP Addresses.py | UTF-8 | 985 | 3.203125 | 3 | [] | no_license | class Solution(object):
def nextPermutation(self, nums):
"""
:type nums: List[int]
:rtype: None Do not return anything, modify nums in-place instead.
"""
l = len(nums)
for i in range(l - 2, -1, -1):
if nums[i] >= nums[i + 1]:
continue
... | true |
06508f302da9ac62cf1ce9afb54a34a87e8b7940 | Python | kobe24shou/python | /基础/day10/oopext1.py | UTF-8 | 919 | 3 | 3 | [] | no_license | #!/usr/bin/env python
# -*-coding:utf-8-*-
class BaseReuqest:
def __init__(self):
print('BaseReuqest.init')
class RequestHandler(BaseReuqest):
def __init__(self):
print('RequestHandler.init') # RequestHandler.init obj = Son() 就会执行到这个
BaseReuqest.__init__(self) # BaseReuqest.init 调... | true |
bdc3fe5a119e75e2d9730e7586fa71c39e58bd5a | Python | limdblur/auto-laod-hosts | /get_hosts_urls.py | UTF-8 | 898 | 3 | 3 | [] | no_license | #!/usr/bin/python
#encoding:utf-8
'''
读取hosts_urls.txt来获得url地址
'''
CONFIG_FILE='hosts_urls_date.txt'
def get_hosts_urls():
try:
file_hosts_urls = open(CONFIG_FILE,'rU')
address = file_hosts_urls.readline()
if address==None or address==[]:
print '读取hosts_urls.txt结果为空'
... | true |
d25c7dd88b01136ce6cef8447675d01617e3a670 | Python | ThomsonRen/mathmodels | /monte-carlo/_build/jupyter_execute/docs/monte-carlo.py | UTF-8 | 17,687 | 3.8125 | 4 | [] | no_license | # 蒙特卡洛模拟
## 蒙特卡洛模拟简介
**蒙特卡罗(Monte Carlo)模拟**其实是对**一种思想的泛指**,只要在解决问题时,利用大量随机样本,然后对这些样本进行概率分析,从而来预测结果的方法,都可以称为蒙特卡洛方法。
```{figure} ../_static/lecture_specific/monte-carlo-demo.jpg
---
height: 300px
name: monte-carlo-1
---
```
蒙特卡罗模拟因摩纳哥著名的赌场而得名。它能够帮助人们从数学上表述物理、化学、工程、经济学以及环境动力学中一些非常复杂的相互作用。
***
```{admonition} ... | true |
3cf2f25e8d6e272ad2404d5b784b7d0418aea3e1 | Python | amelia678/python-105 | /long_vowels.py | UTF-8 | 522 | 3.921875 | 4 | [] | no_license | #given a word, print result of exteninding any long vowels to length of 5
word = input('Enter a word')
word_list = list(word)
long_vowels= ['aa', 'ee', 'ii', 'oo', 'uu'] #what i'm looking for in word
long_vowels2 = ['aaa', 'eee', 'iii', 'ooo', 'uuu']
# word_list = list(word) #break down word into indiviual letters
# pr... | true |
941380ad326523db2d5fc57631a4e528699b944d | Python | adafruit/Adafruit_Learning_System_Guides | /Sound_Reactive_NeoPixel_Peace_Pendant/code.py | UTF-8 | 3,495 | 3.171875 | 3 | [
"MIT"
] | permissive | # SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import array
from rainbowio import colorwheel
import board
import neopixel
from analogio import AnalogIn
led_pin = board.D0 # NeoPixel LED strand is connected to GPIO #0 / D0
n_pixels = 12 # Number of pixels you are ... | true |
7d176b4e4436fd0caf9a3063e3e970553fea0818 | Python | tmaples/radiation | /Python/processUsMovementData.py | UTF-8 | 1,123 | 2.984375 | 3 | [] | no_license | import globals
movementData = []
path = globals.projectDirectory + 'usData/'
movementDataFileName = path + 'usMovementData.txt'
outputFileName = path + 'usMovementDataProcessed.csv'
def loadMovementData():
global movementData
movementFile = open(movementDataFileName, 'r')
for line in movementFile:
processLine(l... | true |
531b08b8b1d3f53cadb4ce76f013836f1edcda14 | Python | Flaac/krypto16 | /krypto16/crt.py | UTF-8 | 853 | 3.3125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
# Extended Euclidean Algorithm
def extEuc(a, b):
s1 = 1
s2 = 0
t1 = 0
t2 = 1
r = 0
while(r != 1):
q = a/b
r = a%b
st = s1 - q * s2
s1 = s2
s2 = st
tt = t1 - q * t2... | true |
b9cbd1e67696c84b279c18f1c7b40c92ba0aab95 | Python | Aasthaengg/IBMdataset | /Python_codes/p02767/s091323658.py | UTF-8 | 154 | 2.734375 | 3 | [] | no_license | n=int(input())
x=list(map(int,input().split()))
m=10**15
for i in range(101):
t=x[:]
s=sum(list(map(lambda x:(x-i)**2,t)))
m=min(m,s)
print(m) | true |
ee8523cfbd5fc562b7113d0fde050b0cff66b9d1 | Python | AcubeK/LeDoMaiHanh-Fundamental-C4E23 | /Season 3/homework_03/gateway1.py | UTF-8 | 330 | 3.015625 | 3 | [] | no_license | # implement superuser login
print("This is a superuser gateway.")
usrnm = input("Please enter username: ")
if usrnm != "c4e" :
print("You're not a superuser.")
else:
pwd = input("Please enter your password: ")
if pwd != "codethechange":
print("Incorrect password.")
else:
print("Welcome... | true |
2a5ebae5a9ef0155bb2e69508900df6ac872f656 | Python | hashnet/PythonProjects | /LearningPython/MatPlot Tests/ScatterLoop.py | UTF-8 | 657 | 2.765625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import matplotlib.animation as animation
def update_plot(i, data, scat):
scat = plt.scatter(x[i], y[i], c=c[i], s=10)
return scat
numframes = 1000
numpoints = 1
x = np.random.random((numframes, numpoints))
y = np.random.random((numframes, numpoints))
c = np.... | true |
18df103345255ab83d5123dadd144f07578a0995 | Python | Sairamvinay/Code-Generation-Classification-QA | /code/preprocessing_scripts/CodeSearchNet/scraper.py | UTF-8 | 2,082 | 2.90625 | 3 | [] | no_license | import bs4 as bs
import urllib.request
import string
import json
import time
def main():
start = time.time()
urlist=[]
finalDict={}
urlist=parse()
for urlVar in range (len(urlist)):
finalDict=scraperUrl(urlist[urlVar],finalDict)
for key, value in dict(finalDict).items():
if value is None or key is None:... | true |
d5c70c2695843fda797000ca364d77e2a70514cc | Python | gniliac1/COSIMA-Laserstar | /Software/Code_testing/gettingStartedWithJupyter.py | UTF-8 | 638 | 2.546875 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
import tensorflow as tf
# In[2]:
from tensorflow import keras
# In[3]:
import numpy as np
# In[4]:
import matplotlib.pyplot as plt
# In[5]:
fashion_mnist = keras.datasets.fashion_mnist
# In[6]:
(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load... | true |
4dafd92f39f2c4b30080b03932b630d62d253a14 | Python | HectorIGH/Competitive-Programming | /Misc/B/3_Square.py | UTF-8 | 715 | 3.125 | 3 | [] | no_license | from sys import stdin, stdout
def main():
t = int(stdin.readline())
ans = []
for j in range(t):
x1, y1 = sorted(map(int, stdin.readline().rstrip().split(' ')))
x2, y2 = sorted(map(int, stdin.readline().rstrip().split(' ')))
if y1 + y2 == x1 and x1 == x2:
ans.append('Y... | true |
77f300cc7da565843540be98ce1615ed3b16ee20 | Python | jiajiafish/louplus | /shiyanlou_flask06/app.py | UTF-8 | 788 | 2.515625 | 3 | [] | no_license | # from flask import
from flask import Flask,render_template,abort
import os
import json
app = Flask(__name__)
files_folder = os.path.join(os.path.dirname(__file__),'files')
@app.route('/')
def index():
files = os.listdir(files_folder)
files = [x.split(".")[0] for x in files]
return render_template("index... | true |
e38339dfa0e1f1919ae3fb506fb9301e17234949 | Python | nikdoof/pytikitag | /pytikitag/nfc/ndef.py | UTF-8 | 2,107 | 2.53125 | 3 | [] | no_license | from smartcard.util import toASCIIString
class NDEFReader():
_uri_lookup = { 0x00: "", 0x01: "http://www.", 0x02: "https://www.",
0x03: "http://", 0x04: "https://", 0x05: "tel:",
0x06: "mailto:", 0x07: "ftp://anonymous:anonymous@",
0x08: "ftp://ftp.", 0x... | true |
b719ec66261df21e60441536f4a6818f4912d566 | Python | cantaloupeJinJin/NLPlearning | /project1/starter_code.py | UTF-8 | 6,534 | 3.515625 | 4 | [] | no_license | # encoding: utf-8
'''
@author: jinjin
@contact: cantaloupejinjin@gmail.com
@file: starter_code.py
@time: 2019/10/25 14:23
'''
import xlrd
from math import log
workbook = xlrd.open_workbook("data/综合类中文词库.xlsx")
dic_words = []
booksheet = workbook.sheet_by_index(0)
rows = booksheet.get_rows()
for row in rows:
dic_... | true |
09a2e179e605f2201ecf3d7ff3e2add88265755b | Python | Devanshu-singh-VR/Bleu_scoreeee | /nltk_for_check.py | UTF-8 | 271 | 2.890625 | 3 | [
"MIT"
] | permissive | import nltk
t = 'hello how are you i am good here'
m = 'hello baby are you i am fine here'
hypothesis = m.split()
reference = t.split()
#there may be several references
BLEUscore = nltk.translate.bleu_score.sentence_bleu([reference], hypothesis)
print(BLEUscore) | true |
d87b2ef40b2afa82b4ee049057f731008c0f71d4 | Python | boert/KC85__M037_segmented_ROM | /ROMSTART/helpers/create_ROM-Image.py | UTF-8 | 10,818 | 2.75 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python3
"""
Ziel: ein ROM-Image anzulegen mit einem
Verzeichnis der Programme
und den entsprechenden Programmen
Aufbau:
Verzeichniss
Porgramm1
Programm2
Programm3
alle Programme sind in 128 Byte Blöcke aufgeteilt
bei 2 Byte für die Blocknummer lassen sich bis zu 8 MByte adressieren (theoretisch)
... | true |
77a554fc067506c69a3ce20465d1bdfbf2174895 | Python | Aasthaengg/IBMdataset | /Python_codes/p03827/s801369389.py | UTF-8 | 184 | 3.140625 | 3 | [] | no_license | n = int(input())
s = input()
num_list = [0]
sum = 0
for w in s:
if w == 'I':
sum += 1
else:
sum -= 1
num_list.append(sum)
num_list.sort()
ans = num_list[-1]
print(ans) | true |
b74ca7b7495e0c81944960e557d5e3f7ab64a78f | Python | haroonrashid235/facad_attr | /utils.py | UTF-8 | 12,814 | 2.5625 | 3 | [] | no_license | import os
import numpy as np
import pickle
import matplotlib.pyplot as plt
from scipy import spatial
from sklearn.metrics import pairwise_distances
import tqdm
import random
import shutil
import itertools
import textwrap
import torch
import torchvision
import torch.nn.functional as F
import cv2
def imshow(img,text=No... | true |
e1ef2c6caf7f6d98df3974c58f0e1ecb487e11f8 | Python | orichardson/mcm2016 | /rnn/mcm.py | UTF-8 | 1,700 | 2.515625 | 3 | [] | no_license | import sys
sys.path.insert(0, 'modules')
from sklearn.preprocessing import Imputer, StandardScaler
from sklearn.feature_selection import VarianceThreshold
from sklearn.pipeline import Pipeline
import preprocess
import numpy as np
import pandas as pd
class rnn_mcm_baker:
def __init__(self):
print('Reading data.... | true |
1f74ebc19f29620c3fa621bdc7f4aba3b1b7893e | Python | AndrosGreen/sigess | /backend/Modelos/Usuario.py | UTF-8 | 1,041 | 2.96875 | 3 | [] | no_license | from flask_login import UserMixin
# El usuario es una abstracción de un alumno o admin
# para reconocer de manera rápida en operaciones que requieran discernir
# Hereda de UserMixin para poder usarse en login y logout
class Usuario(UserMixin):
def __init__(self, usuario, clave, nivelDePermisos):
self.usua... | true |
54cd4ce8c45063c022b29355e38ccc605e3708d8 | Python | jason11489/UROP | /PHA.py | UTF-8 | 1,230 | 2.796875 | 3 | [] | no_license | import Lib
import PPO
import PHA_Parameter
def PHA(n,g,h,M):
list_M = []
list_A = []
num_n = 1
for i in n:
num_n = num_n * (Lib.mns_n(i[0],i[1]))
for i in range(len(n)):
sub_order = Lib.mns_n(n[i][0],n[i][1])
power_g_i = sub_order
power_g_i = int(num_n... | true |
d776429893a9e6a82f803c5cfff4d680ceb40878 | Python | Ranjana151/python_programming_projects | /snake_water_gun_game.py | UTF-8 | 4,919 | 4.09375 | 4 | [] | no_license | # fun Game
import random
Number_Of_chances=10
No_of_points_gamer=0
No_of_points_computer=0
while (Number_Of_chances>0):
print("Total no. of chances is 10")
print("Enter 1 to choose snake")
print("Enter 2 to choose water")
print("Enter 3 to choose gun")
n=int(input())
list=['snake','... | true |
989b0213ccc7eb7275ed01c6ac9cf277f8e87d8b | Python | prkpro/Notes_Transpose | /main.py | UTF-8 | 1,763 | 3.84375 | 4 | [
"Apache-2.0"
] | permissive | class Node:
def __init__(self,Note):
self.Note = Note;
self.next = None;
class NoteList:
#Declaring head and tail pointer as null.
def __init__(self):
self.head = Node(None);
self.tail = Node(None);
self.head.next = self.tail;
self.tail.next = self.hea... | true |
94d470f924919913f9fa093a0fec7ed00e2cbb40 | Python | Coderode/Python | /turtle/a3.py | UTF-8 | 221 | 3.5625 | 4 | [] | no_license | import turtle
c=turtle.Turtle()
c.speed(0)
c.color("red","yellow")
c.begin_fill()
c.setposition(-150,0)
for i in range(200):
c.forward(400)
c.left(168.5)
c.end_fill()
c.hideturtle()
turtle.done() #to stop turtle window | true |
4ca7d336d369275f76d56b01c1a9dfc3e0f816f8 | Python | davidrenderos/travel-tracker | /main.py | UTF-8 | 4,899 | 3.109375 | 3 | [] | no_license | """
Name: David Renderos
Date: 26/10/2020
Brief Project Description: This project highlights the use of inheritance and the use of classes.
GitHub URL: https://github.com/cp1404-students/travel-tracker-assignment-2-davidrenderos
"""
from kivy.app import App
from placecollection import PlaceCollection
from kivy.lang im... | true |
ad42ccc8c0286f67073e31a9fb22e2e2f199cd50 | Python | gyunamister/AOPM | /src/org/processmining/AOPM/experiment/preprocess.py | UTF-8 | 1,429 | 2.875 | 3 | [] | no_license | import pandas as pd;
def splitLog(interval):
"""
Split the log into sublogs
Each sublog contains the events from ongoing instances
"""
eventlog = pd.read_csv("../w-eventlog.csv",index_col=None,names=["event-identifier", "activity", "resource", "startTimestamp", "completeTimestamp", "Order", "Item", "Package", "Ro... | true |
2d197180ca74dec78536c2d2226d51b2f3c7f25e | Python | tigervanilla/Guvi | /k_rotate.py | UTF-8 | 106 | 3.34375 | 3 | [] | no_license | word,k=input().split()
wordlen=len(word)
k=int(k)%wordlen
print(word[wordlen-k:],word[:wordlen-k],sep='')
| true |
8e1befc6668fd913e09c45e7af9614547dea4b59 | Python | moazzam3890/100DaysOfCode-Python | /100DaysOfCoding/turtle-crossing-start/player.py | UTF-8 | 510 | 3.109375 | 3 | [] | no_license | from turtle import Turtle
STARTING_POSITION = (0, -280)
MOVE_DISTANCE = 10
FINISH_LINE_Y = 280
PLAYERS = []
class Player(Turtle):
def __init__(self, position):
super().__init__()
self.players = []
self.init_turtle(position)
def init_turtle(self, position):
# new_player = Turtl... | true |
ae9c4b43de3a35114b2212e91cf49f298686bbdb | Python | catalinc/programmingpraxis-solutions | /python/src/matrix.py | UTF-8 | 4,944 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python
import unittest
import numbers
class Matrix(object):
def __init__(self, rows, cols, init=0):
if rows < 0 or cols < 0:
raise ValueError("invalid dimensions: rows: %d, cols %d" % (rows, cols))
self.matrix = [[init for _ in range(0, cols)] for _ in range(0, rows... | true |
00ecd28564fe1006655515d6caa9762e289e1055 | Python | 1954491/pyval_pro | /pyval_pro.py | UTF-8 | 2,478 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Programme pour évaluer une expression python
(version sécuritaire, avec durée limitée, et professionnelle)
2020, Xavier Gagnon
"""
from timeit import default_timer as timer
import argparse
from typing import NoReturn
from m_timeout_eval import timeout_eval as eval # noqa
import sys
import ... | true |
1672e1a6a99c204de3f8ff45dafadb5ce195fed7 | Python | milenovaldo/MrJudesExercise | /Book/author.py | UTF-8 | 359 | 3.609375 | 4 | [] | no_license | class Author:
__name = ''
__email = ''
__gender = ''
def __init__(self, name, email, gender):
self.__name = name
self.__email = email
self.__gender = gender
def getName(self):
return self.__name
def getEmail(self):
return self.__email
def getGen... | true |
1a535842f607d54d66ecda56c970fe45d76281b6 | Python | Satan012/Algorithms | /leetcode/44-通配符匹配/alg.py | UTF-8 | 746 | 3.1875 | 3 | [] | no_license | class Solution:
def isMatch(self, s, p):
length_s = len(s)
length_p = len(p)
dp = [[False] * (length_p + 1) for _ in range(length_s + 1)]
dp[-1][-1] = True
for i in range(length_s, -1, -1):
for j in range(length_p - 1, -1, -1):
firstMatch = i < ... | true |
1889263d0e09c81935dd9ec933383914630c2150 | Python | ujjwalgulecha/AdventOfCode | /2018/Day_01/Part_1A.py | UTF-8 | 201 | 3.15625 | 3 | [
"MIT"
] | permissive | with open("input1.txt") as f:
data = f.readlines()
count = 0
for val in data:
num = int(val[1:])
if val[0] == '-':
num = num * -1
count+=num
print count
| true |
b7d131c2ecefa14e5d149c9d918a1d586052f1ce | Python | hurricaney/PythonStart | /PythonApplication1/Data/TryCatch.py | UTF-8 | 578 | 3.5 | 4 | [] | no_license | def TestError(d):
try:
print('正常结果:',8/d)
except:
print('这是异常!!!')
else:
print('其他异常!')
finally:
print('这是finally')
i=4
while(i>=0):
TestError(i)
i-=2
while True:
s=input('请输入一个整数:')
try:
i=int(s)
i=8/i
except ValueError:
pr... | true |
4327707f21ac0b1c6934be96375e8e0df8711543 | Python | kiran-kotresh/Python-code | /count_sheep.py | UTF-8 | 148 | 3.734375 | 4 | [] | no_license | def count_sheep(n):
murmur = ''
for i in range(1, n + 1):
murmur += str(i) + ' sheep...'
return(murmur)
print(count_sheep(3))
| true |
8e786a88b4ceee6400307d78d3b8ede7a3fa6613 | Python | jackedison/Card_Counting | /parse_cmd.py | UTF-8 | 9,416 | 2.9375 | 3 | [] | no_license | import argparse
import textwrap
from lib.blackjack import Blackjack # pylint: disable=import-error
def parse(simulation=False):
# Parse in any command line arguments for the game
parser = argparse.ArgumentParser()
parser.add_argument("-p", "--players", default=3, type=int,
help=... | true |
888491d1c2bc93c40cb6e93832f66e41a1a28199 | Python | Elfolgui/Ejercicio_Practica | /Clases/Clase_Base.py | UTF-8 | 125 | 2.578125 | 3 | [] | no_license |
class Clase_Base(object):
def __init__(self, nombre, codigo):
self.Nombre = nombre
self.Codigo = codigo | true |
2215f02e45d8d9c5e8e649afca39aba4f4b16115 | Python | PaulienTensen/RailNL | /RailNL/Code/functies/start.py | UTF-8 | 3,021 | 3.484375 | 3 | [] | no_license | # Vak: Heuristieken
# Namen: Thomas Van Doren, Mattia Caso, Paulien Tensen.
# Case: Rail NL
#
# In dit bestand wordt de start bepaald per traject.
#
from random import randint
def kies_start(sporen, verbindingen, uithoeken, trajecten_algemeen, stations):
"""
Deze functie bepaalt de start van elk traject.
... | true |
8b6dfc181ab77f73459fdb1dab565f8b765bfc2e | Python | EfratGranit/dna-analayzer-by-command-line | /commands_classes/batch/batch_db.py | UTF-8 | 492 | 2.90625 | 3 | [] | no_license | class BatchDB(object):
__instance = None
def __new__(cls, *args, **kwargs):
if not BatchDB.__instance:
BatchDB.__instance = object.__new__(cls)
self = BatchDB.__instance
self.__batches = {}
return BatchDB.__instance
def add_new_batch(self, name, value):
... | true |
49b2798a4db629d315236b149abe52221af38922 | Python | mail-in-a-box/mailinabox | /tools/parse-nginx-log-bootstrap-accesses.py | UTF-8 | 2,041 | 2.6875 | 3 | [
"CC0-1.0"
] | permissive | #!/usr/bin/python3
#
# This is a tool Josh uses on his box serving mailinabox.email to parse the nginx
# access log to see how many people are installing Mail-in-a-Box each day, by
# looking at accesses to the bootstrap.sh script (which is currently at the URL
# .../setup.sh).
import re, glob, gzip, os.path, json
impo... | true |
dade5a22164a5f4b667708a2a6a27891f1fb16e1 | Python | WarrenWeckesser/ufunclab | /ufunclab/tests/test_gendot.py | UTF-8 | 2,991 | 2.703125 | 3 | [
"MIT"
] | permissive |
import pytest
import numpy as np
from numpy.testing import assert_equal
from ufunclab import gendot, gmean
def test_minmaxdot_1d():
minmaxdot = gendot(np.minimum, np.maximum)
a = np.array([1, 3, 1, 9, 1, 2])
b = np.array([2, 0, 5, 1, 3, 2])
c = minmaxdot(a, b)
assert c == np.maximum.reduce(np.min... | true |
5ba2359579eab2152d434db7ca4604837512ff62 | Python | ajmalkurnia/deeplearning-text-playground | /common/utils.py | UTF-8 | 1,962 | 3.1875 | 3 | [
"MIT"
] | permissive | import string
# import re
from nltk.corpus import stopwords
from sklearn.model_selection import train_test_split
def remove_characters(text, charset=string.punctuation):
"""
Remove a set of character from text
:param text: string, text input
:param charset: string, sequence of characters that will be ... | true |
6a42ef01ec112451093511ec994d6a7c0dfcb988 | Python | superf2t/TIL | /PYTHON/BASIC_PYTHON/수업내용/05/05-011.py | UTF-8 | 1,240 | 4.1875 | 4 | [] | no_license | #05-011.py
class Horse:
__horseCnt = 0
def __init__(self, father, mother, name):
self.__father = father
self.__mother = mother
self.name = name
Horse.__horseCnt += 1
def printInformation(self):
print('Horse cnt : ', Horse.__horseCnt)
prin... | true |
c394964fdb62246320aba61638e35f11bf06f441 | Python | Muyiyunzi/ML-pyCV-Notes | /W8/6.1.1-scipyclustering.py | UTF-8 | 547 | 2.71875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from scipy.cluster.vq import *
from PIL import Image
from numpy import *
from pylab import *
class1 = 1.5 * randn(100, 2)
class2 = randn(100, 2) + array([5, 5])
features = vstack((class1, class2))
centroids, variance = kmeans(features, 2)
code, distance = vq(features, centroids)
f... | true |
d5c96103583d0b7386fa6916f1dfc3a65136ec99 | Python | seyoung5744/Basic-Python-in-playdata | /python2/day01/chat_one_to_one_server.py | UTF-8 | 1,586 | 3.09375 | 3 | [] | no_license | #server
import threading, socket
class UniServer:
#class 변수 / static 변수
ip='localhost' #or 본인 ip or 127.0.0.1
port = 5555
def __init__(self):
self.server_soc = None #서버 소켓(대문)
self.client_soc = None #클라이언트와 1:1 통신 소켓
def open(self):
self.server_soc = socket.soc... | true |
dfb3b69b0106672b0fe06a3c7df79980b1114898 | Python | memyarn/OldPythonWork | /1.Intro to Python/INSECUREworldwideBank.py | UTF-8 | 2,825 | 2.78125 | 3 | [] | no_license | from security import protect
from exchangeRateExtractor import extract
import urllib
import datetime
transac=open('transac.txt', 'r+')
lastrem=open('lastconvrates.txt', 'r+')
cdnrate = extract('https://ca.finance.yahoo.com/q?s=CADUSD=X', "<span id=\"yfs_t10_cadusd=x\">", 1796, 1802)
usdrate = extract('https://ca.finan... | true |
48b44a6a5c46ede707a4ae754d226f7d79d04698 | Python | rpt5366/Challenge100_Code_Test_Study | /Codesik/ETC/PGS_83201.py | UTF-8 | 1,279 | 3.34375 | 3 | [] | no_license | # 8 50 23분
import sys
from collections import *
def solution(scores):
score_list = defaultdict(list)
result = []
for i in range(len(scores)):
for score in scores:
score_list[i].append(score[i])
for student, score in score_list.items():
my_score = score[student]
ma... | true |
269ea0db72cceac0d6e36185c3d797dd9475c6f4 | Python | teddy-boy/python_crash_course_exercises | /basics/ch03-list/ex_3_5.py | UTF-8 | 399 | 3.234375 | 3 | [] | no_license | guest_list = ['Lan', 'Chuc', 'Minh']
print('Hi ' + guest_list[0] + ', please come to have dinner with me')
print('Hi ' + guest_list[1] + ', please come to have dinner with me')
print('Hi ' + guest_list[2] + ', please come to have dinner with me')
print('Oop! ' + guest_list[2] + ' can\'t make it today.')
guest_list[2]... | true |
21d95ce3439631413bfc44ff3450b680cb989e8f | Python | shirogin/Multimedia | /Huffman/Huffman.py | UTF-8 | 1,628 | 3.8125 | 4 | [
"MIT"
] | permissive | class Node:
def __init__(self, car, number, left=None, right=None):
self.car = car
self.num = number
self.left = left
self.right = right
self.code = ''
def Right(self, right=None):
if(right is not None):
self.right = right
return self.right
... | true |
23da882b23f23535f33143bfa8144394dedef48e | Python | yyamada12/nlp100 | /6/55.py | UTF-8 | 582 | 2.734375 | 3 | [] | no_license | import joblib
import pandas as pd
from sklearn.metrics import confusion_matrix
train_X = pd.read_table('train.feature.txt')
train_y = pd.read_table('train.label.txt')
valid_X = pd.read_table('valid.feature.txt')
valid_y = pd.read_table('valid.label.txt')
lr = joblib.load('52.Joblib')
predicts_train = lr.predict(trai... | true |
5636e3e3025af5ddf8adf0546e5e5c1b11810660 | Python | danalenvargas/project-euler-solutions | /005.py | UTF-8 | 185 | 3.34375 | 3 | [] | no_license | def compute(n1, n2):
num = n2
while(True):
for i in range(n1, n2+1):
if(num%i != 0):
break
else:
break
num += n2
return num
print(compute(1,20)) | true |
96bb7644c2efed7821060670d7b115b4517dd6e3 | Python | ahmadalvin92/Chapter-05 | /Latihan 1 P1.py | UTF-8 | 363 | 3.453125 | 3 | [] | no_license | #1
ind = int(input('Nilai Bahasa Indonesia :'))
if(ind
>= 0 and ind <= 100):
mtk = int(input('Nilai Matematika :'))
if(mtk >= 0 and mtk <= 100):
ipa = int(input('Nilai IPA:'))
if(ipa >= 0 and ipa <= 100):
print('==========================')
if(ind>60 and ipa>60 and mtk>70):
print ('... | true |
84cd95a05ef1c575ab099b6ca7241c9f7285efef | Python | guruscott/yhat-client | /yhat/api.py | UTF-8 | 8,526 | 2.875 | 3 | [] | no_license | import document
import sys
import requests
import base64
import json
import pickle
import inspect
import urllib2, urllib
import types
import re
BASE_URI = "http://api.yhathq.com/"
class API(object):
def __init__(self, base_uri):
self.base_uri = base_uri
self.headers = {'Content-Type': 'applicatio... | true |