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 |
|---|---|---|---|---|---|---|---|---|---|---|
691f409c3b7da0fcccad6d14106141d6eec6cb92 | BartosZimonczyk/Methods-of-Classification | /Movies_project/recom_system_298754_300248.py | UTF-8 | 12,707 | 2.734375 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.decomposition import NMF, TruncatedSVD
import sklearn.model_selection as ms
import argparse
import warnings
from numba import jit, njit, vectorize
warnings.filterwarnings('ignore')
parser = argparse.ArgumentParser(
description='Method to complete Z matrix with ... | true |
7e959267799f3764943b49f218d669a583bb2edf | zmzhydron/python | /2.py | UTF-8 | 2,797 | 3.59375 | 4 | [] | no_license | # -*- coding:utf-8 -*-
#daytwo
from functools import reduce
#迭代
#dict 类似于js的对象
me = {"name": "zmz", "age": 34, "sex": "male"}
for d in me.values():
# print('打印出来的是dict的值: %s' %d)
pass
for d in me:
# print('打印出来的是dict的键: %s' %d)
pass
for key, value in me.items():
# print('同时打印出来的是dict的键和值: %s %s' %(key,va... | true |
23055efcdb54fb0f2f0afa82f3e22eafbeda0a78 | kimmyoo/python_leetcode | /2.SET/single_number/solution.py | UTF-8 | 1,246 | 3.640625 | 4 | [] | no_license | class Solution(object):
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
set1 = set()
set2 = set()
# first round
# adding unique ele into set
# then remove unique elements(rest in list are repeating elements)
for ... | true |
5fabf5e71c8b51ca05c5e6d0772bb32d20bf398f | JohanWranker/advent-of-code-2020 | /python/day07.py | UTF-8 | 1,494 | 2.9375 | 3 | [
"MIT"
] | permissive | import os
import re
print("day07")
path = "input"
if not os.path.exists(path):
print(" File not exist ", os.path.abspath(path))
exit(1)
bagTable = {}
groups = [x.split("\n") for x in open(path).read().split("\n\n")]
# print(groups)
def addTuples(tt):
tup = []
m = re.match(r"(\d)\s(.*?),\s(.*)", tt)
... | true |
0991919a825fc3d524c8ef8289c9c94e3c6ccf15 | petercorke/robotics-toolbox-python | /roboticstoolbox/examples/twistdemo.py | UTF-8 | 3,199 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
@author Peter Corke
@author Jesse Haviland
"""
import sys
import swift
from math import pi
import roboticstoolbox as rtb
from spatialgeometry import Mesh, Cylinder
from spatialmath import SO3, SE3, Twist3
import numpy as np
# TODO
# rotate the rings according to the rotation axis, so that t... | true |
3d8c6e7bd3b1e936cfc760527ad07e8a4b2b734a | Jamal-Ra-Davis/pov_display | /Misc/button_mapper.py | UTF-8 | 3,952 | 2.703125 | 3 | [] | no_license | from __future__ import print_function
from inputs import get_gamepad
import time
keys_dict = {}
def main():
cnt = 0
prev_x = None
prev_y = None
prev_z = None
while cnt < 10000:
#print("Hi")
events = get_gamepad()
for event in events:
#if (event.ev_type == 'Key')... | true |
55804e2e3b26636c25ad3661f0409b4e830978c8 | lordzth666/AutoShrink | /api/network/Parser.py | UTF-8 | 1,805 | 3 | 3 | [] | no_license | def RemoveListBrace(xstr):
if xstr is None:
return None
res = ""
for l in xstr:
if l != '[' and l != ']':
res += l
return res
def ConvertAsType(var, dtype):
if var == "None":
return None
if type(dtype) == bool:
if var == "True":
return Tru... | true |
a8d2c43c028adae72975fa19c3d845111dabd43c | kathy-lee/astyx-pcdet | /pcdet/datasets/astyx/object3d_astyx.py | UTF-8 | 8,281 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import math
class Object3dAstyx(object):
def __init__(self, dimension3d, score):
self.h = dimension3d[2]
self.w = dimension3d[0]
self.l = dimension3d[1]
self.loc = [None]*3
self.orient = [None]*4
self.score = score
self.src = {}
se... | true |
f3334d2a3c50be6b8b49ae3f31620b6188dccb68 | RahulJ0shi/FaceRec | /gui_messages.py | UTF-8 | 867 | 3.203125 | 3 | [] | no_license | import tkinter as tk
def greet_user(name,f):
popup = tk.Tk()
windowWidth = popup.winfo_reqwidth()
windowHeight = popup.winfo_reqheight()
positionRight = int(popup.winfo_screenwidth()/2 - windowWidth/2)
positionDown = int(popup.winfo_screenheight()/2 - windowHeight/2)
popup.geometry("440... | true |
3b84c68119ef6696d6bfdc8f34771f9ccda55a22 | Ferveloper/python-exercises | /KC_EJ29.py | UTF-8 | 887 | 4.03125 | 4 | [] | no_license | #-*- coding: utf-8 -*
def average(array):
return int(round(sum(array) / len(array), 0))
people = list()
i = 0;
while True:
people.append({})
people[i]['name'] = raw_input('Introduce el nombre de la persona (o escribe "terminar" para finalizar): ')
if (people[i]['name'] == 'terminar'):
pe... | true |
d7da9ba2f9ebf69c77e4427535df2d90ec8ae72f | shapiromatron/bmds | /bmds/bmds3/types/ma.py | UTF-8 | 2,184 | 2.515625 | 3 | [
"MIT"
] | permissive | import numpy as np
from pydantic import BaseModel
from .continuous import NumpyFloatArray
from .structs import DichotomousMAStructs
class ModelAverageResult(BaseModel):
pass
class DichotomousModelAverageResult(ModelAverageResult):
"""
Model average fit
"""
bmdl: float
bmd: float
bmdu: ... | true |
8c9aa8c9eeaee3e7fa78850508ee3f723e9a1a3c | nikitchm/imagemp | /imagemp/shared_frames/misc.py | UTF-8 | 994 | 3.203125 | 3 | [
"MIT"
] | permissive | import ctypes
import multiprocessing as mp
class MPValueProperty(object):
# UNUSED at the moment
# !The intent was to substitute the getters and setters for the mp.Value variables.
# The innate limitation of the desrtiptors is that the variables of this class can only be
# class variables, not instanc... | true |
fba9725a8ab05ba8865fc98d9cbf716352f6d10e | nguyenthaibinh/pytorch_time | /src/datasets/dataset.py | UTF-8 | 868 | 2.59375 | 3 | [] | no_license | import torch as th
from pathlib import Path
import numpy as np
from torch import FloatTensor
class Dataset(th.utils.data.Dataset):
def __init__(self, data_dir, subset='train', debug=False):
data_path = Path(data_dir, f'{subset}.npz')
data = np.load(data_path)
self.X = data['x']
self... | true |
2d1b77f4e3f9ff4c6c0c6c4b302b70ae0b60c08e | geraldlcpd/cp1404_practicals | /prac_01/shop_calculator.py | UTF-8 | 546 | 4.3125 | 4 | [] | no_license | """
Program for entering discount information after user inputs how many items and how much are each
"""
num_items = int(input("Number of Items: "))
while num_items < 0:
print("Invalid Input. Please Try again")
num_items = int(input("Number of Items: "))
total_price = 0
for i in range (0,num_items,1):
ite... | true |
6b29db7806a6aa62f91f90beeb663a25cf9f8da1 | jordanlau123/wallstreetbets_sentiment_analysis | /src/functions.py | UTF-8 | 8,455 | 2.6875 | 3 | [
"MIT"
] | permissive | import pandas as pd
import praw
from praw.models import MoreComments
from nltk import FreqDist
import nltk
from collections import defaultdict
from collections import Counter
#nltk.download('wordnet')
from nltk.sentiment.vader import SentimentIntensityAnalyzer as SIA
import spacy
nlp = spacy.load("en_core_web_sm", dis... | true |
35269585fa3e285b7f6e6cc9343a02cf3007a680 | marvellouz/fmi_projects | /python/p2-sample.py | UTF-8 | 1,932 | 3.359375 | 3 | [] | no_license | import unittest
from p2 import reduce, groupby, construct, curry, compose
class Problem2Tests(unittest.TestCase):
def test_reduce_simple(self):
self.assertEquals(15, reduce(lambda x, y: x + y, [1, 2, 3, 4, 5]))
def test_reduce_init(self):
self.assertEquals(10, reduce(lambda x, y: x + y, [2, 3... | true |
fe706e144bdb34066c18aaa8390981d704337533 | EricLi404/nb | /leetcode/sequence/4.median-of-two-sorted-arrays.py | UTF-8 | 438 | 3.3125 | 3 | [
"MIT"
] | permissive | class Solution:
# def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
def findMedianSortedArrays(self, nums1, nums2) -> float:
n = nums1 + nums2
n.sort()
l = len(n)
return n[l // 2] if l % 2 == 1 else (n[l // 2] + n[l // 2 - 1]) / 2
if __name__ == '__... | true |
38b85797e320f8360c9788f0f4b5d77cfd041d0b | SergioGarcia1/SergioGarcia1.Github.io | /Python/Actividad9.py | UTF-8 | 84 | 2.875 | 3 | [] | no_license | def generar (veces, numero):
return veces * numero
print(generar(2,'e'))
| true |
4867c5a73dcab9f7d35900905d39b973e8cfb975 | jfvilleforceix/BenchmarkRugby | /DB Python/drive/src/ihm/fenetreAppli.py | UTF-8 | 46,467 | 2.640625 | 3 | [] | no_license | '''
@author: Sibawaih Er-razki, Cédric Menut et Jean-françois Villeforceix
'''
# -*- coding: Latin-1 -*-
from tkinter import *
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.messagebox as messagebox
import metier.employe as employe
import metier.exceptions as excpMetier
import bdd.exceptions as excpBdd... | true |
91fe6b17095047c8f471eab93817369c620ff339 | xiaochenchen-PITT/Leetcode | /Python/Power of Two.py | UTF-8 | 341 | 3.28125 | 3 | [] | no_license | class Solution(object):
def isPowerOfTwo(self, n):
if n <= 0:
return False
while n != 1:
if n % 2 != 0:
return False
n /= 2
return True
def isPowerOfTwo2(self, n):
# bit manipulation
if n <= 0:
return False
bitCount = 0
while n > 0:
bitCount += n & 1
n >>= 1
return True if bit... | true |
31f8cd18e21de82065770922340c9fa6d360eeec | rn1k/compe | /beginner/2-2/4-coin.py | UTF-8 | 342 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# p.42 貪欲法
global V, C, A
V = [ 1, 5, 10, 50, 100, 500 ]
# data
C = [ 3, 2, 1, 3, 0, 2 ]
A = 620
def main():
global A
ans = 0
for value, n in reversed(list(zip(V, C))):
t = min( A // value, n )
A -= value * t
ans += t
print(ans)
if __name__ == '__main... | true |
2bbd91be87d0122df1b6adffaf12aec646d8d2af | senyuuri/wireless-activity-tracker | /hw4/receiver.py | UTF-8 | 4,007 | 2.765625 | 3 | [] | no_license | import numpy
import math
import paho.mqtt.client as mqtt
from datetime import datetime
import json
import atexit
# Global states
floor_change = False
indoor = True
idle = True
# Received data
acc_data = []
baro_data = []
light_data = []
temp_data = []
humid_data = []
# Sliding window size
ACC_WINDOW = 100
BARO_WINDO... | true |
b53de5ee4b41f62fa9204674b022e130e0767f41 | bda2291/RSOI_LW1 | /dropbox.py | UTF-8 | 2,470 | 3.03125 | 3 | [] | no_license | import flask
import requests
import json
import webbrowser
choise = ""
client_id = "fpoobzspmsnfm02"
client_secret = "l2ig8e7dcz51jhc"
redirect_uri = "http://127.0.0.1:5000"
access_token = " "
base_url = "https://api.dropboxapi.com/1/"
base_url1 = "https://api.dropboxapi.com/2/"
base_url2 = "https://www.dropbox.com/1/... | true |
3bffb090b32d7bd9d27a5d6c15137cf6ef0709fe | Lzejie/features-extracter | /extracter/tfidf/tfidf.py | UTF-8 | 3,921 | 3.546875 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# @Time : 18/7/27 上午10:40
# @Author : Edward
# @Site :
# @File : tfidf.py
# @Software: PyCharm Community Edition
from collections import Counter
import jieba
from gensim.models import TfidfModel
from gensim.corpora.dictionary import Dictionary
class TfIdf(object):
'''
该类适用于... | true |
e0ce279388f932bed668043bdd947862f3a92ec1 | coderminer/DSA | /algorithm/linearsearch/python/LinearSearch.py | UTF-8 | 249 | 3.484375 | 3 | [
"MIT"
] | permissive | def search(arr,target):
for i in range(len(arr)):
if arr[i] == target:
return i
return -1
if __name__ == '__main__':
target = 4;
arrs = [2,3,4,5,6,8,1,9,10,23,13,34,43,12,14,15,16];
print(search(arrs,target)) | true |
86974471c23f547469b50327f74f0282b3fbc259 | asarenkansah/SalesforceScripts | /clean/clean.py | UTF-8 | 4,317 | 2.546875 | 3 | [] | no_license | import pandas as pd
from pathlib import *
def SAP():
file = Path("SAP Applicant File.xlsx")
if file.exists ():
print("Working on SAP Applicant File")
data = pd.read_excel("SAP Applicant File.xlsx")
data['Concat ID'] = data['VORNA'] + data['NACHN'] + data['FMTSTREET'].str[:10]
d... | true |
a886675948a0c065a6ae349c8d15ac40ca9d5814 | TTL518/incremental-learning-image-retrieval | /metric/recall_at_k.py | UTF-8 | 3,791 | 2.84375 | 3 | [] | no_license | import numpy as np
import torch
from torch import Tensor
from avalanche.evaluation import Metric
# a standalone metric implementation
class RecallAtK(Metric[float]):
"""
This metric will return a `float` value
"""
def __init__(self, k=1):
"""
Initialize the metric
"""
s... | true |
1b7be92a992b8e9812e88404606d865acf4c0d0d | geirtul/advent_of_code | /2020/day06/custom_customs.py | UTF-8 | 938 | 3.09375 | 3 | [] | no_license | test = [line.strip() for line in open("test.txt", "r")]
data = [line.strip() for line in open("input.txt", "r")]
def separate_groups(data):
groups = [[]]
for el in data:
if el != "":
groups[-1].append(el)
else:
groups.append([])
continue
return groups
... | true |
ee146344a2de1e447e095ac97bfd900619cc47b9 | brozi/graphs-and-text | /authors_graphs.py | UTF-8 | 5,802 | 2.53125 | 3 | [] | no_license | import networkx as nx
import community
import numpy as np
import pandas as pd
from collections import defaultdict
def make_graph_authors(X_train, y_train, info):
X_train = pd.concat([X_train.ix[:,:2], y_train], axis = 1)
X_train = X_train.values.astype(int)
G = nx.DiGraph()
dict_citation = defaultdict... | true |
e50d15eb196840fff5d451b88ce4d0c6dc5b9fb4 | PedroOliveiraS/CompGrafica_listas | /sem07/lista06/edgeEnhanceImage.py | UTF-8 | 541 | 3.328125 | 3 | [] | no_license | # Importar as bibliotecas
from PIL import Image, ImageFilter
def run():
# Abrir a Imagem
img1 = Image.open('images/colored.jpg')
# Aplicar o filtro de Edge Enhance
# O filtro de edge enhance faz com que as bordas de diferentes regiões estejam presentes de forma muito mais
# explícita, ficando mai... | true |
a19891ddca82b2b27bcae6c94c9adf4d1f0e48d6 | robvogelaar/tditracer | /utils/tdiallocs | UTF-8 | 2,266 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import re
def sortby(x):
return int(x.split()[0])
def main():
if len(sys.argv) >= 3:
fro_sec = 0.0;
to_sec = sys.float_info.max;
if len(sys.argv) == 4:
fro_sec = float(sys.argv[3]);
if len(sys.argv) == 5:
fro_sec = float(sys.argv[3]... | true |
f576dacd70b1810870573822181d5dd215aa4f9c | jinwoov/hacktoberfest | /Scripts/DoublyLinkedList.py | UTF-8 | 2,052 | 4.375 | 4 | [
"MIT"
] | permissive | ## This code is contributed by sahilsingh2402
## Reversed Doubly Linked List
# Program to reverse a doubly linked list
# A node of the doubly linked list
class Node:
# Constructor to create a new node
def __init__(self, data):
self.data = data
self.next = None
self.prev = None
class DoublyLinkedList:... | true |
cbf1d4a0b3e32a6bb55429e4cbaecb786c4eaf30 | fares-ds/Algorithms_and_data_structures | /00_algorithms_classes/stack_class.py | UTF-8 | 534 | 4.03125 | 4 | [] | no_license | class Stack:
def __init__(self, lst=None):
if lst is None:
self.items = []
else:
self.items = lst
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def __repr__(self):
return f"Stack({[item for item in ... | true |
039a7560a6ca04bbef48402977eca102a5895617 | cuongnb/btm | /vb/online_vb_obtm/evaluation/coherence-on-learn.py | UTF-8 | 5,775 | 2.65625 | 3 | [] | no_license | import sys, string
import numpy as np
def read_minibatch(fp, batch_size):
wordids = list()
stop = 0
for i in range(batch_size):
line = fp.readline()
# check end of file
if len(line) < 5:
stop = 1
break
ids = list()
terms = string.split(line)
... | true |
c71b884338d894f3c0d097e8d4aa79275364b078 | abaric/crowdsourcing-class | /assignments/scripts/python_bootcamp.py | UTF-8 | 6,500 | 3.453125 | 3 | [] | no_license | from collections import Counter
from string import punctuation
import re
wine = open('data/wine.txt').readlines()
stopwords = open('data/stopwords.txt').readlines()
#keep track of how many times each star value appears
ratings = {}
for line in wine:
review_and_rating = line.strip().split('\t')
'''['Lovely de... | true |
5eac80ad69836ffcb013890050addd8f961fea89 | priya-padmanaban/Style | /processing/testing/processing.py | UTF-8 | 6,958 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import division
import nltk
import zipfile
import argparse
import sys
from nltk.corpus import inaugural
import csv
###############################################################################
## Utility Functions ##########################################################
#####... | true |
b088dad0180a0780c187f6df5cb373555ef26ff2 | lucasrachid/learning-python | /Aula10.py | UTF-8 | 786 | 3.640625 | 4 | [] | no_license | #carro = int(input('Quantos anos o seu carro tem ? ').strip())
#if carro <=5:
# print('Carro TOOOPPP')
#elif carro >=10:
# print('TOMA NO CU POBRE DA PORRA')
#else:
# print('Vamo trocar essa lata velha hein!')
#print('--FIM--')
#nome = str(input('Qual o seu nome ? ')).strip().upper()
#if nome == 'RA... | true |
7cc5beb0595d11646ef253960841ec3beba94aa9 | rafaelperazzo/programacao-web | /moodledata/vpl_data/148/usersdata/268/82384/submittedfiles/testes.py | UTF-8 | 1,240 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
n = int(input('Digite o número d equações: '))
cont=0
while (cont<n):
#ENTRADA
a=float(input('Digite o valor de a: '))
b=float(input('Digite o valor de b: '))
c=float(input('Digite o valor de c: '))
E=float(input('Digite a precisão das raízes: '))
#PRE-ENTRA... | true |
472c293f5bbe1746762d483436957b3b86fb94f3 | rgsriram/Algorithms | /Others/nqueens.py | UTF-8 | 1,114 | 3.546875 | 4 | [] | no_license | def is_safe(board, row, col):
for i in range(col):
if board[row][i] == 1:
return False
for i, j in zip(range(row, -1, -1), range(col, -1, -1)):
if board[i][j] == 1:
return False
for i, j in zip(range(row, N, 1), range(col, -1, -1)):
if board[i][j] == 1:
... | true |
44dd346673b3c7a1bf9d0865219ed86f3e34673f | chenxuxia/python | /python基础/def.py | UTF-8 | 549 | 3.75 | 4 | [] | no_license |
import math
def quadratic(a, b, c):
if a!=0:
alt=b*b-4*a*c
if alt>0:
x1=(-b+math.sqrt(alt))/(2*a)
x2=(-b-math.sqrt(alt))/(2*a)
return x1,x2
else:
print("无解")
else:
print ("a不能等于0")
print('quadratic(2, 3, 1) =', quadratic(2, 3, 1))... | true |
1ce8fea608744fc618a82b1ee9996b241bbf2e95 | ericmassip/MyCarbonFoodPrint | /server/business_logic/country/service.py | UTF-8 | 759 | 2.609375 | 3 | [] | no_license | from flask import Blueprint, jsonify
from business_logic.country.controller import CountryController
country_service = Blueprint('country_service', __name__)
class CountryService:
@staticmethod
@country_service.route('/all')
def get_all():
"""Get all Countries"""
return jsonify(CountryCo... | true |
d01c784f0d5c6ae077bb02dc7fd8acf7153c32aa | eehroh/Pythonskriptit | /salasana.py | UTF-8 | 249 | 3.6875 | 4 | [] | no_license | import random
chars = "abcdefghijklmnopqrstuvwxyzåäö1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ.@!"
pasw = ""
pituus = input("Valitse salasanan pituus: ")
pituus = int(pituus)
for c in range(pituus):
pasw += random.choice(chars)
print(pasw) | true |
8d002c859b0db7792bca707e4fb4bbd6f3e7d7a2 | Dhikigame/niconico_eval_tweet | /web/web/db/db_insert.py | UTF-8 | 1,521 | 2.546875 | 3 | [] | no_license | # coding:utf-8
from datetime import datetime, date, timedelta
import sys
sys.path.append('..')
import video_search as vs
import sqlite3
from contextlib import closing
def db_insert(videoID):
# タグを取得
video_info_get = vs.Video_Eval(videoID)
video_tags = video_info_get.tag_video()
# 投稿日時を取得
video_da... | true |
9d535801696f5bfd7dbcbff6796d89f3ee2daeba | dvweersel/falcon-huey | /falcon_api/model/model.py | UTF-8 | 2,012 | 3 | 3 | [] | no_license | import time
import numpy as np
import json
import jsonpickle
from sklearn.base import BaseEstimator, RegressorMixin
class Regressor(BaseEstimator, RegressorMixin):
def __init__(self, degree=None, b=None, x=None, y=None, is_fitted=False):
self.degree = degree
self.b = b
self.is_fitted = is... | true |
dc2c744d1ca9860338cb03daf82ceb72c6b990dd | jhyun0919/Project_EE394V_SPR2021 | /code/data generation/data_preprocess_tools.py | UTF-8 | 2,510 | 2.65625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
import matplotlib.pyplot as plt
import seaborn as sns
from torch.utils.data import DataLoader, TensorDataset
from torch import Tensor
# def standardize_data_type(data, d_type="float32"):
# return np.array(data).astype(d_type)
... | true |
9ccbf61f81024d3d493c03a0c6ab96d8f3168c81 | PriontoAbdullah/Python-Programming-Practice | /Chepter 03 ( String )/nested.py | UTF-8 | 170 | 3.765625 | 4 | [] | no_license | g=24
n=int(input('Enter a number: '))
if g==n:
print('You won!')
else:
if g<n:
print('Number is too high!')
else:
print('Number is too low!')
| true |
d78a37bc184477499067f1538eb393e00495522d | amaj8/StudentSite | /list/models.py | UTF-8 | 378 | 2.75 | 3 | [] | no_license | from django.db import models
# Create your models here.
class Student(models.Model):
name = models.CharField(max_length=1000)
roll_num = models.CharField(max_length=1000,primary_key=True)
aggregate = models.FloatField(default=None)
def __str__(self):
return("Name:"+self.name+" Enrollment Numbe... | true |
c6370be14f0c2847eea00ccf659224d410dc9150 | zhuohuwu0603/interview-algothims | /none_ladder/17_subsets.py | UTF-8 | 3,060 | 4.0625 | 4 | [] | no_license | '''Description:
Given a set of distinct integers, return all possible subsets.
Notice
Elements in a subset must be in non-descending order.
The solution set must not contain duplicate subsets.
'''
class Solution:
"""
@param nums: A set of numbers
@return: A list of lists
"""
def subsets(self, nums... | true |
b2a4e760885002fe8a493809e91395bb5c70edd4 | prathap937/creep | /creep/src/sources/hash.py | UTF-8 | 2,721 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import hashlib
import os
from ..action import Action
from .. import path
class HashSource:
def __init__ (self, options):
self.algorithm = options.get ('algorithm', 'md5')
self.follow = options.get ('follow', True)
def current (self, base_path):
entries = {}
for name in os.listdir (b... | true |
52031b0160154a1f5bd1dedb9a549ae4f8549748 | 1austrartsua1/projSplitFit | /examples/GroupL2.py | UTF-8 | 888 | 2.71875 | 3 | [] | no_license | import numpy as np
import sys
sys.path.append('../')
import projSplitFit as ps
import regularizers as rg
m = 500
d = 200
groupSize = 10
np.random.seed(1)
A = np.random.normal(0,1,[m,d])
trueCoefs = 0.01*np.array(range(d))
r = A @ trueCoefs + np.random.normal(0,1,m)
ngroups = d // groupSize
groups = [range(i*groupSiz... | true |
e6de393d1f3deb579b9d7ebc9342beaac56afbf4 | chikinn/battle-line | /players/racist_player.py | UTF-8 | 972 | 2.921875 | 3 | [] | no_license | """A color segragator.
Racist attempts to build a rainbow out of the first six flags: red only at flag
1, orange only at flag 2, etc. The remaining three are a dumping ground.
"""
from bl_classes import *
class RacistPlayer(Player):
@classmethod
def get_name(cls):
return 'racist'
d... | true |
1f82871e3bd14e25f9f83a58407069961da50ee1 | varun-suresh/MachineLearning | /DecisionTree.py | UTF-8 | 2,917 | 3.40625 | 3 | [] | no_license | # Homework -1
# Machine Learning - CS 6350
############################################################################################################################################
import csv
import decisionTreeFunctions as dtf
# Main Program :
# Open the file and find out the number of rows and columns.
datafile... | true |
d02833479f1b4e788dcce0d61c220f75cce4e4b8 | domenikjones/django-demo | /app/apps/restaurants/models.py | UTF-8 | 1,302 | 2.515625 | 3 | [] | no_license | from django.db import models
from employees.models import Employee
class Restaurant(models.Model):
name = models.CharField("Name", max_length=255, null=True, blank=False)
address = models.CharField("Address", max_length=255, null=True, blank=False)
city = models.CharField("City", max_length=45, null=Tru... | true |
fdbec39440c551f1ce7600a8bb057eb65bb2cfcd | TTalex/smartsurface | /arucotracking.py | UTF-8 | 3,064 | 2.796875 | 3 | [] | no_license | """
An example of detecting ArUco markers with OpenCV.
"""
import cv2
import sys
import cv2.aruco as aruco
import numpy as np
from scipy.spatial import distance
import json
import paho.mqtt.client as mqtt
client = mqtt.Client()
client.connect("localhost", 1883, 60)
last_values = {}
def track(frame):
# Convert f... | true |
6439edcb8167f8c949bb1fd2a2160eb3c56ce6e9 | nik-malnik/Text-Mining | /641_HW6/src/letor.py | UTF-8 | 2,878 | 2.734375 | 3 | [] | no_license | import collaborative_filtering as CF
import LogReg2 as LR2
import Rank_Prediction as RP
from sklearn.svm import LinearSVC as SVC
import numpy as np
import pandas as pd
from time import time
def Generate_Training_Set(U,V,train):
X = []
y = []
temp = train[['user_id','movie_id','rating']]
temp = temp[(temp['ratin... | true |
dd0f1ebc7aa18cd507a3b5453ca8adcc1824197b | vyraun/blindspots | /wordvectors/forced_induction.py | UTF-8 | 1,624 | 2.640625 | 3 | [] | no_license | import pickle
import numpy as np
from pdb import set_trace as bp
def get_induced_vectors(data_file, wordvecfile):
wordvec = pickle.load(open(wordvecfile, 'rb'))
train_data = open(data_file).readlines()
vector = {}
for each in wordvec.wv.vocab:
vector[each] = wordvec[each]
contextual = ['i'... | true |
ca518084ce8971348e73691235501754c58bea7f | innovia/training-exercise | /05-lists-and-dictionaries/capital_city_loop.py | UTF-8 | 846 | 3.8125 | 4 | [] | no_license | # Copyright (c) 2016 Ami . All rights reserved
from capitals import capitals_dict
from random import choice
def get_random_state():
return choice(list(capitals_dict.keys()))
def capital_of_state_quiz(state):
while True:
response = input("What is the capital of " + state + "? ").lower()
if ch... | true |
d8bd444904e3fd79467894f52db123e4ef87b68d | TheFalk/method_challenge | /test_TempTracker.py | UTF-8 | 1,034 | 3.09375 | 3 | [] | no_license | __author__ = "Michael Falkenstein"
import unittest
from TempTracker import TempTracker
class TestTempTracker(unittest.TestCase):
'''
This is a test class for TempTracker.py
'''
def setUp(self):
self.tracker = TempTracker()
def add_temp_values(self):
a = [1,2,3,4,1,3,9,9... | true |
b0017b5e9700ab4aae5dca2d55e4cafea25062c3 | ccecka/ComputeFestChallenge | /Challenge2014/GameSource/GameEngine.py | UTF-8 | 4,031 | 3.140625 | 3 | [] | no_license | import math
import random
import numpy
import collections
from time import sleep
MIN_INT = 0
MAX_INT = 100
STATE_SIZE = 4
STATE_DIM = 2 # 1 or 2
STATE_SHAPE = (STATE_SIZE,) * STATE_DIM
STATE_NUM = STATE_SIZE**STATE_DIM
MAX_MESSAGE_LENGTH = 1024
DELIMITER = ' '
# Join the elements of a wall into a string
d... | true |
c095b9c77eeb486234c22e265bf84e6db026e270 | CamiloBallen24/Python-PildorasInformaticas | /Script's/12 - Interfaces Gráficas/Interfaces Graficas 04.py | UTF-8 | 1,462 | 3.5625 | 4 | [
"Apache-2.0"
] | permissive | #TEMA: Text y Button
#Text: Introducir textos largo
#Button: Botones toda la vida
####################################################################
from tkinter import *
####################################################################
####################################################################
def co... | true |
5313e8d09288736663990eff5d2eaba2eac8b078 | XyK0907/for_work | /LeetCode/30 days challenge/16_Valid_Parenthesis_String.py | UTF-8 | 1,167 | 3.625 | 4 | [] | no_license | class Solution(object):
def checkValidString(self, s):
"""
:type s: str
:rtype: bool
"""
left = 0
right = 0
for i in range(len(s)):
if s[i] in '(*':
left += 1
else:
left -= 1
if s[len(s)-i-1] ... | true |
880fb4727ae48700bb3775acd4ec087c74271257 | siewlan/SL_Assignment | /Assignment_Session16 (placename w 10 days temp).py | UTF-8 | 887 | 3.71875 | 4 | [] | no_license | #Assignment1 - Session16 (placeName with 10 days temp)
import requests
import json
#1) User to enter the placeName (can only access to city "medak")
placeName=input("Enter the city -> ")
#2) Build the url based on the input
url="http://api.openweathermap.org/data/2.5/forecast/daily?q=%s,in&cnt=10&mode=json&un... | true |
67431bb4ac0be60ff3f0e833e97dd7261da4bd55 | milimi974/OC_Projet_5 | /classes/Database.py | UTF-8 | 15,634 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
""" Module Parent for request to BDD """
# import dependencies
from classes.Functions import *
# Mysql packages
import mysql.connector
from mysql.connector import Error
class Database(object):
""" That class connect and manage connection to database
and inherit obje... | true |
0f0614fccaf2fcd71bf674f3d78f02cb4b2fbce9 | kypopthuk1996/python_learning | /Type_data/Number.py | UTF-8 | 642 | 3.578125 | 4 | [] | no_license | import math
a=1
b=2
#Сложение
c=a+b
d=1.0+2.3
#Вычитание
q=10-4
#Умножение
w=3*2
#Возвдение в степень
e=4**3
#Деление
r=10/3
t=12/3.2
#Округление
y=round(10/2.5, 4)
#Остаток от деления
u=14%3
#Конвертация в integer
i=int(14.33)
o="16"
print(int(o))
print(i)
#Перевод в двоичную систему
print(bin(7))
#Перевод ... | true |
7314237f5df039106c1b0eb16d04bd3cafd273d6 | jao6693/ud-de-project1 | /sql_queries.py | UTF-8 | 3,244 | 2.5625 | 3 | [
"MIT"
] | permissive | # DROP TABLES
songplay_table_drop = "DROP TABLE IF EXISTS f_songplays;"
user_table_drop = "DROP TABLE IF EXISTS d_users;"
song_table_drop = "DROP TABLE IF EXISTS d_songs;"
artist_table_drop = "DROP TABLE IF EXISTS d_artists;"
time_table_drop = "DROP TABLE IF EXISTS d_times;"
# CREATE TABLES
user_table_create = ("CRE... | true |
929b9095696161804b96ba30472b81e49ea9b0f4 | nima-akram/HackNotts2020AutoTrader | /app.py | UTF-8 | 10,771 | 2.9375 | 3 | [
"MIT"
] | permissive | import streamlit as st
import json
from mapper import mapper
import backtest as bt
from datetime import datetime
from datetime import timedelta
import plotly.express as px
import streamlit as st
import pandas as pd
import numpy as np
import pickle
import os
from twilio.rest import Client
from twilio_cred import acco... | true |
5e9cfdab28803c222bce6277ba9981250273b36a | Aasthaengg/IBMdataset | /Python_codes/p02409/s615999401.py | UTF-8 | 393 | 2.765625 | 3 | [] | no_license | import sys
n = input()
d = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for i in range(n):
b, f, r, v = map(int, raw_input().split())
d[b-1][f-1][r-1] += v
for i in range(4):
for j in range(3):
for k in range(10):
sys.stdout.write(' %d' % d[i][j][k])
if k==9:
sys.stdout.write... | true |
e43aa1935523679a7f9016bea97a7cc31d828b73 | lrdmic/Pycharm-Projects | /66_aplicando_aprendido.py | UTF-8 | 1,648 | 3.921875 | 4 | [] | no_license | # PROYECTO: Aplicar lo aprendio
# GUARDAR DATOS DE NUESTROS PROGRAMAS
import pickle
# Importamos nuestra clase estudiantes
from estudiantes import Estudiantes as Est
class ListaEstudiantes:
estudiantes = []
def __init__(self):
archestudiantes = open("lista_estudiantes", "ab+")
archestudiant... | true |
43c653597a45d7900dda419e3068d763a2323c1f | jhyoung09/BUMS | /BUMS.py | UTF-8 | 3,092 | 3.125 | 3 | [
"MIT"
] | permissive | ##################################################
#
# James Hunter Young
# 2020
#
# BUMS - Back Up My Shtuff
#
#
#
##################################################
# imports
import logzero
from logzero import logger, logfile
# global variables
def ask():
logger.debug('### STARTING ASK ###')
... | true |
53ba2db1afb631fb4001eb3a7aaf57032db85c70 | FarisHijazi/PrivacyEnhancingTechnologies-projects | /Assign3_ObliviousTransfer/scripts/utils.py | UTF-8 | 1,618 | 3.125 | 3 | [] | no_license | import argparse
import struct
class ArgumentParserError(Exception):
pass
class SafeArgumentParser(argparse.ArgumentParser):
def error(self, message):
# this is what decides if the parser should be safe or not
if hasattr(self, 'errorlevel') and getattr(self, 'errorlevel'):
super()... | true |
59783171f6edca62dbf5d560feeeb3e0323e3d3f | beOk91/code_up | /code_up4021.py | UTF-8 | 155 | 3.15625 | 3 | [] | no_license | num_list=list(map(int,input().strip().split()))
sum=0
for i in range(7):
if num_list[i]%2==1:
sum+=num_list[i]
if sum==0:
sum=-1
print(sum) | true |
6a741b24885ba46c04da927e6a36ab2e4d6c9999 | Sergi50/Telegram_bot | /telegram_bot.py | UTF-8 | 855 | 2.625 | 3 | [] | no_license | import telebot
import time
bot_token = '994821392:AAGUZifqsQfw5jnIhjzekj4VHtw9YeRTSCg'
bot = telebot.TeleBot(token=bot_token)
@bot.message_handler(commands=['start'])
def send_welcome(message):
bot.reply_to(message, 'Hola persona!')
photon = open(r"C:\Users\sergi\OneDrive\Documentos\telegram\Saludos.... | true |
29a448ab8c70fd68d6f849e0df802cd3a9b77d13 | Friday21/algorithms | /chapter2_num3_希尔排序.py | UTF-8 | 1,210 | 4.21875 | 4 | [] | no_license | """
教材162页, 希尔排序
希尔排序是一种基于插入排序的快速排序算法。核心思想是短的数组或者部分有序的数组更适合插入排序
希尔排序的思想是使数组中任意间隔为h的元素都是有序的(h有序数组),然后逐步减小h, 对于任意以1为
结尾的h序列, 我们都能够将数组排序。
下面实现的希尔排序, 在最坏的情况下比较次数和 N^(3/2) 成正比。
1. 找到h=3*n +1 且 h < N的最大h.
2. 将数组a[N] 以间隔h分成多个子数组
3. 对每个子数组进行插入排序
4. h = h//3, 重复步骤2, 3
5. h=1 时排序完成
"""
def shell_sort(input_list):
length ... | true |
fc39acd944d746382ae047c3b5deb063c3615a4b | pure-garyyang/pureelk | /container/worker/pureelk/arraycontext.py | UTF-8 | 4,720 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive |
class ArrayContext(object):
"""
Array context stores the config and the state of an
array during job processing
"""
# array config
ID = "id"
API_TOKEN = "api_token"
NAME = "name"
HOST = "host"
PURITY_VERSION = "purity_version"
# collection config
FREQUENCY = "frequency"... | true |
2999b7a5198ad92bd21e6e8266ac2e62ad6561e0 | sbhackerspace/sbhx-snippets | /py/multiproc-test2.py | UTF-8 | 534 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
# Steve Phillips / elimisteve
# 2011.03.21
# 2011.08.24
from multiprocessing import Process
import os, time
def func(num):
print 'Loop', num
time.sleep(num+1)
print 'Loop %d done sleeping' % num
if __name__ == '__main__':
procs = []
for num in range(5):
p = Process(t... | true |
5a87f28723ec6bbd96402ea4bd018c2488f7e18c | shmishkat/PythonForEveryone | /Week05/Assigment/9.4.py | UTF-8 | 489 | 2.71875 | 3 | [] | no_license |
name = input("Enter file:")
if len(name) < 1 : name = "mbox-short.txt"
handle = open(name)
dic = dict()
for line in handle:
if line.startswith("From "):
line = line.split()
line = line [1]
dic[line] = dic.get(line, 0) + 1
bigword = None
bigcount = None
for word, count in dic.items():
... | true |
b332881870be1a5db84baaae83052c8c64c23676 | MarzioVallero/Real-time-Sign-Language-Detection | /Externals/service/iris_localization.py | UTF-8 | 5,071 | 2.671875 | 3 | [
"MIT"
] | permissive | import cv2
import tensorflow as tf
import numpy as np
class IrisLocalizationModel():
def __init__(self, filepath):
# Load the TFLite model and allocate tensors.
self.interpreter = tf.lite.Interpreter(model_path=filepath)
self.interpreter.allocate_tensors()
# Get input and output ... | true |
c342842a8bcdea69f72165bc74b153b034849207 | imfifc/myocr | /ocr_structuring/core/template/matcher/tp_conf_base_item.py | UTF-8 | 3,361 | 2.71875 | 3 | [] | no_license | import uuid
import editdistance
from ...utils import str_util
from ...utils.bbox import BBox
class TpConfBaseItem:
def __init__(self, item_conf, is_tp_conf: bool = False):
self.conf = item_conf
self.is_tp_conf = is_tp_conf
self.uid = uuid.uuid1().hex
# Supported contents format:... | true |
5e70dcedfb7d243b19510032ec95372453459193 | SimonAwiti/Questioner-APIs | /app/API/version2/questions/models.py | UTF-8 | 6,048 | 2.8125 | 3 | [
"MIT"
] | permissive | """handles all operations for creating and fetching data relating to questions"""
import psycopg2
from psycopg2.extras import RealDictCursor
from flask import request, jsonify, make_response
from datetime import datetime, timedelta
from app.API.utilities.database import connection
from app.API.version2.meetups.models ... | true |
5da7d2bd7445abf74c250d521b53565a356a2780 | PeteRichardson/practice-python | /psamples/filter.py | UTF-8 | 427 | 3.125 | 3 | [] | no_license | ''' filter.py - a grep-like tool.
takes a pattern and a list of files '''
import fileinput
import re
import sys
import optparse
parser = optparse.OptionParser()
parser.add_option('-p', action="store", dest="pattern")
options, remainder = parser.parse_args(sys.argv)
for line in fileinput.input(remainder):
... | true |
f3ae4d9b44751cc029fc708db1c2ae729c45be5f | VasilyDzneladze/streamlit_financial_application | /datasets/DataBase_Download.py | UTF-8 | 586 | 2.734375 | 3 | [] | no_license | import csv, os
import pandas as pd
import yfinance as yf
import time
begin = time.time()
companies = csv.reader(open("C:\\data_science_projects\\streamlit\\streamlit-dashboard-final-project\\datasets\\finviz_market.csv"))
for company in companies:
symbol, name = company
history_filename = f'daily/{symbol}.c... | true |
77f15c4b08bdac998b4e6f3a9dd240b7648417e1 | rhanak/computer_vision | /ch1/imtools.py | UTF-8 | 1,847 | 3.15625 | 3 | [] | no_license | from numpy import *
def imresize(im, sz):
""" Resize an image array using PIL. """
pil_im = Image.fromarray(uint8(im))
return array(pil_im.resize(sz))
def histeq(im, nbr_bins=256):
""" Histogram equalization of a grayscale image. """
# get image histogram
imhist,bins = histogram(im.flatten(), nbr_bins, ... | true |
3b309eae9feed1b15f3f6ffcd4830760cb3f383b | MauVlad/Mytest | /ev3dev/texto/pro/p.py | UTF-8 | 159 | 2.578125 | 3 | [] | no_license | s = input("Escribe 1 o 2: ")
if s == 1:
k = input("Escribe 1 o 2: ")
if k == 1:
import bt
bt
if k == 2:
print 'fin'
if s == 2:
import bt2
bt2
| true |
96ca08568ffadb05dcd2ba4ae79b401dcd472829 | k-s-p/Django_tutorial | /Django_begginer/djangoai/vgg16_transfer_men_women.py | UTF-8 | 2,038 | 2.8125 | 3 | [] | no_license | import numpy as np
from tensorflow import keras
from tensorflow.keras.models import Sequential, Model
from tensorflow.keras.layers import Dense, Dropout, Flatten
from tensorflow.keras.layers import Conv2D, MaxPooling2D
from tensorflow.keras.optimizers import SGD, Adam
#from tensorflow.keras.utils import np_utils
... | true |
9b814ad0e5f2d962db8539035a2a452f54625111 | kaloyansabchev/Programming-Basics-with-Python | /PB Exam - 28 and 29 March 2020/01. Supplies for School.py | UTF-8 | 434 | 3.328125 | 3 | [] | no_license | pens_quantity = int(input())
markers_quantity = int(input())
water_quantity = float(input())
discount = int(input())
pens = 5.80
markers = 7.20
water = 1.20
pens_price = pens_quantity * pens
markers_price = markers_quantity * markers
water_price = water_quantity * water
total_price = pens_price + markers_price + wate... | true |
0c50d090b204fb7590e91a7bc918bc63120a45e9 | daniel-reich/ubiquitous-fiesta | /vLLXeQH5tgyvbzYZS_10.py | UTF-8 | 301 | 2.75 | 3 | [] | no_license |
def is_prim_pyth_triple(lst):
m=min(lst)
k=1
for i in range(2,m):
if lst[0]%i==0 and lst[1]%i==0 and lst[2]%i==0:
k=k*i
if k>1:
return False
else:
k=max(lst)
lst.remove(max(lst))
if k**2==sum([k**2 for k in lst ]):
return True
else:
return False
| true |
4d65b34aa03d04774aef120f525a5c1dde411afb | vaelen/Erasmus | /tests/test_context.py | UTF-8 | 1,423 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | from __future__ import annotations
import unittest.mock
from typing import Any, cast
import discord
import pytest
import pytest_mock
from erasmus.context import Context
class MockUser(object):
__slots__ = ('bot', 'id', 'mention')
def __init__(
self,
*,
bot: bool | None = None,
... | true |
ed7825cb4937f0b7a6d56f2d8f2a222bc6a1aaa0 | Nathan2Warren/Estimating-Impact-of-Opioid-Prescription-Regulations | /10_code/17_Mortality_census_combine_by_county.py | UTF-8 | 1,254 | 2.546875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import os
os.chdir('C:/Users/Jiajie Zhang/estimating-impact-of-opioid-prescription-regulations-team-3/20_intermediate_files')
os.getcwd()
Census = pd.read_csv('21_Census_Full_County_Level.csv')
Mortality = pd.read_csv('15_Drug_Mortality_Full.csv')
Mortality = Mortality.groupby(b... | true |
f2ca0f43acb2e06db9384786f640340edb9b83f8 | LordBrom/advent-of-code | /2020/day25-1.py | UTF-8 | 549 | 3.1875 | 3 | [] | no_license |
inFile = open("day25.in", "r").read().split("\n")
inFile.pop()
cardKey = int(inFile[0])
doorKey = int(inFile[1])
cardSubject = 7
cardValue = 1
cardLoop = 0
while not cardValue == cardKey:
cardLoop += 1
cardValue *= cardSubject
cardValue %= 20201227
doorSubject = 7
doorValue = 1
doorLoop = 0
while not doorValue... | true |
0af8d07d3a53a685b88cea8a8ed063df5b539823 | chrisngan24/searching | /evaluate_results.py | UTF-8 | 1,815 | 2.546875 | 3 | [] | no_license | import pandas as pd
from evaluate.metrics import compute_precision_at_k,\
compute_dcg
import numpy as np
import sys
if __name__ == '__main__':
# use of pandas to load in csv files
df_truth = pd.read_csv(
'data/LA-only.trec8-401.450.minus416-423-437-444-447.txt',
se... | true |
a314b4f4d3de144b44c15c767d034d62893166ce | hagiyat/checkio | /electronic_station/numbers_factory.py | UTF-8 | 974 | 3.453125 | 3 | [] | no_license | def checkio(number):
quotients = []
try:
for value in getDivisors(number):
quotients.append(str(value))
return int("".join(reversed(quotients)))
except:
return 0
def getDivisors(number, divisor=9):
while number > 1:
if number % divisor == 0:
yield... | true |
d37f1c3202d44de1e0c9365db9f8f24e098e85e9 | SourangshuGhosh/MarkovChainTest | /parse.py | UTF-8 | 1,047 | 3.203125 | 3 | [
"MIT"
] | permissive | import sys
import re
class Parser:
SENTENCE_START_SYMBOL = '^'
SENTENCE_END_SYMBOL = '$'
def __init__(self, name, db, sentence_split_char = '\n', word_split_char = ''):
self.name = name
self.db = db
self.sentence_split_char = sentence_split_char
self.word_split_char = word_split_char
self.w... | true |
1a0c4e0864af0500c15739112836c37adf8de3bf | psm18/16ECA_parksunmyeong | /lab 07 vector/test_vector.py | UTF-8 | 2,987 | 3.265625 | 3 | [] | no_license | # -*- coding: utf8 -*-
# 위 주석은 이 .py 파일 안에 한글이 사용되었다는 점을 표시하는 것임
# 2015110018 박선명
"""
벡터 모듈을 위한 단위 테스트(unit test)
시작하기전 PyCharm 설정
1. File/Settings/ 대화 상자를 엶
2. Tool 메뉴 아래에서 python Integrated Tools 를 엶
3. Default test runner 로 Unittest 를 선택
4. Project 창이 열려 있지 않으면 [alt +1] 으로 열기
5. 해당 소스 코드를 담은 폴더를 오른쪽 마우스 클릭
6. 아래쪽... | true |
69963d42052a2a1d76955605a56d1c3a5be415e3 | gnarayan/astr596 | /personal/AdamSnyder/individual projects/plot_spectra.py | UTF-8 | 1,132 | 2.9375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
# function two average 2 arbitrary spectra
# Plan to expand to average arbitrary numbers of spectra, need better way to average
def average_spectra(spectra1, spectra2):
if len(spectra1[:,0]) < len(spectra2[:, 0]):
S1 = spectra2
S2 = spectra1
e... | true |
846e749d827e9e6d4f0a4893f99c2f6df72b5521 | UH-LMU/lmu-scripts | /dialogs.py | UTF-8 | 4,403 | 2.75 | 3 | [] | no_license | import os
import Tkinter, Tkconstants, tkFileDialog
from Tkinter import *
class ConverterDialog(Tkinter.Frame):
def __init__(self, root, converter=None):
self.converter = converter
Tkinter.Frame.__init__(self, root)
# options for buttons
button_opt = {'fill': Tkconstants.BOTH, '... | true |
7986df6ae57ee387d771d7baa682e504d276d6f4 | cpnHere/ACRS | /Toy_clouds/Step_Cloud/cpnCommonlib.py | UTF-8 | 9,436 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
********************************************
Created on Mon Apr 2 10:14:27 2018
by
Chamara Rajapakshe
(cpn.here@umbc.edu)
********************************************
Frequently used common python library
"""
import numpy as np
import matplotlib.pyplot as plt
import o... | true |
5adb3492e342928f9f9bf76621306fe8f8ff08f5 | banboooo044/AtCoder | /ABC005/D_2.py | UTF-8 | 509 | 2.65625 | 3 | [] | no_license | N = int(input())
D = [0]*N
for i in range(N):
D[i] = [int(x) for x in input().split()]
mval = [0]*(N*N+1)
for i in range(1,N+1):
tmp = [[sum(x[j:j+i]) for j in range(N+1-i)] for x in D]
ttmp = list(zip(*tmp))
for k in range(1,N+1):
a = max([max([sum(x[j:j+k]) for j in range(N+1-k)]) for x in t... | true |
c027fd44b505294ecde87767abce4a725fba4cce | kamyu104/LeetCode-Solutions | /Python/backspace-string-compare.py | UTF-8 | 587 | 3.203125 | 3 | [
"MIT"
] | permissive | # Time: O(m + n)
# Space: O(1)
import itertools
class Solution(object):
def backspaceCompare(self, S, T):
"""
:type S: str
:type T: str
:rtype: bool
"""
def findNextChar(S):
skip = 0
for i in reversed(xrange(len(S))):
if S[i... | true |
e6ccffcb1a54ee3e23965c27eac7d030cffa075e | chauxumei/subject-combi-bot | /app.py | UTF-8 | 3,298 | 3.140625 | 3 | [] | no_license | print("subject combi quiz:O")
print()
print("helluu pls ans the questions and we'll suggest a subject combi for you??")
print()
print("kayy so firstly, let's find out about your grades; please respond with a number from 1 to 5, where 1 is C+ and below, 2 is B, 3 is B+, 4 is A and 5 is A+!!!")
print()
hist = input("you... | true |
502c231a65a0fd9915887b25bdf2556a8d6b9032 | boidachenkop/uj-python | /prj3/src/zad3_3.py | UTF-8 | 239 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Author: Pavlo Boidachenko
# @Date: 2018-10-04 20:55:41
# @Last Modified by: pavlo
# @Last Modified time: 2018-10-04 20:56:56
for x in range(30):
if x % 3 != 0:
print(x, end=" ")
else:
print("", end="")
print("") | true |