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 |
|---|---|---|---|---|---|
"""
.. module: lemur.plugins.bases.export
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
from lemur.plugins.base import Plugin
class ExportPlugin(Plugin):
"""
Thi... | Netflix/lemur | lemur/plugins/bases/export.py | Python | apache-2.0 | 545 |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
__version__ = "0.9.0"
| pyro-ppl/numpyro | numpyro/version.py | Python | apache-2.0 | 107 |
# -*- encoding: utf-8 -*-
#
# Copyright © 2016-2018 Red Hat, Inc.
# Copyright © 2014-2015 eNovance
#
# 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/LICE... | gnocchixyz/gnocchi | gnocchi/storage/__init__.py | Python | apache-2.0 | 29,952 |
"""VeSync integration."""
import logging
from pyvesync import VeSync
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.dispatcher import async_dispatcher_send
from .common import async_process_devices
from .cons... | home-assistant/home-assistant | homeassistant/components/vesync/__init__.py | Python | apache-2.0 | 4,023 |
# Copyright 2018 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 agreed to in writing, s... | googlearchive/rgc-models | response_model/python/ASM/su_fit_nov/fit_fine.py | Python | apache-2.0 | 6,622 |
"""Test code for upsampling"""
import numpy as np
import tvm
import topi
import topi.testing
import math
def verify_upsampling(batch, in_channel, in_height, in_width, scale, layout='NCHW', method="NEAREST_NEIGHBOR"):
if layout == 'NCHW':
A = tvm.placeholder((batch, in_channel, in_height, in_width), name=... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/topi/tests/python/test_topi_upsampling.py | Python | apache-2.0 | 2,484 |
from mod_base import*
class NewPass(Command):
"""Change your password.
Usage: newpass oldpassword newpassword newpassword
"""
def run(self, win, user, data, caller=None):
args = Args(data)
if len(args) < 3:
win.Send("Usage: newpass oldpassword newpassword newpassword")
... | richrd/bx | modules/newpass.py | Python | apache-2.0 | 939 |
%matplotlib inline
import itertools
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import scipy
import scipy.spatial
from scipy import linalg
from sklearn.cluster import KMeans
from sklearn import mixture
from scipy.io import arff
from sklearn import datasets
from sklearn import svm
from s... | kephale/TuftsCOMP135_Spring2016 | Lecture18/notebooks/Lecture18.py | Python | apache-2.0 | 9,270 |
"""echo URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... | smorgant/echo | echo/urls.py | Python | apache-2.0 | 854 |
#!/usr/bin/env python
#
# ChaseTracker 2.0 No GUI Version
#
# Copyright 2015 Mark Jessop <vk5qi@rfhead.net>
#
# 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/licen... | projecthorus/chasetracker | ChaseTrackerNoGUI.py | Python | apache-2.0 | 6,363 |
"""
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
distri... | SethGreylyn/gwells | gwells/forms.py | Python | apache-2.0 | 53,558 |
# Copyright 2010-2011 OpenStack Foundation
# 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... | klmitch/glance | glance/common/client.py | Python | apache-2.0 | 23,213 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 Codethink Ltd.
#
# 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 r... | CodethinkLabs/ofc | tools/organise-ofc-stderr-output.py | Python | apache-2.0 | 7,879 |
import cffi
#
# This is only a demo based on the GMP library.
# There is a rather more complete (but perhaps outdated) version available at:
# http://bazaar.launchpad.net/~tolot-solar-empire/+junk/gmpy_cffi/files
#
ffibuilder = cffi.FFI()
ffibuilder.cdef("""
typedef struct { ...; } MP_INT;
type... | hipnusleo/laserjet | resource/pypi/cffi-1.9.1/demo/gmp_build.py | Python | apache-2.0 | 733 |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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
... | kdart/pycopia | core/pycopia/OS/Linux/proc/devices.py | Python | apache-2.0 | 1,668 |
from hw7 import QR_solve
from mat import coldict2mat
from mat import Mat
from orthonormalization import aug_orthonormalize
from QR import factor
from vec import Vec
from vecutil import list2vec
print('Augmented Orthonormalize')
L = [list2vec(v) for v in [[4,3,1,2],[8,9,-5,-5],[10,1,-1,5]]]
print(coldict2mat(L))
Qlist,... | tri2sing/LinearAlgebraPython | test_hw7.py | Python | apache-2.0 | 743 |
#!/usr/bin/env python
"""Program that generates golden regression data."""
from grr.gui import api_regression_test_lib
# pylint: disable=unused-import
from grr.gui.api_plugins import artifact_regression_test
from grr.gui.api_plugins import client_regression_test
from grr.gui.api_plugins import config_regression_test... | destijl/grr | grr/gui/api_regression_test_generate.py | Python | apache-2.0 | 951 |
import logging
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.urls import reverse
from zentral.utils.osx_package import get_standalone_package_builders
from .utils import delete_app, build_and_upload_app
logger = logging.getLogger("zentral.contrib.simplemdm.models")
c... | zentralopensource/zentral | zentral/contrib/simplemdm/models.py | Python | apache-2.0 | 3,296 |
# Copyright 2015 Dimitri Racordon
#
# 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 writi... | kyouko-taiga/mushi | mushi/apps/webui/views.py | Python | apache-2.0 | 1,256 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | QISKit/qiskit-sdk-py | qiskit/pulse/commands/instruction.py | Python | apache-2.0 | 9,538 |
# file eulxml/__init__.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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
#
# ... | dannyroberts/eulxml | eulxml/__init__.py | Python | apache-2.0 | 903 |
#
# 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
# ... | gonzolino/heat | contrib/rackspace/rackspace/tests/test_rackspace_cloud_server.py | Python | apache-2.0 | 20,555 |
# 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... | RobinQuetin/CAIRIS-web | cairis/cairis/ReferenceContribution.py | Python | apache-2.0 | 1,176 |
#!/usr/bin/env python
"""Output plugins implementations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from grr_response_server import output_plugin
# pylint: disable=unused-import,g-import-not-at-top
try:
from grr_response_server.output_plugins im... | dunkhong/grr | grr/server/grr_response_server/output_plugins/__init__.py | Python | apache-2.0 | 668 |
# Copyright 2017 Google 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 or agreed to in writing, ... | googleapis/google-resumable-media-python | google/resumable_media/_helpers.py | Python | apache-2.0 | 12,563 |
# Copyright 2015 UniMOOC. 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 or agr... | UniMOOC/AAClassroom | modules/um_assessments/exceptions.py | Python | apache-2.0 | 816 |
from agent.tests import *
import pylons
import os
import logging
import time
import json
from pylons import config
from subprocess import Popen
from agent.controllers.service import ServiceController
from agent.lib.utils import rchown
from agent.lib.packagemgr import PackageMgr
from agent.tests.unit.test_util import ... | cronuspaas/cronusagent | agent/agent/tests/unit/test_cleanup.py | Python | apache-2.0 | 7,566 |
import re
def clear(s):
return re.sub("[() -]", "", s)
def merge_phones_like_on_home_page(contact):
return "\n".join(filter(lambda x: x != "",
map(lambda x: clear(x),
filter(lambda x: x is not None,
[contact.h... | yupasik/python_training | test/test_phones.py | Python | apache-2.0 | 1,197 |
# This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This file follows the
# PEP8 Python style guide and uses a max-width of 120 characters per line.
#
# Author(s):
# Cedric Nugteren <www.cedricnugteren.nl>
import re
import json
try:
from urllib.request import urlopen ... | dividiti/CLBlast | scripts/database/database/io.py | Python | apache-2.0 | 2,295 |
#kill a Process Chapter 3: Process Based Parallelism
import multiprocessing
import time
def foo():
print ('Starting function')
time.sleep(0.1)
print ('Finished function')
if __name__ == '__main__':
p = multiprocessing.Process(target=foo)
print ('Process before execution:', p, p.is_a... | IdiosyncraticDragon/Reading-Notes | Python Parallel Programming Cookbook_Code/Chapter 3/kill_a_process.py | Python | apache-2.0 | 588 |
"""
Persistence configuration
"""
PERSISTENCE_BACKEND = 'pypeman.persistence.SqliteBackend'
PERSISTENCE_CONFIG = {"path":'/tmp/to_be_removed_849827198746.sqlite'}
| jrmi/pypeman | pypeman/tests/settings/test_settings_sqlite_persist.py | Python | apache-2.0 | 164 |
"""The HTTP api to control the cloud integration."""
import asyncio
from functools import wraps
import logging
import aiohttp
import async_timeout
import attr
from hass_nabucasa import Cloud, auth, thingtalk
from hass_nabucasa.const import STATE_DISCONNECTED
import voluptuous as vol
from homeassistant.components impo... | joopert/home-assistant | homeassistant/components/cloud/http_api.py | Python | apache-2.0 | 19,172 |
# MIT License
#
# Copyright (c) 2018 chakki
#
# 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, publi... | hankcs/HanLP | hanlp/metrics/chunking/sequence_labeling.py | Python | apache-2.0 | 14,144 |
import helper
import json
import pandas as pd
import mpld3
import numpy as np
import requests
import factor_analysis
import visualizations
from datetime import timedelta, datetime
from netwin_analysis import netwin_analysis
from sqlalchemy import create_engine
from generateresponsefromrequest import get_intent_entity_f... | kruegg21/casino_analytics | src/main.py | Python | apache-2.0 | 14,236 |
# coding=utf-8
from abc import ABCMeta, abstractmethod
from typing import Optional
from weakref import ref
from logging import getLogger
from ultros.core.networks.base.connectors import base as base_connector
from ultros.core.networks.base.networks import base as base_network
__author__ = "Gareth Coles"
class Base... | UltrosBot/Ultros3K | src/ultros/core/networks/base/servers/base.py | Python | artistic-2.0 | 942 |
c_template = """
#include <libcgc.h>
#include <stdlib.h>
#include <string.h>
#include <boolector.h>
enum register_t
{
eax = 0,
ecx = 1,
edx = 2,
ebx = 3,
esp = 4,
ebp = 5,
esi = 6,
edi = 7
};
int fd_ready(int fd) {
struct timeval tv;
fd_set rfds;
int readyfds = 0;
FD_SET(fd, &... | shellphish/rex | rex/exploit/cgc/c_templates/c_template_type1.py | Python | bsd-2-clause | 13,969 |
#!/usr/bin/python
'''
Generate pseudo-random SSNs and save to a text file.
'''
import random
try:
myfile = open(str(raw_input("Output filename: ")), "w")
except ValueError:
print "Invalid input. Please enter a valid filename."
try:
for i in range(int(raw_input("How many random numbers?: "))):
lin... | dagorim/mytools | ssngen.py | Python | bsd-2-clause | 524 |
#!/usr/bin/env python3
import os, re, subprocess
import somaticseq.vcfModifier.copy_TextFile as copy_TextFile
import somaticseq.vcfModifier.splitVcf as splitVcf
import somaticseq.vcfModifier.getUniqueVcfPositions as getUniqueVcfPositions
from somaticseq.vcfModifier.vcfIntersector import *
# Combine individual VCF ou... | bioinform/somaticseq | somaticseq/combine_callers.py | Python | bsd-2-clause | 22,749 |
#
# Notification Originator
#
# Send SNMP INFORM notification using the following options:
#
# * SNMPv2c
# * with community name 'public'
# * over IPv4/UDP
# * send INFORM notification
# * to a Manager at 127.0.0.1:162
# * with TRAP ID 'coldStart' specified as an OID
# * include managed objects information:
# 1.3.6.1... | ww9rivers/pysnmp | examples/v3arch/agent/ntforg/inform-v2c.py | Python | bsd-2-clause | 2,964 |
VERSION = '0.3.4'
DEFAULT_SWAGGER_SETTINGS = {
'exclude_namespaces': [],
'api_version': '',
'api_path': '/',
'api_key': '',
'token_type': 'Token',
'enabled_methods': ['get', 'post', 'put', 'patch', 'delete'],
'is_authenticated': False,
'is_superuser': False,
'unauthenticated_user': ... | sacgup/django-rest-swagger | rest_framework_swagger/__init__.py | Python | bsd-2-clause | 1,311 |
import pytest
def test_pack_unpack():
header = ('json', 301)
from gpopup.ipc import _pack_header, _unpack_header
header_bytes = _pack_header(*header)
header_out = _unpack_header(header_bytes)
assert header == header_out
assert header[0] == header_out.type
assert header[1] == header_out.leng... | frostidaho/python-gpopup | tests/test_ipc2.py | Python | bsd-2-clause | 2,655 |
"""
Checkout process utilities.
"""
from django.contrib.auth.models import SiteProfileNotAvailable
from django.utils.translation import ugettext as _
from django.template.loader import get_template, TemplateDoesNotExist
from mezzanine.conf import settings
from mezzanine.utils.email import send_mail_template
from car... | viaregio/cartridge | cartridge/shop/checkout.py | Python | bsd-2-clause | 8,239 |
#!/usr/bin/env python
#(c) 2015 by Authors
#This file is a part of SpectroGene program.
#Released under the BSD license (see LICENSE file)
"""
This script performs SpectroGene run in known proteome mode (proteome run)
"""
from __future__ import print_function
import shutil
import sys
import os
import argparse
import... | fenderglass/SpectroGene | scripts/proteome_run.py | Python | bsd-2-clause | 4,617 |
#!/usr/bin/env python
#
# Indentation finder, by Philippe Fremy <phil at freehackers dot org>
# Copyright 2002,2005 Philippe Fremy
#
# This program is distributed under the BSD license. You should have received
# a copy of the file LICENSE.txt along with this software.
#
import indent_finder
import os, glob
import ... | unphased/Vim-IndentFinder | test_many_files.py | Python | bsd-2-clause | 2,378 |
# ------------------------------------------------------------------------------
# Copyright (c) 2010-2013, EVEthing team
# 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... | cmptrgeekken/evething | thing/models/apikeyfailure.py | Python | bsd-2-clause | 1,916 |
#!/usr/bin/env python
# Copyright (c) 2017, Elaine Short, SIM Lab
# 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, th... | si-machines/poli2 | poli2_launch/scripts/setup_barton_collision_scene.py | Python | bsd-2-clause | 2,588 |
# -*- coding: utf-8 -*-
import io
import textwrap
import pytest
import canmatrix.canmatrix
import canmatrix.formats.sym
def test_colliding_mux_values():
f = io.BytesIO(
textwrap.dedent(
'''\
FormatVersion=5.0 // Do not edit this line!
Title="a file"
{SEND... | altendky/canmatrix | src/canmatrix/tests/test_sym.py | Python | bsd-2-clause | 3,192 |
# use this if you want to include modules from a subforder
import os, sys, inspect
cmd_subfolder = os.path.realpath(os.path.abspath( os.path.join(os.path.split \
(inspect.getfile( inspect.currentframe() ))[0],"VprParsers")))
if cmd_subfolder not in sys.path:
sys.path.insert(0, cmd_subfolder)
import structs
import ... | adbrant/zuma-fpga | source/InitFpga.py | Python | bsd-2-clause | 18,645 |
from __future__ import unicode_literals
from future.builtins import range
from mezzanine.conf import settings
from mezzanine.core.managers import DisplayableManager
from mezzanine.utils.urls import home_slug
class PageManager(DisplayableManager):
def published(self, for_user=None, include_login_required=False):... | damnfine/mezzanine | mezzanine/pages/managers.py | Python | bsd-2-clause | 3,992 |
import numpy as np
from ctypes import (
CDLL,
POINTER,
ARRAY,
c_void_p,
c_int,
byref,
c_double,
c_char,
c_char_p,
create_string_buffer,
)
from numpy.ctypeslib import ndpointer
import sys, os
prefix = {"win32": "lib"}.get(sys.platform, "lib")
extension = {"darwin": ".dylib", "wi... | cbcoutinho/learn_dg | tests/helpers.py | Python | bsd-2-clause | 4,156 |
import femagtools
import importlib
import os
import logging
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(message)s')
models = ['statorBG-magnetSector',
'stator1-magnetIron3',
'stator1-magnetIron4',
'stator1-magnetIron5',
'stator1-magnetIronV'... | SEMAFORInformatik/femagtools | examples/model-creation/createall.py | Python | bsd-2-clause | 886 |
from spdy.frames import *
from spdy._zlib_stream import Inflater, Deflater
from bitarray import bitarray
SERVER = 'SERVER'
CLIENT = 'CLIENT'
class SpdyProtocolError(Exception):
pass
def _bitmask(length, split, mask=0):
invert = 1 if mask == 0 else 0
b = str(mask)*split + str(invert)*(length-split)
return int(b, ... | colinmarc/python-spdy | python-spdy/context.py | Python | bsd-2-clause | 6,954 |
# -*- coding: utf-8 -*-
"""
Greenlet具有确定性. 在相同配置相同输入的情况下, 它们总是会产生相同的输出.
下面就有例子, 我们在multiprocessing的pool之间执行一系列的任务, 与在gevent的pool之间执行作比较.
"""
import time
from multiprocessing.pool import Pool
def echo(i):
time.sleep(0.001)
return i
# Non Deterministic Process Pool
p = Pool(10)
run1 = [a for a in p.imap_uno... | baixuexue123/note | python/concurrency/gevent/test_pool.py | Python | bsd-2-clause | 999 |
__author__ = 'jhurt'
| jhurt/dribbble-palettes | dribbble_palettes/__init__.py | Python | bsd-2-clause | 21 |
# -*- coding: utf-8 -*-
# MusicPlayer, https://github.com/albertz/music-player
# Copyright (c) 2012, Albert Zeyer, www.az2000.de
# All rights reserved.
# This code is under the 2-clause BSD license, see License.txt in the root directory of this project.
import utils
from utils import formatTime
import Traits
import so... | albertz/music-player | src/modules/Search.py | Python | bsd-2-clause | 1,595 |
"""
===================
Base Object Classes
===================
"""
from validation.validationresult.resultenum import ResultType
from validation.validators.document_validator import DocumentValidator
from validation.runner import ValidationsRunner
from base.enums import FieldType
from validation.validationresult.resul... | iraklikhitarishvili/data2class | base/document.py | Python | bsd-2-clause | 7,734 |
import sys
import glob
from PIL import Image
import cv2
import numpy as np
import cmdline as cmd
gap = 0
output = 'tiles.png'
def set_gap(param):
global gap
gap = int(param)
def set_output(param):
global output
output = param
def main():
cmd.flag('gap', True, set_gap)
cmd.flag('out', True... | amirgeva/py2d | tools/combine_tiles.py | Python | bsd-2-clause | 1,330 |
# -*- coding: utf-8 -*-
from ambry_sources import get_source
from fs.opener import fsopendir
from tests import TestBase
# Tests https://github.com/CivicKnowledge/ambry_sources/issues/12 issue.
class Test(TestBase):
""" shapefiles (*.shp) accessor tests. """
def test_bad_row_intuition(self):
from ... | CivicKnowledge/ambry_sources | tests/test_regression/test_issue_12.py | Python | bsd-2-clause | 4,568 |
import tempfile
import numpy as np
import h5py
from ..database import db
from ..xfm import Transform
from .braindata import _hdf_write
from .views import normalize as _vnorm
from .views import Dataview, Volume, _from_hdf_data
class Dataset(object):
"""
Wrapper for multiple data objects. This often does not n... | gallantlab/pycortex | cortex/dataset/dataset.py | Python | bsd-2-clause | 8,008 |
import os
import sys
if sys.version_info[0] == 2:
import __builtin__ as builtins
else:
import builtins
def path(name):
return os.path.join(os.path.dirname(__file__), "test_files", name)
def open(name, mode):
return builtins.open(path(name), mode)
| mwilliamson/sdmx.py | tests/testing.py | Python | bsd-2-clause | 269 |
import os.path
from enum import Enum
class NamedEnum(Enum):
def __init__(self, name):
self.display_name = name
@classmethod
def get_names(cls):
return [name for name, _ in cls.__members__.items()]
class Role(NamedEnum):
solver = ('Solver')
tester = ('Tester')
class Status(NamedE... | jsannemo/programming-battle | battle/battle/api/__init__.py | Python | bsd-2-clause | 1,247 |
from PySide import QtGui
from PySide.QtCore import Signal
from elo_button_row import EloButtonRow
from picture_area import PictureArea
class CentralWidget(QtGui.QWidget):
left_chosen = Signal()
right_chosen = Signal()
left_deleted = Signal()
right_deleted = Signal()
def __init__(self, left_image... | mmanhertz/elopic | elopic/ui/central_widget.py | Python | bsd-2-clause | 1,328 |
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
#
# 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... | frew/simpleproto | scons-local-1.1.0/SCons/Warnings.py | Python | bsd-2-clause | 5,241 |
"""
byceps.permissions.site
~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from ..util.authorization import create_permission_enum
SitePermission = create_permission_enum(
'site',
[
'create',
'update',
'vi... | homeworkprod/byceps | byceps/permissions/site.py | Python | bsd-3-clause | 334 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import yepes.contrib.standards.model_mixins
import mptt.fields
import yepes.fields
class Migration(migrations.Migration):
dependencies = [
]
initial = True
operations = [
migrations.Cre... | samuelmaudo/yepes | yepes/contrib/standards/migrations/0001_initial.py | Python | bsd-3-clause | 16,430 |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Copyright (c) 2019 The ungoogled-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.
"""Run sanity checking algorithms over ungoogled-chromium's patch files
It checks the following... | Eloston/ungoogled-chromium | devutils/check_patch_files.py | Python | bsd-3-clause | 4,385 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
try:
from builtins import *
from future import standard_library
standard_library.install_aliases()
except:
# we might be on py3.2, which the future library doesn't support
pass
import os
import sys
if sys.versio... | staffanm/layeredconfig | tests/test_withFuture.py | Python | bsd-3-clause | 984 |
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
help = "Update permissions without using syncdb."
def handle_noargs(self, **options):
from django.core.management import setup_environ
try:
import se... | pocketone/django-shoppy | shoppy/shop/management/commands/shoppy_updatePermissions.py | Python | bsd-3-clause | 893 |
# -*- coding: utf-8 -*-
# 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... | endlessm/chromium-browser | third_party/catapult/third_party/gsutil/gslib/commands/perfdiag.py | Python | bsd-3-clause | 94,422 |
# -*- coding: utf-8 -*-
"""
A series of tests to establish that the command-line managment tools work as
advertised - especially with regards to the handling of the DJANGO_SETTINGS_MODULE
and default settings.py files.
"""
from __future__ import unicode_literals
import os
import re
import shutil
import socket
import s... | andrewsmedina/django | tests/admin_scripts/tests.py | Python | bsd-3-clause | 79,511 |
from websockets.auth import * # noqa
| aaugustin/websockets | tests/test_auth.py | Python | bsd-3-clause | 38 |
#!/usr/bin/env python
"""Generates the pamqp/specification.py file used as a foundation for AMQP
communication.
"""
import copy
import dataclasses
import functools
import json
import keyword
import logging
import pathlib
import sys
import textwrap
import typing
import lxml.etree, lxml.objectify
import requests
from y... | gmr/pamqp | tools/codegen.py | Python | bsd-3-clause | 45,302 |
from __future__ import division, print_function
from collections import deque
from datetime import datetime
import sys
from time import time
def progress_bar_str(percentage, bar_length=20, bar_marker='=', show_bar=True):
r"""
Returns an `str` of the specified progress percentage. The percentage is
represe... | mozata/menpo | menpo/visualize/textutils.py | Python | bsd-3-clause | 7,250 |
"""
Tests for django test runner
"""
from __future__ import unicode_literals
from importlib import import_module
from optparse import make_option
import sys
import unittest
from django.core.exceptions import ImproperlyConfigured
from django.core.management import call_command
from django import db
from django.test im... | ericholscher/django | tests/test_runner/tests.py | Python | bsd-3-clause | 14,525 |
import json
import string
import random
import requests
import logging
import local_config
from couchdb import Server, http
from couchdb.http import PreconditionFailed, ResourceConflict
logger = logging.getLogger(__name__)
local_config.configure_logger(logger)
def create_db(database):
server = Server('http://... | cozy-labs/cozy-fuse | cozyfuse/dbutils.py | Python | bsd-3-clause | 10,338 |
from datetime import (
datetime,
timedelta,
)
import re
import numpy as np
import pytest
from pandas._libs.tslibs import period as libperiod
from pandas.errors import InvalidIndexError
import pandas as pd
from pandas import (
DatetimeIndex,
NaT,
Period,
PeriodIndex,
Series,
Timedelta,... | pandas-dev/pandas | pandas/tests/indexes/period/test_indexing.py | Python | bsd-3-clause | 32,453 |
from BaseObjects import BaseEDAPage
from EDA import eda_lex_locators
from cumulusci.robotframework.pageobjects import BasePage
from cumulusci.robotframework.pageobjects import pageobject
import time
@pageobject("System", "HEDA_Settings")
class SystemSettingsPage(BaseEDAPage, BasePage):
def _is_current_page(self)... | SalesforceFoundation/HEDAP | robot/EDA/resources/SystemSettingsPageObject.py | Python | bsd-3-clause | 5,956 |
from . import NetworkObject
import z3
class AclFirewall (NetworkObject):
def _init(self, node, network, context):
super(AclFirewall, self).init_fail(node)
self.fw = node.z3Node
self.ctx = context
self.constraints = list ()
self.acls = list ()
network.SaneSend (self)
... | apanda/modeling | mcnet/components/aclfirewall.py | Python | bsd-3-clause | 2,245 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
from decimal import Decimal
import doctest
import unittest
from couchdb import design, mapping
from... | Roger/couchdb-python | couchdb/tests/mapping.py | Python | bsd-3-clause | 12,137 |
"""
DataFrame
---------
An efficient 2D container for potentially mixed-type time series or other
labeled data series.
Similar to its R counterpart, data.frame, except providing automatic data
alignment and a host of useful data manipulation methods having to do with the
labeling information
"""
from __future__ import... | jorisvandenbossche/pandas | pandas/core/frame.py | Python | bsd-3-clause | 376,408 |
# -*- coding: utf-8 -*-
from hvad.fieldtranslator import translate
from hvad.test_utils.testcase import NaniTestCase
from testproject.app.models import Related
class FieldtranslatorTests(NaniTestCase):
def test_simple(self):
INPUT = 'normal__shared_field'
query_string, joins = translate(INPUT, Rel... | ojii/django-nani | hvad/tests/fieldtranslator.py | Python | bsd-3-clause | 971 |
#! /usr/bin/env python3
import json
import logging
import sys
import zmq
def msg_loop(sock):
while True:
try:
message = sock.recv_json()
except Exception as e:
logging.error(e)
continue
logging.info(str(message))
def start_sub(addr):
ctx = zmq.Context()
sock = ctx.socket(zmq.SUB)
logging.info("c... | BeeeOn/server | tools/zmqdump.py | Python | bsd-3-clause | 1,577 |
from django.contrib.sites.models import Site
from django.conf import settings
from django.db.models import get_model
from django.utils.translation import ugettext_lazy as _
from oscar.apps.shipping.methods import Free
from oscar.apps.order.exceptions import UnableToPlaceOrder
from oscar.core.loading import get_class
... | michaelBenin/django-oscar | oscar/apps/order/utils.py | Python | bsd-3-clause | 10,663 |
#!/usr/bin/env python3
#
# $Id$
import os
import re
import sys
import subprocess
import argparse
import readchar
import textwrap
import json
import logging
from utils import mixrange
LOGGER = logging.getLogger("read-a-script")
LOGGER.addHandler(logging.StreamHandler())
VOICES = {
# Spring and Port Wine
"raf... | npadgen/read-a-script | read-a-script.py | Python | bsd-3-clause | 13,084 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | vlegoff/tsunami | src/abstraits/obase/__init__.py | Python | bsd-3-clause | 9,968 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
db.create_index('eve_api_eveplayercharacterskill', ['character_id', 'skill_id'], unique=True)
def backwards(self, orm):
... | nikdoof/test-auth | app/eve_api/migrations/0011_add_skills_index.py | Python | bsd-3-clause | 12,560 |
def extractTranslatinotakuCf(item):
'''
Parser for 'translatinotaku.cf'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Hokage Ryos Path', 'Hokage: Ryo\'s Path', ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractTranslatinotakuCf.py | Python | bsd-3-clause | 2,627 |
# -*- coding: utf-8 -*-
import jieba
import logging
import io
import codecs
def main():
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
# jieba custom setting.
jieba.set_dictionary('jieba_dict/dict.txt.big')
# load stopwords set
stopwordset = set()
... | chunchih/article-matching | word2vec-model/wiki_seg_jieba.py | Python | bsd-3-clause | 1,035 |
class QueryMixin:
"""The default query object used for models, and exposed as
:attr:`~SQLAlchemy.Query`. This can be subclassed and
replaced for individual models by setting the :attr:`~Model.query_class`
attribute. This is a subclass of a standard SQLAlchemy
:class:`~sqlalchemy.orm.query.Query` c... | tazo90/lux | lux/extensions/odm/query.py | Python | bsd-3-clause | 4,708 |
import webipy
import numpy as np
import matplotlib.pyplot as plt
import pylab
import pandas as pd
pylab.rcParams['figure.figsize'] = (15, 11)
@webipy.exports
def plot(x, n=4):
"""
Demo of scatter plot on a polar axis.
Size increases radially in this example and color increases with angle
"""
N = ... | PlotWatt/webipy | examples/ex1.py | Python | bsd-3-clause | 1,406 |
# -*- coding: utf-8 -*-
"""
Django settings for nhweb project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_liter... | boweeb/nhweb | config/settings/common.py | Python | bsd-3-clause | 9,076 |
# -*- coding: utf-8 -*-
from django_jinja.base import Library
import jinja2
register = Library()
@register.filter
@jinja2.contextfilter
def datetimeformat(ctx, value, format='%H:%M / %d-%m-%Y'):
return value.strftime(format)
@register.global_context
def hello(name):
return "Hello" + name
| michaelBenin/django-jinja | example_project/example_project/web/templatetags/testags.py | Python | bsd-3-clause | 301 |
"""
Class which embellishes the DataCollectionView with buttons and actions for
editing the data collection
"""
import operator
from ...external.qt.QtGui import (QWidget, QMenu,
QAction, QKeySequence, QFileDialog)
from ...external.qt.QtCore import Qt, Signal, QObject
from ..ui.laye... | bsipocz/glue | glue/qt/widgets/layer_tree_widget.py | Python | bsd-3-clause | 14,225 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 AYDIN Ali-Kémal
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
... | vlegoff/tsunami | src/secondaires/calendrier/evenement.py | Python | bsd-3-clause | 4,012 |
import functools
import re
from django import forms
from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured
from django.db.models.fields import CharField, TextField
from django.forms.formsets import DELETION_FIELD_NAME, ORDERING_FIELD_NAME
from django.forms.models import fields_for_model
from django... | takeflight/wagtail | wagtail/admin/edit_handlers.py | Python | bsd-3-clause | 29,420 |
# -- coding: utf-8 --
import click
import yaml
import json
@click.command()
@click.option('-n', '--accession_number', help='Accession number')
@click.option('-e', '--environment', default='local', help='Environment.')
@click.option('--input', type=click.File('r'), required=False)
@click.option('--dryrun', is_flag=Tru... | alexisbellido/dockerize-django | python-click/example.py | Python | bsd-3-clause | 1,458 |
"""private_base will be populated from puppet and placed in this directory"""
import logging
import os
import dj_database_url
from lib.settings_base import (CACHE_PREFIX, ES_INDEXES,
KNOWN_PROXIES, LOGGING, HOSTNAME)
from .. import splitstrip
import private_base as private
ENGAGE_RO... | jinankjain/zamboni | sites/altdev/settings_base.py | Python | bsd-3-clause | 5,851 |
# coding: utf-8
import decimal
from . import settings as price_settings
from .utils import price_amount
from .currency import Currency
from .tax import NO_TAX
class Price(object):
def __init__(self, net, currency=None, tax=None, gross=None):
if currency is None:
currency = price_settings.DEFAU... | ddanier/django_price | django_price/price.py | Python | bsd-3-clause | 8,910 |
import re
import abc
import asyncio
import contextlib
import urllib.parse as urlparse
import aiohttp
import pyquery
from pycrawl.utils import Queue
from pycrawl.http import Request
from pycrawl.http import Response
from pycrawl.middleware import CrawlerMiddlewareManager
class Spider(metaclass=abc.ABCMeta):
de... | jmcarp/pycrawl | pycrawl/crawl.py | Python | bsd-3-clause | 3,966 |
import sys
import copy
import time
import signal
import logging
import importlib
from libfuzz.process_management import ProcessManagement
class Fuzzer():
"""
The base fuzzer class provides a standard handler
interfaces to be used from external libraries like
ProcessManagement.
"""
def __ini... | anhusa/pyfuzz | libfuzz/fuzzer.py | Python | bsd-3-clause | 6,407 |