blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
7206eaa182d66a359edac5e8148d4aded8b61352 | aaugustin/sudoku | /legacy/sudoku/__init__.py | UTF-8 | 4,431 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# Copyright (c) 2008-2014 Aymeric Augustin
"""Command-line interface for the SuDoKu solver and generator.
If the C version of the SuDoKu class is available, it will be used. Otherwise,
the pure Python version will be used. This can be determined at runtime by
testing whether 'implementation' is ... | true |
87de5de5635b4e8ed5cb4540413d1e3aae9d90c6 | henrysdev/CTCI-Solutions | /Chapter1/IsUnique.py | UTF-8 | 319 | 3.59375 | 4 | [] | no_license | """
Is Unique: Implement an algorithm to determine if a string has all unique characters. What if you
cannot use additional data structures?
"""
def isUnique(s):
if len(s) == 1:
return True
list(s).sort()
for i in range(1, len(s)):
if s[i] == s[i-1]:
return False
return True | true |
b6c3ba09c3dd47cb2dab6624bdbc420d256cdef9 | CS3216-WhereTo/where-to | /back_end/WhereTo/routes/read_test_data.py | UTF-8 | 1,906 | 2.78125 | 3 | [] | no_license | #unused
import polyline
def read_test_data():
import csv
node_graph, bus_stop_graph, bus_route_edges = {}, {}, {}
with open("test_data/nodedata.csv") as f:
data = csv.reader(f)
next(data)
for node_id, node_name, node_lat, node_lon, node_type, node_neighbors in data:
... | true |
1abc90961abd6c3513677db9587df578e26c903c | Okroshiashvili/Data-Science-Lab | /Machine Learning/Association Rule Learning/Apriori.py | UTF-8 | 2,416 | 3.1875 | 3 | [] | no_license |
"""
Apriori
"""
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from apyori import apriori
dataset = pd.read_csv("data/Market_Basket_Optimisation.csv", header= None)
# Apriori algorithm expects list of lists as input and they must be strings
# We need to convert dat... | true |
d49678d3ad26c63049304adcec6f6d1c3cd1f636 | shreyaprabhakar7/stamp-signature-detection | /augmentation/resize.py | UTF-8 | 409 | 2.859375 | 3 | [] | no_license | from PIL import Image
import os, sys
from tqdm import tqdm
path = #path of dir
dirs = os.listdir( path )
def resize():
for item in tqdm(dirs):
if os.path.isfile(path+item):
im = Image.open(path+item)
f, e = os.path.splitext(path+item)
imResize = im.resize((360,504), Ima... | true |
b1e1acc5688ad3a9cf3453b98c3437282d7b1b61 | GuessWhatGame/referit | /src/referit/preprocess_data/create_glove.py | UTF-8 | 2,299 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | import argparse
from nltk.tokenize import TweetTokenizer
import io
from generic.utils.file_handlers import pickle_dump
from referit.data_provider.referit_dataset import ReferitDataset
# wget http://nlp.stanford.edu/data/glove.42B.300d.zip
if __name__ == '__main__':
parser = argparse.ArgumentParser('Creating G... | true |
2fe1fd75fc871809f97fb8b0fe829d898d1ec30d | Ali-Alhasani/UniSaarApp | /server/source/models/NewsAndEventsModel.py | UTF-8 | 2,611 | 3.09375 | 3 | [
"MIT"
] | permissive | class NewsAndEventsModel:
def __init__(self, title, publishedDate, id, link="", categories=None, description: str = "", content: str = "",
imageLink=""):
"""
construct a NewsAndEventsModel object containing the title, the release date, a link to the item,
the associated cat... | true |
75c3a159558264769f2f6b6eb18456251b276e48 | LucBurge/advent-of-code2020 | /puzzle-3.py | UTF-8 | 1,171 | 3.65625 | 4 | [] | no_license | import math
#Open input file
file = open('input3.txt')
#Determines end of line
line_length = (len(file.readline()))
total_lines = 321
tree = '#'
count_line = 1
count_trees = 0
#Creates a new file to write the output to
out_file = open('out3.txt', 'w')
#Traverse file to the right
repetitions = math... | true |
0747e5c9dee417fca524c52e3e95142bd855df2d | AmiMunshi/Python-programs | /matrix | UTF-8 | 478 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 16 22:40:15 2019
@author: maulik
"""
a,b=input().split()
a=int(a)
b=int(b)
matrix=[]
c=1
c=int(c)
for i in range(0,a):
x=[]
for j in range(0,b):
x.append(c)
c=c+1
matrix.append(x)
for i in range(0,a):
for j in rang... | true |
757ac4ef8040584ed2bdaea598bd25007199cdff | topherCantrell/robots-topherBot | /plot_mounted.py | UTF-8 | 742 | 2.96875 | 3 | [] | no_license | ## py -m pip install matplotlib
import matplotlib.pyplot as plt
from load_data import load_data
x0,y0,z0 = load_data('data/A_NoBase.json')
x1,y1,z1 = load_data('data/B_NoBase_mounted_magnet.json')
x2,y2,z2 = load_data('data/C_NoBase_mounted_iron.json')
fig = plt.figure(figsize=(9,8))
ax = plt.axes(projection='3d',x... | true |
167a8408998f461061462ae5dd7b0ed997c56658 | rajeshsvv/Lenovo_Back | /1 PYTHON/1 EDUREKA/EDUREKA OLD/4 Logical Operators.py | UTF-8 | 83 | 3.015625 | 3 | [] | no_license | x=True
y=True
print("x and y",x and y)
print("x or y",x or y)
print("not y",not y) | true |
35ca6c08ccfea93460876f976e60246f58f23fcf | JerrallK/Algorithms_study | /leetcode/动态规划/栅栏涂色.py | UTF-8 | 1,096 | 3.28125 | 3 | [] | no_license | # coding=utf-8
#coding:utf-8
"""
有 k 种颜色的涂料和一个包含 n 个栅栏柱的栅栏,每个栅栏柱可以用其中一种颜色进行上色。
你需要给所有栅栏柱上色,并且保证其中相邻的栅栏柱 最多连续两个 颜色相同。然后,返回所有有效涂色的方案数。
注意:
n 和 k 均为非负的整数。
示例:
输入: n = 3,k = 2
输出: 6
解析: 用 c1 表示颜色 1,c2 表示颜色 2,所有可能的涂色方案有:
柱 1 柱 2 柱 3
----- ----- ----- -----
1 c1 c1 c2
2 ... | true |
cc340f9bd568127b1be21fb86f805c8db3c8305c | rhitik26/python | /DXCTraining/Examples/6Exceptions/sampleException.py | UTF-8 | 573 | 3.796875 | 4 | [] | no_license | class NameNotInList(Exception):
def __init__(self, value="Invalid Data encountered,a valid data expected"):
self.value = value
def __str__(self):
return self.value
print('Enter User name: ')
uname= input()
try:
li= ['Sachin' ,'Bhargava' , 'Saurav' , 'Sehwag' ,'Dhoni']
if uname not in li:... | true |
c1ba328d49e9794c76e3cb2a459e7b1c3b764f0c | sakuv2/procon | /tests/abc/abc197/test_abc197_c.py | UTF-8 | 652 | 2.859375 | 3 | [] | no_license | # title: ORXOR
# problem link: https://atcoder.jp/contests/abc197/tasks/abc197_c
from unittest import mock
import pytest
from procon import Param
from procon.abc.abc197.c import main
@pytest.mark.parametrize(
"param",
[
Param(inputs=["3", "1 5 7"], outputs=["2"]),
Param(inputs=["3", "10 10 ... | true |
2ca4b4ae97a37b6c6b807a217f0e02cf65a97e10 | Mariavellous/flight_deals | /flight_data.py | UTF-8 | 2,782 | 2.96875 | 3 | [] | no_license | from datetime import datetime
from datetime import timedelta
import requests
TEQUILA_API_KEY = "Jb4o_zhT1mu6JEaY8Z8ZWDgVADWHjV1W"
TEQUILA_ENDPOINT = "https:tequila-api.kiwi.com/"
today = datetime.today()
# Use Timedelta to specify how many (days, hours, min)
add_1_day = timedelta(days=1)
add_180_days = timedelta(days... | true |
e2840eb1b0d731d6b0356835ba371d05ba351ff6 | jamf/SplunkBase | /bin/jamf_pro_addon_for_splunk/aob_py2/cloudconnectlib/core/exceptions.py | UTF-8 | 751 | 2.640625 | 3 | [
"MIT"
] | permissive | """APP Cloud Connect errors"""
class CCEError(Exception):
pass
class ConfigException(CCEError):
"""Config exception"""
pass
class FuncException(CCEError):
"""Ext function call exception"""
pass
class HTTPError(CCEError):
""" HTTPError raised when HTTP request returned a error."""
de... | true |
507d91bcdb15bf6c6704690ff54b494e63b8b11d | mylokin/redisext | /tests/test_queue.py | UTF-8 | 2,315 | 2.546875 | 3 | [
"MIT"
] | permissive | from __future__ import absolute_import
import redisext.queue
import redisext.serializer
from . import fixture
class Queue(redisext.queue.Queue):
CONNECTION = fixture.Connection
KEY = 'queue'
SERIALIZER = redisext.serializer.Pickle
class QueueTestCase(fixture.TestCase):
def setUp(self):
sel... | true |
c0cdea91c06bd4255462de3de6b845629f396b0c | Reynouts/AoC20 | /day17.py | UTF-8 | 1,677 | 3.171875 | 3 | [] | no_license | import aocutils
from itertools import product
def get_neighbours(grid, position, r=4):
heading = list(product([0, 1, -1], repeat=r))
heading.remove((0, 0, 0, 0))
cnt = 0
for h in heading:
cpos = tuple(map(sum, zip(position, h)))
if cpos in grid:
if grid[cpos] == 1:
... | true |
037b838da3f2f13c35bc750ad755045213a8ca59 | kc4v/CSE | /Trenten Williams - CYOA.py | UTF-8 | 19,361 | 3.15625 | 3 | [] | no_license | import random
# from tkinter import *
# import image
# root = Tk()
# root.title("Trenten!!!!!")
# label = Label(root, text="Hello and Welcome!")
# label.pack()
# root.mainloop()
# window = Tk()
#
# window.title("Join")
# window.geometry("800x800")
# window.configure(background='grey')
#
# imageFile = "flat,800x800,070... | true |
b75f38037a01c2b4363d6fdd3db2c0f742003b06 | DeusDeus/documentos | /controlers/documento.py | UTF-8 | 2,309 | 2.609375 | 3 | [] | no_license | from flask_restful import Resource, reqparse
from models.documento import DocumentoModel
import werkzeug, os
class DocumentoController(Resource):
def post(self):
parser= reqparse.RequestParser()
parser.add_argument(
"nombre",
type=str,
required=True,
... | true |
c421bd79496bd29eca473b4ede431da6cf94713a | joaomarcostg/Grafos | /Python/aulas/getData_ufop.py | UTF-8 | 3,507 | 2.65625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from pandas import DataFrame as DF
import json
import csv
import os
def getTabelaDepto(URL):
r = requests.get(URL)
tabela_depto = []
soup = BeautifulSoup(r.text, 'lxm... | true |
db711843aac1edc1cba86c3b8045e1c392e95062 | RC5K/Generating-personalised-wayfinding-for-museum-navigation | /Data collection/ftsp_data.py | UTF-8 | 3,268 | 3.328125 | 3 | [] | no_license | def find_path(road_network,current_vertex,target_vertex):
sub_path =[]
indexes = []
#find all instances of current_vertex in the excel map
for row in xrange(0, len(road_network)):
for col in xrange(0,len(road_network[row])):
if road_network[row][col] == current_vertex:
... | true |
f711716df3498b9bac7ae604492e9ebe1b457179 | SkyNeolagos/Genie_Logiciel_Scrum | /getAuthor.py | UTF-8 | 585 | 2.8125 | 3 | [] | no_license | import os
import re
def getAuthor(nomFichier):
titreSeparer = nomFichier.split("_")
finTitreSeparer = titreSeparer[len(titreSeparer)-1].split(".")
finTitre = finTitreSeparer[0]
fichier = open(nomFichier, "r")
lignes = fichier.readlines()
fichier.close()
auteurLigne = "Aucun Auteur"
for i in range(0,len(ligne... | true |
d210ad754626058e95cb90c47800922bc637a20f | haydenbetts/udacity-cs222 | /w1/programming_acceleration.py | UTF-8 | 1,925 | 3.40625 | 3 | [] | no_license | # QUIZ
#
# Modify the acceleration function so that it returns
# the acceleration vector of the spacecraft.
#
# A sample of how to use the numpy.linalg.norm function
# is given. This computes the length of the vector, and
# it should be the only outside function you need to
# use in your answer.
import numpy
import... | true |
4eb0c21d58f3594c8a1fd751a76b4da9975f9b3c | jrbytes/speech-recognize | /speech_recognize.py | UTF-8 | 618 | 2.84375 | 3 | [] | no_license | import speech_recognition as sr
import os
from err import noalsaerr
def main():
mic = sr.Recognizer()
with noalsaerr.noalsaerr() as n, sr.Microphone() as source:
mic.adjust_for_ambient_noise(source)
print(f'Fale algo: ')
audio = mic.listen(source)
try:
text = mic.recognize_google(a... | true |
eab5017c835242c46a0fe91b0b9966ec732b79e0 | ngoiyaeric/pretty-secure-processor | /utils/img2c.py | UTF-8 | 905 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
from PIL import Image
def main():
if len(sys.argv) != 3:
print("Usage: img2c.py [image] [output]")
exit(-1)
with open (sys.argv[2], "w") as output_f:
img = Image.open(sys.argv[1])
width, height = img.size
output_f.write(f"const uint8_t... | true |
999cbb95c3aec210d3589b962927d0f304d31a3e | Chatti5115/pythonalgorithm | /recursive.py | UTF-8 | 1,470 | 3.671875 | 4 | [] | no_license | # def factorial(num):
# if num > 1:
# return num * factorial(num -1)
# else:
# return num
#
# for num in range(10):
# print(factorial(num))
#
#
# def factorial1(num):
# if num <=1:
# return num
# return num * factorial1(num -1)
#
# for num in range(10):
# print(factorial1... | true |
933a1c59c51bac5a4b477f9d9acca8af3175e4c1 | deshaniVimukthika/waste-classifier | /raspberry_pi_interface/src/overlay_images/old/classify.py | UTF-8 | 1,649 | 3.015625 | 3 | [] | no_license | import os
import tensorflow as tf
import keras
from keras.models import load_model
import cv2
from glob import glob
from constants import *
#load the pretrained model
model = load_model("model.h5py")
TEMP_IMG_PATH = "img.jpg"
STORE_DIRECTORY = "Classified_Images"
WIDTH=299
HEIGHT=299
CLASS_LIST = ['plastic', 'cardboar... | true |
71d721e0903568c14531d5555894de2b885688d3 | Yegaston/testPython | /MetodosDeCadenas/ej1.py | UTF-8 | 171 | 3.421875 | 3 | [] | no_license |
email = input("Introduce tu email: ")
arrobas = email.count('@')
if(arrobas != 1 or email.rfind('@')==(len(email)-1)):
print("Wrong mail")
else:
print("Correct") | true |
5a43d04075918d0cd81cc6207dbcf23c24f3fe7b | Aasthaengg/IBMdataset | /Python_codes/p03733/s101864092.py | UTF-8 | 240 | 2.875 | 3 | [] | no_license | n, t = map(int, input().split())
li = list(map(int, input().split()))
li = li[::-1]
ans = 0
for i in range(n):
if i == 0:
ans += t
if i >= 1:
if li[i-1]-li[i] >= t:
ans += t
else:
ans += li[i-1]-li[i]
print(ans) | true |
b444586a82b034db89b7642ff9d4b1cd70c9a01b | josecper/geofieldpy | /legendre.py | UTF-8 | 1,434 | 2.59375 | 3 | [] | no_license | import scipy
import scipy.special
import numpy
import sys
fs=open(sys.argv[1],"r")
theta=float(sys.argv[2])
phi=float(sys.argv[3])
if(len(sys.argv) > 4):
rparam=float(sys.argv[4])
else:
rparam=1.0
if(len(sys.argv) > 5):
lmax = int(sys.argv[5])
else:
lmax = 13
gcoefs=numpy.zeros((lmax+1,lmax+1))
hcoef... | true |
9f2b163d3d730fe2d69c212b3d851eddcd6335b2 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_201/2892.py | UTF-8 | 2,279 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env
import sys, math
def get_file_contents():
file_contents = open('./inputs/C-small-1-attempt3.in').read().splitlines()
# file_contents = open('./inputs/test.txt').read().splitlines()
return int(file_contents.pop(0)), file_contents
def loop_contents(num_lines, lines):
for i in range(0, num_li... | true |
1596117d0c5ca25d7caed66d42e6aeba5bea691d | freshman-wuliang/Practices | /py_practices/exmp/exmp5-1.py | UTF-8 | 368 | 4.46875 | 4 | [] | no_license | """
#if语句实例
#简单的if举例
#检查是否相等(使用'==')
#检查是否不相等('!=')
#检查多个条件(and,or,)
"""
#part1(if举例)
fruits = ["apple","pear","watermelon"]
for fruit in fruits:
if(fruit == "pear"):
print(fruit.upper())
else:
print(fruit.title())
#part2(检查是否相等)
print(fruits[0] == "apple")
| true |
95cd12e8e35bc21dae0b08d8dcac3c00c5e00970 | microsoftgraph/msgraph-sdk-python | /msgraph/generated/models/windows_app_x_app_assignment_settings.py | UTF-8 | 2,660 | 2.53125 | 3 | [
"MIT"
] | permissive | from __future__ import annotations
from dataclasses import dataclass, field
from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter
from typing import Any, Callable, Dict, List, Optional, TYPE_CHECKING, Union
if TYPE_CHECKING:
from .mobile_app_assignment_settings import MobileAppAssig... | true |
44007be6a2abdd4d790b7ba1c439122b72a2c7ff | vshrivas/graphospasm | /storage/Node.py | UTF-8 | 13,120 | 3.125 | 3 | [] | no_license | from .Relationship import Relationship
from .Property import Property
from .Label import Label
from .LabelIndex import LabelIndex
import sys
DEBUG = False
class Node:
"""Node class: representation of a Node, which has labels, properties
(key-value pairs), and relationships to other Nodes.
The Node ... | true |
2df22c8b08823dd19ba2768d5392daff12834aba | watsonjj/targetpipe | /scripts/deprecated/simple_pulse_spectrum_fitting_comparison.py | UTF-8 | 15,138 | 2.890625 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
from scipy.stats import poisson, norm as gaussian
from scipy.optimize import curve_fit
from os.path import join, exists
from os import makedirs
from functools import partial
from IPython import embed
def pedestal_signal(x, norm, eped, eped_sigma, lambda_):
"... | true |
f874b772c332e2b6660ef5f65f9517d565835d14 | KingArtherTT/ImageSearch | /Features.py | UTF-8 | 1,947 | 2.78125 | 3 | [] | no_license | import cv2
from Abstract import AbstractFeature
import numpy as np
class SURF(AbstractFeature):
def __init__(self, cluster_center=500):
self.surf = cv2.xfeatures2d.SURF_create(
hessianThreshold=3000 # 默认100,关键点检测的阈值,越高监测的点越少
, nOctaves=4 # 默认4,金字塔组数
, nOctaveLayers=3 ... | true |
2fb9552cc65c87bafcc679b9292861b408c95c3b | KidsHackDay/minecraft | /game_tower_defense.py | UTF-8 | 2,684 | 3.0625 | 3 | [] | no_license | from khd.minecraft import *
from random import randrange
from time import sleep
class MyGame( Game ) :
tick = 0
tickRound = 25
# Size of stage
stageSize = 30;
# tower position and size
towerPos = Vec3( 14, 0, 14 )
towerSize = Vec3( 3, 10, 3 )
# This is the amount of blocks per round
level = 1
# This is where... | true |
2f0956ca14d152c92605cf98e6ba49b380f0b04d | basti333/SmartNinja | /Lesson9/strings.py | UTF-8 | 253 | 3.53125 | 4 | [] | no_license | str_one = "Welcome"
str_two = "to"
str_three = "Austria"
print(str_one + str_two + str_three)
print(str_one + " " + str_two + " " + str_three)
print("%s %s %s" % (str_one, str_two, str_three))
print("{0} {1} {2}".format(str_one, str_two, str_three)) | true |
87fa8f612594f781978091b3fae826bc22780d37 | hufs-capstone/graduation_project | /api/mongo/db_init.py | UTF-8 | 762 | 2.75 | 3 | [] | no_license | from pymongo import MongoClient
import csv
client = MongoClient()
db = client.main_db
products = db.products
with open('food_list.csv', encoding='utf8') as csv_file:
csv_reader = csv.DictReader(csv_file)
line_count = 0
for line in csv_reader:
product = {}
product["name"] = line["식품명"]
... | true |
7011aea096e68dffd30c989cba9690aa8f87d537 | renjieliu/leetcode | /2000_2499/2007.py | UTF-8 | 2,245 | 2.984375 | 3 | [] | no_license | class Solution:
def findOriginalArray(self, changed: 'List[int]') -> 'List[int]': # O( NlogN | N )
if len(changed) % 2 :
return []
hmp = {}
for c in changed:
if c not in hmp:
hmp[c] = 0
hmp[c] += 1
output = []
taken = set()... | true |
59362144539f15b2050b82d3a65ea4d64cd1fd81 | powerpenguincat/practice-atcoder | /tests/typical_ninety/test_no15code.py | UTF-8 | 394 | 3.015625 | 3 | [
"MIT"
] | permissive | import pytest
from practice_atcoder.typical_ninety.no15code import question
class Test(object):
@pytest.mark.parametrize("n,expect", [
("1", ["1"]),
("2", ["3", "2"]),
("3", ["7", "4", "3"]),
("4", ["15", "7", "5", "4"]),
("7", ["127", "33", "18", "13", "10", "8", "7"]),
... | true |
70ce104487fcad4a13c3673257a4570c7491bb70 | k8godzilla/-Leetcode | /1-100/L298.py | UTF-8 | 2,451 | 3.46875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 6 09:38:38 2019
@author: admin
"""
'''
给你一棵指定的二叉树,请你计算它最长连续序列路径的长度。
该路径,可以是从某个初始结点到树中任意结点,通过「父 - 子」关系连接而产生的任意路径。
这个最长连续的路径,必须从父结点到子结点,反过来是不可以的。
示例 1:
输入:
1
\
3
/ \
2 4
\
5
输出: 3
解析: 当中,最长连续序列是 3-4-5,所以返回结果为 3
示例 2:
输入:
2... | true |
28f9c2c1aa6f605e1af2504ff6e442306fee893a | aiswarya98/programs | /prog21.py | UTF-8 | 79 | 2.84375 | 3 | [] | no_license | numb,b,dif=map(int,input().split())
summ = num*(2*b+dif*(num-1))/2
print(summ)
| true |
1261d1f86222399fd7bedc6dd5f65617e4076da1 | itembase/itembase-python | /itembase/api.py | UTF-8 | 3,506 | 2.578125 | 3 | [
"MIT"
] | permissive | import requests
from itembase.version import VERSION
class ItembaseError(Exception):
def __init__(self, status_code, error_message, *args, **kwargs):
self.status_code = status_code
self.error_message = error_message
def __str__(self):
return "(%s) %s" % (self.status_code, self.error... | true |
4b815501276ae4dc0a3165488b7bdaa1275c41af | drtconway/zotmer | /zotmer/library/timer.py | UTF-8 | 999 | 3.296875 | 3 | [] | no_license | """
This module provides a simple timer class for instrumenting code.
"""
import time
class timer(object):
def __init__(self):
self.start = time.time()
self.sofar = 0.0
self.paused = False
self.events = 0
def pause(self):
now = time.time()
self.sofar += now - s... | true |
153f42a1e6f342afb595e46e9f69b57f3d58a667 | caseycas/CodeNLPReplication | /NgramCacheModel/evaluation/bin/lstmComparableTest.py | UTF-8 | 1,570 | 2.859375 | 3 | [
"MIT"
] | permissive | import argparse
import os
from utils import *
"""
LSTM comparable training.
This script is intented to use Zhaopeng's cache model in a way
that is comparable to the values used in the lstm model.
This means that we have a fixed train and testing set, rather
than picking them as random 10-fold breaks.
"""
parser = a... | true |
0c0db5b609c7de079a4c55380b8326a6008b936d | Janca-P/pyladies | /02/ctverec.py | UTF-8 | 362 | 3.203125 | 3 | [] | no_license | strana = float ( input ("Zadej cislo"))
cislo_je_spravne = strana > 0
if cislo_je_spravne:
print ("obvod čtverce se stranou", strana, "je", strana * 4)
print ("obsah čtverce se stranou", strana, "je", strana * strana)
else:
print ("Strana musí být kladná, jinak z toho nebude čtverec!")
print ("Děkujeme za p... | true |
ef8b9293710068ef613a35a88cde92d08bad1064 | amirhaf76/Search_engine | /word_info.py | UTF-8 | 2,258 | 2.875 | 3 | [] | no_license |
class WordInfo:
def __init__(self, word: str):
self.__word = word
self.__doc_ids = []
self.__count_each_docs = []
def get_word(self):
return self.__word
def set_word(self, word):
self.__word = word
def get_doc_ids(self):
return self.__doc_ids.copy()
... | true |
34f457c07a87b24de6ba86b48a07cce2e55ec049 | MoonJaeHoon/p3-dst-freshtomato | /code/train_valid_split.py | UTF-8 | 3,847 | 3.0625 | 3 | [] | no_license | import os
import argparse
from tqdm import tqdm
import pandas as pd
from sklearn.model_selection import train_test_split
from utils import load_json, save_json
from data_utils import set_seed
NUM_TURNS_Q1 = 12
NUM_TURNS_Q3 = 18
def stratified_subsample(args):
"""층화추출법을 통해 Dialogue 데이터로부터 표본 추출을 수행하는 함수
층화추출... | true |
16d697d28105393bab96e20459780387f0a8fba3 | nayan2000/LeetCode_Solutions | /Daily Challenge/2020/October/12_buddy_strings.py | UTF-8 | 851 | 3.09375 | 3 | [] | no_license | from collections import Counter
class Solution:
def buddyStrings(self, A: str, B: str) -> bool:
if len(A) < 2 or len(B) < 2:
return False
a = Counter(A)
b = Counter(B)
if a != b:
return False
if len(a) == 1:
return True
replacable ... | true |
bb4a49b261001ccf93a14b69a972e84077d3162b | yamauchih/ifgi-path-tracer | /ifgi/scene/Primitive.py | UTF-8 | 14,123 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
#
# Copyright 2010-2011 (C) Yamauchi, Hitoshi
#
"""IFGI Primitive
\file
\brief scene element primitives
"""
import sys
import math
import numpy
import Ray
import HitRecord
from ifgi.base import OrthonomalBasis
# ----------------------------------------------------------------------
class Primi... | true |
41296adc1998f8d842e94ff88837de6084b34c3f | Rohan-Sharma92/tiny_url_service | /app/encoders/encoder.py | UTF-8 | 1,996 | 2.6875 | 3 | [] | no_license | from app.cache.url_cache import URLCache
from app.models.encode_request import URLEncodeRequest
from app.cache.url_mapping import URLMapping
import string, logging
logger = logging.getLogger(__name__)
class Encoder(object):
'''
Encoder implementation to encode long URL to short URL using EncodingStrategy or ... | true |
6bfae9ba7dbb5e3ff2ef75989e88d9b0261c5dd8 | Titan4ik/meta_cats_alushta | /api_trainer.py | UTF-8 | 6,576 | 2.59375 | 3 | [] | no_license | n_window = 30
models_path = 'C:\\alushta\\meta_cats_alushta\\data\\models\\'
csvs = 'C:\\alushta\\meta_cats_alushta\\data\\datasets\\csv\\'
images = 'C:\\alushta\\meta_cats_alushta\\data\\plots\\'
from pathlib import Path
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing ... | true |
e6e66ce0f9f311f2d9de4fa619e5e41ec3ced202 | nickolas-black/Python | /разные программки/Написать функцию отрисовки смайлика в произвольной точке экрана.py | UTF-8 | 1,526 | 3.4375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import simple_draw
import turtle
import random
# Написать функцию отрисовки смайлика в произвольной точке экрана
# Форма рожицы-смайлика на ваше усмотрение
# Параметры функции: кордината X, координата Y, цвет.
# Вывести 10 смайликов в произвольных точках экрана.
sm = turtle.Pen()
sm.speed(0)
... | true |
f15d0413e9a8110a3e0235305bb6328acbeabdfd | wilmerbermudez/Juego-naves-pygame-bloques | /juego.py | UTF-8 | 5,012 | 3.0625 | 3 | [] | no_license | import pygame
import random
Ancho=1000
Alto=600
verde=[0,255,0]
blanco=[255,255,255]
azul=[0,0,255]
negro=[0,0,0]
imagen=[150,150]
poso=[450,50]
salud=100
cont=0
class Jugador(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image=pygame.Surface([50,50])
s... | true |
68ad54e9bbe623a72c6bb9551577cba5ee16b5b8 | Seanc0315/AE401-Python | /hi.py | UTF-8 | 54 | 3.703125 | 4 | [] | no_license | name = input("你的名字是:")
print("Hi,", name)
| true |
16dc9acefa429dc8dd2d25725c38c098bbe692d9 | TheBlackPrism/2048-AI | /statistics/generate_plots.py | UTF-8 | 5,010 | 2.90625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from collections import Counter
searchai_stats = [{ "name": "Heuristic", "csv": "searchai_heuristic.csv", "df": []},
{ "name": "Snakey", "csv": "searchai_snakey.csv", "df": []},
{ "name": "Snakey +", "csv": "searchai_snakey_plus.csv" , "df"... | true |
b7937d0465e2e41d68c48802d860a9f1e9c5c6e3 | KMongosso/Initiation-Project-Heads-or-tails- | /head_or_tails/predictors/test2.py | UTF-8 | 1,233 | 3.140625 | 3 | [] | no_license | #-*- coding: utf-8 -*-
from random import randint
from class_Predictor import *
#test :
########### oueveture de fichier #####
file = open("4.txt")
file = file.read()
file = file.split(" ")
##########################
####### initialisation de variables #####
#choisir le pattern
n=2
historic = []
memory = 400
###... | true |
1769bac2344dbee76e742b7b1e45ba556d352f65 | jonesmattc/adventofcode2017 | /dayTemplate.py | UTF-8 | 207 | 2.640625 | 3 | [] | no_license | def parseInput(input):
return [line for line in open(input, "r").read().split("\n")]
def partOne(input):
def partTwo(input):
print partOne(parseInput("day7.txt"))
print partTwo(parseInput("day7.txt")) | true |
9ada18092a28800dd36ae9d2a7867d965ce489ac | pag-tools/pena | /pena/tests/test_model.py | UTF-8 | 3,229 | 2.859375 | 3 | [] | no_license | import random
import unittest
from tname.core.model import Configuration, check_frequency
class TestConfiguration(unittest.TestCase):
def test_reflexivity(self):
self.assertEqual(Configuration(["plugin-A"]), Configuration(["plugin-A"]))
def test_commutativity(self):
plugins = ("plugin-A", "p... | true |
fea1682aec8faae75362bb4e492fa01f0cd653b5 | divyanshAgarwal123/PythonProjects | /aptech learning/number postive or negetive.py | UTF-8 | 199 | 3.796875 | 4 | [] | no_license | x=int(input("entre the a number"))
print("your number is ",x)
if(x >0):
print("your number is positive")
elif(x<0):
print("your number is negative")
if(x==0):
print("your number is zero") | true |
047f214df6e2a50c6b0917314d3368bf661b57a6 | CJLakey/Python-School-Projects | /Average_Temperatures.py | UTF-8 | 2,748 | 4.90625 | 5 | [] | no_license | def main():
def ComputeAverageTemp(HourlyTemperatures): # This is my function for calculating the average of the user entered numbers.
average = 0.0 # It works by defining th average as a float, iterates through the list, sums the total of all tempretures and divides them by the number of items in the lis... | true |
d5f1a9a649d36ba21159cfb1bfa1f78fe21ee1dd | MtTsai/Leetcode | /python/739.daily_temperatures.py | UTF-8 | 554 | 3.171875 | 3 | [] | no_license | class Solution(object):
def dailyTemperatures(self, temperatures):
"""
:type temperatures: List[int]
:rtype: List[int]
"""
queue = []
out = [0] * len(temperatures)
for i in range(len(temperatures)):
t_curr = temperatures[i]
for... | true |
d6ded994daa97bd4abacbdaef2d5e62b8a3b813f | indraastra/puzzles | /euler/prob010.py | UTF-8 | 423 | 3.734375 | 4 | [] | no_license |
MAX = 2_000_000
primes = [-1]*MAX
listofprimes = []
# 0 and 1 are not prime
primes[1] = 0
primes[0] = 0
# 2 is prime
i = 2
while i < MAX:
if ( primes[i] != 0 ):
primes[i] = 1
listofprimes.append(i)
j = 2*i
while j < MAX:
primes[j] = 0
j += i
else:
... | true |
2faba636aa607c851f5a867581d9b594c4528afb | piupom/Python | /tyyppi.py | UTF-8 | 1,383 | 3.6875 | 4 | [] | no_license | import sys
def printf(format, *args):
sys.stdout.write(format % args)
#floatin tarkastus
def is_float(n):
try:
float(n) # Type-casting the string to `float`.
# If string is not a valid `float`,
# it'll raise `ValueError` exception
except ValueError:
... | true |
9ccf5fb0746ec890097c8aecd3796d9886044054 | flav-io/flavio | /flavio/physics/bdecays/formfactors/b_p/bsz.py | UTF-8 | 1,968 | 2.546875 | 3 | [
"MIT"
] | permissive | import numpy as np
from functools import lru_cache
import flavio
from flavio.physics.bdecays.formfactors.common import z
from flavio.config import config
def pole(ff, mres, q2):
if mres == 0 or mres is None:
return 1
return 1/(1-q2/mres**2)
# the following dict maps transitions to mesons. Note that ... | true |
d96338dbd6d0552202ce8c1cc860ccecb3a0d68b | q737645224/python3 | /ML/SCIENCE/day03/mean.py | UTF-8 | 434 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import numpy as np
closing_prices = np.loadtxt(
'../data/aapl.csv',
delimiter=',',
usecols=(6),
unpack=False
)
mean = 0
for closing_price in closing_prices:
mean += closing_price
mean /= closing_prices.size
print(mean)
... | true |
630e0b82e63f5ceb27db49dc53898ee851e6627e | jayzane/leetcodePy | /sort/shell_sort.py | UTF-8 | 463 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | """
希尔排序
2020-12-06: 11:02.30;
"""
from sort import validatetool
def sort(data):
l = len(data)
gap = l // 2
while gap > 0:
for i in range(gap, l):
val = data[i]
j = i - gap
while j >= 0 and val < data[j]:
data[j + gap] = data[j]
j... | true |
10e64b4d3a7c39c22d73880ffac2c8481575ef7d | Shinseeker/IS211_Assignment4 | /sort_compare.py | UTF-8 | 3,941 | 3.90625 | 4 | [] | no_license | #!user/bin/env python
# -*- coding: utf-8 -*-
"""IS211 Assignment Week 4"""
import time
import random
def insertion_sort(a_list):
start = time.time()
"""Insertion list sort function."""
for index in range(1, len(a_list)):
current_value = a_list[index]
position = index
while posit... | true |
313e7cfd3d3ba54a77f7fab4e87b4006035c5956 | danigrant/kin-helloworld-math-game | /main.py | UTF-8 | 2,171 | 3.625 | 4 | [] | no_license | # This is the Kin SDK
import kin
# We'll be printing a few things to screen, so we also load pprint
from pprint import pprint
## for async await
import asyncio
## for random nums
import random
computer_account = ''
player_account = ''
player_keypair = ''
async def generate_math_problem():
a = random.randint(2,... | true |
a18f6edf7c476ac2a57796be31d6e03ea5c498f2 | tonylixu/architect-001 | /week07/load_test/run_test.py | UTF-8 | 2,055 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | import argparse
import LoadTester
from concurrent.futures import ThreadPoolExecutor, as_completed
import numpy as np
def create_load_tester(url, concurrent, times):
return LoadTester.LoadTester(url, concurrent, times)
def calculate_95_percentile(response_lists):
"""Calculate 95 percentile time"""
time_l... | true |
1ff6c23e362129ce083a22ae9e6c8f3f7c39d957 | AVladyslav/T-Rex | /t_rex_game_dqn.py | UTF-8 | 5,150 | 2.96875 | 3 | [] | no_license | import pygame as pg
from PIL import Image, ImageOps
import numpy as np
import copy
from model.cactus import Cactus
from model.ground import Ground
from model.dino import Dino
from model.text import Text
from utils.settings import Settings
class TRexGame:
def __init__(self):
# Reinforcement Learning stu... | true |
6e46e328d0dc73034b462dd45910d5ccf251c6c0 | aylinsglam/4.-Hafta-Odevler | /soru_2_yontem2.py | UTF-8 | 183 | 3.234375 | 3 | [] | no_license | liste=[1,2,1,10,1,1,1,20,53,1,1,5,19]
tane=0
for i in range(0,len(liste)):
if liste[i]==1:
tane+=1
print("Listenin içinde ", tane, "tane 1 rakamı bulunmaktadır")
| true |
8c50b186a5e41f274022826e4d825034158a72a3 | prateek3255/hackerearth_python | /codeArena_matrix.py | UTF-8 | 422 | 2.65625 | 3 | [] | no_license | import numpy as np
n,r,c=map(int,input().split());
arr=[]
for i in range(n):
l=list(map(int,input().split()))
arr.append(l)
if r!=0:
rows=list(map(int,input().split()))
if c!=0:
columns=list(map(int,input().split()))
a=np.array(arr)
if r!=0:
for i in rows:
arr[i-1]=arr[i-1][1:]+arr[i-1][:1]
... | true |
d8c0a0399c706da3f257c05bd99040a3733719a7 | mourga/ntua-slp-pytorch-ex-1 | /utils/nlp.py | UTF-8 | 663 | 3.3125 | 3 | [] | no_license | import numpy as np
def tokenize(text, lowercase=True):
pass
def vectorize(text, word2idx, max_length):
"""
Covert array of tokens, to array of ids, with a fixed length
and zero padding at the end
Args:
text (): the wordlist
word2idx (): dictionary of word to ids
max_lengt... | true |
b366b9dd7ad8bf51f6e5edad95dd0e5e1e369759 | htrahddis-hub/DSA-Together-HacktoberFest | /Patterns/leftstar.py | UTF-8 | 491 | 3.59375 | 4 | [
"MIT"
] | permissive | def pattern(n):
k = 2*n - 2
for i in range(0,n):
for j in range(0,k):
print(end=" ")
k = k -1
for j in range(0,i+1):
print("*",end="")
print("\r")
n = n - 1
for i in range(0,n):
for j in range(0,n):
print(end=" ")
... | true |
c4dec74d4b4221b5ea23f31d5335fb985a924552 | eteamin/blackfield | /project_setup.py | UTF-8 | 1,790 | 2.546875 | 3 | [] | no_license | import sqlite3
from blackfield.variables import DB_FILE, DB_TEST_FILE, TEST_PERSON, INVALID_CART
if __name__ == '__main__':
connection = sqlite3.connect(DB_FILE)
cursor = connection.cursor()
connection_to_test_db = sqlite3.connect(DB_TEST_FILE)
cursor_to_test_db = connection_to_test_db.cursor()
... | true |
b373ee6350457f6e8368507b907c904f0880a3d7 | luis-armando-perez-rey/learning-group-structure | /added_modules/architectures/teapot.py | UTF-8 | 2,308 | 2.59375 | 3 | [
"MIT"
] | permissive | import torch.nn as nn
import torch
import torch.nn.functional as F
def init_weights(m, gain):
if (type(m) == nn.Linear) | (type(m) == nn.Conv2d) | (type(m) == nn.ConvTranspose2d):
nn.init.orthogonal_(m.weight, gain)
nn.init.zeros_(m.bias)
class Encoder(nn.Module):
def __init__(self, n_out=4,... | true |
520328e1b5021733eb52bb2e329796bb8b2e0c61 | yvan674/minimal-mnist | /src/utils/to_pickle.py | UTF-8 | 1,045 | 2.84375 | 3 | [
"MIT"
] | permissive | """To Pickle.
Converts the pytorch tensor MNIST dataset to numpy versions through pickle.
Author:
Yvan Satyawan <y_satyawan@hotmail.com>
Created on:
April 10, 2020
"""
import pickle
import torch
from argparse import ArgumentParser
from os.path import join
def parse_args():
p = ArgumentParser(descriptio... | true |
43a826c954d17493b96bf6fdbb17136a02af9e09 | lesp/LV31-Python-Basics | /Project-3-Pick-A-Colour.py | UTF-8 | 661 | 3.15625 | 3 | [] | no_license | from gpiozero import LED, Button
from time import sleep
red = LED(17)
amber = LED(27)
green = LED(22)
red_button = Button(2)
amber_button = Button(3)
green_button = Button(4)
LEDS = [red,amber,green]
def lightup(colour):
for led in LEDS:
led.off()
if colour == "red":
red.on()
elif colour == ... | true |
3b6a4c8be3d353162a2541123d94c94036b86e99 | lelufig/program | /list/list4/list4-5a.py | UTF-8 | 87 | 3.296875 | 3 | [] | no_license | a = int(input("正の整数を入力してください"))
if a >= 0 :
print(a)
| true |
6a915d13784bf9e663926d2f9eb970b57e5b1379 | muxiuyufeng/muxiu | /evaluationexp.py | UTF-8 | 138 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python3
a=9
b=12
c=3
x=a-b/3+c*2-1
y=a-b/(3+c)*(2-1)
z=a-(b/(3+c)*2)-1
print('X=',x)
print('Y=',y)
print('Z=',z) # 10 7 4
| true |
8b7c38690851eac8bb2368ee4296e16640d57290 | urcoder4u/TIC-TAC-TOE | /tic_tac_toe.py | UTF-8 | 3,741 | 3.59375 | 4 | [] | no_license | ttt={'1':' ','2':' ','3':' ','4':' ','5':' ','6':' ','7':' ','8':' ','9':' '}
l=[]
flag=0
def box(ttt):
print("\t\t\t",end=' ')
print(ttt['1']+' | '+ttt['2']+' | '+ttt['3'])
print("\t\t\t---+---+--")
print("\t\t\t",end=' ')
print(ttt['4']+' | '+ttt['5']+' | '+ttt['6'])
print("\t\t\t---+... | true |
942fcdbedbbe1b404723d5979a14c654afb32c43 | apculley/Stat-504 | /HW_3/HW3.py | UTF-8 | 6,813 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 16 19:33:33 2015
@author: thyme
data.info()
data.describe
data.iloc[:,337].describe()
len(data.columns)
len(data.index)
for i in range(len(data.columns)):
if sum(data.iloc[:,i].isnull())>0:
print data.iloc[:,i].describe()
data=data.iloc[:,0:338]
"""
import ... | true |
d46738a23968d161223dc0bd7be7a14188c97e19 | polina-pavlova/epam_python_feb21 | /homework10/stoks.py | UTF-8 | 6,110 | 2.875 | 3 | [] | no_license | """
Ваша задача спарсить информацию о компаниях, находящихся в индексе S&P 500 с данного сайта:
https://markets.businessinsider.com/index/components/s&p_500
Для каждой компании собрать следующую информацию:
Текущая стоимость в рублях (конвертацию производить по текущему курсу, взятому с сайта центробанка РФ)
Код комп... | true |
d1bea86876153bd19f5dde4f9793e986fd91962c | yangminghuan/rec-sys-pytorch | /NCF/NCF.py | UTF-8 | 4,107 | 3.015625 | 3 | [] | no_license | """
@Author: YMH
@Date: 2021-2-27
@Description: Neural network-based Collaborative Filtering论文模型代码复现
"""
import torch
import torch.nn as nn
class GMF(nn.Module):
"""
广义矩阵分解模型
"""
def __init__(self, user_num, item_num, embed_dim):
"""
:param user_num: 用户数量
:param item_num: 项目数量... | true |
812049d3b6e06f690f84c303d99509268778ea17 | axelskyttner/flower-classification | /main.py | UTF-8 | 605 | 2.625 | 3 | [] | no_license | from sklearn.datasets import load_iris
from matplotlib import pyplot as plt
from pandas import DataFrame
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
import numpy as np
iris = load_iris()
X = DataFrame(iris.data, colu... | true |
dd9839550d2b23cd8373ed35f437f1444b469bcf | LIT-Midas/LITHackathon | /lamda-ocr/merge-files/borb/toolkit/export/markdown_to_pdf/markdown_transformer/text/blockquote_transformer.py | UTF-8 | 2,125 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This implementation of BaseMarkdownTransformer handles block quotes
"""
import typing
from decimal import Decimal
from borb.pdf.canvas.color.color import HexColor
from borb.pdf.canvas.layout.text.chunks_of_text import HeterogeneousParagraph
from borb.toolkit.export.ma... | true |
d55b84ef68fc516b1643a2425890d1530a507b12 | gauravrmazra/data-science-learning | /python-programming-beginner/List Operations-3.py | UTF-8 | 919 | 4 | 4 | [
"MIT"
] | permissive | ## 2. Parsing the File ##
f = open("la_weather.csv", 'r')
weathers = f.read().split("\n")
weather_data = []
for weather in weathers:
weather_data.append(weather.split(','))
## 3. Getting a Single Column From the Data ##
# weather_data has already been read in automatically to make things easier.
weather = []
fo... | true |
d3bf6f9f8119997d679bb752864de0d05b4dbeb9 | pogross/bitesofpy | /61/paw.py | UTF-8 | 690 | 3.21875 | 3 | [] | no_license | from collections import namedtuple
import random
import string
from typing import List
ACTIONS = ["draw_card", "play_again", "interchange_cards", "change_turn_direction"]
NUMBERS = range(1, 5)
PawCard = namedtuple("PawCard", "card action")
def create_paw_deck(n: int = 8) -> List[PawCard]:
if n > 26:
rai... | true |
c860caffa49fafa0c76c467ad1d018265103494a | sugar-activities/4295-activity | /ClicActivity/Activity.py | UTF-8 | 16,483 | 2.515625 | 3 | [] | no_license | '''
This file is part of Sugar-Clic
Sugar-Clic is copyrigth 2009 by Maria Jose Casany Guerrero and Marc Alier Forment
of the Universitat Politecnica de Catalunya http://www.upc.edu
Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier
@ upc.edu
Sugar-Clic is free softwar... | true |
3d8b5d904351c4edcc68ced38f81e93d8893f76c | obiltschnig/LetMeCreateIoT | /tests/6lowpan/server.py | UTF-8 | 535 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python3
"""
Test server for the clicker to send a hello and let the server bounce it back
"""
import socket
IP = "::"
PORT = 3000
sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
sock.bind((IP, PORT))
print("Server initialised, awaiting data. Use Ctrl + C to stop")
while True:
data, metadata ... | true |
c3c024321bc28f2b86d7893aebc6726c4398c343 | fanatic/adventofcode | /2017/day_5.py | UTF-8 | 1,370 | 3.421875 | 3 | [] | no_license | #!/bin/env python
""" Advent of code """
def part_1(lines):
"Day 4 Algorithm"
pc = 0
offsets = [int(line) for line in lines]
steps = 0
while True:
if pc >= len(offsets):
break
# print_offsets(pc, offsets)
old_pc = pc
pc = old_pc + offsets[old_pc]
... | true |
2456b72675b21754ee4f11fe456dc6fc81c39a15 | aldemirerdogan/Python | /deneme.py | UTF-8 | 236 | 4.0625 | 4 | [] | no_license | sum = 0.0
num = 0
done = False
while not done:
height = float(input("Enter a height or 0 to finish: "))
if height <= 0:
done = True
else:
sum += height
num += 1
print("Average height is ", sum / num) | true |
364f604a6a213249d924432ea0f676af7e7acdb3 | Yuya-Furusawa/Self-Study | /deep-learning/intro_keras/categorical_class.py | UTF-8 | 1,926 | 2.671875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from keras import models
from keras import layers
from keras.datasets import reuters
from keras.utils.np_utils import to_categorical
def vectorize_sequences(sequences, dimension=10000):
results = np.zeros((len(sequences, dimension)))
for i, sequence in enumerate(seq... | true |
eb10d00fd54426a6c92cd28e3eba91d0fdeee957 | harryjohn14/Python-Repository | /My Repository/Lesson 1- More.py | UTF-8 | 1,066 | 2.84375 | 3 | [] | no_license | """
Attributes of Michael Jackson's Heal the World song and Dangerous Albulm
"""
Song = "Heal the World"
DurationInSeconds = 383
Artist = "Micheal Jackson"
Composers = "Michael Jackson and Marty Paich"
Director = "Joe Pytka"
Albulm = "Dangerous"
Released = 1991 ## Albulm was ereleased in 1991
... | true |
894fe11f60d69cd1529acc26a160aa4f82c23a05 | numRandom/new_pythonCode | /jc_02_累加求和.py | UTF-8 | 217 | 4.15625 | 4 | [] | no_license | # 1、定义一个整数变量记录循环的次数
i = 0
# 2、开始循环
sum = 0
while i <= 100:
sum += i
i += 1
print(" i 的值为 %d " %i)
print(" 0~100 之间累加的结果为:%d" % sum) | true |
f4ae1e9eafd9432d90b8b55232173adebbc1299b | KeckCAVES/flow | /src/Dynamics/RungeKutta4Step.py | UTF-8 | 2,321 | 2.59375 | 3 | [] | no_license | TAB = " "
def step(n):
code = []
code.append( "Scalar stepSize = realParamValues[0];" )
code.append( "" )
code.append( "/* Calculate first half-step vector: */" )
code.append( "model(v, v0);" )
for i in range(n):
code.append( "v0[{0}] *= stepSize * Scalar(0.5);".format(i) )
cod... | true |
7dfa13a73c101e7342958ecb876568760581cf9f | smiroshnikov/ebaPo4tu | /playground/prep/my_sims/netflowsim.py | UTF-8 | 10,474 | 2.671875 | 3 | [] | no_license | import binascii # read pydoc .pcap file is a binary file , we need to convert HEX values to binary eventually
import os
from datetime import datetime, timedelta
import sys
import time
import copy
# read pydoc , we need this to perform full copy from variable to variable (works on lists , tuples , dictionaries)
import ... | true |