code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# coding=utf-8
import unittest
from app_config import Config
from unittest import mock
from campaign_manager.insights_functions.osmcha_changesets import (
OsmchaChangesets
)
from campaign_manager.test.helpers import CampaignObjectTest
class OsmchaChangesetTestCase(unittest.TestCase):
"""Test insight function ... | meomancer/field-campaigner | flask_project/campaign_manager/test/test_osmcha_changeset.py | Python | bsd-3-clause | 2,840 |
# Copyright 2015 Curtis Sand
#
# 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, ... | fretboardfreak/space | lib/error.py | Python | apache-2.0 | 936 |
from pathlib import Path
from shutil import rmtree
from git import Repo
from django.conf import settings
from MMTest.bindings.models import Binding
from MMTest.results.results import TestCaseResult
from MMTest.results.results import MMTestResult
from .runner import runner_factory
def execute_test(mmtest, implement... | ftovar/TCC | Codigo/MMTest/executions/execution_manager.py | Python | gpl-3.0 | 1,568 |
import pytest
from autograd import grad, jacobian
from autograd.scipy.special import (
gammainc as scipy_gammainc,
gammaincc as scipy_gammaincc,
gamma,
)
from autograd_gamma import gammainc, gammaincc, betainc, gammaincln, gammaincinv, gammainccinv, betaincinv
import numpy as np
import numpy.testing as npt
... | CamDavidsonPilon/autograd-gamma | tests/test_autograd_gamma.py | Python | mit | 4,394 |
# coding:utf-8
'''
money recognition v4
winxos 2016-01-07
'''
import cv2
import numpy as np
import time
from datetime import datetime
import math
class board:
mask = None
board_field = None
showflag = True
exact = None
moneys = []
money_files = {"1b.png": "1 yuan back", "1f.png": "1 yuan front... | winxos/python | money recognition/money v4.py | Python | mit | 7,721 |
#-*- coding: utf-8 -*-
import os
import sys
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import pylab as P
import pandas as pd
from .chart import Chart
from .entry.couple import CoupleEntry
class CoupleChart(Chart):
def __init__(self, *args, **kwargs):
super(CoupleChart, self).... | Frky/scat | src/shell/chart/couple.py | Python | mit | 7,891 |
from modeltranslation.translator import TranslationOptions, translator
from mezzanine.core.translation import TranslatedRichText
from mezzanine.galleries.models import Gallery, GalleryImage
class TranslatedGallery(TranslatedRichText):
fields = ()
class TranslatedGalleryImage(TranslationOptions):
fields = (... | stephenmcd/mezzanine | mezzanine/galleries/translation.py | Python | bsd-2-clause | 444 |
import struct, fcntl
def writelock(f):
_lock(f, fcntl.F_WRLCK)
def readlock(f):
_lock(f, fcntl.F_RDLCK)
def unlock(f):
_lock(f, fcntl.F_UNLCK)
def _lock(f, op):
dummy = fcntl.fcntl(f.fileno(), fcntl.F_SETLKW,
struct.pack('2h8l', op,
0, 0, 0... | xbmc/atv2 | xbmc/lib/libPython/Python/Lib/lib-old/lockfile.py | Python | gpl-2.0 | 341 |
import nose
import time
import pickle
import networkx
import logging
l = logging.getLogger("angr.tests.test_cfgemulated")
import os
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')
import angr
from angr import options as o
def compare_cfg(standard, g, funct... | schieb/angr | tests/test_cfgemulated.py | Python | bsd-2-clause | 20,597 |
# shrt - A _really_ simple link shortener
# Copyright (C) 2015 Mitame
#
# 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.... | Mitame/shrt | shrt/__init__.py | Python | gpl-3.0 | 899 |
from tendrl.commons.message import Message as CommonMessage
from tendrl.commons import objects
class ClusterMessage(objects.BaseObject, CommonMessage):
internal = True
def __init__(self, **cluster_message):
self._defs = {}
CommonMessage.__init__(self, **cluster_message)
objects.BaseO... | Tendrl/node_agent | tendrl/node_agent/objects/cluster_message/__init__.py | Python | lgpl-2.1 | 790 |
# BurnMan - a lower mantle toolkit
# Copyright (C) 2012, 2013, Heister, T., Unterborn, C., Rose, I. and Cottaar, S.
# Released under GPL v2 or later.
"""
example_composition
-------------------
This example shows how to create different minerals, how to compute seismic
velocities, and how to compare them to a se... | QuLogic/burnman | examples/example_composition.py | Python | gpl-2.0 | 6,658 |
# event/legacy.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
"""Routines to handle adaption of legacy call signatures,
generation of deprecation... | sqlalchemy/sqlalchemy | lib/sqlalchemy/event/legacy.py | Python | mit | 7,900 |
from collections import deque, Counter
command_string = "L2, L3, L3, L4, R1, R2, L3, R3, R3, L1, L3, R2, R3, L3, R4, R3, R3, L1, L4, R4, L2, R5, R1, L5, R1, " \
"R3, L5, R2, L2, R2, R1, L1, L3, L3, R4, R5, R4, L1, L189, L2, R2, L5, R5, R45, L3, R4, R77, L1, R1, " \
"R194, R2, L5, L3, ... | sclarke/adventofcode2016 | d01.py | Python | bsd-3-clause | 1,577 |
"""
PyCSP implementation of the CSP Core functionality (Channels, Processes, PAR, ALT).
Copyright (c) 2009 John Markus Bjoerndalen <jmb@cs.uit.no>,
Brian Vinter <vinter@nbi.dk>, Rune M. Friborg <rune.m.friborg@gmail.com>.
See LICENSE.txt for licensing details (MIT License).
Versions available: parallel, greenl... | runefriborg/pycsp | pycsp/__init__.py | Python | mit | 664 |
import csv
from datetime import date
from django.core.management.base import BaseCommand
from member.models import (
Client, Member, Referencing, EmergencyContact
)
class Command(BaseCommand):
help = 'Data: import clients relationships from given csv file.'
ROW_MID = 0
ROW_RID = 1
ROW_FIRSTNAME... | savoirfairelinux/sous-chef | src/datamigration/management/commands/importrelationships.py | Python | agpl-3.0 | 3,315 |
from collections import OrderedDict
from edc_export.actions import export_as_csv_action
from tshilo_dikotla.base_model_admin import MembershipBaseModelAdmin
from ..models import MaternalVisit
class BaseMaternalModelAdmin(MembershipBaseModelAdmin):
dashboard_type = 'maternal'
visit_model_name = 'maternalvis... | botswana-harvard/tshilo-dikotla | td_maternal/admin/base_maternal_model_admin.py | Python | gpl-2.0 | 1,919 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""
lastchange.py -- Chromium revision fetching utility.
"""
import re
import optparse
import os
import subprocess
import sys
_GI... | Chilledheart/chromium | build/util/lastchange.py | Python | bsd-3-clause | 9,354 |
from distutils.core import setup
setup(
name = 'lsdeflate',
packages = ['lsdeflate'], # this must be the same as the name above
version = '0.3',
description = 'Compress ls output by gathering numeric ranges into brace expansions',
author = 'Daan van Vugt',
author_email = 'daanvanvugt@gmail.com',
url = 'ht... | Exteris/lsdeflate | setup.py | Python | gpl-3.0 | 621 |
# -*- coding: utf-8 -*-
"""
sphinx.util.compat
~~~~~~~~~~~~~~~~~~
Stuff for docutils compatibility.
:copyright: 2008 by Georg Brandl.
:license: BSD.
"""
from docutils import nodes
# function missing in 0.5 SVN
def make_admonition(node_class, name, arguments, options, content, lineno,
... | BackupGGCode/sphinx | sphinx/util/compat.py | Python | bsd-3-clause | 1,201 |
import os
import sys
import importlib
try:
from django.core.handlers.wsgi import WSGIHandler
except ImportError as e:
raise ImportError(
str(e) + '\n' +
'Hendrix is a Django plugin. As such Django must be installed.'
), None, sys.exc_info()[2]
from twisted.web.resource import Resource, Forbi... | zenweasel/hendrix | hendrix/contrib/__init__.py | Python | mit | 3,127 |
# -*- coding: utf-8 -*-
#
# django cms documentation build configuration file, created by
# sphinx-quickstart on Tue Sep 15 10:47:03 2009.
#
# 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.
#
... | pbs/django-cms | docs/conf.py | Python | bsd-3-clause | 6,932 |
'''Utility functions for xauth.'''
import os
import hashlib
import easyprocess
class NotFoundError(Exception):
'''Error when xauth was not found.'''
pass
def is_installed():
'''
Return whether or not xauth is installed.
'''
try:
easyprocess.EasyProcess(['xauth', '-h']).check_install... | suninsky/ReceiptOCR | Python/server/lib/python2.7/site-packages/pyvirtualdisplay/xauth.py | Python | mit | 741 |
#!/usr/bin/env python
"""
Example application views.
Note that `render_template` is wrapped with `make_response` in all application
routes. While not necessary for most Flask apps, it is required in the
App Template for static publishing.
"""
import app_config
import json
import oauth
import static
import re
import s... | mroswell/m2016 | app.py | Python | mit | 2,659 |
# pylint: disable=too-many-lines, invalid-name, too-many-instance-attributes, too-many-branches, too-few-public-methods
from __future__ import (absolute_import, division, print_function)
import abc
import re
from math import copysign
from sans.common.enums import (ISISReductionMode, DetectorType, RangeStepType, FitT... | dymkowsk/mantid | scripts/SANS/sans/user_file/user_file_parser.py | Python | gpl-3.0 | 96,908 |
# 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.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | johnpbatty/python-neutronclient | neutronclient/shell.py | Python | apache-2.0 | 44,766 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#=======================================================================
#
# aes.py
# ------
# Simple, pure Python, word based model of the AES cipher with
# support for 128 and 256 bit keys.
#
#
# Author: Joachim Strömbergson
# Copyright (c) 2014, Secworks Sweden AB
# All... | secworks/aes | src/model/python/aes.py | Python | bsd-2-clause | 34,499 |
import bpy
from ... base_types.node import AnimationNode
class TransformVectorListNode(bpy.types.Node, AnimationNode):
bl_idname = "an_TransformVectorListNode"
bl_label = "Transform Vector List"
def create(self):
self.newInput("Vector List", "Vector List", "vectors")
self.newInput("Matrix"... | Thortoise/Super-Snake | Blender/animation_nodes-master/nodes/vector/transform_vector_list.py | Python | gpl-3.0 | 529 |
# Copyright 2021 DeepMind Technologies Limited.
#
#
# 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 agre... | deepmind/deepmind-research | galaxy_mergers/helpers.py | Python | apache-2.0 | 8,748 |
#
# $Id: sphinxapi.py 4522 2014-01-30 11:00:18Z tomat $
#
# Python version of Sphinx searchd client (Python API)
#
# Copyright (c) 2006, Mike Osadnik
# Copyright (c) 2006-2014, Andrew Aksyonoff
# Copyright (c) 2008-2014, Sphinx Technologies Inc
# All rights reserved
#
# This program is free software; you can redistribu... | p4apple/sphinx_gt4g | api/sphinxapi.py | Python | gpl-2.0 | 34,870 |
# -*- coding: utf-8 -*-
import os
import yaml
class Dict2Object(object):
"""Dado un diccionario como constructor, cuando se pide un atributo
de la instancia de esta clase, se retorna el valor asociado a la key
del diccionario pasado al constructor."""
def __init__(self, obj):
assert isinstan... | DoctorMalboro/pynps | nps/config.py | Python | gpl-3.0 | 1,365 |
import wx
class TestFrame(wx.Frame):
def __init__(self,parent,title):
wx.Frame.__init__(self,parent,title=title,size=(300,200))
self.sz = wx.BoxSizer(wx.VERTICAL)
# Creating controls
self.rb1 = wx.RadioButton(self, -1, "12")
self.rb2 = wx.RadioButton(self, -1, "14")... | JorgeDeLosSantos/curso-wxpython | Clase 13/c13.py | Python | mit | 1,905 |
#!/usr/bin/env python
#
# Copyright 2020 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr, gr_unittest
from gnuradio import blocks
import random, numpy
from gnuradio import digital
from gnuradio import channels
class qa_mea... | jdemel/gnuradio | gr-digital/python/digital/qa_meas_evm_cc.py | Python | gpl-3.0 | 4,263 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Test audit RBAC"""
from os.path import abspath
from os.path import dirname
from os.path import join
from collections import defaultdict
from integration.ggrc.converters import TestCase
from integration.g... | edofic/ggrc-core | test/integration/ggrc_basic_permissions/test_audit_rbac.py | Python | apache-2.0 | 3,715 |
#!/bin/env python
""" create rst files for documentation of DIRAC """
import os
import shutil
import socket
import sys
import logging
import glob
logging.basicConfig(level=logging.INFO, format='%(name)s: %(levelname)8s: %(message)s')
LOG = logging.getLogger('MakeDoc')
def mkdir(folder):
"""create a folder, ignore ... | petricm/DIRAC | docs/Tools/MakeDoc.py | Python | gpl-3.0 | 12,409 |
# Copyright 2014 Netflix, 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... | Netflix/security_monkey | security_monkey/views/user_settings.py | Python | apache-2.0 | 6,257 |
from curses import wrapper
import time
def main(stdscr):
# Clear screen
stdscr.clear()
# This raises ZeroDivisionError when i == 10.
for i in range(0, 9):
v = i-10
stdscr.addstr(i, 0, '10 divided by {} is {}'.format(v, 10/v))
stdscr.refresh()
time.sleep(2)
stdscr.r... | hjgode/py1090_2 | curses_test.py | Python | mit | 364 |
#!/usr/bin/env python
# Copyright 2016 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... | JavaRabbit/CS496_capstone | bigquery/cloud-client/query_params.py | Python | apache-2.0 | 7,832 |
# -*- encoding: utf-8 -*-
# jtuki@foxmail.com
r"""simple logger.
https://github.com/jtuki/python-snippets/tree/master/src/simple_logging_test
"""
# import gevent
# import gevent.monkey
# gevent.monkey.patch_all()
import logging
import logging.config
# configuration of logger, we use stream and rotating file.
loggin... | jtuki/tubelink_simulation | src/simple_logger.py | Python | mit | 1,605 |
import re
import Queue
import HTMLParser
import dateutil.parser as parser
class TwitterData:
#Twitter Datum properties
tweet_fields_list = ['id', 'user_id', 'in_reply_to_status_id', 'in_reply_to_user_id', 'favorited', 'retweeted', 'retweet_count', 'lang', 'created_at']
tweet_text_fields_list = ['tweet_id... | kuzeko/Twitter-Importer | twitter_helper/twitter_data.py | Python | mit | 8,560 |
# -*- coding: utf-8 -*-
'''
Local Configurations
'''
from base import *
# DEBUG
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# END DEBUG
# INSTALLED_APPS
INSTALLED_APPS = INSTALLED_APPS
# END INSTALLED_APPS
# Mail settings
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBack... | letoosh/techfugees | techfugees/techfugees/settings/local.py | Python | bsd-3-clause | 806 |
# Statement for enabling the development environment
DEBUG = True
# Define the application directory
import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
# Define the database - we are working with
# SQLite for this example
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(BASE_DIR, 'app.db')
DATABAS... | drincruz/slidedecker | config.py | Python | mit | 838 |
#
# Copyright 2013 eNovance <licensing@enovance.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 ... | chungg/aodh | aodh/tests/api/v2/test_alarm_scenarios.py | Python | apache-2.0 | 117,486 |
from rest_framework.permissions import IsAuthenticated
from rest_framework.viewsets import ModelViewSet
from gcm.serializers import DeviceSerializer
from gcm.utils import get_device_model
Device = get_device_model()
class DevicesViewSet(ModelViewSet):
queryset = Device.objects.all()
serializer_class = Devic... | hugobrilhante/django-gcm-android-ios | gcm/api.py | Python | mit | 429 |
#!/usr/bin/env python3
# Copyright 2010-2021 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 ... | google/or-tools | ortools/sat/samples/schedule_requests_sat.py | Python | apache-2.0 | 5,137 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-13 20:19
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('mac_app', '0005_auto_20170413_1910'),
]
operations =... | stevarino/cmsc495 | mac_app/migrations/0006_ticketnote_deptartment.py | Python | mit | 604 |
from .errors import *
from .module_ultra_config import *
from .module_ultra_repo import *
from .pipeline_instance import *
from .result_schema import *
from .utils import *
| MetaSUB/ModuleUltra | moduleultra/__init__.py | Python | mit | 174 |
# Copyright 2014 PerfKitBenchmarker 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 appli... | syed/PerfKitBenchmarker | perfkitbenchmarker/static_virtual_machine.py | Python | apache-2.0 | 10,858 |
# -*- coding: utf-8 -*-
#
# django-pyston documentation build configuration file, created by
# sphinx-quickstart on Wed Aug 26 20:27:52 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.... | druids/django-pyston | docs/conf.py | Python | bsd-3-clause | 11,467 |
#!/usr/bin/env python
import roslib
roslib.load_manifest('nlp')
import rospy
from nlp.srv import String, StringResponse
def handle_test_service(request):
return StringResponse("bar")
def string_server():
rospy.init_node("test_server")
srv = rospy.Service("test_service", String, handle_test_service)
... | PennNLP/SLURP | ros/test_basic/src/test_service.py | Python | gpl-3.0 | 478 |
# Copyright 2016 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/tensorflow | tensorflow/python/kernel_tests/distributions/kullback_leibler_test.py | Python | apache-2.0 | 5,254 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Tag.deleted_at'
db.delete_column(u'tag', 'deleted_at')
... | caogecym/muer | forum/migrations/0004_auto__del_field_tag_deleted_at__del_field_tag_deleted_by__add_field_ta.py | Python | gpl-2.0 | 13,220 |
import sys
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
sys.path.insert(0, "../../")
from scaley import app
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////scaley/scaley/db/scaley.db'
db = SQLAlchemy(app)
class CloudConfig(db.Model):
uid = db.Column(db.Integer, primary_key=True)
a... | ieldib/scaley | scaley/scaley/module/db.py | Python | gpl-2.0 | 1,583 |
"""
@deprecated
Attempt to use a globally ordered queue to manage the nodes that
should be grown. Turns out it's tricky to decide on a good scoring
function.
"""
import time
import pdb
import sys
import Orange
import orange
import heapq
import bisect
import numpy as np
sys.path.extend(['.', '..'])
from collection... | sirrice/scorpion | scorpion/sigmod/newbdtp.py | Python | mit | 15,183 |
import slot
import slot.extensions
class TestExtension(slot.extensions.BaseExtension):
pass
@slot.requires("API", 1)
def factory(bot, config):
return TestExtension(bot, config)
| Slko/Slot | slot/extensions/test.py | Python | bsd-3-clause | 189 |
# TODO(colin): fix these lint errors (http://pep8.readthedocs.io/en/release-1.7.x/intro.html#error-codes)
# pep8-disable:E128
"""Linter that warns against files that aren't following frontend best
practices.
At the moment this checks for handlebars, less, and css files and complains if
any attempts are made to add new... | Khan/khan-linter | contrib/frontend_best_practices_lint.py | Python | apache-2.0 | 25,800 |
import sys
import seq
import os
import argparse as ap
def generate_argparser():
parser = ap.ArgumentParser(prog="change_ncbi_to_name_fasta.py",
formatter_class=ap.ArgumentDefaultsHelpFormatter)
parser = ap.ArgumentParser()
parser.add_argument("-t", "--table", type=str, help="NCBI translation table"... | FePhyFoFum/PyPHLAWD | src/change_ncbi_to_name_fasta.py | Python | gpl-2.0 | 1,058 |
import win32api, win32con, win32security, ntsecuritycon
new_privs = ((win32security.LookupPrivilegeValue('',ntsecuritycon.SE_SECURITY_NAME),win32con.SE_PRIVILEGE_ENABLED),
(win32security.LookupPrivilegeValue('',ntsecuritycon.SE_TCB_NAME),win32con.SE_PRIVILEGE_ENABLED)
)
ph = win32api.GetCurren... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/pywin32-218-py2.7-win32.egg/Demos/security/regsecurity.py | Python | gpl-2.0 | 1,021 |
_PAD_GRID_MIN =36
_PAD_GRID_MAX = 99
_PAD_GRID_SIZE = 8 # Push 2 pad grid is square
def is_pad(note):
"""
Returns True if note corresponds to one of the grid pads.
"""
return _PAD_GRID_MIN <= note and note <= _PAD_GRID_MAX
def get_pad_xy_from_note(note):
"""
Gets the (x, y) coordinate of the specified pad... | jonathonw/pypush2 | pypush2/pads.py | Python | bsd-3-clause | 1,054 |
import requests
from qiniu import Auth
from qiniu import put_data
from flask_upload.views import upload_blueprint
URL_PREFIX = 'url_prefix'
ACCESS_KEY = 'qiniu_access_key'
SECRET_KEY = 'qiniu_secret_key'
BUCKET = 'qiniu_bucket'
HOST = 'qiniu_cdn'
missing = object()
class Upload(object):
def __i... | by46/coffee | flask_upload/extension.py | Python | mit | 2,062 |
from setuptools import find_packages, setup
version = __import__('deduplicated').__version__
with open('README.rst', 'rb') as f:
long_description = f.read().decode('utf-8')
setup(
name='deduplicated',
version=version,
packages=find_packages(),
extras_require={
'web': ['Flask'],
},
... | eduardoklosowski/deduplicated | setup.py | Python | mit | 1,440 |
import flavorsync.test.util as util
from flavorsync.parser.parser_factory import ParserFactory
from flavorsync.model import Infrastructure, Flavor, FlavorCollection, FlavorInfrastructureLink
from flavorsync.parser.xml.xml_infrastructure_parser import XMLInfrastructureParser
from flavorsync.exceptions import FlavorSync... | Fiware/ops.Flavor-sync | flavorsync/test/parser_unit_tests.py | Python | apache-2.0 | 12,194 |
from sklearn import feature_extraction,linear_model, model_selection, pipeline
from insults.classifier import InsultsSGDRegressor
class InsultsPipeline(pipeline.Pipeline):
"""
Custom version of scikit-learn's Pipeline class, with an extra method for
use in tuning.
"""
def staged_auc(self, X, y):
... | thundergolfer/Insults | insults/pipeline.py | Python | gpl-3.0 | 1,411 |
#!/usr/bin/env python
# coding: utf-8
import abc
import numpy as np
from collections import Sequence
class DataSet(object):
def __init__(self, data, labels, n_class, is_label_bits=False, name=None,
is_continuous_labels=False):
data = np.asarray(data)
labels = np.asarray(labels)
... | kanairen/TensorFlowNet | core/dataset.py | Python | mit | 8,203 |
# Copyright (C) 2014 - The MITRE Corporation
# For license information, see the LICENSE.txt file
#: Namespace map of namespaces libtaxii knows about
NS_MAP = {
'taxii': 'http://taxii.mitre.org/messages/taxii_xml_binding-1',
'taxii_11': 'http://taxii.mitre.org/messages/taxii_xml_binding-1.1',
'tdq': 'http:/... | Intelworks/libtaxii | libtaxii/constants.py | Python | bsd-3-clause | 13,355 |
import urlparse
from django.views import generic as generic_views
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_lazy as _
from django.utils.importlib import import_module
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.template.r... | zerok/pyconde-website-mirror | pyconde/proposals/views.py | Python | bsd-3-clause | 13,523 |
from pyelastictest.isolated import Isolated, IsolatedTestCase # NOQA
__all__ = ('Isolated', 'IsolatedTestCase')
| hannosch/pyelastictest | pyelastictest/__init__.py | Python | apache-2.0 | 114 |
from rest_framework import serializers
from models import *
class BuildSerializer(serializers.ModelSerializer):
class Meta:
model = Build
fields = ('build_number',)
class AccountSerializer(serializers.Serializer):
email = serializers.EmailField()
| ldiqual/buildnumber.io | api/serializers.py | Python | mit | 274 |
# Copyright 2012 VMware, 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 agree... | gkotton/vmware-nsx | vmware-nsx/neutron/plugins/vmware/common/config.py | Python | apache-2.0 | 8,941 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-30 07:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('plants', '0008_auto_20160316_1434'),
]
operations = [
migrations.AlterField(... | mgnusl/herb-pi | plants/migrations/0009_auto_20160330_0914.py | Python | mit | 750 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import contextlib
import hashlib
import os
import shutil
import uuid
from abc import abstractmethod
from email import message_from_string
from .common import safe_mkdtemp, safe_open
from ... | objmagic/heron | third_party/pex/pex/http.py | Python | apache-2.0 | 8,323 |
#!/usr/bin/python
##############################################
###Python template
###Author: Elizabeth Lee
###Date: June 3, 2013
###Function: 1) draw charts for OR vs weighted average of vaccine effectiveness, which was calculated from data in Table 4 in Osterholm et al.
### 2) draw charts for OR vs weighted average... | eclee25/flu-SDI-exploratory-age | scripts/pre_ORgenerator_py/OR_vaxeffs_v6-3-13.py | Python | mit | 7,632 |
# This file is part of beets.
# Copyright 2013, Blemjhoo Tezoulbr <baobab@heresiarch.info>.
#
# 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 limitati... | glittershark/beets | beetsplug/the.py | Python | mit | 3,338 |
# -*- coding: utf-8 -*-
"""plane3.py
Representation of a directed plane in 3D.
License:
http://www.apache.org/licenses/LICENSE-2.0"""
from .vector3 import Vector3
class Plane3(object):
def __init__(self, normal: Vector3, w: float) -> None:
self.__normal = normal
self.__w = w
@property... | GarrettGutierrez1/FFG_Geo | ffg_geo/plane3.py | Python | apache-2.0 | 1,219 |
import io
from collections import defaultdict
def remove_comprising(words):
seen = set()
result_words = []
for word in words:
for small_word in words:
if small_word in word and small_word != word:
if small_word in seen:
word = word.replace(small_word,... | alvations/Panda-Hyper-Decoder | code/pervasive.py | Python | cc0-1.0 | 1,565 |
# Copyright 2011 OpenStack Foundation
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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
#
# ... | petrutlucian94/nova_dev | nova/virt/libvirt/volume.py | Python | apache-2.0 | 46,030 |
# $Id: stp.py 23 2006-11-08 15:45:33Z dugsong $
# -*- coding: utf-8 -*-
"""Spanning Tree Protocol."""
import dpkt
class STP(dpkt.Packet):
__hdr__ = (
('proto_id', 'H', 0),
('v', 'B', 0),
('type', 'B', 0),
('flags', 'B', 0),
('root_id', '8s', ''),
('root_path', 'I',... | lkash/test | dpkt/stp.py | Python | bsd-3-clause | 1,695 |
import signal
import time
import os
import click
import psycopg2
from runutils import (run_daemon, runbash, ensure_dir, getvar, run_cmd,
copyfile, ensure_user, get_user_ids,
substitute, Stopper)
# ####################################
# # CONFIGURATION: Edit if necessary #... | vertisfinance/docker-images | django-py3/config/run.py | Python | mit | 4,574 |
"""
>>> avg = make_averager()
>>> avg(10)
10.0
>>> avg(11)
10.5
>>> avg(12)
11.0
>>> avg.__code__.co_varnames
('new_value', 'total')
>>> avg.__code__.co_freevars
('series',)
>>> avg.__closure__ # doctest: +ELLIPSIS
(<cell at 0x...: list object at 0x...>,)
>>> avg.__closure__[0].cell_contents
[10, 11, 12... | YuxuanLing/trunk | trunk/code/study/python/Fluent-Python-example-code/07-closure-deco/average.py | Python | gpl-3.0 | 617 |
'''
Created on Jun 4, 2017
@author: Sam Holden <sholden@holden.id.au>
'''
import random
def rollDice(number, modifier=0, min_=None, max_=None):
"""Return the result of [number]d6+[modifier] limited between min and max."""
result = 0
for _ in range(number):
result = result + random.randint(1,6)
... | sjholden/traveller-universe | travelleruniverse/utils.py | Python | gpl-3.0 | 497 |
from django.conf import settings
from django.conf.urls import include
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import path
from moderator.moderate import views as moderate_views
event_urls = [
path("<str:e_slug>/", moderate_views.show_event, name="event"),
path("<st... | akatsoulas/mozmoderator | moderator/moderate/moderate_urls.py | Python | agpl-3.0 | 1,802 |
from .primitive import *
from ..rect import Rect
class Rectangle(Primitive):
def __init__(self):
super(Rectangle, self).__init__()
def build(self, renderer, rect, color):
self.color = color
# Compute the square in absolute coordinates
self.abs_rect = sdl2.SDL_Rect(*rect.getTuple())
def draw(self, rendere... | Romaingin/Antlia | antlia/blueprint/rectangle.py | Python | mit | 478 |
#
# This file is part of the CCP1 Graphical User Interface (ccp1gui)
#
# (C) 2002-2005 CCLRC Daresbury Laboratory
#
# 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 ... | alexei-matveev/ccp1gui | objects/periodic.py | Python | gpl-2.0 | 24,196 |
#!/usr/bin/env python3
import math
class VectorXYZ(object):
def __init__(self, x2, y2, z2):
self.__x = x2
self.__y = y2
self.__z = z2
def get_x(self):
return self.__x
def get_y(self):
return self.__y
def get_z(self):
return self.__z
def length(self):
"""
Return the length of the vector... | strummerTFIU/TFG-IsometricMaps | src/vector_XYZ.py | Python | mit | 2,505 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Canonical
#
# Authors:
# Didier Roche
# Tin Tvrtković
#
# 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; version 3.
#
# This program is distributed... | Tankypon/ubuntu-make | tests/large/test_ide.py | Python | gpl-3.0 | 24,680 |
# coding: utf-8
#
# Copyright 2020 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | prasanna08/oppia | scripts/linters/codeowner_linter.py | Python | apache-2.0 | 14,292 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2013 by the FIFE team
# http://www.fifengine.net
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of ... | whiterabbitengine/fifeplusplus | demos/pychan_demo/pychan_demo.py | Python | lgpl-2.1 | 7,957 |
"""
byceps.services.consent.dbmodels.subject
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from typing import Optional
from ....database import db, generate_uuid
from ....util.instances import ReprBuilder
class Subject... | homeworkprod/byceps | byceps/services/consent/dbmodels/subject.py | Python | bsd-3-clause | 1,275 |
from __future__ import absolute_import, division, unicode_literals
from html5lib import constants, parseFragment, serialize
from html5lib.filters import sanitizer
def runSanitizerTest(_, expected, input):
parsed = parseFragment(expected)
expected = serialize(parsed,
omit_optional_tag... | UK992/servo | tests/wpt/web-platform-tests/tools/third_party/html5lib/html5lib/tests/test_sanitizer.py | Python | mpl-2.0 | 5,540 |
#!/usr/bin/env python
# License: BSD 3 clause
import sys
from setuptools import find_packages, setup
# Get version without importing, which avoids dependency issues
exec(compile(open('skll/version.py').read(), 'skll/version.py', 'exec'))
# (we use the above instead of execfile for Python 3.x compatibility)
def readm... | ernfrid/skll | setup.py | Python | bsd-3-clause | 2,794 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ev3robot import *
#max_speed = 1023
robo=EV3Robot()
robo.motor('outA').rotate(rot=2,speed=800)
robo.motor('outA').rotate(rot=-1,speed=800)
robo.done()
| girafenok/robots | examples/ev3/motors/ev3_motor_rotate.py | Python | gpl-2.0 | 203 |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... | Azure/azure-sdk-for-python | sdk/servicebus/azure-servicebus/samples/sync_samples/auto_lock_renew.py | Python | mit | 6,100 |
# -*- coding: utf-8 -*-
from .Node import Node
from .Object import FWObject
import codecs
class SCRDRTree:
"""
Single Classification Ripple Down Rules tree for Part-of-Speech and morphological tagging
"""
def __init__(self, root = None):
self.root = root
... | jonathandunn/c2xg | c2xg/modules/rdrpos_tagger/SCRDRlearner/SCRDRTree.py | Python | gpl-3.0 | 6,467 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from rivescript.exceptions import RS_ERR_MATCH
from .config import RiveScriptTestCase
class TopicTest(RiveScriptTestCase):
"""Topic tests."""
def test_punishment_topic(self):
self.new("""
... | Dinh-Hung-Tu/rivescript-python | tests/test_topics.py | Python | mit | 4,421 |
# -*- coding: utf-8 -*-
"""
Tests for the utilities used by integration channels.
"""
import unittest
from collections import namedtuple
from datetime import timedelta
from unittest.mock import MagicMock, PropertyMock
import ddt
import mock
from pytest import raises
from enterprise.utils import parse_lms_api_datetim... | edx/edx-enterprise | tests/test_integrated_channels/test_utils.py | Python | agpl-3.0 | 8,671 |
#!/usr/bin/env python3
# Migrates to version 0.11
import os
import lib.hunting as hunting
import logging
import logging.config
from lib.constants import VT_VERSION, VT_HOME
log_path = os.path.join(VT_HOME, "etc", "logging.ini")
try:
logging.config.fileConfig(log_path)
log = logging.getLogger("processDownloads... | Magicked/vt-hunter | migrate/migrate_0.11.py | Python | mit | 1,293 |
# dockerpty: test_io.py.
#
# Copyright 2014 Chris Corbyn <chris@w3style.co.uk>
#
# 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 re... | d11wtq/dockerpty | tests/unit/test_io.py | Python | apache-2.0 | 9,041 |
import os
import subprocess
class GitImporter(object):
"""An importer for testgit repositories.
This importer simply delegates to git fast-import.
"""
def __init__(self, repo):
"""Creates a new importer for the specified repo.
"""
self.repo = repo
def do_import(self, ba... | schacon/git | git_remote_helpers/git/importer.py | Python | gpl-2.0 | 1,006 |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... | huiyiqun/check_mk | web/htdocs/gui_exceptions.py | Python | gpl-2.0 | 2,649 |
import pygame
import math
import gamelib
# TODO: Implement BaseMenu class
#######################
class BaseMenu:
def __init__(self, basegame, config, audio=True):
self.basegame = basegame
self.config = config
self.audio = audio
self.screen_size = basegame.get_screen_size()
... | google-code/balldodge | src/menu.py | Python | gpl-2.0 | 5,800 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.