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 |
|---|---|---|---|---|---|---|
from os import path
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response, render, redirect
from django.http import HttpResponseRedirect, HttpResponse
from django.template import RequestContext
from django.views... | Rhombik/rhombik-object-repository | project/views.py | Python | agpl-3.0 | 13,528 | 0.016263 |
from os.path import dirname, realpath
from jinja2 import Environment, FileSystemLoader
from google.appengine.ext import ndb
DEBUG = True
SECRET_KEY = 'asdfjasdflkjsfewi23kjl3kjl45kjl56jk6hjb76vsjsa'
CONFIG = {
}
SRC_ROOT = dirname(realpath(__file__))
JINJA_ENVIRONMENT = Environment(
loader=FileSystemLoader(S... | Tjorriemorrie/housing | src/settings.py | Python | mit | 496 | 0.002016 |
"""Tests for the Subaru component config flow."""
# pylint: disable=redefined-outer-name
from copy import deepcopy
from unittest import mock
from unittest.mock import patch
import pytest
from subarulink.exceptions import InvalidCredentials, InvalidPIN, SubaruException
from homeassistant import config_entries
from hom... | Danielhiversen/home-assistant | tests/components/subaru/test_config_flow.py | Python | apache-2.0 | 8,146 | 0.000123 |
from __future__ import unicode_literals
from functools import total_ordering
from django.contrib.gis.geos import (
LinearRing, LineString, Point, Polygon, fromstr,
)
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
from django.utils.html import html_safe
@html_safe
@pyt... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/Django-1.9-py2.7.egg/django/contrib/gis/maps/google/overlays.py | Python | artistic-2.0 | 11,955 | 0.000836 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import sys
class Xsdk(BundlePackage):
"""Xsdk is a suite of Department of Energy (DOE) packages... | rspavel/spack | var/spack/repos/builtin/packages/xsdk/package.py | Python | lgpl-2.1 | 9,658 | 0.003417 |
from django.conf.urls import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'schwag.views.home', name='home'),
url(r'^... | endthestart/schwag | schwag/schwag/urls.py | Python | mit | 1,849 | 0.005949 |
"""One-time script for extracting all the cat and dog images from CIFAR-10."""
import cPickle
import numpy as np
from PIL import Image
TRAIN_FILES = ['cifar-10-batches-py/data_batch_%d' % i for i in range(1,6)]
TEST_FILE = 'test_batch'
CAT_INPUT_LABEL = 3
DOG_INPUT_LABEL = 5
CAT_OUTPUT_LABEL = 1
DOG_OUTPUT_LABEL = ... | random-forests/tensorflow-workshop | archive/extras/cat_dog_estimator/extract_cats_dogs.py | Python | apache-2.0 | 1,545 | 0.01165 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import bottle
import datetime
import time
@bottle.get('/')
def index():
return bottle.static_file('index.html', root='.')
@bottle.get('/stream')
def stream():
bottle.response.content_type = 'text/event-stream'
bottle.response.cache_control = 'no... | hustbeta/python-web-recipes | server-sent-events/bottle-sse.py | Python | mit | 517 | 0.005803 |
from . import NetworkObject
import z3
class AclFirewall (NetworkObject):
def _init(self, node, network, context):
super(AclFirewall, self).init_fail(node)
self.fw = node.z3Node
self.ctx = context
self.constraints = list ()
self.acls = list ()
network.SaneSend (self)
... | apanda/modeling | mcnet/components/aclfirewall.py | Python | bsd-3-clause | 2,245 | 0.015145 |
#! /usr/bin/env python
import os
import Tkinter as Tk
import tkFileDialog, tkMessageBox
import shelve
import time
from scipy.odr.odrpack import *
from scipy.ndimage import minimum_position
from pylab import *
import pylab
from PIL import Image
from PIL import ImageTk
from GRCFcommonFunctions import fig2img, fig2da... | latrop/GRCF | GRCFlibs/GRCFifaceFunctions.py | Python | gpl-3.0 | 80,548 | 0.004407 |
#!/usr/bin/env python3
"""
Copyright (C) 2020, Alexandre Gazet.
This file is part of ret-sync plugin for Binary Ninja.
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, includ... | bootleg/ret-sync | ext_bn/retsync/__init__.py | Python | gpl-3.0 | 2,930 | 0.003413 |
from __future__ import print_function, absolute_import, division
import numpy as np
from numba.cuda.testing import unittest
from numba import cuda
import operator
class TestOperatorModule(unittest.TestCase):
"""
Test if operator module is supported by the CUDA target.
"""
def operator_template(self, ... | stefanseefeld/numba | numba/cuda/tests/cudapy/test_operator.py | Python | bsd-2-clause | 899 | 0 |
import numpy as np
from ..weight import RankingBasedSelection
class NESSelection(RankingBasedSelection):
"""
This selection scheme is Non-increasing transformation as NES weight. See also,
[Wierstra et. al., 2014]<http://jmlr.org/papers/v15/wierstra14a.html>
"""
def transform(self, rank_based_val... | satuma777/evoltier | evoltier/selection/nes_selection.py | Python | gpl-3.0 | 510 | 0.003922 |
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
from scipy.spatial import distance
import matplotlib.pyplot as plt
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn.datasets.samples_generator import make_blobs
from sklearn.preprocessing import StandardScaler
from s... | banacer/door-wiz | src/identification/Identifier.py | Python | mit | 1,449 | 0.006901 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
# Meta-info
Author: Nelson Brochado
Created: 03/09/2015
Updated: 07/03/2018
# Description
# TODO
- Add description.
- Add complexity analysis.
- Add documentation to functions.
"""
__all__ = ["recursive_subset_sum", "bottom_up_subset_sum"]
from pprint import p... | nbro/ands | ands/algorithms/dp/subset_sum.py | Python | mit | 3,075 | 0 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Ericsson AB
#
# 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 ... | EricssonResearch/calvin-base | calvinextras/calvinsys/media/audio/play/BasePlay.py | Python | apache-2.0 | 1,328 | 0.002259 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Buron
# Copyright 2015, TODAY Clouder SASU
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License with Attribution
# ... | nicolas-petit/clouder | clouder/clouder_runner_docker/runner.py | Python | gpl-3.0 | 7,557 | 0.000662 |
import os
from ConfigParser import ConfigParser
from lbryumserver import deserialize
from lbryumserver.claims_storage import ClaimsStorage
from lbryumserver.processor import Dispatcher
from .fixtures import raw_tx_with_claim
def _get_config_for_test_storage(tmpdir):
config = ConfigParser()
config.add_section... | lbryio/lbryum-server | benchmarks/test_claims.py | Python | agpl-3.0 | 1,512 | 0.000661 |
import requests
import json
import logging
LOG = logging.getLogger(__name__)
class Forwarder(object):
def __init__(self):
this.fwd_url = 'http://localhost:9999/forward'
def forward(self, reason, host=None, data=None):
body = {
'reason': reason
}
if host is not None... | dscottcs/superluminal | superluminal/sample/forward_sample.py | Python | apache-2.0 | 510 | 0.001961 |
# -*- coding: utf-8 -*-
'''
Creates a Gene Wiki protein box template around a gene specified by
the first argument passed to it on the command line.
Usage: `python create_template.py <entrez_id>`
'''
import sys
from genewiki.mygeneinfo import parse
if len(sys.argv[1]) > 1:
entrez = sys.argv[1]
try: in... | SuLab/genewiki | old-assets/scripts/create_template.py | Python | mit | 480 | 0.004167 |
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014, 2019 zordsdavini
# Copyright (c) 2014 Alexandr Kriptonov
# Copyright (c) 2014 Tycho Andersen
#
# 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 Softw... | ramnes/qtile | libqtile/widget/gmail_checker.py | Python | mit | 2,825 | 0.000354 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorboard | tensorboard/plugins/hparams/download_data_test.py | Python | apache-2.0 | 8,571 | 0.00035 |
#!/usr/bin/env py.test
import pytest
import numpy
from dolfin import *
def test_manifold_point_search():
# Simple two-triangle surface in 3d
vertices = [
(0.0, 0.0, 1.0),
(1.0, 1.0, 1.0),
(1.0, 0.0, 0.0),
(0.0, 1.0, 0.0),
]
cells = [
(0, 1, 2),
(0, 1... | FEniCS/dolfin | test/unit/python/mesh/test_manifold_point_search.py | Python | lgpl-3.0 | 971 | 0 |
__pretty_app_name__ = "Gonvert"
__app_name__ = "gonvert"
__version__ = "1.1.6"
__build__ = 0
__app_magic__ = 0xdeadbeef
PROFILE_STARTUP = False
IS_MAEMO = True
| epage/Gonvert | gonvert/constants.py | Python | gpl-2.0 | 161 | 0 |
# -*- python -*-
# Copyright (C) 2009 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.
#
... | GeeteshKhatavkar/gh0st_kernel_samsung_royxx | arm-2010.09/arm-none-eabi/lib/armv6-m/libstdc++.a-gdb.py | Python | gpl-2.0 | 2,346 | 0.00682 |
# encoding: utf-8
"""
trends.py -- Analysis of trends in response changes across mismatch angle
Exported namespace: MismatchTrends
Created by Joe Monaco on 2010-02-17.
Copyright (c) 2009-2011 Johns Hopkins University. All rights reserved.
This software is provided AS IS under the terms of the Open Source MIT Licens... | jdmonaco/vmo-feedback-model | src/remapping/trends.py | Python | mit | 9,633 | 0.005294 |
# The MIT License (MIT)
#
# Copyright (c) 2015 Christian Zielinski
#
# 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... | czielinski/portfolioopt | portfolioopt/portfolioopt.py | Python | mit | 9,550 | 0.001152 |
from pathutils import full_path
CONFIG = {
"entityid" : "urn:mace:example.com:saml:roland:sp",
"name" : "urn:mace:example.com:saml:roland:sp",
"description": "My own SP",
"service": {
"sp": {
"endpoints":{
"assertion_consumer_service": ["http://lingon.catalogix.se:80... | arbn/pysaml2 | tests/sp_2_conf.py | Python | bsd-2-clause | 1,571 | 0.007638 |
import json
import os
import subprocess
import uuid
import passlib.hash
import pytest
import gen
import gen.build_deploy.aws
import release
from dcos_installer import backend
from dcos_installer.config import Config, make_default_config_if_needed, to_config
os.environ["BOOTSTRAP_ID"] = "12345"
@pytest.fixture(scop... | darkonie/dcos | dcos_installer/test_backend.py | Python | apache-2.0 | 12,196 | 0.002378 |
import requests_mock
from django.conf import settings
from jingo.helpers import urlparams
from nose.tools import eq_, ok_
from pyquery import PyQuery as pq
from waffle.models import Flag
from kuma.core.urlresolvers import reverse
from . import UserTestCase
from .test_views import TESTUSER_PASSWORD
def add_persona_v... | darkwing/kuma | kuma/users/tests/test_templates.py | Python | mpl-2.0 | 13,321 | 0.00015 |
from raptiformica.settings import conf
from raptiformica.shell.consul import ensure_latest_consul_release
from tests.testcase import TestCase
class TestEnsureLatestConsulRelease(TestCase):
def setUp(self):
self.log = self.set_up_patch('raptiformica.shell.consul.log')
self.execute_process = self.se... | vdloo/raptiformica | tests/unit/raptiformica/shell/consul/test_ensure_latest_consul_release.py | Python | mit | 2,741 | 0.002189 |
# Invert gray image
import cv2
from . import print_image
from . import plot_image
def invert(img, device, debug=None):
"""Inverts grayscale images.
Inputs:
img = image object, grayscale
device = device number. Used to count steps in the pipeline
debug = None, print, or plot. Print = save ... | AntonSax/plantcv | plantcv/invert.py | Python | mit | 794 | 0.001259 |
import functools
import inspect
import logging
import os
import sys
import typing as t
import weakref
from datetime import timedelta
from itertools import chain
from threading import Lock
from types import TracebackType
from werkzeug.datastructures import Headers
from werkzeug.datastructures import ImmutableDict
from ... | mitsuhiko/flask | src/flask/app.py | Python | bsd-3-clause | 82,515 | 0.000267 |
#!/usr/bin/env python
# Copyright 2012 (C) Mickael Menu <mickael.menu@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
# (at your option) any lat... | fredokun/TikZ-Editor | setup.py | Python | gpl-2.0 | 1,449 | 0.031056 |
import csv
import json
import sys
import traceback
from six.moves import StringIO
import requests
import mock
import gevent
from gevent import wsgi
from locust import web, runners, stats
from locust.runners import LocustRunner
from locust.main import parse_options
from .testcases import LocustTestCase
class TestWebU... | pmdarrow/locust | locust/test/test_web.py | Python | mit | 3,957 | 0.009351 |
from model_utils import Choices
COUNTRIES = Choices(
('AF', 'Afghanistan'),
('AX', 'Aland Islands'),
('AL', 'Albania'),
('DZ', 'Algeria'),
('AS', 'American Samoa'),
('AD', 'Andorra'),
('AO', 'Angola'),
('AI', 'Anguilla'),
('AQ', 'Antarctica'),
('AG', 'Antigua and Barbuda'),
... | kartikshah1/Test | user_profile/countries.py | Python | mit | 6,689 | 0 |
import functools
from pyp2rpm import settings
def memoize_by_args(func):
"""Memoizes return value of a func based on args."""
memory = {}
@functools.wraps(func)
def memoized(*args):
if not args in memory.keys():
value = func(*args)
memory[args] = value
return ... | henrysher/spec4pypi | pyp2rpm/utils.py | Python | mit | 1,076 | 0.004647 |
"""
Import celery, load its settings from the django settings
and auto discover tasks in all installed django apps.
Taken from: https://celery.readthedocs.org/en/latest/django/first-steps-with-django.html
"""
from __future__ import absolute_import
import os
from celery import Celery
from django.conf import settings
... | ahmedaljazzar/edx-platform | cms/celery.py | Python | agpl-3.0 | 1,791 | 0.003908 |
from dbhelper import DBHelper
from flask import Flask
from flask import render_template
from flask import request
app = Flask(__name__)
DB = DBHelper()
@app.route("/")
def home():
try:
data = DB.get_all_inputs()
except Exception as e:
print e
data = None
return render_template("ho... | abacuspix/NFV_project | Flask_By_Example/chapter6/crimemap.py | Python | mit | 726 | 0 |
# -*- coding: utf-8 -*-
'''
script.matchcenter - Football information for Kodi
A program addon that can be mapped to a key on your remote to display football information.
Livescores, Event details, Line-ups, League tables, next and previous matches by team. Follow what
others are saying about the match ... | hwoods723/script.gamescenter | main.py | Python | gpl-2.0 | 2,988 | 0.005689 |
#coding=utf-8
#2017.10.3£¬Flash,ship class
import pygame
class Ship():
def __init__(self,ai_settings,screen):
"""³õʼ»¯·É´¬²¢ÉèÖÃÆä³õʼλÖÃ"""
self.screen=screen
self.ai_settings = ai_settings
#¼ÓÔØ·É´¬Í¼Ïñ²¢»ñÈ¡ÆäÍâ½Ó¾ØÐÎ
self.image=pygame.image.load("images/ship.bmp")
self.rect=self.imag... | FlashXT/XJTU_WorkLog | 2017.10/Engineering/PyGame/alien_invasion/ship.py | Python | gpl-3.0 | 1,131 | 0.052166 |
import sys
import os
from . import io
from . import root_paths
from abc import *
def ninja_esc_path(path):
return path.replace('$','$$').replace(' ','$ ').replace(':', '$:')
def xlat_path(project, path):
"""Translate common prefix to variable reference."""
if path.startswith(project.projectDir):
... | fifoforlifo/pynja | packages/pynja/build.py | Python | apache-2.0 | 15,654 | 0.005366 |
import datetime
from pinax.apps.signup_codes.models import SignupCode
def stats():
return {
"signup_codes_total": SignupCode.objects.count(),
"signup_codes_sent": SignupCode.objects.filter(sent__isnull=True).count(),
"signup_codes_used": SignupCode.objects.filter(use_count__gt=0).count(),... | manufacturedba/pinax | pinax/apps/signup_codes/stats.py | Python | mit | 548 | 0.00365 |
#!/usr/bin/python2.4
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
import ez_setup
ez_setup.use_setuptools()
from glob import glob
from setuptools import setup, Extension
NAME = "pycopia-SMI"
VERSION = "1.0a2"
ENAME = NAME.replace("-", "_")
DNAME = NAME.split("-", 1)[-1]
_libsmi = Extension("_libsmi", ["libs... | xiangke/pycopia | SMI/setup.py | Python | lgpl-2.1 | 1,514 | 0.044914 |
import itertools
from ..mixin import ValueType
from .int_c import IntConstraint
from .. import objtypes
array_supers = 'java/lang/Object','java/lang/Cloneable','java/io/Serializable'
obj_fset = frozenset([objtypes.ObjectTT])
def isAnySubtype(env, x, seq):
return any(objtypes.isSubtype(env,x,y) for y in seq)
clas... | alexkasko/krakatau-java | krakatau-lib/src/main/resources/Lib/Krakatau/ssa/constraints/obj_c.py | Python | gpl-3.0 | 4,428 | 0.005194 |
#
# Written by Luke Kenneth Casson Leighton <lkcl@lkcl.net>
# This theme is demonstrates how to
#this import statement allows access to the karamba functions
import karamba
drop_txt = None
#this is called when you widget is initialized
def initWidget(widget):
# this resets the text to "" so we know we've nev... | serghei/kde3-kdeutils | superkaramba/examples/setIncomingData/2.py | Python | gpl-2.0 | 2,246 | 0.007124 |
import os, platform
sysstr = platform.system()
if sysstr == "Windows":
LF = '\r\n'
elif sysstr == "Linux":
LF = '\n'
def StripStr(str):
# @Function: Remove space(' ') and indent('\t') at the begin and end of the string
oldStr = ''
newStr = str
while oldStr != newStr:
oldStr = newStr
... | seims/SEIMS | scenario_analysis/util.py | Python | gpl-2.0 | 1,939 | 0.00361 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorflow | tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/shapes_for_arguments.py | Python | apache-2.0 | 1,730 | 0.009827 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from PyQt4 import QtGui,QtCore
from Ui_about_author import Ui_About
_IME = "<p>Author: Bojan Ili""ć</p>"
_FAKULTET = "Faculty of Electrical Engineering, University of Belgrade - ETF"
_MAIL = "https.rs@gmail.com"
_URL = "<a href = ""https://www.... | puyilio/Application-for-PyBoard | About_author.py | Python | gpl-3.0 | 1,254 | 0.011962 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('MSG', '0017_auto_20150917_0707'),
]
operations = [
migrations.RemoveField(
model_name='content',
nam... | rajeev001114/Grade-Recording-System | project/MSG/migrations/0018_auto_20150917_0722.py | Python | gpl-3.0 | 550 | 0 |
# coding=UTF-8
from datetime import timedelta
import resource
import time
import urllib
from django.core.exceptions import ObjectDoesNotExist
from snh.models.youtubemodel import *
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
import snhlogger
logger = snhlogger.init_logger(__name__, ... | pylanglois/Social-Network-Harvester | SocialNetworkHarvester/snh/management/commands/cronharvester/youtubech.py | Python | bsd-3-clause | 8,013 | 0.009485 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_11_01/models/azure_reachability_report_parameters_py3.py | Python | mit | 2,234 | 0.000895 |
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
# Map PageElement constructor arguments to webdriver locator enums
_LOCATOR_MAP = {'css': By.CSS_SELECTOR,
'id_': By.ID,
'name': By.NAME,
'xpath': By.XPATH,
... | julietalucia/page-objects | page_objects/__init__.py | Python | mit | 4,653 | 0.001075 |
'''
Visual Stimulus codebase implements several classes to display stimulus routines.
Can display frame by frame or compress data for certain stimulus routines and
display by index. Used to manage information between experimental devices and
interact with `StimulusRoutines` to produce visual display and log data. May a... | zhuangjun1981/retinotopic_mapping | retinotopic_mapping/DisplayStimulus.py | Python | gpl-3.0 | 29,197 | 0.002432 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Import system libs
import re
class WWW():
def __init__(self):
pass
def get_domain(self, site):
if site.startswith('https://'):
site = site[8:-1]
elif site.startswith('http://'):
site = site[7:-1]
return s... | soarpenguin/python-scripts | www-url.py | Python | gpl-3.0 | 823 | 0.013564 |
from sys import maxsize
class Contact:
def __init__(self, firstname=None, lastname=None, company=None, homephone=None, workphone=None, mobilephone=None, secondphone=None, address=None, year=None, secondaddress=None, id=None):
self.firsrtname=firstname
self.lastname=lastname
self.company=c... | volkodav1985/volkodavpython | model/contact.py | Python | apache-2.0 | 957 | 0.015674 |
#!/usr/bin/python
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 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 ab... | andir/ganeti | lib/tools/burnin.py | Python | bsd-2-clause | 47,078 | 0.00822 |
# -*- coding: utf-8 -*-
"""
gspread
~~~~~~~
Google Spreadsheets client library.
"""
__version__ = '0.2.1'
__author__ = 'Anton Burnashev'
from .client import Client, login
from .models import Spreadsheet, Worksheet, Cell
from .exceptions import (GSpreadException, AuthenticationError,
Spread... | CPedrini/TateTRES | gspread/__init__.py | Python | apache-2.0 | 475 | 0 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2016 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Michael Sandoz <michaelsandoz87@gmail.com>, Emanuel Cino
#
# The licence is in ... | emgirardin/compassion-modules | child_compassion/controllers/web_children_hold.py | Python | agpl-3.0 | 2,889 | 0 |
# -*- coding: utf-8 -*-
# Action Launcher Bot: This is a bot how can execute differents actions depends commands
# Code wrote by Zagur of PortalLinux.es and modified by NeoRanger of neositelinux.com
# For a good use of the bot please read the README file
import telebot
from telebot import types
import time
... | neoranger/ActionLauncher | action_launcher.py | Python | gpl-3.0 | 8,866 | 0.012407 |
# coding: utf-8
from django.test import TestCase
from django.db import IntegrityError
from datetime import datetime
from eventex.subscriptions.models import Subscription
class SubscriptionTest(TestCase):
def setUp(self):
self.obj = Subscription(
name='Henrique Bastos',
cpf='1234567... | klebercode/lionsclub | eventi/subscriptions/tests/test_models.py | Python | mit | 1,854 | 0.001618 |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.c... | landism/pants | src/python/pants/backend/codegen/antlr/java/register.py | Python | apache-2.0 | 791 | 0.005057 |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
"""
Identities module forms
"""
from django import forms
from django.core.files.storage import default_storage
from django.template import defaultfilters
from django.core.urlresolvers import reverse
from dja... | thiagof/treeio | treeio/identities/forms.py | Python | mit | 15,660 | 0.00166 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-securitycenter | samples/generated_samples/securitycenter_v1_generated_security_center_get_iam_policy_sync.py | Python | apache-2.0 | 1,489 | 0.000672 |
import nltk
import string
import operator
from collections import Counter
#
# def get_tokens():
# with open('/home/davyx8/Downloads/data sets/lebowski/fargo.txt', 'r') as shakes:
# text = shakes.read()
# lowers = text.lower()
# #remove the punctuation using the character deletion step of translate
# ... | davyx8/Python | PRODICTIVE/tfidf.py | Python | gpl-3.0 | 2,184 | 0.005495 |
import unittest
import random
from ..frame import Frame, decode_frame
from ..message import MessageType
from ..utilslib.strings import random_bytes
class FrameTestCase(unittest.TestCase):
MSG_TYPE = MessageType.HELLO
PAYLOAD = "Hello World!"
def frame_setup(self, msg_type, payload):
self.msg_type... | abranches/backmonitor | backmonitor/tests/frame_tests.py | Python | apache-2.0 | 1,806 | 0.001661 |
import os
import tarfile
from contextlib import closing
from archie import helpers
def find_backup(cfg):
files = []
rcfiles = cfg.options('rcfiles')
for rc in rcfiles:
backup = helpers.get_backupfile(cfg, rc)
rcfile = helpers.get_rcfile(cfg, rc)
if os.path.lexists(backup) and tarfil... | fudanchii/archie | archie/handlers/restore.py | Python | mit | 753 | 0.003984 |
from django.conf.urls import include, url
from django.contrib import admin
def i18n_javascript(request):
return admin.site.i18n_javascript(request)
urlpatterns = [
url(r'^$', 'GeneralReport.views.index'),
url(r'^sgrs/', include('GeneralReport.urls')),
url(r'^admin/jsi18n', i18n_javascript),
url(r'... | JackyChou/SGRS | SGRS/urls.py | Python | gpl-2.0 | 359 | 0.005571 |
#!/usr/bin/env python3
# This file is part of OpenSoccerManager.
#
# OpenSoccerManager 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 ver... | OpenSoccerManager/opensoccermanager | uigtk/window.py | Python | gpl-3.0 | 3,411 | 0.002345 |
'''
Library for doing fun things with computers.
'''
__author__ = 'Andrew M Bates'
__version__ = '0.001'
import io, os, sys
# the core imports go here
# this should go in in the mods dir
try:
'''IF RASPBERRY PI & HAS A GPIO BOARD'''
import RPi.GPIO as RPi
except ImportError:
pass
| andrewbates09/FERGUS | fergus/__init__.py | Python | gpl-3.0 | 291 | 0.024055 |
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 14 20:43:12 2016
@author: Adrien
"""
import canpy.point_defects
def defects_movie(dl,t_start='standard',t_end='standard'):
'''
Produce a movie in mp4 format of the defects.
t_start is the time at which we want the movie to begin and t_end is th... | ruaultadrien/canpy | canpy/defects_movie.py | Python | gpl-3.0 | 2,116 | 0.025083 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pastevim.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| m110/pastevim | manage.py | Python | gpl-2.0 | 251 | 0 |
import discord
from discord.ext import commands
from .utils.dataIO import fileIO
from .utils import checks
from __main__ import user_allowed, send_cmd_help
import os
class CustomCommands:
"""Custom commands."""
def __init__(self, bot):
self.bot = bot
self.c_commands = fileIO("data/customcom/co... | Ckrisirkc/Red-DiscordBot | cogs/customcom.py | Python | gpl-3.0 | 5,602 | 0.003213 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from sentry.nodestore.django.models import Node
from sentry.nodestore.django.backend import DjangoNodeStorage
from sentry.testutils import TestCase
class DjangoNodeStorageTest(TestCase):
def setUp(self):
self.ns = DjangoNodeStorage()
de... | rdio/sentry | tests/sentry/nodestore/django/backend/tests.py | Python | bsd-3-clause | 2,382 | 0.001679 |
#coding:utf-8
import hashlib, datetime, pdb
from Yep import system_tags, system_schools
MD5PERFIX = "YEPS_WEIMI"
def md5_pwd(pwd):
return hashlib.new("md5", MD5PERFIX + pwd).hexdigest()
# 检查标签是否合法
def check_user_tag(tags):
tag_list = system_tags.tag_list
for tag in tags:
if tag not in tag_list:... | hezuoguang/Yeps-Server | Yeps/Yep/tools.py | Python | mit | 943 | 0.009967 |
#!/usr/bin/env python
"""Gather information from the registry on windows."""
import re
import stat
from grr.lib import aff4
from grr.lib import artifact
from grr.lib import artifact_lib
from grr.lib import flow
from grr.lib import rdfvalue
from grr.lib import utils
from grr.proto import flows_pb2
class RegistryFind... | ojengwa/grr | lib/flows/general/registry.py | Python | apache-2.0 | 6,980 | 0.008739 |
import statsmodels.api as sm
import numpy as np
class LSM(object):
def __init__(self, lambdas):
self.lambdas = lambdas
def calc(self, y, x):
X = np.zeros((len(x), len(self.lambdas)))
for i in range(0, len(self.lambdas)):
X[:, i] = self.lambdas[i](x)
ols = sm.OLS(... | exleym/simpaq | solvers/regressions.py | Python | mit | 390 | 0 |
# Inviwo Python script
import inviwo
inviwo.loadTransferFunction("SimpleRaycaster.transferFunction",inviwo.getDataPath() + "transferfunction.itf")
| sarbi127/inviwo | data/scripts/loadtransferfunction.py | Python | bsd-2-clause | 150 | 0.026667 |
# -*- coding: utf-8 -*-
'''
Use a git repository as a Pillar source
---------------------------------------
.. note::
This external pillar has been rewritten for the :doc:`2015.8.0
</topics/releases/2015.8.0>` release. The old method of configuring this
external pillar will be maintained for a couple relea... | smallyear/linuxLearn | salt/salt/pillar/git_pillar.py | Python | apache-2.0 | 16,836 | 0 |
from casexml.apps.case.models import CommCareCase
from dimagi.utils.decorators.memoized import memoized
from touchforms.formplayer.api import post_data
import json
from django.conf import settings
from corehq.apps.cloudcare import CLOUDCARE_DEVICE_ID
from django.core.urlresolvers import reverse
from corehq.apps.users.m... | SEL-Columbia/commcare-hq | corehq/apps/cloudcare/touchforms_api.py | Python | bsd-3-clause | 4,169 | 0.003118 |
#!/usr/bin/env python
## \file filter_adjoint.py
# \brief Applies various filters to the adjoint surface sensitivities of an airfoil
# \author T. Lukaczyk, F. Palacios
# \version 5.0.0 "Raven"
#
# SU2 Lead Developers: Dr. Francisco Palacios (Francisco.D.Palacios@boeing.com).
# Dr. Thomas D. Ec... | cspode/SU2 | SU2_PY/SU2/util/filter_adjoint.py | Python | lgpl-2.1 | 16,651 | 0.025404 |
#!/usr/bin/python
# coding=utf-8
# Copyright 2012-2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | amidvidy/mongo-orchestration | mongo_orchestration/sharded_clusters.py | Python | apache-2.0 | 18,384 | 0.000925 |
from django.conf import settings
from django.db import models
# Create your models here.
from products.models import Product
class Transaction(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL)
product = models.ForeignKey(Product)
price = models.DecimalField(max_digits=100, decimal_places=2, defaul... | codingforentrepreneurs/digital-marketplace | src/billing/models.py | Python | mit | 589 | 0.027165 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 AYDIN Ali-Kémal
# 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
... | vlegoff/tsunami | src/secondaires/calendrier/evenement.py | Python | bsd-3-clause | 4,012 | 0.006263 |
"""
Any vector field U can be decomposed into a divergence free term
Ud and the gradient of a scalar, phi:
U = Ud + phi
This program recovers a divergemce-free filed on a 2-d grid.
Marina von Steinkirch, based on M. Zingale's codes, spring 2013
"""
from part_a import doPartA
from part_b i... | bt3gl/Numerical-Methods-for-Physics | homework5_elliptic_PDES/main.py | Python | apache-2.0 | 2,009 | 0.019413 |
# -*- coding: utf-8 -*-
# ###
# Copyright (c) 2013, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
import uuid
from sqlalchemy.types import TypeDecorator, CHAR
from sqlalchemy.dialects.postgresql import UUI... | Connexions/cnx-user | cnxuser/_sqlalchemy.py | Python | agpl-3.0 | 1,342 | 0 |
import pygame
import sys
pygame.init()
class Input:
def __init__(self):
self.shift = False
self.white = (255,255,255)
self.red = (255,10,10)
self.black = (0,0,0)
def get_key(self):
while True:
event = pygame.event.poll()
if event.type == pygame.QUIT:
p... | fapable/pygameproject2 | Input.py | Python | apache-2.0 | 2,779 | 0.031306 |
from rest_framework import serializers
class AttachmentSerializer(serializers.Serializer):
pass
"""
//*
// As of 2017-06-13, up to 38 attachments can be worn per agent
// max of 328 bytes per attach point (if name and description are maxed out).
// x38 = 12464 bytes
// without descriptions: 188 * 38 = 7144 by... | tapple/nsize-web | nsize/body_detector/serializers.py | Python | agpl-3.0 | 1,173 | 0.00341 |
import logging
import pytest
from traitlets.config import Config
from dockerspawner import DockerSpawner
def test_deprecated_config(caplog):
cfg = Config()
cfg.DockerSpawner.image_whitelist = {"1.0": "jupyterhub/singleuser:1.0"}
log = logging.getLogger("testlog")
spawner = DockerSpawner(config=cfg,... | jupyter/dockerspawner | tests/test_deprecations.py | Python | bsd-3-clause | 972 | 0.001029 |
# test for xml.dom.minidom
from xml.dom.minidom import parse, Node, Document, parseString
from xml.dom import HierarchyRequestErr
import xml.parsers.expat
import os
import sys
import traceback
from test_support import verbose
if __name__ == "__main__":
base = sys.argv[0]
else:
base = __file__
tstfile = os.pa... | mancoast/CPythonPyc_test | cpython/223_test_minidom.py | Python | gpl-3.0 | 19,230 | 0.005668 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
DsgTools
A QGIS plugin
Brazilian Army Cartographic Production Tools
-------------------
begin : 2019-09-03
git sha ... | lcoandrade/DsgTools | gui/CustomWidgets/OrderedPropertyWidgets/orderedTableWidget.py | Python | gpl-2.0 | 24,412 | 0.001352 |
# Django settings for math-club project.
import dj_database_url
import os
from os import environ
from urlparse import urlparse
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
if environ.has_key('DATABASE_URL'):
DEBUG = False
DATABASES = {
'default': dj_database_url.conf... | joshcai/utdmathclub | math-club/settings.py | Python | mit | 5,912 | 0.002368 |
# -*- coding: utf-8 -*-
#
from django.dispatch import receiver
from django.db.models.signals import m2m_changed
from django_auth_ldap.backend import populate_user
from django.conf import settings
from django_cas_ng.signals import cas_user_authenticated
from jms_oidc_rp.signals import openid_create_or_update_user
fro... | zsjohny/jumpserver | apps/users/signals_handler.py | Python | gpl-2.0 | 2,429 | 0.001249 |
__author__ = 'David Magee, Carolina Correia, and Kevin Rue-Albrecht'
__copyright__ = "Copyright 2014, GPLv2"
from . import RNAseqIO
from . import SeqDataTypes
| kevinrue/RNAfastqDeconvolute | src/__init__.py | Python | gpl-2.0 | 160 | 0 |
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import models
from . import wizard
| OCA/purchase-workflow | purchase_order_approval_block/__init__.py | Python | agpl-3.0 | 113 | 0 |
import _plotly_utils.basevalidators
class SizesrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="sizesrc", parent_name="bar.insidetextfont", **kwargs
):
super(SizesrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=p... | plotly/python-api | packages/python/plotly/plotly/validators/bar/insidetextfont/_sizesrc.py | Python | mit | 463 | 0 |
#
# Copyright 2019 The FATE 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 appli... | FederatedAI/FATE | python/fate_test/fate_test/_client.py | Python | apache-2.0 | 3,346 | 0.002989 |
# -*- coding: utf-8 -*-
import os
import json
from pymatgen.ext.matproj import MPRester
data = {}
with MPRester() as mpr:
for i, d in enumerate(
mpr.query(criteria={}, properties=["task_ids", "pretty_formula"])
):
for task_id in d["task_ids"]:
data[task_id] = d["pretty_formula"]
o... | materialsproject/MPContribs | mpcontribs-api/mpcontribs/api/contributions/generate_formulae.py | Python | mit | 431 | 0 |
# jhbuild - a tool to ease building collections of source packages
# Copyright (C) 2001-2004 James Henstridge
#
# autobuild.py: non-interactive build that generates a report
#
# 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... | mujin/jhbuild | jhbuild/commands/autobuild.py | Python | gpl-2.0 | 3,732 | 0.001876 |
# coding: utf-8
from __future__ import unicode_literals
import re
import calendar
import datetime
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
HEADRequest,
unified_strdate,
strip_jsonp,
int_or_none,
float_or_none,
determine_ext,
remove_end,
un... | TRox1972/youtube-dl | youtube_dl/extractor/orf.py | Python | unlicense | 11,297 | 0.001151 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.