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 |
|---|---|---|---|---|---|
#############################################################################
##
## Copyright (C) 2010 Hans-Peter Jansen <hpj@urpla.net>.
## 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:BSD$
## You may ... | DevinDewitt/pyqt5 | examples/widgets/stylesheet/stylesheeteditor.py | Python | gpl-3.0 | 4,557 |
from builtins import object
import imp
import inspect
import logging
import os
from itertools import chain
merge = chain.from_iterable
from airflow.configuration import conf
class AirflowPluginException(Exception):
pass
class AirflowPlugin(object):
name = None
operators = []
hooks = []
executors ... | jampp/airflow | airflow/plugins_manager.py | Python | apache-2.0 | 2,039 |
# Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Hale Ligh <michael.ligh@mnin.org>
#
# Contributors/References:
# Richard Stevens and Eoghan Casey
# Extracting Windows Cmd Line Details from Physical Memory.
# http://ww.dfrws.org/2010/proceedings/stevens.pdf
# ... | rlugojr/rekall | rekall-core/rekall/plugins/windows/malware/cmdhistory.py | Python | gpl-2.0 | 40,732 |
#!/usr/bin/env python
""" convert FS format to (Hierarchical Data Format 5) HDF5 Format
"""
from __future__ import print_function, division
import os
import sys
sys.path.append('../')
sys.path.append('../..')
from Detector import data_map
from gad.util import tables
def sizeof_fmt(num):
for x in ['bytes','KB','MB... | hbhzwj/GAD | tools/convert-to-hdf.py | Python | gpl-3.0 | 1,386 |
import os
def load_tests(loader, standard_tests, pattern):
# top level directory cached on loader instance
this_dir = os.path.dirname(__file__)
package_tests = loader.discover(start_dir=this_dir, pattern=pattern)
standard_tests.addTests(package_tests)
return standard_tests
| leth/nose2 | nose2/tests/functional/support/scenario/load_tests_pkg/ltpkg/tests/__init__.py | Python | bsd-2-clause | 296 |
# Copyright (c) 2016-2019. Mount Sinai School of Medicine
#
# 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 ... | hammerlab/varcode | varcode/common.py | Python | apache-2.0 | 2,321 |
"""caching_query.py
Represent persistence structures which allow the usage of
dogpile.cache caching with SQLAlchemy.
The three new concepts introduced here are:
* CachingQuery - a Query subclass that caches and
retrieves results in/from dogpile.cache.
* FromCache - a query option that establishes caching
par... | alex/sqlalchemy | examples/dogpile_caching/caching_query.py | Python | mit | 8,499 |
"""
The B{0install download} command-line interface.
"""
# Copyright (C) 2011, Thomas Leonard
# See the README file for details, or visit http://0install.net.
from __future__ import print_function
import sys
from zeroinstall import SafeException, _
from zeroinstall.injector import model, requirements
from zeroinsta... | timdiels/0install | zeroinstall/cmd/update.py | Python | lgpl-2.1 | 3,393 |
#!/usr/bin/python
"""
XXX: Does not work.
Protocol for ULTRASMART requires some sort of initialization handshake and/or
placing the USB configuration into "self-powered" mode.
"""
import user
import serial
from pprint import pprint, pformat
import insulaudit
from insulaudit.data import glucose
from insulaudit.log i... | bewest/insulaudit | ultrasmart.py | Python | mit | 1,637 |
from settings import *
INSTALLED_APPS.append('basic')
INSTALLED_APPS.append('slashless')
ROOT_URLCONF = 'slashless.api.urls'
APPEND_SLASH = False
TASTEFULPY_ALLOW_MISSING_SLASH = True
| mjschultz/django-tastefulpy | tests/settings_slashless.py | Python | bsd-3-clause | 186 |
import os.path
import datetime
from nose.tools import (assert_equal,
assert_true,
assert_almost_equal,
assert_is)
import numpy as np
from hyperspy.io import load
my_path = os.path.dirname(__file__)
data = np.array([4066., 3996., 3932., 3923., 5... | pburdet/hyperspy | hyperspy/tests/io/test_hdf5.py | Python | gpl-3.0 | 3,266 |
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | jeffery9/mixprint_addons | ineco_sale_make_purchase/wizard/sale_make_purchase.py | Python | agpl-3.0 | 5,830 |
from freelancersdk.session import Session
from freelancersdk.resources.projects import accept_project_bid
from freelancersdk.exceptions import BidNotAcceptedException
import os
# https://developers.freelancer.com/docs/use-cases/performing-a-bid-action
def sample_accept_project_bid():
oauth_token = os.environ.get(... | freelancer/freelancer-sdk-python | examples/accept_project_bid.py | Python | lgpl-3.0 | 774 |
import operator
from bson import ObjectId
from django.conf.urls import url
from django.core.urlresolvers import reverse
from tastypie import http
from tastypie import fields
from tastypie.exceptions import ImmediateHttpResponse
from tastypie.utils import trailing_slash
from api.auth import DocumentsAuthorization
fro... | fatiherikli/dbpatterns | web/dbpatterns/documents/resources.py | Python | mit | 3,863 |
__author__ = 'arobres'
from bottle import run, Bottle, request, response, auth_basic
from collections import defaultdict
import ujson
from sys import argv
app = Bottle()
user_list = []
USER_ATTRIBUTES = {'name', 'username', 'password', 'role', 'email'}
FORUM_ATTRIBUTES = {'theme', 'subject', 'message'}
ROLES = ['QA'... | twiindan/forum | forum/forum.py | Python | gpl-2.0 | 5,157 |
# ------------------------------------------------------------------------------
# This file is part of Appy, a framework for building applications in the Python
# language. Copyright (C) 2007 Gaetan Delannay
# Appy is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public ... | Eveler/libs | __Python__/ufms_blanks/appy3/fields/search.py | Python | gpl-3.0 | 8,383 |
#!/usr/bin/env python2
#
# developed by Sergey Markelov (2013)
#
from __future__ import absolute_import
import HTMLParser
import getopt
import os
import random
import sys
import time
import urllib2
import traceback
from socket import error as SocketError
import errno
file = os.path.realpath(__file__)
sys.path.app... | jungx098/BingRewards | main.py | Python | lgpl-3.0 | 9,936 |
# -*- coding: utf-8 -*-
"""
ulmo.util.raster
~~~~~~~~~~~~~~~~
Collection of useful functions for raster manipulation
"""
from __future__ import print_function
import hashlib
import os
import zipfile
from .misc import download_if_new, mkdir_if_doesnt_exist
def mosaic_and_clip(raster_tiles, xmin, ymin, xmax... | timcera/tsgettoolbox | src/tsgettoolbox/ulmo/util/raster.py | Python | bsd-3-clause | 2,786 |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 27 17:31:34 2015
@author: Sarunya
"""
import sys
import numpy as np
from PIL import Image
from matplotlib import pyplot as plt
import scipy.ndimage
#from scipy.ndimage import filters
#import time
sys.setrecursionlimit(10000)
bs = 200
wd = 8 # theta_range=wd*wd*2
clmax ... | sarunya-w/CS402-PROJECT | Project/feature_extraction/feature_extraction_parallel/fftengine.py | Python | mit | 3,973 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/disk_sku_py3.py | Python | mit | 1,309 |
# coding: utf_8
# 将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。 类似于图中效果
from PIL import Image, ImageDraw, ImageFont
im = Image.open(r'plane.jpg')
w, h = im.size
fs = min(w, h) // 10
ft = ImageFont.truetype(r'seguisym.ttf', size = fs)
dr = ImageDraw.Draw(im)
dr.text((w- fs, 0), '1', font = ft, fill = 0x00FFFF)
im.s... | Ginkgo-Biloba/Misc-Python | Exercise/000.py | Python | gpl-3.0 | 424 |
from __future__ import print_function # makes this work for python2 and 3
import gvar as gv
import corrfitter as cf
def main():
dset = cf.read_dataset('Ds-Ds.h5')
s = gv.dataset.svd_diagnosis(dset, models=make_models())
print('svdcut =', s.svdcut)
s.plot_ratio(show=True)
import importlib
import sys... | gplepage/corrfitter | examples/Ds-Ds-svdcut.py | Python | gpl-3.0 | 906 |
# -*- coding: utf-8 -*-
"""
werkzeug.wrappers
~~~~~~~~~~~~~~~~~
The wrappers are simple request and response objects which you can
subclass to do whatever you want them to do. The request object contains
the information transmitted by the client (webbrowser) and the response
object contains al... | nateprewitt/werkzeug | werkzeug/wrappers.py | Python | bsd-3-clause | 77,011 |
'''
Kaya Baber
Physics 440 - Computational Physics
Assignment 4 - Quantum Simulations
Exploration 1
'''
import numpy as np
from numpy import linalg as LA
import matplotlib.pyplot as plt
#make x array of N intervals, without first and last points, so N-1 points
#make banded matrix using diag and 2nd order central di... | KayaBaber/Computational-Physics | Assignment_4_quantum_simulation/P440_Assign4_Exp1.py | Python | mit | 1,629 |
# -*- coding: utf-8 -*-
#
# Copyright 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should hav... | Katello/katello-cli | src/katello/client/api/package.py | Python | gpl-2.0 | 1,296 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... | quattor/aquilon | lib/aquilon/worker/commands/del_filesystem.py | Python | apache-2.0 | 1,059 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-10-04 20:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("erudit", "0045_auto_20161004_1400"),
]
operations = [
migrations.AlterField(... | erudit/eruditorg | eruditorg/erudit/migrations/0046_auto_20161004_1516.py | Python | gpl-3.0 | 1,035 |
"""
Example of image classification with MLflow using Keras to classify flowers from photos. The data is
taken from ``http://download.tensorflow.org/example_images/flower_photos.tgz`` and may be
downloaded during running this project if it is missing.
"""
import math
import os
import click
import keras
from keras.util... | mlflow/mlflow | examples/flower_classifier/train.py | Python | apache-2.0 | 9,397 |
from django.shortcuts import render, render_to_response
from django.views.generic import DetailView, CreateView
from django.contrib.auth.mixins import LoginRequiredMixin
from . import models
def home(request):
return render(request, 'web/home.html', {
'reddits': models.Reddit.objects.all()})
class WebV... | pista329/django-reddit | code/web/views.py | Python | mit | 494 |
#!/usr/bin/env python
#
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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)
# ... | RedhawkSDR/integration-gnuhawk | qa/tests/qa_pfb_channelizer.py | Python | gpl-3.0 | 4,238 |
#!/usr/bin/env python
import threading
from testutils import unittest, skip_if_no_pg_sleep
import psycopg2
from psycopg2.extensions import (
ISOLATION_LEVEL_SERIALIZABLE, STATUS_BEGIN, STATUS_READY)
import tests
class TransactionTests(unittest.TestCase):
def setUp(self):
self.conn = psycopg2.connect... | Southpaw-TACTIC/Team | src/python/Lib/site-packages/psycopg2/tests/test_transaction.py | Python | epl-1.0 | 8,292 |
"""SRGB color class."""
from ...spaces import RE_DEFAULT_MATCH, Space, GamutBound, OptionalPercent
from ..xyz import XYZ
from ... import util
import re
import math
def lin_srgb_to_xyz(rgb):
"""
Convert an array of linear-light sRGB values to CIE XYZ using sRGB's own white.
D65 (no chromatic adaptation)
... | facelessuser/sublime-markdown-popups | st3/mdpopups/coloraide/spaces/srgb/base.py | Python | mit | 3,574 |
from bs4 import BeautifulSoup
import json
file = 'mock_webpage.html'
line_end_character = '|'
remove_characters = '\n\xa0'
file_contents = open(file).read()
soup = BeautifulSoup(file_contents, 'html.parser')
# print( soup.find_all('span') )
dates = [el.get_text().split(line_end_character)[0] for el in soup.find_all... | Meet-Beagle/dev_phase_first_hackathon | data_retriever/get_json_from_page.py | Python | gpl-3.0 | 952 |
import unittest
from os import remove
from sqlalchemy.orm import Session
from create_database import create_db, Song, Playlist
from factory import (
get_songs, insert_song_into_db, insert_playlist_into_db, get_playlist,
create_song, update_song_id3)
class TestCreateDb(unittest.TestCase):
def setUp(self):... | mileto94/MusicPlayer | test_filling_in_database.py | Python | mit | 3,993 |
#!/usr/bin/env python3
import sys
from mltm.cli import add_entry, show_entries
if __name__ == '__main__':
n = len(sys.argv[1:])
if n == 0:
show_entries()
elif sys.argv[1] == 'add':
add_entry()
else:
show_entries(sys.argv[1])
| sanchopanca/my-long-term-memory | app.py | Python | apache-2.0 | 269 |
#
# Copyright (c) 2013-2016 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# of this distribution and at:
#
# http:... | hirokihamasaki/irma | common/irma/configuration/config.py | Python | apache-2.0 | 855 |
"""
Most of this file is taken from the Django project, which is BSD licensed.
"""
from distutils.core import setup
from distutils.command.install_data import install_data
from distutils.command.install import INSTALL_SCHEMES
import os
import sys
from spotipy import get_version
cmdclasses = {'install_data': install_... | ZenHarbinger/spotipy | setup.py | Python | apache-2.0 | 2,675 |
#!/usr/bin/env python
# $Id: SyntaxAndOutput.py,v 1.1 2006-09-06 09:50:09 skyostil Exp $
"""Syntax and Output tests.
TODO
- #finally
- #filter
- #errorCatcher
- #echo
- #silent
Meta-Data
================================================================================
Author: Tavis Rudd <tavis@damnsimple.... | skyostil/tracy | src/generator/Cheetah/Tests/SyntaxAndOutput.py | Python | mit | 93,995 |
#!/bin/env python
# Automatically translated python version of
# OpenSceneGraph example program "osghangglide"
# !!! This program will need manual tuning before it will work. !!!
import sys
from osgpypp import osg
from osgpypp import osgDB
from osgpypp import osgGA
from osgpypp import osgUtil
from osgpypp import os... | JaneliaSciComp/osgpyplusplus | examples/rough_translated1/osghangglide.py | Python | bsd-3-clause | 307,624 |
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (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.mozilla.org/MPL/
#
# Softwa... | ARL-UTEP-OC/emubox | workshop-manager/bin/VirtualBoxSDK-5.1.20-114628/sdk/bindings/xpcom/python/xpcom/server/__init__.py | Python | gpl-2.0 | 3,609 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Woofer - free open-source cross-platform music player
# Copyright (C) 2015 Milan Herbig <milanherbig[at]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 ... | m1lhaus/woofer | woofer.py | Python | gpl-3.0 | 8,288 |
description = "a module housing checks of DQ summary page functionality"
author = "reed.essick@ligo.org"
#---------------------------------------------------------------------------------------------------
import eventSupervisor.eventSupervisorUtils as esUtils
#--------------------------------------------------... | reedessick/event_supervisor2 | dq/dq.py | Python | mit | 3,882 |
# stdlib, alphabetical
from __future__ import absolute_import
from collections import OrderedDict
import json
# Core Django, alphabetical
from django.conf import settings
from django.db import models
from django.utils import six
from django.utils.translation import ugettext_lazy as _
# Third party dependencies, alpha... | artefactual/archivematica-storage-service | storage_service/locations/models/event.py | Python | agpl-3.0 | 6,733 |
# Yith Library Server is a password storage server.
# Copyright (C) 2014 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# This file is part of Yith Library Server.
#
# Yith Library Server is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as publ... | lorenzogil/yith-library-server | yithlibraryserver/oauth2/utils.py | Python | agpl-3.0 | 2,148 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | hyperized/ansible | lib/ansible/modules/cloud/google/gcp_mlengine_model_info.py | Python | gpl-3.0 | 4,716 |
from typing import Dict
def process_items(prices: Dict[str, float]):
for item_name, item_price in prices.items():
print(item_name)
print(item_price)
| tiangolo/fastapi | docs_src/python_types/tutorial008.py | Python | mit | 171 |
#!/usr/bin/env python
"""
Copyright 2017 ARC Centre of Excellence for Climate Systems Science
author: Scott Wales <scott.wales@unimelb.edu.au>
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
h... | ScottWales/dmpr | test/um/test_um.py | Python | apache-2.0 | 2,353 |
import opcode
### instruction fetching
def fetch_op(iterable):
length = 0
opnum = ord( iterable.next() )
oparg = None
length += 1
if opnum >= opcode.HAVE_ARGUMENT:
oparg = ord(iterable.next()) + ord(iterable.next())*256
length += 2
return (opnum, oparg, length)
def fetch_in... | arizvisa/syringe | lib/pyasm/disassemble.py | Python | bsd-2-clause | 2,551 |
from __future__ import print_function
import requests
from lxml import etree
import pdb
UNIPROT_BASE_URL = "http://uniprot.org/uniprot"
def getUniprotXML(uniprot_id):
"""Using the requests module, obtain a connection
to the Uniprot API"""
uniprot_url = UNIPROT_BASE_URL + '/' + uniprot_id + '.xml'
utf8... | JDRomano2/VenomKB | venomkb/archive/scripts/dbinit_helpers.py | Python | gpl-2.0 | 1,049 |
""""Argo Workflow for building notebook-server-jupyter's OCI image using Kaniko"""
from kubeflow.kubeflow.cd import config, kaniko_builder
def create_workflow(name=None, namespace=None, bucket=None, **kwargs):
"""
Args:
name: Name to give to the workflow. This can also be used to name
th... | kubeflow/kubeflow | py/kubeflow/kubeflow/cd/notebook_servers/notebook_server_jupyter.py | Python | apache-2.0 | 702 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 @threatlead
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This prog... | lixiangning888/whole_project | modules/signatures_merge_tmp/rat_fynloski_mutex.py | Python | lgpl-3.0 | 1,329 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2013, Hiroaki Nakamura <hnakamur@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_versi... | tsdmgz/ansible | lib/ansible/modules/system/hostname.py | Python | gpl-3.0 | 24,751 |
# Copyright (C) 2015 Statoil ASA, Norway.
#
# The file 'test_ecl_init_file.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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 vers... | Ensembles/ert | python/tests/core/ecl/test_ecl_init_file.py | Python | gpl-3.0 | 1,627 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2017 Marcus Comstedt <marcus@mc.pp.se>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the L... | DreamSourceLab/DSView | libsigrokdecode4DSL/decoders/iec/__init__.py | Python | gpl-3.0 | 879 |
n=int(input('Enter any number: '))
if n%2!=0:
n=n+1
for i in range(n):
for j in range(n):
if (i==int(n/2)) or j==int(n/2) or ((i==0)and (j>=int(n/2))) or ((j==0)and (i<=int(n/2))) or ((j==n-1)and (i>=int(n/2))) or ((i==n-1)and (j<=int(n/2))):
print('*',end='')
else:
... | rohitjogson/pythonwork | assign27.09.py | Python | gpl-3.0 | 355 |
import asyncio
import time
import random
import string
class ASyncDHash(object):
def __init__(self):
self.nodes = [ASyncNodes('#1'), ASyncNodes('#2')]
async def read(self, key):
if key % 2 == 0:
await self.nodes[0].read(key)
else:
await self.nodes[1].read(key)
async def write(self, key, value):
if ... | gudnm/dhash | asdhash.py | Python | mit | 1,453 |
"""contains classes in order to faciliate scripting the PyContact package."""
from PyContact.core.ContactAnalyzer import *
from PyContact.core.DataHandler import DataHandler
class JobConfig:
"""Configuration/Settings for a PyContact contact analysis job"""
def __init__(self, cutoff, hbondcutoff, hbondcutangle... | maxscheurer/pycontact | PyContact/core/Scripting.py | Python | gpl-3.0 | 1,812 |
from django.core.urlresolvers import reverse
from django.db import models
from .ref import verse_from_bcv, verse_range_title
def parse_as_dict(parse):
return {
label: parse[i]
for i, label in enumerate([
"person", "tense", "voice", "mood", "case", "number", "gender", "degree"
... | morphgnt/morphgnt-api | morphgnt_api/models.py | Python | mit | 6,250 |
from bs4 import BeautifulSoup
import urllib.request
import MySQLdb
db = MySQLdb.connect(user="", passwd="", db="")
c = db.cursor()
c.execute("SELECT id, name FROM heroes WHERE active=1")
heroes = c.fetchall()
for hero_id, hero_name in heroes:
hero_url = 'https://www.dota2.com/hero/'+str(hero_name).replace(' ', '_').... | Vilkku/Dota-2-Hero-Parser | dota2parser.py | Python | mit | 837 |
from cbagent.collectors.libstats.atopstats import AtopStats
from cbagent.collectors import Collector
class Atop(Collector):
COLLECTOR = "atop"
METRICS = ("beam.smp_rss", "memcached_rss", "beam.smp_vsize",
"memcached_vsize", "beam.smp_cpu", "memcached_cpu")
def __init__(self, settings):
... | vmx/cbagent | cbagent/collectors/atop.py | Python | apache-2.0 | 2,625 |
# coding: utf-8
from __future__ import unicode_literals
import weakref
from wxpy.api.consts import SYSTEM
class Registered(list):
def __init__(self, bot):
"""
保存当前机器人所有已注册的消息配置
:param bot: 所属的机器人
"""
super(Registered, self).__init__()
self.bot = weakref.proxy(bot... | youfou/wxpy | wxpy/api/messages/registered.py | Python | mit | 2,720 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | nop33/indico | indico/modules/categories/compat.py | Python | gpl-3.0 | 1,902 |
"""Hot Reload Logic."""
# This code was copied from the werkzeug project
# Project: https://palletsprojects.com/p/werkzeug/
#
# Original License
# Copyright 2007 Pallets
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#... | sedders123/phial | phial/_reloader.py | Python | mit | 12,984 |
from .quantity import Quantity
class PowerMixin(Quantity):
quantity = 'power'
quantity_label = 'Power'
quantity_units = 'W'
is_power = True
# TODO: the units are not power in some of the transform domains.
# For example, in the Fourier domain V * I has units of V/Hz * A/Hz
# which is equi... | mph-/lcapy | lcapy/powermixin.py | Python | lgpl-2.1 | 403 |
import urllib
from behance_python import ENDPOINTS, url_join
from behance_python.behance import Behance
class WIP(Behance):
def __init__(self, wip_id, auth_key):
#super(Behance, self).__init__(auth_key)
Behance.__init__(self, auth_key)
self.wip_id = wip_id
self.base_url = url_join(... | aravenel/behance_python | behance_python/wip.py | Python | mit | 1,300 |
import asyncio
import time
import engineio
loop = asyncio.get_event_loop()
eio = engineio.AsyncClient()
start_timer = None
async def send_ping():
global start_timer
start_timer = time.time()
await eio.send('ping')
@eio.on('connect')
async def on_connect():
print('connected to server')
await sen... | miguelgrinberg/python-engineio | examples/client/asyncio/latency_client.py | Python | mit | 713 |
from django.conf.urls import patterns, url, include
from django.contrib import admin
from views import hello, current_datetime, hours_ahead, current_datetime_render, display_meta, requires_login
from books import views
from contact import views as cviews
admin.autodiscover()
urlpatterns = patterns('',
... | fbreversg/django_playing | book/urls.py | Python | mit | 1,642 |
# 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/security/azure-mgmt-security/azure/mgmt/security/operations/_external_security_solutions_operations.py | Python | mit | 11,860 |
import os
import numpy as np
import nibabel as nb
import nighresjava
from ..io import load_volume, save_volume
from ..utils import _output_dir_4saving, _fname_4saving
def levelset_curvature(levelset_image, distance=1.0,
save_data=False, overwrite=False, output_dir=None,
... | nighres/nighres | nighres/surface/levelset_curvature.py | Python | apache-2.0 | 4,723 |
import json
class NoEndpointResource:
def on_get(self, req, resp, endpoint_type=None, table=None, catch=None):
if endpoint_type is None:
resp.body = json.dumps({"status": "fail", "message": "Missing endpoint type"})
elif endpoint_type != 'd' and endpoint_type != 'p':
resp.... | snclucas/stashy | NoEndpointResource.py | Python | mit | 1,447 |
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2012-2013 IBM Corp.
# 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/li... | tianweizhang/nova | nova/tests/db/test_migrations.py | Python | apache-2.0 | 26,782 |
__author__ = 'trampfox'
| trampfox/nimbus-phantom-rest-client | tests/__init__.py | Python | apache-2.0 | 24 |
# Program to convert data files in
# pymbar/trunk/examples/alchemical-free-energy/data to format of data files
# produced by GROMACS 4.6 so that data files will work with updated
# alchemical-analysis.py
import commands
from os import remove
from shutil import move
# This program must be called from the folder that... | MobleyLab/alchemical-analysis | samples/gromacs/data/convertdata.py | Python | mit | 1,590 |
import numpy as np
import cv2 as cv
from skimage.filters.rank import entropy
from skimage.morphology import disk
import matplotlib.pyplot as plt
from sklearn import svm
# Use 'Minarawala_trainvideo_03.mp4' and 'Minarawala_trainimage_04.jpg' together
# Use 'Minarawala_trainvideo_01.mp4' and 'Minarawala_traini... | kush100993/Parking_space_detection_and_tracking | Minarawala_code2_04.py | Python | gpl-3.0 | 2,434 |
#-*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring communication protocols... | dasbruns/netzob | src/netzob/Common/Models/Vocabulary/Domain/Variables/Nodes/Rep.py | Python | gpl-3.0 | 4,596 |
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='isholiday',
version='0.1',
description='Finds Czech holiday for given year',
author='Ondřej Caletka',
author_email='ondrej@caletka.cz',
license='Public Domain',
url='https://gist.github.com/oskar456/e91ef3ff77476b0dbc4ac19875... | fedora-python/pyp2rpm | tests/test_data/isholiday-0.1/setup.py | Python | mit | 362 |
# Copyright 2014, Tresys Technology, LLC
#
# This file is part of SETools.
#
# SETools is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
... | TresysTechnology/setools | tests/rolequery.py | Python | lgpl-2.1 | 2,626 |
#
# 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... | wileeam/airflow | airflow/contrib/operators/wasb_delete_blob_operator.py | Python | apache-2.0 | 1,213 |
import requests
from lxml import html
from podcasts.itunes import get_series_by_ids
# SeriesCrawler, to get series from a particular webpage
class SeriesCrawler(object):
def __init__(self, url=''):
self.url = url
self.ids = []
def set_url(self, url):
self.url = url
def _e_to_id(self, e): # href el... | Jma353/py-podcast | podcasts/series_crawler.py | Python | mit | 923 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 NovaPoint Group LLC (<http://www.novapointgroup.com>)
# Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>)
#
# This program is f... | ryepdx/hotp_stock | product_bin_location.py | Python | agpl-3.0 | 3,759 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, subprocess, sys
sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), "..", "..", "..", "..", "..", "tools"))
import traci, sumolib
sumoBinary = sumolib.checkBinary('sumo-gui')
sumoProcess = subprocess.Popen("%s -S -Q -c sumo.sumocfg" % (sumoBinary), shell... | cathyyul/sumo-0.18 | tests/complex/traci/pythonApi/polygon/runner.py | Python | gpl-3.0 | 1,012 |
from ditutils.core import setup
setup(
name = 'morpheusapi',
packages = ['morpheusapi'],
version = '2.11.1',
description = 'A python wrapper for Morpheus APIs',
author = 'Adam Hicks',
author_email = 'thomas.adam.hicks@gmail.com',
url = 'https://github.com/tadamhicks/morpheus-python',
dow... | tadamhicks/morpheus-python | setup.py | Python | mit | 480 |
from django.views import defaults
def page_not_found(request):
"""Handle the server_error view"""
return defaults.page_not_found(request, template_name='dh5bp/404.html')
def server_error(request):
"""Handle the server_error view"""
return defaults.server_error(request, template_name='dh5bp/500.html'... | alexjh/whatson | django-view/whatson/dh5bp/views.py | Python | gpl-2.0 | 321 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import pickle
import random
import bisect
import operator
import functools
import itertools
from math import log
from .common_surnames import d as common_surnames
from .lookuptable import chrevlookup, pinyintrie, surnamerev
for py in tuple(chrevlookup.keys()):... | gumblex/tg-chatdig | vendor/chinesename.py | Python | mit | 6,353 |
#!/usr/bin/env python
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __fu... | facebookincubator/mvfst | build/fbcode_builder_config.py | Python | mit | 1,378 |
"""An XBlock providing thumbs-up/thumbs-down voting.
"""
from xblock.core import XBlock, Scope, Integer, Boolean
from xblock.fragment import Fragment
from xblock.problem import InputBlock
import pkg_resources
import logging
log = logging.getLogger(__name__)
class ThumbsBlock(InputBlock):
"""
An XBlock with ... | avontd2868/xblock-thumbs | thumbs.py | Python | agpl-3.0 | 2,798 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('info_transportation', '0009_stop_time_needed'),
]
operations = [
migrations.AddField(
model_name='line',
... | ojarva/home-info-display | homedisplay/info_transportation/migrations/0010_line_only_show_next.py | Python | bsd-3-clause | 522 |
from django import VERSION as DJANGO_VERSION
from django.db import transaction, connection
from django.test import SimpleTestCase
from django_hstore.fields import HStoreDict
from django_hstore_tests.models import DataBag
class TestNotTransactional(SimpleTestCase):
if DJANGO_VERSION[:2] >= (1, 8):
def se... | Stranger6667/django-hstore | tests/django_hstore_tests/tests/test_not_transactional.py | Python | mit | 1,655 |
"""This module contains api preprocessors and the api configuration."""
from flask_restless import ProcessingException
from flask_login import current_user
from server.forms import RegistrationForm
from server.models import User, Category, Event, EventSubscription
from server.logger import log
def add_current_user(d... | bnotified/api | server/api.py | Python | mit | 6,379 |
from regparser.diff.text import get_opcodes
from regparser.tree import struct
ADDED = 'added'
MODIFIED = 'modified'
DELETED = 'deleted'
def _local_changes(lhs, rhs):
"""Account for only text changes between nodes. This explicitly excludes
children"""
if lhs.text == rhs.text and lhs.title == rhs.title:
... | willbarton/regulations-parser | regparser/diff/tree.py | Python | cc0-1.0 | 3,369 |
#!/usr/bin/python
# (c) 2016, NetApp, 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
# (at your option) any later version.... | britcey/ansible | lib/ansible/modules/storage/netapp/netapp_e_lun_mapping.py | Python | gpl-3.0 | 12,380 |
## transports.py
##
## Copyright (C) 2003-2005 Alexey "Snake" Nezhdanov
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later versi... | grompe/magnet2 | xmpp/dispatcher.py | Python | gpl-3.0 | 17,974 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/iou/ui/iou_preferences_page.ui'
#
# Created: Tue Mar 17 18:49:46 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import Q... | noplay/gns3-gui | gns3/modules/iou/ui/iou_preferences_page_ui.py | Python | gpl-3.0 | 7,930 |
""" admin api to allow management of streams and event schemata """
from cyclone.jsonrpc import JsonrpcRequestHandler
from txbitwrap.event.dispatch import Dispatcher
from txbitwrap.api import headers
import txbitwrap
import txbitwrap.machine as pnml
import txbitwrap.storage.postgres as pgsql
class Rpc(headers.Mixin, ... | stackdump/txbitwrap | txbitwrap/api/rpc.py | Python | mit | 1,615 |
import unittest
from unittest import mock
from unittest.mock import Mock
import lss.configurators.extras
class TestExtrasConfiguratorMethods(unittest.TestCase):
def test_set_up_installs_packages(self):
package_manager = Mock()
configurator = lss.configurators.extras.ExtrasConfigurator()
... | IgWod/linux-setup-scripts | test/configurators/extras.py | Python | mit | 641 |
# -*- coding: utf-8 -*-
"""
Chirptext's enhanced IO functions
"""
# This code is a part of chirptext library: https://github.com/letuananh/chirptext
# :copyright: (c) 2012 Le Tuan Anh <tuananh.ke@gmail.com>
# :license: MIT, see LICENSE for more details.
import csv
import gzip
import logging
import os
# ------------... | letuananh/chirptext | chirptext/chio.py | Python | mit | 8,225 |
#!/usr/bin/python
#
# Example script on how to modify a single Nagios service
from pynag import Model
import sys
# Parse commandline arguments
if len(sys.argv) != 5:
print '''
Usage:
%s <host_name> <service_description> <field_name> <new_value>
Example:
%s localhost Ping check_command 'check_ping'
''' % (sys... | llange/pynag | examples/Model/edit_service.py | Python | gpl-2.0 | 873 |
from __future__ import print_function
import os, logging, argparse
from path import path
from ConfigParser import RawConfigParser
# Specify the default ini file
INI_FILE='~/.mlapse'
# Setup some text based log levels to use for input
LOG_LEVELS = { 'debug': logging.DEBUG, 'info': logging.INFO, 'warning': logging.WAR... | chawkinsuf/motion-lapse | app/setup.py | Python | mit | 2,362 |
from __future__ import unicode_literals
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
# Create your models here.
from django.db.models import Q
from river.models.fields.state import StateField
from myModule.cls... | Pandaaaa906/ChemErpSystem | Produce_manage/models.py | Python | apache-2.0 | 1,744 |
import re
import logging
from praw.errors import Forbidden
from images_of import AcceptFlag
LOG = logging.getLogger(__name__)
class Match:
def __init__(self, reason, detail):
self.reason = reason
self.detail = detail
class Subreddit:
def __init__(self, name, search, feeds=[], ignore=None,... | amici-ursi/ImagesOfNetwork | images_of/subreddit.py | Python | mit | 4,035 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.