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 |
|---|---|---|---|---|---|
"""Utility classes and functions for configuring and setting up the content and the look of a QR code."""
import datetime
import decimal
from collections import namedtuple
from dataclasses import dataclass, asdict
from datetime import date
from typing import Optional, Any, Union, Sequence
from django.utils.html import... | dprog-philippe-docourt/django-qr-code | qr_code/qrcode/utils.py | Python | bsd-3-clause | 30,602 |
from __future__ import print_function
from BinPy import *
print ('Usage of IC 7430:\n')
ic = IC_7430()
print ('\nThe Pin configuration is:\n')
p = {1: 0, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 0, 11: 1, 12: 1, 14: 1}
print (p)
print ('\nPin initialization -using -- ic.setIC(p) --\n')
ic.setIC(p)
print ('\nPowering up the IC ... | coder006/BinPy | BinPy/examples/ic/Series_7400/IC7430.py | Python | bsd-3-clause | 1,126 |
from django_anysign import api as django_anysign
class SignatureType(django_anysign.SignatureType):
pass
class Signature(django_anysign.SignatureFactory(SignatureType)):
pass
class Signer(django_anysign.SignerFactory(Signature)):
pass
| novafloss/django-anysign | demo/django_anysign_demo/models.py | Python | bsd-3-clause | 253 |
from south.db import db
from django.db import models
from dinette.models import *
class Migration:
def forwards(self, orm):
# Creating unique_together for [user] on DinetteUserProfile.
db.create_unique('dinette_dinetteuserprofile', ['user_id'])
def backwards(se... | agiliq/Dinette | dinette/migrations/0005_unique_profiles.py | Python | bsd-3-clause | 9,643 |
import numpy,pylab
def rgb_comp(terncoordlist):
# if numpy.array(terncoordlist).sum()==0:
# return numpy.array([1, 1, 1.])
cmy_cmyk=lambda a:a[:3]*(1.-a[3])+a[3]
rgb_cmy=lambda a:1.-a
rgb_cmyk=lambda a:rgb_cmy(cmy_cmyk(a))
return numpy.array([rgb_cmyk(numpy.array(a)) for a in terncoordlist])... | johnmgregoire/JCAPGeneratePrintCode | gen_100m_4el_tern5_quat10_v3.py | Python | bsd-3-clause | 7,185 |
import logging
from django.core.management.base import BaseCommand
from hs_core.models import GenericResource
from hs_core.hydroshare import current_site_url, set_dirty_bag_flag
class Command(BaseCommand):
help = "Convert all generic resources to composite resource"
def handle(self, *args, **options):
... | hydroshare/hydroshare | hs_core/management/commands/migrate_generic_resources.py | Python | bsd-3-clause | 1,841 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timberwyck.settings")
os.environ.setdefault("DJANGO_CONFIGURATION", "Dev")
from configurations.management import execute_from_command_line
execute_from_command_line(sys.argv)
| powellc/timberwyck | manage.py | Python | bsd-3-clause | 313 |
from django import forms
from django.utils.translation import ugettext_lazy as _
from .models import Customer, Session, CompanyProfile
class CustomerUpdateForm(forms.ModelForm):
"""
Update Customer form
Field enhancements:
* therapyCategory uses forms.TypedChoiceField.
"""
class Meta:
... | ylitormatech/terapialaskutus | therapyinvoicing/customers/forms.py | Python | bsd-3-clause | 7,087 |
from datetime import date, datetime, timedelta
from functools import partial
from io import BytesIO
import os
import numpy as np
from numpy import nan
import pytest
from pandas.compat import PY36
import pandas.util._test_decorators as td
import pandas as pd
from pandas import DataFrame, Index, MultiIndex, get_option... | cbertinato/pandas | pandas/tests/io/excel/test_writers.py | Python | bsd-3-clause | 47,648 |
import sys
import threading
import weakref
from django.utils.six.moves import xrange
if sys.version_info < (3, 4):
from .weakref_backports import WeakMethod
else:
from weakref import WeakMethod
def _make_id(target):
if hasattr(target, '__func__'):
return (id(target.__self__), id(target.__func__)... | andyzsf/django | django/dispatch/dispatcher.py | Python | bsd-3-clause | 11,964 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import with_statement
try:
# For Python >= 2.6
import json
except ImportError:
# For Python < 2.6 or people using a newer version of simplejson
import simplejson as json
import random
from datetime imp... | mouadino/pyes | pyes/es.py | Python | bsd-3-clause | 67,840 |
import array
import pandas.io.msgpack as msgpack
from pandas.io.msgpack import ExtType
from .common import frombytes, tobytes
def test_pack_ext_type():
def p(s):
packer = msgpack.Packer()
packer.pack_ext_type(0x42, s)
return packer.bytes()
assert p(b'A') == b'\xd4\x42A' # fixext 1
... | cbertinato/pandas | pandas/tests/io/msgpack/test_extension.py | Python | bsd-3-clause | 2,167 |
from cms.utils.conf import get_cms_setting
from django.conf import settings
from django.conf.urls.defaults import handler500, handler404, patterns, include, \
url
from django.contrib import admin
try:
from django.conf.urls.i18n import i18n_patterns
except ImportError:
from i18nurls.i18n import i18n_patterns... | adaptivelogic/django-cms | cms/test_utils/project/urls.py | Python | bsd-3-clause | 1,114 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 5, transform = "RelativeDifference", sigma = 0.0, exog_count = 0, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_Lag1Trend/cycle_5/ar_/test_artificial_32_RelativeDifference_Lag1Trend_5__0.py | Python | bsd-3-clause | 271 |
#! /usr/bin/env python3
"""
Before you start:
* Demo application requires ``arcade`` packages to be installed: http://arcade.academy/installation_linux.html.
* Make sure `steampak` is available to your Python 3.
1. Set PATH_LIBSTEAM environment variable to a proper path or put `libsteam_api.so` into `demo` directory... | idlesign/steampak | demo/steampak_demo.py | Python | bsd-3-clause | 2,653 |
from __future__ import absolute_import, print_function
import base64
import logging
import six
import traceback
from time import time
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.http... | gencer/sentry | src/sentry/web/api.py | Python | bsd-3-clause | 26,313 |
# Copyright (c) 2015, Nordic Semiconductor
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions ... | strobo-inc/pc-nrfutil | nordicsemi/utility/__init__.py | Python | bsd-3-clause | 1,580 |
""" Models for representing top-level plot objects.
"""
from __future__ import absolute_import
from six import string_types
from ..enums import Location
from ..mixins import LineProps, TextProps
from ..plot_object import PlotObject
from ..properties import Bool, Int, String, Color, Enum, Auto, Instance, Either, List... | mutirri/bokeh | bokeh/models/plots.py | Python | bsd-3-clause | 15,027 |
# Based on https://github.com/sivy/pystatsd
#
# Copyright (c) 2014, Steve Ivy
# All rights reserved.
#
# Copyright (c) 2015. Librato, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * R... | librato/librato-python-web | librato_python_web/statsd/server/daemon.py | Python | bsd-3-clause | 4,981 |
"""Gaussian processes regression."""
# Authors: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
# Modified by: Pete Green <p.l.green@liverpool.ac.uk>
# License: BSD 3 clause
import warnings
from operator import itemgetter
import numpy as np
from scipy.linalg import cholesky, cho_solve
import scipy.optimize
from .... | kevin-intel/scikit-learn | sklearn/gaussian_process/_gpr.py | Python | bsd-3-clause | 22,428 |
# -*- coding: utf-8 -*-
from apps.registro.models.ExtensionAulicaConexionInternet import ExtensionAulicaConexionInternet
from apps.registro.models.TipoConexion import TipoConexion
from django.core.exceptions import ValidationError
from django import forms
class ExtensionAulicaConexionInternetForm(forms.ModelForm):
... | MERegistro/meregistro | meregistro/apps/registro/forms/ExtensionAulicaConexionInternetForm.py | Python | bsd-3-clause | 1,222 |
# Base setting file, content will be imported in DjangoAutoConf
# Default database name, can be override in extra_settings.settings
from .django_dev_server_auto_conf import DjangoDevServerAutoConf
MYSQL_DATABASE_NAME = "test"
AUTHENTICATION_BACKENDS = []
DATABASE_ROUTERS = []
MEDIA_URL = "/media/"
MEDIA_ROOT = "/m... | weijia/djangoautoconf | djangoautoconf/base_settings.py | Python | bsd-3-clause | 1,467 |
#!/usr/bin/env python
"""
For basic applications, MPI is as easy to use as any other
message-passing system. The sample code below contains the complete
communications skeleton for a dynamically load balanced master/slave
application. Following the code is a description of the few functions
necessary to write typic... | fspaolo/mpisubmit | mpi-submit2.py | Python | bsd-3-clause | 3,645 |
# -*- coding: utf-8 -*-
"""Base stuff for providers that handle filesystem directories."""
from xal.provider import ResourceProvider
from xal.dir.resource import Dir
class DirProvider(ResourceProvider):
"""Base class for filesystem directories."""
def __init__(self, resource_factory=Dir):
super(DirPro... | benoitbryon/xal | xal/dir/provider.py | Python | bsd-3-clause | 895 |
from __future__ import absolute_import
from django.utils.html import escape
from sentry.utils.http import absolute_uri
from .base import ActivityEmail
class RegressionActivityEmail(ActivityEmail):
def get_activity_name(self):
return 'Regression'
def get_description(self):
data = self.activ... | mitsuhiko/sentry | src/sentry/plugins/sentry_mail/activity/regression.py | Python | bsd-3-clause | 918 |
from django.conf.urls.defaults import patterns, include, url
from .views import index, status
urlpatterns = urlpatterns = patterns('',
url(r'^$', index, name='dashboard'),
url(r'^status$', status, name='status'),
)
| nyaruka/motome | motome/dashboard/urls.py | Python | bsd-3-clause | 222 |
'''Test for ratio of Poisson intensities in two independent samples
Author: Josef Perktold
License: BSD-3
'''
import numpy as np
import warnings
from scipy import stats
from statsmodels.stats.base import HolderTuple
from statsmodels.stats.weightstats import _zstat_generic2
def test_poisson_2indep(count1, exposu... | statsmodels/statsmodels | statsmodels/stats/rates.py | Python | bsd-3-clause | 12,513 |
# -*- coding: utf-8 -*-
import time
from django.conf import settings
from django.template import Context
from sekizai.context import SekizaiContext
from cms.api import add_plugin, create_page, create_title
from cms.cache import _get_cache_version, invalidate_cms_page_cache
from cms.cache.placeholder import (
_g... | FinalAngel/django-cms | cms/tests/test_cache.py | Python | bsd-3-clause | 37,055 |
#!/usr/bin/env python3
import os
print(os.path.exists(r'/usr/bin/')) #True
print(os.path.exists(r'/usr/bin/env')) #True
name = r'/usr/bin/env.exe'
print(os.path.dirname(name), os.path.basename(name)) #/usr/bin env.exe
print(os.path.splitext(name)) #('/usr/bin/env', '.exe')
print(os.path.split... | yubo/program | python/pp4e/02_system_programming/02_os_path.py | Python | bsd-3-clause | 840 |
import inspect
def get_attributes(obj):
if isinstance(obj, dict):
return obj.keys()
attributes = inspect.getmembers(obj, lambda a: not(inspect.isroutine(a)))
return [attr[0] for attr in attributes if not(attr[0].startswith('__') and attr[0].endswith('__'))]
class AttributesCache(object):
... | lgrech/MapperPy | mapperpy/attributes_util.py | Python | bsd-3-clause | 1,031 |
from collections import OrderedDict
from copy import copy
from floppy.FloppyTypes import Type, MetaType
from threading import Lock
from os.path import isfile
import floppy.graph
NODECLASSES = {}
_NODECLASSES = {}
# STOREDVALUES = {}
class InputNotAvailable(Exception):
pass
class InputAlreadySet(Exception):
... | JLuebben/Floppy | floppy/node.py | Python | bsd-3-clause | 49,457 |
e1,e2,e3 = MV.setup('e1 e2 e3')
print 'Example: Reciprocal Frames e1, e2, and e3 unit vectors.\n\n'
E = e1^e2^e3
Esq = (E*E)()
print 'E =',E
print 'E^2 =',Esq
Esq_inv = 1/Esq
E1 = (e2^e3)*E
E2 = (-1)*(e1^e3)*E
E3 = (e1^e2)*E
pri... | ichuang/sympy | doc/src/modules/galgebra/GA/reciprocalframeGAtest.py | Python | bsd-3-clause | 1,814 |
from nose.tools import *
from nose.plugins.attrib import attr
from django.test import TestCase
from django.core.management import call_command as call
from dasdocc.aggregator.tests.factories import FeedFactory, InvalidFeedFactory
from dasdocc.aggregator.models import Feed
class UpdateValidFeedsTests(TestCase):
d... | JohnRandom/django-aggregator | dasdocc/aggregator/tests/commands/TestUpdateFeeds.py | Python | bsd-3-clause | 786 |
import sys
import argparse
import logging
import importlib
from .server import Server, build_endpoint_description_strings
from .access import AccessLogGenerator
logger = logging.getLogger(__name__)
DEFAULT_HOST = '127.0.0.1'
DEFAULT_PORT = 8000
class CommandLineInterface(object):
"""
Acts as the main CLI en... | maikhoepfel/daphne | daphne/cli.py | Python | bsd-3-clause | 7,303 |
# Licensed under a 3-clause BSD style license - see PYFITS.rst
import ctypes
import gc
import itertools
import math
import re
import time
import warnings
from contextlib import suppress
import numpy as np
from .base import DELAYED, ExtensionHDU, BITPIX2DTYPE, DTYPE2BITPIX
from .image import ImageHDU
from .table impo... | aleksandr-bakanov/astropy | astropy/io/fits/hdu/compressed.py | Python | bsd-3-clause | 87,677 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, with_statement
import contextlib
import sys
import textwrap
from pytest import deprecated_call, raises
from korean import *
@contextlib.contextmanager
def disable_imports(*names):
"""Stolen from Attest."""
import __builtin__
import_ = __bu... | lqez/korean | koreantests.py | Python | bsd-3-clause | 20,731 |
# -*- coding: utf-8 -*-
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from olympia.lib.crypto.tasks import unsign_addons
class Command(BaseCommand):
args = '<addon_id addon_id ...>'
help = 'Unsign a list of addons.'
option_list = BaseCommand.option_li... | jpetto/olympia | src/olympia/addons/management/commands/unsign_addons.py | Python | bsd-3-clause | 916 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from telemetry import decorators
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.core.backends.chrome im... | sgraham/nope | tools/telemetry/telemetry/core/backends/chrome/cros_unittest.py | Python | bsd-3-clause | 4,879 |
import time
def main(request, response):
headers = [("Access-Control-Allow-Origin", "*"),
("Access-Control-Allow-Credentials", "true"),
("Access-Control-Allow-Methods", "GET, POST, PUT, FOO"),
("Access-Control-Allow-Headers", "x-test, x-foo"),
("Access-Co... | youtube/cobalt | third_party/web_platform_tests/XMLHttpRequest/resources/corsenabled.py | Python | bsd-3-clause | 1,098 |
def precision(TP, FP):
return (TP / (TP + FP)) if (TP + FP) > 0 else 0
def recall(TP, FN):
return (TP / (TP + FN)) if (TP + FN) > 0 else 0
def f1(TP, FP, TN, FN):
return ((2 * (((TP / (TP + FP)) * (TP / (TP + FN))) / ((TP / (TP + FP)) + (TP / (TP + FN)))))) if (TP + FP) > 0 and (TP + FN) > 0 else 0
def accurac... | matheuscas/pyfuzzy_toolbox | pyfuzzy_toolbox/evaluation.py | Python | bsd-3-clause | 550 |
# -*- coding: utf-8 -*-
"""Utility functions and classes for testing Pyrseas"""
import sys
import os
import getpass
import tempfile
from unittest import TestCase
import yaml
from pyrseas.config import Config
from pyrseas.database import Database
from pyrseas.augmentdb import AugmentDatabase
from pyrseas.lib.dbconn i... | reedstrm/Pyrseas | pyrseas/testutils.py | Python | bsd-3-clause | 19,886 |
# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# The initial version of the directory_cache_t class was written
# by Matthias Baas (baas@ira.uka.de).
"""Directory c... | avaitla/Haskell-to-C---Bridge | pygccxml-1.0.0/pygccxml/parser/directory_cache.py | Python | bsd-3-clause | 18,986 |
# -*- coding: utf-8 -*-
import htmls
from django import test
from cradmin_legacy import datetimeutils
from model_bakery import baker
from devilry.devilry_cradmin import devilry_listbuilder
class TestItemValue(test.TestCase):
def test_title(self):
testassignment = baker.make('core.Assignment', long_name... | devilry/devilry-django | devilry/devilry_cradmin/tests/test_devilry_listbuilder/test_assignment.py | Python | bsd-3-clause | 1,305 |
# flake8: noqa
from .main import BasicAuthIdentityPolicy
| morepath/more.basicauth | more/basicauth/__init__.py | Python | bsd-3-clause | 58 |
#!/usr/bin/env python
#
# This software is distributed under BSD 3-clause license (see LICENSE file).
#
# Authors: Heiko Strathmann
from numpy import array
from numpy.random import seed, rand
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm.load_numbers('../data/fm_train_real.dat')
testdat = lm.load_nu... | sorig/shogun | examples/undocumented/python/modelselection_grid_search_krr.py | Python | bsd-3-clause | 4,752 |
from .models import Budget, Expense
from django import forms
class BudgetForm(forms.ModelForm):
class Meta:
model = Budget
fields = (
'title',
'residence_fee',
'neighborhood',
)
class ExpenseForm(forms.ModelForm):
class Meta:
model = Expense
fields = (
'title',
'des... | pabulumm/neighbors | budget/forms.py | Python | bsd-3-clause | 408 |
#!/usr/bin/env python
# Use the sample code in example_01.py. Create three functions named
# func1, func2, and func3.
#
# Make func1 print:
# "Hello World"
#
# Make func2 print:
# "It's nice to meet you"
#
# Make func3 print:
# "Howdeeeee"
# Put your code here:
# Now, make a new function called `using_functions`.
#... | glenjarvis/decorator_training | src/answer01.py | Python | bsd-3-clause | 668 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import logging
import os
import sys
def CaptureLogging(f):
'''Call the function |f|, capturing any logging output ... | cvsuser-chromium/chromium | chrome/common/extensions/docs/server2/test_util.py | Python | bsd-3-clause | 1,383 |
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyri... | mazaclub/mazabot-core | plugins/Factoids/config.py | Python | bsd-3-clause | 4,152 |
from __future__ import unicode_literals
from django import forms
from django.forms.models import inlineformset_factory
from django.forms.widgets import ClearableFileInput
from ...product.models import (ProductImage, Product, ShirtVariant, BagVariant,
Shirt, Bag)
PRODUCT_CLASSES = {
... | hongquan/saleor | saleor/dashboard/product/forms.py | Python | bsd-3-clause | 1,964 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
... | vlegoff/tsunami | src/secondaires/botanique/commandes/__init__.py | Python | bsd-3-clause | 1,675 |
'''Custom models for the block_comment app.'''
import difflib
from django.contrib.comments.models import Comment
from django.db import models
from django.utils.translation import ugettext as _
from block_comment.diff_match_patch import diff_match_patch
class BlockComment(Comment):
'''
``BlockComment`` exten... | gabrielhurley/django-block-comment | block_comment/models.py | Python | bsd-3-clause | 2,966 |
from niprov.formatxml import XmlFormat
from niprov.formatjson import JsonFormat
from niprov.pictures import PictureCache
class FileMedium(object):
def __init__(self, dependencies):
self.filesys = dependencies.getFilesystem()
self.clock = dependencies.getClock()
self.listener = dependencie... | ilogue/niprov | niprov/mediumfile.py | Python | bsd-3-clause | 750 |
import sys
import networkx as nx
def main(graphml):
g = nx.read_graphml(graphml)
nx.write_graphml(g, graphml)
if __name__ == '__main__':
main(sys.argv[1])
| sebwink/deregnet | graphs/kegg/keggtranslator/bin/make_graphml_igraph_readable.py | Python | bsd-3-clause | 169 |
#!/usr/bin/env vpython3
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import argparse
import logging
import sys
import gold_inexact_matching.base_parameter_optimiz... | ric2b/Vivaldi-browser | chromium/content/test/gpu/determine_gold_inexact_parameters.py | Python | bsd-3-clause | 4,018 |
#coding: utf-8
VERSION = "2.0" | tos-kamiya/agec | src/_version_data.py | Python | mit | 31 |
import logging
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.http import Http404
from readthedocs.projects.models import Project, Domain
log = logg... | SteveViss/readthedocs.org | readthedocs/core/middleware.py | Python | mit | 6,904 |
#!/usr/bin/python
# Generate .js files defining Blockly core and language messages.
#
# Copyright 2013 Google Inc.
# https://developers.google.com/blockly/
#
# 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 t... | NTUTVisualScript/Visual_Script | static/javascript/blockly/i18n/create_messages.py | Python | mit | 6,374 |
## Automatically adapted for numpy.oldnumeric May 17, 2011 by -c
# Natural Language Toolkit: Classifiers
#
# Copyright (C) 2001 University of Pennsylvania
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
#
# $Id: __init__.py,v 1.2 2003/10/27... | ronaldahmed/robot-navigation | neural-navigation-with-lstm/MARCO/nltk_contrib/unimelb/tacohn/classifier/__init__.py | Python | mit | 21,922 |
"""A Python module for interacting with Slack's RTM API."""
import inspect
import json
import logging
import time
from concurrent.futures.thread import ThreadPoolExecutor
from logging import Logger
from queue import Queue, Empty
from ssl import SSLContext
from threading import Lock, Event
from typing import Optional, C... | slackhq/python-slackclient | slack_sdk/rtm_v2/__init__.py | Python | mit | 16,519 |
##########################################################################
# Copyright (c) 2009, 2016, ETH Zurich.
# All rights reserved.
#
# This file is distributed under the terms in the attached LICENSE file.
# If you do not find this file, copies can be found by writing to:
# ETH Zurich D-INFK, Universitaetstr 6, ... | kishoredbn/barrelfish | tools/harness/machines/eth_machinedata.py | Python | mit | 22,961 |
import json
from zipfile import ZipFile
import uuid
import activity
import re
import os
from os.path import isfile, join
from os import listdir, makedirs
from os import path
import datetime
from S3utility.s3_notification_info import S3NotificationInfo
from provider.execution_context import Session
import requests
from... | gnott/elife-bot | activity/activity_VersionDateLookup.py | Python | mit | 3,787 |
from flask_settings import GEOTIFF_FULL_PATH
import sys
import traceback
sys.path.append('../')
import numpy as np
import json
from datetime import timedelta
from functools import update_wrapper
from pextant.EnvironmentalModel import GDALMesh
from pextant.explorers import Astronaut
from pextant.analysis.loadWaypoints... | kezilu/pextant | pextant/sextant.py | Python | mit | 6,172 |
import abc
class Container(abc.ABC):
"""
A container for exposed methods and/or event handlers
for a better modularization of the application.
Example usage
::
# in users.py
class UsersModule(gemstone.Container):
@gemstone.exposed_method("users.register")
... | vladcalin/gemstone | gemstone/core/container.py | Python | mit | 1,639 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/structure/shared_generic_house_player_small_style_02_floorp... | anhstudios/swganh | data/scripts/templates/object/draft_schematic/structure/shared_generic_house_player_small_style_02_floorplan_02.py | Python | mit | 487 |
"""Load font "constants" (actually void *s) from the GLUT DLL"""
from OpenGL import platform
import logging
log = logging.getLogger( 'OpenGL.GLUT.fonts' )
for name in [
'GLUT_STROKE_ROMAN',
'GLUT_STROKE_MONO_ROMAN',
'GLUT_BITMAP_9_BY_15',
'GLUT_BITMAP_8_BY_13',
'GLUT_BITMAP_TIMES_ROMAN_10',
'GL... | Universal-Model-Converter/UMC3.0a | data/Python/x86/Lib/site-packages/OpenGL/GLUT/fonts.py | Python | mit | 946 |
import kinterbasdb
import time
import mx
from elementtree import ElementTree
class Callable:
def __init__(self, anycallable):
self.__call__ = anycallable
class EQLogDB:
def __init__(self):
# Connect to the DB
self.con = EQLogDB.getConnection()
def getConnection():
retu... | easel/gamestats | src/spyce/eqlogdb.py | Python | mit | 10,655 |
import sys
import gael.testing
def test__add_appsever_import_paths__multiple_calls__only_adds_once():
components_before_add = len(sys.path)
gael.testing.add_appsever_import_paths()
components_after_first_add = len(sys.path)
gael.testing.add_appsever_import_paths()
components_after_second_add = len... | blairconrad/LibraryHippo | Tests/test_gael_testing.py | Python | mit | 425 |
import logging
import re
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_fsm import FSMIntegerField
from model_ut... | opennode/nodeconductor-assembly-waldur | src/waldur_mastermind/support/models.py | Python | mit | 14,894 |
from pyotp.otp import OTP
from pyotp import utils
class HOTP(OTP):
def at(self, count):
"""
Generates the OTP for the given count
@param [Integer] count counter
@returns [Integer] OTP
"""
return self.generate_otp(count)
def verify(self, otp, counte... | toefl/pyotp | src/pyotp/hotp.py | Python | mit | 1,325 |
# coding=utf-8
# !/usr/bin/env python
try:
from setuptools import setup
except ImportError:
print('No setuptools installed, use distutils')
from distutils.core import setup
with open('requirements.txt') as f:
required = f.read().splitlines()
setup(
name='hokuyo-python-lib',
packages=[
... | old-paoolo/hokuyo-python-lib | setup.py | Python | mit | 1,228 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os
import imp
import hmac
import hashlib
import six
from flask import Flask, abort, request
DEBUG = os.environ.get("DEBUG", False) == 'True'
HOST = os.environ.get("HOST", '0.0.0.0')
ROOT_DIR = os.path.dirname(os.p... | pyupio/octohook | hook/hook.py | Python | mit | 3,954 |
import socket
import sys
def set_keepalive(sock, interval=1, probes=5):
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, interval)
if hasattr(socket, 'TCP_KEEPCNT'):
sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPCNT, probes)
if hasattr(socket, 'TCP_KEEPIDLE'):
sock.setsockopt(sock... | dw/scratch | tcp_ka2.py | Python | mit | 658 |
import time
import rhc.timer as timer
class Action(object):
def __init__(self):
self.t1 = False
self.t2 = False
def a1(self):
self.t1 = True
def a2(self):
self.t2 = True
def test_no_start():
t = timer.Timer()
a = Action()
t.add(a.a1, 15)
t.add(a.a2, 10... | robertchase/rhc | tests/test_timer.py | Python | mit | 2,103 |
from contextlib import contextmanager
import pickle
import sqlalchemy as tsa
from sqlalchemy import ARRAY
from sqlalchemy import bindparam
from sqlalchemy import BLANK_SCHEMA
from sqlalchemy import Boolean
from sqlalchemy import CheckConstraint
from sqlalchemy import Column
from sqlalchemy import column
from sqlalchem... | monetate/sqlalchemy | test/sql/test_metadata.py | Python | mit | 176,328 |
import os
import logging, logging.handlers
import environment
import logconfig
# If using a separate Python package (e.g. a submodule in vendor/) to share
# logic between applications, you can also share settings. Just create another
# settings file in your package and import it like so:
#
# from comrade.core.set... | deddokatana/Ba3-Shop2 | settings.py | Python | mit | 8,109 |
from flask import Blueprint
from flask import request, flash, redirect, url_for, render_template
bp = Blueprint('doc', __name__)
@bp.route('/')
def doc():
flash('not finished yet')
return render_template('index.html')
| gobuild/gobuild3 | web/routers/doc.py | Python | mit | 228 |
import parmed.unit as units
from intermol.decorators import accepts_compatible_units
from intermol.forces.abstract_dihedral_type import AbstractDihedralType
class ProperPeriodicDihedralType(AbstractDihedralType):
__slots__ = ['phi', 'k', 'multiplicity', 'weight', 'improper']
@accepts_compatible_units(None, ... | shirtsgroup/InterMol | intermol/forces/proper_periodic_dihedral_type.py | Python | mit | 1,984 |
"""runpy.py - locating and running Python code using the module namespace
Provides support for locating and running Python scripts using the Python
module namespace instead of the native filesystem.
This allows Python code to play nicely with non-filesystem based PEP 302
importers when locating support scripts ... | ericlink/adms-server | playframework-dist/play-1.1/python/Lib/runpy.py | Python | mit | 3,681 |
# -*- coding: utf-8 -*-
"""
Django settings for ad-manage project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_l... | dilosung/ad-manage | config/settings/common.py | Python | mit | 13,364 |
# ===================================================================
#
# Copyright (c) 2016, Legrandin <helderijs@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributio... | mchristopher/PokemonGo-DesktopMap | app/pylibs/osx64/Cryptodome/PublicKey/RSA.py | Python | mit | 28,324 |
#coding:utf8
'''
Created on 2013-5-8
@author: lan (www.9miao.com)
'''
from dbpool import dbpool
from MySQLdb.cursors import DictCursor
from numbers import Number
from gtwisted.utils import log
import traceback
from gfirefly.utils.singleton import Singleton
M2DB_PORT = 5000
M2DB_HOST = "127.0.0.1"
SYNC_TYPE = 1
clas... | yangdw/PyRepo | src/annotation/gfirefly/gfirefly/gfirefly/dbentrust/util.py | Python | mit | 8,514 |
# This is the version of this source code.
manual_verstr = "1.5"
auto_build_num = "212"
verstr = manual_verstr + "." + auto_build_num
try:
from pyutil.version_class import Version as pyutil_Version
__version__ = pyutil_Version(verstr)
except (ImportError, ValueError):
# Maybe there is no pyutil insta... | prudnikov/python-oauth2 | oauth2/_version.py | Python | mit | 438 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_moncal_female.iff"
result.attribute_template_id = 9
result.st... | obi-two/Rebelion | data/scripts/templates/object/mobile/shared_moncal_female.py | Python | mit | 441 |
"""
Visualization of ARGs (Ancestral Recombination Graphs)
"""
# python imports
from itertools import chain, izip
import random
from math import *
# rasmus imports
from rasmus import util, treelib, stats, sets
# compbio imports
from compbio import arglib
# summon imports
import summon
from summon import sumtr... | wutron/compbio | compbio/vis/argvis.py | Python | mit | 29,618 |
import logging
import os
import sys
from nltk.corpus import stopwords as nltk_stopwords
from hunmisc.utils.huntool_wrapper import Hundisambig, Ocamorph, OcamorphAnalyzer, MorphAnalyzer # nopep8
from stemming.porter2 import stem as porter_stem
from utils import get_cfg
class Lemmatizer():
def __init__(self, cfg... | kornai/4lang | src/fourlang/lemmatizer.py | Python | mit | 5,587 |
t = input()
mem = {}
for _ in range(0, t):
n = input()
c = n / 2
le = s = n % 2
e = n % 2
nearest_n = n - min([n - i for i in mem.keys() if i <= n and i % 2 == e] + [n])
if nearest_n == n:
s = m[nearest_n][0]
else:
if nearest_n > 0:
m = mem[nearest_n]
s = m[0]
le = m[1]
c -= nearest_n / ... | amol9/hackerearth | hackerearth/events/june_circuits/set-1/leaf_and_limelight_attack/solution.py | Python | mit | 506 |
# -*- coding: utf-8 -*-
import os
import sys
from formalchemy.i18n import get_translator
from formalchemy import helpers
from formalchemy.helpers import literal
from tempita import Template as _TempitaTemplate
class TempitaTemplate(_TempitaTemplate):
default_encoding = None
try:
from mako.lookup import TemplateL... | FormAlchemy/formalchemy | formalchemy/templates.py | Python | mit | 4,638 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/bio_engineer/creature/shared_creature_shear_mite.iff"
resu... | anhstudios/swganh | data/scripts/templates/object/draft_schematic/bio_engineer/creature/shared_creature_shear_mite.py | Python | mit | 470 |
# Copyright (C) 2001-2006 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""Encodings and related functions."""
__all__ = [
'encode_7or8bit',
'encode_base64',
'encode_noop',
'encode_quopri',
]
from base64 import encodebytes as _bencode
from quopri import encode... | timm/timmnix | pypy3-v5.5.0-linux64/lib-python/3/email/encoders.py | Python | mit | 2,185 |
import json
from django import template
register = template.Library()
@register.filter
def jsonify(value):
return json.dumps(value)
| Code4SA/municipal-data | municipal_finance/templatetags/jsonify.py | Python | mit | 140 |
#
# Secret Labs' Regular Expression Engine
#
# various symbols used by the regular expression engine.
# run this script to update the _sre include files!
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support modul... | SumiTomohiko/corgi | tools/constants.py | Python | mit | 7,464 |
import os
import tempfile
import re
from pip.util import call_subprocess
from pip.util import display_path, rmtree
from pip.log import logger
from pip.vcs import vcs, VersionControl
from pip.download import path_to_url
from pip._vendor.six.moves import configparser
class Mercurial(VersionControl):
name = 'hg'
... | laborautonomo/pip | pip/vcs/mercurial.py | Python | mit | 5,087 |
class TestRailTestCase:
def __init__(self, title, section, suite, steps):
self.title = title
self.section_name = section
self.suite_name = suite
self.steps = steps
self.type_id = 1
self.priority_id = 4
def to_json_dict(self):
return {
'title':... | 2gis/pytestrail | testrail/testcase.py | Python | mit | 474 |
from __future__ import unicode_literals
import keyword
import re
from collections import OrderedDict
from click import BaseCommand, BaseException
from config import DEFAULT_DB_ALIAS
from ibu import connection as connections
class Command(BaseCommand):
help = "Introspects the database tables in the given databas... | ojengwa/migrate | ibu/schema.py | Python | mit | 12,646 |
#!/usr/bin/env python
import os
import glob
import argparse
import numpy as np
import pandas as pd
import pycondor
import comptools as comp
if __name__ == "__main__":
p = argparse.ArgumentParser(
description='Extracts and saves desired information from simulation/data .i3 files')
p.add_argument('-c... | jrbourbeau/cr-composition | processing/legacy/anisotropy/random_trials/process_teststat.py | Python | mit | 2,883 |
from Scouting2017.model.models2017 import ScoreResult
from django.db.models.aggregates import Avg
from django.db.models.expressions import Case, When
import json
import math
import collections
def get_statistics(regional_code, teams_at_competition, team=0):
'''
The get_statistics function() returns two lists ... | ArcticWarriors/scouting-app | ScoutingWebsite/Scouting2017/model/get_stastics.py | Python | mit | 4,360 |
# pylint: disable=C0103, C0111, C0326, W0122
from setuptools import setup
with open('requirements.txt', 'r') as f:
requirements = f.read().splitlines()
def get_version():
version = {}
with open("trackerjacker/version.py") as fp:
exec(fp.read(), version)
return version['__version__']
def ge... | calebmadrigal/trackerjacker | setup.py | Python | mit | 1,865 |
from __future__ import print_function
from ctypes import cdll, POINTER, byref, c_void_p, c_double
import numpy
import pkg_resources
from icqsol.bem.icqQuadrature import triangleQuadrature
import glob
import sys
PY_MAJOR_VERSION = sys.version_info[0]
# On some distributions the fuly qualified shared library name
# inc... | gregvonkuster/icqsol | tests/testQuadratureCpp.py | Python | mit | 1,770 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/mission/quest_item/shared_jaleela_bindoo_q4_needed.iff"
result.attr... | anhstudios/swganh | data/scripts/templates/object/tangible/mission/quest_item/shared_jaleela_bindoo_q4_needed.py | Python | mit | 483 |