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 |
|---|---|---|---|---|---|
#bot account token so it can log in
token = 'your token here'
#prefix for commands, (q!)hello for example
prefix = 'your prefix here'
#what the bot is 'playing
game = 'your game here'
| yvtea/Sandra | config.py | Python | gpl-3.0 | 184 |
"""
Contains all elements of this package. They act as the formal elements of the law.
"""
import json
import sys
def from_json(data):
"""
Reconstructs any `BaseElement` from its own `.as_json()`. Returns the element.
"""
def _decode(data_dict):
values = []
if isinstance(data_dict, str... | publicos-pt/pt_law_parser | pt_law_parser/expressions.py | Python | mit | 15,426 |
import os, sys, ntpath
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/testing_modules/'))
from file_generation import generate_files, make_directory
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/testing_modules/'))
from test_msh import mesh_file_test
from test_geo import geo_files_test... | adamcandy/QGIS-Meshing | tests/test_uk_main_cons5d.py | Python | lgpl-2.1 | 1,648 |
#!/usr/bin/env python
import os
os.system("tx push -s")
| scalio/liger-content | push-translations.py | Python | apache-2.0 | 58 |
# __init__.py - collection of Luxembourgian numbers
# coding: utf-8
#
# Copyright (C) 2012 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the Lic... | holvi/python-stdnum | stdnum/lu/__init__.py | Python | lgpl-2.1 | 940 |
#!/usr/bin/env python
# Test set domain max memory with API setMaxMemory.
from xml.dom import minidom
import libvirt
from libvirt import libvirtError
from src import sharedmod
required_params = ('guestname', 'memory', )
optional_params = {}
def set_maxmem_config(params):
"""set domain max memory, check with co... | ryanmiao/libvirt-test-API | repos/domain/set_maxmem_config.py | Python | gpl-2.0 | 1,769 |
# -*-python-*-
# GemRB - Infinity Engine Emulator
# Copyright (C) 2009 The GemRB Project
#
# 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) ... | jdm/gemrb | gemrb/GUIScripts/LUCommon.py | Python | gpl-2.0 | 15,820 |
from miasm2.core.graph import *
g = DiGraph()
g.add_node('a')
g.add_node('b')
g.add_edge('a', 'b')
g.add_edge('a', 'c')
g.add_edge('a', 'c')
g.add_edge('c', 'c')
print g
print [x for x in g.successors('a')]
print [x for x in g.predecessors('a')]
print [x for x in g.predecessors('b')]
print [x for x in g.predecessor... | p-l-/miasm | test/core/graph.py | Python | gpl-2.0 | 2,092 |
import logging
from .peakslib import *
logger = logging.getLogger('main.chk.osc..')
logger.debug("init logger")
def check_for_oscillation(data, band, pol, parset):
"""
:param data: recorded antenna data data
:param band: band to check
:param pol: polarity to check
:param parset: parameterset wit... | kernsuite-debian/lofar | LCU/checkhardware/checkhardware_lib/spectrum_checks/oscillation.py | Python | gpl-3.0 | 2,693 |
# encoding: utf-8
#
# 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/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import unicode_literals
from ac... | klahnakoski/ActiveData-ETL | activedata_etl/transforms/pulse_block_to_perfherder_logs.py | Python | mpl-2.0 | 6,710 |
#!/usr/bin/env python
#
# Olivier Soares
# January 2014
#
# Generate the documentation
#
# The MIT License (MIT)
#
# Copyright (c)2014-2016 Olivier Soares
#
# 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... | oliviersoares/tunp | script/doc.py | Python | mit | 1,879 |
"""
PyISYLink Helpers
"""
from .Tester import Tester
from .Foscam1 import Foscam1
from .DateAndTime import DateAndTime
from .Maker import Maker
from .FauxMo import FauxMo
from .PyHue import PyHue
from .PyHarmony import PyHarmony
class Helpers(object):
def __init__(self,logger,sched,co... | jimboca/ISYHelper | ISYHelper/Helpers/__init__.py | Python | apache-2.0 | 3,372 |
'''
@author: xiaowing
@license: Apache Lincese 2.0
'''
from flask import request, redirect, make_response
from app.sso import SSO_Page
import app.SsoEntity.LoginUser as LoginUser
class Signup_Page():
@classmethod
def signup_clicked(cls, username, password, email):
if not isinstance... | xiaowing/tinysso | app/signup.py | Python | apache-2.0 | 777 |
# -*- encoding: utf-8 -*-
'''
Created on 2012-3-22
@author: Neil
'''
import datetime
from StringIO import StringIO
import qiniu.io
import qiniu.rs
from PIL import Image
from django.db import models
from grnglow import settings
from album import Album
from grnglow.glow.models.usertag import UserTag
from tag import Tag... | restran/green-glow | grnglow/glow/models/photo.py | Python | mit | 9,245 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2009-TODAY Tech-Receptives(<http://www.techreceptives.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the... | mohamedhagag/community-addons | openeducat_erp/op_exam/__init__.py | Python | agpl-3.0 | 1,087 |
# -*- coding: utf-8 -*-
"""
This file is part of checkmate, a meta code checker written in Python.
Copyright (C) 2015 Andreas Dewes, QuantifiedCode UG
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Fou... | programmdesign/checkmate | checkmate/contrib/plugins/git/lib/repository.py | Python | agpl-3.0 | 19,633 |
from pymongo import MongoClient
from datetime import datetime, timedelta, date
def get_all_data():
mc = MongoClient()
db = mc.olap
data = []
today = str(date.today())
today_minus7 = str(date.today() - timedelta(days=7))
#get only week old ids
for i in db.post_history.find({"insights": {... | voldesh/cubed | cubesviewer/views/get_info.py | Python | mit | 909 |
#Calculating the inverse of a matrix
from numpy import *
a = array([ [4,1,-2], [2,-3,3], [-6,-2,1] ], dtype='float')
ainv = linalg.inv(a)
print (ainv)
print (dot(a,ainv))
| sposh-science/pycode-browser | Code/Maths/Arrays/inv.py | Python | gpl-3.0 | 172 |
"""Helpers for mobile_app."""
import json
import logging
from typing import Callable, Dict, Tuple
from aiohttp.web import Response, json_response
from nacl.encoding import Base64Encoder
from nacl.secret import SecretBox
from homeassistant.const import CONTENT_TYPE_JSON, HTTP_BAD_REQUEST, HTTP_OK
from homeassistant.co... | sdague/home-assistant | homeassistant/components/mobile_app/helpers.py | Python | apache-2.0 | 5,367 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from sasila.settings import default_settings
if sys.version_info < (3, 0):
import Queue
reload(sys)
sys.setdefaultencoding('utf-8')
else:... | DarkSand/Sasila | sasila/system_normal/downloader/web_driver_pool.py | Python | apache-2.0 | 1,197 |
"""Gaussian Mixture Model."""
# Author: Wei Xue <xuewei4d@gmail.com>
# Modified by Thierry Guillemot <thierry.guillemot.work@gmail.com>
import numpy as np
from scipy import linalg
from .base import BaseMixture, _check_shape
from ..externals.six.moves import zip
from ..utils import check_array
from ..utils.validatio... | olologin/scikit-learn | sklearn/mixture/gaussian_mixture.py | Python | bsd-3-clause | 23,400 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 25 20:51:00 2017
@author: sitibanc
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# =============================================================================
# Read CSV
# =============================================... | SitiBanc/1061_NCTU_IOMDS | 1025/Homework 5/HW5_1.py | Python | apache-2.0 | 4,936 |
from build.management.commands.base_build import Command as BaseBuild
from protein.models import Protein
from residue.models import Residue
from structure.functions import PdbStateIdentifier
from structure.models import *
import Bio.PDB as PDB
from collections import OrderedDict
class Command(BaseBuild):
def add_a... | cmunk/protwis | structure/management/commands/get_chain.py | Python | apache-2.0 | 753 |
# -*- coding: utf-8 -*-
# This file is part of the pymfony package.
#
# (c) Alexandre Quercia <alquerci@email.com>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
from __future__ import absolute_import;
import os.path;
import re;
from pick... | pymfony/pymfony | src/pymfony/component/config/resource.py | Python | mit | 5,243 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# MIT License. See license.txt
from __future__ import unicode_literals
"""
Customize Form is a Single DocType used to mask the Property Setter
Thus providing a better UI from user perspective
"""
import webnotes
from webnotes.utils import cstr
class DocType:
... | gangadhar-kadam/sapphite_lib | core/doctype/customize_form/customize_form.py | Python | mit | 8,959 |
import matplotlib.pyplot as plt
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.datasets import load_breast_cancer
import scikitplot as skplt
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.model_selection import cross_validate
# Load the data
cancer = load_b... | CompPhysics/MachineLearning | doc/src/SupportVMachines/Programs/gdclas.py | Python | cc0-1.0 | 1,327 |
# ===============================================================================
# Copyright 2017 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... | UManPychron/pychron | pychron/pipeline/plot/models/radial_model.py | Python | apache-2.0 | 1,030 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gazelasite.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Chartres/gazela | manage.py | Python | gpl-2.0 | 253 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from decimal import Decimal
from django.db import models, migrations
def no_op(apps, schema_editor):
pass
def set_null_prices(apps, schema_editor):
# We can't import the Person model directly as it may be a newer
# version than this migrat... | stbenjam/CTS | catalog/migrations/0004_set_null_prices_to_zero.py | Python | bsd-3-clause | 786 |
import os
import unittest
os.environ['SIMULATE_HARDWARE'] = '1'
os.environ['LOCK_SETTINGS_PATH'] = 'test-settings'
import db
from app import app
primary_pin = '1234'
sub_pin = '0000'
class AppTestCase(unittest.TestCase):
def setUp(self):
app.testing = True
self.app = app.test_client()
d... | remotelockbox/remotelockbox | app_test.py | Python | mit | 1,992 |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
"""
OO-based reader
"""
import posixpath
from warnings import warn
from openpyxl.xml.functions import fromstring
from openpyxl.packaging.relationship import get_dependents, get_rels_path
from openpyxl.packaging.manifest import Manifest
from o... | htwenhe/DJOA | env/Lib/site-packages/openpyxl/packaging/workbook.py | Python | mit | 3,274 |
#!/usr/bin/env python
#coding: utf-8
from __future__ import division, absolute_import, print_function, unicode_literals
from kasaya.core.lib import LOG, make_kasaya_id
class WorkerBase(object):
def __init__(self, is_host=False):
self.ID = make_kasaya_id(host=is_host)
| AYAtechnologies/Kasaya-esb | kasaya/core/worker/worker_base.py | Python | bsd-2-clause | 284 |
__author__ = 'Fabian'
import zipfile
class ModFile():
def __init__(self, path):
self.path = path
def check(self):
try:
zip = zipfile.ZipFile(self.path)
zip.testzip()
files = zip.namelist()
info = False
for file in files:
... | vlajos/FactorioManager | FactorioManager/ModFile.py | Python | mit | 668 |
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
ledpin = 18
GPIO.setup(ledpin, GPIO.OUT)
try:
while True:
GPIO.output(ledpin, 1)
time.sleep(0.5)
GPIO.output(ledpin, 0)
time.sleep(0.5)
except KeyboardInterrupt:
GPIO.cleanup()
| VA3SFA/rpi_hw_demo | led/blink.py | Python | gpl-2.0 | 312 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-07-01 09:21
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | waymao/SU-System | events/migrations/0001_initial.py | Python | gpl-3.0 | 1,494 |
import os
import re
import random
import hashlib
import hmac
from string import letters
import webapp2
import jinja2
from google.appengine.ext import db
template_dir = os.path.join(os.path.dirname(__file__), 'templates')
jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template_dir),
... | cdesk/Udacity-Blog | blog.py | Python | mit | 7,804 |
import turtle
for i in range(1,361):
turtle.left(1)
turtle.forward(1)
| sergeynikifforov/labs2016 | hexcircle.py | Python | gpl-3.0 | 74 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""A utility module for the update-bugtasktargetnamecaches.py cronscript."""
__metaclass__ = type
__all__ = ['BugTaskTargetNameCacheUpdater']
from collections import defaultdict
... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/bugs/scripts/bugtasktargetnamecaches.py | Python | agpl-3.0 | 5,645 |
#!/usr/bin/env python
from __future__ import print_function
from setuptools import setup, find_packages
from distutils.core import Command
import os
import re
import sys
import subprocess
# Generate version.py
with open('glue/version.py') as infile:
exec(infile.read())
# If the version is not stable, we can ad... | saimn/glue | setup.py | Python | bsd-3-clause | 4,848 |
#
# Author: Guillaume Pernot <gpernot@praksys.org>
#
# 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... | ChinaMassClouds/copenstack-server | openstack/src/ceilometer-2014.2.2/ceilometer/storage/sqlalchemy/migrate_repo/versions/004_add_counter_unit.py | Python | gpl-2.0 | 1,114 |
# -*- coding: utf-8 -*-
'''
Manage Windows Package Repository
'''
from __future__ import absolute_import
# Python Libs
import os
import stat
import itertools
# Salt Modules
import salt.runner
import salt.utils
import salt.config
def __virtual__():
return 'winrepo'
def genrepo(name, force=False, allow_empty=Fa... | smallyear/linuxLearn | salt/salt/states/winrepo.py | Python | apache-2.0 | 3,418 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api, fields
import log... | maljac/odoo-addons | product_bookstore/product.py | Python | agpl-3.0 | 2,549 |
import pygsty.models
import data
from models.map import TILE_SIZE
_cursor = None
def get_cursor():
return _cursor
class Cursor(pygsty.models.BaseModel):
def __init__(self, position):
super().__init__(position=position)
self.screen_offset_x = TILE_SIZE
self.screen_offset_y = TILE_SIZE
... | tredfern/terralien | models/cursor.py | Python | gpl-2.0 | 441 |
import html
from PyQt5.QtCore import Qt, QSize
from PyQt5.QtGui import QPalette
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QListWidget, QLabel, QSizePolicy, \
QListWidgetItem, QCheckBox, QLineEdit, QFormLayout, QFrame
from umlfri2.application import Application
from umlfri2.qtgui.base impo... | umlfri/umlfri2 | umlfri2/qtgui/newproject/newproject.py | Python | gpl-3.0 | 4,623 |
from Scene import Scene
from Utils.Log import Logger
from Sprite.Texture import Texture
from Sprite.Sprite import Sprite
class TestScene(Scene):
def __init__(self):
Scene.__init__(self)
self.sprite = Sprite("test1.png")
self.sprite.position = 100, 100
def update(self):
Scene.u... | choiseungil29/CLogic | Scene/TestScene.py | Python | apache-2.0 | 404 |
'''
Description
Wrapper to execute the program LDNe2.
'''
from builtins import object
__filename__ = "pgldnecontroller.py"
__date__ = "20170314"
__author__ = "Ted Cosart<ted.cosart@umontana.edu>"
import os
import agestrucne.pgutilities as pgut
import tempfile
'''
Constants used by the class objects.
2018_04_28. We ... | popgengui/negui | agestrucne/pgldne2controller.py | Python | agpl-3.0 | 17,470 |
# -*- encoding:utf-8 -*-
from network.protocol import protocol, pdef, pret
class GameToGate:
game_server_ready = protocol(
pdef('Int', 'gameid'),
)
create_player_client = protocol(
pdef('Int', 'cid'),
pdef('Eid', 'eid'),
pdef('Str', 'name'),
)
client_msg = protocol(
pdef('Int', 'cid'),
pdef('Eid', ... | dennisding/ether | protocols/game_to_gate.py | Python | apache-2.0 | 606 |
import datetime
from ecl.util.util import BoolVector
from ecl.util.test import TestAreaContext
from tests import ResTest
from res.enkf import ObsData, ObsBlock
from res.util import Matrix
class ObsDataTest(ResTest):
def test_create(self):
obs_data = ObsData()
obs_size = 10
block = obs_da... | andreabrambilla/libres | python/tests/res/enkf/test_obs_data.py | Python | gpl-3.0 | 1,295 |
import uuid
from mongoengine import Document, StringField, UUIDField, ListField
from django.conf import settings
from cripts.core.cripts_mongoengine import CriptsBaseAttributes, CriptsSourceDocument
from cripts.core.cripts_mongoengine import CriptsActionsDocument
class EmailAddress(CriptsBaseAttributes, CriptsSourc... | lakiw/cripts | cripts/email_addresses/email_address.py | Python | mit | 2,390 |
import matplotlib
matplotlib.use('Agg')
from collections import namedtuple
import matplotlib.pylab as plt
import numpy as np
import os.path
from pySDC.implementations.datatype_classes.mesh import mesh
from pySDC.implementations.problem_classes.HeatEquation_1D_FD import heat1d
# setup id for gathering the results (wi... | danielru/pySDC | tutorial/step_1/B_spatial_accuracy_check.py | Python | bsd-2-clause | 5,878 |
"""
kappa taken and adopted from skll
https://raw.githubusercontent.com/EducationalTestingService/skll/5ea61b8dfc23570e661468457a262b6c2242daa9/skll/metrics.py
"""
# License: BSD 3 clause
"""
This module contains a bunch of evaluation metrics that can be used to
evaluate the performance of learners.
:author: Michael ... | WojciechMigda/KAGGLE-prudential-life-insurance-assessment | src/skll.py | Python | mit | 8,675 |
#unit tests for Python bindings: ImageInput
import OpenImageIO as oiio
import array
def callback(fl):
pass
plugin_path = raw_input("Enter the oiio plugin search path (probably <trunk>/dist/ARCH/lib) :\n ")
#plugin_path = "/home/dgaletic/code/oiio-trunk/dist/linux/lib"
def ii_create_test():
print "Running I... | jeremyselan/oiio | src/python/unit_tests_image_input.py | Python | bsd-3-clause | 12,657 |
import re
import warnings
import numpy as np
import scipy.linalg
from scipy._lib._util import check_random_state
from ._rotation_groups import create_group
_AXIS_TO_IND = {'x': 0, 'y': 1, 'z': 2}
def _elementary_basis_vector(axis):
b = np.zeros(3)
b[_AXIS_TO_IND[axis]] = 1
return b
def _compute_euler_... | person142/scipy | scipy/spatial/transform/rotation.py | Python | bsd-3-clause | 75,566 |
# -*- coding: utf-8 -*-
"""
.. _ex-movement-detect:
=====================================================
Annotate movement artifacts and reestimate dev_head_t
=====================================================
Periods, where the participant moved considerably, are contaminated by low
amplitude artifacts. When ave... | mne-tools/mne-python | examples/preprocessing/movement_detection.py | Python | bsd-3-clause | 3,640 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2004 Robert Kaye
# Copyright (C) 2007 Lukáš Lalinský
# Copyright (C) 2008 Will
# Copyright (C) 2008, 2018-2019 Philipp Wolfer
# Copyright (C) 2009 david
# Copyright (C) 2013 Johannes Dewender
# Copyright (C) 2013 Sebastian Rama... | Sophist-UK/Sophist_picard | picard/util/cdrom.py | Python | gpl-2.0 | 4,197 |
# -*- coding: utf-8 -*-
"""c2s protocol handlers."""
"""
Kontalk XMPP server
Copyright (C) 2014 Kontalk Devteam <devteam@kontalk.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 ver... | daniele-athome/kontalk-legacy-xmppserver | kontalk/xmppserver/component/c2s/handlers.py | Python | gpl-3.0 | 16,001 |
import pickle
avgDD = pickle.load(file='test_data/DD_2017.txt')
print avgDD
| YashAgarwal/ipl_data_analytics | staticPredictions.py | Python | mit | 77 |
# -*- coding: utf-8 -*-
"""
:copyright: 2005-2008 by The PIDA Project
:license: GPL 2 or later (see README/COPYING/LICENSE)
"""
import subprocess
from pygtkhelpers.gthreads import GeneratorTask
class GeneratorSubprocessTask(GeneratorTask):
"""
A Generator Task for launching a subprocess
An exa... | fermat618/pida | pida/utils/gthreads.py | Python | gpl-2.0 | 1,205 |
"""
Classes for representing solutions to boundary value problems.
@author : davidrpugh
"""
class SolutionLike(object):
@property
def basis_kwargs(self):
return self._basis_kwargs
@property
def functions(self):
return self._functions
@property
def nodes(self):
retu... | davidrpugh/pyCollocation | pycollocation/solvers/solutions.py | Python | mit | 1,746 |
from pycp2k.inputsection import InputSection
class _point17(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Type = None
self.Atoms = []
self.Weights = []
self.Xyz = None
self._name = "POINT"
self._keywords = {'Xyz': 'XYZ', 'Type': 'TYPE'}... | SINGROUP/pycp2k | pycp2k/classes/_point17.py | Python | lgpl-3.0 | 397 |
# python3
# 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 ... | google/TaglessCRM | src/test/utils/retry_utils_test.py | Python | apache-2.0 | 4,722 |
import precis
from owlready2 import default_world, get_ontology
from resume_config import config
import os
def buildResume():
# Importing resume template
resume_template = precis.templating.PrecisTemplate(
template_folder=os.path.join(precis.config.templates_folder,
... | rukmal/Resume | scripts/build_resume.py | Python | mit | 954 |
#!/usr/bin/env python
#
#
import sys
#
# Use scipy to integrate:
#
# dy^2 / dt^2 = -g + r (dh/dt)^2 (object falling with drag)
#
from scipy.linalg import det, solve
from scipy.integrate import odeint
from scipy.integrate import simps
import scipy.stats
import numpy as np
from hpd import *
def deriv(h,t,param):
"... | nicholasmalaya/arcanus | uq/ps3/integral_alt.py | Python | mit | 2,523 |
import random
#1 represents a car
#0 represent a goat
stay = 0 #amount won if stay in the same position
switch = 0 # amount won if you switch
for i in range(1000):
lst = [1,0,0] # one car and two goats
random.shuffle(lst) # shuffles the list randomly
ran = random.randrange(3) # gets a ra... | aligoren/pyalgo | monty_hall_problem.py | Python | mit | 841 |
from collections import OrderedDict
from itertools import chain
from operator import attrgetter
from django.db import IntegrityError, connections, transaction
from django.db.models import signals, sql
from django.utils import six
class ProtectedError(IntegrityError):
def __init__(self, msg, protected_o... | diego-d5000/MisValesMd | env/lib/python2.7/site-packages/django/db/models/deletion.py | Python | mit | 14,090 |
"""Raster warping and reprojection"""
from rasterio._warp import _reproject, _transform, _transform_geom, RESAMPLING
from rasterio.transform import guard_transform
def transform(src_crs, dst_crs, xs, ys, zs=None):
"""Return transformed vectors of x, y and optionally z.
The sequences of points x, y, z in... | snorfalorpagus/rasterio | rasterio/warp.py | Python | bsd-3-clause | 1,802 |
# Copyright 2017 Battelle Energy Alliance, 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 t... | joshua-cogliati-inl/raven | tests/framework/ensembleModelTests/EM_C_dummy.py | Python | apache-2.0 | 692 |
"""
Machine shop example
Covers:
- Interrupts
- Resources: PreemptiveResource
Scenario:
A workshop has *n* identical machines. A stream of jobs (enough to
keep the machines busy) arrives. Each machine breaks down
periodically. Repairs are carried out by one repairman. The repairman
has other, less important ... | BengtOFFIS/simpy | docs/examples/code/machine_shop.py | Python | mit | 4,467 |
from events import AstroEvent
from events import AstroTime
from objects import AstroObject
from networks import AstroNetwork
from fields import AstroField
from locations import Distance
"""
Case study: The impacts of Supernova 2011fe
Sources:
http://cdsarc.u-strasbg.fr/viz-bin/Cat?J/other/NewA/20.30
https://arxiv.org/... | liangcun/ConceptsOfSpatialInformation | CoreConceptsPy/Astronomic_Spaces/case_examples/events/events_cases.py | Python | apache-2.0 | 2,681 |
"""This is the rsync command to backup entire head node
"""
import os
target = '/scratch_area/headnode_backup'
cmd = 'rsync -avz --exclude=/data_area --exclude=/scratch_area --exclude=/model_area --exclude=/snapshot_area --exclude=/proc --exclude=/cdrom / %s' % target
print cmd
os.system(cmd)
| uniomni/system_administration | cluster_management/rsync_headnode.py | Python | gpl-3.0 | 301 |
#-------------------------------------------------------------------------------
# Copyright (c) 2012 Gael Honorez.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0
# which accompanies this distribution, and is available at
# htt... | IDragonfire/modular-client | src/featuredmods/_featuredmod.py | Python | gpl-3.0 | 11,050 |
from mongrel2 import config
from mongrel2.config import args
import mongrel2.config.commands
from uuid import uuid4
from mongrel2.config import model
import getpass
import sys
import os
import signal
from sqlite3 import OperationalError
def try_reading(reader):
try:
cmd = reader.readline()
return ... | bnoordhuis/mongrel2 | examples/python/mongrel2/config/commands.py | Python | bsd-3-clause | 14,897 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2013 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either v... | sixuanwang/SAMSaaS | wirecloud-develop/src/wirecloud/platform/tests/__init__.py | Python | gpl-2.0 | 2,777 |
import os, sys
import time
import numpy as np
import scipy.signal as sg
#########################################################################
## Step 0 - Import Library
Tool_UtilFunc_DirStr = '../../../00_Tools/UtilFunc-1.0/';
Tool_SineModel_DirStr = '../../../00_Tools/SineModel-1.0/';
WavDirStr = '../../../../Cod... | EdwardLin2014/SingingVoiceDetection_Python | 04_iKalaProject/01_01_STFT/AmpMagdB_44100/STFTConf_1024_4096_256.py | Python | gpl-3.0 | 2,590 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
... | haad/ansible-modules-extras | network/f5/bigip_device_sshd.py | Python | gpl-3.0 | 10,290 |
#!/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 "Lic... | thammegowda/incubator-joshua | scripts/training/class-lm/replaceTokensWithClasses.py | Python | apache-2.0 | 1,574 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | CUFCTL/DLBD | face-detection-code/object_detection/utils/variables_helper.py | Python | mit | 5,566 |
# -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment import _deploy_template_sample_a
test_host = ('192.168.0.1... | frkwy/oozappa | sample/ops/staging/fabfile/__init__.py | Python | mit | 1,594 |
"""Implementation of the StyleGuide used by Flake8."""
import collections
import contextlib
import copy
import enum
import itertools
import linecache
import logging
import sys
from typing import Optional, Union
from flake8 import defaults
from flake8 import statistics
from flake8 import utils
__all__ = ("StyleGuide",... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/flake8/style_guide.py | Python | mit | 21,018 |
#!/usr/bin/env python
"""
Write TOF calibrations from file
This script must, and can, be run only from a micenet computer
Reads calibrations from a file and uploads them to the CDB
For protection against unintentional uploads, the filename is commented out
Set the appropriate filenames and uncomment the _CALIFILE set ... | mice-software/maus | bin/utilities/upload_scifi_calib.py | Python | gpl-3.0 | 2,074 |
# -*- coding: utf-8 -*-
from django.core import mail
from cms.api import create_page_user
from cms.test_utils.testcases import CMSTestCase
from cms.utils.compat.dj import get_user_model
from cms.utils.mail import mail_page_user_change
class MailTestCase(CMSTestCase):
def setUp(self):
mail.outbox = [] # r... | amaozhao/basecms | cms/tests/mail.py | Python | mit | 633 |
import math
import random
import numpy
from effectlayer import *
from effects.color_palette_library import *
from effects.specklayer import Speck
import random
class ColorPaletteBattleLayer(EffectLayer):
def __init__(self, model):
self.paletteLibrary = ColorPaletteLibrary()
self.initPalette(model)... | FlamingLotusGirls/soma | pier14/opc-client/effects/color_palette_battle.py | Python | apache-2.0 | 6,175 |
# ===============================================================================
# Copyright 2017 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/entry/tasks/basic/task.py | Python | apache-2.0 | 1,910 |
# -*- coding: utf-8 -*-
'''
CuBIC is a statistical method for the detection of higher order of
correlations in parallel spike trains based on the analysis of the
cumulants of the population count.
Given a list sts of SpikeTrains, the analysis comprises the following
steps:
1) compute the population histogram (PSTH) wi... | espenhgn/elephant | elephant/cubic.py | Python | bsd-3-clause | 6,875 |
# -*- coding: utf-8 -*-
import datetime
import hashlib
from math import log10, floor, isnan
try:
import json # try stdlib (Python 2.6)
except ImportError:
try:
import simplejson as json # try external module
except:
import gluon.contrib.simplejson as json # fallback to pure-Python module
... | devinbalkind/eden | modules/ClimateDataPortal/MapPlugin.py | Python | mit | 35,241 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
v0.1.2 2016/12/19 yilai 建表改成utf8mb4字符集
v0.1.1 2016/09/21 yilai 加了些参数
v0.1.0 2016/07/20 yilai created
"""
from datetime import datetime,date,timedelta
from decimal import Decimal
import traceback
import logging
from pymysqlreplication import BinLogStreamReader
... | 58daojia-dba/mysqlbinlog_flashback | joint_sql.py | Python | apache-2.0 | 10,015 |
import pytest
from abridger.schema import PostgresqlSchema
from alternate_primary_keys import TestAlternatePrimaryKeysBase as Base
from test.conftest import got_postgresql
@pytest.mark.skipif(not got_postgresql(), reason='Needs postgresql')
class TestPostgresqlAlternatePrimaryKeys(Base):
@pytest.mark.parametrize... | freewilll/abridger | test/postgresql/test_postgresql_alternate_primary_keys.py | Python | mit | 764 |
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from lettuce import world, step
from common import *
from nose.tools import assert_true, assert_false # pylint: disable=no-name-in-module
from logging import getLogger
logger = getLogger(__name__)
@step(u'I have a course with no sections$')... | rismalrv/edx-platform | cms/djangoapps/contentstore/features/course-outline.py | Python | agpl-3.0 | 4,647 |
import sys, os
pfile=open(sys.argv[1], 'r')
params = {}
for line in pfile:
paramname, paramvalue = line.split()
params[paramname[1:]]=paramvalue
os.system(params['PLINKPATH']+' --bfile '+params['INPUT']+' --extract '+params['ASSAYED']+' --indep-pairwise 1500 150 0.2 --out '+params['WORK']+'/thin')
os.system(para... | sallyrose0425/GWAS | QC/PCA.py | Python | mit | 1,255 |
# coding=utf-8
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import re
import logging
from flexget import plugin
from flexget.event import event
from flexget.components.sites.urlrewriting import UrlRewritingError
from... | gazpachoking/Flexget | flexget/components/sites/sites/serienjunkies.py | Python | mit | 7,683 |
#!/usr/bin/env python
# Copyright 2015 The Native Client 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 argparse
import difflib
import fnmatch
import multiprocessing
import os
import Queue
import re
import shlex
import subproce... | binji/pnacl.c | test/run-tests.py | Python | bsd-3-clause | 12,002 |
from tastypie import http
from tastypie.cache import NoCache
from tastypie.exceptions import ImmediateHttpResponse
from tastypie.throttle import CacheThrottle
class HttpCache(NoCache):
"""Cache class that sets cache-control to response headers."""
def __init__(self, control={'no_cache': True}, *args, **kwarg... | chirilo/remo | remo/api/__init__.py | Python | bsd-3-clause | 1,457 |
#!/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"); ... | chirino/activemq-apollo | apollo-distro/src/main/release/examples/stomp/python/stompest/sync/publisher.py | Python | apache-2.0 | 1,671 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.base.exce... | lahosken/pants | src/python/pants/backend/graph_info/tasks/target_filter_task_mixin.py | Python | apache-2.0 | 1,490 |
from collections import defaultdict
from inspect import isclass
from urllib.parse import urlsplit
from django import template
from django.contrib import auth
from django.db.models import Model
from django.urls import reverse
from django.utils.html import format_html, mark_safe # , conditional_escape
from django.utils... | CobwebOrg/cobweb-django | core/templatetags/cobweb_look.py | Python | mit | 6,164 |
<<<<<<< HEAD
<<<<<<< HEAD
"""Parser for command line options.
This module helps scripts to parse the command line arguments in
sys.argv. It supports the same conventions as the Unix getopt()
function (including the special meanings of arguments of the form `-'
and `--'). Long options similar to those supported by GN... | ArcherSys/ArcherSys | Lib/getopt.py | Python | mit | 22,604 |
# 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 ... | qorio/maestro | zookeeper/src/contrib/huebrowser/zkui/src/zkui/views.py | Python | apache-2.0 | 4,712 |
#!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test re-org scenarios with a mempool that contains transactions
# that spend (directly or indirectly) coin... | pouta/bitcoin | qa/rpc-tests/rawtransactions.py | Python | mit | 5,949 |
import csv
from pyspec import SpectrumData, SpectrumCollection
def from_line_file(filename, filter_negative=True):
"""
Loads linescan single file from directory
** needs input to be a fully qualified file path.
Returns a new list of tuples (x,y) containing points, where
x = wavenums and y = intensi... | danushkana/pyspectrum | linescan.py | Python | mit | 1,689 |
from django.contrib.auth import login as auth_login
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.shortcuts import redirect, render
from django.urls import reverse_lazy
from django.utils.decorators import method_decorator
from django.views.generic impo... | sibtc/django-beginners-guide | accounts/views.py | Python | mit | 1,070 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.