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 struct
import sys
import os
from os import listdir
from os.path import isfile, join
import numpy as np
from ReadArrays import ImportFile
from PercentImbalanced import PercentImbalance
from BuildBestCase import BestCaseRebalancing
from TrueCostModel import TrueCostModel
from NormalizePhases import NormalizeInput
... | bwelton/cmpiprof | analysis_tools/python_analysis/RunAnalysis.py | Python | lgpl-2.1 | 1,376 |
__author__ = 'jnelson'
from thriftapi.shared.ttypes import Type
from thriftapi.data.ttypes import TObject
from types import *
import struct
import parsedatetime
from time import mktime
cal = parsedatetime.Calendar()
def python_to_thrift(value):
"""
Serialize a value to its thrift representation.
:param v... | mAzurkovic/concourse | concourse-driver-python/concourse/utils.py | Python | apache-2.0 | 2,762 |
#!/usr/bin/env python
import os
import django
from django.conf import settings, global_settings
import oscar
def configure():
if not settings.configured:
from oscar.defaults import OSCAR_SETTINGS
# Helper function to extract absolute path
location = lambda x: os.path.join(
os... | marcoantoniooliveira/labweb | tests/config.py | Python | bsd-3-clause | 5,326 |
#!/usr/bin/env python
# encoding: utf-8
# Copyright (c) 2012-2016 Seafile Ltd.
import hashlib
import random
import sys
import time
# Use the system PRNG if possible
try:
random = random.SystemRandom()
using_sysrandom = True
except NotImplementedError:
import warnings
warnings.warn('A secure pseudo-ran... | miurahr/seahub | tools/secret_key_generator.py | Python | apache-2.0 | 1,824 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import argparse
import collections
import datetime
import io
import json
import xlsxwriter
import pytz
headers = [
'Instanz',
'Name Vorschlag',
'Benutzername',
'Statusgruppe',
'Badges',
'Datum',
'Uhr... | hhucn/adhocracy-analysis | misc/dennis_content.py | Python | mit | 4,635 |
__author__ = "Joseph Mullen"
| JMMull/personalWebsite | personalWeb/views/__init__.py | Python | mit | 29 |
# 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 ag... | Sorsly/subtle | google-cloud-sdk/lib/googlecloudsdk/api_lib/compute/transforms.py | Python | mit | 8,082 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: https://sickrage.tv
# Git: https://github.com/SiCKRAGETV/SickRage.git
#
# This file is part of SickRage.
#
# SickRage 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... | SerialShadow/SickRage | sickbeard/db.py | Python | gpl-3.0 | 15,583 |
#!/usr/bin/env python
from kapteyn import wcsgrat, maputils, ellinteract
from matplotlib import pylab as plt
# Get connected to Matplotlib
fig = plt.figure()
movieimages = maputils.MovieContainer()
# Create a maputils FITS object from a FITS file on disk
fitsobject = maputils.FITSimage('rense.fits')
#ch = [10,15,... | kapteyn-astro/kapteyn | doc/source/EXAMPLES/mu_shapes.py | Python | bsd-3-clause | 930 |
"""Add Beer table
Revision ID: d898035a1ff4
Revises:
Create Date: 2017-04-28 20:44:18.299569
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'd898035a1ff4'
down_revision = None
branch_labels = None
depends_on = None
... | paultiplady/apistar-playground | database/versions/d898035a1ff4_add_beer_table.py | Python | mit | 757 |
import jwt
import uuid
import warnings
from calendar import timegm
from datetime import datetime
from rest_framework_jwt.compat import get_username, get_username_field
from rest_framework_jwt.settings import api_settings
def jwt_payload_handler(user):
username_field = get_username_field()
username = get_user... | plentific/django-rest-framework-jwt | rest_framework_jwt/utils.py | Python | mit | 2,913 |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the co... | qtproject/qt-creator | share/qtcreator/debugger/personaltypes.py | Python | gpl-3.0 | 2,513 |
import copy
import json
import platform
import random
import sys
from datetime import datetime, timedelta
import numpy as np
import pytest
import ray
from ray.tests.conftest import (
file_system_object_spilling_config,
buffer_object_spilling_config,
mock_distributed_fs_object_spilling_config,
)
from ray.ex... | ray-project/ray | python/ray/tests/test_object_spilling.py | Python | apache-2.0 | 15,383 |
# Generated by Django 3.0.7 on 2020-06-22 11:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("document", "0022_auto_20200117_2101"),
]
operations = [
migrations.AddField(
model_name="document",
name="outline",
... | fin/froide | froide/document/migrations/0023_auto_20200622_1312.py | Python | mit | 553 |
from django.utils.html import escape
from django.utils.translation import ugettext
import jingo
import jinja2
from . import forms
@jingo.register.function
def SimpleSearchForm(request, search_cat):
data = request.GET
if search_cat and 'cat' not in request.GET:
data = dict(request.GET, cat=search_cat... | harikishen/addons-server | src/olympia/search/helpers.py | Python | bsd-3-clause | 946 |
# schema.py
# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
"""Compatibility namespace for sqlalchemy.sql.schema and related.
"""
from .sql.base im... | zzzeek/sqlalchemy | lib/sqlalchemy/schema.py | Python | mit | 2,413 |
from libs import log
from libs import db
from unidecode import unidecode
def make_searchable_string(s):
if not isinstance(s, str):
s = str(s)
s = unidecode(s).lower()
return "".join(e for e in s if (e.isalnum() or e == " "))
class MetadataInsertionError(Exception):
def __init__(self, value):... | rmcauley/rainwave | rainwave/playlist_objects/metadata.py | Python | gpl-2.0 | 6,550 |
import numpy as np
import cv2
import glob
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import collections
from LaneLine import Line
# For Displaying/Viewing/Editing video on Ipython console
from moviepy.editor import VideoFileClip
from IPython.display import HTML
import pickle
# Step1. Camera Cali... | abhitrip/CarNd-Advanced-Lane-Finding | lane_pipeline_inter.py | Python | mit | 23,132 |
from test_support import *
prove_all(steps=20000, procs=0, opt=["--proof=progressive"])
| ptroja/spark2014 | testsuite/gnatprove/tests/O512-022__vscomp2014_partition_rte/test.py | Python | gpl-3.0 | 89 |
# Copyright (C) 2016 Swift Navigation Inc.
# Contact: Valeri Atamaniouk <valeri@swiftnav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF A... | swift-nav/peregrine | peregrine/iqgen/bits/encoder_glo.py | Python | gpl-3.0 | 3,464 |
"""
Support tool for disabling user accounts.
"""
from django.contrib.auth import get_user_model
from django.db.models import Q
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext as _
from django.views.generic import View
from rest_framew... | cpennington/edx-platform | lms/djangoapps/support/views/manage_user.py | Python | agpl-3.0 | 2,968 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-06-24 21:06
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import imagekit.models.fields
class Migration(migrations.Migration):
dependencies = [
('blog', '0015_auto_20170624_22... | PoprostuRonin/pr0gramista | blog/migrations/0016_auto_20170624_2306.py | Python | gpl-3.0 | 1,167 |
# -*- coding: utf8 -*-
__author__ = 'Viktor Winkelmann'
import sys
sys.path.append('../..')
from core.Plugins.DataRecognizer import *
def getClassReference():
return ELFFile
class ELFFile(DataRecognizer):
signatures = [(b'\x7F\x45\x4C\x46', None)]
fileEnding = ""
dataType = "ELF file"
dataCate... | vikwin/pcapfex | plugins/data_recognizers/elf.py | Python | apache-2.0 | 351 |
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and ... | waynechu/PythonProject | dns/tsig.py | Python | mit | 7,813 |
"""Simple test for the ImageDataProbe filter.
"""
# Author: Prabhu Ramachandran <prabhu [at] aero . iitb . ac . in>
# Copyright (c) 2008, Enthought, Inc.
# License: BSD Style.
# Standard library imports.
from os.path import abspath
from io import BytesIO
import copy
# Local imports.
from common import TestCase, get_... | dmsurti/mayavi | integrationtests/mayavi/test_image_data_probe.py | Python | bsd-3-clause | 4,112 |
"""
Part of the astor library for Python AST manipulation
License: 3-clause BSD
Copyright (c) 2014 Berker Peksag
Copyright (c) 2015, 2017 Patrick Maupin
Use this by putting a link to astunparse's common.py test file.
"""
try:
import unittest2 as unittest
except ImportError:
import unittest
try:
from t... | berkerpeksag/astor | tests/test_optional.py | Python | bsd-3-clause | 947 |
from typing import Any, Type
from mypy_extensions import NoReturn
from .errors import InvariantViolation
def isinst(obj: Any, ttype: Type, _msg: str=None) -> None:
if not isinstance(obj, ttype):
raise InvariantViolation(
'incorrect type! expected {0} got {1}'.format(repr(ttype), repr(obj))
... | schrockn/graphscale | graphscale/check.py | Python | mit | 508 |
#!/usr/bin/python
# This file generated by a program. do not edit.
import pycopia.XML.POM
attribDirection_50741361576644121884686865416273322500 = pycopia.XML.POM.XMLAttribute(u'direction', pycopia.XML.POM.Enumeration((u'ltr', u'rtl', u'inherit')), 12, None)
attribOnend_2245217001552764273737467841846343401 = pyc... | kdart/pycopia | XML/pycopia/dtds/svg11_flat_20030114.py | Python | apache-2.0 | 592,173 |
"""This module implements the Scraper component which parses responses and
extracts information from them"""
from collections import deque
from twisted.python.failure import Failure
from twisted.internet import defer
from scrapy.utils.defer import defer_result, defer_succeed, parallel, iter_errback
from scrapy.utils... | emschorsch/scrapy | scrapy/core/scraper.py | Python | bsd-3-clause | 8,984 |
#
# Copyright (c) 2002, 2003, 2004 Art Haas
#
# This file is part of PythonCAD.
#
# PythonCAD 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 v... | chiamingyen/PythonCAD_py3 | Generic/Kernel/GeoUtil/util.py | Python | gpl-2.0 | 10,081 |
"""Various high level TF models."""
# Copyright 2015-present The Scikit Flow 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/lice... | awni/tensorflow | tensorflow/contrib/skflow/python/skflow/models.py | Python | apache-2.0 | 11,426 |
#!/usr/bin/env python
"""
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER... | device42/RackMonkey-to-Device42-Migration | migrate.py | Python | mit | 10,032 |
"""Map file definitions for postfix."""
class DomainsMap(object):
"""Map to list all domains."""
filename = "sql-domains.cf"
mysql = (
"SELECT name FROM admin_domain "
"WHERE name='%s' AND type='domain' AND enabled=1"
)
postgres = (
"SELECT name FROM admin_domain "
... | modoboa/modoboa | modoboa/admin/postfix_maps.py | Python | isc | 7,054 |
# Copyright 2013-2021 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)
import os
import re
from spack import *
class R(AutotoolsPackage):
"""R is 'GNU S', a freely available language and... | LLNL/spack | var/spack/repos/builtin/packages/r/package.py | Python | lgpl-2.1 | 11,454 |
# -*- coding: utf-8 -*-
"""
@author: kevinhikali
@email: hmingwei@gmail.com
"""
import tensorflow as tf
hello = tf.constant("Hello")
sess = tf.Session()
print(sess.run(hello))
| kevinhikali/ml_kevin | tf/tf_hello.py | Python | gpl-3.0 | 180 |
#!/usr/bin/python
from datasource import DataBuffer
class DataBufferTest(object):
def __init__(self, path):
self.path = path
def run(self):
with open(self.path, 'rb') as f:
self.data_buffer = DataBuffer(f)
actual = self.data_buffer.readint32()
value = 0xA5... | amarghosh/mp4viewer | src/tests/datasource_test.py | Python | mit | 1,575 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Serveur de jeu temps réel Pooo
"""
import socketserver
import socket
import threading
import logging
import re
import argparse
logging.basicConfig(level=logging.DEBUG)
parser = argparse.ArgumentParser(description='Pooo game server', epilog='Example: $pytho... | Valars/Ragnar | code/poooserver.py | Python | gpl-3.0 | 3,826 |
from .log_month import LogMonth
from ..files import DateFiles
from kao_list import KaoList
class LogYear:
""" Represents a specific Log Year directory """
def __init__(self, date):
""" Initialize with the date to wrap """
self.date = date
@property
def previo... | cloew/DevLog | devlog/dates/log_year.py | Python | mit | 1,207 |
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A binary manager the prioritizes local versions first.
This is a wrapper around telemetry.internal.util.binary_manager which first
checks for local versi... | catapult-project/catapult | telemetry/telemetry/internal/util/local_first_binary_manager.py | Python | bsd-3-clause | 7,151 |
import random
# shuffled_deck: will return a shuffled deck to the user
# input:
# output: a list representing a shuffled deck
def shuffled_deck():
basic_deck = range(2, 15) * 4
random.shuffle(basic_deck)
return basic_deck
# player_turn: takes in a player name, player_name, and draws/removes a card from ... | bensk/CS9 | _site/Code Examples/War.py | Python | mit | 2,007 |
# finds the all 1-9 pandigital multiplier, multiplicand, and product sets
# Project Euler problem 32
def main():
l = []
grandTotal = 0
a = 1
b = 1
while a < 1000000000:
while 1:
c = a*b
string = str(a)+str(b)+str(c)
string = ''.join(sorted(string))
... | kujenga/euler | Euler_32/PandigitalProducts.py | Python | gpl-3.0 | 1,098 |
# Adapted from:
# Name: Flask-Bcrypt
# Version: 0.3.2
# Summary: Bcrypt support for hashing passwords
# Home-page: https://github.com/maxcountryman/flask-bcrypt
# Author: Max Countryman
# Author-email: maxc@me.com
# License: BSD
import bcrypt
from website import settings
def generate_password_hash(passw... | doublebits/osf.io | framework/bcrypt/__init__.py | Python | apache-2.0 | 1,564 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | cmouse/buildbot | master/buildbot/steps/source/svn.py | Python | gpl-2.0 | 17,366 |
################################################################################
#
# This program is part of the deviceAdvDetail Zenpack for Zenoss.
# Copyright (C) 2008, 2009, 2010, 2011 Egor Puzanov.
#
# This program can be used under the GNU General Public License version 2
# You can find full information here: http... | epuzanov/ZenPacks.community.deviceAdvDetail | ZenPacks/community/deviceAdvDetail/info.py | Python | gpl-2.0 | 4,719 |
import os
from setuptools import setup, find_packages
setup(
name='keepassx',
version='0.1.0',
description="Python API and CLI for KeePassX",
long_description=open(os.path.join(os.path.dirname(__file__),
'README.rst')).read(),
author='James Saryerwinnie',
... | bapowell/python-keepassx | setup.py | Python | gpl-2.0 | 1,005 |
# -*- test-case-name: twisted.trial.test.test_runner -*-
# Copyright (c) 2005 Twisted Matrix Laboratories.
# See LICENSE for details.
#
# Author: Robert Collins <robertc@robertcollins.net>
import os
from zope.interface import implements
from twisted.trial.itrial import IReporter
from twisted.trial import unittest, r... | UstadMobile/eXePUB | twisted/trial/test/test_runner.py | Python | gpl-2.0 | 7,727 |
# --------------------------------------------------------------------------------- #
# ULTIMATELISTCTRL wxPython IMPLEMENTATION
# Inspired by and heavily based on the wxWidgets C++ generic version of wxListCtrl.
#
# Andrea Gavana, @ 08 May 2009
# Latest Revision: 27 Dec 2012, 21.00 GMT
#
#
# TODO List
#
# 1) Subitem ... | unreal666/outwiker | src/outwiker/gui/controls/ultimatelistctrl.py | Python | gpl-3.0 | 456,589 |
# -*- coding: utf-8 -*-
# Open Source Initiative OSI - The MIT License (MIT):Licensing
#
# The MIT License (MIT)
# Copyright (c) 2012 DotCloud Inc (opensource@dotcloud.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Softwa... | siegesmund/zerorpc-python | zerorpc/gevent_zmq.py | Python | mit | 8,249 |
# -*- coding: utf-8 -*-
from decimal import Decimal
from trytond.model import ModelView, fields, Workflow
from trytond.pool import PoolMeta, Pool
from trytond.transaction import Transaction
from trytond.pyson import Eval, Bool, And, Not, Or, If
from trytond.wizard import Wizard, StateView, StateTransition, Button
fro... | prakashpp/trytond-sale-payment-gateway | sale.py | Python | bsd-3-clause | 26,865 |
def main(tick, config, q):
return # Drafted, TODO
pc = {
'id': 1,
'coords': [0, 0, 0]
}
ship = {
'coords': [0, 0, 0],
'type': 'freight' or 'settler' or 'corvette' or 'frigate', # Corvette small tank, Frigate big tank, guns similar
'storage': {
'go... | Akuukis/MMO_sim | ships.py | Python | gpl-3.0 | 599 |
#!/usr/bin/python
"""sc_initkey.py: utility script forS-CRIB Scramble device to format initialisation key
it requires input string of 40 hex characters - project sCribManager - Python."""
'''
@author: Dan Cvrcek
@copyright: Copyright 2013-14, Smart Crib Ltd
@credits: Dan Cvrcek
@license: GPL version 3 (e.g., https:/... | smartcrib/password-scrambler-ws | ScramblerTools/sc_initkey.py | Python | gpl-3.0 | 1,190 |
#!/usr/bin/env python
import os
import sys
def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "waldur_core.server.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
if __name__ == "__main__":
main()
| opennode/nodeconductor | manage.py | Python | mit | 285 |
import subprocess
import time
for obstacles in [5, 10, 15, 20]:
scores = []
for i in range(30):
procs = []
for j in range(4):
time.sleep(0.1) # allow for different random number generation
procs.append(subprocess.Popen(['build/main', '-w', '15' , '-l', '180', '-o', str(obstacles), '--fmt'], stdout=subpro... | brychanrobot/orrt-star-cpp | scripts/trials.py | Python | mit | 609 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Campaign.qualification_instructions'
db.add_column('opportunities_campaign', 'qualificatio... | praekelt/ummeli | ummeli/opportunities/migrations/0008_auto__add_field_campaign_qualification_instructions.py | Python | bsd-3-clause | 26,212 |
import numpy as np
import scipy.sparse as ss
from sparray import FlatSparray
class Construction2D(object):
def setup(self):
num_rows, num_cols = 3000, 4000
self.spm = ss.rand(num_rows, num_cols, density=0.1, format='coo')
self.arr = self.spm.A
self.data = self.spm.data
self.indices = self.spm.r... | perimosocordiae/sparray | bench/benchmarks/construction.py | Python | mit | 1,438 |
# Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com)
#
# MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without lim... | gangadhar-kadam/mtn-wnframework | core/doctype/search_criteria/search_criteria.py | Python | mit | 3,836 |
# Copyright 2016, Google Inc.
# 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 conditions and the f... | ppietrasa/grpc | src/python/grpcio_tests/tests/unit/_auth_test.py | Python | bsd-3-clause | 3,311 |
# Copyright (C) 2012-2013 Roman Zimbelmann <hut@lepus.uberspace.de>
# This software is distributed under the terms of the GNU GPL version 3.
import os
import subprocess
def Popen_forked(*args, **kwargs):
"""Forks process and runs Popen with the given args and kwargs.
Returns True if forking succeeded, other... | mullikine/ranger | ranger/ext/popen_forked.py | Python | gpl-3.0 | 673 |
# 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... | ArchiFleKs/magnum | magnum/conductor/handlers/federation_conductor.py | Python | apache-2.0 | 1,155 |
"""Tasks to help Robot Framework packaging and other development.
Executed by Invoke <http://pyinvoke.org>. Install it with `pip install invoke`
and run `invoke --help` and `invode --list` for details how to execute tasks.
See BUILD.rst for packaging and releasing instructions.
"""
from __future__ import print_functi... | userzimmermann/robotframework | tasks.py | Python | apache-2.0 | 15,347 |
from ctypes import *
from pyxtrlock.utils import check_and_load_library
class XCBError(Exception):
"""
Raised on XCBErrors
"""
class Connection(Structure):
pass
class Setup(Structure):
pass
Window = c_uint32
Colormap = c_uint32
VisualID = c_uint32
class Screen(Structure):
_fields_ = [
... | boyska/gone | pyxtrlock/xcb.py | Python | gpl-3.0 | 13,775 |
import base64
import unittest
from xml.etree import ElementTree as ET
from devicecloud.file_system_service import FileInfo, DirectoryInfo, FileSystemServiceException, \
_parse_command_response, ResponseParseError, \
ErrorInfo, LsInfo, _parse_error_tree, LsCommand, GetCommand, PutCommand, DeleteCommand, \
F... | brucetsao/python-devicecloud | devicecloud/test/unit/test_file_system_service.py | Python | mpl-2.0 | 37,278 |
# Copyright (C) 2006 Collabora Ltd. <http://www.collabora.co.uk/>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use, copy... | maria-msu-seclab/mpotrDevelopment | libraries/dbus-python-1.2.0/test/cross-test-server.py | Python | gpl-2.0 | 12,271 |
'''
Created on Jan 30, 2011
@author: mkiyer
chimerascan: chimeric transcript discovery using RNA-seq
Copyright (C) 2011 Matthew Iyer
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 ... | tectronics/chimerascan | chimerascan/deprecated/nominate_spanning_reads_v04.py | Python | gpl-3.0 | 12,171 |
from __future__ import division, absolute_import
from __future__ import print_function
import functools
import itertools
import logging
import functools
import os
import sys
import click
import idb
from idb.helpers.logging import configure_app_log, idblogger
clilog = idblogger.getChild('cli')
def get_std_options(... | iDigBio/idb-backend | idb/clibase.py | Python | gpl-3.0 | 4,608 |
#!/usr/bin/env python3
# Generate ./api/versioning/BUILD based on packages with files containing
# "package_version_status = ACTIVE."
import os
import string
import subprocess
import sys
BUILD_FILE_TEMPLATE = string.Template(
"""# DO NOT EDIT. This file is generated by tools/proto_format/active_protos_gen.py.
l... | lizan/envoy | tools/proto_format/active_protos_gen.py | Python | apache-2.0 | 1,880 |
from flask import render_template
from ..query import parse as parse_query
from .. import name
def format_query_result(query):
return {
'uri': format_posts,
'query': format_posts,
}[parse_query(query.text).method](query)
def format_posts(query):
return render_template('ehentai/result/pos... | Answeror/torabot | torabot/mods/ehentai/views/web.py | Python | mit | 758 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Authors: Acsone SA/NV
# Copyright (c) 2013 Acsone SA/NV (http://www.acsone.eu)
# All Rights Reserved
#
# WARNING: This program as such is intended to be used by professional
# programmers who take t... | acsone/acsone-addons | account_auto_installer/account_installer.py | Python | agpl-3.0 | 2,481 |
import pytest
import torch
from allennlp.modules import Attention
from allennlp.modules.attention import BilinearAttention, AdditiveAttention, LinearAttention
@pytest.mark.parametrize("attention_type", Attention.list_available())
def test_all_attention_works_the_same(attention_type: str):
module_cls = Attention.... | allenai/allennlp | tests/modules/attention/attention_test.py | Python | apache-2.0 | 709 |
from .event_hub import EventHub
from ..libs.view_helpers import *
from ..libs.logger import log
from ..libs import cli
class QuickInfoToolTipEventListener:
def on_hover(self, view, point, hover_zone):
view.run_command('typescript_quick_info_doc', {"hover_point": point})
listen = QuickInfoToolTipEventListe... | nimzco/Environment | Sublime/Packages/TypeScript/typescript/listeners/quick_info_tool_tip.py | Python | mit | 374 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of Ansible
#
# Ansible 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
#... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/cloud/ovirt/ovirt_external_provider.py | Python | bsd-3-clause | 10,078 |
class PrefixLengthError(Exception):
pass
class PrefixKeyError(Exception):
pass
class Prefix:
"""A class to generate an identifier prefix.
"""
template = '{protocol_number}{requisition_identifier}'
length = 10
def __init__(self, template=None, length=None, **template_opts):
sel... | botswana-harvard/edc-lab | edc_lab/identifiers/prefix.py | Python | gpl-2.0 | 1,088 |
#!/usr/bin/python
#
# wakeuptime Summarize sleep to wakeup time by waker kernel stack
# For Linux, uses BCC, eBPF.
#
# USAGE: wakeuptime [-h] [-u] [-p PID] [-v] [-f] [duration]
#
# Copyright 2016 Netflix, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
#
# 14-Jan-2016 Brendan Greg... | mcaleavya/bcc | tools/wakeuptime.py | Python | apache-2.0 | 6,897 |
#!/usr/bin/python3
#import nltk
#import pattern.en
from nltk import word_tokenize
from nltk import pos_tag
from nltk.corpus import wordnet
#import nltk.fuf.linearizer
from nltk.stem.wordnet import WordNetLemmatizer as wnl
from re import sub
import string
import random
from .genderPredictor import genderPredictor
#nlt... | theopak/storytellingbot | Extrapolate/Extrapolate.py | Python | mit | 7,576 |
# Michael Greenberg
# suite_quality.py
from scripts.learning import *
from scripts.predictions import *
from classes.lines import *
def test_suite():
years = range(2009,2014)
clf = model_from_years(years)
lines = Lines()
lines.lines_from_dataset('2014_nfl_lines.csv')
season = Season(2014)
season.record_perf... | MIGreenberg/NFLPredict | scripts/suite_quality.py | Python | mit | 2,173 |
"""
Settings for OpenStack deployments.
"""
# We import the aws settings because that's currently where the base settings are stored for all deployments.
# TODO - fix this when aws.py is split/renamed.
from .aws import * # pylint: disable=wildcard-import, unused-wildcard-import
SWIFT_AUTH_URL = AUTH_TOKENS.get('SWIF... | ahmedaljazzar/edx-platform | lms/envs/openstack.py | Python | agpl-3.0 | 1,599 |
# The Server code for Serin
# Start at a terminal and point other nodes (serin.py) to this
import socket
import lib
# Opening Socket
#--------------------------
HOST = ''
PORT = 4444
lib.printSerin()
serv = lib.createListenerHere(HOST, PORT)
serv.listen(10)
print 'Socket Listening'
#--------------------------
# The... | lepisma/Serin | server.py | Python | bsd-3-clause | 1,315 |
import pytest
import os, shutil
import numpy as np
from create_testing_data import (create_test_data,
tds1, tds1_scale33, tds1_scale60,
tds2, tds2_scale33, tds2_scale60,
SCALE60_LPC_1_TO_BS, SCALE60_LPC_2_TO_BS,
SCALE60_RPC_1_TO_BS, SCALE60_RPC_2_TO_BS,
SCALE33_LPC_TO_BS, SCALE3... | mattcieslak/DSI2 | tests/test_dsi2_input.py | Python | gpl-3.0 | 9,490 |
# 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... | Khushbu27/Tutorial | test/unit/common/test_internal_client.py | Python | apache-2.0 | 50,429 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | eric-haibin-lin/mxnet | tests/python/unittest/test_autograd.py | Python | apache-2.0 | 14,284 |
import gtk
from emmalib import dialogs
class DeleteRecord(gtk.ToolButton):
def __init__(self, query, emma):
"""
@param query: QueryTab
@param emma: Emma
"""
super(DeleteRecord, self).__init__()
self.emma = emma
self.query = query
self.set_label('De... | fastflo/emma | emmalib/widgets/querytab/resulttoolbar/DeleteRecord.py | Python | gpl-2.0 | 1,860 |
# sql/expression.py
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Defines the public namespace for SQL expression constructs.
Prior to version 0... | pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/sqlalchemy/sql/expression.py | Python | mit | 6,301 |
# -*- coding: utf-8 -*-
# EDIT
from datetime import date
import json
from datetime import date
from bs4 import BeautifulSoup
import requests
import turbotlib
# present registered banks
# source_url = "http://www.rbnz.govt.nz/regulation_and_supervision/banks/register/"
# list of past and present registered banks
so... | george-taylor/mission_788 | scraper.py | Python | mit | 1,390 |
import json
import mock
from django.test import TestCase, RequestFactory
from ..backends import get_oauthlib_core
from ..oauth2_backends import OAuthLibCore, JSONOAuthLibCore
class TestOAuthLibCoreBackend(TestCase):
def setUp(self):
self.factory = RequestFactory()
self.oauthlib_core = OAuthLibC... | DeskConnect/django-oauth-toolkit | oauth2_provider/tests/test_oauth2_backends.py | Python | bsd-2-clause | 3,755 |
"""Tests for proselint."""
| amperser/proselint | tests/__init__.py | Python | bsd-3-clause | 27 |
#!/usr/bin/env python
# coding: utf8
'''
@author: qitan
@contact: qqing_lai@hotmail.com
@file: forms.py
@time: 2017/3/30 16:05
@desc:
'''
from django import forms
from .models import *
ALLOW_CHOICE = (
(True, u'启用'),
(False, u'禁用')
)
class CommandForm(forms.ModelForm):
class Meta:
model = UserCom... | qitan/SOMS | userperm/forms.py | Python | gpl-3.0 | 1,098 |
""" openconfig_terminal_device
This module describes a terminal optics device model for
managing the terminal systems (client and line side) in a
DWDM transport network.
Elements of the model\:
physical port\: corresponds to a physical, pluggable client
port on the terminal device. Examples includes 10G, 40G, 100G
... | 111pontes/ydk-py | openconfig/ydk/models/openconfig/openconfig_terminal_device.py | Python | apache-2.0 | 96,720 |
"""This module has configurations for flask app."""
import os
import sys
import logging
from logging import handlers
from flask import Flask
from flask_cors import CORS
from .utils.encode import MyFlaskJSONEncoder
app = Flask(__name__)
HOSTNAME = '0.0.0.0'
PORT = 8081
REDIS_HOST = 'database'
REDIS_PORT = 6379
OIDC_M... | webzeppelin/wz-docker-starter-lib | public-server/public-server-python3/flask_app/config.py | Python | mit | 3,856 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "visual_cloud.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| LordShion/visual-cloud | visual_cloud/manage.py | Python | apache-2.0 | 255 |
__author__ = 'rolandh'
EDUPERSON_OID = "urn:oid:1.3.6.1.4.1.5923.1.1.1."
X500ATTR_OID = "urn:oid:2.5.4."
NOREDUPERSON_OID = "urn:oid:1.3.6.1.4.1.2428.90.1."
NETSCAPE_LDAP = "urn:oid:2.16.840.1.113730.3.1."
UCL_DIR_PILOT = 'urn:oid:0.9.2342.19200300.100.1.'
PKCS_9 = "urn:oid:1.2.840.113549.1.9.1."
UMICH = "urn:oid:1.3.... | rohe/saml2test | tests/attributemaps/saml_uri.py | Python | bsd-2-clause | 10,586 |
# Generated by Django 2.1.11 on 2019-08-14 22:44
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ct', '0033_auto_20190814_1537'),
]
operations = [
migrations.RenameField(
model_name='unit',
old_name='assessment_name',
... | cjlee112/socraticqs2 | mysite/ct/migrations/0034_auto_20190814_1544.py | Python | apache-2.0 | 369 |
# -*- coding: utf-8 -*-
#
# libcaca Colour ASCII-Art library
# Python language bindings
# Copyright (c) 2010 Alex Foulon <alxf@lavabit.com>
# All Rights Reserved
#
# This library is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redis... | Distrotech/libcaca | python/caca/dither.py | Python | lgpl-2.1 | 12,062 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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.apach... | eltonkevani/tempest_el_env | tempest/api/compute/images/test_list_image_filters.py | Python | apache-2.0 | 10,391 |
# encoding=utf-8
from flask import Flask,render_template,request,redirect, url_for
from lib.model import db_session,engine
from datetime import *
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
admin_name = 'admin'
admin_pass = 'admin'
app = Flask(__name__)
@app.route('/')
def index():
result = db_sessio... | cfrs2005/flask_blog | myblog.py | Python | bsd-2-clause | 2,058 |
import sys
if sys.version_info[0] == 3:
from multiprocessing.connection import * # noqa
else:
from ._connection import *
| mozilla/firefox-flicks | vendor-local/lib/python/billiard/connection.py | Python | bsd-3-clause | 136 |
from diofant import EmptySet, FiniteSet, Intersection, Rational, Symbol, Union
from diofant.geometry import Circle, Line, Point, Polygon, Segment
__all__ = ()
x = Symbol('x', real=True)
y = Symbol('y', real=True)
z = Symbol('z', real=True)
t = Symbol('t', real=True)
k = Symbol('k', real=True)
x1 = Symbol('x1', real=... | skirpichev/omg | diofant/tests/geometry/test_geometrysets.py | Python | bsd-3-clause | 2,054 |
#!/usr/bin/env python
#
# stopdomain.py - Copyright (C) 2009 Red Hat, Inc.
# Written by Darryl L. Pierce <dpierce@redhat.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; version 2 of the L... | avlubimov/ovirt-node | nodeadmin/stopdomain.py | Python | gpl-2.0 | 2,437 |
"""Tests for certificates views. """
import json
from uuid import uuid4
from nose.plugins.attrib import attr
from mock import patch
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.test.utils import override_settings
from openedx.core.lib... | adoosii/edx-platform | lms/djangoapps/certificates/tests/test_webview_views.py | Python | agpl-3.0 | 25,855 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Pi-Yueh Chuang <pychuang@gwu.edu>
#
# Distributed under terms of the MIT license.
"""__init__.py for package global/one_d"""
from utils.grids.one_d.SequentialAssembly import SequentialAssembly
from utils.grids.one_d.DecomposeAssembl... | piyueh/SEM-Toolbox | utils/grids/one_d/__init__.py | Python | mit | 401 |
class GiterCommandBuilder():
def __init__(self, g8Path, templateName, templateUserProperites):
self.g8Path = g8Path
self.templateName = templateName
self.templateUserProperites = templateUserProperites
def buildGiterCommand(self):
g8Command = []
g8Command.append(self.g8... | lgmerek/ScalaProjectGeneratorFacade | guiterCommandBuilder.py | Python | mit | 586 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.