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 |
|---|---|---|---|---|---|---|---|---|---|---|
b01dc80b6b6abfcb88265701d4cc8aad9bab0ee8 | CyanoKobalamyne/pmsim | /generator.py | UTF-8 | 7,952 | 2.90625 | 3 | [
"MIT"
] | permissive | """Classes that create transaction generators for Puppetmaster."""
import random
from typing import Generator, List, Mapping, Optional, Sequence, Tuple
from api import ObjSetMaker
from pmtypes import Transaction
from sets import IdealObjSetMaker
class TransactionGenerator(Generator[Optional[Transaction], ObjSetMake... | true |
06b9f115cd5d8099337f549a3f57667a157b2c9e | kim-dong-yeob/dataStructure | /heap_sort.py | UTF-8 | 182 | 3.65625 | 4 | [] | no_license | import heapq
data = [9, 4, 5, 6, 2, 3, 1, 8, 7, 10]
heapq.heapify(data)
print("minimum heap:\t", data)
r = []
while data:
r.append(heapq.heappop(data))
print("result:\t", r) | true |
d2fe6c2b9fa4e7fd4a0ce78d5d214dcee055ca6b | jagen/dataprocess | /importWordPackage.py | UTF-8 | 1,346 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import xlrd
import sys
import io
def export_data(filename):
# open a excel file
workbook = xlrd.open_workbook(filename)
file = open('output.txt', 'w', encoding='utf-8')
sheets = workbook.sheets()
last = ['','','','','','','','','']
k = 1
for x in... | true |
2553e1aacd5ff756d46a5c3b9f056897b3eaae08 | mjoscl/cs-i | /Lab 3/pss.py | UTF-8 | 238 | 3.5 | 4 | [] | no_license | import turtle
import math
def draw_rec(radius,depth):
if depth <= 0:
return 0
else:
turtle.circle(radius*10)
return (math.pi*(radius*radius)) + draw_rec(radius+1,depth-1)
print(draw_rec(4,4))
turtle.done | true |
eb225597680bcc3675b0a9a050ebc20c73a28a5c | as-segaf/scraping-python | /shopee.py | UTF-8 | 767 | 3.1875 | 3 | [] | no_license | import bs4
import requests
import csv
url = requests.get('https://www.newegg.com/Laptops-Notebooks/Category/ID-223?Tpk=laptop')
soup = bs4.BeautifulSoup(url.text, 'html.parser')
containers = soup.select('.item-container')
csv_file = open('shopee.csv', 'w')
csv_writer = csv.writer(csv_file)
csv_writer.writerow(['Bra... | true |
46801422e65e3525be2de5d6743fd3fdab06b145 | Artanic30/CS150-Database-and-Data-Mining-Project | /main.py | UTF-8 | 25,753 | 2.609375 | 3 | [] | no_license | import pandas as pd
import logging
import numpy as np
import re
import os
import json
from sklearn.feature_extraction import FeatureHasher
from sklearn.preprocessing import OneHotEncoder, LabelEncoder
from sklearn.experimental import enable_hist_gradient_boosting
from sklearn.ensemble import RandomForestClassifier, Vot... | true |
8da7741e31db3294b30409ff5680aaad685afda5 | Fitzclutchington/multi_cut_seg | /pymaxflow/dice_measurement.py | UTF-8 | 2,194 | 2.625 | 3 | [] | no_license | import numpy as np
import dicom
import sys
import glob
from scipy.misc import imread, imsave, comb
if len(sys.argv) < 3:
print "usage: python dice_measurement.py case class"
exit()
case = sys.argv[1]
multi_class = int(sys.argv[2])
GT_dir = case+'/DCM/GT'
seg_dir = case + '/test'
fil = GT_dir + '/*.dcm'
GT_fi... | true |
3b5b61f6e96395b0f3523032705495cea70f5e3b | therealgarrett/PyRepo | /Boulder/Jeopardy_Dice.py | UTF-8 | 7,111 | 3.21875 | 3 | [] | no_license | import random
import math
def main():
GAME_END_POINTS = 100
COMPUTER_HOLD = 10
is_user_turn = True
print("\n")
print(" __ __ ____ _ ")
print(" / /___ ____ ____ ____ _ _____ ____/ /__ __ / __ \ (_)_____ ___")
print... | true |
6f02d6d054f1390348e717a9e22196a8ee6adb4e | daavera/AvilaDaniel_Ejercicio05 | /bayes.py | UTF-8 | 1,003 | 2.9375 | 3 | [] | no_license |
# coding: utf-8
# In[127]:
import numpy as np
import matplotlib.pyplot as plt
# In[128]:
N = 1000
obs = ["s","c", "c", "c", "c"]
num_s = len(np.where(obs == "s"))
num_c = len(obs) - num_s
# In[129]:
H = np.linspace(1E-5,1-1E-5, N)
p_H = np.ones(N)
p_obs_H = (H**num_c)*((1-H)**num_s)
p_obs = np.trapz(p_obs_H... | true |
1ed7d2939888cf98821a5f58ceb132ba11b96c37 | will8211/my_euler_solutions | /euler_66/euler_66D.py | UTF-8 | 1,688 | 3.75 | 4 | [] | no_license | #!/usr/bin/env python3
'''
Diophantine equation
Problem 66
Consider quadratic Diophantine equations of the form:
x^2 – Dy^2 = 1
For example, when D=13, the minimal solution in x is 649^2 – 13×180^2 = 1.
It can be assumed that there are no solutions in positive integers when D is
square.
By finding minimal so... | true |
f09bc17cbd588b431cf847f392f4a8133f9b2aed | AdamZhouSE/pythonHomework | /Code/CodeRecords/2132/59308/264380.py | UTF-8 | 537 | 3.015625 | 3 | [] | no_license | ff = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
ff = [list(i) for i in ff]
s = list(input())
ans = list()
while s:
i = s[0]
for j in ff:
if i in j:
flag = True
for k in j:
if k not in s:
flag = False
... | true |
281d7ee28d5df2526b95ac9ccf501ca7389ea2c6 | bbalin12/DAT5_BOS_students | /jeppley16/Class8_Homework_JustinEppley.py | UTF-8 | 8,921 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 15 10:33:19 2015
@author: jeppley
"""
##########################
### HOMEWORK: Class 8 ###
##########################
import pandas as pd
import sqlite3 as sql
import numpy as np
from sklearn.preprocessing import Imputer as imp
from sklearn.naive_bayes import Multino... | true |
3c6e0e8c6482dc83239cc1bcc79dfa8536b1c8a6 | Anusha260/dictionary | /key separate.py | UTF-8 | 204 | 3.359375 | 3 | [] | no_license | dict={"a":"sindhu","b":"siri","c":"shabu"}
keys=[]
values=[]
items=dict.items()
for item in items:
keys.append(item[0])
values.append(item[1])
print("keys",":",keys)
print("values",":",values)
| true |
cdd5472565be51758901e10af92e215fae8c12e5 | SathishKumarD/Project-Euler | /69_totient_maximum.py | UTF-8 | 316 | 3.171875 | 3 | [] | no_license |
# coding: utf-8
# In[4]:
def isprime(n):
d=2
while n>d*d and not n%d ==0 :
d+=1
return n<d*d
pmult=0
mult=1
for x in range(2,1000000):
if isprime(x):
pmult=mult
mult*=x
#print mult
if mult > 1000000:
print pmult
break
# In[ ]:
| true |
c6dfe35c76dd4d08dcc0394df7af33433b6c47d2 | hayHarv/Pytime | /think_python/ch3.py | UTF-8 | 1,113 | 3.421875 | 3 | [] | no_license | """
+ - - - - + - - - - +
| | |
| | |
| | |
| | |
+ - - - - + - - - - +
| | |
| | |
| | |
| | |
+ - - - - + - - - - +
"""
def reflect(s):
return s + s[1:]
def reflect_n(s,n):
output ... | true |
59c7e8c4b103035d4333719b7dd610a8c646e75b | Do3956/test | /util/formatStr.py | UTF-8 | 482 | 2.6875 | 3 | [] | no_license | #coding:utf8
def formatName(name):
'''只要英文和数字'''
# highpoints = re.compile(u'[\uD800-\uDBFF][\uDC00-\uDFFF]')
# name = highpoints.sub(u'', name)
name = filter(str.isalnum, name)
return name
print formatName('123465789fdsagdfrtytr')
print formatName('123465789f%#@(*d+_)/*-./sagdfrtytr')
print forma... | true |
221ccbb71e17ae2f79170200dd7794fe325d33c5 | AaliyanK/PythonGUI-WeatherApp | /WeatherApp.py | UTF-8 | 1,936 | 3.578125 | 4 | [] | no_license | import tkinter as tk
# can use .place/.grid/.pack to place items on ur GUI
from tkinter import font
import requests
def test_function(entry):
print('this is the entry:', entry)
# e8cfcc42688907b56bd0dfefaa347b48
# api.openweathermap.org/data/2.5/forecast?q={city name},{state},{country code}&appid={your api key}
... | true |
b7fb32602396d5a215b839acb7c45e11477c2306 | rogalski/adventofcode-2017 | /day18/day18_part2.py | UTF-8 | 3,158 | 3.046875 | 3 | [] | no_license | import functools
import collections
RUNNING = 'RUNNING'
DONE = 'DONE'
QUEUE_EMPTY = 'QUEUE_EMPTY'
class Program:
def __init__(self, code, output_queue, input_queue):
self._code = code
self.output_queue = output_queue
self.input_queue = input_queue
self._instruction_pointer = 0
... | true |
cdb76ff92039a9b430944157d921c4dd152a3358 | milkqq/First_GitHub | /list.py | UTF-8 | 190 | 3.578125 | 4 | [] | no_license | a = [1,2,3,4,5]
b = [2,3,5,'abc',[99,'c','你']]
print(a[2])
print(b)
print(a[0], a[2], a[4], sep="~")
list1 = [1, 2, 3, 2, 3, 4, 2]
print("2一共出現{}次".format(list1.count(2)))
| true |
3867971c6f4275e53bf6537226fc9e885a2314ed | leekyunghun/Face_Recognition_TeamProject | /Detect_face/opencv.py | UTF-8 | 4,712 | 2.734375 | 3 | [] | no_license | # 종합_2 load_model
from cv2 import cv2
import numpy as np
import time
def face_classifier():
xml_path1 = "C:\Anaconda3\Lib\site-packages\cv2\data\haarcascade_frontalface_default.xml"
xml_path2 = "C:\Anaconda3\Lib\site-packages\cv2\data\haarcascade_profileface.xml"
xml_path3 = "C:\Anaconda3\Lib\site-packages... | true |
96770c42d85c6bccb877c1844411bb0ebc366fba | billshi18/dash-sample-apps | /apps/dash-image-segmentation/shapes_to_segmentations.py | UTF-8 | 4,106 | 2.921875 | 3 | [
"MIT"
] | permissive | import PIL.Image
import numpy as np
import skimage
import skimage.util
import skimage.io
import skimage.color
import shape_utils
from trainable_segmentation import fit_segmenter
import plotly.express as px
from sklearn.ensemble import RandomForestClassifier
from time import time
def img_to_ubyte_array(img):
"""
... | true |
d2a0ab6dbaab78baab2637daf30a1c5cfd288728 | jiupeiz/slis19springTextAnalysis | /getPosP.py | UTF-8 | 692 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# get pos-word pair
import csv
def get_PosP(filename):
words = list()
with open(filename) as f:
lines = f.readlines()
for line in lines:
if line.startswith("EOS"):
continue
word, info = line.rstrip().split("\... | true |
18c3185d64180403fc92dc3a0152107db7f5dbaf | jdipietro235/Project4Feature | /code/proj4.py | UTF-8 | 5,066 | 3.40625 | 3 | [] | no_license |
# Local Feature Stencil Code
# CS 589 Computater Vision, American Uniersity, Bei Xiao
# Adapted from James Hayes's MATLAB starter code for Project.2
# % This script
# % (1) Loads and resizes images
# % (2) Finds interest points in those images (you code this)
# % (3) Describes each interest point ... | true |
bff2627b505017f22d6d5f4a9b286dc8d1c3b2d5 | Remy-xl/python_data_structure_algorithm | /double_chain.py | UTF-8 | 772 | 3.515625 | 4 | [] | no_license | class Node(object):
def __init__(self,val):
self.data = val
self.next = None
self.prev = None
class LinkList(object):
def __init__(self):
self.head = 0
def initlist(self,data):
self.head = Node(data[0])
p = self.head
for i in data[1:]:
node... | true |
deb9fd644378958cdbd7a0b499fe35a80d3fa1aa | coderwf/confilter | /cfilter/visitor/myvisitor.py | UTF-8 | 9,986 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from cfilter.fantlr.CFilterVisitor import CFilterVisitor
from cfilter.fantlr.CFilter import CFilter
from cfilter.fantlr.CFLexer import CFLexer
from cfilter.visitor.nodes import *
class MyVisitor(CFilterVisitor):
logic_op_map = {
CFLexer.AND: "and",
CFLexer.OR: "or",
... | true |
ab46c4340b383bde2f62c13f7bb04cf4ed49ec63 | jiluhu/dirtysalt.github.io | /codes/contest/leetcode/number-of-subarrays-with-bounded-maximum.py | UTF-8 | 1,318 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python
# coding:utf-8
# Copyright (C) dirlt
"""
这题的动态规划很有意思
1. back[i+1]=j 表示截止到A[i], 那么A[j..i]所有的值都是在[L,R]之间的
2. dp[i+1] 则表示包含A[i]的话,有多少种组合
这里需要计算back的原因是,如果A[i]<L的话,那么只能使用之前的组合
但是如果A[i]在[L,R]范围的话,那么实际选择是有i-back[i]+1中选择的
"""
class Solution:
def numSubarrayBoundedMax(self, A, L, R):
"""
... | true |
0f1bff6a9d3fb41acec23eac9fa590bd80c8bcaa | TVATactic/TVAEmulator | /bpmf/bpmf.py | UTF-8 | 9,916 | 3.03125 | 3 | [] | no_license | import numpy as np
import pandas as pd
from numpy.random import multivariate_normal
from utilities import Normal_Wishart # this gives a symmetric matrix
def BPMF(R, R_test, U_in, V_in, T, D, initial_cutoff, lowest_rating, highest_rating, output_file,
mu_0=None, Beta_0=None, W_0=None, nu_0=None, save_file=T... | true |
56f6624058d834e33a04ba0971e16c51aa5ea882 | waforbes/initial-journey | /bikeshare_2.py | UTF-8 | 11,196 | 3.921875 | 4 | [] | no_license | import time
import calendar
import pandas as pd
import numpy as np
CITY_DATA = { 'chicago': 'chicago.csv',
'new york city': 'new_york_city.csv',
'washington': 'washington.csv' }
def get_filters():
"""
Asks user to specify a city, month, and day to analyze.
Returns... | true |
5b6809a50ae12b161ea9e7f4cfbb6b77f954acc0 | saurabhrajpoot6677/programming_files | /python/cipher.py | UTF-8 | 779 | 3.25 | 3 | [] | no_license |
def char(char1,num,flag):
l=[]
pos1=0
k=1
for i in range(97,123):
l.append(chr(i))
for pos,i in enumerate(l):
if i==char1:
pos1=pos1+pos
break
while k<num+1:
pos1+=1
... | true |
f8e05ef96a9f82ab7a92740a689a8cfafb73fcd2 | surapat12/DataStructAlgo-Grader-KMITL | /Week9/selection_rec.py | UTF-8 | 719 | 3.84375 | 4 | [] | no_license | def get_max_index(lst):
right = len(lst)-1
if lst[right] != max(lst) and right-1 >= 0:
return get_max_index(lst[:right])
else:
return right
def selection_sort_rec(lst, right=None):
if right is None:
right = len(lst)-1
if right < 0:
return lst
max_index = get_m... | true |
9ed18669dfad0a19ca54900736b3d1493a874e05 | IsaacDVM/main | /python/test2.py | UTF-8 | 661 | 3.453125 | 3 | [] | no_license | import math
a = int(input("Dame el término a en ax2+bx+c=0: "))
b = int(input("Dame el término b en ax2+bx+c=0: "))
c = int(input("Dame el término c en ax2+bx+c=0: "))
if b*b-4*a*c < 0:
print("Esta ecuación no tiene solución")
print("Esta ecuación no tiene solución")
print("Esta ecuación no tiene solución")... | true |
a77c5fe39844e3ed7633163893067cdcf95d2d47 | nicholaskh/lad-crawler | /lad/lad/spiders/qinghai_spider_new.py | UTF-8 | 2,645 | 2.59375 | 3 | [] | no_license | #coding=utf-8
import scrapy
import re
from lad.items import LadItem
from ..spiders.beautifulSoup import processText
from datetime import datetime
from basespider import BaseTimeCheckSpider
class newsSpider(BaseTimeCheckSpider):
name = "qinghainew"
districts = ['Category_115', 'Category_111']
start_urls = ... | true |
c0021afb219b6a3ccf3d38c04d4c0a163a288669 | h2oai/h2o-3 | /h2o-py/h2o/model/extensions/feature_interaction.py | UTF-8 | 2,636 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | import h2o
class FeatureInteraction:
def _feature_interaction(self, max_interaction_depth=100, max_tree_depth=100, max_deepening=-1, path=None):
"""
Feature interactions and importance, leaf statistics and split value histograms in a tabular form.
Available for XGBoost and GBM.
M... | true |
ea0d77add2eee51eb7daf465d14dd46a538b4830 | vertr1995/codecademy_k-nearest | /k-nearest.py | UTF-8 | 3,224 | 3.3125 | 3 | [] | no_license | from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
import matplotlib.pyplot as plt
import numpy as np
#finding the best value of K with the use of KNeighborsClassifier
breast_cancer_data = load_breast_cancer()
training... | true |
5e98d67b1472f992f090932dacb61925d340a201 | PaLaMuNDeR/algorithms | /Algo Expert/106_subarray_sort.py | UTF-8 | 1,519 | 4.53125 | 5 | [] | no_license | """
Subarray Sort
Write a function that takes in an array of integers of length at least 2. The function should return an array of the
starting and ending indices of the smallest subarray in the input array that needs to be sorted in place in order for
the entire input array to be sorted. If the input array is alre... | true |
5bfc8481a6e8b22695209a1bc226d4feb88f87f9 | fumiz/read2vec | /read2vec/preproc/english/segmenter/segmenter.py | UTF-8 | 251 | 2.765625 | 3 | [
"MIT"
] | permissive | import nltk
class Segmenter(object):
def __init__(self):
self.tokenize = nltk.tokenize.wordpunct_tokenize
def separate(self, text):
return self.tokenize(text)
def segment(self, text):
return self.separate(text)
| true |
79a2924d87b3c4090bc2cbde422aff508038af33 | K-Class/Her-Seviyeye-Uygun-Python-Egzersizleri | /02-Kolay Seviye/02-Cevaplar/py/K09-Cevap.py | UTF-8 | 604 | 3.375 | 3 | [] | no_license | def say(yazi):
ara = yazi.lower()
harfler = set("abcçdefgğhıijklmnoöprsştuüvyz")
rakam = set("0123456789")
sayılanHarf = 0
sayılanRakam = 0
for karakter in ara:
if karakter in harfler:
sayılanHarf += 1
elif karakter in rakam:
sayılanRakam +=1
return {... | true |
edf0e232f619f40651dae98b82ae23261ad0af42 | BenWiederhake/random_tweets | /feel_random.py | UTF-8 | 1,828 | 3.75 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# Want:
# * Initially, uniform random distribution
# * If new elements appear, they are likely to be picked
# * If an element is picked, it is unlikely to be picked again soon
# * Long-ago-elements are roughly of the same probability (prevent permutation-lock)
# So:
# - Among new elements, pick... | true |
eef10641a566b4ca161c59627403444922048324 | hvy/chainer-spatial-transformer-networks | /extensions.py | UTF-8 | 2,361 | 2.578125 | 3 | [] | no_license | import matplotlib # NOQA
matplotlib.use('Agg') # NOQA
import math
import os
from chainer import cuda
from chainer.training import extension
import matplotlib.pyplot as plt
import numpy as np
class SamplingGridVisualizer(extension.Extension):
def __init__(self, x, dpi=100):
self.x = x
self.dpi ... | true |
d86d3d3bc7c06f5a06a957d12da04cc35c80f59a | ERIGrid2/benchmark-model-electrical-ict | /Implementation Files/Power Grid/OPC_Python/CreateGenLoadMeas.py | UTF-8 | 10,606 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | import powerfactory
import ReplaceInvalidChars
import SetStatus
def Execute(pfApp: "powerfactory.Application"=None, sTagPrefix: str='PF.', sSeparator: str=',', iDebug: int=0) -> int:
"""
Creates external measurements for all generators (ElmSym, ElmGenstat):
* base name <BASE_NAME> = Gen_<V... | true |
044fb2fe20e6d58927a8cec8996fb8ff8bcfb7a7 | manavkapadnis/ML-Reserve | /Iris Prediction Android App /model.py | UTF-8 | 869 | 2.5625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Spyder Editor
"""
import pandas as pd
import numpy as np
import tensorflow as tf
from sklearn.preprocessing import LabelEncoder
from keras.utils import to_categorical
df = pd.read_csv('iris.data')
X = df.iloc[:, :4].values
y = df.iloc[:, 4].values
le = LabelEncoder()
y = le.fit_transfo... | true |
70e1bb5b7b2b1dec3bc85955d704079d451646f8 | shanenoi/i3status | /i3status/ip.py | UTF-8 | 289 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import json
import urllib.request
with urllib.request.urlopen("https://ipv4.geojs.io/v1/ip/geo.json") as url:
data = json.loads(url.read().decode())
str = " " + data['ip'] + " (" + data['city'] + ", " + data['country_code'] + ")"
print(str, end='')
| true |
6c5d50bb75473d9102ac0863da62edb2a00c25a4 | lyxmegan/Natural_Language_Processing | /a0-distrib/tokenizer.py | UTF-8 | 1,663 | 3.609375 | 4 | [] | no_license | # tokenizer.py
import re
#understanding:
#result = re.sub(pattern, repl, string, count=0, flags=0);
#result = re.sub('abc', '', input) # Delete pattern abc
#result = re.sub('abc', 'def', input) # Replace pattern abc -> def
#result = re.sub(r'\s+', ' ', input) # Eliminate duplicat... | true |
8fed3d7f629b887584396308f83155020405836f | maqianghua/PythonStudy | /workdir/py_django/booktest/20171124/test13.py | UTF-8 | 103 | 2.6875 | 3 | [] | no_license | class TestA:
attr=1
obj_a=TestA()
obj_b=TestA()
obj_a.attr=42
print (obj_b.attr)
print (obj_a.attr) | true |
7e32d19fc7f91a71cd6a6a6e08627fc6bd6f1407 | chalam/Pynaconda | /src/strings/palindrome.py | UTF-8 | 911 | 3.90625 | 4 | [] | no_license | def is_palindrome(s):
i = 0
j = len(s) - 1
while i < j:
if s[i] != s[j]:
return False
i += 1
j -= 1
return True
def is_palindrome_recur(s):
if len(s) <= 1: # single or no char
return True
else:
return s[0] == s[-1] and is_palindrome_recur(s[1:... | true |
ebbe681bc8a9da86d103c50b2505a398124b4a5e | 112EasonLu/Python-Practice | /ShareBack Python_Fundamental Course/train.py | UTF-8 | 127 | 2.640625 | 3 | [] | no_license | def sayhi():
print("hello word")
if __name__ == "__main__":
sayhi()
#print("Fuck you")
#else:
#sayhi()
#print("Shit") | true |
4787c79b23e9ac79a3813d790428fca75f0fbcfe | frenzytejask98/VR_Assignment2 | /Panorama/stitch.py | UTF-8 | 550 | 2.546875 | 3 | [] | no_license | from panorama import Panorama
import imutils
import cv2
imageA = cv2.imread('secondPic1.jpg')
imageB = cv2.imread('secondPic2.jpg')
img1 = imutils.resize(imageA, width=400)
img2 = imutils.resize(imageB, width=400)
panorama = Panorama()
(result, matched_points) = panorama.image_stitch([img1, img2], match_sta... | true |
5a6345b7e2b0c678e2291d61184d84f4498e119b | FeherBalazs/docker-api-skeleton | /plot_results.py | UTF-8 | 1,350 | 2.96875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.metrics import confusion_matrix
def print_confusion_matrix(confusion_matrix, class_names, figsize=(10, 7), fontsize=14, cmap=None):
df_cm = pd.DataFrame(confusion_matrix, index=class_names, columns=class_name... | true |
51ec2c50b04395df8e2de2922b3e279e4ec945f2 | cromox1/KodPerang_kata | /4kyu_snail3.py | UTF-8 | 1,181 | 3.6875 | 4 | [] | no_license | def snail(snail_map):
n = len(snail_map)
out = []
if len(snail_map[0]) != n:
print('ERROR')
else:
for total in range(2*(n-1)):
j = total
i = total - j
while i < n and j < n:
out = outall(out, snail_map[i][j])
j += 1
... | true |
230d266a99f7a9adc02162c2cd919175897c0eef | Aasthaengg/IBMdataset | /Python_codes/p03214/s498564861.py | UTF-8 | 214 | 2.828125 | 3 | [] | no_license | N = int(input())
A = list(map(int,input().split()))
mean_a = sum(A)/N
distance_list = [abs(a - (mean_a)) for a in A]
for i in range(N):
if min(distance_list) == distance_list[i]:
ans = i
break
print(ans) | true |
e4155a0fa59fa588bf3efd330f0ceb166df51c75 | alifa-ara-heya/My-Journey-With-Python | /day_20/alien_dictionary.py | UTF-8 | 4,505 | 4.28125 | 4 | [] | no_license | # Day_20: August/16/2020
# In the name 0f Allah..
# Me: Alifa
# Python Crash Course by Eric Matthes (Chapter: 6 [Dictionaries])
alien_0 = {'color' : 'green', 'points' : 5}
print(alien_0['color']) # green
print(alien_0['points']) # 5
new_points = alien_0['points']
print('You just earned ' + str(new_po... | true |
6bb3a3a9d10f6c8b2cd787498e81880cfec89bb0 | tzalejo/pyhton-base | /curso_basico_python/codicionales.py | UTF-8 | 136 | 3.125 | 3 | [] | no_license | # comantario..
edad = int(input('Escriba su edad: '))
if edad >= 18:
print('Es mayor de edad')
else:
print('Es menor de edad')
| true |
90ea9ee864425181b852d47318e161d16071e49d | oppZ/Bataille-Navale | /Gui Version/BatailleNavale.py | UTF-8 | 21,163 | 3.046875 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk
from tkinter import messagebox
from random import *
from copy import *
from math import *
import time
NUMBER_DEFAULT_LINES = 10
NUMBER_MIN_LINES = 5
NUMBER_MAX_LINES = 10
NUMBER_DEFAULT_COLUMNS = 10
NUMBER_MIN_COLUMNS = 5
NUMBER_MAX_COLUMNS = 10
#Taille en pixel de la gr... | true |
6a86db8941c4a4e53582ad076eafc1749e6de72b | sansyrox/python-design-patterns | /design-patterns-101/Dog.py | UTF-8 | 157 | 2.609375 | 3 | [
"MIT"
] | permissive | from .Animal import Animal
class Dog(Animal):
def __init__(self):
super().setSound("Bark")
def digHole(self):
print("Dug a Hole")
| true |
0bbf3c7a1ee77b0594db0b8fb7d7022df06db1de | DogDod/manim | /topics/three_dimensions.py | UTF-8 | 2,575 | 2.578125 | 3 | [] | no_license |
from helpers import *
from mobject.vectorized_mobject import VGroup
from topics.geometry import Square
from scene import Scene
from camera import Camera
class ThreeDCamera(Camera):
CONFIG = {
"sun_vect" : UP+LEFT,
"shading_factor" : 0.5,
}
def __init__(self, *args, **kwargs):
Came... | true |
d62d67d9ae59f741801d644a764088c88c378d28 | jarrisonfor/DAW-Python | /Tema 1/1.32.py | UTF-8 | 1,403 | 4.21875 | 4 | [] | no_license | """
A-1.32 - Recursividad. Descomposiciones de un número natural
Diseñe e implemente un algoritmo que imprima todas las posibles descomposiciones de un número natural como suma de números menores que él.
1 = 1
2 = 1 + 1
3 = 2 + 1
3 = 1 + 1 + 1
4 = 3 + 1
4 = 2 + 1 + 1
4 = 1 + 1 + 1 + 1
4 = 2 + 2
5 = 3 + 2
5 = 4 + 1
5 = ... | true |
a50c9809a48990d84d130d67a74f24cbadc21790 | xiaohan2012/signed-local-community | /test_eval_helpers.py | UTF-8 | 1,389 | 2.921875 | 3 | [] | no_license | import pytest
import networkx as nx
from eval_helpers import (
edge_agreement_ratio,
evaluate_level_1,
evaluate_level_2
)
@pytest.fixture
def g():
graph_name = 'toy'
path = 'graphs/{}.pkl'.format(graph_name)
return nx.read_gpickle(path)
def test_edge_agreement_ratio(g):
A = nx.adjacency_... | true |
2ee1c67b37387022a6793d806c47b33b683beae6 | shivjeetbhullar/All_Packages_Versions | /pi7db versions/pi7db 0.3.5/build/lib/pi7db/cryptopidb/__init__.py | UTF-8 | 952 | 2.875 | 3 | [
"MIT"
] | permissive | from Crypto import Random
import base64
from Crypto.Cipher import AES
from binascii import hexlify
def genkey(password_provided):
return hexlify(password_provided.encode())
def pad(s):
return s + b"\0" * (AES.block_size - len(s) % AES.block_size)
def encrypt(message, key, key_size=256):
message = pad(mes... | true |
8f394b84e1a426618858a2da6de3460a594e24a6 | dnaeon/pvc | /src/pvc/widget/radiolist.py | UTF-8 | 2,839 | 2.6875 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause",
"LicenseRef-scancode-bsd-unchanged"
] | permissive | # Copyright (c) 2015 Marin Atanasov Nikolov <dnaeon@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, th... | true |
fb31a709e3cad0535df4cf38be4f74648d70b0ca | kelpasa/Code_Wars_Python | /6 кю/Proof Read.py | UTF-8 | 799 | 3.875 | 4 | [] | no_license | '''
You've just finished writing the last chapter for your novel when a virus suddenly infects your document. It has swapped the 'i's and 'e's in 'ei' words and capitalised random letters. Write a function which will:
a) remove the spelling errors in 'ei' words. (Example of 'ei' words: their, caffeine, deceive, weight... | true |
f7d7ab2d59a7f9b97f6742779d0bb2c635d1f175 | mccnudt/mycode | /playcards.py | UTF-8 | 3,260 | 4.0625 | 4 | [] | no_license | class Card():
# 定义牌面数字
RANKS = ["A", "2", "3", "4", "5", "6",
"7", "8", "9", "10", "J", "Q", "K"]
# 定义纸牌花色
SUITS = ["梅", "方", "红", "黑"]
# 初始化牌面、花色、是否显示正面
def __init__(self, rank, suit, face_up=True):
self.rank = rank # 指牌面数字1-13
self.suit = suit # 指牌面花色
se... | true |
7c71b3d8e71752929a246975ba8c4b5650867418 | redbooth/zendesk-help-center-backer | /zendesk/scripts/startup_changes.py | UTF-8 | 3,026 | 2.828125 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | """
Ensures that any changes made to "posts" while track-changes.py
wasn't running are fixed.
"""
import os
import shutil
import renderer
import file_constants
from filecmp import dircmp
FILE_FORMATS = file_constants.FILE_FORMATS
def sync_offline_changes(first, second):
# Delete files/dirs that are no longer ... | true |
f91b5834c99b27344a268f85fa3e24a873a8860c | jancajthaml-python/damm | /tests/damm_test.py | UTF-8 | 1,149 | 2.796875 | 3 | [
"Unlicense"
] | permissive | import os, sys
sys.path.append(os.path.realpath(os.path.join(os.path.dirname(__file__), '..')))
import unittest
import damm
class TestDamm(unittest.TestCase):
def test_digit(self):
tests = [
("0012301476470096832", 5),
("xy-1", None)
]
for t in tests:
number, expected = t
valid... | true |
5ed5c306cfe57ea09ff082cc89d56c33d427cb33 | BLKMR/Advent-of-Code-2020 | /AOC3.py | UTF-8 | 1,174 | 3.875 | 4 | [] | no_license | inputfile = open('trees.txt', 'r')
# Parse lines
data = [x.strip() for x in inputfile.readlines()]
def part1(data):
x = 0 # X is current column
total = 0 # Count of trees
map_width = len(data[0])
map_height = len(data)
for y in range(map_hei... | true |
87b70ac22bb9ba5ae5c53eb7550b12c82ec5c021 | eugeneteo/reference-toolkit | /language_conversion.py | UTF-8 | 15,727 | 3.4375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
u"""
language_conversion_list.py (12/2019)
Mapping for converting to/from python unicode for special characters
1st column: latex format for output bibtex files
2nd column: character with combining modifier unicode
3rd column: precomposed character and modifier unicode
4th column: ... | true |
50ea50269ba520488e6f4a85c9c9a31436bb8b5e | sanadi-rohit/twoplayerchess | /chess.py | UTF-8 | 4,969 | 2.765625 | 3 | [] | no_license | from tkinter import *
root=Tk()
root.title("CHESS")
root.configure(bg="White")
lst=[]
alpha=[]
for i in range(8):
but=[]
num=[]
for j in range(8):
num.append(j)
but.append(j)
alpha.append(num)
lst.append(but)
def colorbut(i,j):
return (i+j)%2
print(lst)
lt=[0,1,2,3,4,5,6,7]
col... | true |
e027b7798dbcfd9c8a1b1a894bab45aa8c09960a | andykitchen/ml-misc | /meta-net/data.py | UTF-8 | 1,433 | 2.625 | 3 | [] | no_license | import collections
import gzip, cPickle
import numpy
import theano
import theano.tensor as T
Data = collections.namedtuple('Data', ['x', 'y', 'size'])
def load_mnist(dataset):
with gzip.open(dataset, 'rb') as f:
train_raw, valid_raw, test_raw = cPickle.load(f)
def theano_load(data_x, data_y):
shared_x = thea... | true |
eb998d49aed91181b10d4fa24a78489235df44a0 | Imfirn/PythonLab | /Lab4/Canteen.py | UTF-8 | 1,128 | 3.453125 | 3 | [] | no_license | class Queue:
def __init__(self):
self.items = []
def Is_Empty(self):
return self.items == []
def Enqueue(self, data):
self.items.append(data)
def Dequeue(self):
return self.items.pop(0)
def size(self):
return len(self.items)
def index(self... | true |
6e93e714a7c81da2cfd9ebcd5c67785aa862f0f3 | sslogar/text-project | /trumpText.py | UTF-8 | 4,931 | 2.921875 | 3 | [] | no_license | import pandas as pd
import nltk
import re
import string
from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from sentiment_module import sentiment
import numpy as np
import sklearn
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.clu... | true |
720d731e95d58e53d9a7e55926c501f0fd1c8a1c | henry32144/neural-style | /models/mask_style/mask_utils.py | UTF-8 | 4,309 | 2.78125 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import patches, lines
from matplotlib.patches import Polygon
from skimage.measure import find_contours
def all_black_colors(N):
"""
Generate all black colors
"""
black = [(0, 0, 0) for i in range(N)]
return black
def apply_mask(im... | true |
48f6853f48d33bec1e0ea58595fd53fbf1ad6145 | marioba/faloppia | /app/utils/message_sender.py | UTF-8 | 5,922 | 2.640625 | 3 | [] | no_license | import logging
import plivo
from time import sleep
from app.utils.utils import StandardAlertLevels, remove_duplicates
from app.utils.utils import ApiStatuses
class MessageSender(object):
"""
Class used to send alerts to users
"""
RETRY = 5 # how many times will we retry calling the send_message API... | true |
a69ba1cd516742f3e92dbcb1d17ef9e7ed4b7d84 | eyuelberga/Email-Harvester | /main.py | UTF-8 | 2,732 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python3
from bs4 import BeautifulSoup
import requests
import requests.exceptions
import urllib.parse
import re
def is_valid_url(url):
parsed = urllib.parse.urlparse(url)
return bool(parsed.netloc) and bool(parsed.scheme) and (parsed.scheme == "http" or parsed.scheme == "https")
def get_links(url)... | true |
7bd49007c1a0ad4ec8feabea8b2eba59c7b50b81 | h232ch/zapapipython | /testpy/zapPython/testpython/test.py | UTF-8 | 259 | 2.609375 | 3 | [] | no_license | '''
Created on 2020. 8. 23
@author: dnwn7
'''
f = open("../htmlparser/test.html", 'w')
data = "test"
f.write(data)
f.close
f = open("../htmlparser/test.html", 'r')
while True:
line = f.readline()
if not line:
break
print(line)
f.close() | true |
478ddf87df1b289343f1ea41d93165df7e141bbd | expoli/Learn-tensorflow | /BEGINNER/Load and preprocess data/pandas.DataFrame/Load a pandas.DataFrame.py | UTF-8 | 1,740 | 2.53125 | 3 | [
"MIT"
] | permissive | from __future__ import absolute_import, division, print_function, unicode_literals
# !pip install -q tensorflow-gpu==2.0.0-rc1
import pandas as pd
import tensorflow as tf
csv_file = tf.keras.utils.get_file('heart.csv', 'https://storage.googleapis.com/applied-dl/heart.csv')
df = pd.read_csv(csv_file)
df.head()
df.d... | true |
d94f10296ca4c670cfbe6018a4d9f3b4881b6601 | Tester-Dolores/python-practice | /boring/what_to_eat.py | UTF-8 | 1,353 | 3.65625 | 4 | [] | no_license | import random
foods = [
"番茄汤冒菜",
"蛋炒饭",
"亲爱的麻辣烫",
"烤肉饭",
"皮蛋瘦肉粥",
"炒河粉",
"螺蛳粉",
"螺蛳粉+奶茶",
"番茄汤冒菜+奶茶",
"蛋炒饭+奶茶",
"亲爱的麻辣烫+奶茶",
"烤肉饭+奶茶",
"炒河粉+奶茶",
]
milk_tea = 0 # 喝奶茶次数
spicyfood = 0 # 辛辣食物次数
delete_foods = [] # 即将被删除的食物
print("规则:\n 1. 一周不能... | true |
168d5098d4cf12c4402868d6edc2d7bdaefd735c | seuqaj114/numpyflow | /numpyflow/ops/inputs.py | UTF-8 | 1,645 | 2.859375 | 3 | [] | no_license | import numpy as np
from ..graph import graph
from .base_ops import AddOp
class Variable:
# Variable class - we try to copy numpy's operations
def __init__(self, name, shape, value=0.0):
assert isinstance(shape, list) or isinstance(shape, tuple)
self.value = value*np.ones(shape)
self.sh... | true |
7744a5c045ca84ceeddf55fd774732ce7602a871 | xiaoyongaa/ALL | /选课系统/选课系统/bin/admin-start.py | UTF-8 | 3,417 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import os
import sys
import pickle
path=os.path.abspath(__file__)
path=os.path.dirname(os.path.dirname(path))
sys.path.append(path)
os.chdir(path)
from src import admin
all_kecheng=pickle.load(open("db/kecheng.txt","rb"))
all_teacheer=pickle.load(open("db/teacher.txt","rb"))
def login():
falg=True
msg=["1.删除课程"... | true |
cb1dba1b8caac41358ccd4139888408ff9d5ac9c | MarcosRibas/Projeto100Exercicios | /Python/ex041.py | UTF-8 | 734 | 4 | 4 | [
"MIT"
] | permissive | #Ex041 A Confederação Nacional de Natação precisa de um programa que leia o ano de nascimento de um atleta e mostre
# sua categoria, de acordo com a idade:
#- Até 9 anos: MIRIM
#- Até 14 anos: INFANTIL
#- Até 19 anos: JUNIOR
#- Até 20 anos: SÊNIOR
#- Acima: Master
from datetime import datetime
now = datetime.now()
ano ... | true |
c521c94ca6cf0e3febd332b12d7ea6df353666c5 | kubeflow/testing | /py/kubeflow/testing/go-license-tools/get_github_license_info.py | UTF-8 | 4,007 | 2.75 | 3 | [
"Apache-2.0",
"CDDL-1.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"GPL-1.0-or-later",
"BSD-3-Clause"
] | permissive | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | true |
8b32c793d0d2b200d38eaed62b42345b8f957ca1 | Zsailer/jupyter-projects | /jupyter_projects/db.py | UTF-8 | 2,255 | 2.65625 | 3 | [] | no_license | """Leverage JupyterHub's database API to avoid building
an incompatible DB from scratch...
"""
import os
import pathlib
from jupyterhub.orm import (
User,
Group,
APIToken,
Base,
new_session_factory
)
from sqlalchemy import (
Column,
Integer,
Unicode,
Table,
ForeignKey,
)
from sq... | true |
c7cc189469ebcaa418594b41649f4fc0e61d170d | jenan-morrar/Problems_Solving | /Longest_Common_Prefix.py | UTF-8 | 920 | 4.125 | 4 | [] | no_license | """
Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string "".
"""
class Solution(object):
def longestCommonPrefix(self, string_lst):
if len(string_lst) == 0:
return ""
current = string_lst[0]
for i in range(1, le... | true |
f4f87707ef020e602fa86558c58cc2836854739b | akaija/DaTa-Vu | /data_vu/figures.py | UTF-8 | 4,802 | 2.875 | 3 | [] | no_license | import os
import matplotlib.pyplot as plt
from data_vu.utilities import *
from data_vu.queries import *
from data_vu.files import load_config_file
from data_vu.plotting import *
def plot_HTSOHM(
run_id,
generations,
z_bins,
data_types,
axes = [
['vf', 'sa'],
... | true |
a64dbc300c9fda564189b67f4ee620f9cc1807ee | garywolk/PyTAAADL | /functions/readSymbols.py | UTF-8 | 25,025 | 2.640625 | 3 | [] | no_license | '''
Created on May 12, 202
@author: donaldpg
'''
def get_RU1000List( verbose=True ):
# set some excluded tickers that are note downloaded by yah**
excluded_tickers = ['ACET', 'ACXM', 'BOFI', 'GOV', 'HBHC', 'HYH'] # 'OCLR', 'SONC'
###
### Query wikipedia.com for updated list of stocks in S&P 1000 ... | true |
3da622c879218569e20c24085e58419c615aa83d | gautam1989/python_nltk | /com/twitter/genderClass.py | UTF-8 | 3,352 | 2.96875 | 3 | [] | no_license | from statistics import mode
import nltk
import random
from nltk.corpus import names
from sklearn.linear_model import LogisticRegression, SGDClassifier
from sklearn.naive_bayes import MultinomialNB, BernoulliNB
from sklearn.svm import LinearSVC, NuSVC
class VoteClassifier(nltk.ClassifierI):
def __init__(self, *cla... | true |
06f8ff85d875d122ba4ce062c8fa3adbdd924841 | joshp123/Project-Euler | /6.py | UTF-8 | 628 | 4.03125 | 4 | [] | no_license | # Problem 6
#The sum of the squares of the first ten natural numbers is,
#12 + 22 + ... + 102 = 385
#The square of the sum of the first ten natural numbers is,
#(1 + 2 + ... + 10)2 = 552 = 3025
#Hence the difference between the sum of the squares of the first ten natural numbers and the #square of the sum is 3025 38... | true |
214e4913dc8dd048d45ed71f56c0ce64cd27413c | ztly/api_framework | /tests/test_core.py | UTF-8 | 2,333 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
from tests.api.httpbin import HttpGet, HttpPost, HttpGetCookies, HttpGetSetCookies
def test_get():
HttpGet().\
run().\
validate("status_code", 200).\
validate("headers.server", "nginx")
def test_get_with_paramers():
HttpGet().\
set_para... | true |
5c1daa2618a1c78370d53525abb178decdcf9f6a | jabarragann/DesignPatternsCourse | /IntroductionCourse/BehavioralPattern/12_Visitor.py | UTF-8 | 1,026 | 3.90625 | 4 | [] | no_license | class House(object):
def __init__(self):
electricityFix =False
acFix = False
def accept(self, visitor):
"""Interface to accept a visitor"""
visitor.visit(self)
def work_on_hvac(self, hvac_specialist):
print(self, "worked on by", hvac_specialist)
def work_on_e... | true |
02b521b79fcf45a069fffa2efe5902ceecfd934c | imsilence/huawei_nowcoder | /hj64.py | UTF-8 | 945 | 3.03125 | 3 | [] | no_license | #encoding: utf-8
def solution():
n = int(input())
ops = input()
current = 1
items = list(range(1, min(n, 4) + 1))
for op in ops:
if op == 'U':
current -= 1
if current <= 0:
current += n
items = list(range(max(1, n-4 + 1), n + 1))
... | true |
0bba5e850c0c2463d3f2ab6fd1108ca3e510dba5 | toby82/shell | /local_hostname_ip.py | UTF-8 | 579 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
import socket
import sys
import commands
def _local_hostname():
return commands.getoutput('hostname')
def _local_ip(cc_host,port):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except socket.error, msg:
print 'Failed to create socket.Error code:' + str(msg[... | true |
7d795efdf700fb122f23cd08572c8aadb34d38d1 | YXY980102/YXY980102 | /21,三角函数.py | UTF-8 | 909 | 4.59375 | 5 | [] | no_license | '''
函数 描述
acos(x) 返回x的反余弦弧度值。
asin(x) 返回x的反正弦弧度值。
atan(x) 返回x的反正切弧度值。
atan2(y, x) 返回给定的 X 及 Y 坐标值的反正切值。
cos(x) 返回x的弧度的余弦值。
hypot(x, y) 返回欧几里德范数 sqrt(x*x + y*y)。
sin(x) 返回的x弧度的正弦值。
tan(x) 返回x弧度的正切值。
degrees(x) 将弧度转换为角度,如degrees(math.pi/2) , 返回9... | true |
a319e452bd19499bebf2166f6a726083e5c699e1 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_155/635.py | UTF-8 | 758 | 2.859375 | 3 | [] | no_license | import math
inf = open("in.in", "r")
ouf = open('out.out','w')
def close_files():
inf.close()
ouf.close()
def precount():
pass
printcounter = 0
def printstr(a):
global printcounter
printcounter +=1
print ('Case #%d: %s' % (printcounter,a), file=ouf)
d... | true |
58ea9577243d9123acc8baf4ea35864748ac2e77 | mikemccabe/code | /locations.py | UTF-8 | 803 | 2.8125 | 3 | [] | no_license | grid = [
[ 524, 523, 522, 521, 520, 519, 518, 517, 516 ],
[ 546, 546, 531, 530, 529, 528, 527, 526, 525 ],
[ 546, 546, 537, 536, 535, 534, 533, 532, 0 ]
]
mappings = {}
def make_grid_mappings():
rownum = 0
for row in grid:
colnum = 0
for col in row:
mappings[grid[ro... | true |
6f29b778aeb917b5c871c4be8d567c059975c399 | sobson125/crypto-classes-python | /Saving_Passwords/src/Password_Utils.py | UTF-8 | 424 | 3.296875 | 3 | [] | no_license | import hashlib
class PasswordUtils:
@staticmethod
def hash_password(password: str, salt: bytes) -> str:
hashed_pass = hashlib.pbkdf2_hmac("sha256", password.encode("utf-8"), salt, 100000)
return hashed_pass.hex()
@staticmethod
def verify_password(stored_password: str, input_password:... | true |
9fb91e30104924db62a10edf6c9f6035c016db64 | alltheplaces/alltheplaces | /locations/spiders/athleta.py | UTF-8 | 2,566 | 2.515625 | 3 | [
"CC0-1.0",
"MIT"
] | permissive | import json
import scrapy
from locations.hours import OpeningHours
from locations.items import Feature
class AthletaSpider(scrapy.Spider):
name = "athleta"
item_attributes = {"brand": "Athleta", "brand_wikidata": "Q105722424"}
athleta_url = "https://athleta.gap.com"
athleta_store_url = "https://athl... | true |
ce9af22813e78a3d7d56eb6a6fd11be664003242 | vivekaxl/LexisNexis | /ExtractFeatures/Data/thesantosh/test_utils.py | UTF-8 | 4,954 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import urllib
from django.conf import settings
from django.utils.translation import get_langua... | true |
4e9d5133042784d8718b17386373b257f9942d7a | josephcalver/CompleteDataStructuresAndAlgorithmsInPython | /LinkedLists/linked_list.py | UTF-8 | 4,500 | 4.0625 | 4 | [] | no_license | from random import randint
class Node:
def __init__(self, value=None):
self.value = value
self.previous = None
self.next = None
def __str__(self):
return str(self.value)
class LinkedList:
def __init__(self):
self.head = None
self.tail = None
def __... | true |
c560f0c86f2877d3f0b0acea6d38e236d89ce612 | Jon1bek/Python_darslari | /21-dars.py | UTF-8 | 393 | 3.59375 | 4 | [] | no_license | class Talaba:
def __init__(self,ism,familiya,t_yil):
self.ism = ism
self.familiya = familiya
self.t_til = t_yil
self.kursi = 1
def tanishtir(self):
return(f"Ismim {self.ism} familiyam {self.familiya} tug`ilgan yilim {self.t_yil}")
talaba1 = Talaba("Jonibek","O`ralov",2001... | true |
d73487ab313ca81f6c8fb0830c004dac9580f772 | nyccowgirl/coding-challenges | /hackbright/pangram.py | UTF-8 | 1,056 | 3.765625 | 4 | [] | no_license | """Given a string, return True if it is a pangram, False otherwise.
For example::
>>> is_pangram("The quick brown fox jumps over the lazy dog!")
True
>>> is_pangram("I love cats, but not mice")
False
"""
def is_pangram(sentence):
"""Given a string, return True if it is a pangram, False otherwis... | true |
b06fc1b50f09c5f59cdbd2b3563af2bd0466e1da | QiangZhurock/qiangzhuleetcode | /015_3sum/learnbetter.py | UTF-8 | 2,007 | 3.953125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Given an array S of n integers, are there elements a, b, c in S such that a +
b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Note:
Elements in a triplet (a,b,c) must be in non-descending order. (ie, a ≤ b ≤ c)
The solution set must not contain duplicate triplet... | true |
ab9120670239295b80a5d9d1a503da8f2d1e7954 | bryonb97/Coding_Dojo | /CodingDojo/Python/Django/Django_Full_Stack/Belt_Exam/apps/HandyHelper/models.py | UTF-8 | 5,610 | 2.8125 | 3 | [] | no_license | from django.db import models
from django.contrib import messages
import bcrypt
# User Validations
class UserManager(models.Manager):
def registration_validator(self, postData, request):
isValid = True
# user first name cannot be fewer than 2 characters
if len(postData['reg_first_name']) < 2... | true |