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
chawins/aml
lib/RandomEnhance.py
1
2811
import random import numpy as np from PIL import Image, ImageEnhance class RandomEnhance(): """ Class to randomly enhance image by adjusting color, contrast, sharpness and brightness """ def __init__(self, seed=None, p=1.0, intensity=0.5): """ Initialises an instance. Pa...
mit
ramanajee/phantomjs
src/qt/qtwebkit/Tools/TestResultServer/generate_builders_json_unittest.py
119
5404
#!/usr/bin/env python # Copyright (C) 2012 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 ...
bsd-3-clause
cloud9ers/gurumate
environment/lib/python2.7/site-packages/gurumate-2.8.6-py2.7.egg/gurumate/linux2/apt.py
2
2541
import subprocess import shlex, re import os from subprocess import CalledProcessError from datetime import * def find(name): ''' returns a list of tuples (package_name, description) for apt-cache search results ''' cmd = 'apt-cache search %s' % name args = shlex.split(cmd) try: out...
lgpl-3.0
ncoop/i3pystatus
i3pystatus/scores/epl.py
11
16454
from i3pystatus.core.util import internet, require from i3pystatus.scores import ScoresBackend import copy import pytz import time from collections import namedtuple from datetime import datetime LIVE_URL = 'http://live.premierleague.com/#/gameweek/%s/matchday/%s/match/%s' CONTEXT_URL = 'http://live.premierleague.com...
mit
davidsminor/cortex
python/IECore/DateTimeParameterParser.py
17
3019
########################################################################## # # Copyright (c) 2009-2012, Image Engine Design 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: # # * Redis...
bsd-3-clause
inspirehep/json-merger
json_merger/__init__.py
1
16680
# -*- coding: utf-8 -*- # # This file is part of Inspirehep. # Copyright (C) 2016 CERN. # # Inspirehep 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...
gpl-2.0
PGer/incubator-hawq
tools/bin/gppylib/gpsubprocess.py
9
7623
#!/usr/bin/env python # # Copyright (c) Greenplum Inc 2008. All Rights Reserved. # """ The gpsubprocess is a subclass of subprocess that allows for non-blocking processing of status and servicing of stdout and stderr. Also the aim was to reduce the overhead associated with this servicing. Normal subprocess.communi...
apache-2.0
richardbeare/SimpleITK
Utilities/GenerateDocs/GenerateDoc.py
4
9500
#!/usr/bin/env python from __future__ import print_function import os import sys import io import json import re import getopt from lxml import etree from collections import OrderedDict # # This script updates the documentation of a SimpleITK class in its # JSON file. The documentation is pulled from the correpso...
apache-2.0
YannickB/odoo-hosting
clouder_template_drupal/__manifest__.py
1
1507
# -*- coding: utf-8 -*- ############################################################################## # # Author: Yannick Buron # Copyright 2015, TODAY Clouder SASU # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License with Attribution # ...
agpl-3.0
obulpathi/poppy
tests/unit/common/test_decorators.py
4
1517
# Copyright (c) 2014 Rackspace, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
apache-2.0
asnorkin/sentiment_analysis
site/lib/python2.7/site-packages/sklearn/feature_selection/variance_threshold.py
123
2572
# Author: Lars Buitinck # License: 3-clause BSD import numpy as np from ..base import BaseEstimator from .base import SelectorMixin from ..utils import check_array from ..utils.sparsefuncs import mean_variance_axis from ..utils.validation import check_is_fitted class VarianceThreshold(BaseEstimator, SelectorMixin): ...
mit
SUNET/eduid-signup
eduid_signup/session.py
1
1724
from zope.interface import implementer from pyramid.interfaces import ISessionFactory, ISession from eduid_common.session.pyramid_session import SessionFactory as CommonSessionFactory from eduid_common.session.pyramid_session import Session as CommonSession import logging logger = logging.getLogger(__name__) _EDIT_U...
bsd-3-clause
the-adrian/KernotekV2.0
venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py
305
4235
from binascii import hexlify, unhexlify from hashlib import md5, sha1 from ..exceptions import SSLError try: # Test for SSL features SSLContext = None HAS_SNI = False import ssl from ssl import wrap_socket, CERT_NONE, PROTOCOL_SSLv23 from ssl import SSLContext # Modern SSL? from ssl import...
gpl-3.0
SteveHNH/ansible
lib/ansible/modules/windows/win_rabbitmq_plugin.py
47
1412
#!/usr/bin/python # Copyright (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- modul...
gpl-3.0
peterfeiner/wcp
wcp/cli.py
1
4339
# Copyright (C) 2014 Peter Feiner import argparse import sys import os import signal from . import record from . import report SIGNALS = {} for name in dir(signal): if name.startswith('SIG') and not name.startswith('SIG_'): SIGNALS[name] = getattr(signal, name) def parse_signal(string): if string ...
gpl-2.0
ralph-group/pymeasure
pymeasure/display/windows.py
1
37114
# # This file is part of the PyMeasure package. # # Copyright (c) 2013-2021 PyMeasure Developers # # 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 limit...
mit
resmo/ansible
test/units/modules/network/netscaler/test_netscaler_service.py
68
14309
# Copyright (c) 2017 Citrix Systems # # 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. # # ...
gpl-3.0
DIYBookScanner/spreads
tests/gui_test.py
5
1886
import mock import pytest pytestmark = pytest.mark.guitest @pytest.yield_fixture def mock_msgbox(): with mock.patch('spreadsplug.gui.gui.QtGui.QMessageBox') as msgbox: msgbox.exec_.return_value = True yield msgbox @pytest.fixture def wizard(config): import spreadsplug.gui.gui as gui wiza...
agpl-3.0
GenericStudent/home-assistant
homeassistant/components/template/alarm_control_panel.py
7
8475
"""Support for Template alarm control panels.""" import logging import voluptuous as vol from homeassistant.components.alarm_control_panel import ( ENTITY_ID_FORMAT, FORMAT_NUMBER, PLATFORM_SCHEMA, AlarmControlPanelEntity, ) from homeassistant.components.alarm_control_panel.const import ( SUPPORT_...
apache-2.0
openstack/tripleo-heat-templates
tripleo_heat_templates/tests/test_environment_generator.py
1
18885
# Copyright 2015 Red Hat Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
apache-2.0
t11e/django
django/core/cache/backends/filebased.py
1
4639
"File-based cache backend" import os import time import shutil try: import cPickle as pickle except ImportError: import pickle from django.core.cache.backends.base import BaseCache from django.utils.hashcompat import md5_constructor class CacheClass(BaseCache): def __init__(self, dir, params): Ba...
bsd-3-clause
Wikidata/StrepHit
doc/update_doc.py
1
3071
import requests import click import subprocess import os class WikimediaApi: logged_in = False def __init__(self, endpoint='https://www.mediawiki.org/w/api.php'): self.session = requests.Session() self.api_endpoint = endpoint def call_api(self, action, **kwargs): r = self.session...
gpl-3.0
mshuler/cassandra
pylib/cqlshlib/test/test_cqlsh_completion.py
8
42447
# 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 u...
apache-2.0
ESS-LLP/erpnext-medical
erpnext/patches/v7_0/rename_prevdoc_fields.py
43
3368
import frappe import json from frappe.model.utils.rename_field import update_reports, rename_field, update_property_setters from frappe.custom.doctype.property_setter.property_setter import make_property_setter def execute(): frappe.reload_doctype('Purchase Order Item') frappe.reload_doctype('Purchase Receipt Item')...
gpl-3.0
ltilve/chromium
third_party/jinja2/parser.py
637
35186
# -*- coding: utf-8 -*- """ jinja2.parser ~~~~~~~~~~~~~ Implements the template parser. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ from jinja2 import nodes from jinja2.exceptions import TemplateSyntaxError, TemplateAssertionError from jinja2.lexer impo...
bsd-3-clause
larrybradley/astropy
astropy/coordinates/tests/test_geodetic_representations.py
8
4556
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test geodetic representations""" import pytest from numpy.testing import assert_array_equal from astropy.coordinates.representation import CartesianRepresentation from astropy.coordinates.earth import ( WGS84GeodeticRepresentation, GRS80Geode...
bsd-3-clause
kenshay/ImageScripter
ProgramData/SystemFiles/Python/Lib/site-packages/dask/array/chunk.py
2
11808
""" A set of NumPy functions to apply per chunk """ from __future__ import absolute_import, division, print_function from functools import wraps from toolz import concat import numpy as np from . import numpy_compat as npcompat from ..compatibility import getargspec, Container, Iterable, Sequence from ..core import ...
gpl-3.0
ammubhave/dropboxfs
dropbox-python-sdk-2.2.0/example/datastore_app/tasks.py
6
7334
"""A simple tasks manager using the Dropbox Datastore API. This example requires Python 2.7 (for OrderedDict). This uses the same data model as the JavaScript tutorial example. The code is somewhat uncharacteristic for Flask apps (e.g. it doesn't use template files). The advantage of this style is that the entire a...
gpl-2.0
thresholdsoftware/asylum
openerp/service/__init__.py
56
5578
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2010-2013 OpenERP SA (<http://www.openerp.com>) # # This program is free software: you c...
agpl-3.0
ricardogsilva/QGIS
python/plugins/processing/algs/grass7/ext/r_colors.py
36
3517
# -*- coding: utf-8 -*- """ *************************************************************************** r_colors.py ----------- Date : February 2016 Copyright : (C) 2016 by MΓ©dΓ©ric Ribreux Email : medspx at medspx dot fr ************************************...
gpl-2.0
Bachaco-ve/odoo
addons/decimal_precision/__init__.py
450
1128
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of t...
agpl-3.0
TeamWorkQualityReport/TeamWorkQualityReport
Backend/Analise/Analisador.py
1
9696
import numpy as np from Analise.IAnalisador import IAnalisador from Analise.entidades.formulario import Formulario from Analise.entidades.variavel import Variavel from Analise.entidades.questao import Questao from Analise.entidades.relatorioResultado import RelatorioResultado from Analise.entidades.constructo import C...
gpl-3.0
TheoRettisch/p2pool-giarcoin
p2pool/test/util/test_math.py
283
1198
from __future__ import division import random import unittest from p2pool.util import math def generate_alphabet(): if random.randrange(2): return None else: a = map(chr, xrange(256)) random.shuffle(a) return a[:random.randrange(2, len(a))] class Test(unittest.TestCase): ...
gpl-3.0
PurityROM/platform_external_gtest
test/gtest_shuffle_test.py
3023
12549
#!/usr/bin/env python # # Copyright 2009 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 of...
bsd-3-clause
837468220/python-for-android
python3-alpha/python3-src/Lib/encodings/mac_turkish.py
272
13513
""" Python Character Mapping Codec mac_turkish generated from 'MAPPINGS/VENDORS/APPLE/TURKISH.TXT' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_table) def decode(self,input...
apache-2.0
cronuspaas/cronusagent
agent/agent/lib/agent_thread/download_thread.py
1
13166
#pylint: disable=W0703,W0511,W0402,R0911,R0915,R0912,W0331,W0612,R0904,W0105 """ Thread to download a package """ from agent.lib import utils, contextutils, configutil from agent.lib.agent_thread.agent_thread import AgentThread from agent.lib.errors import Errors, FileNotFoundError, AgentException from agent.lib.packa...
apache-2.0
algorhythms/LeetCode
283 Move Zeroes.py
1
1204
""" Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non- zero elements. For example, given nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3, 12, 0, 0]. Note: You must do this in-place without making a copy of the array. Minim...
mit
habnabit/pip
pip/_vendor/distlib/_backport/tarfile.py
1005
92627
#------------------------------------------------------------------- # tarfile.py #------------------------------------------------------------------- # Copyright (C) 2002 Lars Gustaebel <lars@gustaebel.de> # All rights reserved. # # Permission is hereby granted, free of charge, to any person # obtaining a copy ...
mit
almlab/SmileTrain
tools/get_taxonomies.py
1
2955
#!/usr/bin/env python ''' Get greengenes taxonomies. Given an otu table with otu ids in the first column, search through the greengenes taxonomy list. Output the taxonomies in order. If the input database is a pickle, just load that dictionary. ''' import sys, argparse, re, cPickle as pickle def table_ids(fn): ...
mit
richardtran415/pymatgen
pymatgen/analysis/diffraction/xrd.py
4
11153
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ This module implements an XRD pattern calculator. """ import json import os from math import asin, cos, degrees, pi, radians, sin import numpy as np from pymatgen.symmetry.analyzer import SpacegroupAnaly...
mit
jimsize/PySolFC
pysollib/tk/tkhtml.py
1
4931
#!/usr/bin/env python # -*- mode: python; coding: utf-8; -*- # --------------------------------------------------------------------------- # # Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer # Copyright (C) 2003 Mt. Hood Playing Card Co. # Copyright (C) 2005-2009 Skomoroh # # This program is free software...
gpl-3.0
mapleoin/braintree_python
tests/unit/test_customer.py
2
2928
from tests.test_helper import * class TestCustomer(unittest.TestCase): def test_create_raise_exception_with_bad_keys(self): try: Customer.create({"bad_key": "value"}) self.assertTrue(False) except KeyError as e: self.assertEquals("'Invalid keys: bad_key'", str(e)...
mit
ajaybhat/scikit-image
skimage/feature/_hog.py
12
8240
from __future__ import division import numpy as np from .._shared.utils import assert_nD from . import _hoghistogram import warnings def hog(image, orientations=9, pixels_per_cell=(8, 8), cells_per_block=(3, 3), visualise=False, transform_sqrt=False, feature_vector=True, normalise=None): """Extrac...
bsd-3-clause
scality/cinder
cinder/brick/local_dev/lvm.py
4
30849
# Copyright 2013 OpenStack Foundation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
apache-2.0
oscar810429/mysql-5.6_facebook
xtrabackup/test/python/testtools/content_type.py
42
1111
# Copyright (c) 2009-2010 testtools developers. See LICENSE for details. """ContentType - a MIME Content Type.""" class ContentType(object): """A content type from http://www.iana.org/assignments/media-types/ :ivar type: The primary type, e.g. "text" or "application" :ivar subtype: The subtype, e.g. "pl...
gpl-2.0
guettli/django
tests/custom_pk/tests.py
55
7465
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import IntegrityError, transaction from django.test import TestCase, skipIfDBFeature from django.utils import six from .models import Bar, Business, Employee, Foo class BasicCustomPKTests(TestCase): @classmethod def setUpTestData...
bsd-3-clause
jeremiahmarks/dangerzone
scripts/python/remoteAccessScripts/dirTree.py
1
2490
#this script will mount a remote file system using fuse and then generate a #directory tree using os.walk #TODO: for some reason the files that are on the top level all have a double slash # I know that it is due to the line: # k.write('{}{}/{}'.format(subindent,root.replace(startpath, 'http://jlmarks...
mit
martinrusev/amonone
amon/apps/alerts/models/mute.py
2
2138
from datetime import datetime, timedelta from amon.apps.core.basemodel import BaseModel from amon.utils.dates import datetime_to_unixtime from amon.apps.tags.models import tags_model from amon.apps.servers.models import server_model class AlertMuteServersModel(BaseModel): def __init__(self): super(AlertM...
mit
eLvErDe/nicotine-plus
test/unit/test_login.py
1
2247
__author__ = 'Lene Preuss <lene.preuss@gmail.com>' from queue import Queue from time import sleep from unittest.mock import Mock, MagicMock import pytest from pynicotine.slskproto import SlskProtoThread from pynicotine.slskmessages import ServerConn, Login, SetWaitPort from pynicotine.utils import ApplyTranslation f...
gpl-3.0
GustavoHennig/ansible
lib/ansible/modules/cloud/openstack/os_ironic_inspect.py
27
6027
#!/usr/bin/python # coding: utf-8 -*- # (c) 2015-2016, Hewlett Packard Enterprise Development Company LP # # This module 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 # (...
gpl-3.0
hyller/CodeLibrary
python-cookbook-master/src/8/extending_a_property_in_a_subclass/example2.py
2
1089
# Example of managed attributes via properties class String: def __init__(self, name): self.name = name def __get__(self, instance, cls): if instance is None: return self return instance.__dict__[self.name] def __set__(self, instance, value): if not isinstance(v...
unlicense
russelmahmud/mess-account
django/core/mail/backends/base.py
660
1164
"""Base email backend class.""" class BaseEmailBackend(object): """ Base class for email backend implementations. Subclasses must at least overwrite send_messages(). """ def __init__(self, fail_silently=False, **kwargs): self.fail_silently = fail_silently def open(self): """Op...
bsd-3-clause
spoonysonny/SAKS-tutorials
chengying/sakspins.py
1
1183
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2016 NXEZ.COM. # http://www.nxez.com # # Licensed under the GNU General Public 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.gnu.org/licen...
gpl-2.0
leppa/home-assistant
homeassistant/components/volumio/media_player.py
1
9924
""" Volumio Platform. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/media_player.volumio/ Volumio rest API: https://volumio.github.io/docs/API/REST_API.html """ import asyncio from datetime import timedelta import logging import socket import aiohttp ...
apache-2.0
shizhai/wprobe
build_dir/host/u-boot-2013.07-rc1/board/pxa255_idp/pxa_reg_calcs.py
267
11108
#!/usr/bin/python # (C) Copyright 2004 # BEC Systems <http://bec-systems.com> # Cliff Brake <cliff.brake@gmail.com> # 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 Li...
gpl-2.0
clausqr/HTPC-Manager
libs/cherrypy/test/test_bus.py
17
9028
import threading import time import unittest import cherrypy from cherrypy._cpcompat import get_daemon, set from cherrypy.process import wspbus msg = "Listener %d on channel %s: %s." class PublishSubscribeTests(unittest.TestCase): def get_listener(self, channel, index): def listener(arg=None): ...
mit
zenodo/invenio
invenio/modules/authors/__init__.py
17
1069
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2014 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...
gpl-2.0
mahak/ansible
test/support/integration/plugins/inventory/foreman.py
13
12170
# -*- coding: utf-8 -*- # Copyright (C) 2016 Guido GΓΌnther <agx@sigxcpu.org>, Daniel Lobato Garcia <dlobatog@redhat.com> # Copyright (c) 2018 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __...
gpl-3.0
40223125/40223125-2
static/Brython3.1.0-20150301-090019/Lib/ui/dialog.py
607
4994
from . import widget from browser import html, document class Dialog(widget.DraggableWidget): def __init__(self, id=None): self._div_shell=html.DIV( Class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-draggable ui-resizable", style={'position': 'absolute', 'height': 'auto',...
gpl-3.0
sebalix/OpenUpgrade
addons/mrp/wizard/mrp_product_produce.py
168
6150
# -*- 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
dgu-dna/DNA-Bot
apps/quiz.py
1
7875
from apps.decorators import on_command from apps.slackutils import cat_token, isNumber, get_nickname from time import localtime, strftime import os import re import json import time import urllib import random CACHE_DEFAULT_URL = './apps/quiz_cache/' CACHE_CATEGORY_URL = './apps/quiz_cache/category/' def get_random_q...
mit
veger/ansible
lib/ansible/modules/cloud/azure/azure_rm_cdnprofile_facts.py
7
7660
#!/usr/bin/python # # Copyright (c) 2018 Hai Cao, <t-haicao@microsoft.com>, Yunge Zhu <yungez@microsoft.com> # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metada...
gpl-3.0
PawlukDesarrollo/pyafipws.web2py-app
controllers/abm.py
12
2557
# -*- coding: utf-8 -*- """ Copyright 2011 Alan Etkin, spametki@gmail.com. Este programa se distribuye bajo los tΓ©rminos de la licencia AGPLv3. This program is free software: you can redistribute it and/or modify it under the terms of the Affero GNU General Public License as published by the Free Software Foundation...
agpl-3.0
gtara/or-tools
examples/python/secret_santa.py
34
3832
# Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com # # 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
WillisXChen/django-oscar
oscar/lib/python2.7/site-packages/debug_toolbar/settings.py
1
8768
from __future__ import absolute_import, unicode_literals import warnings from django.conf import settings from django.utils import six from debug_toolbar.compat import import_module # Always import this module as follows: # from debug_toolbar import settings [as dt_settings] # Don't import directly CONFIG or PANE...
bsd-3-clause
reinaH/osf.io
tests/api_tests/nodes/test_views.py
4
64137
# -*- coding: utf-8 -*- import mock import urlparse from nose.tools import * # flake8: noqa from website.models import Node from framework.auth.core import Auth from website.util.sanitize import strip_html from api.base.settings.defaults import API_BASE from website.settings import API_DOMAIN from tests.base import ...
apache-2.0
dgsantana/arsenalsuite
python/blur/email.py
11
1834
#import email.MIMEText import smtplib # Have to load these like this, because this module is # called email MIMEText = __import__('email.MIMEText').MIMEText.MIMEText MIMEMultipart = __import__('email.MIMEMultipart').MIMEMultipart.MIMEMultipart MIMEBase = __import__('email.MIMEBase').MIMEBase.MIMEBase Encoders = __impo...
gpl-2.0
Molecular-Image-Recognition/Molecular-Image-Recognition
code/rmgpy/molecule/draw.py
1
72901
#!/usr/bin/env python # encoding: utf-8 ################################################################################ # # RMG - Reaction Mechanism Generator # # Copyright (c) 2002-2017 Prof. William H. Green (whgreen@mit.edu), # Prof. Richard H. West (r.west@neu.edu) and the RMG Team (rmg_dev@mit.edu) # # ...
mit
alhashash/odoo
addons/account_test/account_test.py
8
2167
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved. # # $Id: product_expiry.py 4304 2006-10-25 09:54:51Z ged $ # # WARNING: This program as such is intended to be used by professional # prog...
agpl-3.0
maohongyuan/kbengine
kbe/res/scripts/common/Lib/wsgiref/simple_server.py
86
5153
"""BaseHTTPServer that implements the Python WSGI protocol (PEP 3333) This is both an example of how WSGI can be implemented, and a basis for running simple web applications on a local machine, such as might be done when testing or debugging an application. It has not been reviewed for security issues, however, and w...
lgpl-3.0
SeveQ/OctoPrint
src/octoprint/printer/standard.py
13
30961
# coding=utf-8 """ This module holds the standard implementation of the :class:`PrinterInterface` and it helpers. """ from __future__ import absolute_import __author__ = "Gina HÀußge <osd@foosel.net>" __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html' __copyright__ = "Copyright (C...
agpl-3.0
Inspq/ansible
lib/ansible/modules/web_infrastructure/htpasswd.py
1
9184
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2013, Nimbis Services, Inc. # # 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 # (...
gpl-3.0
pavanvidem/tools-iuc
tools/query_tabular/sqlite_to_tabular.py
22
2117
#!/usr/bin/env python from __future__ import print_function import optparse import os.path import sys from query_db import describe_tables, get_connection, run_query def __main__(): # Parse Command Line parser = optparse.OptionParser() parser.add_option('-s', '--sqlitedb', dest='sqlitedb', default=None...
mit
monikasulik/django-oscar
tests/integration/offer/tax_tests.py
60
1873
from decimal import Decimal as D from django.test import TestCase from oscar.apps.offer import models from oscar.apps.basket.models import Basket from oscar.apps.partner import strategy from oscar.test.basket import add_product class TestAValueBasedOffer(TestCase): def setUp(self): # Get 20% if spendin...
bsd-3-clause
bobthekingofegypt/servo
tests/wpt/web-platform-tests/tools/html5lib/html5lib/tests/test_tokenizer.py
420
6544
from __future__ import absolute_import, division, unicode_literals import json import warnings import re from .support import get_data_files from html5lib.tokenizer import HTMLTokenizer from html5lib import constants class TokenizerTestParser(object): def __init__(self, initialState, lastStartTag=None): ...
mpl-2.0
brototyp/CouchPotato
library/hachoir_parser/audio/mod.py
86
4948
""" Parser of FastTrackerII Extended Module (XM) version 1.4 Documents: - Modplug source code (file modplug/soundlib/Load_mod.cpp) http://sourceforge.net/projects/modplug - Dumb source code (files include/dumb.h and src/it/readmod.c http://dumb.sf.net/ - Documents on "MOD" format on Wotsit http://www.wotsit.org ...
gpl-3.0
philanthropy-u/edx-platform
common/lib/xmodule/xmodule/lti_2_util.py
16
16306
# pylint: disable=attribute-defined-outside-init """ A mixin class for LTI 2.0 functionality. This is really just done to refactor the code to keep the LTIModule class from getting too big """ import base64 import hashlib import json import logging import re import urllib import mock from oauthlib.oauth1 import Clien...
agpl-3.0
run2/citytour
4symantec/Lib/site-packages/setuptools/py31compat.py
570
1637
import sys import unittest __all__ = ['get_config_vars', 'get_path'] try: # Python 2.7 or >=3.2 from sysconfig import get_config_vars, get_path except ImportError: from distutils.sysconfig import get_config_vars, get_python_lib def get_path(name): if name not in ('platlib', 'purelib'): ...
mit
swdream/neutron
neutron/agent/linux/async_process.py
8
9812
# Copyright 2013 Red Hat, 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 agre...
apache-2.0
JeroenDeDauw/teg
python/client/gui/tdialog.py
2
10170
# $Id: tdialog.py,v 1.1 2003/09/14 02:01:14 riq Exp $ ############################################################################################### # $Civil: dialog.py,v 1.8 2003/06/29 09:54:52 chakie Exp $ # This file belongs to http://civil.sf.net # License: GNU GPL v2 # Copyright: Civil team ######################...
gpl-3.0
alberto-fc/typhon-vx
kraken_rewrite/cc2/dispatcher.py
6
3415
import select import socket, time, struct server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server_socket.bind(('127.0.0.1', 6666)) server_socket.listen(50) jobptr=0 lookup=[] to_dp=[] # (data,jobptr) to_delta=[] # 8+16320*8 ...
gpl-3.0
richardcs/ansible
lib/ansible/modules/network/f5/bigip_snmp_trap.py
8
20569
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright: (c) 2017, F5 Networks Inc. # GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
gpl-3.0
ets-labs/python-dependency-injector
tests/performance/factory_benchmark_1.py
4
1438
"""Dependency Injector Factory providers benchmark.""" import time from dependency_injector import providers N = 1000000 class A(object): pass class B(object): pass class C(object): pass class Test(object): def __init__(self, a, b, c): self.a = a self.b = b self.c = c...
bsd-3-clause
edx/lettuce
lettuce/plugins/reporter.py
19
2156
import sys class Reporter(object): def __init__(self): self.failed_scenarios = [] self.scenarios_and_its_fails = {} def wrt(self, what): if isinstance(what, unicode): what = what.encode('utf-8') sys.stdout.write(what) def store_failed_step(self, step): ...
gpl-3.0
avilaton/sqlalchemy-continuum
sqlalchemy_continuum/transaction.py
1
5496
from datetime import datetime try: from collections import OrderedDict except ImportError: from ordereddict import OrderedDict import six import sqlalchemy as sa from sqlalchemy.ext.compiler import compiles from .dialects.postgresql import ( CreateTemporaryTransactionTableSQL, InsertTemporaryTransacti...
bsd-3-clause
happy5214/pywikibot-core
tests/cache_tests.py
6
1283
# -*- coding: utf-8 -*- """API Request cache tests.""" # # (C) Pywikibot team, 2012-2014 # # Distributed under the terms of the MIT license. # from __future__ import absolute_import, unicode_literals from pywikibot.site import BaseSite import scripts.maintenance.cache as cache from tests import join_cache_path from ...
mit
Lujeni/ansible
lib/ansible/modules/network/avi/avi_analyticsprofile.py
19
32481
#!/usr/bin/python # # @author: Gaurav Rastogi (grastogi@avinetworks.com) # Eric Anderson (eanderson@avinetworks.com) # module_check: supported # Avi Version: 17.1.1 # # Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses...
gpl-3.0
Dfelker/ansible
lib/ansible/utils/module_docs.py
44
4944
#!/usr/bin/env python # (c) 2012, Jan-Piet Mens <jpmens () gmail.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...
gpl-3.0
RTHMaK/RPGOne
deep_qa-master/deep_qa/tensors/masked_operations.py
1
4270
from keras import backend as K from .backend import switch def masked_batch_dot(tensor_a, tensor_b, mask_a, mask_b): ''' The simplest case where this function is applicable is the following: tensor_a: (batch_size, a_length, embed_dim) tensor_b: (batch_size, b_length, embed_dim) mask_a: None or (...
apache-2.0
eatbyte/depot_tools
third_party/boto/storage_uri.py
51
36475
# Copyright 2010 Google Inc. # Copyright (c) 2011, Nexenta Systems Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use...
bsd-3-clause
OpenEneaLinux/rt-tools
partrt/test/test_partition.py
1
50786
#!/usr/bin/env python3 # Copyright (c) 2014 by Enea Software AB # 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 # noti...
bsd-3-clause
rismalrv/edx-platform
common/lib/xmodule/xmodule/tests/test_editing_module.py
181
2640
""" Tests for editing descriptors""" import unittest import os import logging from mock import Mock from pkg_resources import resource_string from opaque_keys.edx.locations import Location from xmodule.editing_module import TabsEditingDescriptor from xblock.field_data import DictFieldData from xblock.fields import Sco...
agpl-3.0
hbenniou/trunk
examples/simple-scene/simple-scene.py
8
4213
#!/usr/bin/python # -*- coding: utf-8 -*- ## Omega is the super-class that orchestrates the whole program. ## It holds the entire simulation (MetaBody), takes care of loading/saving, ## starting/stopping the simulation, loads plugins and more. o=Omega() # for advaned folks: this creates default MetaBody as well ## ...
gpl-2.0
stdweird/aquilon
tests/broker/test_add_reboot_intervention.py
2
5685
#!/usr/bin/env python2.6 # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2011,2012,2013 Contributor # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obt...
apache-2.0
iidx/volatility
volatility/plugins/malware/svcscan.py
44
16277
# Volatility # Copyright (C) 2007-2013 Volatility Foundation # Copyright (c) 2010, 2011, 2012 Michael Ligh <michael.ligh@mnin.org> # # 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...
gpl-2.0
justinpotts/mozillians
vendor-local/lib/python/django_browserid/tests/test_auth.py
10
7619
# 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/. from django.conf import settings from django.contrib.auth.models import User from django.db import IntegrityError from dj...
bsd-3-clause
DiamondLightSource/auto_tomo_calibration-experimental
old_code_scripts/measure_resolution/lmfit-py/lmfit/asteval.py
7
28090
""" Safe(ish) evaluator of python expressions, using ast module. The emphasis here is on mathematical expressions, and so numpy functions are imported if available and used. Symbols are held in the Interpreter symtable -- a simple dictionary supporting a simple, flat namespace. Expressions can be compiled into ast no...
apache-2.0
egoitzro/poedit
deps/boost/tools/build/src/tools/types/lib.py
71
2703
# Status: ported # Base revision: 64456. # Copyright David Abrahams 2004. # Copyright Vladimir Prus 2010. # Distributed under the Boost # Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) import b2.build.type as type # The following naming scheme ...
mit
spiceqa/tp-spice
spice/client-tests/help_version.py
1
1860
#!/usr/bin/python # 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. # # This program is distributed in the hope that it w...
gpl-2.0
Livit/Livit.Learn.EdX
common/lib/xmodule/xmodule/modulestore/edit_info.py
201
2843
""" Access methods to get EditInfo for xblocks """ from xblock.fields import XBlockMixin from abc import ABCMeta, abstractmethod class EditInfoMixin(XBlockMixin): """ Provides the interfaces for getting the edit info from XBlocks """ @property def edited_by(self): """ The user id o...
agpl-3.0