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 |
|---|---|---|---|---|---|---|---|---|---|---|
8ba296d678f7e0f60c229346d71a7eafede8476d | ExePtion31/PythonTIC | /seriesfactorial.py | UTF-8 | 1,142 | 4.625 | 5 | [] | no_license | '''Ejemplo operación con Factoriales'''
#Se crea la función factorial con un parametro
def factorial(numero):
if numero == 0:
mul=1
return mul
elif numero>0:
mul=1
for i in range(1,numero+1,1):
mul*=i
... | true |
b9f33e28e1ca0167d6e9b44230f03d773003021f | parth2608/NPTEL-Joy-of-computing-with-Python | /Linear_Search.py | UTF-8 | 393 | 3.84375 | 4 | [
"MIT"
] | permissive | def linear_search(n,x):
element=[]
for i in range(1,n+1):
element.append(i)
count=0
flag=0
for i in element:
count=count+1
if(i==x):
print("Yes! I have found my number at position:",str(i))
flag=1
break
if(flag==0):
... | true |
2a639790d66a75fdd5a94d55f4f805775965edee | Nova722/Python-Challenge | /Pypoll/PypollPandas.py | UTF-8 | 1,748 | 3.25 | 3 | [] | no_license | import numpy as np
import pandas as pd
import xlrd
import os
file = "C:/Users/chris/NUCHI201902DATA1/Homework/03-Python/Instructions/PyPoll/Resources/election_data.csv"
df = pd.read_csv(file) #name df
print(df)
##total number of votes
total = df['Voter ID'].count()
print(total) #3521001 total votes
... | true |
020e0c13bcfa096ed64293186f431cadd5a28065 | AmbroiseIdoine/graphs | /templatetags/define_action.py | UTF-8 | 595 | 2.53125 | 3 | [] | no_license | from django import template
import numpy as np
register = template.Library()
@register.filter_function
def order_by(queryset, args):
if queryset is None:
return None
args = [x.strip() for x in args.split(',')]
return queryset.order_by(*args)
@register.filter_function
def subtract(value,arg):
... | true |
f16289b5cb5d0ece5a20de13403728ec25fb158c | Arachnid/boneio | /examples/digitalRead.py | UTF-8 | 509 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | # digitalRead.py - Alexander Hiam - 2/2012
# USR3 LED mirrors GPIO1_6 until CTRL-C is pressed.
#
# This example is in the public domain
# Import boneio library:
from boneio import *
def main():
init()
# Set the GPIO pins:
USR3.output()
GPIO1_6.input()
try:
while True:
state = GPIO1_6.value
... | true |
3d1baa3590e77e7b84525e5f24e7e163c1e89b41 | edu-athensoft/ceit4101python | /stem1400_modules/module_10_gui/s03_mainwin/win_16_minimize_1.py | UTF-8 | 468 | 3.453125 | 3 | [] | no_license | """
minimize window
"""
import tkinter as tk
import time
root = tk.Tk()
root.title('Python GUI - Minimize window')
# set init size
w = 800
h = 450
root.geometry(f'{w}x{h}')
print(f'width={root.winfo_width()}, height={root.winfo_height()}')
root.update()
print(f'width={root.winfo_width()}, height={root.winfo_heigh... | true |
b81b3b5bf6313a165df194bf7e934cca5bea196d | saharshleo/Python-Lab-2nd-YEAR | /perfectSq.py | UTF-8 | 226 | 3.609375 | 4 | [] | no_license | import sys
x = int(sys.argv[1])
flag = False
if x ==1:
print("square of 1")
else:
for a in range(1,x//2 + 1,1):
if x/a == a:
flag = True
break
if flag == True:
print("square of", a)
else:
print("not a square")
| true |
22a3d04ef7f1276028eed4be393256305db1083c | DSeiferth/PK_Model | /pkmodel/tests/test_model.py | UTF-8 | 1,117 | 3.046875 | 3 | [
"MIT"
] | permissive | import unittest
import pkmodel as pk
class ModelTest(unittest.TestCase):
"""
Tests the :class:`Model` class.
"""
def test_create(self):
"""
Tests Model creation.
"""
model = pk.Model(Vc=2., Vps=[], Qps=[], CL=3.)
self.assertIsInstance(model, pk.Model)
se... | true |
8341c8afb0b5f1b937d1888957e9071b1aabcc84 | timlee1128/Keda-Library | /modules/bookCategory.py | UTF-8 | 1,149 | 2.8125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from DatabaseFactory import DatabaseFactory
class BookCategory:
def __init__(self):
df = DatabaseFactory()
self._db = df.connection()
def query_all(self):
query = "SELECT book_cate_id id, book_cate_name name FROM book_category ORDER BY id DESC"
return se... | true |
619c17df572540df1336a60ef662763a998d0b11 | mouroboros/python_exercises | /Primes/primes_setup.py | UTF-8 | 314 | 2.796875 | 3 | [] | no_license | import unittest
class next_primesTestCase(unittest.TestCase):
def test_is_five_prime(self):
self.assertTrue(is_prime(5))
def test_is_six_prime(self):
self.assertFalse(is_prime(6))
def test_next_prime_test(self):
self.assertEqual(next_prime(54),59)
unittest.main()
| true |
2f31476afcc5d0c1b8bf354f41607d4696bdd228 | tfjasper/Facial-Keypoints-Detection | /intro.py | UTF-8 | 2,377 | 3.1875 | 3 | [] | no_license | import csv, numpy as np
## Formal ETL:
# Extracting data out of the given zipped files:
csv_train = open('training.csv','rb')
train_csv = csv.reader(csv_train)
csv_test = open('test.csv','rb')
test_csv = csv.reader(csv_test)
print "Extraction is done!";
# Transforming extracted data:
testID = [];
testData = [];
tra... | true |
e3074292f81aab4743c523bd0ac87255df2468cc | skunz42/New-York-Shortest-Path | /src/Node.py | UTF-8 | 1,123 | 3.171875 | 3 | [] | no_license | import sys
class Node:
def __init__(self, name, lat, lng, pop, priority):
self.name = name
self.lat = lat
self.lng = lng
self.pop = pop
self.priority = priority
self.adjList = []
self.dist = float("inf") # dist from source
self.prev = None # predeces... | true |
a4616a4dd7d95b141e103e9df1d9b4361f5894ab | Kuanch/pyplayground | /algorithms/leetcode/125_valid_palindrome.py | UTF-8 | 516 | 3.90625 | 4 | [] | no_license | def isPalindrome(s: str) -> bool:
beg = 0
end = len(s) - 1
while beg <= end:
while not s[beg].isalnum() and beg < end:
beg += 1
while not s[end].isalnum() and beg < end:
end -= 1
if s[beg].lower() == s[end].lower():
beg += 1
end -= 1
... | true |
a2e91523364963a146a257771a0fbfa69219fb5b | leandroflima/Python | /medias.py | UTF-8 | 365 | 4.03125 | 4 | [] | no_license | nota1str = input("Digite a primeira nota: ")
nota2str = input("Digite a segunda nota: ")
nota3str = input("Digite a terceira nota: ")
nota4str = input("Digite a quarta nota: ")
nota1 = int(nota1str)
nota2 = int(nota2str)
nota3 = int(nota3str)
nota4 = int(nota4str)
media = (nota1 + nota2 + nota3 + nota4) / 4... | true |
3a27c70f296233e8a003c4c860612a8dac72dbd4 | b1ck0/python_coding_problems | /Sequences/010_minimum_swaps_to_sort.py | UTF-8 | 973 | 3.78125 | 4 | [] | no_license | def minimum_swaps(array: list) -> int:
value_map = [(array[index], index + 1) for index in range(len(array))]
misplaced_values = list(filter(lambda x: x[0] != x[1], value_map))
misplaced_values = list(map(lambda x: (x[0], x[1], x[0] - x[1]), misplaced_values))
if len(misplaced_values) == 0:
ret... | true |
d30622524134c680f0e00d3729a70684ab1e1c06 | skystone1000/Instagram-Follower-List-Script | /02 Unfollow/Learn/saving with file/instaBotFileSave.py | UTF-8 | 11,200 | 2.765625 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import pickle
from time import sleep, strftime
from random import randint
"""
Ref
Setting user profile
https://sqa.stackexchange.com/questions/15311/adding-user-data-dir-option-to-chromedriver-makes-it-not-work-a... | true |
798c44e9e7aaedf56f0f96ad6fce73af5def739f | baosun/Python_exercises | /06exercise.py | UTF-8 | 382 | 4.25 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 3 10:16:34 2016
@author: huiying
"""
# Ask the user for a string and print out whether this string is a palindrome
# or not.
user_input = input('Give me a string: ')
backwords = user_input[::-1]
if user_input == backwords:
print('This string is a pal... | true |
fd673d0651530d994d1b3bad444064306006ef2a | didappear/TestProject | /PythonPractice/day10-threads/CoroutineGevent.py | UTF-8 | 2,500 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
#-*- coding:utf-8 -*-
from greenlet import greenlet
import gevent
import time
# # greenlet基本使用:单线程内任务的直接切换
# def eat(name):
# print('%s is eating first' %name)
# g2.switch('amy')
# print('%s is eating second' %name)
# g2.switch()
#
# def play(name):
# print('%s is playing 1' %... | true |
01185880b9f8c9f4d7067331fe0a99b9cee3188d | SSouik/pyutil | /pyutil/iterators/merge.py | UTF-8 | 915 | 3.875 | 4 | [
"MIT"
] | permissive | """
Author Samuel Souik
License MIT.
merge.py
"""
def merge(*seqs):
"""
Description
----------
Create a generator that contains one instance of all values from the sequences.
Parameters
----------
*seqs : (list or tuple or set or string) - sequences to merge
Returns
----------
... | true |
9b357c9a2a0443181fdf876e8f1d2fec78813c2f | Aasthaengg/IBMdataset | /Python_codes/p02601/s074227932.py | UTF-8 | 229 | 3.25 | 3 | [] | no_license | # coding:utf-8
a, b, c = map(int, input().split())
k = int(input())
counter = 0
while a >= b:
counter += 1
b = b * 2
while b >= c:
counter += 1
c = c * 2
if counter <= k:
print('Yes')
else:
print('No')
| true |
5dee5140e3148c875fd7aeb21e1e321cb01a0096 | Kevinello/MySpider | /dangdang.py | UTF-8 | 1,312 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import requests
import re
import json
import io
import codecs
import sys
import datetime
reload(sys)
sys.setdefaultencoding('utf-8')
def request_douban(url):
try:
response = requests.get(url)
if response.status_code == 200:
return response.text
except req... | true |
527ada5da2fc4e978b8cfa4d94aea7b88a9d6ac4 | pengyuhou/git_test1 | /leetcode/151. 翻转字符串里的单词.py | UTF-8 | 566 | 3.703125 | 4 | [] | no_license | class Solution:
def reverseWords(self, s: str) -> str:
ret = []
index = 0
while index < len(s):
tmp = []
flag = False
while index < len(s) and s[index] != ' ':
tmp.append(s[index])
index += 1
flag = True
... | true |
626be4b443e6bd36689c6a9dbc60859067d84935 | mcjohnchristopher/Python_Samples | /Range.py | UTF-8 | 82 | 3.109375 | 3 | [
"CC0-1.0"
] | permissive | print range(4)
friends = [1,2,3]
print len(friends)
print range(len(friends))
| true |
407f565162a6ab0dcfaec26476bf6a14bc0ad309 | arminZolfaghari/req_DNS_server | /part3.py | UTF-8 | 5,446 | 2.734375 | 3 | [] | no_license | # part3
import binascii
import socket
from collections import OrderedDict
def create_socket():
created_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return created_socket
def send_udp_message(message, address, port):
message = message.replace(" ", "").replace("\n", "")
server_address = (... | true |
196512fc9698088125edbb16516e0d51179634ba | ammogcoder/cognitive-services-python-sdk-samples | /samples/language/text_analytics_samples.py | UTF-8 | 4,120 | 2.84375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import os
from azure.cognitiveservices.language.textanalytics import TextAnalyticsAPI
from msrest.authentication import CognitiveServicesCredentials
SUBSCRIPTION_KEY_ENV_NAME = "TEXTANALYTICS_SUBSCRIPTION_KEY"
TEXTANALYTICS_LOCATION = os.environ.get("TEXTANALYTICS_LOCATION", "westcentralus")
... | true |
42b9ff1c1b3329f17cac2331002fb20dcabd2e48 | ShuTing234/Shu-Ting | /TanShuTing.py | UTF-8 | 2,710 | 3.1875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 23 10:20:18 2020
@author: TANST
"""
#---------------------Question 1---------------------
import numpy as py
def calc(m,n, inp):
numbers = []
if m==1:
numbers= [1]*n
elif n==1:
numbers= list(range(1, m+1))
... | true |
7a37dcd1acd7782f28f1ffe209f9ce7750bbe6d4 | stealthycoin/LogistixMockup | /ResourceManager.py | UTF-8 | 4,418 | 2.890625 | 3 | [
"MIT"
] | permissive | import pygame
from Animation import *
import copy
import World
import HUD
import Sprite
import re
import copy
class ResourceManager:
def __init__(self):
"""constructor, makes empty dictionaries, and then calls functions to fill them"""
self.images={}
self.animations={}
self.loadIma... | true |
08710ef7150f0dba50ec61b0148136cba50359b3 | KevinShengKaifeng/computational-physics | /2.2/python/bisection_solve.py | UTF-8 | 642 | 3.40625 | 3 | [] | no_license | from math import log
import time
def bisection_solve(func, root_range, accuracy=1e-8):
a, b = root_range
if func(a) == 0:
return a
elif func(b) == 0:
return b
assert func(a)*func(b) < 0, "root range error!"
c = (a+b)/2
while b - c > accuracy:
if func(c) == ... | true |
73654e0dbb30ab04975d54b931513f1dc235270d | egedursun/computational_intelligence_project_1 | /Kodlar/Soru 3/GATravellingSalesmanProblem/Population.py | UTF-8 | 1,077 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
EGE DOĞAN DURSUN - 05170000006
CEM ÇORBACIOĞLU - 05130000242
EGE ÜNİVERSİTESİ
MÜHENDİSLİK FAKÜLTESİ
BİLGİSAYAR MÜHENDİSLİĞİ BÖLÜMÜ
2019-2020 BAHAR DÖNEMİ
İŞLEMSEL ZEKA VE DERİN ÖĞRENME DERSİ - CIDL2020-P1
PROJE 1 - SORU 3 - ALTERNATİF 3: GENETİK ALGORİTMALARLA TRAVEL... | true |
1d76efbc57cd14fd667c2a366bb314a693bb8ef4 | L200180096/Algostruk_D | /Modul_7/nomor3.py | UTF-8 | 199 | 2.921875 | 3 | [] | no_license |
import re
##Nomor 3
f=open('indonesia.txt', 'r', encoding='latin1')
teks= f.read()
f.close()
pola2= r'di \w+'
tampilan2=re.findall(pola2,teks)
print(tampilan2)
print('\n\n')
| true |
75ba625ebd5b292861ae70a36b81d96e93fe64de | GioGiglio/gSuite | /calendar/event.py | UTF-8 | 5,816 | 3.109375 | 3 | [
"MIT"
] | permissive | import utils
import rrule
from date import Date, TZ
from datetime import datetime, timedelta
class Event:
'''The event object'''
def __init__(self,summary,description, start, end, location, recurrence, attendees):
self.summary = summary
self.location = location
self.description = descri... | true |
294f8d58a060392fa24a5cdf65997149f2e88364 | jskd/ProgComp | /defis/1/la_prosperite_des_charlatans/web_app/controllers/Base.py | UTF-8 | 3,303 | 2.515625 | 3 | [] | no_license | import inspect, sqlite3
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
from site_config import site_config
DB_PATH = "data/database.db"
class BaseController:
def get_template(self, caller_name):
template = None
try:
class_name = self.__class__.__name__.replace('Cont... | true |
09a1cb62d03a0077e14e01c0dbd49e23d1d6a53a | neuroforgede/intern_mask_detection | /utils/drawing_utils.py | UTF-8 | 1,596 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import tensorflow as tf
from PIL import ImageDraw
import os
def draw_parameter():
parameter = {"use_rnd_color": False,
"default_color_0": (0, 255, 0),
"default_color_1": (255, 0, 0)}
return parameter
def draw_all_pictures_of_one_batch(step, batch_size, output_dir, array_of_... | true |
6ce90dfbdae133e633bf1ebd9545cb4fe0c2a766 | EricSchles/humanTraffickingTalk | /Code_v0_3/phoenix/phone_analysis.py | UTF-8 | 3,353 | 2.796875 | 3 | [] | no_license | import re
import os
from subprocess import *
import glob
def digit_grab(body):
#there are a few distinct obfuscation patterns:
#one: numbers interlaced in the text
phone_number = []
for i in body:
if i.isdigit():
phone_number.append(i)
if len(phone_number) == 9 or len(phone... | true |
ffa0bc51f19bd3f055087d4770aa843fcd650cac | abkaya/II-Ambient-Intelligence- | /test_run_projects/pyd7a-master/examples/Localization/pymongoAmbient.py | UTF-8 | 671 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive |
from pymongo import MongoClient
#Connect to MongoDB
# client = MongoClient('localhost', 27017)
client = MongoClient('127.0.0.1', 27017)
db = client['Ambient']
collection = db['V-blok']
#JSON to insert
toInsert = {
"room_name":"V315",
"room_id":"10",
"message": "Hi this is a test for ambient!"
}
#Add our... | true |
ce8635b774494101af4c7c357e023b2bb5a702de | abhinavkashyap/sciwing | /sciwing/data/sciwing_data_loader.py | UTF-8 | 1,172 | 2.609375 | 3 | [
"MIT"
] | permissive | from torch.utils.data.dataloader import DataLoader
class SciwingDataLoader(DataLoader):
def __init__(
self,
dataset,
batch_size=1,
shuffle=False,
sampler=None,
batch_sampler=None,
num_workers=8,
drop_last=False,
timeout=0,
worker_init... | true |
150b65da0c2b3c2bed83ecec74b9c0e7a2e0c199 | nikoulis/ABM | /simple.py | UTF-8 | 4,462 | 3.09375 | 3 | [] | no_license | from __future__ import print_function
from agent import *
from event import *
#-----------------------------------------------------------
# A simple moving average model; this is simply a shell,
# most of the fuctionality is in SimpleModelAgentComm below
#-----------------------------------------------------------
cl... | true |
2487489eb4f18144c3a4835a2b3e0087f5e92263 | martinbergpetersen/Ai2-Project | /src/extract_frames.py | UTF-8 | 812 | 2.625 | 3 | [] | no_license | """
NOTE : this is a toy script just for running quick experiments
"""
import spacy
import os
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import json
json_path = "../data/json/"
frames = {}
for filename in os.listdir(json_path) :
if filename.endswith(".json") :
output = json... | true |
1d041c07b860038c3c6f69f59d2b9162035b4988 | olive-gusta/AdventureTextGame | /adventureScratch.py | UTF-8 | 3,276 | 3.234375 | 3 | [] | no_license | import comandos as com
import numpy as np
arquivo = np.genfromtxt("cenas.txt", delimiter=";", comments="#", dtype=[ ('id',int),
('Text', "|U2400"),
('N',int),
... | true |
1499eb3ad2140c715636acecb933d69dc2502c2d | lheumell/python-mqtt-flask-iot | /flaskServer/methods.py | UTF-8 | 799 | 2.671875 | 3 | [] | no_license | import sqlite3
def temperatures():
con = sqlite3.connect("../BDD/IOT.sqlite")
con.row_factory = sqlite3.Row
cur = con.cursor()
cur.execute("select * from temperature")
return cur.fetchall();
def temperaturesValue():
data = []
con = sqlite3.connect("../BDD/IOT.sqlite")
con.row_factor... | true |
c79456c6a425afabd4451507d1573eea88ea71ea | nfatkhiyev/Harold | /LIGHT_BAR.py | UTF-8 | 817 | 3 | 3 | [] | no_license | import time
import RPi.GPIO as GPIO
import random
RED_GPIO = 17
GREEN_GPIO = 22
BLUE_GPIO = 27
def setup_light_bar_gpio():
GPIO.setmode(GPIO.BCM)
GPIO.setup(RED_GPIO, GPIO.OUT)
GPIO.setup(GREEN_GPIO, GPIO.OUT)
GPIO.setup(BLUE_GPIO, GPIO.OUT)
GPIO.output(RED_GPIO, GPIO.LOW)
GPIO.output(GREEN_... | true |
29479304f5accd3014025df12176721b9fb8f73e | SpeedyCoder/machineLearning | /practical4v2.py | UTF-8 | 10,016 | 2.515625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
from scipy import stats
from time import time
# TODO:
# - add attention
# - make predictions faster
class Config(object):
"""docstring for Config"""
def __init__(self, data):
self.learning_rate = 1.0
self.lr_decay = 1 / 1.15
self.max_gra... | true |
3d7b41b40b3b52dccfff68735ab10da09115a987 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2914/47920/279636.py | UTF-8 | 802 | 3.0625 | 3 | [] | no_license | temp = []
n = int(input())
for i in range(n):
length = int(input())
inp1 = input().split(' ')
inp2 = input().split(' ')
if(length==0):
if(inp1[0] > inp2[0]):
print("NO")
else:
print("YES")
else:
for i in range(length):
temp.append(int(inp2[... | true |
fbbfdf79a325da077b9788ff07959d06f2139a8e | guoger/kattis | /listgame/prime.py | UTF-8 | 445 | 3.609375 | 4 | [] | no_license | import sys
def check_prime(n):
d = 2
while d*d <= n:
if n % d == 0:
return False
else:
d += 1
return True
def prime_list(n):
print "check out number from 1 to " + `n`
prime_list = []
for i in xrange(2,n):
if check_prime(i):
prime_list... | true |
6462ab4b4358a15e1e6770b3db465b5089354514 | kostapanfilov/book_parser | /parimatch_parser.py | UTF-8 | 3,359 | 2.671875 | 3 | [] | no_license | from .base_parser import BaseParser
import time
from bs4 import BeautifulSoup
import re
class ParimatchParser(BaseParser):
__main_urls = ['https://pm-290.info/']
__hockey_buttons = ["КХЛ. Статистика", "NHL. Статистика матча. Броски в створ ворот", "NHL. Статистика матча"]
__prefix_dict = {"SOT": ["бр.в створ"], ... | true |
fa241886680a953c71ea6e679289faba305202b9 | simpa2k/mysql_reader | /generators/php/PhpBaseControllerGenerator.py | UTF-8 | 575 | 2.515625 | 3 | [] | no_license | import os
from generators.Generator import Generator
class PhpBaseControllerGenerator(Generator):
def __init__(self, output_directory):
super().__init__(output_directory)
def generate(self):
with open('generators/php/templates/base_controller_template.txt') as base_controller_template:
... | true |
bb2bf676cddad32df6573bf40f04504cb5221aef | santiagortiiz/Biosenales | /Practicas de Laboratorio/2 Señales y Sistemas Discretos/Quiz 1 señales discretas.py | UTF-8 | 3,577 | 3.625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Editor de Spyder
Este es un archivo temporal
"""
import numpy as np;
import matplotlib.pyplot as plt;
'''
Corrección: Funcion para igualar tamaños de muestreo y operar funciones
'''
def IgualarVectores(origen1,vector1,origen2,vector2):
" Inicialmente se crean los vectores ... | true |
e1695d6bd7fc12920654745fe40a084859afc348 | Sarthak-Chatterjee/Space-Invader | /main.py | UTF-8 | 19,704 | 2.609375 | 3 | [] | no_license | # imports
import random
import pygame
from pygame import mixer
# init
pygame.init()
# window and screen
window = pygame.display
window.set_caption("Space Invader")
game_icon = pygame.image.load("sprites/images/logo.png")
window.set_icon(game_icon)
width, height = 600, 800
screen = window.set_mode((width, height))
ma... | true |
299d1a80cfa85ab629aac83b06d3504f1fb38ffd | petuum/medical_images | /models/model.py | UTF-8 | 18,765 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | from typing import Dict, Any
import torch
import torch.nn as nn
from texar.torch import ModuleBase, HParams
from texar.torch.losses import sequence_sparse_softmax_cross_entropy
from texar.torch.evals import corpus_bleu
from texar.torch.utils import strip_special_tokens
from texar.torch.data import Vocab
from models.c... | true |
d77ebfd12be9b5f78dbd80df27a766d6c17c06bb | erickmiller/AutomatousSourceCode | /AutonomousSourceCode/data/raw/squareroot/bce78319-7a1b-412d-be55-eb9d6950bb1c__PIECES___Probability.py | UTF-8 | 886 | 3.25 | 3 | [] | no_license | def PIECE___root_mean_square_error():
"""PIECE___root_mean_square_error:
ROOT_MEAN_SQUARE_ERROR = sum of squared differences between items in PREDICTED_OUTPUTS multi-dimensional
array and TARGET_OUTPUTS multi-dimensional array, divided by the number of cases, then square-rooted
"""
forwards... | true |
5d3dd85495bf5415203b4a3e767f1d800d6c0972 | anhnguyendepocen/100-pythonExercises | /4.py | UTF-8 | 118 | 3.765625 | 4 | [] | no_license | # Exercise No.4
# Fix the code so that it outputs 1 + 2
a = "1"
b = 2
# print(a + b)
# solution
print(int(a) + b)
| true |
1933e77ac9a34acfdb6de4420a965630419ec350 | Sasha-OS/QAlab6 | /main.py | UTF-8 | 1,091 | 2.53125 | 3 | [] | no_license | import pytest
from selenium import webdriver
import sys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from time import sleep
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
def test_lambdatest_... | true |
880628c84fe6d50220dd766af3972aac67bd1184 | LudvigE/GA_Neural_Network | /c4_functions.py | UTF-8 | 7,696 | 3.734375 | 4 | [] | no_license | import random
import numpy as np
class Board:
def __init__(self, board_columns=7, board_rows=6, pieces_in_row_to_win=4):
if board_rows > board_columns:
raise Exception(f"self.board_rows ({board_columns}) cannot be higher than self.board_columns ({board_columns})")
if pieces_in_... | true |
66b18be1e8023ddeceb3720b1fd3b13097333156 | parvatijay2901/FaceNet_FR | /facenet_pytorch/models/utils/example.py | UTF-8 | 1,952 | 2.609375 | 3 | [
"MIT"
] | permissive | import torch
from torch.utils.data import DataLoader
from torchvision import transforms, datasets
import numpy as np
import pandas as pd
# If running from the parent directory, the following can be changed to:
# from facenet_pytorch import MTCNN, InceptionResnetV1
from models.mtcnn import MTCNN
from model... | true |
3a68b144189ae8053d839d58187d303581329b42 | wwkimball/yamlpath | /yamlpath/merger/enums/outputdoctypes.py | UTF-8 | 1,905 | 3.28125 | 3 | [
"ISC"
] | permissive | """
Implements the OutputDocTypes enumeration.
Copyright 2020 William W. Kimball, Jr. MBA MSIS
"""
from enum import Enum, auto
from typing import List
class OutputDocTypes(Enum):
"""
Supported Output Document Types.
Options include:
`AUTO`
The output type is inferred from the first source d... | true |
ee26d01c672cf17d2ea60b560c68bb3500e529fc | seonuk/algorithm_python | /백준/3665.py | UTF-8 | 1,261 | 2.671875 | 3 | [] | no_license | from sys import stdin
from collections import deque
input = stdin.readline
t = int(input().rstrip())
for _ in range(t):
n = int(input().rstrip())
ranks = list(map(int, input().rstrip().split()))
pointer = [set() for _ in range(n + 1)]
indegree = [0 for _ in range(n + 1)]
for i, v in enumerate(r... | true |
c140413ff764a6d235ba003e848c5d42a62c5b3a | Jieand/capacity-firming-ro | /ro/ro_simulator_configuration.py | UTF-8 | 5,638 | 2.75 | 3 | [
"BSD-2-Clause"
] | permissive | # -*- coding: UTF-8 -*-
"""
Define the simulation parameters for the robust and deterministic algorithms.
"""
import numpy as np
import pandas as pd
# ------------------------------------------------------------------------------------------------------------------
# 1. PV configuration of the Uliège case study
PV_CA... | true |
d27582d102aec4ec9dab8f08a9acdbe12ab16f78 | lhmisho/jh | /johukum/templatetags/custom_tags.py | UTF-8 | 640 | 2.734375 | 3 | [] | no_license | from django import template
register = template.Library()
@register.filter()
def number_to_day(weekday):
weekday = int(weekday) % 7
if weekday < 0:
weekday = weekday * -1
if weekday == 0:
return "Monday"
if weekday == 1:
return "Tuesday"
if weekday == 2:
return "Wed... | true |
970c887e3ea80773445568a1cd1aa2d9084dc87c | ponbac/LEC-pickem | /parse/schedule_parser.py | UTF-8 | 2,384 | 3.40625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from model.match import Match
from model.pickem import Pickem
# Want to make class a singleton, but don't know how in Python
class ScheduleParser:
# Match id counter
match_counter = 0
# Get page and pass it to bs4
url = 'https://lol.gamepedia.com/EU_LCS/2... | true |
2da3a3a8d3ddd9f1a8d2a7cc12c855558e32ed7a | jbozas/events-scrapper | /scrappers/models.py | UTF-8 | 890 | 3.09375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
class Scrapper(object):
"""
Base class to each of the scrappers used.
@url: which page search for.
@headers: accept language.
@component: wich one is the HTML component that has the info.
"""
def __init__(self, url, cinema=None):
"""
... | true |
04fc0321e6780048a2056b060d286faba6ca3900 | RustyShackleford221/pentest | /web-tools/clone-ssl.py | UTF-8 | 7,401 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import argparse,OpenSSL,ssl,os,random;
"""
This script allows you to create a TLS certificate and key that mimics a target domain.
It will first create a CA similar to that of your target, and then use that to sign a second certificate.
Useful for things like web and mobile app pentesting. Inclu... | true |
9367fae186fd1b84cb78f72fee60232ebabeeeb4 | shapiran/PythonExamples | /TwoListsSort.py | UTF-8 | 359 | 3.4375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
list1 = [1, 2, 5, 4, 4, 3, 6]
list2 = [3, 2, 1, 2, 1, 7, 8]
list3 = list();
k = 0;
list1.sort()
list2.sort()
for i in list1:
while i > list2[k]:
list3.append(list2[k])
k = k + 1
list3.append(i)
while k < len(list2):
list3.append(list2[k])... | true |
069d0f875f2dae5505b06bbca20a1bb6d2a6b24d | giahienhoang99/C4T-BO4 | /session10/V.Dictionary - Delete/2.DeleteWithKeyFromInput.py | UTF-8 | 347 | 3.046875 | 3 | [] | no_license | profile = {
"name" : "Bui Minh vu",
"age" : 15,
"description" : "tml ",
}
print("Current profile :", profile)
while True :
a = input("Choose key to delete :")
if a not in profile :
print("Key not found or does not exist.Please re-enter.")
else :
break
del profile[a]
print("Updat... | true |
68bb787a93a631796b81ea41e1500a7f4238e9c2 | abhikrish06/PythonPractice | /HR/Twitter_Prime_In_Sbtree.py | UTF-8 | 1,892 | 3.25 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the primeQuery function below.
def sieveOfEratosthenes(n):
"""sieveOfEratosthenes(n): return the list of the primes < n."""
if n <= 2:
return []
sieve = list(range(3, n, 2))
top = len(sieve)
for si in siev... | true |
250be12e9fb3bb0dcd157269adbf75a1940c6255 | goyourway/lstm_docker | /src/wordcount.py | UTF-8 | 981 | 3.265625 | 3 | [] | no_license | import jieba
import pandas as pd
from collections import Counter
# 加载无意义词典
with open("./model/ignoreWords.txt") as f:
ignoreWords = [s[:-1] for s in f.readlines()]
ignoreWords += [" ", "\n", "\t"]
def split(data):
data['cut'] = data['comment'].apply(lambda x: [i for i in jieba.cut(x) if i not in ignoreWords])... | true |
540c141ac23838cb8421fff325fc67b709951661 | Jonathan2021/semantic_bikes | /bike/models/station.py | UTF-8 | 2,111 | 2.859375 | 3 | [] | no_license | from urllib.parse import quote
class Station:
def __init__(self):
self._name = None
self._id = None
self._lattitude = None
self._longitude = None
self._available = None
self._free = None
self._total = None
self._cardPaiement = None
def getNam... | true |
83092b9d341c6823d7e07d2391411cb8b83642b4 | t-young31/thesis | /4/figs/figX3/scripts_plots_data/garza_volume.py | UTF-8 | 801 | 2.703125 | 3 | [
"MIT"
] | permissive | import numpy as np
import autode as ade
from autode.atoms import get_vdw_radius
if __name__ == '__main__':
h2o = ade.Molecule(smiles='O')
coords = h2o.coordinates
centroid = np.average(coords, axis=0)
r_o = np.linalg.norm(coords[0] - centroid) + get_vdw_radius('O')
r_h = np.linalg.norm(coords[0] ... | true |
814b6d099721c3255144fcb7f1a5300bb596bd9e | github291406933/crawler | /firstLesson.py | UTF-8 | 2,733 | 2.625 | 3 | [] | no_license | from urllib import request, parse, error
import re
import http.cookiejar
# 目的url,?代表页数
orderUrl = "http://www.qiushibaike.com/hot/page/?"
# 默认第一页
pageNum = 1
# 设置必要的Header
def getHeaders():
headers = {}
# headers['Host'] = r"www.qiushibaike.com"
# 很多网站都需要设置这样的header,以证明是浏览器发起的请求
headers[
'Use... | true |
d338be1c310da59aedfbc6936e08bfefddcfcbe3 | structuralbioinformatics/SPServer | /SBI/external/DSSP/DSSP.py | UTF-8 | 5,350 | 2.75 | 3 | [
"MIT"
] | permissive | '''
@file: DSSP.py
@author: Jaume Bonet
@mail: jaume.bonet@gmail.com
@date: 03/2013
@ [oliva's lab](http://sbi.imim.es)
@class: DSSP
'''
from SBI.data import aminoacids3to1 as a3to1
from SBI.data import aminoacids_surface as asurf
class DSSP(object):
'''
Stores a DSSP prediction for a single amino ... | true |
3203aed4e6af2087452c1eafe603085342b442bc | celtic108/fish | /gan_model.py | UTF-8 | 3,017 | 2.59375 | 3 | [] | no_license | #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# General adversarial network
# to create average images to
# subtract from the training
# images
#_________________________________
import tensorflow as tf
import numpy as np
import imagedataloadertiny as idl #contains get_dataset function
import time
from PIL import I... | true |
1989acdc15da2b110fcaa7e11673ea9fac29c9e2 | ejackson054/ancestry-from-rna-seq | /ancestry_pipeline_wrapper.py | UTF-8 | 1,343 | 2.890625 | 3 | [] | no_license | """Wrapper for ancestry_pipeline.py
Usage: python ancestry_pipeline_wrapper.py [meta] [locations] [main_dir]
[meta]: Tab separated file with at least two columns: 1) sample name, 2) cell type
[locations]: Tab-separated file with two columns: 1) sample name, 2) .fastq file location
[main_dir]: Base directory for all... | true |
4bf09ccd81f46e3db71ac3aad8a6416174485e74 | dec1conan/mechamicus | /functions/deck.py | UTF-8 | 2,150 | 3.125 | 3 | [] | no_license | from random import shuffle
from functions.subfunctions.split_file import split_file
NEW_DECK = split_file('standarddeck')
DECK_OF_MANY_THINGS = split_file('domt')
HARROW_DECK = split_file('harrowdeck')
def parse_deck_request(msg, thisdeck):
subcommand = ''
try:
trash, command, subcommand = str(msg.c... | true |
c937b214053f612b8def3303597cabb4733cc165 | henryz2000-stuycs/test | /introcs2/HW/henry.zheng_hw09.py | UTF-8 | 188 | 3 | 3 | [] | no_license | # Henry Zheng
# IntroCS2 pd8
# HW09 -- Name your creations
# 2016-03-04
pieceofcake = (3.0+4) / (7.0-2)
annoyingsqrt = (5**2 - 4.0/8) / (16 - 8 * 9 **(1.0/2))
fractals = (5.0/6) / (7 + 9.0/5)
| true |
19c9e1b7bf7605954ff0d393c2e165859df49b1f | theodortoma/Licenta | /utils.py | UTF-8 | 1,980 | 2.953125 | 3 | [] | no_license | import numpy as np
def compute_surface(bb):
return (bb[2] - bb[0]) * (bb[3] - bb[1])
#(xmin, ymin, xmax, ymax)
def compute_IOU(bb1, bb2):
xmin_int = max(bb1[0], bb2[0])
ymin_int = max(bb1[1], bb2[1])
xmax_int = min(bb1[2], bb2[2])
ymax_int = min(bb1[3], bb2[3])
if (xmax_int <= xmin_int) or (ymax_int <= ymin_in... | true |
a4a51b4656862b9a7cd099ad98466dd3078b25a2 | Aasthaengg/IBMdataset | /Python_codes/p03994/s245417790.py | UTF-8 | 371 | 2.734375 | 3 | [] | no_license | s = str(input())
k = int(input())
n = len(s)
l = [0]*n
for i in range(n):
l[i] = ord('z') -ord(s[i]) + 1
l[i] %= 26
#print(l)
ans = list(s)
i = 0
while k > 0:
if i > n-1:
break
if l[i] <= k:
ans[i] = 'a'
k -= l[i]
i += 1
k %= 26
if k > 0:
ans[-1] = chr((k + ord(ans[-1]... | true |
54a87f5d87d1c3af493561f8dd425543b2d6d75c | kesav02/DjangoDemoApp | /posts/models.py | UTF-8 | 992 | 2.53125 | 3 | [] | no_license | from django.db import models
from django.contrib.auth.models import User
class Post(models.Model):
title = models.CharField(max_length=200)
content = models.TextField()
user_posting = models.ForeignKey(User)
created_at = models.DateTimeField(auto_now_add=True)
def __unicode__(self):
return self.title
class ... | true |
170f60ea35a92adb5ab5ca034897e5218cf76a7a | jaehyeon98/ssafyStartcamp | /lotto.py | UTF-8 | 350 | 3.3125 | 3 | [] | no_license | import random
numbers = []
for i in range(1,46):
numbers.append(i)
lotto = random.sample(numbers,6)
print('이번주 로또의 예상 번호는 ', end="")
for i in lotto:
print(i, end=" ")
print("입니다.")
'''
li = [1, 2, 3]
# 리스트에서 2개 랜덤 추출(중복 허용)
# choiceLIst = [random.choice(li) for i in range(2)]
''' | true |
acc0691cb464f0989eec8b7edf3ad1fdfda1164f | crYamada/flask_sv | /backend/src/model/Status.py | UTF-8 | 775 | 2.875 | 3 | [] | no_license | # 0. NEW
# 1. ACTIVE
# 2. INACTIVE
# 3. DELETE
status_dict = {
'0':'NEW',
'1':'ACTIVE',
'2':'INACTIVE',
'3':'DELETE'
}
def getName(key, p_dict):
return p_dict.get(str(key), "ERROR")
def getStatusName(key):
return getName(str(key), status_dict)
def getKey(value, p_dict):
keys = [k for k, ... | true |
dc202863ef522f9d30fff39c93b82a66527dff4a | samuel871211/My-python-code | /codesignal/arrayReplace.py | UTF-8 | 109 | 3.203125 | 3 | [] | no_license | def arrayReplace(a,b,c):
for i in range(len(a)):
if a[i] == b:
a[i] = c
return a
| true |
c16282fb8fd3dc457b9db2e57cebc9b5c290ea5b | yaraya24/news_web_application | /news/management/commands/seed_initial_data.py | UTF-8 | 1,428 | 3.015625 | 3 | [] | no_license | from django.core.management.base import BaseCommand
from news.models import NewsOrganisation, Category
class Command(BaseCommand):
"""Class that will allow custom commands to populate the database using manage.py"""
help = """
Command that will seed the required intial data for
the ... | true |
c6e44d280bc45d232b56bf336165bd84206f93c3 | KyleCM2/Quantcast | /most_active_cookie.py | UTF-8 | 2,307 | 3.4375 | 3 | [] | no_license | #Kyle Choo Mang
#import for reading csv files and accessing cookies.csv
import os
import csv
import sys
#Checking if 4 arguments are giving
if (len(sys.argv) != 4):
raise Exception("You have input more or less than 4 command line arguments.This program takes 4 CLAs only. ")
#variables for accessing ... | true |
7a9ab78c190a542ab87f4f2f0c2bcfb030341fd4 | rebcabin/baselines | /seeker.py | UTF-8 | 6,929 | 2.65625 | 3 | [
"MIT"
] | permissive | import nengo
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy.spatial import distance
from collections import namedtuple as ntup
from multiprocessing import Pool
D_BALL_RADIUS = 1.0
def sample_d_ball(d=2, n=300):
return nengo.dists.get_samples(
nengo.dists.UniformHypersp... | true |
2c3268de13f1fb2e7cb8f265f61a1278fc9853f7 | mark-koren/AdaptiveStressTestingToolbox | /src/ast_toolbox/algos/go_explore.py | UTF-8 | 36,084 | 2.828125 | 3 | [
"MIT"
] | permissive | """Implementation of the `Go-Explore <https://arxiv.org/abs/1901.10995>`_ algorithm."""
import contextlib
import os
import pdb
import pickle
import shelve
import sys
import time
import numpy as np
from bsddb3 import db
from cached_property import cached_property
from dowel import logger
from dowel import tabular
from ... | true |
fb62c8954e4510c54c8e38b1a720107c39f2a968 | jason3189/Mr.zuo | /Mr.左/mothon02/代码/data_数据结构/day03/bitree_二叉树的遍历.py | UTF-8 | 2,135 | 4.5 | 4 | [] | no_license | """
二叉树的遍历
"""
from squeue_队列的顺序存储 import *
# 二叉树的结点类
class TreeNode:
def __init__(self, data=None, left=None, right=None):
self.data = data # 结点
self.left = left # 左子树
self.right = right # 右子树
# 二叉树类
class Bitree:
def __init__(self, root=None):
self.root = root # 获取起始的根
... | true |
df3546931deb82fc7f8a424b4c242b413396e208 | annazwiggelaar/LCPython_week3 | /3.4.4.8.py | UTF-8 | 688 | 3.609375 | 4 | [] | no_license | length_a = float(input("What is the length of side a?"))
length_b = float(input("What is the length of side b?"))
length_c = float(input("What is the length of side c?"))
compare_c_squared = (length_a ** 2) + (length_b ** 2)
c_squared = length_c ** 2
compare_b_squared = (length_a ** 2) + (length_c ** 2)
b_squ... | true |
20e4f2bffc2e1d8c8d17ca26feb7fa79dc27a914 | NeverMoes/practice | /tf/mnist/mnist_softmax.py | UTF-8 | 1,253 | 2.765625 | 3 | [] | no_license | # 导入mnist数据
import dataloader.path
from tensorflow.examples.tutorials.mnist import input_data
print(dataloader.path.MNIST)
mnist = input_data.read_data_sets(dataloader.path.MNIST, one_hot=True)
import tensorflow as tf
sess = tf.InteractiveSession()
# 数据输入设置
x = tf.placeholder("float", shape=[None, 784])
y_ = tf.p... | true |
697fadecaef8ab662c93305fc51155a50a32b1a2 | daevsikova/prod_hw2_trading_sessions | /preprocess.py | UTF-8 | 5,449 | 3.046875 | 3 | [] | no_license | import pandas as pd
import sqlite3
import numpy as np
def get_raw_data(path='data/trade_info.sqlite3'):
# reading data from database
con = sqlite3.connect(path)
data = pd.read_sql(
"""
SELECT * FROM Chart_data C
JOIN Trading_session T ON C.session_id=T.id
WHERE T.trading_t... | true |
dfcff1d92a781b5dd5e80646555ffc098aca8026 | Gporfs/Python-s-projects | /AULAS/isalgumacoisa.py | UTF-8 | 314 | 4.21875 | 4 | [] | no_license | n=input('digite algo:')
print('Pode-se dizer que esse algo é numérico?{}'.format(n.isnumeric()))
print('Pode-se dizer que esse algo é alfabetico?{}'.format(n.isalpha()))
print('Pode-se dizer que esse algo é alfa-numérico?{}'.format(n.isalnum()))
print('Está somente em maiúsculo?{}'.format(n.isupper())) | true |
fc547fee90e736dbd6519020ce795b5dce00a12c | DotPodcast/dpx | /server/dpx/helpers.py | UTF-8 | 1,297 | 2.59375 | 3 | [] | no_license | from base64 import b64encode
from hashlib import md5
from os import path
import random
import string
def create_slug(queryset, new, name=None, max_length=100):
from django.template.defaultfilters import slugify
from django.utils.timezone import now
from hashlib import md5
if name:
base = slug... | true |
b2b8de324c209bfa03bfd1b5a5a8d0d7d68f0f83 | Anjualbin/workdirectory | /OOP/inheritancewithconstructor.py | UTF-8 | 462 | 3.75 | 4 | [] | no_license | class Person:
def __init__(self,name,age):
self.name=name
self.age=age
def printval(self):
print("Nmae:",self.name,"age:",self.age)
class Student(Person):
def __init__(self,rollno,mark,name,age):
super().__init__(name,age)
self.rollno=rollno
self.mark=mark
... | true |
97ed55d11b58ad7a789d62133c2e37f96dbea9be | finkelsteinj/poker-ai | /Card.py | UTF-8 | 292 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | class Card:
def __init__(self, suit: str, id: str, value: int, state: int = 0): # state: 0 - inactive, 1 - in hand, 2 - on table
self.suit = suit
self.id = id
self.value = value
self.state = state
def toString(self):
return self.id + self.suit | true |
a9daedf0adcd5f7e3a10e9fcdf3208efc2a70382 | lazumbra/Coding-Questions | /LeetCode/count_primesV2.py | UTF-8 | 768 | 3.609375 | 4 | [] | no_license | #!/usr/bin/python3
import math
class Solution:
def isPrime(self, number):
if number % 2 == 0:
return False
for i in range(3, number, 2):
if number % i == 0:
return False
return True
def countPrimes(self, n):
listOfZeros = [... | true |
1d0cbc37df7fd3ea4c4268503b07f44d8de80988 | KristinaUlicna/CellComp | /Movie_Analysis_Pipeline/Single_Movie_Processing/B_Processor_TxtFile_RawToFiltered.py | UTF-8 | 2,403 | 3.140625 | 3 | [] | no_license | # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# ----- LineageTree : Raw TxtFile Processor ----- #
# #
# ----- Creator : Kristina ULICNA ----- #
# #
# ----- ... | true |
46a058494aa50090b4e90b5e6d89315505ed7cc4 | nathan29849/Like_Lion_9th | /session_4/coding_dojang/Unit25_딕셔너리_특정_값_삭제.py | UTF-8 | 464 | 3.3125 | 3 | [] | no_license | # 풀이 1
keys = input().split()
values = map(int, input().split())
x = dict(zip(keys, values))
x.pop('delta')
sample = []
for k, v in x.items():
if v == 30:
sample.append(k)
for i in sample:
x.pop(i)
print(x)
# 집합은 키를 변경할 수 없음
# iteration 도중 size가 바뀌어선 안됨
# value로 key 값을 찾아낼 수는 없음
# 풀이 2
del x['delta... | true |
af3e0ca476f1d8b608186e86bc09c69b2b02b6f6 | tkzilla/Classifier | /get_data.py | UTF-8 | 15,834 | 2.6875 | 3 | [] | no_license | """
Tektronix RSA API: Occupied Bandwidth and Peak Power
Author: Morgan Allison
Date created: 6/15
Date edited: 11/16
Windows 7 64-bit
RSA API version 3.9.0029
Python 3.5.2 64-bit (Anaconda 4.2.0)
NumPy 1.11.0, MatPlotLib 1.5.3
To get Anaconda: http://continuum.io/downloads
Anaconda includes NumPy and MatPlotLib
"""
f... | true |
201b689c3e7a02be32ec39f7a721ffd1fee80fbb | PaulJYim/Leetcode | /palindrome_linked_list.py | UTF-8 | 1,235 | 3.703125 | 4 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
cursor = head
prev = None
fast = head
slow = head
while(fast is not None and... | true |
5756669071b285f039ebb7d246e6c61cad10f1b6 | KetanSingh11/mqtt-empello-assignment | /publisher.py | UTF-8 | 1,606 | 2.671875 | 3 | [
"MIT"
] | permissive | ###!/usr/bin/env python3
import paho.mqtt.client as mqtt
from datetime import datetime
import time
import sys
# BROKER_HOST="localhost"
BROKER_HOST="test.mosquitto.org"
PORT=1883
KEEP_ALIVE=60
send_msg_count = 5
def create_connection():
"""
Establishes a connection to a broker
"""
client = mqtt.Clien... | true |
c1b0e2b0873eb797c6642ac67c053c2f680e80fa | AlexShein/just_code | /lock_manager.py | UTF-8 | 1,180 | 2.5625 | 3 | [] | no_license | import logging
from redis.exceptions import LockError
from redis.lock import Lock
from app.client.redis import redis_client
log = logging.getLogger(__name__)
class LockManager():
def __init__(self, lock_name, lock_timeout=10):
self.lock_name = lock_name
self.lock_timeout = lock_timeout
... | true |
2c0dca413cab0493995eba80995a4c2ca9c8fe7e | AayushQ/SampleRepo | /Day 2/vowel.py | UTF-8 | 186 | 3.9375 | 4 | [] | no_license | a = input("Input a letter of the alphabet: ")
word = a.lower()
first = word[0]
if len(a) > 0:
if first in 'aeiou':
print ("vowel")
else:
print("consonant")
else:
print("empty")
| true |
50be232e404d00cafc2bba281aabe759446d36e2 | zfhrp6/competitive-programming | /atcoder/caddi2018_b.py | UTF-8 | 376 | 3.25 | 3 | [] | no_license | class Plate:
def __init__(self, h, w):
self.h = h
self.w = w
def contains(self, plate):
return self.h >= plate.h and self.w >= plate.w
N, H, W = list(map(int, input().split()))
need_plate = Plate(H, W)
plates = []
ret = 0
for i in range(N):
if Plate(*list(map(int, input().split()... | true |