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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
48ede395155fb122441b0ca217bcf93723c9d85c | Python | Marco87/Projects | /Python/Projetos/Bot WhatsApp/bot.py | UTF-8 | 4,328 | 2.984375 | 3 | [] | no_license | #Bibliotecas nativas do Python
import os
import time
import re
import requests
import json
#Bibliotecas que nós instalamos
from chatterbot.trainers import ListTrainer
from chatterbot import ChatBot
from selenium import webdriver
class wppbot:
#Setamos o caminho de nossa aplicação.
dir_path = os.getcwd()
#Noss... | true |
3f0b7eedb734fd53c606108de97a973973f70b25 | Python | ljia2/leetcode.py | /solutions/heap/719.Find.K-th.Smallest.Pair.Distance.py | UTF-8 | 1,908 | 3.96875 | 4 | [] | no_license | from heapq import heappop, heappush
import bisect
class Solution: # MLE
def smallestDistancePair(self, nums, k):
"""
Given an integer array, return the k-th smallest distance among all the pairs.
The distance of a pair (A, B) is defined as the absolute difference between A and B.
E... | true |
ac509bd0266b205e87f0c6f6372cf46ff5491c64 | Python | ECCO-GROUP/ECCOv4-py | /ecco_v4_py/tile_io.py | UTF-8 | 18,024 | 2.921875 | 3 | [
"MIT"
] | permissive | """
ECCO v4 Python: tile_io
This module provides routines for loading ECCO netcdf files.
--- now with actual documentation!
.. _ecco_v4_py Documentation :
https://github.com/ECCO-GROUP/ECCOv4-py
"""
from __future__ import division,print_function
import numpy as np
import xarray as xr
import glob
import os
import ... | true |
abe74689f6ec7b3304e15aaac21685bbcf79865e | Python | tpqls0327/Algorithm | /Baekjoon/Array/33273_두수의합_S.py | UTF-8 | 359 | 3.234375 | 3 | [] | no_license | # 두수의 합
import sys
input = sys.stdin.readline
n = int(input())
data = list(map(int, input().split()))
x = int(input())
data.sort()
result = 0
start, end = 0, n-1
while start < end:
tmp = data[start] + data[end]
if tmp == x:
result += 1
start += 1
elif tmp > x:
end -= 1
else:
... | true |
f02c8bcc41abfc28161d1cbc2b1d9946da83e45c | Python | jlserra/jserra-python-exercises | /Exercise3.py | UTF-8 | 688 | 3.875 | 4 | [] | no_license | class Pokemon:
def __init__(self, species, damage, health = 100):
self.species = species
self.damage = damage
self.health = health
def attack(self,enemyPokemon):
enemyPokemon.health -= self.damage
def displayStatistics(self):
print "Pokemon Statistics"
print... | true |
2ba01c58df83fa88484117a2a2554659f7f4729a | Python | Chenqianwu/AID1904 | /day03/images/05_baidu_image_xpath.py | UTF-8 | 2,251 | 2.625 | 3 | [] | no_license | import requests
from lxml import etree
import random
import time
class BaiduImageSpider(object):
def __init__(self):
self.headers = {'User-Agent':'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .... | true |
93d59f99b40e46c7f10841d44a3c38289df1b571 | Python | ecode-ethiopia/deepdiy | /deepdiy/test/draft/manager_in_multiprocess.py | UTF-8 | 931 | 3.25 | 3 | [
"MIT"
] | permissive | from multiprocessing import Process, Value, Lock
from multiprocessing.managers import BaseManager
from pysnooper import snoop
class Employee(object):
def __init__(self, name, salary):
self.name = name
self.salary = Value('i', salary)
self.data=[]
def increase(self):
self.salary... | true |
6b7cdc058ad538caa34ec4730b0c74ddc1fdc078 | Python | CristofherAndres/Codigos_Python | /guia asincronica 2/ejercicio7.py | UTF-8 | 168 | 3.953125 | 4 | [] | no_license | i = 0
mayor = -99999999999999999
while i<3:
num = int(input("Ingrese un número: "))
if mayor < num:
mayor = num
i+=1
print("El mayor es:",mayor) | true |
7ca5b3516b1769f15e6d6313b848fe389acbb0e4 | Python | yzl232/code_training | /mianJing111111/Google/手机上只有有限内存,请问何种格式更适合存储contact: hash-table 或 者 binary tree.py | UTF-8 | 430 | 3 | 3 | [] | no_license | # encoding=utf-8
'''
手机上只有有限内存,请问何种格式更适合存储contact: hash-table 或
者 binary tree。
面试官建议: 选binary tree. 因为用户需要看到sorted的结果, 而hashtable需要
额外的空间进行sorting。binary tree的插入和寻找虽然更加耗时,但是因为手机用户
contact数目有限(比如一般不超过1,000或者5,000个),所以O(logN)可以接受.
''' | true |
f5c99b36b66568b19e31ebc55e210936266ad61b | Python | octavian-negru/call-center-coding-exercise | /call_center/src/common/decorators.py | UTF-8 | 595 | 3.03125 | 3 | [] | no_license | import sys
import traceback
import functools
def log_crash(function):
"""
Decorator to log exceptions and stop program execution.
"""
@functools.wraps(function)
def wrapper(*args, **kwargs):
try:
return function(*args, **kwargs)
except:
exc_type, exc_value,... | true |
854fc230d5fb552508b50a273529c59f8e39e550 | Python | PrzemoPoz/p1 | /zjazd2/funkcje/slack7.py | UTF-8 | 672 | 3.78125 | 4 | [] | no_license | # Napisz program "prk.py", który obliczy wszystkie pierwiastki rzeczywiste równania kwadratowego o postaci ax2+bx+c=0,
# gdzie a, b i c podaje użytkownik.
# Program powinien na początku sprawdzić, czy wprowadzone równanie jest rzeczywiście kwadratowe.
def prk(a,b,c):
delta=b**2-4*a*c
if delta<0:
return... | true |
04e24ac916e0a7076e4df5e31eca6e7364d18293 | Python | ekaufmann/python-journey | /URI Online Judge/1072.py | UTF-8 | 361 | 3.484375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
n = int(input())
lista = []
for i in range(n):
numero = int(input())
if ((numero < (10 ** 7)) and (numero > (-10 ** 7))):
lista.append(numero)
i = 0
dentro = 0
fora = 0
while (i < len(lista)):
if (lista[i] in range(10, 20)):
dentro += 1
else:
fora += 1
i += 1
print("%... | true |
071e7515fdcd40b7fc3750ada352e13c9f2008f2 | Python | hsyissocool/rocket-lander | /Server.py | UTF-8 | 1,505 | 2.625 | 3 | [] | no_license | import socket
import struct
import traceback
import logging
import time
import subprocess
import numpy as np
from Controller import Controller
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
def sending_and_reciveing(controller):
s = socket.socket()
socket.setdefaulttimeout(None)
print(... | true |
faad7d66a40981051669c48247ecffbde86d1ca4 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_200/1855.py | UTF-8 | 655 | 3.078125 | 3 | [] | no_license | import fileinput
def solve(s):
tidy = 0
s = list(s)
if s[len(s)-1] is '\n':
s.pop()
while not tidy:
tidy = 1
for i in range(0, len(s)-1):
if int(s[i]) > int(s[i+1]):
tidy = 0
s[i] = str(int(s[i])-1)
for j... | true |
e9ac0fd2a12bfa4d6cd2ed89429873cfdb6e9416 | Python | timmr99/soloman | /code_eval.py | UTF-8 | 1,378 | 3.015625 | 3 | [] | no_license | #! /usr/bin/python3
# -*- coding: utf-8 -*-
import sys
class Cov:
def __init__(self, e, t):
self.effective = e
self.term = t
def __str__(self):
return 'Effective: {} Term: {}'.format(self.effective,self.term)
def longest(coverage):
if len(coverage) == 0:
return None
... | true |
e0b8beca3425de0f70a6cb627e20b90e7ab60342 | Python | crobertz/atcoder | /ABC155/poor.py | UTF-8 | 112 | 3.25 | 3 | [] | no_license | ABC = set()
for x in input().split():
ABC.add(x)
if len(ABC) == 2:
print('Yes')
else:
print('No')
| true |
883ed1b44f7f5b7648662afffcbb112b461e8337 | Python | TanJay/stress_app | /app/src/main/python/hrv.py | UTF-8 | 25,710 | 3 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
from typing import List, Tuple
from collections import namedtuple
import numpy as np
from scipy import interpolate
from scipy import signal
# Static name for methods params
MALIK_RULE = "malik"
KARLSSON_RULE = "karlsson"
KAMATH_RULE = "kamath"
ACAR_RULE = "acar"
CUSTOM_RULE = "custom"
# Frequency ... | true |
4b752ab005ba3609badb9eb754ca720cb7a5055c | Python | gordon-frost-hwu/ros_simple_rl | /src/utilities/line_generator.py | UTF-8 | 4,577 | 3.15625 | 3 | [] | no_license | #! /usr/bin/python
from scipy import random
from copy import deepcopy
import numpy as np
sin = np.sin
cos = np.cos
def noisy_variable(var, sig):
return var + np.random.normal(0.0, sig)
class LineGenerator(object):
points = []
thetas = []
num_segs = 5
_idx_of_closet_point = 0
def generate_lin... | true |
906f8a8086726dbfc0f83e1152ed39c7bcadc146 | Python | zhouyang123200/multimedia-manager-backend | /src/api/tests/test_video.py | UTF-8 | 5,820 | 2.65625 | 3 | [] | no_license | """
title: video api test
description: all test suits for video api
"""
import os
import json
import pathlib
from shutil import copyfile
from http import HTTPStatus
from urllib.parse import urlencode
from api.models.video import VideoSchema, VideoFileSchema
from api.utils.database import db
def test_empty_db(app):
... | true |
c92b5090e26ccac2f434dd4cdf17390c595d1a54 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_155/2652.py | UTF-8 | 497 | 3.3125 | 3 | [] | no_license | def read_input():
n, p = raw_input().split(' ')
n = int(n)
p = map(int, p)
return (n, p)
def solve_problem(inp):
n, p = inp
res, tot = 0, 0
for i in xrange(n+1):
res = max(res, i - tot)
tot = tot + p[i]
return res
def print_output(t, output):
pr... | true |
a7ba5413425cefa76d56ea3b3e8ea7e0e15c1b1b | Python | oelarnes/project-euler | /p17.py | UTF-8 | 951 | 4.21875 | 4 | [] | no_license | # #If the numbers 1 to 5 are written out in words: one, two, three, four, five, then
# there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
#
# If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words,
# how many letters would be used?
#
#
# NOTE: Do not count spaces or hyphens. For ... | true |
9efdb9f2f7d12910a4799a8c86259e73380b7d00 | Python | avasile96/AIA_ML | /source/main_1.py | UTF-8 | 8,623 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 18 21:20:23 2021
@author: vasil
"""
import os
import gc
import numpy as np
from skimage import io
import tensorflow as tf
from tensorflow.keras import layers
from tensorflow.keras.preprocessing.image import load_img
import keras
class patient:
def __init__(self, in... | true |
329c0edc50646d3ea98f8de739250821aadf58fa | Python | janick187/jira-api-client | /resources/permschemeupdater.py | UTF-8 | 1,035 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from .ApiClient import ApiClient, ApiCallError
from .config import Config
from .grouproleassigner import GroupRoleAssigner
class PermSchemeUpdater:
def __init__(self):
self.client = ApiClient()
self.fileReader = GroupRoleAssigner()
def updatePermScheme(self):
# ... | true |
3169d444a3be21f843acedaa20b2839843a80e7f | Python | windshadow233/DKN-NewsRecommendation | /config.py | UTF-8 | 284 | 2.6875 | 3 | [] | no_license | import json
class Config(object):
def __init__(self, config_file='config.json'):
with open(config_file, 'r') as f:
config_dict = json.loads(f.read())
for key, value in config_dict.items():
self.__setattr__(key, value)
config = Config()
| true |
33fd68f228296d3fb114090e5fcf83b9998ca85a | Python | NelsonGomesNeto/ProgramC | /UFAL/PAA/1practice/Prova/1264QuaseMenorCaminho.py | UTF-8 | 1,481 | 2.9375 | 3 | [
"MIT"
] | permissive | from heapq import *
inf = 2**33
def dijkstra(graph, cost, visisted, path, start):
cost[start] += [0]
#path[start] = start
pq = []
heappush(pq, [0, start])
while (pq):
c, v = heappop(pq)
if (visited[v]): continue
visited[v] = 1
for u in graph[v]:
... | true |
9c8af6a997d3e59b3d2e1950ae4282cb6ce61f4f | Python | Peter554/adventofcode | /2022/common/test_shortest_path.py | UTF-8 | 1,835 | 2.859375 | 3 | [] | no_license | import dataclasses
from common.shortest_path import find_shortest_paths, find_shortest_paths_simple
# https://de.wikipedia.org/wiki/Dijkstra-Algorithmus#Beispiel_mit_bekanntem_Zielknoten
@dataclasses.dataclass(frozen=True)
class City:
name: str
FRANKFURT = City("FRANKFURT")
MANNHEIM = City("MANNHEIM")
KASSEL ... | true |
b9769b2b56699f6cf4195a1dda1514c0a69d5b2d | Python | dkwired/coursework | /cs141/labs/lab4/lab4.py~ | UTF-8 | 3,258 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python2.7
import sys, timeit, random, math
debug = False
class LargeInt:
base_bits = 32
base = 1 << base_bits
base_mask = base - 1
def __init__(self, value = 0):
if type(value) == list:
self.digits = value
elif type(value) == LargeInt:
self.digits = list(v... | true |
03051c697ec393511eb95a15dd9c4947f169b895 | Python | BlackHart98/Chirp | /Litmus/Core/__init__.py | UTF-8 | 5,675 | 2.734375 | 3 | [
"MIT"
] | permissive | # this function is correct but can be improved on #
from Litmus.Genetics import LitmusGenetics
import Litmus.Functions as lf
import numpy as np
class LitmusCore:
# ======================================================================================== #
# Litmus class contains the following members: ... | true |
45aa3c5f5466116ed1b3afd3f09701e6cf6ea869 | Python | OpportunV/adventofcode | /2022/d16.py | UTF-8 | 2,280 | 3.203125 | 3 | [] | no_license | import re
from collections import defaultdict
class Cave:
__slots__ = ('rates', 'paths', 'distances', 'results', 'valve_to_bits')
def __init__(self, inp):
self.rates = {}
self.paths = {}
self.valve_to_bits = {}
self.distances = defaultdict(lambda: int(1e5))
self.re... | true |
579478b0b2251deda0df6ad61c26bec872c82a6c | Python | Jrufino/ListaRepeticaoPython | /ex23.py | UTF-8 | 443 | 3.65625 | 4 | [] | no_license | sair='N'
primos=[2,3,5,7]
while sair !='S':
num=int(input('Digite um numero inteiro: '))
i=1
for i in range (1, num):
if i!=1 and i%2!=0 and i%3!=0 and i%5!=0 and i%7!=0:
primos.append(i)
i=i+1
print('Primos entre 1 e {}'.format(num))
print('\n{}'.format(primos))
... | true |
b4d2978ffb03195ef01bab8b991fafceaa1d681d | Python | stuartjohnpage/Advent_of_code_2020 | /Day 4/passport_checker.py | UTF-8 | 2,542 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Date: 12/4/2020
Author: Stuart Page
"""
import re
passport_data = []
passports_to_check = [[]]
passport_counter = 0
with open('input.txt', 'r') as f:
data = f.readlines()
for line in data:
line = line.rstrip()
passport_data.append(line)
for line in passport_data:
if line == ... | true |
5b7cad417737f18c1fabf30693d23e114f9f5aed | Python | yarsanich/prismcalibration | /linearmath.py | UTF-8 | 6,702 | 3.734375 | 4 | [] | no_license | from typing import NamedTuple
from math import sqrt
class Point(NamedTuple):
x: int # Ignore PEP8Bear
y: int
def __repr__(self):
return str((self.x, self.y))
def __str__(self):
return str((self.x, self.y))
class Vector:
def __init__(self, x, y):
self.x = x
self... | true |
03471dc934ed678026f8d7b7eb07fc14b520ba4d | Python | ICRA-2021/FWBO | /nfwbo/design_optimize_alg/surrogates/kernels/FabolasKernel.py | UTF-8 | 1,452 | 2.53125 | 3 | [] | no_license | '''
https://github.com/EmuKit/emukit/blob/master/emukit/examples/fabolas/fabolas_model.py
'''
import GPy
import numpy as np
class FabolasKernel(GPy.kern.Kern):
def __init__(self, input_dim, basis_func, a=1., b=1., active_dims=None):
super(FabolasKernel, self).__init__(input_dim, active_dims, "FabolasKe... | true |
d04773efdbb068dbb062e57c66b94d0047ac03e5 | Python | Andremarcucci98/Python_udemy_geek_university | /Exercícios/funcoes/exercicio_12.py | UTF-8 | 273 | 4.15625 | 4 | [] | no_license | """
Soma de algarismos
"""
def soma(num):
result = 0
while num > 0:
result += num % 10
num = num // 10
return result
n = int(input('Digite um numero para saber a soma de algarismos: '))
print(f'A soma dos algarismos de "{n}" é {soma(n)} ')
| true |
f4902119925f3473e96884f5f662eac7bde9eaf8 | Python | strategist922/SemEval2019-OffensEval | /code/preprocess_demo.py | UTF-8 | 35,037 | 2.75 | 3 | [] | no_license | #! /usr/bin/env python
# _*_coding:utf-8_*_
# project: SemEval2019
# Author: zcj
# @Time: 2019/1/4 10:18
import re
def emoji_to_text(review_text):
# review_text = str(review_text)
review_text = review_text.replace("👊", " Oncoming Fist ")
review_text = review_text.replace("😂", " Face With Tears of Joy ")... | true |
8a819033794ccc7ac89e5a7431255a9e9f917483 | Python | yunusemre002/YTU-Lessons | /Numarical_Analysis_Methods/3_8_Simpson.py | UTF-8 | 1,676 | 3.53125 | 4 | [] | no_license | """ formük basit
h = (y-x)/n
simpson = h/3 [f(x)+f(y) + 4*f(tekler) + 2*f(çiftler)]
"""
from scipy import poly1d # To take a polinoms, derivation, and equations good!
derece = int(input("Polinomun en yuksek derecesini giriniz : "))
dizi = []
for i in range(derece, -1, -1):
add = float(input("Derecesi {... | true |
a47c699913aa7c7bb877f687b5497688baae64a9 | Python | eirikeve/dungeon-generator | /utils.py | UTF-8 | 1,277 | 3.59375 | 4 | [] | no_license | import argparse
MINIMUM_VALUE = 5
def check_positive(value):
""" Check if value is a positive integer, if not raise exception to argparse"""
try:
value = int(value)
except ValueError:
raise argparse.ArgumentTypeError("%s is not an int value" % value)
else:
if value < 0:
... | true |
7c10b2fafd27b6a182a2e486e73030738c226f57 | Python | darling-kefan/practices | /python/examples/classmethod.py | UTF-8 | 381 | 2.984375 | 3 | [] | no_license | class A:
name = 'polarsnow'
def __init__(self, name):
self.name = name
def f(self):
return self.name
@classmethod
def f2(cls):
return cls.name
@staticmethod
def f3():
return A.name
if __name__ == '__main__':
a = A('lvrui')
print(a.f())
print(a... | true |
3c056a9d5b02daadccd4032785760a10230d3e49 | Python | Amagash/Udacity_Python | /Intermediate-python-nanodegree/Functional-programmig/Practice-map-filter.py | UTF-8 | 1,428 | 4.21875 | 4 | [] | no_license | # Practice with map
# Fill out the rest of the map functions.
# You can define additional functions if you need to.
# (a) ["apple", "orange", "pear"] => (5, 6, 4) (length)
# (b) ["apple", "orange", "pear"] => ("APPLE", "ORANGE", "PEAR") (uppercase)
# (c) ["apple", "orange", "pear"] => ("elppa", "egnaro", "raep") (re... | true |
6f3f34db2bf21e0b2155c828d76e7878a45425fa | Python | andrewguenthner/python-challenge | /PyPoll/main.py | UTF-8 | 7,809 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
PyPoll: Automatically counts votes from a specific file,
Resources/election_data.csv, and puts the tally in a file
called PyPoll_results.txt (same folder as script)
The design doc and detailed information is avaialbe in the README
file included with this script.
Important design note: ... | true |
65c839732917d5a7d465dcf794f36be60f825be5 | Python | networkdynamics/perspective-initiative | /src/API_analysis/modular_classifier/trainModule.py | UTF-8 | 1,201 | 2.59375 | 3 | [] | no_license | '''
@Saleem
training module for dangerous speech
'''
import sys
sys.dont_write_bytecode = True
#-----------------------------------------------------------------------------------------------
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from ... | true |
285629d5e7e58e7c1c1072cac71ab9d963317116 | Python | Shivanshgarg-india/pythonprogramming-day4 | /clousre and decorators/question 2.py | UTF-8 | 295 | 3.734375 | 4 | [] | no_license | # Python closure with nonlocal keyword
def make_counter():
count = 0
def inner():
nonlocal count
count += 1
return count
return inner
counter = make_counter()
c = counter()
print(c)
c = counter()
print(c)
c = counter()
print(c) | true |
b7bdc2813709d2471e74a9499e02f2fede2dcd4d | Python | sami-one/mooc-ohjelmointi-21 | /osa11-07_lottorivi/test/test_lottorivi.py | UTF-8 | 8,193 | 2.6875 | 3 | [] | no_license | import unittest
from unittest.mock import patch
from tmc import points, reflect
from tmc.utils import load, load_module, reload_module, get_stdout, check_source
from functools import reduce
import os
import os.path
import textwrap
import inspect, re
from random import choice, randint, shuffle
exercise = 'src.lottoriv... | true |
3be08f648d1ac3dd4de04ec06aacc3bba65a4396 | Python | webjoe/code-gallery | /entries/json-to-csv-script/json-to-top-level-keys.py | UTF-8 | 596 | 3.15625 | 3 | [] | no_license | import json
import csv
jsonFilepath = '../'
jsonFilename = 'test'
#jsonData = json.loads(jsonFilepath + jsonFilename + '.json')
with open(jsonFilepath + jsonFilename + '.json') as json_file:
jsonData = json.load(json_file)
# open a file for writing
csvData = open(jsonFilepath + jsonFilename + '.csv', 'w')... | true |
366945db84df980c73c117b8eaecd8e43a0891ee | Python | jianhui-ben/leetcode_python | /218. The Skyline Problem.py | UTF-8 | 2,269 | 3.953125 | 4 | [] | no_license | #218. The Skyline Problem
#A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Given the locations and heights of all the buildings, return the skyline formed by these buildings collectively.
#The geometric information of each building is given ... | true |
3516e4eaed069192aaa54de0d3e6375d50a93076 | Python | KUNAL932/RESTAURANT-MANAGEMENT-SYSTEM | /restaurant file/restaurant.py | UTF-8 | 10,061 | 2.609375 | 3 | [] | no_license | import tkinter as tk
from tkinter import*
from tkinter import ttk
import sqlite3
root=tk.Tk()
root.title("Management system")
#initialising database**************************************************************
connection=sqlite3.connect("resturant.db")
#initialising new variables for database***********************... | true |
207dbbc8d8c31675de01fc1490235b4e57ebdd2c | Python | wulfgarpro/ancientrunes | /find_img_match.py | UTF-8 | 3,290 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python3
"""
TODO
"""
import os
import sys
import cv2
import numpy as np
IMG_CONTAINER = "AncientRunes.jpg"
MATCH_TEST = {
'1': 'A',
'2': 'B',
'3': 'M',
'4': 'U',
'5': 'G',
'6': 'P',
'7': 'R',
'8': 'E',
'9': 'N',
'10': 'D',
'11': 'I',
'12': 'C',
'13':... | true |
c5d1c2343a30a6ea9e90a71c779250b9dffe8fd8 | Python | MarcusGrass/arch_config | /pythonmiscscripts/opts/user_opts.py | UTF-8 | 1,948 | 2.6875 | 3 | [] | no_license | from pythonmiscscripts.input_utils.parse_input import request_str, confirm
class UserOpts(object):
def __init__(self, host_name: str, user_name: str, git_user: str, email: str, xmonad: bool, programming: bool,
nvidia: bool, yay: bool):
self.host_name = host_name
self.user_name = u... | true |
3b87e937c0dd638fa1e02c0e98ea34fdf7c9c555 | Python | HappyCthulhu/stepik-project | /test_main_page.py | UTF-8 | 1,960 | 2.5625 | 3 | [] | no_license | import pytest
from pages.main_page import MainPage
from pages.login_page import LoginPage
from pages.basket_page import BasketPage
from pages.locators import BasketPageLocators
@pytest.mark.login_guest
class TestLoginFromMainPage:
def test_guest_can_go_to_login_page(self, driver):
link = "http://selenium... | true |
b62911749ab9ab4f9cee32460ad9c83a0a594336 | Python | enformatik/expectigrad | /expectigrad/tensorflow2.py | UTF-8 | 4,660 | 2.8125 | 3 | [
"Python-2.0",
"MIT"
] | permissive | from tensorflow.python.keras.optimizer_v2 import optimizer_v2
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import state_ops
class Expectigrad(optimizer_v2.OptimizerV2):
"""TensorFlow 2.x Optimizer that implements the Expectigrad algorithm... | true |
fa59fc722b380555086f1b78a78cabfca248fc0b | Python | mihirp1998/Tensorflow-Regression-WebApp | /customize.py | UTF-8 | 5,171 | 2.921875 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
def my_model(features, labels, mode, params):
# Create three fully connected layers each layer having a dropout
# probability of 0.1.
# print('hi')
# print(features,labels)
net = tf.feature_column... | true |
3770c23c4b015ddbb7e73f3093ac84e3e4ce3e74 | Python | narimetisaigopi/learnpythonin30days_telugu | /python live classes code/live_class_day_6.py | UTF-8 | 1,255 | 3.78125 | 4 | [] | no_license | # classes and objects
# 1) properties (variables)
# 2) methods (functions)
#class = properities + methods
#Human
# color = white,height =5.6inche,gender,....
# work(), study(), walking(), sleeping()
# https://google.github.io/styleguide/pyguide.html
# def myClass():
class MyClass:
# Global Scope
# Local Sco... | true |
2fb498be097048657d6a73e97a71a3f45a54e1a6 | Python | sghenimi/ScratchML | /2019-04-16-nlp_sarcasm/model-evaluate.py | UTF-8 | 2,983 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 16 21:17:19 2019
@author: hugo
"""
# ==================================================================================================
# Working directory
# ==========================================================================================... | true |
b5b0b5de14d90651e78470e28c93883c41f83526 | Python | pbcanfield/python_diff | /diff.py | UTF-8 | 2,013 | 3.3125 | 3 | [] | no_license | import os
from FileParser import FileParser
def compare_lists(old, new):
last_found = 0
removed = {}
inserted = {}
for item,token in enumerate(old):
try:
offset_index = new.index(token ,item, len(new))
except ValueError:
removed[item] = token
else:
... | true |
b94243d6955ff72e02117646954eef752e2f1902 | Python | wguilherme/uri-python-exercicios-resolvidos | /INICIANTE/1004.py | UTF-8 | 91 | 3.40625 | 3 | [] | no_license | inputA = int(input())
inputB = int(input())
PROD = inputA * inputB
print(f"PROD = {PROD}") | true |
bd9b36c243c9ae15a4d1f80525c9cc1f37dbb007 | Python | jrbtaylor/ampclone | /melfilters.py | UTF-8 | 5,496 | 2.65625 | 3 | [] | no_license | # https://github.com/facebookresearch/tdfbanks/blob/master/melfilters.py
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from __future__ import division
import numpy as np
... | true |
ca9d75c62db46d5fe8db25cf7fc5f807248c0ec4 | Python | grace-omotoso/CIS-202---Python-Programming | /Chapter 3 - Code/The if Statement/if_statement_example2.py | UTF-8 | 158 | 3.5 | 4 | [] | no_license | sales = float(input("Enter the value of sales made: "))
if sales > 50000:
bonus = 500.0
commission_rate = 0.12
print("You met your sales quota!")
| true |
884c646888ae293923058301c16d18d177792ade | Python | Lan-Muzi/LeetCode | /08_stringToInteger.py | UTF-8 | 647 | 2.9375 | 3 | [] | no_license | class Solution:
def myAtoi(self, s: str) -> int:
stripStep = str.strip(s)
if stripStep == "" or stripStep == "-" or stripStep == "+":
return 0
s1 = re.match('[^\d]+', (stripStep.lstrip("-")).lstrip("+"))
if s1 != None:
return 0
else:
s1 ... | true |
244dd2d03608fd2f1eb84b9301e66a479696742b | Python | pbhoiwala/HackerRank | /Algorithms/Search/SherlockAndArray.py | UTF-8 | 541 | 3.15625 | 3 | [] | no_license | # https://www.hackerrank.com/challenges/sherlock-and-array/
T = int(input())
for _ in range(T):
n = int(input())
A = [int(i) for i in input().strip().split(' ')]
if(len(A) == 1 or A[0] == A[-1]): # this is for case when A has only 1 number (test case #6)
print("YES")
continue
found = Fa... | true |
ee2779035a75f3b0b27195657a745d4806802bc4 | Python | rmhowe/rosalind | /parse_fasta.py | UTF-8 | 274 | 2.90625 | 3 | [] | no_license | def parse_fasta(input_file):
sequences = {}
label = ''
for line in input_file:
line = line.strip()
if line[0] is '>':
label = line[1:]
else:
sequences[label] = sequences.get(label, '') + line
return sequences
| true |
f1b48478a3c7fd70f04e50b0ad00dff4048c2b20 | Python | toberge/python-exercises | /misc/vowels.py | UTF-8 | 473 | 3.5625 | 4 | [] | no_license | #!/usr/bin/env python3
vowels = 'aeiou'
found = ''
complete = False
tries = 0
fors = 0
while not complete:
str = input('ur streng: ').lower()
tries += 1
for char in str:
fors += 1
if char in vowels and char not in found:
found += char
if len(vowels) == len(found):
... | true |
1f2534ff925e84d1630c512cc69eec2001bd0ab4 | Python | olenaprokopiv/python-selenium-automation | /features/steps/best_sellers.py | UTF-8 | 933 | 2.859375 | 3 | [] | no_license | from selenium.webdriver.common.by import By
from behave import given, when, then
BESTSELLER = (By.CSS_SELECTOR, "#nav-xshop a[href*='bestseller']")
ALL_TAB = (By.CSS_SELECTOR, "#zg_tabs li")
BANNER_TEXT = (By.CSS_SELECTOR, "#zg_banner_text_wrapper")
@when('Click BestSellers button')
def click_bestSellers_button(con... | true |
e7800926c24ec859134be734f5087944fda36b7d | Python | yds9744/PS | /programmers/[programmers]stk_que_다리를지나는트럭(한나).py | UTF-8 | 729 | 2.921875 | 3 | [] | no_license | def solution(bridge_length, weight, truck_weights):
answer = 0
weightNow = 0
passing = []
trucks = [i for i in truck_weights]
for i, truck in enumerate(trucks):
if len(passing) >= bridge_length:
p = passing.pop(0)
weightNow -= p
if weightNow +... | true |
66efb3bc334e6d99f9a8b7a72eaf6a4e4d13ed4b | Python | fzs-git/PUMD | /Feature Extraction/Feature_Extract/ip.py | UTF-8 | 3,106 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# **④ 基于ip.csv / ipv6.csv中的特征:**
# 1. country_count:统计一个域映射的IP所属国家数 [145]
# 2. subvision_count:统计一个域映射的IP所属地区数[146]
# 3. subvision_jaccard_no: 统计一个域映射的IP所属地区与恶意域的IP所属地区相似性[147,155]
# - 举例:
# 域A映射的IP所属地区【‘北京’,‘上海’,‘天津’】
# 域A映射的IP所属地区【‘北京’,‘上海’,‘湖南’】
# Jaccard系数:相同交集北京’,... | true |
e27b5513733b88aa257628a3c6b0041fcc76ea28 | Python | s6fikass/semanticweblab2020-2021 | /Code/Machine learning for Entity Matching/code/losses.py | UTF-8 | 4,780 | 2.921875 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
def transe_score(hs, rs, ts):
distance = hs + rs - ts
score = tf.reduce_sum(tf.square(distance), axis=1)
# score = tf.reduce_sum(tf.abs(distance), axis=1)
return -score
def mde_score(hs, rs, ts, gamma=12):
a = hs[0] + rs[0] - ts[0]
b = hs[1] + ts[1] - rs[1]
c = ts... | true |
1ae5fe26e58ab679b50d395ce1b0679ed8612aed | Python | sqs6805/Cache-List-Functionality- | /Cache_List.py | UTF-8 | 4,934 | 3.125 | 3 | [] | no_license |
class Node:
def __init__(self, content):
self.value = content
self.next = None
def __str__(self):
return ('CONTENT:{}\n'.format(self.value))
__repr__=__str__
class ContentItem:
def __init__(self, cid, size, header, content):
self.cid = cid
self.size = si... | true |
6c310873ddd9b26755d542d5e7bb402010b6eaca | Python | ebeninca/adventofcode | /2020/day06/day06.py | UTF-8 | 974 | 2.828125 | 3 | [] | no_license | import os
from ast import literal_eval
with open(os.path.dirname(__file__) + '/day06input.txt') as f:
fileLines = [line for line in f]
groupAns = set()
ansSum = 0
for idx, ans in enumerate(fileLines):
groupAns.update([char for char in ans.strip()])
if ans in ('\n', '\r\n') or idx == len(fileLines)-1:
... | true |
83429b97ec195fdd6a33f08a95d6646ccaa4d794 | Python | CCooley11/CPSC475 | /Test 3/cyk.py | UTF-8 | 1,236 | 3.265625 | 3 | [] | no_license | '''
Team Member #1: Connor Cooley
Zagmail address for team member 1: ccooley@zagmail.gonzaga.edu
Test3C: CYK Parser
Due: December 14, 2018
Usage: python cyk.py cfg#.txt strng#.txt
'''
import csv
import numpy as np
import sys
def main():
file = sys.argv[1]
cfg = read(file)
string = open(sys.argv[2]... | true |
5a3d2453fe73fafff5dfece44d33c25570d86c86 | Python | 13950090228/Web-Python-LearningNotes | /Web+Python学习笔记/day14(内置函数)/内置函数.py | UTF-8 | 3,615 | 3.78125 | 4 | [] | no_license | lst=['北京','天津','上海','深圳','厦门']
#it=iter(lst) #iter内部封装的是__iter__()
#n=next(it) #next内部封装的是__next__()
#
#ls=(1,2,3,4,5,6)
#print(id(ls)) #查看内存地址
#print(hash(ls)) #目的是为了存储,计算后是一个数字,hash值尽量不要重复
#字典和哈希算法是用空间换时间,查找速度快,但是很占内存
#print(help(str)) #help 帮助文档
#def a():
# pass
#
#print(callable(a)) #callable()查看是否可以... | true |
0d85cd05af6e127bedda6c7bd68ab4250cbdf402 | Python | Ynitsed/python | /proj/Python Crash Course/2_1_name.py | UTF-8 | 660 | 5.21875 | 5 | [] | no_license | # Chapter 2 Page 24 1_name.py
name = "gabriel k. lu\n"
print(name.title())
#In this example, the lowercase string "ada lovelace" is stored in the variable
#name . The method title() appears after the variable in the print() statement.
#A method is an action that Python can perform on a piece of data. The
#dot ( . ) a... | true |
84d9f0edc6823324d9237ab9751849253e609db5 | Python | shantanuwadnerkar/deepdrive-zero | /deepdrive_zero/physics/collision_detection.py | UTF-8 | 8,694 | 2.859375 | 3 | [
"MIT"
] | permissive | import math
import sys
import timeit
from random import randint
from typing import Type, Union, List, Tuple
import numpy as np
from numba import njit
from deepdrive_zero.constants import CACHE_NUMBA
pi = np.pi
# TODO: Implement broad phase sweep and prune when you have more than 2 objects
@njit(cache=CACHE_NUMBA... | true |
4f6015838bc573f00d837f37fd2c63f3637e4110 | Python | jjlicky/python-basic | /파이썬 기초/factorial(x).py | UTF-8 | 97 | 3.265625 | 3 | [] | no_license | import math as m
# factorial(x)
# x계승을 정수로 반환함
x=4
a=m.factorial(x)
print(a)
| true |
10f48e78d6b35415315390d728d5aaea2cc19c2b | Python | beemihae/ICTM2A_robot | /tcpcom/PC/TigerJython/Examples/ShipClient.py | UTF-8 | 2,512 | 3.390625 | 3 | [] | no_license | # ShipClient.py
# 1 dim, Turtle Graphics
from gturtle import *
import random
from tcpcom import TCPClient
def initGame():
for x in range(-250, 250, 50):
setPos(x, 0)
setFillColor("gray")
startPath()
repeat 4:
forward(50)
right(90)
... | true |
890b3f2d09ac2a89ecaa00f97c34e3a169cb4c02 | Python | weizt/python_studying | /函数/16-filter内置类的使用.py | UTF-8 | 424 | 4.0625 | 4 | [] | no_license | # filter过滤,python2的时候是内置函数,python3修改成了一个内置类
# 对可迭代对象进行过滤,得到的是一个filter对象
ages = [12, 34, 23, 30, 17, 16, 19]
# filter可以给定2个参数,第一个参数是函数,第二个是可迭代对象
# filter结果是一个filter类型对象,filter对象也是一个可迭代对象
x = filter(lambda ele: ele > 18, ages)
for a in x:
print(a)
| true |
f43d673b154b87a4a01cf35fcceb5a025a6982a1 | Python | Aasthaengg/IBMdataset | /Python_codes/p03827/s886705553.py | UTF-8 | 158 | 3.140625 | 3 | [] | no_license | n = int(input())
s = input()
c = 0
maxc = 0
for i in s:
if i == 'I':
c += 1
else:
c -= 1
if maxc < c:
maxc = c
print(maxc) | true |
caa4c5098574462874ab647f170b37ed569a110a | Python | Informatics-ELST/cocktails_code | /controlled_vocab.py | UTF-8 | 2,370 | 3.421875 | 3 | [] | no_license | import json
import tutorial
#fucntion to implement vodka orientated controlled vocabulary
def vodka_cv(user_ingredient):
with open('tutorial/vodka.json', 'r') as myfile: #JSON file opened
data=myfile.read() #whole file read into variable
myfile.close() #closing file to reduce unecessary use of memory ... | true |
36ec63f9d00806c97a1e92e3763627f8aca49b54 | Python | opnsense/core | /src/opnsense/scripts/OPNsense/CaptivePortal/lib/__init__.py | UTF-8 | 4,931 | 2.53125 | 3 | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """
Copyright (c) 2015-2019 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
... | true |
961b1d0fdc3623d372263b38f8ad7bccb56af4a8 | Python | NU11B0T/GUVI_Codekata | /pos_or_neg.py | UTF-8 | 270 | 4.03125 | 4 | [] | no_license | print("Enter the number to check positive or negative :")
a=raw_input()
try:
int(a)
except ValueError:
print ('Not int')
else:
a=int(a)
if (a == 0):
print("Zero")
elif (a > 0):
print("positive")
else:
print ("negative")
| true |
a1652b0e13ab574b50ca3564e9442be0b7d9dc8f | Python | izabelcavassim/Genome_scale_algorithms | /gsa-read-mapper-master/mappers_src/mateo_mapper_src/mateo_mapper | UTF-8 | 3,113 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
from sys import argv
from SamRow import SamRow
from parsers import fasta_parser, fastq_parser
from Alignments import Alignment
def make_cigar(pat, ref):
alignments = Alignment(gap_extend = 1, gap_open = 1, max_or_min="min")
alignments.read_score_matrix_from_text_file(file="config_matrix.... | true |
24eca4d2dd25b5e741e0f9036921c439f0cbcba6 | Python | karlosos/pitchmap | /manual_tracking/gui/color_selector.py | UTF-8 | 1,895 | 3.109375 | 3 | [] | no_license | from .button import Button
import pygame
TEAM_COLOR = [(0, 255, 0), (255, 0, 0), (0, 0, 255)]
class ColorSelector:
def __init__(self, x, y):
self.x = x
self.y = y
self.width = 104
self.height = 36
self.surf = pygame.surface.Surface((self.width, self.height))
self._... | true |
0a12bbee1dfbc8d9616a83b7a1f67e414d5dbe51 | Python | SharkEzz/Pronote-Password-Gen | /note.py | ISO-8859-1 | 2,892 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python :2.7
#Prsentation
try:
print("#Chance d'avoir le bon mot de passe : 100 %")
print("#CTRL+C pour fermer le programme.")
except KeyboardInterrupt :
print("\n[*] Sortie du programme ..\n")
os.system("pause")
sys.exit(1)
#Importation
try:
import... | true |
41ef8d2aacadb7abc12d0d40605a90c603ee7fda | Python | mckoss/pageforest | /appengine/utils/mixins/cacheable.py | UTF-8 | 10,846 | 2.75 | 3 | [] | no_license | import time
import random
import logging
from django.conf import settings
from google.appengine.ext import db
from google.appengine.api import memcache
from google.appengine.datastore import entity_pb
from utils.mixins.serializable import Serializable
COMMIT_INTERVAL = 1.0 # seconds
JIGGLE_INTERVAL = 0.25
cla... | true |
cf06c7a3e233f233d15d6d5f08d3fee6d016c1cc | Python | AngelFA04/image-steganography-encoder | /decrypt.py | UTF-8 | 2,507 | 2.921875 | 3 | [] | no_license | from common import read_image
from typing import Deque, List
import numpy as np
import sys
from textwrap import wrap
path_image = "new_image.bmp"
# TODO
BLACK = [0, 0, 0]
CONTROL_COLOR = BLACK
ENCODE_COLOR = [0,0,1]
def get_pixel_message_in_image(image_array: np.ndarray, control_color, encode_color) -> np.ndarra... | true |
79c3b41f60ebea360941e49a1152172577b7e158 | Python | BerilBBJ/scraperwiki-scraper-vault | /Users/P/phivk/college_of_surgeons_profile_data.py | UTF-8 | 5,802 | 2.765625 | 3 | [] | no_license | '''
scrape surgeon's additional data from College of Surgeons' profile page
'''
import scraperwiki
import lxml.html
import re
def tidy(string):
return " ".join(string.split())
def extractProfileInfo(contentTable, url):
item = {
"itemURL": "",
"itemName": "",
}
item["itemURL"]... | true |
142a9150c3161aef1aae3c8e6c7e805c95dfffdd | Python | bittelandreas/Cryptocurrencies-Group-F | /AQM_Group_F_Crypto.py | UTF-8 | 23,498 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import eikon as ek
import pandas as pd
import numpy as np
import time
import datetime
import matplotlib.pyplot as plt
import os
import sqlite3
from sqlite3 import Error
from scipy import stats
import scipy as sp
import statsmodels.api as sm
import pylab
import statistic... | true |
e76a292a31913b0c52b8c08df8b1b4a093f982d1 | Python | danielballan/caproto | /caproto/_broadcaster.py | UTF-8 | 8,266 | 2.578125 | 3 | [] | no_license | # This module contains only the Broadcaster object, encapsulating the state of
# one Channel Access UDP connection, intended to be used as a companion to a
# UDP socket provided by a client or server implementation.
import logging
import random
from ._constants import (DEFAULT_PROTOCOL_VERSION, MAX_ID)
from ._utils im... | true |
bdbfb45e92cb2f96d5a8938c06cc5b02334fb8d1 | Python | amits91/coursera_algorithmic_thinking | /Project2/application2.py | UTF-8 | 2,099 | 3.109375 | 3 | [] | no_license | '''
Code for application2
'''
__author__ = 'am'
import provided_code as provided
import project2 as proj
import UER as u
import UPA as upa
import random
import example_graphs as eg
import matplotlib.pyplot as plt
def print_gi(graph):
'''
Print graph info
:param graph: undirected graph
:return: None
... | true |
f6b89548bbb6479d49b2bce664e2f153a8b7108f | Python | aszyrej/redes-tp3 | /src/catedra/ptc/rqueue.py | UTF-8 | 2,891 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
##########################################################
# Trabajo Práctico 3 #
# Programación de protocolos end-to-end #
# #
# Teoría de las Comunicaciones #... | true |
390e6e062b4246e225a8fa5edf21590253f50596 | Python | apoorv-vijay-joshi/Insight-Data-Science | /insightDataScience.py | UTF-8 | 2,592 | 3.703125 | 4 | [] | no_license | # Open the file for reading from the directory 'tweets_input'.
with open("tweets_input/tweets.txt", "r") as infile:
data = infile.read() # Read the contents of the file into memory.
# Return a list of the lines, breaking at line boundaries.
my_list = data.splitlines()
wordDict = {} # wordDict is a di... | true |
1aa36e94015cc50947a7b425ed81bbe37d0f42f1 | Python | renjiezhu2/WeiboAnalysis | /weiboSplit.py | UTF-8 | 3,919 | 2.625 | 3 | [] | no_license | #!/usr/bin/python
# coding:utf-8
# Check whether string contains Chinese character or not
# def check_contain_chinese(check_str):
# for ch in check_str.decode('utf-8'):
# if u'\u4e00' <= ch <= u'\u9fff':
# return True
# return False
inputFileName = raw_input("Enter a file name for in... | true |
e358e11e49e07d45d79a411a37c0fc04398f3f8b | Python | jie8357IOII/airflow-dynamic-etl | /etl/etl_register.py | UTF-8 | 9,961 | 2.796875 | 3 | [
"MIT"
] | permissive | # -*- encoding: utf8 -*-
import datetime
import inspect
import logging
import os
from functools import partial, wraps
import unicodecsv as csv
DAILY_DELAY = 10800 # 3 hours
WEEKLY_DELAY = 43200 # 12 hours
MONTHLY_DELAY = 259200 # 3 days
SEASONALLY_DELAY = 604800 # 7 days
YEARLY_DELAY = 604800 # 7 days
MAX_DELAY ... | true |
51d61fb1ea5408550e4f2a0cca3017a53ebd7fb4 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_142/456.py | UTF-8 | 2,133 | 3.015625 | 3 | [] | no_license | def createReg(string):
reg = []
factors = []
fac = 0
l = ' '
for s in string:
if s != l:
reg.append(s)
factors.append(fac)
fac = 1
l = s
else:
fac += 1
factors = factors[1:]
factors.append(fac)
ret... | true |
73ba79c246c2cfaeed4ca6f17ea883bf466b32b4 | Python | ostamand/google-quest-qa | /callbacks.py | UTF-8 | 4,475 | 2.625 | 3 | [] | no_license | import tensorflow as tf
import tensorflow.keras.backend as K
import numpy as np
from scipy.stats import spearmanr
try:
import wandb
except:
pass
# taken from: https://www.kaggle.com/akensert/bert-base-tf2-0-minimalistic
def compute_spearmanr(trues, preds):
rhos = []
for col_trues, col_pred in zip(true... | true |
503509d8b434e3c52cea712f9c4ae2808e0f286c | Python | dezeraecox/student-metrics-analysis-platform | /app.py | UTF-8 | 35,204 | 2.703125 | 3 | [] | no_license | import os, re
import streamlit as st
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import base64
from collections import defaultdict
import src.hierarchical_axes as ha
import zipfile
import io
from PIL import Image
from src import SessionState # Assuming SessionState.py... | true |
af9514785f6cbad12deb2bd7ee54dec0d1b5efb0 | Python | cxovrika/Information_Theory | /hw0/CompleteRead.py | UTF-8 | 917 | 3.203125 | 3 | [] | no_license | import sys
def get_parameters():
if len(sys.argv) != 3: raise Exception("Should pass exactly 2 parameters, passed: {0}".format(len(sys.argv) - 1))
return sys.argv[1], sys.argv[2]
def complete_read(input_file_name, output_file_name):
with open(input_file_name, 'rb') as rfile, open(output_file_name, 'w') as... | true |
7a3c8abf0b7c0fcf9bc31227cd684485c065f7de | Python | TimoBlum/KNN | /KNN.py | UTF-8 | 3,962 | 3.03125 | 3 | [] | no_license | import pygame
import math, random
pygame.init()
xy = 800
blueV = 0
blueCounter = 0
redV = 0
redCounter = 0
positions = []
neighbours = []
NNlist = []
firstTime = True
win = pygame.display.set_mode((xy, xy))
win.fill((255, 255, 255))
def loading():
print('making new Point...')
pygame.time.wait(400)
prin... | true |
cbc5092a18d5f32f6a751587adfc7a62256dc8f5 | Python | omoindrot/baselines | /environments.py | UTF-8 | 2,509 | 2.703125 | 3 | [
"MIT"
] | permissive | """Class to create gym environments.
"""
import gym
from baselines.common.atari_wrappers_deprecated import wrap_dqn, ScaledFloatFrame
MAP = [
"SFFFFFFF",
"FFFFFFFF",
"FFFHFFFF",
"FFFFFHFF",
"FFFHFFFF",
"FHHFFFHF",
"FHFFHFHF",
"FFFHFFFG"
]
class EnvironmentCreator(object):
"""Cre... | true |
ea2213fdc2cb2990096c7577b5f23c1141c68628 | Python | voidptr/ce_rapid_adaptation_data | /research_scripts/__deprecated/generate_graphs_from_raw_data/plot_distribution_of_amplitudes.py | UTF-8 | 3,709 | 2.609375 | 3 | [] | no_license | # Plot the Distribution of the Amplitude of the Oscillation
# of Task Execution
# Written in Python 2.7
# RCK
# 5-28-11
import numpy as np
import pylab as pl
from optparse import OptionParser
import multidimensional_avida_datafiles as md
import calculate_task_oscillation as cto
# Set up options
usage = """usage: %pr... | true |
4b7037c8848c5c2ec3db5d2319cb749f3555e25c | Python | stephenmwilkins/H30 | /imgs/gallery/create_thumb.py | UTF-8 | 745 | 2.71875 | 3 | [] | no_license |
from PIL import Image, ImageOps, ImageEnhance
import glob, os
# 5120 x 2880 # max resolution
# 2560 x 1440 # default
# 3200 x 1800
for infile in glob.glob('original/*'):
f = infile.split('/')[-1]
im = Image.open(infile)
print(f, im.size)
thumb = ImageOps.fit(im, (180,180), method=Image.ANTIALIA... | true |
9503521648d9f353b633837fa670b72692cdfe82 | Python | KnowledgeLab/GSS_code | /OLD_create_articleClasses.py | UTF-8 | 4,986 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
"""
Created on Mon Sep 09, 2013
@author: Misha Teplitskiy
filename: create_articleClasses.py
description:
- This script constructs a list of articleClass instances, where each articleClass contains an article's metadata
- the filtering of the artic... | true |