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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d614b4df5b82b2695748ae5ba513bd8b2e8e2009 | Python | HyeonGyuChi/2019_1st_Semester | /Python_Programing/Exercise10/T1.py | UTF-8 | 1,586 | 3.203125 | 3 | [] | no_license | import sqlite3
# con, corsor 생성
con = sqlite3.connect("new_testDB")
cursor = con.cursor()
# create table > 연결자.commit()
try :
sql = "CREATE TABLE IF NOT EXISTS productTable(num integer primary key autoincrement, pCode char(5), pName char(15), price integer, amount integer)"
cursor.execute(sql)
except :
pr... | true |
e454cca79602b7c4354485d5f723b72ed975967c | Python | Jinxiatucla/Clustering | /b.py | UTF-8 | 2,341 | 2.703125 | 3 | [] | no_license | import a
import numpy as np
from scipy.sparse.linalg import svds
from sklearn.decomposition import TruncatedSVD
from sklearn.decomposition import NMF
import pylab as pl
r = [1, 2, 3, 5, 10, 20, 50, 100, 300]
data = a.retrieve_data()
# plot the variance v.s. r
def get_svd(tfidf):
number = 1000
U, s, V = svds(t... | true |
4134fcb65b1c33170fe00a8d77a4f49afc9671c0 | Python | micahjones13/Sprint-Challenge--Hash-BC | /hashtables/ex1/ex1.py | UTF-8 | 1,617 | 3.71875 | 4 | [] | no_license | # Hint: You may not need all of these. Remove the unused functions.
from hashtables import (HashTable,
hash_table_insert,
hash_table_remove,
hash_table_retrieve,
hash_table_resize)
def get_indices_of_item_weights(weight... | true |
1de9797d66191f8331ddfc7d1e3d4db201a1258c | Python | Surja1997/Python-assignments-1 | /data structures/LinkedList.py | UTF-8 | 1,184 | 4.1875 | 4 | [] | no_license | class Node:
def __init__(self, value):
self.value = value
self.next = None
class LList:
def __init__(self):
self.head = None
# creating an empty LL
LL = LList()
LL.head = Node("Surja")
sec = Node("Rohit")
third = Node("Mohit")
fourth = Node("Chandan")
LL.head.next = sec
sec.next = ... | true |
6b244bf7b3bd40985a32b6abc92e7be9cf7b7e13 | Python | sjy9412/startcamp | /day1/lotto.py | UTF-8 | 98 | 2.703125 | 3 | [] | no_license | import random
# numbers = range(1, 46)
lotto = random.sample(range(1, 46), 6)
print(sorted(lotto)) | true |
d45f166f9c84562656aac0585c8ca1c7b902c01e | Python | hemal507/CS-Algorithms | /test_arrayPacking.py | UTF-8 | 421 | 2.546875 | 3 | [] | no_license | import arrayPacking
def test_case1():
assert arrayPacking.arrayPacking([24, 85, 0]) == 21784
def test_case2():
assert arrayPacking.arrayPacking([23, 45, 39]) == 2567447
def test_case3():
assert arrayPacking.arrayPacking([1, 2, 4, 8]) == 134480385
def test_case4():
assert arrayPacking.arrayPackin... | true |
45a1713689638f97c996942a43475d6ce57157ae | Python | frandres/aletheia | /bills/download_spanish.py | UTF-8 | 1,713 | 2.71875 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import unicodedata
import re
import wget
import urllib
failed_articles = []
def get_url_soup(url,items_present,max_tries=100):
try_again = True
tries = 0
while try_again and tries<max_tries:
tries+=1
try:
try_again = False
... | true |
2f2cdfd135e10c6bf9914fb274fb53c5949a9686 | Python | DanaSergali/Programming | /project1/csv_writer.py | UTF-8 | 1,493 | 2.984375 | 3 | [] | no_license | import csv
from bs4 import BeautifulSoup
def parse_soup(article_path, text, source):
soup = BeautifulSoup(text, 'html.parser')
main_info = soup.find('div', {'class': 'news-info'}) # главная информация о статье
header = main_info.find('strong').get_text()
header = header.replace("\t", "")
header ... | true |
fa2083b9ee41195cd71bc6ed83f5656ab5f1c85b | Python | RajaSekar1311/Data-Science-and-Visualization-KITS | /Data Frame & Load Excel File/DescribeDataFrame.py | UTF-8 | 654 | 2.828125 | 3 | [] | no_license | import pandas
myFileName = 'Session2-KITS-Guntur-DataSet.xls'
with pandas.ExcelFile(myFileName) as myExcelFileReadObject:
myDataFrame1 = pandas.read_excel(myExcelFileReadObject,'Sem1-Marks')
myDataFrame2 = pandas.read_excel(myExcelFileReadObject,'Sem2-Marks')
#print(myDataFrame1.describe())
#print(myD... | true |
89a1c38f4bb97e2ed9544fe9ff84329c9345b89f | Python | curieuxjy/DS-for-PPM | /day1/Day1_PythonCode/day1_python_programming_11.py | UTF-8 | 423 | 3.34375 | 3 | [] | no_license | # Module
#
import myFunctions
x = 1
y = 2
z = myFunctions.sum(x,y); print('sum: ', z)
z = myFunctions.average(x,y); print('average: ', z)
z = myFunctions.power(x,y); print('power: ', z)
#from myFunctions import sum, average, power
#
#x = 1
#y = 2
#
#z = sum(x,y); print('sum: ', z... | true |
59b1fe00c53f9920d99c4b54462ce587c564ffd7 | Python | marikoll/FYS4150_projects | /project_4/python_code/ising_run4c.py | UTF-8 | 5,957 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Calculates and plots expectation values as function of MC-cycles for a
20x20 lattice with temperature T = 1.0 and T = 2.4
"""
import numpy as np
from numba import prange
import time
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import zoo... | true |
8241b067042683930266ec0d5ac343978fb540f8 | Python | shaan2348/hacker_rank | /playfair_cipher_2.py | UTF-8 | 635 | 3.4375 | 3 | [] | no_license | def matrix(key):
m = []
alphabet = "ABCDEFGHIKLMNOPQRSTUVWXYZ"
for i in key.upper():
if i not in m:
m.append(i)
for i in alphabet:
if i not in m:
m.append(i)
m_group = []
for i in range(5):
m_group.append('')
m_group[0] = m[0:5]
m_group[... | true |
8cbbb763f42c828db008ffd6af774e2c814978fe | Python | simdax/synchroVid | /capture.py | UTF-8 | 1,156 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import cv2
import os
class Capture():
def __init__(self, filename=os.path.abspath("video.mkv") ):
print filename
self.c = cv2.VideoCapture(str(filename))
print(self.c)
self.go = False
#helper
def tbCallback(self, n):
self.c.set(1,n)
... | true |
a2d2e4491f3d2f32dcfe3e55e28f8ce25f0bfad0 | Python | zuoguoqing/gqfacenet_recognition | /test_facenet_recognition.py | UTF-8 | 5,516 | 2.515625 | 3 | [
"MIT"
] | permissive | import cv2
from test_facenet_register import FaceRecognition
from PIL import Image, ImageDraw
import multiprocessing as mp
import time
face_recognition = FaceRecognition("config_facenet.yaml")
def recognition_photo():
frame = Image.open('datasets/multiface.jpg')
results = face_recognition.recognition(frame)
... | true |
f90a697387c5932f87b9163de47257f1d0193f49 | Python | Lalala-xnk/Machine-Learning-in-Finance | /preprocessing/preprocessing.py | UTF-8 | 3,470 | 2.984375 | 3 | [] | no_license | import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
def refresh(df):
# remove meaningless and defective data, for example, remove NAN and change '60 months' to '60'
# only the first 10 lines are read for testing
newdf = df[['loan_amnt', 'term', ... | true |
7b2a334c5672abdac69ace296768a424fe32f141 | Python | ananthkalki/melange-colour-detector | /crop.py | UTF-8 | 854 | 2.734375 | 3 | [] | no_license | from PIL import Image
import cv2
import imutils
image = cv2.imread(r".jpg")
resized = imutils.resize(image, width=300)
ratio = image.shape[0] / float(resized.shape[0])
# convert the resized image to grayscale, blur it slightly,
# and threshold it
gray = cv2.cvtColor(resized, cv2.COLOR_BGR2GRAY)
blurred = c... | true |
78be12b58049a6ec9ba0a57832001e1df52324d1 | Python | BrankoFurnadjiski/ProteinProteinInteractions | /prepareFullGO_v2.py | UTF-8 | 2,885 | 2.71875 | 3 | [] | no_license | """
This file connects string-db protenins with GO annotations according to GO Consortium
"""
import gzip
import time
# Counter for skipping rows
counter = 1
# Flag for skipping first row
flag = True
# Dictionary for mapping from stringID to uniprotIDs
stringMapping = dict()
# Dictionary for mapping from uniprotID ... | true |
cda37b6322660a5b9bdbb27127f084055d793c56 | Python | aaronmorgenegg/cs5665 | /final_project/src/stats/states.py | UTF-8 | 2,856 | 2.984375 | 3 | [] | no_license | from src.data_processing.classifier import STATE_NAMES
def getStateRatios(state_data):
"""
:param state_data:
:return: state_ratios
[{state: ([ally, ratio]}, {state: [tally, ratio]}]
"""
state_ratios = []
for i in range(len(state_data[0])):
state_tally = [0]*len(STATE_NAMES)
... | true |
4888ec684f92589be035aecf8663985caba52b10 | Python | NaokiEto/CS171 | /hw7/keyframe.py~ | UTF-8 | 21,656 | 2.5625 | 3 | [] | no_license | #!/usr/bin/python
from OpenGL.GL import *
from OpenGL.GL.shaders import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
import sys
import pyparsing as pp
from math import pi, sin, cos, acos, sqrt
import numpy as np
def idle():
global Initial
if (counterframe == -1 and Initial == 0):
glClearColor... | true |
48fb7d2b450ca7d111bc170baf0c8c56a3351d99 | Python | jlnerd/pyDSlib | /pyDSlib/ML/postprocessing/transform.py | UTF-8 | 395 | 3.03125 | 3 | [
"MIT"
] | permissive |
def one_hot_proba_to_class(y_proba, proba_threshold = 0.5 ):
"""
Transform a one-hot encoded style numpy array of probablities into 0, 1 class IDs
Arguments:
----------
y_proba: numpy array
"""
for i in range(y_proba.shape[1]):
y_proba[:,i][y_proba[:,i]>=proba_threshold] = ... | true |
49f6f86d7d6f4ff4dc76c87dfd92ae720bf8bcf7 | Python | WeddingCandy/Huaat_2018 | /label_auto/labels_pre_classify_to_independent_doc_v2.py | UTF-8 | 3,735 | 2.703125 | 3 | [] | no_license | # -*- coding:UTF-8 -*
import pandas as pd
import re
import numpy as np
from jieba import posseg as pg
import jieba
import jieba.analyse
import os
"""
用来将新扒下来的标签切词分类。
其中有:
1.过滤词,过滤网页专业术语词;
2.文档只包含一级大类和HEAD信息
"""
# jieba.enable_parallel()
def modify_output(s):
pattern1 = re.compile('[ \[\]\'《》\<\>‘’“”\"\(\)]+')
... | true |
8eb56af2c2ef4fdf6a04c3e251fd0eecdb3c63bb | Python | alshamiri5/makerfaire-booth | /2018/burger/generator/label_burger.py | UTF-8 | 2,269 | 3.078125 | 3 | [
"Apache-2.0",
"CC-BY-4.0"
] | permissive | import sys
sys.path.insert(0, "../constants")
from constants import MAX_BURGER_HEIGHT
from burger_elements import BurgerElement
def label_burger(burger, debug=False):
if len(burger) != MAX_BURGER_HEIGHT:
if debug: print("Burger is wrong size")
return False
for i in range(len(burger)):
if (burger[i] == B... | true |
9793cbd62ebe18f8582b62df40c742082faf74cb | Python | Delayless/TL740D_Gyro | /ASCII_conv_hex.py | UTF-8 | 1,695 | 3.640625 | 4 | [] | no_license | class Converter:
@staticmethod
# 比如这里实参只能是不包含前导符0x的十六进制数(0-F)的字符串,如'6805000B0212'
# 可以转换成以这些十六进制数为ASCII码值所对应的字符串返回
def hex_to_ascii(h):
"""
转换成ASCII码值对应的字符串
这次使用我是将字符串'6805000B0212'转换,其中的68转换成h
因为68对应的十进制为104
104对应的ascii字符为h
:return str类型: h (,
""... | true |
b2f84a31a709a01647c2a33bf32f2e1faf4afdff | Python | diego-aquino/competitive-programming | /OBI/Exercices/dp/dequeProblem.py | UTF-8 | 902 | 3.296875 | 3 | [] | no_license | # Working solution!
def main():
n = int(input())
seq = tuple(map(lambda x: int(x), input().split()))
points = []
for i in range(n - 1):
points.append([0] * n)
if n == 1:
print(seq[0])
return
for i in range(n - 1):
points[i][i + 1] = (
max(seq[i], s... | true |
21c8c544344ff219c2064e210252b16f82e7f56f | Python | Kirishima21/yosei | /lib/medicinesName.py | UTF-8 | 697 | 2.875 | 3 | [
"MIT"
] | permissive | import PySimpleGUI as sg
import pandas as pd
def add_medicines_name(data):
print(data)
df = pd.read_excel('data.xlsx', sheet_name=None, index_col=0)
bool = not any(df["Sheet2"]["name"].str.contains(str(data)))
if bool:
df_add = pd.DataFrame([data], columns=['name'], index=['index'])
df1... | true |
39ff9426351030edaa0cdc09aec0c04671f5558e | Python | AlexFue/Interview-Practice-Problems | /dynamic_programming/fibonacci_number.py | UTF-8 | 1,486 | 4.3125 | 4 | [] | no_license | Problem:
The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is,
F(0) = 0, F(1) = 1
F(n) = F(n - 1) + F(n - 2), for n > 1.
Given n, calculate F(n).
Example 1:
Input: n = 2
Output: 1
Exp... | true |
d4e85b1b47d8080b72540bcc073758b4c601b6b9 | Python | CXY-YSL/MGZDTS | /Python/PythonCode/Chapter08/批量修改文件名.py | UTF-8 | 490 | 3.5 | 4 | [
"MIT"
] | permissive | # 批量在文件名前加前缀
import os
funFlag = 1 # 1表示添加标志 2表示删除标志
folderName = './'
# 获取指定路径的所有文件名字
dirList = os.listdir(folderName)
# 遍历输出所有文件名字
for name in dirList:
print(name)
if funFlag == 1:
newName = '[黑马程序员]-' + name
elif funFlag == 2:
num = len('[黑马程序员]-')
newName = name[num:]
print(... | true |
b62d453092f5ff3935d8ba0a36a72e4c28e29568 | Python | an2050/titop-tactic | /_lib/sequenceUtils.py | UTF-8 | 4,210 | 2.625 | 3 | [] | no_license | import re
class sequenceError(BaseException):
pass
class sequenceFileObject:
"""docstring for sequenceFileObject"""
def __init__(self, countType="houdini"):
self.active = False
self.countType = countType
self.countTypes = {"houdini": "${F%p%}", "nuke": "%0%p%d"}
# sel... | true |
5a9046c1eba9d6e7ef42ff7b3bfd75d5bf0775ba | Python | microsoftgraph/msgraph-sdk-python | /msgraph/generated/models/password_credential.py | UTF-8 | 4,546 | 2.625 | 3 | [
"MIT"
] | permissive | from __future__ import annotations
import datetime
from dataclasses import dataclass, field
from kiota_abstractions.serialization import AdditionalDataHolder, Parsable, ParseNode, SerializationWriter
from kiota_abstractions.store import BackedModel, BackingStore, BackingStoreFactorySingleton
from typing import Any, Cal... | true |
7d1cda0ec7e3da6448121cbab5a32fe52ec6664a | Python | acv0209/HancomMDS | /BigData/강의자료/1. 파이썬 입문/6 함수 만들기.py | UTF-8 | 182 | 3.75 | 4 | [] | no_license | '''
>>> add_num1(1,3)
1 + 3 = 4 (함수 안에서 출력되는 값)
4 (리턴값)'''
def add_num1(a, b):
c = a+b
print("{} + {} = {}".format(a, b, c))
return c
| true |
0b31f9da62f81219927cf65b085be664cc9c7bff | Python | jaychan09070339/Python_Basic | /practice_8/list1.py | UTF-8 | 204 | 3.5 | 4 | [] | no_license |
a=int(input("请输入第一个数:"))
b=int(input("请输入第二个数:"))
c=int(input("请输入第三个数:"))
L=[a,b,c]
print("average:",sum(L)/3)
print("max:",max(L))
print("min:",min(L))
| true |
cd9e0fff0d91e0efda90d647b596c60bae0f2d63 | Python | Aasthaengg/IBMdataset | /Python_codes/p02573/s558448832.py | UTF-8 | 3,012 | 2.765625 | 3 | [] | no_license | from __future__ import print_function
from functools import reduce
from operator import mul
from collections import Counter
from collections import deque
from itertools import accumulate
from queue import Queue
from queue import PriorityQueue as pq
from heapq import heapreplace
from heapq import heapify
from heapq imp... | true |
544c29119eb974b0ef38aa9815bc92138f60ba79 | Python | s-tefan/python-exercises | /plottalistor.py | UTF-8 | 941 | 3.328125 | 3 | [] | no_license | import graphics, math
def plottalistor(xlist,ylist,win,color='black'):
xmin=min(xlist)
xmax=max(xlist)
ymin=min(ylist)
ymax=max(ylist)
#w=win.getWidth()
#h=win.getHeight()
win.setCoords(xmin,ymin,xmax,ymax)
x0,y0=xlist[0],ylist[0]
for n in range(1,len(xlist)):
x1,y1 = xlist[... | true |
1f760666a12360e616b554da41348852a70d6c2b | Python | aish2028/stack | /s1.py | UTF-8 | 1,453 | 4.09375 | 4 | [] | no_license | class Stack:
def __init__(self):
self.st=[]
def push(self,ele):
self.st.append(ele)
def pop(self):
if self.is_empty():
print("stack is empty")
else:
ele=self.st.pop()
print(f"element {ele} is removed from the stack")
def search(self,se... | true |
4c2b30486593c81649a964d7107c030efd59e88f | Python | robinsingh-rs/Python | /EmailSender/emailsender.py | UTF-8 | 358 | 2.984375 | 3 | [] | no_license | import smtplib
to = input("Enter the email of receiver:\n") # email address
content = input("Enter the message:\n") # message
def sendEmail(to, content):
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.login('sender@email','password')
server.sendmail('sender email', to, content)
serve... | true |
0f622474b0a797b2fd000a63dd87538109494e7d | Python | jemtca/CodingBat | /Python/String-2/repeat_separator.py | UTF-8 | 459 | 4.09375 | 4 | [] | no_license |
# given two strings, word and a separator sep, return a big string made of count occurrences of the word, separated by the separator string
def repeat_separator(word, sep, count):
s = ''
if count > 1:
for _ in range(count-1):
s = s + word + sep
if count >= 1:
s = s + word
... | true |
412b5f3d44677c281d30bf01b23c9057157d2444 | Python | uilleand/PHY494 | /03_python/list_practice.py | UTF-8 | 229 | 3.015625 | 3 | [] | no_license | # homework assignment one, lol for Hitchiker references
bag = ["guide", "towel", "tea", 42]
ga = "Four score and seven years ago."
# work
for essentials in bag:
most_important = essentials in range(2,4)
print(most_important)
| true |
66ec35b9b6e6ac434c9945457dcdb3b682bcdae4 | Python | shmundada93/InstamojoTweetBot | /worker.py | UTF-8 | 3,256 | 2.5625 | 3 | [] | no_license | import tweepy
from tweepy import Stream
from tweepy import OAuthHandler
from instamojo import Instamojo
import re
import os
import psycopg2
import urlparse
# Twitter Consumer keys and access tokens, used for OAuth
consumer_key = 'nZEzUToqKZcMIWu4nSNXnq6Kq'
consumer_secret = 'xZpwdeiE4FnhQ5E4SE7O3KKa3FCzNWiPfDGRvrIPyH... | true |
7d3c06cb73eef1e258450d3a2c9c61751f645005 | Python | Michael-DaSilva/HEIGVD-SWI21-Labo1-WEP | /files/manual-fragmentation.py | UTF-8 | 2,243 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Manually encrypt a wep message given the WEP key and fragment the packet"""
__author__ = "Michaël da Silva, Nenad Rajic"
__copyright__ = "Copyright 2021, HEIG-VD"
__license__ = "GPL"
__version__ = "1.0"
__email__ = "michael.dasilva@heig-vd.ch, nena... | true |
d904a5cbbdf64387868c0124cfd3153800a536aa | Python | escottrose01/pyGravSim | /engine.py | UTF-8 | 2,107 | 2.796875 | 3 | [] | no_license | import pygame
class SceneBase:
def __init__(self):
self.next = self
def ProcessInput(self, events, pressed_keys):
# Put anything that involves input in here
print("uh-oh, you didn't override this in the child class")
def Update(self):
# Put anything that happens regardless of input here
print("uh-oh, y... | true |
fe8f495ccba7666cd019c30f1061cdf5d7d0e5fe | Python | hlee131/todoer | /todoproject/accounts/tests.py | UTF-8 | 2,513 | 2.9375 | 3 | [] | no_license | import json
from rest_framework.test import APIClient, APITestCase
from django.contrib.auth.models import User
from django.urls import reverse
# Create your tests here.
class TestUserAPI(APITestCase):
def setUp(self):
"""
First part, all sets up client, url, user that will be used in both test ca... | true |
a843e2472a7f68bcdc03e35c6f8d4c94b6c8fffc | Python | ipa-rar/pipeline | /tests/test_storage.py | UTF-8 | 2,104 | 2.6875 | 3 | [
"MIT"
] | permissive | from .common import make_temp_path
from pipeline.storage.state import StateStorageEmpty, StateStorageFile
from pipeline.core import PipelineError
import pytest
class TestStateStorageEmpty:
def test_set_value(self):
state_storage = StateStorageEmpty()
state_storage.set_value("key_name", 123)
... | true |
f5acecd14d3c9b241b2b255ca6e9a3ffa0d1a1a4 | Python | BhanuPrakash-07/app-lock-with-random-password-daily | /RandomPassword/rpsg.py | UTF-8 | 1,466 | 2.8125 | 3 | [] | no_license | import time
from time import ctime
import subprocess
import tkinter
import random as r
from tkinter import PhotoImage
top=tkinter.Tk()
top.geometry('400x400')
var1=tkinter.StringVar()
prev='12'
def cur_time():
import requests as req
tot=req.get('http://worldtimeapi.org/api/timezone/Asia/Kolkata.txt'... | true |
3491b309bc26e884f04f0e0029ed2e9b66ef3b6c | Python | king-11/Information-Technology-Workshop | /python assignments/Assignment1/assignment1/23.py | UTF-8 | 195 | 3.3125 | 3 | [] | no_license | # function arguments two lists
# iterates over both simulatenously
# print both list until least lenght one exhusted
def fun23(a: list, b: list):
for x, y in zip(a, b):
print(x, y)
| true |
9510b68c81b031d2d691ced327b0c48de5b72cef | Python | Aasthaengg/IBMdataset | /Python_codes/p02970/s670787418.py | UTF-8 | 63 | 2.59375 | 3 | [] | no_license | a = list(map(int,input().split()))
print(-(-a[0]//(2*a[1]+1)))
| true |
6877315225589aba2dce2d32f7d8638da30b108e | Python | kball/ambry | /ambry/library/util.py | UTF-8 | 1,343 | 2.5625 | 3 | [
"BSD-2-Clause"
] | permissive | """A Library is a local collection of bundles. It holds a database for the configuration
of the bundles that have been installed into it.
"""
# Copyright (c) 2013 Clarinova. This file is licensed under the terms of the
# Revised BSD License, included in this distribution as LICENSE.txt
# Setup a default logger. The ... | true |
d637d32aa22f14cf52bd5df7f2bcc5510b647050 | Python | NiranjanaDeviA/guvi | /codekata/91surface.py | UTF-8 | 72 | 2.515625 | 3 | [] | no_license | l,b,h=map(int,input().split())
vol=l*h*b
s=2*(l*b+l*h+h*b)
print(s,vol)
| true |
569b2fb27b97d36df38c9ffe68386b8440f8927f | Python | sathwikacharya/Automated-Essay-Grading | /code.py | UTF-8 | 8,202 | 2.859375 | 3 | [] | no_license | #Importing the libraries
import numpy as np
import pandas as pd
#import matplotlib.pyplot as plt
#import seaborn as sns
import streamlit as st
from textblob import TextBlob
import numpy as np
import pandas as pd
import nltk
import re
from nltk.corpus import stopwords
from gensim.models import Word2Vec
from... | true |
f039461af072f605cbba79c23c088874154fe7ff | Python | ghjm/advent2019 | /p12.py | UTF-8 | 2,617 | 3.125 | 3 | [] | no_license | #!/bin/env python
import sys
import re
import copy
import math
def lcm(a):
lcm = a[0]
for i in a[1:]:
lcm = lcm*i//math.gcd(lcm, i)
return lcm
if __name__ == '__main__':
bodies = list()
with open("inputs/input12.txt", "r") as file:
r = re.compile('\< *x=([+-]?\d+), *y=([+-]?\d+), ... | true |
6000cda8682cbb2852bcc64e00fc23315ec3a4c6 | Python | Vigneshwaran07/HackerRank-Random-Problem-Solving-Solutions | /Jumping on the Clouds.py | UTF-8 | 164 | 3 | 3 | [] | no_license | n = int(input())
c = list(map(int,input().strip().split()))
c.insert(n,0)
count = 0
i = 0
while (i < n-1):
i += (c[i+2] == 0) + 1
count += 1
print (count)
| true |
ed0b3312322112426e8b8a23c9b6cfaf39182c76 | Python | PhilBaird/SYSC3010_phil_baird | /Else/Initials.py | UTF-8 | 1,117 | 2.546875 | 3 | [] | no_license | from sense_emu import SenseHat
import time
#import keyboard
sense = SenseHat()
keydown = 0
keyup = 0
p = True
while True:
time.sleep(1)
sense.clear()
#key = keyboard.read_key()
#print( key )
#if key == keydown || key == keyup:
if p:
for i in range(7):
... | true |
9df20c36373453098946f92b07f18d0ec912ca28 | Python | Gandi/dnsknife | /dnsknife/challenge.py | UTF-8 | 853 | 2.75 | 3 | [] | no_license | """
POC for a stateless challenge/response TXT domain ownership validation.
"""
import hashlib
import hmac
import time
def valid_tokens(domain, secret, validity=86400):
if isinstance(secret, str):
secret = secret.encode()
if isinstance(domain, str):
domain = domain.encode('idna')
def to... | true |
643cd636ebed0588e787dc269ef2cd2698f55009 | Python | Yang-Jianlin/python-learn | /python_BB/demo12.py | UTF-8 | 158 | 3.375 | 3 | [] | no_license | import re
str1 = 'I am is str'
print(re.sub('str', 'as', str1))
str2 = 'I am is yang, and:are you Li'
print(re.split(r'[,:]', str2))
print(str2.split(' '))
| true |
6ae1383b46cd0453a091723fd7cc8bae6f5b6d4c | Python | jamesmkrieger/ProDy | /prody/atomic/nbexclusion.py | UTF-8 | 4,042 | 2.984375 | 3 | [
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-biopython",
"LicenseRef-scancode-unknown-license-reference",
"Python-2.0",
"BSD-2-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""This module defines :class:`NBExclusion` for dealing with bond information provided
by using :meth:`.AtomGroup.setNBExclusions` method."""
from numbers import Integral
import numpy as np
__all__ = ['NBExclusion']
class NBExclusion(object):
"""A pointer class for nonnonbonded exclusio... | true |
12ea5ba39c1863bc7416b2895ced62109252ce7f | Python | awk001/pytest | /web/test_cation.py | UTF-8 | 629 | 2.546875 | 3 | [] | no_license | from time import sleep
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
d = webdriver.Firefox()
d.get("http://www.baidu.com")
d.implicitly_wait(10)
d.maximize_window()
element = d.find_element(By.ID, ... | true |
9e0911406954b20c3699c8e692809ea0a3913e26 | Python | sngjuk/fuzzy-flow | /src/client.py | UTF-8 | 14,113 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import pickle
import re
from collections import OrderedDict
from time import sleep
import zmq
import node
class FuzzyClient:
def __init__(self, ip='localhost', port=5555):
self.ip = ip
self.port = port
self.context = zmq.Context()
self.socket = self.context... | true |
46983acf6284034c88a1964a3919e95dd7030c01 | Python | YogPanjarale/RDB-RandomDiscordBot- | /discordbot/my_utils/get_covid_data.py | UTF-8 | 912 | 2.546875 | 3 | [] | no_license | import json
import requests
from dataclasses import dataclass
@dataclass()
class CovResponse():
updated: int
cases:int
active: int
recovered: int
deaths: int
todayCases: int
todayRecovered: int
todayDeaths: int
critical: int
casesPerOneMillion: int
deathsPerOneMillion: int
... | true |
a04dedee57e20d31d2c4fe3fc7a5ab57342f61d2 | Python | zeenat19/dictionary_question | /addlist.py | UTF-8 | 147 | 3.515625 | 4 | [] | no_license |
list1=["one","two","three","four","five"]
list2=[1,2,3,4,5,]
dict1={}
i=0
while i<len(list1):
dict1[list1[i]]=list2[i]
i=i+1
print(dict1) | true |
4cb7c76311fad538a960170aa4eeb1c8b6229429 | Python | targeton/LeetCode-cn | /Solutions/678.有效的括号字符串.py | UTF-8 | 1,614 | 3.640625 | 4 | [] | no_license | #
# @lc app=leetcode.cn id=678 lang=python3
#
# [678] 有效的括号字符串
#
# https://leetcode-cn.com/problems/valid-parenthesis-string/description/
#
# algorithms
# Medium (32.23%)
# Likes: 104
# Dislikes: 0
# Total Accepted: 5.7K
# Total Submissions: 17.6K
# Testcase Example: '"()"'
#
# 给定一个只包含三种字符的字符串:( ,) 和 *,写一个函数来检验这... | true |
d81b346c0fd0901d2be9408140063ad42a876b4f | Python | SamuelLellis/TextBasedAdventureGame | /sam.py | UTF-8 | 1,248 | 3.59375 | 4 | [] | no_license | def scenario1(choice):
print("As you begin to approach the car sounds of scratching begin to eminate from the truck of the car. Would you like to investigate?")
choice1 = input("Would you like to investigate? Yes or no")
if(choice1.lower() == yes):
death1()
def death1():
print("You manage to pu... | true |
30d84725a970f8a4df365dda018a17f863e48215 | Python | augustin-barillec/google-pandas-load | /tests/utils/pandas_normalize.py | UTF-8 | 307 | 2.796875 | 3 | [
"MIT"
] | permissive | from copy import deepcopy
def sort(df):
res = deepcopy(df)
cols = list(res.columns)
res = res.sort_values(cols)
return res
def reset_index(df):
res = deepcopy(df)
return res.reset_index(drop=True)
def normalize(df):
res = sort(df)
res = reset_index(res)
return res
| true |
f3baeb009bdc6ccdd734e72330bca26ec69e2e4c | Python | dromakin/substringAlgorithms | /src/libs/rabin_karp.py | UTF-8 | 2,183 | 3.625 | 4 | [
"MIT"
] | permissive | from src.libs.timing import *
# @speed_test
class Hash:
'''
hash class to simplify code function rabin_karp.
'''
def __init__(self, string, size):
self.str = string
self.hash = 0
for i in range(0, size):
self.hash += ord(self.str[i])
self.init = 0
... | true |
285e51b35c1e91abc7500dc94c2c7f05ef066919 | Python | robinelting/gevprofp | /test_finalproject.py | UTF-8 | 2,562 | 3.234375 | 3 | [] | no_license | import unittest
import finalproject
class test_tokenizer(unittest.TestCase):
def test_tokenizer(self):
'''Checks if function returns a clean and lowercased sentence'''
sentence = finalproject.tokenizer('My mama always said life was like a box of chocolates. You never know what you\'re gonna g... | true |
12dfb8861afd30d27154bfe698a9a3504bcae291 | Python | lucasrodrigues10/processamento_imagens | /lab_2/ex_2.py | UTF-8 | 606 | 3.078125 | 3 | [] | no_license | import numpy as np
import cv2
from matplotlib import pyplot as plt
# le
img = cv2.imread('sunset3.bmp', 0)
# transformada
f = np.fft.fft2(img)
fshift = np.fft.fftshift(f)
mag = 20 * np.log(np.abs(fshift))
# soma os niveis cinzas
soma_cinza = np.sum(img)
print('Soma: ', soma_cinza)
numero_pixels = len(img) * len(img)... | true |
d4c3d9a4c63232a94a071374b6b71d96ca8b9f92 | Python | Devesh-Maheshwari/nlp-python-deeplearning | /Part-08 Web Deployments/api.py | UTF-8 | 1,912 | 2.5625 | 3 | [
"MIT"
] | permissive | import logging
import flask
import os
import numpy as np
from flask import Flask, jsonify, render_template, request
from scipy import misc
from sklearn.externals import joblib
app = Flask(__name__)
# create logger
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
# create file handler which logs ev... | true |
a2a982c5a896e5b1958d5f6d521ed10b551a6ab4 | Python | leticiaglass/projetos-educacionais-python | /práticaE_planoinclinado.py | UTF-8 | 2,067 | 4.03125 | 4 | [] | no_license | # programa principal
from praticaE2_functions import * # Importando todas as funções criadas no módulo de funções
assunto = "Plano inclinado 3." # Definindo assunto e informações relevantes
print(assunto)
print("O tema deste exercício será o seguinte sistema: dois blocos conectados por um fio que passa por uma polia, ... | true |
38f5192faf88c1327912b230c247e46dcc3d2f26 | Python | liaowucisheng/self-study-Python | /01周/python程序/用for循环实现1~100求和.py | UTF-8 | 472 | 4.34375 | 4 | [] | no_license | sum = 0
for x in range(101):
sum += x
print(sum)
"""
range(101):可以用来产生0到100范围的整数,需要注意的是取不到101。
range(1, 101):可以用来产生1到100范围的整数,相当于前面是闭区间后面是开区间。
range(1, 101, 2):可以用来产生1到100的奇数,其中2是步长,即每次数值递增的值。
range(100, 0, -2):可以用来产生100到1的偶数,其中-2是步长,即每次数字递减的值。
""" | true |
38174cf96db3ae42d585a716c09e6f585cdbaa76 | Python | nevin-watkins/dog_breed_app | /models/run_model.py | UTF-8 | 2,772 | 2.765625 | 3 | [
"MIT"
] | permissive | # This is where I'm keeping the Restnet Algorithm
import numpy as np
from keras.models import Sequential
from keras.layers import GlobalAveragePooling2D, Conv2D, Dropout, GlobalAveragePooling2D
from keras.layers import Dense
from keras.models import Sequential
from keras.callbacks import ModelCheckpoint
import s... | true |
4d11edf48b9b12e91dd317bcae09e214ba5b7c1e | Python | ynbella/draco | /draco/triangle.py | UTF-8 | 3,826 | 3.296875 | 3 | [] | no_license | from math import acos, pow, sqrt, degrees, isclose
from itertools import combinations
from star import Star
class Triangle:
def __init__(self, a: Star, b: Star, c: Star):
self.stars = [a, b, c]
self.sides = self._calculate_sides(self.stars)
self.sorted_sides = sorted(self.sides)
s... | true |
88c9f443f80ad6f7e8798912f28a4e63b253cd84 | Python | justinhsg/AdventOfCode2016 | /4/security.py | UTF-8 | 1,204 | 2.75 | 3 | [] | no_license | with open("input.txt", "r") as infile:
raw = infile.read().split("\n")
pretty = []
for i in raw:
checksum = i[-6:-1]
wordsval = i[:-7].split("-")
letters = "".join(sorted("".join(wordsval[:-1])))
value = int(wordsval[-1])
pretty.append([letters, checksum, value])
part1 = 0
for i in pretty:
... | true |
d1164c138d0d51dd74bf5454fbc80074768f9d2c | Python | junghankim-git/test_codes | /program/geopotential_height/center.py | UTF-8 | 562 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
p0 = 100000.0
kapa = 2.8571658640413355e-1
def center(p1,p2):
p12_org = (p1+p2)/2.
pi1 = (p1/p0)**kapa
pi2 = (p2/p0)**kapa
pi12 = (pi1+pi2)/2.
p12 = p0*pi12**(1./kapa)
return p12_org, p12
def exner(p):
return (p/p0)**kapa
pi1 = 900000.
pi2 = 800000.
pim = (pi1+pi2)/2... | true |
f03bce739f3c0635d0838e7f184f4069c916f4e7 | Python | Eradch/3 | /4.py | UTF-8 | 146 | 3.15625 | 3 | [] | no_license | def m_pow_fun(x, y):
try:
res = x ** y
except TypeError:
return "Error"
return res
print(m_pow_fun(2, -3))
| true |
08ba1abda0c7d56eda621347fe71b16ef45016c4 | Python | RadiObad/1MAC-Workshop | /16 - Stores/Forums/main.py | UTF-8 | 792 | 2.828125 | 3 | [
"MIT"
] | permissive | import models, stores
member1 = models.Member("Manar", 23)
member2 = models.Member("Nour", 21)
post1 = models.Post("First Post", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
post2 = models.Post("Second Post", "Ut enim ad minim veniam, q... | true |
5919b504db342e96ef94cbe3adcf2c562652d197 | Python | samuelgerber/OrthogonalAutoencoding | /run-aec-sine.py | UTF-8 | 7,864 | 2.5625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import argparse
import time
import ae
import data2d
#fix seed
tf.set_random_seed(10)
np.random.seed(2)
parser = argparse.ArgumentParser(description='Autoencoder for spiral data set.')
parser.add_argument('--npoints', metavar='N', type=int, na... | true |
f21d1f04ba79d41656b1d7804e1fba99625434d4 | Python | xizhilang2/Python | /Learn PYTHON 3 the HARD WAY/ex20.py | UTF-8 | 607 | 3.6875 | 4 | [] | no_license | from sys import argv
script, inputFile = argv
def printAll(fileInput):
print(fileInput.read())
def rewind(fileInput):
fileInput.seek(0)
def printALine(lineCount, f):
print(f"This's {lineCount} line:", f.readline(), end="")
currentFile = open(inputFile)
print("First let's print the whole file:\n")
pri... | true |
2200a0ec533eed63764c3c0c5c5c41d2bf496ce0 | Python | Aasthaengg/IBMdataset | /Python_codes/p03005/s209409526.py | UTF-8 | 89 | 3.28125 | 3 | [] | no_license | balls, men = map(int,input().split())
if men == 1:
print(0)
else:
print(balls - men) | true |
4e10c52b4a56735ee519ed39938f9913db57c8c1 | Python | lizhaojiang/beautufulDay | /ajax_spider_demo/demo1.py | UTF-8 | 1,268 | 2.984375 | 3 | [] | no_license | from selenium import webdriver
import time
driver_path = r"D:\chromedriver\chromedriver.exe" #定义驱动目录 因为目录里面有斜杠 所以前面加r 表示是原生的字符串
#定义谷歌浏览器的驱动 需要传递驱动路劲
driver = webdriver.Chrome(executable_path=driver_path)
driver.get('https://www.baidu.com/')
# time.sleep(5)
# driver.close() #关闭当前页面
# driver.quit() #退出整个浏览器
# inputT... | true |
47982ef9cb7e965c663ccfd4187b306ae5f3ae7c | Python | rhyun9584/BOJ | /python/1182.py | UTF-8 | 252 | 2.859375 | 3 | [] | no_license | from itertools import combinations
N, S = map(int, input().split())
numbers = list(map(int, input().split()))
result = 0
for i in range(1, N+1):
for arr in combinations(numbers, i):
if sum(arr) == S:
result += 1
print(result) | true |
e488c69066a736b687229ac82cbb4f2b4808ffa2 | Python | igarnett6/CS-1114 | /1114 hw/hw5/ig907_hw5_q1.py | UTF-8 | 306 | 3.9375 | 4 | [] | no_license | userInput = input("Enter an odd length string: ");
middleChar = userInput[int((len(userInput)/2))];
firstHalf = userInput[:(int(len(userInput)/2))];
secondHalf = userInput[int(len(userInput)/2):];
print("Middle charcter: ",middleChar);
print("First half: ",firstHalf);
print("Second half: ",secondHalf);
| true |
d71b7a788d29b9ea8316cc29e14f55a62d2a4e5e | Python | khibma/HomeTemp | /main.py | UTF-8 | 6,017 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | import RPi.GPIO as GPIO
import os
import sys
import time
import datetime
import subprocess
import re
from AdafruitLibs.Adafruit_I2C import Adafruit_I2C
from AdafruitLibs.Adafruit_7Segment import SevenSegment
from AdafruitLibs.Adafruit_BMP085 import BMP085
import outsideWeather as weather
class SensorValues(object):
... | true |
91481083df38b01e8aa79fbfa9951b42a1a525f7 | Python | lfniederauer/pseudo | /pseudo/middlewares/aug_assignment_middleware.py | UTF-8 | 675 | 2.59375 | 3 | [
"MIT"
] | permissive | from pseudo.middlewares.middleware import Middleware
from pseudo.pseudo_tree import Node
class AugAssignmentMiddleware(Middleware):
'''
changes `%<x> = %<x> op %<value>` to `%<x> += %<value>` nodes
`
'''
@classmethod
def process(cls, tree):
return cls().transform(tree)
def transf... | true |
dad51d220681a7eaa10adb6ef49bf4499b981e8d | Python | saivikasmeda/NLP-Assignment1 | /HW1_P4_StandfordPOS.py | UTF-8 | 779 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[2]:
import re
import numpy as np
from nltk import pos_tag
def words_from_sentences(sentence):
return(sentence.split(' '))
def POScheck(sentence):
sent = words_from_sentences(sentence)
return (pos_tag(sent))
S1 = 'The chairman of the board is completely bold ... | true |
55459f2beb9f3ea16d00efa772f892ea89c5e566 | Python | atiger808/opencv-tutorial | /project-demo/Finger_detection.py | UTF-8 | 3,332 | 2.546875 | 3 | [] | no_license | # _*_ coding: utf-8 _*_
# @Time : 2019/9/17 18:09
# @Author : Ole211
# @Site :
# @File : Finger_detection.py
# @Software : PyCharm
import numpy as np
import cv2
import copy
import math
# variables
isBgCaptured = 0 # bool, whether the background captured
triggerSwitch = False
def nothing(x):
... | true |
922f5fdd857219214201d2fcea5d6be694c18378 | Python | anushreesrinivas/Data-Science | /inferential_statistics_exercise_2anushreesrinivas.py | UTF-8 | 4,411 | 3.640625 | 4 | [] | no_license |
# coding: utf-8
# # Examining Racial Discrimination in the US Job Market
#
# ### Background
# Racial discrimination continues to be pervasive in cultures throughout the world. Researchers examined the level of racial discrimination in the United States labor market by randomly assigning identical résumés to black-so... | true |
cc6c5eda714446eee04981caa58d75c22b2493bd | Python | anthonix-hub/bulk-printing-software | /bulk_py-print-V3.0.0.py | UTF-8 | 14,998 | 2.609375 | 3 | [] | no_license | import os
import time
import tkinter as tk
from datetime import date
from tkinter import *
from tkinter import filedialog, ttk
from tkinter.messagebox import *
from tkinter.ttk import Frame, LabelFrame, OptionMenu
import win32com
from PIL import Image, ImageTk
from win32com import client
import win32print ... | true |
2d00671224c188c3a663f4084168fcdde9f08038 | Python | dalab/matrix-manifolds | /experiments/diff_inconsistency.py | UTF-8 | 700 | 3.125 | 3 | [] | no_license | import torch
mat = torch.randn(4, 4, dtype=torch.float64)
mat = (mat @ mat.transpose(-1, -2)).div_(2).add_(torch.eye(4, dtype=torch.float64))
mat = mat.detach().clone().requires_grad_(True)
mat_clone = mat.detach().clone().requires_grad_(True)
# Way 1
chol_mat = mat.cholesky()
logdet1 = 2 * chol_mat.diagonal().log().... | true |
7b4e3bfe057a5abfab253d80c7287f7b31c54bcc | Python | AlertBear/oc-work-tools | /interact/Ldom.py | UTF-8 | 13,341 | 2.734375 | 3 | [] | no_license | #!/usr/bin/python
#
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
#
import time
import re
import pexpect
import os
from basic import *
class Ldom(object):
def __init__(self, name, password, port, record=False):
self.name = name
self.password = password # Telnet... | true |
def232e861f46b9019bd6716f7c4a086c9e858a0 | Python | Trakton/comunicacoes-moveis | /src/main.py | UTF-8 | 1,356 | 2.75 | 3 | [] | no_license | import pandas as pd
import numpy as np
import grid
import models
import fingerprint
import locate
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsRegressor
def main():
train_data = pd.read_csv('data/train.csv')
bst_data = pd.read_cs... | true |
fdabdea092454e64ef3c7d48b167fe10bc84bd5c | Python | HermanYang/SDKDocs | /lt_sdk/proto/configs/param_sweep.py | UTF-8 | 882 | 2.671875 | 3 | [] | no_license | import copy
class ParamSweep(object):
def __init__(self, name, base_fn, *args, **kwargs):
self.name = name
self.base_fn = base_fn
self.args = args # default args for base_fn, not swept over
self.kwargs = kwargs # string -> list
def generate(self):
# flatten params
... | true |
65a26ae44a92b88b86b505c3877f835ca738f6b2 | Python | LiuZechu/CS4246-mini-project | /source_code/agent/models.py | UTF-8 | 2,426 | 2.890625 | 3 | [] | no_license | import torch
import torch.autograd as autograd
import torch.nn as nn
class Base(nn.Module):
def __init__(self, input_shape, num_actions):
super().__init__()
self.input_shape = input_shape
self.num_actions = num_actions
self.construct()
def construct(self):
raise NotImpl... | true |
a44b49709172ea86298d461d90ef365452212639 | Python | DeepakSunwal/Daily-Interview-Pro | /solutions/3x3Sudoku.py | UTF-8 | 1,473 | 3.109375 | 3 | [] | no_license | from functools import reduce
from random import choice
def solver(board):
if isComplete(board):
return board
empty = [(x, y) for x in range(3) for y in range(3) if board[y][x] == 0]
col, row = choice(empty)
for val in range(1, 10):
board[row][col] = val
if isValid(board):
... | true |
c3180813f993cc381b26284bde414e1c4d7507f0 | Python | bitwalk123/PyGObject_samples | /gtk_spinbutton.py | UTF-8 | 735 | 3.15625 | 3 | [] | no_license | import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class MyWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="ボタン")
self.set_default_size(0, 0)
sb = Gtk.SpinButton()
adjustment = Gtk.Adjustment(value=0, lower=0, upper=100, step_increme... | true |
2e726dce34d8ca1356a29428916ef1dc458e9936 | Python | kinegratii/django-echarts | /django_echarts/entities/layouts.py | UTF-8 | 1,790 | 2.703125 | 3 | [
"MIT"
] | permissive | import re
from functools import singledispatch
from typing import List, Union
__all__ = ['LayoutOpts', 'TYPE_LAYOUT_OPTS', 'any2layout']
_defaults = {'l': 8, 'r': 8, 's': 8, 't': 6, 'b': 6, 'f': 12}
_rm = re.compile(r'([lrtbfsa])(([1-9]|(1[12]))?)')
class LayoutOpts:
"""Layout for user defined.
"""
__s... | true |
4c53054a0352d305f066a46c289b78c57564fa29 | Python | dials/dials | /tests/util/test_exclude_images.py | UTF-8 | 6,498 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | """
tests for functions in dials.util.exclude_images.py
"""
from __future__ import annotations
import copy
from unittest.mock import Mock
import pytest
from dxtbx.model import Experiment, ExperimentList, Scan
from dials.array_family import flex
from dials.util.exclude_images import (
_parse_exclude_images_comm... | true |
1902ee3475aceba8808f41923de97279d7e555d8 | Python | jstac/cycles_moral_hazard | /code/simulate_world_econ_ts.py | UTF-8 | 1,254 | 2.828125 | 3 | [
"BSD-3-Clause"
] | permissive | """
Functions for simulated two country time series
"""
import numpy as np
from integrated_econ import *
def simulate_world_econ(n,
country_x,
country_y,
x0=None,
y0=None,
stochastic=False):
# == Initialize arrays == #
x = np.empty(n)
y = np.empty(n)
c... | true |
86b2660fe22300d7b430e88a7face8ef12242eeb | Python | SunnySingh00/Decision-Tree | /utils.py | UTF-8 | 2,559 | 2.921875 | 3 | [] | no_license | import numpy as np
# TODO: Information Gain function
def Information_Gain(S, branches):
# S: float
# branches: List[List[int]] num_branches * num_cls
# return: float
avg = 0
list_tot = 0
for branch in branches:
list_tot +=sum(branch)
for branch in branches:
tot... | true |
836fe01726bc8a94a1067154afbff5e6afed2f06 | Python | lewy95/DebutPython | /basic/variable/variable.py | UTF-8 | 1,395 | 4 | 4 | [] | no_license | import math
import operator
import random
# money per kg
price = 8.5
# kg
weight = 7.5
# total money
money = price * weight
money -= 5
print(money)
# vac = "i am a variable"
# vac = 10086
# print(vac) # 10086
x = y = z = 10099
a, b, c = 1, 2, "haha"
print(type(c)) # <class 'str'>
# id()函数查看变量的内存地址
print(id(c)) # ... | true |
7f2f7cb3531e7a4a36a2efb726ad9f14db91c4a9 | Python | lynnbaratella/pynteractive-fiction | /FN_strFun.py | UTF-8 | 2,113 | 3.78125 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
# File: "strFun.py"
Gathers useful string functions, also from "cryptFunctions.py"
"""
def inputError(type):
print('ERROR: the input must be ' + type + '.')
# Asks the user to input a string
def promptString(message):
userInput = input(message)
while ... | true |
606ffdd7eb3d8cee53b72db851ce495ccdedc233 | Python | Willyou2/2018Hack112 | /TestController.py | UTF-8 | 7,243 | 2.921875 | 3 | [] | no_license | '''from inputs import devices
from inputs import get_gamepad
while True:
events = get_gamepad()
for event in events:
print(event.ev_type, event.code, event.state)'''
from tkinter import *
from inputs import get_gamepad
from inputs import get_key
from inputs import get_mouse
import msvcrt
import time
... | true |
6784ce7a1eeb8d91bef1c8f979e5438d139961c8 | Python | lingochamp/gym | /gym/envs/engzo/models.py | UTF-8 | 5,205 | 2.859375 | 3 | [
"MIT"
] | permissive | import random
import pickle
import os
import numpy as np
from gym import Space
from gym.spaces import Discrete
class BaseModel(object):
"""
BaseModel for engzo Adaptive Learning Env
"""
def __init__(self, _id=None):
self._id = _id
class KnowledgeGroup(BaseModel):
def __init__(self, lev... | true |