code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014-2018 CERN.
#
# INSPIRE 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 the License, or
# (at your option) any ... | inspirehep/inspire-next | inspirehep/modules/records/serializers/schemas/json/authors/common/position.py | Python | gpl-3.0 | 1,690 |
# This file is part of Essential Editor Research Project (EERP)
#
# EERP 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 the License, or
# (at your option) any later version.
#
# EERP is di... | cheery/essence | essence/selection.py | Python | gpl-3.0 | 12,706 |
# Copyright 2017 The UAI-SDK 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 applicable... | ucloud/uai-sdk | uaitrain/api/get_train_max_exec_time_range.py | Python | apache-2.0 | 1,850 |
#
# This file is part of QGis Mobility
#
# QGis Mobility 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 the License, or
# (at your option) any later version.
#
# QGis Mobility is dis... | RealworldSystems/qgis-mobility | lib/qgis_mobility/generator/sqlite_builder.py | Python | gpl-3.0 | 2,600 |
import unittest
from mock import patch, MagicMock
from flask import Flask
from flask_ask import Ask, audio
from flask_ask.models import _Field
class AudioUnitTests(unittest.TestCase):
def setUp(self):
self.ask_patcher = patch('flask_ask.core.find_ask', return_value=Ask())
self.ask_patcher.start()... | johnwheeler/flask-ask | tests/test_audio.py | Python | apache-2.0 | 2,585 |
#!/usr/bin/env python3
import argparse
import colorama
from fortdepend import FortranProject
from fortdepend import __version__
def create_argument_parser():
"""Create the parser for the command line arguments"""
# Add command line arguments
parser = argparse.ArgumentParser(description="Generate Fortran d... | ZedThree/fort_depend.py | fortdepend/__main__.py | Python | mit | 3,434 |
from .mod_options import getModule | ryfx/modrana | modules/mod_options/__init__.py | Python | gpl-3.0 | 34 |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# Copyright 2012 Cloudscaling Group, Inc.
# All Rights Reserved.
#
# Licens... | tanglei528/glance | glance/openstack/common/db/sqlalchemy/models.py | Python | apache-2.0 | 3,948 |
#!/usr/bin/env python
import logging
import json
import time
import multiprocessing
import Queue
from cbtestlib.membase.api.rest_client import RestConnection
from cbtestlib.membase.api.exception import ServerUnavailableException
from tabula.table import Table
from tabula.section import Section
from seriesly import Se... | couchbaselabs/cbtop | libcbtop/visit_cb.py | Python | apache-2.0 | 8,502 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-scheduler | samples/generated_samples/cloudscheduler_v1beta1_generated_cloud_scheduler_create_job_sync.py | Python | apache-2.0 | 1,470 |
# -*- coding: utf-8 -*-
# Copyright 2012 Loris Corazza, Sakis Christakidis
#
# 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
#
# U... | schristakidis/p2ner | p2ner/components/pipeelement/ackelement/ackelement/ack.py | Python | apache-2.0 | 6,148 |
from django.contrib import admin
from website.blog.models import Article, Tag
admin.site.register(Article)
admin.site.register(Tag)
| RPCS3/rpcs3-www | website/blog/admin.py | Python | gpl-2.0 | 133 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Author: Wang Wentao
# Created on 2017-08-02 11:30:00
from datetime import datetime ,timedelta
import requests
from bs4 import BeautifulSoup
from openpyxl import Workbook
import login
import custinfo
def getDepartSalesDetails(depart_id, search_date, session):
... | user5111/ESS-SDK-for-Human | departinfo.py | Python | mit | 8,064 |
import re
import sys
import pickle
import warnings
from indra.java_vm import autoclass, JavaException, cast
from indra.databases import hgnc_client
from indra.statements import *
# Functions for accessing frequently used java classes with shortened path
def bp(path):
prefix = 'org.biopax.paxtools.model.level3'
... | decarlin/indra | indra/biopax/processor.py | Python | bsd-2-clause | 15,737 |
#
# This program 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 the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# ... | eduardocerqueira/cloudbitsgo | setup.py | Python | gpl-3.0 | 2,205 |
#
# make_meqs.py
#
# This code will create module evaluation questionnaires in each
# Canvas course.
#
# Things that need to be set:
#
# input_file - path of Excel file containing course information
input_file = '/mnt/metadmin/CANVASBOTS/UG/Courses_and_Assignments/input_file.xlsx'
#
#
import sy... | alemottura/PyCAPI | uob_scripts/make_meqs.py | Python | mit | 6,705 |
#
# Authors: Robert Abram <robert.abram@entpack.com>
#
# Copyright (C) 2015-2017 EntPack
# see file 'LICENSE' for use and warranty information
#
# This program 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, e... | EntPack/SilentDune-Client | silentdune_client/sdc_firewall.py | Python | lgpl-3.0 | 12,943 |
'''
Created on 15.08.2014
BayEOS Server Command Line Client
@author: oliver
'''
import base64
from bayeos import connectionFile, timeFilter
from datetime import datetime
from xmlrpc import client
import numpy as np
_lookUp = {}
_nDic = {"check_write":0,"check_exec":1,"id":2,"id_super":3,"art":4,"name":5,"rec_st... | BayCEER/bayeos-server-py | src/bayeos/cli.py | Python | gpl-2.0 | 10,579 |
from __future__ import unicode_literals
from django.core.management.base import BaseCommand
from .handlers import create_graph_from_filename
class Command(BaseCommand):
args = 'file'
nodes = {}
relations = {}
def handle(self, file, **options):
create_graph_from_filename(file)
| maciej-gol/call-tracker | src/call_tracker/app/main/management/commands/load_graph.py | Python | mit | 306 |
# -*- coding: utf-8 -*-
#################################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Julius Network Solutions SARL <contact@julius.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under th... | gurneyalex/stock-logistics-barcode | __unported__/tr_barcode_on_prodlots/res_config.py | Python | agpl-3.0 | 4,319 |
# -*- coding: utf-8 -*-
from pyknyx.common import config
DEVICE_NAME = "replay"
DEVICE_IND_ADDR = "1.1.1"
DEVICE_VERSION = "0.1"
# Override default logger level
config.LOGGER_LEVEL = "info"
| knxd/pKNyX | pyknyx/examples/6_replay/replay/settings.py | Python | gpl-3.0 | 193 |
def get_n_jobs(logger=None):
def _from_hardware():
import psutil
return psutil.cpu_count(logical=False)
def _from_env(var):
import os
e = os.getenv(var, None)
if e:
try:
return int(e)
except ValueError as ve:
if l... | marscher/PyEMMA | pyemma/_base/parallel.py | Python | lgpl-3.0 | 2,204 |
"""
***************************************************************************
Output.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*********************************************************... | luofei98/qgis | python/plugins/processing/core/outputs.py | Python | gpl-2.0 | 10,394 |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 16, 2014
@author:
Sebastien Gros
Assistant Professor
Department of Signals and Systems
Chalmers University of Technology
SE-412 96 Gteborg, SWEDEN
grosse@chalmers.se
Python/casADi Module:
An MHE module for Freeway Traffic Incident Detection
Requires the installation... | sebchalmers/TrafficMHE | TrafficFlowRealData.py | Python | gpl-2.0 | 29,667 |
from discord.ext import commands
class simplepoll:
"""A Simple Poll System Using Reactions"""
def __init__(self, bot):
self.bot = bot
@commands.command()
async def startpoll(self, *, question):
"""Starts a poll"""
message = await self.bot.say("POLL: {}".format(question))
... | Electromaster232/Electro-Cogs | simplepoll/simplepoll.py | Python | gpl-2.0 | 1,171 |
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# This program 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 2
# of the License, or (at your option) any later versi... | tomprince/gemrb | gemrb/GUIScripts/bg2/GUICG6.py | Python | gpl-2.0 | 2,607 |
import unittest
from slack.errors import SlackObjectFormationError
from slack.web.classes.actions import (
ActionButton,
ActionChannelSelector,
ActionConversationSelector,
ActionExternalSelector,
ActionLinkButton,
ActionStaticSelector,
ActionUserSelector,
)
from slack.web.classes.objects im... | slackhq/python-slackclient | tests/web/classes/test_actions.py | Python | mit | 6,006 |
from ultimatetictactoe import game
import datetime
def one_game_time():
bot1 = game.players.ai.HeuristicsBot('B1')
bot2 = game.players.ai.RandomBot('B2')
bot1.time = 0
bot2.time = 0
bot1.moves = 0
bot2.moves = 0
on_turn = bot1
board = game.boards.Macroboard()
while board.state == g... | stoimenoff/ultimate-tic-tac-toe | bottimer.py | Python | mit | 723 |
import numpy as np
class Example(object):
def __init__(self):
self.__nstates = 3
self.__estates = 2
self.__tmat0 = [[0.5, 0.2, 0.3], [0.3, 0.6, 0.1], [0.2, 0.4, 0.4]]
self.__tmat1 = [[0.8, 0.1, 0.1], [0.2, 0.6, 0.2], [0.1, 0.3, 0.6]]
self.__emat0 = [[0.6, 0.4], [0.8, 0.2], ... | guanhuamai/DPM | PythonSource/main3.py | Python | mit | 3,568 |
"""Support for Epson Workforce Printer."""
from datetime import timedelta
import logging
from epsonprinter_pkg.epsonprinterapi import EpsonPrinterAPI
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_HOST, CONF_MONITORED_CONDITIONS, PERCENTAGE
fr... | tchellomello/home-assistant | homeassistant/components/epsonworkforce/sensor.py | Python | apache-2.0 | 2,702 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013, 2014, 2015 CERN.
#
# Invenio 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 2 of the
# License, or (at your optio... | jirikuncar/invenio-groups | invenio_groups/__init__.py | Python | gpl-2.0 | 784 |
# -*- coding: utf-8 -*- t
"""
A harvester for metadata from eLife on Github for the SHARE project
Sample API call:https://api.github.com/repos/elifesciences/elife-articles/commits?since=2015-12-22&until=2015-12-31&page=1&per_page=100
Will need to set up Personal access token
"""
from __future__ import unicode_literal... | erinspace/scrapi | scrapi/harvesters/elife.py | Python | apache-2.0 | 5,991 |
"""
FeatureResponses and associated functions and classes.
These classes implement map and tuning curve measurement based
on measuring responses while varying features of an input pattern.
"""
import copy
from collections import defaultdict
import numpy as np
import param
from param.parameterized import ParamOverr... | ioam/topographica | topo/analysis/featureresponses.py | Python | bsd-3-clause | 16,083 |
"""
Python 3 reorganized the standard library (PEP 3108). This module exposes
several standard library modules to Python 2 under their new Python 3
names.
It is designed to be used as follows::
from future import standard_library
standard_library.install_aliases()
And then these normal Py3 imports work on bo... | krischer/python-future | src/future/standard_library/__init__.py | Python | mit | 27,159 |
__author__ = 'dev'
import re
from http.server import SimpleHTTPRequestHandler
HEADERS_HOST_PARAMETER_KEY_NAME = "Host"
REQUEST_LINE_ENCODING = "iso-8859-1"
HOST_PATTERN_KEY_NAME = "host_pattern"
RESPONSE_CONTENT_PATH_KEY_NAME = "response_content_path"
class FakeHTTPRequestHandler(SimpleHTTPRequestHandler):
def... | stubbfel/fakeservices | src/fake_services/service/webservice/fake_http_request_handler.py | Python | mit | 2,003 |
"""
Copyright (c) 2014-2015, The University of Texas at Austin.
All rights reserved.
This file is part of BLASpy and is available under the 3-Clause
BSD License, which can be found in the LICENSE file at the top-level
directory or at http://opensource.org/licenses/BSD-3-Clause
"""
from .acceptan... | nicholas-moreles/blaspy | bp_acceptance_tests/level_3/__init__.py | Python | bsd-3-clause | 642 |
import numpy as np
import OpenGL.GL as gl
from galry import log_debug, log_info, log_warn, get_color, GLRenderer, \
Manager, TextVisual, RectanglesVisual, SceneCreator, serialize, \
GridVisual
__all__ = ['PaintManager']
# PaintManager class
# ------------------
class PaintManager(Manager):... | rossant/galry | galry/paintmanager.py | Python | bsd-3-clause | 9,818 |
from distutils.core import setup
setup(name='GLCD_SDK',
version='0.0.1',
description='Python Wrapper for Logitech LCD SDK',
install_requires=['python=2.7'],
author='Thomas Portassau',
author_email='50thomatoes50@gmail.com',
url='https://github.com/50thomatoes50/GLCD_SDK.py',
py... | 50thomatoes50/GLCD_SDK.py | setup.py | Python | mpl-2.0 | 534 |
#!/usr/bin/env python
# -*- encoding:utf-8 -*-
import json
import os
import requests
import sys
from pytube import YouTube
# Settings
CODEC = 'mp4'
RESOLUTION = '720p'
YOUTUBE_WATCH_URL = "https://www.youtube.com/watch?"
YOUTUBE_API_URL = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet"
PLAYLIST_ID... | fjt7tdmi/atelier-video | download.py | Python | mit | 1,270 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | denny820909/builder | lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/test/unit/test_db_migrate_versions_018_add_sourcestampset.py | Python | mit | 10,021 |
import pyotp
from django.test import TestCase
from watchdog_id.auth_factories.totp.managers import TOTPManager
from watchdog_id.users.factories import UserFactory
class TestTOTPManager(TestCase):
def test_get_totp_secret(self):
manager = TOTPManager({}, UserFactory())
self.assertEquals(manager.ge... | watchdogpolska/watchdog-id | watchdog_id/auth_factories/totp/tests/test_managers.py | Python | mit | 905 |
# coding: utf-8
"""Crypto related utilities."""
import base64
import random
import string
from Crypto.Cipher import AES
from modoboa.parameters import tools as param_tools
def random_key(l=16):
"""Generate a random key.
:param integer l: the key's length
:return: a string
"""
punctuation = """... | carragom/modoboa | modoboa/lib/cryptutils.py | Python | isc | 1,230 |
from test_admin import * | FrankSalad/django-memcache-status | memcache_status/tests/__init__.py | Python | bsd-3-clause | 24 |
class Error ( Exception ):
"""Exception class for Address exceptions"""
def __init__( self, message ) :
Exception.__init__(self,message)
| SPlanzer/AIMS | ElectoralAddress/Error.py | Python | bsd-3-clause | 159 |
import sys
sys.path.append("..")
import numpy as np
import matplotlib.pyplot as plt
import gandalf.neuralnetwork as neuralnetwork
def sampledata(n):
X = np.zeros((2*n,2))
y = np.zeros(2*n)
X[:n,0] = np.random.normal(loc=1.0, scale=0.5, size=[n])
X[:n,1] = np.random.normal(loc=-1.0, scale=0.5, size=[n... | longyangking/ML | Home-made/NeuralNetwork/simple_classification.py | Python | lgpl-3.0 | 1,078 |
# (c) 2013, Daniel Hokka Zakrisson <daniel@hozac.com>
# (c) 2014, Serge van Ginderachter <serge@vanginderachter.be>
#
# This file is part of Ansible
#
# Ansible 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, ... | jotes/ansible | v2/ansible/inventory/dir.py | Python | gpl-3.0 | 10,511 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from google.appengine.ext import ndb
from gaegraph.model import Node
from gaeforms.ndb import property
class Categoria(Node):
nome = ndb.StringProperty(required=True)
categoria_pai = ndb.StringProperty(required=True)
@classmethod
de... | iwilliam317/tekton | backend/apps/categoria/model.py | Python | mit | 394 |
from migen import *
from migen.genlib.record import Record, layout_len
from migen.genlib.fsm import FSM
from misoc.interconnect.csr import *
from misoc.interconnect import stream, wishbone
from artiq.gateware.rtio import cri
def _reverse_bytes(s, g):
return Cat(reversed(list(s[i*g:(i+1)*g] for i in range(len(s)/... | JQIamo/artiq | artiq/gateware/rtio/dma.py | Python | lgpl-3.0 | 11,793 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------
# Project : Stock commision fee calculator
#
# File name : stock.py
#
# Author : Cheang Shian Chin
#
# Date created : 20 Nov 2015
#
# Purpose : Calculate stoc... | shianchin/mini_projects | stock_commision_fee_cal/stock.py | Python | apache-2.0 | 6,253 |
# MIT License
#
# Copyright (C) IBM Corporation 2020
#
# 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
# rights to use, copy, modify, merge... | IBM/differential-privacy-library | diffprivlib/models/utils.py | Python | mit | 4,973 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test a node with the -disablewallet option.
- Test that validateaddress RPC works when running with -d... | faircoin/faircoin | test/functional/disablewallet.py | Python | mit | 1,403 |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import multiprocessing
from test_result import TestResults
def _ShardedTestRunnable(test):
"""Standalone function needed by multipro... | keishi/chromium | build/android/pylib/base_test_sharder.py | Python | bsd-3-clause | 3,483 |
# -*- coding: utf-8 -*-
{
'name': "Sparse Fields",
'summary': """Implementation of sparse fields.""",
'description': """
The purpose of this module is to implement "sparse" fields, i.e., fields
that are mostly null. This implementation circumvents the PostgreSQL
limitation on the num... | jeremiahyan/odoo | addons/base_sparse_field/__manifest__.py | Python | gpl-3.0 | 650 |
#! /usr/bin/env python
from zplot import *
t = table('horizontalintervals.data')
canvas = postscript('horizontalintervals.eps')
d = drawable(canvas, coord=[50,30], xrange=[0,900],
yrange=[0,t.getmax('nodes')])
axis(d, xtitle='Throughput (MB)', xauto=[0,900,300],
ytitle='Nodes', yauto=[0,t.getmax('no... | z-plot/z-plot | examples/basics/horizontalintervals.py | Python | bsd-3-clause | 492 |
__author__ = 'sjp1'
import math
CONVERT_TO_MILLI = 1e3
CONVERT_M_TO_CM = 1e2
print('Circuit:')
voltage = 5 # V
print('Voltage source:', voltage)
resistor = 50 # ohm
print('Resistor:', resistor)
I = voltage / resistor # A
print('Current:', I, 'C/s')
q = 1.602e-19 # C
print('Charge on electron:', q, 'C')
electron_per_... | JediStuart/PythonFirst | src/ElectronMass.py | Python | gpl-2.0 | 4,226 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 6 22:51:00 2017
@author: georg
"""
from multiprocessing import Pool, cpu_count
def _fit_with(leverage):
global add_leverage
add_leverage = leverage
def _bic_of(model):
if add_leverage and hasattr(model, 'add_leverage'):
mod... | yedivanseven/Commodities | helpers/best.py | Python | gpl-3.0 | 1,582 |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | google/clif | setup.py | Python | apache-2.0 | 3,600 |
# -*- coding: utf-8 -*-
from baka.core import Environment
from baka.core import Container
from baka.core import Project
class TestEnvironment:
def test_scripts(self):
dummy_c = Container(Project())
env = Environment(scripts={
'setup': "require('python', '3.5.0'); require('baka', '0.1.... | tim-sueberkrueb/grout | tests/core/test_environment.py | Python | mit | 363 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import os
from pyowm import owm
from pyowm.agroapi10.polygon import GeoPolygon
from pyowm.commons.enums import ImageTypeEnum
from pyowm.agroapi10.enums import SatelliteEnum, PresetEnum
from pyowm.agroapi10.imagery import MetaImage
class IntegrationTestsSa... | csparpa/pyowm | tests/integration/agroapi10/test_integration_satellite_imagery_search.py | Python | mit | 5,105 |
"""
Simple GLM with two neurons connected by a complete network with Gaussian weights.
"""
SimpleSparseModel = \
{
# Number of neurons (parametric model!)
'N' : 2,
# Parameters of the nonlinearity
'nonlinearity' :
{
'type' : 'exp'
},
# Parameters of the bias ... | slinderman/theano_pyglm | pyglm/models/simple_sparse_model.py | Python | mit | 1,863 |
from categories.models import Category
def save(self, *args, **kwargs):
if self.thumbnail:
from django.core.files.images import get_image_dimensions
import django
if django.VERSION[1] < 2:
width, height = get_image_dimensions(self.thumbnail.file)
else:
width... | miceno/django-categories | doc_src/code_examples/custom_categories4.py | Python | apache-2.0 | 548 |
import hmac
import uuid
from hashlib import sha1
from django.db import models
from django.utils.translation import ugettext_lazy as _lazy
from mozillians.users.managers import PRIVACY_CHOICES, PRIVILEGED, PUBLIC
from mozillians.users.models import PrivacyField, UserProfile
class APIv2App(models.Model):
API_PRI... | fxa90id/mozillians | mozillians/api/models.py | Python | bsd-3-clause | 1,647 |
"""
Support for Efergy sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.efergy/
"""
import logging
import requests
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_C... | nugget/home-assistant | homeassistant/components/sensor/efergy.py | Python | apache-2.0 | 5,625 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Driver for aom.py
import sys
print(sys.path)
import os, re, time, subprocess
iterModDiv = 1
#dirPathList = ["/home/tomas/documenten/modelling/diatomas_symlink/results/aom_seed1_anmeStick_randomInit09BasedOn07","/home/tomas/documenten/modelling/diatomas_symlink/results/ao... | tomasstorck/diatomas | blender/aomdriver.py | Python | mit | 2,210 |
import time
import json
import pytz
from datetime import datetime, timedelta
from django.utils import timezone
from django.conf import settings
from rest_framework import status
from rest_framework.decorators import api_view, permission_classes
from rest_framework.response import Response
from rest_framework.permissi... | dspichkin/djangodashpanel | djangodashpanel/security/views.py | Python | gpl-3.0 | 9,113 |
from collections import deque
'''
BFS time complexity : O(|E| + |V|)
BFS space complexity : O(|E| + |V|)
do BFS from (0,0) of the grid and get the minimum number of steps needed to get to the lower right column
only step on the columns whose value is 1
if there is no path, it returns -1
Ex 1)
If grid is
[[1,0,1,1,... | keon/algorithms | algorithms/bfs/maze_search.py | Python | mit | 1,487 |
#
# 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
# ... | dims/neutron | neutron/db/migration/alembic_migrations/versions/mitaka/contract/8a6d8bdae39_migrate_neutron_resources_table.py | Python | apache-2.0 | 3,349 |
import string
from xml.xslt import NullWriter, PlainTextWriter
from xml.xslt import HtmlWriter, XmlWriter
class OutputHandler(NullWriter.NullWriter):
def __init__(self, outputParams, stream, notifyFunc):
self._outputParams = outputParams
self._stream = stream
self._notify = notifyFunc
... | Pikecillo/genna | external/PyXML-0.8.4/xml/xslt/OutputHandler.py | Python | gpl-2.0 | 1,858 |
import sys
from resource_management import *
import subprocess
class Master(Script):
def install(self, env):
subprocess.call("/home/ubuntu/InstaCluster/script/hue/hue_server.sh", shell=True)
def stop(self, env):
subprocess.call("/home/ubuntu/InstaCluster/script/hue/hue_stop.sh", shell=True)
def start(sel... | deib-polimi/InstaCluster | resources/HUE/package/scripts/master.py | Python | apache-2.0 | 611 |
# Compile c program to print output of journal file
# Run c program with service input
# Parse results and output whenever they change
# Imports
from subprocess import Popen, PIPE
import sys
def compile():
p1 = Popen(['cc', '-o', 'parseJournal',
'parseJournal.c', '-lsystemd-journal'])
p1.co... | catmanjan/fireman | src/services/journalmonitor.py | Python | gpl-2.0 | 423 |
from ..properties.geometry import *
from ..icons.__init__ import *
def ui_template_geometry_header(layout, data):
ob = data.name
OB = ob.upper().replace('.', '_')
row = layout.row()
# Show/Hide part
row.prop(data, 'show_part', icon_value=(get_icon('MINIFIG_%s_OFF' % OB) if data.show_part else get_... | feureau/Small-Scripts | Blender/Blender config/2.91/scripts/addons/mecafig/ui_templates/geometry.py | Python | gpl-3.0 | 1,837 |
from matexpr import ShapeError
from matpow import MatPow
class Inverse(MatPow):
"""Matrix Inverse
Represents the Inverse of a matrix expression
Use .I as shorthand
>>> from sympy import MatrixSymbol, Inverse
>>> A = MatrixSymbol('A', 3, 3)
>>> B = MatrixSymbol('B', 3, 3)
>>> Inverse(A)
... | ichuang/sympy | sympy/matrices/expressions/inverse.py | Python | bsd-3-clause | 1,278 |
#!/usr/bin/env python
#
# Copyright (C) 2011, 2012 Google Inc.
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe 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 the License, or
# (... | reinhrst/ycmd | ycmd/completers/cpp/flags.py | Python | gpl-3.0 | 8,322 |
__version__ = "0.2.7"
from pypushover.Constants import PRIORITIES, SOUNDS, OS
from pypushover._base import BaseManager, send, base_url, PushoverError
from pypushover import client, groups, license, message, verification
__all__ = ['PRIORITIES', 'SOUNDS', 'OS', 'client', 'groups', 'license', 'message', 'verification'... | KronosKoderS/py_pushover | pypushover/__init__.py | Python | mit | 324 |
#!/usr/bin/python
import os, sys
import pycurl
from optparse import OptionParser
if __name__ == "__main__":
parser = OptionParser(usage='Usage: %prog url')
(options, args) = parser.parse_args()
if len(args) < 1:
parser.print_usage()
sys.exit(1)
url = args[0]
c = pycurl.Curl()
... | eucalyptus/eucalyptopotamus | django/eucapp/client/delete.py | Python | bsd-2-clause | 573 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
import erpnext
import calendar
import random
from erpnext.accounts.utils import get_fiscal_year
from frappe.utils.make_ran... | ESS-LLP/erpnext | erpnext/payroll/doctype/salary_slip/test_salary_slip.py | Python | gpl-3.0 | 33,144 |
# 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 by applicable law or agreed to in wri... | jumpstarter-io/keystone | keystone/notifications.py | Python | apache-2.0 | 27,747 |
# -*- coding: utf-8 -*-
import os
import argparse
import markdoc
parser = argparse.ArgumentParser(**{
'prog': 'markdoc',
'description': 'A lightweight Markdown-based wiki build tool.',
})
parser.add_argument('-v', '--version', action='version',
version=markdoc.__version__)
config = parser.add_argumen... | snoozbuster/markdoc | src/markdoc/cli/parser.py | Python | unlicense | 1,053 |
"""
Serializer fields that deal with relationships.
These fields allow you to specify the style that should be used to represent
model relationships, including hyperlinks, primary keys, or slugs.
"""
from __future__ import unicode_literals
from django.core.exceptions import ObjectDoesNotExist, ValidationError
... | hsfzxjy/wisecitymbc | site_packages/rest_framework/relations.py | Python | gpl-2.0 | 25,433 |
import sys
import time
from ..projectmanager.widget import AssetWidget, AssetModel
from ...vendor.Qt import QtWidgets, QtCore, QtGui
from ... import api, io, style
from .. import lib
from .lib import refresh_family_config
from .widgets import SubsetWidget, VersionWidget, FamilyListWidget
module = sys.modules[__name... | MoonShineVFX/core | avalon/tools/cbloader/app.py | Python | mit | 10,714 |
from django.utils import timezone
from dateutil.relativedelta import relativedelta
from edc_constants.constants import SCREENED
from edc_registration.models import RegisteredSubject
from edc_identifier.models import SubjectIdentifier
from edc_constants.constants import FAILED_ELIGIBILITY, OFF_STUDY, SCHEDULED, POS, YES... | TshepangRas/tshilo-dikotla | td_maternal/tests/test_maternal_lab_del.py | Python | gpl-2.0 | 4,027 |
#!/usr/bin/python
import argparse
from scripting_utils import *
set_log_tag('BUILD-APP')
if __name__ != "__main__":
error('Error. Do not import this script, but run it explicitly.')
exit()
# ------------------------------------------------------------------
# Arguments.
parser = argparse.ArgumentParser(descr... | adjust/cocos2dx_sdk | scripts/make_cocos_project.py | Python | mit | 3,880 |
#############################################################################
# volumes.py
# this file is part of GEOCUBIT #
# #
# Created by Emanuele... | carenelarmat/Conejo | CUBIT_GEOCUBIT/geocubitlib/volumes.py | Python | gpl-2.0 | 28,245 |
"""DXR plugin for Rust. Relies on output from running rustc with -Zsave-analysis
It is somewhat painful dealing with the untyped-ness of the CSV input. We want
to treat all ids as ints rather than strings, getting this wrong causes annoying
bugs because Python will not check the type of things, but does distinguish be... | bozzmob/dxr | dxr/plugins/rust/__init__.py | Python | mit | 40,045 |
"""
This code was generated by Codezu.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
"""
from mozurestsdk.mozuclient import default as default_client
from mozurestsdk.mozuurl import MozuUrl;
from mozurestsdk.urllocation import UrlLocation
from mozure... | Mozu/mozu-python-sdk | mozurestsdk/commerce/customer/accounts/customerauditentry.py | Python | apache-2.0 | 2,910 |
# Copyright 2018-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 the License, or
# (at your option) any later versio... | chrislit/abydos | tests/distance/test_distance_baystat.py | Python | gpl-3.0 | 3,929 |
from unittest import TestCase
from mock import MagicMock
from apetools.parsers.iperfparser import IperfParser
from apetools.parsers.sumparser import SumParser
FRAGMENT = """
------------------------------------------------------------
Client connecting to 192.168.20.99, TCP port 5001
TCP window size: 16.0 KByte (defa... | rsnakamura/oldape | tests/testunits/testparsers/testpipe.py | Python | apache-2.0 | 3,708 |
import random
markup_escape = lambda text: text.replace('&', '&').replace('<', '<').replace('>', '>')
markup_unescape = lambda text: text.replace('<', '<').replace('>', '>').replace('&', '&')
class MarkupTag(object):
def __init__(self, text, pos):
self.__text = text
self.__po... | jtk1rk/xsubedit | mparser_old.py | Python | gpl-3.0 | 5,207 |
from vsg.rules import previous_line
from vsg import token
lTokens = []
lTokens.append(token.library_clause.keyword)
class rule_003(previous_line):
'''
This rule checks for blank lines or comments above the **library** keyword.
|configuring_previous_line_rules_link|
There is an additional **allow_... | jeremiah-c-leary/vhdl-style-guide | vsg/rules/library/rule_003.py | Python | gpl-3.0 | 1,326 |
"""
<Author>
Justin Cappos
(inspired from a previous version by Geremy Condra)
<Start Date>
May 15th, 2011
<Description>
Mirror code that serves upPIR files. A client obtains a list of live
mirrors from a vendor. The client then sends bit strings to the mirror and
the mirror returns XORed blocks of ... | masayoota/upPIR | uppir_mirror.py | Python | mit | 12,844 |
#!/usr/bin/python
'''
xecryptor.py - Application for Encrypting and Decrypting plain text using the (weak) XECryption algorithm.
Features:
- Compatible with Unicode characters.
- GUI!
Notes:
- Very little sanity checking.
- User is uninformed of serious errors.
Will M. Temple 08/28/13 22:22
wt@wpi.edu
Built for P... | willmtemple/XECryptor | xecryptor.py | Python | mit | 5,078 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def recursive_dirlist(rootdir):
import os
walkedlist = []
for dirname, subdirnames, filenames in os.walk(rootdir):
# append path of all filenames to walkedlist
for filename in filenames:
file_path = os.path.abspath(os.path.join(dirna... | relic7/prodimages | python/jbmodules/image_metadata/md5_unique_dup_files.py | Python | mit | 13,354 |
# -*- coding: utf8 -*-
import numpy as np
import matplotlib.pyplot as plt
if __name__ == "__main__":
data = np.loadtxt("count.txt")
wz = np.loadtxt("wz.txt")
#print data
plt.hist(data, bins=100, alpha=0.5)
plt.hist(wz, bins=100, alpha=0.5)
plt.show()
| yangsan/zhihu-python | number.py | Python | mit | 276 |
#!/usr/bin/env python2.5
#
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | robertobarreda/django-safe-browsing | safebrowsing/vendors/google/expression.py | Python | bsd-3-clause | 11,623 |
# pylint: skip-file
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2010 Rafal Wojtczuk <rafal@invisiblethingslab.com>
# Copyright (C) 2013 Marek Marczykowski <marmarek@invisiblethingslab.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GN... | kalkin/qubes-core-admin | qubes/qmemman/__init__.py | Python | gpl-2.0 | 16,687 |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2015 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
test_logging.py
~~~~~~~~~~~~~~~
'''
def test_help_message(testdir):
result = testdir... | saltstack/pytest-logging | tests/test_logging.py | Python | apache-2.0 | 5,236 |
#!/usr/bin/env python3
import os
import re
import sys
ARGS = sys.argv
ARGS.pop(0)
ARGS_JOINED = ''.join(ARGS).strip(' ')
def call_shell(cmd):
os.system(cmd)
if re.match(r'[0-9]{3,6}]', ARGS_JOINED):
call_shell('s {0}'.format(ARGS_JOINED))
elif len(ARGS_JOINED) == 10 and re.match(r'^1[45]', ARGS_JOINED):
... | eggcaker/dotfiles | bin/zsh_command_not_found_handler.py | Python | mit | 566 |
"""Encode multipart form data to upload files via POST."""
from __future__ import print_function
import mimetypes
import random
import string
_BOUNDARY_CHARS = string.digits + string.ascii_letters
def encode_multipart(fields, files, boundary=None):
r"""Encode dict of form fields and dict of files as multipart/f... | ActiveState/code | recipes/Python/578668_Encode_multipart_form_datuploading_files/recipe-578668.py | Python | mit | 2,591 |
# Copyright 2014 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 required by applicable ... | amitdeutsch/oppia | core/controllers/editor_test.py | Python | apache-2.0 | 49,537 |
from .arm import Arm
from .arm import ArmException
from .mock import MockArm
from .shell import ArmShell
| adamheins/r12 | r12/__init__.py | Python | mit | 107 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.