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 |
|---|---|---|---|---|---|
import os
UPPERLETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
LETTERS_AND_SPACE = UPPERLETTERS + UPPERLETTERS.lower() + " \t\n"
def loadDictionary():
path = os.path.split(os.path.realpath(__file__))
englishWords = {}
with open(path[0] + "/dictionary.txt") as dictionaryFile:
for word in dictionaryFile.rea... | TheAlgorithms/Python | strings/detecting_english_programmatically.py | Python | mit | 1,495 |
import argparse
import csv
import logging
import math
import os
from datetime import date
import numpy
import pandas
from statsmodels.formula.api import OLS
from matplotlib import pyplot
from btplatform import PositionAdjuster, process_strategy, BacktestHistory
from meanrevert import MeanReversionStrategy, PortfolioD... | chris-ch/omarket | python-lab/backtest.py | Python | apache-2.0 | 15,929 |
from pyfunk.monads import Monad
class Identity(Monad):
pass
| danceasarxx/pyfunk | pyfunk/monads/identity.py | Python | gpl-3.0 | 66 |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 lambda
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
(at your option) any l... | viranch/exodus | resources/lib/sources/torba.py | Python | gpl-3.0 | 6,763 |
# -*- coding: iso-8859-1 -*-
#
# Copyright (C) 2001 - 2020 Massimo Gerardi all rights reserved.
#
# Author: Massimo Gerardi massimo.gerardi@gmail.com
#
# Copyright (c) 2020 Qsistemi.com. All rights reserved.
#
# Viale Giorgio Ribotta, 11 (Roma)
# 00144 Roma (RM) - Italy
# Phone: (+39) 06.87.163
#
#
# Si veda ... | phasis/phasis | phasis/finc/oc.py | Python | gpl-2.0 | 10,870 |
#!/usr/bin/python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the follo... | KaSt/ekwicoin | contrib/devtools/update-translations.py | Python | mit | 2,335 |
"""
python version compatibility code
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import codecs
import functools
import inspect
import re
import sys
from contextlib import contextmanager
import py
import six
from six import text_type
import _pytest... | txomon/pytest | src/_pytest/compat.py | Python | mit | 13,160 |
import uuid
from django.core.management import call_command
from oscar.core.loading import get_model
from testfixtures import LogCapture
from ecommerce.coupons.tests.mixins import CouponMixin
from ecommerce.tests.testcases import TestCase
Product = get_model('catalogue', 'Product')
LOGGER_NAME = 'ecommerce.extensi... | edx/ecommerce | ecommerce/extensions/catalogue/management/commands/tests/test_populate_enterprise_id_product_attribute.py | Python | agpl-3.0 | 4,461 |
##############################################################################
# Copyright (c) 2013-2018, 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... | mfherbst/spack | lib/spack/spack/patch.py | Python | lgpl-2.1 | 7,695 |
# -*- coding: utf-8 -*-
import pytest
import env # noqa: F401
from pybind11_tests import ConstructorStats
from pybind11_tests import multiple_inheritance as m
def test_multiple_inheritance_cpp():
mt = m.MIType(3, 4)
assert mt.foo() == 3
assert mt.bar() == 4
@pytest.mark.skipif("env.PYPY and env.PY2"... | YannickJadoul/Parselmouth | pybind11/tests/test_multiple_inheritance.py | Python | gpl-3.0 | 9,495 |
import datetime
import itertools
import logging
import re
import time
from hashlib import sha1
from typing import List
import warnings
warnings.filterwarnings('ignore', category=DeprecationWarning, module='newrelic')
import newrelic.agent
from django.contrib.auth.models import User
from django.core.cache import cach... | jmaher/treeherder | treeherder/model/models.py | Python | mpl-2.0 | 51,534 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.execute(
"update physical_script set metric_collector = 'metric_co... | globocom/database-as-a-service | dbaas/physical/migrations/0068_update_physical_script.py | Python | bsd-3-clause | 21,797 |
import re
from pyramid.view import view_config
from contentbase import (
Collection,
TYPES,
collection_view_listing_db,
)
from contentbase.elasticsearch import ELASTIC_SEARCH
from pyramid.security import effective_principals
from urllib.parse import urlencode
from collections import OrderedDict
def includ... | ClinGen/clincoded | src/clincoded/search.py | Python | mit | 15,299 |
"""
This config file runs the simplest dev environment"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=W0401, W0614
from .common import *
from logsettings import get_logger_config
DEBUG = True
TEMPLATE_DEBUG = DEBUG
LOGGIN... | XiaodunServerGroup/xiaodun-platform | cms/envs/dev.py | Python | agpl-3.0 | 6,564 |
"""
Helper functions for loading environment settings.
"""
from __future__ import print_function
import os
import sys
import json
from lazy import lazy
from path import path
import memcache
class Env(object):
"""
Load information about the execution environment.
"""
# Root of the git repository (edx-... | htzy/bigfour | pavelib/utils/envs.py | Python | agpl-3.0 | 6,325 |
# coding: utf-8
try:
from django.conf.urls import patterns, url, include
except ImportError:
from django.conf.urls.defaults import patterns, url, include
from django.http import HttpResponse
def dummy(request):
return HttpResponse()
urlpatterns = patterns('',
url('^api/.+/$', dummy, name='dummy'),
... | anmekin/django-httplog | test_app/urls.py | Python | bsd-3-clause | 405 |
from __future__ import absolute_import, unicode_literals
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app # noqa
# NOTE: Version must be updated in docs/source/conf.py as well.
VERSION = (1, 4, 2, "final")
def get_ve... | xkmato/tracpro | tracpro/__init__.py | Python | bsd-3-clause | 948 |
########
# Copyright (c) 2013 GigaSpaces Technologies Ltd. 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... | isaac-s/cloudify-manager | tests/integration_tests/tests/agentless_tests/scale/test_scale_in.py | Python | apache-2.0 | 9,915 |
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko 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 License,... | hipnusleo/laserjet | resource/pypi/paramiko-2.1.1/paramiko/packet.py | Python | apache-2.0 | 19,925 |
# This source file is part of Soundcloud-syncer.
#
# Soundcloud-syncer 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.
#
# Soundcloud-s... | Sliim/soundcloud-syncer | tests/ssyncer/test_suser.py | Python | gpl-3.0 | 3,772 |
# Copyright 2012 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 requ... | tudorvio/tempest | tempest/api/compute/servers/test_list_server_filters.py | Python | apache-2.0 | 14,862 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
from file import File
from folder import Folder
from music_file import MusicFile
class FolderList(list):
def __init__(self, path, recurse=False, hidden=False, show_folders=False):
# Ensure unicode
self.__path = unicode(path)
# Save... | Saevon/Recipes | folder_list/folder_list.py | Python | mit | 2,012 |
"""Provide the RedditorList class."""
from .base import BaseList
class RedditorList(BaseList):
"""A list of Redditors. Works just like a regular list."""
CHILD_ATTRIBUTE = "children"
| gschizas/praw | praw/models/list/redditor.py | Python | bsd-2-clause | 194 |
# coding: utf-8
from django import forms
from django.contrib.auth import authenticate
from forum.models import ForumUser
from django.conf import settings
error_messages = {
'username':{
'required': u'必须填写用户名',
'min_length': u'用户名长度过短 (3-12字符)',
'max_length': u'用户名长度过长(3-12个字符)',
'invalid': u'用户名格式错误(英文字母开头,数字... | Liubusy/V2GO | forum/forms/user.py | Python | mit | 3,044 |
import re
import sys
import copy
from .import RefinerUtils
from pandajedi.jedicore import Interaction
from .TaskRefinerBase import TaskRefinerBase
from pandajedi.jedicore.JediTaskSpec import JediTaskSpec
from pandajedi.jedicore.JediDatasetSpec import JediDatasetSpec
# refiner for lost file recovery
class FileRecovery... | PanDAWMS/panda-jedi | pandajedi/jedirefine/FileRecovery.py | Python | apache-2.0 | 14,043 |
import os
import hashlib
import yaml
import sys
import json
import click
from prettytable import PrettyTable
from bitshares.account import Account
from .decorators import onlineChain, unlockWallet, configfile
from .main import main, config
from .ui import print_message
@main.group()
@onlineChain
@click.pass_context
@... | xeroc/uptick | uptick/api.py | Python | mit | 1,654 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.widgets.reportview import get_match_cond
from frappe.model.db_query import DatabaseQuery
def get_filters_cond(doctype, fil... | BhupeshGupta/erpnext | erpnext/controllers/queries.py | Python | agpl-3.0 | 10,371 |
#!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2013 Riverbank Computing Limited.
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
## All rights reserved.
##
## This file is part of the examples of PyQt.
##
## $QT_BEGIN_LICENSE:BSD$
#... | santosfamilyfoundation/SantosGUI | application/custom/videographicsitem.py | Python | mit | 7,446 |
__version__ = '0.1.0'
from .subscribe import subscribe
| ebrelsford/mailchimp_subscribe | mailchimp_subscribe/__init__.py | Python | bsd-2-clause | 56 |
import os
import copy
import scipy.interpolate as spi
import math
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
data_root = 'toneclassifier'
train_data_path = "%s/train" % data_root
val_data_path = "%s/test" % data_root
test_data_path = "%s/test_new" % data_root
def SetPath(r... | BreakVoid/DL_Project | data_utils.py | Python | mit | 12,608 |
# 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 ... | google/checkers_classic | python/integrations/pyunit/pyunit.py | Python | apache-2.0 | 7,520 |
# -*- coding: utf-8 -*-
import itertools
import pythoncom
import win32com.client as com
__author__ = 'cvargasc'
# Una intersección es un SignalController, tiene carriles de entrada, salida, cruces y semáforos.
class Interseccion:
# ------------------------
# Constructor
# ------------------------
# In... | vargax/RAPfSC | RAPfSC/modelo.py | Python | gpl-2.0 | 12,512 |
import sys, ctypes
"""
Python approximation of power.asm
Returns sys.argv[2] ** sys.argv[3]
"""
raise NotImplementedError("This file isn't done yet.")
def echo_args(): # See function 'echo_args' in echo.asm
global stack, r12, r13, r14, rdi, rsi
stack.append(r12) # "push"
stack.append(r1... | cmattoon/pyasm | examples/x-pow-y/power.py | Python | mit | 1,642 |
from django.contrib import admin
from jmbo.admin import ModelBaseAdmin
from post.models import Post
admin.site.register(Post, ModelBaseAdmin)
| praekelt/jmbo-post | post/admin.py | Python | bsd-3-clause | 145 |
"""NDG Security Basic OpenID Authentication Interface.
A demonstration implementation of an authentication interface for
OpenIDProviderMiddleware WSGI. Username/password and OpenId user identifier
details are read from a config file and passed as keywords. This class is not
intended for production use.
NERC DataG... | philipkershaw/ndg_security_server | ndg/security/server/wsgi/openid/provider/authninterface/basic.py | Python | bsd-3-clause | 8,254 |
from pathlib import Path
from datetime import datetime, timedelta, timezone
from django.shortcuts import get_object_or_404
from rest_framework.views import APIView
from rest_framework.parsers import FileUploadParser
from rest_framework import serializers
from rest_framework.response import Response
from hav.utils.im... | whav/hav | src/hav/apps/sources/uploads/api/views.py | Python | gpl-3.0 | 3,645 |
#!/usr/bin/env python
# coding: utf-8
import sys
import flask
from flask import g, url_for
from social.apps.flask_app.default.models import init_social
from social.actions import do_auth, do_complete
from social.apps.flask_app.utils import load_strategy, load_backend
from social.backends.facebook import FacebookOAut... | okfn-brasil/viralata | viralata/auths.py | Python | agpl-3.0 | 3,435 |
#! /usr/bin/env python
import sys
import numpy as np
import pandas as pd
from unittest import TestCase
from pandashells.lib import io_lib
from mock import patch, MagicMock
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
class IOLibTests(TestCase):
def test_get_separator_csv(... | shaunstanislaus/pandashells | pandashells/test/io_lib_tests.py | Python | bsd-2-clause | 6,858 |
# 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)
import json
from os import path
from llnl.util import filesystem
from spack import *
class Hipsycl(CMakePackage):
... | LLNL/spack | var/spack/repos/builtin/packages/hipsycl/package.py | Python | lgpl-2.1 | 6,401 |
#! /usr/bin/env python
from random import shuffle
from math import sqrt
from functools import total_ordering
from heapq import heappop, heappush
def dist(puzzle, idx1, idx2):
"""Get the distance between two cells (as the number of moves)."""
size = int(sqrt(len(puzzle)))
# difference of row and column number... | gliderkite/puzzle15 | puzzle15.py | Python | mit | 15,938 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
"""
(c) 2014 Ronan Delacroix
Doremi API Requests definition
:author: Ronan Delacroix
"""
import six
import tbx.bytes
class MessageDefinition(object):
"""
Request Definition object.
"""
def __init__(self, name, key, elements=... | ronhanson/python-dcitools | dcitools/devices/doremi/message.py | Python | mit | 4,018 |
# -*- coding: utf-8 -*-
#
# 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, software
... | Svjard/presto-admin | prestoadmin/package.py | Python | apache-2.0 | 2,988 |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the ... | ylatuya/Flumotion | flumotion/scenario/steps/conversionsteps.py | Python | gpl-2.0 | 13,864 |
"""mercury URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | jonstacks13/mercury | mercury/urls.py | Python | gpl-2.0 | 1,467 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import pytest
from shuup.core.models import StaffOnlyBehaviorComp... | shoopio/shoop | shuup_tests/core/test_staff_only_behavior.py | Python | agpl-3.0 | 1,377 |
class peaktype(object):
scanned = 'scanned'
broad = 'broad'
noise = 'noise'
overlap = 'overlap'
unassigned = 'unassigned'
ladder = 'ladder'
called = 'called'
stutter = 'stutter'
artifact = 'artifact'
bin = 'bin'
ignored = 'ignored'
class channelstatus(object):
unassig... | trmznt/fatools | fatools/lib/const.py | Python | lgpl-3.0 | 4,039 |
import numpy
from pygbe.util import an_solution
from convergence import (run_convergence, picklesave, pickleload,
report_results, mesh)
def main():
print('{:-^60}'.format('Running sphere_molecule_single test'))
try:
test_outputs = pickleload()
except FileNotFoundError:
... | barbagroup/pygbe | tests/convergence_tests/sphere_molecule_single.py | Python | bsd-3-clause | 1,741 |
"""Module containing classes for extracting/constructing features from data"""
__author__ = 'wittawat'
from abc import ABCMeta, abstractmethod
import numpy as np
import scipy.stats as stats
class FeatureMap(object):
"""Abstract class for a feature map function"""
__metaclass__ = ABCMeta
@abstractmethod... | Diviyan-Kalainathan/dependency_criteria | lib/fsic/feature.py | Python | mit | 3,750 |
# encoding: utf-8
import os
from django.test.runner import DiscoverRunner
from django_nose import NoseTestSuiteRunner
from optparse import make_option
from django.core import management
from django.contrib.auth.management.commands import changepassword
from unittest.result import TestResult
browser = 'Firefox'
sauce_... | OriHoch/Open-Knesset | knesset/browser_test_runner.py | Python | bsd-3-clause | 4,065 |
#!/usr/bin/env python2
# Copyright (c) 2016 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test MVF post fork retargeting
#
# on node 0, test pure block height trigger at height FORK_BLOCK
#
from test_f... | BTCfork/hardfork_prototype_1_mvf-core | qa/rpc-tests/mvf-core-retarget.py | Python | mit | 15,092 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# import
## batteries
import os
import sys
import unittest
## 3rd party
import pandas as pd
## package
from leylab_pipelines import Utils
# data dir
test_dir = os.path.join(os.path.dirname(__file__))
data_dir = os.path.join(test_dir, 'data')
# tests
class Test_Utils(un... | leylabmpi/leylab_pipelines | tests/test_Utils.py | Python | mit | 1,431 |
#!/usr/bin/python
#-*- coding: utf-8 -*-
###########################################################
# © 2011 Daniel 'grindhold' Brendle and Team
#
# This file is part of Skarphed.
#
# Skarphed is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License
# as ... | skarphed/skarphed | core/lib/template.py | Python | agpl-3.0 | 12,772 |
"""
Test DistCI input validation routines
Copyright (c) 2012-2013 Heikki Nousiainen, F-Secure
See LICENSE for details
"""
from distci.frontend import validators
class TestValidators:
valid_task_ids = [
'00000000-0000-0000-0000-000000000000',
'be1a4893-aada-4fa1-980c-46fc30e196c6'
... | F-Secure/distci | src/distci/frontend/tests/test-validators.py | Python | apache-2.0 | 2,641 |
# -*- coding: utf-8 -*-
import pytest
import glob
import os
import six
import sys
import yaml
from flexmock import flexmock
from devassistant import dapi
from devassistant import utils
from devassistant.dapi import dapicli
from devassistant.exceptions import DapiLocalError
class TestDapicli(object):
'''Test if t... | oskopek/devassistant | test/dapi/test_dapicli.py | Python | gpl-2.0 | 6,814 |
# Copyright (C) 2004-2014 Aaron Swartz
# Brian Lalor
# Dean Jackson
# Erik Hetzner
# Etienne Millon <me@emillon.org>
# Joey Hess
# Lindsey Smith <lindsey.smith@gmail.com>
# ... | sciunto/rss2email | rss2email/feeds.py | Python | gpl-2.0 | 14,342 |
import six
import json
from abc import abstractproperty, abstractmethod
from requests.structures import CaseInsensitiveDict
class BaseProcessor(object):
NAME = None
def process_raw(self, raw_doc, **kwargs):
pass # pragma: no cover
def process_normalized(self, raw_doc, normalized, **kwargs):
... | mehanig/scrapi | scrapi/processing/base.py | Python | apache-2.0 | 3,170 |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 22 09:28:26 2017
@author: A
"""
import numpy as np
import matplotlib.pyplot as plt
plt.close('all')
nCell=3
betaG=0.6
betaC=0.3
betaStart=0.1
betaEnd=0.9
betaStep=0.001
def TTFC(nCell,betaC,betaG):
if (np.abs(betaC-betaG)<1.0e-6):
... | iABC2XYZ/abc | Scripts/TTFGen/TTF.py | Python | gpl-3.0 | 1,362 |
import numpy as np
from skimage.color import rgb2gray, rgb2hsv, rgb2lab, rgb2luv
from scipy.stats import skew
from sklearn.metrics.cluster import entropy
import time
def features(img, kernels):
"""
Implements a function to calculate the feature extraction from a block of image
Parameters
----------
... | benitesf/Skin-Lesion-Analysis-Towards-Melanoma-Detection | features_extraction/methods/second_feature_extraction.py | Python | mit | 3,137 |
# -*- coding: utf-8 -*-
"""
model.users.py
~~~~~~~~~~~
Manages the users.
> db.users.findOne()
{
"_id" : ObjectId("4f4a8387d8e40802ea000001"),
"description" : "",
"email" : "admin@bombolone.com",
"image" : [],
"lan" : "en",
"language" : "English",
"location" : "",
"name" : "Admin Name"... | katiecheng/Bombolone | model/users.py | Python | bsd-3-clause | 6,341 |
#!/usr/bin/env python
#
# This library is free software, distributed under the terms of
# the GNU Lesser General Public License Version 3, or any later version.
# See the COPYING file included in this archive
#
# Thanks to Paul Cannon for IP-address resolution functions (taken from aspn.activestate.com)
import argpar... | DaveA50/lbry | lbrynet/create_network.py | Python | mit | 2,692 |
# -*- coding: UTF-8 -*-
#
# Python library for parsing public post journals (postlister) in Norway.
#
# Based on the scraper advanced-scraping-pdf
#
# See also
# https://views.scraperwiki.com/run/pdf-to-html-preview-1/
# Possible sources using format 1 pdf:
# www.bydel-ullern.oslo.kommune.no
# www.gravferdsetaten.osl... | Kagee/nuug-postliste-scrapers | lib/postlistepythonlib.py | Python | gpl-3.0 | 26,254 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-present Taiga Agile LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ver... | taigaio/taiga-back | taiga/projects/mixins/validators.py | Python | agpl-3.0 | 1,663 |
def reverse(array, i, j):
while i < j:
array[i], array[j] = array[j], array[i]
i += 1
j -= 1
def reverse_words(string):
arr = string.strip().split() # arr is list of words
n = len(arr)
reverse(arr, 0, n-1)
return " ".join(arr)
if __name__ == "__main__":
test = "I a... | keon/algorithms | algorithms/strings/reverse_words.py | Python | mit | 396 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2016 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>, Philippe Heer
#
# The licence is in the fil... | philippe89/compassion-modules | child_compassion/models/child_lifecycle_event.py | Python | agpl-3.0 | 11,343 |
# Copyright 2017 reinforce.io. 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... | lefnire/tensorforce | tensorforce/core/explorations/gaussian_noise.py | Python | apache-2.0 | 1,432 |
# prosaicweb
# Copyright (C) 2016 nathaniel smith
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This pro... | nathanielksmith/prosaicweb | prosaicweb/__init__.py | Python | agpl-3.0 | 2,338 |
from django.shortcuts import render
import twitter_tools
import os
from django.http import HttpResponse
def query_by_ext(ext):
mimetype = {
'css': 'text/css',
'js': 'application/x-javascript',
'png': 'image/png',
'PNG': 'image/png',
'jpg': 'image/jpeg',
'j... | WeakGroup/twitter-rec | interface/website/website/views.py | Python | gpl-2.0 | 2,044 |
# -*- coding: utf-8 -*-
def setupVarious(context):
# Ordinarily, GenericSetup handlers check for the existence of XML files.
# Here, we are not parsing an XML file, but we use this text file as a
# flag to check that we actually meant for this import step to be run.
# The file is found in profiles/de... | OpenBfS/dokpool-plone | Plone/src/docpool.elan/docpool/elan/setuphandlers.py | Python | gpl-3.0 | 529 |
from PushbulletLogging import *
| wrow/PushbulletLogging | __init__.py | Python | mit | 32 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('browser', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='RLibrary',
fields=[
... | rwspicer/ARDA | arda_db/browser/migrations/0002_auto_20150320_0137.py | Python | mit | 2,242 |
import codecs
import os
import re
from collections import OrderedDict
from common import SushiError, format_time, format_srt_time
def _parse_ass_time(string):
hours, minutes, seconds = map(float, string.split(':'))
return hours*3600+minutes*60+seconds
class ScriptEventBase(object):
def __init__(self, st... | alicx1/Sushi | subs.py | Python | mit | 10,556 |
compl_iupacdict = {'A':'T',
'C':'G',
'G':'C',
'T':'A',
'M':'K',
'R':'Y',
'W':'W',
'S':'S',
'Y':'R',
'K':'M',
'V':'B',
... | xguse/spartan | src/spartan/utils/seqs.py | Python | mit | 1,664 |
# MIT License
# Copyright (c) 2016 Diogo Dutra
# 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, modify, merge, pu... | dutradda/falcon-swagger | tests/unit/base/models/test_redis.py | Python | mit | 11,240 |
# coding=utf-8
import logging
from pyage.core import address
from pyage.core.agent.agent import unnamed_agents
from pyage.core.agent.aggregate import AggregateAgent
from pyage.core.emas import EmasService
from pyage.core.locator import GridLocator
from pyage.core.migration import ParentMigration
from pyage.core.stats.... | Hoobie/pyage-styblinski-tang | conf/emasconf.py | Python | mit | 1,791 |
# -*- coding: utf-8 -*-
import os
ENV_NAME = "staging"
DEBUG = os.environ.get("FLASK_DEBUG", False) == "True"
| rdev-hackaton/msze_www | msze_www/settings/staging.py | Python | gpl-3.0 | 111 |
from djangoappengine.settings_base import *
import os
# Activate django-dbindexer for the default database
DATABASES['native'] = DATABASES['default']
DATABASES['default'] = {'ENGINE': 'dbindexer', 'TARGET': 'native'}
AUTOLOAD_SITECONF = 'indexes'
SECRET_KEY = '=r-$b*8hglm+858&9t043hlm6-&6-3d3vfc4((7yd0dbrakhvi'
INS... | ormnv/os_final_project | settings.py | Python | bsd-3-clause | 1,866 |
'''
Created on Dec 22, 2011
@author: ajju
'''
from common import HttpUtils
from common.DataObjects import VideoHostingInfo, VideoInfo, VIDEO_QUAL_SD
import base64
import binascii
import urllib
try:
import json
except ImportError:
import simplejson as json
def getVideoHostingInfo():
video_hosting_info = V... | dknlght/dkodi | src/script.module.turtle/lib/snapvideo/Videozer.py | Python | gpl-2.0 | 4,708 |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
adress = Table('adress', pre_meta,
Column('id', INTEGER, primary_key=True, nullable=False),
Column('user_id', INTEGER),
Column('adress', VARCHAR(length=50)),
)
adress = Table('... | serdimoa/vincenzoext | db_repository/versions/016_migration.py | Python | bsd-3-clause | 1,060 |
# This file is part of Invenio.
# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2014 CERN.
#
# Invenio 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
# Lice... | crepererum/invenio | invenio/modules/access/local_config.py | Python | gpl-2.0 | 30,236 |
# 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, software
# d... | gotostack/iSwift | iswift/swiftapi/messages.py | Python | apache-2.0 | 2,533 |
from sentry.plugins.bases.notify import NotificationConfigurationForm
class CommentConfForm(NotificationConfigurationForm):
"""Configuration form.
For now this form just inherits from
NotificationConfigurationForm.
"""
| andialbrecht/sentry-comments | sentry_comments/forms.py | Python | bsd-3-clause | 238 |
import os
import sys
import shutil
import filecmp
import bots.botsglobal as botsglobal
import bots.botslib as botslib
def cleanoutputdir():
''' delete directory standard-out 'bots/botssys/out' (as indicated in bos.ini). '''
botssys = botsglobal.ini.get('directories','botssys')
shutil.rmtree(os.path.join... | Micronaet/micronaet-bots | edifact2fixed_orders-desadv-invoic-aperak/usersys/routescripts/bots_acceptancetest.py | Python | gpl-3.0 | 2,574 |
import os
from analyzer.report import Grade
class LicenseAnalyzer(Grade):
"""An analyzer for checking license
has_license: Whether if license file exists or not
"""
LICENSE_PATTERN = ('license', 'license.md', 'license.rst', 'license.txt')
weight = 0.01
def __init__(self):
self.has... | mingrammer/pyreportcard | analyzer/license.py | Python | mit | 999 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from PySide6 import QtCore, QtWidgets
class MyWidget(QtWidgets.QWidget):
def __init__(self):
super().__init__()
self.text = QtWidgets.QLabel("Hello World", alignment=QtCore.Qt.AlignCenter)
self.layout = QtWidgets.QVBoxLayout(self)... | jeremiedecock/snippets | python/pyside/pyside6/hello.py | Python | mit | 526 |
#!/usr/bin/python
"""
UDP Service Scanner version 0.1 by dev_zzo
This work has largely been inspired by:
https://github.com/portcullislabs/udp-proto-scanner
As is, this is more like a prober than scanner;
it operates using predefined probes for each known protocol.
"""
import argparse
import socket
import struct
im... | dev-zzo/pwn-tools | scanners/udp-probe.py | Python | unlicense | 7,615 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2015 Christoph Reiter
#
# 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... | exaile/python-gtk3-gst-sdk | osx_bundle/misc/list_content.py | Python | gpl-2.0 | 2,435 |
#! /usr/bin/env python
from __future__ import print_function
from openturns import *
TESTPREAMBLE()
RandomGenerator.SetSeed(0)
try:
distribution = LogUniform(1.0, 2.5)
size = 10000
sample = distribution.getSample(size)
factory = LogUniformFactory()
estimatedDistribution = factory.build(sample)
... | aurelieladier/openturns | python/test/t_LogUniformFactory_std.py | Python | lgpl-3.0 | 1,348 |
# -*- Mode: Python; test-case-name: -*-
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU L... | flumotion-mirror/flumotion | flumotion/component/misc/httpserver/serverstats.py | Python | lgpl-2.1 | 7,784 |
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"label": _("Documents"),
"icon": "icon-star",
"items": [
{
"type": "doctype",
"name": "Customer",
"description": _("Customer database."),
},
{
"type": "doctype",
"name": "Quotation",... | mahabuber/erpnext | erpnext/config/selling.py | Python | agpl-3.0 | 7,142 |
import os, sys
from os.path import isdir, join
dir = sys.argv[1] if len(sys.argv) > 1 else '.'
print 'digraph {'
for i in os.listdir(dir):
if not isdir(join(dir, i)):
i = i.rsplit('.', 1)[0]
parts = i.split('=')
print ' -> '.join(parts[:2])
# TODO: add label (optional section 3)
print '}'
| stevenrobertson/cuburn | scripts/graph.py | Python | gpl-2.0 | 316 |
log.info("Restoring core configs.")
bot["configs"] = {'Webserver': {'SSL': {'port': 3142, 'certificate': '', 'enabled': False, 'host': '0.0.0.0', 'key': ''}, 'PORT': 3141, 'HOST': '0.0.0.0'}, 'TwilioLookup': {'TWILIO_ACCOUNT_SID': '{{ twilio_account_sid }}', 'TWILIO_AUTH_TOKEN': '{{ twilio_auth_token }}'}}
log.info("In... | RobSpectre/salt-states | slackbot/backup.py | Python | mit | 590 |
import pymysql
pymysql.install_as_MySQLdb() | HarrisonHDU/myerp | erp/__init__.py | Python | mit | 46 |
from __future__ import absolute_import
from sentry.testutils import AcceptanceTestCase
class AuthTest(AcceptanceTestCase):
def enter_auth(self, username, password):
# disable captcha as it makes these tests flakey (and requires waiting
# on external resources)
with self.settings(RECAPTCHA... | mitsuhiko/sentry | tests/acceptance/test_auth.py | Python | bsd-3-clause | 1,321 |
# -*- coding: UTF-8 -*-
# COPYRIGHT (c) 2016 Cristóbal Ganter
#
# GNU AFFERO GENERAL PUBLIC LICENSE
# Version 3, 19 November 2007
#
# 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, eit... | TelematicaUSM/EduRT | src/wsclass.py | Python | agpl-3.0 | 8,134 |
from PyQt4.QtGui import *
from electrum_myr import BasePlugin
from electrum_myr.i18n import _
from electrum_myr.plugins import BasePlugin, hook
from electrum_myr.i18n import _
class Plugin(BasePlugin):
def fullname(self):
return 'Virtual Keyboard'
def description(self):
return '%s\n%s' % (_(... | wozz/electrum-myr | plugins/virtualkeyboard.py | Python | gpl-3.0 | 2,092 |
"""\
Core Linear Algebra Tools
-------------------------
Linear algebra basics:
- norm Vector or matrix norm
- inv Inverse of a square matrix
- solve Solve a linear system of equations
- det Determinant of a square matrix
- lstsq Solve linear least-squares problem... | LumPenPacK/NetworkExtractionFromImages | win_build/nefi2_win_amd64_msvc_2015/site-packages/numpy/linalg/info.py | Python | bsd-2-clause | 1,198 |
"""Compatibility fixes for older version of python, numpy and scipy
If you add content to this file, please give the version of the package
at which the fix is no longer needed.
"""
# Authors: Marcel Caraciolo <marcel@pingmind.com>
# License: BSD
import numpy as np
import inspect
# little danse to see if np.copy has... | python-recsys/crab | crab/utils/fixes.py | Python | bsd-3-clause | 612 |
# Copyright 2016 Red Hat, 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... | stratis-storage/stratisd-client-dbus | src/stratisd_client_dbus/_managedobjects.py | Python | apache-2.0 | 1,243 |
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
"""
These pipeline stages are used in creating the StandardPipelineRenderer,
the default renderer for standard widget backends.
[createbg] => [overlays] => [iccprof] => [flipswap] => [rotate] => [output]
"""
... | pllim/ginga | ginga/util/stages/render.py | Python | bsd-3-clause | 27,918 |
"""
===============
Gaussian fitter
===============
.. moduleauthor:: Adam Ginsburg <adam.g.ginsburg@gmail.com>
Created 3/17/08
Original version available at http://code.google.com/p/agpy/source/browse/trunk/agpy/gaussfitter.py
(the version below uses a Class instead of independent functions)
"""
from __future__ impo... | vlas-sokolov/pyspeckit | pyspeckit/spectrum/models/gaussfitter.py | Python | mit | 10,316 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.