text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from celery.task import periodic_task
from celery import shared_task
from eveonline.models import Character, Corporation, Alliance
from eveonline.providers import eve_provider_factory
from datetime import timedelta
@shared_task
def update_character(obj_id, provider=None):
"""
Updates a given character model a... | Adarnof/adarnauth-eveonline | eveonline/tasks.py | Python | gpl-3.0 | 2,156 | 0.000464 |
import abc
import random
import fudge
from contextlib import contextmanager
from ..support.models import *
class BackendTestCaseMixin(object):
__metaclass__ = abc.ABCMeta
@abc.abstractproperty # pragma: no cover
def backend_class(self):
"""backend_class = TestThisBackend"""
def __init__(se... | armstrong/armstrong.core.arm_layout | tests/backends/_common.py | Python | apache-2.0 | 4,747 | 0.000421 |
# Copyright 2016 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 agree... | beomyeol/models | inception/inception/slim/ops.py | Python | apache-2.0 | 18,781 | 0.003408 |
'''
Created on Nov 19, 2011
@author: scottporter
'''
class BaseSingleton(object):
_instance = None
@classmethod
def get_instance(cls):
if cls._instance is None:
cls._instance = cls()
return cls._instance | freneticmonkey/epsilonc | resources/scripts/core/basesingleton.py | Python | mit | 263 | 0.015209 |
##
# @author Brandon Michael
# Roll the dice based on the user's input. Track double rolls and display
# the double totals.
# import the random library
import random
# Set the start and end values the same as a dice
start = 1
end = 6
# Set the running total for doubles found
totalDoubles = 0
# Get the number of tim... | bwmichael/jccc-cis142-python | old/roll-the-dice.py | Python | apache-2.0 | 871 | 0 |
#!/usr/bin/python
# (c) 2012, Elliott Foster <elliott@fourkitchens.com>
# Sponsored by Four Kitchens http://fourkitchens.com.
# (c) 2014, Epic Games, Inc.
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__m... | maxamillion/ansible | test/support/integration/plugins/modules/mongodb_user.py | Python | gpl-3.0 | 16,253 | 0.002953 |
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run(host='0.0.0.0', port=5000, debug=True, threaded=True)
| ipedrazas/dotmarks-api | src/app.py | Python | apache-2.0 | 197 | 0.005076 |
# -*- coding: utf-8 -*-
"""Model unit tests."""
import datetime as dt
import pytest
from hamcwebc.user.models import Role, User
from .factories import UserFactory
@pytest.mark.usefixtures('db')
class TestUser:
"""User tests."""
def test_get_by_id(self):
"""Get user by ID."""
user = User('f... | gurkslask/hamcwebc | tests/test_models.py | Python | bsd-3-clause | 1,951 | 0 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from flask import Flask, request
from flask_ripozo.dispatcher import get_request_query_body_args
import json
import unittest2
class TestDispatcherFlaskIntegration(uni... | vertical-knowledge/flask-ripozo | flask_ripozo_tests/integration/dispatcher.py | Python | gpl-2.0 | 1,809 | 0.001106 |
from collections import defaultdict
from datetime import datetime
import pytz
import simplejson
from ichnaea.data.export import (
MetadataGroup,
ReportUploader,
)
class InternalTransform(object):
# *_id maps a source section id to a target section id
# *_map maps fields inside the section from sour... | therewillbecode/ichnaea | ichnaea/data/internal.py | Python | apache-2.0 | 4,710 | 0 |
import logging
import pymongo
import settings
class Proxy(object):
_db = None
def __getattr__(self, name):
if Proxy._db == None:
# lazily connect to the db so we pickup the right environment settings
mongo_database = settings.get('mongo_database')
print mongo_database
logging.info("con... | AlexanderPease/IntroBot | lib/mongo.py | Python | gpl-3.0 | 653 | 0.02144 |
# AWX settings file
import os
def get_secret():
if os.path.exists("/etc/tower/SECRET_KEY"):
return open('/etc/tower/SECRET_KEY', 'rb').read().strip()
ADMINS = ()
STATIC_ROOT = '/var/lib/awx/public/static'
PROJECTS_ROOT = '/var/lib/awx/projects'
AWX_ANSIBLE_COLLECTIONS_PATHS = '/var/lib/awx/vendor/aw... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/installer/roles/image_build/files/settings.py | Python | apache-2.0 | 2,976 | 0.00168 |
# SPDX-License-Identifier: GPL-2.0
#
# Copyright 2019 Google LLC.
import gdb
import zlib
from linux import utils
class LxConfigDump(gdb.Command):
"""Output kernel config to the filename specified as the command
argument. Equivalent to 'zcat /proc/config.gz > config.txt' on
a running target"""
... | gazoo74/linux | scripts/gdb/linux/config.py | Python | gpl-2.0 | 1,302 | 0 |
"""
Copyright 2013 Steven Diamond
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | SteveDiamond/cvxpy | cvxpy/reductions/complex2real/atom_canonicalizers/constant_canon.py | Python | gpl-3.0 | 912 | 0 |
#!/usr/bin/env python
"""
@file checkSvnProps.py
@author Michael Behrisch
@date 2010
@version $Id: checkSvnProps.py 14493 2013-08-24 21:24:04Z behrisch $
Checks svn property settings for all files.
SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
Copyright (C) 2010-2013 DLR (http://www.dlr.de/) and... | cathyyul/sumo | tools/build/checkSvnProps.py | Python | gpl-3.0 | 6,649 | 0.004061 |
import django
import sys
import os
sys.path.append('/tmp/neuropower-web/neuropower')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.settings'
django.setup()
from neurodesign import design, experiment, population, generate, msequence, report
from sqlalchemy.exc import OperationalError, DatabaseError
from django.core.... | neuropower/neuropower | neuropower/apps/designtoolbox/batch/neurodesign.py | Python | mit | 6,551 | 0.009312 |
# This program extracts UF email addresses from a CSV file and prints them organized by class sections.
import os
import re
COURSE_NAME = "EEE3308C"
def extractEmailAddress(list):
for item in list:
if "@ufl.edu" in item:
return item
raise RuntimeError
def extractCVSInfo(namePattern):
... | Babtsov/Python-Scripts | emailExtract.py | Python | mit | 2,106 | 0.006648 |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the ... | flyapen/UgFlu | flumotion/admin/gtk/overlaystep.py | Python | gpl-2.0 | 5,429 | 0.000553 |
from operator import itemgetter
from itertools import groupby
def groupby2(cols, lst, lev=0):
if not cols:
return str(list(lst))
keyfun = itemgetter(cols[0])
srted = sorted(list(lst), key=keyfun)
output = ""
for key, iter in groupby(srted, key=keyfun):
output += "\n"+" "*lev+"%10... | ActiveState/code | recipes/Python/535129_Groupby_hierarchy_tree/recipe-535129.py | Python | mit | 396 | 0.007576 |
from sequana import Quality
from sequana import phred
def test_quality():
q = Quality('ABC')
q.plot()
assert q.mean_quality == 33
q = phred.QualitySanger('ABC')
q = phred.QualitySolexa('ABC')
def test_ascii_to_quality():
assert phred.ascii_to_quality("!") == 0
assert phred.ascii_to_qual... | sequana/sequana | test/test_phred.py | Python | bsd-3-clause | 1,451 | 0.002757 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import test_expectations
# Valid expectation conditions are:
#
# Operating systems:
# win, xp, vista, win7, mac, leopard, snowleopard, lion, mountainlio... | Just-D/chromium-1 | content/test/gpu/gpu_tests/gpu_test_expectations.py | Python | bsd-3-clause | 3,819 | 0.006546 |
import collections
import functools
import hashlib
import logging
import socket
from django.conf import settings
from django.core.cache import cache as default_cache, get_cache, parse_backend_uri
from django.core.cache.backends.base import InvalidCacheBackendError
from django.utils import encoding, translation
try:
... | jicksy/oneanddone_test | vendor-local/lib/python/caching/invalidation.py | Python | mpl-2.0 | 7,039 | 0.000142 |
# -*- coding: iso-8859-1 -*-
#
# This file is part of GNU Enterprise.
#
# GNU Enterprise 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, or (at your option) any later version.
#
# GNU Enter... | HarmonyEnterpriseSolutions/harmony-platform | src/gnue/common/utils/FileUtils.py | Python | gpl-2.0 | 1,224 | 0.001634 |
#!/usr/bin/env python
from setuptools import setup, find_packages
import subprocess
import os
__doc__ = """
App for Django to allow using datetime objects over integer fields.
"""
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
STAGE = 'alpha'
version = (0, 1, 1, STAGE)
de... | simpleenergy/epochdatetimefield | setup.py | Python | mit | 1,135 | 0.003524 |
#!/usr/bin/env python3
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "houseofdota.production_settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| lucashanke/houseofdota | manage.py | Python | mit | 266 | 0.003759 |
# -*- coding: utf-8 -*-
#
# Tax Calculator documentation build configuration file, created by
# sphinx-quickstart on Mon Mar 9 17:06:10 2015.
#
# 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
# autogenerated file... | rkuchan/Tax-Calculator | docs/source/conf.py | Python | mit | 11,210 | 0.00678 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 B1 Systems GmbH
#
# 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
#... | ikargis/horizon_fod | openstack_dashboard/dashboards/admin/hypervisors/tables.py | Python | apache-2.0 | 3,056 | 0 |
# Copyright 2012 the rootpy developers
# distributed under the terms of the GNU General Public License
from __future__ import absolute_import
import ROOT
from . import log; log = log[__name__]
from .. import QROOT, asrootpy
from ..base import NamedObject
from ..extern.six import string_types
__all__ = [
'DataSet... | kreczko/rootpy | rootpy/stats/dataset.py | Python | gpl-3.0 | 1,394 | 0.005022 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('hs_app_timeseries', '0001_initial'),
]
operations = [
migrations.DeleteModel('TimeSeriesResource'),
]
| RENCI/xDCIShare | hs_app_timeseries/migrations/0002_auto_20150813_1247.py | Python | bsd-3-clause | 302 | 0 |
from PETScMatOps import *
| wathen/PhD | MHD/FEniCS/MyPackage/PackageName/PETScFunc/__init__.py | Python | mit | 26 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-09-28 18:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('financialaid', '0005_switch_jsonfield'),
]
operatio... | mitodl/micromasters | financialaid/migrations/0006_update_tierprogram.py | Python | bsd-3-clause | 574 | 0.001742 |
#problem 4
import math
def isPalidrome(test):
return str(test) == str(test)[::-1] #op extended slicing feature
max = 0
for i in range(999,99,-1):
for j in range(999,99,-1):
prod = i*j
if isPalidrome(prod) and prod > max:
max = prod
print max | Lonkal/ProjectEuler | problem4.py | Python | mit | 255 | 0.058824 |
def a(*args, **kwargs):
print("hello world")
| softwaremechanic/Miscellaneous | Python/hw.py | Python | gpl-2.0 | 49 | 0 |
'''
@author: frank
'''
import sys, os, os.path
from zstacklib.utils import log
from zstacklib.utils import linux
import zstacklib.utils.iptables as iptables
pidfile = '/var/run/zstack/ceph-primarystorage.pid'
log.configure_log('/var/log/zstack/ceph-primarystorage.log')
logger = log.get_logger(__name__)
import cephage... | zstackorg/zstack-utility | cephprimarystorage/cephprimarystorage/cdaemon.py | Python | apache-2.0 | 1,450 | 0.006897 |
"""Install script for the dialogKit Package.
This script installs a _link_ to the current location
of dialogKit. It does not copy anything. It also means that
if you move your dialogKit folder, you'll have to run the
install script again.
"""
from distutils.sysconfig import get_python_lib
import os, sys
def instal... | typesupply/dialogKit | install.py | Python | mit | 852 | 0.014085 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import urllib
import zlib
import zipfile
import math
import sys
import json
import time
import bz2
import gzip
import binascii
import requests
import random
from subprocess import *
import subprocess
import threading
import MySQLdb # See http:/... | jpoullet2000/cgs-benchmarks | hbase-benchmarks/hbase_import_process.py | Python | apache-2.0 | 21,976 | 0.011058 |
import requests
from requests import Session
from requests.exceptions import HTTPError
try:
from urllib.parse import urlencode, quote
except:
from urllib import urlencode, quote
import json
import math
from random import uniform
import time
from collections import OrderedDict
from sseclient import SSEClient
im... | ininex/geofire-python | resource/lib/python2.7/site-packages/pyrebase/pyrebase.py | Python | mit | 21,697 | 0.001751 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
import logging
from json import loads, dumps
from datetime import da... | wking/thumbor | thumbor/storages/redis_storage.py | Python | mit | 4,944 | 0 |
#!/usr/bin/python
import scapy
#import scapy_ex
import os,sys
import printerInfo
import enum
from enum import Enum
from scapy.all import *
import time, datetime
#from time import sleep
class Message(Enum):
AUTH = "0"
DEAUTH = "1"
PROBE_REQ = "2"
PROBE_RESP = "3"
HAND_SUCC = "4"
HAND_F... | nananan/Cinnamon | analyzePackage.py | Python | gpl-3.0 | 39,675 | 0.009679 |
# -*- 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-secret-manager | samples/generated_samples/secretmanager_v1_generated_secret_manager_service_set_iam_policy_sync.py | Python | apache-2.0 | 1,501 | 0.000666 |
# Write Python code to print out how far light travels
# in centimeters in one nanosecond. Use the variables
# defined below.
speed_of_light = 299792458 # meters per second
meter = 100 # one meter is 100 centimeters
nanosecond = 1.0/1000000000 # one billionth of a second
print speed_of_light... | ezralalonde/cloaked-octo-sansa | 01/qu/02.py | Python | bsd-2-clause | 342 | 0.005848 |
"""Provides helper classes for testing option handling in pip
"""
import os
from pip._internal.cli import cmdoptions
from pip._internal.cli.base_command import Command
from pip._internal.commands import commands_dict
class FakeCommand(Command):
name = 'fake'
summary = name
def main(self, args):
... | techtonik/pip | tests/lib/options_helpers.py | Python | mit | 792 | 0 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2014 Alex Forencich
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... | elopezga/ErrorRate | ivi/lecroy/lecroyBaseScope.py | Python | mit | 71,778 | 0.00255 |
#!/usr/bin/env python
#
"""
These functions, when given a magnitude mag between cmin and cmax, return
a colour tuple (red, green, blue). Light blue is cold (low magnitude)
and yellow is hot (high magnitude).
"""
import math
def floatRgb(mag, cmin, cmax, alpha=1.0):
"""
Return a tuple of floats between ... | cliburn/flow | src/plugins/visual/TwoDFrame/colormap.py | Python | gpl-3.0 | 1,367 | 0.027067 |
# Exercise 3
#
# Create a "back door" in the Critter Caretaker program that shows the exact values of the object's attributes.
# Accomplish this by printing the object when a secret selection, not listed in the menu, is entered as the user's
# choice. (Hint: add the special method __str__() to the Critter class.)
#
cl... | dmartinezgarcia/Python-Programming | Chapter 8 - Software Objects/exercise_3.py | Python | gpl-2.0 | 2,406 | 0.006234 |
# Copyright (c) 2011 OpenStack Foundation
#
# 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 ... | orbitfp7/nova | nova/compute/utils.py | Python | apache-2.0 | 19,092 | 0.000262 |
from unittest import mock
from aiohttp import web
from aiohttp.web_urldispatcher import View
async def test_render_ok():
resp = web.Response(text='OK')
class MyView(View):
async def get(self):
return resp
request = mock.Mock()
request._method = 'GET'
resp2 = await MyView(req... | singulared/aiohttp | tests/test_py35/test_cbv35.py | Python | apache-2.0 | 351 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012,2013 Thibault VINCENT <tibal@reloaded.fr>
#
# This file is part of Agipibi.
#
# Agipibi 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, e... | LunarLanding/agipibi | python/example_tektronix_2432.py | Python | gpl-3.0 | 6,565 | 0.003809 |
#!/usr/bin/env python3
"""
make_confidence_report_bundle_examples.py
Usage:
make_confidence_report_bundle_examples.py model.joblib a.npy
make_confidence_report_bundle_examples.py model.joblib a.npy b.npy c.npy
where model.joblib is a file created by cleverhans.serial.save containing
a picklable cleverhans.mode... | openai/cleverhans | scripts/make_confidence_report_bundle_examples.py | Python | mit | 4,354 | 0.008268 |
# Copyright (C) 2012 Bastian Kleineidam
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distribute... | linkcheck/linkchecker | tests/checker/telnetserver.py | Python | gpl-2.0 | 3,383 | 0.000887 |
import zerorpc
import gevent.queue
import logging
import sys
logging.basicConfig()
# root logger
logger = logging.getLogger()
# set the mimimum level for root logger so it will be possible for a client
# to subscribe and receive logs for any log level
logger.setLevel(0)
class QueueingLogHandler(logging.Handler):
... | benctamas/zerorpc-logging | logstream_test.py | Python | apache-2.0 | 3,399 | 0.006472 |
#!/usr/bin/env python3
# Copyright (c) 2013-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Generate seeds.txt from Pieter's DNS seeder
#
import re
import sys
import dns.resolver
import collect... | deeponion/deeponion | contrib/seeds/makeseeds.py | Python | mit | 8,058 | 0.003723 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2019 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eith... | dontnod/weblate | weblate/fonts/admin.py | Python | gpl-3.0 | 1,510 | 0 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.rst') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='judge_offline',
version='0.1.0',
description='Provides personal judge similar hackrank or judge online',
long_descri... | yanndavin/judge_offline | setup.py | Python | bsd-2-clause | 532 | 0.00188 |
"""Tasks for invoke."""
from invoke import task, run
@task
def test():
run('./setup.py test --quick')
@task
def fulltest():
run('./setup.py test')
@task
def coverage():
run('./setup.py test', hide='stdout')
run('coverage html')
| beregond/jsonmodels | tasks.py | Python | bsd-3-clause | 251 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import (
force_text, python_2_unicode_compatible)
from django.utils.translation import ugettext_lazy as _
from select_multiple_field.models import Se... | kelvinwong-ca/django-select-multiple-field | test_projects/django14/suthern/models.py | Python | bsd-3-clause | 1,575 | 0 |
# bottle_preferences.py
#
# Copyright 2020 brombinmirko <send@mirko.pm>
#
# 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 later version... | mirkobrombin/Bottles | src/views/bottle_preferences.py | Python | gpl-3.0 | 30,960 | 0.001227 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_cond_format01.py | Python | bsd-2-clause | 1,643 | 0.000609 |
import pandas
from ExternalParsersHookUp import RakuCommandFunctions
from ExternalParsersHookUp import ParseWorkflowSpecifications
dfStarwars = pandas.read_csv("https://raw.githubusercontent.com/antononcube/R-packages/master/DataQueryWorkflowsTests/inst/extdata/dfStarwars.csv")
dfStarwarsFilms = pandas.read_csv("https... | antononcube/ConversationalAgents | Packages/Python/ExternalParsersHookUpApp/examples.py | Python | gpl-3.0 | 1,315 | 0.004563 |
import boto
import argparse
try:
import urllib2
except ImportError: # Python 3
import urllib.request as urllib2
from awsutil.logger import logger
def set_public_record():
parser = argparse.ArgumentParser(description="Updates DNS records")
parser.add_argument(
"--address",
default=url... | opalmer/aws | awsutil/dns.py | Python | mit | 1,168 | 0.000856 |
# Copyright 2015 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.
from __future__ import print_function
from __future__ import absolute_import
import contextlib
import logging
import os
import py_utils
from py_utils import... | catapult-project/catapult | telemetry/telemetry/internal/util/binary_manager.py | Python | bsd-3-clause | 9,298 | 0.008496 |
# -*- coding: utf-8 -*-
"""Module to determine the pywikibot version (tag, revision and date)."""
#
# (C) Merlijn 'valhallasw' van Deen, 2007-2014
# (C) xqt, 2010-2015
# (C) Pywikibot team, 2007-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__versi... | darthbhyrava/pywikibot-local | pywikibot/version.py | Python | mit | 18,495 | 0.000162 |
import argparse
# parse argument
import datetime
from tinydb import TinyDB
import config
parser = argparse.ArgumentParser(description='Refill Gold To Bot')
parser.add_argument('-n', help='Number of credits', required=True)
parser.add_argument('-c', help='Currency', required=True)
parser.add_argument('-p', help='Pric... | magayorker/magatip | scripts/add_gold.py | Python | mit | 735 | 0 |
"""Core XML support for Python.
This package contains four sub-packages:
dom -- The W3C Document Object Model. This supports DOM Level 1 +
Namespaces.
parsers -- Python wrappers for XML parsers (currently only supports Expat).
sax -- The Simple API for XML, developed by XML-Dev, led by David
Megginso... | ekristen/mythboxee | xml/__init__.py | Python | mit | 1,360 | 0.000735 |
# Copyright (c) 2013 Qubell Inc., http://qubell.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 agr... | ysarbaev/contrib-python-qubell-client | qubell/api/public/application.py | Python | apache-2.0 | 5,682 | 0.003872 |
# ==============================================================================
# Copyright 2019 - Philip Paquette
#
# NOTICE: 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 rest... | diplomacy/research | diplomacy_research/models/draw/tests/draw_model_test_setup.py | Python | mit | 7,985 | 0.004634 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2017-01-10 08:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Documen... | SJIT-Hackerspace/SJIT-CodingPortal | QuestionDumps/migrations/0001_initial.py | Python | apache-2.0 | 823 | 0.003645 |
#!/usr/bin/env python3
import sys
import argparse
def parse_arguments():
""" parse the arguments """
p = argparse.ArgumentParser()
p.add_argument(
"--words-file",
help="file with list of words [/usr/share/dict/words]",
default="/usr/share/dict/words",
)
p.add_argument(
... | audy/domain-name-generator | tld.py | Python | mit | 2,280 | 0.001754 |
# The purpose of these tests are to ensure that calling ufuncs with quantities
# returns quantities with the right units, or raises exceptions.
import warnings
import pytest
import numpy as np
from numpy.testing.utils import assert_allclose
from ... import units as u
from ...tests.helper import raises
from ...extern... | AustereCuriosity/astropy | astropy/units/tests/test_quantity_ufuncs.py | Python | bsd-3-clause | 38,162 | 0.000079 |
#!/usr/bin/python3
#
# tBB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# tBB is distributed in the hope that it will be useful,
#... | dpdani/tBB | tBB/settings.py | Python | gpl-3.0 | 7,813 | 0.002048 |
# -*- coding: utf-8 -*-
"""
A Cell
A cell is a single input/output block. Worksheets are built out of
a list of cells.
"""
###########################################################################
# Copyright (C) 2006 William Stein <wstein@gmail.com>
#
# Distributed under the terms of the GNU General Public ... | bollu/sagenb | sagenb/notebook/cell.py | Python | gpl-3.0 | 82,188 | 0.002569 |
import os
from setuptools import setup
# you'd add this, too, for `python setup.py test` integration
from setuptools.command.test import test as TestCommand
class NosebookTestCommand(TestCommand):
def run_tests(self):
# Run nose ensuring that argv simulates running nosetests directly
import nose
... | bollwyvl/nosebook | setup.py | Python | bsd-3-clause | 1,949 | 0 |
# -*- coding: utf-8 -*-
"""
celery.canvas
~~~~~~~~~~~~~
Composing task workflows.
Documentation for these functions are in :mod:`celery`.
You should not import from this module directly.
"""
from __future__ import absolute_import
from copy import deepcopy
from functools import partial as _partia... | mozilla/firefox-flicks | vendor-local/lib/python/celery/canvas.py | Python | bsd-3-clause | 14,524 | 0.000413 |
#!flask/bin/python
from flask.ext.mail import Message
from app import app, mail
from config import ADMINS
msg = Message('test subject', sender = ADMINS[0], recipients = ADMINS)
msg.body = 'text body'
msg.html = '<b>HTML</b> body'
with app.app_context():
mail.send(msg)
| trudikampfschaf/flask-microblog | mail.py | Python | bsd-3-clause | 273 | 0.014652 |
# -*- coding: utf-8 -*-
import cv2
# device number "0"
cap = cv2.VideoCapture(0)
while(True):
# Capture a frame
ret, frame = cap.read()
# show on display
cv2.imshow('frame',frame)
# waiting for keyboard input
key = cv2.waitKey(1) & 0xFF
# Exit if "q" pressed
if key == ord('q'):
break
# Save if "s" pres... | tomoyuki-nakabayashi/ICS-IoT-hackathon | sample/python-camera/python-camera.py | Python | mit | 475 | 0.035789 |
from __future__ import absolute_import
import urllib
from django import forms
DEFAULT_DATE_FORMATS = ["%d/%m/%Y"]
DEFAULT_TIME_FORMATS = ["%H:%M"]
class RevisionsFilteringForm(forms.Form):
from_date = forms.SplitDateTimeField(label="From",
required=False,
... | ox-it/talks.ox | talks/audit_trail/forms.py | Python | apache-2.0 | 812 | 0.002463 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# Plural-Forms for af (Afrikaans (South Africa))
nplurals=2 # Afrikaans language has 2 forms:
# 1 singular and 1 plural
# Determine plural_id for number *n* as sequence of positive
# integers: 0,1,...
# NOTE! For singular form ALWAYS return plural_id = 0
get_p... | manuelep/openshift_v3_test | wsgi/web2py/gluon/contrib/plural_rules/af.py | Python | mit | 598 | 0.006689 |
import sys
def get_civ_leader(civ_leader_file):
"""Reads in a file with civs mapped to leaders and add it to a dict.
"""
return {leader.strip('\n'): country
for line in civ_leader_file
for (country, leader) in [line.split('\t')]}
def get_all_names(civ_leader):
"""Reads in all ... | vincentrose88/civAdder | civ_battleroyal_leader_civ_adder.py | Python | mit | 3,793 | 0.006327 |
#!/usr/bin/python
# Writer (c) 2012, MrStealth
# Rev. 1.1.1
# License: Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0)
# -*- coding: utf-8 -*-
import os
import sqlite3 as sqlite
import xbmcaddon
import xbmc
__addon__ = xbmcaddon.Addon(id='plugin.video.unified.search')
#addon_path = __addon__.getAd... | dandygithub/kodi | addons/DEPRECATED/plugin.video.unified.search/resources/lib/search_db.py | Python | gpl-3.0 | 3,245 | 0.005855 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author Stephan Reith
@date 31.08.2016
This is a simple example to demonstrate how the ROS Spinnaker Interface can be used.
You will also need a ROS Listener and a ROS Talker to send and receive data.
Make sure they communicate over the same ROS topics and std_msgs.... | reiths/ros_spinnaker_interface | examples/example_ros_spinnaker_interface.py | Python | mit | 2,533 | 0.006317 |
from django.contrib import admin
from mc2.controllers.base.models import Controller
class ControllerAdmin(admin.ModelAdmin):
search_fields = ('state', 'name')
list_filter = ('state',)
list_display = ('name', 'state', 'organization')
list_editable = ('organization',)
readonly_fields = ('state', 'o... | praekelt/mc2 | mc2/controllers/base/admin.py | Python | bsd-2-clause | 378 | 0 |
import pytest
from gaphas.painter import BoundingBoxPainter
from gaphas.view import GtkView
from gaphor.diagram.painter import ItemPainter
from gaphor.diagram.selection import Selection
from gaphor.diagram.tests.fixtures import diagram, element_factory, event_manager
@pytest.fixture
def view(diagram):
view = Gtk... | amolenaar/gaphor | gaphor/diagram/diagramtools/tests/conftest.py | Python | lgpl-2.1 | 570 | 0.001754 |
#!/usr/bin/env python2
"""Implement a visuospatial working memory task
described in Mason et al., Science 2007 (doi: 10.1126/science.1131295)"""
# FourLetterTask.py
# Created 12/17/14 by DJ based on SequenceLearningTask.py
# Updated 11/9/15 by DJ - cleanup, instructions
from psychopy import core, visual, gui, data, ... | djangraw/PsychoPyParadigms | BasicExperiments/FourLetterTask.py | Python | mit | 9,655 | 0.020818 |
# -*- coding: utf-8 -*-
"""Family module for Meta Wiki."""
#
# (C) Pywikibot team, 2005-2018
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
from pywikibot import family
# The meta wikimedia family
class Family(family.WikimediaOrgFamily):
"""Family ... | Wesalius/EloBot | pywikibot/families/meta_family.py | Python | gpl-3.0 | 641 | 0 |
from typing import Dict
import tempfile
from dxlclient.client_config import DxlClientConfig
from dxlclient.client import DxlClient
from dxlclient.broker import Broker
from dxlclient.message import Event
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
INTEGRATION_NAM... | VirusTotal/content | Packs/McAfee_DXL/Integrations/McAfee_DXL/McAfee_DXL.py | Python | mit | 7,105 | 0.002252 |
# Copyright 2015 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 logging
import re
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
from telemetry import story
from devil... | ds-hwang/chromium-crosswalk | tools/perf/page_sets/memory_health_story.py | Python | bsd-3-clause | 3,234 | 0.007112 |
#!/usr/bin/env python
import sys,os
import textwrap
def print_header():
print textwrap.dedent("""\
##fileformat=VCFv4.1
##phasing=none
##INDIVIDUAL=TRUTH
##SAMPLE=<ID=TRUTH,Individual="TRUTH",Description="bamsurgeon spike-in">
##INFO=<ID=CIPOS,Number=2,Type=Integer,Description="Confidence inte... | MischaLundberg/bamsurgeon | scripts/makevcf.py | Python | mit | 2,120 | 0.010377 |
#!/usr/bin/env python2
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import array
import binascii
import zmq
import struct
port = 25332
zmqContext = zmq.Context()
zmqSubSoc... | magacoin/magacoin | contrib/zmq/zmq_sub.py | Python | mit | 1,425 | 0.002105 |
"""
Copyright 2007 Alaa Salman <alaa@codedemigod.com>
This file is part of TaskIt.
TaskIt 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... | alaasalman/taskit | TIAboutDialog.py | Python | gpl-3.0 | 2,548 | 0.008634 |
import os
import sys
import logging
import uuid
import re
import json
import string
import tornado.web
import tornado.escape
import urlparse
import urllib
import Levenshtein
from controller.base import *
from module.todo_entity import TodoMatchEntity
_todo_prefix = "t:"
_person_prefix = "p:"
_friend_prefix = "f:"... | xiangcai/todother | controller/search.py | Python | lgpl-3.0 | 3,591 | 0.011139 |
try:
from setuptools import setup, Extension
from setuptools.command import install_lib as _install_lib
except ImportError:
from distutils.core import setup, Extension
from distutils.command import install_lib as _install_lib
from codecs import open
from os import path
from os import environ
from sys import pla... | jruizgit/rules | setup.py | Python | mit | 2,665 | 0.011632 |
import bpy
from bpy.props import *
from bpy.types import Node, NodeSocket
from arm.logicnode.arm_nodes import *
class PlaySoundNode(Node, ArmLogicTreeNode):
'''Play sound node'''
bl_idname = 'LNPlaySoundRawNode'
bl_label = 'Play Sound'
bl_icon = 'QUESTION'
property0: PointerProperty(name='', type=... | luboslenco/cyclesgame | blender/arm/logicnode/sound_play_sound.py | Python | lgpl-3.0 | 652 | 0.004601 |
DVC_CHECKPOINT = "DVC_CHECKPOINT"
DVC_DAEMON = "DVC_DAEMON"
DVC_PAGER = "DVC_PAGER"
DVC_ROOT = "DVC_ROOT"
DVCLIVE_PATH = "DVCLIVE_PATH"
DVCLIVE_SUMMARY = "DVCLIVE_SUMMARY"
DVCLIVE_HTML = "DVCLIVE_HTML"
DVCLIVE_RESUME = "DVCLIVE_RESUME"
DVC_IGNORE_ISATTY = "DVC_IGNORE_ISATTY"
DVC_EXP_GIT_REMOTE = "DVC_EXP_GIT_REMOTE"
DV... | dmpetrov/dataversioncontrol | dvc/env.py | Python | apache-2.0 | 396 | 0 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | google-research/language | language/conpono/evals/run_finetune_coherence.py | Python | apache-2.0 | 18,761 | 0.005863 |
#!/usr/bin/env python
#
# This file is part of dnf.
#
# Copyright 2015 (C) Igor Gnatenko <i.gnatenko.brain@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the Li... | kudlav/dnf | dnf/cli/completion_helper.py | Python | gpl-2.0 | 6,785 | 0.002211 |
"""Additional helper functions for the optlang solvers.
All functions integrate well with the context manager, meaning that
all operations defined here are automatically reverted when used in a
`with model:` block.
The functions defined here together with the existing model functions
should allow you to implement cus... | opencobra/cobrapy | src/cobra/util/solver.py | Python | gpl-2.0 | 21,838 | 0.000687 |
import pycountry
from Acquisition import aq_parent
from castle.cms.fragments.interfaces import IFragmentsDirectory
from castle.cms.browser.survey import ICastleSurvey
from plone import api
from plone.registry.interfaces import IRegistry
from Products.CMFCore.utils import getToolByName
from zope.component import getAllU... | castlecms/castle.cms | castle/cms/vocabularies.py | Python | gpl-2.0 | 11,750 | 0.001106 |
import os #for OS program calls
import sys #For Clean sys.exit command
import time #for sleep/pause
import RPi.GPIO as io #read the GPIO pins
io.setmode(io.BCM)
pir_pin = 17
screen_saver = False
io.setup(pir_pin, io.IN)
while True:
if screen_saver:
if io.input(pir_pin):
os.system("xscreensaver-command -dea... | benekex2/smart_mirror | motiondetect.py | Python | gpl-3.0 | 449 | 0.046771 |
# © 2014-2015 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# Copyright 2016 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
from odoo import api, fields, models
from odoo.exceptions import UserError
from odoo.tools.translate import _
from ..exceptions import... | OCA/connector-cmis | cmis/models/cmis_backend.py | Python | agpl-3.0 | 4,701 | 0 |
from django.views.generic import ListView, DetailView, CreateView, \
DeleteView, UpdateView, \
ArchiveIndexView, DateDetailView, \
DayArchiveView, MonthArchiveView, \
TodayArchiveView, Wee... | tnemis/staging-server | schoolnew/views.py | Python | mit | 219,616 | 0.044382 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.