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 |
|---|---|---|---|---|---|---|---|---|---|---|
6315ba18fba0e93b5ed6b9605e2cb01e23720f9c | tetrabiodistributed/project-tetra-display | /server.py | UTF-8 | 1,996 | 2.5625 | 3 | [
"MIT"
] | permissive | import time
import json
import zmq
from patienttubingdescriptorcalculator \
import PatientTubingDescriptorCalculator
from sensors import Sensors
from tetra_constants import NUMBER_OF_PATIENTS
class Calculator():
def __init__(self):
self._calculators = (
tuple(PatientTubingDescriptorCal... | true |
cdbc84bcd0545ea008a7052f758c8067d4f7ed1f | JuliaKR-10/seac_adv_analytics | /expStd.py | UTF-8 | 2,448 | 2.625 | 3 | [
"MIT"
] | permissive | import math
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
plt.style.use('ggplot')
def generateRandomElements(n, av_low, av_high, dur_low, dur_high):
popInd = np.arange(n)
popAV = np.random.randint(low = av_low, high = av_high, size = n)
popDur = np.random.randint(low ... | true |
f6cc69d6e66890c59ce191fb304f115c67d96a58 | Danis98/AdventOfCode2019 | /day03/part1.py | UTF-8 | 566 | 2.90625 | 3 | [] | no_license | wA, wB = [x.split(",") for x in open("day03.input", "r").read().strip().split()]
dir = {
'U': [0, 1],
'R': [1, 0],
'D': [0, -1],
'L': [-1, 0]
}
grid = {}
def write_wire(w, id):
pos = (0, 0)
for move in w:
d = dir[move[0]]
l = int(move[1:])
for i in range(l):
... | true |
35640792d6fc8de63676b8aae579e0b5dc196aab | RevansChen/online-judge | /Codewars/8kyu/name-on-billboard/Python/test.py | UTF-8 | 551 | 2.625 | 3 | [
"MIT"
] | permissive | # Python - 2.7.6
Test.describe('Basic tests')
Test.assert_equals(billboard('Jeong-Ho Aristotelis'), 600)
Test.assert_equals(billboard('Abishai Charalampos'), 570)
Test.assert_equals(billboard('Idwal Augustin'), 420)
Test.assert_equals(billboard('Hadufuns John',20), 260)
Test.assert_equals(billboard('Zoroaster Donnchad... | true |
a216593621a8a9670bcea7916936ab670f10e5b8 | Sviblov/Bot_test | /SvblvBot.py | UTF-8 | 4,956 | 2.8125 | 3 | [] | no_license | import telebot
import json
import numpy
import requests
from telebot.types import Message
import pandas as pd
import matplotlib
from matplotlib import pyplot as plt
from datetime import date
import pprint as pp
from telebot import types
import my_functions as mf
TOKEN = '1237869167:AAHlSqvq9Kw5Me9g4zrCAaaVya_yCLe9s80'... | true |
c0c457f60c929f9135d00daa58e0d126f9d42708 | conwetlab/fast | /trunk/GVS/media/docs/mdx_documentation.py | UTF-8 | 1,407 | 2.609375 | 3 | [] | no_license | import markdown
from markdown import etree
NOBRACKET = r'[^\]\[]*'
BRK = ( r'\[('
+ NOBRACKET + r')\]' +
r'\[('
+ NOBRACKET + r')\]')
IMAGE_RE = r'\!\!' + BRK + r'\s*\((<.*?>|([^\)]*))\)'
class Documentation(markdown.Extension):
def extendMarkdown(self, md, md_globals):
image_pa... | true |
93b85d44aa56b30b7ca672d0a500a77a9f619bd0 | Moviedraft/moviedraft-api | /models/FlavorTextModel.py | UTF-8 | 2,809 | 2.953125 | 3 | [] | no_license | from utilities.Database import mongo
from bson.objectid import ObjectId
from utilities.DatetimeHelper import get_most_recent_day
from enums.DaysOfWeek import DaysOfWeek
import arrow
class FlavorTextModel():
def __init__(self, _id, game_id, type, text):
self._id = _id
self.game_id = game_id
... | true |
9c79b8f31001962ae07a2062425c8cc71431ef7d | chatlekha/windmapuk | /wind_uk_2020.py | UTF-8 | 2,298 | 2.640625 | 3 | [] | no_license | import folium
import pandas as pd
import branca
df = pd.read_excel('wind_energy_UK_2020.xlsx')
m = folium.Map(location=[55.835501, -3.411868], zoom_start=7)
def fancy_html(row):
i = row
Project = df.NAME[i]
Size = df.PROJECT[i]
Type = df.TYPE... | true |
65a2f96af176cec76183c49564e73c4c62f8fdd8 | TouchInstinct/BuildScript | /scripts/TouchinBuild/parsers/SettingsParser/SettingsLineParser.py | UTF-8 | 1,365 | 3.03125 | 3 | [] | no_license | import re
from parsers.LineParser import LineParser
from parsers.SettingsParser.PathParser import PathParser
class SettingsLineParser(LineParser):
def __init__(self):
LineParser.__init__(self)
def parseLine(self, line):
assert line is not None
pathAndValue = self.splitToPathAndValue(line)
path = pathAnd... | true |
de8aaa2419023d53df3883debc2e7be39343c828 | CarlosWillian/python | /exercicios/ex 011 a 020/ex012.py | UTF-8 | 178 | 3.359375 | 3 | [
"MIT"
] | permissive | print('Descontão pra você')
n1 = float(input('Digite o preço da sua compra: R$ '))
print('O valor a pagar com seus 5% de descontos aplicados é: R$ {:.2f}'.format(n1*0.95))
| true |
17b97a8b124c842d46b7ae5043afc7b51a7b6b14 | thesongtao/FlaskStudy | /spider-flask/bp_bhjk/bhjk.py | UTF-8 | 2,958 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021-05-05 16:04
# @Author : 玛卡玛卡
# @Site :
# @File : bp_bhjk.py
# @Desc: 薄荷健康接口蓝图
# 声明:本作者所有源代码只可以用作技术学习,不可用做其他非法用途。
from flask import Blueprint,request,current_app
import requests
import time
bhjk_bp = Blueprint("bp_bhjk",__name__)
headers = {
"bp... | true |
f1e78c4e34c286ecce0298f48c45f9909e540aaa | RomanPutsilouski/M-PT1-37-21 | /Lessons/lesson 05-03/shapes_utilits.py | UTF-8 | 384 | 3.28125 | 3 | [] | no_license | import math
class ShapesUtilits:
@staticmethod
def circle_square(circle):
r = circle.get_x()
return math.pi*r*r
@staticmethod
def square_square(square):
s = square.get_x()
return s*s
@staticmethod
def rectangle_square(rectangle):
side1 = rectangle.get_... | true |
88a8efb3b27a92098b301af6961abc461b526953 | Sanduoo/OpenCV-Python | /20_contours_demo.py | UTF-8 | 1,351 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
#Canny边缘提取
def edge_demo(image):
blarred = cv.GaussianBlur(image,(3,3),0)
gray = cv.cvtColor(blarred,cv.COLOR_BGR2GRAY)
# # X Gradient
# gray_x = cv.Sobel(gray,cv.CV_16SC1,1,0)
# # Y Gradient
# gray_y = cv.Sobel(gray,cv.... | true |
f1117764a5063147832ddfe58c8ed53d44c3d718 | Neiloooo/PythonBasics | /05-面向对象/01-OOP基础.py | UTF-8 | 4,587 | 4.4375 | 4 | [] | no_license | # coding=utf-8
# 1.类是图纸,对象是实物
# 2.同一个类,属性可能不同
# 3.类名要满足大驼峰命名法:CapWords
# 4.对象的特征描述:属性,对象的具体行为:方法
# 一.dir内置对象
# 可以通过dir查看对象的所有方法和属性
# __方法名__是Python针对对象提供的内置方法名
# ----------------------------------------------------
# 类与方法
# 小猫爱吃鱼,小猫爱喝水
class Cat:
def eat(self):
print ("小猫爱吃鱼")
def drink(self):
... | true |
95c7def06ebe9c5e0f68e66f5d1e91e52a03a770 | rajgouravjain/python3-practice | /learning/data-structure-and-algorithms/MIT-6.006/sorting/InsertionSortAscendingFromHighIndex_v1.py | UTF-8 | 511 | 3.515625 | 4 | [] | no_license | __author__ = 'rjain'
t = [ 4,5,2,5,7,6,3,8,9,4,8,3,9,7]
def insersionSort(t):
for i in range(1,len(t)):
j=i
while j>0 and t[j-1] > t[j]:
t[j-1], t[j] = t[j],t[j-1]
j -= 1
return t
print insersionSort(t)
def insersionSortRec(t,i = None):
if i == None: i = len(t) - ... | true |
51ba788e8736b01fcaf197ae40e74653c4efe2cb | daniwhite/SkidpadControl | /lqr_ss_corner.py | UTF-8 | 16,825 | 2.5625 | 3 | [] | no_license | """"Set up dynamics for cornering and visualize them."""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import matplotlib.cm as cm
import scipy.optimize
import pydrake.symbolic as sym
from pydrake.systems.analysis import Simulator
from pydrake.systems.framework import Diag... | true |
6bb16646b67d38ce90ea6b52f07163ec66c8ee3c | vyshaal/TextBasedSearchEngine | /Phase_1/Task_1.py | UTF-8 | 3,635 | 2.859375 | 3 | [] | no_license | import pickle
from Phase_1 import RetrievalModel
from Phase_1 import Snippet
import csv
"""
Generates ranked lists (in descending order) for all the given 64 queries using each of the following
Information Retrieval Models:
1) Vector Space Model
2) TF-IDF Model
3) BM-25 Mode... | true |
9b8d8db69441c178ebe4c8457fbfd03bf5071976 | enix403/ST-NewFilePrompt | /plugin.py | UTF-8 | 1,670 | 2.734375 | 3 | [
"MIT"
] | permissive | import os
import sublime
import sublime_plugin
from . import bracex
def reveal_in_sidebar(self):
self.window.run_command("reveal_in_side_bar")
class MakeNewFileCommand(sublime_plugin.WindowCommand):
def on_path_entered(self, location_str):
locations_str = location_str.rstrip("/")
locations ... | true |
48c1153c61fd5f9b063bf66f6e62e271ccf545ab | Pereirics/Exercicios_Curso_Python | /ex029.py | UTF-8 | 211 | 3.609375 | 4 | [] | no_license | n1 = float(input('A que velocidade ia o seu carro? '))
if n1 > 80:
multa = (n1 - 80) * 7
print(f'EXCESSO DE VELOCIDADE! A multa é de {multa :.2f}€!')
else:
print('Continuação de boa viagem!')
| true |
019121e0d253d739bbf40285d6b502f3f73851bb | EDCastaneda/visual-automata | /README.py | UTF-8 | 7,016 | 3.1875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light,md
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# --... | true |
da2c286028caff1ff3b7c91561f41d440c3ec610 | santro92/Network-Analysis-And-Modelling | /Problem Set/Problem Set 2/Code/p6a.py | UTF-8 | 803 | 3.125 | 3 | [] | no_license | import networkx as nx
def getDegreeCent(G):
degreeCent = nx.degree_centrality(G)
#for k,v in degreeCent.items():
# degreeCent[k] = round(v,3)
return degreeCent
def getBetweenCent(G):
betweenCent = nx.betweenness_centrality(G,normalized=False)
for k,v in betweenCent.items():
betweenC... | true |
61cfec9271e3f028b749c65d1d5db85104643070 | linth/learn-python | /async_IO/coroutines/create_task.py | UTF-8 | 1,498 | 3.828125 | 4 | [] | no_license | """
Reference
- https://www.maxlist.xyz/2020/03/29/python-coroutine/
"""
import asyncio
import time
from color.IeColor import IeColor
async def do_something(num: int):
"""
do something with async.
:param num:
:return:
"""
print(IeColor().pink, f'task {num}: the first step.', IeColor().end)... | true |
11236e8c62b4e4f18a5c0acc4b67d5cae67838e5 | Aasthaengg/IBMdataset | /Python_codes/p03399/s688844062.py | UTF-8 | 181 | 3.296875 | 3 | [] | no_license | # バスと電車の組み合わせ運賃の最小値を求める
A = int(input())
B = int(input())
C = int(input())
D = int(input())
fare = [A+C, A+D, B+C, B+D]
print(min(fare))
| true |
f5bae1a8befd71df2243346a0df10f25fea43f76 | OpenChemistry/tomviz | /tomviz/python/ConnectedComponents.py | UTF-8 | 1,027 | 2.921875 | 3 | [
"BSD-3-Clause"
] | permissive | import tomviz.operators
class ConnectedComponents(tomviz.operators.CancelableOperator):
def transform(self, dataset, background_value=0):
"""Converts a label map of connected components of foreground-valued
voxels in the input image to a label map where each connected component
has a uniq... | true |
c9399bb6bd591bfb047befb4b83850433b210102 | Lokeshyadav2398/lokeshdev | /suresh/dhcp_bysir/read_List_tuple.py | UTF-8 | 1,493 | 2.796875 | 3 | [] | no_license | def get_data_by_filename(filename):
fd=open(filename,"r")
read_data=fd.readlines()
data=[]
for line in read_data:
data.append(line)
print(data)
return data
def entry_position(a):
pos=a
pos_list=[(pos[i],pos[i+1],pos[i+2],pos[i+3]) for i in range(0,(... | true |
e6ec2e9f63b3886bd316e302ca9b4e8b01785823 | pars-linux/uludag | /ahenk/lider/lider/group.py | UTF-8 | 3,779 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Group dialog
"""
# Qt4 modules
from PyQt4 import QtGui
from PyQt4 import QtCore
# Generated UI module
from lider.ui_group import Ui_dialogGroup
from lider.helpers import i18n
i18n = i18n.i18n
class DialogGroup(QtGui.QDialog, Ui_dialogGroup):
"""
Dia... | true |
5cd3ec2fbd867ad0c27e789a094eede5117ce259 | mengyx-work/CS_algorithm_scripts | /leetcode/LC_438. Find All Anagrams in a String.py | UTF-8 | 1,554 | 3.203125 | 3 | [] | no_license | import collections
# class Solution(object):
# def findAnagrams(self, s, p):
# dict1 = collections.defaultdict(int)
# dict2 = collections.defaultdict(int)
# for elem in p:
# dict1[elem] += 1
# for elem in s[:len(p)]:
# dict2[elem] += 1
# i, j = 0, len(... | true |
8712b1b6b4eca77277ea0c8f8463d5fcc5a14a6c | anhlt59/volley_graphql | /app/core/management/commands/fakeseason.py | UTF-8 | 1,084 | 2.75 | 3 | [
"MIT"
] | permissive | from django.core.management import BaseCommand, CommandError
from league.models import Season, League
from faker import Faker
from itertools import islice
import random
class Command(BaseCommand):
help = "fake data"
def add_arguments(self, parser):
parser.add_argument("number", type=int, help="number... | true |
369ccd885e58e8b6c202846f21c800b58d70f348 | sesseljabs/lokaverkefni-sesselja | /main.py | UTF-8 | 331 | 2.625 | 3 | [] | no_license | from Node import Node
from Grid import Grid
import os
from time import sleep
# þetta er að mestu example hvernig þetta virkar, en keyrir gosper's glider gun
listi = [ # dæmi um lista
[0,0,0,0,0],
[0,1,1,1,0],
[0,1,1,1,0],
[0,1,1,1,0],
[0,0,0,0,0]
]
a = Grid(18,38)
a.listfromfile("grid.txt")
a.gr... | true |
3a5b39858ad47266f8a293a39230cc960187a91b | ehrlichj/Moneyball | /baseball_node.py | UTF-8 | 688 | 2.734375 | 3 | [] | no_license | import math
from numpy.core.numeric import NaN
class Baseball_Node:
def __init__(self, team, year, league, rs, ra, w, obp, slg, oobp, oslg, playoff):
self.team_id = team + str(year)
self.league = league
self.rs = rs
self.ra = ra
self.w = w
self.obp = obp
sel... | true |
c0b330cce3bba6fdabcacb1232ca0085318ef800 | daddvted/excavat0r | /service_api/cq/VaccinationSpider.py | UTF-8 | 5,196 | 2.546875 | 3 | [] | no_license | """
疫苗接种点查询
URL: http://www.cqwsjsw.gov.cn/Html/1/jbyf/index.html
"""
import re
import urllib.request
import lxml.html
import mysql.connector
from service_api.Utils import fake_useragent
class VaccinationSpider(object):
config = {
'user': 'root',
'password': 'hello',
'host': '192.168.86.86... | true |
de03a9b1e2b818bcb7456f1644787ed411898dfb | lwneal/ros-fun | /roscam/nlp_server/server.py | UTF-8 | 1,165 | 2.578125 | 3 | [] | no_license | from StringIO import StringIO
import json
import pickle
import flask
import numpy as np
import word_vector
app = flask.Flask(__name__)
# TODO: API to get vocabulary length
@app.route('/words_to_vec', methods=['GET', 'POST'])
def words_to_vec():
text = flask.request.values.get('text')
dimensionality = flask... | true |
877e17d19771befd5dcd93a56b2a4a8e3214aabd | fwparkercode/Programming2Notes-2017 | /timer_decorator.py | UTF-8 | 700 | 2.984375 | 3 | [] | no_license | import time, sys
force = list if sys.version_info[0] == 3 else (lambda X: X)
class timer:
def __init__(self, func):
self.func = func
self.alltime = 0
def __call__(self, *args, **kargs):
start = time.clock()
result = self.func(*args, **kargs)
elapsed = time.clock() - star... | true |
3e6462a6b5567c5b2bd542b47383f18583eff602 | bhaskars3008/gaws | /codes/standard_deviation.py | UTF-8 | 808 | 3.15625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import numpy as np
import json
from flask import Flask, request
app = Flask(__name__)
@app.route('/test',methods = ["GET"])
def test_api():
return "API is working"
def calculate_mean(arr):
mn=0
for elem in arr:
mn ... | true |
e0f903adab5991980648389d8c7d34f92e23e9c1 | therooler/glowjaw | /glowjaw/observables.py | UTF-8 | 4,409 | 3.25 | 3 | [] | no_license | import numpy as np
from typing import List, Tuple, Union
from glowjaw.ops import assert_state
def single_qubit_observable(state: np.ndarray, observable: np.ndarray,
loc: int) -> np.ndarray:
r"""Measure a single qubit observable :math:`\langle O \rangle` on the density matrix :m... | true |
53256b65768312b0fc4254fe9154c1785495fe11 | sabaduy/ProjectEuler | /python/0024.py | UTF-8 | 636 | 3.359375 | 3 | [] | no_license | from math import factorial
numbers = list(range(0,10))
answer = []
combinations_left = 1000000-1
while len(numbers) > 0 and combinations_left > 0:
fact_result = factorial(len(numbers) - 1)
possible_index = combinations_left // fact_result
# print(combinations_left)
# print(numbers)
# print(fact_result)
# pri... | true |
3ac1afc3bf8ca7c80195502a0a68cb26045d009b | YuXinZhi/chapter02 | /link_crawler.py | UTF-8 | 4,921 | 2.59375 | 3 | [] | no_license | import re
import urllib.request
import urllib.parse
import urllib.error
from datetime import datetime
import time
import urllib.robotparser
def link_crawler(seed_url,link_regex=None,delay=5,max_depth=1,max_urls=1,headers=None,
user_agent='wswp',proxy=None,num_retries=1,scrape_callback=None):
'''cr... | true |
6d3ecf05ce720ba1e600b9bddd118d0d421ca19f | xeor/ParseMeFoo | /challenges/intermediate_days_between.py | UTF-8 | 968 | 3.390625 | 3 | [] | no_license | import datetime
import random
import re
class Challenge:
author = 'Lars Solberg'
description = 'Calculate the how long this event happend on each line.'
def help(self):
return 'Calculate the days it took between it happened. The answer should be in days..'
def generate(self):
earlier ... | true |
d7a2cd00142772aaffe7c28cd9b82c8978766269 | BalintNagy/GitForPython | /Checkio/02_Home/checkio_home_02_The_most_wanted_letter.py | UTF-8 | 2,149 | 4.59375 | 5 | [] | no_license | """\
The Most Wanted Letter
You are given a text, which contains different english letters and
punctuation symbols. You should find the most frequent letter in the text.
The letter returned must be in lower case.
While checking for the most wanted letter, casing does not matter, so for
the purp... | true |
1d15c33876d241e37887cf4f9781bd3952450ce4 | heigelisi/python | /model/model.py | UTF-8 | 18,534 | 2.65625 | 3 | [] | no_license | import os
import html
import pymysql
class Error(Exception):
def __init__(self, e,msg):
self.e = e
self.msg = msg
def __str__(self):
return self.msg+':'+repr(self.e)
class Model(object):
"""
python3 pymysql 操作MySQL数据库
"""
config = {
"host":'localhost',
"user":'r... | true |
1377d1056b5fb484748ac8f0e24fe01279bf5ca5 | darksacred/Python_L2 | /L_2_4.py | UTF-8 | 140 | 3.953125 | 4 | [] | no_license | sl = input('Введите предложение: ').split()
for i, esl in enumerate(sl, 1):
print(f'{i} слово: {esl[:10]}')
| true |
65540874eca07456a1eaba9a62ebb14b46a73d3c | bondarchukYV/AD | /kerneldensity.py | UTF-8 | 1,101 | 3.046875 | 3 | [] | no_license | __author__ = '1'
from sklearn.neighbors import KernelDensity
import numpy as np
#all parameters except data are additional
#fraction is supposed fraction of outliers
#kernel in (‘gaussian’;’tophat’;’epanechnikov’;’exponential’;’linear’;’cosine’)
#returning values is numbers of rows in the dataset, which are marked as... | true |
fb01625810e58c209064e95f45f6bf4942938486 | Jichao-Peng/PythonRobotics | /Mapping/kmeans_clustering/kmeans_clustering.py | UTF-8 | 3,706 | 3 | 3 | [
"MIT"
] | permissive | """
Object clustering with k-means algorithm
author: Atsushi Sakai (@Atsushi_twi)
"""
import numpy as np
import math
import matplotlib.pyplot as plt
import random
show_animation = True
class Clusters:
def __init__(self, x, y, nlabel):
self.x = x
self.y = y
self.ndata = len(self.x)
... | true |
b3d07730bc1af228453ef39742455a92ae88b417 | lawlietmoon/Windy_Python_Course | /Python_Basics/Day_2/3.字符串str.py | UTF-8 | 2,499 | 4.09375 | 4 | [] | no_license | # ### 字符串 : 用引号引起来的就是字符串
# 引号: 单引号 双引号 三引号
"""
# 转义字符: \ + 字符
(1) 将有意义的字符变得无意义
(2) 将无意义的字符变得有意义
\n , \r\n : 都代表换行的意思
\r : 把\r后面所有的字符串拉到当前行首
\t : 一个缩进(水平制表符)
"""
# (1) 单引号 ' '
strvar = '上线不日常,帮主泪两行'
print(strvar)
print( type(strvar) ) # str字符串类型
# (2) 双引号
# 无意义的字符变得有意义
strvar = "上线不日常,帮主... | true |
a27f927c261dd5a5de26616274869486150a041f | podhmo/egoist | /egoist/experimental/serverprocess/spawn.py | UTF-8 | 2,252 | 2.609375 | 3 | [] | permissive | from __future__ import annotations
import typing as t
import typing_extensions as tx
import os
import time
import pathlib
import subprocess
import logging
logger = logging.getLogger(__name__)
class ConnectionChecker(tx.Protocol):
def ping(self) -> bool:
"""is connected?"""
...
def pong(self... | true |
05836123a6e2816ba824ba77730071e51217c045 | pmahon2016/pandas | /ln_pandas.py | UTF-8 | 709 | 2.90625 | 3 | [] | no_license | import PySimpleGUI as sg
from openpyxl import workbook
import pandas as pd
def draw_window():
sg.theme('Dark Blue 3') # please make your creations colorful
layout = [[sg.Text('Filename')],
[sg.Input(), sg.FileBrowse()],
[sg.OK(), sg.Cancel()]]
window = sg.Window('Get filenam... | true |
41c8c30b6a9314fbd6931c5fac35ddfa48b66878 | Omenia/robotframework-whitelibrary | /src/WhiteLibrary/utils/wait.py | UTF-8 | 463 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | import time
from robot.utils import timestr_to_secs
class Wait:
@staticmethod
def until_true(condition, timeout, error_msg):
"""Helper to wait until given condition is met."""
timeout = timestr_to_secs(timeout)
max_wait = time.time() + timeout
while True:
if conditi... | true |
b3a653d5bfd06bd9f52bef58c5fa839dcc0dfb49 | yu5shi8/AtCoder | /ABC_D/ABC159D.py | UTF-8 | 429 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# D - Banned K
# https://atcoder.jp/contests/abc159/tasks/abc159_d
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
d = Counter(A)
total = 0
for v in d.values():
total += (v * (v - 1)) // 2
for a in A:
print(total - d[a] + 1)
# [1] 22:12 - 22:58(... | true |
e5b8846b9113303ef7a73d378718ad693265733b | RiiickL/Leetcode | /MyCodes/ALG_1.py | UTF-8 | 468 | 2.9375 | 3 | [] | no_license | class Solution:
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
n = len(nums)
for k in range(n-1):
for k1 in range(k+1,n):
if (nums[k]+nums[k1]) == target:
return... | true |
843d8561d226cb3b63f3256eace9140131602262 | Vlad116/itis_nlp_course | /scrapy-microbiol-articles-crawl/MicrobiolCrawler/spiders/spider.py | UTF-8 | 3,160 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
import json
# name: название статьи
# author: авторы
# year: год
# volume: том
# number: номер(рядом с томом)
# annotation: текст аннотации статьи
data = {}
data['articles'] = []
class microbiolArticlesSpider(scrapy.Spider):
name = "Crawler"
start_urls = [
'http... | true |
92677652dee5872f972b79789ca6363d5df01bcb | greenjm/MathHandwritingRecognizer | /camera.py | UTF-8 | 416 | 2.609375 | 3 | [] | no_license | import cv2
vc = cv2.VideoCapture(1)
i = 0
if vc.isOpened():
while True:
rval, frame = vc.read()
cv2.imshow("feed me a problem", frame)
key = cv2.waitKey(20)
if key == 27:
cv2.destroyWindow("feed me a problem")
vc.release()
break
elif key == ord('p'):
i+=1
filename = "C:/Users/georgedr/Docu... | true |
576d793aae42e0dddb0f444b8e209492ef079f93 | Vincent105/python | /02_Automate/06_string/060201_string_method_1.py | UTF-8 | 593 | 4.25 | 4 | [] | no_license | # Basic method
spam = 'Hello world!'
spam = spam.upper()
print(spam)
spam = spam.lower()
print(spam)
# isX method
print(spam.isupper())
print(spam.islower())
print('Hello'.upper().islower())
print('Hello'.isalpha())
print('Hello'.isalnum())
print('Hello'.isdecimal())
print(' '.isspace())
print('Hello'.istitle())
whil... | true |
f3ec831ac0f285ca68c4d18b14b597b24f0d75ed | DestructHub/ProjectEuler | /Problem056/Python/solution_1.py | UTF-8 | 314 | 3.484375 | 3 | [
"MIT"
] | permissive | #code created by NamanNimmo Gera
#2:25pm, April 12, 2019.
highest = 0
for i in range(90,100):
for j in range(90,100): #another brute force :D
if sum(map(int, str(i**j)))>highest:
highest = sum(map(int, str(i**j)))
#to calculate the sum of digits of the number(i**j)
print(highest... | true |
afd376dd0a49dbeb53c0a79bed08975720128f8e | Mikkel-14/JuegosModelamiento2020A | /src/snake/Figura_Troyano.py | UTF-8 | 586 | 2.890625 | 3 | [] | no_license | from .Figura import Figura
import pygame
import os
import sys
troyanoIMG = pygame.image.load(os.path.join(os.path.dirname(__file__), "img/troyano.png"))
troyanoIMG = pygame.transform.scale(troyanoIMG, (64, 64))
class Figura_Troyano(Figura):
def __init__(self, x, y):
self.valor = 60
self.posX = x
... | true |
886cdcaa7a4b5b5011a94c5723c1bff574a98374 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2172/60785/288710.py | UTF-8 | 1,913 | 3.828125 | 4 | [] | no_license |
def middle2behind(expresssion):
result = [] # 结果列表
stack = [] # 栈
for item in expression:
if item.isnumeric(): # 如果当前字符为数字那么直接放入结果列表
result.append(item)
else: # 如果当前字符为一切其他操作符
if len(stack) == 0: # 如果栈空,直接入栈
... | true |
04b870401b5a4cfbd79992ae06e8578129de3606 | tybtab/dosenet-raspberrypi | /air_quality_test.py | UTF-8 | 161 | 2.9375 | 3 | [
"MIT"
] | permissive | import serial
print('Running Test Script')
port = serial.Serial("/dev/ttyAMA0", baudrate=9600, timeout=1500)
while True:
recv = port.read(10)
print(recv)
| true |
b27733e3fb81066f2a3b77acd722ce6d6eb226e4 | l793330708/PythonLearning | /machineLearning/regSplit.py | UTF-8 | 168 | 2.90625 | 3 | [] | no_license | import re
mySent = 'This book is the best book on Python or M.L. I have ever laid \
eyes upon.'
regExp = re.compile('/w*')
arr = regExp.split(mySent)
print(arr) | true |
0177a3d96105467e87a3624eb1bc60c8acd3fdf3 | abhijitbonik/Spoken-Analytics-System | /dashboard/calculation_scripts/cameFromActivityStats.py | UTF-8 | 1,680 | 2.71875 | 3 | [] | no_license | """
This script calculates came from activity stats.
It takes logs from 'Log', calculates came from activity stats and
stores them to 'CameFromActivity'.
The script runs everyday after 12:05 AM.
"""
import datetime
from dashboard.models import Log, CameFromActivity
from pytz import timezone
from django.conf import s... | true |
0a843e9fdeb905b3bb0f2d5ead66db7261b1d4f7 | mtandon18/cancer_project_512 | /code/networks_common/network_io.py | UTF-8 | 1,129 | 3.15625 | 3 | [] | no_license | import networkx as nx
import os
def read_ppi(filename, removeSelfLoops=False):
''' Read a weighted ppi network in sif format, naming the weight attribute "confidence" '''
ppiNetwork = nx.Graph()
with open(filename, 'r') as f:
for line in f:
lineArr = line.strip().split('\t')
... | true |
5c86cf1e4ad64dae07d346873d66588445cc321c | YiqunPeng/leetcode_pro | /solutions/605_can_place_flowers.py | UTF-8 | 513 | 3.203125 | 3 | [
"MIT"
] | permissive | class Solution:
def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool:
"""Array.
Running time: O(k) where k == len(flowerbed).
"""
place = 0
for i in range(len(flowerbed)):
if flowerbed[i] == 0:
prev = flowerbed[i-1] if i else 0
... | true |
06b6b21b84025279d178e1aa74be0ccfd6f6a2f9 | arunn03/QRCode | /main.py | UTF-8 | 854 | 2.65625 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk
import pyqrcode
from ttkthemes import ThemedTk
def sub(event=None):
global image
if len(url.get()) > 0:
qr = pyqrcode.create(url.get())
qr.png('qr.png', scale=7)
image = PhotoImage(file='qr.png')
qr_lbl['image'] = image
... | true |
6d562b3f283e9f434f882b4d867eefcd2a0e7fc9 | kofi-armah/DataScience_Assignment-2 | /Justice Timer_Assignment.py | UTF-8 | 2,348 | 3.4375 | 3 | [] | no_license | from datetime import datetime
import csv
from datetime import timedelta
# import Tkinter
from tkinter import *
root = Tk()
def main():
print("\nHi Welcome to daily work timer.")
# print("\nKindly choose a number:"
# "\n 1. Start timer"
# "\n 2. Check wages for current task"
# "\n 3.... | true |
2a4a5fdbde8111ed24ec52cbb1757f8f2cde9e5c | SR2k/leetcode | /first-round/1813.句子相似性-iii.py | UTF-8 | 2,579 | 3.828125 | 4 | [] | no_license | #
# @lc app=leetcode.cn id=1813 lang=python3
#
# [1813] 句子相似性 III
#
# https://leetcode-cn.com/problems/sentence-similarity-iii/description/
#
# algorithms
# Medium (51.87%)
# Likes: 9
# Dislikes: 0
# Total Accepted: 5.2K
# Total Submissions: 10.1K
# Testcase Example: '"My name is Haley"\n"My Haley"'
#
# 一个句子是由一些... | true |
7005d2c8f204717559aab6f4285702526d051317 | BorrowHome/flasky-sandbox | /app/main/video/video.py | UTF-8 | 10,206 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import csv
import os
import cv2
import numpy as np
from flask import render_template, request, redirect, url_for
from flask import jsonify
from app.main import main
from app.utils.frame.frame import base64_to_png
from app.utils.frame.site import Site
from app.utils.frame.sub import PictureSub
... | true |
2093d9e4347a56a661a3d1f6634cc22c02b47d45 | weijiasun2013/Algorithms | /linkedlist/merge_two_sorted_linkedlist/merge_two_sorted_linkedlist.py | UTF-8 | 1,253 | 3.8125 | 4 | [] | no_license |
'''
merge two sorted linked list
'''
class Node(object):
def __init__(self,val):
self.val = val
self.next = None
def display(node):
if node is None:
print('null')
return
n = node
ans = ''
while n:
ans += str(n.val) + ' -> '
n = n.next
ans += ... | true |
000822cb5829f9a675d32658949781148800c05d | Aasthaengg/IBMdataset | /Python_codes/p02813/s137742206.py | UTF-8 | 340 | 2.984375 | 3 | [] | no_license | import itertools
import math
N = int(input())
M = math.factorial(N)
X = [i for i in range(1, N + 1)]
Y = list(itertools.permutations(X))
P = tuple([int(x) for x in input().split()])
Q = tuple([int(x) for x in input().split()])
for i in range(M):
if Y[i] == P:
a = i
if Y[i] == Q:
b = i
ans = a... | true |
70a1012ea02c0325a796ee0d21765fe3384944af | Intelligent-Systems-Phystech/Group594 | /DanilovMurzin2018TextRecognitionUsingSkeletonRepresentationAndCNN/code/2_skeleton_creator/code/gen_filestxt.py | UTF-8 | 638 | 2.546875 | 3 | [] | no_license | import os
import sys
path = sys.argv[1]
class_type = path.replace(os.sep, '').replace('.', '')
class_label = (0 if class_type == 'normal' else 1)
pictures = list(filter(lambda x : x.endswith(".png"), os.listdir(path)))
pictures = list(map(lambda x : '../' + path[2:] + '/' + x, pictures))
picture_names = list(map(la... | true |
b9bcd4f8b351cee5fb5ef6b0d0c0252cbfd746c3 | shrutikmali/PathFinder | /pathfind.py | UTF-8 | 12,154 | 3.453125 | 3 | [] | no_license | import pygame
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
WHITE = (255, 255, 255)
YELLOW = (234, 255, 0)
GREY = (170, 170, 170)
BLACK = (0, 0, 0)
LIGHT_BLUE = (196, 238, 245)
WIDTH = 600
PIXEL_SIZE = 25
PIXEL_X = WIDTH // PIXEL_SIZE # PIXEL_X is the dimension of array
startPlaced = False
end... | true |
1e32e969c5632820d6be7c040b3db19518f485c3 | cikent/Python-Projects | /Automate-The-Boring-Stuff-With-Python/Section_06_Lists/Lesson_14_ForLoopsWithLists_MultipleAssignments_AugmentedOperators/List_Augmented_Operators.py | UTF-8 | 544 | 4.09375 | 4 | [] | no_license | """
Augument Operators for += && *= work with Strings and Lists to concatenate them
"""
# Declare a String variable
myD2Class = 'Druid'
# print the String to console
print(myD2Class)
# Use an Augment Operator to concatenate the String
myD2Class += ' is awesome!'
# print the String to console again
print(myD2Class)
... | true |
b52ece8becd21b17c31d5ba8184d275e10a0fc6c | kartverket/where | /where/parsers/vmf1_grid.py | UTF-8 | 1,822 | 2.96875 | 3 | [
"MIT"
] | permissive | """A parser for reading VMF1 files
Description:
------------
Reads the gridded coefficient 'a' for the wet and hydrostatic delay model.
Reads the gridded zenith wet and hydrostatic delay from the model.
Reads the gridded ellipsoidal heights.
The first line in each VMF1 gridded file is a header showing the values in ... | true |
36cc0891e7dcbf2e55b9bf61b9c39b1a26f9daaf | JOSETUZ-PUMAS/PYTHON | /max3.py | UTF-8 | 329 | 4.03125 | 4 | [] | no_license | x=input("Escriba el dato 1: ")
y=input("Escriba el dato 2: ")
z=input("Escriba el dato 3: ")
def mayorNum():
#print ("numeros:", x, y, z)
mayor=0
if x>y:
mayor=x
elif y>x:
mayor=y
if mayor>z:
mayor=mayor
elif z>mayor:
mayor=z
print ("el mayor de los 3 numeros es: ", mayor)
mayorNum()
#aun no fun... | true |
012366170a9c6cde420bf2c1fb26887cf83a783d | gjogjreiogjwer/jzoffer | /二叉树/二叉树的最近公共祖先.py | UTF-8 | 2,693 | 4.03125 | 4 | [] | no_license | # -*- coding:utf-8 -*-
'''
二叉树的最近公共祖先
给定一个二叉树, 找到该树中两个指定节点的最近公共祖先。
百度百科中最近公共祖先的定义为:“对于有根树 T 的两个结点 p、q,
最近公共祖先表示为一个结点 x,满足 x 是 p、q 的祖先且 x 的深度尽可能大
(一个节点也可以是它自己的祖先)。”
example1:
输入: root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 1
输出: 3
解释: 节点 5 和节点 1 的最近公共祖先是节点 3。
example2:
输入: root = [3,5,1,6,2,0,8,null,null,7,4], p ... | true |
35a16d0cd13fb88f75dc90169190694b72e6ef18 | liberbell/py28 | /processthread.py | UTF-8 | 1,442 | 3.296875 | 3 | [] | no_license | import time
import multiprocessing
import threading
# def square(numbers):
# for n in numbers:
# print("Square of %d is %d" %(n, n * n))
# def cube(numbers):
# for n in numbers:
# print("Cube of %d is %d" %(n, n * n * n))
num_list = [2, 3, 8]
# p1 = multiprocessing.Process(target=square, arg... | true |
1b2b1f53e4fa15b0e2c809af7b7b31d5ea8a2ee9 | alantao5056/python | /lessons/string_format.py | UTF-8 | 272 | 3.828125 | 4 | [] | no_license | nums1 = 3.141525546534
nums2 = 10.324892845
# PREVIOUS
# print('num 1 is ', nums1, 'and num 2 is ', nums2);
# FORMAT METHOD
# print('num 1 is {0:.3f} and num 2 is {1:.3f}'.format(nums1, nums2))
# USING F-STRINGS
print(f'nums 1 is {nums1:.4f} and nums 2 is {nums2:.4f}') | true |
b412a90441af9cf5f6ff54455654237245887552 | Rephilo/shuizhuyu | /machine_learing_book/Ch8regression/regresion.py | UTF-8 | 6,268 | 2.84375 | 3 | [] | no_license | from numpy import *
import matplotlib.pyplot as plt
from time import sleep
import json
import urllib.request
def load_data_set(file_name):
num_feat = len(open(file_name).readline().split('\t')) - 1
data_mat = []
label_mat = []
fr = open(file_name)
for line in fr.readlines():
line_arr = []
... | true |
c7abe0ff1f0ab993bda1a712097cc0418d7cf2a3 | Devendra33/HackerRank | /Python/Collection.OrderedDict().py | UTF-8 | 324 | 3.296875 | 3 | [] | no_license | # Enter your code here. Read input from STDIN. Print output to STDOUT
from collections import OrderedDict
n = int(input())
dic = OrderedDict()
for i in range(n):
lst = input().rpartition(" ")
val = lst[2]
str1 = lst[0]
dic[str1] = dic.get(str1,0)+int(val)
for k in dic.keys():
print(k,dic[k... | true |
dc68a41bd5597043402ab48f3afb6049df47d7d8 | mo-mosverkstad/my_data_structure | /test_my_queue.py | UTF-8 | 1,307 | 3.25 | 3 | [] | no_license | import unittest
from my_queue_stack import my_queue
class Test_queue(unittest.TestCase):
def setUp(self):
self.queue = my_queue()
self.queue.enqueue(0)
self.queue.enqueue(1)
self.queue.enqueue(2)
self.assertEqual(len(self.queue), 3)
self.assertEqual(self.queue.front(... | true |
c925d983cb4baf610caa8533b4150f304eb7bb8a | wsgan001/PyFPattern | /Data Set/bug-fixing-5/f37dbf859bd51da1e36556f07ed884bc54b05849-<_ports_match>-bug.py | UTF-8 | 1,768 | 2.859375 | 3 | [] | no_license | def _ports_match(protocol, module_min, module_max, rule_min, rule_max):
'\n Capture the complex port matching logic.\n\n The port values coming in for the module might be -1 (for ICMP),\n which will work only for Nova, but this is handled by sdk. Likewise,\n they might be None, which works for Neutron, ... | true |
652b92a6b9dbcaa61a022c0a616411d1b7a74cb5 | Iside/sandbox | /examples/flask+zerorpc/api.py | UTF-8 | 1,018 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import json
import logging
import os
import redis
import sys
import zerorpc
class API(object):
def __init__(self, redis_url):
self._redis = redis.StrictRedis.from_url(redis_url, db=0)
def enqueue(self, value):
"""Enqueue the given value in Redis.
The value ha... | true |
5d239de0874f2961f08402c7574ff48b936cf6a8 | siege-analytics/statewide-disaggregations | /python/load_census_shapefiles.py | UTF-8 | 2,740 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
from utilities import *
import os
import gdaltools
def load_all_shapefiles_from_directory(target_directory=CENSUS_SUBDIRECTORY):
try:
for zipped_shapefile in target_directory.glob('**/*.zip'):
name_of_new_dir_for_unzip = zipped_shapefile.stem
path_for_new_... | true |
52aa4aaa3c9a3a19cd3a09f8b4e29ad04bb6bc5e | DeepuDevadas97/-t2021-2-1 | /Problem-3.py | UTF-8 | 396 | 3.90625 | 4 | [] | no_license | n = int(input("Input : "))
for i in range(1, n):
for j in range(1, i+1):
if i%2 == 0:
print(i-j+1, end=" ")
else:
print(j, end=" ")
print("")
for i in range(n, -1 , -1):
for j in range(1, i+1):
if i%2 == 0:
print(i-j+1,... | true |
cd834db8b4c93b5bb0c989788a8470ade7fd5d6d | colvert/bzzz | /hx711.py | UTF-8 | 2,740 | 2.65625 | 3 | [] | no_license | from machine import Pin
import struct
class HX711:
def __init__(self, dout, pd_sck, gain=128, debug=False):
self.pSCK = Pin(pd_sck, mode=Pin.OUT)
self.pOUT = Pin(dout, mode=Pin.IN, pull=Pin.PULL_DOWN)
self.DEBUG = debug
self.GAIN = 1
self.OFFSET = 0
self.SCALE = 1
... | true |
4df6c5af566ab411b8b90fa6069addcac0055c55 | shreyaspotnis/ljpd | /labjacksingle.py | UTF-8 | 7,596 | 2.59375 | 3 | [
"MIT"
] | permissive | """Implements a class to conveniently get single measurements from LabjackU3."""
import u3, LabJackPython
from time import sleep
from datetime import datetime
import time
import struct
import os
import cStringIO
import threading
import Queue
import ctypes, copy, sys
# define MODBUS registers
FIO_ANALOG = 50590
EIO_A... | true |
71416d1419d097defd07af69cc1c03018b17f3ce | vlemas/python-play | /playfiles.py | UTF-8 | 224 | 3.421875 | 3 | [] | no_license |
#with open('test.txt', 'a') as f:
# f.write('even nicer!!\n')
i=0
with open('test.txt', 'r') as f:
i+=1
print(str(i) +' ' + f.readline())
for line in f:
i+=1
print(str(i) +' ' + line, end='')
| true |
5132fd54e111eeaf802ac91ed330a0652e51dbd3 | stephtdouglas/k2phot | /phot.py | UTF-8 | 7,883 | 2.671875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | """Calculate fluxes and produce a lightcurve."""
import logging
import numpy as np
from astropy.wcs import WCS
from astropy.stats import sigma_clipped_stats
import photutils
from k2phot import centroid
def circ_flux(image, maskmap, ap_center, ap_radii, max_rad=None):
"""
Calculate flux in a circular apertur... | true |
8d63c11d7305f1847f9efd3e6da9c11fb78bcab0 | Szymonexis/Python-Sudoku-Solver | /sudoku__generator.py | UTF-8 | 11,434 | 3.640625 | 4 | [] | no_license | # Sudoku Generator Algorithm - www.101computing.net/sudoku-generator-algorithm/
from random import randint, shuffle
from time import sleep
class SudokuGenerator:
def __init__(self):
# initialise empty 9 by 9 grid
self.grid = []
self.grid.append([0, 0, 0, 0, 0, 0, 0, 0, 0])
self.gri... | true |
a88dba40f1f104bb650c038a308d7f5ab81b4703 | 18121861183/spider_learn | /unit5_save/11_mongo_search.py | UTF-8 | 1,058 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python
# coding:utf-8
"""
@author: Lieb
@contact: xx@xx.com
@software: PyCharm
@file: 11_mongo_search.py
@time: 2018/9/8 12:31
"""
import pymongo
from pymongo import MongoClient
client = MongoClient('mongodb://127.0.0.1:27017')
# 等价于 db = client['test']
db = client.test
collection = db.students
# find_one查... | true |
80fd89c32b7dbb33cd1a7b43055e6ab578585586 | Veronica-Kook/CapsuleNet | /utilizations_2nd_step.py | UTF-8 | 6,481 | 3.015625 | 3 | [] | no_license | from os.path import join
import numpy as np
from sklearn.model_selection import train_test_split
import tensorflow as tf
from imageio import imwrite
def split_data(batch_size, is_training=True):
'''
<ARGUMENTS>
# batch_size: # of samples that are going to be propagated through the network
# is... | true |
f3021ea99d63edd7b9a5ec777c01c69d7ad305eb | y-oksaku/Competitive-Programming | /AtCoder/abc/167a.py | UTF-8 | 140 | 3.25 | 3 | [] | no_license | import string
S = input()
T = input()
for a in string.ascii_lowercase:
if S + a == T:
print('Yes')
exit()
print('No') | true |
37638c675adb30cdb4258d286660d31d0da87533 | AmmarHasan/TrafficSceneClassification | /ML/vgg.py | UTF-8 | 3,564 | 2.890625 | 3 | [] | no_license | from keras import applications, layers, optimizers, Input
# Creating new model. Please note that this is NOT a Sequential() model.
from keras.models import Model
import numpy as np, numpy.random as npr
# Config
imagesAsArray = np.load("imagesAsArrayColor.npy")
labels = np.load("labelsVectorColor.npy")
numberOfTraining... | true |
082ba81838ce3808a20d2f6432a26f71a2c670a8 | alewis/jax_vumps | /numpy_backend/contractions.py | UTF-8 | 6,919 | 3.09375 | 3 | [
"MIT"
] | permissive | """
Low level tensor network manipulations.
Conventions
2 3 4
| | |
O U
| | |
1 1 2
2---A---3 1
| |
1 2--A--3
"""
import tensornetwork as tn
def leftmult... | true |
bf954004e740bc7a6153ab5042ab7d23abdad847 | sagargp/shdw | /rc/vim/bundle/completor.vim/pythonx/completor/patch.py | UTF-8 | 829 | 2.734375 | 3 | [
"MIT"
] | permissive | def _bytes(data):
if isinstance(data, str):
return data.encode('utf-8')
if isinstance(data, list):
for i, e in enumerate(data):
data[i] = _bytes(e)
elif isinstance(data, dict):
for k, v in data.items():
data[_bytes(k)] = _bytes(v)
return data
def patch... | true |
6215bdc9c8202c6b0a679165cd898f0cd364c153 | AlexEngelhardt-old/courses | /Data Structures and Algorithms/02 Data Structures/Week 5 and 6 - Binary Search Trees/x3_test.py | UTF-8 | 565 | 3.515625 | 4 | [] | no_license | from collections import namedtuple
from x3_is_bst_hard import IsBinarySearchTree, Node
tree = [
Node(2, 1, 2),
Node(1, -1, -1),
Node(2, -1, -1)
]
print(f"Should be True: {IsBinarySearchTree(tree)}")
tree = [
Node(2, 1, 2),
Node(1, -1, 3),
Node(3, -1, -1),
Node(2, -1, -1)
]
print(f"Should ... | true |
0e180333568f3a4022a50988fb49a27c82b91a4d | edwintcloud/algorithmPractice | /arrays/question6.py | UTF-8 | 249 | 3.671875 | 4 | [
"MIT"
] | permissive | def remove_duplicates(arr):
return list({i:0 for i in arr})
# test remove_duplicates function
numbers = [1,2,3,4,9,8,7,7,5,22,97,64,22,12]
result = remove_duplicates(numbers)
print("Numbers: ", numbers)
print("Numbers w/o Duplicates: ", result) | true |
60320530aceda7819407dc9d9378caf5b7223985 | Yoimer/raspberrypi-amanda-upwork | /dht22/lcd/demo_lcd_backlight.py | UTF-8 | 3,631 | 3.546875 | 4 | [] | no_license | # Simple string program. Writes and updates strings.
# Demo program for the I2C 16x2 Display from Ryanteck.uk
# Created by Matthew Timmons-Brown for The Raspberry Pi Guy YouTube channel
# Backlight: Enhanced by TOMDENKT - backlight control (on/off)
# Backlight: lcd_backlight(1) = ON, lcd_backlight(0) = OFF
# Backlight:... | true |
1add3e4ab14fee53a445e3fabca3285d1919664f | lzpnplon138/spider | /ArticleSpider/tools/crawl_xici_ip.py | UTF-8 | 3,466 | 2.828125 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
import requests
import MySQLdb
from scrapy.selector import Selector
from fake_useragent import UserAgent
class SqlConnection(object):
__instance = None
def __init__(self):
self.conn = MySQLdb.connect(host="192.168.4.40", user="root", passwd="123456", db="article", charset="u... | true |
3a3f48bf8b9d37cdbcb6f6febc351242a7423a42 | horenbergerb/BinaryQuadraticForms | /bqf.py | UTF-8 | 3,042 | 2.828125 | 3 | [] | no_license | from sage.all import *
from matplotlib import pyplot as plt
from matplotlib import animation
from math import sqrt, sin, cos, acos
STEPS = 70
PAUSE = 10
def get_lattice(cur_bqf):
coeffs = cur_bqf.coefficients()
base = sqrt(float(coeffs[0]))
side = sqrt(float(coeffs[2]))
phi = acos(float(coeffs[1])/s... | true |
7417a6b2ffab4120e461c49983ae4c18f954aa73 | stevelandeyasana/aoc2020 | /21.py | UTF-8 | 2,989 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
from util import *
PART = "a"
@attr.s
class Food:
ingredients = attr.ib()
allergens = attr.ib()
def parse(path=None):
FOOD_RE = re.compile(r'([^(]+) \(contains ([^)]+)')
for line in read_data(path=path):
m = FOOD_RE.match(line.strip())
yield Food(
in... | true |
28865ac26e20f006fc81302f58567ded538c32c9 | folivetti/Category4Programmers | /ADT/Zipper.py | UTF-8 | 1,322 | 3.671875 | 4 | [] | no_license | class Tree:
def __init__(self, x=None, left=None, right=None):
self.x = x
self.left = left
self.right = right
def __str__(self):
return f"({self.left} {self.x} {self.right})"
class Zipper:
def __init__(self, t):
self.left = t.left
self.right = t.right
self.focus = [(False, t.x, N... | true |
2c2d51b30a1099faadfa4e1d7d5d0403a1fc92c0 | Flatlightning/AASMA-2021 | /pathfind.py | UTF-8 | 3,083 | 3.671875 | 4 | [] | no_license | import queue
import sys
def createMaze(size):
maze = []
first_line = []
for _ in range(size+2):
first_line.append("#")
maze.append(first_line)
for x in range(size):
middle_line = ["#"]
for i in range(size):
middle_line.append(" ")
middle_line.append("#")... | true |