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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
af2dad5cd4bc92bfcd3b5067a7117018b11e6fc3 | Python | darshilthakore/catalogue-back | /catalogue/models.py | UTF-8 | 780 | 2.53125 | 3 | [] | no_license | from django.db import models
# Create your models here.
class Category(models.Model):
name = models.CharField(max_length=32)
def __str__(self):
return f"{self.name}"
class Subcategory(models.Model):
name = models.CharField(max_length=32)
category = models.ForeignKey(Category, on_delete=models... | true |
59a8b41888a2e057025b4ffd683f97335ba3da7c | Python | lolamathematician/AOC_2019 | /2/2.1.py | UTF-8 | 718 | 3.5625 | 4 | [] | no_license | with open("input.txt", "r") as f:
codes = [int(i) for i in f.read().split(",")]
def main():
for opcode_position in range(0, len(codes)-1, 4):
if codes[opcode_position] == 99:
return codes[0]
else:
input_position_1 = codes[opcode_position+1]
input_position_2 = codes[opcode_position+2]
output_position ... | true |
bb539656cdc7eb538768299822dbd751a04d75ce | Python | voidlessVoid/advent_of_code_2020 | /day_15/mischa/solution.py | UTF-8 | 1,426 | 2.859375 | 3 | [] | no_license | import os
import sys
import pandas as pd
import numpy as np
import math
import datetime
import operator
from copy import deepcopy
from collections import Counter, ChainMap, defaultdict, deque
from itertools import cycle
from more_itertools import locate
from functools import reduce
CURRENT_DIRECTORY = os.path.dirname(... | true |
ecab57d896892b91b4352049e57bb4bd4b8d986e | Python | sebastiandres/mat281_2018S2 | /m01_introduccion/02_data_science_toolkit/labFunctions.py | UTF-8 | 1,108 | 3.609375 | 4 | [
"BSD-3-Clause",
"MIT"
] | permissive | def tribonacci(n):
if n in (1, 2, 3):
return 1
else:
return tribonacci(n - 1) + tribonacci(n - 2) + tribonacci(n - 3)
def tallest_player(nba_player_data):
height_dict = {}
for player, value in nba_player_data.items():
ft, inch = value[3].split('-')
tmp_height = ... | true |
8d24e5fda74320b877045ccc78b27c6e7de361a2 | Python | xiao2912008572/Appium | /StoneUIFramework/public/common/readconfig.py | UTF-8 | 408 | 2.546875 | 3 | [] | no_license | __author__ = 'xiaoj'
import configparser
class Config:
def __init__(self,configPath):
self.configPath = configPath
def get_PATH(self,path_Section,path_NO):
cf = configparser.ConfigParser()
cf.read(self.configPath)
# path_section填写"PATH_YUNKU"
# 此处path_config = "path_00... | true |
969f525ec7e65683a9abd6e9448de56a780031f7 | Python | NandaGopal56/Programming | /PROGRAMMING/python practice/oops-3.py | UTF-8 | 355 | 3.421875 | 3 | [] | no_license | class test:
def m1(self):
print('i am non static method')
@classmethod
def m2(cls):
print('i am class method')
@staticmethod
def m3():
print('i am static method')
def main():
obj=test()
test.m1(obj)
obj.m1()
test.m2()
obj.m2()
... | true |
f904d1b7d7b7b0e997884274f33a4918e96584ad | Python | astreltsov/firstproject | /Eric_Matthes_BOOK/DICTIONARY/poll.py | UTF-8 | 335 | 2.765625 | 3 | [] | no_license | favorite_languages = {
'jen': 'python',
'sarah': 'c',
'edward': 'ruby',
'phil': 'python'
}
coders = ['jen', 'edward', 'peter']
for coder in coders:
if coder in favorite_languages.keys():
print(f"{coder.title()}, thank you for taking poll!")
else:
print(f"{coder.title()}, need to ... | true |
5ad511514dcf2df93c6c27fc7c1a9471e196fd38 | Python | martintb/typyCreator | /molecules/stickyBead.py | UTF-8 | 788 | 2.609375 | 3 | [
"MIT"
] | permissive | from molecule import molecule
import numpy as np
def create(*args,**kwargs):
return bead(*args,**kwargs)
class bead(molecule):
def __init__(self,
bigDiameter=1.0,
bigType='A',
stickyDiameter=1.0,
stickyType='B',
stickyBondType='bondA',
... | true |
7a97aaca4afb1e5e23a19ba19307a4f8e8f4ce7e | Python | Zillow-SJ/Cluster_Zillow | /explore_final.py | UTF-8 | 10,683 | 2.734375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import pandas_profiling
import prep
import seaborn as sns
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
# df = prep.prep_df()
# df_2 = df.drop(columns = ["fips", "latitude", "longitude", "regionidcity", "regionidcounty", "regionidzip"])
# explore_df = pd.Seri... | true |
db691d0b4552ff99d0da63fa2617f073bb265eb0 | Python | StevenChen8759/DSAI_2021_HW04 | /trainer.py | UTF-8 | 8,753 | 2.65625 | 3 | [] | no_license | import time
import argparse
from loguru import logger
import pandas as pd
from utils import csvIO, modelIO
from preprocessor import (
sales_feature,
data_operation,
data_integrator,
data_cleaner,
data_normalizer,
)
from predictor import DTR, XGBoost, kMeans
def main_old():
total_month_count ... | true |
7c8906d675445eef4d3a953dcc28893c456b30f6 | Python | riklauder/ProjectMokman | /src/astartwo.py | UTF-8 | 4,905 | 3.453125 | 3 | [] | no_license | #Currently in use by Ghosts in ghosts.py
import numpy as np
import heapq
class Node:
"""
A node class for A* Pathfinding
parent is parent of the current Node
position is current position of the Node in the maze
g is cost from start to current Node
h is heuristic based estim... | true |
b4f1f4eea9ce750cde5a609c0db3196932a6e89b | Python | antoinebeck/Codingame | /Puzzles/Python/Easy/horse_racing_duals.py | UTF-8 | 459 | 3.203125 | 3 | [] | no_license | ## Array optimisation from codingame "Horse Racing Duals" puzzle
## https://www.codingame.com/training/easy/horse-racing-duals
## solution by Antoine BECK 03-15-2017
import sys
import math
n = int(input())
pi = []
diff = 10000000
tmp = 0
for i in range(n):
pi.append(int(input()))
pi.sort() # Using the sort functi... | true |
3883852ad50bbb1b1279aac8f484af200ce4e7d6 | Python | LuanReinheimer/Work_Space-Python | /CursoPython/Ex084 anotacoes.py | UTF-8 | 733 | 3.921875 | 4 | [] | no_license | pessoas = [['lucas',23], ['luan',23], ['bebeto', 25]]
for nome in pessoas:
print(f' {nome[0]} tem {nome[1]} anos de idade. ')
#-----------------------------------------------------------------------------
galera = []
dado = []
totalmaior = 0
totalmenor = 0
for c in range(5):
dado.append(str(input('NOME: '))... | true |
195d7c2004dac773b8f569dcc61865a09e0edcbd | Python | mkdvice/Python-Iniciante- | /ReajusteSalarial.py | UTF-8 | 353 | 3.65625 | 4 | [] | no_license | def salario_reajuste(salario, reajuste): # craição da função
return salario * reajuste // 100 + salario #calculo do reajuste
reajuste = salario_reajuste(float(input("Digite o valor do salário: ")), float(input("Digite o valor do reajuste: "))) # entrada dos valores
print("Seu salário agora é R${}".format(reajuste)... | true |
2f532d4365a8dd7ad59f53cfb0a9567c4f8b96e9 | Python | jfpio/TKOM-Interpreter | /interpreter/models/constants.py | UTF-8 | 3,285 | 2.890625 | 3 | [] | no_license | from dataclasses import dataclass
from enum import Enum
from typing import Union, Type
from interpreter.token.token_type import TokenType
@dataclass
class CurrencyType:
name: str
@dataclass
class CurrencyValue(CurrencyType):
value: float
def __add__(self, other):
return CurrencyValue(self.name... | true |
dbd88e6b83d319de373314f4645b7061456a49e4 | Python | Satwik95/Coding-101 | /LeetCode/Top 100/sub_array_sum.py | UTF-8 | 707 | 3.21875 | 3 | [] | no_license | class Solution(object):
def subarraySum(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
#return sum(sum(nums[j:i]) == k for i in range(len(nums)+1) for j in range(i))
# have to keep track of how many time a particular sub array sum has a... | true |
79a15354b49f44d3a715e41ad0609820e3d8a4c9 | Python | dixantmittal/image-clustering-using-expectation-maximization | /exp_max.py | UTF-8 | 2,343 | 2.84375 | 3 | [
"MIT"
] | permissive | import numpy as np
from matplotlib import image
import matplotlib.pyplot as plt
from k_means import *
import scipy.stats as st
from tqdm import tqdm
def initialize_params(k, d):
pi = np.random.rand(k)
# normalize pi
pi = pi / np.sum(pi)
mew = np.random.randn(k, d) * 100
# identity matrix
sig... | true |
e6a32147efb576d8b7348c2ac71009e6a2d8e49f | Python | vainotuisk/valikkursuse_materjalid | /Pygame/kliinik2.py | UTF-8 | 251 | 3.234375 | 3 | [] | no_license | ## Väino Tuisk
## Kliinik 2 - nulliga jagamine ja tulemuse täpsus
jagatav = float(input("sisesta jagatav: "))
jagaja = float(input("sisesta jagaja: "))
if (jagaja == 0):
print ("viga!")
else:
print ("Jagatis on: " + str(float(jagatav/jagaja)))
| true |
841f326894e90fd82ad008ca98bdbfe53315fc97 | Python | Energy1190/railroads-maps | /railmap.py | UTF-8 | 46,249 | 2.703125 | 3 | [] | no_license | import math
import pickle
from parserus import *
from database import *
class Station():
def __init__(self, tuple_obj):
assert len(tuple_obj) == 9
self.name = tuple_obj[0]
self.coordX = tuple_obj[-2]
self.coordY = tuple_obj[-1]
self.coords = (self.coordX, self.coordY)
... | true |
76d4e8a0c297775cece57c9453ef381abe4ab549 | Python | martwo/ndhist | /test/constant_bin_width_axis_test.py | UTF-8 | 2,407 | 3.015625 | 3 | [
"BSD-2-Clause"
] | permissive | import unittest
import numpy as np
import ndhist
class Test(unittest.TestCase):
def test_constant_bin_width_axis(self):
"""Tests if the constant_bin_width_axis class works properly.
"""
import math
stop = 10
start = 0
width = 1
axis = ndhist.axes.linear(sta... | true |
473c9ae4b2a8a2a10642546c1f77384ab49f2027 | Python | AlvinJS/Python-practice | /caesar.py | UTF-8 | 445 | 3.84375 | 4 | [] | no_license | # alphabet = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]
def encrypt (text,s):
result = ""
for i in range (len(text)):
char=text[i]
if (char.isupper()):
result += char((ord(char) +s - 65)%26 + 65)
else:
result += char((ord(char) + s-97)%26 + 97)
return result
w... | true |
99dbea9918329739c5a198efcab44586136770d0 | Python | cris-cs/Titanic | /Main3.py | UTF-8 | 1,191 | 3.515625 | 4 | [] | no_license | from Titanic01 import sexe, survided, name, age
nbPassagers = len(sexe)
def analyseTitanic(totalPassagers, sexePassager):
nbSurvivants = 0
nbPassagersCritere = 0
for passager in range(nbPassagers):
if survided[passager] == 1:
nbSurvivants += 1
if sexe[passager] == sexePass... | true |
2a93e72ffb964b6672667b3c8b6f223bc024069d | Python | mathewdgardner/sklearn-porter | /sklearn_porter/utils/Shell.py | UTF-8 | 607 | 2.84375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import subprocess as subp
class Shell(object):
@staticmethod
def call(command, cwd=None):
if isinstance(command, str):
command = command.split()
if isinstance(command, list):
return subp.call(command, cwd=cwd)
return None
@staticme... | true |
3e056101d6d0d12cbec35bd70a0e8e5d07629e2f | Python | messierspheroid/instruction | /D26 - NATO alphbet/pandas_for_loop.py | UTF-8 | 829 | 3.3125 | 3 | [] | no_license | student_dict = {
"student": ["Angela", "James", "Lily"],
"score": [56, 76, 98],
}
# # looping through dictionaries
# for (key, value) in student_dict.items():
# print(key)
# print(value)
import pandas
student_data_frame = pandas.DataFrame(student_dict)
# print(student_data_frame)
# # loop through a ... | true |
067398217e8d02458390a83533edfadd741b6cf5 | Python | mglavitsch/jumbler-python | /tests/test_jumble.py | UTF-8 | 1,667 | 2.828125 | 3 | [
"MIT"
] | permissive | import unittest
from jumblepkg.jumble import Jumbler
class TestJumbler(unittest.TestCase):
def test_indices(self):
# print(sys.getdefaultencoding())
jumbler = Jumbler(" ")
indices = jumbler.get_indices()
self.assertEqual(indices, [])
jumbler.text = "Zaphod Beeble... | true |
343f78f1f7c9a42d18e89f618abf203cb4ee4dd3 | Python | Vikas-KM/python-programming | /partial_func.py | UTF-8 | 112 | 2.796875 | 3 | [] | no_license | from functools import partial
def multiply(x, y):
return x * y
db1 = partial(multiply, 2)
print(db1(3))
| true |
00f15580c91354e88e889f14c97bc492ba560d80 | Python | sethhardik/face-recognition- | /train.py | UTF-8 | 1,462 | 2.734375 | 3 | [] | no_license | import numpy as np
from sklearn.model_selection import train_test_split
from keras_vggface.vggface import VGGFace
from keras.engine import Model
from keras.layers import Input
import numpy as np
import keras
from keras.layers import Dense
# extracting file saved by data_prep.py
data = np.load('face_data.npz')
x , y... | true |
b8bf56e9fd3c760a5f46de01bfecfd4baf23c1cb | Python | yszpatt/PythonStart | /pythonlearn/train/prac9.py | UTF-8 | 153 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
# coding:utf-8
# 暂停一秒输出。
import time
j = int(input("输入暂停时间:"))
time.sleep(j)
print("计时时间到")
| true |
da05558ba14a3f086a6c05fb454e7d5b3e450a57 | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_1/rbonvall/sheep.py | UTF-8 | 389 | 3.484375 | 3 | [] | no_license | #!python3
def main():
T = int(input())
for t in range(T):
n = int(input())
print("Case #{}: {}".format(t + 1, solve(n)))
def solve(n):
if n == 0:
return 'INSOMNIA'
digits = set(range(10))
i = 0
while digits:
i += 1
m = i * n
while m:
... | true |
318daa2aceee700891dff06bad61ebd07270ac47 | Python | mburq/dynamic_optimization_benchmarks | /src/envs/matching/matching_env.py | UTF-8 | 6,226 | 3.3125 | 3 | [
"MIT"
] | permissive | import networkx as nx
from src.envs.matching.vertex import basic_vertex_generator
from src.envs.matching.taxi_vertex import taxi_vertex_generator
from src.envs.matching.kidney_vertex import unweighted_kidney_vertex_generator
class matching_env(object):
"""
Implements a simple dynamic matching environment,
... | true |
f436dae491ed6cfb16212c1bbbe2e4fdb3e044be | Python | guoshan45/guoshan-pyschool | /Conditionals/02.py | UTF-8 | 106 | 2.75 | 3 | [] | no_license | def isIsosceles(x, y, z):
a = x > 0 and y > 0 and z > 0
return a and (x == y or y == z or z == x)
| true |
664ae376e61201be721af6804da20565b123521b | Python | rifkhan95/karsten | /generalRunFiles/MpiTest.py | UTF-8 | 804 | 2.578125 | 3 | [
"MIT"
] | permissive | from mpi4py import MPI
import numpy as np
import pandas as pd
def fixDataframe(array):
array = comm.gather(array, root=0)
array2 = np.sum(array, axis=0)
return array2
comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()
temp = np.zeros((30,5))
data = pd.DataFrame(temp)
rows = [rank + ... | true |
1eb8f3e5dfa786454bd28102e444cee67605b47f | Python | mustafakadi/pr_watcher | /app/exception_definitions/reg_key_cannot_be_read_error.py | UTF-8 | 372 | 3.203125 | 3 | [
"MIT"
] | permissive | class RegKeyCannotBeReadError(Exception):
"""
Custom exception definition, that will be raised in case of an error in reading process of a registry key
:param msg: The custom message to be shown.
"""
def __init__(self, msg, key_name):
super().__init__("Registry Key Cannot be Read! Ms... | true |
f3148bde324cf1c76bc36e64a4480d1bed8df230 | Python | Giovanacarmazio/Projeto-operadora-e-regiao | /codigo.py | UTF-8 | 415 | 3.09375 | 3 | [
"MIT"
] | permissive | import phonenumbers
from phonenumbers import geocoder , carrier
#Inserir o número com codigo do país e o ddd
phoneNumer = phonenumbers.parse("+5551999999999")
#Procura a operadora
operadora = carrier.name_for_number(phoneNumer, 'pt-br')
#Procura a regiao
regiao = geocoder.description_for_number(phoneNumer, 'pt-br')
... | true |
2f5e412ac36573c31d841d4cc80f4f29bed1a737 | Python | miracleave-ltd/mirameetVol24 | /src/UpdateDeleteBigQuery03.py | UTF-8 | 809 | 2.515625 | 3 | [] | no_license | import os
import OperationObject # 操作対象の設定情報取得
from google.cloud import bigquery
# GCP認証設定
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = OperationObject.GOOGLE_APPLICATION_CREDENTIALS
# BigQueryクライアントAPIの利用宣言
client = bigquery.Client()
# 更新SQL生成
updateQuery = "UPDATE `{0}.{1}.{2}` SET mira_text = '更新' WH... | true |
f4fd27a7355d5253d3208cd6f684adbf9b0a7ce0 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_199/2160.py | UTF-8 | 593 | 3.359375 | 3 | [] | no_license | def solve(pancakes, k):
n = 0
# find a pancake (-)
for i in range(len(pancakes)):
if pancakes[i] == '-':
if i + k > len(pancakes):
return None
new_block = ''.join(['-' if c == '+' else '+' for p in pancakes[i:i+k] for c in p])
pancakes = pancakes[... | true |
7a7e1da61ca78d3f132879a9f4015466ff373c8a | Python | amrayach/pml_streamlit | /app.py | UTF-8 | 3,536 | 2.5625 | 3 | [] | no_license | from predictExplain import ModelsDeploy
import numpy as np
import pandas as pd
import streamlit as st
from spacy.tokens import Doc, Span
from spacy_streamlit import visualize_ner
def to_rgba(hex, val):
val = int(val) * 10
val = abs(val)
val = 255 if val > 255 else val
hex = hex + "{:02x}".format(val)
... | true |
380e290674a1b6fdc635af6215a6fba1ef250671 | Python | CO18325/UNIVARIATE-LINEAR-REGRESSION | /script.py | UTF-8 | 9,231 | 3.546875 | 4 | [] | no_license | import matplotlib.pyplot as plt
plt.style.use('ggplot')
''' %matplotlib inline
%matplotlib inline sets the backend of matplotlib to the 'inline' backend:
With this backend, the output of plotting commands is displayed inline within
frontends like the Jupyter notebook, directly below the code cell that produced
it. ... | true |
34baa5bf047df6437a509d3617678b56fdd1ab14 | Python | kymy86/machine-learning | /nb_trainer.py | UTF-8 | 5,026 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python3
import re
import pickle
import os
from random import randrange
from pathlib import Path
from math import log10
from logger import Logger
class Trainer(Logger):
_DATASET = 'dataset/SMSSpamCollection'
STOREDATA = 'dataset/MemoryTrainingData'
STORETESTDATA = 'dataset/MemoryTestData'
#... | true |
76f69e43d157bd6b7a8cfba0dbba871d90533482 | Python | brandonkim0511/Python | /class/loop.py | UTF-8 | 1,817 | 3.3125 | 3 | [] | no_license | # while 1 == 2 : print("Chaeyoung isnot the most beautiful in Twice ")
# adj = ["red", "big", "tasty"]
# fruits = ["apple", "banana", "cherry"]
#
# for x in adj:
# print(x)
# for y in fruits:
# print(y)
# number1 = [1, 2, 3, 4]
# number2 = [1, 2, 3, 4]
# number3 = [1, 2, 3, 4]
# number4 = [1, 2, 3, 4]
#
# cnt ... | true |
ee8a8a3920b21e40d425ef7e940bb7b24835cdb4 | Python | Aasthaengg/IBMdataset | /Python_codes/p03993/s210070602.py | UTF-8 | 445 | 3.078125 | 3 | [] | no_license | import sys
import collections
def swap(t):
if t[1] < t[0] :
return (t[1],t[0])
else:
return t
n = int(sys.stdin.readline().rstrip())
a = [int(x) for x in sys.stdin.readline().rstrip().split()]
zippeda = list(map(swap,list(zip(range(1,n+1),a))))
zippeda.sort()
c = collections.Counter(zippeda)
... | true |
64aeb331d52223e2b3dce26416ad6fede258ef57 | Python | hacklinshell/learn-python | /进程和线程/do_threadLocal.py | UTF-8 | 1,144 | 3.75 | 4 | [] | no_license | import threading
#一个ThreadLocal变量虽然是全局变量,但每个线程都只能读写自己线程的独立副本,互不干扰。ThreadLocal解决了参数在一个线程中各个函数之间互相传递的问题。
loca_school = threading.local() #全局变量local_school是一个ThreadLocal对象
def process_student():
std = loca_school.student # Thread对它都可以读写student属性 每个属性如local_school.student都是线程的局部变量 可以任意读写而互不干扰,也不用管... | true |
8e743394c2379246bb2b70f092802d3d23dd1709 | Python | kulkarniharsha/my_code | /FAC_SVM.py | UTF-8 | 2,330 | 3.6875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
"""Playing with Harshvardhan's SVM"""
""" Lets see what we have."""
import scipy
import pandas as pd
import matplotlib.pyplot as plt
import sklearn, sklearn.svm
import random
"""We will import data from "final.xlsx" into the Pandas datafr... | true |
3ee525fda461634088fc291225738ac33458a6a9 | Python | abu-bakarr/holbertonschool-web_back_end | /0x00-python_variable_annotations/3-to_str.py | UTF-8 | 171 | 3.40625 | 3 | [] | no_license | #!/usr/bin/env python3
"""convert to string
transform to string a value
"""
def to_str(n: float) -> str:
"""takes n and returns his string form"""
return str(n)
| true |
5040cbd883bdd87066fb9ed7aa00a4748bb6428c | Python | PaulaG9/MSFCalc | /calc/functions.py | UTF-8 | 756 | 2.8125 | 3 | [] | no_license | import pandas as pd
def getNetPatients(numpatients, duration, monincrease):
if duration/30>1:
final_mth_patients=numpatients+(round(duration/30)-1)*monincrease
net_patients=((numpatients+final_mth_patients)*round(duration/30))/2
else:
net_patient... | true |
c39cc4fc83896753683d71ceb2b4c07b16d67eac | Python | JackTJC/LeetCode | /sort_alg/HeapSort.py | UTF-8 | 969 | 3.25 | 3 | [] | no_license | from typing import List
class Solution:
def smallestK(self, arr: List[int], k: int) -> List[int]:
# topK问题,使用堆排序解决
def adjustHead(heap, i, length):
temp = heap[i]
k = 2 * i + 1
while k < length:
if k + 1 < length and heap[k] < heap[k + 1]:
... | true |
ed48571077750543079a11c8452aa1eb7b362d43 | Python | SonicMadushi/Week-01 | /codes/7.0 Numpy.py | UTF-8 | 333 | 3 | 3 | [] | no_license | import numpy as np
a=np.array(([1,2,3],[4,5,6]))
#print(a.shape)
b=np.ones((5,2),dtype=np.int)
#b=np.zeros((5,2),dtype=np.int)
#print(b)
c=np.random.randint(0,5,(4,10))
#print(c)
x=np.random.randint(0,10,(1000,500))
y=np.random.randint(0,10,(500,1000))
#print(x)
#print(y)
z=np.matmul(x,y)
... | true |
231c588aebe7f66eae4c9556c27eccaa8fcdc46e | Python | huidou74/CMDB-01 | /hc_auth/auth_data.py | UTF-8 | 3,998 | 2.890625 | 3 | [] | no_license | #!/usr/bin/python
#-*- coding:utf8 -*-
#BY: H.c
def menu_auth(host_obj,request):
obj_all = host_obj.values('name', # 使用values()方法时,对象必须是queryset_list
'pos__name',
'pos__auth__url', # 这是 url 路径
'pos__auth__name', #... | true |
9420cdae068bd89c05621749680673c187e4c3ef | Python | Shank2358/Loistic-Regression | /Logistic Regression/.idea/Logistic Regression.py | UTF-8 | 2,793 | 3.5625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
from numpy import *
from os import listdir
# data=[]
# label=[]
def loadData(direction):
print(direction)
dataArray = []
labelArray = []
trainfileList = listdir(direction)
m = len(trainfileList)
for i in range(m):
filename = trainfileList[i]
fr = open('%s/%s'... | true |
47637d0ff5c637740250c1650bbafd61f4ca8192 | Python | brunner-itb/masters | /classes_backup.py | UTF-8 | 14,160 | 2.546875 | 3 | [] | no_license | class InitialCondition(Expression):
def eval_cell(self, value, x, ufc_cell):
value[0] = np.random.rand(1)
u_D = Expression("rand()/100000", degree=1)
class FEMMesh:
'A class which should be able to incorporate all meshes, created or given, and provides all necessary parameters and values'
def __init__(self, Mes... | true |
59388671cf47001a1cc0abb8149a42083e380ed5 | Python | LangII/GoCalc | /obsolete/taxicabinflcalc.py | UTF-8 | 5,326 | 2.828125 | 3 | [] | no_license |
from kivy.app import App
""" This is stupid... Not sure why, but this import line needs to be commented out if
running from main_console.py. """
from gamelogic.stone import Stone
# def getStoneRawInfluenceGrid(self, pos, opponent=False):
def getStoneRawInfluenceGrid(pos, opponent=False, board_grid=None):
boar... | true |
3655311243e4b23054ea1aaa198ef0739b1db7c8 | Python | feczo/pythonclass | /2048/main_7.py | UTF-8 | 1,246 | 2.8125 | 3 | [] | no_license | from numpy import random, array
a = array([[None for i in range(4)] for i in range(4)])
def addblock():
col = random.randint(4)
row = random.randint(4)
if not a[row, col]:
a[row, col] = 2
else:
addblock()
def move(way):
change = False
if way in ['down', 'right']:
row... | true |
2be99bbb0b5e033bdb1df4cc2036d481ea8ecc9b | Python | mohan-sharan/python-programming | /List/list_1.py | UTF-8 | 126 | 3.703125 | 4 | [] | no_license | #CREATE A LIST TO STORE ANY 5 EVEN NUMBERS
evenNumbers = [2, 4, 6, 8, 10]
print(evenNumbers)
#OUTPUT
#[2, 4, 6, 8, 10]
| true |
ec10969a35c55617e100cb701921e112474fe2ac | Python | jiseungshin/pm4py-source | /pm4py/log/exporter/csv.py | UTF-8 | 1,239 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | from lxml import etree
from pm4py.log import log as log_instance
from pm4py.log import transform as log_transform
import pandas as pd
def get_dataframe_from_log(log):
"""
Return a Pandas dataframe from a given log
Parameters
-----------
log: :class:`pm4py.log.log.EventLog`
Event log. Also, can take a trace log... | true |
93258b947347cf231d5b38148090071c91a39dbf | Python | bigalex95/tkinterExamples | /tkinter/tkinterExamples/whiteboard/tm copy.py | UTF-8 | 4,994 | 3.0625 | 3 | [] | no_license | # Easy Machine Learning & Object Detection with Teachable Machine
#
# Michael D'Argenio
# mjdargen@gmail.com
# https://dargenio.dev
# https://github.com/mjdargen
# Created: February 6, 2020
# Last Modified: February 6, 2020
#
# This program uses Tensorflow and OpenCV to detect objects in the video
# captured from your ... | true |
d1a535bf4ab30adabce392c6fa34d16b363d1b6c | Python | namnt1410/stock_yfinance | /main.py | UTF-8 | 2,462 | 3.25 | 3 | [] | no_license | # This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import yfinance as yf
import pandas as pd
import requests
from bs4 import BeautifulSoup
import plotly.graph_objects as go
f... | true |
2bd1582de4c96c7298709790ca2f2be8e1843617 | Python | madhuriagrawal/python_assignment | /ouputTask2.py | UTF-8 | 364 | 3.8125 | 4 | [] | no_license | x=123
i = 0
count = 0
for i in x:
print(i)
#it will give the error :'int' object is not iterable
while i < 5:
print(i)
i += 1
if i == 3:
break
else:
print("error")
# output will be
# 0
# error
# 1
# error
# 2
while True:
print(count)
count += 1
if count >= 5:
... | true |
886f09114d627aabfb18a6fcbdf7af8873332b03 | Python | Deci-AI/super-gradients | /src/super_gradients/training/losses/cwd_loss.py | UTF-8 | 2,374 | 2.609375 | 3 | [
"LicenseRef-scancode-proprietary-license",
"Apache-2.0"
] | permissive | from typing import Optional
import torch.nn as nn
import torch
class ChannelWiseKnowledgeDistillationLoss(nn.Module):
"""
Implementation of Channel-wise Knowledge distillation loss.
paper: "Channel-wise Knowledge Distillation for Dense Prediction", https://arxiv.org/abs/2011.13256
Official implement... | true |
29b8be49e416f26ea2ce60edccb04068c22a0128 | Python | aquinzi/tdf-actividades | /_admin-scripts/jsontocsv(activities-name).py | UTF-8 | 814 | 2.53125 | 3 | [
"CC0-1.0"
] | permissive | '''
run where the files are
'''
import json
import os
final_file = "tipo,nombre,nombre_alt\n"
for root, subFolders, files in os.walk(os.getcwd()):
for filename in files:
filePath = os.path.join(root, filename)
if not filePath.endswith(".json") or filename.startswith("_"):
continue
print (" processi... | true |
839ca2222455c92e04d24a70d3d999f1e8f24360 | Python | flipelunico/WestWorld | /Miner.py | UTF-8 | 3,091 | 2.671875 | 3 | [] | no_license | from BaseGameEntity import BaseGameEntityClass
import EntityNames
from location_type import location_type
from MinerOwnedStates.GoHomeAndSleepTilRested import GoHomeAndSleepTilRested
class Miner(BaseGameEntityClass):
ComFortLevel = 5
MaxNuggets = 3
ThirstLevel = 5
TirednessThreshold = 5
m_pCurren... | true |
cf0e7f4feb2924a1f252b1b4108f2ea0622d68fb | Python | sajandc/Python-Tutorial | /python8.py | UTF-8 | 68 | 2.734375 | 3 | [] | no_license | l=[]
l=[i for i in input().split(',')]
l.sort()
print(','.join(l))
| true |
213878e0b157e5dd22e6cfb6ff4407903899646c | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_135/4118.py | UTF-8 | 1,724 | 3.46875 | 3 | [] | no_license | def get_matrix(filename):
"""This function reads a file and returns a matrix """
line = []
try:
handler = open(filename, 'r')
line = [ map(int, line.split(' ')) for line in handler]
return line
except Exception, e:
pass
def get_row(n,matrix):
... | true |
8619dae93878e0eb42da3e9658e8987a249782cf | Python | KevinZZZZ1/machinelearning | /logistic_regression.py | UTF-8 | 4,555 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue May 15 16:17:31 2018
斜率没有什么问题,但是偏置b始终存在问题,而且没找到 = =
补充:b不对的问题好像找到了,问题似乎是出在前期数据处理时进行的特征缩放,把特征缩放去掉之后,经过100000次的迭代得到了正确的解,至于原因还没弄清楚
@author: keivn
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
import scipy... | true |
958a29dccb7693995fff1a65b569c636c0eb626b | Python | nel215/color-clustering | /clustering.py | UTF-8 | 877 | 2.703125 | 3 | [] | no_license | import argparse
import numpy as np
import cv2
class ColorClustering:
def __init__(self):
self.K = 16
def run(self, src, dst):
src_img = cv2.imread(src)
samples = np.float32(src_img.reshape((-1, 3)))
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 10, 1.0)
... | true |
c57aac802105b24c5749f46cc34ab770e50e7549 | Python | jgi302/IoT | /MQTT_Coffee/coffeeGUI-BT.py | UTF-8 | 2,492 | 3.078125 | 3 | [] | no_license | import tkinter as tk
from PIL import ImageTk
import socket
# -----------------------------------------------------------------------------
#
# -----------------------------------------------------------------------------
class MainWindow():
def __init__(self, main):
# canvas for image
self.canva... | true |
d11138f8c239b3a7700ea4ab59c96dbb3524d920 | Python | btrif/Python_dev_repo | /Algorithms/backtracking/Hamiltonian Cycle.py | UTF-8 | 4,394 | 4.28125 | 4 | [] | no_license | # Created by Bogdan Trif on 26-10-2017 , 11:24 AM.
'''
https://en.wikipedia.org/wiki/Hamiltonian_path
Hamiltonian Path in an undirected graph is a path that visits each vertex exactly once.
A Hamiltonian cycle (or Hamiltonian circuit) is a Hamiltonian Path such that there is an edge (in graph)
from the last vertex to... | true |
65cc9b0f1d3a313f35e277378dba4f872184c66c | Python | Etheri/bioproject_py | /unique_genes/bi_task_6.py | UTF-8 | 500 | 3.015625 | 3 | [] | no_license | from collections import Counter
def readListFF(name):
# Read list of genes from file
f = open(name, 'r')
out = [line.strip() for line in f]
return out
f.close()
def outInFile(name, l):
# Write list of genes into file
f = open(name, 'w')
for index in l:
f.write(index + '\n'... | true |
72477ca383c50a535745f4024c41f67f33a02045 | Python | VibhorKukreja/refuel | /vehicles/models.py | UTF-8 | 1,367 | 2.5625 | 3 | [] | no_license | from django.db import models
# Create your models here.
VEHICLE_TYPE = (
('BIKE', 'Bike'),
('CAR', 'Car'),
)
FUEL_TYPE = (
('PETROL', 'Petrol'),
('DIESEL', 'Diesel'),
)
class Vehicle(models.Model):
brand = models.CharField(max_length=255)
model = models.CharField(ma... | true |
3924900e83fb73185f4af0fec5ae2b10920e9db8 | Python | varanasisrikar/Programs | /Python/LinAlg_EigenValues,Vectors.py | UTF-8 | 337 | 2.96875 | 3 | [] | no_license | import numpy as np
import numpy.linalg as alg
l1 = []
rows = int(input("enter rows:"))
cols = int(input("enter cols:"))
for i in range(rows):
for j in range(cols):
l1.append(int(input()))
print(l1)
m = np.reshape(l1, (rows, cols))
print(m)
Values, Vectors = alg.eig(m)
print(Values)
print(Vectors[:, 0])
prin... | true |
9c4adc1944249d8c6d100fab3e090345906d93cd | Python | ngoldbaum/unyt | /unyt/exceptions.py | UTF-8 | 8,679 | 3.34375 | 3 | [
"BSD-3-Clause"
] | permissive | """
Exception classes defined by unyt
"""
# -----------------------------------------------------------------------------
# Copyright (c) 2018, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the LICENSE file, distributed with this software.
# -----------... | true |
71dd7fbc4e7c66357b48c98b81eaa298829a5dd3 | Python | kho903/python_algorithms | /programmers/level2/타겟 넘버.py | UTF-8 | 529 | 3.1875 | 3 | [] | no_license | answer = 0
def dfs(numbers, num, target, length):
global answer
if length == len(numbers):
if num == target:
answer += 1
return
else:
return
else:
dfs(numbers, num + numbers[length], target, length + 1)
dfs(numbers, num - numbers[length],... | true |
9b51deb8bbdf63ebbf0121ba94472e999968b61e | Python | edelcorcoran/PandS-Project-2019 | /boxplot.py | UTF-8 | 409 | 3.484375 | 3 | [] | no_license |
#Boxplot Iris Dataset - looks at the 4 attributes
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
#read csv file
iris = pd.read_csv('iris.csv')
sns.set()
#Generates a Boxplot for each column [SL, SW, PL, PW)
iris.boxplot()
#Assign a title to the Boxplot
plt.title('Iris... | true |
07c1594632f5f5b3afa85e49cb319f5478ff4673 | Python | modalsoul0226/LeetcodeRepo | /easy/Pascal's Triangle.py | UTF-8 | 1,074 | 3.421875 | 3 | [] | no_license | class Solution:
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
res = [[1], [1, 1]]
if numRows == 0:
return []
elif numRows == 1:
return [[1]]
elif numRows == 2:
return [[1], ... | true |
828069d3a9354f848d7e85862891d210faaa6600 | Python | StaticNoiseLog/python | /ffhs/heron_sqrt.py | UTF-8 | 200 | 3 | 3 | [] | no_license | epsilon = 0.0000001
x = close_history_list(input("Square root of: "))
h_previous = 1
h = 2
while abs(h - h_previous) > epsilon:
h_previous = h
h = (h_previous + x/h_previous)/2
print(h)
| true |
a23a7f3f059226b7af92f221433a7dcf057a1a1e | Python | RoboticsLabURJC/2014-pfc-JoseAntonio-Fernandez | /MapClient/tools/WayPoint.py | UTF-8 | 551 | 2.546875 | 3 | [] | no_license | from MapClient.classes import Pose3DI
class WayPoint:
def __init__(self, x=0, y=0, lat=0, lon=0, h=0):
self.x = x
self.y = y
self.h = h
self.lat= lat
self.lon = lon
#todo mejorar para que se calculen automagicamente
@staticmethod
def waypoint_to_pose(self, a... | true |
976ff05664c723c330b39b6888363f58be6521a2 | Python | nharini27/harini | /count.py | UTF-8 | 75 | 3.53125 | 4 | [] | no_license | num=int(input())
count=0
while(num>0):
num=num//10
count+=1
print(count)
| true |
d24b19895a18d0307b9a191780685dd2631d1659 | Python | theY4Kman/yaknowman | /yakbot/ext.py | UTF-8 | 1,531 | 2.59375 | 3 | [
"MIT"
] | permissive | CMDNAME_ATTR = '__cmdname__'
ALIASES_ATTR = '__aliases__'
def command(name=None, aliases=()):
""" Decorator to register a command handler in a Plugin. """
fn = None
if callable(name):
fn = name
name = None
def _command(fn):
setattr(fn, CMDNAME_ATTR, fn.__name__ if name is None... | true |
ff6923510ad01f8deb4170816490ecf325c54043 | Python | pwdemars/projecteuler | /josh/Problems/54.py | UTF-8 | 2,581 | 2.90625 | 3 | [] | no_license | hands_file = open('/Users/joshuajacob/Downloads/p054_poker.txt', 'r').read().split()
from operator import itemgetter
def num_func(num):
if num == 'T':
return(10)
if num == 'J':
return(11)
if num == 'Q':
return(12)
if num == 'K':
return(13)
if num == 'A':
retu... | true |
635cbcb9d69589f8f05c2bb703a1f90908e1a8f5 | Python | gowshalinirajalingam/Advanced-regression-modeling | /House_Prices_Advanced_Regression_Techniques.py | UTF-8 | 15,607 | 2.890625 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import os
from sklearn.preprocessing import LabelEncoder ###for encode a categorical values
from sklearn.model_selection import train_test_split ## for spliting the data
# from ligh... | true |
d31f6836dd4cc4abbf6cee63ef4db80b569ebb67 | Python | bruno-antonio-pinho/Projeto1_Kernel | /demo_selector.py | UTF-8 | 512 | 2.75 | 3 | [] | no_license | #!/usr/bin/python3
import selectors
import sys
Timeout = 5 # 5 segundos
# um callback para ler do fileobj
def handle(fileobj):
s = fileobj.readline()
print('Lido:', s)
sched = selectors.DefaultSelector()
sched.register(sys.stdin, selectors.EVENT_READ, handle)
while True:
eventos = sched.select(Timeout)
... | true |
984297216a6d99d92bf82a745db908e3dbefd396 | Python | ConnorJSmith2/First-Pitch-Analyzer | /firstPitchAnalyzer.py | UTF-8 | 2,153 | 3.171875 | 3 | [
"MIT"
] | permissive | import sys
import csv
import copy
#If there are 2 files, return the first (command line), if none then exit
def getCommandLineArg():
if (len(sys.argv) == 2):
return sys.argv[1]
else:
print ("Error: No file inputted. \nUsage is: python firstPitchAnalyzer.py <filename.csv>")
exit()
def printCSV(filename):
wi... | true |
352348e53951c63fd7353a21cf6783b9ab4ecb7b | Python | efikalti/File-Parsing | /mapper.py | UTF-8 | 1,078 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import re, string
from operator import itemgetter
reg_ex = '|'
#open files
file2 = open(sys.argv[1], "r")
#read fields of file1
fields1 = sys.stdin.readline().strip().split(reg_ex)
#read fields of file 2
fields2 = file2.readline().strip().split(reg_ex)
#read every line of file2 into o... | true |
3d83bbc502b68539559b60050f40dc64d43152af | Python | yuki-uchida/Competitive_programming | /AtcoderBeginnerContest/162/d.py | UTF-8 | 2,426 | 3.03125 | 3 | [] | no_license | import bisect
N = int(input()) # N<= 4000 6*10^10なので、削減しないとだめ
S = list(input())
# Si Sj Skがどれも別のもの。ただしi<j<k
# また、j-i != k-j
# 1,2,3はだめ1,2,4はok
# 1,3,5もだめ
# この組の数を求める
# count = 0
# for i in range(N):
# for j in range(i + 1, N):
# for k in range(j + 1, N):
# if j - i != k - j:
# ... | true |
174632ac0ff7e15c818051c7fa0cfd0604be9b90 | Python | mingxoxo/Algorithm | /baekjoon/3053.py | UTF-8 | 225 | 3.03125 | 3 | [] | no_license | #택시 기하학
#https://www.acmicpc.net/problem/3053
import math
R = int(input())
#유클리드 기하학과 맨헤튼 거리의 원은 모양이 다름
print("{:.6f}".format(R*R*math.pi))
print("{:.6f}".format(R*R*2))
| true |
184539ad02b03c70c9347e4f3132c05c60e6c6eb | Python | haochengz/superlists | /functional_test/base.py | UTF-8 | 1,288 | 2.515625 | 3 | [] | no_license |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
import time
class FunctionalTest(StaticLiveServerTestCase):
def setUp(self):
self.browser = self.open_a_browser()
def reset_browser(self):
se... | true |
f875542359851f332040d8038a8ba7ef9ea0a6cf | Python | BedirT/games-puzzles-algorithms | /old/lib/games_puzzles_algorithms/puzzles/solvable_sliding_tile_puzzle.py | UTF-8 | 1,587 | 3.171875 | 3 | [
"MIT"
] | permissive | from games_puzzles_algorithms.puzzles.sliding_tile_puzzle import SlidingTilePuzzle
from games_puzzles_algorithms.twod_array import TwoDArray
import random
class SolvableSlidingTilePuzzle(SlidingTilePuzzle):
"""A representation of a sliding tile puzzle guaranteed to be solvable."""
def __init__(self, size... | true |
757d3b358b58127d74723e996aebba19e8ce5d44 | Python | varenius/oso | /VGOS/VGOS_prep.py | UTF-8 | 8,774 | 2.5625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import sys, os
import datetime
print("Welcome to the OTT VGOS_prep script. Please answer the following questions:")
###########################
exp = input("QUESTION: Experiment, e.g. b22082 ? ").strip().lower()
print("INFO: OK, try to process experiment "+exp)
print()
##########################... | true |
67d06e23cf161abe692fae0421b02323445fe788 | Python | parzibyte/crud-mysql-python | /eliminar.py | UTF-8 | 643 | 3.0625 | 3 | [
"MIT"
] | permissive | """
Tutorial de CRUD con MySQL y Python 3
parzibyte.me/blog
"""
import pymysql
try:
conexion = pymysql.connect(host='localhost',
user='root',
password='',
db='peliculas')
try:
with conexion.cursor() as cursor:
consulta =... | true |
7f0c8544da84b7c67bd2a897a7911e5cb1ae4752 | Python | zachselin/TrafficSim_TeamDangerous | /bufferbuildercar.py | UTF-8 | 3,127 | 2.625 | 3 | [] | no_license | from car import Car
import math
import numpy as np
import random
import shared as g
class BufferBuilder(Car):
def __init__(self, sim, lane, speed, maxspeed, id, carAhead, carUpAhead, carDownAhead, laneidx, size, canvasheight,
lanes, slowdown):
super(BufferBuilder, self).__init__(sim, lane... | true |
d154f9979dfdf2994a0a8a4bc0c7e3df2f6ce289 | Python | a-w/astyle | /AStyleDev/src-p/ExampleByte.py | UTF-8 | 11,436 | 2.8125 | 3 | [
"MIT"
] | permissive | #! /usr/bin/python
""" ExampleByte.py
This program calls the Artistic Style DLL to format the AStyle source files.
The Artistic Style DLL must be in the same directory as this script.
The Artistic Style DLL must have the same bit size (32 or 64) as the Python executable.
It will work with either Python... | true |
e1753a9b57a697ecc0d4fd06df813330e9c4dbee | Python | DDDDDaryl/guidance_line_extraction | /cam_accelerate.py | UTF-8 | 993 | 3.03125 | 3 | [] | no_license | import threading
import cv2
class camCapture:
def __init__(self, dev):
self.Frame = 0
self.status = False
self.isstop = False
# 摄影机连接。
self.capture = cv2.VideoCapture(dev)
# self.capture.set(3, 1280)
# self.capture.set(4, 720)
def isOpened(self):
... | true |
874cfaaa3a2c67a0699fb8949c1e75aded0456b5 | Python | kweird/githubintro | /4_Building_Tools/buildingtools.py | UTF-8 | 6,907 | 4.125 | 4 | [
"MIT"
] | permissive | # Import the modules we use in our code
import random
import operator
import matplotlib.pyplot
import time
# We set the random seed to a certain value so we have reproducable results
# for testing. This can be commented out when not testing.
random.seed(0)
# We create a variable called start_time that stores the curr... | true |
c0d34c9d305b546ad501660f812066c5c6753bdb | Python | denizozger/coffee | /alert_slack_when_button_is_pressed.py | UTF-8 | 2,004 | 2.75 | 3 | [] | no_license | #!/usr/bin/python
# Recommended usage: $ nohup python3 this_file.py >this_file.py.log 2>&1 </dev/null &
import os
import requests
import time
from datetime import datetime
import RPi.GPIO as GPIO
url = os.getenv('SLACK_CHANNEL_URL')
response = None
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# LED setup
RED = 18... | true |
90e1c8ed8a7881304e0cde04c68732745860cb94 | Python | rpw505/aoc_2020 | /day_03/q1.py | UTF-8 | 1,769 | 3.421875 | 3 | [] | no_license | from itertools import cycle
from dataclasses import dataclass
from pprint import pprint
from typing import List
from functools import reduce
import operator
TEST_INPUT = [
'..##.......',
'#...#...#..',
'.#....#..#.',
'..#.#...#.#',
'.#...##..#.',
'..#.##.....',
'.#.#.#....#',
'.#.......... | true |
8c61220653fa86b86cb77a37e704ea4d8be2cb61 | Python | Leo-Wang-JL/force-riscv | /utils/regression/common/threads.py | UTF-8 | 10,681 | 2.546875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | #
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# THIS SOFTWARE IS PRO... | true |
5236846a1e7234ed817ca17e9086eb7f3a0df9f0 | Python | zxqfengdi/graduation-project | /project_code/camera.py | UTF-8 | 3,707 | 2.578125 | 3 | [] | no_license | # coding:utf-8
"""
@author: fengdi
@file: camera.py
@time: 2018-04-21 22:12
"""
import cv2
import face_recognition
class CameraRecognize(object):
def __init__(self):
super().__init__()
def camera_recognize(self):
video_capture = cv2.VideoCapture(1)
jobs_image = face_recognition.load... | true |
0574e1aadc0b48372a74e9b11afa6588dd8130a2 | Python | arnavdas88/qiskit_helper_functions | /qcg/Dynamics/quantum_dynamics.py | UTF-8 | 4,783 | 3.125 | 3 | [
"MIT"
] | permissive | from qiskit import QuantumCircuit, QuantumRegister
import sys
import math
import numpy as np
class Dynamics:
"""
Class to implement the simulation of quantum dynamics as described
in Section 4.7 of Nielsen & Chuang (Quantum computation and quantum
information (10th anniv. version), 2010.)
A circu... | true |
6a974c556298f24c8f03c12e19bafea5271b40a5 | Python | iradukundas/TFT-WebScrapper | /main.py | UTF-8 | 5,599 | 2.53125 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from discord.ext import commands
from discord import Color
import discord
import os
#Setting up for webscrapping
driver = w... | true |
50a745345dae7439ae93218a26aa9c44562698d2 | Python | Eulleraang12/Inspection-robot | /Move/movimentação.py | UTF-8 | 2,338 | 2.984375 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
from MotorDireito import *
from MotorEsquerdo import *
from multiprocessing import Process
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
def frente(tempo, voltas):
for i in range(voltas):
for j in passo:
GPIO.output(bobinas1[0],int(j[0]))
G... | true |
43b76ff31f463de16f07ff768d7341bdb608a53c | Python | WZQ1397/kickstart | /my220927-2.py | UTF-8 | 3,110 | 2.859375 | 3 | [] | no_license | # Author: Zach.Wang
# Module: fileEnc.py
import pickle
from sys import argv
from datetime import datetime
filename=None
class initFileName(object):
def __init__(self,filename=filename) -> None:
self.__filename = filename
def get_filename(self) -> str:
return "".join(self.__filename.split('.')... | true |