blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
d96138f55b11d44a0ecf31568bae31fcd3a97b0b | EscapeB/LeetCode | /3Sum.py | UTF-8 | 1,207 | 3.65625 | 4 | [] | no_license | # Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0?
#
# Find all unique triplets in the array which gives the sum of zero.
#
# Note:
#
# The solution set must not contain duplicate triplets.
#
# Example:
#
# Given array nums = [-1, 0, 1, 2, -1, -4],
#
# A solution set is:
# ... | true |
f3409cbb18971115915185525a3b406663fc296b | LookRain/CS4257 | /match_signature.py | UTF-8 | 2,043 | 2.71875 | 3 | [] | no_license | import os
import matplotlib.pyplot as plt
import numpy as np
features = []
for filename in os.listdir('./signatures/'):
if "DS" not in filename:
filepath = './signatures/' + filename
with open(filepath, 'r') as fp:
# print(filename)
file_out = open('./fingerprints/' + filename, 'w')
... | true |
4e495a66eaf1af78b17c23006ae465cc24d81f67 | samlet/stack | /sagas/tests/cli/plac_tool.py | UTF-8 | 548 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | from datetime import datetime
# ⊕ [plac.rst](http://micheles.github.io/plac/)
def main(dsn, table='product', today=datetime.today()):
"Do something on the database"
print(dsn, table, today)
def main_8(dsn, command: ("SQL query", 'option', 'c')='select * from table'):
print('executing %r on %s' % (command... | true |
6a399eb7c6f8da0d11c6db1458a2c2879a5451b0 | arkkawimba/Learning-Python | /Tic Tac Toe Game/TicTacToe.py | UTF-8 | 3,125 | 4.09375 | 4 | [] | no_license | def show_result(): #showing the current condition of the game board
print(result['TL'],' | ',result['TM'],' | ',result['TR'])
print('---|-----|---')
print(result['ML'],' | ',result['MM'],' | ',result['MR'])
print('---|-----|---')
print(result['BL'],' | ',result['BM'],' | ',result['BR'])
def show_ru... | true |
ae88e3b4cc6308731178906e844ec4571a3f1b77 | M-cube-wustl/Nanocrystals | /matdat.py | UTF-8 | 3,193 | 2.71875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def main():
plt.close('all')
# path to Results4Dong
#path = r'C:\Users\jcavi\Box Sync\Research\Rohan\Projects\Nanocrystals\MATDAT\Results4Dong'
path = #'your\path\here'
datadir = path+'\\Exchange_Density\\individual_data'
datapath = datad... | true |
780ba147bd326142d13c5f9bde9ee3819303c35c | kamojiro/atcoderall | /beginner/168/E.py | UTF-8 | 1,341 | 2.6875 | 3 | [] | no_license | import sys
input = sys.stdin.readline
Q = 10**9+7
from collections import defaultdict
from math import gcd
def main():
N = int( input())
AB = [ tuple( map( int, input().split())) for _ in range(N)]
d = defaultdict( int)
for a, b in AB:
if a == 0 and b == 0:
d[(0,0)] += 1
... | true |
fa550ecd4b8a3d43a5659868a0ae01493ce74f0f | cnu-cse-datacom/8-week-socketprogramming-koohogeun | /DC02_08_201502011_koohogeun_file_transfer_server_recv.py | UTF-8 | 1,060 | 2.796875 | 3 | [] | no_license | import socket
import os
import hashlib
if not os.path.isdir('received_data'):
os.mkdir('received_data')
server_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server_socket.bind(('',9000))
data, addr = server_socket.recvfrom(2000)
server_socket.sendto("name_received".encode(), addr)
print('file recv start fr... | true |
0a055d475722813798e60d9b2e9692cb4536bb54 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2897/58585/314685.py | UTF-8 | 157 | 2.84375 | 3 | [] | no_license | n=input()
if n=='["a","ab","abc","d","cd","bcd","abcd"]':
print(4)
elif n=='["abcw","baz","foo","bar","xtfn","abcdef"]':
print(16)
else:
print(0) | true |
67aee991fe5d461bc681af389096d5f6f278d43d | icoxfog417/aiocutter | /aiocutter/test/test_aiocutter.py | UTF-8 | 1,905 | 2.59375 | 3 | [
"MIT"
] | permissive | import unittest
import logging
from aiocutter import aiocutter
from aiocutter.test.news import BBCTopNews, BBCNews
from aiocutter.test.github_issue import GithubIssue
class TestAioCutter(unittest.TestCase):
def test_set_proxy(self):
# usual proxy
proxy = "http://proxy:8080"
cutter = aiocu... | true |
26e54d6488757cd59706f2874ed673351cdd2105 | jtornholm/Raspberry-Pi-Adafruit.IO-Interface | /TempHumidAdafruitIO.py | UTF-8 | 2,152 | 3 | 3 | [] | no_license | # SHT-30 Temperature/Humidity Sensor
# Sending Raspberry Pi senor data to Adafruit IO netork
# Receiving digital output from Adafriut IO
# By Jake Tornholm
# Williamsburg FLL November 2019
#import adafruit libraries
from Adafruit_IO import *
#Set Adafruit username and AIO key
aio = Client('', '')
digital = aio.feeds('... | true |
9dd7fa3c7272605f953a5afaf54919084469662a | panwarsandeep/LC | /lc_1042_flower_planting_with_no_adjacent.py | UTF-8 | 827 | 3 | 3 | [] | no_license | from collections import defaultdict
class Solution:
def gardenNoAdj(self, n, paths):
adj = defaultdict(list)
for p in paths:
adj[p[0]].append(p[1])
adj[p[1]].append(p[0])
flowers = [0]*(n + 1)
for v in range(1, n+1):
avl_flw = [4,3,2,1]
... | true |
e6e3af893670422563eb689f5164e966235d42a9 | summer-via/tools | /merge.py | UTF-8 | 491 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import sys
import math
def main():
try:
filenames,outputfile = sys.argv[1:-1],sys.argv[-1]
pass
except Exception as e:
print("merge <file1> <file2> ... <outputfile>")
raise e
if len(filenames)==0:
print("as least one inputfile")
sys.exit(-1)
fw = open(outputfile,'w'... | true |
05832ccc35e8e0a81e4dff048e7ff9b05a86a893 | Navypowder/MiDiPSA-for-non-stationary-streams | /Noiser/DiffPrivateNoiseGenerator.py | UTF-8 | 3,465 | 2.921875 | 3 | [] | no_license | from ANoiseGenerator import ANoiseGenerator
from Noiser.RangeEstimator.CategoricalRangeEstimator import CategoricalNoiseEstimator
from Noiser.RangeEstimator.LaplaceDomainRangeEstimator import LaplaceDomainNoiseEstimator
from Utils.ExceptionHandler import ExceptionHandler
from Utils.MetaUtils import MetaUtils
from Utils... | true |
2f0918d20bd6c6ffe35d9189b8ce38be1513d8e9 | Kif11/kk-starterapp | /model.py | UTF-8 | 1,626 | 2.90625 | 3 | [] | no_license | from PySide import QtGui, QtCore
class TableModel(QtCore.QAbstractTableModel):
def __init__(self, data, header=[], parent=None):
QtCore.QAbstractTableModel.__init__(self, parent)
self.data_list = data
self.header = header
def rowCount(self, parent):
if not self.data_list:
... | true |
48ca1252fab811200bb3b37ebb22487b67a20705 | adithyasreenath/Mini-Projects | /Computer Vision/Basic OpenCV/src/AS2.py | UTF-8 | 8,236 | 2.78125 | 3 | [] | no_license | import cv2
import os
from skimage import io, color
import numpy as np
from scipy import ndimage
from matplotlib import pyplot as plt
#Assignment 2
input_user=int(raw_input('Select \n 1:CAPTURE THE IMAGE \n 2:LOAD IMAGE \n'))
#Image Capture
if(input_user==1):
try:
os.remove("frame1.jpg")
except:
... | true |
ec23d111a27a5c86b3cffd24aa5da54a69d793f6 | earthly/example-plotting-precipitation | /plot-precipitation.py | UTF-8 | 3,326 | 3.296875 | 3 | [] | no_license | import math
import re
import os
import pandas
import datetime
import matplotlib.pyplot as plt
import matplotlib
import matplotlib.pyplot as plt
# Our new date parser
def yyyymmdd_parser(s):
return datetime.datetime.strptime(s, '%Y-%m-%d')
def get_data(weather_dir):
p = re.compile('victoria-weather-[0-9]+.csv'... | true |
c5135553f6b8b9c5aa70e80774cf2feb5c7520c5 | jjwon915/Python_Coding_Test | /Section4/창고정리.py | UTF-8 | 241 | 2.734375 | 3 | [] | no_license | # 창고정리
import sys
#sys.stdin = open("input.txt", "rt")
l = int(input())
a = list(map(int, input().split()))
m = int(input())
for i in range(m):
a.sort()
a[0] = a[0] + 1
a[l-1] = a[l-1] -1
a.sort()
print(a[l-1]-a[0]) | true |
87925a0b63fe617ff55d5ec71c1073e61c8de580 | Aasthaengg/IBMdataset | /Python_codes/p03523/s739971810.py | UTF-8 | 367 | 3.203125 | 3 | [] | no_license | s=input()
str=["A","K","I","H","A","B","A","R","A"]
count=0
ans=0
for i in range(9):
if count==len(s) and i<8:
ans=1
break
elif count==len(s):
break
if s[count]==str[i]:
count+=1
elif s[count]!=str[i] and str[i]!="A":
ans=1
break
if len(s)>9:
ans=1
if ... | true |
d05af723f3c2c0d1c60bb2bc7f4d05f551e6ccc9 | heavenshell/msgpack-rpc | /python/msgpackrpc/client/twisted/transport.py | UTF-8 | 5,985 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | import sys
import msgpack
from twisted.internet import protocol, reactor
__all__ = ['TCPTransport']
class TCPTransport(object):
"""
TCPTransport sends/receives the data, by using underlying socket layer.
Before sending the data, it serializes the data into MessagePack format.
As same, it deserializes... | true |
9b13ade226ea2527875c64820aebd93dc278a12d | smartguy-coder/Hillel_django_project | /hillel_django_projects/poll/management/commands/seed.py | UTF-8 | 1,317 | 2.875 | 3 | [] | no_license | import datetime
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from faker import Faker
from poll.models import Question
# имя файла является название команды
class Command(BaseCommand):
# Description of the command will be placed in parameter 'help'
help... | true |
517857ff11394d92cb3b768862769ccde9da193a | militoj/web-caesar | /caesar.py | UTF-8 | 865 | 3.96875 | 4 | [] | no_license |
def alphabet_position(letter):
lower_letter = letter.lower()
alphabet = ["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']
return alphabet.index(lower_letter)
def rotate_character(char, rot):
alphabet = ["a", "b", "c", "... | true |
bb4730dade919101cf7a33aa8a22583dd7728401 | Grooovy123/Project-Jenson | /Python Jenson assistant/Python Jenson assistant version 0.0.1.py | UTF-8 | 696 | 2.890625 | 3 | [] | no_license | import time
import os
import playsound
import speech_recognition as sr
from gtts import gTTS
def Speak(text):
tts = gTTS(text=text, lang='en')
filename = "voice.mp3"
tts.save(filename)
playsound.playsound(filename)
os.remove(filename)
def get_audio():
r = sr.Recognizer()
with sr.Microphone() as source:
aud... | true |
ff345d08ddefbecf879dee6c4cfe67f7851a0863 | erikbeebe/sample_flask_mongodb_docker | /app.py | UTF-8 | 1,437 | 2.75 | 3 | [] | no_license | ###---------------------------------------------------------------------------
### Simple Flask application to demonstrate plugging Flask into MongoDB via
### docker
###
### EMB 20151113
###---------------------------------------------------------------------------
import os
import pymongo
import ssl
import sys
fro... | true |
f12402e39828dc1b5dddba2ff19a575b24393c84 | cglewis/lim-cli | /lim/pcap/shift.py | UTF-8 | 5,500 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import arrow
import dpkt
import logging
import os
import textwrap
from cliff.command import Command
# TODO(dittrich): Make this a command line argument?
# Initialize a logger for this module.
logger = logging.getLogger(__name__)
class ... | true |
cf2475dfa604d7a55b56773566c120856e78aba7 | syurskyi/Python_Topics | /125_algorithms/_exercises/templates/_algorithms_challenges/pybites/advanced/281/test_sales.py | UTF-8 | 1,525 | 2.6875 | 3 | [] | no_license | _______ p.... __ pd
_______ p__
____ sales _______ get_data, process_data, summary_report, yearly_report, URL
?p__.f..(scope="function")
___ df
r.. process_data(URL)
___ test_data(df
... isi..(df, pd.DataFrame)
?p__.m__.p.(
"line, expected",
[
(0, "sum mean max"),
... | true |
d07a820d2e02db1e7210f92ce2b428cadee5d6c1 | pooja89299/if_else | /s.py | UTF-8 | 411 | 3.34375 | 3 | [] | no_license | # b=10
# if (b==10):
# if(b<15):
# print("b is smaller than 15")
# if (b <12):
# print("b is smaller than 12 too")
# else:
# print("b is greater than 15")
# d=20
# if (d ==10):
# print("d is 10")
# elif (d==15):
# print("d is 15")
# elif (d==20):
# print("... | true |
58133ff6210e5a1ce02800d23110851a4632c932 | hauzai/interfaceTest_git | /myrequest/myrequests.py | UTF-8 | 1,760 | 2.640625 | 3 | [] | no_license | import requests
from myrequest.myerror import ResponseError
class myrequests:
def __init__(self, method="GET", url="", **kwargs):
self.url = url
self.kwargs = kwargs
self.method = method
self.response = None
def __str__(self):
return "url:"+self.url+"\nmethod:"+self.me... | true |
30737f5a0b080f05116681dfb45ee24496631868 | vikasgaur31/PytestPythonBankAltoroMutual | /pageObjects/onlineTransferFundPage.py | UTF-8 | 3,810 | 2.953125 | 3 | [] | no_license | from datetime import date
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
class onlineTransferFundPage:
def __init__(self,driver):
self.driver = driver
btnBankTransfer = (By.XPATH, ("//*[@href='/bank/transfer.jsp']"))
txtMes... | true |
b8ae6cf0c845a40557060bfe21b7f7eaac9d6b4a | pauvrepetit/leetcode | /138/main.py | UTF-8 | 1,025 | 3.1875 | 3 | [
"MIT"
] | permissive | #
# @lc app=leetcode.cn id=138 lang=python3
#
# [138] 复制带随机指针的链表
#
from typing import Optional
# @lc code=start
# Definition for a Node.
class Node:
def __init__(self, x: int, next: 'Node' = None, random: 'Node' = None):
self.val = int(x)
self.next = next
self.random = random
class Solutio... | true |
8efff6e6c0b89d292154641aacb3c82ce62bab2e | KostadinHamanov/HackBG-Programming101-3 | /week01/3-The-Final-Round/group.py | UTF-8 | 556 | 3.515625 | 4 | [] | no_license | def take_same(items):
first = items[0]
n = len(items)
index = 1
result = [first]
while index < n and items[index] == first:
result.append(items[index])
index += 1
return result
def group(items):
result = []
while len(items) != 0:
current_group = take_same(ite... | true |
f88b6c22834900a4fb58e4ac2d30111f798d2fb7 | Aasthaengg/IBMdataset | /Python_codes/p03698/s782127450.py | UTF-8 | 151 | 3.375 | 3 | [] | no_license | s=input()
for i in range(len(s)):
for j in range(len(s)):
if s[i]==s[j] and i!=j:
print("no")
exit()
print("yes") | true |
80a608593f780e741a669bd287209a9af96ad2fb | Catriona-Smith/ICTPRG-Python | /# dice roll.py | UTF-8 | 370 | 3.90625 | 4 | [] | no_license | # dice roll
n = int(input ('How many times do you want the dice to roll? '))
a = []
c = 0
import random
while c < n:
c += 1
d = random.randint (1,6)
print (d)
b = input('would you like this number to be counted? (y/n) ')
if b == 'y':
a.append (d)
print ('the sum of the numbers is... | true |
edd8cbd6039f226f1a0fd0de179a6e487fc9c835 | skbly7/speechDataCollection | /source/week8/Voice Analysis/analysis.py | UTF-8 | 1,128 | 2.890625 | 3 | [] | no_license | import wave
import struct
import contextlib
fname = raw_input()
with contextlib.closing(wave.open(fname,'r')) as f:
frames = f.getnframes()
rate = f.getframerate()
duration = frames / float(rate)
duration1 = duration - 0.01
win= wave.open(fname, 'rb')
wout= wave.open('test2.wav', 'wb')
t0, t1= duration1, d... | true |
47a10b73da522de0e799f70582dfe462a427cf15 | RugeljGG/AdventOfCode | /2020/day23.py | UTF-8 | 3,052 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 23 05:59:01 2020
@author: gape
"""
import copy
from collections import Counter, defaultdict, deque
import re
import aoc_helper
#
data = aoc_helper.get_input(23, force=True).strip()
# data = aoc_helper.get_input(23).strip()
print('Day 23 input (first 10 lines):')
print(... | true |
b4786ff20371f9de3828ea60e97b129169812fcf | tamiryo/Shipping-System---Database-Assignment | /DAO.py | UTF-8 | 4,950 | 2.703125 | 3 | [] | no_license | import sqlite3
class _Vaccines:
def __init__(self, conn):
self._conn = conn
def insert(self, vaccine):
self._conn.execute("""
INSERT INTO vaccines (id, date, supplier, quantity) VALUES (?, ?, ?, ?)
""", [vaccine.get_id(), vaccine.get_date(), vaccine.get_supplier(), vaccine... | true |
5861babe4c5f71333ee24b57e65078c47b2bcaa1 | rwieckowski/project-euler-python | /euler465.py | UTF-8 | 1,372 | 3.515625 | 4 | [] | no_license | """
The <i>kernel</i> of a polygon is defined by the set of points from
which the entire polygons boundary is visible We define a <i>polar
polygon</i> as a polygon for which the origin is <u>strictly</u>
contained inside its kernel
For this problem a polygon can have collinear consecutive vertices
However a polygo... | true |
e7088d74ba873c18c0ca49814f7eee4a06730963 | ygqwan/yafblog-1 | /tests/test_search.py | UTF-8 | 1,957 | 2.671875 | 3 | [] | no_license | from yafblog.blog.models import Post, Tag
from yafblog.blog.views import search
from . import TestCase
class TestCaseSearch(TestCase):
def _add_green_posts(self):
p1 = Post(
title='Postgres is the new King',
slug='postgres-is-king',
content='Let Postgres rule througou... | true |
cb2b0dd075f8358f396c484c2e335fa95f2cdcbe | brunobenet8/Joguinho | /tabuada.py | UTF-8 | 248 | 3.671875 | 4 | [] | no_license | #faz o loop e imprime tabuada do 1 ao 9
for i in range(1,10):
print("---------Tabuada do {} ---------".format(i))
for j in range(1,11):
#imprime os numeros que serão multiplicados
print("{} x {} = {}".format(i,j,i*j))
| true |
f12d25cf9b342b4e0cb19a3e4203c5b130fae735 | LawLietzh/workspacePy | /py/py_lianxi/pythonLei.py | UTF-8 | 4,435 | 3.96875 | 4 | [] | no_license | #coding:utf-8
class Animal(object):
def run(self):
print('Animal is running...')
class Dog(Animal):
def run(self):
print('Dog is running...')
class Cat(object):
def run(self):
print('Cat is running...')
cat = Cat()
dog = Dog()
cat.run()
dog.run()
#使用type() 函数 来判断对象类型
type(123)
... | true |
6f7e9a381036ed9c18d4886f964752f02701b501 | dansgithubuser/dnd | /dnd/classes.py | UTF-8 | 33,290 | 2.671875 | 3 | [] | no_license | from . import base, items
def note_class(self, class_, level):
if not hasattr(self, 'classes'):
self.classes = []
self.classes.append((class_, level))
class _Progression:
def __init__(self, list, level):
import collections
self.x=collections.defaultdict(int)
for i in range(... | true |
fcd11bd95c852e4cc1bbd6c954f14a0c5048e6e8 | IgorCalbo/Python-studies | /ex022.py | UTF-8 | 318 | 4.375 | 4 | [] | no_license | # Separando dígitos de um número
nome = input("Digite seu nome completo: ")
print(f"O nome com todas letras maiúsculas: {nome.upper()}")
print(f"O nome com todas letras minúsculas: {nome.lower()}")
print(f"O nome tem {len(nome)- nome.count(' ')} letras")
print(f"O primeiro nome tem {len(nome.split()[0])} letras") | true |
30838f6c99e4fe8cb3c16fd3b658e26c056f71a4 | kivicode/Sketchbook | /Noder/Node.py | UTF-8 | 407 | 3.140625 | 3 | [] | no_license | import pygame as pg
class Node:
def __init__(self,base):
self.base = pg.Rect(base)
self.base.center = (base[0], base[1])
self.click = False
self.image = pg.Surface(self.base.size).convert()
self.image.fill((255,0,0))
def update(self,surface):
if self.click:
... | true |
d245ce9c31f43f16047139623b6730032d7456c1 | rafavg77/Scripts | /python/permutador.py | UTF-8 | 423 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
"""
Permutation Script by me lol
"""
from string import digits, ascii_uppercase, ascii_lowercase
from itertools import product
import base64
chars = ascii_uppercase
for n in range(3, 3 + 1):
for comb in product(chars, repeat=n):
permut = ''.join(comb)
print permut
p... | true |
8267aae76e336a3d413f88e3f7969f9ee5eb2c21 | christosalog/DFS-lineup-generator | /src/FeatureEngineering/feature_eng_functions.py | UTF-8 | 10,871 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 13 11:40:23 2020
@author: admin
"""
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
import numpy as np
from datetime import datetime
from tqdm import tqdm
from sklearn.preprocessing import LabelEncoder
'''Feature Engi... | true |
19d534168dcc322f02a013771af49b37ead95515 | Harvey1973/coding_questions | /stack_queue/trapping_rain_water_stack.py | UTF-8 | 1,488 | 3.546875 | 4 | [] | no_license | class Solution(object):
def trap(self, height):
"""
:type height: List[int]
:rtype: int
"""
stack = []
total_water = 0
n = len(height)
for i in range(n):
# the first condition indicates non-empty stack and the second condition implies
... | true |
5743db56e90987fe8ef8d66717473c3d03203991 | LNBaud/Pulseries | /app/forms.py | UTF-8 | 1,484 | 2.6875 | 3 | [] | no_license | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import DataRequired, Email, EqualTo, ValidationError
from app.models import User
#Formulaire de connexion
class LoginForm(FlaskForm):
username = StringField("Nom d'utilisateur", valida... | true |
6fc9a94d17abe76d5565c47ebc1b2af91a11c078 | tomviner/dojo-adventure-game | /characters.py | UTF-8 | 2,672 | 3.1875 | 3 | [
"MIT"
] | permissive | from adventurelib import Item, Bag, when
class Man(Item):
subject_pronoun = 'he'
object_pronoun = 'him'
class Woman(Item):
subject_pronoun = 'she'
object_pronoun = 'her'
dr_black = the_victim = Man('Dr. Black', 'Dr Black', 'the victim')
dr_black.def_name = 'the victim'
dr_black.description = """\
... | true |
dbb93a0811e76c046540b9aa7b8892e2c1d3625f | nsotiriou88/Python | /Training/Range lists_ Tuples and orders.py | UTF-8 | 1,285 | 3.984375 | 4 | [] | no_license | my_list = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]
my_iterator = iter(my_list)
# This creates an iterator for an iterable object and points at the memory location
for i in range(0, len(my_list)):
next_item = next(my_iterator)
print(next_item)
print("#####################... | true |
08273770032770a21c871f98638601ee3f684f13 | Sen2k9/Algorithm-and-Problem-Solving | /leetcode_problems/696_Count_Binary_Substrings.py | UTF-8 | 2,134 | 4.28125 | 4 | [] | no_license | """
Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings are grouped consecutively.
Substrings that occur multiple times are counted the number of times they occur.
Example 1:
Input: "00110011"
Output: 6
E... | true |
5ca9d0082567969ac7a464bfe45d65060dd1fd39 | russford/pdfscrape | /costreport.py | UTF-8 | 2,380 | 2.875 | 3 | [] | no_license | import pdfquery
import sqlite3
import glob
import Tkinter, tkFileDialog
def scrape_OPR800 (filename):
pdf = pdfquery.PDFQuery(filename)
pages = pdf.doc.catalog['Pages'].resolve()['Count']
print ("pdf has %d pages" % pages)
totals = []
date = None
for i in range((pages/10)+1):
try:
... | true |
3d05d12798598f3d640b837ae12068bbb710f3cb | dolefeast/ProjectEuler | /problem18.py | UTF-8 | 792 | 2.953125 | 3 | [] | no_license | from itertools import product
from time import sleep
def acumulate(tuple):
cont = 0
for i in tuple:
cont+=i
yield cont
piramid = """75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29... | true |
ce5280ea334aa13f937f4c63777e2e0db14222ef | mareliefi/code-wars | /move_zeros.py | UTF-8 | 250 | 3.359375 | 3 | [] | no_license | def move_zeros(array):
new_array = []
count = -1
for i in array:
if isinstance(i,str) == False and (str(i) == "0" or str(i) == "0.0"):
new_array.append(i)
else:
count += 1
new_array.insert(count,i)
return new_array
| true |
c33e8134dfcde8c74b612d5897b6d5e932f20dc4 | hicheng/ManBoker | /DailyDuty/AboutCommic.py | UTF-8 | 11,596 | 2.59375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import os
import unittest
from time import sleep
from selenium import webdriver
from appium import webdriver
from PublicResour import Desired_Capabilities, common, AppMethon
#Return ads path relative to this file not cwd
PATH = lambda p: os.path.abspath(
os.path.join(os.path.dirname(__file__... | true |
39f76e14a6b32e6beb9c115cd49c4220a5ce1e56 | SatishKohli18/SudokuSolver | /Sudoku.py | UTF-8 | 1,539 | 3.4375 | 3 | [] | no_license | class Solution(object):
def solveSudoku(self, board):
"""
:type board: List[List[str]]
:rtype: None Do not return anything, modify board in-place instead.
"""
row,col = -1,-1
for i in range(9):
for j in range(9):
if board[i][j] == ".":
... | true |
d1e584e5ec580ba2c46291de97e092a535b4a408 | amithk/cb-indexing-log-analysis | /scripts/sum_stat_for_all_indexes.py | UTF-8 | 1,101 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | import json
import sys
import os
def get_index_names_from_stats(stats):
index_names = {}
for k in stats:
if k.startswith(bucket):
iname = k.split(":")[-2]
if iname not in index_names:
index_names[iname] = True
return index_names.keys()
def run(filename, bucket, pstat):
f = open(filename, "r")
i = 0
... | true |
127c4da8891f1f4d3bdf9dffdf8cb6a33f469723 | ptmcg/littletable | /examples/fixed_width_demo.py | UTF-8 | 671 | 2.75 | 3 | [
"MIT"
] | permissive | import littletable as lt
data = """\
0010GEORGE JETSON 12345 SPACESHIP ST HOUSTON TX 4.9
0020WILE E COYOTE 312 ACME BLVD TUCSON AZ 7.3
0030FRED FLINTSTONE 246 GRANITE LANE BEDROCK CA 2.6
0040JONNY QUEST 31416 SCIENCE AVE PALO ALTO CA 8.1
"""
columns = [
("id_no",... | true |
ebe278e1d2859f22ca182c27825885fca712a7b2 | Tanner-York-Make-School/CS-1.1-Intro-to-Programming | /Projects/mad_lib/madlibs.py | UTF-8 | 5,528 | 3.3125 | 3 | [
"MIT"
] | permissive | from termcolor import colored
from os import system
import readline
import random
import re
class Mad_Lib:
def __init__(self, mad_lib = None, name = None):
self.name = name;
self.MAD_LIB = mad_lib
self.mad_lib = mad_lib
self.user_inputs = {}
# Check if user input is not... | true |
61ed748cce1e5b4cb963efc842c4370fa9425d8c | it-robot/robotic_arm | /Source/python_code/test-code/Mech_arm.py | UTF-8 | 3,950 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
from PCA9685 import PCA9685
from time import sleep
class Mech_arm:
stage_limit_up = 12.5
shoulder_limit_up = 12.5
elbow_limit_up = 12.5
wrist_limit_up = 12.5
stage_limit_down = 3.5
shoulder_limit_down = 3.5
elbow_limit_down = 3.5
wrist_limit_down ... | true |
75017882c636fe380def9cbc6373f60b276a7070 | yp000925/Holo_synthetic | /3d_helix_colorbar.py | UTF-8 | 4,767 | 2.5625 | 3 | [] | no_license | import matplotlib
import matplotlib.pyplot as plt
matplotlib.use('TkAgg')
import trackpy as tp
import pandas as pd
import numpy as np
import gradient as gd
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Line3DCollecti... | true |
559b20b606ea2f0b31e5cd0877d2e818d744cbd2 | oscstr-9/Datorspels-AI---S0006D | /Lab3/Main.py | UTF-8 | 5,833 | 2.9375 | 3 | [] | no_license | import Pygame
import FogOfWar
import Agents
import StateManager
import Map
import TimeMultiplier
import BaseManager
import Resources
import StatParser
import random
import copy
import time
agents = []
base = 0
# The main function. Initialises useful functions and adds important data to some arrays so the AI knows wha... | true |
807a6790ffa75d4401c0b3cdd70a6d8d9862ccb2 | pastikasatya/linierregresi | /SimpleLinearRegression.py | UTF-8 | 708 | 2.890625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
data = pd.DataFrame({
'Jam' : [2, 4, 5, 6, 7, 8, 9, 9, 12, 10],
'Skor' : [87, 36, 79, 90, 110, 98, 89, 82, 97, 76]
})
data
plt.scatter(data.Jam, data.Skor)
plt.title('Jam Ujian vs Hasil Ujian')
plt.xlabel('... | true |
e1a96cce007ce26816ea64d923be81dbf0644bd3 | gamorales/codigo | /curso/concurrente/process/9.-manager.py | UTF-8 | 977 | 3.03125 | 3 | [] | no_license | import time
import logging
import multiprocessing
logging.basicConfig(level=logging.DEBUG, format='%(processName)s %(message)s')
# Manager -> Namespace -> Contexto
def get_valor(namespace):
while namespace.codigofacilito is None:
time.sleep(0.5)
logging.info('codigofacilito no posee valor alguno!'... | true |
35552e899802a851fd4d1f4fec79606785f681cb | hasnatt/serverless_what3words | /location.py | UTF-8 | 1,838 | 3.078125 | 3 | [] | no_license | import requests
from geopy.geocoders import Nominatim, GoogleV3
import what3words
import json
import config
# get your key from https://developer.what3words.com/public-api
key = config.API_KEY
class Location:
def __init__(self, w1, w2,w3):
self.w1 = w1
self.w2 = w2
self.w3 = w... | true |
4392c850e5cae42f97c03e444144a2e7a122bb29 | Dewit11/MasterThesis-iML | /Backend/evaluation.py | UTF-8 | 4,341 | 2.625 | 3 | [] | no_license | from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.naive_bayes import GaussianNB
from sklearn import model_selection
from gensim.models.d... | true |
85c20b1a20523d6cda9f310c082d4a571c6d4a1e | DenisseGarnica/CodigoPython | /CodigoPractica/CodigoPython/hello.py | UTF-8 | 242 | 3.796875 | 4 | [] | no_license |
#Hola Mundo, mi primer programa
print("Hola Mundo xd")
x,y,name,is_cool = (1,2.5,'Chanchito', True)
a = x + y
print(x,y,name,is_cool,a)
print(type(x))
x = str(x)
y = int(y)
z = float(y)
print(type(y),y)
print(type(x),x)
print(type(z),z)
| true |
9a9b33e285cd04422da980427fb7e1a8180c15e7 | Mazziruso/Python-Dev | /Python-Practise/HalfSort.py | UTF-8 | 1,333 | 3.828125 | 4 | [] | no_license |
#二分法排序
def InsertIndex(Arr,start,end,K) :
#Search inset index of k in list Arr
while start < end :
middle_index = int((start + end)/2)
middle_data = Arr[middle_index]
if middle_data > K :
end = middle_index - 1
else :
start = middle_index + 1
return start
def InsertSort(Arr) :
#Insert sort alg... | true |
261eab8bdc0a01cd340ba10c0b427e97ab16f9be | ahandsel/yodaspeaktest | /testing.py | UTF-8 | 571 | 2.78125 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/env python3
"""
Do Yoda Speak
Takes text and converts it into something Yoda might say
"""
import requests
req = requests.request('GET', 'https://yoda.p.mashape.com/yoda?sentence=You+will+learn+how+to+speak+like+me+someday.++Oh+wait.',
headers={
"X-Mashape-Key": "Upi6oCn4eRmshBVdnoRikxZLfAqkp17iLW... | true |
72c022a5ff863c5516d965e44a538b2526e15fc5 | norawangyining/Algorithms | /Minimum spanning trees.py | UTF-8 | 2,930 | 3.234375 | 3 | [] | no_license | import random
from scipy.spatial import distance
from collections import defaultdict
import sys
n = [16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192]
def Edist(x1,y1,x2,y2):
a = (x1,y1)
b = (x2,y2)
edge = distance.euclidean(a, b)
return edge
class Graph():
def __init__(self, vertic... | true |
20af9b08a0f4a7c09057249217ae66f043e6c2d9 | xuweitj/Computer-VIsion-1 | /Lesson2/main.py | UTF-8 | 901 | 3.359375 | 3 | [] | no_license | import argparse
import cv2
ap = argparse.ArgumentParser()
ap.add_argument('-i', '--image', required=True, help='Path to image')
args = vars(ap.parse_args())
image = cv2.imread(args['image'])
(h, w) = image.shape[:2]
cv2.imshow("Lesson 2", image)
(b, g, r) = image[225, 111]
print(f'Pixel at [0, 0] is R: {r}, G: {g},... | true |
0ad9b335269e3c8b0a40b824eab5d0aeb4b6f438 | nanisaladi24/DataStructures | /Hashing/challenge3.py | UTF-8 | 1,186 | 3.484375 | 3 | [] | no_license | def findSymmetric(my_list):
dictionary = dict()
result = []
for i in range(len(my_list)):
first = my_list[i][0]
second = my_list[i][1]
#print first
#print second
if (first in dictionary.keys()) and (second not in dictionary.keys()):
dictionary[first].ap... | true |
3b7f0667072e08fece2fd419f9706d4af1066462 | pombreda/Law-Enforcement-Scripts | /pagefile_grep/pagefile_grep.py | UTF-8 | 2,119 | 2.890625 | 3 | [] | no_license | import re
import sys
import os
#@Title: PageFile Grep
#@Date: 06/06/12
#@Version: .1
#@Author: Loc
#@Description: Input a file of line delimited regular expressions to be found in a pagefile.
# Output 4K memory pages containing hits of the search term
# Create... | true |
d8a7504c75d5c4923c265906963bfb7284147581 | Udzu/pudzu | /dataviz/fotw.py | UTF-8 | 5,945 | 2.625 | 3 | [
"MIT"
] | permissive | import pandas as pd
from pudzu.pillar import *
from pathlib import Path
from tqdm import tqdm
BG = "#EEEEEE"
FOTW_DIR = Path("images")
class HeraldicPalette(metaclass=NamedPaletteMeta):
Y = "#fcdd09" # 0 yellow
W = "#ffffff" # 1 white
B = "#0f47af" # 2 blue
R = "#da121a" # 3 red
P = "#9116a1" # 4 ... | true |
cae926c1a30064f3caf4c284d075161c7c2b7a62 | hirani/pydec | /pydec/pydec/fem/innerproduct.py | UTF-8 | 7,709 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive |
__all__ = ['barycentric_gradients','whitney_innerproduct','regular_cube_innerproduct']
from scipy import matrix,sparse,zeros,ones,eye,allclose,alltrue, \
isreal,real,dot,concatenate,sqrt, \
arange,array,inner,vstack,atleast_2d,empty,tile, \
asarray,all,sum,hstack
from ... | true |
3043e8fd4fe61ec6200edb6ba9f8b9cd22ae1c3c | Rimon06/Invader-s-Tim | /GUI.py | UTF-8 | 2,269 | 3.171875 | 3 | [] | no_license | import pygame
import scene
import character
import media
class Table(object):
def __init__(self, player, x, y, w, h):
self.rect = pygame.Rect(x, y, w, h)
self.surface = pygame.Surface((w, h))
class pantalla(object):
def __init__(self, player, screen, grid):
self.player ... | true |
50bdadeb68b871a87e6494e9580de97ce1bf7f2c | Histocompitability/Day-22---Pong | /main.py | UTF-8 | 2,736 | 3.0625 | 3 | [] | no_license | from turtle import Screen
from score import Score, Game_Over_Message
from boundary import DotedLine
from platforms import Platform
from ball import Ball
import time
def left_up_dash():
for _ in range (5):
platform_player_left.move_up()
screen.update()
def left_down_dash():
for _ in range (5):
... | true |
0a0f294bcbad3c58c58054657a483ba436723311 | Kraxos/TR | /Raspberry 1 (Sensor)/file_blueServer.py | UTF-8 | 1,731 | 3.1875 | 3 | [] | no_license | # Transmite el archivo de vídeo al cliente de la Raspberry 2, que actúa como ordenador central
import bluetooth
import socket
import threading
import os
import sys
hostMACAddress = 'B8:27:EB:EC:06:47' # Dirección MAC del adaptador Bluetooth del servidor (Raspberry 1 - Sensor)
port = 3 # Puerto de transmisión
backlog =... | true |
f654b839919f7b3d61444364bd22ced8af424f01 | Zhengyu-Huang/1D-Porous-FIVER | /Structure.py | UTF-8 | 3,618 | 2.984375 | 3 | [] | no_license | import numpy as np
class Structure:
def __init__(self,ms, ks, L, mode, material):
'''
:param ms: structure mass
:param ks: structure stiffness, if the structure is modeled as piston-spring system $$ms \dot\dot{xs} + ks(xs - xs_0) = f(t) = p_B$$
:param mode: structure motion type. ... | true |
d0b31bc2a4b03d469338e5666f985ab29b83f461 | qazwsx92284/spartaCodingClub_webBootCamp | /projects/prac/app.py | UTF-8 | 852 | 2.6875 | 3 | [] | no_license | from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/test', methods=['GET'])
def test_get():
title_receive = request.args.get('title_give')
print(title_receive)
return jsonify({'result':'su... | true |
e2e09a8fc3f79ec51d98706e1c1ad2ade7d18ac1 | poponzu/atcoder1 | /atcoder/ABC/214/abc214b.py | UTF-8 | 203 | 3.203125 | 3 | [] | no_license | s, t = map(int,input().split())
cnt = 0
for a in range(101):
for b in range(101):
for c in range(101):
if a + b + c <= s and a * b * c <= t:
cnt += 1
print(cnt)
| true |
666411ac7160b6eb4b3fa2800ce2b4965f9e418a | CristianRodrigoGuarachiIbanez/iCubObjectCollisionSimulator | /DGP_iCubSimulator/tactil_perception_tracker.py | UTF-8 | 7,046 | 2.796875 | 3 | [] | no_license | """
Created on Fr Nov 6 2020
@author: Cristian Rodrigo Guarachi Ibanez
Tactil perception tracker
"""
import sys
import time
from typing import List, Tuple, Any, TypeVar
import numpy as np
import yarp
############ Import modules with specific functionalities ############
################ Import parameter from parame... | true |
118214e8398e2154844a73db792294b46df5ed8f | Dieterbe/projectfilter | /filters/authorfilter.py | UTF-8 | 764 | 2.546875 | 3 | [] | no_license | import os, re
from basefilter import BaseFilter
from lib.backend import debug, warning, critical, run_cmd
class AuthorFilter(BaseFilter):
""""
Match at least one commit for the given author. Only supports git.
"""
def __init__(self, src, expr):
BaseFilter.__init__(self,src)
self.expr... | true |
070010819627dadafec5b6d287b63cdeef7a59b4 | jk983294/CommonScript | /python3/structure/dict/DefaultDict.py | UTF-8 | 328 | 3.375 | 3 | [] | no_license | from collections import defaultdict
counter = defaultdict(int)
for letter in "An apple a day keeps the doctor away":
counter[letter] += 1
print(counter)
# defaultdict(<type 'int'>, {'A': 1, ' ': 7, 'c': 1, 'e': 4, 'd': 2, 'h': 1, 'k': 1,
# 'l': 1, 'o': 2, 'n': 1, 'p': 3, 's': 1, 'r': 1, 'a': 5, 'w': 1, 'y': 2, '... | true |
9179c1fbe0415a4a4fa17029c1592c183532d89a | Girin7716/PythonCoding | /BOJ/class4/1504.py | UTF-8 | 921 | 3.21875 | 3 | [] | no_license | # 특정한 최단 경로
import heapq
import sys
input = sys.stdin.readline
INF = int(1e9)
N, E = map(int,input().split())
graph = [[] for _ in range(N+1)]
for i in range(E):
a,b,c = map(int,input().split())
graph[a].append((b,c))
graph[b].append((a,c))
v1,v2 = map(int,input().split())
def dijkstra(start):
distan... | true |
ace5bff38e914450dec6ba6305bf44d1046847b6 | em-joseph/Tkinter-GUI-Calculator | /SuperCalculator.py | UTF-8 | 5,892 | 3.921875 | 4 | [] | no_license | import math
from tkinter import *
#CREATE THE BUTTON THAT CALCULATES THE DISTANCE
def Distance():
x1 = x1_entry.get()
y1 = y1_entry.get()
x2 = x2_entry.get()
y2 = y2_entry.get()
x1 = float(x1)
y1 = float(y1)
x2 = float(x2)
y2 = float(y2)
#DISTANCE FORMULA
dist = math.sqrt((x2-x... | true |
f9b5a25928feddff1e347ef60207bb4e76f87bab | IAmTomahawkx/math-parser | /mathparser/lex.py | UTF-8 | 2,882 | 2.6875 | 3 | [] | no_license | import re
from sly.lex import Lexer, Token
from .errors import UserInputError, TokenizedUserInputError
__all__ = "MathLexer", "ArgLexer"
def __token_eq(self, other):
return self.index == other.index
Token.__eq__ = __token_eq
# NoInspection PyUnresolvedReference
class MathLexer(Lexer):
tokens = {
FU... | true |
969574ecb0eee50bc2d07e1bc70f62c49602410a | annkeenan/news-reduce | /graph-scripts/single-graph.py | UTF-8 | 1,144 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python2.7
import matplotlib.pyplot as plt
import numpy as np
sorts = ('default','quick','merge','bst')
sizes = (125,174,256,268,400,470,492,502,528,1708)
colors = ('#ef3cc7','#36e5cf','#cd6df3','#0cde70')
all_benches = []
#with open('data/bench-memory.txt','r') as f:
with open('data/bench-time.txt','r'... | true |
6e4ef2ed58846950474494a0b5cb608dfac2f982 | DX-ZZ/218341 | /ch7/7-2.py | UTF-8 | 596 | 4.09375 | 4 | [] | no_license | # 7-1汽车租赁
car = input()
print("Let me see if I can find you a " + car + ".")
# 7-2餐馆定位
message = int(input("请问你们几位?"))
if message > 8:
print("sorry,8个人以上的位置没有了。")
elif message <= 0:
print("吃饭不能少于一人")
else:
print("还有位置,请坐。")
# 7-3 10的整倍数
number = int(input("随机输入一个数,这个数是否是10的整倍数"))
if number % 10 ==0:
prin... | true |
997b2c4b9b74d2e7c03cefd2dee103d619592388 | vikasmahato/Stock-Signal | /app/analyzers/informants/atr.py | UTF-8 | 1,698 | 3.28125 | 3 | [] | no_license | """
ATR Indicator
"""
import math
import numpy
import pandas
from analyzers.utils import IndicatorUtils
class Atr(IndicatorUtils):
def analyze(self, historical_data, n=14):
"""
Performs ATR (Average True Range) analysis on historical data.
This is a volatility based indicator and tries ... | true |
b489601ff8d5db6dc6313d32ea5e55fca3ab19f5 | jenniferdavid/taskallocation | /multihusky_simulator-master/multihusky_navigation/scripts/smach_polyfill.py | UTF-8 | 1,516 | 2.96875 | 3 | [] | no_license | from smach import CBInterface as SmachCBInterface
from smach import cb_interface as smach_cb_interface
class CBInterface(SmachCBInterface):
"""
Support for decorated methods (instead of pure functions) as callbacks. Takes care of binding the instance
to this object and passing it to the method as the self... | true |
2fc3f264535b5d6c4b4149ba5a15fe27d72b7d47 | Thru-Echoes/python-ds-hw6 | /static/py/bibUtil.py | UTF-8 | 5,075 | 2.96875 | 3 | [] | no_license | import bibtexparser
from bibtexparser.bparser import BibTexParser
from pprint import pprint
from functools import wraps
import pandas as pd
from bs4 import BeautifulSoup
from urllib.request import urlopen
import numpy as np
import sqlite3
import bibtexparser.customization as cus
import re
class sql_utl:
... | true |
2a340c9eeffbce8d0f35ee4b817e78b6a61088c0 | jgbmattos/python_currency_app | /backend/src/utils/helper_functions.py | UTF-8 | 909 | 2.921875 | 3 | [] | no_license | from decimal import Decimal, ROUND_UP
from json import JSONDecoder
from typing import Union
def round_value_up(value: Union[float, Decimal], decimals: int):
if not isinstance(value, Decimal):
value = Decimal(value)
return value.quantize(Decimal(f'0.{"0" * (decimals-1)}1'), rounding=ROUND_UP)
def tru... | true |
7da6b254ab6c47eef1e365ee9d3f91c1d1921c69 | kajetanschuler/discoverooData | /python/data_scripts/getBeachesForCity_OpenTripMap.py | UTF-8 | 13,099 | 2.96875 | 3 | [] | no_license | # Script that retrieves beaches for all cities in "allCities_clean.csv"
# Created - 16.02.2020 - by Kajetan
import csv
import requests
import json
import time
#initialize multiple times used variables and set inital value
radius=0
def main():
row_number = 1
# Open .csv file that contains all cities with a mi... | true |
c9bef911e8f53348adf1d39d27a7a3c9dfa23cd1 | dina-hertog/Picture | /picture.py | UTF-8 | 2,957 | 3.484375 | 3 | [
"MIT"
] | permissive | """
picture.py
Author: Dina
Credit: <list sources used, if any>
Assignment:
Use the ggame library to "paint" a graphical picture of something (e.g. a house, a face or landscape).
Use at least:
1. Three different Color objects.
2. Ten different Sprite objects.
3. One (or more) RectangleAsset objects.
4. One (or more)... | true |
cf252b82581b73a245d800cecac383e4eb03a6d7 | arnaldog12/deeplearning-from-scratch | /deepscratch/learning/losses.py | UTF-8 | 1,104 | 3.046875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | import numpy as np
class Loss(object):
def __init__(self):
pass
def __call__(self):
pass
def grads(self):
pass
class SquaredLoss(object):
def __init__(self):
pass
def __call__(self, pred, real):
return (1.0/2) * (1.0/len(pred)) * np.sum(np.power(rea... | true |
b0f0c503702cc725fb5117b9ceb7f0f4199aed45 | bach2o/NguyenNgocBach-fundamentals-c4e15 | /Session2/if_example.py | UTF-8 | 164 | 3.84375 | 4 | [] | no_license | yob=int(input("Your year of birth?"))
age = 2018-yob
print("Your age",age)
if age<18:
print("Baby")
elif age<10:
print("Teenager")
else:
print("Adult")
| true |
f8cda2880351f0b9b3ceaa368b750c7d494d9271 | borissova-e/decorators | /main.py | UTF-8 | 893 | 2.78125 | 3 | [] | no_license | import datetime
import hw_countries
def get_performance(path):
def decorator(old_function):
def new_function(input_file, output_file):
start = datetime.datetime.now()
result = old_function(input_file, output_file)
with open(path, 'a') as file:
file.writ... | true |
46ecb1779f88fc97b20acd06d59f292ee9163458 | rootid23/fft-py | /trie/prefix-and-suffix-search.py | UTF-8 | 3,274 | 4.28125 | 4 | [] | no_license | #Method 2
#Directly save the prefix and suffix combinations for a word, where the value is the weight. For
#a word such as 'bat', store all the prefix + suffix combinations in a dictionary, delimited by
#a non-alphabet character such as '.'. The delimiter is important so as to distinguish between
#prefix/suffix pairs t... | true |
78a7760fdf259445c86f1363ac70d5e9475a3852 | SuperIllu/AoE2DEUnitSpriteFaceAdder | /mainGui.py | UTF-8 | 1,962 | 2.5625 | 3 | [] | no_license | import tkinter as tk
import tkinter.ttk as ttk
from managers.persistenceManager import addPersistanceInterfaceToMenu
from fileSelectionTab.fileSelectionTab import FileSelectionTab
from modificationTab.modificationElement import ModificationElement
class AoeUnitGui:
def __init__(self):
self._buildUI()
... | true |
db01917bd6acdbbf31934dd2330d6381058201b0 | IrwinLai/LeetCode | /17. Letter Combinations of a Phone Number.py | UTF-8 | 525 | 3.3125 | 3 | [] | no_license | class Solution:
def letterCombinations(self, d: str) -> List[str]:
n = len(d)
res = []
if n == 0:
return res
dic = {"2":"abc", "3":"def", "4":"ghi", "5":"jkl", "6":"mno", "7":"pqrs", "8":"tuv", "9":"wxyz"}
def dfs(path,index):
if len(... | true |
4ba5f06ca1aff3ac428e2a752df2b9b4e1298276 | wiktorpp/snake | /snake.py | UTF-8 | 2,244 | 2.859375 | 3 | [] | no_license | import curses
from random import randint
graphicsDict = {
frozenset({ord("s"), ord("d")}): "╔",
frozenset({ord("s"), ord("a")}): "╗",
frozenset({ord("w"), ord("a")}): "╝",
frozenset({ord("w"), ord("d")}): "╚",
frozenset({ord("a"), ord("d")}): "═",
frozenset({ord("w"), ord("s")}): "║",
}
def ma... | true |