text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
##########################################################################
#
# Copyright 2010 Dr D Studios Pty Limited (ACN 127 184 954) (Dr. D Studios),
# its affiliates and/or its licensors.
#
# Copyright (c) 2010-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary ... | DoubleNegativeVisualEffects/cortex | test/IECoreHoudini/FromHoudiniPointsConverter.py | Python | bsd-3-clause | 39,834 | 0.052945 |
from openerp.osv import osv, fields
class attributes(osv.Model):
_name = "product.attribute"
def _get_float_max(self, cr, uid, ids, field_name, arg, context=None):
result = dict.fromkeys(ids, 0)
if ids:
cr.execute("""
SELECT attribute_id, MAX(value)
... | ovnicraft/openerp-restaurant | website_sale/models/product_characteristics.py | Python | agpl-3.0 | 3,642 | 0.006315 |
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list o... | nathawes/swift | utils/build_swift/tests/build_swift/test_shell.py | Python | apache-2.0 | 26,680 | 0.000037 |
from test_support import *
prove_all(no_fail=True, steps = 400)
| ptroja/spark2014 | testsuite/gnatprove/tests/intro/test.py | Python | gpl-3.0 | 65 | 0.030769 |
# 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 a... | awni/tensorflow | tensorflow/python/kernel_tests/softmax_op_test.py | Python | apache-2.0 | 4,506 | 0.006214 |
from pippi import dsp
from hcj import snds, fx
hat = snds.load('mc303/hat2.wav')
def make(length, i):
#h = dsp.bln(length / 4, dsp.rand(6000, 8000), dsp.rand(9000, 16000))
#h = dsp.amp(h, dsp.rand(0.5, 1))
#h = dsp.env(h, 'phasor')
h = hat
h = dsp.fill(h, length, silence=True)
if dsp.rand() > ... | hecanjog/pattern.studies | orc/hat.py | Python | cc0-1.0 | 364 | 0.013736 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
def python3xBytesToStr():
f = open("BytesToStr.txt", "wb")
zhcnBytes = b'\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74'
zhcnUnicodeStr = zhcnBytes.decode('gbk')
print(zhcnUnicodeStr)
f.write(zhcnUnicodeStr.encode('utf-8'))
f.close()
if __name__ == "__ma... | weahwww/python | bytes_to_str.py | Python | gpl-2.0 | 351 | 0.008547 |
# test_patternchain.py -- Tests for Pattern Chains
"""Tests for Pattern Chain objects"""
from morph import (
pattern,
patternchain
)
from morph.pattern import (
LiteralPattern,
NumericCounterPattern,
)
from morph.patternchain import (
generateFullReplaceChain,
PatternChain,
FilePatternCh... | milki/morph | morph/tests/test_patternchain.py | Python | bsd-2-clause | 3,569 | 0.001121 |
"""
Copyright (C) 2017 kanishka-linux kanishka.linux@gmail.com
This file is part of hlspy.
hlspy 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 ver... | kanishka-linux/kawaii-player | kawaii_player/hls_webkit/netmon_webkit.py | Python | gpl-3.0 | 3,417 | 0.009072 |
import io
from django.core.management import call_command
from django.test.testcases import TestCase
from 臺灣言語服務.models import 訓練過渡格式
class KIPsu試驗(TestCase):
@classmethod
def setUpClass(cls):
with io.StringIO() as tshogoo:
call_command('教育部臺灣閩南語字詞頻調查工作', stderr=tshogoo)
prin... | sih4sing5hong5/hue7jip8 | 試驗/test教育部臺灣閩南語字詞頻調查工作.py | Python | mit | 539 | 0 |
import time
import logging
from cnavbot import settings
logger = logging.getLogger()
class Driver(object):
def __init__(self, *args, **kwargs):
self.driver = kwargs.pop('driver', settings.BOT_DRIVER)
class Motors(Driver):
def __init__(self, speed=None, *args, **kwargs):
super(Motors, se... | konradko/cnav-bot | cnavbot/services/pi2go.py | Python | mit | 4,857 | 0 |
# Copyright (c) 2013 Red Hat, 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 require... | Paul-Ezell/cinder-1 | cinder/volume/drivers/glusterfs.py | Python | apache-2.0 | 17,430 | 0 |
# -*- coding: utf-8 -*-
import os, tempfile
PROJECT_ROOT = os.path.dirname(__file__)
TMP_DIR = tempfile.mkdtemp()
DOWNLOAD_DIR = os.path.join(TMP_DIR, "download")
LOG_DIR = os.path.join(TMP_DIR, "logs")
try:
os.makedirs(DOWNLOAD_DIR)
except OSError:
pass
try:
os.makedirs(LOG_DIR)
except OSError:
p... | rafallo/p2c | settings.py | Python | mit | 760 | 0.003947 |
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.auth import views as auth_views
from . import views
urlpatterns = [
path('albums/', include('albums.urls')),
path('photos/', include('photos.url... | asommer70/photolandia | photolandia/urls.py | Python | mit | 678 | 0.00295 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.core.files.storage
import products.models
class Migration(migrations.Migration):
dependencies = [
('products', '0011_auto_20151120_0137'),
]
operations = [
migrations.A... | codingforentrepreneurs/digital-marketplace | src/products/migrations/0012_auto_20151120_0434.py | Python | mit | 630 | 0.001587 |
import boto
import mock
import moto
import tempfile
import unittest
from click.testing import CliRunner
from rubberjackcli.click import rubberjack
class CLITests(unittest.TestCase):
@moto.mock_s3_deprecated
@mock.patch('boto.beanstalk.layer1.Layer1.create_application_version')
@mock.patch('boto.beansta... | laterpay/rubberjack-cli | tests/test_cli.py | Python | mit | 6,380 | 0.003135 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, json
from frappe import _
from frappe.model.mapper import get_mapped_doc
from frappe.utils import get_url, random_string,... | bhupennewalkar1337/erpnext | erpnext/buying/doctype/request_for_quotation/request_for_quotation.py | Python | gpl-3.0 | 8,686 | 0.023947 |
# -*- coding: utf-8 -*-
# Copyright (C) Duncan Macleod (2013)
#
# This file is part of GWSumm.
#
# GWSumm 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) ... | gwpy/gwsumm | gwsumm/triggers.py | Python | gpl-3.0 | 14,721 | 0 |
#!/usr/bin/env python
# -----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------... | JWDebelius/scikit-bio | skbio/parse/sequences/tests/__init__.py | Python | bsd-3-clause | 378 | 0 |
#! /usr/bin/env python
import sys
import math
import collections
import dendropy
def count_set_size_difference(v1, v2):
c1 = collections.Counter(v1)
c2 = collections.Counter(v2)
counted_matched = c1 & c2
matched = sorted(list(counted_matched.elements()))
counted_diffs = (c1 - c2) + (c2 - c1)
u... | jeetsukumaran/pstrudel | test/scripts/calc-tree-unlabeled-symmetric-difference.py | Python | gpl-2.0 | 1,420 | 0.003521 |
# PyUI
# Copyright (C) 2001-2002 Sean C. Riley
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but... | burito/PyUI | pyui/themeBase.py | Python | lgpl-2.1 | 7,045 | 0.013343 |
import session
import namespace
import platform
from .exceptions import ObjectNotFound, APIError, ConnectionError, IsilonLibraryError
class API(object):
'''Implements higher level functionality to interface with an Isilon cluster'''
def __init__(self, *args, **kwargs):
self.session = sessio... | sile16/python-isilon-api | isilon/__init__.py | Python | mit | 500 | 0.018 |
# Copyright 2013 Regionbibliotek Halland
#
# This file is part of Digitala sagor.
#
# Digitala sagor 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
# ... | regionbibliotekhalland/digitalasagor | progressdlg.py | Python | gpl-3.0 | 4,102 | 0.015115 |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
# import frappe
import unittest
class TestLogSettings(unittest.TestCase):
pass
| mhbu50/frappe | frappe/core/doctype/log_settings/test_log_settings.py | Python | mit | 182 | 0.010989 |
#!/usr/bin/env python
#encoding: utf-8
import numpy as np
from pylab import *
dt=0.01 # msec
tau=40.0 # msec
tmax=1000 # msec
V_spk=-20
V_thres=-50.0
V_reset=-70.0
E_leak=V_reset
R_m=10.0 # MΩ
tt=np.arange(0, tmax, dt) #0:dt:tmax
Nt=len(tt) #length(tt)
V=np.zeros((Nt,))
V2=np.zeros((Nt,))
S=np.zeros((Nt,))
S2=np.zero... | jdmonaco/vmo-feedback-model | src/spike_reset.py | Python | mit | 3,535 | 0.040181 |
# 142. Linked List Cycle II
# Given a linked list, return the node where the cycle begins.
# If there is no cycle, return null.
#
# Note: Do not modify the linked list.
#
# Follow up:
# Can you solve it without using extra space?
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):... | gengwg/leetcode | 142_linked_list_cycle_ii.py | Python | apache-2.0 | 976 | 0 |
#!/usr/bin/python
# Copyright 2016 Google Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | anryko/ansible | lib/ansible/modules/cloud/google/gcpubsub_info.py | Python | gpl-3.0 | 4,597 | 0.00261 |
"""
This module defines the BasePackageManager Class which provides an
implementation of the packaging system API providing methods to fetch,
upload and remove packages. Site specific extensions to any of these methods
should inherit this class.
"""
import fcntl
import logging
import os
import re
import shutil
from au... | lmr/autotest | client/shared/base_packages.py | Python | gpl-2.0 | 45,844 | 0.000284 |
from __future__ import division, absolute_import, print_function
import math
import textwrap
from numpy import array
from numpy.testing import run_module_suite, assert_, assert_equal, dec
import util
class TestF77Callback(util.F2PyTest):
code = """
subroutine t(fun,a)
integer a
cf2py intent(out) ... | LumPenPacK/NetworkExtractionFromImages | win_build/nefi2_win_amd64_msvc_2015/site-packages/numpy/f2py/tests/test_callback.py | Python | bsd-2-clause | 3,040 | 0 |
from gdsfactory.port import csv2port
def test_csv2port(data_regression):
import gdsfactory as gf
name = "straight"
csvpath = gf.CONFIG["gdsdir"] / f"{name}.ports"
ports = csv2port(csvpath)
data_regression.check(ports)
| gdsfactory/gdsfactory | gdsfactory/tests/test_port_from_csv.py | Python | mit | 241 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2007-2020 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | dnjohnstone/hyperspy | hyperspy/tests/learn/test_mlpca.py | Python | gpl-3.0 | 2,332 | 0.000429 |
from .lircpy import LircPy
from .exceptions import InvalidResponseError, LircError
__all__ = ['LircPy', 'InvalidResponseError', 'LircError']
| NoMoKeTo/lircpy | lircpy/__init__.py | Python | apache-2.0 | 142 | 0 |
from itertools import chain
from django.db import models
from django.contrib.auth.models import User
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
from django.db.models import Sum
from django.template import Template, Context
class AbstractOrder(models.Mod... | aykut/django-oscar | oscar/apps/order/abstract_models.py | Python | bsd-3-clause | 19,620 | 0.007594 |
# 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/.
from __future__ import absolute_import, print_function, unicode_literals
import copy
import logging
from . import tran... | Yukarumya/Yukarum-Redfoxes | taskcluster/taskgraph/task/test.py | Python | mpl-2.0 | 5,066 | 0.000987 |
#!/usr/bin/env python
import os
from os import path
import logging
import shutil
from sqlalchemy import create_engine
from . import config
from .config import TestBase
import taxtastic
from taxtastic.taxonomy import Taxonomy, TaxonIntegrityError
import taxtastic.ncbi
import taxtastic.utils
log = logging
datadir =... | fhcrc/taxtastic | tests/test_taxonomy.py | Python | gpl-3.0 | 10,512 | 0 |
#!/usr/bin/python
from pyparsing import *
from charm.toolbox.node import *
import string
objStack = []
def createAttribute(s, loc, toks):
if toks[0] == '!':
newtoks = ""
for i in toks:
newtoks += i
return BinNode(newtoks)
return BinNode(toks[0]) # create
# convert 'attr <... | lferr/charm | charm/toolbox/policytree.py | Python | lgpl-3.0 | 6,070 | 0.014333 |
# tcpserv
#
# Copyright (c) 2015 Christian Sengstock, All rights reserved.
#
# 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 3.0 of the License, or (at your option) any l... | csengstock/tcpserv | tcpserv.py | Python | lgpl-3.0 | 5,176 | 0.000773 |
"""Main entry for mass apk when invoked as python module.
>>> python -m massapk
"""
from mass_apk import cli
if __name__ == "__main__":
cli.main()
| binary-signal/mass-apk-installer | mass_apk/__main__.py | Python | bsd-3-clause | 154 | 0 |
"""Core implementation of import.
This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing ver... | kikocorreoso/brython | www/src/Lib/importlib/_bootstrap.py | Python | bsd-3-clause | 39,424 | 0.00038 |
# 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 ... | Azure/azure-sdk-for-python | sdk/cognitiveservices/azure-cognitiveservices-search-customsearch/azure/cognitiveservices/search/customsearch/models/_models_py3.py | Python | mit | 29,187 | 0.000171 |
class Drawable(object):
def draw(self, display_screen, dT):
pass | bpeck/tumblr-display | src/Drawable.py | Python | apache-2.0 | 76 | 0.013158 |
from __future__ import unicode_literals
import os
import shutil
import tempfile
import unittest
from elopic.data.elopicdb import EloPicDB, EloPicDBError
from elopic.logic.elo import INITIAL_ELO_SCORE
from tests.utils import copy_all_files, delete_files_matching_pattern
class TestDatabase(unittest.TestCase):
"""... | mmanhertz/elopic | tests/test_db.py | Python | bsd-2-clause | 3,055 | 0.001309 |
import os
import pwd
import grp
def drop_privileges(uid_name='nobody', gid_name='nogroup'):
if os.getuid() != 0:
# We're not root so, like, whatever dude
return
# Get the uid/gid from the name
sudo_user = os.getenv("SUDO_USER")
if sudo_user:
pwnam = pwd.getpwnam(sudo_user)
... | the-invoice/nab | nwaddrbook/icmp/util.py | Python | gpl-3.0 | 701 | 0 |
#!/bin/python
import os
import roomai.common
import copy
#
#0, 1, 2, 3, ..., 7, 8, 9, 10, 11, 12, 13, 14
#^ ^ ^ ^ ^
#| | | | |
#3, 10, J, Q, K, A, 2, r, R
#
class DouDiZhuActionElement:
str_to_rank = {'3':0, '4':1, '5':2... | DMRookie/RoomAI | roomai/doudizhu/DouDiZhuPokerAction.py | Python | mit | 7,614 | 0.010901 |
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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 ... | denismakogon/tosca-vcloud-plugin | vcloud_plugin_common/__init__.py | Python | apache-2.0 | 17,925 | 0.000167 |
import numpy as np
import fnmatch, os
import h5py
class Hdf5Loader():
def loadDirectory(self, dirname):
"""
Loads all hdf5 files in the directory dirname
@param dirname: The directory which contains the files to load
@returns: list of h5py File objects
""... | nglrt/virtual_energy_sensor | virtual_energy_sensor/loadtrain.py | Python | mit | 3,264 | 0.016544 |
from jinja2 import Environment, FileSystemLoader
data = {
"extensionInfoList": [
{"ext": "apk", "mimeTypes": ["application/vnd.android.package-archive"]}
, {"ext": "zip", "mimeTypes": []}
, {"ext": "tgz", "mimeTypes": []}
, {"ext": "gz", "mimeTypes": []}
, {"ext": "pdf", "mi... | 75py/Download-Confirm | work/generate_extentions_res.py | Python | apache-2.0 | 1,723 | 0.004643 |
""" Parse travis.yml file, partly
"""
import sys
if sys.version_info[0] > 2:
basestring = str
class TravisError(Exception):
pass
def get_yaml_entry(yaml_dict, name):
""" Get entry `name` from dict `yaml_dict`
Parameters
----------
yaml_dict : dict
dict or subdict from parsing .trav... | weberwang/WeRoBot | travis/terryfy/travisparse.py | Python | mit | 1,763 | 0.001134 |
pet = ['dog', 'cat', 'parrot', 'squirrel', 'goldfish']
for animal in pet:
print(animal, len(animal))
| zamonia500/PythonTeacherMythenmetz | 300문제/96.py | Python | gpl-3.0 | 106 | 0 |
"""Plugins that are not OS-specific"""
# pylint: disable=unused-import
from rekall.plugins.common import address_resolver
from rekall.plugins.common import api
from rekall.plugins.common import bovine
from rekall.plugins.common import efilter_plugins
from rekall.plugins.common import inspection
from rekall.plugins.com... | dsweet04/rekall | rekall-core/rekall/plugins/common/__init__.py | Python | gpl-2.0 | 471 | 0 |
#!/usr/bin/python
#
# Copyright 2015 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 or a... | mbrukman/cloud-launcher | apps/cloudera/director/py/rhel6.py | Python | apache-2.0 | 1,057 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2013 Alexandre Bulté <alexandre[at]bulte[dot]net>
#
# 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/.
from fl... | abulte/Flask-Bootstrap-Fanstatic | application/__init__.py | Python | mpl-2.0 | 730 | 0.005487 |
import os
import sqlite3
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from statsmodels.distributions.empirical_distribution import ECDF
from matplotlib.ticker import FuncFormatter
def thousands(x, pos):
if x>=1e9:
return '%.1fB' % (x*1e-9)
elif x>=1e6:
return '%.1fM' %... | natasasdj/OpenWPM | analysis/12_images_third-domains2.py | Python | gpl-3.0 | 19,012 | 0.016148 |
# coding: utf-8
"""
This module defines a containers that hold transcripts excluded from further consideration.
It is invoked when all transcripts in a locus have a score of 0 and the "purge"
option has been enabled.
"""
from .abstractlocus import Abstractlocus
from ..transcripts import Transcript
class Excluded(Ab... | lucventurini/mikado | Mikado/loci/excluded.py | Python | lgpl-3.0 | 3,468 | 0.003172 |
from unittest import TestCase
from datetime import timedelta
from safepickle.types.timedelta import TimedeltaType
from safepickle.encoding import encode, decode
class TestTimedelta(TestCase):
def test_timedelta(self):
""" Asserts timedelta type is handled as expected
"""
obj = timedelta(... | nioinnovation/safepickle | safepickle/types/tests/test_timedelta.py | Python | apache-2.0 | 509 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Test case for Edge3D.
"""
import unittest
from catplot.grid_components.nodes import Node2D, Node3D
from catplot.grid_components.edges import Edge2D, Edge3D
class Edge3DTest(unittest.TestCase):
def setUp(self):
self.maxDiff = True
def test_construc... | PytLab/catplot | tests/edge_3d_test.py | Python | mit | 2,499 | 0.001601 |
from __future__ import absolute_import
import abc
class MinHashIndexBackendTestMixin(object):
__meta__ = abc.ABCMeta
@abc.abstractproperty
def index(self):
pass
def test_basic(self):
self.index.record("example", "1", [("index", "hello world")])
self.index.record("example", "... | mvaled/sentry | tests/sentry/similarity/backends/base.py | Python | bsd-3-clause | 8,478 | 0.003185 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Handles backports of the standard library's `fractions.py`.
The fractions module in 2.6 does not handle being instantiated using a
float and then calculating an approximate fraction based on that.
This functionality is required by the FITS unit format... | piotroxp/scibibscan | scib/lib/python3.5/site-packages/astropy/utils/compat/fractions.py | Python | mit | 568 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 The Spyder development team
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
import optparse
def get_options():
"""
Convert options into commands
return commands, message
"""
parser = optparse.OptionParser(usage="s... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/spyderlib/cli_options.py | Python | gpl-3.0 | 2,217 | 0.000903 |
"""
Convenience methods for working with datetime objects
"""
from datetime import timedelta
from django.utils.translation import ugettext as _
def get_default_time_display(dt, show_timezone=True):
"""
Converts a datetime to a string representation. This is the default
representation used in Studio and LM... | praveen-pal/edx-platform | common/lib/xmodule/xmodule/util/date_utils.py | Python | agpl-3.0 | 1,275 | 0.000784 |
# coding=utf-8
# Authors:
# Pedro Jose Pereira Vieito <pvieito@gmail.com> (Twitter: @pvieito)
#
# URL: https://github.com/mr-orange/Sick-Beard
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# ... | srluge/SickRage | sickbeard/clients/download_station_client.py | Python | gpl-3.0 | 2,731 | 0.001465 |
import threading
import pprint
import json
from bottle import route, run, Bottle
class Rest_Server(Bottle):
'''The REST front end'''
def __init__(self, core):
super(Rest_Server, self).__init__()
self._core = core
self.route('/plms', callback=self.list_plms)
def st... | krkeegan/lib-py-insteon | insteon/rest_server.py | Python | gpl-2.0 | 1,792 | 0.001116 |
from data_types.user import User
class Commit:
"""
Commit object
https://developer.github.com/v3/repos/commits/
Attributes:
url: Commit URL in repo
author: Commit author
committer: Commit sender
message: Commit messagee
tree: Example {
"url": "https:... | codex-bot/github | github/data_types/commit.py | Python | mit | 1,228 | 0.001629 |
from __future__ import unicode_literals
import copy
from ._compat import decode
from ._utils import merge_dicts
from .exceptions import KeyAlreadyPresent
from .exceptions import NonExistentKey
from .exceptions import ParseError
from .exceptions import TOMLKitError
from .items import AoT
from .items import Comment
fro... | kennethreitz/pipenv | pipenv/vendor/tomlkit/container.py | Python | mit | 24,835 | 0.000322 |
from gevent import monkey, sleep, spawn
monkey.patch_all() # NOQA
import sys
import time
import yaml
import logging
import ldap
from oncall import metrics
from ldap.controls import SimplePagedResultsControl
from datetime import datetime
from pytz import timezone
from sqlalchemy import create_engine
from sqlalchemy.o... | diegocepedaw/oncall | src/oncall/user_sync/ldap_sync.py | Python | bsd-2-clause | 17,821 | 0.002188 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import cloudinary.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
... | andela/codango | codango/resources/migrations/0001_initial.py | Python | mit | 1,494 | 0.002677 |
from __future__ import absolute_import, division, print_function
import hashlib
import linecache
import sys
import warnings
from operator import itemgetter
from . import _config
from ._compat import PY2, isclass, iteritems, metadata_proxy, set_closure_cell
from .exceptions import (
DefaultAlreadySetError, Frozen... | nparley/mylatitude | lib/attr/_make.py | Python | mit | 49,291 | 0.00002 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2003-2018 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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... | unioslo/cerebrum | testsuite/docker/test-config/cereconf_local.py | Python | gpl-2.0 | 1,350 | 0.000741 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os.path
import string
import webbrowser
import shutil
import json
import base64
from PyQt5 import QtWidgets
from PyQt5 import QtGui
from PyQt5.QtCore import QFile
from PyQt5.QtCore import QUrl
from PyQt5.QtWebKit import QWebSettings
from ... | marcoconstancio/yanta | plugins/viewers/html_editor/html_editor.py | Python | gpl-2.0 | 16,041 | 0.004239 |
# Copyright (C) 2004 Anthony Baxter
# This file is necessary to make this directory a package
__version__ = '0.3alpha0'
| braams/shtoom | shtoom/__init__.py | Python | lgpl-2.1 | 121 | 0 |
class NameTable:
def __init__(self, start, size):
self.start = start
self.size = size
| Hexadorsimal/pynes | nes/processors/ppu/name_table.py | Python | mit | 106 | 0 |
"""
Django settings for the admin project.
"""
import os
from urlparse import urlparse
from website import settings as osf_settings
from django.contrib import messages
# import local # Build own local.py (used with postgres)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# Q... | TomHeatwole/osf.io | admin/base/settings/defaults.py | Python | apache-2.0 | 5,822 | 0.001546 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# pelisalacarta 4
# Copyright 2015 tvalacarta@gmail.com
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#
# Distributed under the terms of GNU General Public License v3 (GPLv3)
# http://www.gnu.org/licenses/gpl-3.0.html
# --... | Hernanarce/pelisalacarta | python/version-mediaserver/platformcode/launcher.py | Python | gpl-3.0 | 24,841 | 0.017736 |
"""empty message
Revision ID: 424f18f4c1df
Revises: 106e3631fe9
Create Date: 2015-06-23 11:31:08.548661
"""
# revision identifiers, used by Alembic.
revision = '424f18f4c1df'
down_revision = '106e3631fe9'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from sqlalchemy.diale... | uwcirg/true_nth_usa_portal | portal/migrations/versions/424f18f4c1df_.py | Python | bsd-3-clause | 1,316 | 0.006079 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2010 Luke Tucker
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# Author: Luke Tucker <voxluci@gmail.com>
#
from giblets.core import * | ltucker/giblets | giblets/__init__.py | Python | bsd-3-clause | 287 | 0.003484 |
# -*- coding: utf-8 -*-
from __future__ import print_function
# Form implementation generated from reading ui file 'InputChannelTemplate.ui'
#
# Created: Sun Feb 22 13:29:16 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
... | meganbkratz/acq4 | acq4/devices/DAQGeneric/InputChannelTemplate.py | Python | mit | 3,321 | 0.001807 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2016 Vladimir Ermakov <vooon341@gmail.com>
##
## 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 t... | Entropy512/libsigrokdecode | decoders/rgb_led_ws281x/pd.py | Python | gpl-3.0 | 4,320 | 0.003472 |
#!/usr/bin/env python
import PyQt4.QtCore # <- this line causes the error
from multiprocessing import Process
class PTask(Process):
def __init__(self, func):
Process.__init__(self)
self._func = func
def run(self):
self._func()
def f():
try:
import numpy as np
im... | kcii/numpy-pyqt-multiproc-problem | fork.py | Python | mit | 868 | 0.009217 |
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | tellesnobrega/storm_plugin | sahara/service/trusts.py | Python | apache-2.0 | 1,897 | 0 |
"""Iceland specific form helpers."""
from __future__ import unicode_literals
from django.forms import ValidationError
from django.forms.fields import RegexField
from django.forms.widgets import Select
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from localflavo... | jieter/django-localflavor | localflavor/is_/forms.py | Python | bsd-3-clause | 2,973 | 0.002018 |
import sys
if sys.version_info.major == 2:
from .six_py2 import (
urlparse,
urlunparse,
Generator,
)
else:
from .six_py3 import ( # noqa: #401
urlparse,
urlunparse,
Generator,
)
| pipermerriam/web3.py | web3/utils/six/__init__.py | Python | mit | 245 | 0 |
from api.callers.api_caller import ApiCaller
from exceptions import ResponseTextContentTypeError
from colors import Color
import os
from cli.arguments_builders.default_cli_arguments import DefaultCliArguments
import datetime
from cli.cli_file_writer import CliFileWriter
from cli.formatter.cli_json_formatter import CliJ... | PayloadSecurity/VxAPI | cli/wrappers/cli_caller.py | Python | gpl-3.0 | 6,741 | 0.003265 |
from django import template
from security import logic
register = template.Library()
# General role-based checks
@register.simple_tag(takes_context=True)
def is_author(context):
request = context['request']
return request.user.is_author(request)
@register.simple_tag(takes_context=True)
def is_editor(conte... | BirkbeckCTP/janeway | src/security/templatetags/securitytags.py | Python | agpl-3.0 | 2,227 | 0.001347 |
#!/usr/bin/python
import unittest
import apt_pkg
import apt.progress.base
class TestCache(unittest.TestCase):
"""Test invocation of apt_pkg.Cache()"""
def setUp(self):
apt_pkg.init_config()
apt_pkg.init_system()
def test_wrong_invocation(self):
"""cache_invocation: Test wrong in... | suokko/python-apt | tests/test_cache_invocation.py | Python | gpl-2.0 | 863 | 0.001159 |
"""
This sample shows how to update the
large thumbnail of an item
Python 2.x
ArcREST 3.0.1
"""
import arcrest
from arcresthelper import securityhandlerhelper
from arcresthelper import common
def trace():
"""
trace finds the line, the filename
and error message and returns it
to ... | DShokes/ArcREST | samples/update_largethumbnail.py | Python | apache-2.0 | 2,476 | 0.008078 |
"""
handlers for transactional messaging service
"""
import json
# tornado imports
from tornado.queues import Queue
from tornado import websocket, gen, web
#local imports
from settings import DEBUG
#===============================================================================
# WEBSOCKETS SERVER
#================... | pythonpopayan/bermoto | backend/handlers/transactional_messaging.py | Python | mit | 3,778 | 0.002649 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"Visual Property Editor (using wx PropertyGrid) of gui2py's components"
__author__ = "Mariano Reingart (reingart@gmail.com)"
__copyright__ = "Copyright (C) 2013- Mariano Reingart"
__license__ = "LGPL 3.0"
# some parts where inspired or borrowed from wxFormBuilders & wxPython... | reingart/gui2py | gui/tools/propeditor.py | Python | lgpl-3.0 | 12,658 | 0.006241 |
'''
Created on Sep 15, 2010
@author: duncantait
'''
from SimPy.Simulation import *
import numpy as np
import random
import math
class G():
#Settings for HF Stations
num_channels = 18
num_stations = 10
class Network():
stations = []
class Medium():
def __init__(self):
self.channel... | IncidentNormal/TestApps | ALE/HF_Sim_Book.py | Python | gpl-2.0 | 17,239 | 0.019375 |
#!/usr/bin/python3
# Small script to validate a given IP address
import socket
import sys
def validate_ip(ip):
try:
socket.inet_pton(socket.AF_INET, ip)
return (True,"IPv4")
except socket.error:
try:
socket.inet_pton(socket.AF_INET6, ip)
return(True,"IPv6")
... | Tijndagamer/bin | validate_ip.py | Python | mit | 609 | 0.00821 |
# Copyright (c) 2015-2016 Western Digital Corporation or its affiliates.
#
# 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 versio... | lsgunth/nvme-cli | tests/nvme_writeuncor_test.py | Python | gpl-2.0 | 2,752 | 0 |
"""This module contains a tile cache handler."""
__author__ = 'Aaron Steele'
# MOL imports
import cache
# Standard Python imports
import hashlib
import logging
import os
import urllib
import webapp2
# Google App Engine imports
from google.appengine.api import memcache
from google.appengine.api import urlfetch
from ... | MapofLife/MOL | app/tile_handler.py | Python | bsd-3-clause | 3,335 | 0.009595 |
from django.test import TestCase
from django.core import signing
from django.core.exceptions import SuspiciousOperation
from django.http import HttpResponse
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.formtools.wizard.storage.cookie import CookieStorage
from django.contrib.formtool... | edisonlz/fruit | web_project/base/site-packages/django/contrib/formtools/tests/wizard/test_cookiestorage.py | Python | apache-2.0 | 1,813 | 0.003309 |
default_app_config = 'ain7.annuaire.management.FillDb'
| ain7/www.ain7.org | ain7/annuaire/__init__.py | Python | lgpl-2.1 | 55 | 0 |
# pylint: disable=too-many-arguments, too-many-locals, invalid-name, fixme, too-many-lines
"""Scikit-Learn Wrapper interface for XGBoost."""
import copy
import warnings
import json
import os
from typing import Union, Optional, List, Dict, Callable, Tuple, Any, TypeVar, Type, cast
from typing import Sequence
import nump... | dmlc/xgboost | python-package/xgboost/sklearn.py | Python | apache-2.0 | 71,896 | 0.002031 |
import os
import cv2
import time
drone_output_path_string = "./images/intruder-detection/drone-output/drone-output.png"
detected_image_path_string = "./images/intruder-detection/detected/intruder-detected.png"
full_body_haar_cascade_path_string = "./node_modules/opencv/data/haarcascade_fullbody.xml"
def clear_direct... | CianDuffy/nodecopter-security | python/pedestrian_detect.py | Python | mit | 1,228 | 0.004886 |
"""
This is a direct translation of nvvm.h
"""
import logging
import re
import sys
from ctypes import (c_void_p, c_int, POINTER, c_char_p, c_size_t, byref,
c_char)
import threading
from llvmlite import ir
from .error import NvvmError, NvvmSupportError
from .libs import get_libdevice, open_libdevi... | sklam/numba | numba/cuda/cudadrv/nvvm.py | Python | bsd-2-clause | 24,855 | 0.000523 |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'H:i:s'
DATE... | edisonlz/fruit | web_project/base/site-packages/django/conf/locale/mk/formats.py | Python | apache-2.0 | 1,758 | 0.001138 |
# 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 agre... | parthea/datalab | tools/cli/commands/create.py | Python | apache-2.0 | 37,422 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import gdb
import pwndbg.abi
import pwndbg.color.chain as C
import pwndbg.color.memory as M
import pwndbg.color.theme as theme
import pwndbg.enhance
import pwndbg.memory
import pwndbg.symbol
import pwndbg.typeinfo
import pwndbg.vmmap
LIMIT = pwndbg.config.Parameter('dere... | anthraxx/pwndbg | pwndbg/chain.py | Python | mit | 4,555 | 0.003305 |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import logging
from indra.java_vm import autoclass, JavaException
logger = logging.getLogger('reach_reader')
class ReachReader(object):
"""The ReachReader wraps a singleton instance of the REACH reader.
Th... | jmuhlich/indra | indra/reach/reach_reader.py | Python | bsd-2-clause | 1,451 | 0.000689 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.