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 |
|---|---|---|---|---|---|
# Copyright 2016 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | adelez/grpc | tools/buildgen/plugins/make_fuzzer_tests.py | Python | apache-2.0 | 1,629 |
# -*- coding: utf-8 -*-
'''
Copyright 2012-2018 HWM
This file is part of PorDB3.
PorDB3 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 o... | hwmay/pordb3 | pypordb_suche_video.py | Python | gpl-3.0 | 3,401 |
# Copyright 2020 kubeflow.org.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | kubeflow/kfserving-lts | python/kfserving/test/test_v1alpha2_py_torch_spec.py | Python | apache-2.0 | 1,454 |
import os.path
import paste.fileapp
from pylons.middleware import error_document_template, media_path
from ispmanccp.lib.base import *
class ErrorController(BaseController):
"""Generates error documents as and when they are required.
The ErrorDocuments middleware forwards to ErrorController when error
r... | UfSoft/ISPManCCP | ispmanccp/controllers/error.py | Python | bsd-3-clause | 1,348 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "impacta.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | SpaceTheArcher/TecWeb-TF | manage.py | Python | apache-2.0 | 805 |
# Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Abstract Base Classes (ABCs) according to PEP 3119."""
import types
from intessa.vendor.weakrefset import WeakSet
# Instance of old-style class
class _C: pass
_InstanceType = type(_C())
def abstractmethod(funcob... | pombredanne/intessa | lib/intessa/vendor/abc.py | Python | unlicense | 7,159 |
"""
Copyright © 2015 by Stefan Lehmann
"""
def nested_dict_from_list(parents, dict_={}):
if len(parents):
return {parents[0]: nested_dict_from_list(parents[1:], dict_)}
else:
return {}
def set_in_dict(data_dict, maplist, value):
for k in maplist[:-1]:
data_dict = data_dict[k]... | MrLeeh/jsonwatch | jsonwatch/abstractjsonitem.py | Python | mit | 1,678 |
"""
2.1.3.1: When rejected, a promise: must not transition to any other state.
https://github.com/promises-aplus/promises-tests/blob/2.1.1/lib/tests/2.1.3.js
"""
from sleekxmpp.test import SleekTest
import unittest
import threading
class Promise_2_1_3_TestCase(SleekTest):
dummy = {}
def setUp(self):
... | rerobins/rhobot_framework | test/components/scheduler/promises/test_2_1_3.py | Python | bsd-3-clause | 4,765 |
from gwpy.plot import Plot
plot = Plot()
ax = plot.gca(xscale='log', xlim=(10, 1500), xlabel='Frequency [Hz]',
yscale='log', ylim=(3e-24, 2e-20),
ylabel=r'Strain noise [1/$\sqrt{\mathrm{Hz}}$]')
ax.plot_mmm(median, low, high, color='gwpy:ligo-hanford')
ax.set_title('LIGO-Hanford strain noise... | gwpy/gwpy.github.io | docs/2.0.4/examples/frequencyseries/percentiles-4.py | Python | gpl-3.0 | 386 |
class RLPException(Exception):
"""Base class for exceptions raised by this package."""
pass
class EncodingError(RLPException):
"""Exception raised if encoding fails.
:ivar obj: the object that could not be encoded
"""
def __init__(self, message, obj):
super(EncodingError, self)._... | jnnk/pyrlp | rlp/exceptions.py | Python | mit | 1,211 |
# Copyright (c) 2018 PaddlePaddle 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 app... | QiJune/Paddle | python/paddle/fluid/tests/unittests/test_dynrnn_static_input.py | Python | apache-2.0 | 8,495 |
import pytz
from datetime import datetime
from django.utils.timezone import make_aware
from mock import patch
from nose.tools import eq_
from mozillians.announcements.templatetags.helpers import latest_announcement
from mozillians.announcements.tests import AnnouncementFactory, TestCase
class AnnouncementManagerTes... | akatsoulas/mozillians | mozillians/announcements/tests/test_helpers.py | Python | bsd-3-clause | 1,635 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import ownblock.apps.storage.models
class Migration(migrations.Migration):
dependencies = [
('storage', '0003_item_photo'),
]
operations = [
migrations.AlterField(
model_... | danjac/ownblock | ownblock/ownblock/apps/storage/migrations/0004_auto_20140911_0341.py | Python | mit | 493 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | google-research/google-research | tf3d/semantic_segmentation/metric.py | Python | apache-2.0 | 9,713 |
# -*- coding: utf-8 -*-
__author__ = 'zappyk'
from lib_zappyk._setup import _get_version
def the_version(version=None):
if version is None:
from SwitchOnOff import VERSION as version
return(_get_version(version))
| zappyk-github/zappyk-python | src/src_zappyk/switchOnOff/SwitchOnOff/src/version.py | Python | gpl-2.0 | 231 |
# Copyright (c) 2018 PaddlePaddle 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 app... | QiJune/Paddle | python/paddle/trainer_config_helpers/tests/configs/test_l2_distance_layer.py | Python | apache-2.0 | 797 |
from enigma import getPrevAsciiCode
from Tools.NumericalTextInput import NumericalTextInput
from Tools.Directories import resolveFilename, SCOPE_CONFIG, fileExists
from Components.Harddisk import harddiskmanager
from Tools.LoadPixmap import LoadPixmap
import copy
import os
from time import localtime, strftime
# Config... | Dima73/enigma2 | lib/python/Components/config.py | Python | gpl-2.0 | 54,274 |
#!/usr/bin/python
#----------------------------------------------------------------------
# This module is designed to live inside the "lldb" python package
# in the "lldb.macosx" package. To use this in the embedded python
# interpreter using "lldb" just import it:
#
# (lldb) script import lldb.macosx.heap
#-------... | apple/swift-lldb | examples/darwin/heap_find/heap.py | Python | apache-2.0 | 61,389 |
# -*- Mode:python; coding: utf-8; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
# Copyright (C) 2016 Endless Mobile, Inc.
# Author: Niv Sardi <xaiki@endlessm.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# ... | endlessm/endless-ndn | eos_data_distribution/names.py | Python | lgpl-3.0 | 2,421 |
import os
import glob
from setuptools import setup
from setuptools.command.install import install
def post_install(install_path):
"""
Post install script for pyCUDA applications to warm the cubin cache
"""
import pycuda.autoinit
from pycuda.compiler import SourceModule
CACHE_DIR = os.path.join(... | Captricity/sciguppy | setup.py | Python | mit | 1,576 |
# 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/.
from webapi_tests import MinimalTestCase
from webapi_tests import ContactsTestCommon
class TestDeleteContact(MinimalTe... | cr/fxos-certsuite | webapi_tests/wip/contacts/test_delete_contact.py | Python | mpl-2.0 | 771 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-22 22:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('halfwayapp', '0002_auto_20160222_2249'),
]
operatio... | cszc/meethalfway | djangohalfway/halfwayapp/migrations/0003_auto_20160222_2252.py | Python | apache-2.0 | 581 |
from api import *
from dynamicformat import *
from json_response import *
from response import *
from views import *
| funkbit/django-dynamicresponse | examples/myblog/blog/tests/__init__.py | Python | bsd-2-clause | 117 |
"""
Hamiltonian
====================
Set the parameters of the Heisenberg Hamiltonian, such as external field or exchange interaction.
"""
import spirit.spiritlib as spiritlib
import ctypes
### Load Library
_spirit = spiritlib.load_spirit_library()
### DM vector chirality
CHIRALITY_BLOCH = 1
"""DMI Bloch c... | spirit-code/spirit | core/python/spirit/hamiltonian.py | Python | mit | 7,910 |
# -*- coding: utf-8 -*-
__author__ = 'Pascal Mouret'
__version__ = '0.4a.1' | pascalmouret/djangocms-social | djangocms_social/__init__.py | Python | bsd-3-clause | 75 |
# -*- coding: utf-8 -*-
# Build configuration file.
# 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.
# All configuration values have a default; values that are commented out
# serve to show the ... | a25kk/eda | docs/conf.py | Python | mit | 5,991 |
import argparse
from pathlib import Path
from unittest import mock
import json
import os
import io
from urllib.request import urlopen
import pytest
import requests
import responses
from httpie.cli.argtypes import (
PARSED_DEFAULT_FORMAT_OPTIONS,
parse_format_options,
)
from httpie.cli.definition import parse... | jakubroztocil/httpie | tests/test_output.py | Python | bsd-3-clause | 18,705 |
# 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/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_dns_aliases_operations.py | Python | mit | 24,235 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time, datetime, random, json, re, os
from flask import request, redirect, render_template, url_for, abort, flash, g, current_app, send_from_directory
from flask.views import MethodView
from flask_login import current_user, login_required
import dateutil.par... | shawnlinq/SlqBlog2 | main/admin_views.py | Python | gpl-2.0 | 20,441 |
"""
Tests get_user()
"""
import unittest
from algolia import HackerNews
from algolia import User
class TestGetUser(unittest.TestCase):
def setUp(self):
self.hn = HackerNews()
def test_get_item(self):
user = self.hn.get_user('epaga')
self.assertIsInstance(user, User)
self.as... | xbabinec/pyhnalgolia | algolia/tests/test_get_user.py | Python | mit | 403 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'BIOMD0000000489.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/BIOMD0000000489 | BIOMD0000000489/model.py | Python | cc0-1.0 | 427 |
#!/usr/bin/python2
# This is an Adaboost classifier
import sys
from util import get_split_training_dataset
from metrics import suite
import feature_selection_trees as fclassify
from sklearn.grid_search import GridSearchCV
from sklearn.ensemble import AdaBoostClassifier
from sklearn.tree import DecisionTreeClassifi... | bravelittlescientist/kdd-particle-physics-ml-fall13 | src/adaboost.py | Python | gpl-2.0 | 1,625 |
import dask
from dask.local import start_state_from_dask, get_sync, finish_task, sortkey
from dask.order import order
from dask.utils_test import GetFunctionTestMixin, inc, add
fib_dask = {"f0": 0, "f1": 1, "f2": 1, "f3": 2, "f4": 3, "f5": 5, "f6": 8}
def test_start_state():
dsk = {"x": 1, "y": 2, "z": (inc, "... | ContinuumIO/dask | dask/tests/test_local.py | Python | bsd-3-clause | 4,604 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------
# Copyright (c) 2009-2019 Jendrik Seipp
#
# RedNotebook 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... | jendrikseipp/rednotebook | setup.py | Python | gpl-2.0 | 4,992 |
import re
import numpy as np
import pytest
import tensorflow as tf
import tensorflow_addons as tfa
def get_data_and_model():
x = np.random.random((12, 1))
y = np.random.randint(0, 2, (12, 1), dtype=np.int)
inputs = tf.keras.layers.Input(shape=(1,))
outputs = tf.keras.layers.Dense(1)(inputs)
mod... | tensorflow/addons | tensorflow_addons/callbacks/tests/tqdm_progress_bar_test.py | Python | apache-2.0 | 4,441 |
from .insult import *
| MWisBest/PyBot | Commands/insult/__init__.py | Python | gpl-3.0 | 22 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import time
import multiprocessing
# import concurrent.futures
import tqueue
from utils import logger
class Worker(object):
"""Use `concurrent.futures` provides asynchronous execution.
"""
MAX_WORKERS = multiprocessing.cpu_coun... | Damnever/Chat-Room | taskq/worker.py | Python | bsd-3-clause | 4,001 |
# 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/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_groups_operations.py | Python | mit | 24,426 |
import tornado
from oauth2client.client import OAuth2WebServerFlow
import app.objects
class GoogleOAuth2LoginHandler(tornado.web.RequestHandler,
tornado.auth.GoogleOAuth2Mixin):
@tornado.gen.coroutine
def get(self):
# check if user is already logged in
user = s... | bradleygolden/gmail-image-extractor | app/handlers/google_oauth.py | Python | mit | 1,479 |
# This file is part of MyPaint.
# Copyright (C) 2013 by Andrew Chadwick <a.t.chadwick@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 License, or
"""Color ... | dothiko/mypaint | gui/colorpreview.py | Python | gpl-2.0 | 2,370 |
import gevent
import time
class Noparallel(object): # Only allow function running once in same time
def __init__(self, blocking=True):
self.threads = {}
self.blocking = blocking # Blocking: Acts like normal function else thread returned
def __call__(self, func):
def wrapper(*args, ... | andrewrawding/ZeroNet | src/util/Noparallel.py | Python | gpl-2.0 | 4,225 |
#------------------------------------------------------------------------------
# Copyright (C) 2009 Richard Lincoln
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation; version 2 dated June... | rwl/openpowersystem | cdpsm/iec61970/wires/disconnector.py | Python | agpl-3.0 | 1,912 |
import sys
import unittest
import tempfile
import subprocess
import os
import re
import glob
import testenv
class StarlarkTest(unittest.TestCase):
CHUNK_SEP = "---"
seen_error = False
def chunks(self, path):
code = []
expected_errors = []
# Current line no
line_no = 0
# Current test first l... | bazelbuild/starlark | test_suite/starlark_test.py | Python | apache-2.0 | 3,129 |
#
# (c) 2016 Red Hat Inc.
#
# 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 d... | j00bar/ansible | lib/ansible/plugins/action/vyos.py | Python | gpl-3.0 | 4,467 |
"""Test the cross_validation module"""
from __future__ import division
import warnings
import numpy as np
from scipy.sparse import coo_matrix
from scipy import stats
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_equal
from sklearn... | schets/scikit-learn | sklearn/tests/test_cross_validation.py | Python | bsd-3-clause | 40,182 |
# node.py - basic nodeid manipulation for mercurial
#
# Copyright 2005, 2006 Olivia Mackall <olivia@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
import binascii
# This ugly ... | smmribeiro/intellij-community | plugins/hg4idea/testData/bin/mercurial/node.py | Python | apache-2.0 | 2,117 |
# coding=utf-8
from __future__ import unicode_literals
from .. import Provider as CompanyProvider
class Provider(CompanyProvider):
formats = (
'{{last_name}} {{company_suffix}}',
'{{last_name}} {{last_name}} {{company_suffix}}',
'{{last_name}}',
'{{last_name}}',
)
catch_ph... | deanishe/alfred-fakeum | src/libs/faker/providers/company/pt_PT/__init__.py | Python | mit | 1,191 |
"""Tests for the WLED button platform."""
from unittest.mock import MagicMock
from freezegun import freeze_time
import pytest
from wled import WLEDConnectionError, WLEDError
from homeassistant.components.button import (
DOMAIN as BUTTON_DOMAIN,
SERVICE_PRESS,
ButtonDeviceClass,
)
from homeassistant.const ... | home-assistant/home-assistant | tests/components/wled/test_button.py | Python | apache-2.0 | 5,930 |
"""Create and send messages to users
"""
import logging
import os
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from pyramid.settings import asbool
LOG = logging.getLogger(__name__)
# notification statuses
# might have pending, sent, failed
MSG_STATUS = {
'pe... | ojengwa/Bookie | bookie/lib/message.py | Python | agpl-3.0 | 6,762 |
"""
Plugin for probing SMB
"""
from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = " SMB Probing "
def run(PluginInfo):
resource = get_resources("SmbProbeMethods")
return plugin_helper.CommandDump("Test Command", "Output", resource, PluginInfo, [])
| owtf/owtf | owtf/plugins/network/active/smb@PTES-009.py | Python | bsd-3-clause | 316 |
from openalpr import Alpr
| peters/openalpr | src/bindings/python/openalpr/__init__.py | Python | agpl-3.0 | 26 |
import django
try:
from formtools.wizard.forms import ManagementForm
from formtools.wizard.views import WizardView
from formtools.wizard.views import SessionWizardView
from formtools.wizard.storage.session import SessionStorage
except ImportError:
from django.contrib.formtools.wizard.forms import M... | fusionbox/django-two-factor-auth | two_factor/compat.py | Python | mit | 7,716 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import Abstra... | Uran198/med | med/users/models.py | Python | bsd-3-clause | 954 |
#!/usr/bin/env python3
import unittest
def main(): # pragma: no cover
testsuite = unittest.TestLoader().discover('tests/')
results = unittest.TextTestRunner(verbosity=1).run(testsuite)
if results.errors or results.failures:
exit(1)
else:
exit(0)
if __name__ == '__main__':
main()
... | s-i-newton/clang-hook | run_tests.py | Python | apache-2.0 | 321 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, division
import functools
import glob
import os
import os.path
import sys
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from test_manager import *
from ff import plugin
T... | msztolcman/ff | test/test_ffplugins.py | Python | mit | 6,523 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
SuroLeveling
A QGIS plugin
todo
-------------------
begin : 2016-02-12
git sha : $Format:%H$
copyr... | ctu-osgeorel-proj/bp-pesek-2016 | src/position_correction.py | Python | gpl-2.0 | 7,629 |
from django.http import HttpResponse
from async_notifications.register import update_template_context
from async_notifications.utils import send_email_from_template
context = [
('fieldname', 'Field description'),
('fieldname2', 'Field description'),
]
update_template_context("yourcode", 'your email subject',... | luisza/async_notifications | demo/views.py | Python | gpl-2.0 | 768 |
#!/usr/bin/env python
import numpy as np
import sys
def similar(a, b):
similarity = len(a.intersection(b))/(1.0 * len(a.union(b)))
return similarity >= 0.85
def print_duplicates(videos, shingles_map):
unique = np.unique(videos)
for i in xrange(len(unique)):
for j in xrange(i + 1, len(unique... | bvancea/data-mining-project-2014 | lsh/code/reducer_template.py | Python | gpl-3.0 | 1,221 |
"""
:file: scalars.py.
Contains various primitive type formatters.
:date: 27/08/2015
:authors:
- Gilad Naaman <gilad@naaman.io>
"""
from .base import *
import struct
class ScalarMetadata(SerializerMetadata):
__slots__ = ('endianness', 'fmt', 'validator', 'py_types')
_FORMATTERS_INFO = {
'B': (... | Gilnaa/Hydra | hydras/scalars.py | Python | mit | 8,022 |
import os
import datetime
import time
IDLE_TIME = 2 * 60
STRESS_ITERATION_TIME = 10 * 60
STRESS_LEVELS = [2,10,25,50,75,100]
# ENDPOINTS = ["http://10.102.44.201/index.php/Special:Random", "http://10.102.44.202/index.php/Special:Random", "http://10.102.44.203/index.php/Special:Random"]
def do_stress():
print("... | skonefal/workloadsutils | ab_util.py | Python | apache-2.0 | 972 |
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | Princessgladys/googleresourcefinder | app/subscribe_test.py | Python | apache-2.0 | 18,058 |
#!/usr/bin/env python3
import argparse
import pathlib
import re
import shlex
import subprocess
import sys
VARS = ['cflags', 'ldflags', 'libs']
ENV = {
'cflags': '-std=c90 -D_POSIX_C_SOURCE=200809L -D_FILE_OFFSET_BITS=64',
}
CONFIGS = {
'debug': {
'cflags': '-g',
},
'release': {
'cflag... | depp/unrez | gen.py | Python | mit | 5,478 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# Page generator configuration
PATH = 'content'
LOCALE = 'C'
DEFAULT_LANG = 'EN'
DEFAULT_DATE_FORMAT = '%Y-%m-%d'
# Special paths inside content/
ARTICLE_PATHS = [
'posts',
]
STATIC_PATHS = [
'images',
'static',
... | sio/potyarkin.ml | pelicanconf.py | Python | apache-2.0 | 2,803 |
'''This script allows to perform a "grep" command that will be applied on files
content.xml and styles.xml within all ODF files (odt and ods) found within a
given folder.'''
# ------------------------------------------------------------------------------
import sys, os.path, zipfile, time, subprocess
from appy.s... | Eveler/libs | __Python__/ufms_blanks/appy3/bin/odfgrep.py | Python | gpl-3.0 | 3,106 |
# Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | crosswalk-project/crosswalk-android-extensions | build/idl-generator/third_party/WebKit/Tools/Scripts/webkitpy/bindings/main.py | Python | bsd-3-clause | 10,203 |
import fileinput
discs = []
for line in fileinput.input():
line = line[:-2].split()
discs.append((int(line[3]), int(line[-1])))
starttime = 0
while True:
passed = True
time = starttime + 1
for disc in discs:
if (disc[1] + time) % disc[0] != 0:
passed = False
break
... | zigapk/adventofcode | 2016/day_15/15-1.py | Python | mit | 412 |
import sys
import warnings
from logging import getLogger
from django.core.exceptions import ImproperlyConfigured, MiddlewareNotUsed
from threading import local
from careful_forms.conf import settings
log = getLogger(__name__)
_secure_form_storage = local()
class SecurityWarning(RuntimeWarning):
pass
def regis... | ulope/django-careful-forms | careful_forms/middleware.py | Python | mit | 3,033 |
import json
import pickle
from os import makedirs, rename, remove
from os.path import isfile, join
from typing import List, Optional, Any
from keras import Model
from acquisition.item import Item
from acquisition.items import Items
from acquisition.ebay_shopping_api import EbayShoppingAPI
from category import Categor... | lene/style-scout | acquisition/ebay_downloader_io.py | Python | bsd-3-clause | 6,697 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os.path
import sqlite3
import constants
import time
class Database():
def __init__(self):
self.book_list = []
if os.path.isfile(constants.DB_NAME):
print("Found database: " + constants.DB_NAME)
self.conn = sqlite3.connect(... | maxiee/ReadingTrack | database.py | Python | gpl-2.0 | 2,436 |
#-------------------------------------------------------------------------------
# Name: Settings
# Purpose: Contains the settings for the application and threads
#
# TODO: Move the reading of config xml into this file
# Move some setting into external xml file
# Move the config files to ~/.flannelfox
#------------... | FlannelFox/FlannelFox | flannelfox/datasources/common.py | Python | mit | 4,132 |
# coding=utf-8
# This file is part of SickRage.
#
# URL: https://sickrage.github.io
# Git: https://github.com/SickRage/SickRage.git
#
# 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... | b0ttl3z/SickRage | sickrage/system/Restart.py | Python | gpl-3.0 | 1,104 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-11-19 17:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('testproject', '0001_initial'),
]
operations = [
migrations.AddField(
... | vittoriozamboni/django-groups-manager | testproject/testproject/migrations/0002_organizationgroupmemberwithmixin_expiration_date.py | Python | mit | 488 |
#!/usr/bin/python
# ---------------------------------
# This is the configuration file used by the Syndicate observer.
# It is a well-formed Python file, and will be imported into the
# observer as a Python module. This means you can run any config-
# generation code here you like, but all of the following global
# ... | jcnelson/syndicate | opencloud/syndicate_observer/syndicatelib_config/config-opencloud.py | Python | apache-2.0 | 3,710 |
#!/usr/bin/env python2
desc="""Filter QSEQ/FastQ reads. Store output as FastQ.
Reads are clipped at first undetermined base (. in qseq or N in fastq)
and at first base having qual below -q.
Reads (and their pairs if -p) not passing filtering are discarded.
Orphaned reads may be store optionally (-u).
"""
epilog="""Auth... | lpryszcz/bin | filterReads.new.py | Python | gpl-3.0 | 19,083 |
import os
from pybuilder.core import use_plugin, init
from pybuilder.vcs import VCSRevision
use_plugin("python.core")
use_plugin("python.unittest")
use_plugin("python.install_dependencies")
use_plugin("python.flake8")
use_plugin("python.coverage")
use_plugin("python.distutils")
use_plugin("python.integrationtest")
u... | ImmobilienScout24/spotnik | build.py | Python | apache-2.0 | 1,557 |
import logging
from fsgamesys.input.inputservice import (
GamepadConnectedEvent,
GamepadDisconnectedEvent,
JoystickConnectedEvent,
JoystickDisconnectedEvent,
useInputService,
)
from launcher.fswidgets2.flexcontainer import FlexContainer
from launcher.fswidgets2.panel import Panel
from launcher.fswi... | FrodeSolheim/fs-uae-launcher | launcher/controllertest/ControllerTestWindow.py | Python | gpl-2.0 | 2,019 |
#
# Copyright 2013 Quantopian, 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 wr... | erikness/AlephOne | zipline/finance/performance/tracker.py | Python | apache-2.0 | 19,446 |
import unittest
from nose.tools import assert_true, assert_equal
from mock import patch, Mock, call
from tests import tmp_repo_path
class TestAdd(unittest.TestCase):
def test_file_names_no_dot(self):
from dvm import add
link, filename = add.file_names('bashrc')
assert_equal(link, '.b... | boldfield/dvm | tests/test_add.py | Python | mit | 591 |
# -*- coding: utf-8 -*-
__version__ = '1.1.0'
default_app_config = 'ipware.apps.AppConfig'
| devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/ipware/__init__.py | Python | agpl-3.0 | 93 |
"""Container traversing tests."""
from dependency_injector import containers, providers
class Container(containers.DeclarativeContainer):
obj_factory = providers.DelegatedFactory(
dict,
foo=providers.Resource(
dict,
foo="bar"
),
bar=providers.Resource(
... | ets-labs/python-dependency-injector | tests/unit/containers/test_traversal_py3.py | Python | bsd-3-clause | 1,606 |
# Copyright (C) 2017 Paulo V. C. Medeiros
# Defaults used by the Python interface to BandUP
# This file is part of BandUP: Band Unfolding code for Plane-wave based calculations.
#
# BandUP is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# th... | paulovcmedeiros/band_unfolding | src/python_interface/bandupy/defaults.py | Python | gpl-3.0 | 2,350 |
import os
import requests
from .errors import ImproperConfigurationError
from .settings import config
class Github(object):
DOMAIN = 'https://api.github.com'
@property
def token(self):
return os.environ.get('GH_TOKEN')
@staticmethod
def check_build_status(owner, repo, ref):
url... | riddlesio/python-semantic-release | semantic_release/hvcs.py | Python | mit | 3,425 |
# -*- coding: utf-8 -*-
mapping = (
"avgdeziklmnxoprstyfAVGDEZIKLMNXOPRSTYF",
"αβγδεζικλμνξοπρστυφΑΒΓΔΕΖΙΚΛΜΝΞΟΠΡΣΤΥΦ",
)
reversed_specific_mapping = (
"ςάέήίύόώϊϋΐΰωΩηΗϵϱ",
"saeiiyooiyiyooiier"
)
pre_processor_mapping = {
"th": "ϑ",
"Th": "θ",
"ch": "χ",
"Ch": "Χ",
"ps": "ψ",
"... | akosiaris/transliterate | src/transliterate/contrib/languages/el/data/python32.py | Python | gpl-2.0 | 1,012 |
import logging
import sh, os, subprocess
import json
import StringIO
import traceback
import sys
import PblAnalytics
from PblCommand import PblCommand
from PblProjectCreator import requires_project_dir
from LibPebblesCommand import (NoCompilerException, BuildErrorException,
AppTooBigExc... | Hexxeh/libpebble | pebble/PblBuildCommand.py | Python | mit | 10,418 |
import os
import numpy as np
import pandas as pd
from glob import glob
if not os.path.exists('data'):
os.mkdir('data')
def random_array():
if os.path.exists(os.path.join('data', 'random.hdf5')):
return
print("Create random data for array exercise")
import h5py
with h5py.File(os.path.jo... | cloudmesh/book | notebooks/dask/generate-data.py | Python | apache-2.0 | 2,440 |
# -*- coding: utf-8 -*-
#
# costcla documentation build configuration file, created by
# sphinx-quickstart on Sat Sep 20 22:22:40 2014.
#
# 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.
#
# A... | madjelan/CostSensitiveClassification | doc/conf.py | Python | bsd-3-clause | 10,378 |
# -*- coding: utf-8 -*-
import time
import requests
msg = ["早报信息", "晚报信息","日报20130102" ,"日报"]
for m in msg:
#print len(m)
#print m[:4]
pass
r = requests.get('http://127.0.0.1:6226/api/weixin?echostr=echoabc&signature=165082e67e721b63529b73428d8f304152e3ecd3×tamp=b&nonce=a')
#print dir(r)
pr... | mabotech/maboss.py | maboss/webx/addons/mobility/test/web_client01.py | Python | mit | 1,479 |
#!/usr/bin/python
import sys
import os.path
import binascii
def str2ul(my_str):
if my_str.startswith('0x'): return int(my_str[2:],16)
elif my_str.startswith('0b'): return int(my_str[2:],2)
else : return int(my_str[0:],10)
# command-line arguments
# python $RSV_HOME/scripts/rsv... | tectronics/resim-simulating-partial-reconfiguration | scripts/rsvsbt_memory.py | Python | bsd-3-clause | 2,971 |
# coding: utf-8
class User:
"""Represents a Twitter user"""
def __init__(self,
id,
screen_name,
favourites_count,
followers_count,
friends_count,
statuses_count,
verified):
self.id = ... | Rolinh/tweetmining | src/twitter/user.py | Python | bsd-3-clause | 1,880 |
refresh_token = '1/Ev_pCoT**************************loWIxAco'
client_secret = 'GYJ_q**********JNH0ppT'
client_id = '142317537518-las**************************0hh8.apps.googleusercontent.com'
#
key_ring = {}
key_ring['grant_type'] = 'refresh_token'
key_ring['refresh_token'] = refresh_token
key_ring['client_secret'] = cl... | zhaohuaw/GData_OpenERP_Data_Pump | creds_oa.example.py | Python | agpl-3.0 | 560 |
class Persona:
def __init__(self):
self.nome = 'Mario'
self.cognome = 'Rossi'
if __name__ == '__main__':
pika = Persona()
print (pika.nome, pika.cognome)
| localcore/Personal-Works | main.py | Python | gpl-2.0 | 161 |
import os.path
import subprocess
import sys
import reindent
def status(message, modal=False, info=None):
"""Decorator to output status info to stdout."""
def decorated_fxn(fxn):
def call_fxn(*args, **kwargs):
sys.stdout.write(message + ' ... ')
sys.stdout.flush()
r... | leighpauls/k2cro4 | third_party/python_26/Tools/scripts/patchcheck.py | Python | bsd-3-clause | 2,644 |
class ResourceServiceParameter(object):
'''
When true, all nested resources will be given as full descriptors. The default
behavior, false, has all nested resources given as references. For more
information, see Local Resources.
Type/Value: true|false
'''
EXPANDED = "expanded"
'''
B... | saguas/jasperserverlib | jasperserverlib/core/resource_service_param.py | Python | mit | 838 |
from .baselang import BaseLang
class DevanagariUnicode(BaseLang):
def __init__(self):
BaseLang.__init__(self)
self.tokendict = { \
'CHANDRABINDU': '\u0901', \
'BINDU' : '\u0902', \
'VISARGA' : '\u0903', \
# PUNCTUATIONS \
'STAR'... | sushant354/indic2unicode | langs/devanagari.py | Python | gpl-3.0 | 18,196 |
# -*- coding: utf-8 -*-
from . import deposit_slip
| OCA/carrier-delivery | delivery_carrier_deposit/models/__init__.py | Python | agpl-3.0 | 52 |
# importing libraries:
from maya import cmds
from . import dpBaseControlClass
from importlib import reload
reload(dpBaseControlClass)
# global variables to this module:
CLASS_NAME = "SquashTop"
TITLE = "m121_squashTop"
DESCRIPTION = "m099_cvControlDesc"
ICON = "/Icons/dp_squashTop.png"
dpSquashTopVersion = 1.2
c... | nilouco/dpAutoRigSystem | dpAutoRigSystem/Controls/dpSquashTop.py | Python | gpl-2.0 | 2,378 |
import tempfile
import rdflib
from pathlib import Path
def test_reading_from_path_object():
xml_sample = """\
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:cim="http://iec.ch/TC57/2013/CIM-schema-cim16#"
xmlns:cyme="http://www.cyme.com/CIM/1.0.2#"
xmlns:rdf="http://www.w3.org/1999/02/22-... | RDFLib/rdflib | test/test_parser_reads_from_pathlike_object.py | Python | bsd-3-clause | 899 |
# -*- coding: utf-8 -*-
import os
import time
from apps.webdriver_testing.webdriver_base import WebdriverTestCase
from apps.webdriver_testing.data_factories import UserFactory
from apps.webdriver_testing.data_factories import TeamMemberFactory
from apps.webdriver_testing.data_factories import TeamVideoFactory
from ap... | ujdhesa/unisubs | apps/webdriver_testing/check_api_v2/test_activity_resource.py | Python | agpl-3.0 | 3,662 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 zip76 <zip76@BugMachine2>
#
# Distributed under terms of the MIT license.
"""
Homography tester
"""
import numpy as np
b = np.array([100, 12, 1, 0]);
a = np.array([[194.553,1.40942,-22358.4,0],
[-2.78234,199.262,-5346.0... | tlgimenes/GPUImageSweep | helpers/homography.py | Python | gpl-2.0 | 1,443 |
#!/usr/bin/python
# Copyright (c) 2009 David Roberts <d@vidr.cc>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... | davidar/subleq | util/sq2js.py | Python | mit | 1,476 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.