code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright 2014 Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | sajeeshcs/nested_quota | nova/virt/hardware.py | Python | apache-2.0 | 39,169 |
from flask import Flask, render_template
from os import path, pardir
def get_static_dir():
rootdir = path.join(path.dirname(__file__), pardir)
return path.abspath(path.join(rootdir, 'static'))
def get_templates_dir():
rootdir = path.join(path.dirname(__file__), pardir)
return path.abspath(path.join(... | opesci/gui | opescigui/opescigui.py | Python | mit | 735 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2014 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# 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, eithe... | paour/weblate | weblate/trans/models/source.py | Python | gpl-3.0 | 1,144 |
################################################################################
# MIT License
#
# Copyright (c) 2017 Jean-Charles Fosse & Johann Bigler
#
# 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 t... | ThinkEE/Kameleon | kameleon/run_template.py | Python | mit | 2,388 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-08 21:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('features', '0002_featurerequest'),
]
operations = [
migrations.AlterField(
... | wkevina/feature-requests-app | features/migrations/0003_auto_20160408_2155.py | Python | mit | 646 |
#!/usr/bin/env python
import sys
import signal
import time
duration = int(sys.argv[1])
ignore_term = bool(int(sys.argv[2]))
print('duration %s, ignore SIGTERM %s' % (duration, ignore_term))
if ignore_term:
def handler(signum, frame):
print('Signal handler called with signal', signum)
# just ingore... | ganga-devs/ganga | ganga/GangaCore/old_test/Internals/TestShell/kill_test.py | Python | gpl-3.0 | 476 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
"""Use blog post test to test user permissions logic"""
import frappe
import frappe.defaults
import unittest
import frappe.model.meta
from frappe.permissions import (add_user_permission, remove_user_permission,
clear_u... | mhbu50/frappe | frappe/tests/test_permissions.py | Python | mit | 19,796 |
import itertools
import os
import scipy
import struct
from pybrain.datasets import SupervisedDataSet
def labels(filename):
fp = file(filename)
magicnumber, length = struct.unpack('>ii', fp.read(8))
assert magicnumber in (2049, 2051), ("Not an MNIST file: %i" % magicnumber)
for _ in xrange(length):
... | hassaanm/stock-trading | src/pybrain/tools/datasets/mnist.py | Python | apache-2.0 | 1,906 |
# vi: ts=4 expandtab
#
# Copyright (C) 2012 Yahoo! 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... | yahoo/Image-Builder | builder/downloader/tar_ball.py | Python | apache-2.0 | 2,868 |
from gi.repository import Gtk
class ChannelWindow:
def __init__(self, sources, client_thread):
self.sources = sources
self.client_thread = client_thread
self.changes = {}
self.widgets = {}
self.gtkwin = Gtk.Window()
self.gtkwin.set_position(Gtk.WindowPosition.CENTER)
self.gtkwin.set_default_size(320,... | krzotr/kismon | kismon/windows/channel.py | Python | bsd-3-clause | 3,856 |
import pf
import epf
####################
f = epf.EuclidField(
(50, 50), # width x height
(7, 14), # goal
[ # obstacles
(9, 5),
(10, 4),
(10, 5),
(10, 6),
(11, 5),
(9, 15),
(10, 14),
(10, 15),
(10, 16),
(11, 15)... | z-rui/pf | example.py | Python | bsd-2-clause | 564 |
""" User factory """
import factory
from smserver import models
from test.factories import base
from test.factories.room_factory import RoomFactory
class UserFactory(base.BaseFactory):
""" Classic user name """
class Meta(base.BaseMeta):
model = models.User
name = factory.Sequence(lambda n: "Us... | Nickito12/stepmania-server | test/factories/user_factory.py | Python | mit | 1,150 |
"""Bika's browser views are based on this one, for a nice set of utilities.
"""
from dependencies.dependency import DateTime, safelocaltime
from dependencies.dependency import DateTimeError
from dependencies.dependency import getToolByName
from dependencies.dependency import ClassSecurityInfo
from dependencies.dependen... | yasir1brahim/OLiMS | lims/browser/__init__.py | Python | agpl-3.0 | 6,746 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy as np
INCLUDE_BLAS = '/usr/include/atlas'
LIB_BLAS = '/usr/lib/atlas-base/atlas'
LIBS = 'blas'
# for windows
#INCLUDE_BLAS = 'C:\OpenBLAS\include'
#LIB_BLAS = 'C:\OpenBLAS\lib'
#LIBS = 'libopenb... | nicococo/AdaScreen | adascreen/setup.py | Python | mit | 1,699 |
from collections import defaultdict
from changes.api.serializer import Crumbler, register
from changes.models.jobplan import JobPlan
from changes.models.jobstep import JobStep
@register(JobStep)
class JobStepCrumbler(Crumbler):
def get_extra_attrs_from_db(self, item_list):
result = {}
job_id_to_s... | dropbox/changes | changes/api/serializer/models/jobstep.py | Python | apache-2.0 | 1,772 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pigame.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | MoonCheesez/stack | PiGame/pigame/manage.py | Python | mit | 804 |
# coding=utf-8
import os
import hashlib
import logging
from google.appengine.ext import db
from google.appengine.api import memcache
from v2ex.babel.ext.cookies import Cookies
def CheckAuth(handler):
ip = GetIP(handler)
cookies = handler.request.cookies
if 'auth' in cookies:
auth = cookies['auth... | selboo/v2ex | v2ex/babel/security/__init__.py | Python | bsd-3-clause | 1,770 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'xml/login.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):... | isbm/pybug | ui/_login.py | Python | mit | 4,202 |
import sys
from django import http
from django.core import signals
from django.utils.encoding import force_unicode
from django.utils.importlib import import_module
from django.utils.log import getLogger
logger = getLogger('django.request')
class BaseHandler(object):
# Changes that are always applied to a respon... | thiriel/maps | venv/lib/python2.7/site-packages/django/core/handlers/base.py | Python | bsd-3-clause | 11,887 |
#import matplotlib
#matplotlib.use("Agg")
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.lines as lines
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
from pprint import pprint
import sys
import json
from random import randint
def main():
if len(sys.argv) < 2:
print 'you n... | Ircam-RnD/xmm-soundworks-template | bin/plotSet.py | Python | gpl-3.0 | 1,148 |
#!/usr/bin/env python3
from argparse import ArgumentParser, RawTextHelpFormatter
from datetime import datetime
import sys, platform
parser = ArgumentParser(description="""
Generate .geo file for Gmsh to generate a mesh on the unit square.
The settings are suitable for solving the Stokes flow problem in a
lid-driven c... | bueler/p4pdes | python/ch14/lidbox.py | Python | mit | 2,960 |
import requests
import json
from requests.exceptions import ConnectionError
from django.shortcuts import render
from django.http import JsonResponse, HttpResponse, Http404
from django.views.decorators.csrf import csrf_exempt, csrf_protect
from tworaven_apps.rook_services.models import TestCallCapture
from tworaven_app... | vjdorazio/TwoRavens | tworaven_apps/rook_services/views.py | Python | bsd-3-clause | 5,412 |
import logging
import argparse
import realtimewebui.config
import os
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
parser = argparse.ArgumentParser()
parser.add_argument("--webPort", type=int, default=6001)
parser.add_argument("--webSocketPort", type=int, defa... | eliran-stratoscale/rackattack-physical-dashboard | py/rackattack/dashboard/main.py | Python | apache-2.0 | 2,588 |
from __future__ import absolute_import, division, print_function
import operator
def weight(items, **kwargs):
if not len(kwargs):
raise ValueError('Missing attribute for weighting items!')
scaled = []
for attr, weight in kwargs.items():
values = [float(getattr(item, attr)) for item in ite... | lensacom/satyr | mentor/binpack.py | Python | apache-2.0 | 3,414 |
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2017 Stanford University and the Authors
#
# Authors: Robert McGibbon
# Contributors:
#
# MDTraj is free software: y... | leeping/mdtraj | tests/test_reporter.py | Python | lgpl-2.1 | 7,439 |
from __future__ import print_function, division
import os
import sys
root = os.getcwd().split("MAR")[0] + "MAR/src/util"
sys.path.append(root)
from flask import Flask, url_for, render_template, request, jsonify, Response, json
from pdb import set_trace
from mar import MAR
app = Flask(__name__,static_url_path='/stat... | ai-se/MAR | src/index.py | Python | mit | 2,658 |
#!/usr/bin/python -Es
#
# libocispec - a C library for parsing OCI spec files.
#
# Copyright (C) 2017, 2019 Giuseppe Scrivano <giuseppe@scrivano.org>
# libocispec 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... | giuseppe/libocispec | src/generate.py | Python | gpl-3.0 | 27,790 |
PLUGIN_NAME = 'MusicBee Compatibility'
PLUGIN_AUTHOR = 'Volker Zell (and Sophist)'
PLUGIN_DESCRIPTION = '''
Provide MusicBee compatible tags.
<br/><br/>
Note 1: The tags used by this plugin are only populated when you have
checked Options / Metadata / Use track relationships.
<br/>
Note 2: You may wish to use this with... | Sophist-UK/sophist-picard-plugins | musicbee_compatibility.py | Python | gpl-2.0 | 5,299 |
# Copyright 2020 The Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | google-research/sam | sam_jax/models/pyramidnet.py | Python | apache-2.0 | 9,092 |
''' Module '''
import re
import logging
class CurrentCost:
''' Class '''
'''
def __init__(self, data=None, logger=None):
''' Method '''
self._data = data
self.logger = logger or logging.getLogger(__name__)
self.time = None
self.uid = None
self.value = None
'''... | gljohn/meterd | meterd/parser/currentcost.py | Python | gpl-3.0 | 1,012 |
"""
This file provides api for retrieving data from codeforces.com
"""
import hashlib
import json
import operator
import random
import time
from collections import OrderedDict
from enum import Enum
from urllib.error import HTTPError
from urllib.request import urlopen
from .json_objects import Contest
from .json_objec... | soon/CodeforcesAPI | codeforces/api/codeforces_api.py | Python | mit | 16,753 |
import gc
import hashlib
import os
import os.path
import tempfile
import zipfile
import numpy as np
import pytest
import requests
from hyperspy import signals
from hyperspy.io import load
MY_PATH = os.path.dirname(__file__)
ZIPF = os.path.join(MY_PATH, "edax_files.zip")
TMP_DIR = tempfile.TemporaryDirectory()
TEST_F... | thomasaarholt/hyperspy | hyperspy/tests/io/test_edax.py | Python | gpl-3.0 | 19,779 |
# coding=utf-8
from django.http import HttpResponse, Http404
from django.shortcuts import loader
import json
from pmtour.models import Tournament, Player
def get_tour(tour_id):
try:
tour = Tournament.objects.get(alias=tour_id)
except Tournament.DoesNotExist:
try:
tour = Tournament.... | sunoru/pokemon_tournament | pmtour/views/utils.py | Python | mit | 3,347 |
__author__ = 'Paolo Bellagente'
# Documentation for this module.
#
# More details.
################################## DATABASE ##############################################
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, sessionmaker
impor... | mpescimoro/stripp3r | lessonEntity.py | Python | gpl-3.0 | 1,603 |
import math
import numpy as np
import os
# checks if the directory where the file will be written does exist
################################################################################
def ensure_dir(f):
d = os.path.dirname(f)
if not os.path.exists(d):
os.makedirs(d)
# Gives an array of 3d vectors for su... | chjost/analysis-code | analysis/zeta/create_momentum_array.py | Python | gpl-3.0 | 2,134 |
"""
EvMenu
This implements a full menu system for Evennia. It is considerably
more flexible than the older contrib/menusystem.py and also uses
menu plugin modules.
To start the menu, just import the EvMenu class from this module.
Example usage:
```python
from evennia.utils.evmenu import EvMenu
EvMenu(calle... | titeuf87/evennia | evennia/utils/evmenu.py | Python | bsd-3-clause | 39,605 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorflow | tensorflow/python/data/kernel_tests/tf_record_dataset_test.py | Python | apache-2.0 | 10,543 |
from django.shortcuts import render
from django.shortcuts import render
from django.views.generic import ListView, DetailView, UpdateView, CreateView
from braces.views import LoginRequiredMixin, GroupRequiredMixin
from .models import Indicator, Parameter, MainIndicator
from dj... | rlaverde/scorecard_cps | performance_indicators_project/indicators/views.py | Python | gpl-3.0 | 1,983 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2022 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | gem/oq-engine | openquake/hazardlib/gsim/abrahamson_silva_1997.py | Python | agpl-3.0 | 10,993 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# This file is part of the NNGT project to generate and analyze
# neuronal networks and their activity.
# Copyright (C) 2015-2019 Tanguy Fardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... | Silmathoron/NNGT | nngt/core/connections.py | Python | gpl-3.0 | 11,420 |
# Copyright (C) 2010 Canonical
#
# Authors:
# Michael Vogt
#
# 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; version 3.
#
# This program is distributed in the hope that it will be useful, but W... | sti-lyneos/shop | softwarecenter/db/pkginfo.py | Python | lgpl-3.0 | 6,602 |
# Always prefer setuptools over distutils
from setuptools import setup
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_descri... | lfzark/pygalib | setup.py | Python | mit | 1,800 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
r"""Example of Synced sequence input and output.
This is a reimpmentation of the TensorFlow official PTB example in :
tensorflow/models/rnn/ptb
The batch_size can be seem as how many concurrent computations.\n
As the following example shows, the first batch learn the sequenc... | zsdonghao/tensorlayer | examples/text_ptb/tutorial_ptb_lstm.py | Python | apache-2.0 | 20,514 |
import math
from src.course4.week3.tsp_nearest_neighbor import traveling_salesman_problem
def test_tsp_50_cities():
points = []
with open('src/course4/week3_nn.txt') as handle:
handle.readline()
n = 0
for line in handle:
index, x, y = line.split()
points.appen... | manoldonev/algo1-assignments | src/course4/week3/tests/test_tsp_nearest_neighbor.py | Python | mit | 1,299 |
"""Test the search module"""
from collections import Iterable, Sized
from sklearn.externals.six.moves import cStringIO as StringIO
from sklearn.externals.six.moves import xrange
from sklearn.externals.joblib._compat import PY3_OR_LATER
from itertools import chain, product
import pickle
import sys
import numpy as np
i... | rishikksh20/scikit-learn | sklearn/model_selection/tests/test_search.py | Python | bsd-3-clause | 51,803 |
n=int(input())
for i in range(n):
a=input()
a=a.split(" ")
a[0]="{0:0=2d}".format(int(a[0]))
a[1]="{0:0=2d}".format(int(a[1]))
if a[2]=="1":
print(a[0]+":"+a[1]+" - A porta abriu!")
else:
print(a[0]+":"+a[1]+" - A porta fechou!")
| h31nr1ch/Mirrors | c/OtherProblems/pepeJaTireiAVela-2152.py | Python | gpl-3.0 | 270 |
'''
Created on 29.07.2013
@author: mhoyer
'''
from mysqldb import MysqlDB
from local_system import LocalSystem
from remote_system import RemoteSystem
from entities import Application
import logging
import util
class Actionmanager():
'''
classdocs
'''
def __init__(self, config):
self.logger = ... | marco-hoyer/replicator | src/main/python/replicator/actionmanager.py | Python | gpl-2.0 | 6,373 |
"""
Unit tests for resdk/resources/data.py file.
"""
import unittest
from mock import MagicMock, patch
from resdk.resources.data import Data
from resdk.resources.descriptor import DescriptorSchema
from resdk.resources.process import Process
class TestData(unittest.TestCase):
def test_sample(self):
data... | genialis/resolwe-bio-py | tests/unit/test_data.py | Python | apache-2.0 | 7,918 |
import datetime
import hashlib
import random
import re
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.db import models
from django.db import transaction
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
try:
... | austinhappel/django-registration | registration/models.py | Python | bsd-3-clause | 10,586 |
import urllib
from zerver.lib.test_classes import WebhookTestCase
class TravisHookTests(WebhookTestCase):
STREAM_NAME = 'travis'
URL_TEMPLATE = "/api/v1/external/travis?stream={stream}&api_key={api_key}"
FIXTURE_DIR_NAME = 'travis'
TOPIC = 'builds'
def test_travis_message(self) -> None:
... | showell/zulip | zerver/webhooks/travis/tests.py | Python | apache-2.0 | 2,291 |
# manage.py
import os
import unittest
import coverage
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
COV = coverage.coverage(
branch=True,
include='project/*',
omit=[
'project/tests/*',
'project/server/config.py',
'project/server/*/__init__.py'... | kangusrm/XMLFeed | manage.py | Python | mit | 1,869 |
# Copyright 2012 Viewfinder Inc. All Rights Reserved.
"""Handlers for server-side data table paging for administration pages.
These handlers are designed to work with the jQuery Datatable plugin (http://datatables.net/)
"""
__author__ = 'matt@emailscrubbed.com (Matt Tracy)'
import base64
import json
import logging
... | 0359xiaodong/viewfinder | backend/www/admin/data_table.py | Python | apache-2.0 | 3,239 |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 12 11:50:27 2019
@author: Eoin Elliott
A module for easy access to example data for testing analysis codes.
Numpy files are loaded here
access the data by
nplab.analysis.example_data.SERS_and_shifts
for example.
"""
import numpy as np
import os
# Example SERS spe... | nanophotonics/nplab | nplab/analysis/example_data/__init__.py | Python | gpl-3.0 | 467 |
from behave import *
from nose.tools import assert_in
from webium.driver import get_driver
import pages
PAGES_MAP = {
'Main': pages.MainPage,
'Login': pages.LoginPage,
}
@when("I open {page_name} page")
@step("I am on {page_name} page")
def step_impl(context, page_name):
context.page_name = page_name
... | ShinKaiRyuu/Python-testing-template | features/steps/navigation_steps.py | Python | mit | 721 |
from django.shortcuts import render_to_response
from django.http import HttpResponse
# Create your views here.
def index(request):
return render_to_response('index.html') | kostya9/KPI.RelationalDatabases | Lab3/flights/core/views.py | Python | mit | 176 |
# Autor: Alexander Herbrich
# Wann: 03.02.2016
# Thema: Programm zum loesen des magischen Quadrats erstellen
def quadrat():
# DIESES PRORAMM ENTHAELT NOCH FEHLER!!!!!
# A + B + C = S
# D + M + d = S
# a + b + c = S
# A + D + a = S
# B + M + b = S
# C + d + c = S
# A + M + c = S
# C + M + a =... | rherbrich74/FirstPythonSteps | Quadrat.py | Python | apache-2.0 | 2,362 |
# Higgins - A multi-media server
# Copyright (c) 2007-2009 Michael Frank <msfrank@syntaxjockey.com>
#
# This program is free software; for license information see
# the COPYING file.
import random, string, urllib
from twisted.internet.defer import maybeDeferred
from xml.etree.ElementTree import Element, SubElement
fr... | msfrank/Higgins | higgins/upnp/device.py | Python | lgpl-2.1 | 4,547 |
"""
Copyright (c) 2007-2008, Dj Gilcrease
All rights reserved.
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, me... | Ixxy-Open-Source/django-cron | django_cron/__init__.py | Python | mit | 2,868 |
#Copyright 2010, Meka Robotics
#All rights reserved.
#http://mekabot.com
#Redistribution and use in source and binary forms, with or without
#modification, are permitted.
#THIS SOFTWARE IS PROVIDED BY THE Copyright HOLDERS AND CONTRIBUTORS
#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#LIMITED... | CentralLabFacilities/m3meka | python/scripts/m3qa/config_arm_a2r1.py | Python | mit | 38,774 |
import time
import copy
from re import compile as regex
from tek.tools import decode
from tek.errors import InternalError, InvalidInput, MooException
from tek.io.terminal import terminal, ColorString
class UserInputTerminated(MooException):
pass
class InputQueue(list):
delay = None
force_output = False... | tek/pytek | tek/user_input.py | Python | gpl-3.0 | 11,203 |
#@help:history {show|clear} - Scans for open ports on the specified device.
from game.pythonapi import PyDisplay
try:
parameters
except NameError:
PyDisplay.write(terminal, 'Please specify either show or clear.')
else:
if parameters[0] == 'clear':
terminal.getHistory().clear()
terminal.setLine(0)
else:
hist... | Rsgm/Hakd | core/assets/python/programs/rsgm/history.py | Python | mit | 458 |
# -*- coding: UTF-8 -*-
from django.views.generic.base import TemplateView
from django_simptools.shortcuts import create_paginated_page
from payway.orders.conf.settings import ORDERS_PER_PAGE
from payway.orders.models import Order
__author__ = 'Razzhivin Alexander'
__email__ = 'admin@httpbots.com'
class OrderListVie... | RANUX/django-payway | payway/orders/views/list.py | Python | bsd-2-clause | 723 |
#! python 3
""" Initiliases server defaults. """
from application import db
from application.models import User, Group
from application.functions import hash_password
from config import admin_username, admin_name, admin_password, admin_email, admin_group_name
# create admin user
# make sure the user hasn't already b... | evereux/flask_template | setup.py | Python | mit | 1,584 |
from hazelcast.serialization.bits import *
from hazelcast.protocol.builtin import FixSizedTypesCodec
from hazelcast.protocol.client_message import OutboundMessage, REQUEST_HEADER_SIZE, create_initial_buffer, RESPONSE_HEADER_SIZE
from hazelcast.protocol.builtin import StringCodec
from hazelcast.protocol.builtin import D... | hazelcast/hazelcast-python-client | hazelcast/protocol/codec/multi_map_try_lock_codec.py | Python | apache-2.0 | 1,548 |
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2013 YAMAMOTO Takashi <yamamoto at valinux co jp>
#
# 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... | o3project/ryu-oe | ryu/ofproto/oxm_fields.py | Python | apache-2.0 | 12,359 |
""" Unused so far"""
class InlineIMG():
def __init__(self, path):
self.path = path
self.is_local = False
self.id = abs(hash(self.path))
self.name = self.id
self.mime_object = self.makeMIME()
self.html_node = self.html_node()
def __repr__(self):
""" The... | bussiere/yagmail | yagmail/image.py | Python | mit | 1,180 |
"""
Markdown-online
Put your local markdowns online.
"""
from setuptools import setup, find_packages
setup(
name='mdonline',
version='0.1',
long_description=__doc__,
packages=find_packages(), # packages=['application'],
include_package_data=True, # look for a MANIFEST.in file
zip_safe=False,
... | fengsp/markdown-online | setup.py | Python | bsd-3-clause | 495 |
# coding: utf-8
from jumpserver.context_processor import default_interface
from django.conf import settings
class ObjectDict(dict):
def __getattr__(self, name):
if name in self:
return self[name]
else:
raise AttributeError("No such attribute: " + name)
def __setattr__(... | jumpserver/jumpserver | apps/settings/utils/common.py | Python | gpl-3.0 | 806 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from os.path import abspath, basename, dirname, join, normpath
from sys import path
########## PATH CONFIGURATION
# Absolute filesystem path to the Django project directory:
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# Absolute filesystem path to... | pythonvlc/workshop-deploying-django | coffeecake/coffeecake/settings/base.py | Python | mit | 8,345 |
from . import vec3_socket
from . import matrix_socket
from . import stereo_mode_socket
from . import camera_socket
from . import screen_socket
from . import avango_node_socket
def register():
# register sockets
vec3_socket.register()
matrix_socket.register()
stereo_mode_socket.register()
camera_so... | jakobharlan/avango | avango-blender/blender-addon/sockets/__init__.py | Python | lgpl-3.0 | 613 |
# Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or ht... | stepancheg/rust-ide-rust | src/etc/licenseck.py | Python | apache-2.0 | 2,653 |
import transmission
import matplotlib.pyplot as plt, numpy as np
from astropy.io import ascii
files = ['wasp94_140801.obs', 'wasp94_140805.obs', 'wasp94_140809.obs']
toshow = ['k']
# an empty dictionary of observations
spectra = {}
# an empty dictionary of bins (which will each contain a list of spectra)
bins = {}
#... | zkbt/mosasaurus | junk/combine.py | Python | mit | 2,521 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""Miscellaneous functions
"""
import numpy as np
from ..ext.six import string_types
###############################################################################
# Thes... | bollu/vispy | vispy/geometry/calculations.py | Python | bsd-3-clause | 4,276 |
# Awn Applet Library - Simplified APIs for programming applets for Awn.
#
# Copyright (C) 2007 - 2008 Pavel Panchekha <pavpanchekha@gmail.com>
# 2008 - 2010 onox <denkpadje@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public ... | p12tic/awn-extras | shared/python/awnlib.py | Python | gpl-2.0 | 54,312 |
##########################################################################
#
# Copyright 2012-2015 VMware, Inc.
# All Rights Reserved.
#
# 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 withou... | schulmar/apitrace | specs/dxva2.py | Python | mit | 19,676 |
"""
A number of Cocoa API's have a 'context' argument that is a plain 'void*'
in ObjC, and an Integer value in Python. The 'context' object defined here
allows you to get a unique integer number that can be used as the context
argument for any Python object, and retrieve that object later on using the
context number.
... | albertz/music-player | mac/pyobjc-core/Lib/objc/_context.py | Python | bsd-2-clause | 1,283 |
# -*- coding: utf-8 -*-
"""
This file is part of SimpleFSM.
SimpleFSM is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SimpleFSM is ... | lliendo/SimpleFSM | simplefsm/__init__.py | Python | lgpl-3.0 | 8,624 |
#!/usr/bin/python
import sys
def word_count():
#lines_words = []
new_list = []
file = sys.argv[1]
my_dict = {}
# try:
fh = open(file,'r')
for lines in fh:
#print lines
lines = lines.strip()
#lines = lines.lower()
words = lines.split()
for word in words:
my_dict[word] = my_dict.get(word, 0) + 1
lines... | hiteshagrawal/python | info/bkcom/pack.py | Python | gpl-2.0 | 626 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This file is part of XBMC Mega Pack Addon.
Copyright (C) 2014 Wolverine (xbmcmegapack@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 Softwar... | xbmcmegapack/plugin.video.megapack.dev | resources/lib/menus/home_languages_breton.py | Python | gpl-3.0 | 1,109 |
ConnectionError = None
| vsquare95/JiyuuBot | dummympd.py | Python | gpl-3.0 | 23 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def HostPlugStoreTopologyPath(vim, *args, **kwargs):
'''This data object type is an assoc... | xuru/pyvisdk | pyvisdk/do/host_plug_store_topology_path.py | Python | mit | 1,194 |
import scipy.stats as ss
import numpy as np
#import statsmodels.api as sm
### Tests on residuals
def normal_Kolmogorov_Smirnov(sample):
"""The moon illumination expressed as a percentage.
:param astropy sun: the sun ephemeris
:param astropy moon: the moon ephemeris
... | ebachelet/pyLIMA | pyLIMA/microlstats.py | Python | gpl-3.0 | 4,184 |
# Generated by Django 2.2.13 on 2020-08-20 14:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tasks', '0029_sites_blank'),
]
operations = [
migrations.AddField(
model_name='task',
name='available',
... | rdmorganiser/rdmo | rdmo/tasks/migrations/0030_available.py | Python | apache-2.0 | 484 |
from __future__ import print_function
import os
import re
def get_version():
node_version_h = os.path.join(
os.path.dirname(__file__),
'..',
'src',
'node_version.h')
f = open(node_version_h)
regex = '^#define NODE_MODULE_VERSION [0-9]+'
for line in f:
if re.match(regex, line):
majo... | MTASZTAKI/ApertusVR | plugins/languageAPI/jsAPI/3rdParty/nodejs/10.1.0/source/tools/getmoduleversion.py | Python | mit | 477 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-07-07 14:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('salt_observer', '0005_auto_20160615_1439'),
]
operations = [
migrations.Remo... | hs-hannover/salt-observer | salt_observer/migrations/0006_auto_20160707_1629.py | Python | mit | 554 |
"""Modulo que contiene la clase directorio de funciones
-----------------------------------------------------------------
Compilers Design Project
Tec de Monterrey
Julio Cesar Aguilar Villanueva A01152537
Jose Fernando Davila Orta A00999281
-----------------------------------------------------------------
DOCUM... | davilajose23/ProjectCobra | functions_dir.py | Python | mit | 10,907 |
# Copyright (c) 2016 NEC 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... | openstack/neutron-lib | neutron_lib/api/definitions/l2_adjacency.py | Python | apache-2.0 | 1,334 |
from __future__ import unicode_literals
from django.apps import AppConfig
class D4S2ApiV1Config(AppConfig):
name = 'd4s2_api_v1'
| Duke-GCB/DukeDSHandoverService | d4s2_api_v1/apps.py | Python | mit | 136 |
"""
En este modulo se encuentran definida el decorador encargado de comprobar en
las vistas de la aplicacion que el usuario que intenta acceder a la vista, esta
logueado y tiene los permisos de superusuario.
"""
__author__ = 'llerena'
| jmllerena/django-easydata | easydata/decorators/__init__.py | Python | gpl-3.0 | 236 |
#!/usr/bin/env python3
def parse_file(filename):
amino_acids=[]
for line in open(filename):
name, pk1, pk2, pk3 = line.strip().split()
if pk3=="na":
amino_acids.append((name, float(pk1),float(pk2)))
else:
amino_acids.append((name, float(pk1),float(pk2), float(pk3... | Bolt64/my_code | Code Snippets/amino_acid.py | Python | mit | 870 |
# -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... | ARMmbed/yotta_osx_installer | workspace/lib/python2.7/site-packages/github/GithubObject.py | Python | apache-2.0 | 9,896 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2019, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | mrcslws/nupic.research | projects/archive/dynamic_sparse/runs/run_test_mlflow.py | Python | agpl-3.0 | 2,172 |
#
#
# This example shows the diffraction by a Si 111 crystal calculated in a variety of modes (see main):
#
# - make_plots( calculate_standard_interface() )
# using the standard interface via definition of a photon grid (DiffractionSetupSweeps) and
# the DiffractionResult object
#
# - calculate_with_co... | edocappelli/crystalpy | crystalpy/examples/Si111.py | Python | mit | 15,040 |
# -*- coding:utf_8 -*-
from datetime import date
import sys
import Bilibili, Youku, Iqiyi, PPTV, AcFun
import Tools
class CLIApp:
def __init__(self, keywords):
self.errorCount = 0
self.bilibili = Bilibili.BiliBili()
self.acfun = AcFun.AcFun()
self.pptv = PPTV.PPTV()
self.iq... | MrWhoami/WhoamiBangumi | cli.py | Python | mit | 3,577 |
import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-access-dev-stat',
version='0.1',
packages=['access... | yijingping/django-access-dev-stat | setup.py | Python | bsd-3-clause | 1,182 |
from skybeard.utils import setup_beard
setup_beard("dicebeard")
| nasfarley88/dicebeard | setup_beard.py | Python | unlicense | 65 |
import blaze
import numpy as np
import unittest
class TestDatashapeCreation(unittest.TestCase):
def test_raise_on_bad_input(self):
# Make sure it raises exceptions on a few nonsense inputs
self.assertRaises(TypeError, blaze.dshape, None)
self.assertRaises(TypeError, blaze.dshape, lambda x:... | seibert/blaze-core | blaze/tests/test_datashape_creation.py | Python | bsd-2-clause | 2,553 |
from django.apps import AppConfig
class StudentConfig(AppConfig):
name = 'student'
| jianghc724/HappyXueTang | student/apps.py | Python | gpl-3.0 | 89 |
#!/usr/bin/env python
from django.conf import settings
from opencontext_py.libs.general import LastUpdatedOrderedDict
class Languages():
""" Useful methods for Open Context interacctions
with other APIs
"""
DEFAULT_LANGUAGE = 'en' # defaulting to English
DEFAULT_SCRIPT = 'la' # defulting to... | ekansa/open-context-py | opencontext_py/libs/languages.py | Python | gpl-3.0 | 6,689 |
import re
import sys
import time
import numpy
import pprint
provideTimeByServer = dict()
inaugurationTimes = list()
inaugurationTimeByServer = dict()
errornousLines = list()
suspiciousInaugurationTimes = list()
lineCounter = 0
prevMonth = ""
hasYearPassed = False
def parseTime(timeStr):
global hasYearPassed, pr... | Stratoscale/rackattack-physical | racktools/calc-average-inauguration-time.py | Python | apache-2.0 | 2,686 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.