blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
54db4ff9f47345b416f19aaf069b1483c6e7d93c | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_135/3307.py | UTF-8 | 1,562 | 3.390625 | 3 | [] | no_license | from codecs import open as cOpen
from sys import argv
def takeFive(f):
"""Parses the next 5 lines, returns possible numbers
Args: f; file
Returns: List of int
"""
rowguess = int(f.next().strip())
for i in xrange(4):
row = [int(e) for e in f.next().strip().split(' ')... | true |
7c50347e481ca5ee3b581cae5a5d2c776897cad9 | Python | adrianogil/Okane | /src/python/okane/commands/savecategory.py | UTF-8 | 618 | 3.078125 | 3 | [
"MIT"
] | permissive |
def get_cmd_flags():
return ["-sc", "--save-category"]
def get_help_usage_str(application_cmd="okane"):
help_usage_str = f"\t{application_cmd} -sc <new-account-to-be-created>: save a category\n"
help_usage_str += f"\t{application_cmd} --save-category <new-account-to-be-created>: save a category\n"
re... | true |
d4d7c3a503d4b7f13ab42d01ec33d0da26b9074f | Python | zuzanna-f/pp1 | /05-ModularProgramming/shapes.py | UTF-8 | 1,134 | 4.0625 | 4 | [] | no_license | #05.09, 05.12
def drawSquare(x,y,n):
import turtle
turtle.penup()
turtle.setposition(x, y)
turtle.pendown()
for x in range(5):
turtle.forward(n)
turtle.right(90)
turtle.setheading(0)
def drawCircle(x, y, r):
import turtle
... | true |
9cca477ea4d91145d2a0c29d0ddad2a5f8c5be21 | Python | zhangxiaowei5346/sentiment_analysising | /preprocessing.py | UTF-8 | 1,462 | 2.75 | 3 | [] | no_license | import hanlp
import json
import torch
from torchtext import data
import argparse
def parse_args():
args = argparse.ArgumentParser()
# network arguments
args.add_argument("-data", "--data",
default="project3_train.csv", help="data directory(默认在data文件夹下)")
args.add_argument("-j_s",... | true |
dfba65b29accb8382e99bc8ecc5ce450c2533e53 | Python | nournia/raja-feed | /main.py | UTF-8 | 1,590 | 2.53125 | 3 | [] | no_license | # coding=utf8
import datetime
from flask import Flask, request
from werkzeug.contrib.atom import AtomFeed
from pyquery import PyQuery as pq
app = Flask(__name__)
def getRajaLastNews():
domain = 'http://www.rajanews.com'
raja = pq(domain)
item = raja('.slider1 .item')
yield {
'title': item.find('.title').text... | true |
cb5a938721bf01386267a17b1eda874a02ec1c51 | Python | EwertonWeishauptRuiz/dotfiles | /i3blocks/wacken.py | UTF-8 | 311 | 3.21875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
from datetime import date
wacken_date = date(2023, 8, 2)
copenhell_date = date(2023, 6, 18)
remaining_wacken = wacken_date - date.today()
remaining_copenhell = copenhell_date - date.today()
print(f"W:O:A {remaining_wacken.days} | ₦ {remaining_copenhell.days}")
| true |
2f46b6b211bed5a334689fd72e8d3e741104fc54 | Python | horseTom/Test | /study-python/GuessNumberGAME.py | UTF-8 | 587 | 4.09375 | 4 | [] | no_license | import random
def Gamer():
print("猜数游戏:请猜一个0到100之间的整数,共有5次机会")
AI_NUM = random.randint(0, 100)
for i in range(5):
Gamer_NUM = int(input('请输入一个整数:'))
if Gamer_NUM > AI_NUM:
print("您猜大了!")
elif Gamer_NUM < AI_NUM:
print("您猜小了!")
else:
print(... | true |
b212a6f0cbe568ee5c73be8c773d6f7f1001e37e | Python | YogeshKapila/sierpinski-fractal | /ToolB_v6.py | UTF-8 | 9,380 | 3.09375 | 3 | [] | no_license | from __future__ import division
from Tkinter import *
from math import sqrt, pow
import os
import glob
''' Calculates coordinates of Sierpinski Gasket Fractal elements. Input: Number of Iterations,
Frequencies of Operation (Two or Three), Dielectric Constant'''
'''v6 : Input base frequency and Scale factors'''
... | true |
398a52f5e08713e1b8817ff58b9c0d6ac75d5438 | Python | bannso/svm_classifier | /codes/preprocess.py | UTF-8 | 824 | 2.9375 | 3 | [] | no_license | import csv
labels = ["健康","养生","心理","男女","疾病","老人","育儿","行业"]
def read_csv(dir):
f = csv.reader(open(dir,"r",encoding="utf-8"))
return f
def createAll():
file = csv.writer(open("../data_120ask/allWithChapter.csv","w",newline="",encoding="utf-8"))
for label in labels:
dir = "../data_120ask/" +... | true |
0611c85c4a1277260a0409fa37ef703ecd42c87c | Python | andrew-jung/i-want-to-hunt | /main.py | UTF-8 | 3,958 | 2.5625 | 3 | [
"MIT"
] | permissive | import ast
from typing import List
import sqlalchemy
from databases import Database
from fastapi import FastAPI
from models import Ailment, Image, Monster, Resistance, Weakness
"""
SQLite config, can remove later, but this is for instant-setup for anyone.
"""
DATABASE_URL = "sqlite:///./monsters.db"
database = Data... | true |
9e8bd73dd4dbcdbf2857944f320c2374ba172670 | Python | leticiarina/PDI | /T1/t1.py | UTF-8 | 5,258 | 3.5625 | 4 | [] | no_license | # Nome: Letícia Rina Sakurai
# NUSP: 9278010
# SCC0251 - Processamento de Imagens
# 1º Semestre/2018
# Trabalho 1 - Gerador de Imagens
import numpy as np
import math
import random
import sys
def functionOne(cLateral):
# Numpy Array que irá armazenar a imagem da cena
sceneImg = np.zeros((cLateral, cLateral), dtype... | true |
7a9863db83848253411ee9eb0e03b4de9c5e6261 | Python | RachelGHogan/coding-challenge | /Problem 7 (Cupcakes).py | UTF-8 | 360 | 3.59375 | 4 | [] | no_license | testCases = int(input("Input the number of test cases: "))
cupCakes = 0
array = []
size = 0
for i in range (testCases):
array.append(int(input("Input the number of cupcakes: ")))
for data in array:
size = 0
for i in range(1, data+1):
if data%i >= cupCakes:
cupCakes = data%i
... | true |
a2fafa18c96e5cd3e98177ace44338d7778b08bf | Python | Maurya232Abhishek/Python-repository-for-basics | /quadratic.py | UTF-8 | 805 | 3.390625 | 3 | [
"MIT"
] | permissive | def QuadraticRegression(px,py):
sumy = 0
sumx1= 0
sumx2= 0
sumx3 = 0
sumx4 = 0
sumxy = 0
sum2y = 0
n=len(px)
for i in range (n):
x = px[i]
y = py[i]
sumx1 += x
sumy += y
sumx2 += x*x
sumx3 += x*x*x
sumx4 += x*x*x*x
p... | true |
a26d5046ca08de33320cdf060b90b9aa4298c20c | Python | mossishahi/ML-handsOn | /2.KNN.py | UTF-8 | 684 | 2.640625 | 3 | [] | no_license | import pandas as pd
from sklearn import preprocessing, model_selection, neighbors
import numpy as np
#print ('hello')
df=pd.read_csv('breast-cancer-wisconsin.data')
df.replace('?',-99999,inplace=True)
print(df.head())
#df.drop(['id'])
df.drop(['id'],1,inplace=True)
print(df.head())
X = np.array(df.drop(['class'],1))... | true |
648a4a361616a5b11e26732f1b96ad0f68e9a9de | Python | DspaceSPI/SPIScan | /pyramid_gui/surveyorgui/surveyorgui/scripts/brianconnect.py~ | UTF-8 | 453 | 3.078125 | 3 | [] | no_license | #!/usr/bin/python2.4
#
# Small script to show PostgreSQL and Pyscopg together
#
##import psycopg2
##try:
## conn = psycopg2.connect("dbname='testdb' user='brian' host='localhost' password='bjuk9.0'")
##except:
print "I am unable to connect to the database"
##cur = conn.cursor()
##cur.execute("""SELECT dat... | true |
dacd92cdcb1f3e2a52a2aeed13e1a6c23b0e1086 | Python | MoisesFreitas1/Algoritmos-e-Estrutura-de-Dados | /Q10.py | UTF-8 | 305 | 3.734375 | 4 | [] | no_license | indice = float(input("Indice de Poluicao (mg/m3): "))
if indice<0.3:
print("Indice de poluicao aceitavel")
if indice >= 0.3 and indice<0.4:
print("O grupo 1 deve parar")
if indice >=0.4 and indice<0.5:
print("Os grupos 1 e 2 devem parar")
if indice>0.5:
print("Os tres grupos devem parar") | true |
a656a5634707b8c3d01e4fa686437976b0f3b806 | Python | tomtaylor/aiy-vision-kit-scripts | /take_image.py | UTF-8 | 622 | 3 | 3 | [] | no_license | #!/usr/bin/env python3
"""Take a photo with the timestamp in the filename, every time the button is
pressed.
"""
from gpiozero import Button
from aiy.pins import BUTTON_GPIO_PIN
from picamera import PiCamera
import time
# Set up a gpiozero Button using the button included with the vision hat.
button = Button(BUTTON_GP... | true |
d937e2b3d72ad4e58cc5c245648e1238798e0d5e | Python | Garthu/UFSC | /INE5416/Atividade II/2423 - URI.py | UTF-8 | 335 | 3.015625 | 3 | [] | no_license | A, B, C = input().split()
A = int(A)
B = int(B)
C = int(C)
trigo = A
ovo = B
colheres = C
qt = 0
for i in range(1, 101):
if trigo // 2 != 0:
trigo = trigo - 2
if ovo // 3 != 0:
ovo = ovo - 3
if colheres // 5 != 0:
colheres = colheres - 5
qt = q... | true |
db5ed2e46accda264e78fa872c7342b76ebcbf25 | Python | wzwtime/TSS | /TSS/test.py | UTF-8 | 2,595 | 3.3125 | 3 | [] | no_license | # coding=utf-8
import random
import operator
waiting_queues = {
# 任务P1
'P1': {
'r1': 0.1, # 需求的CPU资源
'r2': 0.1, # 需求的内存资源
'r3': 0.1, # 需求的I\O资源
't': 1, # 到达队列时刻
'T': 1, # 运行所需时间
},
# 任务P2
'P2': {
'r1': 0.2,
'r2': 0.2,
'r3': 0... | true |
e3485a3ad9ae184a9ba3026484da99f04903d7b9 | Python | cff874460349/tct | /archived/end_to_end/new/common/utils.py | UTF-8 | 14,038 | 2.59375 | 3 | [] | no_license | import datetime
import math
import os
import shutil
from concurrent.futures import ProcessPoolExecutor, as_completed
from copy import deepcopy
import cv2
import numpy as np
import openslide
from config.config import cfg
from common.tslide.tslide import TSlide
import uuid
def image_format(image, width=cfg.algo.DEFA... | true |
7cf6545078719da70aeacb1bf602c537bf4931a1 | Python | zaxtax/Authl | /authl/handlers/fediverse.py | UTF-8 | 9,563 | 2.5625 | 3 | [
"MIT"
] | permissive | """ Fediverse/Pleroma/Fediverse provider """
import functools
import logging
import re
import typing
import urllib.parse
import requests
from .. import disposition, utils
from . import Handler
LOGGER = logging.getLogger(__name__)
class Fediverse(Handler):
""" Handler for Fediverse services (Mastodon, Pleroma)... | true |
5904e9c1fbba1a56edc2076976a7935d07d9ef99 | Python | silverriver/PersonalDilaog | /page_parse/comment.py | UTF-8 | 2,446 | 2.53125 | 3 | [
"MIT"
] | permissive | import json
from bs4 import BeautifulSoup
from logger import parser
from db.models import WeiboComment
from decorators import parse_decorator
@parse_decorator('')
def get_html_cont(html):
cont = ''
data = json.loads(html, encoding='utf-8').get('data', '')
if data:
cont = data.get('html', '')
... | true |
44972130a064b1cce0bfe8ff108f507393587b58 | Python | Alocks/Project-Euler-in-Python | /001-100/018.py | UTF-8 | 1,100 | 4.1875 | 4 | [] | no_license | def tenPow(value,x,y):
list=[3,7]
result=y*(value/10) #How many times 1-9 occurs in hundred
result+=x*((value/100)-1)#how many times 1-99 occurs
result+=list[1]*900 #How many times 100 occurs
result+=list[0]*891 #how many times and occurs
return result
#Discovering total of 1~99 because... | true |
1fca6108e5605651ef10324900074b5826e31088 | Python | taygunk/python-scripts | /binomial_plot.py | UTF-8 | 514 | 3.359375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def plot_binom_pmf(n=4, p=0.5):
# There are n+1 possible number of "successes": 0 to n.
x = range(n+1)
y = stats.binom.pmf(x, n, p)
plt.plot(x,y,"o", color="black")
# Format x-axis and y-axis.
plt.axis([-(max(x)-min(x))*0.05, max(x)*1.05, -0.01, max(y)*1.10])
plt.xt... | true |
3985eb9c68fd5646ea1657fa5a078ea658f2d7da | Python | nikolajovickg/OpenLabs | /script/template.py | UTF-8 | 1,502 | 3.03125 | 3 | [] | no_license | #ucitavanje potrebnih biblioteka
import Ni6008DAQ as daq #biblioteka za citanje sa A/D-D/A konvertera
import time #biblioteka za vreme
import math #biblioteka sa matematickim funkcijama (potrebno zbog sinusoide)
from skripta import * #ucitavanje programa koji je student napisao
from socketIO_client import SocketIO... | true |
937b33864dd5c36970f49d7cbbae8204c5b0f060 | Python | Aasthaengg/IBMdataset | /Python_codes/p03125/s874588426.py | UTF-8 | 101 | 3.171875 | 3 | [] | no_license | A, B = [int(i) for i in input().split()]
if B % A == 0:
ans = A + B
else:
ans = B - A
print(ans)
| true |
b142e0e5649fde679c8633e9eab0a10372baa98c | Python | luntropy/data-warehouse-db | /modules/connection.py | UTF-8 | 933 | 2.546875 | 3 | [] | no_license | import psycopg2
class Connection:
def __init__(self):
self._user = 'postgres'
self._password = 'postgres'
self._host = '127.0.0.1'
self._port = '5432'
self._database = 'dw-initial-db'
self.connection = None
self.cursor = None
def __init__(self, db):
... | true |
c79f3d70f983ec38733cb4aef3cfae6722622e43 | Python | jcehowell1/learn_python | /.vscode/atbs/wyof.py | UTF-8 | 159 | 3.515625 | 4 | [] | no_license | def hello():
print('Yo')
print('Hey')
print('Sup,')
hello()
def plusOne(number):
return number + 1
newNumber = plusOne(18)
print(newNumber)
| true |
75039f717114f65e71caa45991611a00eaf8c568 | Python | HKUST-KnowComp/ASER | /examples/postprocess_aser/aser_to_glucose.py | UTF-8 | 6,675 | 2.75 | 3 | [
"MIT"
] | permissive | import re
import numpy as np
from tqdm import trange
from glucose_utils import Unusable, glucose_group_list, ATOMIC_group_list, \
ATOMIC_subject_list
from atomic_utils import PP_SINGLE
def trim(s):
"""
This function get rid of the empty space at the beginning and end of the string
:param s: A string... | true |
24385b8733eaf706990e8e10e0e31e315d07e23f | Python | fakahil/prysm | /tests/test_psf.py | UTF-8 | 1,750 | 2.703125 | 3 | [
"MIT"
] | permissive | """Tests for PSFs."""
import pytest
import numpy as np
from prysm import psf
from prysm.coordinates import cart_to_polar
SAMPLES = 32
LIM = 100
@pytest.fixture
def tpsf():
x = y = np.linspace(-LIM, LIM, SAMPLES)
xx, yy = np.meshgrid(x, y)
rho, phi = cart_to_polar(xx, yy)
dat = psf.airydisk(rho, 10,... | true |
05cc821d69e8ccdee303fdf1a94b5e10b6a8f381 | Python | johnsmeppurath/perceptrons-and-multi-layer-perceptrons | /perceptrons and multi-layer perceptrons.py | UTF-8 | 4,632 | 3.296875 | 3 | [] | no_license | from sklearn import datasets
from sklearn.neural_network import MLPClassifier
from matplotlib import pyplot as plt
import numpy as np
import csv
import pandas as pd
from sklearn import tree
#The function will read files and seprate it into data and labes and returns the data
def read(filename):
whole_f... | true |
071ddaace0e23976ff386ffa1dbfe14f36219a22 | Python | niulinlnc/bridge-builder | /bin/set_python.py | UTF-8 | 1,752 | 3.015625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
this script just creates a python and a pip entry in bin
that have the executable bit set, and points to the
bridgebuilders virtual environment
this is hany, when you have an OTHER virtual env active and want
to install something into bridgebuilder environment.
we put these links into a fo... | true |
20677ab8b8f28c5d63f279cd63b8c8ad8fe24c6b | Python | dookse/codesignal_python | /arcade/edge_of_the_ocean/adjacent_elements_product.py | UTF-8 | 192 | 3.21875 | 3 | [] | no_license | def adjacent_elements_product(input_array):
return max([input_array[i] * input_array[i + 1] for i in range(len(input_array) - 1)])
print(adjacent_elements_product([3, 6, -2, -5, 7, 3]))
| true |
ea079622331caed5f43baecc5feab8dc1ba0495c | Python | axiomiety/crashburn | /leetcode/palindrome_linked_list.py | UTF-8 | 1,006 | 3.734375 | 4 | [] | no_license | class Solution:
def isPalindrome(self, head: ListNode) -> bool:
def length(node):
n = 0
while node is not None:
n += 1
node = node.next
return n
n = length(head)
if n == 0 or n == 1:
return True
mi... | true |
8e423e3560b70973c90326a31027e6df665de468 | Python | Omar-ALkhateeb/raspberry-pi-node-python-server | /servo.py | UTF-8 | 511 | 2.8125 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
import sys
servoPIN1 = 2
GPIO.setmode(GPIO.BCM)
GPIO.setup(servoPIN1, GPIO.OUT)
servoPIN2 = 4
GPIO.setmode(GPIO.BCM)
GPIO.setup(servoPIN2, GPIO.OUT)
p1 = GPIO.PWM(servoPIN1, 50) # GPIO 17 for PWM with 50Hz
p2 = GPIO.PWM(servoPIN2, 50) # GPIO 17 for PWM with 50Hz
p1.start(0) # Initi... | true |
5a6954ade7ef05bd7785ece8a83b451e123e3d12 | Python | jondeaton/HumanProteinAtlas | /HumanProteinAtlas/test.py | UTF-8 | 1,707 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
"""
File: test
Date: 10/20/18
Author: Jon Deaton (jdeaton@stanford.edu)
"""
import os
import unittest
import argparse
import HumanProteinAtlas
import numpy as np
# change this to be the path on your mahcine
hpa_dataset_path = os.path.expanduser("~/Datasets/HumanProteinAtlas")
class DataLoade... | true |
24d5d6d6d47c4523feb3be52c08b501bbaf6faaa | Python | youjiajia/learn-leetcode | /solution/55/solution.py | UTF-8 | 401 | 2.921875 | 3 | [] | no_license | class Solution(object):
def canJump(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
max = nums[0]
index = 0
while index <= max:
if max >= len(nums)-1:
return True
number = nums[index] + index
if numbe... | true |
e1a326c62b1243d26e6730a5097214a6d4198f6a | Python | waldeilton/cryptotraining | /bittrex2.py | UTF-8 | 3,171 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python3
import io
import csv
import requests
import ccxt
import time
from datamanager import Data
from resampler import resample
resample_how = {
'open': 'first',
'high': 'max',
'low': 'min',
'close': 'last',
'volume': 'sum',
'basevolume': 'sum',
}
bittrex_ma... | true |
04955d50fdfc989c7d4a6e861104325c8eb30fcd | Python | bbqur6045/bob6_forensics | /DNSheader.py | UTF-8 | 3,590 | 2.671875 | 3 | [] | no_license | #Python 3.6 ver
# name : DNS header parser
#-*- coding : utf-8 -*-
import sys
import struct
f = open(sys.argv[1], 'rb')
f.seek(0)
sp = f.read(12)
print("Transaction ID : ", hex(struct.unpack_from(">H", sp, 0x00)[0]))
Flags = (bin(struct.unpack_from(">H",sp, 0x02)[0]))
print ("------------------------ Flags ------... | true |
4a8c39f22961c8e8a8beb8287adc62ae914f4417 | Python | mneedham/modeling-worked-example | /lib/dups.py | UTF-8 | 1,189 | 3.46875 | 3 | [] | no_license | def find_matching_index(pair, dups):
return [index
for index, dup in enumerate(dups)
if pair[0] in dup or pair[1] in dup]
def extract_groups(items):
dups = []
for pair in items:
matching_index = find_matching_index(pair, dups)
if len(matching_index) == 0:
... | true |
cdd2aab2aabc8a7f87b05c061edcf53cc3e1cc54 | Python | miunina/detect_face | /methodes.py | UTF-8 | 10,390 | 2.875 | 3 | [] | no_license | import numpy as np
import cv2
import math
import copy
def get_skeleton(img, Show_Me=False):
mask = copy.deepcopy(img)
from skimage.morphology import skeletonize
skel = (skeletonize(mask // 255) * 255).astype(np.uint8)
if Show_Me:
cv2.imshow("skeleton", skel)
cv2.destroyAllWindows()
r... | true |
4c88844c2739a547e59e99475d8b76ed9b0962d1 | Python | mgajewskik/website_scraper_api | /app/scraper.py | UTF-8 | 2,891 | 2.921875 | 3 | [
"MIT"
] | permissive | import os
import time
import shutil
import requests
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from bs4.element import Comment
from .settings import DATA_PATH
from .utils.log import debug
from .utils.validators import is_valid_url
from .utils.utils import (
make_dirs,
get_filename_from_url... | true |
5102b2a027fda17ec505e109f504a4ed5f166edf | Python | ahmadraw2002/RESPONSI_DKP_MOD4_KEL16 | /Responsi.py | UTF-8 | 1,733 | 3.703125 | 4 | [] | no_license | huruf = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
def enkripsi(huruf):
str = input("Masukkan kata : ")
key = int(input("Key : "))
str = str.lower()
result = ''
for char in str:
if char in huruf:
n = huruf.in... | true |
99666282557f5066aa8be05cfecc0db74185c902 | Python | HabibMrad/DecMeg2014-1 | /submission.py | UTF-8 | 8,066 | 2.59375 | 3 | [] | no_license | import numpy as np
from scipy.io import loadmat
from sklearn.linear_model import LogisticRegression
from collections import defaultdict
import subprocess
def generate_submission(loc_preds, loc_submission, header="Prediction", binary=True):
with open(loc_submission, "wb") as outfile:
if len(header) > 0:
... | true |
3eec264ed47a20bda08cd511f7e19aa475029d55 | Python | Yongbinkang/SubjectTracker | /src/identification_of_missing_subject_terms/exact_matching.py | UTF-8 | 5,465 | 2.84375 | 3 | [] | no_license | import re
import pandas as pd
import operator
import logging
import pathlib
def preprocess_data(df):
''' This function aims to preprocess input dataframe
Parameters
----------
df: input data (pd.dataframe)
dataframe including article Nid, title, description, summary and text
Return
... | true |
1c402de646bf1d72367657eb8f3aa956aac33bd2 | Python | RustPython/RustPython | /Lib/ctypes/test/test_macholib.py | UTF-8 | 4,553 | 2.609375 | 3 | [
"Python-2.0",
"CC-BY-4.0",
"MIT"
] | permissive | import os
import sys
import unittest
# Bob Ippolito:
#
# Ok.. the code to find the filename for __getattr__ should look
# something like:
#
# import os
# from macholib.dyld import dyld_find
#
# def find_lib(name):
# possible = ['lib'+name+'.dylib', name+'.dylib',
# name+'.framework/'+name]
# for dylib i... | true |
9d80f30ceaafd13562099363160951004d6ca7de | Python | gavinlinasd/OnTop | /crawler/crawlerv2.py | UTF-8 | 2,593 | 2.875 | 3 | [] | no_license | import sys
import re
import urlparse
import urllib2
from collections import deque
import metakeywordindex
linkmatch = re.compile('<a\s*href=[\'|"](.*?)[\'|"].*?>')
# define option defaults
options = dict()
options['server'] = 'local'
options['max'] = 0
options['cache'] = 'crawlcache.txt'
# parse input arguments into... | true |
24b1e0a670bad7cfd574c0a81f4f4808d308b84b | Python | hollisliu/Stock-RNN | /download.py | UTF-8 | 552 | 2.796875 | 3 | [
"MIT"
] | permissive | import requests
import pandas as pd
#data = requests.get('https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=IBM&outputsize=full&apikey=demo').json()
data = requests.get('https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol=AAPL&outputsize=full&apikey=2XZ08DFO2AYVOZHD').json()... | true |
37919685dab81811bbb5e1e58fbfaa4835eca7ce | Python | mpoyraz/Udacity-Data-Engineering-Nanodegree | /L2-Cloud-Data-Warehouses/P3-Data-Warehousing-With-Redshift/etl.py | UTF-8 | 1,721 | 2.96875 | 3 | [] | no_license | import configparser
import psycopg2
from sql_queries import copy_table_queries, insert_table_queries
def load_staging_tables(cur, conn):
""" Load songs and users log data from S3 into Redshift staging tables. """
print('Copying songs and users log data from S3 to Redshift staging tables')
for query in... | true |
1c13201eca05117c39b4da583f15343626a6d419 | Python | hananawad12/Assignment1_SSD_Lab | /src/main.py | UTF-8 | 4,074 | 3.5625 | 4 | [] | no_license | from math import sqrt
from datetime import datetime
from task1 import decorator_1
from task2 import decorator_2
from task3 import decorator_3
from task4 import decorator_4
############################################################################
try:
n=int(input("""Enter the task number to execute it (... | true |
16eba0ef3ff43729238a68dca2ccc4074b67e54c | Python | huseyinyilmaz/placebo | /placebo/utils/datautils.py | UTF-8 | 416 | 3.03125 | 3 | [
"MIT"
] | permissive | """Data conversation related functions."""
import six
def invoke_or_get(f, *args, **kwargs):
"""if f is callable this function invoke f with given args and kwargs
and return the value. If f is not callable return f directly.
This function is used to provide options to give methods instead of
attribute... | true |
ffb5fbd7dad76746f02bd03db80f98e7ed48228f | Python | alexey4petrov/reinteract | /lib/reinteract/config_file.py | UTF-8 | 5,157 | 2.75 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | # Copyright 2008-2009 Owen Taylor
#
# This file is part of Reinteract and distributed under the terms
# of the BSD license. See the file COPYING in the Reinteract
# distribution for full details.
#
########################################################################
from ConfigParser import RawConfigParser, Parsin... | true |
5df5e38a97519d8f0db61b08da738cb6a5544673 | Python | abbasnikbakht/traffic-congestion-analysis | /call_googlemaps_api.py | UTF-8 | 1,985 | 2.6875 | 3 | [] | no_license | # Dependencies
import boto3
import googlemaps
from datetime import datetime
import os
# Origin/Destination
squamish = os.environ.get('SQUAMISH_ADDRESS')
east_van = os.environ.get('EAST_VAN_ADDRESS')
downtown_van = os.environ.get('VAN_ADDRESS')
# API Key
api_key = os.environ.get('API_KEY')
def lambda_handler(event, ... | true |
08ccdcbfd0d3906b46eadbeef35773bb198e853c | Python | greypanda/tk_tools | /examples/dropdown.py | UTF-8 | 223 | 2.671875 | 3 | [
"MIT"
] | permissive | import tkinter as tk
import tk_tools
root = tk.Tk()
dd = tk_tools.SmartOptionMenu(root, ['one', 'two', 'three'])
dd.grid()
def callback():
print(dd.get())
dd.add_callback(lambda: print(dd.get()))
root.mainloop()
| true |
ec8cecbaa44eae9f3de99a66e59ef64bba42b293 | Python | deadlyedge/zhibo8 | /zhibo8_v4.5.py | UTF-8 | 3,705 | 2.640625 | 3 | [] | no_license | import datetime
import os
import re
import eel
import requests
from jinja2 import Environment, FileSystemLoader
root = os.path.dirname(os.path.abspath(__file__))
templates_dir = os.path.join(root, "web/")
env = Environment(loader=FileSystemLoader(templates_dir))
template = env.get_template('main_template.html')
file... | true |
677f9192374a6e441c4652693fc73d2ae720913f | Python | lijianbo0130/My_Python | /Python_2_GitHub_NLP/src/Cut_to_word/unit_max_prob_Seg/a_sen_to_word_no_hmm/a4_cut_sentence_no_hmm.py | UTF-8 | 2,161 | 3.171875 | 3 | [] | no_license | #coding=utf-8
'''
Created on 2016年3月20日
@author: 李健博
程序作用:
把一个句子拆分输出最大概率分词
'''
from __future__ import division
import sys
reload(sys)
sys.setdefaultencoding('utf-8') # @UndefinedVariable
import re
from a1_dict_to_preSet import load_dict
from a2_get_dag import get_DAG
from a3_get_sentence_prob import calc
def cut_ma... | true |
82a73c8694cfe3cf0d4fc5522752599de60c8e85 | Python | JunhoKim94/Fast_text | /utils.py | UTF-8 | 1,005 | 2.640625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from preprocess import *
def plot(acc_stack, loss_stack, epochs):
a = [i for i in range(epochs + 1)]
#plt.figure(figsize = (10,8))
fig , ax1 = plt.subplots()
ax2 = ax1.twinx()
acc = ax1.plot(a, acc_stack, 'r', label = 'Accuracy')
loss = a... | true |
4fb17d270be6cc7e571a5c5317f3c6e001ffd4a9 | Python | YingZ98/asg4 | /model_training/model_training/dict/process_dict.py | UTF-8 | 581 | 2.796875 | 3 | [] | no_license | input_file_path = "glove.twitter.27B.25d.txt"
output_file_path = "glove_vector.txt"
content = ["<pad> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"]
file = open(input_file_path, "r")
for word_vector in file:
if word_vector.split()[0] == "<unk>":
a = word_vector.split()[1:]
a.insert(0,"<unkn... | true |
970ba24d72a02e9042d865ed2622a9088b982f50 | Python | Brenda-Werneck/Listas-CCF110 | /Lista 01/exercício 06.py | UTF-8 | 266 | 4.40625 | 4 | [
"MIT"
] | permissive | #Escreva um algoritmo que leia um número inteiro e escreva o seu sucessor e seu antecessor.
num = int(input("Digite um número inteiro: "))
antecessor = num - 1
sucessor = num + 1
print(f"O antecessor de {num} é {antecessor} \nO sucessorr de {num} é {sucessor}") | true |
6ede70cd62c44237092912ffed64e8a9904503dd | Python | rafaelperazzo/programacao-web | /moodledata/vpl_data/421/usersdata/311/84954/submittedfiles/tomadas.py | UTF-8 | 370 | 3.234375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import math
#COMECE SEU CODIGO AQUI
t1 = int(input('Digite o valor1: '))
while t1<1:
t1=int(input('Digite o valor1: '))
t2=int(input('Digite o valor2: '))
while t2<1:
t2=int(input('Digite o valor2: '))
while t3<1:
t3=int(input('Digite o valor3: '))
while t4<1:
t4=int(... | true |
9e1b4a2575acc698f237507890474542923277ca | Python | roger40/CINS_ML-group | /ML_Learning_Group/Biao Wang/DecisionTree/DecisionTree.py | UTF-8 | 9,419 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
# @Time : 2019/5/6
# @Author : Wang Biao
# @Site :
# @File : DecisionTree.py
# @Software: PyCharm
import graphviz
from sklearn import tree
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
import matplotlib.py... | true |
b1d60f57c8829c04292507a0582277ef1386ef5c | Python | Albino1995/leetcode_python | /480/Sliding Window Median.py | UTF-8 | 963 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
__author__ = 'Albino'
class Solution:
# def medianSlidingWindow(self, nums, k):
# """
# :type nums: List[int]
# :type k: int
# :rtype: List[float]
# """
# i = 0
# re = []
# while True:
# tmp = nums[i:i + k]
# ... | true |
005c1ead23e2e07e320d12044484367355636e0e | Python | NYPL-Simplified/circulation | /tests/test_onix.py | UTF-8 | 3,456 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | from io import BytesIO
from parameterized import parameterized
from api.onix import ONIXExtractor
from core.classifier import Classifier
from core.metadata_layer import CirculationData
from core.model import (
Classification,
Edition,
Identifier,
LicensePool)
from core.util.datetime_helpers import dat... | true |
1b3d55303823acc0c8894bc1aa0599875e5f03a6 | Python | minchanglueth/data_operation_script_error | /test.py | UTF-8 | 1,219 | 3 | 3 | [] | no_license | # def add(a, b):
# return a + b
# def multiply(a, b):
# return a * b
class i:
def __init__(self, j: int, a_variable: int, b_variable: int):
self.j = j
self.a_variable = a_variable
self.b_variable = b_variable
def add(self):
return self.a_variable + self.b_variable
... | true |
9cb359dc9b3c49fb833037f75447d7e5ad2c3131 | Python | rajibeee/Sample-Codes | /Hacker-Rank/35 Viral Advertising.py | UTF-8 | 154 | 2.78125 | 3 | [] | no_license | #day=3
day = int(raw_input())
cum=0
global sh
sh=5
for i in range(day):
lik=sh/2
cum+=lik
sh=lik*3
#print "shared==",sh
#cum+=sh
print cum | true |
5bda52dff64eba5880425d4322246a22dc7da4ec | Python | rmotr-students-code/001_PYP_G1 | /class-2/class-resources/class_work.py | UTF-8 | 2,070 | 4.6875 | 5 | [] | no_license | # functions as first class objects
def my_sum(x, y):
return x + y
def subtract(x, y):
return x - y
# write operation function
operation(my_sum, 2, 1) # 3
operation(subtract, 7, 2) # 5
"""
x. Code a function that can receive either a list itself, or diferetn integer arguemnts and computes the Avera... | true |
4c9b90667c3b7562c3097df3a4563d5e8deb7326 | Python | qaqaqaqaowh/test-project | /hello.py | UTF-8 | 141 | 2.640625 | 3 | [] | no_license | def hello():
print("yoooo")
print("Hello")
def bye():
print ("bye")
print("Hola mis amigos")
def something():
print("asdadkcbzuxjbs")
| true |
e1694207f404223c885ceaf1a1b0b698f6581385 | Python | Jimmy-INL/google-research | /gfsa/training/learning_rate_schedules.py | UTF-8 | 5,048 | 2.640625 | 3 | [
"Apache-2.0",
"CC-BY-4.0"
] | permissive | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | true |
6e33f1f72c407236233108e57464366dbbbeee54 | Python | cassiorodrigo/python | /jokenpo.py | UTF-8 | 1,096 | 3.234375 | 3 | [] | no_license | from time import sleep
from random import randint
com = randint(1, 3)
#if com == 1
escolha = int(input(" Para \033[31m Pedra \033[m digite 1\n Para \033[31m Papel \033[m digite 2\n Para \033[31m Tesora \033[m digite 3\n"))
sleep(0.5)
print('\033[32m JO \033[m')
sleep(0.5)
print('\033[32m KEN \033[m')
sleep(0.5)
print('... | true |
bed199cd640b70b822ab05c0197dbdce01934a35 | Python | mikekiwa/ATM | /Dane/program.py | UTF-8 | 842 | 4 | 4 | [] | no_license | import sys
bal = 0
def checkbal():
return(bal)
def withdraw(amnt):
x = bal
if amnt < x:
x -= amnt
print(x)
return(x)
else:
print('You can\'t do that!')
def deposit(amnt):
x = bal
x += amnt
print(x)
return(x)
while True:
user_input = input('What wo... | true |
64754880cbc76cafb62406873db2da1e0e40120a | Python | swaroopnv/lte_event_parser | /parsers/ParserBase.py | UTF-8 | 1,393 | 2.953125 | 3 | [] | no_license | ### Copyright [2019] Zhiyao Ma
import sys
from abc import ABC, abstractmethod
class ParserBase(ABC):
""" The base class for all event parsers. """
def __init__(self, shared_states):
""" Instantiate the ParserBase with a `shared_states` dictionary.
The `shared_states` dictionary are accessed ... | true |
e0c3f9f541ca2fca59bc396e27a8dbeedf202473 | Python | Eurostar64/RailuinoSrcp | /PythonSrcpServer/DataObjects.py | UTF-8 | 4,057 | 2.578125 | 3 | [
"MIT"
] | permissive | import Generators
class DataPackage:
def __init__(self):
self.Command = 0
self.data = bytes([])
self.isResponse = 0
def setFromIncomingPackage(self, databytes):
self.data = bytearray([])
self.Command = (databytes[0] << 7) | ((databytes[1] & 0xFE) >> 1)
self.isR... | true |
a5f34a8da877e6af0655086bde3d767996831505 | Python | ersincebi/hackerrank | /10 Days of Statistics/Day 5 Poisson Distribution I.py | UTF-8 | 175 | 3.484375 | 3 | [
"MIT"
] | permissive | import math
def factorial(n):
return 1 if n == 0 else factorial(n-1) * n
def poison(l, k):
return ((l ** k) * math.e ** (l * -1)) / factorial(k)
print(poison(0.88, 1.55)) | true |
d8e0fe4537d8c7e6a9adc44d4c6b6b2a8c90ef49 | Python | Frantisekf/IP-to-Geolocation | /nonCommerciallDbs/maxmindgeolite2city.py | UTF-8 | 3,243 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python3
import datetime
from urllib import request
import geoip2.database
from geopy.distance import vincenty
def check_ips(ipRecords, separator, cut, replace, verbose):
# Output file & Separator preparation
database_filepath = ''
if separator == 'tab':
separator = '\t'
els... | true |
73966889c0e41ca338622c041820ada170f457eb | Python | cgbahk/permpy | /permpy/statistics.py | UTF-8 | 9,324 | 3.359375 | 3 | [
"MIT"
] | permissive | from permpy.permutation import Permutation
def fixed_points(perm):
"""Returns the number of fixed points of the permutation.
>>> Permutation(521436).fixed_points()
3
"""
sum = 0
for i in range(perm.__len__()):
if perm(i) == i:
sum += 1
return sum
def skew_decomposable... | true |
8a97c3cdb3c3ddb53bcfd6261b13efde59890fd0 | Python | AlfaBettaGamma/DynArray | /newTest.py | UTF-8 | 3,846 | 3.390625 | 3 | [] | no_license | import ctypes
class DynArray:
def __init__(self):
self.count = 0
self.capacity = 16
self.array = self.make_array(self.capacity)
def __len__(self):
return self.count
def make_array(self, new_capacity):
return (new_capacity * ctypes.py_object)()
def __getit... | true |
710af5c29b275300d6645ec73f73820c5cdbf54c | Python | TheGreatJoules/Python | /Algorithms/DynamicProgramming/EqualSubsetSum/Solution.py | UTF-8 | 1,093 | 3.640625 | 4 | [] | no_license | def can_partition(num):
s = sum(num)
# if 's' is an odd number, we can't have two subsets with the same total
if s % 2 != 0:
return False
# we are trying to find a subset of given numbers that has a total of 's/2'
s = int(s / 2)
n = len(num)
dp = [[False for x in range(s + 1)] f... | true |
9af2b120d2521c0dfe22d40873997d8322be1ea0 | Python | zhulf0804/Coding.Python | /leetcode/322_零钱兑换.py | UTF-8 | 1,059 | 2.96875 | 3 | [] | no_license | from typing import List
# 递归
class Solution_1:
def coinChange(self, coins: List[int], amount: int) -> int:
counts = {}
def helper(n):
if n < 0:
return -1
if n == 0:
return 0
res = float('inf')
for coin in coins:
... | true |
d8ca6ed983920c17b18c0f676ec85b00741582d3 | Python | nouseena/project | /my_app/oopss.py/aoop1.py | UTF-8 | 441 | 2.890625 | 3 | [] | no_license | class Student:
def __init__(self,name,rollnumber,age,dob,marks):
self.name = name
self.rollnum=rollnumber
self.age = age
self.dob = dob
self.age = age
def fn_total(self):
total=0
for i in self.marks
total=total+i
print('t... | true |
e079b393118286a97c71cf0e3aa7e98cf302a725 | Python | yyltwin/backupFile | /py/class_property.py | UTF-8 | 327 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
class User:
def __init__(self, name, age):
self.name = name
self._age = age
@property
def age(self):
return self._age
@age.setter
def age(self, value):
self._age = value
user = User("wp", 18)
user.age = 1
print(us... | true |
921e1c43f6529ccb6cf6f3099b30a53fe567ddb8 | Python | GaoX2015/intro_ds | /ch09-generative_models/yahmm/hmm/tests/test_multinomialHMM.py | UTF-8 | 1,019 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: UTF-8 -*-
import numpy as np
from hmm.multinomialHMM import MultinomialHMM
from numpy.testing import assert_array_equal, assert_array_almost_equal
def test_mutlnomialhmm():
"""
"""
mh = MultinomialHMM(alpha=1)
Y = [0, 1, 1, 1]
X = [[1, 0, 0], [0, 1, 1], [0, 1, 0], [0, 0, 1]]
mh.f... | true |
4179d2e11e649b5f23514b01ba1f51083a0db737 | Python | humorbeing/python_github | /evolutionary_algorithms/course/chapter05_multimodal/crowding_CF_V1001/mutation.py | UTF-8 | 6,711 | 2.671875 | 3 | [] | no_license | import numpy as np
# parameters
'''
lambda_gen_in, boundary_in, gen, normal_sigma=0.5, uniform_pm=0.1,
boundary_pm=0.1, maxgen=50, b=5, cauchy_sigma=0.5,
delta_max=20, n=2
'''
def mutation_normal_mutation(lambda_gen_in, boundary_in, gen, normal_sigma=0.5, uniform_pm=0.1,
boundary_pm=0.1, maxgen=50, b=5, cauchy_sigma... | true |
7d8d3e226023ff2c9afd7bc35cd0e1dc1825c3ae | Python | dsblank/pyrobot | /vision/__init__.py | UTF-8 | 37,022 | 2.84375 | 3 | [] | no_license | import struct
from pyrobot.system import file_exists
from pyrobot import pyrobotdir
# Standard convolution matrices:
laplace = ([-1, -1, -1, -1, 8, -1, -1, -1, -1], 1)
hipass = ([-1, -1, -1, -1, 9, -1, -1, -1, -1], 1)
topedge = ([ 1, 1, 1, 1, -2, 1, -1, -1, -1], 1)
sharpen = ([-1, -1, -1, -1, 16, -1, -1, -... | true |
cb476e63da02fb2ef1e0ed63edd9c527276e0b12 | Python | Chienweichih/TPWeather | /Download_TP_Weather_Data.py | UTF-8 | 3,253 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import datetime
'''''''''''''''''''''
* School Id
'''''''''''''''''''''
schoolID = {u'至善國中':'413504',u'國語實小':'353604',u'福林國小':'413603',
u'光復國小':'323603',u'大龍國小':'363607',u'五常國小':'343607',
u'吳興國小':'323606',u'市大附小':'353608',u'博愛國小':'323609',
u'老松國小':'373609',u'... | true |
e211b3f96347faafe7f612c94501ad7155b2d8a1 | Python | heregoesnothing123/MatPlotLim | /Test_kinematicdataset.py | UTF-8 | 3,374 | 3 | 3 | [] | no_license | from kinematicdataset import *
from element_math import *
#Testing program for KinematicDataset
#Test: Load prepared CSV file
test = KinematicDataset()
test.construct_from_file('c:\kinematicdata\jointKinematics.csv')
print("\n\n")
print("==================================================")
print("Testing Da... | true |
7c2e92172c019c38075f9f8d644511181239f0d0 | Python | anjaligeda/Pythonstring-branch | /lnbsplitlist.py | UTF-8 | 481 | 3.9375 | 4 | [] | no_license | #adding elements in list
q=[]
for i in range(20):
a=int(input('enter number = '))
q.append(a)
print(q)
#slicing the list
l2=q[0:5]
l3=q[15:20]
l4=l2+l3
print(l4)
#squaring the elements of list
square=[i**2 for i in l4 ]
print(square)
#splitting the list
length = len(l4)
middle_index = length ... | true |
e41b199ac8499eb3a754d85f4cbccdaba06ab94e | Python | Napster8/FEA--Truss-Problem-Solving-using-Python | /01 Truss Problem.py | UTF-8 | 5,725 | 3.515625 | 4 | [] | no_license | # Dependencies
import copy
import math
import numpy as np
import matplotlib.pyplot as plt
# Constants
# Young's Modulus for Steel in N/m^2
E=200 * 10 ** 9
# Area in (m^2)
A=0.005
# Element 1 (node 1 to 2)
theta=0 # in radians
L=3 # in metres
# 01 Top left quadrant
e11=math.cos(theta) ** 2
e12=m... | true |
30e70e5a4d3d722cfb5dc3047764775038028168 | Python | XXjo/LeetCode | /python/530. 二叉搜索树的最小绝对差.py | UTF-8 | 910 | 3.90625 | 4 | [] | no_license | """
1、二叉搜索树中序遍历即可得到排好序的数组
2、计算数组相邻元素的差值
"""
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def InOrderR(self, root, res):
if root:
self.InOrderR(root.left, res)
res.append(root.val)
self... | true |
cc0300779401cf059d6c55c4d4cd715af1f5afe8 | Python | Ronak912/Programming_Fun | /String/FindSmallestWindowInString.py | UTF-8 | 1,717 | 3.984375 | 4 | [] | no_license | # https://www.geeksforgeeks.org/find-the-smallest-window-in-a-string-containing-all-characters-of-another-string/
'''Given two strings string1 and string2, find the smallest substring in string1 containing all characters of string2 efficiently.
For Example:
Input : string = "this is a test string"
pattern =... | true |
c2370b76a2ea86e5ed52654ec8d13294a4d753be | Python | sunasaji/VRC_log_checker | /vrc_world_user_checker.py | UTF-8 | 970 | 2.546875 | 3 | [
"CC0-1.0"
] | permissive | #!/usr/bin/env python
# License: These codes are licensed under CC0.
import os
import sys
import re
from os.path import dirname, exists
def main():
path = sys.argv[1]
if not exists(path):
print('{} is not found'.format(path))
return
output_file = open("VRChat_usrlog.txt", mode='a', enco... | true |
fe904d83f0b94f1deb2f2a467b3237079ffe8043 | Python | ronaldoussoren/objc_asyncio | /objc_asyncio/_loop_policy.py | UTF-8 | 2,959 | 2.578125 | 3 | [
"Python-2.0",
"MIT-0",
"MIT"
] | permissive | import asyncio
import threading
import typing
from ._loop import PyObjCEventLoop
from ._subprocess import KQueueChildWatcher
_lock = threading.Lock()
class PyObjCEventLoopPolicy(asyncio.AbstractEventLoopPolicy):
class _Local(threading.local):
_loop: typing.Optional[asyncio.AbstractEventLoop] = None
... | true |
3f9ea80ff95ba7a9402d9ac82e1bf078f2042c58 | Python | mikehagerty/mth-inst-resp | /mth_inst_resp/libPlotResp.py | UTF-8 | 6,735 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
import six
def plotResponse_dB(response, freqs):
rad2deg = 180./np.pi
dB = 20.*np.log10(np.abs(response))
pha = np.arctan2(response.imag, response.real) * rad2deg
xmin = .0009
#xmin = .01
xmax = 20
ymin = -40
ymax = -30
ymax =... | true |
922c5d84db5c16bb5c29f0ce9dce16d22d79658d | Python | ritomar/386-2016-2 | /Ex02_Q03.py | UTF-8 | 355 | 4.28125 | 4 | [] | no_license | '''
Faça uma função que recebe dois números por parâmetro e retorna o maior.
'''
def maior(primeiro, segundo):
'''
função que retorna o maior entre dois números
'''
# return primeiro if primeiro > segundo else segundo
if primeiro > segundo:
return primeiro
else:
return se... | true |
86d0abc7a440a1be457a202e1eb1d7850866bf34 | Python | MorvanZhou/Evolutionary-Algorithm | /tutorial-contents/Evolution Strategy/Natural Evolution Strategy (NES).py | UTF-8 | 2,118 | 3.125 | 3 | [
"MIT"
] | permissive | """
The basic idea about Nature Evolution Strategy with visualation.
Visit my tutorial website for more: https://mofanpy.com/tutorials/
Dependencies:
Tensorflow >= r1.2
numpy
matplotlib
"""
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.contrib.distributions import Multivar... | true |
7b151bbdd4cfa462f4f5e54ff07edbe874b3d1f5 | Python | youngsoomoon/codeUp | /6088.py | UTF-8 | 280 | 3.5 | 4 | [] | no_license | '''
입력
시작 값(a), 등차의 값(d), 몇 번째 수 인지를 의미하는 정수(n)가
공백을 두고 입력된다.(모두 0 ~ 100)
출력
n번째 수를 출력한다.
입력 예시
1 3 5
출력 예시
13
'''
a,d,n = map(int,input().split())
r = a+d*(n-1)
print(r) | true |
82a0156aa293403a32880deba96df5644faac995 | Python | apri-me/python_class00 | /Session3/test5.py | UTF-8 | 148 | 2.90625 | 3 | [] | no_license | my_list = ['Mahdi', 'Mohsen', 'Radmehr', "alireza"]
print(my_list)
my_list.append('Hamid')
print(my_list)
my_list.append("Reza")
print(my_list) | true |
c43f646f7d87666218f7439a0729718cce10235d | Python | EricKurachi/python_programming_fundamentals | /src/Chapter 5/Practices/practice_4.py | UTF-8 | 448 | 3.4375 | 3 | [] | no_license | """
The following code does not work. What is the error message?
Do you see why? Can you suggest a way to fix it?
def length(L):
len = 1
for i in range(len(L)):
len = len + 1
return len
print(length([1, 2, 3]))
# TypeError: 'int' object is not callable
# the len variable is overlapping the len bu... | true |
8fc9a96a419c40d8b0170f2c298efc1b5162aacf | Python | daniel-frey/budget_tool | /budget_api/serializers.py | UTF-8 | 893 | 2.703125 | 3 | [] | no_license | """Define serializers for use with budget auth API."""
from django.contrib.auth.models import User
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
"""Create a serializer for user passwords."""
password = serializers.CharField(write_only=True)
class Meta:
... | true |
85886e2c8ca53485f161b8a406988c2c0fda0c0c | Python | cad75/GBLessons | /Lesson_4_HW_7.py | UTF-8 | 146 | 3.46875 | 3 | [] | no_license | from math import factorial
def fact_func(n):
for el in range(1, n + 1):
yield factorial(el)
for el in fact_func(5):
print(el)
| true |
d21bf0cd4cffe90ad8a6c511b4121bda2ded7f86 | Python | Ashkan-Soleymani98/DesignOfAlgorithms---Fall2018-2019 | /Assignments/Assignment2/Q1.py | UTF-8 | 1,450 | 2.953125 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10000)
n, m = map(int, input().split())
edges = list()
for i in range(m):
edges.append(list(map(int, input().split())))
# print(edges)
adjList = [[] for i in range(m)]
# marked = [False for i in range(m)]
place = [None for i in range(m)]
def checkIntersect(a, b):
if a[0] <... | true |