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 |
|---|---|---|---|---|---|
# TestSwiftPartiallyGenericFuncStruct.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https:... | apple/swift-lldb | packages/Python/lldbsuite/test/lang/swift/partially_generic_func/struct/TestSwiftPartiallyGenericFuncStruct.py | Python | apache-2.0 | 629 |
numbers = range(0, 15)
print map(lambda n: n ** n, numbers)
for i in map(lambda n: n ** n, numbers):
print i
| regnart-tech-club/programming-concepts | course-2:combining-building-blocks/subject-4:all together now/topic-2:ETL/lesson-1:`map` function.py | Python | apache-2.0 | 111 |
from __future__ import print_function
import sys
import traceback
from game_state import GameState
def warning(*objs):
print("WARNING: ", *objs, file=sys.stderr)
traceback.print_exc()
class Player:
VERSION = "Default Python folding player"
def preFlopBet(self):
stack = self.state.get_s... | szepnapot/poker-player-pypoker | player.py | Python | mit | 1,189 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2012 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | cvandeplas/plaso | plaso/parsers/winreg_plugins/winver_test.py | Python | apache-2.0 | 2,842 |
# Copyright 2011 Antoine Bertin <diaoulael@gmail.com>
#
# This file is part of Dobby.
#
# Dobby 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 ... | Diaoul/Dobby | dobby/speakers/speechdispatcher.py | Python | lgpl-3.0 | 2,638 |
"""Tabulate sun and moon ephemerides during the survey.
"""
from __future__ import print_function, division
import warnings
import math
import os.path
import datetime
import numpy as np
import scipy.interpolate
import astropy.time
import astropy.table
import astropy.utils.exceptions
import astropy.units as u
import... | desihub/desisurvey | py/desisurvey/ephem.py | Python | bsd-3-clause | 38,246 |
# -*- python -*-
# you must invoke this with an explicit python, from the tree root
"""Run an arbitrary command with a PYTHONPATH that will include the Tahoe
code, including dependent libraries. Run this like:
python misc/build_helpers/run-with-pythonpath.py python foo.py
"""
import os, sys
# figure out where supp... | drewp/tahoe-lafs | misc/build_helpers/run-with-pythonpath.py | Python | gpl-2.0 | 1,257 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack 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
#
# htt... | usc-isi/essex-baremetal-support | nova/tests/test_vmwareapi.py | Python | apache-2.0 | 10,058 |
#
# Widgets.py -- wrapped Qt widgets and convenience functions
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import os.path
from functools import reduce
from ginga.q... | Cadair/ginga | ginga/qtw/Widgets.py | Python | bsd-3-clause | 54,587 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | stackforge/senlin | senlin/profiles/os/heat/stack.py | Python | apache-2.0 | 14,984 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | cg31/tensorflow | tensorflow/models/image/alexnet/alexnet_benchmark.py | Python | apache-2.0 | 8,437 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2009-TODAY Tech-Receptives(<http://www.techreceptives.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the... | mohamedhagag/community-addons | openeducat_erp/op_placement_offer/op_placement_offer.py | Python | agpl-3.0 | 2,017 |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | hbhdytf/mac | swift/container/server.py | Python | apache-2.0 | 28,271 |
from getTerminalSize import getTerminalSize
def pictureShower(url, cookies = None):
import urllib2
try:
import PIL.Image as Image
from StringIO import StringIO
print('Downloading image ...')
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies))
urllib2.install_opener(opener)
im = Image.open... | charlieamer/Euler-Task | EulerTask/pictureShower.py | Python | gpl-2.0 | 678 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
def register_types(module):
root_module = module.get_root()
## average.h: ns3::Average<double> [class]
module.add_class('Average', template_parameters=['double'])
## delay-jitter-estimation.h: ns3::DelayJitterEstimat... | joelagnel/ns-3 | bindings/python/apidefs/gcc-LP64/ns3_module_tools.py | Python | gpl-2.0 | 21,544 |
# This script serves two purposes:
#
# - to demonstrate that an AWT Listener can be written in Jython, and
#
# - to find the width of an image you know is uncompressed, but do not know
# the dimensions.
#
# To use it, open the raw image with File>Import>Raw... choosing a width and
# height that should roughly be the ... | ferlandlab/BranchAnalysis2D-3D | Fiji.app/plugins/Examples/Find_Dimension_of_Raw_Image.py | Python | gpl-3.0 | 1,431 |
from __future__ import unicode_literals
from django.dispatch import Signal
local_site_user_added = Signal(providing_args=['user', 'localsite'])
| chipx86/reviewboard | reviewboard/site/signals.py | Python | mit | 147 |
# Generated by Django 3.0.5 on 2020-05-29 23:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adventure', '0064_auto_20200529_0136'),
]
operations = [
migrations.AddField(
model_name='artifact',
name='data',
... | kdechant/eamon | adventure/migrations/0065_auto_20200529_1607.py | Python | mit | 1,209 |
import numpy as np
from random import uniform
# set numpy error
np.seterr( over='raise' )
# read full file
data = open( 'pg_essays.txt', 'rt' ).read()
# dictionary conversion. We will use n-gram coding for all the unique characters in the input data
dict_chars = list( set( data ) )
data_size = len( data )
dict_size... | marcino239/min_rnn | min_rnn.py | Python | gpl-2.0 | 6,607 |
import json
import time
def parseSearches(searchesFile, begintimeframe = 0, endtimeframe = int(time.time())) :
searches = json.load(open(searchesFile, 'r'))
listOfsearches = []
for search in searches["event"]:
#a query can contain several timestap so special measurments need te be implemented in... | LeanVel/TakeoutsTimelining | SearchesParser.py | Python | gpl-3.0 | 857 |
# Copyright 2014 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | midonet/python-neutron-plugin-midonet | midonet/neutron/tests/unit/test_extension_license.py | Python | apache-2.0 | 2,932 |
from django import forms
from django.contrib import admin
from . import models
from .models import Template, TemplateTranslation
@admin.register(models.Message)
class MessageAdmin(admin.ModelAdmin):
search_fields = ('subject', 'body', 'mail_to')
date_hierarchy = 'created_at'
list_display = (
'pk'... | dvhbru/dvhb-hybrid | dvhb_hybrid/mailer/admin.py | Python | mit | 1,731 |
import os
import sys
from setuptools import setup, find_packages
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
os.system('python setup.py bdist_wheel upload')
print("Now tag me :)")
print(" git tag -a {0} -m 'version {0}'".format(__import__('pynamodb').__version__))
prin... | mtsgrd/PynamoDB2 | setup.py | Python | mit | 1,186 |
from __future__ import unicode_literals
import mimetypes
import unittest
from os import path
from django.conf.urls.static import static
from django.http import FileResponse, HttpResponseNotModified
from django.test import SimpleTestCase, override_settings
from django.utils.http import http_date
from django.views.stat... | frishberg/django | tests/view_tests/tests/test_static.py | Python | bsd-3-clause | 5,610 |
"""Check new
Revision ID: 92235b77ea53
Revises: 381fdb66ec27
Create Date: 2017-10-14 02:38:51.007307
"""
# revision identifiers, used by Alembic.
revision = '92235b77ea53'
down_revision = '381fdb66ec27'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic - pl... | porduna/appcomposer | alembic/versions/92235b77ea53_check_new.py | Python | bsd-2-clause | 31,211 |
#!/opt/epd/bin/python
# -*- coding: utf8 -*-
from setuptools import setup, find_packages
long_description = '''
This python module is a set of routines designed to ease the way of making SIESTA calculations,
adding them to PBS queue and interpreting the results.
'''
setup(name='SHS',
version='0.4',
descr... | ansobolev/shs | setup.py | Python | mit | 1,055 |
from time import sleep
import sys
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
BgGreen = '\033[42m\033[30m'
sys.stdout.write(bcolors.BgGreen+' '+bcolors.END... | cpausmit/Kraken | bin/progress.py | Python | mit | 672 |
#!/usr/bin/env python2.7
# Copyright 2013 Virantha Ekanayake 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... | virantha/pypdfocr | pypdfocr/pypdfocr_tesseract.py | Python | apache-2.0 | 6,463 |
s = 'hello world'
print s[0] # print first element, h
print s[1] # print e
print s[-1] # will print the last character | wavicles/pycode-browser | Code/PythonBook/chap2/string.py | Python | gpl-3.0 | 153 |
# Originally from:
# github.com/pytorch/tutorials/blob/60d6ef365e36f3ba82c2b61bf32cc40ac4e86c7b/custom_directives.py # noqa
from docutils.parsers.rst import Directive, directives
from docutils.statemachine import StringList
from docutils import nodes
import os
import sphinx_gallery
try:
FileNotFoundError
except Na... | ujvl/ray-ng | doc/source/custom_directives.py | Python | apache-2.0 | 2,945 |
from httplib import HTTPConnection, _CS_IDLE
import urlparse
def pipeline(domain,pages,max_out_bound=4,debuglevel=0):
pagecount = len(pages)
conn = HTTPConnection(domain)
conn.set_debuglevel(debuglevel)
respobjs = [None]*pagecount
finished = [False]*pagecount
data = [None]*pagecount
headers... | ActiveState/code | recipes/Python/576673_Python_HTTP_Pipelining/recipe-576673.py | Python | mit | 3,921 |
#this module here is to compute the formula to calculate the new means and
#new variance.
def update(mean1, var1, mean2, var2):
new_mean = ((mean1 * var2) + (mean2*var1))/(var1 + var2)
new_var = 1/(1/var1 + 1/var2)
return [new_mean, new_var]
def predict(mean1, var1, mean2, var2):
new_mean = mea... | napjon/moocs_solution | robotics-udacity/2.4.py | Python | mit | 465 |
# coding=utf-8
# Copyright 2022 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | google-research/diffstride | diffstride/resnet.py | Python | apache-2.0 | 7,666 |
# -*- coding: utf-8 -*-
#
# This file is part of INGInious. See the LICENSE and the COPYRIGHTS files for
# more information about the licensing of this file.
""" An algorithm contest plugin for INGInious. Based on the same principles than contests like ACM-ICPC. """
import copy
from collections import OrderedDict
fro... | UCL-INGI/INGInious | inginious/frontend/plugins/contests/__init__.py | Python | agpl-3.0 | 11,265 |
# Copyright (C) 2014, CERN
# This software is distributed under the terms of the GNU General Public
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".
# In applying this license, CERN does not waive the privileges and immunities
# granted to it by virtue of its status as Intergovernmental Organ... | AlbertoPeon/jens | src/jens/maintenance.py | Python | gpl-3.0 | 2,566 |
# Copyright (C) 2014 Nippon Telegraph and Telephone Corporation.
#
# 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... | iwaseyusuke/ryu | ryu/services/protocols/bgp/base.py | Python | apache-2.0 | 19,278 |
#!/usr/bin/python
import argparse
import sys
from itertools import *
import math
import operator
def euler15(n, m):
"""Number of distinct Manhattan paths from one side to the other of an n x m grid
http://projecteuler.net/problem=15"""
# You have to walk N + M blocks, of which N have to be horiz and M vertic... | tdierks/project-euler | e15.py | Python | mit | 1,370 |
from matplotlib.pyplot import *
from math import sqrt
m = 1/3.
xs = [+1, +1, -1, -1]
ys = [-1, +1, -1, +1]
figure(figsize=(4, 4))
ax = gca()
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.spines['left'].set_position(('data', 0))
ax.spines['bottom'].set_position(('data', 0))
ax.xaxis.set_t... | saullocastro/compmech | doc/pyplots/theory/fem/fsdt_donnell_kquad4.py | Python | bsd-3-clause | 1,473 |
# UrbanFootprint v1.5
# Copyright (C) 2017 Calthorpe Analytics
#
# This file is part of UrbanFootprint version 1.5
#
# UrbanFootprint is distributed under the terms of the GNU General
# Public License version 3, as published by the Free Software Foundation. This
# code is distributed WITHOUT ANY WARRANTY, without impl... | CalthorpeAnalytics/urbanfootprint | footprint/main/tests/test_api/patch_patch.py | Python | gpl-3.0 | 1,431 |
from difflib import ndiff, restore
class DiffContent:
@classmethod
def get_diff(cls, c_o, c_n):
if c_o is not None and c_n is not None:
diff = ndiff(c_o, c_n)
else:
diff = []
return diff
@classmethod
def get_original(cls, diff):
return ''.jo... | vaizguy/snaps | src/snaps/differ.py | Python | gpl-3.0 | 435 |
#!/usr/bin/env python
# coding=utf-8
"""
ola channel mapper.
read a configuration file and map channels from one universe to a second.
history:
see git commits
todo:
~ all fine :-)
"""
import sys
import time
import os
import array
import json
from configdict import ConfigDict
from ola... | s-light/OLA_channel_mapper | olamapper.py | Python | mit | 10,276 |
#!/usr/bin/env python2.7
import sys
import connection as CN
import serial
import os
import time
import argparse
import logging
serial_device_basename = "/dev/ttyACM"
serial_device_init = 0
def set_log(logname):
logging.basicConfig(filename=logname,
filemode='a',
... | p4u/projecte_frigos | client.py | Python | agpl-3.0 | 2,992 |
from __future__ import division
from drivepy.base.powermeter import BasePowerMeter, CommError, PowerMeterLibraryError
import drivepy.visaconnection as visaconnection
import math
DEFAULT_AVERAGING_TIME = 100 # ms
AVERAGING_TIME_MAX_MODE = 20 # ms
class PowerMeter(BasePowerMeter):
""" Creates a power meter ob... | timrae/drivepy | agilent/powermeter.py | Python | gpl-3.0 | 2,114 |
# -*- coding: utf-8 -*-
# This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and
# is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012)
import subprocess
# from django.contrib.gis.geos import *
from geojson import MultiPolygo... | stephenrjones/geoq | geoq/mgrs/utils.py | Python | mit | 7,246 |
#!/usr/bin/env python
import random
from os.path import abspath, dirname, join as pjoin
def get_words(filename, min_length=3, max_length=9, disallowed=[' ', '-']):
words = []
filename = abspath(pjoin(dirname(__file__), filename))
with open(filename, 'r') as data_in:
for line in data_in:
... | stengaard/moniker | moniker/moniker.py | Python | mit | 1,589 |
from . import object
from .function import FunctionReturnType, native_function
@native_function
def object_constructor(scope, this_object, params):
data = params[0].call(
scope,
this_object,
[],
return_type=FunctionReturnType.RETURN_NAME_MAP
)
return object.PvlObject(
... | lexdene/pavel | pavel/runtime/buildins.py | Python | gpl-3.0 | 3,305 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Article.issue'
db.add_column('journalmanager_article', 'i... | jfunez/scielo-manager | scielomanager/journalmanager/migrations/0044_auto__add_field_article_issue.py | Python | bsd-2-clause | 30,833 |
import numpy as np
import numpy as np
import pylab as pl
import scipy.special as ss
def beta(a, b, mew):
e1 = ss.gamma(a + b)
e2 = ss.gamma(a)
e3 = ss.gamma(b)
e4 = mew ** (a - 1)
e5 = (1 - mew) ** (b - 1)
return (e1/(e2*e3)) * e4 * e5
def plot_beta(a, b):
Ly = []
Lx = []
mews = ... | nicholasmalaya/paleologos | combustion/final/beta.py | Python | mit | 678 |
#!/usr/bin/env python
from netmiko import ConnectHandler
from getpass import getpass
ip_address = raw_input("Enter IP address: ")
device = {
'device_type': 'cisco_ios',
'ip': ip_address,
'username': 'pyclass',
'password': getpass(),
'port': 22,
}
net_connect = ConnectHandler(**device)
output = ... | Collisio-Adolebitque/pfne-2017 | pynet/interop_2016/ex1_router_output/test_cisco.py | Python | gpl-3.0 | 381 |
'''
Confounder Learning and Correction Module
-----------------------------------------
@author: Max Zwiessele
'''
import numpy
from pygp.covar.linear import LinearCFISO
from pygp.covar.combinators import SumCF, ProductCF
from pygp.covar.se import SqexpCFARD
from pygp.gp.gplvm import GPLVM
from pygp.optimize.optimize_... | PMBio/gptwosample | gptwosample/confounder/confounder.py | Python | apache-2.0 | 10,272 |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without writte... | talha81/TACTIC-DEV | src/pyasm/widget/input_wdg.py | Python | epl-1.0 | 86,425 |
'''
Validation of received probe dispatch requests.
Validation is performed in two parts:
1. Requests are handled as messages and are required to carry an HMAC digest
allowing the server to verify the message and validate that client is a
trusted AMPT manager using the same shared key.
2. Request messages conta... | nids-io/ampt-generator | ampt_generator/validator.py | Python | bsd-2-clause | 2,785 |
# Copyright (c) 2012-2021, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
import elasticsearch
import json
import logging
import os
import random
import string
import swiftclient
import unittest
import utils
class MetadataSyncTest(unittest.TestCase):
ES_HOST = 'https://localhost:9200'
ES_VERSION =... | swiftstack/swift-metadata-sync | test/integration/test_metadata_sync.py | Python | apache-2.0 | 5,118 |
# The Hazard Library
# Copyright (C) 2012 GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# Th... | ROB-Seismology/oq-hazardlib | openquake/hazardlib/tests/source/simple_fault_test.py | Python | agpl-3.0 | 13,597 |
import ljson.base.mem
import ljson.base.generic
import ljson.convert.csv
from .data import data, header_descriptor
def test_read_write():
from io import StringIO
header = ljson.base.generic.Header(header_descriptor)
table = ljson.base.mem.Table(header, data)
fio = StringIO()
ljson.convert.csv.table2csv(table... | daknuett/ljson | test/test_ljson_convert_csv.py | Python | agpl-3.0 | 655 |
"""Test the cross_validation module"""
from __future__ import division
import warnings
import numpy as np
from scipy.sparse import coo_matrix
from scipy import stats
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_equal
from sklearn... | ycaihua/scikit-learn | sklearn/tests/test_cross_validation.py | Python | bsd-3-clause | 45,051 |
#!/usr/bin/env python
"""
Generate the table of all terms for the sphinx documentation.
"""
from __future__ import absolute_import
import os
from sfepy.base.base import dict_from_keys_init
from sfepy.discrete.equations import parse_definition
from sfepy.base.conf import ProblemConf, get_standard_keywords
from sfepy.bas... | vlukes/sfepy | script/gen_term_table.py | Python | bsd-3-clause | 8,129 |
#
# Copyright 2013 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | jimgoo/zipline-fork | zipline/sources/test_source.py | Python | apache-2.0 | 7,702 |
import logging
import pathlib
import time
import discord
from discord.ext import commands, tasks
import Data
from NossiInterface.Tools import discordname
logger = logging.getLogger(__name__)
class NossiCog(commands.Cog, name="NossiBot"):
def __init__(self, client):
self.client: discord.client = client
... | x4dr/NossiNet | NossiInterface/Cogs/NossiCog.py | Python | gpl-2.0 | 5,131 |
# encoding: utf-8
"""
cache.py
Created by David Farrar on 2012-12-27.
Copyright (c) 2009-2013 Exa Networks. All rights reserved.
"""
import time
class Cache (dict):
def __init__ (self, min_items=10, max_items=2000, cache_life=3600):
dict.__init__(self)
self.ordered = []
self.min_items = min_items
self.max_i... | jbfavre/exabgp | lib/exabgp/util/cache.py | Python | bsd-3-clause | 3,608 |
"""Created By: Andrew Ryan DeFilippis"""
print('Lambda cold-start...')
import random
import re
import string
import boto3
import os
from botocore.config import Config
from botocore.exceptions import ClientError
from json import dumps, loads
# Disable 'testing_locally' when deploying to AWS Lambda.
testing_locally =... | andrewdefilippis/aws-lambda | Functions/Python/url_shortening_service/lambda_function.py | Python | apache-2.0 | 11,567 |
#-*- coding: utf-8 -*-
__author__ = 'rdk'
from .importer import import_to_db | renaud-dk/invoice_generator | app/utils/__init__.py | Python | gpl-3.0 | 77 |
import _plotly_utils.basevalidators
class IdsValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="ids", parent_name="contour", **kwargs):
super(IdsValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_ty... | plotly/python-api | packages/python/plotly/plotly/validators/contour/_ids.py | Python | mit | 432 |
from datetime import date
from unittest import TestCase
import warnings
from . import GenericCalendarTest
from ..europe import (
Scotland, Aberdeen, Angus, Arbroath, Ayr, CarnoustieMonifieth, Clydebank,
DumfriesGalloway, Dundee, EastDunbartonshire, Edinburgh, Elgin, Falkirk,
Fife, Galashiels, Glasgow, Hawi... | novapost/workalendar | workalendar/tests/test_scotland.py | Python | mit | 19,206 |
import errno
import subprocess
import fnmatch
import os
import yaml
import os.path as path
import yapp
import logging
def makeDir(path):
"""
Make a dir but ignore if it exists.
"""
try:
os.mkdir(path)
except OSError as exception:
if exception.errno != errno.EEXIST:
raise... | benjeffery/yapp | yapp/core.py | Python | mit | 3,481 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2005,2006,2007,2008,2009 Brett Adams <brett@belizebotanic.org>
# Copyright (c) 2012-2015 Mario Frasca <mario@anche.no>
#
# This file is part of bauble.classic.
#
# bauble.classic is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pub... | mfrasca/bauble.classic | bauble/meta.py | Python | gpl-2.0 | 2,702 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
GeoAlgorithm.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**************************... | nirvn/QGIS | python/plugins/processing/core/GeoAlgorithm.py | Python | gpl-2.0 | 13,468 |
# Copyright (c) 2014 VMware, 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 a... | redhat-openstack/nova | nova/tests/virt/vmwareapi/test_ds_util.py | Python | apache-2.0 | 22,988 |
# -*- coding: utf-8 -*-
import os
import json
import platform
import unittest
from httmock import urlmatch, HTTMock, response
from wechatpy import WeChatClient
_TESTS_PATH = os.path.abspath(os.path.dirname(__file__))
_FIXTURE_PATH = os.path.join(_TESTS_PATH, "fixtures")
@urlmatch(netloc=r"(.*\.)?api\.weixin\.qq\.... | jxtech/wechatpy | tests/test_session.py | Python | mit | 3,725 |
<<<<<<< HEAD
<<<<<<< HEAD
import contextlib
import importlib.abc
import importlib.machinery
import os
import sys
import types
import unittest
from test.test_importlib import util
from test.support import run_unittest
# needed tests:
#
# need to test when nested, so that the top-level path isn't sys.path
# need to tes... | ArcherSys/ArcherSys | Lib/test/test_importlib/test_namespace_pkgs.py | Python | mit | 28,346 |
# coding=utf-8
"""Radiance rfluxmtx parameters"""
from gridbased import GridBasedParameters
from ._frozen import frozen
@frozen
class RfluxmtxParameters(GridBasedParameters):
def __init__(self, sender=None, receiver=None, octree=None, systemFiles=None):
"""Init parameters."""
GridBasedParameters... | antonszilasi/honeybeex | honeybeex/honeybee/radiance/parameters/rfluxmtx.py | Python | gpl-3.0 | 336 |
# -*- coding: utf-8 -*-
from geolucidate.functions import _cleanup, _convert
from geolucidate.parser import parser_re
from nose.tools import eq_
def test_parser():
values = [
("N424400 W800557", ['N', '42', '44', '00', 'W', '80', '05', '57']),
("N 5930 W 12330", ['N', '59', '30', '00', 'W', '123... | kurtraschke/geolucidate | geolucidate/tests/tests.py | Python | mit | 5,593 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import logging
import os
from tempfile import TemporaryFile
from psycopg2 import ProgrammingError
from contextlib import closing
from odoo import api, fields, models, tools, sql_db, _
from odoo.exceptions ... | ygol/odoo | odoo/addons/base/wizard/base_import_language.py | Python | agpl-3.0 | 2,837 |
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import testing
from sqlalchemy.testing import eq_
from sqlalchemy.testing import fixtures
from sqlalchemy.testing.fixtures import fixture_session
from sqlalchemy.testing.schema import Column
from sqlalchemy.te... | monetate/sqlalchemy | test/orm/inheritance/test_abc_polymorphic.py | Python | mit | 3,596 |
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Documentation on PRESUBMIT.py can be found at:
# http://www.chromium.org/developers/how-tos/depottools/presubmit-scripts
import os
import sys
# ... | mxOBS/deb-pkg_trusty_chromium-browser | native_client/PRESUBMIT.py | Python | bsd-3-clause | 7,031 |
"""
Django settings for aiplay project.
Generated by 'django-admin startproject' using Django 1.10.4.
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
... | zerolfx/aiplay-api | aiplay/settings.py | Python | mit | 4,928 |
###########################################################
#
# Copyright (c) 2005-2009, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written ... | Southpaw-TACTIC/TACTIC | src/tactic/active_directory/ad_get_user_info.py | Python | epl-1.0 | 4,097 |
"""Tornado app settings."""
import os
from tornado.options import define, options, parse_command_line
define("host", default='0.0.0.0', help="run on the given host", type=str)
define("port", default=5000, help="run on the given port", type=int)
define("debug", default=True, help="run in debug mode")
parse_command_line... | yoziru-desu/locomo-pebble | mock-server/settings.py | Python | mit | 668 |
from topia.termextract import extract
class KeywordExtractor:
def __init__(self):
self.extractor = extract.TermExtractor()
self.extractor.filter = extract.permissiveFilter
def extract(self, text):
return self.extractor(text.lower())
| antoan-angelov/videogame-oracle | extractor/keyword_extractor.py | Python | gpl-3.0 | 269 |
input = """
% No auxiliary atoms at all.
ouch :- #max{V:a(V)} = 0.
"""
output = """
{}
"""
| Yarrick13/hwasp | tests/wasp1/AllAnswerSets/aggregates_max_bug_1.test.py | Python | apache-2.0 | 92 |
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 30 18:09:16 2014
@author: jfelipe
"""
# import multiprocessing as mp
import sys
import os
import time
import multiprocessing as mp
import subprocess
from .processors import Producer, Processor, Consumer
from .dump import DumpFile, process_xml
from .page import pages_to_fi... | glimmerphoenix/WikiDAT | wikidat/retrieval/etl.py | Python | gpl-3.0 | 16,498 |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('lrs.views',
url(r'^$', 'home'),
url(r'^statements/more/(?P<more_id>.{32})$', 'statements_more'),
url(r'^statements', 'statements'),
url(r'^activities/state', 'activity_state'),
url(r'^activities/profile', 'activity_profile'... | daafgo/Server_LRS | lrs/urls.py | Python | apache-2.0 | 1,672 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# brewpi_firmware documentation build configuration file, created by
# sphinx-quickstart on Wed Feb 24 21:47:52 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 t... | BrewPi/firmware | docs/conf.py | Python | agpl-3.0 | 11,969 |
"""ASCII-ART 2D pretty-printer"""
from .pretty import (pretty, pretty_print, pprint, pprint_use_unicode,
pprint_try_use_unicode, pager_print)
# if unicode output is available -- let's use it
pprint_try_use_unicode()
| wxgeo/geophar | wxgeometrie/sympy/printing/pretty/__init__.py | Python | gpl-2.0 | 222 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from lib.core.common import extractRegexResult
from lib.core.common import getFilteredPageContent
from lib.core.common import listToStrValue
from lib.core.common im... | golismero/golismero | tools/sqlmap/lib/request/comparison.py | Python | gpl-2.0 | 6,090 |
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# *************************************... | sbesson/zeroc-ice | certs/makewinrtcerts.py | Python | gpl-2.0 | 8,091 |
"""
Type Inference
"""
from .typevar import TypeVar
from .ast import Def, Var
from copy import copy
from itertools import product
try:
from typing import Dict, TYPE_CHECKING, Union, Tuple, Optional, Set # noqa
from typing import Iterable, List, Any, TypeVar as MTypeVar # noqa
from typing import cast
fr... | nrc/rustc-perf | collector/benchmarks/cranelift-codegen/cranelift-codegen/meta-python/cdsl/ti.py | Python | mit | 28,415 |
#*********************************************************************************
#
# Inviwo - Interactive Visualization Workshop
#
# Copyright (c) 2013-2016 Inviwo Foundation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the f... | cgloger/inviwo | tools/ivwpy/util.py | Python | bsd-2-clause | 4,314 |
#!/usr/bin/env python
from flask import Flask
from flask import render_template
import pandas as pd
import numpy as np
import datetime as datetime
app = Flask(__name__)
if not app.debug:
import logging
file_handler = logging.FileHandler('error.log')
file_handler.setLevel(logging.WARNING)
app.logger.a... | kgorman/WMG_speed | app/app.py | Python | mit | 5,559 |
"""
WSGI config for config 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... | Feverup/workshop-django-react | src/config/wsgi.py | Python | bsd-3-clause | 389 |
import string
import datetime
import numpy as np
import pylab as pl
from matplotlib.patches import Rectangle
import saltefficiency.util.blockvisitstats as bvs
import saltefficiency.util.sdb_utils as su
def create_night_table(obsdate, sdb, els):
"""Create a table that shows a break down for the night and what ... | hettlage/saltefficiency | saltefficiency/nightly/create_night_table.py | Python | bsd-3-clause | 11,116 |
# -*- coding: utf-8 -*-
from django.db import models
import django.template.defaultfilters
from django.db.models import Max
from django.utils.functional import cached_property
# Create your models here.
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.con... | chiara-paci/baskerville | baskervilleweb/bibliography/models.py | Python | gpl-3.0 | 75,809 |
# -*- coding: utf-8 -*-
from functools import partial
from openprocurement.edge.utils import (
context_unpack,
decrypt,
encrypt,
APIResource,
json_view
)
from openprocurement.edge.utils import planningresource
from openprocurement.edge.design import (
by_dateModified_view_ViewDefinition,
r... | openprocurement/openprocurement.edge | openprocurement/edge/views/plans.py | Python | apache-2.0 | 7,002 |
from http import HTTPStatus
from flask import url_for
def test_route_home(client):
response = client.get(url_for('home'))
assert response.status_code == HTTPStatus.OK
def test_route_project(client):
with client.session_transaction() as session:
session['token'] = 'foo'
response = client.get... | textbook/flask-forecaster | tests/test_routes.py | Python | isc | 563 |
# -*- coding: utf-8 -*-
import datetime
import re
import scrapy
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
DAY_MAPPING = {
'Sun': 'Su',
'Mon': 'Mo',
'Tue': 'Tu',
'Wed': 'We',
'Thu': 'Th',
'Fri': 'Fr',
'Sat': 'Sa'
}
class PenskeSpider(scrapy.Spid... | iandees/all-the-places | locations/spiders/penske.py | Python | mit | 4,137 |
#!/usr/bin/python
#
# Copyright (c) 2018 Yuwei Zhou, <yuwzho@microsoft.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | kvar/ansible | lib/ansible/modules/cloud/azure/azure_rm_servicebustopicsubscription.py | Python | gpl-3.0 | 12,038 |
import time
import tornado.ioloop
import tornado.httpserver
import tornado.web
from tornado import httpclient
from tornado import gen
class Application(tornado.web.Application):
def __init__(self):
handlers = [
(r"/", IndexHandler),
(r"/now", BitNowHandler),
(r"/chartap... | guke1991/hellopy | Bitcoin/now/now.py | Python | mit | 2,020 |
"""Support for HomematicIP Cloud cover devices."""
import logging
from typing import Optional
from homematicip.aio.device import AsyncFullFlushBlind, AsyncFullFlushShutter
from homeassistant.components.cover import (
ATTR_POSITION,
ATTR_TILT_POSITION,
CoverDevice,
)
from homeassistant.config_entries impor... | Cinntax/home-assistant | homeassistant/components/homematicip_cloud/cover.py | Python | apache-2.0 | 3,615 |
from flask import Flask
from flask import request
from flask import jsonify
from flask import abort
import time
app = Flask(__name__)
@app.route('/api/1', defaults={'path': ''}, methods=['GET', 'POST'])
@app.route('/api/1/<path:path>', methods=['GET', 'POST'])
def api1(path):
time.sleep(20)
return jsonify({
... | jie/microgate | test_server.py | Python | mit | 1,151 |
"""Define a function is_palindrome() that recognizes
palindromes (i.e. words that look the same written backwards).
For example, is_palindrome("radar") should return True."""
def is_palindrome(str):
pass
#test
print(is_palindrome("radar"))
print(is_palindrome("IzitizI"))
print(is_palindrome("Definitely not a pali... | m3rik/nn | PythonCourse/exercises/ex8.py | Python | apache-2.0 | 332 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.