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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e3fd689ac5107af5bd04233371ef4672f86b2ff4 | Python | glirios/tkinter_learning | /textbox.py | UTF-8 | 122 | 2.703125 | 3 | [] | no_license | from tkinter import *
from tkinter.scrolledtext import ScrolledText
root = Tk()
ScrolledText(root).pack()
root.mainloop() | true |
db6ff41c769631621e964f23874e311cb5549d8e | Python | levisatto/dq | /dq31301.py | UTF-8 | 680 | 3.3125 | 3 | [] | no_license | open_file = open('AppleStore.csv')
from csv import reader
read_file = reader(open_file)
apps_data = list(read_file)
totalFree = 0
totalPaid = 0
count_free = 0
count_paid = 0
for each in apps_data[1:]:
if each[5] == '0':
rating = float(each[8])
totalFree = totalFree + rating
count_free +=1
... | true |
555e6fae50651825d5188a2ad752483a10b97a12 | Python | tylersiskar/PHY411Project | /Lecture14/bvp_example.py | UTF-8 | 1,272 | 3.46875 | 3 | [] | no_license | from cpt import *
from math import *
# Solves a boundary value problem :
#
# d^2u / dx^2 = -pi^2/4 ( u+1)
#
# with Dirichlet boundary conditions u(0)=0 and u(1)=1.
# This is discretized as :
# (2 u_i - u_(i+1) - u_(i-1)) / h^2 = pi^2/4 * (u_i + 1)
#
n = 2 # Number of masses
h = 0.01 ... | true |
5003bdc546c946ce4d22901bdb4cc0abb8b786be | Python | LINKIT-Group/remotestate | /remotestate/main/aws_base.py | UTF-8 | 1,511 | 2.5625 | 3 | [
"MIT"
] | permissive | """
Copyright (c) 2019 LINKIT, The Netherlands. All Rights Reserved.
Author(s): Anthony Potappel
This software may be modified and distributed under the terms of the
MIT license. See the LICENSE file for details.
"""
# pylint: disable=E0401
import boto3
# pylint: disable=E0402
from .exceptions import ResponseError
#... | true |
f89e8c9145a7f93e6aceed7d0481e26082914aa1 | Python | norbr9/opencv-examples | /examples/E18.py | UTF-8 | 2,366 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# python E18.py --dev=file:../images/rot4.mjpg
import cv2 as cv
import numpy as np
from umucv.stream import autoStream
from umucv.htrans import htrans, Pose, kgen
from umucv.util import lineType, cube
from umucv.contours import extractContours, redu
# Movimiento del muรฑ... | true |
fef9ae2548f176f1bd79dbc19d28355a64bf59ec | Python | paweladacha/primes | /pgen.py | UTF-8 | 1,392 | 3.140625 | 3 | [] | no_license | import itertools
def getp(upto:int,bottom:int=0):
# prepare sieve and domain
top = ((upto+1)//6)+1
factop = int((top/6)**0.5)+2
sel_p = bytearray([True]) * top
sel_s = bytearray([True]) * top
# sieve
for x in range(1,factop):
if sel_p[x-1]:
m1 = 6*x+1
... | true |
ff1c91d77c6b8a8d212d1f2f420d69705f212610 | Python | kflmiami420/ee459drone | /skeleton_code.py | UTF-8 | 5,488 | 2.53125 | 3 | [] | no_license | # Sketelon Code
#import all the libraries
import RPi.GPIO as GPIO # needed for the interrupt service routine
ser = serial.Serial ("/dev/ttyAMA0") # this will open the serial port for the device
# declare global variables
LED_PIN = #TODO: declare the LED Pin number
pid_p_gain_roll = 1.3 #Gain settin... | true |
b12d8b7d69d8786c3a4926303f3c7276c39ae623 | Python | jhoibclemente/assignment-mladvice | /src/run.py | UTF-8 | 611 | 2.953125 | 3 | [] | no_license | # 10. Run the algorithm on the set of all test data.
import numpy as np
import graph_operations as go
# GETS ALL PERMUTATIONS OF THE INPUT SEQUENCE
def permute(arr, size, mm=0):
if (mm == size):
print(go.compute_from_numpy(arr))
return
else:
for i in range(mm, size+1):
arr... | true |
40df1b0d0656d85d7243fdb5d7f54fdd8bda9453 | Python | TMarwah/P3Cowboys | /Cowboys/Marc/marcminilab.py | UTF-8 | 1,924 | 3.515625 | 4 | [] | no_license | class Robot:
def setName(self,n):
self.name=n
def getName(self):
return self.name
def setColor(self,c):
self.color=c
def getColor(self):
return self.color
def setWeight(self,w):
self.weight=w
def getWeight(self):
return self.weight
@property... | true |
d809fd4ede251d31dc5496da736e920e023ee35f | Python | hwanginbeom/TIL | /algorithms/source/10.Dolls(bakejoon-15954 kakao festival).py | UTF-8 | 4,006 | 3.65625 | 4 | [] | no_license | """
์นด์นด์คํ๋ ์ฆ ์คํ ์ด์์๋ N์ข
๋ฅ์ ์ธํ์ ํ๊ณ ์๋ค. N๊ฐ์ ์ธํ๋ค ์ค์์๋ ์ ํ๋ฆฌ๋ ์ธํ๊ณผ ๊ทธ๋ ์ง ์์ ์ธํ๋ค์ด ์์ฌ ์์ด์ ์ ํ๋ฆฌ๋ ์ธํ์ ์๋์ ์ผ๋ก ์ฌ๋๋ค์ด ๋ง์ด ๋ณผ ์ ์๋ ๊ณณ์ ๋ฐฐ์นํ๊ณ , ์ ํ๋ฆฌ์ง ์๋ ์ธํ์ ์๋์ ์ผ๋ก ์ฌ๋๋ค์ด ์ ๊ฒ ๋ณผ ์ ์๋ ๊ณณ์ ๋ฐฐ์นํ๋ค. ๊ทธ๋ฌ๋ฏ๋ก ๋ฐฐ์น๋ ๊ณณ์ด ๊ฐ๊น์ด ๋ ์ธํ์ ์๋์ ์ผ๋ก ํ๋งค๋์ด ๋น์ทํ๋ค๊ณ ํ ์ ์๋ค.
์ข์ ๋ฐฐ์น๋ฅผ ์ ํ๊ธฐ ์ํด์ ์ด๋ ๋ , ์ฌ๋ฌ ๋ช
์ ์ฌ๋๋ค์ ๋์์ผ๋ก ์ธํ์ ์ ํธ๋๋ฅผ ์กฐ์ฌํ์๋ค. ์กฐ์ฌ ๊ฒฐ๊ณผ ๊ฐ ์ธํ์ ๋ํด์ ์ ํธํ๋ ์ฌ๋์ ์๋ฅผ ๋ชจ๋ ๊ตฌํ์๊ณ , ๊ทธ์ ๋ฐ๋ผ ์ธํ์ ๋ฐฐ์น๋ฅผ ์ ํ๋ ค๊ณ ํ๋ค.
... | true |
2accc1a5185d3c4f67e6d0deb79056fe30400aae | Python | langlangago/learn_python | /day22_20191030/face_object_3.py | UTF-8 | 1,722 | 4.25 | 4 | [] | no_license | #! encoding:utf8
# ็ฑป๏ผๅฎไพๅ๏ผๅฎไพใ
# ๅฎไพ็ๅฑๆงๅๆนๆณใ
# ไบบ็ๅคงๆ
# class Person:
# def __init__(self, name, blood, aggr, sex):
# self.name = name
# self.blood = blood
# self.aggr = aggr
# self.sex = sex
#
# def attack(self, dog):
# dog.blood -= self.aggr
# print('%s่ขซๆปๅปไบ,ๅฉไฝ่ก้%s' ... | true |
f60614539d33a89de6cbf15966261084f60421d3 | Python | AnnPanackal/Python | /Assignments_Workouts/day8_imports.py | UTF-8 | 563 | 3.96875 | 4 | [] | no_license | """
a=5
b=10
def sumDigits(s):
tot=0
for i in s:
if i.isnumeric()==True:
tot=tot+int(i)
print("\n",tot)
def isPalindrome(s):
if s==s[::-1]:
print("TRUE")
else:
print("FALSE")
def ignoredcase(nw):
w=""
for i in nw:
if i.isalnum()==True:
... | true |
f63dc8e12a272cf2a040c374b9a281390f6cb06a | Python | j-halladay/gpu_hunter | /bot/sites/bestbuy.py | UTF-8 | 1,517 | 2.8125 | 3 | [] | no_license | from bot.helpers import chromeHelper as chrome
from bs4 import BeautifulSoup
import bot.sites.links as link
def check_availibility(url):
driver = chrome.chrome_driver()
availible = False
print(f'Accessing {url}')
driver.get(url)
driver.implicitly_wait(10)
try:
myDynami... | true |
cdca4a0686cf4c3440fb7ecca2118c1a216a2df1 | Python | apetesh/firefly | /firefly/data_source.py | UTF-8 | 4,710 | 3.359375 | 3 | [
"ISC"
] | permissive | import colorsys
import logging
class DataSource(object):
"""Base class for Firefly Data Sources"""
DESC = "Base class for Firefly Data Sources"
# path_splitter can be used to optionally pretty-up the components in
# titles and legends. This was originally used by StatMonster but can be
# adopted... | true |
139309f6bf91baffef2178f4183ecd6263537e71 | Python | JbosSquare/master-manager | /MasterManager/CadastroDeClientes/models.py | UTF-8 | 429 | 2.546875 | 3 | [] | no_license | from django.db import models
from django.utils import timezone
# Create your models here.
class Cliente(models.Model):
nome = models.CharField(max_length=100)
cpf = models.CharField(max_length=11)
created_date = models.DateTimeField(default=timezone.now)
creator_user = models.ForeignKey('auth.User')
... | true |
7f00431c01759a24014c83c5b5aec32d72567330 | Python | FRamseger/flightsoftheworld | /geodesiccalc.py | UTF-8 | 1,675 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 6 20:52:38 2017
@author: @framseger
"""
#impoprt packages:
from geographiclib.geodesic import Geodesic
import pandas as pd
from lxml import etree as ET
#set up kml structure:
kml = ET.Element('kml')
document = ET.SubElement(kml, 'Document')
#read data
d... | true |
1e3dc096cdd78a2578fb2df84e6105cc1414dabb | Python | Daishijun/InterviewAlgorithmCoding | /niuke1.py | UTF-8 | 976 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Date : 2019/4/3
# @Time : 16:55
# @Author : Daishijun
# @File : niuke1.py
# Software : PyCharm
T = int(input())
inlist = []
for i in range(T):
N = int(input())
numlist = list(map(int, input().split()))
inlist.append([N, numlist])
def getdp(nums):
n = len(nums)
... | true |
9fe07d7f57bfa4d5443b1e1361f0bb8542bbdd71 | Python | ChrisRx/flask-base | /application/scripts/manage_users.py | UTF-8 | 3,380 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import inspect
import signal
from flask_script import Manager, prompt, prompt_bool, prompt_choices, prompt_pass
from application import create_app
from application.ext import db
from application.blueprints.user.models import User, Role
... | true |
340793dfb8934d6c78379ce8b8d3b7ad09252baf | Python | hungptit123/code_tensorflow_example | /Functional_API/Guide_API/shared_weight_and_layer.py | UTF-8 | 674 | 2.53125 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.keras.layers import Dense, Input
from tensorflow.keras.models import Model
inputs = Input(shape = (64, ))
# a layer instance is callable on a tensor and return a tensor
# layer_shared = Dense(units = 64, activation = 'relu')(inputs)
# x = Dense(units = 64, activation = 'relu... | true |
6067632653c7bf25ed2be308ee26ab093663f42e | Python | ericocsrodrigues/Python_Exercicios | /Mundo 01/ex029.py | UTF-8 | 459 | 4.3125 | 4 | [] | no_license | """
Exercรญcio Python 29: Escreva um programa que leia a velocidade de um carro.
Se ele ultrapassar 80Km/h, mostre uma mensagem dizendo que ele foi multado.
A multa vai custar R$7,00 por cada Km acima do limite.
"""
vel = int(input('Informe a velocidade do carro: '))
if vel > 80:
d = vel - 80
multa = 7 * d
... | true |
201b571830ea828de021de9dea4ed9d91bee3f80 | Python | julistary/Madplanner- | /src/statistics.py | UTF-8 | 4,785 | 3.390625 | 3 | [] | no_license | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def catint(row):
"""
Cleans a row
Args:
row(df): the row to be cleaned
Returns:
The dataframe cleaned
"""
try:
return float(row)
except:
return row
def daynnite(row):
... | true |
07a71bf1c71d64e1f7898da76999a4ae6fbb7c1c | Python | ssshhh0402/Ssafy_Algorithms | /๋ฌธ์ /์ถ๊ฐ๋ฌธ์ ๋ค/11์ ๋๋น/1113/SW_์๋ฆฌ์ฌ.py | UTF-8 | 876 | 2.859375 | 3 | [] | no_license | def calc(a):
n = len(a)
count = 0
for i in range(n):
for j in range(n):
if i != j:
imsi = base[a[i]][a[j]]
count += imsi
return count
def find(a, b):
global result
food_1 = calc(a)
food_2 = calc(b)
result = min(result, abs(food_1 - fo... | true |
6a7e73a26b657202fe31051a76a0f4f3612d289a | Python | hayakzan/ANNitive | /annitive.py | UTF-8 | 1,817 | 2.765625 | 3 | [] | no_license | # ANNitive--ANN-based additive synthesis
# using a regression model for generating a new spectrum
from keras.models import Sequential
from keras.layers import Dense
from sklearn.datasets import make_regression
from sklearn.preprocessing import MinMaxScaler
import numpy as np
from numpy import array
from numpy import s... | true |
382ed54ee3d1a239c358ba474d9e6780f3120898 | Python | IgoAlgo/Problem-Solving | /AejiJeon/baekjoonOJ/binarysearch/5_jewerlyBox.py | UTF-8 | 1,424 | 3.515625 | 4 | [] | no_license | import sys
import math
input = sys.stdin.readline
n, m = map(int, input().split())
# ์ฌ๋ฌ ๋ณด์ ์ค์์ ์์ด ๊ฐ์ ๋ณด์ ๊ฐ์์ ์ต๋๊ฐ
max_value = 0
numberOfJewerlies = []
for _ in range(m):
num = int(input())
numberOfJewerlies.append(num)
max_value = max(max_value, num)
def binary_search_opt(array, start, end):
... | true |
be0197593f5a4f27f2e5f5d98b301005428262dc | Python | RamiJaloudi/Python-Scripts | /Good_Examples/BS_NYTimes.py | UTF-8 | 903 | 2.625 | 3 | [] | no_license | # <p class="myforecast-current-lrg">53°F</p>
import requests, bs4
res = requests.get('http://nytimes.com')
try:
res.raise_for_status()
except Exception as exc:
print "Status is %s is:" % exc
soup = bs4.BeautifulSoup(res.text)
elems = soup.prettify
elems_pr = soup.select('h2')
for h in ele... | true |
e77b23b9a275368e0ba5a3ac218c1a29b43482bc | Python | Aasthaengg/IBMdataset | /Python_codes/p02731/s289273735.py | UTF-8 | 161 | 2.625 | 3 | [] | no_license | import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9
def main():
l = int(input())
print((l/3)**3)
if __name__ == '__main__':
main()
| true |
86773add18531f724128b0356415bfa699667592 | Python | pzmrzy/LeetCode | /python/lonely_pixel_I.py | UTF-8 | 666 | 2.796875 | 3 | [] | no_license | class Solution(object):
def findLonelyPixel(self, picture):
"""
:type picture: List[List[str]]
:rtype: int
"""
m = len(picture)
if m == 0:
return 0
n = len(picture[0])
row = [0] * n
col = [0] * m
for i in range(m):
... | true |
11cde0db325f1f3395ddb31352a078d9e66b6c23 | Python | nekaz111/2d-ball-physics | /pong.py | UTF-8 | 9,866 | 3.171875 | 3 | [] | no_license | #Jeremiah Hsieh ICSI 502 Final Project Breakout
#try to clean up some excess?
#just pong
#score implementation issue (starts at 10 and 20 for some reason?))
import random
import pygame as pg
#block object class
class Block(pg.sprite.Sprite):
def __init__(self, color, width, height, x = random.randrange(10,... | true |
acb430e9410a2aef59d7008696455931b407da8b | Python | carlosCharz/linkedinmarketingpython | /marketing.py | UTF-8 | 1,805 | 3.390625 | 3 | [] | no_license | import sys
import os
def main():
filepath = 'people.in'
if not os.path.isfile(filepath):
print("File path {} does not exist. Exiting...".format(filepath))
sys.exit()
people = []
# 1 READ FILE
with open(filepath) as fp:
line = fp.readline()
while line:
#print("{}".format(line.strip())) # just for tes... | true |
6fff78ba74e782b8eac2f77e25d338da4a1caf56 | Python | starand/vision | /notifier.py | UTF-8 | 1,243 | 2.71875 | 3 | [] | no_license | from thread import Thread
from tgbot import bot
import time
import utils
import config
class Notifier(Thread):
_regularTimeNotifications = {}
def __init__(self, name, delay=2):
Thread.__init__(self, name, delay)
def do_run(self):
time = utils.getCurrentTime()
#print(time)
... | true |
4b73c621fd154e261df22eca9de1dc9189d80b8c | Python | rucv/MMCD_DA | /model/mnist2mnistm.py | UTF-8 | 2,614 | 2.546875 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
from grad_reverse import ReverseLayerF
class Feature(nn.Module):
def __init__(self):
super(Feature, self).__init__()
self.feature = nn.Sequential()
self.feature.add_module('f_conv1', nn.Conv2d(3, 64, kernel_size=5))
... | true |
42e0186d0f58688ef13c841db4d9c7d13eb90ded | Python | michaelJwilson/DESILBG | /gold/uniform_magpriority.py | UTF-8 | 3,242 | 2.71875 | 3 | [] | no_license | import numpy as np
from astropy.table import Table, vstack
npertranche = 200
def uniform_magpriority(band, magmin, magmax, cat, verbose=False):
# Sanity check.
assert np.isclose(magmin, cat[band].min(), atol=1.e-2)
assert np.isclose(magmax, cat[band].max(), atol=1.e-2)
print('magmin passed: {}; ... | true |
b863f801be302ebd565c47e82294127ad8985867 | Python | CarlosTadeu/CloudBroker | /cliente.py | UTF-8 | 2,273 | 2.90625 | 3 | [] | no_license | import requests
import json
import sys
#PROV_URL = 'http://127.0.0.1:5000/'
PROV_URL = 'https://cloudbroker-1fdfa.appspot.com/'
class Provedor:
def __init__(self):
self.quantidade = 0
self.recurso = {}
def menu(self):
while True:
print('1. Consultar e usar re... | true |
7eb7c3646a030c6a12bf4d0acb0337804fd311c4 | Python | ranajoy-dutta/Challengers-Web-App | /Challengers-Main site/app.py | UTF-8 | 17,299 | 2.921875 | 3 | [] | no_license | """This is a project made and implemented using Flask Framework with backend as SQLITE3 and front end designing in HTML5 and CSS3.
The purpose of the project was to develop a platform where high level programming competitions can be thrown with the well defined
deadline. We built this project and tested it by successfu... | true |
3cc7ce8b6387e834d632d67fb4f74953d3b40853 | Python | syurskyi/Algorithms_and_Data_Structure | /_algorithms_challenges/codeabbey/CodeAbbey_Solutions-master/id061-Prime_Numbers_Generation.py | UTF-8 | 550 | 3.421875 | 3 | [] | no_license | # Python 2.7
def gen_primes(limit=3000000):
ignore_this = raw_input() # CodeAbbey required wasted input.
data = [int(x) for x in raw_input().split()]
primes, answer = [], []
# Sieve of Eratosthenes
sieve = [True] * (limit + 1)
for num in range(2, limit + 1):
if sieve[num]:
p... | true |
8bd57dacf75d4547c183cc05c947a7fea48000bf | Python | DilshanKMGL/plunging_aerofoil_discrete_vortex_method | /main_file.py | UTF-8 | 3,949 | 2.71875 | 3 | [] | no_license | import sympy as sp
import numpy as np
import cmath
import function_file as ff
# -------------- parameters ------------------
#
# --------------------------------------------
# plunging parameters
pl_amplitude = 0
pl_frequency = 0
# joukowski paramters
center = -0.2 + 1j * 0.2
joukowski_parameter = 2
ra... | true |
72dee21967e0905a37d42d9859ecd59ea568461c | Python | etfovac/rpi_cam | /config/gui_config.py | UTF-8 | 718 | 2.578125 | 3 | [
"MIT"
] | permissive |
class ImgType():
def __init__(self):
self.PNG = ".png"
self.JPEG = ".jpg"
self.GIF = ".gif"
self.PPM = ".ppm"
class ImgSize(object):
def __init__(self,
psize=(320,240),
fsize=(2592,1944),
msize=(1920,1080),
... | true |
a821c722ddde198fae5e6ca0a848eea55269334b | Python | mramdass/re-engineered_Quant-Based_Tool_scripts | /Match LRs/Match_reQBT.py | UTF-8 | 1,801 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import csv, re
import re
from os import walk, path
RACE = ['BLACK', 'CAUCASIAN', 'HISPANIC', 'ASIAN']
def name_files():
files = []
for (dirpath, dirnames, filenames) in walk(path.dirname(path.realpath(__file__))):
files.extend(filenames)
break
return files
def read... | true |
b83ce606fbd513a9ec912d22df56e2066bbad159 | Python | Jozkings/advent-of-code-2020 | /7.py | UTF-8 | 1,441 | 3.140625 | 3 | [] | no_license | from collections import defaultdict
FILE_NAME = "input7.in"
with open(FILE_NAME, 'r') as file:
bags = defaultdict(set)
for line in file:
value = line.strip().split()
bag = value[:2]
for i in range(2, len(value)):
char = value[i]
if char == "contain":
... | true |
65d05560d15def4c9aa6bc058be63566bc94c5b7 | Python | mstrHW/EC_lab_2 | /genetic_algorithm/selection.py | UTF-8 | 849 | 3.46875 | 3 | [] | no_license | import random
def yield_mating_pairs(pairs, population):
for j in range(pairs):
chosen = []
for _ in range(2):
selection_probability = random.random()
for individ in population:
if selection_probability >= individ._prob:
chosen.append(ind... | true |
a744ccd64a19f22d647d6f7579592116d3002dc5 | Python | jiangts/DS-TC-RL | /orig-tc/TC-movie/src/deep_dialog/util/plot.py | UTF-8 | 1,975 | 3.0625 | 3 | [
"MIT"
] | permissive | import argparse, json
import matplotlib.pyplot as plt
def read_performance_records(path):
""" load the performance score (.json) file """
data = json.load(open(path, 'rb'))
for key in data['success_rate'].keys():
if int(key) > -1:
print("%s\t%s\t%s\t%s" % (key, data['success_rate'... | true |
66c4153c5bd3bda346e85934bb03adba1d88910c | Python | zodgevaibhav/performance-scripts-locust | /Learning/locustscripts/8.TestStartTestStop.py | UTF-8 | 1,019 | 2.75 | 3 | [] | no_license | # 1. If any of task need to perform once and that too begining and after the User/Test we can use these methods.
# 2. We need to use listeners in this case. Functions should be written in module leve
# 3. How to ad events in class
# Note :
# Fired when a new load test is started. It's not fired again if the number o... | true |
2db1e05d7f482799137d8f6e751cf54c161fc51a | Python | doct15/curses | /v4.py | UTF-8 | 1,045 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: latin-1 -*-
from os import system
import curses
currentx = 2
currenty = 2
map_locx = 2
map_locy = 2
#dngn_viewx = 3
#dngn_viewy = 3
map = [
" 0 ",
"012345",
" 2 x ",
" 3 x ",
" 4xxx ",
" 5 "
]
myscreen = curses.initscr()
#maxy, maxx = myscreen.getmaxyx()
ma... | true |
5be0ca612e3f137c85d236e0e733f236d69e89c6 | Python | super3/partialhash | /examples/usage.py | UTF-8 | 967 | 2.9375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# Copyright (c) 2015 Fabian Barkhau <fabian.barkhau@gmail.com>
# License: MIT (see LICENSE file)
from __future__ import print_function
from __future__ import unicode_literals
import binascii
import partialhash
path = "examples/random.data"
# sha256 hash of full file
digest = ... | true |
365e02a56ec782ffcdfc1973fd906f9729063e9c | Python | chenzhenpin/py_test | /matplotlib/matplotlib12.py | UTF-8 | 346 | 2.578125 | 3 | [] | no_license | from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
fig=plt.figure()
ax=Axes3D(fig)
X=np.arange(-2,2,0.1)
Y=np.arange(-2,2,0.1)
X,Y=np.meshgrid(X,Y)
def f(x,y):
return (1-y**5+x**5)*np.exp(-x**2-y**2)
ax.plot_surface(X,Y,f(X,Y),rstride=1,cstride=1,cmap=plt.cm.hot)
ax.view_init(el... | true |
85ffb44a318e4713e680571bd09461a709420c0e | Python | ayushgoel1594/Codes | /alternating_character.py | UTF-8 | 1,257 | 4.3125 | 4 | [] | no_license | '''
Created on May 27, 2017
@author: ayush
Alice has a binary string, , of length . She thinks a binary string is beautiful if and only if it doesn't contain the substring .
In one step, Alice can change a to a (or vice-versa). Count and print the minimum number of steps needed to make Alice see the string as beautif... | true |
69527a4222fbb3977aec0047358b466ea2afebde | Python | iFengZhao/Algorithms-1 | /LintCode/113. ๅ ้คๆๅบ้พ่กจไธญ็้ๅคๆฐๅญ II.py | UTF-8 | 950 | 3.5625 | 4 | [
"Apache-2.0"
] | permissive | """
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param head: head is the head of the linked list
@return: head of the linked list
"""
def deleteDuplicates(self, head):
# writ... | true |
94c7d7cf13af88c131a366f1c6922c0950f9b507 | Python | mele000/SPA-UDG | /Nedelja 2/lists.py | UTF-8 | 988 | 4.375 | 4 | [] | no_license | # Liste
# Prvi dio
# Kreirajmo listu koja sadrลพi razliฤite tipove podataka
# Isprobajmo indeksiranje i slicing
# Isprobajmo spajanje viลกe listi u jednu
lista = [1, 10, "abc", [10, 10]]
print(lista[::-1])
# Drugi dio
# Metode za liste
# Isprobajmo ih redom
lista.append([100, 200, 300])
print(lista)
a = lista.pop(0)
p... | true |
c0580fae59370c15bb396cd5231d4619d5e6e7b7 | Python | jamesjunaidi/corona-tracker | /corona.py | UTF-8 | 1,398 | 4.125 | 4 | [] | no_license | from sys import stdin
#this is the date class, allows for easy storage of dates
class date:
def __init__(self, month, day):
self.month = month
self.day = day
def printDate(self):
print("Date: " + str(self.month) + "/" + str(self.day))
#the main class
def main():
#hard coded the d... | true |
71172da7f38195d8b76966f6ab33720af43cb409 | Python | pcingola/Epistasis | /scripts/coEvolution/onePvaluePerGene.logistic.py | UTF-8 | 565 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python
"""Pick one p-value per gene"""
import sys
pbygene = {}
linebygene = {}
# Read each line
for line in sys.stdin:
line = line.rstrip()
f = line.split("\t")
# Is this a results line?
if len(f) > 10:
pvalue = float( f[2] )
gene1 = f[6]
gene2 = f[9]
oldp = pbygene.get(gene1, 1.0)
if... | true |
8de002866f32d74a411f0577dca35c7fdd53b63a | Python | remarkableJ/python | /codeNLP/SentenceSimilarly/Doc2Vec.py | UTF-8 | 6,345 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# writer : lgy
# data : 2017-08-30
# funcation ๅค็queries ็ธไผผๅบฆ้ฎ้ข ๆๆกฃๅ้๏ผๅจๆญค่กจ็คบๅฅๅญๅ้๏ผ
import sys
sys.path.append("../..")
reload(sys)
import jieba
from gensim.models import Doc2Vec
from gensim.models.doc2vec import TaggedDocument
from LabelSentences import LabelSentences
from MyCode import config
from ... | true |
3dece1c5ccb4f0381644e23065a7a31828dc9b8c | Python | EvgeniKasatkin/test_FB_API_SQL | /task_2/task_2_SQL/main.py | UTF-8 | 3,878 | 2.671875 | 3 | [] | no_license | # coding=utf-8
import pandas as pd
import psycopg2
import pandas.io.sql as sqlio
#Single insert to database
def single_insert(conn, insert_req):
cursor = conn.cursor()
try:
cursor.execute(insert_req)
conn.commit()
except (Exception, psycopg2.DatabaseError) as error:
print("Error: ... | true |
2ccf8e65ec27f75c4fcea210e4264b8a32d1d92b | Python | MahmudX/100-Days-Challange | /piling_up.py | UTF-8 | 580 | 3.453125 | 3 | [] | no_license | t = int(input())
for _ in range(t):
n = input()
sideLength = list(map(int, input().split()))
start, end = 0, len(sideLength) - 1
peak = 0
possible = True
while start < len(sideLength)-1:
if sideLength[start] < sideLength[start+1]:
peak = start
break
else:
... | true |
63df55f80e7cacb92d555417a3aaab5572c2bd60 | Python | syurskyi/Python_Topics | /125_algorithms/_exercises/templates/_algorithms_challenges/pybites/intermediate/325_v2/test_arithmetic.py | UTF-8 | 486 | 2.8125 | 3 | [] | no_license | # ____ ? _______ ? ?
#
#
# EXPECTED
# ("0.1", "0.2", "0.30"),
# ("0.2", "0.3", "0.50"),
# ("0.3", "0.005", "0.31"),
# ("0.005", "0.005", "0.01"),
# ("0.005", "2.67", "2.68"),
#
#
#
# ___ test_calc_sums
# i 0
# ___ i, line __ e.. ? ?
# n1, n2, sum_ ? ?
# ...
# line... | true |
9b3ecb4d6730764fbc69dbbd28153828e95614fa | Python | qmaxlambda/backend | /util/jsons.py | UTF-8 | 725 | 2.953125 | 3 | [] | no_license | import datetime
from flask import jsonify, make_response
def js_ret(code=None, msg=None, data=None):
"""
return json ่ฟๅๅๆฐๅค็
code :็ถๆ็
data:่ฟๅ็ปๆ
"""
rt_data = {
"code": code,
"msg": msg,
"data": data
}
jss = jsonify(rt_data)
return make_response(jss, 200)
... | true |
230ebee6153848c8ae1660355082d8905d72d798 | Python | jmhobbs/advent-of-code-2016 | /1/python/test.py | UTF-8 | 1,366 | 3.328125 | 3 | [] | no_license | import unittest
from taximap import TaxiMap
class TaxiMapTest(unittest.TestCase):
def setUp(self):
self.taxi_map = TaxiMap()
# Following R2, L3 leaves you 2 blocks East and 3 blocks North, or 5 blocks away.
def test_sample_1_1(self):
self.taxi_map.step('R2')
self.taxi_map.step('L3... | true |
c0313ee794d83bf8f5d1bde6ee9c177dec2be1d7 | Python | Augustine715/Resource_Allocation_In_Satellite_Integrated_Cognitive_Radio_Networks | /simMain.py | UTF-8 | 683 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python3
import satSim as SaS
import copy
"""Main program. Simulation starts here."""
userAlgTot=0.0
userRandTot=0.0
for i in range(1,11):
SaS.generateContents()
users=SaS.generateUsers()
users1=[]
for i in range (0,len(users)):
users1.append(copy.deepcopy(users[i]))
SaS.myAlgoSimu... | true |
11d11e4d90c51de4774f3ee7918992cba6ad679b | Python | mbta/ml_exploration | /subway_prediction_ml/offset_seconds_encoder.py | UTF-8 | 1,281 | 2.734375 | 3 | [
"MIT"
] | permissive | import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
class OffsetSecondsEncoder(BaseEstimator, TransformerMixin):
def __init__(self):
pass
def fit(self, X, y=None):
return self
def transform(self, vehicle_datapoints, y=None):
vehicle_datapoints['offset_depa... | true |
f6865b14792d08c81316fec73e6049e3627e6db8 | Python | rlatmd0829/algorithm | /๋ฐฑ์ค๋ฌธ์ /week2/03.15/26_ex2579.py | UTF-8 | 1,005 | 3.34375 | 3 | [] | no_license | import sys
input = sys.stdin.readline
arr = []
dp = []
N = int(input())
for _ in range(N):
arr.append(int(input()))
if N == 1:
print(arr[0])
elif N == 2:
print(arr[0]+arr[1])
else:
dp.append(arr[0])
dp.append(max(arr[0]+arr[1], arr[1]))
dp.append(max(arr[0]+arr[2], arr[1]+arr[2]))
for i i... | true |
326ea72f5ad4c8d660b29052649c12fbe4e3842a | Python | FergalMiller/TextReplace | /text_replace/common/profile/file_rewrite_profiles/regex_replacer/regex_util/regex_util.py | UTF-8 | 1,072 | 3.484375 | 3 | [] | no_license | from typing import List, Tuple, Match, Pattern
class GroupMatch(object):
groups: List[Tuple[str, int, int]]
def __init__(self): self.groups = []
def get_value_of_group(self, group: int) -> str: return self.groups[group][0]
def get_begin_position_of_group(self, group: int) -> int: return self.groups... | true |
4ae655487ebebc68024a39a8a06d33e3d2b272a4 | Python | fandemonium/glowing_sakana | /plotting/plot_two_column_accumulation.py | UTF-8 | 1,220 | 2.890625 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
import sys
import argparse
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser()
parser.add_argument("--title", help="Plot title")
parser.add_argument("--plot-ratio", dest="raw", help="Plot raw data", default=True, action="store_false")
parser.add_argument("input_file", help="Input ... | true |
7c77eb6e0da337d14bea4abd59d24e4ad165e01d | Python | DaoodS/Self_Driving_Car_Model | /Lane detection/test_file.py | UTF-8 | 2,645 | 2.625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import random
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D
from keras.layers import Activation, Dropout, Flatten, Dense
import cv2
data = pd.read_csv("C:\\Users\\Daood-PC\\Desktop\\finale.csv", encoding = 'utf-... | true |
eb2ebef94344e2fe2938f0dc62d8b9206441534e | Python | breadli428/eth-introduction-to-machine-learning | /Task 2/xgb_test.py | UTF-8 | 4,469 | 2.71875 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.preprocessing import RobustScaler
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import GridSearchCV
from collections import Counter
import xgboost as xgb
from sklearn import linear_model
def features_engineering(df_ori):
df_ori... | true |
a798abfcaf5016ed4471488310d7ab7b9012117d | Python | endless3cross3/learnOpenCV | /cvTest.py | UTF-8 | 489 | 2.890625 | 3 | [] | no_license | import cv2
import numpy as np
image = cv2.imread('colorTest.bmp')
#boundaries = ([0, 0, 1], [0, 0, 255]) # R
#boundaries = ([0, 1, 0], [0, 255, 0]) # G
boundaries = ([1, 0, 0], [255, 0, 0]) # B
lower, upper = boundaries
lower = np.array(lower, dtype = "uint8")
upper = np.array(upper, dtype = "uint8")
mask = cv2.inR... | true |
a2b2211f0bf8662bc93e78b924d6a42dfabee4b4 | Python | ianozsvald/exceptional_clarity | /exceptional_clarity.py | UTF-8 | 6,359 | 3.265625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python """"""
from __future__ import print_function
import sys
import re
previous_traceback = None
PREPEND_STR = "<EXCEPTIONALCLARITY>"
# consider autopep8 module for checking bad syntax e.g.
# autopep8.check_syntax("if True\nprint(2)") -> False
# autopep8.check_syntax("if True:\n print(2)") -> code ... | true |
1a3f527ebf5eaf5a6021c1c57e6316c1982adc8c | Python | yjw9012/cracking-the-coding-interview | /chapter-4/4.11-random_node.py | UTF-8 | 1,913 | 3.796875 | 4 | [] | no_license | from Node import Node
from random import randint
class RandomNode(Node):
def __init__(self, data, left=None, right=None):
super().__init__(data, left, right)
self.size = 1
class Tree:
def __init__(self, data):
self.root = RandomNode(data)
def find(self, num):
return find... | true |
88f88527761b9145470b35e9fea8102f7e979386 | Python | wkreiser/Kreiser-IQT-Project | /Python/Python-Networking/OSI_Layer_4/Performance_Lab/PLs.py | UTF-8 | 909 | 3.390625 | 3 | [] | no_license | # Name: William Kreiser
# Date: 26 Sep 18
# Project: Performance lab
"""
Create a TCP client using IPv4.
Pack the following values in a struct using network byte order: 12345, 56789, &, *, 0x7d0, 0b11111010000.
Then send the packed struct to a TCP server and print the unpacked values.
"""
import struct, s... | true |
da755271abecda2ce6341c7a77126f83e7f6aca4 | Python | hckr/engineering-thesis | /connect4/research/results_to_latex_table.py | UTF-8 | 1,173 | 2.953125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import re
latex_special = "_%"
def prepare(s):
ret = s.strip()
for c in latex_special:
ret = ret.replace(c, r'\%s' % c)
return ret
with open(sys.argv[1]) as file:
contents = file.read()
name = sys.argv[1].rsplit('.')[0]
rankings = c... | true |
9c909c95557531fbf40753bc730caee3760765e4 | Python | 02605/PyQt5 | /38-QAbsBtu-็ถๆ่ฎพ็ฝฎ.py | UTF-8 | 1,233 | 3.15625 | 3 | [] | no_license | # 0ๅฏผๅ
from PyQt5.Qt import *
import sys
# 1.ๅๅปบไธไธชๅบ็จ็จๅบๅฏน่ฑก
app = QApplication(sys.argv)
# 2.1ๅๅปบๆงไปถ
window = QWidget()
# 2.2่ฎพ็ฝฎๆงไปถ
window.setWindowTitle("Button")
window.resize(500, 500)
push_btn = QPushButton(window)
push_btn.setText("push_btn")
push_btn.move(50, 50)
radio_btn = QRadioButton(window)
radio_btn.setText("radi... | true |
a29da6fb85016bfcd3f7cdee41c25f5aab6d46e9 | Python | keefeseag000/Bioanalysis | /bioreactor_results/BSRmerge.py | UTF-8 | 16,520 | 3.171875 | 3 | [] | permissive | import pandas as pd
from os import listdir
import datetime
import re
import numpy as np
def vicell_convert_xlsx():
"""
Converts all .xlsx files in present working directory
Return: Dictionary. Keys = filename.xlsx, values = Dataframe
"""
#### Listing all files in directory ####
files_list = ... | true |
4bdd1b75f5981865164302159dbb0e2f6451cec3 | Python | kikiotsuka/DiscordBot | /bot.py | UTF-8 | 1,478 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
import discord
from discord.ext import commands
import sys, json, traceback, logging
# Constants
AUTH_FILE = 'auth.json'
AUTH_FIELD = 'token'
EXTENSION_ADMIN = 'extensions.admin'
COMMAND_PREFIX = '?'
BOT_DESCRIPTION = 'Bot for personal use with random commands'
bot = commands.Bot(command_p... | true |
4a2edf21713b0a07f6b28a2eaec7c3995060b362 | Python | aj-medianet/python3-contentagg | /main.py | UTF-8 | 4,804 | 2.734375 | 3 | [] | no_license | # pip install spacy
# python -m spacy download en_core_web_sm
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from urllib.request import urlopen
from io import StringIO
from io import BytesIO
#from urllib2 import Request, urlopen
#from StringIO import StringIO
from bs4 import BeautifulSoup
import spacy... | true |
7053c848762cc8136391eac6e9c9e13ff7da84f8 | Python | RosaryYao/sfftk | /sfftk/core/configs.py | UTF-8 | 8,951 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
``sfftk.core.configs``
======================
This module defines classes and functions to correctly process persistent
configurations. Please see the :doc:`guide to miscellaneous operations <misc>`
for a complete description of working with configs.
"""
from __future__ import print_functio... | true |
64c65d74a296c29304a38e12b38f749067bd61e5 | Python | JianfengZhang112358/DeepLearning | /code/method/activation/activation.py | UTF-8 | 5,546 | 3.234375 | 3 | [
"MIT"
] | permissive | from abc import ABC, abstractmethod
import numpy as np
import re
class ActivationBase(ABC):
def __init__(self, **kwargs):
super().__init__()
def __call__(self, z):
if z.ndim == 1:
z = z.reshape(1, -1)
return self.forward(z)
@abstractmethod
def forward(self, z... | true |
65265bf84665f3c0b1b1432d7edf3cbf5c191a76 | Python | danagilliann/coding_practice | /python/int_to_string.py | UTF-8 | 581 | 4.125 | 4 | [] | no_license | '''
function that converts a string to a number.
"1", "14", "142", "1426", ....
1 = (0) * 10 + 1
14 = 1 * 10 + 4 --> (0) * 10 + 1 ...
142 = (1 * 10 + 4) * 10 + 2
1426 = ((1 * 10 + 4) * 10 + 2) * 10 + 6
'''
def convert_to_number(string): # returns an int
multiplier = 0
int_from_str = 0
current_char = 0
for c in ... | true |
f248e60d3678ae1111f63a9198c35baaec5bdd34 | Python | TsingJyujing/HomeMediaSite | /bdata/porn/caoliu.py | UTF-8 | 2,148 | 2.625 | 3 | [] | no_license | #!/bin/python
# -*- coding: utf-8 -*-
"""
Created on 2017-3-2
@author: Yuan Yi fan
"""
from utility.pyurllib import get_soup
# test page url:
# http://cl.4ui.xyz/htm_data/16/1706/2443561.html
# http://cl.4ui.xyz/htm_data/16/1706/2460332.html
caoliu_host = "cl.hm8.xyz" # ๅฐๅๅฏ่ฝๅๅ
def get_page_title(page_soup):
"... | true |
f5602a02f4832410201eb833c583777b474298f6 | Python | nlavanderos/learning-python | /stuff/docTest.py | UTF-8 | 567 | 3.234375 | 3 | [] | no_license | def impar(n):
'''
La funciรณn impar(n) devuelve:
- True: si nรบmero es impar
- False: si nรบmero no es impar
>>> impar(0)
False
>>> impar(1)
True
>>> impar(2)
False
>>> impar(3)
True
'''
if n%2 != 0:
return True
else:
return False
if __name__ ==... | true |
9fa24ae2c073310d0d686704c83e4e92ae143b7a | Python | mig0913/assets | /lib/configure.py | UTF-8 | 1,926 | 2.609375 | 3 | [] | no_license | import ConfigParser, os, logging, getpass, sys
from collections import OrderedDict
from copy import deepcopy
def getConfigFiles(confBasePath):
configs = OrderedDict()
confs = OrderedDict()
for base,dirs,files in sorted([x for x in os.walk(confBasePath)]):
for filename in sorted([x for x in ... | true |
cb5bc7db0aa7f7702442c5649b00a5dcca30b911 | Python | luisdifc/hackerRank | /data_types.py | UTF-8 | 188 | 3.421875 | 3 | [] | no_license | i = 4
d = 4.0
s = 'HackerRank '
new_int = int(input())
new_double = float(input())
new_string = str(input())
print(f"{i + new_int}")
print(f"{d + new_double}")
print(f"{s + new_string}")
| true |
795260b3bb2f6f12cbdcd9ec60fec6c0d92f170e | Python | 88sanjay/BFS-1 | /course_scheduling_dfs.py | UTF-8 | 956 | 2.984375 | 3 | [] | no_license | class Solution:
def dfs(self,course, prereqs,current_path) :
if course in current_path :
return False
current_path.add(course)
for p in prereqs.get(course,[]) :
if not self.dfs(p,prereqs,current_path) :
return False
current_path.remove(cou... | true |
1cc01f32bed20000f0daed6c6afa5ae627d7b41b | Python | loganyu/leetcode | /problems/600_non_negative_integers_without_consecutive_ones.py | UTF-8 | 843 | 3.734375 | 4 | [] | no_license | '''
Given a positive integer n, return the number of the integers in the range [0, n] whose binary representations do not contain consecutive ones.
Example 1:
Input: n = 5
Output: 5
Explanation:
Here are the non-negative integers <= 5 with their corresponding binary representations:
0 : 0
1 : 1
2 : 10
3 : 11
4 : 1... | true |
819bf0acecc68e00b38912f4caa023653ab7f7f5 | Python | yedkk/python-datastructure-algorithm | /python basic/basic 1.py | UTF-8 | 176 | 3.71875 | 4 | [
"MIT"
] | permissive | # this temperature transform was written by Kangdong Yuan
C = int(input("Enter a Celsius temperature: "))
F = float(9/5*C + 32)
print("The Fahrenheit Temperature is " + str(F))
| true |
548f7462fd28721d5c4a5aeaeafad27b02c547eb | Python | hanwgyu/algorithm_problem_solving | /Leetcode/Group_Anagrams.py | UTF-8 | 1,048 | 3.90625 | 4 | [] | no_license | # Solution 1 : Use Hash after sorting string, Time : O(NMlogM), Space : O(NM) (N : number of strings, M : Maximum length of strings)
# Solution 2 : Use Hash . Set string that represents the number of strings as a key. Time : O(NM), Space :O(NM)
class Solution(object):
def groupAnagrams_2(self, strs):
a =... | true |
65e599dc99de944b673186516de0ec7af004beed | Python | oy-vey/algorithms-and-data-structures | /5-AdvancedAlgorithmsAndComplexity/Week2/energy_values/energy_values.py | UTF-8 | 3,194 | 3.359375 | 3 | [
"MIT"
] | permissive | # python3
EPS = 1e-6
PRECISION = 20
class Equation:
def __init__(self, a, b):
self.a = a
self.b = b
class Position:
def __init__(self, column, row):
self.column = column
self.row = row
def ReadEquation():
size = int(input())
a = []
b = []
for row in range(s... | true |
c2f5a660850d41717ea7a918dd5ad93f443fbe26 | Python | piotras/diabet | /diabet/meal.py | UTF-8 | 608 | 3.296875 | 3 | [] | no_license |
class Meal(object):
def __init__(self, name, carbo, fat, protein):
self.name = name
self.carbo = carbo
self.fat = fat
self.protein = protein
def get_name(self):
"""
Get name of the meal"
"""
return self.name
def get_carbo(self):
"""... | true |
62c952400535c5e8af9fc6fccf591535a8ed1b75 | Python | gelijergensen/Constrained-Neural-Nets-Workbook | /experiments/A_constrained_training/main.py | UTF-8 | 9,379 | 2.8125 | 3 | [
"MIT"
] | permissive | """An experiment to evaluate the efficacy of constrained neural network training
methods and draw comparisons"""
import functools
from ignite.engine import Events
import torch
import torch.nn as nn
import torch.optim as optim
from .checkpointer import ModelAndMonitorCheckpointer
from .constraints import helmholtz_equ... | true |
6aa0ae3b429ad2820628f4a283a6088b1330b01b | Python | Magdz/JavaCompiler | /main.py | UTF-8 | 366 | 2.78125 | 3 | [] | no_license | from Lexical import Lexical
from Parser import Parser
lexical = Lexical('rules.txt')
tokens = lexical.analize('code.txt')
tokens = ['int', 'id', ';', 'id', 'assign', 'num', ';', 'if', '(', 'id', 'relop', 'num', ')',
'{', 'id', 'assign', 'num', ';', '}']
print tokens
parser = Parser('grammar.txt')
tree = parser.an... | true |
5a1e5645ed2cb612dc5bc4bf97b06f4ffc3c5274 | Python | driquet/outbreak | /server/network.py | UTF-8 | 1,989 | 3.25 | 3 | [] | no_license | '''
File: network.py
Author: Damien Riquet <d.riquet@gmail.com>
Description: This file contains all network related functions
'''
# imports
import socket
import time
class DisconnectedPlayerException(Exception):
pass
def get_player_connection(host, port, timeout=2):
"""
This function awaits a player... | true |
6837c834a99c928135ceb84652245b9908158ef5 | Python | pangyang1/Python-Ninjagold- | /NinjaGold/ninjagold.py | UTF-8 | 2,388 | 2.71875 | 3 | [] | no_license | from flask import Flask,render_template,request,redirect,session, flash
import random
app = Flask(__name__)
app.secret_key = 'secret'
@app.route('/')
def home():
return render_template('index.html')
@app.route('/process_money', methods =['POST'])
def addCoins():
session['name'] = request.form.keys()[0]
if... | true |
f9835a92aeb44d25fc0b32663a64affd30808de5 | Python | pavanjaldu/python | /snippets.py | UTF-8 | 946 | 3.265625 | 3 | [] | no_license | i = 1
while i <= 10:
print(i)
i=i+1
for a in range(1,10):
for k in range(1,3):
print(a,k)
for b in range(10,-1):
print(b)
for letter in 'pavan':
print('current letter: ', letter)
proj1 = ['scope' ,'rBS' , 'hSBC' , 'euroclear']
for proj in proj1:
print('... | true |
6a2e63381d2cfdeca16ea09950c78e81391de26d | Python | leonlbc/witz-api | /WitzAPI/endpoints/markowitz/utils/validate.py | UTF-8 | 656 | 2.609375 | 3 | [] | no_license | import jsonschema
from jsonschema import validate
schema = {
"title": "Portfolio",
"type": "object",
"required": ["id", "stocks", "period"],
"properties": {
"id": {
"type": "integer"
},
"n_simulations": {
"type": "integer",
"minimum": 1,
... | true |
450f3e1e291143e2520ef1c188f6e21ac31ae1d7 | Python | trendmanagement/tmqrexo_alexveden | /backtester/exoinfo.py | UTF-8 | 758 | 2.828125 | 3 | [] | no_license | from backtester import matlab
import pandas as pd
class EXOInfo(object):
def __init__(self, data, exo_info):
self.data = data
self.exo_info = exo_info
@classmethod
def from_matfile(cls, filename):
data, exo_info = matlab.loaddata(filename)
return cls(data, exo_info)
d... | true |
c4b106cd3a7ccdfc89a876963b5b2f7b8b3a4c24 | Python | huangjunheng/Digit_Recognizer | /cnnNet.py | UTF-8 | 1,318 | 2.6875 | 3 | [] | no_license | import torch
from torch import nn
class ResNet(nn.Module):
def __init__(self):
super(ResNet, self).__init__()
self.func = nn.Sequential(
nn.Conv2d(1, 32, 3, 1, 1),
nn.BatchNorm2d(32),
nn.ReLU(True),
nn.Conv2d(32, 32, 3, 1, 1),
nn.Batch... | true |
f8d0514f04aa5bfc7d978ccc692576f6a71d9e9a | Python | Adasumizox/ProgrammingChallenges | /codewars/Python/4 kyu/PyramidSlideDown/longest_slide_down.py | UTF-8 | 173 | 2.671875 | 3 | [] | no_license | def longest_slide_down(p):
res = p.pop()
while p:
tmp = p.pop()
res = [tmp[i] + max(res[i],res[i+1]) for i in range(len(tmp))]
return res.pop() | true |
107b957e135d3a9036d196d760656d86514191d9 | Python | wait17/data_structure | /10.16/03.ๅ .py | UTF-8 | 2,205 | 4.125 | 4 | [] | no_license | # ๅ
# ไบๅๅ
# ๆๅคงๅ , ๆๅฐๅ
# ไบ่ฟๅถ ๅ่ฟๅถ ๅ
ซ่ฟๅถ ๅๅ
ญ่ฟๅถ
# ๅณ็งปไธไฝ(้คไบ) ๅทฆ็งปไธไฝ(ไนไบ)
class Heap:
def __init__(self):
# ๅๅงๅไธไธช็ฉบๅ ,ไฝฟ็จๆฐ็ปๆฅๅญๆพๅ ๅ
็ด ,่็ๅญๅจ็ฉบ้ด
self.data_list = []
def get_parent_index(self, index):
# ๅๅฐไธๆ ไธบindex็่็น็็ถ่็น็ไธๆ
if index <= 0 or index > len(self.data_list) - 1:
return None
... | true |
174ff5a3489b353a711b51b52e2b0aba253333e6 | Python | killeronline/Madagaskar | /possible_traits.py | UTF-8 | 385 | 2.828125 | 3 | [] | no_license | import numpy as np
traits = []
op = 0 # Baseline
for hp in range(-2,3):
for lp in range(-2,3):
for cp in range(-2,3):
hpC = max(op,hp,lp,cp)
lpC = min(op,hp,lp,cp)
traits.append([op,hpC,lpC,cp])
traits = np.array(traits).astype(float)
traits = np.unique(traits, axis=0)
... | true |
8b42f7ebc514dd3e10d6148ef91dc4fb57df6d51 | Python | roei-birger/Ex3 | /src/Map.py | UTF-8 | 1,211 | 3.609375 | 4 | [] | no_license | import math
class Map:
"""This class represents a support object for the "shortestPath" method,
at the "shortestPathDist" method the graph is tested to find the shortest
path between vertices. Each vertex that is found in this way is preserved
by this object in order to know which vertex was "his p... | true |
edbc27dab824cd9a6d9aac4fe16b9c4b516328e0 | Python | TUIlmenauAMS/Python-Audio-Coder | /Dmatrix.py | UTF-8 | 628 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 04 17:34:26 2016
from Matlab
@author: Max, Gerald Schuller
"""
import numpy as np
def Dmatrix(N):
"""produces a delay matrix D(z), which has delay z^-1 on the upper half of its diagonal
in a 3D polynomial representation (exponents of z^-1 are in the thir... | true |
6f2052c7b6d10e0d72df083f942e1e12aa690c48 | Python | EurobotMDX/Eurobot2018 | /driveRobot/sensorConfig.py | UTF-8 | 638 | 2.65625 | 3 | [] | no_license | import smbus
class SensorConfig:
device = smbus.SMBus(1)
address = None
def __init__(self, dev_addr):
self.address = dev_addr
def changeAddress(self, newAddress):
self.device.write_byte_data(self.address, 0, 0xA0)
self.device.write_byte_data(self.address, 0, 0xAA)
sel... | true |
509e9718a0488f51153f96f963805c0d956b66d0 | Python | Almondo4/ML-IDS-Framework | /ZeroDay1/Models/Clasification/Reduced/SAE-ET.py | UTF-8 | 2,945 | 2.53125 | 3 | [] | no_license | import pandas as pd
import numpy as np
DataTrain = pd.read_pickle("../../../Data/AndMal_Zero_Train.csv")
DataTest = pd.read_pickle("../../../Data/AndMal_Zero_Test.csv")
DataZero = pd.read_pickle("../../../Data/AndMal_Zero_Day.csv")
featureMatrixTR = DataTrain.iloc[:,:-1].values
labelVectorTR = DataTrain.iloc[:,-1].va... | true |