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 (c) 2014 Alcatel-Lucent Enterprise
# 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
#
# Un... | OpenTouch/night-watch | src/nw/providers/Ping.py | Python | apache-2.0 | 8,878 | 0.01194 |
import logging
from typing import Callable, Iterable, List, Optional, Type
from ray.rllib.agents.trainer import Trainer, COMMON_CONFIG
from ray.rllib.env.env_context import EnvContext
from ray.rllib.evaluation.worker_set import WorkerSet
from ray.rllib.execution.rollout_ops import ParallelRollouts, ConcatBatches
from ... | richardliaw/ray | rllib/agents/trainer_template.py | Python | apache-2.0 | 8,307 | 0 |
# Copyright (C) 2014-2016 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
# Originally contributed by Check Point Software Technologies, Ltd.
import ConfigParser
class Config:
def __init__(self, cfg):
"""@param c... | cuckoobox/cuckoo | cuckoo/data/analyzer/android/lib/core/config.py | Python | mit | 881 | 0.001135 |
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# Copyright (c) 2011, Evan Leis
#
# Distributed under the terms of the Lesser GNU General Public License (LGPL)
#-----------------------------------------------------------------------------
'''
Created on May 5, 2011... | nagyv/python-api-library | kayako/core/lib.py | Python | bsd-2-clause | 5,597 | 0.001787 |
from PyPDF2 import PdfFileReader, PdfFileWriter
from rect import Rect
from rect.packer import pack
from reportlab.lib import pagesizes
from reportlab.lib.units import mm
__version__ = "0.1.0"
class PDFPagePacker(object):
def __init__(self, pdf_file, canvas_size=pagesizes.A4, padding=5 * mm):
super(PDFPag... | beyond-content/python-pdf-paper-saver | src/pdfpapersaver/__init__.py | Python | bsd-2-clause | 2,516 | 0.001192 |
# postgresql/__init__.py
# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from . import base
from . import pg8000 # noqa
from . import psycopg2 # noq... | graingert/sqlalchemy | lib/sqlalchemy/dialects/postgresql/__init__.py | Python | mit | 2,432 | 0 |
#----------------------------------------------------------------------
# Copyright (c) 2014 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 witho... | dana-i2cat/felix | modules/resource/orchestrator/src/extensions/sfa/trust/speaksfor_util.py | Python | apache-2.0 | 18,996 | 0.005159 |
# -*- coding: utf-8 -*-
"""
werkzeug.local
~~~~~~~~~~~~~~
This module implements context-local objects.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import copy
from functools import update_wrapper
from werkzeug.wsgi impo... | zwChan/VATEC | ~/eb-virt/Lib/site-packages/werkzeug/local.py | Python | apache-2.0 | 14,275 | 0.003853 |
# framework/core.py
#
# Copyright 2011 Spencer J. McIntyre <SMcIntyre [at] SecureState [dot] net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (a... | firebitsbr/termineter | framework/core.py | Python | gpl-3.0 | 18,028 | 0.023408 |
import re
import urllib
from network import network
from balance import balance
from sms import sms
class Quiubas:
def __init__( self ):
self.lib_version = '1.1.1'
self.api_key = None
self.api_private = None
self.base_url = 'https://api.quiubas.com'
self.version = '2.1'
self.network = network( se... | quiubas/quiubas-python | quiubas/quiubas.py | Python | mit | 1,137 | 0.05277 |
"""
Django settings for lichesshub project.
Generated by 'django-admin startproject' using Django 1.11.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import... | AfricaChess/lichesshub | lichesshub/settings.py | Python | mit | 4,754 | 0.001052 |
import datetime
from django.conf import settings
from django.core.exceptions import FieldError
from django.db.backends.util import truncate_name
from django.db.models.constants import LOOKUP_SEP
from django.db.models.query_utils import select_related_descend, QueryWrapper
from django.db.models.sql.constants import (SI... | makinacorpus/django | django/db/models/sql/compiler.py | Python | bsd-3-clause | 49,723 | 0.001589 |
"""Tests for the HomematicIP Cloud component."""
| fbradyirl/home-assistant | tests/components/homematicip_cloud/__init__.py | Python | apache-2.0 | 49 | 0 |
import csv
import re
import unicodedata
from utils import *
def initialise(name):
return re.sub('[^A-Z]', '', name)
def asciify(name):
return unicodedata.normalize('NFKD', unicode(name)).encode('ascii', 'ignore')
def parse(data):
orgs_by_id = dict([ (x['id'], x) for x in data['organizations'].values() ])... | hzj123/56th | pombola/south_africa/bin/people-json/committees.py | Python | agpl-3.0 | 2,683 | 0.011182 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.auth.models import User
from account.models import Account
class Migration(DataMigration):
def forwards(self, orm):
# we need to associate each user to an account o... | GISPPU/GrenadaLandInformation | geonode/people/migrations/0003_link_users_to_account.py | Python | gpl-3.0 | 10,196 | 0.007846 |
#!/usr/bin/env python
#------------------------------------------------------------
#
# Ciro D. Santilli
#
# Prints a list of paths which are files followed by their inodes and sha1 sums.
#
# Useful to make a backup of paths names before mass renaming them,
# supposing your files are distinct by SHA1 and that SHA1 ha... | cirosantilli/python-utils | bin/find_path_sha1.py | Python | mit | 2,436 | 0.010673 |
'''
@author: lockrecv@gmail.com
A pure python ping implementation using raw socket.
Note that ICMP messages can only be sent from processes running as root.
Inspired by Matthew Dixon Cowles <http://www.visi.com/~mdc/>.
'''
import os
import select
import socket
import struct
import time
class Ping:
''' Power On... | ylcrow/poweron | src/thirdparty/Ping.py | Python | mit | 5,859 | 0.008875 |
# -*- coding: utf-8 -*-
# Алгоритм решето Эратосфена. Нахождение последовательности простых чисел, не превышающе заданной длины.
from math import sqrt, floor
def sieve(len):
# Генерируем массив начальных значений от 2 до len;
init_array = [a for a in range(0, len+1)]
# 1 - не простое число!
init_arra... | madAsket/levitin_algorithms | src/sieve_eratosphene.py | Python | gpl-3.0 | 1,323 | 0.004242 |
from datetime import timedelta
import unittest
import mock
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, Permission
from django.core import mail
from django.core.paginator import Paginator
from ... | jorge-marques/wagtail | wagtail/wagtailadmin/tests/test_pages_views.py | Python | bsd-3-clause | 93,571 | 0.003377 |
# -*- coding: utf-8 -*-
import unittest
from objectchecker import ObjectChecker
# Config
options = {
'messageTemplate': {
'invalid' : "Value of Field `{{fieldName}}` is not valid. Got `{{fieldValue}}`, but require {{checkerName}} = {{checkerOption}}",
'missing' : "Missing {{fieldName}}",
... | pastgift/object-checker-py | test/test.py | Python | mit | 14,685 | 0.009465 |
# -*- coding: utf-8 -*-
"""
@author: Jeff Cavner
@contact: jcavner@ku.edu
@license: gpl2
@copyright: Copyright (C) 2014, University of Kansas Center for Research
Lifemapper Project, lifemapper [at] ku [dot] edu,
Biodiversity Institute,
1345 Jayhawk Boulevard, Lawrence, Kansas, 66045, US... | lifemapper/LmQGIS | lifemapperTools/tools/newExperiment.py | Python | gpl-2.0 | 17,776 | 0.024415 |
import pprint
### "import"
from example.classes import Data
### "plugins"
Data.plugins
import example.classes2
Data.plugins
### "example-data"
example_data = [{
"foo" : 123,
"bar" : 456
}]
### "csv-example"
csv_data = Data.create_instance('csv', example_data)
csv_data.present()
csv_data.update_settin... | dexy/cashew | example/usage2.py | Python | mit | 581 | 0.018933 |
import random
# Simply picks the winning door at random
def door_picker():
winner = random.randrange(1, doors+1)
return winner
# This opens all the other doors and allows the user to swich or stay
def door_opener(choice, winner, switch, enable_auto):
if enable_auto == "n":
switch = None
if cho... | JaredKotoff/100Doors | 100Doors.py | Python | mit | 3,198 | 0.002814 |
"""
byceps.permissions.site
~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from ..util.authorization import create_permission_enum
SitePermission = create_permission_enum(
'site',
[
'create',
'update',
'vi... | homeworkprod/byceps | byceps/permissions/site.py | Python | bsd-3-clause | 334 | 0 |
# https://djangosnippets.org/snippets/690/
import re
from django.template.defaultfilters import slugify
def unique_slugify(instance, value, slug_field_name='slug', queryset=None,
slug_separator='-'):
"""
Calculates and stores a unique slug of ``value`` for an instance.
``slug_field_nam... | thelabnyc/wagtail_blog | blog/utils.py | Python | apache-2.0 | 2,644 | 0.000378 |
# -*- coding: utf-8 -*-
#
# This file is part of the VecNet OpenMalaria Portal.
# For copyright and licensing information about this package, see the
# NOTICE.txt and LICENSE.txt files in its top-level directory; they are
# available at https://github.com/vecnet/om
#
# This Source Code Form is subject to the terms of t... | vecnet/om | website/apps/ts_om/tests/test_run_new.py | Python | mpl-2.0 | 1,914 | 0.000522 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-29 10:44
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0004_auto_20161129_0947'),
]
operations = [
migrations.AlterField(
... | petersterling1/poke-qr-viewer | main/migrations/0005_auto_20161129_1044.py | Python | gpl-3.0 | 633 | 0 |
import itertools
import os
import zipfile
import numpy as np
import requests
import scipy.sparse as sp
def _get_movielens_path():
"""
Get path to the movielens dataset file.
"""
return os.path.join(os.path.dirname(os.path.abspath(__file__)),
'movielens.zip')
def _download... | paoloRais/lightfm | examples/movielens/data.py | Python | apache-2.0 | 3,559 | 0.000281 |
from django.shortcuts import render, redirect
def index(request):
return redirect('status/', permanent=True)
| rogst/drainomote | drainomote/views.py | Python | gpl-3.0 | 115 | 0 |
#!/usr/bin/env python
import string
import logging
from .HTMLElement import HTMLElement
log = logging.getLogger("Thug")
class TAnimateColor(HTMLElement):
def __init__(self, doc, tag):
self.doc = doc
self.tag = tag
self._values = ""
def get_values(self):
return self._values
... | tweemeterjop/thug | thug/DOM/W3C/HTML/TAnimateColor.py | Python | gpl-2.0 | 948 | 0.005274 |
import zstackwoodpecker.operations.scheduler_operations as sch_ops
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.operations.tag_operations as tag_ops
import zstackwoodpecker.operations.backupstorage_operations as bs_ops
import zstackwoodpecker.test_lib as test_lib
import zsta... | zstackio/zstack-woodpecker | integrationtest/vm/virtualrouter/scheduler/test_delete_local_backupstorage.py | Python | apache-2.0 | 5,456 | 0.003116 |
# 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... | ppwwyyxx/tensorflow | tensorflow/python/training/checkpoint_utils.py | Python | apache-2.0 | 19,434 | 0.005557 |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 18 09:29:56 2015
@author: monteiro
"""
from thermopy.iapws import Water
from thermopy.units import Pressure, Temperature
def test_iapws():
"""
Tests are given inside the IAPWS document. See references for more details.
"""
#test Tsat given P
assert r... | guillemborrell/Thermopy | test/test_iapws.py | Python | bsd-3-clause | 9,460 | 0.00222 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Corwin Brown <blakfeld@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... | faust64/ansible | lib/ansible/modules/windows/win_robocopy.py | Python | gpl-3.0 | 4,902 | 0.00204 |
import numpy as np
from config import *
from get_tile_data import get_tile_data
from compute_accuracy_iou import compute_accuracy_and_iou
[test_x, test_y] = get_tile_data(NUM_DATA['TEST'], RAND_SEED['TEST'])
def predict(prototxt, caffe_model):
net = caffe.Net(prototxt, caffe_model, caffe.TEST)
dinputs = {}
... | MPI-IS/bilateralNN | bilateralnn_code/examples/tile_segmentation/predict.py | Python | bsd-3-clause | 710 | 0.002817 |
__author__ = 'Benqing'
users = {
"Angelica": {"Blues Traveler": 3.5, "Broken Bells": 2.0, "Norah Jones": 4.5, "Phoenix": 5.0,
"Slightly Stoopid": 1.5, "The Strokes": 2.5, "Vampire Weekend": 2.0},
"Bill": {"Blues Traveler": 2.0, "Broken Bells": 3.5, "Deadmau5": 4.0, "Phoenix": 2.0, "Slightly St... | timmyshen/Guide_To_Data_Mining | Chapter2/SharpenYourPencil/distance.py | Python | mit | 4,916 | 0.003662 |
# Copyright (C) 2015 Red Hat, Inc., Bryn M. Reeves <bmr@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 General... | slashdd/sos | sos/report/plugins/mpt.py | Python | gpl-2.0 | 732 | 0 |
# Copyright 2004-2006 Daniel Henninger <jadestorm@nc.rr.com>
# Licensed for distribution under the GPL version 2, check COPYING for details
from twisted.python import log
import sys, time
import config
def observer(eventDict):
try:
observer2(eventDict)
except Exception, e:
printf("CRITICAL: Traceback in debug.... | shizeeg/pyicqt | src/debug.py | Python | gpl-2.0 | 3,058 | 0.039568 |
"""Tests for the ATAG integration."""
import aiohttp
from homeassistant.components.atag import DOMAIN
from homeassistant.config_entries import ENTRY_STATE_SETUP_RETRY
from homeassistant.core import HomeAssistant
from tests.async_mock import patch
from tests.components.atag import init_integration
from tests.test_util... | nkgilley/home-assistant | tests/components/atag/test_init.py | Python | apache-2.0 | 1,472 | 0.000679 |
# Copyright (C) 2018-2022 Yannick Jadoul
#
# This file is part of Parselmouth.
#
# Parselmouth 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 ... | YannickJadoul/Parselmouth | tests/resource_fixtures.py | Python | gpl-3.0 | 1,735 | 0.006916 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2012, 2013, 2014, 2015 CERN.
#
# Zenodo 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 o... | otron/zenodo | zenodo/shell.py | Python | gpl-3.0 | 3,274 | 0 |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from appconf import AppConf
trans_app_label = _('Core')
class OppsCoreConf(AppConf):
DEFAULT_URLS = ('127.0.0.1', 'localhost',)
SHORT = 'googl'
SHORT_URL = 'googl.short.GooglUrlShort'
CHANNEL_CONF = {}
VIEWS_LIMIT =... | laborautonomo/opps | opps/core/__init__.py | Python | mit | 4,511 | 0 |
from pymongo import MongoClient
client = MongoClient()
| WING-NUS/corpSearch | mongo.py | Python | lgpl-3.0 | 56 | 0 |
# author: brian dillmann
# for rscs
from Devices.Input import Input
from Devices.Timer import Timer
from Devices.AnalogInput import AnalogInput
from Devices.Output import Output
class DeviceManager:
def __init__(self):
self.inputs = {}
self.outputs = {}
def addSimpleInput(self, name, location, invert = False):
... | dillmann/rscs | lib/DeviceManager.py | Python | mit | 1,683 | 0.026738 |
# Copyright (c) 2015 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 re... | openstack/murano | murano/policy/modify/actions/action_manager.py | Python | apache-2.0 | 3,403 | 0 |
from base_model import BaseModel
import sqlalchemy as db
class User(BaseModel):
#table mapping
__tablename__ = "users"
##region column mapping
id = db.Column(db.Integer, primary_key=True)
user_name = db.Column(db.Text)
primary_email_id = db.Column(db.Integer, db.ForeignKey('user_emails.id') )
#Use mod... | namgivu/shared-model-FlaskSqlAlchemy-vs-SQLAlchemy | python-app/model/user.py | Python | gpl-3.0 | 1,292 | 0.026316 |
from django.contrib.auth.models import User
from django.db import models
from django.db.models import signals
from cyder.core.cyuser import backends
from cyder.core.ctnr.models import Ctnr
class UserProfile(models.Model):
user = models.OneToOneField(User)
default_ctnr = models.ForeignKey(Ctnr, default=2)
... | ngokevin/cyder | cyder/core/cyuser/models.py | Python | bsd-3-clause | 730 | 0.00274 |
# -*- coding: utf-8 -*-
"""Regression tests."""
from __future__ import print_function
from __future__ import unicode_literals
from tabulate import tabulate, _text_type, _long_type, TableFormat, Line, DataRow
from common import assert_equal, assert_in, skip
def test_ansi_color_in_table_cells():
"Regression: ANSI... | astanin/python-tabulate | test/test_regression.py | Python | mit | 16,317 | 0.000741 |
from datetime import datetime
from flask import Flask, request, render_template, redirect, url_for
from flask.ext.mongokit import MongoKit, Document, Connection
import os
app = Flask(__name__)
class Task(Document):
__collection__ = 'tasks'
structure = {
'title': unicode,
'text': unicode,
... | marchon/Debug-Dokku.alt-Mongodb-Flask-Python | todo.py | Python | mit | 2,262 | 0.014147 |
# promptool - A tool to create prompts for POSIX shells, written in python and GTK
# Copyright (C) 2011 - David Winings
#
# promptool 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 Found-
# ation, either version 3 of... | dwinings/promptool | preferences.py | Python | gpl-3.0 | 3,585 | 0.006974 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import re
class EntityException(Exception):
"""Wrap entity specific errors"""
pass
class Entity(object):
"""Base implementation for an Asana entity containing
common funcitonality"""
# Keys which are filtered as part of the HTTP request
_filter_k... | mburgs/asanorm | asana/entities/entity.py | Python | apache-2.0 | 6,721 | 0.031394 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.camino.convert import AnalyzeHeader
def test_AnalyzeHeader_inputs():
input_map = dict(args=dict(argstr='%s',
),
centre=dict(argstr='-centre %s',
units='mm',
),
data_dims=dict(arg... | mick-d/nipype_source | nipype/interfaces/camino/tests/test_auto_AnalyzeHeader.py | Python | bsd-3-clause | 2,420 | 0.032645 |
from contextlib import contextmanager
import sys
from . import CorpusContext
from .client.client import PGDBClient, ClientError, ConnectionError
def get_corpora_list(config):
with CorpusContext(config) as c:
statement = '''MATCH (n:Corpus) RETURN n.name as name ORDER BY name'''
results = c.execute... | PhonologicalCorpusTools/PyAnnotationGraph | polyglotdb/utils.py | Python | mit | 1,770 | 0.001695 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division
from qsrlib_qsrs.qsr_rcc_abstractclass import QSR_RCC_Abstractclass
class QSR_RCC8(QSR_RCC_Abstractclass):
"""Symmetrical RCC5 relations.
Values of the abstract properties
* **_unique_id** = "rcc8"
* **_all_possible_relat... | cdondrup/strands_qsr_lib | qsr_lib/src/qsrlib_qsrs/qsr_rcc8.py | Python | mit | 1,237 | 0.003234 |
#!/usr/bin/env python
# -*- coding: utf-8 -*_
| fuzhouch/amberalertcn | server/amberalertcn/api/__init__.py | Python | bsd-3-clause | 47 | 0.021277 |
import json
import logging
import os
import threading
from collections import deque
from datetime import datetime, timedelta
from typing import Optional
import requests
logging.getLogger('requests.packages.urllib3').setLevel(logging.WARN)
FETCH_PERIOD = 2
FILE_EXT = '.state-summary.json'
STATE_SUMMARY_URI = os.gete... | asridharan/dcos | packages/dcos-history/extra/history/statebuffer.py | Python | apache-2.0 | 6,354 | 0.001731 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("conferences", "0008_auto_20150601_1436"),
]
operations = [
migrations.AddField(
model_name="conferenceproposalre... | pythonindia/junction | junction/conferences/migrations/0009_conferenceproposalreviewer_nick.py | Python | mit | 534 | 0 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | tomsilver/nupic | examples/network/network_api_demo.py | Python | gpl-3.0 | 7,557 | 0.009528 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test cases for L{twisted.python.randbytes}.
"""
import os
from twisted.trial import unittest
from twisted.python import randbytes
class SecureRandomTestCaseBase(object):
"""
Base class for secureRandom test cases.
"""
def... | nlloyd/SubliminalCollaborator | libs/twisted/test/test_randbytes.py | Python | apache-2.0 | 3,309 | 0.003022 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# quicksorts.py (C) myke, 2015
# 2015-11-08 1.1
# various versions of quicksort alogo
import random
TIMES = 10
SIZE = 10
RANGE = 10
# -----------------------------------------------
def qs1 (al):
""" Algo quicksort for a list
"""
if not al:
return ... | mykespb/pythoner | quicksorts.py | Python | apache-2.0 | 1,354 | 0.008124 |
# -*- coding: utf-8 -*-
from copy import deepcopy
from cms.admin.placeholderadmin import FrontendEditableAdminMixin, \
PlaceholderAdminMixin
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import get_user_model
from parler.admin import Translatable... | britny/djangocms-blog | djangocms_blog/admin.py | Python | bsd-3-clause | 5,791 | 0.000691 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
apipatterns = [
url(r'^', include('cars.api.urls')),
]
urlpatterns = patterns(
'',
url(r'^admin/', include(admin.site.urls)),
url(
r'^manufacturer/',
include('man... | Alexx-G/tastypie-example | src/config/urls.py | Python | mit | 771 | 0 |
# -*- coding: utf-8 -*-
'''
Copyright 2014 FreshPlanet (http://freshplanet.com | opensource@freshplanet.com)
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/L... | freshplanet/AppEngine-Counter | counter/views.py | Python | apache-2.0 | 1,493 | 0.004019 |
import sys, glob
sys.path.append('gen-py')
from auth_service import Auth_Service
from auth_service.ttypes import *
from bft2f_pb2 import *
from argparse import ArgumentParser
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
from time import sleep, time
from Crypto.PublicKey... | akshayka/bft2f | start_client.py | Python | gpl-2.0 | 10,155 | 0.006302 |
#!/usr/bin/env python
import random
class WinningStrategy:
def __init__(self):
self.won = False
self.prev_hand = 0
def next_hand(self):
if not self.won:
self.prev_hand = random.randint(0, 2)
return self.prev_hand
def study(self, is_win):
self.won = is_... | kobtea/gof | strategy.py | Python | mit | 2,642 | 0 |
from buildercore.bvars import encode_bvars, read_from_current_host
from buildercore.command import remote_sudo, upload
from io import StringIO
from decorators import requires_aws_stack
from buildercore.config import BOOTSTRAP_USER
from buildercore.core import stack_all_ec2_nodes, current_node_id
from buildercore.contex... | elifesciences/builder | src/buildvars.py | Python | mit | 6,259 | 0.004474 |
#!/usr/bin/python
import ctypes
import sys
import logging
from multiprocessing import Process, Pipe, Value, Manager, Lock
from Platform import platform_unit as platform_unit
from Computation import computation_unit as computation_unit
# configure logging
logging.basicConfig(filename='computational_system.log',level... | jmhal/elastichpc | beta/trials/evolving/System.py | Python | mit | 1,945 | 0.028792 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
from pony.orm.core import Entity, SetInstance, Required, Optional
import suapp.orm
__all__ = ["to_json", "dumps"]
def to_json(object_to_serialize):
"""
Adding simple serialization for objects.
If standard json.dumps fails and it is a real ob... | schilduil/suapp | suapp/simple_json.py | Python | mit | 2,757 | 0.000363 |
# -*coding: utf-8 -*-
"""Module for creating PosyArray instances.
Example
-------
>>> x = gpkit.Monomial('x')
>>> px = gpkit.PosyArray([1, x, x**2])
"""
import numpy as np
from .small_classes import Numbers
from . import units as ureg
from . import DimensionalityError
Quantity = ureg.Quantity
clas... | galbramc/gpkit | gpkit/posyarray.py | Python | mit | 7,110 | 0.000563 |
# -*- coding: utf-8 -*-
import numpy as np
x = np.array([3, 2, 1, 0])
print(x[[0, 1, 2]])
print(x[[-1, -2, -3]])
y = np.array([[1, 2], [3, 4], [5, 6]])
print(y[[0, 1]])
print(y[[0, 1], [0, 1]])
| w01230/test | python/numpy/np_index2.py | Python | gpl-3.0 | 197 | 0 |
# Copyright 2016-2020 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
def post_init_hook(cr, registry):
""" Add street3 to address format """
query = """
UPDATE res_country
SET address_format = replace(
address_format,
E'%(street2)s\n',
E'%(stree... | OCA/partner-contact | partner_address_street3/hooks.py | Python | agpl-3.0 | 919 | 0 |
import os
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
from matplotlib import cm
import atmath
# Define the observable
srcDir = '../runPlasim/postprocessor/indices/'
# SRng = np.array([1260, 1360, 1380, 1400, 1415, 1425, 1430, 1433,
# 1263, 1265, 1270, 1280, 1300, 1330, ... | atantet/transferPlasim | statistics/plotIndices.py | Python | gpl-2.0 | 4,841 | 0.005784 |
#! /usr/bin/python
import boto3
import argparse
import sys
import inspect
import getpass
import os.path
import time
from os.path import expanduser
# Set up acceptable arguments
def create_parser():
parser = argparse.ArgumentParser()
parser.add_argument("-u","--up", nargs='+', help="List of EC2 ids to bring up... | V3ckt0r/Quickspin | Quickspin/quickspin.py | Python | lgpl-3.0 | 8,275 | 0.005317 |
import pytest
from hbayesdm.models import gng_m3
def test_gng_m3():
_ = gng_m3(
data="example", niter=10, nwarmup=5, nchain=1, ncore=1)
if __name__ == '__main__':
pytest.main()
| CCS-Lab/hBayesDM | Python/tests/test_gng_m3.py | Python | gpl-3.0 | 198 | 0 |
"""
The Transition Model.
Init: State object with information about current location & ground velocity, the action
which will be taken, and an environment object containing wind information
and simulation parameters.
This is done as an object so that multiple models may be used at the same time for
reinforcement lea... | ProjectALTAIR/Simulation | mdp/tm.py | Python | gpl-2.0 | 825 | 0.024242 |
import wx
from wx.lib.agw import fourwaysplitter as FWS
from panda3d.core import *
from direct.showbase.ShowBase import *
from direct.directtools.DirectGlobals import *
try:
base
except NameError:
base = ShowBase(False, windowType = 'none')
from .WxAppShell import *
from .ViewPort import *
ID_FOUR_VIEW = 40... | grimfang/panda3d | direct/src/wxwidgets/WxPandaShell.py | Python | bsd-3-clause | 9,624 | 0.010183 |
import sys, numpy as np, hashlib, copy, cPickle, ctypes, os, os.path as osp
from collections import defaultdict,namedtuple
import __builtin__
import traceback
import cgt
from . import utils
# ================================================================
# Datatypes
# ================================================... | nebw/cgt | cgt/core.py | Python | mit | 122,515 | 0.013329 |
import unittest
import numpy as np
import theano
import theano.tensor as T
from tests.helpers import (SimpleTrainer, SimpleClf, SimpleTransformer,
simple_reg)
from theano_wrapper.layers import (BaseLayer, HiddenLayer, MultiLayerBase,
BaseEstimator, BaseTra... | sotlampr/theano-wrapper | tests/test_layers.py | Python | mit | 18,340 | 0 |
from django import forms
from cyder.base.mixins import UsabilityFormMixin
from cyder.cydhcp.supernet.models import Supernet
class SupernetForm(forms.ModelForm, UsabilityFormMixin):
class Meta:
model = Supernet
exclude = ('start_lower', 'start_upper',
'end_lower', 'end_upper')
... | akeym/cyder | cyder/cydhcp/supernet/forms.py | Python | bsd-3-clause | 417 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author:
# Łukasz Polak <l.polak@gmail.com>
#
"""This is main file for whole GUI part of OpenBCI - main window of whole
application, along with loading all needed modules GUIs"""
# We are using newer version of QVariant through our GUI, so we might as well
# set it... | BrainTech/openbci | obci/gui/frontend/main_gui.py | Python | gpl-3.0 | 4,516 | 0.005316 |
#!/usr/bin/python3
import numpy, sys
#from test.generate_test_vectors import TestVectorGenerator
import pyximport; pyximport.install()
from lsh import bits
class Projection:
def __init__(self, n_bits, n_feats):
self.n_bits = n_bits
self.n_feats = n_feats
self.vectors = numpy.random.randn(se... | schwa-lab/lsh | lsh/hashes.py | Python | mit | 2,098 | 0.025262 |
#!/usr/bin/env python
import logging
from pdb import set_trace
import requests
import simplejson
from time import time
import os
import facebook
# MY_API_URL
# MY_SITE_MSG
# MY_GROUP_NAME
# POST_TO_ID = None
def run():
data = get_from_cal_json()
msg = create_msg(data)
post(msg)
def get_from_cal_json... | OpenACalendar/OpenACalendar-Tools-Social | example-facebook-post-weekly/facebook-post-weekly.py | Python | bsd-3-clause | 2,695 | 0.007421 |
# proxy module
from __future__ import absolute_import
from envisage.developer.developer_plugin import *
| enthought/etsproxy | enthought/envisage/developer/developer_plugin.py | Python | bsd-3-clause | 104 | 0 |
import time
import config
from ophyd import scaler
from ophyd.utils import enum
ScalerMode = enum(ONE_SHOT=0, AUTO_COUNT=1)
loggers = ('ophyd.signal',
'ophyd.scaler',
)
config.setup_loggers(loggers)
logger = config.logger
sca = scaler.EpicsScaler(config.scalers[0])
sca.preset_time.put(5.2, ... | dchabot/ophyd | examples/scaler.py | Python | bsd-3-clause | 1,039 | 0 |
# -*- coding: utf-8 -*-
import os
from setuptools import setup
__here__ = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(__here__, 'README.rst')).read()
REQUIREMENTS = [
i.strip()
for i in open(os.path.join(__here__, 'requirements.txt')).readlines()
]
# Get VERSION
version_file = os... | oblalex/txinvoke | setup.py | Python | mit | 1,351 | 0 |
import cv2
import ss_get_axis_points
import math
import numpy as np
import ss_get_lit_button
#now we don't care about what color the button is
#just care about location of bright center relative to major axis
def find_button(img, mean_cols, mean_rows):
#testing
cv2.circle(img, (mean_cols, mean_rows), 2, (255, 255, ... | ufieeehw/IEEE2015 | ros/ieee2015_vision/src/object_detection/test_functions/ss_find_button_test.py | Python | gpl-2.0 | 1,759 | 0.03809 |
# pyOCD debugger
# Copyright (c) 2016-2020 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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... | pyocd/pyOCD | pyocd/cache/register.py | Python | apache-2.0 | 7,288 | 0.001921 |
from pokerstars.screen_scraper import ScreenScraper
from public import map_card_string_to_tuple
from public import change_terminal_color
import re
import time
import json
import copy
class MoveCatcher():
def __init__(self, to_act, game_driver):
self.to_act = to_act#{{{
self.game_driver ... | zhaw/Poker-Bot-Reformed | pokerstars/move_catcher.py | Python | mit | 10,977 | 0.006013 |
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2017 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2013 Lutz Fiebach (lufie@openelec.tv)
#
# This program is dual-licensed; you can redistri... | OpenELEC/service.openelec.settings | src/service.py | Python | gpl-2.0 | 4,695 | 0.002343 |
#!/usr/bin/python
""" wrapper to make simple calls to raxml """
import os
import sys
import glob
import subprocess
from ipyrad.analysis.utils import Params
from ipyrad.assemble.utils import IPyradError
# alias
OPJ = os.path.join
class Raxml(object):
"""
RAxML analysis utility function. This tool makes it ... | dereneaton/ipyrad | ipyrad/analysis/raxml.py | Python | gpl-3.0 | 9,380 | 0.00565 |
# -*- coding: utf8 -*-
import re
from unidecode import unidecode
import os, sys
from hashlib import md5 as hasher
import binascii
import settings
def gen_flattened_list(iterables):
for item in iterables:
if hasattr(item, '__iter__'):
for i in item:
yield i
else:
... | jumoconnect/openjumo | jumodjango/etc/func.py | Python | mit | 1,840 | 0.004934 |
inp = input().split()
n = int(inp[0])
m = int(inp[1])
c = inp[2]
k = []
for i in range(n):
k.append(list(input()))
lt = (-1, -1)
rt = (-1, -1)
for i in range(n):
for j in range(m):
if k[i][j] == c:
rt = (i, j)
if lt[0] < 0:
lt = (i, j)
ans = set()
for i in range(lt[0], rt[0] + 1):
for j in range(lt[... | Blimeo/Java | out/production/matthew/Contests/CodeForces/pset6/President's Office.py | Python | apache-2.0 | 684 | 0.023392 |
# 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():
print "WARNING!!!! Email Settings not migrated. Please setup your email again."
# this will happen if you are migrating... | mahabuber/erpnext | erpnext/patches/v4_0/split_email_settings.py | Python | agpl-3.0 | 2,172 | 0.02302 |
from . import ir_model
from . import ir_ui_view
| OCA/OpenUpgrade | openupgrade_framework/odoo_patch/odoo/addons/base/models/__init__.py | Python | agpl-3.0 | 48 | 0 |
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | plaid/plaid-python | plaid/model/recurring_transaction_frequency.py | Python | mit | 7,155 | 0.000699 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: tasking_dsz.py
import mcl.framework
import mcl.tasking
class dsz:
INTERFACE = 16842801
PFAM = 4169
PROVIDER_ANY = 4169
PROVIDER = 16... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/mca/security/cmd/permissions/tasking_dsz.py | Python | unlicense | 507 | 0.009862 |
# Copyright (c) 2020, NVIDIA 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 by ... | mlperf/inference_results_v0.7 | open/Inspur/code/rnnt/tensorrt/preprocessing/convert_rnnt_data.py | Python | apache-2.0 | 11,154 | 0.004931 |
from parser import CategoryParser
class ScrubbingTelemetryParser(CategoryParser):
def __init__(self, reader, store):
CategoryParser.__init__(self, '05: Scrubbing State', reader, store)
def get_bit_count(self):
return 3 + 3 + 32
def parse(self):
self.append("Primary Flash Scrubbin... | PW-Sat2/PWSat2OBC | integration_tests/emulator/beacon_parser/scrubbing_telemetry_parser.py | Python | agpl-3.0 | 445 | 0.002247 |
from django.contrib.localflavor.co.forms import CODepartmentSelect
from utils import LocalFlavorTestCase
class COLocalFlavorTests(LocalFlavorTestCase):
def test_CODepartmentSelect(self):
d = CODepartmentSelect()
out = u"""<select name="department">
<option value="AMA">Amazonas</option>
<option val... | disqus/django-old | tests/regressiontests/forms/localflavor/co.py | Python | bsd-3-clause | 1,661 | 0.000602 |
from base import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
| dev-coop/meancoach | meancoach_project/settings/test.py | Python | mit | 136 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.