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 |
|---|---|---|---|---|---|---|---|---|---|---|
d7eab534bda3843642f1e874ee39c6d81d042558 | qszhuan/git-x | /tests/utils/test_start.py | UTF-8 | 663 | 2.578125 | 3 | [
"MIT"
] | permissive | import pytest
import mock
from utils import *
@pytest.mark.parametrize("mock_platform,extected_command", [
('win32', 'cmd /c "start'),
('darwin', 'open'),
('cygwin', 'cygstart'),
('linux', 'xdg-open')
])
def test_start(mock_platform, extected_command):
with mock.patch('sys.platform', mock_platform... | true |
069c693b43497519a5791b2c42b65b37f317299b | jancoufal/pyshards | /rabbit.py | UTF-8 | 5,181 | 3.390625 | 3 | [] | no_license | #!/bin/env python3
# https://www.google.com/doodles/celebrating-50-years-of-kids-coding
from enum import Enum
class Direction(Enum):
UP = 'A'
RIGHT = '>'
DOWN = 'V'
LEFT = '<'
def __init__(self, symbol):
self._symbol = symbol
@property
def symbol(self):
return self._symbol
@staticmethod
def rotate(... | true |
310eac7eed1f5ee1c240257ac2a1cafaa1106903 | shambhand/pythontraining | /material/code/functional_programming/functional_2.py | UTF-8 | 555 | 3.640625 | 4 | [] | no_license | #! /usr/bin/python3
import sys
def add_ten (L):
for i in range (len (L)):
L[i] += 10
def main ():
L = [x for x in range (10)]
print ("Original L:", L)
add_ten (L)
print ("After, add_ten (L):", L)
L1 = [x for x in range (20, 30)]
print ("Original L1:", L1)
L1 = list (map... | true |
eecdf14c030bfa91b429484a99708b51f38789c8 | cbass2404/bottega_classwork | /python/notes/strings.py | UTF-8 | 7,851 | 4.09375 | 4 | [] | no_license | # sentence = 'The quick brown fox jumped'
# sentence -> variable
# 'The quick brown fox jumped' -> string
# = -> assignment
# sentence = 'The quick brown fox jumped'
# sentence_two = sentence.upper()
# print(sentence)
# print(sentence_two)
# sentence = 'the quick brown fox jumped'.capitalize()
# print(sentence)
# ... | true |
695d7c4d5522cbdb86c236469942de1c9e4001c8 | woutergins/DSS-DAQ | /DSS-DAQ/midas-ts-client.py | UTF-8 | 490 | 2.5625 | 3 | [] | no_license | #!/bin/env python
#
# MIDAS tapeserver SHM demo client
# Subscribe to data over 0mq and parse tape headers
# P.Rahkila June 2016
#
import zmq
import struct
# open 0mq subscriber and subscribe to all data
context = zmq.Context()
socket = context.socket(zmq.SUB)
socket.connect ("tcp://localhost:5678")
socket.setsockopt(... | true |
e8fe94786b1addacfabb7a8d5e6f65506d4932ef | karolschewe/GeneticAlgorithm | /Osobnik.py | UTF-8 | 2,119 | 3.046875 | 3 | [] | no_license | import random
def oblicz_wspo_trawy(d):
if d < 50 or d > 300:
wzrost_trawy = 0
elif 50 <= d <= 120:
wzrost_trawy = 2
elif 120 < d <= 200:
wzrost_trawy = 3
elif 200 < d <= 300:
wzrost_trawy = 1
else:
wzrost_trawy = 69
return wzrost_trawy
class Osobnik:... | true |
ab3a3b4f3260c65570a569f56541ca4965f8a852 | christopherliu830/trauma-wiley-scraper | /tools/database.py | UTF-8 | 3,523 | 2.890625 | 3 | [] | no_license | import sqlite3
import os
import time
from . import plog, integrity
keywords = [[],[]]
dup = 0
class ArticleData:
''' Container for information of a single article. '''
def __init__(self, key_a, key_b):
self.key_a = key_a
self.key_b = key_b
self.title = ''
self.authors = []
... | true |
c67e0a2f11a0bbc802adbab88fd403c63f4d8f7a | TruVortex/Competitive-Programming | /DMOJ/python3.py | UTF-8 | 1,617 | 2.765625 | 3 | [] | no_license | '''
def foo():
x = 10
y = x*2
def magic(n):
n = 0
print 'magic'
magic(y)
def ff(n):
print (n)
print 'fake magic'
a = foo.__code__
for x in a.co_consts:
print (x)
import inspect
print(inspect.getdoc(foo.__code__))
for x in inspect.getmembers(foo.__code__):
print x
print ... | true |
b31ec56ca2698eba23efa9ae58f48096944d6f73 | CambodgeVie/Equations | /Flux Indirect.py | UTF-8 | 302 | 3.234375 | 3 | [] | no_license | def Flux_Indirect(Tr):
Fi = sigma * (Tr)**4
return Fi
sigma = 5.67*10**(-8)
b = str(input("Labo ou Cambodge:"))
if b == "Labo":
print("Flux Indirect = ",Flux_Indirect(284.0485210168791))
elif b == "Cambodge":
print("Flux Indirect = ",Flux_Indirect(290.04286228445363))
| true |
d5e74566667c124f632250a0b879bc177304ec39 | cainiaomama520/scrapy_spiders | /kugou/kugou/spiders/kugou1.py | UTF-8 | 856 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from kugou.items import KugouItem
class Kugou1Spider(scrapy.Spider):
name = 'kugou1'
allowed_domains = ['www.kugou.com']
start_urls = ['http://www.kugou.com/yy/rank/home/{}-8888.html?from=rank'.format(str(i)) for i in range(1, 24)]
def parse(self, response):
... | true |
b1e3aee81a68b42e49b1181d66eb5e6d87f68ea7 | Earth-KOR/Study | /Python/6클래스/2클래스좀더파헤치기1.py | UTF-8 | 4,385 | 4.5 | 4 | [] | no_license |
#클래스 내부에 존재하는 생성자란?
#클래스 이름과 같은 함수를 생성자라고 부릅니다
#클래스 내부에 __init__라는 함수를 만들면 객체를 생성할때 처리할 내용을 작성할수 있다.
#문법
#class 클래스이름:
# def __init__(self, 추가적인 매개변수):
# 코드작성
#메소드란?
#클래스가 가지고 있는 함수를 메소드라고 부릅니다.
#문법
#class 클래스이름:
# def 메소드이름(self,추가적인 매개변수):
# 코드작성
#예제... | true |
29694065771ccf6bdda2e1d8987c6c17a4e0df8c | romeorizzi/temi_prog_public | /2019.02.27.recupero/conta-minimi-storici/gen/generator.py | UTF-8 | 976 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python3
import random
import argparse
from limits import *
parser = argparse.ArgumentParser()
parser.add_argument("N", type=int, help="numero di elementi della lista")
parser.add_argument("P", type=int, choices=(0, 1), help="0 = minimi storici pari, 1 = minimi storici dispari")
parser.add_argument("E"... | true |
cbe3ffb4d0fe05b18889f3c17976e849fe983359 | Bifidock79/titile | /l06/gog.py | UTF-8 | 591 | 3.75 | 4 | [] | no_license | geometria = {"Теорема Пифагора": "kek","Равенства треугольников":"ууууу"}
print(geometria["Теорема Пифагора"])
s = 0
while s < 10:
s += 1
if s == 5:
continue
print(s)
good_boys = ["Ибрагим", "Халид", "Сааду"]
for boy in good_boys:
print(boy)
for number in "10":
print(number)
user = {
"Им... | true |
24022e5f1285d35933269196c000b0a88f8f73d4 | damiansp/completePython | /oneoffs/multiprocessing/02_extend_the_process_class/custom_process_with_return_val.py | UTF-8 | 507 | 3.296875 | 3 | [] | no_license | from multiprocessing import Process, Value
from time import sleep
def main():
process = CustomProcess()
process.start()
print('Awaiting processes...')
process.join()
print(f'Parent got {process.data.value}')
class CustomProcess(Process):
def __init__(self):
Process.__init__(self)
... | true |
c227473fe67d2fee53dc99819c28c3a670801b21 | rksam24/MCA | /Sem 1/oops/Pattern/g.py | UTF-8 | 654 | 4.65625 | 5 | [] | no_license | """
This program takes an interger number 'n' and print
the pattern below in 'n' rows
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
"""
def main():
row = int(input("Enter Number of Rows: "))#take input from user
pattern(row)#calling function to print pattern
def pattern(row):
"""Purpose: This functio... | true |
bca51b7604b14d253c647119734d63c2800fcb1b | pwgraham91/Python-Exercises | /hr_array_ds.py | UTF-8 | 561 | 4.125 | 4 | [] | no_license | """ take a list and print the reverse of the list separated by a single space """
def print_reverse(array):
output = ''
for index, i in enumerate(array):
output += '{} '.format(array[len(array) - index - 1])
output = output[:-1]
print(output)
return output
assert print_reverse([1, 2, 3, ... | true |
09768138920dde6d47e9c88a09d8d85ed73f61bd | hazrmard/imgurPCA | /imgurpca/query.py | UTF-8 | 6,957 | 2.84375 | 3 | [] | no_license | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from . import config
# The Query class is passed to Parser.get() function. It generates a dictionary
# representing a query that the imgur API can accept. The Parser then matches
# the query type with t... | true |
0792094565900eabe407dbd0d913f1dad0ca88bc | RocheJorge/Proyectos-Personales-Python-Github | /ejercicio-menu-de-clientes.py | UTF-8 | 11,863 | 3.890625 | 4 | [] | no_license | """
Crear un programa que a traves de funciones se pueda apreciar una lista o un menu de opciones, donde cada opcion debe ser una funcion distinta de acuerdo a lo que seleccione el usuario. Cada cliente debe contener la informacion de su nombre, apellido o DNI y el menu o las funciones de cada seccion son las siguiente... | true |
a83280fcaf7a78872f217a7480510b6e43fcc2af | muthusrathinam/30dayscoding | /bit_manipulation/OnlyOneOccurance.py | UTF-8 | 292 | 3.4375 | 3 | [] | no_license | def xor(arr, n):
ans = arr[0]
for i in range(1,n):
ans = ans ^ arr[i]
return ans
T = int(input())
for test in range(T):
N = int(input())
list_n = list(map(int, input().split()[:N]))
res = xor(list_n, N)
print(res)
'''
Input
1
9
1 2 3 4 5 4 3 2 1
Output
5
''' | true |
3247d591f5d2d55073ade92bbf4bc31a766e0717 | MyosQ/adventCoding2020 | /code/adv4.py | UTF-8 | 2,652 | 3.203125 | 3 | [] | no_license | import os
def getKeyValuePairs(line):
l = line.split()
return l;
def addToDict(list, passList, passIndex):
if(len(passList) <= passIndex):
passList.append({})
for l in list:
splitted = l.split(':')
key, value = (splitted[0], splitted[1])
passList[passIndex][key] = value... | true |
4ddc70fa0c640cf0c4d3822e75c1547431c214ad | heyyyelijah/joke-generator-website | /main.py | UTF-8 | 1,312 | 2.53125 | 3 | [] | no_license | from flask import Flask, render_template, redirect, url_for, request, flash, abort
import requests
app = Flask(__name__)
url = "https://v2.jokeapi.dev/joke/"
def request_joke(joke_type):
response = requests.get(f'{url}{joke_type}')
r = response.json()
return r
@app.route('/')
def home():
return rende... | true |
97f57bbaba197a82c85fd49d3b3671914cfc2b27 | laughreyl/pysolo_modular | /PySolo_Video_Main.py | UTF-8 | 5,448 | 2.578125 | 3 | [] | no_license | import wx
from win32api import GetSystemMetrics # to get screen resolution
from configurator import Configuration
from configPanel import configPanel
from acquirePanel import acquirePanel
class maskPanel(wx.Panel): # temporary class
"""
panel for creating a ... | true |
7a07d6ff525515b7f7c00fbc9a17a8e697430a46 | IcyCC/math_search | /math_back/app.py | UTF-8 | 5,345 | 2.578125 | 3 | [] | no_license | import ctypes
from flask import Flask, request, jsonify, redirect, make_response
import os
import mock
from relation import data as key_word_data
import interface
be_mock = False
service = interface
if be_mock:
service = mock
path = os.path.split(os.path.abspath(__file__))[0]
app = Flask(__name__, static_folder=... | true |
04097c9c3abacb253947c8ca458fdd6dd78daa21 | tzyl/ctci-python | /chapter2/2.3.py | UTF-8 | 807 | 3.4375 | 3 | [] | no_license | import sys
sys.path.insert(1, "C:\Users\Tim\Desktop\competition\clrs\datastructures_old_py2")
from datastructures.linkedlist import LinkedList, Node
def delete(x):
"""Deletes node x from singly linked list given only access to x.
Note: Will not work if x is the last node in list. Maybe mark the node
... | true |
bd4f923423a935bf7981086c51a756d45f85fb68 | emejia01/BlockChainProject | /GUI/kivyGUI.py | UTF-8 | 16,271 | 2.515625 | 3 | [] | no_license | # This file handles the actual client, most of the functions here are implemented as basic GUI functionality
# things like validation and popup errors etc.
from kivy.app import App
from kivy.event import EventDispatcher
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen, FloatLayout... | true |
7c43a5e285811e905fb789f2df3eb8c9f6b9065d | as7168/forensics_final_project | /ethernet.py | UTF-8 | 808 | 2.765625 | 3 | [] | no_license | import struct
import binascii
import time
FRAMES = {'IPv4': 0x0800, 'ARP': 0x0806}
# class that parses ethernet frame
# at the moment only takes care of IPv4 and ARP packets
class Ethernet():
def __init__(self, packet):
# ! stands for network input, 6 chars in string, 5 chars in string, H is 2 bytes
... | true |
4dd050cce74e2d24f9eefeabe3331dc976cb3c7b | physyuki/AtCoder | /ABC087/B.py | UTF-8 | 256 | 3.234375 | 3 | [] | no_license | a, b, c, x = map(int, [input() for i in range(4)])
count = 0
for a_num in range(a+1):
for b_num in range(b+1):
for c_num in range(c+1):
if a_num * 500 + b_num * 100 + c_num * 50 == x:
count += 1
print(count) | true |
d4430e3183c64148f539a5a64e1ba5337c8d9108 | cheonyeji/algorithm_study | /프로그래머스/level1/제일작은수제거하기.py | UTF-8 | 299 | 3.65625 | 4 | [] | no_license | # 2022-09-19
# 프로그래머스 lv1 - 제일 작은 수 제거하기
# https://school.programmers.co.kr/learn/courses/30/lessons/12935?language=python3
# 소요 시간 : 11:20 ~ 11:25 (5m)
def solution(arr):
arr.remove(min(arr))
if len(arr) == 0:
arr.append(-1)
return arr
| true |
743bd0ddd694fd7d159784d880f0055a319d01d7 | duartecgustavo/PythonProgress | /desafios/Mundo 1/Ex033.py | UTF-8 | 838 | 4.71875 | 5 | [
"MIT"
] | permissive | # Desafio 33 - Aula 10 : Programa que leia numeros e me indique qual é o Maior e qual é o Menor.
a = int(input('Digite o \033[4mprimeiro numero\033[m: '))
b = int(input('Digite o \033[4msegundo numero\033[m: '))
c = int(input('Digite o \033[4mterceiro numero\033[m :'))
lista = [a, b, c] # Numeros são guardados em um ... | true |
48973477823f24b8015c4c1a08f568fda31629f7 | Y161537/mypython | /filefix.py | UTF-8 | 2,059 | 3.765625 | 4 | [] | no_license | def printfile(file_name, file_line):
(start, end) = file_line.split(':')
num = 0
if start == '':
start = 1
else:
start = int(start)
if end == '':
end = -1
else:
end = int(end)
file = open(file_name, encoding='utf8')
if start == 1:
if end == -1:
... | true |
c7c01428f3c85ecf68a89484510e6c557a1b0f3c | etashkinov/fin-gene | /src/linear_regression.py | UTF-8 | 515 | 2.921875 | 3 | [] | no_license | from statistics import mean
import numpy as np
def _best_fit_slope_and_intercept(xs, ys):
m = (((mean(xs) * mean(ys)) - mean(xs * ys)) /
((mean(xs) * mean(xs)) - mean(xs * xs)))
b = mean(ys) - m * mean(xs)
return m, b
def _squared_error(ys_orig, ys_line):
return sum((ys_line - ys_orig) * (y... | true |
2442ea4c8530595163e61186ad100aeebdba4c57 | livankrekh/Reinforce_experimental | /marvin.py | UTF-8 | 4,497 | 2.609375 | 3 | [] | no_license | #!./venv/bin/python3.7
import gym
import torch
import numpy as np
from torch import nn
from torch.distributions.normal import Normal
import torch.nn.functional as funcs
from tqdm import tqdm
env = gym.make('Marvin-v0')
env._max_episode_steps = 5000
env.reset()
RANDOM_STATE = 123
ZERO_LIMIT = 10**-9
class PolicyN... | true |
975b2c029ec8d7a0bd2cf3f82271195ba3bf41ca | deeplhub/python-demo | /src/com/xh/demo/utils/log.py | UTF-8 | 2,220 | 3.234375 | 3 | [] | no_license | """
Title: 日志
Description:
@author H.Yang
@email xhaimail@163.com
@date 2020/03/09
"""
import logging
import sys
DEFAULT_FORMATTER = "%(asctime)s [%(threadName)s] - [%(levelname)s] %(filename)s:%(lineno)d [%(funcName)s()] : %(message)s"
# DEFAULT_FORMATTER = "[%(levelname)s] %(filename)s:%(lineno)d [%(funcName)s()] ... | true |
12d70c3f2864595e3c3b42f7838c414e98c52d85 | KevinKnott/Coding-Review | /Month 01/Week 01/Day 07/b.py | UTF-8 | 2,211 | 3.921875 | 4 | [
"MIT"
] | permissive | # Best Time to Buy and Sell Stock: https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
# You are given an array prices where prices[i] is the price of a given stock on the ith day.
# You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell... | true |
cd93b1466688fc474cd74b9242f9ac588352563b | tf369/CryptageHomomorphe | /serveur.py | UTF-8 | 448 | 2.921875 | 3 | [] | no_license | import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((socket.gethostname(), 1234))
s.listen(5)
while True:
# now our endpoint knows about the OTHER endpoint.
clientsocket, address = s.accept()
print(f"Connection from {address} has been established.")
clientsocket.send(bytes("Bonj... | true |
88e4031cb0849de3cff4c0b61ee369ad40baa20a | brendankon/Mathematics-of-Deep-Learning---Final-Project | /Project Code/MNIST.py | UTF-8 | 3,122 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 20 05:03:48 2021
@author: deepakd
"""
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import tensorflow_datasets as tfds
import sys
import tensorflow.keras.backend as K
import time
import pickle
import os
# Up to line 44 ... | true |
16ce178ebd9d750b60af17cdf05de6fe45196c0f | aklsh/DynamicExecCore | /src/reservationStation.py | UTF-8 | 5,243 | 2.609375 | 3 | [
"MIT"
] | permissive | from FU import fuEntry
class reservationStationEntry:
'''
+----+-----+-------+-----+-------+-------+--------+
| ID | Op1 | Valid | Op2 | Valid | Ready | Opcode |
+----+-----+-------+-----+-------+-------+--------+
'''
def __init__(self):
self.id = None
self.opcode = None
... | true |
21efb2dd99cfabb580abcf559f802632b48587b2 | hcxie20/Algorithm | /120_triangle_min_path.py | UTF-8 | 553 | 2.96875 | 3 | [] | no_license | class Solution:
def minimumTotal(self, triangle) -> int:
if not triangle:
return 0
m = len(triangle)
n = len(triangle[-1])
dp = [[float('inf') for _ in range(n)] for _ in range(m)]
dp[0][0] = triangle[0][0]
for i in range(1, m):
for j in ran... | true |
638e943e848f0aab1ae3f09a66f9a0870e29eb3d | blacktomato/LightField_tool | /LF_refocusing.py | UTF-8 | 3,109 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
##############################################################
# File Name : LF_refocusing.py
# Purpose : Refocus the Light Field Image
# Creation Date : Wed 16 Aug 2017 02:04:54 PM CST
# Last Modified : Sun 20 Aug 2017 01:15:39 AM CST
# Created By : SL Chung
##################... | true |
d052aa2e44864562685f0cb7753362633c13e042 | katiasantillan/Wallbreakers | /Week 2/DistributeCandies.py | UTF-8 | 267 | 2.78125 | 3 | [] | no_license | class Solution:
def distributeCandies(self, candies: List[int]) -> int:
numCandies = len(candies)//2
candiesC = set(candies)
if (len(candiesC) >= numCandies):
return(numCandies)
else:
return(len(candiesC)) | true |
82b612ca4f54e9290a269b187d910cbddacad051 | vermahardik12345/Project100 | /Atm.py | UTF-8 | 920 | 3.78125 | 4 | [] | no_license | class atm:
def __init__(self,cardnumber,pin):
self.cardnumber=cardnumber
self.pin=pin
def balanceinquiry(self):
print('Your balance is Rs.200:')
def cashwithdrawl(self,amount):
new_amount=200-amount
print('Your withdrawl'+str(amount)+"Your remaining balance is Rs."+st... | true |
c7afb2e42e74dfa71e7c114d1e4a5e6b16329401 | Sergunia/prog_Bakumenko | /Turtle/Bakumenko_6_SquareSpiral.py | UTF-8 | 224 | 3.5 | 4 | [] | no_license | import turtle
t = turtle.Turtle()
t.shape('turtle')
L = 10
for i in range(40):
"""Квадратная спираль из 40 сторон, длины которых: 10+5n"""
t.forward(L)
t.left(90)
L += 5
| true |
f3f4681b19afc9b11cb57adf704ce326323df783 | Anil-account/python-program | /polymorphism.py | UTF-8 | 540 | 3.6875 | 4 | [] | no_license | class person():
def __init__(self,name,address,phone):
self.name = name
self.address = address
self.phone = phone
def introduce(self):
return "Hi! my name is"+ self.name
class Teacher(person):
def __init__(self,name,address,phone,subject):
person.__init__(self,name,... | true |
5ddd7f8f1b485eb4ac495ce34d83d3ce31ec2146 | LuannMateus/python-exercises | /python-files/class-exer/class15.py | UTF-8 | 153 | 3.109375 | 3 | [] | no_license | s = 0
color = {
'white': '\033[1;37m'
}
while True:
s += 1
if s == 100:
break
print(f'\033[1;37mThe sum between all valueis is {s}') | true |
11b4ea935a411a774313b02346cc5041d1f5f068 | kriti-ixix/ait-fdp | /python/lists.py | UTF-8 | 494 | 3.78125 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 6 15:05:56 2021
@author: kritixblaze
"""
'''
1. Lists
2. Tuples
3. Sets
4. Dictionaries
'''
l1 = [1, 2, 3, True, "Hello", 5.5]
l2 = []
l3 = [['A', 'B'], 5.20, "Hey"]
#print(l1)
l1.append("XYZ")
#print(l1)
l1.insert(2, "New Element")
#print(l1)
#p... | true |
5aee3476e5864bac021e8747586362b65436ca79 | ilyatikhonov/imageporndirtyrubot | /imageporndirtyrubot/dirty.py | UTF-8 | 3,649 | 2.515625 | 3 | [
"ISC"
] | permissive | # -*- coding: utf-8 -*-
import time
import requests
from imageporndirtyrubot.exception import APIException, DirtyCantLoginException
DIRTY_API_PATH = 'https://dirty.ru/api'
MAX_PER_PAGE = 42
def raw_request(uri, method, querystring=None, data=None, headers=None, **requests_options):
"""
Make Dirty API HTTP... | true |
253dcee5a5c3c3dbc0834d2886e31e4cbd689eb9 | Jerllina/DeepLearning_PlayGround | /MNIST_series/mnist_simplest version .py | UTF-8 | 1,486 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 20 15:06:52 2018
@author: lijie
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
sess = tf.InteractiveSession()
'''load data'''
from tensorflow.examples.tutorials.mnist... | true |
bd9884d786c69cfd5adb714bcdd365117dce9ecb | ike97/usefulPythonScripts | /MinimumElementBST.py | UTF-8 | 1,790 | 4.28125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 30 14:28:15 2019
Minimum element in BST
@author: ikeos
"""
#Knowing that the BST has least value (on left) and largest value (right)
#Class we will use to test our code
class Node(object):
def __init__(self, left=None, right=None, data=None):
self.left = left
... | true |
d8f85009523c55b86e4df35963edec50c52fde7c | gagan3012/Tcp-basics | /TCPServer.py | UTF-8 | 433 | 2.6875 | 3 | [] | no_license | from socket import *
from reward import reward
serverPort = 2000
serverSocket = socket(AF_INET, SOCK_STREAM)
serverSocket.bind(('', serverPort))
serverSocket.listen(1)
print('The server is ready to receive')
while True:
connectionSocket, addr = serverSocket.accept()
sentence = connectionSocket.recv(1024).deco... | true |
4a87e073172c710692191c3d75580818187dfe11 | AditAg/Interpretability_using_information_theory | /plotting_code/Ensemble/ensemble_minivggnet.py | UTF-8 | 2,774 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
from textwrap import wrap
font = {'family' : 'times',
'size' : 12}
plt.rc('font', **font)
plt.rc('xtick', labelsize=12)
plt.rc('ytick', labelsize=12)
samples = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
# Run ensemble experiment an... | true |
eb524546e52f60af8a1cbe151c5463a731b0c31c | livingstream/mustardseed | /mdata.py | UTF-8 | 2,826 | 2.78125 | 3 | [] | no_license | import sys
import os
import re
import random
from collections import Counter
sys.path.append("openpyxl")
from openpyxl.workbook import Workbook
from openpyxl import load_workbook
wb=load_workbook(filename=r"data_textmining.xlsx")
trainingf=open("training",'w');
testingf=open("testing",'w');
sheetfinal=wb.get_sheet_by_n... | true |
e4ace83079e6fda24c32d73528b82ec5ea729b6a | drbernal47/python-challenge | /PyPoll/main.py | UTF-8 | 3,020 | 3.84375 | 4 | [] | no_license | import os
import csv
# Path to collect data from the Resources folder
poll_data_csv = os.path.join('Resources', '02-Homework_03-Python_Instructions_PyPoll_Resources_election_data.csv')
# Read in the CSV file
with open(poll_data_csv, 'r') as csvfile:
# Split the data on commas
csvreader = csv.reader(csvfile, ... | true |
836ea1579675d8126c1d5d584e1bbc2fa9abf93c | martakedzior/python-course | /09-algoritms/sum_for.py | UTF-8 | 690 | 4.21875 | 4 | [] | no_license | def sum_naturals(n):
sum_number = 0
for nr in range(1, n+1):
sum_number = sum_number + nr
return sum_number
def sum_naturals_while(n):
sum_number = 0
while n > 0:
sum_number += n
n = n - 1
return sum_number
def sum_naturals_recursion(n):
# 10 + sum_naturals_re... | true |
5de79f7d0859406ee63d5ae2cd8cb83216c92e76 | JRasmusBm/ECommerceProject | /berriesandgoods/login_manager/backends.py | UTF-8 | 918 | 2.65625 | 3 | [] | no_license | from django.conf import settings
from django.contrib.auth.hashers import check_password
from home.models import Users
class UserBackend:
def authenticate(self, request, username=None, password=None):
try:
print("Trying to get user!")
user = Users.objects.get(email=username)
... | true |
83df416047be5ca2d3633790b341e1157fad7ff3 | Clobbster/test_scrape | /test_scrape.py | UTF-8 | 895 | 2.859375 | 3 | [] | no_license | from selenium import webdriver
from bs4 import BeautifulSoup
import pandas as pd
browser = webdriver.Firefox()
products = [] #List to store name of products
prices = [] #List to store prices of products
ratings = [] #List to store the ratings of products
browser.get("https://www.flipkart.com/laptops/~buyback-gua... | true |
22f70d3487e09b20f9d67462aeaade3f87df919c | wronrohn/AutoMLFinance | /AutoML Finance.py | UTF-8 | 5,303 | 2.875 | 3 | [] | no_license | import quandl
import random as rand
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#initialization of parameters
dow30=["MMM","AXP","AAPL","BA","CAT","CVX","CSCO"]
action=[(1,0,0,0,0,0,0),(0,1,0,0,0,0,0),(0,0,1,0,0,0,0),(0,0,0,1,0,0,0),(0,0,0,0,1,0,0),(0,0,0,0,0,1,0),(0,0,0,0,0,0,1)]
e... | true |
9e4f5e049bb99660b4d9671e460add6029047b15 | PacktPublishing/QGIS-Python-Programming-Cookbook-Second-Edition | /Chapter03/B06246_03_19a-gpkg.py | UTF-8 | 702 | 2.578125 | 3 | [
"MIT"
] | permissive | # Exporting a geopackage
# https://github.com/GeospatialPython/Learn/raw/master/rivers.zip
import os
from osgeo import ogr
# Path to the shapefiles
pth = "/qgis_data/rivers/"
# Create the base geopackage
gpkg = os.path.join(pth + "rivers.gpkg")
ds = ogr.GetDriverByName("GPKG").CreateDataSource(gpkg)
# Add the firs... | true |
0d104fc8171922040878ff2d9abb6d84b1fc4619 | athallahmaajid/Random-Project | /GUIcalculator.py | UTF-8 | 4,022 | 3.171875 | 3 | [] | no_license | from tkinter import *
import tkinter.messagebox
master = Tk()
master.title('Basic Calculator')
large_font = ('Verdana', 10)
isi_input = StringVar()
input_place = Entry(master, textvariable=isi_input, borderwidth=5, width=50, font=large_font)
input_place.grid(row=0, column=0, columnspan=3, padx=10, pady=10)
input_place... | true |
9bb0cf2d466b4bf08b20286e5424e86f8abaa173 | memerzian/grocery-list | /app/models.py | UTF-8 | 2,018 | 2.5625 | 3 | [] | no_license | from app import db
class Unit(db.Model):
__tablename__ = 'unit'
__table_args__ = ({"schema": 'grc'})
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64))
ingredients = db.relationship('Ingredient', backref='author', lazy='dynamic')
class Ingredient(db.Model):
__tablen... | true |
0482c80c0886d59df92664e484a329c94ff8b96b | carolinegsun/NetPAS | /code/probesim/topology/weighting.py | UTF-8 | 6,820 | 3.3125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import networkx as nx
from .. import util as ps
def add_edge_weights_from_paths(G, P, edge_attr_name='weight', use_default=True, default=0):
"""
Assigns weights to edges in G, such that the weight of edge e is the number of paths in P in which e appears.
Optionally control how weights are set for edges t... | true |
2df368db999f19b048de1570ecbe27083eba0c7f | lfbessegato/Treinamento_Python_CVideo | /exercicios/ex025.py | UTF-8 | 202 | 4.0625 | 4 | [] | no_license | print('Exercício: 025 - Procurando uma string dentro da outra')
nome = str(input("Digite seu nome completo: ")).strip()
print("O {} tem Silva no Nome? ".format(nome.title()),("silva" in nome.lower()))
| true |
8743616712045f7184f2647b2c5cc08e4cb942d2 | Ledoux/ShareYourSystem | /Pythonlogy/draft/Inspecter/01_ExampleDoc.py | UTF-8 | 422 | 2.703125 | 3 | [
"MIT"
] | permissive | #ImportModules
import ShareYourSystem as SYS
#define
@SYS.InspecterClass()
class MakerClass(object):
def default_init(self,
_MakingMyStr,
_MakingMyInt=0,
**_KwargVariablesDict
):
object.__init__(self,**_KwargVariablesDict)
def do_make(self):
#str
self.MadeMyStr=str(self.MakingMyStr)
#print
print... | true |
620f7f2008b76bc69f4e583f5f12235ea863d33e | gitter-badger/python_me | /exercise/20160907/test_pickle.py | UTF-8 | 428 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
#-*- coding: utf-8 -*-
# File Name: test_pickle.py
# Created Time: Wed Sep 7 07:04:06 2016
__author__ = 'Crayon Chaney <mmmmmcclxxvii@gmail.com>'
import pickle
from print_lol import print_lol
mlist = []
for i in range(20):
mlist.append(i)
with open('mydata.pickle','wb') as savedata:
pick... | true |
b4935ba2b7d8c12d19c56c0b00820d9fae993f39 | nishanthegde/bitesofpy | /50/search.py | UTF-8 | 6,031 | 3.09375 | 3 | [] | no_license | from collections import namedtuple
from datetime import datetime, date
import time
import feedparser
# import os
# local = os.getcwd()
# file = os.path.join(local, 'py_feed.txt')
FEED = 'http://projects.bobbelderbos.com/pcc/all.rss.xml'
Entry = namedtuple('Entry', 'date title link tags')
class AttrDi... | true |
fb6a4469baffe35dfbc07aeeff0b953aa18ff1d4 | warbelt/dedupe_test | /src/dedup_test.py | UTF-8 | 6,248 | 2.84375 | 3 | [] | no_license | import csv
import cProfile
import dedupe
import src.dedup_config as CONFIG
from src.dedup_utils import *
# Lee los datos a deduplicar de un CSV y crea un diccionario de records.
# La clave es un record ID único y el valor es un diccionario con los datos
# Preprocesa los campos
def read_messy_data(filename):
try... | true |
fcf2f42dd1b8495dc55faa4d18fe683ab6ad3143 | Milstein-Corp/exercises | /longest-palindromic-substring/dyn.py | UTF-8 | 4,067 | 3.484375 | 3 | [] | no_license | class Solution(object):
def longestPalindrome(self, s):
"""
:type s: str
:rtype: str
"""
oddpals = [[i] for i in range(len(s))]
winner = 0
growing = True
while (growing):
# grow
growing = False
for pal in oddpals:
... | true |
ff2957e2f31558c9e38dceb4e2991094ffc95a1b | rfhits/Data-Structure-BUAA | /0-OnlineJudge/13-2020秋季第十一次练习/2-最少布线.py | UTF-8 | 2,457 | 3.515625 | 4 | [] | no_license | # 【问题描述】
# 北航主要办公科研楼有新主楼、逸夫楼、如心楼、办公楼、图书馆、主楼、一号楼等等;
# 北航网络中心计划要给相关建筑物间铺设光缆进行网络连通,请给出用料最少的铺设方案。
# 编写程序输入一个办公区域分布图及建筑物之间的距离,计算出用料最少的铺设方案(只有一组最优解,不用考虑多组解)。
# 【输入形式】
# 办公区域分布图的顶点(即建筑物)按照自然数(0,1,2,n-1)进行编号,从标准输入中首先输入两个正整数,分别表示线路图的顶点的数目和边的数目,然后在接下的行中输入每条边的信息,每条边占一行,具体形式如下:
# <n> <e>
# <id> <vi> <vj> <weight>
# ...
# 即顶... | true |
f97274acf7fa7b46172d1225e4be7877f7406c63 | GourBera/ProjectPython3 | /ProjectPython3/DataScience_Basic/Matrix.py | UTF-8 | 244 | 3.421875 | 3 | [] | no_license | import numpy
a = [1,2,3,4,5]
b = [1,2,3,4,5]
print(numpy.dot(a,b)) #(1*1)+(2*2)+......
a = [1,2]
b = [[2,4,6],
[3,5,7]]
print(numpy.dot(a,b))
a = [[2,4,6],
[3,5,7]]
b = [[8],
[9],
[10]]
print(numpy.dot(a,b))
| true |
49217e7fe6a6693ab64b409f98f4c15ecca6c6b1 | hulaba/capstone-project | /src/python/callbacks.py | UTF-8 | 3,419 | 2.859375 | 3 | [
"MIT"
] | permissive | import keras
import numpy as np
class BatchLogger(keras.callbacks.Callback):
"""Custom keras callback to record the results more frequently"""
def __init__(self,batch_f,epoch_f,batchInterval,metrics):
"""Initialize the batch Logger.
Parameters
----------
batch_f : String
... | true |
5f7dfad80d17836615b9b693417f6343f7a35dff | crystal22/category_based_RS | /LCF_2.py | UTF-8 | 4,938 | 2.65625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from datetime import datetime
from sklearn.metrics.pairwise import cosine_similarity
import pickle
import operator
import sys
'''
Shuffle pandas dataframe
'''
def shuffle(df, n=1, axis=0):
df = df.copy()
for _ in range(n):
df.apply(np.random.shuffle, axis... | true |
55824699be58f36fe33a38906b29fca834ec82df | Jody-Lu/Array | /56_Merge_Intervals/merge.py | UTF-8 | 1,016 | 3.40625 | 3 | [] | no_license | class Interval(object):
def __init__(self, s=0, e=0):
self.start = s
self.end = e
class Solution(object):
def merge(self, intervals):
"""
:type intervals: List[Interval]
:rtype: List[Interval]
"""
res = []
intervals.sort(key=lambda x: x.start)
... | true |
83a31b91639a795930277db63d2c1171397b269e | VishalJadhav90/ProblemSolving | /FindCycleInDirected.py | UTF-8 | 1,044 | 3.5 | 4 | [] | no_license | class Solution:
def __init__(self):
pass
def dfs(self, node):
self.whites.remove(node)
self.greys.add(node)
for adjnode in self.adj[node]:
if adjnode not in self.greys:
return self.dfs(adjnode)
else:
return True
sel... | true |
22d966e1d476807043e919231d95ed41bfda8df1 | sahiljajodia01/Competitive-Programming | /leet_code/remove_nth_node_from_linked_list.py | UTF-8 | 1,615 | 3.78125 | 4 | [] | no_license | # https://leetcode.com/explore/interview/card/top-interview-questions-easy/93/linked-list/603/
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
############### Two pass approach #####################
class Solution:
def removeNt... | true |
90552edc5be670a8831e7107b521e72f9ce88ac9 | cocm1324/algo | /leetcode/30day/w2_04.py | UTF-8 | 709 | 3.765625 | 4 | [] | no_license | import collections
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def diameterOfBinaryTree(self, root: TreeNode):
self.answer = 0
if not root: return 0
def height(node: TreeNode):
lh, rh = 0, 0
if node.left:
lh = height(node.left) + 1
... | true |
ee552cc76e0c3fcc854e283c91231bb144b141c1 | Sorck228/Interactive-Object-Segmentation-Using-Deep-Learning-Techniques | /COCO_sampler.py | UTF-8 | 1,988 | 2.96875 | 3 | [] | no_license | import os
import random
import shutil
import pathlib
import math
# program to randomly sample images from directive into a test folder
# moves the file from training folder into test image and mask folder
# create empty file list
files_list_img = []
files_list_mask = []
images_to_copy = []
masks_to_copy = []
train_d... | true |
4955431c7eb772492ccd454f47843c6ef0638515 | jihaikang/2021- | /4_17/1.py | UTF-8 | 472 | 3.5625 | 4 | [] | no_license | # 旋转数组
# 循环移位问题
# 给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。
class Solution():
def shuzu(self,A):
n = len(A)
k %= n # 取余
def reverse(i, j):
while i < j:
A[i], A[j] = A[j], A[i]
i += 1
j -= 1
reverse(0, n - k - 1) # 三次反转
... | true |
dcd03d87088490de99c9ba090342f121b2628fa3 | Birdboy821/python | /graphpaper.py | UTF-8 | 4,783 | 3.359375 | 3 | [] | no_license | #graphpaper.py
#christopher amell 12-13-18
#standard four-quadrant coordinate graph paper
from graphics import *
def main():
win = GraphWin('graphy', 1000,1000)
win.setCoords(-1000, -1000, 1000, 1000)
center = Point(0, 0)
## axises
xaxis = Line(Point(-8000, 0), Point(8000, 0))
xaxis.draw(win)
yaxis =... | true |
b0a55e611a18b0b42f77d8bf09065998c3e9a5b4 | waikato-datamining/wai-bynning | /src/wai/bynning/_Binnable.py | UTF-8 | 1,004 | 3.34375 | 3 | [
"MIT"
] | permissive | from abc import abstractmethod
from typing import Generic, Iterable, Iterator
from ._typing import KeyType
class Binnable(Generic[KeyType]):
"""
Interface for objects that can be sorted into bins.
"""
@property
@abstractmethod
def bin_key(self) -> KeyType:
"""
Gets the bin key... | true |
bbe3acef4bef2e87fa5ae8425d74c5c07cd8d955 | world9781/polka_curses | /polka_curses/views/expert_page.py | UTF-8 | 2,029 | 2.8125 | 3 | [
"MIT"
] | permissive | import urwid
from urwid import PACK
from .books_page import BooksPage
class ExpertPage(urwid.WidgetWrap):
def __init__(self, expert):
self.expert = expert
self.is_two_columns = expert.favorites and expert.wrote_about
self.favorites = self.build_favorites() # type: BooksPage
self.... | true |
0e1b33e5ef2a58dac30af1f678c1e00bbd6d4653 | TheAlchemistNerd/Python_Fundamentals | /PyTricks/test.py | UTF-8 | 241 | 3.578125 | 4 | [] | no_license | def fn1():
print('Hello: ', end = '')
return (1)
def fn2():
print('Goodbye', end = '')
return(2)
def test(func):
print('testing', func.__name__, 'Output =', func())
def main():
print('In program', __file__)
test(fn1)
test(fn2)
| true |
a9da8c1e3b57b3831b4ae55dacf450ba96d9dda4 | hanco/april | /main.py | UTF-8 | 1,049 | 3.046875 | 3 | [] | no_license | import itertools
from tqdm import tqdm
n = 20
k = n - 7
wheel_of_choice = list(range(1, n+1))
pos = -1
def find_combinations():
global combinations
combinations = []
for i in itertools.combinations(range(1,n+1), k):
combinations.append(i)
return combinations
def step(q, wheel):
global po... | true |
b82126d7999b89f77173910e1814c9927723c0da | jerryq27/Cheatsheets | /Tutorials/Languages/Python/10AppsCourse/App04_PersonalJournal/program.py | UTF-8 | 1,675 | 3.921875 | 4 | [] | no_license | from App04_PersonalJournal import journal
from Common import app
def run_event_loop():
print("What do you want to do?")
journal_name = "Default"
journal_data = journal.load(journal_name) # [] or list() can also be used.
user_input = "null"
while user_input != "X" and user_input: # Same as sayi... | true |
e51bc6f10ca9f399514fe70a1c96ab2c91e8c434 | ultmaster/deeper-insights-weight-sharing | /figures/typesetting.py | UTF-8 | 1,115 | 2.84375 | 3 | [
"MIT"
] | permissive | import os
from argparse import ArgumentParser
import numpy as np
def tuple_four_display(tp):
ret = "${:.4f} _{{\\pm {:.4f}}}$".format(tp[0], tp[1])
return ret
def tuple_two_display(tp):
return "${:.4f}$ & ${:.4f}$ & ${:.4f}$".format(tp[0], tp[2], tp[3])
if __name__ == "__main__":
parser = Argumen... | true |
7dd5235144e8831a6e693e98b56dbb8b629546eb | jichilen/python | /problem/_9_stack_to_queue.py | UTF-8 | 1,059 | 3.703125 | 4 | [] | no_license | # 常见的有两种方式
# 第一种是循环列表
# 第二种是两个栈转列表
def deco(fun):
def inf(*args,**kwargs):
cls = args[0]
try:
re=fun(*args,**kwargs)
print(re)
except:
fun(*args,**kwargs)
print(cls.s1)
print(cls.s2)
print()
return inf
class Stack2que():
d... | true |
72be4a4b6cb481c5ed39543b395153d4bbcb793a | lyh543/Some-Codes | /2020/uestc-library-downloader/main.py | UTF-8 | 5,708 | 2.671875 | 3 | [
"MIT"
] | permissive | import json
import sys
import requests
import os
import img2pdf
CONFIG_FILE = './config.json'
OUTPUT_ROOT_DIRECTORY = './output_textbooks'
PAGE_TYPE = [ # 不同种图片的链接不同
['封面页', 'cov', 0],
['书名页', 'bok', 0],
['版权页', 'leg', 0],
['前言', 'fow', 0],
['目录', '!', 0],
['正文', '', 0]
]
# 读取... | true |
ef241467c1de22253e9c78662e5ed2d3c868b72b | mwctahoe/pythonHardWay | /ex29.py | UTF-8 | 440 | 3.203125 | 3 | [] | no_license | people = 20
cats =30
dogs = 15
if people < cats:
print "TOO MANY CATS!"
if people > cats:
print "HUZZAH CATS SUCK"
if people < dogs:
print "DOGS RULE"
if people > dogs:
print "cool story bro"
dogs +=5
if people >= dogs:
print "homeslice greater or equal to dogs"
if people <= dogs:
print "GATORS BITCHES ... | true |
4de52dc43cfc51554ca3238b67810805e017d318 | yell/python-utils | /utils/one_hot.py | UTF-8 | 1,432 | 3.328125 | 3 | [
"MIT"
] | permissive | import numpy as np
def one_hot(y, n_classes=None):
"""
Convert `y` from {0, ..., `n_classes` - 1} to one-hot encoding.
Examples
--------
>>> y = [2, 1, 0, 2, 0]
>>> one_hot(y)
array([[0., 0., 1.],
[0., 1., 0.],
[1., 0., 0.],
[0., 0., 1.],
[1., 0... | true |
b7e9ae57191f0342b975207741f84775d5151a50 | evhub/rabbit | /rabbit/data.py | UTF-8 | 32,511 | 3.0625 | 3 | [] | no_license | #!/usr/bin/python
# NOTE:
# This is the code. If you are seeing this when you open the program normally, please follow the steps here:
# https://sites.google.com/site/evanspythonhub/having-problems
#-----------------------------------------------------------------------------------------------------------------------... | true |
4a2cb20163933313f393213925f5e0979434b1f2 | tbille/discourse-site | /generate.py | UTF-8 | 1,973 | 2.796875 | 3 | [] | no_license | #! /usr/bin/python3
import sys
import os
import errno
import yaml
import requests
from shutil import copyfile
def generate_site():
try:
dist = 'dist'
os.makedirs(dist)
files_to_copy = [
"_config.yml",
"Gemfile",
"404.html",
"Gemfile.lock",
... | true |
7c81e5536324122240e31de1b06451eaa08a5efc | JamesFreemantle/Final-Year-Project | /4. Bitcoin RSI.py | UTF-8 | 14,857 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[10]:
# reading csv files
import pandas as pd
df_daily = pd.read_csv('C:/College/Final Year Project/daily_cleaned.csv')
# setting index to date
df_daily = df_daily.set_index('Date')
# changing index type to DateTimeIndex
df_daily.index=pd.DatetimeIndex(df_daily.index)
df_we... | true |
0497351ceae52f302974a181348e4987daf1aede | beirving/mysql-to-bigquery | /src/mysql_bigquery/adapters/storage.py | UTF-8 | 3,121 | 2.71875 | 3 | [
"MIT"
] | permissive | import os
from typing import Union
import google
from google.cloud import storage
from google.oauth2 import service_account
from google.api_core import exceptions
class StorageAdapter:
def __init__(self, credentials: service_account):
self.service_account = credentials
self.client = None
s... | true |
0e5020d6a69ee47098b0a7fa25e719605b115e5e | rogfrich/soduku2 | /exceptions.py | UTF-8 | 332 | 2.765625 | 3 | [] | no_license | class UnableToSolveError(Exception):
"""
Raised when a solving strategy does not result in a change to any cells.
"""
pass
class NumberNotInPossibleValuesError(KeyError):
"""
Raised when the program tries to remove a possible value from a cell that isn't in that cell's possible values.
""... | true |
a6161496c483940e650b8dd37df99964f73107e3 | Enchan1207/CANClientLib | /src/CANClientLib/canClient.py | UTF-8 | 1,685 | 2.515625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #
# CANクライアントライブラリ
#
import can
from .canBusListener import Listener
# RPi.GPIOが存在するか確認する
isPiImplemented = False
try:
import RPi.GPIO as GPIO
isPiImplemented = True
except ImportError:
print("Couldn't import RPi.GPIO. Some features about Raspberry Pi will be limited.")
class Client():
# Initializer 何... | true |
c5b1241fba68746412cbe646ca59ae58d158f9ac | wlsdzyzl/GAMES102 | /hw4/bezier.py | UTF-8 | 2,123 | 3.03125 | 3 | [] | no_license | import numpy as np
# use bezier curve to interpolate
def deCasteljau_recur(points, t):
if len(points) == 1:
return points[0]
new_points = []
for i in range(len(points) - 1):
new_points.append((1 - t) * points[i] + t * points[i+1])
return deCasteljau_recur(new_points, t)
class bezier:
... | true |
6b72500932e7553a825b42b2843972b76634f798 | team-ocean/veros | /veros/tools/assets.py | UTF-8 | 4,584 | 2.8125 | 3 | [
"MIT"
] | permissive | import os
import json
import shutil
import hashlib
import urllib.parse as urlparse
import requests
from veros.tools.filelock import FileLock
from veros import logger, runtime_state
ASSET_DIRECTORY = os.environ.get("VEROS_ASSET_DIR") or os.path.join(os.path.expanduser("~"), ".veros", "assets")
class AssetError(Exc... | true |
2e5f9974a69a2f4258c3e34f61d96ef8fc8b5055 | SofiaLouisy/Plants-vs-Zombies-discarded | /run.py | UTF-8 | 1,320 | 3.28125 | 3 | [] | no_license | #from Actor.Zombie.Zombie import *
#from Actor.Plant.Plant import *
from Board.Board import Board
import Actor
import pygame
import sys
#pygame.examples.aliens
#Initialize all internal modules
pygame.init()
size = width, height = Board.size
#Inititing zombie
zombie = Actor.Zombie()
plant = Actor.Plant()
#Setting ba... | true |
465f22f7f5aadc303ed7c5386a52cb80c086634a | LazyerIJ/Algorithm | /Problem/BakJoon/bj_11721.py | UTF-8 | 152 | 3.359375 | 3 | [] | no_license | input_str=input()
length=len(input_str)
for step in range(0,length//10):
print(input_str[:10])
input_str=input_str[10:]
print(input_str,end='')
| true |
038dbb92ce71169a92d7ce511e1ea493a33258fc | bendavidsteel/final-year-project | /Misc/ConvolutionalNeuralNetworks.py | UTF-8 | 7,193 | 2.671875 | 3 | [] | no_license | # adapted from Alejandro Escontrela
# https://github.com/Alescontrela/Numpy-CNN
import numpy as np
import gzip
# Needs extra light sources, normal weights with tunable activation function, (effectively bias weight)
# Convolutional
class ConvTuneLorentzNetwork:
def __init__(self, x, y, full_layer_size = 128, alpha=0... | true |
93e294964d7196cf4f3529b0aa32ed9a653015aa | ubeydtalha/bitirme-projesi | /trash/d.py | UTF-8 | 581 | 3.734375 | 4 | [
"MIT"
] | permissive | def star(func):
def inner(*args, **kwargs):
print("*",args,kwargs)
func(*args, **kwargs)
print("*" * 30)
return inner
def percent(func):
def inner(*args, **kwargs):
print("%",args,kwargs)
func(*args, **kwargs)
print("%" * 30)
return inner
def r(func):
... | true |
2887ac60dda9b02739dc794e599551d714491f7f | szabgab/Learning-Python | /Basic/Day 10/Sample questions/Sample program 4.py | UTF-8 | 928 | 3.96875 | 4 | [] | no_license | names=["Aatmaj", "123", "zephyr","163","1723"]
#1
print("Names in the list :")
print(names)
print("\n Frequency of 'zephyr' in the list\n")
print(names.count("zephyr"))
print("\n Index of '163' in the list\n")
print(names.index("163"))
print("Adding A in the list")
names.append("A")
print("No. of values in the list ... | true |