blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
9ddd00c32e39e75fc2dc86eab1a749ea4157c8f6 | Python | hugoruscitti/pybox | /pybox/dialogs/open.py | UTF-8 | 2,130 | 2.734375 | 3 | [] | no_license | import cPickle
import gtk
class OpenDialog:
"""Abstract open dialog."""
def __init__(self, parent, canvas, status, pattern, name):
self.canvas = canvas
self.parent = parent
self.status = status
self._create_dialog(pattern, name)
self._run()
def _create_dialog(self,... | true |
588fa10a6ed9030eca0fdae37dc2148c30cacd6a | Python | fengges/leetcode | /101-150/132. 分割回文串 II.py | UTF-8 | 951 | 3.078125 | 3 | [] | no_license |
class Solution:
def minCut(self, s):
dp=[[False for i in s] for j in s]
size=len(s)
for i in range(size):
dp[i][i]=True
for i in range(size-1):
if s[i+1]==s[i]:
dp[i][i+1]=True
for i in range(2,size+1):
for j in range(size-... | true |
1aa4915635abfbaed83f4e09751e76a67e845c53 | Python | smurugap/tools | /flow.py | UTF-8 | 2,459 | 2.765625 | 3 | [] | no_license | import os, subprocess, re, matplotlib, time, numpy
matplotlib.use('Agg')
import matplotlib.pyplot as plt
iter = 5
ind = numpy.arange(5)
width = 0.70 # the width of the bars
fig, ax = plt.subplots(figsize=(10,7))
ax.set_xticks(ind+width)
ax.set_ylabel('No of hash buckets')
ax.set_xlabel('Depth of the bucket')
ax... | true |
2a24d54cb74523befc9f166da6d039676a503794 | Python | niklasadams/explainable_concept_drift_pm | /pm4py/algo/filtering/pandas/cases/case_filter.py | UTF-8 | 4,149 | 2.609375 | 3 | [] | no_license | import pandas as pd
from pm4py.util import constants, xes_constants
from enum import Enum
from pm4py.util import exec_utils
class Parameters(Enum):
TIMESTAMP_KEY = constants.PARAMETER_CONSTANT_TIMESTAMP_KEY
CASE_ID_KEY = constants.PARAMETER_CONSTANT_CASEID_KEY
def filter_on_ncases(df, case_id_glue=constants... | true |
d42089b5912b974f3c08638b9b276e81986a3f2a | Python | Sariel-D/SDomain | /dnsdb/rfile.py | UTF-8 | 938 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
# Data From File
import platform
import os
def coupling_file_addr(file_addr):
current_os = platform.system().lower()
print '[!] 当前系统版本({0}), 尝试转换不规范路径.'.format(current_os)
if current_os == 'win':
file_addr = file_addr.replace('/', '\\')
elif current_... | true |
78e2af45e6857829d99fc0c3c1962c5edaf5275f | Python | luka3117/toy | /py/山内 テキスト text sample code/PythonStatistical 山内/ch6/list6-7.py | UTF-8 | 415 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# List 6-7 母分散の比の検定(母分散の等質性の検定)~f検定
import math
import numpy as np
from scipy.stats import f
m = 10
n = 10
xmean = 76.3
ymean = 70.5
xvar = 160.1
yvar = 59.6
F = xvar/yvar
f_lower = f.ppf(0.025, m-1, n-1)
f_upper = f.ppf(0.975, m-1, n-1)
print('F=', round(F, 4), 'reject=', (F<f_lower)or(f_upper... | true |
8e6efb1c7bec5df87d4ad89e434015163dd781fb | Python | PancrasL/chinamap-coloring | /coloring_algorithm.py | UTF-8 | 4,452 | 3.09375 | 3 | [] | no_license | from pprint import pprint
import copy
id_to_name = {'1': '北京',
'10': '黑龙江',
'11': '江苏',
'12': '浙江',
'13': '安徽',
'14': '福建',
'15': '江西',
'16': '山东',
'17': '河南',
'18': '湖北',
'19': '... | true |
6b56e817be2421806a691237f5205c68288651f0 | Python | elcerdo/projecteuler | /problem15.py | UTF-8 | 432 | 2.765625 | 3 | [] | no_license |
import scipy as s
total=s.zeros((21,21),dtype=s.int0)
total[0,0]=1
def updatetotal(i,j):
nn=[]
if i>0: nn.append(total[i-1,j])
if j>0: nn.append(total[i,j-1])
total[i,j]=sum(nn)
for k in xrange(1,total.shape[0]):
for l in xrange(0,k+1):
updatetotal(k-l,l)
for k in xrange(-total.shape[0]... | true |
fd59cd177546cee8feba33ba99d76615f7731f55 | Python | kjchavez/pong-network | /Server/PongClient.py | UTF-8 | 12,059 | 2.84375 | 3 | [] | no_license | # Pong Client
import socket
from PongNetworkConstants import *
from GameEngine2D import *
USE_NETWORK = True
class PongWorld(World):
def __init__(self,surface):
World.__init__(self,"Pong",surface)
self.playerScore = 0
self.opponentScore = 0
self.playerSide = None
... | true |
5e7ac2222ebb6cf2fcb267863f36d4dc16845475 | Python | dagrewal/nfl-big-data-bowl-2021 | /wrangling/eda.py | UTF-8 | 760 | 2.75 | 3 | [] | no_license | """
NFL EDA of individual files using pyspark
"""
import pandas as pd
from pyspark.sql import SparkSession
from pyspark.context import SparkContext
from pyspark.sql.functions import *
from pyspark.sql.types import *
import utils
import sys
# initialise spark session
sc = SparkSession.builder.appName('nfl-eda')\
.... | true |
5db6a84b1882e96da0f66769cb24dd1023ee8bc2 | Python | javiermontenegro/Python_Design.Patterns | /Behavioral/TemplatePattern.py | UTF-8 | 1,373 | 3.5 | 4 | [
"MIT"
] | permissive | #********************************************************************
# Filename: TemplatePattern.py
# Author: Javier Montenegro (https://javiermontenegro.github.io/)
# Copyright:
# Details: This code is the implementation of the template pattern.
#*****************************************************************... | true |
f6d027205ecc66e4c3f4d9e823338fa75a7bc349 | Python | GiladSchneider/laughing-pancake | /astar.py | UTF-8 | 787 | 3 | 3 | [] | no_license | from astar_algo import loop
#initializes the boards
def init(n,num):
board=[]
#print ("arrays5/arrays%s.txt" %(num))
file = open("arrays%a/arrays%s.txt" %(n,num),"r")
for i in range(n):
line = file.readline()
if ('S' in line):
xstart = i
ystart = line.... | true |
8e292665e52f488fdafd2e658ef60e5a3784beb5 | Python | pedrobf777/MarchMadness | /src/utils.py | UTF-8 | 1,957 | 2.59375 | 3 | [] | no_license | import pandas as pd
from numpy import nan
from sklearn.preprocessing import LabelEncoder
def load_target_sample():
target = pd.read_csv('data/SampleSubmissionStage2.csv').set_index('ID')\
.drop('Pred', axis=1)
target['Season'] = target.index.map(lambda i: i[:4])
target['team_a'] = target.index.map... | true |
3c0ae787aea711aa725d092f17288a6140f24812 | Python | ZombieSave/Python | /Урок1.5/Задача2.py | UTF-8 | 587 | 4.03125 | 4 | [] | no_license | # 2. Создать текстовый файл (не программно), сохранить в нем несколько строк, выполнить подсчет количества строк,
# количества слов в каждой строке.
try:
with open("Задача1.dat", "r", encoding="utf-8") as f:
data = [i for i in f]
except IOError:
print("Ошибка при чтении файла")
print(f"Строк в файле: ... | true |
ea972db451a8b60430d4860a88ab5061a36a2022 | Python | uk-gov-mirror/ministryofjustice.opg-repository-reporting | /output/ouput.py | UTF-8 | 720 | 3.25 | 3 | [] | no_license |
# output class
class outputer:
data_store = {}
conversion_function = None
save_function = None
def __init__(self, conversion_function, save_function):
self.conversion_function = conversion_function
self.save_function = save_function
return
def append(self, key, values):
... | true |
bed310213d50d83d0bdf9941eb41e14c9b527cc0 | Python | UCRoboticsLab/gourmetBot | /light_show.py | UTF-8 | 850 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python2
import argparse
import sys
import rospy
import baxter_interface
def off_lights(navs):
for nav in navs:
nav.inner_led = False
nav.outer_led = False
def main():
rospy.init_node('light_show')
navs = (
baxter_interface.Navigator('left'),
baxter_interfac... | true |
e2c109b90721a4a3581a5c0c38f57f99f934fec5 | Python | sftmsj/python-stepik | /loops.py | UTF-8 | 938 | 3.3125 | 3 | [] | no_license | # a = 5
# while a <= 55:
# print(a, end=' ')
# a += 2
# c = 1
# while c < 7:
# print('*' * c)
# c += 1
# i = 0
# while i < 5:
# print('*')
# if i % 2 == 0:
# print('**')
# if i > 2:
# print('***')
# i = i + 1
# a = int(input())
# s = 0
# while a !=... | true |
bd40efa5bcb84bf7581e2f4122a4c7ab29292a95 | Python | danihooven/Principles-of-Programming | /Homework07/homework07_02.py | UTF-8 | 1,332 | 3.984375 | 4 | [] | no_license | """ -------------------------------------------------------------------------------------------------------------------
ITEC 136: Homework 07_02
Modify your first program to print count of the words instead of percentage of the letters.
In this exercise you will get your input from a file.
Case should be ignored.... | true |
1ddc78d43bdcfab2d5215ce793580551117c1671 | Python | anhthuanprobg/ngotuantu-Fundamentals-c4e13 | /Session01/homework/hello_world.py/area_of_circle.py | UTF-8 | 53 | 3.53125 | 4 | [] | no_license | r= int(input("Radius"))
s= 3.14*r^2
print("Area =",s) | true |
01f393a49e410da7cd29f4168e5f44abbe4450a9 | Python | spanceac/raspboil | /mail.py | UTF-8 | 3,558 | 2.65625 | 3 | [] | no_license | import imaplib
import email
from datetime import datetime
import time
date = ""
action = ""
date_unsplit = ""
have_mail = 0 #variable used to avoid checking empty time structures in check_date at first run if no new mail available
def check_mail(none):
global date, action, have_mail, date_unsplit
result, maildata = ... | true |
3cb0abc40a21d61a3fcc81472345fc812962bc9b | Python | daniela2001-png/MIN_TIC_UNAL | /FUNCIONES/area.py | UTF-8 | 227 | 3.515625 | 4 | [] | no_license | #!/usr/bin/python3
from math import pi
def rectangulo(b, h):
return b * h
def circulo(r):
return pi * r ** 2
def total_area():
total = rectangulo(5, 10) + circulo(3) * 2
return total
print(total_area())
| true |
183f19223366f5c96d26c7c16b61708e13e7e719 | Python | Crossnonsense/Final-project-RTSoft | /main.py | UTF-8 | 4,698 | 2.84375 | 3 | [] | no_license | import cv2
import numpy as np
def canny_filter(frame):
r_channel = frame[:, :, 2]
binary = np.zeros_like(r_channel)
binary[r_channel > 220] = 255
s_channel = frame[:, :, 2]
binary2 = np.zeros_like(s_channel)
binary2[s_channel > 211] = 1
allBinary = np.zeros_like(binary)
allBinary[((bi... | true |
859bb6e822e3da7f83c604c03bfd36ce71235756 | Python | ot-vinta/PentaMail | /scripts/server/python/Normalizer.py | UTF-8 | 3,453 | 3.03125 | 3 | [] | no_license | from nltk.stem import LancasterStemmer
import Translator
def separate_char(s, c):
d = len(s)
j = 1
while j < d - 1:
if (s[j] == c) and (s[j - 1] != ' '):
s = s[0: j] + ' ' + s[j: len(s)]
d += 1
if (s[j] == c) and (s[j + 1] != ' '):
s = s[0: j + 1] + ' ' ... | true |
0afee82bc951a4c423c01b60a164725a277ebd34 | Python | JuliaZxr/LagouPractice_Yuki | /appium_test/test_touchActionDemo.py | UTF-8 | 1,334 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/8/29 12:32
# @Author : Yuki
"""
https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/touch-actions.md
TouchAction
TouchAction对象包含一系列事件。
在所有appium客户端库中,都会创建触摸对象并为其分配一系列事件。
规范中可用的事件是:
press
release
moveTo
tap
wait
longPress
cancel
p... | true |
89aef2771bc3507278f56c56fdfaca8672fea77a | Python | Zander-M/ICS-Exercise | /Midterm/stack_union_student.py | UTF-8 | 1,290 | 3.671875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 20 15:58:27 2017
@author: Mebius
Joyce edited it on Mar 12 2018
"""
import stack_student
def stack_union(lst1, lst2):
"""find the union of two *sorted* lists, with no duplicate in them
Arguments: two sorted lists, each in ascending order
Return: one list... | true |
dd63bb71b24d7fd3fd139603f9e10f003b56cbea | Python | CalvinMakelky/datasciencecoursera | /clientHW6.py | UTF-8 | 299 | 2.9375 | 3 | [] | no_license |
import socket
host = socket.gethostname()
port = 21000
print 'Connecting to ', host, port
while True:
s = socket.socket()
s.connect((host, port))
msg = raw_input('CLIENT >> ')
s.send(msg)
msg = s.recv(1024)
print 'SERVER >> ', msg
s.close()
| true |
fd6324baad96b1780839732d2c46830db490873b | Python | KatrinaHoffert/stroke-radius-segmentation | /run_dilation.py | UTF-8 | 2,561 | 3.125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | permissive | '''
Performs dilation (utilizing the dilate module) on all stroke/point images.
'''
import os, re, sys, enum
from dilate import no_error_dilate
from common import Study, dilation_radii
def dilate(study, strokes_loc, ground_truth_loc, output_loc, radius_range):
'''
Dilates all files.
study: Th... | true |
8f0b06b67d96e03b869356fb235b4190f344de07 | Python | XinpeiWangMRI/MRI-AUTOMAP | /Other files/Automap_chongduan | UTF-8 | 1,250 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 23 09:10:16 2018
@author: chongduan
"""
import numpy as np
import tensorflow as tf
from tensorflow.python.framework import ops
import math
import time
from generate_input import load_images_from_folder
# Load training data:
tic1 = time.time()
# F... | true |
f9732e48f0533ade4ac82d514cf4b18fd6c42035 | Python | earthinversion/PhD-Thesis-codes | /Earthquake-location-problem-Monte-Carlo/monte_carlo_eq_loc.py | UTF-8 | 3,512 | 2.765625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
np.random.seed(0)
plt.style.use('seaborn')
minx, maxx = -2, 2
miny, maxy = -3, 3
numstations = 30
stn_locs=[]
xvals = minx+(maxx-minx)*np.random.rand(numstations)
yvals = miny+(ma... | true |
35b46348f92fbe1759948e0ef15e0d6179dff413 | Python | Aasthaengg/IBMdataset | /Python_codes/p03556/s834395263.py | UTF-8 | 73 | 3.171875 | 3 | [] | no_license | N=int(input())
if int((N+1)**.5)**2==N:print(N)
else:print(int(N**.5)**2) | true |
b0dc60718efa226ca2e42a421fd7cde62083066e | Python | makosenkov/Study | /lab2/src/main.py | UTF-8 | 30,959 | 2.921875 | 3 | [] | no_license | import math
import matplotlib.pyplot as plot
import statistics as stat
import scipy.stats as stats
import numpy as np
from lab2.src import help
# https://matplotlib.org/api/_as_gen/matplotlib.pyplot.plot.html
# =================================== Подготовка данных ===============================
f = open("../input/sh... | true |
bb1e7792704afe5b36323419282af6fb8d906e2e | Python | vonkez/r6s-rank-bot | /stat_providers/rate_limiter.py | UTF-8 | 1,049 | 2.671875 | 3 | [] | no_license | import time
from loguru import logger
from stat_providers.stat_provider import PlayerNotFound
class RateLimiter:
"""
A basic async rate limiter that raises exception if it exceeds the limit.
"""
def __init__(self, limit_per_minute):
self.tokens = limit_per_minute
self.token_rate = li... | true |
b6bafe8ec7b2fd147d6e5809e4ffdab16b1f84e9 | Python | sherirosalia/Python_Challenge_Refactor | /main.py | UTF-8 | 4,335 | 3.34375 | 3 | [] | no_license | #refactored script
# #dependencies
import os
import csv
#import operator for running code on line 63
import operator
#csv file with election data
election_data=os.path.join("election_results.csv")
#variables
total_votes = 0
county_votes = {}
candidates = {}
#open csv
with open(election_data) as election_data:
... | true |
ffe1fe1a46c0f209bf276f347ea3dc36f1762140 | Python | PecPeter/Stock_Tracker | /main.py | UTF-8 | 2,504 | 3.234375 | 3 | [] | no_license | import os
import sys
import sqlite3
import database
import menuCommands
# Main program code
# TODO: change the options to work like terminal commands,
# make it so that you can choose which database to use, and pass the
# cursor for that database to the different functions. add functions to
# init ... | true |
d7b154a988905c9da76950798e4e8ffbefa3dee8 | Python | dmr8230/UNCW-Projects | /CSC231-Python/Chp 8 - Binary Tree/Lab8.py | UTF-8 | 5,232 | 4.0625 | 4 | [] | no_license | # Author: Dani Rowe
# Date: October 20th, 2020
# Description: tests the three different types of traversals by looping
# through the tree
class BinaryTree:
def __init__(self, payload = None, leftChild = None, rightChild = None):
'''
Constructor
:param payload (any value): default None
... | true |
e0af975128b412b0abad597e47344d69370a9b1b | Python | CommanderErika/DataVisualization-with-Covid19-data | /Codes/evoluçao_incidencia_final.py | UTF-8 | 5,912 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 27 17:33:02 2020
@author: erika
"""
# Iportando as bibliotecas #
import pandas as pd
import numpy as np
import matplotlib
import seaborn as sns
import math
import matplotlib.pyplot as plt
# Região que iremos fazer os graficos #
regiao = 'Trairí'... | true |
b5f46271daa92d9dbfea4e21c51a1adeac8743a1 | Python | Miguel-Neves/AA-Assignment1 | /SVM_algorithm.py | UTF-8 | 2,397 | 3.203125 | 3 | [] | no_license | import numpy as np
from sklearn import metrics
from sklearn.svm import SVC
def validation_curve(Xtrain, ytrain, Xval, yval, C_vals, sigma_vals, kernel):
values, error_train, error_val = [], [], []
m_train = Xtrain.shape[0]
m_val = Xval.shape[0]
for i in C_vals:
C = i
for j in sigma_v... | true |
d14a70f5b8b58b164447b9a1d076c95d86b05ae4 | Python | ChrisTensorflow/2021QOSF | /QuantumSimulator.py | UTF-8 | 4,495 | 3.453125 | 3 | [] | no_license | """
=====================
Quantum Circuit Simulator
=====================
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import plot, ion, show
from matplotlib.colors import ListedColormap
import random
from collections import Counter
import itertools
from nu... | true |
1e1b86ca78e93d470577d779a98cecdd77807a3a | Python | kvpratama/medical-image-lib | /nii/Nii3D.py | UTF-8 | 2,230 | 2.59375 | 3 | [] | no_license | from .Nii import Nii
import nibabel as nib
import numpy as np
import matplotlib.pyplot as plt
class Nii3D(Nii):
def __init__(self, path, plane='axial'):
Nii.__init__(self, path)
self.nii_np = np.transpose(np.array(self.nii.dataobj), axes=[2, 1, 0])
self.shape = self.nii_np.shape
s... | true |
33840b619d91aa3fd2adc3311cfcf68b80468fea | Python | Fabfm4/flask-docker | /src/firstapp/core/db/models/models.py | UTF-8 | 834 | 2.546875 | 3 | [] | no_license | from datetime import datetime
from firstapp import db, bcrypt
class TimeStampedMixin(object):
id = db.Column(db.Integer, primary_key=True)
created = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
updated = db.Column(db.DateTime, onupdate=datetime.utcnow)
class CatalogueMixin(TimeStamp... | true |
c0836ca1e0d756772b0260bb47c246ce8585dc2a | Python | Merubokkusu/Discord-S.C.U.M | /examples/TheGiverOfServers.py | UTF-8 | 1,502 | 2.6875 | 3 | [
"MIT"
] | permissive | '''
if someone replies to your message in a dm, this code will use a recent bug to give that person the SERVER badge (credits go to https://github.com/divinityseraph/server-badge-exploit)
here's how it looks: https://www.reddit.com/r/discordapp/comments/jzlnlb/discords_new_reply_feature_is_fun_and_bugged_lol/
this bug ... | true |
adb9b55c2d75afc94f217e4805e34ef5269b68de | Python | QianWanghhu/oconnell-runner | /source_runner/parameter_funcs.py | UTF-8 | 3,557 | 2.875 | 3 | [] | no_license | """Helper functions to load parameters"""
import pandas as pd
__all__ = ['load_parameter_file', 'group_parameters', 'get_initial_param_vals']
def load_parameter_file(fn):
"""Load parameters from file
Parameters
==========
* fn : str, filename and location to load
Returns
... | true |
c6c7a7e341c63e60023502971f17e3f278f19162 | Python | goyal705/Hotel-Management-System | /hotel.py | UTF-8 | 5,933 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | from tkinter import *
from PIL import Image, ImageTk
from customer import Customer_win
from room import Room_win
from details import Details_win
from tkinter import messagebox
class Hotel:
def __init__(self, root):
self.root = root
self.root.title("Hotel management system By Tushar Goyal"... | true |
836a936540a80bc2b4c4e787f17fcec169cca317 | Python | Dongdongshe/md5Cracker | /hashgenerator.py | UTF-8 | 1,205 | 2.84375 | 3 | [] | no_license | import md5
import base64
import string
b64_str='./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
final_str=""
def b64_from_24bit(a, b ,c ,d):
global final_str
w = (ord(a)<<16)|(ord(b)<<8)|ord(c)
for i in range(0, d):
final_str+=b64_str[w & 0x3f]
w = w >> 6
m=md5.new('chfT... | true |
f318b076d5b2b7218bb0d29b2fbf4edab4dbd195 | Python | behrom/wprowadzenie_do_jezyka_pythona | /zadania_laboratorium/zadanie_3_przyblizanie_funkcji/zad_3_poprawka.py | UTF-8 | 9,040 | 3.828125 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from itertools import izip
def linear_intp(nodes):
"""Funkcja, ktora dla zadanej listy punktow zwraca funkcje liczaca interpolacje liniowa.
Parameters:
nodes - lista p... | true |
eda13393ba78b82f0f869e5d5a060d931004b9a7 | Python | tejasarackal/PyConcept | /generators/gen.py | UTF-8 | 1,076 | 3.5 | 4 | [] | no_license | from time import sleep
from decorators import dec
@dec.timer
def add1(x, y):
return x + y
class Adder:
@dec.timer
def __call__(self, x, y):
return x + y
add2 = Adder()
@dec.timer
def heavy_compute():
rv = []
for i in range(101):
sleep(.1)
rv.append(i)
return rv
... | true |
cb216534ea3c84b63dc789dba76dc70932007388 | Python | pablodarius/mod02_pyhton_course | /Python Exercises/3_question10.py | UTF-8 | 669 | 3.96875 | 4 | [] | no_license | import unittest
# Given an input string, count occurrences of all characters within a string
def cout_ocurrences(input_str):
result = dict()
for i in input_str:
count = input_str.count(i)
result[i] = count
return result
class testing(unittest.TestCase):
def setUp(self):
print(... | true |
168d0f234c60b692755eed70e19664fd0ef6d783 | Python | Erik-Han/cs170_sp21_project | /choose_best_output.py | UTF-8 | 997 | 2.5625 | 3 | [] | no_license | import os
from shutil import copyfile
from parse import read_input_file, read_output_file, write_output_file
if __name__ == "__main__":
test_to_files = {}
inputs_to_graphs = {}
sizes = ('small', 'medium', 'large')
input_dir = "./all_inputs/"
output_dir = "./best_outputs/"
for size in sizes:
... | true |
2b7f5ff7e8d4804c163b17a93e66ee02980b448d | Python | diego-codes/next-train | /next-train.py | UTF-8 | 3,045 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
import re
import csv
import datetime
import math
from contextlib import contextmanager
from os import getenv
COLORS = {
'WARNING': '\033[31m',
'OK': '\033[32m',
'END': '\033[0m'
}
# Constants
BASE_DIR = getenv('HOME') + '/bin/metros/ATX/'
NOW = datetime.datetime.now()
WALKING_MINUTE... | true |
b539490bc60f04d0dc42a15cec8c7633e824f6c3 | Python | yenshipotato/TLGMBT | /user_inf.py | UTF-8 | 1,501 | 2.734375 | 3 | [] | no_license | import json
import os
usr_dic={}
def adduser(id):
user={"latest":"","favorite":"","status":0,"lasttime":"14"}
usr_dic[str(id)]=user
def wInFile(id):
with open("user/"+str(id)+".json","w",encoding="utf-8") as f:
json.dump(usr_dic[str(id)],f,ensure_ascii=False)
def saveAll():
for key... | true |
87da43b90a31aa74ea14e7752aa69fbf58390ccf | Python | mccloskeybr/pystringevo | /stringevolution.py | UTF-8 | 1,786 | 3.296875 | 3 | [] | no_license | import string
import random
target = str(raw_input('enter desired string: '))
strings = []
reward = []
currentGeneration = 0
NUM_PER_GENERATION = 10
MUTATION_RATE = 0.05
def is_done():
return strings[0] == target
def sort():
for i in range(len(strings)):
biggest = i
for j in range(i, len(s... | true |
cbf8eff6c0e028e340f0f962860a72463666566e | Python | hg-pyun/algorithm | /leetcode/leftmost-column-with-at-least-a-one.py | UTF-8 | 1,055 | 3.515625 | 4 | [
"MIT"
] | permissive | # """
# This is BinaryMatrix's API interface.
# You should not implement it, or speculate about its implementation
# """
#class BinaryMatrix(object):
# def get(self, x: int, y: int) -> int:
# def dimensions(self) -> list[]:
class Solution:
def binarySearch(self, binaryMatrix, current_col, size):
lo =... | true |
5e63d576cba3897224ccf9e3fb9b639b9616488e | Python | NU-ACCESS/Spectral-Microscope-Tools | /rotation.py | UTF-8 | 518 | 2.625 | 3 | [] | no_license | from ij import IJ, ImagePlus, ImageStack
from ij.process import ImageProcessor, FloatProcessor
from fiji.util.gui import GenericDialogPlus
gd = GenericDialogPlus("Input Parameters")
gd.addNumericField("Number of Angles", 10, 0) # show 3 decimals
gd.showDialog()
ang = 360/int(gd.getNextNumber())
imp = IJ.getI... | true |
119197fa0317fb44052f07e1736bca688caa8c3b | Python | daydaychallenge/leetcode-python | /00893/test_groups_of_special_equivalent_strings.py | UTF-8 | 440 | 2.765625 | 3 | [] | no_license | import unittest
from groups_of_special_equivalent_strings import Solution
class TestSolution(unittest.TestCase):
def test_longestPalindrome_Solution(self):
sol = Solution()
self.assertEqual(3, sol.numSpecialEquivGroups(["abcd", "cdab", "cbad", "xyzz", "zzxy", "zzyx"]))
self.assertEqual(3, ... | true |
d0808da5888571ff365d104db7f27406467565db | Python | dhockaday/deep-embedded-music | /src/models_embedding/gru_net.py | UTF-8 | 1,775 | 2.78125 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
from src.models_embedding.base_model import BaseModel
from src.models_embedding.model_factory import ModelFactory
@ModelFactory.register("GRUNet")
class GRUNet(BaseModel):
""" A simple 1-dimensional GRU model. """
def __init__(self, params, model_name="GRUNet"):
"""
In... | true |
9f48e1dc70686140af803252f5a887b0950cab1b | Python | daianasousa/POO | /LISTA DE EXERCÍCIOS/S_02_Ati_01_Q01_e_02.py | UTF-8 | 2,571 | 3.359375 | 3 | [
"MIT"
] | permissive | class Carro:
#Atributos
nome = None
ano = None
cor = None
veloc_max = None
veloc_atual = 0
estado = 'Desligado'
#Construtores
def __init__(self, cor, nome, veloc_max):
self.cor = cor
self.nome = nome
self.veloc_max = veloc_max
#Métodos
def ligar(self... | true |
ddf19011834c1554eb1fa5800606541a68cba671 | Python | jellehu/Pythonlessen | /lessen/Jaar01/Periode01/Les06/pe6_5.py | UTF-8 | 215 | 3.0625 | 3 | [] | no_license | def kwadraten_som(grondgetallen):
resultaat = 0
for number in grondgetallen:
if number >= 0:
resultaat = resultaat + number ** 2
return resultaat
print(kwadraten_som([4, 5, 3, -81])) | true |
aa9c6671d78cafac45a4b620c54959ae75ba6151 | Python | castlesmadeofcode/pythonFunctions | /chickenMonkey.py | UTF-8 | 563 | 4.78125 | 5 | [] | no_license | # Write a program that prints the numbers from 1 to 100.
# You can use Python's range() to quickly make a list of numbers.
# For multiples of five (5, 10, 15, etc.) print "Chicken" instead of the number.
# For the multiples of seven (7, 14, 21, etc.) print "Monkey".
# For numbers which are multiples of both five and s... | true |
9b56fd98e97a12c48ca49c2475ee38c43e57820f | Python | sagynangare/Python-Programming | /practice program/parent.py | UTF-8 | 205 | 2.75 | 3 | [] | no_license | class Person():
def __init__(self,name,age,address,mobile_no):
self.name = name
self.age = age
self.address = address
self.mobile_no = mobile_no
| true |
a7a51a550b4a07f90e8463d0d1d51e8ed0e4bb2f | Python | novalb12/ai | /Code-OpenCV.py | UTF-8 | 1,638 | 2.625 | 3 | [] | no_license | import cv2
import numpy as np
digits = cv2.imread("digits.png", cv2.IMREAD_GRAYSCALE)
test_digits = cv2.imread("test_digits.png", cv2.IMREAD_GRAYSCALE)
rows = np.vsplit(digits, 50)
cells = []
for row in rows:
row_cells = np.hsplit(row, 50)
for cell in row_cells:
cell = cell.flatten()
... | true |
2e0c5bcfbf9c6b4ca4a94cb9981467508f1f66bc | Python | singhv1shal/Style-Transfer-using-Genetic-Programming | /GeneticStyleTransfer.py | UTF-8 | 4,607 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 18 16:23:30 2019
@author: Vishal Singh
@email: singhvishal0304@gmail.com
"""
import random
import numpy as np
import itertools
import functools
import operator
'''
function for finding gram matrix of a given matrix
'''
def gramMatrix(p):
px=p.transp... | true |
789a510fd3e2bf001542436e4326f46acb117db1 | Python | ChristianEdge/Python | /CIS110/Week 9/Edge_Ch9Ex07.py | UTF-8 | 1,562 | 3.828125 | 4 | [] | no_license | '''
Program Name: Ch9Ex07
Program Description:
Author: Christian Edge
Date created: 29 July 2019
Last modified:
Notes of interest: Uses time module
'''
import time
from random import randrange
def main():
intro()
n = int(input("How many games to simulate? : "))
#Processing
wins =... | true |
22c04d2cc7b6877210f8f2462096a942104f7c22 | Python | harvard-dce/le-dash | /tests/test_banner.py | UTF-8 | 1,211 | 2.625 | 3 | [] | no_license | from le_dash.banner import get_student_list
def test_get_student_info(mocker, student_list_maker):
fake_students = student_list_maker(
('12345', 'foo', 'b', 'baz'),
('12345', 'jane', 'q', 'public'),
('12345', 'fozzy', '', 'bear', 'Withdraw')
)
resp_data = {
"students": {
... | true |
2fdf5a75c8f1d1d70356ba95554ac6a9686da156 | Python | Rybasher/parsepexels | /parse.py | UTF-8 | 1,663 | 2.96875 | 3 | [] | no_license | import os, urllib, webbrowser
import requests
from bs4 import BeautifulSoup
import pathlib
import csv
from datetime import datetime
from multiprocessing import Pool
#
# urls = [
# 'https://images.pexels.com/photos/772662/pexels-photo-772662.jpeg',
# 'https://images.pexels.com/photos/1994904/pexels-photo-1994904... | true |
237ec23e9b211ffaa5ca2d5a94efd5830cecb12a | Python | so02e/TIL | /Python/Day3/forLab1.py | UTF-8 | 134 | 3.3125 | 3 | [] | no_license | # 1부터 10까지 추출되는 코드
for a in range (1,11,1):
print(a, end = " ") # '\n\n' 개행 처리 2번을 의미한다. | true |
fa3715b14ab4f4f6ccb2357d65d008d6f6de476e | Python | kaasbroodju/PROG-V1K-PepeHands | /functions.py | UTF-8 | 7,143 | 3.40625 | 3 | [] | no_license | import random
import api
import marvel
import arcade
import json
def write_to_json(name, score):
'''Writes name and score to leaderboard'''
with open('leaderboard.json') as file:
data = json.load(file)
data['data']['players'].append({'name': name, 'score': score})
file = open('leaderboard.jso... | true |
63ffa3f0cd0f79659494190b1917880f34c7f8ea | Python | BrijeshDutta/stock-prices-dash | /StockPrices.py | UTF-8 | 290 | 3.28125 | 3 | [] | no_license | import yfinance as yf
#define the ticker symbol
tickerSymbol = 'TSLA'
#get data on this ticker
tickerData = yf.Ticker(tickerSymbol)
#get the historical prices for this ticker
tickerDf = tickerData.history(period='1d', start='2010-1-1', end='2020-1-25')
#see your data
print(tickerDf)
| true |
60e3f3ba17613cc6d024235bffdd1a1a340ee38e | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2684/60694/261951.py | UTF-8 | 660 | 3.6875 | 4 | [] | no_license | # www.geeksforgeeks.org/minimum-time-to-finish-tasks-without-skipping-two-consecutive
def minTime(arr, n):
if n <= 0: return 0
incl = arr[0] # First task is included
excl = 0 # First task is exluded
# Process remaining n-1 tasks
for i in range(1, n):
incl_new = arr[i] + min(excl, incl)
... | true |
d9dc6df04a0fdd33a5a08952ba2bdd969be4e602 | Python | KumarLamic/image-transform | /translate.py | UTF-8 | 1,313 | 2.890625 | 3 | [] | no_license | from PIL import Image
import os
import random
ori_image='three.png'
scale_img_path=''
img = Image.open(ori_image)
#Apply translation by changing c and f values
a = 1
b = 0
c = 0 #left/right (i.e. 5/-5)
d = 0
e = 1
f = 0 #up/down (i.e. 5/-5)
img = img.transform(img.size, Image.AFFINE, (a, b, c, d, e, f))
# img.save()
... | true |
15847e832cfcad37081105a96a7b43e0b6c99644 | Python | janosg/dag_gettsim | /dag_gettsim/main.py | UTF-8 | 7,030 | 2.9375 | 3 | [
"BSD-3-Clause"
] | permissive | import inspect
from functools import partial
from inspect import getfullargspec, getmembers
import networkx as nx
import pandas as pd
from dag_gettsim import aggregation, benefits, taxes
def tax_transfer(
baseline_date, data, functions=None, params=None, targets="all", return_dag=False
):
"""Simulate a tax ... | true |
333b6e66fe4044d85ce78084d2728576ee5e1311 | Python | Akatsuki06/Terminal-Pix | /colorinfo.py | UTF-8 | 344 | 2.9375 | 3 | [
"MIT"
] | permissive | # https://jonasjacek.github.io/colors/data.json
import json
def fetchdata():
with open('data.json') as data_file:
data=json.load(data_file)
return data
def getColorList():
data=fetchdata()
colorList=[];
for i in data:
# n=['colorId']
r=i['rgb']['r']
g=i['rgb']['g']
b=i['rgb']['b']
colorList.append([r... | true |
44a2d9679d5b364250efe5183a2852cb3844eefe | Python | Caps3c/batch2shellcode | /bat2shell.py | UTF-8 | 1,294 | 3.171875 | 3 | [] | no_license | import os ,sys
### a script that reads a batch file then outputs a shellcode of the batch file
## a function to output the shell code to txt file with the name shellcode.txt
def write_shellcode():
try:
if sys.argv[2]=="txt":
output = open("shellcode.txt","w")
output.write(shellcode)... | true |
71114eb1bc1461f3b7aa517811bdbae3b9bf1351 | Python | vietnvri/trigger-word | /preprocess/td_utils.py | UTF-8 | 3,401 | 2.90625 | 3 | [] | no_license | import matplotlib.pyplot as plt
from scipy.io import wavfile
import os
from pydub import AudioSegment
import matplotlib.mlab as m
import librosa
import numpy as np
class MaxSizeList(object):
ls = []
def __init__(self, mx):
self.val = mx
def push(self, st):
self.ls.append(st)
def get... | true |
f249b2743f593ed2d68b1d492b8af569a9b21f3a | Python | korbelz/SC_Org_members | /scroll.py | UTF-8 | 1,138 | 3.140625 | 3 | [
"MIT"
] | permissive | #scroll to bottom of the page
from selenium import webdriver
import time
#Below are some example sites to test on.
#https://robertsspaceindustries.com/orgs/SECPRO/members
#https://robertsspaceindustries.com/orgs/AGBCORP/members
def scroll(target_url):
driver = webdriver.Chrome()
driver.get(f'{target_url}')
... | true |
c7b9102c8637c5632b958827965ae209ba92bb0f | Python | danijar/dotfiles | /symlink.py | UTF-8 | 1,542 | 3.171875 | 3 | [] | no_license | import pathlib
def is_child(child, parent):
try:
child.relative_to(parent)
return True
except ValueError:
return False
def remove_broken_links(repo, user):
# Only search in one level into directories that are mirrored in the
# repository and only report broken links that point to the repository.... | true |
a021dc7e315a9e96dc8e85e84462d6aa10056044 | Python | laolee010126/algorithm-with-python | /problems_solving/baekjoon/no_5430_AC.py | UTF-8 | 1,194 | 3.40625 | 3 | [] | no_license | """Do AC language calculations over integer array
url: https://www.acmicpc.net/problem/5430
"""
from collections import deque
ERROR_MESSAGE = 'error'
REVERSE, DISCARD = 'RD'
def do_ac_calculations(arr, cmds):
deck = deque(arr)
# Preprocess commands
tmp_r = 0
new_cmds = ''
for c in cmds:
... | true |
92b06f49babcec7474117d3a30173eb37994c3ca | Python | RaphP/ToutMonPython | /PythonLaptop/omeletes.py | UTF-8 | 548 | 2.921875 | 3 | [] | no_license |
import numpy
import random
import matplotlib.pyplot as plt
import math
dt = 1
Tmax = 1000
#t va de 0 a Tmax par pas de dt
s = [0]
for i in range(Tmax):
s += [s[-1] + (1 -2*random.randint(0,1)) ]
def phi(t):
return 2*t*math.exp(-t**2)
def T(b,a) :
Dt = 3*a
T = 0
for t in range(b-Dt, b+Dt):
T+= s[t]*ph... | true |
2ce3ef0a7af55b2b0161eb18de450a46023b4124 | Python | XYHC-MMDA/Multi-modal-Multi-task-DA | /mmdet3d/models/discriminators/disc.py | UTF-8 | 8,184 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import torch.nn as nn
import torch
import torch.nn.functional as F
from ..registry import DISCRIMINATORS
@DISCRIMINATORS.register_module()
class FCDiscriminatorCE(nn.Module):
def __init__(self, in_dim=128):
super(FCDiscriminatorCE, self).__init__()
self.fc = nn.Sequential(
nn.Linear(in... | true |
1292c75a3e0f02792748e47f89c3b9e04652e0b1 | Python | SpadavecchiaAdrian/surveillance | /opticalFlow_v1.py | UTF-8 | 3,538 | 2.5625 | 3 | [] | no_license | # import the necessary packages
from pyimagesearch.tempimage import TempImage
from picamera.array import PiYUVArray
from picamera import PiCamera
import argparse
import warnings
import datetime
import dropbox
import imutils
import json
import time
import numpy as np
import cv2
# construct the argument parser and parse... | true |
f6f88ef08b3c060609b64c0ddee0f191c8978832 | Python | Avery123123/LeetCode | /dataStructure/array_and_string/寻找数组的中心索引.py | UTF-8 | 372 | 3.109375 | 3 | [] | no_license | class Solution(object):
def pivotIndex(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
left_sum = 0
right_sum = sum(nums)
for index,item in enumerate(nums):
right_sum -= item
if left_sum == right_sum:
return ind... | true |
0504099a50fda05cf91693efbcfb1abd814ba999 | Python | 51running/cmdb | /asset/validators.py | UTF-8 | 2,087 | 2.6875 | 3 | [] | no_license | #encoding:utf-8
from .models import Host
from datetime import datetime
class Validator(object):
@classmethod
def is_interger(cls,value):
try:
int(value)
return True
except BaseException as e:
return False
class Host_Valid(Validator): #这里都是vi... | true |
557249e5b478fc5b09941d0a4467e628c1f3160c | Python | vnherdeiro/project-euler | /p267.py | UTF-8 | 541 | 2.90625 | 3 | [] | no_license | #! /usr/bin/python3
from mpmath import mp
pow = mp.power
binom = mp.binomial
from scipy.optimize import minimize
thresh = 10**9
def g(f):
mp.dps = 400
if f <= 0 or f >= 1: #forcing minimization in (0,1)
return 0
f = mp.mpf( f[-1])
#print( f)
s = mp.mpf()
for k in range(1001):
gain = pow(1+2*f, k) * pow(1-f,... | true |
4d64df957898d2758d81c7c6b84355ca7ac564cc | Python | yajvldrm/notepad_to_spreadsheet | /getting_sheet_from_workbook.py | UTF-8 | 205 | 3.03125 | 3 | [] | no_license | import openpyxl
wb = openpyxl.load_workbook('grading.xlsx')
print(wb.get_sheet_names())
sheet = wb['Sheet1']
print(sheet)
print(type(sheet))
print(sheet.title)
anothersheet = wb.active
print(anothersheet) | true |
17b42b80c67fbd5df0aed930f1dc5924657a1463 | Python | akirapop/pytako | /SSOtable_py3.py | UTF-8 | 5,604 | 3.109375 | 3 | [] | no_license | ####+
#
# 03 June 2013
#
# This class is intended to serve as an "internal" class
# to be used by the solarSystem.py module. In other words, it
# is expected that users will *not* make direct use of this
# class!
#
#
# Object instances of this class serve one fundamental
# purpose: To encapsulate the series of... | true |
e6ea9a51cd0686ae417f560aa5d10fff751631ca | Python | ketakic/Home-Security-Smart-Door-System | /doorlock.py | UTF-8 | 805 | 2.671875 | 3 | [] | no_license | import RPi.GPIO as GPIO
import BlynkLib
import time
from time import sleep
BLYNK_AUTH = 'd2132438bc5244949d13241150f57958'
blynk = BlynkLib.Blynk(BLYNK_AUTH)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(03, GPIO.OUT)
pwm=GPIO.PWM(03, 50)
@blynk.VIRTUAL_WRITE(1)
def my_write_handler(value):
print('Current V! value: {}'.fo... | true |
00e364eaf769d388bca75f32047d4cd3b5d741c0 | Python | amanchourasiya/leetcode | /dp/best-time-to-buy-and-sell-stock.py | UTF-8 | 419 | 3.484375 | 3 | [] | no_license | # https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
class Solution:
def maxProfit(self, prices) :
# Kadane algorithm
maxpro = 0
minprice = 10 ** 5
for i in range(len(prices)):
minprice = min(minprice, prices[i])
maxpro = max(maxpro, prices[i] - m... | true |
c9eeeb4a58396e4389a003f4ea3c8536b63bd63c | Python | blainerothrock/seisml | /seisml/core/transforms/sample/resample.py | UTF-8 | 1,355 | 2.75 | 3 | [] | no_license | from seisml.core.transforms import TransformException, BaseTraceTransform
class Resample(BaseTraceTransform):
"""
reasmple using Fourier method, passthrough of obspy.core.trace.Trace.reample
Args:
sampling_rate: (float): new sample rate in Hz.
source (string): the data source to filter, de... | true |
2aa527f184f61badd36a8c54266d8767c7856e4d | Python | levylll/leetcode | /test30.py | UTF-8 | 2,794 | 3.25 | 3 | [] | no_license | class Solution:
def findSubstring(self, s, words):
"""
:type s: str
:type words: List[str]
:rtype: List[int]
"""
if not s or not words:
return []
word_dict = {}
res = []
word_len = len(words[0])
all_words = len(words)
... | true |
c7be6109884b11a8f0246d1bb6c2ee48b0aaf642 | Python | matthewmolinar/syllabus-scanner | /backend copy/util.py | UTF-8 | 1,805 | 2.78125 | 3 | [] | no_license | from PyPDF4 import PdfFileReader
from icalendar import Calendar, Event
from datetime import datetime
from io import StringIO
import os.path
import docx
import pytz
# to_text functions
def pdf_to_txt(file):
text = ''
pdfReader = PdfFileReader(file)
for i in range(pdfReader.numPages):
page = pdfReade... | true |
a8928d439fe1f728e6eb2c3330398748c3bff10f | Python | rekeshali/kNN-DecisonTree | /implement.py | UTF-8 | 10,145 | 3.015625 | 3 | [] | no_license | import numpy as np
#######################################################################################
############################## K Nearest Neighbors ####################################
#######################################################################################
def kNN(k, Lnorm, Xtrain, Xtest, Ctra... | true |
b59b566172eaa118b5239d5a59ec9d6b328beb48 | Python | DOREMUS-ANR/recommender | /recsystem/index.py | UTF-8 | 2,598 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import argparse
import json
import logging
from types import SimpleNamespace
from embedder import create_edgelists, embed, post_embed, combine_embeddings, visualizer, most_similar
logger = logging.getLogger(__name__)
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argum... | true |
d044dafc29c428dabc7f6f501d1eb1d5966e494a | Python | mirhossain8248/Python-Practice- | /regularExpression_charClass_findAll.py | UTF-8 | 1,036 | 3.796875 | 4 | [] | no_license | #Charecter Classes, Findall
import re
message = "My phone numbers are: 775-737-8248, 775-824-9921"
phoneRegex = re.compile(r'((\d\d\d)-(\d\d\d-\d\d\d\d))')
phoneObjectFindAll= phoneRegex.findall(message)
print(phoneObjectFindAll)
#Charecter classes are short cuts built in, we can just look them up
lyrics =... | true |
df0b0e448d69feed074e95b7cae930a99cdb49d1 | Python | MrHarcombe/PiTwiddles | /mcpi/George/AirShip.py | UTF-8 | 1,025 | 2.578125 | 3 | [] | no_license | import minecraft.minecraft as minecraft
import minecraft.block as block
import time
import datetime
import math
mc = minecraft.Minecraft.create()
x = 64
y = 32
z = 64
xmv = 1
zmv = 0
try:
while True :
MOVE = 0
pos = mc.player.getPos()
if (pos.x > x - 6) and (pos.z < z + 6) and (pos.z > z - 6) and (pos.z < z + 6... | true |
adb9b7dcadda89c40a69e332d4e571957b41274a | Python | sharmar0790/python-samples | /numpy_package/npVector.py | UTF-8 | 179 | 3.140625 | 3 | [] | no_license | import numpy as np
import random as rn
arr = [0 for i in range(30)]
for i in range(30):
arr[i] = rn.randint(1,1000)
print(arr)
data = np.mean(arr)
print("Mean === ",data) | true |
7326873f8e500fa958de5f701414cfa53f271b8e | Python | moylaugh/trading-toolbox | /myquant/my_util.py | UTF-8 | 10,468 | 2.828125 | 3 | [] | no_license | import datetime
import gmsdk
import logging
def average_true_range(dailybars, n):
if len(dailybars) != n + 1:
raise Exception('len(dailybars) = {0}'.format(len(dailybars)))
sum_tr = 0
for i in range(0, n):
bar = dailybars[i]
pre_bar = dailybars[i+1]
high = bar.high
l... | true |
f8cd5fd444f7698eb5d105c40a89fbe027f74335 | Python | nedima68/PseudoSupervisedAnomalyDetection | /utils/parse_json_files_to_latex_table.py | UTF-8 | 3,398 | 3.140625 | 3 | [] | no_license | import glob
import os
import json
class JSONtoLaTeXtableParser:
def __init__(self, output_file, header_titles):
"""
Constructor. Set path where the JSON files are stored,
e. g. "/some/path/to/results/*/*.json"
Also filename for output file is needed
"""
self.header... | true |
c6b820fe14dbbe123026ed5956bede31a1a2d373 | Python | baker-project/baker | /baker_wet_cleaning_application/scripts/test_detection_and_removing_dirt.py | UTF-8 | 2,522 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
from threading import Thread
import services_params as srv
from std_srvs.srv import Trigger
from cob_object_detection_msgs.msg import DetectionArray
import rospy
from utils import projectToCamera
from dirt_removing_behavior import DirtRemovingBehavior
"""
This file contains routine to start the ... | true |
116a822dd47fae8f93b31a4e5cb7c0f4378a6374 | Python | fidoriel/sudoku42 | /legacy/sudoku.py | UTF-8 | 1,852 | 3.25 | 3 | [] | no_license | #!/usr/bin/python3
sudoku = [[0,0,8,0,0,4,9,3,5],
[0,0,0,0,0,5,2,6,0],
[0,0,0,0,2,3,0,0,8],
[0,0,0,0,0,0,1,0,7],
[6,1,0,0,7,0,0,9,0],
[0,0,0,4,5,0,0,0,0],
[5,2,0,0,0,0,0,0,3],
[0,0,3,0,1,0,0,0,0],
[0,0,0,0,0,0,6,0,1]]
def numberPossible(y... | true |
84500c48cbbe32d115eaff2f96a30da9b6e4e7e9 | Python | zzz136454872/leetcode | /hitBricks.py | UTF-8 | 2,174 | 2.890625 | 3 | [] | no_license | from typing import *
import copy
class Solution:
def hitBricks(self, grid: List[List[int]], hits: List[List[int]]) -> List[int]:
n1=len(grid)
n2=len(grid[0])
log=[False for i in range(len(hits))]
for i in range(len(hits)):
if not grid[hits[i][0]][hits[i][1]]:
... | true |
0ea808eb5207dfc9c8f140024919dbec0626a66a | Python | nssalim/we2hwk13112020_codeclan_caraoke | /tests/bar_test.py | UTF-8 | 1,313 | 3.359375 | 3 | [] | no_license | import unittest
from classes.room import Room
from classes.guest import Guest
from classes.song import Song
from classes.drink import Drink
from classes.food import Food
class TestBar(unittest.TestCase):
def setUp(self):
self.song1 = Song("The Rolling Stones", "She's a rainbow")
self.song2 = Song... | true |