text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import logging
import platform
from os.path import abspath
from django.utils.functional import lazy
import... | analytics-pros/mozilla-bedrock | bedrock/settings/base.py | Python | mpl-2.0 | 33,383 | 0.000899 |
#!/usr/bin/env python
"""
create a directory in the FileCatalog
"""
import os
import DIRAC
from DIRAC.Core.Base import Script
from COMDIRAC.Interfaces import critical
from COMDIRAC.Interfaces import DSession
from COMDIRAC.Interfaces import createCatalog
from COMDIRAC.Interfaces import pathFromArguments
if __name__... | pigay/COMDIRAC | Interfaces/scripts/dmkdir.py | Python | gpl-3.0 | 1,488 | 0.024866 |
"""Run the migrator tool through its CLI."""
from pathlib import Path
import sys
from migrator import cli
if __name__ == '__main__':
config_path = Path(Path(__file__).parent.resolve(), '..', '..', '..', 'config')
config_path = config_path.resolve() if config_path.exists() else None
cli.run(sys.argv[1:], co... | RCOS-Grading-Server/HWserver | migration/run_migrator.py | Python | bsd-3-clause | 331 | 0.003021 |
import sys, os
sys.path.insert(1, os.path.join(sys.path[0], '../../../'))
import script.rio as io
import script.initial_condition.noh1D as noh1D
# Domain properties
lx = 1.0
ly = 1.0
Nx = 131072
Ny = 1
# Scheme execution options
T = 0.6
CFL = 0.5
gamma = 5./3.
BClayer = 1
quantityList = ['rho', 'rhou_x', 'rhou_y',... | will-iam/Variant | casepy/eulerRuO2/nNoh131072x1/chars.py | Python | mit | 472 | 0.012712 |
import pathlib
from typing import Optional
from cumulusci.core.exceptions import TaskOptionsError
from cumulusci.core.utils import process_bool_arg, process_list_arg
from cumulusci.salesforce_api.metadata import ApiDeploy
from cumulusci.salesforce_api.package_zip import MetadataPackageZipBuilder
from cumulusci.tasks.s... | SalesforceFoundation/CumulusCI | cumulusci/tasks/salesforce/Deploy.py | Python | bsd-3-clause | 5,848 | 0.002394 |
# 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... | jcshen007/cloudstack | test/integration/smoke/misc/test_escalations_templates.py | Python | apache-2.0 | 8,699 | 0.002299 |
#! /usr/bin/env python3
import json
from s2f.sforce import SClient
from s2f import util
"""
Print SalesForce API versions.
Use this to set the version in the config file JSON.
"""
if __name__ == '__main__':
util.setupLogging()
client = SClient(util.SForceCfgFileName, util.SForceTokenFileName)
print(json.... | futurice/sforce2flowdock | sforce-show-api-versions.py | Python | gpl-3.0 | 362 | 0 |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
a='51.01 633.55 Td\n'
b='(LICZBA UPRAWNIONYCH) Tj\n'
re.compile(r'() () Td\\n')
m = re.match(r'(?P<x>[\d\.]+) (?P<y>[\d\.]+) Td\n', a)
print(m.groupdict())
t = re.match(r'\((?P<t>.*)\) Tj\n', b)
print(t.groupdict())
# <codecell>
import json
import re
... | orian/umo | pdf_scraping.py | Python | mit | 12,546 | 0.012195 |
# Copyright (c) 2010-2014 Turbulenz Limited
"""
Controller class for deploying a game
"""
from urllib3.exceptions import HTTPError, SSLError
from simplejson import dump as json_dump, load as json_load, loads as json_loads, JSONDecodeError
from os import stat, sep, error, rename, remove, makedirs, utime, access, R_OK, ... | turbulenz/turbulenz_local | turbulenz_local/lib/deploy.py | Python | mit | 37,875 | 0.002139 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2016 Jakub Beranek
#
# This file is part of Devi.
#
# Devi 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, version 3 of the License, or
# (at yo... | Kobzol/debug-visualizer | gui/config.py | Python | gpl-3.0 | 2,272 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from core.sessionManager.Video import Video
class Project(object):
def __init__(self, name, path):
super(Project, self).__init__()
self._name = name
self._path = path
self._videos = []
self._sketchBoardVideos = [] #/!\ Unique ... | clejeu03/EWP | core/sessionManager/Project.py | Python | mit | 3,334 | 0.007199 |
from tehbot.plugins import *
import tehbot.plugins as plugins
import wolframalpha
import prettytable
class WolframAlphaPlugin(StandardPlugin):
def __init__(self):
StandardPlugin.__init__(self)
self.parser.add_argument("query", nargs="+")
def initialize(self, dbconn):
StandardPlugin.ini... | spaceone/tehbot | tehbot/plugins/wolframalpha/__init__.py | Python | mit | 2,727 | 0.002567 |
import calendar
import datetime
import functools
import hashlib
import logging
import uuid
import user_agents
from bitpack import BitStream, BitField, register_data_type
from bitpack.utils import pack, unpack
from bottle_utils.common import to_bytes
from pytz import utc
FIELD_SEPARATOR = '$'
DESKTOP = 1
PHONE = 2
... | Outernet-Project/librarian-analytics | librarian_analytics/data.py | Python | gpl-3.0 | 4,521 | 0 |
## \file
## \ingroup tutorial_dataframe
## \notebook -draw
## \brief An example of complex analysis with RDataFrame: reconstructing the Higgs boson.
##
## This tutorial is a simplified but yet complex example of an analysis reconstructing the Higgs boson decaying to two Z
## bosons from events with four leptons. The da... | karies/root | tutorials/dataframe/df103_NanoAODHiggsAnalysis.py | Python | lgpl-2.1 | 17,701 | 0.00661 |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import scipy.interpolate
from PIL import Image
matplotlib.use('Qt5Agg')
class matplotFF():
"""A class for plotting far-field measurements of lasers. It requires
the 'x z signal' format, but supports stitched measurements — the data
can b... | alkamid/lab-scripts | matplotlib-scripts/matplotFF.py | Python | gpl-2.0 | 9,814 | 0.005199 |
#### PATTERN | NL | PARSER COMMAND-LINE ##################################
# Copyright (c) 2010 University of Antwerp, Belgium
# Author: Tom De Smedt <tom@organisms.be>
# License: BSD (see LICENSE.txt for details).
# http://www.clips.ua.ac.be/pages/pattern
##############################################################... | hayd/pattern | pattern/text/nl/__main__.py | Python | bsd-3-clause | 521 | 0.001919 |
#!/usr/bin/python
import socket
HOST = raw_input("enter scanner ip : ")
PORT = 14882
if __name__ == "__main__":
socks = socket.socket()
socks.connect((HOST, PORT))
socks.settimeout(1)
try:
while True:
command = raw_input("# ")
if command != "":
socks.se... | mbouchar/xc2424scan | src/xc2424scan/utils/test.py | Python | gpl-2.0 | 620 | 0.003226 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
IMPORT
Permite adaptar un exportado traducido a uno válido para hoa
Autor: PABLO PIZARRO @ github.com/ppizarror
Fecha: 2014-2015
Licencia: GPLv2
"""
__author__ = "ppizarror"
# Importación de librerías
import os
import sys
reload(sys)
# noinspection P... | ppizarror/korektor | bin/langeditor/_import.py | Python | gpl-2.0 | 1,200 | 0.003342 |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the fundrawtransaction RPC."""
from decimal import Decimal
from test_framework.test_framework imp... | merelcoin/merelcoin | test/functional/rpc_fundrawtransaction.py | Python | mit | 34,177 | 0.009509 |
import logging
from django.http import HttpResponse
from receiver.submitresponse import SubmitResponse
def duplicate_attachment(way_handled, additional_params):
'''Return a custom http response associated the handling
of the xform. In this case, telling the sender that
they sub... | icomms/wqmanager | apps/receiver/__init__.py | Python | bsd-3-clause | 1,031 | 0.007759 |
import math
from map_utils import *
def calc_field_grad(m, pt):
w = len(m[0])
h = len(m)
if pt[0]>=w or pt[0]<0:
return None
if pt[1]>=h or pt[1]<0:
return None
px_s = pt[0]-1
px_e = pt[0]+1
if px_s>=w or px_s<0:
px_s = pt[0]
if px_e>=w or px_e<0:
... | snegovick/dswarm_simulator | path_finding/smoothing_algorithms.py | Python | gpl-3.0 | 6,317 | 0.008073 |
class Node():
def __init__(self, name):
self.name = name
def __str__(self):
if self.name is not None:
return self.name
else:
return "internal_{}".format(id(self))
class Edge():
def __init__(self, node1, node2):
self.nodes = [node1, node2]
def __... | crf1111/Bio-Informatics-Learning | Bio-StrongHold/src/Enumerating_Unrooted_Binary_Trees.py | Python | mit | 3,854 | 0.003114 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/yc/code/calibre/calibre/src/calibre/gui2/preferences/look_feel.ui'
#
# Created: Thu Oct 25 16:54:55 2012
# by: PyQt4 UI code generator 4.8.5
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui... | yeyanchao/calibre | src/calibre/gui2/preferences/look_feel_ui.py | Python | gpl-3.0 | 19,303 | 0.004403 |
import re
import chardet
import sys
RE_CHARSET = re.compile(br'<meta.*?charset=["\']*(.+?)["\'>]', flags=re.I)
RE_PRAGMA = re.compile(br'<meta.*?content=["\']*;?charset=(.+?)["\'>]', flags=re.I)
RE_XML = re.compile(br'^<\?xml.*?encoding=["\']*(.+?)["\'>]')
CHARSETS = {
'big5': 'big5hkscs',
'gb2312': 'gb18030... | AlphaCluster/NewsBlur | vendor/readability/encoding.py | Python | mit | 2,034 | 0.004916 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
class Time:
def ums(i, ignoreZero=True):
i = float(i)
hours = int(i / 3600)
rest = i % 3600
minutes = int(rest / 60)
seconds = int(rest % 60)
if hours < 10:
hours = "0" + str(hours)
if minutes < 10:
... | lucienimmink/scanner.py | scanner/_utils.py | Python | mit | 1,322 | 0 |
# Copyright 2013 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 telemetry import benchmark
from telemetry.page import page
from telemetry.page import page_test
from telemetry.story import story_set as story_set_module... | Chilledheart/chromium | content/test/gpu/gpu_tests/webgl_robustness.py | Python | bsd-3-clause | 2,628 | 0.003044 |
########################################################################
"""Generic and custom log message infrastructure"""
########################################################################
"""\
log - simple logging module
This is so much simpler than Python's stock 'logging' module and thus
much less error... | ndim/weight-calendar-grid | weight_cal_grid/log.py | Python | mit | 5,614 | 0.004453 |
# appnexus cryptography edited google pep8 smarkets
import ast
# This comment should not prevent the I201 below, it is not a newline.
import X # I201
import flake8_import_order # I201
| public/flake8-import-order | tests/test_cases/missing_newline.py | Python | lgpl-3.0 | 184 | 0.01087 |
from level import FakeChunk
import logging
from materials import pocketMaterials
from mclevelbase import ChunkNotPresent, notclosing
from nbt import TAG_List
from numpy import array, fromstring, zeros
import os
import struct
# values are usually little-endian, unlike Minecraft PC
logger = logging.getLogger(__name__)
... | Khroki/MCEdit-Unified | pymclevel/pocket.py | Python | isc | 15,372 | 0.001821 |
# peppy Copyright (c) 2006-2010 Rob McMullen
# Licenced under the GPLv2; see http://peppy.flipturn.org for more info
"""Plotting minor modes for HSI major mode
"""
import os, struct, mmap
from cStringIO import StringIO
import wx
from peppy.actions.minibuffer import *
from peppy.actions import *
from peppy.minor imp... | robmcmullen/peppy | peppy/hsi/plotters.py | Python | gpl-2.0 | 9,351 | 0.008662 |
from boto.connection import AWSAuthConnection
import os
class ESConnection(AWSAuthConnection):
def __init__(self, region, **kwargs):
super(ESConnection, self).__init__(**kwargs)
self._set_auth_region_name(region)
self._set_auth_service_name("es")
def _required_auth_capability(self):
return ['hmac-v4']
if ... | histograph/aws | staging/scripts/register_staging.py | Python | mit | 947 | 0.026399 |
# Time: O(n)
# Space: O(1)
# Given an array of integers with possible duplicates,
# randomly output the index of a given target number.
# You can assume that the given target number must exist in the array.
#
# Note:
# The array size can be very large.
# Solution that uses too much extra space will not pass the judge... | jaredkoontz/leetcode | Python/random-pick-index.py | Python | mit | 1,340 | 0.001493 |
"""The test for the bayesian sensor platform."""
import json
from os import path
from homeassistant import config as hass_config
from homeassistant.components.bayesian import DOMAIN, binary_sensor as bayesian
from homeassistant.components.homeassistant import (
DOMAIN as HA_DOMAIN,
SERVICE_UPDATE_ENTITY,
)
fro... | tboyce021/home-assistant | tests/components/bayesian/test_binary_sensor.py | Python | apache-2.0 | 24,735 | 0.000323 |
# -*- coding: utf-8 -*-
from datetime import datetime
import simplejson as json
from bson import ObjectId
from bson.dbref import DBRef
from cerberus import SchemaError
from unittest import TestCase
from eve.io.mongo import Validator, Mongo, MongoJSONEncoder
from eve.io.mongo.parser import parse, ParseError
from eve.t... | bcrochet/eve | eve/tests/io/mongo.py | Python | bsd-3-clause | 14,202 | 0 |
#!/usr/bin/env python3
from pathlib import Path
import rdflib
from pyontutils.core import makeGraph
from pyontutils.utils import relative_path
from pyontutils.namespaces import makePrefixes, TEMP
from pyontutils.namespaces import rdf, rdfs, owl
from neurondm import *
from neurondm.lang import *
from neurondm.core impor... | tgbugs/pyontutils | neurondm/neurondm/models/phenotype_direct.py | Python | mit | 4,341 | 0.008754 |
from benchmarker.kernels.helpers_torch import Regression
from torch_geometric.nn import DimeNet
def get_kernel(params):
# TODO: make these parameters
net = DimeNet(
hidden_channels=params["problem"]["hidden_channels"],
out_channels=1,
num_blocks=6,
num_bilinear=8,
num_s... | undertherain/benchmarker | benchmarker/kernels/dimenet/pytorch.py | Python | mpl-2.0 | 528 | 0 |
import scipy as sp
from mycwt import cwt
pi = sp.pi
mu = [100.0, 500.0, 900.0]
sigma = [5.0, 10.0, 20.0]
a = [3.0, 1.0, 0.5]
t = sp.arange(0, 1000)*1.0
x = sp.zeros(t.shape)
for i in range(0, len(mu)):
x += 1/sp.sqrt(2*pi)/sigma[i]*sp.exp(-0.5*((t-mu[i])/sigma[i])**2)
smax = 128
wname = 'bior2.6'
scales = sp.aran... | bearicc/python-wavelet-transform | cwt_demo.py | Python | agpl-3.0 | 380 | 0 |
# django-openid-auth - OpenID integration for django.contrib.auth
#
# Copyright (C) 2007 Simon Willison
# Copyright (C) 2008-2010 Canonical Ltd.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions o... | nekohayo/snowy | lib/django_openid_auth/models.py | Python | agpl-3.0 | 2,355 | 0.000425 |
# general
import time
# peachbox imports
from peachbox.task import Task
from peachbox.connector import sink, source
from peachbox.pipeline import Chain, Validator
# tutorial
from pipelines.importer import UserReviewEdge, ProductReviewEdge, ReviewProperties
import model.master
class ImportMovieReviews(ScheduledTask):
... | PeachstoneIO/peachbox | tutorials/tutorial_movie_reviews/tasks/importer.py | Python | apache-2.0 | 1,848 | 0.010823 |
"""
Generate a toy dataset for the matrix factorisation case, and store it.
We use dimensions 100 by 50 for the dataset, and 10 latent factors.
As the prior for U and V we take value 1 for all entries (so exp 1).
As a result, each value in R has a value of around 20, and a variance of 100-120.
For contrast, the San... | ThomasBrouwer/BNMTF | data_toy/bnmf/generate_bnmf.py | Python | apache-2.0 | 3,430 | 0.032362 |
import sys
import time
import numpy as np
from sparkle.QtWrapper.QtGui import QApplication
from sparkle.gui.plotting.protocoldisplay import ProtocolDisplay
from test.sample import samplewav
PAUSE = 0
class TestProtocolDisplay():
def setUp(self):
self.t = np.arange(200)
def data_func(self, f):... | portfors-lab/sparkle | test/tests/gui/plotting/test_protocol_display.py | Python | gpl-3.0 | 3,063 | 0.001306 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-21 07:28
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
depe... | Ninad998/FinalYearProject | django_app/migrations/0001_initial.py | Python | mit | 1,051 | 0.003806 |
__all__ = ('db', 'format', 'query', 'sync') | Timdawson264/acd_cli | acdcli/cache/__init__.py | Python | gpl-2.0 | 43 | 0.023256 |
#!/usr/bin/env python
import argparse
import ConfigParser
import os.path
import digitaloceanmanager
import getpass
from passlib.hash import sha512_crypt
token = None
user = None
passwd = None
ssh_port = None
if __name__ == "__main__":
config = ConfigParser.RawConfigParser()
if (os.path.isfile('doma.cfg')):
... | Elhodred/python-digitaloceanmanager | doma.py | Python | lgpl-3.0 | 4,258 | 0.005402 |
import numpy as np
import pandas as pd
import pytest
from .const import RANDOM_SEED, TARGET_COL
N_CATEGORY = 50
N_OBS = 10000
N_CAT_FEATURE = 10
N_NUM_FEATURE = 5
@pytest.fixture(scope="module")
def generate_data():
generated = False
def _generate_data():
if not generated:
assert N_C... | jeongyoonlee/Kaggler | tests/conftest.py | Python | mit | 1,121 | 0.000892 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# filename: tops_sql.py
# Copyright 2008-2010 Stefano Costa <steko@iosa.it>
#
# This file is part of Total Open Station.
#
# Total Open Station is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by ... | BackupTheBerlios/tops | totalopenstation/output/tops_sql.py | Python | gpl-3.0 | 2,442 | 0.00041 |
#!/usr/bin/python
from btc.main import *
#from btc.pyspecials import *
# get wordlists
def open_wordlist(wordlist):
try:
if wordlist in ('Electrum1', 'electrum1', 'electrum'):
from btc._electrum1wordlist import ELECTRUM1_WORDLIST
assert len(ELECTRUM1_WORDLIST) == 1626
r... | wizardofozzie/simpybtc | btc/mnemonic.py | Python | mit | 7,793 | 0.011549 |
# -*- coding: utf-8 -*-
# Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
# This library 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 Fo... | savoirfairelinux/num2words | tests/test_ko.py | Python | lgpl-2.1 | 4,547 | 0 |
from django.conf.urls.defaults import *
from django.utils.translation import ugettext as _
urlpatterns = patterns('qqq.collections.views',
(r'^%s/$' % _('collections'), 'collections'),
(r'^%s/(\d+)/$' % _('collection'), 'saved_collection'),
(r'^%s/(\d+)/([^/]+)/$' % _('collection'), 'saved_collection'),
(r'^%s... | rtts/qqq | qqq/collections/urls.py | Python | gpl-3.0 | 730 | 0.005479 |
class EventHook(object):
"""
Basic "event system" from:
http://www.voidspace.org.uk/python/weblog/arch_d7_2007_02_03.shtml#e616
"""
def __init__(self):
self.__handlers = []
def __iadd__(self, handler):
self.__handlers.append(handler)
return self
def __is... | fugwenna/bunkbot | src/core/event_hook.py | Python | mit | 537 | 0.001862 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | nburn42/tensorflow | tensorflow/contrib/boosted_trees/examples/boston.py | Python | apache-2.0 | 6,159 | 0.006495 |
# coding=utf-8
# Author: Dustyn Gibson <miigotu@gmail.com>
#
# URL: https://sick-rage.github.io
#
# This file is part of SickRage.
#
# SickRage 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 ... | Arcanemagus/SickRage | sickbeard/providers/speedcd.py | Python | gpl-3.0 | 7,229 | 0.003182 |
# Natural Language Toolkit: Sourced Strings
#
# Copyright (C) 2001-2009 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
X{Sourced strings} are strings that are annotated with information
about the location in a document where they wer... | tadgh/ArgoRevisit | third_party/nltk/sourcedstring.py | Python | apache-2.0 | 54,572 | 0.00317 |
"""Gradient descent
"""
import numpy as np
from frankenstein.tools.perf_utils import TIMER
from pyscf.lib import logger
""" Helper functions
"""
def get_gHp_fd(get_grad, p, order=1, eps=1.E-4):
""" Compute gradient-Hessian product using finite difference
Inps:
get_grad (callable):
gra... | hongzhouye/frankenstein | sgscf/sgopt.py | Python | bsd-3-clause | 6,925 | 0.002455 |
from crispy_forms.helper import FormHelper
from crispy_forms.layout import *
from crispy_forms.bootstrap import *
from crispy_forms.layout import Layout, Submit, Reset, Div
from django import forms
from django.contrib.auth.forms import UserCreationForm
from workflow.models import TolaUser
from django.contrib.auth.model... | mercycorps/TolaActivity | tola/forms.py | Python | apache-2.0 | 3,887 | 0.004116 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Tests for `astropy.vo.validator.validate`.
.. note::
This test will fail if external URL query status
changes. This is beyond the control of AstroPy.
When this happens, rerun or update the test.
"""
from __future__ import absolute_import,... | joergdietrich/astropy | astropy/vo/validator/tests/test_validate.py | Python | bsd-3-clause | 3,067 | 0.000652 |
#***************************************************************************
#* *
#* Copyright (c) 2012 Sebastian Hoogen <github@sebastianhoogen.de> *
#* *
#* This pr... | yantrabuddhi/FreeCAD | src/Mod/OpenSCAD/OpenSCADUtils.py | Python | lgpl-2.1 | 24,151 | 0.02385 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2011 Cubic ERP - Teradata SAC. (http://cubicerp.com).
#
# WARNING: This program as such is intended to be used by professional
# programmers who take t... | kailIII/emaresa | trunk.pe.bk/l10n_pe_vat/__init__.py | Python | agpl-3.0 | 1,401 | 0 |
"""private_base will be populated from puppet and placed in this directory"""
import logging
import os
import dj_database_url
from lib.settings_base import (
CACHE_PREFIX, ES_INDEXES, KNOWN_PROXIES, LOGGING, CSP_SCRIPT_SRC,
CSP_FRAME_SRC)
from .. import splitstrip
import private_base as private
ENGAGE_ROBO... | Joergen/olympia | sites/identitystage/settings_base.py | Python | bsd-3-clause | 5,553 | 0.00036 |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from django.apps import AppConfig
class KolibriContentConfig(AppConfig):
name = 'kolibri.core.content'
label = 'content'
verbose_name = 'Kolibri Content'
def ready(self):
from... | DXCanas/kolibri | kolibri/core/content/apps.py | Python | mit | 410 | 0 |
from twisted.spread import pb
class QuoteReader(pb.Root):
def __init__(self, quoter):
self.quoter = quoter
def remote_nextQuote(self):
return self.quoter.getQuote()
| mzdaniel/oh-mainline | vendor/packages/twisted/doc/core/howto/listings/TwistedQuotes/pbquote.py | Python | agpl-3.0 | 193 | 0.010363 |
# -*- coding: utf-8 -*-
# Copyright 2014 Diamond Light Source 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 ap... | FedeMPouzols/Savu | doc/source/files_and_images/example_test.py | Python | gpl-3.0 | 1,241 | 0 |
from django.db import models
class Profissao(models.Model):
nome = models.CharField(max_length=128)
class Partido(models.Model):
nome = models.CharField(max_length=128)
sigla = models.CharField(max_length=32)
class Deputado(models.Model):
DEPUTADO_SEXO_CHOICES = (
('m', 'Masculino'),
... | ops-org/sistema-ops-backend | parlamentar/models.py | Python | gpl-3.0 | 772 | 0.001295 |
#! /usr/bin/env python
# this script does not perform full installation,
# it is meant for use from Makefile
import sys, os.path, re
from distutils.core import setup
from distutils.extension import Extension
# check if configure has run
if not os.path.isfile('config.mak'):
print "please run ./configure && make f... | mpihlak/skytools-dev | setup_skytools.py | Python | isc | 1,526 | 0.017038 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from abc i... | dturner-tw/pants | src/python/pants/fs/archive.py | Python | apache-2.0 | 5,886 | 0.009004 |
from django.core import management
from ._utils import AstaporCommand
class Command(AstaporCommand):
help = 'Call other commands in sequence to perform the full data import and initial processing.'
def add_arguments(self, parser):
parser.add_argument('specimen_csv_file')
parser.add_argument(... | BelgianBiodiversityPlatform/Astapor | website/specimens/management/commands/full_import.py | Python | bsd-2-clause | 792 | 0.005051 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def configure_root_page(apps, schema_editor):
# Get models
ContentType = apps.get_model('contenttypes.ContentType')
Site = apps.get_model('wagtailcore.Site')
Main = apps.get_model('core.Main')
HomePag... | praekelt/molo | molo/core/migrations/0004_configure_root_page.py | Python | bsd-2-clause | 1,214 | 0 |
##########################################################################
# Author: Jane Curry, jane.curry@skills-1st.co.uk
# Date: April 19th, 2011
# Revised:
#
# interfaces.py for Predictive Threshold ZenPack
#
# This program can be used under the GNU General Public License version 2
#... | jcurry/ZenPacks.community.PredictiveThreshold | ZenPacks/community/PredictiveThreshold/interfaces.py | Python | gpl-2.0 | 2,440 | 0.004098 |
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "... | jai1/pulsar | pulsar-functions/instance/src/main/python/util.py | Python | apache-2.0 | 2,346 | 0.008951 |
from __future__ import print_function, absolute_import
import inspect
from path import path
import imp
import sys
import re
bad_chars = re.compile(u'\W')
python_version = sys.version_info
if python_version.major == 2 and python_version.minor == 7:
if sys.platform == 'win32' or sys.platform == 'cygwin':
... | sergeyfarin/pyqt-fit | pyqt_fit/loader.py | Python | gpl-3.0 | 3,942 | 0.001776 |
import os
import subprocess
locales = os.listdir('locale')
def call_command(command):
print command
subprocess.call(command.split())
for locale in locales:
call_command(
'python ../manage.py jinja2_makemessages -l %s -e html,py,txt' % locale
)
call_command(
'python ../manage.py ma... | PearsonIOKI/compose-forum | askbot/bin/rebuildlocales.py | Python | gpl-3.0 | 365 | 0.005479 |
import argparse
import importlib
import inspect
import os
import sys
import traceback
from bokeh.plotting import output_file, show
from fabulous.color import bold, red
from app import create_app
def error(msg, stacktrace=None):
"""Print an error message and exit.
Params:
-------
msg: str
Er... | saltastro/salt-data-quality-site | test_bokeh_model.py | Python | mit | 2,995 | 0.004341 |
from ee.utils import test
from ee.cli.main import get_test_app
class CliTestCaseSite(test.EETestCase):
def test_ee_cli(self):
self.app.setup()
self.app.run()
self.app.close()
def test_ee_cli_site_disable(self):
self.app = get_test_app(argv=['site', 'disable', 'example2.com'])... | harshadyeola/easyengine | tests/cli/a_test_site_disable.py | Python | mit | 394 | 0 |
"""Use Mayapy for testing
Usage:
$ mayapy run_maya_tests.py
"""
import sys
import nose
import warnings
from nose_exclude import NoseExclude
warnings.filterwarnings("ignore", category=DeprecationWarning)
if __name__ == "__main__":
from maya import standalone
standalone.initialize()
argv = sys.argv... | pyblish/pyblish-mindbender | run_maya_tests.py | Python | mit | 1,052 | 0 |
#!/usr/bin/env python
# Reports a summary of Kraken's results
# and optionally creates a newick Tree
# Copyright (c) 2016 Daniel Blankenberg
# Licensed under the Academic Free License version 3.0
# https://github.com/blankenberg/Kraken-Taxonomy-Report
from __future__ import print_function
import optparse
import os
i... | SANBI-SA/tools-iuc | tools/kraken_taxonomy_report/kraken_taxonomy_report.py | Python | mit | 12,936 | 0.022727 |
# Based on https://github.com/probml/pmtk3/blob/master/demos/bayesChangeOfVar.m
# MC on change of variables and empirical distribution, highlighting that
# modes are not, in general, preserved.
import superimport
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
import os
from pyprobml_u... | probml/pyprobml | scripts/bayes_change_of_var.py | Python | mit | 1,657 | 0.006035 |
from datapackage_pipelines.wrapper import ingest, spew
# this members have a problem with their names
# we can match them directly
KMMBR_IDS_DIRECT_MATCH_TO_PERSON_ID = {'000000431': 431}
def get_mk_individuals(resource, data):
data['mks'] = []
for mk in resource:
yield mk
knesset_nums = set... | hasadna/knesset-data-pipelines | votes/join_kmmbr_mk_individuals.py | Python | mit | 4,076 | 0.002699 |
# disable missing docstring
# pylint: disable=missing-docstring
from collections import OrderedDict
from lettuce import step, world
from nose.tools import assert_equal, assert_false, assert_in, assert_true
from common import get_codemirror_value, type_in_codemirror
CODEMIRROR_SELECTOR_PREFIX = "$('iframe').contents... | kmoocdev2/edx-platform | cms/djangoapps/contentstore/features/html-editor.py | Python | agpl-3.0 | 9,937 | 0.001409 |
import codecs
from setuptools import setup, find_packages
import os
import re
import sys
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
def initialize_options(self):
TestCommand.initialize_opti... | athoune/aiohttp_security | setup.py | Python | apache-2.0 | 2,105 | 0.00095 |
# Copyright (C) 2003-2005 Peter J. Verveer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following d... | alephu5/Soundbyte | environment/lib/python3.3/site-packages/scipy/ndimage/measurements.py | Python | gpl-3.0 | 47,436 | 0.000358 |
# -*- coding: utf-8 -*-
import random
import textwrap
def print_bold(msg):
#Funcion para mostrar por pantalla un string en negrita
print("\033[1m"+msg+"\033[0m")
def print_linea_punteada(width=72):
print('-'*width)
def ocupar_chozas():
ocupantes = ['enemigo','amigo','no ocupada']
chozas = []
... | tidus747/Tutoriales_juegos_Python | Ataca a los orcos V0.0.5/Ataca_a_los_orcos_V0.0.5.py | Python | gpl-3.0 | 4,736 | 0.011467 |
"""Script to get, put and delete secrets stored in credstash."""
import argparse
import getpass
from homeassistant.util.yaml import _SECRET_NAMESPACE
# mypy: allow-untyped-defs
REQUIREMENTS = ["credstash==1.15.0"]
def run(args):
"""Handle credstash script."""
parser = argparse.ArgumentParser(
desc... | joopert/home-assistant | homeassistant/scripts/credstash.py | Python | apache-2.0 | 2,373 | 0.001686 |
from __future__ import division
import math
import numpy as np
from time import time
import sympy as sp
import mpmath as mp
from mpmath.ctx_mp_python import mpf
from scipy.misc import factorial
from scipy.special import gamma
precision = 53
mp.prec = precision
mp.pretty = True
def calculate_factorial_ratio(n,... | tripatheea/Riemann-Zeta | python/dirichlet.py | Python | mit | 1,897 | 0.038482 |
#! /usr/bin/python
# Script for increasing versions numbers across the code
import sys
import glob
import re
import argparse
def check_version_format(version):
"""Check format of version number"""
pattern = '^[0-9]+[\.][0-9]+[\.][0-9]+(\-.+)*$'
return re.match(pattern, version) is not None
BIO_FORMATS_... | stelfrich/bioformats | tools/bump_maven_version.py | Python | gpl-2.0 | 3,006 | 0.001331 |
# -*- coding: utf-8 -*-
"""Status effect data."""
from components.status_effect import StatusEffect
from status_effect_functions import damage_of_time
# todo: generate new object not copy
STATUS_EFFECT_CATALOG = {
'POISONED':
{
'name': 'poisoned',
'tile_path': 'status_effect/poisoned.png',
... | kuraha4/roguelike-tutorial-python | src/data/status_effect.py | Python | mit | 1,577 | 0.000634 |
from diff_match_patch import diff_match_patch
from django import template
register = template.Library()
@register.simple_tag
def compare_values(value1, value2):
dmp = diff_match_patch()
diff = dmp.diff_main(value1, value2)
dmp.diff_cleanupSemantic(diff)
html = dmp.diff_prettyHtml(diff)
return ht... | bmihelac/django-import-export | import_export/templatetags/import_export_tags.py | Python | bsd-2-clause | 323 | 0 |
#!/usr/bin/python
# 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.
"""Gets information about one commit from gitiles.
Example usage:
./fetch_revision_info.py 343b531d31 chromium
./fetch_revision_info.p... | eunchong/build | scripts/slave/recipe_modules/auto_bisect/resources/fetch_revision_info.py | Python | bsd-3-clause | 1,529 | 0.011772 |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import unicode_literals
from __... | mozilla/ChangeDetector | pyLibrary/queries/containers/__init__.py | Python | mpl-2.0 | 4,498 | 0.001556 |
# GromacsWrapper: formats.py
# Copyright (c) 2009-2011 Oliver Beckstein <orbeckst@gmail.com>
# Released under the GNU Public License 3 (or higher, your choice)
# See the file COPYING for details.
"""
Gromacs NDX index file format
=============================
The `.ndx file`_ contains lists of atom indices that are g... | PicoCentauri/GromacsWrapper | gromacs/fileformats/ndx.py | Python | gpl-3.0 | 7,868 | 0.003177 |
# noinspection PyProtectedMember,PyUnresolvedReferences
class CompoundMutableDict(dict):
"""
Resource used for mutable compound dictionaries.
"""
# noinspection PyMissingConstructor
def __init__(self, **kwargs):
self._parent = kwargs.pop('_parent')
self._api = kwargs.pop('api')
... | sbg/sevenbridges-python | sevenbridges/meta/comp_mutable_dict.py | Python | apache-2.0 | 1,715 | 0 |
# Copyright (c) 2010 OpenStack Foundation
#
# 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 ... | hurricanerix/swift | test/unit/common/middleware/test_staticweb.py | Python | apache-2.0 | 41,893 | 0 |
#Olivia Millard - Homework 3
#This program will generate a Sierpinski Triangle.
import pygame, random, math
## PRE- user-inputted width/height to generate the size of the image
## POST- Creates a list with (len(length[0])); each list item is a list with (len(size[1]))
## Points = ima... | oliviamillard/CS141 | ChaosSierpinskiTriangle.py | Python | mit | 2,806 | 0.015324 |
"""
The basic module about log readers
"""
import os
import re
from ..utils.gzip2 import GzipFile
__author__ = 'chenxm'
__all__ = ["FileReader"]
class FileReader(object):
@staticmethod
def open_file(filename, mode='rb'):
""" open plain or compressed file
@return file handler
"""
parts = os.path.basename(f... | pombreda/omnipy | omnipy/reader/_reader.py | Python | gpl-3.0 | 1,755 | 0.034758 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
"""Support for Python.
See https://www.pantsbuild.org/docs/python-backend.
"""
from pants.backend.python import target_types_rules
from pants.backend.python.dependency_inference import r... | patricklaw/pants | src/python/pants/backend/python/register.py | Python | apache-2.0 | 2,773 | 0.001082 |
from pathlib import Path
from typing import List
from nassl._nassl import X509, X509_STORE_CTX
class CertificateChainVerificationFailed(Exception):
def __init__(self, openssl_error_code: int) -> None:
self.openssl_error_code = openssl_error_code
self.openssl_error_string = X509.verify_cert_error_s... | nabla-c0d3/nassl | nassl/cert_chain_verifier.py | Python | agpl-3.0 | 3,020 | 0.00298 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Prokka(Package):
"""Prokka is a software tool to annotate bacterial, archaeal and viral
... | iulian787/spack | var/spack/repos/builtin/packages/prokka/package.py | Python | lgpl-2.1 | 1,155 | 0.001732 |
import unittest
from ISSA.MemberMailer.Objects.database import Database
class TestDelete(unittest.TestCase):
def test_delete_mem(self):
test_member = Database()
test = test_member.delete(8)
self.assertEqual(test, "Success!")
if __name__ == '__main__':
unittest.main()
| BLuu13/ISSAMemberManager | tests/test_delete.py | Python | mpl-2.0 | 278 | 0.02518 |
from Sire.Base import *
from Sire.IO import *
from Sire.Mol import *
from glob import glob
from nose.tools import assert_equal, assert_almost_equal
# Check that we have Mol2 support in this version of Sire.
has_mol2 = True
try:
p = Mol2()
except:
# No Mol2 support.
has_mol2 = False
# General test of abi... | michellab/SireUnitTests | unittests/SireIO/test_mol2.py | Python | gpl-3.0 | 5,051 | 0.008513 |
# 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-batch/azure/batch/models/job_get_all_lifetime_statistics_options.py | Python | mit | 1,726 | 0.000579 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_corvette_rebel_crowley.iff"
result.attribute_template_... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_dressed_corvette_rebel_crowley.py | Python | mit | 458 | 0.045852 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.