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 |
|---|---|---|---|---|---|
"""An XBlock to use as a child when you don't care what child to show.
This code is in the Workbench layer.
"""
from web_fragments.fragment import Fragment
from xblock.core import XBlock
from .util import make_safe_for_html
class DebuggingChildBlock(XBlock):
"""A simple gray box, to use as a child placehold... | stvstnfrd/xblock-sdk | workbench/blocks.py | Python | apache-2.0 | 867 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2017 Snowflake Computing Inc. All right reserved.
#
import codecs
import errno
import glob
import os
import tempfile
from os import path
import OpenSSL
from snowflake.connector.compat import PY2
from snowflake.connector.constants import (SHA256_DIGE... | mayfield/snowflake-connector-python | test/test_unit_s3_util.py | Python | apache-2.0 | 9,034 |
# Copyright 2015 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... | jhseu/tensorflow | tensorflow/python/ops/image_grad.py | Python | apache-2.0 | 15,566 |
import http.server
import sys
class ServerHandler(http.server.BaseHTTPRequestHandler):
def _process_request(self):
self.log_message("<<<HEADERS")
self.log_message(self.headers.as_string().strip())
self.log_message("HEADERS>>>")
self.log_message("<<<BODY")
try:
c... | zentralopensource/zentral | tests/utils/http_server.py | Python | apache-2.0 | 1,158 |
#!/usr/bin/python
"""
@package nilib
@file nicl.py
@brief Basic command line client for NI names, make 'em and check 'em
@version $Revision: 0.04 $ $Author: elwynd $
@version Copyright (C) 2012 Trinity College Dublin
This is an adjunct to the NI URI library developed as
part of the SAIL project. (http://sai... | skunkwerks/netinf | python/nilib/nicl.py | Python | apache-2.0 | 8,160 |
# Copyright 2016 - Nokia
#
# 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, sof... | openstack/vitrage | vitrage/api/controllers/rest.py | Python | apache-2.0 | 1,420 |
# -*- 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-appengine-admin | google/cloud/appengine_admin_v1/types/firewall.py | Python | apache-2.0 | 2,785 |
# Copyright (c) 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 ... | Datera/cinder | cinder/tests/unit/scheduler/test_host_manager.py | Python | apache-2.0 | 63,530 |
# Copyright (c) 2014 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | ibmsoe/ImpalaPPC | tests/custom_cluster/test_spilling.py | Python | apache-2.0 | 3,129 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import warnings
from pyasn1.codec.der import decoder, encoder
f... | hipnusleo/laserjet | resource/pypi/cryptography-1.7.1/src/cryptography/hazmat/primitives/asymmetric/utils.py | Python | apache-2.0 | 2,460 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | briancurtin/python-openstacksdk | openstack/compute/v2/server_group.py | Python | apache-2.0 | 1,373 |
import jax.numpy as np
from jax.scipy.special import erf, erfc, gammaln
from jax.nn import softplus
from jax import jit, partial, jacrev, random
from jax.scipy.linalg import cholesky
from jax.scipy.stats import beta
from numpy.random import binomial
from numpy.polynomial.hermite import hermgauss
from utils import logph... | AaltoML/kalman-jax | kalmanjax/archive/likelihoods.py | Python | apache-2.0 | 27,639 |
# snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.]
# snippet-sourcedescription:[Lambda rotation for AWS Secrets Manager - RDS PostgreSQL with separate Master secret]
# snippet-service:[secretsmanager]
# snippet-keyword:[rotation function]
# snippet-keyword:[python]
# snippet-k... | awsdocs/aws-doc-sdk-examples | lambda_functions/secretsmanager/RDSPostgreSQL-Multiuser.py | Python | apache-2.0 | 16,740 |
""" Cisco_IOS_XR_clns_isis_datatypes
This module contains a collection of generally useful
derived YANG data types.
Copyright (c) 2013\-2016 by Cisco Systems, Inc.
All rights reserved.
"""
import re
import collections
from enum import Enum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedB... | 111pontes/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_clns_isis_datatypes.py | Python | apache-2.0 | 1,675 |
# versa.serial.ntriples
'''
Serialize and deserialize between a Versa model and NTriples
https://www.w3.org/TR/rdf-testcases/#ntriples
'''
import re
from amara3 import iri
from versa import I, VERSA_BASEIRI, ORIGIN, RELATIONSHIP, TARGET
from versa.terms import VERSA_BASEIRI, RDF_NS, RDFS_NS, VTYPE_REL, RDF_TYPE_REL... | uogbuji/versa | tools/py/serial/ntriples.py | Python | apache-2.0 | 4,115 |
import unittest
import requests
import mock
from rest_calls.xmlRestClient import XMLRestCalls
username = 'admin'
password = 'admin'
ip = '127.0.0.1'
port = 80
endpoint = 'Cisco-IOS-XR-ip-static-cfg:router-static'
sm_url = '{scheme}://{ip}:{port}{basePath}/'.format(
scheme='http',
ip=ip,
port... | lisroach/PyRESTCONF | rest_calls/tests/unit/test_xml_mock.py | Python | apache-2.0 | 2,194 |
#!/usr/bin/python3
import re
import smbus
# ===========================================================================
# I2C Class
# ===========================================================================
class MotorI2C(object):
@staticmethod
def getPiRevision():
"Gets the version number of the ... | kkaczkowski/Hoover | robot/motors/motor_i2c.py | Python | apache-2.0 | 6,150 |
import enum
class BugStatus(enum.Enum):
new = 7
incomplete = 6
invalid = 5
wont_fix = 4
in_progress = 3
fix_committed = 2
fix_released = 1
by_design = 4
closed = 1
for status in BugStatus:
print('{:15} = {}'.format(status.name, status.value))
print('\nSame: by_design is won... | jasonwee/asus-rt-n14uhp-mrtg | src/lesson_data_structures/enum_aliases.py | Python | apache-2.0 | 470 |
# -*- coding: utf-8 -*-
#
# Copyright 2012 Institut für Experimentelle Kernphysik - Karlsruher Institut für Technologie
#
# 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://... | HappyFaceGoettingen/HappyFaceCore | modules/JobsStatistics.py | Python | apache-2.0 | 13,429 |
class Solution(object):
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
# Op1:
isNegative = False
if x < 0:
isNegative = True
x *= -1
x = int(str(x)[::-1])
if isNegative:
x *= -1
return x if ab... | rx2130/Leetcode | python/7 Reverse Integer.py | Python | apache-2.0 | 710 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-22 14:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('news', '0002_event'),
]
operations = [
migrations.AddField(
mod... | luisfer85/newspaper2 | newspaper2/newspaper2/news/migrations/0003_event_publish_date.py | Python | apache-2.0 | 520 |
# Copyright 2011 Andrew Bogott for the Wikimedia 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 requi... | badock/nova | nova/api/openstack/compute/plugins/v3/floating_ip_dns.py | Python | apache-2.0 | 10,441 |
from app import db
class Pets(db.Model):
__tablename__ = 'pets'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(128), unique=True)
color = db.Column(db.String(30))
pet = db.Column(db.String(10))
def __init__(self, name, color, pet):
self.name = name
sel... | jairoserrano/simpledevops | models.py | Python | apache-2.0 | 425 |
# Copyright 2012 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 requ... | vijayendrabvs/ssl-python-neutronclient | neutronclient/neutron/v2_0/quota.py | Python | apache-2.0 | 8,697 |
"""
VirtWhoConf - File ``/etc/virt-who.conf`` and ``/etc/virt-who.d/*.conf``
========================================================================
The ``VirtWhoConf`` class parses the virt-who configuration files in `ini-like`
format.
.. note::
The configuration files under ``/etc/virt-who.d/`` might ... | RedHatInsights/insights-core | insights/parsers/virt_who_conf.py | Python | apache-2.0 | 1,776 |
#!/usr/bin/env python3
# Copyright 2010-2021 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 ... | google/or-tools | ortools/constraint_solver/samples/vrp_tokens.py | Python | apache-2.0 | 6,133 |
{%- from "horizon/map.jinja" import server with context %}
{%- if server.app is defined %}
{%- set app = salt['pillar.get']('horizon:server:app:'+app_name) %}
{%- else %}
{%- set app = salt['pillar.get']('horizon:server') %}
{%- endif %}
# Specify a regular expression to validate user passwords.
# HORIZON_CONFIG["pas... | Martin819/salt-formula-horizon | horizon/files/horizon_settings/_horizon_settings.py | Python | apache-2.0 | 4,809 |
from django.contrib.auth import get_user_model
from rest_framework import status
from datetime import datetime, timedelta
from coupons.tests.base import BasicTest
class CouponListTests(BasicTest):
def setUp(self):
u = get_user_model()
u.objects.create_superuser('admin', 'john@snow.com', self.PW)... | pstrinkle/drf-coupons | coupons/tests/test_coupon_list.py | Python | apache-2.0 | 4,596 |
# flake8: noqa
import copy
from collections import OrderedDict, deque
import numpy as np
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
def describe_location(location, locations):
if location.can_describe:
final_location = locations.get(locatio... | c3nav/c3nav | src/c3nav/routing/route.py | Python | apache-2.0 | 9,539 |
import math
a=float(input('Digite o valor de A:'))
b=float(input('Digite o valor de B:'))
c=float(input('Digite o valor de C:'))
delta=(b**2)-4*a*c
if delta < 0:
print('esta equação não possui raízes reais')
else:
xPositivo = (-b + math.sqrt(delta)) / (2 * a)
if delta == 0:
print('a raiz desta equaç... | RodFernandes/Python_USP_Curso_Ciencias_da_Computacao_1 | bhaskara.py | Python | apache-2.0 | 506 |
python = Runtime.createAndStart("python","Python")
mouth = Runtime.createAndStart("Mouth","MouthControl")
arduino = mouth.arduino
arduino.connect('COM3')
jaw = mouth.getJaw()
jaw.detach()
jaw.attach(arduino,11)
mouth.setmouth(110,120)
mouth.autoAttach = False
speech = Runtime.createAndStart("Speech","MarySpeech")
print... | MyRobotLab/pyrobotlab | home/Mats/MouthControl.py | Python | apache-2.0 | 796 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2014 Kitware 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 cop... | sutartmelson/girder | tests/cases/access_test.py | Python | apache-2.0 | 12,062 |
"""
Copyright 2021 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, software
di... | google-research/robodesk | robodesk/robodesk_example.py | Python | apache-2.0 | 642 |
import Cookie
import os
from django.conf import settings
from common.tests import ViewTestCase
from common import api
from common import clean
from common import util
class JoinTest(ViewTestCase):
def setUp(self):
super(JoinTest, self).setUp()
self.form_data = {'nick': 'johndoe',
'fi... | tallstreet/jaikuenginepatch | join/tests.py | Python | apache-2.0 | 4,711 |
"""Provide functionality to stream video source.
Components use create_stream with a stream source (e.g. an rtsp url) to create
a new Stream object. Stream manages:
- Background work to fetch and decode a stream
- Desired output formats
- Home Assistant URLs for viewing a stream
- Access tokens for URLs for vi... | jawilson/home-assistant | homeassistant/components/stream/__init__.py | Python | apache-2.0 | 13,852 |
# increment_version_num.py
# Utility to incremement version number in drupal info files
# Ameer Ayoub <ameer.ayoub@gmail.com>
import re, sys, os
major_v = 0
minor_v = 0
def inc_dv_num(s, minor = True):
global major_v, minor_v
pattern = re.compile("(version = (\d\.x)-)(\d+)\.(\d+)")
m = re.match(pattern, s)
if m:
... | ameerkat/drupal-content-reservation | util/inc_vnum.py | Python | apache-2.0 | 1,320 |
my_dict = {'a': 1}
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_language_tools/dis_simple.py | Python | apache-2.0 | 19 |
import sys
sys.path.append('django-vosi/')
| kristinriebe/django-prov_vo | tests/travis.local.py | Python | apache-2.0 | 43 |
'''
Created on Apr 7, 2016
@author: Alex Ip, Geoscience Australia
'''
import sys
import netCDF4
import subprocess
import re
from geophys2netcdf import ERS2NetCDF
def main():
assert len(
sys.argv) == 5, 'Usage: %s <root_dir> <file_template> <attribute_name> <attribute_value>' % sys.argv[0]
root_dir = ... | alex-ip/geophys2netcdf | utils/set_attribute.py | Python | apache-2.0 | 1,500 |
from setuptools import setup, find_packages
from libbgp import __version__
with open('README.rst') as f:
long_description = f.read()
setup(
name='libbgp',
version=__version__,
url='https://github.com/smartbgp/libbgp',
license='Apache 2.0',
author='Peng Xiao',
author_email='xiaoquwl@gmail.c... | smartbgp/libbgp | setup.py | Python | apache-2.0 | 910 |
"""
Module which handles all the routing mechanics to convert UnroutedNotifications into either
RoutedNotifications or FailedNotifications
"""
from octopus.lib import dates
from octopus.modules.store import store
from service import packages, models
import esprit
from service.web import app
from flask import url_for
f... | JiscPER/jper | service/routing.py | Python | apache-2.0 | 24,672 |
"""Kernel K-means"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# License: BSD 3 clause
import logging
import numpy as np
from sklearn.base import BaseEstimator, ClusterMixin
from sklearn.metrics.pairwise import pairwise_kernels
from sklearn.utils import check_random_state
logger = logging.getLogger(__name__)... | kylemvz/magichour-old | StringKernel/kernel_kmeans.py | Python | apache-2.0 | 4,707 |
"""
Copyright 2017 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 law or agreed to in writing, software
dis... | conversationai/wikidetox | experimental/conversation_go_awry/prediction_utils/configure.py | Python | apache-2.0 | 2,644 |
# Copyright (c) 2015 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 ... | openstack/dragonflow | dragonflow/db/neutron/models.py | Python | apache-2.0 | 1,561 |
# Copyright 2016 Coursera
#
# 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, sof... | coursera/courseraresearchexports | courseraresearchexports/models/ExportRequest.py | Python | apache-2.0 | 8,795 |
# -*- coding: utf-8 -*-
#
# Copyright 2014-2022 BigML
#
# 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 ... | bigmlcom/python | bigml/api_handlers/evaluationhandler.py | Python | apache-2.0 | 3,626 |
from __future__ import absolute_import
import os
from robot.libraries.BuiltIn import BuiltIn
HOST = "http://localhost:8000"
BROWSER = os.environ.get('BROWSER', 'firefox')
def _get_variable_value(variable):
return BuiltIn().replace_variables('${%s}' % variable)
class Page(object):
def __init__(self, path):
... | ox-it/talks.ox | tests/pages.py | Python | apache-2.0 | 4,682 |
import base64
import requests
from flask import Blueprint
from flask import current_app as app
from flask import redirect, render_template, request, session, url_for
from itsdangerous.exc import BadSignature, BadTimeSignature, SignatureExpired
from CTFd.cache import clear_team_session, clear_user_session
from CTFd.mo... | LosFuzzys/CTFd | CTFd/auth.py | Python | apache-2.0 | 20,121 |
import importlib
import pytest
from unittest import mock
from google.cloud import aiplatform
from google.cloud.aiplatform import base
from google.cloud.aiplatform import datasets
from google.cloud.aiplatform import initializer
from google.cloud.aiplatform import schema
from google.cloud.aiplatform.training_jobs import... | googleapis/python-aiplatform | tests/unit/aiplatform/test_automl_forecasting_training_jobs.py | Python | apache-2.0 | 36,005 |
# Copyright (c) 2010-2011 OpenStack, 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 agreed to ... | houseurmusic/my-swift | test/unit/container/test_updater.py | Python | apache-2.0 | 8,262 |
#!/usr/bin/env python
# cardinal_pythonlib/sqlalchemy/dump.py
"""
===============================================================================
Original code copyright (C) 2009-2021 Rudolf Cardinal (rudolf@pobox.com).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version ... | RudolfCardinal/pythonlib | cardinal_pythonlib/sqlalchemy/dump.py | Python | apache-2.0 | 19,483 |
# Copyright 2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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 ... | sony/nnabla | python/src/nnabla/backward_function/affine_grid.py | Python | apache-2.0 | 1,101 |
# coding: utf-8
from __future__ import unicode_literals
from mock import patch
import six
from test.util.streamable_mock_open import streamable_mock_open
def test_upload_then_update(box_client, test_file_path, test_file_content, update_file_content, file_name):
with patch('boxsdk.object.folder.open', streamable_... | Frencil/box-python-sdk | test/functional/test_file_upload_update_download.py | Python | apache-2.0 | 2,514 |
r"""Python script that acts like (GNU coreutils) env -0.
When run as a script, it prints the the environment as
`(VARNAME=value\0)*`.
Ideally we would just use `env -0`, because python (thanks to PEPs 538
and 540) will set zero to two environment variables to better handle
Unicode-locale interactions, however BSD fam... | common-workflow-language/cwltool | cwltool/env_to_stdout.py | Python | apache-2.0 | 927 |
#!/usr/bin/env python3
#
# Copyright (c) 2015-2017 Nest Labs, 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/lice... | openweave/happy | happy/ReturnMsg.py | Python | apache-2.0 | 1,604 |
from __future__ import nested_scopes
import time, sys, os
from zope.interface import implements
from twisted.trial import unittest
from txweb2 import http, http_headers, responsecode, iweb, stream
from txweb2 import channel
from twisted.internet import reactor, protocol, address, interfaces, utils
from twisted.int... | trevor/calendarserver | txweb2/test/test_http.py | Python | apache-2.0 | 47,272 |
#
# 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
# ... | cwolferh/heat-scratch | heat/tests/openstack/manila/test_share.py | Python | apache-2.0 | 9,631 |
#!/usr/bin/env python
#===============================================================================
# Copyright 2015 Geoscience Australia
#
# 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
#... | ama-jharrison/agdc | agdc/tests/test_new_ingest.py | Python | apache-2.0 | 1,629 |
from __future__ import absolute_import
from typing import Any, Iterable, Dict, Tuple, Callable, Text, Mapping
import requests
import json
import sys
import inspect
import logging
from six.moves import urllib
from functools import reduce
from requests import Response
from django.utils.translation import ugettext as _
... | jrowan/zulip | zerver/lib/outgoing_webhook.py | Python | apache-2.0 | 6,862 |
#!/usr/bin/env python3
import randopt as ro
@ro.cli
def test1(arg1=20, arg2='name', arg3=1.23):
print('test1')
print('arg1', arg1)
print('arg2', arg2)
print('arg3', arg3)
@ro.cli
def test2(arg1=20, arg2='name', arg3=1.23):
"""
The docstring serves as help when using the --help flag.
Ar... | seba-1511/randopt | examples/command_example.py | Python | apache-2.0 | 1,067 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
VERSION = '0.0.50'
| sameerparekh/pants | src/python/pants/version.py | Python | apache-2.0 | 320 |
# Copyright (c) 2014 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... | paninetworks/neutron | neutron/db/migration/models/head.py | Python | apache-2.0 | 3,435 |
#make sure to have remapped TCD mosaic(0-31 as NoData, 31-101 as 1)
#remap loss 0 values to NoData. Keep all other values
#set indir to AOI (country or other AOI)
#create geodatabase for results
import os
import arcpy
from arcpy.sa import *
import datetime
import utilities
def emerging_hs_points(country_shapefile, d... | elizabethgoldman/emerging_hotspots | emerging_hotspot_factor.py | Python | apache-2.0 | 4,224 |
# 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/jax | tests/nn_test.py | Python | apache-2.0 | 10,349 |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import glob
import logging
import os
from pylib import android_commands
from pylib import constants
from pylib import perf_tests_helper
from pylib.andro... | plxaye/chromium | src/build/android/pylib/gtest/test_runner.py | Python | apache-2.0 | 15,830 |
# (c) Copyright 2018 ZTE 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 requ... | openstack/freezer-api | freezer_api/tests/unit/sqlalchemy/v2/test_action.py | Python | apache-2.0 | 19,604 |
# coding=utf-8
# Copyright 2018 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... | rsepassi/tensor2tensor | tensor2tensor/models/xception.py | Python | apache-2.0 | 5,805 |
# Copyright (C) 2021 FUJITSU
# 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 a... | stackforge/tacker | samples/mgmt_driver/kubernetes_mgmt.py | Python | apache-2.0 | 147,274 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import six.moves.configparser as ConfigParser
import datetime
import json
import re
import requests
import warnings
try:
import keyring
except ImportError:
keyring = None
import pyos
from pyos import exceptions as exc
from... | emonty/pyos | pyos/base_identity.py | Python | apache-2.0 | 40,621 |
from setuptools import setup
setup(
name="example",
version="0.1",
py_modules=["readdir"],
setup_requires=["cffi>=1.0.dev0"],
cffi_modules=["readdir_build.py:ffi"],
install_requires=["cffi>=1.0.dev0"],
zip_safe=False,
)
| hipnusleo/laserjet | resource/pypi/cffi-1.9.1/demo/readdir_setup.py | Python | apache-2.0 | 260 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-28 22:08
from __future__ import unicode_literals
from django.db import migrations, models
from django.template.defaultfilters import truncatechars, slugify
def gen_slug(apps, schema_editor):
Astronauts = apps.get_model('api', 'Astronauts')
for ... | ItsCalebJones/SpaceLaunchNow-Server | api/migrations/00010_astronauts_populate_slug.py | Python | apache-2.0 | 732 |
import os
import sys
import mock
import logging
import unittest
from inaugurator.server import idlistener
from inaugurator.tests.common import PikaChannelMock
class Test(unittest.TestCase):
def setUp(self):
self.consumeCallback = mock.Mock()
self.channel = PikaChannelMock(self)
self.expect... | Stratoscale/inaugurator | inaugurator/tests/test_idlistener.py | Python | apache-2.0 | 5,274 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import string
import random
import book.database as db
from scrapy import Spider
from book.items import Comment
class CommentSpider(Spider):
name = 'comment'
allowed_domains = ['book.douban.com']
books = db.conn.query('SELECT douban_id FROM books WHERE douba... | snakecon/AI_Lab | spider/book/book/spiders/comment.py | Python | apache-2.0 | 3,658 |
# Copyright 2017 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 law or agreed to in writing, ... | m3drano/power-simulation | simulation/histogram.py | Python | apache-2.0 | 9,086 |
# coding=utf-8
# Copyright 2018 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/policy-learning-landscape | eager_pg/trajectory_batch_stats_test.py | Python | apache-2.0 | 5,906 |
"""
Parsers for file ``/sys/kernel/debug/x86/*_enabled`` outputs
============================================================
This module provides the following parsers:
X86PTIEnabled - file ``/sys/kernel/debug/x86/pti_enabled``
----------------------------------------------------------
X86IBPBEnabled - file ``/sys/... | RedHatInsights/insights-core | insights/parsers/x86_debug.py | Python | apache-2.0 | 3,411 |
from glob import glob
import shutil
import nox
REPO_TOOLS_REQ = \
'git+https://github.com/GoogleCloudPlatform/python-repo-tools.git'
DIRS = [
# Hello world doesn't have system tests, just a lint test which will be
# covered by the global lint here.
# '1-hello-world',
'2-structured-data',
'3-b... | wilcoant/bookshelf | nox.py | Python | apache-2.0 | 1,629 |
#!/usr/bin/env python
import time
import roslib;
import rospy
import actionlib
from control_msgs.msg import *
from std_msgs.msg import Float64
JOINT_NAME = ['PhantomXPincher_gripperClose_joint']
client = None
def move1():
g = GripperCommandGoal()
g.command = GripperCommand()
g.command.position = 0.15
... | EricssonResearch/scott-eu | simulation-ros/src/phantomx_pincher_arm/phantomx_pincher_arm_vrep_controller/action/test_move_gripper.py | Python | apache-2.0 | 959 |
from proxypool.dbop import RedisOperator
import unittest
class RedisOperatorTestCase(unittest.TestCase):
def setUp(self):
self.opor = RedisOperator()
def tearDown(self):
self.opor._flush()
def test_puts_and_pop(self):
self.opor.puts('1')
assert self.opor.pop() == '1'
... | WiseDoge/ProxyPool | tests/test_dbop.py | Python | apache-2.0 | 747 |
# -*- coding: utf-8 -*-
import os
import Image, StringIO
import allura
from nose.tools import assert_true
from ming.orm.ormsession import ThreadLocalORMSession
from allura import model as M
from allura.lib import helpers as h
from allura.tests import decorators as td
from alluratest.controller import TestController
... | leotrubach/sourceforge-allura | ForgeWiki/forgewiki/tests/functional/test_root.py | Python | apache-2.0 | 20,377 |
class Errors(Exception):
__status_code = 400
__error_cat = "General Error"
__default_message = "System Error Occurred"
def __init__(self, message=None, status_code=None, payload=None):
Exception.__init__(self)
self.category = self.__error_cat
self.message = message or self.__d... | marcstreeter/ChatterBlog | app/shared/error.py | Python | apache-2.0 | 1,203 |
from itertools import repeat
def getScores(numPlayers, dieRolls):
dieRolls = list(dieRolls)
scores = list(repeat(0, numPlayers))
print(scores)
c = 0
last = -1
num = 0
for i in dieRolls:
v = dieRolls[i]
if not (v == last and num > 0):
if v <= 2:
scores[c] += 1
elif v <= 4:
scores[c] += 2
els... | Blimeo/Java | out/production/matthew/Contests/TopCoder/SRM007/Dice.py | Python | apache-2.0 | 637 |
# Copyright 2014 Cognitect. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | dand-oss/transit-python | tests/seattle_benchmark.py | Python | apache-2.0 | 1,590 |
import unittest
import lightgbm as lgb
import pandas as pd
from common import gpu_test
class TestLightgbm(unittest.TestCase):
# Based on the "simple_example" from their documentation:
# https://github.com/Microsoft/LightGBM/blob/master/examples/python-guide/simple_example.py
def test_cpu(self):
l... | Kaggle/docker-python | tests/test_lightgbm.py | Python | apache-2.0 | 2,382 |
# 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: david@reciprocitylabs.com
# Maintained By: david@reciprocitylabs.com
from ggrc import db
from ggrc.login import get_current_user
from ggrc.models i... | prasannav7/ggrc-core | src/ggrc/fulltext/mysql.py | Python | apache-2.0 | 16,137 |
from django.contrib.auth.models import Group
from django.contrib.auth.signals import user_logged_in
def setup_user(sender, request, user, **kwargs):
"""
Make sure all users are in a common group and can log into the admin.
This makes setting up permissions in the crud admin easier.
"""
if not use... | texastribune/ox-scale | ox_scale/apps/scale/signals.py | Python | apache-2.0 | 538 |
#!/usr/bin/env python3
# Developer virtualenv setup for Certbot client
"""Aids in creating a developer virtual environment for Certbot.
When this module is run as a script, it takes the arguments that should
be passed to pip to install the Certbot packages as command line
arguments. If no arguments are provided, all C... | letsencrypt/letsencrypt | tools/venv.py | Python | apache-2.0 | 8,641 |
# Copyright 2015 Mirantis, 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 or ... | torgartor21/solar | solar/solar/test/test_orm.py | Python | apache-2.0 | 15,583 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Test.modify_at'
db.delete_column(u'itest_test', 'modify... | xuender/test | testAdmin/itest/migrations/0002_auto__del_field_test_modify_at__del_field_test_create_by__del_field_te.py | Python | apache-2.0 | 2,475 |
import datetime
import re
import time
import urllib
from typing import Any, Dict, List, Optional, Sequence
from unittest.mock import MagicMock, patch
from urllib.parse import urlencode
import orjson
from django.conf import settings
from django.contrib.auth.views import PasswordResetConfirmView
from django.contrib.cont... | punchagan/zulip | zerver/tests/test_signup.py | Python | apache-2.0 | 225,136 |
# 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 ... | nikolay-fedotov/tempest | tempest/api/compute/admin/test_fixed_ips_negative.py | Python | apache-2.0 | 3,516 |
# Copyright 2013 IBM Corp.
import unittest
import mox
from powervc.nova.driver.virt.powervc.sync import flavorsync
import powervc.common.config as cfg
CONF = cfg.CONF
class TestFlavorSync(unittest.TestCase):
def setUp(self):
"""
The method "setUp" is used to initialize the fake environment
... | openstack/powervc-driver | nova-powervc/test/nova/driver/virt/powervc/sync/testflavorsync.py | Python | apache-2.0 | 2,188 |
#!/usr/bin/env python3
import glob
import os
import re
import subprocess
import pytest
@pytest.fixture(autouse=True, scope="module")
def install_certbot_snap(request):
with pytest.raises(Exception):
subprocess.check_call(['certbot', '--version'])
try:
snap_folder = request.config.getoption("s... | stweil/letsencrypt | certbot-ci/snap_integration_tests/dns_tests/test_main.py | Python | apache-2.0 | 1,935 |
from . import Renderer
from PIL import Image, ImageFont, ImageQt, ImageDraw
from PyQt5 import QtGui
'''
Renders a single line of text at a given position.
'''
class TextRenderer(Renderer):
MSFACTOR = 8
def __init__(self, gl, text, pos, size = 64):
super().__init__(gl)
self.text = te... | eeucalyptus/eeDA | app/graphics/textrenderer.py | Python | apache-2.0 | 3,090 |
from ftracer_script import *
## note the capture details file is
## warnings is needed to suppress errors from mousehook tracker
## Function: This is the main script file which houses all the scripts
import sys
import pythoncom, pyHook
import win32con, win32com.client
import win32gui, win32api
import codecs
imp... | mirageglobe/upp-tracker | tracer/ftraceadvance.py | Python | apache-2.0 | 6,390 |
import sys
import csv
import pickle
import numpy as np
from sklearn import svm
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
from sklearn.preprocessing import StandardScaler
training_data = []
training_classes = []
test_data = []
test_classes = []
path = '../../data/'
filename = pa... | PMantovani/road-irregularity-detector | classification_algorithm/src/svm_training.py | Python | apache-2.0 | 4,872 |
from hortee.settings import *
| bne/hortee | hortee/production.py | Python | apache-2.0 | 31 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Tests the remote shell
:author: Thomas Calmant
"""
# Pelix
from pelix.framework import FrameworkFactory, create_framework
from pelix.utilities import to_str, to_bytes
from pelix.ipopo.constants import use_ipopo
# Shell constants
from pelix.shell import SERVIC... | isandlaTech/cohorte-3rdparty | pelix/src/test/python/tests/shell/test_remote.py | Python | apache-2.0 | 10,690 |
# Copyright 2017 Starbot Discord 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 applica... | dhinakg/BitSTAR | plugins/srcutils.py | Python | apache-2.0 | 1,479 |
import math
import models
import tensorflow as tf
import numpy as np
import utils
from tensorflow import flags
import tensorflow.contrib.slim as slim
FLAGS = flags.FLAGS
class DistillchainLstmCnnDeepCombineChainModel(models.BaseModel):
"""A softmax over a mixture of logistic models (with L2 regularization)."""
de... | wangheda/youtube-8m | youtube-8m-wangheda/all_frame_models/distillchain_lstm_cnn_deep_combine_chain_model.py | Python | apache-2.0 | 7,770 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.