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 |
|---|---|---|---|---|---|
# Xlib.__init__ -- glue for Xlib package
#
# Copyright (C) 2000-2002 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library 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 version 2.1
# of th... | python-xlib/python-xlib | Xlib/__init__.py | Python | lgpl-2.1 | 1,184 |
from scrapy.spiders import Spider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request
from scrapy.conf import settings
from beerindex.items import BeerindexItem
import logging
import lxml.html
from urlparse import urlparse
import re
class BeerSpider(Spider):
name = "beerspider"
beer_... | asiviero/brbeerindex | beerindex/spiders/beerspider.py | Python | lgpl-2.1 | 4,667 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import define
import tw8836
import spi
def quad_check():
status = spi.status1_read()
if (status & 0x40):
print 'SPI flash is already in QUAD mode'
return define.TRUE
else:
print 'SPI flash is not in QUAD mode yet'
return def... | lgnq/RPI8836 | issi.py | Python | lgpl-3.0 | 2,227 |
from .ao_integrals import AOIntegrals, ao2mo
from .mo_integrals import FCIDUMP
from .mo_integrals import load as load_fcidump
from .fcidump_generator import generate_fcidump
| orbkit/orbkit | orbkit/libcint_interface/__init__.py | Python | lgpl-3.0 | 174 |
import time
import requests
from collectors.lib import utils
from collectors.lib.collectorbase import CollectorBase
# reference by https://hadoop.apache.org/docs/r2.7.2/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapredAppMasterRest.html
REST_API = {"YARN_APPS_PATH": "ws/v1/cluster/apps",
"MAPREDU... | wangy1931/tcollector | collectors/builtin/map_reduce.py | Python | lgpl-3.0 | 11,834 |
#------------------------------------------------------------------------------
# clob_string.py (Section 7.2)
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Copyright (c) 2017, 2018, Oracle and/or its af... | cmsdaq/hltd | lib/cx_Oracle-7.1/samples/tutorial/clob_string.py | Python | lgpl-3.0 | 1,342 |
from osp.conf.settings import *
# Unique key used for salting passwords
SECRET_KEY = 'Chac-8#haCa_Ra-e?-e+ucrur=gEFRasejayasaC?meMe!AC-a'
# DEBUG should be False in production, True in development
DEBUG = False
# List of administrators who should receive error reports
ADMINS = (
('John Smith', 'john.smith@exampl... | marklocklear/Online-Student-Profile | deploy/osp_settings.py | Python | lgpl-3.0 | 5,374 |
"""This is the Cloud Signature Bot based on Time4Mind and Telegram
It allow to sign documents using a Telegram chat and a Time4Mind account
"""
import sys
import os
import yaml
import logging
import time
import datetime
import uuid
import urllib.request
import shutil
import re
import magic
import json
from threading... | cisba/cloudsignaturebot | cloudsignaturebot.py | Python | lgpl-3.0 | 20,001 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
from PyQt4.uic import loadUiType
from pyqtgraph.Qt import QtCore, QtGui
#from matplotlib.figure import Figure
from matplotlib import pyplot as plt
import numpy as np
from matplotlib.backends.backend_qt4agg import (
FigureCanvasQTAgg as Fig... | acrsilva/animated-zZz-machine | bundle_final_app/source/panelScatter.py | Python | lgpl-3.0 | 11,134 |
# Copyright (C) 2015-2022 by the RBniCS authors
#
# This file is part of RBniCS.
#
# SPDX-License-Identifier: LGPL-3.0-or-later
import os
import sys
from rbnics.utils.config import Config
def test_config(tempdir):
# Create a default configuration
config = Config()
# Write config to stdout
print("===... | mathLab/RBniCS | tests/unit/utils/config/test_config.py | Python | lgpl-3.0 | 1,071 |
# -*- coding: utf-8 -*-
print '''<!DOCTYPE html><html>'''
incluir(data,"head")
print '''<body>'''
incluir(data,"header")
print '''</body></html>''' | ZerpaTechnology/AsenZor | apps/votSys/user/vistas/templates/inicio.py | Python | lgpl-3.0 | 147 |
import argparse
from getpass import getpass
import json
import sys
import textwrap
import zmq
import colorama
from colorama import Fore
def execute(code):
ctx = zmq.Context.instance()
ctx.setsockopt(zmq.LINGER, 50)
repl_in = ctx.socket(zmq.PUSH)
repl_in.connect('tcp://127.0.0.1:2000')
repl_out = ... | lablup/sorna-repl | python-tensorflow/test_run.py | Python | lgpl-3.0 | 2,665 |
#----------------------------------------------------------------------
# ssd1306.py from https://github.com/guyc/py-gaugette
# ported by Guy Carpenter, Clearwater Software
#
# This library works with
# Adafruit's 128x32 SPI monochrome OLED http://www.adafruit.com/products/661
# Adafruit's 128x64 SPI monochrome O... | guyc/py-gaugette | gaugette/ssd1306.py | Python | lgpl-3.0 | 18,416 |
from django import template
# from kilonull.conf import BlogConf
from kilonull.models import Menu, MenuItem
from kilonull.settings import SETTINGS
import re
register = template.Library()
@register.simple_tag
def blog_title():
return SETTINGS['BLOG_TITLE']
# Generate HTML for the header menu.
# Use a regex (pat... | vacuus/kilonull | kilonull/templatetags/theming.py | Python | lgpl-3.0 | 901 |
# -*- coding: utf-8 -*-
import logging
import odoo
from odoo.tools.func import lazy_property
from .sessionstore import PostgresSessionStore
_logger = logging.getLogger(__name__)
class RootTkobr(odoo.http.Root):
@lazy_property
def session_store(self):
# Setup http sessions
_logger.debug('HT... | meta-it/misc-addons | base_session_store_psql/http.py | Python | lgpl-3.0 | 500 |
"""Counter.py
Part of the AQuA Cesium Controller software package
author=Martin Lichtman
created=2013-10-19
modified>=2015-05-11
This file holds everything to model a National Instruments DAQmx counter.
It communicated to LabView via the higher up LabView(Instrument) class.
Saving of returned data is handled... | QuantumQuadrate/CsPyController | python/Counter.py | Python | lgpl-3.0 | 19,978 |
"""
Module defining DataID as enumeration, e.g. concentration, velocity.
class Enum allows accessing members by .name and .value
FunctionID is deprecated and will be removed
"""
from enum import IntEnum, auto
# Schema for metadata
DataSchema = {
"type": "object",
"properties": {
"Type": {"type": "strin... | mupif/mupif | mupif/dataid.py | Python | lgpl-3.0 | 12,557 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'core.views.empresta_list_view', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| luzfcb/projetoteste | projeto/urls.py | Python | lgpl-3.0 | 308 |
#!/usr/bin/env python
# This file should be compatible with both Python 2 and 3.
# If it is not, please file a bug report.
"""
This is a Class which allows one to manipulate a git repository.
"""
#external imports
import os
import tempfile
#internal imports
import subuserlib.subprocessExtras as subprocessExtras
from ... | weaver-viii/subuser | logic/subuserlib/classes/gitRepository.py | Python | lgpl-3.0 | 6,303 |
"""
Cairo test suite.
"""
import imp
import os
import cairosvg
reference_cairosvg = imp.load_source(
'cairosvg_reference', pathname=os.path.join(
os.path.dirname(__file__), 'cairosvg_reference', 'cairosvg',
'__init__.py'))
cairosvg.features.LOCALE = reference_cairosvg.features.LOCALE = 'en_US'
... | Kozea/CairoSVG | test_non_regression/__init__.py | Python | lgpl-3.0 | 796 |
'''
This file contains all the functions that constitute the "frontend of the backend",
i.e. native Python plotting functions. All actual plots are generated by plotting.py --
this is purely about displaying them. manualfit() and geogui() rely on PyQt4, which
is likely to fail, so it's sequestered.
Version: 2019aug06
... | optimamodel/Optima | optima/gui.py | Python | lgpl-3.0 | 48,120 |
# Django settings for babynames project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'data_m... | MarkNenadov/OntarioBabyNames | babynames/babynames/settings.py | Python | lgpl-3.0 | 5,393 |
# -*- coding: utf-8 -*-
"""The function module of dolfin"""
from dolfin.functions import multimeshfunction
from dolfin.functions import functionspace
from dolfin.functions import function
from dolfin.functions import constant
from dolfin.functions import expression
from dolfin.functions import specialfunctions
from .... | FEniCS/dolfin | site-packages/dolfin/functions/__init__.py | Python | lgpl-3.0 | 827 |
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell 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 Foundat... | IfcOpenShell/IfcOpenShell | src/ifcopenshell-python/ifcopenshell/api/material/add_profile.py | Python | lgpl-3.0 | 1,359 |
import coeffstore
import expressions
import caching
import libadjoint
from dolfin_adjoint import backend
if backend.__name__ == "dolfin":
import lusolver
# Create the adjointer, the central object that records the forward solve
# as it happens.
adjointer = libadjoint.Adjointer()
mem_checkpoints = set()
disk_check... | pf4d/dolfin-adjoint | dolfin_adjoint/adjglobals.py | Python | lgpl-3.0 | 3,298 |
import unittest
from Tribler.community.market.core.ttl import Ttl
class TtlTestSuite(unittest.TestCase):
"""Ttl test cases."""
def setUp(self):
# Object creation
self.ttl = Ttl(0)
self.ttl2 = Ttl(2)
self.ttl3 = Ttl(2)
self.ttl4 = Ttl(1)
def test_init(self):
... | vandenheuvel/tribler | Tribler/Test/Community/Market/test_ttl.py | Python | lgpl-3.0 | 1,095 |
# -*- 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):
# Adding model 'Photo'
db.create_table(u'accounts_photo', (
(... | ygrass/handsome | accounts/migrations/0003_auto__add_photo.py | Python | unlicense | 5,858 |
import pygame
import random
import item
import mob
import tile
class Mapgen(object):
def __init__(self, level):
self.xsiz = 10
self.ysiz = 10
self.biome = "random"
self.procedure = 0
self.zone = []
self.level = level
self.sizefactor = 2
#self.items = ... | Lincoln-Cybernetics/Explore- | mapgen.py | Python | unlicense | 7,161 |
import time
import os
import sys
import pickle
a=sys.argv[1]
q=open('facultysubject.txt','r')
w=open('facultydept.txt','r')
e=open('facultyprojects.txt','r')
dic1={}
dic2={}
dic3={}
dic1=pickle.load(q)
##print dic1.keys()
dic2=pickle.load(w)
##print dic2.keys()
dic3=pickle.load(e)
#3print dic3.keys()
print 'NAME OF FA... | gangulydebojyoti/Searching-inside-a-college-server | Searching_Faculty.py | Python | unlicense | 928 |
import re
class Solution(object):
def decodeString(self, s):
"""
:type s: str
:rtype: str
"""
# Original idea by @StefanPochmann
r = re.compile(r"(\d+)\[([^\d\[\]]*)\]")
while r.search(s):
s = r.sub(lambda m: int(m.group(1)) * m.group(2), s)
... | stachenov/PyLeetCode | problems/decode_string.py | Python | unlicense | 333 |
#!/usr/bin/env python3
# 574A_bear.py - Codeforces.com/problemset/problem/574/A Bear program by Sergey 2015
import unittest
import sys
###############################################################################
# Bear Class
###############################################################################
class Be... | snsokolov/contests | codeforces/574A_bear.py | Python | unlicense | 2,847 |
from django import forms
from .models import Topic, Entry
class TopicForm(forms.ModelForm):
class Meta:
model = Topic
fields = ['text']
labels = {'text': ''}
class EntryForm(forms.ModelForm):
class Meta:
model = Entry
fields = ['text']
labels = {'te... | ivanxalie/learning_log | learning_logs/forms.py | Python | unlicense | 394 |
from datetime import timedelta, datetime
from airflow import DAG
from airflow.contrib.operators.bigquery_operator import BigQueryOperator
from airflow.contrib.operators.bigquery_to_gcs import BigQueryToCloudStorageOperator
from airflow.contrib.operators.gcs_to_bq import GoogleCloudStorageToBigQueryOperator
from dags.... | alexvanboxel/airflow-gcp-examples | dags/bigquery.py | Python | apache-2.0 | 3,412 |
#!/usr/bin/python
#
# Copyright (c) 2015, Arista Networks, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# Redistributions of source code must retain the above copyright notice,
# t... | brutalic/pynet_brutal | class6/library/eos_vlan.py | Python | apache-2.0 | 18,361 |
# yellowbrick.features
# Visualizers for feature analysis and diagnostics.
#
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com>
# Created: Mon Oct 03 21:30:18 2016 -0400
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: __init__.py [0f4b236] benjamin@bengfort.com ... | pdamodaran/yellowbrick | yellowbrick/features/__init__.py | Python | apache-2.0 | 1,026 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.test import TransactionTestCase
from myuw.models import VisitedLinkNew, CustomLink, PopularLink, User
from myuw.test import get_request_with_user
from myuw.dao.user import get_user_model
from myuw.dao.affiliation import ... | uw-it-aca/myuw | myuw/test/dao/test_quicklinks.py | Python | apache-2.0 | 8,048 |
import tempfile
import synapse.common as s_common
import synapse.lib.msgpack as s_msgpack
_readsz = 10000000
def splice(act, **info):
'''
Form a splice event from a given act name and info.
Args:
act (str): The name of the action.
**info: Additional information about the event.
... | vivisect/synapse | synapse/lib/splice.py | Python | apache-2.0 | 2,652 |
"""The test for the bayesian sensor platform."""
import json
import unittest
from homeassistant.components.bayesian import binary_sensor as bayesian
from homeassistant.components.homeassistant import (
DOMAIN as HA_DOMAIN,
SERVICE_UPDATE_ENTITY,
)
from homeassistant.const import ATTR_ENTITY_ID, STATE_UNKNOWN
f... | titilambert/home-assistant | tests/components/bayesian/test_binary_sensor.py | Python | apache-2.0 | 22,326 |
from synapse.tests.common import *
import synapse.lib.trees as s_trees
class TreeTest(SynTest):
def test_lib_tree_interval(self):
ivals = (
((-30, 50), {'name': 'foo'}),
((30, 100), {'name': 'bar'}),
((80, 100), {'name': 'baz'}),
)
itree = s_trees.Int... | vivisect/synapse | synapse/tests/test_lib_trees.py | Python | apache-2.0 | 1,092 |
#!/usr/bin/env python2.5
#
# Unit tester for neural_net.py
#
import sys
from neural_net import train, test,\
make_neural_net_basic,\
make_neural_net_two_layer,\
make_neural_net_challenging,\
make_neural_net_with_weights
from neural_net_data import simple_data_sets,\
harder_data_sets,\
ch... | joshishungry/artificial_intel | assignments/lab5/neural_net_tester.py | Python | apache-2.0 | 2,227 |
# -*- coding: utf-8 -*-
#
# 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... | googleapis/python-bigquery-storage | samples/snippets/__init__.py | Python | apache-2.0 | 601 |
#!/usr/bin/python
#
# convert .po to .js
#
import json
import optparse
import os
import polib
import re
import string
import sys
parser = optparse.OptionParser(usage="usage: %prog [options] pofile...")
parser.add_option("--callback", default="_.setTranslation", dest="callback", help="callback function to call with da... | ToureNPlaner/tourenplaner-web | js/lang/po2js.py | Python | apache-2.0 | 1,277 |
import datetime
from ...place import Place
from ...spec import Spec
from .planet import Planet
from .dwarfplanet import DwarfPlanet
class System(Place):
"""Systems exist within galaxies, and can contain planets...
Attributes
allowedChildEntities Entity spec types that can be created from this context
spec ... | Jerad-M/ubfs | classes/custom/place/system.py | Python | apache-2.0 | 1,201 |
# - # Copyright 2016 Max Fischer
# - #
# - # 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 appl... | maxfischer2781/cpy2py | cpy2py/twinterpreter/main_module.py | Python | apache-2.0 | 10,585 |
from __future__ import unicode_literals
import json
import xmltodict
from jinja2 import Template
from six import iteritems
from moto.core.responses import BaseResponse
from .models import redshift_backends
def convert_json_error_to_xml(json_error):
error = json.loads(json_error)
code = error["Error"]["Cod... | william-richard/moto | moto/redshift/responses.py | Python | apache-2.0 | 28,522 |
# -*- coding: utf-8 -*-
from tensorflow.core.framework import node_def_pb2
from tensorflow.python.framework import tensor_util
from intel_quantization.quantize_graph.quantize_graph_base import QuantizeNodeBase
from intel_quantization.quantize_graph.quantize_graph_common import QuantizeGraphHelper as helper
class F... | mlperf/training_results_v0.7 | Intel/benchmarks/minigo/8-nodes-32s-cpx-tensorflow/intel_quantization/quantize_graph/quantize_graph_pad.py | Python | apache-2.0 | 2,437 |
#! /usr/bin/env python
# Copyright 2011, 2013-2014 OpenStack Foundation
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# 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://... | Tesora/tesora-project-config | tools/check_irc_access.py | Python | apache-2.0 | 5,790 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | tmenjo/cinder-2015.1.0 | cinder/volume/manager.py | Python | apache-2.0 | 115,641 |
__author__ = 'frank'
import os
import os.path
import pprint
import re
import traceback
import urllib2
import zstacklib.utils.daemon as daemon
import zstacklib.utils.http as http
import zstacklib.utils.jsonobject as jsonobject
from zstacklib.utils import lock
from zstacklib.utils import linux
from zstacklib.utils impo... | live4thee/zstack-utility | cephbackupstorage/cephbackupstorage/cephagent.py | Python | apache-2.0 | 33,834 |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@hpe.com>
#
# 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/... | grahamhayes/designate | designate/api/v2/controllers/tsigkeys.py | Python | apache-2.0 | 4,349 |
from selenium.webdriver.chrome.webdriver import WebDriver
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from fixture.session import SessionHelper
from fixture.mk import M... | AlexBenyuh/python_training | fixture/application.py | Python | apache-2.0 | 897 |
#!/usr/bin/env/python
# -*-coding : utf-8 -*-
<<<<<<< HEAD
'''
Given a rectangular matrix of characters, add a border of asterisks(*) to it.
For
picture = ["abc",
"ded"]
the output should be
addBorder(picture) = ["*****",
"*abc*",
"*ded*",
"**... | mayababuji/MyCodefights | addBorder_BACKUP_4896.py | Python | apache-2.0 | 872 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import tensorflow as tf
from niftynet.layer import layer_util
class DilatedTensor(object):
"""
This context manager makes a wrapper of input_tensor
When created, the input_tensor is dilated,
the input_tensor resumes to or... | NifTK/NiftyNet | niftynet/layer/dilatedcontext.py | Python | apache-2.0 | 1,675 |
# These color schemes come from d3: http://d3js.org/
#
# They are licensed under the following license:
#
# Copyright (c) 2010-2015, Michael Bostock
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are ... | rmenegaux/bqplot | bqplot/colorschemes.py | Python | apache-2.0 | 2,813 |
# Copyright 2012 Leonidas Poulopoulos
#
# 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... | leopoul/mupy | muparse/__init__.py | Python | apache-2.0 | 582 |
import shutil
import numpy as np
import dill
import gzip
import os
import subprocess
import struct
from array import array
import warnings
from dps import cfg
from dps.utils import image_to_string, cd, resize_image
# This link seems not to work anymore...
# emnist_url = 'https://cloudstor.aarnet.edu.au/plus/index.ph... | e2crawfo/dps | dps/datasets/load/emnist.py | Python | apache-2.0 | 11,445 |
"""
pygments.lexers.jvm
~~~~~~~~~~~~~~~~~~~
Pygments lexers for JVM languages.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, \
this, combined, de... | sonntagsgesicht/regtest | .aux/venv/lib/python3.9/site-packages/pygments/lexers/jvm.py | Python | apache-2.0 | 71,561 |
# Copyright 2013 Mirantis 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 ... | openstack/python-neutronclient | neutronclient/tests/unit/lb/test_cli20_healthmonitor.py | Python | apache-2.0 | 8,574 |
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
import datetime # for checking renewal date range
class RenewBookForm(forms.Form):
renewal_date = forms.DateField(help_text="Enter a date between now and 4 weeks (default 3). ")
... | PatrickCmd/django_local_library | catalog/forms.py | Python | apache-2.0 | 776 |
from pyramid.view import view_config
from twonicornweb.views import (
site_layout,
get_user,
)
@view_config(context=Exception, renderer='twonicornweb:templates/exception.pt')
def error(exc, request):
request.response.status_int = 500
page_title = 'Internal Server Error'
user = get_user(request... | CityGrid/twonicorn | twonicornweb/views/exception.py | Python | apache-2.0 | 471 |
#!/usr/bin/env python
#
# 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
# "... | kgiusti/pyngus | examples/perf-tool.py | Python | apache-2.0 | 6,874 |
import logging
import pytest
import sdk_cmd
import sdk_install
import sdk_plan
import sdk_security
import sdk_utils
from tests import config
from tests import test_utils
LOG = logging.getLogger(__name__)
@pytest.fixture(scope="module", autouse=True)
def zookeeper_server(configure_security):
service_options = ... | mesosphere/dcos-kafka-service | frameworks/kafka/tests/test_check_topic_list_on_zk_restart.py | Python | apache-2.0 | 3,812 |
# coding: utf-8
#
# Copyright 2018 The Oppia 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 requi... | prasanna08/oppia | scripts/linters/pylint_extensions.py | Python | apache-2.0 | 78,064 |
# Copyright 2015-2016 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 requ... | openstack/networking-nec | networking_nec/nwa/common/constants.py | Python | apache-2.0 | 877 |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=8, path_list=[
[TestAction.create_vm, 'vm1', 'flag=ceph'],
[TestAction.create_volume, 'volume1', 'flag=ceph,scsi'],
[TestAction.attach_volume, 'vm1... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/vm_snapshots/paths/xc_path8.py | Python | apache-2.0 | 1,642 |
"""
JsonCli: Library for CLI based on JSON
--------------------------------------
+------------------------+-------------+
| This is the JsonCli common library. |
+------------------------+-------------+
"""
import argparse
from collections import OrderedDict
from argcomplete import autocomplete
from botocore import ... | henrysher/opslib | opslib/icsutils/jsoncli.py | Python | apache-2.0 | 2,568 |
class Hayvan:
def __init__(self,isim, renk):
self.isim=isim
self.renk=renk
def yuru(self):
print(self.isim+" yurumeye basladi")
def ye(self):
print(self.isim+" yemeye basladi")
class Fare(Hayvan):
def __init__(self,isim,renk):
super().__init__(isim,ren... | zinderud/ysa | python/first/inheritance.py | Python | apache-2.0 | 468 |
# Copyright 2012-2013 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 ... | citrix-openstack-build/python-openstackclient | openstackclient/tests/common/test_clientmanager.py | Python | apache-2.0 | 1,180 |
from . import statuscodes
from .exceptions import *
from . import basedatamodel
| Zashel/zrest | zrest/__init__.py | Python | apache-2.0 | 80 |
# 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: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
from ggrc import db
from .mixins import Mapping
class SectionObjective(Mapping, d... | vladan-m/ggrc-core | src/ggrc/models/section_objective.py | Python | apache-2.0 | 1,173 |
#!/usr/bin/env python
# coding=utf-8
import threading
import time
class timer(threading.Thread): #The timer class is derived from the class threading.Thread
def __init__(self, num, interval):
threading.Thread.__init__(self)
self.thread_num = num
self.interval = interval
self.thread_... | zhaochl/python-utils | utils/thread/time_thread.py | Python | apache-2.0 | 846 |
from __future__ import unicode_literals
from .request import Request
from .response import Response
from .stat import Stat
from .primitives import Bool, UString, Vector
class GetChildrenRequest(Request):
"""
"""
opcode = 8
parts = (
("path", UString),
("watch", Bool),
)
class G... | wglass/zoonado | zoonado/protocol/children.py | Python | apache-2.0 | 746 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
setup(name='scalegrease',
version='1',
url='https://github.com/spotify/scalegrease',
description='A tool chain for executing batch processing jobs',
packages=['scalegrease'],
data_files=[('/etc', ['conf/scalegreas... | sisidra/scalegrease | setup.py | Python | apache-2.0 | 415 |
from moto.core.responses import BaseResponse
class ReservedInstances(BaseResponse):
def cancel_reserved_instances_listing(self):
if self.is_not_dryrun("CancelReservedInstances"):
raise NotImplementedError(
"ReservedInstances.cancel_reserved_instances_listing is not yet implemen... | spulec/moto | moto/ec2/responses/reserved_instances.py | Python | apache-2.0 | 1,409 |
# Copyright (C) 2018 DataArt
#
# 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, ... | devicehive/devicehive-python | devicehive/notification.py | Python | apache-2.0 | 1,546 |
#
# 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 | tests/providers/apache/hive/operators/test_hive_stats.py | Python | apache-2.0 | 14,564 |
#!/usr/bin/python3
# Copyright (c) 2016-2021 Dell Inc. or its subsidiaries.
#
# 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... | dsp-jetpack/JetPack | src/pilot/control_overcloud.py | Python | apache-2.0 | 1,930 |
#!/usr/bin/env python
#-*-coding:utf-8-*-
'''
Description:
Created on 2016Äê5ÔÂ26ÈÕ
@author: weihua
@version:
'''
from __future__ import division
import pandas as pd
import numpy as np
import pandas.io.sql as sql
from datetime import datetime
from sklearn.linear_model import LogisticRegression
from sklearn import cros... | diditech/dd_tech | utils.py | Python | apache-2.0 | 4,028 |
import sys
import os
import cv2
from keras.models import load_model
sys.path.append("/Users/alexpapiu/Documents/Conv/OpenCV_CNN")
from webcam_cnn_pipeline import return_compiled_model_2, real_time_pred
model_name = sys.argv[1]
w = 1.5*144
h = 2*144
#keep track of all labels:
all_labels = {"model_hand":["A", "B", "C... | apapiu/live_cnn | live_cnn/reusing_model.py | Python | apache-2.0 | 861 |
# Copyright (c) 2011 Openstack, LLC.
# 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 requi... | salv-orlando/MyRepo | nova/scheduler/filters/json_filter.py | Python | apache-2.0 | 5,243 |
from os.path import join, dirname
from setuptools import setup
setup(
name = 'xmppgcm',
packages = ['xmppgcm'], # this must be the same as the name above
version = '0.2.3',
description = 'Client Library for Firebase Cloud Messaging using XMPP',
long_description = open(join(dirname(__file__), 'README.txt')).r... | gamikun/xmppgcm | setup.py | Python | apache-2.0 | 574 |
#
# Copyright (c) 2021 Arm Limited and Contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""Base class for plugins."""
import os
import sys
import platform
from os import access, F_OK
from sys import stdout
from time import sleep
from subprocess import call
from mbed_lstools.main import creat... | ARMmbed/greentea | src/htrun/host_tests_plugins/host_test_plugins.py | Python | apache-2.0 | 12,644 |
def italianhello():
i01.setHandSpeed("left", 0.60, 0.60, 1.0, 1.0, 1.0, 1.0)
i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed("left", 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
i01.setHeadSpeed(0.65, 0.75)
i01.moveHead(105,78)
i01.moveArm("left",78,48,37,11)
... | MyRobotLab/pyrobotlab | home/kwatters/harry/gestures/italianhello.py | Python | apache-2.0 | 2,293 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: mnist-visualizations.py
"""
The same MNIST ConvNet example, but with weights/activations visualization.
"""
import tensorflow as tf
from tensorpack import *
from tensorpack.dataflow import dataset
IMAGE_SIZE = 28
def visualize_conv_weights(filters, name):
"... | eyaler/tensorpack | examples/basics/mnist-visualizations.py | Python | apache-2.0 | 4,834 |
# -*- coding: utf-8 -*-
"""
Misc stuff also needed for core imports and monkey patching
"""
import numpy as np
from .core import (RVector3, R3Vector, RMatrix)
def isScalar(v, val=None):
"""Check if v is scalar, i.e. int, float or complex.
Optional compare with val.
Examples
--------
>>> import ... | gimli-org/gimli | pygimli/core/base.py | Python | apache-2.0 | 3,243 |
# 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... | eayunstack/neutron | neutron/tests/unit/extensions/test_subnet_service_types.py | Python | apache-2.0 | 14,519 |
"""
Module with location helpers.
detect_location_info and elevation are mocked by default during tests.
"""
import asyncio
import collections
import math
from typing import Any, Dict, Optional, Tuple
import aiohttp
ELEVATION_URL = "https://api.open-elevation.com/api/v1/lookup"
IP_API = "http://ip-api.com/json"
IPAP... | leppa/home-assistant | homeassistant/util/location.py | Python | apache-2.0 | 6,274 |
import logging
from google.appengine.ext import ndb
from endpoints_proto_datastore.ndb.model import EndpointsModel, EndpointsAliasProperty
class UserModel(EndpointsModel):
email = ndb.StringProperty()
name = ndb.StringProperty() | LookThisCode/DeveloperBus | Season 2013/Bogota/Projects/06.Agile_Business/backend/app/models/user.py | Python | apache-2.0 | 231 |
#!/usr/bin/env python
import telnetlib
import subprocess
import signal
import time
###############################################################
# This script will automatically flash and start a GDB debug
# session to the STM32 discovery board using OpenOCD. It is
# meant to be called from the rake task "debug" (... | timbrom/lightshow | scripts/flash_and_debug.py | Python | apache-2.0 | 2,657 |
#!/usr/bin/env python
#
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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... | chrissmall22/odl-client | odlclient/datatypes.py | Python | apache-2.0 | 43,110 |
import json
from boxsdk.object.base_object import BaseObject
from ..util.api_call_decorator import api_call
class Comment(BaseObject):
"""An object that represents a comment on an item"""
_item_type = 'comment'
@staticmethod
def construct_params_from_message(message: str) -> dict:
message_ty... | box/box-python-sdk | boxsdk/object/comment.py | Python | apache-2.0 | 1,357 |
# Copyright (c) 2011 Justin Santa Barbara
#
# 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... | cernops/nova | nova/tests/functional/api/client.py | Python | apache-2.0 | 14,003 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jendap/tensorflow | tensorflow/python/compiler/tensorrt/test/quantization_mnist_test.py | Python | apache-2.0 | 10,917 |
# 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... | Tehsmash/inspector-hooks | inspector_hooks/enroll_node_not_found.py | Python | apache-2.0 | 1,013 |
"""Support for Aurora ABB PowerOne Solar Photvoltaic (PV) inverter."""
from __future__ import annotations
from collections.abc import Mapping
import logging
from typing import Any
from aurorapy.client import AuroraError, AuroraSerialClient
from homeassistant.components.sensor import (
SensorDeviceClass,
Sens... | mezz64/home-assistant | homeassistant/components/aurora_abb_powerone/sensor.py | Python | apache-2.0 | 4,749 |
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# 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 applicabl... | cisco-openstack/tempest | tempest/api/object_storage/test_crossdomain.py | Python | apache-2.0 | 2,264 |
# Copyright 2013 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... | ging/keystone | keystone/tests/test_v3_oauth2.py | Python | apache-2.0 | 31,537 |
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from ..builder import BBOX_ASSIGNERS
from ..iou_calculators import build_iou_calculator
from ..transforms import bbox_xyxy_to_cxcywh
from .assign_result import AssignResult
from .base_assigner import BaseAssigner
@BBOX_ASSIGNERS.register_module()
class Uni... | open-mmlab/mmdetection | mmdet/core/bbox/assigners/uniform_assigner.py | Python | apache-2.0 | 5,556 |
np.random.seed(1234)
fig, ax = plt.subplots(1)
x = 30*np.random.randn(10000)
mu = x.mean()
median = np.median(x)
sigma = x.std()
textstr = '$\mu=%.2f$\n$\mathrm{median}=%.2f$\n$\sigma=%.2f$'%(mu, median, sigma)
ax.hist(x, 50)
# these are matplotlib.patch.Patch properties
props = dict(boxstyle='round', facecolor='wheat... | leesavide/pythonista-docs | Documentation/matplotlib/users/recipes-8.py | Python | apache-2.0 | 493 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.backend.jvm.artifact import Artifact
from pants.backend.jvm.ossrh_publication_metadata import (
Developer,
License,
OSSRHPublicationMetadata,
Scm,
)
from pants.b... | wisechengyi/pants | src/python/pants/backend/jvm/register.py | Python | apache-2.0 | 11,163 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.