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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
58b0cdc4a7ce0d0f71a23c9476aa56f27343f937 | Python | GenericMappingTools/pygmt | /examples/gallery/lines/vector_styles.py | UTF-8 | 2,418 | 3.65625 | 4 | [
"BSD-3-Clause"
] | permissive | """
Cartesian, circular, and geographic vectors
-------------------------------------------
The :meth:`pygmt.Figure.plot` method can plot Cartesian, circular, and
geographic vectors. The ``style`` parameter controls vector attributes.
See also
:doc:`Vector attributes example </gallery/lines/vector_heads_tails>`.
"""
... | true |
e818a64e832f95e8d4d5f46b7eb45943c4e9ae08 | Python | BTanjerine/FRC2019DeepSpaceCode | /Subsystems/intake.py | UTF-8 | 1,699 | 2.625 | 3 | [] | no_license | from wpilib.command import Subsystem
from wpilib import SmartDashboard
from wpilib import Encoder
class Intake(Subsystem):
def __init__(self, robot):
super().__init__("Intake")
self.robot = robot
# robot map short cut
self.map = robot.RobotMap
# intake motors and psitons
... | true |
d136c4e6cd329662bceaec05f7e9dae4183b26ae | Python | csu-anzai/clock-backend | /api/tasks.py | UTF-8 | 747 | 2.578125 | 3 | [] | no_license | from __future__ import absolute_import
import random
import time
from django.contrib.auth.models import User
from api.celery import app
# Example Tasks
# Task which creates 5 User DB-Entries
@app.task(bind=True, default_retry_delay=10)
def async_5_user_creation(self):
for _ in range(5):
print("This Tas... | true |
c350a53bc4a07c62c1893c7b69a4a1d6cac20a24 | Python | brianjrush/aeriallidar-noros | /pointclouds/pointcloud.py | UTF-8 | 947 | 3 | 3 | [] | no_license | #!/usr/bin/env python3
import tools.ply_formatter
from pointclouds.point import Point
class PointCloud():
def __init__(self, points=[], ply=None):
self.points = points
self.stamp = -1
if ply is not None:
self.from_ply(ply)
def from_ply(self, infile):
self.points = tools.ply_formatter.read... | true |
dc99ddfb0ac8aebc32b3654afce1d096d20f11e0 | Python | Soveu/random | /py/picktest.py | UTF-8 | 219 | 3.28125 | 3 | [] | no_license | #!/usr/bin/python
import pickle
class Program(object):
def __init__(self, x):
self.data = x
return
def run(self):
return print(self.data)
x = Program("Hello")
print(pickle.dumps(x))
| true |
b3bc6c30d7c3efa741221c0db3f7b9f3cdd1063e | Python | Skywice/kaggle | /101/digit_recognizer/digit_recognizer.py | UTF-8 | 956 | 3.0625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import csv
import os
import numpy as np
from numpy import *
# 数据的基本路径
base_dir = 'C:\\Users\\dell\\Desktop\\apps\\kaggle_data\\digit_recognizer'
test_set_dir = os.path.join(base_dir, 'test.csv')
# 载入训练数据
def loadTrainData():
train_labels = []
train_array = []
train_set_dir = os.path.... | true |
28b663fadff501ddc229b5521a77e78bbf80e15c | Python | matifernando/itmgt25.03 | /202083_FERNANDO_JOSE_HANDLINGFILES.py | UTF-8 | 2,255 | 3.203125 | 3 | [] | no_license | products = {
"americano":{"name":"Americano","price":150.00},
"brewedcoffee":{"name":"Brewed Coffee","price":110.00},
"cappuccino":{"name":"Cappuccino","price":170.00},
"dalgona":{"name":"Dalgona","price":170.00},
"espresso":{"name":"Espresso","price":140.00},
"frappuccino":{"name":"Frappuccino"... | true |
373c20398f7f18c425d033f97cdd05e07c7e6ab8 | Python | raherpradipto/Rahmat-Herpradipto_I0320083_Muhammad-Abyan-Naufal_Tugas-6 | /I0320083_soal1_tugas6.py | UTF-8 | 150 | 3.328125 | 3 | [] | no_license | # pengulangan "Hello World" 10 kali dengan perintah while
pk = 1
while pk <= 10:
print("pengulangan ke-",pk,": Hello World")
pk = pk + 1
| true |
269f3afe962e735f08b20b71f76a5e18b0f13da9 | Python | jpromanonet/Self_Learning | /Python/02_Exercises/py_exec_08.py | UTF-8 | 577 | 4 | 4 | [] | no_license | print('Another silly program')
print('Magic Word?') # Asking for the magic word
magic_word = input()
if magic_word == 'Stan': # Comparing the magic word
print('Access Granted')
else:
wrong_Magic_Word_Counter = 1 # This variable starts the loop for wrong answers
# Starting the loop
while w... | true |
c0b5f2820a789658cfea8b2a1097af7d4ee6adf2 | Python | JohnWoodman/SecureMe | /cronCheck.py | UTF-8 | 705 | 2.59375 | 3 | [] | no_license | #!/usr/env python
import subprocess as sub
import sys
import re
from execCommand import execute
#CRONJOB CHECKING
def cronCheck():
print "\n<=====Checking Suspicious Cronjobs/Crontabs=====>\n"
users = execute("cut -f1 -d: /etc/passwd")
for user in users:
cronjob = execute("crontab -u " + user + " -l")
if cron... | true |
2e388f2a15d7fde133948b89da06e6fddf30c51e | Python | wangyum/Anaconda | /lib/python2.7/site-packages/conda_manager/utils/misc.py | UTF-8 | 495 | 3.015625 | 3 | [
"Python-2.0",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown"
] | permissive | # -*- coding: utf-8 -*-
def human_bytes(n):
"""
Return the number of bytes n in more human readable form.
"""
if n < 1024:
return '%d B' % n
k = n/1024
if k < 1024:
return '%d KB' % round(k)
m = k/1024
if m < 1024:
return '%.1f MB' % m
g = m/1024
return '... | true |
41bd531ba186aed4acc9af6d2c248e255e4f5fbc | Python | ShiuLab/CRE-Pipeline | /create_mapping_index.py | UTF-8 | 1,110 | 3.078125 | 3 | [] | no_license | # This script will extract the motif name from each file and then output it a
# 2col file with the file name in the first file and the motif name in the
# second line. The motif name will be modified so that . are replaced with N.
import sys, os
map_dir = sys.argv[1] # the name of the directory with the mapping... | true |
1ae986e42a5f26679d86ef0c86c467b7ff79371f | Python | MrHamdulay/csc3-capstone | /examples/data/Assignment_6/knnsad001/question1.py | UTF-8 | 602 | 4.125 | 4 | [] | no_license | #Program where the user can enter a list of strings followed by the sentinel
#knnsad001
#question1
#introducing empty list
names = []
#this will get the list of names
name = input('Enter strings (end with DONE):\n') #introducing name variable
while name != 'DONE': #this will use 'DONE' as a sen... | true |
c7b9ffd6a79db7ea8c1b4379b4e87ac6fa757d0f | Python | DavidPetkovsek/DeepPassage | /tools/video.py | UTF-8 | 2,651 | 2.859375 | 3 | [] | no_license | from pytube import YouTube
from tqdm import tqdm
import argparse
import os
parser = argparse.ArgumentParser(description='Download videos from youtube from urls in plain text file. (One url per line # for comments).')
parser.add_argument("-u", "--urls", type=str, default="videos.txt", help="The path to the plain text f... | true |
b5b90a039233a6fb0c326c28613e425d31a34546 | Python | rbhansali7/Fall2017 | /CompBio/Assignment 3/smallParsimony.py | UTF-8 | 4,769 | 3.09375 | 3 | [] | no_license | adjList = {}
indegree = {}
possibleVals = {}
selectedVals = {}
def assign(selected, possible):
tempList = list()
for i in range(len(selected)):
if selected[i] in possible[i]:
tempList.append(selected[i])
else:
s = list(possible[i])
tempList.append(s[0])
... | true |
dd7cc1cc85b17d4a58b42b8aa7a329ea591ccfa4 | Python | AadilOmar/Calc_III_Project- | /LU.py | UTF-8 | 4,404 | 2.875 | 3 | [] | no_license | from matrix_multiply import *
import numpy as np
from LU import *
from solveHilbert import *
import fileinput
import sys
def computeError(matrix):
#add all elements in column. Absolute value it. Find the greatest value
error = 0
total = 0
for i in range(len(matrix)):
for j in range(len(matrix[0])):
if (matrix... | true |
a69f3540f8f22c3838fc3c05675a56210f3ee01f | Python | barber5/feedEater | /scripts/findFeed.py | UTF-8 | 1,017 | 2.578125 | 3 | [] | no_license | import sys, mechanize, re, feedparser
from bs4 import BeautifulSoup
from util import getHtmlFromUrl, postData
from config import domain
domain = 'localhost'
feed_endpoint = 'http://{}:3000/feed'.format(domain)
def findFeedFromHtml(html):
soup = BeautifulSoup(html)
links = soup.find_all("link", type=re.compile("rss... | true |
ab3344362ce68c6b76e84c98cb644716028e64d0 | Python | YangLIN1997/Handwritten-Neural-Network-np- | /NN_V1.py | UTF-8 | 35,042 | 3.40625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import math
# Handwritten neural network with numpy, math and matplotlib libraries only
# Functionalities:
# weight initialization: "random", "he", "xavier" or "heuristic"
# activation function: "sigmoid", "relu" or "leaky_relu"
# grad... | true |
3d3169f17a2fe9a745285597b5a57170a7cdbb22 | Python | alexandraback/datacollection | /solutions_5744014401732608_0/Python/Pagefault/r1cb.py | UTF-8 | 1,680 | 2.734375 | 3 | [] | no_license | INPUT_FILE = r'D:\Downloads\FromChrome\B-small-attempt1.in'
#INPUT_FILE = r'D:\Downloads\FromChrome\sample.in'
OUTPUT_FILE = INPUT_FILE.replace('.in', '.out')
inputFile = file(INPUT_FILE, 'rb')
numQuestions = int(inputFile.readline())
outputFile = file(OUTPUT_FILE, 'wb')
def iteration(B, M, y, slids):
if... | true |
7c7002622efdf79f6c7065829bd7ef6e7bccc742 | Python | Computational-Thinking-Software-Group/VMTranslator-Python | /translator/assembly.py | UTF-8 | 2,392 | 2.984375 | 3 | [] | no_license | class AssemblyInstruction:
def __init__(self):
pass
@staticmethod
def parse(assembly_str):
tmp = assembly_str.split("//")
if len(tmp) == 0:
return None
assembly_str = tmp[0]
if assembly_str[0] == "@":
return AssemblyA(assembly_str[1:])
... | true |
b3a2801f553abdfa6b7658c43d89e6dc6f4d2b86 | Python | ellarauth/Multi-Agent-Surveillance | /gui/console.py | UTF-8 | 2,996 | 2.828125 | 3 | [] | no_license | from typing import Dict, Callable
import arcade
from . import renderer
class Console(renderer.WindowComponent):
def setup(self):
# console
self.open = False
self.text = ""
self.out = ""
# command list
self.commands: Dict[str, Callable] = {}
self.register... | true |
66b905c2e34e8f6cde47145f4463cf545d7a6b48 | Python | shubham-k7/ML | /Assignment2/svm.py | UTF-8 | 1,671 | 2.640625 | 3 | [] | no_license | import os
import os.path
import argparse
import h5py
import numpy as np
import csv
from sklearn import svm
import operator
parser = argparse.ArgumentParser()
parser.add_argument("--data", type = str )
args = parser.parse_args()
def load_h5py(filename):
with h5py.File(filename, 'r') as hf:
X = hf['x'][:]
Y = hf[... | true |
2b8346969e8dce691a1499f64511fe7aba2898a1 | Python | FFahrenheit/InterpolationMethods | /Euler modificado.py | UTF-8 | 1,100 | 3.90625 | 4 | [] | no_license | #Modificar getFunction segun la operacion y los print para mayor entendimiento xd
epsilon = 4
def main():
x0 = 0
y0 = 0.5 #Corresponde a y(x0) = y0
xf = 2 #Valor de x que buscamos para y'(x)
n = 4 #Intervalos
h = round((xf-x0)/n,epsilon)
print(f"h = ({xf}-{x0})/{n... | true |
532755d9f6babb3c0c3404e173b90ac95d983a26 | Python | VishalVinayRam/password-manager | /main.py | UTF-8 | 133 | 2.984375 | 3 | [] | no_license |
try :
word = open('hell.txt',"r")
hello=word.read()
print(hello)
word.close()
except:
print("File not found")
| true |
1e325d87af35712871ed428a8bfdfc9f7715c047 | Python | xingx2/AA-Drawer | /enforcement.py | UTF-8 | 754 | 2.921875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
# x = np.linspace(0, 50, 10)
x = (1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50)
y = (0.16, 0.17, 0.19, 0.22, 0.23, 0.24, 0.29, 0.31, 0.3, 0.34, 0.35)
if __name__ == '__main__':
plt.figure()
plt.ylabel('time (ms)', fontsize=16)
plt.xlabel('# of policies', font... | true |
6919a05dcec907cac4b4265f4a21fe60f82ffdb9 | Python | abhi472/Pluralsight | /PyFundamentals/minmax.py | UTF-8 | 244 | 3.640625 | 4 | [] | no_license | def enter_elements(n):
lists = []
for i in range(n):
lists.append(i)
return tuple(lists)
def minmax():
return min(tuple), max(tuple)
a = input("enter number of elements")
tuple = enter_elements(int(a))
print(minmax()) | true |
6dbe48b0ded250fda253953bc2e564f05fd48dad | Python | enterpriseih/distributed-realtime-capfaiss | /core/utils/io_utils.py | UTF-8 | 733 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
@time : 2019/5/24 下午10:22
@author : liuning11@jd.com
@file : utils.py
@description : utils
##########################################################
#
#
#
#
##########################################################
"""
import os
... | true |
b615d2c4e379279fbdd53ffad7284d26b7f9d7c5 | Python | AnaMariaBiliciuc/Rezolvare-problemelor-IF-WHILE-FOR | /4.py | UTF-8 | 334 | 3.578125 | 4 | [] | no_license | from fractions import Fraction
n=int(input("Introduceti numaratorul primei fractii: "))
m=int(input("Introduceti numitorul primei fractii: "))
l=int(input("Introduceti numaratorulfractiei a2: "))
p=int(input("Introduceti numitorul fractiei a2: "))
print(Fraction(n ,m) + Fraction(l, p))
print(Fraction(n,m) * Fr... | true |
7b680563575613552d5431c114a7dc466d88ad9a | Python | aswindle/ICS-Projects-Python | /ICS Demo files/pop_quiz_8_24.py | UTF-8 | 397 | 3.578125 | 4 | [] | no_license | x = 8
if x < 10:
print("Q1: How many times will this print?")
y = "the"
while y != "dog":
print("Q2: How many times will this print?")
z = 5
while z < 4:
print("Q3: How many times will this print?")
a = "blah"
while a != "Batman":
print("Q4: How many times will this print?")
a = "Batman"
b = 0
w... | true |
472520daf7b0872e1a1f237f8f5469c35db2e8ce | Python | RomjanHossain/login_Py | /log.py | UTF-8 | 2,044 | 3.09375 | 3 | [] | no_license | from tkinter import *
from tkinter.font import Font
from turtle import *
class Log_in:
def __init__(self):
display = Tk()
# canvas = Canvas(display, width=500, height=500)
# canvas.grid(column=4, row=11)
F_ont = Font(family='Times New Roman', size=17,
weight='... | true |
ab7b8014d4e2015461728da85fe495d2cd6b5729 | Python | harshraj22/problem_solving | /solution/topcoder/CuttingBitString.py | UTF-8 | 741 | 3.421875 | 3 | [] | no_license | from collections import defaultdict
def ispower(s):
# returns if s is a power of 5
n = int(s,2)
if n == 0:
return True
while n%5==0:
n/=5
return True if n==1 else False
record = defaultdict(lambda :-1)
def get(s):
# print(f'for {s} ispower : {ispower(s)}')
if s[0]=='0':
record[s] = 100
return 100
e... | true |
d91771fb6ecfd0aefeaacd3f9e9c84e09c7ee908 | Python | Xeowhyx/proto | /Game_Enemy.py | UTF-8 | 780 | 3.328125 | 3 | [] | no_license | import pygame
from pygame.locals import *
class Enemy:
def __init__(self,x,y,vie,speed,direction,image,hitbox_x,hitbox_y):
self.x = x
self.y = y
self.vie = vie
self.speed = speed
self.direction = direction
self.image = image
self.hitbox_x = hitbox_x
... | true |
c878b125b799592d072e6680d989dc4c4c19d1d7 | Python | deepak-buddha/WiSe20_Team_10_Main | /notebooks/03-lh-Plotting_Data_for_Analysis.py | UTF-8 | 10,009 | 2.859375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
... | true |
e83292c22d0e12c21cbd7d8443fddc21b9c7a8bc | Python | saurabh-pandey/AlgoAndDS | /gfg/dp/sequence_alignment.py | UTF-8 | 2,481 | 3.71875 | 4 | [] | no_license | #URL: https://www.geeksforgeeks.org/sequence-alignment-problem/
#Description
"""
Given as an input two strings, X = x1x2...xm, and Y = y1y2...yn, output the alignment of the
strings, character by character, so that the net penalty is minimised. The penalty is calculated
as:
1. A penalty of p_gap occurs if a gap is ... | true |
bdffe894424eb5c8145592a3313fc37bd43668ff | Python | Dreamingson/python-learning | /Sports.py | UTF-8 | 1,468 | 4.03125 | 4 | [] | no_license | import random
def printInfo():
print("本程序模拟两个选手A和B的某种竞技比赛,请输入A和B的能力值(0-1的小数)")
def getInputs():
a = eval(input("请输入选手A的能力值:"))
b = eval(input("请输入选手B的能力值:"))
n = eval(input("请输入模拟比赛场次:"))
return a,b,n
def simNGames(n,proA,proB):
winsA,winsB = 0,0
for i in range(n):
scoreA,scoreB... | true |
3af5721e820e90801f57ef54507894a640e79b4e | Python | BWyld91/my-isc-work | /python/ex06.py | UTF-8 | 1,164 | 4.5625 | 5 | [] | no_license | #Exercise 6: Strings
#Q1 Loop through a string as a sequence
# create string variable 's'
s = 'I love to write python'
# loop through and display each element
for i in s:
print(i)
# print 5th element/ last element/ length of 's'
print(s[4])
print(s[-1])
print(len(s))
#Q2 Split a string and loop through word... | true |
6a404c477f8b6c7e6490c624274567b9dc19939b | Python | 3fon3fonov/exostriker | /exostriker/lib/pyqtgraph/SignalProxy.py | UTF-8 | 3,736 | 2.671875 | 3 | [
"MIT"
] | permissive | import weakref
from time import perf_counter
from .functions import SignalBlock
from .Qt import QtCore
from .ThreadsafeTimer import ThreadsafeTimer
__all__ = ['SignalProxy']
class SignalProxy(QtCore.QObject):
"""Object which collects rapid-fire signals and condenses them
into a single signal or a rate-limit... | true |
e07093057998f5b6b39a3e0bed5b548062eb5311 | Python | wang-qiuqiu/footID | /featureID_dataGenerator.py | UTF-8 | 2,473 | 2.71875 | 3 | [] | no_license | import numpy as np
import math
import os
target_classes = 2
def load_data(positive_data, negative_data):
positive_data = np.array(positive_data)
negative_data = np.array(negative_data)
train_data = []
train_label = []
for i in range(positive_data.shape[0]):
train_data.append(i)
... | true |
1e0261b8c1b3fca06a75ebc94a5b4ea875d87d25 | Python | newfan314/ai_search_algorithm | /eight_DFS.py | UTF-8 | 6,946 | 3.265625 | 3 | [] | no_license | import heapq
import copy
import time
S0 = []
SG = []
# 上下左右四个方向移动
MOVE = {'up': [-1, 0],
'down': [1, 0],
'left': [0, -1],
'right': [0, 1]}
# OPEN表
OPEN = []
# 节点的总数
SUM_NODE_NUM = 0
# 状态节点
class State(object):
def __init__(self, depth=0, state=None, hash_value=None, father_node=None):
... | true |
c4d09356d1aed96ec74cfe58601c818b2c2e8a69 | Python | Aasthaengg/IBMdataset | /Python_codes/p03409/s787933380.py | UTF-8 | 819 | 2.890625 | 3 | [] | no_license | from collections import defaultdict
from itertools import product
N = int(input())
red_points = [tuple(map(int, input().split(' '))) for _ in range(N)]
blue_points = [tuple(map(int, input().split(' '))) for _ in range(N)]
edges = defaultdict(set)
for i, j in product(range(N), repeat=2):
a, b = red_points[i]
... | true |
1f7b95041cf0b7e1b74dc18439b2c8e5914b9e22 | Python | solomondg/SpellChecker | /misspelled.py | UTF-8 | 1,370 | 2.8125 | 3 | [
"MIT"
] | permissive | import os
import time
temp = open("ref.txt", "r")
ref = temp.read()
def parser(inputfile):
worddict = {}
wordlist = []
tempstring = ""
tempdictside1 = ""
tempdictside2 = ""
for x in range(0, len(ref)-1):
# print tempstring.rsplit('->')
if (ref[x] != '\n'):
# and... | true |
cc6f82d96bf2cdd4000638e9cd92019df9671813 | Python | rreilink/PiPyNC | /target/cstruct.py | UTF-8 | 2,679 | 2.65625 | 3 | [] | no_license | cdef = """
typedef struct {
int naxis;
uint32_t step_mask[MAX_AXIS];
uint32_t dir_mask[MAX_AXIS];
} stepper_config_t;
"""
import struct
import array
class CStruct:
'''
Python representation of a C data structure
This could also be done using ctypes.Structure, but that is not (yet)
avai... | true |
14d26eef9103fc1e64898a2be5669f69813a6ef0 | Python | ZbigniewPowierza/pythonalx | /OOP/employee/test.py | UTF-8 | 3,394 | 3.203125 | 3 | [] | no_license | from employee import Employee, PremiumEmployee, AmountBonus, PercentBonus
class TestEmployee:
def test_init(self):
e = Employee("Jan", "Nowak", 100.0)
# e2 = Employee ("Kazimierz", "Kowalski", 120)
assert e.fname == "Jan"
assert e.name == "Nowak"
assert e.stawka == 100.0
... | true |
8399e03ec44b2214e3db9c67a765ead898683ad6 | Python | GRSEB9S/rfpow | /backend/satenders_parser.py | UTF-8 | 5,363 | 2.6875 | 3 | [] | no_license | import lxml
import re
import urllib
import urllib2
import datetime
from lib.pyquery import PyQuery
import logging
from backend.parsers import Parser
from HTMLParser import HTMLParser
import htmlentitydefs
class STParser(Parser):
domain = 'http://www.sa-tenders.co.za/'
headers = {
'User-Agent' : 'M... | true |
ef6d6020cb03242bac10956ef60d3ce23c2124d1 | Python | jaydenwhyte/Learn-Python-The-Hard-Way | /ex15.py | UTF-8 | 758 | 3.75 | 4 | [] | no_license | # import argv from the sys module
from sys import argv
# set script and filename variables from the script arguments
script, filename = argv
# open the filename passed in as an argument, and assign the file object to the txt variable
txt = open(filename)
# print a string with the filename
print "Here's your file %r:... | true |
7f95f32a901f4b05c6db53b5e170ac4a80d181de | Python | shiminshen/BigData_HW1-Python | /question3.py | UTF-8 | 625 | 2.859375 | 3 | [] | no_license | from loadFile import loadTaxiData, loadWeatherData
import pandas as pd
# load taxi data
tData = loadTaxiData()
# get neccesary data
subData = tData[['pYear', 'pMonth', 'pDay', 'passenger_count']]
# count sum of passenger in each day
dailyPassengerData = subData.groupby(['pYear', 'pMonth', 'pDay']).sum().reset_index()... | true |
a2f05f4863b3788f4ec669471c0eceb7b12d7238 | Python | ExpLife0011/wk15-18 | /gitlab/idfa/idfatracker/loader.py | UTF-8 | 996 | 2.609375 | 3 | [
"BSD-2-Clause"
] | permissive | # -*- coding: utf-8 -*-
import json
from ipaddress import ip_address
from datetime import datetime
from .redis_conn import getRedis
QUEUE_PREFIX = "newlog_"
class LogLoader(object):
"""
"""
def __init__(self, redis=None, maxN=32):
self.maxN = maxN
self.redis = redis if redis is not None ... | true |
294c9db4e0b7f2273499e7e33189650a47466309 | Python | garritfra/compyle.js | /test.py | UTF-8 | 278 | 3.28125 | 3 | [] | no_license | # Auto fahren
alter = 18
if (alter >= 18):
print("Du darfst endlich Auto fahren!")
elif (alter >= 16):
print("Du darfst Moped fahren, aber nicht Auto")
elif (alter >= 14):
print("Du darfst Mofa fahren, aber nicht Moped")
else:
print("Du musst Bus fahren!")
| true |
ad3f998efb6c48a09bf2d404dd007333ff3f7253 | Python | smithchristian/arcpy-create-base-dataset | /supportingModules/top.py | UTF-8 | 2,442 | 2.734375 | 3 | [
"MIT"
] | permissive | # ----------------------------------------------------------------------------
# Name: top.py (Topography.py)
# Purpose: This module contains variables for the construction
# of a topography dataset. This module is to be used in
# conjunction with create-Base-DataSet/main.py... | true |
c5bee9fa9a664ae740bb1b14d31fd706f333d313 | Python | mgedmin/imgdiff | /imgdiff.py | UTF-8 | 19,149 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
"""
imgdiff by Marius Gedminas <marius@gedmin.as>
Released under the MIT licence.
"""
import optparse
import os
import shutil
import subprocess
import sys
import tempfile
import time
# There are two ways PIL used to be packaged
try:
from PIL import Image, ImageChops, ImageDraw, ImageFilter
exce... | true |
16d45e2723f76a3c03c42a978e6c018895fbbbc2 | Python | wpy-111/python | /DataAnalysis/day01/demo09_pad.py | UTF-8 | 321 | 3.578125 | 4 | [] | no_license | """
添加元素
"""
import numpy as np
ary = np.arange(1,5)
print(ary)
ary = np.pad(ary,pad_width=(2,2),mode='constant',constant_values=-1)
print(ary)
#两个一维数组变成一个两行的数组
a = np.arange(1,9)
b = np.arange(9,17)
ary = np.row_stack((a,b))
print(ary)
ary = np.column_stack((a,b))
print(ary)
| true |
95d22c764b91145eb2d0dddaaebb24ec8590d2d7 | Python | nsyzrantsev/algorithms_3 | /BubbleSortStep/SimpleSort_tests.py | UTF-8 | 560 | 3.140625 | 3 | [] | no_license | from SimpleSort import SelectionSortStep, BubbleSortStep
from unittest import TestCase
class SimpleSortTest(TestCase):
def test_sort1(self):
a = [4, 3, 1, 2]
SelectionSortStep(a, 0)
self.assertEqual([1, 3, 4, 2], a)
SelectionSortStep(a, 1)
self.assertEqual([1, ... | true |
9b54812a3d0482d78caf444ecb1bc76db84ba020 | Python | k018c1072/Task10 | /Exam-10_1.py | UTF-8 | 128 | 3.546875 | 4 | [] | no_license | radius = int(input('半径> '))
def area(radius):
return radius * radius * 3.14
print('円の面積 :', area(radius))
| true |
7c4c5b6b3c4826e60fb16cc36a04b58e0e32b426 | Python | zjk1988/Leet-Code | /10 sort.py | UTF-8 | 9,537 | 3.8125 | 4 | [] | no_license | 1、冒泡排序
考虑外层循环,需要len-1次(最后一个元素就不用再走一次循环),外层循环i次也就是排序好了i个元素,考虑内层循环需要len-i-1次循环(同,最后一个元素就不用再走一次循环)
def bubble(L):
l = len(L)
for i in range(l-1):
for j in range(l-i-1):
if L[j]>L[j+1]:
L[j],L[j+1] = L[j+1],L[j]
print(L)
优化1:
如果内层循环某次没有交换数据,说明已经排好序了,设置一个标志位fla... | true |
57e52db33bafe823c43eb973cd2949c2d607c1d6 | Python | caueguedes/uri_online_judge | /beginner/1008.py | UTF-8 | 171 | 3.421875 | 3 | [] | no_license | number = int(input())
worked_hours = int(input())
per_hour = float(input())
amount = worked_hours * per_hour
print("NUMBER = %i"%number)
print("SALARY = U$ %.2f"% amount) | true |
87ea78838a7e462357fd9dde7f1b96ea8578e97e | Python | Ace238/python-bootcamp | /Week-1/challenge_3.py | UTF-8 | 162 | 3.875 | 4 | [] | no_license | n = int(input("Enter number greater than or equal to 0: "))
if(n < 0):
print("Invalid Number")
elif(n == 0):
ans = 0
print(ans)
else:
ans = n * 2
print(ans) | true |
34ed246070ae80250d19a360e8f653f9a40276cd | Python | shencheng-js/machineStudy | /test/feel2.py | UTF-8 | 1,268 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020-11-25 11:42
# @Author : shen
# @File : feel2.py
# @Software: PyCharm
import pandas as pd
import numpy as np
from numpy import random
import matplotlib.pyplot as plt
# 读入数据并对其录取结果修改为 -1,1
path = r'./ex2data1.txt'
data = pd.read_csv(path, names=['exam1', 'exam2', 'admitted'])
# ... | true |
c1f45bec07cd5294b1584b0a1fef52e0cbf6bd21 | Python | MasterScott/Scyll4 | /scylla.py | UTF-8 | 1,983 | 2.734375 | 3 | [
"MIT"
] | permissive | import json
from collections import OrderedDict
import requests
import argparse
import urllib3
urllib3.disable_warnings()
parser = argparse.ArgumentParser(description='Python script to use scylla.sh API')
parser.add_argument('-c', '--count', help='number of records to retrieve (default is 500)', default='500')
parse... | true |
3e22a1d1e331a9249a40497cbff8cfa12e591638 | Python | touhiduzzaman-tuhin/python-code-university-life | /Telusko/63.py | UTF-8 | 1,554 | 3.453125 | 3 | [] | no_license | class Hello:
def run(self):
for i in range(5):
print("Hello")
class Hi:
def run(self):
for i in range(5):
print("Hi")
h1 = Hello()
h2 = Hi()
h1.run()
h2.run()
print("----")
from threading import *
class Hello(Thread):
def run(self):
for i in range... | true |
b58a2f24a8caf304eecd7e779a39edef9ebd0142 | Python | Madisonjrc/csci127-assignments | /hw_01/program.py | UTF-8 | 999 | 4.09375 | 4 | [] | no_license | def capitalize(name):
"""
input: name --> a string in the form "first last"
output: returns a string with each of the two words capitalized
note: this is the one we started in class
"""
return name.title()
print (capitalize("madison chen"))
def init(name):
"""
Input: name --> a string ... | true |
6f6a636698e45d2eb2766ae027e96973bbe3a86d | Python | YSKUMAR775/flask_rds_csv-create-return_csv | /module/create_csv.py | UTF-8 | 1,064 | 2.765625 | 3 | [] | no_license | import csv
# import pandas as pd
def csv_create(id, info_1):
a = id
cur = info_1.cursor()
query = "select * from sql_flask_excel_table where id = '" + str(a) + "'"
##############(method-1)#############
# df = pd.read_sql_query(query, con=mydb)
# file_name = 'csv_data.csv'
# df.to_csv(fil... | true |
b5fde1e5d1b3b59aa129fbcd5ce6adc959777c22 | Python | ssjunnebo/OrderPortal | /orderportal/scripts/api_get_order.py | UTF-8 | 966 | 2.625 | 3 | [
"MIT"
] | permissive | """API example script: Get order data.
NOTE: You need to change several variables to make this work. See below.
NOTE: This uses the third-party 'requests' module, which is better than
the standard 'urllib' module.
"""
from __future__ import print_function
import json
# Third-party package: http://docs.python-reque... | true |
176c4dd7f0ab17fcb7fa4f42a4d10862f90cc745 | Python | ayanchyaziz123/all-competitive-programming-documents-and-problem-solving | /codeforces/1530-b.py | UTF-8 | 707 | 2.96875 | 3 | [] | no_license | for _ in range(int(input())):
lrr, brr = [int(i) for i in input().split(' ')]
flag = ''
for i in range(brr):
flag += '10'[i % 2]
mid = '1' + '0' * (brr-2) + '1'
mid2 = '0' * brr
solution = ['' for i in range(lrr)]
l = 0
h = lrr - 1
while l <= h:
if(l == 0):
... | true |
7fcca54b1ea303a6fd1a9fa405f890dc5fc60232 | Python | amkera/python_for_bioinformatics | /count_motifs.py | UTF-8 | 1,744 | 3.953125 | 4 | [] | no_license | #inputs are the motifs, a list of kmers (strings)
#output the count matrix of motifs as a dictionary of lists
def Count(Motifs):
count = {} #final dictionary
rows = Motifs
row = len(rows[0]) #6
for symbol in "ACGT":
count[symbol] = [] #4 empty lists now exist
for nucleotide in range(row... | true |
749a6246452e44a1593b900f6df2cd43c0dc1339 | Python | unclenachoduh/term_extractor | /src/old_scoreTerms.py | UTF-8 | 4,095 | 2.75 | 3 | [] | no_license | ####
# Script finds TF*IDF scores for terms in a text file with format
# one doc per line.
# To run, use command, `python3 score_terms.py <file_name>`
# Will write a file called `plot` to run directory with <term, score>
####
#### Todo
# I can preprocess to find multi-word entities and merge them
# with the ... | true |
13e8874d7204ac7b71e978b311d9b864f7a389a8 | Python | jlefkoff/GridBoard | /Chess/chessmoves.py | UTF-8 | 9,317 | 3.28125 | 3 | [
"MIT"
] | permissive | import pprint
class PiceMoves:
def __init__(self):
pass
def clearBord(self):
self.row = []
self.returnBord = []
for len in range(8):
self.row = []
for hei in range(8):
self.row.append('xxx')
self.returnBord.append(self.row) ... | true |
71b41701887b862b174f676687af5763547ec84e | Python | bonicim/technical_interviews_exposed | /tst/interview_cake_questions/test_is_palindrome.py | UTF-8 | 346 | 2.84375 | 3 | [] | no_license | import pytest
from src.algorithms.interview_cake_questions.has_palindrome import has_palindrome
def test_odd_length_non_palindrome_word_should_be_true():
string = "ivicc"
assert has_palindrome(string) is True
def test_odd_length_non_palindrome_word_should_be_false():
string = "livc"
assert has_pa... | true |
2e02f0e936149f3dbd8a592b2b9aa1b1e88ff2ba | Python | andykjb/US-Medical-Insurance-Costs | /medical insurance costs.py | UTF-8 | 1,776 | 3.328125 | 3 | [] | no_license | ### Scope ###
## Age ##
# Find the average age, for all and gender
## Charges ##
# Average charge, for all and gender
## Smoking ##
# Find ratio of smokers in genders
# Find ratio of smokers with low, normal and high BMI
# Find ratio of smokers for people with and without kids
# Average price increanse for smokers v... | true |
ddde8ac0336e14afd886d9f47e5571c4cebddfee | Python | MysticalX99/tssoj-solutions | /solutions/graph theory/triway19w1p7.py | UTF-8 | 553 | 3.453125 | 3 | [] | no_license | n,m,a,b = map(int, input().split())
a-=1
b-=1
#dfs
def dfs(vis, graph, node):
for neighbour in graph[node]:
if vis[neighbour]==False:
vis[neighbour] = True
dfs(vis, graph, neighbour)
adj = []
vis = []
# set up adjacency list
for i in range(n):
adj.append([])
vis.append(False... | true |
c1d2610a245fc778d9f17d1242cc5feaece03fa4 | Python | ranakhalil/CarND-Advanced-Lane-Lines | /tracker.py | UTF-8 | 2,024 | 2.65625 | 3 | [] | no_license | import numpy as np
import cv2
class tracker():
def __init__(self, Mywindow_width, Mywindow_height, Mymargin, My_ym = 1, My_xm = 1, Mysmooth_factor = 15):
self.recent_centers = []
self.window_width = Mywindow_width
self.window_height = Mywindow_height
self.margin = Mymargin
... | true |
4886d15baf76707d2d9c98264f3f45d63a0ade7d | Python | AnatolyDomrachev/karantin | /is28/pavlov28/Python/zadanie3/zd1.py | UTF-8 | 343 | 3.28125 | 3 | [] | no_license | def vvod():
print("Ввод матрицы ")
a = []
for i in range (10):
a.append(float(input()))
return a
def raschet(a):
st = 0
for i in range (9):
if a[i] > a[i+1]:
st = 1
return st
def vyvod(st):
if st == 0:
ts = True
else:
ts = False
return ts
a = vvod()
st = raschet(a)
ts = vyvod(st)
print(t... | true |
07c1ec177d2f428d0a478826f8c2fa81c49e0a9e | Python | udoyen/andela-homestead | /basic-datastructures/queue/start.py | UTF-8 | 207 | 2.8125 | 3 | [] | no_license | from pythonds.basic.queue import Queue
q = Queue()
print(q.isEmpty())
q.enqueue(4)
q.enqueue('dog')
q.enqueue(True)
print(q.size())
print(q.isEmpty())
q.enqueue(8.4)
q.dequeue()
q.dequeue()
print(q.size())
| true |
53e0d973a62359253b1fd6923408c71ed0a2f9f5 | Python | guido-mutt/soam | /tests/workflow/test_mergeconcat.py | UTF-8 | 769 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | """Merge concat tester"""
import pandas as pd
from pandas._testing import assert_frame_equal
from soam.workflow import MergeConcat
def test_merge_concat():
"""Function to test the merge concat."""
df1 = pd.DataFrame({"date": [1], "metric1": [512]})
df2 = pd.DataFrame({"date": [1], "metric2": [328]})
... | true |
8c0d53032ebf0fae04fd0bdecc20fbe062f6ba94 | Python | damkh/gb_py_parcing_2020-09-01 | /les_2/1.py | UTF-8 | 802 | 2.9375 | 3 | [] | no_license | from bs4 import BeautifulSoup as bs
import requests
from pprint import pprint
main_link = 'http://127.0.0.1:5000/'
html = requests.get(main_link)
soup = bs(html.text,'html.parser')
a = soup.find('a')
div = a.parent.parent #Получаем родителя
div.children #Возвращает всех детей со скрытыми нодами
div.findChildren(... | true |
ea3cca4d806bdac9a8e3b996ce786b727f38208f | Python | FBecerra2/MachineLearning-Data | /3-Regresion-lineal-multiple/regresion-lineal-multiple.py | UTF-8 | 5,236 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 9 00:26:34 2020
@author: Facundo
"""
# Regresion lineal multiple
#Plantilla de Preprocesado
#Importar librerias
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
dataset = pd.read_csv("50_Startups.csv")
X =dataset.iloc[:, :-1].values
y =dataset.i... | true |
fea269960a972dcdc0e5c62f42bec6251f6b6c0d | Python | popsonebz/lesson1 | /helloWorld17.py | UTF-8 | 206 | 3.234375 | 3 | [] | no_license | from SimpleCV import Image
import time
img = Image('ladies.jpg')
# Crop starting at +(50, 5)+ for an area 280 pixels wide by 500 pixels tall
cropImg = img.crop(80, 5, 280, 500)
cropImg.show()
time.sleep(10) | true |
a21965c4cdeb59e20164341c54da92c6b1195452 | Python | Starboomboom37183/Python | /3/4.py | UTF-8 | 1,407 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import re
input = open("Dijkstra.c","r")
lines = input.read()
input.close()
count = 0
start = 0
end = 0
i = 0
def skip_this(lines,i):
i +=1
while i < len(lines):
if lines[i]=="\"":
if lines[i-1]!="\\\\":
return i
i+=1
output = open("Dijkstra... | true |
61677edd902c52db84cf47fc473d31a7c0c3b49a | Python | Angelicax20/-management_employee | /forms.py | UTF-8 | 2,730 | 2.609375 | 3 | [] | no_license | from flask_wtf import FlaskForm
from wtforms import TextField, SubmitField, PasswordField, DateField, IntegerField, SelectField, DecimalField, StringField
from wtforms.fields.html5 import EmailField, DateField, IntegerField, TelField, DecimalField
from wtforms.validators import EqualTo, InputRequired, Length
clas... | true |
71403e574eb5b274842aac893c364647e2b35d16 | Python | htl1126/leetcode | /1060.py | UTF-8 | 872 | 3.703125 | 4 | [] | no_license | # Ref: https://leetcode.com/problems/missing-element-in-sorted-array/discuss/305579/C%2B%2B-binary-search
# Ref: https://leetcode.com/problems/missing-element-in-sorted-array/discuss/307872/python-binary-search
# Algo: binary search
class Solution(object):
def missingElement(self, nums, k):
"""
:ty... | true |
913acd714fd7cda5eda37eb607110ff7c50dedf9 | Python | jimpelton/bsumg13 | /imgproc/trunk/python/makecsv/Test/DataReaderTest.py | UTF-8 | 3,736 | 2.59375 | 3 | [] | no_license | __author__ = 'jim'
import unittest
import ugDataReader
import ugDataFile
class MyTestCase(unittest.TestCase):
def setupDataFile(self):
return ugDataFile.ugDataFile(layout='testdata/28April2013_plate_layout_transposed_flipped.csv',
dirout="testdata/dirout/",
... | true |
5c806088c40af7da429268d0b0cb8915d35ebda9 | Python | Leos1999/IN-NEED-beta- | /design_project.py | UTF-8 | 4,448 | 2.53125 | 3 | [] | no_license | import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
# nltk.download("stopwords")
# nltk.download('punkt')
from flask import Flask, render_template
from flask_mysqldb import MySQL
app = Flask(__name__)
app.config['MYSQL_HOST'] = 'localhost'
app.config['MYSQL_USER'] = 'root'
app.confi... | true |
9815e9434855bde495465e81513438c67dec2578 | Python | ecypeng/EECS4415 | /a3/twitter_app_b.py | UTF-8 | 3,826 | 2.921875 | 3 | [] | no_license | """
This script connects to Twitter Streaming API, gets tweets with '#' and
forwards them through a local connection in port 9009. That stream is
meant to be read by a spark app for processing. Both apps are designed
to be run in Docker containers.
To execute this in a Docker container, do:
... | true |
8cb45e492b4a706c194aa0724743a1763303f586 | Python | docento/cradle | /cradle.py | UTF-8 | 3,789 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding: windows-1251 -*-
##########################################################
from __future__ import print_function
import string
import sys
##########################################################
TAB = "\t"
Look = "" #lookahea character
#########################################... | true |
bb65b727fb1306a4c1b44caaa2e2476ee48cf35e | Python | zzb5233/coding_interview_c_python | /interview_code/16_power/python/power.py | UTF-8 | 1,529 | 3.703125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
def equal(num_1, num_2):
if num_1 - num_2 < 0.0000001 and num_1 - num_2 > -0.0000001:
return True
else:
return False
def power_with_unsigned_exponent(base, abs_exponent):
result = 1.0
for i in range(abs_exponent):
result *= b... | true |
4c95fad2ab3b0598d3d31c81b031087024cb49bc | Python | misaelvf2/neural_networks | /models/multilayernn.py | UTF-8 | 18,145 | 3.109375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
class MultiLayerNN:
"""
Class implementing feedforward neural networks with backpropagation algorithm implemented as batch gradient descent
"""
def __init__(self, data, raw_data, labels, classes, hidden_layers, num_nodes, learning_rate, epochs):
... | true |
5cfcceb5b80259eab61098a924d2115f22176034 | Python | leogtzr/python_crash_course_book_code_snippets | /even_numbers1.py | UTF-8 | 278 | 4.125 | 4 | [] | no_license | for n in range(1, 11):
if n % 2 == 0:
print(n)
print("sep...............")
even_nums = list(filter(lambda x: x % 2 == 0, list(range(1, 11))))
print(even_nums)
# Using list comprehension:
even_nums2 = [n for n in list(range(1, 11)) if n % 2 == 0]
print(even_nums2)
| true |
c024bdd961f016febf98828539fd897c10b84072 | Python | kminjung/python | /Hello/advence/Step07_Except3.py | UTF-8 | 598 | 3.1875 | 3 | [] | no_license | #-*- coding:utf-8 -*-
'''
Custom 예외 발생 시키기
- 프로그래머가 의도하는 시점에 직접 예외를 발생 시킬수 있다.
raise 예외객체
'''
if __name__ == '__main__':
try:
msg=input('정수 입력')
if not isinstance(msg, int):
# 원하는 시점에 예외 발생 시키기
raise ValueError('정수를 입력 하라니까 말을 안듣네?')
... | true |
ae00b76c1c52dc9551fa8a720a37d1a18e0f6ac5 | Python | pombredanne/gogo | /gogo | UTF-8 | 1,490 | 2.59375 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import argparse
import os
def _get_path(path, src, full=False):
return path if full else os.path.relpath(path, src)
def _get_dirs(directory):
'''Generate full path to each subdir in directory'''
for f in os.listdir(directory):
p = os.path.join(dire... | true |
418bbf809ff9585510b2d4c7ec1d9416e7d035a9 | Python | nagask/leetcode-1 | /33 Search in Rotated Sorted Array/sol2.py | UTF-8 | 1,501 | 3.828125 | 4 | [] | no_license | """
The array is divided in two parts:
- the first one that increases until a pivot index
- the second one that is stricty lower than the first one, and increases until the end
Every item of the first part is greater than every item of the second one.
We can use these feature to create a binary search algorithm.
If the... | true |
7131e83e8699d6beec7e1d9538468904d05e5012 | Python | barleen-kaur/LeetCode-Challenges | /DS_Algo/Graphs/shortestAlternatingColorPaths.py | UTF-8 | 2,171 | 3.71875 | 4 | [] | no_license | '''
1129. Shortest Path with Alternating Colors
Consider a directed graph, with nodes labelled 0, 1, ..., n-1. In this graph, each edge is either red or blue, and there could be self-edges or parallel edges.
Each [i, j] in red_edges denotes a red directed edge from node i to node j. Similarly, each [i, j] in blue_e... | true |
fd623d9cca905514a731e26ee295b78e77cc0c57 | Python | b3b/able | /able/queue.py | UTF-8 | 2,217 | 2.953125 | 3 | [
"MIT"
] | permissive | import threading
from functools import wraps, partial
try:
from queue import Empty, Queue
except ImportError:
from Queue import Empty, Queue
from kivy.clock import Clock
from kivy.logger import Logger
def ble_task(method):
"""
Enque method
"""
@wraps(method)
def wrapper(obj, *args, **kwarg... | true |
97845af4d1c5256336c4ad7e307b1e0287b60f58 | Python | aphid308/weatherterm | /weatherterm/parsers/weather_com_parser.py | UTF-8 | 2,153 | 2.875 | 3 | [] | no_license | from weatherterm.core import ForecastType
from weatherterm.core import Forecast
from weatherterm.core import Request
from weatherterm.core import Unit
from weatherterm.core import UnitConverter
import re
class WeatherComParser:
def __init__(self):
self._forecast = {
ForecastType.TODAY: self.... | true |
2cabbc5520ba702c3f385d9bb25246ae815cba06 | Python | quebic-source/keras-crf | /keras_crf/utils.py | UTF-8 | 1,844 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | import logging
import os
def read_files(input_files, callback=None, **kwargs):
if isinstance(input_files, str):
input_files = [input_files]
for f in input_files:
if not os.path.exists(f):
logging.warning('File %s does not exist.', f)
continue
logging.info('Start... | true |
528155392cb51324fa4af556d2739f0ebd1753bf | Python | OPM/ResInsight-UserDocumentation | /docs/rips/PythonExamples/surface_import.py | UTF-8 | 1,215 | 2.875 | 3 | [
"MIT"
] | permissive | # Load ResInsight Processing Server Client Library
import rips
# Connect to ResInsight instance
resinsight = rips.Instance.find()
print("ResInsight version: " + resinsight.version_string())
# Example code
# get the project
project = resinsight.project
# get the topmost surface folder from the project
surfacefolder ... | true |
131c46a6d6df6c8024ee9cde81dfb8fc3fd3df34 | Python | mrossinek/cobib | /src/cobib/utils/rel_path.py | UTF-8 | 1,860 | 3.75 | 4 | [
"MIT"
] | permissive | """coBib's path utility."""
from __future__ import annotations
from pathlib import Path
from typing import Any
class RelPath:
"""The RelPath object.
This object is a simple wrapper of a `pathlib.Path` object which ensures that a path is, if
possible, relative to the user's home directory or an absolute... | true |
57af271192266fc78498bbeaa94f5310aa2634d2 | Python | t753/Hackerrank-solutions | /newyearchaos.py | UTF-8 | 668 | 3.21875 | 3 | [] | no_license | T = int(input().strip())
for a0 in range(T):
n = int(input().strip())
q = map(int,input().strip().split(' '))
# your code goes here
position = 1
bribes = 0
plus2 = 0
for i in q:
jumps = i - position
if jumps > 2:
bribes = "Too chaotic"
... | true |
09555d4703bd50d88512a6aceae794a91c9dbd24 | Python | 2016-molinf/Eda | /moldb/views.py | UTF-8 | 5,227 | 2.609375 | 3 | [] | no_license | # views (=logika) pro chemoinfo django projekt
# importy
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response, render, get_object_or_404
from django.db.models import Q # slovník v ve funci search...?
#----- importy v rámci django projektu
from .models impor... | true |
92655a35227412a16cfd530e3a9b984c7c8adc19 | Python | leo-Ne/SSVEP_TRCA | /PearsonStimulation.py | UTF-8 | 3,336 | 3 | 3 | [] | no_license | from typing import Any, Union
import numpy as np
template = np.arange(0, 250, 1)
template_std = np.std(template) * np.sqrt(250)
print(template_std)
def PearsonCorrealtion(buffer: np.ndarray, length):
accumulator = 0
x_avg = 0
for i in range(length):
x_avg += buffer[i]
x_avg =... | true |
9b6e0694d9eecf20601524cdc8f812bb95afb9f6 | Python | scottmiao/checkio-solutions | /home/spaceship-purchase.py | UTF-8 | 705 | 3.6875 | 4 | [
"WTFPL"
] | permissive | # Input data: contains four integer numbers:
#
# - the initial Sofia's offer,
# - Sofia's raise to his offer,
# - the initial fare required by the old man's,
# - the old man's reduction of his fare;
#
# Output data: the amount of money that Sofia will pay for the spaceship.
import unittest
def checkio(offers):
in... | true |
ae28d95681f9f74960891c6804953fd692b41ef7 | Python | herrahlstrom/kattis | /pizza2/pizza2.py | UTF-8 | 269 | 3.234375 | 3 | [] | no_license | import sys
import math
input = sys.stdin.readline().strip()
if len(input) > 0:
rc = input.split(" ")
r = int(rc[0])
c = int(rc[1])
circle_total = r * r * math.pi
circle_chees = (r - c) * (r - c) * math.pi
print((circle_chees/circle_total)*100)
| true |