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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
12a7d302c259a688228843bbb09bd5b622513fdc | Python | msaad1311/Flight-Fare | /Scripts/Utils.py | UTF-8 | 4,575 | 3.203125 | 3 | [] | no_license | import pandas as pd
import numpy as np
# from IPython.display import display
import holidays
from math import sqrt
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.ensemble import ExtraTreesRegressor
from sklearn.metrics import mean_squared_error as mse
from sklearn.metrics import mean_absolute_error... | true |
cedac8f7b24a766eb081e99cac702d418d3d799e | Python | shreyasseshadri99/lab-1 | /DSA/6/1.py | UTF-8 | 5,847 | 3.5 | 4 | [] | no_license | import random
class TreeNode:
def __init__(self, value=None, parent=None, left=None, right=None, height=None):
self.parent = parent
self.value = value
self.left = left
self.right = right
self.h = height
def preorder(root):
if root is None:
return
... | true |
f5aa2d8fcc16bf69ddf1f88d23670b09d68a7657 | Python | maelstrom9/DS-and-Algorithms | /EPI/BinaryTrees/postorder_traversal.py | UTF-8 | 852 | 4.21875 | 4 | [] | no_license |
class Tree:
def __init__(self,val):
self.val = val
self.left = None
self.right = None
def postorder_recursion(root):
temp = []
if root.left:
temp.extend(postorder_recursion(root.left))
if root.right:
temp.extend(postorder_recursion(root.right))
temp.app... | true |
01a77a5c9759f66623ec83da91929fdc78e4eea2 | Python | tongni1975/Python-Social-Media-Analytics | /Chapter07/spider_teamspeed.py | UTF-8 | 5,482 | 2.703125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from pymongo import MongoClient
from bs4 import BeautifulSoup
import datetime
import logging
import scrapy
import json
import time
import sys
import re
class ForumTeamSpeedSpider(scrapy.Spider):
name = "forum_teamspeed"
allowed_domains = ['teamspeed.com']
def __init__(self):
... | true |
562235bb6638fad1d7ca928d55ce4d21cfb01674 | Python | allainclair/alg | /quora/fake-test/mutateTheArray.py | UTF-8 | 389 | 3.203125 | 3 | [] | no_license | def main():
test_1()
def mutateTheArray(n, a):
prev_list = [0] + a[:-1]
mid_list = a
post_list = a[1:] + [0]
return [i + j + k for i, j, k in zip(prev_list, mid_list, post_list)]
def test_1():
a = [4, 0, 1, -2, 3]
result = mutateTheArray(len(a), a)
print()
print(result)
asser... | true |
e7fb3f3c222acde0d7f987747af46a629ec01ac3 | Python | koenichiwa/inversekine | /invkin.py | UTF-8 | 8,076 | 3.109375 | 3 | [] | no_license | from __future__ import annotations
from tkinter import Tk, Canvas
from typing import Optional, Union, Tuple, Generator, Iterable, Sequence
from time import sleep
from math import sin, cos, acos, radians, degrees
from numpy import subtract, linalg, dot, cross, append, add
from functools import reduce
from itertools imp... | true |
f6a6b6b8c567a6bcad34bbf81ecab76ad3bc68d9 | Python | LizethPatino/Ciencias-3 | /Parqueaderos para motos/main.py | UTF-8 | 1,140 | 3.3125 | 3 | [] | no_license | from motos import *
miCola = Cola()
salir = False
opcion = 0
while not salir:
print ("1. agregar un motociclista")
print ("2. salir del parqueadero")
print ("3. Mostrar parqueaderos")
print ("4. Salir")
print ("Elige una opcion")
opcion = pedirNumeroEntero()
if opcion == 1:
if ... | true |
4f9f3de6d495225bfe39c4458604827ebea90758 | Python | BartVandewoestyne/Python | /training/PythonFundamentals/day1/Data_Types/ex1_3_lists.py | UTF-8 | 296 | 3.328125 | 3 | [] | no_license | s = "Monty Python"
individual_chars = [letter for letter in s]
print individual_chars
[individual_chars.append(letter) for letter in " Rules"]
print individual_chars
individual_chars2 = [i for i in " big time"]
print individual_chars2
new_list = individual_chars + individual_chars2
print new_list
| true |
06df80e95c2a3046813fbfbd3e936d6afbbd174f | Python | oceanobservatories/mi-instrument | /mi/dataset/parser/test/test_metbk_ct_dcl.py | UTF-8 | 5,339 | 2.546875 | 3 | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_metbk_ct_dcl
@author Tim Fisher (recovered)
@brief Test code for a Metbk ct dcl data parser
Recovered CT files:
SBE37SM-RS485_20190930_2019_09_30-no_records.hex- 0 CT records
SBE37SM-RS485_20190930_2019_09_30-missing_end.hex - 3 CT records
SBE37SM-RS... | true |
bae56aa8bca6c7febabaaa5cf0c9227586546d6e | Python | sultan-m-alharbi/python-py | /greatest.py | UTF-8 | 454 | 4.03125 | 4 | [] | no_license | # Find the greatest among two numbers
def findGreatest (FirstNumber, SecondNumber):
if FirstNumber > SecondNumber:
print("first number is greater")
elif SecondNumber > FirstNumber:
print("second number is greater")
else:
print("tne number are equal")
FirstNumber =int(in... | true |
e0abf04356b43f6af9b08e44c16dba43473d83f7 | Python | UWPCE-PythonCert-ClassRepos/SP_Online_PY210 | /students/nick_miller/lesson02/codingbat-pushups/string_match.py | UTF-8 | 259 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python
def string_match(a, b):
shorter = min(len(a), len(b))
count = 0
for i in range(shorter - 1):
a_sub = a[i:i + 2]
b_sub = b[i:i + 2]
if a_sub == b_sub:
count = count + 1
return count
| true |
1b1e9d12508d7211bcad4a0c3d8d1c90f7e5052a | Python | PierreMsy/DRL_continuous_control | /ccontrol/config/config.py | UTF-8 | 4,722 | 2.671875 | 3 | [
"MIT"
] | permissive | import json
import os
from copy import deepcopy
PATH_JSON = os.path.join(os.path.dirname(__file__),
r'./config.json')
class Configuration:
def set_attr(self, attr, value):
if value:
setattr(self, attr, value)
self.dict[attr] = value
else:
setattr(self, att... | true |
b94ba0bdde701bd6cca356a79817c7cc60cdf0d3 | Python | gurpreet00793/jarvis | /sets2.py | UTF-8 | 1,308 | 3.5625 | 4 | [] | no_license | A={1,2,3,4}#clear all the elemets from the set
A.clear()
print(A)
num={2,3,4,5}#delete a number from the set which is given by user
num.discard(3)
num.discard(10)
num.discard(4)
print('num=',num)
A={10,20,25,30,35}#delete a number from the set randomly
print(A.pop())
print(A)
print(A.pop())
print(A)
A={'a','b','c',... | true |
d168e130acbe3e98147abfe494d5db817c3dfc25 | Python | Lucs1590/Algum_Ritmo | /Recursividade/codigo.py | UTF-8 | 1,243 | 3.703125 | 4 | [] | no_license | #!/usr/bin/python
# -*- encoding: utf-8 -*-
def multiplicacao(num, vezes):
if vezes == 0:
return (num)
else:
return (num + multiplicacao(num,vezes-1))
def elevado(num,por):
if por == 0:
return(1)
else:
return num * elevado(num,por-1)
def soma(num):
if num <= 1:
... | true |
fbb74ec512de656a21e03422e481fc429e2965ec | Python | jinweizhao/Python-Learning | /learning.py | UTF-8 | 28,654 | 4.15625 | 4 | [] | no_license | #!/usr/bin/env python3 #可以让这个learning.py文件直接在Unix/Linux/Mac上运行
# -*- coding: utf-8 -*- #表示.py文件本身使用标准UTF-8编码
'a learning module' #一个字符串,表示模块的文档注释,任何模块代码的第一个字符串都被视为模块的文档注释
__author__ = 'jinweizhao' #使用__author__变量把作者写进去,这样当你公开源代码后别人就可以瞻仰你的大名
# 1.字符串和编码
# name = input('enter your name:')
# s1 = input('输入上一年成绩:... | true |
07b98d2942551ded27e857d143270f7fa23e1000 | Python | kwasnydam/python_exercises | /CodeWarsKata/IQtest/iqtest.py | UTF-8 | 1,313 | 4.09375 | 4 | [] | no_license | '''
Bob is preparing to pass IQ test.
The most frequent task in this test is to find out which one of the given
numbers differs from the others.
Bob observed that one number usually differs from the others in evenness.
Help Bob — to check his answers, he needs a program that among the given numbers
finds one that is di... | true |
c4871ef65227e6462d444ead919a5ae1f9b4bc19 | Python | AnimusVonith/IPP-interpret.py | /interpret.py | UTF-8 | 17,072 | 2.578125 | 3 | [] | no_license | #!/usr/bin/python
from sys import stdin, argv, stderr
from re import match, compile, IGNORECASE, search, findall
input_path = ""
source_path = ""
context = []
def err_exit(err_code):
switch_err = {
10: "parameter error",
11: "read file error",
12: "write file error",
31: "not well... | true |
6a38bc3d05e49c66251ed27c40974e97a040b36f | Python | ironpiggies/delta_robot | /modules/detect_red_circular.py | UTF-8 | 12,157 | 2.671875 | 3 | [] | no_license | from collections import Counter
import pyrealsense2 as rs
import cv2 as cv
import sys
import numpy as np
from matplotlib import pyplot as plt
# Configuration
config = rs.config()
config.enable_stream(rs.stream.depth, 1280, 720, rs.format.z16, 30)
config.enable_stream(rs.stream.color, 1920, 1080, rs.format.bgr8, 30)
... | true |
7eb9d305d46dc0e439b9b49d89af570df80a3963 | Python | KoshikawaShinya/AI_study | /saitoh/ch1/test_numpy_3.py | UTF-8 | 459 | 3.578125 | 4 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.image import imread
x = np.arange(0, 7, 0.1)
y1 = np.sin(x)
y2 = np.cos(x)
print(x)
print(y1)
plt.plot(x, y1, label="sin") # 線の描写と名前付け
plt.plot(x, y2, linestyle="--", label="cos") # 破線の描写と名前
plt.xlabel("x") # x軸の名前
plt.ylabel("y") # y軸の名前
plt.title("... | true |
bdd02b77efe80a2f84448af1804fdd554350c9c4 | Python | lorenzohonegger/auto-correct | /autocorrect_functions.py | UTF-8 | 7,566 | 3.890625 | 4 | [] | no_license | def process_data(file_name):
"""
Process input data.
Input:
A file_name which is found in your current directory. You just have to read it in.
Output:
words: a list containing all the words in the corpus (text file you read) in lower case.
"""
import re
words = []
#... | true |
59598878fa83742a32a836ba181e86873c030ae8 | Python | shootboy/ShotEngine_Pub | /strategy/day_volatility.py | UTF-8 | 2,622 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@Author: ShotBoy
@File: day_volatility.py
@Time: 2020/3/19 17:02
@Motto:I have a bad feeling about this.
计算每日历史波动率
"""
from engine.strategy import StrategyBase
from engine.engine import *
import pandas as pd
import numpy as np
def Cal_ewmaVol(series, LamBda=0.98):
"""历史波动率计算ewma
Lam... | true |
8d3e81f3d6612c97a3c4260e7d7bc9917b498c2a | Python | iamtariqueanjum/p4e_coursera | /floorconvert.py | UTF-8 | 73 | 3.1875 | 3 | [] | no_license | eurf=int(input('Enter European floor'))
usf=eurf+1
print('US floor',usf)
| true |
5154ce22846d95b1056b52a002e1348d6df579c5 | Python | MFournierQC/Symposium | /nBall.py | UTF-8 | 427 | 3.15625 | 3 | [] | no_license | import numpy as np
from scipy.special import gamma
class NBall:
def __init__(self, dimensions, radius=1):
self.n = dimensions
self.r = radius
@property
def volume(self):
return (np.pi ** (self.n / 2)) / (gamma((self.n / 2) + 1)) * (self.r ** self.n)
@property
def surface(... | true |
8b3841b2c21b20f19a49291b396e4ea7dcad3aa1 | Python | riteshideas/Profile-Picture-Creator | /part2/backend.py | UTF-8 | 1,956 | 2.96875 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
import os
from PIL import Image
def createPicture(color=[np.random.randint(0, 255), np.random.randint(0, 255), np.random.randint(0, 255)], value=2, flipType=1):
pixles = [
]
for _ in range(10):
colour = []
for _ in range(5):
val = np.random.ra... | true |
1424924beac8bbbafb5041892681252decd2e585 | Python | HassaanAbbasi/World-PokeStops-Map | /Program/main.py | UTF-8 | 568 | 3.078125 | 3 | [
"MIT"
] | permissive | import folium
import pandas
data = pandas.read_csv("PokeGoLocations.csv")
#Initializing the map to start at Toronto
map = folium.Map(location = [43.6532, -79.3832], zoom_start = 12, min_zoom = 3)
#This object holds all the locations
stops = folium.FeatureGroup(name = "Pokestops")
#Adding places to "stops"
for lat, ... | true |
0e32c974bd87900950d7787a018b7b86fd6b2c39 | Python | anuj2110/FaceRecognition | /splitdata.py | UTF-8 | 1,690 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 5 23:09:25 2020
@author: Anuj
"""
import os
from shutil import copyfile
import glob
import random
base_dir = "./Images/"
train_dir = "./Images/train/"
test_dir = "./Images/test/"
os.mkdir(train_dir)
os.mkdir(test_dir)
person_names = os.listdir(base_dir)[:-2]
train_di... | true |
2fd75321830454cf39e0faa389af07031c9e99f0 | Python | hadi-M/packagedata-struth-rourke | /newpandaspackage/new_function.py | UTF-8 | 1,439 | 4.28125 | 4 | [
"MIT"
] | permissive | from pandas import DataFrame
# Defining the function
def add_state_names(my_df):
''' Converts a dataframe with a column of state abbreviations,
adding a corresponding column of state names
Params:
my_df a pandas.DataFrame with a column called "abbrev".
Example:
add_state_names(Da... | true |
f810c28e937a8e3d52b559ba044239ac61153d8d | Python | xuedong/leet-code | /Problems/Algorithms/282. Expression Add Operators/add_operators.py | UTF-8 | 1,228 | 3.078125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
from typing import List
class Solution:
def addOperators(self, num: str, target: int) -> List[str]:
n = len(num)
results = []
def helper(string, index, prev, curr, value):
if index == n:
if value == target and curr == 0:
... | true |
ca301c2b2c184c982ea0ae9169d6246d4359dc4b | Python | HenryLGL/CH0 | /ex15.py | UTF-8 | 195 | 2.640625 | 3 | [] | no_license | from sys import argv#quote the module
script, filename = argv#unpacking
txt = open(filename)#open the file
print ("Here's your file %r:" % filename)
print (txt.read())
print (txt.close())
| true |
e80a07316b66571ae0f88e6f7a08c87923332102 | Python | dongryoung/Class_Examples | /10. Raspberry Pi/4.LED PWM.py | UTF-8 | 389 | 2.96875 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT, initial=GPIO.LOW)
p = GPIO.PWM(11, 100) #GPIO.PWM(핀번호 ,진동수)
p.start(0) #start(듀티비를 실수로 표시, 0% - 100%)
time.sleep(1)
p.ChangeDutyCycle(10) #듀티비 설정
time.sleep(1)
p.ChangeDutyCycle(50)
time.sleep(1)
p.ChangeDutyCycle(100)
time.slee... | true |
f5ea9200fb23b9f703d6c7ef970a88c2a226488f | Python | ChangRui-Yao/pygame | /LINUX系统/linux实战/14.0/12--复杂可变数据类型的深浅拷贝问题.py | UTF-8 | 503 | 2.6875 | 3 | [] | no_license | import copy
def l1():
A=[1,2,3]
B=[11,22,33]
C=[A,B]
print("A=",A,id(A))
print("B=",B,id(B))
print("C=",C,id(C))
print("C[0]",C[0],id(C[0]))
D=copy.copy(C)
print("D=",D,id(D))
print("D[0]=",D[0],id(D[0]))
print("D[1]=",D[1],id(D[1]))
A=[1,2,3]
B=[11,22,33]
C=[A,B]
print... | true |
482b8e63fb3c1b17a5a68ae436d26922db95acad | Python | mihoku/id-sovereign-debt-analytics | /lender-clusters.py | UTF-8 | 2,672 | 2.765625 | 3 | [] | no_license | import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.graph_objs as go
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
df = pd.read_csv(
'lender_clu... | true |
ca615b7244c6b3814d9df04032d3243783291c91 | Python | cgm97/python_coding_test | /그리디알고리즘연습/실전_곱하기or더하기.py | UTF-8 | 203 | 3.421875 | 3 | [] | no_license | # 곱하기 혹은 더하기
# 507 page
arr = list(map(int,input().split()))
result = 0
for i in arr:
if i <= 1 or result <= 1:
result += i
else:
result *= i
print(result)
| true |
8c66cb10b51852ad16e4c5212873b83fa865aee1 | Python | JiaqiHe/Web-Mining-and-Recommender-System | /hw1/hw1_3.py | UTF-8 | 1,028 | 2.578125 | 3 | [] | no_license | import numpy
import urllib
import scipy.optimize
import random
from urllib import request
def parseData(fname):
for l in urllib.request.urlopen(fname):
yield eval(l)
print ("Reading data...")
data = list(parseData("http://jmcauley.ucsd.edu/cse255/data/beer/beer_50000.json"))
print ("done")
X = []... | true |
b1bd3e2f2e8f442dff3443d4c2f82e987149924b | Python | tobifroe/caboto | /caboto/utils.py | UTF-8 | 536 | 2.875 | 3 | [
"MIT"
] | permissive | import re
MEMORY_UNITS = {"K": 1024, "M": 1024 ** 2, "G": 1024 ** 3, "T": 1024 ** 4, "P": 1024 ** 5, "E": 1024 ** 6}
def normalize_cpu(value: str) -> float:
try:
x = float(value)
except ValueError:
x = int(re.sub(r"milli|m", "", value))
x = x / 1000
return float("{:.2f}".format(x)... | true |
7e3dc0ab80b8b15e3afa283603e79d66fb84d9ea | Python | Piyush123-grumpy/Class_acitvity | /Lab_1/Apple.py | UTF-8 | 306 | 4.03125 | 4 | [] | no_license | N=int(input("Number of students"))
K=int(input("Number of apples "))
Number_of_apples_in_basket=K%N
Number_of_apples_divided_among_students=K//N
print(f"The numer of apples in basket{Number_of_apples_in_basket}")
print(f"The numer of apples divided among students{Number_of_apples_divided_among_students}") | true |
915e83bec44c33da333e9d1c68087aa1568674d8 | Python | adityam31/AIR-assignments | /Assignment 1 - AStar, BFS, Hill Climbing/HillClimbing.py | UTF-8 | 3,003 | 3.765625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 26 14:42:31 2019
@author: Aditya Mahajan
"""
class Node:
def __init__(self, index, h, parent=None):
self.index = index
self.parent = parent
self.h = h
def __eq__(self, other):
return self.index == other.index
def... | true |
ae6a35a9d8d31d5f2eec4530b817e508cf89883a | Python | srcmarcelo/Python-Studies | /CursoemVideo/ex046.py | UTF-8 | 213 | 3.40625 | 3 | [] | no_license | from time import sleep
print('='*10, '{}'.format(' COUNTDOWN TO THE NEW YEAR '), '='*10)
play = input('Press "ENTER" to star: ')
for c in range(10, 0, -1):
print(c)
sleep(1)
print('HAPPY NEW YEAR!!!!!!!')
| true |
8be57fbaf1e7acf70e329d36e7da9264bcb0aaf5 | Python | zenvin/PythonCrashCourse | /PART 1/chapter_4/counting_to_twenty.py | UTF-8 | 1,210 | 5.0625 | 5 | [] | no_license | #use a for loop to count from number 1 to 20
for number in range(1, 21):
print(number)
#count to a million
#make a list of number from one to one million and then use a for loop to print the numbers
# numbers = (list(range(1, 1000001)))
# for value in numbers:
# print(value)
#summing a million. make a list of numb... | true |
ddef712b233109ac870b27692551d343446ba966 | Python | satyabonthu/spacy-transformers | /spacy_transformers/layers/listener.py | UTF-8 | 1,750 | 2.59375 | 3 | [
"MIT"
] | permissive | from typing import Optional, Callable, List
from thinc.api import Model
from spacy.tokens import Doc
from ..data_classes import TransformerData
class TransformerListener(Model):
"""A layer that gets fed its answers from an upstream connection,
for instance from a component earlier in the pipeline.
"""
... | true |
6f687f1a205d032f0b9999efa7501015ea79beeb | Python | MihoKim/bioinfo-lecture-2021-07 | /src/kmer.py | UTF-8 | 317 | 3.28125 | 3 | [] | no_license | import sys
def rec(l1, l2, n):
if n < 2:
return l2
else:
ltmp = []
for s1 in l1:
for s2 in l2:
ltmp.append(s1 + s2)
return rec(l1, ltmp, n - 1)
l1 = ["A", "C", "G", "T"]
l2 = ["A", "C", "G", "T"]
n = int(sys.argv[1])
l = rec(l1, l2, n)
print(l)
| true |
bffd1a50d7b03b1a2c7545a9333714e5526e0b32 | Python | Nanjangpan/Machine_Learnig_algorithm_cheat_sheat | /코드/Machine_Learnig_algorithm_cheat_sheat(scikit-learn).py | UTF-8 | 10,819 | 3.21875 | 3 | [] | no_license | # scikit-learn algorithm cheat-sheet
import time
import csv
import numpy as np
import pandas as pd
dataset = pd.read_csv('./data/iris.csv', engine='python')
data_size = dataset.shape[0]
a = dataset.iloc[:, -1][1]
if(issubclass(type(a), str)): #check predict data is stirng
str_type = True
else :
str_type = False
c... | true |
912a4646f6a5279a93e96f4a78b9fe4244d13951 | Python | mtagg/FXTrade | /Script/FXT_Logic.py | UTF-8 | 1,864 | 3 | 3 | [] | no_license | import CONFIG
from datetime import datetime
def printValues(key, values,
dailyGain, dailySpent,
ema1, ema2, ema3):
##print current currency values - dailygain/loss
print()
print(key[0],values[0]) ##from currency
print(key[2],values[2]) ##to curren... | true |
e2886ef288fa923f5ff69435eeb5afc967584e67 | Python | Acobra/Simple_Shooting_game | /game.py | UTF-8 | 1,739 | 3.21875 | 3 | [] | no_license | import turtle
import random
wn=turtle.Screen()
wn.title('game')
wn.tracer(1)
wn.bgcolor('black')
player=turtle.Turtle()
player.color('red')
player.shape('triangle')
player.penup()
player.goto(-300,0)
speed=10
#bullet
bullet=turtle.Turtle()
bullet.color('green')
bullet.penup()
bullet.goto(-280,0)
def co... | true |
410876bd63bf1ac4b7d336894b9e933c1917fd8a | Python | DataManagementLab/fandomCorpus | /src/split.py | UTF-8 | 5,018 | 2.640625 | 3 | [
"MIT"
] | permissive | import json
import os
import sys
from os import path, listdir
import random
from math import ceil
from parse_dump import get_base_path
SPLIT_TEST = 0.1
SPLIT_VAL = 0.1
def split(wiki_name, experiment, threshold=0):
"""
Split available files into train, validation and test set
:param wiki_name: name o... | true |
5fcf4930dd1a0482b7add8c499f66c451d3df0f4 | Python | Air-df/office_worker_system | /sys_client/lib/module_up_load_client.py | UTF-8 | 4,349 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding:UTF-8 -*-
# coding:utf-8
# Author: Li Xin Hao
"""
此模块提供客户端上传
过程
1.通过文件路径 确定上传文件数量n
2.创建一个套接字,开启n个进程等待服务器来连接
3.连接成功后,开始上传
需要参数:
服务器的addr , 和 udpsock
"""
# 需要的包
from tkinter.filedialog import askdirectory, askopenfilename, askopenfilenames
from socket import *
from mul... | true |
1ce6bf1345db7183dd35c82849803e7a425e62ed | Python | willRicard/congenial-octo-winner | /gfx/ith.py | UTF-8 | 3,294 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
""" Affichage tête-haute """
import curses
from gettext import gettext
from gfx.window import COLOR_RED, COLOR_BLUE, COLOR_YELLOW
## @enum Mode d'affichage de l'ITH
## On affiche tout
DISPLAY_MODE_NORMAL = 0
## On n'affiche que les icônes la valeur
DISPLAY_MODE_NO_TEXT = 1
## On n'affiche q... | true |
b95c8b638ddfd030ac8275d550d87da76bdf3324 | Python | rabiatuylek/Python | /python.py | UTF-8 | 3,073 | 3.46875 | 3 | [] | no_license | # KARAR YAPILARI , if elif else
# karsılastırma operatorleri
# == soldaki deger sagdaki degere esit
# != soldaki deger sagdakine esit degil ornek olarak 4 != 3 sonucu true
# < , >
# =< kucuk yada esit
# => buyuk yada esit
# 1>= 1 sonuc true (esitlik)
#num = input("lutfen kullanıcı adınızı girin:")
#num = num.lower().r... | true |
72e3f2b85802f3eaff77f99719307ed24937cf08 | Python | BohaoLiGithub/Leetcode | /687. Longest Univalue Path/687. Longest Univalue Path(AC).py | UTF-8 | 1,249 | 3.609375 | 4 | [] | no_license | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# We go through the tree by post-order Traverse.
# We recursively calculate the max univalue in the root's left subtree and right subtree
# then we c... | true |
517d85b43a83ec9d7ac003ad953622aee80cd82c | Python | EricMontague/Datastructures-and-Algorithms | /graph_theory/algorithms/traversals/dfs_adjacency_list.py | UTF-8 | 1,072 | 3.90625 | 4 | [] | no_license | """This module contains an implementation of depth first search
where the graph is represented as an adjacency list.
"""
# assumes all inputs are valid and that
# the values in the adjacency list are python lists
def dfs(adjacency_list):
visited = set()
for node in adjacency_list:
if node not in visit... | true |
becaf9ef7acc72feb2fbe76535ebb4c03c2c9b26 | Python | ntl870/BTL-DSP-2 | /xxx.py | UTF-8 | 6,083 | 2.59375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import scipy
from scipy.io.wavfile import read
from scipy.signal import find_peaks
from scipy.signal import medfilt
from scipy.fftpack import fft
def Normalize(data, min, max): # Chuẩn hóa data về 0,1
res = [] # Tạo LIST res rỗng để chứa kết quả
for i in ... | true |
59fb6ef5aa5d1fdb667b1d6ac7eeedc322885730 | Python | isaacvitor/teamtime | /tt01/ex05.py | UTF-8 | 278 | 3.125 | 3 | [] | no_license | """Asyncio"""
from asyncio import coroutine, get_event_loop
from random import randint
@coroutine
def my_coroutine():
print(f'Random: {randint(1,10)}')
print(type(my_coroutine))
print(type(my_coroutine()))
loop = get_event_loop()
loop.run_until_complete(my_coroutine()) | true |
80f5667dcd97a92c5b5e185d8b40877dbfe6bcb9 | Python | garsue/elorating | /lesson5_reduce.py | UTF-8 | 4,212 | 3.546875 | 4 | [] | no_license | """
参考 イロレーティング
https://ja.wikipedia.org/wiki/%E3%82%A4%E3%83%AD%E3%83%AC%E3%83%BC%E3%83%86%E3%82%A3%E3%83%B3%E3%82%B0
このプログラムを理解するのに必要な知識
- reduce https://docs.python.jp/3/library/functools.html#functools.reduce
"""
# CSVファイル操作の関数を使う
import csv
# reduce関数を使うためfunctoolsライブラリをインポート
import functools
# 計算に使う定数を宣言
DEFA... | true |
3ce0b8f60159277e0ef7c72e43e31fb57cb993e1 | Python | alexmojaki/friendly_states | /tests/test_django.py | UTF-8 | 5,127 | 2.625 | 3 | [
"MIT"
] | permissive | import pytest
from django.core.exceptions import ValidationError
from django.db import IntegrityError, models
from django.db.transaction import atomic
from friendly_states.core import AttributeState
from friendly_states.django import StateField, DjangoState
from friendly_states.exceptions import DjangoStateAttrNameWar... | true |
7b477620b9778b57fe4987da9c10476e39527dbd | Python | geroalonso/asphaltproviders | /script.py | UTF-8 | 1,088 | 2.609375 | 3 | [] | no_license | from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
import pandas as pd
names = []
member_numbers = []
page = 1
def crawler(page):
url = "https://www.floridaridesonus.org/members//?Page="+ str(page)
chrome_options = Options() ... | true |
a20eec8c4ae7e6b465f20fecde8572fd417cc489 | Python | frameworkdartboard/LPTHW2ndED | /loginexperiment/websecurity/websecurity.py | UTF-8 | 345 | 2.75 | 3 | [] | no_license | import sqlite3
import hashlib
def isUserValid (login, password):
authdb = sqlite3.connect('users.db')
pwdhash = hashlib.md5(password).hexdigest()
cursor = authdb.execute('select * from users where login=? and password=?', (login, pwdhash))
row = cursor.fetchone()
if row:
return True
el... | true |
a31253099b0ba6beb490b01b703672c114b61452 | Python | vinecodes/minix_car_firmware | /ultrasonic.py | UTF-8 | 2,394 | 3.375 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
# ULT on the left side
TRIG1 = 15
ECHO1 = 7
#ULT on the front
TRIG2 = 13
ECHO2 = 11
class Ultrasonic:
distance_list = ['']
motorobj = 0 #Dummy Value
def __init__(self, motor):
GPIO.setup(TRIG1, GPIO.OUT)
GPIO.setup(ECHO1, GPIO... | true |
6a30bac17a6ce177081264e79ce060fee0abc86b | Python | slongfield/simpleStack | /randProgram.py | UTF-8 | 2,134 | 3.5 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python3
"""randProgram generates random simpleStack programs, and evaluates them.
This is basically a really simple fuzzer for testing that no programs "go
wrong", where "go wrong" means "throw an exception".
Allows one exception to be thrown:
MemoryError if the stack grows beyond 10,000 elements. Thes... | true |
7b7af27d2f2468707948461a61c4786a2d8a7eef | Python | Houplain/netweets | /Tkinter_gen.py | UTF-8 | 42,425 | 2.625 | 3 | [] | no_license | from tkinter import *
import tweepy
import pdb
import pickle
import networkx as nx
import pandas as pd
from module import *
from tkinter import filedialog
import tkinter.tix
#-----------------INDEX---------------------#
class Index(Frame):
def __init__(self, fenetre, **kwargs): #Une classe In... | true |
2888b6d9163b23f1d363f41a635ef0df7632382d | Python | csukuangfj/snowfall | /snowfall/text/numericalizer.py | UTF-8 | 1,180 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) 2021 Xiaomi Corporation (authors: Guo Liyong)
# Apache 2.0
from typing import List, Union
from pathlib import Path
import k2
import sentencepiece as spm
Pathlike = Union[str, Path]
class Numericalizer(object):
def __init__(self, tokenizer, tokens_list):
super().__init__()
self... | true |
0d56cfc6437256a42bbc0e3f427311469e0c0846 | Python | hapei/m83_clustering | /Code/compare_clustering.py | UTF-8 | 6,487 | 3.109375 | 3 | [] | no_license | '''Compare the results of two classifications
1. Run from Spyder terminal
Argument 1 (dim): '2d' or '3d' or '2a3' - puts dimensions of each clustering in file name
Argument 2 (df_1): first id_ file from clustering
Argument 3 (df_2): second id_ file from clustering
Argument 4 (d1_path): path to df_1
... | true |
d0332c770c35d7cf7c4866d6b2e62cba14cd3f24 | Python | sree-varma/CodeSignal | /Arcade/Core/maxMultiple.py | UTF-8 | 282 | 3.46875 | 3 | [] | no_license | """
Given a divisor and a bound, find the largest integer N such that:
N is divisible by divisor.
N is less than or equal to bound.
N is greater than 0.
"""
def maxMultiple(divisor, bound):
while bound>0:
if bound%divisor==0:
return bound
bound-=1
| true |
6eca0292f4e95eec1493a82f7d3b6177f4dbeedc | Python | DKJoey/GLCM_Classify | /plot/f_plot.py | UTF-8 | 2,040 | 2.65625 | 3 | [] | no_license | import os
import matplotlib.pyplot as plt
import numpy as np
from sklearn import preprocessing
files = ['DWI_transverse.npy',
'DWI_sagittal.npy',
'DWI_coronal.npy',
'T1+c_transverse.npy',
'T1+c_sagittal.npy',
'T1+c_coronal.npy',
'T2_transverse.npy',
'T2_s... | true |
5bffc2293fd375e663185826f8719f15dbf8cf03 | Python | econdaryl/carvana-app | /carvana_scrape.py | UTF-8 | 1,423 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import pandas as pd
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from bs4 import BeautifulSoup
url = "https://www.carvana.com/cars"
driver = webdriver.Firefox()
driver.implicitly_wait(30)
dri... | true |
f0de94e9a549858ffb2d1cbb8b5b39bf6c00cb46 | Python | EliLPeters/Spring-2018-Schoolwork | /CS 232 Python/Labs/week6lab.py | UTF-8 | 1,257 | 4.0625 | 4 | [] | no_license | # CS 232 Spring 2018 - Week 06 Lab
# Eli Peters and Elizabeth Lujan
import random
# generator for rolling 2 six-sided dice
def dice_roller():
while True:
roll1 = random.randint(1, 6)
roll2 = random.randint(1, 6)
yield (roll1 + roll2)
roll_dice = dice_roller()
# play_craps: void -> bool
#... | true |
7e2550a6fb7ef40635f8ec0f52dd16ba516a6eb2 | Python | stebr23/python-project | /carhire/views/root_view.py | UTF-8 | 1,143 | 3.046875 | 3 | [] | no_license | import tkinter as tk
import carhire.constants as vc
class RootView(tk.Tk):
"""
This is the Root Window and Frame of the GUI of the application
It is called once on app startup and referred to by the
nested frames when they initialise, which occurs as the user
changes between frames
"""
_v... | true |
c810aec28f16821d2f4b3679ee0729e2d487820b | Python | slavomatas/dqn-navigation | /pixels_dqn/train.py | UTF-8 | 3,635 | 2.796875 | 3 | [] | no_license | import os
import torch
import numpy as np
import matplotlib.pyplot as plt
from collections import deque
from unityagents import UnityEnvironment
import sys
sys.path.append("../")
from utils.utils import process_observation
from agent import Agent
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
device = torch.device("cud... | true |
ab3410b4b9df31f563b3d2e41b663df4e7442dcc | Python | Byeori-Kim/Web-Crawling | /crawler.py | UTF-8 | 1,926 | 2.546875 | 3 | [] | no_license | from bs4 import BeautifulSoup
import pandas as pd
import requests
from datetime import datetime
count = 1
start_row = 10244
print('Crawler starting...')
with open("list.csv", encoding="ISO-8859-1") as file:
df = pd.DataFrame()
reader = pd.read_csv(file)
url_col = reader['Infosec URL']
script_start_... | true |
3bcb8985674838ec3e8c347e348243a94a44865a | Python | ajbansal/CarND-LaneLines-P1 | /check.py | UTF-8 | 6,819 | 2.984375 | 3 | [] | no_license | # importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
import os
from moviepy.editor import VideoFileClip
from IPython.display import HTML
import math
def canny(img, low_threshold, high_threshold):
"""Applies the Canny transform
Args:
... | true |
1401f787521b283cfb77ab1b25bade2316aef6ed | Python | CSHackath0n/Taxidermists | /Data/converted/parse2.py | UTF-8 | 284 | 2.921875 | 3 | [] | no_license | from xml.etree import ElementTree as etree
def etree_to_dict(t):
d = {t.tag : map(etree_to_dict, t.getchildren())}
d.update(('@' + k, v) for k, v in t.attrib.iteritems())
d['text'] = t.text
return d
tree = etree.parse("tmp.xml")
print etree_to_dict(tree.getroot())
| true |
2d45a25ec97ae34a4c3986145ccc20bcde0a099a | Python | srinivas-adivi/pgrms_probs | /jottit/grep.py | UTF-8 | 538 | 3.21875 | 3 | [] | no_license | def grep(filename, word):
'''It takes file and searching word as arguments.and return all lines in given file which contains given word.'''
return ''.join(line for line in open(filename).readlines() if word in line)
if __name__ == "__main__":
import sys
import doctest
doctest.testmod()
try:
sy... | true |
d6d6155605c460da55f425b6891768b31f54a741 | Python | benyouss/ConnectedThermostat | /TMpython.py | UTF-8 | 1,309 | 3.3125 | 3 | [] | no_license | # Graphical User Interface for the Bluetooth sensor transfer
# Imports
import time
import serial
from Tkinter import *
# Serial port parameters
serial_speed = 9600
serial_port = '/dev/cu.AdafruitEZ-Link06d5-SPP'
# Test with USB-Serial connection
# serial_port = '/dev/tty.usbmodem1421'
ser = serial.Serial(seri... | true |
e0d81cbae5f5296aad37d87897c62206e10ebf73 | Python | Yun-Jongwon/TIL | /알고리즘/day25/보급로.py | UTF-8 | 1,236 | 2.609375 | 3 | [] | no_license | import sys
sys.stdin=open('보급로','r')
dy=[-1,0,1,0]
dx=[0,1,0,-1]
def issafe(y,x):
if y>=0 and x>=0 and y<N and x<N:
return True
else:
return False
def directionchange(x):
if x==0:
return 2
elif x==1:
return 3
elif x==2:
return 0
elif x==3:
return 1... | true |
348568985c8980d384d0fd21bfafe5b2345e0365 | Python | Altarax/Discord_Bot_Stock_Market | /tracker/share.py | UTF-8 | 11,289 | 2.8125 | 3 | [] | no_license | # Librairies
import discord
from discord.ext import commands
from bs4 import BeautifulSoup
import re
import pandas as pd
import random
import urllib.request
import matplotlib.pyplot as plt
import csv
import wikipedia
# Librairies for Degiro API
import degiroapi
from degiroapi.product import Product
from degiroapi.util... | true |
b5a4130ab495979b98500aae643da58716011f44 | Python | ankitgupta0910/Data-Structures | /BalancedParantheses.py | UTF-8 | 1,517 | 4.0625 | 4 | [] | no_license | class Stack(object):
def __init__(self):
self.stack = []
self.top = -1
def empty(self):
if self.top is -1:
return 0
else:
return 1
def push(self, data):
self.top += 1
print "Element %s is pushed in Stack at position %d" % (data, self.... | true |
0e086bde4e38784cc4501af8e62985882d6dcf51 | Python | raymond-devries/usara-nationals | /clean_data.py | UTF-8 | 1,661 | 2.953125 | 3 | [] | no_license | import json
import datetime
from bs4 import BeautifulSoup
def parse_seconds(time: str):
h, m, s = time.split(':')
return int(datetime.timedelta(hours=int(h), minutes=int(m), seconds=int(s)).total_seconds())
def parse_checkpoint_data(raw_data: list):
data = raw_data[0::2]
data = [point for point in d... | true |
59f237d21f754aa3dcfec6f75b5dd034e9054644 | Python | SysBioChalmers/proYeast8-GEM | /PDB parameter collection/getParameter_in_PDBhomo.py | UTF-8 | 6,324 | 2.5625 | 3 | [] | no_license | """summary of pdb information for models simulated using swiss web service
input information is the report.html of the simulation results of each protein
export the summary of pdb parameters.
12th,November, 2018
Hongzhong Lu
"""
# import libraries
import urllib.request
from urllib.error import HTTPError
from bs4 impor... | true |
2a718482a98bc1cef980624a86c68ae0a5905ab2 | Python | eteryko/audius-protocol | /discovery-provider/src/utils/redis_cache_test.py | UTF-8 | 2,145 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | import pickle
from time import sleep
from unittest.mock import patch
import flask
from src.utils.redis_cache import cache
def test_cache(redis_mock):
"""Test that the redis cache decorator works"""
@patch("src.utils.redis_cache.extract_key")
def get_mock_cache(extract_key):
# cache requires a re... | true |
a168e28188fc2b77f7cae522c26aa6073cb0d78c | Python | eric496/leetcode.py | /two_pointers/360.sort_transformed_array.py | UTF-8 | 1,615 | 4.3125 | 4 | [] | no_license | """
Given a sorted array of integers nums and integer values a, b and c. Apply a quadratic function of the form f(x) = ax2 + bx + c to each element x in the array.
The returned array must be in sorted order.
Expected time complexity: O(n)
Example 1:
Input: nums = [-4,-2,2,4], a = 1, b = 3, c = 5
Output: [3,9,15,33]
E... | true |
11867f308e8d905a87f7776a61a9fe93b3c8a842 | Python | saequus/learn-python-favorites | /Tasks/FindMostCommonDigit.py | UTF-8 | 982 | 4.1875 | 4 | [] | no_license | # ============================================================================
# ============================== Find The Biggest ===========================
# ============================ and Most Common Digit =========================
# ============================================================================
im... | true |
57ab603cc11e6326d481cd4a3931cd42b49175de | Python | kamsec/django-hotel | /hotel/models.py | UTF-8 | 1,416 | 2.609375 | 3 | [] | no_license | from django.db import models
from django.conf import settings
from django.utils import timezone
from .config import ROOM_CATEGORIES, ROOM_PRICES
class Room(models.Model):
number = models.IntegerField(unique=True, primary_key=True)
category = models.PositiveSmallIntegerField(choices=ROOM_CATEGORIES)
def __... | true |
2e5c8d7e0ce9c92a01081c34495c2e12aa4bbd11 | Python | sharashami/ormuco-python | /a-two-lines/src/lines.py | UTF-8 | 1,085 | 4.0625 | 4 | [] | no_license |
def overlap(x1, x2, x3,x4):
"""Check whether two lines on the x-axis overlap.
Args:
x1 (float): First line's start value.
x2 (float): First line's end value.
x3 (float): Second line's start value.
x4 (float): Second line's end value.
Raises:
ValueError: If the ... | true |
3effe3a54534f53ed7bfaa669a5232f5340484bf | Python | leVirve-arxiv/ptt-viewer | /data/fix_json.py | UTF-8 | 386 | 2.765625 | 3 | [
"MIT"
] | permissive | import json
import glob
def load_json(filename):
with open(filename, encoding='utf8') as f:
return [json.loads(line) for line in f]
def dump_json(data, filename):
with open(filename, 'w', encoding='utf8') as f:
json.dump(data, f)
json_files = glob.glob('*.json')
for json_file in json_file... | true |
709679f2e147d13af1e0e83344d99d84bf18630a | Python | Jackiexiong/software-testing-course | /content/Property Based Testing/code-snippets-1/test_sorting_correct_passing.py | UTF-8 | 853 | 2.765625 | 3 | [
"CC-BY-4.0"
] | permissive | # py.test -p no:django -v
def sort(list_of_ints, descending):
assert isinstance(list_of_ints, list)
assert all(isinstance(x, int) for x in list_of_ints)
result = sorted(list_of_ints, reverse=descending)
return result
from hypothesis import given
import hypothesis.strategies as st
import collections
... | true |
59bcc7da6ea8223f0fecea227983d367a2b2e33b | Python | NaifAlqahtani/100_DaysOfCode | /100 days of python/Day05.py | UTF-8 | 692 | 3.9375 | 4 | [] | no_license | x= "apple"
y = "orange"
z= "lemon"
basket = x + y + z
for i in range(0,len(basket),5):
print(basket[i:i+5], end = ' ') #I tried to split the string every 5 letters, unfortunatly orange
#is 6 letters so the output will be:
# >>>> apple o... | true |
78e1fc2516ecfe5fa4e75c8f0810fbefa00e0e0f | Python | BelleBruinsma/Heuristieken1 | /week3/oefen.py | UTF-8 | 1,039 | 3.515625 | 4 | [] | no_license | glasplaat = []
for i in range(5):
glasplaat.append(["0"] * 6)
def print_glasplaat(glasplaat):
for row in glasplaat:
print (" ".join(row))
print_glasplaat(glasplaat)
print("")
current_x = 0
current_y = 0
highest_y = 0
def place_order(width, height):
global current_x
global current_y
glo... | true |
5943f55abe44c9c1831bbd715fe8fd2b239ddc59 | Python | kingsamchen/Eureka | /crack-data-structures-and-algorithms/leetcode/python-impl/reverse_nodes_in_k_group_q25.py | UTF-8 | 965 | 3.40625 | 3 | [
"MIT"
] | permissive | # Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def reverseKGroup(self, head, k):
"""
:type head: ListNode
:type k: int
:rtype: ListNode
"""
if not head:
... | true |
70d379605a68e4504f69ef230902878efc4092ea | Python | Aavu/Final-Project-MUSI_8903 | /phase_space_embedding/evalModel.py | UTF-8 | 2,226 | 2.734375 | 3 | [] | no_license | import glob
import os
import numpy as np
from keras.models import load_model
import timeit
import matplotlib.pyplot as plt
import util_functions as UF
from keras.utils import to_categorical
import collections
validation_data_folder = "validation_data"
ragas = UF.list_ragas(validation_data_folder)
ragas = np.sort(np.ar... | true |
80c589d8ee5dba4ef9d7f274b22decb526f67f18 | Python | ishantk/GW2021PY1 | /Session3A.py | UTF-8 | 1,100 | 3.515625 | 4 | [] | no_license | # Multi Value Containers => TUPLE
# Read only Storage Container -> IMMUTABLE
# numbers = 10, 20, 30, 40, 50
numbers = (10, 20, 30, 10, 50)
instagram_followers = "john", "jennie", "jim", "jack", "joe"
print(numbers, hex(id(numbers)))
print(instagram_followers, hex(id(instagram_followers)))
# print(numbers[0], hex(id(... | true |
7aad445236441f945e714ef6052f4f852d695643 | Python | spaceone/httoop | /tests/messaging/test_request_header.py | UTF-8 | 1,142 | 2.65625 | 3 | [
"MIT"
] | permissive | from __future__ import unicode_literals
import pytest
from httoop import InvalidHeader
def test_multiple_same_headers():
pass
def test_header_case_insensitivity(headers):
headers.parse(b'Foo: bar')
assert headers['foo'] == 'bar'
assert headers['Foo'] == 'bar'
assert headers['FOO'] == 'bar'
assert headers['F... | true |
9bb5cdcb20920074d0cdccdf6c9ddb55d354b610 | Python | kavdev/python-doc-inherit | /doc_inherit/metaclasses.py | UTF-8 | 1,358 | 2.703125 | 3 | [
"Python-2.0",
"MIT"
] | permissive | """
.. module:: doc_inherit.metaclasses
:synopsis: python-doc-inherit MetaClass Decorators
This is a more robust version of the ``method_doc_inherit`` decorator that uses
a metaclass in order to not break other method decorators.
http://stackoverflow.com/questions/8100166/inheriting-methods-docstrings-in-pyt... | true |
2672340b8c685262ea42c3a9caa5eb58336e885f | Python | donesky/ExpressionRecognition | /dataSet/utilText.py | UTF-8 | 2,714 | 3.546875 | 4 | [] | no_license | """This module is used to implement IO operations as a tool.
It is called after the face detection,the purpose is to save the detected feature values in a document for later use.
The operations for reading the detected feature values from the text are also implemented in this class.
.. note::
Feature values and c... | true |
68df966a3431be69b91ed076013ead1c1032fbe5 | Python | moisesb08/CST-205 | /CST 205/Portfolio/bottomTopMirror.py | UTF-8 | 412 | 3.078125 | 3 | [] | no_license | def bottomTopMirror(pic):
""" Flips half the picture about the y-axis
From bottom to top
Returns the edited picture, pic
pic: a picture that will be manipulated
"""
height = getHeight(pic)
for x in range(0, getWidth(pic)):
for y in range(0, height/2):
c = getColor(getPixel(pic, x, hei... | true |
c6b96513abc7b3cb812d9988011060b1c12395ec | Python | zhengsizuo/leetcode-zhs | /数据结构/单调栈/84-柱状图中的最大矩形.py | UTF-8 | 1,389 | 3.8125 | 4 | [] | no_license | """超出时间限制"""
class Solution:
def largestRectangleArea(self, heights) -> int:
if not heights:
return 0
heights.append(0)
dp = [0] * len(heights)
dp[0] = heights[0]
for i in range(1, len(heights) - 1):
max_rec = dp[i - 1]
for j in range(0, ... | true |
b1545497f2928e89c83ebcbeedbf5e1b770b23ed | Python | hemanthpratury/Data-Structures-Solving-Using-Python | /Searching/RecursiveBinarySearch.py | UTF-8 | 370 | 3.703125 | 4 | [] | no_license | def rec_binary_search(arr,ele):
if len(arr) == 0:
return False
else:
mid = len(arr)//2
if(arr[mid] == ele):
return True
if(ele>arr[mid]):
return rec_binary_search(arr[mid+1:],ele)
else:
return rec_binary_search(arr[:mid],ele... | true |
b156a2fbb2bb2a11e61e29eeda00561f332db7aa | Python | indigoYoshimaru/COSIM | /compiler_parser.py | UTF-8 | 8,805 | 3.1875 | 3 | [] | no_license | import lexical as lClass
# def add_to_list(l, value):
# l.append(value)
# return value
def check_range(position, tokens):
if position < 0 or position >= len(tokens):
raise Exception("out of range")
def parse_group(tokens, position, min, max, parse_func):
current_position = position
chec... | true |
26442d70708e90569d030ed6fc11c177ac385ea2 | Python | antonysama/cdQA | /cdqa/utils/download.py | UTF-8 | 3,346 | 2.5625 | 3 | [] | permissive | import os
import wget
def download_squad(dir="."):
"""
Download SQuAD 1.1 and SQuAD 2.0 datasets
Parameters
----------
dir: str
Directory where the dataset will be stored
"""
dir = os.path.expanduser(dir)
if not os.path.exists(dir):
os.makedirs(dir)
# Download S... | true |
5b9f16c41825f880530f4da6fb678a41ac6c8268 | Python | IEEERASWinterSchoolConsumerRobotics2017/facial_recognition_with_cozmo | /tcp_funcs.py | UTF-8 | 1,556 | 2.703125 | 3 | [] | no_license | import datetime
import socket
TCP_IP = '10.18.81.7'
TCP_PORT = 8896
BUFFER_SIZE = 1024
#Robot: TCP 8896
# Def: Get item user wants
# req item des
# rep item des item(%s)
#
# Def: Guest Entered Room
# set guest enter time(%s yyyy-mm-dd-hh-mm-ss)
# rep ok
#
# Def: Intruder
# set guest intrud... | true |
6b354ffdb058230311ecd5e16aa01b6fa7c2123c | Python | ugabiga/flask-boilerplate | /tests/helper/request.py | UTF-8 | 868 | 2.6875 | 3 | [] | no_license | import json
from typing import Dict
from flask import Response
from flask.testing import FlaskClient
class ResponseHelper:
def __init__(self, response: Response) -> None:
self._response = response
def get_data(self) -> Dict:
return json.loads(self._response.data.decode("utf-8"))
def get... | true |
72b05cc18b365284b45e67e3d4d2c10e72809d1b | Python | sakoki/ncbi_taxonomy | /ncbi_taxonomy/taxonomy.py | UTF-8 | 4,227 | 3.09375 | 3 | [] | no_license | import pandas as pd
from collections import deque
from ncbi_taxonomy.IO import read_nodes_dmp, read_names_dmp
class TaxonomyNode():
"""Taxonomy node"""
def __init__(self, tax_id: str):
self.tax_id = tax_id
self.rank = None
self.name_txt = None
self.parent_tax_id = None
... | true |