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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# Copyright (c) 2010 SubDownloader Developers - See COPYING - GPLv3
'''
FileManagement package
'''
| matachi/subdownloader | languages/__init__.py | Python | gpl-3.0 | 122 |
# -*- coding: utf-8 -*-
"""
jinja2
~~~~~~
Jinja2 is a template engine written in pure Python. It provides a
Django inspired non-XML syntax but supports inline expressions and
an optional sandboxed environment.
Nutshell
--------
Here a small example of a Jinja2 template::
{% ... | rogers0/namebench | third_party/jinja2/__init__.py | Python | apache-2.0 | 2,272 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | keras-team/keras | keras/utils/generic_utils.py | Python | apache-2.0 | 43,269 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('widgetbox', '0010_html'),
]
operations = [
migrations.AddField(
model_name='button',
name='extra_css... | logithr/djangocms-widgetbox | widgetbox/migrations/0011_auto_20150731_0958.py | Python | mit | 447 |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 28 16:52:18 2016 by emin
"""
import os
import sys
import theano
import theano.tensor as T
import numpy as np
from lasagne.layers import InputLayer, ReshapeLayer, DenseLayer, ConcatLayer, SliceLayer
from generators import ModularCueCombinationTaskFFWD
import lasagne.layers
... | eminorhan/inevitable-probability | alt_objectives/abserr_cc_cc_expt.py | Python | gpl-3.0 | 5,456 |
from PyQt4 import QtGui
from Action import BaseAction
from Action import Motion
from Action import Stiffness
from EmpathyMotionList import EmpathyMotionList
import random
class EmpathyRandomButton(QtGui.QPushButton):
INDEX_ACTIONS = 0
INDEX_MOTION = 1
def __init__(self, label):
super(EmpathyRando... | mattBrzezinski/Hydrogen | robot-controller/Study/EmpathyRandomButton.py | Python | mit | 2,532 |
# this file exists for backward compatibility
__all__ = ['DAL', 'Field', 'DRIVERS']
from dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, DRIVERS, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType
| pouyana/teireader | webui/gluon/sql.py | Python | mit | 285 |
from merchant_server import app
import paypal_client
import unittest
import json
from mock import patch, Mock
class TestMerchantServer(unittest.TestCase):
def setUp(self):
"""Before each test, set up a test client"""
app.config['TESTING'] = True
self.app = app.test_client()
self.response... | stafur/pyTRUST | paypal-rest-api-sdk-python/samples/mobile_backend/merchant_server_tests.py | Python | apache-2.0 | 5,839 |
# -*- coding: utf-8 -*-
import click
import os
import pandas as pd
from shutil import rmtree
from . tree_scrape import author_minded
from . query_pmc import pmc_data
OUT_SUBFOLDER = 'contrib_data'
AUTHOR_DATA = 'author_data.json'
def verify_local_repo_location(repo):
if not os.path.isdir(repo):
raise IOE... | lbillingham/commit_opener | commit_opener/commit_opener.py | Python | gpl-3.0 | 2,151 |
# This file is part of HamsiManager.
#
# Copyright (c) 2010 - 2015 Murat Demir <mopened@gmail.com>
#
# Hamsi Manager 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 yo... | supermurat/hamsi-manager | Core/Dialogs.py | Python | gpl-3.0 | 18,494 |
# ***************************************************************************
# * Copyright (c) 2017 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * ... | sanguinariojoe/FreeCAD | src/Mod/Fem/femsolver/calculix/solver.py | Python | lgpl-2.1 | 13,791 |
"""
test_backend.py
Test case for keyring basic function
created by Kang Zhang 2009-07-14
"""
import random
import unittest
import string
import os
import sys
import commands
import keyring.backend
from keyring.backend import PasswordSetError
ALPHABET = string.ascii_letters + string.digits
DIFFICULT_CHARS = strin... | wadobo/GECO | src/gecoc/gtk-geco/keyring/tests/test_backend.py | Python | gpl-3.0 | 6,879 |
import os,sys
sys.path.append("../lib")
from livdatcsvlib import *
import json,requests,urllib
from geopy import geocoders
def geocode_field_from_CSV(csv,fieldname):
g = geocoders.GoogleV3()
#print g.api_key
print "Hello"
finalcsv=CSVFile()
finalcsv.colnames=["SEARCHKEY","LOCATION","LAT","LONG"]
searchkeyl... | mojolab/LivingData | lib/livdatmaplib.py | Python | apache-2.0 | 1,399 |
# Copyright 2015-2017 Cisco Systems, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | dashng/netseen | netseen/common/ip_conversion.py | Python | apache-2.0 | 1,787 |
# -*- coding: utf-8 -*-
from django import forms
from django.contrib.auth.forms import AuthenticationForm
class NuevaSolicitudForm(forms.Form):
choices = (('1','Constancia de Estudios'),
('2','Constancia de Estudios con Periodo Vacacional'),
('3','Boleta Global'),
('4',... | CallmeTorre/Idalia | ESCOM/Area/forms.py | Python | apache-2.0 | 1,509 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-16 16:08
from __future__ import unicode_literals
import ckeditor.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0043_about'),
]
operations = [
migrations.Cr... | OKThess/website | main/migrations/0044_okthessmeetup.py | Python | mit | 775 |
'''Models for Pammy'''
from django.db import models
from django.dispatch import receiver
from closuretree.models import ClosureModel
from .fields import IPNetworkField
from .utils import subnet_complement
class Allocation(ClosureModel):
name = models.CharField(max_length=500)
network = IPNetworkField(uniqu... | ocadotechnology/pammy | pammy/models.py | Python | gpl-3.0 | 2,736 |
# This file is part of beets.
# Copyright 2015, Pedro Silva.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, mod... | ruippeixotog/beets | beetsplug/duplicates.py | Python | mit | 13,370 |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 01 13:21:57 2014
@author: Acer
"""
class Raintanksetup:
def __init__(self, numberofRaintanks, starting_value_i, **Raintankattributes ):
self.numberofRaintanks = numberofRaintanks
self.Raintankattributelist = []
self.Raintanknodelist = []
... | iut-ibk/DynaMind-ToolBox | DynaMind-Performance-Assessment/3rdparty/CD3Waterbalance/Modelcreator/Raintanksetup.py | Python | gpl-2.0 | 1,578 |
# Copyright (C) 2010 Google Inc. All rights reserved.
# Copyright (C) 2013 Apple 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 ... | sloanyang/aquantic | Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py | Python | gpl-2.0 | 23,429 |
__all__ = ["echo", "surround", "reverse"] | XDrake99/IDTP | protocol/__init__.py | Python | mit | 41 |
import sublime
from . import SblmCmmnFnctns
class Spinner:
SYMBOLS_ROW = u'←↑→↓'
SYMBOLS_BOX = u'⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'
def __init__(self, symbols, view, startStr, endStr):
self.symbols = symbols
self.length = len(symbols)
self.position = 0
self.stopFlag = False
self.view = view
self.startStr = startStr
self.... | rusiv/BSScript | bsscript/bsscriptSblm/Spinner.py | Python | mit | 784 |
"""Plotting module that can plot 2D and 3D functions
"""
try:
try:
from ctypes import *
except:
raise ImportError("ctypes is required for plotting.\n"
"'easy_install ctypes' or visit "
"http://sourceforge.net/projects/ctypes/")
def Plot(*a... | ichuang/sympy | sympy/plotting/__init__.py | Python | bsd-3-clause | 3,982 |
"""Support for Canary sensors."""
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.icon import icon_for_battery_level
from . import DATA_CANARY
SENSOR_VALUE_PRECISION = 2
ATTR_AIR_QUALITY = "air_quality"
# Sensor types are defined like so:
# sen... | MartinHjelmare/home-assistant | homeassistant/components/canary/sensor.py | Python | apache-2.0 | 4,232 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import admin
from vendor.paypal.standard.ipn.models import PayPalIPN
class PayPalIPNAdmin(admin.ModelAdmin):
date_hierarchy = 'payment_date'
fieldsets = (
(None, {
"fields": [
"flag", "txn_id", "txn_type", "p... | huihoo/reader | vendor/paypal/standard/ipn/admin.py | Python | mit | 2,505 |
# Copyright 2009 Noam Yorav-Raphael
#
# This file is part of DreamPie.
#
# DreamPie 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.
# ... | noamraph/dreampie | dreampielib/data/subp_main.py | Python | gpl-3.0 | 1,566 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.5.0)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x02\xd0\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x20\x0... | mokachokokarbon/Tsuki | src/resources/resources.py | Python | mit | 15,812 |
# -*- coding: utf-8 -*-
__author__ = "Sergey Karakovskiy, sergey at idsia fullstop ch"
__date__ = "$May 1, 2009 2:46:34 AM$"
from marioagent import MarioAgent
class ForwardAgent(MarioAgent):
""" In fact the Python twin of the
corresponding Java ForwardAgent.
"""
action = None
actionStr = None
... | hunse/mario-ai | src/amico/python/agents/forwardagent.py | Python | bsd-3-clause | 7,913 |
# -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify... | MalkIPP/ipp_work | ipp_work/reforms/ir_reduc.py | Python | agpl-3.0 | 2,110 |
#!/usr/bin/python
# -*- coding:utf-8 -*-
from jpype import *
import logging
import time
import settings_MQ as settings
logger = logging.getLogger("MQPullConsumer")
__all__ = ["MQPushConsumer"]
DefaultMQPushConsumer= JPackage('com.alibaba.rocketmq.client.consumer').DefaultMQPushConsumer
MQClientException = JPackage(... | GangLuICT/RMQ-Client4Python | MQPushConsumer.py | Python | mit | 8,416 |
import re
import os
from setuptools import setup, Extension
from codecs import open
from os import path
version_file = open("tsfm/_version.py", "r").read()
version_match = re.match(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file)
if (version_match):
version = version_match.group(1)
else:
raise RuntimeError... | tlawrence3/tsfm | setup.py | Python | lgpl-3.0 | 2,152 |
# -*-coding:Utf-8 -*
# Copyright (c) 2014 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# lis... | stormi/tsunami | src/test/primaires/scripting/fonctions/test_indice.py | Python | bsd-3-clause | 2,605 |
# pylint: disable=invalid-name
"""TVM operator for softmax and log_softmax compute."""
from __future__ import absolute_import
import tvm
@tvm.tag_scope(tag='softmax_output')
def softmax(x, axis=-1):
"""Perform softmax activation on the data
Parameters
----------
data : tvm.Tensor
can be any di... | phisiart/tvm | topi/python/topi/nn/softmax.py | Python | apache-2.0 | 2,430 |
# Save parameters every a few SGD iterations as fail-safe
SAVE_PARAMS_EVERY = 1000
import glob
import random
import numpy as np
import os.path as op
import pickle as pickle
def load_saved_params():
""" A helper function that loads previously saved parameters and resets iteration start """
st = 0
for f in ... | kingtaurus/cs224d | assignment1/q3_sgd.py | Python | mit | 4,190 |
import numpy
#
# creates twoslits.pol
#
corners = numpy.array([-1.0,-1.0,1,1])*1e-4 # x_leftbottom,y_leftbottom,x_rightup,y_roghtup
t = numpy.array([0,11.3e-4])/2 # translation vector (i.e., horiz. and V preiods)
n = numpy.array([0,1]) # number of translation (H,V)
file_name = 'twoslits.pol'
f = open(file_name,'w'... | srio/ShadowOui-Tutorial | SCRIPTS/script26_twoslits.py | Python | mit | 844 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... | fingeronthebutton/RIDE | src/robotide/lib/robot/model/modifier.py | Python | apache-2.0 | 2,081 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adopteitor_core', '0010_ipn'),
]
operations = [
migrations.AlterModelOptions(
name='ipn',
options={'... | smarbos/adopteitor-server | adopteitor_core/migrations/0011_auto_20170221_2157.py | Python | mit | 368 |
# Test Tree:
# 7 <- root
# / 7 \
# 4 7 9
# / 4 \ \
# 2 5 10
import ternary_tree as t_tree
def _insert_nodes(tree):
""" Helper method to create above test tree structure."""
tree.insert(7)
tree.insert(9)
tree.insert(4)
tree.insert(7)
tree.insert(4)
tree.insert(2)
tree... | vishnun/python-programs | test_ternary_tree.py | Python | mit | 2,164 |
#!/usr/bin/env python
import os
import django
# Base paths
DJANGO_ROOT = os.path.dirname(os.path.realpath(django.__file__))
SITE_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
# Debugging
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS =... | hacktyler/hacktyler_crime | config/settings.py | Python | mit | 4,568 |
from zzeppelin.util import _subgen
class SoundGenerator( _subgen.SubGenerator ):
pass
# -------------------------------
from zzeppelin.util._subgen import Generate
| ZoyaEngine/zoyazeppelin | src/zzeppelin/util/sound.py | Python | gpl-3.0 | 173 |
# -*- coding: utf-8 -*-
"""@package UF
Declaração das classes para UF dos estados.
Este modulo contem declação da classe de modelo
para as UF de os estados.
"""
class Uf:
""" UF de estados """
def __init__(self):
self.tufuf = ''
self.tufdenominacao = '' | matheus-fonseca/acidentes-em-rodovias | acidentes_em_rodovias/app/models/uf.py | Python | gpl-3.0 | 265 |
import datetime
import json
import mock
import pyquery
from nose.tools import eq_, ok_
from django.core.urlresolvers import reverse
from django.utils.timezone import utc
from waffle import Switch
from crashstats.crashstats.tests.test_views import BaseTestViews, Response
from crashstats.supersearch.views import get_r... | bsmedberg/socorro | webapp-django/crashstats/supersearch/tests/test_views.py | Python | mpl-2.0 | 31,386 |
from morsel.panda import *
from morsel.geometries.box import Box as Base
from morsel.nodes.ode.solid import Solid
#-------------------------------------------------------------------------------
class Box(Solid, Base):
def __init__(self, **kargs):
super(Box, self).__init__(**kargs)
#---------------------------... | kralf/morsel | python/lib/morsel/nodes/ode/solids/box.py | Python | gpl-2.0 | 688 |
from __future__ import absolute_import, print_function
from flask import Flask
def create_app():
return Flask('create_app')
def create_app2(foo, bar):
return Flask("_".join(['create_app2', foo, bar]))
def create_app3(foo, bar, script_info):
return Flask("_".join(['create_app3', foo, bar]))
| tristanfisher/flask | tests/test_apps/cliapp/factory.py | Python | bsd-3-clause | 310 |
# Copyright 2011 Justin Santa Barbara
# 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... | ycl2045/nova-master | nova/virt/driver.py | Python | apache-2.0 | 52,734 |
#!/usr/bin/env kross
# -*- coding: utf-8 -*-
import os, datetime, sys, traceback, pickle
import Kross, Plan
T = Kross.module("kdetranslation")
class BusyinfoImporter:
def __init__(self, scriptaction):
self.scriptaction = scriptaction
self.currentpath = self.scriptaction.currentPath()
se... | yxl/emscripten-calligra-mobile | plan/plugins/scripting/scripts/busyinfoimport.py | Python | gpl-2.0 | 2,939 |
"""
This module contains some assorted functions used in tests
"""
from __future__ import absolute_import
import os
from importlib import import_module
from twisted.trial.unittest import SkipTest
from scrapy.exceptions import NotConfigured
from scrapy.utils.boto import is_botocore
def assert_aws_environ():
"""... | umrashrf/scrapy | scrapy/utils/test.py | Python | bsd-3-clause | 3,020 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you c... | kaji-project/shinken | shinken/eventhandler.py | Python | agpl-3.0 | 5,296 |
#
# 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... | DinoCow/airflow | airflow/executors/local_executor.py | Python | apache-2.0 | 14,191 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
#
# author: javi santana
from fabric.api import *
from fabric.contrib.files import upload_template
from fabric.contrib.files import exists
import os.path
import tempfile
import fab_python
def svn_checkout(to_dir):
""" checkout svn repository into dir """
cmd = "s... | frhumanes/consulting | web/deploy/wtdeploy/wtdeploy/modules/fab_django.py | Python | apache-2.0 | 3,798 |
# -*- coding: utf-8 -*-
import logging, logging.handlers
from django.conf import settings
def get_logger(name, level=logging.INFO, format='[%(asctime)s] %(message)s', handler=None, filename=None):
new_logger = logging.getLogger(name)
new_logger.setLevel(level)
if not handler:
filename = filename... | leliel12/handy | handy/logger.py | Python | bsd-3-clause | 733 |
import time
import sys,os
lib_path = os.path.abspath('./modules')
sys.path.append(lib_path)
from py532lib.i2c import *
from py532lib.frame import *
from py532lib.constants import *
class NFCmonitor :
NEWTAG = 1
REMOVETAG = 2
def __init__(self) :
self.cardIn = False
self.UUID = []
... | belese/luciphone | Luciphone/modules/py532lib/NFC.py | Python | gpl-2.0 | 1,850 |
"""
BrowserID support
"""
from social.backends.base import BaseAuth
from social.exceptions import AuthFailed, AuthMissingParameter
class PersonaAuth(BaseAuth):
"""BrowserID authentication backend"""
name = 'persona'
def get_user_id(self, details, response):
"""Use BrowserID email as ID"""
... | nvbn/python-social-auth | social/backends/persona.py | Python | bsd-3-clause | 1,664 |
"""
Module with functionality for splitting and shuffling datasets.
"""
import numpy as np
from sklearn.utils import murmurhash3_32
from spotlight.interactions import Interactions
def _index_or_none(array, shuffle_index):
if array is None:
return None
else:
return array[shuffle_index]
de... | maciejkula/spotlight | spotlight/cross_validation.py | Python | mit | 6,519 |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import sys
if not (sys.version_info.major == 3 and sys.version_info.minor > 5):
print("Python version %s.%s not supported version 3.6 or above required - exiting" % (sys.version_info.major,sys.version_info.minor))
sys.exit(1)
# To be executed in the SchemaTerms/e... | schemaorg/schemaorg | software/SchemaTerms/example-code/jinjaTemplating/simpleJinjaHtml.py | Python | apache-2.0 | 4,454 |
def parse_csv(text):
'''
Parses CSV with a header. Returns a list of dicts, one per line of data.
'''
# Split the text into lines.
lines = text.split('\n')
# The header is the first line; remaining lines contain data.
header = lines[0]
data_lines = lines[1 :]
# The columns names are... | alexhsamuel/codex | solutions/csv.py | Python | mit | 750 |
#!/usr/bin/env python
import sys
from galaxy.util.checkers import is_gzip
def main():
"""
The format of the file is JSON::
{ "sections" : [
{ "start" : "x", "end" : "y", "sequences" : "z" },
...
]}
This works only for UNCOMPRESSED fastq files. The Python ... | icaoberg/cellorganizer-galaxy-tools | datatypes/converters/fastq_to_fqtoc.py | Python | gpl-3.0 | 1,305 |
def maximum_value(maximum_weight, items):
totals = [[0 for _ in range(len(items) + 1)]
for _ in range(maximum_weight + 1)]
for weight in range(1, maximum_weight + 1):
for index, item in enumerate(items, 1):
if item["weight"] <= weight:
value = item["value"] + \... | behrtam/xpython | exercises/knapsack/example.py | Python | mit | 653 |
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def get_install_requires():
return [line.strip() for line in read("requirements.txt").split("\n") if line]
setup(
packages=find_packages(),
install_requires=get... | janesolomon/twitter_search | setup.py | Python | mit | 342 |
# Importing required libraries, setting up logging, and loading questions
import logging
import random # noqa: F401
import pandas as pd
from IPython.display import display
from pandas.io.formats.style import Styler
from pybatfish.client.session import Session # noqa: F401
# noinspection PyUnresolvedReferences
from... | batfish/pybatfish | jupyter_notebooks/startup.py | Python | apache-2.0 | 1,759 |
#!/usr/bin/env python
# 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
# "Li... | mrkm4ntr/incubator-airflow | docs/build_docs.py | Python | apache-2.0 | 14,120 |
from setuptools import setup
setup(
name="singlemodule",
version="0.0.1",
description="A sample Python project with a single module",
py_modules=["singlemodule"],
)
| sbidoul/pip | tests/data/src/singlemodule/setup.py | Python | mit | 182 |
from O365.attachment import Attachment
from O365.contact import Contact
from O365.group import Group
import logging
import json
import requests
log = logging.getLogger(__name__)
class Message(object):
'''
Management of the process of sending, recieving, reading, and editing emails.
Note: the get and set methods a... | roycem90/python-o365 | O365/message.py | Python | apache-2.0 | 9,031 |
from __future__ import unicode_literals
from frappe import _
app_name = "erpnext"
app_title = "ERPNext"
app_publisher = "Frappe Technologies Pvt. Ltd."
app_description = """ERP made simple"""
app_icon = "fa fa-th"
app_color = "#e74c3c"
app_email = "info@erpnext.com"
app_license = "GNU General Public License (v3)"
sour... | ESS-LLP/erpnext-medical | erpnext/hooks.py | Python | gpl-3.0 | 13,893 |
import logging
from waitlist.storage.database import Waitlist, Character, HistoryEntry
from waitlist.base import db
import flask
from waitlist.data.sse import GongSSE, send_server_sent_event
from waitlist.utility.history_utils import create_history_object
from flask_login import current_user
from waitlist.ts3.connectio... | SpeedProg/eve-inc-waitlist | waitlist/utility/notifications.py | Python | mit | 2,084 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
# Copyright 2012 Google, 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
#
# ... | austinwagner/sublime-sourcepawn | watchdog/utils/dirsnapshot.py | Python | mit | 9,600 |
# use the files in this folder first!
#import os, sys
#sys.path.insert(0, os.path.abspath("."))
from bbfreeze import Freezer
includes = ['coherence', 'setuptools', 'cairo',
'pango', 'gtk', 'pangocairo', 'atk', 'xml',
'coherence.base',
#'netifaces'
]
f = Freezer("build", incl... | ismaelgaudioso/UPnP-Inspector | win32/compile.py | Python | mit | 437 |
#!/usr/bin/env python
# This file is part of VoltDB.
# Copyright (C) 2008-2015 VoltDB Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at you... | wolffcm/voltdb | src/catgen/catalog_utils/strings.py | Python | agpl-3.0 | 1,677 |
import sys
import os
import os.path as osp
import re
import fnmatch
import json
import hashlib
import codecs
import traceback
from time import time
from stat import ST_ATIME, ST_MTIME, ST_MODE, S_IMODE, S_IFMT
from stat import S_IFREG, S_ISDIR, S_ISREG
PYSIDE_FOUND = True
try:
from PySide import QtGui, QtCore
exc... | sebcourtois/pypeline-tool-devkit | pytd/util/fsutils.py | Python | gpl-3.0 | 28,594 |
# -*- coding: utf-8 -*-
from django.conf import settings
import mock
import urlparse
import amo
import amo.tests
from addons.models import Addon
from applications.models import AppVersion
from files.utils import make_xpi
from versions.compare import version_int
from zadmin import tasks
def RequestMock(response='', ... | mdaif/olympia | apps/zadmin/tests/test_tasks.py | Python | bsd-3-clause | 7,541 |
import json
from twisted.web import http, resource
from Tribler.community.tunnel.tunnel_community import TunnelCommunity
class DebugEndpoint(resource.Resource):
"""
This endpoint is responsible for handing requests regarding debug information in Tribler.
"""
def __init__(self, session):
reso... | vandenheuvel/tribler | Tribler/Core/Modules/restapi/debug_endpoint.py | Python | lgpl-3.0 | 2,937 |
"""
Many-to-one relationships that can be null
To define a many-to-one relationship that can have a null foreign key, use
``ForeignKey()`` with ``null=True`` .
"""
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Reporter(models.Model):
... | BrotherPhil/django | tests/many_to_one_null/models.py | Python | bsd-3-clause | 885 |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
| vialink/skd | keys/tests.py | Python | bsd-2-clause | 184 |
import os
import subprocess
from flask import Flask, abort, make_response
import yaml
app = Flask(__name__)
TEST_ARGS = ['python2', '/opt/solution.py']
@app.errorhandler(500)
def _handle_exception(error):
return error, 500
def _read_static_flag():
try:
with open('/etc/config.yml') as f:
... | avatao/challenge-engine | templates/telnet/controller/opt/server.py | Python | apache-2.0 | 1,810 |
from typing import List
from ..data_store_encryptor import get_datastore_encryptor
from . import IFieldEncryptor
class StringListEncryptor(IFieldEncryptor):
@staticmethod
def encrypt(value: List[str]):
return [get_datastore_encryptor().encrypt(string) for string in value]
@staticmethod
def d... | guardicore/monkey | monkey/monkey_island/cc/server_utils/encryption/field_encryptors/string_list_encryptor.py | Python | gpl-3.0 | 425 |
from itertools import permutations
import sys
def main(filepath):
with open(filepath, 'r') as f:
for line in f.readlines():
if line:
line = line.strip()
perms = permutations(line)
results = [''.join(x) for x in perms]
pri... | tdsymonds/codeeval | python/hard/(14) string-permutations.py | Python | mit | 403 |
# -*- coding: utf-8 -*-
import datetime
import json
import re
import urllib.parse
import httmock
import jwt
import requests
from girder.exceptions import ValidationException
from girder.models.setting import Setting
from girder.models.token import Token
from girder.models.user import User
from girder.settings import ... | girder/girder | plugins/oauth/plugin_tests/oauth_test.py | Python | apache-2.0 | 63,218 |
import socket
from socksv.socksvSocketServer import socksvSocketServer
def main():
s = socket.socket()
s.connect(("127.0.0.1",1234))
s.send(b'\x05\x01\x00')
rply = s.recv(2)
print("innoSocks local-server reply:", rply)
b = bytearray(b'\x05\x01\x00\x01')
h = socket.gethostbynam... | securesocketimproved/ssi | tests/test_socksv_client.py | Python | gpl-3.0 | 756 |
#!/usr/bin/env python
# Copyright 2016 Criteo
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | natbraun/biggraphite | tests/test_drivers_utils.py | Python | apache-2.0 | 1,554 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
HELPER_SETTINGS = dict(
ROOT_URLCONF='example_app.urls',
INSTALLED_APPS=[
'sekizai',
'meta_mixin',
'example_app',
],
META_SITE_PROTOCOL='http',
META_USE_SIT... | motleytech/django-meta-mixin | cms_helper.py | Python | bsd-3-clause | 673 |
"""
This test tests that i18n extraction (`paver i18n_extract -v`) works properly.
"""
import os
import random
import re
import string
import subprocess
import sys
from datetime import datetime, timedelta
from unittest import TestCase
from i18n import config, dummy, extract, generate
from polib import pofile
from py... | cpennington/edx-platform | pavelib/paver_tests/test_extract_and_generate.py | Python | agpl-3.0 | 4,737 |
# -*- coding: ISO-8859-1 -*-
# Copyright 2010 Dirk Holtwick, holtwick.it
#
# 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... | alanjds/xhtml2pdf | test/cookbook.py | Python | apache-2.0 | 2,140 |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Laurent Bachelier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your o... | Boussadia/weboob | weboob/tools/browser2/cookies.py | Python | agpl-3.0 | 2,534 |
# -*- coding: UTF-8 -*-
"""
Copyright 2000, 2001, 2002, 2003, 2004, 2005 Dataprev - Empresa de Tecnologia e Informações da Previdência Social, Brasil
Este arquivo é parte do programa CACIC - Configurador Automático e Coletor de Informações Computacionais
O CACIC é um software livre; você pode re... | lightbase/pycacic | coletores/lib/url.py | Python | gpl-2.0 | 4,034 |
# RiveScript-Python
#
# This code is released under the MIT License.
# See the "LICENSE" file for more information.
#
# https://www.rivescript.com/
from __future__ import unicode_literals
import re
"""Common regular expressions used in RiveScript."""
# Common regular expressions.
class RE(object):
equals = ... | Dinh-Hung-Tu/rivescript-python | rivescript/regexp.py | Python | mit | 2,209 |
# Copyright 2008-2016 Free Software Foundation, Inc.
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
from __future__ import absolute_import
import os
from mako.template import Template
from .hier_block import HierBlockGenerator, QtHierBlockGenerator
from .top_block import TopBlockG... | skoslowski/gnuradio | grc/core/generator/Generator.py | Python | gpl-3.0 | 1,914 |
"""
What : Internet Group Management Protocol, Version 2
How : http://www.ietf.org/rfc/rfc2236.txt
Who : jesse @ housejunkie . ca
"""
from binascii import unhexlify
from construct import Byte, Enum,Struct, UBInt16
from construct.protocols.layer3.ipv4 import IpAddress
igmp_type = Enum(Byte("igmp_type"),
MEMBE... | gkonstantyno/construct | construct/protocols/layer3/igmpv2.py | Python | mit | 688 |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# create four cursors configured differently
cursor = vtk.vtkCursor2D()
cursor.SetModelBounds(15, 45, 15, 45, 0, 0)
cursor.SetFocalPoint(30, 30, 0)
cursor.AllOff()
cursor.AxesOn()
cu... | HopeFOAM/HopeFOAM | ThirdParty-0.1/ParaView-5.0.1/VTK/Filters/General/Testing/Python/cursor2D.py | Python | gpl-3.0 | 2,161 |
"""
Django settings for djdjdj project.
Generated by 'django-admin startproject' using Django 1.8.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths... | SimplyCo/django-jade-stylus-coffeescript | demo_project/settings.py | Python | mit | 4,283 |
import unittest
import sys
import _ast
from test import support
class TestSpecifics(unittest.TestCase):
def test_debug_assignment(self):
# catch assignments to __debug__
self.assertRaises(SyntaxError, compile, '__debug__ = 1', '?', 'single')
import builtins
prev = builtins.__debug_... | mancoast/CPythonPyc_test | fail/313_test_compile.py | Python | gpl-3.0 | 15,716 |
from abc import ABCMeta, abstractmethod
from core.statements import Statement
from enum import Enum
from typing import Dict, List, Set, Tuple, Generator, Union
class Node(metaclass=ABCMeta):
def __init__(self, identifier: int, stmts: List[Statement]):
"""Node of a control flow graph.
:param ident... | gitsimon/spadup-lyra | core/cfg.py | Python | mpl-2.0 | 7,292 |
#!/usr/bin/env python2.7
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
""" Basic selenium test runner
This script is used for running all selenium tests against the server defined
in the configuration yaml file. The script will wait a defined time for ... | AleksNeStu/ggrc-core | test/selenium/bin/run_selenium.py | Python | apache-2.0 | 1,534 |
from django.test import TestCase
from nav.models.arnold import Justification
from nav.auditlog import find_modelname
from nav.auditlog.models import LogEntry
from nav.auditlog.utils import get_auditlog_entries
class AuditlogModelTestCase(TestCase):
def setUp(self):
# This specific model is used because... | UNINETT/nav | tests/integration/auditlog_test.py | Python | gpl-2.0 | 4,631 |
#!/usr/bin/env python
# Copyright (C) 2014 Bitergia
#
# 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... | jalonsob/Informes | vizgrimoire/EventsDS.py | Python | gpl-3.0 | 10,162 |
from haystack.generic_views import FacetedSearchView
from haystack.generic_views import FacetedSearchMixin
from hs_core.discovery_form import DiscoveryForm, FACETS_TO_SHOW
from haystack.query import SearchQuerySet
from django.conf import settings
class DiscoveryView(FacetedSearchView):
facet_fields = FACETS_TO_SH... | hydroshare/hydroshare | hs_core/views/discovery_view.py | Python | bsd-3-clause | 4,275 |
#
# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
#
"""
VNC Ingress management for kubernetes
"""
import uuid
from config_db import *
from vnc_api.vnc_api import *
from kube_manager.common.kube_config_db import IngressKM
from kube_manager.common.kube_config_db import NamespaceKM
from kube_manager.v... | nischalsheth/contrail-controller | src/container/kube-manager/kube_manager/vnc/vnc_ingress.py | Python | apache-2.0 | 36,050 |
import Deck
class AuctionException(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class Auction(object):
def __init__(self, deck, cardsOnTable):
if (len(cardsOnTable) != 8):
raise AuctionException("Auction must b... | straemer/PowerGrid | src/gamemaster/Auction.py | Python | gpl-3.0 | 353 |
#!/usr/bin/env python
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2010 Leszek Lesner leszek@zevenos.com
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published ... | raspberrypi/lxkeymap | setup.py | Python | gpl-3.0 | 3,508 |
'''
Created on 24.05.2015
@author: vvladych
'''
from MDO import MDO
class ForecastPublication(MDO):
sql_dict={"get_all":"SELECT sid, forecast_sid, publication_sid FROM fc_forecast_publication",
"get_all_foreign_key":"SELECT sid, forecast_sid, publication_sid FROM fc_forecast_publication WHERE f... | vvladych/forecastmgmt | src/forecastmgmt/model/forecast_publication.py | Python | unlicense | 1,271 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 计算1+2+3+...+100:
sum1 = 0
n = 1
while n <= 100:
sum1 = sum1 + n
n = n + 1
print("1+2+3+...+100 = ", sum)
# 计算1x2x3x...x100:
acc = 1
n = 1
while n <= 100:
acc = acc * n
n = n + 1
print("1x2x3x...x100 = ", acc)
| felix9064/python | Demo/liaoxf/do_while.py | Python | mit | 284 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.