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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
edb9c157e487b58dd50ef6ceb9a56ee5950ec77c | Python | manuelmhtr/algortithms-course | /karatsuba/solution.py | UTF-8 | 610 | 3.296875 | 3 | [] | no_license | import sys
import math
def multiply(m1, m2):
largest = max(len(str(m1)), len(str(m2)))
if largest <= 1:
return m1 * m2
mid = int(math.ceil(largest / 2))
n = mid * 2
m1str = str(m1).zfill(n)
m2str = str(m2).zfill(n)
a = int(m1str[:mid])
b = int(m1str[mid:])
c = int(m2str[:mid])
d = int(m2str... | true |
fd9a553132c94e5dbbac5061262dcad454396467 | Python | jgold189/RandomImageADay | /randomImage.py | UTF-8 | 312 | 2.703125 | 3 | [] | no_license | from PIL import Image
import numpy as np
from datetime import datetime
#Width and height for the image
w, h = 512, 512
data = np.random.randint(256, size=(h, w, 3), dtype=np.uint8)
img = Image.fromarray(data, "RGB")
todayFile = "images/" + str(datetime.today().strftime("%m-%d-%Y")) + ".png"
img.save(todayFile) | true |
995a9c87a2806ef5597ac73c6d06161abe962eee | Python | zanoni/python_proway | /exercicios/marcello/array/ex_ar_3.py | UTF-8 | 552 | 4.0625 | 4 | [] | no_license | '''
n = [4, 7, 2, 3]
maior =0
for i in range(len(n)):
if n[i]> maior:
maior = n[i]
print(maior)
'''
#entrada
qtd_pos = int(input('Quantidade de posições: '))
q = []
num_maior = 0
#processamento
while len(q) < qtd_pos:
num = float(input('Número: '))
if num >= 0:
q.append(num)
else:
... | true |
2156c4c8c21b63ef52d982473d960e98d5be5ad1 | Python | PengchengAi/udp_ctl | /led_test.py | UTF-8 | 716 | 2.875 | 3 | [] | no_license | from gpiozero import LED
from time import sleep
led = [LED(17), LED(27), LED(22)]
en = LED(10) # on(): enable. off(): disable.
while True:
for i in range(2):
for j in range(2):
for k in range(2):
if i % 2:
led[2].on()
else:
... | true |
09aa2b8a198bc841bcd4c0af44ad6dc46d920caa | Python | subho781/MCA-python-Assignment5 | /Q2.py | UTF-8 | 200 | 3.609375 | 4 | [] | no_license | '''build a dictionary with two keys, 'a'
and 'b', each having an associated
value of 0 (using two method)'''
D1={'a':0,'b':0}
print(D1)
L = [('a', 0),
('b', 0)]
D2 = dict(L)
print(D2) | true |
b6f21402f425e62f359fb875ce6d89059c3e300f | Python | RolfSievert/dotfiles | /home/.scripts/split-pdf.py | UTF-8 | 2,943 | 2.984375 | 3 | [] | no_license | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
import argparse
from PyPDF2 import PdfFileReader, PdfFileWriter
import pathlib
from copy import deepcopy
index_example = \
"""
Name of new pdf
2-202
Second pdf name
100-200
150-300
"""
parser = argparse.ArgumentParser(description=f'Set bookmarks... | true |
09daf5c586e83c92068dc609309e92e97d335578 | Python | aiborra11/Geoquery-project | /source/modules/acquisition.py | UTF-8 | 970 | 2.84375 | 3 | [] | no_license | from pymongo import MongoClient
import pandas as pd
#Connecting the database with the queried data (companies_cb)
def mongo_connect(host):
client = MongoClient(host)
db = client.DBcompanies_cb
data = db.companies_cb
return data
# Query using Pymongo to receive all the required data for my analysis. (... | true |
22064b13580015727a2c0bb82295521cbf4b8fff | Python | naiveHobo/PostOCR | /PostOCR/helpbox.py | UTF-8 | 2,410 | 2.515625 | 3 | [
"MIT"
] | permissive | import os
from tkinter import *
from PIL import Image, ImageTk
from .config import ROOT_PATH, BACKGROUND_COLOR
class HelpBox(Frame):
def __init__(self, master, **kw):
Frame.__init__(self, master, **kw)
self.columnconfigure(0, weight=1)
self.rowconfigure(0, weight=0)
self.rowconfi... | true |
e4012b9a8fbb536f921d0d50a2d6ed49c1b38392 | Python | dipakdash/python | /python_socratica/10_lists.py | UTF-8 | 599 | 4.5 | 4 | [] | no_license | #!/usr/bin/python3
# Lists can contain duplicates, different data types
numbers = [1,3,5,7,9,17]
letters = ['a', 'b', 'c']
print(f'list numbers = {numbers}')
print(f'list letters = {letters}')
print(f'first element of list numbers is numbers[0] = {numbers[0]}')
print(f'last element of list numbers is numbers[-1] = ... | true |
830a951e037eab94ec4c5292426ab97ba35cf0e9 | Python | dcasasmol/goz | /goz/dbapi/models.py | UTF-8 | 30,818 | 2.53125 | 3 | [] | no_license | # dbapi/models.py
import datetime
from django.db import models
from django.core.exceptions import ValidationError
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import User as djangoUser
from .exceptions import UserNotSaved
from utils.views import generate_password, is_valid_pa... | true |
6beb56d9675836d5662230b9c70d84289061b9cb | Python | lochwg/AI-Big-data-Training-class | /cv2 - 模糊處理.py | UTF-8 | 684 | 3.015625 | 3 | [] | no_license | import cv2
from matplotlib import pyplot as plt
img_bgr = cv2.imread('Nikola_Tesla.jpg')
img_gray = cv2.imread('Nikola_Tesla.jpg', cv2.IMREAD_GRAYSCALE)
# 數字越大 越模糊
img_gauss = cv2.GaussianBlur(img_bgr, (3, 3), 0)
img_rgb = cv2.cvtColor(img_bgr, cv2.COLOR_BGR2RGB)
plt.figure()
# ===============================... | true |
4e90210ffb48e493b3e8d468ac1e12f4ea3b35e3 | Python | afeldman1/SSW555Team4Project | /gedcom/tests/test_family.py | UTF-8 | 912 | 3.03125 | 3 | [] | no_license | """
SSW 555
2016 Spring
Team 4
"""
import unittest
from gedcom.family import Family
class GEDEntitiesTest(unittest.TestCase):
def test_Family(self):
entity = Family(uid = '@F01@',
husband = 'Mr.',
wife = 'Mrs.',
marriage_... | true |
f679f0e035f999d7c36c932c3ccad985ab01b7b1 | Python | liq07lzucn/Scripts-RayStation-4.7.2 | /assigner_types_poi.py | UTF-8 | 1,380 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Ce script tente d'auto-assigner le bon type de POI pour chacun des POI
présentement définis pour le patient.
.. rubric::
EMPLACEMENT :
- *Patient Modeling*
- *Scripting*
- *Module specific scripts*
Le script se fie au nom des POI. Il ignore la casse.
Ainsi, *Iso scan* et *... | true |
a714b395c18cf4bd60c011d28a8ad67a9094638b | Python | vishalydv23/HackerRankSolution | /cracking the coding interview/Data_Structure_Stacks_Balanced_Brackets.py | UTF-8 | 668 | 3.65625 | 4 | [] | no_license | def is_matched(expression):
lefty = "({[" # opening delimiters
righty = ")}]" # respective closing delims
S = []
for c in expression:
if c in lefty:
S.append(c) # push left delimiter on stack
elif c in righty:
if not S:
return False # nothing... | true |
a6b50e96397e20589fa54d2fc7c7eb5ad944fb1a | Python | rembrandtqeinstein/learningPy | /c_ex_12_5.py | UTF-8 | 919 | 3.109375 | 3 | [] | no_license | # To run this, download the BeautifulSoup zip file
# http://www.py4e.com/code3/bs4.zip
# and unzip it in the same directory as this file
import urllib.request, urllib.parse, urllib.error
from bs4 import BeautifulSoup
import ssl
# Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = Fa... | true |
35b781450c873e448b79a617bf4f4e82c4e75071 | Python | yogeshjadhav22/HackerRank_Code | /Beautiful_Days_at_the_Movies.py | UTF-8 | 1,094 | 3.234375 | 3 | [] | no_license | #https://www.hackerrank.com/challenges/beautiful-days-at-the-movies/problem
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the beautifulDays function below.
def beautifulDays(i, j, k):
d=i
arr=[]
for i in range(i,j+1):
arr.append(i)
p... | true |
84e9a825af29b1b7cf02b9bfd57c5055cc7bfee7 | Python | jesslattif/Hackbright-Curriculum | /04 Test List Operations/ex34.py | UTF-8 | 87 | 3.015625 | 3 | [] | no_license | animal = ["bear", "tiger", "penguin", "zebra", "quail", "goldfish"]
print animal[1:-1] | true |
2516b5287474505839fe0d65c333f5eec0524fda | Python | asifhossain2k20/Python-Basic-Codes | /13_String_slincing.py | UTF-8 | 160 | 3.109375 | 3 | [] | no_license | a='joyful'
print("a[1:4] ",a[1:4])
print("a[:4] ",a[:5])
print("a[3:] ",a[3:])
print("a[0:6:2]",a[0:6:2])
print("a[::-1]",a[::-1])
print("a[-1:-5]",a[-1:-5]) | true |
c79e730cc9e5bac1520c4d32dfb2bcb61d78b94c | Python | radtek/MultiverseClientServer | /Media/common/Interface/FrameXML/MarsTarget.py | UTF-8 | 911 | 2.65625 | 3 | [
"MIT"
] | permissive | import MarsUnit
def TargetFrame_OnLoad(frame):
frame.RegisterEvent("PROPERTY_health")
frame.RegisterEvent("PLAYER_TARGET_CHANGED")
def TargetFrame_Update(frame):
if MarsUnit.UnitExists("target"):
frame.Show()
UnitFrame_Update(frame)
TargetFrame_CheckDead()
else:
fra... | true |
a215ac2e4162cca5298d186a53866095471d180b | Python | lswzw/python | /huaban-img.py | UTF-8 | 1,909 | 2.703125 | 3 | [] | no_license | import requests
import os
import re
from selenium import webdriver
from time import sleep
from lxml import etree
from multiprocessing.dummy import Pool
def get_date(num):
option = webdriver.FirefoxOptions()
option.add_argument('--headless')
browser = webdriver.Firefox(options=option)
#b... | true |
30897dca8b03329923f660136427f9fb5e3b4b49 | Python | FDUCxz/Coffee | /main.py | UTF-8 | 1,602 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 27 17:58:49 2020
@author: CXZ
"""
from beveragebase import Beverage, CondimentDecorator
from cuptype import Midcup, Bigcup, Superbigcup
from milktype import Quanzhi, Yanmai, Tuozhi
from condimentdecorator import *
if __name__ == "__main__":
cuptypes = {"中杯":Mid... | true |
9990c8b64273d8ecd9dfcb4afe444334529c3679 | Python | PacketImpact/lcoreapi | /lcoreapi/api.py | UTF-8 | 8,032 | 2.59375 | 3 | [
"MIT"
] | permissive | from datetime import datetime, timedelta
import json
import requests
from requests import exceptions as rexc
from urllib.parse import quote as _quote
__all__ = ['API', 'APIError', 'APIServerError', 'APIAuthError',
'APINotFoundError', 'APIMethodNotAllowedError',
'APIBadRequestError', 'BASE_URL', '... | true |
4618cc4c1197a363bc5fae8a7cbc2876579f7478 | Python | Xanonymous-GitHub/main | /python/191213.py | UTF-8 | 304 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | line = list()
with open("index.txt") as f:
for x in f:
tmp = x.replace("\n", "").split(":")
line.append([tmp[0], list(map(int, tmp[1].split()))])
result = [[] for x in range(6)]
for x in line:
for y in x[1]:
result[y-1].append(x[0])
for x in result:
print(" ".join(x)) | true |
20bac10768af642f2cf507009a7214ba7077b5e8 | Python | uvacw/inca | /inca/rssscrapers/news_scraper.py | UTF-8 | 116,931 | 2.796875 | 3 | [] | no_license | import datetime
from lxml.html import fromstring
from inca.core.scraper_class import Scraper
from inca.scrapers.rss_scraper import rss
from inca.core.database import check_exists
import feedparser
import re
import logging
logger = logging.getLogger("INCA")
def polish(textstring):
# This function polishes the ful... | true |
d414204633f4ea5cdd1236453007cea4f5f5eb98 | Python | KushRohra/PythonProjects | /Machine Learning/Part 1/8. Logistic Regression/logistic_regression.py | UTF-8 | 1,294 | 3.09375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import confusion_matrix, accuracy_score
dataset = pd.read_csv('../datase... | true |
ed18f18192b8926023fa567108ae4bd8e067032e | Python | mysqlbin/python_note | /2020-03-24-Python-ZST-base/2020-08-28-条件循环控制/2020-04-19-02.py | GB18030 | 450 | 2.71875 | 3 | [] | no_license | #!/usr/bin/ptyhon
#coding=gbk
"""
"""
count = 2
while count > 0:
print('ݿͱÿһ,count: {}'.format(count))
count = count - 1
print('debug')
"""
count = 2 0 ݿͱÿһ,count: 2
count = 1 0 ݿͱÿһ,count: 1
count = 0 0ѭ ݿͱÿһ......
..
"""
| true |
cd8c62b0a6894888c97177d3160a11cc8bc25fb6 | Python | searchspring/vaurien | /vaurien/protocols/memcache.py | UTF-8 | 2,148 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import re
from vaurien.protocols.base import BaseProtocol
from vaurien.util import chunked
RE_LEN = re.compile('Content-Length: (\d+)', re.M | re.I)
RE_KEEPALIVE = re.compile('Connection: Keep-Alive')
RE_MEMCACHE_COMMAND = re.compile('(.*)\r\n')
EOH = '\r\n\r\n'
CRLF = '\r\n'
class Memcache(BaseProtocol):
"""... | true |
d8e0242df900667c9f730a133c2054ff4e6c1dab | Python | FiveEyes/ml-notebook | /dlp/ch8_1_text_generation.py | UTF-8 | 2,442 | 2.59375 | 3 | [
"MIT"
] | permissive | import numpy as np
import keras as ks
from keras import layers
def reweight_dist(org_dist, temp=0.5):
dist = np.log(org_dist) / temp
dist = np.exp(dist)
return dist / np.sum(dist)
path = ks.utils.get_file(
'nietzsche.txt',
origin='http://s3.amazonaws.com/text-datasets/nietzsche.txt')
text=open(path... | true |
df30ea3a483dbee9503b3b69804a646c502e2770 | Python | NikaTiunkina/cdv | /programowanie_strukturalne/10.rekurencja.py | UTF-8 | 1,050 | 3.78125 | 4 | [] | no_license |
import time
def find_fib_num_rec(num):
if num == 1 or num == 2:
return 1
else :
return find_fib_num_rec(num - 2) + find_fib_num_rec(num - 1)
def find_fib_num_loop(num):
a,b = 0,1
for elem in range(num) :
a,b= b, a+b
start = time.process_time()
... | true |
8affbb45ec6a6c8214a94d08c954db01ef290ec2 | Python | pmorin2/dslr | /check_script.py | UTF-8 | 485 | 2.625 | 3 | [] | no_license | from sklearn.metrics import accuracy_score
import argparse
import pandas
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("dataset_house", type=str, help="input dataset")
parser.add_argument("dataset_truth", type=str, help="input weights")
args = parser.parse_args()
predict ... | true |
3bebde20baa05e8a45c6b29bcf6134cffd5d3809 | Python | curtislb/ProjectEuler | /py/problem_036.py | UTF-8 | 1,676 | 3.796875 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""problem_036.py
Problem 36: Double-base palindromes
The decimal number, 585 = 1001001001_2 (binary), is palindromic in both bases.
Find the sum of all numbers, less than LIMIT, which are palindromic in base
BASE_A and base BASE_B.
(Please note that the palindromic number, in either base, m... | true |
b48631ea343df95af358fac50d1e23001fadb1b5 | Python | doraemon1293/Leetcode | /archive/573SquirrelSimulation.py | UTF-8 | 788 | 3.296875 | 3 | [] | no_license | class Solution(object):
def minDistance(self, height, width, tree, squirrel, nuts):
"""
:type height: int
:type width: int
:type tree: List[int]
:type squirrel: List[int]
:type nuts: List[List[int]]
:rtype: int
"""
mini = float("inf")
... | true |
147cb9142b20af5d48c6147be2a12debd365b42d | Python | jgmatu/PythonST | /ST05/practica05/exchange.py | UTF-8 | 7,321 | 2.875 | 3 | [] | no_license | #!/usr/bin/python -tt
# -*- coding: utf-8 -*-
import sys
import flask
import json
import requests
import os
import time
app = flask.Flask(__name__)
FAIL = "Amount must be a number to know the amount of bitcoins conversion..."
def openfile (fileName , mode) :
try :
fich = open(fileName , mode)
r... | true |
377b0b2105acba14860aae744dcc0665b5b05c32 | Python | zoukun120/DangDang_Scrapy | /DangDang_Scrapy/dbhelper.py | UTF-8 | 1,560 | 2.515625 | 3 | [] | no_license | import pymysql
from twisted.enterprise import adbapi
from scrapy.utils.project import get_project_settings # 导入seetings配置
import time
# 读取settings中的配置
class DBHelper:
def __init__(self):
settings = get_project_settings() # 获取settings配置,设置需要的信息
dbparams = dict(
host=settings['MYSQL_H... | true |
792538da7343d71bdff8ea8334d70c8449ef3a9d | Python | comptech-winter-school/online-store-redirects | /utils/make_sample.py | UTF-8 | 2,854 | 3.125 | 3 | [
"MIT"
] | permissive | import pandas as pd
def preprocessing_true_redirects(true_redirs):
"""
Удаляет неиспользуемые колоноки в датафрейме с подлинными редиректами.
Переименовывает оставшиеся колонки.
:param true_redirs: pd.DataFrame - датафрейм подлинных редиректов на правильную категорию.
:returntrue_redirects: pd.Dat... | true |
f13a4384a35f72d081a94579c980747fa7547c4d | Python | theatul/practice_problems | /btree.py | UTF-8 | 2,883 | 4.09375 | 4 | [] | no_license | # binary tree
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
class Btree:
def __init__(self):
self.head = None
def add(self, data):
temp = Node(data)
if self.head == None:
self.head = temp
... | true |
cf7eb03cee2db7f5af64540e933974af5712e863 | Python | hguuuu/MML | /modality_weighting/unimodal_text_model.py | UTF-8 | 4,841 | 2.609375 | 3 | [] | no_license | from unimodal_dataset import UnimodalDataset
import torch
import numpy as np
from torch.utils.data import Dataset, DataLoader
import torch.nn as nn
import torch.optim as optim
import pickle
import sklearn.metrics as metrics
class UnimodalTextModel(nn.Module):
def __init__(self, embedding_dim, hidden_dim1, hidden_... | true |
b9ef5de462298fcb713ca6ff2397ab57816ac0b3 | Python | Drawiin/algoritmos-basicos | /OnibusFlexivel/routeCalculator.py | UTF-8 | 6,336 | 3.703125 | 4 | [
"MIT"
] | permissive | from math import sqrt
from math import factorial
from itertools import permutations
import os
def calculateDistance(pointA, pointB):
deltaX = float((pointA[0] - pointB[0])**2)
deltaY = float((pointA[1] - pointB[1])**2)
return sqrt(deltaX + deltaY)
def calculateRouteLength(route):
routeLength = float... | true |
e6ee1f8b94b9aa9efc19c62b22747268b4aa63d3 | Python | masa-k0101/Self-Study_python | /Dfz/Cp5/c5_7_gradient_check.py | UTF-8 | 1,009 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os, sys
import numpy as np
from c5_6_two_layer_net import TwoLayerNet
sys.path.append(os.pardir) # パスに親ディレクトリ追加
from c3_2_data_mnist import load_mnist
# MNISTの訓練データとテストデータ読み込み
(x_train, t_train), (x_test, t_test) = load_mnist(normalize=True, one_hot_label=True)
# 2層のニューラルワーク生... | true |
315be8a39eb0c8d360671a4f6b3b12a9d17673e8 | Python | sriniketh28/Python-DSA | /DSA-Questions/queue-using-stacks.py | UTF-8 | 681 | 3.640625 | 4 | [] | no_license | class Queue:
def __init__(self):
self.stack1 = []
self.stack2 = []
def isEmpty(self):
return True if len(self.stack2)==0 and len(self.stack1)==0 else False
def enQueue(self, data):
self.stack1.append(data)
def deQueue(self):
if not self.stack2:
... | true |
4404d158daaee6e9e719e872fb4cdf0a84c6ee62 | Python | FlogFr/hospital | /tests/loading.py | UTF-8 | 2,156 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""Tests for :py:mod:`hospital.loading` module."""
import os
import unittest
try:
from unittest import mock
except ImportError: # Python 2.x fallback.
import mock
from hospital import HealthCheck
from hospital.loading import HealthCheckLoader
class HealthCheckLoaderTestCase(unittest.... | true |
4ba4ea600d6ce301a352b7b1a945d24518fc700c | Python | JohnOyster/ComputerVision | /HOG/svm_train.py | UTF-8 | 5,536 | 3.046875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""CIS 693 - Project 2.
Author: John Oyster
Date: June 6, 2020
Description:
DISCLAIMER: Comment text is taken from course handouts and is copyright
2020, Dr. Almabrok Essa, Cleveland State University,
Objectives:
2. Write a program to train and test the linear ... | true |
f2f7bd53eaec8f1d2403118a2f8df1e9bc68518d | Python | alchan/COVID-visualization-Chan-Harwell | /code/CovidChoropleth.py | UTF-8 | 12,855 | 2.546875 | 3 | [] | no_license | import dash #required: pip install dash
from dash import dcc
from dash import html
from dash.dependencies import Input, Output, State
import io
import json
from math import inf, ceil
import numpy as np
import os
import pandas as pd
import plotly.express as px #version 5.3.1 used
import requests
from urllib.request impo... | true |
7a0e5e06e46ed4a585d3bf0dbe1ac6c549dfea3f | Python | jamtot/DailyChallenge | /IRC connecting (14mar2016)/Connection.py | UTF-8 | 979 | 2.71875 | 3 | [
"MIT"
] | permissive | input = """chat.freenode.net:6667
carrot_chompa
carrot_chompa
Ed Sheeran"""
import socket
def make_connection(input):
server, nick, user, name = input.splitlines()
server, port = server.split(":")
server_name = "*"
user_mode = 0
s = socket.socket()
s.connect((server, int(port)))
print "co... | true |
bdb6d79e3e208dd9111459b1912827c2306ec33d | Python | Genionest/My_python | /Zprogram3/my_pygame/all_draw.py | UTF-8 | 1,924 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2017-12-18 20:22:32
# @Author : Your Name (you@example.org)
# @Link : http://example.org
# @Version : $Id$
import pygame
from pygame.locals import *
from sys import exit
from random import *
from math import pi
pygame.init()
screen = pygame.display.set_m... | true |
6b40327b60b1c2e733614860b31ea9bf266bae16 | Python | finleysg/image-processor | /image_processing.py | UTF-8 | 3,749 | 2.984375 | 3 | [] | no_license | # coding=utf-8
import os, sys
from PIL import Image, ImageDraw, ImageFont, ImageEnhance
from pilkit.processors import ResizeToFit
# def add_watermark(self, image):
# # Code for adding the watermark goes here.
# return self.watermark(image, "© 2016 Zoomdoggy Design", "arial black.ttf", None, 36)
def resize(i... | true |
1a695545a498151e06b95a2a34c760dfb2fb8104 | Python | mlyzhong/Kofiko | /MonkeyVR/PythonUDPDebugging/python_udp_listener.py | UTF-8 | 686 | 2.71875 | 3 | [] | no_license | import socket
import random
UDP_IP = "127.0.0.1"
UDP_PORT = 12345
UDP_SEND = 1111
print "reading IP address: " + UDP_IP + " port: " + str(UDP_PORT)
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.bind((UDP_IP, UDP_PORT))
while True:
data, addr = sock.recvfrom(... | true |
92f7f2b99962fc799a618984d2177febb894758b | Python | tazle/ruuvitag-sensor | /ruuvitag_sensor/decoder.py | UTF-8 | 4,421 | 2.90625 | 3 | [
"MIT"
] | permissive | from __future__ import division
import base64
import math
import logging
log = logging.getLogger(__name__)
def get_decoder(data_type):
'''
Get correct decoder for Data Type.
Returns:
object: Data decoder
'''
if data_type == 2:
return UrlDecoder()
else:
return Df3Deco... | true |
c3ed155c5d31cb9638c66fd9d76980777f6c4246 | Python | urentia/haphpipe | /haphpipe/stages/assemble_scaffold.py | UTF-8 | 5,256 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import print_function
import os
import argparse
from haphpipe.utils import sysutils
from haphpipe.utils import sequtils
from haphpipe.utils import alignutils
__author__ = 'Matthew L. Bendall'
__copyright__ = "Copyright (C) 2019 Matthew L. Bendall"
def stageparser(parser):
... | true |
2cf334787a84d64e41ea8184951f9ac77ca77eaf | Python | keep999Inchina/stm32-hello-world | /ai&ml/helloml-iamaidiot/有限复仇者.py | UTF-8 | 2,393 | 2.75 | 3 | [
"MIT"
] | permissive | # type善人=0,复仇者=1,恶人=2,行标为成员,列标1-extent,2-life,3-memory,4-type
from numpy import random
import matplotlib.pyplot as plt
from pandas import DataFrame
dic0 = {'life': [5] * 9, 'type': [0] * 9,
'memory': [[]] * 9, 'extent': [0] * 9}
frame = DataFrame(dic0)
frame.name = '有限复仇者'
frame.index.name = '编号'
for x in range... | true |
e1df6170780ec0ffb777f5cf9d78ff663e72136b | Python | jankapusta/milan-sessions | /two_lists.py | UTF-8 | 1,204 | 4.21875 | 4 | [] | no_license |
def readInteger():
try:
sNumber = raw_input()
return int(sNumber)
except ValueError:
print "Skipping value '",sNumber,"'. Not a number"
exit()
print "This will combine two sorted lists into one."
print "Enter size of the 1st list:"
iSizeM = readInteger()
print "Enter numbers ... | true |
f9630eff57e85d9fcf973551dda494890c623e40 | Python | yuispeuda/pro-lang | /python/calısma-soruları/karekok_bulma.py | UTF-8 | 217 | 2.765625 | 3 | [] | no_license | # -*- coding: cp1254 -*-
#!/usr/bin/python
def karekok_hesapla(sayi):
if sayi>=0:
x=sayi**1.0/2
print x
elif sayi<0:
w=((-sayi)**1.0/2)
print w,"i"
| true |
a561f15aeeaee62e3d2ef2e73c07cd509c2bd719 | Python | renerwijn/MEC-downscaling-example | /step3_projection_onto_surface/calc_projection_weights.py | UTF-8 | 4,882 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
interpolation of 3D gridded data to destination grid
"""
import sys
import os, os.path
import numpy as np
import netCDF4
from netCDF4 import Dataset, default_fillvals
from scipy.interpolate import InterpolatedUnivariateSpline
# Output file
outfile = 'projection_weigh... | true |
c0dbfc850b4a7a4c50a71396960e0079603ad032 | Python | arbc139/IMA | /weka_analysis/FPGrowth/csv_manager.py | UTF-8 | 234 | 2.984375 | 3 | [] | no_license |
import csv
class CsvManager():
def __init__(self, csvfile, fieldnames):
self.writer = csv.DictWriter(csvfile, fieldnames = fieldnames)
self.writer.writeheader()
def write_row(self, row):
self.writer.writerow(row) | true |
d999dd84f5282214061cc8272ea16744fd64f77a | Python | Cairnica/django-allauth | /allauth/socialaccount/providers/other/dataporten/provider.py | UTF-8 | 5,313 | 2.578125 | 3 | [
"MIT"
] | permissive | import requests
from allauth.socialaccount.providers.base import ProviderAccount, ProviderException
from allauth.socialaccount.providers.core.oauth2.provider import OAuth2Provider
class DataportenAccount(ProviderAccount):
def get_avatar_url(self):
'''
Returns a valid URL to an 128x128 .png photo ... | true |
e8c8a7f9a018e86d2c0a9e203ba78784686d45fa | Python | pqrkseohyeon/IOT | /Raspberry Pi/Flask (1)/app.py | UTF-8 | 1,484 | 2.640625 | 3 | [] | no_license | from flask import Flask, render_template
import RPi.GPIO as GPIO
import Adafruit_BMP.BMP085 as BMP085
app = Flask(__name__)
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
pins = {
10: { 'name':'YELLOW', 'state':GPIO.LOW},
11: { 'name':'BLUE', 'state':GPIO.LOW},
12: { 'name':'RED', 'state':GPIO.LOW},
}
... | true |
492228a885f224a69f0844f4feaf1bf6d86677bc | Python | ranBernstein/GaitKinect | /Fourier/utils/misc/animate.py | UTF-8 | 545 | 2.703125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
def animate(data):
def update_line(num, data, line):
line.set_data(xrange(num), data[:num])
return line,
fig = plt.figure()
line, = plt.plot([], [], 'r-')
plt.xlim(0, len(data... | true |
63a1efccbe01cb58423ae4ce65119bc950485726 | Python | Ayushmanglani/competitive_coding | /leetcode/October/7_RotateList.py | UTF-8 | 578 | 2.984375 | 3 | [] | no_license | class Solution:
def rotateRight(self, head: ListNode, k: int) -> ListNode:
if k == 0 or not head or not head.next:
return head
curr = head
a = []
while curr:
a.append(curr.val)
curr = curr.next
l = len(a)
r = [0]*l
for i in ... | true |
63114d8981f39dced8b74f4bbd9838434cce53e6 | Python | EzequielGuillen/Inteligencia-Articial-1 | /Agentes Racionales/enviroment.py | UTF-8 | 1,443 | 3.515625 | 4 | [] | no_license | import random
class Enviroment:
def __init__(self,size_x,size_y):
self.sizex=size_x
self.sizey=size_y
self.tablero=[[0]*self.sizex for i in range(self.sizey)]
def CreateDirt(self,cantDirt):
while cantDirt>0:
x=random.randint(0,self.sizex-1)
y=random.... | true |
957b36d625297237eb2dd1d416f95203358903f5 | Python | FranciscoRZ/NeuralNetForOptionPricing | /ANNPricer_v1.py | UTF-8 | 3,065 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 16 17:13:23 2018
@author: Cisco
"""
import os
os.chdir("/Users/Cisco/Desktop/M1 EIF/S2/Mémoire/DataCACPaul")
# Import libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Import data
data = pd.read_csv('DataK5200.csv... | true |
0b91aa683884351391fd46d3c63aecea94507d28 | Python | brownplt/insta-model | /conformance_suite/test_list_of_dynamic.py | UTF-8 | 475 | 2.859375 | 3 | [] | no_license | # test_list_of_dynamic.py
# This should pass.
from threading import Thread
from typing import List
def f(threads: List[Thread]) -> int:
return len(threads)
# def test_list_of_dynamic(self):
# codestr = """
# from threading import Thread
# from typing import List
# def f(threads: List[Th... | true |
6bd9e8103693131457d1bf585b31373e549b077d | Python | arthurtomas/Codes_git | /desafio096.py | UTF-8 | 201 | 4.15625 | 4 | [] | no_license | def area(larg, comp):
print(f'A área de um terreno {larg}m x {comp}m = {larg*comp:.2f}m²')
# Programa Principal
l = float(input('Largura(m): '))
c = float(input('Comprimento(m): '))
area(l, c)
| true |
18152e73c5081301660d167f111b026906f4920f | Python | YorkFish/learning_notes | /Python3/Qizi/set/set_01.py | UTF-8 | 400 | 4.09375 | 4 | [] | no_license | """
intersection, union set, difference set
tips: 有时候,对于列表,可以先 set(list),再用上面的“交、并、差”
"""
set_a = {1, 2, 3}
set_b = {2, 3, 4}
print(">>> set_a & set_b =", set_a & set_b) # 交集
print(">>> set_a | set_b =", set_a | set_b) # 并集
print(">>> set_a - set_b =", set_a - set_b) # 差集
print(">>> set_a ^ set_b =", set_a ^ set_b... | true |
36dc8acdc39cccf2e345bfb35fb2ebbda20f54ab | Python | qdonnellan/lessonwell | /tests/view_tests/sign_up_page_test.py | UTF-8 | 3,013 | 2.578125 | 3 | [] | no_license | from tests.main_test_handler import TestBase
from models.user import User
import json
import unittest
class SignUpPageTest(TestBase):
"""
test that the sign up page is working correctly @ "/sign_up"
"""
def test_sign_up_page_view_not_authenticated(self):
"""
test initial view of '/sign... | true |
3107c7fbc79d79de1cd3a8eb19ca0ae9c6d71298 | Python | ichejun/coding | /leetcode/206. 反转链表.py | UTF-8 | 1,319 | 4.03125 | 4 | [] | no_license | '''
反转一个单链表。
示例:
输入: 1->2->3->4->5->NULL
输出: 5->4->3->2->1->NULL
进阶:
你可以迭代或递归地反转链表。你能否用两种方法解决这道题?
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/reverse-linked-list
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
'''
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# ... | true |
bcd23dea79ab7f4703de8d150287b93c1cb6e4bc | Python | aman-ku/Machine-Learning-Algorithms | /Classification/8.DTC/Decision_tree_classification.py | UTF-8 | 2,870 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 26 16:56:36 2020
@author: amankumar
"""
import pandas as pd
import numpy as np
df = pd.read_csv('play_golf.csv')
eps = np.finfo(float).eps
def entropy_last(df):
Class=df.keys()[-1] #return last column of df(keys() return the different attri... | true |
cd26fcf2812fccda02a7c81568aca5b41d4918a6 | Python | DustyQ5/CTI110 | /P4LAB2_Sawyer.py | UTF-8 | 635 | 3.296875 | 3 | [] | no_license | # Turtle named Bit draws my first and last initial
# 10/9/2018
# CTI-110 P4T1b: Initials
# Chazz Sawyer
#
import turtle
wn = turtle.Turtle
bit=turtle.Turtle()
bit.color("red")
bit.pensize("3")
bit.forward(90)
bit.left(90)
bit.penup()
bit.forward(90)
bit.pendown()
bit.left(90)
bit.forward(90)
b... | true |
2486b8ffd9ff51eb264df6b92794696e90f02b96 | Python | MechaMonk/can_booster_pack | /decode/receive.py | UTF-8 | 1,671 | 2.703125 | 3 | [] | no_license | from serial import *
port_name = 'COM35'
port_baudrate = 1000000
def decode_message(line):
ls = line[1:].strip()
s = ls.split(b'.')
tstm = int(s[0], 16)
typ = 'A' if len(s[1])==3 else 'B'
id = int(s[1], 16)
dlen = len(s[2])//2
data = []
for i in range(dlen):
d... | true |
3b911f647fd79ec9deac419723d61b803e574625 | Python | slash-segmentation/segtools | /pysegtools/images/io/_handler_manager.py | UTF-8 | 8,747 | 2.578125 | 3 | [] | no_license | """
Defines the handler-manager which manages handlers for a class. This is used by the FileImageStack
and FileImageSource classes.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from abc import ABCMeta
from io i... | true |
7ac642f38db14c7dfc26c06a46d3023d360444db | Python | dav009/pythia | /src/pipelines/features_and_labels.py | UTF-8 | 1,139 | 3.25 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# coding: utf-8
import numpy as np
from collections import namedtuple
def get_data(scores, features):
length = 0.8 * len(scores)
data = list()
labels = list()
for score in scores:
feature = list()
if features.cos_similarity:
feature.append(np.array([... | true |
f192c195a612a86fd663f743a3a2e283ad868e46 | Python | OleksiiBondarr/evo2018_2 | /start.py | UTF-8 | 3,693 | 3.453125 | 3 | [] | no_license | import random
class ServerSimulation:
"""
type_id - int тип заполнения серверов (1 - рандомное, 0 - зеркальное)
server_amount - int кол-во серверов
data_amount - int кол-во кусков данных
data_chunks - словарь: key - номер сервера, value - список кусков данных
"""
data_chunks = {... | true |
c7ad22506fffc6b6162070f3200c92fb379e03ae | Python | Grudz/Python_Course_Instructor | /Homework/voltage_divider_calculator2.py | UTF-8 | 696 | 4 | 4 | [] | no_license | # Homework 4 - Ben Grudzien
# ENG 1503 - Voltage Divider Calculator
#import sys (Gets rid of "none" for other script)
def voltage_divider(Vin, R1, R2):
try:
return (Vin * R2) / (R1 + R2)
except ZeroDivisionError:
print("Error: Can't divide by 0")
print("--- VOLTAGE DIVIDER CALC... | true |
81e05d3531505ea85231432a22cac27580457970 | Python | Sstark97/Linux-Commands | /Python-Commands/translate.py | UTF-8 | 4,940 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
from google_trans_new import google_translator
import argparse
from pathlib import Path
from sys import stderr, stdout
class CpError(Exception):
pass
class Logger:
def __init__(self, verbosity=False):
self.verbose = verbosity
def set_verbosity(self,verbosity):
... | true |
3cc060ae4761dc71a97441aa9b8cb2b9f5fcd269 | Python | Pavana24/myPython | /ex24print.py | UTF-8 | 925 | 3.6875 | 4 | [] | no_license | print " Let's practise everything."
print 'you\'d need to know \'but escapes with \\ that do \n newlines and \t tabs.'
poem = """\t The lovely world
with logic so firmed planted
cannot discern \n the needs of love
nor comprehend passion from intution
and recquires an explaination
\n\twhere there is more
"""
prin... | true |
112216ccc9090d627f9307729e86f1ad14f0bc4a | Python | caominhduy/DeepRuby | /test_dataset.py | UTF-8 | 3,907 | 2.640625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """ Run this module to generate the dataset for testing, randomly. """
import numpy as np
import copy
import csv
import os
from datetime import datetime
from dependencies import *
from basics import *
import random as rd
from time import time
from shutil import copy as shucopy
__author__ = 'Duy Cao'
__version__ = '20... | true |
ed651cc49ce1bb25adadace4be077c6fd330b42b | Python | xiangbaloud/okgo_py | /getvolinfo.py | UTF-8 | 777 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python
import sys
import requests
def usage():
print('[-] Usage: ./getvolinfo.py <uuid>, if you want to display all vols, use <all>')
exit(0)
def main():
url = "http://10.144.7.2/api/share/volumes"
key = {'X-AccelStor-API-Key':'4e40139db3e56759fd28ec3f542065eb9048020a'}
if len(sys.arg... | true |
7f5b4470998e2d395a49b9e3d0765bdb52f133ae | Python | gil9red/SimplePyScripts | /world_seed_in_binary_2D.py | UTF-8 | 1,821 | 3.140625 | 3 | [
"CC-BY-4.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "ipetrash"
import hashlib
import random
import string
from itertools import cycle
def get_random_seed(length: int = 8) -> str:
return "".join(random.choices(string.ascii_letters + string.digits, k=length))
def get_bits_seed(seed: str) -> str:
s... | true |
6d576c38f510673ec84c79c8c78345eeead54949 | Python | AnneJoJo/Algorithm | /Algorithm2019/Math/waterAndJar.py | UTF-8 | 1,887 | 4.1875 | 4 | [] | no_license | # 这是一道脑筋急转弯题,我想很多人以前应该听过这道题目,有一个容量为3升和一个容量为5升的水罐,问我们如何准确的称出4升的水。我想很多人都知道怎么做,先把5升水罐装满水,倒到3升水罐里,这时5升水罐里还有2升水,
# 然后把3升水罐里的水都倒掉,把5升水罐中的2升水倒入3升水罐中,这时候把5升水罐解满,然后往此时有2升水的3升水罐里倒水,这样5升水罐倒出1升后还剩4升即为所求。这个很多人都知道,但是这道题随意给我们了三个参数,
# 问有没有解法,这就比较难了。这里我就照搬网上大神的讲解吧:
#
# 这道问题其实可以转换为有一个很大的容器,我们有两个杯子,容量分别为x和y,问我们通过用两个杯子往里倒水,和往出舀水,问能不能使容器中的... | true |
0960915d5596c257b91a8dad992ff0fed66260a2 | Python | HJReachability/learning_feedback_linearization | /ros/src/quads/src/system_identifier.py | UTF-8 | 2,902 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
import rospy
import sys
import numpy as np
from quads_msgs.msg import Control
from quads_msgs.msg import State
class SystemIdentifier(object):
def __init__(self):
self._state_sub = rospy.Subscriber("/state", State, self.state_callback)
self._control_sub = rospy.Subscriber("/con... | true |
c3cec82c8b415deb05005d50af19ef20296f788a | Python | lshi0335/MSITM6341 | /Assignments/homework_assignment_3/working_with_lists.py | UTF-8 | 816 | 4.3125 | 4 | [] | no_license | # Lei Shi
# 0985491
# 9/15/2019
# MSITM 6341
# Assignment 3
grocery_items = ["apple", "banana", "carrot", "dill", "eggplant"]
prices = [1.99, 0.64, 1.00, 0.50, 1.49]
# 1. Print the 3rd item followed by it’s price
print(grocery_items[2] +": " + '${:,.2f}'.format(prices[2]))
# 2. Print the last item followed by it’... | true |
53c5cae635d9a99ff438e2f4addd1b60b321a1b8 | Python | yanxurui/keepcoding | /python/algorithm/cracking/18.9.py | UTF-8 | 1,311 | 3.34375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import heapq
class MedianFinder:
def __init__(self):
"""
initialize your data structure here.
"""
self._before = [] # max heap
self._after = [] # min heap
def addNum(self, num):
if len(self._after) == len(self._before):
heapq.... | true |
5480474fc98ccd05dd04213fe8909ac6c00430b5 | Python | woodymit/millstone_accidental_source | /genome_designer/utils/bam_utils.py | UTF-8 | 1,949 | 3.0625 | 3 | [
"MIT"
] | permissive | """
Utility functions for working with bam files.
"""
import os
import shutil
import subprocess
from django.conf import settings
def filter_bam_file_by_row(input_bam_path, filter_fn, output_bam_path):
"""Filters rows out of a bam file that don't pass a given filter function.
This function keeps all header ... | true |
52bb878dcd77b7644cd196dededb86848c151d69 | Python | JasonKessler/sklearn-porter | /examples/classifier/BernoulliNB/java/basics.py | UTF-8 | 2,205 | 3.015625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from sklearn.datasets import load_iris
from sklearn.naive_bayes import BernoulliNB
from sklearn_porter import Porter
iris_data = load_iris()
X, y = iris_data.data, iris_data.target
clf = BernoulliNB()
clf.fit(X, y)
# Cheese!
result = Porter().port(clf)
# result = Porter(language='java').po... | true |
1681ab059da8c66bd880a1b6d32463e498d9dc33 | Python | vaguely-right/Baseball | /Retrosheet/Old/6-retrosheetlogistic.py | UTF-8 | 9,423 | 2.578125 | 3 | [] | no_license | import pandas as pd
import numpy as np
from tqdm import tqdm
import numpy.linalg as la
import seaborn as sns
from sklearn.linear_model import LogisticRegression
import seaborn as sns
pd.set_option('display.width',150)
pd.set_option('display.max_columns',16)
#%%
# Read the constants
fg = pd.read_csv('fgconstants.csv')
... | true |
ba59ebba2e068546face3a92c586930dc6c334c9 | Python | hsuanhauliu/html-compiler | /html_compiler/compiler.py | UTF-8 | 1,204 | 3.046875 | 3 | [
"MIT"
] | permissive | """
Compiler module.
"""
import os
from bs4 import BeautifulSoup
def compile(path):
""" Recursive function for merging components """
soup = ""
next_dir, filename = _separate_dir_and_file(path)
with cd(next_dir):
with open(filename, "r") as rfile:
soup = BeautifulSoup(rfile, ... | true |
340556fd0862d6b4d83f1e78923171b353d08f04 | Python | hermetique/holpy | /imperative/parser.py | UTF-8 | 5,054 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | # Author: Bohua Zhan
import json, os
from lark import Lark, Transformer, v_args, exceptions
from kernel.type import TFun, NatType
from kernel.term import Term, Var, Not, And, Or, Implies, Eq, Lambda, true, Nat
from kernel.report import ProofReport
from kernel import theory
from logic import basic
from logic import lo... | true |
fc3c87f34e09a7cd047961e8b779ab60109740ea | Python | zhix9767/Leetcode | /code/Longest Valid Parentheses.py | UTF-8 | 1,872 | 3.296875 | 3 | [] | no_license | class Solution(object):
def longestValidParentheses(self, s):
"""
:type s: str
:rtype: int
"""
if len(s) == 0:
return 0
maxLength = 0
stack = []
stack.append(-1)
for i in range(len(s)):
if s[i] == '(':
st... | true |
961ec6d1a23dcfde73235475003d4431fd0ff4cd | Python | daumie/dominic-motuka-bc17-week-1 | /day_1/sieve_of_eratosthenes.py | UTF-8 | 817 | 4.5 | 4 | [
"MIT"
] | permissive | """Finds prime numbers using sieve of eratosthenes"""
def sieve(num):
"""create a boolean array "prime[0...n]" and initialize all entries as True.
A value in prime[i] will finally be false if i is not prime, else True"""
prime = [True for i in range(num + 1)]
p = 2
while p * p <= num:
# I... | true |
49e5ae35f29f8c8d2701468c84613339be239574 | Python | JovoM/Gis-programiranje | /Zadatak5-Vezba2.py | UTF-8 | 116 | 3.28125 | 3 | [] | no_license | # coding=utf-8
rec=raw_input("Unesi neku recenicu: ")
i=0
while i< len(rec):
print rec[i]
i=i+1
| true |
641597cae3183ea491d807d5b9b4906ae95af068 | Python | bsautrey/logistic-regression | /logistic_regression.py | UTF-8 | 4,855 | 3.421875 | 3 | [
"MIT"
] | permissive | # Implement logistic regression from Andrew Ng's CS229 course: http://cs229.stanford.edu/notes/cs229-notes1.pdf. Batch gradient ascent is used to learn the parameters, i.e. maximize the likelihood.
import random
from copy import copy
from math import exp
import numpy as np
import matplotlib.pyplot as plot
# alpha - ... | true |
8f5c7f4a94492f7df91b0c30fe92a73596320a94 | Python | nagmat1/INT-Edge | /modules/backup-metrics/metrics-jan12/sink/conf.py | UTF-8 | 443 | 2.640625 | 3 | [] | no_license | import json
class Configuration:
def __init__(self, file='conf.json'):
self.conf = None
self.file = file
self.__load()
def __load(self):
with open(self.file) as cf:
self.conf = json.load(cf)
def getListenConf(self):
return self.conf['listen']
... | true |
894963a7f4f5fb707f84106c81eb17ed95acbe01 | Python | harsh9451036849/text-FileCompare | /textFileCompare.py | UTF-8 | 270 | 3.078125 | 3 | [] | no_license | f = open("file1.txt")
f1 = open("file2.txt")
i = 0
n = []
for i in range(100):
p = f1.readline().strip().split(' ')
p = ''.join(p)
n.append(p)
for i in range(100):
st = f.readline().strip().split(' ')
st = ''.join(st)
if st in n :
continue
else :
print(st)
| true |
b9793505cb7afeaae0337370183b950ad8e72df3 | Python | javs9708/PGP | /apps/usuario/funciones/validadores.py | UTF-8 | 1,188 | 2.625 | 3 | [] | no_license | import re
from dateutil.relativedelta import relativedelta
from datetime import datetime, date, time, timedelta
LIMITE = (date.today() - relativedelta(years=100))
patron_nombre_apellido = re.compile('([A-ZÁÉÍÓÚ a-zñáéíóú]{1}[a-zñáéíóú A-ZÁÉÍÓÚ ]+[\s]*)+$')
patron_cc = re.compile('[\d]{6,14}$')
patron_password = re.co... | true |
eff6462c59329c55932a78f1e681312856518ef2 | Python | connorcodes/thetrailproject | /transform_data.py | UTF-8 | 10,441 | 2.53125 | 3 | [] | no_license | from typing import *
from enum import Enum, IntFlag, unique
import struct
import json
import os
import errno
@unique
class Activity(IntFlag):
Backpacking = 1 << 0
XCountrySkiing = 1 << 1
HorsebackRiding = 1 << 2
OffRoadDriving = 1 << 3
RockClimbing = 1 << 4
SnowShoeing = 1 << 5
... | true |
24afe5e478b7811ea044687a69bbcb4dee855eaa | Python | Significant-Gravitas/Auto-GPT-Plugins | /run_pylint.py | UTF-8 | 425 | 2.625 | 3 | [
"MIT"
] | permissive | """
https://stackoverflow.com/questions/49100806/
pylint-and-subprocess-run-returning-exit-status-28
"""
import subprocess
cmd = " pylint src\\**\\*"
try:
subprocComplete = subprocess.run(
cmd, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
print(subprocComplete.st... | true |
0b7f5e678a3b5a6ed747a77d7d7c52a3ce84f78f | Python | zingp/webstudy | /studyFlask/test_flask_session.py | UTF-8 | 658 | 2.515625 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Author: "liuyouyuan"
# Date: 2018/6/1
"""
pip install redis
pip install flask-session
"""
from flask import Flask, session, redirect
from flask.ext.session import Session
app = Flask(__name__)
app.debug = True
app.secret_key = 'asdfasdfasd'
app.config['SESSION_TYP... | true |
a3ce227e25dc6c85e3b3dbc39ec16a8441a99e35 | Python | badonfai/Python-packages | /OutlierIdentifiers/test/test_outlieridentifier.py | UTF-8 | 6,986 | 2.5625 | 3 | [] | no_license | """
Test script for outlieridentifier.py
"""
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from OutlierIdentifier.Outlieridentifier.outlieridentifier import *
import numpy as np
import unittest
import json
np.random.seed(2342)
randData1 = np.random.u... | true |
3454eb981643922ee54827741acf728627ae4023 | Python | RonakKhandelwal/Python | /Learn Python The Hard Way/ex15.py | UTF-8 | 278 | 3.109375 | 3 | [] | no_license | from sys import argv
script,filename=argv
txt=open(filename)
print"Here's your file %r:"%filename
print txt.read()
print "Type the filename again :"
file_again=raw_input('>')
txt_again=open(file_again)
print "Here's the new file %r :"%file_again
print txt_again.read()
| true |
4ddd00b34d6cb24e6575d86975a5632914fd9a53 | Python | nitinnat/Tweet-Prejudice-Detection | /make_splits.py | UTF-8 | 1,517 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu May 10 16:07:18 2018
@author: Nitin
"""
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
np.random.seed(42) #Set seed
filepath_not_NER = "./FeatureVectorNotNER.csv"
filepath_NER = "./FeatureVectorNER.csv"
output_file_train_NER = "tr... | true |
24b42a36d3249def982ed249d216077883bcbf4a | Python | wasv/scrap-code | /python/Goddard.py | UTF-8 | 604 | 3.109375 | 3 | [
"MIT"
] | permissive | import Tkinter as tk
import serial
# Translates keypress to robot
commands = { 'W' : 'FG', 'A' : 'RG', 'S' : 'RT', 'D' : 'FT' }
def onKeyPress(event):
key = event.char.upper()
print key
if key in ('W', 'A', 'S', 'D' ):
com = commands.get( key )
ser.write( com )
print key, com
#se... | true |