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 |
|---|---|---|---|---|---|---|---|---|---|---|
39e7d69afdef99e33e3d3e625238d92f0b2a4c8d | sn1572/leetcode | /105_construct_binary_tree_from_preorder_and_inorder_traversal.py | UTF-8 | 1,151 | 3.390625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 3 08:38:23 2019
@author: mbolding3
"""
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def buildTree(self, preorder, inorder):
if not p... | true |
6011921f8a6e6acfdc53aa59808964d12a729e9f | harsha-kadekar/Chitralochana | /ConfigurationHandler.py | UTF-8 | 4,812 | 3.140625 | 3 | [] | no_license | '''
Name: ConfigurationHandler
Description: This file holds all the functions and classes responsible for the configuration of the product.
Developer: Harsha Kadekar
References:
'''
import xml.etree.ElementTree as ET
import GeneralFunctionsandClasses as GFC
class ChitralochanaConfigurator(GFC.Singl... | true |
225497b0952733a7639407cce1f738868a62bf5d | sidjain-jecrc/gaussian-process-regression | /gaussian_process_task1.py | UTF-8 | 2,254 | 2.75 | 3 | [] | no_license | from math import exp
import scipy.io as sp
import scipy.spatial as ssp
import operator
import random
import numpy as np
from numpy.linalg import inv
sigmaN = 0.0464386
sigmaF = 0.08672187
distL = 0.2598845
def cov(x1, x2):
sum = 0.0
for each in range(len(x1)):
sum += pow((x1[each] - x2[each]), 2)
... | true |
b472a0b3ce8c0c72a8cd78a334e20a295a591fee | zhangshuai365/my-python-repository | /Python经典练手小程序100例/program_20.py | UTF-8 | 536 | 3.765625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
【程序20】
题目: 一球从100米高度自由落下,每次落地后反跳回原高度的一半;再落下,求它在第10次落地时,共经过多少米?第10次反弹多高?
程序分析:记录每一次下落并弹起的距离值,最后一次只记录下落的距离值;同时计算出第n次反弹的高度。
"""
H = 100.0
L = []
i = 10
while i > 0:
if i > 1:
L.append(3 / 2 * H)
else:
L.append(H)
H = H / 2
i -= 1
print("L=%f,H=%f" % (sum(L), H)... | true |
0da286f15f7068a07775b4c2f0d7e43983640c48 | gshau/unifi_panel_api | /src/app.py | UTF-8 | 1,353 | 2.59375 | 3 | [
"MIT"
] | permissive | from flask import Flask
import paho.mqtt.client as mqtt
import json
app = Flask(__name__)
PANEL_ADDRESS = "10.0.5.85"
def get_client(panel_address=PANEL_ADDRESS):
client = mqtt.Client("PANEL")
client.connect(PANEL_ADDRESS, port=1883)
return client
def turn_on(panel_address=PANEL_ADDRESS):
client =... | true |
6fc28868ad8d46ae68712d4d89f3eec500859e25 | ant-on-su/DengAI | /packages/data_exploration.py | UTF-8 | 7,040 | 2.8125 | 3 | [] | no_license | """
Created on Wed Jun 20 18:42:52 2018
work on datachallenge DengAI https://www.drivendata.org/competitions/44/dengai-predicting-disease-spread/
"""
import pandas as pd
import numpy as np
import sklearn
from sklearn_pandas import DataFrameMapper, cross_val_score
import lightgbm as lgb
import pprint as pp
#get da... | true |
c694f251dc39143902fc24907f87721ef26c367e | tomchen/csv2po | /tools/template_helper.py | UTF-8 | 2,277 | 2.828125 | 3 | [
"MIT"
] | permissive | # Helper To Add Template for csv2po.py
# Tool of csv2po.py
# By Tom CHEN <tomchen.org@gmail.com> (tomchen.org)
import re
from pathlib import Path
from getfilepaths import getFilePaths
def log(s):
printHead = 'WARNING: '
f = Path('logfile.txt').open(mode = 'a+', newline = '\n', encoding = 'UTF-8')
f.write(printHea... | true |
fd7fed37abdf0305aa59593767b5f491fd4c9765 | dhill94/hello-world | /Week5Page88.2.py | UTF-8 | 98 | 3.109375 | 3 | [] | no_license | theSum = 0
count = 1
while count <= 100000:
theSum += count
count+= 1
print(theSum)
| true |
1e624b96ffb340e4926c6f584af0ff6f2d02c7b5 | CSCMC/cs.cmc-encontros | /3º Encontro/terceito.py | UTF-8 | 2,441 | 4.0625 | 4 | [] | no_license | class Sum:
def add(self, x):
return x + 1
s = Sum()
print(s.add(1823123))
##############################################################################
class Person: #blueprint
def __init__(self, name, age, height, hair_colour, sport):
self.name = name
self.age = age
self.height = height
self.hair_col... | true |
a0c9d688a5ea9d2aacadb4d64bea7af3493f3386 | Juggernaut9434/httpsWebScraper | /home.py | UTF-8 | 2,020 | 2.765625 | 3 | [] | no_license | # Mike Mathews on Jan 4, 2020
# The beta file for general_home that includes a specific example
# of a table from StockCharts
from utils import mikeutils
class Home:
_logoCSS = "#nav-upper > a > img:nth-child(1)"
_chartAndToolNavCSS = "#navbar-menuCollapse > ul:nth-child(1) > li:nth-child(1) > a"
_volCo... | true |
38dfc18cdce97a6c860b545bdf61fc2a9a7ece66 | janina3/Python | /CS 1114/notUsingIfElse.py | UTF-8 | 424 | 2.9375 | 3 | [] | no_license | def checkStudentProgress(grade):
if isPassing(grade):
pass
else:
dealWithFailingGrade(grade)
def isPassing(grade):
'''returns True if student grade is at least 65 and False if not'''
'''
if grade >= 65:
return True
else:
return False
'''
return grade >= 6... | true |
8e0626806df5eadf137a2de308e3e0174dbfec21 | mhpicel/Oasis | /l2_book_builder.py | UTF-8 | 2,253 | 2.578125 | 3 | [] | no_license | import json
from websocket import create_connection
import curses
bid_book = dict()
ask_book = dict()
last_trade = [0,0, "sell"]
def decode_snapshot(snapshot):
for bid in snapshot['bids']:
bid_book[float(bid[0])] = float(bid[1])
for ask in snapshot['asks']:
ask_book[float(ask[0])] = float(ask[1])
def decode_l2... | true |
5d70160a2574d0b25d3da70dc27685a649fbb76d | auzi68/Connection_Tester | /connection_tester.py | UTF-8 | 1,026 | 2.609375 | 3 | [
"MIT"
] | permissive | import sys
import os
import datetime
import time
import socket
status = 'down'
previous_status = 'down'
file = 'path_to_log'
while True:
conn_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
conn_socket.settimeout(2)
ldap = ('IP_ADDRESS', PORT)
response = conn_socket.connect_ex(ldap)
if response == 0:... | true |
eb22757d6880f627b96c38f0f4886ee240b6ee5e | suki0331/bc2020 | /tensorflow1.0/tf10_2_cancer.py | UTF-8 | 1,570 | 2.921875 | 3 | [] | no_license | from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
import tensorflow as tf
# regression
dataset = load_breast_cancer()
x_data = dataset.data
y_data = dataset.target
print(x_data.shape) # (569, 30)
print(y_data.shape) # (569, )
y_data = y_data.reshape(-1, 1)
x_train... | true |
afb88967fcae2cac9bdcaf6014661737db269df9 | bgoonz/UsefulResourceRepo2.0 | /MY_REPOS/INTERVIEW-PREP-COMPLETE/notes-n-resources/Data-Structures-N-Algo/_DS-n-Algos/Interview-Problems/GeeksforGeeks/Find-Swap-Values.py | UTF-8 | 290 | 2.546875 | 3 | [
"MIT"
] | permissive | class Solution:
def findSwapValues(self, a, n, b, m):
# Your code goes here
sa = sum(a)
sb = sum(b)
itb = iter(b)
b = dict(zip(itb, itb))
for i in a:
if ((sb - sa + 2 * i) / 2) in b:
return 1
return -1
| true |
96b82149af936395de95b5fc1d1087cc19164128 | LeonildoMuniz/Logica_de_programacao_Python | /Listas/Lista1_Ex04.py | UTF-8 | 280 | 3.921875 | 4 | [] | no_license | '''
Faça um Programa que peça as 4 notas
bimestrais e mostre a média.
'''
a=int(input("Digite a primeira nota: "))
b=int(input("Digite a segunda nota: "))
c=int(input("Digite a terceira nota: "))
d=int(input("Digite a quarta nota: "))
print("Media das notas: ",(a+b+c+d)/4)
| true |
7d4ee55cf8b9fcc481c941b562da68962495a746 | plone/guillotina | /guillotina/schema/accessors.py | UTF-8 | 3,531 | 3.03125 | 3 | [
"BSD-2-Clause"
] | permissive | ##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | true |
762483a4b6ca0d53e8038786a6ec8030a45ee50e | ACMUNLV/coding-meetups | /2020_fall/coding_meetup_01/chocolate_division/chocolate_division.py | UTF-8 | 194 | 3.03125 | 3 | [] | no_license | # @author Benjamin Alcocer
import math
array = input().replace('\n', '').split()
n = int(array[0])
m = int(array[1])
d = math.gcd(n,m)
n = n // d
m = m // d
print(d if n % 2 == 1 and m % 2 == 1 else 0)
| true |
f508132c5c685b88230067b0057d438a14f824a9 | Cjay-Chou/my_leetcode | /python3/2_add_two_nums.py | UTF-8 | 1,023 | 3.21875 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
l3 = ListNode(0)
temp = l3
up = 0
while l1 is not None and l2 is not... | true |
b5f08d3c2d83cfc39baa5eebb0c5897dd09951e2 | UjjwalLaad/learn-python | /if-else/newnumbers.py | UTF-8 | 365 | 3.53125 | 4 | [] | no_license | a = 17343
b = 142
c = 19
if a>b and a>c:
print("a is greater")
else:
if b >c and b >a:
print("b is greater")
else:
print ('c is greater')
if a > b:
if a > c:
print("a is greater")
else:
if b > a :
if b > c:
print("b is greater")
else:
... | true |
d9d7b70242d350f9ec9cc5fb019e742f9ba1071b | mahdiheydari/reviewECTools | /pythonScripts/extractLostTrueKmerPos.py | UTF-8 | 11,637 | 2.609375 | 3 | [] | no_license | '''
Copyright (C) 2016 Mahdi Heydari
This script find the position of kmers and the frequency of them in contig. '''
import sys
interval=500
def ReverseComplement(seq):
for base in seq:
if base not in 'ATCGatcg':
print ("Error: NOT a DNA sequence")
return None
# too lazy to cons... | true |
4efc6ac4645e9f1ad4c04a577034108b43bb100e | htietze/gallery_database_project | /db_contact.py | UTF-8 | 1,163 | 2.921875 | 3 | [] | no_license | from peewee import *
from config import db_path
import os
from db_initial import Artist, Artwork
def add_artist(data):
artist = Artist(name=data[0], email=data[1])
try:
artist.save()
return 'Artist added'
except IntegrityError:
# I don't understand why I can't raise the custom pass ... | true |
c10178c95970d26263ac2a66964f1c2d24857dd8 | neiterman21/NLP_class | /Datakeeper.py | UTF-8 | 3,255 | 3.171875 | 3 | [] | no_license | #!/usr/local/bin python
import numpy as np # linear algebra
import cv2
import read_data as rd
# Image Parameters
N_CLASSES = 2 # CHANGE HERE, total number of classes
IMG_WIDTH = 387 # CHANGE HERE, the image height to be resized to
IMG_HEIGHT = 231 # CHANGE HERE, the image width to be resized to
CHANNELS = 3 # Th... | true |
4cdd16c46cb3dbfec5743f3c6722f4826b24ea7b | eudoxos/ssd1306 | /oled/serial.py | UTF-8 | 4,496 | 2.578125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2016 Richard Hull
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the righ... | true |
372fc198ca96ced801146ca3a430f4f205da7566 | YusukeKitamura/Python_algo | /石取りゲーム/ishi1.py | UTF-8 | 788 | 4.125 | 4 | [] | no_license | # coding=utf-8
# ishi1.py -- 石取りゲーム 1
def ishi1(n, m):
my_turn = 1
while n > 0 :
if my_turn == 1:
x = (n - 1) % (m + 1)
if x == 0:
x = 1
print("私は ", x, " 個の石を取ります.")
else:
while True:
print("何個取りますか? ");
x = int(input())
if (x > 0 and x <= m and x <= n):
break
n -= x
prin... | true |
d66ff2138ef772fd460063238a7681af38201636 | jeraldamo/EE_Inventory | /cgi-bin/inventoryControl.py | UTF-8 | 725 | 2.625 | 3 | [] | no_license | import shelve
from inventoryObjects import *
defalutInventory = "/home/bear/Projects/inventory/Inventory"
curInventory = defalutInventory
def createInventory():
inventory = shelve.open(defalutInventory)
for room in rooms:
tmp = {}
for Type in types:
tmp[Type] = {}
inventory[room] = tmp
inventory["Index"... | true |
12072ee67a1f74f1e21b1ed2fafdfca4c84de416 | pangeo-data/climpred | /climpred/exceptions.py | UTF-8 | 1,067 | 2.78125 | 3 | [
"MIT"
] | permissive | class Error(Exception):
"""Base class for custom exceptions in climpred."""
pass
class CoordinateError(Error):
"""Exception raised when the input xarray object doesn't have the
appropriate coordinates."""
def __init__(self, message):
self.message = message
class DatasetError(Error):
... | true |
419c6784951f1394e5b789dcf96bc2e048658109 | erik-chen/web_programming | /Server/tcpServer_twisted.py | UTF-8 | 486 | 2.5625 | 3 | [] | no_license | from twisted.internet import protocol, reactor
from time import ctime
class ServerProtocol(protocol.Protocol):
def connectionMade(self):
print("...connected from %s" % self.transport.getPeer().host)
def dataReceived(self, data):
self.transport.write(b"[%b] %b" % (ctime().encode("utf-8"), data... | true |
46480666d176a13f0505ce1a98d17b3c2bb1732c | carpenterbennet/fmri_test | /hello.py | UTF-8 | 106 | 3.359375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
helloString = "Hello (from Python) "
print(helloString * 4)
print(helloString[2:4])
| true |
c169f53229af53672e5735e6d55c6306b85ac66a | Oscer2016/python | /040.py | UTF-8 | 194 | 3.609375 | 4 | [] | no_license | #Exp4_17.py
#encoding=utf-8
s = 0
print '200以内能被17整除的所有数是:'
for i in range(1,201):
if i%17==0:
print i,
s += 1
print '\n数的个数是: ',s
| true |
6459ca6650f7e1d3c1c9dbbc063d2e799b7c6d22 | woka20/kitchen_stories_project | /hello.py | UTF-8 | 2,409 | 4.0625 | 4 | [] | no_license | #Ini pencetak hello world
#print("hello world")
#Integer
myint=7
print(myint)
print(type(myint))
#Float
# myfloat=7.0
# print(myfloat)
# print(type(myfloat))
myfloat=float(7)
print(myfloat)
print(type(myfloat))
#Strings
print(type('hello'))
print(type("hello"))
print("===========================================... | true |
221e06076172da323bbeb9cca3ee8c7c80d6ea9c | wanlipu/coding-python | /dynamic_programming/one_D_DP/climbing_stairs.py | UTF-8 | 955 | 3.75 | 4 | [] | no_license | class Solution(object):
def stairs(self, n):
"""
input: int n
return: int
"""
# write your solution here
if n == 1:
return 1
if n == 2:
return 2
record = [0] * n
record[0] = 1
record[1] = 2
for i in ra... | true |
6fdd0d2d46cd4671e749f56ae080d6948603890a | radishmouse/06-2017-cohort-python | /103/tip_calc2.py | UTF-8 | 617 | 3.546875 | 4 | [] | no_license |
total_bill = int(raw_input('Total bill amount? '))
level_of_service = raw_input('Level of service? ')
split_how_many = int(raw_input('Split how many ways? '))
tip_text = 'Tip amount: %.2f'
tip = 0.0
total_text = 'Total amount: %.2f'
if level_of_service == 'good':
tip = total_bill * 0.2
elif level_of_service == 'f... | true |
99459f2f75f001c70846150c7ffe572bc3a6b27a | xtzd/NLP-2018-Autumn | /Algorithms/count_inversions.py | UTF-8 | 1,225 | 3.46875 | 3 | [] | no_license |
def merge(left,right):
global cnt
sorted=[]
i,j=0,0
while(i<len(left) and j<len(right)):
if left[i]<=right[j]:
sorted+=[left[i]]
i+=1
else:
sorted+=[right[j]]
j+=1
cnt+=len(left)-i
if i>=len(left):
sorted+=... | true |
49f1a075ce8f1afe9a56f021c1174a327e580b70 | panasrat/vistec-de | /utils.py | UTF-8 | 1,316 | 3.234375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from datetime import datetime
def makeSoup(url):
r = requests.get(url)
return BeautifulSoup(r.text, 'html.parser')
def findNoOfPages(soup):
tag = soup.find_all('li', {'class': 'current'})
no_of_pages = int(tag[0].text.strip().split()[-1])
return no_of_... | true |
4da185cb4325059ddf7d871766136ac76afd3242 | Richtig-Wu/python | /rumen/class.py | UTF-8 | 2,297 | 3.75 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# 类
# class classname(object):
# pass
#
# class Fruite(object):
# def __init__(self,name,color,weight):
# self.name = name
# self.color = color
# self.weight = weight
#
# fr = Fruite('aaa','red',90)
# print fr.name
# print fr.color
# print fr.weight
#
# a = '12'... | true |
355af865c5e7ab8e901a46bc2efca7c4b267eadf | tandav/vsu-tasks | /Math-Modeling/untitled/percolation.py | UTF-8 | 1,413 | 2.953125 | 3 | [] | no_license | import numpy as np
# from pylab import imshow, show
import matplotlib.pyplot as plt
from random import random
L = 7 # side length
p = 0.4
a = np.zeros((L + 1, L + 1), dtype=int) # grid / matrix / array
for i in range(1, L+1):
for j in range(1, L+1):
if random() <= p:
a[i][j] = 1
# labels = ... | true |
63d81813a9b97a665c63dca107435e5e57694275 | Ismailmooyoussef/friend-app | /friend/app/test.py | UTF-8 | 4,210 | 2.515625 | 3 | [] | no_license | from friend import app
import unittest
class FlaskTestCase(unittest.TestCase):
def setUp(self):
app.config['TESTING'] = True
# Wrong key:
# app.config['CSRF_ENABLED'] = False
# Right key:
app.config['WTF_CSRF_ENABLED'] = False
# Ensure Sign in, behaves correctly
d... | true |
27cb34c308f7fe616b50c89d3bc35e5537adb649 | hanyax/Advance_Neutral_Network_Projects | /PA4/edit_experiment.py | UTF-8 | 10,043 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
################################################################################
# CSE 253: Programming Assignment 4
# Code snippet by Ajit Kumar, Savyasachi
# Fall 2020
################################################################################
import matplotlib.... | true |
d8aa106f6c0b3e6cb9401c7e680e1a3cacf2725d | beOk91/baekjoon2 | /baekjoon2355.py | UTF-8 | 262 | 3.140625 | 3 | [] | no_license | a,b=map(int,input().strip().split())
a,b=b if b<a else a,a if a>b else b
if a>=0 and b>=0:
print(b*(b+1)//2-(a-1)*a//2)
elif a<0 and b>=0:
a*=-1
print(-a*(a+1)//2+b*(b+1)//2)
elif a<0 and b<0:
a*=-1
b*=-1
print((a*(a+1)//2-(b-1)*b//2)*-1) | true |
e0c145e8a75bb3879dd9f2b01a796cee48923371 | cavrau/aps | /app/lists/screens.py | UTF-8 | 2,233 | 3.0625 | 3 | [] | no_license | from abstracts.abstract_tela import AbstractTela
from PySimpleGUI import Window, Text, Button, Input, Image as ImageField
from .model import List
class TelaSelecao(AbstractTela):
def __init__(self, lists):
layout = [ [Button(_list.title)] for _list in lists]
self.window = Window('Seleção de lista')... | true |
cbe84f655e040cad02bb9fe8227535efe72fa982 | npkhanhh/MazeCreation | /Node.py | UTF-8 | 1,303 | 3.25 | 3 | [] | no_license | """
Created on Aug 9, 2015
@author: ldhuy
"""
class Node(object):
"""
Node for pathMap and deMap
"""
def __init__(self, path, neighbors, typ):
"""
Constructor
"""
self._path = []
self._neighbors = set()
self._type = ''
self.path = path
... | true |
4e0d1b29a6db9aabed9f77118571d3123feabc8d | scmmmh/pwh_permissions | /tests/test_evaluate.py | UTF-8 | 7,745 | 3.140625 | 3 | [
"MIT"
] | permissive | import pytest
from pwh_permissions import tokenise, parse, evaluate, PermissionException
class ExampleObject(object):
def allow(self, user, action):
"""Checks whether the given user is allowed the action. The "view" action is always allowed, the "edit" action
only if the is_allowed flag is set o... | true |
1faf5aebc70c86dd5a814303442452942d80f2c8 | SarrayMedMehdi/root-me | /stack_corruption/formatstringbased2.py | UTF-8 | 414 | 2.84375 | 3 | [] | no_license | import struct
def pad(s):
return s+"X"*(128-len(s))
check = struct.pack('I',0xbffffac8) # check address in the stack
over = struct.pack('I',0xbffffac8+2)
exploit = ""
exploit += check #push the address first write
exploit += over #second write
exploit += "BBBBCCCC"
exploit += "%9$48863x" #dead
exploit +=... | true |
a4c67e94df33f3b850aab50e7ae4d64c98a2c355 | gavinljj/ffstream | /ffstream/testbed.py | UTF-8 | 2,441 | 2.890625 | 3 | [] | no_license | from .core import Application, Command, CommandArgumentParser
import sys
import curses
import curses.panel
from .version import Version
class TestbedCommand(Command):
def __init__(self, application: Application, parser: CommandArgumentParser = None):
super().__init__(application, parser)
self._screen = None
sel... | true |
743e7f536bceddfcf5c6fb57285476c468855d61 | jimfinoc/poker | /cardgame.py | UTF-8 | 13,257 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python
import random
gameNumber = 0
players = 0
cardsInPlayerHands = 2
cardSuitsVerbose = ['hearts','clubs','spades','diamonds']
cardSuits = ['h','c','s','d']
cardValuesVerbose = ['two','three','four','five','six','seven','eight','nine','ten','jack','queen','king','ace']
cardValues = ['02','03','04','05','0... | true |
e695e78115a6294e729c25f150c1e883278110f5 | erovicecode590/PyOpenGL_with_Pygame | /main.py | UTF-8 | 1,558 | 3 | 3 | [] | no_license | #=============================================================
# title : Draw a rotating Cube
# description : Create a cube with python and OpenGL
# author : Alan Ramirez
# date : date
# usage : python main.py
# python_version : 3.6.2
#=====================... | true |
c65934dadefa8575f6fc93e12e98912e9edbbbc5 | bwfeldtjr/FFT_Trial | /Original Files/RandomSignal.py | UTF-8 | 742 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 19 14:00:51 2019
@author: Brenden
"""
import scipy.fftpack as scf
import numpy as np
import matplotlib.pyplot as plt
def corr(Lag, Vec):
Lag = Lag
U_uni1= Vec
#U_uni1=np.mean(U_uni1)
Corr=[]
for i in range(Lag):
sum1=0
U1=U_uni1[0:(len(Vec)-i)... | true |
89729a5db77220b8ca8a46865c39fd5a021f8b66 | aminaldo/classification | /cluster2.py | UTF-8 | 2,964 | 2.796875 | 3 | [] | no_license | import os
import csv
from sklearn import datasets
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import MinMaxScaler
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.cluster import KMeans
from scipy import *
test=pd.read_cs... | true |
d166c74d5ceeba6f8555c593883ff3113e203530 | bitphage/bitshares-tradehistory-analyzer | /bitshares_tradehistory_analyzer/cumulative_analyzer_cli.py | UTF-8 | 1,553 | 3.0625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import click
import pandas as pd
from bitshares_tradehistory_analyzer.cumulative_trade_analyzer import CumulativeAnalyzer
def fmt_price(price):
return f"{price:.10f}"
@click.command()
@click.argument("csv_file", nargs=-1)
@click.option("--start", help="Start analysis data, in pandas form... | true |
3b9db8fdabaa46db50c4fe94535e3e24972e2032 | baojialiustc/python_learning | /class_test.py | UTF-8 | 327 | 3.578125 | 4 | [] | no_license |
class CallableAdd:
def __init__(self, a, b):
self.a = a
self.b = b
def __call__(self):
return self.a + self.b
if __name__ == '__main__':
# tensorflow use call function
# python need to use __call__ function to turn class into callable one
add = CallableAdd(2, 3)
print... | true |
170ec3979a2e740d273d95f3434288e17a6ebb1f | GGL12/myStudy | /leetcode/剑指offer/tree_convert_to_chain.py | UTF-8 | 936 | 3.265625 | 3 | [] | no_license | class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def convert(self, pRootOfTree):
if not pRootOfTree:
return pRootOfTree
if not pRootOfTree.left and not pRootOfTree.right:
return pRootOfTree
... | true |
d8175bbab8c6096cd5e421682e5ef0b7e1701cf8 | dask/zict | /zict/tests/utils_test.py | UTF-8 | 8,098 | 2.75 | 3 | [] | permissive | from __future__ import annotations
import random
import string
import threading
import time
from collections import UserDict
from collections.abc import ItemsView, KeysView, MutableMapping, ValuesView
from concurrent.futures import ThreadPoolExecutor
import pytest
from zict.common import ZictBase
# How many times t... | true |
e5f7ea51aed300fe92d2f031c47106fa579521b5 | LisanneWiengarten/CLT-LangRecognizer | /Evaluate_Recognizer.py | UTF-8 | 9,442 | 3.53125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# CLT Abschlussprojekt Sprachidentifikation
# Python 2.7.3
# Lisanne Wiengarten Matrikelnummer 764870
import sys
from collections import deque
from operator import itemgetter
# Untersucht das übergebene Dokument Zeile für Zeile statt im Ganzen.
# Für jede Zeile kann angegeben werden,... | true |
6ca31185c6368b465246434934ea7deaa1e9a046 | PedroBiel/Cierzo | /Cierzo_1.0.0/CTE/datos/presiones_estaticas.py | UTF-8 | 853 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
DESCRIPCIÓNCIERZO CTE DB SE-AE
Lista de las presiones estáticas en las alturas sobre el terreno a cada paso
Created on Tue Mar 26 16:15:51 2020
__author__ = Pedro Biel
__version__ = 1.0.0
__email__ = structural.eng.biel@gmail.com
"""
class PresionesEstaticas:
"""
Lista de las pres... | true |
682daf8be01180837aac45e0a5202ac6f78481ef | bbartholome/Display_ppt | /copy file.py | UTF-8 | 1,661 | 3.171875 | 3 | [] | no_license |
import shutil, os
from os import walk
original_patch = r'C:/Git/Display_ppt/Drop/'
target_path = r'C:/Git/Display_ppt/copy/'
def copy_file(source, target):
original = [] # get the list of file in directory 'path'
for (dirpath, dirnames, original_filenames) in walk(source):
original.extend(original... | true |
ef5a3a7badc916fc85a04bd6497cf0eda1e13f4b | rahulcode22/Data-structures | /Backtracking/Combination-sum.py | UTF-8 | 577 | 2.890625 | 3 | [] | no_license | from itertools import groupby
def combinationSum(self,arr, target):
res = []
arr = sorted(arr)
def dfs(remain, stack):
if remain == 0:
res.append(stack)
return
for item in arr:
if item > remain:
break
if stack and item < stack[... | true |
fe3e904f75e604e819fe6d37a4ac84081ac24340 | payola469/Example_python | /Lecture 17.py | UTF-8 | 71 | 2.546875 | 3 | [] | no_license | print(type(10/3))
print(type(10+3))
print(type(10-3))
print(type(10*3)) | true |
050f4222420fd02a8d8ab85ecf694b1245a86d87 | rafaelds9/FiltrosIFPB | /bessel_principal.py | UTF-8 | 1,993 | 3.0625 | 3 | [] | no_license | from bessel import *
import matplotlib.pyplot as plt
resposta = 'hp'
wp = 5000.0 #Frequência de passagem
ws = 1000.0 #Frequência de rejeição
ap = -1.0 #Valor de amplitude na banda de passagem
a_s = -20.0 #Valor de amplitude na banda de rejeição
ordem = 1 #Ordem inicial
ordem... | true |
ce94754722dd0adb07dfb3ff8bbc6b54dce1a399 | bradykim7/Algorithm | /HackerRank/Problem_Solving/GraphTheory/Breadth_First_Search:Shortest_Reach.py | UTF-8 | 2,077 | 3.3125 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the bfs function below.
def bfs(n, m, edges, s):
# we will going to stored the fastest path in ans .
ans =[]
# DFS , BFS : We should make graph
graph = {}
# 'n' is the number of nodes
# And node start with 1 not... | true |
dd242d96b9cfaf6c0bfe593b93a03074b643eae4 | microspheres/Optlev | /LabView Code/Stanford/opt_lev-master/scripts/force_sens_vs_pressure.py | UTF-8 | 1,543 | 2.875 | 3 | [] | no_license | ## plot the theoretical force sensitivity vs pressure,
## see Li thesis, eqn 6.14
import numpy as np
import matplotlib.pyplot as plt
p = np.logspace(-10, 3, 1e3) ## in mbar
bead_rad = 2.3e-6 ## m
bead_dens = 2e3 ## kg/m^3
air_viscosity = 18.54e-6 ## Pa s
kb = 1.38e-23
T = 300.
gas_diam = 1.42e-10 ## m
bead_mass = 4... | true |
d6d215f42f07564016bb07ccabbe0e03b4a48c44 | PlyushevyyMishka/pytools | /nowtime.py | UTF-8 | 1,281 | 2.625 | 3 | [] | no_license | import re
import datetime
import locale
import argparse
from inc import EPILOG
def strftime(datetimeobject, formatstring):
formatstring = formatstring.replace("%%", "guest_u_never_use_20130416")
ps = list(set(re.findall("(%.)", formatstring)))
format2 = "|".join(ps)
vs = datetimeobject.strftime(format2... | true |
078b0a63db7f654c4809eb37c87ff7f277030403 | nitinnat/MNIST_Classification | /Final/Logistic Regression with Tensorflow.py | UTF-8 | 9,814 | 2.859375 | 3 | [] | no_license |
# coding: utf-8
# In[21]:
# coding: utf-8
# In[1]:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from sklearn.model_selection import train_test_split
import gzip
import os
import sys
import time
import imageio
from six.moves import urllib
from six.m... | true |
067b7120124b66080164bb422f548b33e7228cbd | fredzhangziji/myPython100Days | /Day6_Function_Module/Test12.py | UTF-8 | 301 | 3.046875 | 3 | [] | no_license | def printOut():
print("This is the function in Test.py")
if __name__ == "Test12":
print("This will run when being imported as a module.")
printOut()
if __name__ == "__main__":
print("This will run when being treated as a main file.")
print("You are testing this Test12.py file.") | true |
ed2dd9a4ef8bb7c00fb4585c685e0e92bf8521b2 | NahHyun-Kim/PythonProject | /CodeitPython/파이썬_1/모듈.py | UTF-8 | 740 | 4.09375 | 4 | [] | no_license | # 모듈 불러옴(module.py 파일에서, sum 함수를 불러와라)
# 모듈 : 변수, 함수, 클래스 등을 모아둔 파일(재사용성)
from 계산기 import sum, square
print(sum(3,5))
print(square(3))
# 파이썬에 기본으로 내장된 random 모듈 사용
from random import randint, uniform
# 변수, 함수, 클래스 등을 모아 놓은 파일,
# from 모듈파일 이름 import 불러올 함수/변수/클래스명(모두 호출 시 * 사용)
print(randint(1,10)) # 두 수 사이의 정수를 임의로... | true |
20a882e54635e671fca98e1190ac19d802c7e34b | claudianjeri/One-Minute-Pitch | /app/models.py | UTF-8 | 1,482 | 2.796875 | 3 | [] | no_license | from . import db, login_manager
from werkzeug.security import generate_password_hash,check_password_hash #generate takes in a password and return hash and check does the opposite.
from flask_login import UserMixin
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class User(U... | true |
64d2a9e58790e1d7f0e9f5fb965ff63c33e74f85 | michael-0115/AlgorithmsAndDataStructures | /000_Python_Programming/002_Building User-Defined Python Classes and Methods/task3.py | UTF-8 | 8,049 | 4.1875 | 4 | [] | no_license | from task1 import StringClass #Importing String Class
from task2 import StringListClass #Importing StringListClass
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
print ("The programe will show the impletmentation of the methods inside the ... | true |
b429405ca6f84b3477e23e3f32d2e018db6cfb3e | artistgrowth/bandsintao | /bandsintao/jjson.py | UTF-8 | 5,547 | 3 | 3 | [
"MIT"
] | permissive | # coding=utf-8
import datetime
import decimal
import json
import logging
import re
import dateutil.parser
import pytz
logger = logging.getLogger(__name__)
def _get_iso_regex():
"""
Creates a regex that handles a subset of the ISO 8601 format that we care about.
Date objects should be recognized by the ... | true |
2412599c94e6f6a8a331ceff8d3ac23e621c1f7c | BusBang/Practice-PythonAndR | /PycharmProjects/Algorithm/algorithm_start/14_fibonacci_dynamic_programing.py | UTF-8 | 816 | 3.5 | 4 | [] | no_license | # 피보나치 수열 (다이내믹 프로그래밍)
# Dynamic programming 동적 프로그래밍
# 메모이제이션 (Memoizaition)
# 함수 호출한 결과값을 메모한다
# 함수 호출은 비용이 크다
# 함수 호출을 적게하기 위한 방법
# 메모해 놓은 값을 넘겨서 이미 계산한 값을 계산하지 않도록 함 (주로 파이썬에선 리스트)
# 메모해둔 값에서 먼저 찾아본다 !!
def fib(n, lookup):
if n <= 1:
return n
# lookup[n]이 없을 때, None일 때 계산해서 넣는 로직
... | true |
ee47b5210827b136766b8dbc7bf75fde54c7401c | mc-cat-tty/AdventOfCode2020 | /day2_1.py | UTF-8 | 521 | 3.25 | 3 | [] | no_license | """
Day 2, part 1 - Password Philosophy
https://adventofcode.com/2020/day/2
Usage: pipe your input into the script
"""
__author__ = "Francesco Mecatti"
import re, sys
def main():
count = 0
for ele in sys.stdin:
# print(ele)
r = re.match(r"(\d+)-(\d+) (\w): (\w+)", ele).groups()
Nmi... | true |
a643218a70e7cdf8d491c96ac2811edfd6490a5e | pralab/secml-zoo | /models/mnist/_exporters/mnist59-svm.py | UTF-8 | 751 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import sys
sys.path.insert(0, '../../')
from svm import svm
from secml.data.loader import CDataLoaderMNIST
from secml.ml.peval.metrics import CMetricAccuracy
tr = CDataLoaderMNIST().load('training', digits=(5, 9))
tr.X /= 255
clf = svm()
clf.verbose = 1
clf.C = 0.1
clf.fit(tr.X, tr.Y)
ts = CDataLoaderMNIST().loa... | true |
3544d07bfa35c7fa84307ea02a25f582d0a6acde | archiba/framania | /framania/pandasmania/merge.py | UTF-8 | 4,027 | 3.03125 | 3 | [
"BSD-3-Clause"
] | permissive | from typing import List
from pandas import DataFrame, MultiIndex
def merge_on_columns_without_breaking_index(left_df: DataFrame, right_df: DataFrame,
left_on: List[str], right_on: List[str],
how: str,
... | true |
f24d268dea954f4961a84ad45955b22da201a887 | hamishgibbs/fbutils_py | /fbutils/process.py | UTF-8 | 674 | 3.421875 | 3 | [] | no_license | import pandas as pd
def process_tile_movement(mob: pd.DataFrame) -> pd.DataFrame:
"""Apply basic processing steps to Tile Movement dataset.
1. Define a journey column.
2. Define percent change from baseline.
Args:
mob (pd.DataFrame): Input movement data.
Returns:
pd.DataFrame: P... | true |
f226179292777edc424c19baae0ac25c2cfeb67a | Daiwik22/python_basic_concept | /try.py | UTF-8 | 204 | 3.703125 | 4 | [] | no_license | class Dog:
def __init__(self):
self.color="brown"
def wash(self):
self.color="white"
return self.color
dog1=Dog()
print(dog1.color)
color_new=dog1.wash()
print(color_new) | true |
06b260b001fe3fc5a6f7c76b905a72af2f0df4c8 | mojh7/jackkong_algo | /week 1~10/week2_20200322/jaeyeonlee0621_2.py | UTF-8 | 678 | 3.15625 | 3 | [] | no_license | def solution(bridge_length, weight, truck_weights):
queue = [[truck_weights[0], 1], ]
cur_weight = truck_weights.pop(0)
time = 1
while len(queue):
i = 0
while i < len(queue):
queue[i][1] += 1
if queue[i][1] > bridge_length: cur_weight -= queue.pop(0)[0]
... | true |
1179ca897ec00540100fbe967c302004bced1bb6 | mostofa-ahsan/Spark | /Count_by_word.py | UTF-8 | 681 | 3.0625 | 3 | [] | no_license | from pyspark import SparkConf, SparkContext
import re
conf = SparkConf().setMaster("local").setAppName("WordCount")
sc = SparkContext(conf = conf)
def norm_word(line):
return re.compile(r'\W+',re.UNICODE).split(line.lower())
input = sc.textFile("file:///sparkcourse/book.txt")
words = input.flatMap(norm_... | true |
a095ed32a312768ef455ab0cd7f6c9b3a3e7d7f2 | Pulkit12dhingra/Python_and_the_Web | /Scripts/Web_Scrappers/Discord_News_Hook/inshorts.py | UTF-8 | 2,362 | 3.5625 | 4 | [
"MIT",
"Python-2.0"
] | permissive | """
Make the request to the inshorts url according to category with requests module.
Parse using beautiful soup and lxml to form the newsDictionary.
"""
import requests
from bs4 import BeautifulSoup
def getNews(category):
newsDictionary = {"success": True, "category": category, "data": []}
try:
html... | true |
78e266624f48f4464663e5ec0c3d184ad44f0bbb | zhaone/Minimax_Reversi | /player.py | UTF-8 | 876 | 3.59375 | 4 | [] | no_license | #!/usr/bin/Anaconda3/python
# -*- coding: utf-8 -*-
class Player(object):
"""
玩家基类
"""
def __init__(self, color=None):
"""
获取当前玩家状态
:param color: 如果 color=='X',则表示是黑棋一方; color=='O',则表示白棋一方。
"""
self.color = color
def get_move(self, board):
"""
... | true |
1e97204fc6b3526010107f14d655a2ffe462ed52 | evaneldemachki/fbi-discord | /routing.py | UTF-8 | 5,563 | 2.671875 | 3 | [] | no_license | def initialize(conn, c):
c.execute('''
create table if not exists trump (quote text null)
''')
c.execute('''
create table if not exists members (
guild_id bigint null,
user_id bigint null,
infractions int null,
xp bigint null,
thumbnail text null,
uniq... | true |
6298c61524806e63c7e40b1c88312ac8308e1382 | StefaniaSferragatta/ADM_Homework_3 | /Search_engines.py | UTF-8 | 10,674 | 2.609375 | 3 | [] | no_license | from field_functions import *
import re
import os
import csv
import nltk
import pickle
import numpy as np
import heapq
from scipy.spatial import distance
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk.stem import PorterStemmer
from nltk.tokenize import RegexpTokenizer
f... | true |
e12a87533c5cb7d128a6e942c33c782564397021 | JoaoRecktenwald/Mineracao_emocao | /Programa funcionando/emocao.py | UTF-8 | 80,863 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import nltk
from converttotext import *
texto = ouvir_microfone()
#nltk.download('all')
#nltk.download('rslp')
base = [
('este trabalho é agradável','alegria'),
('gosto de ficar no seu aconchego','alegria'),
('fiz a adesão ao curso hoje','alegria'),
('eu sou admirada por muitos','alegria'),... | true |
690a384e6044ef2a65207eb5a9df94f2d58351e3 | Drkchy/RL | /S1_Bandits/agent.py | UTF-8 | 4,427 | 3.21875 | 3 | [] | no_license | import numpy as np
"""
Contains the definition of the agent that will run in an
environment.
"""
class RandomAgent:
def __init__(self):
"""Init a new agent.
"""
def act(self, observation):
"""Acts given an observation of the environment.
Takes as argument an observation of th... | true |
a9073b5210614275a594930a25ec33bf6ee61316 | TRIDEEPTEJA/Football-score-Notifications-using-python | /scores.py | UTF-8 | 2,980 | 2.9375 | 3 | [] | no_license | from bs4 import BeautifulSoup
from urllib.error import URLError
from urllib.request import urlopen
from sys import exit
from time import sleep
import platform
def sendmessage(message):
if pf == 2:
Popen(['notify-send', message])
else:
toaster = ToastNotifier()
toaster.sh... | true |
1dcba5646023a67d48efd2ae8db638b08fa69096 | Kipsora/docker-curator | /third_party/pytools/pytools/pyutils/misc/config.py | UTF-8 | 4,313 | 2.75 | 3 | [
"MIT"
] | permissive | import argparse
import importlib
import os
from pytools.pyutils.io.file_system import get_path_dirs, get_relative_path, is_subdirectory, get_absolute_path
from pytools.pyutils.io.pretty import load_yaml
from pytools.pyutils.misc.nested import AttrListDictifier, DictOnlyMerger
__all__ = ["ConfigBuilder"]
class Confi... | true |
8ff72c50ac3b92ffb8e0716a9ae5506ee318a995 | samsepiol-e/cipher | /CipherTools/CipherLib/passgen.py | UTF-8 | 1,603 | 2.84375 | 3 | [
"MIT"
] | permissive | from Crypto.Random import random
import re
strength_order = [
r'^(?=.{32,})((?=.*[a-z])(?=.*[A-Z])(?=.*[\W_])(?=.*[0-9])).*$', #all character tyes over 32 letters
r'^(?=.{24,})((?=.*[a-z])(?=.*[A-Z])(?=.*[\W_])(?=.*[0-9])).*$',
r'^(?=.{16,})((?=.*[a-z])(?=.*[A-Z])(?=.*[\W_])(?=.*[0-9])).*$',
... | true |
3d71ef2be83b15340f576586bd05b197a847b3a4 | Mina2013/WebFundamentals- | /Python/names.py | UTF-8 | 1,101 | 3.40625 | 3 | [] | no_license | ###/***/Print values only/***/
def names(dic1):
for i in students:
print i['first_name']
students = [
{'first_name': 'Michael', 'last_name' : 'Jordan'},
{'first_name' : 'John', 'last_name' : 'Rosales'},
{'first_name' : 'Mark', 'last_name' : 'Guillen'},
{'first_name' : 'KB', 'last_name' ... | true |
eee8c3552a2681295d174ec3a076147fd00755e3 | DudeMSK/python_project_baumana | /dbOperation.py | UTF-8 | 3,804 | 2.890625 | 3 | [] | no_license | import os
import sqlite3
class db_operation:
def __init__(self):
self.cursor = None
self.connection = None
self.pathToFile = 'history_weather.db'
self.sql_create_table_city = '''CREATE TABLE IF NOT EXISTS city (
id integer PRIMARY KEY... | true |
72e34423807f2c1aee11b0859a221a06f79ee31f | lefttree/python_crawlers | /zhihuCrawler/db_handle.py | UTF-8 | 529 | 2.828125 | 3 | [] | no_license | from sqlalchemy import *
from sqlalchemy.ext.declarative import *
engine = create_engine('sqlite:///:memory:', echo=True)
Base = declarative_base()
class User(Base):
# must have
__tablename__ = 'users'
# at lease one primary key column
id = Column(Integer, primary_key=True)
name = Column(String)... | true |
d6f117615e9a641c46f60cd6b2b44eea2ec6c094 | JmiXIII/ramstk | /tests/test_utilities.py | UTF-8 | 6,079 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
#
# tests.test_utilities.py is part of The RAMSTK Project
#
# All rights reserved.
# Copyright 2007 - 2017 Doyle Rowland doyle.rowland <AT> reliaqual <DOT> com
"""Test class for testing the Utilities module algorithms and models."""
import os
import tempfile
from datetime import datetime... | true |
bcf5cc23288764dad77f6211eadf8cd255c75a77 | 2111905222/Deeplearning | /Keras/04_回归问题.py | UTF-8 | 3,611 | 2.921875 | 3 | [] | no_license | from keras.datasets import boston_housing
(train_datas, train_targets), (test_datas, test_targets) = boston_housing.load_data()
# 数据预处理,标准化处理,即数值本身减去平均数再除以标准差,因为房子和房子之间价格差距过大
mean = train_datas.mean(axis=0)
train_datas -= mean # 减去平均数
std = train_datas.std(axis=0) # 标准差
train_datas /= std
# 注意,无论是测试数据还是训练数据都要从这里进行统... | true |
d456bd6bc36f96ca43bcf492232d8735e632a730 | gitTianxy/py-basics | /reflect_demo.py | UTF-8 | 937 | 2.734375 | 3 | [] | no_license | # coding=utf-8
import datetime
import bson
import inspect
class ParantDemo(object):
def __init__(self):
self.p_attr_pub = bson.ObjectId()
self._p_attr_pro = datetime.datetime.utcnow()
self.__p_attr_pri = "parent-attr-private"
class SonDemo(ParantDemo):
def __init__(self):
sup... | true |
caa801e49abfa117814f51d1085f54d5be1bd2e2 | ksopyla/Matplotlib_examples | /5.zad/zad1.py | UTF-8 | 583 | 3.34375 | 3 | [] | no_license |
import numpy as np
import matplotlib.pyplot as pl
# f(x)=sin(n*x) n [1-5]
x = np.linspace(-np.pi,np.pi,100)
N = [1,2,3,4,5]
line_styles = [
("blue", ":"),
("red", "-"),
("green", "--"),
("orange", "-."),
("magenta", "-"),
]
pl.figure()
for n,cs in zip(N,line_styles):
print(n,cs[0],cs[1])... | true |
f0291126cb5c840b9aad95d313105bf5955a547a | edbutcher/trainingAll | /Task/Unruled_Lab/task2.py | UTF-8 | 153 | 3.171875 | 3 | [] | no_license | def find_num(somelist):
for i in somelist:
if i % 2 > 0:
return i
somelist = [0, 8, 2, 50, 13, 6, 34]
print(find_num(somelist))
| true |
e98a7053449701339499628922713ffd78bd2250 | hekejun/myutils36 | /datetimes.py | UTF-8 | 2,260 | 3.0625 | 3 | [] | no_license | # coding=utf-8
"""
datetime的帮助方法
"""
__author__ = 'kejun'
import datetime
import re
import time
from dateutil.parser import *
import check
def get_now(pattern=None):
"""
get the current date time with predefine pattern
:param pattern: datetime pattern,choices:'%Y-%m-%d %H:%M:%S','%m%d%y%H%M%S',...
... | true |
92d054df39659aa410a7d74f707aebcd26e7582e | rhaxlwo21/Python_Sunrin | /practice03.py | UTF-8 | 384 | 3.546875 | 4 | [] | no_license | # 시험점수를 입력받아 합격,불합격 출력하기
# if 문 여러문장 사용해보기
num=int(input("시험 점수를 입력하시오:"))
if num>=70:
print("합격입니다")
print("합격통지서를 메일로 보내드립니다")
else:
print("불합격입니다")
print("지원해주셔서 감사합니다.")
print("프로그램을 종료합니다")
| true |
fd1da31aed912d62d9d8d9a85f908ca274e97db3 | JerrelSogoni/HydroPiOnics | /src/hp/gui/MenuBarView.py | UTF-8 | 2,158 | 2.6875 | 3 | [] | no_license | import wx
class MenuBarView(wx.MenuBar):
def __init__(self):
super(self.__class__, self).__init__()
self.menuFile = self.initFileTab()
self.menuMode = self.initModeTab()
self.menuHelp = self.initHelpTab()
self.menuRun = self.initRunTab()
self.Append(self.menuFile, '&... | true |
4964e373f65cea01350e6ccd500d51e3ac7b34bc | AndreyGarro/Image_processing_catalog | /3_Gray_scale_transformation/transformada_gamma/trans_gamma.py | UTF-8 | 2,224 | 3.90625 | 4 | [] | no_license | import numpy as np
import imageio as im
import matplotlib.pyplot as plt
# Importacion de bibliotecas matematica, manejo imagenes y graficado
def trans_gamma(A):
# Transformada gamma (potencia)
# realiza un cambio en el "brillo" de la imagen dependiendo del valor de
# gamma
# gamma > 1 : se aclara ; 0 < gamma < 1... | true |
642dae6870714282e4c2d2031cd8ba34f2bc0c6a | leecmoses/intro-to-cs | /25-qna/notes.py | UTF-8 | 507 | 3.9375 | 4 | [] | no_license | #############
# Notes #
# Lesson 25 #
#############
'''
* 'Pythonic' way is doing things the best way in Python
* More people are using Python 3 than Python 2 in recent years (2018)
* ref - https://learntocodewith.me/programming/python/python-2-vs-python-3/
* Usually while loop is more efficient but a recursion... | true |
742fbfe686f731f0c2321fe8078558528463f4ce | mapuerta/payroll_application | /apps/utils/misc.py | UTF-8 | 1,873 | 2.59375 | 3 | [] | no_license | try:
import cStringIO as StringIO
except ImportError:
import StringIO
from PIL import Image
from PIL import ImageEnhance
from random import randrange
import re
import base64
Image.preinit()
Image._initialized = 2
DATE_FORMAT = "%Y-%m-%d"
TIME_FORMAT = "%H:%M:%S"
DATETIME_FORMAT = "%s %s" %(DATE_FORMAT, TIM... | true |
a795df19f7de5649b460d69ff3fa8a6246f38f9d | jnf611/cpp-init-prog | /python/s01-ec-01-age-cap.py | UTF-8 | 480 | 4.09375 | 4 | [] | no_license | #!/usr/bin/env python3
"""Ecrivez un programme age.cc qui :
demande son age a l'utilisateur ;
lit la reponse de l'utilisateur et l'enregistre dans une variable age de type entier;
calcule l'annee de naissance (a un an pres) de l'utilisateur et l'enregistre dans la variable annee de type entier;
affich... | true |