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 |
|---|---|---|---|---|---|---|---|---|---|---|
674089c2019bdf375c09ca08edd862557678c3dc | frenem/COLOR | /ledsite/color.py | UTF-8 | 250 | 2.734375 | 3 | [] | no_license |
# A very simple Flask Hello World app for you to get started with...
from flask import Flask , render_template
app = Flask(__name__)
@app.route('/')
@app.route('/<color>')
def home(color=None):
return render_template('home.html',color=color)
| true |
aac94330d8b33ee925b78abcc945fbdd4577e64f | MelekhDA/university_som | /result_estimate_on_all_cores.py | UTF-8 | 1,627 | 3.203125 | 3 | [] | no_license | #
# Непараметрическая оценка регрессиии на 4-х ядрах
#
import pylab, random, math
from utils import default_core as core, nonparametric_regression as regression
# имитационная модель
imit_model = lambda x: round(math.sin(x) + 3, 15)
# начальная точка, шаг, объём выборки
x0, dx, n = 1, 0.05, 200
# входы имитационно... | true |
28702591c9ec006efe5de1a42928dee3fa36b77f | UtsavRaychaudhuri/leetcode-github | /graph-valid-tree/graph-valid-tree.py | UTF-8 | 913 | 2.734375 | 3 | [] | no_license | import collections
class Solution:
def validTree(self, n: int, edges: List[List[int]]) -> bool:
if len(edges) != n - 1:
return False
parent=[i for i in range(n)]
size=[1]*n
def find(x):
root=x
while parent[root]!=root:
root =parent... | true |
4409013d0511fea97798897cf4428c19bac8133a | Mrzhangjwei/python-cjj | /mydemo7.py | GB18030 | 8,800 | 3.53125 | 4 | [] | no_license | #coding:gbk
#LEGB:ʹñߺķΧ
#L ֲ --> local
#E Ƕ --> est
#G ȫ --> global
#B ڽ --> bulid-in
'''
a = 100
def func():
print 'a is:',a
def demo():
print a
func()
demo()
'''
'''
def func():
a = 10
print a
def demo():
print a
demo()
'''
#global ȫֱ
'''
... | true |
419c1ee5509000c6dca0123174079268d3585426 | dooddyfire/Email-OTP-Verification-with-Flask | /mail.py | UTF-8 | 1,171 | 2.9375 | 3 | [] | no_license | from flask import *
from random import *
from email_otp import *
app = Flask(__name__)
app.secret_key = 'EmailAuthenticationByShivamYadav2021'
@app.route('/')
def index():
return render_template("homepage.html")
@app.route('/verify',methods = ["POST"])
def verify():
rec_email = request.form["em... | true |
09559e184841696285549b7c03a4a21dbb0b723f | santihadad/python-course | /datatype.py | UTF-8 | 724 | 3.890625 | 4 | [
"MIT"
] | permissive | # STRING
print("Hello World")
print('Hello World')
print("""Hello World""")
print('''Hello World''')
print(type("Hello World"))
#Concatenar STRINGS
print("Bye" + "World")
#INTEGER AND FLOAT
print(type(30))
print(type(30.5))
print(30)
print(30.5)
#BOOLEAN
print(type(True))
print(type(False))
#LISTS
print(type([10, 2... | true |
711cebb3cb0821f71a8b1798b80f9e71990a72e8 | yggwz/PythonCV | /shiyan.py | UTF-8 | 299 | 2.84375 | 3 | [] | no_license | # 编写者:刘港
# 开发时间:2021/7/15 15:36
import os
import shutil
lit=[[1,23],[23,4],[12,55]]
with open('C:/Users/LGG/Desktop/111.txt','w+') as file:
for i in range(len(lit)):
file.write(str(lit[i]))
print(lit[i])
if i < len(lit)-1:
file.write('\n')
| true |
8e7607db7eb08509bdf754b3d6f3b2adf3c23667 | keven425/robot-learn | /arm-api/abb.py | UTF-8 | 8,921 | 2.890625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import wx
import serial
import sys
from time import sleep
import random
# min, max, home
BOUNDS = {
1: [550, 2350, 1450],
# 2: [600, 1900, 1250],
3: [550, 1850, 1150],
4: [550, 1900, 1450],
5: [550, 2450, 1500],
6: [550, 2350, 1500],
7: [550, 2400,... | true |
2dfd9ff17cf1fb32afcd3881afa3e406f115ac7b | hjcho0617/robot | /battery/checksum.py | UTF-8 | 127 | 3.15625 | 3 | [] | no_license |
def checksum(packet):
sum = 0
for i in packet:
sum += i
sum = sum & 0xFF
print(sum)
return sum
| true |
c745ef34224c84fac7559758ea9d50dbbe38efd3 | Glubs9/Stutter | /Parser.py | UTF-8 | 1,724 | 3.71875 | 4 | [] | no_license | import numbers
def find_matching_brack(tokens): #everything except
amount_needed = 1
for pos in range(len(tokens)):
n = tokens[pos]
if n == "(":
amount_needed += 1
elif n == ")":
amount_needed -= 1
if amount_needed == 0:
return pos
rai... | true |
63e31c643ce81dd44d5628d4439e65a3bce85d84 | zzyoungXC/zzy0413 | /py/demo01.py | UTF-8 | 668 | 3.453125 | 3 | [] | no_license |
#print('hello')
class Person(object):
def __init__(self,name):
#print('1',self)
self.name=name
#self.age=age
def show(self):
#print('4',self)
#print(f'姓名:{self.name},年龄:{self.age}')
print('姓名:%s'%(self.name))
#def __del__(self):
# print('2',self)
cla... | true |
83b57cd0e23d8d8389fb49a4265742f16a5cff29 | Philex5/codingPractice | /MathProblem/romanToInt.py | UTF-8 | 2,792 | 4.125 | 4 | [] | no_license | """
罗马数字转整数
罗马数字包含以下七种字符: I, V, X, L,C,D 和 M。
字符 数值
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
例如, 罗马数字 2 写做 II ,即为两个并列的 1。12 写做 XII ,即为 X + II 。 27 写做 XXVII, 即为 XX + V + II 。
通常情况下,罗马数字中小的数字在大的数字的右边。但也存在特例,例如 4 不写做 IIII,而是 IV。数... | true |
c6a9737f401c5c4b6c875911356ee870ccbbf81a | stothe2/mantid | /Code/Mantid/Framework/PythonInterface/plugins/algorithms/DNSMergeRuns.py | UTF-8 | 11,102 | 2.640625 | 3 | [] | no_license | import mantid.simpleapi as api
from mantid.api import PythonAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty
from mantid.kernel import Direction, StringArrayProperty, StringListValidator, V3D
import numpy as np
import mlzutils
class DNSMergeRuns(PythonAlgorithm):
"""
Merges given runs into one matrix wor... | true |
7c1acce987df20e3e503159dcae1db14162c5bbc | stacygo/2021-01_UCD-SCinDAE-EXS | /07_Exploratory-Data-Analysis-in-Python/07_ex_3-10.py | UTF-8 | 249 | 3.03125 | 3 | [] | no_license | # Exercise 3-10: Computing correlations
import pandas as pd
brfss = pd.read_hdf('input/brfss.hdf5', 'brfss')
# Select columns
columns = ['AGE', 'INCOME2', '_VEGESU1']
subset = brfss[columns]
# Compute the correlation matrix
print(subset.corr())
| true |
26492819aace93f22f2fd81d38210d7b5bbf72a8 | joseahr/arcpy-awesome-symbolizer | /awesome-symbolizer.py | UTF-8 | 19,722 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import arcpy
import arcpy.mapping as mapping
import math
from os import path
from itertools import chain
from PyQt4 import QtGui, uic
from PyQt4.QtGui import QFileDialog, QMessageBox
from functools import partial
# Se carga el formulario mediant... | true |
95d8fe16a658e76ee650ecabef40b18163fa5e20 | bob7757/Repo | /Wt Converter.py | UTF-8 | 353 | 4.21875 | 4 | [] | no_license | weight = input("How much do you weigh? ")
if weight.isalpha():
print("Please only enter numbers.") ;
else:
weight = float(weight); unit = input("(L)b or (K)g?")
unit = unit.lower()
if unit == "l":
print(f"Your weight is {weight / 2.2} Kg")
elif unit == "k":
print(f"Your weight is {weight * 2.2} Lb")
else:
p... | true |
14f07e3dbd1b199ec26a609860c1b1ecc0c75672 | UrlBin/Lessons-10 | /Код от сейфа.py | UTF-8 | 963 | 3.859375 | 4 | [] | no_license | flag_of_True = 0
number = []
cypher = input('Введите четырехзначный код сейфа (одно четырехзначное натуральное число): ')
cypher_tuple = tuple(cypher)
number_of_numbers = int(input('Введите натуральное число - это количество попыток проверки кода: '))
while number_of_numbers > 0:
if len(number) < 4:
numbe... | true |
616002897bb1f05eea2c8bc0281181cc48c985a3 | mike-petrut/crop-yield-forecasting | /py06_random_forrest.py | UTF-8 | 4,873 | 2.96875 | 3 | [
"MIT"
] | permissive |
#%%
from datetime import datetime
import pandas as pd
import numpy as np
from pandas.core import frame
import geopandas as gpd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy import stats
import statsmodels.api as sm
# %%
def process_index_pivot(vi_link, v_index):
v_index = str(v_index)
... | true |
0bec3169bdce824acc340ebce9f996ee50ecc659 | ubryce/Database-For-Emails | /phase1.py | UTF-8 | 4,244 | 2.828125 | 3 | [] | no_license | import re
def terms(line, newfile):
ignore = [" ", "<", ">", "&", "'", """]
#subbing all of the characters to ignore with spaces
for char in ignore:
line = re.sub(char, " ", line)
#will catch any numbers besides
numbers = re.findall("&#(.*);", line)
#will c... | true |
e5cc60458f2a7f05aa23edbc6fb68fbc79805c79 | LichAmnesia/LeetCode | /python/191.py | UTF-8 | 450 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Author: Lich_Amnesia
# @Email: alwaysxiaop@gmail.com
# @Date: 2016-09-18 16:08:04
# @Last Modified time: 2016-09-18 17:37:58
# @FileName: 191.py
class Solution(object):
def hammingWeight(self, n):
"""
:type n: int
:rtype: int
"""
res = 0
... | true |
7f2137e01a06cb478c74b57eb1671ac165787644 | Aviral2642/ringzer0-challenges | /coding.ch126.py | UTF-8 | 1,003 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import ringzer0
# english.dat = ~/bin/scowl/mk-list english 80 > english.dat
WORDS_FILE = './data/english.dat'
def ch126(fp):
ringzer0.output('parsing dictionary')
wordset, wordmap = set(), {}
with open(fp, 'r') as f:
for line in f:
word = line.strip()
wordset.... | true |
e61a69f094eb6ab29102aacf963a16c8b6f0daf1 | johntoms/python-instances | /base_python_knowledge/study_string.py | UTF-8 | 3,525 | 3.734375 | 4 | [] | no_license | # /usr/bin/env python
# coding=utf-8
"""
__Author__ = 'johntoms'
__CreateTime__ = '2019/1/24'
"""
# 1. python 转义字符
# \ 在末尾时 续行符
# \' 单引号
# \" 双引号
# \a 响铃 在pycharm编译器内是无法响铃的,在系统内执行是可以响铃的
# \b 退格符
# \000 空
# \n 换行符
# \t 水平制表符(4个空格)
# \v ... | true |
458abdcfd3257cd033e978cce0293e763d6d33d6 | Surendra81/CodeWars | /atm_problem.py | UTF-8 | 624 | 3.890625 | 4 | [] | no_license | def validate_pin(pin):
"""[ATM machines allow 4 or 6 digit PIN codes and PIN codes cannot contain anything
but exactly 4 digits or exactly 6 digits.
If the function is passed a valid PIN string, return true, else return false.
eg:
validate_pin("1234") == True
validate_pin(... | true |
695c5c602da97899b68d8d91d9559a7f01af29dc | valoto/python_trainning | /exec/16.py | UTF-8 | 565 | 3.484375 | 3 | [] | no_license | class Quadrado:
__lado = 0
def get_lado(self):
return self.__lado
def set_lado(self, lado):
self.__lado = lado
def __init__(self, lado):
self.__lado = lado
def mudar_lado(self, lado):
self.set_lado(lado)
def retorna_lado(self):
return self.get_lado()
... | true |
3ce10ab70a67a881c5ffc6a08db31c0c979290a5 | andrewjmacrae/uvicamo | /polarization/dev/reel_time_chunk_w_poincare.py | UTF-8 | 9,391 | 2.515625 | 3 | [] | no_license | # First task is to get the reading and plotting multiple channels -DONE (indexing is weird)
# Then determine time for reading (without plotting) to get bound on fps - DONE (less than 5 ms lag)
# Then get continuous scan DONE (had to use stop() and clear() or it barfed)
# Then Apply chunking alogorithm (Done)
# Then ext... | true |
28e44c75ea8bd2c2057677896d630782d49dca86 | Tsukumo3/Atcoder | /ABC/152/py/D.py | UTF-8 | 493 | 3.203125 | 3 | [] | no_license | N = int(input())
N_str = list(str(N))
length = len(str(N))
#1<=k<=Nで 先頭がiで末尾がjの総和
c = [[0]*9 for i in range(9)]
'''
#C(i,j)を求めるのは無理
def count(i, j):
pass
for i in range(9):
for j in range(9):
c[i][j] = count(i, j)
'''
for i in range(1, N+1):
s = str(i)
if s[0] == "0" or s[-1] == "0":continue... | true |
b2ad85c91ce72ed2da0f608c6e4131abe4f20a47 | xrw560/KK_AI | /K_opencv/0.入门/2.image_basics.py | UTF-8 | 531 | 3.234375 | 3 | [] | no_license | import cv2
import matplotlib.pyplot as plt
image = cv2.imread("image.jpg")
(h, w, c) = image.shape
print(image.shape)
(b, g, r) = image[0, 0]
print(image[0, 0])
image[0, 0] = (0, 0, 255)
(b, g, r) = image[0, 0]
print(image[0, 0])
cX, cY = (w // 2, h // 2)
tl = image[0:cY, 0:cX] # top left
tr = image[0:cY, cX:w]
bl... | true |
0d254809ffc62400f858dd7353edc72867e26029 | azisak/koramail | /backend/main.py | UTF-8 | 8,497 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python3
from flask import Flask, request, jsonify, g, Response, send_from_directory
from encrypt_body import *
import sys
import os
import json
import hashlib
import sqlite3
import glob
import ecdsa
import keccak
import os
# Reading config
with open('config.json') as config_file:
config = json.load(con... | true |
0cdd15126feb787c2c5404c25eb12f7ab08fc39d | mikeyshulman/pyctcdecode | /pyctcdecode/tests/test_alphabet.py | UTF-8 | 2,352 | 2.8125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | # Copyright 2021-present Kensho Technologies, LLC.
import unittest
from ..alphabet import Alphabet, _normalize_bpe_alphabet, _normalize_regular_alphabet
def _approx_beams(beams, precis=5):
"""Return beams with scores rounded."""
return [tuple(list(b[:-1]) + [round(b[-1], precis)]) for b in beams]
KNOWN_MAP... | true |
9e0c30e0a2d53b2172e3d60af702ab09b6a6ccbf | sike26/PFA-TransportTrack | /App/project/libraries/disturbanceLib/Collecte/tweets_tbc.py | UTF-8 | 6,471 | 2.734375 | 3 | [] | no_license | import tweepy
import pandas as pd
import pickle
class Tweet(object):
"""
/**
* The tweet object.
* @Name : Tweet
* @attribute : struct Game * - Game structure
* @attribute : int - Tweet Id (real ID)
* @attribute : datetime - Tweet Date
* @attribute : String - Tweet source
* @attr... | true |
73c32c34bf9c57b1e66eaccb3918d4c0c37918c7 | cchoe1/btc | /tx.py | UTF-8 | 663 | 3.125 | 3 | [] | no_license | import binascii
x = '../blocks/blk00000.dat'
def readFile(x):
with open(x, 'rb') as f:
hexdata = binascii.hexlify(f.read())
print("File Read")
return hexdata
def combineHex(hex):
arr = list(hex)
#arr.remove('\'')
#arr.pop(0)
print("combineHex() complete")
return arr
# accepts list of digits, forms byt... | true |
18454b13343ff230b65f9174b71b7d3eca0b9b2a | Mrbzs/advent-of-code | /2019/21/21.py | UTF-8 | 2,903 | 3.0625 | 3 | [] | no_license | import os
inputFile = open(os.path.dirname(__file__) + '/input.txt', 'r')
line = inputFile.read().rstrip()
inputFile.close()
def run(inputs):
program = dict(enumerate(int(i) for i in line.split(',')))
output = i = input_index = base = 0
temp = ''
while 1:
instruction = str(program[i]).zfill(5... | true |
73cf00dfffcc10366cdefe5cfb374e8103dbccd8 | nodcah/fprime | /Gds/src/fprime_gds/common/adapters/ip.py | UTF-8 | 12,393 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | import time
import logging
import socket
import threading
import fprime_gds.common.adapters.base
import fprime_gds.common.logger
LOGGER = logging.getLogger("ip_adapter")
class IpAdapter(fprime_gds.common.adapters.base.BaseAdapter):
"""
Adapts IP traffic for use with the GDS ground system. This serves two diff... | true |
f2a107954c4d7a58abefec579269cb80376543a1 | anna2244b/gabyzinha | /lost_city.py | UTF-8 | 399 | 3 | 3 | [] | no_license | ilha1 = input('Emma - ei, capitão!, Aquilo alí parece uma ilha. devemos parar o navio? sim/não')
while True:
if ilha1 == 'sim':
print('PIRATAS!. vamos procurar comidas mantimentos armas etc... NÃO SE SEPAREM OK? piratas- SIM SENHOR CAPITÃO!!!!.')
else:
print('*tempestade*')
from random import randint
tempestade... | true |
287a646c5f9fe1810cb3fd155fda72a6b94a9ea3 | yinzaihecode/hongongpython | /venv/chap51-60/class.py | UTF-8 | 321 | 3.109375 | 3 | [] | no_license | # 클래스 > 최상위 부모 클래스 무조건 상속!!
class 부모:
pass
class 자식(부모):
pass
print(부모.mro())
print(자식.mro())
'''
[<class '__main__.부모'>, <class 'object'>]
[<class '__main__.자식'>, <class '__main__.부모'>, <class 'object'>]
Process finished with exit code 0
''' | true |
b12e8f905056456fee54b21d4ef7706614cd3feb | hpc/charliecloud | /lib/filesystem.py | UTF-8 | 31,869 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | import errno
import fcntl
import hashlib
import json
import os
import pathlib
import re
import pprint
import shutil
import stat
import tarfile
import charliecloud as ch
## Constants ##
# Storage directory format version. We refuse to operate on storage
# directories with non-matching versions. Increment this number... | true |
a6baa512cfb735344f3562bb09e2839c53c7a154 | CarolineNz/projet-td | /select_lignes_all.py | UTF-8 | 452 | 3.15625 | 3 | [] | no_license | def select_lignes_all(date1, date2) :
'''Crée un nouveau tableau "periode" avec les lignes du tableau de base comprises entre les deux dates incluses '''
if date1=="2019-08-11 11:30:50+02:00" and date2=="2019-08-25 17:47:08+02:00" :
return tableau
else :
periode = []
for ligne ... | true |
daebbffe764d67ae2416d59dca248b2d5a9b3e61 | contactpunit/python_sample_exercises | /ds/ds/south_park_parsing.py | UTF-8 | 1,042 | 3.328125 | 3 | [] | no_license | from collections import Counter, defaultdict
import csv
import re
import requests
CSV_URL = 'https://raw.githubusercontent.com/pybites/SouthParkData/master/by-season/Season-{}.csv' # noqa E501
def get_season_csv_file(season):
"""Receives a season int, and downloads loads in its
corresponding CSV_URL"""
... | true |
1a3be44bccfc8350a8eef539e3eb0db7b9b0b1fb | openbaton/clearwater-packages | /bind9/scripts/substitute.py | UTF-8 | 1,082 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | #########################
# Openbaton #
#########################
# Author : lgr
# This script can handle substition of any string in any file
import sys
import os
def replace_gen_vars(line):
for k,v in gen_var_dict.iteritems():
line = line.replace(k,v)
return line
def main():
global ARG_LIST
global gen... | true |
1cf04442ab2d1bf3b190c139dd3142045e7dee2a | s-cai/news-scraper | /news_scraper/news_entry.py | UTF-8 | 2,223 | 2.71875 | 3 | [] | no_license | from .util import *
import datetime
serialization_date_format = '%Y-%m-%d'
serialization_time_format = '%Y-%m-%dT%H:%M:%S'
class NewsEntry:
def __init__ (self):
pass
# FIXME: what is this...
def set_fields (self, site_name, title, url, date, spot_time):
self.site_name = site_name
... | true |
3604adffa586cbef62d02a971a483d2b782cce6f | Sungden/pancreatitis-segmentation | /F_model_2D.py | UTF-8 | 8,475 | 2.59375 | 3 | [] | no_license |
from keras.applications import vgg16
from keras.models import Model, Sequential
from keras.layers import Conv2D, Conv2DTranspose, Input, Cropping2D, add, Dropout, Reshape, Activation
from keras.optimizers import Adam
import numpy as np
import matplotlib.pyplot as plt
from pylab import *
import os
import sys
from funct... | true |
466cfefdaabb81dad69012eea849f7034727649f | housong12590/haiwei | /app/helper.py | UTF-8 | 969 | 2.859375 | 3 | [] | no_license | from flask import jsonify
import datetime
import re
def make_response(msg='success', status_code=200, data=None):
"""
:param msg: success 成功 fail 失败
:param status_code: 返回状态码
:param data: 返回数据
"""
if data is None:
data = {}
response = {
'msg': msg,
'status_code': ... | true |
aec1bc1ddcd179d332b25e0332f5bff423ab6eca | d3m0-sm/KivyLightningATM_Repo | /KivyLightningATM_LCD/lnd_rest.py | UTF-8 | 8,770 | 2.9375 | 3 | [] | no_license | import json
import requests
import math
import shared_values
class LndRest:
class InvoiceDecodeError(BaseException):
"""This is currently under construction and not used. It will handle future exceptions"""
def __init__(self, **kwargs):
super().__init__()
pass
@static... | true |
f5226865aed9eeb7a01bc68ff6a8173e736ae3ba | AdamZhouSE/pythonHomework | /Code/CodeRecords/2180/60604/267450.py | UTF-8 | 953 | 2.890625 | 3 | [] | no_license | a=input()
b=input()
a1=[]
res=[]
b1=[]
for i in range(1,len(a)):
for j in range(len(a)-i+1):
if not a[j:j+i] in a1:
a1.append(a[j:j+i])
res.append(1)
else:
for k in range(len(a1)):
if a1[k]==a[j:j+1]:
res[k]+=1
'''for i in ... | true |
810268843908fd16fa72d6416e37a9e23c24cbf7 | junukitashepard/message_trade | /analysis/plotting.py | UTF-8 | 4,530 | 2.765625 | 3 | [] | no_license | from __future__ import division
import pandas as pd
import matplotlib.pyplot as plt
class Plots(object):
def __init__(self, ds, country, firstyear=2010, input_costs='$/GWa'):
self.ds = ds
self.country = country
self.firstyear = firstyear
if input_costs == '$/MWa':
se... | true |
47fb8232e610d001f6e4671108cc720838f1cef4 | stjordanis/AsteroidsDeepReinforcement | /systems/drawlinessystem.py | UTF-8 | 445 | 3.015625 | 3 | [] | no_license | pygame = None
screen = None
background = None
def run(objs):
""" Draws objects with get_points """
for obj in objs:
b,e = obj.get_points()
rect = pygame.draw.line(screen, (0,0,0),b,e)
rect = rect.clip(screen.get_rect())
try:
obj.dirty = background.subsurface(rect)
... | true |
6b86cad952c63090d6b13435efa9594996667c95 | rockthis/RateParser | /Alexa Rank.py | UTF-8 | 1,796 | 2.71875 | 3 | [] | no_license | import requests
from fake_useragent import UserAgent
from bs4 import BeautifulSoup
from xlsxwriter import Workbook
import xlrd
import re
from decimal import *
from openpyxl import load_workbook
from selenium import webdriver
from time import sleep
from selenium.common.exceptions import NoSuchElementException
from rando... | true |
ba9307c9e1bd0725b47207060a985b266fac7b55 | ticklemynausea/bejeweled | /matrix.py | UTF-8 | 3,596 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import random
import os
def colored(text, color = None, background = None, attributes = None):
COLORS = {
1 : 31,
2 : 34,
3 : 32,
4 : 33,
5 : 36,
6 : 35,
7 : 37,
8 : 137,
}
HIGHLIGHTS = {
1 : 41,
2 : 44,
3 : 42,
... | true |
6f83f0da335aa575bd2a1a0c28c370488a5ce3f3 | zhoujiahua/python_study | /com/a_py/test2.py | UTF-8 | 174 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: UTF-8 -*-
import os, sys
print('命令行参数如下:')
for i in sys.argv:
print(i)
print('\n\nPython 路径为:', sys.path, '\n')
| true |
b7fa6a49a802e150a002e65bd0a7c4003a31b14d | judywawira/objects | /exercises/exercise_2/tests_2.py | UTF-8 | 6,674 | 3.296875 | 3 | [] | no_license | #-*- coding: utf-8 -*-
u'''
Test exercise 2: mutable and immutable types common errors
'''
import unittest
import exercise_2 as source
# import solution_2 as source
class VerboseTestCase(unittest.TestCase):
'''Base unit tests class for verbose output
'''
@classmethod
def setUpClass(cls):
cls.m... | true |
31c0461694141720929bebbb0e0ae8c4147a5df6 | w495/python-video-shot-detector | /shot_detector/utils/collections/smart_dict.py | UTF-8 | 2,610 | 2.84375 | 3 | [] | permissive | # -*- coding: utf8 -*-
"""
This is part of shot detector.
Produced by w495 at 2017.05.04 04:18:27
"""
from __future__ import absolute_import, division, print_function
import six
# noinspection PyPep8
class SmartDict(dict):
"""
Simple object that implements `dict` behavior.
You can see it... | true |
4bb5585ef98d45992e0753a5b1fa15cd4cef0c3f | MyreMylar/nautical_adventure | /ui/ui_text_entry_line.py | UTF-8 | 3,043 | 2.9375 | 3 | [] | no_license | import pygame
class UITextEntryLine(pygame.sprite.Sprite):
def __init__(self, position, width, font, ui_group):
super().__init__(ui_group)
self.selected = False
self.position = position
self.width = width
self.font = font
self.bg_colour = pygame.Color('#000000')
... | true |
4227a2d7564300ed1063163cb69f00bd8d76c7ae | fahmed3/Journey42 | /utils/auth.py | UTF-8 | 1,066 | 2.96875 | 3 | [] | no_license | import os, hashlib
from flask import session
from utils import database
#encrypts passwords
def encrypt(password):
return hashlib.sha224(password.encode('utf-8')).hexdigest()
#creates a new user
def new_user(username, password):
return database.adduser(username, encrypt(password))
def update_pass(username, p... | true |
289954793b77c0104cb45bd659cf1dea91fffcf6 | HzcIrving/Naive-Bayes | /src/utils.py | UTF-8 | 3,489 | 3.3125 | 3 | [] | no_license | # STORES ACCESSORY CLASSES AND FUNCTIONS
import bisect
import time, sys
import numpy as np
import math
# Class used to manage sorted sets of a continuous variable
class continuousBin:
def __init__(self, attrName):
self.values = []
self.attrName = attrName
self.mean = None
self.classMean = {}
def add(self, ... | true |
9e15fb787824c1f6b51ed94030e6220cd9f4ff9d | rukmangadhank/rukman | /oddeven.py | UTF-8 | 119 | 3.515625 | 4 | [] | no_license | num= int(input(''))
a=num%2
if num<0:
print("invalid")
elif a==0:
print("Even")
else :
print("Odd")
| true |
c3d60d6f93625ce863f1ea765c7f16cf4075130d | SimLej18/mini_projet_3 | /get_theme.py | UTF-8 | 1,101 | 4.21875 | 4 | [] | no_license | def get_theme(probabilities, most_probable_theme=('', 0)):
"""
Finds the theme of an article by comparing the probabilities of each theme.
Parameters:
-----------
probabilities: list containing a tuple for each theme in the form (theme, probability)
most_probable_theme: tuple containing the most... | true |
1c8fd9cc484c52fcc7cd81c7dc71bc25eecb2d7b | OmarNour/DWH_Redshift | /create_tables.py | UTF-8 | 1,585 | 2.921875 | 3 | [] | no_license | import configparser
import psycopg2
from sql_queries import create_staging_table_queries, drop_staging_table_queries, create_dwh_table_queries, drop_dwh_table_queries
def drop_tables(cur, conn, tables_list):
"""
to drop tables given in a list
:param cur: an instance to execute database commands
:param... | true |
318364c22ba5d7e173503a8241e7d29b9bcfa061 | dveetil-github/2020sp-finalproject-dveetil-github | /finalproject/dags/tasks.py | UTF-8 | 3,977 | 2.71875 | 3 | [] | no_license | import os
import shutil
import datetime, logging
import dask.dataframe as dd
import pandas as pd
import matplotlib.pyplot as plt
from finalproject.dags.generate_tables import create_tables, drop_tables
from finalproject.dags.sql_scripts import HOST, DB_NAME, DB_USER, DB_PASSWORD, data_stagg_qrys, data_transform_qrys... | true |
2d92c621d14450a7a8b6a34f710c18886a940ef6 | flysall/daily-code | /python/py-tutorial/py_3/end.py | UTF-8 | 66 | 3.34375 | 3 | [] | no_license | a,b = 0,1
while b < 1000:
print(b, end='::')
a,b = b, a+b
| true |
80a42e417613d36bcea0e72621666f8cce07df83 | rudegentleman/wirelessProject | /read.py | UTF-8 | 1,608 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 18 00:39:52 2018
@author: rudegentleman
Last Edit: March 22, 2018 16:29:30
"""
import serial
import MySQLdb
# Initializing open communication port and baud or datarate
# The serial port might change, so make sure you check which port you're
# conne... | true |
3d81b8187d36deb6816403ddc5e147f9b2501ee6 | takin6/algorithm-practice | /at_coder/biginner/2_3_dp/2_3_2/aoj_edit_distance.py | UTF-8 | 381 | 2.890625 | 3 | [] | no_license |
A, B = input(), input()
N, M = len(A), len(B)
dp = [ [0] * (N+1) for _ in range(M+1) ]
for i in range(N+1):
dp[0][i] = i
for j in range(M+1):
dp[j][0] = j
for i in range(1, M+1):
for j in range(1, N+1):
if B[i-1] != A[j-1]:
dp[i][j] = min(dp[i][j-1]+1, dp[i-1][j-1]+1, dp[i-1][j]+1)
... | true |
5038c5278a795124a899097e9d9db6f06b6d6c5a | kritikillz931/Critters-and-Croquettes | /animals/anglerfish.py | UTF-8 | 238 | 2.78125 | 3 | [] | no_license | from animals import Animal
from movements import Swimming
class AnglerFish(Animal, Swimming):
def __init__(self, name, species, shift, food):
Animal.__init__(self, name, species, shift, food)
Swimming.__init__(self)
| true |
1e1e2c8e0311876b9143d2a6f11848ff63766995 | EmanuelDionisio/AtividadesPython | /ExerciciosPython/questao5.py | UTF-8 | 84 | 2.8125 | 3 | [] | no_license | #Faça um algoritmo que mostre a mensagem “Alô mundo”
#na tela
print("Alô mundo") | true |
90a0e3a43e93f0a3c9806a33f644187a48a57dd6 | HamPUG/meetings | /2020/2020-10-12/program_update.py | UTF-8 | 1,415 | 3.921875 | 4 | [] | no_license | #!/usr/bin/env python3
#
# program_update.py
#
# Embedded on the last line is the count of times the program has been run.
# Each time the program is run, update the count.
#
# Could almost be called "self-modifying code".
#
# Ian Stewart - 2020-10-09
import sys
PROGRAM_NAME = sys.argv[0]
#
def main():
"Main prog... | true |
d086e9d5b6f403d5bab47ed51c3729d9699bd3ad | CHRF-Genomics/Paratype | /paratype.py | UTF-8 | 22,493 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
'''
This script assigns genotypes to Salmonella Paratyphi A isolates using whole-genome sequencing data.
It uses FASTQ or BAM (recommended) or VCF (if highly trusted SNP data) or FASTA (assembled contigs) files relative to Paratyphi A AKU_12601 (NC_011147.1). Also, it reads allele definitions of ... | true |
cd08c802761e5e148c4991e8a88333d87307a4bf | choo0618/TIL | /algoritm/20상반기 코딩테스트/그리고 하나가 남았다/bj3895.py | UTF-8 | 355 | 2.53125 | 3 | [] | no_license | import sys
sys.stdin = open('bj3985.txt','r')
while True:
N,K,M=map(int,input().split())
if not N+K+M:break
L=[int(x)+1for x in range(N)]
Idx=M-1
L.pop(Idx)
while len(L)!=1:
Idx-=1
if Idx<0:Idx = len(L)-1
tmp = K%len(L)
Idx+=tmp
if Idx>=len(L):Idx-=len(L)... | true |
333f3f90428c53f27a5057518787c4902d6d0744 | alleyazahri/RayTracing | /Program Files/6DiffuseInterRef/Diffuse.py | UTF-8 | 5,940 | 2.65625 | 3 | [] | no_license | '''
Created on Jan 29, 2015
@author: Alley
'''
from vec3d import Vec3D
from PIL import Image
from sphereEdit2 import Sphere
from multiprocessing import Pool
import random
width = 550
height = 550
image = Image.new('RGB',(width,height))
start = 2
def splitWork():
pixels =[]
p = Pool(4)
for n in range(18)... | true |
7f23755a9e693d7e26faed535ce7aeae50136a27 | applied-systems-biology/Dynamic_SPHARM | /SPHARM/classes/spectrum.py | UTF-8 | 14,586 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | from __future__ import division
import os
import numpy as np
import pandas as pd
import pylab as plt
import pyshtools.expand as shtools
import seaborn as sns
from helper_lib import filelib
class Spectrum(object):
"""
Class for storing and handling the SPHARM spectrum of a surface.
"""
def __init__(... | true |
abfc66c7d01cf5e381745bceec5bccd4b08ff1ec | udhayprakash/PythonMaterial | /python3/18_aws_cloud/a_AWS_Lambdas/a_Basic/b1_event_object_usage.py | UTF-8 | 894 | 3.03125 | 3 | [] | no_license | import json
def lambda_handler(event, context):
# Extract values from the event object
request_id = event["requestContext"]["requestId"]
path = event["path"]
http_method = event["httpMethod"]
query_string_parameters = event["queryStringParameters"]
headers = event["headers"]
body = event["... | true |
4ecc01980fbadfda5188912626397e2343cff287 | fernandorssa/CeV_Python_Exercises | /utilidades/valores/m__110.py | UTF-8 | 1,034 | 3.828125 | 4 | [] | no_license | def aumentar(n, aumento):
return n + (n * aumento / 100)
def diminuir(n, reducao):
return n - (n * reducao / 100)
def dobro(n):
return n * 2
def metade(n):
return n / 2
def moeda(n, s=False):
if s:
if n == int:
n = str(n)
return f'R${n},00'
else:
... | true |
85f08cc633331e479b5953dc1f7ccfb2092c186f | faissalbl/dinheiro | /test/dao/PagamentoDAOTest.py | UTF-8 | 7,961 | 2.671875 | 3 | [] | no_license | from datetime import date
from datetime import datetime
from test.GenericTest import GenericTest
from dao.DespesaTempDAO import DespesaTempDAO
from dao.PagamentoDAO import PagamentoDAO
from models.Despesa import Despesa
from models.DespesaTemp import DespesaTemp
from models.Pagamento import Pagamento
class PagamentoDA... | true |
cd908d585408b071bf4ac6759afd8d3ad373d362 | AustinGiddensAPG/Python | /Turtle.py | UTF-8 | 2,388 | 4 | 4 | [] | no_license | #This is the beginning to the code. This basically gets the Turtle going, importing the use of the program while the code runs.
import turtle
wn = turtle.Screen()
wn.bgcolor("black")
turtle = turtle.Turtle()
turtle.speed(0)
turtle.penup()
turtle.shape("turtle")
#This is the code that draws the initial rectangle that i... | true |
b39a6113a15be70e5b5edd341d34310f435f0d59 | Aasthaengg/IBMdataset | /Python_codes/p02270/s105790386.py | UTF-8 | 658 | 2.953125 | 3 | [] | no_license | n,k = map(int,input().split())
w = []
for _ in range(n):
w.append(int(input()))
def enough(p,k,w):
count = 0
in_truck = 0
for x in w:
if x > p:
return False
else:
if in_truck + x > p:
count += 1
in_truck = x
else:
... | true |
b19f2df031f294dfe0fbb00f6ad163fb3292526f | luisVallejo79/visionArtificial | /cargarYRedimencionarVideo.py | UTF-8 | 453 | 2.828125 | 3 | [] | no_license | import cv2
import imutils
#cargando un video en la variable cap
cap = cv2.VideoCapture('personas.mp4')
while True:
# la funcion video.read() retorna un boleando y el fotograma
ret, frame = cap.read()
if ret == False: break
#redimencionar el video, ya que estaba muy grande el formayo
frame = imutils.resize(frame... | true |
adc3c678e76d450bb66ac7a2cd6c17381ea1dc9a | Aasthaengg/IBMdataset | /Python_codes/p02936/s602193446.py | UTF-8 | 469 | 2.765625 | 3 | [] | no_license | N, Q = map(int, input().split())
G = [[] for _ in range(N)]
for _ in range(N-1):
a, b = map(int, input().split())
G[a-1].append(b-1)
G[b-1].append(a-1)
memo = [0]*N
for i in range(Q):
p, x = map(int, input().split())
memo[p-1] += x
import queue
q = queue.Queue()
q.put((-1, 0))
while not q.empty()... | true |
80995d40fb2d5e9f9cbf6484dd9a231440971eae | vgmoose/meridian | /config/mail/helper.py | UTF-8 | 308 | 2.515625 | 3 | [] | no_license | import getpass, base64 # well isn't this a recipe for disaster, see readme
server = raw_input("Remote server? ") or "imap.gmail.com"
email = raw_input("Email address? ")
other = getpass.getpass()
vals = base64.b64encode("\n".join((server, email, other)))
f = open("contents", "w")
f.write(vals)
f.close()
| true |
8b3b7c1522e8d8bb94b2ff8a2e6386746263a96b | mullinmax/tournament | /tournament/player.py | UTF-8 | 1,463 | 3 | 3 | [] | no_license | import os
import time
class player():
path = ''
player_name = ''
author = ''
score = 0
def __init__(self, path, player_name = '', author=''):
self.path = path
self.player_name = player_name
self.author = author
def take_turn(self, data = None, time_limit=None):
... | true |
5167090fe17e7f44ee5f4a226fc0b9c61a2533d1 | IliaAzhel/monitoring_hdd_ssd | /app/desktop/login.py | UTF-8 | 2,577 | 2.5625 | 3 | [] | no_license | from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQml import QQmlApplicationEngine
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot
import requests
import monitoring
import time
class Authentification(QObject):
def __init__(self):
QObject.__init__(self)
login = ""
password = ""
auth... | true |
c10a299b3a7dcda729a055790e3f8dd5bf63365d | hhhhhjl/triple_extraction | /get_myextraction | UTF-8 | 5,288 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#获取三元组代码
import os
import copy
import time
import argparse
#调用stanfordcorenlp
from stanfordcorenlp import StanfordCoreNLP
nlp = StanfordCoreNLP(r'../stanford-corenlp-full-2018-10-05')
#输入输出文件
#out_file_name = "output.txt"
in_file_name = "../data2/bioconcepts2pubtato... | true |
c02029ede0c69323efd6c70c507d837744dd3264 | channghiep/pingpong | /main.py | UTF-8 | 1,560 | 3.03125 | 3 | [] | no_license | import time
from turtle import Screen
from paddle import Paddle
from ball import Ball
from scoreboard import Scoreboard
RIGHT_POS = (350, 0)
LEFT_POS = (-350, 0)
screen = Screen()
screen.bgcolor("black")
screen.setup(800, 600)
screen.title("Pong")
screen.tracer(0)
ball = Ball()
r_paddle = Paddle(RIGHT_POS)
l_paddle ... | true |
810d4e9e24fb38891cb1f8a02ea76c0343893a3d | Bejerry/ML-Tensorflow-Ex | /BP.py | UTF-8 | 1,437 | 2.9375 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
# Train recruisive function, formula:y = 0.1x +0.3
# create data
x_data = np.random.rand(100).astype(np.float32)
y_data = x_data*0.1 + 0.3
#print(x_data,y_data)
# create tf struct begin #
Weights = tf.Variable(tf.random_uniform([1], -1.0, 1.0))
Biases = tf.Variable(tf.z... | true |
3c3fe0523b9cd50f91244b1a8b9258d04b393c26 | cha63506/ArcGIS_Scripts | /bin/BatchExportandPrint.py | UTF-8 | 3,537 | 2.6875 | 3 | [] | no_license | """
Batch Export and Print
This script takes MXD files
and exports all the maps as selected
@author Steven Porter
@contact: porters1@ohio.edu
@organization: The Voinovich School for Leadership and Public Affairs, Ohio University
@version 1/20/11
"""
import arcpy, sys, os
#Input variables. Re... | true |
44f6727056391b1653a94a0096c2dc45f5ee539e | OlegZhdanoff/algorithm | /lesson_8/task_1.py | UTF-8 | 977 | 3.96875 | 4 | [] | no_license | # 1) Определение количества различных подстрок с использованием хеш-функции. Пусть на вход функции дана строка.
# Требуется вернуть количество различных подстрок в этой строке.
# Примечание: в сумму не включаем пустую строку и строку целиком.
# Пример работы функции:
#
# func("papa")
# 6
# func("sova")
# 9
#
import ha... | true |
e0642169e89e486cf6d5441752c00f96208a9453 | mtk57/PublicMemo | /Python/Lib/src/log.py | UTF-8 | 536 | 2.8125 | 3 | [] | no_license | import logging
class Log():
def __init__(self, logfile):
# ロガーを作成
self.log = logging.getLogger(logfile)
# レベルを設定
self.log.setLevel(logging.DEBUG)
# ハンドラを作成
handler = logging.FileHandler(logfile)
# 書式を作成
fmt = "%(asctime)s:%(message)s"
form... | true |
b1173819a4bd687ecba15aed8c5c35f5b0a3da80 | MalgorzataStruzik/nauka_python | /gwiazdka.py | UTF-8 | 354 | 3.609375 | 4 | [] | no_license | for i in range (5):
print("x"*i)
names = ["Ania", "Kasia", "Jan", "Piotr", "Paweł"]
for name in names:
print("Cześć", name)
print("-------------")
names = ["Ania", "Kasia", "Jan", "Piotr", "Paweł"]
for i in range(5):
print("Cześć", names[i])
for i in range(3):
for j in range(1, 6... | true |
76d0b84f107bcb6db6ea5a768d701f0faa8a518c | damanjitsingh/pythonPrograms | /pythonPrograms.src/RandomImplementations/MySplit.py | UTF-8 | 2,026 | 3.71875 | 4 | [] | no_license | '''
Created on Mar 26, 2015
@author: daman
'''
from operator import add
'''
This is my attempt to implement split function
e.g."28+32+++32++39".split will give {'28','32','','','32','','39'}
'''
'''
is there any good and simple way to do that, i feel that the below implementation is error prone and is complex
to under... | true |
e5ffb62749760139dd34d32e0fe378b42a20c093 | jayrajan/py-app | /main.py | UTF-8 | 227 | 2.640625 | 3 | [] | no_license | # Code written by Jerin Rajan on 19th april 2020
print('hello py-world\n')
c = 10
b = 11
# Core function:
# Create a database
#
# Create new item in database
# Read from database
# Update the database
# Delete a record
| true |
bae1c5ed83a0cd50bc52056dc3d81005d4cacb4f | Kalobi/python-fractals | /mandelbrot.py | UTF-8 | 9,607 | 2.640625 | 3 | [] | no_license | import itertools
import cmath
import math
import random
import time
import sys
import argparse
import contextlib
from PIL import Image
from colour import Color
import matplotlib.pyplot as plt
import numpy as np
class InvalidOptionsException(Exception):
pass
def normalize_pixel(pixel, size, xrange, yrange):
... | true |
5a8bcc975107967846540c2facfe1da698d766f0 | JKeun/determinism | /simple-test/nn_example.py | UTF-8 | 2,207 | 2.734375 | 3 | [] | no_license | import itertools
import pandas as pd
import numpy as np
import tensorflow as tf
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import train_test_split
from sklearn.compose import ColumnTransformer
from sklearn.impute import SimpleImputer
from sklearn.pipeline import Pipeline
from sklearn.p... | true |
fbfee9ca8a120f063e48b5a9ee2e51cde66311a5 | eunbeejang/Gender_Generalization | /Data/AN-SEM/pre_pro.py | UTF-8 | 724 | 2.71875 | 3 | [] | no_license | import re
import os
import pandas as pd
import itertools
directory = './'
folder = os.fsencode(directory)
all_str = []
for file in os.listdir(folder):
filename = os.fsdecode(file)
i = 0
if filename.endswith('.txt'):
try:
#f_open = open(directory + '/' + filename , "rb")
f_open = pd.read_csv(directory + '/... | true |
f89e4647732e1296beda64ec672acd23b126cd31 | bossjones/openheating | /openheating/transport.py | UTF-8 | 1,715 | 2.71875 | 3 | [] | no_license | from .thinking import Thinker
from .switch import Switch
import logging
class Transport(Thinker):
def __init__(self, name, source, sink, diff_hysteresis, pump_switch):
self.__name = name
self.__source = source
self.__sink = sink
self.__pump_switch = pump_switch
self.__diff_... | true |
fbf3a562d8103f5b68aa0540b74481c888226f4e | giselemanuel/programa-Ifood-backend | /qualified/sem6_qualified_4.py | UTF-8 | 851 | 4.21875 | 4 | [
"MIT"
] | permissive | """
Instruções
Crie uma função com a seguinte assinatura verifica_chave(dicionario, chave) que recebe um dicionário e um valor qualquer como parâmetro
Implemente uma lógica para checar se a chave passada como parâmetro já existe no dicionário
Se a chave existir no dicionário, a função deve retornar o booleano True
Caso... | true |
eb8171551e7dabf62d15318e792d8db12f2fd4d0 | ioluwayo/BME-808 | /LAB2/partA/frequency.py | UTF-8 | 1,224 | 3.296875 | 3 | [
"Apache-2.0"
] | permissive | # Created by ioluwayo on 2017-01-26.
#There are 336 genes on Chromosome 6 of Plasmodium falciparum.
import re
def calculateNucleotideFrequency (occurrences, total):
return float(occurrences)/float(total)
def countOccurrence (nucleotide, sequence):
return (sequence.count(nucleotide))
if __name__ == '__main__... | true |
eee83cb5236a407a8596d871050c8aa163ed5bbf | ts4051/gm2plots | /trackerTestBeam/jun2015/mwpcResolution.py | UTF-8 | 1,886 | 3.15625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
from scipy.optimize import curve_fit
from scipy.stats import chi2
from sys import argv,exit
import datetime
from math import log10,pow,sqrt,fabs
from random import gauss,uniform
import argparse
#
# Helper functions
#
#Cal... | true |
47a507eee05f67a87a48f85cc7ce4a7ef369e8b9 | yanxurui/keepcoding | /python/algorithm/leetcode/160.py | UTF-8 | 1,635 | 3.59375 | 4 | [] | no_license | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def len(self, head):
n = 0
p = head
while p:
p = p.next
n += 1
return n
def shift(self, ... | true |
051db4f66dd5adec3de8521528103a35fb354cf8 | MaryanneNjeri/pythonModules | /.history/coinChange_20200702174948.py | UTF-8 | 474 | 3.03125 | 3 | [] | no_license | def coinChange(num):
# coins = [1,5,7,9,11]
coins = [1]
# 25
arrayWays = [0] * (num +1)
# there is one way to make coin 0 using 0
arrayWays[0] = 1
for i in range(len(coins)):
for j in range(len(arrayWays)):
print('j',j)
if coins[i] :
sum =... | true |
724edc6755e8f5980eb822514f1d9e8317f9634e | neilpanchal/py_mip_sample | /mip_test.py | UTF-8 | 6,263 | 2.5625 | 3 | [
"MIT"
] | permissive | import time
from PIL import Image
import numpy as np
import datetime
IS_RASPI = False
try:
import spidev
import RPi.GPIO as GPIO
IS_RASPI = True
except:
pass
print("SPI LOAD:", IS_RASPI)
print("##### PYTHON NIL #####")
DISP = 27
SCS = 22
VCOMSEL = 17
BACKLIGHT = 4 #if GPIO 4(pin7) is already used with... | true |
d75c849e98ba7e3083d9e5a7adfc05e14d14b4e8 | Gfz-arka/MFE-5250 | /execution.py | UTF-8 | 3,510 | 3.0625 | 3 | [] | no_license | # execution.py
import datetime
import pandas as pd
import queue
from abc import ABCMeta, abstractmethod
from event import FillEvent
class ExecutionHandler(object, metaclass=ABCMeta):
"""
ExecutionHandler抽象类处理由Portfolio生成的order对象与实际市场中发生的
Fill对象之间的交互。
这个类可以用于实际的成交,或者模拟的成交
"""
... | true |
5c3b207a6733c666d093227cb6178bea254023c5 | CHDYangMeng/crawler | /shanxi_baidu/main2.py | UTF-8 | 1,526 | 3 | 3 | [] | no_license | import requests
import time
import pymysql
def get_data(city_id):
url = 'http://api.map.baidu.com/place/v2/search?query=交通设施&tag=收费站®ion='+city_id+'&output=json&ak=4wAjx3T4AQtpbqfwuNByB83XkWWVhN0o'
response = requests.get(url)
soup = response.json()
stations = soup['results']
for station in sta... | true |
b2d50c2518453b00dc2a8cfebe0379c7ad5115b3 | jjmaldonis/StructOpt_modular | /structopt/common/population/predators/roulette.py | UTF-8 | 2,692 | 2.96875 | 3 | [] | no_license | import random
from itertools import accumulate
from structopt.tools import root, single_core, parallel
@single_core
def roulette(population, fits, nkeep):
"""Selection function to order and select structures based on simple relative cost. Does not allow duplicates."""
"""The cost selection option is a roulet... | true |