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
abb9f311d622c5d2c4bc78ee2d8bbff266e1bc5a
Valokoodari/advent-of-code
/2020/15.py
UTF-8
281
2.921875
3
[ "MIT" ]
permissive
ts = {int(n): i for i,n in enumerate(open("../inputs/2020/15.txt", "r").readline().split(","))} a1,l = 0,ts.popitem()[0] for i in range(len(ts), 30000000-1): a = i - ts[l] if l in ts else 0 ts[l],l = i,a if i+2 == 2020: a1 = a print("Part 1:", a1) print("Part 2:", l)
true
5b40002dfe2267e716c0f75c35869a510f22ec4e
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/223/users/4428/codes/1646_2450.py
UTF-8
54
3
3
[]
no_license
nome1 = input("Nome 1: ") nome2 = input("Nome 2: ")
true
86b0a4a374655211d2e3fe0d5c128eb739f576d2
yytambaya/ABU-Accommodation
/log.py
UTF-8
140
2.9375
3
[]
no_license
from datetime import datetime myFile = open('append.txt', 'a') myFile.write('\nAccessed on ' + str(datetime.now())) print("Text is written")
true
491989a43b15fe0dbb11c6e2c0d3d6c6d72ed734
huangjin520/PytorchBasic
/action_recog_with_function/cnnRec/c_Single_NN_Net.py
UTF-8
4,179
2.515625
3
[]
no_license
# !/usr/bin/python3 # -*- coding: utf-8 -*- """ @Author: 闫继龙 @Version: ?? @License: Apache Licence @CreateTime: 2020/12/23 19:26 @Describe: """ import math import torch import torch.nn as nn import numpy as np import torch.nn.functional as F from torchvision import models class MyDnn(nn.Module): def __init__(se...
true
198f817812803a30e72a5e8943beae05e6ac7b27
yamabook37/atcoder
/ABC_problems/abc149_c.py
UTF-8
265
3.4375
3
[]
no_license
x = int(input()) flag = 1 while True: if x == 2: break for i in range(3, x): #print("i is " + str(i)) if x % i == 0: flag = 0 break if flag == 1: break else: flag=1 x += 1 print(x)
true
fde6ffafa7b2b3e54a293bc63b0bdb1607e458ec
kivy/pyjnius
/tests/test_arraylist.py
UTF-8
1,023
3.203125
3
[ "MIT" ]
permissive
from __future__ import absolute_import import unittest from jnius import autoclass class ArrayListTest(unittest.TestCase): def test_other_dunders(self): alist = autoclass('java.util.ArrayList')() args = [1,2] for arg in args: alist.add(arg) self.assertEqual(len(args), ...
true
efb3c2198047bf4ca8bdc71aaa83bc12d009073e
alewan/capstone
/gradient_boosting/baseline_model.py
UTF-8
1,107
3.359375
3
[]
no_license
import os import sys import json from argparse import ArgumentParser import numpy as np def make_printable(x: float) -> str: return str(round(100.0 * x, 3)) + '%' if __name__ == "__main__": parser = ArgumentParser(description='Evaluate a baseline model based on provided data') parser.add_argument('--inp...
true
882a014a61f732d782a2ca5108db9026e6a8bed3
lindsallen/mapping
/dc_restaurants/src/visualization/create_map.py
UTF-8
3,632
3.21875
3
[]
no_license
'''Creates map from geojson ''' import folium from folium import plugins import branca __author__ = "Lindsay Allen" __version__ = "1.0.1" __maintainer__ = "Lindsay Allen" __status__ = "Development" def dc_map(dc_gdf, variable, name): ################################################################### ### 3.1...
true
5e059b68a2b9f84f1ff0d67f55b32fbdb1071ee1
sidneyarcidiacono/cs1.1-dueler-tutorial
/scripts/armor.py
UTF-8
625
3.875
4
[]
no_license
"""Import random library""" import random class Armor: """Define Armor class.""" def __init__(self, name, max_block_strength): """Initialize armor properties.""" self.name = name self.max_block_strength = max_block_strength def block(self): """Return random value to set b...
true
111437e2396006ac28e59a826902b44861837b8d
ykang/tools-for-data-science-course
/2021spring/2019311624/leapyearcheck.py
UTF-8
325
3.390625
3
[]
no_license
def leapyearcheck(year): """to judge whether a year is leap year""" if year % 100 ==0: if year % 400 == 0: print(year,'年是闰年') else: print(year,"年不是闰年") elif year % 4 == 0: print(year,'年是闰年') else: print(year,"年不是闰年")
true
ec11903106eb50bb14bca34ae504aa4d8bd52003
sanneabhilash/python_learning
/Concepts_with_examples/importing_modules.py
UTF-8
219
3.46875
3
[]
no_license
# import math module import math print("Floor of 3.4 :", math.floor(3.4)) print("e value:", math.e) print("inf:", math.inf) print("value of pi:", math.pi) print("Not a number:", math.nan) print("tau value:", math.tau)
true
a2efc230d463fe8b86ea3f186cc176e10bf9fe03
dlosowyj/Learn_Python
/ex43.py
UTF-8
13,532
3.328125
3
[]
no_license
from sys import exit from random import randint class Scene(object): def enter(self): print("This scene is not yet configured. Subclass it and implement enter()") exit(1) class Engine(object): def __init__(self, scene_map): self.scene_map = scene_map def play(self): curr...
true
2f909f576f051cf9c9b11e43b3575c4810bf3f48
Orderlee/tjoeun
/source/client3.py
UTF-8
1,118
3.0625
3
[]
no_license
import socket HOST='localhost' PORT=9009 def getFileFromServer(filename): data_transferred=0 # AF_INET : ipv4, SOCK_STREAM : TCP 통신 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: #서버에 접속 sock.connect((HOST,PORT)) # 바이너리 형식으로 인코딩하여 전송 sock.sendall(filename.en...
true
f622bfa9d9797e9e65ad529a6f242510426e9994
cooper-1/Pythonofspider
/第11章/process 类的方法和属性的使用.py
UTF-8
2,218
3.4375
3
[]
no_license
# -*-coding: UTF-8 # @Time : 2021/10/17 20:01 # @Author : Cooper # @FileName: process 类的方法和属性的使用.py # @Software: PyCharm from multiprocessing import Process import time import os # 两个子进程将会调用的两个方法 def child(interval): print('子进程(%s)开始执行,父进程为(%s)' % (os.getpid(), os.getppid())) t_start = time.time() ...
true
5bfa78ebf01ba763ad1bb9dd5b169c65c9a25385
sasank45/guvi
/29.py
UTF-8
75
3.375
3
[]
no_license
n = int(input()) if(n>60): print(n//60,n%60) else: print("0",n)
true
33983f56acdc0d7b73a96b6b33f2d99f513d9f32
Hiroshiba/yukarin_nsf
/scripts/check_min_silence_length.py
UTF-8
1,840
2.71875
3
[]
no_license
import argparse from functools import partial from glob import glob from multiprocessing.pool import Pool from pathlib import Path from typing import Tuple, Sequence, List import numpy from acoustic_feature_extractor.data.sampling_data import SamplingData from tqdm import tqdm def process(args: Tuple[int, Path], sam...
true
99aad26ee6e2287df1406dec0459e257245b015e
Luccifer/PythonCourseraHSE
/w02/e03.py
UTF-8
362
3.859375
4
[ "Unlicense" ]
permissive
# Максимум трех чисел def maximum_of_three(num1, num2, num3): if num3 <= num1 >= num2: ans = num1 elif num2 >= num3: ans = num2 else: ans = num3 return ans if __name__ == '__main__': num1 = int(input()) num2 = int(input()) num3 = int(input()) print(maximum_of_...
true
7e1d861af65cdef8f6cd58a238301cb3eed4aed0
stathischaritos/dagbldr
/examples/mnist_conditional_vae/flying_mnist_conditional_vae.py
UTF-8
5,036
2.609375
3
[ "BSD-3-Clause" ]
permissive
import argparse import os import numpy as np from dagbldr.datasets import fetch_binarized_mnist from dagbldr.utils import convert_to_one_hot, load_checkpoint from dagbldr.utils import interpolate_between_points, make_gif parser = argparse.ArgumentParser() parser.add_argument("saved_functions_file", ...
true
430d49187ec7b32578fb816244c23dd08a56d37a
nata1y/cleanco
/cleanco/classify.py
UTF-8
1,685
3.5625
4
[ "MIT" ]
permissive
""" Functions to help classify business names by country or type, based on legal terms. Examples of use: >> # check name for its possible business type(s) >> classification_sources = typesources() >> matches("MyCompany Ltd", classification_sources) ['Limited'] >> >> # check name for its possible jurisdictions, usual...
true
7f238cf773be7731e2a71d19838254efb9950d6a
GeosoftInc/gxpy
/geosoft/gxapi/GXAGG.py
UTF-8
12,313
2.59375
3
[ "BSD-2-Clause" ]
permissive
### extends 'class_empty.py' ### block ClassImports # NOTICE: Do not edit anything here, it is generated code from . import gxapi_cy from geosoft.gxapi import GXContext, float_ref, int_ref, str_ref from .GXST import GXST ### endblock ClassImports ### block Header # NOTICE: The code generator will not replace the cod...
true
bdd287d24a9148c1bfae161d57b4ca79d5662c87
rawoctopus/dohyun
/Algorithm/FailRates.py
UTF-8
613
2.765625
3
[]
no_license
#2019.07.23 #https://programmers.co.kr/learn/courses/30/lessons/42889 def solution(N, stages): cur_level = [0]*(N+2) for level in stages: cur_level[level] +=1 total_level = [0]*(N+2) total_level[N+1] = cur_level[N+1] fail_rates = [] for i in range(N,0,-1): total_l...
true
0de7113293789a7637bc003e3e1e1596b9fb9f2b
swishy/efl-research
/PROTO/doxygen2gwiki/src/doxygen2gwiki/fix_xml.py
UTF-8
652
2.515625
3
[]
no_license
from xml.dom.minidom import parse import re urlfix = re.compile("""<ulink url=".+?">.*?</ulink>""") def repl(m): urlstart = m.string[m.start():m.end()].find('url="') + 5 urlend = m.string[m.start():m.end()].find('"', urlstart + 1) url = m.string[m.start():m.end()][urlstart:urlend] newurl = [] fo...
true
f94ada06ec3cd68d2a6801cc952c7d62a288450a
ItZoopark/2ege
/main.py
UTF-8
284
3.515625
4
[]
no_license
def f(x, y, z, w): return int( (((not y) or w) == ((not x) or (not z))) and (x or w)) print("x y z w f") for x in range(0, 2): for y in range(0, 2): for z in range(0, 2): for w in range(0, 2): print(x, y, z, w, " " ,f(x, y, z, w))
true
a7a4411052bd2e48d7964c0d541a382bc70cfd2d
HicksCaleb/HicksSelenskyCapstone2018
/displayTest/moreComplex.py
UTF-8
989
2.59375
3
[]
no_license
import numpy as np import pyglet import matplotlib.pyplot as plt width,height = 1024,768 t=2 cf = 2*np.random.rand(t,t)-1+2j*np.random.rand(t,t)-1j coefficients=np.zeros((height,width),dtype=complex) coefficients[:t,:t] = cf array = np.fft.fft2(coefficients) array = (128*(array/np.max(array))+127).astype('uint8') prin...
true
237355e4997e1680b7f5635cbf54128b287ff671
soheil2017/Machine-Learning
/Linear Regression/01 - Simple Linear Regression/linearRegression_one input.py
UTF-8
1,675
3.359375
3
[]
no_license
# https://realpython.com/linear-regression-in-python/#regression # https://zerotohero.ir/article/python/%D8%B1%D8%B3%D9%85-%D9%86%D9%85%D9%88%D8%AF%D8%A7%D8%B1-%D9%88-%D9%85%D8%B5%D9%88%D8%B1-%D8%B3%D8%A7%D8%B2%DB%8C-%D8%AF%D8%A7%D8%AF%D9%87%E2%80%8C%D9%87%D8%A7-%D8%AF%D8%B1-%D9%BE%D8%A7%DB%8C%D8%AA/ # one input i...
true
d124053a2a394111420869c4470d8d8343d11ea6
ageraldo1/Python-bootcamp
/data_science/pandas/rank_sort.py
UTF-8
320
2.9375
3
[]
no_license
import numpy as np import pandas as pd from numpy.random import randn from pandas import Series, DataFrame ser1 = Series(range(3), index=list('CAB')) ser1.sort_index() # sort by index ser1.sort_values(ascending=False) # sort by value # rank ser2 = Series(randn(10)) ser2 = ser2.sort_values() print (ser2.rank())
true
c4836c75ef1c622d0741de4a0c53ea82d1515272
2434325680/Learnbgame
/All_In_One/addons/fujiwara_toolbox/UIutils/makezip.py
UTF-8
1,949
2.53125
3
[]
no_license
import sys import os import shutil import subprocess import zipfile args = sys.argv selfpath = args[0] selfdir = os.path.dirname(selfpath) toolbox_dir = os.path.dirname(selfdir) addon_dir = os.path.dirname(toolbox_dir) print(addon_dir) zipdest = selfdir + os.sep + "fujiwara_toolbox.zip" #既にあるzipの削除 if os.path.exist...
true
b5fa7a6198073eed36ba0d90f4f497533371280a
Dhanya1234/python-assignment-9
/assignment 9_ program on rstrip and lstrip.py
UTF-8
139
3.328125
3
[]
no_license
str="hello everyone" str1=str.rstrip('e') str2=str.lstrip('h') print("old string ",str) print("new string ",str1) print("new string ",str2)
true
820959d5e2bc18fff7a741465eaffc8128375eae
RREYESAL/RPC_HVScan
/common/html.py
UTF-8
1,699
3.015625
3
[]
no_license
'''Common code related to HTML for all CMS DB Web services. ''' __author__ = 'Miguel Ojeda' __copyright__ = 'Copyright 2012, CERN CMS' __credits__ = ['Giacomo Govi', 'Salvatore Di Guida', 'Miguel Ojeda', 'Andreas Pfeiffer'] __license__ = 'Unknown' __maintainer__ = 'Miguel Ojeda' __email__ = 'mojedasa@cern.ch' import...
true
04ae00878f139960beb6f0235de4d99280352b0b
WeirdData/MovieLensAnalysis
/common.py
UTF-8
1,052
3.046875
3
[]
no_license
# Copyright (c) 2020. WeirdData # Author: Rohit Suratekar # # Dataset used: MovieLens 20M # https://www.kaggle.com/grouplens/movielens-20m-dataset # # Common functions which can be used anywhere in the repository import pandas as pd from constants import * def get_movies() -> pd.DataFrame: def _separate_yea...
true
fdac80d08eb3f2cd5618aa2c36cf2a205be08934
ChangxingJiang/LeetCode
/0401-0500/0462/0462_Python_1.py
UTF-8
317
3.0625
3
[]
no_license
from typing import List class Solution: def minMoves2(self, nums: List[int]) -> int: nums.sort() mid = nums[len(nums) // 2] ans = 0 for num in nums: ans += abs(num - mid) return ans if __name__ == "__main__": print(Solution().minMoves2([1, 2, 3])) # 2
true
74f4e40e36280fdd7e246805d901ff6c7e110be2
jeremy-was/Blackjack
/blackjack.py
UTF-8
26,279
3.140625
3
[]
no_license
import random import datetime import os import smtplib from email.mime.text import MIMEText # from datetime import datetime # from datetime import date suits = ('Hearts','Diamonds','Clubs','Spades') ranks = ('Two','Three','Four','Five','Six','Seven','Eight','Nine','Ten','Jack','Queen','King','Ace') values = {'Two':2,'T...
true
09ad9f947f0d07e641499911885387ab368dd9b5
pipoted/my_spider
/douban/test.py
UTF-8
171
3.03125
3
[]
no_license
tem_dict = { 'name': 'xiao', 'age': '18', 'hello': 'world', } for i in tem_dict: print(i, tem_dict[i]) test = [tem_dict[i] for i in tem_dict] print(test)
true
24d95fb4772a5593e10990212e81ec28e40304a8
ivandudkov/dynamic-surface-class
/f04_python_code/reg_grid_3d.py
UTF-8
24,273
3.265625
3
[]
no_license
# For computations and plotting import numpy as np import matplotlib.pyplot as plt class RegGrid3D: """ Original Matlab Class description: % This class hold a UNB style weighed grid - it really consists of two % grids, namely a grid of the sum all of the weights of all the % contributions to the gr...
true
05bc6ddd38327d6c2b3d85357db6b30a6fdc663c
DenisZun/Denis_Spider
/spider/spider1.py
UTF-8
3,220
2.90625
3
[]
no_license
import re url = "http://sdkpy.zqgame.com/3002/316/323/pay_notice" url_01 = "https://www.google.com" url_02 = "http://uni.notice.zqgame.com/3002/316/323/pay_notice" content = 'Hello 1234567 World_This is a Sentence Sweet Heart' res_01 = re.match(r'^Hello\s(\d+)\sWorld', content) # res = re.match(r'[a-zA-Z]+://[^\s]*...
true
e8afaf37a08408370abdb40c19e269c07caf4ee9
jcburnworth1/Python_Programming
/LaunchCode/LaunchCode_HelloWorld.py
UTF-8
18,113
4.53125
5
[]
no_license
## LaunchCode ## Code for the HelloWorld Exercises ##### Chapter 1 - What is Code? Beg ##### ### Your first program Beg ### print("Hello, World!") ## Can I print a message that itself contains quote marks, such as Quoth the Raven "Nevermore"? print('Quoth the Raven "Nevermore"') ### Your first program End ### ##### Ch...
true
0e4a262ce953eee929dda767e22af7a893c87458
one-diary/Movie-Series-Search-Engine
/websites/jio_selenium.py
UTF-8
4,401
2.671875
3
[]
no_license
from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as ec from selenium.common.exceptions import TimeoutException, NoSuchElementException from selenium import webdriver from bs4 import BeautifulSoup import time u...
true
4e0ee793e161f9bb7a3ba50f6fce887de9282527
saviovincent/DSA
/leetcode/easy/SingleNumber.py
UTF-8
308
3.0625
3
[]
no_license
class Solution(object): def singleNumber(self, nums): """ :type nums: List[int] :rtype: int """ op1 = 0 for i in nums: op1 = op1 ^ i return op1 if __name__ == '__main__': soln = Solution() print(soln.singleNumber([4,1,2,1,2]))
true
296dbab30d6d175052bcc2e623a6e30223d75ceb
baddy29/data-analysis
/data_cleaning.py
UTF-8
749
2.734375
3
[]
no_license
#Importing libraries# import numpy as np import pandas as pd #Loading csv file# df=pd.read_csv('C:\\Users\\AQdmin\\Desktop\\Extra_docs\\PetInsurance_Model_Data1.csv') print(df) #Removing fields where DMCFlaf=0# df=df.drop(df[df.DMCFlag == 0].index) #Removing fileds where Days left for renewal < 0# df=df....
true
4a9ec650ef74ac371acc75384a175c8e48ba8bd8
mysticuno/athensrsa
/athensrsa.py
UTF-8
2,595
3.109375
3
[]
no_license
''' Information sending protocol between Voter, Official, and Machine. Currently a work-in-progress LEGEND: V: Voter O: Official M: Machine I: Voter information (Unique identifiers) B: Voter ballot E_x(y): Message y encrypted with x's public key S_x(y): Message y signed by x SHA256(y):...
true
cbabd7576e8c18e52b162c7e76a727a55f68854e
enricobacis/infinite
/infinite/product.py
UTF-8
677
2.859375
3
[ "MIT" ]
permissive
from .gencacher import GenCacher import itertools try: xrange except NameError: xrange = range def _summations(sumTo, n=2): """yields all the n-uples that sum to sumTo.""" if n == 1: yield (sumTo,) else: for head in xrange(sumTo + 1): for tail in _summations(sumTo - head, n -...
true
52cf56c0701c45778e0b320cad0073ebbf03cd25
li23/PythonMath
/conditionals.py
UTF-8
297
3.484375
3
[]
no_license
y = 6 if y > 7: print("yes!") else: print("no!") age = 50 if age < 10: print("What School do you go to?") elif 11 < age < 20: print("Yr cool!") elif 20 < age < 30: print("What job do you have?") elif 30 < age < 40: print("Are u married?") else: print("Fuck ur OLD!")
true
922c923fcd3482c5498ad7a7850ec6e2f9d9fdef
SUMASHREE/codekata
/countDigits.py
UTF-8
83
3.5
4
[]
no_license
n=int(input("Enter a number:")) a=str(n) l=len(a) print("No of digits is:"+str(l))
true
ce96adb1c15c312544f73dfb43e9e2ddca89a8fc
yamaru12345/AdelaiDepth
/LeReS/lib/net_tools.py
UTF-8
1,964
2.625
3
[ "CC0-1.0", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
permissive
import importlib import torch import os from collections import OrderedDict def get_func(func_name): """Helper to return a function object by name. func_name must identify a function in this module or the path to a function relative to the base 'modeling' module. """ if func_name == '': re...
true
246103ba7ad8fb03203a8fb0acd7e1adf7c4a891
erincanada16/university-projects
/statistical_learning/binary_classification.py
UTF-8
6,427
3.875
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Feb 15 13:21:43 2019 @author: Erin Canada Project # 2 is to implement linear regression for binary classification from scratch (as we've been discussing / working on for the past several lectures). Minimize the logistic regression objective function in two differ...
true
4e7861d5c6ff62967809077ef776b0da04f54fe3
moustachio/lastfm-Analysis
/plotting/shrink.py
UTF-8
2,193
3.40625
3
[]
no_license
""" Script that averages the entropy, relative entropy, and gini coefficient as a function of item age. The "age" of an item is defined as the number of months in which it has received tags since the first month in which it was tagged. """ import sys sys.path.append('../bin') from dbSetup import * cursor=db.curso...
true
2e92461d4ea21c4323f86df3f971425b91a1fdcf
bhbruce/TensorRT_YoloV3
/trt_yolo/data_processing.py
UTF-8
3,645
2.71875
3
[]
no_license
import math from PIL import Image import numpy as np import os import torch class PostprocessYOLO(object): """Class for post-processing the three outputs tensors from YOLOv3-608.""" def __init__(self, yolo_masks, yolo_anchors, num_classes, s...
true
fd78a1a16a600efb7c529d06b71ced1a8098510d
hamzakeurti/anomaly-detectives-kpi
/extraction/Seasonality.py
UTF-8
6,620
2.65625
3
[]
no_license
import os import pandas as pd import numpy as np from extraction import Time VALUE = "value" PREDICT = "predict" MINUTE_FROM_START = "minute_from_start" BIG_TREND_MEANS = "big_trend_means" BIG_TREND_STDS = "big_trend_stds" BIG_TREND_EXTRACTED = "big_trend_extracted" WEEKLY_EXTRACTED = "weekly_extracted" EXTRACTED_DAI...
true
50e2d9c75924dfff3b1348b301e0ae5bf96852f7
killerducky/wolfai
/wolfgame.py
UTF-8
2,393
2.953125
3
[ "MIT" ]
permissive
import random from pybrain.utilities import abstractMethod from pybrain.rl.environments import Environment class WolfGame(Environment): def __init__(self, numPlayers, roles): self.numPlayers = numPlayers self.roles = roles self.reset() def reset(self): #print "WolfGame reset" self.done = False...
true
a113e615a95306925da393681d7392371a34ebb4
cooldeveloper7/cooldeveloper7.github.io
/fla.py
UTF-8
365
2.578125
3
[]
no_license
from flask import Flask,redirect,url_for app=Flask(__name__) @app.route('/home/<name>') def home(name): if name=='admin': return redirect(url_for('rev',revn=20.0)) else: return "hello world %s"%name @app.route('/rev/<float:revn>') def rev(revn): return 'revision no %f'%revn if __n...
true
8bf40374917292c189c1d98622c5497d81a2f789
2448845600/LeetCodeDayDayUp
/LeetCode题解/318.py
UTF-8
1,288
3.109375
3
[ "MIT" ]
permissive
class Solution: def maxProduct(self, words) -> int: bitmasks = [] for word in words: bitmask = 0 for ch in word: bitmask |= 1 << (ord(ch) - ord("a")) bitmasks.append(bitmask) max_res = 0 for i in range(len(words)): for ...
true
6df8b0c0c2a845586d50d2e03cdc5d6e2d590c0c
guhan94/django-hibp-validator
/src/django-validator.py
UTF-8
1,920
2.859375
3
[ "MIT" ]
permissive
import requests import hashlib import logging from django.core.exceptions import ValidationError from django.utils.translation import gettext as _ class HIBPCheck(object): def __init__(self): self.hibp_api_endpoint = 'https://api.pwnedpasswords.com/range/' @staticmethod def hash_password(passwor...
true
a116ce973e6fa6f48408b5f1d29dc78712888fc8
daniel-reich/ubiquitous-fiesta
/oQ99uE4iPNbEnf9QZ_21.py
UTF-8
299
3.640625
4
[]
no_license
def no_perms_digits(number): NewNum = 1 for i in range(number): NewNum = NewNum * (i+1) for i in range(len(str(NewNum))): FinalNum = i + 1 print("The",number,"unique items can be arranged in",NewNum,"different ways and the number",NewNum,"has",FinalNum,"digits") return FinalNum
true
40d1abc272a2d11ab0e114f7203334c78b293a53
asdlei99/Artificial-Neural-Network-THU-2018
/hw1/codes/loss.py
UTF-8
369
2.71875
3
[ "MIT" ]
permissive
from __future__ import division import numpy as np class EuclideanLoss(object): def __init__(self, name): self.name = name def forward(self, input, target): '''Your codes here''' return ((target - input) ** 2).mean(axis=0).sum() / 2. def backward(self, input, target): '''...
true
811f14ef8ed81ae9a299781925c2556a5ea92994
jcmadsen/pyTerramechanics
/plot_WongReece.py
UTF-8
3,795
2.9375
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- """ Created on Mon Oct 07 08:07:59 2013 use the WongReece class to use Wong's approach to predicting performance of off-road vehicles in soft soil, for both driven and towed wheels. Plots include the solutions for both towed and driven wheels (separate functions) e.g. @lit Wong, Reece "Predi...
true
a3ca63596b593983de76479c2539960b90cf3b0a
simajune/PythonCrawler
/Practice/com/04_Library.py
UTF-8
144
2.75
3
[]
no_license
# from urllib.request import urlopen import urllib.request url = "https://www.nate.com/" html = urllib.request.urlopen(url) print(html.read())
true
e6e970408c5596376f9ddfe8ec4e9eb65415a6d5
kannanmca1512/taleofthrones
/files/Message.py
UTF-8
621
3.78125
4
[]
no_license
class Message: """ Message Class to hold the details of Message Sent """ def __init__(self, sender, receiver, message): self.__sender = sender self.__receiver = receiver self.__message = message def get_sender(self): """ Gets the Sender Kingdom Object of the ...
true
0868b45df17a148addf582e6f188d6766a6d1526
perplexedfingers/URLShortener
/assignment/shorten_url/models.py
UTF-8
485
2.578125
3
[ "MIT" ]
permissive
from math import pow from string import ascii_uppercase from django.db import models int_to_char = {int_: char for int_, char in enumerate(ascii_uppercase)} ranks = tuple(pow(26, i) for i in range(5)) def from_pk_to_char(pk): result = '' for rank in reversed(ranks): result += int_to_char[pk // rank]...
true
feec8d38a30aad0e067161dc052e99362d6b09e5
anghelo/Python_excercise1
/shopSmart.py
UTF-8
765
3.09375
3
[]
no_license
import shop def shopSmart(orderList,fruitShop): less=99999.0; fruitShopLess = fruitShop[0] for shopp in fruitShop: cost = shopp.getPriceOfOrder(orderList) if cost < less: fruitShopLess = shopp less=cost return fruitShopLess if __name__=='__main...
true
056c6198852de95914c74c7ca7b785fb31e561a3
cleverer123/Algorithm
/二叉树_图/graph.py
UTF-8
1,851
3.734375
4
[]
no_license
class GraphNode(object): def __init__(self, x): self.val = x self.neighbors = [] class Solution: def graph(self): nodes = [GraphNode(i) for i in range(5)] nodes[0].neighbors.append(nodes[4]) nodes[0].neighbors.append(nodes[2]) nodes[1].neighbors.append(nodes[2]) ...
true
cc1dc818a22fee49f605cd0059cb252ef1fbebae
faneco/Programas
/Lista/lista2/exercicio6.py
UTF-8
393
3.03125
3
[]
no_license
horas = input('Digite horas trabalhada: ') valor = input ('Digite valor das horas: ') salario = valor * horas ir = salario * 0.11 inss = salario * 0.08 sindicato = salario * 0.05 liquido = salario - (ir + inss + sindicato) print ('Salrio R$ %.2f' %salario) print ('desconto IR: R$ %.2f' %ir) print ('INSS R$: %.2f' %i...
true
f831be728dd03788c98a691009588029cf59cb81
jihongeek/Algo
/baekjoon/1152.py
UTF-8
64
3.046875
3
[]
no_license
inputstr = input() inputstr.strip() print(len(inputstr.split()))
true
7714cbf9932b245d652e44fdb41d06eb6618acdd
alan-turing-institute/defoe
/defoe/nzpp/queries/total_articles.py
UTF-8
800
2.8125
3
[ "MIT", "CC0-1.0", "CC-BY-4.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
""" Counts total number of articles. """ from operator import add def do_query(all_articles, config_file=None, logger=None, context=None): """ Count total number of articles. Returns result of form: { "num_articles": num_articles } :param all_articles: RDD of defoe.nzpp.articles.Articles ...
true
f68c08e74fadb9e1171c2244c6dcbfabc32c2759
tsvisimcha/KinderKrypt
/encryption_decryption.py
UTF-8
1,586
2.90625
3
[]
no_license
#!/usr/bin/python import Tkinter as tk class EncryptionDecryptionMenu(tk.Frame): """ """ def __init__(self, parent=None, menubar=None, gpg=None, *args, **kwargs): tk.Frame.__init__(self, parent) self.parent = parent self.menubar = menubar self.grid(column=1) self...
true
205974177b64d962033060db4d29ac8d68be55c1
kolanos/culinary
/culinary/text.py
UTF-8
2,444
3.15625
3
[]
no_license
import re import string RE_SPACES = re.compile("[\s\t]+") MAC_EOL = "\n" UNIX_EOL = "\n" WINDOWS_EOL = "\r\n" def detect_eol(text): # FIXME: Should look at the first line if text.find("\r\n") != -1: return WINDOWS_EOL elif text.find("\n") != -1: return UNIX_EOL elif text.find("\r") !=...
true
c6e6eaee516715ed96a37a591ec292814e303740
nljubesi/hbs-twitter-space
/evaluation/accuracy/check-eval.py
UTF-8
1,142
2.59375
3
[]
no_license
#!/usr/bin/python #-*-coding:utf8-*- from __future__ import division from collections import defaultdict vars=[] values=[] tp_dict=defaultdict(int) tn_dict=defaultdict(int) fp_dict=defaultdict(int) fn_dict=defaultdict(int) accuracy=open("accuracy.txt", "w") l=[] for line in open("evalrandom500-checked.tsv", "r"): ...
true
ea2ce8799a09890d2e61874e0be26cb060f482dc
tczhouyou/mpgen
/math_tools/MathTools.py
UTF-8
3,387
2.609375
3
[]
no_license
import math import numpy as np from sklearn import mixture from scipy.stats import multivariate_normal def mat2rpy(R): a = ((R[0, 0] + R[1, 1] + R[2, 2]) - 1) / 2 a = max(a,-1) a = min(a,1) theta = np.arccos(a) if theta == 0: return np.zeros(3) else: multi = 1 / (2 * math.sin(...
true
51037953f7ae0838fc2e25b2c01dca2a216e3161
rohan-dhere/edX
/Program2_3.py
UTF-8
1,281
3.875
4
[]
no_license
''' Now write a program that calculates the minimum fixed monthly payment needed in order pay off a credit card balance within 12 months. By a fixed monthly payment(multiples of 10) ''' monthlyPaymentRate = 0 # min fix amount should be paid per month init_balance = balance # save initial balance monthlyInte...
true
71519503198f18dcf981ca181bb77607583b2835
jahnvi480/Tic_Tac_Toe
/tictaktoe.py
UTF-8
1,234
3.578125
4
[]
no_license
tic_toc = [] for i in range(1,10,3): t = [i, i+1, i+2] tic_toc.append(t) def print_fun(tic_toc): for i in tic_toc: for j in i: print(j, end=" ") print() def check_value(p,x): for i in range(3): for j in range(3): if x == tic_toc[i][j]: ti...
true
dfb986af74357bf3f94da8f0d4c283c5bef4e593
github-wjw/weread-auto
/uiautomator2/huitoutiao-read.py
UTF-8
2,204
2.9375
3
[]
no_license
# coding:utf-8 # from uiautomator2 import device as d import uiautomator2 as u2 import random import time import datetime # 加关注,容易出现在文章列表 news = [ "光明网", "新华社", "中国青年网", "看看新闻", "娱小白", "环球网", "花影故事", "环京津", "新华社", "中国经济网", "吃货做美食", "" ] # 点亮屏幕 def light_screen(): d...
true
ce0848118ab491cc3edcbf8e5ee08b5251fe2c5d
red-hat-storage/cephci
/tests/cephadm/test_legacy_services.py
UTF-8
1,504
2.53125
3
[ "MIT" ]
permissive
from utility.log import Log log = Log(__name__) def run(ceph_cluster, **kw): """ Verify if the cephadm shell tries to infer config from a dummy mon created. Verifies bz:2080242 Args: ceph_cluster: Ceph cluster object **kw : Key/value pairs of configuration information to be u...
true
f9d0f5bb9eb2b4fe39ccf600610c79403fa68b94
PACarrascoGomez/Proyectos
/kneighbours/Python/kneighbours.py
UTF-8
3,394
3.203125
3
[]
no_license
import sys, os import random import math #################################################################### # Autor: Pascual Andres Carrasco Gomez # Descripcion: Algoritmo k vecinos mas cercanos # Corpus: Flores: Virginica, Setosa, Versicolor (150 muestas etiquetadas) # Entorno: python3 #############################...
true
4841a1b59a469d4957b923c5eb972d1af246ee1c
meetshrihari/Deep-Learning-from-scratch
/Exercise4/code_skeleton/data.py
UTF-8
3,084
2.703125
3
[]
no_license
from torch.utils.data import Dataset import os import torch as t import pandas as pd from pathlib import Path from skimage.io import imread from skimage.color import gray2rgb import numpy as np import torchvision as tv from sklearn.model_selection import train_test_split import warnings warnings.simplefilt...
true
bee8b304330804aa98e3a32a41f0cfae36c08ceb
hzyang95/neutral_semantic_retrieval
/scripts/serve.py
UTF-8
796
2.5625
3
[]
no_license
import time import datetime as dt import tornado.gen import tornado.httpserver import tornado.ioloop import tornado.web import json class SleepHandler(tornado.web.RequestHandler): def initialize(self): self.num = '123' @tornado.gen.coroutine def post(self): print(self.reque...
true
0152c8c909cfe99298b1b9d0ffddc81b1dd10269
miramen7/learning-software
/python/indxujian.py
UTF-8
647
3.328125
3
[]
no_license
from __future__ import print_function def main(): a = int(raw_input("Masukan nilai UTS mahasiswa: ")) b = int(raw_input("Masukan nilai UAS mahasiswa: ")) NA = (0.65*b) + (0.35*a) if (NA >= 80): indeks = 'A' elif ((NA < 80) & (NA >= 70)): indeks = 'B' elif ((NA < 70) & (NA >= 5...
true
5e6bccca02685f864f869b420d20abf657a8b1c0
romcon/OPTMOD
/tests/test_variable_scalars.py
UTF-8
4,419
2.90625
3
[ "BSD-2-Clause" ]
permissive
import optmod import unittest import numpy as np class TestVariableScalars(unittest.TestCase): def test_construction(self): x = optmod.variable.VariableScalar() self.assertEqual(x.name, 'var') self.assertEqual(x.get_value(), 0.) self.assertTrue(isinstance(x.id, int)) saved...
true
bd0adf234656cf2dde2af17095f8e923f4068a37
bajpaiNikhil/Leetcode
/leetcode_102.py
UTF-8
287
2.859375
3
[]
no_license
dividend=-2147483648 divisor=-1 sign = -1 if ((dividend<0) ^ (divisor <0)) else 1 dividend=abs(dividend) divisor=abs(divisor) count=0 quotient=0 for i in range(31,-1,-1): if (count+(divisor << i)<= dividend): count+=divisor<<i quotient |= 1<<i print(quotient*sign)
true
5d0a985c408019a8f06b8123966093e0a03278ff
zhinst/zhinst-toolkit
/src/zhinst/toolkit/nodetree/connection_dict.py
UTF-8
5,033
3
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
"""Implements Connection wrapper around a native python dictionary.""" import fnmatch import json import re import typing as t from collections import OrderedDict from numpy import array from zhinst.toolkit.nodetree.helper import NodeDoc from zhinst.toolkit.exceptions import ToolkitError class ConnectionDict: "...
true
777e7c79cedde90f22edf61e0ba12b436eb42494
pkulcsarsz/OCR-MasterThesis
/adversaries.py
UTF-8
976
3.0625
3
[]
no_license
import tensorflow as tf import os, random import matplotlib.pyplot as plt import numpy as np letters = ["0", "1" , "2", "3", "4", "5", "6", "7", "8", "9", "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"] def c...
true
834db2c4150f59e3c1e1ff572fd50b9790627268
SuyangChen/MPSE
/MPSE/examples/phishing/analysis.py
UTF-8
1,292
2.546875
3
[]
no_license
import sys import matplotlib.pyplot as plt import numpy as np import setup_data sys.path.insert(1,'../..') import mview def mds_all_features(n_samples=1000): features = setup_data.df[setup_data.df.columns[0:30]]\ [0:n_samples].to_numpy() results = setup_data.results[0:n_samples] tsne = mview.TSNE...
true
9d96ab767258b567ba7b24c4a690cc340be3ae4a
HenryHerb/tornado
/tornado/test/curl_httpclient_test.py
UTF-8
4,406
2.546875
3
[ "Apache-2.0" ]
permissive
from tornado.httpclient import HTTPRequest from tornado.stack_context import ExceptionStackContext from tornado.test.httpclient_test import HTTPClientCommonTestCase from tornado.testing import AsyncHTTPTestCase from tornado.web import Application, RequestHandler import json try: import pycurl except ImportError: ...
true
de1f021da55368db259072460fcbe4ae5f3c2381
ZhangYet/vanguard
/myrtle/befor0225/linked_list.py
UTF-8
3,193
3.765625
4
[]
no_license
class ListedNode: def __init__(self, val: int): self.val = val self.next = self.prev = None class MyLinkedList: def __init__(self): """ Initialize your data structure here. """ self.dump_head = ListedNode(-1) self.dump_tail = ListedNode(-1) sel...
true
ee984f3e44e00558dc8c2e15a85c6a73a79a6e7c
alwinmreji/ROS-and-ML
/Assingment_#2/#2_fizz_buzz.py
UTF-8
327
3.875
4
[]
no_license
def fizz_buzz(n): if n%3 == 0: if n%5 == 0: return "FizzBuzz" return "Fizz" elif n%5 == 0: return "Buzz" return n a = int(input("Enter a number to check:\t")) print(fizz_buzz(a)) # OUTPUT # Enter a number to check: 6 # Fizz # Enter a number to check: 5 # Buzz # Enter a number to check: 15 # Fi...
true
da0455fc9eff91a743fc07c699593f2580c4ac2e
sisayyt/sisayyt.githab.io
/Heroes of Pymoli/PyPoll.py
UTF-8
1,146
3.0625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[33]: import os import pandas as pd df = pd.read_csv ("C:/Users/Sisay/Desktop/Resources/election_data.csv") # ATotal vote casted Total_votes = df["Candidate"].count() Total_votes Cand_votes = df["Candidate"].value_counts() Cand_votes #Convert to DataFrame Cand_votes = p...
true
f721514c86ab96f8053ad295d1d6a402773aef3d
TovarnovM/pyKas
/src/include/animation/draw.py
UTF-8
599
3.1875
3
[]
no_license
from matplotlib import pyplot as plt from numpy import arange, sin, cos xx = arange(100) cut = (xx > 0) & (xx % 17 == 0) y1 = sin(xx) y2 = (xx**2) % 2.0+cos(xx+0.5) fig = plt.figure() ax1 = fig.add_subplot(211) ax1.plot(xx, y1, c="blue",zorder=1) ax1.scatter(xx[cut], y1[cut], c="red",zorder=2) ax2 = fig.add_subplot(2...
true
167342e687c842df755723bad7ca79724350578d
machariamwangi/simple-basic_python
/app2.py
UTF-8
171
3.484375
3
[]
no_license
import random for i in range(3): print(random.randint(10, 20)) members = ['John', 'Mark', 'Mash', 'Daniel'] leader = random.choice(members) print("member", leader)
true
81b64db16ce2fa95d583b735dbb9eec53a7670cb
alemar11/mangapy
/mangapy/mangarepository.py
UTF-8
994
3.046875
3
[ "MIT" ]
permissive
import re from abc import ABC, abstractmethod from typing import List class Page(): def __init__(self, number: int, url: str): self.number = number self.url = url class Chapter(ABC): def __init__(self, first_page_url: str, number: float): self.first_page_url = first_page_url ...
true
7b4490e363d91b90c460fe302fd7832a38c28231
adolwick/biof309project
/dolwick_project/test_splitdate.py
UTF-8
427
2.8125
3
[]
no_license
import pandas as pd from . import splitdate def tsd(): ''' This function tests splitdate.splitdate. There are no arguments. ''' d = {'Date': ['2019-12-12']} begin = pd.DataFrame(data=d) e = {'Date': ['2019-12-12'], 'year': ['2019'], 'month': ['12'], 'day': ['12']} expected = pd.DataFrame(d...
true
bdcf45123b1b1929b6afc1f5c3dfe5b71303a70d
johnjosephhorton/visibility_allocation
/simulations/optimal_match/optimal_match.py
UTF-8
2,822
3.390625
3
[]
no_license
import os import sys import math import numpy as np import random def m(b,q): """Match probability when a seller with a per-match probability of match q gets exposed to b buyers.""" return 1.0 - math.exp(-b*q) def mm(b,q): """Gets the marginal effect of b on m. """ return q*math.exp(-b*q)...
true
221a9f9f671d14341ca796eef8dd71a6be0e1e7c
sevaroy/mtkpython2
/studentgui_0905.py
UTF-8
876
2.796875
3
[]
no_license
from tkinter import * from models import * import os from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker class QueryFrame(Frame): def __init__(self, master, engine): Frame.__init__(self, master) S = sessionmaker(bind=engine) self.session = S() self.l1 = La...
true
4bddf508f7eb750a98b38281ca40a8ce135698bf
cheshta-kabra/C-97
/countWords.py
UTF-8
254
3.484375
3
[]
no_license
import random rand=random.randint(1,10) name='Cheshta is 15 years old.' wordCount=1 characterCount=0 for i in name: if(i==' '): wordCount+=1 else: characterCount+=1 print(characterCount) print (wordCount) print(rand)
true
fd0d2448afadf31e50b34a7bbc0a4992b66c154a
bishamsingh/Challenge
/challenge01.py
UTF-8
317
3.859375
4
[]
no_license
#!/usr/bin/python def main(): while True: name = raw_input('Enter your keyboard input: ') if (name.strip().lower() == "hello") or (name.strip().lower() == "hola") or (name.strip().lower() == "hi"): print "Greetings" else: print "Sorry, I don't understand" main()
true
6878d1759c60908d2a0bdc9e44417fa22b2ab6d1
bdiptesh/CodeLib
/mllib/lib/model.py
UTF-8
5,794
2.890625
3
[ "BSD-3-Clause" ]
permissive
""" GLMNet module. **Available routines:** - class ``GLMNet``: Builds GLMnet model using cross validation. Credits ------- :: Authors: - Diptesh Date: Sep 06, 2021 """ # pylint: disable=invalid-name # pylint: disable=R0902,R0903,R0913,C0413,W0511 from typing import List, Dict import warnings imp...
true
cb7ccbc5accfc10958abfaddb872d305adfdeb21
kokukuma/atcoder
/abc096/b/main.py
UTF-8
185
2.875
3
[]
no_license
a, b, c = map(int, raw_input().split()) k = int(raw_input()) max_value = max([a,b,c]) value = max_value for i in range(k): value = value * 2 print(sum([a,b,c]) - max_value + value)
true
c4592aaf3bda1c9a1c2311bdeb641525dfc889cf
alexanderNPark-zz/FirstProj
/Grades.py
UTF-8
1,441
4.40625
4
[]
no_license
#---------------------------------------------- #Name: Grades #Purpose: To calculate grade and letter grade based on averages #Author: Alex Park #Date: 10/1/17 #---------------------------------------------- """ Input as many grades as prompted, then select end and the GPA based on a 100 point scale will be printed alo...
true
93eba79d2603da1372dbbb3451d38866efd92c38
MateusCohuzer/Exercicios-do-Curso-em-Video
/Curso_em_Video_Exercicios/ex039.py
UTF-8
901
4.15625
4
[ "MIT" ]
permissive
#Faça um programa q leia o ano de nascimento de um jovem e diga: 1-Se ele ainda deve se alistar 2- Se esta na hr certa de se alistar # Ou se ja passou da hr de se alistar, além de mostrar o tempo que falta pro prazo from datetime import date s = str(input('\033[1;35mQUAL SEU SEXO [M/F]: ')).upper().strip() if s == 'M':...
true
a07ee56420023af568052797f8bcaeaf58c7c4b6
Sona1414/luminarpython
/sajay functional programming/reduce.py
UTF-8
750
3.34375
3
[]
no_license
#map anf filter functions are defined in built ins.py file so we do not require to import any packages #the lambda func in map and filter can contain only one argument #reduce func can be used only if there is a single output,the labda func in reduce function has 2 arguments #reduce is defined in functools file ,so it ...
true
fa459a93ad16229642079b37dfb92ff2d928c7c5
olegzinkevich/programming_books_notes_and_codes
/akshay_natural_language_processing/3_featuring/3_co_occurence_matrix.py
UTF-8
2,100
3.78125
4
[]
no_license
# A co-occurrence matrix is like a count vectorizer where it counts the # occurrence of the words together, instead of individual words. import numpy as np import nltk from nltk import bigrams import itertools import pandas as pd def co_occurrence_matrix(corpus): vocab = set(corpus) vocab = list(vocab) vo...
true
e2c3d04e7135e496e85f9daa580afcaea34b6237
khagesh212/Loops
/Demo28.py
UTF-8
287
3.59375
4
[]
no_license
# Input any 10 numbers find out number of prime numbers ? prime=0 for x in range(10): no = int(input("Enter numbers:")) for y in range(2,no//2+1): if no<2 and no%x==0: break else: prime+=1 print("Number of prime numbers:",prime)
true
64dca03c30361c53b2910451957d6ce6a1e210f5
Akmaralka/seminar3
/myiterator.py
UTF-8
277
3.171875
3
[]
no_license
from collections import Iterator class MyIterator(Iterator): def __init__(self, data): self.data = data def __iter__(self): return self def __next__(self): if not self.data: raise StopIteration return self.data.pop()
true