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 copy import copy
def traverse_pre(expression, visitor):
if not visitor.control.should_skip(expression):
expression.accept(visitor)
if not visitor.control.should_skip():
children = expression.get_children()
if children:
for c in children:
... | dasdy/genexpr | genast/traverse.py | Python | mit | 830 |
#!C:\Users\ponto frio\PycharmProjects\MarceloSandovalScript\backend\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'Unidecode==0.4.18','console_scripts','unidecode'
__requires__ = 'Unidecode==0.4.18'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry... | marcelosandoval/tekton | backend/venv/Scripts/unidecode-script.py | Python | mit | 388 |
from threading import RLock
class CheckStatusException(Exception):
def __init__(self, status, previous_stage, exception):
super(CheckStatusException, self).__init__('{0.step!r} had an exception when checking its status: {1!r}'.format(status, exception))
self.exception = exception
self.stat... | python-daisychain/daisychain | daisychain/step_status.py | Python | mit | 2,994 |
#!/usr/bin/env python
#
# Copyright (c) 2013 by California Institute of Technology
# 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 retain the above cop... | pombredanne/nTLP | contrib/readdstar.py | Python | bsd-3-clause | 8,154 |
# -*- coding: utf-8 -*-
from south.v2 import DataMigration
from vosae_settings.models import TenantSettings
from invoicing import PAYMENT_CONDITIONS
class Migration(DataMigration):
def forwards(self, orm):
for tenant_settings in TenantSettings.objects.all():
if hasattr(tenant_settings.invoic... | Naeka/vosae-app | www/vosae_settings/migrations/0004_new_payment_conditions.py | Python | agpl-3.0 | 2,558 |
import os
import json
import random
import string
from django.views.generic import View
from django.http import HttpResponse
from django.conf import settings
from django.db import transaction
from djcelery import celery
try:
from PIL import Image, ImageDraw, ImageFont, ImageFilter
except ImportError:
import Im... | Virako/authapi | authapi/captcha/views.py | Python | agpl-3.0 | 4,606 |
#! /usr/bin/env python3
#
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | google/neural-logic-machines | difflogic/nn/rl/__init__.py | Python | apache-2.0 | 627 |
from mojo.events import addObserver
from mojo.drawingTools import *
from math import hypot
from AppKit import *
class PointDistanceController(object):
def __init__(self):
# subscribe to the draw event
addObserver(self, "draw", "draw")
addObserver(self, "draw", "drawBackground")
... | typemytype/RoboFontExamples | observers/drawSelectedPointDistances.py | Python | mit | 3,312 |
from __future__ import division
from __future__ import print_function
import dateutil
import dateutil.tz
import datetime
import argparse
import pprint
from misc.datasets import TextDataset
from stageI.model import CondGAN
from stageI.trainer import CondGANTrainer
from misc.utils import mkdir_p
from misc.config import... | hanzhanggit/StackGAN | stageI/run_exp.py | Python | mit | 2,223 |
# Copyright © 2020, Joseph Berry, Rico Tabor (opendrop.dev@gmail.com)
# OpenDrop is released under the GNU GPL License. You are free to
# modify and distribute the code, but always under the same license
#
# If you use this software in your research, please cite the following
# journal articles:
#
# J. D. Berry, M. J. ... | jdber1/opendrop | opendrop/app/ift/image_processing/services/image_processing.py | Python | gpl-3.0 | 3,424 |
from JumpScale import j
class LogRotate(object):
def start(self):
j.system.process.execute('logrotate /etc/logrotate.d/*')
def stop(self):
pass
def restart(self):
pass
def status(self):
pass
| Jumpscale/jumpscale6_core | lib/JumpScale/lib/platform/logrotate/cmdtools/LogRotate.py | Python | bsd-2-clause | 245 |
import sublime
import sublime_plugin
import subprocess
import os
class ProjectCopyFile(sublime_plugin.WindowCommand):
def run(self):
a = subprocess.check_output('ls -t ~/work', shell=True)
projects = bytes.decode(a).splitlines()
file_name = self.window.active_view().file_name()
if not file_name:
return se... | mreq/dotfiles | subl/Packages/User/project_copy_file.py | Python | mit | 981 |
import numpy as np
import pandas as pd
import networkx as nx
from indra.statements import *
from indra.assemblers.indranet.net import default_sign_dict
from indra.assemblers.indranet import IndraNetAssembler, IndraNet
ev1 = Evidence(pmid='1')
ev2 = Evidence(pmid='2')
ev3 = Evidence(pmid='3')
st1 = Activation(Agent('a... | sorgerlab/belpy | indra/tests/test_indranet_assembler.py | Python | mit | 13,200 |
import traceback
from PyQt5 import QtCore
import androguard.session as session
from androguard.core import androconf
import logging
log = logging.getLogger("androguard.gui")
class FileLoadingThread(QtCore.QThread):
file_loaded = QtCore.pyqtSignal(bool)
def __init__(self, parent=None):
QtCore.QThre... | shuxin/androguard | androguard/gui/fileloading.py | Python | apache-2.0 | 1,625 |
from amqpstorm.management import ManagementApi
from amqpstorm.message import Message
from amqpstorm.tests import HTTP_URL
from amqpstorm.tests import PASSWORD
from amqpstorm.tests import USERNAME
from amqpstorm.tests.functional.utility import TestFunctionalFramework
from amqpstorm.tests.functional.utility import setup
... | eandersson/amqpstorm | amqpstorm/tests/functional/management/test_basic.py | Python | mit | 2,514 |
# -*- coding: utf-8 -*-
from nose.tools import * # PEP8 asserts
from modularodm import StoredObject, fields
def test_subclass():
"""Test that fields are inherited from superclasses.
"""
class ParentSchema(StoredObject):
_id = fields.StringField()
parent_field = fields.StringField()
... | chrisseto/modular-odm | tests/test_subclass.py | Python | apache-2.0 | 470 |
import os
from django.core.management.base import BaseCommand, CommandError
from django.template.loader import render_to_string
DEFAULT_FILE = 'dashboard.py'
class Command(BaseCommand):
help = ('Creates a template file containing the base code to get you '
'started with your custom dashboard.')
ar... | Merino/django-admin-tools | admin_tools/dashboard/management/commands/customdashboard.py | Python | mit | 898 |
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# capable Trace security capabilitiy checks (cap_capable()).
# For Linux, uses BCC, eBPF. Embedded C.
#
# USAGE: capable [-h] [-v] [-p PID] [-K] [-U]
#
# Copyright 2016 Netflix, Inc.
# Licensed under the Apache License, Version 2.0 (the "Licen... | tuxology/bcc | tools/capable.py | Python | apache-2.0 | 8,423 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This python module defines a wrapper for synthesising spectra using TurboSpectrum.
"""
import logging
from numpy import RankWarning
from warnings import simplefilter
from .turbospectrum import TurboSpectrum
from .solar_abundances import solar_abundances
__version__... | dcf21/4most-4gp | src/pythonModules/fourgp_specsynth/fourgp_specsynth/__init__.py | Python | mit | 666 |
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be use... | jasonrbriggs/proton | python/proton/xmlutils.py | Python | apache-2.0 | 1,920 |
import os
from fontbakery.profiles.universal import UNIVERSAL_PROFILE_CHECKS
from fontbakery.checkrunner import Section, WARN, PASS #, INFO, ERROR, SKIP, FAIL
from fontbakery.callable import check #, disable
from fontbakery.message import Message
from fontbakery.fonts_profile import profile_factory
from fontbakery.con... | graphicore/fontbakery | Lib/fontbakery/profiles/notofonts.py | Python | apache-2.0 | 6,244 |
import sys
from django.core.management.base import BaseCommand
from isg.libcache import coa_is_locked, lock_coa, unlock_coa
from isg.models import CoaQueue
from isgtool.contrib import log
from time import sleep
class Command(BaseCommand):
help = 'Run pending CoA job'
def handle(self, *args, **options):
... | k-vinogradov/isgtool | isg/management/commands/pending_coa.py | Python | gpl-2.0 | 807 |
# -*- coding: utf-8 -*-
from flask import Blueprint
auth = Blueprint('auth', __name__)
from . import views
| Git-Hexin/zhihuweb | app/auth/__init__.py | Python | mit | 108 |
# -*- coding: utf-8 -*-
import cPickle as pickle
import numpy as np
from sklearn.externals import joblib
from config import *
from lib.utils import *
from lib import kappa
from lib.data_io import Essays
dataset = joblib.load(DATASETS_PATH + "dataset_2_SE")
all_pred = pickle.load(open(MODELS_PATH + "ENSEMBLE_dataset_... | pjankiewicz/essay_scoring | export_results_se.py | Python | gpl-3.0 | 6,187 |
try:
import collections.abc
except ImportError:
import collections
collections.abc = collections
from .mkExceptions import UnknownFile
from .grants.cihrGrant import parserCIHRfile, isCIHRfile
from .grants.nsercGrant import parserNSERCfile, isNSERCfile
from .grants.nsfGrant import parserNSFfile, isNSFfile
... | networks-lab/metaknowledge | metaknowledge/fileHandlers.py | Python | gpl-2.0 | 1,794 |
# 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... | tensorflow/tensorflow | tensorflow/python/keras/optimizer_v2/adadelta_test.py | Python | apache-2.0 | 7,875 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2020 The Project X-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
import json
import math
import os
imp... | SymbiFlow/prjxray | fuzzers/028-fifo-config/top.py | Python | isc | 6,372 |
# 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... | gunan/tensorflow | tensorflow/python/keras/engine/training_dataset_test.py | Python | apache-2.0 | 21,265 |
## Graphite local_settings.py
# Edit this file to customize the default Graphite webapp settings
#
# Additional customizations to Django settings can be added to this file as well
#####################################
# General Configuration #
#####################################
# Set this to a long, random unique s... | 7digital/grafana-graphite-server-cookbook | files/default/graphite-web-configs/local_settings.py | Python | mit | 8,294 |
import bpy
bpy.context.object.data.sky.atmosphere_turbidity = 2.00000023842
bpy.context.object.data.sky.sky_blend_type = 'ADD'
bpy.context.object.data.sky.sky_blend = 1.0
bpy.context.object.data.sky.horizon_brightness = 0.100000016391
bpy.context.object.data.sky.spread = 1.0
bpy.context.object.data.sky.sky_color_space ... | cschenck/blender_sim | fluid_sim_deps/blender-2.69/2.69/scripts/presets/sunsky/mountain.py | Python | gpl-3.0 | 697 |
# Copyright (c) 2007-2009 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test cases for L{twisted.names.srvconnect}.
"""
from twisted.internet import defer, protocol
from twisted.names import client, dns, srvconnect
from twisted.names.common import ResolverBase
from twisted.names.error import DNSNameErro... | sorenh/cc | vendor/Twisted-10.0.0/twisted/names/test/test_srvconnect.py | Python | apache-2.0 | 4,628 |
# -*- encoding: utf-8 -*-
"""Utility functions for downloading files, ...
Copyright (C) 2017 Max Maass
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... | malexmave/pdok-mirror | util/util.py | Python | agpl-3.0 | 4,905 |
# Copyright (c) 2012 Rackspace Hosting
# All Rights Reserved.
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/license... | zhimin711/nova | nova/cells/rpc_driver.py | Python | apache-2.0 | 6,521 |
import sys
import os
import commands
import fnmatch
import re
import subprocess, shlex, shutil
import difflib, time
def cmdsplit(args):
if os.sep == '\\':
args = args.replace('\\', '\\\\')
return shlex.split(args)
def cleanDirs(path):
if not os.path.isdir(path):
return... | aerospark/FML | update_patches.py | Python | lgpl-2.1 | 3,033 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Cubic ERP - Teradata SAC (<http://cubicerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the ... | miltonruelas/cursotecnico | branch/sale_reseller/sale.py | Python | agpl-3.0 | 1,661 |
# Assign the formatter to variable to pass on to print
formatter = "{} {} {} {}"
# display the values and pass them to formatter
print(formatter.format(1, 2, 3, 6))
print(formatter.format("one", "two", "three", "four"))
print(formatter.format(True, False, False, True))
print(formatter.format(formatter, formatter, form... | hbenaouich/Learning-Python | Learning-Python3-The-Hard-Way/8-Printing, Printing/ex8.py | Python | apache-2.0 | 450 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio 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 t... | robk5uj/invenio | modules/bibrank/lib/bibrank_downloads_grapher.py | Python | gpl-2.0 | 14,074 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Vaucher
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | MackZxh/OCA-Choice | reporting-engine/base_report_assembler/ir_report.py | Python | lgpl-3.0 | 4,125 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_02/operations/_iot_hub_operations.py | Python | mit | 9,101 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
#
# Copyright (C) 2017 Lenovo, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Licens... | caphrim007/ansible | lib/ansible/modules/network/cnos/cnos_factory.py | Python | gpl-3.0 | 3,939 |
from django.contrib import admin
from django.db import models
from django import forms
from adhack.adapp.models import PollOption, Poll
class MyWhackyForm(forms.Form):
subject = forms.CharField(max_length=30)
adverb = forms.CharField(max_length=30)
adjective = forms.CharField(max_length=30)
options ... | HonzaKral/custom_admin_form | adhack/adapp/admin.py | Python | bsd-3-clause | 1,411 |
from django.contrib.auth import update_session_auth_hash
from rest_framework import serializers
from authentication.models import Account
class AccountSerializer(serializers.ModelSerializer):
password = serializers.CharField(write_only=True, required=False)
confirm_password = serializers.CharField(write_only=T... | hamicornfury/twistbit_django_angular_boilerplate | src/authentication/serializers.py | Python | mit | 1,762 |
# Copyright 2013 Rackspace Hosting 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 re... | rackerlabs/quark | quark/plugin_modules/mac_address_ranges.py | Python | apache-2.0 | 4,487 |
from binary_tree_prototype import BinaryTreeNode
import random
import sys
# @include
def find_k_largest_in_bst(tree, k):
def find_k_largest_in_bst_helper(tree):
# Perform reverse inorder traversal.
if tree and len(k_largest_elements) < k:
find_k_largest_in_bst_helper(tree.right)
... | meisamhe/GPLshared | Programming/MPI — AMath 483 583, Spring 2013 1.0 documentation_files/find_k_largest_bst.py | Python | gpl-3.0 | 1,607 |
import time
import collections
from django_town.utils.with3 import urlparse, urlencode
from django.utils.six import iteritems
class DictObject(object):
def __init__(self, dict_object, case_sensitive=True):
if case_sensitive:
self._object = dict_object
else:
self._object = C... | uptown/django-town | django_town/utils/common.py | Python | mit | 6,994 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "base.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | galaxy-ctf/milky-way | manage.py | Python | agpl-3.0 | 802 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import io
import re
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import splitext
from setuptools import find_packages
fro... | syntazo/cachefabric | setup.py | Python | bsd-2-clause | 2,684 |
import argparse
import errno
import logging
import os
import platform
import signal
import sys
from collections import OrderedDict
from contextlib import closing
from distutils.version import StrictVersion
from functools import partial
from gettext import gettext
from itertools import chain
from pathlib import Path
fro... | melmorabity/streamlink | src/streamlink_cli/main.py | Python | bsd-2-clause | 37,841 |
# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
from __future__ import absolute_import
import sys
import logging
import unittest
from ..helpers import testenv
from unittest import SkipTest
from instana.singletons import tracer
if sys.version_info[0] > 2:
import MySQLdb
else:
raise SkipTest(... | instana/python-sensor | tests/clients/test_mysqlclient.py | Python | mit | 7,595 |
"""Deletes a Physical Network."""
from baseCmd import *
from baseResponse import *
class deletePhysicalNetworkCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "true"
"""the ID of the Physical network"""
"""Required"""
self.id = None
self.typeInfo['id'] =... | MissionCriticalCloud/marvin | marvin/cloudstackAPI/deletePhysicalNetwork.py | Python | apache-2.0 | 731 |
#!/usr/bin/env python
from setuptools import setup, find_packages
import numpy as np
from Cython.Build import cythonize
include_path = [np.get_include()]
ext_modules = cythonize('pyembree/*.pyx', language='c++',
include_path=include_path)
for ext in ext_modules:
ext.include_dirs = includ... | scopatz/pyembree | setup.py | Python | bsd-2-clause | 532 |
# 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... | hapylestat/apputils | src/modules/apputils/terminal/getch/keymapping_win.py | Python | lgpl-3.0 | 1,723 |
# Copyright 2017 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 agreed ... | supriyagarg/pydatalab | solutionbox/code_free_ml/mltoolbox/code_free_ml/setup.py | Python | apache-2.0 | 1,188 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 30, transform = "Anscombe", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_Lag1Trend/cycle_30/ar_12/test_artificial_128_Anscombe_Lag1Trend_30_12_20.py | Python | bsd-3-clause | 265 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
from autopilot.matchers import Eventually
from testtools.matchers import Equals
from bmicalc import tests
class MainViewTestCase(tests.BaseTestCase):
"""Tests for the mainview"""
def setUp(self):
super(MainViewTestCase, self)... | avi-software/bmicalc | app/tests/autopilot/weightcalc/tests/test_main.py | Python | gpl-3.0 | 671 |
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2010, Eucalyptus Systems, Inc.
#
# 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
# w... | Nexenta/s3-tests | virtualenv/lib/python2.7/site-packages/boto/ec2/image.py | Python | mit | 16,222 |
import hashlib
from simplejson.decoder import JSONDecodeError
from utils import json_functions as json
from django.contrib.auth.models import User
from django.core.cache import cache
from django.utils.http import urlquote
from django.http import HttpResponseForbidden
from django.http import HttpResponse
from django.con... | bruceyou/NewsBlur | utils/user_functions.py | Python | mit | 4,864 |
import math
import mxnet as mx
from mxnext.tvm.decode_bbox import decode_bbox
def _bbox_encode(F, ex_rois, gt_rois, means=[0., 0., 0., 0.], stds=[1., 1., 1., 1.]):
""" decode bbox
inputs:
F: symbol or ndarray
ex_rois: F, (#img, ..., 4)
gt_rois: F, (#img, ..., 4)
means: list, (4... | TuSimple/simpledet | models/FreeAnchor/ops.py | Python | apache-2.0 | 12,465 |
# -*- coding: utf-8 -*-
import unittest
from kodiswift import SortMethod
class TestSortMethod(unittest.TestCase):
def test_from_string(self):
known_values = [
('title', 9),
('TiTLe', 9),
('label', 1),
('LAbel', 1),
]
for sort_method, value i... | Sinap/kodiswift | tests/test_constants.py | Python | gpl-3.0 | 678 |
from fabric.api import env, task
from envassert import detect, file, group, port, process, service, \
user
from hot.utils.test import get_artifacts
@task
def check():
env.platform_family = detect.detect()
assert file.exists('/home/strongloop/loopback-example-app/package.json'), \
'/home/strongloo... | brint/strongloop | test/fabric/strongloop.py | Python | apache-2.0 | 1,034 |
"""
This inline script utilizes harparser.HAR from https://github.com/JustusW/harparser
to generate a HAR log object.
"""
try:
from harparser import HAR
from pytz import UTC
except ImportError as e:
import sys
print >> sys.stderr, "\r\nMissing dependencies: please run `pip install mitmproxy[exam... | devasia1000/anti_adblock | examples/har_extractor.py | Python | mit | 10,062 |
#!/usr/bin/env python3
"""Play the immortal game using push_san() from chess.Board()."""
import chess
import timeit
def play_immortal_game() -> None:
board = chess.Board()
# 1. e4 e5
board.push_san("e4")
board.push_san("e5")
# 2. f4 exf4
board.push_san("f4")
board.push_san("exf4")
... | niklasf/python-chess | examples/push_san.py | Python | gpl-3.0 | 1,996 |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from numpy.random import RandomState
from numpy import nan
from datetime import datetime
from itertools import permutations
from pandas import (Series, Categorical, CategoricalIndex,
Timestamp, DatetimeIndex,
Index, Inter... | lmallin/coverage_test | python_venv/lib/python2.7/site-packages/pandas/tests/test_algos.py | Python | mit | 57,570 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.core.signals import Signal
# Modifying signals
get_basket_comma... | hrayr-artunyan/shuup | shuup/front/signals.py | Python | agpl-3.0 | 494 |
# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for branch listing."""
__metaclass__ = type
from datetime import timedelta
import os
from pprint import pformat
import re
from lazr.uri import URI
from lxml import... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/code/browser/tests/test_branchlisting.py | Python | agpl-3.0 | 34,472 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... | les69/calvin-base | calvin/tests/security_test/store/io/StandardOutUnsigned.py | Python | apache-2.0 | 2,000 |
# -*- coding: utf-8 -*-
from flask import g, request
class MenuItem(object):
def __init__(self, path, text, name, submenu=[], current_func=None):
self.name = name
self.path = path
self.text = text
self._sub = submenu
self._current_func = current_func
@property
def ... | ktmud/david | david/ext/views/menu.py | Python | mit | 2,035 |
# 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... | tombstone/models | official/nlp/transformer/transformer_main.py | Python | apache-2.0 | 18,461 |
#
# Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
#
import gevent
import json
import ConfigParser
from StringIO import StringIO
from ConfigParser import NoOptionError, NoSectionError
import sys
import os
import psutil
import socket
import time
import subprocess
from subprocess import Popen, PIPE
impor... | nischalsheth/contrail-controller | src/nodemgr/common/event_manager.py | Python | apache-2.0 | 48,385 |
#!/usr/bin/env python3
# Generate RST lists of external dependencies.
import json
import os
import pathlib
import sys
import tarfile
import urllib.parse
from collections import defaultdict, namedtuple
# Information releated to a GitHub release version.
GitHubRelease = namedtuple('GitHubRelease', ['organization', 'pr... | envoyproxy/envoy | tools/docs/generate_external_deps_rst.py | Python | apache-2.0 | 5,493 |
#!/usr/bin/env python3
"""
Copyright 2017 Ryan Wick (rrwick@gmail.com)
https://github.com/rrwick/Porechop
Porechop makes use of C++ functions which are compiled in cpp_functions.so. This module uses ctypes
to wrap them in similarly named Python functions.
This file is part of Porechop. Porechop is free software: you... | lfaino/LoReAn | code/align.py | Python | mit | 8,759 |
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Rez Project
from __future__ import absolute_import
from rez import __version__
from rez.utils.data_utils import AttrDictWrapper, RO_AttrDictWrapper, \
convert_dicts, cached_property, cached_class_property, LazyAttributeMeta, \
deep_update, ... | instinct-vfx/rez | src/rez/config.py | Python | apache-2.0 | 34,372 |
#-*- coding: utf-8 -*-
###########################################################################
## ##
## Copyrights Frédéric Rodrigo 2011 ##
## ... | naoliv/osmose-backend | plugins/TagFix_MultipleTag_fr.py | Python | gpl-3.0 | 4,273 |
#!/usr/bin/env python
'''Cairoplot installation script.'''
from distutils.core import setup
import os
setup(
description='Cairoplot',
license='GNU LGPL 2.1',
long_description='''
Using Python and PyCairo to develop a module to plot graphics in an
easy and intuitive way, creating beautiful ... | mrooney/wxbanker | wxbanker/cairoplot/setup.py | Python | gpl-3.0 | 510 |
from django.core.management import call_command
from django.test import TestCase, override_settings
from six import text_type
from six.moves import StringIO
class MigrationTestCase(TestCase):
@override_settings(MIGRATION_MODULES={})
def test_for_missing_migrations(self):
output = StringIO()
... | yakky/django-cms | cms/tests/test_migrations.py | Python | bsd-3-clause | 817 |
#!/usr/bin/env python
import urllib2
import urllib
from BeautifulSoup import BeautifulSoup
import argparse
import os
import subprocess
import sys
from pydub import AudioSegment
from pydub.utils import db_to_float
#Overall info goes here.
___overview___ = {
'title': "Download Media from web",
}
#Script Info goes... | TonkWorks/scripts | webscripts/scripts/download_media.py | Python | mit | 3,306 |
from os import path
from time import sleep
import pkg_resources
import lxml.html
from requests import post
from timus.Exceptions import NetworkError, OnlineJudje
from timus.Templating import gen_source_file, gen_tests_file
from timus.TimusCompilers import lang_description, ext_by_lang
from timus.Logger import Log
B... | Shedward/timus | timus/OnlineJudje.py | Python | gpl-2.0 | 5,691 |
# -*- coding: utf-8 -*-
"""
"""
from pyacq import StreamHandler, FakeDigital
import zmq
import msgpack
import time
import multiprocessing as mp
def test_recv_loop(port, stop_recv):
print 'start receiver loop' , port
context = zmq.Context()
socket = context.socket(zmq.SUB)
socket.setsockopt(zmq.S... | Hemisphere-Project/Telemir-DatabitMe | Telemir-EEG/pyacq/example/example_with_fake_device/simple_digital.py | Python | gpl-2.0 | 1,427 |
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and ... | VcamX/grpc | src/python/grpcio/tests/unit/_links/_proto_scenarios.py | Python | bsd-3-clause | 8,073 |
"""
GNOME Shell extensions repository
Copyright (C) 2019 Yuri Konotopov <ykonotopov@gnome.org>
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 Lice... | GNOME/extensions-web | sweettooth/core/management/commands/compilemessages.py | Python | agpl-3.0 | 2,162 |
from vsg.rules import token_case
from vsg import token
lTokens = []
lTokens.append(token.package_body.body_keyword)
class rule_501(token_case):
'''
This rule checks the **body** keyword has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
... | jeremiah-c-leary/vhdl-style-guide | vsg/rules/package_body/rule_501.py | Python | gpl-3.0 | 563 |
# 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 agreed to in... | varuntiwari27/rally | rally/task/processing/charts.py | Python | apache-2.0 | 24,614 |
"""Represents a device for simctl."""
# pylint: disable=too-many-public-methods
import os
import re
import shlex
from typing import Any, Dict, List, Optional, Union
from isim.runtime import Runtime
from isim.device_type import DeviceType
from isim.base_types import SimulatorControlBase, SimulatorControlType
class ... | dalemyers/xcrun | isim/device.py | Python | mit | 14,800 |
from django.db import models
class Poll(models.Model):
question = models.CharField(max_length=200)
def __str__(self):
return "Q: %s " % self.question
class Choice(models.Model):
poll = models.ForeignKey(Poll, models.CASCADE)
choice = models.CharField(max_length=200)
def __str__(self):
... | Beauhurst/django | tests/null_queries/models.py | Python | bsd-3-clause | 763 |
"""Extensions to the 'distutils' for large or complex distributions"""
from fnmatch import fnmatchcase
import functools
import os
import re
import _distutils_hack.override # noqa: F401
import distutils.core
from distutils.errors import DistutilsOptionError
from distutils.util import convert_path
from ._deprecation... | pypa/setuptools | setuptools/__init__.py | Python | mit | 7,461 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import functools
import importlib
import inspect
import threading
from builtins import st... | foursquare/pants | tests/python/pants_test/engine/examples/parsers.py | Python | apache-2.0 | 10,272 |
from fabric.api import env, local, lcd
from fabric.context_managers import shell_env
from fabric.colors import red, green
from fabric.decorators import task, runs_once
from fabric.operations import prompt
from fabric.utils import abort
from zipfile import ZipFile
import datetime
import fileinput
import importlib
impor... | CENDARI/editorsnotes | fabfile.py | Python | agpl-3.0 | 9,706 |
#!/usr/bin/python2
# 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 w... | StuntsPT/4Pipe4_validator | comparer.py | Python | gpl-3.0 | 1,772 |
import json
import os
import time
import pUtil
import re
from subprocess import Popen, PIPE, STDOUT
class Job:
""" Job definition """
def __init__(self):
self.jobId = '0' # panda job id
self.homePackage = None # package name
self.trf = None ... | mlassnig/pilot | Job.py | Python | apache-2.0 | 61,860 |
import _plotly_utils.basevalidators
class BordercolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="bordercolor", parent_name="heatmapgl.hoverlabel", **kwargs
):
super(BordercolorValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/heatmapgl/hoverlabel/_bordercolor.py | Python | mit | 531 |
import os, subprocess
import sublime, sublime_plugin, io
class TestChooserCommand(sublime_plugin.WindowCommand):
def run(self, paths = [], name = ""):
self.settings = sublime.load_settings('TestChooser.sublime-settings')
search_terms = self.settings.get('search_terms')
self.terminal ... | CraigWilliams/TestChooser | test_chooser.py | Python | mit | 2,627 |
from collections.abc import Mapping
from ctypes import c_int, c_int32, c_double, c_char_p, POINTER, c_size_t
from weakref import WeakValueDictionary
import numpy as np
from numpy.ctypeslib import as_array
from openmc.exceptions import AllocationError, InvalidIDError, OpenMCError
from . import _dll, Nuclide
from .core... | tjlaboss/openmc | openmc/lib/material.py | Python | mit | 9,273 |
# -*- coding: utf-8 -*-
u"""1flow processors loader.
.. Copyright 2015 Olivier Cortès <oc@1flow.io>
This file is part of the 1flow project.
1flow 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 Found... | 1flow/1flow | oneflow/core/models/reldb/processor/loader.py | Python | agpl-3.0 | 13,298 |
#!/usr/bin/python
# Copyright 2016 Joel Dunham
#
# 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... | jrwdunham/old | onlinelinguisticdatabase/model/db_update_scripts/0.2.7_1.0a2/old_update_db_0.2.7_1.0a1.py | Python | apache-2.0 | 78,385 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 the BabelFish authors. All rights reserved.
# Use of this source code is governed by the 3-clause BSD license
# that can be found in the LICENSE file.
#
from __future__ import unicode_literals
from collections import namedtuple
from pkg_resources import resource_stream # ... | dantebarba/docker-media-server | plex/Subliminal.bundle/Contents/Libraries/Shared/babelfish/script.py | Python | gpl-3.0 | 2,054 |
"""
WSGI config for djdan project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` se... | BL-Labs/annotator_demonstrator | djdan/wsgi.py | Python | mit | 1,132 |
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from cfme.configure.configuration.region_settings import Category, Tag
from cfme.rest.gen_data import (
a_provider as _a_provider,
categories as _categories,
service_templates as _service_templates,
tags as _tags,
tenants as _tenants,
vm ... | jkandasa/integration_tests | cfme/tests/configure/test_tag.py | Python | gpl-2.0 | 12,666 |
# -*- coding: utf-8 -*-
"""
Contains `MockApi`, a fake `turses.api.ApiAdapter` implementation for debugging
purposes.
"""
import random
from time import sleep
from datetime import datetime
from turses.models import User, Status
from turses.meta import wrap_exceptions
from turses.api.base import ApiAdapter
def rand... | battlemidget/turses | turses/api/debug.py | Python | gpl-3.0 | 4,408 |
import base64
import boto3
import json
import os
import random
import uuid
from botocore.stub import Stubber
from moto import mock_dynamodb2
from cis_profile import fake_profile
from cis_profile import User
def profile_to_vault_structure(user_profile):
return {
"sequence_number": str(random.randint(100000... | mozilla-iam/cis | python-modules/cis_processor/tests/test_profile_delegate.py | Python | mpl-2.0 | 3,851 |
"""Add render_mode column to (sub-)contribution descriptions
Revision ID: 1b66d038da46
Revises: 8763fe20f41
Create Date: 2016-08-16 16:07:25.177573
"""
import sqlalchemy as sa
from alembic import op
from indico.core.db.sqlalchemy import PyIntEnum
from indico.core.db.sqlalchemy.descriptions import RenderMode
# revis... | DavidAndreev/indico | migrations/versions/201608161607_1b66d038da46_add_render_mode_column_to_sub_.py | Python | gpl-3.0 | 2,768 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.