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 |
|---|---|---|---|---|---|
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from .config import _cfg, _cfgi
engine = create_engine(_cfg('connection-string'))
db = scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine))
Base ... | MaxLeiter/truecraft.io | truecraft/database.py | Python | mit | 461 |
from setuptools import setup
setup(
name='djmicro',
version='0.0.2',
author='Andrew Pendleton',
py_modules = ['djmicro'],
install_requires=['Django>=1.6'],
)
| apendleton/djmicro | setup.py | Python | bsd-3-clause | 178 |
from __future__ import division, print_function, unicode_literals
import re, collections
import hindkit as kit
SCRIPT_PREFIX = 'dv'
STEM_ANCHOR_NAMES = ['abvm.e', 'abvm']
def glyph_filter_matra_i_alts(glyph):
return glyph.name.startswith(SCRIPT_PREFIX + 'mI.alt')
def glyph_filter_bases_for_matra_i(glyph):
n... | mooniak/hindkit | hindkit/scripts/devanagari.py | Python | mit | 11,394 |
"""Test txstripe."""
from mock import patch, Mock
from twisted.trial.unittest import TestCase
from twisted.internet import defer
class BaseTest(TestCase):
"""Default settings for all tests."""
def _json_mock(self):
return self.mocked_resp
def _request_mock(self, *args, **kwargs):
retu... | lextoumbourou/txstripe | txstripe/test/__init__.py | Python | mit | 741 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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',
'status': ['preview'],
... | le9i0nx/ansible | lib/ansible/modules/network/aci/aci_encap_pool.py | Python | gpl-3.0 | 5,480 |
from fake_switches.switch_configuration import Port, AggregatedPort
_unique_port_index = 20000
def _unique_port():
global _unique_port_index
_unique_port_index += 1
return _unique_port_index
def _juniper_ports_with_less_ae():
return [Port("ge-0/0/{}".format(i)) for i in range(1, 5)] + \
... | internap/fake-switches | tests/util/__init__.py | Python | apache-2.0 | 376 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import win32api
import win32con
import winerror
import win32gui_struct
import win32ui
from win32com.shell import shell, shellcon
try:
import winxpgui as win32gui
except ImportError:
import win32gui
import struct, array
import comm... | nickchen-mitac/fork | src/avashell/win32/simpledialog.py | Python | apache-2.0 | 11,791 |
#!/usr/local/bin/python
'''PSwAaDS 1.12 Self Check - Inf Monkeys w/ Hill Climb'''
import random as rand
TARGET = 'methinks it is like a weasel'
def generate(instr, matchset):
'''generate based on matchset'''
outstr = ''
for i, _ in enumerate(TARGET):
if i in matchset:
outstr += instr[... | jonjon33/sandbox | python/dsbook/1.12-func/hcmonkey.py | Python | mit | 1,125 |
""" conf test cases """
import unittest
from zk_shell.conf import Conf, ConfVar
class ConfTestCase(unittest.TestCase):
""" test conf code """
def setUp(self):
""" nothing for now """
pass
def test_conf(self):
""" basic tests """
conf = Conf(
ConfVar(
... | harlowja/zk_shell | zk_shell/tests/test_conf.py | Python | apache-2.0 | 701 |
from .__about__ import __version__
__all__ = ['__version__']
| DataDog/integrations-extras | resin/datadog_checks/resin/__init__.py | Python | bsd-3-clause | 62 |
from __future__ import absolute_import, unicode_literals
import datetime
import json
import logging
import requests
import six
from abc import ABCMeta, abstractmethod
from . import __version__, CLIENT_NAME
from .utils import format_iso8601, parse_iso8601
logger = logging.getLogger(__name__)
# ====================... | caktus/rapidpro-python | temba_client/base.py | Python | bsd-3-clause | 12,474 |
from django.db import models
from django.contrib.auth.models import User
from PIL import Image
class Usuario(models.Model):
""" Este modelo one-to-one es frecuentemente llamado modelo Perfil """
usuario = models.OneToOneField(User, on_delete=models.CASCADE)
# pip install Pillow
foto = models.ImageF... | mike-rg/MyGoalTracker | myGoalTracker/usuario/models.py | Python | gpl-3.0 | 388 |
import os
import sys
def is_excluded():
file_name = os.path.basename(sys.argv[0])
path = os.path.dirname(os.getenv("APPDATA")) # get path to APPDATA
path += "\\Local\\Animation Labs\\vorpX\\vorpControl.ini"
with open(path, mode="r") as f:
return file_name in f.read()
if __name__ == '__main... | Fire-Proof/LoLVRSpectate | LoLVRSpectate/VorpX.py | Python | gpl-3.0 | 343 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from django.forms import ValidationError
from django.forms.models import ModelForm
from django.forms.widgets import Media
from django.utils.translation import ugettext_lazy as _
from djangocms_link.models import Link
cl... | Glasgow2015/team-10 | env/lib/python2.7/site-packages/djangocms_link/forms.py | Python | apache-2.0 | 2,110 |
#!/usr/bin/python
##
# Use : To make reverse compliment of multiple fasta
# Require : preinstalled BioPython
# Usage : python Rev_Comp.py <InputFile> > <OutputFile>
##
import sys
file=sys.argv[1]
print >> sys.stderr, file
from Bio import SeqIO
for record in SeqIO.parse(file, "fasta"):
print ">"+record.id
... | minesh1291/Sequence-Utilities | Rev_Comp.py | Python | apache-2.0 | 359 |
import copy
import unittest
import warnings
import mock
import numpy
import pytest
import chainer
from chainer import backend
from chainer.backends import cuda
from chainer.backends import intel64
from chainer import initializers
from chainer import testing
from chainer.testing import attr
import chainerx
def _asse... | okuta/chainer | tests/chainer_tests/test_link.py | Python | mit | 93,478 |
from django.http import Http404
from django.views.generic.base import TemplateView
from treeherder.model.derived import JobsModel
class ResultsetStatusView(TemplateView):
template_name = "embed/resultset_status.html"
def get_context_data(self, **kwargs):
assert "repository" in kwargs and "revision"... | adusca/treeherder | treeherder/embed/views.py | Python | mpl-2.0 | 1,201 |
#
# 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
# ... | cosminmocan/heat-templates | tests/software_config/test_hook_puppet.py | Python | apache-2.0 | 8,040 |
"""LIT demo for image model.
To run:
python -m lit_nlp.examples.image_demo --port=5432
Then navigate to localhost:5432 to access the demo UI.
"""
import sys
from absl import app
from absl import flags
from lit_nlp import dev_server
from lit_nlp import server_flags
from lit_nlp.api import dtypes as lit_dtypes
from ... | pair-code/lit | lit_nlp/examples/image_demo.py | Python | apache-2.0 | 2,271 |
import itertools
import json
from datetime import datetime, timedelta
from pathlib import Path
from unittest.mock import patch
from raiden.messages import Lock
from raiden.storage.serialize import JSONSerializer
from raiden.storage.sqlite import SerializedSQLiteStorage, SQLiteStorage
from raiden.tests.utils import fac... | hackaugusto/raiden | raiden/tests/unit/test_sqlite.py | Python | mit | 16,362 |
from django.contrib.auth.models import AbstractUser
from django.db import models
class User(AbstractUser):
minecraft_username = models.CharField(max_length=120, blank=True)
referred_by = models.CharField(max_length=120, blank=True) # This should be Minecraft username.
granted_access = models.BooleanField... | weegeekps/minecraft-gatekeeper | MinecraftGatekeeper/RootSite/models.py | Python | apache-2.0 | 727 |
from __future__ import unicode_literals, print_function
from kivy.factory import Factory
def widget_from_json(json_dict):
#Conversion step as python2 kivy does not accept Property names in unicode
args = json_dict['args']
new_dict = {}
for each in args:
new_dict[str(each)] = args[each]
return getattr(Factory, ... | Kovak/KivySurvey | kivy_survey/jsontowidget.py | Python | mit | 351 |
import simplejson as json
from flask import current_app as app, request
from flask.json import dumps
class ExtensibleJSONEncoder(json.JSONEncoder):
"""A JSON encoder that returns the to_json method if present"""
def default(self, obj):
if hasattr(obj, 'to_json'):
return obj.to_json()
... | oregoncountryfair/ocfnet | ocfnet/util.py | Python | mit | 908 |
"""
Django settings for tutorial project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
f... | python-uni/tutorial-django | tutorial/tutorial/settings.py | Python | mit | 2,574 |
"""Implement the rules of each C++ build utility type."""
import os
import logging
import shared_utils as su
class CplusplusCommon(object):
"""Common C++ handler functions."""
@classmethod
def _get_cc_all_link_libs(cls, rule_details, details_map):
"""Get all link libraries for a C++ build rule."""
if su... | jkumarrf/mool | build_tool/bu.scripts/cc_common.py | Python | bsd-3-clause | 8,229 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("GradientBoostingClassifier" , "FourClass_10" , "mssql")
| antoinecarme/sklearn2sql_heroku | tests/classification/FourClass_10/ws_FourClass_10_GradientBoostingClassifier_mssql_code_gen.py | Python | bsd-3-clause | 153 |
from django.contrib import admin
from duelify_app.models import Ring, Punch, Category, User
from django import forms
from django.contrib.auth.models import Group
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.forms import ReadOnlyPasswordHashField
#from customauth.models import User
admin.... | houmie/duelify | duelify_app/admin.py | Python | gpl-2.0 | 3,440 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.refrigeration import RefrigerationCondenserWaterCooled
log = logging.getLogger(__name__)
class TestRefrigerationCondenserWaterCooled(unittest.TestCase):
def setUp(self):
... | rbuffat/pyidf | tests/test_refrigerationcondenserwatercooled.py | Python | apache-2.0 | 5,826 |
# This file is executed by __init__.py and ppimport hooks.
"""
Discrete Fourier Transform algorithms
=====================================
Fast Fourier Transforms:
fft --- FFT of arbitrary type periodic sequences
ifft --- Inverse of fft
fftn --- Multi-dimensional FFT
ifftn --- Inverse of f... | huard/scipy-work | scipy/fftpack/info.py | Python | bsd-3-clause | 2,104 |
#!/usr/bin/python
import sys
def spam(divideBy):
try:
return 42 / divideBy
except ZeroDivisionError:
return sys.maxsize
print(spam(2))
print(spam(12))
print(spam(0))
print(spam(1))
| nibaozhu/project_x | src/test/p1/33.py | Python | unlicense | 190 |
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016, 2017
class DataAlreadyExistsError(RuntimeError):
def __init__(self, label):
self.message = str("Data with label '%s' already exists and cannot be added" % (label))
def get_patient_id(d):
return d['patient']['identifier']
def get_index_... | IBMStreams/streamsx.health | samples/HealthcareJupyterDemo/package/healthdemo/utils.py | Python | apache-2.0 | 2,562 |
"""
WSGI config for chatter 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.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "chatter.settings")
from django.core.w... | scott-w/pyne-django-tutorial | chatter/chatter/wsgi.py | Python | mit | 389 |
class Solution(object):
def findMaxConsecutiveOnes(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
# sliding window
max_len = 0
li = 0
ri = 0
l = 0
inserted = False
for ri, rval in enumerate(nums):
if rval =... | daicang/Leetcode-solutions | 487-max-consecutive-ones-ii.py | Python | mit | 773 |
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# 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 co... | jrabbit/ubotu-fr | src/ircutils.py | Python | bsd-3-clause | 20,860 |
"""Package initialisation file"""
__author__ = "Mark Slater <mws@hep.ph.bham.ac.uk>"
__date__ = "10 June 2008"
__version__ = "1.0"
from .Remote import Remote
| ganga-devs/ganga | ganga/GangaCore/Lib/Remote/__init__.py | Python | gpl-3.0 | 161 |
# Made by Mr. - Version 0.3 by DrLecter
import sys
from com.l2scoria.gameserver.model.quest import State
from com.l2scoria.gameserver.model.quest import QuestState
from com.l2scoria.gameserver.model.quest.jython import QuestJython as JQuest
qn = "320_BonesTellFuture"
BONE_FRAGMENT = 809
ADENA = 57
class Quest (JQues... | zenn1989/scoria-interlude | L2Jscoria-Game/data/scripts/quests/320_BonesTellFuture/__init__.py | Python | gpl-3.0 | 2,291 |
import os
import re
from datetime import *
import feedparser
from newspaper import Article,Config
import newspaper
import urllib.request
def writeFile(outPath,content):
file = open(outPath, 'w')
if file:
file.write(content)
file.close()
else:
print ("Error Opening File " + outPath)
... | ciandcd/ciandcd-web | htmlExtractor/HECommon.py | Python | mit | 5,015 |
# -*- coding: utf-8 -*-
#
# Copyright 2013 Paul Tremberth, Newlynn Labs
# See LICENSE for details.
import graph
import schema
import bz2
import csv
import traceback
import sys
# ----------------------------------------------------------------------
MERGED = '***MERGED***'
class CsvBatchWriter(object):
CSV_BATCH... | redapple/sql2graph | sql2graph/export.py | Python | mit | 13,462 |
import os
import strutil
from astrodata.adutils import gemLog
log = None
"""This file contains the following utilities:
checkImageParam( image )
checkOutputParam( outfile, defaultValue='out.fits' )
def verifyOutlist( inlist, outlist )
checkParam( parameter, paramType, defaultValue, compareValue=0.0... | pyrrho314/recipesystem | trunk/astrodata/adutils/paramutil.py | Python | mpl-2.0 | 14,435 |
# encoding: utf-8
# module samba.dcerpc.netlogon
# from /usr/lib/python2.7/dist-packages/samba/dcerpc/netlogon.so
# by generator 1.135
""" netlogon DCE/RPC """
# imports
import dcerpc as __dcerpc
import talloc as __talloc
class netr_DELTA_TRUSTED_DOMAIN(__talloc.Object):
# no doc
def __init__(self, *args, **... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/samba/dcerpc/netlogon/netr_DELTA_TRUSTED_DOMAIN.py | Python | gpl-2.0 | 1,909 |
"""
urlresolver XBMC Addon
Copyright (C) 2015 tknorris
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.
... | koditraquinas/koditraquinas.repository | script.module.urlresolver/lib/urlresolver/plugins/filehoot.py | Python | gpl-2.0 | 1,599 |
from .base import BaseOp
from .. import objtypes, excepttypes, ssa_types
from ..constraints import ObjectConstraint, IntConstraint
class CheckCast(BaseOp):
def __init__(self, parent, target, args):
super(CheckCast, self).__init__(parent,args, makeException=True)
self.env = parent.env
self.t... | alexkasko/krakatau-java | krakatau-lib/src/main/resources/Lib/Krakatau/ssa/ssa_ops/checkcast.py | Python | gpl-3.0 | 1,131 |
# -*- test-case-name: twistedcaldav.test.test_sharing -*-
# #
# Copyright (c) 2010-2017 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | macosforge/ccs-calendarserver | twistedcaldav/sharing.py | Python | apache-2.0 | 38,051 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""pagegetter lite"""
import ujson as json
import twisted.python.failure
import datetime
import dateutil.parser
import hashlib
import logging
import time
import copy
from twisted.internet.defer import maybeDeferred
from twisted.web.client import _parse
from hiispider.re... | hiidef/hiispider | legacy/pagegetterlite.py | Python | mit | 6,744 |
__author__ = 'saeedamen' # Saeed Amen
#
# Copyright 2016-2020 Cuemacro - https://www.cuemacro.com / @cuemacro
#
# 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/LI... | cuemacro/finmarketpy | finmarketpy_examples/fx_spot_indices_examples.py | Python | apache-2.0 | 6,535 |
from sqlalchemy import create_engine, Column, Integer, Table
from sqlalchemy import String, DateTime, ForeignKey
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.orm import relationship, backref
from sqlalchemy.ext.declarative import declarative_base
from datetime import datetime
engine = create... | Drvanon/Game | database.py | Python | apache-2.0 | 586 |
"""
"""
from link.common import APIResponse
from link.wrappers import APIRequestWrapper, APIResponseWrapper
from requests.auth import AuthBase
import json
import requests
class ConsoleAuth(AuthBase):
"""
Does the authentication for Console requests.
"""
def __init__(self, token):
# setup any... | uhjish/link | link/wrappers/consolewrappers.py | Python | apache-2.0 | 8,558 |
# coding=utf-8
import vim
from os.path import join
from .vim_interface import *
def set_vim_globals():
""" Sets global vim preferences and commands.
"""
# To update the date when files are modified
if get_save_dir() == "":
V + 'echom "vim-pad: IMPORTANT: please set g:pad#dir to a valid path in ... | fmoralesc/vim-pad | pythonx/pad/vim_globals.py | Python | mit | 966 |
from common import TofbotTestCase, bot_action
from httpretty import HTTPretty, httprettified
from plugins.euler import EulerEvent
class TestEuler(TofbotTestCase):
@httprettified
def test_euler(self):
euler_nick = 'leonhard'
def set_score(score):
url = "http://projecteuler.net/pro... | p0nce/tofbot | tests/test_euler.py | Python | bsd-2-clause | 1,331 |
# 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)
from pants.backend.j... | fkorotkov/pants | src/python/pants/backend/codegen/thrift/java/java_thrift_library.py | Python | apache-2.0 | 4,264 |
"""Packaging settings."""
from codecs import open
from os.path import abspath, dirname, join
from subprocess import call
from setuptools import Command, find_packages, setup
from skywatch import __version__
this_dir = abspath(dirname(__file__))
with open(join(this_dir, 'README.rst'), encoding='utf-8') as file:
... | abeer486/skywatch-python-cli | setup.py | Python | gpl-3.0 | 1,310 |
import numpy as np
import numpy.ma as ma
import projections.r2py.reval as reval
import projections.r2py.rparser as rparser
class SimpleExpr():
def __init__(self, name, expr):
self.name = name
self.tree = reval.make_inputs(rparser.parse(expr))
lokals = {}
exec(reval.to_py(self.tree, name), lokals)
... | ricardog/raster-project | projections/simpleexpr.py | Python | apache-2.0 | 956 |
import sys
from resources.datatables import Options
def setup(core, object):
object.setAttachment('radial_filename', 'object/conversation')
object.setAttachment('conversationFile', 'respec')
object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
object.setStfFilename('mob/creature_names')
object.set... | ProjectSWGCore/NGECore2 | scripts/object/mobile/respec_seller_f_1.py | Python | lgpl-3.0 | 352 |
"""
test file/image based on spoke base tests
"""
import pytest
from wheelcms_axle.tests.test_spoke import BaseSpokeTemplateTest, \
BaseSpokeTest
from wheelcms_spokes.file import FileType, File
from wheelcms_spokes.image import ImageType, Image
from django.core.files.u... | wheelcms/wheelcms_spokes | wheelcms_spokes/tests/test_file_image.py | Python | bsd-2-clause | 4,501 |
# Generated by Django 3.1.8 on 2021-06-01 16:29
import TWLight.resources.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("resources", "0073_stream_description_it"),
]
operations = [
migrations.AddField(
model_name="str... | WikipediaLibrary/TWLight | TWLight/resources/migrations/0074_auto_20210601_1629.py | Python | mit | 4,788 |
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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/LIC... | VTabolin/networking-vsphere | networking_vsphere/tests/unit/agent/test_ovsvapp_agent.py | Python | apache-2.0 | 103,582 |
import pkg_resources
def get_dir():
"""Return the location of resources for report"""
return pkg_resources.resource_filename('naarad.resources', None)
| kilink/naarad | src/naarad/resources/__init__.py | Python | apache-2.0 | 157 |
"""
Podi, a command-line interface for Kodi.
Copyright (C) 2015 Peter Frost <slimeypete@gmail.com>
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... | vroomfondle/podi | app/errors/__init__.py | Python | gpl-3.0 | 898 |
#!/usr/bin/env python
import os
import glob
import sys
import signal
import subprocess
# path = '/home/gnomex/HomeWorkMalwareAnalysis/Pcaps'
path = '/media/gnomex/zebras/kenner-pcaps'
src_path = '/home/gnomex/HomeWorkMalwareAnalysis/analysis/bad_pcaps'
new_path = '/home/gnomex/HomeWorkMalwareAnalysis/analysis/rlly_ba... | gnomex/analysis | ids-bots/move_images.py | Python | gpl-3.0 | 992 |
# 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/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_convert_to_and_from_dict.py | Python | mit | 2,735 |
from django.db import models
class BaseModel(models.Model):
add_date = models.DateTimeField(auto_now_add=True, db_index=True)
update_date = models.DateTimeField(auto_now=True)
class Meta(object):
abstract = True
ordering = ['-add_date']
class Doctor(BaseModel):
first_name = models.C... | rainum/registry | www/edoctor/models.py | Python | gpl-3.0 | 3,372 |
# -*- test-case-name: vumi.transports.vumi_bridge.tests.test_client -*-
import json
from twisted.internet.defer import Deferred
from twisted.internet import reactor
from twisted.web.client import Agent, ResponseDone, ResponseFailed
from twisted.web import http
from twisted.protocols import basic
from twisted.python.fa... | TouK/vumi | vumi/transports/vumi_bridge/client.py | Python | bsd-3-clause | 3,394 |
"""Adding census_year to state_congressional_table
Revision ID: 5456e2207d32
Revises: 17105e26eef4
Create Date: 2018-05-03 12:20:05.945295
"""
# revision identifiers, used by Alembic.
revision = '5456e2207d32'
down_revision = '17105e26eef4'
branch_labels = None
depends_on = None
from alembic import op
import sqlalc... | fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/5456e2207d32_adding_census_year_to_state_.py | Python | cc0-1.0 | 1,112 |
class Solution(object):
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
neg = False
if (x < 0):
neg = True
x *= -1
digits = []
number = 0
while (x != 0):
digits.append(x % 10)
x = x // 10
digits = digits[::-1]
for i in range(len(digits)):
number += digits[i] * pow(10, i)
... | njvelat/leetcode | reverse-integer.py | Python | gpl-3.0 | 545 |
#############################################################################
##
## Copyright (C) 2010 Riverbank Computing Limited.
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
##
## This file is part of the examples of PyQt.
##
## $QT_BEGIN_LICENSE:LGPL$
## Commercial Us... | martyngigg/pyqt-msvc | examples/demos/qtdemo/textbutton.py | Python | gpl-3.0 | 13,494 |
"""
Hello from easygui/__init__.py
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# __all__ must be defined in order for Sphinx to generate the API automatically.
from future import standard_library
standard_libr... | draperjames/qtpandas | qtpandas/ui/fallback/easygui/__init__.py | Python | mit | 1,847 |
"""empty message
Revision ID: e95429507f03
Revises: 82e227787c88
Create Date: 2017-10-08 04:00:04.899374
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e95429507f03'
down_revision = '82e227787c88'
branch_labels = None
depends_on = None
def upgrade():
# ... | coderadi/OAuth-server | migrations/versions/e95429507f03_.py | Python | mit | 1,195 |
#!/usr/bin/env python
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
setuptools.setup(
setup_requires=['pbr'],
pbr=True)
| alvarolopez/pyocci | setup.py | Python | apache-2.0 | 171 |
"""
Paste your code here
"""
| fabriziodemaria/LeetCode-Tree-Parser | LC-Parser/here.py | Python | bsd-3-clause | 29 |
# coding: utf-8
# In[13]:
import tkinter as tk
import sqlite3
import numpy as np
import pandas as pd
from pandas import HDFStore
#import pubchempy as pcp
#import json
#from urllib.request import urlopen
#import urllib
#from urllib.request import urlopen
#from bs4 import BeautifulSoup
#from rdkit import Chem
#fro... | bbqtaco/matinsy | mksdswebsite.py | Python | gpl-3.0 | 28,123 |
"""
The :mod:`sklearn.datasets` module includes utilities to load datasets,
including methods to load and fetch popular reference datasets. It also
features some artificial data generators.
"""
from .base import load_diabetes
from .base import load_digits
from .base import load_files
from .base import load_iris
from .... | chaluemwut/fbserver | venv/lib/python2.7/site-packages/sklearn/datasets/__init__.py | Python | apache-2.0 | 3,616 |
# -*- coding: utf-8 -*-
import os
import wx
from DynaUI import *
SF_000A4 = wx.SizerFlags().Border(wx.ALL, 4)
SF_110A4 = wx.SizerFlags().Expand().Border(wx.ALL, 4).Proportion(1)
SF_410A4 = wx.SizerFlags().Expand().Border(wx.ALL, 4).Proportion(4)
SF_010A4 = wx.SizerFlags().Expand().Border(wx.ALL, 4)
SF_001A4 = wx.Size... | yadizhou/DynaUI | DynaUI/demo/demo.py | Python | gpl-3.0 | 17,491 |
__version_info__ = (0, 2, 0, 'final', 0)
def get_version():
version = '%s.%s' % (__version_info__[0], __version_info__[1])
if __version_info__[2]:
version = '%s.%s' % (version, __version_info__[2])
if __version_info__[3] != 'final':
version = '%s%s' % (version, __version_info__[3])
... | zsiciarz/pyaavso | pyaavso/__init__.py | Python | mit | 456 |
from django.conf.urls import patterns, include, url
from pdp import views
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'enableIndia.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
... | pratheekms/cfg14 | enableIndia/urls.py | Python | mit | 961 |
"""initial migration
Revision ID: 310d770bc073
Revises:
Create Date: 2017-03-26 19:56:35.383426
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '310d770bc073'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.create_table('Enti... | qiubit/luminis | backend/alembic/versions/310d770bc073_initial_migration.py | Python | mit | 4,336 |
#!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
from geocoder.distance import Distance
from geocoder.location import Location
from geocoder.arcgis import ArcgisQuery
from geocoder.baidu import BaiduQuery
from geocoder.bing import BingQuery, BingQueryDetail
from geocoder.canadapost import Cana... | DenisCarriere/geocoder | geocoder/api.py | Python | mit | 20,334 |
from dockyard.var import GLOBAL
from dockyard.utils.mongo import Mongo
class Log(Mongo):
"""
_id
level
msg
origin
"""
LEVEL = "level"
MSG = "msg"
ORIGIN = "origin"
def _warn(self, msgs, origin):
self.__save(msgs, GLOBAL.LOG_WARN, origin)
def _fatal(self, msgs,... | galileo-project/Galileo-dockyard | server/dockyard/driver/log/_model/__init__.py | Python | mit | 985 |
#!/usr/bin/python
#####################################################################
# This script tests performance in frames per second.
# Change iters, resolution, window visibility, use get_ state or not.
# It should give you some idea how fast the framework can work on
# your hardware. The test involes copying... | gdb/doom-py | doom_py/examples/python/fps.py | Python | mit | 1,577 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | rakeshmi/cinder | cinder/volume/manager.py | Python | apache-2.0 | 114,688 |
import xml.etree.cElementTree
from os import environ, unlink, symlink, path
from Tools.Directories import SCOPE_SKIN, resolveFilename
import time
from Tools.StbHardware import setRTCoffset
class Timezones:
def __init__(self):
self.timezones = []
self.readTimezonesFromFile()
def readTimezonesFromFile(self):
t... | OpenSPA/dvbapp | lib/python/Components/Timezones.py | Python | gpl-2.0 | 1,411 |
__author__ = 'nmaurer'
import os.path
current_dir = os.path.dirname(os.path.abspath(__file__))
import cherrypy
| ybonjour/nuus | web/__init__.py | Python | mit | 113 |
from ..base import Event
class OpenTabEvent(Event):
def __init__(self, tab):
self.__tab = tab
@property
def tab(self):
return self.__tab
| umlfri/umlfri2 | umlfri2/application/events/tabs/open.py | Python | gpl-3.0 | 172 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Interproscan(Package):
"""InterProScan is the software package that allows sequences
... | rspavel/spack | var/spack/repos/builtin/packages/interproscan/package.py | Python | lgpl-2.1 | 2,898 |
#----------------------------------------------------------------------
# Copyright (c) 2011-2015 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... | ahelsing/geni-ch | plugins/pgch/__init__.py | Python | mit | 1,217 |
################################
# These variables are overwritten by Zenoss when the ZenPack is exported
# or saved. Do not modify them directly here.
# NB: PACKAGES is deprecated
NAME = "ZenPacks.Nova.Windows.SNMPPerfMonitorSimple"
VERSION = "1.6"
AUTHOR = "Ryan Matte"
LICENSE = ""
NAMESPACE_PACKAGES = ['ZenPacks', ... | anksp21/Community-Zenpacks | ZenPacks.Nova.Windows.SNMPPerfMonitorSimple/setup.py | Python | gpl-2.0 | 2,765 |
# code for extracting the feature matrix of second last or any layer on a pretrained deep neural network on keras
#For installation follow 2 websites :
# 1. http://www.pyimagesearch.com/2016/08/10/imagenet-classification-with-python-and-keras/
# 2. https://github.com/fchollet/deep-learning-models (code comes from her... | LinFelix/FlatHack | deep-learning-models/img_classify.py | Python | lgpl-3.0 | 1,481 |
"""
OVERALL CREDIT TO:
t0mm0, Eldorado, VOINAGE, BSTRDMKR, tknorris, smokdpi, TheHighway
urlresolver XBMC Addon
Copyright (C) 2011 t0mm0
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 So... | koditr/xbmc-tr-team-turkish-addons | script.module.urlresolver/lib/urlresolver/plugins/nxload.py | Python | gpl-2.0 | 1,879 |
# ------------------------------------- #
# Python Package Importing #
# ------------------------------------- #
# Importing Necessary System Packages
import sys, os, math
import numpy as np
import time as tp
from optparse import OptionParser
import glob
# Importing cPickle/Pickle
try:
import pickle a... | JPGlaser/Tycho | cut_encounters.py | Python | mit | 10,626 |
# -*- coding: utf-8 -*-
import KBEngine
from KBEDebug import *
import dialogmgr
class Dialog:
def __init__(self):
pass
def dialog(self, srcEntityID, targetID, dialogID):
"""
exposed.
对一个目标entity施放一个技能
"""
if srcEntityID != self.id:
return
if not KBEngine.entities.has_key(targe... | LaoZhongGu/kbengine | demo/res/scripts/cell/interfaces/Dialog.py | Python | lgpl-3.0 | 537 |
import os
import threading
import txaio
txaio.use_twisted()
from txaio import make_logger
from twisted.internet.defer import inlineCallbacks
from autobahn.twisted.util import sleep
from autobahn.wamp.types import PublishOptions
from autobahn.twisted.wamp import ApplicationSession
class MyPublisher(ApplicationSessi... | crossbario/crossbar-examples | containers/max_message_size/publisher.py | Python | apache-2.0 | 1,986 |
# Copyright (c) 2013 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 writi... | 0xf2/stackalytics | stackalytics/processor/mls.py | Python | apache-2.0 | 4,490 |
# Add new column with constant value to first resource
# Column name and value are taken from the processor's parameters
from datapackage_pipelines.wrapper import process
def modify_datapackage(datapackage, parameters, _):
datapackage['resources'][0]['schema']['fields'].append({
'name': parameters['column-n... | frictionlessdata/datapackage-pipelines | samples/add_constant.py | Python | mit | 629 |
from django.db import models
from django.contrib.auth.models import Group
class Category(models.Model):
title = models.CharField(max_length=200)
def __unicode__(self):
return self.title
class Entry(models.Model):
category = models.ForeignKey(Category)
groups = models.ManyToManyField(Group... | UTAlan/ginniBeam.net | gin/writings/models.py | Python | gpl-2.0 | 632 |
# Copyright (c) 2019 PaddlePaddle 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 app... | tensor-tang/Paddle | python/paddle/fluid/contrib/tests/test_distributed_reader.py | Python | apache-2.0 | 1,305 |
from __future__ import unicode_literals
import json
import requests
from rest_framework import viewsets, permissions, views
from django.contrib.auth.models import User
from rest_framework.authentication import TokenAuthentication, BasicAuthentication
from rest_framework.authtoken.views import ObtainAuthToken
from res... | mr-someone/mozo-rest-django | mozorest/views.py | Python | mit | 7,433 |
#######################################################################
# Implements a topological sort algorithm.
#
# Copyright 2014 True Blade 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... | wangmiao1981/spark | dev/sparktestsupport/toposort.py | Python | apache-2.0 | 3,002 |
import importlib
import logging
import sys
import unittest
from os.path import sep, abspath
from queue import Queue
from tempfile import mkdtemp
from threading import Thread
import pytest
from errbot.rendering import text
from errbot.backends.base import Message, Room, Person, RoomOccupant, ONLINE
from errbot.core_pl... | Synforge/err | errbot/backends/test.py | Python | gpl-3.0 | 18,173 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | ganeshgore/myremolab | server/src/voodoo/gen/generators/Args.py | Python | bsd-2-clause | 520 |
"""
Various linear algebra utilities.
Notes on the fast Hadamard transform (Alistair Reid, NICTA 2015):
The Hadamard transform is a recursive application of sums and differences
on a vector of length 2^n. The log(n) recursive application allow computation
in n log(n) operations instead of the naive n^2 per vector tha... | NICTA/revrand | revrand/mathfun/linalg.py | Python | apache-2.0 | 6,602 |
import os
import entity2vec.node2vec as node2vec
from os import path
import networkx as nx
def main(config):
what = config.feature
if what is None:
raise RuntimeError('You must specify the feature using -f or --feature')
print('loading edgelists...')
G = nx.read_edgelist(path.join(config.edg... | DOREMUS-ANR/recommender | recsystem/embedder/embed.py | Python | mit | 1,797 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.