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 |
|---|---|---|---|---|---|
'''
Function script to split a list in n parts
This function can be reused in any project or script.
If you have the following list: [1,2,3,4,5,6,7,8,9,10] and want to break it in
5 parts, you should do:
>>> new_list = [1,2,3,4,5,6,7,8,9,10]
>>> print breaker(new_list, 5)
And you should get:
[[1,2], [3,4]... | niceandcoolusername/cosmos | code/unclassified/split_list/split_list.py | Python | gpl-3.0 | 476 |
#!/usr/bin/env python
__author__ = 'greg'
from cassandra.cluster import Cluster
import cassandra
import pymongo
import uuid
import json
from cassandra.concurrent import execute_concurrent
cluster = Cluster()
cassandra_session = cluster.connect('serengeti')
# try:
# cassandra_session.execute("drop table classifica... | zooniverse/aggregation | experimental/algorithms/serengeti_blank/serengeti_cass.py | Python | apache-2.0 | 2,234 |
# Copyright 2015 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 a... | dllatas/deepLearning | uppmax/cifar10_multi_gpu_train.py | Python | mit | 10,719 |
"""Voluptuous schemas for the KNX integration."""
import voluptuous as vol
from xknx.devices.climate import SetpointShiftMode
from xknx.io import DEFAULT_MCAST_PORT
from xknx.telegram.address import GroupAddress, IndividualAddress
from homeassistant.const import (
CONF_DEVICE_CLASS,
CONF_ENTITY_ID,
CONF_HO... | w1ll1am23/home-assistant | homeassistant/components/knx/schema.py | Python | apache-2.0 | 19,733 |
# -*- coding: utf-8 -*-
"""
This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
then create a function that returns the calculated value based on the value of
FEATURES[...]. Modules that extend this one can change th... | louyihua/edx-platform | cms/envs/common.py | Python | agpl-3.0 | 37,478 |
from distutils.core import setup
setup(name='Critical Py',
version='0.1',
description='Critical path calcuation',
author='David Henderson',
author_email='david.henderson82@gmail.com',
url='https://github.com/dhenderson/criticalpy',
packages=['criticalpy']
) | dhenderson/criticalpy | setup.py | Python | mit | 299 |
"""
Test the script webservice-image-digest by calling this from
the tests directory
cd compose_setup/scripts/tests
python test-webservice-image-digest.py
"""
import unittest
import subprocess
script_location = "../webservice-image-digest.py"
base_command = "python {}".format(script_location)
branch = "develop"... | dockstore/compose_setup | scripts/tests/test-webservice-image-digest.py | Python | apache-2.0 | 1,346 |
""" $lic$
Copyright (C) 2016-2020 by Tsinghua University and The Board of Trustees of
Stanford University
This program is free software: you can redistribute it and/or modify it under
the terms of the Modified BSD-3 License as published by the Open Source
Initiative.
This program is distributed in the hope that it wi... | stanford-mast/nn_dataflow | nn_dataflow/tests/loop_blocking_test/test_loop_blocking_partition.py | Python | bsd-3-clause | 18,952 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A simple Python file."""
CHARLIE = "Brown"
VIOLET = "Gray"
PATRICIA = "Reichardt"
LINUS = "van Pelt"
| neal-rogers/is210-week-02-synthesizing | task_03.py | Python | mpl-2.0 | 151 |
# -*- coding: utf-8 -*-
import os
import pytest
from gridsync.errors import FilesystemLockError
from gridsync.lock import FilesystemLock
def test_lock_acquire(tmpdir):
lock = FilesystemLock(os.path.join(str(tmpdir), "test.lock"))
lock.acquire()
assert lock.fd
def test_lock_acquire_filepath_created(tm... | gridsync/gridsync | tests/test_lock.py | Python | gpl-3.0 | 1,162 |
# setup.py - distutils configuration for esm and esmre modules
# Copyright (C) 2007 Tideway Systems Limited.
#
# 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 Foundation; either
# version 2.1 of the... | mangelin/esmre | setup.py | Python | lgpl-2.1 | 2,313 |
import hashlib
import hmac
import re
import time
from urllib import urlencode
from django.conf import settings
from django.contrib.auth.middleware import (AuthenticationMiddleware as
BaseAuthenticationMiddleware)
from django.contrib.auth.models import AnonymousUser
from djan... | washort/zamboni | mkt/api/middleware.py | Python | bsd-3-clause | 15,987 |
'''OpenGL extension AMD.transform_feedback3_lines_triangles
This module customises the behaviour of the
OpenGL.raw.GL.AMD.transform_feedback3_lines_triangles to provide a more
Python-friendly API
Overview (from the spec)
OpenGL 4.0 introduced the ability to record primitives into multiple output
streams using t... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/GL/AMD/transform_feedback3_lines_triangles.py | Python | lgpl-3.0 | 1,320 |
from textwrap import dedent
from peru import plugin
import shared
def assert_parallel(n):
# The plugin module keep a global counter of all the jobs that run in
# parallel, so that we can write these tests.
if plugin.DEBUG_PARALLEL_MAX != n:
raise AssertionError('Expected {} parallel {}. Counted ... | olson-sean-k/peru | tests/test_parallelism.py | Python | mit | 3,868 |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 04 15:49:07 2016
@author: alr
"""
from pyAPP6Tools import MissionOptimization
from pyAPP6Tools.MissionOptimization import segmentParameter, resFunctionMinimizeEndValue, missionObjective, updateEndCondition
if __name__ == "__main__":
misfile = r'A320_optFu... | ALR-Aerospace/pyAPP6Tools | Examples/MissionOptimization/optimize_A320_optFuelBurn.py | Python | mit | 802 |
"""Constants for the DLNA DMR component."""
from __future__ import annotations
from collections.abc import Mapping
import logging
from typing import Final
from async_upnp_client.profiles.dlna import PlayMode as _PlayMode
from homeassistant.components.media_player import const as _mp_const
LOGGER = logging.getLogger... | rohitranjan1991/home-assistant | homeassistant/components/dlna_dmr/const.py | Python | mit | 7,362 |
from django.core.management.base import BaseCommand
from tenant_only.models import TableTwo
class Command(BaseCommand):
help = 'Test table two'
def add_arguments(self, parser):
parser.add_argument('--id', nargs='+', type=int)
def handle(self, *args, **options):
print(options['id'])
... | tomturner/django-tenants | examples/tenant_tutorial/tenant_only/management/commands/dtest.py | Python | mit | 409 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import smart_selects.db_fields
class Migration(migrations.Migration):
dependencies = [
('lugar', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='DiasEfect... | shiminasai/mapafinca | clima/migrations/0001_initial.py | Python | mit | 4,223 |
"""Contains classes for refinement engines. Refinery is the shared interface,
LevenbergMarquardtIterations, GaussNewtonIterations, SimpleLBFGS and LBFGScurvs
are the current concrete implementations"""
from __future__ import annotations
import copy
import json
import logging
from io import StringIO
from typing import... | dials/dials | algorithms/refinement/engine.py | Python | bsd-3-clause | 37,272 |
from django.views.generic import TemplateView
from main.mixins import MenuContextMixin
from project.helpers.cache_control_view import CacheMixin
class MockupView(MenuContextMixin, CacheMixin, TemplateView):
pass
class HomepageView(MenuContextMixin, CacheMixin, TemplateView):
template_name = 'index.html'
... | makeev/django-boilerplate | back/main/views/pages.py | Python | mit | 461 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for Tango on Android plugins."""
import unittest
from plaso.lib import definitions
from plaso.parsers.sqlite_plugins import tango_android
from tests.parsers.sqlite_plugins import test_lib
class TangoAndroidProfileTest(test_lib.SQLitePluginTestCase):
"""Test... | log2timeline/plaso | tests/parsers/sqlite_plugins/tango_android.py | Python | apache-2.0 | 4,398 |
# -*- coding: utf-8 -*-
"""
Unit testing module for pytest-pylint plugin
"""
import os
import re
from textwrap import dedent
from unittest import mock
import pylint.config
import pytest
pytest_plugins = ("pytester",) # pylint: disable=invalid-name
def test_basic(testdir):
"""Verify basic pylint checks"""
t... | carsongee/pytest-pylint | pytest_pylint/tests/test_pytest_pylint.py | Python | mit | 12,608 |
# Copyright 2016 ZTE Corporation.
#
# 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 ... | open-o/nfvo | lcm/lcm/ns/sfcs/create_sfc_worker.py | Python | apache-2.0 | 2,698 |
# coding=utf-8
import re
# [oov] no longer in words.txt
OOV_TERM = '<unk>'
def load_vocabulary(words_file):
'''Load vocabulary words from an OpenFST SymbolTable formatted text file'''
return set(x.split(' ')[0] for x in words_file if x != '')
def kaldi_normalize(word, vocab):
"""
Take a token extract... | lowerquality/gentle | gentle/metasentence.py | Python | mit | 1,983 |
# Copyright 2016 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 a... | sbc100/yapf | yapftests/reformatter_verify_test.py | Python | apache-2.0 | 3,579 |
__author__ = 'adeksandrcernov'
import mysql.connector
from model.contact import Contact
from model.group import Group
class DbFixture:
def __init__(self, host, name , user, password):
self.host = host
self.name = name
self.user = user
self.password = password
self.connect... | AlChernoff/python_training | fixture/Db.py | Python | apache-2.0 | 2,024 |
from django import forms
from django.core.validators import MinLengthValidator
from .models import DemoUser
class DemoUserEditForm(forms.ModelForm):
"""Form for viewing and editing name fields in a DemoUser object.
A good reference for Django forms is:
http://pydanny.com/core-concepts-django-modelforms.... | kingofsystem/demo-allauth-bootstrap | allauthdemo/auth/forms.py | Python | mit | 1,126 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_chart_format23.py | Python | bsd-2-clause | 1,541 |
from admin import reset
from base import Database, Runtime
from hs_common.hs_cleanup import Cleanup
from user import User,UserGroup,Group,GroupPermission,Permission
import unittest
class PermissionTest(unittest.TestCase):
def setUp(self):
Runtime.enable_trace = False
reset.reset()
Runtime.... | luzi82/HiSocial | test_old/Permission.py | Python | gpl-3.0 | 1,414 |
"""This script allows us to manually merge the results from oplog and profiling
results."""
import calendar
import config
import os
import sys
import utils
from bson import BSON
def dump_op(output, op):
copier = utils.DictionaryCopier(op)
copier.copy_fields("ts", "ns", "op")
op_type = op["op"]
# handp... | ParsePlatform/flashback | record/merge.py | Python | bsd-3-clause | 6,495 |
import os
from django.conf import settings
from celery import Celery
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mygpo.settings")
celery = Celery("mygpo.celery")
celery.config_from_object("django.conf:settings", namespace="CELERY")
celery.autodiscover_tasks()
| gpodder/mygpo | mygpo/celery.py | Python | agpl-3.0 | 269 |
"""Tests for daemon working with IMAP connections."""
import logging
import os
import pathlib
import unittest
from maildaemon.config import load_config
from maildaemon.imap_cache import IMAPCache
_LOG = logging.getLogger(__name__)
_HERE = pathlib.Path(__file__).parent
_TEST_CONFIG_PATH = _HERE.joinpath('maildaemon_... | mbdevpl/maildaemon | test/test_imap_cache.py | Python | apache-2.0 | 1,469 |
# -*- coding: utf-8 -*-
#
# Secret Labs' Regular Expression Engine
#
# convert template to internal format
#
# Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support module for sre"""
import _sre, sys
import sre_parse... | svanschalkwyk/datafari | windows/python/Lib/sre_compile.py | Python | apache-2.0 | 19,817 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Unit tests for emr_emr_usage_demo.py functions.
"""
import time
import pytest
import boto3
from boto3.s3.transfer import S3UploadFailedError
from botocore.exceptions import ClientError
import emr_usage_dem... | awsdocs/aws-doc-sdk-examples | python/example_code/emr/test/test_emr_usage_demo.py | Python | apache-2.0 | 10,773 |
def append_attr(obj, attr, value):
"""
Appends value to object attribute
Attribute may be undefined
For example:
append_attr(obj, 'test', 1)
append_attr(obj, 'test', 2)
assert obj.test == [1, 2]
"""
try:
getattr(obj, attr).append(value)
exce... | baverman/snaked | snaked/signals/util.py | Python | mit | 375 |
from wtforms import StringField, PasswordField, SubmitField, TextAreaField
from flask_wtf import Form
from wtforms.validators import Length, DataRequired, EqualTo, Email
class RegistrationForm(Form):
username = StringField('Username', [Length(min=4, max=25), DataRequired("Enter username")])
email = StringFiel... | bonny-mwenda/bc-8-suggestion-box | forms.py | Python | gpl-3.0 | 1,274 |
# Copyright 2013-2021 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 RTclust(RPackage):
"""Robust Trimmed Clustering
Provides functions for robust trimmed... | LLNL/spack | var/spack/repos/builtin/packages/r-tclust/package.py | Python | lgpl-2.1 | 1,488 |
#!/usr/bin/env python3
'''
Kurgan MultiAgent Framework
http://www.kurgan.com.br/
Agent to check for backup and interesting files.
Author: Glaudson Ocampos - <glaudson@kurgan.com.br>
Created in August 09th, 2016.
Last Modified in January 13th, 2017.
'''
import sys, os
import random
import string
from multiprocessin... | glaudsonml/kurgan-ai | agents/agentBackup.py | Python | apache-2.0 | 5,090 |
from benchfw import BenchEnv, BenchmarkIt
import sys
if __name__=='__main__':
if len(sys.argv) !=2:
print("Usage {} <dbname>".format(sys.argv[0]))
sys.exit(1)
db_name = sys.argv[1]
benv = BenchEnv(db_name=db_name)
bench = BenchmarkIt.load(env=benv, name="Load CSV")
df = bench.to... | jdfekete/progressivis | benchmarks/new_dump.py | Python | bsd-2-clause | 635 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Corpus in the Matrix Market format.
"""
import logging
from gensim import interfaces, matutils
from gensim.corpora import Indexe... | krishna11888/ai | third_party/gensim/gensim/corpora/mmcorpus.py | Python | gpl-2.0 | 1,588 |
# AsteriskLint -- an Asterisk PBX config syntax checker
# Copyright (C) 2015-2019 Walter Doekes, OSSO B.V.
#
# 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 version 3 of the License, or
... | ossobv/asterisklint | asterisklint/version.py | Python | gpl-3.0 | 2,259 |
from os import environ
properties = {}
properties['GITHUB_USERNAME'] = environ['GITHUB_USERNAME']
properties['GITHUB_PASSWORD'] = environ['GITHUB_PASSWORD']
properties['GITHUB_REPO'] = environ['GITHUB_REPO']
properties['REDIS_PORT'] = environ['REDIS_PORT']
properties['REDIS_HOST'] = environ['REDIS_HOST']
| nivertech/gordon | web/config.py | Python | apache-2.0 | 308 |
# Copyright 2013 Netease Corporation
# 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 requi... | petrutlucian94/nova | nova/tests/unit/test_availability_zones.py | Python | apache-2.0 | 10,927 |
# coding: utf-8
from __future__ import unicode_literals
import re
import itertools
from .common import InfoExtractor
from ..utils import (
clean_html,
dict_get,
ExtractorError,
float_or_none,
get_element_by_class,
int_or_none,
js_to_json,
parse_duration,
parse_iso8601,
try_get,
unescapeHTML,
urlencode_pos... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/bbc.py | Python | gpl-3.0 | 46,947 |
def create_nodes(femmesh):
# nodes
femmesh.addNode(0.0, 500.0, 500.0, 1)
femmesh.addNode(8000.0, 500.0, 500.0, 2)
femmesh.addNode(148.14814814814792, 500.0, 500.0, 3)
femmesh.addNode(296.29629629629585, 500.0, 500.0, 4)
femmesh.addNode(444.4444444444438, 500.0, 500.0, 5)
femmesh.addNode(592.... | sanguinariojoe/FreeCAD | src/Mod/Fem/femexamples/meshes/mesh_canticcx_seg2.py | Python | lgpl-2.1 | 5,045 |
#!/usr/bin/env python
import pandas as pd
import requests
import os
import requests
from urllib.parse import urljoin
from bs4 import BeautifulSoup
import random
import time
df = pd.read_csv("metadata.csv")
#Don't download research papers with non-commercial license.
df.loc[df['license'] != "no-cc"]
df.loc[df["pmcid"]... | googleinterns/cloudsearch-ai | helper_scripts/downloadResearchPapers.py | Python | apache-2.0 | 2,607 |
#!/usr/bin/env python
#---------------------------------------------------------------------------
# Copyright 2012-2019 The Open Source Electronic Health Record Alliance
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obta... | josephsnyder/VistA | Scripts/VistAMComponentExtractor.py | Python | apache-2.0 | 11,188 |
import os
import json
try:
import yaml
except ImportError:
yaml = None
def root():
''' Assuming that this function is in root.utils, returns the root directory
of the project. '''
path, _ = os.path.split(__file__)
return os.path.abspath(path)
def loadfile(filename, _format=None):
''' Lo... | kreativitea/RandomData | utils.py | Python | mit | 739 |
#!/usr/bin/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 http://mozilla.org/MPL/2.0/.
# This program splits up a jprof profile into multiple files based on a
# list of functions in a text ... | Yukarumya/Yukarum-Redfoxes | tools/jprof/split-profile.py | Python | mpl-2.0 | 5,461 |
import os, sys, urllib, textwrap
import codecs
from twisted.python import usage
from allmydata.util.assertutil import precondition
from allmydata.util.encodingutil import unicode_to_url, quote_output, \
quote_local_unicode_path, argv_to_abspath
from allmydata.scripts.default_nodedir import _default_nodedir
def ge... | david415/tahoe-lafs | src/allmydata/scripts/common.py | Python | gpl-2.0 | 8,400 |
def readDensityFile(infile):
infile.next()
infile.next()
density = []
for line in infile:
tmp = line.split(",")
tmp2 = tmp[0].split("(")
d = float(tmp2[1])
density.append(d)
infile.close()
return density
infile = open("DensityFCI_w=075_N=4_L=10.txt",'r')
densityFCI = readDensityFile(infile)
infile ... | hakii27/PythonVersionMaster | Results/OneDimDot/FourElectrons/DensityPlot.py | Python | lgpl-3.0 | 956 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Generate java source files from protobuf files.
Usage:
protoc_java.py {protoc} {proto_path} {java_out} {stamp_file} {proto_... | s20121035/rk3288_android5.1_repo | external/chromium_org/build/protoc_java.py | Python | gpl-3.0 | 1,523 |
import importlib
import inspect
import os
import re
import sys
import tempfile
import threading
from io import StringIO
from pathlib import Path
from unittest import mock
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import DatabaseError, connection
from djan... | georgemarshall/django | tests/view_tests/tests/test_debug.py | Python | bsd-3-clause | 53,853 |
import math
ceil = lambda f: int(math.ceil(f))
from gobject import *
import gtk
import cairo
import pango
line = 10
curve = 60
dotSmall = 14
dotLarge = 24
lineprc = 1/7.
hpadding = 5
vpadding = 3
class SpotGraph (gtk.EventBox):
__gsignals__ = {
'spotClicked' : (SIGNAL_RUN_FIRST, TYPE_NONE, (str,))
... | jskurka/PyChess-Learning-Module | lib/pychess/widgets/SpotGraph.py | Python | gpl-3.0 | 17,065 |
# Copyright 2014 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... | flgiordano/netcash | +/google-cloud-sdk/lib/surface/dns/record_sets/export.py | Python | bsd-3-clause | 3,429 |
#!/usr/bin/env python
#
# Copyright (c) 2001-2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use,... | andrewyoung1991/scons | test/Docbook/basedir/htmlhelp/htmlhelp_cmd.py | Python | mit | 2,111 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
class ModuleDocFragment(object):
# inventory cache
DOCUMENTATION = r'''
options:
aws_profile:
description: The AWS profile
type: str
alia... | ujenmr/ansible | lib/ansible/plugins/doc_fragments/aws_credentials.py | Python | gpl-3.0 | 1,170 |
#
# Copyright © 2012–2022 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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 version 3 of the Licens... | nijel/weblate | weblate/trans/models/variant.py | Python | gpl-3.0 | 1,480 |
from decimal import ROUND_HALF_EVEN
import moneyed
from moneyed.localization import _sign, _format
_sign("en_GB", moneyed.GBP, prefix="£")
_format(
"en_GB",
group_size=3,
group_separator=",",
decimal_point=".",
positive_sign="",
trailing_positive_sign="",
negative_sign="-",
trailing_n... | waldocollective/django-hordak | hordak/__init__.py | Python | mit | 377 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | caseylucas/ansible-modules-core | network/junos/junos_command.py | Python | gpl-3.0 | 7,935 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import wiki.plugins.images.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wiki', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Image',... | NablaWebkom/django-wiki | wiki/plugins/images/migrations/0001_initial.py | Python | gpl-3.0 | 1,567 |
#!/usr/bin/env python
# Copyright 2016 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... | spacexnice/ctlplane | Godeps/_workspace/src/github.com/google/cadvisor/build/boilerplate/boilerplate.py | Python | mit | 4,734 |
#-------------------------------------------------------------------------------
#
# Copyright (c) 2006, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions ... | pankajp/pyface | pyface/dock/feature_tool.py | Python | bsd-3-clause | 1,947 |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from sys import argv
from optparse import make_option
import csv
from time import time
from datetime import datetime
from upload.models import ImportItem
from django.template.loader import render_to_string
from django.conf import ... | redsolution/django-catalog | catalog/contrib/defaults/management/commands/makeprice.py | Python | gpl-3.0 | 5,502 |
# Michael Cohen <scudette@users.sourceforge.net>
# David Collett <daveco@users.sourceforge.net>
#
# ******************************************************
# Version: FLAG $Version: 0.87-pre1 Date: Thu Jun 12 00:48:38 EST 2008$
# ******************************************************
#
# * This program is free software... | backupManager/pyflag | src/plugins/DiskForensics/FileHandlers/ZipFile.py | Python | gpl-2.0 | 21,412 |
'''
Kendrick Server
The kendrick http server is extended from the Tornado project. It serves two purposes
=>To serve static files directly, acts exactly like a connection object.
=>To act as a "proxy" that gives you a particular url to that simply maps to the real url, which is defined
by the connection.
'''
import ... | broadmarkio/kendrick | kendrick/server.py | Python | gpl-2.0 | 1,564 |
#!/usr/bin/env python
class SplitResultResponse(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually."""
def __init__(self):
"""
Attributes:
swaggerTypes (dict): The key is attribute name and the value is attribute ... | sohail-aspose/Aspose_Pdf_Cloud | SDKs/Aspose.Pdf_Cloud_SDK_for_Python/asposepdfcloud/models/SplitResultResponse.py | Python | mit | 788 |
"""
HTTP server that responses with delays used for tests.
Example usage:
python tests/slow_server.py [HOST:PORT]
- run HTTP Server, HOST and PORT are optional
python tests/slow_server.py [HOST:PORT] True
- run IMMORTAL server (stopping process only by SIGKILL)
"""
import ast
import sys
im... | ClearcodeHQ/mirakuru | tests/server_for_tests.py | Python | lgpl-3.0 | 4,189 |
import argparse
import pandas
parser = argparse.ArgumentParser(description="Subsets a checkm tab-separated outfile to include only entries that have the specified completeness/contamination level")
parser.add_argument("-checkm", help="the checkm out file", required=True)
parser.add_argument("-completeness", help="com... | hunter-cameron/Bioinformatics | python/checkm_select_bins.py | Python | mit | 1,283 |
#!/usr/bin/python
# (C) Copyright 2004
# BEC Systems <http://bec-systems.com>
# Cliff Brake <cliff.brake@gmail.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 version 2 of
# the Li... | daydaygit/flrelse | uboot1.1.6/board/pxa255_idp/pxa_reg_calcs.py | Python | gpl-3.0 | 11,003 |
from __future__ import print_function, division, absolute_import
import functools
import os
import sys
import warnings
# ---------------------------------------------------------------------
# Simple File Read and Store Utilities
# ---------------------------------------------------------------------
def saveToFile(f... | sys-bio/tellurium | tellurium/utils/misc.py | Python | apache-2.0 | 9,311 |
import os
import requests
import tarfile
from zentral.utils.local_dir import get_and_create_local_dir
GITHUB_BEATS_RELEASES_URL = "https://api.github.com/repos/elastic/beats/releases"
FILEBEAT_RELEASE_NAME_TMPL = "filebeat-{version}-{platform}-x86_64"
FILEBEAT_DOWNLOAD_URL_TMPL = "https://artifacts.elastic.co/downloa... | zentralopensource/zentral | zentral/contrib/filebeat/filebeat_releases.py | Python | apache-2.0 | 1,484 |
#!/usr/bin/env python
# Copyright 2014 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.
"""A git command for managing a local cache of git repositories."""
from __future__ import print_function
import contextlib
import er... | CoherentLabs/depot_tools | git_cache.py | Python | bsd-3-clause | 31,704 |
##
# Copyright 2009-2021 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | akesandgren/easybuild-easyblocks | easybuild/easyblocks/x/xml.py | Python | gpl-2.0 | 2,135 |
# coding: utf-8
# Copyright 2017 video++ Project, SJTU MediaLab
#
# 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 appli... | ArthurChiao/videoplusplus | vpp/tracker/__init__.py | Python | apache-2.0 | 1,645 |
import re
from copy import copy
from datetime import datetime
from django.conf import settings
from django.contrib.sites.models import Site
from django.core import mail
from django.core.cache import cache
from django.test.client import RequestFactory
import bleach
import mock
import waffle
from nose.tools import eq_
... | orvi2014/kitsune | kitsune/wiki/tests/test_tasks.py | Python | bsd-3-clause | 7,075 |
# This file is part of the Indico plugins.
# Copyright (C) 2002 - 2022 CERN
#
# The Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License;
# see the LICENSE file for more details.
import math
from marshmallow import fields, pre_load
from indico.modules.se... | indico/indico-plugins | citadel/indico_citadel/result_schemas.py | Python | mit | 3,366 |
import pandas as pd
from featuretools.computational_backends import calculate_feature_matrix
from featuretools.entityset import EntitySet
from featuretools.synthesis.deep_feature_synthesis import DeepFeatureSynthesis
from featuretools.utils import entry_point
@entry_point('featuretools_dfs')
def dfs(entities=None,
... | Featuretools/featuretools | featuretools/synthesis/dfs.py | Python | bsd-3-clause | 13,558 |
# -*- coding: utf-8 -*-
#
# Telemetric documentation build configuration file, created by
# sphinx-quickstart on Tue Sep 4 14:21:46 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... | knipknap/telemetric | docs/conf.py | Python | mit | 9,676 |
""" Commerce API Service. """
from django.conf import settings
from edx_rest_api_client.client import EdxRestApiClient
from eventtracking import tracker
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
ECOMMERCE_DATE_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
def create_tracking_context(us... | Learningtribes/edx-platform | openedx/core/djangoapps/commerce/utils.py | Python | agpl-3.0 | 1,844 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dataproc | samples/generated_samples/dataproc_v1_generated_batch_controller_create_batch_sync.py | Python | apache-2.0 | 1,661 |
#!/usr/bin/env python
from __future__ import print_function
import emitter
class XMLEmitter(emitter.Emitter):
def preface(self):
return """<?xml version="1.0" encoding="utf-8"?>
<!-- Dynamically generated list of documented logfile messages (generated by parse.py) -->
<loggermessagefile>
"""
def post... | squilter/ardupilot | Tools/autotest/logger_metadata/emit_xml.py | Python | gpl-3.0 | 1,771 |
import datetime
from decimal import Decimal
import types
import six
def is_protected_type(obj):
"""Determine if the object instance is of a protected type.
Objects of protected types are preserved as-is when passed to
force_unicode(strings_only=True).
"""
return isinstance(obj, (
six.inte... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/external/org_mozilla_bleach/bleach/encoding.py | Python | bsd-2-clause | 2,277 |
import sys
import time
import asyncio
import getpass
import threading
from enum import Enum
try:
from socket import socketpair
except ImportError:
from asyncio.windows_utils import socketpair
from ..common import config
from ..common import utils
class ClientState(Enum):
Initial = 1
Handshake = 2
... | mavroskardia/ilovemymudder | mudder/src/client/client.py | Python | mit | 5,259 |
from PyQt4 import QtCore, QtGui
from m2 import *
class GSequEditor(QtGui.QDialog):
def __init__(self):
QtGui.QDialog.__init__(self)
self.setupUi(self)
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(540, 373)
self.textEdit = QtGui.QTextEdit(Dialog)
self.textEdit.setGeometry(... | GanjaNoel/pym2 | pymodeleditor/gsequedit.py | Python | lgpl-3.0 | 2,116 |
from Tkinter import *
from PIL import ImageTk
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import sys
import time
import serial
import matplotlib.pyplot as plt
__author__ = 'tjd08a'
# Using user given port, open a serial connection
port = None
testing = False
for arg in sys.argv:
port = arg
ser... | cspang1/4534-08 | src/supervisory/MS4/UI_Graph.py | Python | gpl-3.0 | 15,623 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
© Copyright 2015-2016, 3D Robotics.
mission_import_export.py:
This example demonstrates how to import and export files in the Waypoint file format
(http://qgroundcontrol.org/mavlink/waypoint_protocol#waypoint_file_format). The commands are imported
into a list, and ... | dronekit/dronekit-python | examples/mission_import_export/mission_import_export.py | Python | apache-2.0 | 5,616 |
import resources.requires as Rq
from resources.roots import PUBLIC_ROOT
def requires():
Rq.required('bootstrap','https://github.com/twbs/bootstrap/releases/download/v3.3.7/bootstrap-3.3.7-dist.zip',PUBLIC_ROOT)
Rq.required('jquery','https://code.jquery.com/jquery-3.2.1.js',PUBLIC_ROOT)
#more requires here
... | barjuegocreador93/pycab | pycabRequires.py | Python | gpl-3.0 | 391 |
from plugins import BasePlugin
from plugins import PluginsData
from etllib.conf import Conf
from etllib.db import DB
from etllib.metrics import Metrics
from etllib.json_helper import JSONHelper as jh
from operator import itemgetter
import json
import re
class Transformations:
def __init__(self, tr=[], first_fi... | gr33ndata/rivellino | plugins/jsonizer_plugin.py | Python | mit | 6,285 |
# coding=utf-8
import unittest
"""675. Cut Off Trees for Golf Event
https://leetcode.com/problems/cut-off-trees-for-golf-event/description/
You are asked to cut off trees in a forest for a golf event. The forest is
represented as a non-negative 2D map, in this map:
1. `0` represents the `obstacle` can't be reached... | openqt/algorithms | leetcode/python/lc675-cut-off-trees-for-golf-event.py | Python | gpl-3.0 | 1,872 |
import math
import time
t1 = time.time()
def f(x):
return math.floor(math.pow(2,30.403243784-x*x))/math.pow(10,9)
'''
a = -1
for i in range(2000):
a = f(a)
print(a)
'''
# E a,b that satisfy
# a = f(b)
# b = f(a)
N = int(math.pow(10,12))
t = [0,0]
fp = True
a = -1
for i in range(N):
a = f(a)
if ... | Adamssss/projectEuler | pb197.py | Python | mit | 519 |
"""Util function to baseline correct data
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import numpy as np
from .utils import logger, verbose
@verbose
def rescale(data, times, baseline, mode, verbose=None, copy=True):
"""Rescale aka baseline correct dat... | jaeilepp/eggie | mne/baseline.py | Python | bsd-2-clause | 2,975 |
import os
from typing import Dict, Optional, Tuple, List
import numpy as np
import tensorflow as tf
import nn_utils.math_utils as math_utils
from losses import multi_gpu_wrapper
from models.neural_pil.embd_store import EmbeddingStore
from models.neural_pil.models import CoarseModel, FineModel
from nn_utils.nerf_layer... | cgtuebingen/Neural-PIL | models/neural_pil/neural_pil_model.py | Python | mit | 25,376 |
'''
Create a PDF copy with split-up pages (posterize)
---------------------------------------------------
License: GNU GPL V3
(c) 2018 Jorj X. McKie
Usage
------
python posterize.py input.pdf
Result
-------
The file "poster-input.pdf" with 4 output pages for every input page:
top-lef, top-right, bottom-left, bottom-r... | JorjMcKie/PyMuPDF-Utilities | examples/posterize.py | Python | gpl-3.0 | 2,611 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | wscullin/spack | lib/spack/spack/test/cmd/find.py | Python | lgpl-2.1 | 3,356 |
# Copyright (C) 2007, Red Hat, Inc.
# Copyright (C) 2007, One Laptop Per Child
#
# 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 version 2 of the License, or
# (at your option) any later ... | tchx84/sugar | src/jarabe/frame/clipboardicon.py | Python | gpl-2.0 | 7,080 |
from django.contrib.syndication.views import Feed as BaseFeed
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
class GeoFeedMixin:
"""
This mixin provides the necessary routines for SyndicationFeed subclasses
to produce simple GeoRSS or W3C Geo elements.
"""
def georss_coords(self... | sametmax/Django--an-app-at-a-time | ignore_this_directory/django/contrib/gis/feeds.py | Python | mit | 5,732 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Zadara Storage Inc.
# Copyright (c) 2011 OpenStack LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ... | nii-cloud/dodai-compute | nova/vsa/connection.py | Python | apache-2.0 | 888 |
# 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/.
#
# Copyright (C) 2017, James R. Barlow (https://github.com/jbarlow83/)
"""
Support functions called by the C++ library ... | pikepdf/pikepdf | src/pikepdf/_cpphelpers.py | Python | mpl-2.0 | 3,084 |
import numpy as np
def median_absolute_deviation(x, M=None) :
if M is None:
M = np.median(x)
return np.median(abs(x - M))
def _biweight_location_work(x, M, MAD, c) :
u = (x-M) / (c*MAD)
w = abs(u) < 1.0
if w.sum() == 0.0:
return M
term = (1.0 - u[w]**2)**2
num = ((x[w]-M)*t... | jmeyers314/astrophotoreduce | biweight.py | Python | mit | 1,347 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.