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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python
# This file should be compatible with both Python 2 and 3.
# If it is not, please file a bug report.
"""
Contains code that prepairs a subuser's image to be run.
"""
#external imports
import os
#internal imports
from subuserlib.classes.userOwnedObject import UserOwnedObject
class RunReadyImage(... | ruipgpinheiro/subuser | logic/subuserlib/classes/subuserSubmodules/run/runReadyImage.py | Python | lgpl-3.0 | 2,881 | 0.012843 |
"""
-- Policy Network for decision making [more general]
"""
from nmt_uni import *
from layers import _p
import os
import time, datetime
import cPickle as pkl
# hyper params
TINY = 1e-7
PI = numpy.pi
E = numpy.e
A = 0.2
B = 1
class Controller(object):
def __init__(self, trng,
option... | nyu-dl/dl4mt-simul-trans | policy.py | Python | bsd-3-clause | 23,644 | 0.007867 |
# -*- coding: utf-8 -*-
from os import path
import yaml
import arrow
from chunkify import chunkify
from jinja2 import Environment, FileSystemLoader, StrictUndefined
from taskcluster.utils import stableSlugId
DEFAULT_TEMPLATE_DIR = path.join(path.dirname(__file__), "templates")
def make_task_graph(root_template="... | mrrrgn/releasetasks | releasetasks/__init__.py | Python | mpl-2.0 | 1,546 | 0.001294 |
"""Remove any personally identifying information from the database"""
from django.core.management.base import BaseCommand
from django.conf import settings
from django.contrib.admin.models import LogEntry
from django_openid_auth.models import UserOpenID
from rest_framework.authtoken.models import Token
from reversion.mo... | lutris/website | common/management/commands/anon_db.py | Python | agpl-3.0 | 2,839 | 0 |
# Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"""A module to handle logging."""
import logging
from logging.handlers import RotatingFileHandler
LOGGER_NAME = 'plover_logger'
LOG_FORMAT = '%(asctime)s %(message)s'
LOG_MAX_BYTES = 10000000
LOG_COUNT = 9
class Logger(object):
def __init__(self):... | shayneholmes/plover | plover/logger.py | Python | gpl-2.0 | 1,566 | 0.000639 |
#!/usr/bin/python
from mininet.topo import Topo, Node
class CampusTopo( Topo ):
"A simple example of a small campus network."
def __init__(self, enable_all = True):
" Create a campus topology."
super( CampusTopo, self).__init__()
# Add switches and hosts.
switches = [1, 2, 3]... | frenetic-lang/netcore-1.0 | examples/Campus.py | Python | bsd-3-clause | 1,239 | 0.026634 |
import string, urllib, urllib2, logging
from webapp2_extras import json
import Handlers, Config
class FoursquareException(Exception):
def __init__(self, message, value):
super(self, Exception).__init__(message)
self.value = value
class FoursquareApiException(FoursquareException): pass
class Four... | timgilbert/how-you-been | src/howyoubeen/Foursquare.py | Python | mit | 3,878 | 0.009025 |
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# *************************************... | sbesson/zeroc-ice | java/test/Ice/operations/run.py | Python | gpl-2.0 | 1,426 | 0.011921 |
# Copyright 2011 Marek Schmidt
#
# This file is part of ManaClash
#
# ManaClash 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 version.
#
# Ma... | fregaham/manaclash | cost.py | Python | gpl-3.0 | 8,669 | 0.006575 |
import os
import sys
import gzip
from datetime import datetime
from termcolor import colored
from singularity_request import get_json_response
BASE_URI_FORMAT = '{0}{1}'
REQUEST_TASKS_FORMAT = '/history/request/{0}/tasks'
ACTIVE_TASKS_FORMAT = '/history/request/{0}/tasks/active'
def unpack_logs(logs):
for zipped_fi... | mjball/Singularity | scripts/logfetch/logfetch_base.py | Python | apache-2.0 | 2,462 | 0.017059 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#==============================================================================#
# #
# Copyright 2011 Carlos Alberto da Costa Filho #
# ... | cako/notorius | src/image_label.py | Python | gpl-3.0 | 15,994 | 0.004627 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
from cpt.packager import ConanMultiPackager
from cpt.ci_manager import CIManager
from cpt.printer import Printer
class BuilderSettings(object):
@property
def username(self):
""" Set catchorg as package's owner
"""
retur... | ibc/MediaSoup | worker/deps/catch/.conan/build.py | Python | isc | 3,044 | 0.001643 |
#!/usr/bin/python
#
# generate_nametags_with_barcodes.py
# Copyright (C) 2016 Sandeep M
#
# every year an elementary school in california runs a festival where families
# sign up for parties and events, as well as bid for auctions and donations.
# each family is issued some stickers with unique barcode to make... | d-e-e-p/generate_nametags_with_barcodes | generate_nametags_with_barcodes.py | Python | gpl-3.0 | 22,514 | 0.014302 |
from __future__ import print_function, absolute_import, division
import sys
sys.path.append("..")
print(sys.path)
from numpy import *
from pyKratos import *
#example = "cavity"
#example = "gravity"
#example = "shear_x"
example = "inlet"
# add variables to be allocated from the list in variables.py
solution_step_va... | RiccardoRossi/pyKratos | stokes_ex/square_cavity.py | Python | bsd-2-clause | 4,711 | 0.011675 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-12-08 21:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0021_auto_20161208_1214'),
]
operations = [
migrations.AlterField(
... | bomjacob/htxaarhuslan | main/migrations/0022_auto_20161208_2216.py | Python | mit | 679 | 0.001473 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from compiled_file_system import CompiledFileSystem
from file_system import FileNotFoundError
class ChainedCompiledFileSystem(object):
''' A CompiledFileS... | windyuuy/opera | chromium/src/chrome/common/extensions/docs/server2/chained_compiled_file_system.py | Python | bsd-3-clause | 3,233 | 0.007733 |
from gen import *
from dataset import *
# TETROMINO
tetromino_gen = lambda w, h: TwoGroups("tetrisi/tetriso/tetrist/tetrisl/tetrisj/tetriss/tetrisz",
1010, w, h,
n1 = 1, n2 = 2, rot = True, task = 1)
tetromino = lambda w, h: BugPlacer(tet... | breuleux/bugland | bugland/premade.py | Python | bsd-3-clause | 796 | 0.028894 |
'''
A set of (smooth) loss functions.
Created on Oct 2, 2014
@author: jiayu.zhou
'''
import numpy as np;
def least_squares(w, X, y):
'''
least squares loss.
MATLAB verified function.
f(x) = 1/2 * ||X * w - y||_F^2.
Parameters
----------
w: np.matrix
X: np.matrix
y: ... | jiayuzhou/pyProxSolver | org/jiayu/optimization/smooth.py | Python | gpl-2.0 | 563 | 0.039076 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 OpenStack Foundation
#
# 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... | Brocade-OpenSource/OpenStack-DNRM-Neutron | neutron/db/migration/alembic_migrations/versions/3b54bf9e29f7_nec_plugin_sharednet.py | Python | apache-2.0 | 2,645 | 0.001134 |
from spectrum import CORRELOGRAMPSD, CORRELATION, pcorrelogram, marple_data
from spectrum import data_two_freqs
from pylab import log10, plot, savefig, linspace
from numpy.testing import assert_array_almost_equal, assert_almost_equal
def test_correlog():
psd = CORRELOGRAMPSD(marple_data, marple_data, lag=15)
... | cokelaer/spectrum | test/test_correlog.py | Python | bsd-3-clause | 1,904 | 0.006828 |
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2014 Star2Billing S.L.
#
# The Initia... | gale320/newfies-dialer | newfies/appointment/templatetags/appointment_tags.py | Python | mpl-2.0 | 1,283 | 0.002338 |
__all__ = [
'Units',
'convert',
]
import enum
class Units(enum.Enum):
SECONDS = 0
MILLISECONDS = -3
MICROSECONDS = -6
NANOSECONDS = -9
def convert(source_unit, target_unit, time):
"""Convert time between units."""
if source_unit is target_unit:
return time
return time * ... | clchiou/garage | py/g1/bases/g1/bases/times.py | Python | mit | 364 | 0 |
import pyspark
import operator
import sys
#311 call 2010 to present csv
#0 Unique Key,Created Date,Closed Date,Agency,Agency Name,
#5 Complaint Type,Descriptor,Location Type,Incident Zip,Incident Address,
#10 Street Name,Cross Street 1,Cross Street 2,Intersection Street 1,
#14 Intersection Street 2,Address Type,Cit... | alejandro-mc/BDM-DDD | value_noisecomplaints/getLoudMusicComp.py | Python | mit | 2,652 | 0.019985 |
__version__ = "1.12.0"
__version_info__ = ( 1, 12, 0 )
| JeffHoogland/bodhi3packages | python3-efl-i386/usr/lib/python3.4/dist-packages/efl/__init__.py | Python | bsd-3-clause | 56 | 0.035714 |
# Copyright 2013-2021 Aerospike, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | aerospike/aerospike-admin | test/e2e/util.py | Python | apache-2.0 | 6,156 | 0.000975 |
"""
S.Tomin and I.Zagorodnov, 2017, DESY/XFEL
"""
from ocelot.common.globals import *
import logging
logger = logging.getLogger(__name__)
try:
import numexpr as ne
ne_flag = True
except:
logger.debug("coord_transform.py: module NUMEXPR is not installed. Install it to speed up calculation")
ne_flag = F... | ocelot-collab/ocelot | ocelot/cpbd/coord_transform.py | Python | gpl-3.0 | 3,359 | 0.002679 |
""" configuration module for awsu, contains two objects """
import boto3
import sqlite3
import logging
import getpass
import datetime
import configparser
import uuid
import requests
import json
from dateutil.tz import tzutc
from urllib.parse import urlencode, quote_plus
from os import environ
from bs4 import BeautifulS... | rizkidoank/awsu | awsu/config.py | Python | gpl-3.0 | 11,653 | 0.000944 |
import os
import tempfile
from wsgiref.util import FileWrapper
import zipfile
from django.http import HttpResponse
from django.views.generic import View
from corehq.util.view_utils import set_file_download
def make_zip_tempfile(files, compress=True):
compression = zipfile.ZIP_DEFLATED if compress else zipfile.ZIP... | SEL-Columbia/commcare-hq | corehq/util/zip_utils.py | Python | bsd-3-clause | 1,577 | 0 |
"""
Annotates Old Bird call detections in the BirdVox-70k archive.
The annotations classify clips detected by the Old Bird Tseep and Thrush
detectors according to the archive's ground truth call clips.
This script must be run from the archive directory.
"""
from django.db.models import F
from django.db.utils import... | HaroldMills/Vesper | scripts/old_bird_detector_eval/annotate_old_bird_calls.py | Python | mit | 6,952 | 0.005898 |
#!/usr/bin/env python
# -*-coding:utf-8-*-
# @Time : 2017/11/1 ~ 2019/9/1
# @Author : Allen Woo
from flask import request
from apps.core.flask.login_manager import osr_login_required
from apps.configs.sys_config import METHOD_WARNING
from apps.core.blueprint import api
from apps.core.flask.permission import permission_... | osroom/osroom | apps/modules/category/apis/theme_category.py | Python | bsd-2-clause | 2,262 | 0.000982 |
#!/usr/bin/env python
from tools.load import LoadMatrix
from numpy import where
import shogun as sg
lm=LoadMatrix()
traindat = lm.load_numbers('../data/fm_train_real.dat')
testdat = lm.load_numbers('../data/fm_test_real.dat')
parameter_list=[[traindat,testdat, 1.0],[traindat,testdat, 10.0]]
def kernel_wave (fm_train... | shogun-toolbox/shogun | examples/undocumented/python/kernel_wave.py | Python | bsd-3-clause | 846 | 0.030733 |
from moto.core.exceptions import JsonRESTError
class AccountAlreadyRegisteredException(JsonRESTError):
code = 400
def __init__(self):
super().__init__(
"AccountAlreadyRegisteredException",
"The provided account is already a delegated administrator for your organization.",
... | spulec/moto | moto/organizations/exceptions.py | Python | apache-2.0 | 2,748 | 0.00182 |
# Copyright 2011,2012 James McCauley
#
# This file is part of POX.
#
# POX 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 version.
#
# POX is d... | mikeing2001/LoopDetection | pox/web/webcore.py | Python | gpl-3.0 | 15,662 | 0.01443 |
#!/usr/bin/env python
#
# Copyright (c) 2001 Autonomous Zone Industries
# Copyright (c) 2002 Bryce "Zooko" Wilcox-O'Hearn
# This file is licensed under the
# GNU Lesser General Public License v2.1.
# See the file COPYING or visit http://www.gnu.org/ for details.
#
__cvsid = '$Id: mencode_unittests.py,v 1.1 200... | zooko/egtp | common/mencode_unittests.py | Python | agpl-3.0 | 13,498 | 0.004075 |
"package1.subpackage.module"
| metachris/py2app | py2app_tests/basic_app_with_encoding/package1/subpackage/module.py | Python | mit | 29 | 0 |
#!/usr/bin/env python
from __future__ import division
import time
import sys
import MySQLdb as mdb
import smtplib
import re
import bz2
import alarm
# Alarm Levels:
# Temperature Alarms
# 0 - No alarm, freezer is in a normal state
# 1 - freezer is in a high temp range, and has been for 30 min
# 2 - freezer is in a high... | xvorenda/DAENA | py/alarm.py | Python | gpl-3.0 | 62,009 | 0.004919 |
import numpy as np
import matplotlib
import matplotlib.pylab as plt
import healpy as hp
import string
import yt
import os
import glob
from PIL import Image as PIL_Image
from images2gif import writeGif
from scipy.special import sph_harm,sph_jn
import beatbox
from beatbox.multiverse import Multiverse
# ===============... | drphilmarshall/Music | beatbox/universe.py | Python | mit | 38,369 | 0.013188 |
from io import (
BytesIO,
StringIO,
)
import os
from typing import Union
from urllib.error import HTTPError
import numpy as np
import pytest
from pandas.compat import PY38
import pandas.util._test_decorators as td
from pandas import DataFrame
import pandas._testing as tm
from pandas.io.xml import read_xml
... | datapythonista/pandas | pandas/tests/io/xml/test_xml.py | Python | bsd-3-clause | 34,008 | 0.000265 |
# Copyright 2018 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... | hfp/tensorflow-xsmm | tensorflow/python/saved_model/model_utils/__init__.py | Python | apache-2.0 | 1,544 | 0.003886 |
from tkinter import *
from modules.gestionnaire import *
def couleurAffiche(couleur):
if couleur == "red":
return "#CC0000"
elif couleur == "green":
return "#006600"
elif couleur == "blue":
return "#0000CC"
elif couleur == "orange":
return "#FF4500"
elif couleur == "yellow":
return "#FFD500... | katyushacccp/ISN_projet_final | final 0.0/modules/affichage.py | Python | cc0-1.0 | 2,709 | 0.068291 |
from django.db import models
class Job(models.Model):
job_name = models.CharField(max_length=80)
disabled = models.BooleanField(default=False)
def __unicode__(self):
return self.job_name
| agamdua/hamster-core | hamster/jobs/models.py | Python | mit | 209 | 0.004785 |
from django.conf.urls import patterns, url
from eatnit.apps.food import views
urlpatterns = patterns('',
url(r'^$', views.index, name='eatnit_index'),
# url(r'^meals/$', views.meal_index, name='meal_index'),
# url(r'^meals/(?P<meal_id>\d+)/$', views.meal_detail, name='meal_detail'),
# url(r'^restauran... | flinz/eatnit | eatnit/apps/food/urls.py | Python | gpl-2.0 | 482 | 0.006224 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Station'
db.create_table('vcapp_station', (
('id', self.gf('django.db.models.fie... | edwinsteele/visual-commute | vcapp/migrations/0002_initial.py | Python | cc0-1.0 | 5,957 | 0.006211 |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | colinbrislawn/scikit-bio | skbio/sequence/_iupac_sequence.py | Python | bsd-3-clause | 16,530 | 0.00006 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... | googleads/google-ads-python | google/ads/googleads/v10/enums/types/webpage_condition_operator.py | Python | apache-2.0 | 1,199 | 0.000834 |
"""Nello.io lock platform."""
from itertools import filterfalse
import logging
from pynello.private import Nello
import voluptuous as vol
from homeassistant.components.lock import PLATFORM_SCHEMA, LockEntity
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
import homeassistant.helpers.config_validation as... | tchellomello/home-assistant | homeassistant/components/nello/lock.py | Python | apache-2.0 | 2,961 | 0.001013 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2002 Ben Escoto <ben@emerose.org>
# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
#
# This file is part of duplicity.
#
# Duplicity is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License... | CloudBrewery/duplicity-swiftkeys | duplicity/backends/hsibackend.py | Python | gpl-2.0 | 2,186 | 0.004575 |
def say_hello(user):
print('Hello', user, '!')
| pycam/python-functions-and-modules | my_first_module.py | Python | unlicense | 51 | 0 |
# -*- coding: utf-8 -*-
import random
import re
import threading
import time
from module.plugins.internal.Plugin import Plugin, Skip
from module.plugins.internal.misc import Periodical, compare_time, decode, isiterable, lock, parse_size
class Account(Plugin):
__name__ = "Account"
__type__ = "account"
... | kaarl/pyload | module/plugins/internal/Account.py | Python | gpl-3.0 | 12,347 | 0.007208 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '.\taskTemplate.ui'
#
# Created: Thu Oct 08 16:48:34 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except... | mgraupe/acq4 | acq4/devices/Laser/taskTemplate.py | Python | mit | 6,745 | 0.001927 |
"""
makerdf.py
Assemble RDF describing all available CC licenses using licenses.xml
as a source for all canonical license URIs.
Requires RDFlib (http://rdflib.net), lxml (http://codespeak.net/lxml).
(c) 2005-2006, Nathan R. Yergler, Creative Commons.
"""
__version__ = 0.5
from rdflib.Graph import Graph
import rdfl... | LAUDATIO-Repository/Version1.1 | app/webroot/js/creativecommons/license_xsl/licensexsl_tools/makerdf.py | Python | gpl-3.0 | 2,716 | 0.004786 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import unicode_literals
import unittest
import os
from pymatgen.analysis.pourbaix.maker import PourbaixDiagram
from pymatgen.analysis.pourbaix.entry import PourbaixEntryIO
class TestPourbaix... | johnson1228/pymatgen | pymatgen/analysis/pourbaix/tests/test_maker.py | Python | mit | 1,116 | 0.005376 |
# -*- coding: UTF-8 -*-
# Gedit External Tools plugin
# Copyright (C) 2005-2006 Steve Frécinaux <steve@istique.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 versi... | halfline/gedit | plugins/externaltools/tools/windowactivatable.py | Python | gpl-2.0 | 7,385 | 0.002844 |
cars = 100
space_in_a_car = 4.0
drivers = 30
passengers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print("There are", cars, "cars available.")
print("There are only", drivers, "drivers available.")
p... | zedshaw/learn-python3-thw-code | ex4.py | Python | mit | 566 | 0.001767 |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# pylint: disable=maybe-no-member, invalid-name
"""Test request import and updates."""
import csv
from collections import OrderedDict
from cStringIO import StringIO
from itertools import izip
from flask.... | AleksNeStu/ggrc-core | test/integration/ggrc/converters/test_import_assessments.py | Python | apache-2.0 | 19,212 | 0.001457 |
from werkzeug.exceptions import HTTPException, InternalServerError
from .json import jsonify
def register(app):
"""
Register error handlers on the given app
:type app: flask.Flask
"""
@app.errorhandler(400)
@app.errorhandler(401)
@app.errorhandler(403)
@app.errorhandler(404)
@app... | kerel-fs/skylines | skylines/api/views/errors.py | Python | agpl-3.0 | 1,466 | 0 |
# -*- coding: utf-8 -*-
"""Template shortcut & filters"""
import os
import datetime
from jinja2 import Environment, FileSystemLoader
from uwsgi_sloth.settings import ROOT
from uwsgi_sloth import settings, __VERSION__
template_path = os.path.join(ROOT, 'templates')
env = Environment(loader=FileSystemLoader(template_pa... | piglei/uwsgi-sloth | uwsgi_sloth/template.py | Python | apache-2.0 | 1,040 | 0.002885 |
""" Copyright 2015 Will Boyce """
from __future__ import print_function
import os
import re
from boto3.session import Session
from ec2hashcat import exceptions
class S3Bucket(object):
types = ('hashlists', 'dumps', 'wordlists', 'rules')
def __init__(self, cfg):
self.cfg = cfg
aws = Session... | wrboyce/ec2hashcat | ec2hashcat/aws/s3.py | Python | apache-2.0 | 5,740 | 0.002265 |
#! usr/bin/env python2
from PySide import QtGui, QtCore
from PySide.QtCore import Qt
from settings import Icon
class Node(object):
Command, Form, Separator = 'command', 'form', 'separator'
@classmethod
def from_type(cls, type_, **kw):
cls = Command if kw['type'] == cls.Command ... | arubertoson/piemenu | piemenu/menusystem/node.py | Python | gpl-2.0 | 4,177 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Johann Prieur <johann.prieur@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) an... | freedesktop-unofficial-mirror/papyon | papyon/service/AddressBook/scenario/contacts/messenger_contact_add.py | Python | gpl-2.0 | 3,036 | 0.002306 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-tpu | google/cloud/tpu_v2alpha1/services/tpu/async_client.py | Python | apache-2.0 | 54,857 | 0.001367 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "e_commerce_with_django_at_scale.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| npinchot/djangocon_2015_talk | manage.py | Python | mit | 274 | 0.00365 |
"""The tests for the Jewish calendar sensors."""
from datetime import timedelta
from datetime import datetime as dt
import pytest
import homeassistant.util.dt as dt_util
from homeassistant.setup import async_setup_component
from homeassistant.components import jewish_calendar
from tests.common import async_fire_time_... | joopert/home-assistant | tests/components/jewish_calendar/test_sensor.py | Python | apache-2.0 | 19,613 | 0.000982 |
# Copyright 2017 Capital One Services, LLC
#
# 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... | FireballDWF/cloud-custodian | tools/c7n_mailer/c7n_mailer/datadog_delivery.py | Python | apache-2.0 | 4,461 | 0.000897 |
from functools import wraps
from flask import Blueprint, render_template, abort, g
from flask.ext.admin import babel
from flask.ext.admin._compat import with_metaclass
from flask.ext.admin import helpers as h
# For compatibility reasons import MenuLink
from flask.ext.admin.menu import MenuCategory, MenuView, MenuLink... | Jumpscale/web | pythonlib/flask_admin/base.py | Python | apache-2.0 | 16,504 | 0.001636 |
# Copyright 2013-2021 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 RMaps(RPackage):
"""Display of maps. Projection code and larger maps are in separate
p... | LLNL/spack | var/spack/repos/builtin/packages/r-maps/package.py | Python | lgpl-2.1 | 902 | 0.004435 |
#!/usr/bin/env python
#####
#
# Synthetic Biology Gene Standardizer
# Copyright (c) 2015, Tyson R. Shepherd, PhD
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source co... | trsheph/SynBioStandardizer | SynColi2/SyGS_v2.py | Python | bsd-2-clause | 3,078 | 0.01462 |
#!/usr/bin/env python
import os
import time
import django
from userreport import maint
os.environ['DJANGO_SETTINGS_MODULE'] = 'userreport.settings'
django.setup()
start_time = time.time()
remove_time, get_time, save_time = maint.refresh_data()
total_time = time.time() - start_time
print("--- Remove Time: {:>5.2f} s... | leyyin/stk-stats | maint_graphics.py | Python | mit | 651 | 0.004608 |
"""
Module used to download from SNCF website trains schedules and save it in the right format
in different databases (Dynamo or relational database)
"""
from os import path, makedirs
import zipfile
from urllib.request import urlretrieve
import logging
import pandas as pd
from api_etl.settings import __GTFS_FOLDER_P... | leonardbinet/Transilien-Api-ETL | api_etl/extract_schedule.py | Python | mit | 5,949 | 0.001513 |
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import unittest
import doctest
import trytond.tests.test_tryton
from trytond.tests.test_tryton import ModuleTestCase
from trytond.tests.test_tryton import doctest_setup, doctes... | kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/modules/sale_promotion/tests/test_sale_promotion.py | Python | gpl-3.0 | 824 | 0.002427 |
#!/usr/bin/python
# interpolate scalar gradient onto nedelec space
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
from dolfin import *
import mshr
Print = PETSc.Sys.Print
# from MatrixOperations import *
import numpy as np
import PETScIO as IO
import common
import scipy
import scipy.i... | wathen/PhD | MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/SplitMatrix/ScottTest/Lshaped/Dominik/NS.py | Python | mit | 11,453 | 0.021304 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import re
from copy import copy
from operator import attrgetter
from django.conf import settings
from django.http import... | sgarrity/bedrock | bedrock/releasenotes/views.py | Python | mpl-2.0 | 8,074 | 0.001362 |
##########################################################################
#
# Copyright (c) 2013, Image Engine Design 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:
#
# * Redistribu... | code-google-com/cortex-vfx | test/IECore/LensDistortOpTest.py | Python | bsd-3-clause | 2,750 | 0.019636 |
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'ring/unity')
object.setAttachment('objType', 'ring')
object.setStfFilename('static_item_n')
object.setStfName('item_ring_set_commando_utility_b_01_01')
object.setDetailFilename('static_item_d')
object.setDetailName('item_ring_set_comman... | agry/NGECore2 | scripts/object/tangible/wearables/ring/item_ring_set_commando_utility_b_01_01.py | Python | lgpl-3.0 | 1,084 | 0.020295 |
'''
Draw a tunnel with keyboard movement, create it and its collision geometry, and walk through it.
Created on Feb 25, 2015
Released Feb 4, 2016
@author: ejs
'''
from panda3d.core import loadPrcFile, loadPrcFileData # @UnusedImport
loadPrcFile("./myconfig.prc")
# loadPrcFileData("", "load-display p3tinydisplay\nba... | eswartz/panda3d-stuff | programs/dynamic-geometry/draw_path_tris.py | Python | mit | 10,950 | 0.010594 |
from enum import IntEnum
class FingerPosition(IntEnum):
VerticalUp = 0
VerticalDown = 1
HorizontalLeft = 2
HorizontalRight = 3
DiagonalUpRight = 4
DiagonalUpLeft = 5
DiagonalDownRight = 6
DiagonalDownLeft = 7
@staticmethod
def get_finger_position_name(finger_position):
... | dedoogong/asrada | HandPose_Detector/FingerPosition.py | Python | apache-2.0 | 1,202 | 0.002496 |
#!/usr/bin/env python
"""
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");... | radicalbit/ambari | contrib/management-packs/odpi-ambari-mpack/src/main/resources/stacks/ODPi/2.0/services/HIVE/package/scripts/hcat_client.py | Python | apache-2.0 | 2,941 | 0.00578 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from lib.core.enums import HTTP_HEADER
from lib.core.settings import WAF_ATTACK_VECTORS
__product__ = "ModSecurity: Open Source Web Application Firewall (Trustwave... | glaudsonml/kurgan-ai | tools/sqlmap/waf/modsecurity.py | Python | apache-2.0 | 777 | 0.003861 |
"""
Django settings for keyman project.
Generated by 'django-admin startproject' using Django 1.11.7.
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 os
... | htlcnn/pyrevitscripts | HTL.tab/Test.panel/Test.pushbutton/keyman/keyman/keyman/settings.py | Python | mit | 3,109 | 0.001287 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... | googleapis/python-aiplatform | google/cloud/aiplatform_v1/types/tensorboard.py | Python | apache-2.0 | 4,087 | 0.001223 |
#!/usr/bin/python
# 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 ap... | bzz/kythe | .ycm_extra_conf.py | Python | apache-2.0 | 9,245 | 0.008329 |
# coding=utf-8
from spec.python import db_connection
import operator
import pytest
from datetime import datetime
from sam.pages.rules import Rules, RulesApply, RulesEdit, RulesNew
from sam.models.security import rules, rule_template, ruling_process
from sam import errors
db = db_connection.db
sub_id = db_connection.de... | JoePelz/SAM | spec/python/pages/test_rules.py | Python | gpl-3.0 | 19,920 | 0.001908 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/libiconv/package.py | Python | lgpl-2.1 | 2,156 | 0.000464 |
__author__ = 'sianwahl'
from string import Template
class NedGenerator:
def __init__(self, number_of_channels):
self.number_of_channels = number_of_channels
def generate(self):
return self._generate_tuplefeeder_ned(), self._generate_m2etis_ned()
def _generate_tuplefeeder_ned(self):
... | ClockworkOrigins/m2etis | configurator/configurator/NedGenerator.py | Python | apache-2.0 | 6,119 | 0.001471 |
# -*- coding: utf-8 -*-
import json
from tg import request
from tgext.pluggable import app_model
from tgext.pyutilservice import Utility
from surveyobject import QuestionObject
class QuestionService(object):
def __init__(self):
self.utility = Utility()
pass
def create(self, **question... | tongpa/pypollmanage | pypollmanage/service/questionservice.py | Python | apache-2.0 | 1,641 | 0.014016 |
__source__ = 'https://leetcode.com/problems/minimum-window-substring/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/minimum-window-substring.py
# Time: O(n)
# Space: O(k), k is the number of different characters
# Hashtable
#
# Description: Leetcode # 76. Minimum Window Substring
#
# Given a string S and ... | JulyKikuAkita/PythonPrac | cs15211/MinimumWindowSubstring.py | Python | apache-2.0 | 7,107 | 0.001688 |
import re
import requests
from livestreamer.compat import urlparse
from livestreamer.exceptions import PluginError, NoStreamsError
from livestreamer.plugin import Plugin
from livestreamer.stream import RTMPStream, HTTPStream
from livestreamer.utils import urlget, urlresolve, prepend_www
RTMP_URL = "rtmp://204.107.26.... | breunigs/livestreamer | src/livestreamer/plugins/filmon_us.py | Python | bsd-2-clause | 3,678 | 0.002719 |
import flask, functools, traceback, urllib
from .. import editor
NO_PROJECT_ERROR = 'No Project is currently loaded'
BAD_ADDRESS_ERROR = 'Bad address {address}'
BAD_GETTER_ERROR = 'Couldn\'t get address {address}'
BAD_SETTER_ERROR = 'Couldn\'t set value {value} at address {address}'
def single(method):
"""Decora... | rec/BiblioPixel | bibliopixel/control/rest/decorator.py | Python | mit | 2,062 | 0.00097 |
import time
def import_grid(file_to_open):
grid = []
print(file_to_open)
with open(file_to_open) as file:
for i, line in enumerate(file):
if i == 0:
iterations = int(line.split(" ")[0])
delay = float(line.split(" ")[1])
else:
... | tburrows13/Game-of-Life | tools.py | Python | mit | 771 | 0 |
from __future__ import print_function
# http://pyrocko.org - GPLv3
#
# The Pyrocko Developers, 21st Century
# ---|P------/S----------~Lg----------
import sys
import logging
import os.path as op
from optparse import OptionParser
from pyrocko import util, scenario, guts, gf
from pyrocko import __version__
logger = lo... | pyrocko/pyrocko | src/apps/colosseo.py | Python | gpl-3.0 | 7,525 | 0 |
from string import Template
import re
import os
import sys
import time
import json
import math
import os
import subprocess
import csv
def saveResults(resultsList, json_fname, csv_fname):
print(resultsList)
print(json.dumps(resultsList, indent=4, sort_keys=True))
with open(json_fname, 'w') as outfile:
... | ECP-CANDLE/Supervisor | workflows/async-search/python/utils.py | Python | mit | 594 | 0.001684 |
from UserDict import UserDict
class odict(UserDict):
def __init__(self, dict = None):
self._keys = []
UserDict.__init__(self, dict)
def __delitem__(self, key):
UserDict.__delitem__(self, key)
self._keys.remove(key)
def __setitem__(self, key, item):
UserDict.__setit... | billiob/papyon | papyon/util/odict.py | Python | gpl-2.0 | 1,321 | 0.006056 |
"""Functionality for manipulating multiple grism exposures simultaneously
"""
import os
import time
import glob
from collections import OrderedDict
import multiprocessing as mp
import scipy.ndimage as nd
import numpy as np
import matplotlib.pyplot as plt
from astropy.table import Table
import astropy.io.fits as pyfi... | albertfxwang/grizli | grizli/multifit.py | Python | mit | 180,455 | 0.010662 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# vertexdomain.py
#
# Copyright 2016 notna <notna@apparat.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; either version 2 of the ... | not-na/peng3d | docs/pyglet/graphics/vertexdomain.py | Python | gpl-2.0 | 851 | 0.008226 |
# Copyright 2015 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... | nburn42/tensorflow | tensorflow/python/ops/linalg_grad.py | Python | apache-2.0 | 14,666 | 0.009 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Category'
db.create_table(u'core_category', (
... | jplusplus/dystopia-tracker | app/core/migrations/0001_initial.py | Python | lgpl-3.0 | 9,322 | 0.008904 |
#!/usr/bin/env python3
"""
The MIT License (MIT)
Copyright (c) 2016 davide
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, co... | raspibo/Livello1 | var/www/cgi-bin/valori2csv_search_date.py | Python | mit | 2,996 | 0.010013 |
import numpy as np
import cv2, csv, os, re, sys, time, argparse, datetime
'''
started 25 August 2015
31 August 2015:
modifying script so that it queries frames from a video taken with ffmpeg
10 Nov 2015
modifying for use in low light LCD tank (filters over the four flourescent light)
assumes there are four 'parts'... | lukereding/mateChoiceTracking | low_light_tracker.py | Python | apache-2.0 | 17,260 | 0.025203 |
from django.conf.urls import url, include
from snippets import views
from rest_framework.routers import DefaultRouter
# Create a router and register our viewsets with it.
router = DefaultRouter()
router.register(r'snippets', views.SnippetViewSet)
router.register(r'users', views.UserViewSet)
# The API URLs are now det... | bertrandvidal/stuff | djangoprojects/django_rest_framework/tutorial/snippets/urls.py | Python | unlicense | 568 | 0.001761 |
import re
from netlib.http import headers
def decode(hdrs, content):
"""
Takes a multipart boundary encoded string and returns list of (key, value) tuples.
"""
v = hdrs.get("content-type")
if v:
v = headers.parse_content_type(v)
if not v:
return []
try:
... | dufferzafar/mitmproxy | netlib/http/multipart.py | Python | mit | 898 | 0.001114 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.