code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
# Copyright (c) 2012 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 sys
import unittest
TEST_MODULES = [
'test_sdktools',
'test_sdktools_commands',
'test_update_nacl_manifest'
]
... | leighpauls/k2cro4 | native_client_sdk/src/build_tools/tests/test_all.py | Python | bsd-3-clause | 687 |
# -*- coding: utf-8 -*-
from cliff.command import Command
from robobrowser import RoboBrowser
try:
import configparser as ConfigParser
except ImportError:
import ConfigParser
import os
class Download(Command):
'Download data files from https://www.kddcup2015.com/submission-data.html'
def get_parser(s... | floydsoft/kddcup2015-cli | kddcup2015_cli/download.py | Python | mit | 1,940 |
import merge_in_memory
__version__ = '0.1'
| danielmoniz/merge_in_memory | __init__.py | Python | mit | 44 |
MAX_STR_LENGTH = 300 # characters
RAW_OUTPUT = False
| goofwear/raspberry_pwn | src/pentest/metagoofil/hachoir_metadata/config.py | Python | gpl-3.0 | 54 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-21 21:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.AddField(
mo... | rit-sailing/website | blog/migrations/0002_post_header_image.py | Python | mit | 451 |
import json, csv
# Get the damn files
with open('sitara_termmodes.json') as jsonfile:
termmodes = json.load(jsonfile)
with open('Default pinmux.txt') as txtfile:
pinmux = csv.DictReader(txtfile, fieldnames=['pinnum', 'address',
'mux', 'driver', 'offset', 'reg name', 'pinname'])
# Turn the pinmux f... | Badg/hwiopy | doc/datasheets/mergemaster.py | Python | lgpl-2.1 | 1,505 |
#!/usr/bin/env python2.7
# Author: echel0n <echel0n@sickrage.ca>
# URL: https://sickrage.ca
#
# This file is part of SickRage.
#
# SickRage 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 t... | SiCKRAGETV/SickRage | tests/test_config.py | Python | gpl-3.0 | 3,485 |
"""CadQuery GUI init module for FreeCAD
This adds a workbench with a scripting editor to FreeCAD's GUI."""
# (c) 2014 Jeremy Wright LGPL v3
import FreeCAD
import FreeCADGui
from Gui.Command import *
class CadQueryWorkbench (Workbench):
"""CadQuery workbench for FreeCAD"""
MenuText = "CadQuery"
... | dcowden/cadquery-freecad-module | CadQuery/InitGui.py | Python | lgpl-3.0 | 5,939 |
# coding: utf-8
# django imports
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
# PATH AND URL SETTINGS
# Main Media Settings
# WARNING: FILEBROWSER_MEDIA_ROOT and FILEBROWSER_MEDIA_URL will be removed with Filebrowser 3.6.
# Read the documentation on FileBrowser's storages ... | josircg/raizcidadanista | raizcidadanista/filebrowser/settings.py | Python | gpl-3.0 | 5,736 |
from .base import SourceType
| mugwort-rc/idata | idata/source/__init__.py | Python | gpl-3.0 | 29 |
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.model_selection import train_test_split
import sys, os
sys.path.append(os.pardir)
from model.ch3 import plot_decision_regions
from sklearn.tree import DecisionTreeClassifier
iris = datasets.load_iris()
x = iris.data[:, [2,3]]... | yukke42/machine-learning | 3/p84_decisiontree.py | Python | mit | 957 |
"""
Write a function to find the longest common prefix string amongst an array of strings.
"""
class Solution(object):
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if strs==[]:
return ''
if len(strs)==1:
retu... | lingcheng99/LeetCode | LongestCommonPrefix.py | Python | mit | 648 |
# nif.py - functions for handling Portuguese VAT numbers
# coding: utf-8
#
# Copyright (C) 2012, 2013 Arthur de Jong
#
# This library 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 Foundation; either
# version 2.1... | t0mk/python-stdnum | stdnum/pt/nif.py | Python | lgpl-2.1 | 2,495 |
from datetime import datetime
import pytest
from nylas.client.restful_models import JobStatus
@pytest.mark.usefixtures("mock_job_statuses")
def test_first_job_status(api_client):
job_status = api_client.job_statuses.first()
assert isinstance(job_status, JobStatus)
@pytest.mark.usefixtures("mock_job_statuse... | nylas/nylas-python | tests/test_job_status.py | Python | mit | 1,449 |
#!/usr/bin/env python
import requests
# Enter here the two sensors to measure the difference
# Get a full list of sensors data at: http://localhost:8090/api/sensors/ and find the sensor you need. Copy the value of the field 'id'
SENSORS=['dcd784579ab801750421dd3634d69fd5','176ba2cc660046a239e15b1f94ef8091']
# Enter th... | theyosh/TerrariumPI | contrib/sensors_diff.py | Python | gpl-3.0 | 1,165 |
# -*- coding: utf-8 -*-
from StringIO import StringIO
import unittest
import urllib
import cherrypy
# Not strictly speaking mandatory but just makes sense
cherrypy.config.update({'environment': "test_suite"})
# This is mandatory so that the HTTP server isn't started
# if you need to actually start (why would you?), ... | luciddg/auth-tool | tests/utils/cptestcase.py | Python | mit | 3,413 |
#!/usr/bin/python
##############################################################
# Program name: NCAA Basketball Stats Scraper (Team Mappings Module)
# Version: 1.0
# By: Rodrigo Zamith
# License: MPL 2.0 (see LICENSE file in root folder)
# Additional thanks:
###########################################################... | rodzam/ncaab-stats-scraper | create_team_mappings.py | Python | mpl-2.0 | 1,809 |
__author__ = 'adeksandrcernov'
import re
from random import randrange
def test_phones_on_home_page(app):
old_contacts = app.contacts.get_contacts_list()
index = randrange (len(old_contacts))
contact_from_home_page = app.contacts.get_contacts_list()[index]
contact_from_edit_page = app.contacts.get_con... | AlChernoff/python_training | test/test_phones.py | Python | apache-2.0 | 1,470 |
# Volatility
# Copyright (c) 2008-2013 Volatility Foundation
#
# This file is part of Volatility.
#
# Volatility 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 o... | Cisco-Talos/pyrebox | volatility/volatility/plugins/overlays/windows/vista_sp12_x64_syscalls.py | Python | gpl-2.0 | 43,395 |
# Copyright 2012 the rootpy developers
# distributed under the terms of the GNU General Public License
from __future__ import absolute_import
from array import array
from math import sqrt
from itertools import product
import operator
import numbers
try:
from itertools import izip as zip
except ImportError: # will ... | henryiii/rootpy | rootpy/plotting/hist.py | Python | gpl-3.0 | 91,405 |
from __future__ import print_function
from setuptools import setup, find_packages
import io
import codecs
import os
import sys
here = os.path.abspath(os.path.dirname(__file__))
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filen... | dilgerma/shipwright | setup.py | Python | apache-2.0 | 1,675 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | leki75/ansible | lib/ansible/module_utils/asa.py | Python | gpl-3.0 | 5,158 |
from crispy_forms.helper import FormHelper
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from postix.core.models import Item
from postix.core.models.base import ItemSupplyPack
class SupplyCreateForm(forms.Form):
amount = forms.... | c3cashdesk/c6sh | src/postix/backoffice/forms/supply.py | Python | agpl-3.0 | 2,178 |
from datetime import datetime
import pytest
from pandas._libs import tslib
@pytest.mark.parametrize(
"date_str, exp",
[
("2011-01-02", datetime(2011, 1, 2)),
("2011-1-2", datetime(2011, 1, 2)),
("2011-01", datetime(2011, 1, 1)),
("2011-1", datetime(2011, 1, 1)),
("201... | toobaz/pandas | pandas/tests/tslibs/test_parse_iso8601.py | Python | bsd-3-clause | 2,108 |
import datetime
import hashlib
import random
import re
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.db import transaction
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
try:
from d... | meletakis/collato | esn/registration/models.py | Python | gpl-2.0 | 10,562 |
#FLM: TT Hints Duplicator_coords
# coding: utf-8
import os
import sys
__copyright__ = __license__ = """
Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software")... | adobe-type-tools/fontlab-scripts | TrueType/tthDupe_coords.py | Python | mit | 4,243 |
import re
from pprint import pprint
import yaml
from netmiko import (
ConnectHandler,
NetMikoAuthenticationException,
NetMikoTimeoutException,
)
def parse_cdp(output):
regex = (
r"Device ID: (?P<host>\w+)\."
r".*?"
r"IP address: (?P<ip>\S+)\n"
r".*?"
r"Interfac... | natenka/natenka.github.io | code_examples/explore_map/explorer2.py | Python | mit | 2,387 |
"""
kmerfreq_ha_2_wrapper.py
A wrapper script for KmerFreq_HA_v2.0
Peter Li - GigaScience, BGI-HK
"""
import optparse, os, shutil, subprocess, sys, tempfile
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def cleanup_before_exit(tmp_dir):
if tmp_dir and os.path.exists(tmp_dir):
shutil.rmtree(... | gigascience/galaxy-bgisoap | tools/kmerfreq_ha_2/kmerfreq_ha_2_wrapper.py | Python | gpl-3.0 | 6,446 |
#!/usr/bin/env python
#coding:utf-8
"""
Author: Steven C. Howell --<steven.howell@nist.gov>
Purpose: calculating the R-factor from a SasCalc run
Created: 12/09/2016
00000000011111111112222222222333333333344444444445555555555666666666677777777778
123456789012345678901234567890123456789012345678901234567890... | StevenCHowell/code_sas_modeling | sas_modeling/calc_discrepancy.py | Python | gpl-3.0 | 11,923 |
"""Skeletons for Python 3 built-in symbols."""
def abs(number):
"""Return the absolute value of the argument.
:type number: T
:rtype: T | unknown
"""
return number
def all(iterable):
"""Return True if bool(x) is True for all values x in the iterable.
:type iterable: collections.Iterabl... | consulo/consulo-python | plugin/src/main/dist/helpers/python-skeletons/builtins.py | Python | apache-2.0 | 57,560 |
# Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | bdang2012/taiga-back-casting | taiga/projects/custom_attributes/choices.py | Python | agpl-3.0 | 1,082 |
from MapManager import MapManager, MapVisualizer
import Pathfinder as PF
mapman = MapManager("map.json")
#map.containerTransfer(map.getObject("tower_1").Chest, map.getEntity("ROBOT").Chest, "module_1")
#Pathfinder
start = mapman.getEntity("ROBOT").Position.tuple2()
goal = ( 600 , 600 )
goal = ( 2757, 988 )
goal ... | MadeInPierre/RobotOS | src/robot_memory_map_old/src/test.py | Python | mit | 662 |
"""
dyn_pages/qoop.py
Author: Josh Williams
Date Added: Thu Jun 28 14:58:26 CDT 2007
Interface for Qoop into the system.
"""
## STD LIBS
from xml.dom import minidom
import md5, time, os
## OUR LIBS
from zoto_base_page import zoto_base_page
from display_sizes import display_sizes
from imagemanip import manip
import ... | kordless/zoto-server | aztk/web/qoop.py | Python | bsd-3-clause | 19,943 |
# -*- coding: utf-8 -*-
# Copyright 2014 Mirantis, 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 requir... | andrei4ka/fuel-web-redhat | nailgun/nailgun/test/performance/base.py | Python | apache-2.0 | 9,265 |
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectUD import DistributedObjectUD
class DistributedToonUD(DistributedObjectUD):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedToonUD")
def setDNAString(self, todo0):
pass
def setGM(self, tod... | silly-wacky-3-town-toon/SOURCE-COD | toontown/toon/DistributedToonUD.py | Python | apache-2.0 | 10,268 |
def __load():
import imp, os, sys
ext = 'objc/_objc.so'
for path in sys.path:
if not path.endswith('lib-dynload'):
continue
ext = os.path.join(path, ext)
if os.path.exists(ext):
#print "py2app extension module", __name__, "->", ext
mod = imp.load_... | debugger06/MiroX | osx/build/bdist.macosx-10.5-fat/python2.7-standalone/app/temp/objc/_objc.py | Python | gpl-2.0 | 540 |
# -*- coding: utf-8 -*-
"""
This program 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.
This program is distributed in... | estaban/pyload | module/plugins/accounts/BitshareCom.py | Python | gpl-3.0 | 1,729 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.contrib.postgres.fields
import django.contrib.postgres.fields.hstore
from django.contrib.postgres.operations import CreateExtension, HStoreExtension
from django.db import migrations, models
try:
from django.db.models import JSONField
e... | fcurella/django-fakery | tests/migrations/0001_initial.py | Python | mit | 6,299 |
# Copyright (c) 2011, Intel Corporation
# 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 condit... | biosbits/bits | python/cpu_gen.py | Python | bsd-3-clause | 3,110 |
from unittest.mock import Mock
from core.exceptions import AddedMoreToCartThanAvailable
from django.core.exceptions import ValidationError
from django.db import IntegrityError
from django.utils import timezone
from core.tests.base import CoreTestCase
from core.models.partners import Partner
class DeliveryModelTest(C... | agripo/website | core/tests/models/test_partners.py | Python | gpl-2.0 | 2,351 |
# Write your mean_datasets function here
import numpy as np
def mean_datasets(filelist):
count = 0
for file in filelist:
newdata = np.loadtxt(file, delimiter=',')
if count == 0:
data = newdata
else:
data = data + newdata #adds matrixes
count = count + 1
data = data/count #calculate t... | lokijota/datadrivenastronomymooc | wk1/MeanOfASetOfSignals/mean_datasets.py | Python | mit | 549 |
import urllib
import re
import json
import sys
from dbmanager import DBManager
from time import time, sleep, timezone
from datetime import timedelta, datetime
import os
from subprocess import Popen, PIPE
from collections import namedtuple
from os.path import join as joinpath, dirname, realpath, exists, split as splitpa... | amol9/fbstats | fbstats/fb.py | Python | mit | 16,086 |
import unittest
from types import ModuleType
def IsTestCase(test):
if type(test) == type and issubclass(test, unittest.TestCase):
return True
return False
def AddTests(suite, test):
if isinstance(test, ModuleType):
for entry in test.__dict__.values():
if IsTestCase(entry):... | aidanf/SimpleICM | tests/testutils.py | Python | gpl-3.0 | 674 |
def argskwargs():
r"""
>>> def countargs(*args):
... print 'Passed in', len(args), 'args.'
>>> countargs('a', 'b', 'c')
Passed in 3 args.
>>> countargs()
Passed in 0 args.
>>> import os
>>> os.path.join('a', 'b', 'c')
'a\\b\\c'
>>> os.path.join('a')
'a'
>>> os.path.join()
Traceback (most recent call last):
T... | rgalanakis/practicalmayapython | src/appendix/interactive.py | Python | mit | 3,252 |
"""Python RADIUS client code.
pyrad is an implementation of a RADIUS client as described in RFC2865.
It takes care of all the details like building RADIUS packets, sending
them and decoding responses.
Here is an example of doing a authentication request::
import pyrad.packet
from pyrad.client import Client
fro... | talkincode/txradius | txradius/radius/__init__.py | Python | lgpl-3.0 | 1,356 |
from conans import ConanFile, CMake
from conans import tools
import os
class SFMLConan(ConanFile):
name = "SFML"
version = "2.3.2"
url = "https://github.com/memsharded/conan-sfml.git"
settings = "os", "compiler", "build_type", "arch"
options = {"static": [True, False]}
default_options = "stati... | memsharded/conan-sfml | conanfile.py | Python | mit | 2,279 |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope t... | Brainbuster/openpli-buildumgebung | openembedded-core/scripts/lib/wic/plugins/source/rawcopy.py | Python | gpl-2.0 | 2,926 |
import numpy as np
from aston.trace.Trace import AstonSeries
from aston.peaks.PeakModels import gaussian
def generate_chromatogram(n=5, twin=None):
if twin is None:
twin = (0, 60)
t = np.linspace(twin[0], twin[1], 300)
peak_locs = twin[1] * np.random.random(n)
peak_ws = 0.2 + 0.8 * np.random.r... | molliewebb/aston | aston/test/TestPeakFinding.py | Python | gpl-3.0 | 614 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from catapult_base import support_binaries
def FetchPath(binary_name, platform, arch):
""" Return a path to the appropriate executable for <binary_name>,... | Just-D/chromium-1 | tools/telemetry/telemetry/internal/util/binary_manager.py | Python | bsd-3-clause | 740 |
# -*- coding: utf-8 -*-
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Joan Massich <mailsik@gmail.com>
#
# License: BSD Style.
import os
import os.path as op
import numpy as np
from distutils.version import LooseVersion
from ...utils import _fetch_file, verbose, _TempDir, _check_pandas_instal... | adykstra/mne-python | mne/datasets/sleep_physionet/_utils.py | Python | bsd-3-clause | 8,431 |
from __future__ import unicode_literals
import itertools
from collections import defaultdict
import string
import random
import uuid
from jinja2 import Template
from moto.core import BaseBackend, CloudFormationModel
ROUTE53_ID_CHOICE = string.ascii_uppercase + string.digits
def create_route53_zone_id():
# Ne... | william-richard/moto | moto/route53/models.py | Python | apache-2.0 | 15,009 |
#!/usr/bin/python
#
# 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 a... | iparanza/earthenterprise | earth_enterprise/src/fusion/portableglobe/servers/windows/glc_unpacker.py | Python | apache-2.0 | 15,906 |
#
# This file is part of nmgr.
# Copyright (C) 2015 Leo Gaspard
#
# nmgr 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.
#
# nmgr is di... | Ekleog/nmgr | tests/devup_test.py | Python | agpl-3.0 | 1,040 |
###
# Copyright (c) 2013, S Teppin
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions, and... | steppin/some_bot | irc/plugins/TagproStats/config.py | Python | gpl-3.0 | 2,367 |
import importlib
import logging
import random
import braintree
from collections import Counter
from decimal import Decimal, ROUND_CEILING
from django.conf import settings
from django.contrib.gis.geoip2 import GeoIP2
from django.core.urlresolvers import reverse
from django.template.response import TemplateResponse
from ... | libretees/libreshop | libreshop/orders/views.py | Python | gpl-3.0 | 17,297 |
import random
def numberRange(number1, number2):
return random.randint(number1, number2)
def resultbyuser(result,usersGuess):
if result > usersGuess:
sub = abs(usersGuess - result)
return "That's over by {}".format(sub)
else:
add = abs(usersGuess + result)
return "That's under by {}".format(add)
def main(... | tonsom1592-cmis/tonsom1592-cmis-cs2 | oneguess.py | Python | cc0-1.0 | 966 |
from __future__ import division
import warnings
import numpy as np
import scipy.sparse as sp
from sklearn.base import clone
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import a... | mblondel/scikit-learn | sklearn/tests/test_dummy.py | Python | bsd-3-clause | 17,468 |
def _super_log(message):
print("-" * 18)
print(message)
print("-" * 18 + "\n")
def _format_ogr2ogr(path='', file_name=''):
return "ogr2ogr -f 'Polygon' %(path)s.Polygon %(path)s/%(file_name)s.shp" % \
{'path': path, 'file_name': file_name}
| kiote/cosmopolitan | cosmopolitan/management/commands/service/__init__.py | Python | mit | 266 |
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | openstack/tempest | tempest/test_discover/test_discover.py | Python | apache-2.0 | 1,891 |
# -*- coding: utf-8 -*-
#
# Map_Corners_Coordinates documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 12 17:11:03 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerat... | ctu-geoforall-lab/qgis-pu-plugin | docs/source/conf.py | Python | gpl-3.0 | 7,218 |
'''Modulo que define la clase variable'''
class Variable(object):
'''Clase Variable. Contiene nombre, tipo y valor'''
def __init__(self, name, value, var_type, scope, size, is_dim=False):
self.name = name
self.value = value
self.type = var_type
self.scope = scope
self.siz... | davilajose23/ProjectCobra | variable.py | Python | mit | 1,057 |
# -*- 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 'Version.privacy_level'
db.add_column('builds_version', 'privacy_level',
... | d0ugal/readthedocs.org | readthedocs/builds/migrations/0015_add_privacy.py | Python | mit | 11,730 |
# -*- coding: utf-8 -*-
#
# Copyright(c) 2010 poweredsites.org
#
# 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... | felinx/poweredsites | poweredsites/libs/mail.py | Python | apache-2.0 | 3,173 |
""" Test docstrings in functions and classes, which are used to infer types """
# -----------------
# sphinx style
# -----------------
def f(a, b, c, d):
""" asdfasdf
:param a: blablabla
:type a: str
:type b: (str, int)
:type c: threading.Thread
:type d: :class:`threading.Thread`
:rtype: di... | SamuelDSR/YouCompleteMe-Win7-GVIM | third_party/jedi/test/completion/docstring.py | Python | gpl-3.0 | 1,595 |
from PIL import ImageDraw, Image
from SyntheticDataset2.ElementsCreator import Shape
import math
class Heptagon(Shape):
def __init__(self, radius, color, rotation):
"""
Initialize a Heptagon shape
:param radius: radius in pixels
:type radius: int
:param color: color of sha... | FlintHill/SUAS-Competition | UpdatedSyntheticDataset/SyntheticDataset2/ElementsCreator/heptagon.py | Python | mit | 2,210 |
# -*- coding: utf-8 -*-
"""
utils
~~~~~
utilities to support comparing python implementation
of serialization frameworks
:copyright: (c) 2014 by sc AmvTek srl
:email: devel@amvtek.com
"""
def is_protobuf_available(with_extension=False):
"return True if selected protobuf framework is rea... | amvtek/PySerializers | utils.py | Python | mit | 5,110 |
"""Perform some action such as having an MUA check mail on the folders
to be synchronized."""
import sys
import subprocess
import pkg_resources
import optparse
from rpatterson.mailsync import parse
def get_checker(option, opt_str, value, parser):
setattr(parser.values, option.dest,
pkg_resources.Entr... | detrout/rpatterson.mailsync | rpatterson/mailsync/check.py | Python | gpl-2.0 | 2,727 |
import pytest
import rules
from adhocracy4.projects.enums import Access
from adhocracy4.test.helpers import freeze_phase
from adhocracy4.test.helpers import freeze_post_phase
from adhocracy4.test.helpers import freeze_pre_phase
from adhocracy4.test.helpers import setup_phase
from adhocracy4.test.helpers import setup_u... | liqd/a4-meinberlin | tests/documents/rules/test_rules_comment_chapter.py | Python | agpl-3.0 | 7,220 |
# Module tests
# Copyright (c) 2014, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import os
import time
import hostapd
def test_module_wpa_supplicant(dev, apdev, params):
"""wpa_supplicant module tests"""
if "OK" not in dev[0]... | s0lst1c3/eaphammer | local/hostapd-eaphammer/tests/hwsim/test_module_tests.py | Python | gpl-3.0 | 889 |
from __future__ import print_function
import time
import argparse
import grpc
from jaeger_client import Config
from grpc_opentracing import open_tracing_client_interceptor
from grpc_opentracing.grpcext import intercept_channel
import command_line_pb2
def run():
parser = argparse.ArgumentParser()
parser.ad... | johnbelamaric/themis | vendor/github.com/grpc-ecosystem/grpc-opentracing/python/examples/trivial/trivial_client.py | Python | apache-2.0 | 1,218 |
from link import Wrapper
from link.utils import list_to_dataframe
class ElasticSearch(Wrapper):
"""
wraps an ElasticSearch connection and extends the functionality
to do tasks like put queries into dataframes
"""
def __init__(self, wrap_name = None, **kwargs):
self.options = {}
if k... | uhjish/link | link/wrappers/elasticsearchwrappers.py | Python | apache-2.0 | 2,617 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
dinftranslimaccum_multi.py
---------------------
Date : March 2015
Copyright : (C) 2015 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
***... | michaelkirk/QGIS | python/plugins/processing/algs/taudem/dinftranslimaccum_multi.py | Python | gpl-2.0 | 4,721 |
from .core import where, old_where
__version__ = "2017.01.23"
| ghostlines/ghostlines-robofont | src/lib/site-packages/certifi/__init__.py | Python | mit | 63 |
# Copyright 2014 IBM Corp.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | rakeshmi/cinder | cinder/tests/unit/test_db_api.py | Python | apache-2.0 | 78,467 |
import os
import unittest
from vsg.rules import generic
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_009_test_input.vhd'))
lExpected_lower = []
lExpected_lower.append('')
utils.read_file(os.path.joi... | jeremiah-c-leary/vhdl-style-guide | vsg/tests/generic/test_rule_009.py | Python | gpl-3.0 | 2,038 |
import sys
import pytest
import os
import shutil
import py
pytest_plugins = "pytester",
class TestNewAPI:
def test_config_cache_makedir(self, testdir):
testdir.makeini("[pytest]")
config = testdir.parseconfigure()
with pytest.raises(ValueError):
config.cache.makedir("key/name")... | oleg-alexandrov/pytest | testing/test_cache.py | Python | mit | 11,823 |
# Copyright 2019-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 versio... | chrislit/abydos | tests/tokenizer/test_tokenizer_legalipy.py | Python | gpl-3.0 | 3,183 |
import numpy as np
import matplotlib.pyplot as plt
import gym
import time
import copy
from keras.models import Sequential, Model
from keras.layers import Dense, Activation, Flatten, Lambda, Input, Reshape, concatenate, Merge
from keras.optimizers import Adam, RMSprop
from keras.callbacks import History
from keras imp... | amozie/amozie | studzie/keras_rl_agent/dqn_test.py | Python | apache-2.0 | 2,269 |
"""
Mixins to facilitate testing OAuth connections to Django-OAuth-Toolkit or
Django-OAuth2-Provider.
"""
from openedx.core.djangoapps.oauth_dispatch import adapters
from openedx.core.djangoapps.oauth_dispatch.tests.constants import DUMMY_REDIRECT_URL
class DOTAdapterMixin:
"""
Mixin to rewire existing tests ... | edx/edx-platform | openedx/core/djangoapps/auth_exchange/tests/mixins.py | Python | agpl-3.0 | 1,519 |
#!/usr/bin/python2.6
# This file is a part of Metagam project.
#
# Metagam 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
# any later version.
#
# Metagam is distributed ... | JoyTeam/metagam | mg/mmorpg/equip.py | Python | gpl-3.0 | 68,596 |
# -*- coding: utf-8 -*-
"""
test_address
~~~~~~~~~~~~~~~
This unittest module tests the ELAddress class
:copyright: (c) 2015 by Justin Cano
:license: MIT, see LICENSE for more details
"""
import vcr
import requests
import unittest
import everythinglocation
class TestAddress(unittest.TestCase):
... | bumrush/everythinglocation.py | tests/test_address.py | Python | mit | 993 |
"""Test sthlm_sbk reader."""
import json
from leopard_lavatory.readers.sthlm_sbk import SBKReader
def test_sthlm_sbk():
reader = SBKReader()
address = 'Brunnsgatan 1'
newer_than_case = '2008-09960'
print('Getting all results for address {}, newer than case {}'.format(address, newer_than_case))
t... | sheep7/leopard-lavatory | tests/readers/test_sthlm_sbk.py | Python | gpl-3.0 | 528 |
#!/usr/bin/python
#------------------------------------------------------------------------------#
# shell.py #
# #
# Copyright (c) 2009-2010, Code A La Mode, original auth... | brainix/imi-imi | shell.py | Python | gpl-3.0 | 5,880 |
import csv
import functools
import io
import itertools
from girder.api import access
from girder.api.describe import describeRoute, Description
from girder.api.rest import loadmodel, setResponseHeader
from girder.constants import AccessType, SortDir
from girder.exceptions import ValidationException
from .base import ... | ImageMarkup/isic-archive | isic_archive/api/study.py | Python | apache-2.0 | 5,933 |
import logging
import ibmsecurity.utilities.tools
logger = logging.getLogger(__name__)
def get(isamAppliance, check_mode=False, force=False):
"""
Get management ssl certificate information
"""
return isamAppliance.invoke_get("Get management ssl certificate information",
... | IBM-Security/ibmsecurity | ibmsecurity/isam/base/management_ssl_certificate.py | Python | apache-2.0 | 1,864 |
"""Tests for 2d flow around a cylinder with a conforming mesh and rans3p"""
from builtins import range
from builtins import object
from importlib import reload
from proteus.iproteus import *
from proteus import Comm
from proteus import Context
import tables
import importlib
comm = Comm.get()
Profiling.logLevel = 7
Pro... | erdc/proteus | proteus/tests/HotStart_3P/test_HotStart_rans3p.py | Python | mit | 3,680 |
"""
@author: ArcREST Team
@contact: www.github.com/Esri/ArcREST
@company: Esri
@version: 1.0.0
@description: Adds an SD to AGOL.
@requirements: Python 2.7.x, ArcGIS 10.3, ArcREST 2.x
@copyright: Esri, 2015
"""
import os
from arcpy import env
from arcpy import mapping
from arcpy import da
i... | BrunoCaimar/ArcREST | tools/src/addItem.py | Python | apache-2.0 | 3,372 |
"""
launch_worker.py : Launch a standalone worker
This file is part of EPControl.
Copyright (C) 2016 Jean-Baptiste Galet & Timothe Aeberhardt
EPControl 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 ve... | PokeSec/agentlib | epc/pc/launch_worker.py | Python | gpl-3.0 | 2,449 |
# !/usr/bin/env python
# -*- coding: utf_8 -*-
# Date: 2014/11/26
#
import hashlib
import struct
import os
import base64
ACSII = {'1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '0': 0,
'a': 10, 'b': 11, 'c': 12, 'd': 13, 'e': 14, 'f': 15}
def writeunsignedleb128(num, file):
if nu... | peterdocter/DexParse | Test.py | Python | apache-2.0 | 2,489 |
client_id = 'jian-mac'
| jianhuashao/WebDownloadJobsManage | post-process/CONFIG.py | Python | apache-2.0 | 24 |
""" Use all available data for training """
import itertools
import logging
from pySPACE.missions.nodes.base_node import BaseNode
class AllTrainSplitterNode(BaseNode):
""" Use all available data for training
This node allows subsequent nodes to use all available labeled
data for training. Accordingl... | pyspace/test | pySPACE/missions/nodes/splitter/all_train_splitter.py | Python | gpl-3.0 | 2,977 |
# This program 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.
#
# This program is distributed in the hope that it will be useful,
# bu... | vpodzime/lvm-dubstep | lvmdbus/automatedproperties.py | Python | gpl-3.0 | 6,035 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2018-12-22 20:31
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('lmhsweb', '0001_initial'),
]
operations = [
... | tiagovaz/lmhs | lmhsweb/migrations/0002_auto_20181222_2031.py | Python | gpl-3.0 | 1,144 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © 2016-2018 Cyril Desjouy <ipselium@free.fr>
#
# This file is part of cpyvke
#
# cpyvke 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 vers... | ipselium/cpyvke | cpyvke/utils/kernel.py | Python | gpl-3.0 | 6,628 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2012 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 General Public License as published by
## the Free Software Foundati... | tiagocardosos/stoq | stoqlib/gui/test/test_paymentseditor.py | Python | gpl-2.0 | 3,897 |
from projectname.tests import *
class TestMakoController(TestController):
def test_mako(self):
response = self.app.get(url_for(controller='/sample', action='testmako'))
assert 'Hello, 5+5 is 10' in response
| santisiri/popego | envs/ALPHA-POPEGO/lib/python2.5/site-packages/Pylons-0.9.6.1-py2.5.egg/tests/test_webapps/filestotest/functional_sample_controller_mako.py | Python | bsd-3-clause | 228 |
"""
Spectral element DEComposition (SDEC) Plot for TARDIS simulation models.
This plot is a spectral diagnostics plot similar to those originally
proposed by M. Kromer (see, for example, Kromer et al. 2013, figure 4).
"""
import numpy as np
import pandas as pd
import astropy.units as u
import astropy.modeling.blackbod... | tardis-sn/tardis | tardis/visualization/tools/sdec_plot.py | Python | bsd-3-clause | 76,641 |
from . import audio, phy, mac, net
| piannucci/blurt | blurt_py_80211/streaming/blurt/__init__.py | Python | mit | 35 |
'''
SASSIE: Copyright (C) 2011 Joseph E. Curtis, Ph.D.
This program 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.
... | madscatt/zazzie_1.5 | trunk/sassie/simulate/energy/angle_energy.py | Python | gpl-3.0 | 1,570 |
import sys
if sys.version_info < (3, 7):
from ._ysrc import YsrcValidator
from ._yperiodalignment import YperiodalignmentValidator
from ._yperiod0 import Yperiod0Validator
from ._yperiod import YperiodValidator
from ._yhoverformat import YhoverformatValidator
from ._ycalendar import YcalendarVa... | plotly/plotly.py | packages/python/plotly/plotly/validators/box/__init__.py | Python | mit | 7,323 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.