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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
#
# Copyright (c) 2017 Stratosphere Laboratory.
#
# This file is part of ManaTI Project
# (see <https://stratosphereips.org>). It was created by 'Raul B. Netto <raulbeni@gmail.com>'
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gene... | stratosphereips/Manati | manati/share_modules/whois_distance.py | Python | agpl-3.0 | 12,100 |
#!/usr/bin/python2.7
# Copyright 2012 Google Inc. All Rights Reserved.
#
"""Common generator index utilities."""
__author__ = 'akesling@google.com (Alex Kesling)'
from googleapis.codegen import cpp_generator
from googleapis.codegen import csharp_generator
from googleapis.codegen import dart_generator
from googleapi... | ivannaranjo/google-api-dotnet-client | ClientGenerator/src/googleapis/codegen/generator_lookup.py | Python | apache-2.0 | 2,301 |
"""
Badge Awarding backend for Badgr-Server.
"""
import logging
import mimetypes
import requests
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError
from lazy import lazy
from request... | gymnasium/edx-platform | lms/djangoapps/badges/backends/badgr.py | Python | agpl-3.0 | 6,288 |
import os
import sys
import time
from owanimo.app.error import ERROR as e
from owanimo.script import allegory_special
from owanimo.util import define
from owanimo.util.log import LOG as L
class Allegory(allegory_special.Allegory):
def __init__(self, runner, profile, player):
allegory_special.Allegory.__in... | setsulla/owanimo | script/quest_special_material_highest.py | Python | mit | 1,446 |
"""
Create cropped test set image
$ ipython -i --pdb scripts/create_test_head_crop_image.py -- --size 256 --data 256_20151023 --model localize_pts_dec17 --overwrite
"""
import argparse
import os
import sys
from time import strftime
import pandas as pd
import numpy as np
from skimage.io import imread
from tqdm import t... | felixlaumon/kaggle-right-whale | scripts/create_test_cropped_image.py | Python | mit | 4,813 |
import os
# toolchains options
ARCH='arm'
CPU='am335x-vmm'
CROSS_TOOL='gcc'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = r'C:\Program Files (x86)\CodeSourcery\Sourcery_CodeBench_Lite_for_ARM_EABI\bin'
elif CROSS_TOOL == 'keil':
PLATFORM... | wzyy2/Embedded-Multi-OS-TOY | app/rtconfig.py | Python | gpl-2.0 | 2,690 |
# Copyright 2019 Mycroft AI 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 writin... | forslund/mycroft-core | mycroft/messagebus/client/client.py | Python | apache-2.0 | 1,543 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('admin_complex_filter', '0002_auto_20151030_1603'),
]
operations = [
migrations.AddField(
model_name='item',
... | vladiibine/django-examples | admin-gallery/widget_customization/admin_complex_filter/migrations/0003_item_available.py | Python | mit | 417 |
from django.contrib import auth
from django.contrib.auth import authenticate, login
from django.core.files.temp import NamedTemporaryFile
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.db import transaction
from django.db.utils import IntegrityError
import json
from django_facebook import e... | abendleiter/Django-facebook | django_facebook/connect.py | Python | bsd-3-clause | 15,841 |
"""Tests for :mod:`robottelo.vm`."""
import six
import unittest2
from robottelo import ssh
from robottelo.vm import VirtualMachine, VirtualMachineError
if six.PY2:
from mock import call, patch
else:
from unittest.mock import call, patch
class VirtualMachineTestCase(unittest2.TestCase):
"""Tests for :clas... | kbidarkar/robottelo | tests/robottelo/test_vm.py | Python | gpl-3.0 | 3,966 |
# Author: Travis Oliphant
# 1999 -- 2002
import types
import warnings
import sigtools
from scipy import special, linalg
from scipy.fftpack import fft, ifft, ifftshift, fft2, ifft2, fftn, \
ifftn, fftfreq
from numpy import polyadd, polymul, polydiv, polysub, \
roots, poly, polyval, polyder, cast, asarray, is... | stefanv/scipy3 | scipy/signal/signaltools.py | Python | bsd-3-clause | 53,313 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-31 18:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('videos', '0034_auto_20160730_1623'),
]
operations = [
migrations.AddField(
... | curtwagner1984/YAPO | videos/migrations/0035_scene_description.py | Python | gpl-3.0 | 460 |
# -*- encoding: utf-8 -*-
from pysis.services.base import Service
class Blastcells(Service):
"""Blastcells Service
Consumes Blastcells API: <{url}/blastcells>
"""
def __init__(self, client):
"""Creates Blastcells object with a client"""
super(Blastcells, self).__init__(client... | sustainableis/python-sis | pysis/services/blastcells/__init__.py | Python | isc | 860 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^api/', include('emoticonvis.apps.api.urls')),
url(r'^docs/', include('docs.urls')),
... | nanchenchen/emoticon-analysis | emoticonvis/urls.py | Python | mit | 767 |
from django.core.management.base import BaseCommand, CommandError
from layerinfo.models import Theme,Issue,Layer, PointLayer, Points
import json
from os import listdir
from os.path import isfile, join
import csv
import sys
from optparse import make_option
from geopy import geocoders
#from polls.models import Poll
cla... | USStateDept/DiplomacyExplorer2 | dipex/layerinfo/management/commands/loadpadata.py | Python | mit | 7,839 |
# -*- coding: utf-8 -*-
"""Discover and lookup command plugins.
This comes from OpenStack cliff.
"""
import inspect
import logging
import pkg_resources
LOG = logging.getLogger(__name__)
class EntryPointWrapper(object):
"""Wrap up a command class already imported to make it look like a plugin.
"""
de... | TurboGears/gearbox | gearbox/commandmanager.py | Python | mit | 3,089 |
# -*- encoding: utf-8 -*-
from abjad import *
def test_rhythmmakertools_TaleaRhythmMaker_tie_split_notes_01():
talea = rhythmmakertools.Talea(
counts=(5,),
denominator=16,
)
maker = rhythmmakertools.TaleaRhythmMaker(
talea=talea,
)
divisions = [(2, 8), (2, 8), (2,... | mscuthbert/abjad | abjad/tools/rhythmmakertools/test/test_rhythmmakertools_TaleaRhythmMaker_tie_split_notes.py | Python | gpl-3.0 | 2,189 |
"""Test the Coolmaster config flow."""
from homeassistant import config_entries
from homeassistant.components.coolmaster.const import AVAILABLE_MODES, DOMAIN
from tests.async_mock import patch
def _flow_data():
options = {"host": "1.1.1.1"}
for mode in AVAILABLE_MODES:
options[mode] = True
return... | tboyce021/home-assistant | tests/components/coolmaster/test_config_flow.py | Python | apache-2.0 | 3,138 |
# flake8: noqa
"""Settings to be used for running tests."""
from settings import *
INSTALLED_APPS.append('integration_tests')
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
}
EMAIL_SUBJECT_PREFIX = '[test] '
EMAIL_BACKEND = 'django.core.mail.backend... | bitmazk/webfaction-django-boilerplate | website/webapps/django/project/settings/test_settings.py | Python | mit | 371 |
"""
WSGI config for mothra project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` s... | xflows/textflows | mothra/wsgi.py | Python | mit | 1,305 |
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import fields, models, api, _
from odoo.exceptions import UserE... | bmya/odoo-argentina | l10n_ar_afipws/models/afipws_connection.py | Python | agpl-3.0 | 6,250 |
# Generated by Django 2.0.4 on 2018-04-24 22:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('calaccess_processed_filings', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='F... | california-civic-data-coalition/django-calaccess-processed-data | calaccess_processed_filings/migrations/0002_auto_20180424_2226.py | Python | mit | 4,143 |
"""Tcp client for synchronous uhd message tcp port"""
import threading
import Queue
import time
import socket
import struct
import numpy as np
class _TcpSyncClient(threading.Thread):
"""Thead for message polling"""
queue = Queue.Queue()
q_quit = Queue.Queue()
ip_address = None
port = None
de... | Opendigitalradio/ODR-StaticPrecorrection | src/tcp_sync.py | Python | mit | 3,403 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division, print_function
import cookielib
def toPyCookie(QtCookie):
"""
qt 쿠키를 python 쿠키로 바꿉니다.
.. 참조:
http://pyqt.sourceforge.net/Docs/PyQt4/qnetworkcookie.html
https://github.com/jeanphix/Ghost.py/blob/d... | Thestars3/pyufp | ufp/pyqt4/QNetworkCookie.py | Python | gpl-3.0 | 1,239 |
# This file is part of Checkbox.
#
# Copyright 2013 Canonical Ltd.
# Written by:
# Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
# Daniel Manrique <roadmr@ubuntu.com>
#
# Checkbox is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# th... | zyga/debian.plainbox | plainbox/impl/commands/test_run.py | Python | gpl-3.0 | 7,912 |
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2013 Task Coach developers <developers@taskcoach.org>
Task Coach 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
... | TaskEvolution/Task-Coach-Evolution | taskcoach/taskcoachlib/domain/category/categorycontainer.py | Python | gpl-3.0 | 2,050 |
#!/usr/bin/env python
# rh2mr.py
import numpy as num
from satvap import satvap
from satmix import satmix
from e2mr import e2mr
def rh2mr(p,t,rh,Tconvert=None):
"""(w1,w2) = rh2mr(p,t,rh,Tconvert)
determine H2O mixing ratio (w, g/kg) given
reference pressure (mbar), temperature (t,K), and
relative humidity (rh,%)
T... | graziano-giuliani/pythoncode | pyuwphysret/common/pyfiles/atmos/rh2mr.py | Python | mit | 2,422 |
#Initialisation
from time import sleep
from NaoCommunication import *
nao=NaoControle(Nao())
# 1 - Que fait ce code ?
# ...
for nombre in range(0,11,1):
nao.dire(str(nombre))
# 2 - Que fait cette fonction ?
# ...
sleep(3)
# 3 - Comment faire pour que le robot compte les secondes jusqu'a 10 ?
# 4 - Resoudre le ... | AdrienVR/NaoSimulator | TPINFO/Partie1/exercice2.py | Python | lgpl-3.0 | 619 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gooosieblog.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that ... | gooosie/django-blog | manage.py | Python | apache-2.0 | 809 |
from theano import tensor as TT
from theano.ifelse import ifelse
from ObjectiveFunction import ObjectiveFunction
from infos.InfoElement import PrintableInfoElement
from infos.InfoList import InfoList
from learningRule.LearningStepRule import LearningStepRule
from theanoUtils import is_inf_or_nan
__author__ = 'giulio'... | GiulioGx/RNNs | sources/learningRule/GradientClipping.py | Python | lgpl-3.0 | 1,739 |
"""
This module creates a sysadmin dashboard for managing and viewing
courses.
"""
import csv
import json
import logging
import os
import subprocess
import time
import StringIO
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth.decorators import login_required
from d... | shubhdev/openedx | lms/djangoapps/dashboard/sysadmin.py | Python | agpl-3.0 | 29,650 |
import os
from typing import Iterator
from .base_parser import BaseParser, PipelineSpec
class BasicPipelineParser(BaseParser):
SPEC_FILENAME = 'pipeline-spec.yaml'
@classmethod
def check_filename(cls, filename):
return filename == cls.SPEC_FILENAME
@classmethod
def to_pipeline(cls, spe... | frictionlessdata/datapackage-pipelines | datapackage_pipelines/specs/parsers/basic_pipeline.py | Python | mit | 776 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2011-2018, wradlib developers.
# Distributed under the MIT License. See LICENSE.txt for more info.
"""
Utility functions
^^^^^^^^^^^^^^^^^
Module util provides a set of useful helpers which are currently not
attributable to the other modules
.. autosummar... | kmuehlbauer/wradlib | wradlib/util.py | Python | mit | 23,048 |
import numpy as np
import lasagne
from lasagne.layers import Conv2DLayer as ConvLayer
from lasagne.layers import ElemwiseSumLayer
from lasagne.layers import InputLayer
from lasagne.layers import DenseLayer
from lasagne.layers import GlobalPoolLayer
from lasagne.layers import PadLayer
from lasagne.layers import Express... | srebuffi/iCaRL | iCaRL-TheanoLasagne/utils_cifar100.py | Python | mit | 9,375 |
# Copyright 2015 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... | nburn42/tensorflow | tensorflow/python/ops/partitioned_variables.py | Python | apache-2.0 | 12,541 |
# -*- coding: utf-8 -*-
#
# 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
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import os
impo... | totalgood/nlpia | docs/conf.py | Python | mit | 8,742 |
#! /usr/bin/env python
#
# CRC32 WJ103
#
import zlib
def crc32(filename):
'''calculate CRC-32 checksum of file'''
f = open(filename, 'r')
if not f:
return ''
crc = 0
while 1:
buf = f.read(16384)
if not buf:
break
crc = zlib.crc32(buf, crc)
f.close()
str_crc = '%x' % crc
# print 'TD: CRC32 : %s... | walterdejong/synctool | contrib/attic/crc32.py | Python | gpl-2.0 | 463 |
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.7.4, generator: @autorest/python@5.12.4)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# ------------------------------... | Azure/azure-sdk-for-python | sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/_container_registry.py | Python | mit | 4,280 |
import shutil
import json
from rest_framework import routers, serializers, viewsets, parsers, filters
from rest_framework.views import APIView
from rest_framework.exceptions import APIException
from rest_framework.response import Response
from django.core.exceptions import ValidationError
from django.core.files.uploa... | memex-explorer/memex-explorer | source/memex/rest.py | Python | bsd-2-clause | 8,218 |
"""
Just to test database functions,
outside of Flask.
We want to open our MongoDB database,
insert some memos, and read them back
"""
import arrow
# Mongo database
from pymongo import MongoClient
import CONFIG
try:
dbclient = MongoClient(CONFIG.MONGO_URL)
db = dbclient.meetme
collection = db.dated
exce... | ian-garrett/meetMe | db_trial.py | Python | artistic-2.0 | 1,359 |
# -*- coding: utf-8 -*-
"""
This is part of WebScout software
Docs EN: http://hack4sec.pro/wiki/index.php/WebScout_en
Docs RU: http://hack4sec.pro/wiki/index.php/WebScout
License: MIT
Copyright (c) Anton Kuzmin <http://anton-kuzmin.ru> (ru) <http://anton-kuzmin.pro> (en)
Class for common HTTP work
"""
import re
impor... | hack4sec/ws-cli | classes/Http.py | Python | mit | 7,764 |
import six
if six.PY2:
from blogstrap import create_app # noqa
else:
from blogstrap.blogstrap import create_app # noqa
| joehakimrahme/blogstrap | blogstrap/__init__.py | Python | apache-2.0 | 130 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from pylms.server import Server
from pylms.player import Player
from displayscreen import PiInfoScreen
# Class must have this name
class myScreen(PiInfoScreen):
refresh... | elParaguayo/RPI-Info-Screen | plugins/lms/screen.py | Python | gpl-3.0 | 10,972 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 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
## ... | valkyriesavage/invenio | modules/bibharvest/lib/oai_repository_regression_tests.py | Python | gpl-2.0 | 2,579 |
# -*- coding: utf-8 -*-
## Add path to library (just for examples; you do not need this)
import sys, os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
import numpy as np
from PyQt4 import QtGui, QtCore
import pyqtgraph as pg
app = QtGui.QApplication([])
mw = QtGui.QMainWindow()
p = pg.Plot... | robertsj/poropy | pyqtgraph/examples/test_Arrow.py | Python | mit | 641 |
#!/usr/bin/env python2.7
# Standard Library
import argparse
import collections
import os
import re
import xml.etree.cElementTree
# Third Party
import imdb
import imdb.helpers
import mediawiki
import sqlalchemy
import sqlalchemy.ext.declarative
import sqlalchemy.ext.hybrid
import sqlalchemy.orm
CANON = {'"Star Trek" (... | brolewis/oracle_of_kirk | oracle.py | Python | bsd-3-clause | 12,551 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Funciones para convertir números a letras o sea al nombre en español
# de ese número según las reglas que explica el artículo de wikipedia
# https://es.wikipedia.org/wiki/Anexo:Nombres_de_los_n%C3%BAmeros_en_espa%C3%B1ol.
import sys
import math
import re
# un arreglo para... | programingfrik/NumerosLetras | python/numLetras.py | Python | mit | 7,652 |
#!/usr/bin/env python3
import csv
from pyhpeimc.auth import *
from pyhpeimc.plat.device import *
IMC_IP="192.168.20.21"
IMC_PROTO="http://"
IMC_PORT="8080"
IMC_USER="imcrs"
IMC_PWD="imcrs"
authIMC = IMCAuth(IMC_PROTO, IMC_IP, IMC_PORT, IMC_USER, IMC_PWD)
def export_vendors(auth,csvFile,delimiter):
vendors = get_sy... | HPENetworking/HPEIMCUtils | PythonUtilities/Export_Conf/exportDeviceDefinition.py | Python | apache-2.0 | 2,519 |
"""Support for Acrobat Forms in ReportLab documents
This module is somewhat experimental at this time.
Includes basic support for
textfields,
select fields (drop down lists), and
check buttons.
The public interface consists of functions at the moment.
At some later date these operations may b... | EduPepperPDTesting/pepper2013-testing | lms/djangoapps/reportlab/pdfbase/pdfform.py | Python | agpl-3.0 | 16,301 |
import hglib
from flask import current_app
# Find the stack on which we want to store the database connection.
# Starting with Flask 0.9, the _app_ctx_stack is the correct one,
# before that we need to use the _request_ctx_stack.
try:
from flask import _app_ctx_stack as stack
except ImportError:
from flask imp... | drivet/flask-mercurial | flask_mercurial.py | Python | mit | 1,242 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache/incubator-airflow | tests/providers/amazon/aws/operators/test_s3_list.py | Python | apache-2.0 | 1,616 |
from django.template import RequestContext
from django.template.response import TemplateResponse
from pyconcz_2016.team.models import Organizer
def team_list(request):
organizers = Organizer.objects.all().filter(published=True).order_by('?')
return TemplateResponse(
request,
template='team/o... | pyvec/cz.pycon.org-2016 | pyconcz_2016/team/views.py | Python | mit | 413 |
# cgc.py - Curriculum Graph Converter - Dana Toribio
import graphviz
import os
import re
import subprocess
import sys
re_courses = re.compile('\w+\s\d+\w*') # regex for courses
header = r'''from graphviz import Digraph
g = Digraph('studyplan', filename='studyplan.gv')
g.attr('graph', fontname='Helvetica')
g.attr('no... | danaoira/CurriculumGraphVisualizer | cgc.py | Python | mit | 5,047 |
from setuptools import setup, find_packages
setup(
name="dominoscli",
version="0.0.1",
packages=find_packages(),
author="Rick van Biljouw",
author_email="rick@ondemand.io",
scripts = [
'bin/dominos.py'
],
data_files = [
],
)
| freecode/dominos-cli | setup.py | Python | mit | 270 |
# -*- encoding: utf-8 -*-
"""Test class for PuppetModule CLI
:Requirement: Puppetmodule
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: Puppet
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from robottelo.cli.factory import make_org, make_product, make_repository
from robottelo.... | omaciel/robottelo | tests/foreman/cli/test_puppetmodule.py | Python | gpl-3.0 | 3,568 |
# Copyright 2013 Radware LTD.
#
# 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 agree... | citrix-openstack-build/neutron-lbaas | neutron_lbaas/tests.skip/unit/services/loadbalancer/drivers/radware/test_plugin_driver.py | Python | apache-2.0 | 46,493 |
"""
State Space Representation and Kalman Filter
Author: Chad Fulton
License: Simplified-BSD
"""
from __future__ import division, absolute_import, print_function
from warnings import warn
import numpy as np
from .representation import OptionWrapper, Representation, FrozenRepresentation
from .tools import (
prefi... | YihaoLu/statsmodels | statsmodels/tsa/statespace/kalman_filter.py | Python | bsd-3-clause | 71,383 |
"""Dump flowpaths to a shapefile."""
from geopandas import read_postgis
from pyiem.util import get_dbconn
def main():
"""Go Main Go."""
pgconn = get_dbconn("idep")
df = read_postgis(
"""
SELECT f.fpath, f.huc_12, ST_Transform(f.geom, 4326) as geo from
flowpaths f, huc12 h WHERE h.... | akrherz/idep | scripts/util/dump_flowpaths.py | Python | mit | 559 |
# -*- coding:utf-8 -*-
# ========================================================== #
# File name: vgg_19.py
# Author: BIGBALLON
# Date created: 07/22/2017
# Python Version: 3.5.2
# Description: implement vgg19 network to train cifar10
# ========================================================== #
import t... | BIGBALLON/cifar-10-cnn | Tensorflow_version/vgg_19_pretrain.py | Python | mit | 12,039 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from biocomplexity.datasets.land_cover_dataset import LandCoverDataset
from biocomplexity.models.land_cover_change_model import LandCoverChangeModel
from biocomplexity.equation_specification impo... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/biocomplexity/examples/lccm_estimator_multirun.py | Python | gpl-2.0 | 10,192 |
#!/usr/bin/env python
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | googleads/google-ads-python | examples/campaign_management/add_complete_campaigns_using_batch_job.py | Python | apache-2.0 | 23,528 |
from builtins import str
import logging
import subprocess
from airflow.executors.base_executor import BaseExecutor
from airflow.utils import State
class SequentialExecutor(BaseExecutor):
"""
This executor will only run one task instance at a time, can be used
for debugging. It is also the only executor t... | wangtuanjie/airflow | airflow/executors/sequential_executor.py | Python | apache-2.0 | 1,230 |
import psutil
def secs2hours(secs):
mm, ss = divmod(secs, 60)
hh, mm = divmod(mm, 60)
return "%d:%02d:%02d" % (hh, mm, ss)
def giveMeBattery():
battery = psutil.sensors_battery()
battery
return "charge = %s%%, time left = %s" % (battery.percent, secs2hours(battery.secsleft))
print(giveMeBatt... | grotadmorv/i3status | batterie.py | Python | apache-2.0 | 327 |
""" Runs the TwitterKnitter. Prepares images and
sends them to the Arduino one line at a time. """
from knitter24 import Knitter24
from pattern24 import Pattern24
from TwitterSearch import *
from secrets import Secrets
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
import requests
import re
... | tangentmonger/twitterknitter | python/twitterknitter.py | Python | gpl-2.0 | 10,925 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
"""Superdesk... | akintolga/superdesk-core | superdesk/users/users.py | Python | agpl-3.0 | 3,970 |
# 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 ... | miyucy/oppia | core/controllers/profile.py | Python | apache-2.0 | 4,152 |
"""
This script intends to assist avoiding recreating audio file by caching common audio files locally.
"""
import os
import string
from shutil import rmtree
DEDFAULT_LOCAL_CACHE_DIR = os.path.join(os.path.expanduser("~"), "reko.cache")
MAX_FILENAME_LEN = 250
TMP_IMAGE_NAME = "reko_img.png"
class CacheStore():
d... | kyhau/reko | reko/cachestore.py | Python | mit | 1,826 |
#!/usr/bin/python
#
# 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 distribut... | shanemcd/ansible | lib/ansible/modules/network/nxos/nxos_gir_profile_management.py | Python | gpl-3.0 | 6,691 |
import argparse
import sys
import dockbot
from dockbot.Error import Error
from dockbot.Dockbot import Dockbot
from dockbot.Config import Config
from dockbot.Image import Image
from dockbot.Container import Container
from dockbot.Slave import Slave
from dockbot.Master import Master
from dockbot.RemoteImage import Remo... | CauldronDevelopmentLLC/dockbot | dockbot/__init__.py | Python | gpl-3.0 | 5,070 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 Pedro Navarro Perez
# 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.apach... | tylertian/Openstack | openstack F/nova/nova/virt/hyperv/volumeutils.py | Python | apache-2.0 | 5,097 |
from numbers import Number
from _collections import OrderedDict
import inspect
import numpy as np
import theano
import theano.tensor as TT
from . import helpers
from . import filter
from . import origin
class SimpleNode(object):
"""A SimpleNode allows you to put arbitary code as part of an NEF model.
This o... | ctn-waterloo/nengo_theano | nengo_theano/simplenode.py | Python | mit | 4,900 |
# encoding: utf-8
from __future__ import unicode_literals
import copy
# `from doctest import DocTestCase` causes crashes, since the DocTestCase is
# detected as a TestCase subclass and unittest.TestLoader.loadTestsFromModule()
# called from GreenTestLoader.loadTestsFromModule() thinks it is a definition
# of a test to... | CleanCut/green | green/test/test_result.py | Python | mit | 36,981 |
import subprocess
import time
import os
import logging
import select
import fcntl
import platform
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
from . import xrandr
def get_here():
return os.path.abspath(os.path.dirname(__file__))
class Backend:
def __init__(self, use_root=False, geo... | peter1010/projector_sequencer | sequencer/plugin_viewer.py | Python | lgpl-3.0 | 2,457 |
# -*- coding: utf-8 -*-
################################################################
# License, author and contributors information in: #
# __openerp__.py file at the root folder of this module. #
################################################################
import controllers
import models
| markeTIC/mtic-addons | competition_website/__init__.py | Python | agpl-3.0 | 318 |
# -*- coding: utf-8 -*-
from ..helpers import construct_similarity_matrix_via_profiles
class SimilarityMatrix:
def __init__(self, keywords, matrix):
self.keywords = keywords
self.matrix = matrix
def construct_similarity_matrix(relevance_matrix, relevance_threshold=0.2):
"""
Constructs ke... | luntos/bianalyzer | bianalyzer/relevance/similarity_matrix.py | Python | mit | 1,579 |
from collections import defaultdict, Counter
from .utils import _
from .card import Group, \
BUSH_WARBLER, CUCKOO, GEESE, PINE_RED_POEM, PLUM_RED_POEM, \
CHERRY_RED_POEM, PEONY_BLUE_POEM, CHRYSANTHEMUM_BLUE_PEOM, MAPLE_BLUE_POEM, \
WISTERIA_RED, IRIS_RED, BUSH_CLOVER_RED, \
CUP, RAIN
class CardList(o... | reidlindsay/gostop | gostop/core/hand.py | Python | mit | 5,521 |
"""
TickerHandler
This implements an efficient Ticker which uses a subscription
model to 'tick' subscribed objects at regular intervals.
The ticker mechanism is used by importing and accessing
the instantiated TICKER_HANDLER instance in this module. This
instance is run by the server; it will save its status across
s... | ypwalter/evennia | evennia/scripts/tickerhandler.py | Python | bsd-3-clause | 16,222 |
# Copyright (c) 2018 NEC, 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 agr... | openstack/octavia | octavia/cmd/status.py | Python | apache-2.0 | 5,631 |
#!/usr/bin/env python3
"""
This file is part of pynadc
https://github.com/rmvanhees/pynadc
Defines class ArchiveGosat2 to add new entries to GOSAT-2 SQLite database
Copyright (c) 2019-2021 SRON - Netherlands Institute for Space Research
All Rights Reserved
License: BSD-3-Clause
"""
import argparse
import sqlite... | rmvanhees/pynadc | scripts/add_entry_gosat2.py | Python | bsd-3-clause | 14,977 |
# (c) 2012, 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) any lat... | kaarolch/ansible | lib/ansible/plugins/lookup/nested.py | Python | gpl-3.0 | 2,100 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | HybridF5/tempest_debug | tempest/api/compute/servers/test_list_server_filters.py | Python | apache-2.0 | 14,988 |
import logging
from collections import deque
import six
import flanker.addresslib.address
from flanker import _email
from flanker.mime.message.headers import parametrized
from flanker.mime.message.utils import to_utf8
_log = logging.getLogger(__name__)
_ADDRESS_HEADERS = ('From', 'To', 'Delivered-To', 'Cc', 'Bcc', ... | mailgun/flanker | flanker/mime/message/headers/encoding.py | Python | apache-2.0 | 2,245 |
# coding: utf-8
"""Generate HDF5 file with all catchment model input data.
Sources are DBF and some large text files.
"""
import sys
import numpy
import pandas
import tables
from crosswater.read_config import read_config
from crosswater.tools import dbflib
from crosswater.tools.hdf5_helpers import find_ids
from cr... | moserand/crosswater | crosswater/preprocessing/hdf_input.py | Python | gpl-3.0 | 9,310 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | cloudera/hue | desktop/libs/notebook/src/notebook/connectors/hbase.py | Python | apache-2.0 | 2,484 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ModelerAlgorithm.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | mhugent/Quantum-GIS | python/plugins/processing/modeler/ModelerAlgorithm.py | Python | gpl-2.0 | 32,306 |
"""
API client class for LittleSMS.ru service.
Ivan Grishaev, 2011.
ivan@grishaev.me
"""
from hashlib import md5, sha1
import urllib
# Find JSON lib
try:
import json # Python >= 2.6
except ImportError:
try:
import simplejson as json # Python <= 2.5
except ImportError:
try:
f... | desecho/hangout-discontinued | hangout_project/hangout/littlesms.py | Python | mit | 5,853 |
## Automatically adapted for numpy.oldnumeric Jun 27, 2008 by -c
#
# Copyright (C) 2000-2008 greg Landrum and Rational Discovery LLC
# All Rights Reserved
#
""" Utilities for data manipulation
**FILE FORMATS:**
- *.qdat files* contain quantized data suitable for
feeding to learning algorithms.
The .qdat fi... | jandom/rdkit | rdkit/ML/Data/DataUtils.py | Python | bsd-3-clause | 17,580 |
from spider import Spider
from lxml import etree
import html5lib
import url as moz_url
import traceback, urlparse, threading, Queue
from multiprocessing import JoinableQueue, Event, Process
def is_html(response):
if not response:
return False
return 'html' in response.headers.get('Content-Type', 't... | sunlightlabs/nanospider | nanospider/ghost_spider.py | Python | bsd-3-clause | 2,066 |
import functools
import numpy as np
from scipy.stats import norm as ndist
import regreg.api as rr
from selection.tests.instance import gaussian_instance
from selection.learning.utils import full_model_inference, pivot_plot
from selection.learning.core import split_sampler, gbm_fit
def simulate(n=200, p=100, s=10, ... | selective-inference/selective-inference | doc/learning_examples/multi_target/lasso_example_multi_gbm_sk.py | Python | bsd-3-clause | 2,838 |
#! /usr/bin/env python
# Copyright (c) 2018, Rethink Robotics 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 ap... | RethinkRobotics/intera_sdk | intera_interface/src/intera_motion_interface/interaction_publisher.py | Python | apache-2.0 | 2,984 |
# Copyright 2009-2015 Canonical
# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distribu... | magicicada-bot/magicicada-server | magicicada/u1sync/client.py | Python | agpl-3.0 | 26,330 |
"""
Views and functions for serving static files. These are only to be used
during development, and SHOULD NOT be used in a production setting.
"""
from __future__ import unicode_literals
import mimetypes
import os
import stat
import posixpath
import re
import urllib
from django.http import Http404, HttpResponse, Htt... | rebost/django | django/views/static.py | Python | bsd-3-clause | 5,092 |
#!/usr/bin/env python
import urllib2
from time import sleep
# test that we are not authorized initially
print "test that the desired rate gets banned"
req = urllib2.Request("http://127.0.0.1:8080/firstrate")
res = None
status = []
expected_status = [404]*3 + [403]
times = 4
total_interval = 35.0
rate = times/total_... | equalitie/banjax | test/regex_rate_test.py | Python | agpl-3.0 | 1,920 |
"""
This module descibes how to manually train and test an algorithm without using
the evaluate() function.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from surprise import BaselineOnly
from surprise import Dataset
from surprise import accuracy
# L... | charmoniumQ/Surprise | examples/iterate_over_folds.py | Python | bsd-3-clause | 721 |
"""
========================
Random Number Generation
========================
Use ``default_rng()`` to create a `Generator` and call its methods.
=============== =========================================================
Generator
--------------- ---------------------------------------------------------
Generator ... | jorisvandenbossche/numpy | numpy/random/__init__.py | Python | bsd-3-clause | 7,527 |
from collections import OrderedDict
from datetime import timedelta
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import update_session_auth_hash
from django.core.exceptions import FieldDoesNotExist, ValidationError
from django.db import models
from django.db.models impor... | AltSchool/django-allauth | allauth/account/utils.py | Python | mit | 15,330 |
"""Borůvka's algorithm.
Determines the minimum spanning tree (MST) of a graph using the Borůvka's algorithm.
Borůvka's algorithm is a greedy algorithm for finding a minimum spanning tree in a
connected graph, or a minimum spanning forest if a graph that is not connected.
The time complexity of this al... | TheAlgorithms/Python | graphs/boruvka.py | Python | mit | 6,482 |
# Copyright 2015 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.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import unittest
from dashboard import change_i... | endlessm/chromium-browser | third_party/catapult/dashboard/dashboard/change_internal_only_test.py | Python | bsd-3-clause | 1,897 |
from __future__ import absolute_import, print_function
import unittest
from bokeh.application.spellings import ScriptHandler
from bokeh.document import Document
def _with_temp_file(func):
import tempfile
f = tempfile.NamedTemporaryFile()
try:
func(f)
finally:
f.close()
def _with_scri... | gpfreitas/bokeh | bokeh/application/spellings/tests/test_script.py | Python | bsd-3-clause | 2,526 |
#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. 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
#
# U... | sunqm/pyscf | pyscf/dft/roks.py | Python | apache-2.0 | 2,523 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.