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 |
|---|---|---|---|---|---|
from pygccxml.declarations.type_traits import array_item_type
from spyderlib.widgets.editortools import item_at_line
__author__ = 'privat'
import os
# pyqt imports
from python_qt_binding.QtCore import pyqtSlot
from python_qt_binding.QtGui import QAction, QMenu, QTreeWidgetItem
import roslab_ide.helper.Workspace as ... | sem23/roslab_ide | src/roslab_ide/helper/TreeHelper.py | Python | mit | 4,960 |
import os
from setuptools import setup, find_packages
PACKAGE_DIR = 'src'
def read(file_name):
return open(os.path.join(os.path.dirname(__file__), file_name)).read()
setup(
name = "pydocgen",
version = '0.0.1',
author = read("AUTHORS"),
keywords = "selenium screenshot",
url = "https://github.com/perfidia/pydoc... | perfidia/pydocgen | setup.py | Python | mit | 503 |
#!/usr/bin/env python
#import logging
from webserver import *
if __name__ == '__main__':
#logging.basicConfig(
# format="[%(asctime)s] %(name)s/%(levelname)-6s - %(message)s",
# level=logging.CRITICAL,
# datefmt='%Y-%m-%d %H:%M:%S'
#)
# Only enable debug level for bbot
#logger =... | elamperti/bastardbot | webserver.py | Python | mit | 507 |
# -*- coding: utf-8 -*-
from duralex.AbstractVisitor import AbstractVisitor
from .AddCommitMessageVisitor import int_to_roman
from . import template
from . import diff
from duralex.alinea_parser import *
import duralex.tree as tree
from bs4 import BeautifulSoup
import jinja2
import os
import subprocess
import tempf... | Legilibre/SedLex | sedlex/CreateGitBookVisitor.py | Python | agpl-3.0 | 16,946 |
import enum
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy_utils import ScalarListType
db = SQLAlchemy()
#########################
# User, APIKeys, Scopes #
#########################
class User(db.Model):
"""A user representation in the database.
Attributes:
id: Steam unique... | FroggedTV/grenouilleAPI | backend/models.py | Python | gpl-3.0 | 16,496 |
#!/usr/bin/env python
import os, sys, struct
def U24(bytes):
return struct.unpack('<I', bytes + '\0')[0]
def ATFRGB888(data, count, n):
l = []
for ct in range(1, count):
ts = []
for f in range(1, n):
len = U24(data.read(3))
ts.append(data.read(len))
l.append(ts)
return l
def ATFRGBA8... | yinqiang/PythonTools | atf2png/atf2png.py | Python | mit | 3,200 |
#!/usr/bin/python3
""" Convert our apps.yaml file to JSON, to stdout. """
import os
import yaml
import json
next_id = 0
def find_data_file():
name = "apps.yaml"
locations = [
os.path.abspath('./data'),
'/usr/share/apps-fp-o',
]
for location in locations:
filename = location +... | fedora-infra/apps.fp.o | bin/yaml2json.py | Python | mit | 1,104 |
MESSAGES = dict({
"1": "\n\nData provided for method __init__() of class Feature \n"
"was not correct to create dict() object",
"2": "\n\nFeature object is not a valid geojson feature object, \n"
"one of the following failed, geometry, properties or type field are missing \n",
"3": "\n\nCo... | LowerSilesians/geo-squizzy | geosquizzy/validation/messages.py | Python | mit | 369 |
# Copyright 2013 dotCloud 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 t... | mikedougherty/docker-py | docker/client.py | Python | apache-2.0 | 42,819 |
#
# Copyright (C) 2013-2016 Fabian Gieseke <fabian.gieseke@di.ku.dk>
# License: GPL v2
#
import os
import sys
import numpy
SOURCES_RELATIVE_PATH = "../../src/"
FILES_TO_BE_COMPILED = ["neighbors/kdtree/base.c", "neighbors/kdtree/util.c", "neighbors/kdtree/kdtree.c", "timing.c", "util.c"]
DIRS_TO_BE_INCLUDED = ["neig... | gieseke/bufferkdtree | bufferkdtree/neighbors/kdtree/setup.py | Python | gpl-2.0 | 2,655 |
""" Граничные значения (и пофиг что по русски) """
from functools import reduce
def count_nodes(node, passed, finish):
if node in passed:
return 0
passed.add(node)
if node == finish:
return 1
return reduce(lambda s, n: s + count_nodes(n, passed, finish), node.children, 1)
def node... | morpheby/msisvit-lab-c-metrics | src/boundary.py | Python | gpl-2.0 | 2,146 |
import os
from secret_info import POSTGRES_CONNECTION, SECRET_KEY
basedir = os.path.abspath(os.path.dirname(__file__))
date_style = {'format': '%d-%b-%Y',
'help': 'DD-MMM-YYYY'}
class Config:
WTF_CSRF_ENABLED = True
SECRET_KEY = os.environ.get('SECRET_KEY') or SECRET_KEY
SQLALCHEMY_TRACK_M... | stefpiatek/mdt-flask-app | config.py | Python | mit | 1,447 |
import pymssql
server = "CNS-ETDEVDB\INST1"
database = "Oboe"
def connect_sqlserver():
conn = pymssql.connect(server=server, database=database)
return conn
def execute_sql(sql):
conn = connect_sqlserver()
cur = conn.cursor()
if cur:
cur.execute(sql)
execute_list = cur.fetchall(... | hongbaby/service-automation | services/schedule_class_service/sql_handler.py | Python | mit | 437 |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
# We use the inorder to find which elements are left and right of the curr element.
# And the post order to start with the fir... | saisankargochhayat/algo_quest | leetcode/106. Construct Binary Tree from Inorder and Postorder Traversal/soln.py | Python | apache-2.0 | 978 |
#!/usr/bin/env python
# encoding: utf8
import imaplib
import optparse
import MySQLdb
import memcache
import ldb
import os
import re
import subprocess
import sys
from samba.param import LoadParm
from samba.samdb import SamDB
from samba.auth import system_session
class SambaOCHelper(object):
def __init__(self):
... | Zentyal/openchange | script/openchange_user_cleanup.py | Python | gpl-3.0 | 15,752 |
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later... | badp/ganeti | lib/rapi/rlib2.py | Python | gpl-2.0 | 40,795 |
"""
urls.py defines patterns for each page of the website.
This determines how to pass parameters to the website and
how the website reads them.
"""
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from flashcards.views import *
urlpatterns = patterns('',
... | latreides/SE_Team3 | flashcards/urls.py | Python | mit | 2,904 |
import os
import sys, logging
import pywikibot
import csv
import MySQLdb as mdb
from MySQLdb import cursors
import traceback
import re
import time
from datetime import datetime, timedelta
import argparse
import pdb
'''
Create the logger
'''
NOW = time.strftime("%Y_%m_%d_%H_%M")
OUT_DIR_LOGS = os.path.expanduser('~/log... | uduwage/Multilingual-Wikipedian-Research | codePy_misc/NewProficencyUserEditsDual.py | Python | mit | 12,638 |
from ajenti.api import ModuleConfig
from main import *
class GeneralConfig(ModuleConfig):
target = TerminalPlugin
platform = ['any']
labels = {
'shell': 'Shell'
}
shell = 'su'
| digideskio/ajenti | plugins/terminal/config.py | Python | lgpl-3.0 | 216 |
#!/usr/bin/env/python
# -*- coding: utf-8 -*-
#
# (c) 2016 WebDevOps.io
#
# This file is part of Dockerfile Repository.
#
# 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, in... | webdevops/Dockerfile | bin/webdevops/docker/__init__.py | Python | mit | 1,384 |
# Copyright 2018 Cloudbase Solutions Srl
# All Rights Reserved.
from oslo_policy import policy
from coriolis.policies import base
REPLICA_EXECUTIONS_POLICY_PREFIX = "%s:replica_executions" % (
base.CORIOLIS_POLICIES_PREFIX)
REPLICA_EXECUTIONS_POLICY_DEFAULT_RULE = "rule:admin_or_owner"
def get_replica_executi... | cloudbase/coriolis | coriolis/policies/replica_tasks_executions.py | Python | agpl-3.0 | 2,399 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
QAD Quantum Aided Design plugin
-------------------
begin : 2013-05-22
copyright : iiiii
email : hhhhh
... | gam17/QAD | qad_ui_textwindow.py | Python | gpl-3.0 | 2,545 |
from unittest import TestCase
from unittest.mock import MagicMock
from pyga import Candidate
from pyga import ListOrderCrossover
from pyga import Probability
from pyga import Random
from pyga import ValidationException
class ListCrossoverOperatorTestCase(TestCase):
def test_apply(self):
candidate1 = Cand... | Eyjafjallajokull/pyga | tests/test_operator/test_list_order_crossover.py | Python | mit | 1,347 |
# #######
# Copyright (c) 2018-2020 Cloudify Platform Ltd. 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... | cloudify-cosmo/cloudify-gcp-plugin | cloudify_gcp/admin/__init__.py | Python | apache-2.0 | 1,945 |
"""Sprite and tile engine.
tilevid, isovid, hexvid are all subclasses of this interface.
Includes support for:
* Foreground Tiles
* Background Tiles
* Sprites
* Sprite-Sprite Collision handling
* Sprite-Tile Collision handling
* Scrolling
* Loading from PGU tile and sprite formats (optional)
* Set rate FPS (optional... | yarbelk/pgu | pgu/vid.py | Python | lgpl-2.1 | 15,497 |
#!/usr/bin/python2.5
#
# Copyright 2012 Olivier Gillet.
#
# Author: Olivier Gillet (ol.gillet@gmail.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (... | lis0r/axoloti | firmware/mutable_instruments/elements/resources/samples.py | Python | gpl-3.0 | 1,708 |
__author__ = 'yinjun'
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param p, a tree node
# @param q, a tree node
# @return a boolean
def isSameTree(self, p, q):
... | shootsoft/practice | LeetCode/python/091-120/100-same-tree/issame.py | Python | apache-2.0 | 691 |
from wsgiref.simple_server import make_server
from pynba import monitor, pynba
from time import sleep
import logging
@pynba.timer(outsider=["bar", "foo"])
def outside():
return
@monitor(('127.0.0.1', 30002), prefix='[foo]')
def app(environ, start_response):
pynba.scriptname = '[lol]' + pynba.scriptname
i... | johnnoone/pynba | examples/test.py | Python | mit | 1,492 |
# Standard Library Imports
from datetime import datetime, timedelta
import gevent
import logging
import json
import multiprocessing
import traceback
import os
import re
import sys
# 3rd Party Imports
import gipc
import googlemaps
# Local Imports
from . import config
from Filters import Geofence, load_pokemon_section, l... | poketrainerbob690/PokeAlarm | PokeAlarm/Manager.py | Python | agpl-3.0 | 41,392 |
from __future__ import division
import numpy as np
def iP2(a):
return a**(1/2)
def iP3(a):
return a**(1/3)
def iP4(a):
return a**(1/4)
def iPN(a, n=None):
return a**(1/n)
def iA2(a):
return (-np.log(1-a))**(1/2)
def iA3(a):
return (-np.log(1-a))**(1/3)
def iA4(a):
return (-np.log(... | jobliz/solid-state-kinetics | ssk/models/theoretical.py | Python | mit | 1,630 |
from lib import log
from lib.log import exception, warning
from version import VERSION_FOR_BUG_REPORTS
from paths import CLIENT_LOG_PATH
log.set_version(VERSION_FOR_BUG_REPORTS)
log.add_secure_file_handler(CLIENT_LOG_PATH, "w")
log.add_http_handler("http://jlpo.free.fr/soundrts/metaserver")
log.add_console_handler()
i... | thgcode/soundrts | soundrts/clientmain.py | Python | bsd-3-clause | 9,739 |
import plotly.offline as py
py.init_notebook_mode()
from temp_pre_process import temp_pre_process
def temp_increase(temp, year):
df1 = temp_pre_process(temp, year)
df2 = temp_pre_process(temp, '2013')
df1['AverageTemperature'] = df1['AverageTemperature'].astype(float)
df2['AverageTemperature'] = df2['AverageTem... | abhisheksugam/Climate_Police | Climate_Police/tests/temp_increase.py | Python | mit | 1,551 |
# -*- coding: utf-8 -*-
from openprocurement.tender.belowthreshold.tests.base import (
test_organization
)
# TenderQuestionResourceTest
def create_tender_question(self):
response = self.app.post_json('/tenders/{}/questions'.format(
self.tender_id),
{'data': {'title': 'question title', 'descri... | openprocurement/openprocurement.tender.openua | openprocurement/tender/openua/tests/question_blanks.py | Python | apache-2.0 | 4,806 |
import _plotly_utils.basevalidators
class CautoValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="cauto", parent_name="scattercarpet.marker", **kwargs
):
super(CautoValidator, self).__init__(
plotly_name=plotly_name,
parent_name=p... | plotly/plotly.py | packages/python/plotly/plotly/validators/scattercarpet/marker/_cauto.py | Python | mit | 477 |
# 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/examples/adding_an_op/zero_out_grad_2.py | Python | apache-2.0 | 1,552 |
__author__ = 'Filip Hanes'
import scrapy_sqlite.connection as connection
from twisted.internet.threads import deferToThread
from scrapy.utils.serialize import ScrapyJSONEncoder
class SQLitePipeline(object):
"""Pushes item into a SQLite table"""
def __init__(self, conn):
self.conn = conn
sel... | filyph/scrapy-sqlite | scrapy_sqlite/pipelines.py | Python | mit | 1,984 |
import unittest
import saliweb.build
class DummyEnv(dict):
def Install(self, target, files):
self.install_target = target
self.install_files = files
def Command(self, *args):
if not hasattr(self, 'command_target'):
self.command_target = []
self.command_target.appen... | salilab/saliweb | test/build/test_frontend.py | Python | lgpl-2.1 | 2,913 |
"""
@name: PyHouse/Project/src/Modules/Computer/Web/web_rootMenu.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2013-2019 by D. Brian Kimmel
@license: MIT License
@note: Created on May 30, 2013
@summary: Handle the Main menu.
"""
__updated__ = '2019-10-31'
# Import s... | DBrianKimmel/PyHouse | Project/src/Modules/Computer/Web/web_rootMenu.py | Python | mit | 1,294 |
# coding=UTF-8
# Author: Dennis Lutter <lad1337@gmail.com>
#
# This file is part of Medusa.
#
# Medusa 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... | pymedusa/Medusa | tests/legacy/db_tests.py | Python | gpl-3.0 | 1,795 |
import struct
import sys
OFFSET = 0x1006
LENGTH = 48
def xor(data, key=0xcafebabe):
crypted = list()
for j in xrange(LENGTH / 4):
s = data[j * 4:(j + 1) * 4]
i = struct.unpack("<L", "".join(s))[0]
crypted.append(i ^ key)
return struct.pack("L" * (LENGTH / 4), *crypted)
... | angea/corkami | wip/MakePE/examples/algo/crypt.py | Python | bsd-2-clause | 1,472 |
from __future__ import unicode_literals
from botocore.exceptions import ClientError, ParamValidationError
import boto3
import sure # noqa
from moto import mock_ec2, mock_kms, mock_rds2
@mock_rds2
def test_create_database():
conn = boto3.client('rds', region_name='us-west-2')
database = conn.create_db_instan... | kefo/moto | tests/test_rds2/test_rds2.py | Python | apache-2.0 | 60,216 |
"""
Interfaces with Verisure alarm control panel.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/alarm_control_panel.verisure/
"""
import logging
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.verisure import ... | Smart-Torvy/torvy-home-assistant | homeassistant/components/alarm_control_panel/verisure.py | Python | mit | 3,272 |
"""Unit test for treadmill.appcfg.abort
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import json
import os
import shutil
import tempfile
import unittest
import kazoo
import mock
import treadmill
fro... | bretttegart/treadmill | tests/appcfg/abort_test.py | Python | apache-2.0 | 3,800 |
"""1.2 : Update primary_groups to fit autonomie
Revision ID: 1f548f8115e8
Revises: 3ffdda6a6fe6
Create Date: 2012-08-28 23:29:01.873171
"""
# revision identifiers, used by Alembic.
revision = '1f548f8115e8'
down_revision = '3ffdda6a6fe6'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.execute... | CroissanceCommune/autonomie | autonomie/alembic/versions/1_2_1f548f8115e8.py | Python | gpl-3.0 | 770 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('notes', '0007_auto_20151214_0823'),
]
operations = [
migrations.AlterField(
model_name='note',
name=... | grnet/project_index | notes/migrations/0008_auto_20170121_1327.py | Python | gpl-3.0 | 599 |
#!/usr/bin/env python
import boto.dynamodb2.table
from boto.dynamodb2.fields import HashKey, RangeKey
from boto.dynamodb2.types import NUMBER
import boto.dynamodb2
import random
import hashlib
import logging
from collections import defaultdict
def create_hash(doi, rec_type):
return "|".join((doi, rec_type))
cla... | iwsmith/babel_datapipeline | babel_datapipeline/database/storage.py | Python | agpl-3.0 | 7,290 |
from __future__ import unicode_literals
import uuid
from sqlalchemy import Column
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
from catsnap import Client
class TaskTransaction(Base):
__tablename__ = 'task_transaction'
transa... | ErinCall/catsnap | catsnap/table/task_transaction.py | Python | mit | 551 |
# 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... | shhui/nova | nova/tests/compute/test_compute_mgr.py | Python | apache-2.0 | 90,992 |
#pylint: disable=invalid-name,too-many-public-methods,too-many-arguments,non-parent-init-called, too-many-branches
from __future__ import (absolute_import, division, print_function)
import os
import numpy as np
from PyQt4 import QtGui
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
fr... | wdzhou/mantid | scripts/HFIRPowderReduction/MplFigureCanvas.py | Python | gpl-3.0 | 19,362 |
"""
pyrtf-ng Errors and Exceptions
"""
class RTFError(Exception):
pass
class RTFParseError(RTFError):
"Unable to parse RTF data."
| oubiwann-unsupported/pyrtf | rtfng/ertf.py | Python | mit | 139 |
# -*- coding: utf-8 -*-
#
# This tool helps you to rebase package to the latest version
# Copyright (C) 2013-2014 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2... | phracek/rebase-helper | rebasehelper/archive.py | Python | gpl-2.0 | 7,554 |
import six
from .log import log_input, log_output
def open(*args, **kwargs):
"""Built-in open replacement that logs input and output
Workaround for issue #44. Patching `__builtins__['open']` is complicated,
because many libraries use standard open internally, while we only want to
log inputs and out... | recipy/recipy | recipy/utils.py | Python | apache-2.0 | 1,587 |
#!/usr/bin/env python
#
# Copyright (C) 2007 The Android Open Source Project
#
# 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 req... | RyanTech/DexHunter | dalvik/vm/compiler/template/gen-template.py | Python | apache-2.0 | 12,676 |
#encoding:utf-8
subreddit = 'humanbeingbros'
t_channel = '@humanbeingbros'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Fillll/reddit2telegram | reddit2telegram/channels/~inactive/humanbeingbros/app.py | Python | mit | 149 |
'''
Copyright 2011-2013 Jonathan Morgan
This file is part of http://github.com/jonathanmorgan/network_builder.
network_builder 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 3 of the Licen... | jonathanmorgan/network_builder | attributes/node_attribute_container.py | Python | gpl-3.0 | 29,001 |
#
# Copyright 2013-2014 eNovance <licensing@enovance.com>
#
# Authors: Mehdi Abaakouk <mehdi.abaakouk@enovance.com>
#
# 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.... | pczerkas/aodh | aodh/tests/test_rpc.py | Python | apache-2.0 | 5,886 |
#------------------------------------------------------------------------------
# Name: pychrono example
# Purpose:
#
# Author: Alessandro Tasora
#
# Created: 1/01/2019
# Copyright: (c) ProjectChrono 2019
#------------------------------------------------------------------------------
import pychrono... | dariomangoni/chrono | src/demos/python/solidworks/demo_SW_irrlicht.py | Python | bsd-3-clause | 3,109 |
#!/usr/bin/python
# This is distributed under cc0. See the LICENCE file distributed along with
# this code.
"""
Let's simulate a tor network! We're only going to do enough here
to try out guard selection/replacement algorithms from proposal
259, and some of its likely variants.
"""
import random
from math ... | nmathewson/guardsim | lib/tornet.py | Python | cc0-1.0 | 8,742 |
# Flexlay - A Generic 2D Game Editor
# Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option)... | SuperTux/flexlay | flexlay/gui/icon.py | Python | gpl-3.0 | 1,135 |
"""Script to plan a path for a Neato depending on the current game state. Needs
to run inside a robot specific namespace for STAR_pose_continuous to work"""
import sys
import rospy
import cv2
import doctest
import numpy as np
import math
from geometry_msgs.msg import Twist, PoseStamped
from tf.transformations import e... | DakotaNelson/robo-games | path_planning.py | Python | mit | 9,422 |
import libtcodpy as libtcod
from entity import Entity
import actions
import consts
class Item:
def __init__(self, use_function=None):
self.use_function = use_function
def pick_up(self, objects, inventory):
if len(inventory) >= 26:
output = consts.MESSAGE_ITEM_PICKUP_FAIL
e... | MykeMcG/SummerRoguelike | src/items.py | Python | gpl-3.0 | 3,617 |
import numpy as np
import tensorflow as tf
import h5py
from sklearn.preprocessing import OneHotEncoder
import time
# Download data from .mat file into numpy array
print('==> Experiment 1e')
filepath = '(separate features & labels) taylorswift_7_36.mat'
print('==> Loading data from {}'.format(filepath))
f = h... | Haunter17/MIR_SU17 | exp1/exp1e.py | Python | mit | 4,028 |
#!/usr/bin/env python
# coding: utf-8
# Copyright 2013 The Font Bakery 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/LIC... | davelab6/fontbakery | tools/fontbakery-crawl.py | Python | apache-2.0 | 4,997 |
###############################################################
# Copyright 2020 Lawrence Livermore National Security, LLC
# (c.f. AUTHORS, NOTICE.LLNS, COPYING)
#
# This file is part of the Flux resource manager framework.
# For details, see https://github.com/flux-framework.
#
# SPDX-License-Identifier: LGPL-3.0
####... | grondo/flux-core | src/bindings/python/flux/resource/__init__.py | Python | lgpl-3.0 | 469 |
'''
'''
import csv,re
def load_tsv(file_name):
with open(file_name, "rb") as tsv_file:
reader = csv.reader(tsv_file, delimiter="\t", lineterminator="\n")
reader.next()
loaded_list = list(reader)
return loaded_list
def return_only_trait(trait, traits_file):
trait_info = []
... | bio-ontology-research-group/neural-network-plant-trait-classification | file_preperation/correlate_photos_to_phenotype.py | Python | mit | 2,222 |
#
# 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... | lxsmnv/spark | python/pyspark/sql/functions.py | Python | apache-2.0 | 103,218 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see winpython/__init__.py for details)
"""
Register a Python distribution
Created on Tue Aug 21 21:46:30 2012
"""
from __future__ import print_function
import sys
import os
import os.path as osp
import subpr... | technologiescollege/Blockly-rduino-communication | scripts_XP/Lib/site-packages/winpython/associate.py | Python | gpl-3.0 | 8,668 |
from Screen import Screen
class ClockDisplay(Screen):
def okbutton(self):
self.session.close()
def __init__(self, session, clock):
Screen.__init__(self, session)
self['theClock'] = clock
b = Button('bye')
b.onClick = [self.okbutton]
self['okbutton']... | kingvuplus/boom | lib/python/Screens/ClockDisplay.py | Python | gpl-2.0 | 409 |
import pathlib
import numpy as np
import radontea
import sinogram
def test_2d_art():
sino, angles = sinogram.create_test_sino(A=100, N=100)
r = radontea.art(sino, angles)
# np.savetxt('outfile.txt', np.array(r).flatten().view(float), fmt="%.8f")
reffile = pathlib.Path(__file__).parent / "data" / "2... | paulmueller/radontea | tests/test_alg_art.py | Python | bsd-3-clause | 623 |
"""biplist -- a library for reading and writing binary property list files.
Binary Property List (plist) files provide a faster and smaller serialization
format for property lists on OS X. This is a library for generating binary
plists which can be read by OS X, iOS, or other clients.
The API models the plistlib API,... | rembo10/headphones | lib/biplist/__init__.py | Python | gpl-3.0 | 29,969 |
#!/usr/bin/env python
import copy
import operator
import os
import os.path
import pickle
import string
import sys
# Constant for C++ files.
FILETYPE_CPP = 2
# Constant for DDDOC files.
FILETYPE_DDDOC = 1
# Constant for none of the above.
FILETYPE_OTHER = 0
SOURCE_ENCODING = 'iso8859-1'
# Extension of C++ files.
CPP... | bkahlert/seqan-research | raw/workshop12/workshop2012-data-20120906/trunk/util/py_lib/seqan/dddoc/core.py | Python | mit | 36,923 |
from datetime import timedelta
from unittest import TestCase
from draughtcraft import model
from draughtcraft.lib.beerxml import export
from draughtcraft.tests import TestModel
def prepare_xml(xml):
return ''.join([n.strip() for n in xml])
class TestField(TestCase):
def test_field_value(self):
f =... | ryanpetrello/draughtcraft | draughtcraft/tests/lib/beerxml/test_export.py | Python | bsd-3-clause | 58,850 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, modify, merge, publish... | rwl/PyCIM | CIM15/IEC61970/Generation/Production/SteamSendoutSchedule.py | Python | mit | 2,510 |
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 29 21:27:52 2016
@author: k nityan suman
A Discrete Mathematics professor has a class of n students.
Frustrated with their lack of discipline, he decides to cancel class
if fewer than k students are present when class starts.
Given the arrival time of each stu... | nityansuman/Python-3 | puzzles/angry_professor.py | Python | gpl-3.0 | 1,703 |
#! /usr/bin/env python
from startup import *
from morphology.list_of_components import ListOfComponents
## Test ListOfComponents class
class TestListOfComponentsFunctions(unittest.TestCase):
def setUp(self):
# Instantiate a ListOfComponents object
self.list_of_components = ListOfComponents()
... | buret/pylmflib | test/test_morphology_list_of_components.py | Python | gpl-2.0 | 2,158 |
#/usr/bin/env python
#-*- coding: utf-8 -*-
import re
import sys
from collections import namedtuple, defaultdict
from pyautocad import Autocad
from pyautocad import utils
LampEntry = namedtuple('LampEntry', 'number, mark, numxpower')
# \A1;2ARCTIC SMC/SAN 254 \S2х54/2,5;\P300 лк
def iter_lamps(acad, ob... | reclosedev/pyautocad | examples/lights.py | Python | bsd-2-clause | 1,272 |
"""
Django settings for multistatus project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... | astrofrog/multistatus | multistatus/settings.py | Python | mit | 2,340 |
"""
An example demonstrating a stand-alone "console".
Copyright (c) Jupyter Development Team.
Distributed under the terms of the Modified BSD License.
Example
-------
To run the example, see the instructions in the README to build it. Then
run ``python main.py``.
"""
import os
from jinja2 import FileSystemLoader
fr... | charnpreetsingh185/jupyterlab | examples/console/main.py | Python | bsd-3-clause | 1,424 |
import pytest
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
@pytest.mark.parametrize("dirs", [
"/opt/prom/etc",
"/opt/prom/etc/rules",
"/opt/prom/etc/file_sd",
"/opt/prom/lib"... | tmartinx/svauto | ansible/roles/prometheus/molecule/alternative/tests/test_alternative.py | Python | apache-2.0 | 1,042 |
# -*- coding: utf-8 -*-
import sys
import os
import shutil
import psutil
import subprocess
import time
import numpy as np
import itertools
# from matplotlib import pyplot
from routeGen import routeGen
from sumoConfigGen import sumoConfigGen
from stripXML import stripXML
import multiprocessing as mp
from glob import glo... | cbrafter/TRB18_GPSVA | codes/mainCode/ParallelSpecialMac.py | Python | mit | 5,186 |
#!/usr/bin/env python3
# Copyright 2015-2016 The Meson development team
# 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... | centricular/meson | mesonbuild/scripts/vcstagger.py | Python | apache-2.0 | 1,568 |
from io import BytesIO
from struct import pack, unpack, calcsize, error as struct_error
from zttf.objects import TTF_post, TTFHeader, TTFOffsetTable, TTF_kern, TTF_kern_subtable
from zttf.utils import Range, glyph_more_components, glyf_skip_format, ttf_checksum, binary_search_parameters
class TTFSubset:
def __ini... | zathras777/zttf | zttf/subset.py | Python | apache-2.0 | 10,377 |
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2001-2006 Donald N. Allingham
# Copyright (C) 2008 Gary Burton
# Copyright (C) 2011 Tim G L Lyons
#
# 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... | dermoth/gramps | gramps/plugins/view/sourceview.py | Python | gpl-2.0 | 13,732 |
import numpy as np
import pandas as pd
from scipy.optimize import least_squares
import re
import lmfit
class Calibrate:
def __init__(self, model):
"""initialize Calibration class
Parameters
----------
model : ttim.Model
model to calibrate
"... | mbakker7/ttim | ttim/fit.py | Python | mit | 10,043 |
__author__ = 'smaaland'
| jonasrogert/Quadcopter | visualization/__init__.py | Python | gpl-2.0 | 24 |
#-*- coding: utf-8 -*-
from bson import ObjectId as _ObjectId
from datetime import datetime
__all__ = ['ObjectId', 'String', 'Integer', 'Float', 'Long', 'List', 'Boolean', 'DateTime']
class TypeMixin(object):
def is_valid(self, value):
raise NotImplementedError
def to_value(self):
raise No... | teitei-tk/SixIsles | sixisles/types.py | Python | mit | 1,562 |
# -*- coding: utf-8 -*-
# open repositories
"""Todo: move src for acquiring data"""
'http://www.opendoar.org/countrylist.php'
better = 'http://oaister.worldcat.org/'
# Should access Terms and Conditions all the time.
| aidiss/disciplines | disciplines/method/open_repositories.py | Python | mit | 219 |
import _plotly_utils.basevalidators
class IdsValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="ids", parent_name="icicle", **kwargs):
super(IdsValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
anim=kwa... | plotly/plotly.py | packages/python/plotly/plotly/validators/icicle/_ids.py | Python | mit | 429 |
# Generated by Django 2.2.9 on 2020-01-28 13:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('aklub', '0064_auto_20200128_1434'),
]
operations = [
migrations.AddField(
model_name='automatic... | auto-mat/klub | apps/aklub/migrations/0065_automaticcommunication_administrative_unit.py | Python | gpl-3.0 | 565 |
import pytest
import numpy as np
from numpy import testing
from clifford import Cl
from clifford.tools import orthoFrames2Versor as of2v
from clifford._numba_utils import DISABLE_JIT
from clifford import tools
from . import rng # noqa: F401
too_slow_without_jit = pytest.mark.skipif(
DISABLE_JIT, reason="test ... | arsenovic/clifford | clifford/test/test_tools.py | Python | bsd-3-clause | 8,422 |
#=========================================================================
# elf
#=========================================================================
# A simple translator between ELF files and a sparse memory image object.
# Note that the translator is far from complete but is sufficient for use
# in our researc... | cornell-brg/pydgin | pydgin/elf.py | Python | bsd-3-clause | 20,497 |
import io
import unittest
import pickle
import pickletools
import sys
import copyreg
from http.cookies import SimpleCookie
from test.support import (
TestFailed, TESTFN, run_with_locale,
_2G, _4G, bigmemtest, impl_detail, check_impl_detail
)
from pickle import bytes_types
# Tests that try a number of pic... | wdv4758h/ZipPy | lib-python/3/test/pickletester.py | Python | bsd-3-clause | 52,644 |
from django.apps import AppConfig
from django.core import checks
from django.contrib.auth.checks import check_user_model
from django.db.models.signals import post_migrate
from django.utils.translation import ugettext_lazy as _
from .management import create_permissions
class AuthConfig(AppConfig):
name = 'django... | iambibhas/django | django/contrib/auth/apps.py | Python | bsd-3-clause | 603 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | Gamebasis/3DGamebasisServer | GameData/blender-2.71-windows64/2.71/scripts/addons/add_mesh_ant_landscape.py | Python | gpl-3.0 | 27,868 |
#!/usr/bin/env python2.7
# launch.py 1.0.1
import argparse, os, sys, subprocess, json
from datetime import datetime
from collections import deque
import dxpy
#import dxencode
import dx
import encd
### TODO:
# 1) NEED TO MAKE a --template version not relying on ENCODEd at all!
# - Nice to have option to dx build pipe... | ENCODE-DCC/dxencode | launch.py | Python | mit | 101,582 |
def chamar_ab():
a = 1
b = 2
return a, b
def soma(x, y):
return x + y
print(soma(*chamar_ab()))
#https://pt.stackoverflow.com/q/392570/101
| bigown/SOpt | Python/Operator/DeconstructIntoArguments.py | Python | mit | 158 |
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
# pprint (a)
#
# a2d = [a, a, a, a]
# pprint(a2d)
# [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]
#
# #indexing 2d lists
# N =122
# a2d = [ list(range(i*N, i... | JosephJamesDoyle87/software | tests/test5.py | Python | mit | 1,742 |
#! /usr/bin/python
"""A simple plugin to connect rsyslog to SOLR
Based on Radu Gheorghe's idea as expressed in
http://blog.sematext.com/2013/12/16/video-using-solr-for-logs-with-rsyslog-flume-fluentd-and-logstash/
Watch out for slide 26.
Copyright (C) 2014 by Adiscon GmbH
This file is part of rsyslog... | ymattw/rsyslog | plugins/external/solr/rsyslog_solr.py | Python | gpl-3.0 | 3,143 |
#!/usr/bin/env python3
import sys, os, unittest, logging, tempfile
# Extend PYTHONPATH with local 'lib' folder
jasyroot = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir, os.pardir, os.pardir))
sys.path.insert(0, jasyroot)
import jasy.core.Project as Project
import jasy.core.Session as Session
... | zynga/jasy | jasy/test/requirements.py | Python | mit | 6,167 |
import math
class JuliaSet(object):
def __init__(self, c, n = 100):
self.c = c
self.n = n
self._d = 0.001
self._complexplane = []
self.set = []
def juliamap(self, z):
return (z ** 2) + self.c
def iterate(self, z):
m = 0
while True:
... | SParadiso18/juliasets | juliaset.py | Python | mit | 841 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.