code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
'''
This file contains the manually chosen admin forms, as needed for an easy-to-use
editor.
'''
from django.contrib import admin
from django.conf import settings
from metashare.repository.editor import admin_site as editor_site
from metashare.repository.editor.resource_editor import ResourceModelAdmin, \
LicenceM... | JuliBakagianni/CEF-ELRC | metashare/repository/editor/manual_admin_registration.py | Python | bsd-3-clause | 11,138 |
from decimal import Decimal
import random
import hashlib
from django.conf import settings
from django.core.cache import cache
from django.db.models.signals import post_save, post_delete, m2m_changed
from waffle.models import Flag, Sample, Switch
VERSION = (0, 9, 2)
__version__ = '.'.join(map(str, VERSION))
CACHE_... | ekohl/django-waffle | waffle/__init__.py | Python | bsd-3-clause | 6,842 |
import re
from setuptools import setup, find_packages
__version__ = re.search(r"__version__.*\s*=\s*[']([^']+)[']",
open('dateparser/__init__.py').read()).group(1)
introduction = re.sub(r':members:.+|..\sautomodule::.+|:class:|:func:|:ref:',
'', open('docs/introduction.rs... | scrapinghub/dateparser | setup.py | Python | bsd-3-clause | 2,228 |
from django.db import models
from django.utils.translation import ugettext as _
class Category(models.Model):
title = models.CharField(max_length=50)
slug = models.SlugField()
order = models.IntegerField(default=1)
class Meta:
verbose_name = _('Category')
verbose_name_plural = _('Cat... | MAPC/cedac | map/models.py | Python | bsd-3-clause | 1,599 |
#### PATTERN #######################################################################################
# Authors: Tom De Smedt <tom@organisms.be>, Walter Daelemans <walter.daelemans@ua.ac.be>
# License: BSD License, see LICENSE.txt
# Copyright (c) 2010 University of Antwerp, Belgium
# All rights reserved.
#
# Redistri... | EricSchles/pattern | pattern/__init__.py | Python | bsd-3-clause | 2,541 |
#! -*- coding: utf-8 -*-
"""
Retrieval of version number
This file helps to compute a version number in source trees obtained from
git-archive tarball (such as those provided by githubs download-from-tag
feature). Distribution tarballs (built by setup.py sdist) and build
directories (produced by s... | blue-yonder/bonfire | bonfire/_version.py | Python | bsd-3-clause | 8,274 |
#!/usr/bin/python2
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tests of directory storage adapter."""
import os
import unittest
import directory_storage
import fake_storage
import gsd_sto... | Lind-Project/native_client | build/directory_storage_test.py | Python | bsd-3-clause | 3,028 |
# encoding=utf-8
from .types.compound import (
ModelType, EMPTY_LIST, EMPTY_DICT, MultiType
)
import collections
import itertools
###
### Field ACL's
###
class Role(collections.Set):
"""A Role object can be used to filter specific fields against a sequence.
The Role has a set of names and one function ... | nKey/schematics | schematics/serialize.py | Python | bsd-3-clause | 8,765 |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
from mixbox import fields
from mixbox import typedlist
from mixbox import entities
# internal
import stix
import stix.bindings.stix_common as common_binding
class KillChain(stix.Entity):
__hash__ = entities.E... | STIXProject/python-stix | stix/common/kill_chains/__init__.py | Python | bsd-3-clause | 4,359 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | ericmjl/bokeh | bokeh/io/__init__.py | Python | bsd-3-clause | 2,128 |
from __future__ import unicode_literals
from django.db import models
from django.utils import timezone
class Post(models.Model):
author = models.ForeignKey('auth.User')
title = models.CharField(max_length=200)
text = models.TextField()
created_date = models.DateTimeField(
default=timezone.now)
pu... | curlyjr25/FrogWebsite | frogs/apps/frogblog/models.py | Python | bsd-3-clause | 521 |
def get_all_styles():
"""
Returns previously registered by richtemplates at
``richtemplates.settings.REGISTERED_PYGMENTS_STYLES``.
"""
from richtemplates.settings import REGISTERED_PYGMENTS_STYLES
return REGISTERED_PYGMENTS_STYLES
def get_style(alias):
"""
Returns pygments style class... | lukaszb/django-richtemplates | richtemplates/pygstyles/__init__.py | Python | bsd-3-clause | 437 |
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
#
#
# Parts of this code is from IPyVolume (24.05.2017), used here under
# this copyright and license with permission from the author
# (see https://github.com/jupyter-widgets/ipywidgets/pull/1387)
"""
Functions for ge... | ipython/ipywidgets | ipywidgets/embed.py | Python | bsd-3-clause | 11,226 |
from baseplate.events import FieldKind
from pylons import app_globals as g
from r2.lib.eventcollector import (
EventQueue,
Event,
squelch_exceptions,
)
from r2.lib.utils import sampled
from r2.models import (
FakeSubreddit,
)
class AdEvent(Event):
@classmethod
def get_context_data(cls, reques... | madbook/reddit-plugin-adzerk | reddit_adzerk/lib/events.py | Python | bsd-3-clause | 7,482 |
from django.contrib.auth.models import User
from esus.phorum.models import Category, Table
__all__ = ("user_super", "users_usual", "table_simple")
def user_super(case):
case.user_super = User.objects.create(
username = "superuser",
password = "sha1$aaa$b27189d65f3a148a8186753f3f30774182d923d5",
... | ella/esus | tests/unit_project/tests/fixtures.py | Python | bsd-3-clause | 1,899 |
try:
import arcpy.mapping
from ._publishing import (convert_desktop_map_to_service_draft as convert_map_to_service_draft,
convert_toolbox_to_service_draft)
except:
from ._publishing import (convert_pro_map_to_service_draft as convert_map_to_service_draft,
... | DavidWhittingham/arcpyext | arcpyext/publishing/__init__.py | Python | bsd-3-clause | 362 |
"""HTML utilities suitable for global use."""
from __future__ import unicode_literals
import re
from django.utils.encoding import force_text, force_str
from django.utils.functional import allow_lazy
from django.utils.safestring import SafeData, mark_safe
from django.utils import six
from django.utils.six.moves.urlli... | errx/django | django/utils/html.py | Python | bsd-3-clause | 10,215 |
from msw.models import Page, RichText, MembersPostUser, MembersPostText
from django.contrib import admin
# could add more complicated stuff here consult:
# tutorial: https://docs.djangoproject.com/en/dev/intro/tutorial02/#enter-the-admin-site
# tutorial finished admin.py: https://github.com/haoqili/Django-Tutori... | haoqili/MozSecWorld | apps/msw/admin.py | Python | bsd-3-clause | 504 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 NOEL-BARON Léo
# 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/primaires/salle/types/combustible.py | Python | bsd-3-clause | 3,785 |
import ctypes
from contextlib import contextmanager
import errno
import logging
import os
import platform
import pwd
import grp
import subprocess
from .exceptions import CommandFailed
_logger = logging.getLogger(__name__)
def get_current_user_shell():
return pwd.getpwuid(os.getuid()).pw_shell
def execute_command... | vmalloc/dwight | dwight_chroot/platform_utils.py | Python | bsd-3-clause | 2,868 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.{{ model_name }}List.as_view(), name='list'),
url(r'^new/$', views.{{ model_name }}Create.as_view(), name='create'),
url(r'^(?P<pk>\d+)/$', views.{{ model_name }}Detail.as_view(), name='detail'),
url(r'^(?P<pk>\d+)/... | grantmcconnaughey/django-app-gen | appgen/templates/appgen/python/urls.py | Python | bsd-3-clause | 479 |
# -*- coding: utf-8 -*-
"""
Eve Demo (Secured)
~~~~~~~~~~~~~~~~~~
This is a fork of Eve Demo (https://github.com/pyeve/eve-demo)
intended to demonstrate how a Eve API can be secured by means of
Flask-Sentinel.
For demonstration purposes, besides protecting a couple API endpoints
with a Be... | nicolaiarocci/eve-oauth2 | run.py | Python | bsd-3-clause | 917 |
#!/usr/bin/python -tt
# vim:set ts=4 sw=4 expandtab:
#
# NodeManager plugin for creating credentials in slivers
# (*) empower slivers to make API calls throught hmac
# (*) also create a ssh key - used by the OMF resource controller
# for authenticating itself with its Experiment Controller
# in order to avoid spam... | planetlab/NodeManager | plugins/sliverauth.py | Python | bsd-3-clause | 5,118 |
from django.conf.urls import url, patterns, include
from accounts import views
user_tool_patterns = patterns(
"",
url(r"^lending/$", views.LendingManager.as_view(), name="lending"),
url(r"^manager/$", views.ToolManager.as_view(), name="manager"),
)
# namespaced under account:
urlpatterns = patterns(
... | toolhub/toolhub.co | accounts/urls.py | Python | bsd-3-clause | 1,267 |
"""Lite version of scipy.linalg.
Notes
-----
This module is a lite version of the linalg.py module in SciPy which
contains high-level Python interface to the LAPACK library. The lite
version only accesses the following LAPACK functions: dgesv, zgesv,
dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetr... | ssanderson/numpy | numpy/linalg/linalg.py | Python | bsd-3-clause | 78,991 |
import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-HTMLtoPDF',
version='0.1',
packages=['django_htmlT... | Daiech/django-HTMLtoPDF | setup.py | Python | bsd-3-clause | 1,128 |
import zeit.cms.generation
import zeit.cms.generation.install
import zeit.calendar.calendar
import zeit.calendar.interfaces
@zeit.cms.generation.get_root
def evolve(root):
zeit.cms.generation.install.installLocalUtility(
root, zeit.calendar.calendar.Calendar,
'calendar', zeit.calendar.interfaces.... | ZeitOnline/zeit.calendar | src/zeit/calendar/generation/install.py | Python | bsd-3-clause | 331 |
__author__ = 'mdavid'
| netkicorp/wns-api-server | netki/util/__init__.py | Python | bsd-3-clause | 23 |
from __future__ import print_function
from math import pi
from bokeh.client import push_session
from bokeh.document import Document
from bokeh.models.glyphs import Line, Quad
from bokeh.models import (
Plot, ColumnDataSource, DataRange1d, FactorRange,
LinearAxis, CategoricalAxis, Grid, Legend,
SingleInter... | azjps/bokeh | examples/models/population_server.py | Python | bsd-3-clause | 4,476 |
# Copyright 2016 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.
DEPS = [
'depot_tools/bot_update',
'chromium',
'depot_tools/gclient',
'recipe_engine/json',
'recipe_engine/properties',
'recipe_engine/python',
... | eunchong/build | scripts/slave/recipes/chromium.gpu.recipe_autogen.py | Python | bsd-3-clause | 6,588 |
from scrapy.http import Response
from scrapy.selector import Selector
def xmliter_lxml(obj, nodename, namespace=None, prefix='x'):
from lxml import etree
reader = _StreamReader(obj)
tag = '{%s}%s' % (namespace, nodename) if namespace else nodename
iterable = etree.iterparse(reader, tag=tag, encoding=r... | Partoo/scrapy | scrapy/contrib_exp/iterators.py | Python | bsd-3-clause | 1,404 |
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 = "MovingAverage", cycle_length = 5, transform = "RelativeDifference", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_MovingAverage/cycle_5/ar_12/test_artificial_32_RelativeDifference_MovingAverage_5_12_20.py | Python | bsd-3-clause | 277 |
# This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
import unittest as ut
from h5py import h5p, h5f, ve... | h5py/h5py | h5py/tests/test_h5p.py | Python | bsd-3-clause | 6,042 |
import math
import ctypes
from parse import *
class Matrix(object):
def __init__(self, string=None):
self.values = [1, 0, 0, 1, 0, 0] #Identity matrix seems a sensible default
if isinstance(string, str):
if string.startswith('matrix('):
self.values = [float(x) for x in p... | fathat/squirtle | squirtle/matrix.py | Python | bsd-3-clause | 2,127 |
# MAEC Behavior Class
# Copyright (c) 2018, The MITRE Corporation
# All rights reserved
from mixbox import fields
from mixbox import idgen
import maec
from . import _namespace
import maec.bindings.maec_bundle as bundle_binding
from cybox.core.action_reference import ActionReference
from cybox.common.meas... | MAECProject/python-maec | maec/bundle/behavior.py | Python | bsd-3-clause | 4,501 |
#!/usr/bin/env python
from Crypto import Random
from M2Crypto import EVP
from io_helper import stream
from padding import pad_pkcs5, unpad_pkcs5
from chunk_buffer import ChunkBuffer
ALGORITHM = 'aes_256_cbc'
# AES has a fixed block size of 16 bytes regardless of key size
BLOCK_SIZE = 16
ENC=1
DEC=0
def encrypt(i... | zulu7/pylib | crypto/stream_crypto.py | Python | bsd-3-clause | 1,198 |
# 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.
from integration_tests import chrome_proxy_measurements as measurements
from integration_tests import chrome_proxy_pagesets as pagesets
from telemetry import... | ltilve/chromium | tools/chrome_proxy/integration_tests/chrome_proxy_benchmark.py | Python | bsd-3-clause | 6,442 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
import re
import os
import sys
def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
init_py = open(os.path.join(package, '__init__.py')).read()
return re.match("__version__ = ['... | simonluijk/django-blog | setup.py | Python | bsd-3-clause | 2,546 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from six import with_metaclass
from decimal import Decimal
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.db import models, transaction
from django.db.models.aggregates import Sum
from django.utils.encoding import py... | rfleschenberg/django-shop | shop/models/order.py | Python | bsd-3-clause | 15,637 |
from __future__ import absolute_import
import os
from pymongo import MongoClient
from test_helpers import bases, mixins, mongo
class WhenCreatingTemporaryDatabase(bases.BaseTest):
@classmethod
def configure(cls):
super(WhenCreatingTemporaryDatabase, cls).configure()
cls.database = mongo.Te... | aweber/test-helpers | tests/integration/test_mongo.py | Python | bsd-3-clause | 2,050 |
from base import MediaFile
from fields import MediaFileField
from widgets import AdminMediaFileWidget
| aino/aino-convert | convert/__init__.py | Python | bsd-3-clause | 105 |
import os
from os.path import join, getctime, dirname
import glob
import subprocess
import argparse
def newest_file(root):
path = join(root, "*tar.bz2")
newest = max(glob.iglob(path), key=getctime)
return newest
def upload(pkg, user):
cmd = ["binstar", "upload", "--force","-u", user, pkg]
subproce... | ContinuumIO/multiuserblazeserver | build.py | Python | bsd-3-clause | 1,553 |
""" Database-related functionality for Minos. """
from flask_sqlalchemy import SQLAlchemy
from .app import app, cache
db = SQLAlchemy()
class SonosConfig(db.Model):
""" Database-class that contains the configuration for Sonos funcionality. """
__tablename__ = 'sonos_config'
key = db.Column(db.Stri... | andpe/minos | minos/database.py | Python | bsd-3-clause | 3,364 |
# -*- coding: utf-8 -*-
import contextlib
import logging
import os
import os.path
import yaml
from bravado_core.spec import is_yaml
from six.moves import urllib
from six.moves.urllib import parse as urlparse
from bravado.compat import json
from bravado.requests_client import RequestsClient
log = logging.getLogger(__... | analogue/bravado | bravado/swagger_model.py | Python | bsd-3-clause | 5,223 |
from django.conf.urls.defaults import *
from .views import *
urlpatterns = patterns('',
url(r'^signup/$',
view=SignupLoginView.as_view(
featured_form_mixin_class=SignupMultipleFormMixin),
name='accounts_signup'
),
url(r'^login/$',
view=SignupLoginView.as_view(
... | mfogel/django-signup-login | signup_login/urls.py | Python | bsd-3-clause | 1,287 |
import urllib
import telnetlib
import logging
import cjson
from models import BinaryResource
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django import forms
from django.contrib.auth import authenticate, login
from sana.mrs.openmrs import sendToOpenMRS
from sana.mrs.util i... | addisclinic/mobile-dispatch-server | sana/mrs/views.py | Python | bsd-3-clause | 4,834 |
from django import template
from system.models import Configuration
register = template.Library()
@register.assignment_tag
def get_config(conf_name=None):
if conf_name is None:
raise Exception("Invalid config name")
c = Configuration.get_by_name_all_fields(conf_name)
if not c:
return Non... | globocom/database-as-a-service | dbaas/admin/templatetags/config_tags.py | Python | bsd-3-clause | 453 |
from corehq.util.spreadsheets.excel import WorkbookJSONReader
from soil import DownloadBase
class UnknownFileRefException(Exception):
pass
class ExcelImporter(object):
"""
Base class for `SingleExcelImporter` and `MultiExcelImporter`.
This is not meant to be used directly.
"""
def __init__(... | qedsoftware/commcare-hq | corehq/util/spreadsheets/excel_importer.py | Python | bsd-3-clause | 1,783 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## Based on learner.js (by Blake Allen and Michael Becker)
import itertools
import collections
from collections import defaultdict
import pdb
import phoment
class Change(object):
def __init__(self, change_type, position, input_material, output_material):
... | bhallen/pyparadigms | hypothesize.py | Python | bsd-3-clause | 15,896 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 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
# l... | stormi/tsunami | src/primaires/pnj/editeurs/pedit/edt_stats.py | Python | bsd-3-clause | 3,848 |
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for the stage results."""
from __future__ import print_function
import mock
import os
import signal
import StringIO
import time
from c... | guorendong/iridium-browser-ubuntu | third_party/chromite/cbuildbot/stages/stage_results_unittest.py | Python | bsd-3-clause | 17,223 |
#!/Users/keith.hamilton/Documents/GitHub/keithhamilton/blackmaas/bin/python
#
# The Python Imaging Library.
# $Id$
#
# convert image files
#
# History:
# 0.1 96-04-20 fl Created
# 0.2 96-10-04 fl Use draft mode when converting images
# 0.3 96-12-30 fl Optimize output (PNG, JPEG)
# 0.4 97-01-18 fl ... | keithhamilton/blackmaas | bin/pilconvert.py | Python | bsd-3-clause | 2,387 |
# -*- coding: utf-8 -*-
try:
import json
except ImportError:
import simplejson as json
import math
import pytz
import pytest
import time
import datetime
import calendar
import re
import decimal
import dateutil
from functools import partial
from pandas.compat import range, zip, StringIO, u
import pandas._libs.j... | louispotok/pandas | pandas/tests/io/json/test_ujson.py | Python | bsd-3-clause | 56,148 |
from fjord.base.tests import TestCase
from fjord.feedback.models import ResponseDocType
from fjord.feedback.tests import ResponseFactory
from fjord.search.index import chunked
from fjord.search.tests import ElasticTestCase
class ChunkedTests(TestCase):
def test_chunked(self):
# chunking nothing yields not... | staranjeet/fjord | fjord/search/tests/test_index.py | Python | bsd-3-clause | 1,072 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
import os
import codecs
from setuptools import setup
def read(fname):
file_path = os.path.join(os.path.dirname(__file__), fname)
return codecs.open(file_path, encoding='utf-8').read()
setup(
name='pytest-typehints',
v... | eddie-dunn/pytest-typehints | setup.py | Python | bsd-3-clause | 1,385 |
import operator
from turbion.bits.antispam import Filter
urlpatterns = reduce(
operator.add,
[filter.urlpatterns for name, filter in Filter.manager.all() if hasattr(filter, 'urlpatterns')],
[]
)
| strogo/turbion | turbion/bits/antispam/urls.py | Python | bsd-3-clause | 209 |
import collections
from django import forms
from django.forms.util import ErrorDict
from tower import ugettext as _, ugettext_lazy as _lazy
import amo
from amo import helpers
from applications.models import AppVersion
sort_by = (
('', _lazy(u'Keyword Match')),
('updated', _lazy(u'Updated', 'advanced_search_... | jbalogh/zamboni | apps/search/forms.py | Python | bsd-3-clause | 11,040 |
class Grating:
"""A class that describing gratings. Sigma should be in lines/mm and the
units of the dimensions should be mm.
"""
def __init__(self, name='', spacing=600, order=1, height=100, width=100,
thickness=100, blaze=0, type='transmission'):
# define the variables... | crawfordsm/pyspectrograph | PySpectrograph/Spectrograph/Grating.py | Python | bsd-3-clause | 714 |
#!/usr/bin/env python
import sys
import argparse
import os
import unittest2 as unittest
from ruamel import yaml
from smacha.util import Tester
import rospy
import rospkg
import rostest
ROS_TEMPLATES_DIR = '../src/smacha_ros/templates'
TEMPLATES_DIR = 'smacha_templates/smacha_test_examples'
WRITE_OUTPUT_FILES = Fa... | ReconCell/smacha | smacha_ros/test/smacha_diff_test_examples.py | Python | bsd-3-clause | 3,604 |
from .datareduction import DataReduction
from .datareductionpipeline import DataReductionPipeLine, ProcessingError
| awacha/cct | cct/core2/instrument/components/datareduction/__init__.py | Python | bsd-3-clause | 115 |
# -*- coding: utf-8 -*-
import scrapy
from scraper.items import ResolutionItem
class ResolutionSpider(scrapy.Spider):
name = "resolutions"
allowed_domains = ["www.pmo.gov.il"]
start_urls = ["http://www.pmo.gov.il/Secretary/GovDecisions/Pages/default.aspx"]
def should_retry(self, response):
... | dvirsky/govsearch | scraper/scraper/spiders/resolutions.py | Python | bsd-3-clause | 2,802 |
import re, urllib2
arguments = ["self", "info", "args"]
helpstring = "randfact"
minlevel = 1
def main(connection, info, args) :
"""Returns a random fact"""
source = urllib2.urlopen("http://randomfunfacts.com/").read()
fact = re.search(r"<strong><i>(.*)</i></strong>", source)
connection.msg(info... | sonicrules1234/sonicbot | oldplugins/randfact.py | Python | bsd-3-clause | 378 |
import decimal
import sys
import steel
from steel import chunks
COMPRESSION_CHOICES = (
(0, 'zlib/deflate'),
)
RENDERING_INTENT_CHOICES = (
(0, 'Perceptual'),
(1, 'Relative Colorimetric'),
(2, 'Saturation'),
(3, 'Absolute Colorimetric'),
)
PHYSICAL_UNIT_CHOICES = (
(0, '<Unknow... | gulopine/steel | examples/images/png.py | Python | bsd-3-clause | 6,898 |
from .group_analysis import create_fsl_flame_wf, \
get_operation
__all__ = ['create_fsl_flame_wf', \
'get_operation']
| FCP-INDI/C-PAC | CPAC/group_analysis/__init__.py | Python | bsd-3-clause | 158 |
import numpy as np
from sklearn import datasets, svm
iris = datasets.load_iris()
iris_X = iris.data
iris_y = iris.target
# Set aside the first 10 data points as test data
indicies = np.random.permutation(len(iris_X))
iris_X_train = iris_X[indicies[:-10]]
iris_y_train = iris_y[indicies[:-10]]
iris_X_test = iris_X[i... | samcervantes/scikit-learn-tutorials | statistical-learning-for-scientific-data-processing/supervised-learning/classification-svc-iris.py | Python | bsd-3-clause | 447 |
from __future__ import division, absolute_import, print_function
r''' Test the .npy file format.
Set up:
>>> import sys
>>> from io import BytesIO
>>> from numpy.lib import format
>>>
>>> scalars = [
... np.uint8,
... np.int8,
... np.uint16,
... np.int16,
... ... | naritta/numpy | numpy/lib/tests/test_format.py | Python | bsd-3-clause | 32,619 |
from math import pi
import pandas as pd
from bokeh.sampledata.stocks import MSFT
from bokeh.plotting import *
df = pd.DataFrame(MSFT)[:50]
df['date'] = pd.to_datetime(df['date'])
mids = (df.open + df.close)/2
spans = abs(df.close-df.open)
inc = df.close > df.open
dec = df.open > df.close
w = 12*60*60*1000 # half d... | sahat/bokeh | examples/plotting/cloud/candlestick.py | Python | bsd-3-clause | 853 |
# Time-stamp: <2019-09-25 10:04:48 taoliu>
"""Description: Fine-tuning script to call broad peaks from a single
bedGraph track for scores.
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file LICENSE included with
the distribution).
"""
# ------------... | taoliu/MACS | MACS2/bdgbroadcall_cmd.py | Python | bsd-3-clause | 2,141 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-02-13 22:21
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registration', '0001_initial'),
]
operations = [
migrations.AlterField(
... | dimagi/commcare-hq | corehq/apps/registration/migrations/0002_alter_request_ip.py | Python | bsd-3-clause | 477 |
import operator
import numpy as np
import pytest
from pandas.core.dtypes.common import is_list_like
import pandas as pd
from pandas import (
Categorical,
Index,
Interval,
IntervalIndex,
Period,
Series,
Timedelta,
Timestamp,
date_range,
period_range,
timedelta_range,
)
impo... | TomAugspurger/pandas | pandas/tests/arithmetic/test_interval.py | Python | bsd-3-clause | 10,306 |
# -*- coding: utf-8 -*-
import time
import requests
from datetime import datetime
from logging import getLogger
from typing import Optional
from typing import Dict
from typing import Iterable
from funcy import compose
from funcy import partial
from pandas import DataFrame
from pandas import to_datetime
from pandas imp... | elsehow/moneybot | moneybot/market/scrape.py | Python | bsd-3-clause | 5,485 |
import re
from django.conf import settings
from rest_framework import exceptions, serializers
from olympia import amo
from olympia.accounts.serializers import BaseUserSerializer
from olympia.amo.templatetags.jinja_helpers import absolutify
from olympia.amo.urlresolvers import get_outgoing_url, reverse
from olympia.a... | atiqueahmedziad/addons-server | src/olympia/addons/serializers.py | Python | bsd-3-clause | 32,770 |
from setuptools import setup, find_packages
from setuptools.command.test import test
class TestCommand(test):
def run(self):
from tests.runtests import runtests
runtests()
setup(
name='aino-utkik',
version='0.9.1',
description='Small, clean code with a lazy view dispatcher and class ... | aino/aino-utkik | setup.py | Python | bsd-3-clause | 1,034 |
import datetime
import logging
try:
import threading
except ImportError:
threading = None
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from debug_toolbar.panels import DebugPanel
class ThreadTrackingHandler(logging.Handler):
def __init__(self):... | none-da/zeshare | debug_toolbar/panels/logger.py | Python | bsd-3-clause | 2,377 |
""" Django support. """
from __future__ import absolute_import
import datetime
from os import path
from types import GeneratorType
import decimal
from django import VERSION
if VERSION < (1, 8):
from django.contrib.contenttypes.generic import (
GenericForeignKey, GenericRelation)
else:
from django.cont... | mechaxl/mixer | mixer/backend/django.py | Python | bsd-3-clause | 12,824 |
import json
import os
import re
from django import http
from django.conf import settings
from django.db.transaction import non_atomic_requests
from django.http import HttpResponse, HttpResponseBadRequest
from django.shortcuts import render
from django.utils.encoding import iri_to_uri
from django.views.decorators.cache... | jpetto/olympia | src/olympia/amo/views.py | Python | bsd-3-clause | 5,726 |
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^pyconpads/', include('pyconpads.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admin... | SeanOC/pyconpads | pyconpads/urls.py | Python | bsd-3-clause | 597 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
from cpt.packager import ConanMultiPackager
from cpt.ci_manager import CIManager
from cpt.printer import Printer
class BuilderSettings(object):
@property
def username(self):
""" Set catchorg as package's owner
"""
retur... | ibc/MediaSoup | worker/deps/catch/.conan/build.py | Python | isc | 3,044 |
#!/usr/bin/env python
"""
"""
from __future__ import unicode_literals
from django.conf.urls import patterns, url
from views import *
urlpatterns = patterns('',
url(r'^index/$', FabricIndex.as_view(), name='fabric_index'),
# Users
url(r'^access/$', FabricAccessList.as_view(), name='fabric_access'),
ur... | rangertaha/salt-manager | salt-manager/webapp/apps/fabric/fabhistory/urls.py | Python | mit | 1,051 |
# Copyright (c) 1998-2002 John Aycock
#
# 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, merge, publ... | Katharsis/unfrozen_binary | uncompyle2/spark.py | Python | mit | 23,261 |
import warnings
from xigt.consts import (
ID,
TYPE,
ALIGNMENT,
CONTENT,
SEGMENTATION
)
from xigt.errors import (
XigtError,
XigtStructureError
)
from xigt.ref import id_re
# list.clear() doesn't exist in Python2, but del list[:] has other problems
try:
[].clear
except AttributeError:
... | goodmami/xigt | xigt/mixins.py | Python | mit | 9,014 |
import os.path
from django.core.urlresolvers import reverse
from django.template import Context, Template
from django.template.defaultfilters import slugify
from django.test import TestCase
from django.test.client import Client
from radpress.compat import get_user_model
User = get_user_model()
from radpress.models imp... | AakashRaina/radpress | radpress/tests/base.py | Python | mit | 7,339 |
import os
import peru.runtime as runtime
import shared
class RuntimeTest(shared.PeruTest):
def test_find_peru_file(self):
test_dir = shared.create_dir({
'a/find_me': 'junk',
'a/b/c/junk': 'junk',
})
result = runtime.find_project_file(
os.path.join(test... | oconnor663/peru | tests/test_runtime.py | Python | mit | 466 |
import six
from unittest import TestCase
from dark.reads import Read
from dark.local_align import LocalAlignment
class TestLocalAlign(TestCase):
"""
Test the LocalAlignment class.
With match +1, mismatch -1, gap open -1, gap extend -1 and
gap extend decay 0.0.
"""
def testPositiveMismatch... | terrycojones/dark-matter | test/test_local_align.py | Python | mit | 11,532 |
# -*- coding: utf-8 -*-
import boto.sqs
import uuid
from beaver.transports.base_transport import BaseTransport
from beaver.transports.exception import TransportException
class SqsTransport(BaseTransport):
def __init__(self, beaver_config, logger=None):
super(SqsTransport, self).__init__(beaver_config, l... | moniker-dns/debian-beaver | beaver/transports/sqs_transport.py | Python | mit | 3,043 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/synapse/manual/operations/accesscontrol.py | Python | mit | 11,030 |
from ..io.importer import lexicon_data_to_csvs, import_lexicon_csvs
from ..io.enrichment.lexical import enrich_lexicon_from_csv, parse_file
from .spoken import SpokenContext
class LexicalContext(SpokenContext):
"""
Class that contains methods for dealing specifically with words
"""
def enrich_lexicon(... | PhonologicalCorpusTools/PolyglotDB | polyglotdb/corpus/lexical.py | Python | mit | 2,263 |
"""!event [num]: Displays the next upcoming H@B event."""
__match__ = r"!event( .*)"
| kvchen/keffbot-py | plugins/event.py | Python | mit | 87 |
# coding:utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2021 yutiansut/QUANTAXIS
#
# 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 th... | yutiansut/QUANTAXIS | QUANTAXIS/QASetting/cache.py | Python | mit | 4,703 |
"""SCons.Variables.PathVariable
This file defines an option type for SCons implementing path settings.
To be used whenever a a user-specified path override should be allowed.
Arguments to PathVariable are:
option-name = name of this option on the command line (e.g. "prefix")
option-help = help string for optio... | engineer0x47/SCONS | engine/SCons/Variables/PathVariable.py | Python | mit | 5,616 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('bibtex', '0008_entry_downloadurl'),
]
operations = [
migrations.AlterField(
model_name='entry',
name... | RTSYork/bibtex | bibtex/migrations/0009_auto_20150720_2105.py | Python | mit | 765 |
from collections import OrderedDict, Mapping, Container
from pprint import pprint
from sys import getsizeof
def deep_compare(a, b, pointer='/'):
if a == b:
return
if type(a) != type(b):
reason = 'Different data types'
extra = str((type(a), type(b)))
x(pointer, reason, extra)
... | the-gigi/deep | deeper.py | Python | mit | 3,000 |
from django.conf.urls import url
from views import calendarpage, jsonsearch, fcdragmodify, EventManager, event_view
event_manager = EventManager.as_view()
urlpatterns = [
url(r'^$', calendarpage, name='events'),
url(r'^json/', jsonsearch, name='jsonsearch'),
url(r'^modify/', fcdragmodify, name='fcdragmodify'),
... | InfoSec-CSUSB/club-websystem | src/events/urls.py | Python | mit | 675 |
"""
Script that trains Tensorflow multitask models on QM8 dataset.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import deepchem as dc
import numpy as np
from qm8_datasets import load_qm8
np.random.seed(123)
qm8_tasks, datasets, transformer... | joegomes/deepchem | examples/qm8/qm8_tf_model.py | Python | mit | 1,512 |
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.cache import cache
from django.urls import reverse
from django.utils import timezone
from freezegun import freeze_time
from rest_framework import status, test
from rest_framework.authtoken.models import Token
from . import... | opennode/nodeconductor-assembly-waldur | src/waldur_core/core/tests/test_authentication.py | Python | mit | 7,832 |
"""Support for EcoNet products."""
from datetime import timedelta
import logging
from aiohttp.client_exceptions import ClientError
from pyeconet import EcoNetApiInterface
from pyeconet.equipment import EquipmentType
from pyeconet.errors import (
GenericHTTPError,
InvalidCredentialsError,
InvalidResponseFor... | rohitranjan1991/home-assistant | homeassistant/components/econet/__init__.py | Python | mit | 5,194 |
# Example of managed attributes via properties
class String:
def __init__(self, name):
self.name = name
def __get__(self, instance, cls):
if instance is None:
return self
return instance.__dict__[self.name]
def __set__(self, instance, value):
if not isinstance(v... | tuanavu/python-cookbook-3rd | src/8/extending_a_property_in_a_subclass/example2.py | Python | mit | 1,089 |
#### 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/deed/pet_deed/shared_kimogila_deed.iff"
result.attribute_template_i... | obi-two/Rebelion | data/scripts/templates/object/tangible/deed/pet_deed/shared_kimogila_deed.py | Python | mit | 691 |
import threading
import urllib2
import time, json
import requests
import os.path
#"284330,150810,09,1109,52,071040,17,28432,7406"
countrylist = ["brazil","canada","china","france","japan","india","mexico","russia","uk","us"]
yrs = ["2011","2012","2013","2014","2015"]
dataTable ={"284330":"gold","150810":"crude","09... | hellious/TradeViz | data_pre/collect_2.py | Python | mit | 4,253 |
"""Creates a user """
# :license: MIT, see LICENSE for more details.
import json
import string
import sys
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
@click.command()
@click.argument(... | softlayer/softlayer-python | SoftLayer/CLI/user/create.py | Python | mit | 3,968 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.