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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
065ed8e1883063a093f7825681b78b745794d1e3 | Python | Usam95/CarND-Behavioral-Cloning-P3 | /model.py | UTF-8 | 5,046 | 2.875 | 3 | [
"MIT"
] | permissive |
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import keras
from keras.models import Sequential
from keras.layers import Convolution2D, MaxPooling2D, Dropout, Flatten, Dense
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
from imgaug... | true |
9aea7d955d13e6890f653f2df114b71c055c88bc | Python | wescran/advent-of-code-2019 | /day2.py | UTF-8 | 1,175 | 3.25 | 3 | [] | no_license | from pathlib import Path
inputFile = Path("inputs/input-02-01.txt")
# Part 1
splitFile = inputFile.read_text().split(",")
data = [int(i) for i in splitFile]
data[1], data[2] = 12, 2
num = 0
while num < len(data):
if data[num] == 1:
data[data[num+3]] = data[data[num+1]] + data[data[num+2]]
elif data[nu... | true |
75b568e3f074835d8b6b3031eb230a9ce8f48e4b | Python | margitantal68/featurelearning | /util/mlp.py | UTF-8 | 1,430 | 2.609375 | 3 | [] | no_license | # MLP model
import tensorflow.keras as keras
import tensorflow as tf
import numpy as np
import time
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
def build_mlp(input_shape, nb_classes, file_path):
input_layer = keras.layers.Input(input_shape)
# flatten/reshape because when mult... | true |
16b3ef70337bee828f97962bcd8c81716a678ac7 | Python | Z3Prover/z3 | /scripts/pyg2hpp.py | UTF-8 | 1,100 | 2.8125 | 3 | [
"MIT"
] | permissive | # - /usr/bin/env python
"""
Reads a pyg file and emits the corresponding
C++ header file into the specified destination
directory.
"""
import mk_genfile_common
import argparse
import logging
import os
import sys
def main(args):
logging.basicConfig(level=logging.INFO)
parser = argparse.ArgumentParser(descripti... | true |
893f11d6f7d41a77f94d9b366d1d7f55615030c9 | Python | Kavita309/Severity-of-cyberbullying-across-SMPs | /Results/print_graphs_bar.py | UTF-8 | 637 | 3.515625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 3 12:11:16 2019
@author: hp
"""
import matplotlib.pyplot as plt
# x-coordinates of left sides of bars
x = [1, 2, 3, 4]
# Twitter embeddings
y = [0.481, 0.419, 0.992, 0.848]
tick_label = ['char', 'word', 'char-oversample', 'word-oversample']
# plotting ... | true |
7a83b8a0a283e1aefbf42bb67c4651cc80062dd1 | Python | djaney/genetic-agent | /agent.py | UTF-8 | 2,714 | 2.78125 | 3 | [] | no_license | #!/usr/bin/python3
from evolution import Species
import argparse
import tornado.ioloop
import tornado.web
import json
parser = argparse.ArgumentParser(description='Genetic algorithm agent')
parser.add_argument('input', type=int)
parser.add_argument('output', type=int)
parser.add_argument('hidden', type=int)
parser.ad... | true |
5683854aaab6d262c4a4e7a12ff47bdd89648c85 | Python | AlexanPetrov/MovieGenres | /moviesPlot.py | UTF-8 | 227 | 2.921875 | 3 | [] | no_license | from matplotlib import pyplot as plt
totalNumberOfGenres = [1, 2, 3, 4, 5, 6, 7, 8, 9]
numberMoviesPerGenere = [66, 128, 794, 10, 49, 18, 26, 272, 76573]
plt.scatter(totalNumberOfGenres, numberMoviesPerGenere)
plt.show();
| true |
860045a68465342f3dc5653493ec0a30d78cdfb5 | Python | neilgall/pykanren | /pykanren/api.py | UTF-8 | 514 | 2.625 | 3 | [] | no_license | from typing import Callable, Iterator, List
from .goal import Goal
from .term import Term
from .microkanren import State
def unify(lhs, rhs):
def goal(state):
return state.unify(lhs, rhs)
return goal
def disunify(lhs, rhs):
def goal(state):
return state.disunify(lhs, rhs)
return goal
def fresh(f: ... | true |
d616475eac3003a201518e358715bfce8946ab2c | Python | JennyAlways/Python_Practice | /Py20190216/encrypt_some_messages_with_a_key.py | UTF-8 | 1,204 | 3.109375 | 3 | [] | no_license | #!/usr/bin/python2.6
# -*- coding: utf-8 -*-key = 3
key=3
#加密
def encrypt(*messageTuple):
mList = []
for message in messageTuple:
letterList = list(message)
encryptList = []
for i in range(len(letterList)):
... | true |
7d42c1c653534a866da5dd4a438a12d03c9d181e | Python | FNSdev/webstore | /django/analytics/models.py | UTF-8 | 2,140 | 2.59375 | 3 | [] | no_license | from django.db import models
from django.core.validators import MaxValueValidator
import datetime
from user.models import CustomUser
from core.models import Order
class DataSample(models.Model):
advertising_costs = models.DecimalField(max_digits=9, decimal_places=2, default=0)
total_user_count = models.Posi... | true |
7abc6252ada1b99cc5fb14f9884eb32c6550786d | Python | golmschenk/sr-gan | /crowd/data.py | UTF-8 | 23,650 | 2.875 | 3 | [] | no_license | """
Code for the crowd data dataset.
"""
import random
from enum import Enum
import scipy.misc
import torch
import numpy as np
import torchvision
from torch.utils.data import Dataset
class CrowdDataset(Enum):
"""An enum to select the crowd dataset."""
ucf_cc_50 = 'UCF CC 50'
ucf_qnrf = 'UCF QNRF'
shan... | true |
f522acceeab1f4d028b11264911aee2d1b3546d3 | Python | arunkumar27-ank-tech/Hackerrank_PYTHON | /7.Collections/Solutions/piling-up.py | UTF-8 | 317 | 3.25 | 3 | [] | no_license | for _ in range(int(input())):
n,lst =int(input()), list(map(int,input().split()))
if (sorted(lst)[-1]==lst[0]) or (sorted(lst)[-1]==lst[-1]):
print("Yes")
else:
print("No")
#lst1 = [2,3,4,5]
##lst2=[4,5,2,3]
#if (lst1==sorted(lst2)):
# print("yes")
#else:
# print("No") | true |
21aeda5dfa80066fc2c64587bf67d8e840834367 | Python | Time1996/python | /pythonPractice/44classwithobject.py | UTF-8 | 64 | 3.03125 | 3 | [] | no_license | s = 'How are you?'
l = s.split()
dir(s)
dir(l)
print(s)
print(l) | true |
3d9d3f0f221dc1103b95192b8a65a4aace2bf652 | Python | cges60809/DenseNet | /data_providers/Mnist.py | UTF-8 | 7,032 | 2.703125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 3 16:45:13 2018
@author: islab
"""
import tempfile
import os
import pickle
import random
from tensorflow.contrib.learn.python.learn.datasets.mnist import read_data_sets
from .base_provider import ImagesDataSet, DataProvider
import numpy as np
clas... | true |
588c5566784db04820cd9ee8b341dda9f1b47a9f | Python | tkhamvilai/SAFRAN_demo | /full_demo/execute_another_script.py | UTF-8 | 875 | 3.109375 | 3 | [] | no_license | import RPi.GPIO as GPIO
import subprocess
import _thread
import time
GPIO.setmode(GPIO.BOARD)
switch_button = 40
GPIO.setup(switch_button, GPIO.IN, pull_up_down = GPIO.PUD_UP)
input_state = GPIO.input(switch_button)
# Define a function for the thread
def call_func(threadName, func_name):
subprocess.call(['python'... | true |
d673256a160cb1669e20887ff92b5cd288b22d04 | Python | hugolu/learn-python | /programming-in-python/ch4.py | UTF-8 | 174 | 3.953125 | 4 | [] | no_license | #!/usr/bin/env python
# Chapter 4 - Control and Function
# conditional branching
num = 10
if num % 2 == 0:
"{0} is even".format(num)
else:
"{0} is odd".format(num)
| true |
ccba07a20be0c997037223b01ae6972ec934823e | Python | linyuxuanlin/3D-print-library | /arduino有关/plen2机器人文件/PLEN2-master/arduino/sdk/UnitRunner/UnitRunner.py | UTF-8 | 1,300 | 2.515625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import json, locale
from datetime import datetime
from argparse import ArgumentParser
# Set global settings.
# ==============================================================================
locale.setlocale(locale.LC_ALL, 'jpn')
# Application entry point.
# =================================... | true |
0f0d48c3c9c6a973252b6be68d96c27cd4661d1a | Python | ctfer-Stao/ctf-sql | /sql.py | UTF-8 | 1,523 | 2.78125 | 3 | [] | no_license | #python3
#by stao
import requests
import threading
words=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W... | true |
3784f826718395d355eaf9ba708a92eac132ca10 | Python | juarezpaulino/coderemite | /problemsets/Codeforces/Python/A88.py | UTF-8 | 336 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | """
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
c=['C','C#','D','D#','E','F','F#','G','G#','A','B','H']
x,y,z=sorted(map(c.index,input().split()))
for _ in' '*3:
a,b=(y+12-x)%12,(z+12-y)%12
if [a,b]==[4,3]:
print('major')
exit()
if [a,b]==[3,4]:
print('minor')
... | true |
b8420a1ff5d5b7a3652be08be3112da53f4e8003 | Python | iamanobject/Lv-568.2.PythonCore | /HW_4/havrylyakyulia/Home_Work4_Task_3.py | UTF-8 | 286 | 3.796875 | 4 | [] | no_license | num = int(input("Number:"))
num_1 = 0
num_2 = 1
if num < 2:
print("Not bad")
else:
print(num_1, end=' ')
print(num_2, end=' ')
for i in range(2, num):
new_num = num_1 + num_2
num_1 = num_2
num_2 = new_num
print(new_num, end=' ')
| true |
a1c10b1267e73049a941eed8e3db8911b40b14ff | Python | Svdvoort/PREDICT | /ImageFeatures/texture_features.py | UTF-8 | 2,048 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from skimage.feature import local_binary_pattern
import pandas as pd
import scipy.stats
def get_LBP_features(image, mask, radius, N_points, method):
feature_names = ['LBP_mean', 'LBP_std', 'LBP_median', 'LBP_kurtosis', 'LBP_skew', 'LBP_peak']
full_features = np.zeros([len(radius) * len(fe... | true |
f8d6cfa3c6399184b5cf3438b60a2b2068a656e7 | Python | manishmcu/Google-Assistant-with-RaspberryPi | /pi_iot.py | UTF-8 | 2,063 | 2.734375 | 3 | [] | no_license | import random
import sys
import time
from Adafruit_IO import MQTTClient
import requests
ADAFRUIT_IO_KEY = 'aio_cEQk60uNwKank8nAXtPXP1Ps5LJ0' # Set to your Adafruit IO key.
ADAFRUIT_IO_USERNAME = 'Debanik2000' # See https://accounts.adafruit.com
... | true |
90e8887f0ecb7ae621b1c250fa99d2b98d1fdb71 | Python | RickvBork/Programming-Project | /data_gen/gen_winners.py | UTF-8 | 1,324 | 3.125 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | '''
Make GET request for data
'''
# Creates data used for the DataMaps Choropleth
# import library
import helpers as hlp
import json
from collections import Counter as count
import os
def gen_winners():
# move back one directory
os.chdir("../data")
test = []
winners = {}
i = 0
# loop over seasons
for seas... | true |
f1aa148e72dee24353aeaead19908d619721e60d | Python | BUCT-CS1808-SoftwareEngineering/MusemData_Collection_System | /museum/spiders/education60.py | UTF-8 | 975 | 2.515625 | 3 | [] | no_license | import scrapy
from museum.items import educationItem
import json
class Education60Spider(scrapy.Spider):
name = 'education60'
start_urls = [
"http://www.gzsmzmuseum.cn/list-19.html"
]
def parse_content(self, response):
educationName = response.xpath("//h2/text()").get()
educa... | true |
ec31cf76940e93668843d6553d65a6e2e80b1d66 | Python | rocketbot-cl/MongoDB | /__init__.py | UTF-8 | 4,498 | 2.640625 | 3 | [
"MIT"
] | permissive | # coding: utf-8
"""
Base para desarrollo de modulos externos.
Para obtener el modulo/Funcion que se esta llamando:
GetParams("module")
Para obtener las variables enviadas desde formulario/comando Rocketbot:
var = GetParams(variable)
Las "variable" se define en forms del archivo package.json
Para modifica... | true |
f6466b2813316bf0b376657cf861d77488e13e75 | Python | Raniac/NEURO-LEARN | /env/lib/python3.6/site-packages/nibabel/tests/test_batteryrunners.py | UTF-8 | 6,176 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | # emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the NiBabel package for the
# copyright and license terms.
#
### ### ### #... | true |
f4089e53731a291ab14eecb8d17a320ba1600e33 | Python | lexweg7/REU2020 | /22Mg(alpha, proton)/dataprep.py | UTF-8 | 1,750 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
'''
This function produces voxel-grid downsampled 128x128 xy projections for 22Mg data
'''
def downsample('my-file.h5','r'):
#Read in h5 file in which each event is an individual key
events = []
for i in hf.keys():
events.append(hf[i])
... | true |
606246c85062d72cccde7e048a9fc8819e02e14e | Python | Vall-1996/bh_mass | /integrate.py | UTF-8 | 1,790 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 19 13:03:15 2020
@author: val
"""
import math
import numpy as np
def integral(k,u,o,a,b):
t1=k*(np.sqrt(2.*np.pi)/2.)*o
t2=math.erf((np.sqrt(2.)/2.)*(u-a)/o)
t3=math.erf((np.sqrt(2.)/2.)*(u-b)/o)
return t1*(t2-t3) #1E-17 erg/s/cm^2/... | true |
0a618939ce0ccf03f208adcc66572d615f58c832 | Python | allenxzy/Data-and-Structures-and-Alogrithms | /python_data/Chapter 10/R/R-10.7.py | UTF-8 | 404 | 2.53125 | 3 | [] | no_license | #-*-coding: utf-8 -*-
"""
Our Position classes for lists and trees support the__eq__method so that
two distinct position instances are considered equivalent if they refer to the
same underlying node in a structure. For positions to be allowed as keys
in a hash table, there must be a definition for the__hash__method th... | true |
22f7d2bb7ea0c2eb805961562a2770340c1b31e1 | Python | markosolopenko/python | /advent_of_code_2015/day_16/aunt_sue.py | UTF-8 | 2,485 | 3.109375 | 3 | [] | no_license | import re
unknown_aunt = {'children': '3', 'cats': '7', 'samoyeds': '2', 'pomeranians': '3', 'akitas': '0',
'vizslas': '0', 'goldfish': '5', 'trees': '3', 'cars': '2', 'perfumes': '1'}
def parse_file():
file = open('day16.txt').read().split('\n')
aunts = {}
aunts_info = {}
num = 1... | true |
0aa3122d46d6638d334e379aaf4ce980a3dd617f | Python | yoganbye/Kirill-homework | /Part_1/Lesson_8/hw8_loto.py | UTF-8 | 7,271 | 3.703125 | 4 | [] | no_license | #!/usr/bin/python3
# == Лото ==
# Правила игры в лото.
# Игра ведется с помощью специальных карточек, на которых отмечены числа,
# и фишек (бочонков) с цифрами.
# Количество бочонков — 90 штук (с цифрами от 1 до 90).
# Каждая карточка содержит 3 строки по 9 клеток. В каждой строке по 5 случайных цифр,
# располож... | true |
846e160d44d6e29d425edbe41b77d1602502003b | Python | sabihismail/cps-406-qix | /util/draw_util.py | UTF-8 | 2,803 | 3.28125 | 3 | [] | no_license | import pygame
def draw_rect(surface, colour, bounds, line_width=1):
draw_rect_specific(surface, colour, bounds.x, bounds.y, bounds.width, bounds.height, line_width=line_width)
def draw_rect_specific(surface, colour, x, y, width, height, line_width=1):
lst = [
((x, y), (x, y + height)),
((x, y)... | true |
bd59d96cdf8d6c1ee934ec9235101777eb86849c | Python | jvasilakes/yall | /yall/utils.py | UTF-8 | 1,562 | 3.265625 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
# TODO: Reference the active learning challenge
def compute_alc(aucs, normalize=True):
'''
Compute the normalized Area under the Learning Curve (ALC)
for a set of AUCs.
param aucs: np.array of AUC values.
param normalize: Whether to normalize the... | true |
19d71a70c9e149adbbba05ca4deb55f4d26ae189 | Python | mifa031/hacking_problems | /web/suninatas07(34).py | UTF-8 | 952 | 2.609375 | 3 | [] | no_license | from http import client
import time
#level7 문제에 접속
conn = client.HTTPConnection('suninatas.com',80)
GET_headers={'Cookie': 'ASPSESSIONIDQQCQAAQS=MDOIJMNCGKDLIFAGHHECJICL'}
GET_url = '/Part_one/web07/web07.asp'
GET_body = ''
conn.request('GET',GET_url,GET_body,GET_headers)
conn.close()
#YES버튼을 누른것과 같은 효... | true |
03062222ac7541a125cd94f8460935fd767b4332 | Python | guiraldelli/MSc | /haplotype_network/guiraldelli/master/mutation/algorithms.py | UTF-8 | 2,274 | 3.3125 | 3 | [
"BSD-2-Clause"
] | permissive | from data import Mutation
import pygraph.classes.graph
def find_mutations(haplotypes):
'''Given (a dictionary of) haplotypes, return a list (of Mutation)
with mutational information about the haplotypes.'''
mutations = list()
tested_pairs = list()
for haplotype in haplotypes.keys():
for oth... | true |
2209e5d07bc968c63bf7633b8f23b4e03608e61e | Python | alexjaw/rnm | /rnm/service.py | UTF-8 | 2,112 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
#
# Classes for accesspoint and dhcp services
import logging
from subprocess import check_output, Popen, PIPE
class Service:
def __init__(self, service):
self.service = service
def _service_cmd(self, cmd):
assert cmd in ['start', 'stop', 'status'], 'Not a valid service cmd'
... | true |
7ec4239b53edb3eebde0ce3a66ddc186160384e3 | Python | huangkg8/Super-Hijacker | /src_v3/screen_factors/enemy.py | UTF-8 | 890 | 3.09375 | 3 | [] | no_license | """俊义完成"""
import pygame as pg
from pygame.sprite import Sprite
class Enemy(Sprite):
def __init__(self,sett,life,speed,time_limit):
super().__init__()
self.sett=sett
self.life=life #生命值
self.speed=speed
self.shoot_dir=180
self.time_limit=time_limit #hero可以驾驶的时限
self.jackedTime=None #被... | true |
a4f7ccd51cf2496cc3535476e9269c9ae7c06ee4 | Python | erantanen/my_blog | /code_snips/file_open.py | UTF-8 | 290 | 3.515625 | 4 | [] | no_license | #! /usr/bin/env python
"""
example showing how to open a file and what to do with non strings
"""
with open("blah.txt", "w") as FH:
FH.write("Space… the final frontier.")
for elm in range(10):
#elm has been cast to a string
FH.write(str(elm) + "\n")
| true |
1146078f6a9c6a8d83d172b4e37e2dcdef392c1a | Python | juhtornr/LocalEGA | /src/lega/utils/checksum.py | UTF-8 | 1,795 | 3 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import logging
import hashlib
from .exceptions import UnsupportedHashAlgorithm, CompanionNotFound
LOG = logging.getLogger('utils')
# Main map
_DIGEST = {
'md5': hashlib.md5,
'sha256': hashlib.sha256,
}
def instanciate(algo):
try:
return (_DIGEST[algo])()
except KeyEr... | true |
797428412a1d2ae78a9dc5f787272c836c271d3d | Python | Deven-14/Python_Level_1 | /decorator.py | UTF-8 | 486 | 3.390625 | 3 | [] | no_license | from functools import wraps
def decorator(func):
@wraps(func)
def print_args_value(*args, **kwargs):
for ele in args:
print(ele)
for ele in kwargs.values():
print(ele)
x = func(*args, **kwargs)
return x
return print_args_value
@decorator
de... | true |
36e8c2c8e13fe292534da179e670aee044a6fb7a | Python | Vishruth-S/Hack-CP-DSA | /Hackerrank/No Idea!/Solution.py | UTF-8 | 1,246 | 4.0625 | 4 | [
"MIT"
] | permissive | """According to the question we need to maintain count of likes and dislikes such that from a set of numbers(Second line of input) if a particluar number exist in set A(Third line of input) then the happiness count will be 1, if it exist in (Forth line of input)B the happiness count will be -1 and if neither of the set... | true |
28d991579468a891b9c15e79b3a205dcb2344613 | Python | umunusb1/PythonMaterial | /python3/03_Language_Components/07_Conditional_Operations/e_celsius_to_fahrenheit_conversion.py | UTF-8 | 337 | 3.984375 | 4 | [] | no_license | #!/usr/bin/python3
"""
Purpose: Temperature Conversions
- celsius to fahrenheit
"""
celsius = float(input('Enter temperature in celsius:'))
# print(f'{celsius =}')
farhenheit = (1.8 * celsius) + 32
# print(f'{farhenheit =}')
print(f'''
celsius : {round(celsius, 2)}
farhenheit : {round(farh... | true |
1129ca00f776ff04e16e114b1d917f0527fc32cd | Python | collopa/mcm | /model/radio.py | UTF-8 | 8,215 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python
# Author: cbecker@g.hmc.edu
#-----------------------------------------------------------------------#
'''
TODO:
import iono and ocean indices correctly, change MAIN!
'''
#-----------------------------------------------------------------------#
'''
Inputs: discrete signal vector as a function of tim... | true |
99feef75c289f4c837b85acd35da46696e2b82d8 | Python | Schroedingberg/EiP | /Sheet06/Test2.py | UTF-8 | 72 | 2.609375 | 3 | [] | no_license | import numpy as np
A = [2, -6, 2, -1]
res = np.polyval(A,3)
print(res)
| true |
40893d8240c5f82ae69cd0bfc2bd1fe03e17dca8 | Python | mrzResearchArena/Intelligent-Elevator-System | /MainElevator.py | UTF-8 | 13,986 | 2.953125 | 3 | [] | no_license | from random import uniform # uniform distribution
import itertools # Combination
import math # floor 0r celling
import time # time counter
global totalServed
totalServed = 0
global up
up = []
global down
down = []
global upStop
upStop = []
global downStop
downStop = []
global currentLocation
currentLocation = 1... | true |
760b957bdf1830b75332d5f605990d515f91ca9c | Python | adibsxion19/CS1114 | /Labs/lab12Pr5.py | UTF-8 | 1,283 | 3.46875 | 3 | [] | no_license | #Aadiba Haque
#4/24/2020
#Lab 12 Q5
def add_entry(contacts, name, number):
if name not in contacts:
if len(number) == 10:
valid = True
for num in number:
if not num.isdigit():
valid = False
if valid:
contacts[... | true |
b57e5429edfc6a457a00d05dd8b282905b01fff8 | Python | totalborons/LPTHW | /ex15.py | UTF-8 | 338 | 3.109375 | 3 | [] | no_license | from sys import argv
script, fileName = argv
txt = open(fileName)
print(f"Opening file {fileName}")
print(txt.read())
# .read reads the whole file here and not the individual lines and no control over where and how to read..
# done now
# have to pass txt extension in name else it wont work
# read() reads all the ... | true |
261159262f4822fc3f8db5e0cf574d7d76186f3a | Python | SebBlin/p4 | /some-tests/print-table.py | UTF-8 | 1,067 | 3.484375 | 3 | [
"MIT"
] | permissive | # affichage d'une grille
# voir https://en.wikipedia.org/wiki/Box-drawing_character#Unicode
nbcol = 7
nbligne = 6
grille = [
[0,0,0,0,0,0,0],
[0,0,0,0,0,0,0],
[0,0,1,0,0,0,0],
[0,0,1,0,0,0,0],
[0,0,1,0,0,0,0],
[0,0,1,2,2,2,0]
]
pion = [' ', 'X', 'O']
def print_top_line():
print(u'\u250... | true |
3361686119ad81a1c35919529dba737a79467f89 | Python | ePlusPS/emr-workflow | /airflow_pipeline/readmission_tf_prob_to_likert.py | UTF-8 | 975 | 2.671875 | 3 | [] | no_license | import pandas as pd
from workflow_read_and_write import standard_read_from_db, standard_write_to_db
def make_likert_column(df):
likert_vals = []
for i, row in df.iterrows():
if row['keras_pred'] < 0.25:
likert_vals.append('Very Unlikely Readmission')
elif 0.25 <= row['keras_pred'] ... | true |
24b96448014e8c1e6495439df7a422598a3354e8 | Python | paullickman/aoc2020 | /09/encoding.py | UTF-8 | 1,125 | 3.4375 | 3 | [] | no_license | def sums(nums):
for i in range(len(nums)):
for j in range(len(nums)):
if i != j:
yield nums[i] + nums[j]
class Encoding():
def __init__(self, filename, preamble):
with open('09/' + filename) as f:
self.nums = list(map(int, f.readlines()))
self... | true |
92e42c766ac3c595bce51941e2d9d2349cc9c4ae | Python | jortis10/TimberPy | /timberman.py | UTF-8 | 1,186 | 2.765625 | 3 | [] | no_license | import pygame
class Timberman:
def __init__(self):
self.texture = pygame.image.load("Assets/timberman.png").convert_alpha()
self.live = 1
self.x = 20
self.y = 512
self.action = 0
self.collide_y = 650
self.state = 0 #0 is left 1 is right
def setTimb... | true |
22d3e08ff0e9d350ec177d502fe5defa430146ec | Python | QuickTiger/PsMiss | /GetDataOfLake.py | UTF-8 | 570 | 2.640625 | 3 | [] | no_license | #A simple scripts of Download data from TaiHu Lake
import re
import urllib.request
f=open('data.txt','w')
for i in range(60617-54291):
n=i+54291
print(n)
data_url="http://www.lakesci.csdb.cn/page/showItem.vpage?id=lakesci.csdb.cn.rgjc.zdhpszzdjc/"+str(n)
s=urllib.request.urlopen(data_url)
d... | true |
32fa67c5143475569df2038099b4bfe1d9ccde37 | Python | cicihou/LearningProject | /leetcode-py/leetcode91.py | UTF-8 | 1,421 | 3.828125 | 4 | [] | no_license | class Solution:
def numDecodings(self, s: str) -> int:
'''
method 1 memoize + recursion
如果都合法的时候,答案就是 fibbo(len(s)+1)
递归:
有多少个需要计算的值,我们可以假设取第一位或者取第二位数
base case:
当 length = 0 时,res = 1
当 s[k:] 的第一位是 0 是,表示这是一个无效的子串,所以也返回 0
... | true |
26c6f8211fec591940f5d043aa4cf9fd53ee0d21 | Python | kkhaveabigdream/iot-device | /apps/tests/labs/Module02Test.py | UTF-8 | 2,832 | 2.734375 | 3 | [] | no_license | """
Test class for all requisite Module02 functionality.
Instructions:
1) Rename 'testSomething()' method such that 'Something' is specific to your needs; add others as needed, beginning each method with 'test...()'.
2) Add the '@Test' annotation to each new 'test...()' method you add.
3) Import the relevant mod... | true |
fd5761d363100f436c43d3c71115288eafad1c71 | Python | AmrGNegm/Code-Wars | /Python/3- Jaden Casing Strings2.py | UTF-8 | 88 | 3.03125 | 3 | [] | no_license | def toJadenCase(string):
return ' '.join(i.capitalize() for i in string.split(" "))
| true |
9fd7585aa38c288df9178a6c0c3df6adb762d297 | Python | weizhixiaoyi/text-similarity | /similarity.py | UTF-8 | 2,079 | 3.265625 | 3 | [] | no_license | import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from scipy.linalg import norm
def tf_cosine_similarity(str1, str2):
"""tf cosine similarity
Parameters
----------
str1: string1
str2: string2
Returns
... | true |
1dd819a78be2b0daf08be92d116632271094d9b0 | Python | demetriushenry/opencv-python-samples | /obj_measurement.py | UTF-8 | 4,079 | 2.953125 | 3 | [] | no_license | import sys
import cv2
import numpy as np
def reorder(points):
new_points = np.zeros_like(points)
points = points.reshape((4, 2))
add_point = points.sum(1)
new_points[0] = points[np.argmin(add_point)]
new_points[3] = points[np.argmax(add_point)]
diff = np.diff(points, axis=1)
new_points[1]... | true |
097b5f46bf9a6494f70d900e6aba59259a490d8e | Python | OneOverCosine/data_collections | /lists_and_tuples.py | UTF-8 | 1,076 | 4.40625 | 4 | [] | no_license | # What is a list?
# # Lists are commonly used to store related data
shopping_list = ["bread", "chocolate", "avocados", "milk"]
# print(shopping_list)
# print(shopping_list[0])
# shopping_list[0] = "orange"
# shopping_list.append("apple juice")
# shopping_list.pop(0)
# print(shopping_list)
mixed_list = [1, 2, 3, "o... | true |
76c456e9e71dde3f83b2cb8d0be4fe5b09af9073 | Python | melnikova12/Repository | /hw4/hw4.py | UTF-8 | 427 | 3.65625 | 4 | [] | no_license | #вариант 1 - найти среднее число слов в строке
with open("/Users/melnikovaarina/Desktop/stranger_things.txt",
encoding="utf-8") as f:
text = f.read()
text = text.replace("\ufeff","")
lines = text.splitlines()
al = 0
st = 0
for x in lines:
st += 1
length = len(x.split())
al += length
pr... | true |
79a7f8667fd6e05c3fc81161fc1be091fd202d79 | Python | DanielFL0/Learning-Python | /exercise3-3.py | UTF-8 | 586 | 4.5625 | 5 | [] | no_license | #3-3 Your own list; Think of your favorite mode of transportation, such as a motorcycle or a car, and make a list that stores several examples. Use your list to print a series of statements about these items, such as "I would like to own a Honda motorcycle."
items = ['Porsche 911', 'Corvette Z06', 'Norton Commando 961... | true |
397745585418608cb2ed5ebe581b294e957aac15 | Python | jelee0621/eon_hw | /train.py | UTF-8 | 5,881 | 3.015625 | 3 | [] | no_license | import copy
f = open("C:/Users/ADmin/Desktop/eonhw/TrainList.txt", 'r')
TrainList=[]
indlist = []
while True:
tl = f.readline().split()
TrainList.append(tl)
if not tl: break
f.close()
del TrainList[0]
del TrainList[len(TrainList)-1]
modyTrainList = c... | true |
2caf5525418d0e68462da3eb77c4d0a7dda0f8f0 | Python | kxmdxhxx/Biometrics | /TrafficLight.py | UTF-8 | 411 | 2.5625 | 3 | [] | no_license | import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(3, GPIO.OUT) # Blue LED
GPIO.output(3, GPIO.HIGH)
time.sleep(2)
GPIO.output(3, GPIO.LOW)
GPIO.setup(5, GPIO.OUT) # Yellow LED
GPIO.output(5, GPIO.HIGH)
time.sleep(2)
GPIO.output(5, GPIO.LOW)
GPIO.setup(7, GPIO.OUT) # White LED
GPIO.outp... | true |
4dbd7e8ee2e86524c6a148b807715f2fabe35d33 | Python | brantseibert/diabetesMonitor | /human_body.py | UTF-8 | 850 | 3.234375 | 3 | [] | no_license | import datetime
import threading
import time
from food import Food
from timezone import MST
class HumanBody:
def __init__(self):
## insulin usage variables
self.carbs_on_board = []
self.clear = threading.Thread( target=self.clearOldCarbs )
self.clear.setDaemon(True)
self.clear.start()
## Methods dealin... | true |
0470a40bc835066890f68f867ecc6a453333ea84 | Python | xaedes/OttoCar-PC | /src/ottocar_utils/scripts/ottocar_utils/window.py | UTF-8 | 1,562 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from ottocar_utils.measure_sample_rate import MeasureSampleRate
import numpy as np
class Window(object):
"""docstring for Window"""
def __init__(self, window_size = 10, n_signals = 1):
super(Window, self).__init__()
self.window_size = window_size
... | true |
e50e203efe195220c2117ef1849c048a24f59ebf | Python | 17390089054/Python | /Python3WorkSpace/Unit6/iftest.py | UTF-8 | 2,405 | 3.25 | 3 | [] | no_license | color='red'
if color=='green':
print("You have got 5 points\n")
elif color=='yellow':
print("You have got 10 points\n")
else:
print("You have got 15 points\n")
#5-7
favorite_fruits=['banana','apple','orange']
if 'banana' in favorite_fruits:
print("You really like bananas!\n")
#5-7-1
re... | true |
ce29b5510bd003b165ea966aaaab7078e1439115 | Python | arthur37231/bilibili-followers-checker | /database/base_handler.py | UTF-8 | 1,345 | 2.59375 | 3 | [
"MIT"
] | permissive | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from .schema import Base
class BaseHandler(object):
_Session = None
@staticmethod
def _make_connection_url(**kwargs):
host = kwargs.get('host')
port = kwargs.get('port')
user = kwargs.get('user')
... | true |
9f0ede206b2ab8c63b90e39aa37b6b99c6fbadb6 | Python | CIgnacio-dev/Ejercicios-b-sicos-py | /if.py | UTF-8 | 471 | 3.609375 | 4 | [] | no_license | import random
aleatorios = [random.randint(1,6) for _ in range(2)]
print(aleatorios)
s=sum(aleatorios)
print ('La suma de los números es', s)
ask=int(input('¿Desea lanzar el dado otra vez? Ingresa 1 para Sí o cualquier otro número para No '))
if ask==1:
aleatorios = [random.randint(1,6) for _ in range(2)]
... | true |
1fc5abb3271d4f43bc63251c92b1561a35fa9834 | Python | HenriTammo/OMIS | /tund8/htmlKirjutamine.py | UTF-8 | 231 | 2.578125 | 3 | [] | no_license | file = open("tund8/näide.html", "w")
ülemine = """<html>
<head></head>
<body><p>"""
sisestus = input("ütle midagi")
alumine = """</p></body>
</html>"""
file.write(ülemine)
file.write(sisestus)
file.write(alumine)
file.close() | true |
3a3c710e20ab634bfd7166018e4baed626d662d5 | Python | jerrybelmonte/DataStructures-Python | /job_queue.py | UTF-8 | 1,092 | 3.515625 | 4 | [
"MIT"
] | permissive | # Parallel Processing
# Author: jerrybelmonte
from collections import namedtuple
from heapq import heapify, heappop, heappush
AssignedJob = namedtuple('AssignedJob', ['worker', 'started_at'])
def assign_jobs(n_workers: int, jobs: list):
"""
Uses n independent threads to process a given list of jobs.
:pa... | true |
820bee9427427240e2887854fd21b21bd0e9dbae | Python | farooq-teqniqly/py-workout | /kidslanguages.py | UTF-8 | 817 | 3.484375 | 3 | [
"MIT"
] | permissive | from typing import Generator
_vowels = ["a", "e", "i", "o", "u"]
def _ensure_not_null(s: str):
if s is None or len(s.strip()) == 0:
raise ValueError("Input string cannot be None or empty.")
def english_to_pig_latin(s: str) -> Generator[str, None, None]:
_ensure_not_null(s)
words = s.split(" ")... | true |
1d307241cfcd4a991166debf15d79c6923141759 | Python | Annapoorneswarid/ANNAPOORNESWARI_D_RMCA_S1A | /Programming_Lab/27-01-2021/7a..py | UTF-8 | 461 | 3.203125 | 3 | [] | no_license | Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
>>> list1=[8,10,15,13,16,20,25,10,13,5,4,16]
>>> list2=[16,4,5,13,10,25,20,16,13,15,10,8]
>>> len1=len(list1)
>>> len2=len(list2)
>>> if len... | true |
bd8b0209ac769b080333c7138ac0e783a0b60472 | Python | GabrielPenaU3F/confiabilidad-software | /src/data/data_formater.py | UTF-8 | 4,387 | 2.765625 | 3 | [] | no_license | from abc import abstractmethod, ABC
import numpy as np
from src.data.formated_data import TTFFormatedData, FPDFormatedData
from src.exceptions.exceptions import InvalidArgumentException
class DataFormater(ABC):
singleton = None
@abstractmethod
def give_format(self, data, optional_arguments):
p... | true |
643e34f549b4a59043c93c246f486d49f1fa5b86 | Python | WTrygar/pp1 | /02-ControlStructures/02-45.py | UTF-8 | 641 | 3.890625 | 4 | [] | no_license |
ilość = int(input("Podaj ilość liczb: "))
x = 2
spr = 0
if(ilość == 1):
print("Liczby pierwsze: 2")
elif(ilość == 2):
print("Liczby pierwsze: 2 3")
elif(ilość < 3):
print("Liczby pierwsze: 2 3 5")
else:
x = 3
print("Liczby pierwsze: 2", end = " ")
while ilość - 1 > 0:
y = 2
... | true |
ad7460dfd8d8fd37fd8fb96b7f392063a00c2ed8 | Python | PawelKowalskiGitHub/Clinical_Programming | /Validation of the eligibility process/Generate_files_in_Python/create_files.py | UTF-8 | 4,673 | 3.09375 | 3 | [] | no_license |
import random
import pandas as pd
import numpy as np
country = []
site = []
subject = []
pi_assessment = []
pi_crit = []
pi_crit_num = []
cm_assessment = []
cm_desciption = []
rand_date = []
def database_generator():
global database
country_id = input("Enter the country ID of the subject: ")
country_tex... | true |
96c8908d8e41094905f7233915f7c7244dc55a47 | Python | benquick123/code-profiling | /code/batch-1/dn7/M-149.py | UTF-8 | 13,330 | 2.890625 | 3 | [] | no_license |
########################
# Za oceno 6
def lel(x, y, mine):
k = 0
for w, q in mine:
if w == x or w == (x - 1) or w == (x + 1):
if q == y or q == (y - 1) or q == (y + 1):
k = k + 1
return k
def sosedov(x, y, mine):
k = 0
for w, q in mine:
if w == x o... | true |
c727e054d5b7db8dd945123b246db97602866c81 | Python | nwgdegitHub/python3_learning | /14-字符串的常用方法之修改.py | UTF-8 | 1,422 | 4.5 | 4 | [] | no_license | # str.replace(oldStr,newStr,count)
mystr = " my name is Liu Wei,My age is 30, My name is LW "
print(mystr.replace("name","name2",3))
print("split()分割 返回一个列表")
print(mystr.split("is",2)) #前2个生效
print("join()合并列表里面的元素为一个大字符串")
mylist = ["aa","bb","cc","dd"]
print("...".join(mylist))
print("title()将字符串每个单词的首字母转成大写")
p... | true |
cb1ffd53ba14cf4a853b7b71224bba0e4e026474 | Python | MikayelB/Learning_Python | /CS EX/sum_of_digits_with_function.py | UTF-8 | 207 | 3.8125 | 4 | [] | no_license | def SumOfDigits(N):
thesum = 0
while N != 0:
thesum += N % 10
N = N // 10
return thesum
def main():
N = int(input("Please input a number: "))
print(SumOfDigits(N))
main() | true |
9bcf814f1e593d4e58838c0931c6bc90d08971c8 | Python | BootcampersCollective/Coders-Workshop | /Contributors/BryanYunis/solutions/graphTransitiveClosure.py | UTF-8 | 387 | 3.125 | 3 | [
"MIT"
] | permissive | def closure(graph):
n = len(graph)
reachable = [[0 for _ in range(n)] for _ in range(n)]
for i, v in enumerate(graph):
for neighbor in v:
reachable[i][neighbor] = 1
for k in range(n):
for i in range(n):
for j in range(n):
reachable[i][... | true |
86528946014eb7f031010fe56e2c31afcad9dfdb | Python | luckyaddress/Python | /12_most_use_module.py | UTF-8 | 2,845 | 3.734375 | 4 | [] | no_license | #-*- coding: utf-8 -*-
# 使用中文註解,要加上上面那一行的編碼
# os模組 可以 刪除檔案 建立目錄 更名和刪除目錄
import os
path = os.getcwd() # 取得現在工作目錄
print(path)
print(os.listdir(path)) # 取得路徑下的檔案 和 目錄清單
# os.mkdir("os_module_test") # 建立新目錄 如果目錄已存在,會出現目錄同名無法建立的錯誤
# os.rename("os_module_test", "omt") # 更名現有目錄
# os.rmdir("omt") # 刪除目錄
# 建立檔案 刪除檔案 因... | true |
4f94d8afa3d64b2129fa0ebcdbfbe01a01224f47 | Python | Aasthaengg/IBMdataset | /Python_codes/p03288/s807151610.py | UTF-8 | 417 | 2.828125 | 3 | [] | no_license | def main():
from sys import stdin, setrecursionlimit
setrecursionlimit(10**6)
r = stdin.readline()[:-1]
#n = int(stdin.readline()[:-1])
#r = [stdin.readline() for i in range(n)]
#t = [int(stdin.readline()) for i in range(n)]
r = int(r)
if r < 1200:
print('ABC')
elif r < 2... | true |
1c94dfe35fcf138fa1f98c42d96771b7d6a262ee | Python | savfod/d16 | /mfesyuk/treug_serp.py | UTF-8 | 639 | 3.171875 | 3 | [] | no_license | import turtle
turtle.speed("fastest")
def draw_levi(d, length):
if d == 0:
turtle.left(60)
turtle.forward(length)
turtle.right(120)
turtle.forward(length)
turtle.right(120)
turtle.forward(length)
else:
turtle.left(60)
turtle.forward(length / 2)
turtle.right(120)
turtle.forward(length / 2)
turtle... | true |
97891293e640c04a7995decf972974350d38bfa3 | Python | Data-Analytic-Research-Insight/kerastuner-tensorboard-logger | /kerastuner_tensorboard_logger/logger.py | UTF-8 | 3,195 | 2.6875 | 3 | [
"MIT"
] | permissive | import os
from typing import Any, Dict, Generator, List, Tuple, Union
from datetime import timedelta, datetime
import tensorflow as tf
from kerastuner.engine.logger import Logger
from tensorboard.plugins.hparams import api as hp_board
def timedelta_to_hms(timedelta: timedelta) -> str:
"""(Deprecated) convert date... | true |
5dbb07fe8192e057d6540082c52c0501cf1826a5 | Python | ZHAW-SPDR/SPDR | /experiments/sequencer/experiment2_plot.py | UTF-8 | 4,975 | 2.53125 | 3 | [] | no_license | import pickle
import os
import sys
import random
import numpy as np
from scipy.spatial.distance import pdist
from scipy.interpolate import *
import matplotlib.pyplot as plt
import math
np.random.seed(1337)
random.seed(1337)
SCALE_NOTSAME = False
SCALE_SAME = True
PICKLEFOLDER = 'data/pickles/'
#PICKLE_NAME_STEM = 'TIM... | true |
3e98c37d0acaee7bb5d08373e15e249d36573710 | Python | hsydw/python | /초보자를 위한 파이썬 200제/084.py | UTF-8 | 250 | 3.5 | 4 | [] | no_license | str1 = 'hello'
str2 = '12345'
str3 = 'hi123'
str4 = '안녕'
str5 = '안녕!'
res1 = str1.isalpha()
res2 = str2.isalpha()
res3 = str3.isalpha()
res4 = str4.isalpha()
res5 = str5.isalpha()
print(res1)
print(res2)
print(res3)
print(res4)
print(res5)
| true |
c3c4e24128a8239a8d679d52c8753dbcfb476c6f | Python | ckane/CS6065-Cloud-BigTableDemo | /tbl_demo.py | UTF-8 | 1,500 | 3.453125 | 3 | [] | no_license | #!/usr/bin/python3
import sys
big_table = {} # The data store
col_names = ['row-id'] # An index of all column names
# Start with a fixed column named row-id:
print("Enter row-id, or just hit ENTER to stop adding data: ")
while True:
input_data = sys.stdin.readline().strip()
if len(input_data) == 0:
... | true |
d5ae08821aea0454b352c3f5a13ed1bb729c1caa | Python | nithyaradha/Python_Project | /Assignment_4.py | UTF-8 | 10,291 | 3.828125 | 4 | [] | no_license | import math as m1
import time as t1
# Q(1): A Robot moves in a Plane starting from the origin point (0,0). The robot can move toward UP, DOWN, LEFT, RIGHT
# Q(2): program for searching specific data from that list.
def selection_sort(a_list):
for i in range(len(a_list)):
least = i
for k in ran... | true |
4d94ceaafeb15f6fba52a155dd90518ca63f377d | Python | tashakim/puzzles_python | /prodExceptSelf.py | UTF-8 | 1,050 | 3.25 | 3 | [] | no_license | class Solution:
def productExceptSelf(self, nums: List[int]) -> List[int]:
# two-pass
# one-pass using division (division by zero)
# left_product * right_product
left, right = [1], []
left_prod = 1
for i in range(1, len(nums)):
left_prod *= nums[i... | true |
346dd2fe2cf03233e8a1b4508e0e42e12901c0f3 | Python | radomirbrkovic/algorithms | /matrices/shift-matrix-elements-k.py | UTF-8 | 624 | 4.5 | 4 | [] | no_license | # Shift matrix elements row-wise by k https://www.geeksforgeeks.org/shift-matrix-elements-k/
def shiftMatrixByK(matrix, k):
n = len(matrix)
if k > n:
print("Shifting is not possible")
return
j = 0
while j < n:
for i in range(k,n):
print("{}". format(matrix[j][i]),... | true |
71682a991f8347986a375e53572f52238bc10358 | Python | asyrul21/recode-beginner-python | /materials/week-2/src/solveTogether.py | UTF-8 | 480 | 4.40625 | 4 | [] | no_license | print("I am in the correct directory!")
# 1. Calculate area of triangle
# area of triangle = (width * height) / 2
width = 5
height = 25
areaOfTriangle = (width * height) / 2
print("The area of the triangle is: " + str(areaOfTriangle))
# 2. Calculate the volume of cone
# formula: pi * radius * radius * (height/3)
# p... | true |
66195d6ee608ef9ace220246951911405d86a2f5 | Python | morozzArt/news_classificator | /test.py | UTF-8 | 1,709 | 2.9375 | 3 | [] | no_license | import math
from common_line import convert
themes = ('science', 'style', 'culture', 'life', 'economics', 'business', 'travel', 'forces', 'media', 'sport')
def key_of_max(d):
v = list(d.values())
k = list(d.keys())
return k[v.index(max(v))]
def sum_theme(themes):
sum = 0
for key, value in themes... | true |
dffa024c19ead68de2a85fdf38b0145c1de304f4 | Python | monorio/stweet | /stweet/mapper/user_dict_mapper.py | UTF-8 | 1,722 | 2.75 | 3 | [
"MIT"
] | permissive | """User - dict mapper."""
from copy import copy
from typing import Dict
from arrow import get as arrow_get
from .util import simple_string_list_to_string, string_to_simple_string_list
from ..model import User
def user_to_flat_dict(self):
"""Method to prepare flat dict of tweet. Used in CSV serialization."""
... | true |
12d7388b4d744b805ddadb1297a7909a79794b6c | Python | Cooper-Grumman/mathematical_curves | /epi_circle.py | UTF-8 | 1,285 | 3.09375 | 3 | [] | no_license | """
epi-cycle
"""
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
theta_array = np.linspace(0, 2 * np.pi, 1000)
def circle(x0, y0, r):
return (r * np.cos(theta_array) + x0,
r * np.sin(theta_array) + y0)
fig = plt.figure()
fig.set_size_inches(12, 12, True)
ax ... | true |
9300599e33dd187ecf74146243fe43734d05e373 | Python | qian99/acm | /test.py | UTF-8 | 538 | 2.515625 | 3 | [] | no_license | import os
import sys
def Run(Path, oldtype, newtype):
allFile = os.listdir(Path)
for file_name in allFile:
currentdir = os.path.join(Path, file_name)
if os.path.isdir(currentdir):
Run(currentdir, oldtype, newtype)
fname = os.path.splitext(file_name)[0]
ftype = os.path.splitext(file_name)[1]
if ... | true |
46bd4d6ea8af8706dd2edee0a6f1080ab7a737cc | Python | Jorza/python-useful-codes | /number_suffix.py | UTF-8 | 401 | 3.640625 | 4 | [] | no_license | def number_suffix(number):
number = str(round(number))
ones_digit = str(number)[-1]
tens_digit = str(number)[-2]
if tens_digit == '1':
suffix = 'th'
elif ones_digit == '1':
suffix = 'st'
elif ones_digit == '2':
suffix = 'nd'
elif ones_digit == '3':
... | true |
bfe8c346de3e5dc7967c4efae38314c7b3ccf263 | Python | oscarcheng105/PAS_Python | /Calculator_Oscar.py | UTF-8 | 5,445 | 2.96875 | 3 | [] | no_license | from tkinter import *
import math
cal = Tk()
cal.title("Calculator")
operator = ""
text_Input = StringVar()
def btnClick(numbers):
global operator
operator = operator + str(numbers)
text_Input.set(operator)
def btnClearDisplay():
global operator
operator=""
text_Input.set("")
def allclear():... | true |
3ca45f19adf67638a9ebc427bf66e38aeaf348ba | Python | nitschmann/chuckjokes | /chuckjokes/joke.py | UTF-8 | 2,096 | 2.734375 | 3 | [] | no_license | import chuckjokes.api.jokes as jokes_api
from . import category
from chuckjokes.db import Entity
class Joke(Entity):
__table__ = "jokes"
__columns__ = ["api_id", "value"]
__extra_attributes__ = ["categories"]
__unique_columns__ = ["api_id"]
__timestampes__ = True
def save(self, check_uniquene... | true |
d4cb6095206862e22096dfba569dee7839dffb49 | Python | ThomasOnline/Activite1 | /quizpython.py | UTF-8 | 388 | 3.28125 | 3 | [] | no_license | answer = input("Quel usage a principalement le language python? ")
print("Tu as répondu", answer)
if answer == "BDD":
print("Tu as bien répondu a la question, Bravo.")
elif answer == "robot":
print("Tu as bien répondu a la question, Bravo")
elif answer == "Web":
print("Tu as bien répondu a la quest... | true |
2fa1a7bd8f51dc8f73d7e45cfbb673e539991e43 | Python | rehmanali1337/music_bot | /models/plex.py | UTF-8 | 1,230 | 2.65625 | 3 | [] | no_license | from plexapi.myplex import MyPlexAccount
import plexapi
import json
class Plex:
def __init__(self):
f = open('config.json', 'r')
self.config = json.load(f)
try:
self.account = MyPlexAccount(self.config.get(
"PS_USERNAME"), self.config.get("PS_PASSWORD"))
... | true |
e6f24061fd11803c56009d140939a10ddd344f0b | Python | jorjich/HackBulgaria-Programming101 | /count_substrings/solution.py | UTF-8 | 447 | 3.96875 | 4 | [] | no_license | def count_substrings(haystack, needle):
x = haystack.count(needle)
return x
def main():
print( count_substrings("This is a test string", "is") )
print( count_substrings("babababa", "baba") )
print( count_substrings("Python is an awesome language to program in!", "o") )
print( count_substrings("We have nothing in... | true |
630f521d28e37ef3ec938938306c812e869eccd4 | Python | Chrisebell24/Copulas | /tests/copulas/univariate/test_kde.py | UTF-8 | 6,096 | 2.859375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `univariate` package."""
from unittest import TestCase
import numpy as np
import scipy
from copulas.univariate.kde import KDEUnivariate
from tests import compare_nested_dicts
class TestKDEUnivariate(TestCase):
def setup_norm(self):
"""set up t... | true |