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/env python
##############################################################################
# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompan... | dtudares/hello-world | yardstick/tests/unit/benchmark/scenarios/storage/test_storagecapacity.py | Python | apache-2.0 | 3,405 |
#coding=utf-8
from functools import wraps
from flask import abort
from flask_login import current_user
from app.models import Permission
def permission_required(permission):
def decorator(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if not current_user.can(permission):
... | ricardonhuang/blog | app/decorators.py | Python | gpl-3.0 | 516 |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 03 11:56:58 2014
@author: paulinkenbrandt
"""
import arcpy
import numpy as np
import pandas as pd
infile = arcpy.GetParameterAsText(0)
#input = "C:\\Temp\\test.gdb\\WQP_Results"
#
#tview = arcpy.MakeTableView_management(input)
arr = arcpy.da.TableToNumPyArray(infile, ... | inkenbrandt/EPAEN | Transposer/Transposer.py | Python | gpl-2.0 | 1,726 |
import inspect
import os
from twisted.internet.defer import fail, succeed
from twisted.web.error import Error
from juju.lib.testing import TestCase
from juju.providers import ec2
from juju.providers.ec2.utils import get_current_ami, get_image_id
IMAGE_URI_TEMPLATE = "\
http://uec-images.ubuntu.com/query/%s/server/r... | mcclurmc/juju | juju/providers/ec2/tests/test_utils.py | Python | agpl-3.0 | 4,795 |
"""The Smart Meter Texas integration."""
import asyncio
import logging
from smart_meter_texas import Account, Client
from smart_meter_texas.exceptions import (
SmartMeterTexasAPIError,
SmartMeterTexasAuthError,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PASSWOR... | kennedyshead/home-assistant | homeassistant/components/smart_meter_texas/__init__.py | Python | apache-2.0 | 3,744 |
# -*- coding: utf-8 -*-
from rest_framework.test import APITestCase
from django.core.urlresolvers import reverse
import json
from helpers import *
class ImageUploadTest(APITestCase):
def test_list_uploaded_images(self):
"""
"""
url = reverse('uploadedimage-list')
#+ with self.assertNumQueries(1):
#+ re... | atados/api | atados_core/tests/test_routes/news/test_image_upload.py | Python | mit | 1,810 |
__author__ = 'mpetyx'
from tastypie.authorization import DjangoAuthorization
from .models import OpeniOrder
from OPENiapp.APIS.OpeniGenericResource import GenericResource
from OPENiapp.APIS.OPENiAuthorization import Authorization
from OPENiapp.APIS.OPENiAuthentication import Authentication
class OrderResource(Gener... | OPENi-ict/ntua_demo | openiPrototype/openiPrototype/APIS/Products_and_Services/Order/Resources.py | Python | apache-2.0 | 2,146 |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
Pre build plugin which adds labels to dockerfile. Labels have to be specified either
as a dict:
{
"name": "add_labels_in_dockerfile",
"... | jarodwilson/atomic-reactor | atomic_reactor/plugins/pre_add_labels_in_df.py | Python | bsd-3-clause | 12,163 |
from django.core.management.base import BaseCommand, CommandError
from judge.templatetags.markdown.camo import client as camo_client
class Command(BaseCommand):
help = 'obtains the camo url for the specified url'
def add_arguments(self, parser):
parser.add_argument('url', help='url to use camo on')
... | Minkov/site | judge/management/commands/camo.py | Python | agpl-3.0 | 499 |
'''
Test IPsec
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.ipsec_operations as ipsec_ops
import zstackwoodpecker.operations.resource_operations as res_o... | zstackio/zstack-woodpecker | integrationtest/vm/virtualrouter/ipsec/test_create_2_ipsec.py | Python | apache-2.0 | 8,069 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redist... | LouisePaulDelvaux/openfisca-france-data | openfisca_france_data/input_data_builders/build_openfisca_survey_data/step_06_rebuild.py | Python | agpl-3.0 | 20,725 |
# A regex-based Lexer/tokenizer.
# See the if __main__ section in the bottom for an example.
#
#-----------------------------------------------
# Eli Bendersky (eliben@gmail.com)
# License: this code is in the public domain
# Last modified: March 2009
#-----------------------------------------------
#
import re
import ... | evandrix/Splat | doc/parser/lexer.py | Python | mit | 4,457 |
#!/usr/bin/python
#
# tests rhn.rpclib.Server(), connection through proxy
#
# $Id$
#
# USAGE: $0 SERVER PROXY [SYSTEMID]
import sys
sys.path.append('..')
from rhn import rpclib
SERVER = "xmlrpc.rhn.redhat.com"
HANDLER = "/XMLRPC"
PROXY = "proxy.example.com:8080"
system_id_file = '/etc/sysconfig/rhn/systemid'
if len... | colloquium/spacewalk | client/rhel/rhnlib/test/21-proxy-user-agent.py | Python | gpl-2.0 | 723 |
"""
* Copyright (C) The Project "Nugget" Team - All Rights Reserved
* Written by Jordan Maxwell <jordanmax@nxt-studios.com>, May 1st, 2017
* Licensing information can found in 'LICENSE', which is part of this source code package.
"""
from panda3d.core import Filename, ExecutionEnvironment, WindowProperties, CullBi... | ProjectNugget/Project-Nugget | nugget/nuggetbase/NuggetBase.py | Python | bsd-3-clause | 5,469 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['RelativeDifference'] , ['Lag1Trend'] , ['Seasonal_DayOfWeek'] , ['SVR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_RelativeDifference/model_control_one_enabled_RelativeDifference_Lag1Trend_Seasonal_DayOfWeek_SVR.py | Python | bsd-3-clause | 170 |
# Copyright (C) 2011, 2012, 2015 David Maxwell
#
# This file is part of PISM.
#
# PISM 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.
... | talbrecht/pism_pik07 | site-packages/PISM/invert/listener.py | Python | gpl-3.0 | 2,656 |
#!/usr/bin/env python
"""phpfpmstats - Munin Plugin for monitoring PHP FPM (Fast Process Manager).
Requirements
- The PHP FPM status page must be configured and it must have access
permissions from localhost.
Wild Card Plugin - No
Multigraph Plugin - Graph Structure
- php_fpm_connections
- php_fpm_... | aouyar/PyMunin | pymunin/plugins/phpfpmstats.py | Python | gpl-3.0 | 5,175 |
import hashlib
import logging
from collections import defaultdict
from xml.parsers.expat import ExpatError
import requests
from django import http
from django.conf import settings
from django.core.cache import cache
from django.contrib import messages
from django.shortcuts import render, redirect, get_object_or_404
f... | blossomica/airmozilla | airmozilla/manage/views/vidly_media.py | Python | bsd-3-clause | 15,188 |
#!/usr/bin/python
# _*_ coding: utf-8 _*_
s = '271828'
def chr2num(s):
return {'0':0, '1':1, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8,
'9':9}[s]
def str2int(s):
return reduce(lambda x, y: x * 10 + y, map(chr2num, s))
print str2int(s)
| louistin/fullstack | Python/functional_programming/higher_order_function/map_reduce_20161026.py | Python | mit | 265 |
import os
import zipfile
from io import BytesIO
from django.test import TestCase
from django.core.files import File
from django.http import HttpResponse
from django.test.client import RequestFactory
from zipview.views import BaseZipView
class ZipView(BaseZipView):
"""Test ZipView basic implementation."""
_f... | thibault/django-zipview | zipview/tests/test_views.py | Python | mit | 2,101 |
# -*- coding: utf-8 -*-
"""Markdown r/w models """
class MarkdownItem:
"""Models anything that can be written in Markdown"""
TYPES = ["text", "url", "image", "title"]
ATTRIBUTES = ["ref", "size"]
def __init__(self, text, item_type, attributes=None):
"""
:param text: Text property to... | sirfoga/hal | hal/streams/markdown.py | Python | apache-2.0 | 2,222 |
#!/usr/bin/env python
"""
A linting tool to check for xss vulnerabilities.
"""
if __name__ == "__main__":
from xsslint.main import main
main()
| a-parhom/edx-platform | scripts/xsslint/xss_linter.py | Python | agpl-3.0 | 153 |
# Copyright (c) 2009 Google Inc. All rights reserved.
# Copyright (c) 2009 Apple Inc. All rights reserved.
# Copyright (c) 2012 Intel Corporation. All rights reserved.
# Copyright (c) 2013 University of Szeged. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, a... | klim-iv/phantomjs-qt5 | src/webkit/Tools/Scripts/webkitpy/tool/commands/queries.py | Python | bsd-3-clause | 27,953 |
import random
nsamples = 100
for sample in range(nsamples):
x, y = random.gauss(0.0, 1.0), random.gauss(0.0, 1.0)
print x, y
| vinhqdang/my_mooc | MOOC-work/coursera/FINISHED/Statistical Mechanics Algorithms and Computations/Week 4/programs_lecture_4/gauss_2d.py | Python | mit | 134 |
from django.apps import AppConfig
class StaticpagesConfig(AppConfig):
name = 'staticpages'
| Datateknologerna-vid-Abo-Akademi/date-website | staticpages/apps.py | Python | cc0-1.0 | 97 |
"""
This is the go division class.
It represents a playing division in a go tournament. In an (or the) open
division, all players play even games against each other. In a handicap
division, player play against each other with the higher ranked player
taking white, and giving the lower ranked player a number of handica... | unyth/tournament_graph | TournamentDivision.py | Python | mit | 3,205 |
import random
from plugin import Plugin
class Flatter(Plugin):
def help_text(self, bot):
return bot.translate("flatter_help")
def on_msg(self, bot, user_nick, host, channel, message):
if message.lower().startswith(bot.translate("flatter_cmd")):
if len(message.split()) >= 2:
if bot.getlanguage... | k4cg/Rezeptionistin | plugins/flatter.py | Python | mit | 687 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2015 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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... | iohannez/gnuradio | gr-analog/python/analog/qa_random_uniform_source.py | Python | gpl-3.0 | 2,736 |
import Entity
import pygame
import Tile
import Keyboard
import random
import Client
import gui
import copy
class EntityTreasure(Entity.Entity):
def __init__(self,level, x, y,value,image=None):
super(EntityTreasure,self).__init__(level,x,y)
self.value = value
self.decrition = "Some treasure"
s... | helloworldC2/VirtualRobot | EntityTreasure.py | Python | mit | 3,359 |
"""
Logs key data from a Fronius inverter to a CSV file for later analysis.
peter.marks@pobox.com
"""
import requests
import json
import datetime
import time
# Set this to the IP address of your inverter
host = "192.168.0.112"
# number of seconds between samples, set to zero to run once and exit
sample_seconds = 60 *... | peterbmarks/froniusLogger | froniusLogger.py | Python | apache-2.0 | 1,273 |
"""
This example shows how to work with the Hydrogen radial wavefunctions.
"""
from sympy import var, pprint, Integral, oo, Eq
from sympy.physics.hydrogen import R_nl
print "Hydrogen radial wavefunctions:"
var("r a")
print "R_{21}:"
pprint(R_nl(2, 1, a, r))
print "R_{60}:"
pprint(R_nl(6, 0, a, r))
print "Normalizati... | pernici/sympy | examples/advanced/hydrogen.py | Python | bsd-3-clause | 558 |
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2016) Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limi... | danielreed/python-hpOneView | tests/unit/resources/networking/test_fcoe_networks.py | Python | mit | 4,952 |
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | abstrakraft/repo | subcmds/forall.py | Python | apache-2.0 | 7,450 |
from bokeh.layouts import layout
from bokeh.models import Div, RangeSlider, Spinner
from bokeh.plotting import figure, show
# prepare some data
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y = [4, 5, 5, 7, 2, 6, 4, 9, 1, 3]
# create plot with circle glyphs
p = figure(x_range=(1, 9), width=500, height=250)
points = p.circle(x=... | bokeh/bokeh | sphinx/source/docs/first_steps/examples/first_steps_9_widgets.py | Python | bsd-3-clause | 1,151 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# jobfeasible - Check current job feasibility for queued job
# Copyright (C) 2003-2011 The MiG Project lead by Brian Vinter
#
# This file is part of MiG.
#
# MiG is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | heromod/migrid | mig/cgi-bin/jobfeasible.py | Python | gpl-2.0 | 1,099 |
import unittest
from sklearn.ensemble import RandomForestClassifier
from ParamSklearn.components.feature_preprocessing.feature_agglomeration import FeatureAgglomeration
from ParamSklearn.util import _test_preprocessing, PreprocessingTestCase, \
get_dataset
import sklearn.metrics
class FeatureAgglomerationCompone... | automl/paramsklearn | tests/components/feature_preprocessing/test_feature_agglomeration.py | Python | bsd-3-clause | 1,946 |
from JumpScale import j
class CodeExecutor:
def __init__(self):
pass
def evalFile(self,path):
content=j.system.fs.fileGetContents(path)
content=self.eval(content)
j.system.fs.writeFile(path,content)
def eval(self,code):
return j.tools.text.eval(code)
def _tostr... | Jumpscale/jumpscale6_core | lib/JumpScale/baselib/codeexecutor/CodeExecutor.py | Python | bsd-2-clause | 378 |
"""
Simple utility module to generate random passwords
"""
import os
import string
DEFAULT_PASSWORD_LENGTH = 12
ALLOWED_PASSWORD_CHARS = string.ascii_letters + string.digits + string.punctuation
def random_password(length=DEFAULT_PASSWORD_LENGTH):
"""
Returns a random password of `length` characters
""... | Korrigan/pepperstack | pepperstack/utils/cred.py | Python | mit | 481 |
from setuptools import setup, find_packages
setup(
name="dish",
version="0.0.0",
author="James J. Porter",
author_email="porterjamesj@gmail.com",
description="distributed shell",
license="MIT",
url="https://github.com/porterjamesj/dish",
packages=find_packages(),
install_requires=[
... | LabAdvComp/dish | setup.py | Python | mit | 452 |
# -*- coding: utf-8 -*-
#
# This file is part of Karesansui.
#
# Copyright (C) 2009-2012 HDE, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without lim... | karesansui/karesansui | karesansui/gadget/init.py | Python | mit | 6,792 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Widget to display simulation data of a CSDF graph.
author: Sander Giesselink
"""
import sys
from PyQt5.QtWidgets import QWidget, QGraphicsItem, QPushButton, QVBoxLayout, QMenu, QAction, QInputDialog, QMessageBox
from PyQt5.QtCore import QRectF, QRect, QPoin... | rinsewester/SchemaViz | node.py | Python | mit | 17,791 |
# This challenge is super big, and it's impossible to solve with IDA alone.
# However, we are sure that most of the code is just garbage - you can't have
# a 100-point challenge with that much non-garbage code. Therefore the idea is
# to use GDB along with hardware breakpoints to find out where each byte is
# verif... | Ruide/angr-dev | angr-doc/examples/ekopartyctf2015_rev100/solve.py | Python | bsd-2-clause | 7,445 |
# Copyright (C) 2010, 2012 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 an... | espadrine/opera | chromium/src/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/printing.py | Python | bsd-3-clause | 18,691 |
from setuptools import setup
from setuptools.command.test import test as TestCommand
import os
import sys
class Tox(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
# import here, cause... | asimihsan/vocalsalad | setup.py | Python | mit | 1,756 |
# Copyright 2014-2020 The ODL contributors
#
# This file is part of ODL.
#
# 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://mozilla.org/MPL/2.0/.
"""Universal functions as `Operator` and `Fu... | kohr-h/odl | odl/ufunc_ops/__init__.py | Python | mpl-2.0 | 442 |
from tests.utils import should_throw
from tests.utils.registry import register
from wallace.db import SqlTable, SqlModel, String, DataType, Integer
from wallace.errors import SetupError, ValidationError
class SuperTable(SqlTable):
pass
class SuperModel(SqlModel):
pass
@register
@should_throw(SetupError, ... | csira/wallace | tests/cases/models/sql/pk.py | Python | bsd-3-clause | 3,520 |
import sys
print(sys.platform);
print('Hello hosvik!')
| Hosvik/Hosvik | src/main.py | Python | apache-2.0 | 55 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Intel-Corporation/tensorflow | tensorflow/python/ops/collective_ops.py | Python | apache-2.0 | 19,889 |
# -*- coding: utf-8 -*-
#
# Django Test Utils documentation build configuration file, created by
# sphinx-quickstart on Fri Apr 3 16:36:58 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fil... | acdha/django-test-utils | docs/source/conf.py | Python | mit | 6,540 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _, msgprint
from frappe.utils import flt
from erpnext.setup.utils import get_company_currency
from erpnext.accounts.pa... | ThiagoGarciaAlves/erpnext | erpnext/controllers/buying_controller.py | Python | agpl-3.0 | 10,394 |
#!/usr/bin/env python3
###############################################################################
# Module Imports
###############################################################################
import base64
import jinja2
import os.path
import pathlib
import random as rand
import shutil
import subprocess
import... | anqxyr/racovimge | racovimge/racovimge.py | Python | mit | 4,222 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | piensa/geonode | geonode/catalogue/backends/generic.py | Python | gpl-3.0 | 16,971 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class AsegurarmiautoComItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
| hanjihun/Car | asegurarmiauto_com/asegurarmiauto_com/items.py | Python | mit | 296 |
from __future__ import unicode_literals
from django.apps import AppConfig
class ModerationsConfig(AppConfig):
name = 'moderations'
| CareerVillage/slack-moderation | src/moderations/apps.py | Python | mit | 138 |
#!/usr/bin/env python3
import os
import sys
import redis
app_path = os.path.realpath('%s/../../..' % os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, '%s/lib' % app_path)
import settings
def get_db(conf):
return redis.StrictRedis(host=conf['host'], port=int(conf['port']), db=int(conf['id']))
i... | czcorpus/kontext | lib/plugins/redis_db/cleanup.py | Python | gpl-2.0 | 1,129 |
#
# 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 us... | vikkyrk/incubator-beam | sdks/python/apache_beam/examples/complete/autocomplete_test.py | Python | apache-2.0 | 1,833 |
# Copyright (C) 2015-2022 by the RBniCS authors
#
# This file is part of RBniCS.
#
# SPDX-License-Identifier: LGPL-3.0-or-later
import os
from abc import ABCMeta, abstractmethod
from rbnics.sampling import ParameterSpaceSubset
from rbnics.utils.io import Folders
# Implementation of a class containing an offline/onli... | mathLab/RBniCS | rbnics/reduction_methods/base/reduction_method.py | Python | lgpl-3.0 | 4,987 |
# Copyright (C) 2008 Guild of Writers PyPRP Project Team
# See the file AUTHORS for more info about the team
#
# 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... | Jrius/PyPRP | PyPRP/prp_DXTConv.py | Python | gpl-2.0 | 22,490 |
# 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 ... | klim-iv/phantomjs-qt5 | src/webkit/Tools/Scripts/webkitpy/layout_tests/models/test_results_unittest.py | Python | bsd-3-clause | 2,300 |
import json
from collections import defaultdict
from constants import ROOT_FORM,ROOT_LEMMA,ROOT_POS,EMPTY
class Data():
'''represent dota instance of one sentence'''
current_sen = 1
def __init__(self):
self.tree = None
self.coreference = None
#self.dependency... | Juicechuan/AMRParsing | stanfordnlp/data.py | Python | gpl-2.0 | 4,053 |
# Copyright 2015 Cisco Systems, 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 requir... | Tehsmash/networking-cisco | networking_cisco/plugins/cisco/l3/drivers/asr1k/asr1k_routertype_driver.py | Python | apache-2.0 | 33,133 |
#!/usr/bin/env python -i
# -*- mode: Python; tab-width: 4; indent-tabs-mode: nil; -*-
# ex: set tabstop=4
# Please do not change the two lines above. See PEP 8, PEP 263.
'''Provides an interactive console with pytan available as handler'''
__author__ = 'Jim Olsen <jim.olsen@tanium.com>'
__version__ = '2.1.5'
import os... | tanium/pytan | bin/pytan_shell.py | Python | mit | 1,167 |
"""
Waveform pseudo-type functions.
[[[cog
import os, sys
if sys.hexversion < 0x03000000:
import __builtin__
else:
import builtins as __builtin__
sys.path.append(os.environ['TRACER_DIR'])
import trace_ex_eng_wave_functions
exobj_eng = trace_ex_eng_wave_functions.trace_module(no_print=True)
]]]
[[[end]]]
"""
# ... | pmacosta/peng | peng/wave_functions.py | Python | mit | 62,878 |
import copy
import datetime
import re
import time
from unittest import TestCase, skipIf
import mongomock
from mongomock import ConfigurationError
from mongomock import Database
from mongomock import InvalidURI
from mongomock import OperationFailure
from .utils import DBRef
try:
from bson.objectid import ObjectI... | StarfishStorage/mongomock | tests/test__mongomock.py | Python | bsd-3-clause | 67,868 |
#!/usr/bin/env python3.4
#
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | yusufm/mobly | mobly/controllers/android_device_lib/fastboot.py | Python | apache-2.0 | 2,228 |
#
# 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... | Tagar/incubator-airflow | airflow/migrations/versions/cc1e65623dc7_add_max_tries_column_to_task_instance.py | Python | apache-2.0 | 4,685 |
import collections
import importlib
import importlib.machinery
import io
import itertools
from itertools import chain
import pprint
import sys
from tokenize import * #tokenize, untokenize, ERRORTOKEN, NAME, OP
def _call_with_frames_removed(f, *args, **kwargs):
return f(*args, **kwargs)
def consume(ite... | abarnert/nonehack | nonecoa.py | Python | mit | 2,928 |
__author__ = 'Blake'
from jinja2 import Template
from basetypes import TextContentAsset
class Page(TextContentAsset):
def __init__(self, obj, site = None):
super(Page, self).__init__(obj, site)
@property
def extension(self):
return 'html'
@property
def as_HTML(self):
tem... | blakev/synpost | synpost/objects/content/page.py | Python | mit | 466 |
#!/usr/bin/env python
# Copyright (c) 2007, 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 l... | managementboy/mntv | gflags.py | Python | lgpl-2.1 | 48,851 |
#!/usr/bin/env python3
"""
A program to extract raw text from Telegram chat log
"""
import argparse
from json import loads
def main():
parser = argparse.ArgumentParser(
description="Extract all raw text from a specific Telegram chat")
parser.add_argument('filepath', help='the json chatlog file to ... | expectocode/telegram-analysis | getalltext.py | Python | mit | 1,599 |
from default_imports import *
from modules.game.AnalysedMove import Analysis, AnalysisBSONHandler
from chess import polyglot, Board
from pymongo.collection import Collection
import pymongo
import logging
AnalysedPositionID = NewType('AnalysedPositionID', str)
class AnalysedPosition(NamedTuple('AnalysedPosition', [
... | clarkerubber/irwin | modules/game/AnalysedPosition.py | Python | agpl-3.0 | 2,340 |
# -*- coding: 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 'Project.key'
db.add_column(u'walkthrough_project', 'key',
self.gf('ran... | pinch-tn/pinch-app | pinch/walkthrough/migrations/0002_auto__add_field_project_key__chg_field_project_slug.py | Python | mit | 4,966 |
import os
import numpy as np
import matplotlib.pyplot as plt
from cs231n.data_utils import load_CIFAR10
from cs231n.classifiers import KNearestNeighbor
cifar10_dir = os.getcwd()+'/cifar-10-batches-py'
X_train, y_train, X_test, y_test = load_CIFAR10(cifar10_dir)
classes = ['plane', 'car', 'bird', 'cat', 'deer',
... | BoyuanYan/CIFAR-10 | knn.py | Python | apache-2.0 | 7,145 |
#!/usr/bin/env python
#
# Copyright 2016 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 requir... | googleads/googleads-python-lib | examples/ad_manager/v202111/line_item_creative_association_service/get_licas_for_line_item.py | Python | apache-2.0 | 2,431 |
# Copyright 2011 OpenStack Foundation
# aLL Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | redhat-openstack/manila | manila/tests/api/v1/test_share_types.py | Python | apache-2.0 | 8,424 |
# --------------------------------------------------------
##########################################################################
#
# QGIS-meshing plugins.
#
# Copyright (C) 2012-2013 Imperial College London and others.
#
# Please see the AUTHORS file in the main source directory for a
# full list of cop... | adamcandy/qgis-plugins-meshing-initial | release/QuickMultiAttributeEdit/quickmultiattributeedit_menu.py | Python | lgpl-2.1 | 3,086 |
'''
Functions related to the creation of the OP_RETURN bytes in accordance
to CRED meta-protocol for issuing/revoking certificates
on the blockchain.
'''
import time
from blockchain_certificates import utils
# Allowed operators -- 2 bytes available
operators = {
'op_issue' : b'\x00\x04',
'op_issue... | UniversityOfNicosia/blockchain-certificates | blockchain_certificates/cred_protocol.py | Python | mit | 5,280 |
#decorator
def now():
print "2015-11-18"
f=now
f()
print now.__name__
print f.__name__
def log(func):
def wrapper(*args,**kw):
print 'begin call %s():' %func.__name__
func(*args,**kw)
print 'end call %s():' %func.__name__
return wrapper
@log
def now1():
print now1.__name__
now1()
now1=log(now1)
now1()
def... | zengboming/python | decorator.py | Python | apache-2.0 | 1,581 |
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.ActionMap import ActionMap
from Components.Sources.FrontendStatus import FrontendStatus
from Components.Sources.StaticText import StaticText
from Components.config import config, configfile, getConfigListEntry
from Comp... | OpenLD/enigma2-wetek | lib/python/Screens/AutoDiseqc.py | Python | gpl-2.0 | 9,231 |
#!/usr/bin/env python3
import os
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('input',
help='the input file')
options = parser.parse_args(sys.argv[1:])
with open(options.input) as f:
content = f.read().strip()
print(content)
| trhd/meson | test cases/common/98 gen extra/srcgen3.py | Python | apache-2.0 | 291 |
class B33rn4rySetupEventError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class B33rn4ryKegError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
| SvenRoederer/b33rn4rycounter | B33rn4ryExceptions.py | Python | gpl-2.0 | 283 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from future.moves.urllib.parse import urlparse
import json
import logging
from collections import MutableSet
import requests
from requests import RequestException
from flexget... | oxc/Flexget | flexget/plugins/list/sonarr_list.py | Python | mit | 11,933 |
from mutant_django.generator import DjangoBase
def register(app):
app.extend_generator('django', django_json_field)
def django_json_field(gen):
gen.field_generators['JSON'] = JSONField
class JSONField(DjangoBase):
DJANGO_FIELD = 'JSONField'
def render_imports(self):
return ['from jsonfiel... | peterdemin/mutant | src/mutant_django_json/__init__.py | Python | isc | 341 |
from unittest import main, TestCase
from moderna.ModernaStructure import ModernaStructure
from moderna.analyze.BaseRecognizer import BaseRecognizer
from moderna.sequence.ModernaAlphabet import Alphabet
from moderna.util.Errors import ModernaResidueError
from moderna.modifications import add_modification, remove_modif... | lenarother/moderna | tests/test_modifications/test_add_modification.py | Python | gpl-3.0 | 5,179 |
import logging
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import useragents
from streamlink.stream import HLSStream
from streamlink.utils import update_scheme
log = logging.getLogger(__name__)
class TVToya(Plugin):
_url_re = re.compile(r"https?://tvtoya.pl/live")
_playlist_re ... | beardypig/streamlink | src/streamlink/plugins/tvtoya.py | Python | bsd-2-clause | 996 |
# Copyright 2015-2018 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import pytest
from azure.mgmt.storage.models import StorageAccountUpdateParameters
from c7n_azure.constants import BLOB_TYPE, FILE_TYPE, QUEUE_TYPE, TABLE_TYPE
from c7n_azure.resources.storage ... | capitalone/cloud-custodian | tools/c7n_azure/tests_azure/tests_resources/test_storage.py | Python | apache-2.0 | 24,667 |
#
# Copyright (C) 2013 - 2015 Red Hat, Inc.
# Author: Satoru SATOH <ssato redhat.com>
# License: GPLv3+
#
"""/etc/sysconfig/i18n formats:
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
"""
import sos_analyzer.scanner.base
class Scanner(sos_analyzer.scanner.base.SinglePatternScanner):
name = input_name = "etc/sy... | ssato/sos-analyzer | sos_analyzer/scanner/etc_sysconfig_i18n.py | Python | gpl-3.0 | 413 |
import wpilib
import math
class SharpIR2Y0A02:
'''
Sharp IR sensor GP2Y0A02YK0F
Long distance sensor: 20cm to 150cm
Output is in centimeters
Distance can be calculated using 62.28*x ^ -1.092
'''
def __init__(self,num):
self.distance = ... | frc1418/2015-robot | robot/common/distance_sensors.py | Python | apache-2.0 | 1,861 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-09-11 19:15
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("plan", "0016_plan_test_dashboard"),
("plan", "0016_auto_20180904_1457"),
]
operati... | SalesforceFoundation/mrbelvedereci | metaci/plan/migrations/0017_merge_20180911_1915.py | Python | bsd-3-clause | 329 |
import logging
from urllib import urlencode
import datetime
import os
import mimetypes
import cgi
from pylons import config
from genshi.template import MarkupTemplate
from genshi.template.text import NewTextTemplate
from paste.deploy.converters import asbool
import paste.fileapp
import ckan.logic as logic
import ckan... | sciamlab/ckanext-datigovit | custom/ckan/ckan/controllers/package.py | Python | agpl-3.0 | 62,527 |
#!/usr/bin/env python3
"""
Avalam agent.
Copyright (C) 2015, <<<<<<<<<<< YOUR NAMES HERE >>>>>>>>>>>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distrib... | fthuin/artificial-intelligence | assignment3/Code/basic_agent_2.py | Python | mit | 2,609 |
# -*- coding: utf-8 -*-
from ..common import get_module_class
class Parser(object):
@staticmethod
def get(parser_name):
clazz = get_module_class(parser_name, __name__)
return clazz()
def loads(self, content):
return content
def dumps(self, content):
return content
... | DataCanvasIO/pyDataCanvas | datacanvas/dataset/parser/parser.py | Python | apache-2.0 | 435 |
# coding=utf-8
# Copyright 2018 The Batfish Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | batfish/pybatfish | pybatfish/client/_diagnostics.py | Python | apache-2.0 | 11,725 |
#!/usr/bin/python
import urllib2
import tempfile
import json
# pprint to print json data on screen
from pprint import pprint
# fetching Google data
url = "http://finance.google.com/finance/info?q=rpower"
response = urllib2.urlopen(url)
#storing google data in temp file
temp_html = tempfile.NamedTemporaryFile(mode='... | krthkj/learningPython | GoogleJson.py | Python | mit | 1,529 |
#!/usr/bin/python
import functools
import optparse
import sys
# Install the Python unittest2 package before you run this script.
import unittest
import os
USAGE = """%prog SDK_PATH TEST_PATH
Run unit tests for App Engine apps.
SDK_PATH Path to the SDK installation
TEST_PATH Path to package containing test module... | balanced/status.balancedpayments.com | tests/__init__.py | Python | mit | 1,201 |
import numpy as np
import pandas as pd
# from scipy.stats import gamma
np.random.seed(181336)
number_regions = 5
number_strata = 10
number_units = 5000
units = np.linspace(0, number_units - 1, number_units, dtype="int16") + 10 * number_units
units = units.astype("str")
sample = pd.DataFrame(units)
sample.rename(c... | survey-methods/samplics | tests/weighting/data_weights.py | Python | mit | 3,158 |
"""
This script can be used to ssh to a cloud server started by GNS3. It copies
the ssh keys for a server to a temp file on disk and starts ssh using the
keys.
Right now it only connects to the first cloud server listed in the config
file.
"""
import getopt
import os
import sys
from PyQt4 import QtCore, QtGui
SCR... | noplay/gns3-gui | scripts/ssh_to_server.py | Python | gpl-3.0 | 3,813 |
__author__ = 'f.forti'
DEBUG = True
class Error(Exception):
"""
classe base per l'eccezioni.
DA EREDITARE IN OGNI ECCEZIONE CREATA.
"""
def __init__(self, msg):
"""
:param msg:
:return:
"""
msg = "--->ATTENTION! " + msg
super(Error, self).__init__(msg)
self.msg = msg
class constructionError(Err... | RainbowAcademy/ScriptingLectures | 2015/HouseGenerator/python/utilities.py | Python | gpl-2.0 | 1,300 |
"""
17 nov. 2014
convert a bunch of fasta files, or a single multi fasta file, into a dictionary
"""
from __future__ import print_function
from collections import OrderedDict
import multiprocessing as mu
from os import path
import re
from pytadbit.utils.file_handling import magic_open
from functools import reduce
t... | 3DGenomes/tadbit | _pytadbit/parsers/genome_parser.py | Python | gpl-3.0 | 7,323 |
# arithmeticOperators.py
if __name__ == '__main__':
a = int(input())
b = int(input())
# Elegant solution, one line
print('{0} \n{1} \n{2}'.format((a + b), (a - b), (a * b)))
| bluewitch/Code-Blue-Python | HR_arithmeticOperators.py | Python | mit | 195 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.