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 |
|---|---|---|---|---|---|---|---|---|
18d6331ad81b3e2edcb0817d9eda45237fa09bc7 | 55a0e76a658b7282d1d830e050730106e13906df | AlexxIT/home-assistant | /homeassistant/components/ipp/entity.py | Python | py | 1,539 | permissive | """Entities for The Internet Printing Protocol (IPP) integration."""
from __future__ import annotations
from homeassistant.const import (
ATTR_IDENTIFIERS,
ATTR_MANUFACTURER,
ATTR_MODEL,
ATTR_NAME,
ATTR_SW_VERSION,
)
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.upd... |
47bc0406e74039240525ef8cabd73db7503c7425 | d5d09a2fcb772fbf963ad4d777a4ffd550c1624e | FedericoGuidi/StudyQuiz | /studyquiz/templatetags/utility.py | Python | py | 708 | no_license | import random
from studyquiz.models import Domanda
from project.settings import DEBUG
from django import template
register = template.Library()
@register.filter
def image_url(domanda):
image_url = 'studyquiz/images/' + domanda.esame + '/lezione_' + str(domanda.lezione) + '_' + str(domanda.num) + '.png'
return... |
cf3f03a0aa4297f7631197ac4e8f9975493a3400 | 522453f89852f63119302ab79bc129b52dcbad4e | MSaIim/HeuristicSearch | /Algorithms/UniformCost.py | Python | py | 2,456 | no_license | import math, time
import Algorithms.Base.Formulas as Formulas
from Algorithms.Base.SingleSearch import SingleSearch
class UniformCost(SingleSearch):
def __init__(self, grid, i=-1):
super().__init__(grid, Formulas.NoHeuristic, i)
# Start the algoirthm. Searches for the best path based on the heuristic.
... |
37d470eb69896e8f99770eb1fd5f928abab191c2 | 8285c641816dd478eeec4a4950305739ab0803ef | pou036/redback | /scripts/image_formatter/dat_to_png.py | Python | py | 652 | permissive | #!/usr/bin/env python
''' script to convert raw binary file to png '''
import os, sys, shutil
from PIL import Image
input_filename = 'pack.dat' # 300x300x300
output_filename = 'image'
with open(input_filename, 'rb') as f:
text = f.read().splitlines()
k=0
for i in range(300):
k+= 1
imtxt=''
for j in... |
5d0d944ef4bdcd636e502dee5cab4385514eeb0b | a955cd46f9683dd14833ba3fce6839423f72f4a5 | Aasthaengg/IBMdataset | /Python_codes/p03067/s455932002.py | Python | py | 240 | no_license | _input = input().split(" ")
_A = int(_input[0])
_B = int(_input[1])
_C = int(_input[2])
if _A < _B:
if _A < _C and _C < _B:
print("Yes")
else:
print("No")
else:
if _B < _C and _C < _A:
print("Yes")
else:
print("No") |
1b7774c19f2c8fd210245dc5f0c76c18a65ed5d9 | 58da4ca79c92560983a8883766fe352e91d90ed2 | hayato0311/ai-blog | /mysite/local_settings.py | Python | py | 388 | no_license | import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
... |
472451032d7f4c067df5192694ea67d044b411af | e3f1e4e82f724716afdd6c4b0cd004791eeccc0e | anyunlong/CCUTV8-Server | /server/v8/migrations/0001_initial.py | Python | py | 838 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-17 11:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Cartoo... |
577ed3f3f12fa10b916c8ecc3c8329be11ca50df | 0afa2bcd6d569fc5d31f041c57f0e1b45df91178 | iliar1987/RPS | /RPS1.py | Python | py | 8,346 | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 07 18:09:10 2015
@author: Ilia
"""
import numpy as np
from matplotlib import pyplot as plt
import matplotlib as mpl
import scipy as sp
from scipy import ndimage
#def eight_neighbors(N,M):
# for dx in [-1,0,1]:
# xi = np.arange(M) + dx
# if dx==1:
# ... |
cadc1b7f62b12a7af3fb4d0675e36a408eea8945 | ff81ea74e4525bd00c8ae96c385296bdd2e4f3db | tanucdi/dailycodingproblem | /CodingContest/CODEFORCES/Codeforce_Round#719_div3/1codeforce.py | Python | py | 1,085 | no_license | # B. Ordinary Numbers
# time limit - per test2 seconds
# memory limit - per test256 megabytes
# Let's call a positive integer n ordinary if in the decimal notation all its digits are the same. For example, 1, 2 and 99 are ordinary numbers, but 719 and 2021 are not ordinary numbers.
# For a given number n, find the n... |
b32c7c3cb5a14f88c63181520148632a9e4f3ec7 | b2a475e2144df9012efeb509f72550aef365f0f6 | lancecopper/python_cookbook_exercises | /14.3.3.py | Python | py | 671 | no_license | from queue import Queue
from threading import Thread
# A thread that produces data
def producer(out_q):
#while True:
# Produce some data
# ...
out_q.put('abc')
# A thread that consumes data
def consumer(in_q):
while True:
# Get some data
data = in_q.get()
... |
471845e38b1d69cdb5319e6ca2c220182fa55f8b | dafc95013b963756f2a8ee6ece01d4b3a7337aa4 | erwincoumans/pytorch | /test/jit/test_builtins.py | Python | py | 6,932 | permissive | import os
import sys
import inspect
import unittest
from typing import List
import torch
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
from torch.testing._internal.jit_utils import JitTestCase, RUN_CUDA
if... |
bf34438519818b1888e8bb3abf29aa37ffdb4c2b | c2eb80325c4226e55b6663327f46ee1737c5a787 | ducongo/parking-a-lot | /research and development/scripts/main.py | Python | py | 563 | no_license | # https://stackabuse.com/object-detection-with-imageai-in-python/
from imageai.Detection import ObjectDetection
detector = ObjectDetection()
model_path = "./models/yolo-tiny.h5"
input_path = "./input/test45.jpg"
output_path = "./output/newimage.jpg"
detector.setModelTypeAsTinyYOLOv3()
detector.setModel... |
140836237214186058d6c1ab32d38242a71e1196 | 05ab164529d32402c229bf01dadbe030ebd181db | bderenzi/commcare-hq | /custom/icds_reports/tests/reports/test_medicine_kit.py | Python | py | 11,449 | no_license | from __future__ import absolute_import
from __future__ import unicode_literals
from django.test.utils import override_settings
from custom.icds_reports.reports.medicine_kit import get_medicine_kit_data_map, get_medicine_kit_data_chart, \
get_medicine_kit_sector_data
from django.test import TestCase
from custom.ic... |
ac7c23a1363071edfc70d2c84765687a3bb12611 | f2cb4e9df716b97bbdb232d0a78b985bd8e3f4a2 | TaraKeck/School_District_Analysis | /School_District_Analysis-main/PyCitySchools_Challenge.py | Python | py | 43,117 | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
# In[2]:
# Add the Pandas dependency.
import pandas as pd
import os
# In[3]:
# Files to load
school_data_to_load = os.path.join("Resources", "schools_complete.csv")
student_data_to_lo... |
60fbba8fdd76484c64a55f4de9ae0e74ad2ef565 | 9a75e27f6d0e9f8cbe8df56523cc8b845b16bec4 | jojorulez/app | /src/server.py | Python | py | 820 | no_license | from bottle import run
import configparser
import os
from lib import db
# Importing the files that define the request handlers is what registers the
# handlers with bottle.
from handlers import auth
from handlers import index
from handlers import samplequiz
CONFIG_FILE = os.path.join(
os.path.dirname(os.path.ab... |
893325d66f3ae34e616175028688da0a59203d90 | ee61fe775f1cec91e008167c22d5b5ef5a4b6e31 | maxsimmonds1337/leetcode | /goodbad.py | Python | py | 1,289 | no_license | class Solution:
def isBadVersion(self, v):
"""
:type v: int
:rtype: bool
"""
if(v<=83):
return False
else:
return True
def firstBadVersion(self, n):
"""
:type n: int
:rtype: int
"""
nums = range(1,n... |
1c4df259883ec07695bf792e0a21707896d2b138 | e09b0244e2c1ffd1ec87219011fbac7c2e10682e | abdullahalkakandilli/neowinCrawl | /lambda_function.py | Python | py | 3,544 | no_license | '''
Get inital datetime from neowindate.txt - aws 3 --> last_execute
Get last_feed datetime from neowin rss --> last_feed
Compare last_execute & last_feed
Crawl web indexes after last_execute until last_feed from .rss
Write list to csv file
Upload csv file to Aws s3 Bucket
'''
import urllib.request
from bs4 i... |
96d94682493bf91347854ff15733e78956951d47 | d9cd2c70054f75059041974db73e9c32b5b4aaf5 | gprerit96/sympy | /sympy/geometry/polygon.py | Python | py | 67,014 | permissive | from __future__ import division, print_function
from sympy.core import Expr, S, Symbol, oo, pi, sympify
from sympy.core.compatibility import as_int, range, ordered
from sympy.core.symbol import _symbol, Dummy
from sympy.functions.elementary.complexes import sign
from sympy.functions.elementary.piecewise import Piecewi... |
8925ad0e43c2d5fecce3d447d34c8473ddcf8ac9 | e43f600f58d6dfad0bcf05ec9977f9e7bee37bee | jayyu23/SMART_Project | /estimator/data_structures/feature_script.py | Python | py | 3,394 | no_license | from collections import OrderedDict
"""
Provides a sandbox environment in order to run the exec() script on values in the database
Allows the methods in math
Disallows the keywords identified in illegal
"""
ILLEGAL = ["open", "import", "exec", "eval", "compile", "__", "exit", "locals", "global", "quit", "zip", "def",... |
744be07f3936847c91aa9d6a2a8929bd5ea593bb | 64e11c7a18fb1161cf36f55d31d0782d11240c22 | nilldiggonto/Flower_shop_Django_3.1 | /coupons/migrations/0001_initial.py | Python | py | 845 | no_license | # Generated by Django 3.1.3 on 2020-11-13 19:22
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Coupon',
fields=[
... |
6749a3e93bfc7636f7237c621a3794490171663c | c9e540d8a34a4b3a9d875afb841a33cd3377ccfd | HussainAther/lcdb-wf | /ci/get-data.py | Python | py | 947 | no_license | import os
from snakemake.shell import shell
from snakemake.utils import makedirs
shell.executable('/bin/bash')
URL = 'https://github.com/lcdb/lcdb-test-data/blob/add-chipseq/data/{}?raw=true'
def _download_file(fn, dest=None):
url = URL.format(fn)
if dest is None:
dest = fn
makedirs(os.path.dirna... |
ae87f198b1968c1567cf218100742d06503f73dc | dec265e6069c7f8c2311c33e0287e0fcf64628c4 | Sourceless/formageddon-django | /formageddon/urls.py | Python | py | 651 | no_license | from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
url(r'^contact_sen$', 'contact_senator.views.contact', name='contact_sen'),
# Examples:
# url(r'^$', 'formageddon.vie... |
a7971ab47c409e8dc825c62bcd8a750a53fe6f0e | 41ea6199a2d5ef7900eb57d8474d1308ee56b286 | sobolevn/kopf | /kopf/_core/engines/peering.py | Python | py | 12,399 | permissive | """
Peer monitoring: knowing which other operators do run, and exchanging the basic signals with them.
The main use-case is to suppress all deployed operators when a developer starts a dev-/debug-mode
operator for the same cluster on their workstation -- to avoid any double-processing.
See also: `kopf freeze` & `kopf... |
4b619ba25c4b625e52e5d0d8f7b80f8f768c0c0e | 000c7d5bac2d1e42ea60a635376f5017e1e7b554 | hasmeed/jobber | /jobhunt/api/urls.py | Python | py | 954 | no_license | from django.urls import path
from rest_framework_jwt.views import obtain_jwt_token, refresh_jwt_token, verify_jwt_token
from .views import parentCategory, ServicesApi, getParentCategoryServices, NewWorker, Worker, AllWorker
app_name = 'api'
urlpatterns = [
# path('login/', obtain_jwt_token, name='api-login'),
... |
f38c7443a199d03aca3a0df88616b7f3c1de1c67 | abd10e7fb819e45ebd1ff781352e419e87218e0b | sw561/AdventOfCode2015-17 | /2017/04/passphrase.py | Python | py | 765 | no_license | #!/usr/bin/env python3
def valid(passphrase):
d = set()
for i in passphrase.split():
if PART2:
i = "".join(sorted(i))
if i in d:
return False
else:
d.add(i)
return True
def check_passphrases(f):
for line in f:
yield valid(line)
PART2... |
8ddd13b78ae428b4a1a2bbbdf5086a7213b5374d | fd67efd6cd71989e3fee0f2d5495c1e8a0a3c207 | BibhuLamichhane/face-detection | /compare.py | Python | py | 664 | no_license | import face_recognition
import os
import shutil
known_image = face_recognition.load_image_file("known_image.jpg")
known_encoding = face_recognition.face_encodings(known_image)[0]
folder = '.'
files = os.listdir(folder)
sorted_images = 'sorted_images'
if sorted_images not in files:
os.mkdir(sorted_images)
for file... |
f56907086b3505141d9504f3e1000b3263ea9d6b | d10dfd254ad04354b6df951eaf41bb1393f023dc | rconan/CEO | /setup.py | Python | py | 1,642 | permissive | #!/usr/bin/env python
import os
import sys
import distutils.cmd
import distutils.log
import setuptools
import subprocess
from distutils.core import setup
import setuptools.command.build_py
sys.path.append(os.path.dirname(__file__)+"/python")
print(sys.path)
class MakeCeoCommand(distutils.cmd.Command):
"""A custom ... |
5468c7b01ec9a81166cf15cb0794ddeb432c3bf4 | 74ae5df16c2cc6b6eaf9ea00dc5c9038a337ce3c | Ally35/backend-baby-names-assessment | /babynames.py | Python | py | 3,734 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# BabyNames python coding exercise.
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
__Author__ = "Allyson Engle w/ help from Class demos, study groups, Udemy ZTM Py Course, and Google Python Cours... |
3994cf9c9f65870e6ee8dfb4708f8f2b876897b8 | 0d0b45c9827386ba7fc4a90760681d91b2047ea1 | Ash-Crow/scrapers | /grandeodyssee-scraper.py | Python | py | 576 | permissive | #!/usr/bin/env python
# grandeodyssee-scraper.py
import requests
from bs4 import BeautifulSoup
results_url = 'http://www.grandeodyssee.com/fr/16/resultats/'
response = requests.get(results_url)
soup = BeautifulSoup(response.text)
mushers = soup.select('aside.gab-identite div')
print ('"Nom", "Pays", "Années"')
f... |
45ff60df961b330fa71ccc2dfbf7d36b985a91f9 | e1d81480622604e8d05ce94b76dd3012a5065cc9 | gatarelib/Airbnb | /tests/test_api/test_v1/test_view/test_places.py | Python | py | 13,851 | no_license | #!/usr/bin/python3
"""
Testing places.py file
"""
from api.v1.app import (app)
import flask
import json
from models import storage
from models.city import City
from models.place import Place
from models.state import State
from models.user import User
import unittest
def getJson(response):
"""
Extract the json... |
2898bd93c0d9e3c038eeed941be8400574d38d0c | 5e32671490895c16d087430c8a594353db1db25c | giocarvalho07/Academia-Demoday | /proj/urls.py | Python | py | 868 | no_license | """proj URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/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-based vi... |
fbf89101436ca5cc9f006530c582b87782157ada | bb2151bd19035d8e6375c6af36c11c0c862fa837 | jzanetti/verif_package | /nwp_verification/scripts/nwp_verification/verif.py | Python | py | 31,901 | no_license | import os
import pandas
from datetime import datetime, timedelta
import numpy
from netCDF4 import Dataset
from data_download_upload import append_item_to_dict
from data_download_upload import read_ifs, read_conv_obs, read_gfs, read_wrf
from nwp_verification import CONV_MODEL_OBS_NAME_MATCH
def read_cappi(radar_cappi_... |
fa26ac04788413968ceab22cf1cd2dc44fd4181b | 652169480a50df2b007f13d58492326353159b04 | mattarnster/scsscompiler | /scsscompile.py | Python | py | 1,090 | permissive | import sublime, sublime_plugin, re
from subprocess import Popen, PIPE, STDOUT
from sys import platform
if platform == 'win32':
scss = 'scss.bat'
else:
scss = '/usr/local/bin/scss'
class scsscompileCommand(sublime_plugin.TextCommand):
def run(self, edit, minify = False):
for region in self.view.sel():
... |
8a3b2cad046264a3fbcb8ca00e1b5b214c832e94 | 85eee6ccf84eaa7b29c938811e9bca700d0d50da | CL545740896/stock | /lib/strategy.py | Python | py | 14,854 | no_license | #coding=utf-8
import gevent
from gevent import socket, monkey, pool
monkey.patch_all()
from lib.point import Point
from lib.stock import StockList, Stock
from lib.stock_history import StockHistory
from lib.point import Point
from lib.notify_tpl import NotifyTpl
from lib.config import Config
from lib.etf import ETF
fro... |
894a5c366d661ff7bb5d4ab69cde3927a6062020 | 945001689e806bfb20ea330968dcb4b937bd7e83 | Gb6379/PythonAlgorithms | /python-exercises/list4/9.L4.py | Python | py | 298 | no_license | import os
import random
import time
list = []
fulfill = 0
verifying = 0
while fulfill < 15:
list.append(random.uniform(-45.6, 100.9))
fulfill += 1
print(list)
while verifying < len(list):
if list[verifying] < 0:
print('Negative number index =>', verifying)
verifying += 1
|
22ed5f883a6796a22582f8e6609a90081201fc09 | 68a011c7ad12f08e172bf0699bc144182882f48a | florian-hoenicke/jina | /tests/integration/hub_usage/test_hub_usage.py | Python | py | 2,940 | permissive | import os
import json
from pathlib import Path
import requests
import pytest
from jina import Flow
from jina.excepts import RuntimeFailToStart
from jina.executors import BaseExecutor
from jina.parsers import set_pod_parser
from jina.peapods import Pod
cur_dir = os.path.dirname(os.path.abspath(__file__))
def test_si... |
58eae0bb6b29e7335939053c0a0dfb4d1d75bedf | 29244d3b83b49c9ba96a641444c0e68b9d9f10de | wwq0327/rss2mail | /rss2html.py | Python | py | 902 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
rss2html
~~~~~~~~~~~~~~~~~~~~
RSS To HTML
:date: 2011-11-01
:author: wwq0327 <wwq0327@gmail.com>
:license: LGPL 2 or later (see README/COPYING/LICENSE)
"""
import blogrssparser
BLOG_ADDR = 'http://linuxtoy.org/?feed=rss2'
HTML_HEAD = "... |
dd40c6767626e8c580fd4e45dd6e488ab9d196bc | 6c6906e398b4b7f5af4435fabedf2e31967caf39 | OlgaShutova17/AQA_python | /lesson 2/waits.py | Python | py | 409 | no_license | from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
class Waits:
def __init__(self, driver):
self.driver = driver
def wait_homePage(self, selector):
wait = WebDriverWait(self.drive... |
035e46ea6e63a8aff6b9bc04c309a774839ead46 | f46b632e330bf216b63d23a9d880746465f5ea84 | purkayasta/StackOverFlowLite | /overflow/migrations/0001_initial.py | Python | py | 1,852 | no_license | # Generated by Django 2.2.7 on 2019-11-17 14:07
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
1c17864ef0bea02c486ec05b659dc48adec25e8e | 21a8ff8cd09e56a6fffa2bdcfc8e3dc4a6a6b450 | mwiens91/fooskill | /backend/api/migrations/0002_auto_20190312_1102.py | Python | py | 1,778 | permissive | # Generated by Django 2.1.7 on 2019-03-12 18:02
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migra... |
1e00d556cdff9fb140ff52e62f24ed2788e933b0 | cfc91f29ed209d2c5f54fbb45145b80183d2bb32 | aslomoi/compliance-trestle | /tests/trestle/core/models/write_action_test.py | Python | py | 1,564 | permissive | # -*- mode:python; coding:utf-8 -*-
# Copyright (c) 2020 IBM Corp. 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
#
#... |
7a6fcfcfcd2f0a2a7082158f69835bb83017a7cd | e188147bdb3fdbebbd9f905e1265c14c215dd21d | gyuree-kim/algorithm | /dfs_and_bfs/dfs/2667_단지번호붙이기.py | Python | py | 855 | no_license | # 문제: git commit -m "[DFSBFS] Upload 2178, 2606, 2667
# 코드: http://colorscripter.com/s/KY5AY83
from collections import deque
n = int(input())
graph = []
for _ in range(n):
graph.append(list(map(int, input())))
num = 0
def dfs(x,y):
global num
if x < 0 or y < 0 or x >= n or y >= n:
return False
... |
d0a8a57236d983bd9a9fa44ad1ab207c45b4f01f | c66f995ac498f54ee13a98a9510c4ce4479f33f5 | minhduy105/MobileRobot | /exercises1/src/move.py | Python | py | 3,042 | no_license | #!/usr/bin/env python
# Every python controller needs these lines
import rospy
import math
# The velocity command message
from geometry_msgs.msg import Twist
from sensor_msgs.msg import LaserScan
import numpy as np
class MovingForward():
def __init__(self,stopD,stopType,calSize):
self.stopD = stopD
... |
5b469524880ed570282c387386ecdf13aebfdfa1 | f60a002ec002996fe947913fb1293993f1bcdefa | tqchen/dgl | /tests/compute/test_sampler.py | Python | py | 32,257 | permissive | import backend as F
import numpy as np
import scipy as sp
import dgl
from dgl import utils
import unittest
from numpy.testing import assert_array_equal
np.random.seed(42)
def generate_rand_graph(n):
arr = (sp.sparse.random(n, n, density=0.1, format='coo') != 0).astype(np.int64)
return dgl.DGLGraph(arr, readon... |
b847cb8046ed3fcc47e9ec9fd2b8fdb239b72ac3 | 23d42b51261fa58abb48dfc7ee2b1b512f67978e | OleksiiZhmyrov/Agiler | /retro/models.py | Python | py | 2,048 | permissive | from django.db import models
from model_choices import *
class Sticker(models.Model):
created = models.DateTimeField('Creation Date', auto_now_add=True)
summary = models.CharField('Description', max_length=1024, null=True, blank=True)
type = models.CharField('type', max_length=1, choices=STICKER_TYPE_CHOI... |
96724f65e8d49b2ff6f323047c39b4ef0b350594 | 6a6d9433274ad159e3ef3767de09523d3af32081 | skvaryk/filabel_tests | /filabel/web.py | Python | py | 5,545 | permissive | import configparser
import flask
import hashlib
import hmac
import jinja2
import os
from filabel.logic import Filabel
from filabel.utils import parse_labels
app = flask.Flask(__name__)
def webhook_verify_signature(payload, signature, secret, encoding='utf-8'):
"""
Verify the payload with given signature aga... |
eeb80e1375297425ba4c09dc1ee08c0ec52ad9be | d3334eea3b4eafda3e655e9c72a5f94a81a4842e | ochirovaur2/nps_website | /quality/main/migrations/0004_auto_20201229_1025.py | Python | py | 547 | no_license | # Generated by Django 3.0.7 on 2020-12-29 03:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0003_auto_20201211_1001'),
]
operations = [
migrations.AddField(
model_name='quality_rating',
name='resoluti... |
ecd8382644726b98c466ca94d0353c791982474d | 0de25b871e7d9ea145abe5a47f4a919e4da257dd | sharmosarkar/Yelp-Dataset-Analysis | /plots.py | Python | py | 2,327 | no_license |
from pylab import *
def plot_topics():
# make a square figure and axes
figure(1, figsize=(6,6))
ax = axes([0.1, 0.1, 0.8, 0.8])
# The slices will be ordered and plotted counter-clockwise.
labels = 'Breakfast', 'Healthcare', 'Value', 'Bakery', 'Decor','Service'
fracs = [10, 10, 45, 10, 5, 20]
explode=(0, 0, ... |
a40aca27d3d0f1094fe40dd6d74d95567843387e | 06a488effc8c962846fc6d0376a0198aaa24259c | quake0day/oj | /Excel Sheet Column Number.py | Python | py | 402 | permissive | class Solution(object):
def titleToNumber(self, s):
"""
:type s: str
:rtype: int
"""
res = 0
k = 0
if s == None: return res
for i in range(len(s)):
res = 26 * res
res += (ord(s[i]) - 64)
return res
a = Solution()
pri... |
32ddcd80a688a3d6639edded744588d9e7906e0c | 14765d4856844e9903c0ab76a99d75843abaa936 | leocm/smartt-python-client | /pysmartt/smartt_simple_protocol.py | Python | py | 3,306 | permissive |
# Escapes a string value according to the protocol
def escape(value):
return value
# Unescapes a string value according to the protocol
def unescape(value):
return value
##############################################################################
### SmarttSimpleProtocol - handles the Smartt simplest pr... |
0b1de0621b66f186802905347fc46f4eeee342e8 | 9fd64a17118b9b284669cf6f83a24adfb30bf3f2 | smikeblog/dotfiles | /config-sm/ranger/plugins/display_move.py | Python | py | 1,484 | no_license | from ranger.api.commands import Command
from ranger.ext.direction import Direction
class DisplayMove(Command):
"""Move to file in Pager view
Example:
Enter Pager view: display_file
Move up: DisplayMove up=1
Move down: DisplayMove down=1
"""
def execute(self):
if not self.fm.ui.pa... |
c94bb5787ca913dd64ee37229f8b7fdf42dd18c1 | 9c67dd1000950f0b5c12952007017e893f2cf544 | DamianDamian-Domin/pp1 | /01-TypesAndVariables/BMI.py | Python | py | 379 | no_license | '''
Program do liczenia BMI
'''
wzrost = float(input("Wprowadź wzrost w metrach")) #wzrost
waga = float(input("Wprowadź wagę w kilogramach")) #waga
BMI = waga/wzrost**2 #BMI
#rezultat
if BMI >=18 and BMI <=25:
print("BMI wynosi {:.2f} Waga prawidłowa".format(BMI))
else:
print... |
0f1f68c3230bff2ff0775b4ba34aaaf9122fd4a4 | d7cf77c12e3624fdc4e441a69c47e3d3d79213b6 | prathap79/Box-office | /booking/models.py | Python | py | 1,761 | no_license | from django.db import models
from django.contrib.auth.models import User
from theatre.models import Show
# Create your models here.
class Booking(models.Model):
payment_choice = (
('Debit Card', 'Debit Card'),
('Credit Card', 'Credit Card'),
('Net Banking', 'Net Banking'),
('Walle... |
da997b30240f17ec49e0026f081c1605b6bb13cc | f085fc4b55553f15c3bfc0a3837dc72cd2e25d46 | KarthikeyanG44/Interview_Prep | /Reverse_polish_notation.py | Python | py | 1,547 | no_license | # https://leetcode.com/problems/evaluate-reverse-polish-notation/
# Input
# 4 2 3 + *
# 4 * (2+3)
# "10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"
# 10 * {6 / [(9+3)* -11 ] } + 17 + 5
# 10 * {6/[-132]} + 17 + 5
# 10 * {0} + 17 + 5
# 0 + 17 + 5
# 22
# input will be a valid expr... |
42d518e556c697a6dbcb6aea76325674e35cf588 | e4185ca154f9437a7cb0cbacca2b30cf28ecc874 | rwl/Andes | /andes/models/blocks.py | Python | py | 995 | permissive | """Control blocks"""
from cvxopt import matrix, sparse, spmatrix ## NOQA
from cvxopt import mul, div, log, sin, cos ## NOQA
from .base import ModelBase ## NOQA
# from ..consts import *
# from ..utils.math import *
class PI1(object):
"""PI controller class as addon base class"""
def __init__(self, params=N... |
c50b78adfdd813dcd4f78b1fafe8ce8b5b50c23b | 784774f11409899222a54358c8c52c631a0928db | PeerHerholz/guideline_jupyter_book | /venv/Lib/site-packages/myst_parser/__init__.py | Python | py | 1,628 | permissive | __version__ = "0.12.10"
def setup(app):
"""Initialize Sphinx extension."""
from myst_parser.sphinx_parser import MystParser
app.add_source_suffix(".md", "markdown")
app.add_source_parser(MystParser)
setup_sphinx(app)
return {"version": __version__, "parallel_read_safe": True}
def setup_sp... |
184718f890babbc2cf8772d1c1d18c866313f5a3 | 37803ccb33fd73272f0bffb69b69e998c18f40ac | dungeonmaster51/commcare-hq | /testapps/test_pillowtop/tests/test_changes.py | Python | py | 2,773 | permissive | import uuid
from django.test import TestCase
from mock import MagicMock
from couchforms.models import XFormInstance
from pillowtop.feed.couch import get_current_seq
from pillowtop.tests.utils import FakeConstructedPillow
class ChangeFeedDbTest(TestCase):
def setUp(self):
super(ChangeFeedDbTest, self).set... |
aa578637b241f3e0af363c9aaf1d8c32ffb18b42 | c87061cc7ec8314f1feff2784165fed335184d25 | rpao/recommendation | /recomendacao_conteudo.py | Python | py | 2,297 | no_license | import numpy as np
import pandas as pd
from sklearn.metrics.pairwise import linear_kernel
from sklearn.feature_extraction.text import TfidfVectorizer
# pega uma venue_ID e retorna os venues_ID mais similares
class recomendacao_conteudo:
def __init__(self, tip, venue):
self.tips = tip.drop(['user_ID'], axis... |
3a0dba837611e69078af99cb6ce1acb0d6ad3046 | e441ee7a9466fc0b45fa9eaebcc35bce2b698816 | KL2KL/py_repo | /test2.py | Python | py | 529 | no_license | birthdays = {'Alice' : 'April 1', 'Bob' : 'Dec 12', 'Carol' : 'Mar 4', 'Stephanie' : 'April 21', 'Chris' : 'July 11'}
while True:
print('Enter a name: (blank to quit)')
name = input()
if name == '':
break
if name in birthdays:
print(birthdays[name] + ' is the birthday of ' + name)
el... |
a22e09aa0bc6d88a585990279281fe727040347a | e92a94112068ca607717ab46f972b0049317b018 | MisinformedDNA/pulumi-azure-nextgen | /sdk/python/pulumi_azure_nextgen/documentdb/v20151106/get_database_account_gremlin_graph.py | Python | py | 8,512 | permissive | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
6011682f8654d1bf04f02a02314aceff260f4d62 | ef44e7d3cece82c8c1bab64d8b77dc760f0ea350 | ToFeWe/Bagging-Regression-Trees | /src/model_code/test_montecarlosimulation.py | Python | py | 1,226 | no_license | """
Tests for the *montecarlosimulation* class.
Wrong parameter inputs are tested directly in the class.
"""
import sys
import pytest
from numpy.testing.utils import assert_array_almost_equal
from src.model_code.montecarlosimulation import MonteCarloSimulation
def test_montecarlosimulation_mspe_decomposition_same... |
39df86b2f29324504ffba695d607245f75ae86c9 | 7a81e5062ab003f0c231b59ce75a95fe031eaec7 | jeng/brew | /myRecipes.py | Python | py | 6,339 | no_license |
# Copyright (c) 2009 Jeremy English <jhe@jeremyenglish.org>
# Permission to use, copy, modify, distribute, and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appear in all copies and
# that both that copyright notice and this permis... |
7fe3519d52c6ea4cbf284117509139c56b04ba9a | 6d4f6dd576bbaf27bfd763016a05fb7c674773ab | mmrice22/virtual_environment_hw | /raffle.py | Python | py | 1,423 | no_license | """Read customer data from file and run a raffle."""
import random
class Customer(object):
"""A customer at Ubermelon."""
def __init__(self, name, email, street, city, zipcode):
self.name = name
self.email = email
self.street = street
self.city = city
self.zipcode =... |
e8a166a14ee748565de48cebf443ad86c6521f27 | 684faa7bfebdd115d2c8ab5f76013f984b84f6d4 | sferro/excercises | /python/picnicTable.py | Python | py | 428 | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
def printPicnic(itemsDict, leftWidth, rightWidth):
print('PICNIC ITEMS'.center(leftWidth + rightWidth, '-'))
for k, v in itemsDict.items():
print(k.ljust(leftWidth, '.') + str(v).rjust(rightWidth))
picnicItems = {'sandwiches': 4, 'apples': 12, 'cups': 4, 'cook... |
25a871c91235c9a12bf1733bcb71fb7614a751ae | 7926932ec1f421ce5e098290bb6c11d4e246d4b8 | airaer1998/airaer | /project/project1_game/alien_war/homework/a_1.py | Python | py | 436 | no_license | #创建一个背景为蓝色的Pygame窗口
import sys
import pygame
from a_2 import SHIP
def bulid():
pygame.init()
screen=pygame.display.set_mode((800,800))
pygame.display.set_caption("blue_window")
screen.fill((0,120,230))
ship=SHIP(screen)
ship.blitme()
while True:
for event in pygame.ev... |
08210274cecb0f29ca519c3aeab225ee57f7affe | b880ae3f829b1e7c7f2802ab7059458c5f7f112d | samerzakhem/Robin-Hood | /canbus/detect.py | Python | py | 2,518 | no_license | #!/usr/bin/python
#==========================================================================
# (c) 2011 Total Phase, Inc.
#--------------------------------------------------------------------------
# Project : Komodo Examples
# File : detect.py
#---------------------------------------------------------------------... |
d2595f24118c47d87202266ef71167b9fab26f66 | b965da576a1aed86ff26c83f9a642a0736b6924e | BBN-E/text-open | /src/python/serif/model/impl/mention_coreference/allennlp_coreference_model.py | Python | py | 3,500 | permissive | import logging
from allennlp.predictors.predictor import Predictor
from serif.model.mention_coref_model import MentionCoreferenceModel
logger = logging.getLogger(__name__)
DUMMY_ENTITY_TYPE = "ALLENNLP_MENTION"
class AllenNLPCoreferenceModel(MentionCoreferenceModel):
def __init__(self, model, **kwargs):
... |
3af9da7cd2766af9ccd978b51ab0e968cbe6831e | 03f8e6be1ba42272970eb8daf8c23656b8cc52e2 | Gordi91/recipe-app-api | /app/recipe/tests/test_tags_api.py | Python | py | 3,252 | permissive | from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Tag, Recipe
from recipe.serializers import TagSerializer
TAGS_URL = reverse("recipe:tag-list")
class ... |
e5e4d9a5ccb08f10b3e8c0364a6461fcf251bf6e | 383e1a5c4b4d38074167fa40e3e9eeac693ade62 | harsh4723/Emotion-Detection | /Codes/Feature Extraction/audioBasicIO.py | Python | py | 5,111 | permissive | import os, glob, eyed3, ntpath, shutil, numpy
import scipy.io.wavfile as wavfile
import pydub
from pydub import AudioSegment
def convertDirMP3ToWav(dirName, Fs, nC, useMp3TagsAsName = False):
'''
This function converts the MP3 files stored in a folder to WAV. If required, the output names of the WAV fil... |
4f13409db0b758da529ea5035c253a4626c13d2b | 840c22749d793582c309b6a0776fa1c84a8bfdde | ZhanRao/python-tensorflow- | /线性回归.py | Python | py | 2,048 | no_license | import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
#函数的是逐渐按倒推的
# 使用numpy生成200个随机点
x_data=np.linspace(-0.5,0.5,200)[:,np.newaxis]
# 定义-0.5到0.5的200个数
# 如果没有[:,np.newaxis]将会变成一行
# [:,np.newaxis]可以将数据变成一列
noise=np.random.normal(0,0.02,x_data.shape)
y_data=np.square(x_data)+noise
# 定义两... |
65f5700709d982fb2cc50577fc153402e1812bd6 | abe6fcfb2a266c759cf39e3559d223e82c3dd4b7 | jagannath/imageAnalysis | /timetraces/createProjectionImages_peakFinding.py | Python | py | 1,835 | no_license | #! /home/jaggu/anaconda
"""
This is a file to cleanup the photobleaching timetrace files. The idea is to move through the sourceDir and retrieve the first
(and perhaps later maximum projection etc) image. Then I will create a new directory and copy the first tif file of the tflds.
"""
import os
import sys
import fnma... |
69bf98e273dbedd92180a202cfc049b3f8243da0 | 11a374bfd7fca317e20bd5fc929db39158a515a0 | bugwumba/Project_Playground | /Web_Scrapper_w_classes.py | Python | py | 34,239 | no_license | import unittest
import pandas as pd
import selenium
import array as arr
from selenium import webdriver
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.we... |
45e11d0c99573979e8350c3dd72f71878071436a | 51775d8301e3b8310cb5b3137937d37f9b91ff23 | cash666/TaskManager | /TaskMnanager/web/migrations/0001_initial.py | Python | py | 11,324 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-31 13:30
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... |
79286e3114eb5386eb31672fdde50b945010406c | 1cabaddb6098a9d5d5000c071f3e343213cd8938 | DamnDanielV/bootcamp-higher_level_programming | /0x11-python-network_1/10-my_github.py | Python | py | 434 | no_license | #!/usr/bin/python3
"""using Github API"""
from requests import get
from requests.auth import HTTPBasicAuth
from sys import argv
def api_github(user, pas):
"""makes a request to github api"""
url = 'https://api.github.com/user'
res = get(url, auth=HTTPBasicAuth(user, pas))
try:
print(res.json()... |
289b9979fa785ef74bb4d077e67df7501c3dc5ff | cf7b9913df47e42c9e24008b51c47365df734159 | uzakari/Forex | /forex/migrations/0003_register.py | Python | py | 795 | no_license | # Generated by Django 2.0.1 on 2018-07-22 11:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('forex', '0002_comment'),
]
operations = [
migrations.CreateModel(
name='Register',
fields=[
('id', m... |
ae569495e63641eddcc9d0a849466745da4a84eb | 6b1a62c841fafeabbe26e65975cec8c08fa4e398 | ahmed-gharib89/DataCamp_Data_Scientist_with_Python_2020 | /Data Cleaning in Python/02_Text and categorical data problems/04_Removing titles and taking names.py | Python | py | 1,768 | no_license | """
Removing titles and taking names
While collecting survey respondent metadata in the airlines DataFrame, the full name of respondents was saved in the full_name column. However upon closer inspection, you found that a lot of the different names are prefixed by honorifics such as "Dr.", "Mr.", "Ms." and "Miss".
Your... |
3420fe7e5e3d09759e2f8f54b752143d5e726c1a | 8b84be88beebc92712050fd4c994de6c10a1d1cb | sseini/maorey | /ticky_check.py | Python | py | 2,861 | no_license | #!/usr/bin/env python3
import sys
import re
import csv
# Number of error messages dictionary
error = {} # "Error": count
# Number of inputs of each user
per_user = {} # "username": {"INFO": 0, "ERROR": 0}
def create_csv_user():
with open("syslog.log") as f_user:
line = f_user.readline()
while ... |
620637add2c172cf7f0750992926acff9d4516a0 | 1005367aef08af2a2b819348fca9ca54fce3ac6c | GaryVermeulen/gdata | /p/sockets/echo1.py | Python | py | 498 | no_license | #!/usr/bin/env python3
import socket
HOST = '127.0.0.1' # Standard loopback interface address (localhost)
PORT = 65432 # Port to listen on (non-privileged ports are > 1023)
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind((HOST, PORT))
s.listen()
conn, addr = s.accept()
wit... |
92fa266b7945181a47a3992bdf2516826f50c6d6 | 7cd5f5227119d6de934d045f424a9d0dd0b208a5 | jdaunt/getbackyourkids | /getbackyourkids/wsgi.py | Python | py | 1,152 | no_license | """
WSGI config for getbackyourkids project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLIC... |
1c49a3702b3c965626baa7e3dd6b6c8ebb3a49c1 | 17d37a4e5262c5c74513b3eb2e73087bdc457007 | scream4ik/devchallenge11_final | /project/core/api/views.py | Python | py | 3,384 | no_license | from rest_framework import generics
from rest_framework import status
from rest_framework.response import Response
from django.db.models import F
from .serializers import (
EmployeeRegistrationSerializer, EmployeeResetSerializer
)
from ..models import Employee, Area
class EmployeeRegisterViewSet(generics.Create... |
b10c8abd7b948206b06e420e7ca65589aca5a689 | cc8bdbac3be4fdcf9bbd1e195f2f1832c4bd622a | DimensionDataResearch/salt | /tests/unit/fileserver/test_gitfs.py | Python | py | 11,386 | permissive | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Erik Johnson <erik@saltstack.com>`
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import errno
import os
import shutil
import tempfile
import textwrap
import tornado.ioloop
import logging
import stat
try:
import... |
d8fea0f58bf676ed10278aad24eca4246f2b1170 | 4db73587132a8888feb6ddee8041c420db746b7c | winddweb/cgss-event-charts | /print_tweet.py | Python | py | 2,054 | no_license | #! /usr/local/bin/python3
import sys
from datetime import datetime, timedelta
import tweepy
from auth_setting import auth_setting
# TODO: avoid twitter api rate limitation
def get_all_tweets(screen_name, max_number):
auth = tweepy.OAuthHandler(auth_setting["consumer_key"], auth_setting["consumer_secret"])
a... |
5d73aeca7b8eaf24239d2fc54b8e56840a40102b | dba2981199b5eaa4c5224b3780d5e8af1d36c7f5 | invincibleraj/a2019 | /Automation Anywhere/Bots/AmazonSentiment.py | Python | py | 356 | no_license | import boto3
import json
import sys
import pyperclip
comprehend = boto3.client(service_name='comprehend', region_name='us-west-2')
def sentimentFinder(sentence):
output = json.dumps(comprehend.detect_sentiment(Text=sentence, LanguageCode='en'), sort_keys=True, indent=4)
resp = json.loads(output)
sentiment = resp[... |
8a9cf7f272f83d2bef3003cdd04beecaaf7b4a18 | d8622a1a991f8c3eb040f5988829e61bc3c0ed07 | Willianan/Boastful_Machine_Learning | /code/lecture_7/SVR.py | Python | py | 1,205 | no_license | # -*- coding:utf-8 -*-
"""
@Author:Charles Van
@E-mail: williananjhon@hotmail.com
@Time:2019-07-24 21:03
@Project:Boastful_Machine_Learning
@Filename:SVR.py
@description:
支持向量回归机SVR
"""
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append("G:/PycharmProjects/Boastful_Machine_Learning/ut... |
db13c1b141f9c5adbf9f6e18febb9d65bf5b8dbc | 1ed68870ebe71151eb7f074570b82087a175b4d3 | SherwinGroup/InstrumentLibrary-yolo | /InstsAndQt/MotorDriver/scopeCollect.py | Python | py | 20,143 | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 28 15:36:27 2014
@author: Darren
"""
from PyQt5 import QtCore, QtGui, QtWidgets
import pyqtgraph as pg
import numpy as np
import threading
from .mainWindow_ui import Ui_MainWindow
from .scopeView import ScopeViewWidget
from InstsAndQt.Instruments import Agilent... |
40b83f71eef18a44b00983a5715cc48f1c3d4e87 | 698a3ae2512d00d2014fedac8dd800138aa76483 | retooth/shmudder | /src/basic/rooms.py | Python | py | 8,834 | no_license | #!/usr/bin/python
# This file is part of Shmudder.
#
# Shmudder is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ... |
c1625b249ba6f866d362246979348a7322f8176e | 9edffdfca47df5b65d058e1b8dff1a169be72e02 | Maduflavins/Spam-detector | /spam.py | Python | py | 2,223 | no_license | #import libraries
import os
import io
import numpy
from pandas import DataFrame
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
#define a readfile path that will walk through the emails and read the message body skiping the header
def readFiles(path):
for r... |
97c021970f556fa3d3e7040508b47a5d20311914 | 10201d351716e034754ea3c4e3c3094a75ad877f | brucehoff/girder | /clients/python/setup.py | Python | py | 1,835 | permissive | # -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
def prerelease_local_scheme(version):
"""Return local scheme version unless building on master in CircleCI.
This function returns the local scheme version number
(e.g. 0.0.0.dev<N>+g<HASH>) unless building on CircleCI for a
... |
5df21b736e82f61859570814c4dbc3da4a1749dd | ff53c339c81739b490c9fd8a761884cca74da1d6 | iangraham20/cs108 | /projects/10/rectangle_driver.py | Python | py | 678 | no_license | ''' A program that converts content from a text file into rectangle objects.
November 7, 2016
Homework 9 Exercise 9.3
@author Ian Christensen (igc2) '''
# Import necessary libraries.
from rectangle import Rectangle
rectangles = []
# Open the text file, and save each line to a list as rectangle objects.
try:
with... |
069c6e1dce89819cf274cefd29e3a779b650314f | 1f83300d8ebebacc9361f07646783c05821501ab | thallkeer/xoma163site | /apps/API_VK/command/commands/Birds.py | Python | py | 2,227 | no_license | from apps.API_VK.command.CommonCommand import CommonCommand
from xoma163site.wsgi import cameraHandler
class Birds(CommonCommand):
def __init__(self):
names = ["с", "c", "синички"]
help_text = "Синички - ссылка и гифка с синичками"
detail_help_text = "Синички ([N[,M]]) - ссылка и гифка с с... |
ad57dc2a652a89cb10a18f3eeb1d238853821f7a | 2d247c90a045ea21a950d0aaee1601a9e00abc2d | dwg920302/study_tensorflow | /keras2/keras70_2_vgg16_seq.py | Python | py | 2,211 | no_license | from tensorflow.keras.layers import Dense, Flatten
from tensorflow.keras.models import Sequential
from tensorflow.keras.applications import VGG16, VGG19
from tensorflow.keras.datasets import cifar10
vgg16 = VGG16(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
# vgg16.trainable = False # 훈련 동결
mod... |
4febe30b5a8c8e7533d83c17982db3d3517a9b0c | 50fd00ecb5583d8a236e789369dc3b32a107fb15 | hatchpay/hatch | /contrib/linearize/linearize-hashes.py | Python | py | 3,974 | permissive | #!/usr/bin/env python3
#
# linearize-hashes.py: List blocks in a linear, no-fork version of the chain.
#
# Copyright (c) 2013-2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from __future__ impo... |
a792d7f87338d851b2fde1fb34331da107af13ee | f4709096850a2fa95e08e4e6c020c5e736150192 | python-cookbook/PythonStudy | /p02_personal_summary/p13_lee_yung_seong/p04_week/p02_thursday/C6.9.py | Python | py | 1,083 | no_license | #16진수 인코딩, 디코딩
#문제
#문자열로 된 16진수를 바이트 문자열로 디코딩하거나 바이트 문자열을 16진법으로 인코딩해야 한다.
#해결
#문자열을 16진수로 인코딩하거나 디코딩할면 binascii
#최초바이트문자열
s=b'hello'
#16진법인코딩
import binascii
h=binascii.b2a_hex(s)
h
#바이트로 인코딩
binascii.a2b_hex(h)
# base64 모듈에도 유사한 기능이 있다.
import base64
h = base64.b16encode(s)
h
base64.b16decode(h)
#토론
#두 기술의 차이점은 대소문자 ... |
ba46473bf36feb6985737b66f66b977313fe2624 | 3bc55b09ef28560277584d58dc956c4ba147b3ec | vkompaniiets/TaskManager | /task_manager/settings.py | Python | py | 3,657 | no_license | """
Django settings for task_manager project.
Generated by 'django-admin startproject' using Django 1.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import... |
cc210b0ade884a338e6195d4c59e2fea2c4fd45f | 30ea47dcec52d34dcaea9cf0cdeb001e8028152e | AdamZhouSE/pythonHomework | /Code/CodeRecords/2097/60895/245657.py | Python | py | 238 | no_license | numerator=int(input())
denominator=int(input())
if numerator%denominator==0:
num=numerator//denominator
else:
num=numerator/denominator
result=str(num)
if len(result)>3 and result[2]=='6':
result='0.(6)'
print(result)
|
dc052a912bc3cea1a6a60f21b437726e1f6d03c8 | f2d59924ab261832624fe020dfd4b29db0574bca | andregomesp/campo_minado_rpc | /versao_fila/campo_minado_view.py | Python | py | 6,775 | no_license | from socket import socket, AF_INET, SOCK_DGRAM
from pygame import mixer
from ast import literal_eval
import json
import sys
import os
import zmq
class CampoMinadoView:
ENCODE = "UTF-8"
PORT = "5559"
def __init__(self):
self.contexto = zmq.Context()
self.socket = self.contexto.so... |
83691a6f46c29213d16c8df963cd42603bbde44f | 5f28885959d21eb13875828fde32acc7639ecdfb | KennethEhmsen/zerocopy | /zerocopy/_copyfile.py | Python | py | 6,661 | permissive | import errno
import os
import shutil
import stat
import sys
if os.name == 'posix':
import _zerocopy
else:
_zerocopy = None
import win32file
import pywintypes
HAS_SENDFILE = hasattr(_zerocopy, "sendfile")
HAS_FCOPYFILE = hasattr(_zerocopy, "fcopyfile")
HAS_WIN32_COPYFILE = os.name == 'nt'
PY3 = sys.ve... |
e508b320c30d2c5027df8706072f07edaad81e0d | 6568061ad6e745622cc1361ae3762ae62e99c3b1 | suzybaek/assignment | /NumericalAnalysis/hw13/hw13.py | Python | py | 3,406 | no_license | import numpy as np
import random
# exact values
# (-5, -11), (-4, -9), (-3, -7), (-2, -5), (-1, -3), (0, -1)
# (1, 1), (2, 3), (3, 5), (4, 7), (5, 9), (6, 11)
x_val = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6]
def make_array(x):
# [x, 1]
result = [x, 1]
return result
def whole(sample):
A... |
fe9452dc8dfb747ed86264b96677efbd51670694 | 15ecd90da9d80d1bb8730d26c660e7d1e11a7660 | AlbertoSara/CC5113-Clasificador-de-Im-genes | /resnet_test.py | Python | py | 2,758 | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 2 02:53:51 2019
@author: Alberto
"""
import time
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.keras.applications.resnet50 import ResNet50
from tensorflow.keras.preprocessing import image
from tensorflow.keras.applications.resnet50 impor... |
271ed85b4cab4d3a2eeb49acf35ac28d1a93d72c | 42c570c02191a60b94ac1f8a6d2f6881c91d4922 | gnwell/mace | /tools/sh_commands.py | Python | py | 49,672 | permissive | # Copyright 2018 Xiaomi, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.