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 |
|---|---|---|---|---|---|
# Copyright (C) 2014, Ugo Pozo
# 2014, Câmara Municipal de São Paulo
# filters.py - definições de filtros padrão para o Anubis.
# Este arquivo é parte do software Anubis.
# Anubis é um software livre: você pode redistribuí-lo e/ou
# modificá-lo sob os termos da Licença Pública Geral GNU (GNU General Pu... | cmspsgp31/anubis | anubis/filters.py | Python | gpl-3.0 | 8,354 |
# OSError
import os
for i in range(10):
print i, os.ttyname(i)
'''
0 /dev/ttys000
1
Traceback (most recent call last):
File "exceptions_OSError.py", line 15, in <module>
print i, os.ttyname(i)
OSError: [Errno 25] Inappropriate ioctl for device
'''
| lmokto/allexceptions | exceptions_OSError.py | Python | mit | 265 |
# Copyright (C) 2013-2015 MetaMorph Software, Inc
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this data, including any software or models in source or binary
# form, as well as any drawings, specifications, and documentation
# (collectively "the Data"), to deal in the Data ... | pombredanne/metamorphosys-desktop | metamorphosys/META/deploy/gen_GME_interpreter_wxi.py | Python | mit | 5,245 |
"""
A pure Python/numpy implementation of the Steihaug-Toint
truncated preconditioned conjugate gradient algorithm as described in
T. Steihaug, *The conjugate gradient method and trust regions in large scale
optimization*, SIAM Journal on Numerical Analysis **20** (3), pp. 626-637,
1983.
.. moduleauthor:: D. Or... | PythonOptimizers/NLP.py | nlp/optimize/pcg.py | Python | lgpl-3.0 | 7,395 |
import json
import urllib2
import urllib
import webbrowser
from alp.settings import Settings
from feedback import Feedback
_DEFAULTHOST = "http://localhost:8080"
def set_APIKey(key):
Settings().set(apikey=key.strip())
print "API key changed!"
def get_APIKey():
return Settings().get("apikey")
def set_... | Fogh/SABnzbd-Alfred | source/sabAlfred.py | Python | unlicense | 2,871 |
"""Support for RFXtrx binary sensors."""
import logging
import voluptuous as vol
from homeassistant.components import rfxtrx
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA, BinarySensorDevice)
from homeassistant.const import (
CONF_COMMAND_OFF, CONF_COMMAND_ON, CON... | molobrakos/home-assistant | homeassistant/components/rfxtrx/binary_sensor.py | Python | apache-2.0 | 7,619 |
'''
@author: Youyk
'''
import os
import tempfile
import uuid
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
test_stub = test_lib.lib_get_test_stub()
test_obj_dict = test_state.TestStateDict()
tmp_file = '/tmp/... | quarkonics/zstack-woodpecker | integrationtest/vm/installation/upgrade/test_zs_upgd_on_ub14.py | Python | apache-2.0 | 1,495 |
"""
This plugin adds a test id (like #1) to each test name output. After
you've run once to generate test ids, you can re-run individual
tests by activating the plugin and passing the ids (with or
without the # prefix) instead of test names.
For example, if your normal test run looks like::
% nosetests -v
tests.t... | ktan2020/legacy-automation | win/Lib/site-packages/nose-1.2.1-py2.7.egg/nose/plugins/testid.py | Python | mit | 9,641 |
from itertools import islice
with open('day3_input.txt') as triangles_file:
possible_triangles = 0
# clever idiomatic use of zip from stackoverflow/python docs:
# https://stackoverflow.com/questions/6890065/
triangles_file_slices = list(zip(*[iter(triangles_file)]*3))
for triangles_file_slice in tr... | twrightsman/advent-of-code-2016 | advent2016_day3_pt2.py | Python | unlicense | 805 |
# 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... | openstack/tosca-parser | toscaparser/tests/test_properties.py | Python | apache-2.0 | 15,137 |
from flask import Flask
from flask.views import MethodView
app = Flask(__name__)
class HelloView(MethodView):
def get(self):
return "Hello World, with GET, " \
"from a class-based view!"
def post(self):
return "Hello World, with POST, " \
"from a class-based view!"... | rafaelmartins/flask-pybr9 | pybr9/examples/ex3.py | Python | bsd-3-clause | 415 |
class ParsedResource(object):
"""
Parent class for parsed resources as returned by parse.
Each supported format parser should return an instance of a class
that inherits from this class.
"""
@property
def translations(self):
"""
Return a list of VCSTranslation instances or s... | participedia/pontoon | pontoon/sync/formats/base.py | Python | bsd-3-clause | 736 |
files = ["dphy_lane.v",
"dphy_serdes.v",
"dsi_core.v",
"dsi_packer.v",
"dsi_packet_assembler.v",
"dsi_timing_gen.v",
"dsi_utils.v"]
| twlostow/dsi-shield | hdl/rtl/dsi_core/Manifest.py | Python | lgpl-3.0 | 186 |
import intrepyd as ip
from intrepyd.engine import EngineResult
import A7E_requirements
import time
import sys
# Property 3:
#
# If the system is in WpnDel modes BOC or SBOC,
# then NavUpd is in AflyUpd
#
#
# In formula:
#
# F := (WpnDel=BOC \/ WpnDel=SBOC) -> NavUpd=AflyUpd
#
#
# Reachability query: !F
#
# !F ... | formalmethods/intrepyd | examples/A7E_requirements/A7E_requirements_verification.py | Python | bsd-3-clause | 2,986 |
# Copyright (C) 2006 Joe Wreschnig
#
# 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 version.
"""MPEG audio stream information ... | quodlibet/mutagen | mutagen/mp3/__init__.py | Python | gpl-2.0 | 14,895 |
# final.py
class FinalGrade(Object):
def init(current_grade, projected_grade):
current_grade = (current_grade * .85)
projected_grade = (projected_grade * .15)
return current_grade + projected_grade | AsyncNick/FinalGrade | python/finalgrade/final.py | Python | mit | 209 |
# -*- coding: UTF-8 -*-
from gi.repository import Gtk, Pango
from pychess.System import uistuff
from pychess.System.prefix import addDataPrefix
from pychess.System.glock import *
from pychess.Utils.const import *
from pychess.Utils.repr import reprColor, reprPiece
from pychess.Utils.lutils.lsort import staticExchangeE... | importsfromgooglecode/pychess | sidepanel/commentPanel.py | Python | gpl-3.0 | 9,492 |
import unittest
import random
import numpy as np
from nose.tools import assert_equal, assert_true, \
assert_false, assert_almost_equal, assert_raises
import networkx as nx
from sampler import quota_upperbound, UBSampler, RandomSampler, \
node_scores_from_tree, AdaptiveSampler, DeterministicSampler
def t... | xiaohan2012/lst | test_sampler.py | Python | mit | 5,635 |
# -*- coding: utf-8 -*-
"""
debug.py - Functions to aid in debugging
Copyright 2010 Luke Campagnola
Distributed under MIT/X11 license. See license.txt for more information.
"""
from __future__ import print_function
import sys, traceback, time, gc, re, types, weakref, inspect, os, cProfile, threading
from . import p... | SpaceGroupUCL/qgisSpaceSyntaxToolkit | esstoolkit/external/pyqtgraph/debug.py | Python | gpl-3.0 | 41,299 |
def hello_name(name):
return "Hello " + name +"!" | ismk/Python-Examples | codingbat/hello_name.py | Python | mit | 51 |
'''
modifier: 01
eqtime: 10
'''
def main():
info("Jan Air Sniff Pipette x1")
gosub('jan:WaitForMiniboneAccess')
gosub('jan:PrepareForAirShot')
open(name="Q", description="Quad Inlet")
close(name="T", description="Microbone to CO2 Laser")
gosub('jan:EvacPipette2')
gosub('common:FillPipette2')... | USGSDenverPychron/pychron | docs/user_guide/operation/scripts/examples/argus/extraction/jan_sniffair_x1_split_with_getter_90fA.py | Python | apache-2.0 | 1,179 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import sys
from matplotlib import pyplot as plt
import numpy as np
import argparse
def getKaryotype(fname):
"""returns dictionary e.g.: {'chr13': 115169878, ... } """
data = [i.strip().split() for i in open(fname) if i[:3] == 'chr']... | ramidas/ChIA-PET_sigvis | drawSignal.py | Python | mit | 2,104 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2008-2009 Zuza Software Foundation
#
# This file is part of Virtaal.
#
# 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 ... | unho/virtaal | virtaal/controllers/baseplugin.py | Python | gpl-2.0 | 2,488 |
from . import vertical_lift_shuttle
| OCA/stock-logistics-warehouse | stock_vertical_lift_server_env/models/__init__.py | Python | agpl-3.0 | 36 |
import json
import logging
import tornado
from db.client import sanitise_data
from handlers.base import BaseHandler
logger = logging.getLogger(__name__)
class HomeHandler(BaseHandler):
@tornado.gen.coroutine
def get(self):
user = self.get_current_user()
future = self.db.pages.find_one({'pag... | jwnwilson/noelwilson_2017 | server/handlers/home.py | Python | mit | 745 |
from .main import MyCli
import sql.parse
import sql.connection
import logging
_logger = logging.getLogger(__name__)
def load_ipython_extension(ipython):
# This is called via the ipython command '%load_ext mycli.magic'.
# First, load the sql magic if it isn't already loaded.
if not ipython.find_line_magi... | danieljwest/mycli | mycli/magic.py | Python | bsd-3-clause | 1,496 |
import unittest
import helper
class TestBuiltin(helper.TestCtypesBindingGenerator):
def test_size_t(self):
self.run_test('''
#include <stdio.h>
size_t size;
ssize_t ssize;
wchar_t wchar;
wchar_t *wchar_p;
va_list va_list_v;
''', '''
class __va_list_tag(Structure):
pass
__va_list_tag._fields_ ... | anthrotype/ctypes-binding-generator | test/test_builtin.py | Python | gpl-3.0 | 1,057 |
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "AWS Network Firewall"
prefix = "network-firewall"
class Action(BaseAction):
def __init__(self, action: str = None) -> ... | cloudtools/awacs | awacs/network_firewall.py | Python | bsd-2-clause | 2,200 |
def cross(environment, book, row, sheet_source, column_source, column_key):
"""
Returns a single value from a column from a different dataset, matching by the key.
"""
a = book.sheets[sheet_source]
return environment.copy(a.get(**{column_key: row[column_key]})[column_source])
def column(environme... | databuild/databuild | databuild/functions/data.py | Python | bsd-3-clause | 660 |
#!/usr/bin/python
import ctypes as c
import random
import ecdsa
import hashlib
import binascii
import os
import pytest
def bytes2num(s):
res = 0
for i, b in enumerate(reversed(bytearray(s))):
res += b << (i * 8)
return res
curves = {
'nist256p1': ecdsa.curves.NIST256p,
'secp256k1': ecdsa.... | JasonLee0524/trezor-crypto-master | test_curves.py | Python | mit | 10,750 |
from library.frontend import Base
class Manager_Privacy(Base):
'''
该功能用于保存用户的机密数据,但该版本暂时不需要使用,故暂时不做展示
'''
def get(self, username, vault_password=None, force=False):
'''
获取用户privacy数据
:parm
username:用户名
vault_password:用户的vault密码
forc... | lykops/lykops | library/frontend/sysadmin/privacy.py | Python | apache-2.0 | 7,308 |
#!/bine/env python
#_*_ coding:utf-8 _*_
import signal
#define signal handler function
def myHnadler(signum,frame):
print"I received:",signum
#register signal.SIGTSTP's handler
signal.signal(signal.SIGTSTP, myHnadler)
signal.pause()
print "END of Signal Demo"
| zhengjue/mytornado | process_sync/process_sigin.py | Python | gpl-3.0 | 268 |
#!/usr/bin/env python
import sys
import json
import urllib2
import argparse
from operator import itemgetter
from prettytable import PrettyTable
AWE_URL = 'https://awe.mg-rast.org'
MGP = {
'mgrast-prod-4.0.3': [
'qc_stats',
'adapter trim',
'preprocess',
'dereplication',
'scr... | teharrison/MG-RAST | src/MGRAST/bin/awe-debuger.py | Python | bsd-2-clause | 7,160 |
import operator
from .plugin import SimStatePlugin
class SimStateCGC(SimStatePlugin):
"""
This state plugin keeps track of CGC state.
"""
#__slots__ = [ 'heap_location', 'max_str_symbolic_bytes' ]
def __init__(self):
SimStatePlugin.__init__(self)
self.allocation_base = 0xb8000000... | f-prettyland/angr | angr/state_plugins/cgc.py | Python | bsd-2-clause | 4,270 |
#!/usr/bin/python
from setuptools import setup, find_packages
setup(
name='dddir',
version='0.1',
description='dddir - creates directories from a blueprint',
author='Jan Oelze',
author_email='hallo@janoelze.de',
packages=['dddir'],
entry_points={
'console_scripts': [
'dd... | janoelze/dddir | setup.py | Python | mit | 367 |
# -*- encoding: utf-8 -*-
from supriya.tools.ugentools.Filter import Filter
class LPZ2(Filter):
r'''A two zero fixed lowpass filter.
::
>>> source = ugentools.In.ar(bus=0)
>>> lpz_2 = ugentools.LPZ2.ar(
... source=source,
... )
>>> lpz_2
LPZ2.ar()
... | andrewyoung1991/supriya | supriya/tools/ugentools/LPZ2.py | Python | mit | 2,895 |
from Soft64 import *
from Soft64.MipsR4300 import *
from System import *
from NLog import *
logger = LogManager.GetLogger("TLB Python Script")
tlb = Machine.Current.DeviceCPU.Tlb
logger.Info("Creating fake entry 0")
entry = TLBEntry()
entry.VPN2 = VirtualPageNumber2(2, 0x345)
tlb.AddEntry(0, entry)
logger.Info("Cre... | bryanperris/Soft64-Bryan | Resources/BinaryFiles/Tests/Tests_TLB.py | Python | gpl-3.0 | 712 |
# Python - 2.7.6
def day_and_time(mins):
MAX_MINUTES = 7 * 24 * 60
mins = mins % MAX_MINUTES
if mins < 0:
mins += MAX_MINUTES
hrs, mins = mins // 60, mins % 60
weeks, hrs = hrs // 24, hrs % 24
w = {
0: 'Sunday',
1: 'Monday',
2: 'Tuesday',
3: 'Wednesday',
... | RevansChen/online-judge | Codewars/7kyu/after-midnight/Python/solution1.py | Python | mit | 452 |
import textwrap
from unittest.mock import MagicMock
import pytest
from logstapo.actions import run_actions, Action, SMTPAction
from logstapo.config import ConfigError
def test_run_actions(mock_config):
logs_config = {
'both': {'actions': ['a']},
'one1': {'actions': ['a', 'b']},
'one2': {... | ThiefMaster/logstapo | tests/test_actions.py | Python | mit | 5,800 |
# Copyright 2014 Google Inc. All Rights Reserved.
"""Command for describing url maps."""
from googlecloudsdk.compute.lib import base_classes
class Describe(base_classes.GlobalDescriber):
"""Describe a URL map."""
@staticmethod
def Args(parser):
base_classes.GlobalDescriber.Args(parser)
base_classes.Add... | harshilasu/LinkurApp | y/google-cloud-sdk/lib/googlecloudsdk/compute/subcommands/url_maps/describe.py | Python | gpl-3.0 | 666 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# numcodecs documentation build configuration file, created by
# sphinx-quickstart on Mon May 2 21:40:09 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# ... | alimanfoo/numcodecs | docs/conf.py | Python | mit | 10,126 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2013-2015 Serv. Tecnol. Avanzados
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
#
# This program is free software: y... | Jortolsa/l10n-spain | l10n_es_toponyms/wizard/__init__.py | Python | agpl-3.0 | 1,118 |
#!/usr/bin/python3
import ctypes as ct
DUMMY_LIB_PATH = 'libdummy.so.0.1.0'
class Endec(object):
"""
create_unicode_buffer(aString) -> character array
create_unicode_buffer(anInteger) -> character array
create_unicode_buffer(aString, anInteger) -> character array
create_string_buffer(aString... | Zex/juicemachine | scripts/ts_lib_loader.py | Python | mit | 1,443 |
import webapp2
from feedgen.feed import FeedGenerator
from datetime import datetime, tzinfo, timedelta
from google.appengine.api import urlfetch
from google.appengine.ext import ndb
import re
import difflib
from HTMLParser import HTMLParser
import uuid
#from pytz import utc
ZERO = timedelta(0)
class UTC(tzinfo):
... | dspeyer/page2rss | main.py | Python | gpl-3.0 | 6,623 |
# coding: utf-8
# pylint: disable=too-many-lines
import inspect
import sys
from typing import TypeVar, Optional, Sequence, Iterable, List, Any
from owlmixin import util
from owlmixin.errors import RequiredError, UnknownPropertiesError, InvalidTypeError
from owlmixin.owlcollections import TDict, TIterator, TList
from ... | tadashi-aikawa/owlmixin | owlmixin/__init__.py | Python | mit | 34,064 |
__author__ = 'joseph'
import sys
import os
sys.path.insert(0,os.path.abspath('../src'))
sys.path.insert(0,os.path.abspath('../src/ChannelDebug.py'))
sys.path.insert(0,os.path.abspath('./ChannelDebugTest.py'))
#print "\n".join(sys.path)
from ChannelDebugTest import ChannelDebugTest
import unittest
if __name__ == '_... | debugchannel/debugchannel-python-client | test/test.py | Python | mit | 350 |
#!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Class for iond node under test"""
import decimal
import errno
import http.client
import json
import logging... | cevap/ion | test/functional/test_framework/test_node.py | Python | mit | 11,014 |
import json
import traceback
import unicodedata
import bel.nanopub.validate
import falcon
import structlog
log = structlog.getLogger(__name__)
class NanopubValidateResource(object):
"""Validate nanopubs"""
def on_post(self, req, resp):
# Validate nanopub only using cached assertions/annotations
... | belbio/bel_api | app/resources/nanopubs.py | Python | apache-2.0 | 2,044 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2011 - 2012, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
... | tucbill/manila | manila/openstack/common/rpc/amqp.py | Python | apache-2.0 | 25,306 |
from django.contrib import admin
from simple_history.admin import SimpleHistoryAdmin
from .models import DocumentContent, Pessoa, HistoricalPessoa, Document
# Register your models here.
@admin.register(DocumentContent)
class DocumentContentAdmin(SimpleHistoryAdmin):
list_display = ['content', 'created_at', 'crea... | luzfcb/documentos | src/core/admin.py | Python | mpl-2.0 | 757 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Program: Hourly Call Reports
# Description: Reports on # of inbound
# calls from each hour of the day. Then
# averages the hours for each day
# separately.
# Date: 2/2/15
# Author: Jeffrey Zic
import re
import fileinput
import sys
import datetime
from datetime import date, t... | Gixugif/CDRecording | Call_Detail_Directory.py | Python | gpl-3.0 | 7,758 |
"""
MagPy
Auxiliary input filter - WIC/WIK
Written by Roman Leonhardt June 2012
- contains test and read function, toDo: write function
"""
from magpy.stream import *
def isSFDMI(filename):
"""
Checks whether a file is spanish DMI format.
Time is in seconds relative to one day
"""
try:
te... | hschovanec-usgs/magpy | magpy/lib/format_sfs.py | Python | gpl-3.0 | 5,996 |
from __future__ import division
import numpy as np
from tensorprob import Model, Parameter, Normal, Exponential, Mix2
def test_mix2_fit():
with Model() as model:
mu = Parameter()
sigma = Parameter(lower=1)
a = Parameter(lower=0)
f = Parameter(lower=0, upper=1)
X1 = Norma... | ibab/tensorprob | tests/distributions/test_combinators.py | Python | mit | 3,595 |
# yacon.models.hierarchy.py
import re, logging
from django.db import models
from django.template.defaultfilters import slugify
from treebeard.mp_tree import MP_Node
from yacon.models.common import Language, TimeTrackedModel, NodePermissionTypes
from yacon.models.pages import Page, MetaPage
from yacon.definitions imp... | cltrudeau/django-yacon | yacon/models/hierarchy.py | Python | mit | 18,597 |
#!/Users/tony/Projects/zooplankton/repositories/python/gizehmoviepy/bin/python
"""PILdriver, an image-processing calculator using PIL.
An instance of class PILDriver is essentially a software stack machine
(Polish-notation interpreter) for sequencing PIL image
transformations. The state of the instance is the interpr... | Ibuprofen/gizehmoviepy | bin/pildriver.py | Python | mit | 15,563 |
# -*- coding: utf-8 -*-
# [HARPIA PROJECT]
#
#
# S2i - Intelligent Industrial Systems
# DAS - Automation and Systems Department
# UFSC - Federal University of Santa Catarina
# Copyright: 2006 - 2007 Luis Carlos Dill Junges (lcdjunges@yahoo.com.br), Clovis Peruchi Scotti (scotti@ieee.org),
# Guilh... | erggo/Harpy | harpia/bpGUI/rotate.py | Python | gpl-3.0 | 7,466 |
#!/usr/bin/python
"""Test of check menu item output."""
from macaroon.playback import *
sequence = MacroSequence()
import utils
sequence.append(KeyComboAction("<Control>f"))
sequence.append(TypeAction("Application class"))
sequence.append(KeyComboAction("Return"))
sequence.append(KeyComboAction("Return"))
sequence.... | pvagner/orca | test/keystrokes/gtk3-demo/role_check_menu_item.py | Python | lgpl-2.1 | 2,208 |
import dataset
import os
# old_db_path = os.path.join("proyectos_de_ley", "leyes_sqlite3.db")
old_db_path = os.path.join("leyes_sqlite3.db")
new_db = dataset.connect("postgresql://proyectosdeley:PASSWORD@localhost:5432/pdl")
old_db = dataset.connect("sqlite:///" + old_db_path)
res = old_db.query("select * from pdl... | proyectosdeley/proyectos_de_ley | migrate_db2postgres.py | Python | mit | 597 |
#!/usr/bin/env python
import os
config = {
"default_actions": [
'clobber',
'checkout-sources',
'get-blobs',
'update-source-manifest',
'build',
'build-symbols',
'make-updates',
'prep-upload',
'upload',
# bug 1222227 - temporarily disable... | cstipkovic/spidermonkey-research | testing/mozharness/configs/b2g/releng-otoro-eng.py | Python | mpl-2.0 | 3,997 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2017-07-28 14:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gestioneide', '0044_perfil'),
]
operations = [
migrations.AddField(
... | Etxea/gestioneide | gestioneide/migrations/0045_asistencia_borrada.py | Python | gpl-3.0 | 448 |
from pytradfri.const import ROOT_DEVICES
from pytradfri.gateway import Gateway
def test_get_device():
gateway = Gateway()
command = gateway.get_device(123)
assert command.method == 'get'
assert command.path == [ROOT_DEVICES, 123]
| r41d/pytradfri | tests/test_gateway.py | Python | mit | 249 |
"""Int textbox class."""
from invisible_ui.elements import Textbox
class IntTextbox(Textbox):
"""A text box that only allows integers."""
def __init__(self, parent, title, value="", hidden = False):
allowedChars = "1234567890"
super().__init__(parent, title, value=value, hidden=hidden, allow... | chrisnorman7/invisible_ui | invisible_ui/elements/extras/intTextbox.py | Python | gpl-2.0 | 342 |
# -*- 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-dialogflow | samples/generated_samples/dialogflow_v2beta1_generated_environments_delete_environment_sync.py | Python | apache-2.0 | 1,447 |
#
# Copyright Red Hat, Inc. 2014
#
# This work is licensed under the terms of the GNU GPL, version 2 or later.
# See the COPYING file in the top-level directory.
#
'''
Unit tests for testing some bug.py magic
'''
import pickle
import sys
import unittest
from tests import StringIO
from bugzilla import RHBugzilla
fro... | pombredanne/python-bugzilla | tests/bug.py | Python | gpl-2.0 | 2,445 |
TYPEMAP = {
"geo": "Location",
"cip": "Education",
"naics": "Industry",
"soc": "Occupation",
"story": "Story",
"map": "Map"
}
HOMEFEED = [
{
"link": "/story/04-04-2016_customStory/",
"featured": True
},
{
"link": "/story/04-04-2016_men-still-do... | tgarland1/datausa-site | datausa/general/home.py | Python | agpl-3.0 | 663 |
import csv
def fix_turnstile_data(filenames):
'''
Filenames is a list of MTA Subway turnstile text files. A link to an example
MTA Subway turnstile text file can be seen at the URL below:
http://web.mta.info/developers/data/nyct/turnstile/turnstile_110507.txt
As you can see, there are numerous... | kwailamchan/programming-languages | python/data_science/NYC/wrangle05_fix_turnstile_data.py | Python | mit | 1,781 |
# *- coding: utf-8 -*-
# mailbox.py
# Copyright (C) 2013-2015 LEAP
#
# 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.
#
#... | kalikaneko/bitmask-dev | src/leap/bitmask/mail/imap/mailbox.py | Python | gpl-3.0 | 33,130 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Byacc(AutotoolsPackage):
"""Berkeley Yacc is an LALR(1) parser generator. Berkeley Yacc h... | rspavel/spack | var/spack/repos/builtin/packages/byacc/package.py | Python | lgpl-2.1 | 908 |
import statsmodels.api as sm
from . import common_fields
from . import make_gaps
from . import tools
from .device_event import make_alarm_event
def apply_loess(solution, num_days, gaps):
"""Solves the blood glucose equation over specified period of days
and applies a loess smoothing regression to the da... | tidepool-org/dfaker | dfaker/cbg.py | Python | bsd-2-clause | 2,185 |
'''
:since: 10/09/2016
:author: oblivion
'''
import json
import os.path
import logging
from serverhud import ws
from serverhud.ws import logger
import tornado.ioloop
from functools import partial
from watchdog.events import FileSystemEventHandler
class AccessHandler(FileSystemEventHandler):
instances = 0
... | deadbok/server-hud | serverhud/ws/access.py | Python | gpl-2.0 | 2,509 |
from __future__ import absolute_import, unicode_literals
import os
from django import VERSION as DJANGO_VERSION
from django.utils.translation import ugettext_lazy as _
######################
# MEZZANINE SETTINGS #
######################
# The following settings are already defined with default values in
# the ``de... | molokov/mezzanine | mezzanine/project_template/project_name/settings.py | Python | bsd-2-clause | 11,708 |
# First run the _ImportScript.py so that these don't have to be imported:
#import numpy as np
#import math
#import beatbox
#import os.path
#import healpy as hp
np.random.seed(1)
# declaring initial objects
#You=beatbox.Multiverse(truncated_nmax=2, truncated_nmin=1, truncated_lmax=8, truncated_lmin=2)
beatbox.You.crea... | drphilmarshall/Music | Scripts/_ReconstructionScript.py | Python | mit | 4,797 |
import datetime
import uuid
from sqlalchemy import (
Column, Index, String, Text, DateTime, Integer, ForeignKey, Table, func)
from sqlalchemy.orm import relationship
from sqlalchemy.dialects.mysql import DOUBLE
from porick import app, db
QSTATUS = {'unapproved': 0,
'approved': 1,
'disappro... | stesh/porick-flask | porick/models.py | Python | apache-2.0 | 4,414 |
"""
.. versionadded:: 2017.7
Management of Zabbix Valuemap object over Zabbix API.
:codeauthor: Jakub Sliva <jakub.sliva@ultimum.io>
"""
import json
import logging
from salt.exceptions import SaltException
log = logging.getLogger(__name__)
def __virtual__():
"""
Only make these states available if Zabbix... | saltstack/salt | salt/states/zabbix_valuemap.py | Python | apache-2.0 | 8,306 |
from rest_framework.serializers import Serializer
from rest_framework_expander.context import ExpanderContext
from rest_framework_expander.exceptions import ExpanderFieldMissing, ExpanderDepthBreached
from rest_framework_expander.settings import expander_settings
class ExpanderParser(object):
"""
Parses the ... | pombredanne/drf-expander | rest_framework_expander/parsers.py | Python | isc | 2,182 |
#!/usr/bin/python
import urllib2
import sys
import os
import os.path
import tarfile
#-------------------------------------------------------------------------------
# FUNCTION: DOWNLOAD FILE
#-------------------------------------------------------------------------------
def download(url, filename):
print "Fetchi... | Hvitnov/WebViewer | scripts/download_external.py | Python | mit | 1,073 |
import math
from math import sin, cos
import numarray
from OpenGL.GL import *
from flapp.pmath.vec3 import *
from flapp.glDrawUtils import DrawAxis
class GlobeLayer:
def __init__(self, latSize, lonSize):
self.latSize = latSize
self.lonSize = lonSize
print "Creating layer:", self.latSize, " ... | rpwagner/tiled-display | flapp/globe.py | Python | apache-2.0 | 3,743 |
from microservices.queues.client import Client
client = Client()
q = client.queue('basic_queue')
q.publish({"message": "Hello, world!"})
| aclef/microservices | examples/queue/hello_world_client.py | Python | mit | 140 |
#!/usr/bin/python2.7
import numpy as np
import numpy.core.multiarray
import cv2
def to_hsv(img):
hsv_img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
return hsv_img
def detect_white(img):
hsv_img = to_hsv(img)
sensitivity = 100
lower_white = np.array([0,0,255-sensitivity], dtype=np.uin... | lazim2142/carrt_goggles | src/crosswalk_detector.py | Python | mit | 2,463 |
#!/usr/bin/env python
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import moviedata
class MainWindow(QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.movies = moviedata.MovieContainer()
self.table = QTableWidget()
self... | opensvn/python | mymovies.py | Python | gpl-2.0 | 877 |
# encoding: utf-8
# Copyright 2013 maker
# License
"""
Events module forms
"""
from django import forms
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from maker.events.models import Event
from maker.core.models import Object, Location
from maker.core.decorators im... | alejo8591/maker | events/forms.py | Python | mit | 5,514 |
## @file
# Apply fixup to VTF binary image for FFS Raw section
#
# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full tex... | carmark/vbox | src/VBox/Devices/EFI/Firmware/UefiCpuPkg/ResetVector/Vtf0/Tools/FixupForRawSection.py | Python | gpl-2.0 | 3,932 |
#!/usr/bin/env python
# Copyright (c) 2017,2018, F5 Networks, 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 app... | ryan-talley/f5-cccl | f5_cccl/resource/ltm/monitor/test/test_monitor.py | Python | apache-2.0 | 3,156 |
"""TI Common module."""
# standard library
import logging
import re
from typing import Dict, List, Optional
from urllib.parse import quote
# third-party
import jmespath
from requests import Session
# first-party
from tcex.backports import cached_property
from tcex.exit.error_codes import handle_error
# get tcex logg... | ThreatConnect-Inc/tcex | tcex/api/tc/utils/threat_intel_utils.py | Python | apache-2.0 | 14,975 |
# Copyright 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
from telemetry.core import exceptions
from telemetry import decorators
from telemetry.page import action_runner as action_runner_module
cla... | lihui7115/ChromiumGStreamerBackend | tools/telemetry/telemetry/page/page_test.py | Python | bsd-3-clause | 7,601 |
# -*- coding: utf-8 -*-
from django import forms
from django_countries.fields import countries
from api.models import Event
from api.models.events import EventTheme, EventAudience
class AddEventForm(forms.ModelForm):
email_errors = {
'required': u'Please enter a valid email, so we can contact you in case... | codeeu/coding-events | web/forms/event_form.py | Python | mit | 10,889 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# cleanexe - [insert a few words of module description on this line]
# Copyright (C) 2003-2009 The MiG Project lead by Brian Vinter
#
# This file is part of MiG.
#
# MiG is free software: you can redistribute it and/or modify
# it under the terms of ... | heromod/migrid | mig/cgi-bin/cleanexe.py | Python | gpl-2.0 | 1,104 |
"""
Some analysis of the gift file:
we begin by creating a list of the volumes of each gift, output to the file 'presentVolumes.csv'
as a file with each volume on a separate line
input is the presents.csv file from the challenge website
Tim Dellinger
Kaggle Santa Challenge, Christmas 2013
"""
from numpy import ... | timdellinger/kaggle-xmas-2013 | calculateVolumes.py | Python | unlicense | 1,516 |
# -*- coding: utf-8 -*-
import pytest
import env # noqa: F401
m = pytest.importorskip("pybind11_tests.virtual_functions")
from pybind11_tests import ConstructorStats # noqa: E402
def test_override(capture, msg):
class ExtendedExampleVirt(m.ExampleVirt):
def __init__(self, state):
super(Ext... | google-research/motion_imitation | third_party/unitree_legged_sdk/pybind11/tests/test_virtual_functions.py | Python | apache-2.0 | 11,417 |
#!/usr/bin/env python
#
# mock_data.py: utility classes and functions for generating test data
# Copyright (C) University of Manchester 2014 Peter Briggs
#
########################################################################
#
# mock_utils.py
#
###############################################################... | fw1121/genomics | bcftbx/test/mock_data.py | Python | artistic-2.0 | 8,581 |
import requests
from requests import Session
from requests.exceptions import HTTPError
try:
from urllib.parse import urlencode, quote
except:
from urllib import urlencode, quote
import json
import math
from random import uniform
import time
from collections import OrderedDict
from sseclient import SSEClient
im... | ininex/geofire-python | resource/lib/python2.7/site-packages/pyrebase/pyrebase.py | Python | mit | 21,697 |
# import the TypeFinder code to this folder
import matplotlib
import astropy
from TypeFinder import * | elliesch/UltracoolTypingKit | Tests/__init__.py | Python | bsd-3-clause | 101 |
def issubstring(s1,s2):
#check if s1 is substring of s2
M = len(s1)
N = len(s2)
for i in range(N-M+1):
for j in range(M):
if s2[i+j] != s1[j]:
break
if j+1 == M:
return i
return -1
if __name__ == "__main__":
s1 = "ford"
s2 = ... | prashantas/MyDataScience | GeneralPython/PyDataStructure/isSubstring.py | Python | bsd-2-clause | 360 |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 15 20:55:19 2016
@author: ajaver
"""
import json
import os
from collections import OrderedDict
import zipfile
import numpy as np
import pandas as pd
import tables
from tierpsy.helper.misc import print_flush
from tierpsy.analysis.feat_create.obtainFeaturesHelper import ... | ljschumacher/tierpsy-tracker | tierpsy/analysis/wcon_export/exportWCON.py | Python | mit | 9,522 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Splinter would be proud."""
TEENAGE_MUTANT_NINJAS = ('Michaelangelo. Leonardo. Rafael. Donatello. Heroes '
'in a half shell.')
TURTLE_POWER = TEENAGE_MUTANT_NINJAS.split('. ') | rrafiringa/is210-week-03-warmup | task_05.py | Python | mpl-2.0 | 258 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi, Guewen Baconnier
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Lic... | eneldoserrata/marcos_openerp | marcos_addons/account_credit_control/__openerp__.py | Python | agpl-3.0 | 2,707 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, publish,
... | andrewyoung1991/scons | test/Fortran/F08FILESUFFIXES2.py | Python | mit | 3,301 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pypinyin.runner import get_parser
def test_default():
options = get_parser().parse_args(['你好'])
assert options.func == 'pinyin'
assert options.style == 'zh4ao'
assert options.separator == '-'
assert not op... | mozillazg/python-pinyin | tests/test_cmd.py | Python | mit | 1,023 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_policy_client.py | Python | mit | 4,159 |
#!/usr/bin/python
"""
Constructed Data
"""
import sys
from copy import deepcopy as _deepcopy
from .errors import DecodingError, EncodingError, \
MissingRequiredParameter, InvalidParameterDatatype, InvalidTag
from .debugging import ModuleLogger, bacpypes_debugging
from .primitivedata import Atomic, ClosingTag, O... | JoelBender/bacpypes | py34/bacpypes/constructeddata.py | Python | mit | 54,681 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.