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 json
import six
_transform_registry = {}
def register_transform(from_type, func):
_transform_registry[from_type] = func
class BaseModel(object):
def __str__(self):
str_dict = {}
for key, value in six.iteritems(self.__dict__):
if key.startswith('_'):
conti... | omninubes/nubes | nubes/common/models.py | Python | apache-2.0 | 1,198 |
from __future__ import absolute_import, print_function
import re
from collections import defaultdict
from constants import (
CONTACT_TYPE_EMAIL,
CONTACT_TYPE_SMS,
CONTACT_TYPE_YO,
STATUS_CANCELLED,
STATUS_CLOSED,
STATUS_FULL,
STATUS_OPEN,
STATUS_STOPPED,
STATUS_TENTATIVE,
)
from db... | Chybby/Tutorifull | util.py | Python | mit | 3,758 |
import datetime as dt
import errno
import logging
import os
import time
from nose.tools import *
import psycopg2
import socorro.lib.ConfigurationManager as configurationManager
import socorro.database.schema as schema
import socorro.database.postgresql as socorro_psg
from socorro.unittest.testlib.testDB import TestD... | boudewijnrempt/HyvesDesktop | 3rdparty/socorro/socorro/unittest/database/testSchema.py | Python | gpl-2.0 | 19,160 |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class OrdersDashboardConfig(AppConfig):
label = 'orders_dashboard'
name = 'oscar.apps.dashboard.orders'
verbose_name = _('Orders dashboard')
| canhhs91/greenpointtrees | src/oscar/apps/dashboard/orders/config.py | Python | mit | 245 |
#John Bozzella, SoftDes 2015
#Function to import lyrics from genius.com with inputs of the URLs and titles
#Extra print statements in the actual function are for debugging
from pattern.web import *
sites = ['http://genius.com/Madvillain-accordion-lyrics' , 'http://genius.com/Madvillain-meat-grinder-lyrics' , 'http:/... | bozzellaj/SoftwareDesignFall15 | MP1/lyricsimportworkfile.py | Python | mit | 3,457 |
# Copyright 2015 Novo Nordisk Foundation Center for Biosustainability, DTU.
# 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 ... | biosustain/driven | tests/test_data_sets.py | Python | apache-2.0 | 2,184 |
from opsy.exceptions import OpsyError
class OpsyMonitoringError(OpsyError):
"""Base class for exceptions in the monitoring plugin."""
class PollFailure(OpsyMonitoringError):
"""The poll failed."""
class BackendNotFound(OpsyMonitoringError):
"""Unable to load specified backend."""
| testeddoughnut/opsy | opsy/monitoring/exceptions.py | Python | mit | 299 |
#!/usr/bin/env python3
if __name__ == '__main__':
python_custom_file = open('../python-sort-locale-custom.py', 'w')
with open('../python-sort-locale.py') as python_file:
for python_line in python_file:
if 'import sys' in python_line:
python_custom_file.write('import re\n')
... | OpenTaal/alphabetical-sort | filters/preprocess.py | Python | mit | 2,133 |
import unittest
import responses
import digitalocean
import json
from .BaseTest import BaseTest
class TestTags(BaseTest):
def setUp(self):
super(TestTags, self).setUp()
@responses.activate
def test_load(self):
data = self.load_from_file('tags/single.json')
url = self.base_url +... | koalalorenzo/python-digitalocean | digitalocean/tests/test_tag.py | Python | lgpl-3.0 | 4,000 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
from remotecv.detectors import CascadeLoaderDetector
HAIR_OFFSET = ... | thumbor/remotecv | remotecv/detectors/face_detector/__init__.py | Python | mit | 907 |
from django.apps import AppConfig
class CoreConfig(AppConfig):
name = 'core'
| kkmsc17/smes | backend/core/apps.py | Python | agpl-3.0 | 84 |
#!/usr/bin/env python
# pylint: disable=W0212
from agate import utils
@utils.allow_tableset_proxy
def find(self, test):
"""
Find the first row that passes test.
:param test:
A function that takes a :class:`.Row` and returns :code:`True` if
it matches.
:type test:
:class:`func... | flother/agate | agate/table/find.py | Python | mit | 489 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | asimshankar/tensorflow | tensorflow/python/ops/logging_ops.py | Python | apache-2.0 | 25,649 |
#
# 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 us... | lukecwik/incubator-beam | sdks/python/apache_beam/utils/processes.py | Python | apache-2.0 | 3,871 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# friday documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# auto... | Zenohm/Friday | docs/conf.py | Python | mit | 8,390 |
import re
import os
import sys
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.md')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
with open(os.path.join(here, 'pyvac', '__init__.py')) as v_file:
version = re... | doyousoft/pyvac | setup.py | Python | bsd-3-clause | 2,082 |
# -*- coding: utf-8 -*-
# models.py ---
# created: 2012-03-13 23:08:13
#
from django.db import models
class User(models.Model):
name = models.CharField(max_length=60)
age = models.IntegerField()
class Meta:
db_table = 'user'
#
# models.py ends here
| wuher/devil | example/userdb/api/models.py | Python | mit | 280 |
# 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... | Acehaidrey/incubator-airflow | kubernetes_tests/test_kubernetes_executor.py | Python | apache-2.0 | 2,909 |
from __future__ import absolute_import
# Copyright (c) 2010-2016 openpyxl
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Typed,
Float,
Integer,
Bool,
MinMax,
Set,
NoneSet,
String,
Alias,
)
from openpyxl.descriptors.excel import Coordina... | aragos/tichu-tournament | python/openpyxl/drawing/shapes.py | Python | mit | 17,855 |
#
# 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... | spektom/incubator-airflow | airflow/example_dags/example_branch_python_dop_operator_3.py | Python | apache-2.0 | 2,110 |
from sqlalchemy import create_engine
import json
# TODO: Fix usage of global
engine = None
def loadDB(user, password, hostname, dbname):
global engine
engine = create_engine('postgresql+psycopg2://{}:{}@{}/{}'.format(user, password, hostname, dbname))
| j-nguyen/FractalBot | cogs/utils/db.py | Python | apache-2.0 | 262 |
from util import hook, timesince
import time
import re
db_ready = False
def db_init(db):
db.execute("""CREATE TABLE if not exists karma(
nick_vote TEXT PRIMARY KEY,
up_karma INTEGER,
down_karma INTEGER,
total_karma INTEGER)""")
db.execute("""CREAT... | thejordan95/Groovebot2 | plugins/karma.py | Python | gpl-3.0 | 4,044 |
import numpy as np
#
# Tensor rotation
# from Peter Mortensen's stackoverflow question
# @ http://stackoverflow.com/questions/4962606/fast-tensor-rotation-with-numpy/18301915
#
n = 9
def rotT_loops(T, g):
Tprime = np.zeros((n,n,n,n))
for i in range(n):
for j in range(n):
for k in range(... | pombredanne/parakeet | benchmarks/tensor_rotation.py | Python | bsd-3-clause | 1,756 |
#!/usr/bin/env python
import setuptools
setuptools.setup(
setup_requires=['pbr'],
pbr=True,
entry_points={
'sphinx.builders': [
'odt = sphinxcontrib.odfbuilder',
],
}
)
| mans0954/odfbuilder | setup.py | Python | bsd-2-clause | 216 |
import unittest
from subprocess import call, DEVNULL
import time
from tests.docker import docker_util
class VMHelper(object):
def __init__(self, vm_name: str, shell: str = "", ssh_username: str = None, ssh_port: str = None):
self.vm_name = vm_name
self.shell = shell # like cmd.exe /c
sel... | splotz90/urh | tests/TestInstallation.py | Python | gpl-3.0 | 5,216 |
from __future__ import print_function, division
import sys
import os
import glob
import doctest
from doctest import DocTestParser, Example, SKIP
import gmpy2
# *****************************************************************************
# Test strategy
# -------------
# Tests are divided into two different categorie... | aleaxit/gmpy | test/runtests.py | Python | lgpl-3.0 | 5,933 |
# -*- coding: utf-8 -*-
import re
from core import httptools
from core import scrapertools
from platformcode import logger
def test_video_exists(page_url):
logger.info("(page_url='%s')" % page_url)
global data
data = httptools.downloadpage(page_url).data
if "<h2>WE ARE SORRY</h2>" in data or '<title>4... | alfa-addon/addon | plugin.video.alfa/servers/fileone.py | Python | gpl-3.0 | 825 |
# http://learning-0mq-with-pyzmq.readthedocs.org/en/latest/pyzmq/patterns/pair.html
import time
import zmq
port = "5556"
context = zmq.Context()
socket = context.socket(zmq.PAIR)
socket.bind("tcp://*:{}".format(port))
while True:
socket.send_string("Server message to client3")
msg = socket.recv()
print(... | introprogramming/exercises | exercises/chat/online_examples/pairserver.py | Python | mit | 343 |
# -*- Mode: Python; test-case-name: flumotion.test.test_bouncers_ipbouncer -*-
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or ... | flumotion-mirror/flumotion | flumotion/component/bouncers/algorithms/ipbouncer.py | Python | lgpl-2.1 | 2,879 |
from rest_framework import generics
from bukkake.models import Bukkake
from bukkake.api.serializers import BukkakeSerializer
class BukkakeListView(generics.ListCreateAPIView):
queryset = Bukkake.objects.all()
serializer_class = BukkakeSerializer
permission_classes = ()
authentication_classes = ()
c... | delitamakanda/BukkakeGramNew | bukkake/api/views.py | Python | mit | 519 |
from test.test_support import have_unicode, run_unittest
import unittest
class base_set:
def __init__(self, el):
self.el = el
class set(base_set):
def __contains__(self, el):
return self.el == el
class seq(base_set):
def __getitem__(self, n):
return [self.el][n]
... | ktan2020/legacy-automation | win/Lib/test/test_contains.py | Python | mit | 3,264 |
#! python3
# -*- coding: utf-8 -*-
'''
自动监测生肉文件夹变化,如果有新文件进入自动启动压制
'''
import sys
def show_exception_and_exit(exc_type, exc_value, tb):
import traceback
traceback.print_exception(exc_type, exc_value, tb)
input('''脚本遇到错误,请截图此画面发送给Kilo19。5秒后继续
Error encountered, please send a screenshot of this error to Kilo19
Press... | Kilo19/NixieVideoKit | nvkdeamon.py | Python | mit | 5,537 |
import click
from cloudcompose.ecs.controller import Controller
from cloudcompose.config import CloudConfig
from cloudcompose.exceptions import CloudComposeException
@click.group()
def cli():
pass
@cli.command()
@click.option('--upgrade-image/--no-upgrade-image', default=False, help="Upgrade the image to the ne... | cloud-compose/cloud-compose-ecs | cloudcompose/ecs/commands/cli.py | Python | mit | 2,554 |
def add(a,b):
"""
Add the two input parameters together.
Parameters:
-----------
a - int
the first number to add
b - int
the second number to add
"""
return a+b
| evanjbowling/playground | lng/py/simple_package/apackage/math.py | Python | mit | 210 |
# -*- coding: utf-8 -*-
import os
import sys
import datetime
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import SIGNAL, SLOT
from models import *
initDB()
b = Repo.get_by_or_init(path=u"/Users/johannes")
f = Soundfile.get_by_or_init(repo=b, file_path=u"test2.wav")
m = RepoModel()
repo = m.add_repo(u"/Users/jo... | jpburstrom/sampleman | tests.py | Python | gpl-3.0 | 798 |
# -*- coding: utf-8 -*-
#---------------------------------------------------------------------
'''
Created on 24 Jan 2016
@author: Seko
@summary: Logger
'''
#---------------------------------------------------------------------
# ____________________ I M P O R T ____________________
import xbmc
# ________... | Seko34/Kodi-Development | script.module.core.ultrastream/resources/lib/logger.py | Python | gpl-3.0 | 1,810 |
'''
Problem 030
Surprisingly there are only three numbers that can be written as the sum of
fourth powers of their digits:
1634 = 14 + 64 + 34 + 44
8208 = 84 + 24 + 04 + 84
9474 = 94 + 44 + 74 + 44
As 1 = 14 is not a sum it is not included.
The sum of these numbers is 1634 + 8208 + 9474 = 19316.
Find the sum of ... | daveinnyc/various | project_euler/030.digit_5th_powers.py | Python | mit | 825 |
from django import forms
from tablemanager.models import Workspace
from livelayermanager.models import Datasource,Layer,SqlViewLayer
from borg_utils.form_fields import GeoserverSettingForm,MetaTilingFactorField,GridSetField
from borg_utils.form_fields import GroupedModelChoiceField,BorgSelect
from borg_utils.forms imp... | rockychen-dpaw/borgcollector | livelayermanager/forms.py | Python | bsd-3-clause | 5,053 |
# Copyright 2018 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/optimizer_v2/optimizer_v2_test.py | Python | apache-2.0 | 30,534 |
import quex.engine.state_machine.index as sm_index
from quex.engine.generator.skipper.common import line_counter_in_loop, \
end_delimiter_is_subset_of_indentation_counter_newline, \
... | coderjames/pascal | quex-0.63.1/quex/engine/generator/skipper/range.py | Python | bsd-2-clause | 16,427 |
import re
import sys
import os
import time
from ruuvitag_sensor.url_decoder import UrlDecoder
mac_regex = '[0-9a-f]{2}([:])[0-9a-f]{2}(\\1[0-9a-f]{2}){4}$'
if not sys.platform.startswith('linux') or os.environ.get('CI') == 'True':
# Use BleCommunicationDummy also for CI as it can't use gattlib
from ruuvitag_... | juhi24/ilmaruuvi | ruuvitag_sensor/ruuvi.py | Python | mit | 4,803 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "veganmekan.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that t... | kemalbsoylu/veganmekan | manage.py | Python | mit | 808 |
import os
from git import Repo
import tempfile
import uuid
import datetime
from .Base import BasePublisher
from shuttl.database import db
class GitPublisher(BasePublisher):
##Id of the directory. Because of the way inheritance is set up in sqlalchemy, this is a foriegnKey
id = db.Column(db.Integer, db.Foreig... | shuttl-io/shuttl | shuttl/Models/Publishers/GitPublisher.py | Python | mit | 2,827 |
from rnndatasets.synthetic.binding.binding import *
| PFCM/datasets | rnndatasets/synthetic/binding/__init__.py | Python | bsd-3-clause | 52 |
#!/usr/bin/env python
__author__ = "Moxie Marlinspike"
__email__ = "moxie@thoughtcrime.org"
__license__= """
Copyright (c) 2009 Moxie Marlinspike <moxie@thoughtcrime.org>
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... | vejeshv/main_project | knockknock-genprofile.py | Python | gpl-3.0 | 2,557 |
import json
import os.path
import unittest.mock as mock
from tests.plugins import PluginTestCase
import plugins.weather
f = "plugins.weather.get_owm_data"
def get_json(state):
path = os.path.join(
os.path.dirname(os.path.dirname(__file__)),
"files",
"openweathermap_" + state + ".json",
... | anlutro/botologist | tests/plugins/weather_test.py | Python | mit | 1,289 |
#!/usr/bin/env python
# flake8: noqa
from ansible import errors
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser
import StringIO
def get_host_ips(topo):
host_public_ips = []
for group in topo['gcloud_gce_res']:
for instance in group['instan... | agharibi/linchpin | linchpin/provision/filter_plugins/gcloud_inventory.py | Python | gpl-3.0 | 3,571 |
#!/usr/bin/env python
import numpy as np;
import sys;
import string;
import numpy.linalg as lg
import argparse as ap
atb=1.88971616463
parser=ap.ArgumentParser(description="Parse polarisation from Gaussian logfile")
parser.add_argument("-f","--logfile", help="Gaussian logfile")
args=parser.parse_args()
inputfile=args... | 12AngryMen/votca-scripts | Gaussian/Gaussian_parse_polar.py | Python | apache-2.0 | 2,005 |
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2005, Tim Potter <tpot@samba.org>
# Copyright 2006 John-Mark Gurney <gurney_j@resnet.uroegon.edu>
# Copyright (C) 2006 Fluendo, S.A. (www.fluendo.com).
# Copyright 2006,2007,2008,2009 Frank Scholz <coherence@beebits.net>
# Co... | bluesliverx/smartthings-src | apps/wifi-104-ssdp-server/lib/ssdp.py | Python | apache-2.0 | 8,142 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
From my blog post:
<http://tanghaibao.blogspot.com/2010/02/getting-phylogeny-from-list-of.html>
Example:
>>> mylist = [3702, 3649, 3694, 3880]
>>> t = TaxIDTree(mylist)
>>> print t
(((Carica_papaya,Arabidopsis_thaliana)Brassicales,(Medicago_truncatula,Populus_trichoca... | sgordon007/jcvi_062915 | utils/taxonomy.py | Python | bsd-2-clause | 4,675 |
# -*- coding: utf-8 -*-
"""Normalizes access to the HTTP libraries.
"""
from __future__ import absolute_import, unicode_literals, division
from six.moves import http_client as client
from .request import Request
from .response import Response
from . import exceptions
__all__ = [
'client',
'Request',
'Respo... | armet/python-armet | armet/http/__init__.py | Python | mit | 919 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
doRasterize.py
---------------------
Date : June 2010
Copyright : (C) 2010 by Giuseppe Sucameli
Email : brush dot tyler at gmail dot com
****************... | herow/planning_qgis | python/plugins/GdalTools/tools/doRasterize.py | Python | gpl-2.0 | 6,287 |
import math
class ColorPoint:
"""
Simple color-storage class; stores way-points on a color ramp
"""
def __init__(self,idx,col,colType):
# index, X-coordinate, on a palette
self.idx = idx
# color; usually an RGBA quad
self.color = col
# One of ColorTypes members
... | gratefulfrog/lib | python/pymol/colorramping.py | Python | gpl-2.0 | 13,994 |
from ConfigParser import SafeConfigParser
import os.path
import pytest
import re
import textwrap
from amazonproduct import utils
def pytest_addoption(parser):
group = parser.getgroup('amazonproduct',
'custom options for testing python-amazon-product-api')
group._addoption('--locale', action='append', ... | prats226/python-amazon-product-api-0.2.8 | tests/conftest.py | Python | bsd-3-clause | 5,765 |
# Note:
# This is a total hack to implement simple disk-based memoization,
# with no expiration.
import os
PATH = '/tmp/django_cache_belonging_to_%s' % os.environ.get('USER', 'unknown')
def set(key, value):
if not os.path.isdir(PATH):
os.mkdir(PATH)
file_obj = file(os.path.join(PATH, key), 'w')
f... | waseem18/oh-mainline | mysite/base/disk_cache.py | Python | agpl-3.0 | 504 |
from PyQt4 import QtCore, QtGui
import vtrace.qt
import vdb.qt.base
from vqt.main import *
class VdbRegistersWindow(vdb.qt.base.VdbWidgetWindow):
def __init__(self, db, dbt, parent=None):
vdb.qt.base.VdbWidgetWindow.__init__(self, db, dbt, parent=parent)
self.regsWidget = vtrace.qt.RegistersView... | joshuahoman/vivisect | vdb/qt/registers.py | Python | apache-2.0 | 753 |
# -*- coding: utf-8 -*-
#
# Copyright 2015-2020 BigML
#
# 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 ... | mmerce/python | bigml/tests/test_17_split_dataset.py | Python | apache-2.0 | 2,882 |
# 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... | ilay09/keystone | keystone/common/policies/base.py | Python | apache-2.0 | 2,354 |
import os
import sys
import shutil
cwd_path = os.getcwd()
sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools'))
# BSP dist function
def dist_do_building(BSP_ROOT):
from mkdist import bsp_copy_files
import rtconfig
dist_dir = os.path.join(BSP_ROOT, 'dist', os.path.basename(BSP... | onelife/rt-thread | bsp/at32/tools/sdk_dist.py | Python | gpl-2.0 | 848 |
import numpy as np
import warnings
def _bit_length_26(x):
if x == 0:
return 0
elif x == 1:
return 1
else:
return len(bin(x)) - 2
try:
from scipy.lib._version import NumpyVersion
except ImportError:
import re
string_types = str
class NumpyVersion():
"""... | CartoDB/crankshaft | src/py/crankshaft/crankshaft/regression/glm/utils.py | Python | bsd-3-clause | 13,087 |
from unittest import TestCase
from itertools import permutations
from src.main.managers.players.hard_coded_player_manager import HardCodedPlayerManager
from src.main.managers.conflict.hard_coded_example_conflict_manager import HardCodedExampleConflictManager
from src.main.managers.conflict.automated_conflict_manager i... | malcolmwhite/DungeonsAndDragons | src/test/managers/test_model_conflict_manager.py | Python | mit | 3,021 |
from PyDynamicStructures.dynamic_structure import *
from PyDynamicStructures.base_types import * | cpchrispye/PyDynamicStructures | PyDynamicStructures/__init__.py | Python | mit | 96 |
# -*- coding: utf-8 -*-
"""
Gadfly queue storage.
:author: David Siroky (siroky@dasir.cz)
:license: MIT License (see LICENSE.txt)
"""
from __future__ import absolute_import
import os
from binascii import b2a_hex, a2b_hex
import gadfly
from snakemq.message import Message, MAX_UUID_LENGTH
from snakemq.messaging impo... | dsiroky/snakemq | snakemq/storage/gadfly.py | Python | mit | 3,702 |
def detect_single_character_xor(ciphertext):
return ""
| gjtempleton/matasano_cryptopals | set1/challenge_4.py | Python | mit | 59 |
'''
used for parsing tricky Svg elements such as bezier curves
Beizer code source: http://www.cs.nyu.edu/~dzorin/numcomp08/bezier.py
Circular fitting ref: http://wiki.scipy.org/Cookbook/Least_Squares_Circle
'''
import numpy
from numpy import array, mean, linalg, sqrt, pi, linspace, cos, sin, arctan2, cross, n... | crobarcro/FreeCAD_drawing_dimensioning | circleLib.py | Python | gpl-3.0 | 12,906 |
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
#
# eos 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, ... | bsmr-eve/Pyfa | eos/db/saveddata/module.py | Python | gpl-3.0 | 2,658 |
__description__ = \
"""
Takes a pdb file with multiple snapshots from a trajectory and colors by time
point using user-specified color gradients. Can take multiple trajectories
simultaneously.
"""
__author__ = "Michael J. Harms"
__date__ = "110223"
__usage__ = "pymol -a *.pdb timePlot.py [pdb files *must* have .pdb ex... | harmsm/md-analysis-tools | motion-over-trajectory/timePlot.py | Python | unlicense | 1,794 |
"""Extension to format and index PSI variables."""
#Sphinx.add_object_type(psivar, rolename, indextemplate='', parse_node=None, ref_nodeclass=None, objname='', doc_field_types=[])
def setup(app):
app.add_object_type('psivar', 'psivar', indextemplate='single: %s')
| loriab/qcdb | docs/source/psi4_sptheme/ext/psidomain.py | Python | lgpl-3.0 | 272 |
# from tkinter import *
# from tkFileDialog import askopenfilename
# import Tkconstants
# class Interface:
# def __init__(self, master):
# self.master = master
# master.title("SeqPyPlot v0.2 GUI")
# master.geometry('680x500')
# self.button_opt = {'fill': Tkconstants.BOTH, 'padx': ... | paulgradie/SeqPyPlot | dev/SeqPyPlot_GUI.py | Python | gpl-3.0 | 4,216 |
import ago
import logbook
import requests
from piper import config
from piper import logging
from piper import utils
from piper.api import RESTful
from piper.db.core import LazyDatabaseMixin
from piper.vcs import GitVCS
class Build(LazyDatabaseMixin):
"""
The main pipeline runner.
This class loads the c... | thiderman/piper | piper/build.py | Python | mit | 9,140 |
"""
OAuth dance session
"""
from google.appengine.ext import ndb
from ferris.core.ndb import Model
from credentials_property import CredentialsProperty
from ndb_storage import NdbStorage
import hashlib
class UserCredentials(Model):
user = ndb.UserProperty(indexed=True)
scopes = ndb.StringProperty(repeated=T... | yowmamasita/social-listener-exam | ferris/core/oauth2/user_credentials.py | Python | mit | 2,290 |
from __future__ import print_function
from random import shuffle
from myhdl import *
class FIFO(object):
"""
FIFO interface and model.
"""
def __init__(self, depth=16, width=16, clock_read=None, clock_write=None):
self.depth = depth
self.clock_write = clock_write
self.clock_r... | cfelton/parallella_elink | elink/_fifo_i.py | Python | mit | 2,030 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import serialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import... | Vagab0nd/SiCKRAGE | lib3/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py | Python | gpl-3.0 | 20,006 |
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
try:
import resource # pylint: disable=F0401
except ImportError:
resource = None # Not available on all platforms
from telemetry.core.pl... | pozdnyakov/chromium-crosswalk | tools/telemetry/telemetry/core/platform/mac_platform_backend.py | Python | bsd-3-clause | 1,792 |
import PIL.Image
from PIL.ExifTags import TAGS, GPSTAGS
# https://gist.github.com/erans/983821
def get_lat_lon(exif_data):
lat = None
lon = None
if "GPSInfo" in exif_data:
gps_info = exif_data["GPSInfo"]
gps_latitude = _get_if_exist(gps_info, "GPSLatitude")
gps_latitude_ref = _ge... | JBmiog/IOT | server_script/exif_reader.py | Python | gpl-3.0 | 2,314 |
# uncompyle6 version 2.9.10
# Python bytecode 2.6 (62161)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: c:\Temp\build\ZIBE\shell.py
# Compiled at: 2013-03-28 22:23:46
import cmd
import string
import binascii
from context_mgr import *
from plugin_manager... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/exploits/ZIBE/shell.py | Python | unlicense | 42,519 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-08-21 17:18
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0023_auto_20190711_1755'),
('protocoloadm', '0023_merge_20190802_1112'),
... | interlegis/sapl | sapl/protocoloadm/migrations/0024_merge_20190821_1418.py | Python | gpl-3.0 | 350 |
from .utils import captitle
class BaseModel(object):
title = None
def __init__(self):
self.__name__ = self.__class__.__name__
self.slug = self.__name__.lower()
if self.title is None:
self.title = captitle(self.__name__)
def __str__(self):
return self.__name__
| byashimov/django-controlcenter | controlcenter/base.py | Python | bsd-3-clause | 320 |
# 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... | cloudera/Impala | tests/common/impala_cluster.py | Python | apache-2.0 | 22,467 |
# Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import stix
import stix.utils
import stix.indicator.test_mechanism
from stix.common import EncodedCDATA
from stix.indicator.test_mechanism import _BaseTestMechanism
import stix.bindings.extensions.test_mechanism.yar... | benjamin9999/python-stix | stix/extensions/test_mechanism/yara_test_mechanism.py | Python | bsd-3-clause | 2,517 |
'''
backends/gs.py - this file is part of S3QL.
Copyright © 2008 Nikolaus Rath <Nikolaus@rath.org>
This work can be distributed under the terms of the GNU GPLv3.
'''
from ..logging import logging, QuietError # Ensure use of custom logger class
from .common import (AbstractBackend, NoSuchObject, retry, AuthorizationE... | s3ql/s3ql | src/s3ql/backends/gs.py | Python | gpl-3.0 | 32,712 |
# 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/reservations/azure-mgmt-reservations/azure/mgmt/reservations/models/__init__.py | Python | mit | 12,190 |
import logging
from .scoring_system import ScoringSystem
logger = logging.getLogger(__name__)
class SingleThread(ScoringSystem):
def _process_missing_scores(self, request, missing_model_set_revs,
root_caches, inprogress_results=None):
rev_scores = {}
errors = {}
... | he7d3r/ores | ores/scoring_systems/single_thread.py | Python | mit | 1,157 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
def index():
print '欢迎登陆后台管理系统!' | zhangyage/Python-oldboy | day04/reflect/backend/admin.py | Python | apache-2.0 | 105 |
"""Websocket client implementation.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import logging
import socket
import time
import urllib
import websocket as ws_client
_LOGGER = logging.getLogger(_... | Morgan-Stanley/treadmill | lib/python/treadmill/websocket/client.py | Python | apache-2.0 | 4,130 |
from flask import render_template, flash, redirect, session, url_for, request, g
from flask_login import login_user, logout_user, current_user, login_required
from app import app, db, lm, oid
from .forms import LoginForm, EditForm
from .models import User
from datetime import datetime
@app.before_request
def before_r... | jtara1/SimpleFlaskWebsite | app/views.py | Python | apache-2.0 | 3,783 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# pyliferisk: A python library for simple actuarial calculations
# Version: 1.11 - Nov 2019
# Copyright (C) 2019 Francisco Garate
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publ... | franciscogarate/pyliferisk | pyliferisk/__init__.py | Python | gpl-3.0 | 19,066 |
from django.utils.translation import ugettext as _
from corehq.apps.groups.models import Group
from corehq.apps.reports.standard.cases.basic import CaseListReport
from corehq.apps.api.es import CaseES
from corehq.apps.reports.standard import CustomProjectReport
from corehq.apps.reports.datatables import DataTablesHead... | gmimano/commcaretest | custom/bihar/reports/mch_reports.py | Python | bsd-3-clause | 19,214 |
from bingads.v13.bulk.entities import *
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V13
from bingads.v13.internal.bulk.entities.single_record_bulk_entity import _SingleRecordBulkEntity
from bingads.v13.internal.bulk.mappings import _SimpleBulkMapping
from bingads.v13.internal.bulk.string_table import _S... | bing-ads-sdk/BingAds-Python-SDK | bingads/v13/bulk/entities/target_criterions/bulk_ad_group_negative_location_criterion.py | Python | mit | 5,218 |
import json, io, re, requests
from bs4 import BeautifulSoup
from datetime import datetime
def get_datasets(url):
r = requests.get(url.format(0))
soup = BeautifulSoup(r.text)
href = soup.select('#block-system-main a')[-1]['href']
last_page = int(re.match(r'.*page=(.*)', href).group(1))
for page in... | nbi-opendata/metadaten-scraper | get-metadata.py | Python | mit | 3,412 |
# Copyright 2013 IBM Corp.
# Copyright 2013 Red Hat, 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 r... | eharney/nova | nova/conductor/rpcapi.py | Python | apache-2.0 | 21,580 |
#!/usr/bin/env python
import tempfile
import sys
import subprocess
import shutil
import os
import hashlib
import contextlib
import gzip
import fnmatch
import tarfile
import zipfile
def generate_file_list(directory):
for dirpath, dirnames, filenames in os.walk(directory):
for filename in filenames:
... | ahh2131/mchisel | run_regression_test.py | Python | isc | 5,935 |
#!/usr/bin/env python
import pytest
if pytest.PYVER[:2] == (3, 3):
pytest.skip("Broken on Python 3.3")
from circuits.web import Controller
from circuits.web.tools import check_auth, digest_auth
from .helpers import HTTPError, HTTPDigestAuthHandler
from .helpers import urlopen, build_opener, install_opener
clas... | treemo/circuits | tests/web/test_digestauth.py | Python | mit | 1,085 |
import control_grid
from os import system,popen
import random
import re
class nn_task(control_grid.specific_task):
def execute(self,iden):
iden_all = dict()
string_dir = "t_";
for i in sorted(iden):
s = (i.split(":"))[0]
iden_all[s] = (i.split(":"))[1]
st... | zzzsss/parsing2 | others/tune_nn.py | Python | lgpl-3.0 | 2,399 |
"""
Tests for the mhlib module
Nick Mathewson
"""
### BUG: This suite doesn't currently test the mime functionality of
### mhlib. It should.
import unittest
from test.test_support import run_unittest, TESTFN, TestSkipped, import_module
import os, StringIO
import sys
mhlib = import_module('mhlib', deprecat... | leighpauls/k2cro4 | third_party/python_26/Lib/test/test_mhlib.py | Python | bsd-3-clause | 11,145 |
#
# Copyright 2015-2016 Free Software Foundation, Inc.
#
# This file is part of PyBOMBS
#
# PyBOMBS 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, or (at your option)
# any later version.
#
... | marcusmueller/pybombs | pybombs/packagers/cmd.py | Python | gpl-3.0 | 2,985 |
from django import forms
FIELD_CHOICES = (('ti','Title'),('au','Author'),
('ab','Abstract'),('yr','Year'))
DIR_CHOICES = (('asc','Ascending'),('desc','Descending'))
class SearchForm(forms.Form):
Keyword = forms.CharField(label='',max_length=20)
class SortForm(forms.Form):
SortField = forms.ChoiceField(label='',... | jianmingtang/django-app-publication | mypub/forms.py | Python | gpl-3.0 | 403 |
# Copyright 2015 NEC Corporation. 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 ... | masayukig/tempest | tempest/lib/services/identity/v3/token_client.py | Python | apache-2.0 | 8,017 |
"""Data normalizer API.
The purpose of data normalizers is to process output
from `mercator-go` command line tool and normalize it.
Ecosystem-specific implementations live in their respective modules,
e.g.: NPM data normalizer can be found in `javascript` module.
All normalizers inherit from `f8a_worker.data_normali... | fabric8-analytics/fabric8-analytics-worker | f8a_worker/data_normalizer/__init__.py | Python | gpl-3.0 | 2,878 |
import time
import shutil
from nxdrive.tests.common import OS_STAT_MTIME_RESOLUTION
from nxdrive.tests.common_unit_test import UnitTestCase
from nxdrive.osi import AbstractOSIntegration
from nose.plugins.skip import SkipTest
class TestConflicts(UnitTestCase):
def setUp(self):
super(TestConflicts, self).... | rsoumyassdi/nuxeo-drive | nuxeo-drive-client/nxdrive/tests/test_conflicts.py | Python | lgpl-2.1 | 11,058 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.