repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
ehirt/odoo | addons/stock/procurement.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
rschnapka/partner-contact | partner_street_number/model/res_partner.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013-2014 Therp BV (<http://therp.nl>).
#
# @autors: Stefan Rijnhart, Ronald Portier
#
# This program is free software: you can redi... |
codeforgoodconf/sisters-of-the-road-admin | bartercheckout/migrations/0002_auto_20170728_2251.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-28 22:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bartercheckout', '0001_initial'),
]
operations = [
migrations.AlterField(
... |
feroda/v4vendemmia | v4v_python/utils.py | #!/usr/bin/env python
import os.path
import subprocess
def size_giga(nfile):
"""
Return the size of a file in GB
"""
if os.path.isfile(nfile):
return round(os.path.getsize(nfile)/(1024*1024*1024.0), 1)
else:
return None
def get_devs():
"""
Return the devs connected at th... |
mitodl/ccxcon | courses/management/commands/gen_realish_data.py | """
Generates fake data
"""
from django.core.management import BaseCommand
from courses.models import Course
from courses.factories import CourseFactory, ModuleFactory
from oauth_mgmt.factories import BackingInstanceFactory
from oauth_mgmt.models import BackingInstance
class Command(BaseCommand):
"""
Generat... |
BirkbeckCTP/janeway | src/production/models.py | __copyright__ = "Copyright 2017 Birkbeck, University of London"
__author__ = "Martin Paul Eve & Andy Byers"
__license__ = "AGPL v3"
__maintainer__ = "Birkbeck Centre for Technology and Publishing"
from datetime import date
from django.db import models
from django.utils import timezone
class ProductionAssignment(mod... |
DempDemp/nautilus | modules/ircpaint.py | import urllib2
from core import base
from core.auth import Auth
class IRCPaint(base.baseClass):
@classmethod
def get_drawing(cls, sid):
return urllib2.urlopen('http://ircpaint.randomlab.info/rawirc.php?q={}'.format(sid)).read()
def on_privmsg(self, address, target, text):
if target == self... |
RPI-OPENEDX/edx-sga | edx_sga/sga.py | """
This block defines a Staff Graded Assignment. Students are shown a rubric
and invited to upload a file which is then graded by staff.
"""
import datetime
import hashlib
import json
import logging
import mimetypes
import os
import pkg_resources
import pytz
from functools import partial
from courseware.models impo... |
stvstnfrd/edx-platform | openedx/core/djangoapps/theming/checks.py | """
Settings validations for the theming app
"""
import os
import six
from django.conf import settings
from django.core.checks import Error, Tags, register
from edx_toggles.toggles import SettingToggle
@register(Tags.compatibility)
def check_comprehensive_theme_settings(app_configs, **kwargs): # lint-amnesty, pyl... |
okfn/rtei | rtei/data.py | import json
import os
from collections import OrderedDict
from django.conf import settings
_file_cache = {}
def get_json_file(path, ordered_dict=True):
if _file_cache.get(path):
return _file_cache[path]
with open(path) as f:
if ordered_dict:
out = json.load(f, object_pairs_hook=... |
DemocracyClub/yournextrepresentative | ynr/apps/parties/management/commands/parties_import_from_ec.py | from io import StringIO
from django.core.management.base import BaseCommand
from parties.importer import ECPartyImporter
from parties.models import PartyEmblem
from utils.slack import SlackHelper
class Command(BaseCommand):
help = """
Import policital parties that can stand candidates from The Electoral
... |
SuperNovaPOLIUSP/supernova | aeSupernova/interface/urls.py | from django.conf.urls import patterns, url
from interface import views
urlpatterns = patterns('',
url(r'^$', views.index, name = 'interface'),
url(r'^professor/$', views.professor, name = 'professor'),
url(r'^crawler/$', views.crawler, name = 'crawler'),
url(r'^crawler_run/$', views.crawler_run, name =... |
romain-li/edx-platform | common/djangoapps/course_modes/views.py | """
Views for the course_mode module
"""
import decimal
import urllib
from babel.dates import format_datetime
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.db import transaction
from django.http import HttpResponse, HttpResponseBadRequest
from djang... |
citiususc/construe | tests/bmi/generate_report.py | # -*- coding: utf-8 -*-
# pylint: disable-msg=
"""
Created on Fri May 8 14:46:45 2015
This script generates a report with the interpretation results on a full
database. It includes the sequence of rhythms, the mean heart rate in every
rhythm, the number of extrasystoles, rhythm blocks and couplets.
@author: T. Teije... |
PairMhai/Backend | catalog/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-15 05:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Design... |
ddico/odoo | addons/im_livechat/models/im_livechat_channel.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import random
import re
from odoo import api, fields, models, modules
class ImLivechatChannel(models.Model):
""" Livechat Channel
Define a communication channel, which can be accessed with 'sc... |
zakansecurity/zrbshell | zrbshell.py | #!/usr/bin/env python
#====================================================================
'''
Author : K. BEKKOUCHE
Web Site : www.zakansecurity.com
Version: 1.0
Date: 17/06/2016
'''
#====================================================================
import socket, subprocess, os, threading, time, sys;
clas... |
h4ck3rm1k3/orca-sonar | src/orca/notification_messages.py | # Orca
#
# Copyright 2010 Informal Informatica LTDA.
# Author: Jose Vilmar <vilmar@informal.com.br>
#
# 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 the License, ... |
ME-ICA/me-ica | meica.libs/nibabel/tests/test_recoder.py | # emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the NiBabel package for the
# copyright and license terms.
#
### ### ### #... |
eriknyk/devcon | devcon/controllers/template.py | # -*- coding: utf-8 -*-
"""Fallback controller."""
from devcon.lib.base import BaseController
from tg import abort
__all__ = ['TemplateController']
class TemplateController(BaseController):
"""
The fallback controller for devcon.
By default, the final controller tried to fulfill the request
whe... |
gbenson/i8c | tests/test_parse_wordsize.py | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Red Hat, Inc.
# This file is part of the Infinity Note Compiler.
#
# The Infinity Note Compiler is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of
... |
zakandrewking/cobrapy | cobra/test/test_manipulation.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import pytest
from cobra.core import Metabolite, Model, Reaction
from cobra.manipulation import *
from .conftest import model, salmonella
class TestManipulation:
"""Test functions in cobra.manipulation"""
def test_canonical_form(self, model):
... |
antong/ldaptor | ldaptor/protocols/ldap/autofill/sambaAccount.py | from ldaptor.protocols.ldap.autofill import ObjectMissingObjectClassException
class Autofill_samba: #TODO baseclass
def start(self, ldapObject):
assert 'objectClass' in ldapObject
if 'sambaAccount' not in ldapObject['objectClass']:
raise ObjectMissingObjectClassException, ldapObject
... |
xiangke/pycopia | mibs/pycopia/mibs/CISCO_VOICE_ANALOG_IF_MIB.py | # python
# This file is generated by a program (mib2py). Any edits will be lost.
from pycopia.aid import Enum
import pycopia.SMI.Basetypes
Range = pycopia.SMI.Basetypes.Range
Ranges = pycopia.SMI.Basetypes.Ranges
from pycopia.SMI.Objects import ColumnObject, MacroObject, NotificationObject, RowObject, ScalarObject, N... |
losalamos/PyFEHM | fvars.py | """Functions for FEHM thermodynamic variables calculations."""
"""
Copyright 2013.
Los Alamos National Security, LLC.
This material was produced under U.S. Government contract DE-AC52-06NA25396 for
Los Alamos National Laboratory (LANL), which is operated by Los Alamos National
Security, LLC for the U.S. Department ... |
mathstuf/fedmsg | fedmsg/commands/tail.py | # This file is part of fedmsg.
# Copyright (C) 2012 - 2014 Red Hat, Inc.
#
# fedmsg 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 the License, or (at your option) any later ver... |
altai/focus2 | focus2/_version.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Focus2
# Copyright (C) 2012 Grid Dynamics Consulting Services, Inc
# All Rights Reserved
#
# This program 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; e... |
rosjat/python-scsi | tests/test_unmarshall_getlbastatus.py | # coding: utf-8
# Copyright (C) 2014 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
# Copyright (C) 2015 by Markus Rosjat <markus.rosjat@gmail.com>
# SPDX-FileCopyrightText: 2014 The python-scsi Authors
#
# SPDX-License-Identifier: LGPL-2.1-or-later
import unittest
from pyscsi.pyscsi.scsi_cdb_getlbastatus import GetL... |
DStauffman/dstauffman2 | dstauffman2/imageproc/photos.py | r"""
Photos module file for the "dstauffman2" library. It contains a collection of commands that are
useful for maintaining photo galleries.
Notes
-----
#. Written by David C. Stauffer in December 2013.
"""
# pylint: disable=C0326
#%% Imports
import doctest
import os
import re
import shutil
import unittest
import ... |
buguen/pylayers | pylayers/network/emsolver.py | # -*- coding:Utf-8 -*-
#####################################################################
#authors :
#Nicolas AMIOT : nicolas.amiot@univ-rennes1.fr
#Bernard UGUEN : bernard.uguen@univ-rennes1.fr
#####################################################################
"""
.. currentmodule:: pylayers.antpr... |
ghorn/debian-casadi | experimental/joris/bench.py | #
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl,
# K.U. Leuven. All rights reserved.
# Copyright (C) 2011-2014 Greg Horn
#
# CasADi is free software; you can... |
asdf1011/bdec | specs/msword/python/decode.py | #!/usr/bin/python
import os.path
import sys
sys.path.append(os.path.join(os.path.split(__file__)[0], '..', '..', '..'))
from bdec import DecodeError
from bdec.data import Data
from bdec.output.xmlout import to_file
from ole import decode, load_msword_spec
if __name__ == '__main__':
data = Data(open(sys.argv[1]... |
matthiaskoenig/sbmlutils | src/sbmlutils/test/test_comp.py | """
Tests for the comp module.
"""
import libsbml
from sbmlutils import comp
from sbmlutils.factory import *
from sbmlutils.factory import PORT_TYPE_PORT, create_objects
from sbmlutils.metadata.sbo import SBO
def create_port_doc() -> libsbml.SBMLDocument:
sbmlns = libsbml.SBMLNamespaces(3, 1, "comp", 1)
doc ... |
jason-vallet/graph-ryder-api | routes/post/post_aggregations.py | from flask_restful import Resource, reqparse
from neo4j.v1 import ResultError
from connector import neo4j
from routes.utils import addargs, makeResponse
parser = reqparse.RequestParser()
class CountAllPost(Resource):
def get(self):
req = "MATCH (:post) RETURN count(*) AS nb_posts"
result = neo4j.... |
oubiwann/epub | epub/writer/epublite.py | # Copyright (c) 2012, Bin Tan
# This file is distributed under the BSD Licence. See
# python-epub-builder-license.txt for details.
from genshi.template import TemplateLoader
from epub.writer import book
class Section(object):
def __init__(self):
self.title = ''
self.subsections = []
self... |
pdear/verilib | pytools/vlparse/types/expression.py | #
# expression.py - Verilog expression parser data types
#
# Verilib - A Verilog HDL development framework
# Copyright (c) 2014, Patrick Dear, All rights reserved.
#
# 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... |
susilehtola/psi4 | psi4/driver/qcdb/molecule.py | #
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2022 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... |
Conorh97/CA117---Python3 | week_9/employee_91.py | class Employee(object):
def __init__(self , name = "" , number = 0):
self.name = name
self.number = number
def wages(self):
return 0
def __str__(self):
return "Name: {}\nNumber: {}\nWages: {:.2f}".format(self.name , self.number , self.wages())
class Manager(Employee):
... |
zhuomingzhe/myapx_admin | game/admin.py | #! encoding=utf-8
from django.contrib import admin
# Register your models here.
from django.contrib import admin
from game.models import Game, Server, Region
@admin.register(Game)
class GameAdmin(admin.ModelAdmin):
list_display = ('name', 'list_channels')
list_filter = ('name',)
search_fields = ('nam... |
ParthKolekar/felicity-threads-base | felicity_threads_base/tle/tasks.py | from __future__ import absolute_import
import commands
import datetime
import imp
import os
from celery import shared_task, task
from base.models import Language, User
from felicity_threads_base.celery import app
from felicity_threads_base.settings import MEDIA_ROOT
from tle.models import Question, Submission
import... |
ereOn/redis-lua | redis_lua/script.py | """
LUA scripts-related functions.
"""
try: # pragma: no cover
from ujson import dumps as jdumps
from ujson import loads as jloads
except ImportError:
from functools import partial
from json import dumps
from json import loads as jloads
jdumps = partial(dumps, separators=(',', ':'))
import si... |
marcoesposito1988/easy_handeye | easy_handeye/src/easy_handeye/handeye_sampler.py | from tf2_ros import Buffer, TransformListener, TransformBroadcaster
from rospy import Time, Duration, loginfo
class HandeyeSampler(object):
"""
Manages the samples acquired from tf.
"""
def __init__(self, handeye_parameters):
self.handeye_parameters = handeye_parameters
# tf structur... |
hroest/pymzML | pymzml/obo.py | # -*- coding: utf-8 -*-
# encoding: utf-8
"""
Class to parse the obo file and set up the accessions library
The OBO parse has been designed to convert MS:xxxxx tags to their appropriate
names. A minimal set of MS accession is used in pymzml, but additional accessions
can easily added, using the extraAccession paramete... |
dormouse/read | database/models.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
from sqlalchemy import Column, ForeignKey
from sqlalchemy.dialects.sqlite import INTEGER, TEXT, DATETIME, BOOLEAN
from sqlalchemy.orm import column_property, relationship
from sqlalchemy.sql import func
from sqlalchemy import and_
from database.database im... |
lgnq/RPI8836 | bmposd.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
import define
import tw8836
import spi
#RLE2/MRLE headerv 16 Byte
ID0_IDX = 0
ID1_IDX = 1
OP_BMPBITS_IDX = 2
RLEDATA_CNT_IDX = 3
WIDTH_L_IDX = 4
WIDTH_H_IDX = 5
HEIGHT_L_IDX = 6
HEIGHT_H_IDX = 7
SIZE0_IDX = 8
SIZE1_IDX = 9
SIZE2_I... |
davidecaminati/Domotics-Raspberry | Hardware/Color_LED/fade.py | import RPIO.PWM as PWM
import time
from flask import Flask, url_for, request
import commands
#variable
app = Flask(__name__)
app.config.from_object(__name__)
GPIO_RED = 17
GPIO_GREEN = 27
GPIO_BLUE = 22
Correction_RED = 1.0
Correction_GREEN = 1.0
Correction_BLUE = 1.0
Correction_RED1 = 1.0
Correction_GREEN1 = 1.0
Corr... |
tonygalmiche/is_automobile_contract | wizard/generate_quotations.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# Asma BOUSSELMI - CONSULTANT OPENERP CONFIRME
#
################################################... |
gatgui/excons | automake.py | # MIT License
#
# Copyright (c) 2017 Gaetan Guidet
#
# This file is part of excons.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rig... |
IfcOpenShell/IfcOpenShell | src/blenderbim/blenderbim/bim/module/boundary/__init__.py | # BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Fo... |
raviqqe/lambda_calculus | lambda.py | #!/usr/bin/env python
import abc
import functools
import sys
import unicodedata
import argparse
# constants
PUNCTUATIONS = {"\\", ".", "(", ")"}
DEBUG = False
# classes
## error
class Error:
def __init__(self, pos, message, raw_message=False):
if not raw_message:
self.__message = self.__format_mes... |
xerosanyam/dev | python/random-simple-check.py | list1=[0]*101
list2=[0]*101
list3=[0]*101
list4=[0]*101
list5=[0]*101
list6=[0]*101
list7=[0]*101
list8=[0]*101
list9=[0]*101
list10=[0]*101
for j in range(1,367):
list1[((1+j)%100)+1]+=1
list2[(2+j)%100+1]+=1
list3[(3+j)%100+1]+=1
list4[(4+j)%100+1]+=1
list5[(5+j)%100+1]+=1
list6[(6+j)%100+1]+=1
list7[(7+j)%100... |
ArchiveTeam/rapidshare-grab | pipeline.py | # encoding=utf8
import datetime
from distutils.version import StrictVersion
import hashlib
import os.path
import random
from seesaw.config import realize, NumberConfigValue
from seesaw.item import ItemInterpolation, ItemValue
from seesaw.task import SimpleTask, LimitConcurrent
from seesaw.tracker import GetItemFromTrac... |
dmulholland/ivy | ivy/cli/__init__.py | # ------------------------------------------------------------------------------
# This package processes the application's command-line arguments.
# ------------------------------------------------------------------------------
import os
import sys
import janus
import ivy
from . import build
from . import init
from... |
jansegre/calcnum | python/trab3/exemplo.py | # coding=utf-8
from base import Calcnum, eq
from bissecao import bissecao
from falsaposicao import falsaposicao
from iteracaolinear import iteracaolinear
from newtonraphson import newtonraphson
from secantes import secantes
calc = Calcnum(100, 1e-10)
calc.tabelar = True
eq1 = 'cos(x) = x'
eq2 = 'exp(x) = 3 * x'
def ... |
matt-hayden/dedup | futil.py | #! /usr/bin/env python3
"""
"""
from datetime import datetime
import os, os.path
import tarfile
import zipfile
#from . import *
from __init__ import *
import characterize
def comm(lhs, rhs):
"""Returns (left-only, common, right-only)
"""
com = lhs & rhs
return (lhs-com), com, (rhs-com)
def cmp_stat(lhs, rhs):... |
IanHawke/HighamSDEs | stab.py | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 28 22:49:20 2013
stab
This is a direct re-implementation of Des Higham's SDE scripts.
Mean-square and asymptotic stability test for Euler-Maruyama
SDE is
dX = \lambda X dt + \mu X dW, X(0) = X_0
with \lambda = -3, \mu = \sqrt{3}, X_0 = 1.
@author: ih3
"""
impor... |
Daetalus/Algorithms | sequence/list/listAlgorithm.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def removeElements(head, val):
dummy = ListNode(0)
dummy.next = ... |
Frikeer/LearnPython | scraper/scraper.py | import urllib.request
from bs4 import BeautifulSoup
class Scraper():
def __init__(self,
site):
self.site = site
self.news_list = []
def scrape(self):
r = urllib.request\
.urlopen(self.site)
html = r.read()
soup = BeautifulSoup(html,
... |
DavidNorman/tensorflow | tensorflow/python/kernel_tests/tridiagonal_solve_op_test.py | # 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... |
zstackio/zstack-woodpecker | integrationtest/vm/multihosts/multiPrimaryStorage/test_one_ps_disabled.py | '''
@author: FangSun
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.primarystorage_operations as ps_ops
import random
_config_ = {
'timeout' : 3000,
'noparallel' : True
... |
googleapis/python-managed-identities | samples/generated_samples/managedidentities_v1_generated_managed_identities_service_get_domain_sync.py | # -*- 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... |
RRCKI/pilot | RunJobHopper.py | # Class definition:
# RunJobHopper
# [Add description here]
# Instances are generated with RunJobFactory via pUtil::getRunJob()
# Implemented as a singleton class
# http://stackoverflow.com/questions/42558/python-and-the-singleton-pattern
# Import relevant python/pilot modules
from RunJobHPC import RunJobHP... |
marieandreeo/GBM4900 | LMPY/src/LeapThread.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from threading import Thread
sys.path.insert(0, "../lib")
import Leap
from SampleListener import *
class LeapThread(Thread):
def __init__(self, subTread):
Thread.__init__(self)
self.listener = SampleListener()
self.controller = Leap.Controller()
self.lis... |
sharbison3/python-docs-samples | auth/api-client/snippets.py | # 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 applicable law or ... |
kennedyshead/home-assistant | homeassistant/components/evohome/climate.py | """Support for Climate devices of (EMEA/EU-based) Honeywell TCC systems."""
from __future__ import annotations
from datetime import datetime as dt
import logging
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_AUTO,
HVAC_MODE_HEAT,
... |
dresl/python_web_grayscale_bootstrap_theme | polls/admin.py | from django.contrib import admin
from polls.models import Choice, Question, Sidebar
class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3
class QuestionAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['question_text']}),
('Date information', {'fields'... |
JonatanAntoni/CMSIS_5 | CMSIS/DSP/PythonWrapper/testdsp.py | import cmsisdsp as dsp
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
from scipy.fftpack import dct
r = dsp.arm_add_f32(np.array([1.,2,3]),np.array([4.,5,7]))
print(r)
r = dsp.arm_add_q31([1,2,3],[4,5,7])
print(r)
r = dsp.arm_add_q15([1,2,3],[4,5,7])
print(r)
r = dsp.arm_add_q7([-1,2,3... |
mikalstill/ostrich | ostrich/stages/stage_20_apt.py | # 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 th... |
jellybean4/yosaipy2 | yosaipy2/core/session/manager.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from yosaipy2.core import (
SessionSettings,
InvalidSessionException,
)
from session import session_tuple, SimpleSession, SessionKey
from session import NativeSessionHandler
from yosaipy2.core.utils.utils import get_logger
from typing import Dict
import abcs as sess... |
zstackio/zstack-woodpecker | integrationtest/vm/mini/image_replication/test_replicating_image_expunge_image.py | '''
New Integration test for image replication.
Delete Image while it is being replicated
@author: Legion
'''
import os
import time
import random
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.config_operations as conf_ops
image_name =... |
UKPLab/semeval2017-scienceie | code/skip-thoughts/TomKenter-siamese-cbow-faf752ef6a99/makeOutputFileName.py | '''
Copyright 2016 Tom Kenter
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 distrib... |
alexgorban/models | research/object_detection/builders/model_builder.py | # 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... |
Datera/cinder | cinder/tests/unit/volume/drivers/test_nfs.py | # Copyright (c) 2012 NetApp, 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... |
galad-loth/DescHash | SemiSupHash.py | import numpy as npy
from scipy import linalg
from LoadData import ReadFvecs
import Utils
import pdb
def GetLabeledInfo(data, nDataL):
ndata=data.shape[0]
kn2=nDataL/3
kn3=2*nDataL/3
idxLabelData=npy.arange(ndata)
npy.random.shuffle(idxLabelData)
idxLabelData=idxLabelData[:nDataL... |
jdanbrown/pydatalab | google/datalab/ml/_job.py | # 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 applicable law or agreed ... |
jabesq/home-assistant | homeassistant/config_entries.py | """Manage config entries in Home Assistant."""
import asyncio
import logging
import functools
import uuid
from typing import (
Any, Callable, List, Optional, Set # noqa pylint: disable=unused-import
)
import weakref
from homeassistant import data_entry_flow, loader
from homeassistant.core import callback, HomeAss... |
xpybuild/xpybuild | xpybuild/targets/archive.py | # xpyBuild - eXtensible Python-based Build System
#
# Copyright (c) 2013 - 2019 Software AG, Darmstadt, Germany and/or its licensors
#
# 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
#
# ... |
googleapis/python-dialogflow-cx | google/cloud/dialogflowcx_v3/services/agents/transports/grpc_asyncio.py | # -*- 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... |
matrix-org/sygnal | tests/test_proxy_url_parsing.py | # -*- coding: utf-8 -*-
# Copyright 2020 The Matrix.org Foundation C.I.C.
#
# 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 require... |
awslabs/aws-shell | awsshell/makeindex.py | """Module for building the autocompletion indices."""
from __future__ import print_function
import os
import json
from six import BytesIO
from docutils.core import publish_string
import awscli.clidriver
from awscli.argprocess import ParamShorthandDocGen
try:
from botocore.docs.bcdoc import textwriter
except Import... |
NoBodyCam/TftpPxeBootBareMetal | nova/volume/storwize_svc.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 IBM, Inc.
# Copyright (c) 2012 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... |
HybridF5/jacket | jacket/tests/compute/functional/api_sample_tests/test_migrations.py | # Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... |
tivaliy/git-repo | gitrepo/v1/sync.py | # -*- coding: utf-8 -*-
#
# Copyright 2016 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 requ... |
jrowan/zulip | zerver/lib/integrations.py | from __future__ import absolute_import
import os.path
from typing import Dict, List, Optional, TypeVar, Any, Text
from django.conf import settings
from django.conf.urls import url
from django.core.urlresolvers import LocaleRegexProvider
from django.utils.module_loading import import_string
from django.utils.safestring... |
bigswitch/nova | nova/conf/s3.py | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2016 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... |
todaychi/hue | apps/metastore/src/metastore/views.py | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
informatics-isi-edu/deriva-py | deriva/core/utils/core_utils.py | import io
import os
import sys
import shutil
import errno
import json
import math
import platform
import logging
import requests
import portalocker
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
from collections import OrderedDict
from distutils import util as du_util
IS_PY2 = (sys.vers... |
adamcharnock/lightbus | lightbus_experiments/kombu_zmq/timer.py | from time import time
class Timer():
def __init__(self):
self.totals = []
self.stack = []
def __enter__(self):
self.stack.append(time())
def __exit__(self, exc_type, exc_val, exc_tb):
self.totals.append(time() - self.stack.pop())
def __str__(self):
return "{}... |
xiang12835/python_web | py2_django/learning/serializers.py | from django_learn.models import Book
from rest_framework import serializers
class BookSerializer(serializers.Serializer):
class Meta:
model = Book
field = ('name','title','author')
# name = serializers.CharField(max_length=100)
# title = serializers.CharField(max_length=100)
# author = serializers... |
mailgun/flanker | flanker/mime/message/headers/encoding.py | import logging
from collections import deque
import six
import flanker.addresslib.address
from flanker import _email
from flanker.mime.message.headers import parametrized
from flanker.mime.message.utils import to_utf8
_log = logging.getLogger(__name__)
_ADDRESS_HEADERS = ('From', 'To', 'Delivered-To', 'Cc', 'Bcc', ... |
mohou/Mohou_Box-master | boxUpdate/machine_api.py | # coding=utf-8
import traceback
import os
import glob
import ConfigParser
import settings as WebConfig
from user_api import get_user_info
def restart_web_service():
os.system("/usr/bin/sudo service octoprint restart")
def get_serial_list():
baselist=[]
baselist = baselist \
... |
pplu/botocore | tests/unit/test_configloader.py | #!/usr/bin/env
# Copyright (c) 2012-2013 Mitch Garnaat http://garnaat.org/
# Copyright 2012-2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is loca... |
SmartInfrastructures/fuel-web-dev | nailgun/nailgun/test/integration/test_volume_manager.py | # -*- coding: utf-8 -*-
# Copyright 2013 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 requi... |
vmturbo/nova | nova/tests/unit/volume/test_cinder.py | # Copyright 2013 Mirantis, Inc.
# 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
#
# Un... |
openstack/cloudkitty | cloudkitty/state.py | # -*- coding: utf-8 -*-
# Copyright 2014 Objectif Libre
#
# 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 ... |
biosustain/cameo | tests/conftest.py | from os.path import abspath, dirname, join
import cobra.test
import pytest
from cameo import load_model
from cameo.config import solvers
cameo_directory = abspath(join(dirname(abspath(__file__)), ".."))
cameo_location = abspath(join(cameo_directory, ".."))
data_dir = join(cameo_directory, "tests", "data", "")
@py... |
realgo/luigi | luigi/s3.py | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... |
happytesting/py-flask-signup | tests/application-tests.py | # Copyright 2013. Amazon Web Services, 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 a... |
bhzunami/reanalytics | app/__init__.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from flask import Flask
from flask_assets import Environment, Bundle
from flask_bootstrap import Bootstrap
from flask_login import LoginManager
from flask_sqlalchemy import SQLAlchemy
from flask_socketio import SocketIO
from config import config
import os
from celery impor... |
sapcc/monasca-notification | monasca_notification/plugins/hipchat_notifier.py | # (C) Copyright 2016 Hewlett Packard Enterprise Development LP
#
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.