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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a87a53d14f5c43d7caee46a3cc263c2a422fe6b9 | Python | fraunhofer-iais/dlplatform | /DLplatform/dataprovisioning/datasource.py | UTF-8 | 840 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | from DLplatform.baseClass import baseClass
from abc import ABCMeta
class DataSource(baseClass):
'''
Super class of the different dataset-dependent data source classes.
'''
__metaclass__ = ABCMeta
def __init__(self, name = "DataSource"):
'''
Returns
-------
None
... | true |
a0afe7259d2e1cbba45be8b6fef7427d5744bad3 | Python | frank081/trophy-scraper | /scraper.py | UTF-8 | 2,696 | 2.921875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup, element
from datetime import datetime
import dateutil.parser
import sys #for exceptions
from trophy import trophy
#username = input("Enter username. ")
url = "https://psnprofiles.com/trophies/483-burnout-paradise/roughdawg4?trophies=earned"
#url = "https://psnprofiles.com... | true |
9054e6acdbb0689d20eca6225affe84eb7835c8c | Python | xsank/cabbird | /leetcode/regular_expression_matching.py | UTF-8 | 329 | 3.09375 | 3 | [] | no_license | def isMatch(s, p):
index = 0
length = len(s)
while index < length:
if __name__ == "__main__":
print(isMatch("aa", "a"))
print(isMatch("aa", "aa"))
print(isMatch("aaa", "aa"))
print(isMatch("aa", "a*"))
print(isMatch("aa", ".*"))
print(isMatch("ab", ".*"))
print(isMatch("aab", "... | true |
278e7e06627842bbea80166d7c41bdfea378a648 | Python | McClain-Thiel/comp-photo | /Proj3/corrospondance.py | UTF-8 | 713 | 2.5625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import sys
import os
import pandas as pd
if __name__ == '__main__':
im_1_path, im_2_path, num_clicks, save_path = sys.argv[1], sys.argv[2], int(sys.argv[3]), sys.argv[4]
print(im_1_path, im_2_path, num_clicks)
im1, im2 = plt.imread(im_1_path), plt.imread(im_2_pat... | true |
e98edeacdd8b6f46d3ab283b1892e5eb41829a35 | Python | laiananardi/100daysofcode | /courses/python_scrimba/18WhileLoops/index.py | UTF-8 | 252 | 3.796875 | 4 | [
"MIT"
] | permissive | i=0
while i < 5:
i+=1
print(f"{i}."+ "*"*i + "Loops are awesome" + "*"*i)
# Three Loop Questions:
#1. What do I want to repeat?
# -> message
#2. What do I want to change each time?
# -> stars
#3. How long should we repeat?
# -> 5 times
| true |
7a2775bd2b46784461154cb2bd84da3b2be2ab76 | Python | edadoko/Recommendation-System | /nearestNeighborClassifier.py | UTF-8 | 4,767 | 3.359375 | 3 | [] | no_license | #
# Nearest Neighbor Classifier
class Classifier:
def __init__(self, f, dataset):
self.medianAndDeviation = []
lines = dataset
self.format = f
self.data = []
for row in dataset:
ignore = []
vector = []
for i in range(len(row)):
... | true |
92827b8413528fbfd7e77c4564500540fa42fd6d | Python | frankfragano/csc280 | /p1.py | UTF-8 | 241 | 3.328125 | 3 | [] | no_license | def main():
dof = ["Tuesday","Wednesday","Friday"]
today_variable = input("What day of the week is it today?")
if today_variable = dof
print("Today you have class")
else
print("Today you do not have class")
if __name__=="__main__":
main() | true |
7b64c793175e1f88d72e876575e5a4f746386640 | Python | zubekj/meta-learning-evaluation | /src/experiments_real_data/generate_minmax_subsets.py | UTF-8 | 1,878 | 2.515625 | 3 | [] | no_license | import sys
import math
from matplotlib import pyplot
from matplotlib.backends.backend_pdf import PdfPages
import Orange
import pycallgraph
sys.path.append('../')
from utils.distribution import *
#from utils.cSimilarity import *
#LEARN_SUBSETS = [1 - math.log(x, 11) for x in xrange(10, 0, -1)] # Log scale
LEARN_SUBS... | true |
e183b1c128c8a52453a4b285db18366bb09415a9 | Python | mshekhar/random-algs | /epi_solutions/arrays/combination-sum-ii.py | UTF-8 | 1,056 | 3.171875 | 3 | [] | no_license | class Solution(object):
def backtrack(self, nums, res, ele_list, start, target):
if target == 0:
res.append(ele_list[:])
if target < 0:
return
i = start
while i < len(nums):
if i > start and nums[i] == nums[i - 1]:
# print 'skipping... | true |
6b62eb0fd2ac1d0a5b12d8938c74dda1448d6344 | Python | MikeMangione/nim_game | /nim_game.py | UTF-8 | 9,474 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
#coding=utf-8
#cool opening text from the site below
#http://patorjk.com/software/taag/#p=display&f=Graffiti&t=Type%20Something%20
import string
import random
import time
import sys
def print_rules():
print '\n'
time.sleep(0.1)
print '\n'
time.sleep(0.1)
print ' ▄██████▄ ... | true |
af77473a2c42cdf90fdb342e9a7534d6369d37bc | Python | jetavator/jetavator | /features/steps/schema_registry.py | UTF-8 | 2,172 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import datetime
import yaml
import os
import pprint
from behave import given, when, then
def schema_registry_value(context, column, entity_type, entity_name):
return context.jetavator.sql_query_single_value(
f"""
SELECT {column}
FROM [jetavator].[objects]
WHERE type = '{entity_typ... | true |
f308f1d74dd96a76c9f33d7eaf9dce95a2f1af7a | Python | GiacomoPinardi/project-euler | /problem0097.py | UTF-8 | 613 | 3.609375 | 4 | [] | no_license | # www.github.com/GiacomoPinardi/project-euler
# The first known prime found to exceed one million digits was discovered in 1999,
# and is a Mersenne prime of the form 26972593-1; it contains exactly 2,098,960 digits.
# Subsequently other Mersenne primes, of the form 2p-1, have been found which contain more digits.
# ... | true |
7a7c786b65c07715a685442d88c3fcb393afa7c6 | Python | NielsHeltner/iot-assignment-1 | /led_latency/device1/main.py | UTF-8 | 576 | 2.953125 | 3 | [] | no_license | import pycom
import time
def on():
pycom.rgbled(0x007f00) #green
def off():
pycom.rgbled(0x000000)
commands = {
'on': on,
'off': off
}
def dispatch(command):
try:
commands[command]()
print('Command \'' + command + '\' dispatched')
except KeyError:
print('Command ... | true |
1fa2d97fa73c2549189641d2861a9d708609fb51 | Python | Faust223/python- | /基础一/06-切片.py | UTF-8 | 329 | 3.625 | 4 | [] | no_license | list1 = ['age',1,23.3,True]
# 切片:[a:b:c] 取值范围:a-b(不包含b)c代表步长
print(list1[0:3:2])
msg = "helloword"
print(msg[0:6:3])
# 分段赋值
a,b,c,d = 3,3,4,3
print(a,b,c,d)
# 连续等式
f1 = f2 = f3 = f4 = 12
print(f1,f2,f3,f4)
# pass关键字
if 5>3:
pass
| true |
e8264eccdd38ba51f20149315496adb85c9d2569 | Python | anubhavshrimal/CompetitiveProgrammingInPython | /HackerRank/World_CodeSprint9/weightedUniformStrings.py | UTF-8 | 346 | 3.453125 | 3 | [] | no_license |
string = list(input())
sets = set({})
count = 1
for i in range(len(string)):
if i > 0 and string[i] == string[i-1]:
count += 1
else:
count = 1
sets.add((ord(string[i]) % 96) * count)
n = int(input())
for i in range(n):
num = int(input())
if num in sets:
print("Yes")
... | true |
78fe5259ca33192734ed71171191661926a4523f | Python | MauricioLucas/CloudThermometer | /Scripts/aws-delete-rows.py | UTF-8 | 1,382 | 3.265625 | 3 | [
"MIT"
] | permissive | # Python script to delete all rows with a given Id value.
import boto.dynamodb
import boto.dynamodb.condition as condition
# Modify the values below to set your AWS region and access keys:
# Set this to the AWS region, for example 'us-west-2', 'us-east-1', etc.
REGION = 'us-east-1'
# Copy your AWS access key value b... | true |
bd7cbb61f6bd187e1e819ff260a5bdf712cb978d | Python | Donner886/dataplay_server | /dataplay/session/__init__.py | UTF-8 | 1,140 | 2.703125 | 3 | [] | no_license | from .redisSession import RedisSessionInterface
__all__ = (
"RedisSessionInterface",
"Session",
)
class Session:
def __init__(self, app=None, interface=None):
self.interface = None
if app:
self.init_app(app, interface)
def init_app(self, app, interface):
self.inte... | true |
2d2e78b29f18ed1428f3b4d793b29944589e7455 | Python | rolandproud/pyechoplot | /pyechoplot/plotting.py | UTF-8 | 3,834 | 2.671875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
.. :module:: plotting
:synopsis: plotting functions
| Developed by: Roland Proud (RP) <rp43@st-andrews.ac.uk>
| Pelagic Ecology Research Group, University of St Andrews
| Contributors:
|
| Maintained by:
| Modification History:
|
"""
import matplotlib as mpl
import ... | true |
5dc8e3833e1908b3cbab2f41a83879e2274668e8 | Python | Licko0909/LOGO | /bgi/common/genebank_utils.py | UTF-8 | 35,414 | 4.125 | 4 | [] | no_license | import numpy as np
import pandas as pd
def multi_value_binary_search(chr_gff: np.ndarray,
low_value: int,
high_value: int,
current_index: int = -1):
"""
二分查找, 给定(low,high)二值, 在列表(starts, ends)中查找。
例如:
# 100 2... | true |
b6a841c00381f9e92885ceabc94692358f593938 | Python | bobisjan/django-shanghai | /tests/integration/actions/linked.py | UTF-8 | 8,078 | 2.546875 | 3 | [
"MIT"
] | permissive | from tests.test_cases import TestCase
class GetLinkedTestCase(TestCase):
def test_app_should_respond_with_not_found_for_non_existing_link(self):
response = self.client.get('/api/articles/4/links/categ')
self.assertEqual(response.status_code, 404)
class GetLinkedBelongsToTestCase(TestCase):
... | true |
dfded543417f6e68be1940841267461b74b44a9a | Python | sarveshgpt1991/Spoj | /CRSCNTRY.py | UTF-8 | 721 | 2.9375 | 3 | [] | no_license | def LCSLength(X, Y):
C = []
m = X.__len__()
n = Y.__len__()
C = [[0 for i in range(m+1)] for j in range(n+1)]
for i in range(1, m+1):
for j in range(1, n+1):
if (X[i-1] == Y[j-1]):
C[j][i] = C[j-1][i-1]+1
else:
C[j][i] = max(C[j-1][i], ... | true |
202d5ee7bf4a92de783bf3f007514a0eca281076 | Python | gjtjdtn201/practice | /유용한 스킬/BFS.py | UTF-8 | 605 | 3.703125 | 4 | [] | no_license | graph={
1:[2,3],
2:[1,4,5,7],
3:[1,5,9],
4:[2,6],
5:[2,3,7,8],
6:[4],
7:[5,2],
8:[5],
9:[3],
}
def BFS(graph,root):
visited = []
queue = [root]
while queue: #while queue is not empty
n = queue.pop(0)
if n not in visited: #if n is not in visited list.... | true |
9fe94f5c558876284bd49529fc9b04c6d08f4039 | Python | santhoshkumarml/Temporal-Opinion-Spam-Detection | /SpamDetection/anomaly_detection/MyCusum.py | UTF-8 | 1,559 | 2.578125 | 3 | [] | no_license | '''
@author: santhosh
'''
import numpy
def run_cusum(data, threshold,magnitude=0.5):
nS, pS= [0 for i in range(len(data)+1)], [0 for i in range(len(data)+1)]
nG, pG= [0 for i in range(len(data)+1)], [0 for i in range(len(data)+1)]
start = 0
changes = []
magnitude = float(magnitude)
threshold =... | true |
494113d2800c3ea91adc18ca7331a26157a22f45 | Python | 181REB281/RTR105 | /tests.py | UTF-8 | 424 | 3.234375 | 3 | [] | no_license | #print(vars())
import sys
sys.path.append('/usr/local/anaconda3/lib/python3.6/site-packages')
#print(vars())
from numpy import cos, sin, linspace
#print(vars())
x = linspace (0, 4, 11)
y = cos(x)
y2 = sin(x)
print(vars())
from matplotlib import pyplot as plt
plt.grid()
plt.xlabel('x')
plt.ylabel('f(x)')
plt.title(... | true |
d407f3d16e52a9afa3b067effde8480310d45512 | Python | heyuhhh/ACM | /contests/2018GCPC/coolestskiroute/submissions/accepted/heliskiing-moritz.py | UTF-8 | 831 | 3.078125 | 3 | [] | no_license | from collections import defaultdict
n,m = map(int, raw_input().split(" "))
g = defaultdict(lambda : defaultdict(lambda: -1))
source = 0
sink = n+1
# Add source and sink
indeg = [0 for i in range(0, n+2)]
outdeg = [0 for i in range(0, n+2)]
for _ in range(m):
start, end, dist = map(int, raw_input().split(" "))
if ... | true |
56c1ba85f167fa5556d011b5833aeff60faf4283 | Python | DHBern/TT2016 | /examplescripts/TT3_lessthan.py | UTF-8 | 187 | 3.953125 | 4 | [] | no_license | allnumbers = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
num = int(input("Choose a number: "))
new_list = []
for item in allnumbers:
if item < num:
new_list.append(item)
print(new_list) | true |
a532f33a6ab3f34b50a8d735fbb0276179d9d53f | Python | abderrahmanesaad/python-climb-learning-tutorial | /python-tips-and-tricks/Visualizing-Bitcoin/main.py | UTF-8 | 569 | 2.59375 | 3 | [] | no_license | import pandas_datareader as web
import matplotlib.pyplot as plt
import mplfinance as mpf
import datetime as dt
crypto = "BTC"
currency = "USD"
start = dt.datetime(2020,1,1)
end = dt.datetime.now()
btc = web.DataReader(f"{crypto}-{currency}", "yahoo", start, end)
eth = web.DataReader(f"ETH-{currency}", "yahoo", star... | true |
287653f1717805c9ffdec2f793e06b0ebcc3c85b | Python | antondelchev/Data-Types-and-Variables---Lab | /01. Concat Names.py | UTF-8 | 103 | 3.234375 | 3 | [] | no_license | name_one = input()
name_two = input()
delimiter = input()
print(name_one + delimiter + name_two)
| true |
076255db8c5f6dafbac999280dbed8433dbc30a0 | Python | sefrota/pythonstuff | /challenges/pinetree.py | UTF-8 | 455 | 3.796875 | 4 | [] | no_license | # How tall is the tree: 5
#
###
#####
#######
#########
#
height = input("How tal is the tree: ")
height = int(height)
spaces = height - 1
hashes = 1
stump_spaces = height - 1
while height != 0:
for i in range(spaces):
print(' ', end="")
for i in range(hashes):
print("#"... | true |
138001e7a8086fa07f7ae491555c82795511d74a | Python | geniousisme/leetCode | /Python/48-rotateMatrix.py | UTF-8 | 2,090 | 3.984375 | 4 | [] | no_license | class Solution:
# @param matrix, a list of lists of integers
# @return nothing (void), do not return anything, modify matrix in-place instead.
def juniorRotate(self, matrix):
rotated_matrix = []
length = len(matrix[0])
for j in xrange(length):
reversed_column = [matrix[i]... | true |
7bd727dcd8ce27964989ebd03080a91fb04c1c75 | Python | herafatmawati/Python_Projects_Protek | /Praktikum 08/Python Project 5.py | UTF-8 | 110 | 3.109375 | 3 | [] | no_license | def kuadrat(bil):
kuadrat=list(map(lambda x:x*x,bil))
print(kuadrat)
bil= [2,4,5,6]
kuadrat(bil)
| true |
0962663b56ef3f0ef54b542649cbc825e7208941 | Python | abd96/MoodleBot | /Bot_v3.py | UTF-8 | 11,575 | 2.640625 | 3 | [] | no_license | import urllib.request
import base64
import json as js
from bs4 import BeautifulSoup as bs
import os
import sys
import requests
from requests import session
import re
import time
import datetime
import getpass
"""-------------------------------------------------------------------------------------------------------... | true |
eac400006ba35cb97295ff6d748e4400f81aa5b5 | Python | sherlockhomeless/master_simulation | /visualization/log_parser.py | UTF-8 | 1,639 | 2.859375 | 3 | [] | no_license | from dataclasses import dataclass
from typing import List
class LogParser:
def __init__(self, log_path):
self.log_path = log_path
log_f = open(log_path, 'r')
self.lines_log = log_f.readlines()
log_f.close()
self.tick_events: List[TickEvent] = []
def read_log(self):
... | true |
40a632d6938db7e7c09573eb423a5e171ffb6d86 | Python | ManjulaGandhi/qiskit-terra | /test/python/circuit/library/adders/test_classicaladd.py | UTF-8 | 3,243 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | true |
7d47406ce1da342ee51c8ab733d95f1036f6e4a8 | Python | Mica210/python_michael | /Mid-Course_Exercises/Targil3.py | UTF-8 | 214 | 4.0625 | 4 | [] | no_license | '''
Write a Python program which accepts the user's first and last name
and print them in reverse order with a space between them.
'''
name=(input("Enter your full name: "))
print(name)
print(' '.join(name[::-1])) | true |
8213279d05bdf2b6de457d224119cc02927c5d89 | Python | GhazanfarShahbaz/interviewPrep | /array_and_string/one_three.py | UTF-8 | 606 | 4 | 4 | [] | no_license | """Challenge : 1.3 Urlify
Description: Write a method to replace all the spaces in the in a string with '%20'. You may assume that the string has sufficient space st the end to hold the additional characters, and that you are given the true length of the string."""
def urlify(string: str, length: int):
newString ... | true |
256d8aad51f28c1ebc9d1cd250f1db27bc3a90e1 | Python | kausthubtm/Advanced-Compilers | /mycgf.py | UTF-8 | 1,730 | 3.03125 | 3 | [] | no_license | import json
import sys
from collections import OrderedDict
TERMINATORS = 'jmp', 'br', 'ret'
def form_blocks(body):
cur_block = []
for instr in body:
if 'op' in instr:
cur_block.append(instr)
# check for terminator
if instr['op'] in TERMINATORS:
yie... | true |
7f4163949baf36672b0842f3eec6d5329d5f64ab | Python | inwe-boku/wind-repowering-usa | /tests/test_util.py | UTF-8 | 675 | 2.734375 | 3 | [
"MIT"
] | permissive | import numpy as np
import xarray as xr
from wind_repower_usa.load_data import load_turbines
from wind_repower_usa.util import turbine_locations, quantile
def test_turbine_locations():
turbines = load_turbines()
locations = turbine_locations(turbines)
assert locations.shape == (turbines.sizes['turbines'], ... | true |
3831303fb5deefc61fb5a9235509804902119506 | Python | Borda/BIRL | /bm_dataset/create_real_synth_dataset.py | UTF-8 | 12,360 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | """
Script for generating synthetic datasets from a single image and landmarks.
The output is set of geometrical deformed images with also change color space
and related computed new landmarks.
Sample run::
python create_real_synth_dataset.py \
-i ../data-images/images/Rat-Kidney_HE.jpg \
-l ../da... | true |
bb84e73e3f8ecc9142ebff8e7d58f12297d8a0cf | Python | Shawamri/Python-scraper-tutorial | /scraper.py | UTF-8 | 916 | 2.71875 | 3 | [
"MIT"
] | permissive | import requests
from bs4 import BeautifulSoup
proxy = {'http': 'http://SPusername:SPpassword@gate.smartproxy.com:7000'}
url = 'http://books.toscrape.com/catalogue/page-1.html'
r = requests.get(url, proxies=proxy)
html = BeautifulSoup(r.content, 'html.parser')
all_books = html.find_all('article', class_='pro... | true |
169c9e1a177200624c14efa80aeba6115f4bd94e | Python | TanakitInt/FSRCNN-anime | /prepare-data-sharpening.py | UTF-8 | 1,240 | 3.015625 | 3 | [
"MIT"
] | permissive | import sys
import os
import cv2
def sharpening(path):
for file in os.listdir(path):
img = cv2.imread(path + '/' + file)
# sharpening
blur_img = cv2.GaussianBlur(img, (0, 0), 5)
sharpened = cv2.addWeighted(img, 1.5, blur_img, -0.5, 0)
# denoising
denoise = cv2.fa... | true |
90558a14a456a7525e2638c336fc963e90a82fc5 | Python | ctb/boink | /boink/tests/test_hashing.py | UTF-8 | 1,954 | 2.734375 | 3 | [
"MIT"
] | permissive | # boink/tests/test_hashing.py
# Copyright (C) 2018 Camille Scott
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
import pytest
from boink.tests.utils import *
from boink.hashing import RollingHashShifter, UKHShifter, unik... | true |
228331e9ec6301e991acd31986aa4d2277b10fc2 | Python | zhoukai83/MachineLearning | /HousePrice/HousePrice.py | UTF-8 | 7,736 | 2.71875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import cross_validation
from sklearn import model_selection
from sklearn import ensemble
from sklearn import metrics
from sklearn import model_selection
from sklearn import preprocessing
from sklearn import linear_model
from sklearn im... | true |
d5f1712da8efade8cb835844299e719d7fdba9df | Python | Ferretsroq/Tales-of-Botseria | /boons.py | UTF-8 | 1,991 | 3.265625 | 3 | [] | no_license | import json
import random
import numpy as np
import discord
class Boon:
def __init__(self, name, data, rank):
self.name = name
self.data = data
self.formFactor = random.choice(self.data['Form Factor'])
self.rank = rank
self.effect = self.data['Ranks'][self.rank]
def __re... | true |
69d8c284d37b1e9028195e0502d130376068376f | Python | Alieff/os_mager | /samagak.py | UTF-8 | 1,100 | 2.78125 | 3 | [] | no_license | import sys
import re
from difflib import ndiff
class bcolors:
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
ENDC = '\033[0m'
# ----- color
DEFAULT = '\033[39m'
BLACK = '\033[30m'
RED = '\033[31m'
GREEN = '\033[32m'
YELLOW = '\033[33m'
BLUE = '\033[34m'
MAGENTA = '\033[35m'
CYAN = ... | true |
5896ca1f1b653bc31551c91a9a1712dc9c5e9fb6 | Python | Aasthaengg/IBMdataset | /Python_codes/p02948/s173240688.py | UTF-8 | 288 | 2.859375 | 3 | [] | no_license | import heapq
N, M = map(int, input().split())
AB = [[] for _ in range(10**5+10)]
for _ in range(N):
ta, tb = map(int, input().split())
AB[ta].append(-tb)
ans = 0
q = []
for i in range(1,M+1):
while AB[i]:
heapq.heappush(q, AB[i].pop())
if q:
ans += heapq.heappop(q)
print(-ans) | true |
e6ec7e576ca7b5e984cb1ea37477c15dd56e8d96 | Python | EParrish/PHYS-410 | /Homework 4/Problem3.py | UTF-8 | 5,850 | 2.828125 | 3 | [] | no_license | # import numpy as np
# from matplotlib import pyplot as plt
# row,col,data=np.loadtxt("noisyimage.txt",unpack=True)
# rsize = int(max(row))
# csize = int(max(col))
# data=np.array(data).reshape(rsize,csize)
# def neighbors(arr,x,y,n):
# ''' Given a 2D-array, returns an nxn array whose "center" element is arr[x,y]... | true |
061f54eec819f106e3ebcfad3f37116bc8877044 | Python | aikiyy/AtCoder | /abc058/c.py | UTF-8 | 180 | 2.859375 | 3 | [] | no_license | from collections import Counter
n = int(input())
s = Counter(input())
for _ in range(n-1):
s &= Counter(input())
ans = ''.join(sorted([k*v for k, v in s.items()]))
print(ans)
| true |
3078f9dfcbe0471ec29c4b08d52db3311be14dff | Python | AdidasOriginals/python-practice | /basic/test-011.py | UTF-8 | 8,497 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python
# _*_ coding: utf-8 _*_
# @Time : 2021/1/20 15:59
# @Author : Edison
# @Version:V 0.1
# @File : test-011.py
# @desc :文件和异常
print('读写文本文件'.center(50, '-'))
def main():
f = open('data/python.txt', 'r', encoding='utf-8')
print(f.read())
f.close()
main()
def main2():
f = None
... | true |
766d4e80103722d42bdbdb02a33e9df13df5fe13 | Python | Kostis-S-Z/mrcl_re | /util/plotter.py | UTF-8 | 1,690 | 2.96875 | 3 | [] | no_license | from sklearn.preprocessing import MinMaxScaler
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from datasets.synth_datasets import gen_tasks, gen_sine_data
def visualize(representation, save_name=None):
"""
Visualize the representation (weights) of a layer for omniglot ... | true |
449e910931f22aa99421a21103f68a67a1ada0f4 | Python | meniossin/src | /third_party/android_ndk/build/gen_cygpath.py | UTF-8 | 3,486 | 3.21875 | 3 | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | #
# Copyright (C) 2017 The Android Open Source Project
#
# 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 la... | true |
1de570d24e5aae9c6e8dfee5dbcc7ca8726f6ee7 | Python | JobsDong/leetcode | /problems/368.py | UTF-8 | 1,286 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = ['"wuyadong" <wuyadong311521@gmail.com>']
class Solution(object):
def largestDivisibleSubset(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
n = len(nums)
if n <= 1:
return nums
... | true |
7111bdf753d55b39df740768db6b38c5188157b4 | Python | skyxyz-lang/CS_Note | /leetcode/tree/code/404.py | UTF-8 | 854 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
@author: skyxyz-lang
@file: 404.py
@time: 2020/11/21 22:57
@source: https://leetcode-cn.com/problems/sum-of-left-leaves/
@desc: 左叶子之和
"""
from tree_node import TreeNode
class Solution(object):
"""
"""
def __init__(self):
self.lst = []
def sumOfLeft... | true |
ef7014584b91f892b1dc8558566673565529af20 | Python | YuriSpiridonov/CodeWars | /codewars-leaderboard.py | UTF-8 | 501 | 3.03125 | 3 | [] | no_license | # https://www.codewars.com/kata/codewars-leaderboard/train/python
import urllib.request, urllib.parse, urllib.error
import re
def get_leaderboard_honor():
url = 'https://www.codewars.com/users/leaderboard'
regex = re.compile(r'(\d{1,3})\,(\d{3})')
fhand = urllib.request.urlopen(url)
for line in fhand:... | true |
91431872fc912c43ef304523d6060fd846da34d1 | Python | corout/classroom | /crossin_qizhong_1.py | UTF-8 | 1,043 | 3.046875 | 3 | [] | no_license | f=open('d:/mystuff/report.txt')
f1=f.readlines()
f.close()
m=[]
#1 生成原始总列表
for x in f1:
m.append(x.split())
#2 插入学科平均分xkl一列,
xkl=['平均']
for i in range(1,10):
z1=0
for j in m[1:]:
z1+=int(j[i])
xkl.append(str(z1//30))
m.insert(1,xkl)
#3 计算所有列表的总分z,平均分z1
m[0].append('总分')
m[0].append('平均分')
for... | true |
0fcb51034f5650c4effe467a08bc493fc179e807 | Python | niuyaning/PythonProctice | /06/14/list_test.py | UTF-8 | 75 | 3.34375 | 3 | [] | no_license |
list = ['banbaa','orange','apple']
for i in list:
print("i like" +i ) | true |
d6b2171774848138be00815449e732c1743bd444 | Python | BrianQcq/LeetCode | /src/078_subset.py | UTF-8 | 479 | 3.375 | 3 | [] | no_license |
class Solution(object):
def subset(self, nums):
res = [[]]
for num in nums:
res += [i + [num] for i in res]
#print(res)
return res
A=Solution()
res=A.subset([1,2,3])
#print(res)
# DFS
class Sol(object):
def subset(self, nums):
res = []
self.dfs(nums, 0, [], res)
return res
def dfs(self, nums... | true |
d799b0b9006e7798ce08babbd4ab4da4a5e99930 | Python | Drust2/100Days | /Day 57 - Jinja/main.py | UTF-8 | 993 | 2.546875 | 3 | [] | no_license | cls = lambda: print("\033[2J\033[;H", end='')
cls()
"""
Day 56 - main
"""
import server
import requests
from flask import render_template
flask_server = server.Server()
app = flask_server.app
@app.route("/guess/<username>")
def guess_genderage(username):
name_response = requests.get(url=f"https://api.genderize.... | true |
9436d15600e8d494483f20b3e7afb22d7ab81c63 | Python | oalberto96/funcoin | /funcoin/chapter_2.py | UTF-8 | 330 | 3.109375 | 3 | [] | no_license | from hashlib import sha256
secret_phrase = "bolognese"
def get_hash_with_phrase(input_data, secret_phrase):
combined = input_data + secret_phrase
return sha256(combined.encode()).hexdigest()
email_body = "Hey Bob, I think you should learn about Blockchains! "
print(get_hash_with_phrase(email_body, secret_ph... | true |
85d46c17d907e1d24513bab83c4cb88bde087b65 | Python | ydmlife/ymutil | /async.py | UTF-8 | 598 | 3.109375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
'''
@author: miyao
@time: 2020/8/24
'''
import sys
from threading import Thread
from time import sleep
default_encoding = 'utf-8'
if sys.getdefaultencoding() != default_encoding:
reload(sys)
sys.setdefaultencoding(default_encoding)
def async(f):
def wrapper(*args, **kwargs):
... | true |
63032a3f7baf08fe2a4b3fefe48d4e416ab142da | Python | farhanirani/Algorithms | /Dynammic Programming/Sudoku-Solver-Backtracking.py | UTF-8 | 1,396 | 3.671875 | 4 | [] | no_license |
f = open('board.txt', 'r')
lines = f.readlines()
board = [[ int(n) for n in line.split() ] for line in lines ]
f.close()
def checkIfPlacingIsPossible(currentRow,currentCol,number):
gridRowNum = int( currentRow / 3)
gridColNum = int( currentCol / 3)
for r in range(9):
if board[r][currentCol] == nu... | true |
6e1788be632664ab4ad378802d85d79543639722 | Python | hwang-17/forpythonstudy | /practice41_1.py | UTF-8 | 477 | 3.71875 | 4 | [] | no_license | '''
1. 按照以下要求,定义一个类实现摄氏度到华氏度的转换
(转换公式:华氏度 = 摄氏度*1.8+32)zcZ"
this is practice is from fishc Forum
'''
class C2F(float):
def __new__(cls, arg=0.0): # 为什么这里arg要初始化为0.0 我试了不给arg赋值也能得到相同结果
return float.__new__(cls, arg*1.8 + 32)
print(C2F(32)) # 这里传进去的 明明不是一个浮点数啊,是int? 为什么程序不会报错。
| true |
7b81b930c1fc3d7e975c1789446b17613de80629 | Python | kidusasfaw/addiscoder_2016 | /labs/server_files/lab5/lis/lis.py | UTF-8 | 652 | 2.8125 | 3 | [] | no_license | import sys
def memlis(L, last, at, mem):
if at==len(L):
return 0
elif mem[last][at]!=-1:
return mem[last][at]
mem[last][at] = memlis(L, last, at+1, mem)
if L[at]>L[last]:
mem[last][at] = max(mem[last][at], 1 + memlis(L, at, at+1, mem))
return mem[last][at]
def lis(L):
m... | true |
55161a19e8eacb9123d4f91ec9a5194d29d64286 | Python | kellysan/oldboy | /homework/day05/练习4_红包.py | UTF-8 | 1,204 | 3.515625 | 4 | [
"Apache-2.0"
] | permissive | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# File Name: 练习4_红包
# Description :
# Author : SanYapeng
# date: 2019-05-01
# Change Activity: 2019-05-01:
import random
"""
基本单位 0.01 获取到的金额必须大于这个数,才能生效
金额和红包个数整除为基本数,那么金额就位0.01
第一个红包金额随机,但是必须得小于输入金额
"""
import random
# s... | true |
d270a09092de28a71bf6118e8800207cd11a9d2a | Python | c0ldwind/python-learning | /day2_列表,字典,集合/shopping1.py | UTF-8 | 989 | 3.53125 | 4 | [] | no_license | #!/usr/bin/env python
# *_* coding:utf-8 *_*
# python learning, keep on!
goods=[[1,'python',25],[2,'math',30],[3,'english',55],[4,'computer',37],[5,'music',78]]
salary=int(input('please input your salary:'))
shoppingcart=[]
print('our goods blow,please input no to add to your shopping cart')
for i in goods:
print... | true |
1cbad0310f5ffd263cb4946a1f882b8643a51a7d | Python | sungminoh/algorithms | /leetcode/solved/537_Complex_Number_Multiplication/solution.py | UTF-8 | 1,874 | 3.671875 | 4 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2020 sungminoh <smoh2044@gmail.com>
#
# Distributed under terms of the MIT license.
"""
A complex number can be represented as a string on the form "real+imaginaryi" where:
real is the real part and is an integer in the range [-100, 100]... | true |
40a43b3f3548ade850072462ac139b9f89530b00 | Python | teddyk251/alx-higher_level_programming-1 | /0x0C-python-almost_a_circle/models/base.py | UTF-8 | 2,373 | 3.609375 | 4 | [] | no_license | #!/usr/bin/python3
""" base: class Base """
import json
class Base:
"""
class Base
Attributes:
__nb_objects(int): number of objects
"""
__nb_objects = 0
def __init__(self, id=None):
"""
initializes all instances
"""
if id is not None:
... | true |
6f2236da6ce8b6a4bf702bd5350b5caaa2ce5321 | Python | wangyum/Anaconda | /lib/python2.7/site-packages/FuncDesigner/examples/uncertainties.py | UTF-8 | 1,574 | 3.21875 | 3 | [
"Python-2.0",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown"
] | permissive | '''
Example of getting uncertainties
Usage:
result = oofun.uncertainty(point, deviations, actionOnAbsentDeviations='warning')
point and deviations should be Python dicts of pairs (oovar, value_for_oovar)
actionOnAbsentDeviations =
'error' (raise FuncDesigner exception) |
'skip' (treat as fixed number with... | true |
bfe1c225f11bca754da630d9bc38205732bfcb6a | Python | sarthaksaini7/python | /learn33.py | UTF-8 | 202 | 3.84375 | 4 | [] | no_license | import random
for i in range(3):
number = random.randint(10, 20)
print(number)
for i in range(5):
members = ['John', 'Mary', 'Harry']
leader = random.choice(members)
print(leader)
| true |
f078134e7cb629e4f0151c3805af2e492816aed0 | Python | Shagiev222/test | /444444.py | UTF-8 | 1,055 | 3.234375 | 3 | [] | no_license | import pygame as pg
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
class Bone1:
w = h = 150
color = WHITE
x = 100
y = 100
border = 5
class Bone2:
w = h = 150
color = WHITE
x = 100+100
y = 100
border = 5
class Bone3:
w = h = 150
color = WHITE
... | true |
25e9a4579ac07d7e3eb5d71ee8c977f376c1029a | Python | redinton/ML_WHEEL | /metrics.py | UTF-8 | 2,299 | 2.9375 | 3 | [] | no_license |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, auc
from sklearn.metrics import roc_auc_score
from sklearn.metrics import recall_score
from sklearn.metrics import accuracy_score
from sklearn.metrics import f1_score
'''
from sklearn.ensemble import RandomForestClassifier
... | true |
cc0a9e24cd6c4e53afda5d34dc932f42302bf650 | Python | hjoad/edge-project | /project_1.py | UTF-8 | 2,325 | 3.84375 | 4 | [] | no_license | import random
lower_letters_list = "abcdefghijklmnopqrstuvwxyz"
upper_letters_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
# The user inputs their requirements (eg. # of letters and numbers, lowercase, etc.) as well as preferences (including a specific word) and the program will generate a password for them.
password = ""
le... | true |
7f617906a1c33901251052d51befd6e9fe1b3a8d | Python | kevinewing/python-challenge | /PyBank/main.py | UTF-8 | 1,470 | 3.15625 | 3 | [] | no_license | #PyBank/main.py
import os
import csv
months = 0
profit = 0
change_list = []
previousValue = 0
maxamt = 0
minamt = 0
csvpath = os.path.join("Resources", "budget_data.csv")
with open(csvpath, newline="") as csvfile:
csvreader = csv.reader(csvfile, delimiter=",")
csv_header = next(csvfile)
profit = 0
... | true |
2a3f3b520ef4a3ccacac69cc8874d94fd5a4dfdc | Python | harshitroy2605/memory_test_gui_game | /1.py | UTF-8 | 6,725 | 2.921875 | 3 | [] | no_license | import time
import threading
from tkinter import *
import random
import os
from PIL import Image, ImageTk
from tkinter import messagebox
class gameclass(Tk):
def __init__(self):
super().__init__()
self.geometry("850x600")
self.config(bg="white")
self.number=0
self.number_list=[]
self.random_character=""
... | true |
3ee9a3696e7434d6af13be090860e247eea3e3fa | Python | nanites2000/AdventOfCode | /2019/Day3/1.py | UTF-8 | 2,194 | 3.484375 | 3 | [] | no_license |
def go_up(start,distance):
"""
start is a 2 number list with x first and then y
"""
pointlist=[]
for i in range(distance):
pointlist.append((start[0],start[1] +i+1))
return pointlist
def go_down(start,distance):
"""
start is a 2 number list with x first and then y
"""
... | true |
497885926d2740121e99a7c479903fc3a17007f0 | Python | goalstrack/python-training-Day1 | /Day3/NumPy/flatten.py | UTF-8 | 187 | 3.625 | 4 | [] | no_license | import numpy as np
x=np.array([[12,34,65],
[32,11,77],
[78,44,23]])
print(x.flatten())#converts to 1d array
print(x.flatten(order='F'))#traverse column wise | true |
c999d2c330cb5ddcc426f635e700e40643eacfb4 | Python | msrini/instapi | /common/LFData.py | UTF-8 | 7,542 | 2.515625 | 3 | [] | no_license | import requests
import sys
from datetime import date
import json
from itertools import repeat
from bson.json_util import dumps
from common import ElasticClass
import pandas as pd
import numpy as np
import logging
'''
Get all Least fares for a city pair or a set of city pairs
Returns a list of city pair objects
'''
c... | true |
94431de2b72951adbcf7281f2e6e920fd07c6920 | Python | Chetan-verma713/python_program | /string_conversion.py | UTF-8 | 91 | 3.421875 | 3 | [] | no_license | t = (1, 2, 3, 4 ,5)
print("This is a tuple",t)
c = 'This is a tuple {}'.format(t)
print(c)
| true |
908843cf5df10ca7a41f4e2de98ac2da61605038 | Python | Gyufei/python-programming | /Queue队列.py | UTF-8 | 1,338 | 3.03125 | 3 | [] | no_license | # coding=utf-8
import time
import threading
from random import randint
from Queue import Queue
def ctime():
return time.strftime('%M:%S',time.localtime())
class lf(threading.Thread):
def __init__(self,func,args,name=''):
threading.Thread.__init__(self)
self.func=func
self.args=args
... | true |
3daba22ca8d2776059e315903f137a9adef8f251 | Python | liteng1995/spider_school_data | /不相信.py | UTF-8 | 4,499 | 2.515625 | 3 | [] | no_license | import requests
from requests import RequestException
from bs4 import BeautifulSoup, Comment
import urllib.request
import urllib.error
import re
from urllib import parse
import os
from posixpath import normpath
import urllib.parse
from lxml import etree
from retrying import retry
import pymysql
import datetime
import o... | true |
06c7cd9a75ff9650b366b2726d3f94f6ac8dc6c0 | Python | amarotta1/FinalDise-oDeSistemas | /Patrones/Visitor Figuras/Square.py | UTF-8 | 259 | 3.140625 | 3 | [] | no_license | from Figure import Figure
class Square():
def __init__(self,name,side):
self.name = name
self.side = side
def getSide(self):
return self.side
def accept(self,figureVisitor):
figureVisitor.visitSquare(self)
| true |
1a308a98cff3561f6ae1307ec7267eaaf734b880 | Python | TheEnjoy/Hyperskill | /Python/Problems/Difference of times/task.py | UTF-8 | 141 | 3.03125 | 3 | [
"MIT"
] | permissive | hour1, min1, sec1, hour2, min2, sec2 = (int(input()) for i in range(6))
print((hour2 - hour1) * 3600 + (min2 - min1) * 60 + (sec2 - sec1))
| true |
19f634e6217aeec117c4c559ac192bb553dd7d6e | Python | DinoSubbu/SmartEnergyManagementSystem | /backend/prices/prices_api.py | UTF-8 | 3,102 | 3.09375 | 3 | [
"MIT"
] | permissive | import requests
import xml.etree.ElementTree as ET
from datetime import datetime, timedelta
class PricesAPI():
def __init__(self, periodStartDateTime=None, in_Domain="10Y1001A1001A82H", out_Domain="10Y1001A1001A82H"):
""" inits prices request class """
# constants
self.API_KEY = "4... | true |
3f9cf19d43eab8255cc2b7809244c8600821fac2 | Python | tomergilor/Tomer_Project_Repo | /Exercises/untitled2/Functions.py | UTF-8 | 2,845 | 4.5625 | 5 | [] | no_license | # def helloWorld():
# print "Hello, World!"
#
# helloWorld()
#
#
# print "________________________________________________________________"
#
#
# def findMaximum (numberOne, numberTwo):
# if numberOne > numberTwo:
# return numberOne
# else:
# return numberTwo
#
# numberOne = 10
# numberTwo =... | true |
ec166330bf8f61261b14e0299d01c52d7155edeb | Python | felipovski/python-practice | /intro-data-science-python-coursera/curso1/semana7/exercicio2_retangulo2.py | UTF-8 | 460 | 3.546875 | 4 | [] | no_license | def desenha_retangulo():
largura = int(input("Indique a largura do retângulo: "))
altura = int(input("Indique a altura do retângulo: "))
i = j = 0
while i < altura:
while j < largura:
if((i == 0 or i == altura-1) or (j == 0 or j == largura-1)):
print("#", end="")
... | true |
fc30df32eb31816a66b78eeed3426db288d13fa3 | Python | tomybombtwtc/HousePrice2020 | /DealwithAdress.py | UTF-8 | 918 | 3.375 | 3 | [] | no_license |
def check_if_chinese(input_str):
chk_result = True
for ch in input_str:
if u'\u4e00' >= ch or ch >= u'\u9fff':
chk_result = False
return chk_result
testAddr = "台中市北屯區軍榮五街181~210號"
print("地號 position = ", testAddr.find("地號"))
print("Skip [地號] = ", testAddr[0:testAddr.index("地號... | true |
0ed606a73921728daece3e375be2595a93038a50 | Python | XiongminLin/my-toolkit-python | /encode_arithmetic.py | UTF-8 | 3,030 | 3.59375 | 4 | [] | no_license | #!/usr/bin/python
# coding:UTF-8
"""
encode_arithmetic.py: encode_arithmetic
//example:
$ python encode_arithmetic.py
Please input probabilities p1 p2 p3 ... seperated by a space
0.7 0.2 0.1
Please input source symbols index 1 2 3 for x1 x2 x3 ... seperated by a space
1 1 2
==============================
probabilitie... | true |
98f7cece4713f1a1589b01b0c5013738d32a9f91 | Python | dbrgn/projecteuler | /python/0003/3.py | UTF-8 | 218 | 3.0625 | 3 | [] | no_license | # BROKEN
import sys
from algorithms import getprimes
factors = []
n = int(sys.argv[1])
for prime in getprimes(int(sys.argv[1])):
if not n % prime:
factors.append(prime)
n = n / prime
print factors
| true |
2ba8b9146b4091a7e7d2e5472ae6eee07de5f01c | Python | OSCAAR/OSCAAR | /oscaar/extras/knownSystemParameters/getLatestParams.py | UTF-8 | 3,764 | 2.609375 | 3 | [
"MIT"
] | permissive | import numpy as np
import cPickle
import os
from glob import glob
from urllib import urlopen
import urllib2
import oscaar
from time import time
from os.path import getmtime
def internet_connected():
'''If internet connection is available, return True.'''
try:
response=urllib2.urlopen('http://www.googl... | true |
34569205f6f87cbbf286403f7b7b73c5c18aba41 | Python | azedlee/blogful | /blog/views.py | UTF-8 | 5,638 | 2.515625 | 3 | [] | no_license | from flask import render_template, request, redirect, url_for, flash
from flask.ext.login import login_user, login_required, current_user, logout_user
from werkzeug.security import check_password_hash
from werkzeug.exceptions import Forbidden
from . import app
from .database import session, Entry, User
# How many ent... | true |
734ffad74f602f3fba6ba03982acd8a8e51a4f8f | Python | peelssy/oxwall_testing2 | /value_models/status.py | UTF-8 | 773 | 2.9375 | 3 | [] | no_license | from value_models.user import User
from datetime import datetime
class Status:
def __init__(self, text="", user=None, photo_source=None):
self.text = text
self.user = user
self.photo_source = photo_source
self.time_created = datetime.now()
def __str__(self):
return 'St... | true |
7c842179df419b9fc6caa2a6154767635443e3ed | Python | goyalshaffi/acad-view | /assignment 7.py | UTF-8 | 855 | 3.828125 | 4 | [] | no_license |
# q1
r=float(input("enter radius"))
def fn(r):
area=3.14*r*r
return area
g=fn(r)
print(g)
# q2
n=6
def perfect(n):
sum=0
for i in range(1,n):
if(n%i==0):
sum=sum+i
if(sum==n):
return True
else:
return False
print(perfect(n))
for i in range(1,1001):
if... | true |
e6a597d59fad4c0a50faa5b4a887e637385a5663 | Python | BayLee001/gntp | /gntp/regularizers/projection.py | UTF-8 | 458 | 2.640625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import tensorflow as tf
def renorm_update(var_matrix, norm=1.0, axis=1):
row_norms = tf.sqrt(tf.reduce_sum(tf.square(var_matrix), axis=axis))
scaled = var_matrix * tf.expand_dims(norm / row_norms, axis=axis)
return var_matrix.assign(scaled)
def clip_update(var_matrix, lower_boun... | true |
8ac5ce7a978a15810f7cf107bce273bf5c172ef8 | Python | fxdx/WorldBankDataProcessing | /tests.py | UTF-8 | 1,982 | 2.671875 | 3 | [] | no_license | import unittest
import data
import xls_parse
import graph_plotting
class TestXLSParsing(unittest.TestCase):
def test_import_population1(self):
xls_parsing_object = xls_parse.XLSParsing('Aruba')
aruba_population = xls_parsing_object.import_country_population()
self.assertEqual(aruba_populat... | true |
cf15cad7d10eec6705e7bfb72f46a5fb0cfabc11 | Python | ElsevierSoftwareX/SOFTX-D-20-00024 | /machinebase.py | UTF-8 | 11,461 | 2.609375 | 3 | [
"MIT"
] | permissive | from functools import reduce
import pandas as pd
import glob
import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import IsolationForest
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklea... | true |
2dc0f83c2ed4968dc0ce8cfaa44bc57d79aa4bb9 | Python | Vincent-Vercruyssen/absent_pattern_detection | /anomaly_detection/kNNo.py | UTF-8 | 5,039 | 3.34375 | 3 | [
"Apache-2.0"
] | permissive | """ kNN based anomaly detection.
Reference:
S. Ramaswamy, R. Rastogi, and K. Shim. Efficient algorithms for mining outliers from large data sets.
In Proceedings of the 2000 ACM SIGMOD international conference on Management of data, vol. 29, no. 2. ACM, 2000, pp. 427–438.
"""
# Authors: Vincent Vercruyssen, 2... | true |
dd3c9649edd36b9ab0228c7097104b33c9a991ea | Python | Popine/smashRanking | /code/RankingFunctions.py | UTF-8 | 14,842 | 3.03125 | 3 | [] | no_license | # Challonge initialization
# "File 2"
import time
from urllib.request import urlopen
import smtplib
import xml.etree.ElementTree as ET
from RankingObjects import *
#from matches2 import *
# Takes tournament name (eg. edmmelee-vapebracket10201) and APIKey and returns a dictionary of participants
# and their local tour... | true |
f5cf5704919843a3a702594df8ad4f2e85f9392f | Python | pratikshete312/Python-project-7-Dictionaries-python-operators | /User input 1.py | UTF-8 | 86 | 3.1875 | 3 | [] | no_license | i=int(input("Inter the value for i"))
j=int(input("Inter the value for j"))
print(i+j) | true |
49b24311b6f997f483e39953e173e4c1ec62a591 | Python | buptweixin/Image_process | /readImg_backup.py | UTF-8 | 5,770 | 2.75 | 3 | [] | no_license | #encoding=utf-8
import struct
from math import ceil
import StringIO
import random
FORMAT_OFFSET = int('0',16)
SIZE_OFFSET = int('2',16)
DATA_OFFSET = int('0a', 16)
BISIZE_OFFSET = int('0e', 16)
WIDTH_OFFSET = int('12',16)
HEIGHT_OFFSET = int('16',16)
BPP_OFFSET = int('1c',16)
BIX = int('26', 16)
BICLR = int('2e', 16... | true |
7915a1c9abc162eb25b8919129926b8c65a77daa | Python | leolivares/leolivares | /Avanzada/Semana 13/estudio01/main.py | UTF-8 | 1,826 | 3 | 3 | [] | no_license | import pickle
import json
import clases
import os
def leer_jugadores(archivo):
jugadores = {}
with open(archivo, 'r') as file:
_jugadores = json.load(file)
for k, v in values.items():
_player = Player(k, None)
_player.update(**v)
jugadores[k] = _player
re... | true |