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 |
|---|---|---|---|---|---|
#
# Copyright 2013 NTT Corp.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | cryptickp/heat | heat/tests/neutron/test_neutron_network_gateway.py | Python | apache-2.0 | 22,563 |
from __future__ import unicode_literals
from . import responses
url_bases = [
"https://route53.amazonaws.com/201.-..-../hostedzone",
]
url_paths = {
'{0}$': responses.list_or_create_hostzone_response,
'{0}/[^/]+$': responses.get_or_delete_hostzone_response,
'{0}/[^/]+/rrset$': responses.rrset_response... | djmitche/moto | moto/route53/urls.py | Python | apache-2.0 | 324 |
# Copyright (c) $today.year. Mark E. Madsen <mark@madsenlab.org>
#
# This work is licensed under the terms of the Creative Commons-GNU General Public Llicense 2.0, as "non-commercial/sharealike". You may use, modify, and distribute this software for non-commercial purposes, and you must distribute any modifications u... | mmadsen/CTPy | ctpy/utils/allele_distribution.py | Python | apache-2.0 | 1,152 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | lib/spack/spack/test/python_version.py | Python | lgpl-2.1 | 6,415 |
# Copyright (C) 2003-2005 Peter J. Verveer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following d... | lesserwhirls/scipy-cwt | scipy/ndimage/tests/test_ndimage.py | Python | bsd-3-clause | 203,773 |
# -*- 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):
# Changing field 'ModelFieldData.foreign'
db.alter_column('blogs_modelfielddata', 'foreign_id', self.gf('dj... | carquois/blobon | blobon/blogs/migrations/0125_auto__chg_field_modelfielddata_foreign.py | Python | mit | 31,918 |
# -*- 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... | chokribr/invenio | invenio/modules/annotations/receivers.py | Python | gpl-2.0 | 1,224 |
"""
Django settings for pronomen project.
Generated by 'django-admin startproject' using Django 1.10.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import o... | jh0ker/pronomen | site/pronomen/settings.py | Python | agpl-3.0 | 3,308 |
##################################################################
# Copyright 2018 Open Source Geospatial Foundation and others #
# licensed under MIT, Please consult LICENSE.txt for details #
##################################################################
from pywps._compat import text_type, StringIO
impor... | tomkralidis/pywps | pywps/inout/basic.py | Python | mit | 31,420 |
# encoding: utf-8
#
# 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/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from mo_dots import Data
d = Data(a=44)
de = Da... | klahnakoski/mo-dots | tests/ambiguous_test.py | Python | mpl-2.0 | 346 |
#Slic3r comand line wrapper and FAB UI syncronization tool
#sudo /var/www/slic3r/slic3r -load /var/www/slic3r/config.ini -o /var/www/slic3r/output.gcode /var/www/slic3r/cube.stl
from subprocess import Popen, PIPE, STDOUT
import time
import os, sys, getopt
from subprocess import call
times=[]
percents=[]
names... | FABtotum/FAB-UI | fabui/python/slic3r_wrapper.py | Python | gpl-2.0 | 3,836 |
import numpy as np
import numpy.linalg
import scipy as sp
import scipy.linalg
from numpy import dot
def solve_tv_lqr(A, B, Q, R):
"""
(K, P) = solve_tv_lqr(A, B, Q, R)
Solve the time-varying discrete LQR problem.
Inputs:
A - Sequence of N matrices (system dynamics)
B - Sequence of N matri... | hilario/trep | src/discopt/dlqr.py | Python | gpl-3.0 | 2,583 |
# coding: utf-8
from __future__ import unicode_literals, absolute_import
from mock import Mock
from boxsdk.auth import remote_managed_oauth2
def test_remote_managed_oauth2_calls_retrieve_tokens_during_refresh(access_token):
retrieve_access_token = Mock()
oauth2 = remote_managed_oauth2.RemoteOAuth2(
... | Frencil/box-python-sdk | test/unit/auth/test_remote_managed_oauth2.py | Python | apache-2.0 | 641 |
'''
Created on 11-Jun-2016
@author: prakash.selvam
'''
import hashlib
import random
from Maintenance.models import RegisteredApartUser, UnmatchedRegistrations, PreRegistrations
class ApartUserUtil(object):
def model_to_dict(self, instance, include=None, exclude=None):
fields = instance._meta.concret... | prakashselvam/Apart | Maintenance/Maintenance_utils/ApartmentUserUtils.py | Python | gpl-3.0 | 7,764 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... | agry/NGECore2 | scripts/mobiles/tatooine/tusken_berserker.py | Python | lgpl-3.0 | 1,347 |
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.models import NOT_PROVIDED
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_rename_table = "RENAME TABLE %(old_table)s TO %(new_table)s"
sql_alter_column_null = "MODIFY %(column)s %(type)s NULL"
sql_alter_column_... | cyaninc/django-mysql-pymysql | src/mysql_pymysql/schema.py | Python | bsd-3-clause | 2,073 |
# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models
class StockPicking(models.Model):
_inherit = 'stock.picking'
stock_request_ids = fields.One2many(comodel_name='stock.request',
... | Vauxoo/stock-logistics-warehouse | stock_request/models/stock_picking.py | Python | agpl-3.0 | 1,420 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
import re
import urlparse
import pymongo
import re
from pcnile.resource import atom_download_resource
from bson import ObjectId
if __name__ == '__main__':
db = pymongo.Connection().server
for item in db.server.find():
item['resource']['... | pczhaoyun/obtainfo | tools/atom.py | Python | apache-2.0 | 417 |
import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="font", parent_name="barpolar.hoverlabel", **kwargs):
super(FontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/barpolar/hoverlabel/_font.py | Python | mit | 1,860 |
import datetime
from django.db import models
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from django.urls import reverse
import reversion
from users.models import Lageruser
from devicetypes.models import Type
from devicegroups.models import Devicegroup
from locations.models... | vIiRuS/Lagerregal | devices/models.py | Python | bsd-3-clause | 10,243 |
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
from __future__ import print_function
from __future__ import absolute_import
import numpy as np
class ResampleError(Exception):
pass
class OverlapError(ResampleError):
pass
class NoOverlapError(OverlapE... | olebole/astrometry.net | util/resample.py | Python | bsd-3-clause | 16,293 |
# -*- coding: utf-8 -*-
import datetime as dt
import itertools
import logging
import re
import urlparse
from copy import deepcopy
import bson
import pytz
import itsdangerous
from modularodm import fields, Q
from modularodm.exceptions import NoResultsFound, ValidationError, ValidationValueError, QueryException
from mo... | SSJohns/osf.io | framework/auth/core.py | Python | apache-2.0 | 56,122 |
#########################################################################
#
# Copyright (c) 2003-2004 Danny Brewer d29583@groovegarden.com
# Copyright (C) 2004-2010 OpenERP SA (<http://openerp.com>).
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser Gene... | Johnzero/OE7 | openerp/addons-modules/base_report_designer/plugin/openerp_report_designer/bin/script/About.py | Python | agpl-3.0 | 3,821 |
#!/usr/bin/kivy
# -*- coding: utf-8 -*-
import os
from kivy.app import App
from kivy.properties import NumericProperty, StringProperty, BooleanProperty, ListProperty, ObjectProperty
from kivy.uix.textinput import TextInput
from kivy.uix.boxlayout import BoxLayout
from kivy.core.window import Window
from kivy.metrics i... | NumesSanguis/KanjiOrigin | data/screens/learnkanji_k.py | Python | gpl-3.0 | 29,549 |
# Django settings for benchmarking project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
import os
os.environ['PGCONNECT_TIMEOUT'] = '1'
MANAGERS = ADMINS
DATABASES = {
'default': {
# 'ENGINE' : 'django.db.backends.sqlite3',
'ENGINE' : 'django.d... | kantai/passe-framework-prototype | passe-sample-apps/benchmarking/settings.py | Python | bsd-3-clause | 4,770 |
import uptime
import storage
import settings
import time
import pymongo
from pymongo import MongoClient
import sqlite3
while True:
conn = sqlite3.connect(settings.DB)
cursor = conn.cursor()
connection = MongoClient('localhost', 27017)
collection = connection[settings.DBS_NAME][settings.FARMERS_COLLECTI... | littleskunk/driveshare-graph | driveshare_graph/updateSQL.py | Python | mit | 593 |
# Copyright David Abrahams 2004. 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)
from b2.build import type
def register ():
type.register_type ('MARKDOWN', ['markdown', 'md'])
register ()
| mzdb/pwiz-mzdb | libraries/boost-build/src/tools/types/markdown.py | Python | apache-2.0 | 298 |
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | Donkyhotay/MoonPy | zope/i18n/locales/__init__.py | Python | gpl-3.0 | 22,122 |
import os
import os.path
import shutil
import socket
import subprocess
import sys
import tempfile
import time
import random
try:
import pytest
except ImportError:
print >> sys.stderr, "Integ tests require pytests!"
sys.exit(1)
def pytest_funcarg__servers(request):
"Returns a new APIHandler with a fil... | twitter-forks/statsite | integ/test_timers_include.py | Python | bsd-3-clause | 3,103 |
# coding: utf-8
from datetime import datetime
import random
from django.http import HttpResponse, HttpResponseBadRequest
from django.http import HttpResponseRedirect
from django.http import HttpResponseServerError
from django.shortcuts import render
from django.urls import reverse
from django.views import View
from l... | xingzhe25/testLeanCloud | views.py | Python | mit | 5,363 |
"""Change relationship between instances and groups from m2m to m2o
Revision ID: 535ddcd39cad
Revises: 4031597ba686
Create Date: 2012-03-10 10:09:02.058131
"""
# downgrade revision identifier, used by Alembic.
revision = '535ddcd39cad'
down_revision = '4031597ba686'
from alembic import op
import sqlalchemy as sa
... | asidev/aybu-manager | migrations/versions/535ddcd39cad_change_relationship_.py | Python | apache-2.0 | 2,870 |
import time
for i in range(1, 10, 2):
time.sleep(2) # print to standard output
print('spam' * i) # nothing GUI about this, eh?
| simontakite/sysadmin | pythonscripts/programmingpython/Gui/Tools/spams.py | Python | gpl-2.0 | 171 |
# -*- coding: utf-8 -*-
import argparse
import json
import logging
import xml.etree.ElementTree as ET
import os
from collections import defaultdict
log = logging.getLogger("importer")
psycopg_import_error = None
try:
import psycopg2
except ImportError as exc:
psycopg2 = None
psycopg_import_error = str(ex... | City-of-Helsinki/kerrokantasi | migrator/process_legacy_data.py | Python | mit | 5,516 |
# coding: utf-8
import unittest
from tapioca_instagram import Instagram
class TestTapiocaInstagram(unittest.TestCase):
def setUp(self):
self.wrapper = Instagram()
if __name__ == '__main__':
unittest.main()
| vintasoftware/tapioca-instagram | tests/test_tapioca_instagram.py | Python | mit | 229 |
"""
Tests for courseware middleware
"""
from django.http import Http404
from django.test.client import RequestFactory
from lms.djangoapps.courseware.exceptions import Redirect
from lms.djangoapps.courseware.middleware import RedirectMiddleware
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestC... | edx/edx-platform | lms/djangoapps/courseware/tests/test_middleware.py | Python | agpl-3.0 | 1,978 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2019 Bitergia
#
# 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 l... | grimoirelab/GrimoireELK | utils/gelk.py | Python | gpl-3.0 | 5,856 |
#! /usr/bin/env python
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
from __future__ import print_function
import matplotlib
matplotlib.use('Agg')
from astrometry.util.index import *
from astrometry.util.plotutils import *
from astrometry.libkd.spherematch... | olebole/astrometry.net | util/index-stats.py | Python | bsd-3-clause | 7,688 |
"""
This module contains deprecation messages and bits of code used elsewhere in the codebase
that is planned to be removed in the next pytest release.
Keeping it in a central location makes it easy to track what is deprecated and should
be removed when the time comes.
"""
from __future__ import absolute_import, divis... | MichaelAquilina/pytest | _pytest/deprecated.py | Python | mit | 1,519 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# fincorrnet documentation build configuration file, created by
# sphinx-quickstart on Thu Apr 7 23:17:52 2016.
#
# 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
#... | mvaz/financial-correlation-networks | conf.py | Python | mit | 9,219 |
import pytest
from api.base.settings.defaults import API_BASE
from osf_tests.factories import (
ProjectFactory,
AuthUserFactory,
PrivateLinkFactory,
)
from osf.utils import permissions
@pytest.fixture()
def admin():
return AuthUserFactory()
@pytest.fixture()
def base_url():
return '/{}nodes/'.fo... | pattisdr/osf.io | api_tests/nodes/views/test_view_only_query_parameter.py | Python | apache-2.0 | 15,854 |
"""
Basic operations for FITS files.
:requires: PyFITS
:requirs: NumPy
:author: Sami-Matias Niemi
:version: 0.2
"""
import pyfits as pf
import numpy as np
def getWavelengths(filename, length, ext=0):
"""
Returns ndarray of wavelengths. This information is
derived using the FITS header.
:param filena... | sniemi/SamPy | fits/basics.py | Python | bsd-2-clause | 1,093 |
# coding=utf8
#
# Insight Minr Active Spider Client Node
# CopyRight BestMiner Inc.
#
'''
从controller节点获取任务数据
'''
import os
import json
import time
import socket
import urllib
from twisted.internet.defer import inlineCallbacks, returnValue
from observer.utils.http import request, TimedAgentPool, InfiniteLoginEr... | seraphlnWu/creditor | observer/platform/taobao/user_client.py | Python | apache-2.0 | 3,700 |
from pyramid.config import Configurator
import datetime
from pyramid.renderers import JSON
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = Configurator(settings=settings)
json_renderer = JSON()
def datetime_adapter(obj, request):
ret... | Leits/openprocurement.api.encryprion | openprocurement/api/encryprion/__init__.py | Python | apache-2.0 | 726 |
#!/usr/bin/env python3
import re
from collections import namedtuple
from contextlib import contextmanager
WHITESPACE_RE = re.compile(r'[ \r\n\v\t]+')
IDENTIFIER_RE = re.compile(r'[a-zA-Z_][a-zA-Z0-9_]*')
NUMBER_RE = re.compile(r'[0-9]+|[0-9]+\.[0-9]*|[0-9]*\.[0-9]+')
STRING_RE = re.compile(r'"([^"\\]|\\.)*"|\'([^\'\\... | bell345/pseudo-interpreter | pseudo/token.py | Python | mit | 9,534 |
import threading
from sqlalchemy import Column, UnicodeText, Integer
from tg_bot.modules.sql import BASE, SESSION
class RSS(BASE):
__tablename__ = "rss_feed"
id = Column(Integer, primary_key=True)
chat_id = Column(UnicodeText, nullable=False)
feed_link = Column(UnicodeText)
old_entry_link = Colu... | PaulSonOfLars/tgbot | tg_bot/modules/sql/rss_sql.py | Python | gpl-3.0 | 2,258 |
'''
Atomix project, oros.py, (TODO: summary)
Copyright (c) 2015 Stanford University
Released under the Apache License v2.0. See the LICENSE file for details.
Author(s): Manu Bansal
'''
from java.lang import *
from java.util import *
from com.ti.debug.engine.scripting import *
from com.ti.ccstudio.scripting.environment ... | manub686/atomix | tirunutils/oros.py | Python | apache-2.0 | 8,347 |
"""
radish
~~~~~~
The root from red to green. BDD tooling for Python.
:copyright: (c) 2019 by Timo Furrer <tuxtimo@gmail.com>
:license: MIT, see LICENSE for more details.
"""
from collections import namedtuple
from pathlib import Path
import click
import colorful as cf
import radish.loader as loader
from radish.__... | radish-bdd/radish | src/radish/step_testing/__main__.py | Python | mit | 3,589 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from torch import nn
class ModuleProxyWrapper(nn.Module):
"""
Wrap a DistributedDataParallel module and forward requests for missing... | pytorch/fairseq | fairseq/distributed/module_proxy_wrapper.py | Python | mit | 1,965 |
try:
import smbus
except:
print 'Try sudo apt-get install python-smbus'
from time import sleep
# Models
MODEL_02BA = 0
MODEL_30BA = 1
# Oversampling options
OSR_256 = 0
OSR_512 = 1
OSR_1024 = 2
OSR_2048 = 3
OSR_4096 = 4
OSR_8192 = 5
# kg/m^3 convenience
DENSITY_FRESHWATER = 997
DENSIT... | dheideman/UCSD-RoboFishy | Mapper/ms5837.py | Python | mit | 7,298 |
import pytest
VIEWPORT = {
'large': {'width': 1201, 'height': 1024}, # also nav-break-ends
'desktop': {'width': 1025, 'height': 1024},
'tablet': {'width': 851, 'height': 1024}, # also nav-block-ends
'mobile': {'width': 481, 'height': 1024},
'small': {'width': 320, 'height': 480}}
def pytest_ad... | safwanrahman/kuma | tests/conftest.py | Python | mpl-2.0 | 1,174 |
# -*- coding: utf-8 -*-
# Copyright 2016 Alexander Fahlke
#
# 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... | alexanderfahlke/hellotravis-python | hellotravis-python/__init__.py | Python | apache-2.0 | 1,050 |
import errno
import glob
import platform
import re
import sys
import tempfile
import zipfile
from contextlib import contextmanager
from distutils.version import StrictVersion
import os
import requests
from xml.etree import ElementTree
IS_64_BIT = sys.maxsize > 2**32
IS_LINUX = platform.system().lower() == 'linux'
I... | kevbradwick/rockyroad | rockyroad/driver.py | Python | bsd-3-clause | 7,103 |
from selenium import webdriver
import selenium.webdriver.support.ui as ui
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
self.wd = webd... | elenagradovich/python_training | fixture/application.py | Python | apache-2.0 | 1,175 |
"""Default value unit tests."""
# Copyright (c) 2001-2009 ElevenCraft Inc.
# See LICENSE for details.
from schevo.constant import DEFAULT, UNASSIGNED
from schevo import error
from schevo.test import CreatesSchema
class BaseDefaultValues(CreatesSchema):
body = '''
class Charlie(E.Entity):
"""Fields... | Schevo/schevo | schevo/test/test_default_values.py | Python | mit | 1,424 |
##
# Copyright 2014-2016 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | Caylo/easybuild-framework | easybuild/tools/module_naming_scheme/toolchain.py | Python | gpl-2.0 | 5,230 |
# $Id: uas-cancel-no-final.py 4188 2012-06-29 09:01:17Z nanang $
#
import inc_const as const
PJSUA = ["--null-audio --max-calls=1 $SIPP_URI"]
PJSUA_EXPECTS = [[0, const.STATE_EARLY, "h"]]
| halex2005/pjproject | tests/pjsua/scripts-sipp/uas-cancel-no-final.py | Python | gpl-2.0 | 190 |
# Copyright (c) 2012 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... | nash-x/hws | neutron/agent/rpc.py | Python | apache-2.0 | 6,712 |
"""
Flux for Home-Assistant.
The idea was taken from https://github.com/KpaBap/hue-flux/
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/switch.flux/
"""
from datetime import time
import logging
import voluptuous as vol
from homeassistant.components.li... | alexmogavero/home-assistant | homeassistant/components/switch/flux.py | Python | apache-2.0 | 8,510 |
#!/usr/bin/env python
"""
Matplotlib provides sophisticated date plotting capabilities, standing on the
shoulders of python :mod:`datetime`, the add-on modules :mod:`pytz` and
:mod:`dateutil`. :class:`datetime` objects are converted to floating point
numbers which represent time in days since 0001-01-01 UTC, plus 1. ... | rbalda/neural_ocr | env/lib/python2.7/site-packages/matplotlib/dates.py | Python | mit | 52,905 |
##
# Copyright 2013-2021 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | hpcugent/easybuild-framework | easybuild/toolchains/golfc.py | Python | gpl-2.0 | 1,661 |
#!/bin/python2
"""Main controller of LLL
"""
import sys, os
import logging
try:
from ptyview import PtyView
from PyQt4 import QtGui
from PyQt4 import QtCore, Qt
from PyQt4.QtCore import QThread, QSettings, pyqtSignal
from PyQt4.QtGui import QMessageBox, QIcon, QMenu
import util
except ImportErr... | c0deforfun/LLL | lll.py | Python | mit | 20,424 |
# coding=utf-8#
# Copyright (c) 2014-2018, F5 Networks, 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 applicabl... | F5Networks/f5-openstack-agent | f5_openstack_agent/lbaasv2/drivers/bigip/icontrol_driver.py | Python | apache-2.0 | 112,266 |
import re
# from https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-camelcase-to-snake-case
def snake_case(string):
''' Takes a string that represents for example a class name and returns
the snake case version of it. It is used for model-to-key conversion '''
s1 = re.sub('(.)(... | getfleety/coralillo | coralillo/utils.py | Python | mit | 1,180 |
# $Id: 401_fmtp_g7221_with_bitrate_32000.py 3664 2011-07-19 03:42:28Z nanang $
import inc_sip as sip
import inc_sdp as sdp
# Answer with codec G722.1 should choose the same bitrate
# which in this test is 32000
sdp = \
"""
v=0
o=- 3428650655 3428650655 IN IP4 192.168.1.9
s=pjmedia
c=IN IP4 192.168.1.9
t=0 0
a=X-nat:0... | lxki/pjsip | tests/pjsua/scripts-sendto/401_fmtp_g7221_with_bitrate_32000.py | Python | gpl-2.0 | 922 |
from SocialNetwork_API.arango_core import ArangoCore
from SocialNetwork_API.arango_services import ArangoBaseService
from SocialNetwork_API.const import ArangoVertex, ArangoEdge
class ArangoDownloadService(ArangoBaseService):
@classmethod
def save_download(cls, data):
try:
database = Aran... | HoangNguyenHuy/SocialNetwork | src/SocialNetwork_API/arango_services/download.py | Python | mit | 3,068 |
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | boto/botocore | botocore/signers.py | Python | apache-2.0 | 28,412 |
#Create mp4 movie from png files in a folder, using ffmpeg encoder.
import os, random, sys
import glob
#--------------------------USER INPUT--------------------------------
#
#The old data location
#if sys.platform == 'darwin': BASEDIR='/Users/kamen/ubuntu_share/MWA_DATA/'
#if sys.platform == 'linux2': BASEDIR='/mnt/u... | kkozarev/mwacme | src/png2mp4_synchrotron.py | Python | gpl-2.0 | 3,452 |
import pipes
from fabric.api import settings, task, local, hide
from fabric.contrib.console import confirm
def is_working_tree_clean():
with settings(hide('everything'), warn_only=True):
local('git update-index -q --ignore-submodules --refresh')
unstaged = local('git diff-files --quiet --ignore-s... | GaretJax/ppc | fabfile.py | Python | mit | 2,432 |
from test_templatetags import *
| acdha/django-google-analytics | google_analytics/tests/__init__.py | Python | mit | 32 |
from __future__ import absolute_import
import urllib2
from django.template import Library, Node
from django.contrib.sites.models import Site
from django.core.cache import cache
from django.conf import settings
register = Library()
SOURCES = {
'nl': 'http://www.degrotegriepmeting.nl/count/counter/?country=NL',
... | pkleimert/hrpt | apps/count/templatetags/count.py | Python | agpl-3.0 | 1,970 |
import datetime
from django.core import signing
from django.test import SimpleTestCase
from django.test.utils import freeze_time
class TestSigner(SimpleTestCase):
def test_signature(self):
"signature() method should generate a signature"
signer = signing.Signer('predictable-secret')
sign... | ifduyue/django | tests/signing/tests.py | Python | bsd-3-clause | 5,150 |
#!/usr/bin/env python
"""Test case."""
import os
import subprocess
import sys
try:
import unittest2 as unittest # Python 2.6
except ImportError:
import unittest
ROOT_DIR = os.path.split(os.path.abspath(os.path.dirname(__file__)))[0]
sys.path.append(ROOT_DIR)
class Tests(unittest.TestCase):
def test_s... | amou269/heatmap | test/test_gradients.py | Python | agpl-3.0 | 1,245 |
# Copyright (c) 2012 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 ... | yosshy/nova | nova/availability_zones.py | Python | apache-2.0 | 6,591 |
# coding=utf-8
# Copyright The HuggingFace Inc. team. 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 requir... | huggingface/pytorch-transformers | src/transformers/models/convbert/tokenization_convbert_fast.py | Python | apache-2.0 | 2,422 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | mlperf/training_results_v0.5 | v0.5.0/google/cloud_v3.8/resnet-tpuv3-8/code/resnet/model/models/official/transformer/utils/schedule_test.py | Python | apache-2.0 | 3,165 |
"""Blebox air_quality tests."""
import logging
import blebox_uniapi
import pytest
from homeassistant.components.air_quality import ATTR_PM_0_1, ATTR_PM_2_5, ATTR_PM_10
from homeassistant.const import ATTR_ICON, STATE_UNKNOWN
from .conftest import async_setup_entity, mock_feature
from tests.async_mock import AsyncM... | nkgilley/home-assistant | tests/components/blebox/test_air_quality.py | Python | apache-2.0 | 2,891 |
# -*- coding: utf-8 -*-
#
# COPYRIGHT (C) 2016-2017 Michael Labouebe <gfarmerfr@free.fr>
# COPYRIGHT (C) 2016-2018 Mutnick <mutnick@techie.com>
# COPYRIGHT (C) 2008-2011 Quinox <quinox@users.sf.net>
# COPYRIGHT (C) 2006-2009 Daelstorm <daelstorm@gmail.com>
# COPYRIGHT (C) 2009 Hedonist <ak@sensi.org>
# COPYRIGHT (C) 20... | eLvErDe/nicotine-plus | pynicotine/gtkgui/frame.py | Python | gpl-3.0 | 137,582 |
"""
WSGI config for my_site project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "my_site.settings")
from django.core.w... | tridvaodin/Assignments-Valya-Maskaliova | project/my_site/wsgi.py | Python | gpl-2.0 | 389 |
from models import SpeciesRepresentation, Specimen, Species
from mediaman.views import MediaFileUploader, ParseError, RecordError
from haystack.query import SearchQuerySet
from bulkimport import BulkDataImportHandler, BulkImportForm
from django.shortcuts import render
import re
class ShellsImagesUploader(MediaFileUpl... | uq-eresearch/archaeology-reference-collections | apps/shells/admin_views.py | Python | bsd-3-clause | 2,834 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... | rwl/PyCIM | CIM14/IEC61968/Customers/CustomerAccount.py | Python | mit | 3,833 |
# $Id$
#
# Copyright (C) 2001-2006 greg Landrum and Rational Discovery LLC
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
""" unit testing code f... | soerendip42/rdkit | rdkit/DataStructs/UnitTestcBitVect.py | Python | bsd-3-clause | 10,981 |
from nose.tools import assert_equal
from sirl.models.base import LocalController
from sirl.models.base import MDPReward
from sirl.models.base import MDP
# from sirl.models import AlgoParams
def test_local_controller():
try:
LocalController()
assert False, 'Abstract method instantiated'
excep... | makokal/scalable-irl | sirl/tests/test_models.py | Python | bsd-3-clause | 1,351 |
# Copyright 2015 FUJITSU LIMITED
#
# 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 writ... | redhat-openstack/ironic | ironic/tests/drivers/irmc/test_power.py | Python | apache-2.0 | 10,352 |
import csv
import indicoio
from indicoio.custom import Collection
# insert your API key
indicoio.config.api_key = "YOUR_API_KEY"
def clean_article(article):
return article.replace("\n", " ").decode('cp1252').encode('utf-8', 'replace')
def test_model(test_list):
cleaned_test = [clean_article(text) for row... | IndicoDataSolutions/SuperCell | personalized_content_filter/main.py | Python | mit | 752 |
# coding: utf-8
# Author: Johannes Schönberger
#
# License: BSD 3 clause
import numpy as np
import warnings
from ..base import BaseEstimator, MetaEstimatorMixin, RegressorMixin, clone
from ..base import MultiOutputMixin
from ..utils import check_random_state, check_consistent_length
from ..utils.random import sample... | kevin-intel/scikit-learn | sklearn/linear_model/_ransac.py | Python | bsd-3-clause | 20,838 |
#
# python-lxc: Python bindings for LXC
#
# (C) Copyright Canonical Ltd. 2012
#
# Authors:
# Stéphane Graber <stgraber@ubuntu.com>
#
# 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... | coconutpilot/lxc | src/python-lxc/lxc/__init__.py | Python | lgpl-2.1 | 11,816 |
# Copyright 2016 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 threading
import unittest
from devil.android import device_errors
from devil.android import device_utils
_devices_lock = threading.Lock()
_devices_c... | endlessm/chromium-browser | third_party/catapult/devil/devil/android/device_test_case.py | Python | bsd-3-clause | 1,406 |
import logging
from scrapy.utils.reqser import request_to_dict, request_from_dict
from . import picklecompat
from .exp import EmptyQueueException
from .logger import sm_log
# EMPTY QUEUE RETURN CODE
EMPTY_QUEUE_CODE = -1
class Base(object):
"""Per-spider base queue class"""
def __init__(self, server, spid... | mavarick/scrapy-mysql | scrapy_mysql/queue.py | Python | mit | 3,976 |
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
def execute(filters=None):
columns = get_columns(filters.item)
data = get_data(filters.item)
return columns, data
def ge... | Zlash65/erpnext | erpnext/stock/report/item_variant_details/item_variant_details.py | Python | gpl-3.0 | 4,905 |
import random
import string
import aiohttp.web
AUTH_TOKEN_HEADER = 'X-AuthToken'
def random_string(length=6, chars=string.ascii_lowercase + \
string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for x in range(length))
def generate_api_auth_token():
... | syncrypt/client | syncrypt/api/auth.py | Python | gpl-3.0 | 1,101 |
import os
from coinpy.tools.ssl.ssl import ssl_RAND_add
if os.name == 'nt':
from coinpy.tools.seeds.perfmon import get_perfmon_data
from coinpy.tools.seeds.performance_counter import get_performance_counter
""" Get a list of (random_data, entropy) tuples suitable for ssl.RAND_add """
def get_syste... | sirk390/coinpy | coinpy-lib/src/coinpy/tools/seeds/system_seeds.py | Python | lgpl-3.0 | 629 |
#!/usr/bin/env python3.6
## RPI Gpio OSC ##
## v0.05 ##
## gllmar 2016-2017 ##
#import OSC #de pyosc
from pythonosc import osc_message_builder
from pythonosc import udp_client
import RPi.GPIO as GPIO
import time
import argparse
import errno
import datetime
import sys
__author__ = 'gllmAr'
# gestion de... | gllmAR/rpi-gpioOsc | gpioOSC.py | Python | mit | 4,647 |
# Copyright 2010 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""GDB Pretty printers and convencience functions for Go's runtime structures.
This script is loaded by GDB when it finds a .debug_gdb_scripts
section in the comp... | SDpower/golang | src/pkg/runtime/runtime-gdb.py | Python | bsd-3-clause | 10,018 |
"""
ass.ets
Asset management for webapps.
:copyright: (c) 2012 by Herrn Kaste <herr.kaste@gmail.com>.
:license: BSD, see LICENSE for more details.
"""
__version__ = "0.1.1"
from bundles import Environment, Assets, bundle, Bundle, Manifest
from filters import FilterError
import filters as f
from ... | kaste/ass.ets | ass/ets/__init__.py | Python | bsd-2-clause | 422 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import math
import numpy as np
from koheron import command
class Oscillo(object):
def __init__(self, client):
self.client = client
self.wfm_size = 8192
self.sampling_rate = 125e6
self.t = np.arange(self.wfm_size)/self.sampl... | Koheron/lase | examples/drivers/oscillo.py | Python | mit | 3,532 |
# -*- coding: utf-8 -*-
#
# input.py - input line for chat and debug window
#
# Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of QWeeChat, a Qt remote GUI for WeeChat.
#
# QWeeChat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General P... | GeoffMaciolek/qweechat | qweechat/input.py | Python | gpl-3.0 | 3,654 |
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Ecs20140526DescribeInstanceMonitorDataRequest(RestApi):
def __init__(self,domain='ecs.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.EndTime = None
self.InstanceId = None
self.Period = None
self.StartTime = ... | francisar/rds_manager | aliyun/api/rest/Ecs20140526DescribeInstanceMonitorDataRequest.py | Python | mit | 416 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def DistributedVirtualSwitchManagerDvsProductSpec(vim, *args, **kwargs):
'''This class is... | xuru/pyvisdk | pyvisdk/do/distributed_virtual_switch_manager_dvs_product_spec.py | Python | mit | 1,242 |
# encoding: 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 model 'YandexMap'
db.create_table('cmsplugin_yandexmap', (
('cmsplugin_ptr', self.gf(... | moskrc/cmsplugin_yandexmap | cmsplugin_yandexmap/migrations/0001_initial.py | Python | mit | 4,409 |
import csv
from Transaction import RawTransaction,BasicTransaction,replaceUndumpableData,UNITS, \
PRICE,AGENCY,VENDOR,PSC,DESCR,DATE,LONGDESCR,AWARDIDIDV,DATASOURCE
from Transaction import ensureZipCodeHasFiveDigits,MANUFACTURER_NAME,MANUFACTURER_PART_NUMBER,BUREAU,CONTRACT_NUMBER,TO_ZIP_CODE,FROM_ZIP_CODE,UNIT_O... | GSA/PricesPaidAPI | USASpendingAdapter.py | Python | unlicense | 3,973 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.