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 |
|---|---|---|---|---|---|
HOST = '127.0.0.1'
PORT = 8080
from Tkinter import *
import tkColorChooser
import socket
import thread
import spots
################################################################################
def main():
global hold, fill, draw, look
hold = []
fill = '#000000'
connect()
root = Tk()
root... | ActiveState/code | recipes/Python/511434_Paint_10/recipe-511434.py | Python | mit | 3,174 |
/*Owner & Copyrights: Vance King Saxbe. A.*/""" Copyright (c) <2014> Author Vance King Saxbe. A, and contributors Power Dominion Enterprise, Precieux Consulting and other contributors. Modelled, Architected and designed by Vance King Saxbe. A. with the geeks from GoldSax Consulting and GoldSax Technologies email @vsaxb... | VanceKingSaxbeA/MarketsEngine | engine.py | Python | mit | 3,899 |
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from textwrap import dedent
import pytest
import pytablewriter
from ...._common import print_test_result
from ....data import (
Data,
headers,
mix_header_list,
mix_value_matrix,
null_test_data_list,
value_matrix,
val... | thombashi/pytablewriter | test/writer/text/rst/test_rst_csv_writer.py | Python | mit | 6,875 |
#!/usr/bin/env python
"""
demos reading HiST camera parameters from XML file
"""
from histutils.hstxmlparse import xmlparam
from argparse import ArgumentParser
if __name__ == "__main__":
p = ArgumentParser()
p.add_argument("fn", help="xml filename to parse")
p = p.parse_args()
params = xmlparam(p.fn)... | scienceopen/histutils | XMLparamPrint.py | Python | mit | 340 |
#!/usr/bin/env python
# minimal.py --- Minimal example of using traits.
from traits.api import HasTraits, Float
class Person(HasTraits):
weight = Float(150.0)
| marshallmcdonnell/interactive_plotting | Traits/manual/minimal.py | Python | mit | 167 |
import struct
import uuid
from enum import IntEnum
from typing import List, Optional, Set
from .sid import SID
class ACEFlag(IntEnum):
""" ACE type-specific control flags. """
OBJECT_INHERIT = 0x01
CONTAINER_INHERIT = 0x02
NO_PROPAGATE_INHERIT = 0x04
INHERIT_ONLY = 0x08
INHERITED = 0x10
... | Noirello/PyLDAP | src/bonsai/active_directory/acl.py | Python | mit | 13,344 |
from django import forms
from djwed.wedding.models import *
from djwed.wedding.admin_actions import *
from django.contrib import admin
class RequireOneFormSet(forms.models.BaseInlineFormSet):
"""Require at least one form in the formset to be completed."""
def clean(self):
"""Check that at least one fo... | garyp/djwed | wedding/admin.py | Python | mit | 10,509 |
import calendar
import collections
try:
from collections.abc import Iterable
except:
from collections import Iterable
from time import strptime
from six import string_types
from lxml import etree
from itertools import chain
def remove_namespace(tree):
"""
Strip namespace from parsed XML
"""
fo... | titipata/pubmed_parser | pubmed_parser/utils.py | Python | mit | 4,118 |
#!/usr/bin/env python2
import time
import random
class Battle:
def __init__(self, user1, user2):
self.user1 = user1
self.user2 = user2
self.turn = user1
self.notTurn = user2
self.accepted = False
self.finished = False
self.auto = False
self.turnCount... | AlexMog/IRCPokemonBot | commands/classes/Battle.py | Python | mit | 1,766 |
from django.db import models
from django.core.urlresolvers import reverse
from django.conf import settings
import misaka
from groups.models import Group
# Create your models here.
# POSTS MODELS.PY
from django.contrib.auth import get_user_model
User = get_user_model()
class Post(models.Model):
user = models.Fo... | srijannnd/Login-and-Register-App-in-Django | simplesocial/posts/models.py | Python | mit | 984 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import mysql.connector
import time
import datetime
conn = mysql.connector.connect(host="localhost",user="spike",password="valentine", database="drupal")
cann = mysql.connector.connect(host="localhost",user="spike",password="valentine", database="content_delivery_weather")... | gandalf-the-white/foundation | amaryl/scripts/initdatabase.py | Python | mit | 1,705 |
#!/usr/bin/env python
# pylint: disable=line-too-long
""" Start the containers """
import argparse
from lib.docker_compose_tools import set_up
def main():
""" Start the containers """
parser = argparse.ArgumentParser(description="Set up testing environment.")
parser.add_argument("--pg", help="PostgreSQ... | matthewfranglen/postgres-elasticsearch-fdw | tests/start.py | Python | mit | 738 |
"""
Shopify Trois
---------------
Shopify API for Python 3
"""
from setuptools import setup
setup(
name='shopify-trois',
version='1.1-dev',
url='http://masom.github.io/shopify-trois',
license='MIT',
author='Martin Samson',
author_email='pyrolian@gmail.com',
maintainer='Martin Samson',
... | masom/shopify-trois | setup.py | Python | mit | 1,267 |
#!/usr/bin/env python
"""
RPG: Operation
These are any operations we want to carry out from our YAML files. Operations
are strings that are tied to Python code, to carry out things that arent
possible to easily make YAML tags for directly.
"""
from rpg_log import Log
import rpg_combat
def HandleOp... | ghowland/rpg | rpg_operation.py | Python | mit | 2,007 |
# -*- coding: utf-8 -*-
# @date 161103 - Export excel with get_work_order_report function
"""
Data exportor (Excel, CSV...)
"""
import io
import math
from datetime import datetime
from xlsxwriter.workbook import Workbook
import tablib
from utils.tools import get_product_size
def get_customers(customer_list=None... | grtfou/data-analytics-web | website/utils/data_exportor.py | Python | mit | 8,235 |
{'level_mc': {'_txt': {'text': '6'},
'currentLabel': 'up',
'progress_mc': {'currentLabel': '_0'}}} | ethankennerly/hotel-vs-gozilla | user/h4.news.py | Python | mit | 126 |
# 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/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/operations/_provider_operations_operations.py | Python | mit | 4,782 |
import os
from kivy.lang import Builder
from kivy.properties import NumericProperty, StringProperty
from kivy.uix.anchorlayout import AnchorLayout
from cobiv.modules.core.hud import Hud
Builder.load_file(os.path.abspath(os.path.join(os.path.dirname(__file__), 'progresshud.kv')))
class ProgressHud(Hud, AnchorLayout)... | gokudomatic/cobiv | cobiv/modules/hud_components/progresshud/progresshud.py | Python | mit | 473 |
"""Non-application-specific convenience methods for GPkit"""
import numpy as np
def te_exp_minus1(posy, nterm):
"""Taylor expansion of e^{posy} - 1
Arguments
---------
posy : gpkit.Posynomial
Variable or expression to exponentiate
nterm : int
Number of non-constant terms in result... | hoburg/gpkit | gpkit/tools/tools.py | Python | mit | 3,097 |
from django.contrib import admin
from modeltranslation.admin import TabbedTranslationAdmin
from .models import Person, Office, Tag
class PersonAdmin(TabbedTranslationAdmin):
list_display = ('name', 'surname', 'security_level', 'gender')
list_filter = ('security_level', 'tags', 'office', 'name', 'gender')
... | mtrgroup/django-mtr-utils | tests/app/admin.py | Python | mit | 908 |
import atexit
from flask import Flask, jsonify, g, request, make_response
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
from flask_jwt_extended import JWTManager, set_access_cookies, jwt_required, unset_jwt_cookies
from apscheduler.schedulers.background import Bac... | patklaey/ZermattReservationAPI | main.py | Python | mit | 1,957 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | Stargrazer82301/CAAPR | CAAPR/CAAPR_AstroMagic/PTS/pts/modeling/fitting/modelgenerators/generator.py | Python | mit | 7,222 |
from django.apps import AppConfig
class DonateAppConfig(AppConfig):
name = 'readthedocs.donate'
verbose_name = 'Donate'
def ready(self):
import readthedocs.donate.signals # noqa
| tddv/readthedocs.org | readthedocs/donate/apps.py | Python | mit | 202 |
from flask import Flask, Response, request
from twilio.util import TwilioCapability
app = Flask(__name__)
@app.route('/token', methods=['GET'])
def get_capability_token():
"""Respond to incoming requests."""
# Find these values at twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
... | teoreteetik/api-snippets | client/capability-token-2way/capability-token.5.x.py | Python | mit | 763 |
#! /usr/bin/env python
import os.path
import os
import argparse
import pickle
from util import *
from collections import defaultdict
import base64
import logging
import sys
import json
import shelve
#from FeatureExtraction import Tf_Idf
from LangProc import docTerms
# todo : remove this assumptions
# Indexer assumes th... | zkmake520/SearchEngine | Indexer.py | Python | mit | 6,844 |
import mobula.layers as L
import numpy as np
def test_acc():
X = np.array([[0, 1, 2],
[1, 2, 0],
[0, 1, 2],
[1, 2, 0]])
Y = np.array([1, 0, 2, 1]).reshape((-1, 1))
# top-k
# 1 [False, False, True, True]
# 2 [True, T... | wkcn/mobula | tests/test_layers/test_acc.py | Python | mit | 625 |
#!/usr/bin/env python
from distutils.core import setup
import strfrag
setup(
name='Strfrag',
version=strfrag.__version__,
description=('StringFragment type to represent parts of str objects; '
'used to avoid copying strings during processing'),
url="https://github.com/ludios/Strfrag",
author="Ivan Kozik",
au... | ludios/Strfrag | setup.py | Python | mit | 611 |
from __future__ import unicode_literals
from django.db import models
from django.core.paginator import Paginator, PageNotAnInteger
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailimages.edit_... | samuelleeuwenburg/Samplate | event/models.py | Python | mit | 1,665 |
import re
import time
class BaseCounters:
def __init__(self):
self.keyre = re.compile('\A[\w.]+\Z')
def ping(self, key):
self.validate_key(key)
self.do_ping(key, int(time.time()))
def hit(self, key, n=1):
self.validate_key(key)
self.do_hit(key, n)
def validate_key(self, key):
if re.m... | francois/pycounters | counters/base_counters.py | Python | mit | 499 |
from django.db import connection
from laboratory.settings import TIME_ZONE
from utils.db import namedtuplefetchall
def get_history_dir(d_s, d_e, card_id, who_create_dir, services, is_serv, iss_pk, is_parent, for_slave_hosp):
with connection.cursor() as cursor:
cursor.execute(
"""WITH
... | moodpulse/l2 | api/directions/sql_func.py | Python | mit | 16,657 |
from django import forms
from .models import PassType, Registration
class SignupForm(forms.ModelForm):
pass_type = forms.ModelChoiceField(
queryset=PassType.objects.filter(active=True),
widget=forms.widgets.RadioSelect(),
)
class Meta:
model = Registration
fields = (
... | smokeyfeet/smokeyfeet-registration | src/smokeyfeet/registration/forms.py | Python | mit | 2,149 |
import urllib.request as urllib
from bs4 import BeautifulSoup as bs
import unicodedata
import pandas as pd
import os
baseURL='http://snre.ifas.ufl.edu/academics/graduate/courses-syllabi-and-curriculum/'
classListFile='majorClassLists/SNREList.csv'
html_titles = ['Principles of Ecology Courses','Particular Perspective... | sdtaylor/scheduleCrossRef | getSNREClassList.py | Python | mit | 3,204 |
# -*- coding: utf8 -*-
"""
The ``config`` module
=====================
Create a named logger and return it so users can log in different log files : one for each module.
"""
__author__ = 'Salas'
__copyright__ = 'Copyright 2014 LTL'
__credits__ = ['Salas']
__license__ = 'MIT'
__version__ = '0.2.0'
__main... | salas106/irc-ltl-framework | utils/config.py | Python | mit | 2,675 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# Database Module
# --------------------
from __future__ import unicode_literals
import warnings
import datetime
import frappe
import frappe.defaults
import frappe.async
import re
import frappe.model.meta
from frappe.u... | manassolanki/frappe | frappe/database.py | Python | mit | 30,790 |
#
# Copyright (c) 2009-2012 Joshua Hughes <kivhift@gmail.com>
#
import webbrowser
import qmk
class BrowseCommand(qmk.Command):
'''Open the supplied URL in the default web browser.'''
def __init__(self):
self._name = 'browse'
self._help = self.__doc__
@qmk.Command.actionRequiresArgument
... | kivhift/qmk | src/commands/browse.py | Python | mit | 426 |
import sys
sys.path.append("../../")
from unittest.mock import patch, MagicMock
MockRPi = MagicMock()
MockSpidev = MagicMock()
modules = {
"RPi": MockRPi,
"RPi.GPIO": MockRPi.GPIO,
"spidev": MockSpidev
}
patcher = patch.dict("sys.modules", modules)
patcher.start()
from gfxlcd.driver.ssd1306.spi import SP... | bkosciow/gfxlcd | gfxlcd/tests/test_ssd1306.py | Python | mit | 464 |
from functools import reduce
import numpy as np
# Qubit representation on a Ket or Bra state. Allows to create only
# basis qubits |0> or |1>. By performing operations defined operations
# it's possible to get other qubits or qubit registers.
class Qubit:
KET = True
BRA = False
# Creates a new qubit |... | miguelfrde/pyquantum | pyquantum/qubit.py | Python | mit | 3,624 |
"""
Configuration parameters:
path.internal.ansi2html
"""
import sys
import os
import re
from subprocess import Popen, PIPE
MYDIR = os.path.abspath(os.path.join(__file__, '..', '..'))
sys.path.append("%s/lib/" % MYDIR)
# pylint: disable=wrong-import-position
from config import CONFIG
from globals import error
... | chubin/cheat.sh | lib/frontend/html.py | Python | mit | 4,663 |
#!/usr/bin/env python
import sys
import configparser
import os
import shutil
from PyQt5 import QtWidgets
from PyQt5 import QtWebKitWidgets
from PyQt5 import QtCore
# Read config file
home_dir = os.path.expanduser("~")
conf_path = os.path.join(home_dir, ".config/mrps/mrps.conf")
config = configparser.ConfigParser(de... | cnodell/mrps | mrps.py | Python | mit | 1,477 |
#
# The Python Imaging Library
# $Id$
#
# simple postscript graphics interface
#
# History:
# 1996-04-20 fl Created
# 1999-01-10 fl Added gsave/grestore to image method
# 2005-05-04 fl Fixed floating point issue in image (from Eric Etheridge)
#
# Copyright (c) 1997-2005 by Secret Labs AB. All rights reserved.
# ... | sserrot/champion_relationships | venv/Lib/site-packages/PIL/PSDraw.py | Python | mit | 6,735 |
"""Core XML support for Python.
This package contains four sub-packages:
dom -- The W3C Document Object Model. This supports DOM Level 1 +
Namespaces.
parsers -- Python wrappers for XML parsers (currently only supports Expat).
sax -- The Simple API for XML, developed by XML-Dev, led by David
Megginso... | ekristen/mythboxee | xml/__init__.py | Python | mit | 1,360 |
import json
from google.appengine.ext import ndb
from models.account import Account
class Suggestion(ndb.Model):
"""
Suggestions are generic containers for user-submitted data corrections to
the site. The generally store a model, a key, and then a json blob of
fields to append or ammend in the model... | synth3tk/the-blue-alliance | models/suggestion.py | Python | mit | 2,411 |
import argparse
import structlog
import logging
from pyramid.paster import get_app
from snovault.elasticsearch.create_mapping import run as run_create_mapping
from dcicutils.log_utils import set_logging
from dcicutils.deployment_utils import CreateMappingOnDeployManager
log = structlog.getLogger(__name__)
EPILOG = _... | hms-dbmi/fourfront | src/encoded/commands/create_mapping_on_deploy.py | Python | mit | 5,218 |
#!/usr/bin/python
# TODO: issues with new oauth2 stuff. Keep using older version of Python for now.
# #!/usr/bin/env python
import json
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
import datetime
from participantCollection import ParticipantCollection
# Edit Me!
participantFileNames =... | foobarbazblarg/stayclean | stayclean-2019-october/update-google-chart.py | Python | mit | 8,223 |
"""
WSGI config for stormtrooper 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_... | CompileInc/stormtrooper | stormtrooper/stormtrooper/wsgi.py | Python | mit | 401 |
""" Unit tests for ``wheezy.templates.engine.Engine``.
"""
import unittest
class EngineTestCase(unittest.TestCase):
""" Test the ``Engine``.
"""
def setUp(self):
from wheezy.template.engine import Engine
from wheezy.template.loader import DictLoader
self.engine = Engine(
... | ezotrank/wheezy.template | src/wheezy/template/tests/test_engine.py | Python | mit | 1,081 |
from collections import defaultdict
import re
import json
import os
import Pubnub as PB
PUB_KEY = os.environ["PUB_KEY"]
SUB_KEY = os.environ["SUB_KEY"]
SEC_KEY = os.environ["SEC_KEY"]
CHANNEL_NAME = os.environ["CHANNEL_NAME"]
def frequency_count(text):
"determine count of each letter"
count = defaultdict(int)... | gregory-nisbet/pubnub-api-example | subscriber.py | Python | mit | 994 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import random
import time
from pyquery import PyQuery as pq
from mongodb import db, conn
from requests.exceptions import ConnectionError
from chem_log import log
# urls = [
# 'http://www.sigmaaldrich.com/china-mainland/zh/analytical-chromatography/ana... | mutoulbj/chem_spider | chem_spider/sigma_urls.py | Python | mit | 10,348 |
#---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------... | BurtBiel/azure-cli | src/command_modules/azure-cli-resource/azure/cli/command_modules/resource/tests/test_api_check.py | Python | mit | 2,871 |
from grslra import testdata
from grslra.grslra_batch import grslra_batch, slra_by_factorization
from grslra.structures import Hankel
from grslra.scaling import Scaling
import numpy as np
import time
# The goal of this experiment is to identify an LTI system from a noisy outlier-contaminated and subsampled observation ... | clemenshage/grslra | experiments/6_grslra/system_identification_lti/system_identification.py | Python | mit | 2,175 |
"""segy.py - read and write SEG-Y files
From command line:
python segy.py <path-to-segy-file>
"""
from collections import OrderedDict
from pprint import pprint
import numpy as np
from sacker import Sacker
# SEG-Y spec: http://www.tritonimaginginc.com/site/content/public/downloads/FileFormatInfo/seg_y_rev1.pdf
... | shamrin/pyxtf | segy.py | Python | mit | 6,783 |
import pytoolkit as tk
module = tk.applications.darknet53
def test_model():
model = module.create(input_shape=(256, 256, 3), weights=None)
assert tuple(module.get_1_over_1(model).shape[1:3]) == (256, 256)
assert tuple(module.get_1_over_2(model).shape[1:3]) == (128, 128)
assert tuple(module.get_1_over... | ak110/pytoolkit | pytoolkit/applications/darknet53_test.py | Python | mit | 752 |
from oauth2_provider.settings import oauth2_settings
from oauthlib.common import generate_token
from django.http import JsonResponse
from oauth2_provider.models import AccessToken, Application, RefreshToken
from django.utils.timezone import now, timedelta
def get_token_json(access_token):
"""
Takes an AccessT... | light940929/omics_api | bio/tools.py | Python | mit | 2,096 |
import Queue
import atexit
import logging
import threading
import traceback
class WorkerPool(object):
""" Pool of worker threads; grows as necessary. """
_lock = threading.Lock()
_pool = None # Singleton.
def __init__(self):
self._idle = [] # Queues of idle workers.
self._workers =... | DailyActie/Surrogate-Model | 01-codes/OpenMDAO-Framework-dev/openmdao.util/src/openmdao/util/wrkpool.py | Python | mit | 3,630 |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:9332")
else:
access = Ser... | stacycoin/stacycoin | contrib/bitrpc/bitrpc.py | Python | mit | 7,840 |
# -*- coding: utf-8 -*-
# 2005/12/06
# Version 0.2.4
# pathutils.py
# Functions useful for working with files and paths.
# http://www.voidspace.org.uk/python/recipebook.shtml#utils
# Copyright Michael Foord 2004
# Released subject to the BSD License
# Please see http://www.voidspace.org.uk/python/license.shtml
# For ... | amir-zeldes/rstWeb | modules/pathutils.py | Python | mit | 19,405 |
alpha = "abcdefghijklmnopqrstuvwxyz"
for n in range(0, 26, 1):
print alpha[0:n+1]
for n in range(26, 1, -1):
print alpha[0:n-1]
"""
alpha = "a"
m = ord(alpha)
n = 0
while n < m:
print chr(m + 1) in range(65, 122)
m += 1
for i in range(ord('a'), 123, 1):
print chr(i[0:m+1])
while m < 123:
print chr(m[0:])... | Valka7a/python-playground | projects/training/alpha-triangle.py | Python | mit | 327 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 Mael Valais <mael.valais@univ-tlse3.fr>
#
# Distributed under terms of the MIT license.
#
# Pour lancer glpsol et générer en même temps le graphe.dot :
# python parseur_noeuds.py --dat noeuds.txt > data.dat && \
# glpsol -m ctp.mod -... | aheba/ctp | parseur_noeuds.py | Python | mit | 14,972 |
import lms_code.lib.rep2 as rep2
from lms_code.analysis.run_bem import bemify, boundary_conditions,\
assemble, constrain, solve, evaluate_surface_disp
from lms_code.analysis.simplified_bem import create_surface_mesh, \
set_params
from codim1.core import simple_line_mesh, combine_meshes, ray_mesh
def create_fau... | tbenthompson/LMS_public | lms_code/analysis/just_detach_bem.py | Python | mit | 846 |
from django.contrib.auth.models import User
from game.models import Point, Team
def addPoint(blame_username, fixer_username):
blame = User.objects.get(username=blame_username)
fixer = User.objects.get(username=fixer_username)
point = Point()
point.blame = blame
point.fixer = fixer
point.save()
return point
def... | MitMaro/The-Blame-Game | game/service.py | Python | mit | 1,086 |
from django.utils import translation
from django.conf import settings
from froide.celery import app as celery_app
from froide.foirequest.models import FoiRequest
from .models import FoiRequestFollower
from .utils import run_batch_update
@celery_app.task
def update_followers(request_id, update_message, template=None... | fin/froide | froide/foirequestfollower/tasks.py | Python | mit | 1,029 |
import numpy as np
import matplotlib.pyplot as plt
import inspect # Used for storing the input
class AquiferData:
def __init__(self, model, kaq, z, Haq, Hll, c, Saq, Sll, poraq, porll,
ltype, topboundary, phreatictop, kzoverkh=None, model3d=False):
'''kzoverkh and model3d only need to be ... | mbakker7/ttim | ttim/aquifer.py | Python | mit | 8,387 |
from django.test import TestCase
from morelia.decorators import tags
from smarttest.decorators import no_db_testcase
from tasks.factories import TaskFactory, UserFactory
@no_db_testcase
@tags(['unit'])
class TaskGetAbsoluteUrlTest(TestCase):
''' :py:meth:`tasks.models.Task.get_absolute_url` '''
def test_sh... | dryobates/testing_django | todo/tasks/tests/test_models.py | Python | mit | 601 |
#------------------------------------------------------------------------------
# Copyright (C) 2009 Richard W. Lincoln
#
# 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 restrictio... | rwl/puddle | puddle/resource/action/home_action.py | Python | mit | 3,827 |
"""
Flow's list of built-in types available in 0.44.0 (Apr 13, 2017).
Related to
https://flow.org/en/docs/types/
and
http://www.saltycrane.com/blog/2016/06/flow-type-cheat-sheet/
"""
def print_type_format(trigger, content=None, description=None):
"""Format output for autocompletion for a given trigger te... | Pegase745/sublime-flowtype | flowtype/listeners/builtintypes.py | Python | mit | 41,312 |
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# 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... | willthames/ansible-lint | lib/ansiblelint/rules/GitHasVersionRule.py | Python | mit | 1,699 |
# backports.functools_lru_cache v1.5
# https://github.com/jaraco/backports.functools_lru_cache
# Copyright (c) 2014-2018 Jason R. Coombs
#
# 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 wit... | orbingol/NURBS-Python | geomdl/functools_lru_cache.py | Python | mit | 8,538 |
'''
Created on Sep 22, 2016
@author: rtorres
'''
import os
from flaskiwsapp.settings.baseConfig import BaseConfig
class DevConfig(BaseConfig):
"""Development configuration"""
ENV = 'dev'
DEBUG = True
DEBUG_TB_ENABLED = True
SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/example'
AUTH0_CAL... | rafasis1986/EngineeringMidLevel | flaskiwsapp/settings/devConfigTemplate.py | Python | mit | 539 |
import socket, threading, thread, os, sys, time
def create(settings):
return IrcBot(settings)
# Revision, yolo
class IrcBot:
_settings = {}
_debug = None
_client = "ArmedGuys IRC Bot"
_version = "0.5"
_env = "Python"
_socket = None
# Channels the bot is in
_channels = []
# Messag... | ArmedGuy/pyircbot | pyircbot.py | Python | mit | 15,149 |
from django.conf import settings
from django.contrib.auth import logout
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_lazy as _
from django.views.generic.base import View, TemplateView
from socialregistration.clients.oauth import ... | vinco/django-socialregistration | socialregistration/views.py | Python | mit | 10,506 |
# -*- coding: utf-8 -*-
import configs.module
import wsgiref.simple_server
import select
import json
import bot
from urllib import parse
import irc.fullparse
import irc.splitparse
import os.path
def init(options):
m = configs.module.Module(__name__)
if 'wserver' in options['server'].state:
del options... | shacknetisp/fourthevaz | modules/core/api/__init__.py | Python | mit | 3,378 |
# Write a function to delete a node (except the tail) in a singly linked list,
# given only access to that node.
#
# Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node
# with value 3, the linked list should become 1 -> 2 -> 4 after calling your function.
#
# time: O(1)
# space: O(1)
# Defini... | RobinCPC/algorithm-practice | LinkedList/deleteNode.py | Python | mit | 1,861 |
from django import template
from djangopress.core.util import smart_truncate_chars as _smart_truncate_chars
register = template.Library()
# truncate chars but leaving last word complete
@register.filter(name='smarttruncatechars')
def smart_truncate_chars(value, max_length):
return _smart_truncate_chars(value, m... | codefisher/djangopress | djangopress/core/templatetags/smart_truncate_chars.py | Python | mit | 330 |
from __future__ import absolute_import, print_function
import os
import pwd
import grp
import sys
import subprocess
from .command import Command
class AuthorizedKeysCommand(Command):
"""
Get authorized keys for a user using NSS and SSSD.
"""
@staticmethod
def configure_parser(parser):
"... | CtrlC-Root/ssh-ldap-utils | ssh_ldap_utils/authorized_keys.py | Python | mit | 2,487 |
"""
Writes Python egg files.
Supports what's needed for saving and loading components/simulations.
"""
import copy
import os.path
import re
import sys
import zipfile
import pkg_resources
from openmdao.util import eggobserver
__all__ = ('egg_filename', 'write')
# Legal egg strings.
_EGG_NAME_RE = re.compile('[a-zA-Z... | DailyActie/Surrogate-Model | 01-codes/OpenMDAO-Framework-dev/openmdao.util/src/openmdao/util/eggwriter.py | Python | mit | 8,098 |
from .. import Provider as PersonProvider
class Provider(PersonProvider):
formats_female = (
'{{first_name_female}} {{last_name}}',
'{{first_name_female}} {{last_name}}',
'{{first_name_female}} {{last_name}}',
'{{first_name_female}} {{last_name}}',
'{{first_name_female}} {{... | danhuss/faker | faker/providers/person/fr_FR/__init__.py | Python | mit | 10,085 |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
import pytest
from openpyxl.xml.functions import fromstring, tostring
from openpyxl.tests.helper import compare_xml
@pytest.fixture
def BubbleChart():
from ..bubble_chart import BubbleChart
return BubbleChart
class TestBubbleChart:
... | cgimenop/Excel2Testlink | ExcelParser/lib/openpyxl/chart/tests/test_bubble_chart.py | Python | mit | 952 |
"""
This module contains a helper to extract various kinds of primitive data types
from a dictionary of strings.
"""
class StringDictHelper:
"""
Helper class to extract primitive types from a dictionary of strings. This is a port
of Java robotutils class StringmapHelper. The special values 'true' an... | josephmjoy/robotics | python_robotutils/robotutils/strmap_helper.py | Python | mit | 3,444 |
from pathlib import Path
import click
from git import Repo
from git.exc import InvalidGitRepositoryError
from logger import logger
from config import config
from utils import PairedObject, PairedProject, get_current_project, PathType
@click.group()
@click.option('-v', '--verbose', is_flag=True, help='Enables verbos... | pnw/env-tracker | main.py | Python | mit | 6,662 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
' module description'
import os
__author__ = 'Andrew Wen'
def file_extension(filename):
"""
获取文件后缀名
:param path:
:return:
"""
#return os.path.splitext(path)[1]
return filename.rsplit('.', 1)[1].lower() | wenanguo/crm | code/pyfw/util/CommonFileUtil.py | Python | mit | 293 |
import datetime
from django.views.generic.detail import SingleObjectMixin
from django.views.generic.list import ListView
from django.views.generic.base import View
from django.utils.translation import ugettext as _
from django.http import Http404, HttpResponseRedirect
from django.core.urlresolvers import reverse
from... | fah-designs/feincms-blogs | blogs/views.py | Python | mit | 3,343 |
"""
We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11).
Now given a string represented by several bits. Return whether the last character must be a one-bit character or not. The given string will always end with a zero.
E... | franklingu/leetcode-solutions | questions/1-bit-and-2-bit-characters/Solution.py | Python | mit | 1,231 |
"""
XML handler for element id condition
"""
# Standard library modules.
# Third party modules.
# Local modules.
from pyhmsa.spec.condition.elementalid import ElementalID, ElementalIDXray
from pyhmsa.fileformat.xmlhandler.condition.condition import _ConditionXMLHandler
# Globals and constants variables.
class Elem... | pyhmsa/pyhmsa | pyhmsa/fileformat/xmlhandler/condition/elementalid.py | Python | mit | 925 |
from gi.repository import GObject, Gtk, Gtranslator, PeasGtk
from panel import Panel
import sys
from gettext import _
class TrobadorPlugin(GObject.Object, Gtranslator.TabActivatable, PeasGtk.Configurable):
__gtype_name__ = "TrobadorPlugin"
tab = GObject.property(type=Gtranslator.Tab)
handler_id = None
... | tomasVega/trobador | gtranslator-plugin/trobador.py | Python | mit | 5,980 |
from helper import greeting
if "__name__" == "__main__":
greeting('hello') | jay4ek/cs3240-labdemo | hello.py | Python | mit | 75 |
# being a bit too dynamic
# pylint: disable=E1101
import datetime
import warnings
import re
from math import ceil
from collections import namedtuple
from contextlib import contextmanager
from distutils.version import LooseVersion
import numpy as np
from pandas.util.decorators import cache_readonly, deprecate_kwarg
im... | dssg/wikienergy | disaggregator/build/pandas/pandas/tools/plotting.py | Python | mit | 116,674 |
from django import forms
from django.forms import Form, ModelForm
from django.utils import timezone
from webapp.models import Task, TaskGroup, TaskGroupSet
from webapp.validators import validate_package
from webapp.widgets import CustomSplitDateTimeWidget
class TaskGroupForm(ModelForm):
class Meta:
model... | algochecker/algochecker-web | webapp/forms.py | Python | mit | 6,858 |
'''
Pypi cache server
Original author: Victor-mortal
'''
import os
import httplib
import urlparse
import logging
import locale
import json
import hashlib
import webob
import gevent
from gevent import wsgi as wsgi_fast, pywsgi as wsgi, monkey
CACHE_DIR = '.cache'
wsgi = wsgi_fast # comment to use pywsgi
host = '0.0.0... | rubik/pyg | tests/pypi_cache_server.py | Python | mit | 3,301 |
#!/usr/bin/env python
""" Example program for JDEV Mercurial tutorial """
from optparse import OptionParser
def calculate_result(white_balls, power_ball):
""" Computation is lauched here """
for ball in white_balls:
if ball < 1 or ball > 59:
return -1
if power_ball < 1 or power_ba... | fjammes/tutorial-git | tp_dvcs/data/lottery_v3.py | Python | cc0-1.0 | 1,056 |
#!/usr/bin/env python
"""PySide port of the network/http example from Qt v4.x"""
import sys
from PySide import QtCore, QtGui, QtNetwork
class HttpWindow(QtGui.QDialog):
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
self.urlLineEdit = QtGui.QLineEdit("http://www.ietf.org/... | Southpaw-TACTIC/Team | src/python/Lib/site-packages/PySide/examples/network/http.py | Python | epl-1.0 | 5,973 |
# Copyright 2012 Kevin Goodsell
#
# This software is licensed under the Eclipse Public License (EPL) V1.0.
from __future__ import with_statement
import time
import unittest
import STAF
class HandleTests(unittest.TestCase):
def assertSTAFResultError(self, rc, func, *args, **kwargs):
try:
fun... | KevinGoodsell/caduceus | test/test_handle.py | Python | epl-1.0 | 5,924 |
"""Unit test of the AlignmentScan
@author: Kay Kasemir
"""
from __future__ import print_function
import unittest
from scan.commands import Set, CommandSequence
from scan.alignment import AlignmentScan
class AlignmentTest(unittest.TestCase):
def testBasics(self):
align = AlignmentScan("motor_x", 0, 10,... | PythonScanClient/PyScanClient | Test/test_alignment.py | Python | epl-1.0 | 1,016 |
import os, requests, time
import mydropbox
edmunds = mydropbox.get_keys('edmunds')
api_key = edmunds['api_key']
api_secret = edmunds['api_secret']
vin = mydropbox.read_dropbox_file(os.path.join('Records', 'Financials', 'Car', 'VIN')).strip()
r = requests.get("https://api.edmunds.com/api/vehicle/v2/vins/%s?&fmt=json&a... | smiley325/accounter | ref/edmunds.py | Python | epl-1.0 | 1,537 |
from __future__ import absolute_import
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.config import ConfigSubsection, ConfigSelection, getConfigListEntry
from Components.SystemInfo import SystemInfo
from Components.Task import job_manager
from Screens.InfoBarGeneric... | atvcaptain/enigma2 | lib/python/Screens/TaskView.py | Python | gpl-2.0 | 5,728 |
# -*- coding: utf-8 -*-
#############################################################################
# File : ConfigCheck.py
# Package : rpmlint
# Author : Frederic Lepied
# Created on : Sun Oct 3 21:48:20 1999
# Purpose :
################################################################... | aborrero/pkg-rpmlint | ConfigCheck.py | Python | gpl-2.0 | 1,798 |
# configobj.py
# A config file reader/writer that supports nested sections in config files.
# Copyright (C) 2005-2014:
# (name) : (email)
# Michael Foord: fuzzyman AT voidspace DOT org DOT uk
# Nicola Larosa: nico AT tekNico DOT net
# Rob Dennis: rdennis AT gmail DOT com
# Eli Courtwright: eli AT courtwright DOT org
#... | theguardian/JIRA-APPy | lib/configobj/configobj.py | Python | gpl-2.0 | 89,640 |
#! /usr/bin/env python
from ppclass import pp
var1 = pp(\
file="/home/aymeric/Big_Data/DATAPLOT/diagfired.nc",\
var="ps",\
x=None,\
y=10.,\
t=2.)
var1.get()
var2 = pp(\
file="/home/aymeric/Big_Data/DATAPLOT/diagfired.nc",\
var="phisinit",\
x=None,\
y=10.,\
t=2.)
var2.get()
var2 = var2 / 3.72
S = var2.func(var1)
S.p... | aymeric-spiga/planetoplot | examples/ppclass_reference/function.py | Python | gpl-2.0 | 493 |
import time
import net.mapserv as mapserv
import net.charserv as charserv
import commands
import walkto
import logicmanager
import status
import plugins
from collections import deque
from net.inventory import get_item_index, get_storage_index
from utils import extends
from actor import find_nearest_being
from chat impo... | mekolat/manachat | plugins/manaboy.py | Python | gpl-2.0 | 11,836 |
"""
WSGI config for geodjango_smurfs 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJA... | cyberbikepunk/smurfs | geodjango_smurfs/wsgi.py | Python | gpl-2.0 | 409 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | cmouse/buildbot | master/buildbot/clients/tryclient.py | Python | gpl-2.0 | 32,055 |