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 |
|---|---|---|---|---|---|
'''
Hello student. Thank you for downloading a CORGIS library. However, you do not need to open this library. Instead you should use the following:
import suicide_attacks
If you opened the file because you are curious how this library works, then well done! We hope that you find it a useful learning experienc... | RealTimeWeb/datasets | datasets/python/suicide_attacks/suicide_attacks.py | Python | gpl-2.0 | 9,512 |
class Instance():
def __init__(self, conn):
self.conn = conn
def prepare():
pass
def put_config():
pass
def status():
pass
def terminate():
pass
def is_master():
pass
def run_slave(instance):
pass
def run_master(instance):
... | kamil/locust_cloud | instance.py | Python | mit | 457 |
import json
# Transliteration map from Cyrillic to Latin script
with open('milanbot/transliteration.json') as json_file:
cyrillic_transliteration = json.load(json_file)
# Supported languages that 'MilanBot' works with
with open('milanbot/languages.json') as json_file:
languages = json.load(json_file)
sparql... | milanjelisavcic/milanbot | milanbot/__init__.py | Python | unlicense | 743 |
from django.contrib.admin.widgets import ForeignKeyRawIdWidget
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
class AttachmentsWidgetBase(ForeignKeyRawIdWidget):
template_name = None
def render(self, name... | zdot/django-attachments | attachments/widgets.py | Python | bsd-3-clause | 1,476 |
#! /usr/bin/python
import compizconfig
from gi.repository import Gdk
screen= Gdk.Screen.get_default()
n = screen.get_number()
context = compizconfig.Context(n)
print context.CurrentProfile.Name
| jokerdino/unity-tweak-tool | notes/wizardry.py | Python | gpl-3.0 | 196 |
##
# Copyright 2009-2021 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | hpcugent/easybuild-framework | test/framework/sandbox/easybuild/easyblocks/o/openblas.py | Python | gpl-2.0 | 1,222 |
# Copyright 2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test maasserver nodes views."""
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
str = None
__metaclass__ = type
__all__ = []
fr... | cloudbase/maas | src/maasserver/tests/test_views_tags.py | Python | agpl-3.0 | 6,530 |
# Github: https://github.com/minfun/leetcode
# Email: nowican@live.com
# Link: https://leetcode.com/problems/add-two-numbers/#/description
import unittest
from leetcode.no2_add_two_numvers import Solution
from leetcode.no2_add_two_numvers import LinkedList
class Test(unittest.TestCase):
def setUp(self):
... | minfun/leetcode | tests/test_no2_add_two_numbers.py | Python | mit | 787 |
from tastypie import fields
from tastypie.resources import ModelResource
from plank.models import Service, Category, Status, Event
from tastypie.constants import ALL, ALL_WITH_RELATIONS
from tastypie.authentication import BasicAuthentication
from tastypie.authorization import DjangoAuthorization
# Authentication clas... | sijis/django-plank | plank/api.py | Python | mit | 2,341 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-28 09:24
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('catalog', '0010_auto_20170928_0610'),
]
operations... | PairMhai/Backend | catalog/migrations/0011_auto_20170928_0924.py | Python | agpl-3.0 | 2,785 |
__author__ = 'Bohdan Mushkevych'
from odm.document import BaseDocument
from odm.fields import StringField, ObjectIdField, IntegerField, DictField, DateTimeField
TYPE_MANAGED = 'type_managed' # identifies UOW created by Abstract State Machine child for Managed Process
TYPE_FREERUN = 'type_freerun' ... | mushkevych/scheduler | synergy/db/model/unit_of_work.py | Python | bsd-3-clause | 4,120 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
import numpy
import sys
from sklearn import metrics
class DCASE2016_SceneClassification_Metrics():
"""DCASE 2016 scene classification metrics
Examples
--------
>>> dcase2016_scene_metric = DCASE2016_SceneClassification_Metrics(class_lis... | rohit21122012/DCASE2013 | runs/2016/dnn2016med_traps/traps9/src/evaluation.py | Python | mit | 43,426 |
"""
# 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... | OBIGOGIT/etch | binding-python/runtime/src/main/python/etch/binding/util/URLSerializer.py | Python | apache-2.0 | 2,249 |
import pylab as plt
mySamples = []
myLinear = []
myQuadratic = []
myCubic = []
myExponential = []
for i in range(30):
mySamples.append(i)
myLinear.append(i)
myQuadratic.append(i**2)
myCubic.append(i**3)
myExponential.append(1.5**i)
plt.figure('lin')
plt.clf()
plt.ylim(0, 1000)
plt.plot(mySamples,... | Mdlkxzmcp/various_python | Alpha & Beta/Mathplotnumpypandas/MIT6001.py | Python | mit | 1,655 |
# Copyright (C) 2010 Google 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... | palladius/gcloud | packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/discovery.py | Python | gpl-3.0 | 26,209 |
import datetime
import pandas as pd
df = pd.io.parsers.read_csv("labdata_2014-07-10_2.csv")
grouped = df.groupby(['patient', 'lab_id'])
for name, group in df.groupby(['patient', 'lab_id']):
m = group.lab_dmy.dropna().min()
group['diff2'] = pd.to_datetime(group['lab_dmy']) - pd.to_datetime(m)
group.to_cs... | davidmatten/eva | prepare_data/transform/transform_v0.1.py | Python | gpl-2.0 | 359 |
# -*- coding: utf-8 -*-
from eclcli.common import command
from eclcli.common import exceptions
from eclcli.common import utils
from eclcli.identity import common as identity_common
from ..sssclient.common.utils import objectify
class ListContract(command.Lister):
def get_parser(self, prog_name):
parser =... | anythingrandom/eclcli | eclcli/sss/v1/contract.py | Python | apache-2.0 | 6,670 |
import pickle
import datetime
import ml.shallow_model as sm
import ml.deep_model as dl
import data_gen as dg
import sys
import numpy as np
import threading
parameter_class = 'HRV,SPE,MOR(3)R'
threshold = 1.3
fold = 5
mode = parameter_class + '_' + str(threshold) + '_' + str(fold)
def pos_counter(Y):
cnt = 0
for ... | RichardLeeK/MachineLearning | MachineLearning/CBFV/CBFVCV.py | Python | mit | 2,229 |
# vi: ts=8 sts=4 sw=4 et
#
# support.py: test support for draco2.model
#
# This file is part of Draco2. Draco2 is free software and is made available
# under the MIT license. Consult the file "LICENSE" that is distributed
# together with this file for the exact licensing terms.
#
# Draco2 is copyright (c) 1999-2007 by ... | geertj/draco2 | draco2/model/test/support.py | Python | mit | 972 |
# -*- coding: utf-8 -*-
import subprocess
import sys
import os.path
import re
import math
import spot
from IPython.display import SVG
from datetime import datetime
import pandas as pd
from experiments_lib import hoa_to_spot, dot_to_svg, pretty_print
def bogus_to_lcr(form):
"""Converts a formula as it is printed in... | jurajmajor/ltl3hoa | Experiments/ltlcross_runner.py | Python | gpl-3.0 | 23,066 |
import sys
import pdb
from numpy import *
import math
import argparse
parser = argparse.ArgumentParser(description='Analysis and assessment of variant information content (vic)')
parser.add_argument('inputfile', metavar='INPUTFILE', type=str, help='The input file')
parser.add_argument('--fcol', type=int, default=4, he... | dimenwarper/vic | vic_analysis.py | Python | gpl-2.0 | 2,860 |
import os
from xbmcswift2.logger import log
from xbmcswift2.mockxbmc import utils
def _get_env_setting(name):
return os.getenv('XBMCSWIFT2_%s' % name.upper())
class Addon(object):
def __init__(self, id=None):
# In CLI mode, xbmcswift2 must be run from the root of the addon
# directory, so w... | jbaiter/plugin.video.brmediathek | resources/lib/xbmcswift2/mockxbmc/xbmcaddon.py | Python | gpl-3.0 | 1,905 |
from uwsgiconf.config import Section, configure_uwsgi
uwsgi_configuration = configure_uwsgi(lambda: Section())
| idlesign/uwsgiconf | tests/confs/dummyone.py | Python | bsd-3-clause | 113 |
import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="font", parent_name="indicator.title", **kwargs):
super(FontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/indicator/title/_font.py | Python | mit | 1,514 |
# -*- coding: utf-8 -*-
from IPython.core.display import Javascript, HTML, display_javascript, display_html
def setup_notebook():
# assign text/x-c++src MIME type to pybind11 cells
code = """
require(['notebook/js/codecell'], function(cc) {
cc.CodeCell.options_default.highlight_modes['magic_text/... | aldanor/ipybind | ipybind/notebook.py | Python | mit | 661 |
"""
You should probably just ignore this ...
"""
import struct
from ppci.wasm.wasm2ppci import create_memories
from ppci.wasm.runtime import create_runtime
from ppci.wasm import
wasm_data = open('rocket.wasm', 'rb').read()
wasm_module = Module(wasm_data)
memories = create_memories(wasm_module)
rt = create_runtime()
... | stonebig/winpython_afterdoc | docs/WASM_almar_klein_demo/play_python.py | Python | mit | 1,902 |
from __future__ import absolute_import
from .array import * # NOQA
from .bounded import * # NOQA
from .citext import * # NOQA
from .encrypted import * # NOQA
from .foreignkey import * # NOQA
from .jsonfield import * # NOQA
from .gzippeddict import * # NOQA
from .node import * # NOQA
from .pickle import * # NO... | mvaled/sentry | src/sentry/db/models/fields/__init__.py | Python | bsd-3-clause | 351 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import os
from shuup.addons import add_enabled_addons
BASE_DIR = os.getenv("SHUUP_WORKBEN... | suutari/shoop | shuup_workbench/settings/base_settings.py | Python | agpl-3.0 | 6,077 |
#!/usr/bin/env python3
# Copyright (c) 2016-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Create a blockchain cache.
Creating a cache of the blockchain speeds up test execution when running
mu... | ericshawlinux/bitcoin | test/functional/create_cache.py | Python | mit | 826 |
#!/usr/bin/python
#
# Convert an 84x48 image into a bitmap suitable for use on SkyDrop.
# The image must be in an arbitrary format understood by ImageMagick and
# in b/w format. Anything in "white" will be transparent and any other
# color will be "black".
#
# If you only give a single input file (and no output file), ... | dpsfotocestou/SkyDrop | skydrop/utils/img/convert-image-to-LOGO.py | Python | gpl-2.0 | 3,061 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# filename: tops_sql.py
# Copyright 2008-2010 Stefano Costa <steko@iosa.it>
#
# This file is part of Total Open Station.
#
# Total Open Station is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by ... | BackupTheBerlios/tops | totalopenstation/output/tops_sql.py | Python | gpl-3.0 | 2,442 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2016-2019 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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... | unioslo/cerebrum | Cerebrum/rest/server.py | Python | gpl-2.0 | 2,520 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | eliasdesousa/indico | indico/modules/users/controllers.py | Python | gpl-3.0 | 24,412 |
#!/usr/bin/python3
#
# CherryMusic - a standalone music server
# Copyright (c) 2012 - 2014 Tom Wallroth & Tilman Boerner
#
# Project page:
# http://fomori.org/cherrymusic/
# Sources on github:
# http://github.com/devsnd/cherrymusic/
#
# CherryMusic is based on
# jPlayer (GPL/MIT license) http://www.jplayer.org/
#... | andpp/cherrymusic | audiotranscode/test/test_transcode.py | Python | gpl-3.0 | 2,593 |
"""A variety of useful functions to keep Python scripts powerful while short and sweet.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/borgesp/pypi-pmb
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
#fr... | borgesp/pypi-pmb | setup.py | Python | gpl-3.0 | 4,557 |
import os, uuid
def generate(filename, depth=2, base=512):
if os.path.sep in filename:
path, filename = os.path.split(filename)
else:
path = None
dummyhash = sum(ord(c)*256**(i % 4) for i,c in enumerate(filename)) % base**depth
folders = []
for level in range(depth-1,-1,-1)... | Titosoft/ferry-boat | web2py/gluon/recfile.py | Python | mit | 2,105 |
from ase import Atoms
from ase.constraints import FixLinearTriatomic
from ase.calculators.acn import (ACN, m_me,
r_mec, r_cn)
from ase.md import Langevin
import ase.units as units
from ase.io import Trajectory
import numpy as np
pos = [[0, 0, -r_mec],
[0, 0, 0],
[0, 0, ... | miroi/open-collection | theoretical_chemistry/software_runs/ase/runs/acn_equil/acn_equil.py | Python | mit | 2,006 |
#! /usr/bin/env python
# -*- encoding: utf-8 -*-
# vim:fenc=utf-8:
from mole.event import Event
from mole.action import Action, ActionSyntaxError
from mole.parser import Parser
class ActionParser(Parser):
"""This action parse the pipeline using specific parser
:param `name`: a list with string representation... | ajdiaz/mole | mole/action/parser.py | Python | gpl-3.0 | 983 |
# encoding: UTF-8
from vnpy.trader import vtConstant
from .tkproGateway import TkproGateway
gatewayClass = TkproGateway
gatewayName = 'TKPRO'
gatewayDisplayName = 'TKPRO'
gatewayType = vtConstant.GATEWAYTYPE_EQUITY
gatewayQryEnabled = True
| harveywwu/vnpy | vnpy/trader/gateway/tkproGateway/__init__.py | Python | mit | 242 |
"""This module contains various functions usued internally to process colours,
mainly for validation pruposes currently."""
import colorsys
def process_color(color):
"""Raises exceptions if a colour does not meet requirements.
:param str color: The colour to check.
:raises TypeError: if the colour is not... | samirelanduk/omnicanvas | omnicanvas/color.py | Python | mit | 2,764 |
import pytest
from tests.utils.loop import CounterLoop
@pytest.fixture(autouse=True)
def _(module_launcher_launch):
pass
def test_move_from_rep1(module_launcher):
module_launcher.create_file('default', 'to_move1')
module_launcher.move_file('default', 'to_move1', 'moved1',
... | onitu/onitu | tests/functional/core/test_move.py | Python | mit | 2,480 |
import unittest
from tests import mock
import pyglet.clock
class ClockTestCase(unittest.TestCase):
"""Test clock using dummy time keeper
not tested:
positional and named arguments
"""
def setUp(self):
self.interval = .001
self.time = 0
self.callback_a = mock.Mock()
... | nicememory/pie | pyglet/tests/unit/test_clock.py | Python | apache-2.0 | 13,923 |
import os, sys; sys.path.append(os.path.join("..", "..", ".."))
import re
from pattern.web import Google, URL
from pattern.web import Document, plaintext
# An interesting experiment on how to use the Google API
# and http://amplicate.com for opinion mining.
# (let's hope we get a real Amplicate API soon!)
query = "... | agermanidis/Pattern | examples/01-web/10-amplicate.py | Python | bsd-3-clause | 1,645 |
import os
import re
import shutil
from datetime import datetime
import config
import database
import thetvdb
import utility
from file_matcher import SeriesMatcher
from file_matcher import MovieMatcher
RECENT_ADDITIONS = "_Recent Additions"
PY_TIVO_METADATA_EXT = ".txt"
SERIES_FILE_NAME='%s-s%02i_e%03i.%s'
MOVIE_FI... | mrtrumbe/meliman | file_manager.py | Python | bsd-3-clause | 10,724 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division, unicode_literals
##
## This is part of Pybble, a WMS (Whatever Management System) based on
## Jinja2/Haml, Werkzeug, Flask, and Optimism.
##
## Pybble is Copyright © 2009-2014 by Matthias Urlichs <matthias@urlichs.de>,
## it is li... | smurfix/pybble | pybble/core/models/__init__.py | Python | gpl-3.0 | 875 |
#!/usr/bin/env python
# vim: expandtab:tabstop=4:shiftwidth=4
"""
This is a script that gathers tags from instances and reports the status of the tags to zabbix
Usage:
ops-ec2-check-tags.py --aws-creds-profile profile1 --clusterid=testcluster --region=us-east-1
"""
# Ignoring module name
# pylint: disable=inval... | blrm/openshift-tools | scripts/monitoring/ops-ec2-check-tags.py | Python | apache-2.0 | 4,882 |
"""
Andrew Hill
MacArthur Lab - 2014
Functions for handling remapping between HGVS and genomic coordinates.
"""
import hgvs
import hgvs.utils
from pygr.seqdb import SequenceFileDB
import os
import sys
import re
from macarthur_core.io import file_io
from macarthur_core.lovd import utilities
class VariantRemapper:
... | macarthur-lab/leiden_sc | leiden_sc/macarthur_core/remapping/remapping.py | Python | bsd-3-clause | 5,674 |
import traces
import pytest
@pytest.mark.mpl_image_compare(
savefig_kwargs={'bbox_inches': 'tight', 'dpi': 300},
remove_text=True,
style='ggplot',
tolerance=20,
)
def test_plot():
ts = traces.TimeSeries()
ts[0] = 0
ts[1] = 2
ts[3] = 1
ts[5] = 0
figure, axes = ts.plot()
... | datascopeanalytics/traces | tests/test_plot.py | Python | mit | 760 |
"""
This tutorial introduces denoising auto-encoders (dA) using Theano.
Denoising autoencoders are the building blocks for SdA.
They are based on auto-encoders as the ones used in Bengio et al. 2007.
An autoencoder takes an input x and first maps it to a hidden representation
y = f_{\theta}(x) = s(Wx+b), paramete... | webeng/DeepLearningTutorials | code/dA_v2.py | Python | bsd-3-clause | 16,442 |
# Copyright 2011 the Melange 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 wr... | rhyolight/nupic.son | app/soc/modules/gsoc/models/project.py | Python | apache-2.0 | 5,610 |
from __future__ import division
fornac_template = """
<!DOCTYPE html>
<meta charset="utf-8">
This is an RNA container.
<div id='rna_ss'> </div>
This after the RNA container.
<link rel='stylesheet' type='text/css' href='https://raw.githubusercontent.com/pkerpedjiev/fornac/master/css/fornac.css' />
<script typ... | ViennaRNA/forgi | forgi/visual/fornac.py | Python | gpl-3.0 | 4,307 |
# The code below is written from the following youtube tutorial
# https://www.youtube.com/playlist?list=PLRyu4ecIE9tibdzuhJr94uQeKnOFkkbq6
# References for the variables used
# shape/ layerSize is architecture of the neural network. ex: (4,3,2,1) means 4 units at input, 3 units at hidden layer 1, 2 units at hidden ... | tejesh95/NeuralNetworks | Neural.py | Python | unlicense | 8,999 |
import os
import unittest
from math import pi
import numpy
from kiva import agg
def save_path(filename):
return filename
def draw_arcs(gc, x2, y2, radiusstep=25.0):
gc.set_stroke_color((0.2,0.2,0.2)) # lightgray
gc.move_to(0, 0)
gc.line_to(100, 0)
gc.line_to(x2, y2)
gc.stroke_path()
gc... | tommy-u/enable | integrationtests/kiva/agg/test_arc.py | Python | bsd-3-clause | 3,344 |
import arcpy, os, sys
| gcsadovy/generalPY | test3.py | Python | gpl-3.0 | 23 |
"""
sentry.testutils.cases
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
__all__ = (
'TestCase', 'TransactionTestCase', 'APITestCase', 'AuthProviderTestCase',
'RuleTest... | zenefits/sentry | src/sentry/testutils/cases.py | Python | bsd-3-clause | 14,473 |
# Generated by Django 2.1.7 on 2019-03-09 11:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("campaign", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="campaign",
name="description",
... | fin/froide | froide/campaign/migrations/0002_auto_20190309_1241.py | Python | mit | 687 |
#
# 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 us... | mxm/incubator-beam | sdks/python/apache_beam/examples/complete/distribopt.py | Python | apache-2.0 | 13,825 |
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from optparse import make_option
class Command(BaseCommand):
"""Create a user.
"""
args = '<name email password>'
help = 'Create a user with specified attributes'
option_list = BaseCommand.option_list ... | orontee/porte-monnaie | site/tracker/management/commands/createuser.py | Python | gpl-3.0 | 1,075 |
import pymysql
from flask_restful import Resource
from flask import abort
ALLOWED_SHOW = ('processlist', 'databases', 'plugins', 'privileges')
class Mysql(Resource):
def __init__(self):
self.connection = pymysql.connect(user='root')
self.cursor = self.connection.cursor()
def _execute(self, s... | natict/roomservice | roomservice/mysql.py | Python | mit | 1,306 |
#!/usr/bin/env python
# encoding: utf-8
"""
Reboot a droplet.
"""
import pyocean
import time
import os
# Put your DigitalOcean access token here or set from environment variables
ACCESS_TOKEN = '' or os.getenv('ACCESS_TOKEN')
DROPLET_ID = '' or os.getenv('DROPLET_ID')
try:
digitalocean = pyocean.DigitalOcean(AC... | fxdgear/pyocean | examples/droplet-reboot.py | Python | mit | 562 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.http_routing.models.ir_http import slugify
from odoo import api, fields, models
class Page(models.Model):
_name = 'website.page'
_inherits = {'ir.ui.view': 'view_id'}
_inherit = 'website.pu... | ygol/odoo | addons/website/models/website_page.py | Python | agpl-3.0 | 8,632 |
import threading
import time
import random
SLEEP = True
counter = 0
# Making race conditions visible by introducing sleep time periods
def sleep_for_a_while():
if SLEEP:
time.sleep(random.random())
def worker():
global counter
sleep_for_a_while()
old_counter = counter
sleep_for_a_while... | rcanepa/cs-fundamentals | python/multiprocessing_multithreading/basic_threading.py | Python | mit | 755 |
# hard coded database parameters aren't we doing something bad
# should fix it later
def create_surrounding_hex(x, y, hexagon_size):
import pymongo
client = pymongo.MongoClient('candygram',27017)
db = client.map
hex_tiles_search = db.hex_tiles
hexagon_segment_one = hexagon_size / 4
hexagon_se... | erictheitguy/hexgenelife | theory/create_hex.py | Python | gpl-3.0 | 15,343 |
import datetime
from django.contrib import admin
from django.contrib.admin.models import LogEntry
from django.contrib.admin.options import IncorrectLookupParameters
from django.contrib.admin.templatetags.admin_list import pagination
from django.contrib.admin.tests import AdminSeleniumTestCase
from django.contrib.admin... | edmorley/django | tests/admin_changelist/tests.py | Python | bsd-3-clause | 38,622 |
import pytest
import os
import json
import utils
from utils import kfp_client_utils
from utils import minio_utils
from utils import sagemaker_utils
@pytest.mark.parametrize(
"test_file_dir",
[pytest.param("resources/config/kmeans-mnist-hpo", marks=pytest.mark.canary_test)],
)
def test_hyperparameter_tuning(
... | kubeflow/kfp-tekton-backend | components/aws/sagemaker/tests/integration_tests/component_tests/test_hpo_component.py | Python | apache-2.0 | 4,223 |
#! /usr/bin/env python
###############################################################################
#
# simulavr - A simulator for the Atmel AVR family of microcontrollers.
# Copyright (C) 2001, 2002 Theodore A. Roth
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of th... | simark/simulavr | regress/test_opcodes/test_LD_Y_decr.py | Python | gpl-2.0 | 3,084 |
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# ------------------------------------------------------... | marmyshev/item_title | openlp/plugins/images/lib/__init__.py | Python | gpl-2.0 | 2,176 |
import pandas as pd
import logging, os
import ipaddress
#from pprint import pprint
#results = []
#with open('http.log') as inputfile:
# for row in csv.reader(inputfile):
# results.append(row)
#with pandas to pull stats if you want by higest nlargest lowest nsmallest
log = logging.getLogger(__name__)
class ... | jzadeh/chiron-elk | parsers/broingest.py | Python | apache-2.0 | 2,439 |
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
try:
from PyQt4.QtGui import QApplication, QKeySequence
except ImportError:
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QKeySequence
from pygs import QxtGlobalShortcut
def hotkeyBinding():
SHORTCUT_SHOW = "Ctrl+Alt+S" # ... | LeunamBk/translatorPy | globalHotkeys.py | Python | gpl-3.0 | 950 |
import json
from urllib import urlencode
from social_auth.backends import BaseOAuth2, OAuthBackend
from social_auth.utils import dsa_urlopen
class AppsfuelBackend(OAuthBackend):
name = 'appsfuel'
def get_user_id(self, details, response):
return response['user_id']
def get_user_details(self, resp... | AppsFuel/django-social-auth-appsfuel | django_social_auth_appsfuel/backend.py | Python | bsd-3-clause | 1,775 |
#!/usr/bin/env python
#
# Copyright 2005,2007,2010,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr, gr_unittest, filter, blocks
class test_single_pole_iir_filter(gr_unittest.TestCase):
def setUp (self):
self... | skoslowski/gnuradio | gr-filter/python/filter/qa_single_pole_iir.py | Python | gpl-3.0 | 4,113 |
import wikipedia
from bot import command, msg
class WikiCmd(command.BotCommand):
def run(self, dest, contents):
if len(contents) < 2:
return msg.BotMsg('Usage: .wiki [search terms]')
search_str = ' '.join(contents[1:])
results = wikipedia.search(search_str)
if not results:
return msg.BotMsg('There wer... | federicotdn/python-tgbot | commands/wikipedia_cmd.py | Python | mit | 793 |
import numpy as np
from keras.layers import Activation, Dense
from keras.models import Sequential, model_from_json
from keras.optimizers import Adam
from . import dataset, utils
def train(summarize=False, data_limit=None):
X_train, y_train = dataset.Speech2Phonemes().load_train_data(limit=data_limit)
print(... | matthijsvk/multimodalSR | code/audioSR/Experiments/spoken-command-processor/model/speech2phonemes.py | Python | mit | 2,910 |
from p2pool.bitcoin import networks
from p2pool.util import math
# CHAIN_LENGTH = number of shares back client keeps
# REAL_CHAIN_LENGTH = maximum number of shares back client uses to compute payout
# REAL_CHAIN_LENGTH must always be <= CHAIN_LENGTH
# REAL_CHAIN_LENGTH must be changed in sync with all other clients
# ... | urpoapina/cpr-p2pool | p2pool/networks.py | Python | gpl-3.0 | 1,730 |
#!/usr/bin/env python
import pytest
import numpy as np
import sklearn.datasets as datasets
import sklearn.manifold as manifold
import pandas_ml as pdml
import pandas_ml.util.testing as tm
class TestManifold(tm.TestCase):
def test_objectmapper(self):
df = pdml.ModelFrame([])
self.... | sinhrks/expandas | pandas_ml/skaccessors/test/test_manifold.py | Python | bsd-3-clause | 3,754 |
"""
This contains the base class for the geometry engine, which proposes new positions
for each additional atom that must be added.
"""
from simtk import unit
import numpy as np
import networkx as nx
from perses.storage import NetCDFStorageView
########################################################################... | choderalab/perses | perses/rjmc/geometry.py | Python | mit | 141,869 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from urbansim.datasets.dataset import Dataset as UrbansimDataset
from opus_core.logger import logger
class NodeTravelDataDataset(UrbansimDataset):
id_name_default = ["from_node_id",... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim/datasets/node_travel_data_dataset.py | Python | gpl-2.0 | 1,176 |
#!/usr/bin/env python
'''
Copyright (c) 2016 anti-XSS developers
'''
class Links(object):
'''
Links class used as a global var.
'''
content = []
def __init__(self):
pass
def addText(self, text):
self.content.append(text)
def setContent(self, content):
self.conte... | lewangbtcc/anti-XSS | lib/var/links.py | Python | mit | 388 |
# -*- coding: utf-8 -*-
#
# scanpdf documentation build configuration file, created by
# sphinx-quickstart on Wed Oct 23 13:43:29 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... | virantha/scanpdf | docs/conf.py | Python | apache-2.0 | 10,696 |
# Bring in all of the public TensorFlow interface into this
# module.
# pylint: disable=wildcard-import
from tensorflow.python import *
| liyu1990/tensorflow | tensorflow/__init__.py | Python | apache-2.0 | 136 |
# maintained by triplefox
# Copyright (c) James Hofmann 2012.
# This file is part of pyspades.
# pyspades 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 optio... | Lensman/pysnip | feature_server/scripts/votekick.py | Python | gpl-3.0 | 10,354 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the tasks attribute containers."""
from __future__ import unicode_literals
import time
import unittest
import uuid
from plaso.containers import tasks
from tests import test_lib as shared_test_lib
class TaskTest(shared_test_lib.BaseTestCase):
"""Tests f... | rgayon/plaso | tests/containers/tasks.py | Python | apache-2.0 | 4,191 |
# This file is part of beets.
# Copyright 2012, Adrian Sampson.
#
# 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, ... | jimyx17/jimh | lib/beets/__init__.py | Python | gpl-3.0 | 801 |
# -*- 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 index on 'StatusCheckResult', fields ['time']
db.create_index('cabotapp_statuscheckresult', ['time'... | iurisilvio/cabot | cabot/cabotapp/migrations/0004_auto.py | Python | mit | 10,656 |
#!/usr/bin/env python
from datetime import date
class DataFileWriter:
def __init__(self, filename_base):
self.filename_base = filename_base
def get_filename(self):
return self.filename_base +"_" + date.today().strftime("%Y-%m-%d") + ".csv"
def append(self, value):
... | nosyjoe/tempomat | src/file_writer.py | Python | mit | 409 |
# -*- 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 field 'Subvention.unit_blank_user'
db.add_column(u'accounting_to... | ArcaniteSolutions/truffe2 | truffe2/accounting_tools/migrations/0003_auto__add_field_subvention_unit_blank_user__add_field_subvention_unit_.py | Python | bsd-2-clause | 10,405 |
# -*- coding: utf-8 -*-
# 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, software... | palmer159/openstack-test | packstack/plugins/ironic_275.py | Python | apache-2.0 | 4,394 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#use it to generate key table between date1 et date2
import datetime,os,subprocess,shlex,time
import thread
import threading
from hashlib import md5
import pickle
from cStringIO import StringIO
ratio_integer_value=60 #crucial parameter : 1 mean one key per second #30 m... | cellus-sas/heavy-encypted-chat | serverside_generating_pwd_table/run.py | Python | mit | 2,750 |
# Get the default preferences setup
DEFAULT_PREFERENCES = {'multiprocessing': False, # Should be False for non-qsub
'ram_integrate': False,
"flip_beam" : True, # Needed for XDS
"analysis": True, #Run analysis on processed data
"... | RAPD/RAPD | src/plugins/integrate/info.py | Python | agpl-3.0 | 866 |
# Copyright (C) 2012,2013
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or modify
# it under the terms of the G... | espressopp/espressopp | src/integrator/DPDThermostat.py | Python | gpl-3.0 | 1,962 |
'''
Split the regridded HI data from 14B-088 into individual channels.
'''
from casa_tools import ms_split_by_channel
vis = "/global/scratch/ekoch/combined/14B-088_HI_LSRK_AT0206_regrid.ms.contsub"
output_dir = "/global/scratch/ekoch/combined/14B-088_channel_ms/"
start_chan = 11
nchan = 205
ms_split_by_channel(vis... | e-koch/VLA_Lband | 14B-088/HI/archival_combination/14B-088_channel_split.py | Python | mit | 415 |
# Copyright (c) 2012 NetApp, 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 require... | theanalyst/cinder | cinder/tests/test_netapp_nfs.py | Python | apache-2.0 | 47,748 |
from .instruction import Instruction
from .level import Level
from .block import Block
from .toolbox import Toolbox
from .category import Category
from .task import Task
| adaptive-learning/flocs-web | tasks/models/__init__.py | Python | gpl-3.0 | 170 |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# 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 3 of the License, or
# (at your option) any later version.
# This program is distrib... | mcolom/ipolDevel | ipol_demo/modules/core/main.py | Python | agpl-3.0 | 2,239 |
#!/usr/bin/python
#
# Copyright 2015 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 b... | richardfergie/googleads-python-lib | examples/dfp/v201508/user_service/get_users_by_statement.py | Python | apache-2.0 | 1,698 |
"""SCons.Tool.BitKeeper.py
Tool-specific initialization for the BitKeeper source code control
system.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 200... | aubreyrjones/libesp | scons_local/scons-local-2.3.0/SCons/Tool/BitKeeper.py | Python | mit | 2,498 |
#!/usr/bin/env python
import socket,sys,gateway_cfg,select,socketserver,http.server,urllib
from threading import *
class WebHandler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
parseParams = urllib.parse.urlparse(self.path)
if parseParams.path=="/t" :
self.send_error(404,"You can't pass!!")
... | fucxy/fucxy-node | gateway/modules.py | Python | gpl-3.0 | 1,672 |
#!/usr/bin/env python
#coding:utf-8
import sys,os
from toughportal.common import utils
import shutil
import time
import random
import ConfigParser
def gen_secret(clen=32):
rg = random.SystemRandom()
r = list('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
return ''.join([rg.choice(r) for ... | talkincode/ToughPORTAL | toughportal/common/secret.py | Python | agpl-3.0 | 344 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import calendar
import csv
from datetime import datetime
import os
import argparse
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import and_
from constants import CONST
from models import Marker
from utilities import init_flask
import importmail
from xml.dom im... | boazin/anyway | united.py | Python | bsd-3-clause | 15,199 |
__author__ = 'Igor'
| Smart-Green/needle | tests/haystackClient/__init__.py | Python | apache-2.0 | 20 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.