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 |
|---|---|---|---|---|---|
# rsync-system-backup: Linux system backups powered by rsync.
#
# Author: Peter Odding <peter@peterodding.com>
# Last Change: August 2, 2019
# URL: https://github.com/xolox/python-rsync-system-backup
"""
Simple to use Python API for Linux system backups powered by rsync.
The :mod:`rsync_system_backup` module contains... | xolox/python-rsync-system-backup | rsync_system_backup/__init__.py | Python | mit | 27,923 |
#
# Copyright 2017 Google 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 law or... | google/ion | ion/dev/replace_strings.py | Python | apache-2.0 | 3,728 |
# -*- coding: utf-8 -*-
#
# django-newsletter documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 13 13:53:07 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fil... | ctxis/django-newsletter | docs/conf.py | Python | agpl-3.0 | 9,203 |
# -*- coding: utf-8 -*-
#
# This file is part of the VecNet Zika modeling interface.
# For copyright and licensing information about this package, see the
# NOTICE.txt and LICENSE.txt files in its top-level directory; they are
# available at https://github.com/vecnet/zika
#
# This Source Code Form is subject to the ter... | vecnet/zika | website/apps/home/tests/test_views.py | Python | mpl-2.0 | 9,522 |
import mpl_toolkits.axes_grid
import mpl_toolkits.axes_grid.axes_size as Size
from mpl_toolkits.axes_grid.axes_divider import Divider, SubplotDivider, \
LocatableAxes, make_axes_locatable
from mpl_toolkits.axes_grid.axes_grid import Grid, ImageGrid, AxesGrid
__path__ = mpl_toolkits.axes_grid.__path__
| leejjoon/pywcsgrid2 | axes_grid/__init__.py | Python | mit | 309 |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
# The classical programming example in Python::
print "Hello world."
| tkarna/cofs | pylit/doc/tutorial/hello_with_header.py | Python | mit | 122 |
def test_comparison_result__zero_for_false_and_one_for_true(shell):
shell.src('test.c', r"""
#include <stdio.h>
int main() {
printf("3 > 2 => %d", 3 > 2);
printf("2 > 3 => %d", 2 > 3);
}
""")
shell.run('make test')
r = shell.run('./test')
assert r.out == '3 > 2 => 1' \... | imsardine/learning | c/tests/test_datatype_bool.py | Python | mit | 2,802 |
# Copyright 2012-2014 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 writin... | antonnik/code-classifier | naive_bayes/resources/python/test_client.py | Python | apache-2.0 | 4,683 |
# UnitySupport.py
#
# Copyright (c) 2011 Canonical
#
# Author: Michael Vogt <mvo@ubuntu.com>
# Bilal Akhtar <bilalakhtar@ubuntu.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software F... | Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/pyshared/UpdateManager/UnitySupport.py | Python | gpl-3.0 | 4,058 |
# -*- coding: utf-8 -*-
# Copyright(C) 2016 François Revol
#
# This file is part of a weboob module.
#
# This weboob module 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 ... | vicnet/weboob | modules/linuxjobs/browser.py | Python | lgpl-3.0 | 1,527 |
# 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.
# libcloud.org licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not... | alex/libcloud | libcloud/providers.py | Python | apache-2.0 | 2,109 |
from __future__ import print_function
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
class Kanal7(Plugin):
url_re = re.compile(r"https?://(?:www.)?kanal7.com/canli-izle")
iframe_re = re.c... | ethanhlc/streamlink | src/streamlink/plugins/kanal7.py | Python | bsd-2-clause | 1,209 |
import subprocess
def call_command_from_client(shell_args, env=None):
print "Running command: {}".format(' '.join(shell_args))
try:
subprocess.call(shell_args, env=env)
except KeyboardInterrupt:
print "KeyboardInterrupt; terminating"
| gamechanger/dusty | dusty/commands/client.py | Python | mit | 263 |
"""Tests for multiple correspondence analysis. The example comes from
https://www.utdallas.edu/~herve/Abdi-MCA2007-pretty.pdf
"""
import unittest
import pandas as pd
import prince
class TestMCA(unittest.TestCase):
def setUp(self):
self.X = pd.DataFrame(
data=[
[0, 'C', 1, 0,... | MaxHalford/Prince | tests/test_mca.py | Python | mit | 1,515 |
# Copyright 2010-2011 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... | klmitch/glance | glance/common/client.py | Python | apache-2.0 | 23,213 |
# -*- coding: utf-8 -*-
__author__ = 'chinfeng'
from gumpy.deco import *
import logging
logger = logging.getLogger(__name__)
import tornado.web
import tornado.wsgi
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write('demo web bundle using tornado')
@service
@provide('wsgi.applicati... | chinfeng/gumpy | plugins/torn_demo/__init__.py | Python | lgpl-3.0 | 568 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2008—2009 Andy Mikhailenko
#
# This file is part of django-autoslug.
#
# django-autoslug is free software under terms of the GNU Lesser
# General Public License version 3 (LGPLv3) as published by the Free
# Software Foundation. See the file README for copying conditions.
#... | jhjguxin/blogserver | lib/python2.7/site-packages/autoslug/__init__.py | Python | mit | 390 |
from pandac.PandaModules import *
from otp.level.BasicEntities import DistributedNodePathEntity
from direct.directnotify import DirectNotifyGlobal
from toontown.coghq import MoleHill
from toontown.coghq import MoleFieldBase
from direct.distributed.ClockDelta import globalClockDelta
from toontown.toonbase import Toontow... | Spiderlover/Toontown | toontown/coghq/DistributedMoleField.py | Python | mit | 19,000 |
# 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... | e-bug/distributed-tensorflow-benchmarks | google-benchmarks/tf_cnn_benchmarks/cnn_util.py | Python | gpl-3.0 | 977 |
""" Put in integration/
because it requires psutil to function properly
"""
# stdlib
import contextlib
import os
# 3p
from mock import patch, MagicMock
import psutil
# project
from tests.checks.common import AgentCheckTest
# cross-platform switches
_PSUTIL_IO_COUNTERS = True
try:
p = psutil.Process(os.getpid()... | indeedops/dd-agent | tests/checks/integration/test_process.py | Python | bsd-3-clause | 17,252 |
# -*- coding: utf-8 -*-
'''
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
#
# This file was generated and any changes will be overwritten.
'''
from ..request_base import RequestBase
from ..model.item import Ite... | OneDrive/onedrive-sdk-python | src/python2/request/item_request.py | Python | mit | 3,549 |
import pytest
import requests
import mock
import string
import random
import re
import time
from credentials import *
from printnodeapi.gateway import Gateway
from printnodeapi.model import Computer, Printer, PrintJob, State, Account
from printnodeapi.auth import Auth
API_ADDRESS = API_ADDRESS
API_KEY = API_KEY
ENTR... | PrintNode/PrintNode-Python | tests/fixtures.py | Python | mit | 1,091 |
"""
The transformer module is for performing cartographic transformations.
"""
__all__ = [
"transform",
"itransform",
"Transformer",
"TransformerGroup",
"AreaOfInterest",
]
import warnings
from array import array
from itertools import chain, islice
from pathlib import Path
from typing import Any, I... | ocefpaf/pyproj | pyproj/transformer.py | Python | isc | 33,316 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# tweetokenize: Regular expression based tokenizer for Twitter
# Copyright: (c) 2013, Jared Suttles. All rights reserved.
# License: BSD, see LICENSE for details.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"""
Tokenization and pre-pro... | jaredks/tweetokenize | tweetokenize/__init__.py | Python | bsd-3-clause | 1,103 |
# coding: utf-8
from __future__ import unicode_literals
import base64
import json
import re
import itertools
from .common import InfoExtractor
from ..compat import (
compat_HTTPError,
compat_str,
compat_urlparse,
)
from ..utils import (
determine_ext,
ExtractorError,
js_to_json,
InAdvancePagedList,
int_or_non... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/vimeo.py | Python | gpl-3.0 | 39,641 |
# Copyright 2021 ForgeFlow (http://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class AccountExceptionConfirm(models.TransientModel):
_name = "account.exception.confirm"
_description = "Account exception wizard"
_inherit = ["exce... | OCA/account-invoicing | account_move_exception/wizard/account_exception_confirm.py | Python | agpl-3.0 | 724 |
# 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.
import unittest
import webapp2
import webtest
from dashboard import shrink_timestamp_revisions
from dashboard import testing_common
from dashboard import u... | modulexcite/catapult | dashboard/dashboard/shrink_timestamp_revisions_test.py | Python | bsd-3-clause | 3,922 |
#!/usr/bin/env python
import os.path
from distutils import log
from distutils.dep_util import newer
def main():
scriptdir = os.path.dirname(os.path.abspath(__file__))
topdir = os.path.abspath(os.path.join(scriptdir, ".."))
pyfile = os.path.join(topdir, "picard", "resources.py")
qrcfile = os.path.join(... | kepstin/picard | resources/compile.py | Python | gpl-2.0 | 563 |
from django.db import models
from django.contrib.auth.models import User
class API(models.Model):
"""
Represents an API for a process
"""
"""
Fields
"""
name = models.CharField(max_length=200)
require_token = models.BooleanField(default=False)
"""
Methods
"""
d... | TwistedHardware/roshanRush | api/models.py | Python | gpl-2.0 | 2,240 |
# coding=utf-8
# UrbanFootprint v1.5
# Copyright (C) 2017 Calthorpe Analytics
#
# This file is part of UrbanFootprint version 1.5
#
# UrbanFootprint is distributed under the terms of the GNU General
# Public License version 3, as published by the Free Software Foundation. This
# code is distributed WITHOUT ANY WARRANT... | CalthorpeAnalytics/urbanfootprint | footprint/main/models/presentation/style_attribute.py | Python | gpl-3.0 | 3,695 |
""" This aids with address validation by means of using REGEX
"""
import re
def validate_address(address):
"""
:param address:
:return: dictionary containing components of the address
that is with the keys: street_address, city, state, and zip
"""
regex = r'^([\d]+[\s[a-zA-Z/.\u00C0-\u... | dfehrenbach/Swen343_Human_Resources | hr/helpers/regex_helper.py | Python | mit | 1,258 |
# -*- coding: utf-8 -*-
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "Licens... | elastic/elasticsearch-py | test_elasticsearch/test_async/test_transport.py | Python | apache-2.0 | 26,032 |
from . import track
from . import webserver
from . import tracksocketserver
from . import globalconfig
| ollien/playserver | playserver/__init__.py | Python | mit | 103 |
import common
from autotest_lib.client.common_lib import global_config
CONFIG_SECTION = 'SCHEDULER'
class SchedulerConfig(object):
"""
Contains configuration that can be changed during scheduler execution.
"""
FIELDS = {'max_processes_per_drone': 'max_processes_per_drone',
'max_processes... | clebergnu/autotest | scheduler/scheduler_config.py | Python | gpl-2.0 | 1,337 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2015 Glencoe Software, Inc. All Rights Reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
# This program is free software you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
... | knabar/openmicroscopy | components/tools/OmeroPy/test/integration/test_delete.py | Python | gpl-2.0 | 26,125 |
"""Spectral Embedding"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Wei LI <kuantkid@gmail.com>
# License: BSD 3 clause
import warnings
import numpy as np
from scipy import sparse
from scipy.linalg import eigh
from scipy.sparse.linalg import eigsh
from scipy.sparse.csgraph import connected_c... | chrsrds/scikit-learn | sklearn/manifold/spectral_embedding_.py | Python | bsd-3-clause | 22,229 |
"""The tests for the Group components."""
# pylint: disable=protected-access
import asyncio
from collections import OrderedDict
import unittest
from unittest.mock import patch
from homeassistant.setup import setup_component, async_setup_component
from homeassistant.const import (
STATE_ON, STATE_OFF, STATE_HOME, S... | HydrelioxGitHub/home-assistant | tests/components/group/test_init.py | Python | apache-2.0 | 20,507 |
import csv
from ..parser import Parser
__author__ = 'James DeVincentis <james.d@hexhost.net>'
class Csv(Parser):
def __init__(self, **kwargs):
self.csv = csv.reader(self.file)
def parsefile(self, filehandle, max_objects=1000):
"""Parse file provided by `filehandle`. Return `max_objects` at ... | jmdevince/cifpy3 | lib/cif/feeder/parsers/csv.py | Python | gpl-3.0 | 2,069 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
# Description: an implementation of a deep learning recommendation model (DLRM)
# The model input consists of dense and sparse features. The ... | hfp/libxsmm | samples/deeplearning/sparse_training/dlrm/dlrm_s_caffe2.py | Python | bsd-3-clause | 58,415 |
import sys
from ReadFile import ReadPatterns
def Overlap(patterns):
graph = {}
for i in range(0, len(patterns)):
graph[patterns[i]] = []
for j in [x for x in xrange(len(patterns)) if x != i]:
if patterns[i][1:] == patterns[j][:-1]:
graph[patterns[i]].append(patterns[... | Shenmolu/rosalind | Overlap.py | Python | gpl-3.0 | 594 |
def itemTemplate():
return ['object/tangible/wearables/bracelet/shared_bracelet_s03_r.iff']
def customItemName():
return 'Courier Wrist Communications Scanner SCNv4 (Right)'
def requiredProfession():
return 'Bounty Hunter'
def requiredCL():
return 75
def itemSkillMods():
mods = ['droid_find_speed','10... | agry/NGECore2 | scripts/loot/lootItems/treasureloot/wrist_communications_scanner_SCNv4_(right).py | Python | lgpl-3.0 | 383 |
#! /usr/bin/python
# FileSR: local-file storage repository
import FileSR
import SR
import SRCommand
import cleanup
import errno
import nfs
import os
import stat
import sys
import util
import vhdutil
import xs_errors
from lock import Lock
CAPABILITIES = ["SR_PROBE", "SR_UPDATE", "SR_CACHING", \
"VDI_CR... | MissionCriticalCloud/cosmic | cosmic-core/scripts/src/main/resources/scripts/vm/hypervisor/xenserver/xcposs/NFSSR.py | Python | apache-2.0 | 8,545 |
from django.shortcuts import render
from django.conf.urls import patterns, url
from django.core.urlresolvers import reverse_lazy
from django.views.generic import TemplateView
from django.contrib.auth.decorators import login_required
from edamame import base, utils, generic
from . import models
class SiteViews(base.... | tokibito/django-edamame | example/note/views.py | Python | mit | 1,407 |
#!/usr/bin/python -OO
# This file is part of Archivematica.
#
# Copyright 2010-2012 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica 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, e... | artefactual/archivematica-history | src/MCPClient/lib/clientScripts/archivematicaClamscan.py | Python | agpl-3.0 | 2,652 |
#!/usr/bin/env python3
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2019 NIWA & British Crown (Met Office) & Contributors.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation... | matthewrmshin/cylc | lib/parsec/tests/test_upgrade.py | Python | gpl-3.0 | 5,870 |
import logging
from typing import Set
from idiotic import resource
from idiotic import config as global_config
import idiotic
import asyncio
log = logging.getLogger(__name__)
if False:
from idiotic.cluster import Cluster
class Block:
REGISTRY = {}
running = False
name = None
inputs = {}
i... | idiotic/idiotic | idiotic/block.py | Python | mit | 4,044 |
from datetime import datetime
from django.conf import settings
from django.db import models
import reversion
class ModerateError(Exception):
def __init__(self, value):
Exception.__init__(self)
self.value = value
def __str__(self):
return repr('%s, %s' % (self.__class__.__name__, se... | pkimber/old_moderate | moderate/models.py | Python | apache-2.0 | 2,446 |
#
"""xdg_basedir - XDG base directory support."""
# Copyright © 2014-2020 James Rowe <jnrowe@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of jnrbase.
#
# jnrbase is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published... | JNRowe/jnrbase | jnrbase/xdg_basedir.py | Python | gpl-3.0 | 3,522 |
# -*- coding: utf-8 -*-
"""
Asset Management Functionality
http://eden.sahanafoundation.org/wiki/BluePrint/Assets
"""
module = request.controller
resourcename = request.function
if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
# ----------------------------------... | smeissner/eden | controllers/asset.py | Python | mit | 3,079 |
import numpy as np
import pandas as pd
import pytest
from multipledispatch.conflict import ambiguities
from pandas.api.types import CategoricalDtype, DatetimeTZDtype
import ibis
import ibis.expr.datatypes as dt
import ibis.expr.schema as sch
dd = pytest.importorskip("dask.dataframe")
def test_no_infer_ambiguities()... | cpcloud/ibis | ibis/backends/dask/tests/test_datatypes.py | Python | apache-2.0 | 4,034 |
#
# Copyright 2015 Reliance Jio Infocomm Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | yanheven/ceilometer | ceilometer/objectstore/rgw.py | Python | apache-2.0 | 7,798 |
#! /usr/bin/env python3
import os
import sys
import subprocess
from setuptools import find_packages, Command
if sys.version_info < (3, 4):
sys.exit('Orange requires Python >= 3.4')
try:
from numpy.distutils.core import setup
have_numpy = True
except ImportError:
from setuptools import setup
have_... | qPCR4vir/orange3 | setup.py | Python | bsd-2-clause | 8,499 |
from fontTools.misc.textTools import safeEval
from . import DefaultTable
import sys
import array
class table__c_v_t(DefaultTable.DefaultTable):
def decompile(self, data, ttFont):
values = array.array("h")
values.frombytes(data)
if sys.byteorder != "big": values.byteswap()
self.values = values
def compile(s... | google/material-design-icons | update/venv/lib/python3.9/site-packages/fontTools/ttLib/tables/_c_v_t.py | Python | apache-2.0 | 1,145 |
"""A block Davidson solver for finding a fixed number of eigenvalues.
Adapted from https://joshuagoings.com/2013/08/23/davidsons-method/
"""
import time
from typing import Tuple
import numpy as np
from tqdm import tqdm
def davidson(A: np.ndarray, k: int, eig: int) -> Tuple[np.ndarray, np.ndarray]:
assert len(A.... | berquist/programming_party | eric/project12/davidson.py | Python | mpl-2.0 | 2,084 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_04_01/aio/operations/_hub_virtual_network_connections_operations.py | Python | mit | 8,992 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2019-07-03 08:35
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('organization_projects', '0087_auto_20190619_2052'),
]
operations = [
migrations.Alt... | Ircam-Web/mezzanine-organization | organization/projects/migrations/0088_auto_20190703_1035.py | Python | agpl-3.0 | 1,401 |
#!/bin/env/python3
import argparse
import os
import subprocess
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument('--name', default='qc18SV4',
help='name for the new virtual environment')
arg_parser.add_argument('--conda', default=False, action='store_true',
help='create a virtual environment usin... | hurwitzlab/muscope-18SV4 | create_virtual_environment.py | Python | mit | 921 |
# Copyright 2020 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... | tensorflow/io | tensorflow_io/python/api/experimental/columnar.py | Python | apache-2.0 | 1,252 |
from blackwidow.network.device import Device
from blackwidow.network.host import Host
def test_construct():
d = Device('H1')
assert d.network_id == 'H1'
def test_host():
h1 = Host('H1')
h2 = Host('H2')
h1.add_link('L1')
assert h1._links[0] == 'L1'
assert h2._links == []
| BLQ-Software/black-widow | src/tests/test_devices.py | Python | mit | 301 |
from collections import OrderedDict
from django.contrib.auth.decorators import login_required
from django.urls.base import reverse
from django.urls.exceptions import NoReverseMatch
from django.utils import timezone
from django.utils.decorators import method_decorator
from django.views.generic import TemplateView
from... | botswana-harvard/ba-namotswe | ba_namotswe_dashboard/views.py | Python | gpl-3.0 | 10,727 |
# -*- encoding: utf8 -*-
from __future__ import unicode_literals, print_function
import sys
from django.core.management.base import BaseCommand, CommandError
from sorl.thumbnail import default
class Command(BaseCommand):
help = (
'Handles thumbnails and key value store'
)
args = '[cleanup, clea... | caioariede/sorl-thumbnail | sorl/thumbnail/management/commands/thumbnail.py | Python | bsd-3-clause | 1,544 |
import MySQLdb as mdb
import ConfigParser
config = ConfigParser.SafeConfigParser()
config.read('../configs/ircBase.conf')
CONST_DB_USER = config.get('MySql', 'username')
CONST_DB_PASSWORD = config.get('MySql', 'password')
#---------------------------------------------------------------
#Create the database and table... | sdmadsen/RafiBot | db migration/2.py | Python | bsd-2-clause | 1,647 |
# defines the main function
def main(count = input("call#: ")):
# loops through numbers in the fibonacci sequence until it's equal to count
counted = 0
x = 1
y = 1
while counted < count:
print x
y += x
print y
x += y
counted += 1
main()
| ethanavatar/pytools | fibonacci.py | Python | apache-2.0 | 252 |
__author__ = 'krishnab'
from operator import neg, truediv
import numpy as np
import pandas as pd
from numpy.random import binomial
from models.Models import Base_model
class Basic_stochastic_model_fixed_promotion(Base_model):
def __init__(self, **kwds):
Base_model.__init__(self, **kwds)
self.nam... | 00krishna-research/py_university_gender_dynamics_pkg | pyugend/BasicStochasticModelFixedPromotionDeptSizeStable.py | Python | mit | 13,110 |
# Simply Coding "Space Pirates"
# By Steve Carlson June/July 2015
# Referenced Materials:
# http://inventwithpython.com/pygame
# https://github.com/BYU-MarsRover/Basestation/blob/master/RoverBase.py
# PyGame Example Files from C:\Python27\Lib\site-packages\pygame\examples
# Dependencies:
# PyGame Library ... | StephenCarlson/SpacePirates | SpacePirates.py | Python | mit | 18,836 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
"""
Boot session from cache or build
Session bootstraps info needed by common client side activities including
permission, homepage, default variables, system defaults etc
"""
im... | jevonearth/frappe | frappe/sessions.py | Python | mit | 10,808 |
"""
Various backends that interface with the Kyoukai application.
.. currentmodule:: kyoukai.backends
.. autosummary::
:toctree: Backends
httptools_
http2
"""
| SunDwarf/Kyoukai | kyoukai/backends/__init__.py | Python | mit | 179 |
#!/usr/bin/env python
# This file is part of VoltDB.
# Copyright (C) 2008-2015 VoltDB Inc.
#
# 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 limitati... | ingted/voltdb | tests/scripts/SQLGenerator.py | Python | agpl-3.0 | 38,571 |
# -*- coding: utf-8 -*-
"""WebHelpers used in turboforum."""
#from webhelpers import date, feedgenerator, html, number, misc, text
from markupsafe import Markup
from datetime import datetime
def current_year():
now = datetime.now()
return now.strftime('%Y')
def icon(icon_name):
return Markup('<i class="glyp... | InformaticiTarantini/turboforum | turboforum/lib/helpers.py | Python | gpl-2.0 | 359 |
"""
WSGI config for bcblink project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bcblink.settings_production")
from dj... | binRick/thc.digital | BitCoin-Blink-Lottery/bcblink/wsgi.py | Python | unlicense | 400 |
#!/usr/bin/env python
# encoding: utf-8
"""Description: pgem parallel test on UFT test fixture.
Currently supports 4 duts in parallel.
"""
__version__ = "0.1"
__author__ = "@boqiling"
__all__ = ["Channel", "ChannelStates"]
from UFT.devices import pwr, load, aardvark
from UFT.models import DUT_STATUS, DUT, Cycle, PGEM... | fanmuzhi/UFT | src/UFT/channel.py | Python | gpl-3.0 | 33,297 |
# -*- coding: utf-8 -*-
# from export import VcardExporter
from Vobj3.vobj import Vobj
vcard2_1 = 'Vobj3/fixtures/vcard_v2.1'
vcard3_0 = 'Vobj3/fixtures/vcard_v3.0'
# x = Vobj(vcard3_0)
x = Vobj(vcard2_1)
x.export()
import ipdb
ipdb.set_trace()
| concordusapps/strudel | test.py | Python | mit | 248 |
# -*- coding: utf-8 -*-
import sys, os
import tsp.tsp
import time, random, itertools
# tour_length = 20
# tour=range(1,tour_length-1)
# random.shuffle(tour)
# tour = [0]+tour+[tour_length-1]
# print(tour)
# start_city = tour[0]
# finish_city = tour[-1]
# tour = tour[1:-1]
# # for ii in range(100):
# # ... | sergeimoiseev/othodi | test_tsp_import.py | Python | mit | 5,784 |
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | twitter-forks/bazel | tools/android/instrumentation_test_check_test.py | Python | apache-2.0 | 2,852 |
#!/usr/bin/env python
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../')
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../../')
from cmake_files import CMakeFiles
from parseXML import ParseXML
import test_functions
###########################################... | hovo1990/deviser | generator/tests/test_cmake_code/run_cmake_tests.py | Python | lgpl-2.1 | 3,357 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Title(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "heatmap.colorbar"
_path_str = "heatmap.colorbar.title"
_valid_props = {"font", "side", "text"... | plotly/python-api | packages/python/plotly/plotly/graph_objs/heatmap/colorbar/_title.py | Python | mit | 6,694 |
# Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from cura.UltimakerCloud import UltimakerCloudConstants
class Settings:
# Keeps the plugin settings.
DRIVE_API_VERSION = 1
DRIVE_API_URL = "{}/cura-drive/v{}".format(UltimakerCloudConstants.CuraCloudAPIRoot, s... | Ultimaker/Cura | plugins/CuraDrive/src/Settings.py | Python | lgpl-3.0 | 491 |
'''
This program demonstrates a problem I've encountered with the PySide
QListWidget class, using PySide 1.2.1, Qt 4.8.5, and Mac OS X 10.8.5.
To see the problem:
1. Run the program.
2. Scroll down the list.
3. Click on a list item to select it.
4. Press the "Delete" button.
When the item is deleted, the list scroll... | HaroldMills/Maka | test/TestListWidget.py | Python | mit | 2,013 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Multi-pattern Insertion Shellcode Encoder - Python Language
# Copyright (C) 2013 Geyslan G. Bem, Hacking bits
#
# http://hackingbits.com
# geyslan@gmail.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General ... | geyslan/SLAE | 4th.assignment/insertion_encoder.py | Python | gpl-3.0 | 6,066 |
"""
Business logic/Service layer
"""
from .models import IdentifyJob, Dataset
from django.core.mail import EmailMessage
from django.db import transaction
from .hpc import identify_pipeline, update_genotype_status
from django.conf import settings
import requests
import logging
from . import plotting
import re
import su... | Gregor-Mendel-Institute/AraGeno | arageno/services.py | Python | mit | 2,642 |
# ./gen_hamm_dct.py
# script generateing NN initialization for training with TNet
#
# author: Karel Vesely
# calling example:
# python gen_mlp_init.py --dimIn=598 --dimOut=135 --dimHid=1024:1024:1024
#
import math, random
import sys
from optparse import OptionParser
parser = OptionParser()
parser.add_option('... | troylee/nnet-asr | tools/init/gen_sharedlinearity_init.py | Python | apache-2.0 | 2,213 |
import io
from os import path
import pytest
from nikola.plugins.compile.markdown import CompileMarkdown
from .helper import FakeSite
@pytest.mark.parametrize(
"input_str, expected_output",
[
pytest.param("", "", id="empty"),
pytest.param(
"[podcast]https://archive.org/download/R... | getnikola/nikola | tests/test_compile_markdown.py | Python | mit | 2,091 |
"""
Example of hyperparameter search in MLflow using Hyperopt.
The run method will instantiate and run Hyperopt optimizer. Each parameter configuration is
evaluated in a new MLflow run invoking main entry point with selected parameters.
The runs are evaluated based on validation set loss. Test set score is calculated... | mlflow/mlflow | examples/hyperparam/search_hyperopt.py | Python | apache-2.0 | 6,367 |
# import the api
from maya.api import OpenMaya as om
# Let maya know we're using it by declaring this function
def maya_useNewAPI():
pass
# We'll be making our node by deriving from MPxNode, a base class for all nodes
class MinMaxNode(om.MPxNode):
# Define the name of the node
kNodeName = 'minMax'
... | dgovil/AdvancedPythonForMaya | Nodes/minMaxNode.py | Python | gpl-3.0 | 5,632 |
#!/usr/bin/env python
#coding:utf-8
"""
Minimal network
The following undirected network consists of seven vertices and twelve edges with a total weight of 243.
The same network can be represented by the matrix below.
However, it is possible to optimise the network by removing some edges and still ensure that all poi... | Urinx/Project_Euler_Answers | 107.py | Python | gpl-2.0 | 2,061 |
# Copyright (C) 2010-2013 Claudio Guarnieri.
# Copyright (C) 2014-2016 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file "docs/LICENSE" for copying permission.
from . import views
from django.conf.urls import url
urlpatterns = [
url(r"^$", views.index, name="da... | cuckoobox/cuckoo | cuckoo/web/dashboard/urls.py | Python | mit | 333 |
from corehq.apps.domain.auth import formplayer_auth
from corehq.apps.ota.case_restore import get_case_restore_response
@formplayer_auth
def migration_restore(request, domain, case_id):
"""Moved to `ota` app. Can be removed once Formplayer is updated."""
return get_case_restore_response(domain, case_id)
| dimagi/commcare-hq | corehq/apps/case_migrations/views.py | Python | bsd-3-clause | 314 |
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.views.generic.base import RedirectView
from settings import API_BASE
from . import views
base_pattern = '^{}'.format(API_BASE)
# Please keep URLs alphabetized for auto-generated documenta... | wearpants/osf.io | api/base/urls.py | Python | apache-2.0 | 2,261 |
"""
Modülün Açıklaması
__author__ : Çağatay Tengiz
__date__ : 19.12.2013
"""
import json
from bottle import Bottle, request, abort, redirect
from sqlalchemy import exc, and_, or_
from sqlalchemy.sql import func
from upload import upload_file
from utils_sa import formdata_to_sa
from i18n import _
from dbcon import ... | makki-io/pitrot | controllers/project.py | Python | mit | 13,617 |
from md2remark import main
def run():
main.run()
if __name__ == '__main__':
run() | patrickayoup/md2remark | md2remark_runner.py | Python | mit | 87 |
from common_fixtures import * # NOQA
TEST_SERVICE_OPT_IMAGE = 'ibuildthecloud/helloworld'
TEST_SERVICE_OPT_IMAGE_LATEST = TEST_SERVICE_OPT_IMAGE + ':latest'
TEST_SERVICE_OPT_IMAGE_UUID = 'docker:' + TEST_SERVICE_OPT_IMAGE_LATEST
LB_IMAGE_UUID = "docker:sangeetha/testlbsd:latest"
logger = logging.getLogger(__name__)
... | sangeethah/validation-tests | tests/v2_validation/cattlevalidationtest/core/test_rancher_compose.py | Python | apache-2.0 | 30,788 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
'Click>=6.0',
'bitcoin',
# TODO: put package requirements here
]... | toirl/pynunzen | setup.py | Python | mit | 1,412 |
""" Custom errors and exceptions. """
class IllegalArgumentError(Exception):
"""
Raised if wrong argument values are passed to functions.
(Similar to ValueError for build-in functions.)
"""
pass
class IllegalStateError(Exception):
"""
Raised if application is in an illegal state.
(e.... | sbaltes/api-retriever | util/exceptions.py | Python | apache-2.0 | 568 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Get DLL or EXE build version
# Copyright © 2015 Sam Liu <sam.liu@activenetwork.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either versi... | defionscode/ansible-modules-extras | windows/win_file_version.py | Python | gpl-3.0 | 2,188 |
import json
from twisted.internet.defer import inlineCallbacks
from Tribler.Test.Core.Modules.RestApi.Channels.test_channels_endpoint import AbstractTestChannelsEndpoint
from Tribler.Test.twisted_thread import deferred
class TestChannelsPlaylistEndpoints(AbstractTestChannelsEndpoint):
@deferred(timeout=10)
... | vandenheuvel/tribler | Tribler/Test/Core/Modules/RestApi/Channels/test_channels_popular_endpoint.py | Python | lgpl-3.0 | 1,685 |
# Copyright 2017 Google 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 law or ag... | nkubala/runtimes-common | ftl/php/builder.py | Python | apache-2.0 | 3,764 |
from tests import pulp_test
from pulp_auto import login, Pulp
def setUpModule():
pass
class TestLogin(pulp_test.PulpTest):
@classmethod
def setUpClass(cls):
super(TestLogin, cls).setUpClass()
cls.wrong_pulp = Pulp(cls.pulp.url, auth=('admin', 'xxx'))
class SimpleTestLogin(TestLogin):
... | RedHatQE/pulp-automation | tests/general_tests/test_01_log_in.py | Python | gpl-2.0 | 599 |
import tempfile
import synapse.common as s_common
import synapse.lib.msgpack as s_msgpack
_readsz = 10000000
def splice(act, **info):
'''
Form a splice event from a given act name and info.
Args:
act (str): The name of the action.
**info: Additional information about the event.
... | vivisect/synapse | synapse/lib/splice.py | Python | apache-2.0 | 2,652 |
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
import sys
fig = plt.figure()
fig.canvas.set_window_title("Cubeception Heatmap")
ax = fig.add_subplot(111)
data = np.zeros((4,6))
im = ax.imshow(data, interpolation='none', vmin=0, vmax=100, cmap='Blues')
a... | sdrobotics101/cubeception-2-tools | scripts/heatmap.py | Python | gpl-2.0 | 857 |
from werkzeug.http import parse_accept_header
class I18NString:
default_lang = 'en'
def __init__(self, default_lang='en', **kwargs):
self.default_lang = default_lang
self.translations = kwargs
def __getitem__(self, item):
return self.translations[item]
def parse_accept_language... | hadron-powered/si-site | si_site/util/i18n.py | Python | gpl-3.0 | 558 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.