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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
71dd7be659cfb5c46903c4e76feade537f9cdb09 | Python | RyanDraves/buffham | /buffham/buffham_gen.py | UTF-8 | 630 | 2.625 | 3 | [] | no_license | #!/usr/bin/python3
import argparse
import glob
import pathlib
import buffham.parse as bh
def main(dir: pathlib.Path):
for bh_file in glob.glob(str(dir.absolute() / '**/*.bh'), recursive=True):
bh_file = pathlib.Path(bh_file)
messages = bh.Parser.parse_file(bh_file)
bh.Generator.generate(bh... | true |
8d47ee7607bcbb94e417505f5a2325e8e6dbac4c | Python | regalk13/Tkinter-projects | /file.py | UTF-8 | 647 | 2.6875 | 3 | [] | no_license | from tkinter import *
from PIL import Image, ImageTk
from tkinter import filedialog
root = Tk()
root.title('File')
img = PhotoImage(file='images/icon.png')
root.tk.call('wm', 'iconphoto', root._w, img)
def open():
global my_image
root.filename = filedialog.askopenfilename(initialdir="tkinter-projects/images",... | true |
172fdc750f08b7474275a639cb28798a7468c787 | Python | a-pavco/ant_simulation | /other/ant_sim_sdf/ant_sim/scripts/moveTripods.py | UTF-8 | 582 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from std_msgs.msg import Float32
def talker():
pub = rospy.Publisher('/ant_topic', Float32, queue_size=1)
rospy.init_node('ant_rosnode_py', anonymous=True)
rate = rospy.Rate(1)
position = Float32()
tmp = 0;
position.data = -100
while not rospy.is_shutdown():
#rospy.loginfo... | true |
0a25b23358de3792e35b6e9f5f4b51465e3fe6d5 | Python | NoahNacho/python-solving-problems-examples | /Chapter4/Exercise8.py | UTF-8 | 139 | 3.765625 | 4 | [
"MIT"
] | permissive | def area_of_circle(r):
A = 3.141592653589793*r**2
print(A)
radius = int(input('What shouldthe radius be?'))
area_of_circle(radius) | true |
9006d2c20fa935aedd9f2d951aaca192b5393718 | Python | Nirperm/Design-Pattern | /Observer/number_generator.py | UTF-8 | 489 | 3.046875 | 3 | [] | no_license | from abc import ABCMeta, abstractmethod
class NumberGenerator(metaclass=ABCMeta):
__observers = []
def add_observer(self, observer):
self.__observers.append(observer)
def delete_observer(self, observer):
self.__observers.remove(observer)
def notify_observers(self):
for obse... | true |
71fe6dc9d54e15846439ae9a8265a0e36dbc3ce7 | Python | kuplo/OstryKodzing | /Model.py | UTF-8 | 1,529 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# importy zewnetrzne
# nasze importy
from Stale import *
#===================================== Na czas testow
Gracz = {"nick" :"user",
"haslo" :"123",
"ip" :"212.191.227.106",
"nazwaSerwera" :"LocalHome"}
Pliki = {"/" ... | true |
23504d1ac21b653538cdb1922efe499d071254d2 | Python | akuchibotla/subway | /generate_all_solutions.py | UTF-8 | 429 | 2.5625 | 3 | [] | no_license | from subway import solver
import json
import os
for i in xrange(10000):
num_str = str(i)
num_str = '0' * (4 - len(num_str)) + num_str
file_name = 'solutions/' + num_str + '.json'
if os.path.isfile(file_name):
print num_str, 'has already been computed, so skipping'
continue
solutions = solver(num_str)._getva... | true |
fac55ceb275d5e7680255d19ea8dff958728348c | Python | Kashish24/hackerEarthCodingSolutions | /Length of a valley.py | UTF-8 | 2,550 | 3.46875 | 3 | [] | no_license | Link to Problem:- https://www.hackerearth.com/practice/algorithms/dynamic-programming/introduction-to-dynamic-programming-1/practice-problems/algorithm/hill-150045b2/
# Brute Force Approach.
'''
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # ... | true |
dbe60c419b0f917fb280db21ffd40d6b4eb55b6f | Python | jsmack/learn | /old/language/python/udemy/ds/184/185.py | UTF-8 | 1,691 | 2.859375 | 3 | [] | no_license | import threading
import time
import logging
logging.basicConfig(level=logging.DEBUG,format='%(threadName)s: %(message)s')
#def work1(x,y=2):
#def work1(d, lock):
def work1(lock):
logging.debug('start')
with lock:
lock.acquire()
i = d['x']
time.sleep(1)
d['x'] = i + 1
l... | true |
35a0849d21e224be5a4b6b358da770c26104acf2 | Python | suneilr/readingspeed | /readingspeed.py | UTF-8 | 2,355 | 3.265625 | 3 | [] | no_license | filename='[file name with path]'
import datetime
def timenow():
time=datetime.datetime.now()
timevalue=float(time.hour*60+time.minute+time.second/60)
return timevalue
paragraph = ''
f = open(filename,'r',encoding="ISO-8859-1")
#f = open(filename,'r',encoding="utf8")
data = f.read()
totalwords = len(data.s... | true |
475737ad472b5b01dac2c2317a83ebea9cbf6e25 | Python | jgazal/DSA_Python-FAD | /Python_FAD/Capitulo2_TiposEstruturasDados/Dicionarios.py | UTF-8 | 1,973 | 4.34375 | 4 | [] | no_license | print("Dicionários")
print("-----------")
# Isso é uma lista
estudantes_lst = ["Pedro", 24, "Fernando", 22, "Tania", 26, "Cris", 25]
print(estudantes_lst)
# Isso é um dicionário
estudantes_dict = {"Pedro":24, "Fernando":22, "Tania":26, "Cris":25}
print(estudantes_dict)
print(estudantes_dict["Pedro"])
estudantes_dict["P... | true |
6b9cc71b2c2d5763b43294e2599e5a9888f01a3a | Python | gregoryhooks/FarmersMarketRegister | /discountFunctions/BXGD.py | UTF-8 | 1,312 | 3.8125 | 4 | [] | no_license | # Buy X Products, get them all at any percentage off
# Written by Gregory Hooks
# Expected input: List of items in basket, the rule to define the discount
# Expected output: The total number of times the discount needs to be applied
# Verify that the requirements for product x is satisfied and return the approp... | true |
5d5460734f4e454babdf73bff329e89a06b7b17a | Python | carlosgaleano/samsung | /contar.py | UTF-8 | 184 | 2.859375 | 3 | [] | no_license | # -*- coding: iso-8859-15
import sys
import os
if len(sys.argv) >= 2:
print "El textos '%s' tiene %s caracteres" % (sys.argv[1],len(sys.argv[1]))
else:
print "Necesito un parámetro" | true |
a3f869af7c2ff622b0c585785100eab28dcf597c | Python | kolakows/ART2 | /test_net.py | UTF-8 | 6,390 | 2.75 | 3 | [] | no_license | from mnist import MNIST
from art2 import Art2Network
import matplotlib.pyplot as plt
from utils import *
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def simple_test_cube(directory_path, train_split = 0.9):
data = pd.read_csv(f'{directory_path}/cube.csv').to_numpy()
np.random.shuff... | true |
89bcc430250d365378d1c5696e0f953145517a11 | Python | FinnHB/Python.GDAL | /Scripts/reduce_dataset.py | UTF-8 | 3,972 | 2.96875 | 3 | [] | no_license | '''
____________________________________________________________________
|TITLE : Reading Raster Data with GDAL |
|DATE : 08 May, 2021 |
|====================================================================|
|DESCRIPTION: ... | true |
d03e922baef9aa9bb2d58195aaf2822acd7bc5c4 | Python | BrindaSahoo2020/Python-Programs | /SmallestNumer.py | UTF-8 | 307 | 4.125 | 4 | [] | no_license | #Python program to find smallest number in a list
#Sample Input
'''list1 = [12,1,3,4,5,5,12,13,12,12,12,1,2,0,-1]'''
#Sample Output
'''Smallest number is -1'''
list1 = [12,1,3,4,5,5,12,13,12,12,12,1,2,0,-1]
sma = list1[0]
for i in list1:
if (sma > i):
sma = i
print("Smallest number is :",sma) | true |
0dfc0dff7af289e05f5cf8276c31a1a7193b24d7 | Python | tcloudb/Biological-Databases-Assignment-1 | /src/getSeq.py | UTF-8 | 478 | 3.40625 | 3 | [] | no_license | sequence = open("data.seq")
locater = open("data.in")
query = raw_input("Please enter your query: ")
file_contents = sequence.read()
index = file_contents.find(query)
if index != -1:
for line in reversed(locater.readlines()):
start = line.find(" ")
value = int(line[start+1:])
if index > ... | true |
2877016e5ed59892e070bcac3cf11a34e38d9c61 | Python | ahmedkamel97/CS142_assignment3 | /Parser2.py | UTF-8 | 2,364 | 3.203125 | 3 | [] | no_license | import typing
from typing import List
from CNF import read_grammar, convert_grammar
import random
END = None
debug = 1
"""
This is the main parser function
I used some online resources to build this parser function, the resources are cited within the references section
"""
def parse(grammar_file_path: Li... | true |
7c7eef3b16f5f09809e29b8a59a54374fcc8a825 | Python | robstall/pi-play | /Servo.py | UTF-8 | 815 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
import RPi.GPIO as GPIO
import time
class Servo:
def __init__(self, pin, cycle_ms, pulse_ms_list):
self.pin = pin
self.frequency = 1000 / cycle_ms
self.dutycycles= []
for p in pulse_ms_list:
self.dutycycles.append(p / cycle_ms * 100)
print "f=" + str(se... | true |
b8be4bdb76e7984b8c8b1c0c457aa46965c52abe | Python | dqyi11/SVNBackup | /Proj/UR/GeneratePaths/WorldViz.py | UTF-8 | 4,188 | 2.859375 | 3 | [] | no_license | '''
Created on Jul 30, 2015
@author: daqing_yi
'''
import pygame, sys
from pygame.locals import *
import numpy as np
from Path import *
BLUE = (0,0,255)
RED = (255,0,0)
BLACK = (0,0,0)
GREEN = (0,255,0)
class WorldViz(object):
def __init__(self, world):
self.world = world
... | true |
1a02aa73a4a4c8b1fe503f6873915ff693051b25 | Python | ayushagarwal2419/common_scripts | /extract_text/krutidev_unicode_converter.py | UTF-8 | 11,691 | 2.859375 | 3 | [
"MIT"
] | permissive | def krutidev_to_unicode(krutidev_substring):
modified_substring = krutidev_substring
array_one = ["ñ", "Q+Z", "sas", "aa", ")Z", "ZZ", "‘", "’", "“", "”",
"å", "ƒ", "„", "…", "†", "‡", "ˆ", "‰", "Š", "‹",
"¶+", "d+", "[+k", "[+", "x+", "T+", "t+", "M+", "<+", "Q+", ";+", "j+... | true |
a6d1bcf4312d70bac6103850a49c949e88931e09 | Python | ZoranPandovski/al-go-rithms | /sort/BozoSort/bozo_sort.py | UTF-8 | 1,162 | 4.34375 | 4 | [
"CC0-1.0"
] | permissive | """
Bozo sort consists out of checking if the input sequence is sorted and if not swapping randomly two elements.
This is repeated until eventually the sequence is sorted.
Takes in an array of numbers and provides a sorted array.
It may take O(infinity) at worst case as upper limit is not defined and best case will... | true |
b01ad886b7d2ef87359a509b221500d894d23b4b | Python | kerighan/differential | /tests/lotka_volterra.py | UTF-8 | 475 | 3.375 | 3 | [] | no_license | from differential import Differential, Unknown
import numpy as np
# initial condition
alpha = 2 / 3
beta = 4 / 3
gamma = 1
delta = 1
# create unknowns
x = Unknown('x', 2, label='proie') # proie
y = Unknown('y', 1.5, label='prédateur') # prédateur
# write down equation
x.dt = alpha * x - beta * x * y
... | true |
95e23b0d54d064365cb4d3a4d093804ca3ec257a | Python | adityachoudary54/covid19 | /WorldIndiaDjangoproject/src/worldStatistics/trendsScript.py | UTF-8 | 2,592 | 2.65625 | 3 | [] | no_license | import os
import plotly.express as px
import plotly.graph_objects as go
import pandas as pd
import numpy as np
import wget
from bs4 import BeautifulSoup
import urllib.request
url = "https://pomber.github.io/covid19/timeseries.json"
def download():
reqPath=os.path.abspath("./worldStatistics/trendsData")
if "ti... | true |
713b81246531095ca417e82bfa9e253ca0afee4c | Python | Blogg9ggg/Project-Euler-Solution | /P16.py | UTF-8 | 174 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 16 00:37:55 2020
@author: blogg9ggg
"""
a = 2**1000
ans = 0
while a > 0:
ans = ans + a%10
a = a//10
print(ans)
| true |
22ca833edc9733b83e3f69fb794668ed824893f0 | Python | xu-robert/Leetcode | /Get Maximum in Generated Array.py | UTF-8 | 1,850 | 3.96875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 15 09:51:40 2021
Get Maximum in Generated Array
You are given an integer n. An array nums of length n + 1 is generated in the following way:
nums[0] = 0
nums[1] = 1
nums[2 * i] = nums[i] when 2 <= 2 * i <= n
nums[2 * i + 1] = nums[i] + nums[i + 1] when 2 <= 2 * i + 1 <= ... | true |
385c23f290dd44a7c0bcb06fb1279007f2d043fc | Python | afcarl/time_series_anomaly_detect_keras | /src/data/data_transform.py | UTF-8 | 989 | 2.59375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from scipy import signal
import numpy as np
from scipy import signal
class DataTransform(object):
def __init__(self, data: np.array, sampling_frequency: int=10e3):
self.data = data
self.sampling... | true |
e09c63dfbb5358787edd98eca49dabf78da0805a | Python | shahbagdadi/py-algo-n-ds | /misc/ramdomWeights/Solution.py | UTF-8 | 537 | 3.515625 | 4 | [
"MIT"
] | permissive |
from typing import List
import random
import bisect
class Solution:
def __init__(self, w: List[int]):
self.weights , self.idx = [0], 0
for i in range(len(w)):
self.weights.append(self.weights[-1] + w[i])
def pickIndex(self) -> int:
rand = random.randint(1, self.weights[-1]... | true |
30d04e959d43715220b5cfdeead61b0dc528827b | Python | mnvx/neonka | /examples/network_example.py | UTF-8 | 1,028 | 2.78125 | 3 | [] | no_license | import numpy
from back_propagation.back_propagation import back_propagation
from network.layered import LayeredNetwork
from neuron.neuron import Neuron
def activation(x):
return max(x, 0)
def activation_derivative(x):
return 1 if x > 0 else 0
net = LayeredNetwork([3, 2, 1])
# print(net)
# Custom weights... | true |
88862d0ba97e5b4a97f67ab299e030b1b2156374 | Python | Elzei/show-off | /Python/Skrypty/Python - Szkolenie_11-2015/przyklady_rec_python/PythonExample/generator.py | UTF-8 | 281 | 3.328125 | 3 | [
"MIT"
] | permissive | def lamYield(x):
yield x
def dzielniki(liczba):
dzielnik = []
dzielnik = filter(lambda x: not liczba % x, range(2,liczba // 2 + 1))
dzielnik = dzielnik if len(dzielnik) else [0]
for i in dzielnik:
yield i
for i in dzielniki(35):
print i
| true |
751352b1b5dad5f730e4a716f8add63d8e58b512 | Python | stephentannersmith/flask_mysql | /semi_restful_users/server.py | UTF-8 | 2,737 | 2.859375 | 3 | [] | no_license | from flask import Flask, redirect, render_template, request
from mysqlconnection import connectToMySQL
app = Flask(__name__)
#renders template for web app
@app.route('/')
def index():
return render_template("add_user.html")
#route that saves user info to DB
@app.route('/add_user', methods=["POST"])
de... | true |
4cc45e2816c930eb04ce355ddf554dcd80e148e8 | Python | RobertKoehlmoos/threading_with_python | /problems_test.py | UTF-8 | 213 | 2.671875 | 3 | [] | no_license | from problems import chars_in_sonnets
def test_chars_in_sonnets():
num_chars = chars_in_sonnets()
assert num_chars == 94084, f"Expected 94084 total characters, but chars_in_sonnets returned {num_chars}"
| true |
bd521509848ef5bed73d321aa963fc61c495c16c | Python | onekr-billy/django-ordered-model | /tests/models.py | UTF-8 | 3,932 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | from django.db import models
from ordered_model.models import OrderedModel, OrderedModelBase
# test simple automatic ordering
class Item(OrderedModel):
name = models.CharField(max_length=100)
# test Answer.order_with_respect_to being a tuple
class Question(models.Model):
pass
class TestUser(models.Model)... | true |
2f893c54567519c4ef493bb43c5c0e76db5c9427 | Python | prayushtatke/python | /common_utils/utils/alerts.py | UTF-8 | 3,073 | 2.78125 | 3 | [] | no_license | from datetime import datetime
from os import getenv
from common_utils.utils.commons import is_not_empty
from json import dumps
from common_utils.utils.logger import Logger
ENABLE_ALERTS_HANDLING = getenv('ENABLE_ALERTS_HANDLING', False)
class AlertsHandler:
"""
Usage:
from utils.alerts import AlertsHandl... | true |
c3fc86ed84f500af2c2414a60447a219ce84bbb3 | Python | madman-bob/python-custom-imports | /custom_imports/file_module/ext_finder.py | UTF-8 | 1,288 | 2.8125 | 3 | [
"MIT"
] | permissive | import sys
from dataclasses import dataclass
from pathlib import Path
from types import ModuleType
from typing import Iterable, Optional
from custom_imports.importer import Finder
__all__ = ["FileModuleExtensionFinder"]
@dataclass(frozen=True)
class FileModuleExtensionFinder(Finder[Path]):
"""
Finder for fi... | true |
2511dbeba80d9772c3908ec9f4bc8ad8b687fa6b | Python | vinodbellamkonda06/myPython | /project/project@2.3.py | UTF-8 | 383 | 3.21875 | 3 | [] | no_license | print("largest palindrome number multiple of two 3 digit prime numbers")
pal=[]
for num in range(900,1000):
for num1 in range(900,1000):
k=num*num1
if k>10:
kstring=str(k)
if (kstring==kstring[::-1]):
h = num * num1
pal.append(h)
print(pal)
pri... | true |
822687dbf6ad285f5baeed123f1301c9dd51232f | Python | kousikr26/tgdh | /graph.py | UTF-8 | 2,103 | 2.984375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import make_interp_spline, BSpline
from scipy.interpolate import interp1d, InterpolatedUnivariateSpline
from scipy import arange, array, exp
import pickle
# 300 represents number of points to make between T.min and T.max
file=open("insertion_t... | true |
227acff9099d6e655732442ffbd6725bb136d0fe | Python | WaiLynnZaw/project_euler_python | /Problem15.py | UTF-8 | 288 | 3.84375 | 4 | [] | no_license | def number_combinations(n, k):
numberOfcombinations = factorial(n) / (factorial(k) * factorial(n - k))
return numberOfcombinations
def factorial(n):
factorialValue = 1
while n > 1:
factorialValue *= n
n -= 1
return factorialValue
print(number_combinations(40,20))
| true |
5ebcf38799522df125d5172de91190fb35699b07 | Python | wuxu1019/leetcode_sophia | /medium/twodimensionalarray/test_79_Word_Search.py | UTF-8 | 2,601 | 3.859375 | 4 | [] | no_license | """
Given a 2D board and a word, find if the word exists in the grid.
The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once.
Example:
board =
[
['A','B','C','E'],
['S','F... | true |
76b1a50305163aa560091b358e92250c58be4383 | Python | VBakhila/project-euler-python | /043.py | UTF-8 | 491 | 3.265625 | 3 | [] | no_license | from lib import num
def gen(nums, primes, pos=0, prefix=0):
if pos >= 4 and prefix % 10 ** 3 % primes[pos - 4] != 0:
return
if not nums:
yield prefix
return
for n in nums:
nums.remove(n)
yield from gen(nums, primes, pos + 1, 10 * prefix + n)
nums.add(n)
def main():
# trick: generate all permutation... | true |
f62c001f0f9626e0c8f151f9c348b76e248334d9 | Python | tadvepio/Object-Oriented-Programming | /Exercise8/Codefiles/flat.py | UTF-8 | 1,311 | 3.421875 | 3 | [] | no_license | # OOP exercise 8
# Author: Tapio Koskinen
# 8.3.2021
class Flat:
def __init__(self):
self.__floors = "Dirty"
self.__windows = "Dirty"
self.__surfaces = "Dirty"
self.__bed = "Unmade"
self.__toilet_paper = "Running out"
self.__fridge = "Empty"
def set_floors(s... | true |
64fd738e69b94071a3469065bc21815bffe16095 | Python | Javed-Akhtar/nlp-dl-prework | /The-Lego-Collector's-Dilemma/code.py | UTF-8 | 1,997 | 3.421875 | 3 | [
"MIT"
] | permissive | # --------------
import pandas as pd
import numpy as np
from sklearn.cross_validation import train_test_split
# code starts here
#Reading dataset
df = pd.read_csv(path)
#display
print(df.head())
#Storing all independent features in X
X = df.copy()
X.drop(['list_price'],axis=1,inplace=True)
#Storing target variable i... | true |
f076019cab85c1d7f8729a6eb7ef3276ce97155d | Python | LimonJohn/pythonProjectED | /Exercises_python/Phase_1/3.7.py | UTF-8 | 155 | 3.515625 | 4 | [] | no_license | # 3.7 Задача «Стоимость покупки»
a = int(input())
b = int(input())
n = int(input())
s = (a * 100 + b) * n
print(s // 100, s % 100)
| true |
8dea31956039f1c8903fea655df716a9eab69445 | Python | alysivji/talks | /data-science-workflows-using-docker-containers/workflow3-data-driven-app/plot_timeseries.py | UTF-8 | 1,922 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''Create live updating graph
'''
# standard library
from collections import namedtuple
import io
import os
# plot.ly modules
import dash
from dash.dependencies import Output, Event
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
TwoDPlot... | true |
3c2543578592eb60a4002907c3c7820875aa10ed | Python | videogamerm/mini.games | /riskTakr/main2.py | UTF-8 | 1,167 | 3.40625 | 3 | [
"CC0-1.0",
"MIT"
] | permissive | import random
import time
import os
def printnm():
os.system("./Time.out")
file = open("name.txt","r")
print("Hello " + file.read())
printnm()
play = input("Play y/n ")
def newround():
os.system("./main.out")
n = random.randint(1,100)
n1 = random.randint(1,100)
n2 = random.randint(... | true |
44364313190f32e076fd899ceabb9f0072b4b196 | Python | EBISPOT/ICBO2017 | /tools/simple_zooma_query.py | UTF-8 | 5,332 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | """
Takes a tsv file as input, with terms to be mapped in the first column
Generates a file called mapped_terms.tsv that has in the first column the term
that was mapped, and in the second column the ontology term mappings that Zooma found.
You can specify:
-confidence
HIGH, GOOD, o... | true |
ab0b2c5b6e413fd9aab3550f2fea60346d49f39b | Python | 44taka/matching | /batch/app/util.py | UTF-8 | 664 | 3.0625 | 3 | [] | no_license | import datetime
import slackweb
import config
def now():
"""
現在時刻取得
:return: 現在時刻
"""
return datetime.datetime.now()
def notify_slack(message=None):
"""
slack通知処理
url: https://github.com/satoshi03/slack-python-webhook
:param message: 通知メッセージ
:return:
"""
if message is... | true |
e5a858d44367f6eff642b4726cac5636df5c2a7d | Python | ak-lucas/trabalho1-IA | /regressao_logistica_regularizado.py | UTF-8 | 3,758 | 3.359375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import csv
from scipy.special import expit
# Hyperparameters:
# -Lambda: fator de regularização
# -learning_rate: taxa de aprendizado
# -epochs: número de iterações
class RegularizedLogisticRegression():
def __init__(self):
self.theta_n = []
self.theta_0 = 0.
self.los... | true |
4da74b20cf22a43ec59d27d80c68b455913a919a | Python | vaideheebhise/100DaysOfCode-1 | /Day026/Exercises/ex03.py | UTF-8 | 212 | 3.421875 | 3 | [] | no_license | with open('file1.txt') as file:
numbers1 = file.readlines()
with open('file2.txt') as file:
numbers2 = file.readlines()
result = [int(number) for number in numbers1 if number in numbers2]
print(result)
| true |
10520aa4e78499ffe3a9f35564982a28473d4550 | Python | yerassyldanay/leetcode | /pyland/solutions/word_and_pattern.py | UTF-8 | 1,096 | 3.359375 | 3 | [] | no_license | from typing import List
class Solution:
def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]:
def convert(word: str) -> List[int]:
p = {}
result = []
for letter in word:
a = p.setdefault(letter, len(p))
result.appen... | true |
2754bba0be4d841e9b71906a1f4af446eb6e05e8 | Python | PREMIEREHELL/Amulet-NBT | /amulet_nbt/amulet_nbt_py/nbt_types/numeric.py | UTF-8 | 4,329 | 2.65625 | 3 | [] | no_license | from __future__ import annotations
from abc import ABC
from typing import (
ClassVar,
BinaryIO,
Union,
)
from struct import Struct
import numpy as np
from amulet_nbt.amulet_nbt_py.const import SNBTType
from .value import BaseImmutableTag
class BaseNumericTag(BaseImmutableTag, ABC):
_value: np.numbe... | true |
fc05b1db7407cb11eead71ed6712b4207695c2c6 | Python | Leeyp/DHS-work | /practical 1/q5_upper_to_lower.py | UTF-8 | 167 | 3.546875 | 4 | [] | no_license | __author__ = 'dhs'
import string
uppercase = input("Write something in uppercase and I convert to lowercase for you")
lowercase = uppercase.lower()
print(lowercase) | true |
f364c32a98389661c64f81fafd1b9591d2a1e14e | Python | DmitryDruzhinin/pvo-lab | /exam/1.py | UTF-8 | 220 | 3.578125 | 4 | [] | no_license | import math
len = float(input("enter yarn length: "))
diam = float(input("enter yarn diameter: "))
vol = math.pi * math.pow(diam * 2, 2) * len
rad = math.sqrt(3 * vol / (4 * math.pi))
print("coil diameter: ", rad / 2) | true |
86539228573f570672bf141c39dd44fd41780a7c | Python | ceciliegl/LiquidCrystals | /plottingcodes/energycLL.py | UTF-8 | 894 | 2.75 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import os
import sys
def get_data(filename, variables):
df = pd.read_csv(filename,\
delim_whitespace=True, \
engine='python', \
names=variables)
return df
... | true |
533beaba56219bc50b3a97a24b1e6fc8f34745a1 | Python | Jeremy-Fang/LeetCode | /Prefix-sum/930better.py | UTF-8 | 546 | 2.625 | 3 | [] | no_license | class Solution:
def numSubarraysWithSum(self, A, S):
res = 0
ones = [-1] + [i for i in range(len(A)) if A[i] == 1] + [len(A)]
print(ones)
if S == 0:
for i in range(1, len(ones)):
z = ones[i] - ones[i-1] - 1
res += z*(z+1)/... | true |
a3e3ae7a1e4aa2bb2b6e975222622d4adc9789a4 | Python | ChloeAust/birds-project | /bird color filter.py | UTF-8 | 2,020 | 2.546875 | 3 | [] | no_license | birds = [
{'common_name': 'Grey Heron', 'latin_name': 'Ardea cinerea', 'size': 'large', 'main_colour': 'grey', 'secondary_colour_1': 'white', 'secondary_colour_2': 'black'},
{'common_name': 'Sparrowhawk', 'latin_name': 'Accipiter nisus', 'size': 'medium', 'main_colour': 'brown', 'secondary_colour_1': 'beige', '... | true |
0af3db954cf1eb9e3798daad1ff0c40b32e21317 | Python | ctyfang/vision_algorithms_eth | /Exercise 3 - Simple Keypoint Tracker/code/selectKeypoints.py | UTF-8 | 934 | 2.71875 | 3 | [] | no_license | import numpy as np
from scipy.signal import convolve2d
from copy import deepcopy
def selectKeypoints(scores, num, r):
"""% Selects the num best scores as keypoints and performs non-maximum
% supression of a (2r + 1)*(2r + 1) box around the current maximum.
Return keypoints in (row, col) format """... | true |
e76dd2e20e4fce5a6461e061437db348e234d958 | Python | solofruad/traffic-accidents | /model/classes/DatabaseToCSV.py | UTF-8 | 2,921 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 8 16:39:16 2019
@author: hat
"""
import pandas as pd
from datetime import timedelta
import re
class DatabaseToCSV:
def __init__(self):
self.df = pd.DataFrame()
self.dir_save = ''
def get_cursor(self,collection, st... | true |
26fec854f79aeecc676112eeae9f9fbe7a2e2775 | Python | johnjdailey/DS-Unit-3-Sprint-2-SQL-and-Databases | /module3-nosql-and-document-oriented-databases/mongo_prep.py | UTF-8 | 2,309 | 2.859375 | 3 | [
"MIT"
] | permissive | # mongo_prep.py
import os
import pymongo
from dotenv import load_dotenv
from datetime import datetime
load_dotenv()
DB_USER = os.getenv("MONGO_USER", default="OOPS")
DB_PASSWORD = os.getenv("MONGO_PASSWORD", default="OOPS")
CLUSTER_NAME = os.getenv("MONGO_CLUSTER_NAME", default="OOPS")
connection_uri = f"mongodb+... | true |
76f11d1dac89d88d624982134b7d696d492d7b20 | Python | HuipengXu/leetcode | /intToRoman.py | UTF-8 | 1,957 | 3.65625 | 4 | [] | no_license | # @Time : 2019/6/28 17:31
# @Author : Xu Huipeng
# @Blog : https://brycexxx.github.io/
class Solution:
def intToRoman(self, num: int) -> str:
res, p = [], 1
int_roman_map = {1: 'I', 4: 'IV', 5: 'V', 9: 'IX', 10: 'X',
40: 'XL', 50: 'L', 90: 'XC', 100: 'C', 400: 'CD',
... | true |
b485313ccebe4e62039cdc5cdbec2e2d0358ad00 | Python | sondongmin0419/study | /python/b_15650 N과M (2).py | UTF-8 | 233 | 2.71875 | 3 | [] | no_license | N, M = map(int, input().split())
def b_15650(n):
if len(li) == M:
print(*li)
if n>N:
return
for i in range(n,N+1):
li.append(i)
b_15650(i+1)
li.pop()
return
li = []
b_15650(1) | true |
1eda0ea0fa19ffd831251f332f86969a846d8bd6 | Python | dcsm8/Udemy-Python-Course | /9._Advanced_Built_in_Functions/class_119.py | UTF-8 | 211 | 3.9375 | 4 | [] | no_license | # Generators
def hundred_numbers():
i = 0
while i < 100:
yield i
i += 1
g = hundred_numbers()
print(next(g)) # 0
print(next(g)) # 1
print(next(g)) # 2
print(list(g)) # [3 - 99]
| true |
9f9139731c59918d4c30c1f4ff8152d2a1a88571 | Python | tfaieta/CoreML_test1 | /lists_arrays_tuples.py | UTF-8 | 587 | 4.09375 | 4 | [] | no_license | # Lists/Arrays
array = ['Tony', 'Faieta']
array[0] = 'Bob'
print (array[0] + " " + array[1])
groceryArray = ['eggs', 'milk', 'carton', 'juice', 'malk', 'chicken']
listSlice = groceryArray[3:5]
slice_up_to_three = groceryArray[:3]
slice_from_three_on = groceryArray [3:]
slice_second_from_last = groceryArray[-2]
print... | true |
b06036dbc5505e82fda13c98ca409c7c443de360 | Python | cesium12/solver-tools | /solvertools/regex.py | UTF-8 | 11,281 | 3.109375 | 3 | [] | no_license | """
Wacky tools for slicing and dicing regexes.
"""
from sre_parse import parse, CATEGORIES, SPECIAL_CHARS, SubPattern
from sre_constants import MAXREPEAT
UNKNOWN = u'/.*/'
INVALID = u'#'
REVERSE_CATEGORIES = {}
for key, value in CATEGORIES.items():
REVERSE_CATEGORIES[str(value)] = key
def is_regex(text):
""... | true |
86e90b2d56e654cf63fc4664cd0c5adcbd53f4ff | Python | derpston/fruitfly | /example/basic/mod_example.py | UTF-8 | 484 | 3.15625 | 3 | [
"WTFPL",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """
A basic fruitfly module. Sends an event once per second, and receives the same event.
"""
import fruitfly
class example(fruitfly.Module):
def init(self):
self.onesecond()
@fruitfly.repeat(1)
def onesecond(self):
self.logger.info("Sending an event")
self.send_event("foo.omg", [... | true |
e68ab169d2f558a21805b4101d90cb85957b57c0 | Python | M5FGN/CodeClanWork | /week_01/day_02/conditionals/ternary_operator.py | UTF-8 | 155 | 3.25 | 3 | [] | no_license | score = 3
# if score > 5:
# result = 'pass'
# else:
# result = 'fail'
# print(result)
result = "pass" if score > 5 else "fail"
print(result) | true |
ee9c25e84912ee87cec5694516bae1da926b266b | Python | pynbody/pynbody | /pynbody/family.py | UTF-8 | 2,974 | 3.15625 | 3 | [] | no_license | """
family
======
This module defines the Family class which represents
families of particles (e.g. dm, gas, star particles).
New Family objects are automatically registered so that
snapshots can use them in the normal syntax (snap.dm,
snap.star, etc).
In practice the easiest way to make use of the flexibility
this ... | true |
76ffc779c2b8a5d2a5a1f23b50a6075770c1a988 | Python | Ritvik19/CodeBook | /data/Algorithms/Graph Adjacency List.py | UTF-8 | 2,343 | 3.671875 | 4 | [] | no_license | class Vertex():
def __init__(self, node):
self.id = node
self.adjacent = {}
self.distance = float("inf")
self.visited = False
self.previous = None
def addNeighbour(self, neighbour, weight=0):
self.adjacent[neighbour] = weight
def getConnections(self)... | true |
0941a3ca53d0b08c36d0b0e06bb5c2d26aea80f2 | Python | PauliKarl/pktool | /tools/dataset/sdc/shipdet/hrsc/visBar.py | UTF-8 | 2,325 | 3.171875 | 3 | [] | no_license | #{'航母': 305, '军舰': 1403, '商船': 540, '船': 624, '潜艇': 104}
h = 305
j = 1403
s = 540
c = 624
q = 104
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
font = FontProperties(fname=r"C:\Windows\Fonts\simhei.ttf", size=14)
plt.bar(1, 305, label='graph 1')
plt.bar(2, 1403, label='graph 2... | true |
4b7716c9e80bbf48db092c72d2efde78a9ba1ba7 | Python | zubairabid/WikiSearchEngine-Mini | /20171076/wikitextparser.py | UTF-8 | 1,338 | 3.0625 | 3 | [] | no_license | import re
citematch = re.compile(r'{{[Cc]ite(.+?)}}')
def isComment(line):
return line.startswith('<!--')
def getCategory(line):
PREFIX_LENGTH = 11 # length of [[Category:
return line[PREFIX_LENGTH:-2] + ' '
def getCitations(line):
# if any <ref> in line, extract
# if any <cite> in line, extract
... | true |
f60a34ae5279501eb9338e241d87ed74c124bb82 | Python | Dinesh-Sivanandam/Data-Structures | /Merge Sort/mergesort-implementation.py | UTF-8 | 1,797 | 4.625 | 5 | [] | no_license | #function for merge sort
"""
we are using recursion for seperating the left and right values in the arrays for sorting
after seperating leeft and right values we are merging the two sorted list
"""
def merge_sort(arr):
#if len is less than or equal to 1 just returning the array
if len(arr) <= 1:
... | true |
48a969f9d715f9854c5831922f190bbfdc2c3ade | Python | AlexisGfly/python_stack | /python/fundamentals/For_Loop_Basic_II.py | UTF-8 | 4,099 | 4.40625 | 4 | [] | no_license | # For Loop Basic II
# 1. Tamaño grande: dada una lista, escriba una función que cambie
# todos los números positivos de la lista a "big".
# Ejemplo: biggie_size ([- 1, 3, 5, -5]) devuelve la misma lista,
# pero cuyos valores son ahora [-1, "big", "big", -5]
def biggie_size(a):
for i in range(len(a)):
if... | true |
ca6a89dc1a96bd4fe1e9edf819a927f36b3e7b20 | Python | JMU-CS354-S19/numpy-sentry-robo-boiz-1 | /scripts/sentry.py | UTF-8 | 1,813 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
"""
SentryBot lets us know if an intruder walks past.
Author:
Version:
"""
import rospy
from kobuki_msgs.msg import Sound
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import numpy as np
class SentryNode(object):
"""Monitor a vertical scan through the ... | true |
a2ff05ada6378df0f9c30ea9de83eddff2dce84d | Python | ervanalb/cesspool | /cesspool/downloadmanager.py | UTF-8 | 419 | 2.546875 | 3 | [] | no_license | class DownloadManager:
def __init__(self,downloaders=[]):
self.downloaders=downloaders
self.uid=0
def get_uid(self):
u=self.uid
self.uid+=1
return u
def instantiate(self,pool,type,args):
if 'pool' in args or 'uid' in args:
raise Exception('arg list cannot contain pool or uid')
uid=self.get_uid()
... | true |
417e0cee7e5df2b55e9cac2e306d2fe95058ae06 | Python | dborowy/pp1 | /10-SoftwareTesting/probne2.py | UTF-8 | 220 | 3.109375 | 3 | [] | no_license | class Miasto:
def __init__(self,name,population):
self.name = name
self.population = population
def __str__(self):
return f'{self.name} posiada populację o wielkości {self.population}'
| true |
3e5b8bf6bfcb1707b7fcdbb49aff9713601cfe9c | Python | glorysdj/BigDL | /python/chronos/src/bigdl/chronos/metric/forecast_metrics.py | UTF-8 | 4,048 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | true |
a3823a0644e6be45d63b0309f0a494461e74bd0b | Python | kuzovkov/geoservice_python | /doc/OSM/start_filter_nodes.py | UTF-8 | 1,149 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
#coding=utf-8
help1="""
Скрипт для для запуска скриптов проверки связности
графа дорожной сети преставленного как база SQLite.
Принимает имя каталога с файлами баз данных
"""
import os
import sys
import getopt
need_update = False
try:
optlist, args = getopt.getopt(sys.argv[1:],'sud:')... | true |
69919780a7dcb50f0223e64b021f46b7b1071c75 | Python | sudheesha93/Python_InClassExercise | /ICE3/Source/sortlist.py | UTF-8 | 134 | 3.28125 | 3 | [] | no_license | items=input("enter the words seperated by commas")
words=[word for word in items.split(",")]
print(",".join(sorted(list(set(words))))) | true |
3e80f9e0b3662fec5d93fa6a653e0779a89b9479 | Python | antares681/Python | /PythonFundamentals/REAL MIDEXAM RETAKE/Problem_3_x.py | UTF-8 | 1,199 | 3.46875 | 3 | [] | no_license | #SOLUTION 2
neighbrhd = [int(house) for house in input().split('@')]
cur_loc_idx = 0
neighbrhd_size = len(neighbrhd)
while True:
command = input().split(" ")
if command[0] == "Love!":
break
if command[0] == "Jump":
jump_length = int(command[1])
cur_loc_idx += jump_length
i... | true |
1c12a638df8502a025d96ea2fd65fedd390de788 | Python | srafanz/loto | /tiragesExistants.py | UTF-8 | 3,491 | 3.03125 | 3 | [] | no_license | # coding=UTF-8
from fonction import *
import os
###########################
## DEFINITIONS GENERALES ##
###########################
# Définition des différentes grilles
grilleChaud = []
grilleFroid = []
grilleHasard = []
grilleConstante = []
grilleFinale = []
# Définition des différents histogramme
histoBoules = CR... | true |
4eeab421a31099a831a438943c05d8a24a613333 | Python | alexfoglia1/PhysicsSimulations | /rocket/rocket.py | UTF-8 | 2,310 | 2.8125 | 3 | [] | no_license | from time import time, sleep
from math import log
SCREEN_WIDTH = 1200
import sys
if sys.version_info > (3, 0):
from tkinter import *
import tkinter.ttk as ttk
else:
from Tkinter import *
import ttk
from threading import Thread
callback_args = []
def mthread(positions, speeds, accs, env, dt_s):
... | true |
311a9e92d00635fe858ac1e4779b374182afcd24 | Python | Minitour/file_printer | /main.py | UTF-8 | 3,060 | 3.171875 | 3 | [
"MIT"
] | permissive | from six.moves import urllib
from subprocess import Popen
import os
import sys
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
# A test pdf to test printer
print_sample_url = 'http://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf'
print_sample_text = 'The quick brown fo... | true |
62b39ff6149c1f2eb9525f538608586c09997c0f | Python | Nmazil-Dev/Learning | /eels.py | UTF-8 | 2,174 | 4.34375 | 4 | [] | no_license | # This is a practice exercise for Codecademy on the Rock Paper Scissor Module
# this imports randomint from random
from random import randint
#This will define the options in a key for the computer and user to select [] for list
options = ["EELS", "ESCALATORS"]
# This index will provide the program with th... | true |
18aa31f3c22d6f46d2463756a18616a074014107 | Python | Luccifer/PythonCourseraHSE | /w03/e12.py | UTF-8 | 513 | 3.828125 | 4 | [
"Unlicense"
] | permissive | # Система линейных уравнений - 1
def system_of_linear_equations_1(a, b, c, d, e, f):
determinant = a*d - c*b
determinant_x = e*d - f*b
determinant_y = a*f - c*e
x = determinant_x / determinant
y = determinant_y / determinant
return x, y
if __name__ == '__main__':
a = float(input())
b... | true |
ca1f785583c2b3a37ba6caaadd549e5466681ae8 | Python | edsonw/myHogwild | /myHogwildsgd/src/test.py | UTF-8 | 2,146 | 3.09375 | 3 | [] | no_license | import unittest
from hogwildsgd import HogWildRegressor
import scipy.sparse
import numpy as np
class TestHogwild(unittest.TestCase):
"""
loadData:loadData form input/w8a.txt
test_work: set the parameters and test hogwildsgd! first fit the X,y then predict the X and caculate Accuracy
"""
def loa... | true |
b6b1b70d9cf6f2f7b2396449f939b737e9af6173 | Python | langenhagen/experiments-and-tutorials | /Python/attrs-hello/attrs-hello.py | UTF-8 | 780 | 3.46875 | 3 | [] | no_license | #!/usr/bin/env python
"""Showcase basic usage of the 3rd party library `attrs`.
@author: andreasl
@version: 2021-02-08
"""
import attr
@attr.s()
class MyAttrClass:
"""Similar to dataclass but with extra features."""
my_field = attr.ib()
my_other_field = attr.ib(default=None)
print("--- 1 simple usage ... | true |
584c3ba2500585e7b06a94a4d34f871a1c99e640 | Python | 981377660LMT/algorithm-study | /14_并查集/经典题/公因数并查集/1722. 执行交换操作后的最小汉明距离.py | UTF-8 | 1,297 | 3.671875 | 4 | [] | no_license | # https://leetcode.cn/problems/minimize-hamming-distance-after-swap-operations/
# 每个 allowedSwaps[i] = [ai, bi] 表示你可以交换数组 source 中下标为 ai 和 bi.
# 相同长度的两个数组 source 和 target 间的 汉明距离 是元素不同的下标数量.
# !在对数组 source 执行 任意 数量的交换操作后,返回 source 和 target 间的 最小汉明距离 。
# 1. 并查集获取帮派邻接表.
# 2. 计算每个连通块对应的source元素与target的交集.
fr... | true |
3f7f4312a4e72740b1918ae60b956747b407a748 | Python | c-yan/atcoder | /abc/abc048/abc048a.py | UTF-8 | 45 | 2.5625 | 3 | [
"MIT"
] | permissive | s = input().split()[1]
print('A%sC' % s[0])
| true |
99cc825753c58e2b8f91b3ea193662a04e6c8b88 | Python | giosermon/holberton-system_engineering-devops | /0x15-api/1-export_to_CSV.py | UTF-8 | 901 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python3
"""using a REST API, for a given employee ID, returns information about
his/her TODO list progress"""
import csv
import requests
from sys import argv
if __name__ == "__main__":
"""Your code should not be executed when imported"""
user_id = argv[1]
todos = requests.get(
"http:/... | true |
6fb009d0f94786ff5150d038028856d2859686ee | Python | ledinhtri97/machine-learning-python | /GradientDescent/GD_multi.py | UTF-8 | 3,200 | 3.296875 | 3 | [] | no_license | import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
matplotlib.rcParams['xtick.direction'] = 'out'
matplotlib.rcParams['ytick.direction'] = 'out'
# Define cost fundtion
def cost(w):
x = w[0]
... | true |
e98e70c0b5a0252535dd3399e699efb0f68e3106 | Python | Cprocc/Week_test | /DyP/动态子结构.py | UTF-8 | 457 | 3.125 | 3 | [] | no_license | s1 = 'AB12N3B4V5A6'
s2 = '123456AA'
m, n = len(s1), len(s2)
matrixR = [[0]*n for i in range(m)]
print(matrixR)
for i in range(0, m):
for j in range(0, n):
if i == 0 or j == 0:
matrixR[i][j] = 1 if (s1[i] == s2[j]) else 0
else:
matrixR[i][j] = max(matrixR[i-1][j-1] + 1, mat... | true |
65d903a8144f769617feb2144892e53252820838 | Python | abhishek0220/library-management | /Library/Models/publisher.py | UTF-8 | 1,089 | 2.640625 | 3 | [] | no_license | from Library import db
from sqlalchemy.orm import relationship
class PublisherModel(db.Model):
__tablename__ = "publishers"
p_id = db.Column(db.Integer, primary_key=True)
p_name = db.Column(db.String(120), nullable=False)
address = db.Column(db.String(120), nullable=False)
phone = db.Column(db.Stri... | true |
39949aed501ea632e00560aeb3dd3b1fb34b2ed8 | Python | Jarvis7923/raibert-hopper-sim | /src/sim.py | UTF-8 | 3,485 | 2.71875 | 3 | [] | no_license |
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.widgets import Slider, Button, RadioButtons
import numpy as np
from scipy.integrate import odeint
from enum import Enum
import threading
import time
from src.vis import vis
class msg_type(Enum):
error = 0
system = 1
... | true |
1d6bea3a4bf9a4cfb578739bf84c7386c845f937 | Python | joeyqlim/cs50 | /week7/houses/import.py | UTF-8 | 1,377 | 3.171875 | 3 | [] | no_license | from cs50 import SQL
from csv import DictReader
from sys import argv, exit
# Check command line args and file type
if len(argv) < 2:
print("Usage: python import.py characters.csv")
exit()
else:
if not (argv[1].endswith(".csv") or argv[1].endswith(".tsv")):
print("Usage: python import.py characters.... | true |
609075cc5f5e0f3955ffaeb2771594566092cd3a | Python | coloed3/loganalysis | /query.py | UTF-8 | 4,114 | 3.734375 | 4 | [] | no_license | #!/usr/bin/env python3
import psycopg2 # needed to create connection to database
import pprint
"""https://docs.python.org/3/library/pprint.html
allows to format the
object we are printing"""
"""
3 queries
1. What are the most popular three articles of all time?
2. Who are the most popular article authors of all ti... | true |
05545bbb6bfa793133f12dc5d7d0c21475a0ab52 | Python | whyando/lol-train | /train.py | UTF-8 | 672 | 3.078125 | 3 | [] | no_license | import numpy
from sklearn.linear_model import LogisticRegression
file = numpy.loadtxt('input_full.txt', delimiter=',')
X = file[:,1:]
y = file[:,0]
# print(X)
# print(y)
print('Begin Train')
clf = LogisticRegression(random_state=3, solver='sag', max_iter=10000).fit(X, y)
print('End Train')
# print(X[:2])
# print(y... | true |
cffe9b6af71f10a35a9fc160588518e82fdd7e10 | Python | jingchenw/Procura-to-ClientCare | /Procura_to_ClientCare_WithMiddleFile_WithoutAutoPushToResiAdmin.py | UTF-8 | 5,499 | 2.609375 | 3 | [] | no_license | import csv
import time
import sys
import shutil
import openpyxl
import os
from operator import itemgetter
# Prompt to type in file directory
print 'Welcome!\n'
print 'Please confirm the raw data files have been put in the "input_files" folder.(Press Enter to continue)\n'
sys.stdin.readline()
# Open and read ServiceTy... | true |
37b38ce4378af68857054ace3e3b48c1e3e74470 | Python | AlexNedyalkov/Python-OOP-2020 | /polymorphism_06/exercises/groups_02.py | UTF-8 | 1,764 | 4.5 | 4 | [] | no_license | '''
Create a class called Person. Upon initialization it will receive a name (str) and a surname (str).
Create another class called Group. Upon initialization it should receive a name (str) and people (list of Person instances).
Implement the needed magic methods, so the test code below works
'''
class Person:
def... | true |
ebbe1a4277a3336ad580c1c7614e79c9d758a25d | Python | jackyluo-learning/NAS_test | /abc_tutorials/abc_base.py | UTF-8 | 563 | 2.765625 | 3 | [] | no_license | import abc
import tensorflow as tf
class PluginBase(object, metaclass=abc.ABCMeta):
# metaclass: the stuff that creates classes.
@abc.abstractmethod
def load(self, input):
"""Retrieve data from the input source and return an object."""
return
@abc.abstractmethod
def save(self, out... | true |
1efe81c4b1bf76b7f5540666611d78ad12793649 | Python | Hi5Austin/SimpleMovieSearcher | /app.py | UTF-8 | 836 | 2.53125 | 3 | [] | no_license | from flask import Flask
from flask import render_template
import requests
import json
app = Flask(__name__)
app.config["DEBUG"] = True
apiURL = "http://www.omdbapi.com/?"
@app.route("/")
def start():
return render_template('hello.html')
@app.route("/movie/<title>")
def get_movie(title):
parameters = {'t':tit... | true |