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 |
|---|---|---|---|---|---|---|---|---|---|---|
51e640393d69803172e8475b855dc8bbbaefe749 | luxuguang-leo/everyday_leetcode | /00_leetcode/150.evaluate-reverse-polish-notation.py | UTF-8 | 1,307 | 3.5 | 4 | [] | no_license | #
# @lc app=leetcode id=150 lang=python
#
# [150] Evaluate Reverse Polish Notation
#
# @lc code=start
class Solution(object):
def __init__(self):
self.operators = {
'+':lambda y, x: x+y,
'-':lambda y, x: x-y,
'*':lambda y, x: x*y,
'/':lambda y, x: int(operato... | true |
dbd2b1f04aaad7f364217d1d35bc4ac2f4ca243a | AaronAikman/MiscScripts | /Py/ProjectEuler/ProjectEuler_013_Large_Sum.py | UTF-8 | 299 | 3.53125 | 4 | [] | no_license |
# Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.
filename = 'ProjectEuler_013_Large_Sum_Number.txt'
f = open(filename, 'r')
large_num = []
for line in f.readlines():
large_num.append(int(line))
big_sum = sum(map(int, large_num))
print str(big_sum)[:10]
| true |
ec8f7201bc773d1f9693a715caf65afa6d98f5bd | rcbadiale/eshop-prices | /helpers/table.py | UTF-8 | 1,136 | 3.125 | 3 | [] | no_license | from helpers.template import card_template, html_template
def data_to_html(games: list):
"""
Convert games data into a HTML Table for the email.
args:
games (list): List of Game Objects with prices and discounts
"""
should_return = False
cards = ''
for game in games:
if ga... | true |
f04993b9b6e4e728c0740b8619ad22330ae6f322 | matanbroner/Bucket | /scripts/official_tests/test.py | UTF-8 | 29,348 | 2.515625 | 3 | [] | no_license | ###################
# Course: CSE 138
# Date: Fall 2020
# Assignment: #4
# Author: Reza NasiriGerdeh, Aleck Zhang
# Email: rnasirig@ucsc.edu, jzhan293@ucsc.edu
###################
import unittest
import requests
import time
import os
from client import Client
addResponse_Success = {
"message": "Added successfully... | true |
ec5665168c4ad94dda7e6ccbcb4824d6ae69203e | LiuYPersonal/Object-Detection-with-Cascaded-AdaBoost-Classification | /classify.py | UTF-8 | 1,527 | 2.6875 | 3 | [] | no_license | import numpy as np
import cv2
#classify testing data
def classify(features,filepath_classifier,stage):
#load classifier
feature_idxs=np.loadtxt(filepath_classifier+'feature_idx'+str(stage)+'.txt', dtype='int')
polars=np.loadtxt(filepath_classifier+'polars'+str(stage)+'.txt')
thetas=np.loadtxt(filep... | true |
4b5dabafa6a10a0340c294e9c9a612aba6916cbc | AnthonyLuZhu/CorePythonProgramming | /Chapter2/2-13.py | UTF-8 | 659 | 3.5 | 4 | [] | no_license | print 'I like to use the internet for: '
for item in ['e-mail','net-surfing', 'homework','char']:
print item
print 'I like to use the internet for: '
for item in ['e-mail','net-surfing', 'homework','char']:
print item,
print
who = 'knights'
what= 'Ni'
print 'We are the ', who , 'who say' , what , wh... | true |
99b295a38e4da819f11818e70129adc0296f8e24 | agnusmaximus/CS242Papers | /insert_entry.py | UTF-8 | 957 | 2.703125 | 3 | [] | no_license | import sqlite3
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--title", type=str, required=True, help='Paper title')
parser.add_argument("--link", type=str, required=True, help='Paper links')
parser.add_argument("--tags", type=str, default="", help='Paper tags (comma separated)')
parser.add_ar... | true |
02483e03f3c45b44b313bb46cebb8491ba352a70 | dhellmann/athensdocket | /docket/vtr.py | UTF-8 | 17,532 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
#
# Copyright 2008 Doug Hellmann.
#
"""VagueTextRecord format parser
"""
from pyparsing import *
# Import system modules
import datetime
import fileinput
import logging
import time
# Import local modules
# Module
log = logging.getLogger(__name__)
def show_parse_action(f):
"""Decorator ... | true |
71366897a13b8a52914dba78b276d332ac2207d3 | 2kindsofcs/exercise | /Backjoon/Backjoon-1010-bridge.py | UTF-8 | 484 | 3.328125 | 3 | [] | no_license | factoList = [1]
def facto(n):
global factoList
if n <= len(factoList):
return factoList[n-1]
else:
factoList.append(facto(n-1)*n)
return factoList[n-1]
def howManyCase(N, M):
if N == M:
print(1)
else:
diff = M - N
print(int(facto(M)/(facto(N)*facto(d... | true |
00059d7214212b22e361b41d35ec51202595e23d | WilliamFWG/Warehouse | /python/PycharmProjects/py03/day01/myfork2.py | UTF-8 | 291 | 3.109375 | 3 | [] | no_license | import os
print('Starting....')
for i in range(3):
rtvalue=os.fork() #生成子进程 [1,2] 和[2]
if not rtvalue: #rtvalue 等于0时为子进程, if not rtvalue 即 判定该进程为子
print('Hello world',rtvalue)
exit() #遇exit彻底结束
print('Done')
| true |
c1d24466535efbd9231e2aeb4b862112b1fd222e | insightcampus/2020-inno-nlp-c-statistics | /gmnoh/gmnlp/analyzer/documentclassifier.py | UTF-8 | 5,540 | 2.53125 | 3 | [] | no_license | # import numpy as np
# import pandas as pd
# class nbc():
# def __init__(self, content, all_cls, keywords, k = 0.5):
# self.content = content
# self.all_cls = all_cls
# self.k = k
# self.keywords = keywords
# self.cls = list(set(all_cls))
# def train(self):
# #... | true |
6a65b0eb26a7659e8b0826d80ff6a0d9680cc13d | Surya-98/RL-Board-Games | /Chess/compete.py | UTF-8 | 3,209 | 3.03125 | 3 | [] | no_license | import numpy as np
import copy
import time
class Compete() :
def __init__(self, player_1, player_2, chess_utils) : # player1 - old network ; player2 - new network
self.player_1 = player_1
self.player_2 = player_2
self.chess_utils = chess_utils
def play(self, num) :
switch_count = int(num/2)
players = [se... | true |
58984afb22cc25b35fc359f3857c8bffcb7784ed | bbrangeo/deep-geometry | /deep_geometry/geom_scaler.py | UTF-8 | 1,817 | 2.65625 | 3 | [
"MIT"
] | permissive | import numpy as np
from deep_geometry.vectorizer import FULL_STOP_INDEX
def fit(vectors):
means = localized_mean(vectors)
min_maxs = []
for index, data_point in enumerate(vectors):
full_stop_point = data_point[:, FULL_STOP_INDEX].tolist()
try:
full_stop_point_index = full_sto... | true |
15858ac94c66330540320270ec31ba174f0d0a9b | Reginald-Lee/biji-ben | /uoft/CSC148H1F Intro to Comp Sci/@week8_binary_search_trees/@@Exercise8/list_binary_tree.py | UTF-8 | 2,818 | 3.828125 | 4 | [
"MIT"
] | permissive | # ListBinaryTree class
#
# CSC148 Fall 2014, University of Toronto
# Instructor: David Liu
# ---------------------------------------------
# STUDENT INFORMATION
#
# List your information below, in format
# <full name>, <utorid>
# Rui Qiu, qiurui2
# ---------------------------------------------
class List... | true |
d094a2ff65a665a167c7752eee10a6711b2b61af | Diogo65/python3-fundamentals | /src/CursoPython-Desafios/desafio007.py | UTF-8 | 244 | 4.0625 | 4 | [] | no_license | #Desenvolva um programa que leia as duas notas de um aluno, e calcule e mostre a sua média
nota1 = float(input('Digite a primeira nota; '))
nota2 = float(input('Digite a segunda nota: '))
m = (nota1 + nota2) / 2
print('Média: {}'.format(m)) | true |
05d6c558dcbabce92cbaefcfb3f9704b8fb5278e | funywill/FirstContactWithTensorFlow-2ndEdition | /MultiLayerNeuralNetworks_slim.py | UTF-8 | 2,847 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | """
https://www.tensorflow.org/tutorials/layers
"""
import input_data
import tensorflow as tf
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
x = tf.placeholder("float", shape=[None, 784])
y_ = tf.placeholder("float", shape=[None, 10])
x_image = tf.reshape(x, [-1, 28, 28, 1])
keep_prob = tf.placehold... | true |
62c2002dd3c825e3e439f06ee1be5199454992f1 | findlay-forsblom/2DT00E-DegreeProject | /Algorithm/plotResults.py | UTF-8 | 2,640 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 11 15:48:58 2020
@author: findlayforsblom
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
trainingError = np.array([0.288, 0.208, 0.140, 0.208, 0.312, 0.226, 0.225, 0.927, 0.171, 0.077]) * 10 **(-3)
validationError = np.... | true |
6267215b4725a8e87eb41e5945c2276a3121de44 | stevalang/Coding-Lessons | /SoftUni/Python Developmen/Python-Basics/1_first_step_in_coding/expression.py | UTF-8 | 310 | 3.625 | 4 | [] | no_license | """
First Steps In Coding
Task 02 Expression
Write a Python console program that calculates and prints the value of the following numeric expression:
(3522 + 52353) * 23 - (2336 * 501 + 23432 - 6743) * 3
"""
expression_result = ((3522 + 52353) * 23 - (2336 * 501 + 23432 - 6743) * 3)
print(expression_result)
| true |
d62216307ba9a360c5f81043275888bbfa7e9116 | MauSDJ/ztm-course | /projects/twitter-bot/tweettweet.py | UTF-8 | 943 | 2.6875 | 3 | [] | no_license | import tweepy
import time
import os
from dotenv import load_dotenv
load_dotenv()
CONSUMER_KEY = os.environ.get('CONSUMER_KEY')
CONSUMER_SECRET = os.environ.get('CONSUMER_SECRET')
ACCESS_TOKEN = os.environ.get('ACCESS_TOKEN')
ACCESS_TOKEN_SECRET = os.environ.get('ACCESS_TOKEN_SECRET')
auth = tweepy.OAuthHandler(CONS... | true |
40ebe392e7703fbef0bd7163341677f28b82a389 | jsdessureault/ros_snn | /src/plot_utils/plot_connectivity.py | UTF-8 | 6,984 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
'''
Filename: SNN.py
Author: Jean-Sebastien Dessureault
Date created: 01/06/2016
Python version 2.7
'''
from brian2 import *
prefs.codegen.target = "cython"
import sys
import rospy
import numpy as np
import time
import string
from lxml import etree
import matplotlib.pyplot as plt
import random ... | true |
c4ad99f19c76f14995d79e0b6d60cc111bde970d | Lucasbertilima/TCC-Cedup | /app/dominios/Produtos/controller.py | UTF-8 | 2,269 | 2.75 | 3 | [] | no_license | from typing import List
from database.database import salvar
from app.dominios.Produtos.modelo import Produto
def Criar(nome, desc, cat_id, nome_categoria, peso, preco, qtd, qtdm) -> Produto:
#categoria = criar_categoria(dados['categoria'])
produto = Produto(nome=nome,
descricao=desc,
... | true |
85e968849b0180b04517d6afd3c87554bbc9e830 | int-brain-lab/ibllib | /examples/one/histology/docs_find_previous_alignments.py | UTF-8 | 4,623 | 2.84375 | 3 | [
"MIT"
] | permissive | """
Get previous ephys alignments
=============================
Extract channel locations from reference points of previous alignments saved in json field of
trajectory object
Create plot showing histology regions which channels pass through as well as coronal slice with
channel locations shown
"""
# import m... | true |
147bf0461e927480ea4075a0e2f981367fd96864 | SaladAss87/PythonMidTermQuesSol | /Python Mid Term Ques Problem 4.py | UTF-8 | 673 | 3.921875 | 4 | [] | no_license | #Determining The Economic Order Quantity
demandRate = eval(input("Enter The Demand Units: "))
setupCost = eval(input("Enter The Setup Cost: "))
holdingCost = eval(input("Enter The Holding Cost Per Item: "))
EOQ = ((2*demandRate*setupCost)/holdingCost)**.5
print("The Economic Order Quantity is ",round(EOQ), " Items")... | true |
b5ffd3fa77ddd4ded08f3d4ab46822df3c9c31ad | saikumar-divvela/programs | /lang/python/tools_apps/calc.py | UTF-8 | 2,460 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python
"""
Calculator
"""
from __future__ import division
import math
'''
TODO
app
design the screen
print the screen inputs
calculate and print the result
error handling
'''
import logging
import sys
def rd_calc(p ,time, i, freq):
print p,i,time,freq
n = 12/freq # numnber of times interest i... | true |
9144cbbecf3e74a59306789d418dc5ba6c51e90c | fukushiki/AtCoder | /ABC193/A.py | UTF-8 | 105 | 2.515625 | 3 | [] | no_license | def resolve():
A, B = map(int, input().split())
ans = 100 - (B/A) * 100
print(ans)
resolve() | true |
9e4f2f7c2f7c63a4bb765cda9f997093773e3d5b | piuma/howoldis | /tests/test_app.py | UTF-8 | 1,021 | 2.609375 | 3 | [] | no_license | from main import app
import unittest
import os
import tempfile
from flask import url_for
class AppTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, app.config['DATABASE'] = tempfile.mkstemp()
self.app = app.test_client()
self.app.testing = True
def tearDown(self):
""... | true |
f287b0986720ea9b87411ab46b36a57bbd1ed775 | stackingfunctions/practicepython | /src/06-string_list.py | UTF-8 | 125 | 4.09375 | 4 | [
"MIT"
] | permissive | str = input("Enter a string: ")
if str.lower() == str.lower()[::-1]:
print("Palidrome")
else:
print("Not palidrome") | true |
c657cc10157cabbb4cf56d5976b718f8649b32a8 | ashraf-a-khan/Leetcode-Python | /checkInclusion.py | UTF-8 | 148 | 3.0625 | 3 | [] | no_license | s1 = "ab"
s2 = "eidbaooo"
s3 = sorted(s1)
s4 = sorted(s2)
s1Sorted = "".join(s3)
s2Sorted = "".join(s4)
if s1Sorted in s2Sorted:
print(True)
| true |
f2560d8ed63639dbfbedddc88d516f36c1d2c86c | nozomi254/g_hw | /g_hw_3.py | UTF-8 | 4,012 | 4.0625 | 4 | [] | no_license | #読む たぶん整数と小数を整数と小数にするやつ
def readNumber(line, index):
number = 0
while index < len(line) and line[index].isdigit():
number = number * 10 + int(line[index])
index += 1
if index < len(line) and line[index] == '.':
index += 1
keta = 0.1
while index < len(line) and line[index].isdigit():
numb... | true |
628f0d1a20448ea6ecc637727acd82d454beb43e | jkerry/orna-raid-resource-bot | /src/raid/logic/discord_parsers.py | UTF-8 | 11,720 | 2.734375 | 3 | [] | no_license | import re
import inspect
from raid.logic.operators import Operators
from raid.data.kingdom import Kingdom
from datetime import datetime
import math
class MessageParser:
configure_channel_pattern = re.compile(r'configure channel\s*(\S+)')
configure_command_channel_pattern = re.compile(r'configure command channe... | true |
9118afde1bf901819980d339e2aad9a35d1c4a69 | daniel-reich/ubiquitous-fiesta | /ojBNREQrg7EW9ZzYx_11.py | UTF-8 | 781 | 3 | 3 | [] | no_license |
import re
def count_eatable_chocolates(total_money, cost_of_one_chocolate):
total_money = int(re.findall(r'-?\d+', total_money)[0])
cost_of_one_chocolate = int(re.findall(r'-?\d+', cost_of_one_chocolate)[0])
if cost_of_one_chocolate <= 0 or total_money < 0:
return 'Invalid Input'
current_ea... | true |
84d528dea952aefa926522d37ae5b09392bf46f5 | fuchsto/hwloc | /utils/lsnettopo/viz-networkx.py | UTF-8 | 2,450 | 2.828125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/python
# Copyright © 2013 University of Wisconsin-La Crosse.
# All rights reserved.
#
# See COPYING in top-level directory.
#
# $HEADER$
#
# You will need the following libraries to use this sample script.
# NetworkX
# http://networkx.github.io/
# Matplotlib
# http://matplot... | true |
5530d02ddf7e689f0a265370b6a1e5f01b1a6a0f | kimsal/challenge | /python_django/my_app/serializers.py | UTF-8 | 4,027 | 2.515625 | 3 | [] | no_license | from django.contrib.auth.models import User, Group
from rest_framework import serializers
from models import School, Student
from rest_framework_nested.serializers import NestedHyperlinkedModelSerializer
from rest_framework.exceptions import APIException
from rest_framework_nested.relations import NestedHyperlinkedRela... | true |
f4708095093ba9e43f5615141c83860cb2488597 | YoinkBird/dataMiningFinal | /feature_definitions.py | UTF-8 | 10,626 | 2.546875 | 3 | [] | no_license | import pandas as pd
#df.append(pd.DataFrame({'newthing':{'type':'str'}}).T
'''
register attrributes here which need to be defaulted to False
this is almost any new attribute
'''
def get_list_of_attributes():
attlist = ['target','dummies','jsmap']
return attlist
def get_feature_defs():
# data.dropna().inf... | true |
09486901198d5abdbc9fc9ee9aae326d72c22c14 | WindyIce/Musical_Synthesis | /pycwt_tutorial.py | UTF-8 | 7,410 | 2.8125 | 3 | [] | no_license | """
In this example we will load the NINO3 sea surface temperature anomaly dataset
between 1871 and 1996. This and other sample data files are kindly provided by
C. Torrence and G. Compo at
<http://paos.colorado.edu/research/wavelets/software.html>.
"""
# We begin by importing the relevant libraries. Please make sure ... | true |
ff4fa63491ad88dcef6d88be5c5c57a8b98743f8 | SebGoliot/oc_p8-purbeurre | /tests/accounts/test_models.py | UTF-8 | 2,522 | 2.828125 | 3 | [] | no_license | from django.test import TestCase
from accounts.models import CustomUser, CustomUserManager
class TestModels(TestCase):
"""Those tests checks the behaviour of the accounts.models"""
@classmethod
def setUpClass(cls) -> None:
"""Tests setup"""
super(TestModels, cls).setUpClass()
cls.... | true |
1538e2775d6996087f7229780ffc07cb4a913c85 | CrazyGalEt/PEE | /Raspberry/Database/database_insert_user.py | UTF-8 | 3,945 | 3.4375 | 3 | [] | no_license | # detPole - Andre Brandao, Emanuel Pereira, Tiago Lima
# File to insert data into database
# File format must be csv:
# First line (Company): Company, company name
# Next Lines (Users): Name, RFID, Contact, email, Citizen, Address, Birthdate
import csv
import pymysql
Host = "localhost" # IP address of the MySQL dat... | true |
bccbe9003294ffca65c7782d4125b5dacf57cd97 | dyspop/baywatch | /originals/bayes_calc_simplified.py | UTF-8 | 2,340 | 2.859375 | 3 | [] | no_license | from numpy.random import beta as beta_dist
from numpy import percentile
import numpy as np
N_samp = 10000000 # number of samples to draw
c = 1 #used to vary sample size by a scalar multiplier
## INSERT YOUR OWN DATA HERE
clicks_A = (44)*c
views_A = (9610)*c
clicks_B = (426)*c
views_B = (83617)*c
alpha = 1#30 #prior
... | true |
915230f89f664720f86fb165e053a78ada4535ec | ArifSohaib/player_tracking | /parse_log.py | UTF-8 | 1,128 | 2.78125 | 3 | [] | no_license | import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--inputFile", type=str, help="the log file to parse")
parser.add_argument("-o", "--outputFile", type=str, help="the output log file")
args = parser.parse_args()
if(args.inputFile == None):
inputFile =... | true |
1d35bb14308d5b2abf6d1ad2ed59a4b1a86ec2ba | musergi/ppcnn | /sequential_ppcnn/tests/ratio_thresh.py | UTF-8 | 1,343 | 3.046875 | 3 | [] | no_license | import numpy as np
import random
def get_ratio_thresh_delta(delta):
ratio_thresh_deltas = []
nodes = range(0, len(deltas))
layers = range(0, len(deltas[0]))
for layer in layers:
layer_weights = list()
layer_max_delta = deltas[0][layer]
for node in nodes:
layer_weight... | true |
f3d9fe48e9fbf03b54ce42086efa442ace53e1a5 | Junjun1guo/improvedWuBaselineCorrection | /LHSamples.py | UTF-8 | 1,723 | 3.0625 | 3 | [
"MIT"
] | permissive | #coding=utf-8
import numpy as np
import matplotlib.pyplot as pl
class Sample():
def __init__(self,bounds,N):
"""
initial data
bounds: variable bounds, such as bounds=[(10,21),(21,34)]
N:sample numbers
"""
self.bounds=bounds
self.N=N
self.D=len(self.bounds)
def LHSample( self):
res... | true |
739ffeb2e70148b502f4c3ed73c04eda8c35ac91 | Lobarr/interview-practice | /ds/stringBuilder.py | UTF-8 | 303 | 3.40625 | 3 | [] | no_license | from ds.arrayList import ArrayList
class StringBuilder:
def __init__(self):
self.words = ArrayList(4)
def append(self, word):
self.words.insert(word)
def toString(self):
words = filter(lambda x: x is not None, self.words.getList())
return " ".join(words)
| true |
66b9a96e516f810fd2bed5c914890832b5ad6033 | MightyMidhun/Login-form-using-tkinter | /login form tkinter.py | UTF-8 | 1,036 | 3.296875 | 3 | [] | no_license | from tkinter import * #to import the tkinter module
from tkinter import messagebox
# This to clear all the values enter by the user
def clear():
t1.delete(0,10)
t2.delete(0,10)
# This to function after user clicking the submmitbutton.
def login():
a=(t1.get())
b=(t2.get())
if ... | true |
3c1df0cc3ccd2ad590c5f12f8593291863a0423c | michalbali256/emida | /eval/sum_n.py | UTF-8 | 1,400 | 2.609375 | 3 | [] | no_license | import matplotlib.pyplot as plt
from matplotlib.collections import EventCollection
import numpy as np
import json
import sys
with open("out-graph.json","r") as fh:
data = json.load(fh)
part = sys.argv[1]
fig, ax = plt.subplots(figsize=(8,4))
yerr = []
sizes = [(20,20),
(20,80),
(50,50),
(50,80),
(80,80)]
for... | true |
f9ae732d5712729978afbf056db390b6aea0d0df | albertfougy/pytest-docker-flask | /services/bank.py | UTF-8 | 665 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
from flask import Flask, request
import json
app = Flask("bank")
_accounts = {
"10011002": {
"name": "Alice",
"balance": 100
},
"10011003": {
"name": "Bob",
"balance": 200
}
}
@app.route("/account-details", methods=["POST"])
def account_details()... | true |
df9d30ea0ab85023012356d3e1ab2bcdb5ac57d2 | AdeDZY/ShardFeature | /efficiency-ext.py | UTF-8 | 1,664 | 2.5625 | 3 | [] | no_license | #!/opt/python27/bin/python
import numpy as np
import os
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("partition_name")
parser.add_argument("--dataset", "-d", choices=["cwb", "gov2"], default="cwb")
parser.add_argument("--query", "-q", help="print re... | true |
f5a52985bb7aa2354b9241922033e266d764e4f2 | LinaNato/Sistemas_distribuidos | /main_3.py | UTF-8 | 632 | 3.84375 | 4 | [] | no_license | import time
numero = int(input('Digite um numero: '))
inicio = time.time()
divisores = 0
if numero == 0 or numero ==1:
print("Não é primo")
fim = time.time()
Time_2=fim - inicio
print(f't2: {Time_2:.10f}')
else:
for divisor in range(1, numero):
if numero % divisor == 0:
diviso... | true |
9ad7541793ea39a7af8d8f2fac7977fefc7ac307 | Dio990521/SA_emo_dialog | /utils/scheduler.py | UTF-8 | 1,228 | 2.90625 | 3 | [
"MIT"
] | permissive | from torch.optim.lr_scheduler import LambdaLR
import math
def get_cosine_schedule_with_warmup(optimizer, num_warmup_steps, num_training_steps, num_cycles=0.5, last_epoch=-1, min_lr_ratio=None):
""" Create a schedule with a learning rate that decreases following the
values of the cosine function between ... | true |
45ebb8beb7ca842e7b19900fa2871db35ac4a55c | gabriellaec/desoft-analise-exercicios | /backup/user_106/ch1_2020_03_20_14_54_38_734085.py | UTF-8 | 64 | 2.65625 | 3 | [] | no_license | def calcula_valor_devido(c,i,n):
y=c*((1+i)**n)
return y | true |
7727fe4e856296c7ba64e0bb928eb65108d1b6cd | shrobinson/python-problems-and-solutions | /maximum_of_a_sequence (2,6a).py | UTF-8 | 275 | 3.84375 | 4 | [] | no_license | #A sequence consists of integer numbers and ends with the number 0. Determine the largest element of the sequence.
#For example, on input
#4
#7
#2
#0
#output must be
#7
n = int(input())
max = 0
while n != 0:
if n > max:
max = n
n = int(input())
print(max)
| true |
1186506c1d21da86d82f6da36b594fe6f7d39deb | fuwu360/Spider | /jixie/pipelines.py | UTF-8 | 1,588 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
from openpyxl import Workbook
from jixie import settings
import pymongo
#
# class JixiePipeline(object):
#
# def __init__(s... | true |
b2fc4afb8d28a01f0c7d6eec183afef02c417339 | VinayakBagaria/Python-Programming | /Code Jam/Country Leader Small.py | UTF-8 | 365 | 3.203125 | 3 | [] | no_license | test=int(input())
for i in range(0,test):
n=int(input())
counts=dict()
for k in range(0,n):
string=input()
counts[string]=len(set(''.join(string.split(' '))))
maxVal=max(counts.values())
countList=[name for name in counts.keys() if counts[name]==maxVal]
print('Case #... | true |
f4b436274f15cf4f4c3797d2fb75e206fb3e3a2b | SMU-2020-2-Computer-Vision/Kim_Soohwan | /04_videos_and_cameras/01_load_and_display_videos.py | UTF-8 | 545 | 2.78125 | 3 | [] | no_license | import cv2
import os
# Get the path to the current file
cwd = os.path.dirname(os.path.abspath(__file__))
# Change the working directory
os.chdir(cwd)
# Create a video capture object
video_name = 'vtest.avi'
capture = cv2.VideoCapture(video_name)
while True:
# Read a video frame
ret, frame = capture.read()
... | true |
55f8d444d4904abbb6204ed97e66099bce232fcd | mendez6412/currency | /currency.py | UTF-8 | 1,084 | 3.515625 | 4 | [] | no_license | class Currency():
def __init__(self, currency_type, value = None):
if value == None:
sign = currency_type[0]
value = float(currency_type[1:])
if sign == '$':
currency_type = 'USD'
if sign == '€':
currency_type = 'EUR'
... | true |
a2e23e6167b93139940d56a335270ba4a71680e2 | firedrakeproject/gusto | /gusto/io.py | UTF-8 | 36,581 | 2.578125 | 3 | [
"MIT"
] | permissive | """Provides the model's IO, which controls input, output and diagnostics."""
from os import path, makedirs
import itertools
from netCDF4 import Dataset
import sys
import time
from gusto.diagnostics import Diagnostics, CourantNumber
from gusto.meshes import get_flat_latlon_mesh
from firedrake import (Function, function... | true |
2941067388f2f5e830826425e716cca25dee5acc | arjungoel/Python-for-Data-Science-and-ML-BootCamp | /create_sns_topic0.py | UTF-8 | 499 | 2.875 | 3 | [] | no_license | import boto3
from botocore.exceptions import ClientError
account_number = input("Enter the account number:")
region = input ("Enter the name of the region:")
sns_topic_name = input("Enter the name of SNS topic:")
# to create an array of topics
topics = []
# Create an SNS Client
conn = boto3.client("sns", region_nam... | true |
bba42ad226cdeaf626f05a030ca5c1cfe3ddedbe | glaucodasilva/PythonURIJudge | /1016.py | UTF-8 | 57 | 3.265625 | 3 | [] | no_license | km = int(input())
temp = int(km*2)
print(temp, "minutos") | true |
28ace838197801e8df6874185e4a75e71ef0de61 | Sh-imaa/glacier_mapping | /glacier_mapping/experiment_helpers/geo.py | UTF-8 | 3,006 | 2.875 | 3 | [] | no_license | """Helpers for Geographic Generalization Experiments
export run_dir=$DATA_DIR/expers/geographic/splits/01/
mkdir -p $run_dir
python3 -m experiment_helpers.geo -d $DATA_DIR/analysis_images/ -o $run_dir
"""
import geopandas as gpd
import pandas as pd
import numpy as np
import shapely
import random
import pathlib
import ... | true |
69608f8ae9ceb2ff9b8aebe15171b311aee3da6d | z21mwKYq/Python | /Lesson1/Algoritm/Tasks/task2_my.py | UTF-8 | 884 | 3.375 | 3 | [] | no_license | import cProfile
def nbr(num):
ll = 0
i = 1
while True:
for k in range(2,i+1):
# print(f' i {i}')
if i == 2:
ll += 1
elif i % k == 0:
break
elif i % k != 0 and k == (i-1):
ll += 1
if ll == num:
... | true |
3f4b1b4cc5e5a1670f438e9e2686320632581483 | princekinZ/Mytest | /Numeric Data Analysis/dataAnalysis.py | UTF-8 | 2,923 | 3.515625 | 4 | [] | no_license | # 导入库
import numpy as np
import matplotlib.pyplot as plt
# 导入magic04,txt文件
dataM = open('magic04.txt')
# 读取所有字符串
List_row = dataM.readlines()
List_result = []
for i in range(len(List_row)):
# 用“,”进行分割
column_list = List_row[i].strip().split(",")
# 将最后一列的g去除
column_list.pop()
# 将前10列数据加入list_result中... | true |
5f5734f4eb0f471a945447da682ca3fe07988b8b | anirudhnuth/my_first_repository | /Coding_Practice_3.py | UTF-8 | 4,504 | 3.5625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 13 14:10:18 2017
@author: Anirudh
"""
"""
Question 1
"""
import pandas as pd
data = {'BRA': [13.37, 13.30, 14.34, 15.07, 15.46, 15.98, 16.10],
'JPN': [33.43, 31.83, 33.71, 34.29, 35.60, 36.79, 37.39],
'USA': [48.30, 46.91, 48.31, 49.72, 51.41, ... | true |
15fe6613bb43450d131126b40f159e0fe5cd96bd | diligentDayl/test_study | /interface_test/execute_case.py | UTF-8 | 2,133 | 3.203125 | 3 | [] | no_license | # coding=utf-8
"""
执行测试用例
1.
2.
3.
4.
"""
import logging
import requests
def check_data(case):
"""
准备参数, 校验参数
:return: bool
"""
return True
def request(case):
"""
请求接口
:return: dict
"""
url = case["url"]
method = case["method"].upper()
headers = case["headers"]
if... | true |
3741bd5353fd7bfce766f907e6a9f6004dbb3511 | ckt371461/python | /basic/armstrong5.py | UTF-8 | 495 | 3.53125 | 4 | [] | no_license | def armstrong(n):
s = []
sum =0
u = n
while u >= 10:
t = u % 10
s.append(t)
u = int((u-t)/10)
s.append(u)
for d in s:
sum = d**len(str(n)) + sum
return sum == n
def armstrong_range(lo, hi):
lo, hi = min(lo,hi), max(lo,hi)
for i in ra... | true |
6818b41e032b34c9941c3213d10c9994d68d973c | jzohdi/web_scraping | /helpers/writer.py | UTF-8 | 4,499 | 3.15625 | 3 | [] | no_license | from typing import List, Set, Dict, Tuple, Optional
from abc import ABCMeta, abstractmethod
import xlsxwriter
class XLWriterInterface:
__metaclass__ = ABCMeta
@classmethod
def version(self): return "1.0.0"
""" creates a sheat with the header passed in as the first row """
@abstractmethod
def ... | true |
2ead022aa7d36e86c0007a3cb5b9c407785b2790 | tklijnsma/twikitool | /twikitool/tests/test_twiki_file.py | UTF-8 | 5,423 | 2.84375 | 3 | [] | no_license | from unittest import TestCase
import twikitool
class TestProcessor(TestCase):
def test_basic_tag_finding(self):
"""Tests a sequence of block finding with text and options """
text = """<@question>T1<@/question>T2<@answer color=red>T3<@/answer>"""
processor = twikitool.TagProcessor(text)... | true |
39d3dd3700dbe314456f9854a210ab53db1a6ca1 | hcyang1106/psnet_implementation | /Visualization.py | UTF-8 | 3,713 | 2.59375 | 3 | [] | no_license | import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from plyfile import PlyData, PlyElement
from random import sample
def draw_curve(lines,model,target): # draw loss curves
plt.figure()
for e in range(len(lines)):
pl... | true |
998f20b6f78b2cee422d55136c11e8c0dda02793 | SBelousov1985/convertimg | /convertimg.py | UTF-8 | 1,864 | 2.921875 | 3 | [] | no_license | from multiprocessing import Pool
import os
import subprocess
import sys
def get_files(source, exts):
result = []
for name in os.listdir(source):
for ext in exts:
if name.endswith("." + ext):
result.append(os.path.join(source, name))
break
return result
... | true |
5bc91bad191e9c0c4480556c98ae3cd7648b1b2a | AshvinKasture/CP2 | /sum_of_four_primes.py | UTF-8 | 590 | 3.28125 | 3 | [] | no_license | n = int(input())
lst = []
for i in range(0, n):
if i > 1:
for j in range(2, i):
if(i % j == 0):
break
else:
lst.append(i)
# print(lst)
lst2 = []
gotAnswer = False
answer = None
for n1 in lst:
for n2 in lst:
for n3 in lst:
for n4 in l... | true |
54bb32b52b258ff5177c42ed95e0da0b0e15fc09 | shiqi0128/My_scripts | /python_study/Py28_0403_function_module/lm_06_module_from_import.py | UTF-8 | 652 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
-------------------------------------------------
@Time : 2020/4/3 21:47
@Auth : 可优
@File : lm_06_module_from_import.py
@IDE : PyCharm
@Motto: ABC(Always Be Coding)
@Email: keyou100@qq.com
@Company: 湖南省零檬信息技术有限公司
@Copyright: 柠檬班
---------------------------------------------... | true |
6f22310dff75b4a8aeec71f32411c366277cbd43 | majung2/CTpractice | /python/2020summer_study/boj_1725.py | UTF-8 | 703 | 3.5 | 4 | [] | no_license | # 히스토그램
# 시간초과
from collections import deque
N = int(input())
his = []
for _ in range(N):
his.append(int(input()))
maxA = 0
for i in range(N):
s, e = 0,i # 밑변 시작, 끝 점
# 시작 인덱스 찾기
if i !=0 and his[i] > his[i-1]: # 이전보다 큼
s = i # 현재인덱스에서 시작
else: # 이전보다 같거나 작음
for j in range(... | true |
7774be43e6189848d0f045399764906eb15c645a | IvanaXu/PyTools | /002.Test_Proxy.py | UTF-8 | 1,491 | 2.609375 | 3 | [
"MIT"
] | permissive | """
https://www.xuebuyuan.com/3229120.html
Python Proxy Server
# TODO: BUG IN CLOSE @LINE45
"""
import socket
import select
import sys
to_addr = ('0.0.0.0', 11111)
class Proxy:
def __init__(self, addr):
self.proxy = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.proxy.bind(addr)
se... | true |
37d838292d7d32645c6e419b3ba6534dd100fc48 | HuShuangPing/Study | /day04/json序列化.py | UTF-8 | 817 | 3.578125 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:HuShuangPing
#序列化
#把信息写到硬盘上
#json 只能处理简单类型 字典 列表,字符串
#json适合所有语言,主要用来不同语言数据交互
#xml(一种存储数据的方式)真逐渐被json语言所替代
#如果想要处理复杂类型数据进行序列化,pickle
#pickle 和 json用法一样,可以将json换成pickle
import json
import pickle
def sayhi(name):
print('hello',name)
info ={
'name':"Jack... | true |
3d80f437f67ac7fbd5b0340a57ff723929ba830b | manuel-quezada/water_wave_diffractons_RR | /Proteus/2D/comparison_versus_3D/plot_extracted_2D_FEM.py | UTF-8 | 2,814 | 2.53125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as pl
from numpy import genfromtxt
from scipy.interpolate import interp2d
import numpy as np
from scipy.interpolate import griddata
from clawpack.petclaw.solution import Solution
def get_FEM_data_frame(name,path='FEM_DATA/'):
# read data
data = genfromtxt(path + '/' ... | true |
7c03d82092f446220296233c7168c986c7f29f42 | arkneid/Scrypt | /Scrypt.py | UTF-8 | 1,206 | 2.734375 | 3 | [] | no_license | #! /usr/bin/env python3
# coding=utf-8
#########################
# Author: João Chaminé #
#########################
# imports
import optparse
import platform
from res.cryptography import Encryption
# Vars
SYSTEM = platform.system()
def main():
# Options treatment
parser = optparse.OptionParser()
parse... | true |
0f5061ac22937a416f1f105e629ebed92ac9b137 | haohlin/Pattern-Recognition-Homework | /homework_02_numpy_matplotlib/exercise_2-1/exercise_2-1.py | UTF-8 | 450 | 3.34375 | 3 | [
"Apache-2.0"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-16,16,32)
y = x**2
fig = plt.figure()
axes = fig.add_axes([0,0,1,1])
axes.plot(x,y)
#plot第一个变量意思是x范围取定在一点,而y的范围在0到y[i]
for i in range(32):
axes.plot([x[i],x[i]],[0,y[i]],'r')
axes.set_title(r'$y = x^2$')
axes.set_xlabel('x')
axes.set_ylabel('y')
... | true |
6c7e1087bdaeff80b23fd80bdc95b43f81e96641 | MissouriMRR/IARC-2019 | /laser/serial_controller_class.py | UTF-8 | 883 | 3.59375 | 4 | [] | no_license | import serial
class SerialController:
""" A controller to simplify the connection of the Serial port as well as simplifying sending the commands
Parameters
----------
port_string : string
The string of the serial port you want to open (for ardunio it has been "dev/ttyACM0")
baudrate : int
The baudrate for the ... | true |
43001f76a5192dc618472006570f3986a5a0078a | Kpassionate/JdCrawler | /JdCrawler/spiders/jd_spider.py | UTF-8 | 3,198 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from JdCrawler.items import JdItem
class JdSpider(scrapy.Spider):
name = 'jd'
# 允许的域名
allowed_domains = ['jd.com'] # 有的时候写个www.jd.com会导致search.jd.com无法爬取
keyword = "射雕英雄传"
page = 1
# 解析jd搜索url,除了keyword和page都是干扰项,故只需拼接keyword和page即可
url = 'https://se... | true |
1dc7ff272c6486513d1246769ac972c1592e09fb | PembangunanSIG/Hand-Counter | /test-handgesture.py | UTF-8 | 1,479 | 2.65625 | 3 | [] | no_license | import cv2
import HandTrackingModule as htm
cap = cv2.VideoCapture(1)
detectorTangan = htm.handDetector ( detectionCon=0.75 )
tipIds = [4, 8, 12, 16, 20]
def handButton():
while True:
ret, frame = cap.read()
imgH = detectorTangan.findHands(frame)
lmList = detectorTangan.find... | true |
be0aa3f2faabbd543f376c006b115a68c3a0d98c | ndrini/10Opportunities | /test/test_main.py | UTF-8 | 1,746 | 2.875 | 3 | [
"MIT"
] | permissive | import pytest
from match import Match
test_match = Match(1, "Bot")
'''
TODO:
create moneypatch for allowing multiple case tests
'''
# @pytest.fixture
# def childs_page_number_setup():
# print("childs_page_number_setup")
# test_match.childs_page_number = [456]
def test_data_fix(monkeypatch):
def subst... | true |
0d74104c43c560d85a1bd22df6e9e53038675d43 | Hbuisser/Piscine_Python_Django | /DAY01/ex00/var.py | UTF-8 | 543 | 3.046875 | 3 | [] | no_license |
def my_var():
i = 42
print(i, "est de type", type(i))
str = "42"
print(str, "est de type", type(str))
str = "quarante-deux"
print(str, "est de type", type(str))
f = 42.0
print(f, "est de type", type(f))
x = True
print(x, "est de type", type(x))
l = [42]
print(l, "es... | true |
71387a68b456af0db1575a82ecae4f7385449a09 | davidcotton/gym-d2d | /src/gym_d2d/devices.py | UTF-8 | 1,150 | 2.703125 | 3 | [
"MIT"
] | permissive | from collections.abc import Mapping
from typing import Dict, Tuple
from gym_d2d.device import Device, BaseStation, UserEquipment
from gym_d2d.id import Id
class Devices(Mapping):
def __init__(self,
bs: BaseStation,
cues: Dict[Id, UserEquipment],
due_pairs: Dict[... | true |
7492c16a99632f263c107805399c7b6664f77579 | tmnewt/hacker-rank-python-work | /python problems/numpy problems/transposeAndFlatten.py | UTF-8 | 528 | 3.828125 | 4 | [] | no_license | # https://www.hackerrank.com/challenges/np-transpose-and-flatten/problem
# In this problem you will need to write your own input code for a 2 dimensional array of N x M elements.
# then simply transpose and then flatten the inputs
import numpy as np
def transposeAndFlatten(arr):
return np.transpose(np.array(arr)... | true |
bee7d24cd2e29724192e8939941e3bf913437e39 | kar10tik/Elementary_DSA | /Python/qprior.py | UTF-8 | 2,054 | 4.34375 | 4 | [] | no_license | #Priority Queue Implementation Using Array
#Here, priority is the numeric value of the integer
class qprior():
def __init__(self, size):
self.size = size
self.queue = []
def is_empty(self):
return len(self.queue) == 0
def is_full(self):
return len(self.queue) == self.size
... | true |
e9cd97d2f9f4c3d911213340e36575da675a58a7 | Kieran-Bacon/Babel-Analytics-Platform | /ManagementConsole/logger.py | UTF-8 | 3,388 | 2.5625 | 3 | [] | no_license | from os import listdir
from os.path import join
import time
class Logger:
def __init__(self):
self.store = "./logs"
def getAnalytics(self, srv_id = 0, resource="", timeframe = 0 ):
# Initialise all variables.
reqtTotal = 0
genTotal = 0
minTime = 0
avgTime = 0
maxTime = 0
errTotal = 0
filepaths ... | true |
476066f02a6ad5a1fcde3241dd0ec4d6126e13c4 | bodetc/CarND-Behavioral-Cloning-P3 | /clone.py | UTF-8 | 1,588 | 2.625 | 3 | [] | no_license | import numpy as np
from src.models import lenet, linear_model, nvidia
from src.read import read_images, augment_images
# read CSV file in the provide folder and load all images
# This also includes the side images
images, measurements = read_images('./data_2runs', '\\')
print(np.shape(images))
print(np.shape(measure... | true |
29f85464742bb6d9bd5274f386e54e088f29bd24 | ihc/futhark | /rts/python/opencl.py | UTF-8 | 1,355 | 2.671875 | 3 | [
"ISC"
] | permissive | # Stub code for OpenCL setup.
import pyopencl as cl
def parse_preferred_device(s):
pref_num = 0
if len(s) > 1 and s[0] == '#':
i = 1
while i < len(s):
if not s[i].isdigit():
break
else:
pref_num = pref_num * 10 + int(s[i])
i +... | true |
a62b40ebb7f2002ab9cb745b7e493fc7609b7e15 | yagodeveloper/Python-amalyotlari | /if_va_else.py | UTF-8 | 748 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 4 04:54:53 2021
@author: Admin
"""
#mashinalar = ['malibu','kaptiva','lacetti','nexia']
#for avto in mashinalar:
# if avto =='malibu':
# print(avto.upper())
#else:
# print(avto.title())
#ismlar = input("ism\n")
#if ismlar.lower() != ... | true |
b9a2f462d83557eabf50c1c029eac71a8b928a36 | demonzyz/huice | /huice/Day01/test21.py | UTF-8 | 1,559 | 3.890625 | 4 | [] | no_license | # -*-coding:utf-8-*-
# 打印1到100的数(while循环)
x= 1
while x <= 100:
print x
x += 1
name = ''
while not name:
name = raw_input('please enter your name:')
print 'hello.%s!' %name
names = ['马超', '马云', '马化腾']
# for name in ['马超', '马云', '马化腾']:
for name in names:
print name
sum = 0
for... | true |
e4399eeebf5e9285b4576d1b03faad6899cb962f | Darkxiete/leetcode_python | /46.py | UTF-8 | 631 | 3.1875 | 3 | [] | no_license | from typing import List
from copy import deepcopy
class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
def backtrack(L, tmpL, nums):
if len(tmpL) == len(nums):
L.append(tmpL[:])
else:
for num in nums:
if num in t... | true |
c14eb96da4cfd33c56a89b1a99b79d8c676a0812 | YoungerMax/md2html-py | /md2html/stage.py | UTF-8 | 4,132 | 3.125 | 3 | [
"MIT"
] | permissive | import os
from md2html import statics, util
# Base stage class
class Stage:
# Get the name of the stage
def get_name(self) -> str:
pass
# Run the stage
#
# args The fixed arguments from __init__.py
#
# last_output The return value of the last run stage.
# ... | true |
34ed4f9aaf89e2723df2d6b9c7df5ca8da5bf4e1 | Athenian-ComputerScience-Fall2020/dictionary-building-eskinders17 | /my_code.py | UTF-8 | 498 | 3.4375 | 3 | [
"Apache-2.0"
] | permissive | # Collaborators (including web sites where you got help: (enter none if you didn't need help)
#
continent_and_country = {}
while True:
continent = input("Enter a continent name: ")
country = input("Enter a country name: ")
continent_and_country[continent] = country
print("Do you want to put annothe... | true |
c60e1888c0b1068405c4575420a46c3e462a2c81 | supramolecular-toolkit/stk | /src/stk/molecular/functional_groups/functional_groups/functional_group.py | UTF-8 | 13,823 | 3.140625 | 3 | [
"MIT"
] | permissive | """
Functional Group
================
.. toctree::
:maxdepth: 2
Alcohol <stk.molecular.functional_groups.functional_groups.alcohol>
Aldehyde <\
stk.molecular.functional_groups.functional_groups.aldehyde\
>
Alkene <stk.molecular.functional_groups.functional_groups.alkene>
Alkyne <stk.molecular.func... | true |
31679920b446820c223d638cf26b9cdb4c42ad3a | barneycouch/ebi | /wk2/comparison/py/test3.py | UTF-8 | 149 | 2.875 | 3 | [] | no_license | infile = open('martpl2short.txt', 'r')
tup = []
for line in infile:
line = line.replace("\n", "")
tup.append(line)
print '\n'
print tup
print '\n' | true |
2ce0ae4ec32dc8c8db6d5758726f392e27918fd1 | chuhanxiong/UberPriceEstimator | /data_preparation/build_model.py | UTF-8 | 5,303 | 2.578125 | 3 | [] | no_license | from pyspark import SparkConf, SparkContext
from pyspark.streaming import StreamingContext
from pyspark.sql import SQLContext
from sklearn import linear_model
import scipy.io
import numpy as np
import pandas as pd
from pandas import DataFrame
import math
import os.path
from os import listdir
import sklearn.externals
f... | true |
f774f183bbf238a01ed922d5c5c4366266291495 | invinst/invisible-flow | /tests/storage/test_local_storage.py | UTF-8 | 1,736 | 2.65625 | 3 | [] | no_license | import os
import pathlib
from io import BytesIO
from werkzeug.datastructures import FileStorage
from invisible_flow.storage.local_storage import LocalStorage
class TestLocalStorage:
subject = LocalStorage()
fake_file_storage = FileStorage(stream=BytesIO(b'Some content'))
def test_store_byte_string_does... | true |
8373386f3a9a8b6f66a0001034ec184433aa286a | davidgroves/infoblox-netmri | /infoblox_netmri/api/remote/models/sensor_datum_remote.py | UTF-8 | 1,952 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | from ..remote import RemoteModel
class SensorDatumRemote(RemoteModel):
"""
Sensor data about the health of the NetMRI
| ``id:`` The internal NetMRI identifier for the table entry.
| ``attribute type:`` number
| ``data_source_id:`` The internal NetMRI identifier for the collector NetMRI that ... | true |
6e62bf93e845194d650b74924e312797aa9dcec1 | wqhcug/SDN-MachineLearning-NumberOfFlowsDetection | /2-flow_monitor/3-processing_samples_train.py | UTF-8 | 59,902 | 2.71875 | 3 | [] | no_license | """This script is used to automatically take the values of
OnwWayDelay (OWD) and InterArrivalTime (IAT) from a file and
create instance for machine learner"""
# highlight peaks selected.
#
import numpy
import numpy as np
import peakutils
from peakutils.plot import plot as pplot
import matplotlib.pyplot as plt
from m... | true |
907bbbecc1a71499cdd52809959a464f46e2928e | vaishalishakhapure/textutilities | /textutils/views.py | UTF-8 | 2,838 | 2.640625 | 3 | [] | no_license | from django.http import response
from django.http.response import HttpResponse
from django.shortcuts import render
def index(request):
return render(request, "index.html")
def analyze(request):
# Get the text
djtext = request.POST.get('text', 'default')
removepunc1 = request.POST.get('removepunc1',... | true |
fb31f07de9ae2456f10a9b32d4b6f22747140684 | nnoyuwan/ATBSWP | /第7章 模式匹配与正则表达式/15.项目:电话号码和 E-mail 地址提取程序.py | UTF-8 | 5,299 | 3.703125 | 4 | [] | no_license | # -*- coding:utf-8 -*-
# author:yuwanmo
# contact: a13767092838@gmail.com
# datetime:2021/8/13 1:27 下午
# 假设你有一个无聊的任务,要在一篇长的网页或文章中,找出所有电话号码和 邮件地址。
# 。如果手动翻页,可能需要查找很长时间。如果有一个程序,可以在剪贴 板的文本中查找
# 电话号码和 E-mail 地址,那你就只要按一下 Ctrl-A 选择所有文本, 按下 Ctrl-C
# 将它复制到剪贴板,然后运行你的程序。它会用找到的电话号码和 E-mail 地址,替换掉
# 剪贴板中的文本。
# 当你开始接手一个新项目时,很容易想要... | true |
545078f8a4fcc6bbc724c530d85eec94ee4e2d38 | adit3011/hellobro | /setsets.py | UTF-8 | 498 | 3.296875 | 3 | [] | no_license | import math;
a = [1, 2, 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
b=[2,4,6,8,10]
def intersection(a,b):
c = [value for value in a if value in b]
return c
print("a intersection b : ", intersection(a,b))
def powret(set,size):
sizep = (int) (math.pow(2, size));
counter = 0;
i = 0;
for coun... | true |