code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
from unittest import TestCase
import dogma
from test_dogma_values import *
class TestDogmaExtra(TestCase):
def test(self):
ctx = dogma.Context()
slot = ctx.add_module(TYPE_125mmGatlingAutoCannonII)
loc = dogma.Location.module(slot)
affectors = ctx.get_affectors(loc)
ctx.... | jboning/python-dogma | test_dogma_extra.py | Python | agpl-3.0 | 1,477 |
# -*- coding: utf-8 -*-
"""Simple functions for dealing with posts, replies, votes and subscriptions
within Redis and MongoDB
:license: AGPL v3, see LICENSE for more details
:copyright: 2014-2021 Joe Doherty
"""
# 3rd party imports
from flask import current_app as app, url_for
from jinja2.filters import do_capital... | pjuu/pjuu | pjuu/posts/backend.py | Python | agpl-3.0 | 24,772 |
# Copyright 2017 ForgeFlow S.L.
# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import _, fields
from odoo.exceptions import UserError, ValidationError
from odoo.fields import Date
from odoo.tests.common import Form, SavepointCase
class Tes... | OCA/bank-payment | account_payment_partner/tests/test_account_payment_partner.py | Python | agpl-3.0 | 21,944 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/bpp-suite/package.py | Python | lgpl-2.1 | 1,771 |
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
from __future__ import with_statement
import unittest
import pycurl
import tempfile
from . import app
from . import runwsgi
from . import util
setup_module, teardown_module = runwsgi.app_runner_setup((app.app, 8380))
class WriteToFileTest(unittest.Te... | p/pycurl-archived | tests/write_to_file_test.py | Python | lgpl-2.1 | 779 |
#!/usr/bin/env python
# -*- python -*-
#
# Git Version: @git@
#-----------------------------------------------------------------------
# XALT: A tool that tracks users jobs and environments on a cluster.
# Copyright (C) 2013-2014 University of Texas at Austin
# Copyright (C) 2013-2014 University of Tennessee
#
# This... | xalt/xalt | contrib/upgradeDB_From0.7.1.py | Python | lgpl-2.1 | 5,640 |
from lcapy import Circuit
cct = Circuit("""
V 1 0 step 10; down
L 1 2 1e-3; right, size=1.2
C 2 3 1e-4; right, size=1.2
R 3 0_1 1; down
W 0 0_1; right
""")
import numpy as np
t = np.linspace(0, 0.01, 1000)
vr = cct.R.v.evaluate(t)
from matplotlib.pyplot import subplots, savefig
fig, ax = subplots(1)
ax.plot(t, vr, li... | mph-/lcapy | doc/examples/netlists/circuit-VRLC2-vr.py | Python | lgpl-2.1 | 442 |
# -*- python -*-
# Git Version: @git@
#-----------------------------------------------------------------------
# XALT: A tool that tracks users jobs and environments on a cluster.
# Copyright (C) 2013-2014 University of Texas at Austin
# Copyright (C) 2013-2014 University of Tennessee
#
# This library is free softwar... | xalt/xalt | proj_mgmt/py_build_tools/build_python_filter_routine.py | Python | lgpl-2.1 | 3,443 |
from setuptools import setup
from setuptools import find_packages
setup(
name='geonition_aliases',
version='0.0.1',
author='Dariusz Walczak',
url='',
packages=find_packages(),
include_package_data=True,
package_data = {
"geoforms": [
"templates/*.html",
"temp... | recoded-co/geonition_aliases | setup.py | Python | lgpl-2.1 | 781 |
from distutils import log
from distutils.core import setup
from distutils.core import Command
from distutils.command.build_py import build_py
from distutils.command.install import install
import os
import zeroinstall
class adjust_scripts_for_home(Command):
"""setup.py install --home puts libraries in ~/lib/python, bu... | turtledb/0install | setup.py | Python | lgpl-2.1 | 3,194 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from abc import ABCMeta, abstractmethod
from cloudclient import CCResponse
class CCPlugin(object):
"""@Interface"""
__metaclass__ = ABCMeta
@abstractmethod
def perform(self):
pass
@abstractmethod
def __init__(self):
self._path = None
self._request = None
"""@Att... | nottorp/cloudvoting | src/python/cloudclient/CCPlugin.py | Python | lgpl-2.1 | 358 |
#!/usr/bin/env python
#
# reference_node_loader.py: unit tests for
# vyconf.tree.referencetree.ReferenceTreeLoader
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General ... | vyos-legacy/vyconfd | vyconf/tests/integration/reference_tree/test_tree_loader.py | Python | lgpl-2.1 | 3,032 |
#
# Secret Labs' Regular Expression Engine
#
# various symbols used by the regular expression engine.
# run this script to update the _sre include files!
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal su... | prefetchnta/questlab | bin/x64bin/python/36/Lib/sre_constants.py | Python | lgpl-2.1 | 7,054 |
#***************************************************************************
#* *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.net> *
#* ... | balazs-bamer/FreeCAD-Surface | src/Mod/Arch/ArchWall.py | Python | lgpl-2.1 | 22,906 |
import subprocess
import sys
import os
import time
from collections import namedtuple
sys.path.append(os.path.join(os.getcwd(), "src"))
from utils import settings
from utils import logger
settings.initialize('watcher')
original_plist = '/opt/TopPatch/agent/daemon/com.toppatch.agent.plist'
osx_plist = '/System/Libra... | vFense/vFenseAgent-nix | agent/watcher_mac.py | Python | lgpl-3.0 | 4,731 |
import unittest
import zmq
import struct
import uuid
import socket
from pyre.zactor import ZActor
from pyre.zbeacon import ZBeacon
class ZBeaconTest(unittest.TestCase):
def setUp(self, *args, **kwargs):
ctx = zmq.Context()
ctx = zmq.Context()
# two beacon frames
self.transmit1 ... | zeromq/pyre | tests/test_zbeacon.py | Python | lgpl-3.0 | 2,243 |
import datetime
import io
import logging
import logging.handlers
import os
import sys
from collections import deque
from time import perf_counter
import colorlog
class LogHelper:
FORMATTER_COLOR = colorlog.ColoredFormatter('{log_color}{asctime} {name}: {levelname} {message}', style='{')
FORMATTER = logging.F... | wolf1986/log_utils | log_utils/helper.py | Python | lgpl-3.0 | 4,265 |
# -*- coding: utf-8 -*-
from google.appengine.api import datastore, datastore_types, datastore_errors
from google.appengine.datastore import datastore_query, datastore_rpc
from google.appengine.api import memcache
from google.appengine.api import search
from server.config import conf
import logging
"""
Tiny wrapper ... | viur-framework/server | db.py | Python | lgpl-3.0 | 43,494 |
# -*- coding: utf8 -*-
from __future__ import absolute_import
from django.conf.urls import url, include
from .views import MonitoringView
urlpatterns = [
url(r'^$', MonitoringView.as_view(), name="index"),
url(r'^info/', include('app.modules.monitoring_nodes.info.urls', namespace='info')),
url(r'^plugins/'... | netsuileo/sfu-cluster-dashboard | dashboard/app/modules/monitoring_nodes/urls.py | Python | lgpl-3.0 | 780 |
from time import localtime, strftime
# download from http://code.google.com/p/psutil/
import psutil
import time
import thingspeak
channel_id = 0 # PUT CHANNEL ID HERE
write_key = 0 # PUT YOUR WRITE KEY HERE
def doit(channel):
cpu_pc = psutil.cpu_percent()
mem_avail_mb = psutil.virtual_memory().percent
... | mchwalisz/thingspeak | examples/thingspeak_cpu_loop.py | Python | lgpl-3.0 | 778 |
#!/Users/tiradoe/Projects/Giflocker/bin/python3
#
# The Python Imaging Library.
# $Id$
#
# a utility to identify image files
#
# this script identifies image files, extracting size and
# pixel mode information for known file formats. Note that
# you don't need the PIL C extension to use this module.
#
# History:
# 0.0... | tiradoe/Giflocker | bin/pilfile.py | Python | lgpl-3.0 | 2,695 |
#!/usr/bin/env python
"""
Tweak of profile plots as a function of nn.
"""
import pickle
import matplotlib.pylab as plt
import matplotlib.lines as mlines
import numpy as np
from subprocess import Popen
import os, sys
# If we add to sys.path, then it must be an absolute path
commonDir = os.path.abspath("./../../../com... | CELMA-project/CELMA | celma/pickleTweaks/neutralScan/neutralField1D.py | Python | lgpl-3.0 | 6,252 |
# This file is part of MSMTools.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# MSMTools is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either ... | markovmodel/msmtools | msmtools/analysis/dense/decomposition.py | Python | lgpl-3.0 | 17,097 |
#from osgeo import ogr
from shapely.geometry import Polygon, shape
from fiona import collection
from fiona.crs import from_epsg
import time
#admin_file_name = 'admin3.shp'
admin_file_name = 'PHL_adm3_PSA_pn_2016June/PHL_adm3_PSA_pn_2016June.shp'
typhoon_file_name = 'typhoon_melor_edited.shp/WindSpeed.shp'
output_file_... | rodekruis/priorityindex | scripts/calc_average_windspeed.py | Python | lgpl-3.0 | 2,134 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# RoundTM - A Round based Tournament Manager
# Copyright (c) 2013 Rémi Alvergnat <toilal.dev@gmail.com>
#
# RoundTM is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free Software Fo... | Toilal/roundtm | roundtm/console.py | Python | lgpl-3.0 | 1,499 |
import threading
import select
import time
import socket
pyb_present = False
try:
import pybonjour
pyb_present = True
except ImportError:
pyb_present = False
TIMEOUT = 5
discovered_lock = threading.Semaphore()
discovered = []
discovered_event = threading.Event()
discovery_running = False
def discover(t... | lorddex/unibopoly | python_kp/smart_m3/discovery.py | Python | lgpl-3.0 | 5,827 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#external imports
import sys
import optparse
import json
import os
import uuid
import subprocess
#internal imports
import subuserlib.commandLineArguments
import subuserlib.profile
import subuserlib.paths
subuserExecutable = os.path.join(subuserlib.paths.getSubuserDir(),"logi... | shannara/subuser | logic/subuserlib/builtInCommands/dev.py | Python | lgpl-3.0 | 2,852 |
"""
The TradeChain community is used to keep track of transactions performed in the decentralized market.
"""
| vandenheuvel/tribler | Tribler/community/tradechain/__init__.py | Python | lgpl-3.0 | 110 |
__author__ = 'Dominic Miglar <dominic.miglar@bitmovin.net>'
import unittest
from bitcodin import create_input
from bitcodin import Input
from bitcodin.exceptions import BitcodinBadRequestError
from bitcodin.test.bitcodin_test_case import BitcodinTestCase
class CreateInputIncompleteDataTestCase(BitcodinTestCase):
... | bitmovin/bitcodin-python | bitcodin/test/input/testcase_create_input_incomplete_data.py | Python | unlicense | 727 |
from __future__ import unicode_literals
import base64
import datetime
import hashlib
import json
import netrc
import os
import re
import socket
import sys
import time
import math
from ..compat import (
compat_cookiejar,
compat_cookies,
compat_etree_fromstring,
compat_getpass,
compat_http_client,
... | mcepl/youtube-dl | youtube_dl/extractor/common.py | Python | unlicense | 89,946 |
import sys
def row_matrix_to_col_matrix(row_matrix):
col_matrix = []
for c in range(len(row_matrix)): col_matrix.append([])
for r in range(len(row_matrix)):
for c in range(len(row_matrix)):
col_matrix[c].append(row_matrix[r][c])
return col_matrix
def col_matrix_to_row_matrix(col_... | mpillar/codeeval | 1-moderate/sort-martix-columns/main.py | Python | unlicense | 1,201 |
from __future__ import unicode_literals
import base64
import re
from .common import InfoExtractor
from ..utils import qualities
class TeamcocoIE(InfoExtractor):
_VALID_URL = r'http://teamcoco\.com/video/(?P<video_id>[0-9]+)?/?(?P<display_id>.*)'
_TESTS = [
{
'url': 'http://teamcoco.com/v... | Kagee/youtube-dl | youtube_dl/extractor/teamcoco.py | Python | unlicense | 3,246 |
'''Find valid tags and usernames.
The file will contain things like:
tag:12345:romance
'''
import gzip
import re
import requests
import string
import sys
import time
import random
DEFAULT_HEADERS = {'User-Agent': 'ArchiveTeam'}
class FetchError(Exception):
'''Custom error class when fetching does not meet our... | ArchiveTeam/panoramio-discovery | discover.py | Python | unlicense | 3,093 |
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from fbposter.models import FacebookStatus
import facebook
import datetime
class Command(BaseCommand):
args = ''
help = 'Gets fresh messages from Reddit'
def handle(self, *args, **options):
if len(args)... | orlenko/FBBot | src/FBBot/fbposter/management/commands/populate.py | Python | apache-2.0 | 412 |
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
import libcloud.security
# This assumes you don't have SSL set up.
# Note: Code like this poses a security risk (MITM attack) and
# that's the reason why you should never use it for anything else
# besides testing. You have ... | Jc2k/libcloud | docs/examples/compute/openstack_simple.py | Python | apache-2.0 | 610 |
# coding=utf-8
# Copyright 2022 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | tensorflow/tensor2tensor | tensor2tensor/data_generators/paraphrase_ms_coco_test.py | Python | apache-2.0 | 3,095 |
#!/usr/bin/env python3
import argparse
import functools
import json
import os
import re
import signal
import socket
import ssl
import subprocess
import sys
import threading
import time
import warnings
from collections import defaultdict
from operator import itemgetter
import psutil
from mtools.util import OrderedDict... | rueckstiess/mtools | mtools/mlaunch/mlaunch.py | Python | apache-2.0 | 96,965 |
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | codilime/cloudify-rest-client | cloudify_rest_client/blueprints.py | Python | apache-2.0 | 7,791 |
# 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... | reeshupatel/demo | keystone/common/serializer.py | Python | apache-2.0 | 13,041 |
# Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | deepmind/brave | brave/training/trainer.py | Python | apache-2.0 | 3,771 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | core/polyaxon/proxies/schemas/api/__init__.py | Python | apache-2.0 | 729 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from contextlib import contextmanager
@contextmanager
def log(name):
print('[%s] start...' % name)
yield
print('[%s] end.' % name)
with log('DEBUG'):
print('Hello, world!')
print('Hello, Python!')
| whyDK37/py_bootstrap | samples/context/do_with.py | Python | apache-2.0 | 269 |
from django.utils.six.moves import input
# From https://stackoverflow.com/a/39257511/1157536
def ask_for_confirmation(question, default=None):
"""Ask for confirmation before proceeding.
"""
result = input('{} '.format(question))
if not result and default is not None:
return default
while l... | Johnetordoff/osf.io | osf/management/utils.py | Python | apache-2.0 | 457 |
# Copyright 2017 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... | nburn42/tensorflow | tensorflow/contrib/boosted_trees/estimator_batch/estimator_test.py | Python | apache-2.0 | 5,248 |
import xml.etree.cElementTree as et
from collections import OrderedDict
from tabletopscanner.boardgamegeekapi.parsers import Deserializer
class SearchParser(Deserializer):
def deserialize(self, xml):
tree = et.fromstring(xml)
return [SearchParser.__make_search_result(el) for el in tree.findall('i... | ramseyboy/tabletop-scanner | tabletopscanner/boardgamegeekapi/search.py | Python | apache-2.0 | 674 |
doubleClick("1370381210737.png")
click("1370381239650.png")
wheel(Pattern("1370381239650.png").targetOffset(-1,30), WHEEL_DOWN, 7)
click(Pattern("mary_hager.png").targetOffset(97,-2))
find("1370381955817.png")
| openmash/medsphere-test | select_provider.sikuli/select_provider.py | Python | apache-2.0 | 214 |
# Generated by Django 2.1.7 on 2019-04-11 06:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0007_auto_20180526_1702'),
]
operations = [
migrations.AlterField(
model_name='article',
name='image',
... | flavoi/diventi | diventi/blog/migrations/0008_auto_20190411_0806.py | Python | apache-2.0 | 574 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-compute | google/cloud/compute_v1/services/target_tcp_proxies/client.py | Python | apache-2.0 | 42,291 |
# -*- coding: utf-8 -*-
#
# 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
#... | malmiron/incubator-airflow | tests/models.py | Python | apache-2.0 | 119,658 |
"""Support for SimpliSafe alarm control panels."""
import logging
import re
from simplipy.entity import EntityTypes
from simplipy.system import SystemStates
from homeassistant.components.alarm_control_panel import (
FORMAT_NUMBER,
FORMAT_TEXT,
AlarmControlPanel,
)
from homeassistant.components.alarm_contr... | qedi-r/home-assistant | homeassistant/components/simplisafe/alarm_control_panel.py | Python | apache-2.0 | 5,527 |
from muntjac.ui.abstract_component import AbstractComponent
from muntjac.demo.sampler.APIResource import APIResource
from muntjac.demo.sampler.Feature import Feature, Version
class Tooltips(Feature):
def getSinceVersion(self):
return Version.OLD
def getName(self):
return 'Tooltips'
... | rwl/muntjac | muntjac/demo/sampler/features/commons/Tooltips.py | Python | apache-2.0 | 930 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | trunglq7/horizon | openstack_dashboard/dashboards/admin/users/views.py | Python | apache-2.0 | 4,417 |
#!/usr/bin/env python3
import unittest
import amulet
class TestDeploy(unittest.TestCase):
"""
Trivial deployment test for Apache Hadoop NameNode.
This charm cannot do anything useful by itself, so integration testing
is done in the bundle.
"""
def test_deploy(self):
self.d = amulet.... | c0s/juju-apache-bigtop-namenode | tests/01-basic-deployment.py | Python | apache-2.0 | 578 |
"""A guestbook sample with sqlite3."""
import logging
import os
import jinja2
import sqlite3
import webapp2
from google.appengine.api import app_identity
from google.appengine.api import modules
from google.appengine.api import runtime
from google.appengine.api import users
from google.appengine.ext import ndb
JINJ... | googlearchive/appengine-sqlite-guestbook-python | main.py | Python | apache-2.0 | 5,760 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | eharney/cinder | cinder/api/v3/attachments.py | Python | apache-2.0 | 11,362 |
'''
PyDALI proxyLinda module to encapsulate DALI agent communication
in the ASP solver case study
Licensed with Apache Public License
by AAAI Research Group
Department of Information Engineering and Computer Science and Mathematics
University of L'Aquila, ITALY
http://www.disim.univaq.it
'''
__autho... | AAAI-DISIM-UnivAQ/ASP_DALI | LindaProxy/proxyLinda.py | Python | apache-2.0 | 10,523 |
"""Provide an authentication layer for Home Assistant."""
import asyncio
from collections import OrderedDict
from datetime import timedelta
import logging
from typing import Any, Dict, List, Optional, Tuple, cast
import jwt
from homeassistant import data_entry_flow
from homeassistant.auth.const import ACCESS_TOKEN_EX... | postlund/home-assistant | homeassistant/auth/__init__.py | Python | apache-2.0 | 17,515 |
#!/usr/bin/env python3
import getopt
import sys
import os
Options = {
'daemon': False,
'fifo': os.environ['HOME'] + '/warnd_fifo',
'log': [],
'time': 2,
'size': 54,
'wrap': 0,
}
State = {
'currentlog': 0,
}
USAGE = '\n'.join([
'Usage: %s' % sys.argv[0],
' Warns the user about so... | lpenz/ansible-playbooks | roles/user-x/files/scripts/warnd.py | Python | apache-2.0 | 1,987 |
# 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... | RobinQuetin/CAIRIS-web | cairis/cairis/TCNarrativeTextCtrl.py | Python | apache-2.0 | 3,495 |
# pylint: disable=missing-docstring
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
from django.core.urlresolvers import reverse
from guardian.shortcuts import assign_perm
from rest_framework.test import APITestCase
from resolwe.flow.models import Process
class Pr... | jberci/resolwe | resolwe/flow/tests/test_ordering.py | Python | apache-2.0 | 1,377 |
# -*- coding: utf-8 -*-
"""Windows UserAssist information collector."""
import codecs
import logging
from winregrc import data_format
from winregrc import errors
from winregrc import interface
class UserAssistEntry(object):
"""UserAssist entry.
Attributes:
guid (str): GUID.
name (str): name.
value_... | libyal/winreg-kb | winregrc/userassist.py | Python | apache-2.0 | 7,938 |
"""
Launcher for homity-hub
"""
from Hub import app
from Hub.api import hub_config
import cherrypy
from paste.translogger import TransLogger
if hub_config.get('ssl_enable'):
from OpenSSL import SSL
def run_cherrypy():
"""Start CherryPy server."""
#Enable WSGI access logging via Paste
app_logged = Tr... | openhomity/homity-hub | runhub.py | Python | apache-2.0 | 1,615 |
from third_party.bi_att_flow.my.tensorflow import * | google/active-qa | third_party/bi_att_flow/my/tensorflow/__init__.py | Python | apache-2.0 | 51 |
#
# PKCS#12 syntax
#
# ASN.1 source from:
# ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-12/pkcs-12.asn
#
# Sample captures could be obtained with "openssl pkcs12" command
#
from pyasn1_modules.rfc2459 import *
from pyasn1_modules import rfc2251
class Attributes(univ.SetOf):
componentType = rfc2251.Attribute()
class... | itielshwartz/BackendApi | lib/pyasn1_modules/pkcs12.py | Python | apache-2.0 | 1,204 |
# Copyright 2014 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | catkin/catkin_tools | catkin_tools/jobs/commands/cmake.py | Python | apache-2.0 | 9,938 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013, Big Switch Networks, 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... | tanglei528/horizon | openstack_dashboard/test/api_tests/lbaas_tests.py | Python | apache-2.0 | 16,445 |
from memoria.app import create_app
app = create_app()
if __name__ == "__main__":
app.run()
| memoria-exorior/memoria | memoria/wsgi.py | Python | apache-2.0 | 97 |
import numpy as np
import sys
R = np.eye(int(sys.argv[2]))
np.savetxt(sys.argv[1]+'/R.txt', R)
| chocjy/randomized-quantile-regression-solvers | hadoop/src/gen_id.py | Python | apache-2.0 | 97 |
# -*- coding: UTF-8 -*-
from insights.client.phase.v1 import post_update
from mock.mock import patch
from pytest import raises
def patch_insights_config(old_function):
patcher = patch("insights.client.phase.v1.InsightsConfig",
**{"return_value.load_all.return_value.status": False,
... | RedHatInsights/insights-core | insights/tests/client/phase/test_LEGACY_post_update.py | Python | apache-2.0 | 3,188 |
#
# Autogenerated by Thrift
#
# DO NOT EDIT
# @generated
#
import apache.thrift.metadata.lite_types as _fbthrift_metadata
# TODO (ffrancet): This general pattern can be optimized by using tuples and dicts
# instead of re-generating thrift structs
def _fbthrift_gen_metadata_struct_MyStruct(metadata_struct: _fbthrift_... | facebook/fbthrift | thrift/compiler/test/fixtures/basic/gen-py3lite/module/lite_metadata.py | Python | apache-2.0 | 13,649 |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By:
# Maintained By:
from . import settings
# Initialize Flask app
from flask import Flask
app = Flask('ggrc', instance_relative_config=True)
app.co... | alaeddine10/ggrc-core | src/ggrc/app.py | Python | apache-2.0 | 1,435 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
import socks
import time
import json
import threading
import string
import random
import os
import logging
from core.alert import *
from core.targets import target_type
from core.targets import target_to_host
from core.load_modules import load_file_path
from ... | viraintel/OWASP-Nettacker | lib/scan/port/engine.py | Python | apache-2.0 | 24,604 |
import datetime
import os
from django.db.models.fields.files import FileField
from django.core.files.storage import default_storage
from django.utils.encoding import force_unicode, smart_str
class ModelUploadFileField(FileField):
"""
Makes the upload_to parameter optional by using the name of the model
"... | callowayproject/django-articleappkit | articleappkit/fields.py | Python | apache-2.0 | 1,369 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | rrlfd/adroit_ext/hammer_v0.py | Python | apache-2.0 | 1,602 |
#!/usr/bin/env python
"""
conference.py -- Udacity conference server-side Python App Engine API;
uses Google Cloud Endpoints
$Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $
created by wesc on 2014 apr 21
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
# ! - - - LIBRARIES - - - - - - - - - ... | chrisullyott/udacity-conference-central | conference.py | Python | apache-2.0 | 35,954 |
print("-------------- assigning numbers -----------")
fred =100
print(fred)
print(fred)
fred = 200
print(fred)
print(fred)
john = fred
fred = john
print("-------------- assigning letters -----------")
adam = "jj"
print(adam)
print("-------------- assigning coins -----------")
number_of_coins = 200
| wibeasley/mayan-playground-1 | teagen/chapter_02/calculations_and_variables.py | Python | apache-2.0 | 306 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# =================================================================
# =================================================================
import httplib
import json
import logging
import sys
import requests
import os
import hashlib
def enum(*sequential, **named):
enums... | windskyer/k_cinder | paxes_cinder/scohack/scosample/imgupload_ostest.py | Python | apache-2.0 | 11,651 |
from __future__ import unicode_literals
from .base import *
GI_APPLICATION = u'wsgi.local.application'
| GhalebKhaled/fb-bot-test | settings/local.py | Python | apache-2.0 | 105 |
# coding=utf-8
# Copyright (c) 2016-2018, F5 Networks, 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... | F5Networks/f5-openstack-agent | f5_openstack_agent/utils/clean_partition.py | Python | apache-2.0 | 2,380 |
# =========================================================================
# Copyright 2012-present Yunify, Inc.
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the Licens... | yunify/qingcloud-sdk-python | qingcloud/iaas/actions/instance_groups.py | Python | apache-2.0 | 6,153 |
import copy
import logging
import os
import pytest
import salt.ext.tornado
import salt.ext.tornado.gen
import salt.ext.tornado.testing
import salt.minion
import salt.syspaths
import salt.utils.crypt
import salt.utils.event as event
import salt.utils.platform
import salt.utils.process
from salt._compat import ipaddress... | saltstack/salt | tests/pytests/unit/test_minion.py | Python | apache-2.0 | 35,098 |
#!/usr/bin/env python
#
# This file contains utilities for understanding dependencies between python
# source files and tests.
#
# Utils are assumed to be used from top level ray/ folder, since that is how
# our tests are defined today.
#
# Example usage:
# To find all circular dependencies under ray/python/:
# ... | ray-project/ray | ci/travis/py_dep_analysis.py | Python | apache-2.0 | 11,800 |
"""Tests for Climacell weather entity."""
from __future__ import annotations
from datetime import datetime
import logging
from typing import Any
from unittest.mock import patch
import pytest
from homeassistant.components.climacell.config_flow import (
_get_config_schema,
_get_unique_id,
)
from homeassistant.... | kennedyshead/home-assistant | tests/components/climacell/test_weather.py | Python | apache-2.0 | 15,479 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('SocialNetworkModels', '0006_remove_comments_post_author'),
]
operations = [
migrations.AddField(
model_name='com... | diego04/cmput410-project | Distributed_Social_Networking/SocialNetworkModels/migrations/0007_comments_comment_author.py | Python | apache-2.0 | 483 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from PenBlog.admin import article,category,link,other
__author__ = 'lihaoquan'
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
# 文章
url(r'^$', article.show_articles),
url(r'^new-article/$', article.new),
url(r'^edit-article... | quanix/PenBlog | PenBlog/admin/urls.py | Python | apache-2.0 | 1,174 |
import logging
from airflow.contrib.hooks.bigquery_hook import BigQueryHook
from airflow.models import BaseOperator
from airflow.utils import apply_defaults
class BigQueryOperator(BaseOperator):
"""
Executes BigQuery SQL queries in a specific BigQuery database
"""
template_fields = ('bql', 'destinatio... | Chedi/airflow | airflow/contrib/operators/bigquery_operator.py | Python | apache-2.0 | 2,155 |
from django.views import generic
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import tabs
from horizon import tables
from billingdashboard.co... | sreenathmenon/billing-dashboard | billingdashboard/dashboards/project/cust_invoice/views.py | Python | apache-2.0 | 1,151 |
# 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... | RobinQuetin/CAIRIS-web | cairis/cairis/RiskScatterPanel.py | Python | apache-2.0 | 3,503 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-resource-manager | samples/generated_samples/cloudresourcemanager_v3_generated_folders_delete_folder_async.py | Python | apache-2.0 | 1,580 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import random
import time
import unittest
from mock import call
from mock import patch
from mock import MagicMock as Mock
import pyrax
from pyrax.manager import BaseManager
from pyrax.clouddns import assure_domain
... | rackspace/pyrax | tests/unit/test_cloud_dns.py | Python | apache-2.0 | 33,656 |
import verifytree.VerifyTree as P
import pytest
import os
import logging
import smtplib
from mock import Mock
from mock import patch, call
from mock import MagicMock
from mock import PropertyMock
class Testverifytree:
def setup(self):
self.p = P.VerifyTree()
| virantha/verifytree | test/test_verifytree.py | Python | apache-2.0 | 275 |
#
# 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... | apache/incubator-airflow | airflow/providers/amazon/aws/sensors/s3_key.py | Python | apache-2.0 | 8,164 |
# Copyright 2019 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... | alexgorban/models | official/nlp/bert/create_pretraining_data.py | Python | apache-2.0 | 16,735 |
"""
Support for WeMo switches.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/switch.wemo/
"""
import logging
from datetime import datetime, timedelta
from homeassistant.components.switch import SwitchDevice
from homeassistant.util import convert
from ... | JshWright/home-assistant | homeassistant/components/switch/wemo.py | Python | apache-2.0 | 7,698 |
"""Treadmill Kafka API"""
import fnmatch
import logging
import os
import re
import socket
from .. import admin as tadmin
from .. import context
from .. import dnsutils
from .. import discovery
from .. import fs
from .. import zkutils
_LOGGER = logging.getLogger(__name__)
KAFKA_ZK_ROOT = 'kafka'
DEFAULT_KAFKA_DIR =... | toenuff/treadmill | lib/python/treadmill/kafka/__init__.py | Python | apache-2.0 | 6,933 |
#! /usr/bin/python
# -*- coding: UTF-8 -*-
from dblog.handler import index_handler
from dblog.handler import cat_handler
from dblog.handler import back_article_handler
from dblog.handler import ckeditor_handler
from dblog.handler import front_handler
urls = [
# -------- 博客首页
(r"/", front_handler.FrontIndex),
... | yunshichen/dblog | src/dblog/handler/urls.py | Python | apache-2.0 | 2,005 |
#!/usr/bin/env python
#
# Copyright 2013 cloudysunny14.
#
# 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... | cloudysunny14/CloudySwitch | cloudyswitch/app/topology_util.py | Python | apache-2.0 | 2,860 |
import logging
import os
import cv2
import numpy as np
import pickle
from skimage.feature import hog
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.svm import LinearSVC
logging.basicConfig(format='%(asctime)s : %(message)s', level=logging.DEBUG)
logg... | vwiart/self-driving-car-nanodegree-project5 | classifier.py | Python | apache-2.0 | 2,376 |
# Copyright (C) 2012-2020 Jonathan Vasquez <jon@xyinn.org>
#
# 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... | fearedbliss/bliss-initramfs | pkg/hooks/Hook.py | Python | apache-2.0 | 2,523 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | openstack/ironic | ironic/tests/unit/api/test_proxy_middleware.py | Python | apache-2.0 | 2,349 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.