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 |
|---|---|---|---|---|---|---|
"""
Define a set of scopes to be used by COS Internal OAuth implementation, specifically tailored to work with APIv2.
List of scopes, nomenclature, and rationale can be found in the relevant "Login as OSF- phase 2" proposal document
"""
from collections import namedtuple
from website import settings
# Public scopes... | pattisdr/osf.io | framework/auth/oauth_scopes.py | Python | apache-2.0 | 18,447 | 0.005746 |
'''Brainfuck interpreter'''
VERSION = '0.1.2.1103'
def __static_vars():
'''Decorate, add static attr'''
def decorate(func):
'''The decorate'''
setattr(func, 'stdin_buffer', [])
return func
return decorate
@__static_vars()
def __getchar() -> int:
'''Return one char from stdin''... | Bestoa/py-brainfuck | nbfi/__init__.py | Python | mit | 2,726 | 0.002935 |
import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-tvdb',
version='0.1',
packages=['tvdb'],
include_package_data=True,
... | maxsocl/django-tvdb | setup.py | Python | mit | 1,193 | 0.000838 |
import psycopg2
from Sequence import ScenarioSequence
class Scenario(object):
"""A simple example class"""
_id_name = "scenario_id"
_table_name = "scenario"
_insert_order = """
(scenario_id ,
algorithm_type ,
benchmark_type ,
config_id,
scenario_description )"""
#scenario ... | CG-F16-16-Rutgers/steersuite-rutgers | steerstats/steersuitedb/Scenario.py | Python | gpl-3.0 | 2,417 | 0.009516 |
{
'name': 'Website Versioning',
'category': 'Website',
'summary': 'Allow to save all the versions of your website and allow to perform AB testing.',
'version': '1.0',
'description': """
OpenERP Website CMS
===================
""",
'author': 'OpenERP SA',
'depends': ['website','marke... | odoousers2014/odoo | addons/website_version/__openerp__.py | Python | agpl-3.0 | 724 | 0.005525 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import _
from odoo.addons.survey.tests import common
from odoo.tests.common import users
class TestSurveyInternals(common.TestSurveyCommon):
@users('survey_manager')
def test_answer_validation_mandat... | ddico/odoo | addons/survey/tests/test_survey.py | Python | agpl-3.0 | 3,979 | 0.002011 |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.ndimage import gaussian_filter
from srxraylib.plot.gol import plot
from oasys.util.oasys_util import write_surface_file
from srxraylib.metrology.profiles_simulation import slopes
# def transform_data(file_name):
#
# """... | srio/shadow3-scripts | METROLOGY/surface2d_to_hdf5.py | Python | mit | 6,588 | 0.007286 |
#!/usr/bin/python
import os
# Memory Map
misc_base = 0
uart_base = 1
spi_base = 2
i2c_base = 3
gpio_base = 4 * 128
settings_base = 5
# GPIO offset
gpio_pins = 0
gpio_ddr = 4
gpio_ctrl_lo = 8
gpio_ctrl_hi = 12
def set_reg(reg, val):
os.system("./usrp1-e-ctl w %d 1 %d" % (reg,val))
def get_reg(reg):
fin,fout... | scalable-networks/ext | uhd/host/apps/omap_debug/set_debug_pins.py | Python | gpl-2.0 | 712 | 0.008427 |
#!/usr/bin/env python
import os
import zipfile
import hashlib
def _rec_split(s):
rest, tail = os.path.split(s)
if rest in ('', os.path.sep):
return tail,
return _rec_split(rest) + (tail,)
def _any_dot(s):
for i in _rec_split(s):
if len(i)>0 and i[0]=='.':
return True
return False
def _zipdir(path, ziph,... | jpn--/pines | pines/zipdir.py | Python | mit | 3,774 | 0.037096 |
from django.views import generic
from django.core.urlresolvers import reverse_lazy
from .models import LotteryUser
class LotteryUserList(generic.ListView):
template_name = 'index.html'
context_object_name = 'number_list'
def get_queryset(self):
"""Return all numbers"""
return LotteryUser.... | munikes/loteria_lgb | loteria/web/views.py | Python | agpl-3.0 | 891 | 0.001122 |
from collections import OrderedDict
from copy import deepcopy
from django.utils import six
from rest_framework.utils.serializer_helpers import BindingDict
from rest_framework_expander import utils
from rest_framework_expander.exceptions import ExpanderContextMissing
class ExpanderOptimizer(object):
"""
Provi... | NextHub/drf-expander | rest_framework_expander/optimizers.py | Python | isc | 5,150 | 0.001748 |
import logging
from django.shortcuts import render
from django.http import JsonResponse
from django.db.models import Count
from homeinventory.inventory.models import Item, Category, Location, ItemLoan
logger = logging.getLogger(__name__)
def dashboard(request):
# get loans
item_loan = ItemLoan.objects \
... | le4ndro/homeinventory | homeinventory/dashboard/views.py | Python | mit | 1,435 | 0 |
MAX_RESULTS_PER_PAGE = 100
def all(listf, **kwargs):
"""
Simple generator to page through all results of function `listf`.
"""
if not kwargs.get('limit'):
kwargs['limit'] = MAX_RESULTS_PER_PAGE
resp = listf(**kwargs)
for obj in resp['objects']:
yield obj
while resp['meta... | philipn/localwiki-geocode-pagenames | geocode_pagenames/utils.py | Python | mit | 688 | 0 |
from blogging.tag_lib import parse_content
from blogging.models import BlogContent, BlogParent, BlogContentType
import json
import os
def convert_tags(blog,tag_name,fd):
tag = {}
# tag['name'] = tag_name + '_tag'
tag['name'] = tag_name
content = parse_content(blog,tag)
if len(content) > 0:
... | PirateLearner/pi | PirateLearner/blogging/db_migrate.py | Python | gpl-2.0 | 2,332 | 0.009434 |
# -*- coding: utf-8 -*-
from .browser import FolderBrowserView
def includeme(config):
config.include('.order')
config.include('.admin')
config.include('.browser')
config.include('.crud')
config.include('.paste')
| silenius/amnesia | amnesia/modules/folder/views/__init__.py | Python | bsd-2-clause | 235 | 0 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 15 16:32:17 2016
@author: elliott
"""
import re
def convert_columbia_html(text):
conversions = [('italic', 'em'),
('block_quote', 'blockquote'),
('bold', 'strong'),
('underline', 'u'),
('s... | voutilad/courtlistener | cl/corpus_importer/import_columbia/convert_columbia_html.py | Python | agpl-3.0 | 2,132 | 0.007036 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""
SUNRISET.C - computes Sun rise/set times, start/end of twilight, and
the length of the day at any date and latitude
Written as DAYLEN.C, 1989-08-16
Modified to SUNRISET.C, 1992-12-01
(c) Paul Schlyter, 1989, 1992
Released to the public domain by Paul Sch... | bwduncan/Suncalendar | Sun.py | Python | gpl-2.0 | 19,058 | 0.00105 |
#
# Copyright (C) 2014 UNINETT
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV 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 th... | alexanderfefelov/nav | python/nav/metrics/errors.py | Python | gpl-2.0 | 926 | 0 |
#!/usr/bin/python
blank_datafile = '/home/kyleb/Dropbox/UCSF/cas9/FCS/150916-3.1/kyleb/150916-rfp-cas9/96 Well - Flat bottom_002/Specimen_001_F1_F01_046.fcs'
script_output_dir = 'script_output'
sample_directory = '/home/kyleb/Dropbox/UCSF/cas9/FCS/150916-3.1/kyleb/150916-rfp-cas9/96 Well - Flat bottom_002'
rows_in_pl... | Kortemme-Lab/klab | klab/fcm/fcm.py | Python | mit | 18,877 | 0.00731 |
from setuptools import setup
setup(name='wealthengine_python_sdk',
version='0.1',
description='A Python SDK for WealthEngine\'s Public API',
url='https://github.com/zackproser/wealthengine-python-sdk',
author='Zack Proser',
author_email='zackproser@gmail.com',
license='MIT',
packages='weal... | zackproser/WealthEngine-Python-SDK | wealthengine_python_sdk/setup.py | Python | mit | 361 | 0.094183 |
import random
from hashlib import sha256
from django import template
register = template.Library()
@register.simple_tag
def random_identifier(length=None):
try:
length = int(length)
except Exception:
length = None
if length is None or length <= 0:
length = random.randint(16, 48)
... | interDist/pasportaservo | core/templatetags/utils.py | Python | agpl-3.0 | 1,270 | 0.001575 |
# 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 PhonePipeline(object):
def __init__(self):
self.file = None
def create_exporter(self, spider):
file = open('%s_data.txt' ... | suvit/scrapy-megafon-phones | megafon_phones/megafon_phones/pipelines.py | Python | mit | 662 | 0.001511 |
import six
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
class EnumField(serializers.ChoiceField):
default_error_messages = {"invalid_choice": _('"{input}" is not a valid choice.')}
def __init__(self, enum, **kwargs):
self.enum = enum
choices =... | 5monkeys/django-enumfield | django_enumfield/contrib/drf.py | Python | mit | 1,336 | 0.000749 |
# Copyright (C) 2011 by Mark Visser <mjmvisser@gmail.com>
#
# 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... | mjmvisser/adl3 | adl3/adl_defines.py | Python | mit | 39,284 | 0.005957 |
from __future__ import absolute_import, print_function, division
from six.moves import range, map, filter, zip
from six import iteritems
from collections import deque, defaultdict
from .polygon import is_same_direction, line_intersection
from .surface_objects import SaddleConnection
# Vincent question:
# using deque... | videlec/sage-flatsurf | flatsurf/geometry/straight_line_trajectory.py | Python | gpl-2.0 | 31,149 | 0.003307 |
# (C) British Crown Copyright 2014, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... | Jozhogg/iris | lib/iris/tests/unit/fileformats/grib/load_convert/test_time_range_unit.py | Python | lgpl-3.0 | 1,951 | 0 |
import mock
from zerver.lib.test_classes import ZulipTestCase
from typing import Dict
class TestFeedbackBot(ZulipTestCase):
def setUp(self) -> None:
user_profile = self.example_user('hamlet')
self.login(user_profile.email, realm=user_profile.realm)
def test_create_video_call_success(self) -> N... | dhcrzf/zulip | zerver/tests/test_create_video_call.py | Python | apache-2.0 | 1,733 | 0.001731 |
#!/usr/bin/python
#
# Copyright 2015 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... | Roshan2017/spinnaker | dev/dev_runner.py | Python | apache-2.0 | 10,050 | 0.00796 |
import os
from verifier import Verifier
import verifier
import unittest
# Verification tests
import json
import codecs
TASK_FILE = '201606231548.json'
with codecs.open(TASK_FILE, mode='r', encoding='utf-8') as file:
run_info = json.load(file)
v = Verifier()
class TestVerifer(unittest.TestCase):
def test_han... | zamattiac/ROSIEBot | tests_verifier.py | Python | mit | 895 | 0 |
"""Contains miscellaneous utility functions and classes."""
__all__ = ['indent',
'doc', 'adjust', 'difference', 'intersection', 'union',
'sameElements', 'makeList', 'makeTuple', 'list2dict', 'invertDict',
'invertDictLossless', 'uniqueElements', 'disjoint', 'contains',
'replace', 'reduceAngle', 'fitSrcAngle2Dest', 'fit... | brakhane/panda3d | direct/src/showbase/PythonUtil.py | Python | bsd-3-clause | 86,071 | 0.005763 |
#!/usr/bin/python2.4
#
# Copyright 2010, The Android Open Source Project
#
# 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... | rex-xxx/mt6572_x201 | sdk/monkeyrunner/jython/test/all_tests.py | Python | gpl-2.0 | 1,636 | 0.00978 |
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
if company:
for doctype in ['Sales Invoice', 'Delivery Note']:
frappe... | Zlash65/erpnext | erpnext/patches/v8_9/update_billing_gstin_for_indian_account.py | Python | gpl-3.0 | 534 | 0.026217 |
import base64
import re,time
import urllib
import urlparse
from BeautifulSoup import BeautifulSoup
from ..import proxy
from ..common import replaceHTMLCodes, clean_title
from ..scraper import Scraper
import xbmcaddon
import xbmc
class Watchfree(Scraper):
domains = ['watchfree.to']
name = "watchfree"
def ... | repotvsupertuga/tvsupertuga.repository | script.module.universalscrapers/lib/universalscrapers/scraperplugins/watchfree.py | Python | gpl-2.0 | 7,916 | 0.006822 |
# coding: utf-8
from qgis.gui import QgsColorWheel
color_wheel = QgsColorWheel()
def on_color_wheel_changed(color):
print(color)
color_wheel.colorChanged.connect(on_color_wheel_changed)
color_wheel.show()
| webgeodatavore/pyqgis-samples | gui/qgis-sample-QgsColorWheel.py | Python | gpl-2.0 | 214 | 0.004673 |
import subprocess
import os.path
import re
import argparse
parser = argparse.ArgumentParser(description="annovate splicing with protein position by annovar.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-i', '--input', action='store', nargs='?', help='... | shengqh/ngsperl | lib/Annotation/annovarSplicing.py | Python | apache-2.0 | 5,184 | 0.016397 |
# 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
# distrib... | mgeisler/satori | satori/sysinfo/ohai_solo.py | Python | apache-2.0 | 6,696 | 0 |
"""Tool to loop over fls_h.inc files. Based on nens/asc.py and NumPy
masked arrays. Stripped out all unnecessary flexibility.
Usage:
# Opens zipfile if path ends with zip; inside it opens the only file,
# or raises ValueError if there are several. Currently we need to no
# data value passed in because we don't get it... | lizardsystem/flooding-lib | flooding_lib/util/flshinc.py | Python | gpl-3.0 | 10,414 | 0.000288 |
"""
@author: Seven Lju
@date: 2016.04.27
"""
constStops = [
'\n', '\t', ' ', '~', '!', '#', '$', '%',
'@', '&', '*', '(', ')', '-', '=', '+', '[',
']', '{', '}', '\\', '|', '\'', '"', ';',
':', ',', '<', '.', '>', '/', '?', '^', '`'
]
class TextWalker(object):
def __init__(self, text, stops=constStops):
... | dna2github/dna2oldmemory | PyLangParser/source/walker.py | Python | mit | 2,919 | 0.012676 |
from django.contrib import admin
from oscar.apps.shipping.models import (
OrderAndItemCharges, WeightBand, WeightBased)
class OrderChargesAdmin(admin.ModelAdmin):
exclude = ('code',)
list_display = ('name', 'description', 'price_per_order', 'price_per_item',
'free_shipping_threshold')... | elliotthill/django-oscar | oscar/apps/shipping/admin.py | Python | bsd-3-clause | 576 | 0 |
__author__ = 'oleduc'
| oleduc/ferrymang | ferrymang/modules/__init__.py | Python | bsd-3-clause | 22 | 0 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | tux-00/ansible | lib/ansible/module_utils/redhat.py | Python | gpl-3.0 | 10,236 | 0.001563 |
from typing import Dict, Any
from depccg.tree import Tree
from depccg.cat import Category
def _json_of_category(category: Category) -> Dict[str, Any]:
def rec(node):
if node.is_functor:
return {
'slash': node.slash,
'left': rec(node.left),
'righ... | masashi-y/depccg | depccg/printer/my_json.py | Python | mit | 1,555 | 0.001286 |
"""
Example of module documentation which can be
multiple-lined
"""
from sqlalchemy import Column, Integer, String
from wopmars.Base import Base
class FooBase2P(Base):
"""
Documentation for the class
"""
__tablename__ = "FooBase2P"
id = Column(Integer, primary_key=True)
name = Column(String(... | aitgon/wopmars | wopmars/tests/resource/wrapper/fooPackage/FooBase2P.py | Python | mit | 325 | 0.003077 |
from django.shortcuts import render_to_response
from bonvortaro.vortaro import forms
def search(request):
if request.method == 'POST':
form = forms.SearchForm(request.POST)
else:
form = forms.SearchForm(request.GET)
return render_to_response("vortaro/search.html", {
"form": form
... | pupeno/bonvortaro | vortaro/views.py | Python | agpl-3.0 | 324 | 0.003086 |
# Copyright 2017 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... | tensorflow/tensorboard | tensorboard/plugins/scalar/scalars_plugin.py | Python | apache-2.0 | 6,802 | 0 |
###
# Copyright (c) 2003-2005, Jeremiah Fincher
# 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 copyright notice,
# this list of co... | kg-bot/SupyBot | plugins/Python/config.py | Python | gpl-3.0 | 2,695 | 0.000742 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020-2022 F4PGA 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
#
# Unl... | SymbiFlow/prjuray | fuzzers/002-tilegrid/clel_int/top.py | Python | isc | 2,848 | 0.001053 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | lulf/qpid-dispatch | python/qpid_dispatch_internal/tools/command.py | Python | apache-2.0 | 9,029 | 0.006534 |
from .base import *
DEBUG = False
ALLOWED_HOSTS = ['*']
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',#'django.db.backends.postgresql_psycopg2',
'NAME': 'bauth',
'USER': 'postgres',
'ADMINUSER':'postgres',
'PASSWORD': 'C7TS*+dp~-9JHwb*7rzP',
... | kyrelos/bauth | settings/production.py | Python | gpl-2.0 | 640 | 0.009375 |
import datetime
import time
from pandac.PandaModules import TextNode, Vec3, Vec4, PlaneNode, Plane, Point3
from toontown.pgui.DirectGui import DirectFrame, DirectLabel, DirectButton, DirectScrolledList, DGG
from direct.directnotify import DirectNotifyGlobal
from toontown.pgui import DirectGuiGlobals
from toontown.toonb... | silly-wacky-3-town-toon/SOURCE-COD | toontown/parties/CalendarGuiDay.py | Python | apache-2.0 | 30,399 | 0.003388 |
import uuid
from uqbar.objects import new
from supriya.patterns.Pattern import Pattern
class EventPattern(Pattern):
### CLASS VARIABLES ###
__slots__ = ()
### SPECIAL METHODS ###
def _coerce_iterator_output(self, expr, state=None):
import supriya.patterns
if not isinstance(expr,... | Pulgama/supriya | supriya/patterns/EventPattern.py | Python | mit | 1,545 | 0.003236 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20150525_1743'),
]
operations = [
migrations.AlterField(
model_name='categoria',
n... | zokis/mapa_do_cidadao | mapa_cidadao/mapa_cidadao/core/migrations/0003_auto_20150525_1937.py | Python | mit | 457 | 0 |
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.http import Http404
class StaffRequiredMixin(object):
@classmethod
def as_view(self, *args, **kwargs):
view... | jbaek7023/CustomEcommerce | src/products/mixins.py | Python | mit | 1,045 | 0.002871 |
class User(object):
def __init__(self, username=None, password=None, email=None):
self.username = username
self.password = password
self.email = email
@classmethod
def admin(cls):
return cls(username="admin", password="admin")
#random values for username and password
... | ArtemVavilov88/php4dvd_tests | php4dvd/model/user.py | Python | apache-2.0 | 512 | 0.005859 |
#!/usr/bin/env python3
#coding=utf-8
import sys
import argparse
from .ABVD import DATABASES, Downloader
from . import __version__
import json
def parse_args(args):
"""
Parses command line arguments
Returns a tuple of (inputfile, method, outputfile)
"""
parser = argparse.ArgumentParser(description... | SimonGreenhill/ABVDGet | abvdget/abvd_download.py | Python | bsd-3-clause | 1,118 | 0.004472 |
"""
Tests of various instructor dashboard features that include lists of students
"""
from django.conf import settings
from django.test.client import RequestFactory
from django.test.utils import override_settings
from markupsafe import escape
from courseware.tests.tests import TEST_DATA_MIXED_MODULESTORE
from student... | bdero/edx-platform | lms/djangoapps/instructor/tests/test_legacy_xss.py | Python | agpl-3.0 | 2,400 | 0.000833 |
"""
The MIT License (MIT)
Copyright (c) 2014 Chris Wimbrow
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... | cwimbrow/veganeyes-api | app/api_1_0/errors.py | Python | mit | 1,089 | 0.000918 |
__author__ = 'erobinson'
| erobinson/cloop | device/processes/test/__init__.py | Python | gpl-2.0 | 25 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apach... | yamt/neutron | quantum/tests/unit/test_servicetype.py | Python | apache-2.0 | 20,304 | 0 |
class CheckBase(object):
"""
Base class for checks.
"""
hooks = []
# pylint: disable=W0105
"""Git hooks to which this class applies. A list of strings."""
def execute(self, hook):
"""
Executes the check.
:param hook: The name of the hook being run.
:type ... | lddubeau/glerbl | glerbl/check/__init__.py | Python | gpl-3.0 | 461 | 0 |
import os
import nose.tools
import ndar
def test_nifti_nifti():
"""image is already a NIfTI-1 file"""
im = ndar.Image('test_data/06025B_mprage.nii.gz')
assert im.nifti_1 == im.path(im.files['NIfTI-1'][0])
def test_nifti_unzipped_nifti():
"""image is already an uncompressed NIfTI-1 file"""
im = nda... | NDAR/NITRC-Pipeline-for-NDAR | unsupported/tests/test_nifti.py | Python | bsd-2-clause | 1,410 | 0.004965 |
#!/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... | KMK-ONLINE/ansible-modules-core | network/openswitch/ops_config.py | Python | gpl-3.0 | 7,945 | 0.001133 |
from ajenti.api import *
from ajenti.plugins import *
info = PluginInfo(
title='BIND9',
description='BIND9 DNS server',
icon='globe',
dependencies=[
PluginDependency('main'),
PluginDependency('services'),
BinaryDependency('named'),
],
)
def init():
import main
| lupyuen/RaspberryPiImage | usr/share/pyshared/ajenti/plugins/bind9/__init__.py | Python | apache-2.0 | 313 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from distutils.core import setup, Command # pylint: disable=no-name-in-module
import dtree
class TestCommand(Command):
description = "Runs unittests."
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
... | chrisspen/dtree | setup.py | Python | lgpl-3.0 | 1,398 | 0.007153 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
# coding=utf-8
import unittest
from datetime import datetime
from lib.escala import Escala
import dirs
dirs.DEFAULT_DIR = dirs.TestDir()
class FrameTest(unittest.TestCase):
def setUp(self):
self.escala = Escala('fixtures/escala.xml')
self.dir = dirs.T... | camponez/importescala | test/test_escala.py | Python | gpl-3.0 | 3,876 | 0 |
# Unit tests for p24.py
# IMPORTS
from S24 import Item
import unittest
# main
class ItemTests(unittest.TestCase):
def test_empty_constructor(self):
item = Item()
self.assertEqual("", item.get_name())
self.assertEqual(0.0, item.get_price())
def test_constructor_with_name(self):
... | futurepr0n/Books-solutions | Python-For-Everyone-Horstmann/Chapter9-Objects-and-Classes/test_24.py | Python | mit | 718 | 0 |
"""The nexia integration base entity."""
from nexia.thermostat import NexiaThermostat
from nexia.zone import NexiaThermostatZone
from homeassistant.const import ATTR_ATTRIBUTION
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send
from homeassistant.helpers.entity import DeviceInfo
fr... | rohitranjan1991/home-assistant | homeassistant/components/nexia/entity.py | Python | mit | 4,354 | 0.000689 |
# Copyright 2009-2010 by Ka-Ping Yee
#
# 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 w... | Princessgladys/googleresourcefinder | lib/feedlib/geo.py | Python | apache-2.0 | 2,777 | 0.001801 |
# -*- coding: utf-8 -*-
import hashlib
import math
import struct
import base64
import json
import zlib
import binascii
from Crypto.Cipher import AES
from Crypto import Random
salt ='__E3S$hH%&*KL:"II<UG=_!@fc9}021jFJ|KDI.si81&^&%%^*(del?%)))+__'
fingerprint_len =4
iv_len =16
randomiv_len =4
print_log =False
# 输入密... | dungeonsnd/forwarding | EChat/pack.py | Python | bsd-3-clause | 3,621 | 0.023497 |
#! /usr/bin/env python
import re
from threading import Thread
from common_utils import *
# Todo: refactor using more of common_utils
receiver_end_time = 0
receiver_status = 0
def wait_for_receiver_finish(receiver_process):
global receiver_end_time
global receiver_status
receiver_status = receiver_proce... | ldemailly/wdt | test/wdt_port_block_test.py | Python | bsd-3-clause | 3,215 | 0.000622 |
from django.apps import AppConfig
class PersonalConfig(AppConfig):
name = 'personal'
| yamstudio/mysite | personal/apps.py | Python | mit | 91 | 0 |
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
# License: BSD Style.
from ...utils import verbose
from ..utils import _data_path, _data_path_doc
@verbose
def data_path(path=None, force_upd... | adykstra/mne-python | mne/datasets/misc/_misc.py | Python | bsd-3-clause | 697 | 0.001435 |
import sys
from pyasn1.compat.octets import octs2ints
from pyasn1 import error
from pyasn1 import __version__
flagNone = 0x0000
flagEncoder = 0x0001
flagDecoder = 0x0002
flagAll = 0xffff
flagMap = {
'encoder': flagEncoder,
'decoder': flagDecoder,
'all': flagAll
}
class Debug:
defaultPr... | coruus/pyasn1 | pyasn1/debug.py | Python | bsd-2-clause | 1,667 | 0.011398 |
"""
Linearization of higher order solutions for the purposes of visualization.
"""
import numpy as nm
from sfepy.linalg import dot_sequences
from sfepy.discrete.fem.refine import refine_reference
def get_eval_dofs(dofs, dof_conn, ps, ori=None):
"""
Get default function for evaluating field DOFs given a list o... | RexFuzzle/sfepy | sfepy/discrete/fem/linearizer.py | Python | bsd-3-clause | 4,428 | 0.001807 |
"""add follow table
Revision ID: f045592adab0
Revises: 56a3d184ac27
Create Date: 2017-10-06 00:38:24.001488
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f045592adab0'
down_revision = '56a3d184ac27'
branch_labels = None
depends_on = None
def upgrade():
... | mikkylok/mikky.lu | migrations/versions/f045592adab0_add_follow_table.py | Python | mit | 964 | 0.006224 |
sedge_config_header = """
# :sedge:
#
# this configuration generated from `sedge' file:
# {}
#
# do not edit this file manually, edit the source file and re-run `sedge'
#
"""
| sthysel/sedge | sedge/templates.py | Python | gpl-3.0 | 177 | 0.00565 |
# This file is part of MAMMULT: Metrics And Models for Multilayer Networks
#
# 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 ver... | KatolaZ/mammult | models/growth/node_deg_over_time.py | Python | gpl-3.0 | 2,400 | 0.01 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Nahuel Riva
# 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... | snemes/pype32 | setup.py | Python | bsd-3-clause | 4,235 | 0.004959 |
from django.conf.urls import url
from wagtail.documents.views import serve
urlpatterns = [
url(r'^(\d+)/(.*)$', serve.serve, name='wagtaildocs_serve'),
url(r'^authenticate_with_password/(\d+)/$', serve.authenticate_with_password,
name='wagtaildocs_authenticate_with_password'),
]
| mikedingjan/wagtail | wagtail/documents/urls.py | Python | bsd-3-clause | 298 | 0.003356 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. py:currentmodule:: leepstools.file.elastic
.. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca>
Read and generate LEEPS elastic file .ees.
"""
###############################################################################
# Copyright 2017 Hendrix Dem... | drix00/leepstools | leepstools/file/elastic.py | Python | apache-2.0 | 1,272 | 0.000786 |
__author__ = 'ramuta'
a = 1
b = 2
if a < b:
a = b
print a
print b
"""
Java equivalent
if (a < b) {
a = b;
}
If you delete parenthesis, brackets and semicolons you get python.
""" | ramuta/python101 | slide4.py | Python | gpl-2.0 | 193 | 0.010363 |
# -*- coding: utf-8 -*-
# © 2015 Elico corp (www.elico-corp.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import base64
import random
import string
from binascii import hexlify, unhexlify
from openerp import api, fields, models
try:
from captcha.image import ImageCaptcha
except ImportE... | Elico-Corp/odoo-addons | website_captcha_nogoogle/website.py | Python | agpl-3.0 | 2,704 | 0 |
"""
Preprocessing function for the bdf.
@author: mje
@email: mads [] cnru.dk
"""
import mne
from mne.preprocessing import ICA, create_eog_epochs
import matplotlib.pyplot as plt
import numpy as np
# SETTINGS
n_jobs = 1
reject = dict(eeg=300e-6) # uVolts (EEG)
l_freq, h_freq, n_freq = 0.5, 90, 50 # Frequency setting... | MadsJensen/agency_connectivity | sorted_scripts/python_processing/preprocessing.py | Python | bsd-3-clause | 9,616 | 0.000416 |
# Generated by Django 2.0.8 on 2018-08-14 10:45
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Banner',
fields=[
('id', models.AutoField(a... | sussexstudent/falmer | falmer/banners/migrations/0001_initial.py | Python | mit | 924 | 0.002165 |
movies = ["The Holy Grail", 1975, "Terry Jones & Terry Gilliam", 91,
["Graham Chapman", ["Michael Palin", "John Cleese",
"Terry Gilliam", "Eric Idle", "Terry Jones"]]]
def print_lol(a_list):
for each_item in a_list:
if isinstance(each_item, list):
prin... | simontakite/sysadmin | pythonscripts/headfirst/hfpy_code/01-MeetPython-Everyone-Loves-Lists/page30.py | Python | gpl-2.0 | 399 | 0.010025 |
#!/usr/local/bin/python
import os
import mysql.connector as mysql
metrics_mysql_password = os.environ["METRICS_MYSQL_PWD"]
sql_host = os.environ["SQL_HOST"]
metrics = os.environ["QUERY_ON"]
def dump_query_results():
"""
It is a simple SQL table dump of a given query so we can supply users with custom tables... | kbase/metrics | source/custom_scripts/dump_query_results.py | Python | mit | 4,387 | 0.004559 |
# Copyright (c) 2006-2007 The Regents of The University of Michigan
# 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 copyright
# notice, this ... | aferr/LatticeMemCtl | configs/example/memtest.py | Python | bsd-3-clause | 7,651 | 0.01307 |
#!/usr/bin/python
import os
import psycopg2
import sys
file = open("/home/" + os.getlogin() + "/.pgpass", "r")
pgpasses = []
for line in file:
pgpasses.append(line.rstrip("\n").split(":"))
file.close()
for pgpass in pgpasses:
#print str(pgpass)
if pgpass[0] == "54.236.235.110" and pgpass[3] == "geonode":
sr... | DOE-NEPA/geonode_2.0_to_2.4_migration | migrate_base_topiccategory.py | Python | gpl-2.0 | 1,677 | 0.023256 |
# Copyright (C) 2008 Google, Inc. All Rights Reserved.
# Copyright (C) 2012 Michael Bryant.
#
# 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 opt... | mikebryant/tsumufs | lib/tsumufs/metrics.py | Python | gpl-3.0 | 1,997 | 0.008513 |
"""
pghoard - common utility functions
Copyright (c) 2015 Ohmu Ltd
See LICENSE for details
"""
import fcntl
import logging
import os
try:
from backports import lzma # pylint: disable=import-error, unused-import
except ImportError:
import lzma # pylint: disable=import-error, unused-import
try:
from ur... | Ormod/pghoard | pghoard/common.py | Python | apache-2.0 | 6,515 | 0.001995 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | r39132/airflow | airflow/task/task_runner/__init__.py | Python | apache-2.0 | 1,803 | 0.001109 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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,... | gylian/sickrage | sickbeard/providers/ezrss.py | Python | gpl-3.0 | 5,370 | 0.003538 |
# -*- coding: utf-8 -*-
#
# This file is part of bd808's stashbot application
# Copyright (C) 2015 Bryan Davis and contributors
#
# 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... | bd808/tools-stashbot | stashbot/__init__.py | Python | gpl-3.0 | 845 | 0 |
import cs50
import sys
def main():
if len(sys.argv) != 2:
print("You should provide cmd line arguments!")
exit(1)
#if sys.argv[1].isalpha() == False:
#print("You should provide valid key!")
#exit(1)
kplainText = int(sys.argv[1])
cipher = []
plainText = cs50.... | DInnaD/CS50 | pset6/caesar.py | Python | apache-2.0 | 2,532 | 0.011453 |
# -*- coding: utf-8 -*-
# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
from django.core.exceptions import Va... | akvo/akvo-rsr | akvo/rsr/models/organisation_document.py | Python | agpl-3.0 | 6,312 | 0.003485 |
import datetime
data = [
{
"name": "test_put_contest_no_login",
"url": "/api/contest/",
"method": "put",
"payload": {
"title": "change",
"start": "2001-01-01 00:00:00",
"end": "2001-01-01 00:00:00",
"freeze": "0",
"descripti... | Tocknicsu/nctuoj_contest | test/api/contest/put_contest.py | Python | apache-2.0 | 3,747 | 0.004003 |
from unittest.mock import mock_open, patch, call
import pytest
from pytest import raises
from vang.misc.wc import is_excluded, is_included, count_words, count_letters, count, count_all, get_files, parse_args
@pytest.mark.parametrize('excluded, expected', [
[('foo.txt',), True],
[('.*.txt',), True],
[('.... | bjuvensjo/scripts | vang/misc/tests/test_wc.py | Python | apache-2.0 | 2,185 | 0.000915 |
# Copyright 2014, 2015 Kevin Reid <kpreid@switchb.org>
#
# This file is part of ShinySDR.
#
# ShinySDR 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) a... | hofschroeer/shinysdr | shinysdr/test/test_devices.py | Python | gpl-3.0 | 5,929 | 0.004891 |
# Copyright (C) British Crown (Met Office) & Contributors.
# This file is part of Rose, a framework for meteorological suites.
#
# Rose 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 L... | metomi/rose | metomi/rose/task_run.py | Python | gpl-3.0 | 6,607 | 0 |
# Copyright 2018 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... | google/loaner | loaner/web_app/backend/api/messages/template_messages.py | Python | apache-2.0 | 2,625 | 0.007619 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.