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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c159517f7387e705dc1e7e53003b56bd604a8b5c | Python | mingxoxo/Algorithm | /baekjoon/18223.py | UTF-8 | 1,067 | 3.25 | 3 | [] | no_license | # 민준이와 마산 그리고 건우
# Dijkstra
# 22.11.22
# https://www.acmicpc.net/problem/18223
import sys
import heapq
from collections import defaultdict
input = sys.stdin.readline
def Dijkstra(graph, N, ori, dst):
if ori == dst:
return 0
heap = [(0, ori)]
visited = [-1] * (N + 1)
visited[ori] = 0
wh... | true |
852ebfecf641a6fc828d470d6611dd1cef78d026 | Python | MariamSafwat/KeepFocus | /gui/myBar.py | UTF-8 | 2,675 | 2.625 | 3 | [] | no_license | from PyQt5 import QtGui , QtWidgets
from PyQt5.QtChart import QChart, QChartView, QValueAxis, QBarCategoryAxis, QBarSet, QBarSeries
from PyQt5.QtGui import QPainter, QPen
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget, QVBoxLayout
from database.modelsfun import *
from datetime import date,timedelta
fr... | true |
751402bada223717bec07403e66c71c8ae1dd534 | Python | gianlucz/LEDAkem | /Inverse_Testing/benchmark_splitting_point_inverse/build/pval.py | UTF-8 | 3,382 | 2.796875 | 3 | [
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-public-domain"
] | permissive | from scipy import stats
import locale
import subprocess
import shlex
import os
ws='128'
alpha2 = 0.001
#calculate mean and var for eeach prime calling c program#
primes = ['7547', '7853', '14341', '14939', '16067', '22691', '25693',
'27437', '35899', '36877', '52147', '57899', '89051', '96221', '152267']... | true |
dff3a17e5696574e7b0235fd0c461b7a68b1bfca | Python | WaterWan/UdacityPA1 | /Task1.py | UTF-8 | 910 | 3.90625 | 4 | [] | no_license | """
下面的文件将会从csv文件中读取读取短信与电话记录,
你将在以后的课程中了解更多有关读取文件的知识。
"""
import csv
with open('texts.csv', 'r') as f:
reader = csv.reader(f)
texts = list(reader)
with open('calls.csv', 'r') as f:
reader = csv.reader(f)
calls = list(reader)
"""
任务1:
短信和通话记录中一共有多少电话号码?每个号码只统计一次。
输出信息:
"There are <c... | true |
c311318c609389cbf254652302a7d9f31c97de69 | Python | lwander/citest | /citest/service_testing/http_scrubber.py | UTF-8 | 3,371 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2015 Google Inc. All Rights Reserved.
#
# 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 applicable law or a... | true |
69b1a4abfcc6481bc621602f0745af6d8c56b66c | Python | gemking/COMProj1- | /venv/Scripts/parser.py | UTF-8 | 19,461 | 3.546875 | 4 | [] | no_license | import re
import sys
with open(sys.argv[1], "r") as file: #opens file
filelines = file.read().splitlines() # reads file and splits lines
file.close() #closes file
insideComment = 0
keywordchecklist = ["else", "if", "int", "return", "void", "while", "float"] # list of all keywords
#keywords = ["if", "else", ... | true |
436b45f7134d6221c8993b2c7ccd811747ab239c | Python | gpava/ProyectoGrafos-2020-1 | /Vista/VentanaRuta.py | UTF-8 | 1,629 | 3.125 | 3 | [] | no_license | from tkinter import *
from tkinter import messagebox
from PIL import Image, ImageTk
class VentanaRuta:
def __init__(self, app):
self.res = False
self.t1 = Toplevel(app)
self.t1.geometry('400x400')
self.t1.title('Ingrese la Ruta')
self.imagen = Image.open("../Imagenes/fondo... | true |
6a909c603ee287257b6fbfcc338a2230b1dfc583 | Python | dwamser/pdsnd_github | /bikeshare.py | UTF-8 | 7,857 | 4 | 4 | [] | no_license | import time
import pandas as pd
import numpy as np
CITY_DATA = {'chicago': 'chicago.csv',
'new york city': 'new_york_city.csv',
'washington': 'washington.csv'}
def get_filters():
"""
Asks user to specify a city, month, and day to analyze.
Returns:
(str) city - name of th... | true |
b665be20a0b975dc8546735fda64841848127c63 | Python | remrama/laka | /utils.py | UTF-8 | 1,336 | 2.953125 | 3 | [] | no_license |
def load_config():
from json import load
with open('./config.json','r') as json_file:
return load(json_file)
def load_scale(scale_name):
from json import load
scale_fname = f'./scales/{scale_name}.json'
with open(scale_fname,'r') as json_file:
return load(json_file)
def get_curre... | true |
fd97b8b87304fcc46ec25816ea05623cee634fe9 | Python | DiegoEliasCosta/snippet-optimization | /code/tutorial_codes/py_qt/sentdex_tutorial/qt_html.py | UTF-8 | 3,530 | 2.625 | 3 | [
"MIT"
] | permissive | import os
import sys
from PyQt4.QtCore import QUrl, SIGNAL
from PyQt4.QtGui import QApplication
from PyQt4.QtWebKit import QWebPage, QWebView
from urllib2 import urlopen
JQUERY_URL = 'https://code.jquery.com/jquery-3.3.1.min.js'
JQUERY_FILE = JQUERY_URL.split('/')[-1]
JQUERY_PATH = os.path.join(os.path.dirname(__file_... | true |
7f3d22b67324330e7edbfdc985fbff51572187d9 | Python | akintu/akintu | /src/region.py | UTF-8 | 10,124 | 3.140625 | 3 | [] | no_license | from location import Location
from const import *
import zlib
import cPickle
import os
import re
class Region:
def __init__(self, *args):
'''
Initializer accepts several different possible inputs. They are:
* a Region object, which it copies
* a list of Location objects, wh... | true |
508a2e912a1c6aa1ecf291c47c0d817f04205bb4 | Python | alexsanduk/pLyX | /scripts/subscripts/break.py | UTF-8 | 1,226 | 2.765625 | 3 | [] | no_license | # Part of the pLyX.py system.
#
# Andrew Parsloe (aparsloe@clear.net.nz)
# version 1.0 (3 December 2012)
#
# break.py
#
import argparse
flex_stop = r'\begin_inset Flex .stop|break'
end_inset = r'\end_inset'
def main(infl, outfl, options, guff):
'''Prevent the running of following scripts'''
p... | true |
a90cdb05291a1c7d451425f7d93138372a805fa4 | Python | nilavann/HackerRank | /Regex/Applications Challenges/Valid PAN format.py | UTF-8 | 154 | 2.96875 | 3 | [] | no_license | #!/bin/python3
import re
Regex = r"[A-Z]{5}\d{4}[A-Z]"
for _ in range( int( input())):
print( "YES" if( bool( re.match( Regex, input()))) else "NO") | true |
f5b0aef7ba69038fe0e481381b1f0bec42d88ce7 | Python | answerrrrrrrrr/leetcode | /169.Easy.MajorityElement_MajorityVote.py | UTF-8 | 451 | 3.421875 | 3 | [] | no_license | class Solution:
# @param num, a list of integers
# @return an integer
def majorityElement(self, num):
# Majority Vote
vote = 1
candidate = num[0]
for i in num[1:]:
if vote == 0:
candidate, vote = i, 1
elif i == candidate:
vo... | true |
3098fd4ab20c9a3992dc652769295d28de49b72a | Python | ramonlimaramos/python_design_patterns | /Visitor/visitor.py | UTF-8 | 1,086 | 3.375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding=utf-8 -*-
""" Visitor Pattern """
class Impressao(object):
def visita_soma(self, soma):
print '(',
soma.expressao_esquerda.aceita(self)
print '+',
soma.expressao_direita.aceita(self)
print ')',
def visita_subtraca... | true |
ac0c9cd58b51b541c11969c8e3c12703f136fc59 | Python | shujer/Python | /wanfang/wanfang/spiders/spider.py | UTF-8 | 3,499 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from wanfang.settings import KEY_WORD
from wanfang.settings import MAX_PAGE
from scrapy.http import Request
from wanfang.items import WanfangItem
class WanfangSpider(scrapy.Spider):
def __init__(self):
self.base_url = 'http://s.wanfangdata.com.cn/Paper.aspx?'
... | true |
a30d26db2639e4520ca97f637e2bc97c4376139a | Python | namemzy/mmdetection-mini | /tools/loss_analyze.py | UTF-8 | 3,493 | 2.6875 | 3 | [
"MIT"
] | permissive | from mmdet.models import build_loss
from mmdet.models.losses.focal_loss import py_sigmoid_focal_loss
import torch
import numpy as np
import math
from matplotlib import pyplot as plt
def show_loss_grad(aux_predict_out, out_losss, out_grads, label, legend_list, extra_str=''):
plt.subplot(2, 1, 1)
plt.title("tar... | true |
452b48a9c3602fe489ecb53298dd86dc49973b3b | Python | GaneshMunna4566/Python_Program | /strings/25.py | UTF-8 | 64 | 2.90625 | 3 | [] | no_license | x='ganes'
if len(x)%5==0:
print(x[: :-1])
else:
print(x) | true |
425b82f497ff1c0c8ff1a5afd94c7d229cadbd36 | Python | JDGC2002/Algoritmos-y-estructuras-de-datos | /Clases/CLASE 26-08/ejemplo_3_operaciones.py | UTF-8 | 919 | 4.34375 | 4 | [] | no_license | import numpy as np
data = np.array([1, 2])
ones = np.ones(2, dtype=int)
# suma
print("suma",data + ones)
# resta
print("resta",data - ones)
# mult
print("multiplicación",data * ones)
# div
print("división",data / ones)
# se puede multiplicar todos y cada uno de los elementos por un entero o flotante
print("ente... | true |
0a9c53f7706e91c08facc653e2e5e4e5c312a485 | Python | keinuma/expart-python | /ch02/context_pro.py | UTF-8 | 934 | 3.3125 | 3 | [] | no_license | from threading import RLock
lock = RLock()
def synchronized(function):
def _synchronized(*args, **kw):
lock.acquire()
try:
return function(*args, **kw)
finally:
lock.release()
return _synchronized
@synchronized
def thread_safe(): #リソースがロックされていることを保証する
p... | true |
a9a056b6b1a4f845e7f861c63d4c43bbdb961469 | Python | loxygenK/oxidizer | /src/main.py | UTF-8 | 3,570 | 2.640625 | 3 | [] | no_license | #!/bin/python3
import toml
import os
import subprocess as sp
from serial.tools import list_ports
from typing import Optional, List
from src.args import Argument, ArgumentError
from src.log import Logger
def fetch_package_name() -> Optional[str]:
if not os.path.isfile("Cargo.toml"):
Logger.error("Cargo.... | true |
c60124ecb9df0c183dc57b2a8093157dce1f8b89 | Python | Kids-Hack-Labs/weekly-code | /Solutions/Week04/game_env.py | UTF-8 | 1,037 | 3.515625 | 4 | [] | no_license | import pygame, sys
from gameobject_example import GameObject
pygame.init()
# 16:9 aspect ratio
screen_size = (800, 450)
screen = pygame.display.set_mode(screen_size)
screen.fill((255, 255, 255))
def gameLoop():
# create the gameobject instance
myObject = GameObject(200, 200)
# challenge q: what happe... | true |
38ff7ceaa3abbd61fb2613a384b78d5fb00b1d0c | Python | armaxwell/Pokemon-Bot | /database.py | UTF-8 | 1,000 | 3.015625 | 3 | [] | no_license | import discord
from discord.ext import commands
import sqlite3
import asyncio
import random
import embed
async def wild_db(ctx):
# Chooses a random index between 1 to 151
numID = random.randint(1, 152)
# Connect to the Pokemon database
conn = sqlite3.connect('Pokemon.db')
c = conn.cursor()
c.e... | true |
fb622e33373662b2082d3ec4f98d254a34fe7c5a | Python | WenyuZhang1992/opencv | /grayscale.py | UTF-8 | 474 | 2.734375 | 3 | [] | no_license | import cv2
import numpy as np
import math
cap = cv2.VideoCapture(0)
while(cap.isOpened()):
ret, img = cap.read()
# Draw a rectangle and obtain the img
cv2.rectangle(img,(400,400),(100,100),(0,255,0),0)
crop_img = img[100:400, 100:400]
# Convert to grayscale
grey = cv2.cvtColor(crop_img, cv2.COLO... | true |
087f210b81184021289c2a6cc881faf98a33b6cb | Python | silky/bell-ppls | /env/lib/python2.7/site-packages/observations/r/heights.py | UTF-8 | 1,817 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def heights(path):
"""A data.frame of the Galton (1888) height and cubit ... | true |
2d6e9a4b44e1041c9a0eba5bdf91ee179ad679f8 | Python | doc22940/repostat | /tools/__init__.py | UTF-8 | 347 | 3.15625 | 3 | [] | no_license | def sort_keys_by_value_of_key(d, key, reverse=False):
return [el[1] for el in sorted([(d[el][key], el) for el in d.keys()], reverse=reverse)]
def split_email_address(email_address):
parts = email_address.split('@')
if len(parts) != 2:
raise ValueError('Not an email passed: %s' % email_address)
... | true |
57da1e3e60dcc23b58b78da7a00dd3a2a1646e1c | Python | hilam/misc-recipes | /propertyclass.py | UTF-8 | 4,427 | 3.28125 | 3 | [] | no_license | """
Implements a fancier property()
"""
__all__ = ['property']
class _property_metaclass(type):
def __new__(meta, class_name, bases, attrs):
if '__init__' in attrs:
# The property class itself
return type.__new__(meta, class_name, bases, attrs)
if len(bases) != 1:
... | true |
e837543de47ca263744c6a8d67054496d9948bea | Python | chaocompute/python-srtm | /tests/test_height_map_collection.py | UTF-8 | 2,926 | 2.625 | 3 | [] | no_license | from srtm.base_coordinates import RasterBaseCoordinates
from srtm.height_map_collection import (
Srtm3HeightMapCollection,
Srtm1HeightMapCollection,
)
def test_srtm3_height_map_collection_build_file_index():
collection = Srtm3HeightMapCollection()
assert len(collection.height_maps) == 13967
def test... | true |
6e3e7bbe314bd753abd1b2b7dca5eeb210793434 | Python | oaifaye/tensorflow_demo | /demo2/test41.py | UTF-8 | 2,858 | 3.1875 | 3 | [] | no_license | '''
Created on 2017年12月27日
两个特征的多元线性回归模型
@author: Administrator
http://bluewhale.cc/2017-08-10/use-tensorflow-to-train-linear-regression-models-and-predict.html#codesyntax_10
'''
import tensorflow as tf
import numpy as np
# import matplotlib.pyplot as plt
#设置广告花费,曝光与点击数据
invest=np.array([[13],[105],[105],... | true |
76e45f1f26b72b162791503f84c7162d0801935d | Python | ZacharyVillarreal/Python_Practice | /Code_Force_Problems/800_problems/soldier_and_bananas.py | UTF-8 | 234 | 3.125 | 3 | [] | no_license | s = [int(i) for i in input().split()]
no_ban = s[2]
tot_mon = s[1]
ban_cost = s[0]
tot_cost = 0
for i in range(1, no_ban+1):
tot_cost += i * ban_cost
if tot_cost < tot_mon:
print('0')
else:
print(abs(tot_mon - tot_cost)) | true |
b7c53f9f71b18e7b850c9d6327507cd6590a43e3 | Python | gomezquinteroD/GWC2019 | /Python/survey.py | UTF-8 | 557 | 3.921875 | 4 | [] | no_license | #create a dictionary
answers = {}
# Create a list of survey questions and a list of related keys that will be used when storing survey results.
survey = [
"What is your name?",
"How old are you?",
"What is your hometown?",
"What is your date of birth? (DD/MM/YYYY)"]
keys = ["name", "age", "hometown", "... | true |
6f9bea45169a31fb1f13a2e695127981b479430d | Python | Aasthaengg/IBMdataset | /Python_codes/p03220/s169925287.py | UTF-8 | 253 | 2.953125 | 3 | [] | no_license | n = int(input())
t, a = map(int, input().split())
h = list(map(float, input().split()))
dt = 1000
ans = 0
for i in range(len(h)):
tmp = float(t) - 0.006 * h[i]
if dt > abs( a - tmp ):
dt = abs( a - tmp )
ans = i + 1
print(ans)
| true |
d0da0009ef864cb80d88a7b58c35d0b932a40254 | Python | jbundtr/test | /flaskapp.py | UTF-8 | 5,710 | 2.734375 | 3 | [] | no_license | import random
from flask import Flask, redirect, url_for, render_template, request, session
import pandas as pd
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
import seaborn as sns
from user_code import create_batches, get_pred_stockcode, set_model, prediction_dataframe
app = F... | true |
18d31ba9d50540d8b6ddc98d69119984ae500422 | Python | xjtushilei/doctor-server2 | /intelligent_triage/db_util.py | UTF-8 | 2,627 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
# coding:utf8
import redis
from pymongo import MongoClient
class RedisCache(object):
def __init__(self, app_config):
self.app_config = app_config
if not hasattr(RedisCache, 'pool'):
RedisCache.create_pool(app_config)
self._connection = redis.Redis(conne... | true |
38fa1730a533208b47623b8354c62e9bf2960146 | Python | aponce12/lab1 | /Lab1.py | UTF-8 | 5,312 | 3.703125 | 4 | [] | no_license | ##CS 2302 Data Structures
##Instructor:Diego Aguirre
##Project 1 Option A
##Modified and submitted by Andres Ponce 80518680
##Date of last modification 09/16/2018
##Purpose: Use recursion to traverse through directories, grab files and classify
##the files according to type (Dog or cat).
##Extra Credit: receives dog an... | true |
4fd1326d7f0fc90cf903da9503578f07aa9c1e07 | Python | ptiwari2407/Bioinformatics-1 | /week3/distanceBetweenPatternAndStrings.py | UTF-8 | 2,042 | 3.109375 | 3 | [] | no_license | import argparse
import os
import sys
from pathlib import Path
DATASET_DIR = os.path.join(os.getcwd(), 'datasets')
WEEK2_DIR = str(Path(__file__).resolve().parents[1]) + "/week2"
sys.path.insert(1, WEEK2_DIR)
from hamming_distance import hammingDistance
from find_neighbors import neighbors
def distanceBetweenPatternA... | true |
421ca36a1b3149517fe4ae9fad6ad920d8fba351 | Python | jeanbenoitdaille/VerifycodePython | /main.py | UTF-8 | 129 | 2.625 | 3 | [] | no_license | code = "print(any(('py' or 'txt') in ext for ext in ['.py', '.obj', '.json']))"
print(code.count('(') == code.count(')')) | true |
d337291e14805ce63482bac9d602f480a6c66ddd | Python | jbdatascience/causalchains | /causalchains/models/encoders/rnn_encoder.py | UTF-8 | 1,151 | 2.703125 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
import numpy as np
#Class is pretty much here for consitancy
class RnnEncoder(nn.Module):
def __init__(self, embedding_dim: int, output_dim: int) -> None:
super(RnnEn... | true |
c5ec824b9f34f3c8ea0607805afee392c783aa53 | Python | krasickiPawel/projektARQ | /system/Simulation.py | UTF-8 | 1,526 | 2.578125 | 3 | [] | no_license | from .ParametersAndOutput import SimulationOutput
class Simulation:
def __init__(self, generator, channel, transmitter, receiver, simulationLog):
self.generator = generator
self.channel = channel
self.transmitter = transmitter
self.receiver = receiver
self.simulationLog = s... | true |
d10fe903b802641b25043473e08f3edf5d696e6a | Python | eemerica/astr-119-session-5 | /Numpy.py | UTF-8 | 536 | 3.65625 | 4 | [
"MIT"
] | permissive | #! usr/bin/env python3
import numpy as np
x=1.0#define a float
y=2.0#define another float
#trigonometry
print(np.sin(x))#sin(x)
print(np.cos(x))#cos(x)
print(np.tan(x))#tan(x)
print(np.arcsin(x))#arcsin(x)
print(np.arccos(x))#arccos(x)
print(np.arctan(x))#arctan(x)
print(np.arctan2(x,y))#arctan(x/y)
print(np.rad2deg(x)... | true |
3813d4337813df5c5258c980f1bfcf563fab2a19 | Python | DiahRah/cobak | /berhasil.py | UTF-8 | 892 | 2.75 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup #librarypython
import pymysql
db = pymysql.connect("localhost","root","","indana")
cursor = db.cursor()
my_url = 'https://www.goodreads.com/search?utf8=%E2%9C%93&q=youtubers&search_type=books'
r = requests.get(my_url)
request = r.content
soup = BeautifulSo... | true |
c1d8c9a6c76765969b496fab33360c4dc276b90b | Python | epeters3/hyperopt-poc | /poc/main.py | UTF-8 | 2,428 | 2.859375 | 3 | [] | no_license | import typing as t
import matplotlib.pyplot as plt
import numpy as np
from poc.optimizable_estimators import elasticnet_reg
from poc.visualize import create_hyperparam_grid, visualize_hyperparam_grid
def plot_circle(circle_eq: t.Callable, lbound: float, ubound: float) -> None:
x = np.linspace(lbound, ubound, 10... | true |
7a51ad220fbbf1d1bc2ab159e647b131a1a82f4d | Python | mgurung/CMPM146-p2 | /greedy_bot.py | UTF-8 | 753 | 3.6875 | 4 | [] | no_license | # greety_bot.py
# chooses a legal move that maximizes the immediate score gain
# looks 1 move into the future and chooses the one that increases its
# score the most
import random
MAX_DEPTH = 1
# chooses a legal move randomly
def think(state, quip):
moves = state.get_moves()
best_move = moves[0]
highest_scor... | true |
8a23ceaf3ccab0d760398c635e5e95087204742c | Python | tiagoleonmelo/cbd | /Redis/1.3/1_3b.py | UTF-8 | 1,661 | 3.453125 | 3 | [] | no_license | import redis
## SimplePost Class
#
# A class that allows basic interaction as a Redis Client
class SimplePost_Set:
def __init__(self, host='localhost', port=6379, db=0):
self.r = redis.Redis(host, port, db)
self.USERS = "users" # Key set for users' names
def saveUser(self, name):
sel... | true |
228bf77f1ea4ad5789dd0eeeb5d5ca62cd60bc71 | Python | LumiWang/adventofcode2015 | /day19.py | UTF-8 | 4,495 | 3.09375 | 3 | [] | no_license | medicine_molecule = "ORnPBPMgArCaCaCaSiThCaCaSiThCaCaPBSiRnFArRnFArCaCaSiThCaCaSiThCaCaCaCaCaCaSiRnFYFArSiRnMgArCaSiRnPTiTiBFYPBFArSiRnCaSiRnTiRnFArSiAlArPTiBPTiRnCaSiAlArCaPTiTiBPMgYFArPTiRnFArSiRnCaCaFArRnCaFArCaSiRnSiRnMgArFYCaSiRnMgArCaCaSiThPRnFArPBCaSiRnMgArCaCaSiThCaSiRnTiMgArFArSiThSiThCaCaSiRnMgArCaCaSiRnFArTi... | true |
ba5a9287e42522f2777438a8b10bc1893a6a38c8 | Python | szrlee/rlberry | /rlberry/stats/tests/test_hyperparam_optim.py | UTF-8 | 4,883 | 2.546875 | 3 | [
"MIT"
] | permissive | from rlberry.envs import GridWorld
from rlberry.agents import AgentWithSimplePolicy
from rlberry.agents.dynprog.value_iteration import ValueIterationAgent
from rlberry.stats import AgentStats
from optuna.samplers import TPESampler
class DummyAgent(AgentWithSimplePolicy):
def __init__(self,
env,
... | true |
f776ffc5861f15bff6581b51c2e6d97c07e15d80 | Python | lldcl/wacl_dev | /MOS_reader.py | UTF-8 | 3,888 | 2.984375 | 3 | [] | no_license | """This program calculates the correlation coefficient between MOS signals and other signals such as O3 and temperature"""
import os
import pandas as pd
import operator
import numpy as np
import pylab
from pylab import *
from sklearn import linear_model
from scipy import stats
def readin(path, f_date, cal_file, date_s... | true |
5b29557fa065bb840dfb6c4f962bd836f66b8d56 | Python | xavihart/CG-RayTracer | /tools/sphere.py | UTF-8 | 11,442 | 2.640625 | 3 | [] | no_license | from .ray import *
from .material import *
import copy
from .aabb import *
from .utils import *
class hit_record:
def __init__(self, t_=0, p_=vec3(0, 0, 0), n_=vec3(0, 0, 0), mat_=lambertian(vec3(0, 0, 0)), u_=0, v_=0):
self.t = t_
self.p = p_
self.normal = n_
self.mat = ma... | true |
f8afec4827eaa461ac2d92b47b4e8b673d4bc975 | Python | mbswos/webOfScienceScrape | /UTDallas/webcrawlerutdallasjournals.py | UTF-8 | 929 | 2.59375 | 3 | [] | no_license | import requests
import dbconnection
from bs4 import BeautifulSoup
connection = dbconnection.DBConnection()
storer = connection.storer
querier = connection.querier
url = 'https://jindal.utdallas.edu/the-utd-top-100-business-school-research-rankings/index.php'
data = requests.get(url)
raw = data.text
html = BeautifulS... | true |
9f5ed8fa780c77e7dd52b0fea3a507fa89049365 | Python | Karagul/vol_surfaces | /modulesForCalibration_VG_XI.py | UTF-8 | 5,743 | 2.65625 | 3 | [] | no_license | import numpy as np
import cmath
import math
import sympy
# range for loops, from start, to finish with increment as the stepsize
def myRange(start, finish, increment):
myZero = 1e-17
while (start <= finish+myZero):
yield start
start += increment
# Periodic Linear Extension: ... | true |
651cc7bce01906e8e439ad77399e46db44de3069 | Python | pdarragh/ml-project | /ml_project_lib/learners/perceptrons/simple_perceptron.py | UTF-8 | 807 | 2.796875 | 3 | [] | no_license | from .base_perceptron import *
class SimplePerceptron(BasePerceptron):
def __init__(self, n_features: int, learning_rate: float):
super().__init__(n_features)
self._n = learning_rate
def train(self, data_pair: DataPair):
y = data_pair.label
x = data_pair.vector
if y * ... | true |
93fff320745bae3c8b5c2c65954092648050a3e0 | Python | caihj/jbyte | /src/main/resources/TryCatch.py | UTF-8 | 131 | 2.828125 | 3 | [] | no_license | try:
print "start"
raise UserWarning("hello",1,2,3,5)
except Exception, e:
print "Exception",e
finally:
print "end" | true |
ccb6828ebb97214422dbe576f3a11aa5bc8b237f | Python | MoshiBin/ssdpy | /ssdpy/http_helper.py | UTF-8 | 1,215 | 2.9375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
def parse_headers(response, convert_to_lowercase=True):
"""
Receives an HTTP response/request bytes object and parses the HTTP headers.
Return a dict of all headers.
If convert_to_lowercase is tr... | true |
89912e19b934d512943709baed284e1c03e03c1a | Python | deesaw/PythonD-03 | /Databases/MongoDB/5-getting-document.py | UTF-8 | 837 | 3.703125 | 4 | [] | no_license | from pymongo import MongoClient
import pprint
client = MongoClient() ## Connecting to client
db = client.test_database ## Connect to db
posts = db.posts ## Access collection 'posts'
### *** most basic type of query that can be performed i... | true |
f8da3b9163fec03dfa16ff5e965cd34442940157 | Python | vikoc/PuthonCoursesStepic | /zadachaStep.py | UTF-8 | 55 | 3.046875 | 3 | [] | no_license | x = 5
y = 10
print (y > x * x or y >= 2 * x and x < y)
| true |
0f9f88cb90b332fd5ecb6af5646d432c7ea6ef0d | Python | xuewengeophysics/YOLOX | /yolox/models/yolox.py | UTF-8 | 1,915 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
import torch.nn as nn
from .yolo_head import YOLOXHead
from .yolo_pafpn import YOLOPAFPN
import ipdb
class YOLOX(nn.Module):
"""
YOLOX model module. The module list is defined by create_yolov3_modules ... | true |
c4e53bb99072aeb3d590ce2aff24a6b0abfd1a20 | Python | FrankieZhen/Lookoop | /LeetCode/python/100_easy_Same Tree.py | UTF-8 | 2,097 | 4.09375 | 4 | [] | no_license | """
Given two binary trees, write a function to check if they are the same or not.
Two binary trees are considered the same if they are structurally identical and the nodes have the same value.
Example 1:
Input: 1 1
/ \ / \
2 3 2 3
[1,2,3], [1,2,3]
Output: tru... | true |
a4b693b7f9e775b73e330d8082c86bb45b51bd31 | Python | arpitsardhana/hacker-rank-solutions | /anagram.py | UTF-8 | 879 | 3.203125 | 3 | [] | no_license |
T = int(raw_input())
for i in range(0,T):
string = raw_input()
size = len(string)
if (size%2 == 1):
print "-1"
continue
str1 = string[0:size/2]
str2 = string[size/2:size]
dict1 ={}
dict2 = {}
size1 = len(str1)
size2 = len(str2)
for i in range(0,size1):
if dict1.has_key(str1[i]) :
... | true |
db3526d45de62b9431de8a5d45730b025f211e0e | Python | Richardmwilson191/python-scripts | /bs4-armarty/scraper.py | UTF-8 | 1,515 | 2.8125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import smtplib
from env import *
URL = 'https://armarty.com/product-category/men-clothing/'
headers = {
"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'}
page = requests.get(URL, head... | true |
ce998828ba07cbfbe8bc60c6403b44330a747ac8 | Python | ctcusick/smiirl-custom-samples | /samples/python/youtube/youtube_json.py | UTF-8 | 1,735 | 2.671875 | 3 | [
"MIT"
] | permissive | # tested on python 3.9
import http.server
import socketserver
import urllib
import urllib.request
import json
import requests
from http import HTTPStatus
youtubeChannelId = "UCKHzE6XF__put_your_real_channel_id"
youtubeApiKey = "AIzaSyDod3x-Rxx21cbQMvuWoput_your_real_api_key"
url = "https://www.googleapis.com/youtube... | true |
0b62adf13e6cade65949e7819cca540a3973c463 | Python | Aasthaengg/IBMdataset | /Python_codes/p03618/s744652468.py | UTF-8 | 213 | 3.203125 | 3 | [] | no_license | s = input() #sys.stdin.readlineは最後が改行
n=len(s)
from collections import Counter
c = Counter(s)
cnt = 0
for k,v in c.items():
if v>1:
cnt+=v*(v-1)//2
ans = n*(n-1)//2 -cnt + 1
print(ans)
| true |
9eccdad77e40f681a0f8858027a4c37ffd6147d1 | Python | sinofeng/vlcp | /tests/testIndexedHeap.py | UTF-8 | 2,569 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | '''
Created on 2017/9/29
:author: hubo
'''
import unittest
from random import randrange, sample
from vlcp.utils.indexedheap import IndexedHeap
class Test(unittest.TestCase):
def testRandomSort(self):
data = [(randrange(0,10000), randrange(0,10000)) for _ in range(0,1000)]
data = list((v,k)
... | true |
113dc51dca8aac733d6b77256b128ef36fea0324 | Python | farhanzafark/FYP_ROS_CODE | /src/metal_line_follower/scripts/graphPy.py | UTF-8 | 6,433 | 2.90625 | 3 | [] | no_license | import matplotlib.pyplot as g_plt
import sys
#sys.path.append("~/Desktop")
import a_star_algorithm
class Vertex:
def __init__(self, vertex,posX,posY):
self.name = vertex
self.neighbors = []
self.posX = posX
self.posY = posY
def add_neighbor(self, neighbor)... | true |
ebdd6916df03071884cb76750d19af92e0a3af03 | Python | DineshMohan0001/py | /venv/ATMECS/din.py | UTF-8 | 271 | 3.109375 | 3 | [] | no_license | import math
a=10
b=20
w=[1,2,3,4]
a = {1,2,3,4,5,6}
b = {7,8,9,0,4}
print(a.union(b))
print(a.__len__())
print(w[2])
print(a)
c=10.798646
print("%.2f" %c )
print()
print(math.log2(4))
a=(1,2,3,6,78)
x=slice(0,4)
print(a[x])
print(a[:3])
string ='hi da'
print(string[-1])
| true |
adae8d13176dc11cc43ffcf3778dc37fdb6ef5bd | Python | SvetlanaBicanin/MATF-materijali | /3. godina/ppj vezbe/cas04 - python/primer04.py | UTF-8 | 599 | 2.984375 | 3 | [] | no_license | import sys, re
if (len(sys.argv) != 1):
print 'Greska!'
sys.exit()
try:
with open('ulaz.txt', 'r') as f:
data = f.read()
quotes = data.split(";;")
print 'Podaci su ucitani :)'
except IOError:
print 'Neuspesno otvaranje datoteke'
try:
with open('izlaz.xml', 'w') as ... | true |
a0d6a789be9679dc8e22bfdb21a62bef5a642a1d | Python | nazuzma/json_oracle_db | /ingestion-api/chunk_bytes.py | UTF-8 | 1,532 | 3.015625 | 3 | [] | no_license | from io import RawIOBase
import threading
import time
KB = 1024**1
MB = 1024**2
class ChunkBytesIO(RawIOBase):
"""IO Bytes Stream that splits and writes data in fixed sized buckets."""
def __init__(self, chunk_size=50*MB, max_chunks=4):
self.chunk_size = chunk_size
self.max_chunks = max_chun... | true |
271785bb3395ab457f9150b278541be08a6d1a67 | Python | groupthr33/project-unit-tests | /testCommandLineController.py | UTF-8 | 835 | 2.65625 | 3 | [] | no_license | import unittest
from commandLineController import CommandLineController
# TODO: only listen() is a public method, so maybe the others dont need to be tested, and listen() is hard to test too
class TestCommandLineController(unittest.TestCase):
def setUp(self):
self.commandLineController = CommandLineCont... | true |
68d3771d5ece794160c5dddb27d85b4c2a124e09 | Python | quanterk/leecode | /167:sum of two numbers.py | UTF-8 | 1,504 | 3.78125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 10 21:10:08 2019
@author: K
"""
'''
167 :两数之和
Input: numbers = [2,7,11,15], target = 9
Output: [1,2]
Explanation: The sum of 2 and 7 is 9. Therefore index1 = 1, index2 = 2.
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorte... | true |
8470d076c31460964037518280eb30a4be851bd0 | Python | brunomendesdecarvalho/URI-Bruno-Mendes | /uri/u1037.py | UTF-8 | 347 | 3.96875 | 4 | [] | no_license | # coding: utf-8
# entrada
numero = float(input())
# computações e saídas
if (0 <= numero <= 25):
print('Intervalo [0,25]')
elif (25 < numero <= 50):
print('Intervalo (25,50]')
elif (50 < numero <= 75):
print('Intervalo (50,75]')
elif (75 < numero <= 100):
print('Intervalo (75,100]')
else:
pr... | true |
57596b584697c423037346e400660555572a9954 | Python | Zaenil/Tugas-Aplikasi-2-RS-20083000189-Zaenil-Muttakin | /Tugas Aplikasi 5 Latihan C.py | UTF-8 | 615 | 3.890625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 11 16:47:51 2021
@author: Nik
"""
# Tugas Aplikasi 5 Latihan C
print("#####################################")
print (" Menampilkan bilangan bulat 1-100")
print("#####################################")
N=input("Masukan Nilai Bilangan = ")
if int(N)>100 :
... | true |
6bd4123c0b48cbaca78482f8bdc959191cfdebb5 | Python | Priyanshusaxena2/github_users | /search/utils.py | UTF-8 | 237 | 2.65625 | 3 | [] | no_license | import requests
def get_results_from_api(username):
"""
:return:
"""
API_URL = "https://api.github.com/"
query_string = API_URL + 'users/' + username
result = requests.get(query_string).json()
return result | true |
43bb0aa2cb6e249525033ffb67ff95f887d4c2d6 | Python | acleee/acleebot | /broiestbot/commands/movies.py | UTF-8 | 3,854 | 2.984375 | 3 | [] | no_license | """Lookup movie information via IMDB API."""
from typing import Optional
from emoji import emojize
from imdb import IMDbError
from imdb.Movie import Movie
from clients import ia
from logger import LOGGER
def find_imdb_movie(movie_title: str) -> Optional[str]:
"""
Get movie summary, rating, actors, poster, &... | true |
d18025c28e19f1efe4227b6106a9324f1556e9cf | Python | dipayandas97/Spiking-Neural-Network | /live_plotting_demo.py | UTF-8 | 375 | 2.90625 | 3 | [] | no_license |
import numpy as np
import matplotlib.pyplot as plt
import time
signal = np.random.normal(loc=0,scale=2,size=100)
start = time.time()
while True:
plt.ylim(-7,7)
plt.plot(signal)
plt.pause(1e-10)
plt.cla()
signal[:-1] = signal[1:]
signal[-1] = np.random.normal(loc=0, scale=2, size=1)[0]
... | true |
ed908b13682e799379903b7793840c0b1e72f50c | Python | mayurimhetre/Python-Basics | /spell-check.py | UTF-8 | 444 | 3.75 | 4 | [] | no_license | #### spelling corrector using TextBlob #################
from textblob import TextBlob
n = int(input("enter the number of elemnts:"))
strlist = []
corrected = []
for i in range(1,n+1):
str1= str(input("enter the value {}:".format(i)))
strlist.append(str1)
corrected.append(TextBlob(str1))
print("i... | true |
4fd9edff57c12069ece530b9c5694d60d8eeb0fc | Python | NiharKashyap/TREX | /AI.py | UTF-8 | 580 | 3.234375 | 3 | [] | no_license | from numpy import *
from PIL import ImageGrab, ImageOps
import pyautogui as py
def pressSpace():
py.keyDown('space')
py.keyUp('space')
def IMG():
Box = (190, 422, 245, 455) # Use your own Coordinates here
image = ImageGrab.grab(Box)
image = ImageOps.grayscale(image)
arr = array(image.getcol... | true |
8501b9b92230969e205c1255b76da9b310c76715 | Python | kavinwkp/Digit | /Drawing/NaiveBayes.py | UTF-8 | 5,412 | 2.765625 | 3 | [] | no_license | from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
import pandas as pd
from PIL import Image
import time
class NaiveBayes():
"""朴素贝叶斯算法"""
def __init__(self):
minst = tf.keras.datasets.mn... | true |
e6f03a24a11a978e79e3848e3d2e5c2a186d7ba7 | Python | Alberts1995/Example | /Checkio.com/Home/sun_angel.py | UTF-8 | 530 | 3.40625 | 3 | [] | no_license | def sun_angle(time):
d = -15.25
for hour in range(6, 19):
d += 15
if hour == int(time[0:2]):
break
elif int(time[0:2]) >= 19 or int(time[0:2]) <= 5:
print("I don't see the sun!")
break
for minute in range(0, 60):
d += 0.25
if int(ti... | true |
46e13ae0e379d5c4acb43db83ca355065dd565e3 | Python | ericgreveson/xwing | /models/faction.py | UTF-8 | 177 | 2.75 | 3 | [
"MIT"
] | permissive | from enum import Enum
class Faction(Enum):
"""
Different factions that ships belong to
"""
rebel = 'rebel'
imperial = 'imperial'
scum = 'scum'
| true |
0164f485dc82161f3c0e4147d3eaea10d13635dd | Python | chanyoonzhu/leetcode-python | /1779-Find_Nearest_Point_That_Has_the_Same_X_or_Y_Coordinate.py | UTF-8 | 467 | 3.3125 | 3 | [] | no_license | """
- 1D array
- O(n), O(n)
"""
class Solution:
def nearestValidPoint(self, x: int, y: int, points: List[List[int]]) -> int:
res = -1
min_dist = float("inf")
for i in range(len(points)):
xb, yb = points[i]
if x != xb and y != yb:
continue
... | true |
89e93136cedf3480fa2dcb3dbb11dd81ec69fba4 | Python | Hank-Kuo/LapSRN-Pytorch | /model/transform.py | UTF-8 | 2,631 | 2.78125 | 3 | [] | no_license | from torchvision.transforms import Compose, CenterCrop, ToTensor, Scale, RandomCrop, RandomHorizontalFlip
def LR_transform(crop_size):
return Compose([
Scale(crop_size//8),
ToTensor(),
])
def HR_2_transform(crop_size):
return Compose([
Scale(crop_size//4),
ToTensor(),
... | true |
2f7a32ef10252e3a47331d56cf1888de7d624ef0 | Python | ananori99/AI-Python | /PycharmProjects/reinforcement/qlearningAgents.py | UTF-8 | 13,182 | 3.078125 | 3 | [] | no_license | # qlearningAgents.py
# ------------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to
# http:/... | true |
045b5d38bcf70e0e699053abb90af6f12c346678 | Python | serhataras/Music-Recommender-based-on-Melody | /pyacoustid/cs425.py | UTF-8 | 889 | 2.59375 | 3 | [
"MIT"
] | permissive | import acoustid, chromaprint, sys, difflib
for k in range(1,10):
for j in range(k,10):
id1 = str(k)
id2 = str(j)
(duration, bytestring) = acoustid.fingerprint_file("mp3/" + id1 + ".mp3")
(duration2, bytestring2) = acoustid.fingerprint_file("mp3/" + id2 + ".mp3")
fingerprint ... | true |
d6a2d8034050692205b3f21ec39895c35a819e12 | Python | LOOPPO/Edit_Distance | /EditDistance.py | UTF-8 | 1,761 | 3.0625 | 3 | [] | no_license | import numpy as np
def edit_distance(x, y):
m = len(x)
n = len(y)
delete_cost = 1
insert_cost = 1
twiddle_cost = 1
replace_cost = 1
copy_cost = 0
c = np.zeros((m + 1, n + 1), int)
op = np.zeros((m + 1, n + 1), str)
for i in range(m + 1):
c[i, 0] = i * delete_cost
... | true |
26d8a0f0f6e3143de3275d795b7e8863c5d0b1b3 | Python | thomasbouix/QuickChat | /QuickChat_client.py | UTF-8 | 1,817 | 3.421875 | 3 | [] | no_license |
"""
QuickChat_client : Gestion des messages clients et des arguments lors de l'execution du script
"""
import socketio
from docopt import docopt
sio = socketio.Client()
host = 'localhost'
port = 5000
# Gestion des arguments passés lors de l'éxécution du script
help = """
Usage:
QuickChat_client.py <usernam... | true |
dc51239bf9808d570bf1e2e1191896878741db7e | Python | AdamF42/MLSamples | /lion_tf.py | UTF-8 | 2,220 | 2.515625 | 3 | [] | no_license | from __future__ import division
import numpy as np
from PIL import Image
from scipy import misc
from skimage import data
from skimage.color import rgb2gray
from io import BytesIO
import matplotlib.pyplot as plt
import requests
from urllib3.connectionpool import xrange
import tensorflow as tf
response = requests.get('... | true |
c635e30aa43382244536d03217c84db35df60ffe | Python | MichaelBrunn3r/cdpy | /tests/test_events.py | UTF-8 | 1,416 | 2.71875 | 3 | [
"MIT"
] | permissive | import pytest
from cdpy import cdp
class TestFromJson:
def test_builtin(self):
e = cdp.animation.AnimationCanceled.from_json({"id": "someid"})
assert type(e) == cdp.animation.AnimationCanceled
assert e.id == "someid"
def test_simple(self):
e = cdp.application_cache.Applicati... | true |
b586d31498424dbad5359286f640436ce3d9c587 | Python | ddd7et/codewars.com | /python/5kyu/A_Chain_adding_function.py | UTF-8 | 50 | 2.6875 | 3 | [] | no_license | def add(x):
print("x=",x)
return 1
add(1)(2)
| true |
622e1f2e0fff35ef7f1a4527c56ada74d1b32157 | Python | AgeOfMarcus/CryptoBaker | /cryptobaker/recipes/encoding.py | UTF-8 | 5,328 | 2.765625 | 3 | [] | no_license | import base64, urllib.parse, hexdump, uuid, html
from .util import check, dec
_morse = {'A': '.-', 'B': '-...', 'C': '-.-.',
'D': '-..', 'E': '.', 'F': '..-.',
'G': '--.', 'H': '....', 'I': '..',
'J': '.---', 'K': '-.-', 'L': '.-..',
'M': '--', 'N': '-.', ... | true |
22876033f8c8ecd9c900ae3ade532fd374ee4585 | Python | HDYadav/python | /finally.py | UTF-8 | 113 | 3.109375 | 3 | [] | no_license | a = 0
b= 5
try:
c= b/a
print(c)
except Exception as e:
print(e)
finally:
print("Always Execute") | true |
88e70c4cc48872547f77b456a1a609c12219cb93 | Python | PsychoinformaticsLab/pliers | /pliers/converters/video.py | UTF-8 | 574 | 2.65625 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | ''' Converter classes that operate on VideoStim inputs. '''
from pliers.stimuli.video import VideoStim
from pliers.stimuli.audio import AudioStim
from .base import Converter
class VideoToAudioConverter(Converter):
''' Convert a VideoStim to an AudioStim by extracting the audio track
using moviepy. '''
_... | true |
4eb0b1352af6e106680d3a67a9c18aee4a31510c | Python | Has3ong/Algorithm | /BOJ/11600/11659.py | UTF-8 | 379 | 2.765625 | 3 | [] | no_license | import sys
def solution():
N, M = map(int, input().split(' '))
arr = list(map(int, input().split(' ')))
dp = [0] * (N+1)
for i in range(1, N+1):
dp[i] = dp[i-1] + arr[i-1]
for i in range(M):
a, b = map(int, sys.stdin.readline().split())
if a == 1:
print(dp[b])
... | true |
57f496ca76186211eb91ace975ce2b8e4959d3c5 | Python | frksteenhoff/02450_MachineLearning | /Scripts/ex4_3_4.py | UTF-8 | 241 | 3.296875 | 3 | [] | no_license | # exercise 4.3.4
import numpy as np
# Number of samples
N = 1000
# Mean
mu = np.array([13, 17])
# Covariance matrix
S = np.array([[4,3],[3,9]])
# Generate samples from the Normal distribution
X = np.random.multivariate_normal(mu, S, N)
| true |
dca0acf2dc494b0cf6f258271841f4626968ad4b | Python | nksmsht/ForStudy | /Draw-a-line-of-player-position_v17.py | UTF-8 | 14,104 | 2.765625 | 3 | [] | no_license |
import os
import glob
import tkinter
from tkinter import filedialog
from tkinter import messagebox
import re
import math
import shutil
import tkinter.simpledialog as simpledialog
import cv2
import csv
import numpy as np
from PIL import Image
import datetime
import sys
# パス取得の関数
def getpath():
idir = 'PC'
... | true |
568a8f25486ec7ad954132ba2d048d03ff0e53d8 | Python | titichayajojo/COJANG | /python_files/api.py | UTF-8 | 1,347 | 2.515625 | 3 | [] | no_license | import json
import urllib
import requests
import pandas
import pyrebase
import csv
states = []
islands = [2, 12, 22, 26, 39, 43, 45, 53]
url = 'https://api.apify.com/v2/datasets/FIbyK6uHUntt2kNy3/items?format=json&clean=1'
headers = {
'X-Parse-Application-Id': 'zoZ3zW1YABEWJMPInMwruD5XHgqT4QluDAAVx0Zz', # This is ... | true |
5cb48704d4aee950842f67edfff57e8ed657d995 | Python | edwincwk/Object-Oriented-Programming | /GUI Examples/AdExercise 1a)-c), 2).py | UTF-8 | 6,634 | 2.875 | 3 | [] | no_license | from tkinter import *
from tkinter.scrolledtext import *
class InvalidMarkException(Exception):
'''Invalid Mark Exception'''
class Student:
def __init__(self, id, name, mark=0):
self._id = id
self._name = name
self.mark = mark #no underscore - allow user to make use of... | true |
51372892b00d2f6ed3ec8e017bd4935f4d9dd007 | Python | mayank1101/uri | /1013.py | UTF-8 | 143 | 3.1875 | 3 | [] | no_license | a,b,c = map(int, raw_input().split(" "))
r = int((a + b + abs(a - b))/2)
greater = int((r + c + abs(r - c))/2)
print ('%d eh o maior' %greater) | true |
d28ccd68cab31ffc070af32315b1b486af22400c | Python | CianLR/judge-solutions | /kattis/glyphrecognition.py | UTF-8 | 1,214 | 3.171875 | 3 | [] | no_license | from math import pi, atan2, tan, sin, cos
def interior_angle(sides):
return (pi * (sides - 2)) / sides
IA = [0, 0, 0, *map(interior_angle, range(3, 9))]
SEG_ANGLE = [0, 0, 0, *map(lambda s: pi * 2 / s, range(3, 9))]
def circ_rotation(point):
h = atan2(point.imag, point.real)
return h if h >= 0 else (pi *... | true |
4ce06c1577b20ec43d2efd74e39e63e02dba4dfc | Python | jw0k/metex-voltage-recorder | /metex_simulator.py | UTF-8 | 1,067 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python
import sys
import argparse
import serial
import random
import time
parser = argparse.ArgumentParser(description="Simulates Metex multimeter")
parser.add_argument("port", help="name of the COM port (e.g. COM7)")
args = parser.parse_args()
ser = serial.Serial()
ser.port = args.port
ser.... | true |
38573dca067f2fd577c8e97a0d42baffe0c2ec56 | Python | AndreaCensi/geometry | /src/geometry/unittests/utils.py | UTF-8 | 2,027 | 3.125 | 3 | [] | no_license | # coding=utf-8
import unittest
import numpy as np
from contracts import contract
from geometry import random_direction, random_quaternion, random_rotation
from geometry.utils import assert_allclose
N = 20
def rotations_sequence():
yield np.eye(3)
# TODO: add special values
for i in range(N): # @Unused... | true |
97bf48a6c5114096c7f4377fbd584ad508d23764 | Python | zaxecivobuny/Euler | /test.py | UTF-8 | 380 | 3.84375 | 4 | [] | no_license | #this Function takes an Integer as Argument and returns a List of prime factors
def primefactor(n):
factors = []
while n>1:
for i in xrange (2, n+1):
if n%i == 0:
factors.append(i)
n = n/i
break
return factors
#call = raw_input("> ")
#print primefactor(int(call))
key = 'aaz'
print key[:-1] + 'a'... | true |