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 |
|---|---|---|---|---|---|
# test_lattices.py
import unittest
import pickle
from concepts.contexts import Context
class TestLattice(unittest.TestCase):
source = '''
|+1|-1|+2|-2|+3|-3|+sg|+pl|-sg|-pl|
1sg| X| | | X| | X| X| | | X|
1pl| X| | | X| | X| | X| X| |
2sg| | X| X| | | X| X| | | X|
... | pombredanne/concepts | tests/test_lattices.py | Python | mit | 3,163 |
from toontown.pets.PetConstants import AnimMoods
from toontown.pets import PetMood
import string
class PetBase:
def getSetterName(self, valueName, prefix = 'set'):
return '%s%s%s' % (prefix, string.upper(valueName[0]), valueName[1:])
def getAnimMood(self):
if self.mood.getDominantMood() in Pe... | ksmit799/Toontown-Source | toontown/pets/PetBase.py | Python | mit | 697 |
from distutils.core import setup
setup(
name = 'kinisot',
packages = ['kinisot'],
version = '1.0.1',
description = 'Compute Kinetic Isotope Effects from Gaussian09 output',
author = 'Robert Paton',
author_email = 'robert.paton@chem.ox.ac.uk',
url = 'https://github.com/bobbypaton/kinisot',
download_url... | bobbypaton/Kinisot | setup.py | Python | mit | 507 |
"""Contains logic that is unique to the horizontal grid lines."""
from lib.grid_lines import GridLines
class Horizontal(GridLines):
"""Contains logic that is unique to the horizontal grid lines."""
def __init__(self, image):
"""Build horizontal grid lines."""
super().__init__(image)
... | rafelafrance/boyd-bird-journal | lib/horizontal_lines.py | Python | mit | 850 |
# -*- coding: utf-8 -*-
# -*- encoding: utf-8 -*-
#############################################################################
#
# Copyright (c) 2007 Martin Reisenhofer <martin.reisenhofer@funkring.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... | funkring/fdoo | addons-funkring/commission/account.py | Python | agpl-3.0 | 2,168 |
#
# The Python Imaging Library.
# $Id: //modules/pil/PIL/PngImagePlugin.py#3 $
#
# PNG support code
#
# See "PNG (Portable Network Graphics) Specification, version 1.0;
# W3C Recommendation", 1996-10-01, Thomas Boutell (ed.).
#
# history:
# 1996-05-06 fl Created (couldn't resist it)
# 1996-12-14 fl Upgraded, added ... | fxia22/ASM_xf | PythonD/lib/python2.4/site-packages/display/PIL/PngImagePlugin.py | Python | gpl-2.0 | 12,421 |
#
# @BEGIN LICENSE
#
# QCDB: quantum chemistry common driver and databases
#
# Copyright (c) 2011-2017 The QCDB Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of QCDB.
#
# QCDB is free software; you can redistribute it and/or modify
# it ... | cdsgroup/qcdb | qcdb/qcformat.py | Python | lgpl-3.0 | 4,153 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from tempfile import mkdtemp
from ansible.module_utils.basic import *
def main():
module = AnsibleModule(
argument_spec = {
'suffix': {'default': ''},
'prefix': {'default': 'tmp'},
'dir': {'default': None},
}
)
... | zolkko/blumenplace-ansible | library/butils/mkdtemp.py | Python | gpl-3.0 | 667 |
import marshal
import logging
from winsys import exc, ipc
class MailslotHandler (logging.Handler):
ur"""A logging-compatible handler which will write to a named
mailslot. The data is marshalled before being sent which means
that only Python primitives may be sent, but allows, eg, None
to be used as a sentinel... | frankyrumple/ope | laptop_credential/winsys/logging_handlers.py | Python | mit | 1,503 |
__author__ = 'davide'
print("Hai giocato {1}, il pc ha giocato {2}, quindi {0}".format(
*(lambda s:
(lambda s1=s, s2=__import__("random").choice(["sasso", "carta", "forbici"]): ("Pareggio", s1, s2)
if s1 == s2 else ("hai perso... :(", s1, s2) if (s1, s2) in {
("sasso", "carta"), ("carta", "fo... | DavideCanton/Python3 | cazzate/morra.py | Python | gpl-3.0 | 433 |
import sqlite3
conn = sqlite3.connect('database name')
c=conn.cursor()
f=open("E:\extract nouns and verbs from google search items/Albert Camus.json")
import textrazor
textrazor.api_key = "textrazor API"
client = textrazor.TextRazor(extractors=["entities", "topics"])
def insert_in_Query_table():
try:
c.e... | mzmmoazam/Entity-Extraction-from-Google-searches-use-database- | insert_data.py | Python | apache-2.0 | 3,601 |
# coding=utf-8
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
from watchdog_id.auth_factories import SESSION_KEY, SESSION_IDENTIFIED_KEY, FACTORY_LIST_SESSION_KEY, Registry
from watchdog_id.auth_factories.shortcuts import get_user
class UserAuthenticationManager(o... | watchdogpolska/watchdog-id | watchdog_id/auth_factories/managers.py | Python | mit | 2,793 |
import numpy as np
import pandas as pd
import random
from sklearn.preprocessing import LabelEncoder
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import matplotlib
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from collections import OrderedDict
import operator
... | stefanpede/KSS | multiDatenanalyse.py | Python | mit | 8,548 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | squirrelo/qiita | qiita_ware/commands.py | Python | bsd-3-clause | 8,365 |
"""
A test script for the particlesystem module in the quantumoperator subpackage.
"""
import numpy as np
import pytest
from HamiltonianPy.indextable import IndexTable
from HamiltonianPy.quantumoperator.constant import ANNIHILATION, CREATION
from HamiltonianPy.quantumoperator.particlesystem import *
from Hamiltonian... | wangshiphys/HamiltonianPy | HamiltonianPy/tests/unit/test_particlesystem.py | Python | gpl-3.0 | 11,869 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
for amimoto_alexa
POST comment for WordPress REST API
@param AUTHOR_NAME:string
@param COMMENT:string
@usage comment_to_wordpress( AUTHOR_NAME, COMMENT )
"""
import urllib
import urllib2
import yaml
import sys
yaml_path = 'data/WPConf.yml'
def create_query(aut... | amimoto-ami/amimoto-amazon-alexa | amimoto_alexa/wpapi.py | Python | mit | 986 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 CERN.
#
# Invenio 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... | SDSG-Invenio/invenio | invenio/modules/formatter/__init__.py | Python | gpl-2.0 | 21,654 |
from django.contrib.auth.models import User
from tagging.models import Tag
from sarpaminfohub.contactlist.tests.contactlist_test_case import ContactListTestCase
class SearchTest(ContactListTestCase):
login_user = None
contact1 = None
contact2 = None
contact3 = None
def login(self, client):
... | aptivate/sarpaminfohub | django/sarpaminfohub/contactlist/tests/search_tests.py | Python | gpl-3.0 | 6,491 |
"""Installs and configures Treadmill locally."""
from __future__ import absolute_import
import os
import click
import yaml
from treadmill import context
from treadmill.osmodules import bootstrap
def init():
"""Return top level command handler."""
@click.group()
@click.option('--cell', required=True, e... | toenuff/treadmill | lib/python/treadmill/cli/admin/install.py | Python | apache-2.0 | 2,257 |
# -*- coding: UTF-8 -*-
# Copyright 2008-2014 Luc Saffre
# This file is part of Lino Welfare.
#
# Lino Welfare is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at y... | khchine5/lino-welfare | lino_welfare/modlib/welfare/models.py | Python | agpl-3.0 | 7,065 |
#!/usr/bin/env python
from __future__ import print_function
import numpy as np
import pandas as pd
from itertools import product
import copy
class ipfn(object):
def __init__(self, original, aggregates, dimensions, weight_col='total',
convergence_rate=1e-5, max_iteration=500, verbose=0, rate_tole... | Dirguis/ipfn | ipfn/ipfn.py | Python | mit | 12,200 |
from bge import logic
import nilutils as nl
import random as rand
class Bullet(nl.GameObject):
def stay_up(self):
self.applyForce = [0, 0, 9.8]
self.worldLinearVelocity.z = 0
class PlayerBullet(Bullet):
def __init__(self, own):
super().__init__(own)
self.collision = self.sensors["Collision"]
self... | Lucrecious/Aphtar-Yu | PlayerBullet.py | Python | mit | 925 |
"""OpenNebula plugin for integration tests."""
from lib.cloud import (
CloudProvider,
CloudEnvironment
)
from lib.util import (
display,
)
class OpenNebulaCloudProvider(CloudProvider):
"""Checks if a configuration file has been passed or fixtures are going to be used for testing"""
def filter(s... | valentin-krasontovitsch/ansible | test/runner/lib/cloud/opennebula.py | Python | gpl-3.0 | 1,609 |
#!/usr/bin/python
"""
This module contains unittests that test splitter nodes
:Author: Jan Hendrik Metzen (jhm@informatik.uni-bremen.de)
:Created: 2008/12/18
"""
import unittest
import numpy
if __name__ == '__main__':
import sys
import os
# The root of the code
file_path = os.path.dirname(os.path.ab... | pyspace/pyspace | pySPACE/tests/unittests/nodes/spatial_filtering/test_fda.py | Python | bsd-3-clause | 3,962 |
# -*- coding: utf8 -*-
from __future__ import unicode_literals
import logging
logger = logging.getLogger(__name__)
import gym
from parametizable import Parametizable
from consts import ParamsTypes, Spaces
class ProblemException(Exception):
pass
class BaseProblem(Parametizable):
"""
Mostly a wrapper a... | Hiestaa/RLViz | src/problems/base.py | Python | mit | 6,050 |
#!/usr/bin/env python
"""
=======================================================
holonomicDrive.py - Ideal Holonomic Point Drive Handler
=======================================================
Passes velocity requests directly through.
Used for ideal holonomic point robots.
"""
class driveHandler:
def __init__(s... | jadecastro/LTLMoP | src/lib/handlers/drive/holonomicDrive.py | Python | gpl-3.0 | 1,178 |
# 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
# d... | rzarzynski/tempest | tempest/api/baremetal/admin/base.py | Python | apache-2.0 | 7,056 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_cointrader
----------------------------------
Tests for `cointrader` module.
"""
import pytest
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return... | toirl/cointrader | tests/test_cointrader.py | Python | mit | 387 |
from datetime import datetime
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth.backends import RemoteUserBackend
from django.contrib.auth.middleware import RemoteUserMiddleware
from django.contrib.auth.models import User
from django.middleware.csrf import _get_new_... | wkschwartz/django | tests/auth_tests/test_remote_user.py | Python | bsd-3-clause | 13,003 |
"""
WSGI config for mysana project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysana.settings.production")
from djan... | triump0870/mysana | src/mysana/wsgi.py | Python | mit | 1,071 |
# This file is part of ranger, the console file manager.
# License: GNU GPL version 3, see the file "AUTHORS" for details.
from __future__ import (absolute_import, division, print_function)
import os
import sys
import threading
import curses
from subprocess import CalledProcessError
from ranger.ext.keybinding_parser... | nanuda/ranger | ranger/gui/ui.py | Python | gpl-3.0 | 17,051 |
"""
Demo of Matplotlib interaction
==============================
Make sure that you have "Enable GUI Event Loop" checked
under the "Shell" menu, as well as the proper toolkit
selected.
Run this code. You'll have an interactive figure.
Click on the figure to see feedback in the shell.
The shell is still usable. If ... | jnvandermeer/PythonFeedback | idlex-1.11.2/demos/matplotlib_demo.py | Python | gpl-2.0 | 1,155 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | platform/polycommon/tests/test_events/test_attribute.py | Python | apache-2.0 | 1,735 |
import os
import sys
from ase import Atom, Atoms
from ase.units import Bohr, Hartree
from ase.io.cube import write_cube
from gpaw import GPAW
from gpaw.test import equal
from gpaw.cluster import Cluster
from gpaw.point_charges import PointCharges
from gpaw.external_potential import ConstantPotential
from gpaw.mpi imp... | robwarm/gpaw-symm | gpaw/test/external_potential.py | Python | gpl-3.0 | 2,567 |
# 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... | aam-at/tensorflow | tensorflow/python/keras/engine/training_generator_v1.py | Python | apache-2.0 | 30,915 |
from math import exp
from colorsys import hls_to_rgb
import random
import struct
import threading
from time import sleep
class Wire:
def __init__(self, board, pin):
self.board = board
self.pin = pin
def __enter__(self):
self.board.uper_io(0, self.board.encode_sfp(100, [1]))
r... | 8devices/IoTPy | IoTPy/sandbox/ledstrip.py | Python | mit | 5,948 |
#------------------------------------------------------------------------------
# Copyright 2013 Esri
# 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/LICENS... | JudTown17/solutions-geoprocessing-toolbox | data_management/test/test_topographic_tools/TestCreateElevationMosaicDataset.py | Python | apache-2.0 | 3,266 |
# -*- coding: utf-8 -*-
import logging
import commands
import simplejson
import os
import os.path
import openerp
import time
import random
import subprocess
import simplejson
import werkzeug
import werkzeug.wrappers
_logger = logging.getLogger(__name__)
from openerp import http
from openerp.addons.hw_proxy.controllers... | jeasoft/odoo | marcos_addons/marcos_pos/hw_proxy/main.py | Python | agpl-3.0 | 8,287 |
from apps.fund.models import DonationStatuses, Donation
from babel.dates import format_date
from babel.numbers import format_currency
from django.contrib.sites.models import Site
from django.core.mail import EmailMultiAlternatives
from django.db.models.signals import post_save, pre_save
from django.dispatch.dispatcher ... | onepercentclub/onepercentclub-site | apps/recurring_donations/mails.py | Python | bsd-3-clause | 2,271 |
from xml.etree.ElementTree import SubElement
from insalata.model.Service import Service
class DhcpService(Service):
"""
This class represents a DHCP-Service in the data model.
"""
def __init__(self, collectorName=None, timeout=None, address=None):
"""
Create a new DhcpService with the g... | tumi8/INSALATA | src/insalata/model/DhcpService.py | Python | apache-2.0 | 4,112 |
from boxbranding import getBoxType, getMachineName
from Screens.Wizard import WizardSummary
from Screens.WizardLanguage import WizardLanguage
from Screens.Rc import Rc
from Screens.Screen import Screen
from VideoHardware import video_hw
from Components.Pixmap import Pixmap, MovingPixmap, MultiPixmap
from Components.co... | sklnet/opendroid-enigma2 | lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py | Python | gpl-2.0 | 8,253 |
# -*- coding: utf-8 -*-
# In dit bestand wordt een toetsenbord gemaakt, dat wat betreft de te oefenen
# letters alleen de letters laat zien die op dat moment worden geoefend.
functie_rij = ['ESC', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9',
'F10', 'F11', 'F12', 'BREAK', 'PRTSCR', 'DEL']
getallenrij = ['... | hendrikjeb/typcursus | toetsenbord.py | Python | mit | 2,192 |
"""
Class to manage packages using pyisac
"""
from core import sshexec
class Package(object):
def __init__(self, name, node, action):
self.node = node
self.os_type = node.facts["distro"]
if self.os_type == "Redhat":
self.provider = "dnf install "
elif self.os_type == "U... | r3alityc0d3r/pyisac-core | src/Pyisac/core/package.py | Python | gpl-2.0 | 1,513 |
# 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
# distributed under t... | ilay09/keystone | keystone/conf/federation.py | Python | apache-2.0 | 3,371 |
#!/usr/bin/env python
#
# Copyright (C) 2011 Austin Leirvik <aua at pdx.edu>
# Copyright (C) 2011 Wil Cooley <wcooley at pdx.edu>
# Copyright (C) 2011 Joanne McBride <jirab21@yahoo.com>
# Copyright (C) 2011 Danny Aley <danny.aley@gmail.com>
# Copyright (C) 2011 Erich Ulmer <blurrymadness@gmail.com>
#
# This program is ... | wcooley/usbrevue | setup.py | Python | gpl-3.0 | 2,112 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... | EmanueleCannizzaro/scons | test/option/debug-includes.py | Python | mit | 3,445 |
from collections import Sequence, Iterable
class NonStringSequence(Sequence):
pass
class NonStringIterable(Iterable):
pass
| OaklandPeters/pyinterfaces | pyinterfaces/convenience/nonstring.py | Python | mit | 133 |
# Copyright 2013 Huawei Technologies Co.,LTD.
#
# 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... | Tesora/tesora-tempest | tempest/api/compute/admin/test_hosts_negative.py | Python | apache-2.0 | 6,539 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('rss', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='entry',
name='concepts',
... | palkeo/nebulosa | rss/migrations/0002_auto_20141013_0610.py | Python | unlicense | 679 |
"""
/rapid [player] will put the player in rapid mode, speeding up all tools
including weapons.
RAPID_BLOCK_DELAY determines how fast block placement should be.
Lowering this value is not recommended except for local use. Ping to the server
is the effective lower limit: if this value is set to 0.1 (0.1 seconds =... | NateShoffner/PySnip | feature_server/scripts/rapid.py | Python | gpl-3.0 | 3,694 |
# -*- coding: utf-8 -*-
"""
Learner data exporter for Enterprise Integrated Channel SAP SuccessFactors.
"""
from logging import getLogger
from requests import RequestException
from django.apps import apps
from enterprise.models import EnterpriseCustomerUser, PendingEnterpriseCustomerUser
from enterprise.tpa_pipelin... | edx/edx-enterprise | integrated_channels/sap_success_factors/exporters/learner_data.py | Python | agpl-3.0 | 9,167 |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from lxml import etree
from calibre import prepare_string_for_xml as xml
fr... | hazrpg/calibre | src/calibre/ebooks/oeb/polish/check/opf.py | Python | gpl-3.0 | 15,112 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
readme = open('README.rst').read()
history = open('HISTORY.rst... | elena/card-task | setup.py | Python | bsd-3-clause | 1,332 |
import os
import pandas as pd
import sqlite3 as dbi
import seaborn
import matplotlib.pyplot as plt
from ipywidgets import interact
# set the plot theme based on seaborn default parameters
seaborn.set()
def set_directory():
# set the current work directory to the data folder
os.chdir('../data... | johnash1990/crashDataAnalysisTools | crashDataAnalysisTools/data_prep.py | Python | bsd-2-clause | 15,069 |
# Copyright 2020 The TensorFlow Probability 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 o... | tensorflow/probability | tensorflow_probability/python/distributions/moyal_test.py | Python | apache-2.0 | 10,137 |
"""
Analyse the distribution of peak distances to see if there is bistability.
To be used for two glomeruli simulations (aka *bigrun*).
You are asked by script the simulation number (x, y) as (rate, strength).
If the plot shows one peak there is no bistability, if the plot shows two peaks
then there is bistability.
U... | neuro-lyon/multiglom-model | src/analysis_bistability.py | Python | mit | 2,605 |
"""
Manager to return status information about a running Pulp instance
"""
from logging import getLogger
from pkg_resources import get_distribution
from pulp.server.async.celery_instance import celery
from pulp.server.db import connection
from pulp.server.db.model import Worker
_logger = getLogger(__name__)
def ge... | ulif/pulp | server/pulp/server/managers/status.py | Python | gpl-2.0 | 1,732 |
import contextlib
import sys
import time
import os
import warnings
import types
from functools import reduce
from PyQt4.QtCore import QByteArray, Qt, pyqtSignal as Signal, pyqtProperty,\
QEventLoop, QSettings, QUrl
from PyQt4.QtGui import QDialog, QPixmap, QLabel, QVBoxLayout, QSizePolicy, \
qApp, QFrame, QSta... | marinkaz/orange3 | Orange/widgets/widget.py | Python | bsd-2-clause | 35,874 |
import sys
import numpy as np
import matplotlib.pyplot as plt
import math
#from datetime import datetime
#import os
# load csv file
PATH = "./data/"
FILENAME = "Sample_F5_21_2_1mA_trial2";
#TIMESTAMP = datetime.now().strftime('%D_%H:%M')
#OUTPUT = ''+ os.path.splitext(FILENAME)[0] + '_' + TIMESTAMP + '.png'
field, res... | caspar/KentLab | scripts/GMRplot3.py | Python | mit | 1,307 |
import json
from wal_e.blobstore import swift
from wal_e.storage.base import BackupInfo
class SwiftBackupInfo(BackupInfo):
def load_detail(self, conn):
if self._details_loaded:
return
uri = "{scheme}://{bucket}/{path}".format(
scheme=self.layout.scheme,
bucket... | wal-e/wal-e | wal_e/storage/swift_storage.py | Python | bsd-3-clause | 609 |
from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404
from blog.models import BlogPost, BlogCategory
class BlogPostFeed(Feed):
title = "Argonemyth >> Blog"
description = "Blog posts from argonemyth.me"
link = "/blog/"
author_name = "Fei Tan"
author_email... | argonemyth/argonemyth-blog | blog/feeds.py | Python | gpl-3.0 | 1,449 |
import sys
sys.path.append('..')
from hermes import run_server, Chatroom
from settings import chatrooms
class BillyMaysChatroom(Chatroom):
command_patterns = ((r'.*', 'shout'),)
def shout(self, sender, body, match):
body = body.upper() #SHOUT IT
self.broadcast(body)
run_server(chatrooms, us... | mattlong/hermes | tests/test_servers.py | Python | isc | 344 |
from jafem import *
from rtree import index
import wx
import psycopg2
APP_EXIT=1
#--------------------------SQL queries----------------------------------------#
query1 = """SELECT * FROM metadata WHERE id = %s;"""
query2 = """INSERT INTO metadata (id, startime, endtime, saliance, class) VALUES (%s, %s, %s, %s, %s);... | lOStres/JaFEM | gui.py | Python | mit | 7,813 |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... | mmahut/openshift-ansible | roles/lib_openshift/library/oc_label.py | Python | apache-2.0 | 59,170 |
import numpy as np
arr1D = np.array([1, 1, 2, 2, 3, 4])
'''不同的填充方法'''
print('constant: ' + str(np.pad(arr1D, (2, 3), 'constant')))
print('edge: ' + str(np.pad(arr1D, (2, 3), 'edge')))
print('linear_ramp: ' + str(np.pad(arr1D, (2, 3), 'linear_ramp')))
print('maximum: ' + str(np.pad(arr1D, (2, 3), 'maximum')))
print(... | antkillerfarm/antkillerfarm_crazy | python/ml/numpy/npy_pad.py | Python | gpl-3.0 | 678 |
"""Copyright (c) 2013 Clarinova.
This file is licensed under the terms of the Revised BSD License,
included in this distribution as LICENSE.txt
"""
from six import iteritems
__all__ = ['command_name', 'make_parser', 'run_command']
command_name = 'util'
def make_parser(cmd):
#
# Library Command
#
l... | CivicKnowledge/ambry | ambry/cli/util.py | Python | bsd-2-clause | 4,550 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2010, 2011 CERN.
##
## Invenio 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 opt... | robk5uj/invenio | modules/bibupload/lib/batchuploader_webinterface.py | Python | gpl-2.0 | 14,164 |
from __future__ import division
from math import log, exp
from operator import mul
from collections import Counter
import os
import pickle
class MyDict(dict):
def __getitem__(self, key):
if key in self:
return self.get(key)
return 0
pos = MyDict()
neg = MyDict()
features = set()
totals... | vivekn/sentiment-web | info.py | Python | bsd-2-clause | 2,750 |
import pandas as pd
import numpy as np
from tqdm import tqdm_notebook
from sklearn.externals import joblib
def prep_data_cols(df):
'''previously determined which columns need to one-hot, mark as null-or-not,
or leave as is. Returns dataframe with modified columns, ready to standardize.'''
to_one_hot = ['... | jmhsi/justin_tinker | data_science/lendingclub_bak/dataprep_and_modeling/modeling_utils/data_prep_deprecated.py | Python | apache-2.0 | 7,377 |
# 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... | tensorflow/tensorflow | tensorflow/python/client/session_list_devices_test.py | Python | apache-2.0 | 3,501 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import re
import pkg_resources
import subprocess
import errno
from natsort import natsorted
import funannotate.library as lib
def perlVersion():
proc = subprocess.Popen(['perl', '-e', 'print $];'],
stdout=subprocess.PI... | nextgenusfs/funannotate | funannotate/check.py | Python | bsd-2-clause | 17,139 |
def divisible_sum_pairs(factor, int_list):
divisible_pairs_count = 0
array_length = len(int_list)
for i in range(array_length):
for j in range(i + 1, array_length):
possible_divisor = int_list[i] + int_list[j]
if possible_divisor % factor == 0:
divisible_pair... | avenet/hackerrank | algorithms/implementation/divisible_sum_pairs.py | Python | mit | 587 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing the central widget showing the web pages.
"""
from __future__ import unicode_literals
import os
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QUrl
from PyQt5.QtGui import QIcon
from PyQt5.... | paulmadore/Eric-IDE | 6-6.0.9/eric/Helpviewer/HelpTabWidget.py | Python | gpl-3.0 | 37,071 |
#!/bin/usr/env python
#
# Mr. Bot command generator (for acdemic research)
#
# Date: Nov. 4, 2012
# All rights are reserved.
#
import sys, random, base64, getopt
from array import array
from crypto import rsa,slowaes
import ccpkt, encopt
_aes_key = [143,194,34,208,145,203,230,143,177,246,97,206,145,92,255,84]
_iv = ... | sfluo/mrbot | cmd.py | Python | bsd-3-clause | 2,745 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | lakshmi-kannan/st2 | st2api/tests/unit/controllers/v1/test_executions_filters.py | Python | apache-2.0 | 17,029 |
import os
import shutil
import unittest
from unittest import TestCase
from wopmars.tests.resource.wrapper.FooWrapper2 import FooWrapper2
from wopmars.tests.resource.wrapper.FooWrapper8 import FooWrapper8
from wopmars.SQLManager import SQLManager
from wopmars.models.FileInputOutputInformation import FileInputOutputInfo... | aitgon/wopmars | wopmars/tests/test_dag.py | Python | mit | 5,683 |
from django.conf.urls import url
from rpi.beehive.views import AddBeehiveView, delete_readering_view, \
ChartReaderingView, export_view, ListReaderingView, DeleteBeehiveView, \
ModifyBeehiveView, summary_view
urlpatterns = [
url(r'^ajouter$', AddBeehiveView.as_view(), name='add-beehive'),
url(r'^(?P<... | RuchePI/Site | rpi/beehive/urls.py | Python | gpl-3.0 | 915 |
#!/usr/bin/env python
from os.path import exists
from setuptools import setup
setup(name='castra',
version='0.1.2',
description='On-disk partitioned store',
url='http://github.com/Blosc/Castra/',
maintainer='Matthew Rocklin',
maintainer_email='mrocklin@gmail.com',
license='BSD',
... | mrocklin/castra | setup.py | Python | bsd-3-clause | 623 |
# -*- test-case-name: twisted.python.test.test_versions -*-
# Copyright (c) 2006-2008 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Versions for Python packages.
See L{Version}.
"""
import sys, os
class _inf(object):
"""
An object that is bigger than all other objects.
"""
def __cmp__... | sorenh/cc | vendor/Twisted-10.0.0/twisted/python/versions.py | Python | apache-2.0 | 7,309 |
import numpy as np
np.sin(1)
np.sin([1, 2, 3])
np.sin(1, out=np.empty(1))
np.matmul(np.ones((2, 2, 2)), np.ones((2, 2, 2)), axes=[(0, 1), (0, 1), (0, 1)])
np.sin(1, signature="D->D")
np.sin(1, extobj=[16, 1, lambda: None])
# NOTE: `np.generic` subclasses are not guaranteed to support addition;
# re-enable this we can ... | simongibbons/numpy | numpy/typing/tests/data/pass/ufuncs.py | Python | bsd-3-clause | 462 |
# -*- coding: utf-8 -*-
# Copyright 2015-2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
from odoo import models, fields
from odoo.addons.connector.unit.mapper import (mapping,
only_create,
... | laslabs/odoo-connector-carepoint | connector_carepoint/models/sale_order_line.py | Python | agpl-3.0 | 5,090 |
TIMEOUT_DEFAULT = 30
| lob/lob-python | lob/constants.py | Python | mit | 21 |
import sys
class _LinePrinter(object):
"""A base class for printing lines to the screen.
Do not use directly. For internal use only.
Experimental.
"""
def find_width_of_char(self, ch):
# will eventually need changing.
return 1
def _print_unicode_char(self, ch, force_a... | umars/npyscreen | npyscreen/wgwidget_proto.py | Python | bsd-2-clause | 2,564 |
class Queue():
def __init__(self, n):
# n is the # of elements the queue can hold
self.n = n
self.data = [None] * n
self.head = 0 # the head of the queue
self.tail = 0 # the index to the next available element
self.free = n
def empty(self):
return self.fr... | JasonVann/CLRS | S3_DataStructures/C10_ElementaryDataStructures/queue.py | Python | mit | 1,745 |
# (C) Copyright 2017 Hewlett Packard Enterprise Development LP
#
# 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... | timothyb89/dbuild | dbuild/tasks/resolve_task.py | Python | apache-2.0 | 1,329 |
#!/usr/bin/python
from gi.repository import GObject
import apt
import datetime
import logging
import os
import subprocess
import sys
import time
import unittest
from testutils import setup_test_env
setup_test_env()
from softwarecenter.db.history_impl.apthistory import AptHistory
from softwarecenter.utils import Exe... | gusDuarte/software-center-5.2 | test/test_apthistory.py | Python | lgpl-3.0 | 3,661 |
# Copyright (C) 2020 OpenMotics BV
#
# 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 Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribu... | openmotics/gateway | src/gateway/hal/mappers_classic/output.py | Python | agpl-3.0 | 5,206 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014-2015 Université Catholique de Louvain.
#
# This file is part of INGInious.
#
# INGInious is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 o... | GuillaumeDerval/INGInious | frontend/plugins/auth/ldap_auth.py | Python | agpl-3.0 | 3,653 |
import os
import os.path
import numpy as np
from PIL import Image
if __name__ == '__main__':
def image_classifier(path):
valid_images = [".jpg", ".gif", ".png", ".tga"]
imgs = []
for f in os.listdir(path):
ext = os.path.splitext(f)[1]
if ext.lower() not in... | Logan1x/Python-Scripts | bin/ImagetoData.py | Python | mit | 722 |
from django.core.management import setup_environ
import os
import sys
sys.path.append(os.path.dirname(__file__))
import settings
setup_environ(settings)
#==================================#
from mybioregions.models import *
from django.contrib.gis.geos import GEOSGeometry
from django.contrib.auth.models i... | Ecotrust/locus | scripts/bioregion_run_tests.py | Python | bsd-3-clause | 2,142 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 NEC Corporation
#
# 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
#... | 99cloud/keystone_register | openstack_dashboard/dashboards/project/networks/panel.py | Python | apache-2.0 | 979 |
import copy
from base import BaseTable, BoundRow
__all__ = ('MemoryTable', 'Table',)
def sort_table(data, order_by):
"""Sort a list of dicts according to the fieldnames in the
``order_by`` iterable. Prefix with hypen for reverse.
Dict values can be callables.
"""
def _cmp(x, y):
for nam... | isolationism/mongoengine-tables | mongoengine_tables/memory.py | Python | bsd-2-clause | 3,373 |
from openerp import models, fields
class stock_production_lot(models.Model):
_inherit = 'stock.production.lot'
ref_initial = fields.Integer(string='Initial reference')
ref_final = fields.Integer(string='Final reference')
| sysadminmatmoz/ingadhoc | stock_lot_information/stock.py | Python | agpl-3.0 | 237 |
# -*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring communication protocol... | nagyistoce/netzob | src/netzob/Common/Models/AbstractMessage.py | Python | gpl-3.0 | 18,132 |
#!/usr/bin/env python3
# class to drive the Trill Touch sensor by Mike Cook December 2020
# requires smbus2 - pip3 install simbus2
from smbus2 import SMBus, i2c_msg
import time
kCentroidLengthDefault = 20
kCentroidLengthRing = 24
kCentroidLength2D = 32
kRawLength = 60
kCommandNone = 0
kCommandMode = 1
kCommandScanSe... | Grumpy-Mike/Mikes-Pi-Bakery | Trill Part 1/Software/trill_lib.py | Python | gpl-2.0 | 15,882 |
#!/usr/bin/env python
"""
make_a_star_cluster.py creates a model star cluster,
which can then be used in N-body simulations or for other purposes.
It requires AMUSE, which can be downloaded from http://amusecode.org or
https://github.com/amusecode/amuse.
Currently not feature-complete yet, and function/argument names... | rieder/MASC | src/amuse/ext/masc/cluster.py | Python | mit | 10,655 |
from os import path
import six
from six.moves import cPickle as pickle
DATA_DIRNAME = path.join(path.dirname(__file__), 'data')
class Vokativ(object):
def __init__(self, data_dirname=DATA_DIRNAME):
self.data_dirname = data_dirname
def vokativ(self, name, woman=None, last_name=None):
if not ... | Mimino666/vokativ | vokativ/vokativ.py | Python | mit | 2,893 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2014, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, ... | raoanirudh/oq-risklib | openquake/commonlib/riskmodels.py | Python | agpl-3.0 | 9,922 |
# Author: David Goodger
# Contact: goodger@users.sourceforge.net
# Revision: $Revision$
# Date: $Date$
# Copyright: This module has been placed in the public domain.
"""
I/O classes provide a uniform API for low-level input and output. Subclasses
will exist for a variety of input/output mechanisms.
"""
__docformat__... | crystalspace/CS | docs/support/docutils/io.py | Python | lgpl-2.1 | 11,516 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('blocks', '0008_auto_20160402_0404'),
]
operations = [
migrations.CreateModel(
name='Block',
fields=[... | effa/flocs | blocks/migrations/0009_auto_20160419_0651.py | Python | gpl-2.0 | 1,273 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.