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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a1cb3f75b1eb3d32a6beed159b4ce8d07f359856 | Python | libxx1/CCeventcapture | /allseeingpievent.py | UTF-8 | 2,853 | 2.703125 | 3 | [] | no_license | from gpiozero import Button
from picamera import PiCamera
from time import gmtime, strftime
from overlay_functions import *
from guizero import App, PushButton, Text, Picture, TextBox
from twython import Twython
from auth import(
consumer_key,
consumer_secret,
access_token,
access_token_secret
)
def ne... | true |
954af84bd0e42c5acdcb865168ce5727a298fe76 | Python | finben/djattendance | /ap/services/models/__init__.py | UTF-8 | 1,540 | 2.5625 | 3 | [] | no_license | from seasonal_service_schedule import *
from service import *
from worker import *
from workergroup import *
from exception import *
from assignment import *
from week_schedule import *
from service_hours import *
""" services models.py
The services model defines both weekly and permanent (designated) services in the... | true |
6d9d79fea634071c4aa4cde10e74c19ef419cb56 | Python | Nakxxgit/PyQt5_Tutorial | /widgets/splitter.py | UTF-8 | 1,479 | 2.8125 | 3 | [] | no_license | import sys
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QFrame, QSplitter, QStyleFactory, QApplication
from PyQt5.QtCore import Qt
class Example(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
hbox = QHBoxLayout(self)
# 칸마다 경계를 나누기 위해 St... | true |
8ed1611e1c9b82bd1236a1e3f6a49f8c24081fdc | Python | FedML-AI/FedML | /python/fedml/model/linear/lr_cifar10.py | UTF-8 | 544 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | import torch
class LogisticRegression_Cifar10(torch.nn.Module):
def __init__(self, input_dim, output_dim):
super(LogisticRegression_Cifar10, self).__init__()
self.linear = torch.nn.Linear(input_dim, output_dim)
def forward(self, x):
# Flatten images into vectors
# print(f"size... | true |
b57b2daf808085520565605593f53c0f5c0979ac | Python | Helumpago/SimplePhysics | /model.py | UTF-8 | 1,958 | 3.171875 | 3 | [] | no_license |
import threading
from .base_obj import BaseObj
from .drawable import Drawable
from .event import Event
from .eventless_object import ParentError
"""
" Controls the flow of the simulation. In other words,
" this object defines the event-model-render loop.
" This object is the root of the scene graph for all
" simula... | true |
498f7712287058cda39912a91dae234e2c6b219f | Python | vikrembhagi/gardening-iot | /DHT/TempHumid/startDAC.py | UTF-8 | 3,120 | 2.5625 | 3 | [] | no_license | import smbus
import time
import dht11
import RPi.GPIO as GPIO
import paho.mqtt.publish as publish
import psutil
# ThingSpeak Channel Settings
# The ThingSpeak Channel ID
# Replace this with your Channel ID
channelID = "305122"
# The Write API Key for the channel
# Replace this with your Write API key
apiKey = "1NUY... | true |
930e8c2d848a72c8ddbcdebe1b9af8899720b2b9 | Python | Lucas-Guimaraes/Reddit-Daily-Programmer | /Easy Problems/41-50/49easy.py | UTF-8 | 3,060 | 3.765625 | 4 | [] | no_license | # https://www.reddit.com/r/dailyprogrammer/comments/tb2h0/572012_challenge_49_easy/
import random
def monty_hall():
winner = random.randint(1, 3)
choices = [1, 2, 3]
result_lst = ['car' if i == winner else 'goat' for i in range(1, 4)]
goat_doors = [i for i in range(1, 4) if result_lst[i-1] == ... | true |
581b8813826d95430361793e944c0f1e9e681b7f | Python | gayoung0838/bioinfo-lecture-2021 | /bioinfo_python/015-1.py | UTF-8 | 254 | 3.421875 | 3 | [] | no_license | #!/usr/bin/python3
# N = int(input())
# print(N * 2)
import sys
def make_double(num):
return num * 2
if len(sys.argv) != 2:
print(f"#usage: python {sys.argv[0]} [number]")
sys.exit()
num = int(sys.argv[1])
result = make_double(num)
print(result)
| true |
4d23f479c0d52b5aac75b40db94716144ea4dbc8 | Python | xingya1/tensorflow | /2/init.py | UTF-8 | 693 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 11 14:51:13 2018
@author: yao
"""
from sklearn import preprocessing
from sklearn import datasets
from numpy import *
def normalization(data,target):
min_max_scaler = preprocessing.MinMaxScaler()
data = min_max_scaler.fit_transform(data)
label = zeros([150,... | true |
38156292902f372260d965946fee6d5ec35ab0d3 | Python | Aileenshanhong/NLTK | /ex3.py | UTF-8 | 3,990 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 24 21:42:52 2017
@author: aileenlin
"""
import nltk, re, pprint
from nltk import word_tokenize
from urllib import request
url = "http://www.gutenberg.org/files/2554/2554.txt"
response = request.urlopen(url)
raw = response.read().decode('utf8')
type(raw)
len(raw)
raw[:75]
... | true |
8ffeb3c81c11f91cf7af3c133b49f1d905bb6daa | Python | coderZsq/coderZsq.practice.data | /study-notes/py-collection/11_列表/09_列表推导式_练习.py | UTF-8 | 1,674 | 3.78125 | 4 | [
"MIT"
] | permissive | import random as r
# 方法2
# 随机数的范围
edge = 10
# 随机数的数量
size = 20
# 生成随机数
nos = [r.randrange(edge) for _ in range(size)]
# 统计每一个随机数的出现次数
all_times = [0 for _ in range(edge)]
for no in nos:
all_times[no] += 1
# 打印
print(nos)
for no, times in enumerate(all_times):
print(f'{no}出现了{times}次')
... | true |
4f54301558345fbe03df70aef130418be6cf770e | Python | emistern/EC601_Robotic_Guidedog | /path_planning/draw.py | UTF-8 | 1,601 | 2.546875 | 3 | [] | no_license | import cv2
import numpy as np
def draw_max_conn(grid, idx, lines=False):
unit_size = 10
height = len(grid)
width = len(grid[0])
t_h = unit_size * height
t_w = unit_size * width
world = np.array([[[240] * 3] * (t_w)] * (t_h)).astype(np.uint8)
if lines:
for x in range(0, t_w, unit_s... | true |
0534c72b00bbde586b46f8a69ad706458937586b | Python | piyuid/my-bangkit-repos | /google-it-automation-with-python/A3-crash-course-on-python/string1.py | UTF-8 | 313 | 3.265625 | 3 | [] | no_license | email = "leopuji17@gmail.com"
old_domain = "gmail.com"
new_domain = "rf.com"
def replace_domain(email, old_domain, new_domain):
if "@" + old_domain in email:
index = email.index("@" + old_domain)
new_email = email[:index] + "@" + new_domain
return new_email
return email
print(replace_do... | true |
de45877b66c69ffe4cbeab8d807b7d87d00d2cc5 | Python | hujinxinb/test202007 | /1.py | UTF-8 | 2,062 | 3.421875 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
from concurrent.futures import ThreadPoolExecutor
import threading
import time
# 定义一个准备作为线程任务的函数
def action(max,a):
my_sum = 0
for i in range(max):
print(threading.current_thread().name + ' ' + str(i))
my_sum += i
return my_sum
for i in range(4):
pool = Thread... | true |
8cd9f91ab738fa6a0e6fa5a92ee12807d37c563c | Python | su-de-sh/HandWrittenAlphabetRecognition | /pyimagesearch/nn/conv/shallownet.py | UTF-8 | 884 | 2.6875 | 3 | [] | no_license | from keras.models import Sequential
from keras.layers.convolutional import Conv2D
from keras.layers.core import Activation
from keras.layers.core import Dense
from keras.layers.core import Flatten
from keras import backend as K
class ShallowNet:
@staticmethod
def build(width,height,depth,classes):
#ini... | true |
f92a4d99de563125ed4746036794d7d349b7d66c | Python | muhit04/xero_connection | /connection.py | UTF-8 | 4,067 | 2.984375 | 3 | [] | no_license | '''This script tries to connect to Xero without using any python wrapper
created by Muhit Anik <muhit@convertworx.com.au>
For xero reference use this guide: https://developer.xero.com/documentation/api
To access another endpoint for instance accessing Name which is found inside Contact, we must call it like Contact.Na... | true |
d60b39dbff7166a0f2b842b4ab7d9c85cd41c8f7 | Python | antgouri/IPP2MCA | /For April1st Class/fnCount.py | UTF-8 | 82 | 2.859375 | 3 | [] | no_license | import sys
fn = sys.argv[0]
print("The length of the file name is ", len(fn)-3)
| true |
b265c0a97d9a11e36ef4a0c45a4814634022532b | Python | geekbitcreations/illinoistech | /ITMD_513/hw5/SortedList.py | UTF-8 | 1,341 | 4.625 | 5 | [] | no_license | '''
Deborah Barndt
2-20-19
SortedList.py
hw5: Question 1 Sorted List
This program will prompt the user to enter a list and display whether the list
is sorted or not sorted.
Written by Deborah Barndt.
'''
# Function that returns true if the list is already sorted in increasing order.
def isSorted(lst):
for i in ... | true |
140749aed0d3401f192f236b1838143955230257 | Python | sheetalkaktikar/csvttlconvertor | /rdfsample.py | UTF-8 | 269 | 2.84375 | 3 | [] | no_license | import rdflib
g=rdflib.Graph()
result = g.parse("http://www.w3.org/People/Berners-Lee/card")
print("Graph has %s statements." %len(g))
for subj,pred,obj in g:
if (subj,pred,obj) not in g:
raise Exception("It better be!")
s=g.serialize(format='turtle')
| true |
681439c28db01d6c85a1452b66ef3a86bf96abfe | Python | LucasVanWijk/ABD | /Group/CBS_csv_to_groupinfo.py | UTF-8 | 1,536 | 3.359375 | 3 | [] | no_license | def get_info_piramide():
def index_containing_substring(the_list, substring):
'''
https://stackoverflow.com/questions/2170900/get-first-list-index-containing-sub-string
'''
for i, s in enumerate(the_list):
if substring in s:
return i
return -1
... | true |
fe44b467d5fd24a5c8c21ff737e97dc956123984 | Python | L00n3y/Python_Excercises | /enum_excercise_1.py | UTF-8 | 426 | 3.65625 | 4 | [] | no_license | from enum import Enum
#class Country aanmaken met de python functie Enum. Deze functie zorgt ervoor dat er een member en een value is.
#Door deze member en value kan gerouteerd worden.
class Country(Enum):
StarWars = 10
LOTR = 100
GOT = 1000
Walking_Dead = 1250
#Nu roepen wij een member en de value aa... | true |
1ea0535f139eb116eca8df0e0b7b8a9e736444c6 | Python | venkat-narahari/Opinion-Mining-on-Twitter-Data-using-Machine-learning | /src/SentimentAnalysis/sentiment.py | UTF-8 | 7,266 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import re
import nltk
from sklearn.externals import joblib
import tweepy
from tweepy import OAuthHandler
import matplotlib.pyplot as plt
import datetime
class TwitterClient(object):
#Generic Twitter Class for sentiment analysis.
def __init__(self):
#Class c... | true |
e24e8fe3f46aae73ff119cbecfcdcbe85757427e | Python | bogedy/vqvae | /ae.py | UTF-8 | 2,178 | 2.59375 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.keras.backend import batch_flatten
import os
from tqdm import tqdm
BATCH_SIZE= 3
optimizer = tf.optimizers.Adam(1e-4)
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
x_train = x_train/255
x_test = x_test/255
trainset = tf.data.Dataset.from_tensor_sl... | true |
8aa240439f15a55a239ff5a96ace02b77ab7b54d | Python | 2018-B-GR1-Python/eguez-sarzosa-vicente-adrian | /01-Python/05_diccionarios.py | UTF-8 | 784 | 3.359375 | 3 | [] | no_license | adrian = {
'nombre': "Adrian",
'apellido': 'Eguez',
"edad": 29,
"sueldo": 1.01,
"hijos": [],
"casado": False,
"loteria": None,
"mascota": {
"nombre": "Cachetes",
"edad": 3
},
}
print(adrian)
print(adrian["nombre"]) # Adrian
print(adrian["mascota"]["nombre"]) # Cach... | true |
7f39954f125c3c4f9288cdd2870428d36394169a | Python | zhiwenliang/archive | /python_crash_course/basics/utils/json_utils.py | UTF-8 | 237 | 2.90625 | 3 | [
"MIT"
] | permissive | import json
def dump_json_to_file(json_obj, file_path):
with open(file_path, "w") as f:
json.dump(json_obj, f)
def load_json_file(file_path):
with open(file_path) as f:
result = json.load(f)
return result
| true |
c93112160331bebaebeeaecd4e9ab7bb49f556a3 | Python | gauravnagal/my-solution | /FizzBuzz.py | UTF-8 | 505 | 4.28125 | 4 | [] | no_license | '''
Write a program that prints the numbers from 1 to 50. But for
multiples of three print "Fizz" instead of the number and for
the multiples of five print "Buzz". For numbers which are
multiples of both three and five print "FizzBuzz"
'''
for fizzbuzz in range(1, 51):
fizz = (fizzbuzz % 3 == 0)
buzz ... | true |
b69749332300b91e646adac10be7cee9bb4f9482 | Python | krishshah99615/Single-Hand-Gesture | /dataset.py | UTF-8 | 2,202 | 3.0625 | 3 | [] | no_license | ####################### LIBRARRIES ##########################
import cv2
import numpy
import os
import argparse
####################### INITIALIZAING CAPTURE ##########################
# Name of base directory
BASE_DIR = "Dataset"
# Starting capturing
cap = cv2.VideoCapture(0)
# Setting height and width of webcam
HE... | true |
1114afbbf6e43ed53242e42e9ffb7daa11b0859c | Python | LawftyGoals/LongWayHome | /LongWayHomeEnemy.py | UTF-8 | 779 | 2.984375 | 3 | [] | no_license | class enemy :
etype = ""
selectedType = ["melee", "ranged"]
def __init__(self, level, etype):
self.level = level
self.levelMultiplyer = [1, 1.5, 2]
self.etype = self.selectedType[etype]
self.numberInGroup = 0
self.etypeI = ""
if self.etype == "m... | true |
b1f8d7198d8967bdacd133797959f84f7fff58df | Python | mikelty/algos | /solutions/computational_geometry/max_darts_in_circular_board_line_sweeping.py | UTF-8 | 1,087 | 3.3125 | 3 | [] | no_license | #solves https://leetcode.com/problems/maximum-number-of-darts-inside-of-a-circular-dartboard/
from math import acos, atan2
class Solution:
def numPoints(self, points):
best=1
for px,py in points:
angles=[] #all angles where a q touches p's sweeping line's circle
for qx,qy in... | true |
655bfc8dec5989b549e3eacdd09851bdce54ff63 | Python | mindthegrow/cafelytics | /simulate.py | UTF-8 | 5,153 | 3.046875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | import datetime
import matplotlib.pyplot as plt
from cafe.farm import (
Config,
Event,
Farm,
guate_harvest_function,
predict_yield_for_farm,
)
def simulateCoOp(plotList, numYears, pruneYear=None, growthPattern=None, strategy=None):
"""
Uses a list of plots, `plotList`, to simulate a coop... | true |
4535bd3f5ce24b87fb38a21042659b6de4472fc2 | Python | SGT103/med_segmentation | /models/metrics.py | UTF-8 | 6,778 | 3 | 3 | [
"Apache-2.0"
] | permissive | import tensorflow as tf
import tensorflow.keras.backend as K
class Metric:
"""
Extension of evaluation metrics not yet existing in keras and/or Tensorflow
"""
"""
per class metrics
"""
# sensitivity, recall, hit rate, true positive rate
# TPR = TP/P = TP/(TP+FN) = 1-FNR
def recall... | true |
349c7147aeb65d6fccd9f8a7c323b9d5670f0eff | Python | pongtr/charm | /src/design_rules.py | UTF-8 | 5,161 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
'''
design_rules.py
design rules
'''
from collections import defaultdict
n_layers = 5 # number of metal layers
# == SPACING ==================
material_spacing = {
'm1': 3, # m1-m1
'm2': 3, # m2-m2
'm3': 3, # m2-m2
'm4': 3, # m2-m2
'm5': 3, # m2-m2
... | true |
fbdd6173d82f53604e5dc86c2f66f57283a0193a | Python | LukeTempleman/Personal_projects | /Lukes_song_Downloader/Lukes_song_Downloader.py | UTF-8 | 564 | 2.59375 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
PATH ='C:\Program Files (x86)\EdgeDriver\msedgedriver.exe'
driver = webdriver.Edge(PATH)
# users_input = input("Input The song you want to Download")
driver.get("https://www.mp3juices.cc")
search = driver.find_elemen... | true |
77b9f099a653b37f2a26469c1d297bd5646669e1 | Python | dwillist/ProjectEuler | /Euler483/maxCycleLength.py | UTF-8 | 1,017 | 3.484375 | 3 | [] | no_license | # here we whish to count the max cycle length as well as number of cycles of this length
import math
def isPrime(k):
for i in range(2,int(math.sqrt(k)) + 1):
if k % i == 0:
return False
return True
def calculate_max():
pSet = []
for i in range(2,350 + 1):
if isPrime(i):
... | true |
0bc9e7b0baca233795067e429bc04f86ab6f06ff | Python | vivequeramji/hackathon_Princeton_F16 | /plot_location.py | UTF-8 | 263 | 2.734375 | 3 | [] | no_license | import time
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
TIME_CONSTANT = 3600*6
def plot(place, timestamp):
size = time.time() - timestamp
alp = 0.5 + (size/(2*TIME_CONSTANT))
plt.scatter(x=place.x, y=place.y, s=150, alpha=alp) | true |
cd44a99c9e2b109677701f5233c793317d70985e | Python | BristolTopGroup/DailyPythonScripts | /tests/utils/test_Fitting_RooFitFit.py | UTF-8 | 3,154 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | '''
Created on 31 Oct 2012
@author: kreczko
'''
import unittest
from dps.utils.Fitting import RooFitFit, FitData, FitDataCollection
from rootpy.plotting import Hist
from math import sqrt
import numpy as np
N_bkg1 = 9000
N_signal = 1000
N_bkg1_obs = 10000
N_signal_obs = 2000
N_data = N_bkg1_obs + N_signal_obs
mu1, mu2... | true |
01b012c1cb56604e6bd843ddb11a03cd1cbe7eda | Python | hugoladret/submissionJHEPC20 | /fig/generate_cloud.py | UTF-8 | 937 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Hugo Ladret
This file can be used to generate the MC.png image
MotionClouds library can be installed with a simple ' pip install MotionClouds '
paper : https://journals.physiology.org/doi/full/10.1152/jn.00737.2011
"""
import MotionClouds as mc
import numpy... | true |
d9742adcc82423db27e0bc43ccc4dd1a4228b4e2 | Python | pengliang1226/model_procedure | /feature_preprocess/Encoding.py | UTF-8 | 6,513 | 3.1875 | 3 | [] | no_license | # encoding: utf-8
"""
@author: pengliang.zhao
@time: 2020/12/7 11:09
@file: Encoding.py
@desc: 特征编码
"""
from typing import List
from category_encoders import OrdinalEncoder, OneHotEncoder, HashingEncoder, HelmertEncoder, SumEncoder, \
TargetEncoder, MEstimateEncoder, JamesSteinEncoder, WOEEncoder, LeaveOneOutEncod... | true |
2d121bc009c9feec59b0bb2279ee467f76ed11c0 | Python | qq184861643/pytorch-CapsNet | /PrimaryLayer.py | UTF-8 | 1,158 | 2.734375 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
import torch
import torch.nn as nn
import numpy as np
from utilFuncs import squash
# In[3]:
class PrimaryLayer(nn.Module):
def __init__(self,in_channels=256,out_channles=256,kernel_size=5,stride=1,caps_dims=8):
super(PrimaryLayer,self).__init__()
self.in_channel... | true |
b136121e505a7449654d752d6687037d2de05b5d | Python | luoyawen/Python_learning | /杂乱的爬/爬取_百度百科.py | UTF-8 | 608 | 2.75 | 3 | [] | no_license | import urllib.request as u
import re
from bs4 import BeautifulSoup
def main():
url = 'http://baike.baidu.com/view/284853.htm'
req = u.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36')
response ... | true |
d6bb22726850bf00d2609a3d29ab6df3c739ea84 | Python | jchernjr/code | /advent2021/day2.py | UTF-8 | 717 | 3.734375 | 4 | [] | no_license | if __name__ == "__main__":
with open("day2input.txt", "r") as f:
lines = f.readlines()
commands = [s.split(" ") for s in lines] # should be ('forward'|'up'|'down', number) list
x_pos = 0 # horizontal (forward) distance
depth = 0 # depth
for direction, dist_str in command... | true |
02fce433068642b0fc94eba7b3f0c9685696d60b | Python | maedoc/epsilon_free_inference | /demos/lotka_volterra_demo/lv_main.py | UTF-8 | 7,935 | 2.796875 | 3 | [
"BSD-2-Clause"
] | permissive | """
Lotka volterra demo, main file. Sets up the simulations. Should be imported by all other lotka volterra demo files.
"""
from __future__ import division
import time
import numpy as np
import numpy.random as rng
import matplotlib
import matplotlib.pyplot as plt
import util.MarkovJumpProcess as mjp
import util.help... | true |
2f0dedfd30215235dd264a0cdf3b54ea12d298cc | Python | KadinTucker/Hunters | /map_editor.py | UTF-8 | 1,156 | 2.921875 | 3 | [] | no_license | import pygame
from pygame.locals import *
import sys
import objects
import math
pygame.init()
display = pygame.display.set_mode((1000, 800))
objs = [objects.bandit1, objects.bandit2]
enemies = []
def save():
world = open('savedworld.txt', 'w')
world.write(str(enemies))
while True:
display.fill((75, 35... | true |
70825887ff8e44517cbfc58318f1f57d9aba0f6e | Python | jmbaker94/qoc | /qoc/core/common.py | UTF-8 | 11,035 | 2.6875 | 3 | [
"MIT"
] | permissive | """
common.py - This module defines methods that are used by
multiple core functionalities.
"""
import numpy as np
from qoc.standard import(complex_to_real_imag_flat,
real_imag_to_complex_flat)
def clip_control_norms(max_control_norms, controls):
"""
Me: I need the entry-wise norms o... | true |
505c0d03dc52750dfc72242c7333a0d5dbbcbd63 | Python | blester125/LAFF_Cython | /src/test_laff_copy.py | UTF-8 | 1,521 | 2.734375 | 3 | [] | no_license | import unittest
import numpy as np
from .copy import copy
class LaffCopyTest(unittest.TestCase):
def setUp(self):
real_length = np.random.randint(1, 20)
self.x = np.random.uniform(0, 10, real_length)
self.x = np.reshape(self.x, [1, real_length])
self.y = np.random.uniform(0, 10, r... | true |
9715f9fafab122eb55d6ce4b819c8fb6b076c816 | Python | ayushi8795/Python-Training | /PythonTask4/5.py | UTF-8 | 290 | 3.171875 | 3 | [] | no_license | def function():
l = []
l2 =[]
l =input("Enter space separated input: ").split()
for a in l:
l1=[]
for p in a:
x = p.capitalize()
l1.append(x)
y = "".join(l1)
l2.append(y)
return (" ".join(l2))
print(function()) | true |
dc3916ee7deab51f5b5f761b60caafc504987d40 | Python | aowens-21/python-sorts | /bubble.py | UTF-8 | 370 | 4.21875 | 4 | [] | no_license | def bubble_sort(list):
# This function will take in a list and sort it in ascending order
# using the bubble sort algorithm
for i in range(len(list) - 1):
for j in range(len(list) - i - 1):
if (list[j + 1] < list[j]):
temp = list[j]
list[j] = list[j + 1]
... | true |
bc6b995c8662307a08ead6c2d16a25f45264f31b | Python | max65536/CloudServer | /Client/oldcode/md5_check.py | UTF-8 | 920 | 3.1875 | 3 | [] | no_license | import hashlib
def md5_check(file_list, file_dir):
file_list_len = len(file_list)
print('The number of files are is: %d' % file_list_len)
md5_result = hashlib.md5(file_dir.encode('ascii'))
for num in range(file_list_len):
md5_result.update(file_list[num].encode('ascii'))
print('MD5 is: %s'... | true |
0cf2c6d09cd1445f70c92b16207d99db5ccb501e | Python | mrhhug/CS4520 | /Assignment_2/Loan/run.py | UTF-8 | 583 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python2
import pdb
'''
@author: Michael Hug hmichae4@students.kennesaw.edu
Created for Dr Setzer's Fall 2013 4520 Distributed Systems Development
Assignment 2
9 September 2013
'''
import loanClass
import sys
if (len(sys.argv)==4):
loan=loanClass.Loanclass(int(float(sys.argv[1])),float(sys.argv[2]),float... | true |
f3df94251f99b87844c2d2849da7150dfcad16b2 | Python | bennymuller/glTools | /data/apfData.py | UTF-8 | 4,018 | 2.84375 | 3 | [] | no_license | import maya.cmds as cmds
import os
import data
class ApfData(data.Data):
"""
Apf data class definition
"""
def __init__(self, apfFile=''):
"""
Apf data class initializer
@param apfFile: Apf file to load.
@type apfFile: str
"""
# Execute Super Class Init... | true |
e8f5efb4e7bdc0da4baf3db236e0dab42d189d3c | Python | Lycos-Novation/PyEngine4 | /pyengine/common/components/text_component.py | UTF-8 | 1,954 | 2.8125 | 3 | [] | no_license | from pyengine.common.components.component import Component
from pyengine.common.utils import Color
class TextComponent(Component):
def __init__(self, game_object):
super().__init__(game_object)
self.name = "TextComponent"
self.text = ""
self.background_transparent = True
se... | true |
95a17dfdffa94bed5764ce4626ed19d0cad58fef | Python | ericyeung/PHY407 | /Lab4/Lab4_q2a.py | UTF-8 | 1,524 | 3.390625 | 3 | [] | no_license | # PHY407, Fall 2015, Lab 4, Q2a
# Author: DUONG, BANG CHI
from numpy import tanh, cosh, linspace
from pylab import figure, subplot, plot, show, title, ylim, xlabel, ylabel, legend
import scipy.optimize
Tmax = 2.0
points = 1000
accuracy = 1e-6
mag_relaxation = []
mag_newton = []
iter_relaxation = []
iter_newton = []
... | true |
747401bce0c737593c58306b9eba2013153b311e | Python | ShashankSinha98/Leet-Code-Solutions | /Problems/153. Find Minimum in Rotated Sorted Array-(READ).py | UTF-8 | 523 | 3.09375 | 3 | [] | no_license | from typing import List
class Solution:
def findMin(self, nums: List[int]) -> int:
n = len(nums)
l = 0
r = n-1
while(l<=r):
if l==r:
return nums[l]
mid = (l+r)//2
if... | true |
5e8f689fb017a88a855b65dd6f7a20314a7d5a66 | Python | BhavikDudhrejiya/Python-Hands-on | /7. Variable Concatenat.py | UTF-8 | 317 | 4.21875 | 4 | [] | no_license | # Assigning Variables
var1 = 'Hello World' # String Variable
var2 = 4 # Integer
var3 = 36.7 # Float
var4 = 'This is a Python Tutorial'
var5 = '32'
# Concatenation of var1 and var2
print(var2 + var3)
print(var1 + ' ' + var4)
print(var1 + var5)
#Concatenation is possible only if the same type of variables
... | true |
fa0fba2c1737029736c6aa2ee24c522d955cb556 | Python | keumdohoon/STUDY | /keras/keras61_cifar10_dnn.py | UTF-8 | 2,088 | 2.6875 | 3 | [] | no_license | from keras.datasets import cifar10
from keras.utils import np_utils
from keras.models import Sequential, Model
from keras.layers import Dense, LSTM, Conv2D, Input
from keras.layers import Flatten, MaxPooling2D, Dropout
import matplotlib.pyplot as plt
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
print(x_... | true |
bec8de7eb445923328f9ff64e8187950d4c52000 | Python | dhanushraparthy/HeartDiseaseClassifier | /Heart_Disease_Model.py | UTF-8 | 2,161 | 3.3125 | 3 | [] | no_license | # Importing libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pickle
import json
import requests
# Load Dataset
dataset = pd.read_csv('heart.csv')
# Selecting Features
X = dataset.iloc[:, :-1]
# Selecting Target
y = dataset.iloc[:, -1]
# Printing Features And Target names
# pri... | true |
2c72513e473495fe65fde5fdd128cbc32c0d1776 | Python | thenagababupython/python_modules | /oops2/using one number class to another classs.py | UTF-8 | 406 | 3.75 | 4 | [] | no_license | class Engine:
a=10
def __init__(self):
self.b=20
def m1(self):
print("Engine specfic functionality")
class Car:
print("Engine Functionality")
def __init__(self):
self.engine=Engine()
def m2(self):
print("car using engine function ")
print(sel... | true |
9ac4e296726c744831486efd288617a4e389389c | Python | haldron/python-projects | /simplepython/class.py | UTF-8 | 705 | 4.3125 | 4 | [] | no_license | """
This python script contains one class and one inherited class
with each having its own functions
and testing for the functions
"""
class Dog():
#Representing a dog
def __init__(self, name):
#initialise function for the dog object
self.name = name
def sit(self):
#function to si... | true |
ce7b7b825cf0891244f5a02ed7c47b9d1a4bfcb2 | Python | Dominik-Kaczor/epitech_mathematique_2019 | /203hotline_2019/203hotline | UTF-8 | 2,755 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python3
from sys import*
from math import*
import random
import time
def compute_1(argv):
if (argv[1] == "-h"):
print("USAGE\n\t./203hotline [n k | d]\n\nDESCRIPTION\nn\tn value for the computation of C(n, k)\nk\tk value for the computat... | true |
29994ec1f593eed989f0069839d2758bdf63044a | Python | liaohhhhhh/denoisy | /Method.py | UTF-8 | 7,151 | 2.5625 | 3 | [] | no_license | import numpy as np
import cv2 as cv
import math as m
m1 = np.array([[-1, 0, 1],
[-1, 0, 1],
[-1, 0, 1]])
m2 = np.array([[-1,-1,-1],
[ 0, 0, 0],
[ 1, 1, 1]])
m3 = np.array([[-1, 0, 0, 0, 1],
[-1, 0, 0, 0, 1],
[-1, 0, 0, 0, 1],
[-1, 0, 0, 0, 1],
[-1, 0, 0, 0,... | true |
c5059f6fc23389fcaed8178ffe3ea353bae95246 | Python | acgoularthub/Curso-em-Video-Python | /desafio022.py | UTF-8 | 362 | 3.90625 | 4 | [] | no_license | nome = input('Digite seu nome completo: ')
separa = nome.split()
print('Seu nome com todas as letras maiúsculas: {}'.format(nome.upper()))
print('Seu nome completo tem {} letras'.format(len(nome.replace(" ", ""))))
# ou: print('Seu nome completo tem {} letras'.format(len(nome) - nome.count(' ')))
print('Seu primeiro no... | true |
5766a35c8399fa6e6211f82abdd2c7811b55588a | Python | csJd/dg_text_contest_2018 | /embedding_model/w2v_model.py | UTF-8 | 4,459 | 2.703125 | 3 | [
"MIT"
] | permissive | # coding: utf-8
# created by deng on 7/25/2018
from utils.path_util import from_project_root, exists
from utils.data_util import load_raw_data, load_to_df
from gensim.models.word2vec import Word2Vec, Word2VecKeyedVectors
from sklearn.externals import joblib
from collections import OrderedDict
from time import time
im... | true |
179eecebacc893e8437f06da307559155cfd5e57 | Python | osak/ICFPC2017 | /src/python/tsuchinoko-viewer/__main__.py | UTF-8 | 3,716 | 2.703125 | 3 | [] | no_license | from argparse import ArgumentParser
import json
import sys
def get_rank(arr):
sorted_arr = sorted(arr, reverse=True)
rank_map = {}
for i, val in enumerate(sorted_arr):
if val not in rank_map:
rank_map[val] = i + 1
return [rank_map[val] for val in arr]
def add_meta_data(objs):
#... | true |
eef723c60bca723588b70f59f09fee9034dec604 | Python | lmmProject/python_01 | /04_对象/02_多态.py | UTF-8 | 781 | 4.75 | 5 | [] | no_license | # 静态语言 vs 动态语言
# 对于静态语言(例如Java)来说,如果需要传入Animal类型,
# 则传入的对象必须是Animal类型或者它的子类,否则,将无法调用run()方法。
# 对于Python这样的动态语言来说,则不一定需要传入Animal类型。
# 我们只需要保证传入的对象有一个run()方法就可以了:
class Animal(object):
def run(self):
print('Animal is running...')
class Dog(Animal):
def run(self):
print('Dog is running...')
... | true |
cc68da405273606d40660bfc8e0e3e1cf56e87b4 | Python | tinoxn/twitter | /tinox.py | UTF-8 | 2,291 | 2.921875 | 3 | [] | no_license | import streamlit as st
import pickle
from sklearn.feature_extraction.text import CountVectorizer
import preprocessor as p
import numpy as np
import pandas as pd
import re
from sklearn.model_selection import train_test_split
#set up punctuations we want to be replaced
REPLACE_NO_SPACE = re.compile("(\.)|(\;)|(\:)|(\!... | true |
d1f276ec42decf7fda3d771109486e1bd9243815 | Python | duncanmmacleod/gwosc | /gwosc/urls.py | UTF-8 | 5,804 | 2.625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# Copyright (C) Cardiff University, 2018-2020
#
# This file is part of GWOSC.
#
# GWOSC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | true |
11e6c9bbe1b4be478f20a805df604149f5f1e05a | Python | AkshayMukkavilli/Analyzing-the-Significance-of-Structure-in-Amazon-Review-Data-Using-Machine-Learning-Approaches | /src/file_mergers/merger_for_title_only_data.py | UTF-8 | 384 | 2.59375 | 3 | [] | no_license | import pandas as pd
df1 = pd.read_csv(r'../../final_csv_files/FinalTitles_LatestData.csv')
print(df1.shape)
df2 = pd.read_csv(r'../../final_csv_files/OriginalFeatures(Corrected).csv')
print(df2.columns)
df1['Helpful_Votes'] = df2['Helpful_Votes']
df1['Z_Score_HelpfulVotes'] = df2['Z_Score_HelpfulVotes']
print(df1.head... | true |
1691892cc98abba69fd6dbe761c7f6edbde916c0 | Python | kenluck2001/scraper_gevent | /HTTPClass.py | UTF-8 | 4,261 | 3.203125 | 3 | [] | no_license | import time
import requests
from datetime import datetime
import requests # library for HTTP
import json
import numbers
SUCCESS = 200
def dump_args(method, filename='output/log.txt'):
def echo_func(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
argna... | true |
618cfadfae855ce77b972b420d59a3dbd97201e5 | Python | sethangavel/machine_learning | /ucsc_ex/decision_tree/decision_tree.py | UTF-8 | 1,714 | 2.53125 | 3 | [] | no_license | from digits_pca import get_training_prinicipal_features_and_labels, get_test_prinicipal_features_and_labels
from utils_stump import build_tree, evaluate_tree, plot_contours
from commons import traverse_tree, log_debug, log
from sklearn.metrics import confusion_matrix
from config import *
import numpy as np
def main_t... | true |
58fe9e0a18cf9c0206a5b10894d3fe0650df8813 | Python | amritavarshi/guvi | /greatestofthreenos.py | UTF-8 | 126 | 4.09375 | 4 | [] | no_license | x,y,z=input().split()
if (x>y) and (x>z):
print(x)
if (y>x) and (y>z):
print(y)
if (z>x) and (z>y):
print(z) | true |
b0d4cc82276bf3efd75ac461ce23f5e8840037b8 | Python | PengfeiLi27/machine-learning | /SVM/SVM.py | UTF-8 | 8,001 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 16 17:43:03 2017
@author: PXL4593
"""
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 16 16:09:25 2017
@author: PXL4593
"""
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.metrics import roc_auc_score
import nu... | true |
1bd37a47951ba1be936d734a25a010e3de960a4a | Python | liruqi/topcoder | /Library/strings.py | UTF-8 | 674 | 3.0625 | 3 | [] | no_license | # https://www.hackerrank.com/challenges/bigger-is-greater/
# No such impl in Python lib: https://stackoverflow.com/questions/4223349
class strings:
def next_permutation(w):
stk=[]
n=len(w)
def nextperm(sc):
i=0
for x in stk:
if x > sc:
... | true |
148fcc799d1d87d575c185646a6296ac8c670d9f | Python | TimilsinaBimal/30-Day-Python-Challenge | /day14.py | UTF-8 | 574 | 4.25 | 4 | [] | no_license | # How many ways can four students Ram, Anuj, Deepak and Ravi line up in
# a line, if the order matters?
# Print all the possible Combination.
def all_combination(arr):
if len(arr) == 0:
return []
if len(arr) == 1:
return [arr]
comb = []
for i in range(len(arr)):
temp = arr[i]... | true |
eee2928cb1be8675f59ed68669659c3db775c717 | Python | etiennedub/pyk4a | /example/devices.py | UTF-8 | 322 | 2.671875 | 3 | [
"MIT"
] | permissive | from pyk4a import PyK4A, connected_device_count
cnt = connected_device_count()
if not cnt:
print("No devices available")
exit()
print(f"Available devices: {cnt}")
for device_id in range(cnt):
device = PyK4A(device_id=device_id)
device.open()
print(f"{device_id}: {device.serial}")
device.close(... | true |
931241ff4a20b1c2be86577a442dd4894ae89ce9 | Python | garyForeman/artools | /artools/plotter.py | UTF-8 | 12,002 | 3.265625 | 3 | [
"MIT"
] | permissive | """Contains convenience functions for plotting AR simulation results such as transmission and reflection.
"""
#Filename: plotter.py
#Author: Andrew Nadolski
import os
import pprint
import shutil
import time
import matplotlib.pyplot as plt
import numpy as np
"""
TODO
7/26
* Debug _convert_to_wavelength(). The pl... | true |
82e0f1f8a99fd3b4f5a514b1653ac8663b6dadc2 | Python | rigogsilva/sqldf | /sqldf/test/test_sqldf.py | UTF-8 | 1,653 | 3.265625 | 3 | [] | no_license | from sqldf import sqldf
# RAW DataFrame
inventory = [{'item': 'Banana', 'quantity': 33}, {'item': 'Apple', 'quantity': 2}]
orders = [{'order_number': 1, 'item': 'Banana', 'quantity': 10}, {'order_number': 2, 'item': 'Apple', 'quantity': 10}]
# To select data from a DataFrame and also register a table in memory do the... | true |
ab55b3c072bee04479f62fa7c604bd2b8ea8afb8 | Python | jaz-programming/python-tutorial-gaming-1 | /pokerdice.py | UTF-8 | 1,551 | 3.546875 | 4 | [] | no_license | #!/usr/bin/python2.7
#pokerdice.py
import random
from itertools import groupby
nine = 1
ten = 2
jack = 3
queen = 4
king = 5
ace = 6
names = { nine: "9", ten: "10", jack: "J", queen : "Q", king = "K", ace = "A" }
player_score = 0
computer_score = 0
def start():
print "Let's play a game of Poker Dice."
while game... | true |
acaa43f322bb6bc89477e8f5a69119a42354c3c5 | Python | filipepcampos/pokemon-xml-data | /moves.py | UTF-8 | 1,361 | 2.984375 | 3 | [] | no_license | from config import *
from dict2xml import dict2xml
import requests
def parseSingleMove(data):
url = data['url']
r = requests.get(url)
data = r.json()
moveId = int(data["id"])
dataDict = {}
dataDict["accuracy"] = data["accuracy"] if data["accuracy"] != None else 0
dataDict["power"] = d... | true |
bc8b555f44a667ceb1d95991a5109dfe514f2417 | Python | NAV-2020/nichipurenko | /Lesson_16_DZ_Nichipurenko_A.V/Lesson_16_DZ_3_Nichipurenko_A.V.py | UTF-8 | 7,126 | 3.546875 | 4 | [] | no_license | """
Создайте программу «Фирма». Нужно хранить информацию о человеке: ФИО, телефон, рабочий email,
название должности, номер кабинета, skype. Требуется
реализовать возможность добавления, удаления, поиска, замены данных. Используйте словарь для хранения
информации.
"""
import pprint
def get_company_employee(company_em... | true |
213ae5d280e7a17a06b8388cd98714b4eb37ceee | Python | shikhar-srivastava/Optimizing-deep-neural-networks | /graph code/helper_code/roc_curve.py | UTF-8 | 3,543 | 2.515625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, auc,roc_auc_score,f1_score,accuracy_score
from scipy import interp
# false_positive_rate
# true_positive_rate
fpredicted_svm = open("C:\Users\MAHE\Desktop\Programs\Python\predicted_smoteSVM.csv")
flables_svm= open("C:\Users\MAHE... | true |
de1070a7b109471af788cc34aefbae84c2ff7efb | Python | chiffa/Chiffa_Area51 | /git_auto_update.py | UTF-8 | 1,310 | 2.515625 | 3 | [] | no_license | __author__ = 'Andrei'
import sys
import time
import logging
from watchdog.observers import Observer
from watchdog.events import LoggingEventHandler, FileSystemEventHandler
from datetime import datetime
import subprocess
from time import sleep
class MyEventHandler(FileSystemEventHandler):
def on_any_event(self, ... | true |
436c697eb9c3c6c54284f3427cc6fc679ace0f33 | Python | chenguosen/AspBac | /aspirelibs/MySQLLibs2.py | UTF-8 | 5,136 | 2.640625 | 3 | [] | no_license | '''
Created on 2020年5月19日
@author: xiecs
'''
import pymysql
from dbutils.pooled_db import PooledDB
class PooledMySQL(object):
__pool = None
__conn_params = {}
def __init__(self, connstr):
params = connstr.split(',')
for i in params:
kv = i.split('=')
self.__conn_pa... | true |
4896f0868779256d995fe64be26bdaaaffcb09b5 | Python | Artembbk/articlesReaderTelegramBot | /main.py | UTF-8 | 5,064 | 2.65625 | 3 | [] | no_license | import telebot
from urllib.parse import urlparse
import requests
import validators
from Voicer import MeduzaVoicer
TOKEN = "TOKEN"
outputFile = "audio.opus"
folderId = "folderId"
supportedSites = ["meduza.io"]
OK_RESPONSE_CODE = 200
START_M = """
Привет! Пришли мне ссылку на любую (почти) статью с сайта ... | true |
2b3c9cf635e4e0b1d709e60067f249a270a62956 | Python | anilpai/leetcode | /Strings/PossibleStrings.py | UTF-8 | 1,158 | 3.5625 | 4 | [
"MIT"
] | permissive | class Solution(object):
def printAllStringsK(self, s, prefix, n, k):
'''
Permutation of a String : print all possible combinations.
'''
if k == 0:
print(prefix)
return
for i in range(n):
self.printAllStringsK(s, prefix + s[i], n, k-1)
... | true |
c202756c577073e799a0ffea5e227d002d0c8726 | Python | RYO515/test | /scp_ing_pra/chap4/scp_chap4-22.py | UTF-8 | 360 | 2.890625 | 3 | [] | no_license | import pandas as pd
import folium
df = pd.read_csv("store.csv")
# print(len(df))
# print(df.columns.values)
store = df[["緯度", "経度", "店舗名(日本語)"]].values
m = folium.Map(location=[35.942957, 136.198863], zoom_start=16)
for data in store:
folium.Marker([data[0], data[1]], tooltip=data[2], zoom_start=16).add_to(m)
m... | true |
5c63d0f5e2ad4aa6f5530662520c2545d71b27e4 | Python | imazerty/TelecomParistech | /INF344 Données du web/TP Philosophie/philosophie/getpage.py | UTF-8 | 2,266 | 3.0625 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# Ne pas se soucier de ces imports
import setpath
from bs4 import BeautifulSoup
from json import loads
from urllib.request import urlopen
from urllib.parse import urlencode
from pprint import pprint
from urllib.parse import unquote
from urllib.parse import urldefrag
# Si vou... | true |
687c19e0e86641e76901f956a4bf55ccaa5452a5 | Python | InsomniaGoku/-silentcrusader | /option_model.py | UTF-8 | 28,152 | 2.796875 | 3 | [] | no_license | from math import log, e
# modified from 3rd party source, added some functions, need further improvement.
try:
from scipy.stats import norm
except ImportError:
print('models require scipy to work properly')
def implied_volatility( model, args, CallPrice=None, PutPrice=None, high=500.0, low=0.0 ):
'''Retu... | true |
a9e0a00ac9b807417ca66cfc972073d44217a4d6 | Python | cc40330tw/Web-App-with-a-DB-backend | /ytfl.py | UTF-8 | 4,734 | 3.109375 | 3 | [] | no_license | #Pass information from Backend of Flask to the frontend of HTML template
from flask import Flask, redirect, url_for, render_template, request, session, flash
from datetime import timedelta
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.secret_key = "hellothisismysecretkey"
app.config['SQLALCHEMY_DAT... | true |
419d96129b00319dbde8cfd451f5ff6ffc79feb6 | Python | pmauduit/osmroutes-1d | /route_analyser.py | UTF-8 | 6,536 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import json
import argparse
import copy
from lib.OsmApi import OsmApi
OSM_API = OsmApi()
# Fetches osm data from the API
def get_osm_data(relation_id):
daugther_relations = []
colour = None
mother_relation = OSM_API.RelationGet(relation_id)
c... | true |
2ba9b0c96dd5604541dddd880e809a95fa79a0f0 | Python | shraysalvi/Tic-Tac-Toi--cordinates-based- | /tic-tac-toi.py | UTF-8 | 3,216 | 3.5625 | 4 | [] | no_license | string = " "
def PRINT(string):
print("---------")
print("|", string[0], end = " ")
print(string[1], end = " ")
print(string[2], end = " |\n")
print("|", string[3], end = " ")
print(string[4], end = " ")
print(string[5], end = " |\n")
print("|", string[6], end = " ")
print(st... | true |
22824bd497b62fba593acae474db94e1ab1939d8 | Python | RajivMotePro/wot2text | /test/com/rajivmote/wot/test_AsciiNormalizer.py | UTF-8 | 1,695 | 3.171875 | 3 | [] | no_license | import unittest
from com.rajivmote.wot.AsciiNormalizer import AsciiNormalizer
class TestAsciiNormalizer(unittest.TestCase):
def setUp(self):
self.func = AsciiNormalizer()
def test_OpenSingleQuote(self):
s = 'The so-called \u2018fob\u2019 was on the table.'
result = AsciiNormalizer.to_a... | true |
3e271d490a924b57a9b5e1ba65192e618336d3b3 | Python | wbclark/crhc-cli | /tests/test_help.py | UTF-8 | 3,793 | 2.53125 | 3 | [] | no_license | """
Module responsible for test the help menu content
"""
from help import help_opt
def test_check_main_help_menu():
"""
Responsible for test the main help menu
"""
response = help_opt.help_main_menu()
content = "\
CRHC Command Line Tool\n\
\n\
Usage: \n\
crhc [command]\n\
\n\
Availab... | true |
96e3dcde249591adcbf7b38ecb139e9342e4d4df | Python | Alex-Linhares/sdm | /python/imac27tests.py | UTF-8 | 5,004 | 2.546875 | 3 | [] | no_license | # cd /Users/AL/Dropbox/0. AL Current Work/3. To Submit/Dr K/AL/python/
import sdm
import sdm_utils
from numpy import *
def mem_write_x_at_x(count=10):
for i in range (count):
b=sdm.Bitstring()
sdm.thread_write(b,b)
def mem_write_x_at_random(count=10):
for i in range (count):
b=sdm.... | true |
bdd9f2a1a552f26fe150ee46294235070765c75e | Python | cgu2022/NKC---Python-Curriculum | /Problems/Unit 1/Unit1Set1.py | UTF-8 | 2,841 | 4.59375 | 5 | [] | no_license | #######################################################################################
# 1.1
# Make 1 variable storing a string, one storing an integer, one storing a float, and another storing a boolean.
#######################################################################################
# 1.2
# Create a string ... | true |
a9f843fcd69f791614a79d02356a5c64deacb214 | Python | hanglomo/Jia-s-python | /class6-test1.py | UTF-8 | 623 | 4.78125 | 5 | [] | no_license |
#人的年龄
age=int(input("人的年龄是多少"))
if age>120 or age<0:
print("年龄不符合标准")
else:
print("合法年龄")
#考试成绩
a=int(input("数学考试成绩"))
b=int(input("语文考试成绩"))
if a>=60 or b>=60:
print("考试及格")
else:
print("考试不及格")
#奖励分类
a=int(input("你考了多少分"))... | true |
d039455c17ab14f0f5e58fafa8efcdded43f8ca1 | Python | vvertash/DMD | /queries.py | UTF-8 | 12,899 | 3 | 3 | [] | no_license | import mysql.connector
# import datetime
from datetime import datetime, date, time
from datetime import timedelta
from math import sin, cos, sqrt, atan2, radians
import operator
import math
now = datetime.now()
mydb = mysql.connector.connect(
host="db4free.net",
user= "vertash",
password="todoproject",
... | true |
e47bdb0ffcee09099b82a4bcb0212c03359c7e5c | Python | gregneat/T21 | /PythonCurriculum/Python/26. Python Graphics - New Waldo/Waldo.py | UTF-8 | 2,422 | 2.90625 | 3 | [] | no_license | from graphics import *;
from random import *;
class Waldo:
skinColor = color_rgb( 255, 194, 166 );
brownColor = color_rgb( 128, 64, 0 );
def __init__(self,point):
self.point = point;
x = point.getX();
y = point.getY();
self.head = Rectangle(point,Point(x+15,y+15));
self.head.setFill(self.skinColor);
hatP... | true |
5b09781f38fa824873f688fc3756479c210fadd9 | Python | parthenon/TolaActivity | /indicators/tests/test_iptt_targetperiods_report.py | UTF-8 | 14,919 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | """ Functional tests for the iptt report generation view
in the 'targetperiods' view (all indicators on report are same frequency):
these classes test monthly/annual/mid-end indicators generated report ranges, values, sums, and percentages
"""
from datetime import datetime, timedelta
from iptt_sample_data import iptt... | true |
8aa6a5cd147f18c4aa8d00e9d50583e14e15e88e | Python | sohskd/mdp14rpi | /All communication/bt_communication.py | UTF-8 | 2,606 | 2.625 | 3 | [] | no_license | from bluetooth import *
from signalling import *
__author__ = 'Aung Naing Oo'
class BluetoothAPI(object):
def __init__(self):
"""
Connect to Galaxy s5 bluetooth
RFCOMM port: 7
MAC address: no need
"""
self.server_socket = None
self.client_socket = None
self.bt_is_connected = False
self.signalObject = S... | true |
e5cd32adce1d17aab25708e58966b1fa11b945f3 | Python | mgh3326/programmers_algorithm | /KAKAO BLIND RECRUITMENT/2019/기둥과 보 설치/main.py | UTF-8 | 3,753 | 2.609375 | 3 | [] | no_license | def solution(n, build_frame):
answer = []
board_list = [[list() for _ in range(n + 1)] for _ in range(n + 1)]
for x, y, a, b in build_frame:
y = n - y
if a == 0: # 기둥
if b == 1: # 설치
if y == n or (0 in board_list[y + 1][x]) or 1 in board_list[y][x] or 1 in board... | true |