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 |
|---|---|---|---|---|---|---|
import sys
sys.dont_write_bytecode = True
from traceback import format_exc as formatted_exception, extract_stack
from inspect import currentframe as inspect_currentframe, getmembers as inspect_getmembers
from os.path import split as path_split, exists as path_exists
from copy import deepcopy
get_globals = globals
ge... | Sw4T/Warband-Development | mb_warband_module_system_1166/Module_system 1.166/compiler.py | Python | mit | 91,472 | 0.028982 |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
definition of plugin system
plugins are supposed to be run when image is built and we need to extract some information
"""
from __future__ impo... | projectatomic/atomic-reactor | atomic_reactor/plugin.py | Python | bsd-3-clause | 24,497 | 0.002449 |
from buildbot.status import build
from buildbot.status import builder
from buildbot.status import buildrequest
from buildbot.status import buildset
from buildbot.status import master
# styles.Versioned requires this, as it keys the version numbers on the fully
# qualified class name; see master/buildbot/test/regressio... | anish/buildbot | master/buildbot/status/__init__.py | Python | gpl-2.0 | 714 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
#
# This file is part of Ansible by Red Hat
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Li... | sonaht/ansible | lib/ansible/modules/network/ios/ios_logging.py | Python | gpl-3.0 | 9,798 | 0.000714 |
import matplotlib.pyplot as plt
import numpy as np
from sys import argv
f1 = argv[1] # task001_run001
block_convo = np.array([])
full_convo = np.array([])
block_num = [1,4,5]
full_num = range(1,7,1)
"""
block_list = ['task001_run001/cond001.txt', 'task001_run001/cond004.txt', 'task001_run001dconv005.txt']
"""
block... | berkeley-stat159/project-iota | code/utils/conv_response/combine_convo_point_script.py | Python | bsd-3-clause | 1,565 | 0.008946 |
#!/usr/bin/env python3
import platform
import subprocess
import sys
VERSION_FILE = 'fasm/version.py'
VERSION_FILE_TEMPLATE = '''\
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2017-2022 F4PGA Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except ... | SymbiFlow/fasm | update_version.py | Python | isc | 3,846 | 0 |
#!/usr/bin/env python
"""
Re-write config file and optionally convert to python
"""
__revision__ = "$Id: writeCfg.py,v 1.1 2011/09/19 21:41:44 paus Exp $"
__version__ = "$Revision: 1.1 $"
import getopt
import imp
import os
import pickle
import sys
import xml.dom.minidom
from random import SystemRandom
from ProdCom... | cpausmit/Kraken | filefi/024/writeCfg.py | Python | mit | 6,916 | 0.005928 |
#!/usr/bin/python
#
# Copyright 2015 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# generate_case_lists.py:
# Helper script for updating the dEQP case list files, stored in the repo.
# Generally only used when... | crezefire/angle | src/tests/deqp_support/generate_case_lists.py | Python | bsd-3-clause | 1,684 | 0.003563 |
#-*- coding: utf-8 -*-
'''
python-libtorrent for Kodi (script.module.libtorrent)
Copyright (C) 2015-2016 DiMartino, srg70, RussakHH, aisman
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 t... | alfa-jor/addon | plugin.video.alfa/lib/python_libtorrent/python_libtorrent/functions.py | Python | gpl-3.0 | 9,266 | 0.012089 |
#!/usr/bin/env python3
import os
import sys
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parentdir)
import time
import unittest
import microstacknode.hardware.display.ssd1306
from microstacknode.hardware.display.font import (FourByFiveFont,
... | RobbieClarken/python3-microstacknode | tests/test_display.py | Python | gpl-3.0 | 2,175 | 0.002299 |
# coding=utf-8
# ==============================================================================
"""Entrenamiento del modelo"""
# ==============================================================================
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function... | NicolasPresta/ReconoBook | reconobook_train.py | Python | mit | 5,180 | 0.002511 |
# start the service
oculusrift = Runtime.start("oculusrift","OculusRift") | MyRobotLab/pyrobotlab | service/OculusRift.py | Python | apache-2.0 | 73 | 0.027397 |
import resume.models as rmod
import random
import logging
from django.http import HttpResponse
from datetime import date
logger = logging.getLogger('default')
def generate(request):
cs_objs = rmod.Department.objects.filter(shortname='cs')
if len(cs_objs) == 0:
logger.info('created cs dept')
cs = rmod.Depa... | brownplt/k3 | dj-resume/resume/generate.py | Python | apache-2.0 | 3,738 | 0.016854 |
from django.contrib import admin
from django.db import transaction
from django.core import urlresolvers
from django.utils.translation import ugettext as _
from django import shortcuts
from django.contrib import messages
from annoying.decorators import render_to
from nmadb_registration import forms, models
@admin.sit... | vakaras/nmadb-registration | src/nmadb_registration/views.py | Python | lgpl-3.0 | 4,119 | 0 |
# -*- coding: utf-8 -*-
''' Test case for signal to signal connections.'''
import unittest
from PySide2.QtCore import *
def cute_slot():
pass
class TestSignal2SignalConnect(unittest.TestCase):
'''Test case for signal to signal connections'''
def setUp(self):
#Set up the basic resources needed
... | BadSingleton/pyside2 | tests/signals/signal2signal_connect_test.py | Python | lgpl-2.1 | 3,340 | 0.004491 |
"""
This class is about determine two path homotopy classes using Constraint Satisfication Programming techniques.+
"""
__author__ = 'Yinan Zhang'
__revision__ = '$Revision$'
import pdb
import sys, os, math, time, pygame, time, copy
sys.path.append('../basics/math')
sys.path.append('../basics/algorithm')
from numpy... | Yinan-Zhang/RichCSpace | alphashape/Homotopy.py | Python | mit | 6,570 | 0.049772 |
"""
Common utility functions useful throughout the contentstore
"""
import logging
from datetime import datetime
from django.conf import settings
from django.urls import reverse
from django.utils.translation import ugettext as _
from opaque_keys.edx.keys import CourseKey, UsageKey
from pytz import UTC
from six import... | Stanford-Online/edx-platform | cms/djangoapps/contentstore/utils.py | Python | agpl-3.0 | 18,481 | 0.002705 |
#!/usr/bin/python3
"""jira_descr.py queries JIRA for issue description info
The information includes, values for:
- issue type
- status
- resolution
- priority
The information is retrieved and formatted for nice printing. This is a
utility for configuring the JIRA access for a new project.
Source documentation: http... | GripQA/client-tools | jira-access/jira_descr.py | Python | apache-2.0 | 2,675 | 0.006729 |
import unittest
from nalaf.structures.data import Dataset, Document, Part, Token
from nalaf.features.simple import SimpleFeatureGenerator, SentenceMarkerFeatureGenerator
class TestSimpleFeatureGenerator(unittest.TestCase):
def setUp(self):
part = Part('Word1 word2 word3. Word4 word5 word6.')
part.... | Rostlab/nalaf | tests/features/test_simple.py | Python | apache-2.0 | 1,582 | 0.004425 |
from setuptools import setup, find_packages
import npm
setup(
name='npm',
version=npm.VERSION,
packages=find_packages(exclude=('tests',)),
description='Python bindings and utils for npm.',
long_description='Documentation at https://github.com/markfinger/python-npm',
install_requires=[
'... | pombredanne/python-npm | setup.py | Python | mit | 472 | 0.004237 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-06 22:06
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... | italopaiva/your.car | yourcar/telegram_bot/migrations/0001_initial.py | Python | bsd-2-clause | 818 | 0.002445 |
the_count = [1, 2, 3, 4, 5]
fruits = ['apples', 'oranges', 'pears', 'apricots']
change = [1, 'pennies', 2, 'dimes', 3, 'quarters']
# ihis firat kind of for-loop goes through a list
for number in the_count:
print "This is the count %d" % number
# same as above
for fruit in fruits:
print "A fruit of type: %s" % frui... | bencastan/LPTHW | ex32.py | Python | gpl-3.0 | 736 | 0.012228 |
#!/usr/bin/python
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUM... | roadmapper/ansible | lib/ansible/modules/network/aci/aci_firmware_group_node.py | Python | gpl-3.0 | 6,497 | 0.001847 |
#-*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring communication protocols... | dasbruns/netzob | src/netzob/Common/Models/Grammar/States/PrismaState.py | Python | gpl-3.0 | 5,647 | 0.007793 |
# -*- coding: utf-8 -*-
import sqlite3
import os
from logger import log
from collections import OrderedDict as odi
CREATE, INSERT, UPDATE, DELETE, SCRIPT, SELECT = range(6)
SQL_CREATE = 'sql_create.sql'
class Sqlcon(object):
def __new__(cls, action, db, sql):
if not action:
return None
... | tedlaz/pyted | pykoinoxrista/u_dbcon.py | Python | gpl-3.0 | 5,047 | 0 |
"""
Scrapy settings for RecipesScraper project.
"""
# Names
BOT_NAME = 'RecipesScraper'
SPIDER_MODULES = ['RecipesScraper.spiders']
NEWSPIDER_MODULE = 'RecipesScraper.spiders'
# Obey robots.txt rules
ROBOTSTXT_OBEY = True
# Disable cookies (enabled by default)
COOKIES_ENABLED = False
# Configure item pipelines
IT... | brandonmburroughs/food2vec | dat/RecipesScraper/RecipesScraper/settings.py | Python | mit | 864 | 0.002315 |
"""
Load pp, plot and save
8km difference
"""
import os, sys
#%matplotlib inline
#%pylab inline
import matplotlib
matplotlib.use('Agg')
# Must be before importing matplotlib.pyplot or pylab!
from matplotlib import rc
from matplotlib.font_manager import FontProperties
from matplotlib import rcParams
from mpl_to... | peterwilletts24/Python-Scripts | plot_scripts/EMBRACE/plot_from_pp_geop_height_by_day_dkbhu.py | Python | mit | 12,998 | 0.018926 |
#!/usr/bin/python
# Copyright (c) 2013 The Bitsend Core developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import json
from urllib import urlopen
import requests
import getpass
from string import Template
import sys
i... | JohnMnemonick/UralsCoin | qa/pull-tester/pull-tester.py | Python | mit | 8,944 | 0.007044 |
import inspect
from IPython.utils.traitlets import (
Any,
CInt,
CBool,
CFloat,
Dict,
Tuple,
link,
)
from IPython.html.widgets import Widget
from IPython.html.widgets.widget_selection import _Selection
from .widgets import Tangle
__all__ = ["Tangle", "tangle"]
function = type(lambda: 0)... | bollwyvl/ipytangle | ipytangle/__init__.py | Python | bsd-3-clause | 5,335 | 0 |
###
### This file was automatically generated
###
from archinfo.arch import register_arch, Endness, Register
from .common import ArchPcode
class ArchPcode_dsPIC33E_LE_24_default(ArchPcode):
name = 'dsPIC33E:LE:24:default'
pcode_arch = 'dsPIC33E:LE:24:default'
description = 'dsPIC33E'
bits = 24
i... | angr/angr | angr/engines/pcode/arch/ArchPcode_dsPIC33E_LE_24_default.py | Python | bsd-2-clause | 4,846 | 0.000619 |
#!/usr/bin/env python
import json
inv = {
'_meta': {
'hostvars': {}
},
'hosts': []
}
for num in range(0, 3):
host = u"host-%0.2d" % num
inv['hosts'].append(host)
inv['_meta']['hostvars'][host] = dict(ansible_ssh_host='127.0.0.1', ansible_connection='local')
print(json.dumps(inv, inde... | ansible/tower-cli | docs/source/cli_ref/examples/inventory_script_example.py | Python | apache-2.0 | 327 | 0.003058 |
# Copyright (c) 2010-2012 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 law or agree... | swiftstack/swift | test/unit/proxy/test_sysmeta.py | Python | apache-2.0 | 21,779 | 0 |
# Copyright 2014 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | axbaretto/beam | sdks/python/.tox/py27gcp/lib/python2.7/site-packages/google/cloud/_testing.py | Python | apache-2.0 | 3,140 | 0 |
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge... | EmanueleCannizzaro/scons | src/engine/SCons/Tool/mssdk.py | Python | mit | 1,834 | 0.001636 |
#!/usr/bin/env python
##########################################################################
#
# QGIS-meshing plugins.
#
# Copyright (C) 2012-2013 Imperial College London and others.
#
# Please see the AUTHORS file in the main source directory for a
# full list of copyright holders.
#
# Dr Adam S. Can... | adamcandy/qgis-plugins-meshing | dev/tests/gaussian_bump.py | Python | lgpl-2.1 | 4,413 | 0.009517 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (division, absolute_import, print_function)
__license__ = 'GPL v3'
__copyright__ = '2014, Derek Broughton <auspex@pointerstop.ca>'
__docformat__ = 'restructuredtext en'
from calibre.ebooks.oeb.iterator.book import EbookI... | auspex/sonyutilities | iterator.py | Python | gpl-3.0 | 1,536 | 0.013672 |
from django.core.management.base import BaseCommand, CommandError
from ship_data.models import GpggaGpsFix
import datetime
from main import utils
import csv
import os
from django.db.models import Q
import glob
from main.management.commands import findgpsgaps
gps_bridge_working_intervals = None
# This file is part of ... | cpina/science-cruise-data-management | ScienceCruiseDataManagement/main/management/commands/exportgpstracks.py | Python | mit | 8,461 | 0.004728 |
class Breadcrumb:
def __init__(self, text, url):
self.text = text
self.url = url | alienlike/hypertextual | hypertextual/models/breadcrumb.py | Python | agpl-3.0 | 100 | 0.01 |
# ===============================================================================
# Copyright 2014 Jake Ross
#
# 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... | UManPychron/pychron | pychron/hardware/environmental_probe.py | Python | apache-2.0 | 1,717 | 0.000582 |
# need to pass it a file, where data starts, path to write
# things to import
import sys
import pandas
import scipy
import numpy
from scipy import stats
from scipy.stats import t
# arguments being passed
path_of_file=sys.argv[1]
last_metadata_column=int(sys.argv[2])
path_to_write=sys.argv[3]
# spearman p calc based... | ryanjw/co-occurrence_python | first_attempt.py | Python | gpl-2.0 | 1,125 | 0.022222 |
import asyncio
try:
from unittest.mock import Mock, create_autospec
except ImportError:
from mock import Mock, create_autospec
from uuid import uuid4
from functools import wraps
from copy import copy
from unittest import TestCase as unittestTestCase
from zeroservices.exceptions import ServiceUnavailable
from... | Lothiraldan/ZeroServices | tests/utils.py | Python | mit | 3,193 | 0.000313 |
# -*- coding: utf-8 -*-
#
# SPDX-FileCopyrightText: 2013-2021 Agora Voting SL <contact@nvotes.com>
#
# SPDX-License-Identifier: AGPL-3.0-only
#
import pickle
import base64
import json
import re
from datetime import datetime
from flask import Blueprint, request, make_response, abort
from frestq.utils import loads, du... | agoravoting/election-orchestra | public_api.py | Python | agpl-3.0 | 8,209 | 0.001707 |
# Encoding: utf-8
import sys
import time
from flask import Flask
app = Flask(__name__)
def kitchen_work():
time.sleep(5)
@app.route('/')
def fast_food_host():
print 'Order sent to the kitchen, waiting...'
sys.stdout.flush()
kitchen_work()
print 'Burger received from kitchen!'
sys.stdout.... | ygravrand/pyconfr2015 | breizhcamp2016/ex2_multi_process/fast_food.py | Python | mit | 429 | 0 |
from price_monitor.models import Site, Price, SiteQuery
import json
from os import path
import os
import logging
logging.basicConfig(level=logging.DEBUG, filename="logfile", filemode="a+",
format="%(asctime)-15s %(levelname)-8s %(message)s")
logger = logging.getLogger(__name__)
class DataLoader(o... | jasonljc/enterprise-price-monitor | django_monitor/price_monitor/spider/data_loader.py | Python | mit | 3,067 | 0.005217 |
"""Support for EDP re:dy sensors."""
import logging
from homeassistant.const import POWER_WATT
from homeassistant.helpers.entity import Entity
from . import EDP_REDY, EdpRedyDevice
_LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['edp_redy']
# Load power in watts (W)
ATTR_ACTIVE_POWER = 'active_power'
async... | jamespcole/home-assistant | homeassistant/components/edp_redy/sensor.py | Python | apache-2.0 | 3,481 | 0 |
# Copyright 2010 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | HybridF5/jacket | jacket/api/compute/openstack/compute/flavors_extraspecs.py | Python | apache-2.0 | 6,329 | 0 |
import os
import csv
def get_value_or_default(value, default=None):
result = value.strip()
if len(result) == 0:
result = default
return result
def read_csv_file(csv_file_name,
delimiter,
quote_char='"',
skip_header=True,
e... | CALlanoR/virtual_environments | medical_etls/part1/etls/utils.py | Python | apache-2.0 | 607 | 0.011532 |
#!/usr/bin/env python
#coding: utf8
import MySQLdb as mdb
import MySQLdb.cursors
SRC_HOST = '127.0.0.1'
SRC_USER = 'root'
SRC_PASS = ''
DATABASE_NAME = ''
DST_HOST = '127.0.0.1'
DST_USER = 'root'
DST_PASS = ''
src_conn = mdb.connect(SRC_HOST, SRC_USER, SRC_PASS, DATABASE_NAME, charset='utf8', cursorc... | banwagong-news/ssbc | workers/clean_rubbish_res.py | Python | gpl-2.0 | 1,384 | 0.011561 |
from mongoengine import *
class Class(Document):
name = StringField(required = True)
meta = {
"allow_inheritance": False
}
| ucrcsedept/galah | galah/db/models/classes.py | Python | apache-2.0 | 145 | 0.02069 |
# Import 'datasets' from 'sklearn'
import numpy as np
from sklearn import datasets
from sklearn.decomposition import PCA, RandomizedPCA
import matplotlib.pyplot as plt
# Load in the 'digits' data
digits = datasets.load_digits()
# Print the 'digits' data
print(digits)
# Print the keys
print(digits.keys)
# Print out ... | monal94/digits-scikit-learn | main.py | Python | mit | 2,459 | 0.001627 |
# Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | LockScreen/Backend | venv/lib/python2.7/site-packages/awscli/customizations/codedeploy/systems.py | Python | mit | 7,661 | 0.000131 |
from setuptools import setup, find_packages
import sys, os
version = '0.0'
setup(name='PickleRPC',
version=version,
description="RPC using pickle",
long_description="""\
""",
classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
keywords='',
auth... | Shea690901/mudrpc | python/lib/PickleRPC/setup.py | Python | isc | 690 | 0.004348 |
from django.views.generic import *
| akx/coffin | coffin/views/generic/__init__.py | Python | bsd-3-clause | 35 | 0 |
import sys
import random
from test_base import *
class TestBlockLD2(TestBase):
def generate(self):
self.clear_tag()
for n in range(50000):
tag = random.randint(0, 15)
index = random.randint(0,self.sets_p-1)
taddr = self.get_addr(tag,index)
op = random.randint(0,2)
if op == ... | litex-hub/pythondata-cpu-blackparrot | pythondata_cpu_blackparrot/system_verilog/black-parrot/external/basejump_stl/testing/bsg_cache/regression_non_blocking/test_block_ld2.py | Python | bsd-3-clause | 747 | 0.024096 |
#!/usr/bin/python
import OpenSSL.crypto
import argparse
import base64
import glob
import k8s
import os
import shutil
import yaml
def sn():
sn = int(open("/etc/origin/master/ca.serial.txt").read(), 16)
sntext = "%X" % (sn + 1)
if len(sntext) % 2:
sntext = "0" + sntext
open("/etc/origin/maste... | RedHatEMEA/aws-ose3 | target/reip.py | Python | apache-2.0 | 18,095 | 0.003426 |
import datetime
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
from django.contrib.admin.utils import (
display_for_field, display_for_value, label_for_field, lookup_field,
)
from django.contrib.admin.views.main import (
ALL_VAR, ORDER_VAR, PAGE_VAR, SEARCH_VAR,
)
from django.co... | georgemarshall/django | django/contrib/admin/templatetags/admin_list.py | Python | bsd-3-clause | 18,018 | 0.001665 |
#!/Library/Frameworks/Python.framework/Versions/Current/bin/python
import os
from os.path import join, getsize
from random import randint
def addEntry (XMLFile, finfo, dirs, NASPath):
#finfo[1].replace(' ', '_')
finfo[1] = finfo[1].replace('.', '_', finfo.count('.')-1)
title = finfo[1].split('.')[0]
... | trafferty/utils | python/buildVideoXML.py | Python | gpl-2.0 | 3,204 | 0.006554 |
# Copyright (c) 2011 Mattias Nissler <mattias.nissler@gmx.de>
#
# Redistribution and use in source and binary forms, with or without modification, are permitted
# provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# condition... | shutej/tapcfg | drivers/osx/tuntap/test/tuntap/tuntap_tests.py | Python | lgpl-2.1 | 4,009 | 0.012472 |
import time
from itertools import izip
from itertools import imap
from itertools import takewhile
import operator
from collections import OrderedDict
from zope.interface import implements
from zope.interface import Interface
class IStorage(Interface):
"""
Local storage for this node.
"""
def __setit... | Tha-Robert/kademlia | kademlia/storage.py | Python | mit | 2,552 | 0.000784 |
from random import Random
from time import time
import inspyred
import math
# Define an additional "necessary" function for the evaluator
# to see how it must be handled when using pp.
def my_squaring_function(x):
return x**2
def generate_rastrigin(random, args):
size = args.get('num_inputs', 10)
return [... | aarongarrett/inspyred | examples/advanced/parallel_evaluation_pp_example.py | Python | mit | 1,728 | 0.011574 |
# -*- coding: utf-8 -*-
#
# pyhamtools documentation build configuration file, created by
# sphinx-quickstart on Thu Apr 24 01:00:39 2014.
#
# 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.
#
... | dh1tw/pyhamtools | docs/source/conf.py | Python | mit | 8,402 | 0.006308 |
# -*- coding: utf-8 -*-
# Copyright(C) 2013 Christophe Lampin
# Copyright(C) 2009-2012 Romain Bignon
#
# This file is part of weboob.
#
# weboob 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 ... | sputnick-dev/weboob | modules/hellobank/perso/transactions.py | Python | agpl-3.0 | 4,962 | 0.007457 |
import plugins, datetime, time, os
class BatchVersionFilter:
def __init__(self, batchSession):
self.batchSession = batchSession
def verifyVersions(self, app):
badVersion = self.findUnacceptableVersion(app)
if badVersion is not None:
raise plugins.TextTestError, "unregistere... | emilybache/texttest-runner | src/main/python/lib/default/batch/batchutils.py | Python | mit | 1,956 | 0.005624 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#########################################################################
# File Name: treeExplore.py
# Author: lpqiu
# mail: qlp_1018@126.com
# Created Time: 2014年09月13日 星期六 21时42分58秒
#########################################################################
from numpy imp... | Com-Mean/MLinAcition | chapter9/treeExplore.py | Python | gpl-3.0 | 1,329 | 0.009916 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase, RequestFactory
from django.contrib.auth import get_user_model, authenticate
from django.contrib.auth.models import AnonymousUser
import json
import status
from tiny_rest.views import APIView
from tiny_rest.authorization ... | allisson/django-tiny-rest | tiny_rest/tests/test_authorization.py | Python | mit | 3,377 | 0 |
from candidates.models import PopItPerson
from candidates.popit import PopItApiMixin, popit_unwrap_pagination
from django.core.management.base import BaseCommand
class Command(PopItApiMixin, BaseCommand):
def handle(self, **options):
for o in popit_unwrap_pagination(
self.api.organization... | YoQuieroSaber/yournextrepresentative | candidates/management/commands/candidates_delete_party_images.py | Python | agpl-3.0 | 1,053 | 0.00095 |
import fractions
import math
print('PI =', math.pi)
f_pi = fractions.Fraction(str(math.pi))
print('No limit =', f_pi)
for i in [1, 6, 11, 60, 70, 90, 100]:
limited = f_pi.limit_denominator(i)
print('{0:8} = {1}'.format(i, limited))
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_mathematics/fractions_limit_denominator.py | Python | apache-2.0 | 249 | 0 |
# -*- 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/nugatewayslocation.py | Python | bsd-3-clause | 17,817 | 0.008868 |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | tseaver/gcloud-python | monitoring/google/cloud/monitoring_v3/gapic/enums.py | Python | apache-2.0 | 21,475 | 0.003679 |
from .. import Provider as PersonProvider
class Provider(PersonProvider):
formats_female = (
"{{first_name_female}} {{last_name}}",
"{{first_name_unisex}} {{last_name}}",
"{{prefix_female}} {{first_name_unisex}} {{last_name}}",
"{{prefix_female}} {{first_name_female}} {{last_name}}... | joke2k/faker | faker/providers/person/or_IN/__init__.py | Python | mit | 35,828 | 0 |
"""
:mod:`zsl.db.helpers.sorter`
----------------------------
"""
from __future__ import unicode_literals
from builtins import object, zip
from sqlalchemy import asc, desc
DEFAULT_SORT_ORDER = 'ASC' # If changed, look at the condition in apply_sorter if self.get_order() == "DESC":.
class Sorter(object):
"""
... | AtteqCom/zsl | src/zsl/db/helpers/sorter.py | Python | mit | 3,601 | 0.003888 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | gundalow/ansible-modules-core | network/nxos/nxos_udld_interface.py | Python | gpl-3.0 | 15,900 | 0.001195 |
#
# CDR-Stats License
# http://www.cdr-stats.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2015 Star2Billing S.L.
#
# The Initial Develope... | Star2Billing/cdr-stats | cdr_stats/import_cdr/models.py | Python | mpl-2.0 | 2,641 | 0.002272 |
from __future__ import absolute_import
from __future__ import print_function
import filecmp
import os
import ujson
from django.core import mail
from django.http import HttpResponse
from django.test import override_settings
from mock import patch
from typing import Any, Dict, List
from zerver.lib.actions import do_ch... | j831/zulip | zerver/tests/test_bots.py | Python | apache-2.0 | 34,708 | 0.001441 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-16 16:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pushkin', '0024_authparam_secret'),
]
operations = [
migrations.AlterField(
... | ilique/webpushkin | pushkin/migrations/0025_auto_20160616_1637.py | Python | mit | 495 | 0.00202 |
#!/usr/bin/python
# coding=utf-8
###############################################################################
#
# Micronaet S.r.l., Migration script for PostgreSQL
# Copyright (C) 2002-2013 Micronaet SRL (<http://www.micronaet.it>).
# All Rights Reserved
#
# This program is free software: you can redistr... | Micronaet/micronaet-migration | script6_7/migrate.py | Python | agpl-3.0 | 52,936 | 0.026269 |
class Leaf():
def __init__(self, screen, xy_pos=[0, 0], value="", radius=15, color=[0, 0, 0]):
self.screen = screen
self.color = color
self.value = value
self.radius = radius
self.width = 1
self.x = coord[0]
self.y = coord[1]
self.top_y = self.y - self... | LukeBaal/PublicProjects | python tree diagrams/bin_tree.py | Python | mit | 3,330 | 0.009309 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Exercise',
fields=[
('id', models.AutoField(ser... | vakila/de-stress | testproject/testapp/migrations/0001_initial.py | Python | mit | 1,334 | 0.002249 |
import json
import pymarc
from siskin.conversions import (de_listify, imslp_xml_to_marc, osf_to_intermediate)
def test_imslp_xml_to_marc():
example = """<?xml version="1.0"?>
<document docID="imslpvalsskramstadhans">
<localClass localClassName="col">imslp</localClass>
<localClass localClassName=... | miku/siskin | siskin/test_conversions.py | Python | gpl-3.0 | 11,642 | 0.001117 |
#!/usr/bin/env python
# $Id: Parser.py,v 1.135 2007/11/16 18:26:01 tavis_rudd Exp $
"""Parser classes for Cheetah's Compiler
Classes:
ParseError( Exception )
_LowLevelParser( Cheetah.SourceReader.SourceReader ), basically a lexer
_HighLevelParser( _LowLevelParser )
Parser === _HighLevelParser (an alias)
Meta-... | carvalhomb/tsmells | lib/Cheetah/src/Parser.py | Python | gpl-2.0 | 101,244 | 0.006568 |
# -*- coding: utf-8 -*-
__title__ = 'subliminal'
__version__ = '2.1.0'
__short_version__ = '.'.join(__version__.split('.')[:2])
__author__ = 'Antoine Bertin'
__license__ = 'MIT'
__copyright__ = 'Copyright 2016, Antoine Bertin'
import logging
from .core import (AsyncProviderPool, ProviderPool, check_video, download_be... | Diaoul/subliminal | subliminal/__init__.py | Python | mit | 818 | 0.002445 |
# -*- coding: utf-8 -*-
# coding: UTF-8
#
# Copyright 2010-2015 The pygit2 contributors
#
# This file 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.
#
# In addition to the permissions in the GNU G... | Sheeo/pygit2 | setup.py | Python | gpl-2.0 | 6,812 | 0.000441 |
"""Tests for the CPU Speed config flow."""
from unittest.mock import AsyncMock, MagicMock
from homeassistant.components.cpuspeed.const import DOMAIN
from homeassistant.config_entries import SOURCE_USER
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import (
RESULT_TYPE_ABORT,
... | rohitranjan1991/home-assistant | tests/components/cpuspeed/test_config_flow.py | Python | mit | 2,642 | 0 |
import kivy
kivy.require('1.9.1')
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.relativelayout import RelativeLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.stencilview import StencilView
from fieldlabel import FieldLabel
from kivy.properties im... | ryandoherty/RaceCapture_App | autosportlabs/uix/gauge/bargraphgauge.py | Python | gpl-3.0 | 1,453 | 0.015141 |
"""Command-line tool to test the (de)serialisation live."""
from sys import stdin, stdout
from argparse import ArgumentParser
from spynl.main.serial import negotiate_content_type, loads, dumps
def main():
"""main function for converting between formats"""
parser = ArgumentParser(description='Convert between... | SoftwearDevelopment/spynl | spynl/main/serial/cli.py | Python | mit | 1,287 | 0.000777 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/MedicationStatement) on 2019-05-07.
# 2019, SMART Health IT.
from . import domainresource
class MedicationStatement(domainresource.DomainResource):
""" Record of medication being take... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_4_0_0/models/medicationstatement.py | Python | bsd-3-clause | 8,384 | 0.005725 |
from bucketlist import create_app, db
from bucketlist.models import User, Bucketlist, Item
import json
import unittest
class BaseTestCase(unittest.TestCase):
def setUp(self):
""" this function creates the base test"""
self.app = create_app(config_name="development")
self.client = self.ap... | kevintumbo/Checkpoint2_Bucketlist | tests/base_test.py | Python | mit | 2,589 | 0.011587 |
# -*- test-case-name: twisted.web.test.test_xml -*-
#
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
#
"""Some fairly inadequate testcases for Twisted XML support."""
from __future__ import nested_scopes
from twisted.trial.unittest import TestCase
from twisted.web import sux
fro... | kenorb/BitTorrent | twisted/web/test/test_xml.py | Python | gpl-3.0 | 23,878 | 0.003015 |
#encoding:utf-8
subreddit = 'comedynecrophilia'
t_channel = '@comedynecrophilia'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Fillll/reddit2telegram | reddit2telegram/channels/~inactive/comedynecrophilia/app.py | Python | mit | 155 | 0.006452 |
from __future__ import division, print_function, unicode_literals
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
# this test is not suitable for autotest because it uses a special clock
# that clashes wi... | google-code-export/los-cocos | test/test_recorder.py | Python | bsd-3-clause | 1,317 | 0.023538 |
from filetypes.basefile import BaseFile
from filetypes.plainfile import PlainFile
from filetypes.plainfile import ReviewTest
import filetypes
class JFLAPReviewTest(ReviewTest):
def __init__(self, dict_, file_type):
super().__init__(dict_, file_type)
def run(self, path):
"""A JFLAP review test ... | abreen/socrates.py | filetypes/jflapfile.py | Python | gpl-2.0 | 1,386 | 0.002165 |
class Solution(object):
# def convert(self, s, numRows):
# """
# :type s: str
# :type numRows: int
# :rtype: str
# """
# ls = len(s)
# if ls <= 1 or numRows == 1:
# return s
# temp_s = []
# for i in range(numRows):
# tem... | qiyuangong/leetcode | python/006_ZigZag_Conversion.py | Python | mit | 1,447 | 0.000691 |
import json
import os
import requests
USERNAME = os.environ['GEONAMES_USER']
BASE_URL = 'http://api.geonames.org'
def search(term, user=USERNAME):
'''Returns a dict of results for a search to geonames.'''
r = requests.get(BASE_URL + '/searchJSON',
params={'q': term,
... | joelwilson/caniflymykite | geonames.py | Python | gpl-3.0 | 1,582 | 0.001264 |
#!/usr/bin/env python3
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... | jwhui/openthread | tools/otci/otci/command_handlers.py | Python | bsd-3-clause | 9,542 | 0.001782 |
import logging
from queue import Queue
from gi.repository import GObject
from lib.commands import ControlServerCommands
from lib.tcpmulticonnection import TCPMultiConnection
from lib.response import NotifyResponse
class ControlServer(TCPMultiConnection):
def __init__(self, pipeline):
'''Initialize serve... | h01ger/voctomix | voctocore/lib/controlserver.py | Python | mit | 5,365 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | manojngb/Crazyfly_simple_lift | src/cfclient/utils/input/inputinterfaces/__init__.py | Python | gpl-2.0 | 3,515 | 0 |
##X3D=group
##X3D Shape node from Appearance and Geometry=name
##X3D_Geometry_file=file
##appearance=string <Appearance><Material></Material></Appearance>
##output_X3D_Shape_file=output file
out=open(output_X3D_Shape_file,'w')
geofile=open(X3D_Geometry_file,'r')
# no error checking, use elementtree later
out.write(... | andreasplesch/QGIS-X3D-Processing | scripts/generate_X3D_Shape.py | Python | gpl-3.0 | 495 | 0.032323 |
# -*- coding: UTF-8 -*-
# Copyright 2008-2018 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
"""Database models for this plugin.
"""
from __future__ import unicode_literals, print_function
import six
from builtins import str
import logging
logger = logging.getLogger(__name__)
import datetime
from d... | khchine5/xl | lino_xl/lib/ledger/models.py | Python | bsd-2-clause | 32,456 | 0.003143 |
"""
PyEarthScience: PyNGL vector example
- vectors on map plot
- rectilinear grid (lat/lon)
09.10.15 kmf
"""
import Ngl,Nio
#-- define variables
diri = "/Users/k204045/NCL/general/data/new_data/" #-- data directory
fname = "rectilinear_grid_2D.nc" #-- data file name
minval = 250. ... | KMFleischer/PyEarthScience | Visualization/PyNGL/vectors_simple_PyNGL.py | Python | mit | 3,506 | 0.042499 |
# Copyright 2015 The Meson development team
# 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 ... | rhd/meson | mesonbuild/modules/qt4.py | Python | apache-2.0 | 7,453 | 0.00161 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.