code
stringlengths
2
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int32
2
1.05M
#!/usr/bin/python import sys from gurobipy import * # try: usage_message = 'gurobi.sh/gurobi.bat stage1.py/stage2.py <file-name>.txt' def stage12_optimize(core_num, wcits, wcmts, wcrrs): m = Model("stage12") weight_ub = 10.0 total_rr = sum(wcrrs) core_alloc = {} ...
amal029/waa
zm/stage12.py
Python
mit
7,976
""" Source file to perform interpolation on the nasa93 data """ import sys import random from lib import * from Models.nasa93 import * from settings import * from where2 import * from Utilities.utils import * import numpy as np import TEAK TREE_VERBOSE=False; CLUSTER_ON_DECISION = False; def launchInterpolate(m, dat...
ai-se/george
Technix/interpolation.py
Python
mit
2,921
from six import python_2_unicode_compatible from .base import Ref, CustomField, QuickbooksManagedObject, \ LinkedTxnMixin, QuickbooksTransactionEntity, LinkedTxn, Address, EmailAddress from .tax import TxnTaxDetail from .detailline import DetailLine from ..mixins import DeleteMixin @python_2_unicode_compatible cl...
ZachGoldberg/python-quickbooks
quickbooks/objects/refundreceipt.py
Python
mit
2,121
#!/usr/bin/env python import urllib2 from lxml import etree import unicodecsv # This will actually often not work, as many implementing organisations' # activities will be funded by donor activities that are not tagged with the # country (e.g. a very large multi-country program). def check_traceability(directory): ...
markbrough/iati-country-tester
check_traceability.py
Python
mit
1,411
import pytest from detectem.results import Result, ResultCollection from detectem.settings import GENERIC_TYPE, HINT_TYPE, INDICATOR_TYPE class TestResultCollection: @staticmethod def _assert_results(detected, results): c = ResultCollection() for d in detected: c.add_result(d) ...
spectresearch/detectem
tests/test_results.py
Python
mit
3,509
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
AutorestCI/azure-sdk-for-python
azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_backend_http_settings.py
Python
mit
5,586
from __future__ import unicode_literals import uuid import re from django.contrib.auth.models import User from sequences import get_next_value from autoslug import AutoSlugField from django.db import models from datetime import datetime from django.contrib.auth.models import AbstractUser, User from model_utils.fields ...
bittssystem/version3
bittscmsapp/models.py
Python
mit
17,934
#!/usr/bin/env python import rospy from std_msgs.msg import String def talker(): pub = rospy.Publisher('drive_control_publish', String, queue_size=10) rospy.init_node('drive_control_publisher', anonymous=False) rate = rospy.Rate(0.2) # 0.2hz (how many times per second) while not rospy.is_shutdown(): ...
zoltan-fedor/robo_car
nodes/drive_control_publisher.py
Python
mit
813
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-04-13 21:49 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('account', '0015_account_current_repos'), ] operations = [ migrations.RenameField( ...
iModels/ffci
account/migrations/0016_auto_20160413_1649.py
Python
mit
442
from otp.ai.AIBase import * from toontown.toonbase.ToontownGlobals import * from direct.distributed.ClockDelta import * from TrolleyConstants import * from direct.distributed import DistributedObjectAI from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.task import Task from direct.directn...
ksmit799/Toontown-Source
toontown/safezone/DistributedGolfKartAI.py
Python
mit
11,333
#! /usr/bin/env python import roslib roslib.load_manifest('roslaunch_axserver') import rospy import subprocess import sys import threading import actionlib import roslaunch_axserver.msg class RoslaunchServer(object): # create messages that are used to publish feedback/result def __init__(self, name): ...
cburbridge/strands_apps
roslaunch_axserver/scripts/roslaunch_server.py
Python
mit
2,972
import _plotly_utils.basevalidators class ColorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="color", parent_name="bar.selected.marker", **kwargs ): super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=pare...
plotly/plotly.py
packages/python/plotly/plotly/validators/bar/selected/marker/_color.py
Python
mit
416
import sys import os PROJECT_HOME = os.path.abspath( os.path.join(os.path.dirname(__file__), '../../')) sys.path.append(PROJECT_HOME) from flask.ext.testing import TestCase from flask import request from flask import url_for, Flask from sqlalchemy import Column, Integer, String, Float, DateTime, Boolean from sqlalc...
ehenneken/metrics_service
service/tests/unittests/testMetricsFunctions.py
Python
mit
26,795
import pytest import numpy as np from numpy.testing import assert_allclose from keras.layers import Conv2D from keras.models import Sequential from keras.optimizers import Adam from keras.losses import sparse_categorical_crossentropy from keras import backend as K from keras_contrib.losses import DSSIMObjective allob...
stygstra/keras-contrib
tests/keras_contrib/losses/dssim_test.py
Python
mit
4,008
from django.conf.urls import patterns, url, include from rest_framework.urlpatterns import format_suffix_patterns from pay_period import views urlpatterns = patterns('pay_period.views', url(r'^payperiod/$', views.PayPeriodList.as_view(), name='payperiod-list'), url(r'^payperiod/(?P<pk>[0-9]+)$...
csalajan/testing
example/pay_period/urls.py
Python
mit
452
from django.test import TestCase from ...client import BaseClient class MicroServiceBaseClientTestCase(TestCase): def setUp(self): self.client = BaseClient('staging') def test_login(self): is_logged_in = self.client.login("admin", "a") assert is_logged_in == True, 'Expect login to have worked' def test_l...
TangentMicroServices/LibraryService
microclient/tests/integration/baseclient_ITCase.py
Python
mit
541
#!/usr/bin/python from __future__ import absolute_import #---------------------------------------------------------------------- # Copyright (c) 2012-2015 Raytheon BBN Technologies # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and/or hardware specification (the "W...
plantigrade/geni-tools
src/gcf/omnilib/handler.py
Python
mit
3,907
from bokeh.charts import Donut, show, output_file from bokeh.charts.utils import df_from_json from bokeh.sampledata.olympics2014 import data from bokeh.models import HoverTool import pandas as pd # utilize utility to make it easy to get json/dict data converted to a dataframe #df = df_from_json(data) df = pd.read_csv(...
aburkard/501proj
scripts/donut_chart.py
Python
mit
1,169
from talent_match import db from talent_match.models.modelUtils import modelToString __author__ = 'Steve' class Activity(db.Model): __tablename__ = 'activity' id = db.Column( db.INTEGER, primary_key=True, autoincrement=True, nullable=False, index=True) name = db.Column(db.String(80), nullable=Fal...
jordan-wright/talent-match
talent_match/models/activity.py
Python
mit
5,420
class Base(object): def save_session(self, request): raise NotImplementedError def get_session_store(self, request): """ Retrieve the session object. """ if hasattr(request, 'session'): return request.session return None def purge_for_user(sel...
modelbrouwers/django-sessionprofile
sessionprofile/backends/base.py
Python
mit
500
from .sendmailhandlerbase import SendmailHandlerBase from django.core.mail import send_mail from django.contrib.sites.models import Site from .. import settings from django import template class PlainSendmailHandler(SendmailHandlerBase): '''Plain text Sendmail handler''' def send(self, invitation, **kwargs): ...
kaleidos/django-viter
viter/sendmailhandlers/plainsendmailhandler.py
Python
mit
1,859
from spotdl.metadata.providers.youtube import YouTubeSearch from spotdl.metadata.providers.youtube import YouTubeStreams from spotdl.metadata.providers.youtube import YouTubeVideos from spotdl.metadata.providers import youtube from spotdl.metadata.providers import ProviderYouTube from spotdl.metadata.exceptions import ...
Ritiek/Spotify-Downloader
spotdl/metadata/providers/tests/test_youtube.py
Python
mit
14,726
from matplotlib import pyplot as plt from matplotlib import animation import numpy as np from boids.flock import Flock from boids.flight import Flight from argparse import ArgumentParser import yaml import os def process(): _ROOT = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(_ROOT,'config/co...
cpmck/boids
boids/betterboids.py
Python
mit
1,540
# !/usr/bin/env python # -*- coding: utf-8 -*- ''' Description: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: "((()))", "(()())", "(())()", "()(())", "()()()" Tags: Backtracking, String Time: O(4^n...
Jan-zou/LeetCode
python/Backtracking/22_generate_parentheses.py
Python
mit
956
#project euler 3 import math n = 600851475143 n1 = int(math.ceil(math.sqrt(600851475143))) for i in range(3,n1,2): #since 600851475143 is odd remove factors of 2 while n%i == 0 : prime = i n/=i if n>1 : #prime factor greater than sqrt(600851475143) print n else : print prime
joemathai/problems
Project Euler/3.py
Python
mit
287
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
Azure/azure-sdk-for-python
sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_08_01/operations/_default_security_rules_operations.py
Python
mit
8,972
""" Module to generate jwt token """ from jose import jwt from app import settings JWT_ALGORITHM = 'HS256' JWT_SECRET = settings.JWT_SECRET def encode(data): """ Function to encode python dict data """ return jwt.encode(data, JWT_SECRET, algorithm=JWT_ALGORITHM, headers={"alg": JWT_ALGORITHM, 'typ':...
qateam123/secure-messaging-ui
app/authentication/jwt.py
Python
mit
475
#!/usr/bin/env python """ Run multiple simulations varying a single parameter. """ import numpy as np from subprocess import call import os import pandas as pd import argparse def read_force_coeffs(): """Read force coefficients from `postProcessing/actuatorLines`.""" df = pd.read_csv("postProcessing/actuator...
petebachant/actuatorLine-2D-turbinesFoam
paramsweep.py
Python
mit
2,273
from distutils.core import setup setup( name='behance_python', packages=['behance_python',], install_requires=['requests'], url='https://github.com/aravenel/behance_python', license='MIT', author='Alex Ravenel', author_email='ravenel@gmail.com', version='...
aravenel/behance_python
setup.py
Python
mit
338
""" init.py Initial script to import, simulate and plot raster of SONATA example 300_cells """ from netpyne import sim from netpyne.conversion import sonataImport import h5py import json import numpy as np from matplotlib import pyplot as plt rootFolder = '/u/salvadord/Documents/ISB/Models/sonata/examples/300_cells...
Neurosim-lab/netpyne
examples/sonata_300_cells/init.py
Python
mit
9,133
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-01-23 04:22 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='HashTa...
chocoelho/twitter-activities-monitor
tweets/migrations/0001_initial.py
Python
mit
962
# -*- coding: utf-8 -*- # # spikeval - __init__.py # # Philipp Meier <pmeier82 at googlemail dot com> # 2011-09-29 # """spike sorting evaluation package""" __docformat__ = 'restructuredtext' __version__ = '0.7.0'
pmeier82/spikeval
spikeval/__init__.py
Python
mit
214
from django.conf.urls import patterns, include, url from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'Proxy.views.home', name='home'), # url(r'^blog/', include('blog.urls')), ...
jchmura/proxy
Proxy/urls.py
Python
mit
455
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
Azure/azure-sdk-for-python
sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_11_01/operations/_virtual_hub_ip_configuration_operations.py
Python
mit
22,118
import sys, socket, re from django.utils.translation import ugettext_lazy as _ from django.db.models import CharField, DateTimeField, DecimalField from django.forms import RegexField from django_extensions.db.fields import UUIDField from caya.choices import DATE_ESTIMATED class DobField(DateTimeField): """ Cr...
elkingtowa/caya
src/fields.py
Python
mit
3,560
import prodtest class ParallelismTest(prodtest.ProduceTestCase): def test_parallelism(self): # control: no declared parallelism # recipes run in parallel with self.assertTakesLessThan(0.3): self.produce('a', **{'-j': '2'}) # treatment: declared parallelism # re...
texttheater/produce
t/test_parallelism_in_recipes.py
Python
mit
629
''' Created on 19 janv. 2014 @author: Alexandre Bonhomme ''' import random from core.agents.AgentMovable import AgentMovable import logging as log from wator.agents.FishAgent import FishAgent class SharkAgent(AgentMovable): def __init__(self, x, y, sma, breedingAge, starvationTime): AgentMovable.__init...
blckshrk/DummySMA
src/wator/agents/SharkAgent.py
Python
mit
1,691
import pickle from gzip import open as gzip_open from collections import defaultdict # ------------------------------------------------------------------------------ # Openers # file_openers = { "vert": open, "txt": open, "gz": gzip_open, } def get_opener(file_path): """ Gets a proper opening functi...
nimcho/dimo
misc.py
Python
mit
1,673
import pytest from swimlane import exceptions @pytest.fixture(autouse=True, scope='module') def my_fixture(helpers): # setup stuff defaultApp = 'read only field' pytest.helpers = helpers pytest.swimlane_instance = helpers.swimlane_instance pytest.waitOnJobByID = helpers.waitOnJobByID pytest.ap...
Swimlane/sw-python-client
functional_tests/driver_tests/test_records_readonly_overwrite.py
Python
mit
2,204
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
Azure/azure-sdk-for-python
sdk/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/models/_models.py
Python
mit
41,820
#!/usr/bin/env python from setuptools import setup, find_packages setup( name="python-metalayer", version="0.0.1", description="Simple client for the MetaLayer data and image API.", author="Rich Schumacher", author_email="rich.schu@gmail.com", url="https://github.com/richid/python-metalayer", ...
d8agroup/python-metalayer
setup.py
Python
mit
875
# -*- coding: utf-8 -*- """ Local settings - Run in Debug mode - Use console backend for emails - Add Django Debug Toolbar - Add django-extensions as app """ import socket import os from .common import * # noqa # DEBUG # ------------------------------------------------------------------------------ DEBUG = env.bo...
dilwaria/thoughtconcert
config/settings/local.py
Python
mit
2,398
import os from unittest import TestCase, main from gruffy import Area TARGET_FILE = 'test.png' class TestArea(TestCase): def tearDown(self): os.remove(TARGET_FILE) def test_writable(self): g = Area() g.data("test1", [1, 2, 3]) g.data("test2", [3, 2, 1]) g.write(TARGE...
hhatto/gruffy
test/test_area.py
Python
mit
367
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/protobuf/timestamp.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as ...
martbhell/wasthereannhlgamelastnight
src/lib/google/protobuf/timestamp_pb2.py
Python
mit
1,662
""" TestSConsMSVS.py: a testing framework for the SCons software construction tool. A TestSConsMSVS environment object is created via the usual invocation: test = TestSConsMSVS() TestSConsMSVS is a subsclass of TestSCons, which is in turn a subclass of TestCommon, which is in turn is a subclass of TestCmd), and...
Distrotech/scons
QMTest/TestSConsMSVS.py
Python
mit
34,423
"""askcoding URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-b...
akarambir/askcoding
askcoding/urls.py
Python
mit
1,220
#!/usr/bin/env python # set_creds.py import keyring, getpass # function to set credentials def __set_creds(ring, user, pwd): try: keyring.set_password(ring, user, pwd) except ValueError: # catch error from wrong keyring password print("Incorrect password for encrypted keyring. Try ag...
zloether/Python-Playground
set_creds.py
Python
mit
787
import logging from ..events import ( ButtonStateChange, MonitorStateChange, ) LOG = logging.getLogger(__name__) def run(queues): LOG.info('Event dispatcher started') while True: try: event = queues['events'].get() if isinstance(event, MonitorStateChange): ...
exhuma/electro-sandbox
mpledcontrol/lib/procs/dispatcher.py
Python
mit
656
import re from urlparse import urljoin from BeautifulSoup import BeautifulSoup, Comment from django.shortcuts import redirect class UserCheckMixin(object): user_check_failure_path = '' # can be path, url name or reverse_lazy def check_user(self, user): return True def user_check_failed(self, re...
synw/django-koica
koica/utils.py
Python
mit
2,359
""" A PyQt5 custom widget used by Morse Trainer. Mini-MiniProficiency shows the proficiency for the Koch test charset in a space-efficient way. proficiency = MiniProficiency(data) where 'data' is the string of characters in the test set. proficiency.setState(in_use, data): where 'in_use' is the number of characte...
rzzzwilson/morse_trainer
mini_proficiency.py
Python
mit
7,674
# -*- coding: utf-8 -*- """ onboarder ~~~~~~~~ app.views (app) """ import os, json from os.path import abspath import argparse from datetime import datetime import tornado.ioloop import tornado.web import numpy as np from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from indis...
IndicoDataSolutions/ClusterRSS
cluster/app.py
Python
mit
6,128
import unittest from katas.kyu_6.two_sum import two_sum class TwoSumTestCase(unittest.TestCase): def test_equal_1(self): self.assertEqual(sorted(two_sum([1, 2, 3], 4)), [0, 2]) def test_equal_2(self): self.assertEqual(sorted(two_sum([1234, 5678, 9012], 14690)), [1, 2]) def test_equal_3(...
the-zebulan/CodeWars
tests/kyu_6_tests/test_two_sum.py
Python
mit
391
__author__ = 'dkador' class BasePersistenceStrategy(object): """ A persistence strategy is responsible for persisting a given event somewhere (i.e. directly to Keen, a local cache, a Redis queue, etc.) """ def persist(self, event): """Persists the given event somewhere. :param ev...
keenlabs/KeenClient-Python
keen/persistence_strategies.py
Python
mit
1,602
def send_email(): import smtplib gmail_user = "xyz@gmail.com" gmail_pwd = "secret" FROM = 'xyz@gmail.com' TO = ['xyz@rediffmail.com','xyz@hcl.com'] #must be a list SUBJECT = "Testing sending using gmail" TEXT = "Testing sending mail us...
gowindone-ns/python
mail/MailClient.py
Python
mit
1,012
# -*- coding: utf-8 -*- # cuts.py - functions for computing and evaluating cuts # # Copyright 2011 Ben Edwards <bedwards@cs.unm.edu>. # Copyright 2011 Aric Hagberg <hagberg@lanl.gov>. # Copyright 2015 NetworkX developers. # # This file is part of NetworkX. # # NetworkX is distributed under a BSD license; see LICENSE.tx...
sserrot/champion_relationships
venv/Lib/site-packages/networkx/algorithms/cuts.py
Python
mit
10,002
""" A simple time zone conversion utility with Daylight Saving Time conversion implementation. It is absurdly myopic, only covering the United States of America. It is only valid through 2025. With all these faults it is also highly effective. It does not need any database or service calls. It can simply be imported...
jaybaker/timeshift
timeshift/__init__.py
Python
mit
2,988
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
Azure/azure-sdk-for-python
sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_04_16/_configuration.py
Python
mit
3,270
"""more fields in submission Revision ID: 661fce6a2f64 Revises: 0c79593066ed Create Date: 2019-11-14 12:02:55.010214 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = '661fce6a2f64' down_revision = '0c79593066ed' branch_...
lalinsky/acoustid-server
alembic/versions/661fce6a2f64_more_fields_in_submission.py
Python
mit
2,671
#!/usr/bin/env python # encoding: utf-8 """ @version: ?? @author: muyeby @contact: bxf_hit@163.com @site: http://muyeby.github.io @software: PyCharm @file: nShortPath.py @time: 16-9-1 上午9:54 """ from graph.wordnet import WordNet import copy import sys class NShotPath(object): def __init__(self): pass ...
muyeby/NLP
Seg/NShortPathseg/nShortPath.py
Python
mit
2,066
from sys import stdin for line in stdin: n = int(line) p = int(input()) print(int(round(pow(p,1./n))))
Am3ra/CS
CS3/ClubProgra/113.py
Python
mit
115
# This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.sx/property_status_premium_name # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import...
huyphan/pyyawhois
test/record/parser/test_response_whois_sx_property_status_premium_name.py
Python
mit
919
#!/usr/bin/env python2 # Copyright (c) 2014-2018 The Bitcoin Core developers # Copyright (c) 2015-2018 The PIVX developers # Copyright (c) 2018 The Ion developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ Exercise th...
mitchellcash/ion
qa/rpc-tests/walletbackup.py
Python
mit
7,382
# Copyright 2006 Lukas Lalinsky # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation import tempfile import struct from muzicast.collection.formats._audio import AudioFile extensions = ...
nikhilm/muzicast
muzicast/collection/formats/wma.py
Python
mit
4,658
import imp import os def render(template, data): filePath = os.path.join(os.path.dirname(__file__), '..', 'templates', template + '.py') l = imp.load_source(template, filePath) return l.render(data)
Secretmapper/updevcamp-session-2-dist
form/cgi-bin/lectures/mvc-5/lib/helpers.py
Python
mit
212
#!/usr/bin/env python from distutils.core import setup try: import setuptools except ImportError, _: pass # No 'develop' command, oh well. version = '1.1' long_description = open('README.rst').read() requirements = [ 'pyramid', ] tests_requirements = requirements setup(name='pyramid_scaffolds_decoupl...
shazow/pyramid_scaffolds_decoupled
setup.py
Python
mit
1,090
class Stack: def __init__(self, *args, **kwargs): self.stack = [] def is_empty(self): return self.stack == [] def push(self, item): self.stack.append(item) def pop(self): return self.stack.pop() def peek(self): return self.stack[len(self.stack)-1] def...
LowerSilesians/geo-squizzy
geosquizzy/classes.py
Python
mit
363
""" @brief test tree node (time=2s) """ import sys import os import unittest from pyquickhelper.loghelper import fLOG from pyquickhelper.pycode.build_helper import private_path_choice, private_replacement_ class TestBuildHelper(unittest.TestCase): def test_private_path_choice(self): fLOG( ...
sdpython/pyquickhelper
_unittests/ut_pycode/test_build_helper.py
Python
mit
1,415
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'D:\Apps\DEV\PROJECTS\KoHighlights\gui_status.ui' # # Created: Sat Mar 30 00:34:32 2019 # by: pyside-uic 0.2.15 running on PySide 1.2.4 # # WARNING! All changes made in this file will be lost! from PySide import QtCore, QtGui class Ui_...
noembryo/KoHighlights
gui_status.py
Python
mit
3,746
#!/usr/bin/env python2 import json import logging import logging.handlers import os import subprocess from datetime import datetime from flask import Flask, request try: # Python 3 from configparser import RawConfigParser except ImportError: # Python 2 from ConfigParser import RawConfigParser confi...
FalconSocial/receipt
app.py
Python
mit
3,595
# vector3d.py 3D vector class for use in inertial measurement unit drivers # Authors Peter Hinch, Sebastian Plamauer # V0.5 17th June 2015 ''' The MIT License (MIT) Copyright (c) 2014 Sebastian Plamauer, oeplse@gmail.com, Peter Hinch Permission is hereby granted, free of charge, to any person obtaining a copy of this...
micropython-IMU/micropython-mpu9150
vector3d.py
Python
mit
4,681
# -*- coding: utf-8 -*- """ Created on Wed Mar 29 13:54:56 2017 @author: Lama Hamadeh *STILL WORKING ON IT* """ ''' Abstract: This study looked into assessing the heating load and cooling load requirements of buildings (that is, energy efficiency) as a function of building parameters. URL: https://archive...
LamaHamadeh/Energy-Efficiency-UCI
Energy_Efficiency.py
Python
mit
8,705
#!/usr/bin/env python # Released under the GPL v2 (or later) by Simon Wood (simon@mungewell.org) # # Sample application to connect to camera, and start a video recording # with or without a GUI LiveView screen from __future__ import print_function import signal import threading import datetime import time import argp...
Bloodevil/sony_camera_api
examples/pyLiveView.py
Python
mit
15,060
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
Azure/azure-sdk-for-python
sdk/graphrbac/azure-graphrbac/azure/graphrbac/operations/domains_operations.py
Python
mit
6,745
# -*- coding: utf-8 -*- # This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and # is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012) import json import re import requests import pytz import logging from django.contrib.aut...
jdaigneau/geoq
geoq/core/views.py
Python
mit
49,838
from flask import Flask from flask.ext.mongoengine import MongoEngine from redis import Redis app = Flask(__name__) app.config['MONGODB_SETTINGS'] = {'DB': 'my_catalog'} app.debug = True db = MongoEngine(app) redis = Redis() from my_app.catalog.views import catalog app.register_blueprint(catalog)
nikitabrazhnik/flask2
Module 2/Chapter03/my_app/__init__.py
Python
mit
302
from blinkytape import BlinkyTape class BaseMode(object): fps = 10 led_count = 60 no_sleep = False def __init__(self, fps=None, led_count=None, no_sleep=None, *args, **kwargs): self.colors = list() for i in range(self.led_count): self.colors.append((0, 0, 0)) if fp...
Blinkinlabs/BlinkyTape_Python
modes/base.py
Python
mit
585
import bench from collections import namedtuple T = namedtuple("Tup", ["num", "bar"]) def test(num): t = T(20000000, 0) i = 0 while i < t.num: i += 1 bench.run(test)
adafruit/micropython
tests/bench/var-8-namedtuple-1st.py
Python
mit
189
import os import optparse def git_commit(details): details = "'" + details + "'" os.system("sudo git add .") os.system("sudo git commit -m %s" %(details)) os.system("sudo git push") def main(): # OptionParser object instantiated and aliased by the variable parser parser = optparse.OptionParser("-m <commit>") #...
tanvirtin/TinDrive
git.py
Python
mit
972
""" Sample Python/Pygame Programs Simpson College Computer Science http://programarcadegames.com/ http://simpson.edu/computer-science/ Explanation video: http://youtu.be/qbEEcQXw8aw """ import pygame import random # Define some colors BLACK = ( 0, 0, 0) WHITE = ( 255, 255, 255) RED = ( 255, ...
cp0153/programarcade
ch14lab.py
Python
mit
4,385
from abc import ABCMeta, abstractmethod from ast import literal_eval from datetime import date from numbers import Number import re from six import string_types def parse(expression, global_context=None): """ Takes a string and returns a parsed expression, which can be evaluated with a context. >>> p = p...
travisjungroth/americano
americano/__init__.py
Python
mit
18,429
from proxymanager import ProxyManager
WalnutATiie/google_search
proxymanager/__init__.py
Python
mit
37
from pint import UnitRegistry from utils import config_file_path # Instantiate a common units registry UR = UnitRegistry(autoconvert_offset_to_baseunit=True) UR.load_definitions(config_file_path('pint.txt')) # Specify order and name of data columns DATA_SPEC = ( 'date', 'temperature_C', 'pH', 'suppl...
pzankov/hydroctrl
settings.py
Python
mit
2,232
# -*- coding: utf-8 -*- # # clx.py - Ethernet/IP Client for Rockwell PLCs # # # Copyright (c) 2014 Agostino Ruscito <ruscito@gmail.com> # # 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 witho...
steritecit/pythonTag
pycomm/ab_comm/clx_Old.py
Python
mit
39,948
import os, sys from base64 import b64encode from dez.network.websocket import WebSocketDaemon from cantools import config from cantools.util import log, set_log from .user import PubSubUser from .channel import PubSubChannel class PubSub(WebSocketDaemon): def __init__(self, *args, **kwargs): if config.pubs...
bubbleboy14/cantools
cantools/scripts/pubsub/ps.py
Python
mit
5,198
import time from math import ceil def karatsuba_mul(x, y): if x < 10 or y < 10: return x * y lx = len(str(x)) ly = len(str(y)) n = max(lx, ly) n2 = int(ceil(n/2.0)) a = x / 10**(n2) b = x % 10**(n2) c = y / 10**(n2) d = y % 10**(n2) ac = karatsuba_mul(a, c) bd = karatsuba_mul(b, d) ad_bc = karatsuba_...
mgireesh05/algorithms
karatsuba.py
Python
mit
835
def makeSequenceDict(): # Make a dictionary that maps groups of 4 bases to numbers sequenceDict = {} baseList = ["A", "C", "G", "T"] count = 0 for baseOne in baseList: # Iterate through the first base options for baseTwo in baseList: # Iterate through the second base options for baseThree in b...
imk1/IMKTFBindingCode
makeSequenceInputsMeanFC.py
Python
mit
11,448
from itimbre.iTimbre import iTimbre class CFDI(iTimbre):
asaenzestrada/itimbre_py
itimbre/cfdi.py
Python
mit
67
"""empty message Revision ID: b2d315470289 Revises: 4acfcfa69a62 Create Date: 2016-06-10 17:49:13.414658 """ # revision identifiers, used by Alembic. revision = 'b2d315470289' down_revision = '4acfcfa69a62' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - ...
answerrrrrrrrr/myflask
migrations/versions/b2d315470289_.py
Python
mit
1,011
class Solution: def subtractProductAndSum(self, n: int) -> int: product = 1 sum = 0 while n is not 0: tmp = n % 10 n = int(n/10) product *= tmp sum += tmp return product - sum
AHJenin/acm-type-problems
leetcode/AC/Easy/subtract-the-product-and-sum-of-digits-of-an-integer.py
Python
mit
261
''' Created on 16 Nov 2012 @author: luy ''' class SitwPara(): Title = 'SitW Phidgets Key v4.6 GH v1.4' FilePath_Ini = '..\\cfg\\SitwPhidgetsKey.ini' FilePath_Log = '..\\log\\' KeyCount = 5 Sensitivity = 0.60 MovingPace = 7 SampleInterval_Key = 50 #ms ...
leslieyel/Phidgets-Light-Keypad
ghSitwPhidgetsKey/src/SitwData.py
Python
mit
2,022
#!/usr/bin/python # encoding: utf-8 """ A module for discrete mathematics. Not that this is something we should do in Python. Created by Shane O'Connor 2016 """ import fractions dumb_relative_prime_const = { 6 : 5, 5 : 2, 4 : 3, 3 : 2, 2 : 1, # yep, I know 1 : 0, # yadda yadda } def dumb_r...
Kortemme-Lab/klab
klab/pymath/discrete.py
Python
mit
1,135
import numpy as np from nilabels.tools.image_shape_manipulations.splitter import split_labels_to_4d def test_split_labels_to_4d_True_False(): data = np.array(range(8)).reshape(2, 2, 2) splitted_4d = split_labels_to_4d(data, list_labels=range(8)) for t in range(8): expected_slice = np.zeros(8) ...
SebastianoF/LabelsManager
tests/tools/test_image_shape_manip_splitter.py
Python
mit
1,054
#!/bin/python import pandas as pd import numpy as np import sys import matplotlib as plot import apachelog apache_log=file('/root/shared/tw_logs_241214/apache_access.txt', 'r').readlines() http_err=range(400,418,1) #ex_url='134.251.87.133 - - [24/Dec/2014:01:00:10 +0800] "GET /IN/common/print.js HTTP/1.1" 200' nform...
mhabib1981/pySecn00b
apache_log_analysis.py
Python
cc0-1.0
722
from tests.unit.dataactcore.factories.staging import DetachedAwardFinancialAssistanceFactory from tests.unit.dataactvalidator.utils import number_of_errors, query_columns from dataactcore.models.domainModels import CityCode _FILE = 'fabs41_detached_award_financial_assistance_2' def test_column_headers(database): ...
fedspendingtransparency/data-act-broker-backend
tests/unit/dataactvalidator/test_fabs41_detached_award_financial_assistance_2.py
Python
cc0-1.0
6,342
"""we want to extract locations from the input file 01_latlong.txt. based on the location names we want to open csv files in /data/c0306010datimeteo/ correspondending to the filenames. from those we want to extract the sum or precipitation each year. therefore we have to find a year (four digits) in the first row. ...
crendl/ilearnpython
09b_precipitazione.py
Python
cc0-1.0
1,942
#start_image.py bins = [0, 0.001, 0.003, 0.01, 0.3, 1., 3., 10., 30., 100.] sigmas=[1, 2, 4, 8 , 16, 32, 64, 128, 256] from armor import pattern dbz = pattern.DBZ a=dbz(dataTime='20140722.1300') a.loadImage() a.setMaxMin() #a.powerSpec() a1 = a.laplacianOfGaussian(sigma=1.5) a1 = a1.copy() a1.matrix= (abs(a1.matri...
yaukwankiu/armor
start_image.py
Python
cc0-1.0
608
from setuptools import setup, find_packages setup(name='BIOMD0000000267', version=20140916, description='BIOMD0000000267 from BioModels', url='http://www.ebi.ac.uk/biomodels-main/BIOMD0000000267', maintainer='Stanley Gu', maintainer_url='stanleygu@gmail.com', packages=find_packages(...
biomodels/BIOMD0000000267
setup.py
Python
cc0-1.0
377
from django.core.validators import RegexValidator from django.conf import settings from django.db import models class Restaurant(models.Model): name = models.CharField(max_length=256) phone_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message="""Phone number must be entere...
MariuszKorotko/Office_Lunch_Order
office_lunch_order/office_lunch_order_app/models.py
Python
epl-1.0
1,768
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def insertionSortList(self, head): """ :type head: ListNode :rtype: ListNode """ dummy = ListNode(0) ...
darkpeach/AlgorithmCoding
_147_InsertionSortList.py
Python
epl-1.0
598
#!/usr/bin/env python # -*- coding: utf-8 -*- # # || ____ _ __ # +------+ / __ )(_) /_______________ _____ ___ # | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \ # +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/ # || || /_____/_/\__/\___/_/ \__,_/ /___...
Nowis75/crazyflie-pc-client-leapmotion
lib/cfclient/utils/leapreader.py
Python
gpl-2.0
7,944