code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import os
import json
import re
import os.path
import filecmp
import pipes
import fnmatch
import subprocess
import sublime
import sublime_plugin
import tempfile
import hashlib
from shutil import copyfile, rmtree
class SpyOnGemsCommand(sublime_plugin.WindowCommand):
def __init__(self, window):
self.setting... | naiyt/gem-spy | gem-spy.py | Python | mit | 5,667 |
"""
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> AB
"""
class Solution(object):
def convertToTitle(self, n):
"""
:type n: int
:rtype: str
"""
... | dichen001/Go4Jobs | JackChen/math/168. Excel Sheet Column Title.py | Python | gpl-3.0 | 489 |
#!/usr/bin/python
from tesselator import *
from block import *
from texture import *
from world import World
from pyglet import image
from pyglet.gl import *
from pyglet.window import key, mouse
import pyglet
class WorldRenderer(object):
def __init__(self, world):
self.cdisplays = {}
self.world = ... | Xyene/Pycraft | pycraft/world_renderer.py | Python | gpl-3.0 | 3,488 |
# Copyright (C) 2017 The YaCo Authors
#
# 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 ... | DGA-MI-SSI/YaCo | YaCo/export_all.py | Python | gpl-3.0 | 1,548 |
# Copyright (C) 2015 Canonical Ltd.
#
# Author: Ryan Harper <ryan.harper@canonical.com>
#
# Curtin 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
... | prometheanfire/cloud-init | cloudinit/net/udev.py | Python | gpl-3.0 | 1,944 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = "Stefan Mauerberger"
__copyright__ = "Copyright (C) 2017 Stefan Mauerberger"
__license__ = "GPLv3"
''' Save a plot of the path coverage as PGF file '''
import numpy as np
from matplotlib import pyplot as plt
from plotting import rcParams, prepare_map
from g... | mauimuc/gptt | src/fig_path_coverage.py | Python | gpl-3.0 | 1,159 |
# Copyright 2014 ETH Zurich
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | FR4NK-W/osourced-scion | python/lib/crypto/certificate_chain.py | Python | apache-2.0 | 6,886 |
# Copyright (C) 2013,2014,2015,2016 The ESPResSo project
# Copyright (C) 2012 Olaf Lenz
#
# This file is part of ESPResSo.
#
# ESPResSo 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 L... | KonradBreitsprecher/espresso | src/featuredefs.py | Python | gpl-3.0 | 6,633 |
"""
Takes GET/POST variable dictionary, as might be returned by ``cgi``,
and turns them into lists and dictionaries.
Keys (variable names) can have subkeys, with a ``.`` and
can be numbered with ``-``, like ``a.b-3=something`` means that
the value ``a`` is a dictionary with a key ``b``, and ``b``
is a list, the third(... | genixpro/formencode | formencode/variabledecode.py | Python | mit | 5,614 |
#
# Copyright 2015,2016,2017 Joseph C. Pietras
#
# 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... | ossCare/svnPlus | tagProtect/Python/setup.py | Python | gpl-2.0 | 2,721 |
# -*- coding: utf-8 -*-
import unittest
from .. import base
from ...patch import jsonpickle
from ...materials import compoundfromname
from ...materials import element
from ...materials import mixture
class test_base(unittest.TestCase):
@unittest.skipIf(compoundfromname.xraylib is None, "xraylib not installed")
... | woutdenolf/spectrocrunch | spectrocrunch/detectors/tests/test_base.py | Python | mit | 1,951 |
#
# __init__.py
#
# Copyright (C) 2010 Red Hat, 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 2 of the License, or
# (at your option) any later version.
#
# This program... | jordan-davis/lorax | src/pylorax/__init__.py | Python | gpl-2.0 | 12,617 |
import parsl
@parsl.bash_app
def my_app(cache=7):
assert type(cache) == int
return "true"
def test_default_value():
my_app().result()
def test_specified_value():
my_app(cache=8).result()
| Parsl/parsl | parsl/tests/test_bash_apps/test_keyword_overlaps.py | Python | apache-2.0 | 209 |
# -*- coding: utf-8 -*-
from koalixcrm.djangoUserExtension.models import *
from koalixcrm.djangoUserExtension.user_extension.user_extension import UserExtension, OptionUserExtension
from koalixcrm.djangoUserExtension.user_extension.template_set import TemplateSet, OptionTemplateSet
from koalixcrm.djangoUserExtension.... | dario61081/koalixcrm | koalixcrm/djangoUserExtension/admin.py | Python | bsd-3-clause | 1,838 |
# Copyright 2017-2021 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from sqlalchemy import (
Boolean,
CheckConstraint,
Column,
DateTime,
ForeignKey,
Index,
Integer,
LargeBinary,
String,
Text,
UniqueConstraint,
func,
schema,
... | wazo-pbx/xivo-auth | wazo_auth/database/models.py | Python | gpl-3.0 | 8,738 |
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase
class TestIrExportsLine(TransactionCase):
def setUp(self):
super(TestIrExportsLine, self).setUp()
self.ir_export... | Vauxoo/server-tools | base_jsonify/tests/test_ir_exports_line.py | Python | agpl-3.0 | 1,789 |
# coding=utf-8
import ROOT
import os
import time
import PIL.Image
import images2gif
import math
def calc_max_voigt_height(width, sigma_gaussian, mass, br, xs, num_bosons, int_lumi=1e-15):
"""
method estimates maximum voigt profile height (normalized to xs * int_lumi) for given lists of width and sigma
est... | MSSM-Higgs-Spectrum/mssm-higgs-viewer | animatehiggspeak.py | Python | gpl-3.0 | 14,832 |
# -*- test-case-name: twisted.test.test_log -*-
# Copyright (c) 2001-2008 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Logging and metrics infrastructure.
"""
from __future__ import division
import sys
import time
import warnings
from datetime import datetime
import logging
from zope.interface import... | ToxicFrog/lancow | madcow/include/twisted/python/log.py | Python | gpl-3.0 | 18,652 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 wi... | alexandrucoman/vbox-nova-driver | nova/utils.py | Python | apache-2.0 | 42,459 |
# __init__.py
__all__ = ['fbxreader']
| floooh/drahtgitter | drahtgitter/readers/__init__.py | Python | mit | 38 |
from django.conf.urls import url
import entities.funding_programs.views as views
urlpatterns = [
url(r'^$', views.funding_program_index, name='funding_program_index'),
url(r'^info/(?P<funding_program_slug>\S+)/$', views.funding_program_info, name='funding_program_info'),
]
| morelab/labman_ud | labman_ud/entities/funding_programs/urls.py | Python | gpl-3.0 | 285 |
#!/usr/bin/env python3
# Copyright (c) 2017-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test multiwallet.
Verify that a bitcoind node can load multiple wallet files
"""
from decimal import D... | jlopp/statoshi | test/functional/wallet_multiwallet.py | Python | mit | 21,944 |
# Inspired by our cat Pietje
from turtle import *
from random import *
speed (0)
colors = ('gray', 'green', 'red', 'white', 'blue', 'yellow')
delta = 8
threshold = 100
color ('black', 'black')
def maybe (bias = None):
return choice ([False, True, bias, bias] if bias != None else [False, True])
... | QQuick/Transcrypt | transcrypt/demos/turtle_demos/mondrian.py | Python | apache-2.0 | 2,044 |
# Copyright 2014 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.0
#
# Unless required by applicable law or a... | drssoccer55/RLBot | src/main/python/flatbuffers/encode.py | Python | mit | 1,555 |
import unittest
from . import testcases
def run():
s = unittest.defaultTestLoader.loadTestsFromModule(testcases)
unittest.TextTestRunner().run(s)
| gonczor/ServerPy | tests/test_runner.py | Python | gpl-2.0 | 157 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A tile source that serves local pre-generated GMT tiles.
Uses pyCacheBack to provide in-memory and on-disk caching.
"""
import os
import glob
import pickle
import wx
import tiles
import pycacheback
# if we don't have log.py, don't crash
try:
import log
except ... | robmcmullen/pySlip | pyslip/gmt_local_tiles.py | Python | mit | 14,138 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | zhouyao1994/incubator-superset | tests/celery_tests.py | Python | apache-2.0 | 13,335 |
#!/usr/bin/env python
# encoding: utf-8
from website.conferences.model import Conference
from osf.models import OSFUser as User
from modularodm import Q
from modularodm.exceptions import ModularOdmException
from website.app import init_app
import sys
import argparse
def main():
init_app(set_backends=True, routes=... | cwisecarver/osf.io | scripts/add_conference.py | Python | apache-2.0 | 3,002 |
import os
import logging
import tempfile
import zinc.utils as utils
from zinc.models import ZincFileList, ZincManifest
from zinc.archives import build_archive_with_manifest
log = logging.getLogger(__name__)
## TODO: real ignore system
IGNORE = ['.DS_Store']
class ZincBundleUpdateTask(object):
def __init__(sel... | mindsnacks/Zinc | src/zinc/tasks/bundle_update.py | Python | mit | 4,582 |
from dive_operator import DiveOperator
from dive_python_operator import DivePythonOperator
__all__ = ['DiveOperator', 'DivePythonOperator']
| industrydive/fileflow | fileflow/operators/__init__.py | Python | apache-2.0 | 141 |
import os
import numpy as np
import pandas as pd
from IPython import embed
from qlknn.models.ffnn import QuaLiKizNDNN, QuaLiKizComboNN, determine_settings
from qlknn.misc.analyse_names import is_pure_flux, is_flux, split_parts
pot_rot_vars = ['Machtor', 'Autor', 'Machpar', 'Aupar', 'gammaE']
class RotDivNN():
d... | Karel-van-de-Plassche/QLKNN-develop | qlknn/models/rotdiv.py | Python | mit | 5,174 |
#! /usr/bin/env python
#
# free.py ---
#
# Filename: free.py
# Description:
# Author: Werther Zhang
# Maintainer:
# Created: Sun Mar 12 11:26:41 2017 (+0800)
#
# Change Log:
#
#
import time
import json
import os
import random
import gc
from slackbot.bot import tick_task
from slackbot.bot import plugin_init
next_tim... | pengzhangdev/slackbot | slackbot/plugins/free.py | Python | mit | 586 |
from django.shortcuts import redirect
from cyder.core.cyuser.views import login_session
from cyder.core.cyuser.models import User
class DevAuthenticationMiddleware(object):
def process_request(self, request):
# Log in as development user.
if (not request.user.is_authenticated()
o... | akeym/cyder | cyder/middleware/dev_authentication.py | Python | bsd-3-clause | 795 |
import itertools
import logging
import time
import random
def retry(f, *allowed_exceptions, times=6, sleep=1, exponent=1, silent=False):
def fn(*a, **kw):
for i in itertools.count():
try:
return f(*a, **kw)
except allowed_exceptions:
raise
... | nathants/s | util/retry.py | Python | mit | 731 |
#! /usr/bin/python
# import packages
import gdal, ogr, osr, os
import rasterio
import numpy as np
import sys
#----------------------------------------
# Input functions
#----------------------------------------
# import raster to array
def raster2array(rasterfn):
raster = gdal.Open(rasterfn)
band = raster.Get... | BuddyVolly/OpenSARKit | lib/python/ost_io_ops.py | Python | mit | 3,781 |
# -*- coding: iso-8859-1 -*-
#Copyright (C) Fiz Vazquez vud1@sindominio.net
#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... | viiru-/pytrainer | pytrainer/activitypool.py | Python | gpl-2.0 | 2,440 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_v1beta1_generated_vizier_service_check_trial_early_stopping_state_async.py | Python | apache-2.0 | 1,697 |
#!/usr/bin/env python
# ##
# Copyright 2009-2015 Ghent University
#
# This file is part of hanythingondemand
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),... | ehiggs/hanythingondemand | hod/utils.py | Python | gpl-2.0 | 2,111 |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | plaid/plaid-python | plaid/model/payment_initiation_consent_constraints.py | Python | mit | 7,903 |
""" Store package data in a SQL database """
from datetime import datetime
import logging
import transaction
from pkg_resources import parse_version
from sqlalchemy import engine_from_config, distinct, Column, DateTime, Text
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmake... | johnswanson/pypicloud | pypicloud/cache/sql.py | Python | mit | 5,833 |
"""
Find runs that match crAssphage with a minimum number of runs, a minimum alignment length, and a minimum percent
identity
"""
import os
import sys
import argparse
import pysam
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Find bam files that match crAssphage")
parser.add_argume... | linsalrob/EdwardsLab | crAssphage/runs_that_match.py | Python | mit | 1,631 |
#!/usr/bin/env python
"""
Script to test that needed packages are correctly installed
Tested with:
- python-weka-wrapper 0.3.8
- LibSVM 1.0.8
- GridSearch 1.0.9
"""
import weka.core.jvm as jvm
from weka.core.converters import Loader
from weka.classifiers import Classifier, Evaluation, GridSearch
jvm.logger.setLevel(j... | srvanrell/libsvm-weka-python | GridSearch-LibSVM.py | Python | mit | 1,952 |
"""
``pas measure stop``
====================
**Usage:** ``pas jobmgr stop [-h]``
optional arguments:
-h, --help Show this help message and exit.
Stops the measures running on all hosts and for each interface as defined in
the :data:`INTERFACES <pas.conf.basesettings.INTERFACES>` and :data:`ROLES
<pas.conf.bases... | GaretJax/pop-analysis-suite | pas/commands/measure/stop.py | Python | mit | 951 |
class Rule:
def __init__(self, bookmark = "", weight = 1.0, text = "",
match_func = None, match_token = ""):
self.bookmark = bookmark
self.weight = weight
self.text = text
self.match_func = match_func
self.match_token = match_token
def weigh(self, file... | bspaans/bookmark-tools | btools/matching/Rule.py | Python | gpl-3.0 | 807 |
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------
# Name: sfp_coderepo
# Purpose: Identifies public code repositories associated with your target.
#
# Author: Steve Micallef <steve@binarypool.com>
#
# Created: 21/07/2015
# Copyright: ... | LubyRuffy/spiderfoot | modules/sfp_coderepo.py | Python | gpl-2.0 | 6,731 |
import pylab
from pycbc.waveform import get_td_waveform
from pycbc.detector import Detector
apx = 'SEOBNRv4'
# NOTE: Inclination runs from 0 to pi, with poles at 0 and pi
# coa_phase runs from 0 to 2 pi.
hp, hc = get_td_waveform(approximant=apx,
mass1=10,
mass2=1... | ligo-cbc/pycbc | examples/waveform/plot_detwaveform.py | Python | gpl-3.0 | 1,502 |
# The HashGenerator module hashes a video file using the Media Player Classic Hash
# as described and implemented at
# http://trac.opensubtitles.org/projects/opensubtitles/wiki/HashSourceCodes/
import struct, os
def HashFile(name):
try:
longlongformat = 'q' # long long
byte... | avirup/PersonalMovieManager | Scripts/HashGenerator.py | Python | mit | 1,291 |
#!/usr/bin/env python
import os
import glob
from setuptools import setup
from setuptools import find_packages
import thug
os.environ['BUILD_LIB'] = '1'
personalities_path = os.path.join(thug.__configuration_path__, "personalities")
rules_path = os.path.join(thug.__configuration_path__, "rules")
scripts_path... | buffer/thug | setup.py | Python | gpl-2.0 | 5,301 |
#!/usr/bin/env python
import os
import sys
import time
# When the parent dies we are seeing continual newlines, so we only access so many before stopping
counter = 1
# sleep a little bit or we will never see the asm in the configuration file
# and the message received just before we go to the established loop will b... | mshahbaz/exabgp | dev/apitest/operational-send.py | Python | bsd-3-clause | 1,251 |
# Copyright 2015 Metaswitch 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 law or agreed to in w... | alexhersh/libcalico | calico_containers/pycalico/ipam.py | Python | apache-2.0 | 36,358 |
#!/usr/bin/env python3
"""
@author Ashaya Sharma
@date July 21, 2015
Order of operations
Program that randomly generates order of operations problems and
checks if user answers them correctly.
MathSitter Beta
"""
from tkinter import *
from tkinter import messagebox
import random
import loaderMain
class OrderO... | ashayas/MathSitter | files/orderops1.py | Python | mit | 15,586 |
#!/usr/bin/python
import urllib2
import json, csv
import subprocess
import sys
import platform
import getopt
all_flag = False
download_flag = False
filename=None
offcore_events=[]
try:
opts, args = getopt.getopt(sys.argv[1:],'a,f:,d',['all','file=','download'])
for o, a in opts:
if o i... | jcmcclurg/serverpower | utilities/intel_pcm/pmu-query.py | Python | gpl-2.0 | 3,641 |
import os
import sys
import time
import urllib
import tempfile
from shutil import rmtree, copyfile
from distutils.dir_util import mkpath
import yaml
from jinja2 import Environment, PackageLoader, FileSystemLoader, StrictUndefined
from hokusai import CWD
from hokusai.lib.command import command
from hokusai.lib.confi... | izakp/hokusai | hokusai/commands/setup.py | Python | mit | 4,114 |
import copy
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
QUERIES = {
"tag": "get_taginfo",
"signature": "get_siginfo",
"file_type": "get_file_type",
"clamav": "get_clamavinfo",
"imphash": "get_imphash",
"yara_rule": "get_yarainfo",
"issuer_cn": ... | VirusTotal/content | Packs/MalwareBazaar/Integrations/MalwareBazaar/MalwareBazaar.py | Python | mit | 12,522 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - Load I18N Text
This macro has the main purpose of supporting Help* page authors
to insert the texts that a user actually sees on his screen into
the description of the related features (which otherwise could
get very confusing).
@copyright: ... | Glottotopia/aagd | moin/local/moin/build/lib.linux-x86_64-2.6/MoinMoin/macro/GetText.py | Python | mit | 632 |
from ..extensions import celery, redis_store
from APITaxi_models.taxis import TaxiRedis
from time import time
from flask import current_app
@celery.task(name='clean_geoindex_timestamps')
def clean_geoindex_timestamps():
max_time = time() - TaxiRedis._DISPONIBILITY_DURATION
redis_store.zremrangebyscore(current_... | l-vincent-l/APITaxi | APITaxi/tasks/clean_geoindex_timestamps.py | Python | agpl-3.0 | 894 |
"""
For detailed information please see
http://shotgunsoftware.github.com/shotgunEvents/api.html
Args based shared state
-----------------------
This plugin demoes how three callbacks can share state through the args argument
to registerCallback.
The shared state stores two counters one (sequential) will be increm... | Nvizible/shotgunEvents | src/examplePlugins/sharedStateB.py | Python | mit | 2,306 |
class TreeNode:
def __init__(self, key, val, left=None, right=None, parent=None):
self.key = key
self.value = val
self.left = left
self.right = right
self.parent = parent
def hasLeftChild(self):
return self.left
def hasRightChild(self):
... | oci1517/chapter-theoretical-cs | source/ds/bst/scripts/bst_miller.py | Python | gpl-2.0 | 7,336 |
"""
categories: Core,Functions
description: User-defined attributes for functions are not supported
cause: MicroPython is highly optimized for memory usage.
workaround: Use external dictionary, e.g. ``FUNC_X[f] = 0``.
"""
def f():
pass
f.x = 0
print(f.x)
| AriZuu/micropython | tests/cpydiff/core_function_userattr.py | Python | mit | 260 |
import unittest
import arff
class TestDecodeConversor(unittest.TestCase):
def get_conversor(self, *args, **kwargs):
conversor = arff.Conversor(*args, **kwargs)
return conversor
def test_real(self):
'''Convert real value.'''
conversor = self.get_conversor('REAL')
# From... | mfeurer/liac-arff | tests/test_conversor.py | Python | mit | 5,189 |
# Generated by Django 2.0.4 on 2018-05-25 02:59
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('article', '0003_article_... | kaideyi/KDYSample | kYPython/Django/mysite/article/migrations/0004_article_auther.py | Python | mit | 598 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import OrderedDict
from setuptools import setup, find_packages
def read_requirements(f):
with open(f, 'r', encoding='utf-8-sig') as fp:
reqs = fp.read().splitlines()
result = []
for line in reqs:
line = line.strip()
... | andreymal/mini_fiction | setup.py | Python | gpl-3.0 | 2,341 |
# NOTE: A large portion of ext_daemon is tested, but not included in
# Coverage report because nose/pytest/coverage lose sight of things after the
# sub-process is forked.
import os
from unittest.mock import patch
from pytest import raises
from cement.core.foundation import TestApp
from cement.core.exc import Framewor... | datafolklabs/cement | tests/ext/test_ext_daemon.py | Python | bsd-3-clause | 2,717 |
# Copyright 2014 Accuen
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | accuen/rqt | lib/rqt/cli_parser.py | Python | apache-2.0 | 6,256 |
from typing import Any, Dict
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.contrib.contenttypes.fields import GenericRelation
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.db import IntegrityError, models, transaction
from djang... | emanuelschuetze/OpenSlides | openslides/motions/models.py | Python | mit | 39,570 |
""" Client for interacting with Framework/BundleDelivery service
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import getpass
import tarfile
from six import BytesIO
from DIRAC import S_OK, S_ERROR, gLogger
from DIRAC.Core.Base.Client import ... | yujikato/DIRAC | src/DIRAC/FrameworkSystem/Client/BundleDeliveryClient.py | Python | gpl-3.0 | 6,477 |
#!/usr/bin/env python
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | cneill/barbican | barbican/cmd/keystone_listener.py | Python | apache-2.0 | 2,341 |
from flask import Flask
from flask.ext.misaka import Misaka
from flask.ext.mongoengine import MongoEngine
app = Flask(__name__)
app.config['SECRET_KEY'] = 'blogme'
app.config['MONGODB_SETTINGS'] = {
'db': 'flask-blog',
'host': '127.0.0.1',
'port': 27017
}
md = Misaka(app)
db = MongoEngine(app)
def regis... | syndbg/flask-blog | blog/__init__.py | Python | mit | 478 |
# -*- coding: utf-8 -*-
"""Family module for Vikidia."""
#
# (C) Pywikibot team, 2010-2016
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
from pywikibot import family
class Family(family.SubdomainFamily):
"""Family class for Vikidia."""
name =... | magul/pywikibot-core | pywikibot/families/vikidia_family.py | Python | mit | 639 |
# -*- coding: utf-8 -*-
# Copyright 2012 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 applic... | jumpstarter-io/keystone | keystone/tests/unit/test_backend_sql.py | Python | apache-2.0 | 39,227 |
#!/usr/bin/env python
# coding=utf-8
import sys
import imp
import os
import logging
import getpass
from optparse import OptionParser, OptionGroup
from threading import Thread
from Queue import Queue
from .greader import GReader
root_logger = logging.getLogger()
root_logger.setLevel(logging.WARNING)
def get_plugin... | wistful/grbackup | grbackup/grbackup.py | Python | mit | 9,549 |
"""
Provides factory methods to assemble the Galaxy web application
"""
import sys
import os
import os.path
import atexit
import warnings
import glob
from paste import httpexceptions
import pkg_resources
import galaxy.model
import galaxy.model.mapping
import galaxy.datatypes.registry
import galaxy.web.framework
impo... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/lib/galaxy/webapps/galaxy/buildapp.py | Python | gpl-3.0 | 31,390 |
#!/usr/bin/env python3
'''TTL mismatch test'''
from dnstest.utils import *
from dnstest.test import Test
t = Test()
zone = t.zone("example.com.")
master = t.server("knot")
t.link(zone, master, ddns=True)
t.start()
# Add new RR with different TTL to a RRSet that is already in the zone
# The UPDATE should be REFUS... | jkadlec/knot-dns-zoneapi | tests-extra/tests/ddns/ttl/test.py | Python | gpl-3.0 | 4,004 |
import sys
import xmlrpclib
proxy = xmlrpclib.ServerProxy("http://localhost:8000/")
res = proxy.get_article(sys.argv[1])
print res
| sysdream/pysqli | demos/proto/client.py | Python | mit | 133 |
import pytest
from run_dtox import run
class TestSimpleToxIni:
tox_ini = """[tox]
envlist = py26,py27,py33,py34,py35,pypy
skipsdist = True
"""
def test_dtox_empty_params(self):
# skip py32, there's something wrong with virtualenv+tox+py32
r = run(tox_ini=self.tox_ini)
assert r.retu... | realcundo/docker-tox | tests/test_simple_ini.py | Python | mit | 2,500 |
from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor
import win32com.client
factory = Factory()
factory.clients = []
class cmdr(Protocol):
def connectionMade(self):
self.factory.clients.append(self)
print "connection made"
print "clients are ",self.factory.clients
def... | dargus/cmdriface | python/win/server.py | Python | mit | 820 |
from crispy_forms.helper import FormHelper
from crispy_forms.layout import *
from crispy_forms.bootstrap import *
from crispy_forms.layout import Layout, Submit, Reset, Div
from django import forms
from django.contrib.auth.forms import UserCreationForm
from workflow.models import TolaUser
from django.contrib.auth.model... | mercycorps/TolaActivity | tola/forms.py | Python | apache-2.0 | 3,887 |
# Copyright 2016 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... | AndreasMadsen/tensorflow | tensorflow/contrib/learn/python/learn/utils/export.py | Python | apache-2.0 | 13,528 |
"""
Filters for FOIA models
"""
# Django
from django import forms
from django.contrib.auth.models import User
# Third Party
import django_filters
# MuckRock
from muckrock.core import autocomplete
from muckrock.core.filters import NULL_BOOLEAN_CHOICES
from muckrock.crowdsource.models import Crowdsource
class Crowds... | MuckRock/muckrock | muckrock/crowdsource/filters.py | Python | agpl-3.0 | 1,013 |
import os
import jinja2
from webapp2_extras import i18n
jinja_environment = jinja2.Environment(loader=jinja2.FileSystemLoader('static/templates'),extensions=['jinja2.ext.i18n'])
jinja_environment.install_gettext_callables(
i18n.gettext,
i18n.ngettext,
newstyle=True)
jinja_environment.filters.update({
'format_d... | helmuthb/devfest-at-site | handlers/__init__.py | Python | mit | 480 |
# Copyright 2018 OpenStack Foundation
# Copyright 2017 Letv Cloud Computing
# 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/l... | noironetworks/neutron | neutron/db/migration/alembic_migrations/versions/stein/expand/195176fb410d_router_gateway_ip_qos.py | Python | apache-2.0 | 1,514 |
#!/usr/bin/env python
import sys
import re
from helpers import *
PROGRAM_USAGE = """
SeqAn invalid identifiers detection script.
USAGE: invalid_identifiers.py BASE_PATH
BASE_PATH is the root path of all the folders to be searched.
This script generates a list of invalid identifiers found in the code base,
paired wi... | bkahlert/seqan-research | raw/workshop13/workshop2013-data-20130926/trunk/misc/renaming/invalid_identifiers.py | Python | mit | 5,253 |
import numpy
print(numpy.array(input().split(), float)[::-1])
| alexander-matsievsky/HackerRank | All_Domains/Python/Numpy/np-arrays.py | Python | mit | 63 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class TranslateError(Exception):
def __init__(self):
pass
class ScanError(TranslateError):
pass
class InvalidSyntaxError(TranslateError):
pass
class IncompleteSyntaxError(TranslateError):
pass
| bnjones/Mathics | mathics/core/parser/errors.py | Python | gpl-3.0 | 271 |
class SubrectangleQueries:
def __init__(self, rectangle: List[List[int]]):
self.rect=rectangle
def updateSubrectangle(self, row1: int, col1: int, row2: int, col2: int, newValue: int) -> None:
for r in range(row1,row2+1):
for l in range(col1, col2+1):
... | jianjunz/online-judge-solutions | leetcode/1572-subrectangle-queries.py | Python | mit | 666 |
# Copyright (C) 2016-2019 Virgil Security Inc.
#
# Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>
#
# 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) Redistribution... | VirgilSecurity/virgil-sdk-python | virgil_sdk/jwt/__init__.py | Python | bsd-3-clause | 1,844 |
# Copyright 2018 The TensorFlow Constrained Optimization 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
#
#... | google-research/tensorflow_constrained_optimization | tensorflow_constrained_optimization/python/rates/expression_test.py | Python | apache-2.0 | 13,709 |
#! /usr/bin/python -u
""" FileLock - Implements a file lock mechanism that does not depend
on fcntl.
Copyright (c) 1997-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com
See the documentation for further information on... | Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/pyshared/mx/Misc/FileLock.py | Python | gpl-3.0 | 12,427 |
#!/usr/bin/env python
"""
<Program Name>
formats.py
<Author>
Geremy Condra
Vladimir Diaz <vladimir.v.diaz@gmail.com>
<Started>
Refactored April 30, 2012. -vladimir.v.diaz
<Copyright>
See LICENSE for licensing information.
<Purpose>
A central location for all format-related checking of TUF objects.
No... | team-ferret/pip-in-toto | pip/toto/ssl_crypto/formats.py | Python | mit | 25,848 |
import unittest
from weppy.test import *
from weppy.handler import *
from weppy.http import *
from weppy.wsgi import *
### Handlers ###
@url('/')
class RootHandler:
def get(self, req):
res = HTTPResponse('get, %s' % req.cookies.get('method', ''))
res.set_cookie('method', 'get')
return res
... | ral99/weppy | tests/unit_tests/test_test.py | Python | bsd-3-clause | 1,966 |
##########################################################################
#
# Copyright (c) 2013, Image Engine Design 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:
#
# * Redistrib... | hradec/gaffer | python/GafferSceneUI/InteractiveRenderUI.py | Python | bsd-3-clause | 14,585 |
#!/usr/bin/env python
#
# Copyright 2007 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | adviti/melange | thirdparty/google_appengine/google/storage/speckle/python/django/backend/oauth2storage.py | Python | apache-2.0 | 1,714 |
# -*- coding: utf-8 -*-
from __future__ import division
from numpy import maximum as max_, minimum as min_
from openfisca_france.model.base import * # noqa analysis:ignore
# Variables apparaissant dans la feuille de déclaration de patrimoine soumis à l'ISF
## Immeubles bâtis
class b1ab(Variable):
column = Int... | benjello/openfisca-france | openfisca_france/model/prelevements_obligatoires/isf.py | Python | agpl-3.0 | 29,309 |
"""
Generate argument list for benchmark ridge regression.
"""
from sklearn.model_selection import ParameterGrid
from util import write_config_file
import argparse
parser = argparse.ArgumentParser(description="Generate configuration file for bench_ridge")
parser.add_argument("tool", help="configuration for which tool... | doublsky/MLProfile | benchmark/gen_ridge_args.py | Python | mit | 1,089 |
from OpenGLCffi.GLES3 import params
@params(api='gles3', prms=['type', 'object', 'length', 'label'])
def glLabelObjectEXT(type, object, length, label):
pass
@params(api='gles3', prms=['type', 'object', 'bufSize', 'length', 'label'])
def glGetObjectLabelEXT(type, object, bufSize, length):
pass
| cydenix/OpenGLCffi | OpenGLCffi/GLES3/EXT/EXT/debug_label.py | Python | mit | 300 |
import pandas as pd
class IndexCache:
number = 1
repeat = (3, 100, 20)
params = [
[
"CategoricalIndex",
"DatetimeIndex",
"Float64Index",
"IntervalIndex",
"Int64Index",
"MultiIndex",
"PeriodIndex",
"Ran... | pandas-dev/pandas | asv_bench/benchmarks/index_cached_properties.py | Python | bsd-3-clause | 2,309 |
""" Functions related to calculating and saving the equivalent composition
of lignins (in terms of mole fractions of LIGC, LIGH, LIGO) from their
elemental compositions (available experimentally)."""
import numpy as np
# Atomic masses of C, H, O
M_C = 12.011
M_H = 1.0079
M_O = 15.999
# Number of carbon, hydrogen, oxy... | houghb/ligpy | ligpy/equivalent_compositions.py | Python | bsd-2-clause | 7,378 |
#
# This file is part of apt2d8.
#
# Copyright (C) 2013 David Gnedt
#
# apt2d8 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.
#
# apt... | lxp/apt2d8 | src/apt2d8/daemon/hostmanager.py | Python | gpl-3.0 | 3,545 |
import jps
import time
def callback(msg):
print(msg)
sub = jps.Subscriber('/hoge1', callback)
try:
while True:
sub.spin_once()
time.sleep(0.1)
except KeyboardInterrupt:
pass
| OTL/jps | samples/subscriber_spin_once.py | Python | apache-2.0 | 205 |
# -*- coding: utf-8 -*-
'''
Genesis Add-on
Copyright (C) 2015 lambda
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 opt... | hexpl0it/plugin.video.genesi-ita | resources/lib/resolvers/promptfile.py | Python | gpl-3.0 | 1,470 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.