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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
581717301e0e48d3259f6b908b8701320f69505d | Python | vakhnenko2/Math-Modeling_10_class | /Лаба 13 Задача 1.py | UTF-8 | 3,661 | 2.9375 | 3 | [] | no_license | import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
from matplotlib.animation import ArtistAnimation
second_in_year = 365 * 24 * 60 * 60
second_in_day = 24 * 60 * 60
years = 4
t = np.arange(0, years*second_in_year, second_in_day)
def move_func(s, t):
(x1, v_x1, y1, v... | true |
75c7f38d704b4d3eac344880bac09ff83ab89525 | Python | kaiduohong/imageProcessing | /DIP/homeWorks/hw2.py | UTF-8 | 4,991 | 2.59375 | 3 | [] | no_license | #-*-coding:utf8-*-
import numpy as np
from scipy.misc import imread, imsave
import numpy as np
import matplotlib as mpl
from matplotlib import pyplot as plt
import os
import skimage
from skimage import io
import sys
def getNewHistogram(histogram,map):
level = 256
newHist = np.zeros(level)
for i in range(l... | true |
e6b6150c9369067c32c85ca10145a48084279481 | Python | derekderie/challenges | /codechef/JUNE20/GUESSG/run_local.py | UTF-8 | 3,152 | 3.40625 | 3 | [] | no_license | from codechef.JUNE20.GUESSG.solution import search, SearchSpace
def truthful_answer(val, ans):
if ans == val:
return 'E'
elif ans < val:
return 'L'
else:
return 'G'
def lie_answer(val, ans):
if ans == val:
return 'E'
elif ans < val:
return 'G'
else:
... | true |
d6cc380caf8eb14f3867152ada677d905bd43ad4 | Python | Hubert51/leetcode | /Citadel-OA1-matrix-summation.py | UTF-8 | 523 | 3.125 | 3 | [] | no_license |
def solution(after_matrix):
before_mat = []
for i in range(len(after_matrix)):
vector = []
sum = 0
for j in range(len(after_matrix[i])):
val = after_matrix[i][j] - sum
for k in range(i):
val -= after_matrix[k][j]
sum += v... | true |
e21a28d0a40517b8fa4297c921b3e51f20302ad8 | Python | Schnei1811/DotA2OptimizationStrategies | /WinnerPrediction.py | UTF-8 | 4,040 | 2.6875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import pickle
def datacreation(input_data):
input_data[radhero1-1] = 1
input_data[radhero2-1] = 1
input_data[radhero3-1] = 1
input_data[radhero4-1] = 1
input_data[radhero5-1] = 1
input_data[direhero1+112] = 1
input_data[direhero2+112] = 1
input_data[direhero3+112] = 1
in... | true |
e19d5b94b6c15f921e829d22d97c3456f95e56b2 | Python | SuzanaBhandari/Python_learning | /Strings/stringformatiing.py | UTF-8 | 602 | 3.953125 | 4 | [] | no_license | #string concatenation
a = "sujana"
b = "bhandari"
c = a + b
print(c)
age = 23
name = "sujana"
print("My age is " + str(age))
#manually insert
print("My age is " + str(age) +" " + "years")
#format(), dynamic procedure
print("My age is {0} years".format(age))
print ("My name is %s and My age is %d" % (name,age... | true |
61974b1f6a11e8aed0eb49da548761368fdb3ff4 | Python | William-Mou/-py-1 | /Py大作業2 (1).py | UTF-8 | 1,757 | 2.953125 | 3 | [] | no_license |
# coding: utf-8
# In[ ]:
from PIL import Image
import random
K = 5 # number of colors
W = 800 # width of output image
H = 600 # height of output image
MAX_ITER = 3
def find_nearest(pixels, centroids):
re = []
for pixcel in range(len(pixels)):
a = [0,0,0,0,0]
for cen in range(K):
... | true |
0a67dc283e490b12e1539208bdc214e3579a86a8 | Python | songzhipengn/store | /京东登录.py | UTF-8 | 1,124 | 2.71875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains #事件链对象
#当前浏览器
driver = webdriver.Chrome()
#打开
driver.get("http://www.jd.com")
#窗口最大化
driver.maximize_window()
#定位
#点击请登录
driver.find_element_by_xpath('//*[@id="ttbar-login"]/a[1]').click()
#点击账户登录
driver.find_e... | true |
237b0af5d942c50bef24540ff0817a7017161d66 | Python | DavidRocha12/Tabela-de-calculos | /tabelasalarial.py | UTF-8 | 2,154 | 3.484375 | 3 | [] | no_license | #Meu primeiro projeto, estou aprendendo e procuro melhorar este programa e finalizar para
# adiquirir esperiência.
#e aprendendo com os erros.
#Projeto para fazer calculo trabalhista que vai servir para usuário empregador ou funcionário.
print('Calculo Salárial')
print('')
escolha = str(input('O calculo é para a empres... | true |
9a303cd5f01bb57c072a2702fc539a9d117a823a | Python | sai-karthikeya-vemuri/PPP | /optimizers_comparision.py | UTF-8 | 5,132 | 3.671875 | 4 | [] | no_license | """
This is a comparision between the optimizers based on loss vs iterations
A simple loss function is defined commonly for all the optimizers .
The same Neural Network is instantiated individually for every optimizer and training is done for 1000 iterations.
Each optimizer object is created and loss is minimized... | true |
4436561ac0937d9fc29f97832c59f9746b73ae69 | Python | shaffi3000/MarsRoverAttempt | /Rovers_List.py | UTF-8 | 1,343 | 3.578125 | 4 | [] | no_license | '''The RoverList class allows storage of all rovers run, and to provide the scope to have unlimited rovers. '''
class RoversList():
def __init__(self):
self.roverList = []
self.minSize = 0
self.maxSize = 0
self.currentRover = 0
self.roverRemaining = self.maxSize - se... | true |
f8b18d2c7c29476e7869ec13e28e83418de5e089 | Python | Kilmani/CryptoPrim | /ciphers/rol.py | UTF-8 | 1,821 | 2.8125 | 3 | [] | no_license | import saveKey, random, Double, grouper, math
lengthBlock = 8
def encodeRol(text, iter, round):
# Генерация ключа и запись в файл
key = 1
saveKey.saveKey(key, "ROL", round, iter)
# Переводим в ASCII
asciiText = [ord(c) for c in text]
binaryText = []
for i in range(len(asciiText)):
... | true |
c814a2ef7be117843940220028cbbccf6613c1a2 | Python | Albinutte/football-prediction | /Extraction/season_2013_2014/form_extraction.py | UTF-8 | 1,895 | 3.078125 | 3 | [] | no_license | # Форма рассчитывается по формуле
# sum / 10, где
# sum - сумма очков за матч:
# 2 за победу
# 1 за ничью
# 0 за поражение
import useful_functions as uf
import re
def get_form(url):
"""Gets teams and their forms from url"""
soup = uf.get_soup(url)
res = []
#: adding names
res += uf.get... | true |
ebdd04edd742b8d03fe3dc74c2eb854a8563ba8e | Python | gorilla-Kim/algorithm | /Basic/p1204.py | UTF-8 | 211 | 3.328125 | 3 | [] | no_license | strlist = {1:"st", 2:"nd", 3:"rd", 4:"th"}
num = input()
if((int(num)//10)==1 ):
print(num+strlist[4])
else:
print("{0}{1}".format(num, strlist[int(num)%10 if int(num)%10<4 and int(num)%10!=0 else 4]))
| true |
c278ae9a2d89629fd38907f2ac626723c6781c00 | Python | wenwei-dev/motor-calibration | /evaluate.py | UTF-8 | 1,045 | 2.6875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import os
import yaml
def evaluate(shapekey_values, x):
param_num = shapekey_values.shape[1]
sum = x[:param_num]*shapekey_values + x[-1]
values = sum.sum(axis=1)
return values
def run(motor_config_file, pau_data_file, model_file):
params_df = pd.read_csv(mode... | true |
f30d87cf055551e6e288f2530d75735d51fcb81e | Python | wanleung/linne-analyzer | /src/linne/analyzer/sound/sound.py | UTF-8 | 539 | 2.609375 | 3 | [] | no_license | # Sound Data Type
class Sound:
def __init__(self):
self.phonetic = None
self.ipa = None
self.filter = None
self.threshold = None
self.remarks = None
def passThreshold(self,frame):
ret = False
if self.filter == "RMS":
ret = frame["RMS"] > sel... | true |
cbae0736507d53f8e77f6e803b2402283fa61b3b | Python | lemduc/CSCI622-Advanced-NLP | /HW2/1.Create_bigram.py | UTF-8 | 2,218 | 2.703125 | 3 | [] | no_license | import collections
start_state = final_state = 0
lastest_state = 1
mapping_state = dict()
mapping_next = dict()
mapping_next['.'] = 0
mapping_next[','] = 0
total_per_state = dict()
with open('train-data') as f:
content = f.readlines()
count = 0
current_state = 0
next_state = 0
for line in con... | true |
8eb0c9edc5a3b67ac03a09b276a661e73d9006c3 | Python | sapurvaa/HackerRank-Problems | /find_the_runner_up_score.py | UTF-8 | 343 | 2.84375 | 3 | [] | no_license | if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().split()))
largest = max(arr)
x = []
for i in arr:
if (largest-i) != 0:
x.append(largest-i)
if len(x) != 0:
smallest_diff = min(x)
print(largest-smallest_diff)
else:
print("no r... | true |
742cd7a98d2afdf1d8899fa6f21356597451950a | Python | linter0663/EPS-Jetson-Nano | /visualize.py | UTF-8 | 5,702 | 2.609375 | 3 | [] | no_license | from keras.models import load_model
import numpy as np, pandas as pd, matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler
from sklearn.linear_model import LinearRegression
from keras.models import Sequential
from keras.layers import LSTM, Dense, TimeDistributed, Bidirectional
from sklearn.metrics im... | true |
b4e4d5cec45b0417b02c2c653fc0b011bb91204f | Python | YuiTH/ML-lec4 | /ML_Lec4/plot.py | UTF-8 | 2,582 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 4 10:32:09 2019
@author: Lenovo
"""
from readFile import get3ClassData
import numpy as np
import matplotlib.pyplot as plt
from bi_logistic_reg_sgd import logistic_reg_predict
from preprocess import preprocess
# x, y = get3ClassData()
# x0, y0 = x[0:50], y[0:50]
# x1, ... | true |
68c16c6568ac9f5b465147483359d62419a6332b | Python | raniels/01a-Exercises-Arithmatic | /exercises.py | UTF-8 | 4,785 | 4.84375 | 5 | [
"MIT"
] | permissive | '''
01a Exercises
These exercises should help you get the flavor of how to perform arithmetic and string operations in Python.
You will also get to play with (pseudo-)random generators and the range operator.
These skills will all be used in assignment 2.
To answer these exercises, open the IDLE program that came wi... | true |
790da40149f7eaa72911c8403eec1007e39b8e6a | Python | gitdog01/AlgoPratice | /study/pratice/d.py | UTF-8 | 975 | 3.046875 | 3 | [] | no_license | def solve(snapshots, transactions):
my_snap = {}
my_tran = [False for _ in range(len(transactions))]
for snap in snapshots:
my_snap[snap[0]] = int(snap[1])
for tran in transactions:
if my_tran[int(tran[0])]:
continue
else:
my_tran[int(tran[0])] = True
... | true |
9d08696a8a6eb2770aa2b4777a07db3f25ab3e90 | Python | p4telj/subnet-calculators | /networking/IPRange.py | UTF-8 | 3,539 | 3.375 | 3 | [] | no_license | """
IPRange.py
Contains class definition.
"""
import copy
from networking import IP
class IPRange:
"""Represents a range of IPv4 addresses."""
def __init__(self, *, first_ip=None, second_ip=None, cidr=None):
"""
Constructor.
(1) Create an IP range given 2 IPs.
or
... | true |
cea5245ccd42d107c9087c7b6865d8d597005ce5 | Python | yeomye/pyworks | /day25/customer_manage/main2.py | UTF-8 | 852 | 3.8125 | 4 | [] | no_license | # 객체(인스턴스)를 리스트로 관리
from customer_class import Customer, GoldCustomer, VIPCustomer
# 객체 생성
c1 = Customer(101, '흥부')
c2 = Customer(102, '놀부')
gold1 = GoldCustomer(201,'콩쥐')
gold2 = GoldCustomer(202,'팥쥐')
vip = VIPCustomer(301, '심청', 777)
# 리스트로 관리
customer = [] #빈리스트 생성
customer.append((c1))
customer.append((c2))
cu... | true |
5140d3852d28d72ec25295d7d963b8dc2297f4f5 | Python | mauricesandoval/Tech-Academy-Course-Work | /Python/Tkinter/Organizational_Widgets/01_frameOutput.py | UTF-8 | 525 | 2.640625 | 3 | [] | no_license | Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> from tkinter import *
>>> from tkinter import ttk
>>> root = Tk()
>>>
>>> frame = ttk.Frame(root)
>>> frame.pack()
>>> frame.config(height = 100, width = 2... | true |
245deccba1032522c7e3d478e74164f4064e9da7 | Python | pierreCarvalho/Topicos_Avancados_em_Informatica | /CuboMagico/cubomagico.py | UTF-8 | 2,146 | 3.890625 | 4 | [] | no_license | #regra para a inserção dos numeros
# Defina a casa 1 como sendo a do meio da linha superior
# Você deve sempre preencher o número em sequência (1, 2, 3, 4 etc.),
# um para cima e um para direita
#condições:
# - Se a sequência terminar uma "casa" acima da fileira superior do quadrado mágico,
# continue nessa fil... | true |
3fb5bd074b2d82f52fe077c7c18e739b64ec9b99 | Python | ddiazsouto/Sentencer | /Service1/test_ser1.py | UTF-8 | 2,271 | 2.71875 | 3 | [
"MIT"
] | permissive |
from unittest.mock import patch
from flask import url_for
from flask_testing import TestCase
from things import DanSQL, callme
from app import app
# pytest
# pytest --cov=app
# pytest --cov-config=.coveragec --cov=.
# pytest --cov=app --cov-report=term-missing
# pytest --cov . --cov-report html
class TestBase(T... | true |
ad59813badacd0a7e9ca83866baf51bfd7a8fdde | Python | lab11/time_series_project | /plaid_data/plaid_analysis.py | UTF-8 | 4,601 | 2.640625 | 3 | [] | no_license | #! /usr/bin/env python3
import os
import sys
import json
# check if plaid dataset exists
if not (os.path.exists("PLAID/") and os.path.isdir("PLAID/")):
print("PLAID not downloaded yet. Run `plaid_serializer.py`")
sys.exit()
metadata_filenames = ["PLAID/meta1.json",
#"PLAID/meta2.json",
... | true |
0f9241739c5c73227df5e65afc6b6c7e28e39697 | Python | DaiHanpeng/CentralDB | /DBInterface/ResultFlagInterface.py | UTF-8 | 2,055 | 2.828125 | 3 | [] | no_license | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from Tables import BaseModel,ResultFlagTable
class ResultFlagInterface():
"""
db interface for result flag table.
"""
def __init__(self):
DB_CONNECT_STRING = 'mysql+mysqldb://root:root@localhost/sys_info'
sel... | true |
188cccf5a6890d99180d835c419079eccbcf19e6 | Python | guille3218/HLC_2122 | /Introduccion/00b_formateo.py | UTF-8 | 216 | 3.484375 | 3 | [] | no_license | print("Hola")
print("Adios")
print("Sevilla", end="")
print("Cádiz", end="")
print("Huelva", end=" ")
print("Granada", end=" ")
print("")
print("Córdoba", end=" ")
print("a")
i=3
print(f"valor de la variable {i}") | true |
40028d37afe5038adcc66e1b7438efa832f1139b | Python | alexssandroos/learn_formacaods_udmy | /scripts/testes_normal.py | UTF-8 | 252 | 2.546875 | 3 | [
"MIT"
] | permissive | ourfrom scipy import stats
from scipy.stats import norm
import matplotlib.pyplot as plt
dados = norm.rvs(size = 100)
stats.probplot(dados, plot = plt)
stats.shapiro(dados)
import pandas as pd
import numpy as np
a = pd.DataFrame(np.arange(10)*10)
a
| true |
76b6c6d6c5a8221f67ead6154a3a67233ce259a5 | Python | Jonasori/Outdated-Disk-Modeling | /baseline_cutoff.py | UTF-8 | 4,126 | 2.984375 | 3 | [] | no_license | """Run the ICR process while cutting off baselines below b_max.
Testing a change.
"""
import numpy as np
import pandas as pd
import argparse as ap
import subprocess as sp
import matplotlib.pyplot as plt
from tools import icr, imstat, already_exists, remove
from constants import today
# baselines = np.arange(0, 130,... | true |
1834be7502a81538313ab138a52acb954c70cf90 | Python | nastevens/sandbox | /python/flushbot/oldcode/createlookup.py | UTF-8 | 1,666 | 2.875 | 3 | [] | no_license | import hands, stacks, sys, pickle
from card import card
def createdata(dataset):
depth = 53
dataset["all"] = set([])
for i in range(1,depth):
dataset[i] = set([])
for i in range(1,depth):
sys.stdout.writelines(["\n",str(i)])
for j in range(i+1,depth):
sys.stdout.writ... | true |
d0f98f2ca82274b5db273d6810c239e72e2ddeba | Python | BrianHicks/perch | /perch/utils.py | UTF-8 | 414 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from py.path import local
import os
class ClassRegistry(dict):
"hold and register classes by nickname, to select later"
def register(self, name):
def inner(cls):
self[name] = cls
return cls
return inner
def files_in_dir(tar... | true |
0193fe59189d18af00503738ee4a6664e784d1e8 | Python | tangingw/python_pymetheus | /monitor/monitor_net.py | UTF-8 | 2,716 | 2.5625 | 3 | [] | no_license | import os
import psutil
import platform
from datetime import datetime
from socket import AF_INET, AF_INET6, SOCK_DGRAM, SOCK_STREAM
class MonitorNetwork:
def __init__(self):
self.net_connections = psutil.net_connections()
self.network_interface_info = psutil.net_if_addrs()
def get_network_i... | true |
35ad3205182795026dc04666aae8d0c14c174731 | Python | marquesarthur/w2v-rest-api | /fasttext/write_so_corpus.py | UTF-8 | 2,601 | 2.5625 | 3 | [] | no_license | # https://radimrehurek.com/gensim/models/fasttext.html
# https://stackoverflow.com/questions/58876630/how-to-export-a-fasttext-model-created-by-gensim-to-a-binary-file
# from gensim.models.fasttext import FastText
# from gensim.test.utils import datapath
# from gensim.utils import tokenize
# from gensim import utils
#... | true |
a128fde5365dc3ea3c4c3dd788c8522858158fcc | Python | biggydbs/Sudoku-Solver | /sudoku.py | UTF-8 | 1,707 | 3.34375 | 3 | [] | no_license | import time
n = 9
m = int(n**0.5)
def findNextCellToFill(grid, i, j):
for x in range(i,n):
for y in range(j,n):
if grid[x][y] == 0:
return x,y
for x in range(0,n):
for y in range(0,n):
if grid[x][y] == 0:
return x,y
return -1,-1
def ... | true |
fe57418dea247bd936572bb4f58354a770618c70 | Python | JeanPaiva42/recommendaJogos | /recommendaJogos/RecomendacaoJogos.py | UTF-8 | 7,651 | 2.96875 | 3 | [] | no_license | from numpy import *
import numpy as np
import Usuario
import Jogos
from Jogos import Jogos
from Usuario import Usuario
a = list()
j = 0
jogosLista = list()
with open("Jogos.txt", 'r+') as txtJogos:
for line in txtJogos:
if j < 5:
line = line.strip('\n')
a.append(line)
... | true |
511d754f0a7520542df46aab91417faa9d61afc5 | Python | swakkhar/RNA-Editing | /source_code/gen 0/parser.py | UTF-8 | 870 | 2.765625 | 3 | [
"CC0-1.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 25 10:54:28 2018
@author: HiddenDimension
"""
import re
def createData(algo):
with open(algo+'.txt') as f:
lines = f.readlines()
p= re.compile("\d+")
a = p.findall(lines[-2])
b = p.findall(lines[-1])
... | true |
8fde556b30dead2bd9aac95dfb9f1391fb058857 | Python | WalidAshraf/ConvNet-Architectures | /VGG/data_utils.py | UTF-8 | 1,754 | 2.671875 | 3 | [] | no_license | import numpy as np
import matplotlib as plt
from scipy import misc
import os
def getNumImages(path):
cs = os.listdir(path)
num = 0
for c in cs:
num += len(os.listdir(path + '/' + c))
return num
def resizeImage(img, H, W):
return misc.imresize(img, (H, W), interp='cubic')
def loadDataSet... | true |
36a9f746d195641165f9e6fa0097e332a5d8ed28 | Python | sandeep-skb/Algorithms | /Dynamic Programming/findLongestPath.py | UTF-8 | 1,440 | 3.8125 | 4 | [] | no_license | # LINK: https://www.geeksforgeeks.org/find-the-longest-path-in-a-matrix-with-given-constraints/
# Given a n*n matrix where all numbers are distinct, find the maximum length path (starting from any cell) such that
# all cells along the path are in increasing order with a difference of 1. We can move in 4 directions fro... | true |
98745ebff3411749cefb7b10b6a0fac1a46a614f | Python | ccc96360/Algorithm | /BOJ/Gold IV/BOJ1744.py | UTF-8 | 661 | 3.296875 | 3 | [] | no_license | #BOJ1744 수 묶기 20210515
import sys
input = sys.stdin.readline
def calc(li):
ret = 0
while li and li[-1] == 1:
ret += li.pop()
tmp, cnt = 1,0
for v in li:
tmp *= v
cnt += 1
if cnt == 2:
cnt = 0
ret += tmp
tmp = 1
if len(li) % 2 == 1:... | true |
2ae129fce2f96db2ea73304b9cb6cfdce85aa2b9 | Python | CannonLock/PhotoDescrambler | /Timer.py | UTF-8 | 323 | 3.421875 | 3 | [] | no_license | import time
class Timer:
def __init__(self):
self.s = 0
def start(self):
self.s = time.time()
def step(self, string = ''):
print(string, time.time() - self.s)
self.s = time.time()
def end(self, string = ''):
print(string, time.time() - self.s)
self.s ... | true |
4ddfbd22a58bed496bcaa2f92d7df63e0bfcc761 | Python | seungjulee/brush-up-algo-ds | /hackerrank/test/strings/bubblesort.py | UTF-8 | 175 | 2.9375 | 3 | [] | no_license | A=[1,5,4,3,5,3,4,3]
# bubble sort A
def bubbleSort(A):
for v, i in enumerate(A):
for vv, ii in enumerate(v):
if v > vv:
s
bubbleSort(A) | true |
e16c6ca84e39c5c9bd6b6407acc6c0b7212cee41 | Python | gokulvasan/CapacityShifting | /list.py | UTF-8 | 1,871 | 3.421875 | 3 | [] | no_license |
class list_node:
def __init__(self, data, nxt, prev):
self.data = data
self.nxt = nxt
self.prev = prev
def get_nxt(self):
return self.nxt
def get_prev(self):
return self.prev
def get_data(self):
return self.data
def set_prev(self, prev):
self.prev = prev
def set_nxt(self, nxt):
self.nxt = nxt
d... | true |
fc14938e2858909835d2e5b81f4b0c7d40afb79c | Python | yifanx0/project_euler_solutions | /0001-0100/euler_0019.py | UTF-8 | 1,583 | 4.1875 | 4 | [] | no_license | # date: 08/01/2018
# problem: how many Sundays fell on the first of the month during
# the 20th century (01/01/1901-12/31/2000)
century = {19000101 : "Monday"}
# define a function create_key that adds a date to the dictionary
def create_key(year, month, day) :
date = year * 10000 + month * 100 + day
century[date] ... | true |
7c695073dc2b770c4d857ecd46b385de7a9baefe | Python | wesleychristelis/python-basic-blockchain-poc | /blockchain.py | UTF-8 | 12,719 | 2.546875 | 3 | [] | no_license | import json
import pickle
import requests
# Own lib
from utility.verification import Verification
from utility.hash_util import hash_block
from utility.global_constants import MINING_REWARD
from utility.helpers import sum_reducer
from wallet import Wallet
from block import Block
from transaction import Transaction
p... | true |
359d20871003863c4d0998b3d2aa20140093b80a | Python | McNoah/Educational-Data-Mining | /IP2IDMapper.py | UTF-8 | 795 | 2.640625 | 3 | [] | no_license | import csv
# from collections import defaultdict
# reader1 = csv.reader(open('/Users/MCNOAH/Desktop/AccessLog_Tool-develop/MappedIP.csv', 'r'))
mylist = []
myset = set()
result = open('test.txt', 'w')
with open('IP.csv', 'r') as IPFile, open('Mapping2.csv', 'r') as IPMappedFile:
IPs = IPFile.read().splitlines()
IPIDs... | true |
4fe2fc234c0138063917b1bf72e4e0fa78f2f070 | Python | IsseBisse/adventcode20 | /10/AdapterArray.py | UTF-8 | 1,895 | 3.515625 | 4 | [] | no_license | def get_data(path):
with open(path) as file:
data = file.read().split("\n")
for i, entry in enumerate(data):
data[i] = int(entry)
data.append(0)
data.append(max(data) + 3)
return data
def part_one():
data = get_data("input.txt")
print(data)
data.sort()
print(data)
jolt_differences = [0, 0]
for i, j... | true |
74b023c3e38c7ce2d3661aa2aa3b4c5a292fe11e | Python | ericgiunta/nebp | /unfolding_tool/origami.py | UTF-8 | 3,619 | 3.1875 | 3 | [
"MIT"
] | permissive | import numpy as np
from numpy.linalg import norm
from scipy.optimize import basinhopping
def preprocess(N, sigma2, R, f_def, params):
"""Apply any preprocessing steps to the data."""
#
if 'scale' in params:
if params['scale']:
#
N0 = np.sum(R * f_def, axis=1)
... | true |
af5621eb9aaf33aaa690ead83a17208eac331fcb | Python | dangkim/FBScanTool | /Code/utils.py | UTF-8 | 2,352 | 2.578125 | 3 | [
"MIT"
] | permissive | import os
# Create Original URL to crawl Data
def create_original_link(url):
if url.find(".php") != -1:
original_link = "https://en-gb.facebook.com/profile.php?id=" + ((url.split("="))[1])
else:
original_link = url
return original_link
# Get Section Route
def get_friend_section_route(url... | true |
52829fca46bf28cb98a08a32b5e8aec6a6cb0630 | Python | mbr4477/frontpage | /frontpage/__main__.py | UTF-8 | 2,055 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import argparse
import json
from subprocess import run
import os
import glob
import dropbox
import datetime
import random
def print_file(filename, printer_name):
# print this file
run(['mutool', 'poster', '-y', '2', filename, 'out.pdf'])
run(['cpdf', 'out.pdf', '-draft', '-boxes', '-o', 'out.pdf'])
run... | true |
53130b6184eef2761adc99b71d5d2ccd9e60d9ad | Python | MYlindaxia/Python | /HomeWorkSystem/main.py | UTF-8 | 461 | 2.515625 | 3 | [] | no_license | import easygui as gui
import CheckDemo
t = gui.buttonbox(msg="已经有:"+str(CheckDemo.Sum)+"交了作业\n还有:"+str(CheckDemo.Total)+"名同学没有交",title="MADE IN MYlindaxia",choices=('打印未交作业的同学','打印交了作业的同学'))
if(t=='打印未交作业的同学'):
print("good")
gui.msgbox(str(CheckDemo.Fall),title='作业管理系统')
else:
print("bad")
gui.msgbox(st... | true |
6c2879e1d76dc6ac73af2255d25b79116a7d6cf0 | Python | zm-reborn/zmr-vpk-tools | /material_textures.py | UTF-8 | 4,076 | 2.96875 | 3 | [] | no_license | """Prints model's /possible/ materials to a file."""
import argparse
import os
import re
import sys
import vpk_generator
def get_mat_paths(mats, lowercase=False):
ret = []
for p in mats['paths']:
for tex in mats['textures']:
s = os.path.join(
'materials',
... | true |
66e1e86bd4ff53df9e3ac46892d9473e84ad159a | Python | kin5/react-flask-trivia | /db.py | UTF-8 | 668 | 2.78125 | 3 | [] | no_license | import sqlite3
class DB:
def query(query, data=None):
conn = sqlite3.connect("trivia-game.db")
cur = conn.cursor()
cur.execute("""
CREATE TABLE IF NOT EXISTS trivia_games (
token PRIMARY KEY,
correct_answer,
lives,
... | true |
d46a62f7c26c61598d3aa81a49fa7d90ac9b1684 | Python | krittinunt/RaspberryPi | /LED_Runing_I.py | UTF-8 | 393 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python3
# by krittinunt@gmail.com
from time import sleep
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
LED = [26, 19, 13, 6, 5, 21, 20, 16]
for i in range(8):
GPIO.setup(LED[i], GPIO.OUT)
GPIO.setwarnings(False)
try:
while True:
for i in range(8):
GPIO.output(LED[i], True)
sleep(0.5)
for i... | true |
787c4d52befdd17e5e743326dd3e6c60f3822b39 | Python | jyu001/New-Leetcode-Solution | /solved/457_circular_array_loop.py | UTF-8 | 1,581 | 3.734375 | 4 | [] | no_license | '''
457. Circular Array Loop
DescriptionHintsSubmissionsDiscussSolution
You are given an array of positive and negative integers. If a number n at an index is positive, then move forward n steps. Conversely, if it's negative (-n), move backward n steps. Assume the first element of the array is forward next to the last ... | true |
e8a3f8037a93463008ff26ba000b2a0cc14871b9 | Python | Verlanti2002/TepsitProject | /database.py | UTF-8 | 4,710 | 2.71875 | 3 | [] | no_license | import mariadb
import threading
class Database: # Classe Database
# Costruttore
def __init__(self, user, password, host, database, port=3306):
# Connessione al database
self.conn = mariadb.connect(
user=user,
password=password,
host=host,
port... | true |
51707f30eddc400adc71e5e63ad8a7b1759ea434 | Python | narutoben10af/cis | /PycharmProjects/Scraping/BeautifulSoup.py | UTF-8 | 3,013 | 3.15625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
htmlFile = open("home.html")
htmlData = htmlFile.read()
htmlFile.close()
soup = BeautifulSoup(htmlData, "html.parser")
print(soup)
# prettify output
print(soup.prettify())
#Get the title tag
title = soup.title
print(title)
#Get the title text
titleText = soup.title.te... | true |
5162d5898bb20667a79b3309d3e6b3b8581614b3 | Python | LaryLopes/Exercicios-Python | /média.py | UTF-8 | 185 | 3.625 | 4 | [] | no_license | n1 = float(input("nota 1: "))
n2 = float(input("nota 2: "))
n3 = float(input("nota 3: "))
n4 = float(input("nota 4: "))
m =(n1+n2+n3+n4)/4
print ("média: ", m)
| true |
8f7726a441367c5bff74c4c60daff68fe2b205cc | Python | AmauryVanEspen/craiglist_scraper | /spiders/jobs-titles.py | UTF-8 | 3,006 | 3.4375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
class JobsSpider(scrapy.Spider):
# name of the spider.
name = 'jobs-titles'
# allowed_domains contains the list of the domains that the spider is allowed scrape.
allowed_domains = ['newyork.craigslist.org/search/egr']
# start_urls contains the list of one or ... | true |
1b41ab7d9675398b68758b2a510ed899ac28cadd | Python | gusye1234/PRank | /prank/object.py | UTF-8 | 8,135 | 2.53125 | 3 | [] | no_license | import spacy
from spacy.tokens.doc import Doc
from .world import *
from tqdm import tqdm
import numpy as np
import pickle
from .utils import pattern_match_backward, pattern_match_forward
from .utils import isLine, span2low, span2pos, span2tag, generate_wildcard, str2span, low2str
class Docs:
"""
:class A wrapp... | true |
62a081d5dbe9e45841e0c122fa4122a431b4bc9a | Python | jim-schwoebel/voicebook | /chapter_5_generation/make_chatbot.py | UTF-8 | 3,783 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | '''
================================================
## VOICEBOOK REPOSITORY ##
================================================
repository name: voicebook
repository version: 1.0
repository link: https://github.com/jim-schwoebel/voicebook
author: Jim Schwoebel
author contact: js@neur... | true |
3ba7860335a0fa3dad1acb36c4b3e745a08b17fa | Python | raphaelbomeisel/VamoRachar2 | /Cardapio.py | UTF-8 | 1,033 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 27 15:18:05 2015
@author: Raphael
"""
class cardapio():
def __init__(self):
self.bebidas = dict()
self.pratos = dict()
self.sobremesas = dict()
def AdicionaBebida(self,bebida,preco):
self.bebidas[bebida] = preco
... | true |
8ba934f4acf4b4c7b3f1ee321d41ae4a4a93ed57 | Python | Instagram/LibCST | /native/libcst/tests/fixtures/malicious_match.py | UTF-8 | 896 | 2.9375 | 3 | [
"Python-2.0",
"MIT",
"Apache-2.0"
] | permissive |
# foo
match ( foo ) : #comment
# more comments
case False : # comment
...
case ( True ) : ...
case _ : ...
case ( _ ) : ... # foo
# bar
match x:
case "StringMatchValue" : pass
case [1, 2] : pass
case [ 1 , * foo , * _ , ]: pass
case [ [ _, ] , *_ ... | true |
09d2f138a7dbad38ea5e32d554ee45a3cb552857 | Python | behrouzmadahian/python | /Tesnorflow2_05-12-20/10_Images/03_transfer_learning_tfHuB.py | UTF-8 | 7,456 | 3.140625 | 3 | [] | no_license | """
TensorFlow Hub is a way to share pre-trained model components.
See the TensorFlow Module Hub for a searchable listing of pre-trained models.
This tutorial demonstrates:
- How to use TensorFlow Hub with tf.keras.
- How to do image classification using TensorFlow Hub.
- How to do simple transfer learning.
"""
from _... | true |
df5931bd615b72bf63e045a6e6a497a6d40d81d1 | Python | Its-a-me-Ashwin/DBaaS | /Dbaas/dbass.py | UTF-8 | 3,822 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 29 16:07:42 2020
@author: 91948
"""
# import libraries
from flask import Flask,jsonify,request
import pymongo
import json
# set up the DB
# runs on port 27017
myclient = pymongo.MongoClient("mongodb://localhost:27017/")
mydb = myclient["mydatabase"]
... | true |
73ab31094f3dcb85549fd28c3815a8b032a4c171 | Python | ADQF/tutorial | /L40爬虫入门/4urllib代理.py | UTF-8 | 826 | 2.71875 | 3 | [] | no_license | # urllib代理示例
#为了防止同一个ip频繁访问服务器被封锁,需要不断变化ip通过别人的电脑代理访问服务器。
"""
从哪里找代理?
1. ip代理平台 http:/www.xicidaili.com/nn/
免费的不太稳定,有些不可用,付费的稳定。
2. 网友搜索爬取的ip代理池。
"""
import urllib.request
# import random
#
# proxies = [
# {},
# {},
# {},
# ]
# proxy = random.choice(proxies)
proxy = urllib.request.ProxyHandler({'http': '... | true |
f1b8984ddf78ac929ca1519f98bf687a169c3a54 | Python | joshyfrott/exercises | /integer2words.pyw | UTF-8 | 6,177 | 3.59375 | 4 | [] | no_license | from tkinter import *
import tkinter.messagebox
def affix(string_aff, digit_aff):
#function for appending a postfix
#string_aff is the whole original input in string format
#digit_aff is the current digit checked
post_fix = "" #variable for the postfix
lower = True #variable for checking the lower digit
... | true |
795928164d88439cb9dc5e072b5b84f2337c8424 | Python | leonardocroda/tcc | /transformacoes/pre_processamento.py | UTF-8 | 2,860 | 2.96875 | 3 | [] | no_license | import nltk
from nltk import tokenize
from string import punctuation
import unidecode
import pandas as pd
import re
def execute(dataframe, coluna_texto):
def remove_links(dataframe,coluna_texto):
frase_processada = list()
for tweet in dataframe[coluna_texto]:
tweet_processado= re.sub(r"http\S+", "", tw... | true |
d704ea44b2a51e8910c6f988cd6b7d8b4e3fc0f1 | Python | abhijeetjoshi0594/courseradatascience | /firstpython.py | UTF-8 | 235 | 3.234375 | 3 | [] | no_license | #python code to check duplicate in a string
check_string = "Abhijeemmt"
count = {}
for s in check_string:
if s in count:
count[s] += 1
else:
count[s] = 1
for key in count:
if count[key] > 1:
print (key, count[key])
| true |
072295e73df9f5e4b210f75f124dceb447e24fde | Python | malcolmmcswain/141l-project | /assembler/assembler.py | UTF-8 | 1,691 | 2.703125 | 3 | [] | no_license | import sys
from isa_map import (
opcode_dict, # opcode dictionary
std_reg_dict, # standard register dictionary
ext_reg_dict # extended register dictionary
)
### Reads in a decimal integer n and returns 6-bit binary
### representation string within unsigned range
def toBinary(n):
if n >= 64 or n < 0:... | true |
e5476438749a1549c6362a39e1f600609e4aa0c1 | Python | gujie1216933842/codebase | /时间模块time和datetime/01_time.py | UTF-8 | 1,161 | 3.9375 | 4 | [] | no_license |
'''
time模块学习
time.time() 生成当前的时间戳,格式为10位整数的浮点数。
time.strftime()根据时间元组生成时间格式化字符串。
time.strptime()根据时间格式化字符串生成时间元组。time.strptime()与time.strftime()为互操作。
time.localtime()根据时间戳生成当前时区的时间元组。
time.mktime()根据时间元组生成时间戳。
区分 strftime()和strptime()的方法,方便记忆
strftime- str_format_time 格式化(format)
strptime- str_parse_time 解析... | true |
9ff4a0b00fc9ec725088fcaf93070966cf66dae1 | Python | hyunsang-ahn/algorithm | /문제풀이/홀수만 더하기/홀수만 더하기.py | UTF-8 | 267 | 2.890625 | 3 | [] | no_license | import sys
sys.stdin = open('input.txt', 'r')
T = int(input())
for tc in range(1, T+1):
arr = list(map(int, input().split()))
res = []
for i in range(10):
if arr[i] %2 != 0:
res.append(arr[i])
print("#{} {}".format(tc, sum(res))) | true |
c9b30321bde82b1a80ec64b3a7ce0e5b6465a50f | Python | gau-nernst/search-algos | /search.py | UTF-8 | 9,761 | 3.25 | 3 | [] | no_license | class Search():
valid_strat = {'bfs', 'dfs', 'ldfs', 'ids', 'ucs', 'greedy', 'a_star'}
def __init__(self, strategy):
assert strategy in self.valid_strat
self.strat = strategy
def __call__(self, start, end, adj_list, max_depth=3, heuristic=None):
print("Strategy:", self.... | true |
47e43b6f86717f39898879a45abd91eb5e0bd4b9 | Python | joshearl/ThreadedPackageLister | /threaded_package_lister.py | UTF-8 | 1,985 | 2.890625 | 3 | [] | no_license | import sublime
import sublime_plugin
import threading
import os
class ListPackagesCommand(sublime_plugin.WindowCommand):
def __init__(self, window):
self.view = window.active_view()
def run(self):
threaded_package_lister = ThreadedPackageLister()
print "Starting thread ..."
thr... | true |
db158f2a1b3e13cdaa33ede47e547e3de132d5f8 | Python | oyuchangit/Competitive_programming_exercises | /algorithm_practices/ABC/ABC_exercises/B074.py | UTF-8 | 258 | 2.890625 | 3 | [] | no_license | # https://atcoder.jp/contests/abc074/tasks/abc074_b
N = int(input())
K = int(input())
x_list = list(map(int, input().split()))
ans = 0
for x in x_list:
K_x = K - x
if K_x >= x:
ans += x*2
elif K_x < x:
ans += K_x*2
print(ans) | true |
1d4c807f7d3039c78729f513dba4fa2532d6a170 | Python | AAbhishekReddy/Portfolio-Optimisation | /script.py | UTF-8 | 772 | 2.65625 | 3 | [
"MIT"
] | permissive | import pandas as pd
from sklearn.preprocessing import StandardScaler
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
%matplotlib inline
plt.style.use("classic")
etf = pd.read_csv("/home/abhishek/Desktop/major/mutual/ETFs.csv")
mut = pd.read_csv("/home/abhishek/Desktop/major/mutual/Mutual Fun... | true |
acc43980e4c6095cf47409bd7673a4a0a5cb3bdb | Python | jasperchn/bootstrap | /testerEntry.py | UTF-8 | 574 | 3 | 3 | [] | no_license | from utils.FileWriter import FileWriter
if __name__ == "__main__":
path = "C:/temp"
filename = "tester.txt"
# 第一次新建文件并且写入
fileWriter = FileWriter(path=path, filename=filename)
fileWriter.writeLine("this a test file")
fileWriter.writeLine("first writing")
fileWriter.destory()
# 第二次找到已有... | true |
f957235214561e15888f568caa263155057c4783 | Python | Project-X9/Testing | /Web_Testing/Pages/PlaylistSongs.py | UTF-8 | 6,026 | 3.203125 | 3 | [] | no_license | import time
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from Web_Testing.Pages.WebPlayerMenu import WebPlayerMenu
class PlaylistSongs(WebPlayerMenu):
"""
A class representing the Web Player's playlist songs
...
Attributes
----------
... | true |
2ea1beaea82c3f05425610d36b4eb0a6a67c14bc | Python | j-tyler/learnProgramming | /TheCProgrammingLanguage/python-celsiustofahr-e1p4.py | UTF-8 | 178 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python
lower = -20
upper = 100
step = 5
celsius = lower
while celsius <= upper:
fahr = celsius * 9 / 5 + 32
print "%3d %6d" % (celsius, fahr)
celsius += step
| true |
ba673439e837ec4829dacdbb6cdb7f2c5b52d443 | Python | ashurzp/tradingpy | /candle_stick_plot.py | UTF-8 | 1,172 | 3.0625 | 3 | [] | no_license | import matplotlib
import matplotlib.pyplot as plt
import mpl_finance
import pandas
matplotlib.style.use('ggplot')
def stockPricePlot(ticker):
print('dsqdsq')
# Step 1. load data
history = pandas.read_csv(
'./Data/IntradayUS/' + ticker + '.csv', parse_dates=True, index_col=0)
# Step 2. Data ... | true |
9bbcb857bd64e6f58e3b01a910edb35b2b2254a4 | Python | Onodric/Bangazon-Orientation-Classes | /department.py | UTF-8 | 602 | 3.484375 | 3 | [] | no_license | class Department(object):
"""Parent class for all departments
Methods: __init__,meet , get_name, get_supervisor
"""
def __init__(self, name, supervisor, employee_count):
self.name = name
self.supervisor = supervisor
self.size = employee_count
def meet():
... | true |
323894b202ed7d68c1f3c4f522025f2416829aca | Python | J-Seo/sgg | /lib/get_union_boxes.py | UTF-8 | 4,020 | 2.578125 | 3 | [
"MIT"
] | permissive | import torch
from torch.nn import functional as F
from lib.pytorch_misc import enumerate_by_image
from torch.nn.modules.module import Module
from torch import nn
from config import BATCHNORM_MOMENTUM
class UnionBoxesAndFeats(Module):
def __init__(self, pooling_size=7, stride=16, dim=256, concat=False, use_feats=T... | true |
871495337c13d2ce57af92f766145f7022ab01ed | Python | LinXueyuanStdio/EchoEA | /toolbox/DatasetSchema.py | UTF-8 | 19,358 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | # 数据集路径,下载数据集
# outline
# 1. utils function
# - extract_tar(tar_path, extract_path='.')
# - extract_zip(zip_path, extract_path='.')
# 2. remote dataset
# - RemoteDataset
# - fetch_from_remote(name: str, url: str, root_path: Path)
# 3. RelationalTriplet class
# - RelationalTriplet
# - RelationalTriplet... | true |
916e980408ffc41420083910d154c22b032d4c61 | Python | BiancaChirica/Lego-Framework | /Page4.py | UTF-8 | 4,141 | 2.796875 | 3 | [] | no_license | import pickle
import random
import numpy as np
import Pieces
from Configuration import Configuration
from Page import Page
import tkinter as tk
from Render import Render
from tkinter import messagebox
class Page4(Page):
def __init__(self, mainPage, data):
Page.__init__(self, mainPage)
self.data = d... | true |
aa2d9d845c18716e0ca6b887d246f75f93f9f0d1 | Python | sashamerchuk/algo_lab_1 | /venv/training.py | UTF-8 | 4,831 | 3.46875 | 3 | [] | no_license | import random
a=[1,2,68,2,3,5]
b=[21,23,68,24,31,5]
c=[121,233,648,254,311,54]
q = [32,48,356,54,67,76]
z=[983,234,765,4321,342,23,12]
import time
def bubble_sort(arr):
swapped=True
while swapped:
swapped=False
for i in range(len(a)-1):
if arr[i]>arr[i+1]:
arr[i],arr[... | true |
2fc2e9f44ea9babbe8f7f0b90e2a3ba4309070e5 | Python | hlfshell/pyimagesearch | /animals/dataset.py | UTF-8 | 882 | 2.96875 | 3 | [] | no_license | from torch.utils.data.dataset import Dataset
import os
from PIL import Image
import torch
import numpy as np
class AnimalsDataset(Dataset):
def __init__(self, filepath, transforms=None):
self.filepath = filepath
self.transforms = transforms
def __getitem__(self, index):
#Get the item... | true |
c3438173f86322cf97e8d37208389b62933f79b6 | Python | Hwenhan/Physiological_signal_processing | /dataset_format/TxDatasetTable.py | UTF-8 | 964 | 2.71875 | 3 | [] | no_license | import numpy as np
import pandas as pd
from pandas import DataFrame
class TxDatasetTable:
def __init__(self,datasetid,path):
self.id=[];
self.datasetid=[];
self.data=DataFrame([]);
self.rowcount=[];
self.colcount=[];
self.__path=path+datasetid+'.csv';
def load(self):
if os.path.exists(self.__path):
... | true |
cb717044d964523f40f69230a99996b02350c976 | Python | nima14/Coursera_P4E_Specialization | /03. Using PythonTo Access Web Data/myurllib.py | UTF-8 | 220 | 2.578125 | 3 | [] | no_license | import urllib.request, urllib.parse, urllib.error
url = 'http://data.pr4e.org/romeo.txt'
fhand=urllib.request.urlopen(url)
print(urllib.request.urlopen(url).read())
for line in fhand:
print(line.decode().strip()) | true |
871771dbd4036f9542ee9ece3b16511942c328dc | Python | anaswara-97/python_project | /function/func_with_args.py | UTF-8 | 68 | 3.140625 | 3 | [] | no_license | def add(n1,n2):
print("result :",n1,"+",n2," = ",n1+n2)
add(3,5) | true |
639c186cdda26133a724fb94e9f969747486a42a | Python | pwdemars/projecteuler | /josh/Problems/69.py | UTF-8 | 451 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 14 02:14:22 2017
@author: joshuajacob
"""
import numpy
num =1000000
def primes_list(n):
x = numpy.ones(n, dtype = numpy.bool)
for i in range(2,int(n**0.5)+1):
if (i-1)%6 == 0 or (i+1)%6 == 0 or i == 2 or i == 3 and i<n+1:
... | true |
6d6bcf131ff76e11767ac1db028b3276c5c4c4b4 | Python | orriborri/AdventOfCode | /day10/main.py | UTF-8 | 699 | 3.09375 | 3 | [] | no_license |
from collections import defaultdict
def readfile():
with open("input.txt", "r") as f:
lines = list(map(lambda x: int(x), f.read().split('\n')))
return lines
arr = readfile()
arr.sort()
arr2 = arr.copy()
arr = [0] + arr + [arr[-1] + 3]
i = 0
one = 0
three = 0
while(i+1 < len(arr)):
diff = a... | true |
71293520f2ef67c14b0fa7a2ffa9390751b693b1 | Python | KellyDeveloped/git-issue | /Git-Issue/git_issue/comment/comment.py | UTF-8 | 1,122 | 2.875 | 3 | [] | no_license | from git_issue.gituser import GitUser
from git_issue.utils import date_utils
from git_issue.utils.json_utils import JsonConvert
import uuid as unique_identifier
@JsonConvert.register
class Comment(object):
""" Class represents what a comment is. The default date of a comment is the current datetime
in UTC ... | true |
dd28c5b9cb528c0607027dacb2d9cb0c7281f6a2 | Python | vietanh125/cds_scripts | /test_mpu.py | UTF-8 | 2,569 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from sensor_msgs.msg import Imu
from math import sin, asin,sqrt, atan2, pi
import time
gyro_x_cal = 0
gyro_y_cal = 0
gyro_z_cal = 0
angle_pitch = 0
angle_roll = 0
skip = 1001
angle_pitch_output = 0
angle_roll_output = 0
set_gyro_angles = False
max_value = -1000000
min_value = 1000000... | true |
1ff6166188ab309cfb293cdec847204aaa69647d | Python | reint-fischer/MAIOproject | /computedistance.py | UTF-8 | 2,861 | 2.78125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Chance pair distance timeseries
Created on Sat Oct 12 13:42:52 2019
@author: Gebruiker
"""
import numpy as np
import pandas as pd
def ComputeDistance(ID1,ID2,Data_Mediterrenean):
id1 = [] #select only the 1st ID from all Mediterrenean data
id2 = [] #select only the 2nd ID from all... | true |
a16c893cca35484d1adb7eb026ebf3e979c34abf | Python | itsmenick212/algorithm-in-leetcode | /lc_problems/137.SingleNumberII.py | UTF-8 | 1,568 | 3.734375 | 4 | [] | no_license | from typing import List
class Solution:
def singleNumber(self, nums: List[int]) -> int:
'''
states:
00 -> 01 -> 10 -> 00
our goal is to make state go back to zero using
bit manipulation when a bit appeared to be same
value for three times, when 0 ap... | true |
d6560b5440923692c2775cef4781d5dd42ed9791 | Python | ashleighyslop/CFG | /session_2/arrays.py | UTF-8 | 734 | 3.328125 | 3 | [] | no_license | my_list = ['pc', 'clothes', 'food']
#for items in my_list:
# message = 'hello '
# print message + items
#print 'done shopping'
#print 'xxxxxxx ' + message
#print my_list[2]
#for x in range (0,9):
# print x
available_money = 300
running_total = 0
items_bought = []
money_spent =0
for item in my_list:
if (... | true |
dbfeb95bec36e20049967d240db47a8df58c96f2 | Python | heihachi/Coding-Projects | /Python/upload.py | UTF-8 | 2,251 | 2.78125 | 3 | [] | no_license | import ClientForm
import urllib2
request = urllib2.Request(
"http://jamez.dyndns.org/?p=custom&sub=upload")
response = urllib2.urlopen(request)
forms = ClientForm.ParseResponse(response, backwards_compat=False)
response.close()
## f = open("example.html")
## forms = ClientForm.ParseFile(f, "http://example.com/examp... | true |
2255331631511c9878ed26be29f8a7d81c8a4d02 | Python | garydoranjr/mikernels | /src/convert_multiclass.py | UTF-8 | 2,033 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
import os
import numpy as np
import pylab as pl
from collections import defaultdict
DATA_DIR = 'data'
NAT = 'data/natural_scene.data'
NAT_NAMES = 'data/natural_scene.names'
CLASSES = [
'desert',
'mountains',
'sea',
'sunset',
'trees',
]
NAT_N = len(CLASSES)
def main():
with open(NAT, 'r') as ... | true |