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
#!/usr/bin/env python from setuptools import setup from gun import __version__ setup( name = 'gun', version = __version__, description = 'Gentoo Updates Notifier', author = 'Andriy Yurchuk', author_email = 'ayurchuk@minuteware.net', url = 'https://github.com/Ch00k/gun', licen...
Ch00k/gun
setup.py
Python
mit
728
#!/usr/bin/python # -*- coding: UTF-8 -*- # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: import os from setuptools import setup, find_packages def get_version(): basedir = os.path.dirname(__file__) with open(os.path.join(basedir, 'instapush/version.py')) as f: locals = {} exec(f.rea...
adamwen829/instapush-py
setup.py
Python
mit
894
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-14 17:12 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('volunteers', '0001_initial'), ] operations = [ migrations.RenameField( ...
NewsNerdsAtCoJMC/ProjectTicoTeam6
service/volunteers/migrations/0002_auto_20170314_1712.py
Python
mit
424
import command command_list = ["joke","weather","play","pause","stop","skip","light","security","created","name","mood","selfie"] def interpret(s): print "meow" for cmd in command_list: if s.find(cmd) != -1: print cmd return command.Command(cmd).do()
TrevorEdwards/Jauffre
jauffre/interpreter.py
Python
mit
284
# This file is part of Indico. # Copyright (C) 2002 - 2022 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 StringField from wtforms.validators import DataRequired from wtforms_sqlalchemy...
indico/indico
indico/modules/events/tracks/forms.py
Python
mit
2,016
#!/usr/bin/env python # -*- coding: utf-8 -*- # # pysia documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autog...
jnmclarty/pysia
docs/conf.py
Python
mit
8,373
""" Django settings for myproject project. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) ...
easyCZ/SLIP-A-2015
api/wsgi/src/project/settings.py
Python
mit
4,305
from distutils.core import setup long_description = """ `termtool` helps you write subcommand-based command line tools in Python. It collects several Python libraries into a declarative syntax: * `argparse`, the argument parsing module with subcommand support provided in the standard library in Python 2.7 and later....
markpasc/termtool
setup.py
Python
mit
1,440
from django.conf.urls import patterns, include, url from django.conf import settings # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^$', 'schwag.views.home', name='home'), url(r'^...
endthestart/schwag
schwag/schwag/urls.py
Python
mit
1,849
#!/usr/bin/env python from tasks import * from math import cos, sin, pi import rospy from signal import signal, SIGINT from geometry_msgs.msg import Point import sys def signal_handler(signal, frame): print('You pressed Ctrl+C') print('Leaving the Controller & closing the UAV') Controller.__exi...
AlexisTM/Indoor_Position_lasers
laserpack/bin/Scenari/scenario_circle.py
Python
mit
1,452
# 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/__init__.py
Python
mit
2,687
from __future__ import ( unicode_literals, absolute_import, division, print_function, ) # Make Py2's str type like Py3's str = type('') # Rules that take into account part of speech to alter text structure_rules = [ ((["JJ*","NN*"],), (["chuffing",0,1],), 0.1), ((["."],),...
safehammad/mancify
mancify/dialects/manc.py
Python
mit
7,080
from thrift import Thrift from thrift.transport import TSocket from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol from thrift.server import TServer import threading from wpwithin.WPWithinCallback import Client from wpwithin.WPWithinCallback import Processor class CallbackHandler: d...
WPTechInnovation/worldpay-within-sdk
wrappers/python_2-7/EventServer.py
Python
mit
3,460
"""Base command for search-related management commands.""" from __future__ import annotations import argparse import builtins import logging from typing import Any, Optional, Union from django.core.management.base import BaseCommand from elasticsearch.exceptions import TransportError CommandReturnType = Optional[Uni...
yunojuno/elasticsearch-django
elasticsearch_django/management/commands/__init__.py
Python
mit
2,479
"""Tests for GP and SP classes""" import math import unittest import numpy as np from gpkit import (Model, Monomial, settings, VectorVariable, Variable, SignomialsEnabled, ArrayVariable) from gpkit.geometric_program import GeometricProgram from gpkit.small_classes import CootMatrix from gpkit.feasibi...
galbramc/gpkit
gpkit/tests/t_model.py
Python
mit
14,190
#!/usr/bin/env python import sys def convert_str(infile, outfile): f = open(infile, 'r') lines = f.readlines() f.close() f = open(outfile, 'w') f.writelines(['"%s\\n"\n' % i.rstrip() for i in lines]) f.close() def main(): convert_str('fountain.vert', 'fountain.vert.inc') convert_str('...
fountainment/FountainEngineImproved
fountain/render/convert_shader.py
Python
mit
396
# -*- coding: utf-8 -*- # # complexity documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # ...
DES-SL/EasyLens
docs/conf.py
Python
mit
8,340
"""Global variables for testing.""" from pathlib import Path from calcipy.file_helpers import delete_dir, ensure_dir from calcipy.log_helpers import activate_debug_logging from recipes import __pkg_name__ activate_debug_logging(pkg_names=[__pkg_name__], clear_log=True) TEST_DIR = Path(__file__).resolve().parent ""...
KyleKing/recipes
tests/configuration.py
Python
mit
758
import os, glob import operator import h5py import numpy as np import matplotlib.pyplot as plt def get_time_potential_charge_absrbd_on_anode_from_h5( filename ): h5 = h5py.File( filename, mode="r") absorbed_charge = h5["/InnerRegions/anode"].attrs["total_absorbed_charge"][0] time = h5["/TimeGrid"].attrs["c...
epicf/ef
examples/diode_childs_law/plot.py
Python
mit
1,764
# 二分查找,这题应该归为 easy class Solution(object): def searchInsert(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ end_index = len(nums)-1 start_index = 0 while True: if start_index > len(nums)-1: r...
zhangziang/MyLeetCodeAlgorithms
python/35-search_insert_position.py
Python
mit
732
#!/usr/bin/env python """ |jedi| is mostly being tested by what I would call "Blackbox Tests". These tests are just testing the interface and do input/output testing. This makes a lot of sense for |jedi|. Jedi supports so many different code structures, that it is just stupid to write 200'000 unittests in the manner of...
rfguri/vimfiles
bundle/ycm/third_party/ycmd/third_party/JediHTTP/vendor/jedi/test/run.py
Python
mit
14,446
from django.conf.urls import url from fundraiser_app import views urlpatterns = [ url(r'^$', views.FMItemListView.as_view(), name='fmitem_list'), url(r'^about/$', views.AboutView.as_view(), name='about'), url(r'^fmitem/(?P<pk>\d+)$', views.FMItemDetailView.as_view(), name='fmitem_detail'), url(r'^fmite...
CarlGraff/fundraisermemorial
fundraiser_app/urls.py
Python
mit
663
from django.http import HttpResponse def hello(request): return HttpResponse("Hello world ! ")
battlecat/Spirit
HelloWorld/HelloWorld/view.py
Python
mit
96
from __future__ import absolute_import, unicode_literals import os from celery import Celery # set the default Django settings module for the 'celery' program. os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'celcius.settings') app = Celery('celsius') # Using a string here means the worker doesn't have to serialize ...
cytex124/celsius-cloud-backend
src/celsius/celery.py
Python
mit
623
import numbers import numpy import cupy ############################################################################### # Private utility functions. def _round_if_needed(arr, dtype): """Rounds arr inplace if the destination dtype is an integer. """ if cupy.issubdtype(dtype, cupy.integer): arr....
cupy/cupy
cupy/_padding/pad.py
Python
mit
29,422
import sys from pymongo import MongoClient from werkzeug.utils import secure_filename import os import sys client = MongoClient('mongodb://localhost:27017/') db = client.ir #li=[] #color=open("AllColors.txt","r") doc1=[] doc2=[] edgeConWT=[] edgeElaWT=[] edgeStart=[] edgeEnd=[] path="JVcode/Scripts/ForClassification/" ...
ramaganapathy1/AMuDA-Ir-back-end
production/JVcode/Scripts/ForClassification/ela-sep.py
Python
mit
2,166
from .util import to_datetime, to_iso from .http import request from .exceptions import KloudlessException as KException from . import config import inspect import json import requests import six import warnings class BaseResource(dict): # {'key': (serializer, deserializer)} _serializers = { 'create...
Kloudless/kloudless-python
kloudless/resources.py
Python
mit
35,586
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals from .exceptions import TransactionValidationError AVAIABLE_PAYMENT_METHOD = ['credit_card', 'boleto'] def validate_transaction(attrs): if len(attrs) <= 0: raise TransactionValidationError('Need a vali...
devton/pagarme-py
pagarme/transaction.py
Python
mit
1,490
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/ # generate server.xml with the following command: # openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes # run as follows: # python simple-https-server.py # then in your browser, visit: # https://localhost:4443 ...
shawnlawson/The_Force
pythonBridge/simple-https-server.py
Python
mit
581
# 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/operationsmanagement/azure-mgmt-operationsmanagement/azure/mgmt/operationsmanagement/aio/_configuration.py
Python
mit
4,167
import pdb #!python # -*- coding: utf-8 -*- """File: visual.py Description: This module contains visualizing method for geo data History: 0.1.0 The first version. """ __version__ = '0.1.0' __author__ = 'SpaceLis' import dataset from anatool.dm.db import GEOTWEET import text_util from operator im...
spacelis/anatool
anatool/dm/visual.py
Python
mit
6,377
import re from threading import Thread import time from django.core.management.base import BaseCommand import requests from mittab.apps.tab.models import Round, TabSettings from mittab.apps.tab.management.commands import utils class Command(BaseCommand): help = "Load test the tournament, connecting via localhos...
jolynch/mit-tab
mittab/apps/tab/management/commands/load_test.py
Python
mit
4,345
# coding:utf-8 # Create your views here. from django.shortcuts import render from django.http import HttpResponse from arrow_time import today_date_for_influxd_sql from arrow_time import ten_day_ago_for_influxd_sql from influxdb_function import influxDB_interface from aircraft_config import AC_WQAR_CONFIG import json ...
waterwoodwind/influxDB_web
main_web/views.py
Python
mit
1,205
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test txindex generation and fetching # import time from test_framework.test_framework import Bitcoin...
terracoin/terracoin
qa/rpc-tests/txindex.py
Python
mit
2,703
#!/usr/bin/python #By Rhys McCaig @mccaig / mccaig@gmail.com import sys import json import logging import re from datetime import datetime, timedelta import xml.etree.ElementTree as ET import thread import numpy import requests class NikePlus: """Class for working with the Nike+ API""" #Nike+ Settings #You migh...
rhysmccaig/blue-ribbon-plus
nikeplus/nikeplus.py
Python
mit
31,565
from codecs import open from os import path from setuptools import setup, find_packages here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup( name='serpy', version='0.3.1', description='ridiculously fast object ...
clarkduvall/serpy
setup.py
Python
mit
1,452
# 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/metricsadvisor/azure-ai-metricsadvisor/azure/ai/metricsadvisor/_generated/aio/_metrics_advisor.py
Python
mit
3,345
#!/usr/bin/python import sys import argparse def loopfile(polyfile): polyline='' with open(polyfile,'r') as f: read_data = f.readlines() f.close() polylines = [] polyline = "" countend = 0 # countpoly = 0 for l in read_data: s = l.strip() if len(s) > 1: try: x = '' y = '' ...
napo/poly2wkt
poly2wkt.py
Python
mit
2,953
#!/usr/bin/env python # -*- coding: utf-8 -*- # # try: # from setuptools import setup # except ImportError: # from distutils.core import setup #from setuptools import setup #from setuptools import Extension from numpy.distutils.core import setup from numpy.distutils.extension import Extension import os impo...
DTUWindEnergy/FUSED-Wake
setup.py
Python
mit
2,875
#!/usr/bin/env python """ PURPOSE: The routines in this file test the get_neighborhoods module. Created on 2015-04-02T21:24:17 """ from __future__ import division, print_function #import numpy as np #from types import * #from nose.tools import raises #import pandas as pd import nhrc2.backend.read_seeclickfix_api_to...
newhavenrc/nhrc2
tests/test_get_neighborhoods.py
Python
mit
1,060
from typing import Optional, Any, List, Union from enum import Enum from pathlib import Path from wasabi import Printer import srsly import re import sys import itertools from ._util import app, Arg, Opt from ..training import docs_to_json from ..tokens import DocBin from ..training.converters import iob_to_docs, conl...
spacy-io/spaCy
spacy/cli/convert.py
Python
mit
10,094
from praw import Reddit import json import os import time import datetime from .tools import storage from .tools import display class FetchBot: """Bot to fetch the subreddit data.""" def __init__(self, user_agent, subreddit, data_file): """Basic constructor""" self._user_agent = user_agent ...
dopsi/flairstats
flairstats/fetchbot.py
Python
mit
5,308
from __future__ import print_function from __future__ import division __author__ = """Alex "O." Holcombe""" ## double-quotes will be silently removed, single quotes will be left, eg, O'Connor import numpy as np import itertools #to calculate all subsets from copy import deepcopy from math import atan, pi, cos, sin, sqr...
alexholcombe/movingCue
helpersAOHtargetFinalCueLocatn.py
Python
mit
32,987
#!/usr/bin/env python import sys with open(sys.argv[1], 'r') as my_file: print(my_file.read())
TheShellLand/pies
v3/Libraries/sys/Open file.py
Python
mit
102
''' Created on Feb 4, 2016 Decoding tables taken from https://github.com/typiconman/Perl-Lingua-CU @author: mike kroutikov ''' from __future__ import print_function, unicode_literals import codecs def ucs_decode(input_, errors='strict'): return ''.join(decoding_table[x] for x in input_), len(input_) def ucs_e...
pgmmpk/cslavonic
cslavonic/ucs_decode.py
Python
mit
9,501
from . import ast from .pystates import symbols as syms from .grammar.sourcefile import SourceFile import token import six import re class ASTError(Exception): pass class ASTMeta(type): def __new__(cls, name, bases, attrs): handlers = {} attrs['handlers'] = handlers newcls = type.__n...
lodevil/cpy
cpy/parser/ast_builder.py
Python
mit
38,253
# -*- coding: utf-8 -*- class BaseAI(object): player = None table = None def __init__(self, player): self.player = player def discard_tile(self): pass
huangenyan/Lattish
project/mahjong/ai/base.py
Python
mit
187
import time import arcpy from arcpy import env from arcpy.sa import * # Set environment settings env.workspace = "" # set your workspace arcpy.env.overwriteOutput = True # Check out the ArcGIS Spatial Analyst extension license arcpy.CheckOutExtension("Spatial") tic = time.clock() a_file = "random_a.tif" b_file = "ra...
ahhz/raster
benchmarks/benchmark_3_layers_arcpy.py
Python
mit
478
#!/usr/bin/python import hashlib # perl ## http://stackoverflow.com/questions/9991757/sha256-digest-in-perl #use Digest::MD5 qw(md5_hex); #print md5_hex('swaranga@gmail.com'), "\n"; perl_result = "cbc41284e23c8c7ed98f589b6d6ebfd6" md5 = hashlib.md5() md5.update('swaranga@gmail.com') hex1 = md5.hexdigest() if hex1...
jtraver/dev
python/hashlib/md5.py
Python
mit
457
# -*- 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): # Deleting model 'unique_cards' db.delete_table(u'card_game_unique_cards'...
AndrewRook/game_designer
card_game/migrations/0002_auto__del_unique_cards__del_cards__del_versions__del_unique_versions__.py
Python
mit
7,131
import json def load(ctx): with open(ctx.obj["data_location"], "r") as f: return json.load(f) def save(ctx, map_obj): with open(ctx.obj["data_location"], "w") as f: json.dump(map_obj, f, indent=4)
jghibiki/Cursed
utils.py
Python
mit
223
import logging import pygame from .. import Collage class SimpleResize(Collage): """ Example class for collage plugins - Takes a single image and resizes it """ name = 'simple resize' def __init__(self, config): super(SimpleResize, self).__init__(config) def generate...
loktacar/wallpapermaker
plugins/simple_resize/simple_resize.py
Python
mit
734
import warnings from collections import OrderedDict from honeybadger.plugins import default_plugin_manager from .contrib.test_django import DjangoMiddlewareTestCase from honeybadger.middleware import DjangoHoneybadgerMiddleware __all__ = ['MiddlewareTestCase'] class MiddlewareTestCase(DjangoMiddlewareTestCase): ...
honeybadger-io/honeybadger-python
honeybadger/tests/test_middleware.py
Python
mit
674
def get_all(tordb): return tordb.find() def delete(tordb, obj_id): tordb.remove([obj_id]) def insert(tordb, obj): return tordb.insert(obj) def update_full(tordb, id, obj): tordb.update({'_id': id}, {'$set': obj})
noahgoldman/torwiz
torrents/torrents/database.py
Python
mit
232
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('discussions', '0004_auto_20150430_1641'), ] operations = [ migrations.AlterField( model_name='discussion', ...
ZackYovel/studybuddy
server/studybuddy/discussions/migrations/0005_auto_20150430_1645.py
Python
mit
459
from .plot import *
jacobdein/nacoustik
nacoustik/plot/__init__.py
Python
mit
19
"""simpledrf URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-...
Calzzetta/Simple-Django-REST-Framework-Demo
simpledrf/urls.py
Python
mit
825
import posixpath class UrlPackage: """ Represents a package specified as a Url """ def __init__(self, url): """ Initialize with the url """ if ':' in url: self.url = url else: self.url = posixpath.join('git+git://github.com', url) @p...
cloew/tidypip
tidypip/packages/url_package.py
Python
mit
604
import sublime, sublime_plugin, requests from xml.etree import ElementTree as ET class WolframAlphaLookupCommand(sublime_plugin.WindowCommand): def run(self): settings = sublime.load_settings("Preferences.sublime-settings") if settings.has("wolfram_api_key"): API_KEY = setting...
PapaCharlie/WolframAlphaLookup
WolframAlphaLookup.py
Python
mit
2,331
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 17-4-19 上午11:02 # @Author : Tom.Lee # @Description : # @File : helper_os.py # @Product : PyCharm import commands import os import sys def shell(): command_ls = 'ls -al /opt' command_docker = 'docker ps -a' # 使用...
amlyj/pythonStudy
2.7/standard_library/study_os.py
Python
mit
3,462
/usr/bin/env python pandoc -t s5 --self-contained trial.md -o index.html
Lcmm/SESE
tools/mkslides.py
Python
mit
75
# Copyright (C) 2015 by Per Unneberg class NotInstalledError(Exception): """Error thrown if program/command/application cannot be found in path Args: msg (str): String described by exception code (int, optional): Error code, defaults to 2. """ def __init__(self, msg, code=2): sel...
percyfal/snakemakelib
snakemakelib/exceptions.py
Python
mit
965
""" Module: dr2 """
barentsen/iphas-dr2
dr2/__init__.py
Python
mit
26
""" Generate possible queries from Gates Found grant database. There are 4 filters and >11K possibilities, Bill returns a max of 1000 results per query combo. So the hope is that by using all potential queries, we will get everything. Otherwise, their system is broken too! """ import json import requests from itert...
dylanjbarth/gates-found-scraper
generate_queries.py
Python
mit
4,344
import os from lxml import etree # write_rss_xml writes name and date data for podcast RSS feeds to XML files # contained in the relative path ./feeds. It is currently assumed that each # podcast will have its data stored in a separate file. def write_rss_xml( feed, feed_url, latest_title, latest_date ): # the fu...
digwiz/engrss
write_rss_xml.py
Python
mit
1,634
from python_vlookup import *
cscanlin/Super-Simple-VLOOKUP-in-Python
python_vlookup/__init__.py
Python
mit
29
# -*- coding: utf-8 -*- """ Amavis management frontend. Provides: * SQL quarantine management * Per-domain settings """ from __future__ import unicode_literals from django.utils.translation import ugettext_lazy from modoboa.admin.models import Domain from modoboa.core.extensions import ModoExtension, exts_pool f...
modoboa/modoboa-amavis
modoboa_amavis/modo_extension.py
Python
mit
1,395
import os from loguru import logger from requests import Session from requests.exceptions import RequestException from flexget import plugin from flexget.event import event from flexget.utils.template import RenderError logger = logger.bind(name='qbittorrent') class OutputQBitTorrent: """ Example: q...
Flexget/Flexget
flexget/plugins/clients/qbittorrent.py
Python
mit
12,568
#!/usr/bin/env python # -*- coding: utf-8 -*- """ type 'pytest -v' to run u test series """ import codecs import json import os import pytest import tempfile import sys sys.path.insert(1, os.path.join(sys.path[0], '..')) import core class TestHelpers: @staticmethod def file_read(fd): """ fro...
pyseed/objify
objify/test/test_core.py
Python
mit
13,959
#第四集(包含部分文件3.py和部分第二集) # courses=['History','Math','Physics','Compsci']#此行代码在Mutable之前都要打开 # print(courses) # courses.append('Art')#在最后添加一个元素 # courses.insert(0,'English')#在0的位置添加一个元素 # courses_2=['Chinese','Education'] # courses.insert(1,courses_2)#看看这条代码与下面两条代码有什么不同 # courses.append(courses_2) # courses.extend(cour...
Tiger-C/python
python教程/第四集.py
Python
mit
3,007
import os from flask import Flask, Response, request, url_for import psycopg2 import urlparse import plivo import plivoxml AUTH_ID = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' AUTH_TOKEN = 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY' CALLER_ID = '+12345678901' BOX_ID = '+12345678901' MY_URL = 'http://morning-ocean-4669.herokuapp.com/re...
kmichal2/plivo
app.py
Python
mit
7,016
from django.db import models from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic from django_countries import CountryField from django.contrib.localflavor.us.models import * from django.contrib.localflavor.us.us_states im...
jedp/oakland_pm
core/models.py
Python
mit
8,624
# -*- coding: utf-8 -*- from django.contrib.auth.decorators import user_passes_test from Aluno.models import Aluno def check_aluno_exist(user): if not user.is_authenticated(): return False try: aluno = user.aluno_set.get() return True except Aluno.DoesNotExist: return ...
arruda/amao
AMAO/apps/Aluno/views/utils.py
Python
mit
400
import collections from sets import Set from Drawer import Drawer class Cultivar(): def __init__(self, id, name, year): self.id = id self.name = name self.year = year self.parent1 = None self.parent2 = None # row index starts from 0 self.row = 0 # column index starts from 0 self...
lindenquan/draw-pedigree
Generator.py
Python
mit
6,647
""" sum(2 * 2**i for i in range(i)) == 2 * (2**i - 1) == n i == log_2(n // 2 + 1) """ from math import ceil, log import time def count_ways(n, current_power=None, memo=None): if memo is None: memo = {} if current_power is None: current_power = ceil(log(n // 2 + 1, 2)) key = (n, current_po...
simonolander/euler
euler-169-sum-of-powers-of-2.py
Python
mit
1,172
# coding=utf-8 """Test configuration of toolbox.""" import importlib import os import pytest from snntoolbox.bin.utils import update_setup from snntoolbox.utils.utils import import_configparser with open(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'req...
NeuromorphicProcessorProject/snn_toolbox
tests/core/test_config.py
Python
mit
1,363
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting model 'New' db.delete_table('news_new') # Removing M2M table for field projects_relate...
nsi-iff/nsi_site
apps/news/migrations/0003_auto__del_new__add_news.py
Python
mit
7,906
# 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/synapse/azure-synapse/azure/synapse/artifacts/aio/_configuration_async.py
Python
mit
3,080
# 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-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/run_command_document_base.py
Python
mit
1,874
#!/usr/bin/env python import time import json import random import re from bottle import route, hook, response, run, static_file @route('/') def index(): return static_file('index.html', root = '.') @route('/maptweets.js') def index_css(): return static_file('maptweets.js', root = '.') @route('/cross.jpg') d...
relh/cathhacks
app.py
Python
mit
626
# python3 import sys class Bracket: def __init__(self, bracket_type, position): self.bracket_type = bracket_type self.position = position def Match(self, c): if self.bracket_type == '[' and c == ']': return True if self.bracket_type == '{' and c == '}':...
supermikol/coursera
Data Structures/Week 1/check_brackets_in_code/check_brackets.py
Python
mit
1,323
# vim:ts=4:sts=4:sw=4:expandtab import os import satori.web.setup def manage(): from django.core.management import execute_manager import satori.web.settings as settings # HACK import django.core.management old_fmm = django.core.management.find_management_module def find_management_module(a...
zielmicha/satori
satori.web/satori/web/__init__.py
Python
mit
616
#!/usr/bin/env python # -*- coding: utf-8 -*- from tornado.web import RequestHandler, HTTPError from schema import Session, Feed from jinja2.exceptions import TemplateNotFound class Base(RequestHandler): @property def env(self): return self.application.env def get_error_html(self, status_code, *...
mfussenegger/Huluobo
base.py
Python
mit
1,242
########################################################################## # # Copyright 2010 VMware, Inc. # All Rights Reserved. # # 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 res...
xranby/apitrace
glproc.py
Python
mit
12,065
import unicodedata class SanitiseText: ALLOWED_CHARACTERS = set() REPLACEMENT_CHARACTERS = { '–': '-', # EN DASH (U+2013) '—': '-', # EM DASH (U+2014) '…': '...', # HORIZONTAL ELLIPSIS (U+2026) '‘': '\'', # LEFT SINGLE QUOTATION MARK (U+2018) '’': '\'', # RIGHT SI...
alphagov/notifications-utils
notifications_utils/sanitise_text.py
Python
mit
5,965
"""Defines all the classes needed to create a Report from scratch. Report: a single document about the state of a cafe. Category: a class of products sharing common characteristics. Product: a single item in a cafe. Unit: a measure of products. FullProduct: a product with its quantity. """ from django.core.exceptions...
VirrageS/io-kawiarnie
caffe/reports/models.py
Python
mit
6,128
""" WSGI config for sitefinder_project 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/dev/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sitefinder_project.settings....
robjordan/sitefinder
src/sitefinder_project/wsgi.py
Python
mit
942
from transmute_core import * # from .handler import convert_to_handler # from .route import route from .route_set import RouteSet from .url import url_spec from .swagger import add_swagger
toumorokoshi/tornado-transmute
tornado_transmute/__init__.py
Python
mit
189
# -*- coding: utf-8 -*- import re import json import traceback import sys import time import datetime import random # 这段代码是用于解决中文报错的问题 reload(sys) sys.setdefaultencoding("utf8") from datetime import date from scrapy.selector import Selector from dateutil.relativedelta import relativedelta if __name__ == '__main__': ...
Svolcano/python_exercise
dianhua/worker/crawler/china_telecom/neimenggu/main.py
Python
mit
17,659
from app import app from flask import jsonify from backup.api import api as api_backup from backup.api import api_restore # Blueprints registration app.register_blueprint(api_backup, url_prefix='/api/backup') app.register_blueprint(api_restore, url_prefix='/api/restore') @app.route('/api/help', methods = ['GET']) ...
cedricmenec/mysql-backup-service
main.py
Python
mit
626
from typing import Dict, Any, List, Optional import numpy from allennlp.common.util import JsonDict from allennlp.data import DatasetReader from allennlp.models import Model from allennlp.predictors.predictor import Predictor import depccg.parsing from depccg.types import ScoringResult, Token from depccg.allennlp.pre...
masashi-y/depccg
depccg/allennlp/predictor/parser_predictor.py
Python
mit
3,044
from mediaviewer.models.person import Person class Writer(Person): class Meta: app_label = 'mediaviewer' db_table = 'writer'
kyokley/MediaViewer
mediaviewer/models/writer.py
Python
mit
146
#!/usr/bin/python """ html_writer.py - Construct HTML pages """ import datetime import os import types import numpy as np import xml.dom.minidom class BaseHtmlWriter: def __init__(self): self.div_counter = 0 pass def relative_to_full_path(self, relpath): raise Exception("class not i...
eladnoor/optslope
src/html_writer.py
Python
mit
9,669
from conf import paths import scipy.io import numpy as np def load_train(): """ Loads all training data. """ tr_set = scipy.io.loadmat(file_name = paths.TR_SET) tr_identity = tr_set['tr_identity'] tr_labels = tr_set['tr_labels'] tr_images = tr_set['tr_images'] return tr_identity, tr_labels, tr_...
hinshun/smile
please/utils.py
Python
mit
849
from django.contrib import admin from Weather.models import * from Weather.util import updateForecast def update_forecast(modeladmin, request, queryset): for forecast in queryset: updateForecast(forecast) update_forecast.short_description = "Force forecast update from NWS" class forecastAdmin(admin.Mod...
sschultz/FHSU-GSCI-Weather
Weather/admin.py
Python
mit
524
from collections import Counter def answer(q,inf): s = Counter(q.split(' ')); r = [-1,-1] for i,j in enumerate(inf): check = sum(s.get(w,0) for w in j.split(' ')) if check != 0 and check > r[1]: r = [i,check] return None if r == [-1,-1] else inf[r[0]]
Orange9000/Codewars
Solutions/beta/beta_answer_the_students_questions.py
Python
mit
293
import sys params = open(sys.argv[1], 'r') errors = open(sys.argv[2], 'r') error = [] for line in errors: if len(line) < 5: continue error.append(map(float, line.replace('[', '').replace(']', '').split(','))) print error output = [] count = 0 paramCount = 0 roundValues = [4, 2, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2...
weissj3/MWTools
Scripts/MakeTableResultsandErrors.py
Python
mit
1,034
from examples import acquire_token_by_username_password from office365.graph_client import GraphClient client = GraphClient(acquire_token_by_username_password) groups = client.groups.get().top(1).execute_query() for cur_grp in groups: cur_grp.delete_object() client.execute_batch()
vgrem/Office365-REST-Python-Client
examples/directory/delete_groups_batch.py
Python
mit
289
from base import ChoicesEnum from _version import __version__
tcwang817/django-choices-enum
django_choices_enum/__init__.py
Python
mit
62
from .waveform_utils import omega, k, VTEMFun, TriangleFun, SineFun from .current_utils import ( getStraightLineCurrentIntegral, getSourceTermLineCurrentPolygon, segmented_line_current_source_term, )
simpeg/simpeg
SimPEG/electromagnetics/utils/__init__.py
Python
mit
212