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 |
|---|---|---|---|---|---|
#!/router/bin/python
from .stl_general_test import CStlGeneral_Test, CTRexScenario
from nose.plugins.attrib import attr
import time
import os
@attr('wlc')
class CTRexWLC_Test(CStlGeneral_Test):
"""This class tests TRex WLC related code"""
def get_pkts(self):
stats = self.client.get_stats()
ret... | kisel/trex-core | scripts/automation/regression/stateless_tests/stl_wlc_test.py | Python | apache-2.0 | 2,909 |
# $Id$
#
# Copyright (C) 2003-2008 Greg Landrum and Rational Discovery LLC
# All Rights Reserved
#
from __future__ import print_function
from rdkit import RDConfig
from rdkit import DataStructs
from rdkit.DataStructs.TopNContainer import TopNContainer
import bisect
class GenericPicker(object):
_picks = None
def... | jandom/rdkit | rdkit/SimDivFilters/SimilarityPickers.py | Python | bsd-3-clause | 7,303 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.variables.variable import Variable
from urbansim.functions import attribute_label
from numpy import float32
class age_times_population_per_acre(Variable):
""" age of head ... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/psrc/household_x_zone/age_times_population_per_acre.py | Python | gpl-2.0 | 1,765 |
from .openstep_parser import OpenStepDecoder
__version__ = '1.5.3'
| kronenthaler/openstep-parser | openstep_parser/__init__.py | Python | bsd-2-clause | 68 |
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | ilay09/keystone | keystone/federation/backends/base.py | Python | apache-2.0 | 11,167 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
retile.py
---------------------
Date : January 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : mederic dot ribreux at medspx dot fr
****************... | dwadler/QGIS | python/plugins/processing/algs/gdal/retile.py | Python | gpl-2.0 | 10,480 |
# get all files from links given from a txt file
import subprocess
import os
# edit this to your own directory i guess
pdir = "/home/nitrous/projects/python/scripts/scripts/"
def get_from_txt(location):
filenames = []
files = os.listdir(pdir + "get")
print("Retrieving textfile..")
# lets fetch the t... | NitrousPG/scripts | scripts/get-txt.py | Python | gpl-3.0 | 1,171 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "raxui.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| rmyers/dtrove-ui | manage.py | Python | mit | 248 |
#! /usr/bin/python
# Copyright (c) 2015 Dave McCoy (dave.mccoy@cospandesign.com)
#
# This file is part of Nysa.
# (http://wiki.cospandesign.com/index.php?title=Nysa.org)
#
# Nysa 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 So... | CospanDesign/nysa | nysa/cbuilder/sdb_component.py | Python | mit | 16,800 |
#!/usr/bin/env python
import logging
l = logging.getLogger("claripy.frontends.constrained_frontend")
from ..frontend import Frontend
class ConstrainedFrontend(Frontend): # pylint:disable=abstract-method
def __init__(self):
Frontend.__init__(self)
self.constraints = []
self.variables = ... | Ruide/angr-dev | claripy/claripy/frontends/constrained_frontend.py | Python | bsd-2-clause | 4,485 |
#!/usr/bin/env python
from bs4 import BeautifulSoup
import sys
import urllib
import urllib2
import json
from nltk.corpus import stopwords
import urlparse
import re
package = ""
visited = set()
unvisited = set()
count = 0
cachedStopWords = stopwords.words("english")
#Entry point
def CrawlPage (url):
global packa... | srikanthmaturu/webpage-classifier | crawler/unlCralwer.py | Python | gpl-2.0 | 2,600 |
from maxixe.api import *
@step(r"there is a feature$")
def step_one(*args, **kwargs):
pass
@step(r"I attempt to import that feature like a Python file")
def step_two(*args, **kwargs):
pass
@step(r"I can access it as a module")
def step_three(*args, **kwargs):
pass
| tswicegood/maxixe | maxixe/features/steps.py | Python | apache-2.0 | 283 |
#!/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.
"""\
Wrapper script around Rietveld's upload.py that simplifies working with groups
of files.
"""
import json
import optparse
impo... | chinmaygarde/depot_tools | gcl.py | Python | bsd-3-clause | 51,974 |
from nbodykit import CurrentMPIComm
from nbodykit.binned_statistic import BinnedStatistic
from collections import OrderedDict
import numpy
import logging
import kdcount
class Base3PCF(object):
"""
Base class for implementing common 3PCF calculations.
Users should use :class:`SimulationBox3PCF` or :class:`... | bccp/nbodykit | nbodykit/algorithms/threeptcf.py | Python | gpl-3.0 | 20,013 |
#!/usr/bin/env python
# vim: fileencoding=utf8:et:sta:ai:sw=4:ts=4:sts=4
import traceback
import greenhouse
from junction import Hub
HOST = "127.0.0.1"
PORT = 9100
SERVICE_HOST = HOST
SERVICE_PORT = 9000
BDHOST = HOST
BDPORT = 9101
SERVICE = 1
greenhouse.global_exception_handler(traceback.print_exception)
hub =... | teepark/junction | examples/echo/relayer.py | Python | bsd-3-clause | 654 |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2014 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | stitchfix/pybossa | test/test_password_manager.py | Python | agpl-3.0 | 8,144 |
"""Test hooks in bash scripts."""
import contextlib
import re
import subprocess
import pytest
@contextlib.contextmanager
def build_image(root):
"""Build a new Docker image with any file in root coped to /.
:param py.path.local root: Root directory of files to copy.
:return: Same root variable, Dockerf... | Robpol86/makemkv | tests/test_hooks.py | Python | mit | 7,910 |
def golf(r):
s=p=0
c=int(-(-r//1))
for i in range(c):
y=max(r**2-(i+1)**2,0)**0.5
s+=y//1
p+=c-y//1
c=-(-y//1)
return s*4,p*4
if __name__ == '__main__':
# These "asserts" using only for self-checking and not necessary for auto-testing
assert isinstance(golf(1), (list, tuple))
assert list(golf(2)) ... | edwardzhu/checkio-solution | EmpireOfCode/common/Crystalite Storage/countingTiles.py | Python | mit | 505 |
from __future__ import division, print_function, unicode_literals, absolute_import
import setuptools
version = '2018.1.12'
dependencies = ['sarge', 'ordered-namespace']
setuptools.setup(install_requires=dependencies,
include_package_data=True,
packages=setuptools.find_packages(),... | Who8MyLunch/NutMeg | setup.py | Python | mit | 355 |
###############################################################################
##
## Copyright (c) Crossbar.io Technologies GmbH
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at... | crossbario/autobahn-testsuite | autobahntestsuite/autobahntestsuite/case/case1_2_1.py | Python | apache-2.0 | 1,321 |
# -*- coding: utf-8 -*-
# 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
from scrapy.exceptions import DropItem
# from goose import Goose
from pagecrawler.model_article import Articles
class SaveArtic... | mayawang/capstone_fetchbot | crawler/pagecrawler/pagecrawler/pipelines.py | Python | mit | 1,732 |
import pytest
from pytest import raises
from viper import compiler
from viper.exceptions import TypeMismatchException
fail_list = [
"""
def foo(inp: bytes <= 10) -> bytes <= 2:
return slice(inp, start=2, len=3)
""",
"""
def foo(inp: num) -> bytes <= 3:
return slice(inp, start=2, len=3)
""",
... | NedYork/viper | tests/parser/syntax/test_slice.py | Python | mit | 1,020 |
# -*- coding: utf-8 -*-
from django.utils import feedgenerator
from django.shortcuts import render_to_response
from django.http import HttpResponse, Http404, HttpResponsePermanentRedirect
from django.utils.cache import patch_vary_headers
from django.template import Context, RequestContext, loader
from django.views.ge... | mk-fg/feedjack | feedjack/views.py | Python | bsd-3-clause | 8,247 |
from hubcheck.pageobjects.po_groups_wiki_base_page import GroupsWikiBasePage
class GroupsWikiArticlePage(GroupsWikiBasePage):
"""groups wiki article page"""
def __init__(self,browser,catalog,groupid,articleid):
super(GroupsWikiArticlePage,self).__init__(browser,catalog,groupid,articleid)
# sel... | codedsk/hubcheck | hubcheck/pageobjects/po_groups_wiki_article_page.py | Python | mit | 1,583 |
# -*- coding: utf-8 -*-
# Kodi Addon: Youtube Library
# Copyright 2015 Sleuteltje
#
# This file is part of plugin.video.youtubelibrary
# Description: Functions that will handle updating of playlists in the library (required functions for the service)
#
# This program is free software: you can redistribut... | Sleuteltje/plugin.video.youtubelibrary | resources/lib/service.py | Python | gpl-3.0 | 26,342 |
'''
Cache manager
=============
The cache manager can be used to store python object attached to an uniq key.
The cache can be controlled in different manner, with a object limit or a
timeout.
For example, we can create a new cache with a limit of 10 objects and a timeout
of 5 seconds::
# register a new Cache
... | nuigroup/kivy | kivy/cache.py | Python | lgpl-3.0 | 7,641 |
# -*- coding: utf-'8' "-*-"
from hashlib import sha1
import logging
from lxml import etree, objectify
from pprint import pformat
import time
from urllib import urlencode
import urllib2
import urlparse
from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.addons.payment_ogone.controll... | mycodeday/crm-platform | payment_ogone/models/ogone.py | Python | gpl-3.0 | 19,078 |
import json
import time
import os
import argparse
import re
import sys
import logging
import math
import random
import threading
import requests
import queue
from datetime import datetime
import datetime as dt
from models.user import User, UserManager
from models.emote import Emote
from scripts.database import updat... | 0rmi/BetterTyggbotKappa | tyggbot.py | Python | mit | 32,794 |
import sys
from operator import add
from pyspark import SparkContext
#import pyspark_csv as pycsv
from csv import reader
import os
import StringIO
import datetime
import numbers
import re
def str2date(x):
x = x.strip()
try:
x = datetime.datetime.strptime(x, '%m/%d/%Y')
except ValueError:
r... | leedtan/SparklesSunshinePuppies | feature_mapreduce/mapreduce4.py | Python | mit | 2,966 |
import zmqpy as zmq
def main():
context = zmq.Context()
socket = context.socket(zmq.PUSH)
socket.bind("tcp://*:3333")
msg = "aaaaaaaaaa"
for i in range(10000000):
socket.send(msg, 0)
socket.close()
context.term()
if __name__ == "__main__":
main()
| felipecruz/zmqpy | benchmarks/sender.py | Python | bsd-2-clause | 292 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Simon Dodsley (simon@purestorage.com)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1'... | nrwahl2/ansible | lib/ansible/modules/storage/purestorage/purefa_host.py | Python | gpl-3.0 | 5,132 |
"""The tests for the device tracker component."""
# pylint: disable=protected-access
import asyncio
import json
import logging
import unittest
from unittest.mock import call, patch
from datetime import datetime, timedelta
import os
from homeassistant.core import callback
from homeassistant.bootstrap import setup_compo... | florianholzapfel/home-assistant | tests/components/device_tracker/test_init.py | Python | mit | 24,131 |
from django.contrib import admin
from surprise import models
def update_metadata(model_admin, request, queryset):
for surprise in queryset:
models.update_metadata(surprise)
update_metadata.short_description = "Update metadata"
class SurpriseAdmin(admin.ModelAdmin):
list_display = ('id', 'link', 'm... | mirigata/mirigata | mirigata/surprise/admin.py | Python | agpl-3.0 | 441 |
import time
def dumps(s):
if not console.json:
die('dumps requries lib', 'console-json')
console.json(s)
def out(prefix, *a):
p = [prefix]
for obj in a:
if obj.__repr__:
p.append(obj.__repr__())
else:
p.append(obj)
console.log.apply(console, p)
de... | axiros/misc_transcrypt | doc/kendo/src/ch7/tools.py | Python | bsd-3-clause | 3,203 |
from datetime import datetime
from multiprocessing import Process
from uuid import uuid4
import time
from collections import OrderedDict
import logging
import functools
import zmq
from zmq.eventloop.ioloop import IOLoop, PeriodicCallback
from zmq.utils import jsonapi
from .socket_configs import DeferredSocket, SockCo... | cfobel/zmq_helpers | zmq_helpers/async.py | Python | gpl-3.0 | 10,902 |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The Starwels developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the fundrawtransaction RPC."""
from test_framework.test_framework import StarwelsTestFramework
from t... | starwels/starwels | test/functional/rpc_fundrawtransaction.py | Python | mit | 33,077 |
""":mod:`plastic.config` --- Configuration mapping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from keyword import iskeyword
from re import VERBOSE, compile
from os.path import abspath
from tokenize import Name
from types import ModuleType
from werkzeug._internal import _DictAccessorProperty
from werkzeug.... | dahlia/plastic | plastic/config.py | Python | mit | 9,295 |
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from typing import Sequence
import pytest
from pants.core.util_rules import stripped_source_files
from pants.core.util_rules.source_files import Sourc... | benjyw/pants | src/python/pants/core/util_rules/stripped_source_files_test.py | Python | apache-2.0 | 5,370 |
# Copyright (c) 2018 PaddlePaddle 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 app... | reyoung/Paddle | python/paddle/fluid/tests/unittests/test_rpn_target_assign_op.py | Python | apache-2.0 | 9,366 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = [
# url(r'^$', TemplateView.as_view(temp... | 2083008/blog | config/urls.py | Python | bsd-3-clause | 1,269 |
__version__="0.1.0"
# ToDo:
# [] process mult dimacs.trees to hrg
import sys
import traceback
import argparse
import os
import glob
import networkx as nx
import pandas as pd
from PHRG import graph_checks
import subprocess
import math
import graph_sampler as gs
global args
def get_parser ():
parser = argparse.Ar... | nddsg/TreeDecomps | xplodnTree/tdec/tredec.edgelist_dimacs.py | Python | mit | 6,413 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... | tensorflow/datasets | tensorflow_datasets/core/github_api/__init__.py | Python | apache-2.0 | 740 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | hachreak/invenio-previewer | invenio_previewer/api.py | Python | gpl-2.0 | 2,592 |
############################################################################
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# 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 https://mozil... | perlang/bv9arm-chinese | branches/9.16.18/arm/conf.py | Python | mpl-2.0 | 5,717 |
from setuptools import setup
import sys
setup(name='HTTPLang',
version='2.0.0',
author='Frankie Primerano',
author_email='max00355@gmail.com',
packages=['httplang'],
entry_points={
'console_scripts': ['httplang=httplang:console_main'],
},
url='https://github.com/Max0... | Max00355/HTTPLang | setup.py | Python | mit | 853 |
import tensorflow as tf
from kentf.scoping import adapt_name
def merge_grads(tower_grads, name=None):
name = adapt_name(name, "merge-grads")
with tf.name_scope(name):
grads = []
for grad_group in zip(*tower_grads):
var = grad_group[0][1]
vals = [val for val, var in grad_... | kkleidal/kentf | splitfn.py | Python | mit | 5,794 |
# -*- coding: utf-8 -*-
# Este arquivo é parte do programa Blocos
# Blocos é um software livre; você pode redistribui-lo e/ou
# modifica-lo dentro dos termos da Licença Pública Geral GNU como
# publicada pela Fundação do Software Livre (FSF); na versão 3 da
# Licença, ou (na sua opinião) qualquer versão.
#
# Este... | yantrabuddhi/blocos | blockcanvas/canvas.py | Python | gpl-3.0 | 19,312 |
from uno.base import UnoBaseFeature, Element
# standard bs3 field follows...
class TextInputBs3(Element):
div_0 = Element('element_0', 'div')
div_0.class_1 = Css('CLASS','form-group')
div_0.label_4 = Element('element_4', 'label')
div_0.label_4.payload_6 = Payload('payload_6', "Text Input... | elbow-jason/Uno | uno/field.py | Python | mit | 517 |
from cosmos.lib.ezflow.tool import Tool
from cosmos.Workflow.models import TaskFile
from cosmos.session import settings as cosmos_settings
import os
def list2input(l):
return "-I " +" -I ".join(map(lambda x: str(x),l))
def get_interval(param_dict):
"""
:param param_dict: parameter dictionary
:return... | LPM-HMS/GenomeKey | obsolete/genomekey/tools/gatk.py | Python | mit | 12,514 |
from practicum import McuBoard
RQ_GET_SWITCH_UP = 4
RQ_GET_SWITCH_DOWN = 1
RQ_GET_SWITCH_LEFT = 3
RQ_GET_SWITCH_RIGHT = 5
RQ_GET_SWITCH_BOMB = 0
RQ_GET_LIGHT = 2
# from practicum import *
# from peri import PeriBoard
# devs = findDevices()
# b = PeriBoard(devs[0])
####################################
class PeriBoar... | vuun/PyGame_OOP | board/peri.py | Python | mit | 2,252 |
"""
Helper functions and classes for discussion tests.
"""
from uuid import uuid4
from ...fixtures.discussion import (
SingleThreadViewFixture,
Thread,
Response,
)
class BaseDiscussionMixin(object):
"""
A mixin containing methods common to discussion tests.
"""
def setup_thread(self, num... | LearnEra/LearnEraPlaftform | common/test/acceptance/tests/discussion/helpers.py | Python | agpl-3.0 | 933 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _, throw
from frappe.utils import cint, today, flt
from erpnext.setup.utils import get_company_currency, get_exchang... | mbauskar/phrerp | erpnext/controllers/accounts_controller.py | Python | agpl-3.0 | 21,173 |
import os
import re
import tempfile
import unittest
from pyprint.ClosableObject import close_objects
from pyprint.NullPrinter import NullPrinter
from coalib.misc import Constants
from coalib.misc.ContextManagers import make_temp, change_directory
from coalib.output.printers.LogPrinter import LogPrinter
from coalib.pa... | djkonro/coala | tests/settings/ConfigurationGatheringTest.py | Python | agpl-3.0 | 12,712 |
#!/usr/bin/python
import unittest
try:
import autotest.common as common
except ImportError:
import common
from autotest.client.shared.test_utils import mock
from autotest.client import harness, harness_standalone, harness_ABAT
class harness_unittest(unittest.TestCase):
def setUp(self):
self.god = ... | nacc/autotest | client/harness_unittest.py | Python | gpl-2.0 | 1,370 |
from django.contrib.auth import get_user_model
from elasticsearch_dsl import field
class ContributorField(field.Object):
def __init__(self, *args, **kwargs):
super(ContributorField, self).__init__(*args, **kwargs)
self.properties['username'] = field.String(index='not_analyzed')
self.prop... | theonion/django-bulbs | bulbs/contributions/fields.py | Python | mit | 1,311 |
from django.conf import settings
from rest_framework.settings import APISettings
USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK_EXTENSIONS', None)
DEFAULTS = {
# caching
'DEFAULT_USE_CACHE': 'default',
'DEFAULT_CACHE_RESPONSE_TIMEOUT': None,
'DEFAULT_CACHE_ERRORS': True,
'DEFAULT_CACHE_KEY_FU... | chibisov/drf-extensions | rest_framework_extensions/settings.py | Python | mit | 1,645 |
#!/usr/bin/python
# Copyright (c) 2015 Ansible, Inc.
#
# 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 lat... | elventear/ansible | lib/ansible/modules/cloud/vmware/vca_vapp.py | Python | gpl-3.0 | 9,031 |
def get_position(pag):
return pag.locateOnScreen('start.png')
def get_screen(region,win32gui, win32ui, win32con, win32api):
left,top,width,height = region
hwin = win32gui.GetDesktopWindow()
hwindc = win32gui.GetWindowDC(hwin)
srcdc = win32ui.CreateDCFromHandle(hwindc)
memdc ... | Akatsuki06/AutonomousCarAI | lib/game_position.py | Python | mit | 762 |
'''One of the enemies, the spider, which climbs along walls and shoots at the player.'''
import pygame
import os
from pygame.locals import *
from locals import *
import data
from object import Gameobject
from sound import play_sound
from animation import Animation
from projectile import Projectile
from util impor... | italomaia/turtle-linux | games/WhichWayIsUp/lib/spider.py | Python | gpl-3.0 | 4,462 |
#!/usr/bin/env python
""" Record a few seconds of audio and plot the fft. """
import pyaudio
import wave
import sys
import random
import LightController
from scipy import *
#from pylab import *
from time import sleep
chunk = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 22050
RECORD_SECONDS = 1000
WAVE_OUTPUT... | KappaEtaKappa/Sound-2-Disco | partylights_Dan.py | Python | mit | 3,080 |
from __future__ import absolute_import
from nlpaug.model.audio.audio import *
from nlpaug.model.audio.noise import *
from nlpaug.model.audio.shift import *
from nlpaug.model.audio.speed import *
from nlpaug.model.audio.pitch import *
from nlpaug.model.audio.loudness import *
from nlpaug.model.audio.crop import *
from n... | makcedward/nlpaug | nlpaug/model/audio/__init__.py | Python | mit | 480 |
"""
Redis Backends
------------------
Provides backends for talking to `Redis <http://redis.io>`_.
"""
from __future__ import absolute_import
from dogpile.cache.api import CacheBackend, NO_VALUE
from dogpile.cache.compat import pickle, u
redis = None
__all__ = 'RedisBackend',
class RedisBackend(CacheBackend):
... | dprince/dogpile.cache | dogpile/cache/backends/redis.py | Python | bsd-3-clause | 4,596 |
# -*- coding: utf-8 -*-
#
# The Linux Kernel documentation build configuration file, created by
# sphinx-quickstart on Fri Feb 12 13:51:46 2016.
#
# 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 fi... | walac/linux | Documentation/conf.py | Python | gpl-2.0 | 20,998 |
# 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, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
from... | jtrobec/pants | src/python/pants/backend/codegen/targets/java_wire_library.py | Python | apache-2.0 | 2,849 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:si:et:enc=utf-8
# Author: Ivan A-R <ivan@tuxotronic.org>
# Project page: http://tuxotronic.org/wiki/projects/stm32loader
#
# This file is part of stm32loader.
#
# stm32loader is free software; you can redistribute it and/or modify it under
# the terms of ... | fabriciopk/SEA_Firmware | firmware/support/stm32loader.py | Python | mit | 17,493 |
# -*- coding: utf-8 -*-
"""
Sop.config
~~~~~~~~~~~~~~
Configure file
:copyright: (c) 2017 by 陶先森.
:license: MIT, see LICENSE for more details.
"""
import os
GLOBAL={
"ProcessName": "Sop",
#Custom process, you can see it with "ps aux|grep ProcessName".
"Host": os.getenv("sop_host", ... | staugur/Sop | src/config.py | Python | mit | 899 |
from .misc import (
camel_to_underscore,
convert_date,
convert_datetime,
dict_from_dataframe,
dir_list,
download_if_new,
get_ulmo_dir,
mkdir_if_doesnt_exist,
module_with_dependency_errors,
module_with_deprecation_warnings,
open_file... | cameronbracken/ulmo | ulmo/util/__init__.py | Python | bsd-3-clause | 1,031 |
import unittest
"""
Given an array of positive and negative numbers, arrange them in alternate fashion
such that every positive number is followed by a negative number and vice-versa. You should
maintain the order of appearance.
Input: 1 2 3 -4 -1 4
Output: -4 1 -1 2 3 4
"""
"""
Approach 1:
1. Scan the array from left... | prathamtandon/g4gproblems | Arrays/rearrange_positive_and_negative_same_order.py | Python | mit | 3,022 |
from django import forms
from a2b_satchmo.customer.function_def import *
from django.forms import ModelForm
from django.contrib import *
from django.contrib.admin.widgets import *
from uni_form.helpers import *
from django.utils.translation import ugettext_lazy as _
from satchmo_store.accounts.forms import Registration... | Star2Billing/a2b-satchmo | a2b_satchmo/localsite/forms.py | Python | agpl-3.0 | 527 |
from PoolBasedTripletMDS import PoolBasedTripletMDS
| lalitkumarj/NEXT-psych | gui/base/app_manager/PoolBasedTripletMDS/__init__.py | Python | apache-2.0 | 52 |
# Copyright 2014 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... | GrimDerp/gcloud-python | system_tests/storage.py | Python | apache-2.0 | 12,846 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Include this to load these fixtures. """
def import_fixtures(self):
""" Create simple fixture entries..."""
self.redis.zadd('flaw_scope', '{ "name":"major" , "score":100 }', 100)
self.redis.zadd('flaw_quality', '{ "name":"poor" , "score":100 }', 10... | CityGenerator/Megacosm-Generator | fixtures/flaw.py | Python | gpl-2.0 | 538 |
# Adapted from the book "The Blender Python API: Precision 3D Modeling and Add-on Development"
# by Chris Conlan
bl_info = {
"name": "Add-on Template",
"author": "Alex Martinelli",
"location": "View3D > Tools > Simple Addon",
"version": (1, 0, 0),
"blender": (2, 7, 8),
"description": "Template"... | 5agado/data-science-learning | graphics/blender_addon_template.py | Python | apache-2.0 | 3,418 |
import logging
from django.db import models
from django.db import connection
import os
from django.conf import settings
logger = logging.getLogger(__name__)
class QuerySetManager(models.Manager):
"""
@see http://djangosnippets.org/snippets/734/
@see http://hunterford.me/django-custom-model-manager-chaini... | alexhayes/django-toolkit | django_toolkit/db/models.py | Python | mit | 2,944 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import sys
from lib.workflow import Workflow3 as Workflow, ICON_WARNING, ICON_INFO, web, MATCH_ATOM, MATCH_SUBSTRING
def main(wf):
# Imports go here.
import pycountry
import unicodedata
import unicodecsv as csv
from dotmap import DotMap as Map
fro... | darkwinternight/alfred-airports-workflow | airports.py | Python | mit | 8,021 |
#!/usr/bin/python
"""
AirRace competition in Vienna. See robotchallenge.org
usage:
./airrace.py <TODO>
"""
import sys
import datetime
import multiprocessing
import cv2
import math
from pave import PaVE, isIFrame, frameNumber, timestamp, correctTimePeriod
from airrace import processFrame, allStripPoses
from s... | robotika/heidi | airrace_drone.py | Python | mit | 10,239 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# $Id$
# Last modified Wed Jul 8 22:50:28 2009 on violator
# update count: 133
#
# subdms - A document management system based on subversion.
# Copyright (C) 2009 Albert Thuswaldner
#
# This program is free software: you can redistribute it and/or modify
# it under the t... | thuswa/subdms | tools/dbdump.py | Python | gpl-3.0 | 1,211 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^form$', views.form_test),
url(r'(?P<pk>\d+)/$', views.detail, name='detail'),
url(r'(?P<pk>\d+)/results$', views.results, name='results'),
]
| usa-mimi/tutorial | tutorial/polls/urls.py | Python | mit | 275 |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | mjzmjz/swift | swift/account/replicator.py | Python | apache-2.0 | 850 |
# 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... | Lekensteyn/buildbot | master/buildbot/www/auth.py | Python | gpl-2.0 | 6,728 |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 14 19:53:25 2009
Author: josef-pktd
generate arma sample using fft with all the lfilter it looks slow
to get the ma representation first
apply arma filter (in ar representation) to time series to get white noise
but seems slow to be useful for fast estimation for nobs=1... | rgommers/statsmodels | statsmodels/sandbox/tsa/fftarma.py | Python | bsd-3-clause | 16,687 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sonetworks.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that t... | semitki/semitki | api/manage.py | Python | mit | 808 |
import numpy as np
from lightdock.constants import DEFAULT_LIGHTDOCK_PREFIX, DEFAULT_ELLIPSOID_DATA_EXTENSION, NUMPY_FILE_SAVE_EXTENSION
from lightdock.gso.searchspace.ofunction import ObjectiveFunction
class ScoringFunction(ObjectiveFunction):
"""Scoring Functions interface"""
def __init__(self, weight=1.0):... | brianjimenez/lightdock | lightdock/scoring/functions.py | Python | gpl-3.0 | 2,421 |
#-*- coding: cp936 -*-
import math
from PIL import Image
def spherize(image):
'''
@Ч¹û£ºÇòÃæ£¬¶ÔͼÏñ½øÐÐÇòÃæÌØÐ§´¦Àí(¹þ¹þ¾µ)
@param image: instance of Image
@return: instance of Image
'''
width, height = image.size
mid_x = width / 2
mid_y = height / 2 # modified
max_mid_... | QuinnSong/JPG-Tools | src/spherize.py | Python | gpl-3.0 | 1,157 |
#!/usr/bin/env python
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# quickly: quickly project handler
#
# Copyright (C) 2009 Didier Roche
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3,
# as... | didrocks/quickly | setup.py | Python | gpl-3.0 | 4,148 |
from openmm_systems.test_systems import (
LennardJonesPair,
LysozymeImplicit,
)
import simtk.openmm.app as omma
import simtk.openmm as omm
import simtk.unit as unit
from wepy.runners.openmm import gen_sim_state
import time
def create_sim():
test_sys = LysozymeImplicit()
integrator = omm.LangevinInt... | ADicksonLab/wepy | jigs/trio_mapper/source/sync_openmm.py | Python | mit | 1,288 |
import argparse
import os
import random
import scipy.stats as stats
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torchvision.utils as vutils
from tensorboardX import SummaryWriter
from torch.autograd import grad
from data.finetune import CreateDataLoader
from models.standard import *
parse... | orashi/PaintsPytorch | train_ft.py | Python | mit | 13,323 |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright (c) 2015--, The Horizomer Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------... | biocore/WGS-HGT | horizomer/utils/tree.py | Python | bsd-3-clause | 24,210 |
#!/usr/bin/env python
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
sys.path += ['../..']
import gencerts
def add_excluded_name_constraints(cert, num_dns, num_ip, num_dirnames, num_uri):
c... | nwjs/chromium.src | net/data/verify_certificate_chain_unittest/many-names/generate-chains.py | Python | bsd-3-clause | 7,944 |
import json
import pytest
import responses
from twitch.client import TwitchClient
from twitch.constants import BASE_URL
from twitch.exceptions import TwitchAttributeException
from twitch.resources import Channel, Community, Follow, Subscription, Team, User, Video
example_user = {
"_id": "44322889",
"name": "... | tsifrer/python-twitch-client | tests/api/test_channels.py | Python | mit | 11,170 |
#!/usr/bin/env python
# coding: utf-8
import datetime
import locale
import os
import sys
import re
import random
import struct
import traceback
import argparse
import subprocess as sp
import unicodedata
from os.path import dirname, join
from doge import wow
ROOT = join(dirname(__file__), 'static')
DEFAULT_DOGE = 'd... | thiderman/doge | doge/core.py | Python | mit | 15,188 |
#!/usr/bin/env python
#
# 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... | espadrine/opera | chromium/src/third_party/WebKit/Source/devtools/scripts/generate_devtools_html.py | Python | bsd-3-clause | 3,443 |
"""
shapefile.py
Provides read and write support for ESRI Shapefiles.
author: jlawhead<at>geospatialpython.com
date: 20130727
version: 1.2.0
Compatible with Python versions 2.4-3.x
"""
__version__ = "1.2.0"
import array
import os
from struct import pack, unpack, calcsize, error
import sys
import tempfile
import time
... | slub/vk2-georeference | georeference/utils/process/shapefile.py | Python | gpl-3.0 | 44,672 |
from django.utils.encoding import iri_to_uri
from urlparse import urljoin
def utility(request):
"""
Add some useful niceties to the context
"""
base_uri = "%s://%s" % (request.is_secure() and 'https' or 'http',
request.get_host())
return dict(
site_base_uri=... | iivvoo/two.ol | two/ol/context_processors.py | Python | bsd-2-clause | 419 |
"""
:codeauthor: Thomas Jackson <jacksontj.89@gmail.com>
"""
import logging
import threading
import pytest
import salt.channel.client
import salt.channel.server
import salt.config
import salt.exceptions
import salt.ext.tornado.concurrent
import salt.ext.tornado.gen
import salt.ext.tornado.ioloop
import salt.utils... | saltstack/salt | tests/unit/transport/test_tcp.py | Python | apache-2.0 | 5,132 |
import websocket
import json
import logging
import coloredlogs
import sys
import ssl
from getopt import gnu_getopt, GetoptError
from mouserver_ext import grab_window, Window
import random
import string
import time
class Mouserver:
def __init__(self, ws_url, session, window):
self.ws_url = ws_url
... | ssfrr/advenshare | mouserver/mouserver/server.py | Python | mit | 6,082 |
from datetime import timedelta
from six import text_type
from rest_framework.fields import DurationField
from .utils import parse_duration, duration_decimal
class DurationField(DurationField):
def to_internal_value(self, value):
if isinstance(value, timedelta):
return value
parsed =... | cdubz/timestrap | core/fields.py | Python | bsd-2-clause | 593 |
from api.serializers import LocationSerializer
from events.models import Location
from rest_framework import viewsets, serializers, permissions
from api.permissions import IsEventOrganizer
class LocationSet(viewsets.ModelViewSet):
serializer_class = LocationSerializer
permission_classes = [permissions.IsAdm... | auto-mat/klub | apps/api/frontend/locations_unit.py | Python | gpl-3.0 | 1,357 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import io
import pytest
from astropy import units
asdf = pytest.importorskip('asdf')
from asdf.tests import helpers
def roundtrip_quantity(yaml, quantity):
buff = helpers.yaml_to_asdf(yaml)
with asdf.AsdfFile.open(buff)... | funbaker/astropy | astropy/io/misc/asdf/tags/unit/tests/test_quantity.py | Python | bsd-3-clause | 1,879 |
# -*- coding: utf-8 -*-
"""
Managers of ``critica.apps.polls`` application.
"""
from django.db import models
class PollPublishedManager(models.Manager):
"""
Published poll manager.
"""
def get_query_set(self):
"""
Default QuerySet.
"""
return super(PollPu... | brunobord/critica | apps/polls/managers.py | Python | gpl-3.0 | 384 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.