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
# stdlib from collections import defaultdict from datetime import datetime, timedelta from itertools import islice from urlparse import urljoin # project from checks import AgentCheck # 3p import requests class ConsulCheck(AgentCheck): CONSUL_CHECK = 'consul.up' HEALTH_CHECK = 'consul.check' CONSUL_CAT...
huhongbo/dd-agent
checks.d/consul.py
Python
bsd-3-clause
14,551
source = '''# line 1 'A module docstring.' import sys, inspect # line 5 # line 7 def spam(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h): eggs(b + d, c + f) # line 11 def eggs(x, y): "A docstring." global fr, st fr = inspect.currentframe() st = inspect.stack() p = x q = y / 0 # line 20 clas...
MalloyPower/parsing-python
front-end/testsuite-python-lib/Python-2.3/Lib/test/test_inspect.py
Python
mit
11,556
# -*- coding: utf-8 -*- # # PySPED - Python libraries to deal with Brazil's SPED Project # # Copyright (C) 2010-2012 # Copyright (C) Aristides Caldeira <aristides.caldeira at tauga.com.br> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Library General Public Lic...
henriquechehad/PySPED
pysped/nfe/leiaute/nfe_110.py
Python
lgpl-2.1
156,153
#!/usr/bin/env python # # Written by Dougal Scott <dougal.scott@gmail.com> # # Copyright (C) 2017 Dougal Scott # # 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 t...
dwagon/hostinfo_client
bin/hostinfo_deleterestrictedvalue.py
Python
gpl-3.0
1,805
""" Platform for the opengarage.io cover component. For more details about this platform, please refer to the documentation https://home-assistant.io/components/cover.opengarage/ """ import logging import voluptuous as vol import requests from homeassistant.components.cover import ( CoverDevice, PLATFORM_SCHEMA...
JshWright/home-assistant
homeassistant/components/cover/opengarage.py
Python
apache-2.0
6,089
# # This source file is part of the EdgeDB open source project. # # Copyright 2016-present MagicStack Inc. and the EdgeDB 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...
edgedb/edgedb
tests/test_http_graphql_query.py
Python
apache-2.0
121,035
import numpy as np import pylab as pl pl.figure(figsize=[12,6]) cm = np.genfromtxt('/media/luna1/vinu/software/cosmosis/mft_output/mass_function/m_h.txt') cmf = np.genfromtxt('/media/luna1/vinu/software/cosmosis/mft_output/mass_function/dndlnmh.txt') h = 0.71 pl.subplot(121) pl.loglog(cm, cmf[0], label='COSMOSIS z=0'...
vvinuv/HaloModel
plotting_scripts/compare_massfunction.py
Python
gpl-3.0
941
''' Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] return 3, and [3,4,-1,1] return 2. Your algorithm should run in O(n) time and uses constant space. ''' class Solution(object): def firstMissingPositive(self, nums): """ :type nums: List[int] ...
wufangjie/leetcode
041. First Missing Positive.py
Python
gpl-3.0
988
import os import shutil import yaml from twisted.internet.defer import inlineCallbacks from juju.charm.directory import CharmDirectory from juju.charm.tests import local_charm_id from juju.charm.tests.test_directory import sample_directory from juju.charm.tests.test_repository import unbundled_repository from juju....
anbangr/trusted-juju
juju/state/tests/test_charm.py
Python
agpl-3.0
6,967
# -*- coding: UTF-8 -*- from flask import jsonify from sqlalchemy.orm.exc import NoResultFound from flask.ext.databrowser import ModelView, col_spec, sa from flask.ext.databrowser.action import DeleteAction from flask.ext.babel import lazy_gettext, gettext as _ from genuine_ap.config import config_ws from genuine_ap.mo...
PuZheng/lejian-backend
lejian/config/views.py
Python
mit
2,153
from __future__ import absolute_import import os import pytest from scipy import ndimage TESTDATA = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'testdata') @pytest.fixture(scope='session') def easy_plate(): return ndimage.io.imread( os.path.join(TESTDATA, 'test_fixture_easy.tiff') ) ...
Scan-o-Matic/scanomatic
tests/unit/image_analysis/conftest.py
Python
gpl-3.0
470
#!/usr/bin/env python import vtk from vtk.test import Testing from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() # this script tests vtkImageReslice with different interpolation modes, # with the wrap-pad feature turned on # Image pipeline reader = vtk.vtkImageReader() reader.ReleaseDataFlagOff(...
HopeFOAM/HopeFOAM
ThirdParty-0.1/ParaView-5.0.1/VTK/Imaging/Core/Testing/Python/ResliceMirrorPad.py
Python
gpl-3.0
3,424
""" This app can be hooked in to a page via the CMS template options. The template file needs adding to CMS_TEMPLATES in settings. Content is controlled via django admin. """ __author__ = 'mwalker'
marksweb/django-cms-app-examples
clinics/__init__.py
Python
mit
199
__author__ = 'Michael' import codecs import logging class Ccedict(): @staticmethod def splitLine(line): """Returns simplified character, pinyin, and definitions in a set""" if (line.startswith("#")): return None pinyin_start = line.find("[") pinyin_end = line.find...
The80sCalled/flash-card-builder
ccedict.py
Python
mit
2,205
from tests.models import Theme, Question, Option, Course, Document, Help from rest_framework import routers, serializers, viewsets # Serializers define the API representation. class OptionSerializer(serializers.ModelSerializer): class Meta: model = Option fields = ('right', 'text') class HelpSer...
simpleTestSystem/Server_core
tests/serializers.py
Python
mit
3,627
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Interpreter version: python 2.7 # # Imports ===================================================================== # Functions & classes ========================================================= class Field(object): def __init__(self, name, docstring, is_comm_fiel...
edeposit/edeposit.amqp.storage
src/edeposit/amqp/storage/structures/templates/tools/field.py
Python
mit
619
#!/usr/bin/python2 # This is a decision tree classifier based on the scikit-learn example, # taking as input an X and Y and any tree complexity parameters, and # returning a classifier that can then be analyzed with the classifier. # See the example in the main method for that and error-checking. # # Decision tree doc...
bravelittlescientist/kdd-particle-physics-ml-fall13
src/decision_tree.py
Python
gpl-2.0
1,339
from abc import ABCMeta, abstractmethod import itertools from FibonacciHeap import FibHeap import heapq import Queue class PriorityQueue(): __metaclass__ = ABCMeta @abstractmethod def __len__(self): pass @abstractmethod def insert(self, node): pass @abstractmethod def minimum(self): pa...
mikepound/mazesolving
priority_queue.py
Python
unlicense
3,189
#!/usr/bin/env python ''' Copyright (C) 2005 Aaron Spike, aaron@ekips.org 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 2 of the License, or (at your option) any later version. Thi...
step21/inkscape-osx-packaging-native
packaging/macosx/Inkscape.app/Contents/Resources/extensions/motion.py
Python
lgpl-2.1
4,709
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # # Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved. # # This program is free software: you can redistribute it and/or modify # it under...
rschnapka/account-financial-reporting
account_move_line_report_xls/report/move_line_list_xls.py
Python
agpl-3.0
17,500
# Copyright (C) 2012,2013 # Max Planck Institute for Polymer Research # Copyright (C) 2008,2009,2010,2011 # Max-Planck-Institute for Polymer Research & Fraunhofer SCAI # # This file is part of ESPResSo++. # # ESPResSo++ is free software: you can redistribute it and/or modify # it under the terms of the G...
espressopp/espressopp
src/integrator/CapForce.py
Python
gpl-3.0
2,764
# Copyright 2008, 2009 (C) Nicira, Inc. # # This file is part of NOX. # # NOX 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. # # NO...
tlodge/homehub.nox
src/nox/netapps/switchstats/switchstats.py
Python
gpl-3.0
9,266
import copy from nose.tools import * from vcloudtools.vcloud import Link, Org, OrgList MOCK_LINK = { 'type': 'application/foo+xml', 'href': 'https://test/foo', 'rel': 'test_rel', 'name': 'foo', } MOCK_ORG = { 'type': 'application/vnd.vmware.vcloud.org+xml', 'href': 'http://test-api-client/org...
exoscale/vcloudtools
test/unit/test_vcloud.py
Python
mit
1,412
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
Azure/azure-sdk-for-python
sdk/eventhub/azure-mgmt-eventhub/azure/mgmt/eventhub/v2021_01_01_preview/aio/operations/_operations.py
Python
mit
4,822
import logging from unittest import TestCase, skipIf from hvac import exceptions from tests import utils from tests.utils.hvac_integration_test_case import HvacIntegrationTestCase class IntegrationTest(HvacIntegrationTestCase, TestCase): def setUp(self): super(IntegrationTest, self).setUp() if "s...
ianunruh/hvac
tests/integration_tests/v1/test_integration.py
Python
apache-2.0
29,744
# Name: params.py # Purpose: Classes for parameter introduction # Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be> # Created: 22.08.2001 # RCS-ID: $Id: params.py 71829 2012-06-21 19:15:52Z ROL $ ''' Visual C{Param*} classes for populating C{AtrtibutePanel} with attribute editing blocks. ...
garrettcap/Bulletproof-Backup
wx/tools/XRCed/params.py
Python
gpl-2.0
45,266
#!/usr/bin/env python # Copyright (c) 2011 X.commerce, a business unit of eBay Inc. # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may ...
abusse/cinder
cinder/cmd/manage.py
Python
apache-2.0
19,015
""" Code for managing the implementation cache. """ # Copyright (C) 2009, Thomas Leonard # See the README file for details, or visit http://0install.net. from __future__ import print_function from zeroinstall import _, logger import os from zeroinstall.support import basedir from zeroinstall import SafeException, s...
slovenwd/0install
zeroinstall/zerostore/__init__.py
Python
lgpl-2.1
13,307
from __future__ import unicode_literals import unittest import spotify import tests from tests import mock @mock.patch('spotify.image.lib', spec=spotify.lib) class ImageTest(unittest.TestCase): def setUp(self): self.session = tests.create_session_mock() spotify._session_instance = self.session ...
felix1m/pyspotify
tests/test_image.py
Python
apache-2.0
13,570
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2008-2010 Zuza Software Foundation # # This file is part of Virtaal. # # 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 ...
elric/virtaal-debian
virtaal/modes/__init__.py
Python
gpl-2.0
1,103
import smtplib import copy from email.mime.text import MIMEText from main import app, db from flask import jsonify, request from DB.User import User from DB.Reservation import Reservation from flask_jwt_extended import jwt_required, get_jwt_identity from constants import MAIL_MESSAGES, PASSWORD_MIN_LENGTH @app.route(...
patklaey/ZermattReservationAPI
endpoints/user.py
Python
mit
7,947
# Copyright 2015, 2018 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 ag...
openstack/nova
nova/tests/unit/virt/powervm/disk/test_ssp.py
Python
apache-2.0
20,150
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
lmazuel/azure-sdk-for-python
azure-mgmt-network/azure/mgmt/network/v2018_01_01/models/dhcp_options_py3.py
Python
mit
1,066
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-01-13 10:10 from __future__ import unicode_literals import re import uuid import django.core.validators import django.utils.timezone import jsonfield.fields import model_utils.fields import sortedm2m.fields from django.db import migrations, models import djan...
cosgrid001/cosgrid_dn
django_netjsonconfig/migrations/0001_initial.py
Python
gpl-3.0
3,287
# This file is part of TRS (http://math.kompiler.org) # # TRS is free software: you can redistribute it and/or modify it under the # terms of the GNU Affero General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # TRS is distrib...
smvv/trs
src/logger.py
Python
agpl-3.0
1,348
"""Library for polling dataplanes for statistics.""" # Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd. # Copyright (C) 2015--2017 The Contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
byllyfish/faucet
faucet/gauge_pollers.py
Python
apache-2.0
7,197
""" tests.pytests.unit.beacons.test_memusage ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Memory usage beacon test cases """ from collections import namedtuple import pytest import salt.beacons.memusage as memusage from tests.support.mock import MagicMock, patch @pytest.fixture def configure_loader_modules(...
saltstack/salt
tests/pytests/unit/beacons/test_memusage.py
Python
apache-2.0
2,027
import numpy as np def topicJSONmaker(malletPath): # Configuration inpath = malletPath # Insert the path to the Mallet file here num_top_words = 100 # Top N number of words in each topic that will appear in output mallet_vocab = [] word_topic_counts = [] topics = [] # Calculate the numb...
TheLady/Lexos
processors/visualize/multicloud_topic.py
Python
mit
3,532
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2013 SF Isle of Man Limited # # PyBossa is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at...
stitchfix/pybossa
test/test_api/test_category_api.py
Python
agpl-3.0
10,259
import boto.ec2 from datetime import date, timedelta,datetime from dateutil.parser import parse import csv days_counter=45 region="ap-southeast-1" class Ami: def __init__(self,ec2_ami): self.id = ec2_ami.id self.strpdate = parse(ec2_ami.creationDate).date() ## Computing Older date old = datet...
hiteshBhatia/aws-boto-scripts
amiOlderThanXDays.py
Python
apache-2.0
839
# Copyright 2009-2010 Gregory P. Ward # Copyright 2009-2010 Intelerad Medical Systems Incorporated # Copyright 2010-2011 Fog Creek Software # Copyright 2010-2011 Unity Technologies # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. '...
iaddict/mercurial.rb
vendor/mercurial/hgext/largefiles/lfcommands.py
Python
mit
21,474
''' {Underdog Militia, a text based adventure.} Copyright (C) {2015} {Michael G Zigler Jr} 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...
MrZigler/UnderdogMilitia
main.py
Python
gpl-3.0
2,475
#!/usr/bin/env python3 ####################################################################### # This file is part of JMdictDB. # Copyright (c) 2008-2012 Stuart McGraw # # JMdictDB is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published # by the F...
tatsuhirosatou/JMdictDB
python/exparse.py
Python
gpl-2.0
16,713
def foo(a_new, b_new): print(a_new + b_new * 123) def f(): a = 1 b = 1 foo(a, b)
IllusionRom-deprecated/android_platform_tools_idea
python/testData/refactoring/extractmethod/Statement.after.py
Python
apache-2.0
98
import os import pickle import signal import time from gppylib.mainUtils import * from gppylib.utils import checkNotNone, appendNewEntriesToHbaFile from gppylib.db import dbconn from gppylib import gparray, gplog from gppylib.gplog import * from gppylib.commands import unix from gppylib.commands import gp from gppyli...
foyzur/gpdb
gpMgmt/bin/gppylib/operations/buildMirrorSegments.py
Python
apache-2.0
41,655
from tinymce.widgets import TinyMCE, get_language_config from django.conf import settings from django.utils.translation import get_language from django.template.loader import render_to_string from django.utils.safestring import mark_safe from os.path import join from django.utils.encoding import smart_unicode import ti...
jalaziz/django-cms-grappelli-old
cms/plugins/text/widgets/tinymce_widget.py
Python
bsd-3-clause
3,625
# pylint: disable=bad-continuation,missing-docstring,no-self-use,invalid-name,global-statement,global-variable-not-assigned from __future__ import (absolute_import, print_function) import socket import subprocess import sys import os import logging import yaml from ooinstall.variants import find_variant from ooinstal...
zhiwliu/openshift-ansible
utils/src/ooinstall/openshift_ansible.py
Python
apache-2.0
13,004
# Legendre polynomials P_n(x) on [-1,1] for n=0,1,2,3,4 f0 = lambda x: legendre(0,x) f1 = lambda x: legendre(1,x) f2 = lambda x: legendre(2,x) f3 = lambda x: legendre(3,x) f4 = lambda x: legendre(4,x) plot([f0,f1,f2,f3,f4],[-1,1])
pducks32/intergrala
python/sympy/doc/src/modules/mpmath/plots/legendre.py
Python
mit
230
# -*- coding: utf-8 -*- """ Test output formatting for Series/DataFrame, including to_string & reprs """ from __future__ import print_function from datetime import datetime import itertools from operator import methodcaller import os import re import sys import textwrap import warnings import dateutil import numpy ...
GuessWhoSamFoo/pandas
pandas/tests/io/formats/test_format.py
Python
bsd-3-clause
110,932
class WriteAroundCacheMixin(object): cache_modes = {'*': 'standard'} def get_context_data(self, *args, **kwargs): context = super(WriteAroundCacheMixin, self).get_context_data(*args, **kwargs) context['cache_modes'] = self.cache_modes return context
gizmag/django-write-around-cache
django_write_around_cache/view_mixins.py
Python
mit
283
# -*- coding: utf8 -*- """ Script baseado no arquivo decorators.py do django 1.3. Ele foi copiado para usar o decorador ``login_required`` que possui o argumento ``login_url``, responsável por redirecionar ao template de login desejado. No ato de atualizar o framework, esse script torna-se obsoleto. """ import urlpa...
brenotx/SIGI-1.6
sigi/apps/utils/decorators.py
Python
gpl-2.0
2,697
#!/usr/bin/python # # Test for tempfile creation # Use lsof to see how many open files we have # import sys import os import glob sys.path.append('..') from rhn.SmartIO import _tempfile def t(): f = _tempfile() for i in range(1024): f.write(("%s" % (i % 10)) * 1023 + "\n") f.seek(0, 2) assert...
aronparsons/spacewalk
client/rhel/rhnlib/test/10-tempfile.py
Python
gpl-2.0
1,289
# # #------------------------------------------------------------------------------ # Copyright (C) 2006-2009 University of Dundee. 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 Softw...
hflynn/openmicroscopy
components/tools/OmeroPy/src/omero/util/script_utils.py
Python
gpl-2.0
44,494
from app.controller.weather import Weather from json import dumps api = 'v3/location/search' params = {'query' : 'Atlanta', 'locationType' : 'city', 'countryCode' : 'US', 'adminDistrictCode' : 'GA'} weather = Weather(username='ad6fbabc-d710-4126-8764-3a12d5a85096', password='onPrMLvFGk', params=params, api_url=api) pri...
weizy1981/WatsonRobot
run/runWeather.py
Python
apache-2.0
607
import json import threading import os import re import tornado.autoreload import tornado.ioloop import tornado.web from api_python_library.tools import config, api class ItemsHandler(tornado.web.RequestHandler): def data_received(self, chunk): pass def get(self, *args, **kwargs): # items G...
SuderPawel/api-python-library
src/api_python_library/examples/main.py
Python
mit
3,029
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2017-01-07 23:02 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('django_tasker', '0004_auto_20170102_1510'), ] operations = [ migrations.AlterIndexT...
wooyek/django-tasker
django_tasker/migrations/0005_auto_20170107_2302.py
Python
mit
506
from setuptools import setup description = 'Ask not what $ORG can do for you, but what you can do for $ORG' setup( name='asknot-ng', version='1.0', description=description, license='GPLv3+', author='Ralph Bean', author_email='rbean@redhat.com', url='https://github.com/fedora-infra/asknot-n...
fedora-infra/asknot-ng
setup.py
Python
gpl-3.0
885
import json import time import settings from datetime import datetime from shared import common from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTShadowClient handler = None send_interval = 60 # in seconds doorpi_update_topic = '$aws/things/DoorPi/shadow/update/accepted' def init(): global handler if settings.is...
royveshovda/pifog
source/piclient/statuspi/status_runner.py
Python
apache-2.0
5,635
# This file is part of Indico. # Copyright (C) 2002 - 2021 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from flask import jsonify, session from marshmallow import INCLUDE, fields from marshmallow_enum import En...
pferreir/indico
indico/modules/search/controllers.py
Python
mit
2,694
#!/usr/bin/python # # Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
coxmediagroup/googleads-python-lib
examples/adwords/v201502/basic_operations/get_campaigns_with_awql.py
Python
apache-2.0
2,056
# coding: utf-8 from pww.crypto import Cipher def test_plaintext_should_equal_decrypted_text(): cipher = Cipher(b"password", b"saltlsalt") plain = "sample text サンプル テキスト".encode() encrypted = cipher.encrypt(plain) decrypted = cipher.decrypt(encrypted) assert plain == decrypted def test_differe...
meganehouser/pww
test/test_crypto.py
Python
mit
970
# -*- coding: utf-8 -*- from __future__ import (unicode_literals, absolute_import, print_function, division) from copy import deepcopy from itertools import combinations class Cell: def __init__(self): self.value = 0 self.row = set() self.col = set() self.sq = set() self....
albatros69/Divers
sudoku.py
Python
gpl-3.0
11,551
from __future__ import absolute_import from typing import Any, Optional, Text import logging import re from email.header import decode_header import email.message as message from django.conf import settings from zerver.lib.actions import decode_email_address, get_email_gateway_message_string_from_address, \ int...
sonali0901/zulip
zerver/lib/email_mirror.py
Python
apache-2.0
12,924
#!/usr/bin/env python from flask import Flask from nose.tools import eq_, raises from kit.util import * def test_uncamelcase(): eq_(uncamelcase('CalvinAndHobbes'), 'calvin_and_hobbes') class Test_Cacheable(object): def setup(self): class Example(Cacheable): @Cacheable.cached_property def nu...
mtth/kit
kit/test/test_util.py
Python
mit
3,867
from horizon.test import helpers as test class BandwidthTests(test.TestCase): # Unit tests for bandwidth. def test_me(self): self.assertTrue(1 + 1 == 2)
jorik041/shmoocon_2014_talk
caravan/caravan/dashboards/infrastructure/bandwidth/tests.py
Python
bsd-2-clause
171
# Copyright 2011 the Melange 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...
rhyolight/nupic.son
app/soc/views/org_app.py
Python
apache-2.0
9,576
"""Defines methods that call the unversioned Mesos HTTP endpoints""" from __future__ import unicode_literals from node.resources.node_resources import NodeResources from node.resources.resource import ScalarResource from util.dcos import make_dcos_request def get_agent_resources(master, agent_ids): """Returns th...
ngageoint/scale
scale/mesos_api/unversioned/agent.py
Python
apache-2.0
1,202
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-24 20:36 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.Crea...
moniquehw/quoterizer
quotes/migrations/0001_initial.py
Python
gpl-3.0
1,134
import numpy as np class AxisOrder: """Define the order of spatial axes. Default: x first""" def __init__(self): self.is_x_first = False self.x = 0 self.y = 0 self.z = 0 self.x_first() def x_first(self): self.is_x_first = True self.x, self.y, self....
tum-pbs/PhiFlow
phi/math/_config.py
Python
mit
862
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
saltstar/spark
python/pyspark/sql/session.py
Python
apache-2.0
32,651
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
dhuang/incubator-airflow
airflow/providers/docker/example_dags/example_docker_copy_data.py
Python
apache-2.0
3,524
# Volume import SMESH_mechanic_tetra import SMESH smesh = SMESH_mechanic_tetra.smesh mesh = SMESH_mechanic_tetra.mesh salome = SMESH_mechanic_tetra.salome # Criterion : VOLUME < 7. volume_margin = 7. aFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_Volume3D, SMESH.FT_LessThan, volume_margin) anIds = mesh.GetIds...
FedoraScientific/salome-smesh
doc/salome/examples/quality_controls_ex21.py
Python
lgpl-2.1
690
import database as d import numpy as np import random from transitions import Machine #Conversations are markov chains. Works as follows: a column vector for each CURRENT state j, a row vector for each TARGET state i. #Each entry i,j = the probability of moving to state i from state j. #target state D = end of convers...
markemus/economy
conversation.py
Python
mit
18,547
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/ # # Copyright (c) 2008 - 2014 by Wilbert Berendsen # # 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 2 ...
anthonyfok/frescobaldi
frescobaldi_app/mainwindow.py
Python
gpl-2.0
50,862
""" A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abs...
hkbakke/fwgen
setup.py
Python
mit
4,104
#!/usr/bin/env python3 """Find similar words to query term.""" import hashlib import os import unicodedata from philologic.Query import get_expanded_query from Levenshtein import ratio def get_all_words(db, request): """Expand query to all search terms.""" words = request["q"].replace('"', "") hits = d...
ARTFL-Project/PhiloLogic5
python/philologic/runtime/find_similar_words.py
Python
gpl-3.0
2,263
import numpy as np from numba import cuda @cuda.jit(debug=True) def histogram(x, xmin, xmax, histogram_out): nbins = histogram_out.shape[0] bin_width = (xmax - xmin) / nbins start = cuda.grid(1) stride = cuda.gridsize(1) for i in range(start, x.shape[0], stride): bin_number = np.int32((x...
fluxcapacitor/source.ml
jupyterhub.ml/src/main/python/numba/histogram.py
Python
apache-2.0
789
import website_sale_product_tags_models
Endika/website-addons
website_sale_product_tags/__init__.py
Python
lgpl-3.0
40
#!/usr/bin/python # Copyright (C) 2007 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 o...
jonpetersen/transitfeed-1.2.12
build/scripts-2.7/unusual_trip_filter.py
Python
apache-2.0
5,999
# MIT licensed # Copyright (c) 2020-2021 DDoSolitary <DDoSolitary@gmail.com>, et al. from nvchecker.api import GetVersionError from pyalpm import Handle async def open_db(info): dbpath, repo = info handle = Handle('/', dbpath) db = handle.register_syncdb(repo, 0) return handle, db async def get_version(nam...
lilydjwg/nvchecker
nvchecker_source/alpm.py
Python
mit
1,200
# Copyright 2022 ForgeFlow - Joan Mateu # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import test_sale_contract
OCA/contract
contract_sale/tests/__init__.py
Python
agpl-3.0
143
#!/usr/bin/env python ####################################################### # Copyright (c) 2015, ArrayFire # All rights reserved. # # This file is distributed under 3-clause BSD license. # The complete license agreement can be obtained at: # http://arrayfire.com/licenses/BSD-3-Clause ###############################...
arrayfire/arrayfire-python
tests/simple/random.py
Python
bsd-3-clause
1,182
#!/usr/bin/python # # \file config.py # \brief Process configuration # \date 2010-08-27 17:02GMT # \author Jan Boon (Kaetemi) # Python port of game data build pipeline. # Process configuration. # # NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/> # Copyright (C) 2010 Winch Gate Property Limited # # This p...
osgcc/ryzom
ryzom/tools/build_gamedata/workspace/common/construction/process.py
Python
agpl-3.0
2,956
import os import fnmatch from pipa import PipelineItem class FindInPath(PipelineItem): def __init__(self, *args, **kwargs): super(FindInPath, self).__init__(*args, **kwargs) self.name='find_in_remote_path' self.tuple_name = 'find_in_remote_path' self.tuple_fields = 'con...
pokerone/pipa
pipa/system/remote/find_in_path.py
Python
bsd-3-clause
758
# Copyright (c) 2014 Intel, 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 ...
dims/nova
nova/scheduler/filters/metrics_filter.py
Python
apache-2.0
1,998
import django from django.contrib.admin.checks import InlineModelAdminChecks as BaseInlineModelAdminChecks def get_empty_value_display(model_admin): if django.VERSION >= (1, 9): return model_admin.get_empty_value_display() else: from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALU...
jamieconnolly/django-lazy-choices
src/lazychoices/compat.py
Python
mit
958
# Copyright 2014-2015 Insight Software Consortium. # Copyright 2004-2008 Roman Yakovenko. # Distributed under the Boost Software License, Version 1.0. # See http://www.boost.org/LICENSE_1_0.txt import os import platform from . import linker from . import config from . import patcher import subprocess import pygccxml.u...
CIBC-Internal/itk
Modules/ThirdParty/pygccxml/src/pygccxml/parser/source_reader.py
Python
apache-2.0
22,365
# Generated by Django 2.0.6 on 2018-06-21 14:26 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [("papers", "0020_auto_20180621_1426")] operations = [ migrations.AddField( model_name="paper", nam...
arxiv-vanity/arxiv-vanity
arxiv_vanity/papers/migrations/0021_paper_source_file.py
Python
apache-2.0
562
#File: default.py """ Provides a default style for bib4txt.py Produces a list of citations that to be included in a reStructuredText document. (In very simple documents, can also provide citation reference formatting by substituting in the document text for the citation references.) A style includes: - citation templ...
matthew-brett/bibstuff
bibstuff/bibstyles/default.py
Python
mit
4,900
import functools import json import logging import random import re import string import fnmatch import unicodedata import urllib from textwrap import dedent from external_auth.models import ExternalAuthMap from external_auth.djangostore import DjangoOpenIDStore from django.conf import settings from django.contrib.au...
jbzdak/edx-platform
common/djangoapps/external_auth/views.py
Python
agpl-3.0
36,622
from sympy import integrate, Rational, sqrt, Symbol from sympy.physics.units import (au, amu, charge, day, find_unit, foot, km, m, meter, minute, s, speed_of_light, grams, quart, inch) def test_units(): assert (5*m/s * day) / km == 432 assert f...
lidavidm/mathics-heroku
venv/lib/python2.7/site-packages/sympy/physics/tests/test_units.py
Python
gpl-3.0
1,062
from __future__ import absolute_import from .selector import *
boooka/GeoPowerOff
venv/lib/python2.7/site-packages/grab/selector/__init__.py
Python
apache-2.0
63
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import logging import traceback from google.appengine.api import users import webapp2 from shared import utils from shared.config import AUTO_T...
nicko96/Chrome-Infra
appengine/chromium_cq_status/handlers/post.py
Python
bsd-3-clause
2,369
from gevent import monkey monkey.patch_all() from gevent.server import StreamServer from multiprocessing import Process, current_process from hashlib import sha256 import socket import pickle import pyshark from sys import argv from flask import Flask, render_template from flask_socketio import SocketIO app = Flask(...
shieldwed/package-viewer
packageviewer/app.py
Python
mit
2,475
""" Test for RFlink sensor components. Test setup of rflink sensor component/platform. Verify manual and automatic sensor creation. """ from datetime import timedelta from homeassistant.components.rflink import CONF_RECONNECT_INTERVAL from homeassistant.const import ( EVENT_STATE_CHANGED, STATE_OFF, STATE...
tchellomello/home-assistant
tests/components/rflink/test_binary_sensor.py
Python
apache-2.0
5,889
# -*- coding: utf-8 -*- # Copyright 2019 OpenSynergy Indonesia # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models class HrPromotionTransition(models.Model): _name = "hr.promotion_transition" _inherit = ["hr.promotion_transition", "hr.career_transition"]
open-synergy/opnsynid-hr
hr_promotion_transition_timesheet_computation/models/hr_promotion_transition.py
Python
agpl-3.0
310
# Mantid Repository : https://github.com/mantidproject/mantid # # Copyright &copy; 2018 ISIS Rutherford Appleton Laboratory UKRI, # NScD Oak Ridge National Laboratory, European Spallation Source # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + """ Defines the main State object.""" # pyli...
mganeva/mantid
scripts/SANS/sans/state/state.py
Python
gpl-3.0
5,932
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # Copyright (c) 2017 Digi International Inc. All Rights Reserved. from digi.xbee.models.mode import OperatingMode from...
diescalo/rst_test
digi/xbee/packets/common.py
Python
mpl-2.0
96,238
from django.contrib.auth.decorators import permission_required from django.contrib.auth import logout from django.conf import settings from django.http import HttpResponse, JsonResponse, Http404 from django.shortcuts import render, reverse, get_object_or_404 import yaml from mittab.apps.tab.archive import ArchiveExpor...
jolynch/mit-tab
mittab/apps/tab/views.py
Python
mit
14,458
#!/usr/bin/env python #-*- coding: utf-8 -*- from dbconf import * import database as db import os import re confs = db.query("""SELECT domains.name, websites.config, users.login FROM domains, websites, users WHERE domains.id = websites.id_domains AND users.id = websites.id_users AND websites.enabled = 'yes'""") ...
sr/beadmin
lighttpd-mysql-config.py
Python
gpl-3.0
815