code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from __future__ import unicode_literals
from django.http import HttpResponseRedirect, HttpResponse, JsonResponse
from django.urls import reverse
from django.utils.dateparse import *
from django.shortcuts import render
from django.template import RequestContext
from django.db.models import F, Sum, Count
from django.temp... | ReneBrals/RESS-AutoLog | autologbackend/views.py | Python | mit | 17,918 |
import firenado.conf
from firenado import tornadoweb
class IndexHandler(tornadoweb.TornadoHandler):
def get(self):
if not firenado.conf.session['enabled']:
self.write("Session is disabled as supposed to be.<br>")
if self.session is None:
self.write("Handler session... | piraz/firenado | examples/nosessionapp/handlers.py | Python | apache-2.0 | 549 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
import config
os.chdir(os.path.dirname(config.__file__)) #Override wsgi directory change
from flask import Flask, Response, render_template, request, session, g
from flask import flash, abort, redirect, url_for, get_flashed_messages
from flask import Markup, make_... | rechner/Taxidi-volunteer2 | routes.py | Python | gpl-3.0 | 34,530 |
def test():
a = {}
b = {}
c = {}
d = {}
i = 0
while i < 1e6:
# 100
a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b
a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b
a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b
... | kphillisjr/duktape | tests/perf/test-reg-readwrite-object.py | Python | mit | 8,045 |
from jsonrpc import ServiceProxy
access = ServiceProxy("http://127.0.0.1:40001")
pwd = raw_input("Enter wallet passphrase: ")
access.walletpassphrase(pwd, 60)
| KevinBiomech/GameCredits | contrib/wallettools/walletunlock.py | Python | mit | 159 |
from distutils.core import setup
setup(
name='RiboMethSeq',
version='0.1.1',
author='Brett N. Olsen',
author_email='brett.olsen@gmail.com',
packages=['ribomethseq'],
scripts=['bin/calculate-ribomethseq-from-bam', 'bin/bed-to-wig', 'bin/split-bed'],
license='LICENSE',
description='Implem... | caethan/ribomethseq | setup.py | Python | mit | 436 |
# 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 License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but... | codificat/sos | sos/plugins/cobbler.py | Python | gpl-2.0 | 1,477 |
import server, sys
from hardwarepixel import HardwarePixel
__ESP__ = True
try:
import network
except Exception as exc:
print("Failed to import hardware packages, switching to no ESP mode")
sys.print_exception(exc)
__ESP__ = False
class Handler:
def __init__(self):
if __ESP__:
s... | mostley/lightnet | handlers/micropython-osc/src/handler.py | Python | mit | 1,213 |
import os
USE_SYMENGINE = os.getenv('USE_SYMENGINE')
if USE_SYMENGINE:
from symengine.sympy_compat import (Symbol, Integer, sympify, S,
SympifyError, exp, log, gamma, sqrt, I, E, pi, Matrix,
sin, cos, tan, cot, csc, sec, asin, acos, atan, acot, acsc, asec,
sinh, cosh, tanh, coth, asinh, aco... | jaimahajan1997/sympy | sympy/core/backend.py | Python | bsd-3-clause | 1,114 |
import json
import numpy as np
import pandas as pd
from utils import serialize_dict, serialize_merge_dict, \
map_to_unrealized_pnl, map_to_holding_values
from statics import OrderType, PositionType, PositionStatus, CurrencyType, \
TradingExecuteFlag, BarColNames, ORD_POS_MAPPING
from errors import KernelOrder... | zedyang/oaForex | kernel.py | Python | mit | 24,595 |
# Copyright (c) 2014 Rackspace, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | amitgandhinz/cdn | poppy/transport/validators/helpers.py | Python | apache-2.0 | 6,176 |
"""Support for Freebox devices (Freebox v6 and Freebox mini 4K)."""
from __future__ import annotations
import logging
from typing import Any
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
DATA... | aronsky/home-assistant | homeassistant/components/freebox/sensor.py | Python | apache-2.0 | 5,841 |
#!/usr/bin/python
import os
import sys
import csv
## DJANGO SETUP
##
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'flipside.settings')
import django
django.setup()
##
##
def update_poem(poem, uuid):
p = Poem.objects.get(uuid=uuid)
if p.text != poem:
print("Poem [{}], has bad characters".format(uui... | seriouscamp/frbb | web/tools/convert_text.py | Python | apache-2.0 | 613 |
import numpy as np
import math
import time
class SIFTDescriptor(object):
"""Class for computing SIFT descriptor of the square patch
Attributes:
patchSize: size of the patch in pixels
maxBinValue: maximum descriptor element after L2 normalization. All above are clipped to this value
nu... | spongezhang/vlb | python/features/numpy_sift.py | Python | bsd-2-clause | 7,728 |
# -*- coding: utf-8 -*-
# vim: set ts=4
from django.db import models
class Structure(models.Model):
class Meta:
app_label = 'DUlSine'
ordering = ('numero', )
numero = models.IntegerField(primary_key = True)
nom = models.CharField(max_length = 50)
adresse = models.CharField(max_length ... | DUlSine/DUlSine | DUlSine/models/structure.py | Python | agpl-3.0 | 478 |
import module
module.
| vheon/ycmd | ycmd/tests/python/testdata/project/__main__.py | Python | gpl-3.0 | 23 |
# -*- coding: utf-8 -*-
from .app import PersonalAccessTokenManager
| soasme/flask-personal-access-token | flask_personal_access_token/__init__.py | Python | mit | 69 |
"""Common profiles are defined here to be easily used within a project using --profile {name}"""
from typing import Any, Dict
black = {
"multi_line_output": 3,
"include_trailing_comma": True,
"force_grid_wrap": 0,
"use_parentheses": True,
"ensure_newline_before_comments": True,
"line_length": 8... | TeamSPoon/logicmoo_workspace | packs_web/butterfly/lib/python3.7/site-packages/isort/profiles.py | Python | mit | 1,601 |
# 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... | mlperf/training_results_v0.5 | v0.5.0/google/cloud_v3.8/resnet-tpuv3-8/code/resnet/model/models/official/utils/misc/distribution_utils_test.py | Python | apache-2.0 | 2,394 |
#
# FLOGGER
#
# This program reads records from the OGN network processing only
# those received from a specified site and registration marks, eg aircraft belonging to
# a specific club.
# It writes each record to a database and at the end of each day process
# them to determine the flight times of each flight for eac... | tobiz/OGN-Flight-Logger_V3 | flogger3.py | Python | gpl-3.0 | 77,519 |
from thefuck import shells
from thefuck.utils import sudo_support
try:
import CommandNotFound
except ImportError:
enabled_by_default = False
@sudo_support
def match(command, settings):
if 'not found' in command.stderr:
try:
c = CommandNotFound.CommandNotFound()
pkgs = c.get... | bugaevc/thefuck | thefuck/rules/apt_get.py | Python | mit | 817 |
# python day 22
# author zach.wang
# -*- coding:utf-8 -*-
import smtplib, sys, os, re
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
# TODO ONLY TEST NETEASE AND QQ mail
# options
receiver = ['wzq1397@live.cn', ]
subject = 'attachments'
smtps... | WZQ1397/automatic-repo | project/mailsystem/ZachMaillib/SmtpSystem.py | Python | lgpl-3.0 | 4,650 |
#! /usr/bin/env python
# Copyright 2014 Uri Laserson
#
# 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 o... | churchlab/vdj | bin/translate_chains.py | Python | apache-2.0 | 1,081 |
# Copyright 2016 Sebastian Spautz <sebastian@human-injection.de>
#
# This file is part of "RPI Display Backlight Control for Kodi".
#
# "RPI Display Backlight Control for Kodi" is free software: you can
# redistribute it and/or modify it under the terms of the GNU General
# Public License as publishe... | sebastiansIT/RPI-Display-Backlight-Controller-for-Kodi | sources/screensaver.rpi-backlight-disabler/screensaver.py | Python | gpl-3.0 | 2,345 |
# This file is part of the Hotwire Shell user interface.
#
# Copyright (C) 2007 Colin Walters <walters@verbum.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 Software Foundation; either version 2 of the Li... | desirable-objects/hotwire-shell | hotwire_ui/renderers/dict.py | Python | gpl-2.0 | 2,355 |
"""This is to generate the awards table."""
import argparse
import random
import socket
import sys
import time
from copy import copy
from datetime import datetime
from json import dumps, load
from os.path import isdir, split
from textwrap import wrap
import requests
import tabulate
from praw import Reddit
AWARD_TYPE... | praw-dev/praw | tools/generate_award_table.py | Python | bsd-2-clause | 8,880 |
# file doc/conf.py
#
# Copyright 2012 Emory University Library
#
# 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 requir... | emory-libraries/findingaids | doc/conf.py | Python | apache-2.0 | 1,491 |
"""
This module will test the start --force (ex restart) command
"""
from controller.app import Configuration
from tests import (
Capture,
create_project,
exec_command,
get_container_start_date,
init_project,
pull_images,
start_project,
start_registry,
)
def test_all(capfd: Capture) ->... | rapydo/do | tests/test_restart.py | Python | mit | 1,353 |
from ..workdays import *
from datetime import datetime, timedelta
from time import strptime
import math
import traceback
tests=[]
def test( fn ):
tests.append(fn)
return fn
def runTests():
for t in tests:
print t
try: t()
except Exception as e:
print e
trace... | mmahnic/trac-tickethistory | tickethistory/test/workdays_t.py | Python | mit | 4,805 |
# 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 ... | tbombach/autorest | src/generator/AutoRest.Python.Azure.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account_regenerate_key_parameters.py | Python | mit | 960 |
from importlib import import_module
from django.apps import AppConfig as BaseAppConfig
class AppConfig(BaseAppConfig):
name = "laboite"
def ready(self):
import_module("laboite.receivers")
| bgaultier/laboitepro | laboite/apps/__init__.py | Python | agpl-3.0 | 209 |
"""
Tests suite for the template tags of the notifications app.
"""
from django.test import TestCase
from django.template import (engines,
TemplateSyntaxError)
from django.contrib.auth import get_user_model
from ..models import Notification
class NotificationsTemplateTagsTestCase(TestCa... | TamiaLab/carnetdumaker | apps/notifications/tests/test_templatetags.py | Python | agpl-3.0 | 3,591 |
# Create your views here.
from django import forms
from django.template import RequestContext
from django.http import HttpResponse, HttpResponseRedirect
from django.template.loader import get_template
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse
import datetime
from... | HarrisonHDU/myerp | apps/depot/views.py | Python | mit | 4,631 |
from sqlobject import *
from ics_demo.dao.orm.base import IcsSQLObject
from ics_demo.dao.orm.host import Host
class BlockDevice(IcsSQLObject):
"""Block devices"""
#id = StringCol()
name = StringCol()
used = BoolCol()
capacity = StringCol()
absolute_path = StringCol()
osd = Sing... | lielongxingkong/ics_demo | ics_demo/dao/orm/block_device.py | Python | mit | 364 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2005 Donald N. Allingham
#
# 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 License, or
# (at you... | beernarrd/gramps | gramps/gen/relationship.py | Python | gpl-2.0 | 129,799 |
import reversion
from django.contrib import admin
from .models import Protocol, Topic, Institution
class ProtocolAdminIndex(reversion.VersionAdmin, admin.ModelAdmin):
list_display = [
'number',
'start_time',
'get_topics',
'information',
'majority',
'current_majorit... | Hackfmi/Diaphanum | protocols/admin.py | Python | mit | 1,042 |
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from views import DashboardView
urlpatterns = patterns('',
url(r'^dashboard/render', DashboardView.as_view(),
name="render"),
url(r'^dashboard', direct_to_template,
{'template': 'dashboard/index.... | mivanov/editkit | editkit/dashboard/urls.py | Python | gpl-2.0 | 344 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from django.contrib.gis.db import models
from mapwidgets.widgets import GooglePointFieldWidget
from homes_for_sale.models import *
class SaleAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('title',), }
... | bertnotbob/django-property | homes_for_sale/admin.py | Python | mit | 2,584 |
from django.test import RequestFactory, TestCase, override_settings
from django.urls import reverse
from gem.context_processors import (
compress_settings,
detect_freebasics,
detect_kaios,
)
from gem.tests.base import GemTestCaseMixin
class TestDetectKaiOS(TestCase):
def setUp(self):
self.req... | praekelt/molo-gem | gem/tests/test_context_processors.py | Python | bsd-2-clause | 2,737 |
from distutils import dirname
from mgl2d.graphics.quad_drawable import QuadDrawable
from mgl2d.graphics.shader_program import ShaderProgram
from mgl2d.graphics.texture import Texture
from mgl2d.math.vector2 import Vector2
class CharDef:
def __init__(self):
self.id = 0
self.x = self.y = 0
... | maxfish/mgl2d | mgl2d/graphics/font.py | Python | mit | 7,748 |
from django.conf import settings
from django.http import HttpResponse
from django.test import TestCase
from django.test.client import Client
from paypal.standard.ipn.models import PayPalIPN
from paypal.standard.ipn.signals import (payment_was_successful,
payment_was_flagged)
IPN_POST_PARAMS = {
"... | bluestemscott/librarygadget | librarygadget/paypal/standard/ipn/tests/test_ipn.py | Python | mit | 4,140 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : lookup_property
Description : Set properties for Lookup data type
Date : 02/January/2016
copyright : (C) 2015 by UN-Habitat and implementing partners.... | gltn/stdm | stdm/ui/wizard/lookup_property.py | Python | gpl-2.0 | 4,938 |
# -*- coding: utf-8 -*-
from jenkins import Jenkins
from simple_manager.utils import git_add
from simple_manager.utils import git_clone
from simple_manager.utils import git_commit
from simple_manager.utils import git_push_branch
from simple_manager.utils import git_push_tag
from simple_manager.utils import git_tag
from... | victorpantoja/git-repo-manager | git_repo_manager/classes.py | Python | mit | 3,348 |
from django.contrib.auth.models import Group
from django.db import models
# Create your models here.
from proyectos.models import Proyecto
class Rol(Group):
proyecto = models.ForeignKey(Proyecto) | alforro/sgpa2015 | roles/models.py | Python | gpl-2.0 | 201 |
from pathlib import Path
import pytest
from .factories import LibraryFactory
# pytestmark = pytest.mark.django_db
@pytest.fixture
def photo_fixture_snow(db):
from photonix.photos.utils.db import record_photo
snow_path = str(Path(__file__).parent / 'photos' / 'snow.jpg')
library = LibraryFactory()
... | damianmoore/photo-manager | tests/test_classifier_runners.py | Python | agpl-3.0 | 4,655 |
import bpy, http, threading, pprint, types, os
import http.server
import socketserver
from mathutils import Euler
from bpy.props import *
from bpy.types import Operator
from .websocket_server import websocket_server
bl_info = {
"name": "Remote 3D Navigation ",
"author": "Laxminarayan Kamath <kamathln@gmail.c... | kamathln/blenderrpc | __init__.py | Python | lgpl-3.0 | 9,571 |
'''
Created on Jan 23, 2014
@author: Chris
'''
import sys
from gooey.monkey_parser import ArgumentError
from gooey.gui.action_sorter import ActionSorter
class ClientApp(object):
def __init__(self, parser, payload):
self._parser = parser
self.description = parser.description
self.actio... | garrettcap/Bulletproof-Backup | gooey/gui/client_app.py | Python | gpl-2.0 | 1,454 |
#!/usr/bin/python
# Copyright 2014 Jens Carl, Hothead Games 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.
#
# ... | JasonCormie/ansible-modules-extras | cloud/amazon/redshift.py | Python | gpl-3.0 | 17,157 |
#!/usr/bin/python
#
# websocket clinet for test.
#
"""
Copyright (c) 2015, SUGIMOTO Norimitsu <dictoss@live.jp>
All rights reserved.
Redistribution and use in source and binary forms,
with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must ret... | dictoss/websockettools | tools/eqclient_autobahn.py | Python | bsd-2-clause | 4,573 |
from gmusic.frontend.CursedObject import CursedObject
from gmusic.core.CommandProcessor import CommandProcessor
from gmusic.core.EventHandler import EventHandler
from gmusic.core.UIParser import UIParser
import curses
import collections
class UI(CursedObject, EventHandler):
"""
Handles input from the user; han... | etkirsch/gmusic | gmusic/frontend/UI.py | Python | gpl-2.0 | 6,102 |
# $Id: mod_call.py 369517 2012-07-01 17:28:57Z file $
import time
import imp
import sys
import inc_const as const
from inc_cfg import *
# Load configuration
cfg_file = imp.load_source("cfg_file", ARGS[1])
# Check media flow between ua1 and ua2
def check_media(ua1, ua2):
ua1.send("#")
ua1.expect("#")
ua1.send("1122... | marcelloceschia/asterisk-11-extended_codec | res/pjproject/tests/pjsua/mod_call.py | Python | gpl-2.0 | 5,335 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='compilewheel',
version='1.0',
packages=find_packages()
)
| alex/pip | tests/data/src/compilewheel/setup.py | Python | mit | 154 |
import sys
with open(sys.argv[1], 'r') as file:
lines = file.readlines()
for line in lines:
if line:
line = line.strip()
print int(line, 16)
| tdsymonds/codeeval | python/easy/(67) hex-to-decimal.py | Python | mit | 190 |
from test.support import run_unittest
from test.script_helper import assert_python_failure, temp_dir
import unittest
import sys
import cgitb
class TestCgitb(unittest.TestCase):
def test_fonts(self):
text = "Hello Robbie!"
self.assertEqual(cgitb.small(text), "<small>{}</small>".format(tex... | Orav/kbengine | kbe/src/lib/python/Lib/test/test_cgitb.py | Python | lgpl-3.0 | 2,621 |
#
# Copyright (C) 2012 UNINETT AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# This program is distributed in the hope... | sigmunau/nav | python/nav/ipdevpoll/snmp/common.py | Python | gpl-2.0 | 5,571 |
from Language import BTO
from Base import BaseServer,BaseClient
from utils import change_workdir, remove_workdir, path_clt2svr, path_svr2clt
import socket,sys,os,os.path,time,signal,shutil
import string,re,getopt
########################################################################
class ADIC:
"""Adic-specific... | LighthouseHPC/lighthouse | src/oldbtoserver/BTO.py | Python | mit | 4,854 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/OSIS-Louvain | learning_unit/views/learning_unit_class/tutor_repartition.py | Python | agpl-3.0 | 6,168 |
import sys,getopt,string
filenames = None
fileOut = None
filePath = None
blocksize = 1024
i = 0
license ='/*\n'\
' ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio\n'\
'\n'\
' Licensed under the Apache License, Version 2.0 (the "License");\n'\
' you may not use this file except in compliance ... | serdzz/ChibiOS | test/crypto/ref/genfile.py | Python | gpl-3.0 | 1,842 |
#!/usr/bin/env python
from __future__ import print_function
from collections import OrderedDict
__author__ = 'Taio'
def meminfo():
''' Return the information in /proc/meminfo
as a dictionary '''
meminfo=OrderedDict()
with open('/proc/meminfo') as f:
for line in f:
meminfo[line.spli... | jiasir/sys-management-scripts | system-status/mem.py | Python | gpl-3.0 | 567 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import os
import alembic.command
from alembic.script import ScriptDirectory
from flask import current_app... | pferreir/indico | indico/core/db/sqlalchemy/migration.py | Python | mit | 5,184 |
# Twisted Imports
from twisted.internet import defer
from twisted.internet.protocol import Factory
# System Imports
from time import time as now
# Package Imports
from ..machine import Machine, Property, Stream, ui
from ..protocol.basic import QueuedLineReceiver
__all__ = ["K120", "S100"]
class K120LineReceiver (Q... | richardingham/octopus | octopus/manufacturer/knauer.py | Python | mit | 6,864 |
import pytest
from pandas.core.frame import DataFrame
@pytest.fixture
def dataframe():
return DataFrame({'a': [1, 2], 'b': [3, 4]})
class TestDataFrameValidate(object):
"""Tests for error handling related to data types of method arguments."""
@pytest.mark.parametrize("func", ["query", "eval", "set_ind... | GuessWhoSamFoo/pandas | pandas/tests/frame/test_validate.py | Python | bsd-3-clause | 1,063 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Assinante',
fields=[
('id', models.AutoField(ve... | pydawan/protetores_bucais | protetores_bucais/apps/newsletter/migrations/0001_initial.py | Python | mit | 773 |
# coding=utf-8
import logging
try:
import requests
mode = "requests"
# Suppress logging
logging.getLogger("requests.packages.urllib3").setLevel(logging.WARNING)
except ImportError:
requests = None
from urllib.request import urlopen
mode = "urllib"
log = logging.getLogger(__name__)
log.s... | DefaltSimon/SSKJpy | sskjpy/connector.py | Python | mit | 938 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
"""
"""
from functools import partial
import inspect
import re
from types import FunctionType
from tornado.web import URLSpec, Application, RequestHandler
__author__ = 'Martin Martimeo <martin@martimeo.de>'
__date__ = '16.06.13 - 23:48'
SUPPORTED_METHODS = RequestHandler.S... | tornado-utils/tornado-menumaker | tornado_menumaker/route.py | Python | agpl-3.0 | 3,154 |
# encoding: utf-8
# module samba.dcerpc.samr
# from /usr/lib/python2.7/dist-packages/samba/dcerpc/samr.so
# by generator 1.135
""" samr DCE/RPC """
# imports
import dcerpc as __dcerpc
import talloc as __talloc
class ValidatePasswordInfo(__talloc.Object):
# no doc
def __init__(self, *args, **kwargs): # real s... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/samba/dcerpc/samr/ValidatePasswordInfo.py | Python | gpl-2.0 | 1,308 |
from django.conf import settings
from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.utils import dateformat
from django.utils.html import escape, conditional_escape
from django.utils.text import capfirst
from ... | samluescher/django-media-tree | media_tree/contrib/legacy_mptt_support/templatetags/mptt_admin.py | Python | bsd-3-clause | 8,088 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import warnings
import unittest
import os
from pymatgen.alchemy.transmuters import CifTransmuter, PoscarTransmuter
from pymatgen.alchemy.filters import ContainsSpecieFilter
from pymatgen.transformations.standa... | dongsenfo/pymatgen | pymatgen/alchemy/tests/test_transmuters.py | Python | mit | 4,616 |
import os
import json
import requests
from pprint import pprint
from django.core.files import File as DjangoFile
from django.core.files.temp import NamedTemporaryFile
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand, CommandError
from trivago2015.users.models import ... | ephes/trivago2015 | trivago2015/users/management/commands/import_users.py | Python | bsd-3-clause | 1,246 |
from itertools import count
from django import template
register = template.Library()
class GetCounterNode(template.Node):
def __init__(self, var_name, start=1):
self.var_name = var_name
self.start = start
def render(self, context):
context[self.var_name] = count(self.start).next
... | Minkov/site | judge/templatetags/counter.py | Python | agpl-3.0 | 575 |
if __name__ == '__main__':
print('''run tests via
FreeCAD_assembly2$ python2 test.py assembly2.solvers.dof_reduction_solver.tests''')
exit()
import unittest
import FreeCAD
import assembly2
import os, time, numpy
test_assembly_path = os.path.join( assembly2.__dir__ , 'assembly2', 'solvers', 'test_assemblies' ... | hamish2014/FreeCAD_assembly2 | assembly2/solvers/dof_reduction_solver/tests.py | Python | lgpl-2.1 | 13,172 |
from scipy import *
import json
import scipy
import numpy as np
import time as tm
import gc
import struct
import getopt, sys
import os
import traceback
# ------------------------------------------------------------
# Logging & Timer
# ------------------------------------------------------------
logging_level = 0;
... | cvdlab/lar-running-demo | py/computation/old/step_convert_binarychains.py | Python | mit | 3,895 |
##
# Copyright (C) 2013 TopCoder Inc., All Rights Reserved.
##
"""
Abstract interface of writer class. Clarifying interface and duty of writer classes.
"""
__author__ = 'Easyhard'
__version__ = '1.0'
class DataWriter(object):
"""
Abstract interface of writer class.
A writer class should be able to export ... | NASA-Tournament-Lab/CoECI-CMS-Healthcare-Fraud-Prevention | partnerclient/hfppnetwork/partner/conversion/datawriter.py | Python | apache-2.0 | 1,031 |
import attrdict
import json
import paho.mqtt.client as mqtt
from ohaut import consts
from ohaut.devices import manager
class MQTTClient(object):
def __init__(self):
self.client = mqtt.Client()
self.client.on_connect = self.on_connect
self.client.on_message = self.on_message
def conn... | ohaut/ohaut-core | ohaut/mqtt.py | Python | gpl-3.0 | 1,197 |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
salt.utils.vt
~~~~~~~~~~~~~
Virtual Terminal
This code has been heavily inspired by Python's subprocess code, the `non
blocking version of it`__, some minor online snippets about TTY handling
with python... | stephane-martin/salt-debian-packaging | salt-2016.3.2/salt/utils/vt.py | Python | apache-2.0 | 37,126 |
#***************************************************************************
#* *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.net> *
#* ... | bblacey/FreeCAD-MacOS-CI | src/Mod/Arch/importIFClegacy.py | Python | lgpl-2.1 | 98,719 |
"""Base classes to configure an OSPF daemon"""
from ipaddress import ip_interface, IPv4Network
from typing import Sequence, List
from ipmininet.link import IPIntf
from ipmininet.overlay import Overlay
from ipmininet.utils import L3Router
from .utils import ConfigDict
from .zebra import QuaggaDaemon, Zebra
class OSPF... | oliviertilmans/ipmininet | ipmininet/router/config/ospf.py | Python | gpl-2.0 | 4,813 |
def test():
print('This is printed')
return
##print('This is not')
x =test()
def func2():
return 1
| quran1987/Test | test.py | Python | gpl-2.0 | 127 |
"""
Module rendering
"""
import hashlib
import json
import logging
from collections import OrderedDict
from functools import partial
import newrelic.agent
from capa.xqueue_interface import XQueueInterface
from django.conf import settings
from django.contrib.auth.models import User
from django.core.cache import cache
... | prarthitm/edxplatform | lms/djangoapps/courseware/module_render.py | Python | agpl-3.0 | 47,090 |
from datetime import datetime
from django.http import (
HttpResponse,
HttpResponseBadRequest,
HttpResponseForbidden,
)
from django.urls import reverse
from memoized import memoized
from tastypie import fields
from tastypie.authentication import Authentication
from tastypie.bundle import Bundle
from tastypi... | dimagi/commcare-hq | corehq/apps/api/resources/v0_4.py | Python | bsd-3-clause | 18,133 |
def calculate_firewall_cost(firewall, delay=0):
layers = max(firewall.keys()) + 1
hits = []
for iteration in range(0, layers):
if iteration not in firewall:
continue
period = (firewall[iteration] - 1) * 2
if (iteration + delay) % period == 0:
... | matslindh/codingchallenges | adventofcode2017/13.py | Python | mit | 1,380 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import IntegrityError, models, transaction
from sentry.utils.query import RangeQuerySetWrapperWithProgressBar
class Migration(DataMigration):
def forwards(self, orm... | BuildingLink/sentry | src/sentry/south_migrations/0302_merge_environments.py | Python | bsd-3-clause | 70,522 |
# -*- encoding: utf-8 -*-
#ABECEDARIO
abecedario = map(chr, range(97, 123))
index = abecedario.index("n") + 1
abecedario.insert(index, "ñ")
vocales = ["a", "e", "i", "o", "u"]
#DICCIONARIOS
Acciones = ["medir", "comprar", "querer"]
Personales = ['yo','tu','el','nosotros','ustedes','ellos']
Pronombres = ["casa", "apar... | codeapps/pythonista | Conjugaciones.py | Python | mit | 5,814 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
#
# Rule Classs
#
###############################################################################
class Rule():
"""Transform a formated rule into stochastic matrix"""
def __init__(self, rul... | Fritzip/ReactionNetwork | SRC/rule.py | Python | gpl-2.0 | 2,449 |
import recontree as RT, mul_tree as MT, global_vars as globs
def orthLabel(gene_trees, min_maps, min_tree, min_clade):
orthfile = open(globs.orth_file_name, "w");
lfile = open(globs.labeled_tree_file, "w");
orthfile.write(MT.mulPrint(min_tree, min_clade));
orthfile.write("\n------------------\n");
for gene_num ... | gwct/grampa | lib/orth_label.py | Python | gpl-3.0 | 2,091 |
# Copyright Bors LTD
# This file is part of django-icons-mimetypes.
#
# django-icons-mimetypes 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)... | bors-ltd/django-icons-mimetypes | icons_mimetypes_dev/tests/test_templatetags.py | Python | gpl-3.0 | 4,507 |
from __future__ import with_statement
import unittest
from flask import Flask, Response
from flask_principal import Principal, Permission, Denial, RoleNeed, \
PermissionDenied, identity_changed, Identity, identity_loaded
anon_permission = Permission()
admin_permission = Permission(RoleNeed('admin'))
admin_or_e... | MichiganLabs/flask-principal | test_principal.py | Python | mit | 7,923 |
# Copyright (c) 2012-2022, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
def validate_homedirectory_type(homedirectory_type):
"""
Validate HomeDirectoryType for User
Property: User.HomeDirectoryType
"""
VALID_HOMEDIRECTORY_TYPE = ("LOGICAL", "PATH")
... | cloudtools/troposphere | troposphere/validators/transfer.py | Python | bsd-2-clause | 563 |
"""
Encrypts secrets using kms key wrapping.
Usage:
kms_wrap
[--region=<region_name>]
[--profile=<profile name>]
--key <key_alias_or_id>
Options:
-r --region=<region_name> AWS Region Name
-p --profile=<profile_name> the name of the profile to use to connect to aws
-k --key=<key_alias_or_id> ... | 2ps/djenga | djenga/encryption/kms_wrap.py | Python | bsd-3-clause | 1,631 |
from Queue import Queue, Empty
import threading
import traceback
import inspect
import os, stat
def isiter(obj):
'''
test whether an object conforms to the iterator protocol
'''
try:
if obj.__iter__() == obj and obj.next:
return True
except AttributeError:
pass
retu... | lunixbochs/meta | snippets/python/threadpool.py | Python | mit | 6,725 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | rs2/bokeh | bokeh/embed/notebook.py | Python | bsd-3-clause | 4,638 |
# Copyright 2010 Pablo Arrighi, Alex Concha, Miguel Lezama for version 1.
# Copyright 2013 Pablo Arrighi, Miguel Lezama, Kevin Mazet for version 2.
#
# This file is part of GOOL.
#
# GOOL is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by t... | darrivau/GOOL | src/main/resources/gool/generator/python/goolHelper/IO.py | Python | gpl-3.0 | 2,848 |
#
# Copyright (c) 2014 Nick Douma < n.douma [at] nekoconeko . nl >
#
# This file is part of imagecat.
#
# imagecat 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... | LordGaav/imagecat | imagecat/settingswrapper.py | Python | gpl-3.0 | 2,896 |
import unittest
from conans.test.tools import TestClient
from conans.test.utils.cpp_test_files import cpp_hello_conan_files
from nose.plugins.attrib import attr
@attr("slow")
class ConanTestTest(unittest.TestCase):
def _create(self, client, number, version, deps=None, export=True):
files = cpp_hello_cona... | dragly/conan | conans/test/integration/conan_test_test.py | Python | mit | 1,929 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import json
from config import Config
class DozensApi(object):
"""
Wrapping DozensAPI
(https://sites.google.com/a/dozens.jp/docs/)
This class do not wrap whole apis.
Implementing minimum APIs to maitan A records.
"""
def __ini... | LS1qJ/IP-Updater-For-Heroku | dozens_ip_updater/dozens_api.py | Python | mit | 2,062 |
from prudentia.domain import Box
from prudentia.simple import SimpleProvider, SimpleCli
from prudentia.utils import io
class SshCli(SimpleCli):
def __init__(self):
SimpleCli.__init__(self)
self.prompt = '(Prudentia > Ssh) '
self.provider = SshProvider()
class SshProvider(SimpleProvider):... | StarterSquad/prudentia | prudentia/ssh.py | Python | mit | 1,877 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | nearlyfreeapps/python-googleadwords | examples/adspygoogle/adwords/v201109_1/campaign_management/add_location_extension_override.py | Python | apache-2.0 | 3,540 |
#proxy12.py
#Proxy object for all modules that have a mib12 executive
import proxy
from pymomo.utilities.typedargs.annotate import returns, param, annotated
from collections import namedtuple
from pymomo.commander.exceptions import *
#Printer functions for displaying return values.
def print_status(status):
"""
Bre... | amcgee/pymomo | pymomo/commander/proxy/proxy12.py | Python | lgpl-3.0 | 2,215 |
"""
It turns out that 12 cm is the smallest length of wire that can be bent to form an integer sided right angle triangle in exactly one way, but there are many more examples.
12 cm: (3,4,5)
24 cm: (6,8,10)
30 cm: (5,12,13)
36 cm: (9,12,15)
40 cm: (8,15,17)
48 cm: (12,16,20)
In contrast, some lengths of wire, like 20... | peterstace/project-euler | OLD_PY_CODE/project_euler_old_old/75/75.py | Python | unlicense | 2,033 |
# 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... | dongjoon-hyun/tensorflow | tensorflow/contrib/constrained_optimization/python/external_regret_optimizer.py | Python | apache-2.0 | 16,425 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.