code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from gettext import gettext as _
NAME = _('Rwanda')
STATES = [
(_('Eastern Province'), 254, 605, 534, 0),
(_('Kigali'), 253, 485, 443, 0),
(_('Northern Province'), 252, 408, 326, 0),
(_('Southern Province'), 251, 310, 606, 0),
(_('Western Province'), 250, 230, 500, 45),
... | AlanJAS/iknowRwanda | recursos/0rwanda/datos/0rwanda.py | Python | gpl-3.0 | 4,873 |
# -*- coding: utf-8 -*-
class Exploit():
def execute(self, ip, port, flag_id):
import socket
import cPickle
import base64
import marshal
import random
import time
import datetime
flag = ''
error = 0
error_msg = ''
try:
s = socket.socket()
s.connect((ip,port)... | idkwim/ictf-framework | services/temperature/exploit.py | Python | gpl-2.0 | 857 |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | Achuth17/scikit-bio | skbio/io/tests/test_fastq.py | Python | bsd-3-clause | 30,554 |
r"""
===============================================================================
Submodule -- diffusive_conductance
===============================================================================
"""
import scipy as _sp
import OpenPNM.Utilities.misc as misc
def bulk_diffusion(physics, phase, network, pore_molar... | amdouglas/OpenPNM | OpenPNM/Physics/models/diffusive_conductance.py | Python | mit | 2,960 |
# encoding: utf8
from __future__ import absolute_import, division
from collections import defaultdict, namedtuple
import colorsys
import logging
import wtforms.validators
from wtforms import Form, ValidationError, fields
from wtforms.ext.sqlalchemy.fields import QuerySelectField
import pokedex.db
import pokedex.db.t... | Sanqui/spline-pokedex | splinext/pokedex/controllers/pokedex_gadgets.py | Python | mit | 30,941 |
# -*- coding:utf-8 -*-
from django.forms import ChoiceField, MultipleChoiceField
from yepes.forms.widgets import BitWidget
from yepes.types import Bit
from yepes.utils.properties import cached_property
class BitField(MultipleChoiceField):
def __init__(self, choices=(), widget=BitWidget, *args, **kwargs):
... | samuelmaudo/yepes | yepes/forms/fields/bit.py | Python | bsd-3-clause | 1,400 |
# Copyright 2016 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | americanstone/mongo-connector | tests/test_filter_fields.py | Python | apache-2.0 | 18,768 |
"""
Table of Contents Extension for Python-Markdown
* * *
(c) 2008 [Jack Miller](http://codezen.org)
Dependencies:
* [Markdown 2.0+](http://www.freewisdom.org/projects/python-markdown/)
"""
import markdown
from markdown import etree
import re
class TocTreeprocessor(markdown.treeprocessors.Treeprocessor):
# Iter... | lepture/Vealous | vealous/markdown/extensions/toc.py | Python | bsd-3-clause | 4,907 |
#
# Copyright 2015 LinkedIn Corp. 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 law or ... | lowks/simoorg | src/test/test_atropos.py | Python | apache-2.0 | 15,921 |
import unittest
import 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
def write_syn_dataset(csvPathname, rowCount, colCount, SEED):
r1 = random.Random(SEED)
dsf = open(csvPathname, "w+")
for i in range(rowCount)... | janezhango/BigDataMachineLearning | py/testdir_multi_jvm/test_parse_many_cols_fvec.py | Python | apache-2.0 | 2,463 |
langversion = 1
langname = "Russian"
##updater
# text construct: "Version "+version+available+changelog
#example: Version 3 available, click here to download, or for changelog click here
available = " доступна, кликните, чтобы скачать"
changelog = ", или посмотрите список изменений тут"
##world gen
worldify = "world ... | flying-sheep/omnitool | Language/russian.py | Python | mit | 3,091 |
import parseHTML
import parsedDictionary
import json
import urllib2
import tldextract
import re
#return a list of the actual embedded javascript code
def GetFullScripts(domain_name):
html = getPage(domain_name)
parse = parseHTML.parseHTML(html)
data = parse.tag_Data("script")
return data
#just get the... | marcb1/python-indexer | src/basicFunctions.py | Python | gpl-2.0 | 3,203 |
# -*- encoding: utf-8 -*-
from abjad import *
import pytest
def test_scoretools_Measure_scale_and_adjust_time_signature_01():
r'''Scales power-of-two measure to non-power-of-two measure.
No note head rewriting necessary.
'''
measure = Measure((3, 8), "c'8 d'8 e'8")
measure.scale_and_adjust_time_s... | mscuthbert/abjad | abjad/tools/scoretools/test/test_scoretools_Measure_scale_and_adjust_time_signature.py | Python | gpl-3.0 | 6,084 |
from __future__ import absolute_import, unicode_literals
import logging
import urlparse
from mopidy import models
from mopidy.audio import PlaybackState
from mopidy.core import listener
from mopidy.internal import deprecation, validation
logger = logging.getLogger(__name__)
class PlaybackController(object):
py... | rawdlite/mopidy | mopidy/core/playback.py | Python | apache-2.0 | 16,110 |
#encoding: utf-8
import time
from tentacle_pi.AM2315 import AM2315
from tentacle_pi.BMP180 import BMP180
from tentacle_pi.TSL2561 import TSL2561
from tentacle_pi.MCP9808 import MCP9808
from tentacle_pi.MPL115A2 import MPL115A2
from tentacle_pi.LM75 import LM75
"""
Simple test to check if all supported sensors are work... | crazyquark/tentacle_pi | test/test_load_sensors.py | Python | mit | 1,559 |
#!/usr/bin/env python
import oerplib
oerp = oerplib.OERP('erp.bringsvor.com', protocol='xmlrpc', port=8099)
user = oerp.login('admin', 'Hebekk1406', 'hebekk8')
invoices = oerp.get('account.invoice')
print "I", invoices
for n in invoices.search([]):
nn = invoices.read(n, ['ref', 'amount_total', 'partner_id', 'date_... | bringsvor/bc_korps | utils/write_dates.py | Python | agpl-3.0 | 413 |
"""
Assorted utilities for use in tests.
"""
import cmath
import contextlib
import errno
import math
import os
import sys
import tempfile
import numpy as np
from numba import config, errors, typing, utils, numpy_support
from numba.compiler import compile_extra, compile_isolated, Flags, DEFAULT_FLAGS
from numba.targe... | ssarangi/numba | numba/tests/support.py | Python | bsd-2-clause | 15,582 |
import openvoronoi as ovd
import ovdvtk
import time
import vtk
import datetime
import math
import random
import os
def drawLine(myscreen, p1, p2):
myscreen.addActor(ovdvtk.Line(p1=(p1.x, p1.y, 0), p2=(p2.x, p2.y, 0), color=ovdvtk.yellow))
def writeFrame(w2if, lwr, n):
w2if.Modified()
current_dir = os.ge... | aewallin/openvoronoi | python_examples/point_animation.py | Python | lgpl-2.1 | 3,469 |
import orbit
| edermartioli/ExoplanetLight | src/test/test-orbit.py | Python | mit | 13 |
# -*- coding: utf-8 -*-
import sys
import os
from chown import chown
from chmodsym import chmod
def get_actperms(path):
try:
# use os.lstat instead of os.stat in order to not following symlinks
actpermsraw = os.lstat(path)
except OSError, e:
if e.errno == 2:
# this means t... | open-dynaMIX/experms | src/experms/action/action.py | Python | gpl-3.0 | 1,586 |
#coding=UTF-8
necessary_request={
"appliance":{
"air conditioner":{
"on":['location','temperature'],
"off":['location']
}
}
}
class Service(object):
def __init__(self,type):
self.type=type
class ApplianceService(Service):
def __init__(self,name):
... | ilab-tongji/raas | nlp/service.py | Python | mit | 1,741 |
import time
import numpy as np
from alias.io.command_line_output import StdOutTable
from alias.src.intrinsic_surface import xi
from alias.src.linear_algebra import update_A_b, lu_decomposition
from alias.src.spectra import intrinsic_area
from alias.src.surface_reconstruction import surface_reconstruction
from alias.s... | franklongford/alias | alias/src/self_consistent_cycle.py | Python | bsd-2-clause | 10,907 |
# Copyright (c) 2013 ISP RAS.
# 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 ... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/scheduler/filters/pci_passthrough_filter.py | Python | gpl-2.0 | 1,975 |
#!/usr/bin/env python
# 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 https://mozilla.org/MPL/2.0/.
import re
import os
import sys
from io import BytesIO
GECKO_DIR = os.path.dirname(__file__.rep... | splav/servo | components/style/gecko/regen_atoms.py | Python | mpl-2.0 | 5,700 |
import shipment_utility
from openerp.osv import fields, osv
class res_partner(osv.osv):
"""
inherited product.product
"""
_inherit = "res.partner"
_columns = {
'is_freight_forwarder': fields.boolean('Freight Forwarder', help="Freight Forwarder"),
'is_carrier': fields.boolean('Carri... | duyetdev/openerp-6.1.1 | openerp/addons/openerp_shipment-master/partner.py | Python | agpl-3.0 | 790 |
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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
... | rvs/gpdb | src/test/tinc/tinctest/lib/__init__.py | Python | apache-2.0 | 7,104 |
# Copyright 2015 Brocade Communications System, Inc.
# 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
#
#... | openstack/tacker | tacker/tests/unit/db/utils.py | Python | apache-2.0 | 24,612 |
import serial
import time
ser = serial.Serial(
port = "/dev/ttyACM0",
baudrate = 9600,
bytesize = serial.EIGHTBITS
)
time.sleep(2)
ser.write("\x36\x20\x00")
print(hex(ord(ser.read(1))))
print(hex(ord(ser.read(1))))
print(hex(ord(ser.read(1))))
print(hex(ord(ser.read(1))))
print(hex(o... | DelusionalLogic/TAS-100 | python/test.py | Python | gpl-3.0 | 571 |
#!/usr/bin/python3
#
# Copyright 2014 Joseph Haig
#
# 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... | jrmhaig/Bakery | bakery.py | Python | apache-2.0 | 1,223 |
import re
import unicodedata
from injector import inject, AssistedBuilder
import cx_Oracle as pyoracle
class Oracle(object):
"""Wrapper to connect to Oracle Servers and get all the metastore information"""
@inject(oracle=AssistedBuilder(callable=pyoracle.connect), logger='logger')
def __init__(self, orac... | scm-spain/slippin-jimmy | src/slippinj/databases/drivers/oracle.py | Python | apache-2.0 | 7,437 |
# coding: utf-8
from __future__ import absolute_import
from __future__ import print_function
try:
from .error import * # NOQA
from .nodes import * # NOQA
from .compat import text_type, binary_type, to_unicode, PY2, PY3, ordereddict
from... | naparuba/kunai | opsbro/misc/internalyaml/ruamel/yaml/representer.py | Python | mit | 34,222 |
thon# -*- coding: utf-8 -*-
"""
Created on Fri May 24 15:20:18 2019
@author: jarl
"""
from matplotlib import pyplot as plt
import numpy as np
from sympy import Symbol
import os
import re
import json
PC_dir = './DB/Pure Component Properties (Several Properties)'
json_df = {}
T_c = []
P_c = []
V_m_c = []
R = 8.... | JarlPed/DDBSTCrawler | Vizualization_data.py | Python | mit | 1,229 |
from merc import feature
from merc import mode
class RoleFeature(feature.Feature):
NAME = __name__
install = RoleFeature.install
@RoleFeature.register_channel_mode
class Operator(mode.ChannelRoleMode):
CHAR = "o"
def toggle_for_target(self, target):
target.is_operator = not target.is_operator
def ge... | merc-devel/merc | merc/features/rfc1459/role.py | Python | mit | 941 |
"""Support for Netatmo Smart thermostats."""
import logging
from typing import List, Optional
import voluptuous as vol
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
CURRENT_HVAC_HEAT,
CURRENT_HVAC_IDLE,
DEFAULT_MIN_TEMP,
HVAC_MODE_AUTO,... | tboyce021/home-assistant | homeassistant/components/netatmo/climate.py | Python | apache-2.0 | 20,029 |
"""
The B{0install} command-line interface.
"""
# Copyright (C) 2011, Thomas Leonard
# See the README file for details, or visit http://0install.net.
from zeroinstall import _
import os, sys
from optparse import OptionParser
import logging
from zeroinstall import SafeException
valid_commands = ['select', 'download'... | pombredanne/zero-install | zeroinstall/cmd/__init__.py | Python | lgpl-2.1 | 4,130 |
from django.conf import settings
from django.utils.module_loading import import_string
from django.views.generic.list import MultipleObjectMixin
from oscar.core.loading import get_class, get_model
BrowseCategoryForm = get_class('search.forms', 'BrowseCategoryForm')
SearchHandler = get_class('search.search_handlers', ... | sonofatailor/django-oscar | src/oscar/apps/catalogue/search_handlers.py | Python | bsd-3-clause | 4,282 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_12_01/operations/virtual_network_peerings_operations.py | Python | mit | 19,137 |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from upload_avatar.app_settings import UPLOAD_AVATAR_URL_PREFIX_CROPPED, UPLOAD_AVATAR_URL_PREFIX_ORIGINAL
from . import views
urlpatterns = patterns('',
url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'admin/login... | yueyoum/django-upload-avatar | example/app/urls.py | Python | bsd-3-clause | 712 |
# pylint: disable=invalid-name
"""Extract feature of iter vars
There are two types of feature
1) Itervar feature
This feature is extracted based on loop variables.
Different loop structures will result in different shapes of feature
2) Curve sample feature (relation feature)
This feature is extracted by sampl... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/python/tvm/autotvm/feature.py | Python | apache-2.0 | 5,382 |
#funções de entrada e saida
# print() - imprime na tela
# input('Texto complementar') - imprime o texto e solicita ao usuario
# que digite algo que será o retorno da função
#imprimindo na tela
print('Isso será impreso na tela e pulará uma linha\n')
# Solicitando que usuario digite algo
input('Digite algo p... | GlauberGoncalves/Python | 03-entrada-e-saida-de-dados.py.py | Python | mit | 338 |
import re
import unittest
from urlparse import urlsplit, urlunsplit
from xml.dom.minidom import parseString, Node
from django.conf import settings
from django.core import mail
from django.core.management import call_command
from django.core.urlresolvers import clear_url_caches
from django.db import transaction, connec... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.2/django/test/testcases.py | Python | bsd-3-clause | 22,281 |
from keras.models import load_model
from keras.preprocessing import image
import numpy as np
def load_img(path):
img = image.load_img(path, target_size=img_size)
x = image.img_to_array(img)
return x
def predict(url):
global model
img = load_img(url)
img = np.expand_dims(img, axis=0)
pred... | GuminEgor/CheeseMilkTomatoRobot | website/predict.py | Python | mit | 602 |
#backup copy of script original version of script in bamsurgeon file
import sys
import re
import os
from subprocess import Popen, PIPE
#set up files
my_distance = sys.argv[1]
my_directory = sys.argv[2]
my_name = sys.argv[5]
my_distance =int(my_distance)
my_out_file = "BEDCOMPARE_{my_name}.txt".format(**locals())
my_ou... | klaricch/Transposons2 | scripts/bed_compare9_redo.py | Python | mit | 14,438 |
# (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... | hfinucane/ansible | lib/ansible/plugins/action/__init__.py | Python | gpl-3.0 | 32,910 |
__author__ = 'breddels'
# from https://github.com/pyinstaller/pyinstaller/wiki/Recipe-PyQt4-API-Version
import sip
sip.setapi(u'QDate', 2)
sip.setapi(u'QDateTime', 2)
sip.setapi(u'QString', 2)
sip.setapi(u'QTextStream', 2)
sip.setapi(u'QTime', 2)
sip.setapi(u'QUrl', 2)
sip.setapi(u'QVariant', 2)
| maartenbreddels/vaex | packages/vaex-ui/vaex/ui/rthook_pyqt4.py | Python | mit | 298 |
##############################################################################
#
# Copyright (c) 2004 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | Donkyhotay/MoonPy | zope/app/apidoc/codemodule/metaconfigure.py | Python | gpl-3.0 | 1,513 |
import numpy as np
from numpy.testing import TestCase, assert_array_almost_equal
from scikits.talkbox.transforms.dct_ref import direct_dctii, direct_dctii_2
from scikits.talkbox.transforms.dct import dctii
class TestDCTTypeII(TestCase):
Y0 = np.array([16.58312395177700, -10.41945851392763, 0.,
-1.12380254... | cournape/talkbox | scikits/talkbox/transforms/tests/test_dct.py | Python | mit | 1,283 |
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2019 RERO
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that... | rero/reroils-app | rero_ils/modules/acq_invoices/jsonresolver.py | Python | gpl-2.0 | 1,312 |
# Copyright 2008-2014 Nokia Solutions and 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 applicable l... | ldtri0209/robotframework | src/robot/running/baselibrary.py | Python | apache-2.0 | 983 |
# -*- coding: utf-8 -*-
"""
Created on 26-02-2016
Bobby McKinney
PID initial program
"""
import omegacn7500
import time
def PIDstop(pid1,pid2,pid3,pid4):
time.sleep(0.1)
while True:
try:
pid1.stop()
print 'PID 1 stopped'
break
except IOError:
pri... | bobbymckinney/seebeck_measurement | programs/PIDprogramstop.py | Python | gpl-3.0 | 2,049 |
"""
Uses MINE (Maximal Information-based Nonparametric Exploration) to rank variables:
http://www.exploredata.net/
@copyright: The Broad Institute of MIT and Harvard 2015
"""
import argparse
import sys, csv, os
src_file = "./data/sources.txt"
range_file = "./data/ranges.txt"
ignore_file = "./data/ignore.txt"
def r... | broadinstitute/ebola-predictor | utils/run_mine.py | Python | bsd-2-clause | 4,082 |
#
# synctool.unbuffered.py WJ110
#
# synctool Copyright 2015 Walter de Jong <walter@heiho.net>
#
# synctool COMES WITH NO WARRANTY. synctool IS FREE SOFTWARE.
# synctool is distributed under terms described in the GNU General Public
# License.
#
# - unbuffered output, needed for synctool_master
#
'''ma... | walterdejong/synctool | src/synctool/unbuffered.py | Python | gpl-2.0 | 1,686 |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import print_function, unicode_literals, absolute_import
import os
import re
import inspect
def test_if_all_versions_match(... | projectatomic/osbs-client | tests/test_osbs.py | Python | bsd-3-clause | 1,224 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import pytest
class TestMetainfo(object):
config = """
tasks:
test_content_size:
mock:
- {title: 'size 10MB', description:... | LynxyssCZ/Flexget | flexget/tests/test_metainfo.py | Python | mit | 10,315 |
# (C) British Crown Copyright 2010 - 2017, Met Office
#
# This file is part of Iris.
#
# Iris 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 of the License, or
# (at your option) any l... | QuLogic/iris | lib/iris/tests/test_pp_cf.py | Python | gpl-3.0 | 7,152 |
import bpy
from bpy.props import *
from bpy.types import Node, NodeSocket
from arm.logicnode.arm_nodes import *
class OnSurfaceNode(Node, ArmLogicTreeNode):
'''On surface node'''
bl_idname = 'LNOnSurfaceNode'
bl_label = 'On Surface'
bl_icon = 'CURVE_PATH'
property0: EnumProperty(
items = [(... | luboslenco/cyclesgame | blender/arm/logicnode/input_on_surface.py | Python | lgpl-3.0 | 761 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from typing import Any, List, Dict, Optional
from django.utils import translation
from django.utils.translation import ugettext as _
from django.conf import settings
from django.contrib.auth import authenticate, login, get_backends
from django.core.urlreso... | reyha/zulip | zerver/views/__init__.py | Python | apache-2.0 | 34,560 |
import sys
def setup(core, object):
return
#Warriors Honor | ProjectSWGCore/NGECore2 | scripts/object/tangible/painting/painting_trandoshan_m.py | Python | lgpl-3.0 | 63 |
# Rewind is an event store server written in Python that talks ZeroMQ.
# Copyright (C) 2012 Jens Rantil
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License,... | JensRantil/rewind | rewind/server/test/test_config.py | Python | agpl-3.0 | 4,378 |
#pylint: disable=missing-docstring
#################################################################
# DO NOT MODIFY THIS HEADER #
# MOOSE - Multiphysics Object Oriented Simulation Environment #
# #
# (c) 2010... | Chuban/moose | python/chigger/filters/ContourFilter.py | Python | lgpl-2.1 | 2,812 |
# http://rosettacode.org/wiki/K-means%2B%2B_clustering
from math import pi, sin, cos
from random import random, choice
from copy import copy
FLOAT_MAX = 1e100
class Point:
__slots__ = ["x", "y", "group"]
def __init__(self, x=0.0, y=0.0, group=0):
self.x, self.y, self.group = x, y, group
def g... | shedskin/shedskin | examples/kmeanspp.py | Python | gpl-3.0 | 4,608 |
'''
Data from: Srivastav et al. 2016
'''
import snid_runner
# Run SNID:
snid = snid_runner.run_snid('29janflxsc.dat')
print 'Best guess at the type:', snid.select_best_type()
print 'Best estimation of the age: {:.1f}'.format(snid.select_best_age())
print 'Redshift: {:.4f} +-{:.4f} (or +-{:.4f})'.format(*snid.select_b... | astrobarn/SNIDrunner | example/example.py | Python | gpl-3.0 | 336 |
import django_filters
from rest_framework import filters
class CaseInsensitiveBooleanFilter(django_filters.Filter):
# The default django_filters boolean filter *only* accepts True and False
# which is problematic when dealing with non-Python clients. This allows
# the lower case variants, as well as 0 and... | mozilla/normandy | normandy/base/api/filters.py | Python | mpl-2.0 | 1,421 |
from django.conf.urls import url
from .views import WikiListView, WikiAddView, WikiDetailView, WikiEditView
urlpatterns = [
url(r'^list/$', WikiListView.as_view(), name='wiki_list'),
url(r'^add/$', WikiAddView.as_view(), name='wiki_add'),
url(r'^detail/$', WikiDetailView.as_view(), name='wiki_detail'),
... | itpubs/OneStack | apps/wiki/urls.py | Python | mit | 383 |
#
# 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 | airflow/contrib/operators/grpc_operator.py | Python | apache-2.0 | 1,112 |
# encoding: 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):
# Adding field 'Item.admin_subletter'
db.add_column('sqp_item', 'admin_subletter', self.gf('django.db.mode... | recsm/SQP | sqp/migrations/0061_adding_item_subletter.py | Python | mit | 24,137 |
class MockSettings(object):
def __init__(self, values):
self.values = values
def get_safe(self, value):
return self.values.get(value, None)
MockOptions = MockSettings
class MockDepsCppInfo(object):
def __init__(self):
self.include_paths = []
self.lib_paths = []
... | tivek/conan | conans/test/utils/conanfile.py | Python | mit | 2,207 |
from __future__ import unicode_literals
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.generic import GenericRelation, GenericForeignKey
from django.db import models
from django.test import TestCase
from rest_framework import serializers
from rest_framework.compat import pyt... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/rest_framework/tests/test_genericrelations.py | Python | agpl-3.0 | 4,602 |
#!/usr/bin/env python
import sys
import os
import argparse
import glob
import egglib
# This script reads in a fasta alignment or a directory of alignments
# and a list of outgroup sequences. Alignments in directory must end in .fasta.
# Alignments must also be in frame coding sequence.
# It outputs population genetic... | tatumdmortimer/popgen-stats | selectionStats.py | Python | mit | 5,509 |
#!/usr/bin/python
# ----------------------------------------------------------------------------
# cocos "jscompile" plugin
#
# Copyright 2013 (C) Intel
#
# License: MIT
# ----------------------------------------------------------------------------
'''
"jscompile" plugin for cocos command line tool
'''
__docformat__ =... | dios-game/dios-cocos | src/oslibs/cocos/cocos-src/tools/cocos2d-console/plugins/plugin_jscompile/__init__.py | Python | mit | 12,716 |
import move
from game.gamesrc.scripts import status_effects
class Combo(object):
"""
Combo move holds all the information on what each combo moves
positional costs are, additional effects, crit bonuses, etc.
self.name (string) - name of the combo
self.pos_vict (int) - positional points modifier fo... | cluebyte/Fantasy-Combat | combat/combo.py | Python | bsd-2-clause | 17,966 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import logging
from vmchecker.generic_executor import Host,VM
_logger = logging.getLogger('vm_executor')
from threading import Thread
import time
class LXCHost(Host):
def getVM(self, bundle_dir, vmcfg, assignment):
return LXCVM(self, bundle_dir, vmcfg... | cojocar/vmchecker | vmchecker/lxc_executor.py | Python | mit | 3,638 |
from .widgets import BaseFrame
__author__ = 'zz'
dummy = object()
class FrameStack:
def __init__(self, root, frame_list=None, now=None):
self._root = root
self._frames = list(frame_list) if frame_list else []
self._now = now
def previous_frame(self, pass_data):
"""
... | littlezz/IslandCollection | gui/layouts.py | Python | mit | 2,879 |
# -*- coding: utf-8 -*-
"""
format-sql
Makes your SQL readable.
Copyright (c) 2015, Friedrich Paetzke (paetzke@fastmail.fm)
All rights reserved.
"""
from __future__ import print_function
import sys
def print_data(msg):
print(msg)
def print_non_data(msg):
print(msg, file=sys.stderr)
| paetzke/format-sql | format_sql/util.py | Python | bsd-2-clause | 298 |
import re
import os
import difflib
import guessit
from . import Element, Transformer, Empty, EOF
def _regex_chain_process(s, regexes, *args, **kwargs):
for (regex, repl) in regexes:
s = re.subn(regex, repl, s, *args, **kwargs)[0]
return s
def _apply_on_fields(func, d, fields):
for field in [f fo... | ldotlopez/pypes | pypes/mediaocd.py | Python | gpl-2.0 | 1,473 |
#
# 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... | hengyicai/OnlineAggregationUCAS | python/pyspark/statcounter.py | Python | apache-2.0 | 4,354 |
#!/usr/bin/env python
"""
_configuration_
Util class to read and access the cirrus.conf file
that defines how the various commands operate.
Commands should access this by doing
from cirrus.configuration import load_configuration
conf = load_configuration()
"""
import os
import subprocess
from cirrus.gitconfig impo... | evansde77/cirrus | src/cirrus/configuration.py | Python | apache-2.0 | 11,858 |
__all__ = ["sunpy__load", "sunpy__plot", "sunpy__synthetic_image"]
| linan7788626/hackday_03112016 | sunpy/__init__.py | Python | mit | 70 |
# 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/airflow | airflow/providers/yandex/hooks/yandex.py | Python | apache-2.0 | 6,138 |
# a minimal tracking script - this will start all peer
# services and attach everything appropriately
# change parameters depending on your pan eyeY, pins and
# Arduino details
# all commented code is not necessary but allows custom
# options
port = "COM8"
eyeXPin = 3
eyeYPin = 6
headXPin = 10
headYPin = 9
eyes = ... | MyRobotLab/pyrobotlab | home/Alessandruino/InMoov.Alessandruino.py | Python | apache-2.0 | 2,463 |
import os
import os.path
from argparse import ArgumentParser
from PIL import Image
from mako.template import Template
__here__ = os.path.dirname(__file__)
extensions = set(['jpg', 'jpeg', 'tif', 'tiff', 'bmp', 'png', 'gif'])
def readable_bytes(n):
n = float(n)
for exponent, prefix in ((5, 'P'),
... | storborg/thumbs | thumbs/__init__.py | Python | mit | 2,470 |
# -*- coding: utf-8 -*-
# @Author: zebedeen
# @Date: 2017-04-10 10:41:20
# @Last Modified by: Richard Millar
# @Last Modified time: 2017-04-25 13:58:00
# # # ------------ IMPORT REQUIRED MODULES ------------ # # #
from _version import __version__
import forward | OMS-NetZero/FAIR-pro | fair/__init__.py | Python | apache-2.0 | 267 |
"""\
Encode and decode using Douglas Crockford's base32 encoding scheme:
http://www.crockford.com/wrmg/base32.html
The module uses the base64 module's API for base32 functions:
base64.b32encode(s)
base64.b32decode(s[, casefold[, map01]])
See base64 for more info.
"""
__version__ = '0.0.2'
import base6... | ingydotnet/crockford-py | crockford/__init__.py | Python | bsd-2-clause | 867 |
"""Collection of DIRAC useful file related modules.
.. warning::
By default on Error they return None.
"""
# pylint: skip-file
# getGlobbedFiles gives "RuntimeError: maximum recursion depth exceeded" in pylint
import os
import hashlib
import random
import glob
import sys
import re
import errno
__RCSID__ = "$Id$"... | arrabito/DIRAC | Core/Utilities/File.py | Python | gpl-3.0 | 7,925 |
##
# Copyright (c) 2012-2013 Apple Inc. 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 l... | skarra/CalDAVClientLibrary | caldavclientlibrary/protocol/caldav/query.py | Python | apache-2.0 | 4,678 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Run tests for dsh-orderwrt-bug.
This is for running tests from `setup.py test`. Most users should use
`manage.py test` instead.
"""
import os
import sys
# Setup path to Django settings
os.environ['DJANGO_SETTINGS_MODULE'] = 'sample_site.settings'
# Add project folde... | jwhitlock/dsh-orderwrt-bug | sample_site/runtests.py | Python | mpl-2.0 | 986 |
import asposepdfcloud
from asposepdfcloud.PdfApi import PdfApi
from asposepdfcloud.PdfApi import ApiException
import asposestoragecloud
from asposestoragecloud.StorageApi import StorageApi
from asposestoragecloud.StorageApi import ResponseMessage
apiKey = "XXXXX" #sepcify App Key
appSid = "XXXXX" #sepcify App SID
api... | asposepdf/Aspose_Pdf_Cloud | Examples/Python/Examples/GetTextFormatOfPDFSegment.py | Python | mit | 1,391 |
# Copyright 2015 Mirantis Inc.
# 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... | aforalee/RRally | rally/plugins/openstack/scenarios/manila/utils.py | Python | apache-2.0 | 10,193 |
# -*- coding: utf-8 -*-
# Copyright 2017, Digital Reasoning
#
# 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... | clarkperkins/stackdio | stackdio/api/search/serializers.py | Python | apache-2.0 | 1,170 |
# (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... | dlundquist/ansible | lib/ansible/utils/template.py | Python | gpl-3.0 | 13,049 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-08-21 18:59
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
('dispatch', '0017_subsections'),
]
operations = [
migrations.CreateModel(... | ubyssey/dispatch | dispatch/migrations/0018_podcasts.py | Python | gpl-2.0 | 2,099 |
#!/bin/python
import subprocess
import sys
import io
import os
import json
to_resolve_path = sys.argv[1]
dest_repo_path = sys.argv[2]
##load all snapshosts to merge
#list snapshots in to_resolve
p = subprocess.Popen(['hdfs', 'dfs', '-ls', to_resolve_path], stdout=subprocess.PIPE) #, shell=True
(output, err) = p.com... | andybab/OfflineESIndexGenerator | arange_snapshosts.py | Python | apache-2.0 | 3,517 |
# Copyright (C) 2015-2018 SignalFx, Inc.
#
# Docker container orchestration utility.
import jinja2
import os
import sys
import yaml
from yaml.constructor import ConstructorError, SafeConstructor
from . import exceptions
class MaestroYamlConstructor(SafeConstructor):
"""A PyYAML object constructor that errors on... | signalfuse/maestro-ng | maestro/loader.py | Python | apache-2.0 | 3,733 |
#!/usr/bin/python3
"""A script for resizing images to specified maximum dimensions
Uses "convert" utility of the ImageMagick suite of tools, which thus must be installed
@author: Frantisek Hajnovic
@email: ferohajnovic@gmail.com
"""
# ---------------------------------------------------------------
# Imports
# -----... | silverfield/imgres | imgres.py | Python | mit | 6,791 |
# hack script to set the bad pixels to the right value for PPOL
import os
import glob
import numpy as np
import astroimage as ai
ai.set_instrument('Mimir')
bkgFreeDir = 'C:\\Users\\Jordan\\FITS_data\\Mimir_data\\pyPol_Reduced\\201611\\bkgFreeHWPimages'
fileList = glob.glob(
os.path.join(bkgFreeDir, '*.fits')
)
fo... | jmontgom10/Mimir_pyPol | hackScript_setBadPixForPPOL.py | Python | mit | 905 |
"""Simple implementation non-blocking code execution.
By Torgrim "Fable" Ruud - torgrim.ruud@gmail.com
"""
import threading
from queue import Queue
from .cli import *
import time
# noinspection PyUnusedLocal
class ThreadHandler:
queue = []
activethreads = {}
@staticmethod
def create_thread(callbac... | f4ble/Arkon | ark/thread_handler.py | Python | apache-2.0 | 1,863 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from random import randrange
from flask import jsonify
from aurantia_webservice.models import Arduino
def find_arduino(ip):
ip_founded = Arduino.query.filter_by(ip_address=str(ip)).first()
if ip_founded is not None:
return True
return False
def ch... | Aurantia/AurantiaWebService | aurantia_webservice/core/utils.py | Python | gpl-3.0 | 973 |
import unittest
import tempfile
import os
import caffe
class ElemwiseScalarLayer(caffe.Layer):
"""A layer that just multiplies by ten"""
def setup(self, bottom, top):
self.layer_params_ = eval(self.param_str_)
self.value_ = self.layer_params_['value']
if self.layer_params_['op'].lowe... | zimenglan-sysu-512/pose_action_caffe | caffe/python/caffe/test/test_python_layer_with_param_str.py | Python | mit | 3,180 |
"""
Stub implementation of EdxNotes for acceptance tests
"""
from __future__ import absolute_import
import json
import re
from copy import deepcopy
from datetime import datetime
from math import ceil
from uuid import uuid4
import six
from six.moves.urllib.parse import urlencode # pylint: disable=import-error
from ... | ESOedX/edx-platform | common/djangoapps/terrain/stubs/edxnotes.py | Python | agpl-3.0 | 12,662 |
#!/usr/bin/env python
#
# Copyright 2013 Institute for Theoretical Information Technology,
# RWTH Aachen University
#
# Authors: Johannes Schmitz <schmitz@ti.rwth-aachen.de>
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | iohannez/gr-zmqblocks | examples/client.py | Python | gpl-3.0 | 4,224 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.