repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
acid1789/bitcoin | contrib/seeds/generate-seeds.py | 115 | 4377 | #!/usr/bin/python
# Copyright (c) 2014 Wladmir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the directory that... | mit |
karvenka/sp17-i524 | project/S17-IR-P014/code/delay.py | 15 | 5276 | import sys
import csv
import sip
#import org.apache.log4j.{Level, Logger}
import matplotlib
#matplotlib.user('agg')
import matplotlib.pyplot as plt
plt.switch_backend('agg')
from matplotlib import rcParams
rcParams.update({'figure.autolayout': True})
from pyspark import SparkContext, SparkConf
from datetime import date... | apache-2.0 |
Mozilla-TWQA/mozMinions | tests/test_kevin.py | 1 | 1799 | #!/usr/bin/python
__author__ = 'shako'
from moz_minions.kevin import MtbfToRaptorMinion
from b2g_util.util.adb_helper import AdbWrapper
testdata = {'name': "mtbf",
'path': "/home/shako/PycharmProjects/mozMinions/conf/test.json",
'output': {'dirpath': 'output',
'file': "... | mpl-2.0 |
DepthDeluxe/ansible | lib/ansible/modules/network/net_user.py | 20 | 4964 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
#
# This file is part of Ansible by Red Hat
#
# Ansible 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 3 of the Li... | gpl-3.0 |
a270443177/cos-python3-sdk-v4 | qcloud_cos/cos_common.py | 2 | 7092 | # -*- coding: utf-8 -*-
from __future__ import print_function
import struct
import io
try:
range = xrange
except NameError:
pass
def _left_rotate(n, b):
"""Left rotate a 32-bit integer n by b bits."""
return ((n << b) | (n >> (32 - b))) & 0xffffffff
def _process_chunk(chunk, h0, h1, h2, h3, h4):
... | apache-2.0 |
dfroger/alot | alot/foreign/urwidtrees/example3.collapse.py | 3 | 1764 | #!/usr/bin/python
# Copyright (C) 2013 Patrick Totzke <patricktotzke@gmail.com>
# This file is released under the GNU GPL, version 3 or a later revision.
from example1 import construct_example_tree, palette # example data
from decoration import CollapsibleIndentedTree # for Decoration
from widgets import TreeBox
im... | gpl-3.0 |
mariopro/youtube-dl | test/helper.py | 29 | 8457 | from __future__ import unicode_literals
import errno
import io
import hashlib
import json
import os.path
import re
import types
import sys
import youtube_dl.extractor
from youtube_dl import YoutubeDL
from youtube_dl.utils import (
compat_str,
preferredencoding,
write_string,
)
def get_params(override=No... | unlicense |
GaretJax/csat | csat/acquisition/migrations/0013_auto__add_field_acquisitionsessionconfig_dark_thumbnail.py | 1 | 3962 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'AcquisitionSessionConfig.dark_thumbnail'
db.add_column(u'acquisition_acquisitionsessionconfi... | mit |
bassosimone/yaml-cpp | test/gmock-1.7.0/gtest/test/gtest_break_on_failure_unittest.py | 2140 | 7339 | #!/usr/bin/env python
#
# Copyright 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | mit |
RueLaLaTech/savory-pie | savory_pie/tests/django/test_integration.py | 2 | 1503 | try:
import ujson as json
except ImportError:
from warnings import warn
warn('Using plain JSON instead of uJSON, performance may be degraded.')
import json
import unittest
from mock import Mock
from savory_pie.resources import APIResource
from savory_pie.django import resources, fields
from savory_pi... | mit |
eviljeff/zamboni | mkt/submit/serializers.py | 13 | 3772 | import json
from django.core.urlresolvers import reverse
from rest_framework import serializers
import mkt
from mkt.access import acl
from mkt.api.fields import ReverseChoiceField
from mkt.files.models import FileUpload
from mkt.webapps.models import Preview, Webapp
class AppStatusSerializer(serializers.ModelSeria... | bsd-3-clause |
emonty/ansible-modules-core | cloud/rackspace/rax_meta.py | 51 | 5142 | #!/usr/bin/python
# This file is part of Ansible
#
# Ansible 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 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | gpl-3.0 |
uniphil/heroku-buildpack-pythonsass | vendor/setuptools-2.1/setuptools/command/install_egg_info.py | 357 | 3833 | from setuptools import Command
from setuptools.archive_util import unpack_archive
from distutils import log, dir_util
import os, shutil, pkg_resources
class install_egg_info(Command):
"""Install an .egg-info directory for the package"""
description = "Install an .egg-info directory for the package"
user_... | mit |
apagac/cfme_tests | cfme/utils/datafile.py | 5 | 2305 | """datafile functions, to help reliably datafiles from the data directory."""
import os
from string import Template
from tempfile import NamedTemporaryFile
from jinja2 import Environment
from jinja2 import FileSystemLoader
from cfme.utils.path import template_path
def load_data_file(filename, replacements=None):
... | gpl-2.0 |
Carnon/nlp | TextClassify/textclassify/textdata.py | 1 | 2565 | import os
import codecs
import re
import jieba
import numpy as np
from tqdm import tqdm
from tensorflow.contrib import learn
from sklearn.preprocessing import OneHotEncoder
from sklearn.preprocessing import LabelEncoder
class TextData(object):
def __init__(self,args):
self.args = args
corpus_dir =... | apache-2.0 |
w1ll1am23/home-assistant | homeassistant/components/screenlogic/switch.py | 3 | 1966 | """Support for a ScreenLogic 'circuit' switch."""
import logging
from screenlogicpy.const import ON_OFF
from homeassistant.components.switch import SwitchEntity
from . import ScreenlogicEntity
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass, config_entry, async_add... | apache-2.0 |
s3nk4s/flaskTutorials | FlaskApp/FlaskApp/venv/local/lib/python2.7/site-packages/setuptools/command/build_ext.py | 125 | 11983 | from distutils.command.build_ext import build_ext as _du_build_ext
try:
# Attempt to use Pyrex for building extensions, if available
from Pyrex.Distutils.build_ext import build_ext as _build_ext
except ImportError:
_build_ext = _du_build_ext
import os
import sys
from distutils.file_util import copy_file
fr... | mit |
openmb/stb-gui | lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py | 11 | 11069 | from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Screens.HelpMenu import HelpableScreen
from Components.ActionMap import ActionMap
from Components.Sources.List import List
from Components.Sources.StaticText import StaticText
from Components.FileList import FileList
from Tools.Directories... | gpl-2.0 |
argonemyth/sentry | src/sentry/utils/sqlparser.py | 36 | 1072 | """
sentry.utils.sqlparser
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from sqlparse import engine
from sqlparse import filters
from sqlparse import tokens as T
class ValueFilter... | bsd-3-clause |
pcengines/seabios | scripts/layoutrom.py | 3 | 27113 | #!/usr/bin/env python
# Script to analyze code and arrange ld sections.
#
# Copyright (C) 2008-2014 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import operator
import sys
# LD script headers/trailers
COMMONHEADER = """
/* DO NOT EDIT! This is an aut... | lgpl-3.0 |
bear/gae-deploy-test | lib/werkzeug/contrib/lint.py | 318 | 12282 | # -*- coding: utf-8 -*-
"""
werkzeug.contrib.lint
~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 0.5
This module provides a middleware that performs sanity checks of the WSGI
application. It checks that :pep:`333` is properly implemented and warns
on some common HTTP errors such as non-empty respons... | apache-2.0 |
ahmadshahwan/cohorte-runtime | python/src/lib/python/unidecode/x0d3.py | 253 | 4705 | data = (
'tim', # 0x00
'tib', # 0x01
'tibs', # 0x02
'tis', # 0x03
'tiss', # 0x04
'ting', # 0x05
'tij', # 0x06
'tic', # 0x07
'tik', # 0x08
'tit', # 0x09
'tip', # 0x0a
'tih', # 0x0b
'pa', # 0x0c
'pag', # 0x0d
'pagg', # 0x0e
'pags', # 0x0f
'pan', # 0x10
'panj', # 0x11
... | apache-2.0 |
ejpbruel/servo | tests/wpt/web-platform-tests/tools/manifest/tests/test_manifest.py | 33 | 1660 | from .. import manifest, item as manifestitem, sourcefile
def test_local_reftest_add():
m = manifest.Manifest()
s = sourcefile.SourceFile("/", "test", "/")
test = manifestitem.RefTest(s, "/test", [("/ref", "==")])
m.local_changes.add(test)
assert list(m) == [(test.path, {test})]
def test_local_r... | mpl-2.0 |
konefalg/whylog | whylog/tests/tests_log_reader/__init__.py | 4 | 7710 | import os.path
from unittest import TestCase
import six
import yaml
from generator import generate, generator
from whylog.config import YamlConfig
from whylog.config.consts import DEFAULT_LOG_TYPE
from whylog.config.investigation_plan import LineSource
from whylog.config.parser_name_generator import ParserNameGenerat... | bsd-3-clause |
alex/django-debug-toolbar | debug_toolbar/utils/sqlparse/engine/__init__.py | 18 | 2339 | # Copyright (C) 2008 Andi Albrecht, albrecht.andi@gmail.com
#
# This module is part of python-sqlparse and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php.
"""filter"""
import re
from debug_toolbar.utils.sqlparse import lexer, SQLParseError
from debug_toolbar.utils.sqlparse.en... | bsd-3-clause |
icomms/wqmanager | apps/aquatest_calendar/controller.py | 2 | 5546 | import eventCalBase
from samples.models import *
import calendar
class CalendarController(object):
"""Controller object for calendar"""
def __init__(self, day=1,q=0):
"""owner - owner of this calendar, day - day to shown"""
calendar.setfirstweekday(calendar.SUNDAY)
self.area = q
... | bsd-3-clause |
elifesciences/elife-tools | elifetools/tests/fixtures/test_references_json/content_06_expected.py | 1 | 2157 | from collections import OrderedDict
expected = [
OrderedDict(
[
("type", u"journal"),
("id", u"bib12"),
(
"authors",
[
OrderedDict(
[
("type", "person"),
... | mit |
supertom/ansible-modules-core | cloud/amazon/ec2_vpc_net.py | 21 | 10137 | #!/usr/bin/python
# This file is part of Ansible
#
# Ansible 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 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | gpl-3.0 |
coxmediagroup/googleads-python-lib | examples/dfp/v201411/proposal_service/get_all_proposals.py | 4 | 1656 | #!/usr/bin/python
#
# Copyright 2014 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 b... | apache-2.0 |
HiroIshikawa/21playground | flask-sample/hello/venv/lib/python3.5/site-packages/jinja2/_stringdefs.py | 990 | 404291 | # -*- coding: utf-8 -*-
"""
jinja2._stringdefs
~~~~~~~~~~~~~~~~~~
Strings of all Unicode characters of a certain category.
Used for matching in Unicode-aware languages. Run to regenerate.
Inspired by chartypes_create.py from the MoinMoin project, original
implementation from Pygments.
:co... | mit |
yarikoptic/NiPy-OLD | examples/neurospin/demo_dmtx.py | 1 | 2005 | """ test code to make a design matrix
"""
import numpy as np
from nipy.neurospin.utils.design_matrix import dmtx_light
tr = 1.0
frametimes = np.linspace(0,127*tr,128)
conditions = [0,0,0,1,1,1,3,3,3]
onsets=[30,70,100,10,30,90,30,40,60]
hrf_model = 'Canonical'
motion = np.cumsum(np.random.randn(128,6),0)
add_reg_name... | bsd-3-clause |
sarathid/Learning | Intro_to_ML/pca/eigenfaces.py | 9 | 4989 | """
===================================================
Faces recognition example using eigenfaces and SVMs
===================================================
The dataset used in this example is a preprocessed excerpt of the
"Labeled Faces in the Wild", aka LFW_:
http://vis-www.cs.umass.edu/lfw/lfw-funneled.tgz (2... | gpl-3.0 |
mtnbikenc/ansible-modules-extras | monitoring/sensu_subscription.py | 47 | 5171 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Anders Ingemann <aim@secoya.dk>
#
# This file is part of Ansible
#
# Ansible 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 3 of the Licen... | gpl-3.0 |
skycucumber/xuemc | python/venv/lib/python2.7/site-packages/pbr/packaging.py | 5 | 23791 | # Copyright 2011 OpenStack LLC.
# Copyright 2012-2013 Hewlett-Packard Development Company, L.P.
# 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
#
# htt... | gpl-2.0 |
grevutiu-gabriel/sympy | sympy/physics/quantum/tests/test_spin.py | 80 | 320440 | from __future__ import division
from sympy import cos, exp, expand, I, Matrix, pi, S, sin, sqrt, Sum, symbols
from sympy.abc import alpha, beta, gamma, j, m
from sympy.physics.quantum import hbar, represent, Commutator, InnerProduct
from sympy.physics.quantum.qapply import qapply
from sympy.physics.quantum.tensorproduc... | bsd-3-clause |
xiangshouding/nv | node/node_modules/pygmentize-bundled/vendor/pygments/pygments/styles/default.py | 135 | 2532 | # -*- coding: utf-8 -*-
"""
pygments.styles.default
~~~~~~~~~~~~~~~~~~~~~~~
The default highlighting style.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Keyword, Name, Com... | bsd-3-clause |
karimbahgat/Tk2 | tk2/_orderedlist.py | 5 | 10847 |
# Import GUI functionality
import Tkinter as tk
from tkFileDialog import askopenfilenames, asksaveasfilename
from .buttons import *
from .popups import *
from .progbar import *
# Import style
from . import theme
style_layerspane_normal = {"bg": theme.color4,
"width": 200}
style_layersheader... | mit |
opadron/girder | plugins/gravatar/plugin_tests/gravatar_test.py | 1 | 4046 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | apache-2.0 |
lancezlin/ml_template_py | lib/python2.7/site-packages/pandas/tools/tests/test_util.py | 7 | 16721 | import os
import locale
import codecs
import nose
import numpy as np
from numpy import iinfo
import pandas as pd
from pandas import (date_range, Index, _np_version_under1p9)
import pandas.util.testing as tm
from pandas.tools.util import cartesian_product, to_numeric
CURRENT_LOCALE = locale.getlocale()
LOCALE_OVERRID... | mit |
BrotherPhil/django | django/contrib/flatpages/views.py | 475 | 2777 | from django.conf import settings
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.shortcuts import get_current_site
from django.http import Http404, HttpResponse, HttpResponsePermanentRedirect
from django.shortcuts import get_object_or_404
from django.template import loader
from django.uti... | bsd-3-clause |
MarcelloLins/ServerlessCrawler-VancouverRealState | SearchResultsPaginator/requests/api.py | 109 | 6237 | # -*- coding: utf-8 -*-
"""
requests.api
~~~~~~~~~~~~
This module implements the Requests API.
:copyright: (c) 2012 by Kenneth Reitz.
:license: Apache2, see LICENSE for more details.
"""
from . import sessions
def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
:para... | mit |
JingJunYin/tensorflow | tensorflow/python/keras/_impl/keras/utils/generic_utils_test.py | 34 | 2342 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
nriyer/csvkit | csvkit/utilities/csvstat.py | 19 | 8673 | #!/usr/bin/env python
import datetime
from heapq import nlargest
from operator import itemgetter
import math
import six
from csvkit import CSVKitReader, table
from csvkit.cli import CSVKitUtility
NoneType = type(None)
MAX_UNIQUE = 5
MAX_FREQ = 5
OPERATIONS =('min', 'max', 'sum', 'mean', 'median', 'stdev', 'nulls',... | mit |
Titan-C/scikit-learn | sklearn/datasets/covtype.py | 17 | 3649 | """Forest covertype dataset.
A classic dataset for classification benchmarks, featuring categorical and
real-valued features.
The dataset page is available from UCI Machine Learning Repository
http://archive.ics.uci.edu/ml/datasets/Covertype
Courtesy of Jock A. Blackard and Colorado State University.
"""
# Aut... | bsd-3-clause |
geomagpy/magpy | magpy/lib/format_wic.py | 1 | 41605 | """
MagPy
Auxiliary input filter - WIC/WIK
Supports USB temperature loggers, RCS files, old Caesium data and SG data
Written by Roman Leonhardt June 2012
- contains test and read function, toDo: write function
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicod... | bsd-3-clause |
iamutkarshtiwari/sympy | sympy/printing/tests/test_python.py | 87 | 7394 | # -*- coding: utf-8 -*-
from sympy import (Symbol, symbols, oo, limit, Rational, Integral, Derivative,
log, exp, sqrt, pi, Function, sin, Eq, Ge, Le, Gt, Lt, Ne, Abs, conjugate,
I, Matrix)
from sympy.printing.python import python
from sympy.utilities.pytest import raises, XFAIL
x, y = symbols('x,y')
th = Sy... | bsd-3-clause |
Jmdebugger/mfbog | core/bak.py | 1 | 1748 | """
def singleton(cls, *args, **kw):
instances = {}
def _singleton():
if cls not in instances:
instances[cls] = cls(*args, **kw)
return instances[cls]
return _singleton
@singleton
"""
"""
url:http://app.50bang.org/?action=session
"""
r_app_key = "0307cafd71... | gpl-3.0 |
mcella/django | tests/template_tests/filter_tests/test_escapejs.py | 324 | 2055 | from __future__ import unicode_literals
from django.template.defaultfilters import escapejs_filter
from django.test import SimpleTestCase
from ..utils import setup
class EscapejsTests(SimpleTestCase):
@setup({'escapejs01': '{{ a|escapejs }}'})
def test_escapejs01(self):
output = self.engine.render_... | bsd-3-clause |
AOSPU/external_chromium_org | tools/telemetry/telemetry/core/backends/chrome/android_browser_finder.py | 8 | 8951 | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Finds android browsers that can be controlled by telemetry."""
import os
import logging as real_logging
import re
import subprocess
import sys
from tele... | bsd-3-clause |
ivmech/iviny-scope | lib/xlsxwriter/test/worksheet/test_worksheet08.py | 1 | 3138 | ###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ..helperfunctions import _xml_to_list
from ...worksheet import Worksheet
from ...sharedstring... | gpl-3.0 |
loafbaker/django_matchmaker | likes/models.py | 1 | 1024 | from django.db import models
from django.conf import settings
# Create your models here.
User = settings.AUTH_USER_MODEL
class UserLikeManager(models.Manager):
def get_all_mutual_likes(self, user, number):
try:
qs = user.liker.liked_users.all().order_by('?')
except:
return []
mutual_users = []
for oth... | mit |
chokribr/inveniocnudst | modules/websubmit/lib/wsm_pdftk_plugin.py | 35 | 7328 | ## This file is part of Invenio.
## Copyright (C) 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 of the
## License, or (at your option) any later version.
##
... | gpl-2.0 |
williamfeng323/py-web | flask/lib/python3.6/site-packages/pip/utils/hashes.py | 517 | 2866 | from __future__ import absolute_import
import hashlib
from pip.exceptions import HashMismatch, HashMissing, InstallationError
from pip.utils import read_chunks
from pip._vendor.six import iteritems, iterkeys, itervalues
# The recommended hash algo of the moment. Change this whenever the state of
# the art changes; ... | mit |
googleinterns/step51-2020 | hangout_bot/clientserver.py | 1 | 14176 | from google.cloud import datastore
from campaigndata import CampaignData
from activeuser import *
from constant import *
import requests
import json as json_module
# [Datastore Interaction Functions]
def get_user_key(user_id):
return datastore.Client().key('ActiveUser', user_id)
def get_campaign_key(user_id, cam... | apache-2.0 |
jnewland/home-assistant | homeassistant/components/qbittorrent/sensor.py | 7 | 4234 | """Support for monitoring the qBittorrent API."""
import logging
import voluptuous as vol
from requests.exceptions import RequestException
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_NAME, CONF_PASSWORD, CONF_URL, CONF_USERNAME, STATE_IDLE)
from homeassistan... | apache-2.0 |
lizardsystem/lizard-history | lizard_history/handlers.py | 1 | 4716 | # (c) Nelen & Schuurmans. GPL licensed, see LICENSE.txt.
from django.utils.encoding import force_unicode
from django.contrib.admin.models import LogEntry
from lizard_history import utils
OBJECT_ATTRIBUTE = '_lizard_history_hash'
REQUEST_ATTRIBUTE = 'lizard_history'
PRE_COPY_KEY = 'pre_copy'
INSTANCE_KEY = 'instance'... | gpl-3.0 |
Nesiehr/osf.io | framework/transactions/commands.py | 6 | 1168 | # -*- coding: utf-8 -*-
import contextlib
import logging
from framework.mongo import database as proxy_database
from website import settings as osfsettings
logger = logging.getLogger(__name__)
@contextlib.contextmanager
def handle_missing_client():
try:
yield
except AttributeError:
if not osf... | apache-2.0 |
Kazade/NeHe-Website | google_appengine/lib/django-1.3/tests/modeltests/m2m_and_m2o/tests.py | 92 | 1938 | from django.db.models import Q
from django.test import TestCase
from models import Issue, User
class RelatedObjectTests(TestCase):
def test_m2m_and_m2o(self):
r = User.objects.create(username="russell")
g = User.objects.create(username="gustav")
i1 = Issue(num=1)
i1.client = r
... | bsd-3-clause |
getnikola/nikola | nikola/plugins/compile/rest/post_list.py | 1 | 4278 | # -*- coding: utf-8 -*-
# Copyright © 2013-2021 Udo Spallek, Roberto Alsina and others.
# 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
#... | mit |
woqer/kappa | setup.py | 2 | 1696 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from kappa import __version__
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def open_file(fname):
return open(os.path.join(os.path.dirname(__file__), fname))
def run_setup():
setup(
name='kappa... | apache-2.0 |
google-research/batch-ppo | agents/tools/streaming_mean.py | 1 | 2386 | # Copyright 2017 The TensorFlow Agents Authors.
#
# 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 ag... | apache-2.0 |
fiee/croisee | tools/make-wordlist.py | 1 | 1717 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Crossword tool - wordlist
Make a wordlist from a text (in utf-8 encoding)
"""
import os, sys, locale
import re
locale.setlocale(locale.LC_ALL, 'de_DE.utf-8') # affects re's \w
reTEX = re.compile(r'\\\w+')
reNONCHARS = re.compile(r'[^\w\s]')
reSINGLECHAR = re.compile(... | bsd-3-clause |
dead10ck/pyinvestigate | tests/test_investigate.py | 1 | 13571 | from pprint import pprint
import pytest
import datetime
def assert_keys_in(json_obj, *keys):
for key in keys:
assert key in json_obj
def test_categorization(inv):
keys = ['status', 'content_categories', 'security_categories']
# Test get with a single domain
domain = 'www.amazon.com'
resp_... | mit |
hilaskis/UAV_MissionPlanner | Lib/site-packages/numpy/linalg/tests/test_build.py | 81 | 1631 | from subprocess import call, PIPE, Popen
import sys
import re
import numpy as np
from numpy.linalg import lapack_lite
from numpy.testing import TestCase, dec
from numpy.compat import asbytes_nested
class FindDependenciesLdd:
def __init__(self):
self.cmd = ['ldd']
try:
st = call(self.... | gpl-2.0 |
DualSpark/ansible | v1/ansible/runner/action_plugins/assert.py | 138 | 2123 | # Copyright 2012, Dag Wieers <dag@wieers.com>
#
# This file is part of Ansible
#
# Ansible 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 3 of the License, or
# (at your option) any later versi... | gpl-3.0 |
acutesoftware/AIKIF | scripts/examples/document_AIKIF.py | 1 | 9668 | # document_AIKIF.py written by Duncan Murray 18/4/2014
# All Python Program Statistics
# 26/08/2014 : Files = 110 Bytes = 377221 Lines = 10694 Lines of Code = 8836
# 30/10/2014 : Files = 127 Bytes = 444760 Lines = 12595 Lines of Code = 10409
# 04/03/2015 : Files = 142 Bytes = 572245 Lines = 15947 Li... | gpl-3.0 |
r14r-work/fork_bootstrap_master | test-infra/s3_cache.py | 2166 | 5734 | #!/usr/bin/env python2.7
# pylint: disable=C0301
from __future__ import absolute_import, unicode_literals, print_function, division
from sys import argv
from os import environ, stat, chdir, remove as _delete_file
from os.path import dirname, basename, abspath, realpath, expandvars
from hashlib import sha256
from subpr... | mit |
Summerotter/furryyellowpages | config.py | 1 | 1363 | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
MAIL_SERVER = 'smtp.googlemail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USERNAME = os.environ.get('MAIL_USE... | mit |
linjeffrey/phantomjs | src/qt/qtbase/src/3rdparty/freetype/src/tools/glnames.py | 259 | 103407 | #!/usr/bin/env python
#
#
# FreeType 2 glyph name builder
#
# Copyright 1996-2000, 2003, 2005, 2007, 2008 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.... | bsd-3-clause |
adeepkit01/networks | src/csma/bindings/modulegen__gcc_ILP32.py | 28 | 367346 | from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | gpl-2.0 |
EricssonResearch/monad | OpenStreetMap/routesGenerator/tests/tester.py | 2 | 4227 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Copyright 2015 Ericsson AB
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 l... | apache-2.0 |
squeaky-pl/japronto | src/japronto/app/__init__.py | 1 | 8668 | import signal
import asyncio
import traceback
import socket
import os
import sys
import multiprocessing
import faulthandler
import uvloop
from japronto.router import Router, RouteNotFoundException
from japronto.protocol.cprotocol import Protocol
from japronto.protocol.creaper import Reaper
signames = {
int(v): ... | mit |
2uller/LotF | App/Lib/test/test_grammar.py | 4 | 33723 | # Python test set -- part 1, grammar.
# This just tests whether the parser accepts them all.
from test.test_support import run_unittest, check_syntax_error, \
check_py3k_warnings
import unittest
import sys
# testing import *
from sys import *
class TokenTests(unittest.TestCas... | gpl-2.0 |
lawrenceakka/SoCo | tests/test_discovery.py | 2 | 2492 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import socket
import select
from mock import patch, MagicMock as Mock
from soco import discover
from soco import config
from soco.discovery import any_soco
IP_ADDR = '192.168.1.101'
TIMEOUT = 5
class TestDiscover:
def test_discover(self, monkeypat... | mit |
kelvin13/Knockout | pygments/lexers/special.py | 49 | 3069 | # -*- coding: utf-8 -*-
"""
pygments.lexers.special
~~~~~~~~~~~~~~~~~~~~~~~
Special lexers.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer
from pygments.token import Token, Error, Text
from... | gpl-3.0 |
google/seqio | seqio/utils_test.py | 1 | 12588 | # Copyright 2021 The SeqIO Authors.
#
# 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 wr... | apache-2.0 |
asimshankar/tensorflow | tensorflow/contrib/stat_summarizer/python/stat_summarizer_test.py | 22 | 2886 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | apache-2.0 |
addition-it-solutions/project-all | addons/account_followup/report/account_followup_print.py | 4 | 6058 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
muffinresearch/olympia | apps/applications/management/commands/addnewversion.py | 15 | 1104 | from django.core.management.base import BaseCommand, CommandError
from django.db import IntegrityError
import commonware.log
import amo.models
from applications.models import AppVersion
class Command(BaseCommand):
help = ('Add a new version of an application. Syntax: \n'
' ./manage.py addnewversi... | bsd-3-clause |
RickMohr/nyc-trees | src/nyc_trees/apps/users/routes/group.py | 1 | 2018 | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from django.contrib.auth.decorators import login_required
from django_tinsel.decorators import route, render_template, json_api_call
from django_tinsel.utils import decorate as do
fro... | apache-2.0 |
rbarlow/pulp | server/pulp/server/content/sources/event.py | 7 | 3328 | from gettext import gettext as _
from logging import getLogger
log = getLogger(__name__)
EVENT_FAILED = _('Listener error on event: {event}')
class Event(object):
"""
Base event.
:ivar name: The event name.
:type name: str
:ivar request: A download request.
:type request: pulp.server.cont... | gpl-2.0 |
selahssea/ggrc-core | src/ggrc/migrations/versions/20160119143508_262bbe790f4c_import_squashed_migrations.py | 7 | 1939 | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Import all squashed migrations from 0.9.5-Zucchini-P1.
Revision ID: 262bbe790f4c
Revises: 297131e22e28
Create Date: 2016-01-19 14:35:08.577857
These migration were generated with the following procedur... | apache-2.0 |
JustinTulloss/harmonize.fm | masterapp/masterapp/controllers/people.py | 1 | 3444 | # Profile controller for viewing a friend's profile
from masterapp.lib.base import *
from masterapp.lib.amazon import *
from masterapp.lib.profile import Profile
from masterapp.lib.fbauth import ensure_fb_session
from masterapp.lib.snippets import get_session_user
from masterapp.model import User, Session, Spotlight, ... | mit |
jermowery/xos | xos/tosca/resources/sflowservice.py | 2 | 1449 | import os
import pdb
import sys
import tempfile
sys.path.append("/opt/tosca")
from translator.toscalib.tosca_template import ToscaTemplate
from core.models import ServiceAttribute
from services.ceilometer.models import SFlowService
from service import XOSService
class XOSSFlowService(XOSService):
provides = "tos... | apache-2.0 |
sadanandb/pmt | src/tactic/ui/tools/mail_templates.py | 6 | 1494 | {
"insert":
{
"subject": "TACTIC: a new item has been added.",
"message": '''
A new item has been added.
________________________
Code: {@GET(.code)}
Name: {@GET(.name)}
Description: {@GET(.description)}
'''
},
# When an sobject has been updated
"update":
{
"subject": "T... | epl-1.0 |
devdelay/home-assistant | homeassistant/components/light/tellstick.py | 7 | 3313 | """
Support for Tellstick lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.tellstick/
"""
import voluptuous as vol
from homeassistant.components import tellstick
from homeassistant.components.light import ATTR_BRIGHTNESS, Light
from homeassi... | mit |
Brainiq7/Ananse | ananse_dl/extractor/generic.py | 1 | 44347 | # encoding: utf-8
from __future__ import unicode_literals
import os
import re
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..compat import (
compat_urllib_parse,
compat_urlparse,
compat_xml_parse_error,
)
from ..utils import (
determine_ext,
ExtractorError,
float_or_n... | unlicense |
klmitch/neutron | neutron/tests/unit/ipam/fake_driver.py | 38 | 1074 | # Copyright (c) 2015 Infoblox 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... | apache-2.0 |
galtys/odoo | addons/google_calendar/controllers/main.py | 420 | 3002 | import openerp.addons.web.http as http
from openerp.addons.web.http import request
class google_calendar_controller(http.Controller):
@http.route('/google_calendar/sync_data', type='json', auth='user')
def sync_data(self, arch, fields, model, **kw):
"""
This route/function is called when ... | agpl-3.0 |
fernandog/Medusa | ext/sqlalchemy/dialects/oracle/base.py | 1 | 65069 | # oracle/base.py
# Copyright (C) 2005-2018 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: oracle
:name: Oracle
Oracle version 8 through current (11g ... | gpl-3.0 |
xq262144/hue | desktop/core/ext-py/cryptography-1.3.1/src/_cffi_src/commoncrypto/common_digest.py | 10 | 1574 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
INCLUDES = """
#include <CommonCrypto/CommonDigest.h>
"""
TYPES = """
ty... | apache-2.0 |
steedos/odoo7 | openerp/addons/account_voucher/wizard/__init__.py | 79 | 1084 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
frederick-masterton/django | tests/user_commands/tests.py | 53 | 2946 | import os
import sys
from django.core import management
from django.core.management import CommandError
from django.core.management.utils import find_command, popen_wrapper
from django.test import SimpleTestCase
from django.utils import translation
from django.utils.six import StringIO
class CommandTests(SimpleTestC... | bsd-3-clause |
freezmeinster/avagata-site | django/conf/locale/cs/formats.py | 232 | 1288 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. E Y'
TIME_FORMAT = 'G:i:s'
DATETIME_FORMAT = 'j. E Y G:i:s'
YEAR_MONTH... | bsd-3-clause |
eternnoir/VSTools | VSTools/fortify.py | 1 | 3867 | # -*- coding: utf-8 -*-
__author__ = 'eternnoir'
import os
from subprocess import Popen, PIPE
SOURCEANALYZERBIN = 'sourceanalyzer'
def __build_dll_args__(folder_path):
ret = ["-libdirs"]
dll_list = get_all_dll_path(folder_path)
if len(dll_list) == 0:
return []
dll_path_string = ""
for d... | apache-2.0 |
mojaie/kiwiii-server | kiwiii/parser/SpectraMaxM2.py | 1 | 1126 |
import csv
def content_loader(lines):
"""Load datafile from SpectraMax M2.
TODO: multilayer
Args:
lines: lines of input file (or file object)
Returns:
parsed data
"""
bs = 20 # block_size
bo = 1 # block_offset
pr = 16 # plate_rows
ro = 2 # row_offset
pc =... | mit |
Eagles2F/werkzeug | tests/test_wrappers.py | 22 | 34007 | # -*- coding: utf-8 -*-
"""
tests.wrappers
~~~~~~~~~~~~~~
Tests for the response and request objects.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import pytest
import pickle
from io import BytesIO
from datetime import datetime
from werkzeug._compat imp... | bsd-3-clause |
jamespacileo/django-france | django/db/models/deletion.py | 2 | 10834 | from functools import wraps
from operator import attrgetter
from django.db import connections, transaction, IntegrityError
from django.db.models import signals, sql
from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE
from django.utils.datastructures import SortedDict
class ProtectedError(IntegrityErro... | bsd-3-clause |
lab305itep/linux | scripts/tracing/draw_functrace.py | 14676 | 3560 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call ... | gpl-2.0 |
zhukaixy/kbengine | kbe/src/lib/python/Lib/distutils/tests/test_bdist_wininst.py | 105 | 1040 | """Tests for distutils.command.bdist_wininst."""
import unittest
from test.support import run_unittest
from distutils.command.bdist_wininst import bdist_wininst
from distutils.tests import support
class BuildWinInstTestCase(support.TempdirManager,
support.LoggingSilencer,
... | lgpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.