text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# Copyright (c) 2011-2013 Andreas Sembrant
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditi... | uart/scarphase | pyscarphase/plot/color.py | Python | bsd-3-clause | 1,885 | 0.000531 |
import datetime
import factory
from django.utils.timezone import utc
from openbudget.apps.accounts.models import Account
class AccountFactory(factory.DjangoModelFactory):
FACTORY_FOR = Account
password = 'letmein'
email = factory.Sequence(lambda n: 'p{0}@here.com'.format(n))
first_name = factory.Seq... | nborwankar/open-budgets | openbudget/apps/accounts/factories.py | Python | bsd-3-clause | 1,107 | 0 |
# -*- coding: utf-8 -*-
"""
Production Configurations
- Use Redis for cache
"""
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat
from django.utils import six
from .common import * # noqa
# SECRET CONFIGURATION
# ---------------------------------------... | Patrick-and-Michael/trumptweets | config/settings/production.py | Python | mit | 4,984 | 0.001605 |
# Copyright 2008-2015 Canonical
#
# 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 program is distributed... | zhsso/ubunto-one | lib/config.py | Python | agpl-3.0 | 1,777 | 0 |
from decimal import Decimal
import random
import hashlib
from django.conf import settings
from django.core.cache import cache
from django.db.models.signals import post_save, post_delete, m2m_changed
from waffle.models import Flag, Sample, Switch
VERSION = (0, 9, 2)
__version__ = '.'.join(map(str, VERSION))
CACHE_... | ekohl/django-waffle | waffle/__init__.py | Python | bsd-3-clause | 6,842 | 0.000438 |
# pylint: disable-all
# flake8: noqa
import sys
sys.path.append("..")
from todopagoconnector import TodoPagoConnector
from SendAuthorizeRequestData import SendAuthorizeRequestData
import unittest
from unittest import TestCase
if sys.version_info[0] >= 3:
from unittest.mock import patch, Mock
else:
from mock imp... | ingadhoc/website | payment_todopago/todopago/test/SendAuthorizeRequestTest.py | Python | agpl-3.0 | 2,473 | 0.003235 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016-2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | elopio/snapcraft | tests/integration/general/test_clean_prime_step.py | Python | gpl-3.0 | 3,431 | 0 |
# Miro - an RSS based video player application
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
# Participatory Culture Foundation
#
# 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; eithe... | debugger06/MiroX | tv/lib/frontends/widgets/watchedfolders.py | Python | gpl-2.0 | 3,503 | 0.000571 |
from django.db import connection
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from rest_framework.generics import RetrieveAPIView
from jarbas.core.models import Company
from jarbas.core.serializers import CompanySerializer
from jarbas.chamber_of_deputies.serializers import format... | datasciencebr/serenata-de-amor | jarbas/core/views.py | Python | mit | 867 | 0 |
"""
XML handler for element id condition
"""
# Standard library modules.
# Third party modules.
# Local modules.
from pyhmsa.spec.condition.elementalid import ElementalID, ElementalIDXray
from pyhmsa.fileformat.xmlhandler.condition.condition import _ConditionXMLHandler
# Globals and constants variables.
class Elem... | pyhmsa/pyhmsa | pyhmsa/fileformat/xmlhandler/condition/elementalid.py | Python | mit | 925 | 0.005405 |
# author: Fei Gao
#
# Unique Paths
#
# A robot is located at the top-left corner of a m x n grid (marked 'Start' in
# the diagram below).
# The robot can only move either down or right at any point in time. The robot
# is trying to reach the bottom-right corner of the grid (marked 'Finish' in
# the diagram below).
# Ho... | feigaochn/leetcode | p62_unique_paths.py | Python | mit | 892 | 0 |
# Copyright (C) 2013 Lunatixz
#
#
# This file is part of PseudoTV.
#
# PseudoTV 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.
#
# P... | DrSpaceMonkey/script.pseudotv.live | resources/lib/EPGWindow.py | Python | gpl-3.0 | 58,386 | 0.008512 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# http://www.youtube.com/user/irmaospiologo
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
# Based on code from youtube addon
#----------------------------------... | cmvac/demagorgon.repository | plugin.video.irmaospiologo/default.py | Python | gpl-2.0 | 1,296 | 0.013117 |
# -*- coding: utf-8 -*-
# !/usr/bin/python
# mavri kütüphanesi yükle
import mavri
# json kütüphanesi yükle
import json
wiki='tr.wikipedia'
username= 'Mavrikant Bot'
# Kullanıcı girişi yap
xx = mavri.login(wiki, username)
# Giriş denemesini sonucunu ekrana JSON ile düzenleyerek yazdır
print json.dumps(json.loads(xx... | Mavrikant/WikiBots | deneme.py | Python | mit | 826 | 0.007472 |
"""The tests for the litejet component."""
import logging
import unittest
from unittest import mock
from homeassistant import setup
from homeassistant.components import litejet
from tests.common import get_test_home_assistant
from tests.components.scene import common
_LOGGER = logging.getLogger(__name__)
ENTITY_SCE... | fbradyirl/home-assistant | tests/components/litejet/test_scene.py | Python | apache-2.0 | 1,928 | 0.001037 |
#!/usr/bin/env python
# This file comes from here: https://github.com/llSourcell/tensorflow_demo/blob/master/input_data.py
"""Functions for downloading and reading MNIST data."""
import gzip
import os
from six.moves.urllib.request import urlretrieve
import numpy
SOURCE_URL = 'http://yann.lecun.com/exdb/mnist... | KamilSzot/365_programs | 2017-01-27/input_data.py | Python | unlicense | 6,497 | 0.000154 |
"""Set of Mocks and stubs for network utilities unit tests.
Implement a set of mocks and stubs use to implement unit tests
for the network libraries.
"""
import socket
from autotest.client.shared.test_utils import mock
from autotest.client.net import net_utils
def os_open(*args, **kwarg):
return os_stub('open')... | nacc/autotest | client/net/net_utils_mock.py | Python | gpl-2.0 | 2,952 | 0.004743 |
cypher = input()
per = "PER"
count = 0
for i in range(len(cypher)):
if cypher[i] != per[i%3]:
count +=1
print(count) | rvrheenen/OpenKattis | Python/conundrum/conundrum.py | Python | mit | 128 | 0.023438 |
# -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------
# xawtv.py - use xawtv for tv viewing
# -----------------------------------------------------------------------
# $Id$
#
# Notes:
# Todo:
#
# -----------------------------------------------------------------------
# F... | freevo/freevo1 | src/tv/plugins/xawtv.py | Python | gpl-2.0 | 9,292 | 0.004305 |
"""
Anscombe's quartet
==================
_thumb: .4, .4
"""
import seaborn as sns
sns.set_theme(style="ticks")
# Load the example dataset for Anscombe's quartet
df = sns.load_dataset("anscombe")
# Show the results of a linear regression within each dataset
sns.lmplot(x="x", y="y", col="dataset", hue="dataset", data... | mwaskom/seaborn | examples/anscombes_quartet.py | Python | bsd-3-clause | 430 | 0 |
# coding: utf-8
# In[ ]:
import numpy as np
import numexpr as ne
def sym_decorrelation_ne(W):
""" Symmetric decorrelation """
K = np.dot(W, W.T)
s, u = np.linalg.eigh(K)
return (u @ np.diag(1.0/np.sqrt(s)) @ u.T) @ W
# logcosh
def g_logcosh_ne(wx,alpha):
"""derivatives of logcosh"""
return n... | 663project/fastica_lz | fastica_lz/fastica_lz.py | Python | mit | 2,082 | 0.022574 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
sine
~~~~
Run a TSM procedure on a signal generated with numpy.
"""
# pylint: disable=invalid-name
import numpy as np
import sounddevice as sd
from audiotsm import wsola
from audiotsm.io.array import ArrayReader, ArrayWriter
# The parameters of the input signal
le... | Muges/audiotsm | examples/sine.py | Python | mit | 957 | 0 |
from threading import Event
import threading
# encoding: utf-8
__author__ = "Nils Tobias Schmidt"
__email__ = "schmidt89 at informatik.uni-marburg.de"
class StopThread(threading.Thread):
""" Extends the `Thread` with an `Event` and the `terminate` method
like the `multiprocessing` api offers it.
Callin... | miniworld-project/miniworld_core | miniworld/concurrency/StopThread.py | Python | mit | 883 | 0.001133 |
# Copyright 2016 Capital One Services, 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 agreed to in... | VeritasOS/cloud-custodian | c7n/resources/iot.py | Python | apache-2.0 | 1,009 | 0 |
# Copyright (C) 2013-2018 Free Software Foundation, Inc.
# 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 later version.
#
# This progr... | BPI-SINOVOIP/BPI-Mainline-kernel | toolchains/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/share/gdb/python/gdb/FrameDecorator.py | Python | gpl-2.0 | 10,392 | 0.00154 |
# -*- coding: utf-8 -*-
# Copyright 2018 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models
from odoo.tools import safe_eval
class DeliveryCarrier(models.Model):
_inherit = 'delivery.carrier'
@api.multi
def get_price_ava... | OCA/carrier-delivery | delivery_price_by_category/models/delivery_carrier.py | Python | agpl-3.0 | 2,275 | 0 |
#-
# Copyright (c) 2013 Michael Roe
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# Licensed to BER... | 8l/beri | cheritest/trunk/tests/cp2/test_cp2_creturn_trap.py | Python | apache-2.0 | 2,300 | 0.003478 |
from django.contrib.auth import authenticate
from django.contrib.auth import login as loginUser
from django.contrib.auth import logout as logoutUser
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.models import User
from django.http import HttpResponse, HttpResponseRedir... | AndyGrant/EtherealBenchmarking | EtherBench/views.py | Python | gpl-3.0 | 11,198 | 0.012413 |
#!/usr/bin/python
import sys
import os
import subprocess
import random
import time
import sqlite3
import threading
import hashlib
import gzip
import json
import datetime
import re
if sys.version_info[0] >= 3:
from socketserver import ThreadingTCPServer
from urllib.request import urlopen, URLError
from urllib.parse... | aagallag/nexmon | utilities/aircrack-ng/scripts/dcrack.py | Python | gpl-3.0 | 17,795 | 0.044338 |
# Copyright (c) 2018, Intel Corporation.
# SPDX-License-Identifier: BSD-3-Clause
# Create the ixp_default.conf file used by installer based on the ixp_default.h
import argparse
delete_list = ["\"", "\\n"]
parser = argparse.ArgumentParser(description='The default ini conf file generator.')
parser.add_argument('src_f... | intel/ipmctl | src/os/ini/ini_auto_gen_default_config.py | Python | bsd-3-clause | 682 | 0.001466 |
#!/usr/bin/python
import glob
import os.path
import re
import hashlib
from bs4 import BeautifulSoup
from subprocess import call, Popen, PIPE, STDOUT
root = "/home/alex/tidalcycles.github.io/_site/"
dnmatcher = re.compile(r'^\s*d[0-9]\s*(\$\s*)?')
crmatcherpre = re.compile(r'^[\s\n\r]*')
crmatcherpost = re.compile(r'[... | tidalcycles/tidalcycles.github.io | bin/build_examples.py | Python | gpl-3.0 | 1,514 | 0.002642 |
#!/usr/bin/env python
from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
long_description = "Pupil tracking library for mouse pupil"
setup(
name='pupil_tracking',
version='0.1.0.dev1',
description="Pupil tracker library.",
long_description=long... | cajal/pupil-tracking | setup.py | Python | mit | 1,026 | 0.001949 |
#
# Licensed under the GNU General Public License Version 3
#
# 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 later version.
#
# This p... | mcalmer/spacewalk | spacecmd/src/lib/utils.py | Python | gpl-2.0 | 24,782 | 0.000726 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | pulinagrawal/nupic | examples/opf/experiments/opfrunexperiment_test/simpleOPF/hotgym/description.py | Python | agpl-3.0 | 16,183 | 0.003399 |
from django import forms
from django.utils.translation import ugettext_lazy as _
class GroundtruthRecordFormMixin(forms.ModelForm):
def clean(self):
cleaned_data = super(GroundtruthRecordFormMixin, self).clean()
contact_email = cleaned_data.get('contact_email', None)
contact_phone = clean... | 596acres/django-livinglots-groundtruth | livinglots_groundtruth/forms.py | Python | bsd-3-clause | 569 | 0 |
from MapCombiner import MapCombiner
| hiuwo/acq4 | acq4/analysis/modules/MapCombiner/__init__.py | Python | mit | 36 | 0 |
from django.http import HttpResponse, HttpResponseForbidden
from django.core.cache import cache
from inboxtix.util import get_api_tree
def autocomplete_category(request):
if not request.is_ajax():
return HttpResponseForbidden()
name = request.GET.get('q',None)
limit = request.GET.get('limit', 10)
... | tdavis/inboxtix | inboxtix/home/views.py | Python | mit | 594 | 0.006734 |
'''
Bryan Bonvallet
2013
This file tests functionality of series.py (and PMF.py).
'''
from testbase import FinitePMF
from testbase import InfinitePMF
from testbase import TestSeriesPMF
class TestSeries(TestSeriesPMF):
# Test functions in series.py
def test_finite_str(self):
# Test that a string is r... | btbonval/DieStatistician | tests/testseries.py | Python | mit | 1,440 | 0.000694 |
VERSION = (0, 1, 0)
# Do some version checking
try:
import micawber
except ImportError:
raise ImportError(
"The 'micawber' package is required to use the 'oembeditem' plugin."
)
| edoburu/django-fluent-contents | fluent_contents/plugins/oembeditem/__init__.py | Python | apache-2.0 | 199 | 0 |
#
# Copyright (c) 2010 Matteo Boscolo, Gertwin Groen
#
# This file is part of PythonCAD.
#
# PythonCAD 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... | Csega/PythonCAD3 | Interface/cadscene.py | Python | gpl-2.0 | 15,874 | 0.006678 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
#
# 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, ... | GroestlCoin/electrum-grs | electrum_grs/gui/qt/exception_window.py | Python | gpl-3.0 | 7,308 | 0.001505 |
from flask import Flask, url_for, redirect, request, render_template, send_from_directory
from flask.ext.sqlalchemy import SQLAlchemy
from model import *
from werkzeug import secure_filename
import os
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif', 'mp4'])
if not os.path.exists('data/media'):
... | Alshootfa/I.K.R.A | app.py | Python | mit | 3,051 | 0.004916 |
#oClasses.py
import Classes
class LCDMgr:
display = 0
editing = 1
eoEdit = 2
error = 3
confirmAbortMode = 4
#modes = [display, editing, eoEdit, error,confirmAbortMode]
cursorOff =-1
cursorStart = 0
eoLine = 15
lineLength = 16
letters = ['A','a','B','b','C','c','D','d'] ... | gratefulfrog/ArduGuitar | Ardu2/design/POC-3_MAX395/pyboard/V1_WithHMI/PyHMI/oClasses.py | Python | gpl-2.0 | 5,003 | 0.017789 |
from __future__ import absolute_import
from django.conf.urls import include, url
from tastypie.api import Api
from locations.api import v1, v2
from locations.api.sword import views
v1_api = Api(api_name="v1")
v1_api.register(v1.SpaceResource())
v1_api.register(v1.LocationResource())
v1_api.register(v1.PackageResource... | artefactual/archivematica-storage-service | storage_service/locations/api/urls.py | Python | agpl-3.0 | 865 | 0 |
"""
Graphical user interface functionalities for the
SampleResource Aggregate Manager.
@date: Jun 12, 2013
@author: CarolinaFernandez
"""
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts imp... | dana-i2cat/felix | expedient/doc/plugins/samples/plugin/sample_resource/controller/GUIdispatcher.py | Python | apache-2.0 | 7,485 | 0.011089 |
# ----------------------------------------------------------------------------
# Copyright 2015 Nervana Systems 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.o... | DougFirErickson/neon | neon/backends/tests/test_tensor.py | Python | apache-2.0 | 4,727 | 0.000635 |
from PyQt4 import QtGui, QtCore, QtWebKit, Qsci
import os, sys, pickle
from monkey_ui import Ui_Monkey
sys.path.append('../')
import settings
class Monkey(QtGui.QWidget):
def __init__(self,parent=None):
QtGui.QWidget.__init__(self,parent)
self.ui = Ui_Monkey()
self.ui.setupUi(self)
... | lucidlylogicole/monkey | monkey.py | Python | gpl-3.0 | 11,008 | 0.014353 |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# 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... | rogerthat-platform/rogerthat-backend | src/rogerthat/service/api/app.py | Python | apache-2.0 | 17,482 | 0.002402 |
from datetime import timedelta
from propeller.cookie import Cookie
from propeller.options import Options
from propeller.template import Template
from propeller.util.dict import MultiDict
from urllib import quote
import httplib
import propeller
class Response(object):
def __init__(self, body='', status_code=200, ... | bwind/propeller | propeller/response.py | Python | bsd-2-clause | 4,589 | 0.000436 |
# 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... | chengduoZH/Paddle | python/paddle/fluid/profiler.py | Python | apache-2.0 | 13,034 | 0.003683 |
from rest_framework import permissions
from korjournal.models import Driver
class IsOwner(permissions.BasePermission):
"""
Custom permission to only allow owners of an object to see it
"""
def has_object_permission(self, request, view, obj):
user = request.user
try:
if (ob... | linefeedse/korjournal | www/korjournal/permissions.py | Python | gpl-2.0 | 2,170 | 0.003687 |
# Graphical paste and save GUI for adding members
from Tkinter import *
import os
import pdb
import datetime
lday = 04
lmonth = 10
class myDate:
def __init__(self, year, month, day):
self.date = datetime.datetime(year, month, day)
self.updateString()
def getMonthDay(self):
lday = for... | marev711/scripts | medlemsinput.py | Python | mit | 2,300 | 0.006957 |
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import argparse
import re
import shutil
class Colour(object):
"""Utility class for colour printing messages"""
RED = '\033[91m'
WHITE = '\033[97m'
END = '\033[0m'
@staticmethod
def print(colour, msg, end="\n"):
... | ElliottH/tvrename | tvrename.py | Python | mit | 7,125 | 0.002105 |
#!/usr/bin/env python
def makeYqlQuery(req):
result = req.get("result")
parameters = result.get("parameters")
city = parameters.get("geo-city")
if city is None:
return None
return "select * from weather.forecast where woeid in (select woeid from geo.places(1) where text='" + city + ... | jacoboariza/BotIntendHub | yahooWeatherForecast.py | Python | apache-2.0 | 335 | 0.00597 |
# This file is part of MLDB. Copyright 2015 mldb.ai inc. All rights reserved.
pythonScript = {
"type": "python",
"params": {
"address": "",
"source": """
mldb.log("Constructing plugin!")
def requestHandler(mldb, remaining, verb, resource, restParams, payload, contentType, contentLength, he... | mldbai/mldb | testing/plugin_delete_test.py | Python | apache-2.0 | 856 | 0.005841 |
from __future__ import print_function
from django.core.management.base import BaseCommand
from optparse import make_option
from laws.models import Bill
from laws.vote_choices import BILL_STAGE_CHOICES
from mks.models import Knesset
class Command(BaseCommand):
help = "Freeze bills staged in previous knessets"
... | noamelf/Open-Knesset | laws/management/commands/freeze_bills.py | Python | bsd-3-clause | 1,347 | 0 |
#!python
# log/urls.py
from django.conf.urls import url
from . import views
# We are adding a URL called /home
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^clients/$', views.clients, name='clients'),
url(r'^clients/(?P<id>\d+)/$', views.client_detail, name='client_detail'),
url(r'^clie... | alexeyshulzhenko/OBDZ_Project | OnlineAgecy/urls.py | Python | gpl-3.0 | 3,927 | 0.005348 |
"""Set of utility functions for working with OS commands.
Functions in this module return the command string. These commands are composed but not executed.
"""
import os
from subprocess import call
HADOOP_CONF_DIR = '/etc/hadoop/conf'
def encrypt(key_file):
"""
Encrypt the data from stdin and write output t... | apache/incubator-cotton | mysos/executor/shell_utils.py | Python | apache-2.0 | 3,152 | 0.011421 |
# Copyright (C) 2010 CAMd
# Please see the accompanying LICENSE file for further information.
"""This module provides all the classes and functions associated with the
evaluation of exact exchange with k-point sampling."""
from math import pi, sqrt
import numpy as np
from ase import Atoms
from gpaw.xc import XC
fr... | qsnake/gpaw | gpaw/xc/hybridk.py | Python | gpl-3.0 | 14,413 | 0.002637 |
# -*- coding: utf-8 -*-
#
# Natural Language Toolkit: Snowball Stemmer
#
# Copyright (C) 2001-2010 NLTK Project
# Author: Peter Michael Stahl <pemistahl@gmail.com>
# Algorithms: Dr Martin Porter <martin@tartarus.org>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
u"""
Snowball stemmers and ap... | skarllot/open-tran | lib/stem/snowball.py | Python | gpl-2.0 | 136,128 | 0.004988 |
# (c) Copyright 2014 Cisco Systems 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
#
# Unl... | hguemar/cinder | cinder/zonemanager/drivers/cisco/cisco_fc_zone_driver.py | Python | apache-2.0 | 23,043 | 0 |
# -*- coding:utf-8; mode:python -*-
"""
A terrible sorting algorithm
|----------------------+-----------------------+------------------|
| Best Time Complexity | Worst Time Complexity | Space Complexity |
|----------------------+-----------------------+------------------|
| O(n^2) | O(n) ... | wkmanire/StructuresAndAlgorithms | pythonpractice/bubblesort.py | Python | gpl-3.0 | 819 | 0 |
#
#
# Copyright (C) 2010, 2011 Google Inc.
# Copyright (C) 2013, GRNET S.A.
#
# 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 ve... | Erethon/synnefo | snf-cyclades-app/synnefo/logic/rapi.py | Python | gpl-3.0 | 54,880 | 0.003243 |
# -*- 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):
# Adding model 'LaunchWindow'
db.create_table(u'launch_window_launchwindo... | naphthalene/fabric-bolt | fabric_bolt/launch_window/migrations/0001_initial.py | Python | mit | 1,427 | 0.006307 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
## @file ostap/frames/tree_reduce.py
# Helper module to "Reduce" tree using frames
# @see Ostap::DataFrame
# @see ROOT::RDataFrame
# @author Vanya BELYAEV Ivan.Belyaev@itep.ru
# @date 201... | OstapHEP/ostap | ostap/frames/tree_reduce.py | Python | bsd-3-clause | 12,435 | 0.052352 |
#-*- coding:utf-8 -*-
# 各种方便的工具。
import os, logging, threading
def is_empty(string):
# 判断是否空字符串,如果是空格之类的,也是empty。
# return:Bool:True,空 False,非空
if string is None or len(string) == 0:
return True
elif string.isspace():
return True
else:
return False
def is_not_empty(s... | luo2chun1lei2/AgileEditor | ve/src/VeUtils.py | Python | gpl-2.0 | 503 | 0.014458 |
# Lint as: python3
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | annarev/tensorflow | tensorflow/compiler/xla/python/xla_client.py | Python | apache-2.0 | 24,551 | 0.005539 |
import re
import asyncio
import threading
from collections import defaultdict
def connector(bot, dispatcher, NICK, CHANNELS, PASSWORD=None):
@bot.on('client_connect')
async def connect(**kwargs):
bot.send('USER', user=NICK, realname=NICK)
if PASSWORD:
bot.send('PASS', password=PAS... | AiAeGames/DaniBot | dispatcher.py | Python | gpl-3.0 | 4,840 | 0.000207 |
# Copyright 2019 DeepMind Technologies Limited. 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 ... | deepmind/rlax | rlax/_src/nonlinear_bellman.py | Python | apache-2.0 | 7,670 | 0.004824 |
#!/usr/bin/env python
#
# qtfmt.py v1.10
# v1.10 : Updated to use Python 2.0 Unicode type.
#
# Read a document in the quotation DTD, converting it to a list of Quotation
# objects. The list can then be output in several formats.
__doc__ = """Usage: qtfmt.py [options] file1.xml file2.xml ...
If no filenames are provid... | Pikecillo/genna | external/PyXML-0.8.4/demo/quotes/qtfmt.py | Python | gpl-2.0 | 13,896 | 0.008923 |
"""
flask.ext.restless.search
~~~~~~~~~~~~~~~~~~~~~~~~~
Provides querying, searching, and function evaluation on SQLAlchemy models.
The most important functions in this module are the :func:`create_query`
and :func:`search` functions, which create a SQLAlchemy query object and
execute that que... | HellerCommaA/flask-angular | lib/python2.7/site-packages/flask_restless/search.py | Python | mit | 19,670 | 0.000153 |
import re, os, os.path
import Media, VideoFiles, Stack, Utils
import time
#
# this is a start to get to learn how to write scanners
#
debugfile = '/tmp/enigma2_movie_debug.log'
debug = True
def Scan(path, files, mediaList, subdirs, language=None, root=None, **kwargs):
def strip_name_from_ts_file(tsfile):
... | witjoh/enigma2_dreambox_scanner | Scanners/Movies/Enigma2 Debug Scanner.py | Python | gpl-2.0 | 7,163 | 0.006003 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "vps_monitor.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| J22Melody/VPS-Monitor | manage.py | Python | gpl-2.0 | 254 | 0 |
"""
# PROBLEM 31
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
It is possible to make £2 in the following way:
1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
How many different ways can £2 be made using a... | zejacobi/ProjectEuler | Solutions/0031.py | Python | unlicense | 2,719 | 0.004433 |
# -*- coding: utf-8 -*-
import unittest
from mock import MagicMock, patch
from py_inspector import verificadores
class CustomReport(unittest.TestCase):
def test_deve_retornar_quantidade_erros(self):
options = MagicMock()
report = verificadores.CustomReport(options)
report._deferred_print ... | Maethorin/py-inspector | tests/unitarios/test_validacao_pep8.py | Python | mit | 1,941 | 0.002061 |
"""
Preprocess
----------
"""
import numpy as np
import sklearn.preprocessing as skl_preprocessing
import bottlechest
import Orange.data
from . import impute, discretize
from ..misc.enum import Enum
__all__ = ["Continuize", "Discretize", "Impute", "SklImpute"]
def is_continuous(var):
return isinstance(var, Ora... | qusp/orange3 | Orange/preprocess/preprocess.py | Python | bsd-2-clause | 6,516 | 0.00046 |
# -*- coding: utf-8 -*-
# Copyright 2020 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... | googleads/google-ads-python | google/ads/googleads/v9/services/services/campaign_simulation_service/transports/base.py | Python | apache-2.0 | 3,952 | 0 |
"""
WSGI config for elmolino project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "elmolino.settings")
from django.core... | palichis/elmolino | elmolino/wsgi.py | Python | gpl-2.0 | 391 | 0.002558 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2008 Mozilla Corporation, Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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; ... | mozilla/verbatim | vendor/lib/python/translate/storage/tiki.py | Python | gpl-2.0 | 6,875 | 0.002327 |
#!/usr/bin/python
import argparse
import xml.etree.ElementTree as ET
def main():
parser = argparse.ArgumentParser(description="List all error without a CWE assigned in CSV format")
parser.add_argument("-F", metavar="filename", required=True, help="XML file containing output from: ./cppcheck --errorlist --xml... | bryongloden/cppcheck | tools/listErrorsWithoutCWE.py | Python | gpl-3.0 | 645 | 0.006202 |
#Interphase - Copyright (C) 2009 James Garnon <http://gatc.ca/>
#Released under the MIT License <http://opensource.org/licenses/MIT>
from __future__ import division
import os
from env import engine
__docformat__ = 'restructuredtext'
class Text(object):
"""
Receives text to display on surface.
Arguments ... | nordicpower/GameListPatch | interphase/util.py | Python | apache-2.0 | 17,408 | 0.003389 |
# Copyright (C) 2009 by Ning Shi and Andy Pavlo
# Brown University
#
# 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, cop... | ifcharming/original2.0 | tests/scripts/xml2/xmlparser.py | Python | gpl-3.0 | 6,723 | 0.00119 |
# -*- encoding: utf-8 -*-
from __future__ import division
import itertools
import operator
import collections
debug = True
to_bin = lambda integer: zero_filler(bin(integer)[2:])
def zero_filler(filling_string):
result = ""
if len(filling_string) != 4:
result = filling_string
else:
return ... | izevg/CryptoLabs | first_lab.py | Python | gpl-2.0 | 8,202 | 0.003447 |
# -*- coding: utf-8 -*-
# Automatic provisioning of Azure DNS zones.
import os
import azure
import json
from requests import Request
try:
from urllib import quote
except:
from urllib.parse import quote
from nixops.util import attr_property
from nixops.azure_common import ResourceDefinition, ResourceState, R... | coreyoconnor/nixops | nixops/resources/azure_dns_zone.py | Python | lgpl-3.0 | 4,631 | 0.003239 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2012 ChriCar Beteiligungs- und Beratungs- GmbH (<http://www.camptocamp.at>)
#
# Thi... | VitalPet/c2c-rd-addons | product_price_property/__openerp__.py | Python | agpl-3.0 | 1,905 | 0.009449 |
from .. import InstanceResource, ListResource
class IpAccessControlListMapping(InstanceResource):
def delete(self):
"""
Remove this mapping (disassociate the ACL from the Domain).
"""
return self.parent.delete_instance(self.name)
class IpAccessControlListMappings(ListResource):
... | danielvdao/facebookMacBot | venv/lib/python2.7/site-packages/twilio/rest/resources/sip/domains.py | Python | mit | 5,827 | 0 |
#########################################################################################
#
# Resample data using nibabel.
#
# ---------------------------------------------------------------------------------------
# Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca>
# Authors: Julien Cohen-Adad, Sara Dup... | neuropoly/spinalcordtoolbox | spinalcordtoolbox/resampling.py | Python | mit | 7,336 | 0.003544 |
'''
Created on 2009 eka 22
@author: peio
'''
# Copyright 2009 Jose Blanca, Peio Ziarsolo, COMAV-Univ. Politecnica Valencia
# This file is part of franklin.
# franklin 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 Softwa... | JoseBlanca/franklin | test/gmod/read_source_test.py | Python | agpl-3.0 | 3,791 | 0.006858 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "strecklista.settings.production")
application = get_wsgi_application()
| Majsvaffla/strecklista | strecklista/wsgi.py | Python | gpl-3.0 | 183 | 0.005464 |
"""Machine learning model"""
from copy import deepcopy
import logging
from operator import itemgetter
from pathlib import Path
import shutil
from tempfile import TemporaryDirectory
from typing import List, Tuple, Dict, Any, Callable
import tensorflow as tf
from tensorflow.estimator import ModeKeys, Estimator
from ten... | yoeo/guesslang | guesslang/model.py | Python | mit | 6,714 | 0 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... | agry/NGECore2 | scripts/mobiles/tatooine/bantha_matriarch.py | Python | lgpl-3.0 | 1,676 | 0.02685 |
from rest_framework import serializers
from bulbs.utils.fields import RichTextField
from bulbs.utils.data_serializers import CopySerializer, EntrySerializer, BaseEntrySerializer
from .fields import ColorField
class XYEntrySerializer(BaseEntrySerializer):
title = RichTextField(required=False, field_size="short")
... | theonion/django-bulbs | bulbs/infographics/data_serializers.py | Python | mit | 1,619 | 0.000618 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.urlresolvers import reverse_lazy
from django.conf import settings
from rest_framework import serializers
from rest_flex_fields import FlexFieldsModelSerializer
from rest_flex_fields.serializers import FlexFieldsSerializerMixin
from easy... | hzlf/openbroadcast.org | website/apps/alibrary/apiv2/serializers.py | Python | gpl-3.0 | 9,901 | 0.000707 |
from . import base
from . import mainMenu
from . import utils
| Aiacos/DevPyLib | mayaLib/guiLib/__init__.py | Python | agpl-3.0 | 62 | 0 |
import unittest, tempfile, os.path
from gitdh.config import Config
from gitdh.git import Git
from subprocess import check_output
class GitdhConfigGitTestCase(unittest.TestCase):
def setUp(self):
self.cStr = """
[Git]
RepositoryPath = /var/lib/gitolite/repositories/test.git
[Database]
Engine = sqlite
DatabaseFile ... | seoester/Git-Deployment-Handler | gitdh/tests/configgit.py | Python | mit | 2,693 | 0.022651 |
from django.contrib.messages import constants
from django.contrib.messages.storage.fallback import (
CookieStorage, FallbackStorage,
)
from django.test import SimpleTestCase
from .base import BaseTests
from .test_cookie import set_cookie_data, stored_cookie_messages_count
from .test_session import set_session_data... | frishberg/django | tests/messages_tests/test_fallback.py | Python | bsd-3-clause | 6,536 | 0.000459 |
delivery_head = [
{
"seq": 1,
"len": 5,
"type": "A",
"col": "codenr",
"req": True,
"def": "E",
"allowed": ["E"],
"comment": "Code enregistrement",
},
{
"seq": 2,
"len": 20,
"type": "A",
"col": "cmdcli",
"... | akretion/logistics-center | stef_logistics/data/flow_delivery.py | Python | agpl-3.0 | 1,924 | 0 |
"Memcached cache backend"
from django.core.cache.backends.base import BaseCache, InvalidCacheBackendError
from django.utils.encoding import smart_unicode, smart_str
from google.appengine.api import memcache
class CacheClass(BaseCache):
def __init__(self, server, params):
BaseCache.__init__(self, params)
... | thomazs/geraldo | site/newsite/site-geraldo/django/core/cache/backends/memcached.py | Python | lgpl-3.0 | 1,303 | 0.00307 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | CubicERP/odoo | addons/stock_landed_costs/stock_landed_costs.py | Python | agpl-3.0 | 20,934 | 0.004395 |
#!/usr/bin/env python
# ***** BEGIN LICENSE BLOCK *****
# 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/.
# ***** END LICENSE BLOCK *****
import sys
import os
# load mod... | cstipkovic/spidermonkey-research | testing/mozharness/scripts/b2g_desktop_multilocale.py | Python | mpl-2.0 | 9,106 | 0.002745 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.