code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# This script contains general functions for calculating an initial period
# and running the MCMC.
# coding: utf-8
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os
import time
import h5py
import emcee3
from gatspy.periodic import LombScargle
from ... | RuthAngus/granola | granola/seismology/GProt.py | Python | mit | 8,084 |
# coding=utf-8
__author__ = 'mic'
import json
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
from django.conf.urls import patterns, url, include
from apis import urls as api_urls
from misc.views import JsonResult
# todo:
def api_token_required(request):
"""跨域调用API, 传acce... | micfan/dinner | src/apis/core.py | Python | mit | 1,205 |
#!/usr/local/bin/python3
import ps1Lint
def test():
test.tests = 0
test.testsPassed = 0
lineNum = 0
testPs1sPath = os.path.dirname(os.path.realpath(__file__)) + '/ps1s'
with open(testPs1sPath, 'r') as testPS1s:
for ps1 in testPS1s:
lineNum += 1
if ps1[0] == '+':
... | ustasb/ps1_lint | tests/run_tests.py | Python | mit | 1,441 |
# -*- coding: utf8 -*-
"Export declaration for models"
from .namespace import Namespace
from .variable import Type, Group, Variable
from .filter import Configuration, Filter, Link
from .workflow import Layer, Workflow
| Exanis/cannelloni | backend/models/__init__.py | Python | mit | 220 |
def dispatch(name):
print("Task {} dispatched.".format(name))
def cancel(name):
print("Task {} was cancelled".format(name))
| hugo-aa/aa-demo | aademo/task.py | Python | mit | 134 |
#! /usr/bin/env python
# Copyright (C) 2017 Alessio Deiana <adeiana@gmail.com>
# 2017 Alexis Sultan <alexis.sultan@sfr.com>
# This file is part of Scapy
# Scapy 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... | CodeNameGhost/shiva | thirdparty/scapy/contrib/gtp_v2.py | Python | mit | 31,781 |
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals
try:
from urlparse import urlparse, parse_qs
except ImportError: # Python 3
from urllib.parse import urlparse, parse_qs
from wikimd.base import Page, ROOT_URL
from wikimd.souputils import parse_homemade_dl
class Page(object):
"""
A P... | tsalmon/WikiMD | wikimd/article.py | Python | mit | 580 |
from django.core.management.base import BaseCommand
from facebook_auth import models
class Command(BaseCommand):
def handle(self, *args, **options):
users_ids = (models.UserToken.objects.distinct('provider_user_id')
.values_list('provider_user_id', flat=True))
for user_id in ... | pozytywnie/django-facebook-auth | facebook_auth/management/commands/debug_user_tokens.py | Python | mit | 454 |
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.generic.base import TemplateView
from django.utils.decorators import method_decorator
from django.shortcuts import render
from django.template.exceptions import TemplateDoesNotExist
from django.http import Http404
class IndexView(TemplateVi... | tiamunley/holiday-gift-organizer | holiday_api/holiday_app/views/__init__.py | Python | mit | 750 |
import time
import graphics
import game
import controls
import config
last_update = None
playing = False
state = 0
p = None
frame_time = 0.07
run_count = 1
def update():
retVal = game.update(p)
graphics.update(p)
return retVal
def start(program_runner):
global playing, state, p
p = program_run... | Tormyst/python-console-snake | snake/gameloop.py | Python | mit | 1,155 |
#!/usr/bin/env python
# vim: fileencoding=utf-8
class _Parser_xml:
def __init__(self, ntg=['title']):
self.tag_stack = []
self.node_stack = []
self.NODE_TAGS = ntg
def start(self, tag, attrib):
print(" " * len(self.tag_stack) + "<" + tag + ">")
self.tag_stack.append(tag... | amerlyq/airy | %wf/dev/xml/xml-pretty.py | Python | mit | 1,311 |
# -*- coding: utf-8 -*-
# Copyright © 2014-2022 Pelle Nilsson and others.
# 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... | getnikola/nikola | nikola/plugins/task/scale_images.py | Python | mit | 4,563 |
import mazes
def check(m):
name = m[0]
maze = m[1]
start_found = False
exit_found = False
for i, row in enumerate(maze):
for j, cell in enumerate(row):
if cell == '0' or cell == '1':
assert i == 0 or i == (len(maze) - 1) or \
j == 0 or... | Gryphon-Sky/Maze | test.py | Python | mit | 1,610 |
# -*- coding: utf-8 -*-
import os
from ... import OratorTestCase
from orator.connections import MySQLConnection
from orator.connectors.mysql_connector import MySQLConnector
from . import IntegrationTestCase
class SchemaBuilderMySQLIntegrationTestCase(IntegrationTestCase, OratorTestCase):
@classmethod
def get... | sdispater/orator | tests/schema/integrations/test_mysql.py | Python | mit | 1,178 |
# The MIT License (MIT)
#
# Copyright (c) 2016 Leon Jacobs
#
# 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, modif... | leonjza/tli | tli/util/twitter.py | Python | mit | 6,528 |
from PyQt5.QtGui import qRgb
from PyQt5.QtCore import Qt
from idacyber import ColorFilter
from ida_kernwin import ask_str, warning
class xpression(ColorFilter):
name = "expression"
help = """Specify expression for RGB color values.
Press right mousebutton in order to change expression."""
def __... | patois/IDACyber | cyber/expr.py | Python | mit | 1,451 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class BctItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
| itzo/scrapy | bct/bct/items.py | Python | mit | 282 |
# https://raw.githubusercontent.com/raghakot/keras-resnet/master/resnet.py
import os
from keras.optimizers import SGD
from keras.models import Model, model_from_json
from keras.layers import (
Input,
Activation,
merge,
Dense,
Flatten
)
from keras.layers.convolutional import (
Convolution2D,
... | fegonda/icon_demo | code/model/unet/old/resnet.py | Python | mit | 13,217 |
############################################################
#
# Autogenerated by the KBase type compiler -
# any changes made here will be overwritten
#
############################################################
try:
import json as _json
except ImportError:
import sys
sys.path.append('simplejson-2.3.3')... | janakagithub/psd_count_contigs_janaka | lib/psd_count_contigs_janaka/psd_count_contigs_janakaClient.py | Python | mit | 7,158 |
# Copyright (c) 2008-2014 LG Electronics, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | openwebos/build-webos | weboslayers.py | Python | mit | 3,210 |
# -*- 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.
#
# ... | jonathansick/androcmd | docs/conf.py | Python | mit | 8,107 |
x = 360
for div in range(1, x):
if x % div == 0:
print("divisor", div)
| feliposz/learning-stuff | python/examples/divisors.py | Python | mit | 83 |
#!/usr/bin/python
# -*- coding:utf-8 -*-
# 1- P(N,n) / pow(N, n)
# N : days, 365/366
# n : peoples
# P(N, n) = (N-1+1)*(N-2+1)*(N-3+1)*...*(N-n+1)
# pow(N, n) = N * N * N * ... * N
# P(N, n) / pow(N, n), nobody birthday conflict
import matplotlib.pyplot as plt
if __name__ == "__main__":
days = 366
... | nnaabbcc/exercise | python/TestBirth.py | Python | mit | 902 |
# -*- coding: utf-8 -*-
from datetime import date
from entrenamiento.views.form import ModelForm
class GastoForm(ModelForm):
''' Tiene toda la data del form de cuando se esta creando
o editando un :class:`entrenamiento.models.gasto.Gasto`
'''
def __init__(self, model_class, object_id=None):
... | tzulberti/entrenamiento-arqueria | entrenamiento/views/gasto/form.py | Python | mit | 744 |
"""Config flow for Google Maps Travel Time integration."""
from __future__ import annotations
import logging
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_API_KEY, CONF_MODE, CONF_NAME
from homeassistant.core import callback
import homeassistant.helpers.config... | rohitranjan1991/home-assistant | homeassistant/components/google_travel_time/config_flow.py | Python | mit | 5,501 |
from django.shortcuts import render_to_response
from django.template import RequestContext
from character.models import Character
from history.models import History
def home(request):
'''
Redirect to default home view.
'''
characters = Character.objects.all()
history = History.objects.all()
... | maxicecilia/dnd3.5-tools | dnd_tools/website/views.py | Python | mit | 811 |
from .. import Provider as PhoneNumberProvider
class Provider(PhoneNumberProvider):
formats = (
'01 #### ###',
'020 ### ###',
'021 ### ###',
'022 ### ###',
'023 ### ###',
'031 ### ###',
'032 ### ###',
'033 ### ###',
'034 ### ###',
'03... | danhuss/faker | faker/providers/phone_number/hr_HR/__init__.py | Python | mit | 803 |
import random
import math
from PIL import Image
""" Produce a series of Perlin noise images that tile with each other
and wrap at the end of the sequence. The pixel value are interpreted as
heights and colour values then calculated to represent a normal map.
"""
# values used by the noise function
perm = list(range(256... | paddywwoof/sailsim | textures/water/noise_normal.py | Python | mit | 2,452 |
import pytest
from github import api
@pytest.fixture
def githubdata():
return {'status': 200}
@pytest.mark.usefixtures("githubdata")
class TestApi:
"""
Test Github
"""
def test_zen_quotes(self):
"""
Test api.zen() method
"""
r = api.zen()
assert len(r) > 1
... | django-py/PythonGithub | tests/test_api.py | Python | mit | 790 |
import sys
import logging
from optparse import OptionParser
from pymclevel import *
from collections import namedtuple
usage = "usage: %prog [OPTIONS]\n\t Example: %prog -x 1 -z -1 -p \"/minecraft/saves/worldFolder/\""
parser = OptionParser(usage)
parser.add_option("-x","--xchunk", dest="xc",metavar="XC",
action="... | thegreatunclean/unwarder | unwarder.py | Python | mit | 4,106 |
# -*- coding=utf -*-
from __future__ import absolute_import
from ...server.logging import RequestLogHandler, REQUEST_LOG_ITEMS
from sqlalchemy import create_engine, Table, MetaData, Column
from sqlalchemy import Integer, Sequence, DateTime, String, Float
from sqlalchemy.exc import NoSuchTableError
from ...browser imp... | she11c0de/cubes | cubes/backends/sql/logging.py | Python | mit | 4,942 |
"""
A function named Enum that creates enumeration types.
Days = Enum('Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su')
monday = Days.Mo
tuesday = Days.Tu
print(monday
if monday == tuesday:
print("monday == tuesday"
print("All days: ")
print(Days)
... | aroberge/qt_py | varia/lib/enum.py | Python | mit | 3,566 |
"""
Holds the config for the current conference.
"""
from .ep2018 import *
| EuroPython/ep-tools | eptools/config/__init__.py | Python | mit | 76 |
from line_profiler import LineProfiler
lp = LineProfiler()
lp.enable_profile_all()
profile = lp.runcall
| iddl/pprofile | lib/pylprof/imports.py | Python | mit | 104 |
shader_assignment = []
for shadingEngine in renderPartition.inputs():
if not shadingEngine.members():
continue
if shadingEngine.name() == 'initialShadingGroup':
continue
nameSE = shadingEngine.name()
nameSH = shadingEngine.surfaceShader.inputs()[0].name()
shader_assignment.appe... | satishgoda/Maya | concepts/shadingEngine/study.py | Python | mit | 1,597 |
import unittest
from selenium import webdriver
class FunctionalTests(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(2)
def tearDown(self):
self.browser.quit()
def test_get_home_page(self):
self.browser.get('http://lo... | hitenjadeja/stock-management | stock_management/functional_tests.py | Python | mit | 435 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import pytest
from httmock import HTTMock
from expects import expect, contain, equal
from surveymonkey.manager import BaseManager
from surveymonkey.exceptions import (
SurveyMonkeyBadRequest, SurveyMonkeyAuthorizationError,
... | Administrate/surveymonkey | surveymonkey/tests/test_surveymonkey_exceptions.py | Python | mit | 4,108 |
# Copyright 2015 John Reese
# Licensed under the MIT license
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from congress import Congress
from core import get, template
from flask import redirect
@get('/', 'Search'... | jreese/congress | views/main.py | Python | mit | 707 |
#python-encoding: UTF-8
from csc.nl import NLTools, get_nl
import re
def ja_enc(string):
''' Encodes an ascii, unicode, or utf-8 to utf-8, hopefully without making a fuss '''
try:
s = str(string)
except:
s = string
try:
d = s.decode('utf-8', 'ignore')
except:
d = ... | pbarton666/buzz_bot | djangoproj/djangoapp/csc/nl/ja/util.py | Python | mit | 3,624 |
from flask.ext.wtf import Form, Required, EqualTo, Length, Email, \
URL
from flask.ext.wtf import TextField, PasswordField, TextAreaField, \
DateField, SelectField, SubmitField
from flask.ext.wtf.html5 import EmailField, TelField, URLField
from flaskext.babel import gettext as _
from .constants import (FIRSTNAME_LEN_MI... | vovantics/flask-bluebone | app/user/forms.py | Python | mit | 4,081 |
# encoding: utf-8
from __future__ import unicode_literals
import pytest
from marrow.mongo import Document, F, Field, Filter
from marrow.mongo.field import Array, Number
class TestParametricFilterConstructor(object):
@pytest.fixture()
def D(self):
class Sample(Document):
field = Field()
number = Number()
... | marrow/mongo | test/param/test_filter.py | Python | mit | 1,228 |
import serial
import time
s = None
inter_command_delay = 0.02
def command(cmd_text):
s.write((cmd_text + '|').encode())
time.sleep(inter_command_delay)
def setup():
global s
s = seri... | jhogsett/linkit | python/fun4.py | Python | mit | 823 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('confess', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='post',
name='is_liked',... | amartinez1/nonymous | confess/migrations/0002_post_is_liked.py | Python | mit | 427 |
import _plotly_utils.basevalidators
class TicktextValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(
self, plotly_name="ticktext", parent_name="layout.polar.radialaxis", **kwargs
):
super(TicktextValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/polar/radialaxis/_ticktext.py | Python | mit | 432 |
import sortedcontainers
class IterableDict(sortedcontainers.SortedDict):
"""A dictionary with keys in sorted order."""
def prev(self, key):
"""Returns previous key from sorted order.
Args:
key: Existing dictionary key.
Returns:
Previous dictionary key.
Raises:
KeyError: Given ... | cripplet/treedoc-py | src/core/iterable_dict.py | Python | mit | 1,018 |
import pygame
from pygame.locals import KEYDOWN, QUIT, K_1, K_2, K_3, K_4, K_ESCAPE
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
PURPLE = (255, 0, 255)
YELLOW = (255, 255, 0)
CYAN = (0, 255, 255)
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
GRAY = (88, 88, 88)
BASE_PROGRESS_TIMER = 10
#####################... | gentimouton/comboline | battle.py | Python | mit | 7,475 |
# -*- coding: utf-8 -*-
from .earth import *
from .steric import *
from .library import *
from .freezing import *
from .isobaric import *
from .constants import *
from .derivatives import *
from .conversions import *
from .geostrophic import *
from .geostrophic_48 import *
from .water_column_48 import *
from .practica... | rabernat/python-gsw | gsw/gibbs/__init__.py | Python | mit | 527 |
from unittest import TestCase
from protobuf3.fields.int64 import Int64Field
from protobuf3.message import Message
class TestInt64Field(TestCase):
def setUp(self):
class Int64TestMessage(Message):
a = Int64Field(field_number=1)
self.msg_cls = Int64TestMessage
def test_get(self):
... | Pr0Ger/protobuf3 | tests/fields/test_int64.py | Python | mit | 1,552 |
import importlib
import json
import numpy as np
import os
import re
import sys
import time
import uuid
import copy
from hypergan.discriminators import *
from hypergan.distributions import *
from hypergan.generators import *
from hypergan.inputs import *
from hypergan.samplers import *
from hypergan.trainers import *
... | 255BITS/HyperGAN | hypergan/gans/configurable_gan.py | Python | mit | 4,488 |
from osgeo import ogr
shp_driver = ogr.GetDriverByName('ESRI Shapefile')
shp_dataset = shp_driver.Open(r'../geodata/schools.shp')
shp_layer = shp_dataset.GetLayer()
shp_srs = shp_layer.GetSpatialRef()
print shp_srs
| mdiener21/python-geospatial-analysis-cookbook | ch02/code/ch02-01_show_shp_crs.py | Python | mit | 216 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | samedder/azure-cli | src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/tests/test_webapp_commands.py | Python | mit | 42,844 |
"""
Generates and analyzes orders and relations
"""
orders = {"trans": {}, "reflex": {}, "sym": {}, "total": {}, "equiv": {}, "betw": {}, "linear": {}, "pre": {}, "partial": {}, "cyclic": {}}
def closure(collection, order):
"""
Find a closure for the relation/order in the given collection
"""
...
def... | cyanoats/OrderTheory | orders.py | Python | mit | 1,484 |
from __future__ import print_function
import os
import sys
import subprocess as sp
import pytest
import yaml
import tempfile
import requests
import argparse
import contextlib
import json
from ggd import search
from ggd import utils
from ggd import list_files
from helpers import install_hg19_gaps_ucsc_v1, uninstall_hg1... | gogetdata/ggd-cli | tests/test_search.py | Python | mit | 125,760 |
import math
from collections import Counter
# ==================================================
# Statistical tools
# ==================================================
# efficient combinatorial function to handle extremely large numbers
def log_choose(n, k):
r = 0.0
# swap for efficiency if k is more than h... | hall-lab/svtyper | svtyper/statistics.py | Python | mit | 3,592 |
#!/usr/bin/env python
# Modified to fit Python 3.
#
# Copyright 2009 Facebook
# 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 req... | waterdrinker/gblog | gblog/mytorndb.py | Python | mit | 9,505 |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="color", parent_name="layout.ternary.caxis.tickfont", **kwargs
):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/ternary/caxis/tickfont/_color.py | Python | mit | 425 |
import fileinput
counter = 0
for line in fileinput.input():
sides = sorted([int(a) for a in line.split()])
if sides[0] + sides[1] > sides[2]:
counter += 1
print(counter)
| zigapk/adventofcode | 2016/day_3/3-1.py | Python | mit | 188 |
from keyboard import KeyBoardReader, cardreader_keymap, keypad_keymap
from DoorDaemon import DoorDaemon
import Queue
from DoorGuard_db_queries import get_card_cache
from evdev import list_devices, InputDevice
devices = {dev.name : dev for dev in map(InputDevice, list_devices())}
print devices
keypad_path = devices["U... | TomHodson/FizzPOP-access | main.py | Python | mit | 957 |
import unittest
from unittest import mock
from test import support
import subprocess
import sys
import signal
import io
import os
import errno
import tempfile
import time
import selectors
import sysconfig
import select
import shutil
import gc
import textwrap
try:
import threading
except ImportError:
threading ... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.6.0/Lib/test/test_subprocess.py | Python | mit | 119,726 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Inventory
#
import wx
import wx.grid as gridlib
import sys,re
import faulthandler
import json
import time
import numpy
import xml.etree.cElementTree as ET
import wx.lib.masked as masked
import datetime
import pout
import handy_utils as HUD
from button_stuff import Butt... | fuspu/RHP-POS | inventory.py | Python | mit | 102,038 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .forms import SlideForm
from .models import Slide, Slider
from .settings import app_settings
cl... | tdsymonds/djangocms-flexslider | djangocms_flexslider/cms_plugins.py | Python | mit | 1,131 |
from django.conf.urls import url,include
from django.contrib.auth.views import (
password_reset,password_reset_done,
password_reset_confirm,password_reset_complete)
from account import views
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
url(r'^login/$',views.login_... | mhadiahmed/accounts | account/urls.py | Python | mit | 1,530 |
#!python3
# -*- coding:utf-8 -*-
import os
import sys
import time
import ctypes
import shutil
import subprocess
IsPy3 = sys.version_info[0] >= 3
if IsPy3:
import winreg
else:
import codecs
import _winreg as winreg
BuildType = 'Release'
IsRebuild = True
Build = 'Rebuild'
Update = False
Copy = False
CleanAl... | xylsxyls/xueyelingshuang | src/AtomicMath/scripts/rebuild_AtomicMath.py | Python | mit | 14,085 |
import requests
from bs4 import BeautifulSoup
website = "http://dict.baidu.com/s"
def get_meaning(soup):
"""
解析获取单词解释
不同解释间用|分割
:soup: 网页的Beautiful对象
:return:包含全部中文解释的字符串
若没有找到则返回None
"""
result = str()
# 获取单词中文解释并放在结果集中
zhn_meanings = soup.find(attrs={'id': 'en-sim... | zhuzhenpeng/MyDict | DBGenerate/webdict.py | Python | mit | 5,367 |
"""oauth 1.0 flow for khan-api"""
from __future__ import print_function, unicode_literals
import requests_oauthlib
import requests
import urlparse
import webbrowser
from six.moves import input
# package specific
import pkaaw.constants
def get_request_tokens(consumer_key, consumer_secret):
"""uses request_oauthlib... | almartin82/pkaaw | pkaaw/auth_flow.py | Python | mit | 1,635 |
from pylab import *
import matplotlib.dates as mdates
import os, sys, datetime, string
import numpy as np
from netCDF4 import Dataset
import time
import numpy.ma as ma
import calclight
from subprocess import call
import mpl_util
import pandas as pd
import calculateLightUnderIce
import prettyplotlib as ppl
import brewe... | trondkr/OceanLight | calculateTheoreticalLightandIce.py | Python | mit | 3,652 |
import ConfigParser
import logger
l = logger.setup(__name__)
def config():
config = ConfigParser.ConfigParser()
try:
config.readfp(open('config.cfg'))
return config
except IOError:
l.exception("Error reading config.cfg file.")
raise | achavez/photostreamer-pi | settings.py | Python | mit | 244 |
"""
Thu Oct 23 11:38:56 IDT 2014
Automation script for building and deploying the website,
by xorpd.
Should be later ported to fabric, when fabric supports python3.
"""
import os
import shutil
import sys
import inspect
OUTPUT_DIR = "./output"
class ExceptDeploy(Exception):
pass
class ExceptBuild(Exception):
... | xorpd/static_weber | website_tool.py | Python | mit | 3,575 |
# 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.
# --------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/async_samples/sample_recognize_content_async.py | Python | mit | 4,663 |
"""Test default selectors."""
from .. import util
class TestDefault(util.TestCase):
"""Test default selectors."""
def test_default(self):
"""Test default."""
markup = """
<form>
<input type="radio" name="season" id="spring">
<label for="spring">Spring</label>
... | facelessuser/soupsieve | tests/test_level4/test_default.py | Python | mit | 4,650 |
# 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-devtestlabs/azure/mgmt/devtestlabs/operations/operations.py | Python | mit | 3,944 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib2
import json
import os, sys
import time
from jinja2 import Environment, FileSystemLoader
from subprocess import check_call
#from distutils.spawn import find_executable
import re
import pprint
class AnsibleHelper(object):
"""This class will contain functions ... | padajuan/ansible-docker-base | builder.py | Python | mit | 3,433 |
import model
from SaoInfo import SaoInfo
from RDFInterface import importRDFGraph, importRDFFile, exportRDFGraph, exportRDFFile
import foaf
import owlssc
import sao
import rdfs
import owlss
import tm
import tzont
import owlssp
import geo
import tl
import ssn
import ces
import owlssrp
import prov
import DUL
import muo
i... | CityPulse/CP_Resourcemanagement | saopy/__init__.py | Python | mit | 365 |
# Project Euler Problem 12
# Created on: 2012-06-15
# Created by: William McDonald
import math
# Short list of prime numbers under 20
primeList = [2, 3, 5, 7, 9, 11, 13, 17, 19]
last = 21
# Returns True if n is prime, otherwise False
def isPrime(n):
prime = True
for i in primeList:
if n % i == 0:
... | WalrusCow/euler | Solutions/problem12.py | Python | mit | 1,428 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.dev20160107235441 on 2016-03-27 20:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fileuploads', '0003_auto_20160320_0656'),
]
operations = [
... | yayoiukai/signalserver | fileuploads/migrations/0004_auto_20160327_2017.py | Python | mit | 484 |
import os
class EnvVarBackend:
"""Backend that reads settings in environment variables."""
def get_setting(self, key):
return os.environ.get(key)
| caravancoop/configstore | configstore/backends/env_var.py | Python | mit | 165 |
"""
Support for REST API sensors..
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.rest/
"""
import logging
import requests
from blumate.const import CONF_VALUE_TEMPLATE, STATE_UNKNOWN
from blumate.helpers.entity import Entity
from blumate.helper... | bdfoster/blumate | blumate/components/sensor/rest.py | Python | mit | 3,164 |
import sys
if sys.version_info < (3, 7):
from ._bar import Bar
from ._barpolar import Barpolar
from ._box import Box
from ._candlestick import Candlestick
from ._carpet import Carpet
from ._choropleth import Choropleth
from ._choroplethmapbox import Choroplethmapbox
from ._cone import C... | plotly/plotly.py | packages/python/plotly/plotly/graph_objs/__init__.py | Python | mit | 9,566 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import glob
import MySQLdb
def createSqlPatchStatusTable(config):
try:
# Connect to MySQL
conn = MySQLdb.connect (host = config['host'],
user = config['user'],
passwd = config['pw'],
... | mzucker007/mysqlpatch | mysqlpatch.py | Python | mit | 4,697 |
from django.core.management.base import BaseCommand
from django.utils import timezone
from core.models import ConveneTime
from legislators.models import Chamber
from dateutil.parser import parse
import requests
class Command(BaseCommand):
help = u'Scrape TLO for convening times.'
def handle(self, *args, **... | texastribune/txlege84 | txlege84/core/management/commands/updateconveningtimes.py | Python | mit | 1,808 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-20 16:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Blog',
... | zhu327/greentor | demo/app/migrations/0001_initial.py | Python | mit | 923 |
# coding: utf-8
"""
Qc API
Qc API # noqa: E501
The version of the OpenAPI document: 3.0.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import datetime
import telestream_cloud_qc
from telestream_cl... | Telestream/telestream-cloud-python-sdk | telestream_cloud_qc_sdk/test/test_audio_loudness_stest.py | Python | mit | 1,707 |
from multiprocessing import Process, Queue, Pipe
# there are two ways to communicate between processes, queues and pipes
# queues are thread and process safe
#
def f(q):
q.put([42, None, 'hello'])
def g(conn):
conn.send([42, None, 'hello'])
conn.close()
if __name__ == '__main__':
q = Queue()
# ... | abhianand7/learn_multiprocessing | queues_and_pipe.py | Python | mit | 1,171 |
from flask_wtf import Form # , RecaptchaField
from wtforms import StringField, IntegerField, SelectField, TextAreaField
from wtforms import validators, SubmitField, BooleanField
from wtforms import ValidationError
from wtforms.validators import Required, Email, Length, Regexp
from ..models import User
# from wtforms i... | Kimanicodes/wananchi | app/main/forms.py | Python | mit | 2,589 |
# Copyright 2013 Lyman Gillispie
# This code is distributed under the MIT License
# Author: Lyman Gillispie
def _entry_getter(s):
"""Address the string s
Args: s - Any string
Returns: linepos(l,w) - function which returns word w on line l
from s
"""
lines = s.splitlines()
def linepos(line, word):
ret... | fmuzf/python_hk_glazer | hk_glazer/dat_to_dict.py | Python | mit | 10,681 |
from enum import Enum
class Position(Enum):
guard = "GUARD"
guard_forward = "GUARD-FORWARD"
forward_guard = "FORWARD-GUARD"
forward = "FORWARD"
center = "CENTER"
forward_center = "FORWARD-CENTER"
@staticmethod
def get_position_from_abbreviation(abbreviation):
return abbreviati... | jaebradley/nba_data | nba_data/data/position.py | Python | mit | 953 |
import requests
import time
import json
import datetime
import os
import sys
import csv
class Helper:
headers = None
fileName = None
fileStatistic = None
@staticmethod
def parseHTML(link):
try:
html = requests.get(link, headers = Helper.headers)
except Exception, e:
... | HCB2-NPT/Amazon-Web-Crawler | source-code/Crawlers/Helper.py | Python | mit | 2,112 |
from ..libloader.com import load_com
from .base import Output
import logging
log = logging.getLogger(__name__)
class Sapi4(Output):
name = 'sapi4'
priority = 102
def __init__(self):
sapi4 = load_com("{EEE78591-FE22-11D0-8BEF-0060081841DE}")
self._voiceNo = sapi4.Find(0)
sapi4.Select(self._voiceNo)
sapi4.... | frastlin/PyAudioGame | pyaudiogame/accessible_output2/outputs/sapi4.py | Python | mit | 2,881 |
from pprint import pprint
from eveapimongo import MongoProvider
from pymongo.errors import BulkWriteError
POS_DAY_FEE = 2000000
def lambda_handler(event, context):
message = event['Records'][0]['Sns']['Message']
print("SNS Message: " + message)
if message == "deposits-built":
BalanceJournalBuild... | bahrmichael/eve-pos-taxer | functions/balanceJournalBuilder/balanceJournalBuilder.py | Python | mit | 4,256 |
import json
import os
from unittest import TestCase
from controler import dbInterface
__author__ = 'Jesse'
class TestDbInterface(TestCase):
def setUp(self):
os.chdir("..") # Go-to project root
os.chdir("forgeLandWall")
import forgeLandWall.models as models
x = models.messageModel()
... | Jelloeater/forgeLandWall | tests/test_dbInterface.py | Python | mit | 1,750 |
#!/usr/bin/python3
import sys
import os
import time
t0 = time.clock()
def filename():
if 'C:\\' not in sys.argv[1]:
file = "'" + os.getcwd() + "/" + str(sys.argv[1]) + "'"
return file.replace('\\', '/')
else:
return ("'" + str(sys.argv[1]) + "'").replace('\\', '/')
if __name__ == '_... | cheeseywhiz/cheeseywhiz | Project-Euler/programSelf.py | Python | mit | 663 |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models.signals import pre_save
from django.utils import timezone
from django.utils.safestring impo... | sukenda/django-api-tutorial | posts/models.py | Python | mit | 4,026 |
import os
from setuptools import find_packages, setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-throttled-logger... | mennanov/django-throttled-logger | setup.py | Python | mit | 650 |
"""mymenu URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | quangnguyen-asnet/python-django | mymenu/mymenu/urls.py | Python | mit | 992 |
from kombu import Connection
from kombu.pools import connections
from kombu import Exchange, Queue
from microservices.utils import get_logger
from microservices.helpers.logs import InstanceLogger
import six
_logger = get_logger(__file__)
class _exchange(object):
"""Exchange helper"""
def __init__(self, clie... | aclef/microservices | microservices/queues/client.py | Python | mit | 7,868 |
from electrum_arg.i18n import _
fullname = 'Virtual Keyboard'
description = '%s\n%s' % (_("Add an optional virtual keyboard to the password dialog."), _("Warning: do not use this if it makes you pick a weaker password."))
available_for = ['qt']
| argentumproject/electrum-arg | plugins/virtualkeyboard/__init__.py | Python | mit | 246 |
from django.urls import reverse
from django.utils import timezone
from django.template import defaultfilters
from django_webtest import WebTest
from datetime import timedelta
from ..models import PressRelease, PressMention
class PressReleaseViewTest(WebTest):
def setUp(self):
now = timezone.now()
... | okfn/website | foundation/press/tests/test_views.py | Python | mit | 6,177 |
import ts3, ts3.commands
#from ts3.commands import clientlist, privilegekeyadd, privilegekeydelete, privilegekeylist
__all__ = ["ChannelTreeNode", "tsviewer", "clientlist", "gen_privilegekey", "rem_privilegekey", "get_privilegekeys"]
class ChannelTreeNode(object):
"""
Represents a channel or the virtual serve... | Au1st3in/au1st3in.net | app/tsstatus.py | Python | mit | 8,527 |
"""
Django settings for albumproject project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ..... | sniboboof/djangophotos | albumproject/albumproject/settings.py | Python | mit | 2,077 |
from .base import Base
import sqlalchemy as sa
__all__ = ["User", "Admin"]
class User(Base):
id = sa.Column(sa.Integer, primary_key=True)
name = sa.Column(sa.Text)
email = sa.Column(sa.Text, unique=True)
uq_user = sa.Column(sa.String(8), unique=True, nullable=True)
points = sa.Column(sa.Integer, ... | UQComputingSociety/codegolf | codegolf/models/user.py | Python | mit | 1,284 |