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 |
|---|---|---|---|---|---|
import doctest
import pytest
from insights.parsers import nfnetlink_queue, ParseException
from insights.parsers.tests import skip_exception_check
from insights.tests import context_wrap
NFNETLINK_QUEUE = """
0 -4423 0 2 65535 0 0 22 1
1 -4424 0 2 65535 0 0 27 1
2 ... | RedHatInsights/insights-core | insights/parsers/tests/test_nfnetlink_queue.py | Python | apache-2.0 | 2,689 |
# Copyright 2015 PLUMgrid, Inc. All Rights Reserved.
#
# 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 ... | openstack/networking-plumgrid | networking_plumgrid/neutron/plugins/drivers/fake_plumlib.py | Python | apache-2.0 | 5,565 |
#!/usr/bin/env python2
# Copyright 2012 Google Inc. All Rights Reserved.
#
# 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 require... | TomiBelan/fetchrev | syncgit.py | Python | apache-2.0 | 5,005 |
# @Author: Manuel Rodriguez <valle>
# @Date: 01-Jan-2018
# @Email: valle.mrv@gmail.com
# @Last modified by: valle
# @Last modified time: 07-Jan-2018
# @License: Apache license vesion 2.0
| vallemrv/tpvB3 | cloud/contabilidad/__init__.py | Python | apache-2.0 | 192 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Test.content'
db.alter_column(u'itest_test', 'content'... | xuender/test | testAdmin/itest/migrations/0006_auto__chg_field_test_content.py | Python | apache-2.0 | 1,755 |
#(C) Copyright Syd Logan 2017-2020
#(C) Copyright Thousand Smiles Foundation 2017-2020
#
#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... | slogan621/tscharts | tschartslib/clinicstation/clinicstation.py | Python | apache-2.0 | 30,523 |
default_app_config = 'daiquiri.query.apps.QueryConfig'
| aipescience/django-daiquiri | daiquiri/query/__init__.py | Python | apache-2.0 | 55 |
import logging
from django.db import models
from common.stdlib import json
from jstestnet.system.models import TestSuite
from jstestnet.system.useragent import parse_useragent
log = logging.getLogger('jstestnet')
class Worker(models.Model):
user_agent = models.CharField(max_length=255)
last_heartbeat = mo... | kumar303/jstestnet | jstestnet/work/models.py | Python | apache-2.0 | 4,167 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... | HaebinShin/tensorflow | tensorflow/python/kernel_tests/sparse_ops_test.py | Python | apache-2.0 | 27,450 |
import abc
from nalaf.features import FeatureGenerator
import re
from nalaf import print_debug, print_verbose
class EdgeFeatureGenerator(FeatureGenerator):
"""
Abstract class for generating features for each edge in the dataset.
Subclasses that inherit this class should:
* Be named [Name]FeatureGenera... | Rostlab/nalaf | nalaf/features/relations/__init__.py | Python | apache-2.0 | 10,867 |
import player
import pygame
import menu
import settings as s
pygame.init()
pygame.mixer.init()
class Game:
def __init__(self, numplayers=2, doublebull='ON', mpcalc='ROUND'):
#GAME INFO
self.mpcalc = mpcalc
self.doublebull = doublebull
self.numplayers = numplayers
self.mainLoop = True
self.cl... | DrewMcCarthy/dartboard | game.py | Python | apache-2.0 | 3,208 |
from dependencywatcher.crawler.detectors import Detector
import urllib2, json, logging, os
logger = logging.getLogger(__name__)
class RubyGemsDetector(Detector):
""" rubygems.org API based information detector """
url = "https://rubygems.org/api/v1/gems/%s.json"
auth = "af93e383246a774566bcf661f9c9f591"
... | DependencyWatcher/crawler | dependencywatcher/crawler/rubygems.py | Python | apache-2.0 | 1,359 |
# -*- encoding: utf-8 -*-
#
# 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 to in writing, so... | leandroreox/gnocchi | gnocchi/incoming/file.py | Python | apache-2.0 | 7,168 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); y... | 30loops/nova | nova/tests/test_compute.py | Python | apache-2.0 | 59,837 |
from datetime import timedelta
from rx import Observable
from rx.testing import TestScheduler, ReactiveTest, is_prime, MockDisposable
from rx.disposables import Disposable, SerialDisposable
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
on_error = ReactiveTest.on_error
subscribe = ReactiveTes... | Reactive-Extensions/RxPy | tests/test_group_join.py | Python | apache-2.0 | 84,360 |
[m,n] = map(int,input().split())
def find(v,cs):
for c in cities:
if v in c:
return (True,c)
return (False,set([v]))
cities = []
for _ in range(n):
[a,b] = map(int,input().split())
(ra,fa) = find(a,cities)
(rb,fb) = find(b,cities)
mg = fa | fb
if ra:
cities.r... | a143753/AOJ | 1576.py | Python | apache-2.0 | 497 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-tasks | samples/generated_samples/cloudtasks_v2beta2_generated_cloud_tasks_renew_lease_async.py | Python | apache-2.0 | 1,455 |
import os
from django.db import models
from core.models import PlCoreBase
from core.models import Site
from core.models.site import SitePrivilege
from core.models import User
from core.models import Role
from core.models import Controller,ControllerLinkManager,ControllerLinkDeletionManager
from core.models import Servi... | xmaruto/mcord | xos/core/models/slice.py | Python | apache-2.0 | 9,216 |
# predict.py: Uses a previously trained TensorFlow model to make predictions on a test set
# Copyright 2016 Ramon Vinas
#
# 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.apac... | rvinas/sentiment_analysis_tensorflow | predict.py | Python | apache-2.0 | 3,339 |
from django.test import TestCase
from opendebates.models import Submission
from opendebates.tasks import update_trending_scores
from opendebates.tests.factories import SubmissionFactory, VoteFactory
class TestScores(TestCase):
def test_update_trending_scores(self):
sub1 = SubmissionFactory()
for ... | ejucovy/django-opendebates | opendebates/tests/test_update_scores.py | Python | apache-2.0 | 637 |
import inspect
def caller():
return inspect.stack()[2][3]
def print_debug(msg, tag=None):
if tag:
print('[%s]%s %s' % (caller(), tag, msg))
else:
print('[%s] %s' % (caller(), msg))
| zhouhoo/conceptNet_55_client | tools/debug.py | Python | apache-2.0 | 213 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... | googleads/google-ads-python | google/ads/googleads/v8/services/services/conversion_upload_service/client.py | Python | apache-2.0 | 25,206 |
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | tseaver/google-cloud-python | tasks/google/cloud/tasks_v2beta2/gapic/cloud_tasks_client.py | Python | apache-2.0 | 93,412 |
from mist.mist_job import *
class SimpleStreaming(MistJob, WithStreamingContext, WithPublisher):
def execute(self, parameters):
import time
def takeAndPublish(time, rdd):
taken = rdd.take(11)
self.publisher.publish("-------------------------------------------")
... | KineticCookie/mist | examples-python/simple_streaming.py | Python | apache-2.0 | 1,188 |
# -*- coding: utf-8 -*-
'''
Management of PostgreSQL groups (roles)
=======================================
The postgres_group module is used to create and manage Postgres groups.
.. code-block:: yaml
frank:
postgres_group.present
'''
from __future__ import absolute_import
# Import Python libs
# Import s... | smallyear/linuxLearn | salt/salt/states/postgres_group.py | Python | apache-2.0 | 7,913 |
# 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 to in writing, software
# distributed under the... | viraptor/cryptography | cryptography/hazmat/primitives/asymmetric/dsa.py | Python | apache-2.0 | 3,615 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... | tombstone/models | official/vision/image_classification/optimizer_factory_test.py | Python | apache-2.0 | 4,279 |
"""Auto-generated file, do not edit by hand. VA metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_VA = PhoneMetadata(id='VA', country_code=39, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='(?:0(?:878\\d{5}|6698\\d{5})|[1589]\\d{5,... | gencer/python-phonenumbers | python/phonenumbers/data/region_VA.py | Python | apache-2.0 | 1,604 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008-2015,2018 Contributor
#
# 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... | quattor/aquilon | lib/aquilon/worker/commands/show_resource.py | Python | apache-2.0 | 2,445 |
import dynet_config
dynet_config.set_gpu()
import dynet as dy
import os
import pickle
import numpy as np
import numpy as np
import os,sys
from sklearn import preprocessing
import pickle, logging
import argparse
debug = 0
class falcon_heavy(object):
def __init__(self, model, args):
self.pc = model.add_su... | saikrishnarallabandi/clustergen_steroids | building_blocks/falcon_models.py | Python | apache-2.0 | 7,925 |
"""
This module defines the attributes of the
PyPI package for the mbed SDK test suite ecosystem tools
"""
"""
mbed SDK
Copyright (c) 2011-2015 ARM Limited
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 Licen... | bridadan/mbed-ls | setup.py | Python | apache-2.0 | 1,786 |
# Copyright 2013 IBM Corp.
#
# 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 agree... | ge0rgi/cinder | cinder/tests/unit/compute/test_nova.py | Python | apache-2.0 | 8,409 |
# -*- coding: utf-8 -*-
'''
Install software from the FreeBSD ``ports(7)`` system
.. versionadded:: 2014.1.0
This module allows you to install ports using ``BATCH=yes`` to bypass
configuration prompts. It is recommended to use the :mod:`ports state
<salt.states.freebsdports>` to install ports, but it it also possible... | smallyear/linuxLearn | salt/salt/modules/freebsdports.py | Python | apache-2.0 | 13,305 |
from django.core import checks
from feincms import extensions
class Extension(extensions.Extension):
def handle_model(self):
cls = self.model
def render_json(self, request):
"""Render the feincms regions into a dictionary."""
def region_data(region):
conte... | incuna/feincms-extensions | feincms_extensions/render_json.py | Python | bsd-2-clause | 1,559 |
"""
Definition of the Session class.
"""
import re
import sys
import time
import json
import base64
import random
import hashlib
import asyncio
import weakref
import datetime
from http.cookies import SimpleCookie
from ..event._component import new_type
from ._component2 import PyComponent, JsComponent, AppComponentM... | jrversteegh/flexx | flexx/app/_session.py | Python | bsd-2-clause | 32,665 |
# coding: utf-8
import os
import shutil
from django.core.management.base import BaseCommand
from django.conf import settings
from twiggy_goodies.threading import log
from twiggy_goodies.django import LogMixin
from allmychanges.downloaders import guess_downloaders
from allmychanges.models import (
Changelog)
from... | AllMyChanges/allmychanges.com | allmychanges/management/commands/migrate_downloaders.py | Python | bsd-2-clause | 6,481 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_files\version_updater.ui'
#
# Created: Thu Nov 10 15:32:30 2016
# by: pyside2-uic running on PySide2 2.0.0~alpha0
#
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore, QtGui, QtWidgets
class Ui_Dialo... | sergeneren/anima | anima/ui/ui_compiled/version_updater_UI_pyside2.py | Python | bsd-2-clause | 3,651 |
import os
import re
from contextlib import contextmanager
from itertools import cycle
try:
from invoke.vendor.six import raise_from, iteritems, string_types
except ImportError:
from six import raise_from, iteritems, string_types
from .config import Config, DataProxy
from .exceptions import Failure, AuthFailur... | pyinvoke/invoke | invoke/context.py | Python | bsd-2-clause | 25,409 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
'''
PAC-BAYESIAN DOMAIN ADAPTATION (aka PBDA)
Executable script to use the classifier (to be used after the learning process).
@author: Pascal Germain -- http://researchers.lille.inria.fr/pgermain/
'''
import common
from pbda import *
from dataset import *
from kernel import... | pgermain/pbda | pbda_classify.py | Python | bsd-2-clause | 2,793 |
#!/usr/bin/env python
"""
@package mi.dataset.driver.velpt_ab.dcl
@file mi-dataset/mi/dataset/driver/velpt_ab/dcl/velpt_ab_dcl_recovered_driver.py
@author Joe Padula
@brief Recovered driver for the velpt_ab_dcl instrument
Release notes:
Initial Release
"""
from mi.dataset.dataset_parser import DataSetDriverConfigKe... | JeffRoy/mi-dataset | mi/dataset/driver/velpt_ab/dcl/velpt_ab_dcl_recovered_driver.py | Python | bsd-2-clause | 2,466 |
from django.conf.urls import include, url
# from django.urls import path, include
from . import views
# from django.contrib.auth import views as auth_views
import search.views
app_name = 'users'
urlpatterns = [
url(r'^login/', views.Login.as_view(), name='login'),
url(r'^register/', views.register_view, name... | introini/ourlist | users/urls.py | Python | bsd-2-clause | 1,039 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-17 01:52
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wangblog', '0004_auto_20160416_1039'),
]
operations = [
migr... | wanghe4096/WangBlog | src/wangblog/migrations/0005_auto_20160417_0152.py | Python | bsd-2-clause | 802 |
import logging
import networkx
from .. import Analysis, register_analysis
from ...codenode import BlockNode
from ..calling_convention import CallingConventionAnalysis
import ailment
import ailment.analyses
l = logging.getLogger('angr.analyses.clinic')
class Clinic(Analysis):
"""
A Clinic deals with AILm... | tyb0807/angr | angr/analyses/decompiler/clinic.py | Python | bsd-2-clause | 5,861 |
#!/usr/bin/env python3
#-----------------------------------------------------------------------
#
# Core video, sound and interpreter loop for Gigatron TTL microcomputer
# - 6.25 MHz clock
# - Rendering 160x120 pixels at 6.25MHz with flexible videoline programming
# - Must stay above 31 kHz horizontal sync --> 200 ... | kervinck/gigatron-rom | Core/ROMv2.asm.py | Python | bsd-2-clause | 106,391 |
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import urllib.parse
import requests
from testutils import prefix, api_v0
HOUR = 60 * 60
DAY = HOUR * 24
@prefix... | diegocepedaw/oncall | e2e/test_schedules.py | Python | bsd-2-clause | 6,315 |
"""
URL patterns for the views included in ``django.contrib.auth``.
"""
from django.conf.urls import patterns, url
from registration_withemail.forms import EldonUserAuthenticationForm
urlpatterns = patterns('',
url(r'^login/$', 'django.contrib.auth.views.login',
{'template_name': 'registration/login.html', 'a... | kamagatos/django-registration-withemail | registration_withemail/auth_urls.py | Python | bsd-2-clause | 1,200 |
# -*- coding: UTF-8 -*-
# Copyright 2013-2014 by Luc Saffre.
# License: BSD, see LICENSE for more details.
"""This module is based on Ross McFarland idea to simply send the
server startup signal "at the end of your last app's models.py file"
in his post `Django Startup Signal (Sun 24 June 2012)
<http://www.xormedia.co... | lsaffre/djangosite | djangosite/models.py | Python | bsd-2-clause | 1,293 |
# configuration of access manager domain
#
acConnect()
edit()
startEdit()
cd('/AdminConsole/'+domName)
cmo.setCookieName('OAMCONSOLESESS')
cd('/Clusters/oam_cluster')
cmo.setWeblogicPluginEnabled(true)
cd('/')
servers = cmo.getServers()
for s in servers:
srvName = s.getName()
acConfigServerLog(srvName)
... | kapfenho/iam-deployer | lib/access/oam-config.py | Python | bsd-2-clause | 515 |
from font import font
class zschemaname( font ):
"""
Displays a header name for a Z Schema. It may contain text, images,
equations, etc... but the width of it should be kept to a minimum so
it isn't wider than the containing Z Schema box. See
<a href="zschema.html"><zschema></a> for proper usage.
"""
def... | derekmd/opentag-presenter | tags/zschemaname.py | Python | bsd-2-clause | 2,160 |
import sys
import time
import lexer
import parser
import cfg
import typecheck
import codegen
import errors
import exc
from threading import Lock
compilelock = Lock()
#------------------------------------------------------------------------
# Pipeline
#---------------------------------------------------------------... | seibert/blaze-core | blaze/blir/passes.py | Python | bsd-2-clause | 6,473 |
# -*- coding: utf-8 -*-
#
# TKP API documentation build configuration file, created by
# sphinx-quickstart on Mon Feb 7 17:00:49 2011.
#
# 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.
#
# All... | bartscheers/tkp | documentation/conf.py | Python | bsd-2-clause | 9,711 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_textbox31.py | Python | bsd-2-clause | 1,070 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as et
class XMLReader(object):
def __init__(self, instance):
self.instance = instance
def read(self):
"Convert XML to Dict"
tree = et.fromstring(self.instance.source)
elements = tree.findall(self.insta... | vparitskiy/data-importer | data_importer/readers/xml_reader.py | Python | bsd-2-clause | 463 |
from __future__ import absolute_import
from pymongo.collection import Collection as PymongoCollection
from .Cursor import Cursor
class Collection(PymongoCollection):
def find(self, *args, **kwargs):
return Cursor(self, *args, **kwargs)
| Narrato/mongotron | mongotron/Collection.py | Python | bsd-2-clause | 251 |
# global imports
import numpy as np
import scipy.special as scsp
import scipy.optimize as scop
# local imports
import helper as bhlp
"""
ref Helias14:
Helias, Tetzlaff, Diesmann (2014) The Correlation Structure of
Local Neuronal Networks Intrinsically Results from Recurrent Dynamics
PLoS Comput Biol 10(1): e1003428
D... | jakobj/binary_network | meanfield.py | Python | bsd-2-clause | 6,477 |
from django.core.urlresolvers import resolve, Resolver404
from django.test import TestCase
from conman.routes import views
class RouteRouterViewTest(TestCase):
"""Test the route_router view."""
def assert_url_uses_router(self, url):
"""Check a url resolves to the route_router view."""
resolve... | meshy/django-conman | tests/routes/test_urls.py | Python | bsd-2-clause | 1,649 |
from scattering import scatterer
import numpy as np
from numpy.testing import assert_array_almost_equal, run_module_suite
def test_ones():
scat = scatterer(.1, 0.0, 'water', diameters=np.array([0.04, 0.05]))
scat.set_scattering_model('rayleigh')
assert_array_almost_equal(scat.sigma_b,
... | dopplershift/Scattering | test/test_scatterer.py | Python | bsd-2-clause | 434 |
# coding: utf-8
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
impo... | mindbody/API-Examples | SDKs/Python/test/test_custom_payment_method.py | Python | bsd-2-clause | 980 |
#!/usr/bin/env python
"""
Morfessor 2.0 FlatCat - Python implementation of
the FlatCat variant of the Morfessor method
"""
import logging
__all__ = ['MorfessorException', 'ArgumentException', 'FlatcatIO',
'FlatcatModel', 'flatcat_main', 'get_flatcat_argparser',
'MorphUsageProperties', 'Heuristic... | aalto-speech/flatcat | flatcat/__init__.py | Python | bsd-2-clause | 1,193 |
def dev_nav(active=None):
from uliweb import settings
out = "<span>"
for i in settings.MENUS_DEVELOP.nav:
if active!=i["name"]:
out += "<a href='%s'>%s<a> "%(i["link"],i["title"])
else:
out += "<strong>%s</strong> "%(i["title"])
out += "</span>"
return out
| limodou/uliweb | uliweb/contrib/develop/__init__.py | Python | bsd-2-clause | 318 |
import gdb.printing
# https://sourceware.org/gdb/onlinedocs/gdb/Pretty-Printing.html
# https://sourceware.org/gdb/onlinedocs/gdb/Writing-a-Pretty_002dPrinter.html
COORDINATE_PRECISION = 1e6
coord2float = lambda x: int(x) / COORDINATE_PRECISION
lonlat = lambda x: (coord2float(x['lon']['__value']), coord2float(x['lat']... | frodrigo/osrm-backend | scripts/gdb_printers.py | Python | bsd-2-clause | 17,883 |
from pandalib import myhive, myscene, pandalogichive, pandalogicframe, load_hive, camerabind
import bee, dragonfly
from bee import connect
import Spyder
camerahive = "camera.web"
pandadict = {} # global variable...
# First panda class
a = Spyder.AxisSystem()
a *= 0.005
data = "models/panda-model", "egg", [("walk", ... | agoose77/hivesystem | manual/movingpanda/panda-15c.py | Python | bsd-2-clause | 3,125 |
from future import print_function
print ("This is awsome")
| scollis/Bork | awsome.py | Python | bsd-2-clause | 60 |
# coding=utf-8
__author__ = 'ealexand'
import os
import csv
import zipfile
from flask import render_template, request, Response, current_app, url_for, redirect, jsonify, json
import Utilities as util
def get_tokens_fromCSV(model_name, text_name):
html_root = os.path.join(util.get_model_root(model_name), 'HTML')
... | uwgraphics/SerendipSlim | TextViewer.py | Python | bsd-2-clause | 1,527 |
"""Solve the advection/diffusion equation with PyPFASST."""
# Copyright (c) 2011, Matthew Emmett. 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. Redistributions of source code must ret... | memmett/PyPFASST | examples/advection/main.py | Python | bsd-2-clause | 3,683 |
"""
This script is an example of how to use the random gaussian noise generator (type 2)
module. |br|
In this example only one signal is generated.
Both the minimum and the maximum frequency component in the signal is regulated.
After the generation, spectrum fo the signal is analyzed with an Welch analysis
and p... | JacekPierzchlewski/RxCS | examples/signals/gaussNoise2_ex1.py | Python | bsd-2-clause | 1,832 |
from invoke import task, Collection
from invocations.checks import blacken
from invocations.packaging import release
from invocations import docs, pytest as pytests, travis
@task
def coverage(c, html=True):
"""
Run coverage with coverage.py.
"""
# NOTE: this MUST use coverage itself, and not pytest-co... | bitprophet/pytest-relaxed | tasks.py | Python | bsd-2-clause | 1,883 |
# Copyright (c) 2016, Matt Layman
import unittest
from tap.tests.factory import Factory
class TestCase(unittest.TestCase):
def __init__(self, methodName='runTest'):
super(TestCase, self).__init__(methodName)
self.factory = Factory()
| Mark-E-Hamilton/tappy | tap/tests/testcase.py | Python | bsd-2-clause | 258 |
# -*- coding: utf-8 -*-
import hashlib
import requests
import time
import json
import cgi
from io import StringIO
from xml.dom import minidom
from .messages import MESSAGE_TYPES, UnknownMessage
from .exceptions import ParseError, NeedParseError, NeedParamError, OfficialAPIError
from .reply import TextReply, ImageRep... | zguangyu/wechat-python-sdk | wechat_sdk/basic.py | Python | bsd-2-clause | 37,055 |
from django.core.management.commands.flush import Command as FlushCommand
from django_cassandra_engine.utils import get_engine_from_db_alias
class Command(FlushCommand):
def handle_noargs(self, **options):
engine = get_engine_from_db_alias(options['database'])
if engine == 'django_cassandra_engi... | maria-grigorieva/django_cassandra_engine | django_cassandra_engine/management/commands/flush.py | Python | bsd-2-clause | 1,112 |
#!/usr/bin/env python3
"""
Configure user settings.
- Install files in tschutter/homefiles using symbolic links.
- Configure window manager keybindings.
- Install fonts.
"""
import argparse
import glob
import os
import shutil
import stat
import subprocess
import sys
import tempfile
import time
try:
# pylint: dis... | tschutter/homefiles | install.py | Python | bsd-2-clause | 27,678 |
# Copyright 2015 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.
"""A module for storing and getting objects from datastore.
This module provides Get, Set and Delete functions for storing pickleable
objects in datastore, ... | SummerLW/Perf-Insight-Report | dashboard/dashboard/stored_object.py | Python | bsd-3-clause | 6,638 |
import os
import zmarkdown
import codecs
import difflib
try:
import nose
except ImportError as e:
msg = e.args[0]
msg = msg + ". The nose testing framework is required to run the Python-" \
"Markdown tests. Run `pip install nose` to install the latest version."
e.args = (msg,) + e.args[1:]
r... | zestedesavoir/Python-ZMarkdown | tests/__init__.py | Python | bsd-3-clause | 6,651 |
# Django settings for test_project project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '... | juanique/django-chocolate | test_project/test_project/settings.py | Python | bsd-3-clause | 5,101 |
"""
Human cortical neuron using A-current model in reduced, 2D version of Hodgkin-Huxley model
Section 9.5
"""
from __future__ import division
from PyDSTool import *
from PyDSTool.Toolbox.phaseplane import *
from common_lib import *
import Ch9_HH_red
import Ch9_HH
gentype='vode' # dopri, euler, etc.
# Parameter An =... | robclewley/compneuro | Ch9_HH_compare.py | Python | bsd-3-clause | 1,267 |
from __future__ import unicode_literals
from django.http import Http404
class Resolver404(Http404):
pass
class NoReverseMatch(Exception):
pass
| yephper/django | django/urls/exceptions.py | Python | bsd-3-clause | 167 |
from datetime import datetime, timedelta
from django.test import TestCase
from django.contrib.auth.models import User
from nose.tools import *
from event.models import Calendar, Event, Occurrence, Attendance
class TestCommonManager(TestCase):
def setUp(self):
self.user = User.objects.create(username='Test... | chrischambers/django-calendartools | test_project/event/tests/test_managers.py | Python | bsd-3-clause | 8,416 |
import argparse
import hashlib
import json
import csv
import os
MAESTRO_INDEX_PATH = '../mirdata/indexes/maestro_index.json'
def md5(file_path):
"""Get md5 hash of a file.
Parameters
----------
file_path: str
File path.
Returns
-------
md5_hash: str
md5 hash of data in ... | mir-dataset-loaders/mirdata | scripts/legacy/make_maestro_index.py | Python | bsd-3-clause | 1,799 |
# -*- coding: utf-8 -*-
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.shortcuts import render, redirect, get_object_or_404
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_la... | stephrdev/brigitte | brigitte/accounts/views.py | Python | bsd-3-clause | 3,125 |
from django.db.models import signals
def create_perm(*args, **kwargs):
"""
Creates a fake content type and permission
to be able to check for permissions
"""
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django import VERS... | django-leonardo/django-constance | constance/models.py | Python | bsd-3-clause | 1,142 |
import time
from bento import console, store
from bento.crons.job import Job
class PeriodicMessageCron(Job):
def __init__(self, conf, queue=None):
super().__init__(conf, queue)
self.messages = self.params['messages']
self.current = 0
def main(self):
if self.current >= len(se... | chefhasteeth/BentoBot | bento/crons/periodicmessagecron.py | Python | bsd-3-clause | 540 |
"""
Oracle database backend for Django.
Requires cx_Oracle: http://cx-oracle.sourceforge.net/
"""
import datetime
import decimal
import os
import platform
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import utils
from django.db.backends.base.base import BaseD... | alimony/django | django/db/backends/oracle/base.py | Python | bsd-3-clause | 23,451 |
from .exceptions import SourceException
def log(text, *args, **kwargs):
return
# TODO: use logging
print(text.format(*args, **kwargs))
class ParseError(SourceException):
def __init__(self, token, msg=None):
if msg is None:
msg = "Unable to parse token {}".format(token.name)
... | irskep/computerwords | computerwords/markdown_parser/parser_support.py | Python | bsd-3-clause | 2,981 |
# -*- coding: utf-8 -*-
"""
Data engine implementation based on lighting memory database
(http://symas.com/mdb/).
The Lmdb is initialized, the access needs to use its binding API, though.
Extension packages may provide higher-level APIs based on this.
"""
from __future__ import absolute_import, division, unicode_litera... | eavatar/ava | src/eavatar.ava/ava/core/data.py | Python | bsd-3-clause | 8,549 |
#!/usr/bin/env python
"""
basketPInfo data procesors (rrdtool output)
Rafal Zawadzki <bluszcz@bluszcz.net>
BSD License (license.txt)
"""
import sys
def exit_failure():
" Nice info on failure "
print "usage: %s int\n" % sys.argv[0]
print "int should be 2 (humidity) or 3 (temperature)"
sys.exit(-1)
if... | bluszcz/basketpinfo | python/process_to_rrdtool.py | Python | bsd-3-clause | 812 |
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, q"
tags = "Draw, Line"
import summa
from summa.director import director
from summa import draw
import pyglet, math
class TestLayer(summa.la... | shackra/thomas-aquinas | tests/test_draw_line.py | Python | bsd-3-clause | 667 |
#!/usr/bin/python
from __future__ import print_function
import sys
from sympy import Symbol,symbols,sin,cos,Rational,expand,simplify,collect
from galgebra.printer import enhance_print,Get_Program,Print_Function,Format
from galgebra.deprecated import MV
from galgebra.mv import Nga,ONE,ZERO
from galgebra.ga import Ga
de... | arsenovic/galgebra | examples/Old Format/terminal_check.py | Python | bsd-3-clause | 10,702 |
import unittest
from coval.es import *
class CodeValidatorEsTestCase(unittest.TestCase):
def setUp(self):
pass
def test_cif(self):
self.assertTrue(cif('A58818501'))
self.assertTrue(cif('B00000000'))
self.assertTrue(cif('C0000000J'))
self.assertTrue(cif('D00000000'))
... | jespino/coval | tests/es_tests.py | Python | bsd-3-clause | 4,205 |
# Copyright (c) 2007 MIPS Technologies, 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: redistributions of source code must retain the above copyright
# notice, this list of conditions and ... | koparasy/faultinjection-gem5 | src/cpu/inorder/InOrderCPU.py | Python | bsd-3-clause | 4,432 |
###
# Copyright (c) 2004, Jeremiah Fincher
# 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 conditi... | Alcheri/Plugins | MyPing/config.py | Python | bsd-3-clause | 2,709 |
#!/usr/bin/python
# this script will update the versions in plist and installer files to match that in resource.h
import plistlib, os, datetime, fileinput, glob, sys, string
scriptpath = os.path.dirname(os.path.realpath(__file__))
def replacestrs(filename, s, r):
files = glob.glob(filename)
for line in filein... | mbrucher/ATK-plugins | ATKStereoPhaser/update_version.py | Python | bsd-3-clause | 4,450 |
# Generated by Django 2.0.8 on 2019-01-11 17:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("course_catalog", "0006_adds_timestampedmodel_20190111_0031")]
operations = [
migrations.AlterField(
model_name="course",
name="cr... | mitodl/open-discussions | course_catalog/migrations/0007_alters_created_on_field_20190111_1755.py | Python | bsd-3-clause | 922 |
#!/usr/bin/env python
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# (1) Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# ... | ashcrow/etcdobj | setup.py | Python | bsd-3-clause | 2,107 |
from django.conf.urls import url
from . import views
app_name = 'auth0user'
urlpatterns = [
url(r'^alogin/', views.alogin, name='alogin'),
]
| bretth/django-auth0user | auth0user/urls.py | Python | bsd-3-clause | 147 |
"""
raven.core.processors
~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import re
from raven.utils import varmap
from raven.utils import six
class Processor(object):
def _... | nikolas/raven-python | raven/processors.py | Python | bsd-3-clause | 3,988 |
"""
SQLAlchemy-Utils provides way of automatically calculating aggregate values of
related models and saving them to parent model.
This solution is inspired by RoR counter cache,
`counter_culture`_ and `stackoverflow reply by Michael Bayer`_.
Why?
----
Many times you may have situations where you need to calculate d... | konstantinoskostis/sqlalchemy-utils | sqlalchemy_utils/aggregates.py | Python | bsd-3-clause | 15,378 |
# _*_ coding: utf-8 _*_
"""
@copyright Copyright (c) 2014 Submit Consulting
@author Angel Sullon (@asullom)
@package rrhh
Descripcion: Implementacion de los controladores de la app rrhh
"""
from django.shortcuts import render_to_response, get_object_or_404
from django.template.context import RequestContext
... | submitconsulting/backenddj | apps/rrhh/views.py | Python | bsd-3-clause | 16,713 |
# *-* coding=utf-8 *-*
from django.conf import settings
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from django.forms.widgets import flatatt
from django.utils.encoding import smart_unicode, force_unicode
from django.template.loader... | ninjaotoko/djblog | djblog/forms.py | Python | bsd-3-clause | 1,755 |
"""
APIs that deal with the edx cached data
"""
import datetime
import logging
from collections import namedtuple
from django.db import transaction
from requests.exceptions import HTTPError
from edx_api.client import EdxApi
from backends import utils
from backends.constants import COURSEWARE_BACKEND_URL, BACKEND_EDX_... | mitodl/micromasters | dashboard/api_edx_cache.py | Python | bsd-3-clause | 15,571 |
#!/usr/bin/env python3
###############################################################################
# Copyright (c) Intel Corporation - All rights reserved. #
# This file is part of the LIBXSMM library. #
# ... | hfp/libxsmm | samples/deeplearning/tvm_cnnlayer/mb1_tuned_latest.py | Python | bsd-3-clause | 20,227 |