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 |
|---|---|---|---|---|---|
###########################################################################
#
# 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/l... | google/starthinker | examples/dynamic_costs_example.py | Python | apache-2.0 | 4,668 |
#!/usr/bin/env python
from __future__ import print_function
from flask import Blueprint, Flask, jsonify, json, abort, request, g
from os_reststack_manager.app import credentials, db, Tenant, logging
from lib.setup_tenant import tenant_create, extract_keys
from lib.erase_tenant import tenant_delete
import re
import j... | gemagomez/os-reststack-manager | os_reststack_manager/app/tenant_manager.py | Python | apache-2.0 | 2,958 |
"""
Clever Authentication
"""
import base64
import urllib.parse
import httplib2
from django.conf import settings
from oauth2client.client import OAuth2WebServerFlow, OAuth2Credentials
from helios_auth import utils
# some parameters to indicate that status updating is not possible
STATUS_UPDATES = False
# display ... | benadida/helios-server | helios_auth/auth_systems/clever.py | Python | apache-2.0 | 4,586 |
'''
<TBTAF>
<TestID>2021</TestID>
<Tags>TBTAF,Discoverer,Textbook</Tags>
</TBTAF>
'''
'''
Created on 06/11/2015
@author: Nander
'''
from common.test import TBTestCase
from common.result import TBTAFResult
from common.trace import TBTAFTrace
from common.event import TBTAFEvent
from common.enums.verdict_type import TBTA... | S41nz/TBTAF | tbtaf/test/orchestrator/samples/testOnlyTheRequired.py | Python | apache-2.0 | 1,271 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/falken | service/generated_flatbuffers/tflite/SpaceToDepthOptions.py | Python | apache-2.0 | 2,795 |
from django import forms
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect, Http404
from shop import models as pmod
from . import templater
from django.conf import settings
import decimal, datetime
def process_request(request):
if not request.user.is_authenticate... | odrolliv13/Hex-Photos | shop/views/store_details.py | Python | apache-2.0 | 2,324 |
#coding: utf-8
from django import forms
class PreForm(forms.Form):
user_mail = forms.EmailField(
label = "メール",
required = True,
)
user_mail.widget.attrs.update({'placeholder': 'e-mail'}) | pistatium/houkago_app | server_appengine/app/forms/preform.py | Python | apache-2.0 | 230 |
import sys
from xml.etree import ElementTree
from xml.etree.ElementTree import Element, SubElement
from xml.dom import minidom
from lxml import etree
class PascalVocWriter:
def __init__(self, foldername, filename, imgSize, databaseSrc='Unknown', localImgPath=None):
self.foldername = foldername
self... | huangshiyu13/funnyLittleProgram | WhatKindofGirlYouLIke/labelImg/libs/pascal_voc_io.py | Python | apache-2.0 | 4,750 |
input ('Анук Эме - это псевдоним актрисы Франсуазы Юдит Сорья Дрейфус')
| Mariaanisimova/pythonintask | ISTp/2014/VOLKO_S_D/task-1-46.py | Python | apache-2.0 | 123 |
#! /usr/bin/python
import requests, pprint, json
from collections import defaultdict
class GuardianStats:
# Bungie API KEY
api_key = '1b6d2823d9ba455db6d22c0c75ae55a2'
def __init__(self, psn_id):
self.membership_id = self.GetMembershipID(psn_id)
self.character_id = self.GetLatestUsedGuardian(self.membe... | elnoxgdl/destinystats | GuardianStats.py | Python | apache-2.0 | 5,360 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack, LLC
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this s3 except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/li... | rcbops/glance-buildpackage | glance/tests/unit/test_s3_store.py | Python | apache-2.0 | 11,404 |
#!/usr/bin/env python3
import json
import os
import sys
import anchore_engine.analyzers.utils
analyzer_name = "file_package_verify"
try:
config = anchore_engine.analyzers.utils.init_analyzer_cmdline(
sys.argv, analyzer_name
)
except Exception as err:
print(str(err))
sys.exit(1)
imgname = con... | anchore/anchore-engine | anchore_engine/analyzers/modules/31_file_package_verify.py | Python | apache-2.0 | 2,520 |
import string
t = string.Template('$var')
print(t.pattern.pattern)
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_text/string_template_defaultpattern.py | Python | apache-2.0 | 69 |
## 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... | cognitect/transit-python | transit/read_handlers.py | Python | apache-2.0 | 3,818 |
import unittest
import docker
from .. import helpers
from .base import TEST_API_VERSION
class ServiceTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
client = docker.from_env(version=TEST_API_VERSION)
helpers.force_leave_swarm(client)
client.swarm.init('127.0.0.1', listen_a... | vpetersson/docker-py | tests/integration/models_services_test.py | Python | apache-2.0 | 7,604 |
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import object
from cgi import escape
from io import BytesIO as IO
import functools
import gzip
import dateutil.parser as dateparser
import json
import os
from flask import after_this_request, request, Response
... | griffinqiu/airflow | airflow/www/utils.py | Python | apache-2.0 | 6,553 |
#
# Copyright (c) 2017-Present Pivotal Software, 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 req... | pivotal-partner-solution-architecture/pcf-gcp-python | pcfgcp/pcfgcp.py | Python | apache-2.0 | 5,039 |
from O365.message import Message
import logging
import json
import requests
log = logging.getLogger(__name__)
class Inbox( object ):
'''
Wrapper class for an inbox which mostly holds a list of messages.
Methods:
getMessages -- downloads messages to local memory.
Variables:
inbox_url -- url used for fetc... | roycem90/python-o365 | O365/inbox.py | Python | apache-2.0 | 2,984 |
import re
def fun(s):
# return True if s is a valid email, else return False
f = "^[a-zA-Z][\w-]*@[a-zA-Z0-9]+\.[a-zA-Z]{1,3}$"
if not re.match(f, s):
return False
username, after = re.split(r'[@]', s)
websitename, extension = re.split(r'[.]', after)
if(len(extension) > 3):
ret... | kakaba2009/MachineLearning | python/src/algorithm/coding/regex/email.py | Python | apache-2.0 | 614 |
#!/usr/bin/python3
#
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | karkhaz/tuscan | toolchains/install_bootstrap/android/setup.py | Python | apache-2.0 | 2,742 |
def solve(N, R, P, S):
if max([R, P, S]) > 2**(N-1): return "IMPOSSIBLE"
if N > 2 and max([R, P, S]) == 2**(N-1): return "IMPOSSIBLE"
min_val = min([R, P, S])
rep = 2**N//3
if min_val < rep: return "IMPOSSIBLE"
if N == 1:
tmp = ""
if P: tmp += "P"
if R: tmp += "R"
... | zuun77/givemegoogletshirts | codejam/2016/Round2/q1.py | Python | apache-2.0 | 877 |
#!/usr/bin/env python3
# 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
# "L... | wooga/airflow | backport_packages/import_all_provider_classes.py | Python | apache-2.0 | 4,232 |
import time
import RPi.GPIO as GPIO
# use Broadcom pin numbers
GPIO.setmode(GPIO.BCM)
SERVO_PIN = 3
GPIO.setup(SERVO_PIN, GPIO.OUT)
# setup PWM
pwm = GPIO.PWM(SERVO_PIN, 100)
pwm.start(5)
for i in range(5, 25):
pwm.ChangeDutyCycle(i)
time.sleep(0.5)
pwm.stop()
GPIO.cleanup()
| lukaszo/rpitips-examples | RPi.GPIO/servo.py | Python | apache-2.0 | 288 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ar'
import time
import shutil
import os
import matplotlib.pyplot as plt
import skimage.io as skio
import numpy as np
import keras
from keras.utils import np_utils
from keras.utils.vis_utils import plot_model
def readDataMasked(pidx):
with open(pidx, 'r') as... | gakarak/FCN_MSCOCO_Food_Segmentation | MSCOCO_Processing/ext_code/run04_model_inference.py | Python | apache-2.0 | 2,889 |
from django.shortcuts import render_to_response
from django.template import RequestContext
from webinars_web.webinars.views import syncs
def show(request, sync_id):
from webinars_web.webinars import models as wm
return syncs._show(request, 'hub', wm.HubSync.objects.select_related('hub').get(pk=sync_id))
def n... | prior/webinars | webinars_web/webinars/views/hub_syncs.py | Python | apache-2.0 | 1,234 |
# 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 the Li... | thenetcircle/dino | test/api/test_api_ban.py | Python | apache-2.0 | 2,148 |
#!/usr/bin/env python
# Copyright (c) 2016 Orange 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 accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# pylint: d... | mywulin/functest | functest/tests/unit/cli/test_cli_base.py | Python | apache-2.0 | 3,933 |
#!/usr/bin/env python
import sys
import socket
import ssl
import os
import select
import json
import logging
import asyncore
import threading
import six
from six.moves import _thread
from six.moves import queue
from contextlib import contextmanager
from const import *
class AsyncDataStoreCmd(asyncore.dispatcher):
... | lagopus/lagopus | test/datastore/long_run/lib/async_datastore_cmd.py | Python | apache-2.0 | 3,080 |
import os
import sys
import unittest
from pprint import pprint
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + '/../')
from google_api_clients.bigquery import BigQuery
from google_api_clients.bigquery.errors import ParameterError
class BigQueryTest(unittest.TestCase):
def setUp(self):
se... | shojikai/python-google-api-clients | test/test_bigquery_dataset.py | Python | apache-2.0 | 3,541 |
# -*- coding: utf-8 -*-
# Copyright 2020 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... | googleads/google-ads-python | google/ads/googleads/v9/resources/types/ad_group_criterion.py | Python | apache-2.0 | 22,226 |
# coding=utf-8
# 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 required by app... | AlexEKoren/grumpy | compiler/block_test.py | Python | apache-2.0 | 10,530 |
import time
from datetime import datetime
from logging import getLogger
# from django.contrib.auth.models import User, Group
from rest_framework.views import APIView
from employee.api.models import Employee, Login
# from employee.api.serializers import UserSerializer, GroupSerializer
from employee.api.serializers imp... | naokiur/circle-ci-demo | backend/employee/api/views.py | Python | apache-2.0 | 863 |
# -*- coding: utf-8 -*-
# Copyright 2010 Dirk Holtwick, holtwick.it
#
# 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 ... | bakaat/xhtml2pdf | xhtml2pdf/parser.py | Python | apache-2.0 | 25,104 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ar'
import matplotlib.pyplot as plt
import numpy as np
import os
import glob
import nibabel as nib
import app.core.preprocessing as preproc
import unittest
class TestLungDividing(unittest.TestCase):
def setUp(self):
self.wdir = '../../experimental_d... | gakarak/BTBDB_ImageAnalysisSubPortal | app/core/preprocessing_test.py | Python | apache-2.0 | 3,387 |
from .client import client
from .errors import JujuError
class CharmHub:
def __init__(self, model):
self.model = model
async def info(self, name, channel=None):
"""info displays detailed information about a CharmHub charm. The charm
can be specified by the exact name.
Channel... | juju/python-libjuju | juju/charmhub.py | Python | apache-2.0 | 1,584 |
from mayavi import mlab
from BDSpace.Coordinates import Cartesian
from BDSpace.Curve.Parametric import Line
import BDSpaceVis as Visual
coordinate_system = Cartesian()
fig = mlab.figure('CS demo', bgcolor=(0, 0, 0))
line = Line(name='Line', coordinate_system=coordinate_system, a=1, b=2, c=0, start=0, stop=1)
line_vis... | bond-anton/Space | demo/07_lines_demo.py | Python | apache-2.0 | 471 |
"""
factor.py
"""
from functools import wraps
from operator import attrgetter
from numbers import Number
from math import ceil
from numpy import empty_like, inf, nan, where
from scipy.stats import rankdata
from catalyst.errors import BadPercentileBounds, UnknownRankMethod
from catalyst.lib.normalize import naive_grou... | enigmampc/catalyst | catalyst/pipeline/factors/factor.py | Python | apache-2.0 | 58,406 |
__author__ = 'Zero'
from django.utils.translation import pgettext_lazy
STATUS_DISPLAY_CHOICES = (
("CREATE INSTANCE", pgettext_lazy("Action of an Instance", u"Create Instance")),
("DELETE INSTANCE", pgettext_lazy("Action of an Instance", u"Delete Instance")),
("UPDATE INSTANCE", pgettext_lazy("Action of an... | xuweiliang/Codelibrary | openstack_dashboard/dashboards/admin/systemlogs/trans.py | Python | apache-2.0 | 6,683 |
# Copyright 2017 Sergey Berezin
# 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, ... | sergey-a-berezin/acme-tiny-cron | acme_tiny_cron/protos/__init__.py | Python | apache-2.0 | 575 |
# 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... | failys/CAIRIS | cairis/core/TrustBoundary.py | Python | apache-2.0 | 1,461 |
# 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... | BeenzSyed/tempest | tempest/api/compute/security_groups/test_security_groups.py | Python | apache-2.0 | 8,626 |
# coding=utf-8
import requests
def download(url):
resp = requests.get(url) # TODO add retries
return resp.content, resp.headers
| ahmetalpbalkan/permalinker | application/downloader.py | Python | apache-2.0 | 140 |
import random
print "".join([random.choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for i in range(50)])
| lvbeck/niubi | lib/keygen.py | Python | apache-2.0 | 120 |
import collections
import re
import urllib2
url = 'http://shakespeare.mit.edu/hamlet/full.html'
#url = 'https://courseworks.columbia.edu/access/content/group/COMSW3101_002_2015_3/week3/hamlet.html'
req = urllib2.Request(url)
response = urllib2.urlopen(req)
page = response.read()
#lines = page.split('\n')
speech = re... | jackcht/pythonPractice | master/Homework3/hw3q3.py | Python | apache-2.0 | 573 |
#!/usr/bin/env python
#
# Copyright 2015 Airbus
# Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
#
# 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
#
# ... | ipa-led/airbus_coop | airbus_docgen/src/airbus_docgen/docgen/pkg/node/__init__.py | Python | apache-2.0 | 2,723 |
# Copyright 2018, OpenCensus 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 law or agreed to in w... | census-instrumentation/opencensus-python | contrib/opencensus-ext-threading/opencensus/ext/threading/trace.py | Python | apache-2.0 | 4,939 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from cobra.core.loading import is_model_registered
from .abstract_models import * # noqa
__all__ = []
if not is_model_registered('svnkit', 'Repository'):
class Repository(AbstractRepository):
pass
__all__.append('Repository')
if not ... | lyoniionly/django-cobra | src/cobra/apps/svnkit/models.py | Python | apache-2.0 | 962 |
import os
import pwd
import spwd
import grp
import subprocess
class Machine():
def __init__(self, dryrun=False, default_gid=2000, uid_range=[2000, 3000]):
self.dryrun = dryrun
self.default_gid = default_gid
self.uid_range = uid_range
def call(self, cmd):
if self.dryrun:
... | aipescience/daiquiri-admin | daiquiri/machine.py | Python | apache-2.0 | 4,577 |
# 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... | Xeralux/tensorflow | tensorflow/contrib/py2tf/utils/py_func.py | Python | apache-2.0 | 4,890 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | skuda/client-python | kubernetes/test/test_v1_subject_access_review_spec.py | Python | apache-2.0 | 943 |
# -*- coding: utf-8 -*-
# Copyright 2020 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-dialogflow | samples/generated_samples/dialogflow_generated_dialogflow_v2_session_entity_types_create_session_entity_type_async.py | Python | apache-2.0 | 1,957 |
# coding: utf-8
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 2.0.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class PrepaymentBonusResponse(object):
"""
NOTE: This cl... | kinow-io/kinow-python-sdk | kinow_client/models/prepayment_bonus_response.py | Python | apache-2.0 | 7,163 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
from setuptools import setup, find_packages
import codecs
import os
import re
import sys
def read(*parts):
path = os.path.join(os.path.dirname(__file__), *parts)
with codecs.open(path, e... | metocean/tugboat-py | setup.py | Python | apache-2.0 | 1,239 |
########
# 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... | fogelomer/cloudify-filebeat-plugin | setup.py | Python | apache-2.0 | 1,438 |
# Copyright 2010-2012 Institut Mines-Telecom
#
# 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 agre... | jordan-developer/pyCMBS | pyocni/backends/dummy_backend.py | Python | apache-2.0 | 2,079 |
from .. import parser, LegacyItemAccess, CommandParser
from insights.specs import Specs
@parser(Specs.sestatus)
class SEStatus(LegacyItemAccess, CommandParser):
"""Class to parse the ``sestatus -b`` command
Attributes:
data (dict): A dict likes
{
"loaded_policy_name": "targeted",
... | RedHatInsights/insights-core | insights/parsers/sestatus.py | Python | apache-2.0 | 2,984 |
from lib import broker
__author__ = 'ehonlia'
import pika
import logging
logging.basicConfig()
connection = pika.BlockingConnection(pika.ConnectionParameters(host=broker.HOST))
channel = connection.channel()
channel.exchange_declare(exchange=broker.STREAM_EXCHANGE, type=broker.EXCHANGE_TYPE)
message = '''
{
"_i... | EricssonResearch/iot-framework-engine | semantic-adapter/test_pubsub/test_publisher.py | Python | apache-2.0 | 1,498 |
# Generated by Django 3.1.4 on 2020-12-06 08:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0023_auto_20201202_0349'),
]
operations = [
migrations.AlterField(
model_name='review',
name='status',
... | stencila/hub | manager/projects/migrations/0024_auto_20201206_0819.py | Python | apache-2.0 | 746 |
# Copyright (c) 2015-2016 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | openstack/swift | test/unit/common/middleware/crypto/test_encryption.py | Python | apache-2.0 | 31,916 |
# -*- coding: utf-8 -*-
"""Tests for the Item model"""
import unittest
import sys
import os
from os.path import join, abspath, dirname
parentpath = abspath(join(dirname(__file__), '../../..'))
sys.path.append(parentpath)
from blibbapi.db import get_engine, init_db, get_db_session, Base
from blibbapi.models.blibb imp... | ipedrazas/blibb-project | blibbapi/tests/models/test_item.py | Python | apache-2.0 | 1,623 |
#!/usr/bin/env python
"""
As simviz1cpGUI.py, but the parameters have dimensions.
Only the import statement for SimViz differs from simviz1cpGUI.py.
"""
import sys, os, math
from scitools.ParameterInterface import Parameters, AutoSimVizGUI
from simviz1cp_unit import SimViz
class SimVizGUI(SimViz):
def __init__(... | sniemi/SamPy | sandbox/src1/TCSE3-3rd-examples/src/py/examples/simviz/simviz1cpGUI_unit.py | Python | bsd-2-clause | 1,881 |
import sys, getopt
sys.path.insert(0, '/home/tzeng/space/Caffe_3D_FF/trunk/python')
#sys.path.insert(0,'/home/tzeng/autoGenelable_multi_lables_proj/code/py-leveldb-read-only/build/lib.linux-x86_64-2.7')
import numpy as np
import hdf5storage
import leveldb
from leveldb import WriteBatch, LevelDB
import os
im... | Xiaomi2008/Caffe_3D_FF | tools/convert_mat2levelDB.py | Python | bsd-2-clause | 2,667 |
#!/usr/bin/env python
"""Test faster version of sematic similarity"""
from __future__ import print_function
# Computing basic semantic similarities between GO terms
# Adapted from book chapter written by _Alex Warwick Vesztrocy and Christophe Dessimoz_
# How to compute semantic similarity between GO terms.
# First... | tanghaibao/goatools | tests/test_semantic_faster.py | Python | bsd-2-clause | 3,361 |
"""
Django settings for laborzugang project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... | rsdk/labaccess | laborzugang/settings.py | Python | bsd-2-clause | 2,131 |
# -*- Mode: Python -*-
import socket
import unittest
__version__ = '0.1.1'
from .cys2n import *
protocol_version_map = {
'SSLv2' : 20,
'SSLv3' : 30,
'TLS10' : 31,
'TLS11' : 32,
'TLS12' : 33,
}
class PROTOCOL:
reverse_map = {}
for name, val in protocol_version_map.items():
setattr (PROT... | samrushing/cys2n | cys2n/__init__.py | Python | bsd-2-clause | 2,452 |
# -*- coding: UTF-8 -*-
# Copyright 2009-2013 Luc Saffre
# License: BSD (see file COPYING for details)
#import time
#from datetime import date
#from dateutil import parser as dateparser
#from lino.projects.finan import models as finan
#~ import decimal
from decimal import Decimal
from django.conf import settings
fro... | khchine5/xl | lino_xl/lib/finan/fixtures/unused_demo.py | Python | bsd-2-clause | 2,045 |
#! /usr/bin/env python
"""Script to find missing GLUT entry points"""
from OpenGL import GLUT
import subprocess, re
func_finder = re.compile( 'FGAPIENTRY (\w+)\(' )
constant_finder = re.compile( '#define\W+([0-9a-zA-Z_]+)\W+((0x)?\d+)' )
INCLUDE_DIR = '/usr/include/GL'
def defined( ):
"""Grep FGAPIENTRY headers ... | frederica07/Dragon_Programming_Process | PyOpenGL-3.0.2/src/missingglut.py | Python | bsd-2-clause | 1,579 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.rst') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='judge_offline',
version='0.1.0',
description='Provides personal judge similar hackrank or judge online',
long_descri... | yanndavin/judge_offline | setup.py | Python | bsd-2-clause | 532 |
__all__ = [
"getMin"
]
__doc__ = "Different algorithms used for optimization"
import Optizelle.Unconstrained.State
import Optizelle.Unconstrained.Functions
from Optizelle.Utility import *
from Optizelle.Properties import *
from Optizelle.Functions import *
def getMin(X, msg, fns, state, smanip=None):
"""Solv... | OptimoJoe/Optizelle | src/python/Optizelle/Unconstrained/Algorithms.py | Python | bsd-2-clause | 863 |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
#with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-... | jupyter/jupyter-drive | setup.py | Python | bsd-2-clause | 2,752 |
from ..errors import InvalidEnumValue
from ..folders.base import BaseFolder
from ..items import ID_ONLY, ITEM_TRAVERSAL_CHOICES, SHAPE_CHOICES, Item
from ..util import MNS, TNS, create_element, set_xml_value
from .common import EWSPagingService, folder_ids_element, shape_element
class FindItem(EWSPagingService):
... | ecederstrand/exchangelib | exchangelib/services/find_item.py | Python | bsd-2-clause | 4,353 |
from django.conf import settings
from django.http import HttpResponseRedirect
from django.shortcuts import render, redirect
from django.contrib.auth.views import logout_then_login, LoginView
from django.contrib.auth import authenticate, login
from django.contrib.flatpages.models import FlatPage
from django.views.decora... | chop-dbhi/biorepo-portal | accounts/views.py | Python | bsd-2-clause | 4,178 |
import datetime
from django.core.urlresolvers import reverse
from django.utils import timezone
from djanalytics import models
from djanalytics.tests.base_chart_test import BaseChartTest
class TestExitPage(BaseChartTest):
def test_exit_page(self):
for i in range(3):
first_page = models.Reques... | analytehealth/django-analytics | djanalytics/tests/test_exit_page.py | Python | bsd-2-clause | 2,477 |
'''
SAPI 5+ driver.
Copyright (c) 2009 Peter Parente
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS... | thisismyrobot/gedit-pytts | src/pyttsx/drivers/sapi5.py | Python | bsd-2-clause | 5,041 |
"""
Measure one resonator per LO frequency. Since each measurement has only one channel, record SingleSweepStreams.
"""
import time
import logging
import numpy as np
from kid_readout.utils import log
from kid_readout.roach import hardware_tools, analog
from kid_readout.measurement import acquire, basic
from kid_reado... | ColumbiaCMB/kid_readout | apps/data_taking_scripts/cooldown/2016-06-09_hpd/sweepstream_r1_on_off.py | Python | bsd-2-clause | 5,195 |
# coding: utf-8
"""
Standalone file utils.
Nothing in this module should have an knowledge of config or the layout
and structure of the site and pages in the site.
"""
from __future__ import unicode_literals
import logging
import markdown
import os
import pkg_resources
import shutil
import sys
import yaml
import fn... | williamjmorenor/mkdocs | mkdocs/utils/__init__.py | Python | bsd-2-clause | 13,602 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
from django.db import migrations
# data :: [{name :: String, meanings :: [{id :: Int, name :: String}]}]
data = [
{'name': 'Stable50',
'meanings': [
{'id': '13', 'name': 'bite'},
{'id': '14', 'name'... | lingdb/CoBL-public | ielex/lexicon/migrations/0014_meaningLists.py | Python | bsd-2-clause | 15,673 |
from fabric.context_managers import settings
from golive.layers.base import BaseTask, DebianPackageMixin, IPTablesSetup
from golive.stacks.stack import environment
from golive.utils import get_remote_envvar
class RabbitMqSetup(BaseTask, DebianPackageMixin):
package_name = "rabbitmq-server"
GUEST_USER = "guest... | fatrix/django-golive | golive/layers/queue.py | Python | bsd-2-clause | 2,683 |
from biokit.rtools import tools
import pytest
import os
skiptravis = pytest.mark.skipif( "TRAVIS_PYTHON_VERSION" in os.environ,
reason="On travis")
@skiptravis
def test_codecs():
assert 'T' == tools.bool2R(True)
assert 'F' == tools.bool2R(False)
try:
tools.bool2R('ggg')
assert Fals... | biokit/biokit | test/rtools/test_tools.py | Python | bsd-2-clause | 434 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
class Options:
def __init__(self):
self.color = "black"
self.verbose = False
pass
| LaurentCabaret/pyVhdl2Sch | tools/tools.py | Python | bsd-2-clause | 177 |
import pytest
import pyqos.backend.tc
from pyqos.backend import tc
NETIF = "eth0"
@pytest.fixture
def fixture_disable_commands(monkeypatch, mocker):
monkeypatch.setattr("pyqos.backend.tc.launch_command", mocker.stub())
launch_cmd_spy = pyqos.backend.tc.launch_command
return launch_cmd_spy
def test_... | Anthony25/python_tc_qos | pyqos/tests/backend/test_tc.py | Python | bsd-2-clause | 6,670 |
import nltk
import os
from random import shuffle
from nltk.classify.scikitlearn import SklearnClassifier
from sklearn.naive_bayes import MultinomialNB, BernoulliNB
from sklearn.linear_model import LogisticRegression, SGDClassifier
from sklearn.svm import SVC, LinearSVC, NuSVC
from datetime import datetime
from nltk imp... | jessefeinman/FintechHackathon | python-getting-started/nlp/classificationTools.py | Python | bsd-2-clause | 2,927 |
from JumpScale import j
descr = """
Fetches the public keys from the vscalers_sysadmin repo and puts them in authorized_keys
use '-e system ' to only use the system key (e.g. in production env on a mgmt node)
"""
organization = "vscalers"
author = "tim@incubaid.com"
license = "bsd"
version = "1.0"
category = "ssh.... | Jumpscale/jumpscale6_core | apps/admin/jumpscripts/varia/upload_root_keys.py | Python | bsd-2-clause | 1,949 |
# -*- encoding: utf-8 -*-
__author__ = 'pp'
__date__ = '6/25/14'
"""
georest.view.utils
~~~~~~~~~~~~~~~~~
helper/mixin things for views
"""
import sys
from functools import wraps
from flask import request
from .exceptions import InvalidRequest
from ..geo import GeoException
def get_json_content():
... | Kotaimen/georest | georest/view/utils.py | Python | bsd-2-clause | 1,423 |
#!/usr/bin/env python
"""
You can precisely specify dashes with an on/off ink rect sequence in
points.
"""
from pylab import *
dashes = [5,2,10,5] # 5 points on, 2 off, 3 on, 1 off
l, = plot(arange(20), '--')
l.set_dashes(dashes)
savefig('dash_control')
show()
| sniemi/SamPy | sandbox/src1/examples/dash_control.py | Python | bsd-2-clause | 264 |
"""
A pretty-printing dump function for the ast module. The code was copied from
the ast.dump function and modified slightly to pretty-print.
Alex Leone (acleone ~AT~ gmail.com), 2010-01-30
"""
from ast import *
def dump(node, annotate_fields=True, include_attributes=False, indent=' '):
"""
Return a format... | Suor/flaws | astpp.py | Python | bsd-2-clause | 2,283 |
# -*- coding: utf-8 -*-
# Copyright 2013 django-htmlmin 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 re
import six
import bs4
try:
from django.conf import settings
except:
settings = {}
from .util import force_tex... | cobrateam/django-htmlmin | htmlmin/minify.py | Python | bsd-2-clause | 7,270 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from pyxform_test_case import PyxformTestCase
class DoubleColonTranslations(PyxformTestCase):
def test_langs(self):
self.assertPyxformXform(
name='translations',
id_string='transl',
md="""
| survey | | | ... | dorey/pyxform | pyxform/tests_v1/test_translations.py | Python | bsd-2-clause | 1,244 |
"""Test simple functions (i.e. no pointers involved)"""
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import time
start = time.time()
window = None
def drawText( value, x,y, windowHeight, windowWidth, step = 18 ):
"""Draw the given text at given 2D position in window
"""
glMa... | frederica07/Dragon_Programming_Process | PyOpenGL-3.0.2/tests/test_glutwindow.py | Python | bsd-2-clause | 3,343 |
import json
from urllib2 import urlopen, HTTPError
from urllib import urlencode
import logging
class HTTPClient(object):
def __init__(self, host='localhost', port=90):
self.host = host
self.port = port
def get_serv_addr (self):
return 'http://%s:%s/' % ( self.host, self.port, )
... | procool/mygw | globals/utils/server/http_client.py | Python | bsd-2-clause | 1,122 |
from django.core import serializers
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS
from sitetree.utils import get_tree_model, get_tree_item_model
from sitetree.compat import CommandOption, options_getter
MODEL_TREE_CLASS = get_tree_model()
MODEL_TREE_ITEM_CLA... | idlesign/django-sitetree | sitetree/management/commands/sitetreedump.py | Python | bsd-3-clause | 2,050 |
#!/usr/bin/env python
# Copyright (c) 2015, Robot Control and Pattern Recognition Group,
# Institute of Control and Computation Engineering
# Warsaw University of Technology
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the ... | dseredyn/velma_scripts | scripts/test_hierarchy_control.py | Python | bsd-3-clause | 18,738 |
"""CloseSpider is an extension that forces spiders to be closed after certain
conditions are met.
See documentation in docs/topics/extensions.rst
"""
from collections import defaultdict
from twisted.internet import reactor
from scrapy import signals
from scrapy.exceptions import NotConfigured
class CloseSpider(ob... | eLRuLL/scrapy | scrapy/extensions/closespider.py | Python | bsd-3-clause | 2,631 |
from setuptools import setup ; setup()
| karpierz/libpcap | setup.py | Python | bsd-3-clause | 39 |
# Tai Sakuma <tai.sakuma@gmail.com>
import pandas as pd
from .ToTupleListWithDatasetColumn import ToTupleListWithDatasetColumn
##__________________________________________________________________||
class ToDataFrameWithDatasetColumn:
def __init__(self, summaryColumnNames,
datasetColumnName = 'co... | alphatwirl/alphatwirl | alphatwirl/collector/ToDataFrameWithDatasetColumn.py | Python | bsd-3-clause | 1,326 |
# Copyright (c) 2016, Kate Fox
# All rights reserved.
#
# This file is covered by the 3-clause BSD license.
# See the LICENSE file in this program's distribution for details.
"""Game Library for DOOM II: Hell on Earth (doom2.exe, or close to it, maybe)"""
game_shortname = "doom2"
game_title = "DOOM II: Hell on Earth"... | Pink-Silver/PyDoom | resourcezip/scripts/doom2/__init__.py | Python | bsd-3-clause | 410 |
# Generated by Django 3.1.7 on 2021-09-27 16:10
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('product', '0016_product_company'),
]
operations = [
migrations.RemoveField(
model_name='product',
name='companies',
... | KlubJagiellonski/pola-backend | pola/product/migrations/0017_remove_product_companies.py | Python | bsd-3-clause | 329 |
#pylint: disable=I0011,W0613,W0201,W0212,E1101,E1103
from ....core import Hub
from ....core.data_collection import DataCollection
from ..histogram_widget import HistogramWidget
from ..scatter_widget import ScatterWidget
from ..image_widget import ImageWidget
import pytest
from mock import MagicMock
ALL_WIDGETS = [Hi... | glue-viz/glue-qt | glue/qt/widgets/tests/test_data_viewer.py | Python | bsd-3-clause | 735 |
from django.conf import settings
from rest_framework.settings import import_from_string
from .mixins import FileContentMixin, DocStringContentMixin, MarkupProcessMixin, NoProcessMixin, SafeProcessMixin
APIDOC_DEFAULT_DOCUMENTER_CLASSES = getattr(
settings,
'APIDOC_DEFAULT_DOCUMENTER_CLASSES',
['rest_fra... | jespino/django-rest-framework-apidoc | rest_framework_apidoc/apidoc.py | Python | bsd-3-clause | 2,342 |
# -*- coding: utf-8 -*-
"""
logbook.notifiers
~~~~~~~~~~~~~~~~~
System notify handlers for OSX and Linux.
:copyright: (c) 2010 by Armin Ronacher, Christopher Grebs.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
import base64
from time import time
from logbook.base import N... | pombredanne/logbook | logbook/notifiers.py | Python | bsd-3-clause | 11,853 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.