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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
50c228cf9df7e858ade3d624572e25d6c0cee3af | Python | WayneHartigan/Data-Application-Development-Labs | /ca_2_2/filtering/onlineRetailReducer.py | UTF-8 | 382 | 3.09375 | 3 | [] | no_license | import sys
topFifty = []
limit = 50
for line in sys.stdin:
line = line.strip()
data = line.split(",")
try:
prices = float(data[1])
except ValueError:
continue
topFifty.append((prices, line))
topFifty.sort(reverse = True)
if len(topFifty) > limit:
topFifty = topFi... | true |
bdfb3909f7d3ca43d27f7c09773c011db9147bca | Python | noeljeremydiatta/Python | /exo4.py | UTF-8 | 203 | 3.6875 | 4 | [] | no_license | from math import *
x = float(input("Entrer la valeur du réel x: "))
n = int(input("Entrer la valeur de l’entier n: "))
result = float(x ** n)
print("le résultat de la puissance est: ", result)
| true |
0a7b353f45e011c6e22cb492a03fa911d0265480 | Python | JackDraak/Python_Fifteen_Game | /AI_QtMCTS_controller.py | UTF-8 | 5,138 | 3.296875 | 3 | [] | no_license | '''
This module contains the AI_QtMCTS Controller class, which is responsible for handling AI input and updating the console (for now).
'''
# AI_QtMCTS_controller.py
from time import sleep
from console_controller import Controller as cc
from Game import Game
import random
from typing import Union, Tuple
import nump... | true |
db7280be61ee0b2bb8421d89cdb18e1685c63b1d | Python | aroraenterprise/brewhacks | /backend/api/models/base_model.py | UTF-8 | 4,945 | 2.90625 | 3 | [] | no_license | """
Project: backend
Author: Saj Arora
Description:
"""
from datetime import date
from google.appengine.ext import ndb
import pydash as _
class Base(ndb.Expando):
"""Base model class, it should always be extended
Attributes:
created (ndb.DateTimeProperty): DateTime when model instance was created
... | true |
f569335619959ba55ee827dc334ac6470cbae407 | Python | jintgeorge/NeuralNets_PrimeNumbers | /checkPrime.py | UTF-8 | 3,498 | 3.625 | 4 | [] | no_license | # Check/Test for Prime Number in Tensorflow!
# I got approximately 75% accuracy. Feel free to let me know if you find anything wrong
# or ways the performance can be improved
#Inspired by Joel Grus (http://joelgrus.com/2016/05/23/fizz-buzz-in-tensorflow/)
import numpy as np
import tensorflow as tf
from math import s... | true |
e551dbd37f65d92da0f489ebdae59b61539a64e1 | Python | alexanderad/pony-standup-bot | /pony/dictionary.py | UTF-8 | 6,325 | 3.234375 | 3 | [
"MIT"
] | permissive | # coding=utf-8
import string
from datetime import datetime
class Dictionary(object):
"""Collection of phrases."""
PLEASE_REPORT = (
"Hey, just wanted to ask your current status. How it is going?",
"Psst. I know you don't like it. But I have to ask. "
"What is your status? Anything you... | true |
8770966b5104e50763feefc4643c00762fe95c96 | Python | cash2one/Swin | /reptile/List.py | UTF-8 | 6,003 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
######################## BEGIN LICENSE BLOCK ########################
# The Initial Developer of the Original Code is
# Chunwei from China Agricual University
# Portions created by the Initial Developer are Copyright (C) 2012
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# C... | true |
797039ade0d6080faf9b0ba302e099823bf447ab | Python | abhijeet0401/chatbot | /appointments/create_event.py | UTF-8 | 982 | 2.828125 | 3 | [] | no_license | from datetime import datetime, timedelta
from cal_setup import get_calendar_service
def create_event(start, end, summary='no summary', description='no description'):
# authentication
service = get_calendar_service()
# add event
event_result = service.events().insert(calendarId='primary',
body={... | true |
5cb5b8f03e49586b71b3e5ea74b920fb95b9caa1 | Python | carlosfernandez9/ReservaHotelesMinTic | /db/user_db.py | UTF-8 | 915 | 2.625 | 3 | [] | no_license | from typing import Dict
from pydantic import BaseModel
class UserInDB(BaseModel):
username: str
password: str
RewardPoints: int
database_users = Dict[str, UserInDB]
database_users = {"camilo24": UserInDB(**{"username":"camilo24",
"password":"root",
"RewardPoints":20000... | true |
cc7a99e42302c448bfd8d59d0e2c2b38670dbeae | Python | linhuiyangcdns/leetcodepython | /两个数组的交集 II.py | UTF-8 | 982 | 4.0625 | 4 | [] | no_license | """
给定两个数组,写一个方法来计算它们的交集。
例如:
给定 nums1 = [1, 2, 2, 1], nums2 = [2, 2], 返回 [2, 2].
注意:
输出结果中每个元素出现的次数,应与元素在两个数组中出现的次数一致。
我们可以不考虑输出结果的顺序。
跟进:
如果给定的数组已经排好序呢?你将如何优化你的算法?
如果 nums1 的大小比 nums2 小很多,哪种方法更优?
如果nums2的元素存储在磁盘上,内存是有限的,你不能一次加载所有的元素到内存中,你该怎么办?
"""
class Solution:
def intersect(self, nums1, nums2):
... | true |
6d8898b0a0b530aad7b70a5c4b81c0888f13b4eb | Python | MikimotoH/firmadyne | /scripts/shellutils.py | UTF-8 | 996 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import subprocess
from os import path
import sys
def shell(cmd):
bufsize=8
cmd = path.expandvars(cmd)
proc= subprocess.Popen(cmd, shell=True,bufsize=1,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
ret=None
cmdou... | true |
42ae32cd63acf3f0c78e4bee4e62ed1e55783662 | Python | ethanpasta/holberton-system_engineering-devops | /0x16-api_advanced/0-subs.py | UTF-8 | 524 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python3
""" Module for task 0 """
import requests
def number_of_subscribers(subreddit):
headers = {
'User-Agent': ('Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
'AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/76.0.3809.132 Safari/537.36')
}
... | true |
aa6f08d7f62645c41f77f36f1591f2327d08c6fd | Python | iraytrace/Adafruit_CircuitPython_Debouncer | /adafruit_debouncer.py | UTF-8 | 4,182 | 2.921875 | 3 | [
"MIT"
] | permissive | # The MIT License (MIT)
#
# Copyright (c) 2019 Dave Astels for Adafruit Industries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the righ... | true |
52289ffbd49d895979c340f7843de75e9fbccff3 | Python | thewtex/dwl-multidop-l2-viewer | /source/fileparsing/dwl_multidop_tw.py | UTF-8 | 2,164 | 2.875 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | import numpy
import os
class TW:
"""Process a DWL Multidop L2 *.TW? file
Arguments:
filepath: path to the *.TW? file
prf: Pulse repetition frequency
doppler_freq_1 Doppler Frequency of Channel 1
doppler_freq_2 Doppler Frequency of Channel 2
... | true |
72035140810715d9539ae7f2534099ec64ba6870 | Python | hernandez-jesus/Harvard-REU-2017 | /motor_init.py | UTF-8 | 2,753 | 3.03125 | 3 | [] | no_license | from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor
import atexit
# From Adafruit MotorHat example code
# create a default object, no changes to I2C address or frequency
mh = Adafruit_MotorHAT(addr=0x60)
# get each motor: WORKS FOR LITTLE BLUE
# get each motor
myMotor1 = mh.getMotor(1) # right motor
myM... | true |
b186b80b777fea51a378e2222dd9caa0249b2f26 | Python | todddeluca/vanvactor_mirna | /python/flybaseutil.py | UTF-8 | 1,310 | 2.71875 | 3 | [] | no_license |
def select_flybase_gene_ids(gene_conversion_table):
'''
Return a list of unique flybase gene ids from the gene conversion table
downloaded from flybase, skipping ids that did not convert.
'''
uniques = set()
for i, line in enumerate(open(gene_conversion_table)):
# skip comments and ... | true |
8dbf93ee1773af72ca7bce7da55cbfaf2ffb64ba | Python | Control-xl/game | /state_display.py | UTF-8 | 1,013 | 2.953125 | 3 | [] | no_license | import pygame
class StateDisplay():
def __init__(self, screen, settings):
self.settings = settings
self.screen = screen
# 设置显示的血量
self.blood = settings.hero_init_blood
self.blood_ico = pygame.image.load('images/heart.ico')
self.blood_ico.convert()
self.bloo... | true |
9160393f4e9420ea953a4d65d66d4145b3d33ae2 | Python | nubok/project_euler | /problem_28.py | UTF-8 | 738 | 3.75 | 4 | [] | no_license | spiral_size = 1001
spiral = { }
"""direction:
0: right
1: down
2: left
3: up
"""
direction = 0
row = (spiral_size-1)/2
col = (spiral_size-1)/2
delta_row = [0, 1, 0, -1]
delta_col = [1, 0, -1, 0]
current_len = 1
current_number = 1
while current_number != (spiral_size*spiral_size+1):
for j in range(current_len):... | true |
e0ea79884035a5ab8c26db7d29efec8ad8717db1 | Python | Andres-Hernandez-Mata/Scripts-Python | /src/01_Lucky.py | UTF-8 | 563 | 3.15625 | 3 | [] | no_license | """
Uso: Google search
Creador: Andrés Hernández Mata
Version: 1.0.0
Python: 3.9.1
Fecha: 06 Junio 2021
"""
import os, time, random
try:
from googlesearch import search
except ImportError:
os.system('pip install google')
print('Installing google... Ejecute de nuevo')
exit()
# to search
query = input... | true |
c5b59b3512b9e388a155c64742bf7f708d6dfcb3 | Python | itbullet/python_projects | /Stack_20190722/stack_homework2.py | UTF-8 | 576 | 3.921875 | 4 | [] | no_license | import stack_class
number_stack = stack_class.Stack()
number_list = [1, 2, 3, 4, 5]
print(number_list)
"""Version 1
for i in range(len(number_list)):
num = number_list[i]
#print(str(i) + " " + str(num))
number_stack.push(num)
"""
#Version 2
for item in number_list:
#print(item)
number_stack.push... | true |
78b16b72ec4490ac58b5fa41e202da3a776b44c1 | Python | doc22940/twint-utils | /link_counter.py | UTF-8 | 3,211 | 2.71875 | 3 | [
"MIT"
] | permissive | #This code takes a list of twitter usernames, iterates over them to find tweets where they shared links,
#and then sums up the base URLs of everyones links combined and turns it into a matplotlib graph.
#I put a bunch of code documentation in and it really will help you use this.
#the code does take a bit to run dep... | true |
b8ce7bc195186f971cfb5cb0785b840e34ecef0c | Python | Lisa-Apple/myInterface | /api_keyword/key_myOperations.py | UTF-8 | 1,157 | 2.8125 | 3 | [] | no_license | '''
title: 对接口响应体(不仅仅)进行分析的方法
time: 2020.12.12
auth: wanglisha
'''
import json, jsonpath
class OperateFunctions():
# 请求参数转换为json格式
def json_dumps(self, data):
return json.dumps(data)
# 返回值转换成字符串格式
def json_loads(self, data):
return json.loads(data)
# 校验字段获取方法
def ... | true |
6507b4d898bda0f3430bf62821ad6d8105d0f1c8 | Python | VineetMakharia/LeetCode | /463-Island-Perimeter.py | UTF-8 | 684 | 3.21875 | 3 | [] | no_license | class Solution:
def islandPerimeter(self, grid):
if not grid:
return 0
perimeter = 0
rows = len(grid)
cols = len(grid[0])
dirs = [(1,0),(0,1),(-1,0),(0,-1)]
for x in range(rows):
for y in range(cols):
if grid[x][y]==... | true |
b729d0cb8e150953ee1c53f2b43feff8f8edc108 | Python | charlesjavelona/coding-the-matrix | /chapter2/quiz_2_10_6.py | UTF-8 | 312 | 2.953125 | 3 | [] | no_license | from module.vec import Vec
def list2vec(L):
"""
Input: List L of field elements
Output: Return an instance of Vec with domain{0, 1, 2, ..., len(L)-1} such that v[i] = L[i] for each integer i in the domain
Example: [0, 1, 2, 3, 4] -> {0, 1, 2, 3, 4}
"""
return Vec({i for i in L}, {})
| true |
6c3a750b749214686d719fd8d207efa88605d900 | Python | stjordanis/evolutionary_ensembles | /utils/load.py | UTF-8 | 2,825 | 3.25 | 3 | [
"MIT"
] | permissive | import numpy as np
import utils.dictionary as d
def load_labels(dataset='RSDataset', step='validation', fold=1):
"""Loads ground truth labels from a particular dataset, step (validation or test) and fold number.
Args:
dataset (str): Dataset's identifier.
step (str): Whether it should load fr... | true |
5865525201d3b9d803e9d207239d30cae32d66de | Python | case2012/html_parse | /fetch_test.py | UTF-8 | 1,181 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python
import re
fp = open('/home/chen/test.html', 'r')
html_text = ''
for line in fp:
html_text += line
tag_name = 0
tag_attr = 1
tag_end = 2
tag_text = 3
tag_child = 4
tag_parent = 5
tag_ss = '<'
tag_ee = '>'
tag_es = '</'
html_list = gen_taglist(6)
con_nu = html_text.find(tag_ss)
def fetch_tag(te... | true |
8bb392c1ddfde10079e19a15f09a7aba21657e66 | Python | isobelfc/eng84_python_oop | /python.py | UTF-8 | 665 | 3.90625 | 4 | [] | no_license | # Create python class inheriting from snake
from snake import Snake
class Python(Snake):
def __init__(self):
super().__init__()
self.large = True
self.two_lungs = True
self.venom = False # polymorphism - overridden from Snake
def climb(self):
return "up we go"
de... | true |
6ac4e6670c16f9e986cd87d5bbd255e227b65f6b | Python | qmisky/python_fishc | /6-2猜随机数(gui界面版).py | UTF-8 | 1,663 | 3.078125 | 3 | [] | no_license | import easygui as g
import sys
import random
g.multpasswordbox(msg="请输入您的信息:",title="猜数字游戏",fields=("用户名","密码"),values="")
choice=("简单","中级","难","超级难")
g.buttonbox(msg="请选择游戏等级:",title="游戏等级",choices=choice)
# b=100
# if g.buttonbox(choices=choice(o)):
# b=10
# elif g.buttonbox(choices=choice(1)):
# b=50
# elif g.bu... | true |
55907450f1734a47509a123fd648cbbb163362d1 | Python | MOHAMMAD-FATHA/Python_Programs | /Data Structures/Tuples/CheckEleinTuple.py | UTF-8 | 286 | 3.5 | 4 | [] | no_license | """
* @Author: Mohammad Fatha
* @Date: 2021-09-26 19:20
* @Last Modified by: Mohammad Fatha
* @Last Modified time: 2021-09-26 19:20
* @Title: :Python program to check whether an element exists within a tuple
"""
#create a tuple
tuple1 = 2, 4, 5, 6, 2, 3, 4, 4, 7
print(2 in tuple1)
print(5 in tuple1) | true |
6b4cfa672163dd5fbdac271e14f19a6d3ff7c27b | Python | zhaoyinsheng/helloworld | /exercises 1-3.py | UTF-8 | 541 | 4.375 | 4 | [] | no_license | ### LESSON 1: if elif else
#if guess==num:
# print("Current! \nBut no any prize!")
#elif guess>num:
# print("maybe a little BIGGER")
#else:
# print("maybe a little SMALLER")
#print("DONE!")
### LESSON 2:while else
#guess=int(input("Enter a number:"))
#while guess != num:
# if guess > num:
# print("BIGGER!\n")
# els... | true |
4c434be66cc55d253a3f485b40495e4f489869ef | Python | SusanLovely/Test | /testing/test_demo.py | UTF-8 | 1,377 | 2.5625 | 3 | [] | no_license | from appium import webdriver
import pytest
class TestXueQiu:
def setup(self):
desire_cap = {
"platformName": "android",
# "platformVersion": "5.1.1",
# "deviceName": "T3QDU15B04000723",
"deviceName": "66J5T19110001875",
"appPackage": "com.xueqiu... | true |
542a74ca0c0a29dfdf9fc9ae7c316b46962aa169 | Python | fodisi/ByteAcademy-Bootcamp | /w3/d1/schema.py | UTF-8 | 369 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python3
def create_table(ticker_symbol):
connection = sqlite3.connect('master.db', check_same_thread=False)
cursor = connection.cursor()
cursor.execute('create table {0} (pk integer primary key autoincrement, last_price float)'.format(ticker_symbol)
cursor.execute()
connection.close()
return True
... | true |
478f73e97a5555db0b8d70c6f713d1cb1b741628 | Python | eldridgejm/dsc80-sp21 | /projects/04/project04.py | UTF-8 | 11,123 | 3.5625 | 4 | [] | no_license |
import os
import pandas as pd
import numpy as np
import requests
import time
import re
# ---------------------------------------------------------------------
# Question #1
# ---------------------------------------------------------------------
def get_book(url):
"""
get_book that takes in the url of a 'Plai... | true |
2a59366899aeb9e7dfa4af31b7e35f1a025fc481 | Python | liseyko/CtCI | /Chapter 3 - Stacks and Queues/s0307.py | UTF-8 | 2,110 | 3.515625 | 4 | [] | no_license | from queue import Queue
class Animal():
animals = {}
cntr = 0
def __init__(self,id=None):
if not self.animal_type:
self.animal_type = "unspecified"
if self.animal_type in Animal.animals:
Animal.animals[self.animal_type] += 1
else:
Animal.animals[s... | true |
d1a9d444db56467ee661b12a4c15036d8d0742ed | Python | Tanych/CodeTracking | /164-Maximum-Gap/solution.py | UTF-8 | 2,012 | 3.359375 | 3 | [
"MIT"
] | permissive | class Solution(object):
def maximumGap(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
"""
It's a problem with bucket sort.Also, we should
has some idea of math.
Assume the min of the array is A, and the max is B
the min of the gap would... | true |
129f4c5b0a25efac6209e81c38f9a4e9959e8fe9 | Python | FedericoV/SysBio_Modeling | /measurement/timecourse_measurement.py | UTF-8 | 1,923 | 3.21875 | 3 | [
"MIT"
] | permissive | __author__ = 'Federico Vaggi'
from .abstract_measurement import MeasurementABC
class TimecourseMeasurement(MeasurementABC):
"""
A series of measured values, with their associated timepoints and standard deviations (optimal).
:param variable_name: The name of the measured variable
:type: string
:... | true |
2050d90a96e5addc52b30ccb71f422c4ed8ed876 | Python | Sen2k9/Algorithm-and-Problem-Solving | /leetcode_problems/953_Verifying_an_Alien_Dictionary.py | UTF-8 | 4,314 | 4.125 | 4 | [] | no_license | """
In an alien language, surprisingly they also use english lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters.
Given a sequence of words written in the alien language, and the order of the alphabet, return true if and only if the given words are s... | true |
ed75b6743caa7a6bc4da4e2a829a7bcf3d72ed3c | Python | chuck2kill/CoursPython | /chapitre_6/racine.py | UTF-8 | 511 | 4.40625 | 4 | [] | no_license | # programme 4 page 56
# on demande un chiffre à l'utilisateur
# soit on affiche la racine carrée
# soit on affiche un message pour dire
# que la racine carrée ne peut pas être calculée
# importation de module
from math import *
# on demande le chiffre
chiffre = int(input("Veuillez entrer un chiffre :"))
# condition ... | true |
a70bfab27e0b04715f653006665d8161159cd34b | Python | CathyZhou0120/pipelines | /pull_from_psql.py | UTF-8 | 1,412 | 2.71875 | 3 | [] | no_license | import psycopg2
import csv
import os
#conn_string = """dbname='exampledb' user='cathyzhou@cathydb2' host='cathydb2.postgres.database.azure.com' password='3.14159Zyr' port='5432' sslmode='require'"""
# Construct connection string
def get_data(host,user,dbname,password,port,sslmode):
conn = psycopg2.connect(
... | true |
43076f235bcf03af08c954c5ab8c181ddb3a6fed | Python | nelo81/code2word | /converter.py | UTF-8 | 2,505 | 2.8125 | 3 | [] | no_license | import os
import codecs
from docx import Document
doc = Document()
errorlist = []
def convert(dir, mode='flat', title=None, include=None, exclude=None, encoding='utf-8'):
print('copy from diretory: ' + dir)
if title is not None:
doc.add_heading(title, 1)
if include is not None:
inc=include.split('|'... | true |
c6274340edfb073b70ae0a384a445f70502ce67b | Python | sharmakajal0/codechef_problems | /previous_problems/BEGINNER/ONP.sol.py | UTF-8 | 659 | 3.9375 | 4 | [] | no_license | #!/usr/bin/env python
'''module for transformation of infix to postfix'''
def infix_topostfix(infix_exp):
'''Function definition to transform an infix expression into postfix expression'''
stack = []
answer = ''
for i in infix_exp:
if i == '(':
stack.append('(')
elif i >=... | true |
2c569fd0d64171e926e6d10aaaac6aeb618448e0 | Python | lahsivvishal/algorithms-in-python | /Easy/Nth_fib.py | UTF-8 | 654 | 3.953125 | 4 | [] | no_license | # General
"""
if n == 2:
return 1
elif n == 1:
return 0
elif:
return fib(n-1)+fib(n-2)
"""
# Memoize
"""
def getNthFib(n, memoize = {1:0, 2:1}):
if n in memoize:
return memoize[n]
else:
memoize[n] = getNthFib(n-1, memoize) + getNthFib(n-2, memoize)
return memo... | true |
1bd728c6e2f90adc43e6706b57df1e3a55028932 | Python | fiso0/my_python | /sanitize.py | UTF-8 | 304 | 3.46875 | 3 | [] | no_license | def sanitize(time_string):
if '-' in time_string:
splitter='-'
elif ':' in time_string:
splitter=':'
else:
return(time_string)
(mins, secs)=time_string.split(splitter)
return(mins+'.'+secs)
time_string="2-21"
print(sanitize(time_string))
print(sanitize("2:10"))
print(sanitize("3.3"))
input() | true |
038d386b6ba71ccf2690c9207c97c9ab833ef24a | Python | rizkyramadhana26/TubesDaspro | /riwayatGadget.py | UTF-8 | 5,465 | 2.78125 | 3 | [] | no_license | import validasi, variabelGlobal
from datetime import datetime
def cetakRiwayatPinjam(count,sortedriwayat,panjang): # fungsi untuk mencetak riwayat pengambilan
if panjang > 5 : # mengecek panjang list yang belum dicetak
for i in range(count,count + 5): # prosedur percetakan
print("\nID Pem... | true |
f697b8c275cd103732ff50c8121ae5e7e5fe4148 | Python | TaumarT/python | /Quinto_exercicio.py | UTF-8 | 194 | 3.8125 | 4 | [] | no_license | print("---converte metros em centimetros-----")
metros = int(input("digite o numero a ser convertido : "))
cent = metros * 100
print("{} metro equivale a {} centimetros".format( metros,cent)) | true |
4a8d1ec0d98f0c9e6f81cafb5cf32916e1db74b5 | Python | kwangminini/Algorhitm | /CodeUp/CodeUp1091.py | UTF-8 | 237 | 3.15625 | 3 | [] | no_license |
num=input().split()
a=int(num[0])
m=int(num[1])
d=int(num[2])
n=int(num[3])
resultList=[]
result=0
result+=a*m+d
resultList.append(a)
for i in range (n-1):
resultList.append(result)
result=(result*m)+d
print(resultList[-1]) | true |
0ae43f1faf4c628530c8b49f6f96836fbf01fd1c | Python | Arrrrrr/Hoth | /Python/seuss01.py | UTF-8 | 711 | 2.90625 | 3 | [] | no_license | #! /usr/bin/python
# ========== SET UP ===========
# import libraries we need
import pprint
import re
import csv
import os
from _csv import reader
# create a file called seuss.csv
with open('seuss.csv', 'w') as csvfile:
# fieldnames are the headings for each column
fieldnames = ['character', 'habitat']
wr... | true |
bfe876ce37abad96ed78d627fd9310d34c11148a | Python | EmersonDove/Beale | /Scripts/Ciphers/Vigenere.py | UTF-8 | 471 | 3.140625 | 3 | [] | no_license | class Vigenere:
global key
def __init__(self,decryptKey):
global key
key=decryptKey
def decrypt(self,text):
global key
output = ""
currentKeyIndex = 0
for i in range(len(text)):
output += chr(((ord(text[i].lower()))-(ord(key[currentKeyIndex].lower... | true |
913044a3b47839425b8167679ea98bd8f80a9918 | Python | chokoryu/atcoder | /problems/abc182_c.py | UTF-8 | 877 | 2.875 | 3 | [] | no_license | from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations
def m... | true |
33eb372eabd1512234d6ce5232dbeb392aa8ab24 | Python | josephborrego/doom | /frames.py | UTF-8 | 3,874 | 2.953125 | 3 | [] | no_license | # I was inspired to emabrk on this journey with the help from Thomas Simonini
# # https://github.com/simoninithomas/Deep_reinforcement_learning_Course/blob/master/Deep%20Q%20Learning/Doom/Deep%20Q%20learning%20with%20Doom.ipynb
import numpy as np
from skimage import transform
import skimage.transform
from collections ... | true |
1df44f2489163d4743665d4d0ef41e431671efd8 | Python | anillava1999/Innomatics-Intership-Task | /Task5/Task6.py | UTF-8 | 454 | 3.46875 | 3 | [] | no_license | # Regex Substitution in Python - Hacker Rank Solution
# Python 3
# Enter your code here. Read input from STDIN. Print output to STDOUT
# Regex Substitution in Python - Hacker Rank Solution START
import re
def change(match):
if match.group(1) == '&&':
return 'and'
else:
return 'or'
for _ in ran... | true |
89844d00405e8637e8d81fcf7ef1e61b7252e004 | Python | Gustavo-835-tp555/tp555-machine-learning | /misc/holdout.py | UTF-8 | 1,351 | 3.078125 | 3 | [] | no_license | # Import all the necessary libraries.
import numpy as np
import timeit
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.metrics import mean_squared_error
from sklearn... | true |
38e00dc0d4b4550025f59d56c4b72ef597bd1511 | Python | wangqi/deuces | /deuces/round.py | UTF-8 | 2,335 | 2.984375 | 3 | [
"MIT"
] | permissive | from .card import Card
from .deck import Deck
import os
STATUS_FILE = "round.state"
class Round:
def __init__(self, num_player=0):
self.num_player = num_player
self.players = {}
self.player_keys = []
self.flop_card_strs = ""
def add_player_cards(self, player_id, player_name, card_strs):
key = str(playe... | true |
74b154f411e136b36f22b1a1aab1d83082de8361 | Python | GeorgeGio/python_programming | /class-notes/class13/opening.py | UTF-8 | 149 | 2.5625 | 3 | [] | no_license | a_file = open("new_text.txt")
file_contents = a_file.read()
second_file = open("new_file2.txt","w")
second_file.write(file_contents)
a_file.read()
| true |
9c952e4a3f8422efd35797d9482bbd18f208a204 | Python | harinathreddy224/data-mining-project | /bull_vs_bear.py | UTF-8 | 834 | 2.75 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import pylab
import numpy as np
from peakdetect import peakdetect
folderPath = "./data/"
# Process S&P 500
dfSP500 = pd.read_csv('./dataset/SP500.csv')
dfSP500['Date'] = pd.to_datetime(dfSP500['Date'])
dfSP500 = dfSP500[['Date', 'Close']]
print... | true |
90d59cb2a2fd930d41fc1c0ce1726d18808a08aa | Python | vishwasks32/python3-learning | /myp3basics/exers/exer2.py | UTF-8 | 1,066 | 4.21875 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
#
# Author : Vishwas K Singh
# Email : vishwasks32@gmail.com
#
# Script to convert Celcius to Farenheit and vice versa
# Formula F = (C x 9/5) + 32
# C = (F - 32) x 5/9
import os
import sys
os.system('clear')
print("Menu: ")
print("1. Celcius to Farenheit")
print("2. Farenheit to Celciu... | true |
2871145931f7d904c9b2ac1d349daf8b621cd6b6 | Python | rbuckley-git/AdventOfCode2019 | /day19.py | UTF-8 | 2,668 | 3.71875 | 4 | [] | no_license | # https://adventofcode.com/
# 19/12/2019
# Day 19
#
# This had me puzzled for ages. Turned out to be an out by one error. 100 cells are contained in 99 coordinate changes. Algorithm was sound.
#
import intcode
prog = intcode.get_program("19.input.txt")
grid = {}
def render_grid():
maxx = max(x for x,y in grid)
... | true |
afb0ad4de9c558d53a4a7f7b3320923bd41aa919 | Python | konishis/python_training | /wwwproject/tests/test_practice2/test_q3_3.py | UTF-8 | 1,262 | 3.25 | 3 | [] | no_license | """
q3_3【難】
借金返済計画を立てるプログラムを作りたい.
簡単のため,利子は無しとする.
まず,借金の総額と,ひと月に返済する金額を入力すると,
返済にかかる年数を表示し,
さらに,毎年のボーナスから返済する金額を入力すると,
返済完了が何年早まるかを表示し,
その次に返済を完了したい年数を入力すると,
ボーナスからいくら返せばよいかを表示するプログラムを作成せよ.
"""
# from wwwproject.practice2 import q3_3
# def test_1():
# q3_3.debtperson.debt = 500000
# q3_3.d... | true |
91798fa11ae78596dea453c86c4fcde6cbc2b512 | Python | neuroquant/skmediate | /skmediate/conditional_independence.py | UTF-8 | 11,292 | 2.828125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | """Classes for computations of conditional independence."""
import numpy as np
import warnings
from collections.abc import Sequence
from sklearn.base import clone
from sklearn.linear_model import LinearRegression
from sklearn.covariance import (
EmpiricalCovariance,
GraphicalLasso,
GraphicalLassoCV,
Le... | true |
d94afd4f8844ccdec796e2100fa1c597d331eb95 | Python | jaqquery/BigSmallDice | /BigSmallDice/BigSmallDice.py | UTF-8 | 576 | 3.515625 | 4 | [] | no_license | import os
import sys
import random
import time
print("Big or Small Dice Dame")
print("Press any key to start")
system = False
while system == False:
keyInput = input()
diceA = random.randint(0,6)
diceB = random.randint(0,6)
diceC = random.randint(0,6)
result = diceA + diceB + diceC
t... | true |
41b6fd89e39cf40330f423534f56cceb25af1b68 | Python | VadimVovk/VadimWork | /HomeWork6.py | UTF-8 | 2,439 | 3.28125 | 3 | [] | no_license | # my_list = ["ab", "cd", "ef", "gh"]
# result=[]
# for index,item in enumerate(my_list):
# if index%2 == 0:
# result.append(item)
# else:
# result.append(item[::-1])
# print(result)
# #2##########
# my_list = ["aba", "cad", "aef", "gh", "aaa"]
# result=[]
# for str_a in (my_list):
# if str_a[... | true |
16950d2b18262680be0315db1eb10a4f15701158 | Python | TheElk205/RotorTestingBench | /python/plotSerialData.py | UTF-8 | 1,322 | 3.109375 | 3 | [] | no_license | import serial
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import time
import numpy as np
from classes.SerialReader import SerialReader
threads = []
# Create new threads
thread1 = SerialReader(1, "Thread-1", 1)
# Start new Threads
thread1.start()
# Add threads to thread list
threads.app... | true |
622c960c508043c181d1611e223e29e9965e8970 | Python | geyunxiang/mmdps | /mmdps/vis/heatmap.py | UTF-8 | 6,742 | 2.921875 | 3 | [] | no_license | """
Plot network heatmap.
"""
import numpy as np
from matplotlib import pyplot as plt
import matplotlib.cm
from mmdps.util import path
class HeatmapPlot:
"""The heatmap plot."""
def __init__(self, net, title, outfilepath, valuerange=(-1.0, 1.0)):
"""Init the heatmap.
net, the network.
title, the image titile.... | true |
e125753c3ddb12c1a4dcec2277bd0f7837b153d2 | Python | nbro/ands | /ands/algorithms/numerical/horner.py | UTF-8 | 4,956 | 4.0625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
# Meta-info
Author: Nelson Brochado
Created: 30/09/2017
Updated: 30/09/2017
# Description
## Polynomials
The most common way of expressing a polynomial p: R → R of degree at most u is
to use the monomial basis {1, x, x², ..., xᵘ} and to write p as
p(x) = a... | true |
e07f231fc81a6f7e92eb0f2192ce80cff0bbdb5c | Python | acganesh/euler | /545/545.py | UTF-8 | 2,889 | 3.5625 | 4 | [] | no_license | from Euler import prime_sieve, factor
import itertools
from bisect import bisect
import random
def prime_sieve(l):
s = [True] * (l + 1)
s[0:2] = [False, False]
for x in xrange(2, l):
if s[x]:
s[x ** 2::x] = [False] * ((l - x ** 2) / x + 1)
primes = [x for x in xrange(lim) if s[x]]
... | true |
bf4698b4f2772427eee6b02d8c3fe6fa52b06f4a | Python | quekyufei/lottery-env | /environment/plotpoint.py | UTF-8 | 418 | 2.640625 | 3 | [] | no_license | from .constants import LOTTERY_RESULTS
class PlotPoint():
def __init__(self, winnings, tier_idx, bet, won, game_step):
self.winnings = winnings
self.tier = LOTTERY_RESULTS[tier_idx] # loss, small win, med win, large win, jackpot
self.bet = bet
self.won = won
self.game_step... | true |
c2d8191dae4b13a50ee6ee3854b87f3d83f2f09c | Python | kate-gordon/python_GameofThrones | /game_of_thrones_starter/got_demo.py | UTF-8 | 1,920 | 3.8125 | 4 | [] | no_license | from pprint import pprint
from characters import characters
from houses import houses
# ## Characters with names starting with "A "
# namesA = 0
# for character in characters:
# if character['name'][0] == 'A':
# namesA += 1
# print(namesA)
# ## Characters with names starting with "Z"
# namesZ = 0
# for ... | true |
216c564a66269f26a7014c1159cbadc83636d39d | Python | DeshErBojhaa/sports_programming | /leetcode/833. Find And Replace in String.py | UTF-8 | 680 | 3.25 | 3 | [] | no_license | # 833. Find And Replace in String
class Solution:
def findReplaceString(self, S: str, indexes: List[int], sources: List[str], targets: List[str]) -> str:
ans, instructions = [], {}
for i, s, r in zip(indexes, sources, targets):
instructions[i] = (s, r, len(s))
i... | true |
2893a34288d5a4bca591e9980da36b05c9c69831 | Python | hjazcarate/empleado | /applications/departamento/models.py | UTF-8 | 740 | 2.53125 | 3 | [] | no_license | from django.db import models
# Create your models here, blank_True -> el campo permite espacios o null=True
# str(self.id) el id es entero str permite un string
# editable=False -> bloquea el uso de ese campo
class Departamento(models.Model):
name = models.CharField('Nombre', max_length=50, blank=True, null=True)... | true |
34d0ea514b0b34f05f8fd7a5ff5c13b13f2e25bb | Python | sittinginmiami/practice-projects | /Quadraticpolynomialssumofdigitstothe4thpower.py | UTF-8 | 456 | 3.875 | 4 | [
"MIT"
] | permissive | # mensa bulletin Aug 2021 quadratic polynomials
#
# this program will find the three 4-digit numbers that are the sum of their digits to the 4th power
#
# no import math
for i in range(999, 9999): # brute force check each 4 digit number to see whether it meets criteria
first = i % 10
second = (i // ... | true |
afd761d234ae6fbb2d1f37650c8645f0e630e2ff | Python | yycho0108/MobileNet | /voc_utils.py | UTF-8 | 4,776 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
import os
from bs4 import BeautifulSoup
from more_itertools import unique_everseen
import numpy as np
import matplotlib.pyplot as plt
import skimage
from skimage import io
root_dir = os.environ["VOC_ROOT"]
img_dir = os.path.join(root_dir, 'JPEGImages/')
ann_dir = os.path.join(root_dir, 'Annotation... | true |
ec3263487861ff9805d665972532227326a2791c | Python | marcial2020/python_1 | /tuples.py | UTF-8 | 145 | 3.328125 | 3 | [] | no_license |
# tuples can not be changed or modified so it's immutable
coordinates = (4, 5)
# coordinates[1] = 10 will send an error
print(coordinates[0])
| true |
50bda7d89d046f58e4e3e893a362e174dbd7f403 | Python | TrellixVulnTeam/allPythonPractice_R8XZ | /2019/05/0520多进程服务器/05-单进程非阻塞多客端server.py | UTF-8 | 744 | 3.140625 | 3 | [] | no_license | tcp_server_socket = socket(.....)
tcp_server_socket.setblocking(False) # 设置套接字为非阻塞的方式
client_socket_list = list()
while True:
try:
new_socket, new_addr = tcp_server_socket.accept()
except Exception as ret:
print('----没有新客户端到来----')
else:
print('----只要没有产生异常,那么就表示来了一个新客户端')
... | true |
3c9bab4ffcd9224fed8921e9a1a3c62452490dea | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_2/354.py | UTF-8 | 2,148 | 3.25 | 3 | [] | no_license | #!/usr/bin/python
import sys
def min_from_hm(hm):
h, m = hm.split(':')
return int(h) * 60 + int(m)
def first(arr):
if len(arr):
return arr[0]
else:
return 99999;
def calc_requirements(in_a, in_b, out_a, out_b):
req_a = 0
req_b = 0
cur_a = 0
cur_b = 0
while le... | true |
c26e4d8e0aee614c0c3a8a53aa7261ae932291b7 | Python | pauljxtan/imgtag | /imgtag/state.py | UTF-8 | 796 | 2.59375 | 3 | [
"MIT"
] | permissive | """Provides a class for storing and passing around globally shared state.
There should ideally be as little in this module as possible.
"""
from PySide2.QtCore import QStringListModel
from PySide2.QtWidgets import QCompleter
from .data import get_all_tags
class GlobalState(object):
"""Stores all global state n... | true |
def8acc5723f20722daa7bd54544aa800aa1b111 | Python | yangnaGitHub/LearningProcess | /python/pop3.py | UTF-8 | 463 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#Python内置一个poplib模块,实现了POP3协议,可以直接用来收邮件
#POP3协议收取的不是一个已经可以阅读的邮件本身,而是邮件的原始文本
#第一步:用poplib把邮件的原始文本下载到本地
#第二部:用email解析原始文本,还原为邮件对象
import poplib
email = input("Email: ")
password = input("Password: ")
pop3_server = input("POP3 server: ")
| true |
05972f0cd3102fcda53c5b65c2db9fa2e84bcb4f | Python | magiob/drln_tennis | /MaDDPG.py | UTF-8 | 4,444 | 2.984375 | 3 | [] | no_license | import numpy as np
import random
import copy
from collections import namedtuple, deque
from model import Actor, Critic
from DDPG_agent import Agent
import torch
import torch.nn.functional as F
import torch.optim as optim
BUFFER_SIZE = int(1e5) # replay buffer size
BATCH_SIZE = 512 # minibatch size
UPDATE_EVE... | true |
7cfe15f8aea63fde9abe3ea85d5bd940722f0d56 | Python | RAVIKANT431/dummy.project | /ravikant.py | UTF-8 | 379 | 3.875 | 4 | [] | no_license | num1= input("enter first value:" )
num2= input("enter second value:" )
num3= input("enter third value:" )
num1=float(num1)
num2=float(num2)
num3=float(num3)
def max_num(num1,num2,num3):
if num1>=num2 and num1>=num3:
return num1
elif num2>=num1 and num2>=num3:
return num2
else:... | true |
cc20de0fd27f9bcf8232eff2b5a26de830a2f670 | Python | statistics-exercises/hypothesis-testing-13 | /test_main.py | UTF-8 | 453 | 2.859375 | 3 | [] | no_license | import unittest
from main import *
class UnitTests(unittest.TestCase) :
def test_statPower(self) :
psi4 = scipy.stats.norm.ppf(0.05)
mdiff = 20 - sample
for i in range(10) :
xv = mdiff / ( 2 / np.sqrt(i+1) ) + psi4
myval = scipy.stats.norm.cdf(xv)
... | true |
dbdeee88b347899da91128207330bc4b3af2f893 | Python | eliben/code-for-blog | /2016/readline-samples/python/readline-complete-simple.py | UTF-8 | 1,073 | 3.296875 | 3 | [
"Unlicense",
"LicenseRef-scancode-public-domain"
] | permissive | # Simple completion with the readline module.
#
# Tested with Python 3.4
#
# Eli Bendersky [http://eli.thegreenplace.net]
# This code is in the public domain.
import readline
def make_completer(vocabulary):
def custom_complete(text, state):
# None is returned for the end of the completion session.
... | true |
6765b089aee26e37c9c4f2a4f3636cce9f2b8f19 | Python | kimmj8205/Python | /Study/countdown.py | UTF-8 | 157 | 3.34375 | 3 | [] | no_license | import time
def countdown(n):
while n>0:
print(n)
time.sleep(0.3)
n=n-1
print("Go !")
countdown(int(input("Insert sec. :")))
| true |
bdac38b8a12d14f54d3de45712f6e98aeb5a7502 | Python | roarkemc/StatTools | /stattools/optimization/base.py | UTF-8 | 468 | 2.984375 | 3 | [
"MIT"
] | permissive | """Defines the Optimizer abstract base class."""
import abc
class Optimizer(metaclass=abc.ABCMeta):
"""Abstract base class for function optimization.
Subclasses should have an `__init__` method which sets the optimzation
algorithm parameters and a `optimize` method that accepts an objective
function... | true |
b1408635522f1a4b6873c393f66fc73778f3bbaf | Python | MrKolbaskin/insurance_company | /interface/layouts/layout_main.py | UTF-8 | 2,816 | 2.515625 | 3 | [] | no_license | import PySimpleGUI as sg
from interface.contracts import contracts
COMPANY_INFO = '-COMPANY_INFO-'
LOGS = '-LOGS-'
CONTRACTS_INFO = '-CONTRACTS_INFO-'
CONTRACTS = '-CONTRACTS-'
CURRENT_DEMAND = '-CURRENT_DEMAND-'
buttons = [
[
sg.Button('Следующий месяц', button_color=('black', 'green'), size=(16, 1), f... | true |
a97dfb679136198d4895074771e8d04fa9f3edbc | Python | rosariomgomez/udacity_prog_foundations | /programming_foundations/lesson1/take_a_break.py | UTF-8 | 254 | 3.265625 | 3 | [] | no_license | import time
import webbrowser
num_breaks = 1
total_breaks = 3
print("This program started on "+ time.ctime())
while num_breaks <= total_breaks:
time.sleep(10)
webbrowser.open('http://www.youtube.com/watch?v=dQw4w9WgXcQ')
num_breaks = num_breaks + 1
| true |
c3f6ec6d42a0654aed417045691636bc1647416c | Python | HuDunYu/031902106 | /test.py | UTF-8 | 836 | 3.046875 | 3 | [] | no_license | import unittest
from function import edit_text, count_keyword, count_switch, count_if_else
with open("c.txt") as file_object:
read_lines = file_object.readlines()
lines = edit_text(read_lines)
class MyTestCase(unittest.TestCase):
def test_something1(self):
total_num = count_keyword(lines)
sel... | true |
b940173b53d8ba8585989fc7b5d9409018c49464 | Python | NeonNihon/Pynet | /Class1/exercise7.py | UTF-8 | 449 | 3.359375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import yaml
import json
def open_file(f):
with open(f, 'r') as e:
if 'yml' in f:
return yaml.load(e)
if 'json' in f:
return json.load(e)
def print_list(lst):
for word in lst:
print(word)
new_yaml = open_file('exercise6.yml')
new_json = ... | true |
b8bc78cf1050dda74d33c63d771fb8cf6eeac6f8 | Python | AnshChoudhary/ZIRA---The-Virual-Assistant | /lyrics finder.py | UTF-8 | 231 | 2.9375 | 3 | [
"MIT"
] | permissive | import webbrowser
a = input("Search for lyrics: ")
L = list(a)
i = 0
while i < len(L):
if L[i] == ' ':
L[i] = '%20'
i+= 1
searchTerm = ''.join(L)
webbrowser.open("https://genius.com/search?q="+searchTerm) | true |
fe9bf09fd3ea7d48fd662bae9eba7fa7db8c1817 | Python | Brewgarten/c4-utils | /c4/utils/command.py | UTF-8 | 6,323 | 2.921875 | 3 | [
"MIT"
] | permissive | """
Copyright (c) IBM 2015-2017. All Rights Reserved.
Project name: c4-utils
This project is licensed under the MIT License, see LICENSE
This library contains methods for executing commands, capturing their output
and raising exceptions accordingly.
Functionality
-------------
"""
import logging
import os
import shl... | true |
341053ae0faf77e62ec655c3f13736461b8ba723 | Python | Krasniy23/Hillel_Krasnoshchok | /Lesson_10/HW10_1.py | UTF-8 | 194 | 3.640625 | 4 | [] | no_license | file_name = input('Cоздать новый файл: ')
with open(file_name, 'w') as file:
while True:
s = input()
if s == '':
break
file.write(s + '\n') | true |
43b1ad0b09aace400da18d8cd4da55acd2096ac0 | Python | Mi7ai/EI1022 | /L2/L2Ex14.py | UTF-8 | 325 | 3.265625 | 3 | [] | no_license | from L2.L2Ex11 import first
from L2.L2Ex13 import take_while
def squares():
n=1
while True:
yield n*n
n +=1
def escapicua(n):
a = str(n)
b = a[::-1]
return a==b
a = first(100,squares())
b = take_while(lambda n: n<10 ,squares())
c = first(10, filter(escapicua,squares()))
print(list... | true |
7e6c76e9797b83bc3218479cab07df0ae10fa6ac | Python | godiatima/Gui_apps | /spinner_1.py | UTF-8 | 2,553 | 3.015625 | 3 | [] | no_license | import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib
class SpinnerWindow(Gtk.Window):
def __init__(self, *args, **kwargs):
Gtk.Window.__init__(self, title="Musify")
self.set_border_width(10)
mainBox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
self.add(mainBox)
sel... | true |
76d08bc5473701a91b53841e0bc93007fb414999 | Python | ChangMQ267/VOC2COCO | /findPhoto.py | UTF-8 | 1,343 | 2.59375 | 3 | [] | no_license | import os
import shutil
def findPhoto(PHOTOPATH, filename, SAVE_PATH):
filename_1 = str(filename).strip(".xml")
photourl = PHOTOPATH + filename_1 + ".jpg"
if (os.path.exists(photourl)):
shutil.move(photourl, SAVE_PATH)
else:
print(filename)
def findXML(PATH, XMLPATH):
i = 0
t... | true |
ec945b4e4ec4387e7486f2b473005fdcf83c7347 | Python | BIAOXYZ/variousCodes | /_CodeTopics/LeetCode/601-800/000738/000738.py | UTF-8 | 1,616 | 3.15625 | 3 | [] | no_license | class Solution(object):
def monotoneIncreasingDigits(self, N):
"""
:type N: int
:rtype: int
"""
def has_increasing_digits(N):
lis = int_to_list(N)
if lis == sorted(lis):
return True
return False
def int_to_list(N):
... | true |
696cfb1b8ff8333d5f89a1315b2b15a3d88b3d36 | Python | ergoregion/Rota-Program | /Rota_System/Appointments.py | UTF-8 | 2,006 | 2.640625 | 3 | [
"MIT"
] | permissive | __author__ = 'Neil Butcher'
from PyQt4.QtCore import pyqtSignal, QObject
class AppointmentAbstract(QObject):
changed = pyqtSignal()
def __init__(self, parent, role):
QObject.__init__(self, parent)
self.role = role
self._note = ''
self._disabled = False
@property
def ... | true |
a7481bf74f4228fe90435afecd4dd471ea705573 | Python | Fracappo87/ML | /logisticregression/test/test_mylogisticmodel.py | UTF-8 | 5,863 | 2.984375 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 13 18:23:38 2017
Author: Francesco Capponi <capponi.francesco87@gmail.com>
License: BSD 3 clause
"""
import unittest
import numpy as np
import numpy.testing as npt
from ..mylogisticmodel import MyLogisticRegressionClassifier
class MyLogisticModelClassifie... | true |
419a335aac1bb48636ae2ba54a383b77a41acf00 | Python | jamie-g/wardrobe-mix | /polyvore_main.py | UTF-8 | 1,969 | 2.609375 | 3 | [] | no_license | from random import choice
from flask import Flask, render_template, request
import polyvore
import os
app = Flask(__name__)
import logging
import requests
import google_scrape
logger = app.logger
GOOGLE_URL = "https://www.googleapis.com/shopping/search/v1/public/products?country=US"
GOOGLE_KEY = "AIzaSyDYSIyGTRNGRvv2X... | true |
ab07a78a7283a49a5575c5cc4b9062069c830664 | Python | trevorkt/learnpython | /MIT.OCW/ps1a.v2.py | UTF-8 | 352 | 3.78125 | 4 | [] | no_license | # Problem Set 1, Problem 1
# Trevor T
import math # for sqrt()
def isprime(x):
x = abs(int(x))
if x < 2:
return False
if x == 2:
return True
if (x/2)*2 == ((x*1.0)/2)*2:
return False
for div in range(3, int(math.sqrt(x)), 2):
if x % div == 0:
return False
return True
x = int(raw_input('Enter a posit... | true |
57c0764b33f8a8784d59334585693a0287b0b886 | Python | trams/top100movies | /test_application.py | UTF-8 | 596 | 2.65625 | 3 | [] | no_license | import application
state = application.State("test_data/movies.json")
def test_not_existing_one():
assert state.naive_get("abracadabra") == []
assert state.naive_get("abracadabra") == []
def test_empty_query():
assert state.naive_get("") == []
assert state.get("") == []
def test_si... | true |
40dc1b5c6b7b44aeb3da9248ea1558a0021982a0 | Python | dack/text-based-atk | /game/enemies.py | UTF-8 | 2,544 | 2.984375 | 3 | [
"MIT"
] | permissive | import random
class Enemy:
def __init__(self, name, hp, damage, critChance):
self.name = name
self.gf = bool(random.getrandbits(1))
self.sf = bool(random.getrandbits(1))
self.hp = hp
self.damage = damage + random.randint(1, 5) * critChance
self.critChance = critChanc... | true |
81e2623852489b20aa6c050c383013e02966fbc8 | Python | EduardoMSA/Proyectos_ISC_ITESM | /Programas Python/Password.py | UTF-8 | 492 | 3.359375 | 3 | [] | no_license |
# coding: utf-8
# In[ ]:
def Suffix(t,s):
if t==s[:len(t)]:
return True
return False
def Preffix(t,s):
if t==s[-len(t):]:
return True
return False
def Obelix(t,s):
obel=s[len(t):-len(t)]
if t in obel:
return True
return False
def Password(s):
for i in range(le... | true |