code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_11_01/models/application_gateway_sku.py | Python | mit | 1,567 |
import socket,select,sys,time
from errors import *
from communicate import SendData, ReceiveData, ReceiveDataUDP
class TCPServer():
def __init__(self):
self.sending_socket = None
def input_func(self,sock,host,port,address):pass
def output_func(self,sock,host,port,address):pass
de... | remremrem/EV-Tribute | world/Net/netbase.py | Python | mit | 6,335 |
"""navitron_system_kills.py: cronjob for snapshotting /universe/system_kills/"""
from os import path
from datetime import datetime
import warnings
import pandas as pd
import retry
import navitron_crons.exceptions as exceptions
import navitron_crons.connections as connections
import navitron_crons._version as _version... | j9ac9k/NavitronEve | crons/navitron_crons/navitron_system_stats.py | Python | mit | 5,545 |
<<<<<<< HEAD
<<<<<<< HEAD
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Fixer for exec.
This converts usages of the exec statement into calls to a built-in
exec() function.
exec code in ns1, ns2 -> exec(code, ns1, ns2)
"""
# Local imports
from .. import pytre... | ArcherSys/ArcherSys | Lib/lib2to3/fixes/fix_exec.py | Python | mit | 3,143 |
import mallet.hmm as h_mm
import mallet.state as state
# emissions
def emissions():
return [
{'A': 0.25, 'B': 0.25, 'C': 0.5},
{'A': 0.55, 'B': 0.15, 'C': 0.3},
{'A': 0.675, 'B': 0.20, 'C': 0.125},
{'B': 0.5, 'C': 0.5},
{'A': 0.0, 'B': 0.5, 'C': 0.5}
]
def invalid_... | undeadpixel/mallet | test/fixtures/hmm_fixtures.py | Python | mit | 1,846 |
import urllib.request, urllib
def get_challenge(s):
return urllib.request.urlopen('http://www.pythonchallenge.com/pc/' + s).read()
src = get_challenge('def/equality.html')
count = 0
lcount = 0
ucount = 0
print (src)
for i in src:
if i == i.uppercase():
count += 1
if count == 3 and i == i.lowercase() and ucount ==... | lockout87/Projects | Python/bodyguards.py | Python | mit | 510 |
template = '%.2f'%(fh_21) | shlopack/cursovaya | template/f_h_21.py | Python | mit | 25 |
# -*- coding:utf-8 -*-
import math
# 这个开始我还没有考虑dp什么那么多,自己想没有想出来,看了网上讨论.
# 假设台阶总是为100阶
# 分为51种情况,有0次两个台阶,有1次上两个台阶...有50次上两个台阶.
# 没有实现,太麻烦
# def count_stairs(n):
# if n % 2 == 0:
# count_2 = n / 2 + 1
# start = 3
# else:
# count_2 = (n + 1) / 2 + 1
# start = 2
#
# counts = 1... | xudongyangwork/algo | day8/xudy.py | Python | mit | 986 |
from random import choice
class RandomWalk():
"""class to generate random walks."""
def __init__(self, num_points=5000):
"""Initialize attributes of a walk"""
self.num_points = num_points
#All walks start from (0, 0)
self.x_values = [0]
self.y_values = [0]
def fi... | 4bic-attic/data_viz | random_walk.py | Python | mit | 1,179 |
import json
import random
from uuid import uuid1
from collections import defaultdict
import requests
schema_url = "http://localhost:5000/api/schema/"
experiment_url = "http://localhost:5000/api/sample/"
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
binary_schema = {
"default": 0,
"di... | diogo149/simbo | webapp/demo/binary.py | Python | mit | 1,214 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-27 19:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('posts', '0007_auto_20170327_1919'),
]
operations = [
migrations.AlterField(... | jokuf/hack-blog | posts/migrations/0008_auto_20170327_1923.py | Python | mit | 469 |
def makex():
threesixty(.5, -.5, 0.835)
wait(.2)
forward(1, 0.806)
wait(.1)
backward(1, 0.403)
wait(.1)
threesixty(1, -1, 0.835)
wait(.1)
forward(1, 0.403)
wait(.1)
backward(1, 0.806)
wait(.2)
threesixty(.5, -.5, 0.835)
... | pbardea/scribbler | finalPrj/notUsed/makex.py | Python | mit | 606 |
#!/usr/bin/env python
# by TR
from obspy.core import UTCDateTime as UTC
from sito.data import IPOC
from sito.noisexcorr import (prepare, get_correlations,
plotXcorrs, noisexcorrf, stack)
from sito import util
import matplotlib.pyplot as plt
from sito.stream import read
from multiprocessing ... | trichter/sito | bin/noise/noise_s_final_autocorr2.py | Python | mit | 5,012 |
# -*- coding: utf-8 -*-
"""
pid - example of PID control of a simple process with a time constant
Copyright (c) 2016 - RocketRedNeck.com RocketRedNeck.net
RocketRedNeck and MIT Licenses
RocketRedNeck hereby grants license for others to copy and modify this source code for
whatever purpose other's deem worthy as l... | RocketRedNeck/PythonPlayground | pid_dot.py | Python | mit | 2,665 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-10-26 14:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Occupanc... | christianknu/eitu | eitu/migrations/0001_initial.py | Python | mit | 662 |
import yaml
from core.AbstractConfig import AbstractConfig
class YamlConfig(AbstractConfig):
def __init__(self, config_path):
self.path = config_path
with open(config_path) as fr:
self.conf = yaml.load(fr)
pass
def get_dict(self):
return self.conf
| john123951/gold.icbc.watcher | src/util/YamlConfig.py | Python | mit | 304 |
#!/usr/bin/python2
# Copyright (C) 2011 by Ondrej Martinak <omartinak@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the righ... | omartinak/cfree | cfree.py | Python | mit | 1,303 |
"""
Basic IRT support for assessment items
"""
from dlkit.json_.osid.metadata import Metadata
from dlkit.abstract_osid.assessment import record_templates as abc_assessment_records
from dlkit.abstract_osid.osid.errors import IllegalState, InvalidArgument
from ...osid.base_records import DecimalValuesRecord,\
Deci... | mitsei/dlkit | dlkit/records/assessment/analytic/irt.py | Python | mit | 7,495 |
# -*- coding: utf-8 -*-
"""'Books' part of product categories dictionary.
Must hold subcategories of 'Books'
category in the form of python dictionary data type.
"""
books = {('books', 'книги'): {
('audiobooks', 'аудиокниги'): {
('biography', 'биографии'): {},
('business, economics', 'бизнес, экон... | redmoo-info/proddict | ru/books.py | Python | mit | 8,821 |
from rest_framework import serializers
from bulbs.utils.fields import RichTextField
from bulbs.utils.data_serializers import CopySerializer, EntrySerializer, BaseEntrySerializer
from .fields import ColorField
class XYEntrySerializer(BaseEntrySerializer):
title = RichTextField(required=False, field_size="short")
... | theonion/django-bulbs | bulbs/infographics/data_serializers.py | Python | mit | 1,619 |
from utilities.compression import SoSCompression
class SparqlDecompress:
"""Performs SPARQL sos-decompression"""
name = "SparqlCompress"
description = "Performs SPARQL sos-decompression"
@staticmethod
def execute(token):
message = token.message
body = message.get_body()
d... | onnovalkering/sparql-over-sms | sos-service/src/processing/filters/sparqldecompress.py | Python | mit | 635 |
from os import walk
from definitions import Config
class Walker(object):
def __init__(self, directory):
super(Walker, self).__init__()
cfg = Config()
for (_path, _file, _archives) in walk(cfg.globals['root'] + directory):
pass
self.archives = _archives
| innusource/siteg.py | _app/walker.py | Python | mit | 303 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2020-09-10 14:23
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("chroma_core", "0024_mountsnapshotjob_unmountsnapshotjob"),... | intel-hpdd/intel-manager-for-lustre | chroma_core/migrations/0025_createsnapshotjob_destroysnapshotjob.py | Python | mit | 2,819 |
"""
================
:mod:`variators`
================
.. Copyright 2012 Aaron Garrett
.. Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction... | aarongarrett/inspyred | inspyred/ec/variators/variators.py | Python | mit | 1,660 |
# Created By: Virgil Dupras
# Created On: 2004/12/07
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses... | jmtchllrx/pyMuse | src/hsaudiotag/id3v1.py | Python | mit | 2,528 |
from rest_framework.views import APIView
from rest_framework import viewsets
from game.serializers import *
from rest_framework.response import Response
from game.models import *
from rest_framework.permissions import IsAuthenticated
from django.shortcuts import get_object_or_404
from django.http import Http404
class ... | codyparker/channels-obstruction | game/views/api_views.py | Python | mit | 2,229 |
#Decorators
from django.http import HttpResponseRedirect
from gameheart.entities.models import UserProfile
def check_terms(function):
def wrap(request, *args, **kwargs):
profile = UserProfile.objects.get(user=request.user)
if profile.acceptedterms == False:
action = request.path_info
... | undergroundtheater/gameheart | gameheart/entities/decorators.py | Python | mit | 570 |
from __future__ import (
unicode_literals,
absolute_import,
print_function,
division,
)
from aaf2.auid import AUID
from uuid import UUID
import uuid
import unittest
class MobIDTests(unittest.TestCase):
def test_basic(self):
s = "0d010101-0101-2100-060e-2b3402060101"
v = AUID(s... | markreidvfx/pyaaf2 | tests/test_auid.py | Python | mit | 1,210 |
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from django import forms
class UserRegistrationForm(UserCreationForm):
class Meta:
model = User
fields = ('username', 'email',)
| cscanlin/munger-builder | munger_builder/forms.py | Python | mit | 269 |
# coding: utf-8
from google.appengine.ext import ndb
from flask.ext import restful
import flask
from api import helpers
import auth
import model
import util
from main import api_v1
###############################################################################
# Admin
##############################################... | lipis/the-smallest-creature | main/api/v1/song.py | Python | mit | 1,226 |
# Create your views here.
from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404
from django.http import Http404
from echo.models import Comment, Reply, CategoryMeta
from echo.forms import RegistrationForm, ConfirmRegistration
from django.core.urlresolvers import reverse
from django.http im... | robneville73/OpenEcho | echo/views.py | Python | mit | 6,048 |
import MuseScoreHelper as MuseScore
import SerialHelper
while True:
# Print a menu of available operations
print ("AVAILABLE OPERATIONS:")
print (" 1. Connect Device\n")
print (" 2. Load Music File\n")
print (" 3. Exit Program\n")
# Loop until valid input is provided
while True:... | justephens/ArduMusic | ArduMusic.py | Python | mit | 3,240 |
#!/home/dark/Exile/Git/AutoLavadox/maq_autolavadox/bin/python
"""PILdriver, an image-processing calculator using PIL.
An instance of class PILDriver is essentially a software stack machine
(Polish-notation interpreter) for sequencing PIL image
transformations. The state of the instance is the interpreter stack.
The ... | exildev/AutoLavadox | maq_autolavadox/bin/pildriver.py | Python | mit | 15,553 |
import pytest
sa = pytest.importorskip("sqlalchemy")
import os
import responses
import flask
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import event
from flask_caching import Cache
from flask_login import LoginManager, UserMixin, current_user, login_user, logout_user
from flask_dance.consumer import OAut... | singingwolfboy/flask-dance | tests/consumer/storage/test_sqla.py | Python | mit | 24,167 |
# -*- coding: utf-8 -*-
__author__ = 'eso'
import sys
sys.path.append('../../')
from tools.petscan import PetScan
import re
import requests
import pywikibot
list_of_pages =[1134,
1135,
1136,
1137,
1138,
1139,
1140,
... | the-it/WS_THEbotIT | archive/online/2015/150914_add_pages_Saint_Germain.py | Python | mit | 3,440 |
"""LombardiSpirograph - draw rotationally symmetric drawings in Lombardi style
David Eppstein, UC Irvine, March 2010
For usage information type "python LombardiSpirography.py"
without any additional arguments.
"""
from pyx import canvas,path,color
from optparse import OptionParser
from math import *
import sys
# ===... | MHenderson/graph-visualisations | lib/lombardi/LombardiSpirograph.py | Python | mit | 18,845 |
# -*- coding: utf-8 -*-
import os
import pygame
from pygame.locals import *
class Sprite(pygame.sprite.Sprite):
def __init__(self,SpriteName):
pygame.sprite.Sprite.__init__(self)
self.Name = SpriteName
self.rect = 0
self.image = 0
def getRect(self):
return self.rect
... | vtungn/HackaPanzer | Sprite.py | Python | mit | 2,212 |
# how many routes are in a 20x20 lattice grid?
import time
start_time = time.clock()
field = []
sum = 0
for n in range(0,21):
field.append([1])
for i in range(1,21):
sum = field[n][i-1]
if n>0: sum += field[n-1][i]
field[n].append(sum)
print(field[20][20])
print("--- %s seconds ---" %... | Selen93/ProjectEuler | Python/Problem 15/Problem 15.py | Python | mit | 349 |
"""empty message
Revision ID: 3cee55aae20
Revises: None
Create Date: 2015-08-30 22:42:28.320071
"""
# revision identifiers, used by Alembic.
revision = '3cee55aae20'
down_revision = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
### commands auto g... | theMentalItchGuy/NLP | migrations/versions/3cee55aae20_.py | Python | mit | 847 |
#!/usr/bin/env python2
# Imports
import json
import datetime
from bin import monitor, register
from ClientSettings import ClientSettings
from ClientSettings import constants
import dataCollector
import settings
import time
import sys
Monitor = monitor.Monitor()
message1 = "Client script running on version: {0}".form... | Evert-Arends/AuroraPlusClient | run.py | Python | mit | 5,859 |
import importlib
import json
from .base import MongoEnginericsAdapter
class ApistarWSGIAdapter(MongoEnginericsAdapter):
def __init__(self, *args, **kwargs):
self.engine = importlib.import_module('apistar')
self._wsgi = importlib.import_module('apistar.frameworks.wsgi')
super(ApistarWSGIAda... | monumentum/mongoenginerics | mongoenginerics/adapter/apistar.py | Python | mit | 1,346 |
# -*- coding: utf-8 -*-
""" Module for making calls to EPO-OPS REST-API.
This module contain classes and functions to get data from
[EPO-OPS API](http://www.epo.org/searching-for-patents/technical/espacenet/ops.html)
"""
import logging
import re
import time
from base64 import b64encode
from collections import namedtup... | clicumu/epo_utils | epo_utils/api.py | Python | mit | 20,708 |
import logging
import message
import os
import random
import datetime
import time
import collections
from google.appengine.ext.webapp import template
try: import simplejson as json
except ImportError: import json
from abstract_app import AbstractApp
class CmdrData(AbstractApp):
# A user who has authorized your a... | PullRequestFive/CmdrData | cmdrdata/cmdrdata.py | Python | mit | 1,690 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding unique constraint on 'Ratings', fields ['user', 'page']
db.creat... | haystack/eyebrowse-server | api/migrations/0046_auto__add_unique_ratings_user_page.py | Python | mit | 16,679 |
"""
https://open.kattis.com/problems/easiest
"""
import sys
def sum_digits(number):
sum_of_digits = 0
while number:
sum_of_digits, number = sum_of_digits + number % 10, number // 10
return sum_of_digits
for line in sys.stdin:
n = int(line)
if n == 0:
break
p = 11
while... | cstewart90/kattis-python | easiest/easiest.py | Python | mit | 428 |
#!/usr/bin/python
import pygame
import random
import math
from lib.GameObjects import Player, Enemy
from lib.Globals import Vars, FixPath, UnitType, TileImage
from lib.Pathing import MovementPath
from lib.EventHandler import JoyHandler, KeyHandler
from lib.Effects import Explosion
from lib.Menu import *
from lib.Logge... | zorchenhimer/NoudaEngine | lib/Level.py | Python | mit | 9,721 |
"""
homeassistant.components.device_tracker.actiontec
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Device tracker platform that supports scanning an Actiontec MI424WR
(Verizon FIOS) router for device presence.
This device tracker needs telnet to be enabled on the router.
Configuration:
To use the Action... | EricRho/home-assistant | homeassistant/components/device_tracker/actiontec.py | Python | mit | 6,633 |
from ..sqlclear import SQLClearCommand as Command
| skibblenybbles/django-commando | commando/django/core/management/commands/sqlclear.py | Python | mit | 50 |
#!/usr/bin/env ipython
# -*- coding: utf-8 -*-
from datetime import datetime, time, timedelta
import numpy as np
import console_colors as ccl
from scipy.io.netcdf import netcdf_file
from ShiftTimes import ShiftCorrection, ShiftDts
import os, argparse
import h5py
from h5py import File as h5
from numpy import (
mean... | jimsrc/seatos | shared_lib/shared_funcs.py | Python | mit | 54,269 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mathathon.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| randpdevs/chopper | manage.py | Python | mit | 252 |
dictionary = {"GEEKS", "FOR", "QUIZ", "GO"}
N, M = 3, 3
board = [['G','I','Z'],
['U','E','K'],
['Q','S','E']]
class Graph:
class Vertex:
def __int__(self, v):
self.val = v
self.adj = []
def findWords(board=board):
def search(node, word, visited):
if node not in visited:
visited.appen... | carlb15/Python | boggle.py | Python | mit | 785 |
#!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
from geocoder.osm import Osm
from geocoder.w3w import W3W
from geocoder.bing import Bing
from geocoder.here import Here
from geocoder.yahoo import Yahoo
from geocoder.baidu import Baidu
from geocoder.tomtom import Tomtom
from geocoder.arcgis impo... | miraculixx/geocoder | geocoder/api.py | Python | mit | 11,482 |
from django.conf.urls.defaults import patterns, url
from urls import urlpatterns as main_patterns
ALL_VERSIONS_RE = '(?P<version>.+)'
urlpatterns = patterns(
'', # base view, flake8 complains if it is on the previous line.
url('^$',
'djangome.views.redirect_home',
{'version': 'latest'}),
... | phalcon/readthedocs.org | readthedocs/core/djangome_urls.py | Python | mit | 821 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-batch/azure/batch/models/task_id_range.py | Python | mit | 1,362 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from wtforms.fields import BooleanField, SelectField, TextAreaField
from wtforms.validators import DataReq... | ThiefMaster/indico | indico/modules/events/reminders/forms.py | Python | mit | 5,113 |
import os
from click import confirm
from getgist import GetGistCommons
class LocalTools(GetGistCommons):
"""Helpers to deal with local files and local file system"""
def __init__(self, filename, assume_yes=False):
"""
Sets the file name to be used by the instance.
:param filename: (... | cuducos/getgist | getgist/local.py | Python | mit | 2,630 |
from fastapi.testclient import TestClient
from docs_src.metadata.tutorial001 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {
"title": "ChimichangApp",
"description": "\nChimichangApp API helps you do awesome stuff. 🚀\n\n## Items\n\nYou can **read items**.... | tiangolo/fastapi | tests/test_tutorial/test_metadata/test_tutorial001.py | Python | mit | 1,611 |
from marshmallow import post_load
from marshmallow_sqlalchemy import field_for
from models import ma, User, Device, Measurement
class UserSchema(ma.Schema):
id = field_for(User, 'id', dump_only=True)
class Meta:
# Fields to expose
fields = ('id', 'name', 'username')
model = User
@... | KMSkelton/cgm_flask | schema.py | Python | mit | 920 |
#coding:utf8
"""
yet another logging wrapper
- log level
logging.CRITICAL,
logging.ERROR,
logging.WARNING,
logging.INFO,
logging.DEBUG
"""
import logging
from config import PROJECT_ROOT
def configLogger(logFile="spider.log", logLevel=logging.DEBUG, logTree=""):
logFile = PROJECT_ROOT+"/log/"+ logF... | zhkzyth/a-super-fast-crawler | logmanager.py | Python | mit | 783 |
{
"uidPageMap": {
W3Const.w3PropType: W3Const.w3TypePanel,
W3Const.w3PropSubUI: [
"uidMSMap"
]
},
# Map
"uidMSMap": {
W3Const.w3PropType: W3Const.w3TypeMap,
W3Const.w3PropMap: {
W3Const.w3AttrMapLocation: "",
W3Const.w3Att... | eddiedb6/ej | web/metadata/EJUIMapPage.py | Python | mit | 493 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-batch/azure/batch/models/cloud_job.py | Python | mit | 9,338 |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseForbidden, \
HttpResponseRedirect, HttpResponseBadRequest, HttpResponseNotAllowed
import logging
log = logging.getLogger('client_app')
# Create your views here.
from .oauthclient import *
OAUTH_URL = 'http://192.168.243.5:3900... | Boris-Barboris/rsoi | lab01/client/client_app/views.py | Python | mit | 2,533 |
from __future__ import annotations
import cmath
import numpy as np
import psutil
import ray
import scipy.special as ssp
from pymwm.utils import cylinder_utils
from pymwm.waveguide import Database, Sampling, Waveguide
from .samples import Samples, SamplesForRay, SamplesLowLoss, SamplesLowLossForRay
class Cylinder(... | mnishida/PyMWM | src/pymwm/cylinder/__init__.py | Python | mit | 26,692 |
# -*- coding: utf-8 -*-
import logging
from django.utils.deprecation import MiddlewareMixin
from .shortcuts import get_oauth2_app
from .toolkit_settings import API_VERSION, MIDDLEWARE_ACCESS_LOG_FORMAT
logger = logging.getLogger(__name__)
class VersionHeaderMiddleware(MiddlewareMixin):
"""
Add a X-API-Vers... | luizalabs/django-toolkit | django_toolkit/middlewares.py | Python | mit | 1,039 |
"""
WSGI config for WeatherForecast 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/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJA... | vinicius-ronconi/WeatherForecast | WeatherForecast/wsgi.py | Python | mit | 408 |
from qtpy.QtWidgets import QDialog
from qtpy import QtGui
from addie.utilities import load_ui
class SaveSqDialogMessageDialog(QDialog):
def __init__(self, main_window=None):
self.main_window = main_window
QDialog.__init__(self, parent=main_window)
self.ui = load_ui('save_sq_information_d... | neutrons/FastGR | addie/calculate_gr/save_sq_dialog_message.py | Python | mit | 504 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-24 17:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.manager
class Migration(migrations.Migration):
dependencies = [
('cadastro', '0001_initial'),
]
operations = [
... | HerlanAssis/scosi | cadastro/migrations/0002_auto_20160224_1443.py | Python | mit | 1,256 |
#!/usr/bin/env python2
#
# wsi_bot_codebook3
#
# Version 3 of codebook construction:
#
# -uses OpenCV for faster operation - but different local descriptors than in the 1st version;
# -uses annotation files for defining the regions from where the descriptors are to be
# extracted
# - try to optimize the codebook with... | vladpopovici/WSItk | WSItk/tools/wsi_bot_codebook3.py | Python | mit | 7,170 |
from django.contrib import admin
# Register your models here.
from .models import Engine
admin.site.register(Engine) | electblake/python-lipsumation | lipsumation/engines/admin.py | Python | mit | 119 |
import _plotly_utils.basevalidators
class MinexponentValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self,
plotly_name="minexponent",
parent_name="scattergeo.marker.colorbar",
**kwargs
):
super(MinexponentValidator, self).__init__(
plo... | plotly/plotly.py | packages/python/plotly/plotly/validators/scattergeo/marker/colorbar/_minexponent.py | Python | mit | 503 |
# coding=utf8
class Error(Exception):
pass
class TitleRequiredError(Error):
pass
class TextRequiredError(Error):
pass
class APITokenRequiredError(Error):
pass
class GetImageRequestError(Error):
pass
class ImageUploadHTTPError(Error):
pass
class FileTypeNotSupported(Error):
pass... | mercuree/html-telegraph-poster | html_telegraph_poster/errors.py | Python | mit | 1,361 |
import os
import sys
import time
sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
import pyfbi
@pyfbi.target
def func1():
time.sleep(1)
def func2():
time.sleep(2)
@pyfbi.target
def func3():
time.sleep(3)
with pyfbi.watch():
[f() for f in (func1, func2, func3)]
pyfbi.show()
with py... | icoxfog417/pyfbi | tests/demo.py | Python | mit | 404 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/timeseriesinsights/azure-mgmt-timeseriesinsights/azure/mgmt/timeseriesinsights/aio/__init__.py | Python | mit | 574 |
from item import Item
import random
from floatingText import FloatingText,FloatingTextManager
from playerConsole import PlayerConsole
from serializable import Serializable
from eventRegistry import Event
from eventRegistry import EventRegistry
class Inventory(Serializable):
INV_SIZE_X = 10
INV_SIZE_Y = 3
... | benjamincongdon/adept | inventory.py | Python | mit | 6,093 |
#coding:utf-8
#################################
#Copyright(c) 2014 dtysky
#################################
import G2R
class ScSp(G2R.SpSyntax):
def Show(self,Flag,Attrs,US,UT,Tmp,FS):
sw=''
name,Attrs=self.Check(Flag,Attrs,UT,FS)
if Attrs['k']=='Main':
sw+=' $ store.chapter='
sw+="'Chapter."+Attrs['cp... | dtysky/Gal2Renpy | Gal2Renpy/SpSyntax/ScSp.py | Python | mit | 352 |
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE','tango_with_django_project.settings')
import django
django.setup()
from rango.models import Category, Page
def populate():
# First, we will create lists of dictionaries containing the pages
# we want to add into each category.
# Then we will create... | cclai999/rango | tango_with_django_project/populate_rango.py | Python | mit | 3,340 |
from unittest import TestCase
from CodeEval.challenge_7 import challenge
class Challenge7Test(TestCase):
def test_input_1(self):
self.assertEqual(5, challenge("- * / 15 - 7 + 1 1 3 + 2 + 1 1"))
def test_input_2(self):
self.assertEqual(20, challenge("* + 2 3 4")) | andrewzwicky/puzzles | CodeEval/test_challenge_7.py | Python | mit | 289 |
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
import tensorflow as tf
sess = tf.InteractiveSession()
x = tf.placeholder(tf.float32, shape=[None, 784])
y_ = tf.placeholder(tf.float32, shape=[None, 10])
W = tf.Variable(tf.zeros([784,10]))
b = t... | StephanH84/reinforcement_learning_explorations | tensorflow/src/MNIST1.py | Python | mit | 912 |
from pqhelper import base, capture, versus
# these parts are heavy so keep one common object for the module
_state_investigator = base.StateInvestigator()
def versus_summaries(turns=2, sims_to_average=2, async_results_q=None):
"""Return summaries of the likely resutls of each available action..
Arguments:
... | kobejohn/PQHelper | pqhelper/easy.py | Python | mit | 2,931 |
"""Convenient imports"""
from pswingw2.client import send_simple_message # noqa
from pswingw2.client import send # noqa
from pswingw2.client import send_single # noqa
from pswingw2.client import send_batch # noqa
from pswingw2.client import Client # noqa
from pswingw2.config_defaults import get_simple_config as c... | ZettaIO/pswingw2py | pswingw2/__init__.py | Python | mit | 334 |
from django.conf.urls import url
from articles import views
urlpatterns = [
url(r'^$', views.list_all, name='articles'),
url(r'^(?P<id>[0-9]+)/$', views.article, name='article'),
url(r'^admin/$', views.admin, name='admin_articles'),
url(r'^add/$', views.add, name='add_article'),
url(r'^delete/$', ... | Dubrzr/golb | articles/urls.py | Python | mit | 774 |
# Copyright (C) 2011 by Stefano Palazzo
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish,... | sfstpala/png.py | png.py | Python | mit | 2,602 |
# coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import r... | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | orcid_api/models/credit_name.py | Python | mit | 2,882 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_11_01/operations/_private_link_resources_operations.py | Python | mit | 5,923 |
import ply.yacc as yacc
from bsi_lexer import tokens
from bsi_object import BsiObject
from bsi_array import BsiArray
def p_object_pairs(p):
'obj : pairs'
p[0] = BsiObject()
for pair in p[1]:
p[0].set(pair[0], pair[1])
def p_pairs_pair(p):
'pairs : pair'
p[0] = [p[1]]
def p_pairs_pair_pair... | jshou/bsi | bsi/bsi_parser.py | Python | mit | 930 |
"""Build a sentiment analysis / polarity model
Sentiment analysis can be casted as a binary text classification problem,
that is fitting a linear classifier on features extracted from the text
of the user messages so as to guess wether the opinion of the author is
positive or negative.
In this examples we will use a ... | gnublet/py_explorations | sklearn/exercise_02_sentiment.py | Python | mit | 4,170 |
#-*- coding: UTF-8 -*-
import os
import web
import sys
sys.path.append("..")
import News_Recommend
import similar_doc
import jieba
import config
import word2Vec.word2vec as Word2Vec
path="../data/netease"
query=News_Recommend.CosineScore(path+config.inverted_Dictionary_filename,path+config.inverted_index_filename,conf... | Google1234/Information_retrieva_Projectl- | web/main.py | Python | mit | 4,577 |
"""Exceptions for APIs."""
import werkzeug.exceptions
class ApiException(Exception):
"""An exception raised due to user error.
Exceptions derived from ApiException will be logged automatically if raised.
User will receive appropriate error response according to the content type.
"""
descriptio... | paylogic/atilla | atilla/exceptions.py | Python | mit | 1,492 |
from django.db import models
from phonenumber_field.modelfields import PhoneNumberField
class PhoneNumber(models.Model):
provider = models.ForeignKey(
to='providers.Provider'
)
phone_number = PhoneNumberField()
| aniruddha-adhikary/bookit | bookit/providers/models/phone_number.py | Python | mit | 235 |
"""
Blackboard Analysis Tools
Copyright 2013, Jeroen Doggen, jeroendoggen@gmail.com
"""
import sys
from blackboard_analysis_tools.blackboard import BlackboardAnalysisTools
def run():
"""Run the main program"""
assignment_analyser = BlackboardAnalysisTools()
#assignment_analyser.init()
assign... | jeroendoggen/blackboard-analysis-tools | blackboard_analysis_tools/main.py | Python | mit | 434 |
from __future__ import unicode_literals
import base64
import binascii
import hashlib
import importlib
from collections import OrderedDict
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.signals import setting_changed
from django.dispatch import rece... | diego-d5000/MisValesMd | env/lib/python2.7/site-packages/django/contrib/auth/hashers.py | Python | mit | 17,840 |
from pytest import fixture
from itertools import combinations
import msgpack as pymsgpack
values = [
42, 7, 3.14, 2.71, 'lorem', 'ipsum', True, False, None, b'lorem', b'ipsum', [], [
'lorem', 42, 3.14, True, None, ['ipsum']], dict(), {
'lorem': 'ipsum', 'dolor': 42, 'sit': 3.14, 'amet': [
... | attugit/cxxjson | test/conftest.py | Python | mit | 587 |
from heapq import heapify, heappush, heappop
class priority_dict(dict):
"""Dictionary that can be used as a priority queue.
Keys of the dictionary are items to be put into the queue, and values
are their respective priorities. All dictionary methods work as expected.
The advantage over a standard heap... | ActiveState/code | recipes/Python/522995_Priority_dict_priority_queue_updatable/recipe-522995.py | Python | mit | 2,795 |
"""
vue2svg : spike/prototype for scenetool.
generates an svg scene from VUE files specified on command line.
usage:
python3.2 vue2svg.py ../test/vue/*.vue
https://github.com/tangentstorm/scenetool
copyright (c) 2013 michal j wallace.
available to the public under the MIT/x11 license. (see ../LICENSE)
"""
import o... | tangentstorm/scenetool | spike/vue2svg.py | Python | mit | 5,403 |
from staffjoy.resource import Resource
from staffjoy.resources.location import Location
from staffjoy.resources.admin import Admin
from staffjoy.resources.organization_worker import OrganizationWorker
class Organization(Resource):
PATH = "organizations/{organization_id}"
ID_NAME = "organization_id"
def g... | Staffjoy/client_python | staffjoy/resources/organization.py | Python | mit | 959 |
# coding=utf-8
import logging
import time
from adapter import Adapter
DROIDBOT_APP_PACKAGE = "io.github.ylimit.droidbotapp"
IME_SERVICE = DROIDBOT_APP_PACKAGE + "/.DroidBotIME"
class DroidBotImeException(Exception):
"""
Exception in telnet connection
"""
pass
class DroidBotIme(Adapter):
"""
... | nastya/droidbot | droidbot/adapter/droidbot_ime.py | Python | mit | 3,282 |
from __future__ import annotations
import operator
from collections import defaultdict
from contextlib import ExitStack
from datetime import datetime, timedelta, timezone
from logging import Logger, getLogger
from typing import Any, Callable, ClassVar, Iterable
from uuid import UUID
import attrs
import pymongo
import... | agronholm/apscheduler | src/apscheduler/datastores/mongodb.py | Python | mit | 19,667 |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import pytest
import functools
from devtools_testutils.aio import recorded_by_proxy_async
from azure.ai.formrecognizer._generated.models import AnalyzeRe... | Azure/azure-sdk-for-python | sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dac_analyze_general_document_async.py | Python | mit | 8,184 |
import os
import unittest
import xcube.core.store as xcube_store
from cate.core.ds import DATA_STORE_POOL
def _create_test_data_store_config(name: str):
local_test_store_path = \
os.path.join(os.path.dirname(__file__), 'ds', 'resources', 'datasources', name)
local_test_store_dict = {
"store_i... | CCI-Tools/cate-core | tests/storetest.py | Python | mit | 1,590 |
from gusto import *
from gusto import thermodynamics
from firedrake import (PeriodicIntervalMesh, ExtrudedMesh,
SpatialCoordinate, conditional, cos, pi, sqrt, NonlinearVariationalProblem,
NonlinearVariationalSolver, TestFunction, dx, TrialFunction, Constant, Function,
... | firedrakeproject/gusto | examples/moist_bf_bubble.py | Python | mit | 7,797 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.