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 |
|---|---|---|---|---|---|
mylist = ["00_os_ubuntu_latest", "34_app_emacs", "18_lib_vtk"]
def create_Dockerfile(fragmentList):
fragmentList.sort()
Dockerfile = ""
for fragment in fragmentList:
fragmentfile = open(fragment, "r")
Dockerfile = Dockerfile + fragmentfile.read()
fragmentfile.close()
return Do... | callaghanmt/research-stacks | config/makeDockerfile.py | Python | mit | 330 |
#!/usr/bin/env python
# ObservationStartListener.py: Receive observation messages to dispatch tasks
#
# Copyright (C) 2015
# ASTRON (Netherlands Institute for Radio Astronomy)
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This file is part of the LOFAR software suite.
# The LOFAR software suite is free software: ... | jjdmol/LOFAR | LCS/MessageDaemons/ObservationStartListener/src/ObservationStartListener.py | Python | gpl-3.0 | 14,466 |
# -*- coding: utf-8 -*-
# This file is part of AudioLazy, the signal processing Python package.
# Copyright (C) 2012-2014 Danilo de Jesus da Silva Bellini
#
# AudioLazy 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 Foun... | antiface/audiolazy | audiolazy/tests/test_synth.py | Python | gpl-3.0 | 9,033 |
# Copyright(c) 2018, Dimitar Venkov
# @5devene, dimitar.ven@gmail.com
# www.badmonkeys.net
def tolist(x):
if hasattr(x,'__iter__'): return x
else : return [x]
walls = UnwrapElement(tolist(IN[0]))
OUT = [getattr(w, 'CurtainGrid', None) is not None for w in walls] | dimven/SpringNodes | py/Wall.IsCurtainWall.py | Python | mit | 267 |
from django.conf.urls import include, url, patterns
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'', include('polls.urls', namespace='polls1')),
# url(r'', include('polls2.urls', namespace='polls2')),
]
| Predator01/potential-adventure | mysite/mysite/urls.py | Python | mit | 269 |
def plot(desc, value, scale):
slength = int(desc.__len__())
whitespace = (30 - (slength + 1)) *" "
initial = str(desc) + ":" + whitespace + "-" + str(scale)
if value != 0:
svalue = value
if value < 0:
line1 = initial + " [" + ((20 - (-1)*svalue)*" ") + "(|" + (((svalue*(-1)) - 2) * "=") + "8" + (" "*20) + "... | eldon/WorseIsBetter | shit.py | Python | mit | 833 |
import unittest
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
from sqlalchemy import create_engine
from mocksqlalchemy import ScopedSessionmakerMock
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class User(Base):
__tablename__ = 'users... | levisaya/mocksqlalchemy | mocksqlalchemy/test/test_scoped_session_mock.py | Python | apache-2.0 | 1,243 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from __future__ import (unicode_literals, absolute_import,
division, print_function)
import logging
from django.utils import timezone
from snisi_core.models.Reporting import (ExpectedReporting,
... | yeleman/snisi | snisi_reprohealth/aggregations.py | Python | mit | 7,786 |
# Copyright 2021 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 writing, ... | google-research/DBAP-algorithm | third_party/rlkit_library/config_reader.py | Python | apache-2.0 | 2,390 |
#######################################
# Counter with bag-of-words
# Import Counter
from collections import Counter
# tokenize the article
tokens = word_tokenize(article)
# convert into lowercase: lower_tokens
lower_tokens = [t.lower() for t in tokens]
# create counter
bow_simple = Counter(lower_tokens)
# most ... | Ventrosky/python-scripts | nlp-scripts/demo-chatbot/topics.py | Python | gpl-3.0 | 2,680 |
#!/usr/bin python
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
def tidalEfficiency_method1(df, canal, well, log=False):
'''
Calculate Tidal Efficiency according to Erskine 1991, as the ratio
of the standard deviation of the two sets of reading.
Note, author mentions that this method... | cdd1969/pygwa | lib/functions/TidalEfficiency.py | Python | gpl-2.0 | 6,501 |
#!/usr/bin/env python
'''
pyGCMMA - A Python pyOpt interface to GCMMA.
Copyright (c) 2008-2014 by pyOpt Developers
All rights reserved.
Revision: 1.5 $Date: 31/07/2014 21:00$
Tested on:
---------
Linux with g77
Win32 with g77
Mac with g95
Developers:
-----------
- Mr. Andrew Lambe (AL)
- Dr. Ruben E. Perez (RP)
... | DailyActie/Surrogate-Model | 01-codes/pyOpt-1.2.0/pyOpt/pyGCMMA/pyGCMMA.py | Python | mit | 22,786 |
# vi: ts=4 expandtab
#
# Copyright (C) 2012 Canonical Ltd.
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# Copyright (C) 2012 Yahoo! Inc.
# Copyright (C) 2014 Amazon.com, Inc. or its affiliates.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefl... | henrysher/aws-cloudinit | cloudinit/distros/amazon.py | Python | gpl-3.0 | 4,160 |
# 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... | lvdongbing/python-bileanclient | bileanclient/shell.py | Python | apache-2.0 | 23,726 |
import webapp2
from google.appengine.api import users
import logging
from loader import loadJsonSchema
import json
import xjsonschema
class APIBase(webapp2.RequestHandler):
@classmethod
def GetJsonSchema(cls):
lschema = loadJsonSchema(cls.__name__, "handlers")
if lschema is None and cls.... | emlynoregan/sutldoc | apibase.py | Python | apache-2.0 | 3,462 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
:py:mod:`utils.py` - Mission auxiliary routines
-----------------------------------------------
`K2`-specific auxiliary routines. These are not
generally called from the top level of the code.
'''
from __future__ import division, print_function, absolute_import, \
... | rodluger/everest | everest/missions/k2/utils.py | Python | mit | 20,979 |
################################################################################
# The Neural Network (NN) based Speech Synthesis System
# https://svn.ecdf.ed.ac.uk/repo/inf/dnn_tts/
#
# Centre for Speech Technology Research
# University of Edinburgh, UK
# ... | bajibabu/merlin | src/work_in_progress/run_mdn.py | Python | apache-2.0 | 52,440 |
from django.contrib import admin
from country_dialcode.models import Country, Prefix
class CountryAdmin(admin.ModelAdmin):
list_display = ('countrycode', 'iso2', 'countryprefix', 'countryname')
search_fields = ('countryname', 'countryprefix')
ordering = ('id', )
list_filter = ['countryprefix', 'countr... | dedayoa/django-country-dialcode | country_dialcode/admin.py | Python | mit | 956 |
def func(x):
return 42
va<caret>r = func('foo')
| siosio/intellij-community | python/testData/intentions/PyAnnotateVariableTypeIntentionTest/conflictWithAnnotationFunctionTypeIntention.py | Python | apache-2.0 | 54 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Generator for C style prototypes and definitions """
import glob
import os
import sys
from idl_log import ErrOut, InfoOut, Wa... | blackenough/mediaAdapter | ppapitest/sdk/ppapi/generators/idl_c_proto.py | Python | gpl-3.0 | 25,722 |
"""SCons.Tool.ifort
Tool-specific initialization for newer versions of the Intel Fortran Compiler
for Linux/Windows (and possibly Mac OS X).
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) ... | bleepbloop/Pivy | scons/scons-local-1.2.0.d20090919/SCons/Tool/ifort.py | Python | isc | 3,377 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import argparse
from configparser import SafeConfigParser
class Configurable(object):
"""
Configuration processing for the network
"""
def __i... | Impavidity/text-classification-cnn | configurable.py | Python | mit | 4,672 |
#!/usr/bin/env python2.7
"""
Requirements:
threading
curses
getpass
requests
"""
from bot import Bot, Game
import re
import sys
import threading
import curses
import getpass
def prompt(q, pattern):
while True:
inp = raw_input(q)
if re.match(pattern, inp):
return i... | DecksAgainstSociety/CLI | cli.py | Python | gpl-2.0 | 10,391 |
from django.urls import re_path
from olympia.files import views
# This set of URL patterns is not included under `/files/` in
# `src/olympia/urls.py`:
upload_patterns = [
re_path(r'^file/(?P<uuid>[0-9a-f]{32})/', views.serve_file_upload,
name='files.serve_file_upload'),
]
| eviljeff/olympia | src/olympia/files/urls.py | Python | bsd-3-clause | 292 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from ios_code_generator.generators import as_ios_swift_generator
from ios_code_generator.maps import ui_model_type_map, ui_controller_model_type_map, ui_type_value_field_map
from ios_code_generator.models import model_bool_property
from ios_code_generator... | banxi1988/iOSCodeGenerator | ios_code_generator/models/controller_model.py | Python | mit | 4,003 |
#!/usr/bin/python
# Generate a simple web slideshow
# for use with a Chromecast.
#
# Copyright (c) 2014 by Jim Lawless
# See MIT/X11 license at
# http://www.mailsend-online.com/license2014.php
#
import os
import SimpleHTTPServer
import SocketServer
import string
delay_millis="10000"
images=os.listdir('... | jimlawless/castpy | cast.py | Python | mit | 1,218 |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
def plot_error(out_file,xticks,means,errors):
print out_file
print xticks
print means
print errors
x=np.array(range(1,len(xticks)+1))
my_xticks=list(xticks)
for index,val in enumerate(xticks):
... | KECB/learn | machine_learning/NN_code_release/plot_error.py | Python | mit | 2,268 |
from HTMLParser import HTMLParser
class MyHTMLParser(HTMLParser):
def __init__(self):
self.pdf_url = False
HTMLParser.__init__(self)
def handle_starttag(self, tag, attrs):
if tag == "a":
for attr in attrs:
if attr[0] == u"href" and attr[1][-4:] ... | martinburchell/crossword_collective | parser.py | Python | gpl-3.0 | 375 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... | rwl/PyCIM | CIM14/ENTSOE/Dynamics/IEC61970/Dynamics/DynamicsMetaBlockOutput.py | Python | mit | 2,396 |
#
# 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... | dhuang/incubator-airflow | airflow/providers/google/cloud/example_dags/example_tasks.py | Python | apache-2.0 | 5,151 |
import database as d
import abc
#Orders allow a Business to queue method calls from their Jobs in a particular order, to be performed daily.
class Order(object):
def __init__(self, business, job):
self.business = business
self.job = job
def getJob(self):
return self.job
clas... | markemus/economy | orders.py | Python | mit | 2,391 |
# -*- coding: utf-8 -*-
import argparse
import asyncio
from aiohttp import web
__all__ = ["get_cli_parser", "webserver",
"route_to_resource"]
webapp = web.Application()
async def webserver(addr, port):
"""
Initialize the HTTP server and start responding
to requests.
"""
loop = asyncio... | Lawouach/event-driven-microservice | bookshelf/restlib.py | Python | bsd-3-clause | 575 |
#! /usr/bin/env python
from nose.tools import assert_false, assert_true, assert_equal
import os
import sqlite3
import tables
import numpy as np
from tools import check_cmd
from helper import tables_exist, find_ids, exit_times, \
h5out, sqliteout, clean_outs, to_ary, which_outfile
def test_stub_example():
"""T... | gonuke/cyclus | tests/test_stub_example.py | Python | bsd-3-clause | 2,025 |
"""
Note: studies are (for the most part) ordered from shallow to deep clades.
This might need to be reversed when using the mapcompatible function.
"""
studytreelist=[
## Bacteria + Archaea
"pg_2542_5590", # Bacteria + Archaea. Lang et al. 2013. PLoS ONE
## Bacteria
"pg_263_149"... | OpenTreeOfLife/gcmdr | files_for_submission_v2.0/other_microbes.py | Python | bsd-2-clause | 1,291 |
"""Added users count
Revision ID: 342a7b8abf68
Revises: None
Create Date: 2014-08-23 14:20:56.590066
"""
# revision identifiers, used by Alembic.
revision = '342a7b8abf68'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust!... | akhilaryan/clickcounter | alembic/versions/342a7b8abf68_added_users_count.py | Python | bsd-3-clause | 879 |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.action import ActionBase
import linchpin.MockUtils.MockUtils as mock_utils
class ActionModule(ActionBase):
def run(self, tmp=None, task_vars=None):
"""
Simple action plugin that returns th... | CentOS-PaaS-SIG/linch-pin | linchpin/provision/action_plugins/ec2_eip.py | Python | gpl-3.0 | 911 |
#!/usr/bin/env python
#pylint: disable=missing-docstring
####################################################################################################
# DO NOT MODIFY THIS HEADER #
# MOOSE - Multiphysics Object Oriented Simu... | Chuban/moose | python/MooseDocs/tests/refs/test_refs.py | Python | lgpl-2.1 | 1,852 |
import logging
from types import ModuleType
from typing import Any, Dict, List, Optional
from ray.autoscaler.command_runner import CommandRunnerInterface
from ray.autoscaler._private.command_runner import SSHCommandRunner, DockerCommandRunner
logger = logging.getLogger(__name__)
class NodeProvider:
"""Interface... | ray-project/ray | python/ray/autoscaler/node_provider.py | Python | apache-2.0 | 8,871 |
"""Launching script."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import logging
import os
import sys
import os.path as op
import tempfile
from subprocess import Popen
import threa... | DavidTingley/ephys-processing-pipeline | installation/klustaviewa-0.3.0/klustaviewa/gui/recluster.py | Python | gpl-3.0 | 3,905 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import logging
import ebstall.errors as errors
import collections
import re
import ebstall.util as util
import subprocess
import types
import ebstall.osutil as osutil
import shutil
import pkg_resources
__author__ = 'dusankl... | EnigmaBridge/ebstall.py | ebstall/deployers/supervisord.py | Python | mit | 6,210 |
#
# Copyright (c) 2009, Novartis Institutes for BioMedical Research 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:
#
# * Redistributions of source code must retain the above copyri... | rdkit/rdkit-orig | Contrib/LEF/ClusterFps.py | Python | bsd-3-clause | 2,812 |
"""
Aliases for functions which may be accelerated by Scipy.
Scipy_ can be built to use accelerated or otherwise improved libraries
for FFTs, linear algebra, and special functions. This module allows
developers to transparently support these accelerated functions when
scipy is available but still support users who hav... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/numpy/dual.py | Python | agpl-3.0 | 1,783 |
import os
from scipy.io import wavfile
def main(filename):
if not os.path.exists(filename):
raise RuntimeError("Could not find audio file %s" % filename)
audio_data = wavfile.read(filename)
if __name__ == '__main__':
from optparse import OptionParser
parser = OptionParser()
(options,args... | stein2k/BeatTracking | src/onsetdetection/onsetdetection.py | Python | mit | 450 |
"""Platform for Bosch BMP280 Environmental Sensor integration."""
from datetime import timedelta
import logging
from adafruit_bmp280 import Adafruit_BMP280_I2C
import board
from busio import I2C
import voluptuous as vol
from homeassistant.components.sensor import (
DEVICE_CLASS_PRESSURE,
DEVICE_CLASS_TEMPERAT... | w1ll1am23/home-assistant | homeassistant/components/bmp280/sensor.py | Python | apache-2.0 | 5,094 |
"""
Classes to provide the LMS runtime data storage to XBlocks.
:class:`DjangoKeyValueStore`: An XBlock :class:`~KeyValueStore` which
stores a subset of xblocks scopes as Django ORM objects. It wraps
:class:`~FieldDataCache` to provide an XBlock-friendly interface.
:class:`FieldDataCache`: A object which pro... | rismalrv/edx-platform | lms/djangoapps/courseware/model_data.py | Python | agpl-3.0 | 35,926 |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
import os, sys, inspect, dispy
# ensure pyeq2 can be imported
if -1 != sys.path[0].find('pyeq2-master'):raise Exception('Please rename git checkout directory from "pyeq2-master" to "pyeq2"')
exampleFil... | burkesquires/pyeq2 | Examples/Cluster/FitAllEquations_2D.py | Python | bsd-2-clause | 4,985 |
# -*- coding: utf-8 -*-
"""Boolean property."""
from safe.common.exceptions import MetadataCastError
from safe.metadata.property import BaseProperty
__copyright__ = "Copyright 2016, The InaSAFE Project"
__license__ = "GPL version 3"
__email__ = "info@inasafe.org"
__revision__ = '$Format:%H$'
NoneType = type(None)
... | ismailsunni/inasafe | safe/metadata/property/boolean_property.py | Python | gpl-3.0 | 1,258 |
# -*- coding: utf-8 -*-
#
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2015 Jérémy Bobbio <lunar@debian.org>
#
# diffoscope 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 Foundati... | brettcs/diffoscope | tests/comparators/test_fonts.py | Python | gpl-3.0 | 1,851 |
#!/usr/bin/env python2
# encoding: utf-8
# The MIT License (MIT)
#
# Copyright (c) 2015 Shane O'Connor
#
# 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 withou... | Kortemme-Lab/ddg | protocols/rosetta/map_pdb_residues.py | Python | mit | 11,751 |
import unittest, random, sys, time, os
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_hosts, h2o_browse as h2b, h2o_import as h2i, h2o_exec as h2e
import h2o_util
def write_syn_dataset(csvPathname, rowCount, colCount, SEEDPERFILE, sel):
# we can do all sorts of methods off the r object
r = random.Ra... | janezhango/BigDataMachineLearning | py/testdir_multi_jvm/test_many_fp_formats.py | Python | apache-2.0 | 2,830 |
#
# This file is 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
# distr... | TresAmigosSD/SMV | src/test/python/testModuleLink/stage2/links.py | Python | apache-2.0 | 853 |
############################################################
#
# Copyright (c) 2005-2011, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written... | CeltonMcGrath/TACTIC | src/tactic/ui/container/wizard_wdg.py | Python | epl-1.0 | 19,238 |
# Copyright 2016 FUJITSU LIMITED
# 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 b... | huntxu/python-neutronclient | neutronclient/tests/unit/osc/v2/fwaas/fakes.py | Python | apache-2.0 | 4,328 |
##
# Copyright 2009-2016 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# Flemish Research Foundation ... | wpoely86/easybuild-easyblocks | easybuild/easyblocks/p/python.py | Python | gpl-2.0 | 8,497 |
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from google.appengine.api import users
import logging
class Authentication(object):
ADMIN_EMAIL = 'hexvector@gmail.com'
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# authenticate admin
# ~~~~... | codecollision/Gamedex-Backend | gamedex/authentication.py | Python | bsd-3-clause | 1,340 |
from base64 import urlsafe_b64encode, urlsafe_b64decode
import glob
import os
from traits.api import HasStrictTraits, Dict, Instance, List, Str
from .transfer_function import TransferFunction
from .utils import load_ctf, save_ctf
CTF_EXTENSION = '.ctf'
def _name_encode(name):
return urlsafe_b64encode(name.enc... | dmsurti/ensemble | ensemble/ctf/manager.py | Python | bsd-3-clause | 2,376 |
#! /usr/bin/env python
# coding: utf8
import os
import sys
# Python translation of Jaro-Winkler code found here:
# http://web.archive.org/web/20100227020019/http://www.census.gov/geo/msb/stand/strcmp.c
# This will be the 'oracle', against which we test our re-written and
# re-factored Jaro-Winkler functions. We confi... | jrenner/JaroWinkler | jaro/strcmp95.py | Python | gpl-3.0 | 9,986 |
import pytest
from unittest import mock
from mitmproxy.test import tflow
from mitmproxy import io
from mitmproxy import exceptions
from mitmproxy.addons import clientplayback
from mitmproxy.test import taddons
def tdump(path, flows):
with open(path, "wb") as f:
w = io.FlowWriter(f)
for i in flow... | MatthewShao/mitmproxy | test/mitmproxy/addons/test_clientplayback.py | Python | mit | 2,612 |
from django.core.management.base import NoArgsCommand
from askbot.models import User
class Command(NoArgsCommand):
def handle_noargs(self, *args, **kwargs):
# Make sure all superusers have their status set to 'd'
fixed = (User.objects
.filter(is_superuser=True)
.... | divio/askbot-devel | askbot/management/commands/fix_superuser_status.py | Python | gpl-3.0 | 677 |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""
"""
#end_pymotw_header
import traceback
import sys
from traceback_example import produce_exception
try:
produce_exception()
except Exception, err:
print 'print_tb():'
exc_type, exc_value, exc_tb = sys.... | qilicun/python | python2/PyMOTW-1.132/PyMOTW/traceback/traceback_print_tb.py | Python | gpl-3.0 | 362 |
#!/usr/bin/env python
#coding: UTF-8
#
# Examples.
#
# Copyright (c) 2013 Samuel Groß
#
from graph import *
from algorithms.basics import *
from algorithms.max_flow import solve_max_flow
from algorithms.min_cost_flow import solve_min_cost_flow
from algorithms.min_cut import solve_min_cut
def max_flow():
g = Grap... | saelo/algopy | examples.py | Python | mit | 2,943 |
# 04_movement.py
# Uses the ultrasonic rangefinder to detect movement
from rrb3 import *
import time
threshold = 10
rr = RRB3()
reference = rr.get_distance()
rr.set_led1(0)
rr.set_led2(0)
print("alarm activated")
print("Press CTRL-c to quit the program")
while True:
time.sleep(0.3)
reading = rr.get_distanc... | simonmonk/raspirobotboard3 | python/examples_python3/rover_kit_examples/04_movement.py | Python | mit | 682 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''Collections of messages and their translations, called cliques. Also
collections of cliques (uber-cliques).
'''
import re
impo... | JoKaWare/WTL-DUI | tools/grit/grit/clique.py | Python | bsd-3-clause | 17,200 |
import pytest
from flex.exceptions import ValidationError
from flex.validation.request import (
validate_request,
)
from flex.error_messages import MESSAGES
from flex.constants import (
ARRAY,
BOOLEAN,
CSV,
INTEGER,
PATH,
PIPES,
QUERY,
SSV,
STRING,
TSV,
)
from tests.factori... | pipermerriam/flex | tests/validation/request/test_request_parameter_validation.py | Python | mit | 4,865 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""My iterations of sorting algorithms.
"""
# Import standard packages.
import copy
# Import installed packages.
# Import local packages.
def _median_pivot(vals):
"""Compute the pivot value for quicksort and the index of the pivot value.
Args:
val... | stharrold/interview_prep | interview_prep/sorting.py | Python | mit | 3,792 |
# Copyright 2008-2017 Luc Saffre
# License: BSD (see file COPYING for details)
"""
Adds functionality for managing "milestones" and "deployments".
See :doc:`/specs/noi/deploy`.
"""
from lino.api import ad, _
class Plugin(ad.Plugin):
"See :class:`lino.core.plugin.Plugin`."
verbose_name = _("Deploy")
n... | khchine5/xl | lino_xl/lib/deploy/__init__.py | Python | bsd-2-clause | 1,183 |
import unittest
from avellaneda2008 import library
class TestAvellaneda2008(unittest.TestCase):
def setUp(self):
pass
def test_for_sanity(self):
u"""
Non-marked lines should only get 'p' tags around all input
"""
self.assertTrue(
library.FinMath.return_true... | lockywolf/tutorial-finmath | test/test_avellaneda2008.py | Python | gpl-3.0 | 390 |
"""
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 posixpath
import re
import stat
from django.http import (
FileResponse, Http404... | diego-d5000/MisValesMd | env/lib/python2.7/site-packages/django/views/static.py | Python | mit | 5,293 |
from django.contrib import admin
from message.models import Broadcast
class BroadcastAdmin(admin.ModelAdmin):
list_display = ('name', 'phone')
admin.site.register(Broadcast, BroadcastAdmin)
| Artikulpi/sms-komunitas | medkom/message/admin.py | Python | gpl-3.0 | 196 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-27 17:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('simulation', '0004_auto_20170727_1815'),
]
operations = [
migrations.AddFie... | BenLatham/FLOSS-Agricultural-Simulation | simulation/migrations/0005_breeddetails_bw_adjustment_q4.py | Python | mit | 465 |
import os
from whylog.log_reader.exceptions import EmptyFile, OffsetBiggerThanFileSize
class ReadUtils(object):
STANDARD_BUFFER_SIZE = 512
@classmethod
def size_of_opened_file(cls, fh):
prev_position = fh.tell()
fh.seek(0, os.SEEK_END)
size = fh.tell()
fh.seek(prev_positi... | andrzejgorski/whylog | whylog/log_reader/read_utils.py | Python | bsd-3-clause | 2,366 |
import warnings
import re
import csv
import mimetypes
import time
from math import ceil
from werkzeug import secure_filename
from flask import (current_app, request, redirect, flash, abort, json,
Response, get_flashed_messages, stream_with_context)
from jinja2 import contextfunction
try:
import... | lifei/flask-admin | flask_admin/model/base.py | Python | bsd-3-clause | 74,214 |
# -*- coding: utf-8 -*-
"""
==================================
Fiber to bundle coherence measures
==================================
This demo presents the fiber to bundle coherence (FBC) quantitative
measure of the alignment of each fiber with the surrounding fiber bundles
[Meesters2016_HBM]_. These measures are usef... | matthieudumont/dipy | doc/examples/fiber_to_bundle_coherence.py | Python | bsd-3-clause | 10,895 |
# 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 u... | airbnb/superset | superset/views/core.py | Python | apache-2.0 | 101,703 |
import os
import sys
import cdms2
import vcs
from variance_utils import plotVariance, summerVariance, winterVariance, calculateVariance
# setting the absolute path of the previous directory
# getting the this py module path by __file__ variable
# pass that __file__ to the os.path.dirname, returns the path of this modul... | arulalant/mmDiagnosis | diagnosis1/mjo/level1/variance/do_variance_plot.py | Python | gpl-3.0 | 5,284 |
# Copyright 2014 Netflix, 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... | Yelp/security_monkey | security_monkey/constants.py | Python | apache-2.0 | 991 |
from fontTools.misc.arrayTools import updateBounds, pointInRect, unionRect
from fontTools.misc.bezierTools import calcCubicBounds, calcQuadraticBounds
from fontTools.pens.basePen import BasePen
__all__ = ["BoundsPen", "ControlBoundsPen"]
class ControlBoundsPen(BasePen):
"""Pen to calculate the "control bounds" of... | google/material-design-icons | update/venv/lib/python3.9/site-packages/fontTools/pens/boundsPen.py | Python | apache-2.0 | 2,714 |
# ../rf2db/schema/rf2.py
# -*- coding: utf-8 -*-
# PyXB bindings for NM:a62023a1e63ecb635c8d1a3482d1f64c6fb3e0f6
# Generated 2015-06-09 08:58:21.913541 by PyXB version 1.2.4 using Python 3.4.3.final.0
# Namespace http://snomed.info/schema/rf2
from __future__ import unicode_literals
import pyxb
import pyxb.binding
impo... | cts2/rf2db | rf2db/schema/rf2.py | Python | bsd-3-clause | 478,141 |
"""Sensor for monitoring the contents of a folder."""
from datetime import timedelta
import glob
import logging
import os
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER =... | leppa/home-assistant | homeassistant/components/folder/sensor.py | Python | apache-2.0 | 3,154 |
# encoding: utf-8
"""
change.py
Created by Thomas Mangin on 2009-11-05.
Copyright (c) 2009-2013 Exa Networks. All rights reserved.
"""
class Change (object):
__slots__ = ['nlri','attributes']
def __init__ (self,nlri,attributes):
self.nlri = nlri
self.attributes = attributes
def index (self):
return '%02x%0... | jbfavre/exabgp | lib/exabgp/rib/change.py | Python | bsd-3-clause | 759 |
from typing import Any
from argparse import ArgumentParser
from zerver.lib.actions import do_rename_stream
from zerver.lib.str_utils import force_text
from zerver.lib.management import ZulipBaseCommand
from zerver.models import get_stream
import sys
class Command(ZulipBaseCommand):
help = """Change the stream ... | amanharitsh123/zulip | zerver/management/commands/rename_stream.py | Python | apache-2.0 | 1,181 |
# Copyright (C) 2012,2013
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or modify
# it under the terms of t... | capoe/espressopp.soap | src/analysis/Test.py | Python | gpl-3.0 | 1,624 |
from graphics import *
from math import *
from time import sleep
win_width = 400
win_height = 400
r=100
dotr = 10
def main():
global win
win = GraphWin("My Graph", win_width, win_height)
g = [
[0,1], # 0
[1,2], # 1
[0], # 2
[1,2], # 3
[4,3,0], # 4
... | vatai/dm2b-py | graph/graph.py | Python | gpl-2.0 | 1,527 |
from django.contrib.postgres.search import SearchVector
from core import models
# https://docs.djangoproject.com/en/1.10/ref/contrib/postgres/search/#postgresql-fts-search-configuration
def search(keywords):
vector = (SearchVector('name', weight='A')
+ SearchVector('address', weight='B')
... | rastrexando-eu/rastrexando-eu | web/queries.py | Python | gpl-3.0 | 527 |
import copy
class Solution:
# @param strs: A list of strings
# @return: A list of strings
def anagrams(self, strs):
# write your code here
str1=copy.deepcopy(strs)
def hashLize(s):
dicts1= dict()
for i in range(26):
dicts1[chr(i+ord("a"... | jonathanxqs/lintcode | 171.py | Python | mit | 1,786 |
import sys
from os import path
from datetime import datetime
from fabric.api import sudo, put, env, run, settings, prompt, task, hide, puts, show, warn, cd
from fabric.contrib.files import upload_template
from ezjailremote.utils import kwargs2commandline, jexec, get_flavour, is_ip
EZJAIL_JAILDIR = '/usr/jails'
EZJAI... | tomster/ezjail-remote | ezjailremote/fabfile.py | Python | bsd-2-clause | 9,344 |
import unittest
import numpy as np
import tensorflow as tf
from tf_qrnn import QRNN
class TestQRNNForward(unittest.TestCase):
def test_qrnn_linear_forward(self):
batch_size = 100
sentence_length = 5
word_size = 10
size = 5
data = self.create_test_data(batch_size, sentence_... | icoxfog417/tensorflow_qrnn | test_tf_qrnn_forward.py | Python | mit | 2,523 |
"""Load pickle, organize indices per condition and custom text file."""
import pickle
pickle_name = 'Test_01.pickle'
file = open(pickle_name, 'rb')
pickle_file = pickle.load(file)
file.close()
# Put some prints to see/remember the data structure.
print pickle_file
print type(pickle_file)
print pickle_f... | ofgulban/minimalist_psychopy_examples | future/csv_related/06_load_pickle_index_organization_BV_prt_Part1.py | Python | unlicense | 1,957 |
import random
from pybrain.rl.environments.environment import Environment
from scipy import asarray
class Lander(Environment):
indim = 7
outdim = 2
max_safe_landing_speed = 4.0
max_safe_x = 0.2
def __init__(self, acceleration=None):
self.fixed_acceleration = False
if acceleratio... | andschwa/uidaho-cs470-moonlander | environment.py | Python | bsd-2-clause | 2,512 |
import helper_modules
import battery_models
import params
import model
import testdriver
import plotdriver
| matthewpklein/battsimpy | battsimpy/__init__.py | Python | gpl-3.0 | 107 |
from Crypto import Random
from Crypto.Cipher import AES
from Crypto.Cipher import Blowfish
class aes:
@staticmethod
def encrypt(key, data, block_size=32):
"""Encrypt the data with AES using the specified encryption key."""
assert key is not None, "The key parameter is null!"
assert dat... | MagicWishMonkey/fuze | fuze/crypto/symmetric.py | Python | mit | 3,105 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.delete_column('pages_page', 'in_navigation')
db.delete_column('pages_page', 'in_footer')
def backwar... | Kniyl/mezzanine | mezzanine/pages/migrations/south/0011_delete_nav_flags.py | Python | bsd-2-clause | 5,250 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['BoxCox'] , ['Lag1Trend'] , ['Seasonal_Minute'] , ['NoAR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_BoxCox/model_control_one_enabled_BoxCox_Lag1Trend_Seasonal_Minute_NoAR.py | Python | bsd-3-clause | 156 |
# Create a model of Jz and ages. Bin heights? Straight line?
import numpy as np
import matplotlib.pyplot as plt
def age_jz_model(par, jz):
pars = # bin heights
| RuthAngus/granola | granola/model.py | Python | mit | 168 |
from test_support import *
do_flow(opt=["-u", "indefinite_bounded.adb"])
| ptroja/spark2014 | testsuite/gnatprove/tests/NB19-026__flow_formal_vectors/test.py | Python | gpl-3.0 | 73 |
#!/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... | grimmjow8/ansible | lib/ansible/modules/network/ios/_ios_template.py | Python | gpl-3.0 | 6,078 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
r"""
Bot to upload pages from a file.
This bot takes its input from a file that contains a number of
pages to be put on the wiki. The pages should all have the same
begin and end text (which may not overlap).
By default the text should have the intended title of the page
as t... | jayvdb/pywikibot-core | scripts/pagefromfile.py | Python | mit | 12,110 |
from genshi.builder import tag
from trac.core import implements,Component
from trac.ticket.api import ITicketActionController
from trac.perm import IPermissionRequestor
revision = "$Rev$"
url = "$URL$"
class DeleteTicketActionController(Component):
"""Provides the admin with a way to delete a ticket.
Illust... | dokipen/trac | sample-plugins/workflow/DeleteTicket.py | Python | bsd-3-clause | 1,496 |
from django.contrib import admin
from Course.models import Enrollment, Assignment
admin.site.register(Enrollment)
admin.site.register(Assignment) | RedBulli/CourseDeadlines | Course/admin.py | Python | mit | 147 |
"""Sample represents a physical sample submitted for testing
"""
from AccessControl import ClassSecurityInfo
from Products.CMFCore.WorkflowCore import WorkflowException
from bika.lims import bikaMessageFactory as _, logger
from bika.lims.utils import t, getUsers
from bika.lims.browser.widgets.datetimewidget import Date... | hocinebendou/bika.gsoc | bika/lims/content/sample.py | Python | mit | 41,371 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.