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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
783334a6f8262c0b793ef327f922b6a3def21721 | Python | paulazg/senales_de_auscultacion | /rutina_total.py | UTF-8 | 4,316 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun May 31 19:09:49 2020
@author: ASUS
"""
import glob
import numpy as np
import pandas as pd
from pre_procesamiento import preprocesamiento_senal
from ciclos_respiratorios import ciclos_respiratorios_f
from operaciones_ciclos import indices
import matplotlib.pyplot as plt
impor... | true |
c6df8868a76b3307cbefc4327bc5234c711fced3 | Python | Esri/public-transit-tools | /deprecated-tools/edit-GTFS-stop-locations/scripts/WriteNewStopstxt.py | UTF-8 | 5,459 | 2.8125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ################################################################################
## Toolbox: Edit GTFS Stop Locations
## Tool name: 2) Write New stops.txt
## Created by: Melinda Morang, Esri, mmorang@esri.com
## Last updated: 26 June 2018
################################################################################
... | true |
d7b83b9df5c803179cab67748118d87c188ddc91 | Python | wangfuchaoooooo/tflearn | /use_hdf5.py | UTF-8 | 2,057 | 2.953125 | 3 | [] | no_license | """
Example on how to use HDF5 dataset with TFLearn. HDF5 is a data model,
library, and file format for storing and managing data. It can handle large
dataset that could not fit totally in ram memory. Note that this example
just give a quick compatibility demonstration. In practice, there is no so
real need to use... | true |
2856cf8e08d977cf1009c18128862a3b4c8d5d21 | Python | slivingston/SCA | /QF_Py/bin/csuite.py | UTF-8 | 14,319 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
#
# Copyright 2009, 2010 California Institute of Technology.
# ALL RIGHTS RESERVED. U.S. Government Sponsorship acknowledged.
#
'''
Created on Aug 07, 2011.
This module performs unittest of Autocoder results on the C suite of test XMLs,
using the pexpect module.
@author: Shang-Wen Cheng <Shang-W... | true |
53b20367f61d5c89ec6d3544d13f22c3a897b690 | Python | chenliang019/scraping | /test7.py | UTF-8 | 550 | 2.8125 | 3 | [] | no_license | #!/bin/usr/python3
import time
import requests
import _thread
def get_url(tN,delay):
try:
url = requests.get(tN,timeout=delay)
print (url.status_code,tN)
except Exception as e:
print ('Error: ',e)
with open(r'D:\CL\gittest\spider\alexa2.txt','r',newline="",encoding='utf-8') as file:
r = file.readlines()
l... | true |
796a666862617a4766344ec0b47a4dcbb1aee5f5 | Python | smile0304/py_asyncio | /chapter13/test.py | UTF-8 | 609 | 2.875 | 3 | [] | no_license | import asyncio
import time
from functools import partial
async def get_html(url):
print("start get url")
await asyncio.sleep(2)
print("end")
return "TT"
def callback(url,future):
print(url)
if __name__ == "__main__":
start_time = time.time()
loop = asyncio.get_event_loop()
#get_future ... | true |
309d31f03366ecd2818d5c913644108265576110 | Python | Rubber-Human/1JuanPablo_1ZavalaCardona_1358 | /Recursividad/factorial.py | UTF-8 | 239 | 3.9375 | 4 | [] | no_license | def factorial(num):
if num == 0:
return 1
elif num < 0:
return "Imposible realizar el factorial de un número negativo"
else:
return num * factorial(num - 1)
def main():
print(factorial(8))
main()
| true |
205802e11b3b8c6816a71302305343b083653bcd | Python | wiseodd/rgpr | /rgpr/kernel.py | UTF-8 | 1,158 | 2.71875 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn.functional as F
from gpytorch import kernels
import math
def k_cubic_spline(x1, x2, var=1, c=0):
min = torch.min(x1, x2)
return var * (1/3*(min**3-c**3) - 1/2*(min**2-c**2)*(x1+x2) + (min-c)*x1*x2)
def gamma(x):
return 0.5*(torch.sign(x)+1)
def kernel_1d(x1, x2, var=1):
... | true |
a0936943b6b95cc56104b7a6438ba7d2fd79c8ea | Python | wangyendt/LeetCode | /Contests/201-300/week 249/1930. Unique Length-3 Palindromic Subsequences/Unique Length-3 Palindromic Subsequences.py | UTF-8 | 499 | 3.15625 | 3 | [] | no_license | # !/usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author: Wang Ye (Wayne)
@file: Unique Length-3 Palindromic Subsequences.py
@time: 2021/07/19
@contact: wangye@oppo.com
@site:
@software: PyCharm
# code is far away from bugs.
"""
import string
class Solution:
def countPalindromicSubsequence(self, s: str) -> in... | true |
ec1ce79cddfe565b026756a365d1f94d786335c2 | Python | timff/bootstrap-cfn | /bootstrap_cfn/iam.py | UTF-8 | 14,871 | 2.59375 | 3 | [
"OGL-UK-2.0"
] | permissive | import logging
from boto.connection import AWSQueryConnection
import boto.iam
from bootstrap_cfn import utils
from bootstrap_cfn.errors import CloudResourceNotFoundError
class IAM:
conn_cfn = None
aws_region_name = None
aws_profile_name = None
def __init__(self, aws_profile_name, aws_region_name='... | true |
a708a4dbe0a666b2976ba86109024f55a46ea9f4 | Python | Jribbit/GenCyber-2016 | /onetimepad.py | UTF-8 | 311 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 8 11:13:22 2016
@author: student
"""
def onetimepad(text, pad):
convertedText = ""
i = 0
for letter in text:
convertedText += chr(ord(pad[i])^ord(text[i])
i = i + 1
if i > len(text):
break
return convertedText | true |
22194c7e411b70a967df89cda2f03cc75d81968e | Python | its-me-sv/Solutions-For-Project-Euler-s-Problems | /Smallest_Multiple/workout.py | UTF-8 | 620 | 3.609375 | 4 | [] | no_license | from time import time
from functools import reduce
def iterativeSolution(n):
start = time()
i = 1
while True:
for no in range(1, n+1):
if i % no:
break
else:
print("Iterative solution, Ans : {}, Time : {} seconds".format(i, time()-start))
return
i += 1
def mathematicalSolution(n):
start = time(... | true |
cf81f2a594d0cefa39d8d3311f0d2745d5a3ce1d | Python | alexanderfranca/pdbfile | /pdbfile/pdbfile.py | UTF-8 | 2,165 | 3.3125 | 3 | [] | no_license | import sys
import pprint
class PDBFile:
"""
Deals with KEGG PDB files indexers.
KEGG typically has PDB indexes for its proteins stored in ${organism_code}_pdb.list format.
"""
def __init__(self, file_to_parse):
# This class is all about filling that dictionary
self.pdbs = {}
... | true |
24802fd4e3ecd005e9f48ea5902928039a8d1bcb | Python | Adithyaj467/flask | /debugMode.py | UTF-8 | 376 | 3.015625 | 3 | [] | no_license | from flask import Flask
app =Flask(__name__)
@app.route('/')
def index():
return"<h1>Hello puppy</h1>"
@app.route("/information")
def info():
return"<h1>puppies are cute</h1>"
#Dynamic Routing Happens here
@app.route("/puppy/<name>")
def puppy(name):
return "<h1>2nd letter is .{}</h1>".format(name[... | true |
85d6de25a8dfa35e051196a7d59738dcb016f553 | Python | yimenhfeifei/josm-invoice | /view/database_dialog.py | UTF-8 | 3,485 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python3
try:
import traceback
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from view.customerTable import CustomerTable
from database_mapper import Database
except ImportError as err:
eType, eValue, eTb = sys.exc_info()
fileName, lineNum, funcName, text =... | true |
cc2090f90e16d7e8446589ae6e3dfdb041c3aee9 | Python | kuning19901/Algorithms-SedgewickandWayne-Python | /ch1-Fundamentals/ch1.3/ex_1.3.7.py | UTF-8 | 572 | 3.71875 | 4 | [] | no_license |
class pilaLista:
def __init__(self):
super().__init__()
self.mipila=list()
def tamano(self):
return len(self.mipila)
def vacia(self):
return (len(self.mipila==0))
def apilar(self,value):
self.mipila.append(value)
def desapilar(self):
retu... | true |
62531b773230c84cd1de429e1802403d68f9f7ff | Python | Mcguffen/StudyPython | /lession15/web15上课用品/routes/img.py | UTF-8 | 2,745 | 2.9375 | 3 | [] | no_license | from flask import (
render_template,
request,
redirect,
# url_for,
# Blueprint,
url_for,
Blueprint,
)
# 一次性引入多个 flask 里面的名字
# 注意最后一个后面也应该加上逗号
# 这样的好处是方便和一致性
from models.todo import Todo
from utils import log
# 创建一个 蓝图对象 并且路由定义在蓝图对象中
# 然后在 flask 主代码中「注册蓝图」来使用
# 第一个参数是蓝图的名字, 以后会有用(add函数里面就用... | true |
78fc94154d90b9f7b4d8b0dcef508e108f1f68c8 | Python | EdgarCarrera/EdgarProgramacionEjercicios | /HolaMundo.py | UTF-8 | 229 | 3.375 | 3 | [] | no_license | # holamundo es un mensaje basico.
# El punto de entrada se llamará main
# Se compone de un estatuto def que significa que lo definiremos
def main():
print("Hola mundo, ahora estas en el archivo de Edgar Carrera en Python") | true |
32e293ccb12d232e0177b5dd74af25eed532de46 | Python | hyang012/leetcode-algorithms-questions | /345. Reverse Vowels of a String/Reverse_Vowels_of_a_String.py | UTF-8 | 883 | 4.21875 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Leetcode 345. Reverse Vowels of a String
Write a function that takes a string as input and reverse only the vowels of
a string.
Example 1:
Given s = "hello", return "holle".
Example 2:
Given s = "leetcode", return "leotcede".
Note:
The vowels does not include the l... | true |
3d205b96bf324c0ff9907358bea9c235639ed081 | Python | Ar-Ray-code/rclpy_separate_example | /example_pkg_py/scripts_main.py | UTF-8 | 996 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/python3
import rclpy
from rclpy.node import Node
from example_pkg_py import a
from example_pkg_py.B import b
from example_pkg_py.C.C_child import c
class example_node(Node):
def __init__(self) -> None:
super().__init__("scripts_main")
self.self_introduction()
def hello(self):
... | true |
641514e51b604142948ce36b98152c4319027b21 | Python | secunda-cloud/sudoku-generator | /sudoku_generator.py | UTF-8 | 1,653 | 3.390625 | 3 | [
"MIT"
] | permissive | # !/usr/bin/python
import sys
from Sudoku.Generator import *
import json
def generate_soduku(difficulty_str):
difficulties = {
'easy': (35, 0),
'medium': (81, 5),
'hard': (81, 10),
'extreme': (81, 15)
}
base = "base.txt"
difficulty = difficulties[difficulty_str]
g... | true |
6b081a12dc2579141a83dfea0e71ede199f845ca | Python | bmwillett/wateraudio | /init.py | UTF-8 | 9,340 | 2.65625 | 3 | [] | no_license | # imports
###########################################
import numpy as np
import matplotlib.pyplot as plt
import random
import librosa
import librosa.display
import sounddevice as sd
from scipy.io import wavfile
from IPython.display import Audio, clear_output, display, Markdown
import time
from tqdm import tqdm
fro... | true |
adf9ea69e19c4713e6f47f42aeeb38ed04d1f622 | Python | AbhAsg09/Summer_Of_Bitcoin | /main.py | UTF-8 | 2,850 | 3.15625 | 3 | [] | no_license | import pandas as pd
# !!pls change the path to where you have stored you .csv file
dataframe = pd.read_csv('mempool.csv')
dataframe['parents '] = dataframe['parents '].fillna('NULL')
tx_id = list(dataframe['tx_id']) # List of transaction ids
# This function is used to find whether a given parent/parents are valid or... | true |
a43c072750c6e2f5b0da9a044afc8f3e3a0a6f74 | Python | rickzx/Rick-s-Pool-Game-Project | /untitled.py | UTF-8 | 439 | 3.140625 | 3 | [] | no_license | def encrypt(plaintext,password):
result = ""
for i in range (len(plaintext)):
shift = ord(password[i%len(password)]) - ord("a")
res = ((ord(plaintext[i])-ord("A") + shift) % 26) + ord("A")
result += chr(res)
return result
print(encrypt("GOTEAM","azby"))
d = {1:2, 3:4, 5:6}
d.update({"a":"b", 3:42})
print(d... | true |
6af1f2e47d041b6f48b04e89bcbaaed47e2f3b11 | Python | Aasthaengg/IBMdataset | /Python_codes/p03694/s261513682.py | UTF-8 | 309 | 2.71875 | 3 | [] | no_license | #from fractions import gcd
#mod = 10 ** 9 + 7
#N = int(input())
#a = list(map(int,input().split()))
#a,b,c = map(int,input().split())
#ans = [0] * N
def intinput():
return int(input())
def listintinput():
return list(map(int,input().split()))
N = intinput()
a = listintinput()
print(max(a)-min(a))
| true |
98335ff0597ab1f97045a1aed95de1178c913d0a | Python | shotashirai/Data-Analysis-Pipeline | /my_pipeline/feat_engineer.py | UTF-8 | 1,957 | 3.1875 | 3 | [] | no_license | # coding: utf-8
from sklearn.preprocessing import StandardScaler
import pandas as pd
def standard_vars(df, col_names):
sc = StandardScaler()
for col in col_names:
df[col] = sc.fit_transform(df[[col]])
return df
def gen_lagdata(df, columns, lags, drop_NaN=True):
''' Lag feature generator
... | true |
a6414f89cb360f2500a927a38fcd367714a79cb3 | Python | washing1127/LeetCode | /Solutions/0393/0393.py | UTF-8 | 826 | 2.609375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
# Author: washing
# DateTime: 2022/3/13 17:29
# File: 0393.py
# Desc:
class Solution:
def validUtf8(self, data: List[int]) -> bool:
MASK1, MASK2 = 1 << 7, (1 << 7) | (1 << 6)
def getBytes(num: int) -> int:
if (num & MASK1) == 0:
ret... | true |
c73bba00ce288ea06f84ab2d4f0fa283c9760475 | Python | mini-Shark/MONAI | /monai/data/dataset.py | UTF-8 | 6,438 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2020 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, s... | true |
11b8109231b63a6422895df8ff3ca4fec6526430 | Python | kiransivasai/hackerearth_problems | /determining_numbers.py | UTF-8 | 303 | 3.03125 | 3 | [] | no_license | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
e=0
c=list(dict(Counter(a)).keys())
d=list(dict(Counter(a)).values())
b=[]
for i in range(len(c)):
if(d[i]==1):
b.append(c[i])
e+=1
if(e==2):
break
b.sort()
for i in b:
print(i,end=" ")
| true |
01ac5b4fd58ebd828d6af3270c5d8ecd834c249a | Python | marine0131/keras_examples | /data_generator.py | UTF-8 | 1,772 | 2.640625 | 3 | [] | no_license | from tensorflow import keras
class DataGenerator():
def __init__(self, ptrain, ptest=None, augmentation=True, validation_split=0.2):
"""Data generation and augmentation
# Arguments
ptrain: string, training data folder .
"""
self.ptrain = ptrain
if not ptest:
... | true |
336129d5ddd0e423d5baba12a9b62715911c4787 | Python | leungjch/damped-harmonic-motion | /theoretical/calculateQ.py | UTF-8 | 943 | 2.71875 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import numpy as np
import csv
# exponential function
def func(x, a, b, c):
return a * np.exp(-b * x) + c
for i in range(1,2):
filename = "peaks/"+str(i)+".csv"
my_csv = pd.read_csv(filename)
p... | true |
ccd126fe5cc92e4530c2a08004bef4eafc36900a | Python | zaferozzcan/GA-adds | /GA-weeks/w1d5-landscaper/week11/dog_app_flask/models.py | UTF-8 | 409 | 2.703125 | 3 | [] | no_license | from peewee import *
import datetime
DATABASE = PostgresqlDatabase('dogs')
class Dog(Model):
name = CharField()
owner = CharField()
breed = CharField()
created_at = DateTimeField(default=datetime.datetime.now)
class Meta:
database = DATABASE
def initialize():
DATABASE.connect()
... | true |
4059eedc2b13f91d435c90dd5642eaf7790f4da8 | Python | Health-Union/snowshu | /snowshu/samplings/samplings/brute_force_sampling.py | UTF-8 | 2,217 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | from typing import TYPE_CHECKING
from snowshu.configs import MAX_ALLOWED_ROWS
from snowshu.core.samplings.bases.base_sampling import BaseSampling
from snowshu.samplings.sample_methods import BernoulliSampleMethod
from snowshu.samplings.sample_sizes import BruteForceSampleSize
if TYPE_CHECKING:
from snowshu.core.m... | true |
09898ae3ad9e5f187686c3334586c607db395f17 | Python | A-K-M16/Tic-tac-toe | /TTT - Final.py | UTF-8 | 3,739 | 3.203125 | 3 | [] | no_license | # putting random comment here
import sys
import os
class Board:
def __initi__(self):
self.board = []
def Create_Board(self):
self.board = [['1','2','3'],
['4','5','6'],
['7','8','9']]
def Show_Board(self):
print("\n")
for i in ra... | true |
539b3dcbc341f963c5d1dd4e46beaf1c1a2fd7ab | Python | joconstantine/Python | /Python School/Email_Sender_Application/Email_Sender.py | UTF-8 | 6,034 | 2.609375 | 3 | [] | no_license | import tkinter
import smtplib
import re
username = ""
password = ""
server = smtplib.SMTP('smtp.gmail.com:587')
def login():
if validate_login():
try:
global username
global password
username = str(entry1.get()) # username is from entry1
password = str(ent... | true |
06518719fd1f1ae7af2908a04f515a85aea8c31c | Python | deanantonic/exercises | /checkio/rotate_hole.py | UTF-8 | 3,295 | 3.828125 | 4 | [] | no_license | """
Sometimes humans build weird things. Our Robots have discovered and wish to use an ancient circular cannon loading system. This system looks like numbered pipes arranged in a circular manner. There is a rotating mechanism behind these pipes, and the cannons are attached to the end. This system is incredibly ancien... | true |
c7074fc495fb0d1c5e7078cb2020a3de7baea79b | Python | enorenio/test | /bs.py | UTF-8 | 381 | 3.84375 | 4 | [
"MIT"
] | permissive | """
Binary search algorithm
Input: list >> searchable variable
"""
def bs(lst, x):
lb = 0
ub = len(lst)
while lb != ub:
cv = (lb + ub)//2
if x == lst[cv]:
return x
elif x < lst[cv]:
ub = cv
else:
lb = cv+1
return None
"""
An example of work
"""
if __name__ == '__main__':
lst = sorted([int(x) for... | true |
3c1a6e46690f1d1df5a9ad4dce7426699edcfbc1 | Python | DmitriyDvornik/foo | /analis.py | UTF-8 | 1,333 | 3.09375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import textwrap
#reading txt files (data is already in Volts)
data = np.genfromtxt("data.txt",comments="\n")
settings = np.genfromtxt("settings.txt",comments="\n")
# init times
times = np.linspace(0, settings, len(data))
# init figure
fig = plt.figure()
ax = fig.add... | true |
92cceaf053fc2f9f10edec5fede1372d9aaa4f5e | Python | shifelfs/shifel | /a21.py | UTF-8 | 215 | 3.046875 | 3 | [] | no_license | a=input().split()
b=input().split()
c=input().split()
if a[0]==b[0]==c[0] or a[1]==b[1]==c[1]:
print('yes')
elif a[0]==a[1] or b[0]==b[1] or c[0]==c[1]:
print('yes')
else:
print('no')
| true |
7a96d6e4db4e3e9256a472083716eddffd44f52b | Python | WPI-FRASIER/PARbot | /ros_workspace/src/parbot_pathplanning/scripts/PARbot_drive_path.py | UTF-8 | 3,875 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
#Olivia Hugal
#Jeffrey Orszulak
#Last Revised 2/5/2014
import roslib; roslib.load_manifest('parbot_pathplanning')
import rospy
from PARbot_dijkstra import *
from nav_msgs.msg import OccupancyGrid
from geometry_msgs.msg import Point, Twist, Vector3
from parbot_pathplanning.srv import PARbotPathPl... | true |
71769d78cfa72aa0c0fd553e39bdf7bcd522c199 | Python | huazhige/EART119_Lab | /hw4/submissions/alvarezalejandra/alvarezalejandra_9951_1304044_HW_4_5.py | UTF-8 | 812 | 3.078125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
data = np.genfromtxt( 'HW4_vertTraj.txt').T
z = data[1]
t = data[0]
dzdt = []
def central_dif_1(z, h):
h = t[1]-t[0]
for i in range(len(z)-1): #iterating z column
new_value = (z[i+1] - z[i])/(2*h)
dzdt.append(new_value)
r... | true |
5d7495e6b604f077f5d0450c2ed98f279d95e1fc | Python | SKosztolanyi/Python-exercises | /50_Defining divisors function to return a tuple.py | UTF-8 | 460 | 3.984375 | 4 | [] | no_license | # This function finds all the common divisors of two numbers.
# The divisors are returned in the form of a tuple
def findDivisors(n1, n2):
'''
assumes n1 and n2 positive ints returns tuple
containing common divisors of n1 and n2'''
divisors = () # the empty tuple that will be filled at the end of func... | true |
619d60689961cad79a238a898bdd3f19ec75691a | Python | SunHwan-Park/problem-solving | /swea/1486/1486_dfs.py | UTF-8 | 447 | 2.71875 | 3 | [] | no_license | import sys
sys.stdin = open('input.txt')
def dfs(current, i):
global min_r
if current >= B or i == N:
if min_r > current >= B:
min_r = current
return
else:
dfs(current+H[i], i+1)
dfs(current, i+1)
T = int(input())
for tc in range(1, T+1):
N, B = map(int, inp... | true |
d62114648e06d536dae1421bbf99b72ef2411456 | Python | thanethomson/haproxy-session-mon | /haproxysessionmon/haproxy.py | UTF-8 | 3,642 | 2.640625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import io
import csv
from collections import namedtuple
import asyncio
from aiohttp import BasicAuth
import logging
logger = logging.getLogger(__name__)
__all__ = [
"HAProxyServerMonitor"
]
ProxyMetrics = namedtuple("ProxyMetrics", [
"server_id",
"endpoint",
"backend",
"s... | true |
cdc720506b34e850b6548a04d8fdb47a724a6a12 | Python | habetyes/WPT-Game | /Semi-Natural.py | UTF-8 | 4,878 | 3.4375 | 3 | [] | no_license | import random
import operator
import collections
import time
from Poker import *
from itertools import cycle
# Functions to disposition the pot after a hand.
def adjustment(max_burn, pot):
adjust = min(pot, max_burn)
return adjust
def bank_lost(bankroll, adjust):
bankroll -= adjust
return bankrol... | true |
ed374cf91e1a7b8af50c7a9139048153e849211f | Python | mizanur-rahman/HackerRank | /Python3/30 days of code/Day 26: Nested Logic/Solutions.py | UTF-8 | 270 | 2.796875 | 3 | [] | no_license | ad, am, ay = [int(x) for x in input().split(' ')]
ed, em, ey = [int(x) for x in input().split(' ')]
if (ay > ey):
print(10000)
elif (am, ay)==(em, ey) and (ad > ed):
print(15*(ad-ed))
elif (ay == ey) and (am > em):
print(500 * (am - em))
else:
print(0)
| true |
3d507983337b6ce44c8935783e6746c76fcbe2ff | Python | lucassxs/lista-1-expressoes-algoritmos | /exercicios/exercicio-1.py | UTF-8 | 2,666 | 4.15625 | 4 | [] | no_license | # alternativa a
x = int(input('Digite um valor para x: '))
i = int(input('Digite um valor para i: '))
j = int(input('Digite um valor para j: '))
r = x**(i+j)
print('O resultado de {} elevado a {} + {} é {}!'.format(x, i, j, r))
# alternativa b
print('Letra B:')
a = int(input('Digite um valor para x: '))
b = int(input(... | true |
c6653cfbfca547bf3624c8519379af1c068a84c7 | Python | AaronMillOro/Personal_learning_journal_Flask | /models.py | UTF-8 | 1,015 | 2.53125 | 3 | [] | no_license | import datetime
from flask_bcrypt import generate_password_hash
from flask_login import UserMixin
from peewee import *
DATABASE = SqliteDatabase('learn_journal.db')
class Entry(Model):
"""Peewee model class for entries"""
title = CharField()
date = DateTimeField(default=datetime.datetime.now)
timespe... | true |
a027e7294593e7ec9e0e5734fbcdab236737e841 | Python | kart/projecteuler | /42.py | UTF-8 | 396 | 3.53125 | 4 | [] | no_license | def is_square(n):
n = n ** 0.5
return int(n) == n
def sqrt(n):
return int(n ** 0.5)
def is_triangular(x):
y = 8*x + 1
if (is_square(y) and (0 == (sqrt(y) - 1) % 2)):
return 1
return 0
if __name__ == "__main__":
f = open('42.in', 'r')
for line in f:
s = line[0:len(line) - 1]
t = 0
for c in s:
t = ... | true |
74728042f01fed1b9fd8a1964da7a074fbdd4e93 | Python | hrz123/algorithm010 | /Week07/每日一题/95. 不同的二叉搜索树 II.py | UTF-8 | 6,374 | 3.515625 | 4 | [] | no_license | # 95. 不同的二叉搜索树 II.py
from functools import lru_cache
from typing import List
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
# 思路:
# 用dfs找到所有的树
# 当没有用的数字为止
# 只要有可用的数字
# dfs()
class S... | true |
d3a1ac9f91840e8be54f925ffafaa3f6289628b9 | Python | kravi2018/acda | /src/acda/common/metrics.py | UTF-8 | 2,063 | 3.1875 | 3 | [] | no_license | '''
Implementation of the metrics
'''
import numpy as np
def precision_at_k(predictions, actuals, k):
"""
Computes the precision at k
:param predictions: array, predicted values
:param actuals: array, actual values
:param k: int, value to compute the metric at
:returns precision: float, the pr... | true |
da01544eb18163c45c2948122d1d5e86c1a4eec5 | Python | Kevinbriceo567/allPython | /3.Irtemediate/GuardadoPermanente/infoPermanente.py | UTF-8 | 1,560 | 3.703125 | 4 | [] | no_license | import pickle
class Persona:
def __init__(self, nombre, genero, edad):
self.nombre=nombre
self.genero=genero
self.edad=edad
print("\nNueva persona " + nombre)
def __str__(self):
return "{} {} {}".format(self.nombre, self.genero, self.edad)
class ListaPersonas:
l... | true |
1a4956f55563136cca273185493c6f155632873c | Python | MarkNo1/Machine_Learning | /ML_16-17/05-K-Mean_GMM/code/hw5.py | UTF-8 | 2,312 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 28 14:40:41 2016
@author: markno1
"""
from sklearn import datasets
from plot import plotting_grid, plot_info
digits = datasets.load_digits()
from tabulate import tabulate
# plt.imshow(digits.images[5])
# plt.show()
X = digits.data
y = digits.tar... | true |
fe45dbb85d9ee2ea07a175f18e656c536c241b53 | Python | kl0ck/meuspila | /parsers.py | UTF-8 | 462 | 2.890625 | 3 | [
"BSD-3-Clause"
] | permissive | import re
class DataParser:
# DD/MM/YYYY
def parse(self, txt):
return re.findall(r"\b\d{2}/\d{2}/\d{4}\b", txt)
class TickerParser:
def parse(self, txt):
return re.findall(r"\b([A-Za-z]\w*)\b", txt)
class TipoOperacaoParser:
# C/V
def parse(self, txt):
... | true |
4b5e25595e19ef2c1b0111e92213095be1e74e9b | Python | draconar/MITx-600x | /2.py | UTF-8 | 500 | 2.890625 | 3 | [] | no_license | balance = 10000
annualInterestRate =0.18
monthlyInterestRate = annualInterestRate/12
lower = balance/12
upper = (balance*(1+monthlyInterestRate)**12)/12
b = balance
lowestpayment = 0
epsilon = 0.01
while abs(b)>=epsilon:
b = balance
lowestpayment = (lower+upper)/2
for month in range(1,13):
b = (b-... | true |
3933e717da97ab8139bcd8fd5a4964cd3574a675 | Python | Carlzkh/CrazyPythonNotes | /exercise/four/4.11.py | UTF-8 | 476 | 3.8125 | 4 | [] | no_license | """
11. 给定3
----c----
--c-b-c--
c-b-a-b-c
--c-b-c--
----c----
给定4输出:
------d------
----d-c-d----
--d-c-b-c-d--
d-c-b-a-b-c-d
--d-c-b-c-d--
----d-c-d----
------d------
"""
english = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
n = int(input('输入整数:'))
row = 2... | true |
60e04522ad50070c2f179cfe872ebde2f539ff1f | Python | sayeedap/Paperless-Ticketing-Using-Face-Recognition-System | /01_face_dataset.py | UTF-8 | 5,401 | 2.828125 | 3 | [] | no_license | import cv2
import os
import mysql.connector
from tabulate import tabulate
from texttable import Texttable
import datetime
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="",
database="python"
)
mycursor = mydb.cursor()
#def logged(station_id,station_name):
# print ("welcome",station_name... | true |
be1ababf5c8194204db2bc49e3b4d4a2fcd7615e | Python | kylinRao/appTestSum | /yinyangshi/identifySimilarImage.py | UTF-8 | 1,286 | 2.578125 | 3 | [] | no_license | from PIL import Image
import math
import operator
import heapq
WPIECE = 20
HPIECE = 10
def compare_and_return_rms(image1filePath,toCompare):
h1 = Image.open(image1filePath).histogram()
h2 = Image.open(toCompare).histogram()
rms = math.sqrt(reduce(operator.add, list(map(lambda a,b: (a-b)**2, h1, h2... | true |
b0302fed7f34280f458765f9eee4602a6b3a6e82 | Python | farazahmediu01/Simple-Command-line-App | /cmd_colors.py | UTF-8 | 823 | 3.375 | 3 | [] | no_license | COLORS = {
"black": "\u001b[30;1m",
"red": "\u001b[31;1m",
"green": "\u001b[32m",
"yellow": "\u001b[33;1m",
"blue": "\u001b[34;1m",
"magenta": "\u001b[35m",
"cyan": "\u001b[36m",
"white": "\u001b[37m",
"reset": "\u001b[0m",
"yellow-background": "\u001b[43m",
"black-background... | true |
cc8c087e8059f4662722fa777299599b0b520ca8 | Python | hieucnm/fashion_visual_search | /retrieval/utils/visualizers.py | UTF-8 | 3,040 | 2.796875 | 3 | [] | no_license |
import cv2
import numpy as np
import matplotlib.pyplot as plt
from . import restrict_bbox
class BoundingboxVisualizer(object):
def __init__(self, n_class, scaled=True):
assert n_class > 0, 'n_class must greater than zero'
self.n_class = int(n_class)
self.scaled = scaled
cmap =... | true |
5e75c3a4b09688eb0ea5167f756c888283a76878 | Python | intcatch2020/autonomy_meta_data | /metadata_parse.py | UTF-8 | 11,535 | 2.609375 | 3 | [] | no_license | import sys
import datetime
import re as regex
import json
import six
import numpy as np
import sklearn.linear_model as lm
import matplotlib.pyplot as plt
_REGEX_FLOAT = regex.compile(r"[-+]?[0-9]*\.?[0-9]+")
_REGEX_FILENAME = regex.compile(
r".*platypus"
r"_(?P<year>\d{4})(?P<month>\d{2})(?P<day>\d{2})"
... | true |
9996c7bacc163e4e49a5c20c9ccaadad956d9d58 | Python | openGDA/gda-diamond | /configurations/i16-config/scripts/pd_attenuator.py | UTF-8 | 4,200 | 2.515625 | 3 | [] | no_license | from inttobin import *
from gda.epics import CAClient
import string
import beamline_info as BLi
from gda.device.scannable import ScannableMotionBase
from time import sleep
from mathd import *
class Atten(ScannableMotionBase):
def __init__(self,name,FoilList):
self.setName(name)
self.setInputNames(["Atten"])
... | true |
494d57267d45db78f43e3363cc41d7488db8c9a4 | Python | LukeLinEx/mlforest | /ml_forest/core/constructions/docs_handler.py | UTF-8 | 4,747 | 2.765625 | 3 | [] | no_license | from bson.objectid import ObjectId
from datetime import datetime
from copy import deepcopy
from ml_forest.core.utils.docs_init import root_database
class DocsHandler(object):
def __init__(self):
pass
def init_doc(self, obj, update_dict=True):
"""
The "essentials" attribute of an obj w... | true |
242ae757b266c07336fb145da03add1ac7c5a71c | Python | CamphortreeYH/Python | /Crossin/Pygame/Fighting.py | UTF-8 | 4,321 | 3.09375 | 3 | [] | no_license | import pygame, sys
from random import *
pygame.init()
size = width, height = 450, 800
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Hello World!")
background = pygame.image.load("back.jpg")
screen.blit(background, [0, 0])
clock = pygame.time.Clock()
class Plane(pygame.sprite.Sprite):
def __ini... | true |
cdc82d98ee66e093592a1dbe1c9e04fb07ffcb99 | Python | p0nley/magnet_search | /basic_coder.py | UTF-8 | 1,578 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
#coding=utf8
# by luwei
# begin:2013-9-11
# developing...
import sys,os
import socket
import header
reload(sys)
sys.setdefaultencoding('utf-8')
def btol(net_str):
#转换id和port的基础
return long(str(net_str).encode('hex'), 16)
def ltob(long_num):
#btol的逆操作
num_str = hex(long_num)[2:].... | true |
86ab93b9224eb4be8aa4cccd88ba4fa11074a011 | Python | TsingJyujing/AnimeHeadDetection | /transforms.py | UTF-8 | 2,664 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@Author: zzn
@Date: 2019-11-04 10:30:30
@Last Modified by: zzn
@Last Modified time: 2019-11-04 10:30:30
"""
import random
import torch
from PIL import Image
from torchvision.transforms import functional as F
class Compose(object):
def __init__(self, transforms):
... | true |
4983076699b6410deac602df3e1e13a972249041 | Python | Hamza-Rashed/Python-data-structures-and-algorithms | /data_structures_and_algorithms/data_structures/hash_table/hash_table.py | UTF-8 | 893 | 3.328125 | 3 | [] | no_license |
class Hashmap:
def __init__(self,size):
self.size=size
self.map=[None]*size
def get_hash(self,key):
ascii_tot=0
for obj in key:
ascii_tot += ord(obj)
hashed = (ascii_tot*17)%self.size
return hashed
def add(self,key,value):
idx=se... | true |
e473e3d001dd511bc96567cddf36620a452cab90 | Python | CompBiochBiophLab/Tools | /filesTools/DuplicatedFilesB.py | UTF-8 | 3,591 | 3.25 | 3 | [
"Unlicense"
] | permissive | from collections import defaultdict
import hashlib
import os
import sys
def chunk_reader(fobj, chunk_size=1024):
"""Generator that reads a file in chunks of bytes"""
while True:
chunk = fobj.read(chunk_size)
if not chunk:
return
yield chunk
def get_hash(filename, first_ch... | true |
799a5dc9c38320c46833de6ef37390cda83e7b48 | Python | henryji96/LeetCode-Solutions | /Medium/576.out-of-boundary-paths/out-of-boundary-paths.py | UTF-8 | 948 | 2.5625 | 3 | [] | no_license | class Solution:
def findPaths(self, m, n, N, i, j):
"""
:type m: int
:type n: int
:type N: int
:type i: int
:type j: int
:rtype: int
"""
dp = [[[0 for i in range(n)] for i in range(m)] for i in range(N+1)]
adjs = [[1,0], [-1,0], [0,1],... | true |
54b58fa2d0140102e07524a6203edc6d1556ff0d | Python | vidhya002/python-programming | /Beginner level/minimum.py | UTF-8 | 100 | 2.90625 | 3 | [] | no_license | b=int(input())
a=[]
for i in range(b):
s=int(input())
a.append(s)
c=min(a)
print(c)
| true |
515c76bace5254c5a41f4a886b425a9a397bf68c | Python | art567/bf2-stats | /webapp/processors/awards/fearless.py | UTF-8 | 900 | 2.84375 | 3 | [] | no_license |
from processors.awards import AwardProcessor,Column,PLAYER_COL
from models.weapons import SOLDIER
class Processor(AwardProcessor):
'''
Overview
This processor keeps track of the most number of kills against vehicles
using soldier carried weapons.
Implementation
On kill events check if the wea... | true |
330131ca99caf2e0cf60945108c6de4db449d25e | Python | Mingxiao-Li/DecomposingSentenceRe | /Discriminator.py | UTF-8 | 596 | 2.59375 | 3 | [] | no_license | import torch.nn as nn
class Discriminator(nn.Module):
def __init__(self,input_size,hidden_size,output_size,dropout):
super().__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.output_size = output_size
self.dropout = dropout
self.classifier... | true |
d21a6ec72a56ada1c980357750994737bf43195f | Python | ivnukov/aleveloop7 | /lesson2/multiple.py | UTF-8 | 1,257 | 3.65625 | 4 | [] | no_license | class Parent:
def __init__(self, age, gender, name, dob):
self.age = age
self.gender = gender
self.name = name
self.dob = dob
def iam(self):
return f"I am {self.__class__.__name__} and {self.age} yo"
def working(self):
return 'I\'m working'
class GrandPar... | true |
8ad2ec506ed16aa5af96568c0151e394872eab46 | Python | huangyingw/submissions | /267/267.palindrome-permutation-ii.353243650.Wrong-Answer.leetcode.python3.py | UTF-8 | 822 | 3.09375 | 3 | [] | no_license | class Solution(object):
def generatePalindromes(self, s):
dic = {}
half = []
res = []
for c in s:
dic[c] = dic.get(c, 0) + 1
odd = 0
for c in dic:
if dic[c] % 2 != 0:
odd += 1
if odd > 1:
return []
se... | true |
240853f5e67d002ceb01fd7ff8758ca6093c35c7 | Python | Deci-AI/super-gradients | /src/super_gradients/common/exceptions/factory_exceptions.py | UTF-8 | 926 | 3.109375 | 3 | [
"LicenseRef-scancode-proprietary-license",
"Apache-2.0"
] | permissive | from typing import List
from rapidfuzz import process, fuzz
class UnknownTypeException(Exception):
"""Type error with message, followed by type suggestion, chosen by fuzzy matching
(out of 'choices' arg passed in __init__).
:param unknown_type: The type that was not found.
:param choices: ... | true |
274e72adf86ff863f7f52b3e02c9ac2ad8435a78 | Python | dilanmorar/python_basics | /python_basics/strings.py | UTF-8 | 1,396 | 4.84375 | 5 | [] | no_license | # strings
## define string
my_string = "I'm an amazing string"
my_string2 = "So am I"
my_name = "Dilan Morar"
print(my_string)
print(type(my_string2))
# Concatenation - joining if two strings
print("Example of concatenation: "+my_string)
print("these are examples of strings", my_string2, my_string)
concatenate = my... | true |
2f7e4e4763bb5384d1519579c54e384a17970a98 | Python | VRamazing/UCSanDiego-Specialization | /Assignment 2/lcm/lcmBygcd.py | UTF-8 | 554 | 3.734375 | 4 | [] | no_license | # Uses python3
import sys
# Task. Given two integers a and b, find their least common multiple.
# Input Format. The two integers a and b are given in the same line separated by space.
# Constraints. 1 ≤ a, b ≤ 2 * 10 9 .
# Output Format. Output the least common multiple of a and b.
#lcm is product of number divided by... | true |
0d962090c5d8f66c9db23eb1b628ef7297ee3d23 | Python | foxzyxu/offer | /50.数组中重复的数字.py | UTF-8 | 569 | 4.0625 | 4 | [] | no_license | #题目:**在一个长度为n的数组里的所有数字都在0到n-1的范围内。 数组中某些数字是重复的,
#但不知道有几个数字是重复的。也不知道每个数字重复几次。请找出数组中任意一个重复的数字。
#例如,如果输入长度为7的数组{2,3,1,0,2,5,3},那么对应的输出是第一个重复的数字2
class method():
def count(self, array, n):
num = {}
for val in array:
num[val] = 0
for i in range(0,len(array)):
num[... | true |
e398398485928ac1a2d58effd464bfd92dadb41d | Python | pvk-developer/SDV | /sdv/constraints/utils.py | UTF-8 | 4,021 | 3.296875 | 3 | [
"MIT"
] | permissive | """Constraint utility functions."""
from datetime import datetime
from decimal import Decimal
import numpy as np
import pandas as pd
from pandas.core.tools.datetimes import _guess_datetime_format_for_array
def cast_to_datetime64(value):
"""Cast a given value to a ``numpy.datetime64`` format.
Args:
... | true |
2f442ffad5caccbbcd4430399ff942dc645a9941 | Python | GANPerf/GANPerf | /model_def.py | UTF-8 | 1,710 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import print_function, division
import torch
import torch.nn as nn
from torchvision import models
class MyModel(nn.Module):
def __init__(self):
super(MyModel, self).__init__()
self.classifier = nn.Sequential(
nn.Linear( 8, 128 )... | true |
80240b2c2f119c62b0cb97d62c24a7b5cf673fe2 | Python | tonyktliu/Excel_filtering_by_prefix | /scanning.py | UTF-8 | 3,920 | 3.421875 | 3 | [] | no_license | import csv
import openpyxl as xl;
import sys
from openpyxl.styles import Font
# This program converse the source file from CSV to XLSX. Extract rows when the prefix of particular cells matches with the Keywords.
# ===============Variables for the script=================#
targetExcel = "Test_Output.xlsx"
pref... | true |
ffbf365d5c7d280ba8120d5ce234dee175cf8e1a | Python | jjmirandaa86/learn_Python | /example2/22.var_name.py | UTF-8 | 293 | 2.53125 | 3 | [] | no_license | from modulo_calculadora import __name__ as __name__calculadora__
print(__name__) # modulo principal q ejecuto es decir 22.var_name
print(__name__calculadora__) #modulo principal de modulo_calculadora
if __name__ == '__main__': # para saber q es el principal
print("es el principal") | true |
4441ca8ea41ea5d0aaff88cfe93f9fd5ca7e2efa | Python | chesleahkribs/RFID_Tag | /proj2 (1).py | UTF-8 | 1,827 | 3.15625 | 3 | [] | no_license | #proj2.py
import numpy as np
# Python program to get average of a list
def Average(lst):
return sum(lst) / len(lst)
with open("testdata") as f:
floatdata = f.read()
floatdata = floatdata.rstrip()
tdata = floatdata.split("\n")
#tdata = tdata.strip()
new_tdata = []
for item in tdata:
... | true |
b0566bae38bcc078f4694c734d3059ed7e851c20 | Python | yagippi27/Big_Data_Course_from_Jul.1st_to_Nov.08th | /파이썬 코딩 도장 by 남재윤/과제제출/안수현(과제17)/practice3-5.py | UTF-8 | 707 | 2.78125 | 3 | [] | no_license | import random
import os
import shutil
PATH = 'c:/Temp/Ex04'
os.mkdir(PATH)
os.chdir(PATH)
for dirname in ('low', 'mid', 'high'):
os.mkdir(PATH + '/' + dirname)
for num in ('1','2','3'):
os.mkdir(PATH + '/' + dirname + '/' +num)
a = random.randrange(0,10000)
b = str(random.randrange(1,4))
file_name = '... | true |
89620a69689ac5c6a03cb31f65804bb63533353e | Python | vault-the/laboratory | /tests/test_decorator.py | UTF-8 | 1,284 | 2.734375 | 3 | [
"MIT"
] | permissive | import mock
import pytest
import laboratory
from laboratory import Experiment
def dummy_candidate_mismatch(x):
return False
@Experiment(candidate=dummy_candidate_mismatch, raise_on_mismatch=True)
def dummy_control_mismatch(x):
return True
def dummy_candidate_match(x):
return True
@Experiment(candida... | true |
7880cdcc9183da27a5c297d3d54825d2b7949409 | Python | KEZKA/ESCAPE | /ESCAPE/sprites/notes_on_board.py | UTF-8 | 1,235 | 3.109375 | 3 | [
"MIT"
] | permissive | from random import randint, shuffle
from ESCAPE.sprites.note import Thing
class Notes:
def __init__(self, game, code):
base_filename = 'images/note_with_number/*.png'
self.sprites = []
self.game = game
x, y = 220, 60
for i in range(4):
x += 55
s = r... | true |
49a140f62b481b75cfe51977750cf3f873ef010f | Python | Fedorkka/Pycharm-projects | /untitled/untitled-11222.py | UTF-8 | 345 | 3.015625 | 3 | [] | no_license | #coding: utf-8
from tkinter import*
def c(event):
x1=(event.x_root)
y1=(event.y_root)
while True:
if x1>200 and x1<700:
b.destroy()
root=Tk()
root.geometry('600x100')
b=Button(root, text='Попробуй нажать на меня',font='Arial 30')
b.pack()
root.bind('<Motion>', c)
root.mainl... | true |
c654b8b6f43541bbeef3274672bc3001c9b69ea2 | Python | Red-Teapot/mc-commandblock-1.13-update | /commands/pre_1_13/nbtstr/types/nbt_float.py | UTF-8 | 926 | 2.78125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from . import NBTValueType
from ..serialization_params import SerializationParams
class NBTFloat(NBTValueType):
value_types = [float]
def __init__(self, size, value):
super().__init__(value)
self.size = size
@property
def size(self) -> str:
return self.__size
@size.... | true |
f009160771170abe5c6b492b7e289d8835495a56 | Python | zytomorrow/IP_POOL | /IP_POOL/pipelines.py | UTF-8 | 1,541 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
import os
import sqlite3
class IpPoolPipeline(object):
count = 0
def process_item(self, item, spider):
IpPool... | true |
3768378742a32ff0e21b20fe576b2dfce938fdcb | Python | monkeyfeige/SEOBaiduQuickRank | /autoupdate/down_util.py | UTF-8 | 3,563 | 2.515625 | 3 | [] | no_license | # uncompyle6 version 3.2.2
# Python bytecode 3.4 (3310)
# Decompiled from: Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: C:\PycharmProjects\AutoUpdate\down_util.py
import re, os, traceback, requests, sys, time
class DownLoad:
def __init__(self, url, downPat... | true |
8ea6224a41029d4d756137c15cf8d6f413a50ecd | Python | muditbac/ExoplanetDetection | /test_model.py | UTF-8 | 2,451 | 2.515625 | 3 | [] | no_license | import argparse
import cPickle
import os
import numpy as np
import pandas as pd
from datetime import datetime
from config import RESULTS_PATH
from utils.model_utils import load_model
from utils.processing_helper import load_testdata, save_features
from train_model import analyze_results
from utils.python_utils import... | true |
0a7f2c34db64be89de5b7eb80c6e8992513239ec | Python | robertsawko/covid-19-in-households-public | /examples/building_matrices.py | UTF-8 | 4,466 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | '''This script constructs the internal transmission matrix for a UK-like
population and a single instance of the external importation matrix.
'''
from numpy import array, arange, concatenate, diag, ones, where, zeros
from pandas import read_excel, read_csv
from model.preprocessing import (
make_aggregator, aggregat... | true |
b75fa86490acb9ef4329676716643e506e535e44 | Python | aesdeef/advent-of-code-2020 | /day_11/day_11_seating_system.py | UTF-8 | 883 | 3.578125 | 4 | [] | no_license | from seat_part_1 import Seat as SeatPart1
from seat_part_2 import Seat as SeatPart2
def parse_input(Seat):
"""
Parses the input and creates the seats using the provided class
"""
with open("input_11.txt") as f:
for y, line in enumerate(f):
for x, seat in enumerate(line):
... | true |
9fb8b0af36473ac1909e42c635663b1d83d4aab2 | Python | dzolotusky/advent-of-code | /2016/15/15.py | UTF-8 | 685 | 3.390625 | 3 | [] | no_license | with open("input15.txt") as f:
content = f.readlines()
discs = []
for cur_line in content:
cur_line_split = cur_line.strip().split(' ')
disc_num = int(cur_line_split[1][1:])
tot_positions = int(cur_line_split[3])
start_pos = int(cur_line_split[-1][:-1])
discs.append({"num": disc_num, "tot_pos"... | true |
4890e0f779ba2cc9418247dc775b675d7727d242 | Python | githublgc/PCFG_MARKOVmodel | /markov/attack.py | UTF-8 | 1,820 | 2.71875 | 3 | [] | no_license | from train import *
from guess import *
import argparse
import os
def main():
parser = argparse.ArgumentParser(description="Markov-based Password Cracking")
parser.add_argument('--path', type=str, default='data/rockyou.txt', help='the path of password file')
parser.add_argument('--number', type=float, defa... | true |
b2e4b1a72c32dab1070ac93685088314751caf86 | Python | sjgosai/cms2-work | /component_stats/cms/old/Operations/DotDataFunctions/datavstack.py | UTF-8 | 2,305 | 2.65625 | 3 | [
"BSD-2-Clause"
] | permissive | '''
"Vertical stacking" of DotDatas, e.g. adding rows.
'''
import numpy
from System.Utils import uniqify, ListUnion, SimpleStack1, ListArrayTranspose
import Classes.DotData, pickle
def datavstack(ListOfDatas):
#if all([isinstance(l,DotData) for l in ListOfDatas]):
#else:
# return numpy.vstack(ListOfDatas)
CommonAtt... | true |
7d51a5ebb36d693572ee15c799868ee2c8bd3cd7 | Python | carronj/lenspyx | /lenspyx/angles.py | UTF-8 | 3,785 | 2.671875 | 3 | [
"MIT"
] | permissive | import numpy as np
import healpy as hp
def _sind_d_m1(d, deriv=False):
"""Approximation to sind / d - 1"""
assert np.max(d) <= 0.01, (np.max(d), 'CMB Lensing deflections should never be that big')
d2 = d * d
if not deriv:
return np.poly1d([0., -1 / 6., 1. / 120., -1. / 5040.][::-1])(d2)
el... | true |
ca679082c9bc45a6696a3c9b5841d5764c769f6f | Python | Tim-Birk/warbler | /test_user_model.py | UTF-8 | 6,608 | 2.859375 | 3 | [] | no_license | """User model tests."""
# run these tests like:
#
# python -m unittest test_user_model.py
import os
from unittest import TestCase
from sqlalchemy.exc import IntegrityError
from models import db, User, Message, Follows
# BEFORE we import our app, let's set an environmental variable
# to use a different databas... | true |
d272e034bc743de8b8e0adf1fbda9900d7781cf5 | Python | Paruyr31/Basic-It-Center | /Basic/Homework.6/251_.py | UTF-8 | 196 | 3.671875 | 4 | [] | no_license | n = int(input("list length = "))
arr = []
for i in range(n):
arr.append(int(input("arr["+str(i)+"] = ")))
max = arr[0]
for i in arr:
if i > max:
max = i
print("max = "+str(max)) | true |
950246d5efd85effb4b2ab9526415b3a4900896f | Python | ManuelFay/NumpyDeepLearning | /numpy_dl/models/model_lib.py | UTF-8 | 995 | 2.859375 | 3 | [] | no_license | import numpy as np
import numpy_dl as nn
class SimpleNet(nn.Sequencer):
def __init__(self):
super(SimpleNet, self).__init__()
self.fc1 = nn.Linear(2, 200)
self.fc5 = nn.Linear(200, 1)
self.relu1 = nn.ReLU()
self.seq = [self.fc1, self.relu1, self.fc5]
def forward(self... | true |