code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# coding: utf-8
from django.db import models
class Band(models.Model):
name = models.CharField(max_length=100)
bio = models.TextField()
rank = models.IntegerField()
class Meta:
ordering = ('name',)
| adviti/melange | thirdparty/google_appengine/lib/django_1_2/tests/regressiontests/admin_ordering/models.py | Python | apache-2.0 | 224 |
"""The fail2ban component."""
| aronsky/home-assistant | homeassistant/components/fail2ban/__init__.py | Python | apache-2.0 | 30 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... | tszym/ansible | lib/ansible/modules/cloud/ovirt/ovirt_quotas_facts.py | Python | gpl-3.0 | 3,955 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | inovtec-solutions/OpenERP | openerp/addons/mail/tests/test_mail_base.py | Python | agpl-3.0 | 4,516 |
# urllib3/_collections.py
# Copyright 2008-2012 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from collections import deque
from threading import RLock
__all__ = ['RecentlyUsedContai... | samabhi/pstHealth | venv/lib/python2.7/site-packages/requests/packages/urllib3/_collections.py | Python | mit | 4,119 |
# This file is only necessary for the tests to work | nathangeffen/tbonline-old | tbonlineproject/external/filebrowser/models.py | Python | mit | 51 |
from Components.Converter.Converter import Converter
from Components.Element import cached
from Components.config import config
from Tools.GetEcmInfo import GetEcmInfo
from Poll import Poll
class CryptoInfo(Poll, Converter, object):
def __init__(self, type):
Converter.__init__(self, type)
Poll.__init__(self)
... | popazerty/EG-2 | lib/python/Components/Converter/CryptoInfo.py | Python | gpl-2.0 | 885 |
from __future__ import unicode_literals
from django.conf.urls import include, url
from django.test import TestCase
from django.utils import six
from rest_framework import generics, routers, serializers, status, viewsets
from rest_framework.renderers import (
BaseRenderer, BrowsableAPIRenderer, JSONRenderer
)
from... | rubendura/django-rest-framework | tests/test_response.py | Python | bsd-2-clause | 10,811 |
# This tests the compilation and execution of the source code generated with
# utilities.codegen. The compilation takes place in a temporary directory that
# is removed after the test. By default the test directory is always removed,
# but this behavior can be changed by setting the environment variable
# SYMPY_TEST_CL... | kaichogami/sympy | sympy/external/tests/test_codegen.py | Python | bsd-3-clause | 11,832 |
"""A library for integrating Python's builtin ``ssl`` library with CherryPy.
The ssl module must be importable for SSL functionality.
To use this module, set ``CherryPyWSGIServer.ssl_adapter`` to an instance of
``BuiltinSSLAdapter``.
"""
try:
import ssl
except ImportError:
ssl = None
from cherrypy import ws... | minixalpha/SourceLearning | webpy/src/web/wsgiserver/ssl_builtin.py | Python | apache-2.0 | 2,589 |
# -*- coding: utf-8 -*-
from openerp.tests import common
KARMA = {
'ask': 5, 'ans': 10,
'com_own': 5, 'com_all': 10,
'com_conv_all': 50,
'upv': 5, 'dwv': 10,
'edit_own': 10, 'edit_all': 20,
'close_own': 10, 'close_all': 20,
'unlink_own': 10, 'unlink_all': 20,
'gen_que_new': 1, 'gen_que... | mycodeday/crm-platform | website_forum/tests/common.py | Python | gpl-3.0 | 3,442 |
class C:
def empty(self):
def another(self):
<selection> """
line 1
line 2
"""
pass
</selection>
| asedunov/intellij-community | python/testData/copyPaste/EmptyFunctionCaretAtNoneIndent.src.py | Python | apache-2.0 | 153 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Vim Colorscheme Converter
~~~~~~~~~~~~~~~~~~~~~~~~~
This script converts vim colorscheme files to valid pygments
style classes meant for putting into modules.
:copyright 2006 by Armin Ronacher.
:license: BSD, see LICENSE for details.
"""
impor... | sysbot/pastedown | vendor/pygments/scripts/vim2pygments.py | Python | mit | 26,283 |
# -*- 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... | diogocs1/comps | web/addons/account/wizard/account_report_common_partner.py | Python | apache-2.0 | 1,999 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Dummy migration
pass
def backwards(self, orm):
# Dummy migration
pass
models = {
... | mpetyx/palmdrop | venv/lib/python2.7/site-packages/cms/migrations/0036_auto__add_field_cmsplugin_changed_date.py | Python | apache-2.0 | 19,523 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [('migrations', '0001_initial')]
operations = []
| tragiclifestories/django | tests/migrations/test_migrations_backwards_deps_1/0002_second.py | Python | bsd-3-clause | 211 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("migrations", "0002_second")]
operations = [
migrations.CreateModel(
"OtherAuthor",
[
("id", mode... | DONIKAN/django | tests/migrations2/test_migrations_2/0001_initial.py | Python | bsd-3-clause | 627 |
import praw
import requests
from env import env
from twitch import twitch
class reddit:
def __init__(self):
self.r = praw.Reddit(user_agent='Heroes of the Storm Sidebar by /u/Hermes13')
self.env = env()
self.access_information = None
def setup(self):
# self.r.set_oauth_app_info( client_id=self.env.redditC... | rhots/automation | heroes-sidebar-master/reddit.py | Python | isc | 1,603 |
import unittest
import clusto_query.lexer
from clusto_query.exceptions import StringParseError
class LexerTest(unittest.TestCase):
def test_consume(self):
self.assertEqual(clusto_query.lexer.consume('nom', 'nomnomnom'),
'nomnom')
def test_lex_string_inner_quoted_basic(self):
... | uber/clusto-query | test/test_lexer.py | Python | isc | 3,315 |
from pyramid.exceptions import ConfigurationError
from pyramid.interfaces import ISessionFactory
from .settings import parse_settings
def includeme(config):
""" Set up standard configurator registrations. Use via:
.. code-block:: python
config = Configurator()
config.include('pyramid_keystone... | bertjwregeer/pyramid_keystone | pyramid_keystone/__init__.py | Python | isc | 1,415 |
from os.path import dirname, join
import unittest
from cvsgit.cvs import CVS
from cvsgit.changeset import Change
class Test(unittest.TestCase):
def test_rcsfilename(self):
"""Find the RCS file for a working copy path.
"""
cvs = CVS(join(dirname(__file__), 'data', 'zombie'), None)
... | ustuehler/git-cvs | tests/test_cvs.py | Python | isc | 727 |
#!/usr/bin/env python
# -*- mode: Python; tab-width: 4; indent-tabs-mode: nil; -*-
# ex: set tabstop=4
# Please do not change the two lines above. See PEP 8, PEP 263.
'''generates all of the examples from the test/ddt JSON files'''
__author__ = 'Jim Olsen (jim.olsen@tanium.com)'
__version__ = '2.1.4'
import os
import ... | tanium/pytan | BUILD/build_api_examples.py | Python | mit | 16,361 |
import logging
import time
import pychromecast
from traktcast.trakt import configure_trakt_client
from traktcast.hulu import HuluHandler
from traktcast.scrobble import TraktScrobblerListener
if __name__ == '__main__':
logging.basicConfig()
logging.getLogger('traktcast').setLevel(logging.DEBUG)
configur... | milas/traktcast | main.py | Python | mit | 594 |
#!/usr/bin/env python3
import argparse
import configparser
import json
import logging
import time
from datetime import datetime
from logging.handlers import SysLogHandler
from operator import itemgetter
import duo_client
from tzlocal import get_localzone
def get_logs(mintime):
logs = []
admin_api = duo_clien... | infinite-turtles/duo_logger | duo_logger.py | Python | mit | 2,265 |
import unittest,types
from pyvisdk import Vim
from pyvisdk.base.managed_object_types import ManagedObjectTypes
from pyvisdk.mo.host_system import HostSystem
from pyvisdk.mo.folder import Folder
from pyvisdk.mo.datastore import Datastore
from pyvisdk.mo.cluster_compute_resource import ClusterComputeResource
from pyvisdk... | xuru/pyvisdk | tests/test_facade.py | Python | mit | 1,752 |
from django.apps import AppConfig
class AppConfig(AppConfig):
label = 'teacher_apps_accounts'
name = 'teacher.apps.accounts'
verbose_name = "teacher accounts apps" | houssemFat/MeeM-Dev | teacher/apps/accounts/apps.py | Python | mit | 178 |
from burp import IBurpExtender
from burp import IContextMenuFactory
from javax.swing import JMenuItem
import sys
import os
import re
#Adding directory to the path where Python searches for modules
module_folder = os.path.dirname('/home/arvind/Documents/Me/My_Projects/Git/WebAppsec/BurpExtensions/modules/')
sys.path.in... | arvinddoraiswamy/mywebappscripts | BurpExtensions/FileUploadFuzz.py | Python | mit | 1,693 |
import re
from mrjob.job import MRJob
from math import log
def tsv_model_to_dict(file):
results = {}
with open(file, "r") as model:
for line in model:
term, ham, spam = line.strip().split("\t")
results[term] = (float(ham), float(spam))
return results
class NBPredict(M... | JasonSanchez/w261 | week2/NBPredict.py | Python | mit | 1,580 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Convenience functions for doing web things."""
import re
import requests
import urlparse
import traceback
import json
from lxml.cssselect import CSSSelector as cs
from lxml.html import document_fromstring
from daneel import utils
ua = "Mozilla/5.0 (Macintosh; Intel M... | jmoiron/daneel | daneel/plugins/weblib.py | Python | mit | 2,749 |
from pyswagger import SwaggerApp, utils, primitives, errs
from ..utils import get_test_data_folder
from ...scanner import CycleDetector
from ...scan import Scanner
import unittest
import os
import six
class CircularRefTestCase(unittest.TestCase):
""" test for circular reference guard """
def test_path_item_... | joequant/pyswagger | pyswagger/tests/v2_0/test_circular.py | Python | mit | 3,163 |
from .connection import Connection
from .group import Group, SerialGroup, ThreadingGroup
from .tasks import task
| github/codeql | python/ql/test/query-tests/Security/lib/fabric/__init__.py | Python | mit | 113 |
import unittest
from unittest.mock import Mock, patch
import copy
from datetime import timezone, timedelta, datetime
from ..reply.Reply import Reply
from ..reply import ReplyCRUD
from ..user.User import User
from ..messager import TweetAdapter, MessageBreaker, MessageSender
from ..data import DataConfig
from ..schedule... | kiriappeee/reply-later | src/core/tests/TestMessageSender.py | Python | mit | 14,145 |
import matplotlib.pyplot as plt
import tensorflow as tf
from softmax_del import Softmax
from lib import mytool
'''
gildong = MnistClassifier()
gildong.learn(3, 100) # epoch, partial_size
gildong.evaluate() # for all test data
gildong.classify_random_image() # classify a randomly selected image
#gildong.show_errors()
... | JNU-Include/CNN | lib/mnist_classifier_del.py | Python | mit | 2,492 |
import cPickle
import gzip
import os
import sys
import time
import numpy
import theano
import theano.tensor as T
class LogisticRegression(object):
"""
Multi-class Logistic Regression Class
The logistic regression is fully described by a weight matrix :math:`W`
and bias vector :math:`b`. Classif... | zhenxuan00/mmdgm | conv-mmdgm/layer/LogisticRegression.py | Python | mit | 4,977 |
#!/usr/bin/env python2
# transpiled with BefunCompile v1.3.0 (c) 2017
import sys
import zlib, base64
_g = ("AR+LCAAAAAAABAC9jz0KAjEQha+SnZhmh5hMhogECbZeYrcR0qZK6dkddxVEEGOzrxjmD977mt9AbQMPynCFTDYNus3Jc/XEFW4XwMA1By5yNoRr4wp4sJ7LSFwwxYjm"
+ "cFRNdWla6k5/rOdJD5VDslQ4VCaHMVYnZjIimWcznvpMVuUFgAUm84uA3whQKRkTWXnpjf9N5/2D... | Mikescher/Project-Euler_Befunge | compiled/Python2/Euler_Problem-020.py | Python | mit | 1,973 |
import json
import zipfile
from io import BytesIO
from ..constants import BULK_API
from ..api.base import BestBuyCore
from ..utils.exceptions import BestBuyBulkAPIError
class BestBuyBulkAPI(BestBuyCore):
def _api_name(self):
return BULK_API
def archive(self, name, file_format):
"""BestBuy ge... | lv10/bestbuyapi | bestbuyapi/api/bulk.py | Python | mit | 3,123 |
import os
import os.path
import traceback
# init JS9 configuration
# js9 source directory
DIRNAME = os.path.dirname(__file__)
JS9_ERROR = os.environ.get("RADIOPADRE_JS9_ERROR") or None
def init_js9():
global radiopadre
import radiopadre
from radiopadre.render import render_status_message
global JS9... | radio-astro/radiopadre | radiopadre/js9/__init__.py | Python | mit | 2,243 |
# -*- coding:utf-8 -*-
import test_core
import demjson
import datetime
test_core.title("登录测试")
f = open("testconfig.json", 'r')
lines = f.read()
f.close()
jsonfiledata = demjson.decode(lines)
if jsonfiledata["url"] == "":
test_core.terr("错误: 'testconfig.json' 配置不完全。")
exit()
uurl = jsonfiledata["url"]+"nyalogin... | cxchope/YashiLogin | tests/test_login.py | Python | mit | 712 |
# This file is part of the uPiot project, https://github.com/gepd/upiot/
#
# MIT License
#
# Copyright (c) 2017 GEPD
#
# 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, inc... | gepd/uPiotMicroPythonTool | tools/sampy_manager.py | Python | mit | 9,119 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('isisdata', '0040_auto_20160701_1946'),
]
operations = [
migrations.AlterField(
model_name='aarelation',
... | upconsulting/IsisCB | isiscb/isisdata/migrations/0041_auto_20160712_1656.py | Python | mit | 6,228 |
#!/usr/bin/env python
# Copyright (c) 2015, Brandan [coldfusion]
#
# 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,... | coldfusion39/excel-press | excel_press.py | Python | mit | 9,911 |
import logging
log = logging.getLogger(__name__)
try:
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.layers.normalization import BatchNormalization
from keras.layers.advanced_activations import PReLU, LeakyReLU
from keras.optimizers import A... | pierre-chaville/automlk | automlk/utils/keras_wrapper.py | Python | mit | 2,073 |
#!/usr/bin/env python
print "Hola\n\n\tmundo"
#Para que la impresion se realizara en la misma linea tendriamos
# que colocar una coma al final de la sentencia
for i in range(3):
print i,
print "\n"
for i in range(3):
print i
#Diferencias entre , y el + en las cadenas: al utilizar las comas
#print introduce ... | MGautier/Programacion | Python/salida_estandar.py | Python | mit | 1,308 |
#-*- coding: utf-8 -*-
import os
import stat
from django.http import Http404, HttpResponse, HttpResponseNotModified
from django.utils.http import http_date
from django.views.static import was_modified_since
from filer.server.backends.base import ServerBase
class DefaultServer(ServerBase):
'''
Serve static file... | KristianOellegaard/django-filer | filer/server/backends/default.py | Python | mit | 1,458 |
"""
Routes for the API.
"""
import datetime
import dateutil.parser
from cerberus import Validator
import flask
import sqlalchemy
from ganttcharts.chart import Chart, InvalidGanttChart
from ganttcharts.models import AccessLevel, Project, \
ProjectCalendarHoliday, ProjectEntry, ProjectEntryDependency, \
Projec... | thomasleese/gantt-charts | ganttcharts/web/routes/api.py | Python | mit | 21,937 |
# -*- coding: utf-8 -*-
import cherrypy
class Root(object):
exposed = True
@cherrypy.tools.json_out()
def GET(self, id=None):
return ["Hello", "world", "!"]
if __name__ == '__main__':
conf = {
'/': {
'request.dispatch': cherrypy.dispatch.MethodDispatcher(),
'... | alexalv-practice/topoml | modules/root.py | Python | mit | 532 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... | EmanueleCannizzaro/scons | test/CC/SHCC.py | Python | mit | 2,436 |
#!/usr/bin/python
#First Method taking in file "matrix.txt" and printing list of lists
#Function1
def readmatrix( file ):
list = open( file, 'r' )
return list.readlines();
#Calling function
print readmatrix( 'matrix.txt' )
#Funtion2
def reverse( list, matrixfile ):
file = open( matrixfile, 'w' )
for i i... | gjwajda/Computational-Tools-For-Big-Data | Exercise2/exercise2_1.py | Python | mit | 449 |
"""The stressmodels module contains all the stressmodels that available in
Pastas.
Supported Stressmodels
----------------------
The following stressmodels are supported and tested:
- StressModel
- StressModel2
- FactorModel
- StepModel
- WellModel
All other stressmodels are for research purposes only and are not (y... | gwtsa/gwtsa | pastas/stressmodels.py | Python | mit | 38,561 |
# coding: utf-8
import arctic
from email.utils import parseaddr
from setuptools import setup, find_packages
kwargs = {}
try:
from babel.messages import frontend as babel
kwargs['cmdclass'] = {
'extract_messages': babel.extract_messages,
'update_catalog': babel.update_catalog,
'compile_... | tim-tang/arctic-bear | setup.py | Python | mit | 1,115 |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.domainregistry.ie/property_contacts_multiple
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.... | huyphan/pyyawhois | test/record/parser/test_response_whois_domainregistry_ie_property_contacts_multiple.py | Python | mit | 1,945 |
import numpy as np
from scipy.spatial import distance
class measurementError():
'''
Requires repeated measurements at single position (no rotation).
Takes a set of solver.axis instances as input.
'''
def __init__(self, axes):
self.axes = axes
def calculate_angle_error_at_z(self, z=0, vect... | oxford-pcs/measure_lens_alignment | errors.py | Python | mit | 1,499 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from pint import UnitRegistry, errors
from pint.quantity import _Quantity
from pint.unit import _Unit
from pint.measurement import _Measurement
ureg = UnitRegistry()
# Because of unpickling:
class Quantity(_Quantity):
_REGISTRY = ureg
force_nd... | woutdenolf/spectrocrunch | spectrocrunch/patch/pint.py | Python | mit | 829 |
from __init__ import db
db.create_all()
db.session.commit() | Hack4Eugene/Hack4Cause2016 | src/bobby-drop-tables/15thnight/db_create.py | Python | mit | 64 |
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... | talon-one/talon_one.py | test/test_attributes_mandatory.py | Python | mit | 2,093 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('adverts', '0011_auto_20151210_1116'),
]
operations = [
migrations.CreateModel(
... | pyshop/pyjobs | src/adverts/migrations/0012_auto_20151214_1910.py | Python | mit | 1,060 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime as dt
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import marshmallow_jsonapi
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinx_issues',
]
primary_domain = 'p... | Tim-Erwin/marshmallow-jsonapi | docs/conf.py | Python | mit | 1,125 |
#!/usr/bin/env python3
"""
Play a sound when the Internet connection is back.
"""
import os
import socket
from pathlib import Path
from time import sleep
from lib import network
from lib.audio import play
ROOT = os.path.dirname(os.path.abspath(__file__))
TIMEOUT = 3
AUDIO = str(Path(ROOT, "assets", "alert.wav"))
... | jabbalaci/Bash-Utils | is_net_back.py | Python | mit | 866 |
from ..utils.command import BaseCommand
from ..utils.tabulate import tabulate
from ..utils.info import get_packages, Sources
class Colors:
PURPLE = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
UNDERLINE = '\033[4m'
ENDC = '\033[0m'
class Command(BaseCommand):
name... | piton-package-manager/piton | piton/commands/outdated.py | Python | mit | 1,511 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
import sys
import getpass
from os.path import expanduser
import stat
import shutil
import bit.git as git
structure="\n\
/file_system_a\n\
|\n\
'- data\n\
|\n\
'- p... | mpg-age-bioinformatics/bit | bit/config.py | Python | mit | 9,252 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | tzpBingo/github-trending | codespace/python/tencentcloud/ie/v20200304/models.py | Python | mit | 146,031 |
#!/usr/bin/env python3
"""
compares two pdf files.
"""
import io
import logging
import sys
import pdfminer.settings
from pdfminer import high_level, layout
pdfminer.settings.STRICT = False
logging.basicConfig()
def compare(file1, file2, **kwargs):
# If any LAParams group arguments were passed,
# create a... | goulu/pdfminer | tools/pdfdiff.py | Python | mit | 5,794 |
"""
#-------------------------------------------------------------------------------
# Name: ALOS HH, HV and RFDI on RGB 16signedint GEOTIFF
# Purpose: Calculates the RFDI , saves geotiff with HH, HV and RFDI layers
# in 8bit unsigned format, with values stretched for contrast enhancement.
# A... | leandromet/Geoprocessamento---Geoprocessing | Palsar_HH_HV_to_RGB8bit.py | Python | mit | 4,323 |
#!/usr/bin/env python
# coding:utf-8
import urllib
domain = 'http://www.liaoxuefeng.com' #廖雪峰的域名
path = r'C:\Users\cyhhao2013\Desktop\temp\\' #html要保存的路径
# 一个html的头文件
input = open(r'C:\Users\cyhhao2013\Desktop\0.html', 'r')
head = input.read()
# 打开python教程主界面
f = urllib.urlopen("http://www.liaoxuefeng.c... | pinggit/plwe | bin/liaoxuefeng_scan.py | Python | mit | 1,649 |
import numpy as n
import scipy.interpolate
import scipy.ndimage
def congrid(a, newdims, method='linear', centre=False, minusone=False):
'''Arbitrary resampling of source array to new dimension sizes.
Currently only supports maintaining the same number of dimensions.
To use 1-D arrays, first promote them to... | martindurant/misc | congrid.py | Python | mit | 3,851 |
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
from structure import __version__
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# str... | kengz/python-structure | setup.py | Python | mit | 976 |
from models import Country, City, Item, Location, Review, Image, Vote, Tag
import requests
BASE_URL = 'http://api.qaym.com/0.1'
class Api(object):
"""
A python interface to the Qaym API
"""
def __init__(self, key=None, base_url=None):
if base_url is None:
self.base_url = BASE_URL
... | abduhbm/python-qaym | qaym/api.py | Python | mit | 4,643 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import urllib
import numpy as np
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.INFO)
# Data sets
IRIS_TRAINING = "iris_training.csv"
IRIS_TRAINING_URL = "http://download.tensorflow.or... | bsautermeister/machine-learning-examples | dnn_classification/tf_learn/dnn_iris.py | Python | mit | 4,053 |
import numpy as np
from astropy import units as u
from astropy.io import fits
from astroNN.apogee import allstar
from astroNN.apogee.downloader import apogee_distances, apogee_rc
from astroNN.gaia import mag_to_absmag, mag_to_fakemag, extinction_correction
from astroquery.vizier import Vizier
def load_apogee_distanc... | henrysky/astroNN | astroNN/datasets/apogee.py | Python | mit | 6,265 |
from .constants import *
from databases import KEGGPathways
from methods.method import Method, MethodResult
from models import Experiment
from networkx import get_edge_attributes
from scipy import stats
from scipy.stats import norm
from stats import ttest
from statsmodels.sandbox.stats import multicomp
import math
impo... | sienkie/pathways-analysis | methods/SPIA/SPIA.py | Python | mit | 12,169 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
... | xianjunzhengbackup/code | http/django/mysite/mysite/settings.py | Python | mit | 3,096 |
"""Order 17: show time with give time and current time.
"""
class ShowTimeWithCurrentAndGiven(object):
@staticmethod
def show(current_timestamp=0, given_timestamp=0):
if current_timestamp - given_timestamp < 0:
return ''
if current_timestamp - given_timestamp < 120:
... | flyingSprite/spinelle | task_inventory/order_1_to_30/order_17_show_time_with_current_and_given.py | Python | mit | 1,185 |
#!/usr/bin/python
# coding: utf-8
class Solution(object):
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
if numRows <= 0:
return []
res = []
for i in range(numRows):
res.append([1 if j == 0 or j == i el... | Lanceolata/code-problems | python/leetcode/Question_118_Pascals_Triangle.py | Python | mit | 400 |
# 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.
# --------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/search/azure-search-documents/samples/async_samples/sample_index_crud_operations_async.py | Python | mit | 3,884 |
from __future__ import print_function
import unittest
from genetic.structures import *
from genetic import *
sample_scheduler = interface.create_scheduler_from_file_test("tests/schedules/morning_class_test.xml")
class TestRoom(unittest.TestCase):
def setUp(self):
self.roomMWF = sample_scheduler.weeks[0].... | donnell74/CSC-450-Scheduler | tests/structures/test_room.py | Python | mit | 628 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'window.ui'
#
# Created: Tue Dec 22 17:18:58 2015
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_MainWindow(object):
def setupUi(se... | RLejolivet/MarioMakerLevelsBot | MarioMakerLevelsBot/MarioMakerLevelsBot/ui/window.py | Python | mit | 18,935 |
"""Flask middleware definitions. This is also where template filters are defined.
To be imported by the application.current_app() factory.
"""
from logging import getLogger
import os
from flask import current_app, render_template, request
from markupsafe import Markup
import simplejson as json
from imp_... | thijsmie/imp_flask | imp_flask/middleware.py | Python | mit | 3,368 |
# -*- coding: utf-8 -*-
#
# Streaker documentation build configuration file, created by
# sphinx-quickstart on Sun Mar 6 12:34:57 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... | aldialimucaj/Streaker | docs/source/conf.py | Python | mit | 11,449 |
#!/usr/bin/env python3
#
# This file is part of the utilities shipped with 'Aleph - A Library for
# Exploring Persistent Homology'. It contains test code to parametrize a
# 'pinched torus'. The parametrization follows a sine pattern as the gap
# towards the singular point is approached.
#
# Original author: Bastian Rie... | Submanifold/Aleph | utilities/make_pinched_torus.py | Python | mit | 1,687 |
# -*- coding: UTF-8 -*-
import datetime
import json
import logging
import re
from mercado.core.base import Mercado
from mercado.core.common import nt_merge
log = logging.getLogger(__name__)
class Safeway(Mercado):
def __init__(self, auth, urls, headers, sleep_multiplier=1.0):
self.auth = auth
se... | furritos/mercado-api | mercado/core/safeway.py | Python | mit | 6,259 |
import sublime
import unittest
import os
import sys
class TestImport(unittest.TestCase):
mpath = None
@classmethod
def setUpClass(cls):
basedir = os.path.dirname(__file__)
mpath = os.path.normpath(os.path.join(
basedir, "..", "st3_{}_{}".format(sublime.platform(), sublime.arc... | dmilith/SublimeText3-dmilith | Packages/Debugger/modules/libs/pywinpty/tests/test_import.py | Python | mit | 909 |
from mpf.tests.MpfFakeGameTestCase import MpfFakeGameTestCase
from unittest.mock import MagicMock, patch
from mpf.tests.MpfTestCase import MpfTestCase
class TestDropTargets(MpfTestCase):
def get_config_file(self):
return 'test_drop_targets.yaml'
def get_machine_path(self):
return 'tests/mac... | missionpinball/mpf | mpf/tests/test_DropTargets.py | Python | mit | 18,577 |
#!/usr/bin/env python
from __future__ import print_function
import datetime
from couchdbkit import *
from couchdbkit.designer import push
from docs import initvars
import config as cfg
import sys
import json
# Wrap sys.stdout into a StreamWriter to allow writing unicode.
import codecs
import locale
sys.stdout = c... | SandStormHoldings/ScratchDocs | couchdb_metastates.py | Python | mit | 1,377 |
#!/usr/bin/env python3
import os
from construct import Adapter, Const, GreedyBytes, Int32ul, Struct, this
from .common import ZeroString, PreallocatedArray, test_folder, mkdir_p
from .encryption import EncryptedBlock
RES_ENCRYPTION = 23, 9782, 3391, 31
# noinspection PyPep8,PyUnresolvedReferences
ResourceEntry = ... | domi-id/across | across/res.py | Python | mit | 2,378 |
#!/usr/bin/env python
"""
Python script to automate downloading pdb files from list received from fludb.org
Devin Villegas
2014/01/02
Input file is tab delimited
PDBid Description Strain Subtype
Will put downloaded pdbs in <cwd>/subtype/strain/pdbs
Depends on the getentry script from ProtCAD
"""
import csv
import os... | dvillega/scripts | collect_pdbs.py | Python | mit | 2,626 |
from tests.models_tests import ModelsTestBase
from test_models.core import Language
from tests import dbhelper
from sqlalchemy.exc import IntegrityError
class TestLanguageModel(ModelsTestBase):
def test_00_init(self):
assert Language
def test_01_populate(self):
dbhelper.add(Language(lang='en... | jfillmore/hoops | tests/models_tests/test_model_language.py | Python | mit | 1,525 |
import numpy as np
import pytest
from astropy import units as u
from hypothesis import given, strategies as st
from eniric.atmosphere import Atmosphere
from eniric.legacy import RVprec_calc_masked, RVprec_calc_weights_masked, mask_clumping
def test_RV_prec_masked(test_spec):
"""Test same precision results betwee... | jason-neal/eniric | tests/test_legacy.py | Python | mit | 3,783 |
#!/usr/bin/env python
ergodoxian = (
("KEY_DeleteBackspace","1x2"),
("KEY_DeleteForward","1x2"),
('KEY_ReturnEnter', '1x2'),
('KEY_Spacebar', '1x2'),
('SPECIAL_Fn', '1x2'),
('KEY_Shift', '1.5x1'),
('KEY_Shift', '1.5x1'),
("KEY_Dash_Underscore", "1.5x1"),
("KEY_Equal_Plus", "1.5x1"),
('KEY_ReturnEnter', '1.5x1'),
("KEY... | jdeblese/ergovolve | proposals.py | Python | mit | 3,554 |
"""
Created on 4/18/17
@author: Numan Laanait -- nlaanait@gmail.com
"""
#MIT License
#Copyright (c) 2017 Numan Laanait
#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, i... | nlaanait/pyxrim | examples/hdf5_export.py | Python | mit | 1,439 |
import random
def read_tri(flike):
tri_arr = []
for line in flike:
line = line.strip("\n")
tri_arr.append([int(s) for s in line.split(" ")])
return tri_arr
# def valid_path(path):
# if path[0] != 0:
# return False
# for idx, pidx in enumerate(path[1:]):
# if not (pi... | andrew-christianson/Polyglot-Euler | Problem 18.py | Python | mit | 2,376 |
#!/usr/bin/python
import ble
import uuids
OPCODE_RESET_EXPENDED=1
class HeartRateService(ble.Service):
uuid=uuids.heart_rate
class HeartRateControlPoint(ble.Characteristic):
uuid=uuids.heart_rate_control_point
def reset_expended(self):
opcode = OPCODE_RESET_EXPENDED
self.va... | markrages/ble | profiles/hrm_service.py | Python | mit | 1,438 |
import hashlib
import shutil
import os
from datetime import datetime
list_of_paths_and_strings = [
["assignment1.cpp", "main()"]
]
def main():
abspath = os.path.abspath(__file__)
dname = os.path.dirname(sys.argv[0])
os.chdir(dname)
if acceptance_test():
make_txt_file()
zip_dir()
def get_md... | shanestockall/EECS-Grading-Rig | src/packages/EECS-211-Grader/acceptancetest_osx.py | Python | mit | 2,279 |
#!/usr/bin/env python
import sys, json, csv, pprint
patrons = []
with open(sys.argv[1]) as csvfile:
csvrows = csv.DictReader(csvfile)
for row in csvrows:
name = row["Name"]
pledge = float(row["Pledge $"].replace("$",""))
lifetime = float(row["Lifetime $"].replace("$",""))
stat... | OverTheWireOrg/OverTheWire-website | patreon/patreon.py | Python | mit | 745 |
from django.shortcuts import render
from django.http import HttpResponseRedirect, HttpResponse
from bs4 import BeautifulSoup as bs
import requests
import json
WIKI_PAGE_BASE = "https://en.wikipedia.org/wiki/"
WIKI_API_BASE = "https://en.wikipedia.org/w/api.php?format=json&action=query"
WIKI_EXTRACT = WIKI_API_BASE... | TimelyToga/wtf_is | wtf_proj/wtf_proj/views.py | Python | mit | 3,001 |
# The MIT License(MIT)
# Copyright (c) 2013-2014 Matt Thomson
# 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, mo... | pyembed/pyembed | pyembed/core/test/parse_test.py | Python | mit | 5,317 |
import os
PRODUCTION = 'merged-corpus'
DEVELOPMENT = 'test'
ENVIRONMENT = PRODUCTION
EPUB = 'epub'
EPUB_DIRNAME = EPUB
TXT = 'txt'
TXT_DIRNAME = TXT
def set_env( env=PRODUCTION ):
global ENVIRONMENT
ENVIRONMENT = env
def get_data_dir():
path_to_here = os.path.dirname( os.path.abspath( __file__ ) )
if... | jorisvanzundert/sfsf | sfsf/sfsf_config.py | Python | mit | 717 |
import unittest
import quite
class MyTestCase(unittest.TestCase):
def test_line_edit_text(self):
with quite.EventLoop(0.1):
line_edit = quite.LineEdit()
line_edit.show()
times = []
@quite.connect_with(line_edit.string.changed)
def text_changed(t... | SF-Zhou/quite | tests/gui/widgets/test_line_edit.py | Python | mit | 731 |
class UnknownCrawler(RuntimeError):
pass
| BStalewski/dontWasteTime | webapp/crawler_app/crawling/exceptions.py | Python | mit | 45 |
from __future__ import absolute_import
from proteus import *
from proteus.default_n import *
try:
from .rdls_p import *
from .vortex2D import *
except:
from rdls_p import *
from vortex2D import *
timeIntegration = NoIntegration
stepController = Newton_controller
# About the nonlinear solver
multilevel... | erdc/proteus | proteus/tests/elliptic_redist/RDLS/rdls_n.py | Python | mit | 1,916 |
"""
Processes the data from whatever format it was captured in and renders
it in a usable form to whoever's knocking.
"""
# Standard modules
import ConfigParser
import os
from os import path
import sys
# Third party
import numpy as N
def config(top_dir='.', debug=False):
# Parse the settings file, check for pro... | l3enny/lasana | parse.py | Python | mit | 4,091 |