code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-26 09:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('directorio', '0011_auto_20160225_0957'),
]
operations = [
migrations.CreateM... | josemfc/directorio-iep | directorio/migrations/0012_video.py | Python | apache-2.0 | 865 |
# -*- coding: utf-8 -*-
"""
Copyright © Val Neekman ([Neekware Inc.](http://neekware.com))
[ info@neekware.com, [@vneekman](https://twitter.com/vneekman) ]
All rights reserved.
Redistribution and use in source and binary forms,
with or without modification,
are permitted provided that the following condition... | TheOstrichIO/tomato-cmd | slugify.py | Python | apache-2.0 | 4,674 |
# !/usr/bin/python
# -*- coding=utf-8 -*-
import json
import urllib2
from books.models import Book
domain = "http://smartebook.zmapp.com:9026"
# 同步图书详情
def sync_book(bid, cm):
# 完结了的图书不更新信息
if Book.objects.filter(id=bid, status=1).count() == 0:
page = urllib2.urlopen("http://wap.cmread.com/r/p/view... | lnybrave/zzbook | data/sync.py | Python | apache-2.0 | 2,231 |
def __bootstrap__():
global __bootstrap__, __loader__, __file__
import sys, pkg_resources, imp
__file__ = pkg_resources.resource_filename(__name__, '_unpacker.cp35-win32.pyd')
__loader__ = None; del __bootstrap__, __loader__
imp.load_dynamic(__name__,__file__)
__bootstrap__()
| stevenzhang18/Indeed-Flask | lib/pandas/msgpack/_unpacker.py | Python | apache-2.0 | 297 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#
# Copyright 2010 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | nearlyfreeapps/python-googleadwords | tests/adspygoogle/adwords/ad_param_service_unittest.py | Python | apache-2.0 | 6,640 |
#!/usr/bin/env python
"""
Copyright 2016 Alex Cortelyou
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... | acortelyou/drone-tools | dji2papywizard.py | Python | apache-2.0 | 5,866 |
from collections import Counter
class Solution(object):
def triangleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
nums = filter(None, nums)
if not nums:
return 0
c = Counter(nums)
N = max(nums)
buckets = [0] * (N + 1... | ckclark/leetcode | py/valid-triangle-number.py | Python | apache-2.0 | 931 |
import os
import requests # pip install requests
# The authentication key (API Key).
# Get your own by registering at https://app.pdf.co
API_KEY = "******************************************"
# Base URL for PDF.co Web API requests
BASE_URL = "https://api.pdf.co/v1"
# Source PDF file
SourceFile = ".\\sample.pdf"
def... | bytescout/ByteScout-SDK-SourceCode | PDF.co Web API/Invoice Parser API/Python/Get Invoice Info From Uploaded File/GetInvoiceInfoFromUploadedFile.py | Python | apache-2.0 | 2,505 |
# Copyright 2015 Tesora Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | openstack/trove | trove/guestagent/common/guestagent_utils.py | Python | apache-2.0 | 5,574 |
# Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | google/BIG-bench | bigbench/benchmark_tasks/gender_sensitivity_english/task.py | Python | apache-2.0 | 20,240 |
"""Constants for AccuWeather integration."""
from __future__ import annotations
from typing import Final
from homeassistant.components.weather import (
ATTR_CONDITION_CLEAR_NIGHT,
ATTR_CONDITION_CLOUDY,
ATTR_CONDITION_EXCEPTIONAL,
ATTR_CONDITION_FOG,
ATTR_CONDITION_HAIL,
ATTR_CONDITION_LIGHTNI... | kennedyshead/home-assistant | homeassistant/components/accuweather/const.py | Python | apache-2.0 | 10,736 |
import sys
from collections import deque
from Catalog.Schema import DBSchema
from Query.Operators.TableScan import TableScan
from Query.Operators.Select import Select
from Query.Operators.Project import Project
from Query.Operators.Union import Union
from Query.Operators.Join import Join
from Query.Ope... | yliu120/dbsystem | HW2/dbsys-hw2/Query/Plan.py | Python | apache-2.0 | 10,860 |
# Copyright 2013-present Barefoot Networks, 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 ... | hanw/p4-hlir | p4_hlir/hlir/exclusive_conditions.py | Python | apache-2.0 | 8,296 |
import pandas as pd
import numpy as np
import numpy.testing as npt
from aneris import harmonize
from aneris import utils
nvals = 6
_df = pd.DataFrame({
'gas': ['BC'] * nvals,
'region': ['a'] * nvals,
'units': ['Mt'] * nvals,
'sector': ['bar', 'foo'] + [str(x) for x in range(nvals - 2)],
'2010':... | gidden/aneris | tests/test_harmonize.py | Python | apache-2.0 | 6,716 |
import asyncio
import logging
from typing import Text
from rasa.core.agent import Agent
from rasa.shared.utils.cli import print_info, print_success
from rasa.shared.utils.io import json_to_string
logger = logging.getLogger(__name__)
def run_cmdline(model_path: Text) -> None:
"""Loops over CLI input, passing eac... | RasaHQ/rasa_nlu | rasa/nlu/run.py | Python | apache-2.0 | 803 |
#!/usr/bin/env python3
# Copyright 2021 The Pigweed Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google/pigweed | pw_build_mcuxpresso/py/pw_build_mcuxpresso/__main__.py | Python | apache-2.0 | 1,865 |
#
# Copyright 2008-2015 Semantic Discovery, 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 applicab... | KoehlerSB747/sd-tools | src/main/python/util/StatsAccumulator.py | Python | apache-2.0 | 5,869 |
##
# Copyright (c) 2014 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | trevor/calendarserver | calendarserver/tools/checkdatabaseschema.py | Python | apache-2.0 | 7,687 |
#!/usr/bin/env python
#coding=utf-8
import logging
from db_operation import *
logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',datefmt='%a, %d %b %Y %H:%M:%S')
def query_conf(marathon,app):
"""
:marathon marathon name
:app_id app id
... | bc-dcos/autoscaling | set_get.py | Python | apache-2.0 | 2,842 |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | nkubala/runtimes-common | ftl/common/ftl_util.py | Python | apache-2.0 | 8,151 |
# Lint as: python3
# Copyright 2018 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 ... | tensorflow/docs | tools/tensorflow_docs/api_generator/doc_controls.py | Python | apache-2.0 | 12,723 |
# flake8: noqa
from .account import AccountViewSet
from .allocation import AllocationViewSet
from .allocation_source import AllocationSourceViewSet
from .boot_script import BootScriptViewSet
from .base import BaseRequestViewSet
from .credential import CredentialViewSet
from .email_template import EmailTemplateViewSet
f... | CCI-MOC/GUI-Backend | api/v2/views/__init__.py | Python | apache-2.0 | 2,314 |
"""Defines the base broker class"""
from abc import ABCMeta
from collections import namedtuple
"""
FileDownload tuple contains an additional partial flag for defining whether the file
is allowed to be accessed directly or must be copied into running container. This is
currently only applicable to the S3Broker and requ... | ngageoint/scale | scale/storage/brokers/broker.py | Python | apache-2.0 | 11,848 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2009,2010,2011,2012,2013,2014,2017 Contributor
#
# 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... | quattor/aquilon | lib/aquilon/worker/formats/network_environment.py | Python | apache-2.0 | 1,782 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# 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 b... | youkochan/shadowsocks-analysis | shadowsocks/manager.py | Python | apache-2.0 | 12,796 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/interfaces/interface/subinterfaces/subinterface/ipv4/addresses/address/__init__.py | Python | apache-2.0 | 15,915 |
#!/usr/bin/env python
#
# Simple TCP line-based text chat server. Clients connect and send a
# conversation ID (any string) as the first line, then they are connected
# to other clients who sent the same conversation ID.
#
# Uses a thread pair per connection, so not highly scalable.
from Queue import Queue, Empty
fro... | splatspace/esprelay | esprelay.py | Python | apache-2.0 | 4,441 |
#!/usr/bin/env python
"""
filterMapview.py <input mapview file> <output filename>
Author: Tony Papenfuss
Date: Mon Jun 16 14:31:42 EST 2008
"""
import os, sys
from useful import progressMessage
iFilename = sys.argv[1]
oFilename = sys.argv[2]
mQ_cutoff = 40
nSeqs = 280000000
oFile = open(oFilename, 'w')
headers ... | PapenfussLab/Srtools | bin/old/filterMaqMapview.py | Python | artistic-2.0 | 1,020 |
# -*- coding: utf-8 -*-
import user
import inscription
import notes
import util
import stage
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | anaslamaizi/Projet-ODOO | __init__.py | Python | artistic-2.0 | 160 |
"""
Configuration of 'memos' Flask app.
Edit to fit development or deployment environment.
"""
# import random
# localhost
# PORT = 5000
# DEBUG = True
# MONGO_PORT = 27017
# ix.cs.uoregon.edu
PORT = 7420 # random.randint(5000, 8000)
MONGO_PORT = 4152
DEBUG = False # Because it's unsafe to run outside localhost
... | hkhamm/proj5-mongo | CONFIG.py | Python | artistic-2.0 | 563 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import time
import datetime
import logging
import csv
import six
from datetime import date
from django.apps import apps
from django.utils import timezone
logger = logging.getLogger(__name__)
ats_settings = apps.get_app_config('ats')
def get_user_rea... | dictoss/active-task-summary | ats/libs.py | Python | bsd-2-clause | 3,533 |
#! /usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# Copyright 2018 the HERA Collaboration
# Licensed under the 2-clause BSD license.
"""script to write M&C records to a CSV file
"""
from astropy.time import Time, TimeDelta
from hera_mc import mc, cm_utils
valid_tables = {
"hera_obs": {"method": "get... | HERA-Team/hera_mc | scripts/write_records_to_file.py | Python | bsd-2-clause | 6,355 |
"""autogenerated by genpy from outdoor_bot/mainTargetsCommand_msg.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class mainTargetsCommand_msg(genpy.Message):
_md5sum = "b1faa92c8dffb7694c609d94e4e2d116"
_type = "outdoor_bot/mainTargetsCommand_ms... | dan-git/outdoor_bot | src/outdoor_bot/msg/_mainTargetsCommand_msg.py | Python | bsd-2-clause | 4,588 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2014 The python-semanticversion project
# This code is distributed under the two-clause BSD License.
try: # pragma: no cover
import django
from django.conf import settings
django_loaded = True
except ImportError: # pragma: no cover
django_loaded = False
... | marcelometal/python-semanticversion | tests/django_test_app/__init__.py | Python | bsd-2-clause | 941 |
'''
Designs oligos for a pre RNA-seq selection method
'''
### imports ###
import sys
import os
import numpy as np
def readFastaFile(fastaFilePath):
'''
Given a path to a multiline fasta file, reads the file, returning two lists - one containing the sequences, the other containing the headers
inputs: path to a fas... | jenhantao/preRNA-seq_OligoDesigner | makeAllOligos.py | Python | bsd-2-clause | 2,270 |
# Copyright 2008 Owen Taylor
#
# This file is part of Reinteract and distributed under the terms
# of the BSD license. See the file COPYING in the Reinteract
# distribution for full details.
#
########################################################################
import glib
from about_dialog import AboutDialog
fro... | alexey4petrov/reinteract | lib/reinteract/main_menu.py | Python | bsd-2-clause | 3,049 |
"""
WSGI config for hackathon project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | python-frederick/hackathon-2016 | hackathon/wsgi.py | Python | bsd-2-clause | 395 |
from readers import (autodiscover, FeedReader, TimestampedModelFeedReader,
RSSFeedReader)
from library import (FeedLibrary)
from dispatch import (SubscriptionDispatcher, SubscriptionEmailer)
from utils import (FeedRecordUpdater, FeedRecordCleaner)
| mjumbewu/django-subscriptions | subscriptions/feeds/__init__.py | Python | bsd-2-clause | 252 |
#!/usr/bin/env python3
# coding:utf-8
import os
import sys
import time
import traceback
from datetime import datetime
import atexit
# reduce resource request for threading
# for OpenWrt
import threading
try:
threading.stack_size(128 * 1024)
except:
pass
try:
import tracemalloc
tracemalloc.start(10)
e... | xyuanmu/XX-Net | code/default/launcher/start.py | Python | bsd-2-clause | 5,393 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from ._overlap import _compute_overlap
__all__ = ['compute_overlap']
def compute_overlap(ilon, ilat, olon, olat):
"""Compute the overlap between two 'pixels' in spherical coordinates.
... | bsipocz/reproject | reproject/spherical_intersect/overlap.py | Python | bsd-2-clause | 1,255 |
# Backend loading
# Based on the Django cache framework
# https://github.com/django/django/blob/5d263dee304fdaf95e18d2f0619d6925984a7f02/django/core/cache/__init__.py
import sys
from importlib import import_module
import warnings
from django.utils import six
from django.utils.module_loading import import_string
from ... | praekelt/nurseconnect | nurseconnect/wagtailsearch/backends/__init__.py | Python | bsd-2-clause | 3,570 |
# Author: Mike 'Fuzzy' Partin
# Copyright: (c) 2016-2018
# Email: fuzzy@fumanchu.org
# License: See LICENSE.md for details
# Stdlib imports
import math
import datetime
def red(txt):
return '\033[1;31m%s\033[0m' % txt
def green(txt):
return '\033[1;32m%s\033[0m' % txt
def yellow(txt):
return '\033[1;33m%... | fuzzy/mvm | mvm/term.py | Python | bsd-2-clause | 2,114 |
import numpy as np
import pandas as pd
from break4w.question import Question
class Continous(Question):
def __init__(self, name, description, units=np.nan, dtype=float,
limits=None,
sig_figs=None, magnitude=1, order=None, **kwargs):
"""A Question object with continous responses
... | jwdebelius/break_4w | break4w/continous.py | Python | bsd-2-clause | 10,502 |
# -- REQUIRES: Python >= 3.5
from behave import step
from behave.api.async_step import async_run_until_complete
import asyncio
@step('an async-step waits {duration:f} seconds')
@async_run_until_complete
async def step_async_step_waits_seconds_py35(context, duration):
"""Simple example of a coroutine as async-step ... | Abdoctor/behave | examples/async_step/features/steps/async_steps35.py | Python | bsd-2-clause | 373 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_page_breaks04.py | Python | bsd-2-clause | 1,171 |
# -*- coding: utf-8 -*-
from celeryone.helpers import queue_one_key, kwargs_to_list, force_string
import pytest
import six
def test_force_string_1():
assert force_string('a') == 'a'
def test_force_string_2():
assert force_string(u'a') == 'a'
def test_force_string_3():
assert force_string('é') == 'é'
... | szandara/celery-one | tests/unit/test_helpers.py | Python | bsd-2-clause | 2,483 |
"""Leetcode 124. Binary Tree Maximum Path Sum
Hard
URL: https://leetcode.com/problems/binary-tree-maximum-path-sum/
Given a non-empty binary tree, find the maximum path sum.
For this problem, a path is defined as any sequence of nodes from some starting
node to any node in the tree along the parent-child connections... | bowen0701/algorithms_data_structures | lc0124_binary_tree_maximum_path_sum.py | Python | bsd-2-clause | 2,485 |
import os
from setuptools import find_packages, setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
install_requires = [
'requests==2.8.1... | technoarch-softwares/linkedin-auth | setup.py | Python | bsd-2-clause | 1,410 |
import base64
import httplib
import json
import os
import re
import ssl
import urllib
from urlparse import urlunsplit
from exceptions import CloudPassageAuthentication
class HaloSession(object):
"""All Halo API session management happens in this object.
Args:
key(str): Halo API key
secret(str... | ashmastaflash/cloudpassage_slim | cloudpassage_slim/halo_session.py | Python | bsd-2-clause | 3,951 |
"""HTML Exporter class"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import os
from traitlets import default, Unicode
from traitlets.config import Config
from nbconvert.filters.highlight import Highlight2HTML
from nbconvert.filters.markdown_mistune import IP... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/nbconvert/exporters/html.py | Python | bsd-2-clause | 3,189 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import os
def strip_comments(l):
return l.split('#', 1)[0].strip()
def reqs(*f):
return list(filter(None, [strip_comments(l) for l in open(
os.path.join(os.getcwd(), *f)).readlines()]))
def get_version(version_tuple):
if not i... | 20tab/python-gmaps | setup.py | Python | bsd-2-clause | 1,557 |
from .parseStateProtoFile import *
from .StateTreeModel import *
| poobalan-arumugam/stateproto | src/extensions/lang/python/reader/__init__.py | Python | bsd-2-clause | 65 |
#! ../env/bin/python
from flask import Flask
from webassets.loaders import PythonLoader as PythonAssetsLoader
from appname import assets
from appname.models import db
from appname.controllers.main import main
from appname.controllers.categories import categories
from appname.controllers.products import products
from ... | ahmadpriatama/Flask-Simple-Ecommerce | appname/__init__.py | Python | bsd-2-clause | 1,969 |
from django.test import TestCase
from django.contrib.gis.geos import (LineString, Polygon, MultiPolygon,
MultiLineString, MultiPoint, Point)
from django.core.exceptions import ValidationError
from django.conf import settings
from django.test.utils import override_settings
from unit... | GeotrekCE/Geotrek-admin | geotrek/trekking/tests/test_models.py | Python | bsd-2-clause | 21,282 |
### Interactively plot points
### to show the correlation between the x and y directions.
### By Rajeev Raizada, Jan.2011.
### Requires Python, with the Matplotlib and SciPy modules.
### You can download Python and those modules for free from
### http://www.python.org/download
### http://scipy.org
### http://matplotlib... | sniemi/SamPy | plot/interactive_correlation_plot.py | Python | bsd-2-clause | 11,714 |
# e Django settings for dss project.
import os
import mimetypes
from django.core.urlresolvers import reverse_lazy
import djcelery
from django.conf import global_settings
from dss import logsettings
from utils import here
from localsettings import *
from pipelinesettings import *
from storagesettings impor... | fergalmoran/dss | dss/settings.py | Python | bsd-2-clause | 6,629 |
"""
WSGI config for base freebasics.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault(
"DJANGO_S... | praekelt/molo-freebasics | freebasics/wsgi.py | Python | bsd-2-clause | 409 |
# Copyright (c) 2017, Matt Layman
from ConfigParser import ConfigParser, NoOptionError, NoSectionError
import os
import sys
import requests
API_URL = 'https://www.transifex.com/api/2'
LANGUAGES = [
'ar',
'de',
'el',
'es',
'fr',
'it',
'nl',
'pt_BR',
]
def fetch_po_for(language, usern... | handroll/handroll | transifex.py | Python | bsd-2-clause | 1,809 |
def solve():
return sum([n for n in range(1,1000) if (n % 3 == 0) or (n % 5 == 0)])
| brunorijsman/euler-problems-python | euler/problem001.py | Python | bsd-2-clause | 87 |
np.identity(3) | jorisvandenbossche/DS-python-data-analysis | notebooks/python_recap/_solutions/05-numpy35.py | Python | bsd-3-clause | 14 |
from __future__ import absolute_import, unicode_literals
from datetime import datetime
import json
import random
import pytz
from smartmin.models import SmartModel
from temba import TembaClient
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.core.cache import cache
from... | peterayeni/dash | dash/orgs/models.py | Python | bsd-3-clause | 12,481 |
"""
`GrammarLexer` is compatible with Pygments lexers and can be used to highlight
the input using a regular grammar with token annotations.
"""
from __future__ import unicode_literals
from pygments.token import Token
from prompt_toolkit.layout.lexers import Lexer
from .compiler import _CompiledGrammar
__all__ = (
... | niklasf/python-prompt-toolkit | prompt_toolkit/contrib/regular_languages/lexer.py | Python | bsd-3-clause | 2,621 |
# stdlib
import re
import traceback
from contextlib import closing, contextmanager
from collections import defaultdict
# 3p
import pymysql
try:
import psutil
PSUTIL_AVAILABLE = True
except ImportError:
PSUTIL_AVAILABLE = False
# project
from config import _is_affirmative
from checks import AgentCheck
GAU... | lookout/dd-agent | checks.d/mysql.py | Python | bsd-3-clause | 62,670 |
import sys
from django.conf import settings
from django.core.exceptions import MiddlewareNotUsed
from django.core.signals import got_request_exception
from django.http import HttpResponse
from django.template import engines
from django.template.response import TemplateResponse
from django.test import RequestFa... | yephper/django | tests/middleware_exceptions/tests.py | Python | bsd-3-clause | 45,313 |
raise Exception("tests where moved to emzed to avoid circular dependencies")
| uweschmitt/emzed_optimizations | tests/test_sample.py | Python | bsd-3-clause | 77 |
"""Tests for cement.core.extension."""
from cement.core import exc, backend, extension, handler, output, interface
from cement.utils import test
class IBogus(interface.Interface):
class IMeta:
label = 'bogus'
class BogusExtensionHandler(extension.CementExtensionHandler):
class Meta:
inter... | rjdp/cement | tests/core/extension_tests.py | Python | bsd-3-clause | 1,546 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vi: ts=4 sw=4
################################################################################
# Code for defining a 'Sample' object, which keeps track of its state, and
# simplifies the task of aligning, measuring, etc.
################################################... | yugangzhang/GitTest | CMS_Profile/94-sample.py | Python | bsd-3-clause | 105,895 |
# -*- coding: utf-8 -*-
# Copyright 2018 GIG Technology NV
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | threefoldfoundation/app_backend | plugins/tff_backend/migrations/_009_change_token_value.py | Python | bsd-3-clause | 1,840 |
import sys
import os
# import device
# import plugin
import pkg_resources
def version():
return pkg_resources.get_distribution(aux.__package__.title()).version
def base_dir():
return os.path.abspath(os.path.dirname(aux.__file__))
def working_dir():
return os.getcwd()
import aux
from aux.logger import Lo... | bischjer/auxiliary | aux/__init__.py | Python | bsd-3-clause | 2,087 |
from docar import Document, Collection
from docar import fields
from docar.backends.http import HttpBackendManager
from libthirty.state import uri, app_uri, service_uri, resource_collection_uri
from libthirty.validators import naming, max_25_chars, naming_with_dashes
import os
HttpBackendManager.SSL_CERT = os.path.... | 30loops/libthirty | libthirty/documents.py | Python | bsd-3-clause | 6,039 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-25 00:10
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import filer.fields.file
class Migration(migrations.Migration):
initial = True
dependen... | django-danceschool/django-danceschool | danceschool/financial/migrations/0002_auto_20170425_0010.py | Python | bsd-3-clause | 3,541 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributi... | bitcraft/pyglet | pyglet/graphics/allocation.py | Python | bsd-3-clause | 14,197 |
# Copyright (c) 2011-2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module that handles interactions with a Validation Pool.
The validation pool is the set of commits that are ready to be validated i.e.
ready ... | bpsinc-native/src_third_party_chromite | cbuildbot/validation_pool.py | Python | bsd-3-clause | 106,838 |
squares = [x**2 for x in range(10)]
print squares
couples = [(x, y) for x in [1,2,3] for y in [3,1,4] if x != y]
print couples
| ufo22940268/my-tours | content/prog/tour/list_comprehension.py | Python | bsd-3-clause | 128 |
# proxy module
from __future__ import absolute_import
from envisage.plugins.refresh_code.refresh_code_plugin import *
| enthought/etsproxy | enthought/plugins/refresh_code/refresh_code_plugin.py | Python | bsd-3-clause | 118 |
from django.core.files.uploadedfile import InMemoryUploadedFile
import re
import six
from django import forms
from django.forms.util import flatatt
from django.forms.widgets import FileInput
from django.template import Context
from django.template.loader import render_to_string
from django.utils.encoding import force_... | MrReN/django-oscar | oscar/forms/widgets.py | Python | bsd-3-clause | 5,740 |
from django.forms import ModelForm
from django import forms
from crispy_forms import layout
from crispy_forms.layout import Layout, HTML
from hs_core.forms import BaseFormHelper, Helper
from hs_core.hydroshare import users
from hs_modelinstance.models import ModelOutput, ExecutedBy
from hs_modflow_modelinsta... | ResearchSoftwareInstitute/MyHPOM | hs_modflow_modelinstance/forms.py | Python | bsd-3-clause | 27,274 |
from django.apps import apps
from django.conf import settings
from django_sharding_library.fields import BasePostgresShardGeneratedIDField
from django_sharding_library.exceptions import DjangoShardingException, InvalidMigrationException
from django_sharding_library.utils import (
is_model_class_on_database,
ge... | uncovertruth/django-sharding | django_sharding_library/router.py | Python | bsd-3-clause | 7,143 |
import random
import string
from django.contrib.auth.models import User
from django.test import TestCase
from longerusernameandemail.forms import UserCreationForm
def get_random_string(alpha=string.ascii_letters, length=100):
"Get a 'long', randmon string"
return ''.join([random.choice(alpha) for i in range... | madssj/django-longer-username-and-email | longerusernameandemail/tests/__init__.py | Python | bsd-3-clause | 5,387 |
# Copyright (c) 2005 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list ... | andrewfu0325/gem5-aladdin | src/python/m5/main.py | Python | bsd-3-clause | 14,348 |
import unittest
from scrapy.http import Request
from scrapy.utils.request import request_fingerprint, _fingerprint_cache, \
request_authenticate, request_httprepr
class UtilsRequestTest(unittest.TestCase):
def test_request_fingerprint(self):
r1 = Request("http://www.example.com/query?id=111&cat=222")... | eLRuLL/scrapy | tests/test_utils_request.py | Python | bsd-3-clause | 4,301 |
import redis
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.config import Configurator
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
authorization_policy = ACLAuthorizati... | AppEnlight/demo-application | src/appenlight_demo/__init__.py | Python | bsd-3-clause | 939 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# 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/navigation/commandes/matelot/__init__.py | Python | bsd-3-clause | 3,210 |
from django.utils import unittest
from django.contrib import admin
from hyperadmin.sites import ResourceSite
class SiteTestCase(unittest.TestCase):
def test_install_from_admin_site(self):
site = ResourceSite()
admin.autodiscover()
site.install_models_from_site(admin.site)
... | webcube/django-hyperadmin | hyperadmin/tests/test_sites.py | Python | bsd-3-clause | 360 |
def extract夢見る世界(item):
"""
Parser for '夢見る世界'
"""
if 'Otome Games' in item['tags']:
return None
if 'Drama CDs' in item['tags']:
return None
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
tagmap = [... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extract夢見る世界.py | Python | bsd-3-clause | 772 |
import numpy as np
from bokeh.document import Document
from bokeh.models import ColumnDataSource, DataRange1d, Plot, LinearAxis, Grid
from bokeh.models.glyphs import Patch
from bokeh.plotting import show
N = 30
x1 = np.linspace(-2, 2, N)
x2 = x1[::-1]
y1 = x1**2
y2 = x2**2 + (x2+2.2)
x = np.hstack((x1, x2))
y = np.hs... | almarklein/bokeh | tests/glyphs/Patch.py | Python | bsd-3-clause | 987 |
#!flask/bin/python
import os
import unittest
from coverage import coverage
cov = coverage(branch = True, omit = ['flask/*', 'tests.py'])
cov.start()
from config import basedir
from app import app, db
from app.models import User
from datetime import datetime, timedelta
from app.models import User, Post
class TestCase... | VagrantApe/flaskMicroblog | tests.py | Python | bsd-3-clause | 5,133 |
# -*- coding: utf8 -*-
__author__ = 'shin'
import jieba
namelist_answer=[]
'''
namelist_answer.append('[slot_name]。')
namelist_answer.append('叫[slot_name]。')
namelist_answer.append('姓名是[slot_name]。')
namelist_answer.append('我是[slot_name]。')
namelist_answer.append('您好,我叫[slot_name]。')
namelist_answer.append('[slot_name... | shincling/MemNN_and_Varieties | DataCoupus/list_document/namelist_answer.py | Python | bsd-3-clause | 2,870 |
def g(x):
import random
return int(x * random.random())
def h(x):
return sum(tmap(g, x))
def f(x,y):
return x*y
x = range(10)
y = range(5)
if __name__ == '__main__':
from pathos.helpers import freeze_support
freeze_support()
from pathos.pools import ProcessPool, ThreadPool
amap = ProcessPo... | mathieudesro/pathos | examples/nested.py | Python | bsd-3-clause | 629 |
import re
with open('d07.txt') as f:
raw_input = f.readlines()
test_input = """abba[mnop]qrst
abcd[bddb]xyyx
aaaa[qwer]tyui
ioxxoj[asdfgh]zxcvbn
asdfasdf[qwerqwer]asdffdsa[12341234]zcxvzcv""".splitlines()
def group_finder(s):
head, _, tail = s.partition('[')
yield head
if tail:
yield from gr... | sclarke/adventofcode2016 | d07.py | Python | bsd-3-clause | 1,196 |
import collections
import lxml.objectify
import mock
import zeit.cms.repository.interfaces
import zeit.cms.tagging.interfaces
import zeit.cms.tagging.tag
import zope.component
import zope.interface
NAMESPACE = "http://namespaces.zeit.de/CMS/tagging"
KEYWORD_PROPERTY = ('testtags', NAMESPACE)
class DummyTagger(objec... | ZeitOnline/zeit.cms | src/zeit/cms/tagging/testing.py | Python | bsd-3-clause | 5,795 |
import os
import logging
import tqdm
from urllib.request import urlretrieve, URLError
import multiprocessing as mp
import itertools
import numpy as np
log = logging.getLogger(__name__)
def download_PHOENIX_models(path, ranges=None, parameters=None):
"""
Download the PHOENIX grid models from the Goettingen ... | iancze/Starfish | Starfish/grid_tools/utils.py | Python | bsd-3-clause | 10,682 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# 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
# ... | blutack/mavlog | docs/conf.py | Python | bsd-3-clause | 8,361 |
"""Base class for undirected graphs.
The Graph class allows any hashable object as a node
and can associate key/value attribute pairs with each undirected edge.
Self-loops are allowed but multiple edges are not (see MultiGraph).
For directed graphs see DiGraph and MultiDiGraph.
"""
# Copyright (C) 2004-2015 by
# ... | chrisnatali/networkx | networkx/classes/graph.py | Python | bsd-3-clause | 55,144 |
#!/usr/bin/python
#
# Copyright 2014-2015 Facebook, 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 l... | rtrouton/Recipes-for-AutoPkg | android_sdk/AndroidSDKVersioner.py | Python | bsd-3-clause | 2,375 |
# Author: Travis Oliphant, 2002
#
# Further updates and enhancements by many SciPy developers.
#
from __future__ import division, print_function, absolute_import
import math
import types
import warnings
from . import statlib
from . import stats
from .stats import find_repeats
from . import distributions
from numpy i... | sargas/scipy | scipy/stats/morestats.py | Python | bsd-3-clause | 48,888 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from catapult_base.dependency_manager import dependency_info
class DependencyInfoTest(unittest.TestCase):
def testInitRequiredInfo(self):... | Bysmyyr/chromium-crosswalk | tools/telemetry/catapult_base/dependency_manager/dependency_info_unittest.py | Python | bsd-3-clause | 19,819 |
from csv import DictReader
from django.core.management.base import BaseCommand
from registrations.models import ClinicCode
class Command(BaseCommand):
help = (
"This command takes in a CSV with the columns: uid, code, facility, province,"
"and location, and creates/updates the cliniccodes in the... | praekeltfoundation/ndoh-hub | registrations/management/commands/upload_clinic_codes.py | Python | bsd-3-clause | 2,626 |
from django.conf import settings
REDMINE_SERVER_URL = getattr(settings, 'REDMINE_SERVER_URL', 'https://localhost')
| JulienDrecq/RedmineTimer | redmine_auth/settings.py | Python | bsd-3-clause | 116 |
from traits.api import Bool, Float, Tuple
from tvtk.api import tvtk
from .volume_scene_member import ABCVolumeSceneMember
# Convenience for the trait definitions below
FloatPair = Tuple(Float, Float)
class VolumeAxes(ABCVolumeSceneMember):
""" An object which builds a CubeAxesActor for a scene containing a Volu... | dmsurti/ensemble | ensemble/volren/volume_axes.py | Python | bsd-3-clause | 2,316 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.