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 django.core.urlresolvers import reverse
from django.shortcuts import redirect, render
from django.utils.timezone import now
from django.views.generic import DetailView, ListView
from .models import Article, Category
from .search import Article as SearchArticle
def index(request):
return redirect(reverse('bl... | MarkusH/talk-django-elasticsearch | blog/views.py | Python | bsd-3-clause | 2,259 | 0.001771 |
# coding: utf-8
# In[1]:
import matplotlib.pyplot as plt #import modules
import matplotlib.patches as mpatches
import numpy as np
#get_ipython().magic(u'matplotlib inline') # set to inline for ipython
# In[2]:
water = [0,2,2,3,1.5,1.5,3,2,2,2,2,2.5,2] #arrange data from lab
alc = [0,2.5,2.5,2.5,2.5,3,2.5,2.5]
wei... | aknh9189/code | physicsScripts/flotation/flotation.py | Python | mit | 1,813 | 0.04909 |
# Copyright 2016 ARM Limited
#
# 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 writin... | ep1cman/workload-automation | wlauto/utils/fps.py | Python | apache-2.0 | 4,301 | 0.00186 |
#!/usr/bin/python
# gly19.py -- protein glycosylator
# 2016.10.05 -- first version -- John Saeger
# gly19 -- 2017.5.27
# This version complains about incomplete sidechains. You must fix them up.
# I use pymol's mutate wizard to mutate a residue to itself.
# This version has a slightly more sophisticated solvent exp... | aequorea/gly | versions/gly19.py | Python | gpl-2.0 | 8,326 | 0.036872 |
"""Breast Cancer Data"""
__docformat__ = 'restructuredtext'
COPYRIGHT = """???"""
TITLE = """Breast Cancer Data"""
SOURCE = """
This is the breast cancer data used in Owen's empirical likelihood. It is taken from
Rice, J.A. Mathematical Statistics and Data Analysis.
http://www.cengage.com/statistics/dis... | kiyoto/statsmodels | statsmodels/datasets/cancer/data.py | Python | bsd-3-clause | 1,743 | 0.010901 |
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Top Block
# Generated: Thu Oct 8 20:41:39 2015
##################################################
from datetime import datetime
from gnuradio import blocks
from gnuradio import digital
from gnuradio import e... | bitrat/alarm-fingerprint | AlarmGnuRadioFiles/Spectra_FileInput_To_BinarySlice_Local_only.py | Python | gpl-2.0 | 10,425 | 0.011415 |
import os
import sys
import transaction
from pyramid.paster import bootstrap
import transaction
from mojo.models import root_factory
from mojo.blog.models import get_blogroot
def usage(argv):
cmd = os.path.basename(argv[0])
print('usage: %s <config_uri>\n'
'(example: "%s development.ini")' % (cmd... | gliheng/Mojo | mojo/scripts/dump_blog_data.py | Python | gpl-2.0 | 1,041 | 0.001921 |
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
def make_regalur_image(img, size=(256, 256)):
return img.resize(size).convert('RGB')
# 几何转变,全部转化为256*256像素大小
def split_image(img, part_size=(64, 64)):
w, h = img.size
pw, ph = part_size
... | pythonlittleboy/python_gentleman_crawler | util/ImageSimilar.py | Python | apache-2.0 | 3,416 | 0.005423 |
import datetime
import unittest
from freezegun import freeze_time
from semantic.dates import DateService
@freeze_time('2014-01-01 00:00')
class TestDate(unittest.TestCase):
def compareDate(self, input, target):
service = DateService()
result = service.extractDate(input)
self.assertEqual(t... | twizoo/semantic | semantic/test/testDates.py | Python | mit | 6,209 | 0.000161 |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
from mixbox import fields
import stix
from stix.data_marking import MarkingStructure
import stix.bindings.extensions.marking.simple_marking as simple_marking_binding
@stix.register_extension
class SimpleMarkingSt... | STIXProject/python-stix | stix/extensions/marking/simple_marking.py | Python | bsd-3-clause | 780 | 0.002564 |
# Generated by Django 3.1.2 on 2021-01-13 17:11
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('product', '0014_auto_20210113_1803'),
]
operations = [
migrations.RemoveField(
model_name='product',
name='company',
... | KlubJagiellonski/pola-backend | pola/product/migrations/0015_remove_product_company.py | Python | bsd-3-clause | 330 | 0 |
# 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/python/data/experimental/kernel_tests/auto_shard_dataset_test.py | Python | apache-2.0 | 27,708 | 0.004547 |
# -*- coding: utf-8 -*-
from django.db import migrations
def set_collection_path_collation(apps, schema_editor):
"""
Treebeard's path comparison logic can fail on certain locales such as sk_SK, which
sort numbers after letters. To avoid this, we explicitly set the collation for the
'path' column to th... | kaedroho/wagtail | wagtail/core/migrations/0027_fix_collection_path_collation.py | Python | bsd-3-clause | 906 | 0.003311 |
import os
import time
from urllib.parse import urljoin
import requests as rq
from bs4 import BeautifulSoup as bs
current_page_url = 0
page_soup = 0
def download_file(file_url, file_path):
if os.path.exists(file_path):
print(file_path, "already exists")
return False
i = 0
while i <= 30:
... | SilentObserver/mangafox_rippers | mangafox_ripper.py | Python | lgpl-3.0 | 3,898 | 0.001283 |
#!/usr/bin/env python3
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
import argparse
import enum
import logging
import sys
import chipwhisperer as cw
import chipwhisperer.analyzer as cwa
import codetiming
import more_... | lowRISC/ot-sca | cw/cw305/ceca.py | Python | apache-2.0 | 23,127 | 0.001254 |
# -*- coding: utf-8 -*-
from httoop.status.types import StatusException
from httoop.uri import URI
class RedirectStatus(StatusException):
u"""REDIRECTIONS = 3xx
A redirection to other URI(s) which are set in the Location-header.
"""
location = None
def __init__(self, location, *args, **kwargs):
if not isin... | spaceone/httoop | httoop/status/redirect.py | Python | mit | 3,015 | 0.021891 |
import urllib.request
import urllib.parse
import json
from Admit import Data
# number:the number of a student
# birthday: the student's birthday, like 9301
# try_time: the request reconnect times when it broken.
def get_admit_result_by_number_and_birthday(number, birthday, try_times=3):
if try_times == 0:
... | archerda/gkcx | Admit/HttpRequestTool.py | Python | apache-2.0 | 2,421 | 0.004131 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | ltb-project/white-pages | docs/conf.py | Python | gpl-3.0 | 5,250 | 0 |
def extractXvvCpuMybluehostMe(item):
'''
Parser for 'xvv.cpu.mybluehost.me'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous'... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractXvvCpuMybluehostMe.py | Python | bsd-3-clause | 553 | 0.034358 |
# -*- coding: utf-8 -*-
from .. Error import RINGError
class Reader(object):
"""
Reader reads the parsed RING input, and returns the RDkit wrapper objects
in pgradd.RDkitWrapper.
Attributes
----------
ast : abstract syntax tree obtrained from parser
"""
def __init__(self, ast):
... | VlachosGroup/VlachosGroupAdditivity | pgradd/RINGParser/Reader.py | Python | mit | 2,491 | 0 |
#!/usr/local/bin/python
a=['red','orange','yellow','green','blue','purple']
odds=a[::2]
evens=a[1::2]
print odds
print evens
x=b'abcdefg'
y=x[::-1]
print y
c=['a','b','c','d','e','f']
d=c[::2]
e=d[1:-1]
print e
| Vayne-Lover/Effective | Python/Effective Python/item6.py | Python | mit | 211 | 0.085308 |
'''
Coursera:
- Software Defined Networking (SDN) course
-- Network Virtualization
Professor: Nick Feamster
Teaching Assistant: Arpit Gupta
'''
from pox.core import core
from collections import defaultdict
import pox.openflow.libopenflow_01 as of
import pox.openflow.discovery
import pox.openflow.spanning_tree
from ... | pragya1990/pox_whole_code | pox/misc/videoSlice1.py | Python | gpl-3.0 | 10,272 | 0.012169 |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import logging
from copy import copy
from indra.databases import get_identifiers_url
from indra.statements import *
from indra.util import write_unicode_csv
logger = logging.getLogger(__name__)
class TsvAssembler... | johnbachman/indra | indra/assemblers/tsv/assembler.py | Python | bsd-2-clause | 8,109 | 0.00037 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2016 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 ... | rbreitenmoser/snapcraft | snapcraft/tests/test_yaml.py | Python | gpl-3.0 | 25,577 | 0 |
#!/usr/bin/env python
#
# Copyright (c) 2011 anatanokeitai.com(sakurai_youhei)
#
# 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 right... | mschon314/pyamazonclouddrive | bin/acdsession.py | Python | mit | 3,367 | 0.017226 |
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Dense
import tensorflow_datasets as tfds
import tensorflow_recommenders_addons as tfra
ratings = tfds.load("movielens/100k-ratings", split="train")
ratings = ratings.map(
lambda x: {
"movie_id": tf.strings.to_number(x["movie_i... | tensorflow/recommenders-addons | demo/embedding_variable/ev-keras-eager.py | Python | apache-2.0 | 3,467 | 0.002019 |
# -*- coding: utf-8 -*-
import importlib
import json
import os
def has_installed(dependency):
try:
importlib.import_module(dependency)
return True
except ImportError:
return False
def is_tox_env(env):
if 'VIRTUAL_ENV' in os.environ:
return env in os.environ['VIRTUAL_ENV']... | python-thumbnails/python-thumbnails | tests/utils.py | Python | mit | 814 | 0 |
"""ninetofiver serializers."""
from django.contrib.auth import models as auth_models
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django_countries.serializers import CountryFieldMixin
from django.db.models import Q
from rest_framework import serializers... | BartDeCaluwe/925r | ninetofiver/serializers.py | Python | gpl-3.0 | 422 | 0 |
import numpy as np
from apvisitproc import despike
import pytest
import os
DATAPATH = os.path.dirname(__file__)
FILELIST1 = os.path.join(DATAPATH, 'list_of_txt_spectra.txt')
FILELIST2 = os.path.join(DATAPATH, 'list_of_fits_spectra.txt')
@pytest.fixture
def wave_spec_generate():
'''
Read in three small chunks... | mrawls/apVisitproc | apvisitproc/tests/test_despike.py | Python | mit | 2,736 | 0.002558 |
#!/usr/bin/env python3
# -*- mode:python; tab-width:4; c-basic-offset:4; intent-tabs-mode:nil; -*-
# ex: filetype=python tabstop=4 softtabstop=4 shiftwidth=4 expandtab autoindent smartindent
#
# Universal Password Changer (UPwdChg)
# Copyright (C) 2014-2018 Cedric Dufour <http://cedric.dufour.name>
# Author: Cedric Du... | alex-dot/upwdchg | tests/python-tokenreader-test.py | Python | gpl-3.0 | 7,822 | 0.003328 |
from django.apps import AppConfig
from django.template.base import add_to_builtins
class PrxAppConfig(AppConfig):
name = 'prx_aplikacja'
verbose_name = 'prx_aplikacja'
def ready(self):
add_to_builtins('prx_aplikacja.templatetags.tagi')
| michkol/prx | prx_aplikacja/apps.py | Python | gpl-3.0 | 258 | 0.003876 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
LrsPlugin
A QGIS plugin
Linear reference system builder and editor
-------------------
begin : 2013-10-02
copyright ... | blazek/lrs | lrs/ui/lrscombomanagerbase.py | Python | gpl-2.0 | 5,538 | 0.002167 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
fix_xml_ampersands,
)
class MetacriticIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?metacritic\.com/.+?/trailers/(?P<id>\d+)'
_TESTS = [{
'url': 'http://www.metacritic.com/game/playstation-4/infamo... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/metacritic.py | Python | gpl-3.0 | 2,280 | 0.025877 |
from os import getenv
from time import time, sleep
from core import Platform, Instance
from SoftLayer import Client
from SoftLayer.CCI import CCIManager
from paramiko import SSHClient
class _SuppressPolicy(object):
def missing_host_key(self, client, hostname, key):
pass
class CCIPlatform(Platform):
... | softlayer/stack-dev-tools | platforms/softlayer.py | Python | mit | 4,908 | 0 |
# Sample script for loading volume data.
import voreen
# usage: voreen.loadVolume(filepath, [name of VolumeSource processor])
voreen.loadVolume(voreen.getBasePath() + "/data/volumes/nucleon.dat", "VolumeSource")
| Elima85/bccfccraycaster | data/scripts/loadvolume.py | Python | gpl-2.0 | 213 | 0.004695 |
import pytest
from selenium import webdriver
@pytest.fixture
def driver(request):
wd = webdriver.Chrome()
request.addfinalizer(wd.quit)
return wd
def test_example(driver):
driver.get("http://localhost/litecart/")
driver.implicitly_wait(10)
sticker_number = len(driver.find_elements_by_xpath("/... | olga121/Selenium_Webdriver | test_sticker.py | Python | apache-2.0 | 496 | 0.010081 |
# -*- coding: utf-8 -*-
# import re
from core import httptools
from core import scrapertools
from platformcode import logger
import codecs
def get_video_url(page_url, video_password):
logger.info("(page_url='%s')" % page_url)
video_urls = []
data = httptools.downloadpage(page_url).data
list = scrap... | alfa-addon/addon | plugin.video.alfa/servers/youdbox.py | Python | gpl-3.0 | 822 | 0.008516 |
# coding: utf-8
"""Tests for the elpy.server module"""
import os
import tempfile
import unittest
import mock
from elpy import rpc
from elpy import server
from elpy.tests import compat
from elpy.tests.support import BackendTestCase
import elpy.refactor
class ServerTestCase(unittest.TestCase):
def setUp(self):
... | birkenfeld/elpy | elpy/tests/test_server.py | Python | gpl-3.0 | 14,270 | 0 |
"""
Tests the crowdsourced hinter xmodule.
"""
from mock import Mock, MagicMock
import unittest
import copy
from xmodule.crowdsource_hinter import CrowdsourceHinterModule
from xmodule.vertical_module import VerticalModule, VerticalDescriptor
from xblock.field_data import DictFieldData
from xblock.fragment import Frag... | TsinghuaX/edx-platform | common/lib/xmodule/xmodule/tests/test_crowdsource_hinter.py | Python | agpl-3.0 | 22,068 | 0.001042 |
# flake8: noqa
import dcs.mapping as mapping
from dcs.terrain.terrain import Airport, Runway, ParkingSlot, Terrain, MapView
from .projections.thechannel import PARAMETERS
class Abbeville_Drucat(Airport):
id = 1
name = "Abbeville Drucat"
tacan = None
unit_zones = []
civilian = False
slot_versio... | pydcs/dcs | dcs/terrain/thechannel.py | Python | lgpl-3.0 | 165,474 | 0.006986 |
"""
This module contains functions for auto feature generation.
"""
import logging
import pandas as pd
import six
from py_entitymatching.utils.validation_helper import validate_object_type
from IPython.display import display
import py_entitymatching as em
import py_entitymatching.feature.attributeutils as au
import ... | anhaidgroup/py_entitymatching | py_entitymatching/feature/autofeaturegen.py | Python | bsd-3-clause | 34,022 | 0.001323 |
from django.forms import CharField, ValidationError
from django.forms.fields import EMPTY_VALUES
import re, string
class TinyMCEField(CharField):
def clean(self, value):
"Validates max_length and min_length. Returns a Unicode object."
if value in EMPTY_VALUES:
return u''
... | saebyn/django-classifieds | classifieds/forms/fields.py | Python | bsd-3-clause | 1,278 | 0.005477 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/scout/trap/shared_trap_webber.iff"
result.attribute_template_id = -... | anhstudios/swganh | data/scripts/templates/object/tangible/scout/trap/shared_trap_webber.py | Python | mit | 444 | 0.047297 |
# -*- coding: utf-8 -*-
from resources.lib.handler.jdownloaderHandler import cJDownloaderHandler
from resources.lib.download import cDownload
from resources.lib.handler.hosterHandler import cHosterHandler
from resources.lib.gui.gui import cGui
from resources.lib.gui.guiElement import cGuiElement
from resources.lib.hand... | mmllnr/plugin.video.xstream | resources/lib/gui/hoster.py | Python | gpl-3.0 | 8,657 | 0.005198 |
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
from datetime import datetime
from datetime import date
from twilio.rest.resources import parse_date
from twilio.rest.resources import transform_params
from twilio.rest.resources import convert_keys
from twilio.rest.reso... | schwardo/chicago47-sms | tests/test_core.py | Python | mit | 2,358 | 0.004665 |
# Generated by Django 2.2.13 on 2020-08-10 09:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('terminal', '0024_auto_20200715_1713'),
]
operations = [
migrations.AlterField(
model_name='session',
name='protocol... | skyoo/jumpserver | apps/terminal/migrations/0025_auto_20200810_1735.py | Python | gpl-2.0 | 543 | 0.001842 |
# -*- coding: utf-8 -*-
from django.contrib import messages
from django.db.models import Q
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import redirect, get_object_or_404
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext as _
from django.vi... | indexofire/gork | src/gork/application/know/plugins/attachments/views.py | Python | mit | 13,497 | 0.003853 |
import click
import newsfeeds
import random
import sys
from config import GlobalConfig
def mixer(full_story_list, sample_number):
"""Selects a random sample of stories from the full list to display to the user.
Number of stories is set in config.py
Todo: Add argument support for number of stories to displ... | haaspt/whatsnew | main.py | Python | mit | 2,815 | 0.006039 |
from mock import Mock
from ceph_deploy import install
class TestSanitizeArgs(object):
def setup(self):
self.args = Mock()
# set the default behavior we set in cli.py
self.args.default_release = False
self.args.stable = None
def test_args_release_not_specified(self):
... | rtulke/ceph-deploy | ceph_deploy/tests/test_install.py | Python | mit | 1,312 | 0 |
#!/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 os
import sys
import glob... | cstipkovic/spidermonkey-research | testing/mozharness/scripts/gaia_unit.py | Python | mpl-2.0 | 4,408 | 0.004537 |
class LoggingException(Exception):
def __init__(self, message, logger):
Exception.__init__(self, message)
if logger:
logger.error(message)
class ConfigError(LoggingException):
def __init__(self, message, error=None, logger=None):
LoggingException.__init__(self, message, ... | invenia/shepherd | shepherd/common/exceptions.py | Python | mpl-2.0 | 911 | 0 |
"""Tests for models."""
from unittest.mock import patch
from datetime import datetime
from django.contrib.auth.models import User
from django.test import TestCase
from django.utils import timezone
from main.models import Post, Comment
class ModelPostTest(TestCase):
"""Main class for testing Post models of this ... | kpi-web-guild/django-girls-blog-DrEdi | main/tests/test_models.py | Python | mit | 2,406 | 0.002909 |
#Faça um programa que receba dois números inteiros e gere os números inteiros que estão no intervalo compreendido por eles.
a=int(input('valor incial'))
print (a)
b=int(input('valor final'))
print (b)
while a<b:
print(a)
a=a+1
| erikaklein/algoritmo---programas-em-Python | GerarNumeroNoIntervalo.py | Python | mit | 251 | 0.032389 |
"""
InaSAFE Disaster risk assessment tool developed by AusAid **Messaging styles.**
Contact : ole.moller.nielsen@gmail.com
.. note:: 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 ... | drayanaindra/inasafe | safe/messaging/styles.py | Python | gpl-3.0 | 2,016 | 0.000496 |
# coding=utf-8
# Author: Idan Gutman
# Modified by jkaberg, https://github.com/jkaberg for SceneAccess
# URL: https://sick-rage.github.io
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the F... | Arcanemagus/SickRage | sickbeard/providers/scc.py | Python | gpl-3.0 | 7,234 | 0.002903 |
import os, logging, praw, HTMLParser, ConfigParser, pprint, csv
from bs4 import BeautifulSoup
from urlparse import urlparse
from tldextract import tldextract
print "Reddit Research Scraper v0.1"
print "============================"
'''
Grab the config file (we're gonna need it later on)
'''
try:
config ... | carolinehardin/learnProgrammingByForums | countReddit.py | Python | gpl-2.0 | 5,525 | 0.029864 |
import sys, os, operator, json
from py4j.java_gateway import JavaGateway
from py4j.java_collections import ListConverter
'''
@author: Anant Bhardwaj
@date: Nov 1, 2013
'''
class Recommender:
def __init__(self):
self.gateway = JavaGateway()
def get_item_based_recommendations(self, paper_id_list):
java_p... | imclab/confer | server/recommender.py | Python | mit | 741 | 0.017544 |
# 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
# distributed under t... | rajalokan/keystone | keystone/tests/hacking/checks.py | Python | apache-2.0 | 14,985 | 0 |
"""
Misago default settings
This fille sets everything Misago needs to run.
If you want to add custom app, middleware or path, please update setting vallue
defined in this file instead of copying setting from here to your settings.py.
Yes:
#yourproject/settings.py
INSTALLED_APPS += (
'myawesomeapp',
)
No:
#yo... | 390910131/Misago | misago/conf/defaults.py | Python | gpl-2.0 | 12,306 | 0 |
#
# This file is part of GNU Enterprise.
#
# GNU Enterprise 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, or (at your option) any later version.
#
# GNU Enterprise is distributed ... | fxia22/ASM_xf | PythonD/lib/python2.4/site-packages/display/cursing/ScrollBar.py | Python | gpl-2.0 | 5,591 | 0.023609 |
import re
import sys
def get_wire(input_value):
try:
int(input_value)
return int(input_value)
except ValueError:
if callable(wires[input_value]):
wires[input_value] = wires[input_value]()
return wires[input_value]
class Gate:
def __init__(self, first_input, oper... | twrightsman/advent-of-code-2015 | advent_day7_pt2.py | Python | unlicense | 2,686 | 0.004468 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: mnist-visualizations.py
"""
The same MNIST ConvNet example, but with weights/activations visualization.
"""
import tensorflow as tf
from tensorpack import *
from tensorpack.dataflow import dataset
IMAGE_SIZE = 28
def visualize_conv_weights(filters, name):
"... | eyaler/tensorpack | examples/basics/mnist-visualizations.py | Python | apache-2.0 | 4,834 | 0.002069 |
# -*- coding: UTF-8 -*-
"""
this is the default settings, don't insert into your customized settings!
"""
DEBUG = True
TESTING = True
SECRET_KEY = "5L)0K%,i.;*i/s("
SECURITY_SALT = "sleiuyyao"
# DB config
SQLALCHEMY_DATABASE_URI = "sqlite:///dev.db"
SQLALCHEMY_ECHO = True
UPLOADS_DEFAULT_DEST = 'uploads'
LOG_FILE = ... | PuZheng/cloud-dashing | cloud_dashing/default_settings.py | Python | gpl-2.0 | 618 | 0 |
# $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are
#met:
#
... | DLR-SC/DataFinder | src/datafinder/core/configuration/properties/domain.py | Python | bsd-3-clause | 6,707 | 0.00999 |
# Copyright (c) 2007-2017 Joseph Hager.
#
# Copycat is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License,
# as published by the Free Software Foundation.
#
# Copycat is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; with... | ajhager/copycat | copycat/slipnet/sliplink.py | Python | gpl-2.0 | 1,760 | 0.001705 |
# -*- coding: utf-8 -*-
from time import strftime
from django.db.models import Max
from django.shortcuts import render_to_response, get_object_or_404
from django.core.paginator import QuerySetPaginator, InvalidPage, EmptyPage
from django.core.urlresolvers import reverse
from django.utils.feedgenerator import Rss201rev... | omat/django-timeline | timeline/views.py | Python | mit | 4,465 | 0.002917 |
import uuid
import re
import datetime
import decimal
import itertools
import functools
import random
import string
import six
from six import iteritems
from ..exceptions import (
StopValidation, ValidationError, ConversionError, MockCreationError
)
try:
from string import ascii_letters # PY3
except ImportErr... | kaiix/schematics | schematics/types/base.py | Python | bsd-3-clause | 28,230 | 0.001594 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from hwt.interfaces.std import VectSignal
from hwt.interfaces.utils import addClkRstn
from hwt.simulator.simTestCase import SimTestCase
from hwt.synthesizer.unit import Unit
from hwtHls.hlsStreamProc.streamProc import HlsStreamProc
from hwtHls.platform.virtual import Virt... | Nic30/hwtHls | tests/utils/alapAsapDiffExample.py | Python | mit | 2,761 | 0.002898 |
'''
MiPyBot 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.
MiPyBot is distributed in the hope that it will be useful,
but WITHOUT ANY WARRA... | Eloston/mipybot | mipybot/world/world.py | Python | gpl-3.0 | 626 | 0 |
# Loosely based on https://github.com/Skarlso/SublimeGmailPlugin by Skarlso
import sublime
import sublime_plugin
from smtplib import SMTP
from email.mime.text import MIMEText
from email.header import Header
# from email.headerregistry import Address
# from email.utils import parseaddr, formataddr
config = {
# TO... | jbjornson/SublimeGMail | GMail.py | Python | mit | 4,056 | 0.003205 |
from ginger import utils
from datetime import datetime, timedelta
from django.core.cache import cache
from django.conf import settings
from django.utils import timezone
import pytz
__all__ = ['CurrentRequestMiddleware',
'MultipleProxyMiddleware',
'ActiveUserMiddleware',
'LastLoginMi... | vivsh/django-ginger | ginger/middleware.py | Python | mit | 3,073 | 0.000976 |
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
#
# eos 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, ... | blitzmann/Pyfa | eos/db/gamedata/group.py | Python | gpl-3.0 | 1,802 | 0.002775 |
"""
Handler for Juniper device specific information.
Note that for proper import, the classname has to be:
"<Devicename>DeviceHandler"
...where <Devicename> is something like "Default", "Junos", etc.
All device-specific handlers derive from the DefaultDeviceHandler, which implements the
generic information need... | ncclient/ncclient | ncclient/devices/junos.py | Python | apache-2.0 | 6,467 | 0.002783 |
"""
Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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... | SaikWolf/gnuradio | grc/gui/Port.py | Python | gpl-3.0 | 10,040 | 0.003586 |
from datetime import datetime
import re
import numpy as np
import pytest
from pandas._libs import iNaT
import pandas._testing as tm
import pandas.core.algorithms as algos
@pytest.fixture(params=[True, False])
def writeable(request):
return request.param
# Check that take_nd works both with writeable arrays
#... | pandas-dev/pandas | pandas/tests/test_take.py | Python | bsd-3-clause | 11,995 | 0.000417 |
# Generated by Django 2.2.12 on 2020-04-25 15:53
from django.db import migrations, models
import django.db.models.deletion
import djangocms_text_ckeditor.fields
import parler.fields
import parler.models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... | gitsimon/tq_website | partners/migrations/0001_initial.py | Python | gpl-2.0 | 1,987 | 0.003523 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('firecares_core', '0008_auto_20161122_1420'),
]
operations = [
migrations.CreateModel(
name='RegistrationWhitelis... | FireCARES/firecares | firecares/firecares_core/migrations/0009_registrationwhitelist.py | Python | mit | 576 | 0.003472 |
# -*- coding: utf-8 -*-
"""Prepare configure file for fuzzy slope position inference program.
@author : Liangjun Zhu
@changelog:
- 15-09-08 lj - initial implementation.
- 17-07-30 lj - reorganize and incorporate with pygeoc.
"""
from __future__ import absolute_import, unicode_literals
import time
... | lreis2415/AutoFuzSlpPos | autofuzslppos/FuzzySlpPosInference.py | Python | gpl-2.0 | 6,208 | 0.003222 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.editor, name="editor"),
url(r'^game/$', views.edit_game, name="add_game"),
url(r'^game/(?P<gameid>\d+)/$', views.edit_game, name="edit_game"),
url(r'^event/$', views.edit_event, name="add_event"),
url(r'^event... | wadobo/socializa | backend/editor/urls.py | Python | agpl-3.0 | 775 | 0.00129 |
#!/usr/bin/env python
# encoding: utf-8
from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
from efl.elementary.window import StandardWindow
from efl.elementary.box import Box
from efl.elementary.spinner import Spinner
EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
EXPAND_HORIZ = EVAS_H... | maikodaraine/EnlightenmentUbuntu | bindings/python/python-efl/examples/elementary/test_spinner.py | Python | unlicense | 2,598 | 0.005774 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This package contains various command line wrappers to programs used in
pymatgen that do not have Python equivalents.
"""
| gVallverdu/pymatgen | pymatgen/command_line/__init__.py | Python | mit | 237 | 0 |
import numpy as np # モジュールnumpyを読み込み
import matplotlib.pyplot as plt # モジュールmatplotlibのpylab関数を読み込み
def bernstein(t, n, i): # bernstein基底関数の定義
cn, ci, cni = 1.0, 1.0, 1.0
for k in range(2, n, 1):
cn = cn * k
for k in range(1, i, 1):
if i == 1:
break
ci = ci * k
f... | o-kei/design-computing-aij | ch3_2/bezier_2D.py | Python | mit | 1,190 | 0 |
"""
bjson/main.py
Copyright (c) 2010 David Martinez Marti
All rights reserved.
Licensed under 3-clause BSD License.
See LICENSE.txt for the full license text.
"""
import socket
import bjsonrpc.server
import bjsonrpc.connection
import bjsonrpc.handlers
__all__ = [
"createserver",
"... | deavid/bjsonrpc | bjsonrpc/main.py | Python | bsd-3-clause | 2,824 | 0.01204 |
import ast
import copy
from datetime import datetime, timedelta
import mock
import os
import shutil
import util
try:
import unittest2 as unittest
except ImportError:
import unittest
try:
from itertools import ifilter as filter
except ImportError:
pass
from testrail.api import API
from testrail.helper... | travispavek/testrail-python | tests/test_api.py | Python | mit | 31,201 | 0.000128 |
import os
from django.contrib.auth import authenticate
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.auth.models import User, Permission
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.context_processors import PermWrapper, PermLookupDict
from djan... | simbha/mAngE-Gin | lib/django/contrib/auth/tests/test_context_processors.py | Python | mit | 7,020 | 0.000142 |
# Copyright (C) 2014 Red Hat, Inc., Bryn M. Reeves <bmr@redhat.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 later version.
# ... | pierg75/pier-sosreport | sos/plugins/distupgrade.py | Python | gpl-2.0 | 1,902 | 0 |
# -*- coding: utf-8 -*-
"""
@file
@brief Helpers for :epkg:`Flask`.
"""
import traceback
import threading
from flask import Response
def Text2Response(text):
"""
convert a text into plain text
@param text text to convert
@return textReponse
"""
return Response(text... | sdpython/ensae_teaching_cs | src/ensae_teaching_cs/td_1a/flask_helper.py | Python | mit | 1,966 | 0.001526 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 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
#
... | citrix-openstack-build/nova | nova/consoleauth/manager.py | Python | apache-2.0 | 5,195 | 0.000577 |
# -*- coding: utf-8 -*-
from openerp import SUPERUSER_ID
from openerp.osv import fields, osv
import openerp.addons.decimal_precision as dp
import datetime
import re
class rhwl_project(osv.osv):
_name = "rhwl.project"
_columns = {
"name":fields.char(u"项目名称"),
"catelog":fields.char(u"类别"),
... | vnsofthe/odoo-dev | addons/rhwl/rhwl_project.py | Python | agpl-3.0 | 1,119 | 0.040991 |
# -*- 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-dialogflow-cx | samples/generated_samples/dialogflow_v3beta1_generated_sessions_detect_intent_async.py | Python | apache-2.0 | 1,676 | 0.000597 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-04-02 19:34
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('mhap', '0003_auto_20170402_1906'),
]
operations = [
migrations.DeleteModel(
... | SIU-CS/J-JAM-production | mhapsite/mhap/migrations/0004_delete_quote.py | Python | gpl-3.0 | 354 | 0 |
# coding: utf-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
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(... | scibi/django-teryt | teryt/south_migrations/0002_auto__add_field_miejscowosc_aktywny__add_field_ulica_aktywny__add_fiel.py | Python | mit | 4,805 | 0.005411 |
import threading, time
from sqlalchemy import pool, interfaces, create_engine, select
import sqlalchemy as tsa
from sqlalchemy.test import TestBase, testing
from sqlalchemy.test.util import gc_collect, lazy_gc
from sqlalchemy.test.testing import eq_
mcid = 1
class MockDBAPI(object):
def __init__(self):
sel... | simplegeo/sqlalchemy | test/engine/test_pool.py | Python | mit | 25,148 | 0.003141 |
#!/usr/bin/python -tt
# Quality scores from fastx
# Website: http://hannonlab.cshl.edu/fastx_toolkit/
# Import OS features to run external programs
import os
import glob
v = "Version 0.1"
# Versions:
# 0.1 - Simple script to run cutadapt on all of the files
fastq_indir = "/home/chris/transcriptome/fastq/trimmed/"
fa... | calandryll/transcriptome | scripts/old/quality_stats.py | Python | gpl-2.0 | 685 | 0.00438 |
# Copyright 2014 Baidu, 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, softwa... | baidubce/bce-sdk-python | baidubce/services/tsdb/tsdb_handler.py | Python | apache-2.0 | 1,744 | 0.006881 |
#!/usr/bin/env python
#
# @file Constructors.py
# @brief class for constructors for c++ and c
# @author Frank Bergmann
# @author Sarah Keating
#
# <!--------------------------------------------------------------------------
#
# Copyright (c) 2013-2018 by the California Institute of Technology
# (California, USA)... | sbmlteam/deviser | deviser/code_files/cpp_functions/Constructors.py | Python | lgpl-2.1 | 42,243 | 0.001349 |
from setuptools import setup
def setup_package():
# PyPi doesn't accept markdown as HTML output for long_description
# Pypandoc is only required for uploading the metadata to PyPi and not installing it by the user
# Try to covert Mardown to RST file for long_description
try:
import pypandoc
... | FloBay/PyOmics | setup.py | Python | bsd-3-clause | 1,788 | 0.003356 |
# Copyright 2015-2017 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
#
# Unless req... | smartbgp/libbgp | libbgp/bmp/termination.py | Python | apache-2.0 | 1,910 | 0.001571 |
import re
import pytest, py
from _pytest import python as funcargs
class TestMetafunc:
def Metafunc(self, func):
# the unit tests of this class check if things work correctly
# on the funcarg level, so we don't need a full blown
# initiliazation
class FixtureInfo:
name2... | mhils/pytest | testing/python/metafunc.py | Python | mit | 36,868 | 0.001302 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# tvalacarta - XBMC Plugin
# Canal para Ecuador TV
# http://blog.tvalacarta.info/plugin-xbmc/tvalacarta/
#------------------------------------------------------------
import urlparse,re
import urllib
import os
from core import logger... | uannight/reposan | plugin.video.tvalacarta/channels/ecuadortv.py | Python | gpl-2.0 | 5,395 | 0.007987 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.