code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# Copyright (c) 2016-2021 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.
import logging
import os
from argparse import Namespace
from shut... | renatahodovan/fuzzinator | fuzzinator/reduce/picireny.py | Python | bsd-3-clause | 6,022 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('program', '0009_host_remove_is_active'),
]
operations = [
migrations.RemoveField(
model_name='show',
name='i... | nnrcschmdt/helsinki | program/migrations/0010_show_remove_is_active.py | Python | bsd-3-clause | 348 |
from __future__ import absolute_import
import unittest
class TestContents(unittest.TestCase):
def test_dir(self):
import bokeh
names = dir(bokeh)
self.assertTrue("__version__" in names)
self.assertTrue("__base_version__" in names)
self.assertTrue("license" in names)
... | srinathv/bokeh | bokeh/tests/test_bokeh_init.py | Python | bsd-3-clause | 638 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import logging
import pyauto_functional # Must be imported before pyauto
import pyauto
import test_utils
class PopupsT... | keishi/chromium | chrome/test/functional/popups.py | Python | bsd-3-clause | 8,054 |
# ----------------------------------------------------------------------
# Copyright (c) 2013-2016 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including... | MarshallBrinn/geni-ch | tools/dbutils.py | Python | mit | 7,441 |
import beaglebone_pru_adc as adc
import time
print 'Will start capture, keep it running for 10 seconds, then get timer value'
print 'This is used to compute the capture speed (time value of one timer unit)'
print 'Please wait...'
capture = adc.Capture()
capture.encoder0_pin = 0 # AIN0, aka P9_39
capture.encoder1_pin... | thegmarlow/TagTrack- | examples/speed_control.py | Python | mit | 832 |
# -*- coding: utf-8 -*-
"""
Created on Mon May 26 23:42:03 2014
@author: Administrator
"""
from bilibili import *
import os
def fileRename(title):
if title.find('/') >= 0:
title = title.replace('/','');
if title.find(':') >= 0:
title = title.replace(':','');
if title.find('?') >= 0:
... | Vespa314/bilibili-api | bili-monitor/main.py | Python | mit | 2,030 |
# -*- coding: utf-8 -*-
__all__ = ['match', 'method', 'static_files', 'prefix',
'subdomain', 'namespace', 'by_method']
import six
import logging
import os
from os import path
from six.moves.urllib.parse import unquote
from webob.exc import HTTPMethodNotAllowed, HTTPNotFound
from webob.static import FileAp... | boltnev/iktomi | iktomi/web/filters.py | Python | mit | 12,418 |
from __future__ import absolute_import
from collections import defaultdict
import numpy as np
from sklearn.metrics import average_precision_score
from ..utils import to_numpy
def _unique_sample(ids_dict, num):
mask = np.zeros(num, dtype=np.bool)
for _, indices in ids_dict.items():
i = np.random.choi... | Cysu/open-reid | reid/evaluation_metrics/ranking.py | Python | mit | 4,126 |
class Solution(object):
def rearrangeString(self, s, k):
"""
:type s: str
:type k: int
:rtype: str
"""
counter = collections.Counter(s)
heap = []
for c, v in counter.items():
heapq.heappush(heap, (-v, c))
waiting = collections.deque... | Mlieou/oj_solutions | leetcode/python/ex_358_logn.py | Python | mit | 670 |
import pg
class Window(pg.Window):
def setup(self):
self.font = pg.Font(self, 1, '/Library/Fonts/Arial.ttf', 24)
self.wasd = pg.WASD(self)
self.wasd.look_at(pg.normalize((1, 0, 1)), (0, 0, 0))
self.context = pg.Context(pg.DirectionalLightProgram())
self.context.sampler = pg.... | kbrafford/pg | examples/textured_sphere.py | Python | mit | 1,340 |
# encoding: UTF-8
'''
vn.coincheck的gateway接入
'''
from __future__ import print_function
import os
import json
from datetime import datetime
from copy import copy
from threading import Condition
from Queue import Queue
from threading import Thread
import json
from vnpy.api.coincheck import vncoincheck
from vnpy.trader.... | harveywwu/vnpy | beta/gateway/coincheckGateway/coincheckGateway.py | Python | mit | 29,373 |
# Global state.
#
# * @author Ben Gardner October 2009
# * @author Guy Maurel October 2015
# * @author Matthew Woehlke June 2018
#
import os
test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
# sorted by lexicographic order
all_tests = [
'c-sharp',
'c',
'cpp',
... | nivekkagicom/uncrustify | tests/test_uncrustify/config.py | Python | gpl-2.0 | 782 |
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# chimera - observatory automation system
# Copyright (C) 2006-2007 P. Henrique Silva <henrique@astro.ufsc.br>
# 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 S... | wschoenell/chimera | src/chimera/interfaces/focuser.py | Python | gpl-2.0 | 5,743 |
try: from rsf.cluster import *
except: from rsf.proj import *
import fdmod,pplot
# ------------------------------------------------------------
# acoustic wave-equation modeling
#def awefd(odat,owfl,idat,velo,dens,sou,rec,custom,par):
# par['fdcustom'] = custom
#
# Flow( [odat,owfl],[idat,velo,dens,sou... | zxtstarry/src | book/Recipes/wefd.py | Python | gpl-2.0 | 10,390 |
from django.conf.urls import patterns, include, url
from .settings import settings, API_PREFIX, API_APPS_ENABLED
urlpatterns = patterns('nodeshot.core.api.views',
url(r'^%s$' % API_PREFIX, 'root_endpoint', name='api_root_endpoint'),
)
if 'rest_framework_swagger' in settings.INSTALLED_APPS:
urlpatterns += pa... | PabloCastellano/nodeshot | nodeshot/core/api/urls.py | Python | gpl-3.0 | 829 |
# -*- coding: utf-8 -*-
#
# sphinxcontrib-osaka documentation build configuration file, created by
# sphinx-quickstart on Sat Apr 10 11:39:05 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated f... | bboalimoe/ndn-cache-policy | docs/sphinx-contrib/osaka/doc/conf.py | Python | gpl-3.0 | 6,464 |
import discord
from sigma.core.utilities.role_processing import user_matching_role, matching_role
async def removerole(cmd, message, args):
if message.author.permissions_in(message.channel).manage_roles:
if args:
if len(args) >= 2:
if message.mentions:
targ... | AXAz0r/apex-sigma-core | sigma/modules/moderation/server_settings/roles/role_control/removerole.py | Python | gpl-3.0 | 2,018 |
# ------------------------------------------------------------------
# Copyright (c) 2020 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this software.
#
# SPD... | etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-lxml.isoschematron.py | Python | gpl-3.0 | 616 |
"""Unit tests for the ``foreman_tasks/api/v2/tasks`` paths.
:Requirement: Foremantask
:CaseAutomation: Automated
:CaseLevel: Component
:CaseComponent: TasksPlugin
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from nailgun import entities
from requests.exceptions import HTTPError
from robottelo.de... | ldjebran/robottelo | tests/foreman/api/test_foremantask.py | Python | gpl-3.0 | 1,295 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015, 2016 Canonical Ltd
#
# 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 by the Free Software Foundation.
#
# This program is distributed in... | tsdgeos/snapcraft | snapcraft/internal/common.py | Python | gpl-3.0 | 8,056 |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import sys, os, textwrap, subprocess, shutil, tempfile, atexit, glob
from setup imp... | drxaero/calibre | setup/install.py | Python | gpl-3.0 | 12,762 |
# -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2017 The HORTON Development Team
#
# This file is part of HORTON.
#
# HORTON is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by th... | QuantumElephant/horton | horton/grid/test/test_rtransform.py | Python | gpl-3.0 | 11,052 |
import random
import requests
from cloudbot import hook
from cloudbot.bot import bot
api_url = 'http://api.giphy.com/v1/gifs'
@hook.command("gif", "giphy")
def giphy(text):
"""<query> - Searches giphy.com for a gif using the provided search term."""
api_key = bot.config.get_api_key("giphy")
term = text... | tiredtyrant/CloudBot | plugins/giphy.py | Python | gpl-3.0 | 903 |
import re
import unittest
from numrangeregex import generate_numeric_range_regex
class NrRangeRegexGeneratorTest(unittest.TestCase):
def _verify_range(self, regex, min_, max_, from_min_, to_max_):
for nr in xrange(from_min_, to_max_ + 1):
if min_ <= nr <= max_:
self.assertTru... | tremby/deluge-yarss-plugin | yarss2/lib/numrangeregex/numrangeregex_test.py | Python | gpl-3.0 | 2,879 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from frappe.model.document import Document
class PackingSlipItem(Document):
pass
| mhbu50/erpnext | erpnext/stock/doctype/packing_slip_item/packing_slip_item.py | Python | gpl-3.0 | 264 |
# -*- coding: UTF-8 -*-
# Copyright (C) 2005-2008, 2010 J. David Ibáñez <jdavid.ibp@gmail.com>
# Copyright (C) 2008 David Versmisse <versmisse@lil.univ-littoral.fr>
# Copyright (C) 2008 Sylvain Taverne <taverne.sylvain@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the te... | bepatient-fr/itools | itools/xml/namespaces.py | Python | gpl-3.0 | 6,303 |
import frappe, re
from frappe import _
from erpnext.regional.india import states, state_numbers
def validate_gstin_for_india(doc, method):
if not hasattr(doc, 'gstin'):
return
if doc.gstin:
doc.gstin = doc.gstin.upper()
if doc.gstin != "NA":
p = re.compile("[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]... | emakis/erpnext | erpnext/regional/india/utils.py | Python | gpl-3.0 | 784 |
import datetime
import json
import responses
from tests.sampledata import SampleData
from treeherder.client.thclient import TreeherderClient
from treeherder.etl.jobs import store_job_data
from treeherder.etl.push import store_push_data
from treeherder.model import models
def post_collection(project, th_collection):... | tojonmz/treeherder | tests/test_utils.py | Python | mpl-2.0 | 8,259 |
# -*- coding: utf-8 -*-
# Copyright(C) 2013 franek
#
# 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 option... | blckshrk/Weboob | modules/arretsurimages/browser.py | Python | agpl-3.0 | 2,372 |
import unittest
from utils import mvs_rpc, common, code
from Roles import Alice, Bob, Cindy, Dale, Eric, Frank, Zac
class MVSTestCaseBase(unittest.TestCase):
roles = (Alice, Bob, Cindy, Dale, Eric, Frank, Zac)
need_mine = True
def setUp(self):
for role in self.roles:
try:
... | mvs-live/metaverse | test/test-rpc-v3/TestCase/MVSTestCase.py | Python | agpl-3.0 | 5,796 |
# coding: utf-8
# Copyright (c) 2001-2019, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public transport:
# a non ending quest to... | kinnou02/navitia | source/tyr/tests/integration/endpoints_test.py | Python | agpl-3.0 | 1,776 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import frappe.defaults
from frappe import msgprint, _
from frappe.utils import cstr, flt, cint
from erpnext.stock.stock_ledger import upda... | indictranstech/biggift-erpnext | erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py | Python | agpl-3.0 | 10,064 |
import os
import unittest
from collections import OrderedDict
from coalib.bearlib.languages import Language
from coalib.settings.Setting import (
Setting, path, path_list, url, typed_dict, typed_list, typed_ordered_dict,
glob, glob_list,
language,
float_list, bool_list, int_list, str_list,
)
from coali... | Nosferatul/coala | tests/settings/SettingTest.py | Python | agpl-3.0 | 6,809 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def convert_logs(apps, schema_editor):
'''
Adds a unit to users who have imperial units in the profile
'''
WorkoutLog = apps.get_model('manager', 'WorkoutLog')
UserProfile = apps.get_model('c... | DeveloperMal/wger | wger/manager/migrations/0007_auto_20160311_2258.py | Python | agpl-3.0 | 1,049 |
#
# edd.py
# BIOS EDD data parsing functions
#
# Copyright 2010-2015 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 la... | AdamWill/blivet | blivet/devicelibs/edd.py | Python | lgpl-2.1 | 31,893 |
#!/usr/bin/env python
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
# identity.py
# 2016 Marianna S. Buschle <msb@qtec.com>
#
# Simple identity element in python
#
# You can run the example from the source doing from gst-python/:
#
# $ export GST_PLUGIN_PATH=$GST_PLUGIN_PATH:$PWD/plugin:$PWD/examples/plugins
# $... | GStreamer/gst-python | examples/plugins/python/identity.py | Python | lgpl-2.1 | 1,496 |
# Copyright (C) 2007, Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distrib... | tchx84/debian-pkg-sugar-toolkit | src/sugar/graphics/toolbox.py | Python | lgpl-2.1 | 3,178 |
#!/usr/bin/python3
from zocp import ZOCP
import socket
import logging
class SubscriberNode(ZOCP):
# Constructor
def __init__(self, nodename):
super(SubscriberNode, self).__init__(nodename)
self.string_value = ''
self.count_value = 0
def run(self):
self.register_string("My ... | z25/pyZOCP | examples/signal_subscriber.py | Python | lgpl-3.0 | 1,017 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This file is part of the prometeo project.
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... | zuck/prometeo-erp | projects/forms.py | Python | lgpl-3.0 | 3,011 |
def counter():
print('counter: starting counter')
i = -3
while i < 3:
i = i + 1
print('counter: yield', i)
yield i
return None
# if __name__ == '__main__':
# print "the generator function:"
# print repr(counter)
# print "call generator function"
# c = counter()... | Baumelbi/IntroPython2016 | Examples/Session09/yield_example.py | Python | unlicense | 448 |
# 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, software
# distributed under t... | rushiagr/keystone | keystone/contrib/revoke/backends/sql.py | Python | apache-2.0 | 4,100 |
# Copyright 2013 IBM Corporation.
# 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... | yamt/tempest | tempest/services/compute/json/hypervisor_client.py | Python | apache-2.0 | 3,048 |
# Copyright 2011 OpenStack Foundation
# 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... | takeshineshiro/nova | nova/api/openstack/compute/server_metadata.py | Python | apache-2.0 | 7,641 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Tests for log entry API
'''
import unittest
from base64 import b64encode
from ooiservices.app import create_app, db
from ooiservices.app.models import User, UserScope
from ooiservices.app.models import OperatorEvent, OperatorEventType, Organization
from ooiservices.ap... | asascience-open/ooi-ui-services | ooiservices/tests/test_log_entries.py | Python | apache-2.0 | 10,833 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', which is part of this source code package.
#
import json
import time
from kubernetes_py.K8sExceptions import DrainNodeException, TimedOutException, NotFoundException
from kubernetes_py.K... | mnubo/kubernetes-py | kubernetes_py/K8sNode.py | Python | apache-2.0 | 12,352 |
# Copyright (c) 2010-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 applicable law or agree... | NeCTAR-RC/swift | test/unit/container/test_auditor.py | Python | apache-2.0 | 4,195 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/config/gslb/gslbservice_binding.py | Python | apache-2.0 | 3,851 |
from django.db.models import Q
from django.contrib.comments.models import CommentFlag
from zinnia.flags import PINGBACK
from zinnia.flags import TRACKBACK
from south.v2 import DataMigration
from zinnia.migrations import user_name
from zinnia.migrations import user_table
from zinnia.migrations import user_orm_label
f... | pczhaoyun/obtainfo | zinnia/migrations/0013_compute_discussion_count.py | Python | apache-2.0 | 11,229 |
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# compactsnoop Trace compact zone and print details including issuing PID.
# For Linux, uses BCC, eBPF.
#
# This uses in-kernel eBPF maps to cache process details (PID and comm) by
# compact zone begin, as well as a starting timestamp for calculati... | tuxology/bcc | tools/compactsnoop.py | Python | apache-2.0 | 11,168 |
# 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... | nburn42/tensorflow | tensorflow/python/keras/applications/nasnet.py | Python | apache-2.0 | 28,039 |
"""Generated test for checking pynos based actions
"""
import xml.etree.ElementTree as ET
from st2tests.base import BaseActionTestCase
from system_host_name import system_host_name
__all__ = [
'TestSystemHostName'
]
class MockCallback(object): # pylint:disable=too-few-public-methods
"""Class to hold mock ca... | tonybaloney/st2contrib | packs/vdx/tests/test_action_system_host_name.py | Python | apache-2.0 | 1,507 |
'''
eqtime: 30
'''
def main():
start_response_recorder()
info('Felix Furnace Hot Blank')
# prepare bone for furnace analysis
close('F')
open('D')
# isolate furnace from bone
close('J')
close('FC')
open('FH')
info('Running a Hot Blank')
do_extraction()
... | USGSDenverPychron/pychron | docs/user_guide/operation/scripts/examples/helix/extraction/felix_furnace_hot_blank.py | Python | apache-2.0 | 1,449 |
# Copyright 2015 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 ag... | KaranToor/MA450 | google-cloud-sdk/lib/surface/compute/groups/remove_members.py | Python | apache-2.0 | 2,728 |
# Copyright 2015 IBM Corp.
#
# 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 t... | affo/nova | nova/tests/functional/v3/test_baremetal_nodes.py | Python | apache-2.0 | 2,284 |
# Copyright 2012 Michael Still and Canonical 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
#
# ... | badock/nova | nova/virt/libvirt/imagecache.py | Python | apache-2.0 | 23,263 |
# 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... | clinc/models | slim/datasets/dataset_utils.py | Python | apache-2.0 | 4,382 |
import angr
import itertools
rand_count = itertools.count()
class random(angr.SimProcedure):
#pylint:disable=arguments-differ
IS_SYSCALL = True
def run(self, buf, count, rnd_bytes):
if self.state.mode == 'fastpath':
# Special case for CFG
if (not self.state.se.symbolic(co... | axt/angr | angr/procedures/cgc/random.py | Python | bsd-2-clause | 1,788 |
#!/usr/bin/env python
#-*-*- encoding: utf-8 -*-*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individual... | weblabdeusto/weblabdeusto | server/src/test/unit/weblab/core/webclient/__init__.py | Python | bsd-2-clause | 460 |
from contextlib import contextmanager
from django.core import checks
from django.test import TestCase
from wagtail.core.models import Page
from wagtail.search import index
from wagtail.tests.search import models
from wagtail.tests.testapp.models import EventPage, SingleEventPage
@contextmanager
def patch_search_fie... | jnns/wagtail | wagtail/search/tests/test_indexed_class.py | Python | bsd-3-clause | 5,140 |
from __future__ import division
import numpy as np
import math
import argparse
coords100 = np.array(
[[0.0, 0.0, 0.0],
[0.5, 0.5, 0.0],
[0.5, 0.0, 0.5],
[0.0, 0.5, 0.5]]
)
def generate_slab(args):
a = args.a
nslab = args.nslab
nvac = args.nvac
k = args.k
nlayers = nslab + nvac... | materialsvirtuallab/nano266 | labs/lab4/fcc_surf_gen.py | Python | bsd-3-clause | 2,339 |
#!/usr/bin/python
#
# Copyright (C) 2013 The Android Open Source Project
#
# 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 require... | Chilledheart/chromium | third_party/android_platform/development/scripts/symbol.py | Python | bsd-3-clause | 19,003 |
from __future__ import division
from itertools import chain
from operator import itemgetter, attrgetter
from collections import defaultdict
import math
from django.db import connection
from django.db import models
from django.db.models import Sum, Q, Count, F
from django.utils.translation import ugettext_lazy as _
fro... | navotsil/Open-Knesset | agendas/models.py | Python | bsd-3-clause | 28,365 |
from django.contrib import admin
from django.utils.translation import ugettext, ugettext_lazy as _
from ella.positions.models import Position
from ella.utils import timezone
class PositionOptions(admin.ModelAdmin):
def show_title(self, obj):
if not obj.target:
return '-- %s --' % ugettext('em... | petrlosa/ella | ella/positions/admin.py | Python | bsd-3-clause | 1,451 |
import unittest.mock
from django import forms
from django.apps import apps
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, Permission
from django.core.exceptions import ImproperlyConfigured
from django.core.files.uploadedfile import SimpleUp... | torchbox/wagtail | wagtail/users/tests/test_admin_views.py | Python | bsd-3-clause | 68,319 |
from cms.exceptions import SubClassNeededError
from cms.models import Title
from .models import PageExtension, TitleExtension
class ExtensionPool(object):
def __init__(self):
self.page_extensions = set()
self.title_extensions = set()
self.signaling_activated = False
def register(self... | SinnerSchraderMobileMirrors/django-cms | cms/extensions/extension_pool.py | Python | bsd-3-clause | 3,459 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import gzip
import os
import time
import zipfile
import six
def ArchiveFiles(host_files, output):
with zipfile.ZipFile(output, 'w', zipfile.ZIP_DEFLATED) ... | catapult-project/catapult | systrace/profile_chrome/util.py | Python | bsd-3-clause | 1,104 |
import pytest
import sqlalchemy as sa
from sqlalchemy_utils.aggregates import aggregated
@pytest.fixture
def Thread(Base):
class Thread(Base):
__tablename__ = 'thread'
id = sa.Column(sa.Integer, primary_key=True)
name = sa.Column(sa.Unicode(255))
@aggregated('comments', sa.Column... | konstantinoskostis/sqlalchemy-utils | tests/aggregate/test_simple_paths.py | Python | bsd-3-clause | 2,164 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Defines functionality for pipelined execution of interfaces
The `Workflow` class provides core functionality for batch processing.
Change directory to provide relative paths for doctests
>>> impo... | iglpdc/nipype | nipype/pipeline/engine.py | Python | bsd-3-clause | 101,179 |
#!/usr/bin/env python
#
# Author: Jon Trulson <jtrulson@ics.com>
# Copyright (c) 2015 Intel Corporation.
#
# 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
# wit... | pylbert/upm | examples/python/grovescam.py | Python | mit | 2,232 |
import base64
import json
import logging
import time
from jumpgate.common import aes
from jumpgate.common import exceptions
from jumpgate.common import utils
from jumpgate import config
DEFAULT_TOKEN_DURATION = 60 * 60 * 24
LOG = logging.getLogger(__name__)
def auth_driver():
return utils.load_driver(config.CON... | HOQTEC/MCP | jumpgate/identity/drivers/core.py | Python | mit | 8,862 |
import re
from loguru import logger
from flexget import plugin
from flexget.components.sites.urlrewriting import UrlRewritingError
from flexget.event import event
from flexget.utils.soup import get_soup
logger = logger.bind(name='koreus')
class UrlRewriteKoreus:
"""Koreus urlrewriter."""
# urlrewriter API... | Flexget/Flexget | flexget/components/sites/sites/koreus.py | Python | mit | 1,328 |
"""2008_明牌通知接口"""
import clr, sys
from action import *
from lang import Lang
clr.AddReference('ZyGames.Framework.Game')
clr.AddReference('ZyGames.Doudizhu.Lang')
clr.AddReference('ZyGames.Doudizhu.Model')
clr.AddReference('ZyGames.Doudizhu.Bll')
from ZyGames.Framework.Game.Service import *
from ZyGames.Doudiz... | wenhulove333/ScutServer | Sample/Doudizhu/Server/src/ZyGames.Doudizhu.HostServer/bin/Debug/Script/PyScript/Action/Action2008.py | Python | mit | 1,795 |
from libsaas import http, parsers, port
from libsaas.services import base
class ZendeskResource(base.RESTResource):
path = None
@base.apimethod
def get(self, page=None, per_page=None):
"""
For single-object resources, fetch the object's data. For collections,
fetch all of the obj... | livingbio/libsaas | libsaas/services/zendesk/resources.py | Python | mit | 13,572 |
# 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/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_10_01/operations/__init__.py | Python | mit | 591 |
import os
import sys
import re
import subprocess
import pprint
from clouseau_model import ClouseauModel
# -----------------------------------------------------------------------------------------------
class CommitParser:
"""
Converts git-show's stdout to Python dictionary for any commit messages and file ch... | willbarton/clouseau | clouseau/commit_parser.py | Python | cc0-1.0 | 5,062 |
#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error
class hostname(test.test):
"""
Autotest module for testing basic functionality
of hostname
@author Basavaraju.G <basavarg@in.ibm.com>
"""
version = 1
nfail = 0
... | rajashreer7/autotest-client-tests | linux-tools/hostname/hostname.py | Python | gpl-2.0 | 1,216 |
#
#
# Copyright (C) 2006, 2007, 2010, 2011, 2012, 2013 Google 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.
#
... | kawamuray/ganeti | lib/storage/drbd_cmdgen.py | Python | gpl-2.0 | 14,857 |
# Copyright (C) 2020 Red Hat, Inc., Jake Hunsaker <jhunsake@redhat.com>
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU Gen... | slashdd/sos | sos/policies/runtimes/podman.py | Python | gpl-2.0 | 649 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
SelectByLocation.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | herow/planning_qgis | python/plugins/processing/algs/qgis/SelectByLocation.py | Python | gpl-2.0 | 5,570 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2012-8 Met Office.
#
# This file is part of Rose, a framework for meteorological suites.
#
# Rose is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | matthewrmshin/rose | .travis/sitecustomize.py | Python | gpl-3.0 | 1,113 |
from itertools import chain
class DeleteLooseVerts(SvScriptSimpleFunction):
inputs = [("v", "verts"), ("s", "pol")]
outputs = [("v", "verts"), ("s", "pol")]
@staticmethod
def function(*args, **kwargs):
ve, pe = args
indx = set(chain.from_iterable(pe))
v_index = sorte... | taxpon/sverchok | node_scripts/SN2-templates/deleteloose.py | Python | gpl-3.0 | 551 |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Florent Fourcot
#
# 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 op... | nojhan/weboob-devel | modules/colisprive/module.py | Python | agpl-3.0 | 1,259 |
# The Hazard Library
# Copyright (C) 2013-2014, GEM Foundation
#
# 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 your option) any later version.
... | mmpagani/oq-hazardlib | openquake/hazardlib/tests/source/non_parametric_test.py | Python | agpl-3.0 | 5,224 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
if frappe.db.table_exists("Asset Adjustment") and not frappe.db.table_exists("Asset Value Adjustment"):
frappe.rename_... | gsnbng/erpnext | erpnext/patches/v11_0/rename_asset_adjustment_doctype.py | Python | agpl-3.0 | 459 |
# Copyright 2010-2012 RethinkDB, all rights reserved.
import sys, subprocess32, tempfile, string, signal, os
class RemotelyInternalError(Exception):
pass
class ScriptFailedError(Exception):
def __init__(self, exit_code):
self.exit_code = exit_code
def __str__(self):
return "Remote script f... | jfriedly/rethinkdb | scripts/nightly-test/remotely.py | Python | agpl-3.0 | 6,741 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | VitalPet/c2c-rd-addons | stock_invoice_service/__init__.py | Python | agpl-3.0 | 1,071 |
# -*- coding: utf-8 -*-
#
# PySPED - Python libraries to deal with Brazil's SPED Project
#
# Copyright (C) 2010-2012
# Copyright (C) Aristides Caldeira <aristides.caldeira at tauga.com.br>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Library General Public Lic... | renatonlima/PySPED | pysped/xml_sped/certificado.py | Python | lgpl-2.1 | 20,395 |
from rest_framework import serializers as ser
from api.base.utils import absolute_reverse
from api.base.serializers import JSONAPISerializer, LinksField, RelationshipField
class PreprintProviderSerializer(JSONAPISerializer):
filterable_fields = frozenset([
'name',
'description',
'id'
... | monikagrabowska/osf.io | api/preprint_providers/serializers.py | Python | apache-2.0 | 2,237 |
"""Support for Satel Integra zone states- represented as binary sensors."""
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from . import (
CONF_OUTPUTS,
CONF_ZONE... | leppa/home-assistant | homeassistant/components/satel_integra/binary_sensor.py | Python | apache-2.0 | 3,478 |
# Copyright 2017 Cloudbase Solutions Srl
#
# 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... | stackforge/cloudbase-init | cloudbaseinit/tests/plugins/common/test_trim.py | Python | apache-2.0 | 1,786 |
# Copyright 2015: Mirantis 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 b... | vishnu-kumar/PeformanceFramework | rally_os/plugins/openstack/context/heat/stacks.py | Python | apache-2.0 | 3,318 |
from collections import defaultdict
import enum
import opentracing
@enum.unique
class SpanRelationship(enum.Enum):
NONE = 0
FOLLOWS_FROM = 1
CHILD_OF = 2
class _SpanContext(opentracing.SpanContext):
def __init__(self, identity):
self.identity = identity
class _Span(opentracing.Span):
... | johnbelamaric/themis | vendor/github.com/grpc-ecosystem/grpc-opentracing/python/tests/_tracer.py | Python | apache-2.0 | 2,696 |
#
# 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... | mtagle/airflow | tests/providers/google/marketing_platform/hooks/test_search_ads.py | Python | apache-2.0 | 3,884 |
# calling convention constants
CC_REG = 1 << 0 # argument is stored in a register
CC_STACK = 1 << 1 # argument is stored on the stack
CC_STACK_INF = 1 << 2 # all following args are stored on the stack
CC_CALLEE_CLEANUP = 1 << 3 # callee cleans up the stack
CC_CALLER_CLEANUP ... | bat-serjo/vivisect | envi/const.py | Python | apache-2.0 | 471 |
import base64
import datetime
import re
import json
from dateutil import parser
from bson import json_util
from django.conf import settings
from django.db import models
from django.db.models.signals import post_save, pre_delete
from restservice.utils import call_service
from stats.tasks import stat_log
from utils.deco... | ultimateprogramer/formhub | odk_viewer/models/parsed_instance.py | Python | bsd-2-clause | 11,755 |
"""
This module implements several commonly used utility functions.
The implemented functions can be used to swap variables, write and read data
from files and to convert a number to raw text.
"""
import obfsproxy.common.log as logging
import os
import time
import const
import mycrypto
log = logging.get_obfslogger... | Yawning/obfsproxy | obfsproxy/transports/scramblesuit/util.py | Python | bsd-3-clause | 5,081 |
#########################
## NEW STYLE FORMAT ##
## ie, string.format() ##
#########################
#accessing arguments by position
assert '{0}, {1}, {2}'.format('a', 'b', 'c') == 'a, b, c'
assert '{}, {}, {}'.format('a', 'b', 'c') == 'a, b, c'
assert '{2}, {1}, {0}'.format('a', 'b', 'c') == 'c, b, a'
assert '{2}... | Lh4cKg/brython | www/tests/test_string_format.py | Python | bsd-3-clause | 5,543 |
# Copyright 2016 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 ag... | catapult-project/catapult | third_party/gsutil/third_party/pyu2f/pyu2f/convenience/localauthenticator.py | Python | bsd-3-clause | 2,501 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""Imports that vary depending on available libraries or python versions."""
# If funfactory is available, we want to u... | chirilo/remo | vendor-local/lib/python/django_browserid/compat.py | Python | bsd-3-clause | 760 |