code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import logging
import fmcapi
def test__cert_enrollment(fmc):
logging.info("Testing CertEnrollment class. Requires a CertEnrollment")
obj1 = fmcapi.CertEnrollments(fmc=fmc)
logging.info("All CertEnrollments -- >")
result = obj1.get()
logging.info(result)
logging.info(f"Total items: {len(result... | daxm/fmcapi | unit_tests/certificate_enrollment.py | Python | bsd-3-clause | 405 |
#!/usr/bin/env python3
import os, sys, signal, argparse, configparser, traceback, time
from contextlib import closing
from ananas import PineappleBot
import ananas.default
# Add the cwd to the module search path so that we can load user bot classes
sys.path.append(os.getcwd())
bots = []
def shutdown_all(signum, fram... | Chronister/ananas | ananas/run.py | Python | mit | 2,535 |
# -*- coding: utf8 -*-
"""
Created on 23/08/2010
@author vbmendes
"""
from django.test import TestCase
from shorturl import conf
class RedirectTest(TestCase):
urls = 'shorturl.urls'
fixtures = ['shorturl-test-data.json']
def setUp(self):
self.old_models = conf.MODELS
conf.MODELS = {
... | vbmendes/django-meio-shorturl | src/shorturl/tests/test_views.py | Python | bsd-3-clause | 2,085 |
import requests
import json
from requests_oauthlib import OAuth1
from requests_oauthlib import OAuth1Session
import time
# This code was built using Python 3.5
start_time = time.time()
baseURI = 'https://{YOUR BASE URI}/interaction_history/api/account/{YOUR ACCOUNT NUMBER}/interactions/search?offset=0&limit=10'
cons... | scottwestover/LiveEngageExamples | APIs/Engagement History API/Python-EngagementHistoryAPISample/ehapiExample.py | Python | mit | 2,225 |
from django.conf.urls.defaults import patterns, include, url
from django.contrib.auth.decorators import permission_required, login_required
from rapidsms_httprouter.views import console
from django.conf import settings
urlpatterns = patterns('',
url(r'^users/', include('smartmin.users.urls')),
url(r'^text/', i... | nyaruka/motome | motome/urls.py | Python | bsd-3-clause | 1,851 |
# -*- test-case-name: go.apps.surveys.tests.test_vumi_app -*-
from twisted.internet.defer import inlineCallbacks
from vxpolls.example import PollApplication
from vxpolls.manager import PollManager
from vumi.message import TransportUserMessage
from vumi import log
from go.vumitools.app_worker import GoApplicationMixi... | praekelt/vumi-go | go/apps/surveys/vumi_app.py | Python | bsd-3-clause | 4,964 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------
# test_groupProperties.py
#
# test for groupProperties rule
# ----------------------------------------------------------------
# copyright (c) 2014 - Domen Ipavec
# Distributed under The MIT License, see L... | matematik7/CSSQC | tests/test_groupProperties.py | Python | mit | 1,126 |
"""
===========================
make_imbalance function
===========================
An illustration of the make_imbalance function
"""
# Authors: Dayvid Oliveira
# Christos Aridas
# Guillaume Lemaitre <g.lemaitre58@gmail.com>
# License: MIT
from collections import Counter
import matplotlib.pyplot... | glemaitre/UnbalancedDataset | examples/datasets/plot_make_imbalance.py | Python | mit | 1,841 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cint, flt, cstr
from frappe import msgprint, _
import frappe.defaults
from erpnext.accounts.general_ledger import... | MartinEnder/erpnext-de | erpnext/controllers/stock_controller.py | Python | agpl-3.0 | 14,728 |
#!/usr/bin/env python
import random
from src.core import setcore as core
try:
print ("\n [****] Custom Template Generator [****]\n")
author=raw_input(core.setprompt(["7"], "Name of the author"))
filename=randomgen=random.randrange(1,99999999999999999999)
filename=str(filename)+(".template")
origin=raw_i... | firebitsbr/pwn_plug_sources | src/set/src/sms/client/custom_sms_template.py | Python | gpl-3.0 | 886 |
#!/usr/bin/python
script = r"""
MD Dir1
MD Dir1\Dir2
MF Dir1\readme.txt
COPY Dir1 Dir1
"""
expected = r"""
C:
|_DIR1
|_DIR1
| |_DIR2
| |
| |_readme.txt
|
|_DIR2
|
|_readme.txt
"""
import test
test.run(script, expected)
| artemkin/sandbox | fme/tests/test_copy_to_itself.py | Python | bsd-2-clause | 262 |
import html
import os
from random import randint
import requests
from pdf417as_str import convert
from pdf417as_str import main
# supported symbols
symbols = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
test_data = [
(symbols, -1),
('ab12', 2),
('Tran... | ikvk/pdf417as_str | test/test.py | Python | lgpl-3.0 | 2,344 |
from django.contrib.auth.models import User
from django.db import models
from django.test import TestCase
from lingo.forms import LingoForm
from lingo.models import LabelCustomization
class TestModel(models.Model):
name = models.CharField(max_length=200)
rank = models.CharField(max_length=200)
serial_numb... | ryates/django-lingo | lingo/tests.py | Python | bsd-3-clause | 1,163 |
from setuptools import setup, find_packages
setup(
name='django-test-html-form',
version='0.1',
description="Make your Django HTML form tests more explicit and concise.",
long_description=open('README.rst').read(),
keywords='django test assert',
author='Dan Claudiu Pop',
author_email='danc... | danclaudiupop/django-test-html-form | setup.py | Python | bsd-3-clause | 546 |
#!/usr/bin/env python
"""Test file names for tvnamer
"""
import datetime
files = {}
files['default_format'] = [
{'input': 'Scrubs - [04x19] - My Best Laid Plans',
'parsedseriesname': 'Scrubs',
'correctedseriesname': 'Scrubs',
'seasonnumber': 4, 'episodenumbers': [19],
'episodenames': ['My Best ... | lahwaacz/tvnamer | tests/test_files.py | Python | unlicense | 16,174 |
import os
from genomepy.plugins import Plugin
from genomepy.utils import cmd_ok, mkdir_p, rm_rf, run_index_cmd
class Minimap2Plugin(Plugin):
def after_genome_download(self, genome, threads=1, force=False):
if not cmd_ok("minimap2"):
return
# Create index dir
index_dir = genom... | simonvh/genomepy | genomepy/plugins/minimap2.py | Python | mit | 1,157 |
# 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/appconfiguration/azure-appconfiguration/samples/conditional_operation_sample.py | Python | mit | 2,180 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
aliases = [
"number_of_young_households=gridcell.aggregate(urbansim.household.is_young)",
"number_of_home_owners=gridcell.aggregate(urbansim.household.is_home_owner)",
... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim/gridcell/aliases.py | Python | gpl-2.0 | 524 |
"""Simple example showing several generations of spans in a trace.
"""
import argparse
import sys
import time
import traceback
import opentracing
import xray_ot.tracer
def sleep_dot():
"""Short sleep and writes a dot to the STDOUT.
"""
time.sleep(0.05)
sys.stdout.write('.')
sys.stdout.flush()
def... | nornagon/xray-python-opentracing | examples/trivial/main.py | Python | mit | 3,112 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2018_01_01/operations/connection_monitors_operations.py | Python | mit | 32,322 |
from Pipe import Pipe
from PeriodicEnergy import PeriodicEnergy
from StaticImage import StaticImage
from WeeklyExtrema import WeeklyExtrema
from IndividualContest import IndividualContest
| interactiveinstitute/watthappened | drivers/__init__.py | Python | mit | 188 |
# encoding: 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):
# Adding model 'MailQueueItem'
db.create_table(u'mailq', (
('id', self.gf('django.db.models.fi... | liveaverage/baruwa | src/baruwa/status/migrations/0001_initial.py | Python | gpl-2.0 | 2,911 |
#!/usr/bin/env python
import json
import sys
metrics = {}
dimensions = {
"dim1": "val1"
}
metrics['first'] = {
"name": "example",
"value": 2.0,
"dimensions": dimensions,
"metricType": "gauge"
}
metrics['second'] = {
"name": "anotherExample",
"value": 2.0,
"dimensions": dimensions,
... | tsheasha/fullerite | examples/adhoc/example.py | Python | apache-2.0 | 457 |
"""
================================
Temporal whitening with AR model
================================
Here we fit an AR model to the data and use it
to temporally whiten the signals.
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import numpy as np
from scipy... | teonlamont/mne-python | examples/time_frequency/plot_temporal_whitening.py | Python | bsd-3-clause | 1,840 |
import luigi
import sciluigi
import ssl
import cv2
import six.moves.urllib.request
import urllib
import pyannote.video
import pyannote.video.structure
import pyannote.video.face.face
import pyannote.video.face.tracking
import pyannote.video.face.clustering
from pyannote.core import Timeline
import pyannote.core.json
... | pyannote/pyannote-workflows | pyannote_workflows/workflows/persondiscovery2016/face.py | Python | mit | 9,955 |
from __future__ import absolute_import, unicode_literals
import json
from flask import current_app, request, Response
from flask_restful import Resource
from urllib import quote
from freight.config import db
from freight.exceptions import ApiError
from freight.utils.auth import get_current_user
LINK_HEADER = '<{uri... | jkimbo/freight | freight/api/base.py | Python | apache-2.0 | 3,675 |
# Example script that shows how the co-routines will work
def audit(self, req):
for i in ["adam", "test", "xss", "blah"]:
new_req = req
new_req.param[0] = i
yield new_req
response = yield
if i in response:
print "VULN FOUND"
def example_crawle... | adamdoupe/enemy-of-the-state | audit/example.py | Python | gpl-2.0 | 713 |
# ext/compiler.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
r"""Provides an API for creation of custom ClauseElements and compilers.
Synopsis
... | sqlalchemy/sqlalchemy | lib/sqlalchemy/ext/compiler.py | Python | mit | 20,045 |
from sys import stdout
import pprint
import psycopg2
# Make a new Grouvie table to store all the plans
CREATE_GROUVIE = """
CREATE TABLE GROUVIE(
PHONE_NUMBER CHAR(11) NOT NULL,
LEADER CHAR(11) NOT NULL,
CREATION_DATETIME CHAR(19) NOT NULL,
DATE ... | Team-JETT/Grouvie | Back-end/DBManager.py | Python | mit | 11,947 |
import unittest
from libs.funcs import *
class TestFuncs(unittest.TestCase):
def test_buildPaths(self):
recPaths, repPaths, rouPaths, corePaths = buildPaths()
findTxt = lambda x, y: x.find(y) > -1
assert findTxt(recPaths["Task"][0], "base")
assert findTxt(recPaths["Department"][0... | ancho85/pylint-playero-plugin | tests/test_funcs.py | Python | gpl-2.0 | 3,850 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base... | tysonholub/twilio-python | twilio/rest/video/v1/room/room_participant/room_participant_subscribed_track.py | Python | mit | 15,072 |
#!/usr/bin/env python
# Copyright 2015 Bryce Schroeder, www.bryce.pw, bryce.schroeder@gmail.com
# Wiki: http://www.ferazelhosting.net/wiki/delv
#
# 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 Fo... | BryceSchroeder/delvmod | redelv/redelvlib/level_editors.py | Python | gpl-3.0 | 41,490 |
from django.views.generic import RedirectView
from django.conf.urls import url
from . import views
app_name = 'micropress'
urlpatterns = [
url(r'^$', RedirectView.as_view(url='article/', permanent=False)),
url(r'^article/$', views.ArticleListView.as_view(),
name='article_list'),
url(r'^article/(?... | jbradberry/django-micro-press | micropress/urls.py | Python | mit | 487 |
#!/usr/bin/env python
import sys
import shutil
from cdrouter import CDRouter
from cdrouter.configs import Config
if len(sys.argv) < 3:
print('usage: <base_url> <token> [<config-ids>] [<device-ids>] [<package-ids>] [<result-ids>]')
sys.exit(1)
base = sys.argv[1]
token = sys.argv[2]
config_ids = None
device_... | qacafe/cdrouter.py | examples/bulk_export.py | Python | mit | 1,089 |
from datetime import date, timedelta
import io
import os
import json
import shutil
import random
import string
import unittest
from unittest import mock
import tempfile
import responses
from sqlalchemy import Column, Table, Unicode, create_engine
from cumulusci.core.exceptions import BulkDataException, TaskOptionsErr... | SalesforceFoundation/CumulusCI | cumulusci/tasks/bulkdata/tests/test_load.py | Python | bsd-3-clause | 81,450 |
# encoding=utf8
# (c) Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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
... | openstack/os-brick | os_brick/tests/test_executor.py | Python | apache-2.0 | 6,655 |
"""
A small templating language
This implements a small templating language. This language implements
if/elif/else, for/continue/break, expressions, and blocks of Python
code. The syntax is::
{{any expression (function calls etc)}}
{{any expression | filter}}
{{for x in y}}...{{endfor}}
{{if x}}x{{elif y}}y... | DailyActie/Surrogate-Model | 01-codes/numpy-master/tools/npy_tempita/__init__.py | Python | mit | 44,114 |
#!/usr/bin/env python
# Copyright 2013 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.
"""Tests for the module module, which contains Module and related classes."""
import os
import unittest
from py_vulcanize import fake... | SummerLW/Perf-Insight-Report | third_party/py_vulcanize/py_vulcanize/module_unittest.py | Python | bsd-3-clause | 4,004 |
# Copyright 2014 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_packages/mdadm.py | Python | apache-2.0 | 1,002 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_07_01/operations/_subnets_operations.py | Python | mit | 35,774 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/py-pyparsing/package.py | Python | lgpl-2.1 | 2,057 |
# Copyright 2017 BrainPad 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... | BrainPad/FindYourCandy | webapp/candysorter/models/texts.py | Python | apache-2.0 | 4,296 |
#!/usr/bin/env python
"""
Draw a graph of the net architecture.
"""
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from google.protobuf import text_format
import caffe
import caffe.draw
from caffe.proto import caffe_pb2
def parse_args():
"""Parse input arguments
"""
parser = Argument... | aayushbansal/PixelNet | tools/caffe/python/draw_net.py | Python | mit | 1,934 |
"""
This recipe calculates statistics on values of a raster within the zones of a
vector dataset. It returns for each feature a dictionary item (FID) with the
statistical values in the following order:
Average, Mean, Medain, Standard, Deviation, Variance
While this recipe works and is a good example, it is generally ... | EC-software/EC_stuff | gdal_stuff/grab_zonal_values.py | Python | gpl-2.0 | 4,909 |
from typing import overload
class A:
@overload
def bar(self, value: str) -> None:
pass
@overload
def bar(self, value: int) -> str:
pass
def bar(self, value):
return None
A().bar("") | allotria/intellij-community | python/testData/refactoring/rename/overloadsAndImplementationInClassRenameCall_after.py | Python | apache-2.0 | 231 |
"""The climate tests for the venstar integration."""
from unittest.mock import patch
from homeassistant.components.climate.const import (
SUPPORT_FAN_MODE,
SUPPORT_PRESET_MODE,
SUPPORT_TARGET_HUMIDITY,
SUPPORT_TARGET_TEMPERATURE,
)
from .util import async_init_integration, mock_venstar_devices
EXPEC... | home-assistant/home-assistant | tests/components/venstar/test_climate.py | Python | apache-2.0 | 2,706 |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... | NeostreamTechnology/Microservices | venv/lib/python2.7/site-packages/simplejson/__init__.py | Python | mit | 23,698 |
from distutils.core import setup
from Cython.Build import cythonize
setup(
setup_requires=[
'cython>=0.x',
],
ext_modules=cythonize(
["pytset.pyx", "tset.cpp"],
language="c++",
),
)
| jmnybl/setlib | setup.py | Python | gpl-2.0 | 223 |
# Copyright 2012-2013 Eric Ptak - trouch.com
#
# 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... | myDevicesIoT/Cayenne-Agent | myDevices/devices/digital/pcf8574.py | Python | mit | 2,274 |
import math
def max_sub_array(array, begin=None, end=None):
def max_sub_array_mid(arr, begin_m, end_m, middle):
l_sum, l_max_index, l_max_sum = 0, None, None
l_local = middle - 1
while l_local >= begin_m:
l_sum += arr[l_local]
if l_max_index is None:
... | ShengGuangzhi/SummerTree | algorithm/python_version/basic/max_sub_array.py | Python | mit | 2,257 |
#!/usr/bin/env python
#=========================================================================
#
# Copyright Insight Software Consortium
#
# 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
... | prasadvagdargi/med_image_analysis | Examples/Python/ExtractSlice.py | Python | apache-2.0 | 1,397 |
#-*- coding:utf-8 -*-
import dircache, os, math
from PIL import Image
from psd_tools import PSDImage
from psd_tools import Group
import json
class Rect:
width = 0
height = 0
x = 0
y = 0
name = ""
class MergeImg:
sizes = [16, 32, 64, 128, 256, 512, 1024, 2048, 4096]
div = 1 #间隔像素
width = 0
height = 0
imgs = ... | hookehu/utility | max_rects.py | Python | gpl-2.0 | 1,716 |
#-*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('oauth2_authorization_server.account',
(r'^login/?$', 'login'),
(r'^logout/?$', 'logout'),
(r'^signup/?$', 'signup'),
(r'^clients/?$', 'clien... | RaduGatej/SensibleData-Platform | sensible_data_platform/oauth2_authorization_server/account_urls.py | Python | mit | 328 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import frappe.utils
import json
from frappe.utils import cstr, flt, getdate, comma_and
from frappe import _
from frappe.model.mapper im... | gangadharkadam/smrterp | erpnext/selling/doctype/sales_order/sales_order.py | Python | agpl-3.0 | 17,677 |
from manager import OneServerManager
import sys
try:
from ctypes import cdll
from ctypes import c_int,c_void_p,c_long
from ctypes import POINTER,Structure
from ctypes.util import find_library
except ImportError:
OneServerManager().log.error('Library CTypes not found.')
sys.exit()
##
# Free list node. Points to ... | 1Server/OneServer | oneserver/wrappers/upnp/FreeList.py | Python | mit | 2,790 |
# -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
# ... | FireBladeNooT/Medusa_1_6 | lib/github/tests/Issue131.py | Python | gpl-3.0 | 2,820 |
from __future__ import unicode_literals
from optparse import make_option
from django.core.management.base import NoArgsCommand
from docutil.commands_util import recocommand
from docutil.str_util import smart_decode
from recommender.actions import find_high_level_links_msg
class Command(NoArgsCommand):
option_lis... | bartdag/recodoc2 | recodoc2/apps/recommender/management/commands/findhighlevel.py | Python | bsd-3-clause | 1,989 |
def recurrence_memo(initial):
"""
Memo decorator for sequences defined by recurrence
See usage examples e.g. in the specfun/combinatorial module
"""
cache = initial
def decorator(f):
def g(n):
L = len(cache)
if n <= L - 1:
return cache[n]
... | hazelnusse/sympy-old | sympy/utilities/memoization.py | Python | bsd-3-clause | 1,358 |
from common_fixtures import * # NOQA
@pytest.fixture(scope='module')
def user_client(admin_user_client):
return create_context(admin_user_client, create_project=False,
add_host=False, kind='user').user_client
@pytest.fixture(scope='module')
def read_admin_client(admin_user_client):
... | jimengliu/cattle | tests/integration-v1/cattletest/core/test_authorization.py | Python | apache-2.0 | 80,099 |
#!/usr/bin/python
"""
Copyright 2014 Google Inc.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
Expectations on local disk that we can modify.
"""
# System-level imports
import logging
import os
import re
# Must fix up PYTHONPATH before importing from within Skia
... | mxOBS/deb-pkg_trusty_chromium-browser | third_party/skia/gm/rebaseline_server/writable_expectations.py | Python | bsd-3-clause | 6,889 |
# Copyright The IETF Trust 2007, All Rights Reserved
import datetime, re
from django.conf import settings
from django.contrib.syndication.feeds import Feed, FeedDoesNotExist
from django.utils.feedgenerator import Atom1Feed
from django.core.urlresolvers import reverse as urlreverse
from django.template.defaultfilters ... | mcr/ietfdb | ietf/doc/feeds.py | Python | bsd-3-clause | 2,790 |
#
#
#
from __future__ import absolute_import, division, print_function, \
unicode_literals
from os.path import dirname, isfile, join
from unittest import TestCase
from yaml import safe_load
from yaml.constructor import ConstructorError
from octodns.record import Create
from octodns.provider.yaml import YamlProvi... | h-hwang/octodns | tests/test_octodns_provider_yaml.py | Python | mit | 4,373 |
from django.http import HttpResponse
from .models import Entry
import socket
import datetime
def index(request):
current_hostname = socket.gethostname()
current_host = socket.gethostbyname(current_hostname)
entry = Entry(contents=u"%s (%s)" % (current_host, current_hostname), created_on=datetime.datetime.n... | nineinchnick/django-demo | code/whoami/views.py | Python | mit | 498 |
from bottle import route, request, run
from textblob import TextBlob
from marshmallow import Schema, fields
class BlobSchema(Schema):
polarity = fields.Float()
subjectivity = fields.Float()
chunks = fields.List(fields.String, attribute="noun_phrases")
tags = fields.Raw()
discrete_sentiment = fields... | mwstobo/marshmallow | examples/textblob_example.py | Python | mit | 845 |
"""Parse command line options and execute it.
Built on top of getopt. optparse can't handle sub-commands.
"""
import getopt
import copy
from collections import OrderedDict
class DefaultUpdate(dict):
"""A dictionary that has an "update_defaults" method where
only items with default values are updated.
T... | agustinhenze/doit.debian | doit/cmdparse.py | Python | mit | 11,568 |
#!/usr/bin/env python3
'''A simple implementation of a sorting algorithm, meant to allow
people to manually rank a list of items using whatever subjective or
objective criteria they want.
This program can be called as a script and used interactively. You
can provide the list of things to sort as command line argument... | sagittarian/personal-sort | sort.py | Python | mit | 4,539 |
## READ VARIABLE FROM SEVERAL NCFILES and store subset of it as NPY
from __future__ import print_function
path = '/network/aopp/cirrus/pred/kloewer/swm_bf_cntrl/data/'
#path = '/network/aopp/cirrus/pred/kloewer/swm_back_ronew/'
import os; os.chdir(path) # change working directory
import numpy as np
from netCDF4 impor... | milankl/swm | calc/process/var_subset_last.py | Python | gpl-3.0 | 1,070 |
from __future__ import absolute_import
from future.utils import PY3
__future_module__ = True
if PY3:
from html.parser import *
else:
from HTMLParser import *
| hughperkins/kgsgo-dataset-preprocessor | thirdparty/future/src/future/moves/html/parser.py | Python | mpl-2.0 | 167 |
# -*- coding: utf-8 -*-
"""
sphinx.builders.gettext
~~~~~~~~~~~~~~~~~~~~~~~
The MessageCatalogBuilder class.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import unicode_literals
from os import path, walk
from codecs ... | fzheng/codejam | lib/python2.7/site-packages/sphinx/builders/gettext.py | Python | mit | 7,836 |
#******************************************************************************#
# User class:
class user:
def __init__(self, sumer=0., car=0, ident=[], rate=[], time=[] ):
self.sum = sumer # Sum of the rate for all the movies.
self.car = car # Number of movies.
self.id = ident # Identifier for each movie.... | DanielDagnino/Machine_Learning-Collaborative_Filter | src/ml_class.py | Python | gpl-3.0 | 466 |
import random
class RegressionTree(object):
"""Wrapper for a whole regression tree."""
def __init__(self, table, target, attr_frac=.75, debug=False,
exclude=[], min_count=10, min_gain=None, split_sampling=100):
"""Build a new regression tree.
table -- complete trainin... | mlskit/astromlskit | RANDOM_TREES/Rforest/RandomTrees/regression.py | Python | gpl-3.0 | 9,032 |
# This file is part of django-ca (https://github.com/mathiasertl/django-ca).
#
# django-ca 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... | mathiasertl/django-ca | ca/django_ca/tests/tests_command_sign_cert.py | Python | gpl-3.0 | 25,708 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import ctypes
import sys
from . import api
from . import compat
class LazyResult(object):
"""
Lazy command execution result wrapper.
This wrapper implements a iterator interface.
"""
_return_code = None
_consumed = False
... | niwinz/pyssh-ctypes | pyssh/result.py | Python | bsd-3-clause | 3,169 |
#!/usr/bin/python
import sys, os
import subprocess
# Get the current folder
folder = os.path.abspath(__file__)
folder = os.path.dirname(folder)
# Change to static folder
folder = os.path.dirname(folder)
# Change to app folder
folder = os.path.dirname(folder)
# Get app name
app_name = folder.split(os.sep)[-1]
# Change... | frankyrumple/smc | static/scheduler/start_wamap_delete_scheduler.py | Python | mit | 2,018 |
"""Predicates regarding the state of the challenge."""
import datetime
from apps.managers.challenge_mgr import challenge_mgr
from apps.managers.challenge_mgr.models import GameInfo
def game_enabled(user, game_name):
"""Returns True if the game is enabled."""
_ = user
return GameInfo.objects.filter(name=g... | yongwen/makahiki | makahiki/apps/managers/predicate_mgr/challenge_predicates.py | Python | mit | 619 |
#!/usr/bin/env python
import rospy
from std_msgs.msg import String
import PyCmdMessenger
import threading
# Initialize an ArduinoBoard instance. This is where you specify baud rate and
# serial timeout. If you are using a non ATmega328 board, you might also need
# to set the data sizes (bytes for integers, longs, fl... | DrClick/ARCRacing | ros_system_ws/src/vector79/scripts/bus_playback.py | Python | mit | 2,126 |
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAdminUser',),
'PAGE_SIZE': 50,
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'],
'DEFAULT_AUTHENTICATION_CLASS... | astrobin/astrobin | astrobin/settings/components/rest.py | Python | agpl-3.0 | 484 |
#!/usr/bin/env python3
import os, json, re
JSON_LINES_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "haiku_lines.json")
PUNCTUATION = r"[`~@#$%_\\'+\-/]" # punctuation that is a part of text
STANDALONE = r"(?:[!.,;()^&\[\]{}|*=<>?]|[dDpP][:8]|:\S)" # standalone characters or emoticons that wouldn'... | Uberi/botty-bot-bot-bot | src/plugins/haiku/generate_haiku_lines.py | Python | mit | 5,681 |
# An example script to show how to output a sine wave using a DAC.
# Because we have to do it all in software, there are limitations on how fast
# we can update the DAC. Update intervals faster than 5 ms may give weird
# results because of the large percentage of missed updates.
#
# Note: This example uses signal.setit... | bmazin/SDR | DataReadout/ReadoutControls/lib/LabJackPython-8-26-2011/Examples/outputSinDAC.py | Python | gpl-2.0 | 4,045 |
# Copyright 2014 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 ... | danieldanciu/schoggi | modules/dashboard/dto_editor.py | Python | apache-2.0 | 9,313 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is a script for installing IronPyCompiler.
"""
from __future__ import with_statement
from setuptools import setup
import sys
import ironpycompiler
# Read README.txt and HISTORY.txt
with open("README.txt", "r") as f_readme:
readme_content = f_readme.read()
... | hamukichi/ironpycompiler | setup.py | Python | mit | 2,051 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-09-18 16:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0010_auto_20180918_1317'),
]
operations = ... | interlegis/saap | saap/core/migrations/0011_municipio_estado.py | Python | gpl-3.0 | 577 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/models/operation.py | Python | mit | 1,909 |
"""
Many-to-many relationships
To define a many-to-many relationship, use ``ManyToManyField()``.
In this example, an ``Article`` can be published in multiple ``Publication``
objects, and a ``Publication`` has multiple ``Article`` objects.
"""
from django.db import models
class Publication(models.Model):
title =... | frankvdp/django | tests/many_to_many/models.py | Python | bsd-3-clause | 1,753 |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
'''
BitBake 'Fetch' implementations
This implementation is for Secure Shell (SSH), and attempts to comply with the
IETF secsh internet draft:
http://tools.ietf.org/wg/secsh/draft-ietf-secsh-scp-sftp-ssh-uri/
Currently doe... | twoerner/bitbake | lib/bb/fetch2/ssh.py | Python | gpl-2.0 | 4,245 |
import iccpy.gadget
import matplotlib.pyplot as pl
import numpy as np
import iccpy.utils
sim_label = { 'aqa' : 'A', 'aqb' : 'B', 'aqc':'C', 'aqd':'D', 'aqe':'E' }
last_snapnum = { 'aqa2' : 1023, 'aqa3' : 511, 'aqa4' : 1023, 'aqb2' : 127, 'aqc2' : 127, 'aqd2' : 127, 'aqe2' : 127 }
r_200 = { 'aqa1' : 245.67, 'aqa2' : 2... | Lowingbn/iccpy | simulations/aquarius.py | Python | mit | 4,810 |
from __future__ import absolute_import
__author__ = 'chris'
from django.db import models
from ..forms import fields as wooey_form_fields
class WooeyOutputFileField(models.FileField):
def formfield(self, **kwargs):
# TODO: Make this from an app that is plugged in
defaults = {'form_class': wooey_for... | wooey/Wooey | wooey/models/fields.py | Python | bsd-3-clause | 771 |
r"""
Network
=======
This submodule contains models for calculating topological properties of
networks
"""
from ._topology import *
from ._health import *
| PMEAL/OpenPNM | openpnm/models/network/__init__.py | Python | mit | 158 |
from django.db import models
class Memo(models.Model):
memo_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.memo_text
| a-kirin/Dockerfiles | sample01/web/sample01/memos/models.py | Python | mit | 214 |
from django import forms
from app.models import Player
class CardForm(forms.Form):
name = forms.CharField(max_length=32, label="名字", help_text="點數卡的名子", required=False)
value = forms.IntegerField(label="值", help_text="點數卡的數值", initial="64", max_value=2560, min_value=-2560)
long_desc = forms.CharField(max_l... | sitcon-tw/arcane | app/card/forms.py | Python | agpl-3.0 | 637 |
"""
mbed SDK
Copyright (c) 2018 ARM Limited
SPDX-License-Identifier: Apache-2.0
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 ap... | kjbracey-arm/mbed | TESTS/host_tests/usb_device_serial.py | Python | apache-2.0 | 13,241 |
from networkx.algorithms.assortativity import *
from networkx.algorithms.block import *
from networkx.algorithms.boundary import *
from networkx.algorithms.centrality import *
from networkx.algorithms.cluster import *
from networkx.algorithms.clique import *
from networkx.algorithms.community import *
from networkx.alg... | KNMI/VERCE | verce-hpc-pe/src/networkx/algorithms/__init__.py | Python | mit | 2,128 |
#--------------------------------------------------------------
# Purpose: Creates custom quarter quarter section grid labels.
#
# Author: Ian Broad
# Website: www.ianbroad.com
#
# Created: 04/21/2014
#--------------------------------------------------------------
import arcpy
arcpy.env.overwriteOutp... | inkenbrandt/ArcPy | PLSS/CreateQQLabels.py | Python | gpl-2.0 | 8,932 |
from models import (AuctionUser, Auction, AuctionItem, AuctionEvent,
AuctionParticipant, AuctionBid)
from django.contrib import admin
admin.site.register(AuctionUser)
admin.site.register(Auction)
admin.site.register(AuctionItem)
admin.site.register(AuctionEvent)
admin.site.register(AuctionParticipant)
admin.site.r... | ajportier/djauction | admin.py | Python | gpl-3.0 | 340 |
# coding: utf-8
#
# Copyright 2020 The Oppia 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 requi... | kevinlee12/oppia | scripts/linters/css_linter_test.py | Python | apache-2.0 | 4,592 |
import os, sys, time
import vagrant
from dockyard.core.command_interpreter import *
class StackCommandInterpreter(CommandInterpreter):
""" Command interpreter for Stack related tasks """
def up(self, args):
# Bring Vagrant UP
v = vagrant.Vagrant()
if not v.status()['default'] ... | smysnk/dockyard | dockyard/core/plugin_stack/command_interpreter.py | Python | mit | 1,870 |
# Thanks go to
# * cbelden for this module (https://github.com/
from controls import kill_stream
from consumers import create_consumer
from producers import create_producer | haukurk/Partify | partify/core/__init__.py | Python | mit | 173 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2016 Multimex (<http://multimex.com.vn>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | ncliam/serverpos | openerp/custom_modules/pricelist_uom/__init__.py | Python | agpl-3.0 | 1,075 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
impor... | UnrememberMe/pants | src/python/pants/util/contextutil.py | Python | apache-2.0 | 10,875 |
import os
import errno
import shutil
import sys
import sqlite3
def root_dir():
return os.path.dirname(os.path.realpath(os.path.join(sys.argv[0],'..')))
def make_dir_if_not_found(dir_path):
if os.path.isdir(dir_path) is not True:
os.makedirs(dir_path)
return None
def delete_dir(dir_path):
... | tommilligan/RainWorld-Map | src/common.py | Python | gpl-2.0 | 1,466 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.