blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e09c7099fa358b374bb80eac3b6f80d611f99860 | Python | josephdouce/alexa-find-any-film | /aws lambda deployment package/yaep/yaep.py | UTF-8 | 1,568 | 3.078125 | 3 | [] | no_license | """
YAEP - Yet Another Environment Package
"""
import os
import ConfigParser
from .utils import SectionHeader, str_to_bool
from .exceptions import UnsetException
def env(key, default=None, convert_booleans=True, boolean_map=None,
sticky=False, type_class=unicode):
"""
Retrieves key from the environm... | true |
7a681d83606749261aff6fd3b394998f0f22b311 | Python | martinferianc/SentimentAnalysis-EIE3 | /src/test.py | UTF-8 | 861 | 3 | 3 | [
"MIT"
] | permissive | from exceptions import NonExistantDataType, OutofBoundsError
from decision_forest import DecisionForest
def testTrees(T, X, mode="var"):
return T.test(X, mode)
def loadTrees(dataType="clean", split=None):
"""Returns a DecisionForest according to the datatype and split that
was input. If the split is Non... | true |
a54bfa51068b337a7900f694c4cac9766d6b8704 | Python | jier/DL_assignments_2019 | /assignment_2/part1/vanilla_rnn.py | UTF-8 | 2,816 | 2.671875 | 3 | [] | no_license | ################################################################################
# MIT License
#
# Copyright (c) 2019
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, in... | true |
399f83c02d99c17c639037da3b50323ea29f8674 | Python | deckerego/hack-clock | /lib/hackclock/runapp/Libs/Clock.py | UTF-8 | 1,980 | 3.078125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive | import threading
import datetime
import time
class Clock(threading.Thread):
__RESOLUTION = 1000
__running = True
__waitLock = threading.Lock()
def __init__(self):
threading.Thread.__init__(self)
self.daemon = False
self.tickFunc = None
self.additionalWait = 0
se... | true |
8a8e67659328b0adb763dd8984e16a0147f9feff | Python | MGoglio2212/StreamLit | /ProveDurata.py | UTF-8 | 4,248 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 6 12:35:21 2020
@author: gogliom
"""
'''
Doc = convert_pdf_to_txt( r"D:\Altro\RPA\Energy\IREN\TEST CTE\CTE\esempi cte\EnelLuce30.pdf")
Doc = Doc.upper()
'''
##### BISOGNA IMPORTARE FUNZIONE CONVERT_PDF_TO_TEXT DA ALTRO PROGRAMMA!
import pandas as... | true |
51d636f222b9273ca4b049b70834dcef7eb7d04e | Python | yuanxu00/Image-recognition-trash-can | /test_camera.py | UTF-8 | 599 | 2.578125 | 3 | [] | no_license | import cv2
print("test start")
camera = cv2.VideoCapture(1)
print("test open")
camera.set(cv2.CAP_PROP_FRAME_WIDTH,1280)
camera.set(cv2.CAP_PROP_FRAME_HEIGHT,720)
print("test1")
while True:
ret, image = camera.read()
print("test2")
# 这一步根据实际需要来
# 由于摄像头是定焦摄像头
# 而模型的接口是[228,228]
# 所以这一步就是让读取到的图... | true |
a3618cd48ad08024b48f9304ece96c74b1039815 | Python | kevin-kretz/Park-University | /CS 152 - Introduction to Python Programming/Unit 6/Assignment 2/programming_assignment_2.py | UTF-8 | 2,855 | 4.1875 | 4 | [] | no_license | """
Unit 6 - Programming Assignment (2)
By Kevin Kretz | 20 July 2019
Using the data provided from the file "health-no-head.csv", print the values of the appropriate states according the filters provided by the user.
Also print the states with the lowest and highest number of effected people.
"""
def main():
#ge... | true |
7b42360d0430843f69adcb8edef8c47f061cbe01 | Python | jrzmnt/ActionRecognitionSmallDatasets | /codes/utils/svm.py | UTF-8 | 2,366 | 2.796875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
#-*- coding: utf-8 -*-
import sys
sys.path.insert(0, '..')
import warnings
warnings.filterwarnings("ignore")
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
import os
import argparse
from os.path import j... | true |
d61b8b4662108a65ac5710d0e2899901b1e4b1c5 | Python | thonny/thonny | /thonny/plugins/micropython/base_api_stubs/usocket.pyi | UTF-8 | 18,366 | 2.734375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | """
socket.
Descriptions taken from:
https://raw.githubusercontent.com/micropython/micropython/master/docs/library/socket.rst.
******************************
.. module:: socket
:synopsis: socket module
|see_cpython_module| :mod:`python:socket`.
This module provides access to the BSD socket interface.
.. admonit... | true |
bdf4b9700d6e8f0a3920e2452e75b1d4f7b485f4 | Python | jeevanmore/MyPythonPrograms | /py01_HR_Jumping_on_the_Cloud.py | UTF-8 | 128 | 3.03125 | 3 | [] | no_license | n = 6
s = ['0','0','0','0','1','0']
jumps = 0
for cloud in s:
if cloud == 0:
jumps += 1
print(jumps)
| true |
6326416590f9691eaceca6a7230dc2074ce9b10b | Python | OctopusHugz/holbertonschool-interview | /0x10-rain/0-rain.py | UTF-8 | 620 | 3.84375 | 4 | [] | no_license | #!/usr/bin/python3
""" This module creates a rain function """
def rain(walls):
""" Calculates how much rain water is retained """
total_rain = 0
for i in range(len(walls)):
index = walls[i]
if i > 0:
left_list = walls[0:i]
left_wall_height = max(left_list)
... | true |
f2f3d3ba1c7463b4fa67d2bc464d30f89787f06a | Python | HarikaSatyaPreethi/opencv_programms | /videoplayback.py | UTF-8 | 764 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 22 01:08:14 2019
@author: preethi
"""
import cv2
def main():
windowName = "video play back"
cv2.namedWindow(windowName)
filename = '/home/preethi/Documents/opencv/output/videorecord.avi'
cap = cv2.VideoCapture(filena... | true |
4a942cf9efd64421ebd1f50523c7355368dcd679 | Python | JJong-Min/Baekjoon-Online-Judge-Algorithm | /Data Structure(자료구조)/Data_Structure_6번.py | UTF-8 | 419 | 3.109375 | 3 | [] | no_license | import sys
inputVal = sys.stdin.readline()
values = []
while (inputVal != "고무오리 디버깅 끝"):
inputVal = sys.stdin.readline().rstrip()
if inputVal == "문제":
values.append(1)
if inputVal == "고무오리":
if len(values) == 0:
values.append(1)
values.append(1)
else:
values.pop()
print("고무오... | true |
d63161ce0f6116d37bb30dc5ed9ab7147f890e16 | Python | MichaelTrzaskoma/CSCI380_Nutrifetch | /backend/flask_app.py | UTF-8 | 4,809 | 2.828125 | 3 | [] | no_license | from flask import Flask
from flask import request, jsonify
# import the things that Michael has coded
from Nutrifetch import *
app = Flask(__name__)
app.config["DEBUG"] = True
allergy_profile = {
'Email': "",
'Allergy': [],
}
profileInput = {}
@app.route('/api/v1/CSCI380/profileInput', methods=['POST'])
d... | true |
9170a44e2219ab020c615a365fb126d61dc08fd7 | Python | sumanth-nirmal/SpeedPrediction | /extract_images.py | UTF-8 | 1,988 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python
## Author: sumanth
## Date: March 23, 2017
#extract images from video
# Python 2/3 compatibility
from __future__ import print_function
import cv2
import json
import argparse
import subprocess
# no.of images extracted
count=0
# extracted images path
data_extracted_path='./data_extracted/'
def main... | true |
1396b2ba5463064ab879c70584d4a0ca10b5eda7 | Python | MayankMaheshwar/DS-and-Algo-solving | /microsoft1.py | UTF-8 | 349 | 3.0625 | 3 | [] | no_license | from itertools import groupby
def solution(S):
# write your code in Python 3.6
if len(S) == 1:
return 0
mx = -2**32
group = groupby(S)
for k, v in group:
mx = max(mx, len(list(v)))
print(group, "yes")
for j, l in group:
print(j, l)
print(group)
return ... | true |
af2d558c3be84a098832e0fd65864ec3ddfe8a48 | Python | starkizard/CrudeCode | /Codeforces/Practice/A2oJ Ladders/Ladder #14/presentFromLena.py | UTF-8 | 461 | 3.640625 | 4 | [] | no_license | # author: starkizard
# implementation problem. function string computes what actually has to be printed, for n=5 i print from 0 to 4 store in a list , print 5 and print reverse of the list
def string(i):
s=""
for j in range(i):
s+=str(j)+" "
r=s[::-1]
s+=str(i)
s+=r
return s
n=int(i... | true |
f6d6a5439e9a6779c1d27f5d225be9b150147fd6 | Python | simonr0204/twitch_plays | /main.py | UTF-8 | 897 | 2.8125 | 3 | [] | no_license | import twitch
from keyholder import holdForSeconds as Press
from secrets import username, key
from collections import Counter
def collect_messages(t):
new_messages = t.twitch_recieve_messages()
if not new_messages:
return
else:
msgs = [message['message'].lower() for message in... | true |
dd8af3ae8a63861fd13c9557f70698b5f36cdd8e | Python | oVirt/ovirt-scheduler-proxy | /doc/plugin_samples/ksm_same_os_score.py | UTF-8 | 1,987 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import print_function, division
from ovirtsdk.api import API
import sys
class ksm_same_os_score():
"""rank hosts higher the more vms they have with similar
os to the scored vm"""
properties_validation = ''
def _get_connection(self):
# open a connection to the rest api
... | true |
377467355d16b6e093d9374da180434ab41591fa | Python | skailasa/practice | /ctc/ch04-trees-and-graphs/9-bst-sequences.py | UTF-8 | 2,362 | 4.25 | 4 | [] | no_license | """
A BST is created by traversing through an array left to right and
inserting each element. Given a BST with distinct elements, print
all possible arrays that could have led to this tree.
Strategy:
- root node always first, a different first element would make a
different BST
- need to 'weave' to... | true |
e5f8998e8eb045c5a7e485f65c2b95c014a70481 | Python | lxxue/TorchSeg | /model/pspnet2/cil.pspnet2.R50/split_train_val.py | UTF-8 | 1,933 | 2.609375 | 3 | [
"MIT"
] | permissive | import os
import numpy as np
import argparse
import glob
parser = argparse.ArgumentParser()
parser.add_argument('--trainall', default=False, action='store_true')
parser.add_argument('-v', '--verbose', default=True, action='store_true')
parser.add_argument('-s', '--size', default=0.9, action='store', type=int)
args = ... | true |
afcc5ae9597a1f37b177086f4eed386b787b33ae | Python | ED2589/gesture_classify | /Preprocessing/LoopForAllParticipant_Preproc.py | UTF-8 | 18,521 | 2.796875 | 3 | [] | no_license | # Created May 24,2019 #
# Overview:
# takes each of the 19 EMG files + each of the 19 IMU files,
# and returns ,mat files of binned data (in Python it's 3D array)
##########
# Step 1 #
##########
# import raw data (.csv) into Python
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
... | true |
daf9d0d5f44080cdc3e8ae121acd60681f1e3ece | Python | shendrix07/tide_station_info | /make_station_info.py | UTF-8 | 1,737 | 3.0625 | 3 | [
"MIT"
] | permissive | import pandas as pd
import csv
import geopy
station_info = pd.read_csv('station_web_info.csv')
station_info['Timezone'] = '***' # initialize
stations_by_state = station_info.groupby('State')
with open('timezones_by_state.csv') as f:
f_csv = csv.DictReader(f)
for row in f_csv:
rows_to_change = stati... | true |
9334896f1e1441525ebdee3c4465a0b2005f2704 | Python | StefanoBelli/foi1819 | /changebrightness.py | UTF-8 | 213 | 2.890625 | 3 | [] | no_license | def changeBrightness(pict, x):
# @param pict : Picture
# @param x : float
for pix in getPixels(pict):
origColor = makeColor( getRed(pix) + x, getGreen(pix) + x, getBlue(pix) + x)
setColor(pix, origColor) | true |
d8a395c904098043f361f46bacf4e97710e2aaca | Python | Skvidvardin/project_s | /vocab.py | UTF-8 | 2,045 | 2.984375 | 3 | [] | no_license | from collections import Counter, OrderedDict
import numpy as np
class OrderedCounter(Counter, OrderedDict):
"""Counter that remembers the order elements are first seen"""
def __repr__(self):
return '%s(%r)' % (self.__class__.__name__,
OrderedDict(self))
def __reduce__(... | true |
2dab948a46427783e9ea126404ec01d97d1630bf | Python | RicardoHernandezVarela/GradingStudents- | /gradingStudents.py | UTF-8 | 1,510 | 4 | 4 | [] | no_license | def getMultiplesOfFive(num):
numToString = str(num)
if len(numToString) < 2:
numToString = '0' + numToString
zeros = len(numToString) - 1
times = int('1' + '0' * zeros)
multiple_1 = (int(numToString[0]) + 1) * times
multiple_2 = multiple_1 - 5
return [multiple_2, multiple_1]
def ... | true |
5f063bfeac1be4bc4411e3e86b135000ca1a5632 | Python | kennycaiguo/glglue | /src/glglue/sample/samplecontroller.py | UTF-8 | 2,506 | 2.5625 | 3 | [
"MIT"
] | permissive | # encoding: utf-8
import re
import sys
import math
from OpenGL.GL import *
from ..basecontroller import BaseController
from . import targetview
from . import triangle
from . import cube
from . import coord
from logging import getLogger
logger = getLogger(__name__)
DELEGATE_PATTERN=re.compile('^on[A-Z]')
VELOCITY=0.1... | true |
3b80831e17fd5da1328b43847fe3dbf17b08f988 | Python | etnpce/PhysLab2 | /autoErr.py | UTF-8 | 3,774 | 3.5625 | 4 | [] | no_license | class autoErr:
__slots__ = ("val","err") # Root of all evil
def __init__(self, val, err):
self.val = val
# INVARIANT: self.err >= 0
self.err = abs(err)
# Python has to ways to print a value:
# str(x) calls __str__ if it exists, and is meant to be "pretty"
# repr(x) ca... | true |
2c3474930d5dbbcb11abd69a54cd36a8acedb39a | Python | Psyborrg/Baka-Bot | /Music.py | UTF-8 | 3,934 | 2.6875 | 3 | [] | no_license | import asyncio
import time
import discord
from discord.ext import commands
from discord import FFmpegPCMAudio
from youtube_dl import YoutubeDL
ytdl_format_options = {
'format': 'bestaudio/best',
'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s',
'restrictfilenames': True,
'noplaylist':... | true |
4c31db1025e984d406ebf400088d4ff824f3a323 | Python | swagatk/Raspi_codes | /Edukit3/pwm_motors.py | UTF-8 | 2,170 | 3.1875 | 3 | [] | no_license | # CamJam Edukit 3 - robotics
# Worksheet - 7: controlling motors with PWM
import RPi.GPIO as GPIO
import time
#set GPIO modes
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# set variables for GPIO motor Pins
pinMotorAForward = 10
pinMotorABackward = 9
pinMotorBForward = 8
pinMotorBBackward = 7
# PWM parameters
F... | true |
9335e57aa2ce5a8bad6b582c4a28a63b808bd118 | Python | yann021/PythonAN21 | /Jour1/Exo/Tst1.py | UTF-8 | 98 | 3.640625 | 4 | [] | no_license | a = 3
b = 12
c = 4
result = (b-a)//c
print("Le resultat de l'opération est " + str(result))
| true |
ef0e41dccb633376c0d52796bbd1a9aa80b539d1 | Python | ScholarIndex/LinkedBooks | /disambiguation/primary/model_dev/supporting_functions.py | UTF-8 | 553 | 3.046875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Loads checked and correct disambiguations AND a sample of references which are NOT checked-
"""
__author__ = """Giovanni Colavizza"""
import string,re
def cleanup(text):
"""
remove punctuation except . and numbers
:param text: a string
:return: a string
"""
RE_D = re.compile('\d')
... | true |
f6f9dc6c06adcc69d61b69cebdc4d522a8325205 | Python | abubakarsiddik1221/SiddikR151530_DSP | /linearity_dtft.py | UTF-8 | 1,022 | 3.03125 | 3 | [] | no_license | from pylab import *
import matplotlib.pyplot as plt
import numpy as np
import cmath as cm
k=int(input("enter number of samples for x[n]:"))
x=[]
print("enter samples for x[n]:")
for i in range(0,k):
y=int(input())
x=np.append(x,y)
print("x[n]=",x)
N=1000
j=cm.sqrt(-1)
X=[]
w=np.linspace(-np.pi,np.pi,N)
... | true |
671b1f2e7960e8bcc394d17de9ba2f7f9d86310c | Python | nbearman/city-scrapers | /city_scrapers/spiders/det_entertainment_commission.py | UTF-8 | 2,784 | 2.78125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import re
from datetime import time
from dateutil.parser import parse
from city_scrapers.constants import COMMISSION
from city_scrapers.spider import Spider
class DetEntertainmentCommissionSpider(Spider):
name = 'det_entertainment_commission'
agency_name = 'Detroit Entertainment Comm... | true |
12680f7077b4d0dda117697d5e36bc0fc735f29a | Python | Yushgoel/Python | /oddeven.py | UTF-8 | 155 | 3.96875 | 4 | [] | no_license | number = raw_input("Please enter a positive number.")
number = float(number)
remainder = number % 2.0
if remainder == 0:
print "Even"
else:
print "Odd" | true |
b4e359fce4b5e0af6118bac4390b003e86eb3c96 | Python | andresrv94/zerotomastery-twitterbot | /search.py | UTF-8 | 2,491 | 3.125 | 3 | [] | no_license | # This file will use the Tweepy Cursor API to reply to mentions, follow users that follow us, and a backup like and retweet
# imports tweepy, time, and the create_api function from config.py
import tweepy
import time
from config import create_api
# Define a follow_followers function that accepts api and check if they ... | true |
b0bc8dc7a9c96845803d99c41b3cd75baf391552 | Python | Godaday/pythonDemo | /mergeExcel/main.py | UTF-8 | 2,075 | 2.921875 | 3 | [] | no_license | #pip3 install xlrd
#pip3 install xlsxwriter
import os
import xlrd
import xlsxwriter
import datetime,time
Target_Folder_Path="mergeData/" #合并Excel目标文件夹默认程序当前目录下
Sheet_Index=0#数据在Excel的第几个Sheet中,默认第一个0
First_Data_row=5#数据开始的第一行(排除表头)
mergeDoneData=[]#存储读取数据
def MergeFiles(folderPath):
for root ,dirs,files... | true |
a643b53e755277aa450f0ef97e3bdc56392f6e54 | Python | c0deTang/lintCode | /140_fast-power/fast-power.py | UTF-8 | 578 | 3.1875 | 3 | [] | no_license | # coding:utf-8
'''
@Copyright:LintCode
@Author: CodeWTKH
@Problem: http://www.lintcode.com/problem/fast-power
@Language: Python
@Datetime: 17-06-01 15:07
'''
class Solution:
"""
@param a, b, n: 32bit integers
@return: An integer
"""
def fastPower(self, a, b, n):
# write your code h... | true |
fd53c2cbd6aee3426cd501e520576f754c1de955 | Python | james-claar/Python-Projects | /email_checker.py | UTF-8 | 2,434 | 2.984375 | 3 | [] | no_license | """
A Project I created to check my email without opening a Gmail tab.
"""
import time
from googleapiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools
from blink1.blink1 import blink1
SCOPES = 'https://www.googleapis.com/auth/gmail.readonly'
LIGHT_COLOR_RG... | true |
1525b6591117eaee608fefe3bcf9e1cdcfed9de6 | Python | damlassugur/KohenenNetwork | /number.py | UTF-8 | 1,403 | 3.140625 | 3 | [] | no_license | import numpy as np
import random
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
#3 sınıftan 200er nokta oluşturabilmek amacıyla farklı ortalama ve varyans değerlerine sahip gauss dağılımlarından faydalanılmıştır
mu1=1000
sigma1=500
mu2=2
sigma2=6
mu3=3
sigma3=7
#noktalar npy nokt... | true |
262ec8a9fc2241422d79720605e903e873c25d4e | Python | BLOODMAGEBURT/exercise100 | /data-structure/sort-search/5.9.插入排序.py | UTF-8 | 1,522 | 4.40625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: 5.9.插入排序
Description :
Author : Administrator
date: 2019/10/12 0012
-------------------------------------------------
Change Activity:
2019/10/12 0012:
--------------------------... | true |
62122b8a006e3bedd738fb04afa2e0ac85ac63a5 | Python | m1m0r1/galgo | /galgo/samutil.py | UTF-8 | 25,411 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import logging
from operator import attrgetter
from .interval import Interval, IntervalMixin
import pysam
from .utils import fill_text, cached_property, attrdict
from . import csamutil
from builtins import zip
import re
# deprecated
def _parse_region_old(region):
"""
Args:
regio... | true |
4229e94b6d8e0c586fcd93e50229589b800b7fd8 | Python | lagerone/advent-of-code-2020 | /src/day4/day4.py | UTF-8 | 4,523 | 2.75 | 3 | [] | no_license | import logging
import os
import re
from typing import List, Optional
logging.basicConfig(level=logging.DEBUG)
def read_input(input_path: str):
input_file = open(input_path, "r")
lines = input_file.readlines()
result: List[str] = []
for line in lines:
result.append(line.strip())
return re... | true |
91fa324d4550e6681d77b15f4b50fd2e3368ac1b | Python | AhosanuzzamanRoni/python-basic-a2z | /p-6.py | UTF-8 | 217 | 2.84375 | 3 | [] | no_license | name="roni"
age="23"
gpa="3.50"
name=input ("enter your name :")
name=input ("enter your age :")
name=input ("enter your gpa:")
print("student information")
print("name:"+ name)
print("age:" +age)
print("gpa :" +gpa) | true |
472c077040d5e436a9d0b7d8e3ad13ebf4ae6d6c | Python | BTAutist/meme-generator | /quote_engine/docx_ingestor.py | UTF-8 | 866 | 2.921875 | 3 | [] | no_license | from .ingestor_interface import IngestorInterface
from .quote_model import QuoteModel
import docx
class DocxImporter(IngestorInterface):
allowed_extensions = ['docx']
@classmethod
def parse(cls, path):
""" Parses text from file, returns quote models """
if not cls.can_ingest(path):
... | true |
faeaa75c9113dd53d1d426804d9d14c436cec68b | Python | bwjubrother/Algorithms | /Learn_advanced/5204_mergeSort.py | UTF-8 | 849 | 3.125 | 3 | [] | no_license | import sys
sys.stdin = open('5204.txt', 'r')
def mergeSort(arr):
if len(arr) <= 1:
return arr
else:
mid = len(arr) // 2
left = arr[:mid]
right = arr[mid:]
left = mergeSort(left)
right = mergeSort(right)
return merge(left, right)
def merge(left, right):
... | true |
9b03b641978e4933b49b7ecc2918f66ae034b69b | Python | mrtbld/practice | /leetcode/238-product-of-array-except-self/238.py | UTF-8 | 953 | 3.75 | 4 | [] | no_license | class Solution:
# t:O(n), s:O(1 + output)
def productExceptSelf(self, nums):
"""For each element in nums, return the product of every other elements.
>>> _ = Solution()
>>> _.productExceptSelf([1,2,3,4])
[24, 12, 8, 6]
>>> _.productExceptSelf([1,2,3,4,0])
[0, 0, ... | true |
8e2d2f6d69b53c4d23a0c6afaaa1dfe20e5d3b97 | Python | jmvalente/PathPlanning | /src/entities/robot.py | UTF-8 | 6,721 | 3.28125 | 3 | [] | no_license | from random import randint
from grid import Grid
import logging
#Create the robot objects
class Robot:
population = 0 #Keep track of how many robots exist, useful for assigning ID.
#We should keep a list of occupied start and end nodes so we don't give two robots the same point
startNodes = ()
goal... | true |
dc68fe3acb6cdb3d3717b7a29300c9f8b956e6fa | Python | henryeleonu/time_series_queue_model | /arrival_queue.py | UTF-8 | 11,245 | 3.375 | 3 | [
"MIT"
] | permissive | from math import sin, cos, sqrt, atan2, radians
import pandas as pd
import datetime
from matplotlib import pyplot as plt
from geopy.distance import geodesic
"""
Code developed by Henry Eleonu
"""
def get_distance_between_point(test_long, test_lat, lab_long, lab_lat):
"""
Calculates the distance betwee... | true |
2d1aae770d95977f84374bdf4222e99eac41d784 | Python | h4t4u/heapling | /heapling/model/wall.py | UTF-8 | 3,681 | 3.28125 | 3 | [] | no_license | from model.physicalobject import PhysicalObject
import random
from math import *
import pygame
from utility.vector import Vector
KEY = (0, 0, 0)
BLACK = (0, 0, 1)
def plane_angle_and_length(a, b):
'''
it finds all I need for my program please DON'T TOUCH
:param a:
:param b:
:return:
'''
if a!=b:
x = b[0] -... | true |
95fbc46c09dd69e92a2948f2b7ab5270eff794a4 | Python | tate1010/Python-Neural-Network | /Basic Learning/Machine learning to mutiple two number.py | UTF-8 | 1,628 | 2.84375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM
import random
from keras import backend as K
import tensorflow as tf
import math
from keras.callbacks import EarlyStopping, ModelCheckpoint
np.random.seed(42)
#Generate tra... | true |
358d4728fefcd1a894177866ed64fef9a4da9928 | Python | MangledPotat0/1DSolarWind | /thing.py | UTF-8 | 3,514 | 2.859375 | 3 | [] | no_license | from time import sleep
# List of parameters to be used
numberOfCells = 5
gr = 396.41 #solar radius^3/solar mass*seconds
initVelocity = 0
initDensity = 0.000000000000001
initEnergy = 2.1395 * (10 ** (-64)) # 3/2 kT = 2.071 E-16 joules
x0 = 0.5
dx = 0.005
dt = 0.0000001
# List of functions to be used
def calc_pressure... | true |
b29dab0fe94b3b9c5490f0e3ad21128e0baa3633 | Python | deyh2020/Metsco_Insulator_Detection | /final_design/data_reader.py | UTF-8 | 1,428 | 2.765625 | 3 | [] | no_license | import json
from urllib import request
from PIL import Image
import numpy as np
import scipy.misc
import os
def normalize_image(file):
img = Image.open(file, 'r')
arr = np.array(img)
arr = np.floor_divide(arr, 255)
img = Image.fromarray(arr)
img.save(file)
with open('data.json') as f:
data = j... | true |
1912c2cbbb9e4638b51d7189bbb90ebd5b1d3eff | Python | rusvoskres/python_homework1 | /dice_game_dif.py | UTF-8 | 2,318 | 3.984375 | 4 | [
"MIT"
] | permissive | from dice_game import Dice
class Dice_dif(Dice):
def __init__(self, N,type):
super().__init__(N)
self.type_game=type
def __str__(self):
super().__str__()
if self.type_game == 1:
return f'Нужно угадать числа как непорядоченную пару'
elif self.type_game==2:
... | true |
7b91592b4ce15bcc601ba4c91803d6dcabe94e12 | Python | AntoineGachet/new_repo_python | /trash_code/progamme nul.py | UTF-8 | 110 | 3.109375 | 3 | [] | no_license | r=float(input('entrer un nombre'))
if r<5:
print('bien joué')
else:
print('sal petite merde')
| true |
5024608c4818660e938999cbab7dd0d3dcd074b4 | Python | flocka12/Flocka_records | /DB/db_con.py | UTF-8 | 457 | 2.796875 | 3 | [] | no_license | ''' module that connects to the database '''
import psycopg2
import os
def db_init():
"""creates db connection"""
dbname = os.getenv('DB_NAME')
user = os.getenv('DB_USER')
host = os.getenv('DB_HOST')
password = os.getenv('DB_PASSWORD')
db_conn = psycopg2.connect(
"dbname={} use... | true |
b46e1d282e10b2db105ab35b199685cb69ffa081 | Python | jrucl2d/Python_Coding_Test | /1Cycle/13장/q15.py | UTF-8 | 705 | 3.0625 | 3 | [] | no_license | from collections import deque
n, m, k, x = map(int, input().split())
graph = [[] for _ in range(n + 1)]
for _ in range(m):
a, b = map(int, input().split())
graph[a].append(b)
visited = [False] * (n + 1)
answer = []
def bfs(graph, start, visited):
depth = 0
queue = deque([(start, depth)])
visit... | true |
697bd8f5be4f160aca9c1b9f45e50b650152dc00 | Python | TapanBhavsar/CIFAR10_classification_production_level | /CIFAR10_Serving/lib/cifar10_model_trainer.py | UTF-8 | 4,689 | 2.71875 | 3 | [] | no_license | from model_trainer import ModelTrainer
from CIFAR10_model import CIFAR10Model
import tensorflow as tf
import time
import os
import utilities
class CIFAR10ModelTrainer(ModelTrainer):
def __init__(
self, train_data, train_labels, validation_data, validation_labels, test_data, test_labels,
):
sup... | true |
6543740ba77da904da22689a103453f656cfb37b | Python | GLMF/GLMF191 | /Dev/1_4_radio/radio.py | UTF-8 | 544 | 2.671875 | 3 | [] | no_license | import npyscreen
class Window(npyscreen.NPSApp):
def main(self):
Form = npyscreen.Form(name="GNU/Linux Magazine")
radio_values = ["Option 1", "Option 2", "Option 3"]
radio = Form.add(npyscreen.TitleSelectOne, max_height=len(radio_values), value = [0], name="Choix:",
values =... | true |
254584e03f6529313acaa2b3ef96ddf99166bfc6 | Python | Brian-McG/HonoursDefaulterPrediction | /src/config/classifiers.py | UTF-8 | 4,192 | 2.671875 | 3 | [] | no_license | """Configures classifiers and their status"""
from collections import OrderedDict
from sklearn import svm
from sklearn.ensemble import AdaBoostClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import VotingClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.na... | true |
9b839ebf46f27bf76f7484218e5714c137215cc0 | Python | rishsharma1/grokking_algorithms | /recursion.py | UTF-8 | 1,127 | 3.6875 | 4 | [] | no_license |
def sum_array(array):
if len(array) == 0:
return 0
return array[0]+sum_array(array[1:])
def length(array):
if array == []:
return 0
return 1+length(array[1:])
def _max(a,b):
if a > b:
return a
return b
def max_number(array):
mid = (len(array)/2) - 1
if... | true |
363f7c33ace24d474a91cba62d966dd813a3a434 | Python | katherinebroner/hackbright-intro-classes | /plants.py | UTF-8 | 554 | 3.921875 | 4 | [] | no_license | class Plants(object):
def __init__ (self, type_of_flower, flowering_or_not_flowering, color):
self.type_of_flower = type_of_flower
self.flowering_or_not_flowering = flowering_or_not_flowering
self.color = color
def set_is_flowering(self, bool):
self.flowering_or_not_flowering = b... | true |
c94f0bd2b537007520cd09c2fd5d6090cd89d177 | Python | ejoerns/flamingo | /flamingo/core/settings.py | UTF-8 | 856 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | import runpy
class Settings:
def __init__(self):
self._values = {}
self._modules = []
self.add('flamingo.default_settings')
def add(self, module):
self._modules.append(module)
if module.endswith('.py') or '/' in module:
values = runpy.run_path(module, ini... | true |
ccf4adc09750dd387c31b170cc7e03c6466a4b87 | Python | darrylyeo/Email-Event-Extractor | /utility_functions.py | UTF-8 | 3,032 | 2.6875 | 3 | [] | no_license | import re
import sys
import spacy
from itertools import *
from spacy.attrs import ENT_IOB
from spacy.matcher import Matcher
def fix_space_tags(doc):
ent_iobs = doc.to_array([ENT_IOB])
for i, token in enumerate(doc):
if token.is_space:
# Sets 'O' tag (0 is None, so I is 1, O is 2)
... | true |
4f061868679f32e0d0b88256f5d2e184cc81370e | Python | Talanvor/infa_2020_Snigir | /Solar/graph3.py | UTF-8 | 656 | 3.015625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
x = []
y = []
t = 1.0
px = 0.0
py = 0.0
sx = 0.0
sy = 0.0
objects = []
with open('stats.txt', 'r') as stats:
for line in stats:
if len(line.strip()) == 0 or line[0] == '#':
r = ((px - sx)**2 + (py - sy)**2)**0.5
y.append( r )
continue
object_type = lin... | true |
26d98e214125814995375a656e485469bc6ece13 | Python | Aasthaengg/IBMdataset | /Python_codes/p02271/s434090235.py | UTF-8 | 271 | 2.78125 | 3 | [] | no_license | import itertools
n = input()
a = list(map(int, input().split()))
q = input()
aset = set()
for i in range(1, len(a) + 1):
aset |= set(sum(combi) for combi in itertools.combinations(a, i))
for m in map(int, input().split()):
print('yes' if m in aset else 'no') | true |
d55b8e3250070c038c0ec56447bbd37d20990e53 | Python | Jeevanjeethu/Practice | /Total/Python Learning/2nd class/xprint.py | UTF-8 | 38 | 3.03125 | 3 | [] | no_license | x=int(input('x'))
sum=x+x
print(sum) | true |
d75d15125c609fbabd6b254346f413f310bdc1ee | Python | Richard-Kirby/otg_keyboard | /accel/accel.py | UTF-8 | 4,404 | 2.796875 | 3 | [
"MIT"
] | permissive | import smbus
import time
import math
import threading
from collections import deque
import queue
# Accelerometer class - sets up and returns accelerometer values as requested.
class Accelerometer(threading.Thread):
scaled_accel = [0, 0, 0]
address = 0x68
power_mgmt_1 = 0x6b
total_accel = ... | true |
88a39df0f62bedf8a640e6a94855ebaf8af97b74 | Python | jlucangelio/adventofcode | /day7.py | UTF-8 | 1,412 | 3 | 3 | [
"MIT"
] | permissive | import sys
with open(sys.argv[1]) as f:
lines = f.readlines()
count = 0
for line in lines:
line = line.strip()
seen = []
abba = ""
tls = False
hypernet = False
abba_in_hypernet = False
for char in line:
if char == "[":
hy... | true |
c688ffb759c080d2d33f59b4c30b9cd7a1af70f6 | Python | OpenGL-rolandpls/OpenGL-texture | /src/index.py | UTF-8 | 16,930 | 2.984375 | 3 | [
"MIT"
] | permissive | # IF3260: Computer Graphics
# Texture Mapping - Immediate
# --Libraries and Packages--
import sys
import numpy
from math import *
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
from PIL import Image
# --Camera Settings--
# Camera Angle
angle = 0.0
# Camera Coordinate
x = 0.0
y = 0.0
z = 0... | true |
7e0d08ced97466efac6ee69191d7bba9df933fd2 | Python | YaooXu/Software_test | /analyzer.py | UTF-8 | 12,056 | 2.8125 | 3 | [] | no_license | import os
import re
import ast
import json
import astunparse
import numpy as np
global source, file_parent_path, file_name
TAB_SIZE = 4
cnt = 0
all_func = {}
# 分析源码的class和method
class SourceAnalyser(ast.NodeVisitor):
def __init__(self):
self.all_class = {}
self.all_func = []
self.names = ... | true |
cc2b492650aedc5ec9271657e5d76b8bad6edf53 | Python | Ismgh/OCR | /neural_network_design.py | UTF-8 | 2,315 | 2.609375 | 3 | [] | no_license | # Try various number of hidden nodes and see what performs best
for i in xrange(5, 50, 5):
nn = OCRNeuralNetwork(i, data_matrix, data_labels, train_indices, False)
performance = str(test(data_matrix, data_labels, test_indices, nn))
print "{i} Hidden Nodes: {val}".format(i=i, val=performance)
def test(data_... | true |
6dcd7ee1176922eb32fcdaed810de63ff5e8d5dc | Python | Garyguo2011/DistanceVectorRouting | /project1/hub.py | UTF-8 | 481 | 2.59375 | 3 | [] | no_license | from sim.api import *
from sim.basics import *
import time
class Hub (Entity):
""" A simple hub -- floods all packets """
def handle_rx (self, packet, port):
"""
Just sends the packet back out of every port except the one it came
in on.
"""
if type(packet) is DiscoveryPacket:
print ("Rout... | true |
a42d46ca65cbfa162fb0b499a1643d7be618d439 | Python | qianpeng-shen/Study_notes | /第二阶段笔记/pythonweb/day04/unix_send.py | UTF-8 | 622 | 2.65625 | 3 | [] | no_license | from socket import *
import sys,os
#确定用哪个文件进行通信
server_address='./test'
#判断'./test'文件存在性,如果已经存在需要处理
#删除这个文件
if os.path.exists(server_address):
os.unlink(server_address)
#创建本地套接字
sockfd=socket(AF_UNIX,SOCK_STREAM)
#绑定本地套接字文件
sockfd.bind(server_address)
#监听
sockfd.listen(5)
while True:
c,addr=sockfd.accept()
... | true |
c79ed3d8fb6294f539ccd2a2fdfc75ba86f50356 | Python | zerlok/nsu-prog-all | /ptycho-coursework/fp.py | UTF-8 | 14,960 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python3
from argparse import Action
from numpy import (
pi,
sin, cos, radians, arctan, arccos, exp, angle, conjugate, sqrt, conj,
array, zeros, ones, meshgrid, arange,
mean, any as np_any, sum as np_sum, std,
fft,
save as np_save,
)
import optics as o
from abstracts import Factory
from os.path import ... | true |
209eafeec0cd6b5bacb44a7231920c01c824b433 | Python | carrier-io/galloper | /galloper/database/utils.py | UTF-8 | 410 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | from sqlalchemy.sql import expression
from sqlalchemy.ext.compiler import compiles
from sqlalchemy.types import DateTime
class utcnow(expression.FunctionElement):
type = DateTime()
@compiles(utcnow, 'postgresql')
def pg_utcnow(element, compiler, **kw):
return "TIMEZONE('utc', CURRENT_TIMESTAMP)"
@compiles(u... | true |
a62a6642313d5b1ff0d28f4fc6705a4aa6b387b2 | Python | yxrya/Distributed-Computing-SynchBFS | /v4MB/main.py | UTF-8 | 3,887 | 2.625 | 3 | [] | no_license | from queue import Queue
from message import Message
from process import Process
import threading
import time
import sys
import json
def launch_master_thread(n, ids, root, conn_matrix):
global id_process, id_label
print(f'In master thread. Launching {n} threads..')
initial_config = {}
q = Queue() # init... | true |
27b7b846c193c6386ddc974ab1a6b895a422d2bd | Python | AlejandroCamara/Learn_Python_3_the_Hard_Way | /Exercise 03. Numbers and Math/ex3-sd.py | UTF-8 | 1,512 | 4.28125 | 4 | [] | no_license | # Exercise 03: Numbers and Math - Study Drills.
# Prints the message "I will now count my chickens:"
print("I will now count my chickens:")
# Prints "Hens" and the result of (25 + (30 / 6))
print("Hens", 25.0 + 30.0 / 6.0)
# Prints "Roosters" and the result of (100 - (25 * (3 % 4)))
print("Roosters", 100.0 - 25.0 * ... | true |
f39b599dacc067dc03b21d974a9bccc4ebdaa26b | Python | AustenA/AOC2020 | /3-1.py | UTF-8 | 378 | 3 | 3 | [] | no_license | f = open("Day3Trees.txt", "r")
d = f.read().split("\n")
total = 0
down = 0
over = 0
height = len(d)
width = len(d[0])
downSpeed = 1
rightSpeed = 3
while True:
over = rightSpeed + over
down = downSpeed + down
if down >= height:
break
over = over%width
print(d[down][over])
if (d[down][o... | true |
ba2f20b365a33bd2709e3fa7fe8456dd91584df9 | Python | Pranavtechie/Class-XII-Projects | /Section C/Group - 1 (03,04,433)/Source Code/src.py | UTF-8 | 12,090 | 3.21875 | 3 | [] | no_license | import mysql.connector as sql
from mysql.connector import Error
from time import sleep
import os
import datetime
from prettytable import PrettyTable
from math import fabs
house_list = ['Godavari', 'Krishna', 'Penna', 'Tungabhadra']
def Establish_Connection():
"""This function establishes connection to mysql data... | true |
ab8dcaaff9068711dd87fe66e3c1a736362ac5ca | Python | searow/cs249-project | /scws_poly_eval.py | UTF-8 | 4,884 | 2.5625 | 3 | [] | no_license | from utils import *
import numpy as np
from scipy.stats import spearmanr
window_sizes = range(1, 100)
embeddings_fp = './embedding_results/saved_embeddings_step_5000000_k_2_dim_150_neg_1_swind_5_contexts_1_2018-06-02-20-39-00/saved_embeddings_step_5000000_k_2_dim_150_neg_1_swind_5_contexts_1_2018-06-02-20-39-00'
# emb... | true |
1a374bf3437548133478a3ee20978e726bf6b7c3 | Python | donglaiw/pytorch_connectomics | /connectomics/data/utils/data_affinity.py | UTF-8 | 4,188 | 2.703125 | 3 | [
"MIT"
] | permissive | import numpy as np
# from Janelia pyGreentea
# https://github.com/naibaf7/PyGreentea
def mknhood2d(radius=1):
# Makes nhood structures for some most used dense graphs.
ceilrad = np.ceil(radius)
x = np.arange(-ceilrad,ceilrad+1,1)
y = np.arange(-ceilrad,ceilrad+1,1)
[i,j] = np.meshgrid(y,x)
id... | true |
87aa5dcbbab1a117e3f0ff41f685a291efb72b74 | Python | takkaria/plucker | /tests/test_plucker/test_extractor.py | UTF-8 | 1,407 | 2.796875 | 3 | [
"MIT"
] | permissive | import pytest
from typing import List
from plucker.types import JSONValue
from plucker.extractor import extract, _get_from_path
from plucker.tokeniser import ArrayToken, NameToken, Range, Token
from plucker.exceptions import ExtractError
# A fake range cos it doesn't really matter.
fr = Range(0, 0)
def test_getter... | true |
9de669e2a40472f54416f858b33b56d677b88535 | Python | frozenparadox99/OpenCvCourse | /drawOnStream.py | UTF-8 | 1,117 | 2.796875 | 3 | [] | no_license | import cv2
#Callback Function
def draw_rect(event,x,y,flags,params):
global p1,p2,topLeftClicked,bottomRightClicked
if event==cv2.EVENT_LBUTTONDOWN:
if topLeftClicked and bottomRightClicked:
p1=(0,0)
p2=(0,0)
topLeftClicked=False
bottom... | true |
1f06329bdb958c952b45f9999504208e107b2d5f | Python | JakeAttard/2810ICTPythonExercises | /W1H6.py | UTF-8 | 933 | 3.375 | 3 | [] | no_license | from PyTest import *
##//////////////////////////// PROBLEM STATEMENT //////////////////////////
## Given a list of ints, decide which is larger of the first and //
## last elements in the list, and set all the other elements to be that //
## that value. Print the changed list. Implement functions for: ... | true |
5be89b5e1bfafc13a64772afca678879345d1543 | Python | drabekj/OttoBot-Alexa-Skill | /test/test_add_to_watchlist.py | UTF-8 | 3,682 | 2.609375 | 3 | [
"MIT"
] | permissive | import unittest
from flask import json
from app import create_app, db, logger
from app.models import Stock, User, Watchlist
from test.sample_requests import *
class AddToWatchlistTestCase(unittest.TestCase):
"""This class represents the OttoBot routing test case"""
def setUp(self):
"""Define test v... | true |
c2a180e13a684facfb74f3055a4acf620094dbca | Python | morallo/plaso | /tests/parsers/sqlite_plugins/twitter_ios.py | UTF-8 | 6,863 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for Twitter on iOS 8+ plugin."""
import unittest
from plaso.lib import definitions
from plaso.lib import timelib
from plaso.parsers.sqlite_plugins import twitter_ios
from tests import test_lib as shared_test_lib
from tests.parsers.sqlite_plugins import test_lib
cl... | true |
7c0702d25ff96613d2f0a75ec8d61b7149f2de64 | Python | stefanduscher/stefanduscher | /Anfänger_Tag3_Schieberegler.py | UTF-8 | 2,764 | 3.53125 | 4 | [] | no_license | # Programm: Interaktive Grafik mit Schieberegler
#
# Datum: 02. Juno 2019
#
# Autor: Stefan Duscher
#
# Bemerkungen: Kurs "Python für Anfänger" Ludwigsburg
#
# ----------------------------------------------------
# Einbinden der Bibliotheken
import numpy as np
import matplotlib.pyplot as... | true |
3a7f93912835863b36ce9326b6dcb9a72c8876f2 | Python | dongupak/Basic-Python-Programming | /Ch18_패키지/from_import_ex.py | UTF-8 | 190 | 2.65625 | 3 | [] | no_license | import sys
sys.path.append("/Users/dongupak/pkgTutorial")
from math_pkg import math_op
print('100 + 200 =', math_op.add(100,200))
from str_pkg import str_op
print(str_op.upper('hello'))
| true |
e39e1b1ecb2867867113fd26aa951eca6a54d3e6 | Python | gutzbenj/hackerrank_challenges | /warmup/birthday_cake_candles.py | UTF-8 | 315 | 3.03125 | 3 | [] | no_license | import sys
# Complete the birthdayCakeCandles function below.
def birthdayCakeCandles(ar):
ar_max = max(ar)
print(sum([n == ar_max for n in ar]))
sys.stdout.flush()
if __name__ == '__main__':
ar_count = int(input())
ar = list(map(int, input().rstrip().split()))
birthdayCakeCandles(ar)
| true |
3082950c9c51fb337c3ca87a5c9e6dfa519015c6 | Python | Icedgarr/Machine-Learning | /coursework/Problemset1/Ex4.py | UTF-8 | 2,077 | 3.171875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 27 11:18:36 2017
@author: roger
"""
import numpy as np
import itertools as itt
import matplotlib.pyplot as plt
from numpy import random as rand
def proj_basis(d,D): #Projects the basis of a D-dim space to a d-dim space
W=rand.normal(0,1/d,(d,D)) #Generate a rando... | true |
6851172d0b9952f940f838f89ef0e316edb6f073 | Python | ChizzaHut/PythonLog | /Practice 6 - List Comprehensions.py | UTF-8 | 174 | 3 | 3 | [] | no_license | import random
a = random.sample(range(1, 50), 10)
a.sort()
b = []
c = []
for x in a:
if x % 2 == 0:
b.append(x)
else:
c.append(x)
print(a)
print(b)
| true |
3583759e41724e3824eb3d7df8ff1f55dfe04330 | Python | bwats2/CSCIE7-Final-Project | /tests/beautifulsouptest3.py | UTF-8 | 2,594 | 3.28125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
# https://stackoverflow.com/questions/24398302/bs4-featurenotfound-couldnt-find-a-tree-builder-with-the-features-you-requeste
# https://codeburst.io/web-scraping-101-with-python-beautiful-soup-bb617be1f486
NFL_TEAMS = ['Arizona Cardinals', 'Atlanta Falcons', 'Baltimore Rav... | true |
9f956c93a622df14048693b428b8d1db11c6c7d1 | Python | faterazer/LeetCode | /0022. Generate Parentheses/generate_parentheses.py | UTF-8 | 524 | 3.40625 | 3 | [] | no_license | from typing import List
class Solution:
def generateParenthesis(self, n: int) -> List[str]:
ret = []
self.dfs(ret, "", n, n)
return ret
def dfs(self, ret: List[str], s: str, lpairs: int, rpairs: int) -> None:
if rpairs < lpairs:
return
if lpairs == 0 and rp... | true |
752852e27c7500c56dc4c7a03790ec99359e9469 | Python | Tubbz-alt/sds | /example_problem/exact-solution.py | UTF-8 | 825 | 3.109375 | 3 | [
"BSD-2-Clause"
] | permissive | '''Find the exact solution of the toy dataset
'''
from itertools import combinations
import numpy as np
import pandas as pd
from time import time
START = time()
N = 24 # Population size
n = 12 # dissimilar-set size
# Load dataset, reset column labels while doing so because pandas will interpret as string
mtrx = pd.... | true |
dc21f1d75ad28fa3f7d7fdebfd694e29872c064d | Python | tangyiheng2021/pg_plan_inspector | /pgpi/regression.py | UTF-8 | 19,527 | 2.953125 | 3 | [] | no_license | """
rgression.py
Formatted by black (https://pypi.org/project/black/)
Copyright (c) 2021, Hironobu Suzuki @ interdb.jp
"""
import math
import os
import operator
from .common import Common, Log
from .repository import Repository
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.m... | true |
7a96c3968455cd93482d14650e46a4463e68f313 | Python | zhao1701/tcvae | /tcvae/visualization.py | UTF-8 | 6,200 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
"""
This module contains utilities for predicting with and inspecting
autoencoders models.
"""
import imageio
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from .utils import check_path
def plot_img(img, figsize=(4, 4)):
plt.figure(figsize=figsize)
plt.imshow... | true |
53cd1ab4b5f083450ec003ed9c8ce954338c85ad | Python | WHJR-G12-Github/Template_C6_SAA1 | /template_c6_saa1.py | UTF-8 | 203 | 4.09375 | 4 | [] | no_license | # Create a list 'numbers'
# Create a variable 'count'
# Initialize it to '0'
# Create a 'for' loop to access every element in the list
# Increment 'count' by '1'
# Print the value of 'count'
| true |
6c0629c92e02d265fed64805996f97e26d68f96a | Python | learning022/quality-report | /backend/hqlib/metric/product/size_metrics.py | UTF-8 | 3,053 | 2.53125 | 3 | [] | no_license | """
Copyright 2012-2019 Ministerie van Sociale Zaken en Werkgelegenheid
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... | true |
795c029a42ca3a93b03f409dccf1ea3138456403 | Python | BlakeMcMurray/Bioinformatics-Algorithms | /Chapter 2/score.py | UTF-8 | 527 | 2.859375 | 3 | [] | no_license | #working (probably)
import countMatrix as CM
#calculates the score of a set of motifs
#breaks ties by first encounter of max nucleotide
def score(kmers):
count_m = CM.count(kmers)
m = 0
score = 0
tracker = 0
for i in range(len(count_m)):
m = max(count_m[i])
for j in range(len(count_m... | true |