blob_id stringlengths 40 40 | content_id stringlengths 40 40 | repo_name stringlengths 5 114 | path stringlengths 5 318 | language stringclasses 5
values | extension stringclasses 12
values | length_bytes int64 200 200k | license_type stringclasses 2
values | content stringlengths 143 200k |
|---|---|---|---|---|---|---|---|---|
45aacb08108c4292c8852d6ae4574fc0ee8abf74 | 2ac3f05edc2085ee140c51f61a80ad63b7cf95e6 | Skuldur/athena-model-training | /intent_trainer/preprocessing.py | Python | py | 4,387 | permissive | # -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2017 Hiroki Nakayama
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, cop... |
abd3308ff63efcf140b2fe457ff47f16e5f57831 | 05e418f90ec4228d1ba10d2e05f8687a64938fa6 | boringxie/Pyqt5_Study_File | /PyQt5_主窗口类型/__init__.py | Python | py | 711 | no_license | import sys
from PyQt5.QtWidgets import QApplication,QWidget,QMainWindow
from PyQt5.QtGui import QIcon
class FirstMainWin(QMainWindow):
def __init__(self):
super(FirstMainWin,self).__init__()
self.setWindowTitle("第一个主窗口应用")
self.resize(400,300)
self.status = self.statusBar()... |
20c2d8cd1037008fc498e3b99187cad83f45f7a3 | 248d6b0a99af893fb61fb5108963806d41f3bfbe | adimyth/datascience_stuff | /machine-learning/cross_validation.py | Python | py | 6,121 | no_license | # taken from mlframework repo - https://github.com/abhishekkrthakur/mlframework
# single_col_regression stratified split - https://github.com/abhishekkrthakur/mlframework/pull/9/files
import pandas as pd
from sklearn import model_selection
from rich import print
import rich.traceback
rich.traceback.install()
class Cr... |
5e7da168e3cdf4022ba8a17792fd422dd969265b | d9fd13e08d9c14d25a8b10dc34525ecbc685c462 | web-pf/service | /src/api/error.py | Python | py | 2,163 | no_license | from flask import Blueprint, request, session, make_response
import secrets
from werkzeug.security import generate_password_hash, check_password_hash
import json
import shortuuid
import time
from numpy import mean
from .db import client
from .auth import authenticate
from .util.db import get_next_seq
platform_db = cl... |
e4925cfbba833b43f0c4a194d624931c3cd27eea | ddfde7e595938263d0052b15dc848f049d317518 | qianqianderizi/11777-Group11 | /oscar/distillation/train.py | Python | py | 12,977 | permissive | # coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. team.
#
# 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 a... |
17e504657ce36c5053ea415606da07b25ed40ec5 | ca3c45fa657a760a53e4762bfcd5692b3ffdbe3d | sawar7577/terminal-based-mario | /config.py | Python | py | 2,483 | no_license | '''
contains all the symbols, constants
directions, etc
'''
'''
Allow certain inputs and translate to easier to read format
UP : 0
DOWN : 1
LEFT : 2
RIGHT : 3
BOMB : 4
'''
board_height = 44
board_width = 1200
show_height = 44
show_width = 100
# key presses
JUMP, DOWN, LEFT, RIGHT, SHOOT,... |
81169865e875b3b90d5e416157ef443ae1511783 | be4d9eaddbb9a659a5b371235e46db79ede8e455 | AnimusAntonius/Axelrod | /axelrod/strategies/axelrod_first.py | Python | py | 17,456 | permissive | """
Additional strategies from Axelrod's first tournament.
"""
import random
from axelrod.actions import Actions, flip_action, Action
from axelrod.player import Player
from axelrod.random_ import random_choice
from axelrod.strategy_transformers import FinalTransformer
from .memoryone import MemoryOnePlayer
from scip... |
140a24396ed7d08a7d762d55163a04aefd5290ff | f66dde8fd006063772ec16657988b7e83090f598 | nevermore1993/leetcode_python3 | /1016. Binary String With Substrings Representing 1 To N/solution.py | Python | py | 521 | no_license | // 没什么技巧,只不过是对python内置函数的应用。bin()将int转换为二进制字符串,如bin(3)='0b011'
// string.count(abegin=0,end=len(string))返回string中a出现的次数。类似的函数还有string.find(a),返回起始索引或-1
// string.index(a),返回起始索引或异常
class Solution:
def queryString(self, S: str, N: int) -> bool:
for i in range(1, N + 1):
tmp = bin(i)[2:]
... |
b3e528848ab0099535ebad59f6b49743b166d3d4 | d512f12cfa2a2e15b226ac875d80c8cd511f0d30 | pythondjango1234/university_repository | /my_new_project/university/models.py | Python | py | 1,506 | no_license | from django.db import models
from multiselectfield import MultiSelectField
class Feedbackdata(models.Model):
name=models.CharField(max_length=100)
rating=models.IntegerField()
date=models.DateField()
feedback=models.TextField(max_length=1000)
class ContactData(models.Model):
name=models.CharField(... |
47432f2e0df0c44a359bcaf89e4594369f6ed131 | 50e1c1af8246985f645d2fc139f77c7e0148a0b6 | tatoalo/USI_Hackaton_2019 | /backend/logic/store_journey.py | Python | py | 655 | no_license | import json
from datetime import datetime
from ..classes import Coords, JourneyType
from ..elastic.core import insert_data
async def store_journey(type: JourneyType, start_coords: Coords, end_coords: Coords, distance: float, fuel: float):
current_time = datetime.now()
dict_data = {
"type": type.value... |
962506b3b3f1224ba986ee0d5451125749b07045 | c00a1be69b21bde03d801f2ddba1d5f687121e04 | shen-huang/selfteaching-python-camp | /exercises/1901010089/d3_exercise_calculator.py | Python | py | 748 | no_license | def add(x, y):
return x + y
def sub(x, y):
return x - y
def mul(x, y):
return x * y
def div(x, y):
return x / y
print('******************************')
print("简陋计算器---只能算加减乘除哦")
print('******************************')
num1 = int(input("输入第一个数字:"))
print("使用哪种运算?1:+ 2:- 3:* 4:/")
choice = input("输入您的选... |
8313422fe65b5cfa7b6efcc983324cb45abe6493 | 4724bf1f3c8585b677d1a76433cc414369d9ce15 | BeePig/Fake_news_detection_using_knowledge_graph | /server/crawl_cnn.py | Python | py | 10,705 | no_license | from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
import os
import spacy
import neuralcoref
import nltk
import datetime
import re
import requests
def telegram_bot_sendtext(service_name, time, type, bot_message):
bot_tok... |
70ae0f18eb2f9605dc0b518a1e953c1a22e80cc8 | 5eefa91071ea79a8cb81e201f537667f618b1ff3 | BigDataHeroes/airbnbProcess | /.ipynb_checkpoints/airbnb_analisis_exploratorio-checkpoint.py | Python | py | 6,253 | no_license | import pandas as pd
import numpy as np
import json
from shapely.geometry import shape, Point
def getInputPath():
return "airbnb.csv"
def getOutputPath():
return "airbnb_clean.csv"
def getBaseDataPath():
return ""
def getOutputAggPath():
return 'airbnb_aggregate.csv'
def deleteColumns(datos):
d... |
50618e6d0e281ce9750855d3bb5a31fe361991a4 | eb8c4f27004a59a9160fe71c3f9e0151ec0f126f | MihirMehta5695/MachineLearning_SpamFilter_WebApp | /python/venv/Scripts/easy_install-3.8-script.py | Python | py | 504 | no_license | #!C:\Mihir\Projects\My\ML_Spam_Filter_Web_App\MachineLearning_SpamFilter_WebApp\python\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==40.8.0','console_scripts','easy_install-3.8'
__requires__ = 'setuptools==40.8.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__mai... |
ddb46c62054db4f8ea2fe8e868e84cda99a09400 | f9fc1e24e788cec959b82c85799c7d1b42dc460c | SynthAI/SynthAI | /sunset/sunset/python/modules/base_errors.py | Python | py | 2,836 | permissive | # Copyright 2017 The Sunset Authors. 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 l... |
9379f3cc9c1a49e6f7ad2ea8db62bcb491962a6c | 71b17a6b14c1fb62d0a2519e4f39369e8a66b78a | DevWonder01/django-tensortflow-image-classification-backend | /manage.py | Python | py | 545 | no_license | #!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ImageClassify.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django... |
4a36481424130fd39f28f66f739c24e06809be37 | a67b67f4cae5fe15076bd1231803fc8d00466d1d | mog-hi/BOJ_Python | /BOJ/Greedy/1041.py | Python | py | 353 | no_license | n = int(input())
arr = list(map(int, input().split()))
if n == 1:
answer = sum(arr) - max(arr)
else:
a = [min(arr[0], arr[5]), min(arr[1], arr[4]), min(arr[2], arr[3])]
a.sort()
one = a[0]
two = a[0] + a[1]
three = a[0] + a[1] + a[2]
answer = one *((n-2)**2 + (n-2)*(n-1)*4) + two * ((n-2)*4+... |
935cd8694754ac58770de6b47e82c000c5827285 | 51f7f02304d5198872552a79e522b999d7f4dd0f | qalmaqihir/pyecsca | /test/sca/test_combine.py | Python | py | 2,677 | permissive | from unittest import TestCase
import numpy as np
from pyecsca.sca import Trace, CombinedTrace, average, conditional_average, standard_deviation, variance, average_and_variance, add, subtract
class CombineTests(TestCase):
def setUp(self):
self.a = Trace(np.array([20, 80], dtype=np.dtype("i1")), {"data": ... |
1c40c619b8e82d0cde15b62de8eeb0c0ca4b2e14 | 0bd5da9fd0103578c7ff07d6b01dbed8a3a32ff1 | imouiche/Python-for-Developers | /Fundemantals/lists.py | Python | py | 621 | no_license |
chars = list("Hello World")
print(chars)
items = [
("prduct1", 10),
("prduct2", 9),
("prduct3", 12)
]
""" def sort_item(item):
return item[1]
items.sort(key=sort_item)
print(items)
"""
# Using lambda expression
items.sort(key=lambda item: item[1])
print(items)
prices = [item[1] for item in items... |
685689999403fd2327ee905f40433ebdb1b3c7cc | 22f0bef09b7cdf85a77521061502ed7852c3a0b0 | afkmike/afkcon | /home/views.py | Python | py | 435 | no_license | __author__ = 'Mark'
from django.shortcuts import render
from django.http import HttpResponse
from django.core.urlresolvers import reverse
def index(request):
#return HttpResponse("Testaroonie")
#return render(request, reverse('index'))
return render(request, 'home/home.htm')
def contact(request):
re... |
e8ede3c2b8236dc53cea50d4ab097c61a76335bd | f1477d3bc44ba988240f5fa03c5179c86d49ce05 | bytebarista/iot_workshop | /src/thumbslide.py | Python | py | 1,445 | no_license | import math
from machine import Pin, ADC
from array import array
class Thumbslide:
x_center = 1580
y_center = 1769
def __init__(self, pinx, piny, atten=ADC.ATTN_11DB, width=ADC.WIDTH_12BIT, tolerance=300):
self._pinX = pinx
self._pinY = piny
self._tolerance = tolerance
A... |
99fef3ab029f13ebd0c7201941c948dee1af8f04 | 0b584fab8a25c11a890fbaf9f459e6bab845f5c6 | cui553497637/matplotlib | /lib/matplotlib/widgets.py | Python | py | 103,644 | no_license | """
GUI neutral widgets
===================
Widgets that are designed to work for any of the GUI backends.
All of these widgets require you to predefine a `matplotlib.axes.Axes`
instance and pass that as the first parameter. Matplotlib doesn't try to
be too smart with respect to layout -- you will have to figure out ... |
8ab47ff70a02f453d396d4154996678096cfa93c | f7463e5c895ffa8076e2f5d973fb48afea709f68 | Wh1t3Fox/CS547-Project | /docs/conf.py | Python | py | 9,101 | permissive | # -*- coding: utf-8 -*-
#
# PIR documentation build configuration file, created by
# sphinx-quickstart on Fri Mar 13 20:02:20 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All c... |
122488e14d86c8a009235a124916e17ce64e4c39 | 5ef4a748a2e39d1be55ec19d82d6fc818abd9d3f | afcarl/Sif-1 | /sif/models/bayesian_logistic_regression.py | Python | py | 4,238 | permissive | import numpy as np
import scipy.linalg as spla
import scipy.sparse as spsp
from .generalized_linear_model import GeneralizedLinearModel
from .sigmoid import sigmoid, sigmoid_derivative
from ..samplers import multivariate_normal_sampler
def add_bias(X):
return np.hstack((np.ones((X.shape[0], 1)), np.atleast_2d(X))... |
a5d71a030e7219637141210c1e7c8bc730db6900 | 8a50b3d42ef3f822b5cd12334b4f6ca4e438b978 | ToonAlfrink/amcatscraping | /newssites/nrc_archief.py | Python | py | 4,168 | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, absolute_import
###########################################################################
# (C) Vrije Universiteit, Amsterdam (the Netherlands) #
# ... |
ce7ca0dd9784024a79868f7ed4e158d390b0726b | db966a2cab93e108174fe34fb327f367ce2d6625 | XDATA-Year-3/hackathon-2015 | /titan_setup/split.py | Python | py | 4,210 | no_license | #!/usr/bin/env python
import csv, sys
#LIMIT = sys.maxint
LIMIT = 10000
rawfile = open('../data/songs.csv','rb')
raw = csv.reader(rawfile)
songsfile = open('/tmp/splitsongs.csv', 'wb')
songs = csv.writer(songsfile)
albumsfile = open('/tmp/splitalbums.csv','wb')
albums = csv.writer(albumsfile)
artistsfile = open('... |
b7e9f6121e6b2480bbe3e32200551db1a5766fe3 | 2e20d1b11d449f7d6fab886fc5035087bad9467e | miezekatzendompteur/geocaching | /geocaching.py | Python | py | 3,470 | no_license | #!/usr/bin/env python
# coding: utf-8
# In[14]:
import re
import csv
import requests
from bs4 import BeautifulSoup
url = "https://www.geocaching.com/account/signin"
class geocache():
def __init__(self, name):
self.name = name
self.nCor = ""
self.eCor = ""
self.hint = ""
... |
7758273bd44d22c361a6a82a13b9212ed5dae9cc | b41fd2894130a92189e108f0ec0222cfb961c25f | stephenohair/alexa-smart-garage | /garage_status.py | Python | py | 1,550 | permissive | import RPi.GPIO as GPIO
import time
import os
from pathlib import Path
GPIO.setmode(GPIO.BCM)
# photo resistor pin 1
open_led = 17
# photo resistor pin 2
close_led = 27
def rc_time(pin):
count = 0
# Output on the pin
GPIO.setup(pin, GPIO.OUT)
GPIO.output(pin, GPIO.LOW)
time.sleep(0.1)
# C... |
dd9b06899dcb24be73a9f17ad892d84f1672adee | 30e580113466adce3829657eefd80556ae490116 | Sturtuk/Zun | /zunzun/LongRunningProcess/FitUserCustomizablePolynomial.py | Python | py | 6,229 | permissive | import inspect, time, math, random, multiprocessing, os, sys, copy
import numpy, scipy, scipy.stats
import FittingBaseClass
import zunzun.forms
import zunzun.formConstants
import pyeq2
sys.stdout = sys.stderr # wsgi cannot send to stdout, see http://code.google.com/p/modwsgi/wiki/DebuggingTechniques
class FitUser... |
8cedd206d8303f30598169ad57ae9d1811558b48 | d3201bffc48571a96f49a71d4d975c5641a7738e | SamHames/hyperreal | /examples/australian_federal_hansard/hansard_corpus.py | Python | py | 21,365 | permissive | """
This module creates a corpus of hansard speeches - the data model is based on (and
uses code derived from) Tim Sherratt's GLAM Workbench [1].
Note that there are differences in structure between the historical
(-2005) Hansard data and data since that point - they can broadly be brought
together into the same schem... |
abdf72e6d0ccd92df1d6046229e97e72b09e7def | d2a440fb16b60b737345a4e5c85ca5452037abcb | Nitin-Diwakar/100-days-of-code | /day75/2.py | Python | py | 353 | permissive | sampleList = [34, 54, 67, 89, 11, 43, 94]
print("Original list ", sampleList)
element = sampleList.pop(4)
print("List After removing element at index 4 ", sampleList)
sampleList.insert(2, element)
print("List after Adding element at index 2 ", sampleList)
sampleList.append(element)
print("List after Adding... |
03352019c037e9b2e0482477c91b9013dc8ef16f | bc0cca5c41ca1189814e5a05a73dcfdd824082fc | cesarPano/ProjectForTFG | /consulta.py | Python | py | 951 | no_license | import pymysql
import sys
mes = { '1': 'Ene', '2': 'Feb', '3': 'Mar',
'4': 'Abr', '5': 'May', '6': 'Jun',
'7': 'Jul', '8': 'Ago', '9': 'Sep',
'10': 'Oct', '11': 'Nov', '12': 'Dic',
'99': 'Todo' }
db = pymysql.connect("localhost","root","root","agenda")
cursor = db.cursor()
sql = "SELECT * FROM alarmas"
... |
17761f723ad4de234704a91bfffd7bf921afddc0 | 1cfe6760710c32d8af0f4f1bc67eb0c7536b85ff | Swapnil-Powar/Crop-Yield-Prediction | /Crop Yield Prediction/Python Code/Load_Data.py | Python | py | 560 | no_license | import pandas as pd
def Display_Data(df):
print("*****Top 5 rows in a data*****")
print("\n")
print(df.head())
print("\n")
print("*****Bottom 5 rows in a data*****")
print("\n")
print(df.tail())
print("\n")
def Describe_Data(df):
print("*****Statistical description of the data*****... |
cf61ec1e7c1fa3ba3617e9b4b28af38ce51329cd | 0ee4e00dd5aecde8249f538c38e7677b83892116 | MokoSan/pymc3 | /pymc3/tests/test_distributions.py | Python | py | 64,652 | permissive | # Copyright 2020 The PyMC Developers
#
# 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 ag... |
d2b9f514049ad8fb70ee3a77c664a09733efa6d4 | 0571732495e0d2241a83871913cd023113cddcae | LucienXian/CS61a | /Project/scheme/scheme.py | Python | py | 21,841 | no_license | """A Scheme interpreter and its read-eval-print loop."""
from scheme_primitives import *
from scheme_reader import *
from ucb import main, trace
##############
# Eval/Apply #
##############
def scheme_eval(expr, env, _=None): # Optional third argument is ignored
"""Evaluate Scheme expression EXPR in environment ... |
1b2ae319e26db3d7ea2cf4831717c574eb7cdf6b | 7ef6eb252ffce00d418a69ed2e80237201e3fbd8 | cleiveliu/leetcodecn | /1114.按序打印/1114-按序打印.py | Python | py | 759 | permissive | class Foo:
def __init__(self):
self.d = {}
def first(self, printFirst: "Callable[[], None]") -> None:
# printFirst() outputs "first". Do not change or remove this line.
self.d[0] = printFirst
self.check()
def second(self, printSecond: "Callable[[], None]") -> None:
... |
5b40935723aab2ad0d67c44e31b52050fa27a400 | dfbfcac471e4bb2693d50a23e186d0921e9c3f6f | SwyftG/PeekpaHubTech | /PeekpaHubWebsite/apps/Gua/serializers.py | Python | py | 1,250 | permissive | # encoding: utf-8
__author__ = 'lianggao'
__date__ = '2019/10/27 3:10 PM'
from rest_framework import serializers
from .models import Gua, GuaRModel
class GuaSerializer(serializers.Serializer):
gua_number = serializers.CharField()
gua_sub_title = serializers.CharField()
gua_title = serializers.CharField()
... |
91d23e8d6180146db9835029a6414f76dcd47d8d | 3e54883ed9b7581eba6b6fe327cd5c0c8d94e5e7 | tensorflow/federated | /tensorflow_federated/python/aggregators/hadamard.py | Python | py | 3,999 | permissive | # Copyright 2021, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
cb3955d1b772bf623a4e29100bc6f73f5ca066fa | eb0bd7994b09b9885d32a085ad2d076300a60e94 | joeirimpan/nse_scraper | /setup.py | Python | py | 951 | permissive | # -*- coding: utf-8 -*-
import setuptools
requirements = [
'cherrypy',
'redis',
'requests'
]
test_requirements = ['flake8', 'pytest', 'vcrpy']
setuptools.setup(
name="nse-scraper",
version="0.0.5",
url="https://github.com/joeirimpan/nse_scraper",
author="Joe Paul",
author_email="joe... |
40bef969766886d859480f6d95f18ba585aceb64 | c0add4704d1c947628630f2fed784ee158735c00 | CGodinho/RaspberryPi | /04-Led_Breathing/led_breathing.py | Python | py | 691 | no_license | # name: leg_breathing.py
# Este programa usa modelação de frequência para controlar um led.
# A luz acende e apaga progressivamente, simulando um sinal analógico.
import RPi.GPIO as GPIO
import time
import random
ledPin = 12
GPIO.setmode(GPIO.BOARD)
GPIO.setup(ledPin, GPIO.OUT)
GPIO.output(ledPin, GPIO.LOW)
cycle =... |
071f682bee6218ef4881657b37ad3ffcff16aa57 | 3364d02be4da7a82d94ed29798da8eadcb62601d | MsMaddyMac/django-portfolio | /blog/migrations/0002_auto_20201101_0000.py | Python | py | 370 | permissive | # Generated by Django 3.1.2 on 2020-11-01 00:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='blog',
name='title',
field=m... |
5d158712736a340c0b9c682f5b65a48dabdc942a | 8fe9f786d608cfdc7b55639c543094fce56a7930 | kimsoar/gistory | /gistory/git_object.py | Python | py | 7,659 | no_license | import os
from abc import ABCMeta, abstractmethod
from six import with_metaclass
class Data(with_metaclass(ABCMeta)):
filepath = None
_info = None
def __init__(self, filepath):
self.filepath = filepath;
self.parse()
def __str__(self):
return self.symbol() + self._info['type'... |
1b8de413c214cc399aacefc2dde04e499e1093cc | 5f2b4671d61b9fe600203330f4f0e3c917f6b9e6 | Justamann/learn_django | /artways/products/products/urls.py | Python | py | 750 | no_license | """products URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-base... |
6343ea66ad59cdcebfc440b0ce9a5d7e15ab289c | 50013abd61638048d821ba2751159d9162f5cfa1 | billw2012/Caveman2Cosmos_old | /Assets/Python/Screens/CvIntroMovieScreen.py | Python | py | 4,304 | no_license | ## Sid Meier's Civilization 4
## Copyright Firaxis Games 2005
from CvPythonExtensions import *
import CvUtil
import ScreenInput
import CvScreenEnums
# globals
gc = CyGlobalContext()
ArtFileMgr = CyArtFileMgr()
localText = CyTranslator()
class CvIntroMovieScreen:
"Intro Movie Screen"
bMovieState = 0
... |
6edd6c26df56ecc7b27ee0e187e4c127f637c1a5 | a2a836113078e4056fdd3a5f8e91903ce238b026 | Patricia-Kasapa/starting_github_anew | /new_try_website.py | Python | py | 404 | no_license | #! usr/bin/python3
from flask import Flask, render_template, url_for
app = Flask(__name__)
@app.route('/')
def index():
return render_template("index.html")
@app.route('/home')
def home():
return render_template("home.html")
@app.route('/contact')
def contact():
return render_template("contact.html"... |
0cfba09697540ae6ef51fe721dde66ce1a8b9de0 | 170664d30eeb4ae5646206df6a905fc744de0cf3 | YYLSourceCodeLearn/models | /official/resnet/resnet_model.py | Python | py | 14,613 | permissive | # Copyright 2017 The TensorFlow Authors. 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 applica... |
6025664f8c1ba14192ff57097de914b0a4ed7584 | 4c37858604aedf6523769de1fba6e095debcede1 | maria-kravtsova/learning-python | /exercism/leap/leap.py | Python | py | 379 | no_license | def is_leap_year(year):
""" Function that checks if a year is a leap year. """
# if (year % 400 == 0):
# return True
# elif (year % 100 == 0):
# return False
# elif (year % 4 == 0):
# return True
# else:
# return False
retur... |
52672c01ddd38bfa989f79c2cd54d8839411991e | f0d35eb02cc61c6625b3ff12eaa3a4a511bac702 | wbubblerteam/bubcoin | /test/functional/mempool_packages.py | Python | py | 15,980 | permissive | #!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test descendant package tracking code."""
from decimal import Decimal
from test_framework.messages im... |
c07cf1762c07a1d883319c6d8fcca1bc4c1e52dc | aa02ac5bc278205de2aed504c6ee104e54c980fd | pedroleone/rpgcampaign | /rpgcamp/campaign/migrations/0025_auto_20170501_1736.py | Python | py | 562 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-01 20:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('campaign', '0024_auto_20170429_1738'),
]
operations = [
migrations.RemoveFiel... |
6b2229cb6e4fa80a7efaa0ed3103443cbbb10e48 | 5b1b99ffae7c5db48dd8ff404656a0f79b9b424b | smmzhang/VideoDenoiseByDVP | /image_warp.py | Python | py | 3,594 | no_license | import numpy as np
def image_warp(im, flow, mode='bilinear'):
"""Performs a backward warp of an image using the predicted flow.
numpy version
Args:
im: input image. ndim=2, 3 or 4, [[num_batch], height, width, [channels]]. num_batch and channels are optional, default is 1.
flow: flow vector... |
86ca0bdd8ed0a94171aff098efcf8f79cae997d7 | 868bdc2ca1591bed2ff9b70a546a457c3ae2ddde | jlquichimbo/keyzresidential | /rents/urls.py | Python | py | 894 | no_license | from django.conf.urls import url
from .import views
urlpatterns = [
url(r'^reports/', views.reports_view, name='reports'),
url(r'^$', views.RentList.as_view(), name='list'),
url(r'^(?P<pk>\d+)$', views.RentDetail.as_view(), name='detail'),
url(r'^new/$', views.RentCreation.as_view(), name='new'),
url(r'^edit/(?P<... |
849d9bc8089feb72fb68bd7b6ae9f325e3f0e86b | ab08f32dd273d97076c89b49fca645161482763f | CovidInfo-PT/backend | /backups/venv_backups/bin/rst2xetex.py | Python | py | 913 | no_license | #!/Users/rd/Desktop/UA/covid/backups/venv_backups/bin/python
# $Id: rst2xetex.py 7847 2015-03-17 17:30:47Z milde $
# Author: Guenter Milde
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing Lua/XeLaTeX code.
"""
try:
import locale
local... |
422b0b204011c39ecccd03f7b46300674a31e244 | 9bcdd0c21acf4bac30484b86a95deb3c659ca839 | LautaroEst/BecaNLP | /Programs/16-pytorch-back-to-basics/NLPUtils_v16_1/WordVectors.py | Python | py | 6,027 | no_license | import pandas as pd
import torch
from torch.utils.data import Dataset, DataLoader, sampler
import torch.nn as nn
import numpy as np
import itertools
class Vocabulary(object):
"""Class to process text and extract vocabulary for mapping"""
def __init__(self, tokens_dict={}, frequencies_dict={}):
... |
b85e56c2419c2a73e50562f847ae319075991f1b | f68bfe72119b6e948820dd52614e99d364b641bf | navneetha08/Ride-Share-Application | /Final_Project/Users/database_users.py | Python | py | 1,169 | no_license | from sqlalchemy import Column, Integer, Sequence, String, ForeignKey, DateTime
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from flask_sqlalchemy_session import current_session
from sqlalchemy import create_engine
# from database_rides import Ride, RideUsers
from... |
8aa2901e1699a348277e076707671a60214e13bd | 8cf8f24446712a719d6a83ba3f60e6415ff5d837 | annamartinez21284/AoC2020 | /8Dec0.py | Python | py | 1,685 | no_license | with open("8Dec-data.txt", "r") as f:
rows = f.readlines()
rows = [x.strip() for x in rows]
ACC = 0
INDEX = 0
INDICES = {0}
def iterate(rows):
global ACC
global INDEX
while INDEX <= len(rows):
if rows[INDEX].startswith("acc"):
if INDEX == len(rows)-1:
return ACC + int(rows[INDEX].strip("acc... |
943e2d27cae80323c7f1dc56117ac3398ea8298f | 54ce1a2a2c1b541b3f16ade815fd14f39f61483b | JackGrence/FuzzInspector | /visualizer.py | Python | py | 30,044 | permissive | import threading
import traceback
import sys
import time
import os
import select
import subprocess
import struct
import r2pipe
import json
import queue
import hexdump
import signal
import glob
from datetime import datetime
class VisualizeHelper:
STATUS_CHILD = 0
STATUS_PARENT = 1
@classmethod
def pr... |
bf38babafa15660c4ccf130f854ec401863f03d0 | aa9b0c622f37f70d21711b17e2ef5e5f2c9f29a8 | cyberjunky/python-plugwise | /plugwise/util.py | Python | py | 1,510 | permissive | # Copyright (C) 2011 Sven Petai <hadara@bsd.ee>
# Use of this source code is governed by the MIT license found in the LICENSE file.
import sys
import serial
DEBUG_PROTOCOL = False
def _string_convert_py3(s):
if type(s) == type(b''):
return s
return bytes(s, 'latin-1')
def _string_convert_py2(s):
... |
b81f3c6075b3d4ebb9d57dad2218b515c472eec1 | bde2c96f42a0aa30d0c97e482c4b764fbfd082df | schlecky/infotsi | /challenge/migrations/0016_auto_20190827_2321.py | Python | py | 588 | no_license | # Generated by Django 2.2.4 on 2019-08-27 21:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('challenge', '0015_auto_20170427_2304'),
]
operations = [
migrations.CreateModel(
name='Notification',
fields=[
... |
5e7fed101c2f4d7f7004a9449744cf5fa7bb8b00 | 2061257ed64e6dd8a536ae07fe0cdbc0c50731d3 | mindspore-ai/models | /research/cv/advanced_east/src/config.py | Python | py | 3,353 | permissive | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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 agreed to... |
225a0b1151ff7137bf8ceceabb96a3015ab4b2df | baa9cb2800054dcf68704d604eeacab62edf74c4 | adevore/ttt-bench | /python/ttt.py | Python | py | 325 | permissive | # Perfect Tic-Tac-Toe player in Python
# Copyright © 2012 Bart Massey
# [This program is licensed under the "MIT License"]
# Please see the file COPYING in the source
# distribution of this software for license terms.
from negamax import *
board = [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0] ]
print(negamax(1, boar... |
2856510d9e26884005e811b029cfd1543083afde | b7c42753e373922499b91f55a0f69ce7b744f08c | valeria-laynes/Homeworks | /HW07.py | Python | py | 12,154 | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
#Import packages
from surprise import *
import os
from surprise.model_selection import *
from surprise import accuracy
from surprise import Dataset
import numpy as np
import random
import matplotlib.pyplot as plt
# In[2]:
# 3 Import dataset
np.random.seed(0)
rando... |
7ff6c3a7a2082e3ff251467cdaf9d20d52a818f5 | 63b241f2f6ab5a8d94f19191b588bca276123c58 | aditya-doshatti/Leetcode | /seat_reservation_manager_1845.py | Python | py | 2,049 | no_license | '''
1845. Seat Reservation Manager
Medium
Design a system that manages the reservation state of n seats that are numbered from 1 to n.
Implement the SeatManager class:
SeatManager(int n) Initializes a SeatManager object that will manage n seats numbered from 1 to n. All seats are initially available.
int reserve() F... |
1dfcd3e657a535231ad45d6eb83a29b3ac3a090e | 62edd62682ca752bf4abc9d49617cff6819a5db2 | capy-larit/exercicios_python | /exer23.py | Python | py | 369 | no_license | '''
Faça um programa leia e sorteie os nomes digitados.
'''
from random import choice
nome = input('Digite o primeiro nome: ')
nome_1 = input('Digite o segundo nome: ')
nome_2 = input('Digite o terceiro nome: ')
nome_3 = input('Digite o quarto nome: ')
lista = [nome, nome_1, nome_2, nome_3]
sorteio = choice(lista)
... |
8b280df07da22bb8d0b0e677d1caa33976b547c3 | 6a42a7b88254f4d963d35d167cb37f5903bf2213 | EvgeniyaKomaltilova/romashka-rat | /rattery/models/Location.py | Python | py | 563 | no_license | from django.db import models
class Location(models.Model):
"""Модель локации (месторасположения)"""
class Meta:
verbose_name = 'Локацию'
verbose_name_plural = 'Локации'
country = models.CharField(verbose_name='страна', max_length=32)
region = models.CharField(verbose_name='регион', m... |
a2e4639ce0f725b0dd88f73f015584062aff28df | c0e760c9fd249fd7bf9c84c849963c0df9c61c6c | matt-j-harvey/Widefield_Analysis | /build/lib/Trial_Aligned_Analysis/Select_Custom_ROI_Aligned_Across_Mice.py | Python | py | 6,750 | no_license | import numpy as np
import matplotlib.pyplot as plt
import os
import cv2
from matplotlib.path import Path
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import pyqtgraph
from scipy import ndimage
import os
import sys
from tqdm import tqdm
from Widefield_Utils import widefield_util... |
9362885412adf59ce21c700af8782c9cb9058b53 | ea395f573a024d0479d6d5b813b402467c63248c | esdvFootloose/FootlooseStudents | /FootlooseStudents/settings.py | Python | py | 5,184 | no_license | """
Django settings for FootlooseStudents project.
Generated by 'django-admin startproject' using Django 2.1.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
impo... |
e8f99328adfd99ae6964bfb6b179f0fd0d55d676 | 2996321f7c3730572d949473d084a9bb49a73166 | shahrukhqasim/HGCalML | /modules/GravNetLayersRagged.py | Python | py | 125,410 | permissive | import tensorflow as tf
import pdb
import yaml
import os
from select_knn_op import SelectKnn
from slicing_knn_op import SlicingKnn
from binned_select_knn_op import BinnedSelectKnn
from select_mod_knn_op import SelectModKnn
from accknn_op import AccumulateKnn, AccumulateLinKnn
from local_cluster_op import LocalCluster
f... |
cf6689c701d9a6ec0c8a2cbb26b4d9ebf7e501f1 | d24c33a7752c886c15907a9d8c5921ce3abef738 | basnijholt/home-assistant | /homeassistant/components/coronavirus/sensor.py | Python | py | 2,710 | permissive | """Sensor platform for the Corona virus."""
from homeassistant.const import ATTR_ATTRIBUTION
from homeassistant.helpers.entity import Entity
from . import get_coordinator
from .const import ATTRIBUTION, OPTION_WORLDWIDE
SENSORS = {
"confirmed": "mdi:emoticon-neutral-outline",
"current": "mdi:emoticon-sad-outl... |
90b94138e65067b631928f77dbdbecaf0678100f | 10a731eac95d7de8ef25ea8db92a1cad03e13b6f | jiankangren/Projects | /GPUTimingAnalysis/src/ParseCFGs.py | Python | py | 6,624 | no_license | import shlex
import CFGs, Debug
vertexID = 0
PCPrefix = "PC=0x"
braOP = "bra"
callOP = "call"
callpOP = "callp"
retOP = "ret"
retpOP = "retp"
exitOP = "exit"
breakOP = "break"
predicated = "@%p"
def getAddress (string):
return int(string[len("PC="):], 0)
def getBasicBloc... |
344a89e71cc5c898cafd934a30a57aeecb723386 | 24964f9492cf5b4771fbc09a8db7f30b1426b1f9 | crflynn/dephell | /dephell/commands/package_downloads.py | Python | py | 1,188 | permissive | # built-in
from argparse import ArgumentParser
# external
from packaging.utils import canonicalize_name
# app
from ..actions import get_downloads_by_category, get_total_downloads, make_json
from ..config import builders
from .base import BaseCommand
class PackageDownloadsCommand(BaseCommand):
"""Show downloads ... |
814cc5bf63d7fbb6d2c5a59d00f6a5a7fc5aa60c | e6571fe7146a1ab0e76196733080e4810fef08b3 | MinbinGong/OpenStack-Ocata | /python-senlinclient-1.2.0/senlinclient/tests/unit/v1/test_profile.py | Python | py | 17,447 | permissive | # 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 agreed to in writing, software
# distributed unde... |
12f14765dd499b9d8ac8589366e6ce35cff39ef1 | bd167d6fc15d0f946ca6b8b211eefba1090a1967 | KristenBrandt/Lab3_Redes | /dinamic_client.py | Python | py | 9,577 | no_license | #Oliver Graf 17190
# Kristen Brandt 171482
import asyncio
import logging
import uuid
import time
import networkx as nx
import sys
import aiodns
import asyncio
if sys.platform == 'win32' and sys.version_info >= (3, 8):
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
from slixmpp import Cl... |
422f1c067dac240e951baf4d61fd2cedd1052287 | c51d345324df0a1bb4db71024ab32ffbd18db233 | FabioAyresInsper/Pesquisas | /common_nlp/topicModelling.py | Python | py | 794 | permissive | from textNormalization import textNormalization
from gensim import corpora, models
class topicModel(textNormalization):
"""Creates topic models for normalized texts"""
def __init__(self):
super(topicModel, self).__init__()
def dicionario_corpora(self,textos):
return corpora.Dictionary(textos)
def lda_Model... |
fca3949d1925eefaf83646ca6759958bdc088aec | 16d32d244db3385a4880da7327aa5d064ffa45fe | misterme00/aws-boto3 | /main.py | Python | py | 1,492 | no_license | import boto3
import datetime
import json
cloudtrail = boto3.client('cloudtrail')
#ec2 = boto3.resource('ec2')
ec2 = boto3.resource('ec2')
#iid = 'i-0fecd1ee86f6aa449'
iid = 'i-0d63b207e435dc1b2'
instance = ec2.Instance(iid)
print(instance.launch_time)
#id = instance.instance
#endtime = datetime.datetime.now()
#end... |
ad76da84eff66c1c40c7b9d7dccb6cab22d5b796 | 9d67d9042dde64348fd60f7900fb2064ae262fde | caitaozhan/LeetCode | /graph/773.sliding-puzzle.py | Python | py | 3,822 | no_license | #
# @lc app=leetcode id=773 lang=python3
#
# [773] Sliding Puzzle
#
# https://leetcode.com/problems/sliding-puzzle/description/
#
# algorithms
# Hard (58.68%)
# Likes: 659
# Dislikes: 22
# Total Accepted: 37.4K
# Total Submissions: 63.6K
# Testcase Example: '[[1,2,3],[4,0,5]]'
#
# On a 2x3 board, there are 5 til... |
9dd8d8ea1cb83bd1351d09c6dfe9f7fc53fb9613 | c6c4b693565d2af80704fd91e6d44a0849390410 | yaominzh/CodeLrn2019 | /mooc43-bobo-algo/pythonEdition/7/广度优先遍历求最短路径.py | Python | py | 1,612 | permissive | # -*- coding: utf-8 -*-
from repo import SparseGraph,buildGraphFromFile,Queue
class ShortestPath(object):
def __init__(self,aGraph,start):
self.graph=aGraph
self.startVertex=aGraph.vertDict[start]
self.calc()
def calc(self):
self.startVertex.setDistance(0)
self.startVer... |
aa0f721893687a75d7ac282a061b2da0975db521 | 52574f16a0259ce14169171acdca365382e9ec3f | kangyifei/intel-minicloud | /Server/image/cal.py | Python | py | 1,181 | no_license | from DataProcesser import DataProcesser
import numpy as np
import time
# 字符串转矩阵,如'1 2;3 4',转为[[1,2],[3,4]]
def str2mat(istr):
# 通过;将字符串分割
rows = istr.split(';')
# 通过空格分割每行,转化为二维列表
mat = [row.split(' ') for row in rows]
# 字符转数字
mat = [[int(ele) for ele in row] for row in mat]
# 转化为np矩阵
r... |
d05ab5b3cb4c6ca6d97f1013ce891242cd0d852f | 57dd875e65922e63b57e421b94bd326bbae4d05b | thinkAmi-sandbox/Django_form_preview_sample | /myapp/models.py | Python | py | 460 | permissive | from django.db import models
class Category(models.Model):
name = models.CharField('category', max_length=255)
# 表示した時に
# Category object
# のようになるのを防ぐため、__str__を定義
def __str__(self):
return self.name
class Article(models.Model):
title = models.CharField('title', max_length=255)
... |
ed91bcd0c5c209080db9365135b8cb3b01a15f30 | 77c1ae45f821476defec0f645f3e2d794ce4bf7c | aditisjoshi/SoftDesSp15 | /text_mining/text_mining.py | Python | py | 4,165 | permissive | """
text-mining
Aditi Joshi
Software Design Spring 2015
goal of the project: to find comments from ratemyprofessors.com and parse through them to find words used most often between genders
"""
from pattern.web import *
from pattern.en import *
from bs4 import BeautifulSoup as BS
import random
from genderPredictor im... |
fbf137a728510ef07fbdfd57f468f7b298fb0eee | 6fe2cbe183edbe244392f8b33349051e4f9576bc | sithu/grader | /app.py | Python | py | 10,388 | no_license | import sys
import uuid
import re
import unirest
import pickledb
import time
import rules
import json
from bottle import route, run, get, post, static_file, request, response, default_app, auth_basic
from constants import SUBMISSIONS
from paste import httpserver
db = pickledb.load('cmpe273-spring15.db', False)
global_m... |
e36fd8335c86af77916778b22890a7c9548b66e5 | 9dfdb14b3a7693f294a8d29db5285b78fbac3de3 | MarcusMendes81/Python | /Ex062 - Super progressão aritmetica.py | Python | py | 526 | permissive | print('='*10, 'Gerando uma PA', '='*10)
primeiro = int(input('Digite o primeiro termo: '))
razao = int(input('Digite o valor da razão: '))
cont = 1
termo = primeiro
total = 0
mais = 10
while mais != 0:
total = total + mais
while cont <= total:
print(' {} -> '.format(termo), end='')
te... |
81810285d44b5ff5d83a116b3f77970a83bed15e | 7ceee7f612d5037be5e6348ce19a46ba207e4002 | mdizhar3103/Python-Design-Patterns | /Observer-Pattern/main.py | Python | py | 384 | no_license | from currentKpiObserver import CurrentKPIs
from forecastKpiObserver import ForecastKPIs
from kpisubject import KPIs
kpis = KPIs()
currentKPIs = CurrentKPIs(kpis)
forecastKPIs = ForecastKPIs(kpis)
kpis.set_kpis(25, 10, 5)
kpis.set_kpis(100, 50, 30)
kpis.set_kpis(50, 10, 20)
print("\n Detaching the current KPIS obser... |
f6f3e3ac89a4f5fdbbda29fe16f00c768d3c63d0 | 7510cf062dfb4bc0dcc630cca5b45acde075d2b2 | ncst-robot/bigger | /source/conf.py | Python | py | 4,577 | no_license | # -*- coding: utf-8 -*-
#
# python3-cookbook documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 19 03:21:45 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fi... |
d76e5cc85f3a5cef8787766deaf4e81d66a5768e | b12799d5785e306e07eb188b6b54919790ed5704 | himanmenGit/educast_django_askcompany | /askcompany/urls.py | Python | py | 1,583 | no_license | """askcompany URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-ba... |
4e301d21291eb8d446e8189fc13fa612dec4615c | 457636886cc545e9789758b466b48b7418ec7fc1 | dwtcourses/ReAgent | /reagent/training/ranking/seq2slate_trainer.py | Python | py | 6,551 | permissive | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import logging
from typing import Optional
import numpy as np
import reagent.types as rlt
import torch
from reagent.models.seq2slate import BaselineNet, Seq2SlateMode, Seq2SlateTransformerNet
from reagent.parameters import S... |
83120a61dce32c0d0f93ca865fe4d8cdc555a01d | 9782f23080b786014552b708876370e6ababdd8d | flos-mortis/recipe-book | /recipebook1/recipebook/asgi.py | Python | py | 397 | no_license | """
ASGI config for recipebook project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SE... |
d539dac056b696d11782d55699794d184652db80 | 2b1cc18d0ce9c81d80720a071d9c96e576a53ae6 | mikelambert/dancedeets-monorepo | /server/dancedeets/login_admin.py | Python | py | 1,006 | no_license | import IPy
import logging
def _check_for_builtin(environ):
return ('HTTP_X_APPENGINE_QUEUENAME' in environ or 'HTTP_X_APPENGINE_CRON' in environ or False)
_no_admin = lambda x: False
def authorize_middleware(app, check_env_for_admin=_no_admin):
def wsgi_app(environ, start_response):
# deferred.py ... |
a0fc4f77ef62e33bfc70e2032d94693b7710cb38 | 01a33ddf7434cc42a90a8816b028e466adcb993a | sumeetgajjar/CS6140-ML | /src/HW_8/demo_dual_perceptron.py | Python | py | 2,086 | no_license | import numpy as np
from sklearn.metrics import accuracy_score
from HW_8 import utils
from HW_8.dual_perceptron import DualPerceptron
from HW_8.knn import SimilarityMeasures
def demo_perceptron():
print("+" * 40, "Dual Perceptron demo on normal perceptron data", "+" * 40)
data = utils.get_perceptron_data()
... |
fdf2bdface3cc58ebe22aaef59f2246cb6319ab2 | 1b3d51c900b9ed57ba29e0716bd70116ce27cca6 | abyssmu/Python-Climate-Project | /dataRequest.py | Python | py | 2,365 | permissive | import createGraph
import pandas as pd
import requests
token = 'XQaHgOfNlBGkEDhohjTElRwVcMwmbjIc'
url = 'https://www.ncdc.noaa.gov/cdo-web/api/v2/data'
datasetid = 'datasetid=GHCND'
limit = 'limit=1000'
units = 'units=metric'
offset = 'offset=0'
def buildURL(startdate, enddate, station, datatype):
u = url + '?' +... |
4c204b95994ba6dc8df30288fa8d3688019daa1d | 1bce5d54f144d38eecec91d5563b0a48397f9f87 | zjdznl/turtlebot_follow_line | /version3/canny_center.py | Python | py | 3,368 | permissive | # coding=utf-8
import cv2
import numpy as np
from matplotlib import pyplot as plt
from util import *
import copy
kernel = np.ones((5, 5), np.uint8)
def show_edge(image='origin/origin127.jpg'):
print "current image: {}".format(image)
img = cv2.imread(image)
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
... |
5537a280d7c3d97e01aee09f5b20f27ee499e4be | 0112ddbc1006c4907d6d8244ddb72f5d62f9ea6e | xsurfer/django_jenkins_test | /django_jenkins_test/urls.py | Python | py | 769 | no_license | """django_jenkins_test URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home... |
688a705ef9426ec632ba834e03b593c8ee976cf7 | e2986eaabb8d0e93e90b6c727a5f4c65fd09bd19 | mjmcandrew/Coursera_2020 | /Bioinformatics1_Spring2020/Func_FasterFrequentWordsWithMismatches.py | Python | py | 5,211 | no_license | def FasterFrequentWordsWithMismatches(Text, k, d):
#This algorithm improves upon the standard FasterFrequentWordsWithMismatches
#by first computing a frequency array of frequent words.
words = []
#Initializes empty list 'words'.
freq = ComputingFrequenciesWithMismatches(Text, k, d)
#Calculates f... |
74e8252a352a1fb25abd5d46ae2f134a00c27be7 | ae32548bcdf604cfce17083721909f6e734986b0 | chaoyinlung/vnpy | /vnpy/trader/database/database_sql.py | Python | py | 15,104 | permissive | """"""
from datetime import datetime
from typing import List, Dict, Optional, Sequence, Type
from peewee import (
AutoField,
CharField,
Database,
DateTimeField,
FloatField,
Model,
MySQLDatabase,
PostgresqlDatabase,
SqliteDatabase,
chunked,
)
from vnpy.trader.constant import Exc... |
2a9bca3deaa4f245f68375ed9a214687ee69a276 | ae2909a9e8f99963bca0b1a7a852c84d5803d8c3 | eijiuema/sd | /atividade_1/atividade1.py | Python | py | 4,000 | no_license | import sys
import time
import socket
import struct
import random
import threading
PROCCESS_N = 3 # Número total de processos
ID = int(sys.argv[1]) # Identificador do processo
MULTICAST_GROUP = '224.3.29.71' # IP do grupo de Multicast
SERVER_ADDRESS = ('', 10000+ID) # IP e porta que o processo vai ouvir
print('Startin... |
514df1305af77ee7b653a566adae96bdcb3cbb0a | 1b343686c1d1a002d8b04295bdf6ceafa22550ca | farhananwari07/flask-image-processing | /venv/Lib/site-packages/networkx/generators/mycielski.py | Python | py | 3,253 | permissive | """Functions related to the Mycielski Operation and the Mycielskian family
of graphs.
"""
import networkx as nx
from networkx.utils import not_implemented_for
__all__ = ["mycielskian", "mycielski_graph"]
@not_implemented_for("directed")
@not_implemented_for("multigraph")
def mycielskian(G, iterations=1):
r"""R... |
189d183456dfb6309e677a76cd90923fbd3511b9 | b771a8ed1004ef0984c881fd54ea28bcde4f3795 | Mugao/TOH_rpg | /TOH RPG/Game.py | Python | py | 793 | no_license | import pygame
WIDTH, HEIGHT = 900, 500
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
FPS = 60
#Azura
class stats:
def set_stats(self, base_atk, base_defe, base_sp_atk, base_sp_defe, base_spe, base_hp, lvl):
atk = 2 * base_atk * lvl // 100 + lvl + 10
defe = 2 * base_defe * lvl // 100 + lvl + 10
... |
591f7bc6600521aae6edf4140bd6ac5a8cf593e7 | 1f279b18390efcd678fdee5a6e151e6253061d1b | Bingsuya/crud | /September9-master/September9-master/user/views.py | Python | py | 2,304 | no_license | from django.shortcuts import render, redirect
from .models import Ouruser
from django.contrib import auth
from django.http import HttpResponse
from django.contrib.auth.hashers import make_password, check_password # 자동 암호화, 비밀번호 체크 기능
from .forms import LoginForm
def home(request):
return render(request, 'home.html... |
2bf724c184577a03c579ae1d66d2bb90b824a63a | 0351691aebc7cda97e14856c85b1e064f4759319 | aslafy-z/pytest-ansible | /pytest_ansible/module_dispatcher/v1.py | Python | py | 3,096 | permissive | import warnings
import ansible
import ansible.constants
import ansible.utils
import ansible.errors
from ansible.runner import Runner
from pytest_ansible.module_dispatcher import BaseModuleDispatcher
from pytest_ansible.errors import AnsibleConnectionFailure
from pytest_ansible.results import AdHocResult
from pytest_an... |
d30eb7fc7a76e67639294f2c3e09b16c4a6c3e41 | a1478661044efffe8875c7b915ac14c7b8d6b5d4 | abhishekreddy1206/django-report-builder | /setup.py | Python | py | 1,055 | permissive | from setuptools import setup, find_packages
setup(
name = "django-report-builder",
version = "3.1.9",
author = "David Burke",
author_email = "david@burkesoftware.com",
description = ("Query and Report builder for Django ORM"),
license = "BSD",
keywords = "django report",
url = "https://... |
ce194ca192d51d8c87ffe98755d13902922ee0c5 | d9261814b96dbf6c0d326d81db221cf364cdc0e1 | garabek/Django_OnlineShoppingWebsite | /bin/pilfile.py | Python | py | 2,526 | no_license | #!/Users/Bekif/Desktop/ecommerce-1/bin/python
#
# The Python Imaging Library.
# $Id$
#
# a utility to identify image files
#
# this script identifies image files, extracting size and
# pixel mode information for known file formats. Note that
# you don't need the PIL C extension to use this module.
#
# History:
# 0.0 1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.