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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b067b03d0c05d9f84c455443240226322a4c4fc2 | Python | Marco2018/leetcode | /leetcode118.py | UTF-8 | 605 | 3.046875 | 3 | [] | no_license | class Solution:
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
if n==0:
return []
if n==1:
return [[1]]
if n==2:
return [[1],[1,1]]
res=[[1],[1,1]]
for i in range... | true |
adfbabd8b18733a9d3abaac1529231e37335f712 | Python | Trooper2123/logica_com_python | /python/lista1/circulo_esfera.py | UTF-8 | 121 | 3.578125 | 4 | [] | no_license | raio = float(input("Valor do raio:"))
print(f"Valor do raio:{3.14*raio**2}")
print(f"Valor da esfera:{4*3.14*raio**2}")
| true |
c612767fe49e3d5ca0368c1d7a27a93ce877d1a4 | Python | PatrickVienne/PythonAssessment | /questions/q5.py | UTF-8 | 1,200 | 3.828125 | 4 | [
"MIT"
] | permissive | #############################
# whats the difference (1)? #
#############################
a = (1, 2, 3, "12")
b = [1, 2, 3, "12"]
c = {1, 2, 3, "12"}
#############################
# whats the difference (2)? #
#############################
d = (a for a in range(10) if a % 2 == 0)
e = [a for a in range(10) if a % 2 ==... | true |
e97a7b44414244b0f22c7cb1efabeee4c09871c1 | Python | geekan/scrapy-general-spider | /misc/common.py | UTF-8 | 942 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive |
from collections import OrderedDict
from misc.log import *
# Make sure css rules have only one root.
def extract_items_from_list(list_item):
items = []
for k, v in list_item.items():
for d in v:
# print type(d), d
oi = OrderedDict(d).items()
# info(oi)
... | true |
46e2eee74a44ce1b41ae28a5876d621946ee48a0 | Python | veverkap/food_challenge | /meatsweatsweb/app/rectangle.py | UTF-8 | 537 | 3.953125 | 4 | [] | no_license | class Rectangle:
def __init__(self, pt1, pt2):
self.set_points(pt1, pt2)
def set_points(self, pt1, pt2):
(x1, y1) = pt1
(x2, y2) = pt2
self.left = min(x1, x2)
self.top = min(y1, y2)
self.right = max(x1, x2)
self.bottom = max(y1, y2)
def overlaps(self... | true |
5e301816fbd9f8356af3fc676d87cb4f51390e0b | Python | calebwhite0322/KultureKiwibot | /LikeBot.py | UTF-8 | 1,538 | 3.0625 | 3 | [] | no_license |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
class KultureBot:
def __init__(self, username, password):
self.username = username
self.password = password
self.bot = webdriver.Chrome(executable_path="C:\\chromedriver.exe")
def l... | true |
031b3ab4e443a19b25847ef8b05eab8ee014b293 | Python | barjinderpaul/Programming | /python/codewars.py | UTF-8 | 319 | 2.765625 | 3 | [] | no_license | def printer_error(s):
count = 0
for ch in s:
if ch in "nopqrstuvwxyz":
count+=1
#print("error_printers(s) => \""+str(count)+"/"+str(len(s))+"\"")
stringg = str(count)+"/"+str(len(s))
return stringg
print(printer_error("aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbmmmmmmmmmmmmmmmmmmmxyz")) | true |
a0073769067731e4dd2edebd6dd65ff7ee93a631 | Python | 100ideas/schema | /py/tests/test_code_parsing.py | UTF-8 | 10,849 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | import typing
from stencila.schema.code_parsing import CodeChunkParseResult, annotation_name_to_schema, CodeChunkParser
from stencila.schema.types import Variable, IntegerSchema, CodeChunk, Function, Parameter, SchemaTypes, StringSchema, \
BooleanSchema, NumberSchema, ArraySchema, TupleSchema
ASSIGNMENT_CODE = ""... | true |
210a97984b84cb6b7304a761dfebd9a23503d6de | Python | owkin/FLamby | /flamby/benchmarks/benchmark_utils.py | UTF-8 | 19,861 | 2.625 | 3 | [
"MIT"
] | permissive | import copy
import random
import time
import numpy as np
import pandas as pd
import torch
from opacus import PrivacyEngine
from torch.utils.data import DataLoader as dl
from tqdm import tqdm
from flamby.utils import evaluate_model_on_tests
def set_seed(seed):
"""Set numpy, python and torch seed.
Python seed... | true |
1ce97a3f2786eeac01f27e06a2388a02e13761f0 | Python | heliosPy/hrmanagement | /hrm/manager/utils.py | UTF-8 | 1,056 | 2.515625 | 3 | [] | no_license | from datetime import date
from django.shortcuts import redirect
from .models import RecuirtmentModel
from applicant.models import ApplicationFormModel
today = date.today()
def check_regestration_ends(x):
"""To check the id got from url
weather the object exist and if
exits its regestration should end""... | true |
8b650cdc7930b867a21cf93b676807a53e166804 | Python | zamfiralina/AuctioX | /Backend/Functions/login.py | UTF-8 | 1,335 | 2.984375 | 3 | [] | no_license | import time
from Backend.DBController.DBConnection import DBConnection
from Backend.Functions.unicodeHash import unicodeHash
def login(username: str, password: str, db_conn: DBConnection, activeUsers: dict) -> bytes :
"""
Checks the user id and SHA256 of the pw against the DB.
Adds the tuple... | true |
e5f995799f165483299864199ea79e83d54f8d55 | Python | ksjk2165/pythoSeleniummail | /energy.py | UTF-8 | 2,229 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python3
import sys
sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver')
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriv... | true |
1099f4c0626a57ee3844833f0ea03c2b0f2afac9 | Python | smohsinali/smac2JSON | /pjson.py | UTF-8 | 6,569 | 2.609375 | 3 | [] | no_license | from itertools import product
from ConfigSpace.configuration_space import ConfigurationSpace
from ConfigSpace.hyperparameters import CategoricalHyperparameter,NumericalHyperparameter, Constant, \
IntegerHyperparameter, NormalIntegerHyperparameter, NormalFloatHyperparameter
from ConfigSpace.conditions import EqualsC... | true |
1003f6ece2dcac0eb4bed09c253bc75889c5da6f | Python | LukeBluett/PasswordManager | /src/passwordmanager/main.py | UTF-8 | 1,781 | 3.5625 | 4 | [] | no_license | #!/usr/bin/env python3.4
from Account_Information import *
from Create_Password import *
from Database_Handler import *
def main():
title('* Password Manager *')
choice = option_selection()
password = get_password(choice)
account = raw_input('Enter in Account: ')
description = raw_input('Enter in De... | true |
53d3550b7116f08a52bbea60415e4306221dc17f | Python | hathas07/FUNS | /projet-CM-Etudiant.py | UTF-8 | 1,504 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 4 15:47:08 2019
@author: Hassen Drira
"""
from Shadock import Exemple
from Shadock import Diagonalisation
from Shadock import stationnaire
from Shadock import simulation
from Shadock import stochastique
from Shadock import puits
from Shadock impor... | true |
23579cc0635b01756dbcf5219935a7b5ea56e2ba | Python | konfer/PythonTrain | /src/train/test/ChangeAbleVariable.py | UTF-8 | 117 | 3.015625 | 3 | [] | no_license | #coding:utf-8
def foo(*a):
for i in a:
print i
foo(3,4,5)
b=("sss",78,"de",89)
foo(b)
foo(*b) | true |
0b234c30f9a2076f58c7e7f619a04e71da80e674 | Python | artcheng/eular | /39.py | UTF-8 | 342 | 2.96875 | 3 | [] | no_license | import math
from utility import *
ct = {}
for c in range(2, 1000):
for a in range (1, c):
b_sqr = (c+a)*(c-a)
if isSquare(b_sqr):
b = math.sqrt(b_sqr)
if b>=c:
continue
print a, b, c
cc = a+b+c
if cc < 1000:
ct[cc] = ct.get(cc, 0) +1
m = 0
cc = 0
for c in ct:
if ct[c] > m:
m = ct[c]
... | true |
f77f63652d5ccd8e0882d1be1f9bf5eaeb9423f5 | Python | zutmkr/Studia | /praca_inz/pole.py | UTF-8 | 267 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
class Pole:
def __init__(self,x,y,otwarty):
self.x = x #wiersz
self.y = y #kolumna
self.g = 0
self.h = 0
self.suma = 0
self.otwarty = otwarty
self.aktualny = False
| true |
c8aec8e03facae6a90861672cba01c261d1423d7 | Python | hhk86/Barra | /basic function/makeStkEX.py | UTF-8 | 2,991 | 2.828125 | 3 | [] | no_license | import cx_Oracle
import numpy as np
import pandas as pd
from makeTradeCalendar import getTradeCalendar
from makeDailyUniverse import makeDailyUniverse
class OracleSql(object):
'''
Oracle数据库数据访问
'''
def __init__(self):
'''
初始化数据库连接
'''
self.host, self.oracle_port = '1... | true |
b74a50fa64c76bbec1a3be7f5939f2714b3a14f3 | Python | EricWangyz/Exercises | /Exam4Job/shopee0215/ttttt.py | UTF-8 | 380 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/2/15 14:40
# @Author : Eric Wang
# @File : ttttt.py
import sys
# data = [1, 3, 5, 23, 67, 135, 456]
for line in sys.stdin:
size = len(line)
print(type(line))
line = line[1:size-2]
print(line)
... | true |
a037618f735a09aba7f2a0e31b4ca7524bb97e27 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_54/189.py | UTF-8 | 454 | 3.03125 | 3 | [] | no_license | #!/usr/bin/python
## Interpreter: Python 2.6.5
from fractions import gcd
T = int(raw_input())
for c in range(1, T + 1) :
args = raw_input().split()
N = int(args[0])
t = [ int(args[i + 1]) for i in range(N) ]
dt = [ abs(t[i + 1] - t[i]) for i in range(N - 1) ]
T = reduce(gcd, dt)
maxt = max(t)... | true |
54bcb74f77c6bbb0fd96c1653679a4659f08e5b6 | Python | didwns7347/algotest | /알고리즘문제/asdfasdfzcvzxcv.py | UTF-8 | 794 | 3.15625 | 3 | [] | no_license | import sys
from collections import deque
n,m,v=map(int,input().split())
checkb=[0 for x in range(n+1)]
checkd=[0 for x in range(n+1)]
g=[[] for _ in range(n+1)]
for x in range(m):
a,b=map(int,sys.stdin.readline().split())
g[a].append(b)
g[b].append(a)
for x in g:
x.sort()
out1=[v]
out2=[v]
checkd[v]=1
c... | true |
79bfb0503311e65264935909ca9eab4796635c39 | Python | rramr/fa-python | /4. OOP/Third tasks/Task 1.py | UTF-8 | 1,833 | 3.9375 | 4 | [] | no_license | class People:
def __init__(self, name, age) :
self.name = name
self.age = age
def __str__(self) :
return f'Имя: {self.name}, Возраст: {self.age}'
def info(self):
print (self.__class__.__name__ + ': ' + str(self))
class Worker(People):
def __init__(self, name, age, post... | true |
e1a5e5e06495eed0956688613d6d1e2714984dba | Python | rschroer/allhomeworks | /HW03/PyParagraph/main.py | UTF-8 | 803 | 3.96875 | 4 | [] | no_license | import os
import re
#user enters the file name
input_file=os.path.join("raw_data", input("Please type the filename in the raw data folder: "))
#initial variables
paragraph_text=""
words=[]
#read file
with open(input_file,"r") as paragraph:
paragraph_text=paragraph.read().replace('\n', ' ')
#split into sentences,... | true |
d56d392f2c834ddc00de8830a5520515c0c6f17d | Python | MiaoPaSiPython/LearnPython | /learn-python-code/books/简明Python教程/ds_reference.py | UTF-8 | 843 | 3.75 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/7/3 15:11
# @Author : yuhui.Mr
# @Email : 1299824045@qq.com
# @File : ds_reference.py
# @Software: PyCharm
print('Simple Assignment')
shoplist = ['apple', 'mango', 'carrot', 'banana']
# mylist 只是指向同一对象的另一种名称
mylist = shoplist
# 我购买了第一项项目,所以我将其从列表中删除
del shoplist[0]
print('shopl... | true |
9355993b20c99745cd8f849d6b382e619ebe0067 | Python | VanLiuZhi/tf_gpu | /to.py | UTF-8 | 1,384 | 3 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
with tf.device('/gpu:0'):
x = tf.placeholder(tf.float32, [None, 1])
W = tf.Variable(tf.zeros([1, 1]))
b = tf.Variable(tf.zeros([1]))
y = tf.matmul(x, W) + b
y_ = tf.placeholder(tf.float32, [None, 1])
cost = tf.reduce_sum(tf.pow((y_ - y), 2))
train_step... | true |
fcb7b52a6d0991f6fc14ffeda67d70db71bb04fd | Python | JhoanRodriguez/holbertonschool-higher_level_programming | /0x0B-python-input_output/9-add_item.py | UTF-8 | 443 | 2.75 | 3 | [] | no_license | #!/usr/bin/python3
"""
This file contains a function that adds
all arguments to a python list and saves
to a file
"""
import sys
save_to_json_file = __import__("7-save_to_json_file").save_to_json_file
load_from_json_file = __import__("8-load_from_json_file").load_from_json_file
filename = "add_item.json"
try:
new... | true |
bd604c13ccb7a3a4c749422c0204fa71d3d40cd2 | Python | matt-rowlinson/NCAS_CVAO | /code/ozone_trends_all.py | UTF-8 | 2,820 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 16 10:31:45 2019
Script to examine different deseasonalisation techniques.
@author: ee11mr
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
plt.style.use('seaborn-darkgrid')
plt.rcParams['figure.figsize'] = (7, 7)
filepath = '/users/m... | true |
4c78bf104d6b8e55833576457678135447a2cdb9 | Python | theS3b/TM-1.0 | /TM 1.0/python interface/playAgainstAi.py | UTF-8 | 2,178 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 9 17:15:19 2019
@author: seb
"""
import time
import os
from detectPieces import get_move, get_board_map
from clientConnexion import SocketConnexion
from movePiece import set_magnet_on, set_magnet_off
from ledControl import *
from talking import saying_win, s... | true |
389facd7544292711c2741c4f19cfa087a74a1e9 | Python | joan-kii/Automate-boring-stuff-with-Python | /Chapter 17/prettifiedStopwatch.py | UTF-8 | 1,338 | 3.5 | 4 | [] | no_license | #!python3
#prettifiedStopwatch.py Pues eso, un stopwatch.
import time, pyperclip
# Informa al usuario del funcioanmeinto del cronómetro.
print('\nPulsa ENTER para comenzar. Después, pulsa ENTER de nuevo para parar el reloj en cada vuelta. Para salir, pulsa Ctrl + C.')
# Con la entrada del usuario inicia la c... | true |
d757743b34b32efc2915112b35b4a24262fc40fc | Python | alvinoc/programming-lab | /linhas_cruzadas.py | UTF-8 | 693 | 3.46875 | 3 | [] | no_license | def mergeSort(array):
inv = 0
if len(array) > 1:
mid = len(array) // 2
L = array[:mid]
R = array[mid:]
inv += mergeSort(L)
inv += mergeSort(R)
L.append(float("inf"))
R.append(float("inf"))
j, k = 0, 0
for i in r... | true |
c334f8a214506511b963a1fd9efb8721047a389b | Python | acadien/lazyPlot | /smoothing.py | UTF-8 | 976 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
from numpy import *
from scipy import weave
from scipy.weave import converters
#uses a guassian smooth convoluted with finite differences to get an absurdly smooth line but with edge effects
superSmoothCode="""
double pre=0.3989422804014327/sigma;
double dx,xmus;
for(int a=0;a<N;a++){
for(int b... | true |
b832c262c4b21d7da555b9147bb18b421435b917 | Python | MiMoText/roman18 | /Python-Scripts/archive/hyphen/trennung_auflösen_part2.py | UTF-8 | 2,942 | 3.0625 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | import glob
import os.path
def line_reader(document):
file = open(document, 'r', encoding='utf8')
inhalt = file.readlines()
inhalt_ = [line.strip() for line in inhalt]
return inhalt_
'''this script deals with hyphen at the end of a line, if there are xml-tags as well
here we have three different ca... | true |
86e22cdce841585174471efdc61aad25b3a1017f | Python | samtx/ecen760 | /Friedman_Sam_hw2.py | UTF-8 | 8,561 | 3.53125 | 4 | [] | no_license | # Sam Friedman
# 10/9/2018
# HW 2
# ECEN 760
from __future__ import print_function
import sys
class Graph(object):
"""
Graph object that has sets of nodes and edges
"""
def __init__(self, edges=set(), nodes=set()):
self.parents = {}
self.children = {}
self.nodes = nodes
... | true |
7ec0bc8e758f0d49847a230d67a4aaaa64787eb2 | Python | vladokovac/aoc-2018 | /2/day2.py | UTF-8 | 1,786 | 3.671875 | 4 | [] | no_license | import array
def main():
with open("2.txt") as input_file:
input_lines = input_file.readlines()
input_lines = [x.strip() for x in input_lines]
two_repeating_letters = 0
three_repeating_letters = 0
# part 1
for input_word in input_lines:
letter_count = array.array('I', (0 for ... | true |
4f065f9533426e8228da05204da0612a7fb8fe98 | Python | ztaylor2/cracking-the-coding-interview | /chapter_2/CTCI_2_2.py | UTF-8 | 371 | 3.421875 | 3 | [
"MIT"
] | permissive | """."""
def kth_to_last(k, node):
"""."""
curr_node = node
kth_to_last_nodes = []
for _ in range(k):
if not curr_node.next:
raise ValueError('k larger than list')
curr_node = curr_node.next
while curr_node:
kth_to_last_nodes.append(curr_node.val)
curr_n... | true |
264c1aa812385f57611eafe4e841a568d77f0d7b | Python | upple/BOJ | /src/15000/15351.py3.py | UTF-8 | 258 | 3.125 | 3 | [
"MIT"
] | permissive | import sys
n=int(input())
for p in range(n):
str=sys.stdin.readline()
ans=0
for ch in str:
if ch.isalpha():
ans+= ord(ch)-ord('A')+1
if ans==100:
print("PERFECT LIFE")
else:
print(ans) | true |
0bc595a662a4f4263f21d056eef04cca5659bb72 | Python | mckayav3/FinTech | /Python_Project/Module_2/cli.py | UTF-8 | 411 | 2.8125 | 3 | [] | no_license | import fire
import random
def clothes_picker(pants=False):
shirts_list = ["solid blue", "red striped", "purple and green tie dye","black dress shirt"]
pants_list = ["Black dress pants", "Gray sweatpants","Khakis"]
if pants:
return random.choice(shirts_list), random.choice(pants_list)
... | true |
c93fe2e9420703a5e5a709b22c933b03a009cf31 | Python | code-evince/Competitive-Programming-3-The-New-Lower-Bound-of-Programming-Contests | /Introduction/Getting Started : The Easy Problems/Super Easy/12250 - Language Detection.py | UTF-8 | 363 | 3.734375 | 4 | [] | no_license | i=1
while(True):
text = input()
if(text == '#'):
break
language = {"HELLO":"ENGLISH","HOLA":"SPANISH","HALLO":"GERMAN","BONJOUR":"FRENCH","CIAO":"ITALIAN","ZDRAVSTVUJTE":"RUSSIAN"}
if(text in language):
print("Case {}: {}".format(i,language[text]))
i+=1
else:
print("C... | true |
ba7da7ff6188638ec66e56c415f856d5174d9318 | Python | nick95a/Python_Practice | /Deque.py | UTF-8 | 1,352 | 4.34375 | 4 | [] | no_license | class Deque:
'''
Deque class based on the built-in list datatype in Python
'''
def __init__(self):
'''
Creates an empty container in the form of a list
'''
self.deque = []
def pushBack(self, item):
'''
The method pushes the item argument provided to t... | true |
f4a123989efe488f2c7ad79d1887c59c84de8dab | Python | renekm/ReneEGebara | /ep3.py | UTF-8 | 2,678 | 3.140625 | 3 | [] | no_license | 3# -*- coding: utf-8 -*-
"""
Created on Wed Apr 20 08:58:03 2016
@author: Rene Martinez
"""
class Jogo:
def __init__(self):
self.M = [[1,2,3], [4,5,6], [7,8,9]]
self.jogadas=0
def recebe_jogada (self, linha, coluna):
if self.jogadas %2 == 0:
s... | true |
e69045b1622cb68aeb7baa418c026ef244d8bde6 | Python | jzm-123/test | /Distributed_instagram_spider/util/backup/test_sleep.py | UTF-8 | 133 | 2.859375 | 3 | [] | no_license | import random
import time
second = random.randint(0,60)
print('before:',time.time())
time.sleep(second)
print('after:',time.time())
| true |
13d01048ff3fd092cdeb06304c8151d042557836 | Python | JIANGWQ2017/Algorithm | /Leetcode/LC5.py | UTF-8 | 656 | 3.59375 | 4 | [] | no_license | class Solution:
def longestPalindrome(self, s: str) -> str:
res= ""
for i in range(len(s)):
temp = self.findPalindromic(i,i,s)
if len(temp)>len(res):
res = temp
for i in range(len(s)-1):
temp = self.findPalindromic(i,i+1,s)
if l... | true |
19118170b29eff731ab3b709ddc2c0d5a9192ad6 | Python | toddcblank/pitboss | /pokerroom/payouts.py | UTF-8 | 1,050 | 3.171875 | 3 | [] | no_license | PAYOUTS = {
0: [0],
1: [1],
2: [2],
3: [2, 1],
4: [3, 1],
5: [3, 2],
6: [3.5, 2.5],
7: [3.5, 2, 1.5],
8: [4, 2.5, 1.5],
9: [4.5, 3, 1.5],
10: [5, 3, 2],
11: [5.5, 3.5, 2],
12: [6.5, 3.5, 2],
13: [6.5, 4, 2.5],
14: [6, 4, 2.5, 1.5],
15: [7, 4, 2.5, 1.5],
... | true |
71a61f9a660db84c994e03f01357eff309da487e | Python | sssv587/PythonFullStackStudy | /day07_dict/tuple01.py | UTF-8 | 1,823 | 4.78125 | 5 | [] | no_license | '''
总结列表:
list
1、定义
l = [] 空列表
l = ['aaa']
2.符号
+ ----> 合并 [] + []
* ----> [] * n
in ----> a in [] False / True
not in ---->
is 地址是否相等
not is
3.系统中给列表提供的函数
len(list) ----> int
sorted(list) ----> 排序
max(list) ----> 最大值
min(list) ----> 最小值
list(list) ----> 转换为list类型
enumeate(list) ----> index,value
4.列表... | true |
cbc78f881084b4c11fba6575883b662c88b04ca4 | Python | oaifaye/pyfirst | /nlp/_03_word2vec/__init__.py | UTF-8 | 6,903 | 2.609375 | 3 | [] | no_license | #utf-8
'''
https://www.cnblogs.com/Lin-Yi/p/9007259.html
'''
from gensim.models import word2vec
from gensim.models.word2vec import LineSentence
import jieba
import pymysql
class MyWord2vec():
'''
# 配置词向量的维度
num_features = 1000
# 保证被考虑的词汇的频度
min_word_count = 5
# 并行计算使用cpu核心数量
... | true |
8eabb1b246360c5bd0ad410b2939871bdb46aa8e | Python | EliteGirls/Camp2017 | /Girls10/Rhodaline and Linah/ohlo.py | UTF-8 | 481 | 3.140625 | 3 | [] | no_license | c=1
while c ==1:
c=input("press 1 to continue or any key to exit")
if c!=1:
break
score=input("please enter your score")
if score <=100 and score >80:
print "A"
elif score<=79 and score >70:
print "B"
elif score<=69 and score >60:
print "C"
el... | true |
b67007a5fd35f73dd715c753ed595c0d2ed45a24 | Python | kmui2/Rule-Game-server | /python/client-socket.py | UTF-8 | 1,736 | 3 | 3 | [] | no_license | #!/usr/bin/python
#----------------------------------------------------------------------
#-- This is a sample Python program that plays a game with a socket-based
#-- Game Server
#--
#-- Usage:
#-- client-socket.py host port rule-filet nPieces
#-- e.g.
#-- client-socket.py localhost 7501 game-data/rules/rules-01.txt ... | true |
a57d0b54b77d0f67651cbf7353fe3371eed67814 | Python | vp1961/Parser | /HTMLparser/models.py | UTF-8 | 2,503 | 2.578125 | 3 | [] | no_license | from django.db import models
import uuid
import requests
from datetime import datetime, timedelta, timezone
from lxml import html
import threading
class Task(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4)
url = models.URLField(max_length=100, verbose_name='URL')
minutes = models... | true |
ba8dcdf2ff23c0dc10190ae16a95f7f4924efac6 | Python | ByteHackr/Image_Processing_Practice | /Basics/Noise.py | UTF-8 | 862 | 2.859375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 10 09:57:44 2019
@author: BILU
"""
import cv2
import numpy as np
from matplotlib import pyplot as plt
import random
img = np.array([])
img = cv2.imread('Scan1.jpg',1)
#img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
rows, columns, dim = img.shape
p = 0.05
... | true |
d88cae5f0f7eba722869280fcf081f4d422cf822 | Python | LONG990122/PYTHON | /第一阶段/2. Python01/day05/exercise/07_even.py | UTF-8 | 358 | 4.25 | 4 | [] | no_license | # 练习:
# 输入一个整数用begin绑定,再输入一个整数用end绑定,打印出从begin~end(包含end)的所有偶数
# (建议用continue语句跳过奇数)
begin = int(input("请输入一个开始整数: "))
end = int(input("请输入一个结束整数: "))
for x in range(begin, end):
if x % 2 == 1:
continue
print(x)
| true |
8da7de21f47f498b846679e9648398e774912759 | Python | srishti88/spy_chat | /message.py | UTF-8 | 1,757 | 3.046875 | 3 | [] | no_license | import sys
from termcolor import colored, cprint
from friends import *
from datetime import datetime
from steganography.steganography import Steganography
#using steganography library to encrypt
def encrypt_message():
input_image = raw_input("please select an image to encode: ")
input_message = raw_input("pleas... | true |
15f3f5e11c5ff222b1aa2978a90b04a5450c2a18 | Python | Aswinpkrishnan94/Fabulous-Python | /Python/Day 9/Secret_Auction.py | UTF-8 | 1,038 | 3.515625 | 4 | [
"MIT"
] | permissive | # importing clear function
from replit import clear
# To display logo
from art import logo
print(logo)
# State variables
bids = {}
bidding_finished = False
# Bidding Process. Each bidder and their bid amount is stored. Continues until bidding is bidding_finished
while not bidding_finished:
name = input("What is y... | true |
c0d8d42059694d8e77018124c7c3bb351326cbe9 | Python | AleksandraZv/Netology | /Homework_2.5/2.5_homework.py | UTF-8 | 631 | 2.578125 | 3 | [] | no_license | import os
import subprocess
def lets_convert():
cur_dir = os.path.dirname(__file__)
path = os.path.join(cur_dir, 'Source/')
try:
os.makedirs('Result/')
except OSError:
pass
folder = os.listdir(path)
for pic in folder:
# convert = (convert, os.path.join(cur_dir, 'Source... | true |
25969b638b30d5f6d94e5040332e795053e99b44 | Python | fuston05/Data-Structures | /queue/queue.py | UTF-8 | 6,551 | 4.4375 | 4 | [] | no_license | """
A queue is a data structure whose primary purpose is to store and
return elements in First In First Out order.
1. Implement the Queue class using an array as the underlying storage structure.
Make sure the Queue tests pass.
2. Re-implement the Queue class, this time using the linked list implementation
as t... | true |
f25fb1816ebcf27a19d8b308d0a8aee23a628b04 | Python | krisfris/pyfongo | /pyfongo/__init__.py | UTF-8 | 10,490 | 2.671875 | 3 | [
"MIT"
] | permissive | import os
import shutil
from bson import ObjectId, json_util
from collections import namedtuple
from operator import itemgetter
from itertools import islice
from atomicwrites import atomic_write
from pymongo import ASCENDING, DESCENDING, errors # noqa
InsertOneResult = namedtuple('InsertOneResult', ['inserted_id'])
... | true |
cddef8737e6ec9fb2b79b1bf18225adf07e0f1a3 | Python | kangmihee/EX_python | /py_hypo_tensor/pack/ten30rnn.py | UTF-8 | 881 | 3.171875 | 3 | [] | no_license | # RNN - sequence data로 자연어에 대해 이전문자를 참조하여 다음문자를 예측
import tensorflow as tf
import numpy as np
# test1 : 1,1,4
# data = np.array([[[1,0,0,0]]], dtype=np.float32)
# print(data.shape)
# test2 : one-hot encoding한 여러개 사용 - 1,2,3,4,5
one_hot = [[[1,0,0,0,0],[0,1,0,0,0],[0,0,1,0,0],[0,0,0,1,0],[0,0,0,0,1]]]
dat... | true |
3929b075ebcc095bde15c1e090c1ca4536996c95 | Python | tazbingor/EzPascal | /test.py | UTF-8 | 533 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 测试
from interpreter import Interpreter
from lexer import Lexer
def main():
while True:
try:
try:
text = raw_input('ezpas> ')
except NameError:
text = input('ezpas> ')
except EOFError:
... | true |
2255a449b45d7f823d80e151c54290b7e1714524 | Python | Lakhanbukkawar/Python_programs | /FunctionTotakeNameAndDisplayMessage.py | UTF-8 | 88 | 3.296875 | 3 | [] | no_license | def name(x):
return x
a=input("enter the name")
print("happy birthday",name(a))
| true |
bf754f39b9de1abd54afd78dfc0fdf4162003c97 | Python | bojone/small_norb | /main.py | UTF-8 | 512 | 2.515625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
from smallnorb.dataset import SmallNORBDataset
plt.ion()
if __name__ == '__main__':
# Initialize the dataset from the folder in which
# dataset archives have been uncompressed
dataset = SmallNORBDataset(dataset_root='./smallnorb/')
# Dump all images to disk
data... | true |
49117f6a26e7c9c351025c115e666583bdb56d51 | Python | luanhsd/librarysort_aaed | /sorts.py | UTF-8 | 5,870 | 3.421875 | 3 | [] | no_license | def bubblesort(array):
status = True
compare = 0
moves = 0
for i in range(len(array)):
for j in range(1, len(array) - i):
if array[j] < array[j - 1]:
array[j], array[j - 1] = array[j - 1], array[j]
moves += 3
status = False
... | true |
f4174d741e9383afa4a2df4bc081dd2eaf96d639 | Python | omerkap/bulboard | /runners/screen_usages_orchestrator.py | UTF-8 | 3,054 | 2.890625 | 3 | [] | no_license | import logging
import time
import threading
import cPickle
import pickle
from screen_usages.abstract_screen_usage import AbstractScreenUsage
class ScreenUsagesOrchestrator(threading.Thread):
def __init__(self, sr_driver, screen_scroll_delay=0.2, runners={}):
super(ScreenUsagesOrchestrator, self).__init__(... | true |
e44c9531bae2e0d65d67b005e3832363d0c646af | Python | srafi1/introcs2finalproject | /writepokedex.py | UTF-8 | 2,254 | 2.609375 | 3 | [] | no_license | def getids():
try:
idfile = open('data/csv/pokemon_species.csv', 'rU')
s = idfile.read()
except:
return {}
s = s.split('\n')
s = s[1:-1]
ids = {}
for i in s:
i = i.split(',')
ids[i[0]] = i[1]
return ids
def gettypes():
try:
typefile = open... | true |
e3e3daddaaa1d74acc530254c3f1c83428837954 | Python | abstractlyZach/python_design_patterns | /command_pattern/assignment/actions/appliance.py | UTF-8 | 632 | 3.28125 | 3 | [] | no_license | import logging
class Appliance(object):
def __init__(self, name):
self._name = name
self._is_on = False
def on(self):
if self._is_on:
raise Exception('{} is already on.'.format(self._name))
else:
logging.info('%s has been turned on.' % self._name)
... | true |
7058664e862323923e67f3285127bfa4c9dcdd1f | Python | dominicwhite/cherryblossoms | /darksky_stuff.py | UTF-8 | 2,478 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 13 07:10:32 2019
@author: dominic
"""
import csv
import datetime
import os
import pandas as pd
import requests
KEY = os.environ.get("DARKSKY_KEY")
tidal_basin_lat = 38.883995
tidal_basin_long = -77.038976
def format_darksky_url(dtime, lat=38.8839... | true |
8086847b50d75c35516ddad1ec88bf6bed1a3b83 | Python | xiaoqi2019/python14 | /week_6/class_0222/task_02.py | UTF-8 | 510 | 3.4375 | 3 | [] | no_license | #-*-coding:utf-8-*-
#@Time :2019/2/25 18:12
#@Author:xiaoqi
#@File :task_02.py
# 2:思考:分别将我们学过的数据类型 int float boolean str list tuple dict
# 写到每个单元格里面,观察,你通过openpyxl操作后拿到的数据分别是是什么类型。
from openpyxl import load_workbook
wb=load_workbook('python_16.xlsx')
sheet=wb['Sheet1']
for i in range(1,sheet.max_row+1):
res=she... | true |
f6a2bc125693249d86f2622d8477a45ca605338a | Python | dzheleznyakov/PythonMegaCourse | /s10more_on_functions/concat.py | UTF-8 | 130 | 2.9375 | 3 | [] | no_license | def concat(s1, s2='ccc'):
return s1 + s2
print(concat('aaa', 'bbb'))
print(concat(s2='aaa', s1='bbb'))
print(concat('aaa'))
| true |
304d3f065a836270ff58910d8f1e47cefddc940f | Python | shwotherspoon/misc-code-things | /min_edit_dist.py | UTF-8 | 1,104 | 3.59375 | 4 | [
"MIT"
] | permissive | import numpy as np
def compute_med(s1, s2, ins_cost=1, del_cost=1, sub_cost=1):
'''
Compute the minimum edit distance (MED) between string 1 (s1) and
string 2 (s2)
'''
target = s1
source = s2
target_len = len(target)+1 # num cols
source_len = len(source)+1 # num rows
matr = np.zeros((source_len,... | true |
4905c87ccb8988204df91febc2da760b1642d19f | Python | hirosuzuki/procon | /atcoder/abc076/a.py | UTF-8 | 58 | 2.78125 | 3 | [] | no_license | R = int(input())
G = int(input())
r = 2 * G - R
print(r)
| true |
f0ac73a42bd0b039fb0d98f45c38e74b7a94c068 | Python | baixf-xyz/raspberry_pi | /face.py | UTF-8 | 3,966 | 2.609375 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
from picamera import PiCamera
from aip import AipFace
import urllib.request
import RPi.GPIO as GPIO
import base64
import time
import cv2
import pymysql.cursors
import sys
import datetime
#打开数据库连接
conn=pymysql.connect(host='localhost',user='root',passwd='123456',db='rapberry',port=3306)
#使用cur... | true |
94772fdd33d9d0078c3e835528bdc359ffd18b63 | Python | hack4impact-uiuc/globalgiving-tool | /microservices/conftest.py | UTF-8 | 593 | 2.515625 | 3 | [] | no_license | import pytest
import sys, os
"""
Contains methods used before pytest collects all the tests within the microservices directory. Adds the correct directory such that
all of the test imports in each microservice will be found and the test cases will run.
"""
def pytest_sessionstart(session):
# Add microservice dir... | true |
595980326b35e63178642f0f816bdf2c14edaf83 | Python | KratosMultiphysics/Kratos | /applications/DEMApplication/tests/test_erase_particles.py | UTF-8 | 2,998 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | import os
import KratosMultiphysics as Kratos
from Kratos import Logger
import KratosMultiphysics.KratosUnittest as KratosUnittest
import KratosMultiphysics.DEMApplication.DEM_analysis_stage as dem_analysis
# This test consists in a system with a single already existing particle and an inlet that injects a few
# part... | true |
d144d2dcd7b2571f2d5dba57de5295c6d6241096 | Python | Ercion/learning_python | /ordered_dict_example.py | UTF-8 | 1,732 | 2.859375 | 3 | [] | no_license | # you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
from collections import OrderedDict
line_pattern=re.compile('^([\w\W]+)\.([\w\d]+)\s(\d+)b$')
'''
selected_file_types={
'music':['mp3','acc','flac'],
'images':['jpg','bmp','gif'],
... | true |
8a605edd7b40bb5fbb205c5df6d134d3baa7ac57 | Python | aalexx-S/picklewrapper | /pickleutils.py | UTF-8 | 1,893 | 3.75 | 4 | [] | no_license | import os
try:
import cPickle as pickle
except:
import pickle
class PickleUtils:
"""
Provide a simple facade for the python package 'pickle'.
A file name for reading and writing is needed, and objects will be read from and writen to the file given.
The file and directories will be created if no... | true |
1990d6395a9e588c4f803d0897e318e1a9a289e2 | Python | PravinAlhat/Splinter-Automation | /Tests/testRadioButtons.py | UTF-8 | 1,402 | 2.578125 | 3 | [] | no_license | from Splinter_Project.Page._PracticePage import practicePage
import unittest
import pytest
class testClass(unittest.TestCase):
_test_Obj = practicePage()
@classmethod
def setUpClass(cls) -> None:
cls._test_Obj.browserClose()
cls._test_Obj.openApplication()
def setUp(self) -> None:
... | true |
8b0c7c9066b31846da241d10818e8a3d4cc85938 | Python | ekaone/raspberrypi | /Nema17.py | UTF-8 | 1,028 | 3 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD) #read the pin as board instead of BCM pin
LinearActuatorDir = 33
LinearActuatorStepPin = 35
LinearActuatorEnable = 36
GPIO.setwarnings(False)
GPIO.setup(LinearActuatorDir, GPIO.OUT)
GPIO.setup(LinearActuatorStepPin, GPIO.OUT)
GPIO.setup(Linea... | true |
39301331b8b70f380c0f786d6d60ffd2281feeab | Python | hayden-williams/ECE4012 | /autoV1.py | UTF-8 | 9,603 | 2.625 | 3 | [] | no_license | # Authors: Stephen Hayden Williams and Edgardo Marchand
# Date Created: 18 Oct 2017
# Date Revised: 18 Oct 2017
# A very basic TurtleBot script that moves TurtleBot forward, bumper paused the movement for 2 sec. Press CTRL + C to stop. To run:
# On TurtleBot:
# roslaunch turtlebot_bringup minimal.launch
# On w... | true |
8b921259874a9d6e04f1aa59d1f5718ad0183673 | Python | JasonJOCKKY/CS4820-jtnfx | /assignments/assignment 5/createAssignment_2_test.py | UTF-8 | 809 | 2.734375 | 3 | [] | no_license | import pytest
import System
import json
# Login as a professor and create assignment in the course that the professor does not teach
def test_createAssignment_2(grading_system):
username = 'saab'
password = 'boomr345'
course = 'databases'
newAssignment = 'assignment000'
newDueDate = '5/10/21'
g... | true |
961303bc91935b93d2116f0b22f6f5620cbf7d15 | Python | abdullahelnajjar/FirstPythonProject | /Python Exercises/read a file.py | UTF-8 | 368 | 3.09375 | 3 | [] | no_license | with open('names.txt', 'r') as open_file:
content = {}
for line in open_file:
line = line.strip()
if line in content:
content[line] += 1
else:
content.update({line: 1})
print(content)
'''
with open('names2.txt', 'a+') as open_file:
for count in range(1,10):
... | true |
22873b2cd76bf2caa6c97232c0d7b019f50696ff | Python | KleyLima/condo_manager | /source/dao/pessoa_dao.py | UTF-8 | 1,011 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from source.dao.models.pessoa import Pessoa
# Inserting imovel at Database
def insert_pessoa(nome, email, cpf, nacio, fone, nasc, tipo, sexo):
pessoa = Pessoa(
name = nome,
email = email,
cpf = cpf,
nacionality = nacio,
phone = fone,
birthda... | true |
ba5d9bd7f69dbb204d7b71d830c14d6b7cf6cdf5 | Python | AryaStar/Data-Mining-for-Cybersecurity | /Project/2019/5/code/sent_seg.py | UTF-8 | 1,435 | 2.84375 | 3 | [
"MIT"
] | permissive | '''
author:Fr3ya
date:20191205
function: 对每一条语句分句
'''
from nltk.tokenize import sent_tokenize
import re
import pymysql
# 连接数据库
db = pymysql.connect("127.0.0.1",
"root",
"123456",
"Apollo",
use_unicode=True,
charset... | true |
d782eb14160767132273a8b62bd5d943fd924c21 | Python | AshaS1999/ASHA_S_rmca_s1_A | /ASHA_PYTHON/17-02-2021/C01Q13.py | UTF-8 | 255 | 3.8125 | 4 | [] | no_license | input_string = input("Enter a list element separated by comma ")
list = input_string.split(',')
print("The enterd list is")
for x in range(len(list)):
print (list[x])
print("the first and last colour is\n")
print( "%s %s"%(list[0],list[-1]))
r | true |
4752a0e26a0f02d74d3c979fcac9d17e0f49c32d | Python | Mianto/handwriting | /backend/utilities/basic_info/get_contact_number.py | UTF-8 | 1,119 | 3.015625 | 3 | [] | no_license | import json
import re
import os
def contact_number(json_dict):
"""
Extract contact number from the json_dict file
:param json_dict
:return all present contact numbers
"""
texts = json_dict['textAnnotations'][0]['description']
texts = texts.replace('\n', '$')
try:
li = re.fin... | true |
7edc6e63386aad9fcc5be1a47d9e709312a6ddbd | Python | dnath/RamseyCoin | /admin-tool-v2/http_utils.py | UTF-8 | 2,670 | 3.046875 | 3 | [] | no_license | import httplib
import json
class ResponseInfo:
"""
Contains the metadata and data related to a HTTP response. In
particular this class can be used as a holder of HTTP response
code, headers and payload information.
"""
def __init__(self, response=None):
"""
Create a new instance... | true |
37c13a99486e7adbc89490b871b06a9b69e20185 | Python | kumarjeetray/Programs | /Python/UniqueColors.py | UTF-8 | 494 | 2.6875 | 3 | [] | no_license | def minimumColors(n,s,v,i,j,count):
l=len(v)
ma=max(v)
if j>=l:
print(count-1)
return
if v[0]==min(v) and v[l-1]==max(v) and v[l-1] - v[0] < s:
print('1')
#print(i,j,v[i],v[j])
while v[j]-v[i]>=s and v[j+1]-v[i]<s:
#print(j)
j=j+1
count=count+1
... | true |
93e972cc713619588f6044b5788f67409b068152 | Python | rystills/CryptoChat | /NS_DH/Bob.py | UTF-8 | 2,775 | 2.546875 | 3 | [] | no_license | from main import generate_nonce, nonceSubtract, diffieHellman, encoder, decoder, sendMessage, receiveMessage, namePrint, chatDataHandler
import sympy, random, sys, threading
try: import simplejson as json
except ImportError: import json
sys.path.insert(0, 'DES/'); import DES
import socket
def main():
TCP_IP = '127... | true |
28ff35f863ae7e376d72b64a4ac797ca8518783a | Python | JetSimon/Advent-of-Code-2017 | /Day 11/day11.py | UTF-8 | 604 | 3.609375 | 4 | [] | no_license | from math import sqrt
def getInput():
out = []
f = open('input.txt', 'r')
for line in f:
out += line.split(",")
return out
steps = getInput()
x = 0
y = 0
best = 0
for step in steps:
if step == "n":
y+=1
elif step == "s":
y-=1
elif step == "ne":
x+=0.5
... | true |
3dc6397eb9544a8c494a5bc404f15e1499956050 | Python | tinguen/Currency-bot | /db.py | UTF-8 | 1,229 | 2.71875 | 3 | [] | no_license | import mysql.connector
my_db = mysql.connector.connect(
host="localhost",
user="xxxxx",
passwd="xxxxx"
)
my_cursor = my_db.cursor()
def get_currency(chat_id):
my_cursor.execute("SELECT currency FROM `bot`.`base_currency` WHERE chat_id={}".format(chat_id))
row = my_cursor.fetchone()
if row is None:... | true |
ba86b7af479cfb273bbdfebd2230ff1ad2320936 | Python | chaelivieira/SSW567HW2a | /TestTriangle.py | UTF-8 | 3,538 | 3.5625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Updated Jan 21, 2018
The primary goal of this file is to demonstrate a simple unittest implementation
@author: jrr
@author: rk
"""
import unittest
from Triangle import classifyTriangle
# This code implements the unit test functionality
# https://docs.python.org/3/library/unittest.html ha... | true |
3bbb35d6713d7d1b7f677b430e72b0c58772306e | Python | iRnx/Tabela-de-Times | /Montar uma tabela.py | UTF-8 | 627 | 3.703125 | 4 | [
"MIT"
] | permissive | lista1 = list()
lista2 = list()
while True:
lista1.append(str(input('Nome: ')))
lista1.append(int(input('Vitória: ')))
lista1.append(int(input('Empate: ')))
lista1.append(int(input('Derrota: ')))
lista2.append(lista1[:])
lista1.clear()
resp = ' '
while resp not in 'SN':
... | true |
d388ea6e622e350d2f7f95203c4ec24bdbd8c225 | Python | meir367612/File_Project_oop | /Word.py | UTF-8 | 318 | 2.515625 | 3 | [] | no_license | from SuperFile import SuperFile
class WordFile(SuperFile):
def __init__(self, name:str, content:str,who_created:str,description:str,file_size:int):
SuperFile.__init__(self, name, content, who_created, description, file_size)
def __str__(self):
s = SuperFile.__str__(self)
return s
| true |
b624e919f64a0c98be62441d66d7f35f809eae57 | Python | jorson-chen/thu-network-topology-discovery | /map.py | UTF-8 | 3,250 | 2.515625 | 3 | [] | no_license | import os
import re
import networkx as nx
from networkx.readwrite import json_graph
import csv
import json
import sys
import signal
from optparse import OptionParser
from netaddr import IPNetwork, IPAddress
# Initialize the command line parser instance
parser = OptionParser()
parser.add_option("-i", "--input", dest="... | true |
9da548be860e0bf7a9df69e9df59003c80c980cb | Python | philprobinson84/RPi | /camera/timelapse/cam_timeLapse_Threaded_upload.py | UTF-8 | 1,578 | 2.796875 | 3 | [
"Artistic-2.0"
] | permissive | #!/usr/bin/env python2.7
import time
import os
from subprocess import call
import sys
class Logger(object):
def __init__(self):
self.terminal = sys.stdout
self.log = open("logfile.log", "a")
def write(self, message):
self.terminal.write(message)
self.log.write(message)
sys.... | true |
a6aee1aeaab9fc5f19edaa44708637b51a3e0adf | Python | Klaudia67/IMDb | /Project/Python/IMDb.py~ | UTF-8 | 2,028 | 2.625 | 3 | [] | no_license | import omdb
import re
with open('Baza', 'r') as myfile:
data=myfile.read()
def txt():
mtext = ment.get()
[print(ment.get()) if mtext == data else print("false")]
def txt2():
[print(ment.get()) if ment.get() in open('Baza').read() else print("false")]
#
def txt3():
movie=omdb.get(title=ment.get(), year=ment1... | true |
22ee69c379c0903d08b23bb64c4760b86d1542b7 | Python | Lain-progressivehouse/atCoder | /atCoder/abc140.py | UTF-8 | 1,228 | 2.828125 | 3 | [
"MIT"
] | permissive | def p_a():
i = int(input())
print(i ** 3)
def p_b():
N = int(input())
A = list(map(int, input().split()))
A = [i - 1 for i in A]
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
bf = -100
for i in A:
ans += B[i]
if bf == i - 1:
... | true |
d8a6e8f75c9128d2e9761670751d4c65ee5ae0b4 | Python | sherholz/render_scripts | /pyscripts/pytools/inset.py | UTF-8 | 6,855 | 2.609375 | 3 | [] | no_license | '''
Created on 20.11.2015
@author: Jirka
'''
import OpenEXR as oe
import Imath
import os
import numpy
import fnmatch
import sys
from PIL import Image
def toSRGB( val, ev ):
res = val * pow( 2, ev )
if res <= 0.0031308:
res = res * 12.92
else:
a = 0.055
res = (1 + a) * pow( res, ... | true |
b56941f591a00870cbd4d49fb1f0219e9125778b | Python | revan7/pv-simulator | /src/messaging/senders/RabbitMQBroker.py | UTF-8 | 1,396 | 3.21875 | 3 | [] | no_license | import json
import logging
import pika
logger = logging.getLogger(__name__)
class RabbitMQBroker:
"""
Implementation of a broker that sends messages to a queue. This particular implementation is of a RabbitMQ broker.
Attributes
----------
queue_address: str
The host of the RabbitMQ ser... | true |
bcb458ab697f53c547d3872decab2aaa3377e7d8 | Python | princewang1994/work | /MachineLearning/greg.py | UTF-8 | 866 | 2.859375 | 3 | [] | no_license | #!/usr/bin/python
import re
def generateData(f):
word={}
count=0
for line in open(f):
if count >=2000 :
break
i=0
while(line[i]!=' '):
i+=1
first=i
while(line[i]==' '):
i+=1
word[line[0:first]]=line[i:]
count+=1
return word
def analyze():
word=generateData('ee_dic.txt')
wordset={}
w... | true |
b8b169bace6ac198fc503d1f5d556e2dc4683a21 | Python | KimEklund13/SeleniumWD-with-Python3x | /basicsSyntax/multiple_lists.py | UTF-8 | 278 | 4.34375 | 4 | [] | no_license | """
Iterating over multiple lists
"""
l1 = [1, 2, 3]
l2 = [6, 7, 8, 20, 30, 40]
for a, b in zip(l1, l2):
print(a) # printing item from first list
print(b) # printing item from second list
# This will run as many times as the length of the shortest list (3 times) | true |
168a8392fba11f97173cd96e9ae1d0cbff8be59c | Python | chadsten/advent-of-code | /2018/day-1/main.py | UTF-8 | 1,730 | 3.46875 | 3 | [] | no_license | # get values for freq changes
import json
from pprint import pprint
with open('C:/Users/chadsten/source/repos/advent-of-code/2018/day-1/data.json') as data_file:
data = json.load(data_file)
## determine the end frequency after applying all modifiers in the
freq = 0 # base frequency
for f in data['freq']:
freq = ... | true |