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 |
|---|---|---|---|---|---|---|---|---|---|---|
3d67493d36293d5c27985dd2424e0c395a283a66 | clapslock/python-assignments-2017 | /Class_1/Ex1.py | UTF-8 | 606 | 4.09375 | 4 | [] | no_license |
triangle_side = input("Lenght of the side of your triangle: ")
if triangle_side.isdigit():
float(triangle_side)
else:
while triangle_side.isdigit() != True:
triangle_side = input("Lenght of the side of your triangle: ")
triangle_height = input("Height of the trinagle: ")
if triangle_height.isdigit(... | true |
96d1bcaad1ba4b372be48bc7e6d262e2b3a74a38 | feliperuhland/movietime | /movietime/spiders/floripa.py | UTF-8 | 1,217 | 2.640625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import scrapy
from movietime.util import format_movie_name
class FloripaSpider(scrapy.Spider):
name = "floripa"
allowed_domains = ["floripashopping.com.br"]
start_urls = ['http://www.floripashopping.com.br/cinema/']
def parse(self, response):
for movie_link in respon... | true |
41660b2d423553b8963e751fe82efd2b0176d9ec | ethanlocke-oss/canvas_client | /canvas_client/util.py | UTF-8 | 7,907 | 2.703125 | 3 | [
"MIT"
] | permissive | import unicodedata
import shutil as shutil
import sys
import os
import json
import jsonpickle
import codecs
from pyunpack import Archive
from collections import namedtuple
import pandas as pd
import textwrap
import re
jsonpickle.set_preferred_backend('json')
jsonpickle.set_encoder_options('json', ensure_ascii=False, i... | true |
0f185f558cca5f40e0e0c6daea2ee174a7ebc72b | tanaytoshniwal/Spiders | /goodreadsQuotes.py | UTF-8 | 1,659 | 2.75 | 3 | [] | no_license | import urllib.request
from bs4 import BeautifulSoup
from sys import argv
import bs4
import unicodedata
import re
import json
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("term", help="search term")
parser.add_argument("pages", help="number of pages to be searched")
args = parser.parse_args()... | true |
04430247fd7e3bdcf075f7359adcc52ceb540516 | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_2_neat/16_0_2_chengineer_B.py | UTF-8 | 475 | 2.984375 | 3 | [] | no_license | import sys
def answer(s):
stack = s + '+'
flips = 0
for i in range(len(s)):
if stack[i] != stack[i+1]:
flips += 1
return flips
if __name__ == '__main__':
f = sys.stdin
fn = sys.argv[1]
f = open(fn)
if len(sys.argv) == 3:
output = open(sys.argv[2], 'w')
t = int(f.readline())
for _t in xrange(t):
s =... | true |
54dc0cc92c3b79da6903c9a4831f3da3e8f5af21 | MapleLeafKiller/entity2rec | /metrics/recall_at_n.py | UTF-8 | 647 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | """
Recall at N
"""
from . import MetricItem
class RecallAtN(MetricItem):
def __init__(self, k=10, cutoff=0.5):
super(RecallAtN, self).__init__()
self.k = k
self.cutoff = cutoff
def evaluate(self, qid, targets, items=None):
n_targets = len(targets)
num_rel = 0
... | true |
ed3365e3afe94a7b2ac0199f99340e25dd904c37 | ludiankai/trun_time | /turntime.py | UTF-8 | 1,412 | 3.5 | 4 | [] | no_license | # -*- coding:utf-8 -*-
import Tkinter
import time
from Tkinter import *
import tkMessageBox as messagebox
##转换时间的小工具
window = Tk()
window.geometry("300x300+500+500")
v = IntVar()
v.set(1)
print v.set(1)
Radiobutton(window, text = "时间戳转为时间!", variable = v, value = 1 ).pack(anchor = W )
Radiobutton(windo... | true |
b64dd01307855b2459b59942bc162a8d4287df8a | absop/PAT | /AdvancedLevel_C/1016.py | UTF-8 | 1,336 | 3.125 | 3 | [
"MIT"
] | permissive |
def tominute(time):
day, hour, minute = time
return (day * 24 + hour) * 60 + minute
def bill(time):
day, hour, minute = time
charge = day * rate[24]
charge += sum(rate[:hour])
charge += rate[hour] * minute / 60.0
return charge
customer, paired = {}, []
rate = [0.6 * int(i) for i in input(... | true |
3eedef3215093d957be2e10feda0776f140ce263 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2846/60632/234238.py | UTF-8 | 94 | 2.734375 | 3 | [] | no_license | n = input()
key = list(set(list(map(int, input().split(' ')))))
print(len(key) - key.count(0)) | true |
e49d73134244c7a114e602dd415c45377f26ef9e | jeffbass/rpi-backlight | /rpi_backlight.py | UTF-8 | 3,346 | 3.109375 | 3 | [
"MIT"
] | permissive | """rpi_backlight.py
A Python module for controlling power and brightness of the official Raspberry Pi 7" touch display.
Author: Linus Groh (mail@linusgroh.de)
License: MIT license
"""
from __future__ import print_function
import time
import os
import sys
__author__ = "Linus Groh"
__version__ = "1.3.1"
PATH = "/sys/cl... | true |
9f19683c9103c7478204511a188632b1b4bd1cda | BoraxTheClean/adaptable-antelopes | /src/application/editor.py | UTF-8 | 4,636 | 2.96875 | 3 | [
"MIT"
] | permissive | import os
import os.path
from shutil import copyfile
from prompt_toolkit.application import Application
from prompt_toolkit.filters import Condition
from prompt_toolkit.layout.containers import (
ConditionalContainer,
HSplit,
VSplit,
Window,
WindowAlign,
)
from prompt_toolkit.layout.controls import... | true |
b9ffe3ef0b3e3d1478f1948fa6ca465573789d3c | jbernrd2/blender-scripts | /blender_modules/functions/talbot_effect.py | UTF-8 | 3,389 | 3.0625 | 3 | [] | no_license | import math
import numpy as np
import matplotlib.pyplot as plt
# A one dimensional solution to a linear dispersive PDE
class TalbotSolution:
##### Constants #####
pi = np.pi
NFourier = 500
##### Fields #####
t = np.pi/6 # Time to graph solution at
r... | true |
7da0d6812ddb00b7564edbc2446044d2ebad3fae | adityaaggarwal19/Python-Code | /twenty_twenty_user_computer.py | UTF-8 | 386 | 3.34375 | 3 | [] | no_license | from random import randint
def comp_call(a,b):
return randint(a,b)
turn=0
x=0
while(1):
if turn==0:
x=int(input("Enter a Number"))
if x==20:
break
else:
turn=1
if turn==1:
y=comp_call(x+1,x+2)
print(y)
if y==20:
... | true |
4d18d11fc10479e96d6d40f86a5b7e273f2f0287 | cto-course-polimi/pl0com | /parser.py | UTF-8 | 8,748 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
"""PL/0 recursive descent parser adapted from Wikipedia"""
import ir
from logger import logger
from functools import reduce
class Parser:
def __init__(self, the_lexer):
self.sym = None
self.value = None
self.new_sym = None
self.new_value = None
self... | true |
030c51a476a3a37c68f861565631193beefa072c | Cameron-Calpin/Code | /Python - learning/Functions/sameObject.py | UTF-8 | 67 | 2.671875 | 3 | [] | no_license | def saver(x=None):
if x is None:
x = []
x.append(1)
print x
| true |
a6536fd4ee69c9e7f14147f59f229bf4ab21724b | LIMr1209/machine-learn | /Image_recognition/utils/imagefolder_splitter.py | UTF-8 | 3,246 | 2.65625 | 3 | [] | no_license | from sklearn.model_selection import train_test_split
from utils.get_classes import get_classes
from config import opt
import random
class ImageFolderSplitter:
def __init__(self, path, train_size=0.8):
self.path = path
self.train_size = train_size
self.x_train = [] # 训练图片
... | true |
83ad61d2619bb1ca26fad05f73878abaf6e94822 | seanbhart/anthracite-python | /anthracite/model.py | UTF-8 | 4,660 | 2.578125 | 3 | [] | no_license | import logging
from google.cloud import firestore
from db_local import db
from language_analysis.language_analysis import sentiment_analysis
from utils import settings
class Ticker:
"""A db object to retain settings regarding
which and how to search for Ticker symbols in text.
"""
def __init__(self,
... | true |
d6b044ac064cfb14c31551eb09f884eb3cf3ba8e | nanaiori/ProjetDjangoM1 | /projet/librairie/views.py | UTF-8 | 3,210 | 2.640625 | 3 | [] | no_license | from django.http import HttpResponse, Http404
from django.shortcuts import render
from django.shortcuts import redirect
from datetime import datetime
from .forms import ContactForm
from .forms import LivreForm
from librairie.models import Livre
def home(request):
livres = Livre.objects.all() # Nous sélectionnons t... | true |
491fa3cc259cdb99732c4bd8d2a2a1ecab09720c | lycantropos/seidel | /tests/integration_tests/nodes_tests/test_replace_with.py | UTF-8 | 1,231 | 2.640625 | 3 | [
"MIT"
] | permissive | from typing import Tuple
from hypothesis import given
from tests.utils import (BoundPortedNodesPair,
are_bound_ported_nodes_equal,
are_bound_ported_nodes_sequences_equal)
from . import strategies
@given(strategies.nested_nodes_with_children_pairs, strategies.nodes_p... | true |
3952720fcc5f4aec53e966c16bf1dac4ad53394e | childmodel/child | /Child/Postproc/childtools/readchild.py | UTF-8 | 4,988 | 2.765625 | 3 | [
"MIT"
] | permissive | #! /usr/env/python
"""
readchild.py: contains routines to read data from a CHILD run.
created oct 2013 gt
"""
import numpy
class Layer():
def __init__(self, thick, ctime, rtime, etime, erody, is_regolith, dgrade=[1.0] ):
self.thickness = thick
self.creation_time = ctime
sel... | true |
c7462d64b6e91c9b4a1359b148933cb639588d28 | shartrooper/My-python-scripts | /Python scripts/Rookie/file-reading-writing-process.py | UTF-8 | 4,512 | 4.34375 | 4 | [
"MIT"
] | permissive | #The File Reading/Writing Process
'''
The pathlib module’s read_text() method returns a string of the full contents of a text file.
Its write_text() method creates a new text file (or overwrites an existing one) with the string
passed to it. Enter the following into the interactive shell:
'''
from pathlib impor... | true |
2f26605c8149d3fa2cf0037922ebb87122062153 | rjmorla/helloworld | /my_Workspace/cst205/cvvdev/lab14.py | UTF-8 | 701 | 2.609375 | 3 | [] | no_license | from urllib.request import Request, urlopen
from bs4 import BeautifulSoup
import numpy as np
import cv2
mysite = "https://en.wikipedia.org/wiki/Pepe_the_Frog"
headers={"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169'}
link = Request(mysite, headers... | true |
28d6c347465dfa6bd21eeb4dc1c922bcb89d9ec0 | gabriellaec/desoft-analise-exercicios | /backup/user_078/ch40_2020_04_06_14_13_16_278906.py | UTF-8 | 245 | 2.609375 | 3 | [] | no_license | def soma_valores(valores):
s=0
i=0
while i<len(valores):
s= s+valores[i]
i=i+1
return s
def soma_valores(lista):
i=0
s=lista[i]
for i in range (1, len(lista)):
s=s+s[i]
return s
| true |
f325fc8cbc054080e362c0fa00a88cc632496f2c | sarphiv/dtu-intro-ai-exam-project | /environment/car.py | UTF-8 | 4,159 | 3.203125 | 3 | [] | no_license | import math
import numpy as np
import copy
class Car(object):
"""
Car with ability to move
"""
def __init__(self,
position,
bearing,
size,
velocity = np.zeros(2),
c_ = 0.000049,
c_v... | true |
659e2970aaa2e0851aad0645fbcc9a3e177648fa | Jaydeep9979/pythion | /Single_Number.py | UTF-8 | 231 | 2.75 | 3 | [] | no_license | import sys
sys.stdout = open('output.txt', 'w')
sys.stdin = open('input.txt', 'r')
import math
for testcase in range(int(input())):
arr=list(map(int,input().split()))
xor=0
for i in arr:
xor^=i
print(xor)
| true |
45156c5e7ea2f820a5766ff986ed0c81fb8da866 | kiran-kadam-2021/PythonTutorials | /BinarySearch.py | UTF-8 | 474 | 3.609375 | 4 | [] | no_license | pos = -1
def search(lst, n):
low, high = 0, len(lst)-1
while low <= high:
mid = (low + high) // 2
if lst[mid] == n:
globals()["pos"] = mid
return True
elif lst[mid] < n:
low = mid + 1
else:
high = mid - 1
r... | true |
804e47743dc63f699a1b951b2e53ab5e48138d6d | siyuez/Py_collections | /lru_cache.py | UTF-8 | 165 | 3.21875 | 3 | [] | no_license | import functools
#Least Recently Used
@functools.lru_cache()
def fib(n):
if n < 2:
return n
return fib(n-2) + fib(n-1)
if __name__=='__main__':
print(fib(6))
| true |
5f6ac69f835d445a78e68743e16a9231dcebf520 | xxxfly/PythonStudy | /ProjectBaseTest1/python核心编程/02-高级3-元类/04-內建属性.py | UTF-8 | 2,778 | 3.296875 | 3 | [] | no_license | #-*- coding:utf-8 -*-
from functools import reduce
# 常用专有属性 说明 触发方式
# __init__ 构造初始化函数 创建实例后,赋值时使用,在 __new__ 后
# __new__ 生成实例所需属性 创建实例时
# __class__ 实例所在的类 实例. __class__
# __str__ 实例字符串表
# 示,可读性 print(类实例),如没实现,
# 使用repr结果
# __repr__ 实例字符串表
# 示,准确性 类实例 回⻋ 或者
# print(repr(类实例))
# __del__ 析构 del删... | true |
34bc719c358d97f742d895eabcd66de37d7b9418 | RoyLaw/RushAssis | /common/consultation_from_baidu.py | UTF-8 | 1,800 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
'''
@author: Roy Law
@license: (C) Copyright 2018.
@contact: https://github.com/RoyLaw
@file: consultation_from_baidu.py
@time: 2018/1/15 下午1:40
@desc:
@ref: https://github.com/smileboywtu/MillionHeroAssistant/blob/master/core/baiduzhidao.py
'''
import operator
import ... | true |
73cd8543d131f042830f0183c8375b6ec8a4bb50 | Zxttttttt/Machine-Learning | /Examples/Example1 Y=x+0.3.py | UTF-8 | 995 | 2.890625 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
#create data
x_data=np.random.rand(100).astype(np.float32)
y_data=x_data*0.1+0.3
###create tensorflow structure start###
Weights=tf.Variable(tf.random_uniform([1],-0.1,1.0))
biases=tf.Variable(tf.zeros([1]))
y=Weights*x_data+biases
loss=tf.reduce_mean(tf.square(y-y_data))
... | true |
9c1e80184a43f0e66dbba2cd603d7aad750a42d7 | juanfromqa/CursoPython | /Fase 4 - Temas avanzados/Tema 13 - Interfaces graficas con tkinter/text.py | UTF-8 | 181 | 2.84375 | 3 | [] | no_license | from tkinter import *
root = Tk()
texto = Text(root)
texto.pack()
texto.config(width=30,height=10, font=("Consolas", 12), padx=15,pady=15, selectbackground="red")
root.mainloop() | true |
863bfbffc88d5fc0fd20a82ec524421899b14056 | kohnakagawa/ghidra_scripts | /ghidra9.2.1_pyi/ghidra/formats/gfilesystem/GFileSystemBase.pyi | UTF-8 | 4,483 | 2.578125 | 3 | [
"MIT"
] | permissive | from typing import List
import ghidra.formats.gfilesystem
import ghidra.util.task
import java.io
import java.lang
class GFileSystemBase(object, ghidra.formats.gfilesystem.GFileSystem):
"""
This is the original GFileSystem implementation abstract base class, with most of the
initially implemented filesyst... | true |
83fb664af4e006421eb6376592d80b74d9af12d2 | resul4e/INFOMR-Project | /Evaluation/compute_tiers.py | UTF-8 | 1,854 | 2.875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
precision_knn = np.loadtxt('statistics_knn_1813.csv', dtype='str', delimiter=',')
precision_ann = np.loadtxt('statistics_ann_1813.csv', dtype='str', delimiter=',')
query_knn = precision_knn[:, 0]
results_knn = precision_knn[:, 1:]
query_ann = pre... | true |
121fc8c03b8db8dbab16845a04c93abbd6eee351 | TerryDuan/PokerSchool | /TexasHoldemCalculators_v0.py | UTF-8 | 398 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 11 22:32:33 2020
@author: terry
helper functions for playerClass's action()
"""
from cardClass import Card, PokerCard
def calc_prob(c1 : PokerCard, c2 : PokerCard):
pass
def calc_equity():
pass
def find_winner(**args):
"""
given multi... | true |
a80c41163ad65fb6a68073681c17c55d769979ed | ThDePaula/Exercicios-Python | /ex058.py | UTF-8 | 668 | 4.125 | 4 | [] | no_license | from random import randint
computador = randint(0, 10) #A máquina irá pensar nos valores entre 0 a 10.
print('-'*40)
print('Pensei em um número de [0 a 10] \nTente adivinhar!')
print('-'*40)
acerto = False
tentativa = 0
while not acerto:
jogador = int(input('Em que número eu pensei? '))
if jogador == computador... | true |
e1ad31614efec1431f1f31a80bc9eab5e33246a6 | Turtle-Hwan/Python-class | /12강/1202 (5).py | UTF-8 | 217 | 3.3125 | 3 | [] | no_license | #실습 5
import queue
q = queue.Queue()
print(q.queue)
q.put('사과')
q.put('딸기')
print(q.get())
print(q.queue)
q.put('포도')
print(q.get())
q.put('귤')
print(q.queue)
print(q.qsize())
| true |
954ac58fbc6b4dc62015170f4c50d931b9388657 | vortex-exoplanet/PyAstrOFit | /PyAstrOFit/Orbit.py | UTF-8 | 31,756 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 17 07:45:24 2014
@author: Dr. Olivier Wertz
"""
from __future__ import print_function
from __future__ import absolute_import
__all__ = ["Orbit"]
import math
import numpy as np
from astropy import constants as const
from astropy.time import Time
import matplotlib.pyplot... | true |
b3ad9ad57a6f194c73f2fedfd6c40e6d74e46918 | lfntchagas/security-exploits | /helloword.py | UTF-8 | 56 | 3.046875 | 3 | [] | no_license | name = 'sam'
new_name = 'p' + name[1:]
print(new_name)
| true |
d2693170444cd10aea676e4de9675734793f2087 | roberson-miguel/python_Aprendizado | /lista_convidado_while.py | UTF-8 | 277 | 4 | 4 | [] | no_license | convidados = int(input("Numero de convidados: "))
pessoas = []
while convidados > 0:
#nome = input("digite um nome de convidado: ")
pessoas.append(input("digite um nome de convidado: "))
convidados = convidados - 1
print("Os convidados são: ", pessoas)
| true |
cb161dd798c6e9574da1026c9a91cc917a978367 | aming0518/PythonStudy | /元组特点.py | UTF-8 | 193 | 2.90625 | 3 | [] | no_license | mydata=1,2,3,4,5,6
print(type(mydata))
#mydata=()#元组为空
print(type(mydata))
#mydata[1]=10#不可以修改
print(mydata[1])
for i in range(len(mydata)):
print(mydata[i],id(mydata[i])) | true |
72f51b35b7d5210d63bedaac3ff5fe21904e6de6 | UranMai/Master-project | /MDA code/centroid_np.py | UTF-8 | 12,951 | 2.703125 | 3 | [] | no_license | import sys
from igraph import Graph
import warnings
from functools import reduce
from pandas.core.common import SettingWithCopyWarning
from score_functions import *
warnings.filterwarnings(action="ignore", category=DeprecationWarning)
warnings.filterwarnings(action="ignore", category=UserWarning)
warnings.simplefilter... | true |
17a1c46879bcbf7009a8075b71f047b2c333d524 | KevinBoxuGao/ICS3UI | /Unit 4/Lesson 8/Rainfall.py | UTF-8 | 762 | 3.359375 | 3 | [
"MIT"
] | permissive | from tkinter import *
from time import *
from random import *
root = Tk()
screen = Canvas( root, width=800, height=800, background = "lightgrey" )
screen.pack()
x = []
y = []
rainDrops = []
lengths = []
speeds=[]
for i in range(800):
x.append(randint(0,800))
y.append(randint(-400,500))
... | true |
dbaa707db240e985fe4bce9469320dd57e502f6e | NikitaSikalov/BioinformaticsAlgorithms | /tasks/task18/progma18.py | UTF-8 | 4,080 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python3
from typing import Dict, List
import pyperclip
AMINO_ACIDS = [
57, 71, 87, 97,
99, 101, 103, 113,
114, 115, 128, 129,
131, 137, 147, 156,
163, 186
]
SEPARATOR = '-'
def parent_mass(spectrum: List[int]):
return max(spectrum)
def peptide_mass(peptide: List[int]):
r... | true |
31ad20309f85c7d9b097011cbe5648fcebae87b0 | wanderanimrod/Utraffic-Client--Sim-Engine | /application/models/data_server.py | UTF-8 | 1,361 | 3.078125 | 3 | [] | no_license | class DataServer:
#Make this a monotone class so we can get rid of centralising instantiation in another script
def __init__(self):
self.series = []
def add_series(self, series):
series.series_id = self.next_series_id()
self.series.append(series)
return series.series_id
... | true |
92f95c1f934ccca7ec170ee91ebe18f32035cf88 | jduan/cosmos | /python_sandbox/python_sandbox/tests/effective_python/test_item15.py | UTF-8 | 908 | 3.5625 | 4 | [
"MIT"
] | permissive | import unittest
from python_sandbox.effective_python.item15 import (
sort_priority,
sort_priority2,
sort_priority3,
)
class TestItem15(unittest.TestCase):
def test1(self):
numbers = [8, 3, 1, 2, 5, 4, 7, 6]
group = {2, 3, 5, 7}
sort_priority(numbers, group)
expected = [... | true |
2520a4f15c115fadf33c26f86897907b2586f5d0 | JoaoGustavo83/Student_Projects | /Desafio27.py | UTF-8 | 333 | 4.4375 | 4 | [] | no_license | """Programa lê o nome e imprime o primeiro e ultimo nomes."""
nome = str(input("Digite seu nome completo: ")).strip()
nomeSplit = nome.split()
print("Seu primeiro nome é {}{}{}".format("\033[4;36m",nomeSplit[0],"\033[m"))
print("Seu ultimo nome é: {}{}{}".format("\033[1;33m",nomeSplit[len(nomeSplit)-1],"\033[m"... | true |
92fa8653d1ed0b9bc05009ebe3bb8f23c9ca39f8 | tobereborn/python-recipes | /lng/template.py | UTF-8 | 739 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
class Template(object):
def __init__(self, user):
self._user = user
def language(self):
pass
def program(self):
print('{0} is working on {1}'.format(self._user, self.language()))
class JavaWorker(Template):
def __init__(self, ... | true |
7af8403bd165fe717ed4f779033127c2c56edd2a | NikolayOtmakhov/np-can-learn | /loss.py | UTF-8 | 1,145 | 3.140625 | 3 | [] | no_license | import numpy as np
class Loss:
def get_loss(self, y_pred, y_true):
# Same function for all loss functions
lst_neg_log_confidence = self.calculate(y_pred, y_true)
# Mean of the losses
return np.mean(lst_neg_log_confidence)
def get_accuracy(elf, y_pred, y_true):
... | true |
050b6bf6677dec1821240d68d552b203fe3cabb2 | ccrxf/FDA | /detectorsMap.py | UTF-8 | 490 | 2.59375 | 3 | [] | no_license | import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import numpy as np
a = np.load('npfiles/metadata.npy')
detData = a.tolist()
locations = [[], []]
for i in range(0, len(detData[0])):
locations[0].append(float(detData[5][i]))
locations[1].append(float(detData[6][i]))
m = Basemap(llcrnrl... | true |
e6a02d527c9ca314de78c6a85da91526a6f0343e | smvazirizade/INFO521 | /HW2/problem 1-4/hw1.py | UTF-8 | 537 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 9 14:05:43 2017
@author: smvaz
"""
#importing the library
import numpy
import fitpoly
#reading the data from the folder data
A=fitpoly.read_data('data/mens100.csv', d=',')
#seperating the columns
x=(A[:,0])
t=A[:,1]
#printing the reasults for checking
print('x=%s' % (x))... | true |
b96d262281d5acd1465a6282e82b329edba3317f | mkoryor/Python | /coding patterns/tree Depth First Search/all_path_for_sum.py | UTF-8 | 1,819 | 4.25 | 4 | [
"Unlicense"
] | permissive |
"""
[M] Given a binary tree and a number ‘S’, find all paths from root-to-leaf
such that the sum of all the node values of each path equals ‘S’.
tree: 1
7 9
4 5 2 7
S: 12
Output: 2
Explanation: There are the two paths with sum '12':
1 -> 7 -> 4 and 1 -> 9 -> 2
"""
# Time: O(NlogN) Space: O(N)
class Tre... | true |
03e6c34b2bc5889a5741a7e7761a6dd58f2fa82e | zdenek-nemec/sandbox | /anomaly-detector/sip_statistics_check/fix_threshold.py | UTF-8 | 545 | 3.015625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
class FixThreshold(object):
"""Fix Threshold"""
def __init__(self, minimum):
if type(minimum) != int:
raise TypeError("The minimum must be an integer")
self._minimum = minimum
def get_outliers(self, data):
if type(data) != list:
raise... | true |
acb7990bb56051594b2fbc69d7067d16e53d2df5 | Makima7/Spider | /list_spider.py | UTF-8 | 4,261 | 2.796875 | 3 | [] | no_license | # --codeing=utf-8--
from bs4 import BeautifulSoup
import re
import requests
import urllib.request
import urllib.error
import xlwt
import sqlite3
"""
提取当前steam热销榜首页所有独立游戏的价格、链接、评价、发行日期,并生成excel表格
价格过滤基于人民币计算,需要使用中国大陆IP访问
"""
# 如果使用正则表达式
# findLink = re.compile(r'<a href="(.*?)">')
# findImgSrc = re.compile(r'<img.*... | true |
dc61595f619fdf343adf9cf8912ddf1fe87039ff | gsdu8g9/stado | /tests/examples/__init__.py | UTF-8 | 1,995 | 3.03125 | 3 | [
"MIT"
] | permissive | import unittest
import shutil
import tempfile
import os
import inspect
from stado.console import Console
class TestExample(unittest.TestCase):
@property
def path(self):
return os.path.dirname(inspect.getfile(self.__class__))
@property
def output(self):
return os.path.join(self.path,... | true |
0a654e3ee270d7e66ef7eb3fb88fb0af0d297caa | Gulfem93/Machine_Learning_Udemy | /Algoritma Sablonları/Classification/knn_deneme.py | UTF-8 | 1,176 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 6 18:50:13 2020
@author: sadievrenseker
"""
#1.kutuphaneler
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.preprocessing import LabelEncoder
#2.veri onisleme
#2.1.veri yukleme
veriler = pd.read_csv('veriler.csv')
#pd.read_csv("verile... | true |
41cd6fbe97fd440efd0875192b78988f49a7a494 | milyasyousuf/socialSearch | /scripts/twitter_search.py | UTF-8 | 3,147 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python
from tweepy import Stream
from tweepy.auth import OAuthHandler
from tweepy.streaming import StreamListener
from progressbar import ProgressBar, Percentage, Bar
import json
import config as c
import pandas as pd
import databaseFunction as d
import sys
#from pymongo import MongoClient
tweetList = []
t... | true |
26486396eeb67b49e696eaf10ecbae7c633f67ab | adviksinghania/cfc-assignments-pyboot | /assignment-1/q5.py | UTF-8 | 179 | 3.859375 | 4 | [] | no_license | #!/usr/bin/env python3
# q5.py
# Count number of digits in a number
n = int(input('Enter a number: '))
c = 0
while n != 0:
c += 1
n //= 10
print('Number of digits:', c)
| true |
2ee6aa4590b5a15f3067fdc6b6a848da0eb0cc53 | BGR360/mnist-tensorflow | /dataset/visualize_mnist.py | UTF-8 | 2,863 | 3.171875 | 3 | [] | no_license | """
Loads images from the MNIST TFRecords files and displays them in a grid.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import sys
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from MNISTData... | true |
13369b721f004d4b5911467ef59c255eb6d7697b | adgj5472/Python-Note | /example/code/ch04/dict4.py | UTF-8 | 252 | 3.9375 | 4 | [] | no_license | # dictionary
d1 = {"tom":30, "bobe":3}
print("d1 = " + str(d1))
d2 = {"bobe":3, "tom":30}
print("d2 = " + str(d2))
# Member
print("tom" in d1) # True
print("tom" not in d1) # False
# Relational
print(d1 == d2) # True
print(d1 != d2) # False | true |
fe34894915ddf94c9e7826551e6e9659f85e195c | szabgab/slides | /python/examples/functions/dependencies/traversing_dependency_tree.py | UTF-8 | 522 | 2.734375 | 3 | [] | no_license | import sys
import os
if len(sys.argv) < 2:
exit("Usage: {} NAME".format(sys.argv[0]))
start = sys.argv[1]
def get_dependencies(name):
print("Processing {}".format(name))
deps = set(name)
filename = name + ".txt"
if not os.path.exists(filename):
return deps
with open(filename) as fh:
... | true |
7246a4e1a10376b185a8e89c2d2ba366a612dca4 | semihiseri/invaderBot | /trackGenerator3.py | UTF-8 | 1,744 | 2.75 | 3 | [] | no_license | import Draft
def generateTrack():
linklen=20 #15
"""lines = [4,3,3,4]
inx = 4
iny = 3"""
"""lines = [8,7,7,7,7,8]
inx = 8
iny = 5"""
"""lines = [6,4,4,4,4,6]
inx = 6
iny = 5"""
lines = [6,5,5,6]
inx = 6
iny = 3
linkId = 0
posx = 0
posy = 0
... | true |
16374c6883b45478428bf0ad1f96891713f6f272 | pthis/CppLogging | /scripts/hashlog-map/hashlog-map.py | UTF-8 | 4,324 | 3.015625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Hashlog map generate tool is used to parse C++ source files for logging format messages
and create the corresponding .hashlog binary file
"""
import codecs
import glob
import os
import re
import struct
import sys
__author__ = "Ivan Shynkarenka"
__email__ = "chronoxo... | true |
64bf51e72d53abbee3eb0716ea2eac20149101a8 | naveen6797/Git_tutorials | /matrix 3.py | UTF-8 | 713 | 3.828125 | 4 | [] | no_license | def create_matrix():
rows = int(input("enter how many rows"))
columns = int(input("enter how many colums"))
matrix = []
for i in range(rows):
each_row = []
for j in range(columns):
row_value=int(input("enter your values"))
each_row.append(row_value)
matrix... | true |
c68d417ce5bcb804d91397addf52448cede2fe9f | mingchia-andy-liu/practice | /daily/solved/5_medium_implement_car_and_cdr_COMPLETED/test.py | UTF-8 | 627 | 3.484375 | 3 | [] | no_license | import unittest
def cons(a, b):
'''Provided'''
def pair(f):
return f(a, b)
return pair
# Solutions before I realize Python supports lambda functions
def car_old(pair):
def first(a, b):
return a
return pair(first)
def cdr_old(pair):
def last(a, b):
return b
return pair(last)
# Lambda solut... | true |
6618748eb7eafc06934fa75267c6b529e54f02c5 | anas5550/algoritma | /konversi-suhu/main.py | UTF-8 | 195 | 3.5625 | 4 | [] | no_license | """
Copyright (c) 2021 Billal Fauzan
Created: 15 Juli 2021
"""
suhu = input("Suhu Celcius: ")
F = (9/5) * int(suhu) + 32
R = (4/5) * int(suhu)
print ("Farenheit: " + str(F))
print ("Reamur: " + str(R)) | true |
48c971d54fc032613ed236cb77ad7f3553e02c1d | Ycchen826/Data_operation | /rowmask_generate.py | UTF-8 | 4,288 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 14 11:34:39 2019
@author: Administrator
"""
# 导入库
import numpy as np
import csv
import os
import operator
import cv2
import shutil
from PIL import Image
def get_label_info(csv_path):
"""
Retrieve the class names and label values for the selected dataset.
Must... | true |
b45c86505db997a6c24e2a1166b1dab97b83d65b | fazlikeles/RACLAB | /Goruntu Isleme/Beginning/ornk33.py | UTF-8 | 662 | 2.8125 | 3 | [
"MIT"
] | permissive | #-*-coding: utf-8 -*-
#Countours Cizdirme
import numpy as np
import cv2
img=cv2.imread('resimler/python.jpg')
imgray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
ret,thresh=cv2.threshold(imgray,225,255,0)
image, contours,hierarchy=cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
#contours ile resmin k... | true |
bdeb547e7f79b0ffc6ba801e68fe0a3701e76a5e | vishnusangli/autonomous_cars | /worldcreation.py | UTF-8 | 4,965 | 2.578125 | 3 | [] | no_license | '''
This is the warm up assignment to the racetrack rendering
Should be completely standalone, including the render loop
'''
'''
Track input should be done as a track buffered object
The saved track should be of the same form of input as one gets when interactively creating it
'''
import numpy as np
import pyglet
from... | true |
d03a0563162023887cea4bea2c799750cbb47658 | mkumble/codestack | /StockPricePredictor/Plotter.py | UTF-8 | 1,117 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python
__author__ = "Mithun Kumble"
import pylab as plt
#Creates plots based on the parameters passed to the function
def createScatterPlot(xLabel,xValue,yLabel,yValue,fname):
""" Plot the values based on the parameters passed.
xlabel : Label for x axis
xValue : Values of x
ylabel : ... | true |
41bdfb1e398dc5b38835cfeffcbc16c4e1797b0e | brutaldamage/graphic-builder | /main.py | UTF-8 | 6,183 | 2.875 | 3 | [] | no_license | import click, datetime, logging
from casters import casters
from wand.image import Image, COMPOSITE_OPERATORS
from wand.drawing import Drawing, TEXT_ALIGN_TYPES
from wand.display import display
from wand.color import Color
@click.command()
@click.option('--date', '-d', help='The date of the match (x/x/xxxx)')
@click.o... | true |
4ae80c7dffca36575eb08c7544fe8883ade2f37f | pecey/InterviewPreparationKit | /Warm Up/counting_valleys.py | UTF-8 | 390 | 3.328125 | 3 | [] | no_license | def counting_valleys(n, path):
valleys = 0
previous_altitude = 0
for step in path:
if step == "D":
current_altitude = previous_altitude - 1
else:
current_altitude = previous_altitude + 1
if current_altitude == 0 and step == "U":
valleys = valleys +... | true |
b89a5edb4ba37ff3ae0009a0fefc3cc6f53e8f7c | mustangostang/mygrate | /db/alter.py | UTF-8 | 3,191 | 2.8125 | 3 | [] | no_license | class DatabaseDiff:
def __init__ (self):
self.TablesAdded = []
self.TablesDropped = []
self.TablesModified = []
def compare (self, src, dest):
for table in src.tables:
if not dest.tableExists (table):
self.TablesDropped.append(table)
continue
if dest.table (table.nam... | true |
d04de38b4f93afb1f31cf53603d08769ce9d0a9f | fexofenadine/brcm63xx-tch | /source/packages/mailman_2.1.20-1_brcm63xx-tch/usr/local/mailman/bin/dumpdb | UTF-8 | 4,269 | 2.59375 | 3 | [] | no_license | #! /usr/bin/python
#
# Copyright (C) 1998-2007 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any ... | true |
baf3b6beaf2e20266c3a2c9201854906935057a0 | mgbo/My_Exercise | /2017/Sympy/ODE_2016/kaca_self.py | UTF-8 | 489 | 3.171875 | 3 | [] | no_license |
# -*- coding:utf-8 -*-
from sympy import*
def pprints(func,*funcs):
pprint(func),
if funcs is None: return
for f in funcs:
pprint(f),
init_printing()
#
#
x = symbols('x')
y = Function('y')(x)
z = symbols('z')
eq = x**4 + y**4 - 2
# Make a differential equation
d_eq = diff(eq,x)
pprint (d_eq)
roots = solve(... | true |
c96a7767481d6889a3b059ea1309b8dedeb60eca | plastr/extrasolar-game | /tests/lib/test_locking.py | UTF-8 | 3,478 | 2.53125 | 3 | [
"MIT"
] | permissive | # Copyright (c) 2010-2011 Lazy 8 Studios, LLC.
# All rights reserved.
from front.tests import base
from front.lib import db, locking
from front.lib.locking import acquire_db_lock, acquire_db_lock_if_unlocked
class TestLocking(base.TestCase):
def test_acquire_db_lock(self):
with db.commit_or_rollback(self.... | true |
2be3db04ede845d7fa352619b50e1a48c6d9c2d4 | linukc/glowing-enigma | /heroes.py | UTF-8 | 10,632 | 3.015625 | 3 | [] | no_license | import pygame
import random
from config import *
from utils import load_image
class Bomb(pygame.sprite.Sprite):
image = load_image("bomb.png")
image_boom = load_image("boom.png")
def __init__(self, width_range, height_range, opponent):
super().__init__(all_sprites)
self.add(bombs_sprites)... | true |
ceffa30a5ae2a2891725f1798ab6a17e93926d3b | ohookins/opencv_playground | /chapter3/exercise6.py | UTF-8 | 781 | 3.265625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import cv2
from cv2 import cv
def a(img):
"""
Create two image headers from the image and draw rectangles in them.
"""
header1 = cv.CreateImageHeader(cv.GetSize(img),img.depth,img.nChannels)
header2 = cv.CreateImageHeader(cv.GetSize(img),img.depth,img.nChannels)
#(header1.width,heade... | true |
252dc7330d0dea11e85e4ebfaac9a5c619dffe4d | kokimoribe/moody | /moody/geo.py | UTF-8 | 1,401 | 3.125 | 3 | [] | no_license | """Helper functions to handle location context are defined here"""
import requests
from moody.config import GOOGLE_API_KEY
def google_places_from_coord(latitude, longitude):
"""
Query places near given coordinates from Google Places API
This can be done by using their web service via HTTP:
https://... | true |
7ded3bec54559f69d8a1adc66d41044e1bfd4e8f | kwanCCC/doraemon | /redisQ-client/src/test/script/getStatus.py | UTF-8 | 292 | 2.75 | 3 | [] | no_license | #!/usr/bin/python
import urllib2
import json
import sys
rs=0
for i in range(2, len(sys.argv)):
html = urllib2.urlopen('http://'+sys.argv[1]+':'+sys.argv[i]+'/health')
hjson = json.loads(html.read())
status=hjson.get("status")
if status=="UP":
rs+=1
print rs
| true |
91f638fe51a3f9558e0d0a043f829bc57a05b143 | lorenzo-deepcode/buildit-all | /jenkins-job-builder-addons/jenkins_jobs_addons/folders.py | UTF-8 | 1,861 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | """
The Folder plugin handles creating CloudBeesFolder Jenkins Jobs.
You man specify ``folder`` in the ``project-type`` attribute of the
:ref:`Job` definition.
Requires the Jenkins `CloudBees Folder Plugin.
<CloudBees+Folder+Plugin>`_
:arg str primary-view: Name of the default view to show for this folder.
:a... | true |
edc3ab382ab6db8ee848800a799b63069907b89a | tspannhw/Face-Recognition-System | /iot_control/iot_controller.py | UTF-8 | 4,564 | 2.6875 | 3 | [
"MIT"
] | permissive | import time
import datetime
import Adafruit_DHT
import sys
import requests
import RPi.GPIO as GPIO
import sqlite3
import spidev
DHT_TYPE = Adafruit_DHT.DHT22
DHT_PIN = 24
GPIO.setmode(GPIO.BCM)
ROOM_SENSOR_PIN = 27
DOOR_SENSOR_PIN = 23
GPIO.setup(ROOM_SENSOR_PIN, GPIO.IN)
GPIO.setup(DOOR_SENSOR_PIN, GPIO.IN, pull_up... | true |
af80382a0269f7f40fe6700eadbebf3295024f98 | mitchshiotani/cfb-led-scoreboard | /src/renderers/timekeeper.py | UTF-8 | 1,594 | 2.78125 | 3 | [
"MIT"
] | permissive | from rgbmatrix import graphics
from src.renderers.renderer_utils import RendererUtils
# TODO: set as constant read from config files
GOOD_COLOR_HEX = '26f50f'
DEFAULT_COLOR_HEX = 'ffffff'
class TimekeeperRenderer:
def __init__(self, canvas, data):
self.canvas = canvas
self.data = data
self.game = self.... | true |
1c81f6ec7cd384ee7084fec10be27e94fb8b6920 | shengwa/ava_fun | /video_download_script/video_download.py | UTF-8 | 5,198 | 2.65625 | 3 | [] | no_license | """Script to download youtube videos of AVA dataset.
"""
import argparse
import glob
import os
import pathlib
import re
import subprocess
import sys
import requests
import pafy
BASE_URL = 'https://www.youtube.com/watch?v='
UNAVAILABLE_VIDEOS_LINK = 'http://pascal.inrialpes.fr/data2/ava_cache/cache/'
YOUTUBE_FILE_PATT... | true |
2cfd2d0aee46fa30c29c1a6df662524cc3314288 | MLDawn/EBFDD | /DataPreparationScripts/Spambase_Script.py | UTF-8 | 1,426 | 2.640625 | 3 | [] | no_license | import numpy as np
import pandas as pd
def prepare_Spambase(normal, anomalous):
dataset = pd.read_csv('spambase.original.csv')
X = np.array(dataset[dataset.columns[1:]])
Y = np.array(dataset[dataset.columns[0]])
maximum = np.max(X, axis=0)
minimum = np.min(X, axis=0)
denum = maximu... | true |
5c6a972eddd525f6c19d55ca20d466a42b2b443b | uzaymacar/python-interview-review | /practice/CH2 - linked_lists/partition.py | UTF-8 | 4,333 | 4.09375 | 4 | [] | no_license | # LINKED LIST IMPLEMENTATION
class Element(object): # single unit (Node) in a linked list
def __init__(self, value = None): # to initialize a new element
self.value = value
self.next = None
def get_value(self): # get value (data) of element
return self.value
class LinkedLis... | true |
894a4f1dcf1798d6646386087f8385e2170205f9 | rajBandhakavi/Stock-Market-Correlation | /Correlation/Correlation_Spark.py | UTF-8 | 789 | 2.5625 | 3 | [] | no_license | import sys
from pyspark import SparkContext
from pyspark.mllib.regression import LabeledPoint
from pyspark.mllib.stat import Statistics
from pyspark.mllib.util import MLUtils
if _name_ == "_main_":
sc = SparkContext(appName="PythonPearsonCorrelation")
corrType = 'pearson'
arr1 = []
arr2 = []
dat... | true |
39f59800b871716eae1b6871e9d3a12da9fd1cd7 | txstate-coding-titans/hue | /data_extract.py | UTF-8 | 190 | 2.65625 | 3 | [] | no_license | import json
from pprint import pprint
with open('data.json') as f:
raw_data = json.load(f)
data = (raw_data['statuses'][1])
pprint(data)
if ~data["truncated"]:
print(data["text"])
| true |
2f231b9a4f489c292566a67980c5ebab553df5ee | aboyher/bioinfo | /assembly_to_fasta.py | UTF-8 | 650 | 3.046875 | 3 | [] | no_license | import sys
f = sys.argv[1]
with open(f, 'r') as fn:
line = fn.readline().rstrip("\n")
prev_contig = ""
c = 0
while line:
if line[0] == ">":
if ":::" in line:
contig = line[1:].split(":::")[0]
else:
contig = line[1:].split(" ")[0]
... | true |
a7e7852bc287ba68d88b18de244a3384e36d388a | abdellahseddikpro/IP-Bruteforce | /IP-Bruteforce.py | UTF-8 | 1,059 | 2.859375 | 3 | [] | no_license | #!/usr/bin/python
# AUTHOR TAHARDJEBBAR Abdellah seddik
# Mail : Abdellahseddikpro@gmail.com
''' This a free software that is use to brute-force a target(the target must be on your local network )if he is using an IP-based
ACL That allow a single host with a pre defined IP address to connect to the target, princi... | true |
2ea354f53cbdccea8e203a3791d2302d865db2f3 | jnawaz/Python-Scripts | /A3lan/MosqueDirectory.py | UTF-8 | 4,034 | 2.84375 | 3 | [] | no_license | import bs4
import io
from urllib import urlopen as uReq
from bs4 import BeautifulSoup as soup
baseurl = 'http://www.mosquedirectory.co.uk';
mosques = '/browse-mosques/alphabet/letter/A/1'
filename = "mosque.csv"
f = open(filename, "w")
isZedAndLastPage = False
lettersArray = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',... | true |
6022a8231d06aa4406ba0718c0324e9aa43070d2 | AhmadAli137/Pygame-Project | /settings.py | UTF-8 | 1,264 | 2.75 | 3 | [] | no_license | import pygame as pg
vec = pg.math.Vector2
import tkinter as tk
root = tk.Tk()
# define some colors (R, G, B)
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
DARKGREY = (40, 40, 40)
LIGHTGREY = (100, 100, 100)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
YELLOW = (255, 255, 0)
DARKRED = (102, 3, 19)
CYAN = (... | true |
d1215419cb7fb55bb391243d9fc995aed142242a | Pengrui-Feng/realtime_turtle | /getTurtleTagData.py | UTF-8 | 2,847 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 30 12:59:27 2019
@author: Jon ONeil
modified by Pengrui in Sep 30 without hardcodes testing one database "tu102"
found it needed sudo apt-get install mdb-tools
"""
import tqdm
import requests
import zipfile
import io
import subprocess
import os
#from turtle_email import s... | true |
2cf8173d70f95413432ab2b0a2a02a493ab66332 | forkdump/creepster | /app/services/user_network_service.py | UTF-8 | 1,998 | 3.359375 | 3 | [] | no_license | # user_network_service.py
from app.clients.instagram_client import InstagramClient
from app.clients.twitter_client import TwitterClient
from app.entities.user_network import UserNetwork
class UserNetworkService:
"""
Service that finds the most likely Instagram username that matches
a Twitter profile. Take... | true |
376d80011e12ef4fb1b195b23b2917809cbfcff8 | Ravenbrook/perforce-git-fusion | /bin/p4gf_profiler.py | UTF-8 | 3,831 | 3.21875 | 3 | [
"BSD-2-Clause"
] | permissive | #! /usr/bin/env python3.2
"""profiling classes"""
import time
import weakref
class Counter:
"""a class for counting things, for performance measurement"""
def __init__(self, name, units=''):
self.name = name
self.units = units
self.value = 0
def __iadd__(self, other):
if i... | true |
d307114c7c0077796f87eb57d15182d6cb3a5b07 | FlorianBury/MoMEMtaNeuralNet | /import_tree.py | UTF-8 | 5,369 | 2.828125 | 3 | [] | no_license | import glob
import os
import sys
import logging
import re
import collections
import copy
import array
import numpy as np
import pandas as pd
import parameters
from root_numpy import tree2array, rec2array
from ROOT import TChain, TFile, TTree
##########################################################################... | true |
9c52a1f716e3c38ba593e8babd00b2a359b19304 | chrissyblissy/thepantry | /__init__.py | UTF-8 | 19,595 | 2.640625 | 3 | [] | no_license | import os
from flask import Flask, render_template, request, redirect, session, flash
from flask_sqlalchemy import SQLAlchemy
from functools import wraps
from tempfile import mkdtemp
from sqlalchemy import create_engine, Table, MetaData
from sqlalchemy.sql import table, column, select, update, insert
from sqla... | true |
35d7cec0aabdb31c260f9ae02cf1cf0676b1e032 | shadab4150/hackerrank-maths | /Connecting Towns.py | UTF-8 | 1,211 | 3.59375 | 4 | [] | no_license | """"
https://www.hackerrank.com/challenges/connecting-towns/problem
""""
""""
Gandalf is travelling from Rohan to Rivendell to meet Frodo but there is no direct route from Rohan (T1) to Rivendell (Tn).
But there are towns T2,T3,T4...Tn-1 such that there are N1 routes from Town T1 to T2,
and in general, Ni routes from... | true |
a8d9cf79e5fde48a7bab2fccbfdddfcbfdc9e5c2 | mingrui4/Machine-Learning-Mini-Projects | /mp3/codefromscratch/main.py | UTF-8 | 1,176 | 2.8125 | 3 | [] | no_license | """Main function for binary classifier"""
import numpy as np
from io_tools import *
from logistic_model import *
import tensorflow as tf
""" Hyperparameter for Training """
learn_rate = 0.001
max_iters = 300
if __name__ == '__main__':
###############################################################
# Fill yo... | true |
6355ee08e2f737d6488f4c689004d5ff17475a1e | sanjayaravinth721/Score_Prediction | /main.py | UTF-8 | 796 | 3.046875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
dataset=pd.read_csv("Students_Score.csv")
dataset.head()
dataset.describe()
dataset.plot(x='Hours',y='Scores',style="*")
plt.title('Student mark prediction')
plt.xlabel('Hours')
plt.ylabel('Percentage marks')
... | true |
87f61d14f1e8562cbb53fb351c2a035af63ee7df | Keirua/aoc2020 | /9b.py | UTF-8 | 818 | 3.109375 | 3 | [] | no_license | import re
file = open('input/9.txt', 'r')
target = 1721308972
# file = open('input/9ex.txt', 'r')
# target = 127
data = [int(i.strip()) for i in file.readlines()]
def find_pairs(data, offset, preamble):
l = []
for i in range(0, preamble):
for j in range(0, preamble):
l.append((data[offset-(preamble+1)+i], d... | true |