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 |
|---|---|---|---|---|---|---|---|---|
4085a3cbeb53758fbc018c2bb3794c54b6e5443b | 8b0ec3c06d4df9b994e9b465df6becfaa81f0367 | JohnPaton/local-library | /catalog/tests/test_views.py | Python | py | 15,485 | no_license | import uuid
import datetime
from django.test import TestCase
from django.urls import reverse
from django.utils import timezone
from django.contrib.auth.models import User, Permission
from catalog.models import Author, BookInstance, Book, Genre, Language
class AuthorListViewTest(TestCase):
@classmethod
def s... |
9f653773cb21736de2bc0ee3d1d49f77eb9140cc | 71d9c2da8a32b040ca5d26910a2e1fd030fc2f5d | avidLearnerInProgress/cf-octo-journey | /old_attempts/1038a.py | Python | py | 395 | no_license | from collections import Counter
def equality(s, n, k):
if s is None: return 0
unq= set(s)
if len(unq) != k:
return 0
vl = list(Counter(s).values())
minCount = min(vl)
for i in range(k):
minCount = min(vl[i], minCount)
minCount *= k
return minCount
n, k = map(in... |
1baf63e43a0a31373d9e67349c0b122cff93002d | 84f4713a993bc1c63f6dc1b42b0bdc5947f425fb | ZhengYi0310/pygp_yi | /inference/_base.py | Python | py | 8,686 | no_license | """
Interface for latent function inference in Gaussian process models. These
models will assume that the hyperparameters are fixed and any optimization
and/or sampling of these parameters will be left to a higher-level wrapper.
"""
# future imports
from __future__ import division
from __future__ import absolute_impor... |
6aa8ce8691b0b908a3b808dbaade1b4307686230 | 086af2c0439da53f32f4689184bdc953093e8868 | strategist922/linkedspatialindex | /lsi/index.py | Python | py | 10,350 | permissive | #
# Copyright 2012 Talis Systems 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 ... |
a786ed087b4872e9e8191f761e207ffcd51f963d | 352142dc5d2b4007dd792e3a8f9579e8704630c4 | TorrentofShame/hackathon-2021-backend | /src/common/init_defaults.py | Python | py | 984 | permissive | # -*- coding: utf-8 -*-
"""
src.common.init_defaults
~~~~~~~~~~~~~~~~~~~~~~~~
Functions:
init_default_users()
"""
from src.models.user import User
from mongoengine.errors import NotUniqueError
def init_default_users():
"""Initializes the default users"""
from flask import current_app as ... |
a5e072983d224bc9eed8a4f413a61802419efd00 | 7ead874d709690c282f57f379f9f8be29c0a97d1 | pcrews/reddwarf_lite | /reddwarf/tests/fakes/common.py | Python | py | 1,252 | no_license | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 OpenStack LLC.
# 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.apach... |
2f939e25ffa81b45bab9b9d09381cff0248fa1db | e2677439cb695e74073f62675f35422a0327e342 | OpenSlides/openslides-backend | /openslides_backend/action/actions/projector_countdown/update.py | Python | py | 1,754 | permissive | from typing import Any, Dict
from ....models.models import ProjectorCountdown
from ....permissions.permissions import Permissions
from ....shared.exceptions import ActionException
from ....shared.filters import And, FilterOperator, Not
from ....shared.patterns import fqid_from_collection_and_id
from ...generics.update... |
9552dc3753e50c177d2e81657fb70aca1c0bd03c | 665e74886d0811b26300a072798c384eb17213f8 | voron3x/sentry | /src/sentry/web/decorators.py | Python | py | 6,490 | permissive | from functools import wraps
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import get_object_or_404
from sentry.conf import settings
from sentry.models import Project, Team, Group
from sentry.web.helpers import get_project_list, render_to_r... |
985697884d127fd02b006a3fde4d1cb15ad4b785 | 8565bb2d1d6653c5a746d5657184a5da99d1e12c | Shimenrock/shimenrock.github.io | /_pentesting/weblogicScanner/stars/console.py | Python | py | 1,095 | permissive | #!/usr/bin/env python3
# _*_ coding:utf-8 _*_
# Weblogic Console
# updated 2019/10/23
# by 0xn0ne
import sys
from stars import Star, universe, target_type
from utils import http
headers = {'User-Agent': 'TestUA/1.0'}
@universe.groups()
class WeblogicConsole(Star):
info = {
'NAME': 'Web... |
346c1440caed32c136cd493fa318dcf447a436ad | b40558c4048e0b27b40af7b2a1f6eaab7a1ce1b8 | kathyk90/my-first-blog | /polls/migrations/0001_initial.py | Python | py | 3,466 | no_license | # Generated by Django 3.0.6 on 2020-08-15 21:51
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Code',
fields=[
... |
98709efaa6a8589b5d300d3f1cee0db369dc581b | 315479999a376faaf2f365196523a5dac8e72181 | lyzpokemon/Biu | /Biu/urls.py | Python | py | 615 | no_license | from django.conf.urls import patterns, include, url
from django.contrib import admin
from biuser import views as views
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'Biu.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^register... |
6b2be6a28b7b96d1e818864a482c67c5a5d93466 | 4394f20ef0bc50ddf717ac20629e8c55e310bd54 | nata502ly/test_project | /pulse_api_roles.py | Python | py | 473 | no_license | import requests
class PulseRestApi:
def __init__(self):
self.host = "pulse-rest-testing.herokuapp.com"
self.base_url = "http://{}/".format(self.host)
def create_object(self,obj):
url = self.base_url + obj.url + "/"
response = requests.post(url, data = obj.get_dict())
... |
01ed40bf7fa43e9952ef16bd9edde405ac7b1c63 | c905afee08393f2161f136f248f34a1f76f6b4b3 | jdhaagenson/cowsay | /cows/models.py | Python | py | 211 | no_license | from django.db import models
# Create your models here.
class Recent(models.Model):
text = models.CharField(max_length=80)
output = models.TextField()
def __str__(self):
return self.text
|
88d825f99313395dd57e3f179ca35f28e677b4f4 | 25ce3a358d84022b096e29365f4108ea18aa3e3f | LaunchKey/splinter | /tests/iframes.py | Python | py | 597 | permissive | # -*- coding: utf-8 -*-
# Copyright 2012 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
class IFrameElementsTest(object):
def test_can_work_on_iframes(self):
"""can work on iframes and switch back to the page"""... |
b923288ca8c18b9c5990ef6ccf72f9eb05dbca16 | 6aaefc7b19477640a50f06ceb62de77ba9e9ac5f | slavking/python_training | /temp.py | Python | py | 263 | no_license | class Node1:
def __init__(self,x):
self.x=x
class Node2(Node1):
def __init__(self):
while self is not None:
yield self.x
from string import ascii_lowercase
def returner(x):
return True if x in ascii_lowercase else False
|
6e3e664ccabc367626644e16649866d969821382 | f2845e6855885fe49daa7ef68b33a375281cab4c | rongxz/JDBuy | /jd.py | Python | py | 26,162 | no_license | # -*- coding: utf-8 -*-
"""
JD online shopping helper tool
-----------------------------------------------------
only support to login by QR code,
username / password is not working now.
"""
import bs4
import requests, requests.utils, pickle
import requests.packages.urllib3
requests.packages.urllib3.disable_warnings... |
4bffb72dcd82c90f2eedad7ac5fae7e7035ae86b | e5754e1d15c119dfdcf5591072c50fc21309c647 | Coni63/CG_repo | /training/easy/chuck-norris.py | Python | py | 470 | no_license | import sys
import math
from itertools import groupby
message = input()
print("message : ", message, file=sys.stderr)
binary_code = "".join(format(ord(x), 'b').zfill(7) for x in message)
print("code : ", binary_code, file=sys.stderr)
res = []
for k, g in groupby(binary_code):
if k == "0":
res.append("00"... |
86ecd65350beea8a1c0d6143c753ff628aab71eb | 30822519091f55749dbed0de5cdbe64160eafb6e | gdassori/bitcoincrawler | /test/test_bitcoin_scanner.py | Python | py | 4,080 | no_license | from unittest import TestCase
from unittest.mock import Mock, call
from bitcoincrawler.bitcoin_scanner import BitcoinScanner
__author__ = 'mirko'
class TestBitcoinScanner(TestCase):
def test_block_listener(self):
block1 = Mock()
block2 = Mock()
block3 = Mock()
blocks = [block1, bl... |
3c44402bc03c744ad33ed27a06d798e249f5ae27 | 2a3ed49aee199243665294fb0f7233d6ed458a3f | Omicron02/Ciphers | /src/ciphers.py | Python | py | 6,358 | no_license | import argparse
parser=argparse.ArgumentParser(description="Implement 5 ciphers")
group=parser.add_mutually_exclusive_group()
group.add_argument("-c","--caesar",metavar="caesar",type=str,nargs=2,help="\nPerform\
caesar cipher operation on given string.\nUsage: zdciph -c <string> <value to rotate by>")
group.add_argu... |
ad1df17c49b8c9879a33e7b0b1dcbfba04288945 | db1d568e0aed9ae150faa05c4ebf00e43a4b2106 | Echtll/DeltaGrad | /src/Benchmark_experiments_add/incremental_updates_provenance5.py | Python | py | 29,595 | no_license | '''
Created on Mar 15, 2019
'''
'''
Created on Mar 15, 2019
'''
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))+'/data_IO')
# print(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspat... |
7e2b33f4ce8226768cde7b3210b767ef86f7c3f2 | f82ab166b8890a05bb6fa7205161fc6a789ea793 | slsp8752/DMNS-photogrammetry | /organize_photos.py | Python | py | 2,089 | permissive | #http://stackoverflow.com/questions/23064549/get-date-and-time-when-photo-was-taken-from-exif-data-using-pil
import os
from PIL import Image
from Tkinter import Tk
from tkFileDialog import askopenfilename
from tkFileDialog import askdirectory
def get_date_taken(path):
return Image.open(path)._getexif()[36867]
def ... |
a33e4179b07e9e77ef56d8524e035d0810961739 | ec0d4b42e4ac11c3e3009de41c4e7e4f8f9a7db9 | murabo/project | /cocolink/cocolink/views.py | Python | py | 553 | no_license | # encoding:utf-8
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.views.decorators.csrf import csrf_protect
def index_view(request):
# del request.session["login"]
return render_to_response("dummy.html",)
def sign_in_view(request):
return render_to_re... |
80bed68cf41995de7127b489b7b1d310a0b3209c | 8e9db00d1abda7c9725bf019242c152f5b284d7b | BoTranVan/octavia | /octavia/policies/usage.py | Python | py | 1,360 | permissive | # Copyright 2018 GoDaddy
#
# 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 ... |
39256eeb00a94082578cfe197ff7a8cbae60d9aa | e41a710986923303fe474023e8a2f7aa27845067 | eoantunes/AlocacaoDeAntenas | /ProjetoDjango/mapa/views.py | Python | py | 494 | no_license | from django.shortcuts import render, get_object_or_404
from mapa.models import PtAntena, PtDemanda
import folium
brasil = folium.Map(
tiles='Stamen Terrain',
location=[-15.796401, -47.874189],
zoom_start=14
)
brasil.add_child(folium.ClickForMarker(popup='PtDemanda'))
brasil = brasil._repr_html_()... |
653c2a625e14d73b1f4119031479e5d5d10c8a98 | 37d0c408a548006a684546a96e719c4424b39f4f | abhmul/LeafClassification | /src/train.py | Python | py | 2,657 | no_license | from __future__ import print_function
import os
import numpy as np
import pandas as pd
## Keras Libraries for Neural Networks
from keras.models import load_model
from keras.utils.np_utils import to_categorical
from keras.callbacks import ModelCheckpoint
import leaf99
from keras_utils import ImageDataGenerator2
f... |
c86f8a367285340e9139662d0b779d38c9f59476 | 760192abb66973b30225a35887b891b8554993d1 | developer-Wonjun/python-newbie | /성적 평균 계산기.py | Python | py | 419 | no_license | lst = []
value = 0
studeonts = int(input("학생수를 입력하세요. :"))
for i in range(studeonts):
num = int(input("성적을 입력하시오 :"))
lst.append(num)
for j in lst:
value = value + j
m = 0
for k in range(len(lst)):
if lst[k] >= 80:
m += 1
print("성적 평균은 {0}입니다.".format(value/studeonts))
print("80점을 넘기는 학생 수는... |
05e6a82fe87c25ea3eab8de8c0c42c6ba1325646 | d8ca836161476aa567976f1d057b033ed3796149 | odoo258/project_salon | /addons/enterprise/account_taxcloud/models/taxcloud_request.py | Python | py | 3,540 | no_license | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import suds
from suds.client import Client
from urllib2 import URLError
from odoo import modules
_logger = logging.getLogger(__name__)
class TaxCloudRequest(object):
""" Low-level object intended ... |
00d14ed1fe22f763eff1d333d458df8dd35f4067 | 29903b613aa1e74dcc84498df10ca6c67c818c88 | sawich/havok-reflection | /havok_classes/hkpBreakableMaterial.py | Python | py | 839 | permissive | from .hkReferencedObject import hkReferencedObject
import struct
from .hkRefCountedProperties import hkRefCountedProperties
class hkpBreakableMaterial(hkReferencedObject):
strength: float
typeAndFlags: int
properties: any
def __init__(self, infile):
self.strength = struct.unpack('>f', infile.... |
d94055ade15e01ba4137642260bfc0cf480e6147 | a1c214f3136cafd08708c02129fd612398ed0567 | fuodorov/yalenta | /yalenta/posts/tests/test_paginator.py | Python | py | 790 | no_license | from django.test import Client, TestCase
from .constants import POST_TITLE, POST_TEXT, INDEX_URL
from ..models import Post, SiteSettings
class PaginatorTests(TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.guest = Client()
cls.per_page = int(SiteSettings.objects.... |
f1e6bd445ea27f2ad04c3e32b8e44bbc58e7a2a2 | a7b8978412db71d8cf2df38be2a0a27fbd21ee9f | qyx1996/JianZhiOffer | /JZ23. 二叉搜索树的后序遍历序列.py | Python | py | 737 | no_license | # 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。
# 如果是则返回true,否则返回false。假设输入的数组的任意两个数字都互不相同。
class Solution:
def VerifySquenceOfBST(self, sequence):
if not sequence: return False
return self.helper(sequence)
def helper(self, sequence):
if len(sequence) <= 1:
return True
root = s... |
c74217121f6a043f0dbede3b0ee2564426b3e37b | c18f698ea599d24d6c491ae904c35ab6d80f6cf2 | Outsiders-inc/Engineering-Project | /experiments_scripts_and_res/Statistics.py | Python | py | 9,934 | no_license | import os
import argparse
from argparse import RawDescriptionHelpFormatter
from unittest.mock import _MockIter
_F_by_sent = []
_recall_by_sent = []
_precision__by_sent = []
_total_recall = 0
_total_precision = 0
_total_F_measure = 0
# CRF+ result-file locations:
GOLD_STANDARD_TAG = -2
OUR_CRF_TAG = -1
... |
9eddaf2b15665fc1d817c3aa449587e058307cf8 | 6421e4db060221ae89e7ba3fc8a2d7064cb25b9f | akesiraju/raspberrypi | /sensors/led.py | Python | py | 483 | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
def dance(pin, speed):
GPIO.setup(pin,GPIO.OUT)
print ("pin", pin, "on")
GPIO.output(pin,GPIO.HIGH)
time.sleep(1/speed)
print ("pin", pin, "off")
GPIO.output(pin,... |
c2bfdf9008499aaa7e5d3fa8d44fbc4182af317e | e53193f7a46843dd04ef293164849d62d3e28b17 | darvin/django-table-export-import | /setup.py | Python | py | 963 | no_license | import os
from setuptools import setup, find_packages
from django_table_export_import import VERSION
f = open(os.path.join(os.path.dirname(__file__), 'README'))
readme = f.read()
f.close()
setup(
name='django-table-export-import ',
version=".".join(map(str, VERSION)),
description='django-table-export-im... |
96692773f9474c089fbde6bf88b76d0ef33deefc | 59edeb000fd18da8a039d348dc5a96c3a708ba45 | lavisingla/transport-auction | /project/customer/migrations/0001_initial.py | Python | py | 3,468 | no_license | # Generated by Django 2.1.5 on 2019-06-19 06:06
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='item_info',
fields=[
('id', models.AutoFiel... |
30c611daa9d3740b3ba6bca75fbb33935dcece18 | 383104ebd27fcc026b9c501b65a2687ea7d33239 | bdvllrs/recvis-project-3d-pose | /preprocess_surreal.py | Python | py | 2,071 | permissive | import os
import h5py
from utils import Config
from utils.data import SurrealDataset, heatmat_to_2d_joints
from models import StackedHourGlass
import torch
import numpy as np
from tqdm import tqdm
config = Config('config/')
device_type = "cuda" if torch.cuda.is_available() and config.device_type == "cuda" else "cpu"
... |
4c68e2db8cd9d4275f5d41752c4477c18c92fcb6 | fd24e5706f77fe009a533c96da86bada0dc990d9 | Aminaba123/LeetCode | /065 Plus One.py | Python | py | 1,414 | permissive | """
Given a non-negative number represented as an array of digits, plus one to the number.
The digits are stored such that the most significant digit is at the head of the list.
"""
__author__ = 'Danyang'
class Solution(object):
def plusOne(self, digits):
"""
Math
Basics of ... |
acd7a9b2c68d17e6cd6e1e3019162372acd2bf77 | 112e08d36ce9db5deaeba23a0db43d706210469d | Codificador/contests | /uri/strings/1024_Criptografia/main.py | Python | py | 369 | no_license | import string
n = int(input())
while n > 0:
str = input()
nstr = ""
for ch in str:
if ch in string.ascii_letters:
nstr += chr(ord(ch) + 3)
else:
nstr += ch
nstr = nstr[::-1]
nnstr = ""
for ch in nstr[len(nstr) // 2:]:
nnstr += chr(ord(ch) - 1)
... |
a0c823960346e425e58b5e0a376a5a40385bce78 | 9d12f56a1961889519ae0a93a9d69218a2baa893 | AditShah/IT562_Pro_DA-IICT | /Assignment 5/201501128/KNNBasic.py | Python | py | 3,974 | no_license | import numpy as np
import surprise # run 'pip install scikit-surprise' to install surprise
import os
import time
from guppy import hpy
from surprise import BaselineOnly
from surprise import Dataset
from surprise import Reader
from surprise.model_selection import cross_validate
import pandas as pd
class MatrixFacto(su... |
0f5d2b19e2b3ed7958b600ecdc0699e6f2c5b1cd | 3a801c72f3b0a9d3bfb692fbdce7b610c4695337 | pydap/pydap | /src/pydap/tests/test_responses_version.py | Python | py | 1,430 | permissive | """Test the version response."""
import unittest
from webtest import TestApp as App
from pydap.lib import __version__
from pydap.handlers.lib import BaseHandler
from pydap.tests.datasets import VerySimpleSequence
class TestVersionResponse(unittest.TestCase):
"""Simple tests for the version response.
Here... |
53fc87dde21726dd6ca4db99d8b99559a6ab3fef | c4d1d22e8c1c43a1cc2b0e88d88731e4ca0c2611 | niche007/IoTSecurityDevice | /Docs/Senior_Design_Spring_2017_Software/BeagleBone_Code/El_gamal.py | Python | py | 6,392 | no_license | #Thanks to wobine on github for ecc functions below.
#Link to file:
#https://github.com/wobine/blackboard101/blob/master/EllipticCurvesPart4-PrivateKeyToPublicKey.py
# Remember to use Python 2.7.6 or lower. You'll need to make changes for Python 3.
# Parameters below are recommended values obtained from standards... |
b15f0354ae989cfffed25134f712e76fd7698b2a | 40e6462841c7bf442302d3a7849470a3444afc0e | rraquel/ABM-crime-mobility-NYC | /offender/myLogger.py | Python | py | 900 | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import logging,os,time
dir_path = os.path.dirname(os.path.realpath(__file__))
# set up logging to file
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
... |
2291ed34f4d95d8deab110db82fea5c64322e20a | 7585728938f82bb81c0bd1eb8885f03a9e47171f | kaushikdayabar/project | /dsma.py | Python | py | 763 | no_license | def dsma():
from pandas_ods_reader import read_ods
from sklearn.metrics import mean_squared_error,mean_absolute_error
import numpy as np
df=read_ods("dataset1_part2.ods",1)
data=df["price"].values
x=[data[i] for i in range(1095)]
# simple moving average
r=[] #... |
e0b06215d5776dc38d0a49678a02aab87306625b | 420bde34fbc59e2028e6f6f7922cc813fa823960 | berquist/funsies | /src/funsies/_constants.py | Python | py | 1,173 | permissive | """Names of stuff in the key value store."""
from __future__ import annotations
# std
from enum import Enum
from os import PathLike
from typing import NewType, Union
JsonData = Union[str, int, float, bool, None, dict, list]
"""Can be converted to JSON."""
_Data = Union[bytes, JsonData]
"""All output data types."""
... |
4343fa4f9ef9cc081f6559fbb894221a0fb389d7 | 0db1c53726d695c25899a04f9dc1b02252491c5f | aiman-mumtaz/todo-django | /todo_list/models.py | Python | py | 235 | no_license | from django.db import models
class List(models.Model):
item = models.CharField(max_length=200)
completed = models.BooleanField(default=False)
def __str__(self):
return self.item + ' | ' + str(self.completed) |
b9b132a49dd784e31f464168d33e9802b6b0680f | 59b0b0cd825550defcd5649a6b9020a6ff22255e | theelk801/videoEditBot | /pathHelper.py | Python | py | 499 | no_license | from os import path
def getName(file):
return path.splitext(path.split(file)[1])[0]
def getExt(file):
return path.splitext(file)[1][1:]
def chExt(file, ext):
return f"{path.splitext(file)[0]}.{ext}"
def getDir(file):
return path.split(file)[0]
def chName(file, newName):
return f"{getDir(file)}/{new... |
98ec0a2c1a8b24174e4e0ee89d267ff2350211c0 | f4006ef3ea1e2d5f2469de1a63b64d0d4abe12c6 | BVH-ESL/MQTTProject | /REBORN/src/python/paho_pub.py | Python | py | 2,243 | no_license | #!/usr/bin/env python
import argparse
import sys, os, time, datetime
import paho.mqtt.client as mqtt
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
butPin = 17
GPIO.setup(butPin, GPIO.IN)
ap = argparse.ArgumentParser()
ap.add_argument(
"-rpid", "--rpid", default="1",
help="RPi Id for publish")
ap.add_argument... |
b1fbae6bcb7334046dc1e32858ebffad48ad1771 | 7dbd7174d60c6c181c403c903c71d06f5e09601c | weimingtom/ai20projects | /2018202096/src/scripts/SpeechRecognitionTello.py | Python | py | 4,483 | no_license | import pyaudio
import wave
from aip import AipSpeech
from playsound import playsound
import socket
import threading
import time
import sys
import re
import tellopy
APP_ID = '22828037' #新建AiPSpeech
API_KEY = '14HDtbjYr6ILvntBwy0c1TOh'
SECRET_KEY = 'XDEirKAF4E4kxzFpCoDgUDQ0ZLfPH5f9'
client = Ai... |
731bce22353367fc9fe5162d0f09430a40ceb466 | 3bef7a4335564f07d612dd005fe4566a89314572 | PlumpMath/bdropout | /maunaloa.py | Python | py | 591 | permissive | import numpy as np
import matplotlib.pyplot as plt
def load_mauna():
y = np.loadtxt("./maunaloa-co2/maunaloa_clean.txt", usecols=xrange(1,13), skiprows=1)[7:-1].flatten()
x = np.array(xrange(len(y)))
mx = np.mean(x)
stdx = np.std(x)
x = (x - mx)/stdx
m, c = np.linalg.lstsq(np.vstack([x, np.on... |
8a99cfc243a54884706d41f00392cd7129bebe41 | ebcf08bfc736a3067886f6627946a3d38dd22349 | RedFT/HexTiler | /hextiler/tile_selector.py | Python | py | 1,215 | permissive | import pygame as pg
import numpy as np
class TileSelector:
def __init__(self):
self.tilemap_img = None
self.tile_imgs = []
self.num_imgs = 0
self.current_tile_idx = 0
def load_tiles(self, filename, radius):
self.tilemap_img = pg.image.load(filename).convert_alpha()
... |
412dc791c5fd91c1dd4100dd9fc2ab5769dd2bb1 | dd49583f58ccfa3bc9bc429b3456d4b4fd51ebc2 | bruceplai/AIT-Core | /ait/core/bin/ait_create_dirs.py | Python | py | 6,695 | permissive | #!/usr/bin/env python
# Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT)
# Bespoke Link to Instruments and Small Satellites (BLISS)
#
# Copyright 2016, by the California Institute of Technology. ALL RIGHTS
# RESERVED. United States Government Sponsorship acknowledged. Any
# commercial use must... |
ccdc74adb32e7fbb647e6496e4a5737a1c6d9feb | b36558021c819cedd2e5b5ad1428ecac2df70620 | vedicvamsi/portfolio-project | /blog/views.py | Python | py | 374 | no_license | from django.shortcuts import render, get_object_or_404
from .models import Blog
# Create your views here.
def allblog(request):
blogs = Blog.objects
return render(request, 'blog/allblog.html', {'blogs': blogs})
def detail(request, blog_id):
detailblog = get_object_or_404(Blog, pk = blog_id )
return ren... |
58f1a6c9716f6cd0b8350568f8d55fc9e05a7c03 | 6fa43c43a7ca8b97c0ec925a3c07e214664888e0 | 13thProgression/lotus-blockchain | /lotus/full_node/full_node.py | Python | py | 100,874 | permissive | import asyncio
import dataclasses
import logging
import random
import time
import traceback
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
import aiosqlite
from blspy import AugSchemeMPL
import lotus.server.ws_connection as ws # lgtm [py/import-and-import-from]
fro... |
4b72642d54f10712dadac0972890812223b80a80 | 5736b325c5f2c24b736467f6fff4321714063c81 | Baysaakop/Zaal | /courts/migrations/0011_auto_20190612_1049.py | Python | py | 396 | no_license | # Generated by Django 2.1.2 on 2019-06-12 01:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('courts', '0010_court_created_at'),
]
operations = [
migrations.AlterField(
model_name='courtphoto',
name='uploaded_a... |
c4410eaf09ba20b02a82c4070b65e44e37c027f9 | 63fe6693185451e114d7c9f8499cd9928cf549d5 | KoushikKumar/WholeSaleBusinessLogistics | /inventory/logistics/migrations/0004_moneyreceivedinformation_remarks.py | Python | py | 440 | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('logistics', '0003_moneyreceivedinformation'),
]
operations = [
migrations.AddField(
model_name='moneyreceivedinf... |
9142448df9997f67823f048795b409dca65c090c | 150a6d93b99a39e853f7cef75f660ea60b902ce3 | hongxuanrui1999/SJTU-CS245 | /Prj4/Traditional/KMM/KMM.py | Python | py | 3,420 | no_license | # encoding=utf-8
import sys
sys.path.append('..')
from utils import dataloader, SVM, TSNE
import numpy as np
import sklearn.metrics
import matplotlib.pyplot as plt
from cvxopt import matrix, solvers
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC
import multiprocessing
def kernel(ker, X1, ... |
ab4d31403df1345674475cb7918230d893533084 | c7f9bae68b923f2029f2895bd440901cbf5d9aaf | gyrationtechs/Image-Classifier | /classifier.py | Python | py | 2,131 | no_license | from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D
from keras.layers import Activation, Dropout, Flatten, Dense
from keras import backend as K
# dimensions of our images.
img_width, img_height = 150, 150
train_data_dir = 'data/t... |
664eeac71a61e64d6d09cb249553a5953eabaf1a | 9ec17a1271f913cd72ed6fcfe0d88af618d02daf | AndyKickass96/IR-AutoTag | /cosine_similarity.py | Python | py | 1,755 | no_license | from nltk.featstruct import Feature
from numpy.core.fromnumeric import argsort
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
from nltk.stem import WordNetLemmatizer
from nltk.stem impor... |
7907955d1fcaa2440d65ae4350ec049e3301d018 | 799822baf5ac1018957ed7ab1cf15edefd66dce8 | hodl2020/BerlinRealEstateETL | /rs_upload.py | Python | py | 2,424 | permissive | import psycopg2
import awsconfig as cfg
import boto3
import sys
import logging
def rsload():
# logging configuration
logging.basicConfig(filename='rsload.log', level=logging.INFO,
format='%(asctime)s %(name)s.%(funcName)s +%(lineno)s: %(levelname)-8s [%(process)d] %(message)s')
# c... |
4a665eb0d41a460c4e3aae47d9d2a95529051dc6 | c01ea19f14f0984a574d737aab11d4553a35505e | alejoe91/spikeinterface | /src/spikeinterface/comparison/comparisontools.py | Python | py | 24,739 | permissive | """
Some functions internally use by SortingComparison.
"""
import numpy as np
from joblib import Parallel, delayed
def count_matching_events(times1, times2, delta=10):
"""
Counts matching events.
Parameters
----------
times1: list
List of spike train 1 frames
times2: list
Li... |
c5deede234191179e6a79d3994fb06ed918d7370 | 456e738e404112c414c2038df9c6661e13bd6e9a | carta/openpyxl25 | /openpyxl25/workbook/function_group.py | Python | py | 846 | permissive | from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
from openpyxl25.descriptors.serialisable import Serialisable
from openpyxl25.descriptors import (
Sequence,
String,
Integer,
)
class FunctionGroup(Serialisable):
tagname = "functionGroup"
name = String()
def __init__(... |
70c0a979da789c004422e3363d15d0032cd674f2 | f13d403dcefc1405d4d94d2fe378a83487e478d0 | adieu/zerorpc-python | /setup.py | Python | py | 2,120 | permissive | # -*- coding: utf-8 -*-
# Open Source Initiative OSI - The MIT License (MIT):Licensing
#
# The MIT License (MIT)
# Copyright (c) 2012 DotCloud Inc (opensource@dotcloud.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Softwa... |
03a6d0c2afaa2b4b8118eadf46970a51ca7a9692 | ae8f6131aadce97c85f0731a5a61d846e53b5449 | kivS/pohms | /setup.py | Python | py | 304 | no_license | from setuptools import setup
setup(
name='pOhms',
version='2019.0.1.0',
author='Vik Borges',
author_email='v1k@protonmail.com',
py_modules=['pohms'],
install_requires=[
'Click',
],
entry_points='''
[console_scripts]
pohms=pohms:main_cli
'''
)
|
145a443494dfca8f772a8ecbad5871dfc84586af | a530e5290f0d7d1fcefeb203457e7ae8c7846738 | ralitsapetrina/Programing_basics | /nested_loop/excercise/6_sum_prime_non_prime.py | Python | py | 733 | no_license | prime = []
composite = []
isComposite = False
while True:
command = input()
if command == "stop":
break
command_int = int(command)
if command_int < 0:
print('Number is negative.')
elif command_int > 1:
for check in range(2, command_int):
if command_int % check ==... |
0a61e326df67495115c6f4586dc81eb7f8da6596 | a4ea0dad894b42e812611f0149ea0deeca0d5f51 | isabellavalice/discussion4 | /discussion_4.py | Python | py | 2,611 | no_license | import unittest
# Counts the number of a's in a sentence (e.g., a string)
def count_a(sentence):
total = 0
for letter in sentence:
if letter == 'a':
total += 1
return total
# Item class
# Describes an item to be sold. Each item has a name, a price, and a stock.
class Item:
# Constructor.
def __init__(self,... |
461355db5da3edb04572cfe4f23aedc6c1d8d6ce | c3b2735cc1693693832a47f0be652aaba9976da8 | beladinaelfitri/knapsack01-dp | /knapsack01.py | Python | py | 1,765 | no_license |
# coding: utf-8
# Knapsack with Dynamic Programming - Kelompok 2
# Angela Marpaung
# Shindy Trimaria Laxmi
# Beladina Elfitri
# Kartiko Nurhada Wicaksono
def knapsack(c, d, p, n):
n = n + 1
c = c + 1
v = [[0 for x in range(c)] for y in range(n)] #inisialisasi array dengan 0
... |
1e07a6bdedaad300db9d73d87c262e5521fb7bc1 | c87ba4b7a6c3ba0951a94367ae84847f09d97607 | mathias3/bokehPlayground.py | /fertility.py | Python | py | 520 | no_license | # Create the figure: p
p = figure(x_axis_label='fertility', y_axis_label='female_literacy (% population)')
# Add a circle glyph to the figure p
p.circle(fertility_latinamerica, female_literacy_latinamerica)
# Add an x glyph to the figure p
p.x(fertility_africa, female_literacy_africa)
# Add a red circle glyph to the... |
38628e8c8a2e5b69f351a3fc224b455667670a38 | 51c4d2f52b7061b55ee2cbddcce58d2a3c4f9310 | heyongman/python2 | /chk_ftp_file/check_target_hz.py | Python | py | 2,903 | no_license | #!/usr/bin/env python
# coding=utf-8
import os
import logging
import shutil
import time
import subprocess
curr_path = os.path.dirname(os.path.abspath(__file__))
log_path = os.path.join(curr_path, "check_target_hz.log")
src_data_dir = "/net_imp/hz" # 源端数据目录-ftp
src_data_prefix = "zw" # 源数据文件前缀
dst_data_di... |
c6aeac06961a7973439234445b5643ae992541b4 | d21cc4a574437c8dfd2ffd30bd6b38ccee99defd | NoahSekreter/CenFill | /venv/Lib/site-packages/smartsheet/models/sheet.py | Python | py | 12,008 | no_license | # pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
# Smartsheet Python SDK.
#
# Copyright 2016 Smartsheet.com, Inc.
#
# 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.... |
2ac116de90157cdb8f69c8eb113d0f30df9fbf57 | fa120b15b421e1f493d83c3f8629f8e1f15d4a58 | Momentum-Team-8/django-duplex-pine-marten | /django_flashcards/asgi.py | Python | py | 411 | no_license | """
ASGI config for django_flashcards 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('DJ... |
c8758f3f6ae65be0dc9832011574008553d58ff4 | c38fe948b2a0b6438368121bee2a210494d65ce2 | uit-no-old/publish-tp-course-mq | /publish_tp_course.py | Python | py | 1,733 | no_license | #!/usr/bin/env python
# Python script to publish changes in course timetable from TP to RabbitMQ
# Author: Øyvind Årnes
import pika
from datetime import datetime
from pathlib import Path
import requests
import json
import time
import sys
import logging
import os
logging.basicConfig(filename='publish_tp_course.log',... |
a35e89554e8e08ba79c41c63c0fe3d262c547009 | b94875f97f38457afd7ed4d3d37f7e091f29b421 | sharmautkarsh31/dock_port_problem | /port_project/test1/models.py | Python | py | 527 | no_license | from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Port(models.Model):
port_no= models.IntegerField()
no_of_containers=models.IntegerField()
def __str__(self):
return str(self.port_no)
class Container(models.Model):
port= models.ForeignKey(... |
33496456dc9f34e5175384d9113d42a562ee40e0 | 40a960078834868fef6c13f8788a196394024889 | wuhendadi/myCloud | /logic/relay/tests/box.py | Python | py | 6,083 | no_license | # -*- coding: utf-8 -*-
__author__ = 'Fred'
# For run in console.
import os
import sys
parent = os.path.dirname(os.path.realpath(__file__))
parent = os.path.dirname(parent)
sys.path.append(os.path.join(parent, 'src'))
import socket
import time
import select
from message import Message, Type
from config import config
... |
9fd2e049a6272d9ae9c8515ccaa4232c92d8633d | d3aebc25c0aea7c4cb2bb0c25f63e938f9ce60b0 | ReshmaRajanChinchu/python-programming | /E.py | Python | py | 275 | no_license | num1 = input("first number: ")
num2 = input("second number: ")
num3 = input("third number: ")
if (num1 >= num2) and (num1 >= num3):
largest = num1
elif (num2 >= num1) and (num2 >= num3):
largest = num2
else:
largest = num3
print("The largest number is",largest)
|
fd8ba4aaf559d4307fd5acaaac5f6d72c8a6e5ae | 96d58e017869b6c7bca5cf13af6bc4e9d24c71c2 | akapitonov1999/CovidRayAnonymizer | /Anon.py | Python | py | 1,672 | no_license | def anon_dir(main_dir, new_dir):
os.chdir(main_dir)
lst_main_dir = os.listdir()
iteration_main_dir = 0
while iteration_main_dir != len(lst_main_dir):
iteration_final_dir = 0
os.chdir(lst_main_dir[iteration_main_dir])
#print(os.getcwd())
#print('New dir', os.listdir())
... |
c8e88bc3192b9986175ac5b52041066029c57409 | 97ec5afae279fef704271f8c8af2d4e7e4fef1a0 | nerdguru/dashboard-api-python | /meraki_v0/config.py | Python | py | 1,424 | permissive | # Package Constants
# Meraki dashboard API key, set either at instantiation or as an environment variable
API_KEY_ENVIRONMENT_VARIABLE = 'MERAKI_DASHBOARD_API_KEY'
# Base URL preceding all endpoint resources
DEFAULT_BASE_URL = 'https://api.meraki.com/api/v0'
# Maximum number of seconds for each API call
SINGLE_REQUE... |
fa0347393a21c70b41b226ff9ea73d1d957858b3 | cc54295f704248974ed87fb867e4762538ec78f8 | scidam/forums | /mainpy/oct_2019_tk.py | Python | py | 960 | no_license | from tkinter import *
storage = dict()
def drop_dwn():
OPTIONS = ["DEV","LB","ST"] #etc
master = Tk()
variable = StringVar(master)
variable.set("Select_the_Regions") # default value
w = OptionMenu(master, variable, *OPTIONS)
w.pack()
def ok():
print ("value is:" + varia... |
7acd88fd73921ded716a9bc668ecffcf5c7228c1 | 720ebf59ba2d307de4cc52555eead4b2d484a97c | TheOtherDan/pythonhard | /ex5.py | Python | py | 696 | no_license | name = 'Zed A. Shaw'
age = 35 # not a lie in 2009
height = 74 # inches
weight = 180 # lbs
eyes = 'Blue'
teeth = 'White'
hair = 'Brown'
weight_kg = weight*0.45
height_cm = height*2.54
print "Let's talk about %s." % name
print "He's %d inches tall." % height
print "He's %d pounds heavy." % weight
print "Actually, that'... |
b472ed07478ae18d1f85d83504b592f77bc88b8d | 6d59e6de3faa2f5d0eae979d28d6bb1a31522ab9 | tangshuran/udacity_data_analyse | /project2/test10.py | Python | py | 1,181 | no_license | import pandas as pd
# Change False to True for this block of code to see what it does
# DataFrame applymap()
if False:
df = pd.DataFrame({
'a': [1, 2, 3],
'b': [10, 20, 30],
'c': [5, 10, 15]
})
def add_one(x):
return x + 1
print df.applymap(add_one)
g... |
6b8fa1730952816a53c54511ca7ae4739c8dc7a3 | 89adb48706aff802e149d9bd1c5f6aad28c6456a | jackbm633/Projects | /Python/change.py | Python | py | 608 | permissive | total_cost = float(input("Enter the total cost of the items: "))
paid_amount = float(input("Enter the amount of money used to pay for this item: "))
change = (paid_amount - total_cost) * 100
print("Change required to give: £",change/100)
change_temp = change
denom_values = (2000, 1000, 500, 200, 100, 50, 20, 10, 5, 2... |
b9fa525a7761be118f49c0daecff79191d1d65c2 | fa0422ad2c2a9ab09520c2e6fda7aeee03f21492 | omarryhan/google-auth-library-python | /system_tests/nox.py | Python | py | 9,430 | permissive | # Copyright 2016 Google Inc.
#
# 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,... |
29cce27b6e5479b5aeed4fb2c963af917f0370f4 | e696edf4a7e158d843cef509725d2cc575645657 | peacemaker07/tsuruya-flyer | /run.py | Python | py | 1,194 | permissive | from flask import Flask, request, abort
from linebot import (
LineBotApi, WebhookHandler
)
from linebot.exceptions import (
InvalidSignatureError
)
from linebot.models import (
MessageEvent, TextMessage, TextSendMessage,
)
import os
app = Flask(__name__)
access_token = os.environ['YOUR_CHANNEL_ACCESS_TOKE... |
bd25f112f6766eb1782313987c3b638691377e55 | 78f0983d058041ab87bf6670d256aa0bf7671694 | SStauden/adversarial-squad | /src/py/squad_ops.py | Python | py | 8,433 | permissive | #!/usr/bin/env python
"""Script to do common operations on SQuAD data files."""
import argparse
import collections
import json
import random
import sys
OPTS = None
DESCRIPTIONS = collections.OrderedDict([
('split', 'Split a file into two parts.'),
('shard', 'Split a file into |n| equally sized parts.'),
('... |
76b64402e2cbb94bd9a631859f18a95d7b6dfff1 | da0bb3f01c7c2871abcc5accd47b031b1cf21b8e | michaelerickstad/PyGRBL | /optimize.py | Python | py | 5,642 | no_license | #!/usr/bin/env python
# optimize.py : Optimizes a set of paths from a pcbGcode.
# [2011.12.25] Mendez written
# [2012.07.31] Mendez cleaned up handles drills
import sys, getopt, os, re
from datetime import datetime
from lib import argv
from lib.util import deltaTime
from lib.gcode import GCode
from lib.tool import Tool... |
48306d32c8b1f522e16bfe957e56c705c5dd3711 | b80a63dc55838bf654ec9ad369140023803b7b6b | icsystems/moduloSAPeM_Triagem | /forks/TriagemImplementacaoAmbulatorio/__init__.py | Python | py | 1,130 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os.path
from django.http import HttpResponse
from django.http import HttpResponseRedirect
import django.views.static as static
import mlp_net
import autocomplete as ac
import runNet as rn
name = 'Triagem Implementação Ambulatório'
version = 'v1.0.0'
fields_xml_path... |
4bd1a8da2f68d143e4c99a49fc72747fe5fc5b20 | 60f3416595166cc2a2d3ce465464b729d58facfa | henrylaih41/LeetCode | /top_100_liked/python3/4sum_ii.py | Python | py | 837 | no_license | class Solution:
def fourSumCount(self, nums1: List[int], nums2: List[int], nums3: List[int], nums4: List[int]) -> int:
self.d, self.cnt = {}, 0
lists = [nums1, nums2, nums3, nums4]
self.addHash(lists, 0, 0)
self.countHash(lists, len(lists)//2, 0)
return self.cnt
def ... |
b36046aa74d3cec839a12c2112e875569d6fa407 | 01e3859d9a6e4948ca1309315d28555688239ce6 | keyrons-hub/Class-Projects | /module 3 problem 2.py | Python | py | 528 | no_license | # Kieran Humphreys Module 3 Problem 2
import math
import numpy
beta = 1000.0
check = 0
for n in range(100):
if check == 1:
break
for fc in range range(beta, 1.2*beta):
passband = 20*math.log(1/(math.sqrt(1 + math.pow((beta/fc),(2*n)))))
harmonic = 20*math.log(1/(math.sqrt... |
318d13da597160dea8910d2cc57fa523134f4832 | 9f99c5873bd2883f354c96693e1bd81d82b59d58 | foolalos/jango | /proyecto/boletin/models.py | Python | py | 505 | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Registrado(models.Model):
nombre= models.CharField(max_length=100, blank=True, null=True)
email= models.EmailField()
timestamp= models.DateTimeField(auto_now_add=True, auto_now=False)
car... |
d864b58c0e36d5217c895d383bd62adead77dbf3 | 29e55f996685898136ba7a9c8ab7e72823c37898 | ktlp/Deep-Modelling | /src/base/base_net.py | Python | py | 808 | no_license | import logging
import torch.nn as nn
import numpy as np
class BaseNet(nn.Module):
"""Base class for all neural networks."""
def __init__(self, type):
super().__init__()
self.logger = logging.getLogger(self.__class__.__name__)
assert type in ['regressor', 'classifier'], 'Network type ... |
8121031f2d3c31ac2f5a91489e1fe889a2357ccc | 050117b8bf52f9c2784f0d8ea59518849ec746d3 | perfectFeng/ResNet | /config.py | Python | py | 2,923 | no_license | # This is a variable scope aware configuation object for TensorFlow
import tensorflow as tf
FLAGS = tf.app.flags.FLAGS
FLAGS.flag_values_dict()
# FLAGS._parse_flags()
class Config:
def __init__(self):
root = self.Scope('')
for k, v in FLAGS.flag_values_dict():
# v = FLAGS[k].value
... |
59e7a99984b8328afdb210c10d690e026d310f09 | d2a29ddf41fd8e299fcdeae57abffdb03c7511cd | codekarsatvik/Red-green | /app/admin.py | Python | py | 732 | no_license | from django.contrib import admin
from .models import Customer
from .models import CurrentGame
from .models import Games
from .models import Gameplayed
# Register your models here.
class CustomerAdmin(admin.ModelAdmin):
list_display = ('user', 'walletbalance')
admin.site.register(Customer)
class Curre... |
7cf04b0b7cd18f5273738ec5b33de1b16b5b986c | 185dea6a1624e65e15731babd3b27a12660544e6 | dlmuljj/faq | /faq/wsgi.py | Python | py | 383 | no_license | """
WSGI config for faq project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_... |
3013446430c78cafa9edf4452b94185e0aa25b5b | 7e88dbed5daacbdb8a6e07b2755c55495e72e5e3 | d1mlex/test_task | /app/__init__.py | Python | py | 728 | no_license | from flask import Flask, render_template, flash, redirect
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
posts = [['Генеральный директор', 1000000],
['Директор', 200000],
['Начальник отдела', 60000],
['Тимлид', 40000],
... |
8535cfadbd7ee95d96c839af1bcf80107e43e3b7 | 64c213a7af698d398da375e86c961e150149525b | KZzizzle/osparc-simcore | /services/web/server/src/simcore_service_webserver/projects/projects_api.py | Python | py | 13,584 | permissive | """ Interface to other subsystems
- Data validation
- Operations on projects
- are NOT handlers, therefore do not return web.Response
- return data and successful HTTP responses (or raise them)
- upon failure raise errors that can be also HTTP reponses
"""
# pylint: disable=too-many-arg... |
ae455eb683ee10e8490db6aa68f5fd5c2aca0b0e | 16a211c49f97f21e117fd7bdceb7f6f108def205 | cash2one/xai | /xai/brain/wordbase/verbs/_fill.py | Python | py | 517 | permissive |
#calss header
class _FILL():
def __init__(self,):
self.name = "FILL"
self.definitions = [u'to make or become full; to use empty space: ', u'to put a substance into an empty space: ', u'to make someone have a partricular feeling: ', u'to put a substance into a hole in a tooth to repair it: ', u'to give a job or ... |
78e079e5ec157b576eb797c0d98a44c3daf7242e | a635a6beecdbe678def1f9a9e2e0851dc0b8ef7c | remigiococo/codeeval | /mincoins.py | Python | py | 248 | no_license | import sys
test_cases = open(sys.argv[1], 'r')
for test in test_cases:
if( len(test) > 0 ):
n = int(test)
i = 0
while( n >=5 ):
n -= 5
i += 1
while( n >=3 ):
n -= 3
i += 1
i += n
print i
test_cases.close()
|
12f87e700100c280d181783062f00dbac0aeaa6a | 4f76f6caec0795558437ecc86ca79035535d6c49 | ukaea/ditto | /ditto_web_api/DittoWebApi/src/models/bucket_information.py | Python | py | 463 | no_license | # pylint: disable=W0212
class BucketInformation:
def __init__(self):
self._name = None
self._creation_date = None
@property
def name(self):
return self._name
@property
def creation_date(self):
return self._creation_date
@staticmethod
def create(name, creati... |
114d29947e0d19f00ce600652d34b761c9479d65 | 89cdf2ff7f3b90b996b91d8e6697fbb83b04b185 | omarelsheekh/jumpscaleX_archived | /Jumpscale/data/zip/ZipFile.py | Python | py | 3,870 | permissive | """The ZipFile class provides convenience methods to work with zip archives"""
import sys
import os.path
import zipfile
from Jumpscale import j
JSBASE = j.application.JSBaseClass
class ZipFileFactory(j.application.JSBaseClass):
READ = "r"
WRITE = "w"
APPEND = "a"
def __init__(self):
if not... |
d5b91f5e8c6cdb15208a73ca70448d7f04e2a1e5 | 2ca118b82f2eded9adad7f4c9c1fa883edd5dcb0 | abcrs/general | /python/python-learning/lab8/bico.py | Python | py | 330 | no_license | def choose(n,k):
if k==0 or n==k:
return 1
else:
return choose(n-1,k-1)+choose(n-1,k)
def main():
top=int(input("Enter the 'n' value: "))
bot=int(input("Enter the 'k' value: "))
print(str(top)+" choose "+str(bot)+" is: ",end='')
print(choose(top,bot))
if __name__=='__main__':
... |
ec9bbf24d5a8976d15a3482d944eda054407c83a | 28b0ee5e8dfbe9a9299d8a097c4722dfd1c4abc1 | ashwinr64/onnx-tensorflow | /onnx_tf/handlers/backend_handler.py | Python | py | 6,012 | permissive | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import copy
import inspect
import tensorflow as tf
from onnx_tf.common import IS_PYTHON3
from onnx_tf.common import get_data_format
from onnx_tf.common import get_perm_... |
60bbb07c22d49305b4fe03232763ccc16ce0ff30 | b61aa8a99d95dcfaa2337c8f372e6d10bfc54763 | bmcqueen/rektleague | /stats/admin.py | Python | py | 1,109 | no_license | from django.contrib import admin
from .models import Season
from .models import Team, Match, TeamMatch, PlayerMatch
from .models import Player
from .models import TeamPlayer
from .models import Role
from .models import Item
from .models import Champion
from .models import SummonerSpell
class TeamPlayerInline(admin.T... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.