code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
################################################################################
##
## validation_triple.py
## Author: Satoshi Takahama (satoshi.takahama@epfl.ch)
## Jul. 2017
##
## -----------------------------------------------------------------------------
##
## This file is part of APRL-SSP
... | stakahama/aprl-ssp | validation_triple.py | Python | gpl-3.0 | 6,346 |
from datetime import datetime
from unittest import mock
from waffle.testutils import override_switch
from olympia import amo
from olympia.accounts.tasks import (
delete_user_event, primary_email_change_event)
from olympia.accounts.tests.test_utils import totimestamp
from olympia.amo.tests import (
addon_facto... | eviljeff/olympia | src/olympia/accounts/tests/test_tasks.py | Python | bsd-3-clause | 4,069 |
"""Package Install Manager for Python.
This is currently a MacOSX-only strawman implementation.
Despite other rumours the name stands for "Packman IMPlementation".
Tools to allow easy installation of packages. The idea is that there is
an online XML database per (platform, python-version) containing packages
known to... | teeple/pns_server | work/install/Python-2.7.4/Lib/plat-mac/pimp.py | Python | gpl-2.0 | 43,335 |
from src.deenuxapi.deezer.Model import Model
class Artist(Model):
"""
Contains information about an artist.
"""
def __init__(self, id: int, name: str):
"""
Constructor of Artist.
:param id: artist's ID
:param name: artist's name
"""
super().__init__(id... | alexarnautu/deenux | src/deenuxapi/deezer/model/Artist.py | Python | gpl-3.0 | 705 |
'''
negative test for adding image: raw format and raw image
@author: SyZhao
'''
import os
import apibinding.inventory as inventory
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.zstack_test.zstack_test_image as zsta... | zstackorg/zstack-woodpecker | integrationtest/vm/vm_password/test_add_image_neg_raw_raw.py | Python | apache-2.0 | 2,104 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 Lic... | amenonsen/ansible | lib/ansible/modules/network/fortios/fortios_firewall_vip6.py | Python | gpl-3.0 | 46,189 |
# Copyright 2022 The jax3d Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | google-research/jax3d | jax3d/projects/nesf/nerfstatic/integration_test/import_test.py | Python | apache-2.0 | 1,009 |
# 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.
#
# Copyright 2010 OpenStack, LLC
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (th... | juggie/stripe | tools/install_venv.py | Python | apache-2.0 | 2,331 |
# Created By: Virgil Dupras
# Created On: 2012-03-13
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/g... | stuckj/dupeguru | core/gui/ignore_list_table.py | Python | gpl-3.0 | 1,300 |
from abc import abstractmethod
from collections import OrderedDict
from enum import Enum
class DP832:
def __init__(self, instrument):
identification = instrument.query('*IDN?')
if 'DP832' not in identification:
raise ValueError("Instrument identified by {!r} is not a Rigol DP832".form... | sixty-north/dp800 | dp800/dp800.py | Python | mit | 14,714 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from django.db import connection
_survey_sql = """
WITH most_recent_survey AS (
SELECT DISTINCT ON (survey.blockface_id) survey.*
FROM survey_survey AS survey
... | maurizi/nyc-trees | src/nyc_trees/libs/sql.py | Python | agpl-3.0 | 3,143 |
"""Operator classes for eval.
"""
from datetime import datetime
from distutils.version import LooseVersion
from functools import partial
import operator as op
import numpy as np
from pandas._libs.tslibs import Timestamp
from pandas.compat import PY3, string_types, text_type
from pandas.core.dtypes.common import is_... | MJuddBooth/pandas | pandas/core/computation/ops.py | Python | bsd-3-clause | 16,387 |
"""The tests for the sun automation."""
from datetime import datetime
import pytest
from unittest.mock import patch
from homeassistant.const import SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET
from homeassistant.setup import async_setup_component
from homeassistant.components import sun
import homeassistant.components.automat... | PetePriority/home-assistant | tests/components/automation/test_sun.py | Python | apache-2.0 | 10,305 |
#!/usr/bin/env python
# coding: -utf8
if __name__ == '__main__':
print("Press C to convert from Fahrenheit to Celsius.")
print("Press F to convert from Celsius to Fahrenheit.")
choice = input("Your choice: ")
choice = choice.upper()[0]
if choice == "C":
frm = "Fahrenheit"
to = "Cel... | yamanobori-old/LanguageExercises | 18_摂氏華氏変換/python/a.py | Python | mit | 654 |
import numpy as np
import matplotlib.pyplot as plt
import dolfin as df
import ufl
if __name__ == '__main__':
# Number of elements
nel = 200
# Local approximation order
p = 2
# Strength of nonlinearity
a = df.Constant(5.0)
# Construct mesh on [0,1]
mesh = df.IntervalMesh(nel,0,1)
... | gregvw/FEniCS-examples | newton_sys2.py | Python | mit | 2,312 |
import OpenPNM
#Controller object provides oversite to all simulations
ctrl = OpenPNM.Base.Controller()
#initializing the network topology
pn = OpenPNM.Network.Cubic(name='net',shape=[20,5,10])
Ps = pn.pores()
Ts = pn.throats()
#initialize and build a Geometry object
geom = OpenPNM.Geometry.GenericGeometry(network=p... | amdouglas/OpenPNM | Tutorials/Tutorial1.py | Python | mit | 3,523 |
#!/usr/bin/python3
import xml.etree.ElementTree as etree
import configparser
from importlib import import_module
import pprint
from elasticsearch import Elasticsearch
from elasticsearch.helpers import bulk, streaming_bulk, parallel_bulk
def validate_item(item):
return item
def parseXML(xml_file, parser=None, id... | fxarte/es_bulk | xml2es.py | Python | apache-2.0 | 3,146 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-19 05:39
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0002_auto_20161218_2122'),
]
operations = [
migrations.RemoveField(
... | LarryHillyer/PoolHost | PoolHost/app/migrations/0003_remove_nfl_schedule_cronjob.py | Python | gpl-3.0 | 396 |
import re
from DIRAC.AccountingSystem.private.Plotters.BaseReporter import BaseReporter as myBaseReporter
from DIRAC.AccountingSystem.private.TypeLoader import TypeLoader
class PlottersList:
def __init__( self ):
objectsLoaded = TypeLoader().getTypes()
self.__plotters = {}
for objName in objectsLoaded:
... | sposs/DIRAC | AccountingSystem/private/Plotters/__init__.py | Python | gpl-3.0 | 548 |
"""Utilities to help work with log files"""
import os
import re
from robottelo import ssh
from robottelo.config.settings import get_project_root
LOGS_DATA_DIR = os.path.join(get_project_root(), 'data', 'logs')
class LogFile(object):
"""
References a remote log file. The log file will be downloaded to allow
... | danuzclaudes/robottelo | robottelo/log.py | Python | gpl-3.0 | 1,235 |
# Copyright (c) 2011-2012 OpenStack, LLC
# Copyright (c) 2012 Canonical Ltd
# Copyright (c) 2012 SUSE LINUX Products GmbH
# 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 ... | tylertian/Openstack | openstack F/nova/nova/scheduler/filters/image_props_filter.py | Python | apache-2.0 | 3,506 |
"""Welcome cog
Sends welcome DMs to users that join the server.
"""
import os
import logging
import discord
from discord.ext import commands
from __main__ import send_cmd_help # pylint: disable=no-name-in-module
from cogs.utils.dataIO import dataIO
# Requires checks utility from:
# https://github.com/Rapp... | Injabie3/lui-cogs | welcome/welcome.py | Python | gpl-3.0 | 20,055 |
# Copyright 2015 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... | davidzchen/tensorflow | tensorflow/python/framework/function_test.py | Python | apache-2.0 | 61,835 |
from selenese.testcases import TestCase
import unittest
import os
TEST_FILE = os.path.join(os.path.dirname(__file__), 'data', 'testcase.html')
class TestTestCases(unittest.TestCase):
def setUp(self):
# load the testcase
with open(TEST_FILE) as file_pointer:
self.testcase = TestCase(f... | Lukas-Stuehrk/selenese | tests/test_testcases.py | Python | bsd-3-clause | 819 |
# -*- 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-automl | google/cloud/automl_v1/types/data_items.py | Python | apache-2.0 | 8,309 |
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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.... | Chibin/gpdb | src/test/tinc/tincrepo/mpp/gpdb/tests/queries/basic/exttab/errlog/test_errlog.py | Python | apache-2.0 | 2,682 |
from flask import make_response, render_template, session, url_for, request, redirect, g
from application.blueprint import manager as bp
from server_global import db
from form.manager.general import CanonicalDomainForm
@bp.route('/canonical-domain/', methods=['GET', 'POST'])
def canonical_domain():
if not g.acc... | glennyonemitsu/MarkupHiveServer | src/application/manager/view/canonical_domain.py | Python | mit | 833 |
# Copyright (C) 2006, 2007, 2009, 2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED... | cluck/dnspython | dns/e164.py | Python | isc | 3,149 |
"""
Django settings for the admin project.
"""
import os
from urlparse import urlparse
from website import settings as osf_settings
from django.contrib import messages
# import local # Build own local.py (used with postgres)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# Q... | TomHeatwole/osf.io | admin/base/settings/defaults.py | Python | apache-2.0 | 5,822 |
__author__ = 'Guanhua, Joms'
from scipy.io import loadmat, savemat
from numpy import vstack, array
import os
def output_data(key, heading, num_imgs):
arr = []
data = vstack(((heading[key][:, i])[0] for i in range(num_imgs)))
data_mean = data.mean(axis=0).reshape(-1, 1)
data_std = data.std(axis=0).res... | archonren/project | preprocess/split_without_target.py | Python | mit | 1,255 |
# -*- coding: utf-8 -*-
import pytest
import sys
from .as_status_codes import AerospikeStatus
from .index_helpers import ensure_dropped_index
from aerospike import exception as e
aerospike = pytest.importorskip("aerospike")
try:
import aerospike
except:
print("Please install aerospike python client.")
sys... | aerospike/aerospike-client-python | test/new_tests/test_index.py | Python | apache-2.0 | 21,152 |
import sys, json, os, requests, shutil, classes.repository
##everything to do with configuration in a convenient class
class Configuration:
def __init__(self):
'''define all aspects of configuration'''
self.repositories = []
self.platform = ''
self.hostfile = ''
self.patchloc... | zhrts/Private-Peer-Domain-Syndication | classes/config.py | Python | gpl-3.0 | 3,903 |
# Copyright 2014-2015 Ivan Kravets <me@ikravets.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 law or... | bq/web2board | src/platformio/platforms/linux_i686.py | Python | lgpl-3.0 | 1,414 |
# -*- coding: utf-8 -*-
"""
Useful network functions
begin : 2011-03-01
copyright : (C) 2011 by Luiz Motta
author : Luiz P. Motta
email : motta _dot_ luiz _at_ gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published ... | drayanaindra/inasafe | safe_qgis/utilities/proxy.py | Python | gpl-3.0 | 2,139 |
# python 2
from __future__ import absolute_import
# builtins
from unittest import TestCase, main
import sys
from datetime import datetime
from time import time, sleep
from string import digits
from io import StringIO
# custom
from blowdrycss.timing import Timer, LimitTimer
from blowdrycss.utilities import change_sett... | nueverest/BlowDryCSS | blowdrycss/unit_tests/test_timing.py | Python | mit | 3,429 |
'''
Created on Sep 22, 2010
@author: ivan
'''
from gi.repository import Gtk
import logging
from foobnix.fc.fc import FC
from foobnix.util import const
from foobnix.gui.model.signal import FControl
from foobnix.gui.about.about import AboutWindow
from foobnix.util.widget_utils import MenuStyleDecorator
from foobnix.h... | kagel/foobnix | foobnix/gui/menu.py | Python | gpl-3.0 | 9,247 |
def get3Sum(arr):
nums = sorted(arr)
mainList = []
for i in range(len(arr)-2):
if (i > 0) and (nums[i] == nums[i-1]):
continue
j = i + 1
k = len(nums) -1
while (j < k):
if (nums[i] + nums[j] + nums[k] == 0):
innerList = []
innerList.append(nums[i])
innerList.append(nums[j])
innerList.a... | ruchikd/Algorithms | Python/3Sum/3SumOnPart2.py | Python | gpl-3.0 | 720 |
from flask import Blueprint, jsonify, request, session, redirect
from app.extensions import instagram_API as InstagramAPI
auth = Blueprint('auth', __name__)
@auth.route('/authenticate')
def authenticate():
return jsonify({'success': 'True'})
@auth.route('/register')
def register():
return jsonify({'success... | sthoma/gramhammer.com | app/blueprints/auth/views.py | Python | mit | 1,111 |
from SeparationBarrier import IsraelRear, Settler, Palestinian, Barrier, SeparationBarrierModel
from SeparationBarrierGrid import SeparationBarrierGrid
from mesa.visualization.ModularVisualization import ModularServer
from mesa.visualization.modules import CanvasGrid
ISRAELI_COLOR = "#0000FF"
PALESTINIAN_COLOR = "#F... | Avnerus/separationbarrier | SeparationBarrierServer.py | Python | apache-2.0 | 2,600 |
from distutils.core import setup
setup(# package information
name="interfacecosmology",
version="0.0.1dev",
description='A set of utilities to analyze Halo mass function properties',
long_description=''' ''',
# What code to include as packages
packages=['interfacecosmology'],
... | rbiswas4/FluctuationsInCosmology | setup.py | Python | mit | 521 |
"""
Cyclical color scales are appropriate for continuous data that has a natural cyclical \
structure, such as temporal data (hour of day, day of week, day of year, seasons) or
complex numbers or other phase data.
"""
from ._swatches import _swatches
def swatches(template=None):
return _swatches(__name__, global... | plotly/python-api | packages/python/plotly/_plotly_utils/colors/cyclical.py | Python | mit | 3,949 |
"""
TESTS is a dict with all you tests.
Keys for this will be categories' names.
Each test is dict with
"input" -- input data for user function
"answer" -- your right answer
"explanation" -- not necessary key, it's using for additional info in animation.
"""
TESTS = {
"Basics": [
{"input": [3,... | Bryukh-Checkio-Tasks/checkio-task-simple-equation | verification/tests.py | Python | gpl-2.0 | 2,047 |
#!/usr/bin/env python3
# written by sqall
# twitter: https://twitter.com/sqall01
# blog: https://h4des.org
# github: https://github.com/sqall01
#
# Licensed under the GNU Affero General Public License, version 3.
from .eventHandler import ManagerEventHandler
from .screen import Console
from .screenUpdater import Scre... | sqall01/alertR | managerClientConsole/lib/manager/__init__.py | Python | agpl-3.0 | 330 |
# A Magento 2 module generator library
# Copyright (C) 2016 Derrick Heesbeen
# Copyright (C) 2016 Maikel Martens Changed add API and refactor code
#
# This file is part of Mage2Gen.
#
# Mage2Gen is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published b... | krukas/Mage2Gen | mage2gen/snippets/preference.py | Python | gpl-3.0 | 2,479 |
"""Test ZHA Gateway."""
import zigpy.zcl.clusters.general as general
import homeassistant.components.zha.core.const as zha_const
from .common import async_enable_traffic, async_init_zigpy_device
async def test_device_left(hass, config_entry, zha_gateway):
"""Test zha fan platform."""
# create zigpy device
... | Teagan42/home-assistant | tests/components/zha/test_gateway.py | Python | apache-2.0 | 884 |
#!/usr/bin/python
#
# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
# Chris Houseknecht, <house@redhat.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 Soft... | erwilan/ansible | lib/ansible/modules/cloud/azure/azure_rm_networkinterface_facts.py | Python | gpl-3.0 | 7,332 |
"""
Provides a binary sensor which is a collection of ffmpeg tools.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.ffmpeg/
"""
import logging
from os import path
import voluptuous as vol
import homeassistant.helpers.config_validation as c... | varunr047/homefile | homeassistant/components/binary_sensor/ffmpeg.py | Python | mit | 6,634 |
import os as _os
import dash as _dash
import sys as _sys
from .version import __version__
_current_path = _os.path.dirname(_os.path.abspath(__file__))
_components = _dash.development.component_loader.load_components(
_os.path.join(_current_path, 'metadata.json'),
'dash_components_table_own'
)
_this_module = ... | garmoncheg/dash-plugin-TbleOwn | dash_components_table_own/__init__.py | Python | mit | 838 |
import tensorflow as tf
import numpy as np
from .utility import *
class Memory:
def __init__(self, words_num=256, word_size=64, read_heads=4, batch_size=1):
"""
constructs a memory matrix with read heads and a write head as described
in the DNC paper
http://www.nature.com/nature/jo... | HimariO/VideoSum | dnc/memory.py | Python | mit | 27,244 |
"""
iFiltr, Simple & Secure Social Shopping.
Copyright (C) 2012-2013 iFiltr (<https://ifiltr.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
published by the Free Software Foundation, either version 3 of the
... | ifiltr/ifiltr | janrain/api.py | Python | agpl-3.0 | 3,681 |
# coding: utf-8
from __future__ import print_function, absolute_import, division, unicode_literals
import sys
from .compat import no_limit_int # NOQA
from ...ruamel.yaml.anchor import Anchor
if False: # MYPY
from typing import Text, Any, Dict, List # NOQA
__all__ = ['ScalarFloat', 'ExponentialFloat', 'Expone... | RedHatInsights/insights-core | insights/client/apps/ansible/playbook_verifier/contrib/ruamel_yaml/ruamel/yaml/scalarfloat.py | Python | apache-2.0 | 4,409 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookmarks', '0004_auto_20160901_2322'),
]
operations = [
migrations.RunSQL("DROP TABLE bookmarks_bookmark;"),
migrations.RunSQL("ALTER TABLE core_bookmark RENAME TO bookmarks_bookmark;"),
... | tom-henderson/bookmarks | bookmarks/bookmarks/migrations/0005_rename_app.py | Python | mit | 431 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
DeleteScriptAction.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
********************... | kiith-sa/QGIS | python/plugins/processing/gui/DeleteScriptAction.py | Python | gpl-2.0 | 2,091 |
# This script is designed to be run as a Web2Py application:
# python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py
# or
# python web2py.py -S eden -M -R applications/eden/modules/tests/suite.py -A testscript
import sys
import re
import time
import unittest
import argparse
def loadAllTests():
... | ashwyn/eden-message_parser | modules/tests/suite.py | Python | mit | 10,095 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 Intel Corp.
#
import sys
from IPython import get_ipython, start_ipython
from traitlets.config.loader import Config
from .magics import ShellCommands
from datastore import DataStoreBuilder
def start_ipython_shell(datastore_connection='/tmp/cmm'):
cfg = Config()
cf... | intel-ctrlsys/actsys | cmm/cmm/shell.py | Python | apache-2.0 | 2,069 |
class Keyring:
data={}
owner_fingerprint=''
has_changes=False
from getpass import getpass
import sys
try:
import gnupg
except ImportError:
print("missing gnupg")
sys.exit(-1)
import json
try:
from Tkinter import Tk
except ImportError:
from tkinter import Tk
t=Tk()
t.withdraw()
g... | baptistem/gauntlet | gauntlet.py | Python | agpl-3.0 | 4,910 |
from authomatic.providers.oauth2 import OAuth2
import logging
LOGGER = logging.getLogger("PHOENIX")
class CEDAProvider(OAuth2):
""" CEDA oauth2 provider based on classes within the
authomatic.providers.oauth2 package.
"""
user_authorization_url = 'https://slcs.ceda.ac.uk/oauth/authorize'
access_... | bird-house/pyramid-phoenix | phoenix/providers/oauth2.py | Python | apache-2.0 | 1,779 |
#!/usr/bin/env python
"""Tests for grr.lib.rdfvalues.checks."""
import os
import yaml
from grr.lib import config_lib
from grr.lib import flags
from grr.lib import test_lib
from grr.lib.checks import checks as checks_lib
from grr.lib.checks import filters
from grr.lib.rdfvalues import anomaly
from grr.lib.rdfvalues imp... | defaultnamehere/grr | lib/rdfvalues/checks_test.py | Python | apache-2.0 | 8,069 |
# -*- coding: utf8 -*-
#
# 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... | stackforge-attic/tuskar-ui-extras | tuskar_boxes/overview/panel.py | Python | apache-2.0 | 975 |
# When I made this, I was not comletely sure how to make functions, so when it
# doesn't understand the input, it just spits out a line saying it didn't
# understand then moves on.
author = 'Zed A. Shaw'
book = 'Learn Python the Hard Way by %s' % author
print """
Hi dad! This is a little program I wrote
to show you s... | jaredmanning/learning | lpthw/showdad.py | Python | mit | 2,304 |
# Copyright (c) 2015 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... | DavidPurcell/murano_temp | murano/tests/unit/api/v1/test_sessions.py | Python | apache-2.0 | 16,337 |
# -*- coding: utf-8; -*-
#
# Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License"... | crate/crate-python | src/crate/client/sqlalchemy/tests/create_table_test.py | Python | apache-2.0 | 6,206 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class MoovyPipeline(object):
def process_item(self, item, spider):
return item
| miztiik/TamMovie-Recommendation-Engine | moovy/moovy/pipelines.py | Python | mit | 285 |
from rest_framework import status
from rest_framework.reverse import reverse
from rest_framework.test import APITestCase
from measure_mate.models import Tag
from measure_mate.tests.factories import TagFactory
class TagAPITestCases(APITestCase):
def test_list_tags(self):
"""
List all tags and chec... | mvillis/measure-mate | measure_mate/tests/api/test_tag.py | Python | mit | 2,652 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_make_userprofile_user_a_onetoonefield'),
]
operations = [
migrations.AddField(
model_name='userprofile',
name='banned',
... | rtfd/readthedocs.org | readthedocs/core/migrations/0003_add_banned_status.py | Python | mit | 406 |
# coding: utf-8
from __future__ import absolute_import
from m3.actions.context import ActionContext
from m3_ext.ui.base import ExtUIComponent
class BaseExtContainer(ExtUIComponent):
"""
Базовый класс qдля контейнерных компонентов
"""
AUTO = 'auto'
FIT = 'fit'
FORM = 'form'
BORDER = 'bord... | barsgroup/m3-ext | src/m3_ext/ui/containers/base.py | Python | mit | 8,229 |
"""
@package mi.instrument.nortek.vector.ooicore.driver
@file mi/instrument/nortek/vector/ooicore/driver.py
@author Rachel Manoni, Ronald Ronquillo
@brief Driver for the ooicore
Release notes:
Driver for vector
"""
__author__ = 'Rachel Manoni, Ronald Ronquillo'
__license__ = 'Apache 2.0'
import time
import re
import ... | ooici/marine-integrations | mi/instrument/nortek/vector/ooicore/driver.py | Python | bsd-2-clause | 52,475 |
from ckeditor.fields import RichTextField
from adhocracy4.models.base import UserGeneratedContentModel
class ModeratorStatement(UserGeneratedContentModel):
statement = RichTextField(
blank=True,
)
| liqd/adhocracy4 | tests/apps/moderatorfeedback/models.py | Python | agpl-3.0 | 216 |
# Copyright 2019 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | google/next-prediction | code/utils.py | Python | apache-2.0 | 20,529 |
from agent.tests import *
import pylons
import os
import logging
import time
import json
from pylons import config
from subprocess import Popen
from agent.controllers.service import ServiceController
from agent.lib.utils import rchown
from agent.lib.packagemgr import PackageMgr
from agent.tests.unit.test_util import ... | cronuspaas/cronusagent | agent/agent/tests/unit/test_cleanup.py | Python | apache-2.0 | 7,566 |
"""Unit tests for Little Brother."""
| kxz/littlebrother | littlebrother/test/__init__.py | Python | mit | 37 |
#!/usr/bin/env python3
# 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.
"""
This file contains a list of all the tasks, their id and task name, description and the
tags associated with them.
""... | facebookresearch/ParlAI | parlai/tasks/task_list.py | Python | mit | 58,760 |
# Copyright (C) 2016 Tomasz Miasko
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; wit... | tmiasko/pyjags | test/__init__.py | Python | gpl-2.0 | 464 |
import hashlib, itertools
db = {}
def register(username, password):
db[username] = get_md5(password + username + 'the-salt')
def get_md5(s):
md5 = hashlib.md5()
md5.update(s.encode('utf-8'))
return md5.hexdigest()
def login(username, password):
hashstr = get_md5(password + username ... | ianzhengnan/learnpy | hashlib_ext.py | Python | apache-2.0 | 685 |
'''
- Leetcode problem: 200
- Difficulty: Medium
- Brief problem description:
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and
is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all
sur... | bzhou26/leetcode_sol | p200_Number_of_Islands.py | Python | mit | 1,295 |
"""Test methods related to handling project settings."""
from unittest2 import TestCase
from outputs import lamp
class TestLamp(TestCase):
"""Sets up tests"""
def setUp(self):
"""Setup test_lamp fixture"""
self.test_lamp = lamp.Lamp('test_lamp', 17, False)
def tearDown(self):
""... | arunderwood/BasilPi | tests/test_lamp.py | Python | mit | 1,004 |
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import ascii
import scipy.constants as const
from scipy.optimize import curve_fit
import uncertainties.unumpy as unp
from uncertainties import ufloat
from uncertainties.unumpy import (nominal_values as noms, std_devs as stds)
U, f = np.genfromtxt('Rohd... | mwindau/praktikum | v606/Rechnungen.py | Python | mit | 5,124 |
import os
import tempfile
import warnings
try:
from PIL import Image
except ImportError:
Image = None
from django.core.files.storage import FileSystemStorage
from django.db import models
from django.db.models.fields.files import ImageFieldFile, ImageField
from django.utils import six
class Foo(models.Model)... | lecaoquochung/ddnb.django | tests/model_fields/models.py | Python | bsd-3-clause | 9,527 |
"""
Copyright (c) 2017 Genome Research Ltd.
Author: Christopher Harrison <ch12@sanger.ac.uk>
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 ... | wtsi-hgi/irobot | irobot/precache/db/_dbi.py | Python | gpl-3.0 | 6,897 |
import copy
from django.db.models import Q
from django.utils import timezone
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from crowdsourcing import models
from crowdsourcing.crypto import to_hash
from crowdsourcing.serializers.dynamic import DynamicFieldsModelSerializer... | shirishgoyal/crowdsource-platform | crowdsourcing/serializers/project.py | Python | mit | 20,782 |
"""recipeIdentifier.py
This module contains code for creating hashes to identify recipes
based on title & instructions (recipe hash) or based on ingredients (ingredient hash).
The hash_recipe function is a convenience function that provide both a
recipe hash and an ingredient hash.
For individual hashes, use the get... | thinkle/gourmet | gourmet/recipeIdentifier.py | Python | gpl-2.0 | 9,681 |
# -*- coding: utf-8 -*-
#
# File: Division.py
#
# Copyright (c) 2007 by []
# Generator: ArchGenXML Version 1.5.2
# http://plone.org/products/archgenxml
#
# GNU General Public License (GPL)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public ... | uwosh/UWOshCommitteeOnCommittees | content/Division.py | Python | gpl-2.0 | 3,092 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import frappe.website.render
page_title = "Partners"
def get_context(context):
partners = frappe.db.sql("""select * from `tabSales Part... | treejames/erpnext | erpnext/templates/pages/partners.py | Python | agpl-3.0 | 533 |
"""
Platform to retrieve Jewish calendar information for Home Assistant.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.jewish_calendar/
"""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sen... | tinloaf/home-assistant | homeassistant/components/sensor/jewish_calendar.py | Python | apache-2.0 | 4,847 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='basic_base',
name='blood... | aiyyoi/DevFest-MaxBond | tiesable_codes/main/migrations/0002_auto_20150105_0139.py | Python | mit | 2,184 |
import datetime
import json
import logging
from dateutil.parser import parse as dateutil_parse
import pykube.exceptions
import autoscaler.utils as utils
logger = logging.getLogger(__name__)
class KubePodStatus(object):
RUNNING = 'Running'
PENDING = 'Pending'
CONTAINER_CREATING = 'ContainerCreating'
... | gabrieladt/kops-ec2-autoscaler | autoscaler/kube.py | Python | mit | 13,310 |
# Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# unless required by applicable law or a... | rarcotvmw/capirca | lib/policyreader.py | Python | apache-2.0 | 7,920 |
# Generated by Django 3.0.2 on 2020-01-21 09:28
import django.db.models.deletion
import django.utils.timezone
import feincms.extensions.base
import feincms.translations
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
... | feincms/feincms-elephantblog | tests/testapp/migrate/medialibrary/0001_initial.py | Python | bsd-3-clause | 6,050 |
#!/usr/bin/env python
#
# svnauthz_tests.py: testing the 'svnauthz' tool.
#
# Subversion is a tool for revision control.
# See http://subversion.apache.org for more information.
#
# ====================================================================
# Licensed to the Apache Software Foundation (ASF) under one
#... | centic9/subversion-ppa | subversion/tests/cmdline/svnauthz_tests.py | Python | apache-2.0 | 46,930 |
from django import forms
from captcha.fields import CaptchaField
class CaptchaTestForm(forms.Form):
myfield = AnyOtherField()
captcha = CaptchaField()
def some_view(request):
if request.POST:
form = CaptchaTestForm(request.POST)
# Validate the form: the captcha field will automatically
... | Andrew0701/coursework-web | progress/home/captcha.py | Python | apache-2.0 | 497 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-20 13:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0010_testrun_datetime'),
]
operations = [
migrations.AddField(
... | Linaro/squad | squad/core/migrations/0011_testrun_metadata_fields.py | Python | agpl-3.0 | 959 |
from enum import Enum
class ConnectorRelationType(Enum):
SYNAPTIC = "Synaptic"
GAP_JUNCTION = "Gap junction"
TIGHT_JUNCTION = "Tight junction"
DESMOSOME = "Desmosome"
ABUTTING = "Abutting"
ATTACHMENT = "Attachment"
SPATIAL = "Spatial"
OTHER = ""
@classmethod
def from_relation(... | catmaid/catpy | catpy/enums.py | Python | mit | 1,933 |
# -*- coding: utf-8 -*-
#===============================================================================
#
# Copyright 2013 Horacio Guillermo de Oro <hgdeoro@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 ... | hgdeoro/GarnishMyPic | gmp/dnd.py | Python | gpl-3.0 | 4,062 |
#!/usr/bin/env python
import subprocess
import argparse
from vhost_template import *
__status__ = "Development"
class Nginx:
def __init__(self):
self.vhost_root = '/etc/nginx/sites-available/'
self.vhost_root_enabled = '/etc/nginx/sites-enabled/'
def __generate_website_location(self, ws, lo... | thesoulless/nginx-vhosts | vhost.py | Python | mit | 5,136 |
import sublime
import sublime_plugin
import calendar
import datetime
import itertools
NOT_FOUND = sublime.Region(-1, -1)
DONE_SYMBOL = 'X'
NORMAL_SYMBOL = ' '
WEEKEND_SYMBOL = '.'
CALENDAR_WIDTH = 158
TODAY_KEY = 'today'
INITIAL_MESSAGE = ("<Put your goal here that you want to achieve everyday. "
"R... | hc-12/sublime-in-chains | Chains.py | Python | mit | 11,559 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# 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 copyrigh... | nuagenetworks/vspk-python | vspk/v6/fetchers/nuinfrastructuregatewayprofiles_fetcher.py | Python | bsd-3-clause | 2,247 |
#!/usr/bin/python3
# mari von steinkirch @2013
# steinkirch at gmail
def calculate_score(name, dict_letters):
sum_letters = 0
for letter in name:
sum_letters += dict_letters[letter]
return sum_letters
def names_score(filename):
dict_letters ={'A':1,'B':2,'C':3,'D':4,'E':5,'F':6,'G':7,'H':8,'... | bt3gl/Python-and-Algorithms-and-Data-Structures | First_edition_2014/other_resources/Project-Euler/022-names_score.py | Python | mit | 880 |
#!/usr/bin/python
#
# dump_nptdr_routes.py: Convert NPTDR data in ATCO-CIF format into CSV files that relate routes
# to locations.
#
# Copyright (c) 2010 UK Citizens Online Democracy. All rights reserved.
# Email: louise@mysociety.org; WWW: http://www.mysociety.org/
#
import optparse
import sys
import re
import os
im... | mysociety/fixmytransport | script/dump_nptdr_routes.py | Python | agpl-3.0 | 11,513 |
wordlist = ["aardvark",
"aardwolf",
"aaron",
"aback",
"abacus",
"abaft",
"abalone",
"abandon",
"abandoned",
"abandonment",
"abandons",
"abase",
"abased",
"abasement",
"abash",
"abashed",
"abate",
"abated",
"abatement",
"abates",
"abattoir",
"abattoirs",
"abbe",
"abbess",
"abbey",
"abbeys",
"abbot",
"abbots",
"abbreviat... | cathalgarvey/deadlock | deadlock/passwords/wordlist.py | Python | agpl-3.0 | 717,038 |
import struct
from io import BytesIO
def unpack(fmt, buff):
return struct.unpack(fmt, buff)[0]
def bytesToString(bytes):
return bytes.decode('utf-8').rstrip('\0')
def readVLQU(stream):
value = 0
while True:
tmp = ord(stream.read(1))
value = (value << 7) | (tmp & 0x7f)
if tmp &... | McSimp/StarDB | stardb/util.py | Python | mit | 643 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.