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 |
|---|---|---|---|---|---|
"""Build in connectors.
Connectors have to implement `process_request`.
"""
from .errors import HTTPError
try:
import aiohttp
import asyncio
class AHConnector:
"""Connector implementation using aiohttp."""
def __init__(self, sess=None, loop=None):
self.loop = loop or asyncio.... | Phxntxm/osuapi | osuapi/connectors.py | Python | mit | 2,424 |
"""
@package mi.instrument.rbr.xr-420_thermistor_24.ooicore.driver
@file /Users/Bill/WorkSpace/marine-integrations/mi/instrument/rbr/xr-420_thermistor_24/ooicore/driver.py
@author Bill Bollenbacher
@brief Driver for the RBR Thermistor String (24 thermistors)
Release notes:
initial release
"""
import time
import re
im... | janeen666/mi-instrument | mi/instrument/rbr/xr_420_thermistor_24/ooicore/driver.py | Python | bsd-2-clause | 90,876 |
#!/usr/bin/python
#
# Copyright (c) 2015, Arista Networks, 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,
# t... | steve-dodd/pynet | class6/library/eos_bgp_config.py | Python | gpl-2.0 | 14,323 |
"""Interactive map entities/players!
Note:
Could even be something like a sign! Or the human player.
"""
import pygame
from hypatia import constants
from hypatia import actor
class HumanPlayer(actor.Actor):
def __init__(self, *args, **kwargs):
actor.Actor.__init__(self, *args, **kwa... | Applemann/hypatia | hypatia/player.py | Python | mit | 2,943 |
#!/usr/bin/env ambari-python-wrap
'''
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 (th... | arenadata/ambari | ambari-server/src/main/python/ambari_server/BackupRestore.py | Python | apache-2.0 | 6,601 |
from dataclasses import dataclass
import dataclasses
from typing import Dict, Optional, Tuple
from frozendict import frozendict
from randovania.game_description.item.item_category import ItemCategory
from randovania.game_description.resources.pickup_index import PickupIndex
from randovania.games.game import Randovani... | henriquegemignani/randovania | randovania/game_description/item/major_item.py | Python | gpl-3.0 | 2,756 |
"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.... | TechInvestLab/dot15926 | editor_qt/iso15926/io/rdfxml_writer.py | Python | lgpl-3.0 | 9,297 |
"""Faça um programa que carregue uma lista com os modelos de cinco carros (exemplo de modelos: FUSCA, GOL, VECTRA etc).
Carregue uma outra lista com o consumo desses carros, isto é, quantos quilômetros cada um desses carros faz com um litro
de combustível. Calcule e mostre:
O modelo do carro mais econômico;
Qu... | jucimarjr/IPC_2017-1 | lista06/lista06_lista01_questao21.py | Python | apache-2.0 | 2,450 |
"""
TestCases for checking set_get_returns_none.
"""
import sys, os, string
import tempfile
from pprint import pprint
import unittest
try:
# For Python 2.3
from bsddb import db
except ImportError:
# For earlier Pythons w/distutils pybsddb
from bsddb3 import db
from test_all import verbose
#--------... | trivoldus28/pulsarch-verilog | tools/local/bas-release/bas,3.9/lib/python/lib/python2.3/bsddb/test/test_get_none.py | Python | gpl-2.0 | 2,233 |
# -*- coding: utf-8 -*-
import random
import time
import gevent
from celery import Celery
from gevent.pool import Pool
from gevent.timeout import Timeout, with_timeout
import sys
class TimeOutException(Exception):
pass
app = Celery('with_celery', broker='amqp://guest@localhost//')
@app.task
def add(x, y):
p... | gmaclinuxer/pyabs | test/test_with_celery.py | Python | mit | 4,114 |
# -*- coding: utf-8 -*-
"""
This module contains tags for including react components into templates.
"""
import uuid
from django import template
from django.conf import settings
from django.template import Node
register = template.Library()
CONTEXT_KEY = "REACT_COMPONENTS"
CONTEXT_PROCESSOR = 'django_react_templat... | ssteinerx/django-react-templatetags | django_react_templatetags/templatetags/react.py | Python | mit | 3,500 |
from django.core.urlresolvers import resolve
from django.http import HttpRequest
from django.http import QueryDict
from django.test import TestCase
from django.test import Client
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from landpage.views import terms
impo... | AcademicsToday/py-academicstoday | academicstoday_project/landpage/tests/test_terms.py | Python | apache-2.0 | 1,259 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of level.
# https://github.com/heynemann/level
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT-license
# Copyright (c) 2016, Bernardo Heynemann <heynemann@gmail.com>
from unittest import TestCase as PythonTestCase
from torn... | heynemann/level | tests/unit/base.py | Python | mit | 845 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
components/tools/OmeroPy/omero/util/UploadMask.py
-----------------------------------------------------------------------------
Copyright (C) 2006-2009 University of Dundee. All rights reserved.
This program is free software; you can redistribute it and/or modif... | bramalingam/openmicroscopy | components/tools/OmeroPy/src/omero/util/uploadMask.py | Python | gpl-2.0 | 8,488 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | tonybaloney/st2 | st2common/st2common/services/datastore.py | Python | apache-2.0 | 8,753 |
# coding: utf-8
#
# Copyright 2021 The Oppia 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 requi... | brianrodri/oppia | core/jobs/transforms/validation/question_validation.py | Python | apache-2.0 | 3,458 |
from setuptools import setup, find_packages
setup(name='alfred',
version="0.3",
author="Mike Spindel",
author_email="mike@spindel.is",
license="MIT",
keywords="alfred alfredapp script filter",
url="http://github.com/deactivated/python-alfred",
description='Utilities for Alfre... | deactivated/python-alfred | setup.py | Python | mit | 674 |
import angr
from angr.sim_type import SimTypeFd, SimTypeTop
from ..libc import io_file_data_for_arch
import logging
l = logging.getLogger("angr.procedures.posix.fileno")
######################################
# fileno
######################################
class fileno(angr.SimProcedure):
#pylint:disable=argu... | f-prettyland/angr | angr/procedures/posix/fileno.py | Python | bsd-2-clause | 865 |
# Copyright (c) 2013 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 agreed to ... | netscaler/neutron | neutron/tests/unit/mlnx/test_mlnx_security_group.py | Python | apache-2.0 | 4,391 |
#!/usr/bin/env python3
import re
from collections import Counter
def minutes_per_guard():
"""Return a dictionary with each minute spent sleeping for each guard.
Repeating
E.g. {
10: [5, 6, 7, ..., 53, 54, 24, 25, 26, 27, 28],
99: [40, 41, 42, ..., 48, 49, 36, 37, ..., 48, 49, 50, 51, 52,... | YouriAckx/AdventOfCode | 2018/day04/day04.py | Python | gpl-3.0 | 1,826 |
#!/usr/bin/env python
# Licensed under the Apache 2.0 License
'''
Deletes a user from the database
Usage: deleteuser username
The environment variable LIGHTS_WEB_DATABASE must be set to the path of the database
Created on Nov 13, 2014
@author: Gary O'Neall
'''
import sys
import sqlite3
from hashlib import... | goneall/PiLightsWebServer | src/deleteuser.py | Python | apache-2.0 | 1,246 |
def extractForthemoneyTranslations(item):
"""
Forthemoney Translations
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
return False
| fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractForthemoneyTranslations.py | Python | bsd-3-clause | 249 |
#!/usr/bin/python3
# counting_sheeps.py
# Returns the count of true values of an array.
#
# Written by Billy Wilson Arante <arantebillywilson@gmail.com>
# Last updated on 2017/11/24 PHT
def counting_sheeps(arr_of_sheeps):
count = 0
for i in arr_of_sheeps:
if (i == True):
count += 1
re... | arantebillywilson/python-snippets | codewars/counting_sheeps.py | Python | mit | 459 |
import time
import RPi.GPIO as GPIO
import sys
# the red led cathode is wired to pin 22 of the expansion header
# the yellow led cathode is wired to pin 18 of the expansion header
# the green led cathode is wired to pin 16 of the expansion header
REDLED = 22
YELLOWLED = 18
GREENLED = 16
# set up control for the chan... | timroster/gamma-rover | led.py | Python | mit | 910 |
def counter():
print 'counter: starting counter'
i = -3
while i < 3:
i = i + 1
print 'counter: yield', i
yield i
if __name__ == '__main__':
print "the generator function:"
print repr(counter)
print "call generator function"
c = counter()
print "the generator:"... | AmandaMoen/AmandaMoen | notes/resources/UW_IntroClass/class08/code/yield_example.py | Python | gpl-2.0 | 411 |
"""This module only works as a central point for importing logging that outputs to stdout
"""
"""
Copyright (c) 2015, Are Hansen - Honeypot Development.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:... | ZombieNinjaPirate/HonSSH-utilities | bifrozt/functions/std.py | Python | gpl-2.0 | 1,728 |
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/charts/linecharts.py
__version__=''' $Id: linecharts.py 3604 2009-11-27 16:35:29Z meitham $ '''
__doc__="""This modules defines a very prelim... | fergalmoran/Chrome2Kindle | server/reportlab/graphics/charts/linecharts.py | Python | mit | 23,114 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-19 14:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('landing', '0004_plan_unlimited_users'),
]
operations = [
migrations.AlterFie... | HeaTSolutions/CatracaDigital | CatracaDigital/landing/migrations/0005_auto_20160619_1124.py | Python | mit | 485 |
from django.conf.urls import patterns, include, url
from consumption import views
urlpatterns = patterns(
'',
url(r'^/?$', views.main),
)
| tbarbette/monitoring | consumption/urls.py | Python | gpl-2.0 | 159 |
#!/usr/bin/python3
# Copyright 2018 The Tulsi 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 requ... | bazelbuild/tulsi | src/TulsiGenerator/Scripts/symbol_cache_schema_tests.py | Python | apache-2.0 | 1,667 |
from .util import escape, escape_html
class BaseRenderer(object):
NAME = 'base'
def __init__(self):
self._methods = {}
def register(self, name, method):
self._methods[name] = method
def _get_method(self, name):
try:
return object.__getattribute__(self, name)
... | lepture/mistune | mistune/renderers.py | Python | bsd-3-clause | 6,095 |
# -*- coding: utf-8 -*-
########################################
### Minecraft Server Maker #############
### Create Your Own Minecraft Server ###
########################################
from commun import *
import os
import subprocess as sub
if os.path.isfile("install.py"):
os.remove("install.py")
else:
pass
... | dinnozap/MinecraftServerMaker | main.py | Python | apache-2.0 | 973 |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 26 19:32:49 2018
@author: JinJheng
"""
x,y=map(int,input().split(','))
m,n=map(int,input().split(','))
if n > y:
greater = n
else:
greater = y
while(True):
if((greater % n == 0) and (greater % y == 0)):
q = greater
break
... | KuKuKai/104asiajava | 509.py | Python | mit | 712 |
import gameconfig
from random import randint
class SoundPlayer:
def __init__(self, sound_arg, **kwargs):
if gameconfig.SOUND:
from pygame import mixer
self.mixer = mixer
self.mixer.init()
init_loop = kwargs.get('loop', False)
if type(sound_arg) is... | nerdyLawman/officeHack | src/sound/SoundPlayer.py | Python | gpl-3.0 | 1,632 |
"""
Sarsa is a online updating method for Reinforcement learning.
Unlike Q learning which is a offline updating method, Sarsa is updating while in the current trajectory.
You will see the sarsa is more coward when punishment is close because it cares about all behaviours,
while q learning is more brave because it only ... | DaniellaAngel/MachineLearning | DQN/run_this.py | Python | apache-2.0 | 1,923 |
#! /usr/bin/env python
# Test program for jaxml
#
# (C) Jerome Alet <alet@librelogiciel.com> 2000
# You're welcome to redistribute this software under the
# terms of the GNU General Public Licence version 2.0
# or, at your option, any higher version.
#
# You can read the complete GNU GPL in the file COPYING
# which sho... | denys-duchier/Scolar | config/softs/jaxml-3.01/test/test.py | Python | gpl-2.0 | 9,215 |
# -*- coding: utf-8 -*-
# Scrapy settings for maiziedu_spider project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedo... | ejoful/scrapy_example | maiziedu_spider/maiziedu_spider/settings.py | Python | gpl-3.0 | 5,476 |
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the... | Dhivyap/ansible | test/units/modules/network/fortios/test_fortios_user_quarantine.py | Python | gpl-3.0 | 5,350 |
# -*- coding: utf-8 -*-
"""
Optimization algorithms for OT
"""
# Author: Remi Flamary <remi.flamary@unice.fr>
# Titouan Vayer <titouan.vayer@irisa.fr>
#
# License: MIT License
import numpy as np
from scipy.optimize.linesearch import scalar_search_armijo
from .lp import emd
from .bregman import sinkhorn
# The... | rflamary/POT | ot/optim.py | Python | mit | 12,806 |
"""
A simple console for playing with the tango parser
"""
import sys
import os
if __name__ == "__main__":
tangodir = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)
sys.path.append(tangodir)
import tangolib.parser
def process_command(cmd):
if cmd == ":quit":
print("bye bye ... | fredokun/tango | src/tangolib/parser_console.py | Python | mit | 862 |
from kivy.uix.bubble import Bubble
from kivy.properties import StringProperty
from kivy.clock import Clock
from kivy.animation import Animation
from kivy.core.window import Window
class InfoBubble(Bubble):
'''Bubble to be used to display short Help Information'''
message = StringProperty('')
'''Message t... | 5y/kivy-designer | designer/uix/info_bubble.py | Python | mit | 1,646 |
import json
from util import hook, http
@hook.command(autohelp=False)
def mcstatus(inp):
"""mcstatus -- Checks the status of various Mojang (the creators of Minecraft) servers."""
try:
request = http.get("http://status.mojang.com/check")
except (http.URLError, http.HTTPError) as e:
retur... | Red-M/CloudBot-legacy | plugins/minecraft_status.py | Python | gpl-3.0 | 1,296 |
from csc.divisi.tensor import Tensor
import tables
from itertools import izip, count
from csc.divisi.pyt_utils import get_pyt_handle
# I noticed the following in the user manual: "Note that, from
# PyTables 1.1 on, you can nest several iterators over the same
# table." This looks worrisome; we may want to avoid retur... | commonsense/divisi | csc/divisi/pt_tensor.py | Python | gpl-3.0 | 8,119 |
# Copyright (c) 2012 Rackspace Hosting
# All Rights Reserved.
# 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/license... | redhat-openstack/nova | nova/cells/rpc_driver.py | Python | apache-2.0 | 7,115 |
# open the genomic dna file and read the contents
genomic_dna = open("genomic_dna.txt").read()
# open the exons locations file
exon_locations = open("exons.txt")
# create a variable to hold the coding sequence
coding_sequence = ""
# go through each line in the exon locations file
for line in exon_locations:
# s... | ianmisner/BIO309_Spring2017 | week4/from_the_book/multiple_exons_from_genomic_dna.py | Python | gpl-3.0 | 803 |
import os
import unittest
from vsg.rules import variable
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_011_test_input.vhd'))
lExpected = []
lExpected.append('')
utils.read_file(os.path.join(sTestDir,... | jeremiah-c-leary/vhdl-style-guide | vsg/tests/variable/test_rule_011.py | Python | gpl-3.0 | 1,178 |
# 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... | ghchinoy/tensorflow | tensorflow/python/keras/model_subclassing_test.py | Python | apache-2.0 | 44,884 |
__author__ = 'jwright'
# Text and pictures tutorial
# http://pythonprogramming.net/tkinter-adding-text-images/
import Tkinter as tk
import Tkconstants, tkFileDialog
from Tkinter import *
class Tkbrut(tk.Frame):
def __init__(self, brut):
tk.Frame.__init__(self, brut)
def quit_win(self):
brut.destroy... | COCS4950G7/COSC4950 | Source/GUI/frameGUI_BRUT.py | Python | gpl-3.0 | 544 |
import pygame
import pygameMenu
from game_logic import helper
class SettingsMenu(object):
def __init__(self, screen):
"""
Constructor. Receives the screen to be able to draw
the menu and creates the different configuration widgets
"""
# Settings menu
self.__setting... | juangallostra/TicTacToe | src/game_logic/settings_menu.py | Python | mit | 2,753 |
'''
In this exercise you need to know how to set joint commands.
* Tasks:
1. set stiffness of LShoulderPitch to 0
2. set speed of HeadYaw to 0.1
* Hint: The commands are stored in action (class Action in spark_agent.py)
'''
# add PYTHONPATH
import os
import sys
sys.path.append(os.path.join(os.path.abspath(o... | DAInamite/programming-humanoid-robot-in-python | introduction/set_joint_commands.py | Python | gpl-2.0 | 647 |
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM 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 Founda... | jerome-nexedi/dream | dream/simulation/CoreObject.py | Python | gpl-3.0 | 47,086 |
from vt_manager.communication.sfa.rspecs.elements.element import Element
class Execute(Element):
fields = [
'shell',
'command',
]
| dana-i2cat/felix | vt_manager/src/python/vt_manager/communication/sfa/rspecs/elements/execute.py | Python | apache-2.0 | 155 |
#!/usr/bin/env python
#
# Appcelerator Titanium Module Packager
#
#
import os, subprocess, sys, glob, string, optparse, subprocess
import zipfile
from datetime import date
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
os.chdir(cwd)
required_module_keys = ['name','version','moduleid','desc... | titanium-forks/appcelerator-modules.ti.touchid | ios/build.py | Python | apache-2.0 | 8,826 |
import pyxel
from pyxel.ui.constants import WIDGET_HOLD_TIME, WIDGET_REPEAT_TIME
class FieldCursor:
def __init__(
self,
data_getter,
pre_history_setter,
post_history_setter,
data_max_length,
data_view_length,
data_count,
):
self._get_data = data_... | ferriman/SSandSP | pyxel-test/venv/lib/python3.8/site-packages/pyxel/editor/field_cursor.py | Python | gpl-3.0 | 3,620 |
#!/usr/bin/python3
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from SettingsWidgets import SidePage
from xapp.GSettingsWidgets import *
class Module:
comment = _("Control mouse and touchpad settings")
name = "mouse"
category = "hardware"
def __init__(self, co... | glls/Cinnamon | files/usr/share/cinnamon/cinnamon-settings/modules/cs_mouse.py | Python | gpl-2.0 | 7,459 |
# each GM builds a Team() to gain them the most points possible this season
from sys import exit
class Team(list):
"""Busiest Class in the program. Subclass of list() Object.
The application's goal is to make the best Team() (i.e. the team with
the most points by the end of the season). Object holds rost... | aspic2/firstDraft | firstDraft/team.py | Python | gpl-3.0 | 7,183 |
from VanishingPoint import *
import os
import time
from dronekit import connect, VehicleMode, LocationGlobal, LocationGlobalRelative
from pymavlink import mavutil # Needed for command message definitions
def arm_and_takeoff(aTargetAltitude):
"""
Arms vehicle and fly to aTargetAltitude.
"""
print "Basi... | naitikshukla/drone | vanish_point/mainv1.py | Python | unlicense | 11,986 |
import multiprocessing as mp
import pytest
from manageiq_client.api import ManageIQClient as MiqApi
from cfme import test_requirements
from cfme.infrastructure.provider import InfraProvider
from cfme.markers.env_markers.provider import ONE
from cfme.rest.gen_data import automation_requests_data as _automation_request... | RedHatQE/cfme_tests | cfme/tests/infrastructure/test_rest_automation_request.py | Python | gpl-2.0 | 13,910 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | xdevelsistemas/taiga-back-community | taiga/projects/history/api.py | Python | agpl-3.0 | 7,344 |
"""
This module converts requested URLs to callback view functions.
RegexURLResolver is the main class here. Its resolve() method takes a URL (as
a string) and returns a ResolverMatch object which provides access to all
attributes of the resolved URL match.
"""
import functools
import re
import threading
from importli... | ifduyue/django | django/urls/resolvers.py | Python | bsd-3-clause | 21,041 |
# -*- coding: utf-8 -*-
from PIL import Image
def get_target_size(img_size, size, exact_size=False):
assert img_size[0] and img_size[1]
assert size[0] or size[1]
size = list(size)
if not size[0]:
size[0] = size[1] * img_size[0] // img_size[1]
if not size[1]:
size[1] = size[0] * im... | codeif/crimg | crimg/api.py | Python | mit | 2,205 |
import pytest
import pytz
from dateutil import parser
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.log_validator import LogValidator
@pytest.mark.tier(2)
@pytest.mark.uncollectif(lambda appliance: appliance.version < '5.9')
def test_configure_vmdb_last_start_time(appliance):
""... | lkhomenk/integration_tests | cfme/tests/configure/test_database_ui.py | Python | gpl-2.0 | 2,269 |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2014 Dean Jackson <deanishe@deanishe.net>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2014-03-07
#
"""
Generate a ReST table of icons in :mod:`workflow.workflow` with previews.
"""
from __future__ import print_function, unicode_lit... | JT5D/Alfred-Popclip-Sublime | latest/alfred-workflow-master/gen_icon_table.py | Python | gpl-2.0 | 1,451 |
""" import the necessary modules """
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy.sql import text
# Create a class that will give us an object that we can use to connect to a database
class MySQLConnection(object):
def __init__(self, app, db):
config = {
'host': 'localhost',
... | authman/Python201609 | Guerrero_Melissa/flask_mysql/mysqlconnection.py | Python | mit | 1,977 |
# Copyright 2014 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 unittest
from telemetry.core.platform.power_monitor import android_ds2784_power_monitor
class DS2784PowerMonitorMonitorTest(unittest.TestCase):
d... | sgraham/nope | tools/telemetry/telemetry/core/platform/power_monitor/android_ds2784_power_monitor_unittest.py | Python | bsd-3-clause | 884 |
from Tkinter import *
import PIL.Image
from PIL import ImageTk
WIDTH = 1366#3286#
HEIGHT = 768#1440#
# TODO: add multi-monitor support (figure out dimension of current monitor)
def init(window):
'''
global WIDTH, HEIGHT
WIDTH = window.winfo_screenwidth() #1366
HEIGHT = window.winfo_screenheight() #768
print ... | tannerbohn/RandomAttraction | graphicsTools.py | Python | gpl-2.0 | 3,697 |
"""
Tiny framework used to power LWR application, nothing in here is specific to running
or staging jobs. Mostly deals with routing web traffic and parsing parameters.
"""
from webob import Request
from webob import Response
from webob import exc
import inspect
from os.path import exists
import re
from json import du... | jmchilton/lwr | lwr/web/framework.py | Python | apache-2.0 | 5,653 |
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Rds20130528DescribeSecurityIpsRequest(RestApi):
def __init__(self,domain='rds.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.DBInstanceId = None
def getapiname(self):
return 'rds.aliyuncs.com.DescribeSecurityI... | francisar/rds_manager | aliyun/api/rest/Rds20130528DescribeSecurityIpsRequest.py | Python | mit | 335 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-13 06:57
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('clothing', '0002_auto_20161112_2036'),
]
operation... | c-pari22/dressme | dressme/clothing/migrations/0003_auto_20161113_0657.py | Python | gpl-3.0 | 2,405 |
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from utils import HTML5RequiredMixin
from models import BucketList, BucketListItem
class SignupForm(HTML5RequiredMixin, UserCreationForm):
"""
Form that creates a u... | andela-uawili/django-bucketlist-application | bucketlist/dashboard/forms.py | Python | mit | 1,530 |
#!/usr/bin/env python3
"""Project Euler - Problem 11 Module"""
from numpy import *
def problem11(grid, nr_adjacent):
"""Problem 11 - Largest product in a grid"""
result = 0
GRID_SHAPE = grid.shape
for row in range(0, GRID_SHAPE[0] - (nr_adjacent-1)):
for col in range(0, GRID_SHAPE[1] - (nr_ad... | rado0x54/project-euler | python/problem0011.py | Python | mit | 2,145 |
""" Sahana Eden Automated Test - HRM001 Create Volunteer Certificate
@copyright: 2011-2012 (c) Sahana Software Foundation
@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 ... | vgupta6/Project-2 | modules/tests/staff/create_staff_certificate.py | Python | mit | 2,237 |
from django.conf.urls import include, handler404
from django.urls import path
from rest_framework_extensions.routers import ExtendedSimpleRouter
from rest_framework_jwt.views import obtain_jwt_token
from api import viewsets
from api.views import root_route, landing, dashboard, logout
router = ExtendedSimpleRouter()
(... | andela-cmutembei/III | api/urls.py | Python | mit | 935 |
from .tap import (TAPVizieR, TAP_Service, GaiaArchive, QueryStr, TAP_AsyncQuery,
resolve, timeit)
| mfouesneau/iasbs2017 | tap/__init__.py | Python | mit | 106 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | mifads/pyscripts | doc/conf.py | Python | gpl-3.0 | 5,381 |
#
# Copyright 2003,2004 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
# misc utilities
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import types
class seq_with_cursor (object):
... | jdemel/gnuradio | gnuradio-runtime/python/gnuradio/gru/seq_with_cursor.py | Python | gpl-3.0 | 1,933 |
from __future__ import print_function
from upower import UPowerManager
if __name__ == "__main__":
pwrMan = UPowerManager()
battery_device = None
print('Devices list:')
for dev in pwrMan.detect_devices():
print('\t', dev)
if 'battery' in dev:
battery_device = dev
print(... | corerd/PyDomo | powerman/upower_demo.py | Python | mit | 485 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
r_info.py
---------------------
Date : December 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
******************************... | mweisman/QGIS | python/plugins/processing/grass/ext/r_info.py | Python | gpl-2.0 | 1,238 |
"""Main functions for user interaction. All of these are imported into the
top-level namespace."""
import flavio
import numpy as np
from collections import defaultdict
from multiprocessing import Pool
from functools import partial
import warnings
def np_prediction(obs_name, wc_obj, *args, **kwargs):
"""Get the c... | flav-io/flavio | flavio/functions.py | Python | mit | 13,966 |
# Converts a METIS-graph into the DIMACS format
import sys, os, re
filename = sys.argv[1]
if not os.path.isfile(filename):
print "File not found."
sys.exit(0)
number_nodes = 0
number_edges = 0
edges_counted = 0
adjacency = []
print "Reading the file."
with open(filename) as f:
node = 0
for line in f... | sebalamm/KaMIS | misc/conversion/metis_to_dimacs.py | Python | gpl-2.0 | 1,447 |
'''This module contains a wrapper for C{os.environ} that deals with
proper encoding / decoding of values
When this module is loaded it will try to set proper values
for C{HOME} and C{USER} if they are not set and C{APPDATA} on windows.
'''
import os
import logging
import collections
logger = logging.getLogger('zim'... | gratteur/zim-desktop | zim/environ.py | Python | gpl-2.0 | 2,881 |
#
# Elastic Model: Testelastic
#
from elasticsearch_dsl import Date, Boolean, Text, Integer, Byte, Float, Keyword
from {{appname}}.models.elastic.dsl_basemodel import ElasticDSLBaseModel
from {{appname}}.lib.powlib import relation
from elasticsearch_dsl import DocType
from {{appname}}.database.elasticdblib import dbna... | pythononwheels/pow_devel | pythononwheels/start/stubs/elasticdsl_model_template.py | Python | mit | 1,539 |
from __future__ import absolute_import
from .utils import *
| mfixstsci/peewee4cosmo | cosmo_peewee/utils/__init__.py | Python | bsd-3-clause | 61 |
import glob
import json
import os
import typing
import zipfile
from argparse import ArgumentParser
from datetime import datetime
import cauldron
from cauldron import cli
from cauldron import environ
from cauldron.cli import sync
from cauldron.environ import Response
from cauldron.session import projects
NAME = 'save'... | sernst/cauldron | cauldron/cli/commands/save.py | Python | mit | 5,246 |
"""
I'm a service module without a handler.
""" | elishacook/mabruk | mabruk/tests/mock/bad_service_missing_handler.py | Python | mit | 47 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('transit_indicators', '0026_auto_20140911_2016'),
]
operations = [
migrations.AddField(
model_name='indicatorjob'... | flibbertigibbet/open-transit-indicators | python/django/transit_indicators/migrations/0027_auto_20140916_2114.py | Python | gpl-3.0 | 476 |
import io
import base64
import gevent
from Tkinter import Label
from PIL import ImageTk, Image
class AnimatedImgLabel(Label):
# http://stackoverflow.com/questions/7960600/python-tkinter-display-animated-gif-using-pil
def __init__(self, master, data, encoding='base64', **kwargs):
if encoding == 'base64... | MoroGasper/client | client/plugins/ui/tk/animate.py | Python | gpl-3.0 | 1,581 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | kwailamchan/programming-languages | python/django/elf/elf/src/hours10k/migrations/0001_initial.py | Python | mit | 1,153 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division
import theano
import theano.tensor as T
import numpy as np
from .. import activations, initializations
from ..utils.theano_utils import shared_zeros, floatX
from ..utils.generic_utils import make_tuple
from ..regularizers import ActivityRegulari... | kfoss/keras | keras/layers/core.py | Python | mit | 18,396 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mps.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| UPDDI/mps-database-server | manage.py | Python | mit | 246 |
#!/home/sam/p/drumm-farm/drumm_env/bin/python
from __future__ import print_function
import base64
import os
import sys
if __name__ == "__main__":
# create font data chunk for embedding
font = "Tests/images/courB08"
print(" f._load_pilfont_data(")
print(" # %s" % os.path.basename(font))
p... | samdowd/drumm-farm | drumm_env/bin/createfontdatachunk.py | Python | mit | 584 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# IkaLog
# ======
# Copyright (C) 2015 Takeshi HASEGAWA
#
# 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/l... | mzsm/IkaLog | ikalog/outputs/csv.py | Python | apache-2.0 | 4,550 |
import re
import sublime
import sublime_plugin
try:
from .settings import *
from .tools import *
except ValueError:
from settings import *
from tools import *
class PhpSettings():
def getConsoleFunc(self):
return settings().get('php').get('consoleFunc', ['print_r'])
def getPreTag(self):
return settings()... | unknownuser88/consolewrap | core/php_wrapper.py | Python | mit | 5,774 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditio... | tkaitchuck/nupic | build_system/autobuild/deploy.py | Python | gpl-3.0 | 7,654 |
import praw, cPickle as pickle
from collections import Counter
from nltk import word_tokenize,sent_tokenize
def unpickle(filename):
f = open(filename,"rb")
heroes = pickle.load(f)
return heroes
def writePickle(struct, filename):
file1 = open(filename,"wb")
pickle.dump(struct,file1)
... | nidishrajendran/computational-politeness | data/reddit/threadGetter_countries.py | Python | apache-2.0 | 2,361 |
# This file is part of sydpy.
#
# Copyright (C) 2014-2015 Bogdan Vukobratovic
#
# sydpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 2.1
# of the License, or (at your option)... | bogdanvuk/sydpy | sydpy/verif/basic_seq.py | Python | lgpl-2.1 | 2,192 |
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import re
from collections import OrderedDict
from docker.errors import NotFound
from docker.types import IPAMConfig
from docker.types import IPAMPool
from docker.utils import version_gte
from docker.utils import version_lt
... | dnephin/compose | compose/network.py | Python | apache-2.0 | 11,573 |
# Copyright 2014 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
from telemetry.page import legacy_page_test
from telemetry.timeline.model import TimelineModel
from telemetry.timeline import tracing_config
from ... | danakj/chromium | tools/perf/measurements/oilpan_gc_times.py | Python | bsd-3-clause | 7,075 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
parser = argparse.ArgumentParser( description = 'Generate label-term-distributions.csv from topic-term-distributions.csv.' )
parser.add_argument( 'path', type = str, help = 'Path of STMT model output' )
args = parser.parse_args()
path = args.path
lines = ... | StanfordHCI/termite | pipeline/stmt/extract-term-freqs.py | Python | bsd-3-clause | 563 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Windows constants for IOCP
"""
# this stuff should really be gotten from Windows headers via pyrex, but it
# probably is not going to change
ERROR_PORT_UNREACHABLE = 1234
ERROR_NETWORK_UNREACHABLE = 1231
ERROR_CONNECTION_REFU... | hlzz/dotfiles | graphics/VTK-7.0.0/ThirdParty/Twisted/twisted/internet/iocpreactor/const.py | Python | bsd-3-clause | 550 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.