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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# Copyright (C) 2011 Google Inc. 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 list ... | cs-au-dk/Artemis | WebKit/Tools/Scripts/webkitpy/layout_tests/servers/http_server_base.py | Python | gpl-3.0 | 8,410 |
#!/usr/bin/env python2
'''
Simple monitoring script to collect per process cpu percentage
and mem usage in bytes (vms or virt and rss)
usage:
cron-send-cpu-mem-stats process_name openshift.whatever.zabbix.key
or
cron-send-cpu-mem-stats 'something parameter more params' openshift.something.parameter.mo... | ivanhorvath/openshift-tools | scripts/monitoring/cron-send-cpu-mem-stats.py | Python | apache-2.0 | 3,773 |
# Outspline - A highly modular and extensible outliner.
# Copyright (C) 2011-2014 Dario Giovannetti <dev@dariogiovannetti.net>
#
# This file is part of Outspline.
#
# Outspline 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 Softw... | xguse/outspline | src/outspline/conf/core.py | Python | gpl-3.0 | 1,547 |
from django.db import connection, models
from south.db import generic
class DatabaseOperations(generic.DatabaseOperations):
"""
PsycoPG2 implementation of database operations.
"""
backend_name = "postgres"
def rename_column(self, table_name, old, new):
if old == new:
ret... | wahaha02/myblog | south/db/postgresql_psycopg2.py | Python | bsd-3-clause | 2,521 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Midokura Japan K.K.
#
# 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... | rcbops/nova-buildpackage | nova/api/openstack/compute/contrib/server_start_stop.py | Python | apache-2.0 | 2,721 |
"""
.. _ex-publication-figure:
===================================
Make figures more publication ready
===================================
In this example, we show several use cases to take MNE plots and
customize them for a more publication-ready look.
"""
# Authors: Eric Larson <larson.eric.d@gmail.com>
# ... | olafhauk/mne-python | examples/visualization/plot_publication_figure.py | Python | bsd-3-clause | 11,270 |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | our-city-app/oca-backend | src-generator/generator/custom/objc_filters.py | Python | apache-2.0 | 7,376 |
from django.apps import AppConfig
from django.contrib.auth.signals import user_logged_out
from django.db.models.signals import post_save
class TrackingConfig(AppConfig):
name = 'tracking'
verbose_name = 'django-tracking2'
def ready(self):
from tracking import handlers
from tracking.model... | bruth/django-tracking2 | tracking/apps.py | Python | bsd-2-clause | 467 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2013 Canonical
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
"""libautopilot-qt autopilot t... | uglide/autopilot-qt | tests/autopilot/libautopilot_qt/__init__.py | Python | gpl-3.0 | 349 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#******************************************************************************
# $Id$
#
# Project: GDAL
# Purpose: Application for Google web service authentication.
# Author: Frank Warmerdam, warmerdam@pobox.com
#
#***********************************************... | tilemapjp/OSGeo.GDAL.Xamarin | gdal-1.11.0/swig/python/scripts/gdal_auth.py | Python | mit | 4,264 |
import os
import sys
import imp
import logging
from collections import namedtuple
"""
Objects used to configure Glue at runtime.
"""
__all__ = ['Registry', 'SettingRegistry', 'ExporterRegistry',
'ColormapRegistry', 'DataFactoryRegistry', 'QtClientRegistry',
'LinkFunctionRegistry', 'LinkHelperRegi... | bsipocz/glue | glue/config.py | Python | bsd-3-clause | 11,375 |
import unittest
from Assembly import Assembly
from Parser.ParserContext import ParseException
from Attribute import Attribute
class AssemblyParser(object):
def __init__(self):
pass
def parse(self, parserContext):
assembly = Assembly()
token = parserContext.get_next_to... | martydill/PyCIL | src/Parser/AssemblyParser.py | Python | bsd-2-clause | 3,623 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Module Writen to Odoo, Open Source Management Solution
#
# Copyright (C) 2013 Obertix Free Solutions (<http://obertix.net>).
# cubells <info@obertix.net>
#
# All Rights ... | cubells/odoo-addons | search_by_date/wizard/__init__.py | Python | agpl-3.0 | 1,120 |
import pysal.lib as lp
from pysal.lib import examples
import geopandas as gpd
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
from pysal.viz.splot.mapping import (value_by_alpha_cmap,
vba_choropleth,
mapclassify_bin,
... | lixun910/pysal | pysal/viz/splot/tests/test_viz_value_by_alpha_mapl.py | Python | bsd-3-clause | 3,191 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
:Author: Bastian Knippschild (B.Knippschild@gmx.de)
:Date: October 2014
Copyright (C) 2014 Bastian Knippschild
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
Fo... | martin-ueding/LueschersZetaFunction | zeta.py | Python | gpl-3.0 | 10,459 |
#!/usr/bin/env python
from json import loads
from decimal import Decimal
from struct import pack
def fix(n, m = 1):
return long(Decimal(n) * Decimal(m) * 10**18)
def unfix(n):
return n // 10**18
def stringToBytes(value):
return value.ljust(32, '\x00')
def longTo32Bytes(value):
return pack(">l", val... | redsquirrel/augur-core | tests/utils.py | Python | gpl-3.0 | 997 |
#! /usr/bin/env python
# -*- coding: UTF8 -*-
"""
############################################################
Criação de slots para a matéria de psicologia geral
############################################################
:Author: *Carlo E. T. Oliveira*
:Contact: carlo@nce.ufrj.br
:Date: $Date: 2017/06/23 $
:Status... | cetoli/draft | src/activmech/fonoslots.py | Python | gpl-2.0 | 8,148 |
"""
Server startstop hooks
This module contains functions called by Evennia at various
points during its startup, reload and shutdown sequence. It
allows for customizing the server operation as desired.
This module must contain at least these global functions:
at_server_start()
at_server_stop()
at_server_reload_star... | ccubed/EvenniaGames | FSuns/server/conf/at_server_startstop.py | Python | mit | 1,329 |
from django.contrib import admin
from django.utils.safestring import mark_safe
from .models import OrganizerType
class ParticipantAdminMixin(object):
def linked_target(self, organizer):
if not organizer.content_object:
return None
return mark_safe(
'<a href="%s">%s</a>' %... | 596acres/django-livinglots-organize | livinglots_organize/admin.py | Python | agpl-3.0 | 1,358 |
from sklearn.externals import joblib
import time
from . import folder_name
class ClassifierLoader(object):
"""Handles saving and loading of trained classifiers transparently."""
def __init__(self):
super(ClassifierLoader, self).__init__()
def dump_object(self, obj, classifier, category="", **kwar... | peret/visualize-bovw | util/classifierloader.py | Python | gpl-2.0 | 1,518 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | KaranToor/MA450 | google-cloud-sdk/lib/googlecloudsdk/third_party/appengine/googlecron/GrocParser.py | Python | apache-2.0 | 45,082 |
from __future__ import unicode_literals
from django.db import models
class Artist(models.Model):
first_name = models.CharField(max_length=200)
last_name = models.CharField(max_length=200)
bio = models.TextField(null=True, blank=True)
email_address = models.EmailField()
created = models.DateTimeFi... | highsineburgh/gallery_api | gallery_api/gallery/models.py | Python | gpl-3.0 | 1,130 |
#!/usr/bin/env python
# encoding: utf-8
"""
setup.py
Created by Cody Brocious on 2006-12-21.
Copyright (c) 2006 Falling Leaf Systems. All rights reserved.
"""
from distutils.core import setup
import py2app
setup(
app = ['Convert.py'],
options = dict(
py2app=dict(
argv_emulation=True
)
)
)
| callen/Alky-Reborn | Convertor/setup.py | Python | lgpl-3.0 | 303 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# ... | janusnic/dj-21v | unit_07/mysite/mysite/settings.py | Python | mit | 6,967 |
import nltk
import urllib
import json
import urllib2
from urllib import urlopen
from simplenlp import get_nl
from nltk.corpus import wordnet
import random
import sys
import string
import pickle
import readline
#this method replaces adjectives with a random synonym
def replace_adjectives_strip_pos(token):
if(token[1]... | natematias/the-synonym-machine | poetry_synonym_machine.py | Python | mit | 3,300 |
import sys
sys.path.insert(1, "../../../")
import h2o, tests
def binop_amp(ip,port):
iris = h2o.import_file(path=h2o.locate("smalldata/iris/iris_wheader_65_rows.csv"))
rows, cols = iris.dim
###################################################################
# LHS: scaler, RHS: H2OFrame
... | bospetersen/h2o-3 | h2o-py/tests/testdir_munging/binop/pyunit_binop2_amp.py | Python | apache-2.0 | 2,942 |
# Copyright 2013, Nachi Ueno, NTT I3, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | onecloud/neutron | neutron/services/vpn/service_drivers/__init__.py | Python | apache-2.0 | 3,066 |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool developed by AusAid -
**Zonal Stats.**
Contact : ole.moller.nielsen@gmail.com
.. note:: 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 Founda... | danylaksono/inasafe | safe_qgis/impact_statistics/zonal_stats.py | Python | gpl-3.0 | 21,354 |
#!/usr/bin/env python
__all__ = ['color', 'grayscale', 'sstv', 'tests', 'examples']
| dnet/pySSTV | pysstv/__init__.py | Python | mit | 85 |
#!/usr/bin/env python3
"""
Plot form factor.
"""
import bornagain as ba
from bornagain import nm, deg
import bornplot as bp
det = ba.SphericalDetector(200, 5*deg, 2.5*deg, 2.5*deg)
n = 4
results = []
for i in range(n):
theta = 30*i/(n - 1)
title = r'$\vartheta=%d^\circ$' % theta
ff = ba.FormFactorCone(4*nm... | gpospelov/BornAgain | Doc/FFCatalog/fig/ff2/sim_Cone.py | Python | gpl-3.0 | 503 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime as dt
import json
from django.test import TestCase, Client
from bs4 import BeautifulSoup as bs
from common.templatetags import common_tags as tags
from bulletins.models import BulletinEmail
class FilterTests(TestCase):
"""Tests for common/common_ta... | PhillyDSA/phillydsa-com | common/tests.py | Python | agpl-3.0 | 2,443 |
# This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
import unittest as ut
from h5py import h5p, h5f, ve... | h5py/h5py | h5py/tests/test_h5p.py | Python | bsd-3-clause | 6,042 |
# Copyright 2005 Duke University
# Copyright (C) 2012-2016 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later versio... | jsilhan/dnf | dnf/cli/cli.py | Python | gpl-2.0 | 39,626 |
# -*- coding: utf-8 -*-
import json
from django.contrib.auth import authenticate
from django.test import TestCase
from django.test.client import RequestFactory
from protoExt.views.protoSaveProtoObj import protoSaveProtoObj
from protoLib.tests.dataSetup import createAuthExt, MySession
from protoExt.views.protoGetPci ... | DarioGT/docker-carra | src/protoExt/tests/test_ProtoSaveProtoObj.py | Python | mit | 3,156 |
"""
Django settings for scheduler project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
... | anshulthakur/scheduler | scheduler/scheduler/settings.py | Python | gpl-2.0 | 2,820 |
"""Models for room meta information"""
import os
from os.path import exists, join
from django.db import models
from nav.models.profiles import Account
from nav.models.manage import Room
from nav.models.fields import VarcharField
from nav.path import localstatedir
ROOMIMAGEPATH = join(localstatedir, 'uploads', 'images'... | alexanderfefelov/nav | python/nav/models/roommeta.py | Python | gpl-2.0 | 1,361 |
# -*- coding: utf-8 -*-
"""Reload command."""
# Part of Clockwork MUD Server (https://github.com/whutch/cwmud)
# :copyright: (c) 2008 - 2017 Will Hutcheson
# :license: MIT (https://github.com/whutch/cwmud/blob/master/LICENSE.txt)
from .. import Command, COMMANDS
from ...channels import CHANNELS
from ...characters impo... | whutch/cwmud | cwmud/core/commands/admin/reload.py | Python | mit | 847 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-mgmt-web/azure/mgmt/web/models/virtual_network_profile.py | Python | mit | 1,489 |
# -*- coding: utf-8 -*-
import numpy as np
import cantera as ct
import pandas as pd
import re
import warnings
import copy
###################################
# 3b. output data analysis
###################################
def branching_ratios(df, solution, compound, production = False):
"""
This method looks at... | goldmanm/tools | analysis.py | Python | mit | 9,967 |
from ImportDependence import *
from CustomClass import *
class CIA(AppForm):
useddf=pd.DataFrame()
Lines = []
Tags = []
description = 'Chemical Index of Alteration'
unuseful = ['Name',
'Mineral',
'Author',
'DataType',
'Label',
... | chinageology/GeoPython | geopytool/CIA.py | Python | gpl-3.0 | 10,636 |
# This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
from h5py import h5
from .common import TestCase
d... | h5py/h5py | h5py/tests/test_h5.py | Python | bsd-3-clause | 1,216 |
#!/usr/bin/env python3
import sys
# import osgeo.utils.gdalchksum as a convenience to use as a script
from osgeo.utils.gdalchksum import * # noqa
from osgeo.utils.gdalchksum import main
from osgeo.gdal import deprecation_warn
deprecation_warn('gdalchksum', 'utils')
sys.exit(main(sys.argv))
| grueni75/GeoDiscoverer | Source/Platform/Target/Android/core/src/main/jni/gdal-3.2.1/swig/python/scripts/gdalchksum.py | Python | gpl-3.0 | 295 |
# minke.normalize
# Utilities and helpers for cleaning and normalizing text data.
#
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com>
# Created: Tue May 03 14:19:14 2016 -0400
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: normalize.py [978bbb0] benjamin@bengf... | bbengfort/minke | minke/normalize.py | Python | mit | 3,826 |
# Copyright 2014 Violin Memory, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | takeshineshiro/cinder | cinder/tests/unit/test_v6000_fcp.py | Python | apache-2.0 | 24,905 |
# -*- coding: utf-8 -*-
import time
from ..internal.MultiAccount import MultiAccount
class SimplydebridCom(MultiAccount):
__name__ = "SimplydebridCom"
__type__ = "account"
__version__ = "0.20"
__status__ = "testing"
__config__ = [("mh_mode", "all;listed;unlisted", "Filter hosters to use", "all"... | Arno-Nymous/pyload | module/plugins/accounts/SimplydebridCom.py | Python | gpl-3.0 | 1,693 |
"""
WSGI config for djangobook project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djangobook.settings")
from django.... | fenexomega/DjangoBookExercises | djangobook/wsgi.py | Python | gpl-3.0 | 395 |
#!/usr/bin/python
###############################################################################
# This code is developed by HighEnergyDataScientests Team.
# Do not copy or modify without written approval from one of the team members.
###############################################################################
imp... | HighEnergyDataScientests/homesitekaggle | feature_analysis/analyze_unique_values.py | Python | apache-2.0 | 2,549 |
import unittest
from unittest.mock import Mock
from unittest.mock import MagicMock
from unittest.mock import patch
from unittest.mock import call
from unittest.mock import ANY
from tornado.concurrent import Future
from tornado.httpclient import AsyncHTTPClient
from tornado.gen import coroutine
from tornado.testing imp... | dbpedia/dbpedia-widgets | proxy/tests/summarum/ranking_service_test.py | Python | gpl-2.0 | 6,841 |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import yaml
class DictWithSourceType(dict):
"""An environment dict which keeps track of its source.
Environment files may be loaded from simple key/value files, or from
structured YAML files, and... | remind101/stacker | stacker/environment.py | Python | bsd-2-clause | 1,543 |
from sklearn.cluster import DBSCAN
from common import constants
import numpy as np
def cluster_points(coordinates, eps, min_samples, n_jobs=1):
"""Given coordinates, function returns the number of clusters in the
set of coordinates and a list of integer labels corresponding to
the input coordinate list
... | google/eclipse2017 | common/cluster_points.py | Python | apache-2.0 | 1,883 |
# Copyright 2017 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | googledatalab/datalab | tools/cli/commands/utils.py | Python | apache-2.0 | 14,859 |
"""This is a demonstration script for Gittip's test suite.
"""
# Layout
# ======
# The Gittip test suite lives at tests/test_*.py. The tests/ directory is not a
# Python package (there is no __init__.py). Think of it as holding test scripts
# to be run via nosetest (maybe py.test would work too?). Helpers are defined
... | MikeFair/www.gittip.com | tests/test_suite_intro.py | Python | cc0-1.0 | 5,623 |
# Tour through the asteroids
from py4j.clientserver import ClientServer, JavaParameters
gateway = ClientServer(java_parameters=JavaParameters(auto_convert=True))
gs = gateway.entry_point
# Camera params
gs.setCameraSpeed(1.0)
gs.setRotationCameraSpeed(1.0)
gs.setTurningCameraSpeed(1.0)
gs.setCinematicCamera(True)
gs... | langurmonkey/gaiasky | assets/scripts/showcases/3d-asteroids-tour.py | Python | mpl-2.0 | 2,766 |
""" Controller for TSTools that handles slots/signals communication
"""
import copy
from datetime import datetime as dt
from functools import partial
import itertools
import logging
import matplotlib as mpl
import numpy as np
try:
import palettable
HAS_PALETTABLE = True
except:
HAS_PALETTABLE = False
from... | ceholden/TSTools | tstools/src/controller.py | Python | gpl-2.0 | 27,300 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Xmessage(AutotoolsPackage, XorgPackage):
"""xmessage displays a message or query in a wind... | iulian787/spack | var/spack/repos/builtin/packages/xmessage/package.py | Python | lgpl-2.1 | 845 |
''' -- imports from python libraries -- '''
import os
import csv
import json
import ast
import time
import datetime
''' imports from installed packages '''
from django.core.management.base import BaseCommand, CommandError
from mongokit import IS
try:
from bson import ObjectId
except ImportError: # old pymongo
f... | AvadootNachankar/gstudio | gnowsys-ndf/gnowsys_ndf/ndf/management/commands/data_entry.py | Python | agpl-3.0 | 45,442 |
# PyQuantFi - statisticsMC.py
# (c) 2012 Nick Collins
class StatisticMC(object):
"""
Abstract statistics gathering class
"""
def add_one_result(self,value):
self._store_one_result(value)
def get_results(self):
return self._get_results()
class StatisticMean(StatisticMC):
de... | ncollins/pyquantfi | statistics_mc.py | Python | bsd-3-clause | 1,509 |
# Prompts the user for a year or a year and a month,
# the year being no earlier than 1753, and displays
# the calendar for the period requested in the style
# of the Unix cal command, but starting the week on Monday (not SUnday)
# Written by Eric Martin for COMP9021
field_width = 22
def calendar():
month_name... | YufeiZhang/Principles-of-Programming-Python-3 | Labs/Lab5/calendar.py | Python | gpl-3.0 | 4,645 |
from __future__ import absolute_import, division, print_function
import tensorflow as tf
from odin.bay.vi.autoencoder.beta_vae import BetaVAE
from odin.bay.vi.autoencoder.variational_autoencoder import TrainStep
from odin.utils import as_tuple
__all__ = ['ImputeVAE', 'StochasticVAE']
class PosteriorStep(TrainStep):... | imito/odin | odin/bay/vi/autoencoder/stochastic_vae.py | Python | mit | 7,473 |
from os import system
print "Generating your public/private key pair. You'll use this for github & ssh connections"
email = raw_input("First, what is your @degordian.com email? I won't use it for anything shady, I promise ;)\n")
print("Okay, generating your key....")
ssh_location = "~/.ssh/github_rsa"
system("ssh-... | krukru/shell-me-up-scotty | scripts/ssh.py | Python | apache-2.0 | 863 |
'''Operating System Scheduler
'''
from queue import Queue
from task import Task
from systemCall import *
import time
import select
class Scheduler(object):
def __init__(self):
self.ready = Queue()
self.taskMap = {}
self.waitMap = {}
self.waitrl = {}
self... | JShadowMan/package | python/coroutine/operatingSystem/scheduler.py | Python | mit | 4,290 |
# Copyright (C) 2014 Rémi Bèges
# For conditions of distribution and use, see copyright notice in the LICENSE file
# Test of the protocol algorithm with dummy frames
from API.Protocol import Protocol
from API.SerialPort import SerialPort
class SerialMgr():
def __init__(self):
# Create serial... | Overdrivr/DistantIO | 03_Serial_listener.py | Python | mit | 721 |
#!/usr/bin/env python
import os, random, sys, time, urllib
#
# Options
#
dry_run = len(sys.argv) > 1 and "--dry-run" in set(sys.argv[1:])
quiet = len(sys.argv) > 1 and "--quiet" in set(sys.argv[1:])
#
# Functions and constants
#
def download_progress_hook(block_count, block_size, total_blocks):
if quiet or... | danialbehzadi/Nokia-RM-1013-2.0.0.11 | webkit/Tools/CygwinDownloader/cygwin-downloader.py | Python | gpl-3.0 | 5,471 |
from intelligine.core.exceptions import MoleculeException
from intelligine.synergy.object.Bug import Bug
from intelligine.cst import CARRYING, TRANSPORTER, ATTACKER, COL_TRANSPORTER, COL_TRANSPORTER_NOT_CARRYING, \
COL_FIGHTER, MODE_EXPLO, MODE_GOHOME, BODY_PART_PHEROMONE_GLAND, TYPE, TYPE_ANT, \
COL_TRANSPORTE... | buxx/intelligine | intelligine/synergy/object/ant/Ant.py | Python | apache-2.0 | 4,135 |
all = """
Add
Delete
Insert
List
SetDefault
""".split()
| onelab-eu/sfa | sfatables/commands/__init__.py | Python | mit | 56 |
# CRPropa test script
# Simulates the integrated relative abundance from a source,
# accelerationg particles up to a maximum rigidity.
# Minimum energy = 10 EeV
# Maximum rigidity = 100 EeV / Z -> max. energy = Z * 100 EeV
# Composition = p, He, C, O, Si, Fe with relative abundances
# from Allard 2006, DOI: 10.1088... | cheiter/CRPropa3 | test/python/testSourceComposition.py | Python | gpl-3.0 | 1,515 |
# -*- coding: utf-8 -*-
from .base import Entidade
from OpenSSL import crypto
import tempfile
import os
class Certificado(Entidade):
"""Classe abstrata responsavel por definir o modelo padrao para as demais
classes de certificados digitais.
Caso va implementar um novo formato de certificado, crie uma cl... | leotada/PyNFe | pynfe/entidades/certificado.py | Python | lgpl-3.0 | 2,889 |
#!/usr/bin/python
from scrapy.cmdline import execute
execute("scrapy crawl index".split())
| VisitBoy/Tumblr_Feed_Video_Crawler | start.py | Python | apache-2.0 | 93 |
#!/usr/bin/env python
## Testing for correct patchset estimation
# Structure of the test cvs repository
#
# Message File:Content Commit Time
# Rev 1 a: 1.1 2009-02-21 19:11:43 +0100
# Rev 2 a: 1.2 b: 1.1 2009-02-21 19:11:14 +0100
# Rev 3 b: 1.2 2009-02-21 19:11:... | jleverenz/cvsps-esr | test/t9603.py | Python | gpl-2.0 | 594 |
from __future__ import unicode_literals
from .base import * # noqa @UnusedWildImport
INSTALLED_APPS += ['sendfile']
WIKI_ATTACHMENTS_USE_SENDFILE = True
SENDFILE_BACKEND = 'sendfile.backends.development'
# SENDFILE_URL = None #Not needed
# SENDFILE_ROOT = None #Not needed
| cXhristian/django-wiki | testproject/testproject/settings/sendfile.py | Python | gpl-3.0 | 280 |
# coding=utf-8
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import os.path as path
from io import StringIO
import astwro.starlist as sl
import astwro.sampledata as data
from astwro.utils import tmpdir
def get_catalog(object):
from astroquery.vizier import Vizier
viz = ... | majkelx/astwro | astwro/starlist/tests/ds9_io_test.py | Python | mit | 3,020 |
# aprslib - Python library for working with APRS
# Copyright (C) 2013-2014 Rossen Georgiev
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option... | rossengeorgiev/aprs-python | aprslib/__init__.py | Python | gpl-2.0 | 1,577 |
# -*- coding: utf-8 -*-
"""
F test for null hypothesis that coefficients in several regressions are the same
* implemented by creating groupdummies*exog and testing appropriate contrast
matrices
* similar to test for structural change in all variables at predefined break points
* allows only one group variable
* cur... | matthew-brett/draft-statsmodels | scikits/statsmodels/sandbox/regression/onewaygls.py | Python | bsd-3-clause | 16,054 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache/incubator-airflow | tests/providers/amazon/aws/hooks/test_cloud_formation.py | Python | apache-2.0 | 3,561 |
class List_plays:
'''
This class stores and sorts objects of the Play class so that they can be efficiently accessed for processing.
Overall list consisting of three separate lists each of which stores multiple instances of the Play class.
'''
def __init__(self):
self.first_down = [[],[],[],[],[],[],[],[... | A-Malone/NFL-Analytics | AnalysisSite/DataStructure.py | Python | mit | 3,299 |
import numpy as np
from numpy import linalg
from scipy.sparse import dok_matrix, csr_matrix, issparse
from scipy.spatial.distance import cosine, cityblock, minkowski, wminkowski
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing impo... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/metrics/tests/test_pairwise.py | Python | mit | 27,335 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
#Importar libreria GPIO
import RPi.GPIO as GPIO
#Definir modo de trabajo para la placa BCM
GPIO.setmode(GPIO.BCM)
#Desactivo Errores
GPIO.setwarnings(False)
#Importamos la libreria time
import time
#Importamos la libreria para comandos de la consola/shell
import os
#De... | fryntiz/Raspberry-PI | Obsoleto/Web Administración Raspberri PI/GPIO/6/apagar.py | Python | gpl-3.0 | 494 |
#!/usr/bin/env python
# Copyright (c) 2021 by
# Donatas Abraitis <donatas.abraitis@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software
# for any purpose with or without fee is hereby granted, provided
# that the above copyright notice and this permission notice appear
# in all copies.
#
# T... | freerangerouting/frr | tests/topotests/bgp_community_alias/test_bgp-community-alias.py | Python | gpl-2.0 | 4,645 |
import os
import re
import shutil
from urllib import parse
from jirafs import exceptions, utils
from jirafs.plugin import CommandPlugin
from jirafs.ticketfolder import TicketFolder
class Command(CommandPlugin):
"""Clone a new ticketfolder for the specified ticket URL"""
MIN_VERSION = "2.0.0"
MAX_VERSION... | coddingtonbear/jirafs | jirafs/commands/clone.py | Python | mit | 2,005 |
# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
from testrunner.local import testsuite
from testrunner.objects import testcase
class FuzzerVariantGenerator(testsuite.VariantGenerator):
# O... | RPGOne/Skynet | node-master/deps/v8/test/fuzzer/testcfg.py | Python | bsd-3-clause | 1,746 |
import twitter
import urllib
from datetime import datetime
from django.db.utils import IntegrityError
from django.http import HttpResponse
from django.views.generic import TemplateView, View
from rest_framework import generics, viewsets
from socialtool.loading import get_classes, get_model
PostSerializer, Paginated... | udox/django-social-tools | socialtool/social/views.py | Python | bsd-3-clause | 4,489 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2017-03-21 16:28:18
# @Author : Zhou Bo (zhoub@suooter.com)
# @Link : http://onlyus.online
# @Version : $Id$
from io import open
def filter(oldfile, newfile):
'''\
Read a list of names from a file line by line into an output file.
If a line be... | congminghaoxue/learn_python | read_write_file.py | Python | apache-2.0 | 662 |
"""The tests for the manual_mqtt Alarm Control Panel component."""
from datetime import timedelta
import unittest
from unittest.mock import Mock, patch
from homeassistant.components import alarm_control_panel
from homeassistant.const import (
STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_HOME,
STATE_ALARM_ARME... | Teagan42/home-assistant | tests/components/manual_mqtt/test_alarm_control_panel.py | Python | apache-2.0 | 59,283 |
"""
sentry.utils.imports
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import inspect
import sys
from sentry.utils.imports import import_string
PACKAGES = {
'django.db.backends.postgresql_psycopg2': 'psycopg2.ext... | beni55/sentry | src/sentry/utils/settings.py | Python | bsd-3-clause | 2,562 |
import urllib2
import lxml.html
from gauth.settings import TOKEN_FIELD_NAME
# gets the entry id for the auth token field
def get_entry_id(form_url):
try:
page = urllib2.urlopen(form_url)
except urllib2.HTTPError:
return None
p = lxml.html.parse(page)
root = p.getroot()
heading... | benweissmann/gauth | redirector/form_parser.py | Python | mit | 801 |
#!/usr/bin/env python
import urllib
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
@stringfilter
def qrcode(value, alt=None):
"""
... | hugobarzano/DispositivosMovilesBackEnd | ControlUsuarios/templatetags/qr.py | Python | gpl-3.0 | 1,049 |
#!/usr/bin/env python
# encoding: utf-8
import argparse
import os
import pickle
import sys
sys.path.insert(0, 'utilities')
from analyze import *
from output import *
from stats import *
from store import *
from filesystem import *
from lists import *
from numbers import *
from strings import *
#from google.protobu... | ephracis/hermes | hermes.py | Python | mit | 6,704 |
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).
from openerp.tests import common
from openerp.tools import SUPERUSER_ID
class TestPurchaseRequest(common.TransactionCase):
def setUp(self):
super(... | SerpentCS/purchase-workflow | purchase_request/tests/test_purchase_request.py | Python | agpl-3.0 | 1,728 |
import sys
if sys.version_info < (3, 7):
from ._text import TextValidator
from ._offset import OffsetValidator
from ._font import FontValidator
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__,
[],
["._text.... | plotly/python-api | packages/python/plotly/plotly/validators/carpet/baxis/title/__init__.py | Python | mit | 395 |
from django.conf import settings
from django.utils.six.moves.urllib.parse import urlparse
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.utils import resolve_model_string
class BadRequestError(Exception):
pass
def get_base_url(request=None):
base_url = getattr(settings, 'WAGTAILAPI_BA... | gogobook/wagtail | wagtail/api/v2/utils.py | Python | bsd-3-clause | 1,286 |
from ..testing.test_loader import MANUAL, AUTOMATIC
PAUSED = "paused"
RUNNING = "running"
COMPLETED = "completed"
ABORTED = "aborted"
PENDING = "pending"
UNKNOWN = "unknown"
class Session(object):
def __init__(
self,
token=None,
test_types=None,
user_agent=None,
... | servo/servo | tests/wpt/web-platform-tests/tools/wave/data/session.py | Python | mpl-2.0 | 2,341 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from app_data import AppDataField
from six import python_2_unicode_compatible
@python_2_unicode_compatible
class AppHookConfig(models.... | aldryn/aldryn-apphooks-config | aldryn_apphooks_config/models.py | Python | bsd-3-clause | 1,617 |
# Copyright 2017, David Wilson
#
# 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 and the following disclaimer.
#
# 2.... | ConnectBox/wifi-test-framework | ansible/plugins/mitogen-0.2.3/ansible_mitogen/runner.py | Python | mit | 28,071 |
from django import template
register = template.Library()
def getattribute(value, arg):
"""Gets an attribute of an object dynamically from a string name"""
if hasattr(value, str(arg)):
return getattr(value, arg)
register.filter('getattr', getattribute)
| osu-cass/working-waterfronts-api | working_waterfronts/working_waterfronts_api/templatetags/getattr.py | Python | apache-2.0 | 274 |
# -*- coding: utf-8 -*-
#
# SPDX-FileCopyrightText: 2013-2021 Agora Voting SL <contact@nvotes.com>
#
# SPDX-License-Identifier: AGPL-3.0-only
#
import pickle
import base64
import json
import re
from datetime import datetime
from flask import Blueprint, request, make_response, abort
from frestq.utils import loads, du... | agoravoting/election-orchestra | public_api.py | Python | agpl-3.0 | 8,209 |
# Python - 3.4.3
def bmi(weight, height):
# 計算BMI
v = weight / height ** 2
# 根據BMI輸出訊息
if v <= 18.5:
return 'Underweight'
elif v <= 25:
return 'Normal'
elif v <= 30:
return 'Overweight'
else:
return 'Obese'
| RevansChen/online-judge | Codewars/8kyu/calculate-bmi/Python/solution1.py | Python | mit | 293 |
# bgscan tests
# Copyright (c) 2014, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import time
import logging
logger = logging.getLogger()
import os
import hostapd
def test_bgscan_simple(dev, apdev):
"""bgscan_simple"""
hostapd... | wangybgit/Chameleon | hostapd-OpenWrt/tests/hwsim/test_bgscan.py | Python | apache-2.0 | 6,284 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, André Paramés <git@andreparames.com>
# Based on the Git module by Michael DeHaan <michael.dehaan@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 a... | Rajeshkumar90/ansible-modules-extras | source_control/bzr.py | Python | gpl-3.0 | 6,658 |
# ===============================================================================
# Copyright 2019 ross
#
# 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/LICE... | USGSDenverPychron/pychron | pychron/pipeline/results/base_matrix_result.py | Python | apache-2.0 | 1,863 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Module for connecting to kodi """
import cherrypy
import htpc
import base64
import socket
import struct
from urllib2 import quote
from jsonrpclib import Server
from sqlobject import SQLObject, SQLObjectNotFound
from sqlobject.col import StringCol, IntCol
from htpc.help... | scith/htpc-manager_ynh | sources/modules/kodi.py | Python | gpl-3.0 | 37,969 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.