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 |
|---|---|---|---|---|---|
# 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
# d... | guptaankita/python-novaclient | novaclient/tests/functional/test_volumes_api.py | Python | apache-2.0 | 3,419 |
import inflection
inflector = inflection
| markEarvin/sl-contest-tracker | ferris/core/__init__.py | Python | mit | 41 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
from pants.base.fingerprint_strategy import DefaultFingerprintStrategy
from pants_test.te... | twitter/pants | tests/python/pants_test/base/test_fingerprint_strategy.py | Python | apache-2.0 | 921 |
#!/usr/bin/env python
from cli import cli
cli() | ethanwh/tfrrs | tfrrs/__main__.py | Python | mit | 49 |
# #####
# This file is part of the RobotDesigner of the Neurorobotics subproject (SP10)
# in the Human Brain Project (HBP).
# It has been forked from the RobotEditor (https://gitlab.com/h2t/roboteditor)
# developed at the Karlsruhe Institute of Technology in the
# High Performance Humanoid Technologies Laboratory (H2T)... | HBPNeurorobotics/BlenderRobotDesigner | robot_designer_plugin/operators/collision.py | Python | gpl-2.0 | 17,538 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from flask_script import Manager, Shell, prompt_bool
from flask import request, render_template
from unpcmdb.extensions import db
from unpcmdb.user.models import User
from unpcmdb.asset.models import Archetype, ArchetypeAttribute, Entity, EntityValue
from unpcmdb... | simple2source/unp-cmdb | manage.py | Python | apache-2.0 | 1,707 |
#!/usr/bin/env python3
import argparse
import logging
import json
def run(args):
infile = args.input
outfile = args.output
inp_format = args.format
config = args.config
if inp_format == 'toolbox':
import xigt.importers.toolbox as importer
elif inp_format == 'odin':
import xigt.... | goodmami/xigt | xigt/scripts/xigt_import.py | Python | mit | 1,443 |
import helpers.common as common
from multiprocessing import Process
import math
from index import *
from token_index import weightFun as tokenWeightFun
from token_index import genKeys as tokenGenKeys
from ident_index import weightFun as identWeightFun
from ident_index import genKeys as identGenKeys
def runAssignment(... | JonathanPierce/Algae | processors/bloom.py | Python | mit | 4,755 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Legendgrouptitle(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "histogram2d"
_path_str = "histogram2d.legendgrouptitle"
_valid_props = {"font", "t... | plotly/plotly.py | packages/python/plotly/plotly/graph_objs/histogram2d/_legendgrouptitle.py | Python | mit | 4,724 |
class Solution:
def productExceptSelf(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
if (not nums):
return None
n = len(nums)
result = [1] * n
prod = 1
for i in range(n):
result[i] = result[i] * pr... | stuti-rastogi/leetcodesolutions | 238_productOfArrayExceptSelf.py | Python | apache-2.0 | 519 |
"""
Tweak influence weights on a vertex level.
.. figure:: https://github.com/robertjoosten/rjSkinningTools/raw/master/tweakVertexWeights/README.png
:align: center
`Link to Video <https://vimeo.com/120942200>`_
Installation
============
Copy the **rjSkinningTools** folder to your Maya scripts directory
::
... | josephkirk/PipelineTools | packages/rjTools/tweakVertexWeights/__init__.py | Python | bsd-2-clause | 1,973 |
# This file is part of cloud-init. See LICENSE file for license information.
"""Setup image for testing."""
from functools import partial
import os
import yaml
from tests.cloud_tests import LOG
from tests.cloud_tests import stage, util
def installed_package_version(image, package, ensure_installed=True):
"""Ge... | larsks/cloud-init | tests/cloud_tests/setup_image.py | Python | gpl-3.0 | 8,779 |
# Copyright 2008-2013 Nokia Siemens Networks Oyj
#
# 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... | ktan2020/legacy-automation | win/Lib/site-packages/robot/htmldata/normaltemplate.py | Python | mit | 1,052 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# 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/... | sileht/deb-openstack-quantum | quantum/wsgi.py | Python | apache-2.0 | 37,548 |
"""
## Hyptotheis Testing Stuff
### Standard Stuff
#### Standard Headers
"""
from __future__ import division
import sys
import random
import math
from functools import reduce
from pdb import set_trace
sys.dont_write_bytecode = True
"""
#### Standard Utils
"""
class o():
"Anonymous container"
def __in... | gbtimmon/ase16GBT | code/7/stats.py | Python | unlicense | 16,557 |
# Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | tensorflow/probability | tensorflow_probability/python/math/psd_kernels/parabolic_test.py | Python | apache-2.0 | 4,688 |
"""
Student Views
"""
import datetime
import logging
import uuid
import json
import warnings
from collections import defaultdict
from urlparse import urljoin
from pytz import UTC
from requests import HTTPError
from ipware.ip import get_ip
from django.conf import settings
from django.contrib.auth import logout, authen... | simbs/edx-platform | common/djangoapps/student/views.py | Python | agpl-3.0 | 96,840 |
"""Tests to converting MusicXML to NoteSequence proto."""
import os
# internal imports
import tensorflow as tf
from magenta.music.music_xml_io import music_xml_to_sequence_proto
class MusicXmlIOTest(tf.test.TestCase):
def setUp(self):
"""Get the file path to the test MusicXML file."""
fname = 'bach-one_... | hanzorama/magenta | magenta/music/music_xml_io_test.py | Python | apache-2.0 | 833 |
# -*- coding: utf-8 -*-
from app import app
if __name__ == "__main__":
app.debug = True
app.run(host='0.0.0.0')
| vbisserie/sudoku_sover | main.py | Python | gpl-3.0 | 122 |
'''elastic net modules for AVM class
These are separate in order to reflect dependencies in the Makefile
'''
import pdb
import numpy as np
import sklearn
from Features import Features
import layout_transactions
def fit(avm, X_train, y_train):
if avm.verbose > 0:
print 'fit elastic net: %s~%s alpha: %f ... | rlowrance/re-avm | AVM_elastic_net.py | Python | bsd-3-clause | 1,584 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'UserProfile.wiki_profile_url'
db.add_column('profiles_userprofile', 'wiki_profile_url', se... | chirilo/remo | remo/profiles/migrations/0014_auto__add_field_userprofile_wiki_profile_url.py | Python | bsd-3-clause | 6,986 |
# This file is part of WSRC.
#
# WSRC 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.
#
# WSRC is distributed in the hope that it will ... | perrys/WSRC | modules/wsrc/utils/xls_utils.py | Python | gpl-2.0 | 2,271 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2015, Florian Apolloner <florian@apolloner.eu>
#
# 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 ... | Jonnymcc/ansible | test/units/plugins/action/test_action.py | Python | gpl-3.0 | 27,726 |
"""Testing for overlap intervals
"""
import unittest
from genda.transcripts.exon_utils import calcOverlap, collideIntervals, \
collapseIntervals
class TestOverlapFunctions(unittest.TestCase):
def setUp(self):
# Simple Overlap
self.simple = [(1,10), (6,15)]
# One interval enclosed ... | jeffhsu3/genda | tests/exon_utils_tests.py | Python | bsd-3-clause | 1,802 |
from __future__ import print_function
from __future__ import unicode_literals
import logging
import re
import signal
import sys
from inspect import getdoc
from operator import attrgetter
import dockerpty
from docker.errors import APIError
from requests.exceptions import ReadTimeout
from .. import __version__
from ..... | iamluc/compose | compose/cli/main.py | Python | apache-2.0 | 21,832 |
#!/usr/bin/env python3
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "houseofdota.production_settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| lucashanke/houseofdota | manage.py | Python | mit | 266 |
#!/usr/bin/python
# This script generates a list of testsuites that should be run as part of
# the Samba test suite.
# The output of this script is parsed by selftest.pl, which then decides
# which of the tests to actually run. It will, for example, skip all tests
# listed in selftest/skip or only run a subset during ... | SpectraLogic/samba | selftest/tests.py | Python | gpl-3.0 | 4,687 |
# -*- coding: utf-8 -*-
import codecs
import logging
import os
import chardet
import pysrt
from .score import get_equivalent_release_groups
from .video import Episode, Movie
from .utils import sanitize, sanitize_release_group
logger = logging.getLogger(__name__)
#: Subtitle extensions
SUBTITLE_EXTENSIONS = ('.srt'... | ofir123/subliminal | subliminal/subtitle.py | Python | mit | 8,283 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def drop_customers_for_shared_service_settings(apps, schema_editor):
ServiceSettings = apps.get_model('structure', 'ServiceSettings')
for settings in ServiceSettings.objects.all():
if settings.shared and ... | opennode/nodeconductor | waldur_core/structure/migrations/0046_shared_service_settings_customer.py | Python | mit | 648 |
def add_native_methods(clazz):
def nativeSQL__java_lang_String__(a0, a1):
raise NotImplementedError()
clazz.nativeSQL__java_lang_String__ = nativeSQL__java_lang_String__
| laffra/pava | pava/implementation/natives/java/sql/Connection.py | Python | mit | 188 |
# Tag Toggler 1.2.2 (2017-02-06)
# Copyright: Don March <don@ohspite.net>
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
#
# Tag Toggler is an Anki 2 add-on for quickly adding tags while reviewing.
# Based in part on Quick Tagging by Cayenne Boyer
# (https://github.com/cayennes/Quick_Tagg... | ohspite/anki-tag-toggler | Tag_Toggler.py | Python | gpl-3.0 | 10,858 |
# coding: utf-8
# PYTHON IMPORTS
import os
import ntpath
import posixpath
import shutil
import sys
# DJANGO IMPORTS
from django.conf import settings
from django.test import TestCase
from django.contrib.auth.models import User
from django.utils.encoding import filepath_to_uri
from django.template import Context, Templ... | josircg/raizcidadanista | raizcidadanista/filebrowser/tests/test_commands.py | Python | gpl-3.0 | 5,432 |
#!/usr/bin/python
# Copyright 2012 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 applic... | pnakka/googlecrisismap | utils.py | Python | apache-2.0 | 8,703 |
import spyral
import pygame
from weakref import ref as _wref
import math
_all_sprites = []
def _switch_scene():
"""
Ensure that dead sprites are removed from the list and that sprites are
redrawn on a scene change.
"""
global _all_sprites
_all_sprites = [s for s in _all_sprites
... | icarito/taller-artesano | libraries/spyral/spyral/sprite.py | Python | gpl-3.0 | 21,198 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 vArmour Networks 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.apa... | subramani95/neutron | neutron/services/firewall/agents/varmour/varmour_router.py | Python | apache-2.0 | 13,149 |
from django.http import HttpResponseRedirect
def anonymous_required(view, redirect_to= None):
return AnonymousRequired(view, redirect_to)
class AnonymousRequired(object):
def __init__(self, view, redirect_to):
if redirect_to is None:
from django.conf import settings
redirect_to... | ZwaConnection/TheGuildWeb | apps/member/decorators.py | Python | gpl-3.0 | 646 |
from compatibility import range
class LSystemOverflow(Exception):
"""
Exception that happens when
an LSystem generates a string
that's too long. This helps
limit memory usage.
"""
pass
class LSystem(object):
"""
Class that handles an Lindenmayer System (L-System)
... | ptrgags/turtle-fractals | turtlelsystem/LSystem.py | Python | gpl-2.0 | 2,233 |
#!/usr/bin/python
"""
This simple tool decodes a BACnet packet hex string.
"""
from bacpypes.debugging import ModuleLogger, xtob
from bacpypes.consolelogging import ArgumentParser
from bacpypes.analysis import decode_packet
# some debugging
_debug = 0
_log = ModuleLogger(globals())
#
# __main__
#
# parse the co... | JoelBender/bacpypes-pcap | hexdecode.py | Python | mit | 865 |
#
# Collective Knowledge (TensorFlow CK front-end)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
# Developer: cTuning foundation, admin@cTuning.org, http://cTuning.org
#
cfg={} # Will be updated by CK (meta description of this module)
work={} # Will be updated by CK (temp... | dsavenko/ck-tensorflow | module/tensorflow/module.py | Python | bsd-3-clause | 2,411 |
import numpy as np
import itertools as it
import gurobipy as gurobi
from gurobipy import GRB as G
from textwrap import dedent
from . import get_logger, freeze, subdict
_LOG = get_logger('adt17')
_STATUS = {
1: 'LOADED',
2: 'OPTIMAL',
3: 'INFEASIBLE',
4: 'INF_OR_UNBD',
5: 'UNBOUNDED',
6: 'CU... | stefanoteso/musm-adt17 | musm/problem.py | Python | mit | 7,690 |
class Solution:
def firstMissingPositive2(self, nums):
i = 0
while i != len(nums):
if 1 <= nums[i] <= len(nums) and nums[i] != i + 1 and nums[i] != nums[nums[i] - 1]:
nums[nums[i] - 1], nums[i] = nums[i], nums[nums[i] - 1]
else:
i += 1
... | lmmsoft/LeetCode | LeetCode-Algorithm/0041. First Missing Positive/Solution2.py | Python | gpl-2.0 | 454 |
# 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/.
from firefox_puppeteer import PuppeteerMixin
from marionette_harness import MarionetteTestCase
class TestMixedContentP... | Yukarumya/Yukarum-Redfoxes | testing/firefox-ui/tests/functional/security/test_mixed_content_page.py | Python | mpl-2.0 | 2,408 |
# #
# Copyright 2009-2013 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (ht... | omula/easybuild-easyblocks | easybuild/easyblocks/i/imkl.py | Python | gpl-2.0 | 17,568 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import os
import o... | krishna11888/ai | third_party/gensim/gensim/test/test_hdpmodel.py | Python | gpl-2.0 | 2,047 |
#!/usr/bin/env python
# This file is part of nexdatas - Tango Server for NeXus data writer
#
# Copyright (C) 2012-2017 DESY, Jan Kotanski <jkotan@mail.desy.de>
#
# nexdatas is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... | nexdatas/configserver | test/XMLConfigurator_test.py | Python | gpl-3.0 | 437,351 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Transform raw osm data into objects"""
__author__ = 'Pedro Larroy'
__version__ = '0.1'
import os
import sys
import optparse
import logging
from utils import pbar
sys.path.append('minimongo')
# load mongodb credentials
import minimongo
import mongocredentials
minimongo... | larroy/osmtransform | osm_transform.py | Python | agpl-3.0 | 1,577 |
# forever-alone: A course and free time matching web app for college students
# Copyright (C) 2011 Lawrence Patrick Calulo
#
# This file is part of forever-alone.
#
# forever-alone is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# t... | lugkhast/forever-alone-gae | core/utils.py | Python | agpl-3.0 | 1,468 |
import struct
# See https://wiki.wireshark.org/Development/LibpcapFileFormat
PCAP_HDR_FORMAT = '=LHHlLLL'
PCAP_PKT_HDR_FMT = '=4L'
SOCKETCAN_HDR_FMT = '!LBxxx'
def write_header(outfile):
magic = 0xa1b2c3d4
ver_maj, ver_min = 2, 4
thiszone = 0
sigfigs = 0
snaplen = 65535
network = 227 # Socke... | cvra/can-bootloader | client/can/pcap.py | Python | bsd-2-clause | 1,285 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import superd... | marwoodandrew/superdesk-aap | server/aap/publish/formatters/aap_nitf_formatter.py | Python | agpl-3.0 | 5,137 |
# implement samba_tool drs commands
#
# Copyright Andrew Tridgell 2010
#
# based on C implementation by Kamen Mazdrashki <kamen.mazdrashki@postpath.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Fou... | amitay/samba | source4/scripting/python/samba/netcmd/drs.py | Python | gpl-3.0 | 20,929 |
from __future__ import absolute_import
import inspect
import os
import types
import six
import numpy as np
import pandas as pd
from ._utils import get_wrapped_y, update_wrapped_y
from ._base import InOpChecker
_in_ops = InOpChecker(__file__)
def make_estimator(estimator, ind):
ind = ind.copy()
def get_... | atavory/ibex | ibex/_xy_estimator.py | Python | bsd-3-clause | 2,447 |
# Author: Prabhu Ramachandran
# License: BSD style
# Copyright (c) 2004, Enthought, Inc.
""" A Traits-based wrapper for the Visualization Toolkit.
Part of the Mayavi project of the Enthought Tool Suite.
"""
from os.path import exists, join, dirname, isdir
# The tvtk wrapper code is all typically inside one zip fi... | dmsurti/mayavi | tvtk/__init__.py | Python | bsd-3-clause | 1,169 |
import tensorflow as tf
import numpy as np
from numpy import pi as PI
from numpy.testing import assert_almost_equal
import scipy.sparse as sp
from .embedded_gcnn import conv, EmbeddedGCNN
from ..tf.convert import sparse_to_tensor
class EmbeddedGCNNTest(tf.test.TestCase):
def test_conv_K2_P4(self):
featur... | rusty1s/embedded_gcnn | lib/layer/embedded_gcnn_test.py | Python | mit | 6,485 |
# qreorder.py - reorder unapplied MQ patches
#
# Copyright 2010 Steve Borho <steve@borho.org>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2, incorporated herein by reference.
import os
from hgext import mq
from tortoisehg.hgqt import qtlib, qrename... | velorientc/git_test7 | tortoisehg/hgqt/qreorder.py | Python | gpl-2.0 | 7,443 |
import png
from depixel.io_data import PixelDataWriter
class Bitmap(object):
mode = 'RGB'
bgcolour = (127, 127, 127)
def __init__(self, size, bgcolour=None, mode=None):
if bgcolour is not None:
self.bgcolour = bgcolour
if mode is not None:
self.mode = mode
... | jerith/depixel | depixel/io_png.py | Python | mit | 7,006 |
# This file is part of Buildbot. Buildbot 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 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | buildbot/buildbot | master/buildbot/test/util/integration.py | Python | gpl-2.0 | 15,821 |
class Vendor(object):
def __init__(self):
self._vendor = None # altera, lattice, xilinx
self._model = None # vendor model
@property
def vendor(self):
return self._vendor
@vendor.setter
def vendor(self, v):
assert v.lower() in ('altera', 'lattice', 'xilinx')
... | cfelton/rhea | rhea/vendor/vendor.py | Python | mit | 351 |
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | atsushieno/cerbero | cerbero/utils/msbuild.py | Python | lgpl-2.1 | 2,936 |
#! /usr/bin/python
## pysieved - Python managesieve server
## Copyright (C) 2007 Neale Pickett
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or (at
## you... | miracle2k/pysieved | plugins/accept.py | Python | gpl-2.0 | 2,161 |
class easyconfig(objekt)
def __init__(self, filepath, seperator=":", encode = "utf-8"):
self._encode = encode
self.__filepath = filepath
self.__seperator = seperator
def __del__(self):
def newconf(self, key, value):
with open(self.filepath, "a", encoding = self.encode) as ... | nam3less/Snippets | EasyConfig/EasyConfig.py | Python | mit | 1,614 |
#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Explicitly set/remove/print the merge-base for the current branch.
This manually set merge base will be a stand-in for `git merge-... | endlessm/chromium-browser | third_party/depot_tools/git_mark_merge_base.py | Python | bsd-3-clause | 2,059 |
#!/usr/bin/env python
"""
contains all the patches that have been applied to
the database in order to keep schemas consistent across environments
"""
class DBPatch():
def __init__(self, name, sql, validation, *args, **kwargs):
""" Encapsulates the patches to be applied """
self.name = name
... | mauromsl/dark_web_datamining | python_src/db_patches.py | Python | gpl-3.0 | 1,811 |
# Copyright (c) 2010, Google Inc. 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 conditions and the... | indashnet/InDashNet.Open.UN2000 | android/external/chromium_org/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults_unittest.py | Python | apache-2.0 | 4,718 |
from src.utils.DictUtils import DictUtils
from src.provider.ContentProvider import ContentProvider
class TextProvider(ContentProvider):
def __init__(self, dictionary):
self.dictionary = dictionary
def getCallables(self):
return ['text']
def text(self, paragraph, path):
return DictUtils... | purplecode/espresso | src/provider/basic/TextProvider.py | Python | mit | 374 |
'''Configuration file for the FENS2014 poster figures.'''
from __future__ import absolute_import, print_function
from noisefigs.plotters.base import SeparateMultipageSaver
def get_config():
return _config
_config = {
'GridSweepsPlotter': {
'cbar': [1, 1, 1],
'scale_factor': .75,
'yla... | MattNolanLab/ei-attractor | grid_cell_model/simulations/007_noise/figures/thesis/config.py | Python | gpl-3.0 | 6,889 |
import numpy as np
from pandas import DataFrame, Series, DatetimeIndex, date_range
try:
from pandas.plotting import andrews_curves
except ImportError:
from pandas.tools.plotting import andrews_curves
import matplotlib
matplotlib.use('Agg')
class SeriesPlotting:
params = [['line', 'bar', 'area', 'barh', 'h... | cbertinato/pandas | asv_bench/benchmarks/plotting.py | Python | bsd-3-clause | 2,426 |
from . import db
class CustomPlaceholder(db.Model):
"""email notifications model class"""
__tablename__ = 'custom_placeholder'
id = db.Column(db.Integer,
primary_key=True)
name = db.Column(db.String)
url = db.Column(db.String)
thumbnail = db.Column(db.String)
copyright =... | gaeun/open-event-orga-server | app/models/custom_placeholder.py | Python | gpl-3.0 | 1,176 |
"""
appsettings
"""
from __future__ import absolute_import, division, print_function
import logging
from mcedit2.util.settings import Settings
log = logging.getLogger(__name__)
RecentFilesSetting = Settings().getOption('open_world_dialog/recent_files', "json", [])
EnableLightingSetting = Settings().getOption('edi... | Rubisk/mcedit2 | src/mcedit2/appsettings.py | Python | bsd-3-clause | 430 |
__author__ = 'Jonas Eberle <jonas.eberle@eberle-mail.de>'
| jonas-eberle/pyEOM | pyEOM/outputs/__init__.py | Python | mit | 58 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditi... | tkaitchuck/nupic | lang/py/engine/__init__.py | Python | gpl-3.0 | 23,539 |
""" staticInterface.py
by Ibrahim Sardar
NOT TESTED YET!
"""
#handles static graphics (NOT any dynamic graphics)
class staticInterface(object):
#initializer
def __init__(self, wwidth, wheight):
#attributes
self.wwidth = wwidth
self.wheight = wheight
self.... | mzhamad/SnakeProject | staticInterface.py | Python | gpl-3.0 | 3,424 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-mgmt-scheduler/azure/mgmt/scheduler/models/job_collection_properties.py | Python | mit | 1,416 |
#!/usr/local/bin/python3.3
# -*- coding: utf8 -*-
import sys, traceback, codecs, re
from urllib.parse import urlparse
from imp import reload
from time import strftime, gmtime, time
from datetime import date, datetime, timedelta
import boto.sns, json, sys, csv
from elasticsearch import Elasticsearch
from boto.sns impo... | wangqi/elasticsearch-push | src/gcmpush.py | Python | apache-2.0 | 8,283 |
from threading import Thread, Lock
from peak.util.proxies import LazyProxy
def function_thread(f, lock=None):
def args_wrapper(*args, **kwargs):
class FunctionRunner(Thread):
def run(self):
if lock is not None: lock.acquire()
try:
self.result ... | ActiveState/code | recipes/Python/577931_actorish_decorator_making_async_code_look_more/recipe-577931.py | Python | mit | 1,842 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import importlib
imp... | sameerparekh/pants | contrib/go/src/python/pants/contrib/go/subsystems/fetchers.py | Python | apache-2.0 | 24,935 |
# coding: utf-8
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 2.0.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class WidgetFooterMenuListResponse(object):
"""
NOTE: Th... | kinow-io/kinow-python-sdk | kinow_client/models/widget_footer_menu_list_response.py | Python | apache-2.0 | 3,583 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- author: chat@jat.email -*-
from b4m.views.index import IndexView
def add_url_rule(app):
app.add_url_rule('/', view_func=IndexView.as_view('index'), methods=['GET'])
| jat001/B4M | b4m/views/__init__.py | Python | gpl-3.0 | 224 |
# Copyright 2014 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 ... | gotostack/neutron-lbaas | neutron_lbaas/db/migration/alembic_migrations/versions/lbaasv2_tls.py | Python | apache-2.0 | 2,055 |
#!/Users/Steven/Documents/debateIt/venv/bin/python
#
# The Python Imaging Library
# $Id$
#
# this demo script illustrates pasting into an already displayed
# photoimage. note that the current version of Tk updates the whole
# image every time we paste, so to get decent performance, we split
# the image into a set of t... | steventimberman/masterDebater | venv/bin/painter.py | Python | mit | 2,185 |
"""
Developed by niphlod@gmail.com
"""
import redis
from redis.exceptions import ConnectionError
from gluon import current
from gluon.storage import Storage
import cPickle as pickle
import time
import re
import logging
import thread
logger = logging.getLogger("web2py.session.redis")
locker = thread.a... | ccpgames/eve-metrics | web2py/gluon/contrib/redis_session.py | Python | mit | 8,463 |
n=raw_input()
count=0
while True:
sq=0
for i in n:
sq+=int(i)**2
count+=1
n=str(sq)
if len(n)==1:
if int(n)==1:
print count
break
else:
print "-1"
break
| ProgDan/maratona | SPOJ/HYPNOS.py | Python | gpl-3.0 | 234 |
#!/usr/bin/env python3
# Copyright (c) 2014-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test descendant package tracking carve-out allowing one final transaction in
an otherwise-full packa... | JeremyRubin/bitcoin | test/functional/mempool_package_onemore.py | Python | mit | 4,183 |
"""
Common checksum routines.
"""
__all__ = ['luhn']
from django.utils import six
LUHN_ODD_LOOKUP = (0, 2, 4, 6, 8, 1, 3, 5, 7, 9) # sum_of_digits(index * 2)
def luhn(candidate):
"""
Checks a candidate number for validity according to the Luhn
algorithm (used in validation of, for example, credit cards)... | ericholscher/django | django/utils/checksums.py | Python | bsd-3-clause | 728 |
import os
import base64
import requests
import logging
from functools import wraps
from flask import session, render_template, request, redirect, url_for, jsonify, current_app
from appcomposer import db
from .models import GoLabOAuthUser
from .application import app
from .utils import sendmail
@app.route('/logout'... | porduna/appcomposer | appcomposer/login.py | Python | bsd-2-clause | 5,380 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2019 Bitergia
#
# 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.
#
# This ... | grimoirelab/GrimoireELK | grimoire_elk/elk.py | Python | gpl-3.0 | 36,594 |
#name<=>Wave Leap
#texture<=>boat
#cooldown<=>4000
def setblock_yscandown(x,y,z,blockType=DIRT,forceTheIssue=True,scanDistance=10,blockMetadata=0):
yOrig=y
while(getblock(x,y-1,z) == AIR):
y-=1
if(forceTheIssue == False and yOrig-y>scanDistance):
break
setblock(x,y,z,blockType,blockMetadata)
return (x,y,z)
... | sapphon/minecraftpython | src/main/resources/assets/techmage/scripts/techmage/aqueite/wave_leap.py | Python | gpl-3.0 | 1,467 |
# _*_ coding: utf-8 _*_
from .base import * | brianhwitte/djangotest | taskbuster/settings/staging.py | Python | mit | 43 |
"""
Author: Robert Post
Based on code from Nathan Sprague
from: https://github.com/spragunr/deep_q_rl
"""
import DeepNetworks
import lasagne
import numpy as np
import theano
import theano.tensor as T
import cPickle
import imp
class DeepQNetwork(object):
def __init__(self, batchSize, numFrames, inputHeight, inputW... | Mog333/DeepRL | network/DeepQNetwork.py | Python | mit | 7,211 |
from nose.tools import eq_, ok_
from path import path
from pyavrutils.arduino import Arduino, ArduinoCompileError
from pyavrutils.support import simple_targets
import logging
from nose_ittr import IttrMultiplier, ittr
import tempfile
root = path(__file__).parent.parent
sample_cfg = root / 'sample_cfg.h'
'''
sudo rm -... | ryanvade/nanpy-firmware | tests/test_build.py | Python | mit | 2,121 |
import csv
import dateutil.parser
from rainyday.models import Vote, Constituency, Party, Division, Person, VoteRecord, InstallStatus
class DbInstaller:
def __init__(self, install_type):
self.fname = "./rainyday-{0}.csv".format(install_type)
def install(self, request):
try:
sta... | brunogirin/parly12 | parly2012/rainyday/install.py | Python | gpl-3.0 | 3,220 |
# 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 u... | GabrielBrascher/cloudstack | test/integration/component/test_multiple_subnets_in_vpc_rvr.py | Python | apache-2.0 | 51,271 |
import unittest
from katas.kyu_5.valid_date_regex import valid_date
class ValidDateTestCase(unittest.TestCase):
def test_none(self):
self.assertIsNone(valid_date.search("[02-31]"))
def test_none_2(self):
self.assertIsNone(valid_date.search("[ 6-03]"))
def test_none_3(self):
self... | the-zebulan/CodeWars | tests/kyu_5_tests/test_valid_date_regex.py | Python | mit | 1,034 |
#
# MLDB-2142-prefix-suffix.py
# Mathieu Marquis Bolduc, 2017-02-10
# This file is part of MLDB. Copyright 2017 Datacratic. All rights reserved.
#
from mldb import mldb, MldbUnitTest, ResponseException
class Mldb2077MergeTest(MldbUnitTest): # noqa
def test_prefix(self):
n = mldb.get('/v1/query', q="SELE... | mldbai/mldb | testing/MLDB-2142-prefix-suffix.py | Python | apache-2.0 | 1,499 |
from .sqs import Boto3SqsTestCase
from .swf import *
from .ecs import *
| groboclown/pipit | test/integration/boto3/__init__.py | Python | mit | 79 |
#
# NineMSN CatchUp TV Video Addon
#
# This code is forked from Network Ten CatchUp TV Video Addon
# Copyright (c) 2013 Adam Malcontenti-Wilson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# ... | predakanga/plugin.video.catchuptv.au.ninemsn | resources/lib/addon/show_season.py | Python | mit | 2,488 |
from django import template
from tracking.models import Visitor
register = template.Library()
class VisitorsOnSite(template.Node):
"""
Injects the number of active users on your site as an integer into the context
"""
def __init__(self, varname, same_page=None):
self.varname = varname
... | DraXus/andaluciapeople | tracking/templatetags/tracking_tags.py | Python | agpl-3.0 | 1,704 |
import json
import logging
from pprint import pprint
def loadData(info):
jsonData = open(info["location"])
data = json.load(jsonData)
jsonData.close()
logging.info(str(info["name"]) + " data loaded")
return data
def loadAll(locations):
returnDic = {}
for name, loc in locations.items():
... | JPeroutek/TRPG | src/loadJSON.py | Python | mit | 581 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Nicolas Badoux <n.badoux@hotmail.com>
#
# The licence is in the file __manifest__... | eicher31/compassion-modules | survey_phone/wizards/__init__.py | Python | agpl-3.0 | 448 |
import os
import sys
'''Get the directory where this script is'''
def getScriptDirectory():
return os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
''' Add to the sys.path the path to the Imgur Python module directory. '''
sys.path.append(os.path.join(getScriptDirectory(), "imgur-python"))
... | lukka/imguploader | imgbackends.py | Python | gpl-3.0 | 2,968 |
# 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
# distributed unde... | briancurtin/python-openstacksdk | openstack/cluster/v1/cluster.py | Python | apache-2.0 | 6,541 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.