blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
f9e296bfdeb62ed9881c0d1c422ca933957283f3 | aplassard/Image_Processing | /MachineLearning/ml.py | UTF-8 | 2,383 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
import numpy as np
from common import *
from mlFunctions import *
from SVM import buildSVM
from KNN import buildKNN
from ANN import initialize
import mask
class ml(object):
'''
Machine Learning Class
'''
def __init__(self,trainingfeatures,traininglabels):
'''
Input... | true |
568285b25848ac7d9100d6a5b1916e04aadb30ec | prashunchitkr/basic-python-training | /Day4/string_operations.py | UTF-8 | 977 | 4.875 | 5 | [] | no_license | '''
String Operations
1. List analogy
2. count()
3. split()
4. startswith()/endswith()
5. Repeating strings
6. replace()
7. upper()/lower()
8. strip()/lstrip()/rstrip()
9. join()
'''
text = 'Hello World'
print(text[:5])
for char in text:
print(char)
# .count()
print(text.count('Hello'))
# .split()
print(tex... | true |
a905d3b33ab5927c206e6b1efd3e0a68e1174587 | xingyunsishen/Python_CZ | /38-函数参数.py | UTF-8 | 1,977 | 3.828125 | 4 | [] | no_license | #-*- coding: utf-8 -*-
'''
num1 = int(input('please input a num:'))
num2 = int(input('please input a num:'))
num3 = int(input('please input a num:'))
num4 = int(input('please input a num:'))
'''
#函数的缺省参数
def test(a, b=3):
c = a + b
print('%d+%d=%d' %(a, b, c))
# 多个缺省参数
def test01(a, b=11, c=22):
result = a... | true |
6f9cd9a0f9d4c9ea2401cd744e373dacf147a831 | CesarDevs/Programacion | /Programacion/Inteligencia artificial/Logica Difusa/pruebaMatriz.py | UTF-8 | 101 | 2.65625 | 3 | [] | no_license | matriz= []
matriz= [],[]
matriz[0].append(4)
matriz[0].append(5)
matriz[1].append(6)
print(matriz) | true |
cf67b7d12ff0fb42d1dba4941ad36bb940b79af2 | jlin00/savetheturtles-env | /utl/db_manager.py | UTF-8 | 3,394 | 2.84375 | 3 | [] | no_license | import sqlite3
from utl.db_builder import exec, execmany
#====================================================
#sign up and login functions
#authenticates user
def userValid(username,password):
'''def userValid(username,password): determines if username is in database and password corresponds to username'''
q... | true |
0468d0d84de0f0de129263969ff78e663ab23e16 | linian365boy/e_craw | /e_amazon/keyword_to_placement.py | UTF-8 | 6,150 | 2.5625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import random
import os
import csv
import time
from datetime import datetime
from e_amazon.craw_constant import headers_list
class Keyword_placement():
def __init__(self):
# 这里填你要查排名的ASIN,注意英文引号,英文逗号,每行必须左对齐!
self.asin_list = [
"B01E9TJMA... | true |
04b34dd70812045f17ea051dfd8edc7e484289dc | jasarsoft/examples | /python/ops/lekcija 22/mobilni_telefon.py | UTF-8 | 758 | 2.671875 | 3 | [
"MIT"
] | permissive | import ekran_telefona
def MobilniTelefon(proizvodjac, model, godina, memorijaRAM, memorijaDisk, ekran):
if type(ekran) != dict:
return -1
for kljuc in ekran.keys():
if kljuc not in ['sirina', 'visina']:
return -1
return {
'proizvodjac' : proizvodjac,
... | true |
d9dddfe16fe8f3b8bb07e28538b603aa1f88f662 | Jack-Tilley/ctci_python_jt | /ch_08_recursion_dynamic_programming/powerSet.py | UTF-8 | 270 | 3.28125 | 3 | [] | no_license | #8.4
set = [1,2,3]
length = len(set)
powers = []
def power_set(set, powers):
if set not in powers:
return powers.append(power_set(set[:-1], powers))
else:
return powers.append(power_set(set, powers))
powers.append()
return powers.append() | true |
30692360230b3a5564525c6c9d298bc1f946be73 | Shah-imran/Test-Driven-Development-with-Django-REST-Framework-and-Docker | /app/tests/movies/test_views.py | UTF-8 | 5,797 | 2.6875 | 3 | [] | no_license | import pytest
from movies.models import Movie
# Request database access explicitly decorator(@pytest.mark.django_db)
@pytest.mark.django_db
def test_add_movie(client):
movies = Movie.objects.all()
assert len(movies) == 0
resp = client.post(
"/api/movies/",
{"title": "The Big Lebowski", "g... | true |
e5ac060c1fbb43ef3ffd827b754f2d4330317a9a | rhzx3519/leetcode | /python/160. Intersection of Two Linked Lists.py | UTF-8 | 790 | 3.59375 | 4 | [] | no_license | # Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def getIntersectionNode(self, headA, headB):
"""
:type head1, head1: ListNode
:rtype: ListNode
"""
pa = headA
... | true |
e8cc128e0007dea2b53bd4315f79502c161bc3d8 | SelvorWhim/competitive | /Codewars/VasyaClerk.py | UTF-8 | 831 | 3.578125 | 4 | [
"Unlicense"
] | permissive | def tickets(people):
bills = {25:0,50:0,100:0}
for bill in people:
if bill == 25:
bills[25] += 1
elif bill == 50: # must give a 25 in change
if bills[25] >= 1:
bills[25] -= 1
bills[50] += 1
else:
return "NO"
... | true |
8397a0568ac17f37b76986c1fab7fb80538b0d74 | webkadiz/olympiad-problems | /explosion_hazard.py | UTF-8 | 162 | 3.234375 | 3 | [
"MIT"
] | permissive | n = int(input())
tasks = [0] * (n if n >= 2 else 2)
tasks[0] = 2
tasks[1] = 3
for i in range(2, n):
tasks[i] = tasks[i - 1] + tasks[i - 2]
print(tasks[n - 1])
| true |
03000cd6d0b5f3338eea22d46bd2ef7ed3d05c0f | tamnguyenvan/visualdet3d-tf | /visualdet3d/networks/utils/utils.py | UTF-8 | 11,262 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | """
"""
import numpy as np
import tensorflow as tf
from tensorflow.keras import layers
from visualdet3d.utils import alpha_to_theta_3d
def get_num_parameters(model):
"""Count number of trained parameters of the model"""
num_parameters = 0
for var in model.trainable_variables():
num_parameters += t... | true |
04cf9a0d1866e695ce49337fefaaee0d4ed969f6 | Naveen-Krishnamurthy/PythonProgramming | /PythonPrograms/GuessTheNumber.py | UTF-8 | 454 | 3.765625 | 4 | [] | no_license | from random import *
screetNumber=randint(1,20)
#Ask user to enter the number
for guessNumber in range(1,6) :
print("Guess the number ",end=':')
value=int(input())
if(value > screetNumber) :
print("Your number is too high :"+str(value))
elif(value<screetNumber) :
print("Your number is too low :"+str(value))... | true |
f56156d0c8d5f0b9c52d6fcb2ad7148762186a51 | daianasousa/Semana-09 | /cidades.py | UTF-8 | 384 | 2.703125 | 3 | [
"MIT"
] | permissive | def carrega_cidades():
resultado = []
with open('cidades.csv', 'r', encoding='utf-8') as arquivo:
for linha in arquivo:
uf, ibge, nome, dia, mes, pop = linha.split(';')
resultado.append(
(uf, int(ibge), nome, int(dia), int(mes), int(pop))
)
arquivo... | true |
611a4a2097a3ed0831d7589495db0d21cb4f2b36 | BenDoan/playground | /python/multiproc_test.py | UTF-8 | 320 | 2.65625 | 3 | [
"MIT"
] | permissive | import requests
import time
from multiprocessing import Pool
def download_google(t):
print("downloading cnn")
time.sleep(1)
page = requests.get("http://cnn.com").text
time.sleep(1)
return {"name": "cnn", "text": page}
pool = Pool(8)
results = pool.map(download_google, range(50))
print(results)
| true |
ce49000ff9fee85fe44ebdaf339f2c3ae1c34fb7 | jrumsey/collegeprojects | /CollegeProjects/jrumsey-algorithms/jrumsey-algorithmanalysis-e5c9da126483/quicksort1.py | UTF-8 | 855 | 3.71875 | 4 | [] | no_license | import random
import math
#array = [];
array = [10, 9, 8, 7, 6, 1, 4, 3, 2, 5]
def quicksort1(low, high):
if(high > low):
pivotpoint = 5
partition(low, high, pivotpoint)
print array
# quicksort1(low, pivotpoint - 1)
# quicksort1(pivotpoint + 1, high)
def partition(low, high, pivotpoint):
... | true |
0c3c6e3b8100fb0c55ca27d91aa010df4b5a0360 | navkant/ds_algo_practice | /scaler/heaps/max_heap.py | UTF-8 | 2,093 | 3.953125 | 4 | [] | no_license | class MaxHeap:
def __init__(self):
self.heap = list()
def percolate_up(self):
n = len(self.heap)
i = n-1
while self.heap[(i-1)//2] < self.heap[i] and i > 0:
self.heap[(i - 1) // 2], self.heap[i] = self.heap[i], self.heap[(i-1)//2]
i = (i-1) // 2
def... | true |
43e461b71c8bcf879ba380f8bada847cbd4cea74 | divanshu79/GeeksForGeeks-solutions | /Permutations of a given string.py | UTF-8 | 249 | 3.40625 | 3 | [] | no_license | import itertools
for _ in range(int(input())):
n = input()
n = sorted(n)
ans = ''
for p in itertools.permutations(n):
k = p
for i in range(len(k)):
ans += k[i]
ans += " "
print(ans) | true |
7599295da496deafab15d54f759d982bbf9fcdbd | jaynedu/transfer | /dan/experiments.py | UTF-8 | 4,205 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Date : 2020/9/22 9:30
# @Author : Du Jing
# @FileName: experiments
# ---- Description ----
import os
import math
import torch
import torch.nn
import torch.nn.functional as F
from torch.autograd import Variable
from dan.data_loader import loader
from dan import models
os.environ["CUDA_... | true |
0a35b55903fa1363210564868329e2b208246a66 | ajvcorreia/CryptoTicker | /ldn-bus-ticker/ldn-bus-ticker.py | UTF-8 | 1,432 | 2.8125 | 3 | [] | no_license | # London Bus arrivals ticker
# Ismail Uddin, 2015
# www.scienceexposure.com
from TfLAPI import *
import Adafruit_CharLCD as LCD
from Adafruit_CharLCD import Adafruit_CharLCD
import time
import sys
bSC = sys.argv[1]
lcd = Adafruit_CharLCD()
lcd.begin(20,4)
lcd.clear()
lcd.message('Initialising... | true |
ba747665fa227c65345c6be5e7a3e403b7724c03 | XIEJD/mySolutions | /Experiments/binsort.py | UTF-8 | 5,516 | 3.203125 | 3 | [] | no_license | #-*- coding:utf-8 -*-
'''
Data structure and algorithms for sorting problem.
Include:
bin sort - For fas_r.py use only.
Author:
ExcitedX
Date:
2016.12.26
'''
class bins :
'''
Bins
- for the use of the algorithm presented in fas.py, this may be a little different ... | true |
2de7e1510b0174e7aa5684e44c02bb60d637eb33 | MarkNahabedian/GoTournamentUtilities | /aga_roster.py | UTF-8 | 3,854 | 2.984375 | 3 | [] | no_license | # Representation of the contents of https://www.usgo.org/ratings/TDListA.txt
import abc
import csv
import datetime
import math
import rank
import urllib.request
from rank import Rank
AGA_MEMBER_FILE_URI = 'https://www.usgo.org/ratings/TDListA.txt'
AGA_MEMBER_FILE_NAME = 'TDListA.txt'
def fetch_aga_membership_file(... | true |
c4700d2a55834aa597345f39473325e670b44cbd | Coder2cdb/leetcode | /solution.py | UTF-8 | 17,255 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@version: v1.0
@author: caiminchao
@mail: cmc930726@163.com
@software: PyCharm,python 2.7
@file: test
@time: 2019/5/23 20:51
"""
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
# leetcode1
def... | true |
d2b58f25968676f4122b3e97d838755ed9218c6e | rajeshsvv/Lenovo_Back | /1 PYTHON/9 PYTHON PROGRAMS/PYTHON PROGRAMS NOUS/5_Guru(regex and unit test logging here)/untitest.py | UTF-8 | 2,241 | 4.125 | 4 | [] | no_license | '''
Unit Testing in Python – Unittest
What is Unit Testing?
Unit Testing is the first level of software testing where the smallest testable parts of a software are tested.
This is used to validate that each unit of the software performs as designed.
The unittest test framework is python’s xUnit style framework.
Metho... | true |
75be56c1e8f15d03bdd9906db0507bdd94cfeadb | uwcms/FinalStateAnalysis | /MetaData/python/data_styles.py | UTF-8 | 2,940 | 2.515625 | 3 | [] | no_license | '''
Define styles for the different data samples.
The keys correspond to "logical" samples, defined in data_name_map of
datadefs.py
The values are dictionaries, which can be passed as kwargs to objects which
inherit from rootpy Plottable
http://ndawe.github.com/rootpy/reference/rootpy.plotting.html#rootpy.plotting... | true |
c3f5f42f6683c2e043b3cfe7af405512713767b9 | empratts/poehelper | /inventory.py | UTF-8 | 8,175 | 2.984375 | 3 | [] | no_license | """
Inventory module maintains a current picture of the players inventory, including worn gear
-This module will parse the JSON responses from the API module to update the inventory on zone change
-Parse the character on all zone changes
-Parse the stash tabs on leaving a town zone (even if it is to... | true |
465f1cd4a120ea566b997856ecf70df1b0b469b7 | zihuan-yan/Something | /Algorithms/RadixSort/__init__.py | UTF-8 | 1,527 | 3.875 | 4 | [
"Unlicense"
] | permissive |
class RadixSort(object):
@classmethod
def sort(cls, arr):
_max_digit = cls._get_max_digit(arr)
return cls._sort(arr, _max_digit)
@classmethod
def _get_max_digit(cls, arr):
max_element = cls._get_max_element(arr)
return cls._get_element_length(max_element)
@sta... | true |
d09f174f03b858aa259a5391b21be829cff95ab9 | scpyork/Comtrade_parse | /concat_h5.py | UTF-8 | 1,399 | 2.609375 | 3 | [] | no_license | '''
A program to merge all h5files into one long one.
'''
import json,re,h5py,glob,sys
import numpy as np
import pandas as pd
files = glob.glob('data/COMTRADE*.hdf5')
files.sort()
columns = False
open_hf = [h5py.File(f,mode='r') for f in files]
columns = list(open_hf[0])
writehf = h5py.File('combined_comtrade.hdf5'... | true |
f0e606d233577458ac61eae5438a294c4c37805d | eashanadhikarla/congestion-control-bbrv2 | /bostdtn-10G.py | UTF-8 | 27,559 | 2.6875 | 3 | [] | no_license | """
BOST-DTN ANALYSIS
1. ALL HOSTS
2. ESNET HOSTS
3. NON-ESNET HOSTS
"""
import os
import json
import csv
import numpy as np
import warnings
from pathlib import Path
warnings.filterwarnings("ignore")
rootdir = "/Users/eashan22/Desktop/Internship 2021/bbrv2/Brian's Project/"
def _filereader(path, verbose=False):
... | true |
9fd9fc0c90680dc2d7ab04e3420105a65d277575 | jphacks/F_2004 | /src/api/concentration_value.py | UTF-8 | 7,162 | 2.53125 | 3 | [
"MIT"
] | permissive | import datetime
from distutils.util import strtobool
from flask import Blueprint, jsonify, request
from sqlalchemy import desc
import requests
from src.model import *
import src.predict as predict
api = Blueprint("api_concentration_value", __name__)
@api.route("/concentration_values/<int:user_id>", methods=["GET"... | true |
ba77f008ccd81107461a42b6f5e32697c47fced1 | zhoupengzu/PythonPractice | /Practice/practice29.py | UTF-8 | 546 | 4.125 | 4 | [] | no_license | # 可变参数练习
a1 = [1, 2, 3, 4]
a2 = [5,4,2,1,3]
def mutable_params(*args):
print(args)
print(*args)
print(type(args))
mutable_params(a1) # ([1, 2, 3, 4],)
mutable_params(*a1) # (1, 2, 3, 4)
mutable_params([1,2,3,'hahahh'])
mutable_params(a1, a2) # ([1, 2, 3, 4], [5, 4, 2, 1, 3])
mutable_params(*a1, *a2)... | true |
b1674944b078f01ba53ae7c31809f527967b3105 | radhikascs/python-data-science-examples | /demoloop.py | UTF-8 | 397 | 3.921875 | 4 | [] | no_license | #count = 0
#while count<=5:
# print(count)
# count+=1;
# Prints out 1,2,3,4
#for i in range(1, 10):
# if(i%5==0):
# break
# print(i)
#else:
# print("this is not printed because for loop is terminated because of break but not due to failure in condition")
#prints out numbers 0,1,2,3,4
for x in ... | true |
8bd9e41343de0dc8abfefa15ae02f74239818179 | MrBorisov/algorithm_hw- | /task_4.py | UTF-8 | 3,928 | 3.59375 | 4 | [] | no_license | """
Задание 4.
Для этой задачи:
1) придумайте 1-3 решения (желательно хотя бы два)
2) оцените сложность каждого решения в нотации О-большое
3) сделайте вывод, какое решение эффективнее и почему
Примечание:
Без выполнения пунктов 2 и 3 задание считается нерешенным. Пункты 2 и 3 можно выполнить
через строки документаци... | true |
39b99068d2eeae287b91faf330f118f07a770e1b | AryaLakshay/SequenceLabeling | /new.py | UTF-8 | 3,816 | 2.890625 | 3 | [] | no_license | import csv
import os
import pycrfsuite
def baseline():
parentElement = []
labels = []
filedir = "/Users/lakshayarya/Desktop/NLP Ass-3/labeled data";
for root, dirs, files in os.walk(filedir):
for file in files:
if file.endswith(".csv"):
f = open(root + "//" + file... | true |
e304d6d064394af24dd19e65c005c9df4932ef4d | mhs10031990/Xgboost_project | /q01_myXGBoost/build.py | UTF-8 | 1,706 | 2.890625 | 3 | [] | no_license | # %load q01_myXGBoost/build.py
import pandas as pd
from xgboost import XGBClassifier
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import accuracy_score
from unittest import TestCase
from inspect import getargspec
# load data
dataset = pd.rea... | true |
0eee1ebb5737212d394fc163fe3e059d7aef9193 | kutukmu/ML-assignment-1 | /Main.py | UTF-8 | 2,223 | 3.4375 | 3 | [] | no_license | from Node import Node
class Main:
def __init__(self):
self.open = []
self.goal = self.getGoal()
self.start = self.getStart()
self.counter = 0
def getGoal(self):
return [
['0', '1', '2'],
['3', '4', '5'],
['6', '7', '8']
]
... | true |
a30e096ff61556972466f066901d08f43b95bd3a | lmb633/leetcode | /239maxSlidingWindow.py | UTF-8 | 800 | 3.25 | 3 | [] | no_license | from collections import deque
class Solution(object):
def maxSlidingWindow(self, nums, k):
len_nums = len(nums)
if len_nums == 0 or k == 0:
return []
dq = deque()
result = []
for i in range(k):
while dq and nums[dq[-1]] <= nums[i]:
... | true |
20f36b0d27778f7776f792a9b11c634ee5eaabc3 | huyaoyu/numpy_2_pointcloud | /scripts/QuaternionHelpers.py | UTF-8 | 376 | 2.8125 | 3 | [] | no_license | import numpy as np
def find_quaternion_between_vectors( v0, v1 ):
"""
v0, v1 are numpy arrays.
"""
a = np.cross( v0, v1 )
n0 = np.linalg.norm( v0, 2 )
n1 = np.linalg.norm( v1, 2 )
w = np.sqrt( n0**2 * n1**2 ) + v0.transpose().dot( v1 )
q = np.array( ( a[0], a[1], a[2], w ), dtype=np... | true |
f24f4dd1d01d80a762cdbd9911342ddc5fa96bb5 | PozzettiAndrea/Armageddon-ODE-Solver | /example.py | UTF-8 | 1,797 | 2.9375 | 3 | [
"MIT"
] | permissive | import armageddon
#######################
### Airburst Solver ###
#######################
# Initialise the Planet class
earth = armageddon.Planet(atmos_func='exponential')
# Solve the atmospheric entry problem (for something similar to Chelyabinsk).
result = earth.solve_atmospheric_entry(radius=10, angle=20,
... | true |
39b3dfbfde54695d0fa5f1e406b70f724e526ae2 | thecrimsoncoder/WhatsUp | /WhatsUp.py | UTF-8 | 1,798 | 2.84375 | 3 | [
"MIT"
] | permissive | import ipaddress
import os
import subprocess
from colorama import init
init();
def START():
print("+-------------------------------------+")
print("| W H A T S U P . P Y |")
print("| By: Sean McElhare (TheCrimsonCoder) |")
print("+-------------------------------------+")
... | true |
988392709655db9a31d0defed530a5a9aa8157a1 | jaromrax/shspe | /pytest.py | UTF-8 | 1,338 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python3
import ROOT
from array import array
LEN=200
# define double array?
x,c = array('d'), array( 'd' )
for i in range( LEN ):
x.append(i )
c.append(i+100)
filename="pytest_TGraph.root"
print("T... create .root file with graph TEST:", filename)
f=ROOT.TFile( filename,"recreate")
gc=ROOT.TGrap... | true |
b9cd7da7719766625f2550200c12bca6c2e67f3c | yigarashi-9/SystemF | /main.py | UTF-8 | 556 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import subprocess
from eval import typing
from eval import execute
def driver_loop():
while(1):
try:
expr = input("> ")
(res, ty) = execute.systemf_eval(expr)
print("{0} :: {1}".format(ty, res))
except subprocess.CalledProcessError as err:... | true |
79b21bae1be725f2857fd0abe2fb429be6d2fbb8 | itmoura/fetin | /thread2.py | UTF-8 | 4,953 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# coding: utf-8
import threading
import time
from manipulation import Manipulation
from test import Test
from voice import Voice
from open import Open
exitFlag = 0
controller = Manipulation("db")
test = Test()
voice = Voice()
bcom = "command"
bcar = "car"
bt = "teach"
cad = 0
class myThread (... | true |
69a666223a3394c913255f2aac98abe7b08e669d | DK2K00/100DaysOfCode | /d9_queue.py | UTF-8 | 447 | 3.609375 | 4 | [
"MIT"
] | permissive | class queue():
def __init__(self):
self.items = []
def enqueue(self, item):
return self.items.insert(0, item)
def dequeue(self):
return self.items.pop()
def length(self):
return len(self.items)
def IsEmpty(self):
return self.items == []
q = queue... | true |
aa58f1456893cab83cf6548ee12dfeb07a02821c | robcmills/robcmills | /jade/code/copy-page.py | UTF-8 | 1,721 | 2.578125 | 3 | [] | no_license | def copy_model(model, attrs={}):
model.pk = None
model.id = None
model.save()
for attr in attrs:
setattr(model, attr, attrs[attr])
model.save()
return model
def copy_page(page, parent=None, attrs={}):
'''copy page, children, and all related models recursively
and set provide... | true |
e25d7064a2b8fa4fed3949b39b5eb23177af9f19 | wbcustc/ruby_example | /scrapers/uncommons_scraper.py | UTF-8 | 4,407 | 2.6875 | 3 | [] | no_license | import io
import itertools as IT
import json
import re
import requests
import time
import xml.etree.ElementTree as ET
from HTMLParser import HTMLParser
from datetime import datetime
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
def handle_data(self, d):
se... | true |
840d2a365f5bccea789411f8d5e20c72a4a096f5 | wanjunhong0/GHCN | /baseline/utils.py | UTF-8 | 2,975 | 3.0625 | 3 | [] | no_license | import torch
class EarlyStopping:
"""Early stops the training if validation metrics doesn't improve after a given patience."""
def __init__(self, patience=10, mode='min', delta=0, path='checkpoint.pt'):
"""
Args:
patience (int): How long to wait after last time validation improved.... | true |
cb4234bed4f04f4ace20ce1f2909fb2dcf6cefe4 | karina-gm/machine-learning-ipn | /review/Predict.py | UTF-8 | 270 | 3 | 3 | [] | no_license | x1 = [1, 3, 1, 0]
x2 = [2, 2, 0, 1]
x3 = [3, 1, 1, 1]
import numpy as np
X = np.array([
x1,
x2,
x3,
]).T
y = [1, 2, 3, 4]
from sklearn.linear_model import LinearRegression
reg = LinearRegression()
reg.fit(X, y)
print(reg.score(X, y))
print(reg.coef_) | true |
670dc9dc29b5c7a753af003f31d9c021dfc541ae | Agarwal-Anchal/PYTHON-OOP | /LEARNING/4.StaticInstanceMethod.py | UTF-8 | 340 | 3.578125 | 4 | [] | no_license | class Employee:
def employeeDetails(self):
self.name='Ben'
#have to pass and dont want to use it anywhere in the function
#Make it static
@staticmethod
def welcomeMsg():
print("Welcome here!")
employee=Employee()
employee.employeeDetails()
print(employee.name)
emp... | true |
c56158ae0c034bd091fd6c485d85c513f8b4c2b3 | analyticahouse/GoogleSearchConsole-Tutorial | /file_manip.py | UTF-8 | 6,161 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
'''
@author: Jean-Christophe Chouinard.
@role: Sr. SEO Specialist at SEEK.com.au
@website: jcchouinard.com
@LinkedIn: linkedin.com/in/jeanchristophechouinard/
@Twitter: twitter.com/@ChouinardJC
Learn Python for SEO
jcchouinard.com/python-for-seo
Get API Keys
jcchouinard.com/how-to... | true |
37eaff28024d22eeb8f14484c2a742d44e81b460 | floscha/featurefilter | /tests/spark-backend/test_spark_na_filter.py | UTF-8 | 1,343 | 2.796875 | 3 | [
"MIT"
] | permissive | import unittest
import databricks.koalas as ks
import numpy as np
from featurefilter import NaFilter
def test_fit_returns_none():
train_df = ks.DataFrame({'A': [0, np.nan, np.nan],
'B': [0, 0, np.nan]})
na_filter = NaFilter()
return_value = na_filter.fit(train_df)
asse... | true |
e3b253627f5795c6cb8516283560405620f0734d | venkatsvpr/Problems_Solved | /LC_Sum_of_Root_to_Leaf_Binary_Number.py | UTF-8 | 1,462 | 3.921875 | 4 | [] | no_license | """
1022. Sum of Root To Leaf Binary Numbers
Given a binary tree, each node has value 0 or 1. Each root-to-leaf path represents a binary number starting with the most significant bit. For example, if the path is 0 -> 1 -> 1 -> 0 -> 1, then this could represent 01101 in binary, which is 13.
For all leaves in the tre... | true |
6414dc13b7e4f92e507df28f33957130da2d82fb | balonovatereza/Pyladies-repository | /03/pokus1.py | UTF-8 | 151 | 3.421875 | 3 | [] | no_license | from math import sin
import math
x = sin(1) # (v radiánech)
print(x)
print(1, "dvě", False)
print(1, end=" ")
print(2, 3, 4, sep=", ")
help(math)
| true |
482354e005d68f6f92303899644f9187b242d35d | ndanielsen/yellowbrick | /yellowbrick/regressor/residuals.py | UTF-8 | 28,557 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | # yellowbrick.regressor.residuals
# Regressor visualizers that score residuals: prediction vs. actual data.
#
# Author: Rebecca Bilbro
# Author: Benjamin Bengfort
# Created: Fri Jun 03 10:30:36 2016 -0700
#
# Copyright (C) 2016 The scikit-yb developers
# For license information, see LICENSE.txt
#
# ID: residuals.p... | true |
5901182dde67dad51e43cf1118f8da175bab0db5 | Ritikajain18/Problem-Solving | /Staircase.py | UTF-8 | 534 | 3.875 | 4 | [] | no_license | '''
Consider a staircase of size n :
#
##
###
####
Observe that its base and height are both equal to n, and the image is
drawn using # symbols and spaces. The last line is not preceded by any spaces.
Write a program that prints a staircase of size n .'''
import math
import os
import random
impo... | true |
85ccc9a690828448eae34fb1e4ac2e61c0e69720 | geeeeeeeek/NNStudy | /demo_train/utils.py | UTF-8 | 1,177 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
def compute_cross_entropy_with_softmax():
y = tf.constant([[1.0, 2.0], [0.2, 1.0], [0.0, 1.0]])
y_ = tf.constant([[0, 1], [1, 0], [1, 0]])
# logits labels shape must be--> [batch_size, num_classes]
cros... | true |
49b529e6f2ae901d27a89f24225376a8beb25ac4 | ninoseki/uzen | /tests/utils/test_network.py | UTF-8 | 1,092 | 2.546875 | 3 | [
"MIT"
] | permissive | import socket
from typing import Optional
import pytest
import vcr
from _pytest.monkeypatch import MonkeyPatch
from app.utils.network import (
get_asn_by_ip_address,
get_hostname_from_url,
get_ip_address_by_hostname,
)
@vcr.use_cassette("tests/fixtures/vcr_cassettes/ip_address.yaml")
@pytest.mark.asynci... | true |
f2f6a4e8972c9d61a9e1938033e8314d6fb2e8dc | zhongpei0820/LeetCode-Solution | /Python/100-199/152_Maximum_Product_Subarray.py | UTF-8 | 849 | 3.28125 | 3 | [] | no_license | #
#Find the contiguous subarray within an array (containing at least one number) which has the largest product.
#
#
#
#For example, given the array [2,3,-2,4],
#the contiguous subarray [2,3] has the largest product = 6.
#
class Solution(object):
def maxProduct(self, nums):
"""
:type nums:... | true |
fd7544db81e30e5f2f56e61a6f70e856d4b9e820 | jiajiabin/python_study | /day01-10/day05/周末作业/2_判断质数.py | UTF-8 | 504 | 3.890625 | 4 | [] | no_license | # 封装一个功能,判定一个数是不是质数【只能被1和本身整除】
def prime(a):
j = 0
if 1 < a <= 2:
print("是质数")
if a == 1:
print("1既不是质数也不是合数")
elif a > 2:
for i in range(2, a):
if a % i == 0:
j += 1
if j:
print("不是质数")
else:
print("是质数")
el... | true |
012cad1f825f313da04bb941ab273a6e17dc45d0 | RishikaGarg19/NOvid-20 | /Covid19 Predictor.py | UTF-8 | 2,323 | 2.5625 | 3 | [] | no_license |
import pandas as pd
import numpy as np
import pickle
# In[7]:
df = pd.read_csv(r'C:\Users\vividha\Desktop\Datasets\covid19 dataset\Cleaned-Data.csv')
df.tail()
# In[10]:
# In[16]:
df.shape
# In[45]:
# In[20]:
df.dtypes
# In[24]:
df['Severity'] = (df.iloc[:, 19:23] == 1).idxmax(1)
# In[27]:
... | true |
c593844482c6c1e382b980121da9fb6bda6bd43b | JoseDRamirezM/IO_1 | /Metodo de las dos fases/dos-fases final/archivo.py | UTF-8 | 3,026 | 3.375 | 3 | [] | no_license | from problema import Problema
class Archivo:
#lee el archivo de entrada
@staticmethod
def leer_archivo(file_name):
try:
file = open(file_name, 'r')
line_count = 0
method = -1
objective = ""
restriccions_array = []
matrix = []
... | true |
e1424dc055d66d25336abcc3d7191c8280a3ebfa | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_200/1261.py | UTF-8 | 356 | 3.34375 | 3 | [] | no_license | n = int(input())
i = 0
while i < n:
i += 1
num = input()
a = [int(x) for x in list(num)]
for j in reversed(range(len(num) - 1)):
if a[j + 1] < a[j]:
a[j] -= 1
for k in range(j+1, len(a)):
a[k] = 9
a = int(''.join([str(x) for x in a]))
print... | true |
ffdc0418af5c40f083096eb3c8cf20aaac359b31 | Tim-Nosco/timsat2 | /test.py | UTF-8 | 4,594 | 3 | 3 | [] | no_license | from interpret import Parser
from util import Assignment, AssignmentStack, Variable, Literal, Clause
from solver import Solver
import unittest
class TestStack(unittest.TestCase):
def test_assignment(self):
v = Variable("1")
s = AssignmentStack()
a = Assignment(1,v,True,Clause(Literal(v)))
... | true |
d649d42b3d68e2ac8cc57c02ac3f2c269aa2c414 | mingweihe/leetcode | /_1370_Increasing_Decreasing_String.py | UTF-8 | 581 | 3.15625 | 3 | [] | no_license | from collections import Counter
class Solution(object):
def sortString(self, s):
"""
:type s: str
:rtype: str
"""
cnt = Counter(s)
res = []
keys = sorted(cnt.keys())
while len(res) != len(s):
for k in keys:
if cnt[k] > 0:
... | true |
3c8e5539e62c8a26806f4ca9802b4e8bd58e5d92 | ish/dataish | /dataish/wrapper.py | UTF-8 | 2,178 | 2.875 | 3 | [] | no_license | import logging as log
log.basicConfig(level=log.DEBUG,)
def reduce_keylevel(d):
for k, v in d:
segments = k.split('.')
d['.'.join(segments[1:])] = v
return d
class Wrapper(object):
def __init__(self, dict, wrap_children=True, class_register=None,**k):
self.__subject__ = ... | true |
ad4708870a282295b786ab7aa8b13c943ea7a3b5 | e9485111/coding | /Combination_Sum_III.py | UTF-8 | 588 | 3.140625 | 3 | [] | no_license | class Solution(object):
def combinationSum3(self, k, n):
"""
:type k: int
:type n: int
:rtype: List[List[int]]
"""
return self.helper(k, n, 0, [])
def helper(self, k, n, last, res):
if k == 0 and n == 0:
return [res[:]]
else:
... | true |
5e438794a19197ff67e358807a48db54dc6fa834 | sathishkumarusk/py4e | /ex_4.6.py | UTF-8 | 260 | 3.515625 | 4 | [] | no_license | def computepay(h, r):
if h < 40:
hrs = h * r
return hrs
elif h > 40 :
hrs = (40*r)+(h-40)*1.5*r
return hrs
hour=input('Enter the hours ')
rate=input('Enter the rate')
h=int(hour)
r=float(rate)
pay=computepay(h, r)
print(pay) | true |
4c1f7df4d8aeab15bf74822a5540d648c8d4a1bf | samrullo/deep-learning-from-scratch | /practice/layers.py | UTF-8 | 1,469 | 2.65625 | 3 | [
"MIT"
] | permissive | import numpy as np
from practice.activation import softmax
from practice.loss_functions import cross_entrpy_error
class Relu:
def __init__(self):
self.mask = None
def forward(self, x):
self.mask = (x <= 0)
out = x.copy()
out[self.mask] = 0
return out
def backward(... | true |
9d47393c09fe1098fbe39292246ff3637b6f5813 | jgutman/Refugee | /refugee preprocessing 43015.py | UTF-8 | 8,217 | 2.765625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import os
import datetime
from sklearn import preprocessing
from matplotlib import pyplot as plt
# Large dataset, this line can take a little bit of time to run (about 30 seconds)
raw_data = pd.read_csv(os.getcwd() + '/asylum_clean_chicago_eoirstrictconsec3_1.csv', low_memory=F... | true |
12b0bc1099acfa0b24fb905e5b7d43227ab74fef | itzura/data-structure_algorithms | /Linear_Structures/Stack/postfixeval.py | UTF-8 | 671 | 3.53125 | 4 | [] | no_license | from stackimplement import Stack
def postfixEval(postfixexp):
operandstack = Stack()
tokenlist = postfixexp.split()
for token in tokenlist:
if token in "0123456789":
operandstack.push(token)
else:
operand2 = operandstack.pop()
operand1 = operandstack.pop... | true |
66b3b15d3df5ff94ec37c919f6a846ad88094ab2 | bekesibeks/rnn-python | /test.py | UTF-8 | 909 | 3.46875 | 3 | [] | no_license | import numpy as np
matrix1 = np.random.randn(5, 5)
for i in range(len(matrix1)):
for j in range(len(matrix1[0])):
matrix1[i][j] = i+j
matrix2 = np.random.randn(5, 5)
for i in range(len(matrix2)):
for j in range(len(matrix2[0])):
matrix2[i][j] = 2
matrix3 = np.random.randn(5, 5... | true |
3d51e8683cc6e9ed9f96308ab7bd53c4bc06777c | abradbury/FPGA-Implementation-of-Flocking-Birds | /Python-Simulation/simulation.py | UTF-8 | 46,519 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
# To ignore numpy errors and docstrings:
# pylint: disable=E1101
# pylint: disable=C0111
from boidCPU import BoidCPU # Import the BoidCPU class
from boidGPU import BoidGPU # Import the BoidGPU class
import logging # Used to handle... | true |
9d584197101e3b9676bf9d9b5f5c3d6bc0ece3d2 | vlrod/asprobe | /pyprobe/works.py | UTF-8 | 1,727 | 2.515625 | 3 | [] | no_license | import logging
import multiprocessing
from multiprocessing import Process
import time
from cloudServer import CloudServer
from thirdparty.Ping import quiet_ping
from thirdparty.Singleton import Singleton
@Singleton
class Works:
def __init__(self):
self.processes = []
self.is_running = False
... | true |
aa8653e80a3425e25367cff3310f5f79fce308ce | caicloud/katib | /pkg/suggestion/v1alpha3/advisor/algorithm/grid_search_test.py | UTF-8 | 2,228 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import json
from django.test import TestCase
from suggestion.models import Study
from suggestion.models import Trial
from suggestion.algorithm.grid_search import GridSearchAlgorithm
class GridSearchAlgorithmTest(TestCase):
def setUp(self):
study_configuration_json = {
"goal":
"MAXIMIZE",
... | true |
f71f07a3ac6c1471a927d3ff31dc6cd256cbe01f | ivansangines/Deep-Learning | /Assignment1_Sangines/PythonExamples/StudentsGrades/Student.py | UTF-8 | 736 | 3.375 | 3 | [] | no_license | class Student(object):
"""description of class"""
def __init__(self, firstName, lastName, id):
self.firstName = firstName
self.lastName = lastName
self.id = id
self.test = [] #initially empty, filling it up with students.txt
self.grade = ""
def addTestScore (self... | true |
bf324b5a621280ecbdef5b4e73976b315d5659a1 | badadivyareddy/B-divya | /s2_18.py | UTF-8 | 154 | 3.078125 | 3 | [] | no_license | n1=int(input())
n2=int(input())
for num in range(n1,n2+1):
sum=0
temp=num
while temp=0:
dig=temp%10
sum+=digit**3
temp=temp//10
if num==sum:
print(num)
| true |
ecf5eb90486e0f7fde191a3fcf78831a642619a9 | rahulon001/python_programs | /IPSegmentNubres.py | UTF-8 | 494 | 4.03125 | 4 | [] | no_license |
def ipNumberSegments(ip):
segment, segment_length, character = 1, 0, ''
for character in ip:
if character == '.':
print("Segment {} contains {} characters". format(segment, segment_length))
segment += 1
segment_length = 0
else:
segment_length += 1... | true |
631e1778e07c520335feb63f95516f46706fe0ff | zmvmarina/online-survey | /online_survey/models.py | UTF-8 | 2,504 | 2.59375 | 3 | [] | no_license |
# from flask_login import LoginManager
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import Column, Integer, String, Boolean, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Text
from .database import B... | true |
788c2dc15fefbfe59e1039dbdbb6fe6440db6586 | ngglasgow/biophys_glm_show | /coherence.py | UTF-8 | 12,133 | 2.84375 | 3 | [
"MIT"
] | permissive | import os
import pandas as pd
import scipy.io as sio
import set_paths
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.colors import Normalize
import seaborn as sns
import conversions
from colors import bluered10
# set paths
home_dir = os.path.expanduser("~")
project_dir = ... | true |
5235d7c1830d18816997d48f0a9e3c74b5b0fe9f | berkistayn/NN_tests | /sample_classify/train_best.py | UTF-8 | 4,077 | 2.828125 | 3 | [] | no_license | from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten
from tensorflow.keras.layers import Conv2D, MaxPooling2D
# more info on callbakcs: https://keras.io/callbacks/ model saver is cool too.
from tensorflow.keras.callbacks import TensorBoard, EarlyStopping... | true |
eaca2c68a004fc5331abab64cde62a2d3d7afed2 | loreleivillatte/Grandpy_project_7 | /py_bot/test.py | UTF-8 | 1,518 | 2.90625 | 3 | [] | no_license | import unittest
from unittest.mock import Mock, patch
import requests
from py_bot.views import app
from py_bot.utils import get_map, format_response, get_section
class TestApp(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
def test_status_code(self):
response = self.app.get... | true |
6265c8f8cb57cc87a109cbbc46eef343968504d3 | mapler/cook | /models.py | UTF-8 | 1,737 | 2.84375 | 3 | [] | no_license | import json
from typing import NamedTuple, List, Optional
class Ingredient:
def __init__(self, iid, name, image, unit=None):
self.iid = iid
self.name = name
self.image = image
self.unit = unit
with open('./data/ingredient.json') as f:
ingredients = {data['iid']: Ingredient(*... | true |
da15b22ba387d4ad40f9403d683b9deb09f67bba | MichaelAuditore/holbertonschool-higher_level_programming | /0x11-python-network_1/8-json_api.py | UTF-8 | 557 | 3.28125 | 3 | [] | no_license | #!/usr/bin/python3
"""Script to do a POST request to an URL
and print the value passed as parameter into a dictionary
"""
if __name__ == "__main__":
import sys
import requests
send = {'q': ""}
if (len(sys.argv) > 1):
send['q'] = sys.argv[1]
r = requests.post("http://0.0.0.0:5000/search_user... | true |
1c902393b686ca84a0d177b9e279aaaf60a4f352 | lamine2000/jeu_du_pendu | /fonctions.py | UTF-8 | 1,265 | 2.953125 | 3 | [] | no_license | from os import system, name
from pickle import Pickler, Unpickler
def affiche(nbVies, mot, motAffiche, listeTentatives):
chaine = str()
trouve = True
for elt in mot:
if elt in listeTentatives:
chaine += elt
else:
chaine += '*'
trouve = False
if len... | true |
bd4b97f7939b15998129b257480b6ea5c85b39f7 | Snehal-610/Python_Set | /set4/dbu_program002.py | UTF-8 | 937 | 4.28125 | 4 | [] | no_license | #!/user/bin/python
# -*- coding: utf-8 -*-
# program002 :
# Write a program which can compute the factorial of a given numbers.
# The results should be printed in a comma-separated sequence on a single line.
# Suppose the following input is supplied to the program:
# 8
# Then, the output should be:
# 40320
# Hints:... | true |
816eeafe102833a6927b85813a82f9fa3a67306b | phatcatmatt/python | /blinkrandom.py | UTF-8 | 567 | 3.015625 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
import sys
import random
pin1 = int(sys.argv[1])
pin2 = int(sys.argv[2])
pin1Val = False
pin2Val = False
GPIO.setmode(GPIO.BCM)
GPIO.setup(pin1, GPIO.OUT)
GPIO.setup(pin2, GPIO.OUT)
print("blinking on", pin1, pin2)
while True:
pin = random.randint(pin1,pin2)
if pin == pin... | true |
fd4c0fe4758555c34f09fcd5626fad37be4cb8ec | ivasilyev/curated_projects | /meta/scripts/filter_plasmid_assembly_by_chromosome.py | UTF-8 | 2,916 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from Bio import SeqIO
class ArgParser:
def __init__(self):
from argparse import ArgumentParser
parser = ArgumentParser(description="Tool to remove from the plasmid nucleotide assembly the sequences which "
... | true |
4aee8460e900b36467ee1b4e5ee4e15c8ed9b767 | vicda164/LOTR_family | /train.py | UTF-8 | 6,190 | 2.671875 | 3 | [] | no_license | import ast
import os
import random
from collections import defaultdict
import numpy as np
import spacy
import filemanager
def create_train_data():
training_set = [] #np.empty((1000, 5))
nlp = spacy.load("en_core_web_sm")
#list of existing names in LOTR
names = filemanager.lotr_char_names()
... | true |
5f9cc94ac2cd2e7183efd79a74d31941ee41cdb7 | yousefmasry4/programming-competitions | /sections/s2/c1.py | UTF-8 | 641 | 3.09375 | 3 | [] | no_license | from sys import stdin, stdout
import math
def set():
return stdin.readline()
def get(data):
stdout.write(str(data))
def p(num: int):
return all(num % i != 0 for i in range(2, int(math.sqrt(num)) + 1))
def main(arr, len_arr):
if(len(arr) == 5):
return
helper = [i for i in range(len_ar... | true |
bb189ecf57b1f1434dd356240b1352e4a3d21905 | Mela2014/lc_punch | /lc90_bk.py | UTF-8 | 398 | 2.671875 | 3 | [] | no_license | class Solution:
def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:
nums.sort()
rslt = []
def backtracking(temp, i):
rslt.append(temp)
for j, num in enumerate(nums[i:]):
if j == 0 or num != nums[j+i-1]:
backtracking(temp+[... | true |
010927888ada1b1955962ccc126827d77624ae68 | jancaaa/advent-of-code2020 | /day24/day24.py | UTF-8 | 1,934 | 3.84375 | 4 | [] | no_license | import collections
def read_file(file: str) -> (list, list):
with open(file) as fp:
line = fp.readline().rstrip()
input = []
while line:
line = line.replace("e", "e ").replace("w", "w ").strip()
line = line.split(" ")
input.append(line)
line... | true |
ef30dbfc6479207f4de8b2af81d909ce2a738422 | writetoSelftag/Skeet-Shooting | /skeetgame.py | UTF-8 | 20,570 | 2.6875 | 3 | [] | no_license | import pygame, sys, eztext, platform
from pygame.locals import *
from pygame.math import Vector2
import math
from leaderboard import *
from physics import *
import time as systime
### Definitions ###
## constants ##
PI = math.pi
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
BLUE = (0, 0, 255)
LIGHTBLUE = (150, 150, 255)
... | true |
0052ee78926d2cb5c3c5701d7f1bee0d2c33c6f5 | buxx/synergine_lifegame | /synergine_lifegame/PlotTerminal.py | UTF-8 | 815 | 2.96875 | 3 | [] | no_license | from synergine.core.connection.Terminal import Terminal
import matplotlib.pyplot as plt
class PlotTerminal(Terminal):
"""
A very simple Terminal to see how many cells are alive in plot.
"""
def __init__(self, config, context, synergy_manager):
super().__init__(config, context, synergy_manager... | true |
db28b6f39bc498c3a66f11b4e20192afbdb80324 | Geguowei/SeleniumPython | /case/fourth_case.py | UTF-8 | 803 | 2.609375 | 3 | [] | no_license | '''
BeautifulReport.py测试报告,未搞成功
'''
#coding=utf-8
from BeautifulReport import BeautifulReport
import unittest
from second_case import Second
import os
import time
current_path = os.getcwd()
report_path = os.path.join(current_path, "Report")
now = time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))
... | true |
d32a677a07c7b2dcdeabcf8739247f17ab3d1f46 | New-Be-Maker/Introduction-to-Python | /Part2_Small Projects/Codes/power_distribution.py | UTF-8 | 2,781 | 3.078125 | 3 | [] | no_license | # _*_ coding: utf-8 _*_
"""
Party power distribution index
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This exercise is similar to population world map. However, we need to deal with more problems in this
exercise. Some country names are not matched with pygal standard COUNTRIES。
:presenter: by Yifeng
"""
import j... | true |
1ae43509deb4be24dd621729e0a3ed58ca856ec8 | harkabeeparolus/kodkalender-2020 | /dag_15.py | UTF-8 | 773 | 3.640625 | 4 | [
"MIT"
] | permissive | #! /usr/bin/env python3
"""Unga programmerare kodkalender 2020, lucka 15."""
# https://ungaprogrammerare.se/kodkalender/lucka-15/
import string
def shift_letter(letter: str, amount: int) -> str:
"""Shift a letter forward in the alphabet by a certain amount."""
sv_alfabet = string.ascii_lowercase + "åäö"
... | true |
c81769f421c85b140e0630b1c96830cf5f96bae0 | pstuvwx/squib | /squib/updaters/supervised.py | UTF-8 | 2,363 | 2.59375 | 3 | [
"MIT"
] | permissive | from typing import Callable, Dict, Union
import torch
import torch.nn as nn
from torch import Tensor
from torch.nn import Module
from torch.optim import Optimizer
from squib.functions.evaluation import accuracy
class SupervisedUpdater():
def __init__(self, model :Module,
o... | true |
085f05d5ca9ef0d72d04d791df9f0454e26d8aa5 | JakeRoggenbuck/jai | /jai/logger.py | UTF-8 | 885 | 3.3125 | 3 | [
"MIT"
] | permissive | from enum import Enum
from termcolor import colored
class Severity(Enum):
Info = 0
Debug = 1
Warning = 2
Error = 3
Fatal = 4
Raw = 5
def log(message: str, severity: Severity):
# Print only the raw message
if severity == Severity.Raw:
print(message)
return
# Add t... | true |
09e40fb71cb86ff04c5b0ac0895b37e1e326788b | jcalderon6305/Rumor-Spreading | /python/syntheticGraphTrials.py | UTF-8 | 2,129 | 2.640625 | 3 | [] | no_license | import buildGraph
import infectionModels
import random
import scipy.io as io
import numpy as np
if __name__ == "__main__":
##---------- Synthetic Graphs ---------------#
num_nodes_range = range(10,661,50)
p_reached_smallworld = []
p_reached_scalefree = []
for num_nodes in num_nodes_ra... | true |