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 (c) 2015 ThoughtWorks, Inc.
#
# Pixelated 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.
#
# Pixelated is distrib... | pixelated/pixelated-user-agent | service/pixelated/adapter/mailstore/searchable_mailstore.py | Python | agpl-3.0 | 3,083 |
##############################################################################
# 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... | wscullin/spack | lib/spack/spack/hooks/__init__.py | Python | lgpl-2.1 | 2,944 |
#!/usr/bin/python
import numpy
import matplotlib.pyplot as plot
import time
import instrument
""" Example program to plot the Y-T data from Channel 1"""
# Initialize our scope
test = instrument.RigolScope("/dev/usbtmc0")
# Stop data acquisition
test.write(":STOP")
# start a single acquisition
#
test.write(":SIN... | dboonz/DSO1002A | src/capture_channel_1.py | Python | mit | 2,147 |
#!/usr/bin/python
import os
import subprocess
import shlex
import shutil
import time
import datetime
import numpy
import sys
ITERATIONS = 25
DATA_MAX = 512*1024*1024
STORAGE_DIR = "test_storage/"
MOUNT_DIR = "test_mount/"
METADATA_FILE = "test_metadata.json"
TIMESTAMP = datetime.datetime.now().isoformat()
LOG_FILE =... | mcoughli/root_of_trust | operational_os/encrypted_filesystem/filesystem_test.py | Python | gpl-3.0 | 6,292 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | Tom-Trumper/selenium | py/docs/source/conf.py | Python | apache-2.0 | 9,331 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# SEPA Credit Transfer module for Odoo
# Copyright (C) 2010-2015 Akretion (http://www.akretion.com)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can... | rlizana/bank-payment | account_banking_sepa_credit_transfer/wizard/export_sepa.py | Python | agpl-3.0 | 11,961 |
from captcha.fields import CaptchaField
from django import forms
from django.conf import settings
from django.core.mail import send_mail
from django.template import loader
from django.views import generic
from ..models import PendingUser
class RegisterForm(forms.ModelForm):
agreement = forms.BooleanField()
... | Atilla106/members.atilla.org | accounts/views/registration.py | Python | mit | 1,837 |
## PyZUI 0.1 - Python Zooming User Interface
## Copyright (C) 2009 David Roberts <d@vidr.cc>
##
## 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 you... | davidar/pyzui | pyzui/mainwindow.py | Python | gpl-2.0 | 13,155 |
"""The Wallbox integration."""
from __future__ import annotations
from datetime import timedelta
from http import HTTPStatus
import logging
from typing import Any
import requests
from wallbox import Wallbox
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERN... | rohitranjan1991/home-assistant | homeassistant/components/wallbox/__init__.py | Python | mit | 5,743 |
import pickle
# Third-party
import astropy.units as u
import pytest
# Project
from .. import Hamiltonian
from ...potential.builtin import KeplerPotential
from ...frame.builtin import StaticFrame, ConstantRotatingFrame
from ....units import solarsystem, galactic
def test_init():
p = KeplerPotential(m=1.)
f =... | adrn/gala | gala/potential/hamiltonian/tests/test_hamiltonian.py | Python | mit | 1,529 |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
pipe2py.modules.pipefetchpage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://pipes.yahoo.com/pipes/docs?doc=sources#FetchPage
"""
# Author: Gerrit Riessen, gerrit.riessen@open-source-consultants.de
# Copyright (C) 2011 Gerrit Riessen
# This code is licensed und... | ganugapav/pipe | pipe2py/modules/pipefetchpage.py | Python | gpl-2.0 | 3,788 |
from django.contrib.auth.models import User
from django_rq import job
from .recommender import Recommender
from .mailer import Mailer
@job
def send_recommendations(user: User):
recommender = Recommender(user)
photos = recommender.process()
mailer = Mailer()
mailer.send_recommendations(user.email, ph... | stlk/socialist | recommendation_engine/tasks.py | Python | mit | 326 |
#!/usr/bin/env python
'''
Worker.
'''
import logging
from tornado import gen
from tornado.options import options
from tornado import httpclient
from .scraper import HTTPClient, Page
from .urlnorm import norm, join_parts
from . import tasks
async def add_task(redis, url):
task = join_parts(norm(url))
logging.... | skrushinsky/torspider | torspider/worker.py | Python | mit | 3,793 |
import exch_constants as exchconst
import exchrate_util as exchutil
import re
import feedparser
import pprint
import datetime
from dateutil import parser
# MAYBE ADD THIS TO THE PYTHONPATH environment varibale?
import sys
sys.path.insert(0, '..')
from utility import utildb as ud
class CentralBankScrape():
def __... | liamneath1/hailey.io | server-side/central_bank/centralb.py | Python | mit | 4,313 |
import os
from google.appengine.ext.webapp import template
from base_controller import CacheableHandler
# Note, broken out into its own class for future extensibility -PJL 04272015
class EventWizardHandler(CacheableHandler):
CACHE_VERSION = 1
CACHE_KEY_FORMAT = "event_wizard"
def __init__(self, *args, *... | verycumbersome/the-blue-alliance | controllers/event_wizard_controller.py | Python | mit | 613 |
"""
Django settings for django_110 project.
Generated by 'django-admin startproject' using Django 1.10.
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... | johansteffner/raven-python | examples/django_110/app/settings.py | Python | bsd-3-clause | 3,321 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/stat/cmp/cmp_stats.py | Python | apache-2.0 | 23,385 |
import sys
from fermipy import utils
utils.init_matplotlib_backend()
from fermipy.gtanalysis import GTAnalysis
from fermipy.utils import *
import yaml
import pprint
import numpy
import argparse
from fermipy.gtanalysis import GTAnalysis
def main():
usage = "usage: %(prog)s [config file]"
description =... | fermiPy/lcpipe | runLC.py | Python | bsd-3-clause | 1,786 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pages', '0015_auto_20160704_0603'),
]
operations = [
migrations.AddField(
model_name='slideshow',
na... | thanos/mykonosbiennale.org | pages/migrations/0016_auto_20170329_0435.py | Python | apache-2.0 | 738 |
import iso639, importlib
from elasticsearch import Elasticsearch
KNOWN_LANGS = iso639.languages.part1.keys()
def populate_iso_639_language_field(dbs_row, attribute_prefix, source_lang_dict):
# we use this approach for dealing with multiple languages
# https://www.elastic.co/guide/en/elasticsearch/guide/curre... | Beit-Hatfutsot/mojp-dbs-pipelines | datapackage_pipelines_mojp/common/utils.py | Python | mit | 1,646 |
# Copyright (C) 2008 Guild of Writers PyPRP Project Team
# See the file AUTHORS for more info about the team
#
# 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... | Jrius/PyPRP | PyPRP/prp_Types.py | Python | gpl-2.0 | 23,185 |
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
__here__ = os.path.abspath(os.path.dirname(__file__))
REQUIREMENTS = [
i.strip() for i in
open(os.path.join(__here__, "requirements.txt")).readlines()
]
setup(
name='django-rf-candv-choices',
version='1.0.0',
descrip... | oblalex/django-rf-candv-choices | setup.py | Python | lgpl-3.0 | 1,282 |
from twisted.trial import unittest
from buildbot_travis.vcs import git
class GitUrlParser(unittest.TestCase):
def test_simple(self):
url = "git://github.com/tardyp/buildbot_travis"
parsed = git.ParsedGitUrl(url)
self.assertEqual(parsed.scheme, 'git')
self.assertEqual(parsed.netloc... | tardyp/buildbot_travis | buildbot_travis/tests/test_git.py | Python | mit | 1,156 |
# Copyright 2020 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 applicab... | tombstone/models | research/delf/delf/python/training/datasets/__init__.py | Python | apache-2.0 | 964 |
__author__ = 'Dzmitry'
def test_login(app):
app.session.login("administrator", "root")
assert app.session.is_logged_in_as("administrator") | duskat/python_training_mantis | test/test_login.py | Python | apache-2.0 | 147 |
import wx
import wx.grid
import wx.lib.scrolledpanel
import os
import os.path
import platform
from tools import *
import webbrowser
from threading import Thread
class SuperimpositionPanel(wx.lib.scrolledpanel.ScrolledPanel):
def __init__(self, parent, W, H):
#if (platform.system() == "Windows"):
wx... | schenc3/InteractiveROSETTA | InteractiveROSETTA/scripts/superimposition.py | Python | gpl-2.0 | 19,855 |
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | rnirmal/savanna | savanna/tests/unit/service/test_instances.py | Python | apache-2.0 | 7,244 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.internal_gains import ElectricEquipmentIteAirCooled
log = logging.getLogger(__name__)
class TestElectricEquipmentIteAirCooled(unittest.TestCase):
def setUp(self):
s... | rbuffat/pyidf | tests/test_electricequipmentiteaircooled.py | Python | apache-2.0 | 9,538 |
# -*- coding: utf-8 -*-
'''
Bubbles Addon
Copyright (C) 2016 Exodus
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... | azumimuo/family-xbmc-addon | plugin.video.bubbles/resources/lib/sources/french/hoster/open/filmenstreaminghd.py | Python | gpl-2.0 | 6,888 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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
# not use this file except in compli... | salv-orlando/MyRepo | nova/tests/api/ec2/test_middleware.py | Python | apache-2.0 | 4,748 |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a researchcoind o... | researchcoin/researchcoin | contrib/spendfrom/spendfrom.py | Python | mit | 10,213 |
#!/usr/bin/env python
# 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
# "L... | enachb/mesos | src/scaling/scaling_sched.py | Python | apache-2.0 | 3,197 |
"""
Credit Card Validator - Takes in a credit card number from a
common credit card vendor (Visa, MasterCard, American Express,
Discoverer) and validates it to make sure that it is a valid
number (look into how credit cards use a checksum).
This program works with *most* credit card numbers.
Uses Luhn Algorit... | Informatics43-S14/hw2-projects-126 | Numbers/credit_card_validator.py | Python | mit | 1,652 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditio... | Petr-Kovalev/nupic-win32 | tests/unit/py2/nupic/frameworks/opf/opf_metrics_test.py | Python | gpl-3.0 | 27,219 |
# Database connection config
# The URI most scrapers will use to access the DB
DB_URI = 'sqlite:///db/data.sqlite'
# The read-only URI the server will use to access the DB
DB_URI_READ_ONLY = 'file:db/data.sqlite?mode=ro'
# Server performance config
# Max time an SQL query can take before it's killed
QUERY_TIMEOUT_SECS... | mplewis/narcissa | sample_config.py | Python | mit | 682 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
import frappe.defaults
from frappe.core.page.data_import_tool.data_import_tool import export_csv
import unittest
import os
class TestDataImportFixtures(unittest.Tes... | indictranstech/frappe | frappe/core/page/data_import_tool/test_exporter_fixtures.py | Python | mit | 9,975 |
# -*- coding: utf-8 -*-
import csv
import heapq
import json
import os
import os.path
import sys
import click
from six.moves import input, zip_longest
from .database import (
CaughtDB, Game, Status, NoSuchPokemonError, NoSuchGameError,
)
DEFAULT_DBFILE = os.path.join(os.environ.get("HOME", os.curdir), '.caughtd... | jwodder/caught | caught/__main__.py | Python | mit | 12,026 |
import json, os, shutil
from pprint import pprint
import jinja2
from pprint import pprint as p
# GLOBALS
working_dir = working_directory = os.path.dirname(os.path.realpath(__file__))
json_dir = os.path.join(working_directory, "json")
colorgen_theme_dir = os.path.join(working_directory, "colorgen-Theme")
colorgen_json ... | zinglax/jquerymobile-ThemeRoller-Ripper | JQMT-Ripper.py | Python | gpl-3.0 | 2,863 |
# Copyright (c) 2012 OpenStack Foundation.
# Administrator of the National Aeronautics and Space Administration.
# 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 a... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/openstack/common/eventlet_backdoor.py | Python | gpl-2.0 | 4,798 |
import six
import mimetypes
class RegistryMeta(type):
def __getitem__(meta, key):
return meta._registry[key]
@six.add_metaclass(RegistryMeta)
class GeoIORegistry(type):
_registry = {}
_registry_by_ext = {}
_registry_by_mime = {}
def __new__(meta, name, bases, clsdict):
cls = super(GeoIORegistry, m... | cinepost/Copperfield_FX | copper/core/data/geometry_data/iotranslators/base.py | Python | unlicense | 1,275 |
#!/usr/bin/env python
# Copyright 2011 Google Inc. All Rights Reserved.
"""Tests for grr.parsers.chrome_history."""
import datetime
import os
from grr.lib import flags
from grr.lib import test_lib
from grr.parsers import chrome_history
class ChromeHistoryTest(test_lib.GRRBaseTest):
"""Test parsing of chrome hi... | MiniSEC/GRR_clone | parsers/chrome_history_test.py | Python | apache-2.0 | 2,443 |
import unittest
def bubble_sort(seq):
n=len(seq)-1
for i_corrente in range(n):
for i in range(n):
if seq[i]>seq[i+1]:
seq[i],seq[i+1]=seq[i+1],seq[i]
flag=True
if (flag==False):
break
flag=False
return seq
class OrdenacaoTest... | lucas2109/estruturaDados | aula6/bubble_sort.py | Python | mit | 804 |
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
from geoalchemy import GeometryColumn, LineString, GeometryDDL
engine = create_engine('postgres://michel@localhost/featureserver', echo=False)
session = sessionmaker(bind=engine)()
metadata = MetaData(engine)
... | guolivar/totus-niwa | service/thirdparty/featureserver/tests/geoalchemy_model.py | Python | gpl-3.0 | 605 |
# The absolute import feature is required so that we get the root celery
# module rather than `amo.celery`.
from __future__ import absolute_import
from inspect import isclass
from celery.datastructures import AttributeDict
from tower import ugettext_lazy as _
__all__ = ('LOG', 'LOG_BY_ID', 'LOG_KEEP',)
class _LOG... | jpetto/olympia | src/olympia/amo/log.py | Python | bsd-3-clause | 16,661 |
'''IPA API tests.'''
import unittest
import mock
from treadmill.api import ipa
import subprocess
class ApiIPATest(unittest.TestCase):
'''treadmill.api.ipa tests.'''
def setUp(self):
self.ipa = ipa.API()
def tearDown(self):
pass
def test_add_host(self):
_ipa_result_mock = ... | bretttegart/treadmill | tests/api/ipa_test.py | Python | apache-2.0 | 2,790 |
import unittest2 as unittest
import pymongo
import time
import random
import threading
from oplogreplay import OplogReplayer
SOURCE_HOST = '127.0.0.1:27017'
DEST_HOST = '127.0.0.1:27018'
TESTDB = 'testdb'
# Inherit from OplogReplayer to count number of processed_op methodcalls.
class CountingOplogReplayer(OplogRepl... | uberVU/mongo-oplogreplay | oplogreplay/test/test_oplogreplayer.py | Python | mit | 7,945 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'example_project.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^users/... | cfpb/django-api-test | api_test/tests/example_project/example_project/urls.py | Python | cc0-1.0 | 352 |
import helper
from subprocess import Popen, PIPE
import logging
import os
import time
def createVault(config):
logging.info("Creating vault \"%s\"", config["glacier-vault"])
result = glacierCommand(config, ["mkvault", config["glacier-vault"]])
if result is None or result["code"] != 0:
logging.error("Failed t... | mrworf/iceshelf | modules/glacier.py | Python | gpl-2.0 | 2,059 |
import sys
import os
from distutils.core import setup
if sys.version_info.major >= 3:
print 'Sorry, currently only supports Python 2. Patches welcome!'
sys.exit(1)
setup(
name='browser-cookie',
version='0.6',
packages=['browser_cookie'],
package_dir={'browser_cookie' : '.'}, # look for packag... | JFDesigner/FBAlbumDownloader | browser_cookie/setup.py | Python | gpl-2.0 | 722 |
from .. import db
from purchase import CartItem
from sqlalchemy import or_, desc, func
from ..models import Vendor, User
from sqlalchemy import UniqueConstraint
class Tag(db.Model):
__tablename__ = "tag"
id = db.Column(db.Integer, primary_key=True)
tag_name = db.Column(db.String(1000))
vendors = db.re... | hack4impact/reading-terminal-market | app/models/tag.py | Python | mit | 968 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-08-13 10:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('pages', '0007_video_thumbnail'),
]
operations = [
... | Ignamarte/Movit-2017 | pages/migrations/0008_video_date.py | Python | gpl-3.0 | 547 |
# Copyright 2021 The TF-Coder 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... | google-research/tensorflow-coder | tf_coder_colab_logging/serialization_test.py | Python | apache-2.0 | 2,882 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sound_lib.input, sound_lib.output
import config
import languageHandler
from mysc import restart
from . import base
class configurationPresenter(base.basePresenter):
def __init__(self, session, view, interactor):
self.session = session
... | manuelcortez/socializer | src/presenters/configuration.py | Python | gpl-2.0 | 5,040 |
from .element import Element
class Anchor(Element):
"""Implements the <a> tag"""
def __init__(self, text=None, href="#", cl=None, ident=None, style=None, attrs=None):
super().__init__(cl=cl, ident=ident, style=style, attrs=attrs)
self.href = href
if text:
self._children.... | tryexceptpass/sofi | sofi/ui/anchor.py | Python | mit | 1,243 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | rouge/rouge.py | Python | apache-2.0 | 3,102 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-26 16:21
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0036_auto_20170926_1555'),
]
operations = [
migrations.AlterField(
... | OKThess/website | main/migrations/0037_auto_20170926_1621.py | Python | mit | 630 |
{
'name' : 'Gamification extra',
'version' : '1.0.0',
'author' : 'IT-Projects LLC, Ivan Yelizariev',
'license': 'GPL-3',
'category' : 'Human Resources',
'website' : 'https://yelizariev.github.io',
'description': """
Improvements for gamification module:
* allows don't hide challenge, after ... | ilmir-k/addons-yelizariev | gamification_extra/__openerp__.py | Python | lgpl-3.0 | 649 |
# -*- coding: utf-8 -*-
__author__ = 'bjorskog'
__email__ = 'bjorn.skogtro@gmail.com'
__version__ = '0.1.0'
from .syspower import Client
__all__ = [Client]
| bjorskog/syspower | syspower/__init__.py | Python | isc | 159 |
#
# Taken from http://justcramer.com/2010/12/06/tracking-changes-to-fields-in-django/
#
from django.db.models.signals import post_init
def track_data(*fields):
"""
Tracks property changes on a model instance.
The changed list of properties is refreshed on model initialization
and save.
>>> @trac... | crate-archive/crate-site | crateweb/apps/crate/utils/datatools.py | Python | bsd-2-clause | 2,269 |
# -*- coding: utf-8 -*-
##############################################################################
#
# ECSL Export for HMRC
# Copyright (C) 2015 OpusVL (<http://opusvl.com/>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | OpusVL/odoo-hmrc | account_hmrc_esl_declaration/company.py | Python | agpl-3.0 | 1,295 |
"""Basic functionality of all model parts."""
from abc import ABCMeta
from contextlib import contextmanager
from typing import Any, Dict, Optional
import tensorflow as tf
from neuralmonkey.dataset import Dataset
from neuralmonkey.logging import log
# pylint: disable=invalid-name
FeedDict = Dict[tf.Tensor, Any]
# py... | bastings/neuralmonkey | neuralmonkey/model/model_part.py | Python | bsd-3-clause | 2,608 |
#!/usr/bin/env python2
# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
import argparse
from collections import Counter
import logging
import operator
import os.path
import sys
import time
# Find the best implementation available
try:
from cStringIO import StringIO
except ImportError:
from... | gheinrich/DIGITS-GAN | digits/tools/analyze_db.py | Python | bsd-3-clause | 6,662 |
# This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.io` namespace for importing the functions
# included below.
import warnings
from . import _matlab
__all__ = [ # noqa: F822
'loadmat', 'savemat', 'whosmat', 'byteordercodes'
]
def __dir__():
return __all__
def __... | grlee77/scipy | scipy/io/matlab.py | Python | bsd-3-clause | 756 |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | sunqm/pyscf | pyscf/pbc/lib/test/test_kpts.py | Python | apache-2.0 | 2,033 |
# Copyright © 2020, Joseph Berry, Rico Tabor (opendrop.dev@gmail.com)
# OpenDrop is released under the GNU GPL License. You are free to
# modify and distribute the code, but always under the same license
#
# If you use this software in your research, please cite the following
# journal articles:
#
# J. D. Berry, M. J. ... | jdber1/opendrop | opendrop/app/ift/physical_parameters/physical_parameters.py | Python | gpl-3.0 | 3,810 |
#
# @lc app=leetcode id=599 lang=python3
#
# [599] Minimum Index Sum of Two Lists
#
# https://leetcode.com/problems/minimum-index-sum-of-two-lists/description/
#
# algorithms
# Easy (52.13%)
# Total Accepted: 116.2K
# Total Submissions: 222.6K
# Testcase Example: '["Shogun","Tapioca Express","Burger King","KFC"]\n'... | vermouth1992/Leetcode | python/599.minimum-index-sum-of-two-lists.py | Python | mit | 2,922 |
# -*- coding: utf-8 -*-
"""
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
"""
from .common import *
# DB
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': str(ROOT_DIR.path('dev.sqlite')),
... | ortutay/23andme-phenotypes-hackathon | config/settings/local.py | Python | mit | 1,030 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def add_bluesheet_names(apps, schema_editor):
DocTypeName = apps.get_model('name', 'DocTypeName')
StateType = apps.get_model('doc', 'StateType')
State = apps.get_model('doc', 'State')
#
DocTyp... | wpjesus/codematch | ietf/name/migrations/0002_auto_20150208_1008.py | Python | bsd-3-clause | 1,210 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='statsd_decorators',
version='0.0.1',
description='Decorators for python-statsd',
long_description=readme,
author=... | jjmalina/statsd-decorators | setup.py | Python | bsd-2-clause | 509 |
# Webhooks for external integrations.
from __future__ import absolute_import
from django.utils.translation import ugettext as _
from django.http import HttpRequest, HttpResponse
from typing import Any
from zerver.lib.actions import check_send_message
from zerver.lib.response import json_success, json_error
from zerve... | sonali0901/zulip | zerver/webhooks/codeship/view.py | Python | apache-2.0 | 2,072 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-securitycenter | google/cloud/securitycenter_v1/types/folder.py | Python | apache-2.0 | 1,339 |
{
'name' : 'Signature templates for user emails',
'version' : '1.0.0',
'author' : 'IT-Projects LLC, Ivan Yelizariev',
'license': 'GPL-3',
'category' : 'Social Network',
'website' : 'https://yelizariev.github.io',
'depends' : ['base'],
'data':[
'res_users_signature_views.xml',
... | Antiun/yelizariev-addons | res_users_signature/__openerp__.py | Python | lgpl-3.0 | 443 |
# -*- coding: utf-8 -*-
# Copyright 2012 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
class HttpResponseError(Exception):
"""
Represents an HTTP response error.
"""
def __init__(self, code, reason):
... | lrowe/splinter | splinter/request_handler/status_code.py | Python | bsd-3-clause | 1,827 |
''' dbrev.sql_types_table.SqlTypesTable implements the
Flyweight pattern which handles caching.
'''
import logging
LOG = logging.getLogger(__name__)
# LOG.setLevel(logging.INFO)
# Long lines expected.
# pylint: disable=C0301
# Cyclic imports protected by functions
# pylint: disable=R0401
from freevolv.models.dbr... | genevolv/dbrev | py/freevolv/models/dbrev/sql_types_table.py | Python | bsd-2-clause | 2,682 |
"""
merged implementation of the cache provider
the name cache was not chosen to ensure pluggy automatically
ignores the external pytest-cache
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
from collections import OrderedDict
imp... | txomon/pytest | src/_pytest/cacheprovider.py | Python | mit | 13,168 |
def __bootstrap__():
global __bootstrap__, __loader__, __file__
import sys, pkg_resources, imp
__file__ = pkg_resources.resource_filename(__name__,'Blowfish.so')
del __bootstrap__, __loader__
imp.load_dynamic(__name__,__file__)
__bootstrap__()
| noba3/KoTos | addons/plugin.video.mega/resources/lib/platform_libraries/Linux/64bit/Crypto/Cipher/Blowfish.py | Python | gpl-2.0 | 259 |
# Copyright 2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import res_partner
| mozaik-association/mozaik | mozaik_person/models/__init__.py | Python | agpl-3.0 | 121 |
from os import makedirs
from os.path import abspath, join, isfile, isdir
from twisted.python import logfile
from leap.common.config import get_path_prefix
def getLogPath():
configdir = abspath(join(get_path_prefix(), 'leap'))
if not isdir(configdir):
makedirs(configdir)
log_path = join(configdir... | leapcode/bitmask-dev | src/leap/bitmask/core/logs.py | Python | gpl-3.0 | 574 |
# -*- coding: utf-8 -*-
"""
Tests for core JSON import/export
"""
import json
import logging
import os
import shutil
import time
import unittest
import zipfile
from StringIO import StringIO
from app import current_app as app
from tests.unittests.api.utils import create_event, get_path, create_services, \
create_se... | arpitn30/open-event-orga-server | tests/unittests/api/test_export_import.py | Python | gpl-3.0 | 10,783 |
from test.fixtures import make_test_env
from wsgi_intercept import httplib2_intercept
import wsgi_intercept
import httplib2
import simplejson
def setup_module(module):
make_test_env(module)
httplib2_intercept.install()
wsgi_intercept.add_wsgi_intercept('0.0.0.0', 8080, app_fn)
module.http = httplib2.... | TiddlySpace/tiddlyspace | test/test_web_cors_headers.py | Python | bsd-3-clause | 972 |
# -*- coding: utf-8 -*-
import traceback
from flask import g
from cortex import app
from cortex.lib.errors import fatalerr, logerr, stderr
################################################################################
@app.errorhandler(500)
@app.route('/err500')
def error500(_error):
# Record the error in the ... | southampton/cortex | views/errors.py | Python | gpl-3.0 | 2,180 |
"""Write initial TrueGrid files for one biplane blade station.
Usage
-----
start an IPython (qt)console with the pylab flag:
$ ipython qtconsole --pylab
or
$ ipython --pylab
Then, from the prompt, run this script:
|> %run biplane_blade_lib/prep_stnXX_mesh.py
or
|> import biplane_blade_lib/prep_stnXX_mesh
... | perryjohnson/biplaneblade | biplane_blade_lib/prep_stn18_mesh.py | Python | gpl-3.0 | 30,755 |
import unittest
from bok_choy.web_app_test import WebAppTest
from pages import GitHubSearchPage, GitHubSearchResultsPage
class TestGitHub(WebAppTest):
"""
Tests for the GitHub site.
"""
def setUp(self):
"""
Instantiate the page object.
"""
super().setUp()
self.... | edx/bok-choy | docs/code/round_3/test_search.py | Python | apache-2.0 | 1,017 |
def a(b=4,c=5):
print b,c
a()
a(12,13)
a(b=15,c=16) | janusnic/py-21v | args/2.py | Python | mit | 56 |
#coding=utf-8
people = 30
cars = 40
buses = 15
if cars > people:
print "We should take the cars."
elif cars < people:
print "We should not take the cars."
else:
print"We can't decide."
if buses > cars:
print "That's too many buses."
elif buses < cars:
print "Maybe we could tak... | Jumpers/MysoftAutoTest | Step1-PythonBasic/Practices/dengt/p30_DT.py | Python | apache-2.0 | 499 |
import MapReduce
import sys
"""
Word Count Example in the Simple Python MapReduce Framework
"""
mr = MapReduce.MapReduce()
# =============================
# Do not modify above this line
def mapper(record):
# key: person id
# value: count
mr.emit_intermediate(record[0], 1)
def reducer(key, list_of... | okkhoy/pyDataAnalysis | dataAnalysis/take3/friend_count.py | Python | mit | 1,549 |
"""Search syntax builder"""
from emma.query import operator
class QueryFactory(object):
"""
A collection of search query factories
Usage::
>>> qf = QueryFactory
>>> query1 = qf.eq('member_field:foo', 1) & qf.contains('member_field:bar', '*foo*')
>>> query1.to_tuple()
("a... | myemma/EmmaPython | emma/query/factory.py | Python | mit | 7,459 |
from datetime import datetime
from django.utils.timezone import make_aware
from pytz import UTC
from gore.excs import InvalidAuth
from gore.models import Key
def validate_auth_header(request, project):
try:
auth_header = request.META['HTTP_X_SENTRY_AUTH']
except KeyError:
raise InvalidAuth('... | akx/gentry | gore/auth.py | Python | mit | 1,158 |
# The MIT License.
# Copyright (C) 2017 The Future Shell , DeathSec.
#
# @filename : InstagramPyInstance.py
# @description : creates a new app instance and coordinates with
# InstagramPySession , InstagramPyReports and InstagramPyCLI.
# the main attack script.
import uuid
import time
im... | deathsec/instagram-py | InstagramPy/InstagramPyInstance.py | Python | mit | 7,109 |
import json
from urllib import request
import pymongo
connection = pymongo.MongoClient('mongodb://localhost')
db = connection.reddit
stories = db.stories
# stories.drop()
# req = request.Request('http://www.reddit.com/r/technology/.json')
# req.add_header('User-agent', 'Mozilla/5.0')
# reddit_page = request.urlopen(... | dossorio/python-blog | reddit-data-extractor.py | Python | mit | 891 |
from mendeley.models.annotations import Annotation
from mendeley.resources.base import GetByIdResource, ListResource
class Annotations(GetByIdResource, ListResource):
"""
Top-level resource for accessing annotations.
"""
_url = '/annotations'
def __init__(self, session):
self.session = se... | Mendeley/mendeley-python-sdk | mendeley/resources/annotations.py | Python | apache-2.0 | 2,124 |
#!/usr/bin/env python
# encoding: utf-8
# Copyright (C) 2015 John Törnblom
import logging
import unittest
import os
import sys
import stat
import zipfile
try:
from setuptools import setup
from setuptools import Command
from setuptools.command.build_py import build_py
except ImportError:
from distutils... | john-tornblom/pyrsl | setup.py | Python | gpl-3.0 | 4,688 |
import sys
import time
import ldap
url, binddn, bindpw, basedn, nconns, niters = sys.argv[1:]
conns = []
for ii in xrange(0, int(nconns)):
conn = ldap.initialize(url)
conns.append(conn)
for conn in conns:
conn.simple_bind(binddn, bindpw)
for ii in xrange(0, int(niters)):
for conn in conns:
e... | richm/389-perf-test | nconns.py | Python | gpl-3.0 | 504 |
# -*- coding: utf-8 -*-
import pygame
import random
import os
import classes.board
import classes.extras as ex
import classes.game_driver as gd
import classes.level_controller as lc
class Board(gd.BoardGame):
def __init__(self, mainloop, speaker, config, screen_w, screen_h):
self.lvlc = mainloop.xml_con... | imiolek-ireneusz/eduActiv8 | game_boards/game087.py | Python | gpl-3.0 | 8,831 |
# Copyright 2019 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... | tombstone/models | official/modeling/activations/gelu_test.py | Python | apache-2.0 | 1,402 |
# -*- coding: utf-8 -*-
# code for console Encoding difference. Dont' mind on it
import sys
import imp
imp.reload(sys)
try:
sys.setdefaultencoding('UTF8')
except Exception as E:
pass
import testValue
from popbill import FaxService, PopbillException
faxService = FaxService(testValue.LinkID, testValue.SecretK... | linkhub-sdk/popbill.fax.example.py | listContact.py | Python | mit | 1,623 |
# Copyright 2019 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | brianrodri/oppia | core/domain/classroom_services_test.py | Python | apache-2.0 | 3,494 |
# coding=utf-8
import time
from datetime import datetime, timedelta
import calendar
import random
A_DAY_SECONDS = 24 * 60 * 60
# 2016.4.26
# 输入: date_kind, eg 'last month', 'this month'
# 输出: tuple, type datetime.date eg '2016-03-01' '2016-03-31'
# v1.0.14 edit by Hu Jun #61
def get_date_range(dates, ... | chinapnr/fish_base | fishbase/fish_date.py | Python | mit | 13,453 |
self.description = "System upgrade with conflicts and provides"
sp1 = pmpkg("pkg1", "1.0-2")
sp1.conflicts = ["pkg2"]
sp1.provides = ["pkg2"]
self.addpkg2db("sync", sp1);
sp2 = pmpkg("pkg2", "1.0-2")
self.addpkg2db("sync", sp2)
lp1 = pmpkg("pkg1")
self.addpkg2db("local", lp1)
self.args = "-S %s" % " ".join([p.name ... | terralinux/pacman | test/pacman/tests/sync898.py | Python | gpl-2.0 | 445 |
import re
from django.conf import settings
from django.http import HttpResponsePermanentRedirect
class WebSecureMiddleware:
CONTENT_SECURITY_POLICY_HEADER = 'Content-Security-Policy'
CONTENT_TYPE_OPTIONS_HEADER = 'X-Content-Type-Options'
HSTS_HEADER = 'Strict-Transport-Security'
XSS_PROTECTION_HEADER... | syndbg/django-web-secure | django_web_secure/middleware.py | Python | mit | 2,332 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.