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 |
|---|---|---|---|---|---|---|---|---|---|---|
206565e6699be13a6bff4868a40867d689dcbb40 | cschu/chrom_plot | /chrom_plot/data_io.py | UTF-8 | 2,754 | 2.703125 | 3 | [
"MIT"
] | permissive | import os
import csv
def read_genemap(geneset_file):
gene_map = dict()
for line in open(geneset_file):
if line.startswith("#"):
timepoints = set(map(int, line.replace("#", "").replace("dpi", "").strip().split(" ")[:-1]))
col = "#cc0000"
if 7 in timepoints:
... | true |
3054aec2695a6b055c6f30356a4fad5e02fa8954 | pvmigdalov/self-taught-programmer-Althoff | /chapter_12.py | UTF-8 | 1,099 | 4.09375 | 4 | [] | no_license | from math import pi
# №1
class Apple:
def __init__(self, t, c, s, p):
self.type = t
self.color = c
self.size = s
self.price = p
# №2
class Circle:
def __init__(self, r):
self.radius = r
def area(self):
return pi * self.radius**2
# №3
class Traingle:
... | true |
f6b2e5022f2dca1d22463e80f41ee0807d1a8377 | argentonik/battlefield | /script.py | UTF-8 | 1,113 | 3.125 | 3 | [] | no_license | import json
from encoder import ObjectEncoder
from model import *
from print_scripts import print_init_stats, print_line, print_battle_log, \
print_battle_log_from_json
print("Играть или посмотреть лог прошлой игры? (p - играть, другое - лог)")
answer = input()
if answer == 'p':
arm1 = Army(name='A'... | true |
a8e963b875405273d340cf0d85f841bf4324be85 | jarmknecht/CS474-Final_Project | /DataBot/preprocessors/stock.py | UTF-8 | 7,901 | 2.921875 | 3 | [] | no_license | import json
import os
import pandas as pd
import numpy as np
import shutil
from pathlib import Path
from DataBot.config import CONFIG
class Stock:
"""
Computes Traditional Stock Market Indicators.
"""
DATA_IN_PATH = CONFIG["downloaders"]["stocks"]["path"]
DATA_OUT_PATH = CONFIG["preprocesso... | true |
c8366365e3389345468523dfc11a77a7084fc0e5 | macleginn/eurphon-parse-search | /prepare_inventory_file.py | UTF-8 | 2,996 | 2.65625 | 3 | [] | no_license | import os
import json
import sqlite3
from collections import defaultdict
from unicodedata import normalize
import pandas as pd
from IPAParser_3_0 import IPAParser
parser = IPAParser()
def prepare_eurphon():
db_connection = sqlite3.connect(os.path.join('data', 'europhon.sqlite'))
cursor = db_connection.cursor... | true |
f55b10c5dfc1410c26d40302db195dc6312ca9f4 | LidaVygonskaya/Citizen-system | /citizen_system/tests/citizen_system_config.py | UTF-8 | 17,847 | 2.734375 | 3 | [] | no_license | import copy
import random
import string
class Config:
"""
Class for config to get templates as fields.
"""
pass
def random_string(string_length=10):
"""Generate a random string of fixed length """
letters = string.ascii_lowercase
return "".join(random.choice(letters) for i in range(stri... | true |
ecbf299d549c952e8b8eb1ab708d4a1ea3714562 | yunyuyuan/pygame | /五子棋/五子棋游戏/play.py | UTF-8 | 15,050 | 2.53125 | 3 | [] | no_license | from 小工具.gametool.GameButton import Button
from 小工具.gametool.alert import Window
from requests import post
import pygame
from threading import Thread
from json import loads
from copy import deepcopy
# 游戏界面
class Play(object):
def __init__(self, father, surface):
self.screen = surface
self.father =... | true |
45dbb56de6ea4b4b1cd8f51a2a531f60544b6bf5 | Daryl-PSH/us_traffic | /src/data_pipeline/feature_engineering.py | UTF-8 | 2,360 | 3.203125 | 3 | [] | no_license | import pandas as pd
import datetime as datetime
from dateutil.relativedelta import relativedelta
def create_max_volume_column(traffic_df: pd.DataFrame) -> pd.DataFrame:
"""
Create the max_volume_column for the traffic dataframe which keep tracks of the total
daily traffic volume
Args:
traffic... | true |
4b94cc0279051a60dcf60c4a1ea7254f39e7ec20 | jvrb/Python | /Lista de Exercícios I Python para Zumbis - D.S.M.1.S - Fatec 2021/4 - aumento_de_salario.py | UTF-8 | 411 | 4.25 | 4 | [
"MIT"
] | permissive | #4) Faça um programa que calcule o aumento de um salário. Ele deve solicitar o valor do salário e a porcentagem do aumento. Exiba o valor do aumento e do novo salário.
print("Calculo de salario")
salario = int(input("Valor do salario: "))
aumento = int(input("Quantos % de aumento: "))
salario_aumento = salario + (sal... | true |
32ea08d54f01ce6f06b9028d34d374aaf2fb8bb0 | vchernoy/coding | /hackerrank/medium/dynamic_programming/bricks_game/bricks_game.py | UTF-8 | 375 | 2.71875 | 3 | [] | no_license |
for _ in range(int(input())):
n = int(input())
a = [int(w) for w in input().split()]
assert len(a) == n
if n <= 3:
print(sum(a))
else:
a.reverse()
f0, f1, f2 = 0, a[0], a[0]+a[1]
s = sum(a[:2])
for i in range(3, n+1):
s += a[i-1]
f0, f... | true |
18cea75afd984b594c8a88de73df8708b14989ae | ximenchuigao/fetch | /src/fund_sync/old/fetch_fund_details.py | UTF-8 | 2,248 | 2.796875 | 3 | [] | no_license | # https://fundapi.eastmoney.com/fundtradenew.aspx?ft=pg&pi=1&pn=100
# response begin with var rankData =
import requests
import demjson
import sqlite3
databaseName = '..\\test.db'
def CreateFundDetailsTable(dbname):
conn = sqlite3.connect(dbname)
cur = conn.cursor()
cur.executescript('''
DROP TA... | true |
e414f2d928f76586f72f2e0ce9003c8ccb1064f5 | torpau/mysql_movies | /extract_movie_data.py | UTF-8 | 846 | 2.875 | 3 | [] | no_license | from mongo_data.repo.movie_repo import store_movies, get_all, find
def extract_data():
with open('./raw_data/movie_titles_metadata.txt') as movie_data:
lines = []
for line in movie_data:
line = line.strip()
line_data = line.split(' +++$+++ ')
line_dict = {
... | true |
95b464d370ae68ab1d1ee10bd3e5d56ed13c924b | BB8-2020/FARM-deforestation | /python/models/metrics.py | UTF-8 | 3,863 | 2.859375 | 3 | [] | no_license | """Metrics for validating model performance."""
from typing import Any, Optional
from tensorflow import Tensor
from tensorflow import math as tf_math
from tensorflow.keras import metrics
class MeanIoU(metrics.MeanIoU):
"""Class to calculate the MeanIoU."""
def __init__(
self,
num_classes: in... | true |
775b8c57a63f5363781226dad831c95f488c44d3 | anhpt1993/abstract_picture | /abstract_picture.py | UTF-8 | 3,765 | 3.796875 | 4 | [] | no_license | # abstract pictures
import turtle as t
import random
def get_color():
return random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)
def draw_rectangle(width, height, color):
t.pendown()
t.pencolor(color)
for i in range(4):
if i % 2 == 0:
t.forward(width)
els... | true |
f6e446a6c343b353c1dda64f83e3b586fa7a9755 | abedhousary/To-do-list | /main.py | UTF-8 | 1,085 | 3 | 3 | [] | no_license | from tkinter import *
counter = 0
def add (event=None):
global counter
counter += 1
messagetoadd = f"{counter} {e1.get()}"
lis.insert(END,messagetoadd)
e1.delete(0,END)
def edit(event):
slot = lis.get(ACTIVE).split()
e1.insert(END,slot[1])
lis.delete(ACTIVE)
root = Tk()
width = 500
height = 500
sw = root.wi... | true |
6b49d8f2940406f6695cc4eff6dc0ae8a3df8aeb | HelberthGM/Python | /PildorasInformaticas_video17/Ejercicio2.py | UTF-8 | 203 | 3.890625 | 4 | [] | no_license | number=int(input("Intoduce un numero positivo: "))
suma=0
while number>0:
suma=number+suma
number=int(input("Intoduce otro numero positivo:"))
print ("La suma de todos los numero intoducidos es",suma) | true |
223aa5150f0eac50f1f4aef83a1f88f6957da880 | Guya-LTD/branch | /tests/unit/test_branch_repository.py | UTF-8 | 2,231 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""Copyright Header Details
Copyright
---------
Copyright (C) Guya , PLC - All Rights Reserved (As Of Pending...)
Unauthorized copying of this file, via any medium is strictly prohibited
Proprietary and confidential
LICENSE
-------
This file is subject to the terms and conditi... | true |
4e23f895bf8e35b2a94532d56c7425ff298e343a | alexandrabrown/lyrical-genre-predictor | /vectorization.py | UTF-8 | 814 | 2.75 | 3 | [] | no_license | import tf_idf
import count_vec
import binary_vec
import lsa
import sys
from main import usage_string
# Function to vectorize input lyrics based on command line arg
def vectorization(train_lyrics, test_lyrics, vect_opts, output_matrix="dense"):
if vect_opts == "tf_idf":
return tf_idf.tf_idf_vectorize(trai... | true |
e24ff589563d4cde33abdd6abcc8f7f4b738a566 | sanket17-amazatic/contacts-service | /src/api/v1_0_0/serializers/user_serializers.py | UTF-8 | 2,947 | 2.8125 | 3 | [] | no_license | """
Serializer for Conntact app user accounts
"""
import phonenumbers
from rest_framework import serializers
from user.models import (User, BlackListedToken)
class UserSerializer(serializers.ModelSerializer):
"""
Serialzer class for Application user
"""
password2 = serializers.CharField(write_only=True... | true |
08848e576fc78de9ada6dcd9b04451e43fad2146 | theSTremblay/Data-Science-Principles | /Hw5_DataScience.py | UTF-8 | 2,206 | 2.984375 | 3 | [] | no_license | # imports needed
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
# setting seed, DON'T modify
def reshape_to_Image(arr):
w, h = 28,28
#arr = np.random.randint(255, size=(28 * 28))
#arr = arr *255
#img = Image.fromarray(arr.reshape(28, 28), 'RGB')
arr = arr.reshap... | true |
adc13ee364588da380159beaeea2bacce38357c4 | amckee/Maxine | /sandbox.py | UTF-8 | 681 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python3
from bluetooth import *
import bluetooth
obd_name = "FIXD"
#obd_mac = "88:1B:99:1D:1F:5E"
obd_addr = None
print( "Scanning..." )
neardevs = bluetooth.discover_devices()
print( "Found %d devices" % len(neardevs) )
for dev in neardevs:
if obd_name == bluetooth.lookup_name( dev ):
obd_a... | true |
83cab3810ad39dab44529f7580a3d3820a656a56 | SrikanthAmudala/COMP551_Projects | /MiniProj_1/scikit_test.py | UTF-8 | 704 | 2.75 | 3 | [] | no_license | import numpy as np
import pandas as pd
import utils
from sklearn.linear_model import LogisticRegression
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
path = 'winequality/clean_redwine.csv'
df = pd.read_csv(path,index_col=0)
# df = utils.augment_square(df)
# df = utils.augment_interact(df)
(X_tr... | true |
cf8310711d9325c79ebbee5a26688c5bcf0a351e | CN-UPB/nbgrader | /nbgrader/tests/formgrader/base.py | UTF-8 | 3,982 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | from six.moves.urllib.parse import urljoin, unquote
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import TimeoutException
class BaseTestFormgrade(object):
"""Do NO... | true |
ea1d87322baa1df75214f947ba029c21d40f91a0 | hgomersall/Ovenbird | /tests/base_hdl_test.py | UTF-8 | 3,979 | 2.703125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive |
import unittest
from random import randrange
from myhdl import Signal, intbv
from mock import patch, call
def get_signed_intbv_rand_signal(width, val_range=None, init_value=0):
'''Create a signed intbv random signal.
'''
if val_range is not None:
min_val = val_range[0]
max_val = val_range... | true |
14c3b5fa3043dff2cd8919ace52c1d5662ac6bb3 | Tubbz-alt/LLNMS | /src/core/assets/llnms-run-asset-task.py | UTF-8 | 2,646 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
#
# File: llnms-run-asset-task.py
# Author: Marvin Smith
# Date: 6/15/2015
#
# Purpose: Run a task on a registered asset
#
__author__ = 'Marvin Smith'
# Python Libraries
import os, sys, argparse
# LLNMS Libraries
if os.environ['LLNMS_HOME'] is not None:
sys.path.append(... | true |
96c664c0c449e32a8492d7ce1a76ef5b11e721f0 | hahahannes/gateway | /helper_functions/core_link_format_helper.py | UTF-8 | 1,355 | 3.359375 | 3 | [] | no_license | """
CoRE Link Format (RFC6690) functions
"""
def generate_link(resources):
"""
Generates a link in the CoRE Link Format (RFC6690).
:param resources: Array of resources that should translated into links.
Resources are dict, containing a path property and a parameters property.
... | true |
51bc2bc2da25d0ab93cad5d28cdcbbab2260ce8b | tatsuya4649/cwan | /b_cam/camera.py | UTF-8 | 308 | 2.703125 | 3 | [] | no_license | import cv2
capture = cv2.VideoCapture("sample_movies/dark_tunnel.mp4")
while(True):
ret,frame = capture.read()
w_size = (300,200)
frame = cv2.resize(frame,w_size)
cv2.imshow("title",frame)
if cv2.waitKey(10) & 0xFF == ord("q"):
break
capture.release()
cv2.destroyAllWindows()
| true |
691125ca5205caf398a116e49df5bcf87852eecb | HUGGY1174/MyPython | /Ch06/Gugudan.py | UTF-8 | 209 | 4.09375 | 4 | [] | no_license | for dan in range(2, 10, 1) :
print(" ----", dan, "단","---- ")
for su in range(1, 10, 1):
print("|", dan, "x", su, "=", dan * su, "|")
print(" --------------")
print()
| true |
d7ece6c218921cff4178ab4799b9931736dbdfc1 | tua-qwest/project_Flask | /data/student_form.py | UTF-8 | 478 | 2.59375 | 3 | [] | no_license | from flask_wtf import FlaskForm
from wtforms import *
from wtforms.validators import DataRequired
class StudentForm(FlaskForm):
surname = StringField('Фамилия', validators=[DataRequired()])
first_name = StringField('Имя', validators=[DataRequired()])
last_name = StringField('Отчество (не обязатель... | true |
09d12bec2b2ce70faf3b1635d19a774a74651833 | natekoch/CIS-211 | /Exams/S2020-211-MT1/q2_color_tiles.py | UTF-8 | 2,234 | 4.375 | 4 | [] | no_license | """Rows of tiles (Midterm problem)"""
import enum
from typing import List
class Color(enum.Enum):
red = 1
blue = 2
def __str__(self) -> str:
"""'r' for red, 'b' for blue"""
return self.name[0]
ABBREVIATIONS = { 'r': Color.red,
'b': Color.blue
}
class Ti... | true |
46b0a51c1ca2285d82a77eb246b5f24fd6298d4f | Aikyo/python | /nlp1/jieba/1.jieba_keywords.py | UTF-8 | 864 | 3.234375 | 3 | [] | no_license | from jieba import analyse
text = r"其次因为香港是一个寸金寸土的地方,先不说它的房子价格有多么的高," \
r"我们如果要去香港游玩的话住宿方面就需要花费不少的钱,普通的民宿住一" \
r"晚上都需要花费400港币左右,也就是人民币300元,更不要说酒店了住一晚上" \
r"大概需要花费800以上港币也就是人民币600元以上。住的方面如果我们玩一段时" \
r"间就需要花费许多,一万元人民币顶多让你住十多天。" \
r"漂亮美丽无敌"
keywords = analyse.textrank(text,withWeight=Tru... | true |
6e7c9419250730f4244fc50ede1ed0b8ea7e1f75 | mbenedicrios/MCCDAQ_2048_TC | /Windows/MCCdaq/2408_examples/USB2408_c_in_32.py | UTF-8 | 3,111 | 3.203125 | 3 | [] | no_license | """
File: USB2408_c_in_32.py
Library Call Demonstrated: mcculw.ul.c_in_32().
Purpose: control the analog output
Demonstration: analog out range from -10V to +10V is .1V steps.
Other Library Calls: mcculw.ul.flash_LED()
... | true |
9c6af183e43292662262c32282a0627d4948245c | mtdukes/leg_tracker | /get_new_bills.py | UTF-8 | 3,516 | 2.859375 | 3 | [] | no_license | '''
get_new_bills.py
A python script to download a new Master File from the Legiscan API and check
against our application's existing master file for any bill changes.
Currently checks for old file in data/master_file_old.json
Usage:
python get_new_bills.py
'''
import urllib, json
import datetime, os
#API key for yo... | true |
5b379ef76db700ab9165e858f8f7fe41f9bbfddd | enchantress085/NLP_Basic | /parts_of_speech_3.py | UTF-8 | 2,869 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import nltk
paragr = """It is this fate, I solemnly assure you, that I dread for you,
when the time comes that you make your reckoning, and realize
that there is no longer anything that can be done. May you never
find yourselves, men of Athens, in... | true |
e785935eb3efa82f0706d95d9655883c8514af7c | ChanghwaPark/CCADA | /tools/bar_plot.py | UTF-8 | 2,929 | 2.59375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
# sns.set_context('paper')
# sns.set()
sns.set_style('ticks')
error_array_jcl_src = np.array([0.034, 0.035, 0.034])
error_array_jcl_src /= 100.
error_array_jcl_tgt = np.array([13.461, 13.344, 13.405])
error_array_jcl_tgt /= ... | true |
09c153745205b8afaf55cda43834f8cfe5d025dc | KarlEmm/LearningPython | /CrashCourse/PLOT/eq_world_map.py | UTF-8 | 1,081 | 2.515625 | 3 | [] | no_license | import json
from plotly.graph_objs import Scattergeo, Layout
from plotly import offline
# Explore the structure of the data.
filename = 'PLOT/MODIS_C6_Global_48h.csv'
with open(filename) as f:
all_eq_data = json.load(f)
all_eq_dicts = all_eq_data['features']
mag, lon, lat, hover_texts= [], [], [], []
for e in all... | true |
969dc24c775ab3aa1b1131441dda4f7c319b0c84 | ejfisher/OnboardFCCopy | /csuIF.py | UTF-8 | 2,334 | 2.84375 | 3 | [] | no_license | import csuGPS
import csuI2C
import csuDM
import csuTX
import time
timeA = ["Hours", "Minutes", "Seconds"]
gpsD = ["Latitude", "Longitude", "Altitude", "Speed", "TAD", "HD"]
gpsQ = ["Quality", "# of Satellites"]
axis = ["X", "Y", "Z"]
mplA = ["Pressure", "Altitude", "Temperature"]
headers = [timeA, gpsD, gpsQ, axis, ax... | true |
426062483730aee2b2e13b0b061f2fb2f8885eb0 | ju-sung-kang/algorithm-practice | /BOJ 14503.py | UTF-8 | 2,384 | 3.015625 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10**6) # 재귀호출이 많이 필요해서 최대 재귀호출 제한을 늘림
def clean(turn): # 로봇청소기의 작동을 정의
global r, c, d # r,c는 현재 행과 열 d는 현재 바라보는 방향
global _map
global cleaned # 청소한 칸... | true |
d8754af81163b91c914f19931574a2142145db22 | EoinDavey/Competitive | /Kattis/Fleecing_The_Raffle.py | UTF-8 | 196 | 2.734375 | 3 | [] | no_license | n, p = map(int,raw_input().split())
x0 = (p*1.0)/(n+1)
x = 1
while(True):
nx = x0 * ((x+1)*(n+x-p+1))/(x*(n+x+1))
x+=1
if nx < x0:
print "%.9f" % x0
break
x0 = nx
| true |
e011270d489f4931849d03baf25e4b95bf271543 | samkohn/atlas_pix | /readSR.py | UTF-8 | 1,312 | 2.828125 | 3 | [] | no_license | import dscope
import argparse
def collect(nsamples, outname, clock, data):
scope = dscope.ScopeInst(0)
scope.init_digital_channel(clk=clock)
#import pdb
#pdb.set_trace()
try:
traces = [scope.dtrace(timeout=1.0)[0][data] for i in range(nsamples)]
except IndexError:
print "dtrace ... | true |
c7f50912c17ef9ae7e0a6570a11b1b4b742170bb | zhuonan3180/NLP-for-8K-documents | /ey_nlp/preprocessing.py | UTF-8 | 8,849 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Taken largely from this website
# https://www.kdnuggets.com/2018/08/practitioners-guide-processing-understanding-text-2.html
import pandas as pd
import spacy
import nltk
from nltk.tokenize.toktok import ToktokTokenizer
import re
from bs4 import BeautifulSoup
from contractions import CONTRACT... | true |
fbf79ac600e89684149ae38147a667a3bc76f975 | suong4554/Data-Mining-PolyU | /scripts/randomForestAlgo.py | UTF-8 | 355 | 3.078125 | 3 | [] | no_license | from sklearn.ensemble import RandomForestRegressor
def apply_forest(train_x, train_y, test_x):
# apply Linear Regression:
rfr = RandomForestRegressor(n_estimators=250, criterion='mse', max_depth=3)
rfr.fit(train_x, train_y)
# predict the results:
y_prediction = rfr.predict(test_x)
# return pr... | true |
50d99efff7febf71c5c01cebb330a2108f3694e0 | thainan10/Tutoria-IP-2015.1 | /17-05/exemploMedia.py | UTF-8 | 874 | 4.40625 | 4 | [] | no_license | """Função que recebe uma lista de números como parâmetro
e retorna a média deles."""
def calculaMedia(numeros):
tamNumeros = len(numeros)
soma = 0
#Laço que irá realizar a soma dos números da lista.
for cont in range(tamNumeros):
soma+=numeros[cont]
media = soma / tamNumeros
return medi... | true |
6a4e4c93a9c50d87acfdfc28d8566bd79b453097 | Thang1102/PYTHON-ZERO-TO-HERO | /Basic/Chapter8/41-file01.py | UTF-8 | 292 | 3.859375 | 4 | [] | no_license | fp = open("data/list.txt","r") #đọc file
for line in fp :
print(line, end " ")
fp.close() #đong file sau đọc
##### dem dong trong file
fp = open("data/list.txt","r")
i = 0
for line in fp :
i = i + 1
print(line, end " ")
fp.close()
print()
print("Tông số dòng", i) | true |
94cc125a65ae1036cf902d18bd481052a8e95029 | frankdavid-addae/using_databases_with_python | /tracks.py | UTF-8 | 2,419 | 3.0625 | 3 | [] | no_license | import sqlite3
import xml.etree.ElementTree as ET
dbCon = sqlite3.connect('trackdb.sqlite')
cursor = dbCon.cursor()
# Create database tables using executescript
cursor.executescript('''
DROP TABLE IF EXISTS artist;
DROP TABLE IF EXISTS album;
DROP TABLE IF EXISTS track;
CREATE TABLE artist (
artistId INTEGER NO... | true |
7ffedb20d5c5731ec80ef8cfd7d710a2bc9947fd | lujoba/ImageProcessing | /imgFil/ImageFilters.py | UTF-8 | 7,042 | 3.046875 | 3 | [
"MIT"
] | permissive |
import numpy as np
import cv2
import matplotlib.pyplot as plt
import os
import math
class ImageFilters(object):
def __init__(self, apply, nImg):
super(ImageFilters, self).__init__()
self.apply = apply
self.nImg = nImg
self.nApply = nImg * sum(
[f.dimPerImg for f in sel... | true |
0009fe5b3b239edb8ece3d093120c1298fca62a3 | dockerizeme/dockerizeme | /hard-gists/2b19fd6f758ffd2e8ab9ec7d1f3f4b2c/snippet.py | UTF-8 | 4,548 | 3.34375 | 3 | [
"Apache-2.0"
] | permissive | # Toy example of using a deep neural network to predict average temperature
# by month. Note that this is not any better than just taking the average
# of the dataset; it's just meant as an example of a regression analysis using
# neural networks.
import logging
import datetime
import pandas as pd
import torch
import... | true |
880e1cb26611b2be5cc167b83f6f568ee11d7fab | StRobertCHSCS/fabroa-Ethan1127120 | /Working/ClassExamples/test.py | UTF-8 | 104 | 2.78125 | 3 | [] | no_license | colour = "red"
name = input()
print("this is a test")
print("another test")
print("third test", colour)
| true |
ce5e68d9814a30dfc135ef20cb538d55971bab66 | kwkelly/swflights | /run.py | UTF-8 | 6,934 | 2.546875 | 3 | [] | no_license | import swflights
import pandas as pd
import csv
import datetime
import numpy as np
import splinter.exceptions
import time
import string
import datetime
from email.mime.text import MIMEText
from subprocess import Popen, PIPE
import smtplib
import email_config
import logging
from sqlalchemy.ext.declarative import declara... | true |
7f573630bb6b9241ac915f07a68f3d7a0da8fd0e | tasyaulfha/bootcamp | /pemulaPython/fungsi.py | UTF-8 | 828 | 3.890625 | 4 | [] | no_license | def cetak(param1):
print(param1)
return
# panggil
cetak("Panggilan Pertama")
cetak("Panggilan Kedua")
def kali(angka1,angka2):
hasil=angka1*angka2
print('Dicetak dari dalam fungsi: {}' .format(hasil))
return hasil
keluaran=kali(10,20)
print('Dicetak sebagai kembalian: {}'.format(keluaran))
"""
N... | true |
dd296587928ea0746a2df02c3e0e98d813e2bcf7 | Danicodes/markov_deb | /assets/markov_debate.py | UTF-8 | 5,095 | 3.359375 | 3 | [] | no_license | ####################################################################
####################################################################
####################################################################
# Danielle Williams -- Exploring text generation using markov chains
# * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | true |
0ff9516d41888ca0bdd9df5dfae1fb81014291a9 | shuishiyuan/aoapc-bac2nd | /ch1/ch1-pg5-exam1.py | UTF-8 | 158 | 3.28125 | 3 | [] | no_license | import math;
r = float(input());
h = float(input());
s1 = 2 * math.pi * r * h;
s2 = math.pi * pow(r, 2);
area = s1 + 2 * s2;
print('Area = %.3f' % area);
| true |
324c2c18493803af9c2f55e451ba6f00f7da3291 | hobbz216/RandomVikingName | /random_name.py | UTF-8 | 3,258 | 3.8125 | 4 | [] | no_license | #Creating a random fantasy name generator
import random
import random_dict as rd
def random_name():
"""Generating a first and last name by generating random syllables and vowels"""
first_random = []
for i in range(3):
first_random.append(random.randint(1, 3))
last_random = []
for i in range(4):... | true |
0e6c34e1ef2e8ffd160646fef60e0158441a4223 | PhanVu26/Machine-Leaning | /Perceptron/main.py | UTF-8 | 752 | 2.84375 | 3 | [] | no_license | from Perceptron.myPerceptron import Perceptron
import numpy as np
perceptron = Perceptron()
# Load du lieu
file = "dataset.csv"
X, y = perceptron.loadData(file)
# Hien thi du lieu
perceptron.display_data(X[0], X[1], y)
# Tinh Xbar (d rows, N columns)
Xbar = np.concatenate((np.ones((1, X.shape[1])), X), axis=0)
# ... | true |
d5d9056d314f1141dff937c4885fbe74b0c60752 | mburaksayici/FullNumPyCNN-NN-LogReg | /visualizelayerfornn.py | UTF-8 | 1,816 | 2.546875 | 3 | [
"MIT"
] | permissive | import mnist
import numpy as np
import matplotlib.pyplot as plt
from forward2 import *
import matplotlib
#w1l2 = np.load("weight1fornnl2.npy")
w2l2 = np.load("weight2fornnl2.npy")
#w1 = np.load("weight1fornn.npy")
w2 = np.load("weight2fornn.npy")
#w1l1 = np.load("weight1fornnl1.npy")
w2l1 = np.load("weight2fornnl1.np... | true |
4baf34fd4fd74b8a1a34d0f40635f63adda65ead | SusanDarvishi/nlp3 | /sd2842_trainHMM_HW3 copy.py | UTF-8 | 11,592 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 30 10:57:10 2018
@author: susandarvishi
"""
# make dictionary of POS where each value is a dictionary from words to freq.
class word:
# frequencies we'll need a dictionary
def __init__(self, name = None, freq = None):
self.name = na... | true |
4d1e527567bf8b393826373e4a8315fd413f7670 | fedevirgolini-unc/AnNum | /lab04/ej1b.py | UTF-8 | 457 | 3.4375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
fun_lab04_ej1b = lambda x: (3/4) * x - (1/2)
x = np.linspace(0, 10, 20)
y = fun_lab04_ej1b(x)
y_desviado = y + np.random.rand(20)
coef = np.polyfit(x, y_desviado, 1)
aprox_plot = np.polyval(coef, x)
###---Gráfico---###
plt.plot(x,y, label="Función dada")
plt.plot... | true |
4a6f927e4ecd6b3a7e01218f12d88255e7924605 | jedzej/tietopythontraining-basic | /students/jarosz_natalia/lesson_05/maximum.py | UTF-8 | 419 | 2.703125 | 3 | [] | no_license | def func():
n, m = [int(i) for i in input().split()]
a = [[int(j) for j in input().split()] for i in range(n)]
best_i, best_j = 0, 0
curr_max = a[0][0]
for i in range(n):
for j in range(m):
if a[i][j] > curr_max:
curr_max = a[i][j]
best_i, best_j ... | true |
779c73928c49b38e970b7269209a39a63d983a08 | udaykumarbhanu/iq-prep | /ibts364/3-sum-zero.py | UTF-8 | 1,464 | 3.734375 | 4 | [] | no_license | '''Given an array S of n integers, are there elements a, b, c in S such
that a + b + c = 0?
Find all unique triplets in the array which gives the sum of zero.
Note:
Elements in a triplet (a,b,c) must be in non-descending order. (ie, a <= b <= c)
The solution set must not contain duplicate triplets. For example, given
... | true |
b4e37232cc8f4f7222bf45d24ba31ac21df93afe | dylanjorgensen/ai-for-robotics | /01-localization/01-lession/02-hit-and-miss-multiply.py | UTF-8 | 360 | 3.78125 | 4 | [] | no_license | # Write code that outputs p after multiplying each entry
# by pHit or pMiss at the appropriate places. Remember that
# the red cells 1 and 2 are hits and the other green cells
# are misses.
p=[0.2,0.2,0.2,0.2,0.2]
pHit = 0.6
pMiss = 0.2
for x,y in enumerate(p):
if x == 1 or x == 2:
p[x] = p[x]*pHit
... | true |
7edf8a3742babcdc2179af68b35b3f00168edc24 | janiszewskibartlomiej/Python-Postgraduate_studies_on_WSB | /01_2020/Part4_GR2.py | UTF-8 | 6,494 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import os
os.chdir('D:\\GITHUB\\Python-Postgraduate_studies_on_WSB')
#---- load data ----
flights = pd.read_csv("01_2020\\flights.csv")
weather = pd.read_csv("01_2020\\weather.csv")
#----- prepare data ------
#---- time series ----
flights['YMD'] = ... | true |
bda1b22435159a1c303ef1487e5cc5e82b640d76 | Ajitesh13/Python-OOP | /numpy/2_numpy.py | UTF-8 | 171 | 3.5625 | 4 | [] | no_license | import numpy as np
a = np.array([1,2,3]) #array created from a list
b = np.array((1,2,3,4,5)) #array created from a tuple
print("Shape of the array is " + str(b.shape)) | true |
fa5a4871892d740c318757de801c481b5d82cb59 | EliCUBE/b4ct | /Listapp1v3.py | UTF-8 | 1,217 | 3.859375 | 4 | [] | no_license |
import random
MyList = []
def MainProgram():
while True:
try:
print("HELLO. me ugg. me make list")
print("type number to choose from optios below and me do that")
choice = input("""1. add to list.
2.return the value index position.
3.random search
4.Exit pro... | true |
578fef8c241c6ec4ca912f2d631ff954ddf6a049 | AsmaRahimAliJafri/Client-Server-Communication-using-UDP-Sockets | /server.py | UTF-8 | 443 | 2.671875 | 3 | [] | no_license | import socket
UDP_IP_ADDRESS = "192.168.56.1"
UDP_PORT_NO = 6780
#creating server socket which listens for udp mgsgs
serverSock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
#binding the newly created socket to the ip and the port no
serverSock.bind((UDP_IP_ADDRESS, UDP_PORT_NO))
#WHILE LOOPS KEEPS ... | true |
5c763f59c422b9427670db46a760a6f91b142ef4 | dankoga/URIOnlineJudge--Python-3.9 | /URI_1172.py | UTF-8 | 170 | 3.90625 | 4 | [] | no_license | for index in range(10):
number = int(input())
if number > 0:
print('X[{}] = {}'.format(index, number))
else:
print('X[{}] = 1'.format(index))
| true |
b4a34104eba6fd9abe5b6a2e9ac2dff4bcbefb26 | JKHila/baekjoon-practice | /etc/5565 - bill.py | UTF-8 | 86 | 3.21875 | 3 | [] | no_license | total = int(raw_input())
for i in range(9):
total -= int(raw_input())
print total | true |
0e63aae0773e4471a089c130b05851c29d9736b5 | abhis2007/Nsec-Codechef-Chapter | /Encoding/Encoding Junior( MARCH )/Codechef Rating Pattern/gen_op_file ( rating pattern ).py | UTF-8 | 1,175 | 2.71875 | 3 | [] | no_license | from collections import defaultdict, deque
from itertools import permutations
from sys import stdin,stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
from random import randint,randrange,choice
int_input=lambda : int(stdin.readline())
string_input=lambda : stdin.readline()
multi_int_input =... | true |
479c7747d03d43031e8d51b89a7ee4237bcc8366 | xavierloos/python3-course | /Basic/Classes/variables.py | UTF-8 | 261 | 3.1875 | 3 | [] | no_license | # 1.You are digitizing grades for Jan van Eyck High School and Conservatory. At Jan van High, as the students call it, 65 is the minimum passing grade.
# Create a Grade class with a class attribute minimum_passing equal to 65.
class Grade:
minimum_passing = 65
| true |
cc687a83d921290367697ef32c702da9bcb4ba14 | swsms/python-for-practical-problems | /module2_xlsx/lesson4/calculate_salaries_for_roga_and_kopyta.py | UTF-8 | 1,743 | 3.296875 | 3 | [] | no_license | import os
from typing import List, Set, Tuple
import xlrd
import xlwt
LESSON_PATH = 'module2_xlsx/lesson4'
COMPANY_DATA_PATH = f'{LESSON_PATH}/rogaikopyta'
def get_file_names(directory_name: str) -> Set[str]:
file_names_in_dir = set()
for (path, _, file_names) in os.walk(directory_name):
for file_na... | true |
ef81b1828b7261e71e66216bf3e220da1583e7b0 | pligzie/shijianning | /main.py | UTF-8 | 4,007 | 4.15625 | 4 | [] | no_license | # 实现输入10个数字,并打印10个数的求和结果
# a = 0
# sum = 0
#
# while a < 10:
# c = int(input("请输入数字:"))
# sum = sum + c
# a+= 1
# print ("请输入数字:",sum)
# 从键盘依次输入10个数,最后打印最大的数、10个数的和、和平均数。
# a = 0
# sum = 0
# c = 0
# big = 0
# b = 0
#
#
# while a < 10:
# c = int(input("请输入数字:"))
# sum = sum + c... | true |
ec90005702d815d117e2c94e685de864a10125a7 | diegonzaleez/Extemporary_Unit2 | /functions1/ex02.py | UTF-8 | 111 | 3.328125 | 3 | [] | no_license | def sum_of_a_list(arr):
return(sum(arr))
arr=[]
arr = [12, 3, 4, 15]
print (sum_of_a_list(arr))
| true |
261a471682754d01d9104286689ecc90ac8fcba3 | alejandrogonzalvo/Python3_learning | /IES El Puig/lineas/build/scripts-3.7/main.py | UTF-8 | 4,584 | 3.8125 | 4 | [] | no_license | """
graficas : este programa visualiza una serie de graficas en un espacio 2d
Made by Alejandro Gonzalvo
Github: https://github.com/dahko37/Python3_learning
"""
import matplotlib.pyplot as plt
from numpy import linspace
from cmath import sin, cos, pi
def espiral_1():
"""Representa la función R(t) = t / 2p... | true |
2d8d69bc3981672124b7ac30ec858f83d584a98c | bingyingL/SuccessiveConvexification | /trajectory/plot.py | UTF-8 | 2,986 | 2.609375 | 3 | [
"MIT"
] | permissive | from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
import pickle
X_in = pickle.load(open("X.p", "rb"))
U_in = pickle.load(open("U.p", "rb"))
def plot_X():
''' state variable
0 1 2 3 4 5 6 7 8 9 10 11 12 13
x = [m, r0, ... | true |
ec14351b512bed277a4b61493d256de3ac587a79 | Centreant/fuelprice_download | /get_initial_fuel_price.py | UTF-8 | 815 | 2.671875 | 3 | [] | no_license | import requests
import pandas as pd
import settings
import write_to_db
import datetime
from write_to_db import write_data
# Request data from API
response = requests.get('https://api.onegov.nsw.gov.au/FuelPriceCheck/v1/fuel/prices', headers=settings.headers)
data = response.json()
stations = pd.DataFrame(data['statio... | true |
ae96a0038e61050c9205cb15a62f277455511675 | Woimarina/mundo-1---python-curso-em-video | /desafio 25.py | UTF-8 | 131 | 4.0625 | 4 | [] | no_license | nome = input('digite seu nome completo: ')
nome = nome.lower().strip()
print('seu nome possui Silva: {}'.format('silva' in nome)) | true |
dc56751416c74f343c24530fef65651f7c1426b7 | LetMarq/Quaternion | /ReadData.py | UTF-8 | 4,026 | 3.046875 | 3 | [] | no_license | # Developed by Letícia Marques Pinho Tiago
# Contact: leticia.marquespinho@gmail.com
import pyquaternion as pyq
import math
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import csv
# def save(quat1,quat2):
# with open('quat.csv', 'a') as arquivo_csv:
# escrev... | true |
32b5134cc707890c8ffced40398bfb1a073e5f38 | Eskay73/WaitingTimePredictor | /soln1.py | UTF-8 | 3,612 | 3.265625 | 3 | [] | no_license | import pandas as pd
import datetime as dt
import random
from time import sleep
def generateData( start=dt.datetime(2020, 6, 21), end=dt.datetime(2020, 9, 28) ):
"""This generates random data for clients issues
Args:
start (datetime): Start Time for issues to be generated from
end (datetime): ... | true |
994dd63b0d09b7c7fc5c9ac24477bb79119c23e1 | bwallace/sample-size-extraction | /sample_size_model_train.py | UTF-8 | 6,022 | 2.609375 | 3 | [] | no_license | from itertools import chain
import numpy as np
import gensim
from gensim.models import Word2Vec
import tensorflow as tf
from tensorflow.contrib import learn
import pandas as pd
import spacy
import pycrfsuite
from sklearn.preprocessing import LabelBinarizer
from sklearn.metrics import classification_report, c... | true |
3770b8ebc2f027fdd1239c44173356eed0e5ff2b | chamidullinr/nlp-translation-and-classification | /src/metrics.py | UTF-8 | 2,965 | 2.5625 | 3 | [] | no_license | from typing import Iterable
import numpy as np
from sklearn.metrics import accuracy_score, f1_score
def accuracy(pred: np.array, targ: np.array):
if len(pred.shape) == 2:
pred = pred.argmax(1)
return accuracy_score(targ, pred)
def f1(pred: np.array, targ: np.array, labels=None):
if len(pred.sha... | true |
5b49cb1be5e6e802a46634a5c8c7bb111ecff07a | DanSehayek/MachineLearning | /ScikitLearn/ConfusionMatrix.py | UTF-8 | 7,303 | 3.1875 | 3 | [] | no_license | from sklearn.cross_validation import train_test_split
from sklearn.cross_validation import cross_val_score
from sklearn.linear_model import LogisticRegression
from sklearn.preprocessing import binarize
from sklearn import metrics
import matplotlib.pyplot as plt
import pandas as pd
url = "https://archive.ics.uci.edu/ml... | true |
0065343f217d536484623623cbac597d10157b72 | markrichter14/Stats | /ubs_stats.py | UTF-8 | 8,562 | 3.296875 | 3 | [] | no_license | """
Code for Understanding Basic Statistics, 8th edition
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os
from scipy import stats
def str_to_arr(s):
'''
converts a str of space separeted values to an array
'''
res = map(int, s.split())
res = np.array(list(res))... | true |
cbb42c5d8970501e0af354746929be5722f9cb2f | PhillipRamdas/news | /app/models/newsUtils.py | UTF-8 | 7,618 | 2.515625 | 3 | [] | no_license | from random import randint as rand
import requests
newsSite = ["New Yorker", "Slate", "Daily Show", "The Guardian", "Al Jazeera America", "NPR", "Colbert Report", "New York Times", "BuzzFeed", "PBS", "BBC", "Huffington Post" , "Washington Post", "The Economist", "Politico", "MSNBC", "CNN", "NBC News", "CBS News", "Goo... | true |
702c76dfc876b64bc91487f3813a5c2c0a70538b | 314H/Data-Structures-and-Algorithms-with-Python | /Dynamic Programming/Longest Increasing Subsequence.py | UTF-8 | 1,083 | 4.03125 | 4 | [] | no_license | """
Longest Increasing Subsequence
Given an array with N elements, you need to find the length of the
longest subsequence of a given sequence such that all elements of
the subsequence are sorted in strictly increasing order.
Input Format
Line 1 : An integer N
Line 2 : Elements of arrays separated by spaces... | true |
85e70bde35bbaddfd0d1cc0e9ce7304fe89361a1 | t1191578/moniteredit | /code/app.py | UTF-8 | 941 | 2.765625 | 3 | [
"ISC",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"Zlib",
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-ssleay-windows",
"BSD-3-Clause",
"OpenSSL",
"MIT"
] | permissive | from flask import Flask ,request
from flask_restful import Resource, Api
app =Flask(__name__)
api = Api(app)
cluster = []
class Student(Resource):
def get(self, name):
node = next(filter(lambda x:x['name'] ==name, cluster), None)
#for node in cluster:
# if node['name'] == name:
... | true |
4b5e0547a6b151526da686fd8179aebfbeaea5c8 | Python-aryan/Hacktoberfest2020 | /Others/substitution_cipher.py | UTF-8 | 1,226 | 4.5 | 4 | [] | permissive | # Python program to demonstrate
# Substitution Cipher
import string
# A list containing all characters
all_letters= string.ascii_letters
"""
create a dictionary to store the substitution
for the given alphabet in the plain text
based on the key
"""
dict1 = {}
key = 4
for i in range(len(all_letters)):... | true |
109c6c8ce1ea3e379919c5c5b7467ae10c470e60 | deval-patel/csc148_labs | /oh_misc/demo1.py | UTF-8 | 2,114 | 3.796875 | 4 | [
"MIT"
] | permissive | def bigoh3(n: int) -> int:
res = 0
i = 0
# Outer loop goes n^2 times
# While i < n^2
while i < n * n:
# This is the only one which happens
if i % 148 == 0:
j = 1
# O(n)
while j < n:
res = res + j # This doesnt affect complexity, O(... | true |
8d4c24fc6ea9ca29bc905bdf75541dd24e9c951e | Make-School-Courses/BEW-1.1-RESTful-and-Resourceful-MVC-Architecture | /Lessons/09-ERDs-Resource-Associations-and-MongoDB/demo/juggling.py | UTF-8 | 409 | 2.59375 | 3 | [] | no_license | from pymongo import MongoClient
client = MongoClient()
client.drop_database('test_database')
db = client.test_database
new_post = {
'title': 'Mastering the Three Ball Cascade',
'subreddit': 'Jugglers Anonymous'
}
db.Posts.insert_one(new_post)
# Return all Posts in a specific subreddit:
juggling_posts = db.Post... | true |
7c385930117bee0eab44fef30adef03da4ad52f7 | zarkle/code_challenges | /leetcode/merge_two_bt.py | UTF-8 | 2,125 | 4 | 4 | [] | no_license | # https://leetcode.com/problems/merge-two-binary-trees/description/
# https://leetcode.com/articles/merge-two-binary-trees/
# runtime 68 ms, 68%
# runtime 88 ms, 74%; memory 13.4 MB, 30%
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.l... | true |
b93f111949ffc7fe758edd9a5808a3340fd6a9f2 | caitaozhan/ExamWebRegister | /WebRegister/register/models.py | UTF-8 | 1,411 | 2.859375 | 3 | [] | no_license | from django.db import models
from django.utils import timezone
class ExamInfoModel(models.Model):
subject = models.CharField(verbose_name="科目名称", max_length=30)
exam_time = models.DateTimeField(verbose_name="考试开始时间")
exam_time_end = models.DateTimeField(verbose_name="考试结束时间", default=timezone.now)
reg... | true |
321b286dbd013ad5103e3aaaedead81b0a2424c8 | mtlock/CodingChallenges | /CodingChallenges/HackerRank:LeetCode/quicksort1-partition.py | UTF-8 | 371 | 2.90625 | 3 | [] | no_license | def partition(l):
p=l[0]
left=[]
#equal=[p]
right=[]
for char in l:
if char<p:
left.append(char)
elif char>=p:
right.append(char)
string=' '.join(str(x) for x in left)+' '+' '.join(str(x) for x in right)
return string
m = input()
ar = [int(i) for i i... | true |
c1d70cc7fe98a7ce347d698e21be40b14a9996a8 | mbelalsh/Data_Structures_Algorithms_Specialization_Coursera | /2_Data_Structures/Assignments/week4_binary_search_trees/3_is_bst_advanced/Submission.py | UTF-8 | 777 | 3.171875 | 3 | [] | no_license | #!/usr/bin/python3
import sys, threading
sys.setrecursionlimit(10**7) # max depth of recursion
threading.stack_size(2**27) # new thread will get stack of such size
def IsBinarySearchTree(k, mini, maxi):
if not k in tree:
return True
if tree[k][0] < mini or tree[k][0] > maxi:
return False
return IsBinary... | true |
548e319b2eb0af55b08cedbd972a8f989533979c | jesusrugarcia/Learn | /boston_ejemplo.py | UTF-8 | 680 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 10 05:18:01 2020
@author: tachi
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_boston
import reglin
boston = load_boston()
X = np.array(boston.data[:, 5])
X = np.array([X, boston.data[:, 0]])
#X = np.array(boston.data[:, 0])
Y= ... | true |
3a9d5e6367da8662b0da6f52a2e9266de78c1abd | arsaikia/Data_Structures_and_Algorithms | /Data Structures and Algorithms/Python/LeetCode/Isomorphic Strings.py | UTF-8 | 867 | 4.15625 | 4 | [] | no_license |
'''
Isomorphic Strings https://leetcode.com/problems/isomorphic-strings/
Given two strings s and t, determine if they are isomorphic.
Two strings are isomorphic if the characters in s can be replaced to get t.
All occurrences of a character must be replaced with another character while preserving... | true |
b9e25d5ff4159b08e287c4c50cb7c1b2eff7a90f | Imperative2/decision_tree | /utils/split_dataset.py | UTF-8 | 927 | 2.890625 | 3 | [] | no_license |
from sklearn.model_selection import train_test_split
from models import PreparedSet
class SplitDataset:
@staticmethod
def split_sets(raw_data):
features_labels = raw_data[0]
raw_data = raw_data[1:]
x_train, x_test = train_test_split(raw_data, test_size=0.3)
train_set_class... | true |
668d6fb3e028bfac65c0a2e9d68af3dab94165f3 | lzy-v/MuZero-PyTorch-1 | /naive_tree_search/Agent.py | UTF-8 | 1,949 | 2.71875 | 3 | [] | no_license | import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from Networks import Representation_Model, Dynamics_Model, Prediction_Model
from naive_search import naive_search
device = torch.device("cuda:0")
dtype = torch.float
class MuZero_Agent(nn.Module):
... | true |
36ed6d12cd62d9cbd2d66d07847496634b675ada | GSamuel/DataMining | /Datamining_assign/Assignment 1/assignment_1.2.py | UTF-8 | 564 | 3.171875 | 3 | [] | no_license | """
Created on Thu Sep 18 09:26:20 2014
@author: Gideon
"""
from xlrd import open_workbook
from pylab import *
import numpy as np
file = 'Data/nanonose.xls'
book = open_workbook(file)
sheet = book.sheet_by_index(0) #select the correct sheet
#print sheet.col_values(1,2)
#print sheet.cell(0,0).value == 'Nanonose'
... | true |
f76f89739f073bae9a7b524299164d50de2c27e0 | Rikuo-git/AtCoder | /ABC/abc038/d/main.py | UTF-8 | 293 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python3
import bisect
(n, ), *s = [[*map(int, i.split())] for i in open(0)]
s.sort(key=lambda x: (x[0], -x[1]))
seq = [i[1] for i in s]
LIS = [seq[0]]
for i in seq:
if i > LIS[-1]:
LIS.append(i)
else:
LIS[bisect.bisect_left(LIS, i)] = i
print(len(LIS))
| true |
11d3284f2317c868efeb1e6d1bdca5925e55a38c | tsburke86/OptionStalker | /stocksOptions.py | UTF-8 | 6,554 | 3.375 | 3 | [
"MIT"
] | permissive | # Stock Stalker Pro Options
class Trade():
def __init__(self, ticker, openPrice, closePrice, optionType='NA'):
self.__list = [ticker, openPrice, closePrice, optionType]
self.__open = openPrice
self.__close = closePrice
self.__ticker = ticker.upper()
self.__type = optionType... | true |
3ae3ca29b117495323cc281957a058914ff60ccf | williamSYSU/TextGAN-PyTorch | /metrics/bleu.py | UTF-8 | 4,258 | 2.9375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# @Author : William
# @Project : TextGAN-william
# @FileName : bleu.py
# @Time : Created at 2019-05-31
# @Blog : http://zhiweil.ml/
# @Description :
# Copyrights (C) 2018. All Rights Reserved.
from multiprocessing import Pool
import nltk
import os
import random
... | true |
35ad9b376da000125d4cfc46b9e0a8d929525353 | babaliauskas/Python | /SQLite/friends.py | UTF-8 | 485 | 2.828125 | 3 | [] | no_license | import sqlite3
conn = sqlite3.connect('SQLite/my_friends.db')
c = conn.cursor()
# c.execute(
# "CREATE TABLE friends (first_name TEXT, last_name TEXT, closeness INTEGER);")
# insert_query = '''INSERT INTO friends
# VALUES ('Lukas', 'Babaliauskas', 2)'''
# first = 'Modestas'
# query = f"INSERT INT... | true |