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 requests
from pprint import pprint
from lxml import html
#expected command with two search tokens separated by /
#rq = ".h2hm fed/mur"
#rq = ".h2hw wil/sha"
def head2head(p1, p2, gender):
#scraping from tennisexplorer.com
page = requests.get('http://www.tennisexplorer.com/list-playe... | t0m201/tennis-irc-scripts | ircbot/h2h.py | Python | mit | 3,460 |
from pyhistorian import Story, Scenario
from pyhistorian.language import TEMPLATE_PATTERN
from story_parser import parse_text
import re
class StoryRunner(object):
def __init__(self, story_text, output, colored,
modules=(), language='en-us',
before_all=(), before_each=(),
... | hugobr/pycukes | pycukes/runner.py | Python | mit | 4,287 |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
requires = [
'SQLAlchemy',
'apscheduler',
'chaussette',
'couchdb',
'grequests',
... | openprocurement/openprocurement.chronograph | setup.py | Python | apache-2.0 | 1,610 |
from array import array
from random import randint, choice
import numpy
from pprint import pprint
import json
from combinatorics_class import *
from widget import load_expectation, get_next_state, get_state_big_mask
from widget import get_expected_score
import logging
logging.basicConfig(format='%(message)s',level=logg... | greeness/yahtzee-optimal-strategy | sim_game_with_cache.py | Python | mit | 9,075 |
import contextlib
import os
from google import auth
from google.auth.transport import grpc as google_auth_transport_grpc
from google.auth.transport import requests as google_auth_transport_requests
from googleapiclient import discovery
BIGSTORE_SCOPES = [
'https://www.googleapis.com/auth/devstorage.write_only',
]
... | google/resultstoreui | resultstoresearch/server/resultstoresearch/credentials/credentials.py | Python | apache-2.0 | 4,250 |
'''
Created on 16 Nov 2016
@author: gbstring
'''
from flask import render_template, session, redirect, url_for
from .forms import TitleForm
from .models import Title
from .__init__ import db
from app import app
| gbstringer/flasksimple | flask/simple/app/views.py | Python | cc0-1.0 | 216 |
"""HTTP server classes.
Note: BaseHTTPRequestHandler doesn't implement any HTTP request; see
SimpleHTTPRequestHandler for simple implementations of GET, HEAD and POST,
and CGIHTTPRequestHandler for CGI scripts.
It does, however, optionally implement HTTP/1.1 persistent connections,
as of version 0.3.
Notes on CGIHTT... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.2/Lib/http/server.py | Python | mit | 43,374 |
# Copyright 2016 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... | jendap/tensorflow | tensorflow/python/keras/layers/__init__.py | Python | apache-2.0 | 8,897 |
# -*- coding: utf-8 -*-
"""SMTP email client
.. module:: network.email.smtp_client
:platform: Unix
:synopsis: SMTP email client
.. moduleauthor:: Petr Rašek <bowman@hydratk.org>
"""
"""
Events:
-------
email_before_connect
email_after_connect
email_before_send_email
email_after_send_email
"""
from hydratk.co... | hydratk/hydratk-lib-network | src/hydratk/lib/network/email/smtp_client.py | Python | bsd-3-clause | 7,498 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 Rackspace Hosting
#
# 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.... | DirectXMan12/nova-hacking | nova/api/openstack/compute/contrib/cell_capacities.py | Python | apache-2.0 | 1,016 |
'''
* Copyright (c) 2011, University of Kent
* 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 of condi... | ioram7/keystone-federado-pgid2013 | build/lib.linux-x86_64-2.7/keystone/contrib/federated/middleware/saml.py | Python | apache-2.0 | 10,370 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | mtreinish/tempest_ec2 | tempest_ec2/tests/thirdparty/boto/utils/wait.py | Python | apache-2.0 | 4,468 |
#
# This file is part of Mapnik (c++ mapping toolkit)
#
# Copyright (C) 2013 Artem Pavlenko
#
# Mapnik is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your op... | yiqingj/work | plugins/input/ogr/build.py | Python | lgpl-2.1 | 2,637 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2010 Jendrik Seipp (jendrikseipp@web.de)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any l... | jendrikseipp/pogo | pogo/__init__.py | Python | gpl-2.0 | 794 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | toofar/qutebrowser | qutebrowser/browser/signalfilter.py | Python | gpl-3.0 | 3,206 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Humanizing functions for numbers."""
import re
from fractions import Fraction
from .import compat
from .i18n import gettext as _, gettext_noop as N_, pgettext as P_
def ordinal(value):
"""Converts an integer to its ordinal as a string. 1 is '1st', 2 is '2nd',
... | fniephaus/alfred-travis-ci | src/humanize/number.py | Python | mit | 4,567 |
import stp.play as play
import stp.tactic as tactic
from rj_gameplay.tactic import (
# pass_tactic,
pass_seek,
goalie_tactic,
clear_tactic,
wall_tactic,
)
import stp.skill as skill
import stp.role as role
from stp.role.assignment.naive import NaiveRoleAssignment
import stp.rc as rc
from typing impo... | RoboJackets/robocup-software | rj_gameplay/rj_gameplay/play/restart.py | Python | apache-2.0 | 9,160 |
# -*- coding: utf-8 -*-
from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo
class StealthTo(DeadCrypter):
__name__ = "StealthTo"
__type__ = "crypter"
__version__ = "0.22"
__status__ = "stable"
__pattern__ = r'http://(?:www\.)?stealth\.to/folder/.+'
__config__ ... | fzimmermann89/pyload | module/plugins/crypter/StealthTo.py | Python | gpl-3.0 | 530 |
import json
import time
import sched
from api import send_message
scheduler = sched.scheduler(time.time, time.sleep)
def load_reminders():
reminders = {}
try:
with open("data/reminders.json") as fp:
reminders = json.load(fp)
except Exception:
with open("data/reminders.json",... | lucasberti/telegrao-py | plugins/melenbra.py | Python | mit | 2,962 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | Microvellum/Fluid-Designer | win64-vc/2.78/scripts/startup/bl_operators/mesh.py | Python | gpl-3.0 | 6,277 |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 22 17:59:04 2016
@author: Wasit
"""
def fib(x):
if x==1:
return 1
else:
return x*fib(x-1)
if __name__ == "__main__":
print fib(4) | wasit7/tutorials | kivy/fib.py | Python | mit | 207 |
#!/usr/bin/env python
from horton import *
import h5py as h5
import os
log.set_level(log.silent)
def store_wfn(fn_h5, mixing, name_case, exp):
with h5.File(fn_h5) as f:
name_mixing = '%08.5f' % (-np.log10(mixing))
grp = f.require_group(name_mixing)
grp = grp.require_group(name_case)
... | eustislab/horton | tools/convergence_tester/make_guesses.py | Python | gpl-3.0 | 4,368 |
# coding=utf-8
__author__ = "AstroPrint Product Team <product@astroprint.com>"
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
__copyright__ = "Copyright (C) 2017 3DaGoGo, Inc - Released under terms of the AGPLv3 License"
import os
import threading
import time
from astroprint.p... | AstroPrint/AstroBox | src/plugins/com_astroprint_astrobox_plugins_virtualcomms/__init__.py | Python | agpl-3.0 | 10,257 |
import wx.lib.ogl as ogl
from myhdl import Signal, always
from MyHDLSim.combinational import Nxor
from MyHDLSim.Wrappers.GenericGateWrapper import GenericGateWrapper
class NxorGateShape(ogl.CompositeShape):
""" This shape is used exclusively to contruct the NXOR Gate main shape.
The shape is initially base... | mattsnowboard/msu-myhdlsim | MyHDLSim/Wrappers/NxorGateWrapper.py | Python | bsd-2-clause | 2,302 |
#!/usr/bin/env python2
# -.- coding: utf-8 -.-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is dist... | seleznev/audit-helper | modules/audit_iptables.py | Python | gpl-3.0 | 1,167 |
"""Directed graph production.
This module contains the code to produce an ordered directed graph of a
bzr branch, such as we display in the tree view at the top of the bzrk
window.
"""
__copyright__ = "Copyright 2005 Canonical Ltd."
__author__ = "Scott James Remnant <scott@ubuntu.com>"
from bzrlib.revis... | jelmer/bzr-gtk | branchview/linegraph.py | Python | gpl-2.0 | 19,106 |
from django.db import models
from mezzanine.pages.models import Page
from django.contrib.auth.models import User
#from account import models as user_models
class UseCase(models.Model):
name = models.CharField(max_length=255)
def __unicode__(self):
return (self.name)
class CollectionTable(models.Mode... | SISTEMAsw/TAMP | gui/data_ingestion/models.py | Python | mit | 4,023 |
# 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/operationsmanagement/azure-mgmt-operationsmanagement/azure/mgmt/operationsmanagement/aio/_configuration.py | Python | mit | 4,167 |
# -*- coding: utf-8 -*-
import pytest
from mutagenwrapper import MediaFile, ReservedTagNameError
basic_ref = {
'artist': 'Daft Punk',
'title': 'Get Lucky',
'album': 'Random Access Memories',
'date': '2013',
'genre': 'Electronic',
'composer': 'Guy-Manuel de Homem-Christo, Nile Rodgers, Pharrel... | clee704/mutagenwrapper | tests/test_mutagenwrapper.py | Python | mit | 3,184 |
from __future__ import print_function
import atexit, copy, inspect, itertools, os, pprint, re, sys, time, warnings
from datetime import datetime, tzinfo, timedelta # used by time tests
stashedPath = copy.copy(sys.path)
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), os.path.pardir, os.path... | robertjpayne/rethinkdb | test/rql_test/drivers/driver.py | Python | apache-2.0 | 25,478 |
# Settings file optimized for test running. Sets up in-memory database,
# Nose test runner and disables South for the tests
from .base import *
# Use in-memory SQLIte3 database for faster tests
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
# No nee... | AnthonyHonstain/LazyBower | lazybower/settings/test.py | Python | mit | 988 |
import matplotlib.pyplot as plt
import numpy as np
def runningMoments(data):
x = np.cumsum(data)
x2 = np.cumsum(data**2)
n = np.arange(1, len(data)+1)
mean = x / n
std = np.sqrt((x2*n - x*x) / (n * (n-1)))
return mean, std
def walkers(data, labels, npts=250, fontmin=11):
... | acbecker/pyhm | pyhm/walkers.py | Python | mit | 2,993 |
#!/usr/bin/env python
# "convertor" - converts ODF files from a YUSCII font-encoding to proper UTF-8.
# Copyright (C) 2009 Damjan Georgievski
#
# 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 S... | gdamjan/convertor | setup.py | Python | agpl-3.0 | 1,692 |
import py, os, sys
from pytest import raises
from .support import setup_make, IS_WINDOWS
class TestREGRESSION:
helpout = []
def setup_class(cls):
import cppyy
def stringpager(text, cls=cls):
cls.helpout.append(text)
import pydoc
pydoc.pager = stringpager
def... | karies/root | bindings/pyroot/cppyy/cppyy/test/test_regression.py | Python | lgpl-2.1 | 17,758 |
import ast
import ConfigParser
import datetime
import exceptions
import glob
import grp
import importlib
import inspect
import multiprocessing
import os
import sys
from drop_privileges import drop_privileges
from pwd import getpwnam
class JobCtl(object):
def __init__(self, sched, config, logging):
self... | stevec7/ratking | ratking/jobhandler.py | Python | mit | 19,610 |
import os, re
file = 'latex.tex'
dir = 'tex-test'
with open(file, 'r', encoding='utf8') as f:
data = ''.join(f.readlines())
split = re.split(r'(\\hier[ABCDE]def{|\\section{|\\subsection{)', data)
print(len(split))
for s in split:
title = s[:s.find("}")].replace('?','').replace('/','')
... | nert-gu/Xposition | xposition/scripts/split_latex.py | Python | gpl-3.0 | 706 |
import mock
from librarian_setup import setup as mod
@mock.patch.object(mod.Setup, 'auto_configure')
@mock.patch.object(mod.Setup, 'load')
def test_setup_init_already_completed(load, auto_configure):
load.return_value = {'some': 'data', 'completed': True}
setup = mod.Setup('setup.json')
assert setup.data... | Outernet-Project/librarian-setup | tests/test_setup.py | Python | gpl-3.0 | 2,743 |
# -*- coding: utf-8 -*-
# Copyright 2011 NorfCran <norfcran@gmail.com>
# License: same as zim (gpl)
from __future__ import with_statement
import gtk
from zim.plugins import PluginClass, extends, WindowExtension
from zim.actions import action
from zim.gui.widgets import ui_environment, MessageDialog
#from zim.gui.... | gdw2/zim | zim/plugins/linesorter.py | Python | gpl-2.0 | 3,057 |
# Copyright 2019 The MLPerf 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 applicable ... | mlperf/inference_results_v0.5 | open/Inspur/code/resnet/schedule/src/loadgen/demos/py_demo_multi_stream.py | Python | apache-2.0 | 2,879 |
from oslo_log import log as logging
from nca47.common.exception import NonExistParam, ParamNull, ParamValueError
from nca47.common.i18n import _
from nca47.common.i18n import _LE
from nca47.manager import central
from oslo_messaging.exceptions import MessagingException
from nca47.common.exception import BadRequest
from... | willowd878/nca47 | nca47/api/controllers/v1/firewall/fw_snat_addr_pool.py | Python | apache-2.0 | 8,191 |
from ircutils import dictapi
import time
import re
dictionary = dictapi.DictApi()
def chmsg(event, server):
global dictionary
msg = event['msg']
nick = event['nicka']
field = re.match('!mean (?P<word>.*)', msg)
if not field:
return
word = field.group('word')
ret = dictionar... | iogf/candocabot | plugins/mean/mean.py | Python | apache-2.0 | 428 |
"""
SoftLayer.tests.managers.loadbal_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
import SoftLayer
from SoftLayer import testing
VIRT_IP_SERVICE = ('SoftLayer_Network_Application_Delivery_Controller_'
'LoadBalancer_VirtualIpAddress')
c... | underscorephil/softlayer-python | tests/managers/loadbal_tests.py | Python | mit | 7,926 |
# -*- coding: utf-8 -*-
# Copyright (c) 2005 - 2013 Christopher Zorn
# See LICENSE.txt for details
import os
import sha
from twisted.trial import unittest
from twisted.words.protocols.jabber import jid
from twisted.internet import defer, reactor
from twisted.words.xish import xpath
try:
from twisted.words.protoco... | twonds/palaver | palaver/test/xep045.py | Python | mit | 74,418 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/OSIS-Louvain | base/models/enums/learning_unit_year_subtypes.py | Python | agpl-3.0 | 1,452 |
import logging
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from corehq.apps.adm.dispatcher import ADMSectionDispatcher
from corehq.apps.adm.models import REPORT_SECTION_OPTIONS, ADMReport
from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumn, DTSort... | SEL-Columbia/commcare-hq | corehq/apps/adm/reports/__init__.py | Python | bsd-3-clause | 6,857 |
'''
Date: 20th July 2009
This test ensures that the engine is able to run and shut down properly.
The criteria is that you should be able to "exit" the mainloop twice,
either by manual exit (ESC) or the console command "exit".
Before each run a welcoming message will be printed.
'''
import tra... | andersandersson/smug | python/tests/hello.py | Python | gpl-3.0 | 878 |
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import filecmp
import gyp.common
import gyp.xcodeproj_file
import errno
import os
import posixpath
import re
import shutil
import subprocess
import tempfile
# Pr... | kans/birgo | tools/gyp/pylib/gyp/generator/xcode.py | Python | apache-2.0 | 53,685 |
def main(request, response):
response.headers.set("Content-Security-Policy", "default-src * 'unsafe-inline'")
response.headers.set("X-Content-Security-Policy", "default-src * 'unsafe-inline'")
response.headers.set("X-WebKit-CSP", "default-src * 'unsafe-inline'")
return """<!DOCTYPE html>
<!--
Copyright ... | pk-sam/crosswalk-test-suite | webapi/tct-csp-w3c-tests/csp-py/csp_default-src_asterisk_script.py | Python | bsd-3-clause | 3,198 |
import unittest
from nose.tools import raises
from wextractor.extractors.extractor import Extractor
class TestExtractor(unittest.TestCase):
@raises(Exception)
def test_header_matches_dtypes(self):
'''
Tests that mismatched lengths of headers and dtypes raises
'''
Extractor(
... | codeforamerica/w-drive-extractor | test/unit/extractors/test_extractor.py | Python | mit | 752 |
#!/usr/bin/python3
from subframe import Subframe, SubframeError
class Frame(dict):
"""Parse one frame from sonde."""
def __init__(self, data, frame_prev = None):
"""Parse and decode frame. Input data have structure of byte
stream where input data interleaves with data status, eg.
byt... | pinkavaj/rstt | rstt_cli/frame.py | Python | apache-2.0 | 1,450 |
import pytest
import requests
from cfme.utils.appliance.implementations.ui import navigate_to
pytestmark = [pytest.mark.ignore_stream("5.11")]
@pytest.mark.tier(3)
def test_verify_rss_links(appliance):
"""
Polarion:
assignee: jhenner
initialEstimate: 1/4h
casecomponent: WebUI
"""... | nachandr/cfme_tests | cfme/tests/intelligence/test_rss.py | Python | gpl-2.0 | 567 |
# -*- coding: utf-8 -*-
"""
objetos_trayectorias.py declaraciones de objetos para el main
loop_trayectorias
@author: Damián E. Stanganelli
"""
class Trayectorias(object):
"""
Objeto que administra el listado de trayectorias
trayectorias
trayectoriasArchivadas
numeroDeFotograma
... | sebalander/VisionUNQ | visionUNQ/objetos_trayectorias.py | Python | bsd-3-clause | 8,447 |
# Generated by Django 1.9.6 on 2016-05-10 09:46
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('appliances', '0030_bugquery'),
('appliances', '0031_auto_20160506_0848'),
]
operations = [
]
| nachandr/cfme_tests | sprout/appliances/migrations/0032_merge.py | Python | gpl-2.0 | 270 |
# coding: utf8
# textutil.py
# 10/8/2012 jichi
if __name__ == '__main__':
import sys
sys.path.append('..')
import debug
debug.initenv()
import re
from sakurakit import skstr
from unitraits import unichars, jpchars
from windefs import winlocale
import convutil, defs
## Encoding ##
# SHIFT-JIS VS CP932
# http... | Dangetsu/vnr | Frameworks/Sakura/py/apps/reader/utilities/textutil.py | Python | gpl-3.0 | 7,550 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/authentication/authenticationvserver_authenticationpolicy_binding.py | Python | apache-2.0 | 9,955 |
import speech_recognition as sr
import os
from .utils import ShellParser
class Parser(ShellParser):
"""
Extract text (i.e. speech) from an audio file, using SpeechRecognition.
Since SpeechRecognition expects a .wav file, with 1 channel,
the audio file has to be converted, via sox, if not compliant
... | Nift/textract | textract/parsers/audio.py | Python | mit | 1,736 |
import io
import json
import os
from pathlib import Path
from random import randint, random
from textwrap import dedent
from typing import List, Tuple
import numpy as np
import pandas as pd
import pytest
from ecl.util.util import BoolVector
from numpy.testing import assert_almost_equal, assert_array_equal
from ert_sh... | joakim-hove/ert | tests/ert_tests/storage/test_extraction.py | Python | gpl-3.0 | 18,961 |
from lib.hachoir_core.field import (MissingField, BasicFieldSet, Field, ParserError,
createRawField, createNullField, createPaddingField, FakeArray)
from lib.hachoir_core.dict import Dict, UniqKeyError
from lib.hachoir_core.error import HACHOIR_ERRORS
from lib.hachoir_core.tools import lowerBound
import lib.hachoir... | Branlala/docker-sickbeardfr | sickbeard/lib/hachoir_core/field/generic_field_set.py | Python | mit | 19,195 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django_markdown.models
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='post',... | Ratina/ratina_portal | blog/migrations/0002_auto_20150209_0254.py | Python | gpl-3.0 | 459 |
import json
import netrc
import tempfile
from click.testing import CliRunner
import pytest
import responses
from ghutil.api.client import ACCEPT
from ghutil.cli.__main__ import cli
@pytest.fixture
def echo_headers():
with responses.RequestsMock() as rsps:
rsps.add_callback(
responses.GET,
... | jwodder/ghutil | test/test_api_config.py | Python | mit | 4,464 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Grid Dynamics
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License ... | Brocade-OpenSource/OpenStack-DNRM-Nova | nova/api/openstack/compute/plugins/v3/fping.py | Python | apache-2.0 | 5,098 |
# Copyright (C) 2005 Martin v. Löwis
# Licensed to PSF under a Contributor Agreement.
from _msi import *
import fnmatch
import os
import re
import string
import sys
AMD64 = "AMD64" in sys.version
# Keep msilib.Win64 around to preserve backwards compatibility.
Win64 = AMD64
# Partially taken from Wine
datasizemask= ... | xyuanmu/XX-Net | python3.8.2/Lib/msilib/__init__.py | Python | bsd-2-clause | 17,596 |
from django.contrib.auth.models import User
from drf_haystack.serializers import HaystackSerializer
from rest_framework import serializers
from apiv2.models import *
from apiv2.search_indexes import QuestionIndex
class EducationLevelSerializer(serializers.ModelSerializer):
class Meta:
model = EducationLe... | deka108/mathqa-server | apiv2/serializers.py | Python | apache-2.0 | 5,579 |
import numpy
import time
import pyglet
import pyglet.graphics as gl
import noise
from config import SECTOR_SIZE
cb_v = numpy.array([
[-1,+1,-1, -1,+1,+1, +1,+1,+1, +1,+1,-1], # top
[-1,-1,-1, +1,-1,-1, +1,-1,+1, -1,-1,+1], # bottom
[-1,-1,-1, -1,-1,+1, -1,+1,+1, -1,+1,-1], # left
[+... | spillz/minepy | util.py | Python | gpl-3.0 | 5,629 |
from flask import Flask, request, abort
import json
import ndb_util
from model import User
from google.appengine.api import users
from google.appengine.ext import ndb
from google.appengine.api import app_identity
from google.appengine.api import mail
from flask_restful import Resource
from google.appengine.runtime i... | jtovar2/demo_app | backend/resources/org_user_relationships.py | Python | mit | 4,196 |
import functools
import httplib as http
import itertools
from operator import itemgetter
from dateutil.parser import parse as parse_date
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.utils import timezone
from flask import request, redirect
import pytz
from framework.d... | erinspace/osf.io | website/project/views/drafts.py | Python | apache-2.0 | 13,819 |
"""Demo EmulatedDevice and EmulatedTile objects for testing and demonstration purposes."""
from .demo_device import DemoEmulatedDevice
from .demo_reference import DemoReferenceDevice
from .demo_proxy import DemoTileProxy
__all__ = ['DemoEmulatedDevice', 'DemoReferenceDevice', 'DemoTileProxy']
| iotile/coretools | iotileemulate/iotile/emulate/demo/__init__.py | Python | gpl-3.0 | 296 |
def get_heroku_caches():
try:
os.environ['MEMCACHE_SERVERS'] = os.environ['MEMCACHIER_SERVERS']
os.environ['MEMCACHE_USERNAME'] = os.environ['MEMCACHIER_USERNAME']
os.environ['MEMCACHE_PASSWORD'] = os.environ['MEMCACHIER_PASSWORD']
return {
'default':
{
'BACKEND': 'django_pylibmc.memcached.PyLibMCCa... | thisismess/heroku-django-helpers | heroku_django_helpers/helpers.py | Python | mit | 531 |
# -*- coding: utf-8 -*-
# Flask-Diamond (c) Ian Dennis Miller
from flask_security import SQLAlchemyUserDatastore
from flask_security import Security
from flask import current_app
security = Security()
def init_accounts(self, user=None, role=None, *args, **kwargs):
"""
Initialize Security for application.
... | diamond-org/flask-diamond | flask_diamond/facets/accounts.py | Python | mit | 1,403 |
from datetime import datetime
from ss.log import Log
from ss.config import Config
from ss.jobs.job import Job
from ss.jobs.sync_job import SyncJob
from ss.jobs.backup_job import BackupJob
from ss.jobs.zfs_status_job import ZfsStatusJob
class DummyJob(Job):
def __init__(self,config,lastExecConfig,n... | JFinis/serverscript | src/ss/jobs/scheduler.py | Python | mit | 2,822 |
##############################################################################
# Copyright (c) 2013-2017, 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... | TheTimmy/spack | var/spack/repos/builtin/packages/graphmap/package.py | Python | lgpl-2.1 | 1,857 |
"""
Class that preprocesses the data
Siddharth Sigtia
Feb,2014
C4DM
"""
import numpy
import cPickle as pickle
import sklearn.preprocessing as preprocessing
import os
import tables as T
from utils import *
class PreProcessor():
def __init__(self,dataset_dir,):
self.dataset_dir = dataset_dir
self.f... | daleloogn/mython | preprocessing.py | Python | gpl-2.0 | 4,046 |
# coding=utf-8
# Copyright 2006-2009 Scott Horowitz <stonecrest@gmail.com>
# Copyright 2009-2014 Jonathan Ballet <jon@multani.info>
#
# This file is part of Sonata.
#
# Sonata 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 Softwa... | deprint/sonata | sonata/about.py | Python | gpl-3.0 | 9,748 |
# Copyright 2015 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 a... | martinbede/second-sight | tensorflow/contrib/layers/python/ops/loss_ops_test.py | Python | apache-2.0 | 15,936 |
import numpy as np
import sonnet as snt
import tensorflow as tf
from tensorflow.contrib.distributions import Bernoulli, NormalWithSoftplusScale
from modules import SpatialTransformer, ParametrisedGaussian
class AIRCell(snt.RNNCore):
"""RNN cell that implements the core features of Attend, Infer, Repeat, as desc... | akosiorek/attend_infer_repeat | attend_infer_repeat/cell.py | Python | gpl-3.0 | 7,842 |
# -*- coding: utf-8 -*-
'''
Created on Jul 18, 2013
@author: Carl, Aaron
'''
import MySQLdb
| MoneyBack/MoneyBack | mb/dal.py | Python | gpl-2.0 | 96 |
from cfme.common.provider import DefaultEndpoint, DefaultEndpointForm
from . import InfraProvider
from wrapanapi.virtualcenter import VMWareSystem
class VirtualCenterEndpoint(DefaultEndpoint):
pass
class VirtualCenterEndpointForm(DefaultEndpointForm):
pass
class VMwareProvider(InfraProvider):
type_nam... | jteehan/cfme_tests | cfme/infrastructure/provider/virtualcenter.py | Python | gpl-2.0 | 2,366 |
import time
import unittest
from mox import MoxTestBase
from slimta.edge import Edge, EdgeServer
class TestEdge(MoxTestBase, unittest.TestCase):
def test_handoff(self):
self.mox.StubOutWithMock(time, 'time')
env = self.mox.CreateMockAnything()
queue = self.mox.CreateMockAnything()
... | slimta/python-slimta | test/test_slimta_edge.py | Python | mit | 2,894 |
__author__ = 'albmin'
#allows for package support (i can't think of any methods that need to go in here) | albmin/json_mapper | __init__.py | Python | mit | 104 |
# -*- coding: utf-8 -*-
# This file is part of DigitalPedalBoard python program.
# Copyright (C) 2013 Copyright (C) 2013 Daniel Ken Fujimori Killner,
# Gabriel Moura Vieira Martinez, Rafael Alves de Araujo Sena,
# Ricardo Boccoli Gallego, Danilo de Jesus da Silva Bellini.
#
# DigitalPedalBoard is free software: you can... | RicardoBoccoliGallego/DigitalPedalBoard | lib.py | Python | gpl-3.0 | 4,588 |
import json
import urllib
import dateutil.parser
from collections import OrderedDict
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
from matplotlib.transforms import blended_transfo... | ClinicalGraphics/scikit-image | doc/tools/plot_pr.py | Python | bsd-3-clause | 4,128 |
# 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... | Vagab0nd/SiCKRAGE | lib3/twilio/rest/verify/v2/service/entity/factor.py | Python | gpl-3.0 | 19,771 |
# -*- coding: utf-8 -*-
from module.plugins.internal.SimpleHoster import SimpleHoster
class DataportCz(SimpleHoster):
__name__ = "DataportCz"
__type__ = "hoster"
__version__ = "0.46"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.+)'
__config__ = [("activated", "... | rlindner81/pyload | module/plugins/hoster/DataportCz.py | Python | gpl-3.0 | 2,266 |
"""Packaging settings."""
from codecs import open
from os.path import abspath, dirname, join
from subprocess import call
from setuptools import Command, find_packages, setup
import motey
this_dir = abspath(dirname(__file__))
with open(join(this_dir, 'README.rst'), encoding='utf-8') as file:
long_description =... | Neoklosch/Motey | setup.py | Python | apache-2.0 | 3,323 |
"""
bungee tests
These require an ElasticSearch server running on localhost:9200.
"""
import unittest
from bungee import SearchModel
from pyelasticsearch import ElasticSearch
class BungeeTestCase(unittest.TestCase):
books = [
{ '_id': 'A',
'title': 'Heart of Darkness',
'autho... | wan/bungee | bungee/tests/__init__.py | Python | bsd-2-clause | 2,975 |
import requests
import pytest
import json
import demistomock as demisto
bundle_index = 0
submitted_indicators = 0
mocked_get_token_response = """{"access_token": "fababfafbh"}"""
iocs_bundle = [
{
"id": "bundle--f00374ec-429c-40cb-b7bb-61f920814775",
"objects": [
{
"cre... | demisto/content | Packs/Cybersixgill-DVE/Integrations/CybersixgillDVEFeed/CybersixgillDVEFeed_test.py | Python | mit | 41,917 |
"""Views for the branding app. """
import logging
import urllib
from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.cache import cache
from django.views.decorators.cache import cache_control
from django.http import HttpResponse, Http404
from django.utils import translation
fr... | nttks/edx-platform | lms/djangoapps/branding/views.py | Python | agpl-3.0 | 11,288 |
# Copyright (C) 2015 Yahoo! 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... | openstack/horizon | openstack_dashboard/dashboards/identity/identity_providers/protocols/tables.py | Python | apache-2.0 | 2,469 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
from invoke import task
from website import settings
HERE = os.path.dirname(os.path.abspath(__file__))
WHEELHOUSE_PATH = os.environ.get('WHEELHOUSE')
@task()
def manage(ctx, cmd_str):
"""Take command string for manage commands
:param... | mluo613/osf.io | admin/tasks.py | Python | apache-2.0 | 2,257 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import cgi
import html
import http.cookies
import os
from _wall import Wall
wall = Wall()
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
session = cookie.get("session")
if session is not None:
session = session.value
user = wall.find_cookie(sessio... | deadsquirrel/helloworld | tw/wall.py | Python | unlicense | 2,103 |
# Copyright (c) 2015 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | japaniel/CloudFerry | devlab/tests/data_collector.py | Python | apache-2.0 | 12,617 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-07 12:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('groups', '0008_group_url_import_feed'),
]
operations = [
migrations.AlterFi... | stadtgestalten/stadtgestalten | grouprise/features/groups/migrations/0009_auto_20170607_1402.py | Python | agpl-3.0 | 628 |
# -*- coding:utf-8 -*-
# Copyright 2014, Quixey 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... | quixey/python-aliyun | tests/unit/aliyun/slb/model_test.py | Python | apache-2.0 | 7,883 |
#
# for single user:
# pip install jsonpath-rw jsonpath-rw-ext --user
# for global:
# sudo -H pip install jsonpath-rw jsonpath-rw-ext
#
# OR preferred way through virtualenv
# virtualenv jsonpath
# source jsonpath/bin/activate
# pip install jsonpath-rw jsonpath-rw-ext
#
import json
from jsonpath_rw import jsonpath
#f... | fabianlee/blogcode | python-jsonpath/SquadTestJSONPath.py | Python | mit | 2,447 |
"""
Example of how to use byte-code execution technique to trace accesses to numpy
arrays.
This file demonstrates two applications of this technique:
* optimize numpy computations for repeated calling
* provide automatic differentiation of procedural code
"""
import __builtin__
import ctypes
import inspect
import lo... | sujason/quantitative | autodiff/context.py | Python | mit | 45,855 |
import datetime
from django.conf import settings
from django.db.models import Q
from django.utils import timezone
from django.core.cache import cache
from funfactory.urlresolvers import reverse
from airmozilla.main.models import (
Event,
Channel,
EventHitStats,
most_recent_event
)
from airmozilla.mai... | lcamacho/airmozilla | airmozilla/main/context_processors.py | Python | bsd-3-clause | 12,078 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | openstack/designate | designate/tests/unit/test_conf.py | Python | apache-2.0 | 1,855 |
## func
##
## Copyright 2007, Red Hat, Inc
## See AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 ... | dockerera/func | func/module_loader.py | Python | gpl-2.0 | 5,193 |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 10 11:10:38 2015
@author: boland
"""
from obspy import read
import numpy as np
import itertools
import os
import datetime
import sqlite3 as lite
try:
import cPickle as pickle
except:
import pickle
print "Caution, database code may run slow because cPickle f... | boland1992/seissuite_iran | build/lib/ambient/database/create_database.py | Python | gpl-3.0 | 6,655 |
"""Help getting the etree.
This method is copied as suggested by lmxl.
http://lxml.de/tutorial.html
"""
try:
from lxml import etree
print("running with lxml.etree")
except ImportError:
try:
# Python 2.5
import xml.etree.cElementTree as etree
print("running with cElementTree on Pytho... | zorion/acm-uva | jsonml/python/xmlhelper.py | Python | gpl-3.0 | 1,020 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.