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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
bc425304220cb8afee1bde8aa4411ab6539ebc38 | Python | arpithappu/python | /assignment1/q2.py | UTF-8 | 125 | 3.859375 | 4 | [] | no_license | n=int(input("enter a number:"))
sum=0
if n>0:
for i in range(1,n+1):
sum+=1/i
print(f"result is{sum}") | true |
698a80bbc03176ef88c880403a83f205f6da142f | Python | christinekost/python_course | /fibonacci.py | UTF-8 | 180 | 3.46875 | 3 | [] | no_license | a, b = 1, 1
while b < 10**7:
a, b = b, a + b
print(b)
a, b = 1, 1
while len(str(b)) < 1000:
a, b = b, a + b
print(b)
a, b = 1, 1
while b < 10**999:
a, b = b, a + b
print(b) | true |
cf9870d990bfe9b036f78cab7b8e4b548f9ea8c2 | Python | RoPP/pytest-flake8dir | /tests/test_pytest_flake8dir.py | UTF-8 | 2,608 | 2.671875 | 3 | [
"ISC"
] | permissive | import flake8
import pytest
def test_make_py_files_single(flake8dir):
flake8dir.make_py_files(
example="""
x = 1
"""
)
result = flake8dir.run_flake8()
assert result.out_lines == [
"./example.py:1:2: E221 multiple spaces before operator"
]
assert result.exit_code ==... | true |
03b111f19e27c12e1ea4171e2a4427f431a9e492 | Python | muralisc/pycrawler | /server.py | UTF-8 | 709 | 2.75 | 3 | [] | no_license | #!/bin/python
import crawler
from flask import Flask, jsonify, request
import logging
import json
log_level = logging.DEBUG
logging.basicConfig(level=log_level)
logger = logging.getLogger(__name__)
app = Flask(__name__)
@app.route('/crawl', methods = ['POST'])
def hello_world():
url = request.form['url']
de... | true |
254a043fe09885d3d52db3ab3b81bdf5b79a5cb6 | Python | nandodelezo/python | /practica6/p6e5.py | UTF-8 | 991 | 4.59375 | 5 | [] | no_license | ##Escribe un programa que te pida números cada vez más grandes y que se guarden en una lista.
##Para acabar de escribir los números, escribe un número que no sea mayor que el anterior. El programa termina escribiendo la lista de números:
##Escribe un número: 6
##Escribe un número mayor que 6: 10
##Escribe un número may... | true |
d60ab20ee7751ef5dfc0397da91e682c8def9601 | Python | sucre03/python | /io/github/sucre/junior/study-20160623.py | UTF-8 | 810 | 4 | 4 | [] | no_license | #20160623
###python2和python3的区别,在print上2没有(),而3有()
print('hello,world')
##一个逗号代表一个空格
print('hello world','do you like scala','yes but i like python better')
print('The quick brown fox', 'jumps over', 'the lazy dog')
print(333)
print(111+222)
name=input('please enter your name:')
print('hello',name)
print('1024*768=',10... | true |
4ca45155c02b6172ced2a30d10da64ce55db2f61 | Python | tooringanalytics/libpycontainerize | /src/pycontainerize/containerize.py | UTF-8 | 5,616 | 2.609375 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
'''
Containerize
Create a docker-compose file from a web service specification.
'''
import argparse
import os
import sys
import six
from pycontainerize.constants import DEFAULT_OUTPUT_DIR
from pycontainerize.constants import DEFAULT_PROJECTS_DIR
from pycontainerize.constants import DEFAULT_TEMP... | true |
d8e3424312935ee7658293feb3b010b818f9f9e6 | Python | arifcahya/introduction | /KaushalSoni 21BCON368 4rd file.py | UTF-8 | 435 | 3.84375 | 4 | [] | no_license | # This program is used to identify the profit and loss on the particular item
n=int(input("Enter no. of Items:"))
t=0
S=0
K=0
for i in range (0,n):
c=int(input("Enter Cost Price of Item:"))
s=int(input("Enter Selling Price of Item:"))
t+=c
S+=s
print ('Total Cost Price is:',t)
print ('Total Selling Pric... | true |
cfe0fec8e78ff3aafce92bc5d7d267a5ef8704b2 | Python | marijnkoolen/fuzzy-search | /fuzzy_search/phrase/phrase.py | UTF-8 | 9,868 | 2.71875 | 3 | [
"MIT"
] | permissive | import re
from collections import defaultdict, Counter
from typing import Dict, List, Set, Union
from fuzzy_search.tokenization.string import SkipGram, text2skipgrams
from fuzzy_search.tokenization.token import Token
from fuzzy_search.tokenization.token import Tokenizer
def is_valid_label(label: Union[str, List[str]... | true |
1c6112a86918f09080933471ac507c2384a4b176 | Python | songye38/Computing-Form-and-Shape | /Session2/src/session2_example7.py | UTF-8 | 478 | 3.015625 | 3 | [] | no_license | #session2 - 6
#nesting loops to create many curves with random values
import rhinoscriptsyntax as rs
import random
#we can establish 10 curves
for c in range(3):
#we have to create list to append point
listOfPoints = []
for q in range(50):
v1 = random.uniform(-100,100)
v2 = random.uniform... | true |
29bd23f1c053fc6ceaa24b036f76aee1c2e44263 | Python | junyechen/PAT-Advanced-Level-Practice | /1058 A+B in Hogwarts.py | UTF-8 | 1,304 | 4.03125 | 4 | [] | no_license | """
If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid explained it to Harry, "Seventeen silver Sickles to a Galleon and twenty-nine Knuts to a Sickle, it's easy enough." Your job is to write a program to compute A+B where A and B are given in the standard form ... | true |
3a11cdedfd58ab4fd5e49c9c59388f2a797a6521 | Python | sachinraut11/PyCharm | /method of override.py | UTF-8 | 554 | 4.53125 | 5 | [] | no_license | # Python program to demonstrate
# method overriding
# Defining parent class
class Parent():
# Constructor
def __init__(self):
self.value = "Inside Parent"
# Parent's show method
def show(self):
print(self.value)
# Defining child class
class Child(Parent):
# ... | true |
b9e39b64d0f457ffa25233d9f271068f7d09b442 | Python | conorgpower/DataMining_Lab1 | /sqlData.py | UTF-8 | 2,661 | 3.5 | 4 | [] | no_license | import pandas as pd
import numpy as np
import pymysql
# STEP 6
# Q. Now your mysql installation contains BSCY4 database that contains 1 table,
# AVOCADO. Use pymysql module to import contents of the table via pandas.
# A.
connection = pymysql.connect(host='127.0.0.1', user='root', password ='', db='BSCY4')
d... | true |
751e767f489023cab5f939e61f7862192267a821 | Python | cjsmith33/CIS554-Controlling-Prog-Flow | /Using Conditional Statements/Exercise6/test.py | UTF-8 | 2,554 | 3.609375 | 4 | [] | no_license | """
A completed test script for the Pig Latin module.
Author: Charles Smith
Date: 01 January 2021
"""
import funcs
import introcs
def test_first_vowel():
"""
Test procedure for the function first_vowel()
"""
print('Testing first_vowel()')
# No vowels
result = funcs.first_vowel('grrm')
int... | true |
728c34ff067a2ad7384d8d76076412bf8a6409c9 | Python | douglask3/GDAY | /src/bewdy.py | UTF-8 | 13,755 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
""" Photosynthesis model """
import sys
import datetime
from math import fabs, exp, sqrt, sin, pi, log
import constants as const
from utilities import float_eq, float_lt, float_le, float_gt, day_length
__author__ = "Martin De Kauwe"
__version__ = "1.0 (08.03.2011)"
__email__ = "mdekauwe@gmail... | true |
6956d2d5f0bde821eb05ef676c018bd4cfa46501 | Python | luke28/NENIF | /script/sort_cascades.py | UTF-8 | 550 | 2.9375 | 3 | [] | no_license | import os
import sys
a = []
with open('../data/cascades256.txt', "r") as f:
for line in f:
line = line.strip();
if len(line) == 0:
continue
nums = line.split(",")
b = []
for i in xrange(0, len(nums), 2):
b.append((int(nums[i]), float(nums[i+1])))
... | true |
6615082ba8b078ed0b9fd89bb35d17ef1abe74a7 | Python | ChaitanyaCixLive/Keras_Examples | /AntiRectifier/antirectifier.py | UTF-8 | 3,687 | 3.390625 | 3 | [] | no_license | '''The example demonstrates how to write custom layers for Keras.
We build a custom activation layer called 'Antirectifier',
which modifies the shape of the tensor that passes through it.
We need to specify two methods: `compute_output_shape` and `call`.
Note that the same result can also be achieved via a Lambda lay... | true |
1e03d876a69ec669032e20af663aa27c0ac551cd | Python | yujianzhang7/COEN296_fall2018 | /helper.py | UTF-8 | 2,722 | 2.859375 | 3 | [] | no_license | #! /usr/bin/env python3
#-*- coding:utf-8 -*-
from paths import raw_dir, sxhy_path, check_uptodate
from singleton import Singleton
import jieba
import os
_rawsxhy_path = os.path.join(raw_dir, 'shixuehanying.txt')
def _gen_sxhy_dict():
print("Parsing shixuehanying dictionary ...")
words = set()
with ope... | true |
0f550115b7e9b9efff3363c53bfb71178c151023 | Python | scortier/Leetcode-Submissions | /problems/diagonal_traverse/solution.py | UTF-8 | 895 | 3.71875 | 4 | [] | no_license | class Solution:
def findDiagonalOrder(self, matrix: List[List[int]]) -> List[int]:
"""
:type matrix: List[List[int]]
:rtype: List[int]
"""
# check empty matrix
if not matrix or not matrix[0]:
return []
# Store length and width of the matrix
... | true |
ef562e67b9330247e7e57720d77a3300ff70a6f3 | Python | seckalou/MLAlgorithms | /mla/knn.py | UTF-8 | 1,608 | 3.234375 | 3 | [
"MIT"
] | permissive | from collections import Counter
import numpy as np
from scipy.spatial.distance import euclidean
from mla.base import BaseEstimator
class KNN(BaseEstimator):
def __init__(self, k=5, distance_func=euclidean):
"""Nearest neighbors classifier.
Note: if there is a tie for the most common label amon... | true |
2612b2a6868a58ba25550b83cee6f7b89999409e | Python | patrotom/combinatorial-optimization-problems | /sat/lib/genetic.py | UTF-8 | 5,317 | 2.734375 | 3 | [
"MIT"
] | permissive | import copy
import random
import numpy as np
from timeit import default_timer as timer
from sat.lib.solution import Solution
class Genetic:
def __init__(self, inst, opts):
self.inst = inst
self.opts = opts
self.sol = Solution(inst.vars_num)
def run(self):
start = timer()
... | true |
c3db857b0d6e01017d7246cf4234b9dcdea9ddd2 | Python | cktan/gppg | /gppg.py | UTF-8 | 5,495 | 2.5625 | 3 | [] | no_license | import sys, os, csv, subprocess
from StringIO import StringIO
# -----------------------------------------------------
def _pr(prefix, s):
for line in s.split('\n'):
print prefix,line
pr = lambda prefix, s: _pr(prefix, s)
def pr_inf(s): pr('inf', s)
def pr_dst(s): pr('dst', s)
def pr_src(s): pr('src', s)
... | true |
d5a8f8cc26cfa1ec6828494d94ccb906791fec45 | Python | ariesunique/FSND | /projects/02_trivia_api/starter/backend/test_flaskr.py | UTF-8 | 3,670 | 2.953125 | 3 | [] | no_license | import os
import unittest
import json
from flask_sqlalchemy import SQLAlchemy
from flaskr import create_app
from models import setup_db, Question, Category
class TriviaTestCase(unittest.TestCase):
"""This class represents the trivia test case"""
def setUp(self):
"""Define test variables and initiali... | true |
02d8ae1626206abb04de31ac537cc88ad0d99a79 | Python | davimi/mountaincar-rl | /src/main/model_visualization.py | UTF-8 | 1,687 | 2.765625 | 3 | [] | no_license | from mountaincar import *
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
import pandas as pd
import seaborn as sns
def show_3D_plot():
plt.clf()
fig = plt.figure()
ax = Axes3D(fig)
ax.plot_surface(xs, ys, zs, rstride=1, cstride=1, cmap=cm.viridis)
... | true |
92125a95cee8bda6318d20c7b77aaa6a01ef8691 | Python | richardgmcmahon/astropy_examples | /votable_example.py | UTF-8 | 3,856 | 2.546875 | 3 | [] | no_license | from __future__ import (absolute_import, division, print_function,
unicode_literals)
"""
Example table i/o for votable with timing comparison
"""
import os
import sys
import time
import numpy as np
t0 = time.time()
import astropy
print('Elapsed time(secs):', time.time() - t0)
print()
print(... | true |
a52763d507b12c92dfe020da1492f2282ecff0de | Python | llhbum/Problem-Solving_Python | /BaekJoon/1193.py | UTF-8 | 203 | 3.3125 | 3 | [] | no_license | N = int(input())
cnt=1
while True:
if N>cnt:
N = N - cnt
cnt += 1
else:
break
if cnt % 2 == 0:
print(f'{N}/{cnt - (N - 1)}')
else:
print(f'{cnt - (N - 1)}/{N}')
| true |
fa3d55516e37d5a23f05c084de90e7674a14bb01 | Python | Azure/azure-sdk-for-python | /sdk/anomalydetector/azure-ai-anomalydetector/azure/ai/anomalydetector/_model_base.py | UTF-8 | 23,846 | 2.625 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT",
"LGPL-2.1-or-later"
] | permissive | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------------------------------------------... | true |
2f2b9b20b9114e686cfe821da0b3406ace28f438 | Python | CrazyEzh/KnightInDungeon | /MapFactory.py | UTF-8 | 14,594 | 2.53125 | 3 | [] | no_license | class MapFactory(yaml.YAMLObject):
@classmethod
def from_yaml(cls, loader, node):
_map = cls.create_map()
_obj = cls.create_object()
return {'map': _map, 'obj': _obj}
@classmethod
def create_map(cls):
return cls.Map()
@classmethod
def create_object(cls):
... | true |
1e5160511a1bed4d3e78b04d0d8e9f2e03b07305 | Python | anuj-nair/DSA | /Recursion/lenString.py | UTF-8 | 227 | 2.9375 | 3 | [] | no_license | from trace_recursion import trace
def str_len(n):
if not n:
return 0
return 1 + str_len(n[1:])
str_len = trace(str_len)
print(str_len("Thomas"))
print(str_len("Ramu"))
print(str_len("ShivaRamaKrishnaIyer"))
| true |
b4e249f3437f82225b56aa9ac5f6cc9d88f1b17f | Python | anamariadem/University | /Semester 1/FP/Assignment 10/Obstruction/tests/test_board.py | UTF-8 | 1,245 | 3.390625 | 3 | [] | no_license | import unittest
from Obstruction.domain.board import *
class test_board(unittest.TestCase):
def test_create_board (self):
b = Board(2,3)
self.assertEqual(b.rows, 2)
self.assertEqual(b.columns, 3)
def test_move (self):
b = Board(2,3)
b.move(1,1,"X")
b.move(0,0,"o... | true |
57f062d9e174d0c4518c2815ef780b0093b87c81 | Python | FRmathieu13/Homework_s3-4 | /homework.py | UTF-8 | 324 | 3.6875 | 4 | [] | no_license | prompt = 'what is your name'
name = input(prompt)
print("hello "+name)
prompt = 'give the 1st nbr'
a = input(prompt)
a = int(a)
prompt = 'give the 2nd nbr'
b = input(prompt)
b = int(b)
print(int(a/b))
prompt = "give ma the radius of a circle to get the surface"
r = input(prompt)
r = int(r)
import math
print(math.pi*... | true |
e8066b4bff504ef4da79c63811cc1e2db351142f | Python | kmzn128/atcoder | /b169/a.py | UTF-8 | 90 | 3.140625 | 3 | [] | no_license | A, B = map(int, input().split())
def Main(A, B):
return A*B
print(Main(A, B))
| true |
a89fe23ed90039796019b23b53a5f6a4b4ed04cf | Python | mingzidouzhemenanqi/Getting-started-with-python-code | /Files from MOOC/Python实例/第一期MOOC实例/实例四:简易文本进度条/简易文本进度条刷新模拟.py | UTF-8 | 214 | 3.234375 | 3 | [] | no_license | #简易文本进度条刷新模拟
import time as t
jindu=10
for i in range(jindu+1):
a=i*'*'
b=(jindu-i)*'.'
c=i*10
print("\r{:^3.0f}%[{}->{}]".format(c,a,b),end=" ")
t.sleep(1)
| true |
08fc8f42e3ed4b052c658b720e26eef092f31e64 | Python | leer752/battleship | /code/g_func/menus.py | UTF-8 | 3,962 | 2.9375 | 3 | [] | no_license | from foundation import init_screen
from g_func import g_var, draw_grids
from during_game import scores
import pygame
# Main menu before game starts that prompts player to either begin or quit; calls the Main function
def main_menu():
init_screen.screen.fill(g_var.blue)
text = g_var.title_font.rende... | true |
e2785a00953e02ff0d9955fac61805cb3736ae91 | Python | hhsalik/staj | /02-19-Cuma/forLoop.py | UTF-8 | 368 | 4.1875 | 4 | [
"MIT"
] | permissive | # for loops
# for letter in "Cihat Salik":
# print(letter)
friends = ["Hasan", "Mahmut", "Ali", "Veli"]
for friend in friends:
print(friend)
for index in range(3, 10):
print(index)
for index in range(len(friends)):
print(friends[index])
for index in range(5):
if index == 0:
print("Fi... | true |
e5c65dab0dc1e60df083facd5a398a92a2dfb064 | Python | xiangys0134/python_study | /new-day02/07.对象/05.反射.py | UTF-8 | 623 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
class daliu:
def __init__(self):
pass
def chi(self):
print("大牛一顿吃100个螃蟹")
def he(self):
print("大牛一顿喝100频可乐")
def la(self):
print("大牛不用拉")
def shui(self):
print("大牛一次睡一年")
def country(self):
print('国... | true |
7467219300bb562fb9a58a2effcb9918658add8e | Python | csdnak/McPython | /hodnik_01.py | UTF-8 | 2,972 | 2.609375 | 3 | [] | no_license | #ispred lika hodnik
import time
from crtanje import * #tu je funkcija koju zovem
from mc import * #import api-ja
mc = Minecraft() #inicijalizacija sustava za rad sa Minecraftom
def hodnik_01 ( orMj , orSm , iX=0 , iZ=0 , iY=0 , duzina= 3 , materijal = 98, dv = 0 , stepenice_mat = 109 ):
"""
ispred lika sob... | true |
9cb113467af50042d77157f6e1898aa703661431 | Python | akhramshaik/Machine-Learning | /My Notes/Visualization/EDA_Univariate.py | UTF-8 | 801 | 3.203125 | 3 | [] | no_license | import pandas as pd
import seaborn as sns
titanic_train = pd.read_csv('C:/Users/akhram/Desktop/AIML/Machine Learning/Problems/Titanic/train.csv')
#This is sort of plot using Pandas
pd.crosstab(index=titanic_train["Survived"], columns="count")
#The below are actual plots using sns
sns.countplot(x='Survived',data=tita... | true |
839668ae55d89b0dfaccb339e21a24d0d794cf53 | Python | acererak/convex-hull | /TurtleCanvas.py | UTF-8 | 4,032 | 3.140625 | 3 | [] | no_license | from math import sin,cos
from tkinter import *
from Turtle import Turtle, Position2D, Segment2D
class TurtleCanvas(Frame):
def draw_grid(self):
graph_paper_bg = '#c0d0a0'
graph_paper_fg = '#80b060'
major_grid_lines = 8 # this needs to be even
minor_grid_lines = 5
grid_lines = major_grid_lines ... | true |
7901e6fc860715ed93f422dfe921081a3cbf9cf9 | Python | gowth6m/zombie-maze | /settings.py | UTF-8 | 1,354 | 2.65625 | 3 | [] | no_license | # IMPORTS AND FILES
import pygame as pg
import math
from random import choice
pg.init()
pg.font.init()
vec = pg.math.Vector2
# COLOURS
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
DARKGREY = (40, 40, 40)
LIGHTGREY = (100, 100, 100)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
YELLOW = (255, 255, 0)
# GAME SETTINGS
TITLE = 'Zo... | true |
0e1943f715a4204b150dda06654a72db8b225dff | Python | YuzhiSun/CompetitionLearn | /Hand_on_Books/topic1/data_explore2.py | UTF-8 | 9,256 | 2.75 | 3 | [] | no_license | from scipy import stats
from sklearn.linear_model import Ridge
from sklearn.metrics import mean_squared_error
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import warnings
warnings.filterwarnings("ignore")
train_data_file = "D:\\project\\TianChi\\data\\zhengqi_train.txt"... | true |
a43c0c449b387ba5d0ee2e84b7d8082e7781d9aa | Python | SungFeng-Huang/SSL-pretraining-separation | /local/librimix/create_local_metadata.py | UTF-8 | 1,682 | 2.546875 | 3 | [] | no_license | import os
import shutil
import argparse
from glob import glob
import pandas as pd
# Command line arguments
parser = argparse.ArgumentParser()
parser.add_argument(
"--librimix_dir", type=str, default=None, help="Path to librispeech root directory"
)
parser.add_argument(
"--metadata_old_root", type=str, default=... | true |
c1f24ee212d6cd6f56928b298cc05d5c65b6d6ab | Python | kellyhennigan/cueexp_scripts | /preproc_func.py | UTF-8 | 9,187 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python
# filename: preproc_func.py
# script to do pre-processing of functional data. Does the following:
# 1) drops first X volumes from each scan run
# 2) slice time correction
# 3) pulls out a functional reference volume from the 1st run for each task
# 4) motion correct to task functional reference vo... | true |
9651ca498f7074efad0084e6e7020919db291b41 | Python | ruanyangry/web-scraping-with-python-book-scripts | /ch03/3.2.1.3.py | UTF-8 | 2,167 | 2.796875 | 3 | [] | no_license | # _*_ coding: utf-8 _*_
from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
import datetime
import random
pages=set()
random.seed(datetime.datetime.now())
# get page internal links list
def getInternalLinks(bsObj,includeUrl):
internalLinks=[]
for link in bsObj.findAll("a",href=... | true |
d299134c6d020126e2b8fcc0ec8e5f0c382d6f07 | Python | elliotmoose/2SatSolver | /main.py | UTF-8 | 286 | 2.640625 | 3 | [] | no_license | import basic.cnfgraph as cnfgraph
import basic.parser as parser
clauses = parser.parse_cnf_file_to_clauses(parser.INPUT_FILE_PATH)
edges = cnfgraph.edges_from_clauses(clauses)
nodes = cnfgraph.graph_nodes_from_edges(edges)
print(", \n".join(str(node) for node in nodes.values()))
| true |
42476868a596397efe556d2367d80d79e8e2297b | Python | wunnox/python_grundlagen | /stadtlauf_bern_oo_modul.py | UTF-8 | 4,886 | 3.046875 | 3 | [] | no_license | #! env python3
##############################################
#
# Name: stadtlauf_bern_oo_modul.py
#
# Author: Peter Christen
#
# Version: 1.0
#
# Date: 10.09.2022
#
# Purpose: Modul zu Script Stadtlauf_Bern_OO.py
#
##############################################
#Module
import pygame
#Initialisierung
pygame.init()
py... | true |
ac81587b2a5a420aed9de25ee9485bc5f6392f8d | Python | simonbrahan/adventofcode | /2015/15/15_1.py | UTF-8 | 1,704 | 3.359375 | 3 | [] | no_license | import re
def get_cmd(line):
pattern = re.compile('(\w+): capacity (-?\d+), durability (-?\d+), flavor (-?\d+), texture (-?\d+), calories (-?\d+)')
res = re.search(pattern, line)
return {
'name': res.group(1),
'capacity': int(res.group(2)),
'durability': int(res.group(3)),
... | true |
b1a7791f802362e7de3dfb0bac6b56aebcc43a24 | Python | anachronic/tarea1-seguridad | /mac.py | UTF-8 | 1,919 | 3.21875 | 3 | [] | no_license | #!/usr/bin/python
import sys
import os
from parser import parsear_input
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives import hashes, padding
from cryptography.hazmat.backends import default_backend
def usage():
print("usage")
print("mac -g <... | true |
81904127481ed6cf633dc4a1ab61d1ddf611f03c | Python | codingant007/fuzzy-fiesta | /makeMetadata.py | UTF-8 | 4,900 | 2.796875 | 3 | [] | no_license | # Standalone script for generating pickle file of metadata
# Generates alldata.pkl, train.pkl, val.pkl, test.pkl
# Generates alldata_group.pkl, train_group.pkl, val_group.pkl, test_group.pkl
# usage - makeMetadata.py <dataset path>
import six.moves.cPickle as pickle
import os,sys
from os.path import isfile, join
impo... | true |
0d2b34b01f1e226835682a12126aff2b01844aec | Python | Orangeman1226/ProbabilityRobotics | /CameraCs.py | UTF-8 | 12,904 | 2.625 | 3 | [] | no_license | import math
import numpy as np
from scipy.stats import expon , norm ,uniform
import IdealCameraCs as ICamera
from enum import Enum
import OccSensorNoisemarkCs as OccSensNisemark
import WorldCs as wo
from enum import Enum
class KindofObsEventNoise(Enum):
noEvent ="-"
phantom = "p"
oversight = "o"
occu... | true |
cc770d9a51f95c4a9dc7dc74e3b2bfd8819a9478 | Python | nmounzih/weather-report | /weather.py | UTF-8 | 524 | 2.78125 | 3 | [] | no_license | import requests
from weather_classes import Current_conditions, Sunrise_set, Hurricane, Alert, TenDay
def main():
zipcode = input("Enter zipcode: ")
r = requests.get('http://api.wunderground.com/api/b042b9ca2dcb4435/alerts/currenthurricane/forecast10day/astronomy/conditions/q/{}.json'.format(zipcode))
rep... | true |
ee1e7c26e26ee612511da1f5168352969a89f0dc | Python | pauleveritt/wired_injector | /examples/protocols/simple_protocols/__init__.py | UTF-8 | 808 | 2.75 | 3 | [
"MIT"
] | permissive | from typing import Tuple, Mapping, List
from .models import (
FrenchCustomer,
FrenchGreeter,
RegularCustomer,
RegularGreeter,
)
from .protocols import Customer, Greeter
def test() -> Tuple[List[str], List[str]]:
customers: Tuple[Customer, ...] = (
RegularCustomer(), FrenchCustomer(),
... | true |
b17f7ed4ccba88b15de9d32f72ab1f629a043887 | Python | 173647085/practice | /homework7/7_3.py | UTF-8 | 1,354 | 2.953125 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
'''
@File : 7_2.py
@Time : 2020/04/25 17:52:36
@Author : zxl
@Version : 1.0
@Contact : 173647085@qq.com
3给定一个网址(包含了优质的英语学习音频文件),http://www.listeningexpress.com/studioclassroom/ad/; 请大家写一个爬虫,将里面的英语节目MP3,都下载下来;
要求大家使用Requests库获取这个网页html文本内容,并且使用正则表达式获取里面所有的mp3文件的网址;并进行下载;
#Windows上的wget可以点击这里... | true |
3cb89939bc3f0acc301fd69c2cf869e02f9626c5 | Python | TodimuJ/Python | /mnist_number.py | UTF-8 | 1,801 | 3.109375 | 3 | [] | no_license | import numpy as np
import mnist
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Dense
from keras.utils import to_categorical
train_images = mnist.train_images() #training data images
train_labels = mnist.train_labels() #training data labels
test_images = mnist.... | true |
68250738c7b915911ed3720e0a26b568d2049d9f | Python | benjdj6/Hackerrank | /ProjectEuler/13-LargeSum.py | UTF-8 | 181 | 3.109375 | 3 | [] | no_license | # Enter your code here. Read input from STDIN. Print output to STDOUT
n = int(raw_input())
sum = 0
for i in range(n):
sum += int(raw_input())
print ''.join(list(str(sum))[0:10]) | true |
839d79968a352465c30653655da698d9e115abf0 | Python | valerydec17/learn-it | /Learn/Scrapper-2/tutsplus/tutsplus/spiders/myyoutspider.py | UTF-8 | 3,594 | 2.609375 | 3 | [] | no_license | from scrapy.spiders import Spider
from tutsplus.items import TutsplusItem
from tutsplus.items import AlternativetoItem
from tutsplus.items import YoutubeItem
from scrapy.http import Request
import re
import os
from bs4 import BeautifulSoup
import pdb
crawledLinks = []
class MySpider(Spider):
name = "my... | true |
014619c1125ca3ae8d050d1a2d07fe19b78e8182 | Python | mayurkadampro/Tsunami-Warning-System | /Tsunami Warning System.py | UTF-8 | 1,800 | 3.046875 | 3 | [] | no_license |
from bs4 import BeautifulSoup
import requests
from pygame import mixer
if __name__ == '__main__':
High_Tide = ''
High_Tide_Limit = '20.00'
Low_Tide = ''
Low_Tide_Limit = '2.00'
#it's play the siren for High Tide
def alert():
mixer.init()
alert = mixer.Sound('Sirens_2.wav')
alert.play()
#it'... | true |
7988e57a226f7ee54f51f2f3ebbe2d5d5f27ed05 | Python | alexandraback/datacollection | /solutions_5738606668808192_1/Python/Loci/C-large.py | UTF-8 | 1,153 | 2.75 | 3 | [] | no_license | cases = int(raw_input())
from time import time
def isPrime(n):
if n%2==0: return 2
startTime = time()
i = 3
while i < int(n**0.5)+1:
if n%i==0:
return i
# timeout for lame coins
if time() - startTime > 3:
return -1
i += 2
return -1
def isJamCoin(binaryCoin):
deviders = []
for i in ran... | true |
74b3d1f99351ac7a7695d56e3057259f9aa419a4 | Python | mpingram/yearly-grade-comparison-report | /scripts/data_access.py | UTF-8 | 295 | 3.015625 | 3 | [] | no_license | import pandas as pd
def get_grade_df(filepath):
df = pd.read_csv(filepath)
# add column with ClassName (SubjectName + StudentHomeroom)
df["ClassName"] = df.apply(lambda row:
"{} ({})".format(row.loc["SubjectName"], row.loc["StudentHomeroom"]), axis=1)
return df
| true |
2927208b266568501c1dc105134471cc28839886 | Python | bgossage/biomath | /simple_epidemic.py | UTF-8 | 6,387 | 3.125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed March 14, 2018
@author: bgossage
"""
"""
A simple epidemic model
Mathematical Biology, J.D. Murray
Chapter 19.1
Given a disease in which recovery confers immunity:
S(t) .=. Susceptibles
I(t) .=. Infectives
R(t) .=. Removed (immune, or isolated)
D(t) .=. Deaths
(Often... | true |
ccff5a1a0aaa9f9edb51862a94273a8e67246dbd | Python | konoufo/gif4101_E8D1 | /devoir1/q4/q4c.py | UTF-8 | 4,785 | 3.203125 | 3 | [] | no_license | import numpy as np
from sklearn.utils import check_X_y
class CustomBayes:
def __init__(self, cout_lambda=0.4):
self.cout_lambda = abs(cout_lambda)
self.check_lambda()
self.classes = None
self.variances = None
self.means = None
self.priors = None
self.rejet_... | true |
ca67f4bd905fd068a6c2046382c5e20289948f74 | Python | Villa01/OLC2_P2_201900907 | /Structure/Driver.py | UTF-8 | 5,015 | 2.859375 | 3 | [] | no_license | from Structure.SymbolTable.Type import get_stype
from Structure.SymbolTable.Symbol import Symbol
from Structure.SymbolTable.SymbolTable import SymbolTable
import sys
sys.path.append('../')
from Structure.AST.Error import Err, errors
class Driver:
def __init__(self) -> None:
self.error = []
self... | true |
81f282c2e26317df2ab619cb0eff4de3a3f4cf63 | Python | erickmendonca/GDGAjuBot | /tests/test_util.py | UTF-8 | 2,356 | 2.625 | 3 | [] | no_license | import json
from pathlib import Path
from gdgajubot.util import BotConfig
def test_botconfig_init():
config = BotConfig(group_name="JLA,TT", events_source="CIE,BN", database_url=None)
assert config.group_name == ["JLA", "TT"]
assert config.events_source == ["CIE", "BN"]
assert config.database == {
... | true |
1c0dbbae3fee730d7166b5d02deb470b211ffb92 | Python | jmacach1/flask_crud | /app/database/__init__.py | UTF-8 | 2,230 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
# """Database operations"""
from flask import g # context; global
import sqlite3
ID = "id"
FIRST_NAME = "first_name"
LAST_NAME = "last_name"
HOBBIES = "hobbies"
DATABASE="user_db" # database filename
def get_db():
db = getattr(g, "_database", None) # None is the default
if not db:
db ... | true |
0d5eaeb91a47ded83c34ccbcf8d8b9af8eb23023 | Python | bmei1/Machine_Learning_Algorithm | /model_selection.py | UTF-8 | 475 | 2.71875 | 3 | [] | no_license | import numpy as np
def train_test_split(X, y, test_ratio = 0.2, seed = None):
if seed:
np.random.seed(seed)
shuffled_index = np.random.permutation(len(X))
test_size = int(len(X) * test_ratio)
train_index = shuffled_index[test_size:]
test_index = shuffled_index[:test_size]
X_train ... | true |
c2b193302d7293286b461b24ad39d91cb0233ed9 | Python | Sushmita-08june/cat | /Tuple.py | UTF-8 | 892 | 4.09375 | 4 | [] | no_license | #Tuple
tuple1 = (7,8,2,3,4,"Python","Hi")
print(tuple1)
print(type(tuple1))
print(len(tuple1))
tuple2 = (8.0,7.23,False,True,9)
print(tuple2)
print(tuple2[2])
print(tuple1[-1])
#Concat
tuple3 = tuple1 + tuple2
print(tuple3)
tuple4 = tuple3 + (7,8,9)
print(tuple4)
tuple5 = (2,0,1) + (3,2,4)
print(tuple5... | true |
86dc381dc6e2a87d16f0d12572d6cbc0eaade43d | Python | CHIEH-YU/microsoft_oneday_intern_test | /puzzle.py | UTF-8 | 1,467 | 2.6875 | 3 | [] | no_license | graph = [[6,8,2],[3,7,5],[0,6,8],[7,5,1],[4,4,4],[1,3,7],[8,2,0],[5,1,3],[2,0,6]]
puzzle=[[0]*3 for i in range(6)]
record_1 = []
record_2 = []
for i in range(6):
if i==3:
blank = input()
puzzle[i] = list(input())
for idx,k in enumerate(puzzle):
for idx1,j in enumerate(k):
if j == '*':
... | true |
a3291ac6c2461afd7e9f67401a5169d5bd560a31 | Python | enodr/pytglib | /pytglib/api/types/chat_invite_link_info.py | UTF-8 | 1,954 | 3.015625 | 3 | [
"MIT"
] | permissive |
from ..utils import Object
class ChatInviteLinkInfo(Object):
"""
Contains information about a chat invite link
Attributes:
ID (:obj:`str`): ``ChatInviteLinkInfo``
Args:
chat_id (:obj:`int`):
Chat identifier of the invite link; 0 if the user is not a member of this chat
... | true |
ec547cccc62b3aa87505a260a0333ce8c877c1b8 | Python | sloscal1/lights | /src/lights/core.py | UTF-8 | 3,286 | 2.65625 | 3 | [
"MIT"
] | permissive | from collections import defaultdict
from functools import partial
from itertools import chain
from typing import List
def to_bytes(value: int, byte_length: int) -> bytearray:
return bytearray(value.to_bytes(byte_length, "big"))
NUM_BANDS = 11
RGB_BYTES = 3
# Message parts
MESSAGE_START = bytearray.fromhex("FF ... | true |
529deda9a496d17eeba8bef457def21ec1e79bb6 | Python | byronwasti/CircuitsLabs | /lab3/scripts/graphing2.py | UTF-8 | 938 | 2.703125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import csv
from scipy.optimize import curve_fit
CUR_VOL = "data/experiment1_data2_2.csv"
with open(CUR_VOL, 'r') as f:
reader = csv.reader(f)
Vin = []
Ibase = []
Iemit = []
for i, row in enumerate(reader):
if i == 0:... | true |
0b00147f4922dec3d9ab02dc730fddb5c433145a | Python | nkahrs/lewin-rhythms | /svg.py | UTF-8 | 1,115 | 3.09375 | 3 | [] | no_license | # refactored "07 30 svg creation.py", svg generation only
## theme2svg: given theme, output svg rectangles to mark points
def theme2svg(theme, x_offset, y_offset, height, width, color):
for i in theme:
print('<rect x="', (x_offset+i), '" y="', y_offset,
'" height="', height, '" width="'... | true |
ef503279f689af328ce90fa5a37bb37e7f44ae66 | Python | jrbj0/IF969-Projetos | /Projeto 3 - Concessionaria/carro.py | UTF-8 | 1,725 | 2.96875 | 3 | [] | no_license | from veiculo import *
class Carro(Veiculo):
def __init__(self, fabricante, modelo, portas,
autonomia, ano, placa, renavam, chassi, reservado):
Veiculo.__init__(self, fabricante, modelo, autonomia,
ano, placa, renavam, chassi, reservado)
self.portas = porta... | true |
7750109f9a69ce29032d6779200f7df251a810ad | Python | KirkGuo/LeetCode-Accepted-Code | /Problems/0797-All Paths From Source to Target.py | UTF-8 | 934 | 2.953125 | 3 | [] | no_license | class node:
def __init__(self, n=None, idx=None, nums=None):
self.mask = [0 for i in range(nums)] if n==None else [each for each in n.mask]
self.path = [] if n==None else [each for each in n.path]
if idx != None:
self.mask[idx] = 1
self.path.append(idx)
clas... | true |
9eb5762c3c6dea89c6078d691546185ef2200c57 | Python | marquesarthur/programming_problems | /interviewbit/test/test_min_absolute_diff.py | UTF-8 | 586 | 3.15625 | 3 | [] | no_license | import unittest
from interviewbit.pointers.min_absolute_diff import Solution
class MinAbsoluteDiffTest(unittest.TestCase):
def test_base_case(self):
s = Solution()
expected = 1
A = [1, 4, 5, 8, 10]
B = [6, 9, 15]
C = [2, 3, 6, 6]
result = s.solve(A, B, C)
... | true |
925eaf653a5bbe367baeac18341e09f0a24b4637 | Python | kslam07/potentialSolver | /potentialSolver/postProcess.py | UTF-8 | 1,106 | 2.859375 | 3 | [
"MIT"
] | permissive | """
Functions created for plotting
"""
import matplotlib.pyplot as plt
def plot_airfoil(airfoil):
# plot for test
xloc, yloc, x_1, y_1, x_3, y_3, alpha, __ = airfoil.datafile
plt.scatter(x_1[:-1], y_1[:-1], label="collocation points")
plt.scatter(x_3[:-1], y_3[:-1], label="vortex elements")
plt.plo... | true |
a9261e0d41defb7143c54bed6a20c0feb984ba41 | Python | kyeah01/Problem_Solving | /code/programmers/1_lv/printer.py | UTF-8 | 515 | 2.890625 | 3 | [] | no_license | def solution(priorities, location):
answer, current = 0, -1
lenth = len(priorities)
while priorities:
work = priorities.pop(0)
current += 1
if current == lenth:
current = 0
for i in priorities:
if i > work:
priorities += [work]
... | true |
db9074d700bf23f0675e0f8afaee3feac0b997e8 | Python | hayeonk/algospot | /routing.py | UTF-8 | 665 | 2.890625 | 3 | [] | no_license | import heapq
import sys
def dijkstra(src):
dist[src] = 1.0
pq = []
heapq.heappush(pq, (1.0, src))
while pq:
cost, here = heapq.heappop(pq)
for there, c in adj[here]:
nextDist = cost * c
if dist[there] > nextDist:
dist[there] = nextDist
heapq.heappush(pq, (nextDist, there))
... | true |
21709b83d819ce63e477f83a3252bb373f3b5a9b | Python | AHHHZ975/neuralnet-pytorch | /neuralnet_pytorch/utils/numpy_utils.py | UTF-8 | 3,047 | 3.5 | 4 | [
"MIT"
] | permissive | import numpy as np
__all__ = ['is_outlier', 'smooth']
def smooth(x, beta=.9, window='hanning'):
"""
Smoothens the data using a window with requested size.
This method is based on the convolution of a scaled window with the signal.
The signal is prepared by introducing reflected copies of the signal
... | true |
19440e508de59f50f9f0ce99ee1d8391f96198d9 | Python | codename-rinzler/goldmine | /src/framework/rect.py | UTF-8 | 546 | 3.734375 | 4 | [] | no_license | class Rect:
def __init__(self, x, y, w, h):
self.x1 = x
self.y1 = y
self.x2 = x + w
self.y2 = y + h
def center(self):
cx = (self.x1 + self.x2) / 2
cy = (self.y1 + self.y2) / 2
return (cx, cy)
def intersect(self, other):
return (self.x1 <= oth... | true |
ea6d5588690b45eeebf3125829089425411d3738 | Python | nikhilbhatewara/HackerRank | /Python/Day5_Normal_Distribution_II.py | UTF-8 | 294 | 3.65625 | 4 | [
"MIT"
] | permissive | import math
mean, std = 70, 10
def cdf(x): return 0.5 * (1 + math.erf((x - mean) / (std * (2 ** 0.5))))
# More than 80 => 1 - P(less than 80)
print('{:.2f}'.format(100*(1-cdf(80))))
# More than 60
print('{:.2f}'.format(100*(1 - cdf(60))))
# Less than 60
print('{:.2f}'.format(100*cdf(60)))
| true |
cb56b5fbfeebedc431bf1d16639c6062bbfe8bda | Python | HighLvRiver/PythonLearning | /Study/python_basic_01_calculator.py | UTF-8 | 3,197 | 4.1875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
#파이썬을 계산기로 사용하기
#파이썬 셸에서 할 수 있는 가장 간단한 프로그래밍은 파이썬을 계산기로 사용하는 것이다.
#정수의 연산
#셀에서 다음과 같이 입력해보자.
#1+1 #모두 붙여 쓰지 않는다
#1 +1 #너무 많이 띄우지 않는다. 한칸만 띄운다.
#더하기 : +
#빼기 : -
#곱하기 : *
#나누기 몫만 구하기 : //
#소숫점까지 나누기 : /
#나머지 : %
#제곱 : **
#2 + 4 -5 #1
... | true |
358e45a6e8f9605e666d2dcdb0c5232139a6de18 | Python | Sabhijiit/Captcha-breaking-using-TensorFlow | /train_test_model.py | UTF-8 | 5,774 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu May 24 10:32:37 2018
@author: Sabhijiit
"""
import cv2 # to load the images
import numpy as np # to do matrix manipulations
from os.path import isfile, join # to manupulate file paths
from os import listdir # get list of all the files in a directory
from random import shuff... | true |
89321f63eb27f750cf2a4a52add15d2e59d5bde7 | Python | yulifromchina/python-exercise | /Scrapy learn/Spider-Series/doubanTop250_spider/parse.py | UTF-8 | 1,753 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
import re
import requests
import logging
import logging.config
import time
from bs4 import BeautifulSoup
from database import *
logging.config.fileConfig("logger.conf")
logger = logging.getLogger("spiderLogger")
def write_database(movie_title, score, judge_people,info, ... | true |
ecb479f44b66fab8b89861cb1c11d334e8a4dbc2 | Python | lty9520/crawlerDemo | /crawler/downurlHandler.py | UTF-8 | 2,066 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: ProxyHandler.py
Description :
Author : LHY
date: 2020/8/29
-------------------------------------------------
Change Activity:
2020/8/29:
----------------------------------------... | true |
90a9532d6908e530b19155aa8798a5b756a50fcf | Python | ZhaoYu1105/ElemeSpider | /main_spider.py | UTF-8 | 623 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2021/8/7 14:30
# @FileName: main_spider.py
# @Software: VSCode
# @Comments: 饿了么爬虫,爬取商品信息|主函数
import ele_login
import merchant_spider
import data_process
if __name__=="__main__":
# 自动登录并记录cookie
ele_login.login_and_cookie_get()
mycookie = ele_login.cookie_process()
... | true |
b88ff614e78d89ac3083f8b24f2953071fa712b1 | Python | HBlack09/ICTPRG-Python | /Reading and Writing Files/1.py | UTF-8 | 237 | 4.09375 | 4 | [] | no_license | #Request Input
x1 = int(input("Please write down any positive number: "))
y1 = int(input("Write down another number: "))
#Create output file
f = open("math.txt", "a")
#Print output to file
f.write(f"{x1 + y1}")
#Close file
f.close()
| true |
02a1921dbe2f76bd55d1dfe9913338fa42da4059 | Python | geoluengas/obd_tool | /read_data/read_data.py | UTF-8 | 3,587 | 2.515625 | 3 | [] | no_license | import random
import os
import obd
import time
import threading
from obd.OBDResponse import Monitor
from obd.utils import BitArray
def main():
time.strftime('%X %x %Z')
# obd.logger.setLevel(obd.logging.DEBUG)
connection = obd.OBD("/dev/ttys001") # auto-connects to USB or RF port
reader = DataReader(... | true |
e01eddcf7de4ce3fc20600a9ae5cc737160c338a | Python | tharvell/interview_questions | /questions/do_they_add_up.py | UTF-8 | 284 | 3.59375 | 4 | [] | no_license | # Do they add up ?
def do_they_add_up(numbers, number):
"""
Args:
Returns:
Raises:
"""
for i in range(len(numbers)):
for j in range(i, len(numbers)):
if numbers[i] + numbers[j] == number:
return True
return False
| true |
7cdecf6bfa378a499afdf9fb065d576ec5aeeeea | Python | joacomf/procesamiento_seniales | /guia01/ejercicio15.py | UTF-8 | 565 | 3.15625 | 3 | [] | no_license | import matplotlib.pyplot as plot
import numpy
from herramientas.signals.Signal import Signal
from herramientas.OddPart import OddPart
from herramientas.EvenPart import EvenPart
import random
class RandomFunction(Signal):
def value_at(self, time):
return random.randint(-2, 2)
time_collection = numpy.linspace(-1... | true |
f484bdb4db327d1963ea3385f55dbabf3c15f3be | Python | zahybnaya/mnk | /scripts/calc_avg_time_predictions.py | UTF-8 | 3,299 | 2.546875 | 3 | [] | no_license | #!/bin/python
# Seems like a way to average rts data
from sys import argv
from numpy import std
def get_rts(rt_values_file):
rts = {}
with open(rt_values_file, 'r') as f:
for line in f:
if line[1].isalpha():
continue
fields=line.split(',')
key=(fiel... | true |
198bf6b09c1c37038bc5e392dfeebb096b350308 | Python | gSchool/dsi-prep-autochallenge-test | /images/makeplt.py | UTF-8 | 197 | 2.734375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
x_vals = np.linspace(-2 * np.pi, 2*np.pi, 25)
plt.figure(figsize=(6, 6))
plt.scatter(x_vals, np.sin(x_vals))
plt.savefig('correct_solution.png') | true |
0ebce30544f94bb971fe07365cbdb7ea7d6ae691 | Python | gp-learning/Python_educative_assignment | /LC409.Longest Palindrome.py | UTF-8 | 501 | 3.078125 | 3 | [] | no_license | from collections import Counter
def longestPalindrome( s):
"""
:type s: str
:rtype: int
"""
res = {}
ans=[]
out=[]
x=0
y=0
for i in s :
if i not in res:
res[i] = 1
else:
res[i] += 1
su = 0
for val in res.values():
if val %2... | true |
cf2b6a34e06d1100df151666d4a6a7452da15bf0 | Python | aquarion/lampstand | /lampstand/reactions/base.py | UTF-8 | 1,681 | 2.546875 | 3 | [] | no_license | import time
import ConfigParser
def __init__():
pass
class Reaction:
#canSay = ("Aquarion")
__name = 'Base'
cooldown_number = 6
cooldown_time = 360
uses = []
def __str__(self):
return self.__name
def __repr__(self):
return '<%s Reaction>' % self
def __init__... | true |
d16d2a8fe429ff67d3c8c7df475597403b776bc0 | Python | ChastityAM/Python | /Python-sys/HelloWorld.py | UTF-8 | 56 | 3 | 3 | [] | no_license | name = "Chuckie"
print (name + " says, 'Hello World'.") | true |
d0d0838accb0cd6e7491f1e69a9b528f167b8825 | Python | evamrom/messaging_system | /app.py | UTF-8 | 4,752 | 2.765625 | 3 | [] | no_license | from datetime import datetime
from time import strftime
from flask import Flask, jsonify, request
from users.current_user import current_user
from users.users import users
app = Flask(__name__)
@app.route('/register', methods=["POST"])
def register():
"""Register the user to system. If the user already exists it... | true |
acb576a4524f3f53273e3a3e69351558cebcf7ec | Python | tedelon/py3Gat | /py3gat_demo/Gat/util/methodtracer.py | UTF-8 | 1,998 | 2.671875 | 3 | [] | no_license | # coding=utf-8
'''
Created on 2013-7-8
@author: tiande.zhang
'''
from Gat.util.logger4py.logger import Logger
from settings import GlobalConfig
import functools
import re
def MethodTracer(msg=None):
def MethodInvokeTracer(method):
@functools.wraps(method)
def tracer(*args):
#print(meth... | true |
59edbd18f7485d4a785f1ba275849b6af6abe217 | Python | vdomos/snips-chacon | /action-vdomos-setChacon.py | UTF-8 | 3,778 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
intent message hermes/intent/vdomos:setChaconOff: {"sessionId":"19b22b6f-4dcc-459c-88ef-fc7a26f3fe90","customData":null,"siteId":"default","input":"éteint la lumière du séjour","intent":{"intentName":"vdomos:setChaconOff","probability":1.0},"slots":[{"rawValue":"séjou... | true |
9b1564c40850edf3088898dbc7989adb7086e928 | Python | khlin216/recurrent_portfolio | /rnn_portfolio/preprocessing.py | UTF-8 | 14,897 | 2.796875 | 3 | [
"MIT"
] | permissive | """Functions that load data from txt files, as well as clean
loaded data of NaNs, zeros, and other oddities.
"""
import glob
from datetime import datetime, timedelta
from sklearn.preprocessing import StandardScaler
import numpy as np
from . import NP_DTYPE
def get_n_batch(n_timesteps, horizon, val_period,
... | true |
acbe96a34712a37464b34a95fc5a3c1fe50d4ded | Python | fakegit/mecache | /mecache/_file.py | UTF-8 | 1,175 | 2.515625 | 3 | [
"MIT"
] | permissive | import os
import time
import pickle
from .core import BaseCache
class File(BaseCache):
def __init__(self, path):
self.__path = path
os.makedirs(path, exist_ok=True)
@property
def path(self):
return self.__path
def _get_path(self, qual, key):
path = os.path.join(os.p... | true |
4c68c48d691c57e8b87cc2742655c3b39db91751 | Python | hassaanaliw/uofm-halal | /halal/models.py | UTF-8 | 3,931 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | """
Defines schema for all the tables in our database. All tables are related
Hall => Menu (One to Many)
Menu => Meal (One to Many)
Meal => Course (One to Many)
Course => MenuItem (One to Many)
Hassaan Ali Wattoo - <hawattoo@umich.edu>
"""
import json
import os
from halal import db
import datetime
class Hall(db.Mo... | true |