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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f9644ba45ec08733a6a90df335c2961980c2ea58 | Python | shiqi0128/My_scripts | /test/interfaceTest/GMALL/float.py | UTF-8 | 678 | 3.8125 | 4 | [] | no_license | """此方法为四舍五入可以调用的方法"""
def precision(a, b):
c = a / b
c1 = "%.3f" % c
print("初始值:", c1)
c2 = int(float(c1.split(".")[1]) / 10) # c1.split(".")=["0", "333"],取第2个是"333",333除以10=33.3,int执行后c2=33
# print(int(c2))
c3 = c2 % 10
if a % b == 0:
print(c)
else:
x = int(c) + int(c2... | true |
d794d5636cbcf777690d35724e0dad34fb5170df | Python | tmu-nlp/100knock2017 | /take/chapter07/knock66.py | UTF-8 | 349 | 2.59375 | 3 | [] | no_license | '''
66. 検索件数の取得
MongoDBのインタラクティブシェルを用いて,活動場所が「Japan」となっているアーティスト数を求めよ.
'''
from pymongo import MongoClient, ASCENDING
client = MongoClient('localhost', 27017)
query = 'Japan'
print(client.DB_NAME.sample.find({'area': query}).count())
client.close()
| true |
5189ba7251d047e4808b40f807be568def16ff33 | Python | mdlugajczyk/yarpen | /yarpen/assignment_elimination.py | UTF-8 | 3,274 | 3.109375 | 3 | [] | no_license | from yarpen.expression import YarpenBoxedValue, YarpenList, assignment_value, \
assignment_variable, begin_expressions, if_alternative, if_condition, \
if_conseq, is_application, is_assignment, is_begin, is_if, is_lambda, \
is_number, is_variable, lambda_args, lambda_body, make_assignment, \
make_begin,... | true |
9ffb8972712278b22e6e3e7671c49636c6dc1c78 | Python | azrdev/sklearn-seco | /sklearn_seco/predefined.py | UTF-8 | 5,444 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | """
Implementation of SeCo / Covering algorithm:
Known instantiations / example configurations of the abstract base algorithm.
"""
from sklearn_seco.abstract import SeCoEstimator
from sklearn_seco.common import \
SeCoAlgorithmConfiguration, AugmentedRule, RuleContext, Theory
from sklearn_seco.concrete import TopDo... | true |
309cec92f9eac4abdd80c600dc571b3d0664eba3 | Python | YaroslavVygovsky/Git_Python | /Званый обед.py | UTF-8 | 1,202 | 3.46875 | 3 | [] | no_license | list=['Юля','Виталий','Алексей']
message=f"Приглашаю вас на обед,{list[0],list[1],list[2]}"
print(message)
print(list[1])
list[1]='Жора(голубь)'
message2=f"Приглашаю вас, мои лучшие друзья, ко мне на обед (Жора будет на закусь), {list[0],list[1],list[2]}"
print(message2)
list.append('Максим')
list.insert(0,'Велимир')
l... | true |
154205933d78f6306eb0227bc3c135b5010b1b87 | Python | wiegandt/week_3 | /odd even.py | UTF-8 | 134 | 4.375 | 4 | [] | no_license | num = int(input("Enter a number: "))
if (num % 2) == 0:
print(num, " is an even number")
else:
print(num, " is an odd number") | true |
38eb2456c9f2451bd207f289b210f4c71eb01db0 | Python | yuvaltimen/NeuralLanguageModel | /data_files/data_cleaning.py | UTF-8 | 1,335 | 3.65625 | 4 | [] | no_license | import re
from nltk import sent_tokenize
"""
Some problems we want to deal with in our cleaning process:
1. Punctuation and hyphens (many instances of '--')
2. British spellings (colour, behaviour, phaenomenon)
3. Different cases
"""
favour, endeavour, colour, behaviour, \
possest
def clean_data(file_path):
""... | true |
26021ef8b7d7ebc9f3c5605e1778cd3462c269e1 | Python | dangom/faster-ica | /ml_ica/algorithms/truncated_newton.py | UTF-8 | 6,017 | 3.09375 | 3 | [
"BSD-3-Clause"
] | permissive | """
Python implementation of the Truncated Newton's method for ICA.
Reference for the algorithm without preconditioning:
Tillet, P. et al., "Infomax-ICA using Hessian-free optimization"
"""
# Authors: Pierre Ablin <pierre.ablin@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Jean-Franc... | true |
045370614c3e82b2de94657411cdcb23f928e832 | Python | J3T4R0/Covid-Scrapper | /Covid/storefront-kafka-docker/refresh.py | UTF-8 | 2,237 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# Delete (3) MongoDB databases, (3) Kafka topics,
# create sample data by hitting Zuul API Gateway endpoints,
# and return MongoDB documents as verification.
# usage: python3 ./refresh.py
from pprint import pprint
from pymongo import MongoClient
import requests
import time
client... | true |
b67d68ce3b1fb0de30392aee0d0506d67ac226c7 | Python | drdoctr/doctr | /doctr/common.py | UTF-8 | 1,104 | 3.125 | 3 | [
"MIT"
] | permissive | """
Code used for both Travis and local (deploy and configure)
"""
# Color guide
#
# - red: Error and warning messages
# - green: Welcome messages (use sparingly)
# - yellow: warning message (only use on Travis)
# - blue: Default values
# - bold_magenta: Action items
# - bold_black: Parts of code to be run or copied t... | true |
cba225ce3aef23250ce2172f658238b607995f6f | Python | mehdibettiche/OpenNMT-tf | /opennmt/utils/transformer.py | UTF-8 | 5,578 | 2.984375 | 3 | [
"MIT"
] | permissive | """Define functions related to the Google's Transformer model."""
import tensorflow as tf
def scaled_dot_attention(queries,
keys,
values,
mode,
values_length=None,
mask_future=False,
... | true |
c1f9ebaed2735eb502b72f5e5bc845af6267a0fe | Python | jungeunlee95/python-basic | /python-pratice-problem3/prob02.py | UTF-8 | 456 | 4.03125 | 4 | [] | no_license | '''
range() 함수와 유사한 frange() 함수를 작성해 보세요.
frange() 함수는 실수 리스트를 반환합니다.
'''
# --- 1
def frange(val, start=0.0, step=0.1):
if(val<start):
val, start = start, val
i = start
result = []
while True:
if i >= val:
break
result.append(round(i,2))
i += step
return ... | true |
debeda62062e18dc77f79026f708060f345c2944 | Python | hengrumay/dsp | /python/markov.py | UTF-8 | 2,528 | 2.890625 | 3 | [] | no_license | ## h-rm_tan 28Aug2016//
#==============================================================================
# # Refs
#==============================================================================
# http://www.bitsofpancake.com/programming/markov-chain-text-generator/
# http://agiliq.com/blog/2009/06/generating-pseudo-ran... | true |
46044b3e21be4a1f9d15dcd133d8f14698b698ca | Python | NoahBlack012/ascii_photo | /main.py | UTF-8 | 1,404 | 3.078125 | 3 | [] | no_license | from PIL import Image, ImageDraw
from image import Img
from math import sqrt
img = Img("./obama.jpg")
width, height = img.img.size
resize_factor = width // 90
if resize_factor < 1:
resize_factor = 1
img.get_pixel_array(resize_factor)
data = img.pixels
width = len(img.pixels)
height = len(img.pixels[0])
def sca... | true |
39bcb2b0d6082a2af04b13c7aa5f8a27e02959f0 | Python | DaehanKim/word_emb_for_txt_generation | /process_paraphrase_data.py | UTF-8 | 646 | 2.78125 | 3 | [] | no_license | '''process labelled paraphrasing dataset for vocab building and word vector training purposes.'''
def main():
# extract useful sentences from labelled paraphrasing corpus
sent_list = []
with open('paraphrasing data_DH - train_x_kss.tsv', 'rt', encoding='utf8') as f:
for idx, line in enumerate(f):
if idx < 2 : ... | true |
666210d07f56893680e5012467b28331dbf29448 | Python | davidmcnabnz/cryptoxlib-aio | /cryptoxlib/clients/eterbase/functions.py | UTF-8 | 339 | 2.78125 | 3 | [
"MIT"
] | permissive | from typing import List
from cryptoxlib.Pair import Pair
def map_pair(pair: Pair) -> str:
return f"{pair.base}-{pair.quote}"
def map_multiple_pairs(pairs : List[Pair], sort = False) -> List[str]:
pairs = [pair.base + "-" + pair.quote for pair in pairs]
if sort:
return sorted(pairs)
else:
... | true |
57bf3d99cd1b8e4c141168ebfd741bbf353a4efb | Python | boukeversteegh/Advent-of-Code-2019 | /day18/day18.py | UTF-8 | 9,134 | 2.90625 | 3 | [] | no_license | import os
import sys
from collections import namedtuple
from heapq import heappush, heappop
grid = {}
player = None
keys = {}
doors = {}
with open('day18/input.txt') as fh:
lines = [line.strip() for line in fh.readlines()]
for y, line in enumerate(lines):
for x, c in enumerate(line):
grid[x, y] = c
... | true |
a4c3608283e739b3f7eadab63baded608c2ebb62 | Python | pavendra-maurya/xls_json_serverless_code | /xls_json_serverless_code.py | UTF-8 | 3,089 | 2.859375 | 3 | [] | no_license | import xlrd
import requests
import os
import json
import boto3
from botocore.client import Config
class Download():
def __init__(self,url,file):
self.excel_url = url
self.file_path = file
def download_start(self):
response = requests.get(self.excel_url,verify=None)
with open(s... | true |
0eba692c15cae2e0d0471f329f14c521b7c5f05f | Python | sjuvekar/Map-Recognition | /model.py | UTF-8 | 1,904 | 3.046875 | 3 | [] | no_license | import numpy
from matplotlib import pyplot as plt
from sklearn.cross_validation import train_test_split
from sklearn.metrics import precision_score, recall_score, f1_score
from sklearn.metrics import confusion_matrix
class Model(object):
def __init__(self, X, y):
self.X = X
self.y = y
self... | true |
92bb9c6d16cbcd0e04b9b035121fd963051844df | Python | yncat/screamingstrike | /dialog.py | UTF-8 | 788 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Simple crossplatform dialog
# Copyright (C) 2019 Yukio Nozawa <personal@nyanchangames.com>
# License: GPL V2.0 (See copying.txt for details)
import platform
import ctypes
import subprocess
import re
def dialog(title, message):
"""Shows messageBox on win and mac.
:par... | true |
1cf3050e26e32f107e0769b4c640cb443de7312d | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_135/1887.py | UTF-8 | 448 | 3.484375 | 3 | [] | no_license | #!/usr/bin/python
def get_cards():
row = int(raw_input())
vals = [raw_input().split(' ') for x in range(0, 4)]
return set(vals[row - 1])
tc = int(raw_input())
for t in range(0, tc):
c1 = get_cards()
c2 = get_cards()
c = c1 & c2
if len(c) == 1:
result = c.pop()
elif len(c) == ... | true |
2f16f08cfe7a65d5f27469b90aabc99695a74904 | Python | anirudhprabhakaran3/style-transfer-app | /model.py | UTF-8 | 1,626 | 2.578125 | 3 | [] | no_license | import os
import tensorflow as tf
import tensorflow_hub as hub
os.environ['TFHUB_MODEL_LOAD_FORMAT'] = 'COMPRESSED'
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.rcParams['figure.figsize'] = (12, 12)
mpl.rcParams['axes.grid'] = False
import numpy as np
import PIL.Image
import random
def tensor_to_imag... | true |
044b26bb4269d7ece135449c7a57e595cc3ff9cd | Python | WUT-IDEA/domain-ner | /is13/examples/elman-train/aa.py | UTF-8 | 330 | 2.515625 | 3 | [] | no_license | import numpy
import math,time
s=time.time()
a=numpy.load('aa/W.txt.npy')
print a.shape #a shape:(100L,12L)
# print numpy.mean(a,axis=0)
# print numpy.linalg.norm([12,2,5,7])
b=numpy.array([4,5,6])
b2=numpy.array([1,2,3])
print math.exp(-numpy.linalg.norm(b2-b)/12),math.e
print 'costs:',(time.time()-s)/60
t=(1,23)
... | true |
dcd7515f5d0c1f598d16dd1f9e83793a990c06d0 | Python | GustavoAngelCM/myconfig | /server.py | UTF-8 | 257 | 2.625 | 3 | [] | no_license | # Python 3 required
# dependencies
from dependencies.menus import menuMain
from dependencies.switches import switchMain
while True:
menuMain()
opcion = input()
if opcion == '0':
break
switchMain(opcion) | true |
b806706ae6958f2be96584f6d6eefa80d4d02032 | Python | kesharwanisourabh/opencv_basics_code | /camera3.py | UTF-8 | 761 | 2.59375 | 3 | [] | no_license | import cv2
#face detection
c_im = cv2.CascadeClassifier ("F:\\python\\facialrecogn\\haarcascades\\haarcascade_frontalface_default.xml")
r_im = cv2.imread ("C:\\Users\\HP\\Pictures\\Camera Roll\\r6.jpg")
gray_im = cv2.cvtColor(r_im,cv2.COLOR_BGR2GRAY)
faces=c_im.detectMultiScale(gray_im, scaleFactor = 1.0... | true |
c06a1b5bd6956c4c5edf444a78be647e215651da | Python | anabeatrizzz/exercicios-pa-python | /exercicios_4/exercicios_4_04.py | UTF-8 | 482 | 4.25 | 4 | [] | no_license | """Escreva um programa que armazene os números de 1 a 25 em uma matriz 5x5
e ao final exiba apenas os valores das diagonais desta matriz."""
matriz = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]
print(f"{matriz[0][0]} {matriz[0][4]}")
print(f" {mat... | true |
79eb7c5d46e85bca2b8fc59b6ff9cd4d11bb696c | Python | amberleeshand/Susewi-Challenge1 | /challenge1.py | UTF-8 | 7,472 | 3.546875 | 4 | [] | no_license | #the first part of the challenge was to assemble the files with '_DLI' and export them back to CSV
import pandas as pd
import glob, os
#creating the light variable assembles all the files with _DLI in the name
light = glob.glob("*_DLI")
#I then created a variable named dli
dli = pd.concat([pd.read_csv(file) for file... | true |
1d2463e66049b3b19b3a164a7c420da734a16ccb | Python | hexin46373/Python | /UnderLine/UnderLineTest.py | UTF-8 | 302 | 2.84375 | 3 | [] | no_license | """
@author: Alfons
@contact: alfons_xh@163.com
@file: UnderLineTest.py
@time: 2019/7/4 下午9:50
@version: v1.0
"""
_Test__arga = "hello"
class Test:
def __init__(self):
self.__ar = None
def print(self):
return __arga
t = Test()
print(t.print())
print(t._Test__ar)
print(dir(t))
| true |
cb87338b0c7681399b4fab46924c979b56e8e160 | Python | devm1023/GeekTalentDB | /src/careerdefinition_cluster.py | UTF-8 | 5,594 | 2.9375 | 3 | [] | no_license | from logger import Logger
import csv
from math import sqrt, acos
import argparse
from clustering import find_clusters
def get_skillvectors(filename, titles_from):
title_set = set()
has_titles_from = False
if titles_from:
has_titles_from = True
with open(titles_from, 'r') as inputfile:
... | true |
fe57423617b81b95efe8e1d9e2e1fe43cf97e3bd | Python | ahcl7/jstris-bot | /board.py | UTF-8 | 6,408 | 2.828125 | 3 | [] | no_license | import PIL.ImageGrab
from termcolor import colored
import os
os.system('color')
import time
BOARD_WIDTH = 10
BOARD_HEIGHT = 20
class Board:
def __init__(self, bitmap = -1):
if (bitmap == -1):
self.bitmap = [[False] * BOARD_WIDTH for _ in range(BOARD_HEIGHT)]
else:
self.bit... | true |
3d5dde8363c852449a5c07905ddd479e5fc7fca1 | Python | CamilaGO/Proyecto2-Graficas | /raytracer.py | UTF-8 | 5,676 | 2.8125 | 3 | [] | no_license | from lib import *
from rayUtils import *
from sphere import *
from plane import *
from cube import *
from pyramid import *
from envmap import *
from math import pi, tan
BLACK = color(0, 0, 0)
WHITE = color(255, 255, 255)
FONDO = color(50, 50, 200)
MAX_RECURSION_DEPTH = 3
class Raytracer(object):
def __init__(self,... | true |
afd8926abb2a4ab66e000c9ca6a0e8bddb966218 | Python | dmurdin/macro-of-inline | /macro_of_inline/recorder.py | UTF-8 | 1,609 | 2.515625 | 3 | [] | no_license | import cfg
import ext_pycparser
import os
import shutil
import StringIO
import time
class Recorder:
def __init__(self):
self.rec_dir = cfg.t.record_dir
self.file_rewrite_level = 0
self.current_fun_name = None
self.fun_rewrite_level = {}
self.last_time = time.clock()
if os.path.exists(self.rec_dir):
... | true |
bec0fa5147b6eafc8a4ad1fab1dfbe689ffe594a | Python | chiselko6/MapReduce | /mr/client/config.py | UTF-8 | 1,555 | 2.9375 | 3 | [
"MIT"
] | permissive | import os
class MasterConfigParser(object):
def __init__(self, config_path):
self._config_path = config_path
self._host = None
self._port = None
def _read(self):
with open(self._config_path, 'r') as fin:
lines = fin.readlines()
assert len(lines) == 1, ... | true |
d05a79735fd08191b3d46bbb5b04aa0f97126d5c | Python | deardurham/ciprs-reader | /tests/parsers/test_case_information.py | UTF-8 | 1,631 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | import pytest
from ciprs_reader.parser.section import case_information
def test_case_status(report, state):
string = " Case Status: DISPOSED "
matches = case_information.CaseStatus(report, state).match(string)
assert matches is not None, "Regex match failed"
assert matches["value"] == "DISPOSED"
... | true |
cedcc6cb1d61ec3a5ae3b05337f61b794db302f8 | Python | FragmentsVN-FGJ/SDG_Dragonfire | /game/DFO_classes_py.py | UTF-8 | 16,745 | 3 | 3 | [
"MIT"
] | permissive | import math
class Gamestate(object):
""" docstring for Gamestate
All variables related to battles that are just laying around should be moved here
"""
# TODO "You can't save or load during a battle!" Disable rollback as well.
battle_label = "Ruins_battle1"
players = {}
enemies ... | true |
2bfbf079dca559ebb02b7ab82a6d7a75f8ba22cf | Python | LuAzamor/exerciciosempython | /primeirosimpares.py | UTF-8 | 256 | 3.734375 | 4 | [] | no_license | quantidade_impares= int (input("Digite o n: "))
quantidade_impresso = 0
numero = 0
while quantidade_impresso < quantidade_impares:
if numero % 2 != 0:
print (numero)
quantidade_impresso = quantidade_impresso + 1
numero = numero + 1 | true |
ef604dc1ec116927a8728ab96b099cb931777f4f | Python | Alex-Francisco/Python-3 | /Exercicios_propostos_01.py | UTF-8 | 566 | 4.46875 | 4 | [
"MIT"
] | permissive | ## Exercício 01 do livro Python 3 - Conceitos e Aplicações - Uma Abordagem Didática
""" Faça X = 0.0 e Y = 18. Verifique o tipo de dado que o Python atribuiu a cada um. Faça Z = X + Y e verifique
o resultado calculado e armazenado em Z. Verifique com qual tipo de dado foi criado o objeto Z. """
X = 0.0
Y = 18
print("... | true |
a9cc32a9f8ce8c525b49f5c6e1c6986dc84a262c | Python | antronx/HeadFirstPython | /Collections/lists.py | UTF-8 | 238 | 3.734375 | 4 | [] | no_license | prices = []
prices.append('Me skuzi')
car_details = ['Toyota','Rav 4', 3.14, 7]
list_of_lists = [prices, car_details]
print("Prices: ")
print(prices)
print("Details: ")
print(car_details)
print("off The List: ")
print(list_of_lists)
| true |
187b79799ef82061e69df81bad624cf3b6330a13 | Python | tvenko/crawler | /crawler visualization/site_connections_visualization.py | UTF-8 | 3,244 | 2.9375 | 3 | [] | no_license | import database
import plotly.plotly as py
import plotly.graph_objs as go
import networkx as nx
data = {}
def prepare_graph():
edges = []
for key in data.keys():
for val in data[key]:
edges.append((key, val))
G = nx.Graph()
G.add_edges_from(edges)
pos = nx.kamada_kawai_layout... | true |
05481eabacfa7f048c7a55a4cb1af614a32fe620 | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/16_2_1/johannly/a.py2 | UTF-8 | 1,816 | 3.0625 | 3 | [] | no_license | import sys
def get_letter_counts(s):
letter_counts = {}
for c in s:
if (c not in letter_counts):
letter_counts[c] = 0
letter_counts[c] += 1
return letter_counts
digit_letter_counts = {
0 : {'Z': 1, 'E': 1, 'R': 1, 'O': 1},
1 : {'O': 1, 'N': 1, 'E': 1},
2 : {'T': 1, 'W': 1, 'O': 1},
3 : {'T': 1, 'H': ... | true |
8149aef39f300b83ae9ada94ed0037991c3e1a1f | Python | rlalpha/MLDS-107 | /hw2-1/preposessing_data.py | UTF-8 | 3,537 | 2.671875 | 3 | [] | no_license | import json
import numpy as np
import itertools
import re
def data_generator(x_train_feature_dir, y_train_filename, thershold_of_occurences):
# Load data
f = open(y_train_filename)
print('start loading data')
y_train = json.load(f)
video_id = []
feature_list = []
captions = []
num_of... | true |
be0833b0c36faec0b059c5619dfd2400e58f0e25 | Python | armyrunner/CS1400-OOP1 | /nameguesser.py | UTF-8 | 1,167 | 4.5 | 4 | [] | no_license | def main():
#print Insturctions
print("Welcome to the name guesser. In this challenge you have")
print("three chances to guess nyname. If you should guess my name,")
print(" a reward will be in store. However, if you fail to guess my name,")
print("bad things will happen to you")
print("... | true |
5402c79ae92fc655c1a29362a6e28d0c77fb9959 | Python | adrien-simard/Curso2021-2022-ODKG | /Assignment4/javiegal-21A325/task07.py | UTF-8 | 2,338 | 2.734375 | 3 | [] | no_license | from rdflib import Graph, Namespace, Literal
from rdflib.namespace import RDF, RDFS
from rdflib.plugins.sparql import prepareQuery
github_storage = "https://raw.githubusercontent.com/FacultadInformatica-LinkedData/Curso2021-2022/master/Assignment4/course_materials"
"""Leemos el fichero RDF de la forma que lo hemos v... | true |
133f593ce4b0fb0034691e16ec93ee72cfeccaaf | Python | AnishWalawalkar/pymusic | /pymusic/downloader.py | UTF-8 | 650 | 2.734375 | 3 | [] | no_license | import spotify
from youtube2mp3 import Youtube, Mp3
from threading import Thread
def download_song(song):
youtube = Youtube()
youtube_link = youtube(song)
mp3 = Mp3(youtube_link, output_directory='/Users/JustAnish/Documents/songs/')
mp3()
def get_songs():
access_token = spotify.get_spotify_token(... | true |
811a8fbcb78afa7e3cd69ad83fd69cb3c75ce153 | Python | HaroldMills/Maka | /src/maka/util/SerialNumberGenerator.py | UTF-8 | 422 | 3.265625 | 3 | [
"MIT"
] | permissive | class SerialNumberGenerator(object):
def __init__(self, nextNumber=0):
super(SerialNumberGenerator, self).__init__()
self._nextNumber = nextNumber
@property
def nextNumber(self):
result = self._nextNumber
self._nextNumber += 1
return result... | true |
d044024f24adce60e96a7f82745efbcaca130669 | Python | Zedmor/hackerrank-puzzles | /leetcode/140.py | UTF-8 | 3,834 | 3.828125 | 4 | [] | no_license | """
Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each word is a valid dictionary word. You may assume the dictionary does not contain duplicate words.
Return all such possible sentences.
For example, given
s = "catsanddog",
di... | true |
133dba9fa83eadfd6d5888a87d9d196be6ea5a5e | Python | DragonWarrior15/snake-rl | /utils.py | UTF-8 | 16,902 | 2.9375 | 3 | [] | no_license | # some utility functions for the project
from tqdm import tqdm
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import matplotlib.animation as animation
import numpy as np
import time
import pandas as pd
import sys
def calculate_discounted_rewards(rewards, discount_factor=0.99):
"""Utility ... | true |
37c5e6e6e9c2cbc455032b1c170bb82ae3870095 | Python | Fabriciogg8/pygame | /tilemap.py | UTF-8 | 2,577 | 3.015625 | 3 | [] | no_license | from settings import TILESIZE
import pygame as pg
import pytmx
from settings import *
def collide_hit_rect(one, two):
return one.hit_rect.colliderect(two.rect)
class Map:
def __init__(self, filename):
self.data = []
with open (filename, "r") as f:
for line in f:
... | true |
9ecfd07533f2a8fffee277ead99b37260960e3fd | Python | jtaenzer/InsightProject | /scripts/clean_db.py | UTF-8 | 3,274 | 2.53125 | 3 | [] | no_license | import os
from pymongo import MongoClient
import re
def regex_subs(title):
clean_title = title
clean_title = re.sub(r"\bceo\b", "chief executive officer", clean_title)
clean_title = re.sub(r"\bpres\b", "president", clean_title)
clean_title = re.sub(r"\bvp\b", "vice president", clean_title)
clean_ti... | true |
0f7df456ad71bbcd9a1f70b8656b202e26e30815 | Python | that-jpg/repositorio_do_desafiador | /l33t/problems/teams-forming.py | UTF-8 | 271 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python
trash = input()
students = list(map(int, input().split(' ')))
students.sort()
problems = 0
for i, student in enumerate(students):
if (i % 2 == 1):
continue;
problems = problems + (students[i + 1] - students[i])
print(problems)
| true |
b60914e02199021008dfe5e60771d05ea017cf76 | Python | dorothychen/nycmoves | /get_dest_counts.py | UTF-8 | 1,081 | 2.765625 | 3 | [] | no_license | # get_dest_counts.py
#
#
import pandas as pd
import os, sys, time
from globes import taxi_dir, days_dir, dest_count_dir, getFullDf
ZONE_COLS = [
"pickup_day",
"pickup_hour",
"pickup_zone_taxi",
"dropoff_zone_taxi",
"pickup_borough",
"dropoff_borough"
]
def get_dest_counts(df=None):
i... | true |
3ff9c51f1f40bde67b9883bab3136eeefebd9fe5 | Python | mruigrok/self-driving-car | /src/get_data.py | UTF-8 | 4,267 | 2.953125 | 3 | [] | no_license | import cv2
import numpy as np
import time
import os
from helpers.grabscreen import grab_screen
from helpers.getkeys import key_check
from helpers.balance_data import balance_data
#Script to get the screen and keyboard input from the user. Use 'P' to pause collecting the data
#Variables for image resize, filename for... | true |
21ae52fc62cc3db40c4cf33e5becdaefdd8a44c3 | Python | tngo0508/practice_coding | /number_of_stairs.py | UTF-8 | 183 | 3.75 | 4 | [] | no_license | def staircase(n):
# Fill this in.
if n <= 1:
return 1
return staircase(n - 1) + staircase(n - 2)
print staircase(4)
# 5
print staircase(5)
# 8
print staircase(2) | true |
deb2ae6a724ae1c0991fb8384bb45cc8e52ba337 | Python | minlattnwe/unreliable-deform-manipulation | /moonshine/src/moonshine/tests/testing_utils.py | UTF-8 | 1,011 | 2.96875 | 3 | [] | no_license | import numpy as np
import tensorflow as tf
def are_dicts_close_np(a, b):
for v1, v2 in zip(a.values(), b.values()):
if not np.allclose(v1, v2):
return False
return True
def assert_dicts_close_np(a, b):
for v1, v2 in zip(a.values(), b.values()):
assert np.allclose(v1, v2)
de... | true |
3810c71d00fb4b5c8db44477b607ebbd78433598 | Python | kalverra/KeepQuiet | /keep_quiet.py | UTF-8 | 656 | 2.625 | 3 | [] | no_license | import sys
import numpy as np
import sounddevice as sd
import soundfile as sf
threshold = 41 # Decibel limit where I can start to be heard in the other room
shut_up, sample_rate = sf.read("D:/Projects/Keep_Quiet/shut_up.wav")
def audio_callback(indata, frames, time, status):
if status:
print(status, fil... | true |
6c657788a54ef7645b22d3030d784eb2fbee6a7b | Python | Xowap/typefit | /tests/issue_000001/test_narrows.py | UTF-8 | 781 | 2.609375 | 3 | [
"WTFPL"
] | permissive | from typing import NamedTuple
import pendulum
from pytest import raises
from typefit import narrows, typefit
def test_date_time():
assert narrows.DateTime("2019-01-01T00:00:00Z") == pendulum.parse(
"2019-01-01T00:00:00Z"
)
with raises(ValueError):
assert narrows.DateTime("xxx")
def te... | true |
e98827e161e01a399eceee31e00eec88765bc0b0 | Python | tdorobantu/TexasHoldem | /TexasHoldem.py | UTF-8 | 21,264 | 3.640625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 7 19:05:37 2020
@author: Tudor Dorobantu
"""
import random
import numpy as np
from itertools import chain, combinations
from collections import namedtuple
from operator import attrgetter
class TexasHoldem:
"""
Initializes TexasHoldem Table. Works with Playe... | true |
aad5c1e4f01f2da3dff5a70bb20153076896d54a | Python | atharvap27/Forest-Cover-Project | /data_preprocessing/preprocessing.py | UTF-8 | 6,397 | 2.953125 | 3 | [] | no_license | import numpy as np
import pandas as pd
from imblearn.over_sampling import SMOTE
from sklearn.impute import KNNImputer
from sklearn.preprocessing import StandardScaler
class preprocessing:
def __init__(self,file_object,logger_object):
self.file_object=file_object
self.logger_object=logger_o... | true |
28cc58167424fa06722c867b39c02f2cb8a012d7 | Python | narnolddd/CPDetect | /networklike.py | UTF-8 | 1,990 | 2.90625 | 3 | [] | no_license | ## Work in progress for using simulated annealing for fitting network combination parameters
import os
import numpy as np
coolRate = 0.5
init_guess=0.5 #Initial parameter guess
no_steps=20
like_file = "AS_like.xml"
tmp_file = "AS_like.tmp"
def replace_param(param):
with open(like_file,'r') as f:
filedat... | true |
7426a61b7ce974e1b0b0cdedc74c49baa68b1022 | Python | Prometheus-Team/pid-control | /InitialRotatePID.py | UTF-8 | 3,832 | 2.9375 | 3 | [] | no_license | from math import atan, sin, cos, radians, pi
class Controller():
def __init__(self, orientation, start, goal,kPVel = 0.1, kIVel = 0.01, kDVel = 0.1, kPPos = 0.1, kIPos = 0.01, kDPos = 0.1, kPW = 0.1, kIW = 0.01, kDW = 0.1, timeDurationVel = 0.1, timeDurationPos=0.3, saturationWheel=100):
self.startPossition... | true |
4d14b03b0e71b8a6ccd4eacf22f5dd1fe9a1d9e3 | Python | projectanthropos/architecting-anthropoveillance | /03-code-references/tripadvisor.py | UTF-8 | 1,254 | 3.015625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import time
url = "https://www.tripadvisor.com/Attractions-g43323-Activities-Minneapolis_Minnesota.html"
def fetch(url):
response = requests.get(url)
data = response.content
return data
def extract_data(data):
name = data.findChildren('a')[0].string.str... | true |
a239b06c5cda7f2b295ff25aece9816e197e6b8f | Python | sbarb/RPiProxy | /piserver/GPIOTCPHandler.py | UTF-8 | 2,373 | 3.125 | 3 | [] | no_license | import SocketServer
from PinsConfig import PinNames
from MyPi import MyPi
import logging
logging.basicConfig(level=logging.DEBUG,
format='%(name)s: %(message)s',
)
logger = logging.getLogger('GPIOTCPHandler')
# http://stackoverflow.com/questions/6792803/finding-all-possible-case-... | true |
57202b3ec50fb591ac540b1318c8c3f1702d0cac | Python | WoosterSchoolDLIPhysics/problem-set-1-derivatives-in-mechanics-Imacooldude | /Animation.py .py | UTF-8 | 1,135 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 25 11:30:25 2017
@author: admin
"""
from pylab import *
from pylab import *
#def x(t):
# x=3*sin(2*pi*t)
# return x
#def y(t):
# y=2*cos(2*pi*t)
# return y
#dt=.01
#t=arange(0,1+dt,dt)
#clf()
#plot(x(t),y(t),'r')
t = linsp... | true |
3e059c139a3841218996a2c663f562b33413921b | Python | avermaisi11/AWS-Development-Or-Automation | /Automating Security/stop_instance.py | UTF-8 | 573 | 2.796875 | 3 | [] | no_license | """
Scenario:
Below lambda function code will get trigger by SNS which will be trigger by CloudWatch Alarm when there will more than 2 invalid login in BastionHost
Instance.
The below lambda function will stop the instance.
"""
import json, boto3
ec2 = boto3.client('ec2')
def lambda_handler(event, contex... | true |
2077c05c3f99dd61fbe42af9336128d6a2c8d958 | Python | parulsajwan/python_all | /ch1_replace_findmethod.py | UTF-8 | 385 | 3.59375 | 4 | [] | no_license | name="she is a girl and she is good dancer "
print(name.replace("is","was",1)) # 1 denotes replace the first is
print(name.find("i",5)) # find from 5 position
name2="she is a girl and she is good dancer "
is_pos1=name.find("is")
is_pos2=name.find("is",is_pos1+1) # +1 because it will start from next place to first i... | true |
ff883742220d989df468c9ab08a1d87869060822 | Python | kel243/Chat | /models.py | UTF-8 | 1,308 | 2.5625 | 3 | [] | no_license | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class User(db.Model):
user_id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(24), nullable=False, unique=True)
pw = db.Column(db.String(64), nullable=False)
def __init__(self, username, pw):
self.username = u... | true |
8b7fd1f75c5c79cb425c862c0424ba62107efc5f | Python | Nikikapralov/Codewars | /Python/Find_the_divisors!.py | UTF-8 | 287 | 3.625 | 4 | [] | no_license | def divisors(number):
number = int(number)
divisors_list = []
[divisors_list.append(integer) for integer in range(2, number) if number % integer == 0]
if not divisors_list:
result = f'{number} is prime'
else:
result = divisors_list
return result
| true |
d73c7149fec0c4e49daf208cad5301a996353df8 | Python | Spikhalskiy/invest-checker | /graphs/graph.py | UTF-8 | 664 | 2.75 | 3 | [] | no_license | from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Numeric, String, DateTime
Base = declarative_base()
class GraphPoint(Base):
__tablename__ = 'GraphPoints'
date = Column(DateTime, nullable=False)
name = Column(String, nullable=False)
category = Column(String, null... | true |
820b8626307dd0eda7cc9387c973e35d72890644 | Python | ciaranhd/project | /python4every1/Test.py | UTF-8 | 414 | 3.609375 | 4 | [] | no_license | # Gross pay computtion#
hrs = input("Enter Hours: ")
hrs = float(hrs)
pay_rate_normal = input("Enter normal rate of pay: ")
pay_rate_normal = float(pay_rate_normal)
def gross_pay(aa):
if hrs < 40:
added = (pay_rate_normal * hrs)
return added
else:
added = ((pay_rate_normal * 40)... | true |
2a0e5777ea6b963f0d1124952181caf8f9656131 | Python | rsreenivas2001/LabMain | /Sem 4/cn/tcp multiconnection/client.py | UTF-8 | 725 | 3.046875 | 3 | [] | no_license | import socket
import threading
HOST = "localhost"
PORT = 8888
TCP_client = socket.socket()
TCP_client.connect((HOST, PORT))
print(TCP_client.recv(256).decode())
name = input("Enter your NAME for the CHAT server : ")
TCP_client.send(name.encode())
def print_messages():
while True:
try:
me... | true |
0f70cc028e3d3f2ac45143011df2f46b9a4effb1 | Python | azhelezny/mobile-automation-python | /mobile_ui_searcher/Searcher.py | UTF-8 | 8,368 | 2.671875 | 3 | [] | no_license | import time
__author__ = 'andrey'
from mobile_ui_searcher.CustomDriver import CustomDriver
from selenium.webdriver.common.by import By
from config_entries.Properties import Properties
class Searcher:
driver = None
SWIPE_VERTICAL_X = 200
SWIPE_VERTICAL_Y = 400
SWIPE_HORIZONTAL_X = 200
SWIPE_HORIZ... | true |
220bb795ade55be0a66ed24e8620d8b27e82ac78 | Python | Rosenstoyanov/Week0HW | /Number Containing all digits/solution.py | UTF-8 | 324 | 2.984375 | 3 | [] | no_license | def contains_digits(number, digits):
exist = False
numberStr = str(number)
for item in digits:
for strItem in numberStr:
#print(strItem)
#print(type(item))
#print (type(strItem))
if strItem == str(item):
exist = True
if exist == False:
return False
exist = False
return True
#ctrl c stop pro... | true |
a6ba0c8c16871d59cb9f8634e24fca97cf675f7d | Python | donghang-a/Rs_task_DH | /RsL1_Action1_byDH_Alldata.py | UTF-8 | 1,413 | 2.671875 | 3 | [] | no_license | from sklearn.model_selection import train_test_split
from sklearn import preprocessing
from sklearn.metrics import accuracy_score
from sklearn.datasets import load_digits
import matplotlib.pyplot as plt
from sklearn import tree
import numpy as np
import datetime
data = np.load('mnist.npz') #从本地读取数据集
# 加载数据... | true |
59418e8e181f5214f37f4381d27ba60a15451ab5 | Python | mattkjames7/spicedmodel | /spicedmodel/PlotEq.py | UTF-8 | 6,006 | 2.671875 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from mpl_toolkits.axes_grid1 import make_axes_locatable
from .Mav import Mav
from .MavHot import MavHot
from .MavPS import MavPS
from .MavPT import MavPT
from .Prob import Prob
from .PS import PS
from .PT import PT
from .Density impor... | true |
cbd75c962e59d0e490c597abdadf754830bf3bbe | Python | Zer0xPoint/LeetCode | /Top Interview Questions/1.Array/Intersection of Two Arrays II.py | UTF-8 | 1,074 | 3.3125 | 3 | [] | no_license | from collections import defaultdict
from typing import List
class Solution:
def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]:
# sort solution
# nums1.sort()
# nums2.sort()
# result = []
# i1, i2 = 0, 0
#
# while i1 < len(nums1) and i2< le... | true |
f32670459421ed032f0a894177e733fab36d3273 | Python | xytill/tic-tac-toe | /Topics/Loop control statements/Count up the squares/main.py | UTF-8 | 132 | 3.21875 | 3 | [] | no_license | numbers = []
while 1:
numbers.append(int(input()))
if sum(numbers) == 0:
break
print(sum(x * x for x in numbers))
| true |
a64a475148d9dfe7b63e8051ff5e1753527c86b0 | Python | Albert-Agung-G/python | /calculator.py | UTF-8 | 315 | 3.796875 | 4 | [] | no_license | operasi = input("operasi dalam? : ")
angka1 = int(input("angka dalam meter : "))
angka2 = int(input("angka2 dalam meter : "))
if operasi == '+':
hasil= angka1 + angka2
elif operasi == '-':
hasil= angka1 - angka2
elif operasi == '*' :
hasil= angka1 * angka2
else:
hasil= angka1 / angka2
print (hasil) | true |
51304718c819ece379b1259ea258425988d0a89b | Python | StarBrand/CC5114-Tareas | /tests/test_useful/test_set_functions.py | UTF-8 | 1,745 | 3.03125 | 3 | [] | no_license | """test_set_functions.py: unittest of set methods"""
from unittest import TestCase, main
import numpy as np
from os import path
from useful.patterns import Line
from useful.preprocess_dataset import split_set, import_data
class FunctionTest(TestCase):
def setUp(self) -> None:
"""
Sets up unittest... | true |
a9ac008f6dd3400ad4fb5aefd1889e3b20620a05 | Python | ohnorobo/pagerank | /pagerank.py | UTF-8 | 3,587 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python
'''
// P is the set of all pages; |P| = N
// // S is the set of sink nodes, i.e., pages that have no out links
// // M(p) is the set of pages that link to page p
// // L(q) is the number of out-links from page q
// // d is the PageRank damping/teleportation factor; use d = 0.85 as is typical
//
fore... | true |
87a7951e0c7ff7b3215ba9ca577ea2fb63fa8b8a | Python | Little-Captain/py | /Python/02-Core/26.py | UTF-8 | 6,400 | 3.6875 | 4 | [] | no_license | #!/usr/bin/env python
# pdb: python debug
# break b 设置断点
# continue c 继续执行程序
# list l 查看当前行的代码段
# step s 进入函数
# return r 执行代码直到从当前函数返回
# quit q 中止并退出
# next n 执行下一行
# print p 打印变量的值
# help h 帮助
# args a 查看传入参数
# 回车 重复上一条命令
# break b 显示所有断点
# break lineno b lineno 在指... | true |
07153612c72f7ada34889c0c4363df2c6aedd422 | Python | oakie/qi-list | /qi.py | UTF-8 | 3,826 | 3.0625 | 3 | [] | no_license | import requests
import re
section_title_re = re.compile('(?<===).*(?===)')
series_section_re = re.compile('.*(Series\s[A-Z][^=]*)')
episode_title_re = re.compile('(?<=\|Title=)([^<])*')
guests_cell_re = re.compile('(?<=\|Aux1=)(.)*')
params = {
'format': 'json',
'action': 'query',
'prop': 'revisions',
... | true |
3d7f1605b527697fe0d53c7940f45daef8d7acde | Python | 1033291362/python | /剑三/剑三.py | UTF-8 | 1,381 | 2.59375 | 3 | [] | no_license | #coding:utf-8
import requests
import urllib2
import re
import HTMLParser
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
url="http://tieba.baidu.com/f?kw=%BD%A3%C8%FD&fr=ala0&tpl=5"
def getHtml(url):
header={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.... | true |
38bdb02178649ab90e1ca72a4292ac45643c4fbc | Python | pmeq/pyback | /pyback/SysUtil.py | UTF-8 | 4,191 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
import time
import logging
import sys
import os
import multiprocessing
import datetime
import re
import traceback
def get_local_address():
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname)
if ip:
return ip
else:
... | true |
cfaa681c966927ff3c7b16c30dd8abcf1900748e | Python | bimasetia/python-exercise | /33.py | UTF-8 | 78 | 4 | 4 | [] | no_license | a = [1, 2, 3]
for n,i in enumerate(a):
print(f"Item {i} has number {n}")
| true |
4cd047ed58486dccb3328776071a6e4caa31ce6d | Python | freebird258/project | /misc/thread_test.py | UTF-8 | 474 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import time
import threading
class MyThread(threading.Thread):
def __init__(self,parm):
threading.Thread.__init__(self)
self.parm = parm
def run(self):
for i in xrange(5):
print 'thread {}, @number: {}, {}'.format(self.name, self.parm,i)
def exec_thread(p):
... | true |
c621cc361ad97e27e2fb32f32333298a70834ea0 | Python | iteong/comp9021-principles-of-programming | /labs/Lab_9_solutions/exercise_3.py | UTF-8 | 3,413 | 4.09375 | 4 | [] | no_license | # Checks whether an expression can be generated by the following grammar,
# and in case the answer is yes, evaluates the expression and displays its value.
# EXPRESSION --> TERM SUM_OPERATOR EXPRESSION
# EXPRESSION --> TERM
# TERM --> FACTOR MULT_OPERATOR TERM
# ... | true |
83dc812a032a1fa0e4fca4097947acabcd8af185 | Python | aopp-pred/openifs-scmtiles | /openifs_scm.py | UTF-8 | 13,986 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | """A TileRunner class for runnning the OpenIFS SCM over a tile."""
# Copyright 2016 Andrew Dawson
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.... | true |
c8220ad8bc6ae9c3e1378af4da2c064b54130999 | Python | WargLlih/LPP | /LPP_Listas/Lista_05/Questao_B.py | UTF-8 | 133 | 3.03125 | 3 | [] | no_license | cont = 0
for i in range(1, 10):
if i != 3:
for j in range(1, 7):
print('oi')
cont+=1
print(cont)
| true |
76b68fc751c1ee6285a3b23057e5ce6ce86bf2a6 | Python | 2snchan/gradresearch | /filler.py | UTF-8 | 994 | 2.703125 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage
from skimage.feature import canny
from skimage import morphology
from skimage.filters import sobel as skimage_sobel
src = cv2.imread("src/img.png", cv2.IMREAD_COLOR)
gray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)
laplacian = cv2.Lap... | true |
3bb71b706bf0910e9e79a97bae9102a3a84dbeb6 | Python | DaltonLarrington/Dalton-Larrington-Data-Structures | /Dalton Larrington DS Level 1-2 - Simulation/doctorsoffice.py | UTF-8 | 2,846 | 3.6875 | 4 | [] | no_license | #Doctor's Office
#Programmer: Dalton Larrington
#Date: 1-31-18
# Originally I had trouble with finding the correct methods in which the simulation will run from.
# As we went along, I saw how abstract a simulation can be.
# While creating multiple patients, I found it difficult for the simulation to run multiple patie... | true |
13aca2f21b12fd393cfa3f13c34486ed5d904f8a | Python | HarrisonMc555/adventofcode | /2015/day01b.py | UTF-8 | 1,030 | 3.8125 | 4 | [] | no_license | #!/usr/bin/env python3
# TEST = True
TEST = False
INPUT_FILE = 'input01.txt'
def main():
if TEST:
test()
return
else:
print(get_index_for_basement(get_text(INPUT_FILE)))
def get_index_for_basement(text):
floor = 0
for i, c in enumerate(text):
if c == '(':
f... | true |
f0a3d88164e175526618677bebd1bbd0bb1b1776 | Python | hugokk12/lin-lana | /run.py | UTF-8 | 1,376 | 2.578125 | 3 | [] | no_license |
import streamlit as st
import pandas as pd
from streamlit_folium import folium_static
import folium
from folium.plugins import HeatMap
import json
import numpy as np
import matplotlib.pyplot as plt
import random
import pickle
import plotly.express as px
import streamlit.components.v1 as components
import statistics
... | true |
b1ecd8f0b38cf8e848c26abcd208c0bae9d73c6f | Python | duaraghav8/MailGriller | /sendmail.py | UTF-8 | 2,439 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python3
import smtplib;
import os;
from openpyxl import load_workbook;
import getpass;
#For problems, feedback and/or bug reporting, please contact duaraghav8@gmail.com
def send_mail (to, subject, text, gmail_sender_id, server):
BODY = '\r\n'.join(['To: %s' % to, 'From: %s' % gmail_sender_id,'Subject: ... | true |
df2d69609c5836f2e92ca750e62d73bd8139870f | Python | dsprahul/PersonalAssistant | /framework/contentExtractor.py | UTF-8 | 1,792 | 3.796875 | 4 | [] | no_license | # Content extractor logic from that case study.
# This program takes an array of truthvalues of words in sentence. That will be a vector
# of binary, vector length being length of sentence.
# And gives out starting counter and length of longest streak of zeros in the sentence
# That's our content, a little tailoring... | true |
cef899eeba20ad4742271002c4144ca9af855550 | Python | kigsmtua/FIleScanner | /weather.py | UTF-8 | 1,784 | 4 | 4 | [] | no_license | #
# Task:
# Write a program to find the row with the **maximum** spread
# in the weather.dat file,
# where spread is defined as the difference between MxT and MnT.
# @author John Kiragu Mutua
# Author email : mutuakiragu@gmail.com
#
import operator
import re
#Reads data from file and the data in a list
def read_... | true |
693d6c0bfa603f84e5eb27baf3b3decd4662e2ea | Python | gualt1995/pRP | /operators.py | UTF-8 | 1,947 | 3.84375 | 4 | [] | no_license | import random
def single_point_crossover(parent1, parent2, p_crossover=1.0):
"""Perform a single point crossover on two given parents.
The point is chosen uniformly and two children are produced.
Args:
parent1 (string): First parent.
parent2 (string): Second parent.
p_crossover (f... | true |
1007192db249c5e97d7fcdfab4f79f0b2f9f112d | Python | lingofunk/lingofunk-regenerate | /lingofunk_regenerate/tests.py | UTF-8 | 2,632 | 2.765625 | 3 | [
"MIT"
] | permissive | import torch
import numpy as np
from lingofunk_regenerate.utils import log as _log
def log(text):
_log(text, prefix="tests: ")
def test_generate_text_of_sentiment(model, dataset):
log("Text generation of given sentiment\n")
# Samples latent and conditional codes randomly from prior
z = model.sample... | true |
92b469cf1dbe8c2288a4795a34ed9ea8caaf046f | Python | billhuang56/job-miner | /database_tests/db_test.py | UTF-8 | 3,103 | 3.015625 | 3 | [
"MIT"
] | permissive | from elasticsearch import Elasticsearch
import psycopg2
import pandas as pd
from statistics import mean
import time
import random
import pickle
from scipy import stats
import db_config as conf
'''
Run query speed tests from local machines between PostgreSQL and Elasticsearch
'''
# Open the list of tags
with open('tag_... | true |
5e8867dbbec698e6ed32a6955662f4b47cd174ff | Python | malmike/BucketListAPI | /tests/test_app_config.py | UTF-8 | 1,761 | 2.671875 | 3 | [] | no_license | """
Script contains test that verify the app configurations
"""
from flask_testing import TestCase
from instance import ENVIRONMENTS
from myapp import create_app
class DevelopmentConfigTests(TestCase):
"""
Class contains test that verify the app created with
development configurations
""... | true |
58cb0af8f714e573ae37080a3a03394206d5570b | Python | YoannT/Projet-TAL_M1 | /Projet/src/algo.py | UTF-8 | 2,409 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import codecs
import matplotlib.pyplot as plt
import unicodedata
import re
from collections import Counter,defaultdict
import os
import string
import pdb
import nltk
import scipy
import numpy.random as rand
import nltk.corpus.reader as pt
import cPickle as ... | true |