code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
import logging
from angrop.errors import RopException
from ...vulnerability import Vulnerability
from .. import Exploit, CannotExploit
from ..technique import Technique
l = logging.getLogger("rex.exploit.techniques.rop_to_accept_system")
class RopToAcceptSystem(Technique):
name = "rop_to_accept_system"
ap... | shellphish/rex | rex/exploit/techniques/rop_to_accept_system.py | Python | bsd-2-clause | 3,231 |
import pygame
class StartBlock(pygame.sprite.Sprite):
def __init__(self, pos = [0,0]):
pygame.sprite.Sprite.__init__(self, self.containers)
self.image = pygame.image.load("Art/EnterBlock.png")
self.rect = self.image.get_rect()
self.place(pos)
self.living = True
def place(self, pos):
self.rect.topleft ... | KRHS-GameProgramming-2014/Arkansas-Smith | StartBlock.py | Python | bsd-2-clause | 390 |
# scan a set of file
from __future__ import print_function
import os
import fnmatch
import tempfile
from ScanFile import ScanFile
class FileScanner:
def __init__(self, handler=None, ignore_filters=None, scanners=None,
error_handler=None, ram_bytes=10 * 1024 * 1024,
skip_handler=None... | alpine9000/amiga_examples | tools/external/amitools/amitools/scan/FileScanner.py | Python | bsd-2-clause | 3,414 |
import os
import numpy as np
import sys
label_file = open('/home/hypan/data/celebA/test.txt', 'r')
lines = label_file.readlines()
label_file.close()
acc = np.zeros(40)
cou = 0
for line in lines:
info = line.strip('\r\n').split()
name = info[0].split('.')[0]
gt_labels = info[1: ]
feat_path = '/home/hy... | last-one/tools | caffe/result/celeba_multilabel_acc.py | Python | bsd-2-clause | 857 |
# Copyright 2014 Dietrich Epp.
# This file is part of SGLib. SGLib is licensed under the terms of the
# 2-clause BSD license. For more information, see LICENSE.txt.
BASE_CONFIG = {
'Config.PlatformToolset': 'v120',
'Config.CharacterSet': 'Unicode',
'ClCompile.WarningLevel': 'Level3',
'ClCompile.SDLCh... | depp/sglib | script/d3build/msvc/base.py | Python | bsd-2-clause | 1,042 |
# Copyright (c) 2011 Duncan Fordyce, Jimmy Cao
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | Agent-Isai/lykos | oyoyo/client.py | Python | bsd-2-clause | 11,881 |
# coding=utf-8
from __future__ import unicode_literals
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.db.models.signals import post_save, post_delete, pre_save
from pybb.models import Post, Category, Topic, Forum, create_or_check_slug
from pybb.s... | hovel/pybbm | pybb/signals.py | Python | bsd-2-clause | 3,815 |
#! /usr/bin/env python
import heapq
class PriorityQueue:
def __init__(self):
self._queue=[]
self._index=0
def push(self,item,priority):
heapq.heappush(self._queue,(-priority,self._index,item))
self._index += 1
def pop(self):
return heapq.heappop(self._queue)[-1]
... | xiongerqi/enki | sample/cookbook/chapter1/5priority_quene.py | Python | bsd-2-clause | 717 |
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import numpy as np
def subarray_multislice(array_ndim, fixed_axes, indices):
'''
Return tuple of slices that if indexed into an array with given dimensions
will return subarray with the axes in axes fixed at given indices
... | quanta413/Population-Evolution-Project-Source-Code | populationevolution/stenciledsum.py | Python | bsd-2-clause | 6,254 |
'''
Copyright (c) 2015, Harsh Bhatia (bhatia4@llnl.gov)
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 copyright notice, this
list of conditions a... | bhatiaharsh/naturalHHD | pynhhd-v1.1/pynhhd/structured.py | Python | bsd-2-clause | 6,676 |
import bisect
import struct
import cffi
__all__ = ('Clemory',)
# TODO: Further optimization is possible now that the list of backers is sorted
class Clemory(object):
"""
An object representing a memory space. Uses "backers" and "updates" to separate the concepts of loaded and written
memory and make look... | Ruide/angr-dev | cle/cle/memory.py | Python | bsd-2-clause | 10,840 |
# -*- coding: utf-8 -*-
import numpy as np
np.set_printoptions(precision=3, linewidth=256)
from dyconnmap.fc import mi
if __name__ == "__main__":
data = np.load(
"/home/makism/Github/dyconnmap/examples/data/eeg_32chans_10secs.npy")
data = data[0:5, :]
fs = 128
fb_lo = [1.0, 4.0]
fb_hi =... | makism/dyfunconn | examples/fc_mi.py | Python | bsd-3-clause | 390 |
from __future__ import absolute_import, print_function
import logging
from sentry.auth import access
from sentry.tasks.base import instrumented_task
from sentry.utils.email import send_messages
logger = logging.getLogger(__name__)
def _get_user_from_email(group, email):
from sentry.models import User
# TO... | beeftornado/sentry | src/sentry/tasks/email.py | Python | bsd-3-clause | 2,317 |
from ..dataset import DataSet
from .basenode import BaseNode
import numpy as np
from functools import reduce
def _ch_idx(channels, names):
'''Construct a set of channel indices, given a list of mixed integer indices
and string names.'''
if channels is None:
return set([])
else:
return s... | wmvanvliet/psychic | psychic/nodes/eeg_montage.py | Python | bsd-3-clause | 10,556 |
from django.db import models
class Tag(models.Model):
tag = models.CharField(max_length=10, primary_key=True)
class Product(models.Model):
name = models.CharField(max_length=18, primary_key=True)
tags = models.ManyToManyField(Tag)
| brosner/django-sqlalchemy | tests/apps/inventory/models.py | Python | bsd-3-clause | 250 |
# Generated by Django 2.1 on 2018-09-04 12:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [('django_x509', '0005_organizational_unit_name')]
operations = [
migrations.AddField(
model_name='ca',
name='passphrase',
... | openwisp/django-x509 | django_x509/migrations/0006_passphrase_field.py | Python | bsd-3-clause | 792 |
""" test positional based indexing with iloc """
from datetime import datetime
import re
from warnings import (
catch_warnings,
simplefilter,
)
import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas import (
NA,
Categorical,
CategoricalDtype,
DataFrame,
In... | jorisvandenbossche/pandas | pandas/tests/indexing/test_iloc.py | Python | bsd-3-clause | 47,159 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 - 2022 -- Lars Heuer
# All rights reserved.
#
# License: BSD License
#
"""\
SVG related tests.
"""
from __future__ import absolute_import, unicode_literals
import os
import re
import io
import tempfile
import xml.etree.ElementTree as etree
import pytest
import segno
_SVG_... | heuer/segno | tests/test_svg.py | Python | bsd-3-clause | 16,883 |
#!/usr/bin/python
# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Subcommand codes that specify the crypto module."""
# Keep these codes in sync with include/extension.h.
AES = 0
HASH = 1
RSA = 2
| akappy7/ChromeOS_EC_LED_Diagnostics | test/tpm_test/subcmd.py | Python | bsd-3-clause | 318 |
from django.contrib import admin
from custom.m4change.models import McctStatus
class McctStatusAdmin(admin.ModelAdmin):
model = McctStatus
list_display = ('form_id', 'status', 'domain', 'reason', 'received_on', 'registration_date', 'immunized', 'is_booking', 'modified_on', 'user')
search_fields = ('form_i... | SEL-Columbia/commcare-hq | custom/m4change/admin.py | Python | bsd-3-clause | 374 |
from __future__ import division
import numpy as np
from menpo.transform import Scale
from menpo.visualize.base import GraphPlotter, MultipleImageViewer
from menpo.fit.fittingresult import FittingResult
class MultilevelFittingResult(FittingResult):
r"""
Object that holds the state of a MultipleFitter object (... | jabooth/menpo-archive | menpo/fitmultilevel/fittingresult.py | Python | bsd-3-clause | 13,883 |
import cmd
import json
import termcolor
from struct_manager import createEmptyCommandGroup, createEmptyStruct, createEmptyCommand
from populator import populateDict
class EditorShell ( cmd.Cmd ) :
def __init__ ( self, file ) :
cmd.Cmd.__init__(self)
self.file = file
# self.struct = json.load ( self.file )
... | operatorequals/gatheros | gatheros/editor/cmd_interface.py | Python | bsd-3-clause | 3,370 |
import random
import datetime
import time
import wemo
from wemo.environment import Environment
# http://pydoc.net/Python/wemo/0.7.3/wemo.examples.watch/
if __name__ == "__main__":
print("")
print("WeMo Randomizer")
print("---------------")
env = Environment()
# TODO: run from 10am to 10pm
try:... | tomjmul/wemo | wemo/examples/Randomize.py | Python | bsd-3-clause | 1,078 |
#!/usr/bin/env python
import os, resource, sys
import argparse
import numpy as np
import networkx as nx
import neurokernel.core_gpu as core
from neurokernel.pattern import Pattern
from neurokernel.tools.logging import setup_logger
from neurokernel.tools.timing import Timer
from neurokernel.LPU.LPU import LPU
import... | neurokernel/retina-lamina | examples/retlam_demo/retlam_demo.py | Python | bsd-3-clause | 11,654 |
import sys
import json
import logging
import asyncio
from collections import namedtuple
from pulsar import AsyncObject, as_coroutine, new_event_loop, ensure_future
from pulsar.utils.string import gen_unique_id
from pulsar.utils.tools import checkarity
from pulsar.apps.wsgi import Json
from pulsar.apps.http import Http... | dejlek/pulsar | pulsar/apps/rpc/jsonrpc.py | Python | bsd-3-clause | 11,409 |
#!/usr/bin/env python
import math
import time
import naoqi
import motion
from naoqi import ALProxy
import roslib
roslib.load_manifest('nao_driver')
import rospy
use_robot_state_publisher = False
if use_robot_state_publisher:
from robot_state.msg import RobotState
from scan_pose_bending import scanPoseBending
from... | miguelsdc/nao_robot | nao_driver/scripts/headscanTop.py | Python | bsd-3-clause | 5,281 |
#!/usr/bin/env python
# encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
import requests
# Try to import urljoin from the Python 3 reorganized stdlib first:
try:
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
i... | django-searchstack/skisolr | tests/get-solr-download-url.py | Python | bsd-3-clause | 1,192 |
#------------------------------------------------------------------------------
#
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions d... | enthought/traitsgui | enthought/traits/ui/image/image.py | Python | bsd-3-clause | 49,614 |
import numpy as np
np.sin(1)
np.sin([1, 2, 3])
np.sin(1, out=np.empty(1))
np.matmul(np.ones((2, 2, 2)), np.ones((2, 2, 2)), axes=[(0, 1), (0, 1), (0, 1)])
np.sin(1, signature="D->D")
np.sin(1, extobj=[16, 1, lambda: None])
# NOTE: `np.generic` subclasses are not guaranteed to support addition;
# re-enable this we can ... | pbrod/numpy | numpy/typing/tests/data/pass/ufuncs.py | Python | bsd-3-clause | 447 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contacts', '0008_auto_20150205_1853'),
]
operations = [
migrations.AlterModelOptions(
name='organizationmember',... | delphcf/sis | sis/contacts/migrations/0009_auto_20150205_1942.py | Python | bsd-3-clause | 1,435 |
import sys
from fermipy import utils
utils.init_matplotlib_backend()
from fermipy.gtanalysis import GTAnalysis
from fermipy.utils import *
import yaml
import pprint
import numpy
import argparse
from fermipy.gtanalysis import GTAnalysis
def main():
usage = "usage: %(prog)s [config file]"
description =... | fermiPy/lcpipe | runLCWeekly.py | Python | bsd-3-clause | 1,277 |
# -*- coding: utf-8 -*-
#
#
# $Date: 2005/11/04 14:06:36 $, by $Author: ivan $, $Revision: 1.1 $
#
"""
Graph pattern class used by the SPARQL implementation
"""
import sys, os, time, datetime
from rdflib.term import Literal, BNode, URIRef, Variable
from types import *
from rdflib.namespace import NamespaceManager
from... | alcides/rdflib | rdflib/sparql/graphPattern.py | Python | bsd-3-clause | 15,809 |
from sympy.core import Add, S, C, sympify, oo, pi
from sympy.core.function import Function, ArgumentIndexError
from zeta_functions import zeta
from sympy.functions.elementary.exponential import log
from sympy.functions.elementary.integers import floor
from sympy.functions.elementary.miscellaneous import sqrt
from sympy... | minrk/sympy | sympy/functions/special/gamma_functions.py | Python | bsd-3-clause | 10,069 |
# coding: utf-8
'''
Copyright (c) 2010, Alexandru Dancu
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 copyright notice,
this list of condit... | BackupTheBerlios/kimchi | src/ui/mvc/model/KColumnModel.py | Python | bsd-3-clause | 4,629 |
from django import forms
from django.utils import timezone
from django.utils.formats import get_format
from django.utils.safestring import mark_safe
from django.forms.widgets import SplitDateTimeWidget, HiddenInput
from timezones.forms import TZDateTimeField
from datetime import datetime
import dateutil.parser
from... | aarontropy/django-datebook | datebook/forms.py | Python | bsd-3-clause | 5,875 |
# Generated by Django 2.2.13 on 2020-07-28 23:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('linked_domain', '0010_auto_20200622_0156'),
]
operations = [
migrations.AlterField(
model_name='domainlinkhistory',
... | dimagi/commcare-hq | corehq/apps/linked_domain/migrations/0011_auto_20200728_2316.py | Python | bsd-3-clause | 804 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Daniel Zhang (張道博)'
__copyright__ = 'Copyright (c) 2014, University of Hawaii Smart Energy Project'
__license__ = 'https://raw.github' \
'.com/Hawaii-Smart-Energy-Project/Maui-Smart-Grid/master/BSD' \
'-LICENSE.txt'
import unittes... | Hawaii-Smart-Energy-Project/Maui-Smart-Grid | test/test_msg_types.py | Python | bsd-3-clause | 1,301 |
class OrderError(Exception):
pass
class OrderIdentifierError(OrderError):
"""
Order exception that is raised if order identifier was not found.
"""
pass
| druids/django-pyston | pyston/order/exceptions.py | Python | bsd-3-clause | 175 |
import dectate
try:
from urllib.parse import urlencode
except ImportError:
# Python 2
from urllib import urlencode
from morepath.path import get_arguments
from morepath.converter import Converter, IDENTITY_CONVERTER, ConverterRegistry
import morepath
import webob
def consume(mount, path, parameters=None):... | faassen/morepath | morepath/tests/test_model.py | Python | bsd-3-clause | 4,600 |
#!/usr/bin/env python
'''
Created on Mar 29, 2013
This script allows the user to dynamically investigate the IV and PV
characteristics of a single module. The user chooses the modules size--72 or 96
cells. A GUI is then generated that allows the user to change the size, location,
and irradiance level of a single "sha... | SunPower/PVMismatch | pvmismatch/contrib/module_mismatch_simulator.py | Python | bsd-3-clause | 20,978 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ....testing import assert_equal
from ..utils import MaskTool
def test_MaskTool_inputs():
input_map = dict(args=dict(argstr='%s',
),
count=dict(argstr='-count',
position=2,
),
datum=dict(argstr='-datum %s',
),
dilate_inputs=dict... | carolFrohlich/nipype | nipype/interfaces/afni/tests/test_auto_MaskTool.py | Python | bsd-3-clause | 1,581 |
# Arithmetic tests for DataFrame/Series/Index/Array classes that should
# behave identically.
# Specifically for datetime64 and datetime64tz dtypes
from datetime import datetime, time, timedelta
from itertools import product, starmap
import operator
import warnings
import numpy as np
import pytest
import pytz
from pa... | TomAugspurger/pandas | pandas/tests/arithmetic/test_datetime64.py | Python | bsd-3-clause | 90,010 |
"""A tool for monitoring webpages for updates
urlwatch is intended to help you watch changes in webpages and get notified
(via email, in your terminal or with a custom-written reporter class) of any
changes. The change notification will include the URL that has changed and
a unified diff of what has changed.
"""
pkgn... | lechuckcaptain/urlwatch | lib/urlwatch/__init__.py | Python | bsd-3-clause | 598 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by Exopy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ---------------... | Ecpy/ecpy | exopy/instruments/drivers/driver_decl.py | Python | bsd-3-clause | 10,506 |
import os
import threading
import time
from django.conf import settings
from django.db import connections
from django.dispatch import receiver
from django.test.signals import setting_changed
from django.utils import timezone
from django.utils.functional import empty
# Most setting_changed receivers are supposed to be... | dsanders11/django-future-staticfiles | tests/staticfiles_tests/signals.py | Python | bsd-3-clause | 3,301 |
"""A pythonic alternative to pandocfilters
See:
https://github.com/sergiocorreia/panflute
"""
from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
... | sergiocorreia/panflute | setup.py | Python | bsd-3-clause | 4,886 |
import autograd.numpy as np
import tensorflow as tf
import torch
import pymanopt
from examples._tools import ExampleRunner
from pymanopt.manifolds import Stiefel
from pymanopt.solvers import TrustRegions
SUPPORTED_BACKENDS = ("Autograd", "Callable", "PyTorch", "TensorFlow")
def create_cost_egrad_ehess(manifold, sa... | pymanopt/pymanopt | examples/pca.py | Python | bsd-3-clause | 3,394 |
"""
Cluster Supporting Redis Client
"""
import collections
import logging
import hiredis
from tornado import concurrent
from tornado import ioloop
from tornado import locks
from tornado import iostream
from tornado import tcpclient
from tredis import common
from tredis import crc16
from tredis import exceptions
from... | gmr/tredis | tredis/client.py | Python | bsd-3-clause | 25,877 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Activity'
db.create_table('sentry_activity', (
('id', self.gf('django.db.models.... | rdio/sentry | src/sentry/migrations/0082_auto__add_activity__add_field_group_num_comments__add_field_event_num_.py | Python | bsd-3-clause | 25,258 |
# proxy module
from __future__ import absolute_import
from mayavi.preferences.mayavi_preferences_page import *
| enthought/etsproxy | enthought/mayavi/preferences/mayavi_preferences_page.py | Python | bsd-3-clause | 111 |
from settings import *
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = '/tmp/token_auth.db'
| robmoggach/django-token-auth | src/token_auth/test_settings.py | Python | bsd-3-clause | 91 |
"""SQLAlchemy Transport module for kombu.
Kombu transport using SQL Database as the message store.
Features
========
* Type: Virtual
* Supports Direct: yes
* Supports Topic: yes
* Supports Fanout: no
* Supports Priority: no
* Supports TTL: no
Connection String
=================
.. code-block::
sqla+SQL_ALCHEMY... | celery/kombu | kombu/transport/sqlalchemy/__init__.py | Python | bsd-3-clause | 7,389 |
"""
sentry.tsdb.inmemory
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import six
from collections import Counter, defaultdict
from django.utils import timezone
from sentry.uti... | fotinakis/sentry | src/sentry/tsdb/inmemory.py | Python | bsd-3-clause | 6,068 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ordenes', '0008_tecnico_orden'),
]
operations = [
migrations.AlterField(
model_name='concepto',
name... | zaresdelweb/tecnoservicio | tecnoservicio/ordenes/migrations/0009_auto_20150513_1841.py | Python | bsd-3-clause | 449 |
from __future__ import absolute_import
from datetime import timedelta
from django.utils import timezone
from unittest import TestCase as SimpleTestCase
from sentry.api.paginator import (
BadPaginationError,
Paginator,
DateTimePaginator,
OffsetPaginator,
SequencePaginator,
GenericOffsetPaginato... | mvaled/sentry | tests/sentry/api/test_paginator.py | Python | bsd-3-clause | 19,392 |
# script to validate h5gate schema files using json schema
import os.path
import sys
# import json
import jsonschema
import ast
def load_schema(file_name):
""" Load Python file that contains JSON formatted as a Python dictionary.
Files in this format are used to store the schema because, unlike pure JSON,
... | NeurodataWithoutBorders/api-python | nwb/check_schema.py | Python | bsd-3-clause | 2,669 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import json
from pytak.please import convert_to_dotted
data = """
{
"title": "main_title",
"components": [
{
"component_id": 100,
"menu": [
{
"title": "menu_title1"
... | zlatozar/pytak | pytak/tests/convert_test.py | Python | bsd-3-clause | 1,147 |
# Bokeh imports
from bokeh.model import Model
class AModel(Model):
pass
| bokeh/bokeh | tests/unit/bokeh/embed/ext_package_no_main/__init__.py | Python | bsd-3-clause | 78 |
def extractOrtatranslationsBlogspotCom(item):
'''
Parser for 'ortatranslations.blogspot.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractOrtatranslationsBlogspotCom.py | Python | bsd-3-clause | 570 |
from django.db import models
from image_helper.fields import SizedImageField
class TestModel(models.Model):
image = SizedImageField(
upload_to='test_images', size=(220, 150), thumbnail_size=(100, 100))
| madisona/django-image-helper | image_helper/tests/test_app/models.py | Python | bsd-3-clause | 216 |
import pkg_resources
from portia.portia import Portia
from portia.utils import (
start_redis, start_tcpserver, compile_network_prefix_mappings)
from twisted.internet.defer import inlineCallbacks
from twisted.internet.task import Clock
from vumi.dispatchers.tests.helpers import DispatcherHelper
from vumi.errors i... | praekelt/vxportia | vxportia/tests/test_dispatchers.py | Python | bsd-3-clause | 6,447 |
#!/usr/bin/env python
# $Id$
"""
Print detailed information about a process.
"""
import os
import datetime
import socket
import sys
import psutil
from psutil._compat import namedtuple
def convert_bytes(n):
if n == 0:
return '0B'
symbols = ('k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
prefix = {}
... | jazinga/psutil | examples/process_detail.py | Python | bsd-3-clause | 3,753 |
# -*- coding: utf-8 -*-
"""Functional tests using WebTest.
See: http://webtest.readthedocs.org/
"""
| pmrowla/p101stat | tests/test_functional.py | Python | bsd-3-clause | 101 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import six
from django.core.exceptions import ValidationError
from django.db import models
from django.forms import CheckboxSelectMultiple
from django.utils.text import capfirst
from dynamic_forms.forms import MultiSelectFormField
class TextMultiSelect... | wangjiaxi/django-dynamic-forms | dynamic_forms/fields.py | Python | bsd-3-clause | 3,454 |
##########################################################################
#
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
# Copyright (c) 2013, John Haddon. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that ... | chippey/gaffer | python/GafferRenderMan/__init__.py | Python | bsd-3-clause | 2,499 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'WombatToken'
db.create_table('wombat_authenticator_wombattoken', (
('id', self.g... | AgainFaster/django-wombat-authenticator | wombat_authenticator/migrations/0001_initial.py | Python | bsd-3-clause | 5,385 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import copy
from django.db import connection
from cms.api import create_page
from cms.menu import CMSMenu, get_visible_pages
from cms.models import Page
from cms.models.permissionmodels import GlobalPagePermission, PagePermission
from cms.test_utils.fixtures... | datakortet/django-cms | cms/tests/menu.py | Python | bsd-3-clause | 52,671 |
#!/usr/bin/env python
"""
Create Matplotlib style gallery for all stylesheets and display in the browser.
By default, all plots are rebuilt, but this can be avoided using
the `--skip-build` (`-s`) flag.
To build a static website, run suppress user input and set a static output
directory::
python -m mpl_style_gal... | tonysyu/matplotlib-style-gallery | mpl_style_gallery/__main__.py | Python | bsd-3-clause | 2,157 |
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import itertools
import numpy as np
import pytest
torch = pytest.importorskip("torch")
import torc... | apple/coremltools | coremltools/converters/mil/frontend/torch/test/test_internal_graph.py | Python | bsd-3-clause | 67,606 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("GaussianNB" , "FourClass_500" , "sqlite")
| antoinecarme/sklearn2sql_heroku | tests/classification/FourClass_500/ws_FourClass_500_GaussianNB_sqlite_code_gen.py | Python | bsd-3-clause | 139 |
import binascii
import os
import random
from django.db import models
from django.utils.encoding import force_text, python_2_unicode_compatible
from aesfield.field import AESField
from olympia.amo.fields import PositiveAutoField
from olympia.amo.models import ModelBase
from olympia.users.models import UserProfile
#... | aviarypl/mozilla-l10n-addons-server | src/olympia/api/models.py | Python | bsd-3-clause | 3,638 |
# repo.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from git.exc import InvalidGitRepositoryError, NoSuchPathError
from git.cmd import Git
from git.util im... | dbaxa/GitPython | git/repo/base.py | Python | bsd-3-clause | 30,180 |
from datetime import datetime
import os
import subprocess
symbol = {'alpha': 'a', 'beta': 'b'}
def get_version(version, filename=None):
assert len(version) == 5
assert version[3] in ('alpha', 'beta', 'rc', 'final')
main = '.'.join(map(str, version[:3]))
sub = ''
if version[3] == 'alpha' and versi... | quantmind/pulsar | pulsar/utils/version.py | Python | bsd-3-clause | 2,619 |
from __future__ import print_function, division
import sys,os
qspin_path = os.path.join(os.getcwd(),"../")
sys.path.insert(0,qspin_path)
from quspin.basis import spinless_fermion_basis_general
from quspin.operators import hamiltonian
import numpy as np
J=-np.sqrt(2.0) # hoppping
U=+1.0 # nn interaction
no_checks... | weinbe58/QuSpin | tests/general_spinless_majorana_opstr_test.py | Python | bsd-3-clause | 2,006 |
from south.db import db
from django.db import models
from knesset.laws.models import *
class Migration:
no_dry_run = True
def forwards(self, orm):
for v in orm.Vote.objects.all():
v.votes_count = orm.VoteAction.objects.filter(vote=v).count()
v.save()
def bac... | livni/old-OK | src/knesset/laws/migrations/0005_add_votes_count_to_vote_data.py | Python | bsd-3-clause | 6,357 |
__author__ = 'Bohdan Mushkevych'
from werkzeug.utils import cached_property
from synergy.conf import settings
from synergy.system import time_helper
from synergy.conf import context
from synergy.mx.rest_model import RestTimetableTreeNode, RestJob
from synergy.mx.base_request_handler import BaseRequestHandler, valid_a... | eggsandbeer/scheduler | synergy/mx/tree_node_details.py | Python | bsd-3-clause | 2,627 |
from sympy import (Matrix, Symbol, solve, exp, log, cos, acos, Rational, Eq,
sqrt, oo, LambertW, pi, I, sin, asin, Function, diff, Derivative, symbols,
S, sympify, var, simplify, Integral, sstr, Wild, solve_linear, Interval,
And, Or, Lt, Gt, Assume, Q, re, im, expand, zoo)
from sympy.solvers import solve_l... | pernici/sympy | sympy/solvers/tests/test_solvers.py | Python | bsd-3-clause | 13,913 |
from flask import render_template, g, flash, redirect, url_for, request
from flask_peewee.utils import object_list
from werkzeug.datastructures import FileStorage
from werkzeug.utils import secure_filename
from peewee import fn, JOIN
from apps.forms.others import TugasForm
from apps.models import KumpulTugas, Tugas, M... | ap13p/elearn | apps/views/dosen/__init__.py | Python | bsd-3-clause | 3,490 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | vlegoff/tsunami | src/secondaires/navigation/editeurs/shedit/__init__.py | Python | bsd-3-clause | 10,053 |
import vtk
import os
import os.path
from vis.vtkpoly import VtkPolyModel
from vis.vtkvol import VtkVolumeModel
from IO.obj import OBJReader
class VtkIO:
def __get_reader(self, file_extension):
'''Returns a reader that can read the file type having the provided extension. Returns None if no such reader.'''
lo... | zibneuro/brainvispy | IO/vtkio.py | Python | bsd-3-clause | 1,198 |
#!/usr/bin/env python
from app import app
if __name__ == "__main__":
app.run(debug=True, host='0.0.0.0')
| voltaire/minecraft-site | app/run.py | Python | bsd-3-clause | 111 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2020, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | thermokarst/qiime2 | qiime2/core/type/grammar.py | Python | bsd-3-clause | 20,252 |
#!/usr/bin/env python
from distutils.core import setup
setup( name="qless_blinker",
version = "0.1",
description = "A bridge between qless & blinker.",
author = "Manas Garg",
author_email = "manasgarg@gmail.com",
license = "BSD License",
url = "https://github.com/manasgarg/qless-blinker-bridge... | manasgarg/qless-blinker-bridge | setup.py | Python | bsd-3-clause | 429 |
# -*- coding: utf-8 -*-
"""
:copyright: (C) 2010-2013 by Contrail Consortium.
"""
from conpaas.core.log import create_logger
from conpaas.core.node import ServiceNode
E_ARGS_UNEXPECTED = 0
E_CONFIG_READ_FAILED = 1
E_CONFIG_NOT_EXIST = 2
E_UNKNOWN = 3
E_ARGS_MISSING = 4
E_ARGS_INVALID = 5
E_STATE_ERROR = 6
E_STR... | ConPaaS-team/conpaas | conpaas-services/src/conpaas/services/mysql/manager/config.py | Python | bsd-3-clause | 4,854 |
from django.template.defaultfilters import make_list
from django.test import SimpleTestCase
from django.test.utils import str_prefix
from django.utils.safestring import mark_safe
from ..utils import setup
class MakeListTests(SimpleTestCase):
"""
The make_list filter can destroy existing escaping, s... | yephper/django | tests/template_tests/filter_tests/test_make_list.py | Python | bsd-3-clause | 1,654 |
"""Utilties for documentation."""
def docstring_parameter(*args, **kwargs):
"""Decorator to parameterize docstrings.
Examples
--------
>>> @docstring_parameter('test', answer='Yes it does.')
... def do_nothing():
... '''Does this {} do anything? {answer}'''
... pass
>>> print(... | FCP-INDI/C-PAC | CPAC/utils/docs.py | Python | bsd-3-clause | 503 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['MovingAverage'] , ['Seasonal_WeekOfYear'] , ['NoAR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Logit/model_control_one_enabled_Logit_MovingAverage_Seasonal_WeekOfYear_NoAR.py | Python | bsd-3-clause | 163 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("LogisticRegression" , "FourClass_100" , "mssql")
| antoinecarme/sklearn2sql_heroku | tests/classification/FourClass_100/ws_FourClass_100_LogisticRegression_mssql_code_gen.py | Python | bsd-3-clause | 146 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
#
# This s... | exocad/exotrac | contrib/checkwiki.py | Python | bsd-3-clause | 6,045 |
"""xferfcn.py
Transfer function representation and functions.
This file contains the TransferFunction class and also functions
that operate on transfer functions. This is the primary representation
for the python-control library.
"""
# Python 3 compatibility (needs to go here)
from __future__ import print_function
... | roryyorke/python-control | control/xferfcn.py | Python | bsd-3-clause | 58,104 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | ericmjl/bokeh | bokeh/client/session.py | Python | bsd-3-clause | 18,677 |
"""
Domain middleware: enables multi-tenancy in a single process
"""
from anaf.core.domains import setup_domain, setup_domain_database
from anaf.core.db import DatabaseNotFound
from anaf.core.conf import settings
from django.http import HttpResponseRedirect
from django.db.utils import DatabaseError
from django.core.url... | tovmeod/anaf | anaf/core/middleware/domain.py | Python | bsd-3-clause | 1,463 |
"""
Provides utilities to cleanup text
"""
NUMBER_DICTIONARY = {
0:'Zero'
, 1: "One"
, 2: "Two"
, 3: "Three"
, 4: "Four"
, 5: "Five"
, 6: "Six"
, 7: "Seven"
, 8: "Eight"
, 9: "Nine"
, 10: "Ten"
, 11: "Eleven"
, 12: "Twelve"
, 13: "Thirteen"
, 14: "Fourteen"
, 15: "Fifteen"
, 16: "Sixteen"
, 17: "Seventeen"
, 18: "Eight... | dimagi/rapidsms | lib/rapidsms/contrib/stringcleaning/inputcleaner.py | Python | bsd-3-clause | 9,705 |
# how long a cached payload sits around for (in seconds).
INITIAL_SYNC_CACHE_TIMEOUT = 60 * 60 # 1 hour
# the threshold for setting a cached payload on initial sync (in seconds).
# restores that take less than this time will not be cached to allow
# for rapid iteration on fixtures/cases/etc.
INITIAL_SYNC_CACHE_THRESH... | qedsoftware/commcare-hq | corehq/ex-submodules/casexml/apps/phone/const.py | Python | bsd-3-clause | 738 |
from neurodesign import geneticalgorithm, generate, msequence
import sys
design_i = sys.argv[1]
EXP = geneticalgorithm.experiment(
TR = 0.68,
P = [.6,.4],
C = [[0.5, -0.5]],
rho = 0.3,
n_stimuli = 2,
n_trials = 125,
duration = 310,
resolution = 0.136,
stim_duration = 1.85... | hbp-brain-charting/public_protocols | stanford_battery/protocol/design_files/stop_signal/GA_design.py | Python | bsd-3-clause | 937 |
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for chromite.lib.git and helpers for testing that module."""
from __future__ import print_function
import functools
import mock
import... | guorendong/iridium-browser-ubuntu | third_party/chromite/lib/git_unittest.py | Python | bsd-3-clause | 13,396 |
from __future__ import unicode_literals
from blanc_basic_assets.fields import AssetForeignKey
from django.core.exceptions import ValidationError
from django.core.urlresolvers import get_script_prefix
from django.core.validators import RegexValidator
from django.db import models
from django.utils.encoding import iri_to... | blancltd/blanc-basic-pages | blanc_basic_pages/models.py | Python | bsd-3-clause | 2,112 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 12, transform = "Logit", sigma = 0.0, exog_count = 0, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Logit/trend_MovingMedian/cycle_12/ar_/test_artificial_1024_Logit_MovingMedian_12__0.py | Python | bsd-3-clause | 264 |
dimension = 2
ncomponents = 1
potential = "henon_heiles"
eigenstate_of_level = 0
eigenstates_indices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
starting_point = [0.5, 0.5]
eps = 0.25
hawp_template = {
"type": "HagedornWavepacket",
"dimension": dimension,
"ncomponents": 1,
"eps": eps,
... | WaveBlocks/WaveBlocksND | examples/henon_heiles/eigenstates[eps=0.25].py | Python | bsd-3-clause | 830 |
#----------------------------------------------------------------------------
#
# Copyright (c) 2014, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in /LICENSE.txt and may be redistributed only
# under the conditions described in... | itziakos/trait-documenter | trait_documenter/trait_documenter.py | Python | bsd-3-clause | 4,946 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.