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 |
|---|---|---|---|---|---|
from django.db import models
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
import datetime
# Create your models here.
class Article(models.Model):
title = models.CharField(max_length=255)
brief = models.CharField(null=True,blank=True,max_length=255)
category... | XiaJieCom/change | stu103151/days20/project/bbs/models.py | Python | lgpl-2.1 | 2,809 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... | agry/NGECore2 | scripts/mobiles/tatooine/womprat.py | Python | lgpl-3.0 | 1,620 |
#!/usr/bin/env python3
import os
import json
import logging
import unittest
from pycaching import Geocaching
from pycaching.utfgrid import UTFGrid, GridCoordinateBlock
from pycaching.errors import Error
from test.test_geocaching import _username, _password
_this_folder = os.path.dirname(__file__)
sample_files = {i... | kumy/pycaching | test/test_utfgrid.py | Python | lgpl-3.0 | 7,914 |
import unittest
from magnumfe import *
set_log_active(False)
class CacheTest(unittest.TestCase):
def test_initial_update(self):
mesh = UnitCubeMesh(1,1,1)
state = State(mesh)
cache = Cache()
self.assertTrue(cache.requires_update(state))
def test_change_state(self):
mesh = UnitCubeMesh(1,1,1... | micromagnetics/magnum.fe | tests/cache_test.py | Python | lgpl-3.0 | 1,521 |
# graphicsDisplay.py
# ------------------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projects for educational
# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
# John DeNero (denero@cs.berkeley.edu) and Dan ... | rio-group/trabalho-ai-pacman | graphicsDisplay.py | Python | unlicense | 24,882 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import pytest
from ... | pgroudas/pants | tests/python/pants_test/tasks/test_list_goals.py | Python | apache-2.0 | 4,088 |
# -*- coding: utf-8 -*-
import os
from flask import request
from website.addons.dataverse.client import get_study, get_files, \
get_dataverse, connect_from_settings
from website.project.decorators import must_be_contributor_or_public
from website.project.decorators import must_have_addon
from website.util impor... | himanshuo/osf.io | website/addons/dataverse/views/hgrid.py | Python | apache-2.0 | 4,249 |
from django.contrib.contenttypes.models import ContentType
import json
from django.http import Http404, HttpResponse
from django.contrib import messages
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required, user_passes_test
from django.core.urlresolvers import... | gunnery/gunnery | gunnery/core/views.py | Python | apache-2.0 | 7,964 |
# Copyright 2015 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 required by applicable law o... | ivano666/tensorflow | tensorflow/contrib/learn/python/learn/estimators/tensor_signature.py | Python | apache-2.0 | 4,029 |
import unittest
class Test0017(unittest.TestCase):
def test_problem(self):
one_to_nine = [3, 3, 5, 4, 4, 3, 5, 5, 4]
ten_to_nineteen = [3, 6, 6, 8, 8, 7, 7, 9, 8, 8]
twenty_to_ninety = [6, 6, 5, 5, 5, 7, 6, 6]
words_len = 0
sum_1_to_9 = sum(one_to_nine)
sum_10_to_1... | mccxj/leetcode | projecteuler/p0017_test.py | Python | apache-2.0 | 930 |
# Copyright 2013 NEC Corporation
# 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 ... | manasi24/tempest | tempest/scenario/test_large_ops.py | Python | apache-2.0 | 5,090 |
# Copyright 2012, Nachi Ueno, NTT MCL, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | sandvine/horizon | openstack_dashboard/dashboards/project/routers/tests.py | Python | apache-2.0 | 38,873 |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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... | USGSDenverPychron/pychron | pychron/entry/graphic_generator.py | Python | apache-2.0 | 14,662 |
# Copyright (c) 2013 Red Hat, 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... | Paul-Ezell/cinder-1 | cinder/volume/drivers/glusterfs.py | Python | apache-2.0 | 17,430 |
import os
import shutil
from subprocess import call
def main():
# Clean the build directory
if os.path.isdir('./build'):
shutil.rmtree('./build')
# Freeze it
call('python setup.py build')
# Zip it up - 7-zip provides better compression than the zipfile module
# Make sure the 7-zip fo... | alekz112/xlwings | examples/simulation/build_standalone.py | Python | apache-2.0 | 704 |
"""Python API for composing notebook elements
The Python representation of a notebook is a nested structure of
dictionary subclasses that support attribute access
(IPython.utils.ipstruct.Struct). The functions in this module are merely
helpers to build the structs in the right form.
"""
# Copyright (c) IPython Develo... | wusung/ipython-notebook-tabs | kyper/nbformat/v40/nbbase.py | Python | apache-2.0 | 4,854 |
# 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 th... | mtreinish/stestr | stestr/commands/failing.py | Python | apache-2.0 | 4,990 |
#!/usr/bin/env python
# encoding: utf-8
from .user import User
| luke0922/celery_learning | application/models/__init__.py | Python | apache-2.0 | 63 |
'''
1.create private vpc router network with cidr
2.check dhcp ip address
@author Antony WeiJiang
'''
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.operations.resource_operations as res_ops
import zs... | zstackorg/zstack-woodpecker | integrationtest/vm/simulator/dhcp_server_ip/test_dhcp_for_vpcrouter_cidr.py | Python | apache-2.0 | 2,037 |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | apache/libcloud | libcloud/test/dns/test_buddyns.py | Python | apache-2.0 | 6,194 |
# Copyright 2014 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | onecloud/neutron | neutron/tests/functional/agent/linux/base.py | Python | apache-2.0 | 2,637 |
import numpy as np
from scipy.io.wavfile import write
a = np.fromfile('/tmp/file.raw', dtype='int16')
write('/tmp/file.wav', 16000, a)
| Jokeren/neon | loader/test/raw_to_wav.py | Python | apache-2.0 | 136 |
# Copyright 2015-2016 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | osrf/docker_templates | docker_templates/library.py | Python | apache-2.0 | 2,737 |
"""Test Home Assistant json utility functions."""
from json import JSONEncoder
import os
import sys
from tempfile import mkdtemp
import unittest
from unittest.mock import Mock
import pytest
from homeassistant.exceptions import HomeAssistantError
from homeassistant.util.json import SerializationError, load_json, save_... | leppa/home-assistant | tests/util/test_json.py | Python | apache-2.0 | 2,695 |
# 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
# d... | Juniper/nova | nova/virt/libvirt/volume/iscsi.py | Python | apache-2.0 | 3,538 |
revision = 'e966a3afd100'
down_revision = '954c3c4caf32'
branch_labels = None
depends_on = None
import alembic
import sqlalchemy
import requests
import pytz
import dateutil.parser
import datetime
def upgrade():
patreon_users = alembic.op.create_table("patreon_users",
sqlalchemy.Column("id", sqlalchemy.Integer, pri... | mrphlip/lrrbot | alembic/versions/e966a3afd100_separate_patreon_user_table.py | Python | apache-2.0 | 4,230 |
##############################################################################
#copyright 2013, Hamid MEDJAHED (hmedjahed@prologue.fr) Prologue #
#Licensed under the Apache License, Version 2.0 (the "License"); #
#you may not use this file except in compliance with the License. #
#You... | compatibleone/accords-platform | pyaccords/pysrc/ec2instanceinfo.py | Python | apache-2.0 | 13,279 |
# Copyright 2015-2017 F-Secure
# 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, ... | F-Secure/see | see/hooks.py | Python | apache-2.0 | 3,119 |
# Copyright 2014-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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | freedomtan/workload-automation | wlauto/modules/cpuidle.py | Python | apache-2.0 | 3,815 |
'''
Integration Test Teardown case
@author: Youyk
'''
import zstacklib.utils.linux as linux
import zstacklib.utils.http as http
import zstackwoodpecker.setup_actions as setup_actions
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.clean_util as clean_util
import zstackwoodpecker.test_lib as te... | zstackio/zstack-woodpecker | integrationtest/vm/vpc_ha/suite_teardown.py | Python | apache-2.0 | 1,332 |
"""passlib.bcrypt -- implementation of OpenBSD's BCrypt algorithm.
TODO:
* support 2x and altered-2a hashes?
http://www.openwall.com/lists/oss-security/2011/06/27/9
* deal with lack of PY3-compatibile c-ext implementation
"""
#=============================================================================
# imports
... | ioram7/keystone-federado-pgid2013 | build/passlib/passlib/handlers/bcrypt.py | Python | apache-2.0 | 13,180 |
# Copyright (c) 2011 Intel Corporation
# Copyright (c) 2011 OpenStack, LLC.
# 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/l... | tucbill/manila | manila/scheduler/filter_scheduler.py | Python | apache-2.0 | 8,816 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the Mozilla Firefox history database plugin."""
import collections
import unittest
from plaso.lib import definitions
from plaso.parsers.sqlite_plugins import firefox_history
from tests.parsers.sqlite_plugins import test_lib
class FirefoxHistoryPluginTest(... | log2timeline/plaso | tests/parsers/sqlite_plugins/firefox_history.py | Python | apache-2.0 | 6,326 |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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/licens... | USGSDenverPychron/pychron | pychron/core/ui/text_editor.py | Python | apache-2.0 | 1,141 |
# Copyright 2015 Google Inc. All Rights Reserved.
"""Context manager to help with Control-C handling during critical commands."""
import signal
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.core import log
from googlecloudsdk.test.lib import exit_code
class CancellableTestSection(object):
""... | wemanuel/smry | smry/server-auth/ls/google-cloud-sdk/lib/googlecloudsdk/test/lib/ctrl_c_handler.py | Python | apache-2.0 | 1,298 |
#!/usr/bin/env python
import sys, random
if len(sys.argv) != 3:
sys.stderr.write("Must provide file with list of filenames and number of files to pick\n")
sys.exit(1)
file_list = open(sys.argv[1])
file_array = []
for filepath in file_list:
file_array.append(filepath.strip())
try:
choices = int(sys.argv[... | DHTC-Tools/parrot-benchmark-tools | Root/parrot-root/get_file_list.py | Python | apache-2.0 | 494 |
from __future__ import division
import json
import os
import copy
import collections
import argparse
import csv
import neuroglancer
import neuroglancer.cli
import numpy as np
class State(object):
def __init__(self, path):
self.path = path
self.body_labels = collections.OrderedDict()
def loa... | janelia-flyem/neuroglancer | python/neuroglancer/tool/filter_bodies.py | Python | apache-2.0 | 6,932 |
"""
# Licensed to the Apache Software Foundation (ASF) under one *
# or more contributor license agreements. See the NOTICE file *
# distributed with this work for additional information *
# regarding copyright ownership. The ASF licenses this file *
# to you under the Apache License, Version 2.0 (the... | OBIGOGIT/etch | binding-python/runtime/src/main/python/etch/binding/util/StrStrHashMapSerializer.py | Python | apache-2.0 | 2,642 |
"""
Support for MQTT vacuums.
For more details about this platform, please refer to the documentation at
https://www.home-assistant.io/components/vacuum.mqtt/
"""
import logging
import voluptuous as vol
from homeassistant.components.vacuum import DOMAIN
from homeassistant.components.mqtt import ATTR_DISCOVERY_HASH
f... | joopert/home-assistant | homeassistant/components/mqtt/vacuum/__init__.py | Python | apache-2.0 | 2,361 |
import json
from idpproxy.social.oauth import OAuth
import oauth2 as oauth
#from xml.etree import ElementTree as ET
import logging
logger = logging.getLogger(__name__)
__author__ = 'rohe0002'
class LinkedIn(OAuth):
def __init__(self, client_id, client_secret, **kwargs):
OAuth.__init__(self, client_id, cli... | rohe/IdPproxy | src/idpproxy/social/linkedin/__init__.py | Python | bsd-2-clause | 1,002 |
import angr
class InterlockedExchange(angr.SimProcedure):
def run(self, target, value): #pylint:disable=arguments-differ
if not self.state.solver.symbolic(target):
old_value = self.state.memory.load(target, 4, endness=self.state.arch.memory_endness)
self.state.memory.store(target, ... | angr/angr | angr/procedures/win32/InterlockedExchange.py | Python | bsd-2-clause | 525 |
# -*- coding: UTF-8 -*-
# Copyright 2019-2021 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
import subprocess
from rstgen.utils import confirm
from django.core.management.base import BaseCommand
from django.conf import settings
def runcmd(cmd, **kw): # same code as in... | lino-framework/lino | lino/management/commands/install.py | Python | bsd-2-clause | 1,888 |
import shutil
import json
from rest_framework import routers, serializers, viewsets, parsers, filters
from rest_framework.views import APIView
from rest_framework.exceptions import APIException
from rest_framework.response import Response
from django.core.exceptions import ValidationError
from django.core.files.uploa... | memex-explorer/memex-explorer | source/memex/rest.py | Python | bsd-2-clause | 8,218 |
from . import numeric as _nx
from .numeric import asanyarray, newaxis
def atleast_1d(*arys):
res = []
for ary in arys:
ary = asanyarray(ary)
if len(ary.shape) == 0 :
result = ary.reshape(1)
else :
result = ary
res.append(result)
if len(res) == 1:
... | FilipeMaia/afnumpy | afnumpy/core/shape_base.py | Python | bsd-2-clause | 1,076 |
#!/usr/bin/env python
# Author: Timm Linder, linder@cs.uni-freiburg.de
#
# Publishes fake tracked persons and the corresponding detections (if not occluded) at
# /spencer/perception/tracked_persons and /spencer/perception/detected_persons.
import rospy, yaml, tf
from spencer_tracking_msgs.msg import TrackedPersons, Tr... | pirobot/pedsim_ros | pedsim_simulator/scripts/mocktracks_rss_scenario_one.py | Python | bsd-2-clause | 12,091 |
"""
Implements a simple, robust, safe, Messenger class that allows one to
register callbacks for a signal/slot (or event/handler) kind of
messaging system. One can basically register a callback
function/method to be called when an object sends a particular event.
The Messenger class is Borg. So it is easy to instanti... | liulion/mayavi | tvtk/messenger.py | Python | bsd-3-clause | 10,137 |
import unittest
from django.db import connection, migrations, models
from django.db.migrations.state import ProjectState
from django.test import override_settings
from .test_operations import OperationTestBase
try:
import sqlparse
except ImportError:
sqlparse = None
class AgnosticRouter(object):
"""
... | memtoko/django | tests/migrations/test_multidb.py | Python | bsd-3-clause | 6,893 |
# -*- coding: utf-8 -*-
import ipaddress
__all__ = [
'config_to_map',
'get_region'
]
def config_to_map(topology_config):
"""
args:
topology_config: dict
{
'region1': [
'10.1.1.0/24',
'10.1.10.0/24',
'172.1... | polaris-gslb/polaris-core | polaris_common/topology.py | Python | bsd-3-clause | 2,452 |
#!/usr/bin/python
# ex:set fileencoding=utf-8:
from __future__ import unicode_literals
from django.db.models import Q
# from djangobmf.permissions import ModulePermission
from djangobmf.utils import FilterQueryset
class GoalFilter(FilterQueryset):
def filter_queryset(self, qs, user):
if user.has_perm(... | django-bmf/django-bmf | djangobmf/contrib/task/permissions.py | Python | bsd-3-clause | 2,444 |
#!/usr/bin/env python
"""Command-line tool for starting a local Vitess database for testing.
USAGE:
$ run_local_database --port 12345 \
--topology test_keyspace/-80:test_keyspace_0,test_keyspace/80-:test_keyspace_1 \
--schema_dir /path/to/schema/dir
It will run the tool, logging to stderr. On stdout, a sm... | tjyang/vitess | py/vttest/run_local_database.py | Python | bsd-3-clause | 3,537 |
"""
TutorialWorld - basic objects - Griatch 2011
This module holds all "dead" object definitions for
the tutorial world. Object-commands and -cmdsets
are also defined here, together with the object.
Objects:
TutorialObject
Readable
Climbable
Obelisk
LightSource
CrumblingWall
Weapon
WeaponRack
"""
from future.utils... | ergodicbreak/evennia | evennia/contrib/tutorial_world/objects.py | Python | bsd-3-clause | 40,255 |
# -*- coding: utf-8 -*-
class ResourceOptions(object):
"""
A configuration class for ``Resource``.
Provides sane defaults and the logic needed to augment these settings with
the internal ``class Meta`` used on ``Resource`` subclasses.
"""
allowed_methods = ['get', 'post', 'put', 'delete', 'pat... | codeboy/coddy-sitetools | sitetools/coddy_api/api_resource.py | Python | bsd-3-clause | 1,729 |
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.permissions import SAFE_METHODS, BasePermission
from olympia.amo import permissions
from olympia.access import acl
# Most of these classes come from zamboni, check out
# https://github.com/mozilla/zamboni/blob/master/mkt/api/permissions.py fo... | kumar303/addons-server | src/olympia/api/permissions.py | Python | bsd-3-clause | 10,291 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def create_site(apps, schema_editor):
# We get the model from the versioned app registry;
# if we directly import it, it'll be the wrong version
Site = apps.get_model('sites', 'Site')
db_alias = s... | SaptakS/pune.pycon.org | symposion/conference/migrations/0002_create_site.py | Python | bsd-3-clause | 753 |
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/pdfbase/_fontdata.py
#$Header $
__version__=''' $Id: _fontdata.py 3052 2007-03-07 14:04:49Z rgbecker $ '''
__doc__="""
database of font related thi... | alexissmirnov/donomo | donomo_archive/lib/reportlab/pdfbase/_fontdata.py | Python | bsd-3-clause | 61,719 |
import logging
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from corehq.apps.adm.dispatcher import ADMSectionDispatcher
from corehq.apps.adm.models import REPORT_SECTION_OPTIONS, ADMReport
from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumn, DTSort... | SEL-Columbia/commcare-hq | corehq/apps/adm/reports/__init__.py | Python | bsd-3-clause | 6,857 |
"""
This test will use the default permissions found in
flaskbb.utils.populate
"""
from flaskbb.utils.permissions import *
def test_moderator_permissions_in_forum(
forum, moderator_user, topic, topic_moderator):
"""Test the moderator permissions in a forum where the user is a
moderator.
""... | joyhuang-web/flaskbb | tests/unit/utils/test_permissions.py | Python | bsd-3-clause | 3,474 |
#!/usr/bin/env python
""" md5s3stash
content addressable storage in AWS S3
"""
from __future__ import unicode_literals
import sys
import os
import argparse
import tempfile
import urllib2
import urllib
import urlparse
import base64
import logging
import hashlib
import basin
import boto
import magic
from PIL import I... | tingletech/md5s3stash | md5s3stash.py | Python | bsd-3-clause | 13,467 |
"""Jinja2's i18n functionality is not exactly the same as Django's.
In particular, the tags names and their syntax are different:
1. The Django ``trans`` tag is replaced by a _() global.
2. The Django ``blocktrans`` tag is called ``trans``.
(1) isn't an issue, since the whole ``makemessages`` process is based on
... | akx/coffin | coffin/management/commands/makemessages.py | Python | bsd-3-clause | 2,126 |
import os.path as op
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from mne.parallel import parallel_func
from mne.utils import ProgressBar, array_split_idx, use_log_level
def test_progressbar():
"""Test progressbar class."""
a = np.arange(10)
pbar = ProgressBar(a)
as... | Teekuningas/mne-python | mne/utils/tests/test_progressbar.py | Python | bsd-3-clause | 3,513 |
import inspect
from functools import partial
try:
from joblib.externals.cloudpickle import dumps, loads
cloudpickle = True
except ImportError:
cloudpickle = False
WRAP_CACHE = dict()
class CloudpickledObjectWrapper(object):
def __init__(self, obj, keep_wrapper=False):
self._obj = obj
... | lesteve/joblib | joblib/externals/loky/cloudpickle_wrapper.py | Python | bsd-3-clause | 3,964 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Simple script which takes a file with one packet latency (expressed as a
# signed integer) per line and plots a trivial histogram.
# Copyright (c) 2015, Malte Schwarzkopf
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modifica... | camsas/qjump-nsdi15-plotting | figure11/plot_throughput_factor_experiment.py | Python | bsd-3-clause | 8,217 |
from __future__ import unicode_literals, absolute_import
from mock import MagicMock
from ....unittest import TestCase
from oauthlib.oauth1 import RequestValidator
from oauthlib.oauth1.rfc5849 import errors
from oauthlib.oauth1.rfc5849.endpoints import AuthorizationEndpoint
class ResourceEndpointTest(TestCase):
... | masci/oauthlib | tests/oauth1/rfc5849/endpoints/test_authorization.py | Python | bsd-3-clause | 2,250 |
import Sea
from Connection import Connection
class ConnectionPoint(Connection):
"""
Class for point connections.
"""
def __init__(self, obj, system, components):
Connection.__init__(self, obj, system, components)
#obj.Sort = 'Point'
def updateComponents(self,... | python-acoustics/Sea | Sea/adapter/connections/ConnectionPoint.py | Python | bsd-3-clause | 714 |
import doctest
import pytest
from datascience import predicates
from datascience import *
def test_both():
"""Both f and g."""
p = are.above(2) & are.below(4)
ps = [p(x) for x in range(1, 6)]
assert ps == [False, False, True, False, False]
def test_either():
"""Either f or g."""
p = are.above(... | dsten/datascience | tests/test_predicates.py | Python | bsd-3-clause | 2,093 |
# 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 optparse
import os
import sys
from telemetry.core import util
from telemetry.results import buildbot_output_formatter
from telemetry.results import c... | hefen1/chromium | tools/telemetry/telemetry/results/results_options.py | Python | bsd-3-clause | 7,550 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | stonebig/bokeh | bokeh/colors/named.py | Python | bsd-3-clause | 13,025 |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: Text Trees
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# Peter Ljunglöf <peter.ljunglof@gu.se>
# Nathan Bodenstab <bodenstab@cslu.ogi.edu> (tree transforms)
# URL: <h... | nelango/ViralityAnalysis | model/lib/nltk/tree.py | Python | mit | 64,375 |
from collections import defaultdict
import copy
import datetime
import json
from appengine_fixture_loader.loader import load_fixture
from google.appengine.ext import ndb
from helpers.event_details_manipulator import EventDetailsManipulator
from helpers.match_helper import MatchHelper
from helpers.match_manipulator im... | nwalters512/the-blue-alliance | helpers/event_simulator.py | Python | mit | 15,162 |
# Copyright 2011 the V8 project authors. 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... | sirchristian/v8DOM.NET | v8-read-only/test/test262/testcfg.py | Python | mit | 3,870 |
# -*- coding: utf-8 -*-
"""
IAMService
"""
import time
import xml.sax.saxutils as saxutils
# post xml soap message
import sys, httplib
from lxml import etree
from cStringIO import StringIO
#import static
import toml
class IAMClient(object):
def __init__(self):
conf_fn = "config.toml"
... | mabotech/mabo.ai | py/webservices/orgService.py | Python | mit | 5,747 |
# -*- coding: utf-8 -*-
from __future__ import print_function
# Form implementation generated from reading ui file 'InputChannelTemplate.ui'
#
# Created: Sun Feb 22 13:29:16 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
... | meganbkratz/acq4 | acq4/devices/DAQGeneric/InputChannelTemplate.py | Python | mit | 3,321 |
# Natural Language Toolkit: Confusion Matrices
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
from __future__ import print_function, unicode_literals
from nltk.... | MyRookie/SentimentAnalyse | venv/lib/python2.7/site-packages/nltk/metrics/confusionmatrix.py | Python | mit | 7,825 |
__author__ = "Jon Dawson"
__copyright__ = "Copyright (C) 2012, Jonathan P Dawson"
__version__ = "0.1"
class Allocator:
"""Maintain a pool of registers, variables and arrays. Keep track of what they are used for."""
def __init__(self, reuse):
self.registers = []
self.all_registers = {}
... | amerc/phimii | chips2/chips/compiler/allocator.py | Python | mit | 1,644 |
from tkinter.scrolledtext import ScrolledText
import tkinter as tk
from trace_json import traceparse
from parsley_json import jsonGrammar
jsonData = open('337141-steamcube.json').read()
class Tracer(object):
def __init__(self, grammarWin, inputWin, logWin, trace):
self.grammarWin = grammarWin
s... | JaDogg/__py_playground | reference/parsley/examples/trace_visualiser.py | Python | mit | 2,033 |
#!/usr/bin/env python2.7
#The MIT License (MIT)
#Copyright (c) 2015-2016 mh4x0f P0cL4bs Team
#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... | samyoyo/3vilTwinAttacker | 3vilTwin-Attacker.py | Python | mit | 1,843 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module provides classes to interface with the Crystallography Open
Database. If you use data from the COD, please cite the following works (as
stipulated by the COD developers)::
Merkys, A., Vaitk... | gpetretto/pymatgen | pymatgen/ext/cod.py | Python | mit | 5,037 |
"""foo URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vie... | rochacbruno/dynaconf | example/issues/449_django_lazy_path/foo/urls.py | Python | mit | 996 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# MIT License. See license.txt
from __future__ import unicode_literals
"""
Create a new document with defaults set
"""
import webnotes
from webnotes.utils import nowdate, nowtime, cint, flt
import webnotes.defaults
def get_new_doc(doctype, parent_doc = None, par... | rohitw1991/latestadbwnf | webnotes/model/create_new.py | Python | mit | 1,707 |
"""LCM type definitions
This file automatically generated by lcm.
DO NOT MODIFY BY HAND!!!!
"""
try:
import cStringIO.StringIO as BytesIO
except ImportError:
from io import BytesIO
import struct
class vortex_sensor_t(object):
__slots__ = ["sensor1", "sensor2", "velocity"]
def __init__(self):
... | blandry/crazyflie-tools | lcm/crazyflie_t/vortex_sensor_t.py | Python | mit | 1,903 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import warnings
import unittest
import os
from pymatgen.alchemy.transmuters import CifTransmuter, PoscarTransmuter
from pymatgen.alchemy.filters import ContainsSpecieFilter
from pymatgen.transformations.standa... | dongsenfo/pymatgen | pymatgen/alchemy/tests/test_transmuters.py | Python | mit | 4,616 |
import unittest
import numpy as np
from chainermn.datasets import create_empty_dataset
import chainerx as chx
class TestEmptyDataset(unittest.TestCase):
def setUp(self):
pass
def check_create_empty_dataset(self, original_dataset):
empty_dataset = create_empty_dataset(original_dataset)
... | hvy/chainer | tests/chainermn_tests/datasets_tests/test_empty_dataset.py | Python | mit | 1,128 |
# -*- coding: utf-8 -*-
#
# Natural Language Toolkit: Snowball Stemmer
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Peter Michael Stahl <pemistahl@gmail.com>
# Peter Ljunglof <peter.ljunglof@heatherleaf.se> (revisions)
# Algorithms: Dr Martin Porter <martin@tartarus.org>
# URL: <http://nltk.org/>
# For li... | nelango/ViralityAnalysis | model/lib/nltk/stem/snowball.py | Python | mit | 145,854 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from acq4.util import Qt
import acq4.pyqtgraph as pg
from .CanvasItem import CanvasItem
from .itemtypes import registerItemType
class GridCanvasItem(CanvasItem):
_typeName = "Grid"
def __init__(self, **kwds):
kwds.pop('viewRect', None... | pbmanis/acq4 | acq4/util/Canvas/items/simpleitems.py | Python | mit | 1,421 |
"""
Django settings for kboard project.
Generated by 'django-admin startproject' using Django 1.10.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
... | kboard/kboard | kboard/kboard/settings.py | Python | mit | 5,166 |
"""Test for the once bitten strategy."""
import random
import axelrod
from .test_player import TestPlayer
C, D = 'C', 'D'
class TestOnceBitten(TestPlayer):
name = "Once Bitten"
player = axelrod.OnceBitten
expected_classifier = {
'memory_depth': 12,
'stochastic': False,
'inspec... | emmagordon/Axelrod | axelrod/tests/unit/test_oncebitten.py | Python | mit | 4,785 |
#!./env/bin/python
""" Windows Registry Network Query
Lists the network name and MAC addresses of the networks that
this computer has connected to. If the location command is given
print the coordinates of the network if they are in the wigile
datebase
Don't be a moron, please don't use this for ... | JackStouffer/Violent-Python | forensic/windows_registry.py | Python | mit | 2,693 |
# Usage: mitmdump -s "iframe_injector.py url"
# (this script works best with --anticache)
import sys
from bs4 import BeautifulSoup
class Injector:
def __init__(self, iframe_url):
self.iframe_url = iframe_url
def response(self, flow):
if flow.request.host in self.iframe_url:
return... | mosajjal/mitmproxy | examples/simple/modify_body_inject_iframe.py | Python | mit | 829 |
#!/usr/bin/env python
import re
class Templates:
TOKENS = re.compile('([A-Za-z]+|[^ ])')
SIMPLE = {
'l': '_n.l.ptb()',
'r': '_n.r.ptb()',
'<': 'addr(_n)',
'>': 'addl(_n)',
}
def compile(self, template):
python = self.parse(self.TOKENS.findall(template))
return eval("lambda _n: %s" % p... | TeamSPoon/logicmoo_workspace | packs_sys/logicmoo_nlu/ext/candc/src/scripts/ccg/template.py | Python | mit | 1,061 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | thaim/ansible | lib/ansible/modules/cloud/google/gcp_compute_backend_service.py | Python | mit | 44,362 |
#!/usr/bin/env python
import os
from watermark.config import config as conf
from watermark import connect
config_name = os.getenv('WM_CONFIG_ENV') or 'default'
config = conf[config_name]()
conn = connect.get_connection(config)
conn.message.create_queue(name=config.NAME)
print("{name} queue created".format(name=con... | danabauer/app-on-openstack | code/worker/deploy.py | Python | mit | 331 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test BIP68 implementation."""
from test_framework.test_framework import BitcoinTestFramework
from test... | dashpay/dash | test/functional/feature_bip68_sequence.py | Python | mit | 17,835 |
import unittest
import testRObject
import testVector
import testArray
import testDataFrame
import testFormula
import testFunction
import testEnvironment
import testRobjects
import testMethods
import testPackages
import testHelp
import testLanguage
# wrap this nicely so a warning is issued if no numpy present
import t... | welltempered/rpy2-heroku | rpy/robjects/tests/__init__.py | Python | gpl-2.0 | 1,832 |
# Copyright 2020 Red Hat, Inc. Jake Hunsaker <jhunsake@redhat.com>
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General ... | slashdd/sos | sos/cleaner/archives/generic.py | Python | gpl-2.0 | 1,463 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2010 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published by
## the Free Software F... | andrebellafronte/stoq | stoqlib/gui/dialogs/paymentflowhistorydialog.py | Python | gpl-2.0 | 8,070 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 ... | labordoc/labordoc-next | modules/docextract/lib/docextract_webinterface.py | Python | gpl-2.0 | 6,745 |
# -*- coding: utf-8 -*-
#
# Copyright © 2013-2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2, or (at your option) any later
# version. This program is distributed... | mizdebsk/pkgdb2 | tests/test_groups.py | Python | gpl-2.0 | 9,297 |
##
# Copyright 2009-2013 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (htt... | geimer/easybuild-easyblocks | easybuild/easyblocks/g/geant4.py | Python | gpl-2.0 | 25,334 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2017 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of ... | kratman/psi4public | psi4/header.py | Python | gpl-2.0 | 2,628 |
# Copyright 2012 OpenStack Foundation
#
# 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 ... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/db/sqlalchemy/migrate_repo/manage.py | Python | gpl-2.0 | 724 |