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 |
|---|---|---|---|---|---|---|---|---|---|---|
034cb40dcbc0a2200e87d259eb29b47d353cefa9 | wzgdavid/myCoding | /2015and_older/wzg_mongodb/__init__.py | UTF-8 | 3,157 | 2.703125 | 3 | [] | no_license | # encoding: utf-8
import sys
sys.path.insert(0, 'C:\\Users\\Administrator\\Desktop\\myCoding')
from wzg_mongodb.config import *
import pymongo
import collections
'''
mongodb中一个 document 对应 python 的一个 Model 的实例的字段
一个 collection 对应一个 Model 的类
'''
class MongoApp(object):
'''这个类操作pymongo'''
def __init__(self, url... | true |
bfe31f1772ca585323984a76e6ee5ba29fd243e6 | pwilthew/Systems-Security | /Heap-Spray-DEP/webserver.py | UTF-8 | 710 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python
#
# Python Web Server
# Serves only static files
#
# by Saumil Shah
import sys
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
port = 8080
class HandlerClass(SimpleHTTPRequestHandler):
# Disable DNS lookups
def address_string(self):
return str(self.client_address[0])... | true |
fda98daf5ec5535d5f9796b2418bfc74c389569a | cImentik/wsgi_simple | /models.py | UTF-8 | 7,989 | 2.765625 | 3 | [] | no_license | from core.base_model import DB
"""
Models classes.
Methods: all() - get all rows from table
get() - get rows with attributs filter (for Region and Comment - get One row)
as_dic() - present as a dictionary
delete() - delete row from table
__fix_kwargs() - fix values from kwargs for ... | true |
174245ba4bea3ae0140196fd6f6ea475c1862649 | Kira1108/rnn_play_around | /lstm_on_img_clf.py | UTF-8 | 1,525 | 2.53125 | 3 | [] | no_license | import os
from keras.models import Model
from keras.layers import Input, LSTM, GRU, Bidirectional,Lambda, Concatenate,Dense, GlobalMaxPooling1D
import keras.backend as K
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist... | true |
34dc03c4a6c6014221df8b0e086adb9dfe7e461e | umesh-timalsina/redshift | /redshift/model/model.py | UTF-8 | 8,132 | 2.765625 | 3 | [] | no_license | from tensorflow.keras import Model
from tensorflow.keras.layers import (Input, Conv2D, AveragePooling2D,
concatenate, Dense, PReLU, Flatten)
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.initializers import Constant
class RedShiftClassificationModel(Model):
def __in... | true |
56bad10ef35921faed8a8243690060518bf6547f | jiayiliu/photozGUI | /photozGUI/photozMVC.py | UTF-8 | 11,152 | 2.8125 | 3 | [] | no_license | """
Photo-z P(z) MVC module
=======================
"""
__author__ = 'jiayiliu'
import matplotlib
matplotlib.use('TkAgg')
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.figure import Figure
from os.path import isfile
import numpy as np
import Tkinter as Tk
fr... | true |
96f8f0858a1ca3f75e639aeed597e635120946e8 | dillonbck/drop7-ai | /main.py | UTF-8 | 1,641 | 2.59375 | 3 | [] | no_license | import eventmanager
import model
import view
import controller
from ai import AI
import logging
from optparse import OptionParser
import pygame
# Log Levels
# logging.DEBUG
# logging.INFO
# logging.WARNING
# logging.ERROR
# logging.CRITICAL
#LOG_LEVEL = logging.DEBUG
LOG_LEVEL = logging.INFO
logging.basicConfig(form... | true |
358cc17fe47b2004fb4e6124c7ec881671c657f1 | Alirsgp/mathFiles | /Math:Biology/MatrixTheoryPrograms/eigenValMax.py | UTF-8 | 1,274 | 3.78125 | 4 | [] | no_license | # Homework #1, code to find eigenvalues of 2x2 symmetric matrics with entries between -1 and 1.
import numpy as np
import random
from joblib import Parallel, delayed
import multiprocessing
from statistics import mean
import time
num_cores = multiprocessing.cpu_count()
avg = 0
iteration = range(100000)
eVals = []
... | true |
bc4686e2c81f1fe4252606d65d3065fae27bfb78 | prayasshrivastava/Hacker_rank | /string_split_join.py | UTF-8 | 52 | 2.84375 | 3 | [] | no_license | a=input()
a = a.split(" ")
b="-".joain(a)
print(b)
| true |
3932afd19a8eee2ffe575c2638048e272540b62b | fbserkov/praxis | /kent_beck/triangle.py | UTF-8 | 1,006 | 3.8125 | 4 | [] | no_license | # Test-driven development by example
# Section III: Patterns
# Mastering TDD
# How much feedback do you need?
import unittest
class TestTriangle(unittest.TestCase):
def test_equilateral(self):
self.assertEqual(1, self.evaluate(2, 2, 2))
def test_isosceles(self):
self.assertEqual(2, self.eval... | true |
516549306c464cd1b7deb7a911718dfa7f9e5ef4 | MarTecs/python-introducing | /尹成Python/day01plus/第二章习题/9.py | UTF-8 | 399 | 3.5625 | 4 | [
"Apache-2.0"
] | permissive | # -*-coding:utf-8-*-
# Author: sivan
# computer: notebook
# description: 风寒湿度
temperature = eval(input("Enter the temperature between -58 and 41:"))
speed_wind = eval(input("Enter the wind speed in miles per hour:"))
chill_index = 35.74 + 0.6215 * temperature - 35.75 * (speed_wind ** 0.16) + 0.4275 * temperature * (sp... | true |
1de1919b981b794c4a5643cca7fd99cb48107cac | weepwood/CodeBase | /Python/Exercise/计算天数.py | UTF-8 | 365 | 3.953125 | 4 | [] | no_license | # 求输入日期在该年中是第几天
import datetime
print(datetime.datetime.today().year) # 返回当前年份值
dtstr = input('Enter the datetime:(例如:20000907):')
dt = datetime.datetime.strptime(dtstr, "%Y%m%d")
another_dtstr = dtstr[:4] + "0101"
another_dt = datetime.datetime.strptime(another_dtstr, "%Y%m%d")
print(int((dt - another_dt).days) + 1)... | true |
5461829e45a326827e1d4c086f5aeba1a1aba7b2 | atarola/cards | /src/py/cards/connection_pool.py | UTF-8 | 2,408 | 2.9375 | 3 | [] | no_license |
import asyncio
from datetime import datetime, timedelta
from cards.game import Game
#
# ConnectionPool
# Handles all of the communications between the game simulation and the world.
#
class ConnectionPool(object):
def __init__(self):
self.game = Game()
self.input_queue = asyncio.Queue()
... | true |
4425b387b91876e7383e834147ab93b910c8b827 | alegaballo/CCI | /ch1/e1_6.py | UTF-8 | 705 | 3.84375 | 4 | [
"MIT"
] | permissive | # implement a method to perform basic string compression using the count of repeated characters
# aabcccccaaa -> a2b1c5a3
def string_compression(string):
compressed = []
cnt = 1
char = string[0]
for i in string[1:]:
if i==char:
cnt += 1
else:
compressed.append(c... | true |
57ecc9ff68b7dc6bf343d062e665cff1154b3ba5 | lilwilsond2/KeegansBot | /helper.py | UTF-8 | 433 | 3.078125 | 3 | [] | no_license | import json
import requests
def getJsonObjectsFromUrl(requestUrl) -> list:
apiData = requests.get(requestUrl).text
apiObjects = json.loads(apiData)
return apiObjects
def beautifyList(list):
output = list.pop(0)
for armorPiece in list:
output += "\n{}".format(armorPiece)
return outpu... | true |
58ecba8e02766638a5d30771f208b32765c53b81 | Rikuo-git/AtCoder | /other/aising2020/c/main.py | UTF-8 | 240 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python3
i = [0] * (10**5 + 1)
for x in range(1, 100):
for y in range(1, 100):
for z in range(1, 100):
i[x**2 + y**2 + z**2 + x * y + y * z + z * x] += 1
n = int(input())
print(*i[1:n + 1], sep="\n")
| true |
5f24f8c60c261ca2495eeaf30a56ae9044aa9ff8 | jayhsieh/credit-risk-ml | /divide_dataset.py | UTF-8 | 1,613 | 2.78125 | 3 | [] | no_license | import sys
import csv
data_file = sys.argv[1] or 'data.csv'
test_bucket = []
buckets = [
{ 'filename': 'data1.csv', 'rows': [] },
{ 'filename': 'data2.csv', 'rows': [] },
{ 'filename': 'data3.csv', 'rows': [] },
{ 'filename': 'data4.csv', 'rows': [] },
{ 'filename': 'data5.csv', 'rows': [] },
]
with open(data_f... | true |
e8d6e26b267ec49bddd7257c53ccc0e3906d09eb | bennettcm4/INFO450 | /Page84/Aliens.py | UTF-8 | 586 | 3.8125 | 4 | [] | no_license | # Caleb
# This will be page 84 assignment.
alien_color = 'red'
# green 5
# yellow 10
# red 15
def get_points(killed_color):
earned_points = 0
if killed_color == 'green':
earned_points = 5
elif killed_color == 'yellow':
earned_points = 10
elif killed_color == 'red':
earned_po... | true |
0718540ea855722698b84b228f270a871b900af7 | Jl5her/AdventOfCode | /2016/day-10/solution.py | UTF-8 | 1,340 | 2.96875 | 3 | [] | no_license | import re
registry = {}
def read():
with open('input.txt') as f:
return [line.rstrip() for line in f.readlines()]
return None
def process(steps):
new_steps = steps[:]
for step in steps:
if run(step):
new_steps.remove(step)
break
return new_... | true |
8303bc90d90bc0556a3f10c1f26207a9765971b6 | lchoward/Practice-Python | /Intervals/EraseOverlaps.py | UTF-8 | 1,922 | 4.0625 | 4 | [] | no_license | # Given a collection of intervals, find the minimum number of intervals you need to remove
# to make the rest of the intervals non-overlapping.
# Note: = are not considered overlapping (e.g., [0,1] and [1,2])
#
# Example 1:
# Input: [[1,2],[2,3],[3,4],[1,3]]
# Output: 1
# Explanation: [1,3] can be removed and the rest ... | true |
c08394acc60f61a0882c59ad944b654ce801ca5c | vino160898/LIST | /diagonal_value.py | UTF-8 | 131 | 2.875 | 3 | [] | no_license | l=[[10,20,30],
[40,50,60],
[70,80,90]]
total=0
for val in l:
total=total+val[i]
i+=1
else:
print(total)
#output:
#150
| true |
7bd7ff8dc604238f509d0ca7278ed02a013527ea | T-parrish/LeetCode | /strings/aToI.py | UTF-8 | 909 | 3.609375 | 4 | [] | no_license | # Solution 1 beats 99%
# Regex solution -> crawl past empty space to find the first group
# of numbers preceded by a + or - sign. If words or letters are first,
# This will not produce a match. If no match, return 0
# if there is a match, return whichever is smaller between
# the 32 bit integer and the matched number ... | true |
ccc53fa3d4fcd14b7d3174b522c10f1c6e7359b4 | brunoaibanez/rfid-david-prasad | /tag.py | UTF-8 | 1,393 | 2.640625 | 3 | [] | no_license | import numpy as np
import random
import logging
import logging.config
class Tag:
def __init__(self,id, pid, pid2, k1, k2):
self.logger = logging.getLogger(__name__)
self.logger.info('[Init] - Initializing Tag')
self.id = id
self.pid2 = pid2
self.k1 = k1
self.k2 = k2
... | true |
d747d6033f7f93a9a09064dfd49e8a238f4d0665 | vanloc04101995/c4e25-Labs_Nguyen-Van-Loc | /session2/dantri.py | UTF-8 | 964 | 2.953125 | 3 | [] | no_license | # urllib
from urllib.request import urlopen
from bs4 import BeautifulSoup
import pyexcel
from collections import OrderedDict
url = "https://dantri.com.vn/"
# 1.download the page
# 1.1. Mình với sever là 2 thằng xa lạ, mình phải kết nối vớ n, open connection
conn = urlopen(url)
# 1.2. Read data
raw_data = conn.r... | true |
f2d7d53af110be9380a3c7434b6a7b0910921e42 | psycho-pomp/CodeChef | /UTMOPR.py | UTF-8 | 260 | 2.84375 | 3 | [] | no_license | # cook your dish here
t=int(input())
for _ in range(t):
n,k=map(int,input().split())
l=list(map(int,input().split()))
if k==1:
if sum(l)%2==0:
print("odd")
else:
print("even")
else:
print("even")
| true |
fae0f5396f36fbf0881bbc080050e24686fe6df7 | Stanema/Python_test | /main.py | UTF-8 | 1,530 | 3.5625 | 4 | [] | no_license | import numpy as np
import random as rand
def osud(datum_narozeni):
x = datum_narozeni.split(". ")
den = x[0]
den = split(den)
mesic = x[1]
mesic = split(mesic)
rok = x[2]
rok = split(rok)
datum = den + mesic + rok
for i in range(0, len(datum)):
datum[i] = int(datum[i])
... | true |
e1c6222895552854be5cbf00d713e8ad4c653cc7 | mckib2/pygrappa | /pygrappa/examples/basic_grappaop.py | UTF-8 | 3,482 | 2.90625 | 3 | [
"MIT"
] | permissive | '''Basic usage of the GRAPPA operator.'''
import numpy as np
import matplotlib.pyplot as plt
from phantominator import shepp_logan
try:
from skimage.metrics import normalized_root_mse as compare_nrmse # pylint: disable=E0611,E0401
except ImportError:
from skimage.measure import compare_nrmse
from pygrappa im... | true |
0e1c3f60f788dcec41b5cb1b262506c7a833e3ce | chapeaute/playbooks | /etcd/templates/usr/local/sbin/etcd-backup-restore.j2 | UTF-8 | 691 | 2.765625 | 3 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | #!/bin/python
import etcd3
import json
import os
import argparse
import gzip
etcd = etcd3.client()
data = {}
parser = argparse.ArgumentParser()
parser.add_argument("-f", "--file", help="Backup file to restore")
args = parser.parse_args()
if not args.file:
print("Missing filename to restore\n")
parser.print_... | true |
b20f3ab0c76a2c77410d348b8082b9ed940817bd | ramon-ortega/Codigo_Clientes | /main.py | UTF-8 | 2,515 | 4.1875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import sys
clients = 'pablo,ricardo,'
def create_client(client_name):
""" Aqui creamos al cliente"""
global clients
if client_name not in clients:
clients += client_name
_add_comma()
else:
print('The name of client is repeated')
def updated_client(cl... | true |
a03c6d732b86f86f82396de2286992f9fa2d95cd | Shunderpooch/AdventOfCode2017 | /Day 5/Maze_of_Twisty_Trampolines_1.py | UTF-8 | 490 | 3.328125 | 3 | [] | no_license | import sys
JUMP_OFFSETS = []
with open("maze.txt", "r") as filestream:
for line in filestream:
JUMP_OFFSETS.append(int(line)) #Convert to int as we go
sys.stdout.flush()
CURRENT_INDEX = 0
NUM_STEPS = 0
while CURRENT_INDEX >= 0 and CURRENT_INDEX < len(JUMP_OFFSETS):
PREV_INDEX = CURRENT_INDEX
CUR... | true |
8d557c9c8cd0420d30b36c4c14f0dcd755304157 | fbeckman/sensordatamap | /getDweetAndWriteToCSV.py | UTF-8 | 935 | 2.796875 | 3 | [] | no_license | import json, requests
from time import sleep
import csv
getdata_url = 'https://dweet.io/get/latest/dweet/for/6f6ce443-341d-473a-b75f-eca547f87728'
with open('c:/temp/measurementdata.csv', 'w') as csvfile:
fieldnames = ['thing', 'created', 'temperature', 'humidity']
writer = csv.DictWriter(csvfile, del... | true |
3d4ab2328449aa3238949bfbe64d3b7fcafa7d86 | J-pcy/Jffery_Leetcode_Python | /Easy/653_TwoSumIV-InputisaBST.py | UTF-8 | 881 | 3.546875 | 4 | [] | no_license | """
Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target.
Example 1:
Input:
5
/ \
3 6
/ \ \
2 4 7
Target = 9
Output: True
Example 2:
Input:
5
/ \
3 6
/ \ \
2 4 7
Target = 28
Output: ... | true |
76a81a9037784e3ffab9859d2db6905a0852fbe6 | ra1zo/100-Days-of-Code | /Day-1/username_generator.py | UTF-8 | 1,199 | 3.28125 | 3 | [
"MIT"
] | permissive | from tkinter import *
from tkinter.ttk import Combobox
import random
from random import randrange
f_name = input('Enter Your First Name: ')
l_name = input('Enter Your Last Name: ')
dob = input('Enter Birth Year:')
screen = Tk()
screen.title("Username Generator")
screen.geometry("600x400")
screen.configure(backgroun... | true |
394430c2d9a14285917cd1786ecd5cd963479b77 | Agrebolledomu/Maibokun | /Tarea 0/main.py | UTF-8 | 386 | 3 | 3 | [] | no_license | import parametros
#Para utilizar los parámetros dentro de este archivo, tendríamos
#que llamarlo de la forma:
total_ships = parametros.NUM_BARCOS
print(total_ships)
from tablero import print_tablero
tablero_enemigo = [['X', ' ', 'X'],[' ', ' ', ' '],['F', ' ', ' ']]
tablero_propio = [['B', ' ', ' '],['B', ' ', ' '],... | true |
3174fdf2305ee16d16ebb8ceb9a0f00c051773d6 | oliver-glardon/UPM-Applied-Artificial-Intelligence | /Code/MAIN_FINAL.py | UTF-8 | 11,442 | 2.953125 | 3 | [] | no_license | # Group Information: Inteligencia Artificial Applicada, UPM
# .....
# Emiliano Capogrossi, M18029
# Oliver Glardon, 19936
# Sorelys Sandoval, M19237
# .....
# _______________________________________________________________________________________________________________________
# imports
import os
from scipy.io import ... | true |
d042ed3b90ccdde4daa90789c665548d9c52de09 | Ross04/id-cabinet | /core/pyrpmanager.py | UTF-8 | 5,512 | 3.578125 | 4 | [] | no_license | import operator as oper
import itertools as itr
#Stores relations between RPArrays in a tree like structure
rpa_tree = []
#Depreciated
rpa_dictionary = {}
class RPArray():
'''
Relative Position Array. Creates a grid of coordinates in 3D space whos
positions are defined by arbitrary size values.
'''... | true |
e1a864db3c15097b5625ee7eacb74b4d7a09e932 | DagnyTagg2013/Python-Heap | /Heaps/binheap.py | UTF-8 | 8,757 | 3.625 | 4 | [] | no_license | """
APPLICATION:
- track the 5 (LARGEST) elements coming from a stream of data with a LARGE volume of data that
cannot be all stored within memory, where say you have a MAX capacity of 10
SOLUTION:
- use a MIN HEAP to retain the 5 largest elements; while periodically paring out the MIN elements
when... | true |
3a6b9bd784d89b9a847cbfc86c0137713fdf38e2 | nag9s/Python_PostgreSQL_Developer_Course | /advanced-python/advance/build-in-methods.py | UTF-8 | 989 | 4.03125 | 4 | [] | no_license | class Currency:
def __init__(self, code, exchange_to_usd):
self.amount = 0.00
self.code = code
self.exchange_to_usd = exchange_to_usd
# Not necessary but interesting. in python we can do pounds.amount = 15
def set_amount(self, amount):
self.amount = amount
def in_curren... | true |
dd272e8ef5a18a0c3e9962fceabf806d2ef6677b | BenziAhamed/todo | /src/parser.py | UTF-8 | 4,512 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import re
from pprint import pprint
import sys
from dateutil.relativedelta import *
from dateutil.parser import parse as date_parse
from datetime import *
import helpers
def parse(text):
tag = None
task = text
pinned = False
clear_due = False
# check for pinned status
... | true |
bed9870f4214ddd6a34091b796b732e8ef7ac184 | yangxiaodong1/ygblcrm | /test/day9.4晚上2次/归并排序1.py | UTF-8 | 494 | 3.59375 | 4 | [] | no_license | def merger(arr,left,right):
i,j=0,0
result = []
while left<right:
if left <right and left[i]<right[j]:
result.append(left[i])
i+=1
else:
result.append(right[j])
j+=1
result +=left[i:]
result +=right[j:]
return result
def merger_so... | true |
99b554a2d5c992b8558b8aaaa95764d209884142 | tilmanbeck/DynamicWord2Vec | /visualization/tsne.py | UTF-8 | 2,037 | 2.640625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pickle
from sklearn.manifold import TSNE
import scipy.io as sio
import numpy as np
import json
from pprint import pprint
from scipy.spatial.distance import pdist
import os
import collections
import cPickle as pickle
def load_pickle(filename):
fp = open(filename, "rb")
re... | true |
29bd72f12dfe97d0ff7caedcd69ba8ba3ae39d27 | HarshineeSriram/Club-Recommendation-System | /minimal_recommendation_engine/new_user_clubs.py | UTF-8 | 599 | 2.8125 | 3 | [] | no_license | import pandas as pd
import collections
from collections import Counter
from ast import literal_eval
def global_club_recommendations() -> None:
all_student_memberships = pd.read_csv(r'./generated_csv_files/student_all_interests.csv')['clubs']
c = collections.Counter()
for clubs in all_student_memberships:
... | true |
0d3a5f2b7f7b8b8ffcac54f4972dea8f006d8242 | bingplease/something | /2016/stuff.py | UTF-8 | 475 | 3.453125 | 3 | [] | no_license | import sys
sys.setrecursionlimit(99999999)
def fibhelper(x, array):
if x == 0:
return 0
elif x == 1:
return 1
elif array[x] != -1:
return array[x]
else:
array[x] = fibhelper(x-1, array) + fibhelper(x-2, array)
print(array[x])
return array[x]
def betterfib(x):
array = ... | true |
bf9dd10e47ace98d76dfe07333e4f4f563324820 | parkinss/connectfour | /con4/logic.py | UTF-8 | 2,202 | 3.90625 | 4 | [] | no_license | """Connect 4 logic"""
from board import GameBoard
def check_lat_win (board:GameBoard, i, j):
#Check if the slot (i,j) corresponds to a win in the vertical direction
piece_count = 1 #keeps track of how many pieces are in a row of the same color, when it reaches 4 the game ends
piece = board.piece
pointer = ... | true |
5367a779d5652773660a3e4a14c74d98f2d5ce1e | EdenShuker/kaggle_Microsoft_malware_full | /join_ngrams.py | UTF-8 | 3,057 | 3.359375 | 3 | [] | no_license | import heapq
import math
import pickle
from collections import Counter
from csv import DictReader
def count_ngrams_performances():
"""
join all ngrams to one dictionary, which holds for every ngram
the number of files it appears in for every class.
:return: dict_all
"""
ngram_to_num_occurs = d... | true |
068f37bfa8b12000e71e70e655d2197ebee56d69 | gopa810/folio-python-html | /query.py | UTF-8 | 5,646 | 2.703125 | 3 | [
"MIT"
] | permissive | # system
import re
import unicodedata as ucd
# local
import conv
HLNone = 0
HLNormal = 1
HLBold = 2
AT_Sys = 0
AT_Text = 1
AT_Regexp = 2
AT_Group = 3
AT_Phrase = 4
AT_Or = 5
QueryTextScopeLen = 5
def NewTextAtom(s):
qa = QueryToken()
qa.Type = AT_Text
qa.Text = s
return qa
def NewS... | true |
5246127dce8184115644accef289464976a2e037 | saurabhKS14/CovidTwitterBot | /src/askCovid.py | UTF-8 | 3,094 | 3.03125 | 3 | [] | no_license | #importing all the necessary libraries and methods
from access import CONSUMER_KEY,CONSUMER_SECRET,ACCESS_TOKEN,ACCESS_TOKEN_SECRET , ACCOUNT_NAME
from textToInfo import *
from sheetApi import *
from pprint import pprint
import sys
import tweepy
from tweepy import Stream
from tweepy.streaming import StreamListener
imp... | true |
c4de1da9838c9893257469a1cd72969f95302ffb | DoomsdayDevice/onenote-to-org | /oto/utils.py | UTF-8 | 2,089 | 3.6875 | 4 | [] | no_license | import string
def remove_newlines(text):
return ''.join(text.splitlines())
def filter_html(text):
new_text = remove_newlines(text)
new_text = new_text.replace(' ', '')
# new_text = new_text.replace(''', "'")
return new_text
def get_substr(string, from_str, break_chars):
result = ""... | true |
57aa07769aa49da6d5285c71c64a936b3d48c777 | elendili/advent-of-code-2015-python | /day08.py | UTF-8 | 1,150 | 2.734375 | 3 | [] | no_license | #!/usr/bin/python -u
import sys, argparse
import re, math
parser = argparse.ArgumentParser("")
parser.add_argument('file', type=argparse.FileType('r'), nargs='?', default=sys.stdin,
help='input data for parsing')
args = parser.parse_args(sys.argv[1:])
# test_input = """"coykr\x57luiy""".split('\n'... | true |
28a810bd3fb06e56153e69163583897f28e951e8 | sayyamgatagat/coronasafe-fellowship-task | /todo.py | UTF-8 | 3,012 | 3.328125 | 3 | [] | no_license | import sys
import os
import datetime
def add_todo(task):
addfile = open("todo.txt", 'a')
addfile.write(task + '\n')
print("Added todo: " + f'"{task}"')
addfile.close()
def display():
try:
if os.stat("todo.txt").st_size > 0:
file = open("todo.txt", "r")
tasks = fil... | true |
cde32219908ecc941a07b8997e0a479c64eebe12 | zhouliuling/Leetcode_Task | /605.py | UTF-8 | 775 | 3.390625 | 3 | [] | no_license | ## 种花问题
## 分为前后2位和中间三位讨论,首尾都为0时可种花数+1,中间三个0时+1
class Solution(object):
def canPlaceFlowers(self, flowerbed, n):
"""
:type flowerbed: List[int]
:type n: int
:rtype: bool
"""
ll = len(flowerbed)
if ll == 1:
return 1-flowerbed[0] >= n
count =... | true |
89786a183c204eed339099e7e69f0962a311daf5 | anuragjain0610/synergy_task | /averaging.py | UTF-8 | 2,175 | 3.625 | 4 | [
"MIT"
] | permissive | # import the opencv module
import cv2
def frame_averaging(input_video_file, output_filename):
# create a capture object(file pointer) by loading the given video
# video file downloaded from [https://drive.google.com/file/d/1il2yWyr7-t9XfG1nDVL7QlfmnmNDf_9I/view?usp=sharing]
cap = cv2.VideoCapture(input_vi... | true |
d29530212cfa4dc723aa078ac2f9f36e15b02801 | aymane081/python_algo | /arrays/flipping_image.py | UTF-8 | 325 | 3.53125 | 4 | [] | no_license | # 832
class Solution:
def flip(self, matrix):
for row in matrix:
for i in range((len(row) + 1) // 2):
row[i], row[-1 -i] = 1 - row[-1 -i], 1 - row[i]
return matrix
solution = Solution()
matrix = [[1,1,0,0],[1,0,0,1],[0,1,1,1],[1,0,1,0]]
print(solution.flip(mat... | true |
3b6518eca4386a3bc2b8dbe6540307f87ebeb0f4 | SeanFxyz/cards-cli | /cards.py | UTF-8 | 9,986 | 2.65625 | 3 | [] | no_license | import requests, json, time, textwrap
from enum import Enum
class State(Enum):
LOBBY = 0
PROMPT = 1
SELECT = 2
DISPLAY = 3
def success(text):
lines = text.splitlines()
if lines.pop(0) == "SUCCESS":
return (True, "\n".join(lines))
return (False, "\n".join(lines))
def checkIntInput(... | true |
6ee57b272502dc3f774df64074a8051697268f4c | r00tnb/wheabck-console | /src/modules/exploit/file_system/touch/__init__.py | UTF-8 | 2,258 | 2.546875 | 3 | [] | no_license | r'''Modify the access time and modification time of a file or directory.
'''
from api.exploit import WebshellExploit, Cmdline
from api.webshell import WebshellSession, Webshell
from api import logger, utils
import argparse
import os
import json
import re
import base64
import time
class exploit(Webshell... | true |
ab36c97dc4c2b263d85e72c84e664acc83276430 | AndroidHot/MachineLearning | /MLFirstQuarter/one.py | UTF-8 | 387 | 3.46875 | 3 | [] | no_license | from sklearn import tree
# [140, 1] first data is weight, second data is the surface smoothness.
# O is apple, 1 is orange
features = [[140, 1], [130, 1], [150, 0], [170, 0]]
labels = [0, 0 , 1, 1]
clf = tree.DecisionTreeClassifier()
clf = clf.fit(features, labels)
print(clf.predict([135, 1]))
print(clf.predict([13... | true |
7a3c267c7ab276e4fe734c60739ccd2c112c4588 | RoddyJaques/fibre_stage_characterisation | /orthogonality.py | UTF-8 | 3,063 | 2.875 | 3 | [] | no_license | import picamera
from openflexure_stage import OpenFlexureStage
import numpy as np
from camera_stuff import get_numpy_image, find_template
import time
import h5py
from contextlib import closing
import data_file
def measure_txy(n, start_time, camera, templ8): #everything used in a definition should be put in as an argum... | true |
9b179a78764b56c5223b9c8555c86dfee61d2a32 | gordonbrander/chrome_icon_svg | /chrome_icon_to_svg.py | UTF-8 | 4,786 | 3.15625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
Quick-and-dirty script that converts Chrome .icon files into .svg files.
"""
import re
import argparse
from os import path
from xml.etree import ElementTree as ET
arg_parser = argparse.ArgumentParser(
description="Converts Chrome .icon files to .svg")
arg_parser.add_argument("icon_path",... | true |
9e0a58b7de719a261db6e98304592c82f19e4c7a | suboqi/-python | /ex19.py | UTF-8 | 1,047 | 4.375 | 4 | [] | no_license | # -*- coding:utf-8 -*-
#定义一个函数只接受两个参数
def cheese_and_crackers(cheese_count,boxes_of_crackers):
#打印
print("You have %d cheeses!" % cheese_count)
print("You have %d boxes_of_crackers!" % boxes_of_crackers)
print("Man that's enough for a party!")
#在需要在字符中使用特殊字符时,python用反斜杠(\)转义字符,\n代表换行
print("Get a blanket.\n")
#... | true |
b3e2ed3f2c74bbffa1a11679e484bb5e9c0dbb81 | Maeril/homework | /python_training/ml_bootcamp/day00/ex07/cost.py | UTF-8 | 3,100 | 3.09375 | 3 | [] | no_license | # **************************************************************************** #
# #
# ::: :::::::: #
# cost.py :+: :+: :+: ... | true |
22ff48531bc4336a6d983d9fc0bdb3252df6e04a | Kmmanki/bit_seoul | /ml/m13_kfold_estimators1.py | UTF-8 | 7,895 | 2.78125 | 3 | [] | no_license | #분류
import pandas as pd
from sklearn.model_selection import train_test_split,KFold,cross_val_score
from sklearn.metrics import accuracy_score
from sklearn.utils.testing import all_estimators
import warnings
warnings.filterwarnings('ignore')
iris = pd.read_csv('./data/csv/iris_ys.csv', header=0, index_col=0)
x= iris... | true |
412879338a7cf39594c11674d67fa73e8198db44 | bhy06/Opencv_python | /ObjectDetection/yolo_demo.py | UTF-8 | 2,311 | 2.546875 | 3 | [] | no_license | import cv2
import numpy as np
conf_threshold = 0.5
nms_threshold = 0.2
cap = cv2.VideoCapture(0)
whT = 320
# Get 80 class names
class_names = []
class_file = "coco_yolo.names"
with open(class_file, "rt") as f:
class_names = f.read().rstrip("\n").split("\n")
model_config = "yolov4-tiny.cfg"
model... | true |
42511dd3c2a407fc7186b83ed7723c14a23ddfbb | personalrobotics/magipy | /src/magi/planning.py | UTF-8 | 20,937 | 2.8125 | 3 | [] | permissive | """MAGI planners."""
from abc import abstractmethod
from contextlib import contextmanager
import logging
import random
import signal
import sys
import networkx as nx
import numpy as np
from magi.actions.Parallel import ParallelAction
from magi.actions.Sequence import SequenceAction, SequenceSolution
from magi.action... | true |
646046bf3bd095d0835d659748c9bdb5fceafc75 | yasminelsawy/Fallback-DFA | /task_3_1.py | UTF-8 | 4,708 | 2.703125 | 3 | [] | no_license | import re
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(
add_help=True, description='Sample Commandline')
parser.add_argument(
'--dfa-file',
action="store",
help="path of file to take as input to construct DFA",
nargs="?",
... | true |
25d6b1a14637a14abeaa106b4babd4bb3f8001c7 | johnkommas/hands_on_python_katartisi.gr | /LESSONS/01. Syntax/09. Changing Numbers.py | UTF-8 | 1,408 | 3.484375 | 3 | [
"MIT"
] | permissive | # Copyright (c) 2021. Ioannis E. Kommas. All Rights Reserved.
coffee_price = 1.50
number_of_coffees = 4
print(coffee_price * number_of_coffees) # Prints "6.0"
print(coffee_price) # Prints "1.5"
print(number_of_coffees) # Prints "4"
# Updating the price
coffee_price = 2.00
print(coffee_price * number_of_coffees)... | true |
15823223888f150a2856bcef2f694c231f36e68e | poduszeczka3/JSP2019 | /lista7/zad1l7.py | UTF-8 | 571 | 4.375 | 4 | [] | no_license | # Wersja z pętlą for
n = int(input("Ile wyrazów ciągu Fibonacciego chcesz zobaczyć? "))
print()
n1, n2 = 0, 1
if n < 0:
print("Spadaj śmieciu!")
elif n==0: print(n1)
elif n==1: print(n2)
else:
for i in range(1,n+1):
nth = n1 + n2
n1 = n2
n2 = nth
print(n1)
i += 1
# Wersj... | true |
30ec9332c0af67092c69d8c6c6ac3ead63804aa9 | aistairc/qunomon | /ait_repository/ait/dev_template_local_docker_0.1/tool/ait_deploy/container/ait_deploy.py | UTF-8 | 3,115 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright c 2019 National Institute of Advanced Industrial Science and Technology (AIST). All rights reserved.
#!/usr/bin/env python3.6
# coding=utf-8
import os
import requests
import time
import shutil
from pprint import pprint
from pathlib import Path
from ait_sdk.test.hepler import Helper
backend_entry_point = ... | true |
b859a48f20456a602ac4f0c964c90efaa9668f78 | jazermarie/JLabs | /PythonBeginnersExercises/ListOverlapComprehension/ListOverlapComprehension.py | UTF-8 | 288 | 3.703125 | 4 | [] | no_license | # Import random module
import random
# Generate a list randomly
a = random.sample(range(50), random.randint(3,10))
b = random.sample(range(50), random.randint(3,10))
# Create a new list of the common numbers of the list above
c = [num for num in a if num in b]
print a
print b
print c
| true |
5aabe9b76d273351a3e4ebd102613b63da2aeea0 | SachinVesit/audio_to_text | /speechRecord/record2.py | UTF-8 | 866 | 3.078125 | 3 | [] | no_license | import speech_recognition as sr
print(sr.__version__)
r = sr.Recognizer()
file_audio = sr.AudioFile('hello.wav')
with file_audio as source:
audio_text = r.record(source)
print(type(audio_text))
file = open("record.txt","w")
file.write(r.recognize_google(audio_text))
file.close()
f1 = open("record.txt", 'r')
f2 =... | true |
3e9d79af36f125522666977dd8eb670550f62d84 | desenfirman/rice-seeds-classification | /python_based_app/main.py | UTF-8 | 5,230 | 2.796875 | 3 | [] | no_license | import kivy
import json
import math
import os
import cv2
from module.image_detection import ImageRecognition
from kivy.app import App
from kivy.factory import Factory
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
from kivy.uix.floatlayout import FloatLayo... | true |
a4abefb4d5157aed65be335907e11c520c1a4634 | jthom143/age_oxygen_project | /code/figure_code/linew_model_age_o2_contour.py | UTF-8 | 2,430 | 2.578125 | 3 | [] | no_license | ################################################################################
# Model Data
################################################################################
import iris
import iris.quickplot as qplt
import iris.analysis.stats
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.appe... | true |
e82c492d69bff4c19b3ddf2a15e8e16c697a1724 | Gitznik/Albsig | /classes/classes.py | UTF-8 | 1,416 | 3.90625 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[4]:
class StudentIn():
"""
Speichert die Daten einer Student*in.
Attribute: ...
Methoden: ...
"""
arbeitsmoral = "Hervorragend"
def __init__(self, vorname, nachname, noten):
self.vorname = vorname
self.nachname = nachname
... | true |
cda45bd10baf3618fcd011322c797c8616ac52df | JacobT/Maze-Generator | /mazegenerator.py | UTF-8 | 3,597 | 3.875 | 4 | [] | no_license | import random
import time
from collections import deque
class MazeNode:
def __init__(self, row, column):
self.name = "node"
self.coords = (row, column)
self.visited = False
self.adjacent = {"north": None,
"south": None,
"west": No... | true |
d5fa65926c7ed7da95f71d01bfb638a451b316bb | xiao2mo/script-python | /app_label.py | UTF-8 | 1,307 | 2.5625 | 3 | [] | no_license | #coding: utf8
import sys
import re
def load_dict(fname):
d = {}
with open(fname, 'rb') as fin:
for line in fin:
line = line.rstrip('\n')
toks = line.split('\t')
term, tag = toks[0], toks[1]
uterm = term.decode('utf8')
d[uterm] = toks[1]
sy... | true |
25e5b1f07e1ea8f1637454ba9d41070a6cb4d4d4 | Keerthijan3/scheduler-app | /src/Components/services/RunAlgo.py | UTF-8 | 852 | 3.484375 | 3 | [] | no_license | import itertools
def cost(arr, employees):
length = len(arr)
val = 0
for i in range(0, length):
employee = employees[arr[i]] #returns employee selected at position i
priority = employee.priority or 1
preference = employee.preference
choice = preference[i] #did he get his top... | true |
b72a8495574933c1b7237afd12b944c6d3403e68 | JMH201810/Labs | /Python/p01320k.py | UTF-8 | 802 | 4.3125 | 4 | [] | no_license | # k. Unchanged Magicians:
# Make a copy of your program from part (j).
# Call the function make_great() with a copy of the list of magicians' names.
# Because the original list will be unchanged, return the new list and store
# it in a separate list.
# Call show_magicians() with each list to show that you have... | true |
834a41022af294e65252915c3bba518f1a42580c | lbyg1003/pricing-service | /models/store.py | UTF-8 | 1,391 | 3.109375 | 3 | [] | no_license | import re
import uuid
from typing import Dict
from dataclasses import dataclass, field
from models.model import Model
@dataclass()
class Store(Model):
collection: str = field(init=False, default="stores")
name: str
url_prefix: str
tag_name: str
attrs: Dict
_id: str = field(default_factory=lamb... | true |
1e1eb785c58fa4281bad76424bfc6b2324ad55d6 | W3ddl3Q5/ubiquitous-guacamole | /Python Files/TemperatureSensor.py | UTF-8 | 306 | 3.59375 | 4 | [] | no_license | room1 = [20, 21, 23, 25, 22]
room2 = [27, 23, 25, 20, 30, 24]
room3 = [22, 23, 24, 22]
measurement = [room1, room2, room3]
for room in measurement:
total = 0
for temp in room:
total += temp
avg = total / len(room)
print("Average temperature in room {} is {:.1f}".format(room ,avg)) | true |
b7acd23168a4cac8d3afab25692d93f940e90c97 | nayr31/Connect4 | /BoardManip.py | UTF-8 | 17,434 | 3.734375 | 4 | [] | no_license | # This file is for anything that relates to the board. The main program should not know what it needs to do, only what it wants to.
# This could just be my Java seeping into my Python, but this is how I like it.
from PVector import PVector
import random
# Constants
width, height = 7, 6
top_string = "+ 0 1 2 3 4 5 6 "... | true |
1fe98eb88ae93ecdd5a6c8a6b7cf442054259475 | ripplesaround/ML4E | /聚类/GMM_EM/GMM.py | UTF-8 | 6,319 | 2.609375 | 3 | [
"MIT"
] | permissive | # coding=utf-8
'''
Author: ripples
Email: ripplesaround@sina.com
date: 2020/3/11 22:19
desc:
'''
import sys
sys.path.append('../')
import copy
import data_process
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import multivariate_normal
from sklearn import metrics
# 考虑用k-means迭代后的center来更新结果
K... | true |
d1831773c58b3dca8e20769e3249e23446296873 | zzz136454872/leetcode | /evaluateTree.py | UTF-8 | 544 | 3.09375 | 3 | [] | no_license | from typing import Optional
from pytree import TreeNode
class Solution:
def evaluateTree(self, root: Optional[TreeNode]) -> bool:
if root.left is None and root.right is None:
return root.val == 1
if root.val == 2:
return self.evaluateTree(root.left) or self.evaluateTree(
... | true |
45915052389b595361ca73c496501063f67b99b7 | publu/pixelmap.io | /pixelmap_service.py | UTF-8 | 907 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
from functions import (get_contract, render_full_image)
import gevent
import random
from render_tile import render_tile
from render_html import render_html
from render_all_tiles import render_all_tiles
# Connect to Servers
contract = get_contract()
# Refresh all
print "Re-rendering eve... | true |
34a723383fd3a725b6b0d04a2b60e68ee2c7cd5d | kellyortiz/Defense-of-mind-sad | /Bolinhas/test_bolinhas.py | UTF-8 | 780 | 2.9375 | 3 | [] | no_license | import bolinhas
import unittest
import pygame
class TestBolinhas(unittest.TestCase):
def test_criar_bolinha(self):
pygame.init()
screen = pygame.display.set_mode((800, 650), 0, 0)
img = pygame.image.load('fear.png').convert_alpha()
b = bolinhas.criar_bolinha(5, 3, img)
... | true |
81b2b059e0647bc415f727dd5077b7888e32f6b2 | tschibu/hslu-dl4g | /doc/tschinux-Ineichen_Steve_Schwarzentruber_Remo/deep_learning_player.py | UTF-8 | 3,904 | 2.890625 | 3 | [
"MIT"
] | permissive | import numpy as np
import tensorflow as tf
from jass.base.const import color_masks
from jass.base.player_round import PlayerRound
from jass.player.player import Player
from tensorflow.keras.models import load_model
class DeepLearningPlayer(Player):
"""
Deep learning implementation of a player to play Jass.
... | true |
300ea3e6c5de3c9955466f27f467e2f939e4c58e | jtemplon/stock-exchange-app | /app/models.py | UTF-8 | 4,042 | 2.5625 | 3 | [] | no_license | from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from datetime import datetime
from time import time
from app import app, db, login
from hashlib import md5
from sqlalchemy.ext.hybrid import hybrid_property, hybrid_method
import jwt
@login.user_loader
def load_... | true |
448755e97a9c385f5d839c5bee9ec32235ac1bdc | kgarmtz/GeneticAlgorithm | /utils.py | UTF-8 | 13,806 | 3.1875 | 3 | [] | no_license | import math
import random
from typing import Text
""" This function returns back the extension and the file name of the given path """
def getFileExtension(file_path):
snippets = file_path.split('/')[-1].split('.')
fname = snippets[0]
ext = snippets[1]
return (fname, ext)
""" This function takes in an... | true |
9b2c0c01cd3b1582d66886c9ea269a9367bd5545 | bace1920/10daysWeb | /tendaysweb/exceptions.py | UTF-8 | 428 | 2.71875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from.utils import STATUS_CODES
class HttpException(Exception):
def __init__(self, err_code: int, err: str=''):
self.err_code = err_code
self.err = err if err else STATUS_CODES.get(err_code, 'Unknown Error')
class UnknownSignalException(Exception):
def __init__(self, s... | true |
3db96b750f382cfba1930cc1750fd1fa47027843 | henrytien/henry-notes | /src/python/cs2proto.py | UTF-8 | 10,596 | 2.75 | 3 | [] | no_license | def delete_constructor(file, old_str, new_str):
"""
替换文件中的字符串
:param file:文件名
:param old_str:就字符串
:param new_str:新字符串
:return:
"""
newstr = old_str
file_data = ""
with open(file, "r", encoding="utf-8") as f:
it = iter(f)
for line in it:
if old_str in ... | true |
edf3e53b63f21293f12d0ba8f53a5228c823d812 | Sergio05Rule/ML | /Regression_MatrixForm/Validation.py | UTF-8 | 3,341 | 2.9375 | 3 | [] | no_license | from math import ceil
from Regression import Regression
import Preprocessing
import Input
import pandas as pd
def _KFolds_Validation(dataset, X_indeces, Y_indeces, k):
folder_dim = ceil(len(dataset)/k)
folder_boundaries = list()
start = 0
while start < len(dataset):
end = start + folder_dim
... | true |
663932e91543c79386d2e6616526a15a6bdaf9c1 | jpsalviano/ATBSWP_exercises | /chapter9/findLargeFiles.py | UTF-8 | 1,954 | 3.84375 | 4 | [] | no_license | #! /usr/bin/python3
# This code is my solution to Practice Project: Deleting Unneeded Files in the book Automate the Boring Stuff with Python by Al Sweigart
# findLargeFiles.py - Search for files larger than a user determined size in a folder tree and print their absolute paths.
# Usage: findLargeFiles.py <folder> <siz... | true |
20a94addfeba013e87fd9141f9e91733b4f0b73e | wonbeomjang/cyclegan-pytorch | /download_dataset.py | UTF-8 | 1,526 | 2.53125 | 3 | [
"MIT"
] | permissive | import os
import argparse
import shutil
from glob import glob
from utils.utils import download_url, unzip_zip_file
parser = argparse.ArgumentParser()
parser.add_argument('--style', type=str, default='monet2photo', help='the path of image data set')
args = parser.parse_args()
urls = {'monet2photo': 'https://people.eec... | true |
cd749bbb57ba3801663779593ddfe96a632e8830 | jstac/cycles_moral_hazard | /code/integrated_econ.py | UTF-8 | 3,005 | 3.21875 | 3 | [
"BSD-3-Clause"
] | permissive | """
The main file for the two country economy containing basic class
and functions.
"""
import numpy as np
import random
from scipy.optimize import brentq
from scipy.optimize.minpack import fixed_point
class Country:
def __init__(self, w, gamma=0.5, alpha=0.66, z=20, p=0.2):
# == Current wage == #
... | true |
d5ce35eb7b3fa92e264dfc9166d82f5c0ebfaa1f | CamilaGO/RT1_Graficas | /raytracer.py | UTF-8 | 2,757 | 3.015625 | 3 | [] | no_license | from lib import *
from sphere import *
from math import pi, tan
from materials import *
# ===============================================================
# Paula Camila Gonzalez Ortega - 18398
# ===============================================================
BLACK = color(0, 0, 0)
WHITE = color(255, 255, 255)
BLUE = ... | true |
956da5df343e9e94e4bc8ed789f7f8c17f048dec | FabianForsman/Chalmers | /TDA548/Exercises/week6/src/exercises/ex3theory/InheritenceAndTypes.py | UTF-8 | 749 | 3.109375 | 3 | [] | no_license | # package exercises.ex3theory
from abc import ABC
# See:
# - inheritance
# - types
# - override
#
# Uncomment each row in turn and explain why the row gives a warning or not.
def test_subtypes_program():
ia: IA = A()
ia = B()
ia = C()
ia = D()
ia = E()
a: A = A()
a = B()
a = C()
a... | true |
3ef07d195003ddd01a9e3b48198daf898bbb9f2f | tongue01/pyfmu | /tests/builder/test_generate.py | UTF-8 | 1,499 | 2.546875 | 3 | [] | no_license | from os.path import join, exists, isdir, isfile
import os
import json
from tempfile import TemporaryDirectory
from pathlib import Path
from pybuilder.builder.generate import create_project
class TestGenerate():
def test_returnsProject_pathsAreCorrect(self, tmpdir):
tmpdir = Path(tmpdir)
p = cr... | true |
f63a8adf6fdcad81f7190de7700c766fbca55304 | philiptzou/tsuru-deb | /node-hipache-deb/hipache/test/test_parseerror.py | UTF-8 | 3,538 | 2.703125 | 3 | [
"MIT"
] | permissive |
import os
import time
import signal
import socket
import logging
import SocketServer
import base
logger = logging.getLogger(__name__)
class BaseTCPHandler(SocketServer.BaseRequestHandler):
def generate_response(self, size):
""" This generates a wrong HTTP request, Content-Length is higher
... | true |
abd7742dce81beda7bf6524ace01fadc9aa40b5d | zerebom/0419_middlebury_FCNN | /util/loader.py | UTF-8 | 8,434 | 3.09375 | 3 | [] | no_license | import numpy as np
import glob
from PIL import Image
import os
directory_path = r'C:/Users/k-higuchi\Desktop\LAB2019\2019_04_10\Middle_Data\quarter_resolution\MiddEval3-data-Q\MiddEval3\trainingQ'
class Loader(object):
def __init__(self, directory_path, init_size=(128, 128), one_hot=False):
#返り値は... | true |
e37d8e59c3db1d04738ea992b7211f1655b9949e | pflun/advancedAlgorithms | /minNumberOfFrogs.py | UTF-8 | 2,050 | 2.921875 | 3 | [] | no_license | class Solution(object):
def minNumberOfFrogs2(self, croakOfFrogs):
c = r = o = a = k = 0
watermark = 0
for ch in croakOfFrogs:
if ch == 'c':
c += 1
watermark = max(watermark, c - k)
elif ch == 'r':
r += 1
eli... | true |
ec49ea70ff991a8d107b9bf0363ffda4ca4bac94 | swkonz/cs221FinalProject | /linear_regression.py | UTF-8 | 660 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python
import pickle
import numpy as np
left_features = pickle.load(open("leftFeatures.p", "rb"))
right_features = pickle.load(open("rightFeatures.p", "rb"))
def linearRegression(features):
feat_len = len(features[0][0])
weights = np.random.rand(feat_len)
T = 10000
eta = 0.00001
def trainLoss(w)... | true |
4c8871fbec0a8dbc1410621d8c14f6c04274fcef | elijahtai14/CS33aTeachingMaterials | /section6/sel+unittest/test.py | UTF-8 | 863 | 2.953125 | 3 | [] | no_license | import unittest
from selenium import webdriver
browser = webdriver.Firefox()
path = "Users/apple/Desktop/CSE33A/CS33aTeachingMaterials/section6/sel+unittest/"
browser.get("file:///" + path + "index.html")
class SwitchTest(unittest.TestCase):
def test1(self):
"""Title"""
self.assertTrue("Some pa... | true |