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 |
|---|---|---|---|---|---|---|---|---|---|---|
6c138522299b1b78e000804e0bed3b2820dbd89c | matheuscordeiro/random-problems | /Cracking the Coding Interview/Cap 8/8.3_magic_index.py | UTF-8 | 466 | 3.796875 | 4 | [] | no_license |
# Search binary algorithm
def find_magic_index(array, start, end):
if start > end:
return -1
middle = int((start + end) / 2)
if array[middle] == middle:
return middle
elif array[middle] < middle:
return find_magic_index(array, middle + 1, end)
else:
return find_mag... | true |
f4f74a4d4fee2811fee1caa69416b97b83a77e38 | CoderUper/KNN | /test.py | UTF-8 | 2,566 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 19 11:28:42 2020
@author: 金祝光
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from collections impor... | true |
cab913187174c83208e77965bcc0c7845e3e7f04 | BressettJ21/Digital-Art | /FaceBlend.py | UTF-8 | 2,766 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 21 12:31:24 2020
@author: jackb
"""
from PIL import Image, ImageFilter
import random
def getLists(images):
#Container for im objects
ims = []
ws = []
hs = []
pixelsList = []
i = 0
imagesUsed = ""
for image in images:
... | true |
ddb5ed69596e0c63c18ec3bbb4e6ab77b9b8760d | webclinic017/gcp-database-as-a-service-stock-markets | /data_service/config/exceptions.py | UTF-8 | 4,083 | 2.640625 | 3 | [
"MIT"
] | permissive | import typing
from werkzeug.exceptions import HTTPException
class DataServiceError(HTTPException):
"""
use this error to throw a custom error explaining something is wrong with the datastore
"""
code: int = 512
description: str = 'We have a problem connection to the Database'
def __init__... | true |
bb07391113c52f9450ba14a5e634ff0370ce0f08 | cog-imperial/suspect | /suspect/dag/vertices_list.py | UTF-8 | 2,285 | 3.21875 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2018 Francesco Ceccon
#
# 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.0
#
# Unless required by applicable law or agreed to in writ... | true |
732366e941f3547f231b3e3150f3f5a184de7cf8 | oumingyuan/machine | /tensorflowstudy/tensor/world.py | UTF-8 | 610 | 3.515625 | 4 | [] | no_license | import tensorflow as tf
# 创建两个占位 Tensor 节点
a = tf.placeholder(tf.float32)
b = tf.placeholder(tf.float32)
# 创建一个 adder 节点,对上面两个节点执行 + 操作
adder_node = a + b
# 打印三个节点
print(a)
print(b)
# 创建两个常量节点
node1 = tf.constant(3.2)
node2 = tf.constant(4.8)
# 创建一个 adder 节点,对上面两个节点执行 + 操作
adder = node1 + node2
print(adder)
# 运行一下,后面... | true |
6603a35b273a55696dcb9979c4c0bf8f6b395c8e | aaronywang/ucla_stats202a | /week1/week2 sweep function.py | UTF-8 | 4,417 | 3.921875 | 4 | [] | no_license | """
Stat 202A - Homework 1
Author:
Date :
Description: This script implements the sweep operator as
well as Gauss-Jordan elimination in both plain and
vectorized form
INSTRUCTIONS: Please fill in the missing lines of code
only where specified. Do not change function names,
function inputs or outputs. You can add ex... | true |
98999c4fb7c5577707946c65f2e2adf309fe4ab6 | jmeckley/python_learning_exercises | /demos/roman_numeral/tests_MainView.py | UTF-8 | 990 | 2.734375 | 3 | [] | no_license | from django.core.urlresolvers import reverse
from django.test import TestCase
from .views import MainView
from .models import RomanNumeralForm
class MainViewTests(TestCase):
def setUp(self):
self.sut = MainView()
self.form = RomanNumeralForm(... | true |
e5c7f21f0fdb41ae48ba444347bb847f204c0e84 | spel-uchile/balloon_experiment | /sw/raspberry/aprs/pg_scripts/read_test.py | UTF-8 | 2,016 | 2.65625 | 3 | [] | no_license | import psycopg2
import time
#from gpiozero import *
#ch_select1 = LED(4)
#ch_select2 = LED(17)
#ch_select1.off()
#ch_select2.off()
#time.sleep(60)
#import RPi.GPIO as GPIO
#GPIO.setmode(GPIO.BCM)
#GPIO.setup(4, GPIO.OUT)
#GPIO.setup(17, GPIO.OUT)
#GPIO.cleanup()
#time.sleep(5)
try:
connection = psycopg2.connect(u... | true |
45a77af227307ce18cd02a30e987d56f1c7fefb2 | KeenanMcConkey/trashbot_ai | /bin/test_navigator_depth.py | UTF-8 | 2,685 | 2.921875 | 3 | [] | no_license | #!/usr/bin/python2
from __future__ import print_function
import roslib
import rospy
from geometry_msgs.msg import Twist
from darknet_ros_msgs.msg import BoundingBoxes
from sensor_msgs.msg import PointCloud2
class Navigator:
"""
Navigator class for trash bot
"""
def __init__(self):
# By default... | true |
801418429ee07b88cc9cbe565e5fbabe55b593fd | dannymas/hexdumptoexe | /bkptobin.py | UTF-8 | 683 | 2.875 | 3 | [] | no_license | #!/usr/bin/python2
import sys
import re
import string
if len (sys.argv) != 3:
print 'Usage: %s bkp exe' % sys.argv[0]
exit (1)
(progname, bkp, exe) = sys.argv
def is_valid_hex (hex_str):
if len (hex_str) != 4:
return False
for c in hex_str:
if c not in string.hexdigits:
... | true |
db6a705b176a8a4c02636be1bcb54272d215013d | Andrey-Raspopov/Carnatic_FSM | /carnatic_fsm/carnatic_fsm/simulate_fsm.py | UTF-8 | 8,959 | 3.09375 | 3 | [] | no_license | '''
Includes code to read a finite-state-machine assocaited with a raagam
simulated it using a random see and produce a music21 stream object
Author: Madhavun Candadai
Created: Jan 2018
'''
import sys
import pickle
import numpy as np
import music21
from config import config
def simulate_fsm(raagam,taalam,num_avartana... | true |
57b44e3af3cf7b893f06958c6631092247d7506f | JacobDowney/SDSU_Schedule_Planner | /Databases/create_databases.py | UTF-8 | 2,629 | 2.953125 | 3 | [] | no_license | import sqlite3
#period = "p_20204" # this is fall 2020
# Period is not entered by the user so no need to protect against SQL Injections
def CreateDatabses(period):
# Database file
db_file = f"./Databases/{period}.db"
# SQL Create Table Instruction
conn = sqlite3.connect(db_file)
cursor = conn.cur... | true |
14fcd887b3f972c0c81821cd92cf097bcdd96c1c | kedar14/geomag-algorithms | /geomagio/processing/observatory.py | UTF-8 | 8,051 | 2.515625 | 3 | [
"LicenseRef-scancode-public-domain",
"CC0-1.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | import os
from typing import List, Optional
import numpy
from ..algorithm import (
Algorithm,
AdjustedAlgorithm,
AverageAlgorithm,
DeltaFAlgorithm,
SqDistAlgorithm,
XYZAlgorithm,
)
from ..edge import EdgeFactory, MiniSeedFactory
from ..Controller import Controller, get_realtime_interval
from .... | true |
b126e00aa2cda1d0eb3d4d475f05bb877b0bb92e | kk-deng/Text-File-Parser | /parser.py | UTF-8 | 4,482 | 3.890625 | 4 | [] | no_license | def export_tuples(filepath) -> tuple:
"""
Assumption:
Here we assume that the file has the first line as the first question,
and it ends with a "\n" character.
The whole file ends with the last answer not "\n".
Each question/answer has a "\t" tab character between number and content.
Questi... | true |
79159f85a1240c9013629e54e164a492ff117d05 | JYleekr847/python_summer | /Chapter2/Chapter2_String.py | UTF-8 | 88 | 3.171875 | 3 | [] | no_license | a = 'py'
print(a*3)
a = a + 'thon'
print(a[0], a[5], a[0:1], a[1:4], a[:2], a[-2:])
| true |
6b54649630bbbfccd41088f2e03464ab59bfebbf | Tanych/CodeTracking | /380-Insert-Delete-GetRandom-O(1)/solution.py | UTF-8 | 1,592 | 3.984375 | 4 | [
"MIT"
] | permissive | class RandomizedSet(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.valset=[]
# record the index to remove
self.dictional={}
self.index=0
def insert(self, val):
"""
Inserts a value to the set. Returns true i... | true |
ec89afb796b11a4fd0dd115be97bf8209eb424aa | jonas99y/hslu-pren-32 | /src/states/drivetopictogramstate.py | UTF-8 | 3,151 | 2.921875 | 3 | [] | no_license |
from time import sleep
from drive.distancedriver import DistanceDriver
from hal.distancesensor import DistanceSensor
from hal.led_driver import Piktogram
from drive.mecanum_driver import Direction
from states.context import Context
from states.state import State
from getposition import get_position
pictos = {
Pi... | true |
f6434d6eccf9c80ed1e84ed49906d06a07d27255 | bossjones/openheating | /openheating/sink.py | UTF-8 | 1,250 | 2.875 | 3 | [] | no_license | from .thinking import Thinker
import logging
class Sink(Thinker):
def __init__(self, name, thermometer, hysteresis):
self.__name = name
self.__thermometer = thermometer
self.__hysteresis = hysteresis
self.__source = None
self.__thinking = False
def name(self):
... | true |
b944c07fe8edcf2772abd59fd19dbc47c66978e6 | peggypan0411/CREST-iMAP | /cresthh/UQ/optimization/pyevolve/GPopulation.py | UTF-8 | 10,321 | 3.375 | 3 | [] | no_license | """
:mod:`GPopulation` -- the population module
================================================================
This module contains the :class:`GPopulation.GPopulation` class, which is reponsible
to keep the population and the statistics.
"""
import Consts
from FunctionSlot import FunctionSlot
from Stat... | true |
757561a712817637e4ed8606863076259be38ece | MAHESHRAMISETTI/My-python-files | /time.py | UTF-8 | 311 | 3.234375 | 3 | [] | no_license | # num=int(input('enter the value'))
# for a in range (1,11):
# print(num,'x',a,'=',num*a)
# import time
# print(dir(time))
# print(time.asctime())
# import math
# print(dir(math))
# print(math.factorial(5))
import calendar
# print(dir(calendar))
print(calendar.calendar(2018,8))
#
# print('dasdasd')
| true |
dfac1bc4f3022d8338ebd345216c101873afe8ef | computational-group-the-golden-ticket/Machine-Learning-Music_Project | /main.py | UTF-8 | 2,534 | 2.546875 | 3 | [
"MIT"
] | permissive | import pickle
import numpy
from midi_to_statematrix import *
import multi_training
import model
import os
def gen_adaptive(m, pcs, times, keep_thoughts=False, name="final"):
xIpt, xOpt = map(lambda x: numpy.array(x, dtype='int8'),
multi_training.getPieceSegment(pcs))
all_ou... | true |
00217d2315ba8449f7e3d8f99c7915127bab886a | ysuter/gbm-robustradiomics | /preprocessing/N4biasfieldcor.py | UTF-8 | 1,598 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import SimpleITK as sitk
import os
import glob
def main(patdir: str):
corrector = sitk.N4BiasFieldCorrectionImageFilter()
# loop over all subdirectories / timepoints in current patient folder
with os.scandir(patdir) as it:
for entry in it:
if e... | true |
80cc5131e2f9b64d5cc57fb288004154c0cbc407 | changhwi211/Algorithm | /데사스/19.01.11/main_quiz_solution.py | UTF-8 | 404 | 3.015625 | 3 | [] | no_license | def my_accum(arr):
result = 0
for el in arr:
result += el
yield result
def solution(n, queries):
B = [0 for _ in range(n+1)]
for start, end, k in queries:
B[start-1] += k
B[end] -= k
print(list(my_accum(B)))
return max(my_accum(B))
n=5
queries = [
[1, 2,... | true |
f17369af0aaa4826d15af5a03455a82233c4f185 | hungwii/Meta_DataPrepro | /Analysis_pr.py | UTF-8 | 4,923 | 2.546875 | 3 | [] | no_license | #-*- coding: UTF-8 -*-
from sklearn.metrics import precision_recall_curve
from sklearn.metrics import roc_curve, auc
import matplotlib.pyplot as plt
from extract import single_column
from scipy import integrate
import os
'''
这个主函数是从我生蚝好的多个文件中提取出样本画PRC
'''
#-------------------------参数设置---------------------------
fil... | true |
efb8e1e943bf9b17a5f37572b9897fb1fb621920 | mHooshdar/MachineLearning-A-Z | /Part 2 - Regression/04 - Simple Linear Regression/04_simple_linear_regression.py | UTF-8 | 1,234 | 3.140625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import LabelEncoder, OneHotEncoder, StandardScaler
from sklearn.compose import ColumnTransformer
from sklearn.model_selection import train_test_split
from sklearn.linear_model impor... | true |
94adaa37b88feec3a1e38c03a26d83b5d2d5a31a | rostyboost/sqpug | /python/sqpug/__init__.py | UTF-8 | 2,585 | 2.828125 | 3 | [
"MIT"
] | permissive | """Waiting for a good D->Python wrapper...."""
from itertools import chain
import os
import shutil
import subprocess
import tempfile
import numpy as np
class Model(object):
def __init__(self, bits, loss):
self.intercept = 0.0
self.weights = np.zeros(1 << bits)
self.loss = loss
def ... | true |
b2971db900109c7e172eb2b602a5e3a094af7708 | quadrama/DramaNLP | /de.unistuttgart.ims.drama.io.core/src/main/python/validate_schematron.py | UTF-8 | 770 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
The script validates an input xml/tei-file against an input iso-schematron
schema, using lxml. Prints 'True' to the console if the document is valid,
'False' and the corresponding lxml-Exception otherwise.
Usage: validate_schematron.py schema-file xml/tei-file
"""
f... | true |
ab9f3ec54f4e8dee0bf5778683750642949e0081 | mengxingshifen1218/Safe_Occlusion_Aware_Planning | /risk_analysis/reachable_set.py | UTF-8 | 8,320 | 2.640625 | 3 | [] | no_license | from matplotlib import pyplot as plt
from shapely.geometry import Polygon, LineString
from shapely.affinity import affine_transform
import numpy as np
from datetime import datetime
def double_integrator_reachable_tube(v0_min, v0_max, delta_t_min, delta_t_max, a_max, v_min, v_max, x_extend=0, n=20, BRS = False, oppo =... | true |
1084b47229457fffccd3cd38f5fb725bf11a6ff1 | Ivanchyshyn/SearchEngine | /web_index.py | UTF-8 | 1,624 | 3.609375 | 4 | [] | no_license | """
Building index
"""
class WebIndex:
"""
Indexing pages in form 'keyword - URLs'
"""
def __init__(self):
self.index = {}
def add_to_index(self, keyword, url):
if not keyword:
return
if keyword in self.index:
if url not in self.index[ke... | true |
fb296dc134c189d26b341321ea454f2c34429960 | Aasthaengg/IBMdataset | /Python_codes/p02936/s502233310.py | UTF-8 | 673 | 2.78125 | 3 | [] | no_license | import sys
sys.setrecursionlimit(1000000)
def val_add(i,con,val):
if con[i] :
for j in con[i]:
val[j]+=val[i]
val_add(j,con,val)
def tree(i,con):
if not con[i]: pass
else :
for j in con[i]:
con[j].remove(i)
tree(j,con)
def main():
n,q=ma... | true |
44222156a053f017525ff5d433e078953789547c | cgpitta/PythonPractice | /#pythonquestion2_norecursion.py | UTF-8 | 495 | 4.53125 | 5 | [] | no_license | #write a program that computes the factorial of a given number without the user of recursion
#print results in a comma-separated sequence on a single line
def factorial(num):
result = num
while num >0:
if num > 3:
result=result*num-1
print(str(result)+',', end=" ")
elif num>2:
result=result*num-1
... | true |
7251609a7fb113e66a94bbd91325c5cb15aae958 | DP-3T/gaenlib | /impl-python/keygen.py | UTF-8 | 1,216 | 2.546875 | 3 | [] | no_license | """
Key Generation functions
All devices sharing the same TEKRollingPeriod roll TEKs at the same time — at
the beginning of an interval whose ENIntervalNumber is a multiple of
TEKRollingPeriod.
"""
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.hkdf import HKDF
from cryptog... | true |
a5cdba0489b937eb75076dcfaa9802020b55e014 | kuzeygh/crypto | /set2/c9.py | UTF-8 | 518 | 2.6875 | 3 | [] | no_license | import unittest
from cryptopals import pkcs7
class TestPkcs7(unittest.TestCase):
def testBlockSize20(self):
text = b'YELLOW SUBMARINE'
expected = b'YELLOW SUBMARINE\x04\x04\x04\x04'
actual = pkcs7(text, 20)
self.assertEqual(expected, actual)
def testBlockSize6(self):
... | true |
80b71596a3853666709658e2ed4ce0ac47ec3e38 | Esen9248/Python-Academy | /Examples/January/22.01.18/02.py | UTF-8 | 282 | 3.484375 | 3 | [] | no_license | f = open(input('FileName: '))
try:
# data = f.readlines()
# print(data)
data = f.readline()
print(data)
f.seek(0) # return to the begining of the file
data = f.readline()
print(data)
except Exception as e:
print('Error caught', e)
finally:
f.close()
print('Closed') | true |
fa9e04d6e53e1a04c7a62f789ed791cec6736627 | hopehappy92/sublecture | /07_lecture.py | UTF-8 | 2,443 | 2.78125 | 3 | [] | no_license | # import sys
# sys.stdin = open('07_lecture_midavg.txt')
# # def sort(data):
# # max = 0
# # for i in range(len(data)):
# # if data[max] < data[i]:
# # data[i], data[max] = data[max], data[i]
# # max = i
# T = int(input())
# for tc in range(1, T+1):
# data = li... | true |
3d2ae4a25767d53b9a46a3e7ed5ab17b92752074 | gautam-ergo/Big-Data-Analytics | /task2.py | UTF-8 | 918 | 2.59375 | 3 | [] | no_license | from __future__ import print_function
import sys
from operator import add
from pyspark import SparkContext
def main():
sc = SparkContext(appName="Ass1")
lines = sc.textFile(sys.argv[1], 1)
#Split the csv file using ","
taxi = lines.map(lambda x: x.split(','))
filtered_taxi = taxi.filter(lambda x:... | true |
ef3af54c1cc30dcffd4fca90722220b1694b71aa | pawarspeaks/HacktoberFest_2021 | /python/speak.py | UTF-8 | 324 | 2.546875 | 3 | [
"MIT"
] | permissive | from gtts import gTTS
import os
def speak(str):
#from win32com.client import Dispatch
#from toga-win32.client import Dispatch
language = 'en'
speech = gTTS(text = str, lang = language, slow = False)
speech.save('text.mp3')
os.system('start text.mp3')
if __name__ =='__main__':
b=input("ENTER A STRING:")
spea... | true |
75139b8b6f4c90d0a1937ea22755d23f04a0e6da | littlejkim/naver_toron | /app.py | UTF-8 | 5,202 | 2.921875 | 3 | [] | no_license | import webbrowser
import re
from selenium import webdriver
regexp = re.compile('[^0-9a-zA-Z]+')
options = webdriver.ChromeOptions()
options.add_argument('headless')
browser = webdriver.Chrome(
'C:/Users/NHWM/Downloads/chromedriver', chrome_options=options)
countries_list = "m_gtsnation.txt"
stock_list = "m_gtss... | true |
0c51b6956bdcc4f8145825fb17ee72e84647427e | minhthangtkqn/PythonWorkSpace | /Basic_Machine_Learning/test.py | UTF-8 | 485 | 3.078125 | 3 | [] | no_license | import math
import numpy as np
if __name__ == '__main__':
print math.log(3)
x = [3, 2, 6, 5, 9, 5, 8]
print np.array(x).shape
for number in x[:3]:
print number
mh = [[1, 5, 9], [5, 8, 7]]
print np.amax(mh)
print '----------'
print mh[1][2]
abc = [1,5,6,8,4]
# abc.append... | true |
2208cb0b0f9ace8aed4265aed80b94c60050723d | chea-young/Financial-Statistics-Practice-Using-Python | /6주차/파이썬 기초 -23.py | UTF-8 | 1,258 | 3.609375 | 4 | [] | no_license | #%% 참고 교재: 데이터 분석을 위한 판다스 입문 p.76 ~ p.79
#%% 3-1. 데이터 피클로 저장하기: to_pickle()메서드
# 피클로 데이터를 저장하면 작은 용량으로 데이터 저장 가능
import pandas as pd
scientists=pd.read_csv('scientists.csv')
names=scientists['Name']
print(names)
print('=======================================================')
names.to_pickle('scientists_names_series.p... | true |
4181a23f5f3c037774de87e9f1896ee7b7af539b | ziggyman/python | /hash-report.py | UTF-8 | 2,354 | 2.6875 | 3 | [] | no_license | from datetime import datetime,time
from matplotlib import pyplot as plt
import csvFree
import csvData
csvFileIn = '/Users/azuri/daten/uni/HKU/website/reports/04Mar2020/hash-userlog.csv'
userList = '/Users/azuri/daten/uni/HKU/website/reports/04Mar2020/hash-userlist.csv'
startDate = '2019-03-04'
data = csvFree.readCSV... | true |
cdc28d69e0c32178d84ed04d8abb47f95d0945fe | alexendrios/automacao | /python/tau-python/venv/004_condicionais.py | UTF-8 | 175 | 3.25 | 3 | [] | no_license | def soma(a,b):
return a+b
def imorime_true():
pront("true")
def imprime_false():
print("false")
if soma(5,2) < 6:
imorime_true()
else:
imprime_false()
| true |
b535379117034d9a20448ba64fe84514df765007 | jamesfebin/STL-Crimelog | /crimelog/crimelog/helpers.py | UTF-8 | 660 | 2.5625 | 3 | [
"MIT"
] | permissive | """
Helper functions for scrapy project
dupCheck(): Delete duplicate entries.
Called after each reactor.run() in crimelog.py
"""
import sys
sys.path.insert(0, '/home/amirkurtovic/crimeline')
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'crimeline.settings'
from storylist.models import Story
from scrapy.cont... | true |
75569e72fe7ad8b3f782b0c6f3ac357245388b7e | AirikWarren/dunderhead-webhook | /main.py | UTF-8 | 2,558 | 2.796875 | 3 | [
"MIT"
] | permissive | '''idk set this up as a cron job or something'''
from super_secret_shit import SLACK_WEBHOOK_URL, DISCORD_WEBHOOK_URL, INVITE_URL
import rss_parse
from datetime import datetime
import random
import requests
from slack_sdk.webhook import WebhookClient
greetings = [
"Bonjour",
"Hola",
"Hello",
"Good da... | true |
bbf12030c61159b077898519360c499e819e3a46 | open-game/Hip-Hop-Seq2Seq | /seq2seq/data/split_data.py | UTF-8 | 884 | 2.75 | 3 | [] | no_license | import pandas as pd
src_df = pd.read_csv("x.txt", header=None, names=["src"])
tgt_df = pd.read_csv("y.txt", header=None, names=["tgt"])
pair_df = pd.concat([src_df, tgt_df], axis=1)
pair_df = pair_df.sample(frac=1).reset_index(drop=True)
train_df = pair_df.iloc[:-200, :]
dev_df = pair_df.iloc[-200: -100, :]
test_df =... | true |
f1592ff486c17ce97ae7d33ca2abe181c7a5d076 | marcinsieciechowicz/PycharmProjects | /python/tuple.py | UTF-8 | 362 | 3.125 | 3 | [] | no_license | T = (1, 'a', True, [1, (22,33)])
U = ('xyz', 789)
print(T[-1][1][0])
# T.append(5) # nie wolno
# T[0] = 100 # nie wolno
Z = T + U # dodawanie dwoch tupli do siebie
klient = (765432, "Jan", "Kowalski", 'jan@o2.pl', 35)
id = klient[0]
name = klient[1]
id, name, surname, email, age = klient # tuple unpack - rozpakowy... | true |
9f12525dc249c6aeb4d2e9c00702d1e9e85ab978 | RowenWitt/Leet | /hash_table.py | UTF-8 | 3,116 | 3.59375 | 4 | [
"MIT"
] | permissive | class HashTableEntry:
"""
Linked List hash table key/value pair
"""
def __init__(self, key, value):
self.key = key
self.value = value
self.next = None
# Hash table can't have fewer than this many slots
MIN_CAPACITY = 9
class HashTable:
"""
A hash table with 'capacity' buckets
that accepts string keys
... | true |
10921bd5714fdf2c71815b275f750877980668cb | murayama333/python2020 | /02_oop/ex/src/04_init/mysales/sale.py | UTF-8 | 221 | 3.578125 | 4 | [] | no_license | class Sale:
def __init__(self, price, count):
self.price = price
self.count = count
def calc(self):
return self.price * self.count
def print(self):
print(f"{self.calc():,d}")
| true |
19933a3c160a7859ad6d7b18c4c08660fdd2a534 | marza-pane/Indoorino | /application/widgets/devices.py | UTF-8 | 5,664 | 2.8125 | 3 | [] | no_license | from common.templates import *
class AnalogController(CanvasTemplate):
def __init__(self, parent):
CanvasTemplate.__init__(self, parent)
self.___ratio=0.7
self.___value=tk.IntVar()
self.___status=False
self.___flag_drag=False
self.buttons = dict()
self.li... | true |
491e7bbf1551a56d74506636ade78267226149f6 | GiuseppeCavallaro/2016.M3.TQF-ML.Credit.Card.Fraud | /creditcardfraud.py | UTF-8 | 413 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 26 16:14:59 2017
@author: Giuseppe
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df_creditcard = pd.read_csv('creditcard.csv', ",")
df_creditcard.head()
classes = pd.value_counts(df_creditcard['Class'], sort = True).sort_index()
classes.plot... | true |
c636c8eab5d556de3c42be41a830861e94381707 | gongzuozhe/word_count | /Django/functions.py | UTF-8 | 741 | 2.6875 | 3 | [] | no_license | # from django.http import HttpResponse
from django.shortcuts import render
def home(request):
# return HttpResponse('Hello world')
return render(request,'home.html')
def count(request):
user_text=request.GET['text']
count_len=len(user_text)
word_dict={}
for word in user_text:
if word ... | true |
5a133dca05ca8d01c5dc2460e2fa31013e019a14 | xavierloos/python3-course | /Basic/Classes/object.py | UTF-8 | 381 | 4.9375 | 5 | [] | no_license | # 1. Call dir() on the number 5. Print out the results.
dir(5)
# 2.Define a function called this_function_is_an_object. It can take any parameters and return anything you’d like.
def this_function_is_an_object():
return "Hello"
# 3.Print out the result of calling dir() on this_function_is_an_object.
# Functions... | true |
4ff5df48ff55460bc87c026a348ef49820c6d94d | alex-bailey1/data_engineering | /data_integration/data_integrate.py | UTF-8 | 5,739 | 3.21875 | 3 | [] | no_license | import pandas as pd
import math
import json
def read_data(filename):
data = pd.read_csv(filename)
return data
#group the rows into a dictionary, where each tract id is a list
def group_census_rows(data):
county_dict = {}
is_first = True
# print("data:")
# print(data)
for index, row ... | true |
12b75e47bb660837d2af4fe0603534b0ec7889e5 | hamza422/MicrostructureSegmentation | /Histogram_Approach/HistrogramApproch.py | UTF-8 | 4,382 | 2.609375 | 3 | [
"MIT"
] | permissive | import numpy as np
import cv2
from PIL import Image
import matplotlib
matplotlib.use("agg")
import matplotlib.pyplot as plt
from AugmentedImageData import AugmentedData
class HistrogramApproch:
color_Image=cv2.imread("Boundries.tif",0)
orignal_Image=cv2.imread("Boundries.tif",0)
output_image=cv2.imread("Boundr... | true |
def23783755125360a1ba2d869b2628066fd1774 | uwcms/FinalStateAnalysis | /PlotTools/scripts/shapes2hist.py | UTF-8 | 5,485 | 2.53125 | 3 | [] | no_license | #! /bin/env python
import os
import sys
import rootpy.plotting.views as views
import rootpy.plotting as plotting
from rootpy import io
from FinalStateAnalysis.MetaData.data_styles import data_styles
from FinalStateAnalysis.PlotTools.DifferentialView import DifferentialView
from fnmatch import fnmatch
from optparse imp... | true |
2a966182d0a85593ec394f8c600f478cf02ffb16 | 974steph/api.openbikes.co | /collecting/providers/velin.py | UTF-8 | 1,384 | 2.71875 | 3 | [] | no_license | import datetime as dt
import re
import requests
def stations(city):
# The city parameter is necessary so that everything works
response = requests.get('https://www.vel-in.fr/cartoV2/libProxyCarto.asp')
data = response.json()
return normalize(data)
def clean(s):
if s is not None:
s = s.l... | true |
5e874c4e8fa002b301dd02040dccdf3fd8a9cbce | UniBus/Server | /data_management/modules/gtfs/mobile/trips.py | UTF-8 | 3,779 | 2.828125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
#
# add_trips.py
#
#
# Created by Zhenwang Yao on 03/11/08.
# Copyright (c) 2008 Music Motion. All rights reserved.
#
## This module import trips.txt to table 'trips' in a sqlite database
#
# It take two parameters, as
# import_trips $dbName $cvsFile
#
# Thus, it imports $cvs... | true |
883ebba4b6af311ef62c86c49d47abea40748a6f | davidchenli/Text-Analysis | /Media Index Analysis.py | UTF-8 | 5,163 | 3.0625 | 3 | [] | no_license |
import os
import pandas as pd
import numpy as np
import re
from datetime import datetime
import matplotlib.pyplot as plt
from sklearn.decomposition import NMF
from numpy.linalg import svd
os.chdir("C:/Users/USER/Desktop/Text/")
#%%%% Function to deal with inconsistent date format
def day(x):
for i in formats:
... | true |
fe9768cacd99154c5107a3f7716c4bbce48058fb | kuoaid/kuoAidanAssignment11 | /test_utilities.py | UTF-8 | 3,139 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python3
import subprocess
import sys
import unittest
import signal
from typing import Optional
import os
import collections
TestResult = collections.namedtuple('TestResult', ['output', 'error'])
def runcmd(cmd, input_text=None):
splitcmd=cmd.split()
return subprocess.run(splitcmd, input=input_text,
... | true |
2cdf715fe34ea984fa53935c5de33c96b710c7b5 | shendel/hippyvm | /testing/objects/test_convert.py | UTF-8 | 3,380 | 2.984375 | 3 | [
"MIT"
] | permissive | import py
from hippy.objects.convert import _whitespaces_in_front
from hippy.objects.convert import convert_string_to_number
from hippy.objects.intobject import W_IntObject as Int
from hippy.objects.floatobject import W_FloatObject as Float
def test_whitespaces_in_front():
assert _whitespaces_in_front('') == 0
... | true |
877fc5242686d98d9aad52adeb70a1fdbc650c42 | jacksonhenry3/Speech_Bot | /generate_Speech.py | UTF-8 | 2,343 | 3.453125 | 3 | [] | no_license | from numpy import cumsum,max
from numpy.random import rand,seed
from re import findall#for regular expressions
seed(203)
class word_Graph(dict):
"""docstring for graph"""
def __init__(self,word_Array):
self.generate_Graph(word_Array)
def add_Edge(self,v1_Name,v2_Name,weight = 1):
self[v1_Name] = {v2_Name:weight... | true |
2e170bd82b9a7669baab74341f31797a14d1dac6 | VitaliyZakharkiv/shop | /parse_img.py | UTF-8 | 846 | 2.59375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup as BS
HEADERS = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
' (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36',
'accept': '*/*'
}
def url_product(url):
request = requests.get(url=url)
return reque... | true |
49d24cf317d13f3509aec22ce3e807a227476f22 | dochman-ato/Python-Basics | /12_IF_Statement.py | UTF-8 | 469 | 4.3125 | 4 | [] | no_license | #1
is_male = True
if is_male:
print("You are a male")
#2
is_male = True
is_tall = True
if is_male or is_tall:
print("You are a male or tall or both")
else:
print("You are NOT a male NOR tall")
#3
if is_male and is_tall:
print("You are a male and tall")
elif is_male and not is_tall:
print("You ar... | true |
fb83b5dd7b22cf9ed8de59ec15b80aa46a1a66a4 | cindy3124/Study_PythonWebFramework | /6.webpy_teacher/utils/file_upload.py | UTF-8 | 1,131 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import web
import os
def save_file():
x = web.input(filename={})
##测试代码
# web.debug(x['filename'].filename) # This is the filename
# web.debug(x['filename'].value) # This is the file contents
# web.debug(x['filename'].file.read()) # Or use a file(-like) obj... | true |
ea0c502b9433b4fbcac8e0a89c2e874a496198e5 | luozm/frog | /reference/ensemble_1.py | UTF-8 | 10,931 | 2.546875 | 3 | [
"MIT"
] | permissive | import os, sys
sys.path.append(os.path.dirname(__file__))
from common import *
from dataset.reader import *
#ensemble =======================================================
class Cluster(object):
def __init__(self):
super(Cluster, self).__init__()
self.members=[]
self.center =[]
de... | true |
6adc92b4e1fde3fc3ab0b3dc8b2714aa4e29ad5e | valentineisme/magna_aquae | /populate_entornos.py | UTF-8 | 1,102 | 2.515625 | 3 | [] | no_license | # coding: utf-8
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'magna_aquae.settings')
import django
django.setup()
import rbcapp.models.entorno
def populate():
add_entorno(variavel_entorno="Vegetação", cor="#033403")
add_entorno(variavel_entorno="Área Urbana", cor="#ba3acb")
add_entorno(v... | true |
48ebf22ecc8ed55fb271686170fb2393bee95dfc | Trietptm-on-Coding-Algorithms/synacor | /coins.py | UTF-8 | 204 | 3.390625 | 3 | [] | no_license | import itertools
def eqn(a):
return a[0] + a[1] * a[2] * a[2] + a[3] * a[3] * a[3] - a[4]
arr = [2, 3, 5, 7, 9]
for perm in itertools.permutations(arr):
if eqn(perm) == 399:
print perm
| true |
09d83871d8ee0c019f8a19d331d675f06139662c | huthanh89/iot-security-game-production | /game-server/levels.py | UTF-8 | 1,214 | 2.734375 | 3 | [] | no_license | import json
import os
_levels = []
# load all files in the level folder into _levels global var
def loadLevels(dir):
global _levels
with open(dir + '/levels.json') as f:
_levels = json.load(f)
for index, levelDir in enumerate(_levels):
with open(dir + '/' + levelDir + '/level.json') as f:
level = json.loa... | true |
21e12d4b20847ff14fec401041abde1968ebed43 | iklimah27/praxis-academy-1 | /novice/minggu-01/01-04/advanced_oop/multiple_inherintance.py | UTF-8 | 932 | 3.46875 | 3 | [] | no_license | # Parent class 1
class DataPekerja():
def __init__(self, name, uid):
self.name = name
self.uid = uid
# Parent class 2
class Job():
def __init__(self, pay, role):
self.pay = pay
self.role = role
#Class team leader mendapat turunan dari dua parent class
class TeamLe... | true |
1935ecf345f7f9c7ed75156579cba13691efbf9a | jaishivnani/DataStructuresInPython | /4Searchingalgorithmsbinarysearchusingrecursion.py | UTF-8 | 584 | 3.703125 | 4 | [] | no_license | pos = -1
def binarysearch(list,n,low,high):
if low > high:
return False
else:
mid = (low + high)//2
if list[mid] == n:
globals()['pos'] = mid
return True
else:
if list[mid] < n:
return binarysearch(list,n,mid+1,high)
... | true |
540f3ea33c9cfbb4fd5acc12474f81275183e6df | DenisRang/ICV-EmotionRecognition | /cnn.py | UTF-8 | 3,792 | 2.53125 | 3 | [] | no_license | import tensorflow as tf
from keras_preprocessing.image import ImageDataGenerator
from tensorflow import keras
from random import uniform
import numpy as np
from tensorflow.keras.initializers import RandomNormal
from tensorflow.python.keras.layers.normalization_v2 import BatchNormalization
from extract_data import loa... | true |
9b201d017df240fedc55505c7e78eee288270ced | Aasthaengg/IBMdataset | /Python_codes/p03003/s781811927.py | UTF-8 | 1,921 | 2.71875 | 3 | [] | no_license | def getN():
return int(input())
def getNM():
return map(int, input().split())
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(input()) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
return random.randint(ran1,... | true |
6cdab8b13eb7298414b33bbfe843015fbe8990b7 | LokeshKD/MachineLearning | /NLPwithML/wordEmbeddings/skip-gram.py | UTF-8 | 1,529 | 3.234375 | 3 | [] | no_license |
import tensorflow as tf
# Skip-gram embedding model
class EmbeddingModel(object):
# Model Initialization
def __init__(self, vocab_size, embedding_dim):
self.vocab_size = vocab_size
self.embedding_dim = embedding_dim
self.tokenizer = tf.keras.preprocessing.text.Tokenizer(num_words=self... | true |
34c1f9365368fc05411926ab4b27c4b5b1526c26 | alecacco/KDI-Project-2019-2020-Geospace | /models/script/Accommodations/cleanEncoding.py | UTF-8 | 1,375 | 2.796875 | 3 | [] | no_license | import sys
import os
import json
from postal.parser import parse_address
def get_value(key, collection):
for (v, k) in collection:
if k == key:
return v
return ''
def rm_main():
path = os.path.join(os.path.expanduser('~'), 'hotels.json')
outputFile = open("hotels.csv", "a")
h... | true |
5f08655a7532f32fd190f23153d241ea38cb7c18 | holayeah/andela-exercies-oop | /tests.py | UTF-8 | 1,424 | 3.359375 | 3 | [] | no_license | import unittest
class PersonTestCase(unittest.TestCase):
"""
Tests for the person class
"""
def test_person_is_created(self):
"""
tests for creating a person
"""
p = Person('firstname', 'lastname', [1, 1, 2016])
self.assertEqual(p.first_name, 'first_name')
... | true |
bd7605a34af1aec4c7a26faf5da8059bb9f2b996 | rfdmeshkath/web_map | /wmap_back_end/web_app/data_collector.py | UTF-8 | 661 | 3.109375 | 3 | [] | no_license | import requests
def dublin_bike_api():
"""
this function collects dublin bike station data from and api then normalize the data in a dictionary
:return: list of dictionary
"""
r = requests.get(
'https://api.jcdecaux.com/vls/v1/stations?contract=dublin&apiKey=a6c1b6c4bac2222a2b80e49abf91bbf... | true |
b23fdcc02e8d9b58aa33e7e53ef3c9c4ae9cd411 | kotsky/programming-exercises | /Array/Waterfall Streams.py | UTF-8 | 1,445 | 3.96875 | 4 | [] | no_license | '''
Return how many water will be on the last row
of the given matrix.
Promt: https://www.algoexpert.io/questions/Waterfall%20Streams
'''
# array = [
# [0, 0, 0, 0, 0, 0, 0],
# [1, 0, 0, 0, 0, 0, 0],
# [0, 0, 1, 1, 1, 0, 0],
# [0, 0, 0, 0, 0, 0, 0],
# [1, 1, 1, 0, 0, 1, 0],
# [0, 0, 0, 0, 0, ... | true |
f096c30b44d9103576a4a49cb77ded21b68faff4 | adamsellars/ass1 | /AraBCPR301Assignment1-master/relationshipfinder.py | UTF-8 | 1,126 | 2.921875 | 3 | [] | no_license | from Classmaker import NewClass
file = open("test4(myowncode).txt")
stuff = file.read()
file_data = stuff.split()
relationships = ["--", "o--"]
ClassFinder = NewClass("ClassFinder")
Controller = NewClass("Controller")
Poop = NewClass("Poop")
my_class_list = [ClassFinder, Controller, Poop]
def relations... | true |
c733cd83187518f7fb60d417056210e45f972ff8 | shuyuFranky/hackdata_GPA_predict | /hyperopt_opt.py | UTF-8 | 5,012 | 3 | 3 | [] | no_license | # -*- coding: utf8 -*-
# Run an XGBoost model with hyperparmaters that are optimized using hyperopt
# The output of the script are the best hyperparmaters
# The optimization part using hyperopt is partly inspired from the following script:
# https://github.com/bamine/Kaggle-stuff/blob/master/otto/hyperopt_xgboost.py
... | true |
651eb54b37bbf9a918d66e5d084f9d0d3b170d57 | dilipRathoreRepo/data_structures | /trees/binary_search_tree.py | UTF-8 | 3,691 | 4.40625 | 4 | [] | no_license | """
A binary search tree relies on the property that the keys less than parent are found in the left subtree and keys
greater than parent are found in the right subtree. This property holds true for each parent and a child. All keys
in the left of the root are less than the root. While all keys on the right of the root... | true |
2d365fd9e8f91b8cf86e2ae37518e90599e209c4 | HHoofs/DSB_KERAS | /neural_net.py | UTF-8 | 8,121 | 2.75 | 3 | [] | no_license | import os
import keras.backend as K
import tensorflow as tf
from keras.callbacks import ModelCheckpoint, TensorBoard, ReduceLROnPlateau
from keras.layers import Input, Conv2D, MaxPooling2D, Dropout, Conv2DTranspose, concatenate
from keras.models import Model
from keras.optimizers import Adam
import generator
def we... | true |
8279bbb822a7a61d6c811635135e5d672a2a6c3b | sboxberg/KUBootCamp | /Python HW 3/PyPoll/main.py | UTF-8 | 1,718 | 3.296875 | 3 | [] | no_license | import os
import csv
csvname = input ("What .csv file do you want to analyze? ")
electiondata_csv = os.path.join("Resources",csvname)
election_results = {}
with open(electiondata_csv, newline="") as csvfile:
csv_reader = csv.reader(csvfile, delimiter=",")
header = next(csv_reader)
for row in csv_reader... | true |
231b21475308ab4301f1c6b9ccbdd0cb4fcffb19 | roeyashernielsen/eeproj | /statistics/trades_statistics.py | UTF-8 | 3,494 | 3.125 | 3 | [] | no_license | from utils.enums import STOCK_DATA_COLUMNS as COLUMNS
from .trade import Trade
import ipdb
"""
This file liable for the statistics calculations of each trade among all the trades that been done on stock.
Those trades are represented by the stock data table post the processing progress (shrunk table contains only rows
... | true |
8ca91cbc19aea17a755d4c369782579f8ae3d7dd | devTreasure/cs556_A2 | /ReadGraph3.py | UTF-8 | 3,693 | 2.96875 | 3 | [] | no_license | __author__ = 'Bhavin.Parekh'
import networkx as nx
import matplotlib.pyplot as plt
import timeit
test_file = open(r'edges.csv','r')
node_list=[]
edge_list=[]
#collecting unique nodes
# with open(r'edges.csv','r') as csv:
# for r in csv:
# edge_list.append([r[0],r[2]])
# if not node_list.__contains... | true |
454ea3a846e27ae1de3136737cbdcdfd56e2fee9 | Preethikoneti/Python | /Algorithms/highesh_rpod.py | UTF-8 | 983 | 3.296875 | 3 | [] | no_license | import sys
def highest_product(list_of_ints):
size = len(list_of_ints)
if size == 0:
return 0
first_max = -sys.maxsize-1
second_max = -sys.maxsize-1
third_max = -sys.maxsize-1
first_min = sys.maxsize
second_min = sys.maxsize
for value in list_of_ints:
if valu... | true |
298f97f59a601f55781712d8b64704479bd8fa62 | Raymond0620/Interview | /算法笔试/wangyi/2.py | UTF-8 | 398 | 2.921875 | 3 | [] | no_license | #coding=utf-8
# 本题为考试多行输入输出规范示例,无需提交,不计分。
import sys
if __name__ == "__main__":
# 读取第一行的n
# t = int(sys.stdin.readline().strip())
t = 1
for i in range(t):
result.sort()
if nums[-1] < nums[-2] + nums[-3]:
print("YES")
else:
print("NO")
# 核心点在于先将result排序 | true |
1dd14d7d5d4de9b6679545797059fa6afd75e967 | jbarba87/wave_equation_python | /test_function.py | UTF-8 | 173 | 2.9375 | 3 | [] | no_license | import numpy as np
def cos_t0(data):
# Return the cos of the function
t = .5 - .5*np.cos(2*np.pi*data/(data[-1]))
return t
def sin_t0(data):
return np.sin(data)
| true |
dd9f182a4f525ba63415dd4d1ad763f5e9022f9e | hyunwoo-song/TOT | /algorithm/day24/selection.py | UTF-8 | 293 | 2.734375 | 3 | [] | no_license | def Sel(list):
if not list:
return
min_l = 0x7FFFFFFF
min_i = 0
for i in range(len(list)):
if list[i]< min_l:
min_l = list[i]
min_i = i
R.append(list.pop(min_i))
Sel(list)
L = [8, 4 ,3 ,11 ,2, 50]
R = []
Sel(L)
print(R)
| true |
17a98553ca430b3c411551449d1940c914156e04 | Sho1981/NLP-with-Python-chapter4 | /ex15.py | UTF-8 | 571 | 3.625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import nltk
import re
import pprint
def print_freq_words(text):
"""
Print frequency of each word in text.
Type of text is string
"""
assert isinstance(text, str), "Please input parameter 'text' to string."
sent = nltk.word_tokenize(text)
fd = nltk.FreqDist(w.low... | true |
4e3354c546be8d7ff654ef53538fc406a37b9772 | musaprg/KyoPro | /atcoder/abc158/C/main.py | UTF-8 | 631 | 2.765625 | 3 | [] | no_license | import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
... | true |
1e26082a539199941ee22f706a54ebcf5af8e397 | EunhoCho/Modularization-CS454-2018-Fall | /MakeResult.py | UTF-8 | 3,507 | 2.875 | 3 | [] | no_license | import DotParser
import HC
import SA
import MDG
import PSO
import TurboMQ
from WCA import WCA
import csv
# read .gv file(dot) and create graphs
def make_target_MDG(file_path):
"""
Make MDG based on given file
:param file_path: A path of dot file
:return: MDG graph of given dot file
"""
dot_fil... | true |
00a573016b0fecba4c6d0c4d10839f75402f119f | Caesar-droid/python-projects | /first_numbers.py | UTF-8 | 79 | 3.375 | 3 | [] | no_license | for value in range(10):
print(value)
numbers=list(range(5))
print(numbers) | true |
3745881ae6e25057d00b572aeb69a18acc7e540f | AlexPetrov75/10s_Bot | /Homework2/Part3.py | UTF-8 | 3,618 | 2.765625 | 3 | [] | no_license | import cv2 as cv
import sys
import numpy as np
import math as math
def main():
focalLen = 485.82423388827533
principalX = 134.875
principalY = 239.875
#parse args
if len(sys.argv) != 2:
print("Usage:", sys.argv[0], "file_path")
cap = cv.VideoCapture(sys.argv[1])
... | true |
eeeb88a6cfb4a249c80257d06789062ac54e1088 | ASU-CompMethodsPhysics-PHY494/PHY494-assignments-skeleton | /assignment_06/Submission/test_hw06.py | UTF-8 | 2,980 | 2.859375 | 3 | [] | no_license | # tests for HW 5
import importlib
import math
import random
import numpy as np
from numpy.testing import assert_almost_equal
import pytest
class TestExpSeries:
@pytest.fixture(scope="class")
def solution(self):
return importlib.import_module("problem2")
def test_import_module(self):
try:... | true |
b6f0cbdb63ec15d49698ad6eccf666b88453c40f | pni1/bi_lstm_code | /text_blob_accuracy.py | UTF-8 | 608 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python
from __future__ import print_function
import glob
def main():
files = glob.glob("2*.txt")
count = .0
total_count = .0
for f in files:
with open(f) as fin:
for line in fin.readlines():
star, score = line.strip().split("\t")
star = int... | true |
3bc46f8057b35d66368dc2ee2d6bac337d1dd5ec | Erin-Codes/Python-Task-Manager | /TASK_MANAGER/task_manager.py | UTF-8 | 26,397 | 3.40625 | 3 | [] | no_license | import csv
print("\t\t\t\t\t\t\t\t\tL O G I N")
fl = open("user.txt", "r+")
rfl = fl.read()
user = input("Enter your username:\n")
password = input("Enter your password (case sensitive):\n")
while user.lower() not in rfl:
print("This username does not exist, please try again.")
user = input("\n\nEnter you... | true |
385eb6612ce7c89de668e56f6a9235149f272551 | iiy2/strings-api | /index.py | UTF-8 | 4,604 | 2.640625 | 3 | [] | no_license | from flask import Flask, jsonify, make_response, Response, request, session
from urllib.parse import quote
from functools import wraps
import requests, json, operator
app = Flask(__name__)
app.avoid_login = False
def check_auth(username, password):
return username == 'admin' and password == 'secret'
def authe... | true |
361a7f3fec46452b0b98de8d245c34ac6316173d | laumiulun/falcon | /scripts/runtest.py | UTF-8 | 3,812 | 2.578125 | 3 | [] | no_license | #Include Subprocess
import os
import sys
import subprocess
# FUNCTION to FIND LOCATION
def findlocation(keyword):
string = str(keyword)
for s in list:
if string in str(s):
out=list.index(s)
return out
# Class of Colors
class bcolors:
N='\033[0m' #Normal
BOLD = '\033... | true |
5e42d7fd9ebd29d7a175aa7817f4f591a5e600b8 | ambarsingh1611/Visitor-Predictor-for-YellowStone-National-Park | /Data Cleaning EDA and Logistic Model.py | UTF-8 | 18,444 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 27 12:17:33 2019
@author: Cosmic Dust
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import os
os.chdir('C:/Users/CosmicDust/Documents/Statistics/Final Project')
df = pd.read_csv('ysnp.csv')
df.head(... | true |