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 |
|---|---|---|---|---|---|
from __future__ import absolute_import
from scripts import manager, app
if __name__ == '__main__':
with app.app_context():
manager.run()
| jeremlb/sms-hiking-traker | manage.py | Python | gpl-3.0 | 150 |
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | HybridF5/tempest_debug | tempest/api/hybrid_cloud/compute/test_versions.py | Python | apache-2.0 | 3,146 |
from resources.lib.modules import client
from resources.lib.modules import cloudflare
import re,sys,urllib,urlparse,base64,urllib2
domains = ['stream4free.pro', 'stream4free.eu']
def resolve(url):
try:
result = cloudflare.request(url)
items = client.parseDOM(result, 'video', attrs={'id': 'live_... | azumimuo/family-xbmc-addon | plugin.video.phstreams/resources/lib/resolvers/stream4free.py | Python | gpl-2.0 | 582 |
# -*- coding: utf-8 -*-
from Headset import Headset
import logging
import time
puerto = 'COM3'
headset = Headset(logging.INFO)
try:
headset.connect(puerto, 115200)
except Exception, e:
raise e
print "Is conected? " + str(headset.isConnected())
print "-----------------------------------------"
headset.startR... | emotrix/Emotrix | emotrix/HeadsetTester.py | Python | bsd-2-clause | 529 |
#!/usr/bin/env python
import pafy
| girish946/ytsafe | pafy/__init__.py | Python | gpl-3.0 | 34 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | lahwaacz/qutebrowser | qutebrowser/misc/crashdialog.py | Python | gpl-3.0 | 25,028 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask_script import Manager as Managers
# from flask_migrate import Migrate, MigrateCommand
from .app import create_app
# from .ext import db
app = create_app()
# migrate = Migrate(app, db)
manager = Managers(app)
# manager.add_command('db', MigrateCommand)
@man... | jhgdike/Squares | squares/cli.py | Python | mit | 452 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | lukecwik/incubator-beam | sdks/python/apache_beam/examples/windowed_wordcount.py | Python | apache-2.0 | 3,220 |
#!/usr/bin/env python
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License")... | radicalbit/ambari | ambari-agent/src/test/python/ambari_agent/TestRegistration.py | Python | apache-2.0 | 3,177 |
import matplotlib.image as mpimg
import scipy, scipy.interpolate
from platemap_ui import *
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
class plateimagealignDialog(QDialog):
def __init__(self, parent=None, title='', folderpath=None, manual_image_init_bool=True):
super(p... | johnmgregoire/JCAPPlatemapVisualize | plate_image_align_Dialog.py | Python | bsd-3-clause | 31,164 |
import re
# from urllib.parse import urlparse
# from urllib.parse import urljoin
# from urllib.parse import urldefrag
import urllib
import time
from datetime import datetime
from urllib.robotparser import RobotFileParser
import queue
import random
import socket
import csv
import lxml.html
DEFAULT_AGENT = 'wswp'
DEFAU... | Code-In-Action/python-in-action | webscrap/c1.py | Python | mit | 7,304 |
"""
kombu.transport.librabbitmq
===========================
`librabbitmq`_ transport.
.. _`librabbitmq`: http://pypi.python.org/librabbitmq/
"""
from __future__ import absolute_import
import socket
try:
import librabbitmq as amqp
from librabbitmq import ChannelError, ConnectionError
except ImportError:
... | mozilla/firefox-flicks | vendor-local/lib/python/kombu/transport/librabbitmq.py | Python | bsd-3-clause | 4,289 |
# coding=utf-8
import logging
# About language detecting logic:
#
# Step 1: if member.l10n is not empty/false, use it as the best choice
#
# Step 2: if Accept-Language header has something interesting, use it as the second choice
#
# Step 3: Fallback to site.l10n
def GetMessages(handler, member=None, site=False):
... | cwyark/v2ex | v2ex/babel/l10n/__init__.py | Python | bsd-3-clause | 1,729 |
import os
from wb import system, home_fn, choose_arch
def build_ddk(config, dir, x64):
ddk_path = config['DDK_PATH']
ddk_major = int(config['DDKVER_MAJOR'])
debug = 'PRODUCT_TAP_DEBUG' in config
return build_tap(ddk_path, ddk_major, debug, dir, x64)
def build_tap(ddk_path, ddk_major, debug, dir, x64):... | vyos/openvpn | win/build_ddk.py | Python | gpl-2.0 | 1,559 |
#! /usr/bin/env python
import threading
from socket import *
from time import ctime
import os
def create_tcp_server(port):
HOST=''
BUFSIZ = 1024
ADDR = (HOST,port)
tcpSerSock = socket(AF_INET, SOCK_STREAM)
tcpSerSock.bind(ADDR)
tcpSerSock.listen(5)
while True:
print 'waiting for connection...'
tcpCliSock, ... | hotpoor-for-Liwei/LiteOS_Hackathon | Hackathon_170108_莫比黑客_Pjt/raspberryPi_gateway_python/tcpserver.py | Python | bsd-3-clause | 709 |
from __future__ import absolute_import, unicode_literals
from django.template import Template, Context
from django.test import TestCase
from django.utils.encoding import force_text, force_bytes
from django.utils.functional import lazy, Promise
from django.utils.html import escape, conditional_escape
from django.utils... | makinacorpus/django | tests/utils_tests/test_safestring.py | Python | bsd-3-clause | 1,940 |
import json
import urllib
import urllib2
response = urllib2.urlopen("http://hackerleague.org/api/v1/hackathons.json")
html_string =response.read()
try:
decoded = json.loads(html_string)
print decoded[0]['location']['city']
except (ValueError, KeyError, TypeError):
print "JSON format error"
#print html_string | UBHackathon/HTML5Web | parser.py | Python | gpl-3.0 | 319 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
### auteur: Ward De Ridder
### bedoeling: regelmatige werkwoorden op -cer vervoegen in het Frans
werkwoord = input("Werkwoord: ")
#werkwoord = developper
stam = werkwoord[:-3]
FILE = open(werkwoord+".txt","w",encoding='utf-8')
begin = "{{-start-}}\n"
eind =... | warddr/wiktionary-frverb | verb-ger.py | Python | gpl-3.0 | 6,287 |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | letuananh/chirptext | docs/conf.py | Python | mit | 2,010 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from ffmpymedia import __author__, __version__, __copyright__, __package__
import os.path
import datetime
import unittest
import ffmpymedia.parser as parser
class TestDecodeDateString(unittest.TestCase):
def test_empty_string(self):
self.assertRaises(Value... | flaviocpontes/ffmpymedia | tests/test_parser.py | Python | mit | 2,051 |
import json
from sqlalchemy import func
import models
from .. import base
from . import forms
__all__ = [
"BannerHandler",
"BannersHandler",
"HomePhotographerHandler",
"HomePhotographersHandler",
"HomeCollectionHandler",
"HomeCollectionsHandler",
]
class BannerHandler(base.APIBaseHandler):
... | hstxcn/hstxcn-backend | api/home/views.py | Python | apache-2.0 | 8,005 |
#!/usr/bin/python
"""
Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, INC
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,... | gaberger/pybvc | samples/samplenetconf/cmds/show_yangmodels.py | Python | bsd-3-clause | 3,054 |
#!/usr/bin/env python
import os,glob,string,sys
from numpy.distutils.core import setup, Extension
from numpy.distutils import fcompiler
from distutils.dep_util import newer
## -------- set these
KM = 11
JM = 1
IM = 1
NC_INC = '/usr/local/include'
NC_LIB = '/usr/local/lib'
##----------------------
if '--lite' in sys.... | jsbj/climt | setup.py | Python | bsd-3-clause | 8,118 |
import logging
l = logging.getLogger("angr.exploration_techniques.spiller")
import ana
from . import ExplorationTechnique
class SpilledState(ana.Storable):
def __init__(self, state):
self.state = state
def _ana_getstate(self):
return (self.state,)
def _ana_setstate(self, s):
sel... | tyb0807/angr | angr/exploration_techniques/spiller.py | Python | bsd-2-clause | 4,993 |
from sqlalchemy import Column, ForeignKey, Integer, String, Text, DateTime, Table
from sqlalchemy.orm import relationship, backref
from models import DecBase
from models.document import Document
from models.keyword import Keyword
from jsonschema import *
from json_schemas import *
from models.collection_version import ... | FreeJournal/freejournal | models/collection.py | Python | mit | 6,736 |
import sys, os
outDir = sys.argv[2]
if(not outDir[-1] == "/"):
outDir += "/"
def processFile(filename):
global outDir
inFile = open(filename,'r')
newFilename = filename[filename.rfind("/")+1:-3] + ".txt"
outFile = open(outDir + newFilename, 'w')
wroteSomething = False
while(True):
... | utcompling/fieldspring | src/main/python/trrraw2plain.py | Python | apache-2.0 | 1,191 |
#!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
BASE_DIR = "datatables_views"
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=[
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"datatables_views",
],
DATABASES... | a1fred/django-datatables-views | runtests.py | Python | mit | 1,411 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Soldeva, SRL and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
# test_records = frappe.get_test_records('Cashier Closing Entry')
class TestCashierClosingEntry(unittest.TestCase):
pass
| YefriTavarez/finance_manager | fm/finance_manager/doctype/cashier_closing_entry/test_cashier_closing_entry.py | Python | gpl-3.0 | 289 |
# coding: utf-8
from __future__ import unicode_literals
from .theplatform import ThePlatformIE
from ..utils import (
determine_ext,
parse_duration,
)
class TheWeatherChannelIE(ThePlatformIE):
_VALID_URL = r'https?://(?:www\.)?weather\.com/(?:[^/]+/)*video/(?P<id>[^/?#]+)'
_TESTS = [{
'url': 'https://weather.co... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/theweatherchannel.py | Python | gpl-3.0 | 2,621 |
# 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,
# bu... | kenorb-contrib/BitTorrent | BitTorrent/PeerID.py | Python | gpl-3.0 | 914 |
# 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... | ghchinoy/tensorflow | tensorflow/python/client/virtual_gpu_test.py | Python | apache-2.0 | 9,731 |
#!/usr/bin/env python
# coding=utf-8
#
# Copyright 2017 ihasy.com
# Do have a faith in what you're doing.
# Make your life a story worth telling.
import time
import re
import random
from htmlentity import unescape
from HTMLParser import HTMLParser
def date(timestamp, formatter):
return time.strftime(formatter, t... | ddong8/ihasy | lib/variables.py | Python | bsd-3-clause | 1,059 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('server', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='fuelclass',
options={... | dmarley/tfrs | server/migrations/0002_auto_20170214_1526.py | Python | apache-2.0 | 377 |
import perm
Project = perm.Subject(__name__, 'project')
Project.read = perm.Permission()
Project.write = perm.Permission()
| FlorianLudwig/perm | test/example2.py | Python | apache-2.0 | 124 |
# Copyright 2018-2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | kubeflow/kfp-tekton-backend | sdk/python/kfp/dsl/_pipeline.py | Python | apache-2.0 | 8,125 |
from configobj import ConfigObj
from woodpecker.misc.contrib.validate import Validator
class HttpSequenceSettings(ConfigObj):
def __init__(self, **kwargs):
super(HttpSequenceSettings, self).__init__({
'http': {
'user_agent': 'Google Chrome 58',
'all... | steromano87/Woodpecker | woodpecker/settings/httpsequencesettings.py | Python | agpl-3.0 | 1,368 |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Philippe Biondi <phil@secdev.org>
# This program is published under a GPLv2 license
"""
RTP (Real-time Transport Protocol).
"""
from scapy.packet import *
from scapy.fields import *
_rtp_payload_types = {
... | smainand/scapy | scapy/layers/rtp.py | Python | gpl-2.0 | 1,687 |
'''
Created on Jan 8, 2014
@author: xapharius
'''
from abc import ABCMeta, abstractmethod
class AbstractDataSet(object):
'''
Abstract class for DataSet
DataSet is the processed rawData got in the engine's map step.
It has the necessary format for the learning algorithms to operate.
'''
__meta... | xapharius/mrEnsemble | Engine/src/datahandler/AbstractDataSet.py | Python | mit | 1,215 |
# Copyright 2011 Ludvig Widman
#
# 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... | Tjoppen/pyjames | py/JamesXMLObject.py | Python | apache-2.0 | 2,237 |
'''
This file is part of the Python EJTP library.
The Python EJTP library is free software: you can redistribute it
and/or modify it under the terms of the GNU Lesser Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
the Python EJTP ... | campadrenalin/EJTP-lib-python | ejtp/frame/base.py | Python | lgpl-3.0 | 4,709 |
"""wrapper for cmake tool"""
import subprocess
from subprocess import PIPE
import platform
from mod import log,util
from mod.tools import ninja
name = 'cmake'
platforms = ['linux', 'osx', 'win']
optional = False
not_found = 'please install cmake 2.8 or newer'
#--------------------------------------------------------... | code-disaster/fips | mod/tools/cmake.py | Python | mit | 4,302 |
"""
*methods for working with workspaces containing taskpaper project documents*
"""
from workspace import workspace
from sync import sync
| thespacedoctor/tastic | tastic/workspace/__init__.py | Python | mit | 139 |
#!/usr/bin/env python
import os
import shutil
import glob
import time
import sys
import subprocess
from optparse import OptionParser, make_option
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PARAMETERS = None
ADB_CMD = "adb"
def doCMD(cmd):
# Do not need handle timeout in this short script, let tool... | yugang/crosswalk-test-suite | stability/wrt-stablonglast2d-android-tests/inst.apk.py | Python | bsd-3-clause | 3,243 |
#
# main.py
# Mich, 2015-03-11
# Copyright (c) 2015 Datacratic Inc. All rights reserved.
#
# The "plugin" variable is defined by the mldb loader
if False:
# mute pep8 validation
mldb = None
mldb.log("Loading kmeans generator plugin")
mldb.plugin.serve_static_folder('/files', 'webUiFiles')
def request_handle... | datacratic/mldb-stackexchange-tag-explorer | main.py | Python | apache-2.0 | 797 |
"""
Support for ZigBee devices.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zigbee/
"""
import asyncio
import logging
from binascii import hexlify, unhexlify
import voluptuous as vol
from homeassistant.const import (
EVENT_HOMEASSISTANT_STOP, C... | miniconfig/home-assistant | homeassistant/components/zigbee.py | Python | mit | 14,617 |
from pycp2k.inputsection import InputSection
class _each47(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Just_energy = None
self.Powell_opt = None
self.Qs_scf = None
self.Xas_scf = None
self.Md = None
self.Pint = None
self.Metad... | SINGROUP/pycp2k | pycp2k/classes/_each47.py | Python | lgpl-3.0 | 1,113 |
# Copyright 2018 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | ocampocj/cloud-custodian | tools/c7n_mailer/c7n_mailer/slack_delivery.py | Python | apache-2.0 | 9,488 |
#------------------------------------------------------------------------------
# Reynolds-Blender | The Blender add-on for Reynolds, an OpenFoam toolbox.
#------------------------------------------------------------------------------
# Copyright|
#-----------------------------------------------------------------------... | dmsurti/reynolds-blender | tests/cavity/__init__.py | Python | gpl-3.0 | 1,399 |
# coding: utf-8
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm import scoped_session
from sqlalchemy.ext.declarative import declarative_base
from settings import PUBLIC_STRING, ECHOSQL
Base = declarative_base()
def get_engine():
engine = create_engine(
... | amaozhao/restornado | demo/db.py | Python | apache-2.0 | 574 |
"""
Django settings for lo2 project.
"""
from webapp.settings_base import * # noqa
SECRET_KEY = '...'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
#INSTALLED_APPS += ['debug_toolbar']
# ********************************************************* Database
# Connect local instance to ... | msipos/lasernotes | backend/webapp/settings_debug.py | Python | agpl-3.0 | 896 |
import numpy as np
from astropy import units as u
from ctapipe.image import cleaning
def compute_cleaning_1(events, snr=3, overwrite=True):
for event in events:
baseline_std = event.data.baseline_std
max_amplitude = np.max(event.data.adc_samples, axis=-1)
mask = max_amplitude > (snr * bas... | calispac/digicampipe | digicampipe/calib/cleaning.py | Python | gpl-3.0 | 4,074 |
##
# This module provides a VirtualFileSystem from which data from many plugins can be accessed seemlessly and like if it was a real filesystem
from plugin.interface import IStoragePlugin
from manager import OneServerManager
from entry import Entry
##
# This class represents a virtual filesystem. The filesys... | 1Server/OneServer | oneserver/vfs.py | Python | mit | 6,012 |
from django.contrib import admin
from simple_history.admin import SimpleHistoryAdmin
from .models import Problem, Part
class PartInline(admin.StackedInline):
model = Part
extra = 0
class ProblemAdmin(SimpleHistoryAdmin):
inlines = (
PartInline,
)
list_display = (
'course',
... | ul-fmf/projekt-tomo | web/problems/admin.py | Python | agpl-3.0 | 759 |
from registration.forms import RegistrationForm
from django import forms
class Sc2RegForm(RegistrationForm):
username = forms.RegexField(regex=r'^[\w.@+-]+$',
max_length=30,
widget=forms.TextInput(attrs={'class': 'required'}),
... | wraithan/rplay | replayswithfriends/profiles/backends/forms.py | Python | mit | 634 |
"""
Parses an AWS credentials file and create a dictionary with
K:profilename V:{AWS_ACCESS_KEY_ID;AWS_SECRET_ACCESS_KEY}
"""
import os
class ParseAWSEnvVariables():
creds = {}
def __init__(self, credentials_file):
with (open(credentials_file, 'r')) as f:
for line in f:
... | otsu81/parseley | parse_aws_variables.py | Python | mit | 833 |
# -*- coding: utf-8 -*-
from django.shortcuts import redirect
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.template.response import TemplateResponse
from nest.forms import SignUpForm, UserForm
def home(request):
if request.user.is_authenticated(... | devsar/djProject | djProject/apps/nest/views.py | Python | bsd-3-clause | 1,299 |
import os
from django.conf import settings
from django.template.response import TemplateResponse
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from django.core.exceptions import PermissionDenied
from django.utils.translation import ugettext_lazy as _
from oioioi.base.menu... | papedaniel/oioioi | oioioi/testspackages/views.py | Python | gpl-3.0 | 2,354 |
from statsmodels.compat.python import lrange, lmap, iterkeys, iteritems
import numpy as np
from scipy import stats
from statsmodels.iolib.table import SimpleTable
from statsmodels.tools.decorators import nottest
def _kurtosis(a):
'''wrapper for scipy.stats.kurtosis that returns nan instead of raising Error
mi... | hlin117/statsmodels | statsmodels/stats/descriptivestats.py | Python | bsd-3-clause | 13,634 |
# -*- coding: utf-8 -*-
'''
pyCA tests for the agents state handling
'''
import os
import os.path
import tempfile
import unittest
from pyca import agentstate, config, db, utils
from tests.tools import terminate_fn, reload
class TestPycaAgentState(unittest.TestCase):
def setUp(self):
utils.http_request ... | opencast/pyCA | tests/test_agentstate.py | Python | lgpl-3.0 | 836 |
from django.conf.urls import patterns, url
urlpatterns = patterns('apps.authentication.views',
url(r'^login/$', 'login', name='auth_login'),
url(r'^logout/$', 'logout', name='auth_logout')
)
| larserikgk/mobiauth-server | apps/authentication/urls.py | Python | mit | 208 |
class Field(object):
def __init__(self, title, value, short=False):
"""
Initiate the field
:param title: The title
:param value: The value
:param short: Short or not
"""
super(Field, self).__init__()
self._title = title
self._value = ... | LowieHuyghe/script-core | scriptcore/integrations/slack/field.py | Python | apache-2.0 | 673 |
# coding=utf-8
import logging
from json import dumps
import requests
from oauthlib.oauth1 import SIGNATURE_RSA
from requests_oauthlib import OAuth1, OAuth2
from six.moves.urllib.parse import urlencode
from atlassian.request_utils import get_default_logger
log = get_default_logger(__name__)
class AtlassianRestAPI(o... | AstroTech/atlassian-python-api | atlassian/rest_client.py | Python | apache-2.0 | 11,985 |
"""Tests for wiring causes no issues with queue.Queue from std lib."""
from pytest import fixture
from samples.wiring import queuemodule
from samples.wiring.container import Container
@fixture
def container():
container = Container()
yield container
container.unwire()
def test_wire_queue(container: Co... | rmk135/dependency_injector | tests/unit/wiring/test_with_stdlib_queue_py36.py | Python | bsd-3-clause | 521 |
from pysnmp.entity import engine, config
from pysnmp.carrier.asynsock.dgram import udp
from pysnmp.entity.rfc3413 import ntfrcv
from pysnmp.proto.api import v2c
from pysnmp import debug
import os
import argparse
import time
import string
####### The SNMP Agent Daemon #######
def agent(verbose,quiet,server_ip0,server... | gnuhow/Quick_Daemon | snmp_agent.py | Python | apache-2.0 | 8,637 |
# Copyright 2010 Frederico G. C. Arnoldi <fgcarnoldi /at/ gmail /dot/ com>
#
# This file is part of pyBioSig.
#
# pyBioSig 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 3... | fredgca/pybiosig | hclust_parser.py | Python | gpl-3.0 | 8,002 |
from marshmallow import Schema, fields
from willstores.util.response_schema import PriceSchema
class ProductDetailsSchema(Schema):
id = fields.String(required=True)
name = fields.String(required=True)
kind = fields.String(required=True)
brand = fields.String(required=True)
details = fields.Raw(re... | willrogerpereira/willbuyer | willstores/willstores/util/response_schema/product_details_schema.py | Python | mit | 571 |
import sys
import operator
import pytest
import ctypes
import gc
import warnings
import types
from typing import Any
import numpy as np
from numpy.core._rational_tests import rational
from numpy.core._multiarray_tests import create_custom_field_dtype
from numpy.testing import (
assert_, assert_equal, assert_array_... | simongibbons/numpy | numpy/core/tests/test_dtype.py | Python | bsd-3-clause | 61,597 |
#!/usr/bin/env python
#Data file name
f="MetDept1.csv"
#Read CSV files
import csv
# open csv file
csvfile = open( f, "rb" )
# sniff into 10KB of the file to check its dialect
dialect = csv.Sniffer().sniff( csvfile.read( 10*1024 ) )
csvfile.seek(0)
# read csv file according to dialect
reader = csv.reader( csvfile, ... | YannChemin/MWS | DATA/BauddalokaMw/plot_mws.py | Python | unlicense | 1,556 |
# Development tool - build-image plugin
#
# Copyright (C) 2015 Intel Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it w... | schleichdi2/OPENNFR-6.1-CORE | opennfr-openembedded-core/scripts/lib/devtool/build_image.py | Python | gpl-2.0 | 7,058 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-28 07:40
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('content... | CooCooooo/cococomments | comments/migrations/0001_initial.py | Python | apache-2.0 | 2,572 |
import sys
sys.path.append("/fiberfit/")
from src.fiberfit_gui import export_window
from src.fiberfit_control.support import img_model
from PyQt5.QtWidgets import QDialogButtonBox, QDialog, QFileDialog
from PyQt5.QtGui import QTextDocument
from PyQt5.QtPrintSupport import QPrinter
from PyQt5.QtCore import pyqtSlot, py... | NTMatBoiseState/FiberFit | src/fiberfit_control/support/report.py | Python | lgpl-3.0 | 13,160 |
# Copyright (c) 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 required by applicable law or agreed to in writ... | citrix-openstack-build/sahara | sahara/tests/unit/service/edp/test_job_manager.py | Python | apache-2.0 | 20,947 |
# flake8: noqa
from api import ShopApiTestCase
from cart import CartTestCase
from cart_modifiers import (
CartModifiersTestCase,
TenPercentPerItemTaxModifierTestCase,
)
from order import (
OrderConversionTestCase,
OrderPaymentTestCase,
OrderTestCase,
OrderUtilTestCase,
)
from forms import (
... | hzlf/openbroadcast | website/shop/shop/tests/__init__.py | Python | gpl-3.0 | 1,088 |
#
# (c) 2016 Red Hat Inc.
#
# 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, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | veger/ansible | lib/ansible/plugins/action/sros.py | Python | gpl-3.0 | 3,259 |
# -*- coding: utf-8 -*-
from collections import OrderedDict, defaultdict
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponse
from django.shortcuts import Http404, render
from django.template.loader import render_to_string
from rest_framework import filters, viewsets
from rest_fr... | pythonindia/junction | junction/schedule/views.py | Python | mit | 2,023 |
'''
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.resource_operations as res_ops
import apibinding.inventory as inventory
test_stub = test_lib.lib_get_tes... | zstackorg/zstack-woodpecker | integrationtest/vm/virtualrouter/novlan/test_create_vm_on_specified_ps.py | Python | apache-2.0 | 1,502 |
from __future__ import absolute_import
from celery import shared_task
from celery.task.schedules import crontab
from celery.decorators import periodic_task
from SmartHome.api.models import *
from .XBee import XBee
from operator import xor
import platform
import time
import pytz, datetime
try:
if platform.system()... | Baymaxteam/SmartHomeDjango | SmartHome/node/tasks.py | Python | bsd-3-clause | 13,406 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import os
os.environ['DJANGO_SETTINGS_MODULE... | iafan/zing | pootle/apps/pootle_app/management/commands/sync_stores.py | Python | gpl-3.0 | 1,918 |
# -*- encoding: utf-8 -*-
import os
import re
import shutil
from django.test import TestCase
from django.core import management
LOCALE='de'
class ExtractorTests(TestCase):
PO_FILE='locale/%s/LC_MESSAGES/django.po' % LOCALE
def setUp(self):
self._cwd = os.getcwd()
self.test_dir = os.path.absp... | mzdaniel/oh-mainline | vendor/packages/Django/tests/regressiontests/i18n/commands/extraction.py | Python | agpl-3.0 | 7,630 |
# -*- coding: utf-8 -*-
# Copyright 2014, 2015 Metaswitch Networks
#
# 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 ap... | anortef/calico | calico/test/test_datamodel_v1.py | Python | apache-2.0 | 3,130 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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, either version 3 of the License, or
# (at your option) an... | MihaiMoldovanu/ansible | lib/ansible/playbook/helpers.py | Python | gpl-3.0 | 17,221 |
"""
WSGI config for trovistelo project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... | annalee/trovistelo | trovistelo/wsgi.py | Python | agpl-3.0 | 397 |
import os
import string
import random
from StringIO import StringIO
from PIL import Image
from newebe.config import CONFIG
class Resizer(object):
'''
Utilities to modifiy image files
'''
def resize(self, image_file, width, height):
'''
Resize given image. Returns a PIL Image object.... | gelnior/newebe | newebe/lib/picture.py | Python | agpl-3.0 | 1,130 |
import toolbox
import numpy as np
import pylab
data, params = toolbox.initialise("geometries.su")
vels = {}
#~ vels[1755]= (2501.6, 0.151), (2664.9, 0.582), (2867.1, 0.786), (2933.5, 1.105), (3103.3, 1.352), (3233.3, 1.730), (3296.8, 2.117), (3523.6, 3.263), (3324.0, 2.620), (2659.8, 0.537),
vels[753] = (0.02, 1973... | stuliveshere/SeismicProcessing2015 | prac1_staff/09.1_field_stack.py | Python | mit | 1,296 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from auto_nag import utils
from auto_nag.bzcleaner import BzCleaner
from auto_nag.nag_me import Nag
class Tracking(BzC... | mozilla/relman-auto-nag | auto_nag/scripts/tracking.py | Python | bsd-3-clause | 4,089 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -------------------------------------------------------------------------... | julienr/vispy | vispy/geometry/generation.py | Python | bsd-3-clause | 20,920 |
import argh, os, pwd, sys
from gitdh.gitdh import gitDhMain
from gitdh.config import Config
try:
from shlex import quote
except ImportError:
import re
_find_unsafe = re.compile(r'[^\w@%+=:,./-]', re.ASCII).search
def quote(s):
"""Return a shell-escaped version of the string *s*."""
if not s:
return "''"
i... | seoester/Git-Deployment-Handler | gitdh/cli.py | Python | mit | 6,712 |
# Support for button detection and callbacks
#
# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import logging
######################################################################
# Button state tracking
############################... | KevinOConnor/klipper | klippy/extras/buttons.py | Python | gpl-3.0 | 9,896 |
"""
Dec 10, 2015 Developed by Y.G.@CHX
yuzhang@bnl.gov
This module is for the GiSAXS XPCS analysis
"""
from chxanalys.chx_generic_functions import *
from chxanalys.chx_compress import ( compress_eigerdata, read_compressed_eigerdata,init_compress_eigerdata, get_avg_imgc,Multifile)
from chxanalys.chx_correlationc imp... | yugangzhang/chxanalys | chxanalys/XPCS_GiSAXS.py | Python | bsd-3-clause | 90,446 |
# coding=utf-8
from __future__ import division
import numpy as np
def cdf(arr, pos=None):
'''
Return the cumulative density function of a given array or
its intensity at a given position (0-1)
'''
r = (arr.min(), arr.max())
hist, bin_edges = np.histogram(arr, bins=2 * int(r[1] -... | radjkarl/imgProcessor | imgProcessor/utils/cdf.py | Python | gpl-3.0 | 504 |
# -*- coding: utf-8 -*-
default_app_config = 't4proj.apps.survey.apps.SurveyConfig' | mivanov-utwente/t4proj | t4proj/apps/survey/__init__.py | Python | bsd-2-clause | 83 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Quantization'] , ['MovingAverage'] , ['Seasonal_DayOfMonth'] , ['MLP'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Quantization/model_control_one_enabled_Quantization_MovingAverage_Seasonal_DayOfMonth_MLP.py | Python | bsd-3-clause | 169 |
# 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/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/__init__.py | Python | mit | 2,339 |
def fib():
a, b = 0,1
while True:
yield a
a,b = b, a+b
def my_range(lower, upper):
pass | rrees/learning-python | generators.py | Python | gpl-3.0 | 114 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Main
circutis.web Web Server and Testing Tool.
"""
import os
from sys import stderr
from hashlib import md5
from optparse import OptionParser
from wsgiref.validate import validator
from wsgiref.simple_server import make_server
try:
import hotshot
import hot... | nizox/circuits | circuits/web/main.py | Python | mit | 5,763 |
from __future__ import absolute_import
import re
from collections import namedtuple
from ..exceptions import LocationParseError
from ..packages import six
url_attrs = ["scheme", "auth", "host", "port", "path", "query", "fragment"]
# We only want to normalize urls with an HTTP(S) scheme.
# urllib3 infers URLs withou... | kawamon/hue | desktop/core/ext-py/urllib3-1.25.8/src/urllib3/util/url.py | Python | apache-2.0 | 13,962 |
from openerp import api, models, fields
class mail_message(models.Model):
_inherit = 'mail.message'
@api.one
@api.depends('author_id', 'notified_partner_ids')
def _get_sent(self):
self.sent = len(self.notified_partner_ids) > 1 or len(self.notified_partner_ids)==1 and self.notified_partner_ids[... | csokt/odoo8 | addons/mail_extend/models/mail.py | Python | mit | 719 |
dictionary = {"GEEKS", "FOR", "QUIZ", "GO"}
N, M = 3, 3
board = [['G','I','Z'],
['U','E','K'],
['Q','S','E']]
class Graph:
class Vertex:
def __int__(self, v):
self.val = v
self.adj = []
def findWords(board=board):
def search(node, word, visited):
if node not in visited:
visited.appen... | carlb15/Python | boggle.py | Python | mit | 785 |
from django.shortcuts import render
from django.template import RequestContext
from builder.models import House,Energy,Floor,Meter
from django.core import serializers
from django.contrib.auth.decorators import permission_required
@permission_required('builder.view_house')
def main(request):
house = House.object... | tbarbette/monitoring | consumption/views.py | Python | gpl-2.0 | 1,286 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from BeautifulSoup import BeautifulSoup
import os, sys
import re
import urllib, urllib2
TARGET_DIR = './html'
BASE_URL = 'http://80.251.167.40/page.aspx?cid=r3.dar&diary='
BASE_INDEX_URL = 'http://80.251.167.40/diary.aspx?cid=r3.dar&'
GET_COOKIE_URL = 'http://80.251.167.4... | transparenciahackday/dar-scripts | scripts/darscraper/scraper.py | Python | gpl-3.0 | 3,098 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.