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 |
|---|---|---|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Jakub Jirutka <jakub@jirutka.cz>
#
# 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.0',
... | bearstech/ansible | lib/ansible/modules/packaging/os/layman.py | Python | gpl-3.0 | 7,605 |
'''
New Test For bill Operations
'''
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.operations.billing_operations as bill_ops
import zstackwoodpecker.operations.resource_operations as res_ops
import zst... | zstackio/zstack-woodpecker | integrationtest/vm/simulator/public_billing/test_public_ip_biling.py | Python | apache-2.0 | 8,861 |
from __future__ import unicode_literals
from .common import InfoExtractor
class WorldStarHipHopIE(InfoExtractor):
_VALID_URL = r'https?://(?:www|m)\.worldstar(?:candy|hiphop)\.com/(?:videos|android)/video\.php\?.*?\bv=(?P<id>[^&]+)'
_TESTS = [{
'url': 'http://www.worldstarhiphop.com/videos/video.php?... | vinegret/youtube-dl | youtube_dl/extractor/worldstarhiphop.py | Python | unlicense | 1,344 |
from django.db import models as model_fields
from django.conf import settings
from django.conf.urls import url, include
from django.contrib.auth import models as django_models
from polymorphic import PolymorphicModel
from cabot.cabotapp import models, alert
from rest_framework import routers, serializers, viewsets, mix... | cmclaughlin/cabot | cabot/rest_urls.py | Python | mit | 4,286 |
# -*- coding: utf-8 -*-
"""
author: ferris
function: trace the trigger actions and their prior actions for funnel, and add source tags to funnel steps
"""
from pyhive import hive
import pandas as pd
import numpy as np
import datetime
import os
# def in_manually():
# df = pd.read_csv('./data_hive.csv', delimiter=... | ferris-wufei/toolbox | dw/dw_funnel_source/archive/funnel_source.py | Python | gpl-2.0 | 6,513 |
# Pyledger. A simple ledger for smart contracts implemented in Python
# Copyright (C) 2017 Guillem Borrell Nogueras
#
# This program 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, eithe... | guillemborrell/pyledger | pyledger/server/contract.py | Python | agpl-3.0 | 3,527 |
"""
Discovery-related Resource Classes for flask_restful
"""
import json
import logging
from flask import request
from flask_restful import Resource
from es_stats_zabbix.exceptions import NotFound
from es_stats_zabbix.defaults.settings import APIS
from es_stats_zabbix.helpers.batch import get_endpoints, lldoutput, mac... | untergeek/es_stats_zabbix | es_stats_zabbix/backend/discovery.py | Python | apache-2.0 | 5,177 |
# PosetOfExtrema.py
# MIT LICENSE
# Shaun Harker 2016-12-27
from DSGRN._dsgrn import *
class PosetOfExtrema(Pattern):
def __init__(self, network, events, orderings):
"""
Initializes a poset of extrema
network is a DSGRN network object
events is a list of tuples of the form (NAME,'min') or (NAME,... | shaunharker/DSGRN | src/DSGRN/Query/PosetOfExtrema.py | Python | mit | 2,236 |
import argparse
import mir3.data.feature_track as track
import mir3.data.spectrogram as spectrogram
import mir3.lib.mir.features as feats
import mir3.module
import copy
class LowEnergy(mir3.module.Module):
"""Calculate the Low Energy feature"""
def get_help(self):
return """Low energy feature for each... | pymir3/pymir3 | mir3/modules/features/low_energy.py | Python | mit | 2,201 |
#!/usr/bin/env python3
"""
http://adventofcode.com/day/17
Part 1
------
The elves bought too much eggnog again - 150 liters this time. To
fit it all into your refrigerator, you'll need to move it into
smaller containers. You take an inventory of the capacities of
the available containers.
For example, suppose you hav... | rnelson/adventofcode | advent2015/day17.py | Python | mit | 2,152 |
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.normalization import BatchNormalization
from keras.models import Model
from keras.layers import Input, Dense, merge
from keras.applications.resnet50 import ResNet50
import numpy as np
class Detector(... | GodelBose/NSFW_Detection | detector.py | Python | mit | 3,477 |
#!/usr/bin/env python
from thug.DOM.JSClass import JSClass
class NodeList(JSClass):
def __init__(self, doc, nodes):
self.doc = doc
self.nodes = nodes
def __len__(self):
return self.length
def __getitem__(self, key):
return self.item(int(key))
def item(self, index):
... | tweemeterjop/thug | thug/DOM/W3C/NodeList.py | Python | gpl-2.0 | 589 |
# -*- coding: utf-8 -*-
import urllib
import urlparse
import furl
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Q
from rest_framework.exceptions import NotFound
from rest_framework.reverse import reverse
from api.base.authentication.drf import get_session_from_cookie
from api.base... | aaxelb/osf.io | api/base/utils.py | Python | apache-2.0 | 7,885 |
import supriya.commands
import supriya.realtime
from supriya.system.SupriyaValueObject import SupriyaValueObject
class NodeTransition(SupriyaValueObject):
"""
A non-realtime state transition.
"""
### CLASS VARIABLES ###
__documentation_section__ = "Session Internals"
__slots__ = ("_source",... | Pulgama/supriya | supriya/nonrealtime/NodeTransition.py | Python | mit | 4,163 |
"""
Copyright 2016 (c) Rakshak Talwar
Released under the Apache 2 License
"""
import json, pdb, re, time
import HTMLParser
import sqlite3 as sql
import requests
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
### global variables ###
hparse = HTMLParser.HTMLParser()
### gather authentic... | RakshakTalwar/hatchpitchpull | hatchpitchpull/hatchpitchpull.py | Python | apache-2.0 | 12,244 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014-2018 CERN.
#
# INSPIRE 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 ... | inspirehep/inspire-next | tests/unit/records/serializers/literature/common/test_doi.py | Python | gpl-3.0 | 2,323 |
# -*- coding: utf-8 -*-
import time, sched, urllib2, json
from devsup.db import IOScanListBlock
from devsup.hooks import initHook
from devsup.util import StoppableThread
class BPLReport(object):
reports = {}
def __init__(self, name, url, period):
self.name = name
self.url, self.period = url, ... | mdavidsaver/pyDevSup | archApp/bplreport.py | Python | gpl-2.0 | 4,059 |
"""
Bitbucket OAuth support.
This adds support for Bitbucket OAuth service. An application must
be registered first on Bitbucket and the settings BITBUCKET_CONSUMER_KEY
and BITBUCKET_CONSUMER_SECRET must be defined with the corresponding
values.
By default username, email, token expiration time, first name and last n... | looker/sentry | src/social_auth/backends/bitbucket.py | Python | bsd-3-clause | 4,237 |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- http://www.mdanalysis.org
# Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under th... | kain88-de/mdanalysis | package/MDAnalysis/core/topologyobjects.py | Python | gpl-2.0 | 33,789 |
import autosar
ws = autosar.workspace(version="4.2.2")
ws.loadXML('DataTypes.arxml', roles = {
'/DataTypes': 'DataType',
'/DataTypes/CompuMethods': 'CompuMethod',
'/DataTypes/Units': 'Unit',
'/DataTypes/DataConstrs': 'DataConstraint'})
print(ws.roles) | cogu/autosar | doc/autosar4_guide/examples/setting_roles_on_load_xml.py | Python | mit | 276 |
"""
Some tests for the App Editor module.
"""
import unittest
from biokbase.narrative.appeditor import (
generate_app_cell
)
import json
from util import TestConfig
class AppEditorTestCase(unittest.TestCase):
@classmethod
def setUpClass(self):
config = TestConfig()
self.specs_list = config... | jmchandonia/narrative | src/biokbase/narrative/tests/test_appeditor.py | Python | mit | 1,090 |
"""
Module for scope operations
"""
import datetime
import inspect
import itertools
import pprint
import struct
import sys
import numpy as np
from pandas._libs.tslibs import Timestamp
from pandas.compat import DeepChainMap, StringIO, map
from pandas.core.base import StringMixin
import pandas.core.computation as com... | MJuddBooth/pandas | pandas/core/computation/scope.py | Python | bsd-3-clause | 9,212 |
"""Fun games to play! """
| Ikusaba-san/Chiaki-Nanami | cogs/games/__init__.py | Python | mit | 26 |
class Solution(object):
def maxRotateFunction(self, A):
"""
:type A: List[int]
:rtype: int
"""
res = 0
prevDiff = 0
s = sum(A)
for i in xrange(len(A) - 1):
diff = s - len(A) * A[len(A) - 1 - i]
res = max(res, diff + prevDiff)
... | Jacy-Wang/MyLeetCode | RotateFunction396.py | Python | gpl-2.0 | 420 |
# -*- coding: utf-8 -*-
import random
import math
import time
import KBEngine
import wtimer
from KBEDebug import *
from interfaces.Combat import Combat
from interfaces.Spell import Spell
from interfaces.Motion import Motion
from interfaces.State import State
from interfaces.Flags import Flags
from interface... | LaoZhongGu/kbengine | demo/res/scripts/cell/Monster.py | Python | lgpl-3.0 | 3,929 |
from datetime import datetime
import json
import django
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db.models.signals import pre_save
from django.test.testcases import TestCase
from tastypie import fields
from tastypie.exceptions import ApiFieldError, NotFound
... | ocadotechnology/django-tastypie | tests/related_resource/tests.py | Python | bsd-3-clause | 39,916 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/adamatch | semi_supervised/mcd.py | Python | apache-2.0 | 7,580 |
# -*- coding: utf-8 -*-
"""
Program to make bry nc file
okada on 2014/10/21
"""
import numpy as np
import pandas as pd
def ramp(zeta):
for i in xrange(744):
zeta[i] = zeta[i] * i / 744.0 + 150.0 * (1.0 - i / 744.0)
return zeta
def bry_zeta(dims, zetafile):
print 'bry_zeta:', ... | okadate/romspy | romspy/make/boundary/bry_zeta.py | Python | mit | 1,889 |
"""
WSGI config for pacemPI project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pacemPI.settings")
from django.core.w... | AngelTsanev/pacemPI | pacemPI/wsgi.py | Python | mit | 906 |
###
# Copyright (c) 2004-2005, Jeremiah Fincher
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of co... | tecan/xchat-rt | plugins/scripts/Supybot-0.83.4.1-bitcoinotc-bot/plugins/Channel/__init__.py | Python | gpl-2.0 | 2,341 |
import os,shutil
from datetime import datetime,timedelta
class create_cms2_files:
def __init__(self,time,cmsdir='',nproc=4,outdir='%Y/%m/%d/%H%M/',tempmodel='model1',axi=[],pol=[],start=1):
"""Sets up initial variables to pass to rest of create_model_cms_files functions.
Really only need to s... | jprchlik/cms2_python_helpers | create_model_files.py | Python | mit | 7,124 |
from django import forms
from falta.models import *
from cfar.utils import *
class JustificativaForm(forms.ModelForm):
class Meta:
model = Justificativa
fields = ('url','tipo_justificativa','faltas')
class AntecipacaoForm(forms.ModelForm):
class Meta:
model = Antecipacao
... | diaspa-nds/cfar | falta/forms.py | Python | gpl-2.0 | 655 |
# domain management
#
# Copyright Matthias Dieter Wallnoefer 2009
# Copyright Andrew Kroeger 2009
# Copyright Jelmer Vernooij 2007-2012
# Copyright Giampaolo Lauria 2011
# Copyright Matthieu Patou <mat@matws.net> 2011
# Copyright Andrew Bartlett 2008-2015
# Copyright Stefan Metzmacher 2012
#
# This program is free soft... | kernevil/samba | python/samba/netcmd/domain.py | Python | gpl-3.0 | 197,686 |
'''
searx 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 your option) any later version.
searx is distributed in the hope that it will be useful,
but WITHOUT ANY WA... | framasoft/searx | searx/plugins/__init__.py | Python | agpl-3.0 | 2,646 |
# Copyright 2013 IBM Corp.
# 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... | jeffrey4l/nova | nova/tests/unit/api/openstack/compute/contrib/test_multiple_create.py | Python | apache-2.0 | 22,764 |
from pygments.lexer import RegexLexer, words
from pygments.token import *
KEYWORDS = [
'store', 'link', 'view', 'style',
'import', 'from',
'for', 'of', 'key',
'if', 'elif', 'else',
]
class KhufuLexer(RegexLexer):
name = 'Khufu'
aliases = ['khufu']
filenames = ['*.khufu']
tokens = {
... | tailhook/khufu | doc/khufulexer.py | Python | apache-2.0 | 738 |
#!/usr/bin/env python
import sys
import os
import ConfigParser
import json
import multiprocessing
from functools import partial
import time
import logging
import argparse
from appdirs import site_config_dir
from Queue import Queue
from threading import Thread
ROOT_PATH = os.path.abspath( os.path.join(os.path.dirna... | coinjet/bitex | apps/main.py | Python | gpl-3.0 | 2,479 |
import inspect
from .cameraserver import CameraServer
def run(grip_pipeline):
'''
A function that can be used to run python image processing code
as generated by GRIP
'''
if inspect.isclass(grip_pipeline):
grip_pipeline = grip_pipeline()
cs = CameraServer.getInstance... | Ironpulse/CRC2017 | Cam/grip.py | Python | agpl-3.0 | 1,049 |
#!/usr/bin/python
from time import time
REPS = 17500
def insert():
m = [None]
i = 0
now = time()
while i < REPS:
m.insert(0, i)
i += 1
print 'Elapsed (insert):', time() - now
def colonZero():
m = [None]
i = 0
now = time()
while i < REPS:
m[:0] = [i]
i += 1
print 'Elapsed (... | opensvn/test | src/study/python/cpp/ch06/alt/insertVsColonZero.py | Python | gpl-2.0 | 442 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2010 Dariusz Suchojad <dsuch at gefira.pl>
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
import glob, imp, itertools, os, tempfile, shutil, subprocess, unittes... | dsuch/sec-wall | code/tests/test_cli.py | Python | gpl-3.0 | 18,478 |
import bnbcalendar
from pprint import pprint
def calculate_total_revenue(calendar):
total = 0
for day, details in calendar.items():
if details["available"] is False:
total += details["price"]
return total
def calculate_revenue_for_listing(listing_id, start=None, end=None, adults=None... | mpresh/airbnb-tools | airbnb/system/finance.py | Python | mit | 878 |
__author__ = "Brian Lenihan <brian.lenihan@gmail.com"
__copyright__ = "Copyright (c) 2012 Python for Android Project"
__license__ = "Apache License, Version 2.0"
import os
import logging
import androidhelper
"""
Create and set a new Tasker variable, display the variable's value in a Tasker
popup, and then clear the v... | gc313/Learning-Python | tasker_example.py | Python | lgpl-3.0 | 1,901 |
from neuroelectro import models as m
__author__ = 'stripathy'
def get_article_last_author(article):
"""
Gets the last author object from NeuroElectro DB given an article
"""
return get_article_author(article, author_position = -1)
def get_article_author(article, author_position = -1):
"""
G... | neuroelectro/neuroelectro_org | db_functions/author_search.py | Python | gpl-2.0 | 1,532 |
# -*- coding: utf-8 -*-
"""
Defines views.
"""
import locale
from calendar import day_abbr, month_name
from collections import OrderedDict
from flask import abort, make_response, redirect
from flask_mako import render_template
from mako.exceptions import TopLevelLookupException
from main import app
from utils import... | djallberto/presence-analyzer-anowak | src/presence_analyzer/views.py | Python | mit | 5,040 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import pickle
from openerp import tools
from openerp.osv import osv, fields
from openerp.exceptions import AccessError, MissingError
from openerp.tools.translate import _
EXCLUDED_FIELDS = set((
'report_sxw_content'... | ilexius/odoo | openerp/addons/base/ir/ir_values.py | Python | gpl-3.0 | 25,389 |
import mox
import time
import unittest
from zoom.agent.predicate.health import PredicateHealth
from zoom.common.types import PlatformType
class PredicateHealthTest(unittest.TestCase):
def setUp(self):
self.mox = mox.Mox()
self.interval = 0.1
def tearDown(self):
self.mox.UnsetStubs()
... | spottradingllc/zoom | test/predicate/health_test.py | Python | gpl-2.0 | 1,195 |
"""Test configuration for the ZHA component."""
from unittest.mock import AsyncMock, MagicMock, PropertyMock, patch
import pytest
import zigpy
from zigpy.application import ControllerApplication
import zigpy.config
import zigpy.group
import zigpy.types
from homeassistant.components.zha import DOMAIN
import homeassist... | turbokongen/home-assistant | tests/components/zha/conftest.py | Python | apache-2.0 | 6,990 |
__author__ = 'takuro'
| taxpon/pyomni | pyomni/object/__init__.py | Python | mit | 22 |
from south.db import db
from django.db import models
from cms.plugins.googlemap.models import *
class Migration:
def forwards(self, orm):
# Deleting field 'GoogleMap.public'
db.delete_column('cmsplugin_googlemap', 'public_id')
# Deleting model 'googlemappublic'
... | team-xue/xue | xue/cms/plugins/googlemap/migrations/0006_publisher2.py | Python | bsd-3-clause | 10,224 |
# coding: utf-8
from __future__ import print_function
import time
from functools import wraps
def timethis(func):
@wraps(func)
def wrapper(*args, **kwargs):
start = time.time()
result = func(*args, **kwargs)
end = time.time()
print(end - start)
return wrapper
@timethis
de... | phyng/python-cookbook | 9.1.py | Python | mit | 418 |
""" Curriculum-based course timetabling solver;
solves timetabling problems formulated in .ectt file format (http://tabu.diegm.uniud.it/ctt/)
Copyright (C) 2013 Stephan E. Becker
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License a... | stBecker/CB-CTT_Solver | Course timetabling solver/hard.py | Python | gpl-3.0 | 3,933 |
from .geo_dundee import GeoSatelliteDataDundee
from .geo_jma import GeoSatelliteDataJMA
from .polar import PolarSatelliteData
from .satellites import Satellites
from .mkdir import mkdir_p
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
| jmozmoz/cloudmap | cloudmap/__init__.py | Python | gpl-3.0 | 289 |
#!/usr/bin/env python3
from functools import reduce
from pgmpy.factors.base import BaseFactor
class FactorSet(object):
r"""
Base class of *DiscreteFactor Sets*.
A factor set provides a compact representation of higher dimensional factor
:math:`\phi_1\cdot\phi_2\cdots\phi_n`
For example the fa... | pgmpy/pgmpy | pgmpy/factors/FactorSet.py | Python | mit | 15,815 |
# The plot server must be running
# Go to http://localhost:5006/bokeh to view this plot
import numpy as np
from scipy.integrate import odeint
from bokeh.plotting import *
sigma = 10
rho = 28
beta = 8.0/3
theta = 3 * np.pi / 4
def lorenz(xyz, t):
x, y, z = xyz
x_dot = sigma * (y - x)
y_dot = x * rho - x ... | the13fools/Bokeh_Examples | plotting/server/lorenz.py | Python | bsd-3-clause | 936 |
import idautils
import idc
from . import vector
class InstructionHashVector(vector.Vector):
type = 'instruction_hash'
type_version = 0
# The Keleven
# http://movies.stackexchange.com/q/11495
keleven = 17391172068829961267
@staticmethod
def _cycle(h, b):
h |= 5
h ^= b
h *= h
h ^= (h >>... | nirizr/rematch | idaplugin/rematch/collectors/vectors/instruction_hash.py | Python | gpl-3.0 | 654 |
import os
import numpy as np
from scipy.io import savemat
from config import ECG_eHEALTH_DATA_DIR
SOURCE_DIR = 'trainECG'
TARGET_DIR = 'trainECG_mat'
source_data_path = os.path.join(ECG_eHEALTH_DATA_DIR, SOURCE_DIR)
target_data_path = os.path.join(ECG_eHEALTH_DATA_DIR, TARGET_DIR)
if not os.path.exists(target_data_pa... | YuriyKhoma/ecg-identification | npy2mat.py | Python | apache-2.0 | 1,163 |
# -*- coding: utf-8 -*-
import functools
import time
import sys
import os
import os.path
import posixpath
import re
from six import u, moves, print_
from . import TIME_TO_SLEEP
def try_if_empty(count):
assert count >= 1
def outer_decorator(func):
@functools.wraps(func)
def inner_decorator... | 9seconds/iblocklist2ipset | iblocklist2ipset/utils.py | Python | mit | 1,566 |
########################################################################
import time, sys
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
NRST = 7 #GPIO4
BOOT0 = 26 #GPIO7
SHORT = 0.1
LONG = 0.5
VERYLONG = 1.0
def setup():
print "GPIO version: " + str(GPIO.VERSION)
print "Pi revision " +... | ARMinARM/arminarm | src/tools/stm32control.py | Python | gpl-2.0 | 974 |
""" lintswitch lints your code in the background.
http://github.com/grahamking/lintswitch
"""
import sys
import socket
import logging
import os
import os.path
import argparse
from threading import Thread
try:
# python 3
from queue import Queue
except ImportError:
# python 2
from Queue import Queue
fro... | grahamking/lintswitch | lintswitch/main.py | Python | gpl-3.0 | 4,151 |
# Copyright (c) 2019 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 appli... | luotao1/Paddle | python/paddle/fluid/tests/unittests/white_list/no_check_set_white_list.py | Python | apache-2.0 | 1,111 |
import os
from setuptools import setup, find_packages
from packstack import version
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(... | mohitsethi/packstack | setup.py | Python | apache-2.0 | 1,032 |
#
# 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... | uber/fbthrift | thrift/tutorial/py/PythonClient.py | Python | apache-2.0 | 2,254 |
##
# Copyright 2009-2015 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 (htt... | nesi/easybuild-framework | test/framework/sandbox/easybuild/easyblocks/t/toy.py | Python | gpl-2.0 | 3,252 |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import os.path
from ansible.errors import AnsibleError
from ansible.module_utils._text import to_text
from ansible.plugins.action import ActionBase
class ActionModule(ActionBase):
def run(self, tmp=None, task_vars=... | hanjianwei/dotfiles | action_plugins/link.py | Python | gpl-3.0 | 1,931 |
import logging
from datetime import datetime
from .actions import actions
from .system_menu.system_menu import system_menu
from .library.buttons import library_buttons
from .book.buttons import book_buttons
from .go_to_page.buttons import go_to_page_buttons
from .bookmarks.buttons import bookmarks_buttons
from .languag... | Bristol-Braille/canute-ui | ui/buttons.py | Python | gpl-3.0 | 3,110 |
"""
Module that provides a connection to the ModuleStore specified in the django settings.
Passes settings.MODULESTORE as kwargs to MongoModuleStore
"""
from importlib import import_module
import gettext
import logging
import six
from pkg_resources import resource_filename
import re
from django.conf import settings... | msegado/edx-platform | common/lib/xmodule/xmodule/modulestore/django.py | Python | agpl-3.0 | 16,136 |
#!/usr/bin/python
from datetime import datetime
class Test(object):
def __init__(self):
self._bla = 0
def incr(self):
self._bla += 1
def meth1():
t = Test()
for _ in xrange(1000000):
t.incr()
def meth2():
t = Test()
incr = t.incr
for _ in xrange(1000000)... | david-furminieux/movingForest | src/methPerf.py | Python | lgpl-3.0 | 547 |
# -*- coding: utf-8 -*-
#
# This file is part of Calypso Server - Calendar Server
# Copyright © 2008-2011 Guillaume Ayoub
# Copyright © 2008 Nicolas Kandel
# Copyright © 2008 Pascal Halter
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... | agx/calypso | calypso/acl/htpasswd.py | Python | gpl-3.0 | 2,935 |
#!/usr/bin/env python
from flask import Flask
from flask.ext.saresource import SAResource
from models import db_session
from models import Todo
app = Flask(__name__)
api = SAResource(app, db_session, url_prefix='/api/v0.1')
# registers GET/POST/DELETE/PUT endpoints at '/api/v0.1/todos' (tablename used for url by d... | mmautner/Flask-SAResource | examples/app.py | Python | mit | 373 |
import time
import os
import sys
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from nw_util import *
chrome_options = Options()
chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__f... | nwjs/nw.js | test/sanity/document-start-end/test.py | Python | mit | 768 |
initialRobotLoc(2.0, 0.5)
dimensions(4.05,6.05)
wall((1.5,3.0),(3.0,3.0))
wall((3.0, 3.0),(3.0,3.5))
wall((3.0,3.5),(2.0,3.5))
wall((2.0,3.5),(2.0,4.5))
wall((2.0,4.5),(1.5,4.5))
wall((1.5,4.5),(1.5,3.0))
wall((1.2,1.5),(3.0,1.5))
wall((3.0, 1.5),(3.0,2.0))
wall((3.0,2.0),(1.2,2.0))
wall((1.2,2.0),(1.2,1.5))
| Cynary/distro6.01 | arch/6.01Soft/lib601-F13-4/soar/worlds/raceWorld.py | Python | mit | 312 |
#!/usr/bin/env python
#
# A simple command line validator for TDoc2 YAML/Markdown based documentation
#
import os, sys, re
apiDocDir = os.path.abspath(os.path.dirname(__file__))
# We package markdown in support/common.
commonSupportDir = os.path.abspath(os.path.join(apiDocDir, '..', 'support', 'common'))
if os.path.e... | hieupham007/Titanium_Mobile | apidoc/validate.py | Python | apache-2.0 | 19,765 |
# (c) 2014, James Tanner <tanner.jc@gmail.com>
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed i... | trondhindenes/ansible | lib/ansible/cli/doc.py | Python | gpl-3.0 | 26,365 |
#!/usr/bin/env python
# Phusion Passenger - https://www.phusionpassenger.com/
# Copyright (c) 2010-2014 Phusion
#
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (th... | gnoling/passenger | helper-scripts/wsgi-loader.py | Python | mit | 8,988 |
from __future__ import unicode_literals
from django.test import TestCase
class HomepageViewTestCase(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_get_method(self):
pass
def test_post_method(self):
pass
def test_dispatch(self):
pass... | ozknightwalker/testing_101 | base/tests/test_views.py | Python | bsd-2-clause | 321 |
"""
Register the list of OAuth2 scopes that can be requested by third parties. This populates the Mongo collection
referenced by CAS when responding to authorization grant requests.
The database class is minimal; the exact specification for what a scope contains lives in the
python module from which this colle... | doublebits/osf.io | scripts/register_oauth_scopes.py | Python | apache-2.0 | 2,812 |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
#
# 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/LIC... | google/apis-client-generator | src/googleapis/codegen/filesys/tar_library_package_test.py | Python | apache-2.0 | 5,992 |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | sadanandb/pmt | src/pyasm/search/__init__.py | Python | epl-1.0 | 730 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
from decimal import Decimal
import doctest
import unittest
from couchdb import design, mapping
from... | Roger/couchdb-python | couchdb/tests/mapping.py | Python | bsd-3-clause | 12,137 |
from bs4 import BeautifulSoup
from park_api.util import convert_date
from park_api.geodata import GeoData
state_map = {
"frei": "open",
"geschlossen": "closed",
"besetzt": "open"
}
geodata = GeoData(__file__)
def parse_html(html):
soup = BeautifulSoup(html, "html.parser")
lot_table_trs = soup.s... | offenesdresden/ParkAPI | park_api/cities/Muenster.py | Python | mit | 1,414 |
#!/usr/bin/env python
#
# Bootloader for the Swift Navigation Piksi GPS Receiver
#
# Copyright (C) 2010 Gareth McMullin <gareth@blacksphere.co.nz>
# Copyright (C) 2011 Piotr Esden-Tempski <piotr@esden.net>
# Copyright (C) 2013-2014 Swift Navigation Inc <www.swift-nav.com>
#
# Contacts: Colin Beighley <colin@swift-nav.c... | swift-nav/piksi_tools | piksi_tools/bootload_v3.py | Python | lgpl-3.0 | 3,528 |
"""
Примитивный UDP сервер.
"""
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 9999
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((UDP_IP, UDP_PORT))
while True:
data, addr = sock.recvfrom(1024)
print("received message:", data, "from", addr)
sock.sendto(data, addr)
| park-python/course | lectures/06_Internet/udp_echo_server_simple.py | Python | bsd-3-clause | 318 |
#############################################################################
# #
# inet6.py --- IPv6 support for Scapy #
# see http://natisbad.org/IPv6/ #
# ... | secdev/scapy | scapy/layers/inet6.py | Python | gpl-2.0 | 155,317 |
from __future__ import print_function
from bokeh.util.browser import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models.glyphs import Circle
from bokeh.models import (
GMapPlot, Range1d, ColumnDataSource, PanTool, WheelZoomTool, BoxSelectTool, GMapOptions)
from bokeh.resou... | phobson/bokeh | examples/models/maps.py | Python | bsd-3-clause | 2,314 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('umibukela', '0032_auto_20180511_1315'),
]
operations = [
migrations.AddField(
model_name='programme',
... | Code4SA/umibukela | umibukela/migrations/0033_programme_slug.py | Python | mit | 428 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import (
compat_b64decode,
compat_str,
)
from ..utils import (
clean_html,
ExtractorError,
int_or_none,
str_or_none,
try_get,
url_or_none,
urlencode_postdata,
urljoin,
)
cla... | vinegret/youtube-dl | youtube_dl/extractor/platzi.py | Python | unlicense | 7,630 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# pilconfig for pyILPER
#
# (c) 2015 Joachim Siebold
#
# 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 your o... | bug400/pyilper | pyilper/pilconfig.py | Python | gpl-2.0 | 3,560 |
class h:
a = 0
b = 1
def __init__(self):
print "hello world"
def sum(self):
return self.a + self.b
def setA(self, a):
self.a = a
def setB(self, b):
self.b = b
v = h()
v.setA(2)
c = v.sum()
print c
| xu-wang11/Pyww | test8.py | Python | mit | 254 |
# from electrum_arg.i18n import _
# fullname = 'KeepKey'
# description = _('Provides support for KeepKey hardware wallet')
# requires = [('keepkeylib','github.com/keepkey/python-keepkey')]
# registers_keystore = ('hardware', 'keepkey', _("KeepKey wallet"))
# available_for = ['qt', 'cmdline']
| argentumproject/electrum-arg | plugins/keepkey/__init__.py | Python | mit | 294 |
# Copyright (C) 2014, 2015, 2016 SICS Swedish ICT AB
#
# Main author: Tomas Olsson <tol@sics.se>
#
# License: BSD 3 clause
from visisc import _EventHierEle
__author__ = 'tol'
import visisc
import pyisc
class EventHierarchyElement(_EventHierEle):
child_ = None
sibling_ = None
parent_ = None
num_of_ch... | STREAM3/visisc | _visisc_modules/EventHierarchy.py | Python | bsd-3-clause | 4,104 |
from __future__ import division
import math, random, re
from collections import defaultdict, Counter
from bs4 import BeautifulSoup
import requests
def plot_resumes(plt):
data = [ ("big data", 100, 15), ("Hadoop", 95, 25), ("Python", 75, 50),
("R", 50, 40), ("machine learning", 80, 20), ("statistics", 20, ... | joelgrus/data-science-from-scratch | first-edition/code/natural_language_processing.py | Python | mit | 10,007 |
import re
import signal
import sys
import time
import Adafruit_DHT
from utils.decorators import in_thread, log_exceptions
from utils.io import non_empty_input, non_empty_positive_numeric_input, log, Color, wrh_input
from wrh_engine import module_base as base_module
ninput = non_empty_input
iinput = non_empty_positiv... | Waszker/WRH---Raspberry | modules/dht22/dht22.py | Python | gpl-2.0 | 5,335 |
# vim:ts=4:et
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 your option) any later version.
#
# This prog... | taniwha-qf/io_object_mu | export_mu/volume.py | Python | gpl-2.0 | 6,925 |
import unittest
import pysal
import scipy
import numpy as np
from pysal.spreg.ml_lag import ML_Lag
from pysal.spreg import utils
from pysal.common import RTOL
@unittest.skipIf(int(scipy.__version__.split(".")[1]) < 11,
"Max Likelihood requires SciPy version 11 or newer.")
class TestMLError(unittest.TestCase):
... | schmidtc/pysal | pysal/spreg/tests/test_ml_lag.py | Python | bsd-3-clause | 2,788 |
"""
Base utilities to build API operation managers and objects on top of.
"""
class Manager(object):
"""
Managers interact with a particular type of resource and provide CRUD
operations for them.
"""
resource_class = None
def __init__(self, api):
self.api = api
def _list(self, ... | jacobian-archive/python-storymarket | storymarket/base.py | Python | bsd-3-clause | 2,426 |
from django.contrib import admin
from django_tablib.admin import TablibAdmin
from django import forms
from gigs.gig_registry import models
class AutofillUUIDForm(forms.ModelForm):
class Meta:
model = None
def __init__(self, *args, **kwargs):
# TODO(shauno): This method stops working once we ha... | shaunokeefe/gigs | gigs/gig_registry/admin.py | Python | bsd-3-clause | 6,616 |
#!/usr/bin/env python
# encoding: utf-8
# ----------------------------------------------------------------------------
import datetime
import logging
from optparse import make_option
from django.core.management.base import BaseCommand
from django_yubin.management.commands import create_handler
from django_yubin.mode... | sergei-maertens/django-yubin | django_yubin/management/commands/cleanup_mail.py | Python | apache-2.0 | 1,233 |
print "How old are you?"
age = int(raw_input())
if age >= 21:
print "Yay, you can drink legally!"
print "You are", age, "years old." | jordantdavis/CourseProblemSolvingWithComputers | InClassExamples/DrinkingAge.py | Python | mit | 142 |
# Copyright 2013 NEC Corporation
# 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 ... | pczerkas/tempest | tempest/api/compute/admin/test_simple_tenant_usage.py | Python | apache-2.0 | 2,598 |
import os
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
import mpf
# Test
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(se... | tartopum/MPF | setup.py | Python | mit | 1,662 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.