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
# -*- coding: utf-8 -*- from django.db import models from datetime import datetime class Place(models.Model): """ Holder object for basic info about the rooms in the university. """ room_place = models.CharField(max_length=255) floor = models.IntegerField() def __unicode__(self): ...
DeltaEpsilon-HackFMI2/FMICalendar-REST
schedule/models.py
Python
mit
4,666
from cherrydo.utils import is_cherrydo_project class CherryDoException(Exception): pass class BaseGenerator(object): def __init__(self, name, params): self.name = name self.params = params def formatted_name(self): return self.name.replace('_', ' ').title().replace(' ', '') ...
mihail-ivanov/cherrydo
cherrydo/common.py
Python
mit
619
from libdotfiles.packages import try_install from libdotfiles.util import HOME_DIR, PKG_DIR, copy_file try_install("alacritty") copy_file( PKG_DIR / "alacritty.yml", HOME_DIR / ".config" / "alacritty" / "alacritty.yml", )
rr-/dotfiles
cfg/alacritty/__main__.py
Python
mit
231
#!/usr/bin/env python # -*- coding: utf-8 -*- # CAVEAT UTILITOR # # This file was automatically generated by Grako. # # https://pypi.python.org/pypi/grako/ # # Any changes you make to it will be overwritten the next time # the file is generated. from __future__ import print_function, division, absolute_import, un...
rjw57/rbc
rbc/parser.py
Python
mit
24,773
#!/usr/bin/env python from django import forms from django.utils.translation import ugettext_lazy as _ from django.utils.html import format_html from django.forms.util import flatatt from django.utils.encoding import force_text from mezzanine.conf import settings from cartridge.shop.forms import OrderForm from cartri...
ryneeverett/cartridge_braintree
cartridge_braintree/forms.py
Python
mit
3,807
# MIT License # Copyright (c) 2017 MassChallenge, Inc. from impact.tests.api_test_case import APITestCase from impact.tests.factories import JudgingRoundFactory class TestJudgingRound(APITestCase): def test_str(self): judging_round = JudgingRoundFactory() judging_round_string = str(judging_round)...
masschallenge/impact-api
web/impact/impact/tests/test_judging_round.py
Python
mit
445
__author__ = 'sarangis' from src.ir.function import * from src.ir.module import * from src.ir.instructions import * BINARY_OPERATORS = { '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '**': lambda x, y: x ** y, '/': lambda x, y: x / y, '//': lambda x, y: ...
ssarangi/spiderjit
src/ir/irbuilder.py
Python
mit
9,699
# -*- coding: utf-8 -*- """ pyvisa.visa ~~~~~~~~~~~ Module to provide an import shortcut for the most common VISA operations. This file is part of PyVISA. :copyright: 2014 by PyVISA Authors, see AUTHORS for more details. :license: MIT, see COPYING for more details. """ from __future__ import...
MatthieuDartiailh/pyvisa
visa.py
Python
mit
1,581
# -*- coding: utf-8 -*- """ Created on Sat May 21 16:43:47 2016 @author: Pratik """ from ftplib import FTP import os # login and download file from ftp site and retrieve file (use default params) def ftpDownloader(filename, host="ftp.pyclass.com", user="student@pyclass.com", passwd="student123"): ftp = FTP(host) ...
pratikmshah/practice
py-data-analysis/ftpDownloader-test.py
Python
mit
831
class PresentDeliverer: present_locations = {} def __init__(self, name): self.name = name self.x = 0 self.y = 0 self.present_locations[self.get_key()]=1 def get_key(self): return str(self.x)+"-"+str(self.y) def status(self): print(self.name + " x: "+str(self.x)+" y: "+str(self.y)) def move(self...
caw13/adventofcode
python/day_three_part2.py
Python
mit
939
import json from sets import Set from sys import maxint import math # tmp hacky functions for vec3 def norm2 (a): return dot(a, a) def dot ( a, b ): return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] def area (a, b, c): u = [ b[0] - a[0], b[1] - a[1], b[2] - a[2] ] v = [ c[0] - a[0], c[1] - a[1], c[2] -...
shrekshao/Polyhedron3D
assets/models/test/txt2json_parser.py
Python
mit
8,122
#!/usr/bin/env python __author__ = 'waroquiers' import unittest import numpy as np from pymatgen.util.testing import PymatgenTest from pymatgen.analysis.chemenv.coordination_environments.coordination_geometries import ExplicitPermutationsAlgorithm from pymatgen.analysis.chemenv.coordination_environments.coordinatio...
tschaume/pymatgen
pymatgen/analysis/chemenv/coordination_environments/tests/test_coordination_geometries.py
Python
mit
19,397
import logging import os import subprocess import traceback from zipfile import ZipFile from os import listdir from os.path import isfile, join ''' A utility python module containing a set of methods necessary for this kbase module. ''' LEVELS = {'debug': logging.DEBUG, 'info': logging.INFO, 'war...
arfathpasha/kb_cufflinks
lib/kb_cufflinks/core/script_utils.py
Python
mit
5,654
import py from rpython.flowspace.model import SpaceOperation, Constant, Variable from rpython.rtyper.lltypesystem import lltype, llmemory, rffi from rpython.translator.unsimplify import varoftype from rpython.rlib import jit from rpython.jit.codewriter import support, call from rpython.jit.codewriter.call import CallC...
jptomo/rpython-lang-scheme
rpython/jit/codewriter/test/test_call.py
Python
mit
11,707
# imports ## core import importlib import logging import os import pprint import sys import StringIO ## 3rd party import cherrypy import requests ## local def full_path(*extra): return os.path.join(os.path.dirname(__file__), *extra) sys.path.insert(0, full_path()) import db logging.basicConfig() sorry = 'Thi...
metaperl/metaperl-proxy
myapp.py
Python
mit
797
from battle_tested.beta.input_type_combos import input_type_combos
CodyKochmann/battle_tested
battle_tested/beta/fuzz_planner.py
Python
mit
68
import os import sys import numpy as np import matplotlib.image as mpimg from ..core.data import Data from ..util import tryremove URL = 'http://synthia-dataset.cvc.uab.cat/SYNTHIA_SEQS/' SEQS = [ # SUMMER and WINTER from sequences `1 - 6` 'SYNTHIA-SEQS-01-SUMMER', 'SYNTHIA-SEQS-01-WINTER', 'SYNTHIA-SEQS...
simonmeister/UnFlow
src/e2eflow/synthia/data.py
Python
mit
2,040
import sys from genStubs import * stub = Stubs( "systemMessages", sys.argv[1], sys.argv[2] ) stub.include( "nanopb/IMessage.h" ) stub.include( "systemMessages/AGLMsg.pb.h" ) stub.include( "systemMessages/AGLOffsetMsg.pb.h" ) stub.include( "systemMessages/AGLRawMsg.pb.h" ) stub.include( "systemMessages/AbortLaunchMsg....
denniswjackson/embedded-tools
apollo/bin/stubFactory/stub_systemMessages.py
Python
mit
13,464
import scipy.misc, numpy as np, os, sys def save_img(out_path, img): img = np.clip(img, 0, 255).astype(np.uint8) scipy.misc.imsave(out_path, img) def scale_img(style_path, style_scale): scale = float(style_scale) o0, o1, o2 = scipy.misc.imread(style_path, mode='RGB').shape scale = float(style_scal...
gmittal/prisma
server/src/utils.py
Python
mit
975
from datetime import datetime import hashlib from extractor import Ways from date import way_date class Helpers: ''' ''' @staticmethod def make_id(website, timestamp): ''' ''' m=hashlib.md5() m.update(''.join([website, timestamp]).encode()) return m.hexdigest() ...
VulcanoAhab/waybackeess
response.py
Python
mit
1,236
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^(?P<quiz_slug>[-A-Za-z0-9_]+)/$', views.quiz, name='quiz'), url(r'^(?P<quiz_slug>[-A-Za-z0-9_]+)/(?P<question_slug>[-A-Za-z0-9_]+)/$', views.question, name='question') ]
super1337/Super1337-CTF
questionnaire/urls.py
Python
mit
299
import sys # this allows you to read the user input from keyboard also called "stdin" import classOne # This imports all the classOne functions import classTwo # This imports all the classTwo functions import classThree # This imports all the classThree functions import classFour # This imports all the classFour fun...
nischal2002/m-quiz-2016
quiz.py
Python
mit
1,704
import numpy from srxraylib.plot.gol import plot_image, plot import sys from comsyl.scripts.CompactAFReader import CompactAFReader def plot_stack(mystack,what="intensity",title0="X",title1="Y",title2="Z"): from silx.gui.plot.StackView import StackViewMainWindow from silx.gui import qt app = qt.QAppl...
srio/oasys-comsyl
orangecontrib/comsyl/scripts/load_results_from_file.py
Python
mit
2,411
from django.conf.urls import url,include from django.contrib import admin from cn_device import views urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^send/(?P<id_ras>[0-9]+)/$',views.payam,name='send condition'), url(r'^give/(?P<id_ras>[0-9]+)/(?P<bl>[0-1])/$', views.give_req, name='give condition'...
msadegh97/IoT_first-project
server/server/urls.py
Python
mit
326
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('core', '0008_auto_20150819_0050'), ] operations = [ migrations.AlterUniqueTogether( name='test', uni...
swarmer/tester
core/migrations/0009_auto_20150821_0243.py
Python
mit
376
""" Run latency & thruput tests on various server configurations. """ import glob import os.path import shutil import time from openmdao.main.mp_util import read_server_config from openmdao.main.objserverfactory import connect, start_server from openmdao.util.fileutil import onerror MESSAGE_DATA = [] def init_mess...
DailyActie/Surrogate-Model
01-codes/OpenMDAO-Framework-dev/openmdao.main/src/openmdao/main/test/netperf.py
Python
mit
3,996
#!/usr/bin/env python # -*- coding: utf-8 -*- import gdb import pwndbg.abi import pwndbg.color.chain as C import pwndbg.color.memory as M import pwndbg.color.theme as theme import pwndbg.enhance import pwndbg.memory import pwndbg.symbol import pwndbg.typeinfo import pwndbg.vmmap LIMIT = pwndbg.config.Parameter('dere...
anthraxx/pwndbg
pwndbg/chain.py
Python
mit
4,555
# encoding: utf-8 __author__ = "Nils Tobias Schmidt" __email__ = "schmidt89 at informatik.uni-marburg.de" from androlyze.error.WrapperException import WrapperException ############################################################ #---Helper functions ############################################################ def _...
nachtmaar/androlyze
androlyze/storage/exception/__init__.py
Python
mit
6,046
import os, sys import commands import optparse import shutil INSTALL_DIR = "" BASE_DIR = os.path.dirname(__file__) SIP_FILE = "poppler-qt4.sip" BUILD_DIR = "build" SBF_FILE = "QtPoppler.sbf" def _cleanup_path(path): """ Cleans the path: - Removes traling / or \ """ path = path.rstrip('/') ...
cbeing/remoteSlideShow
third_party/pypoppler-qt4/configure.py
Python
mit
7,528
#-*- coding: utf8 -*- ''' Examples of advanced Python features: - metaclass - descriptor - generator/forloop ''' from __future__ import print_function import sys if sys.version_info > (3, ): # Python 3 exec(''' def exec_in(code, glob, loc=None): if isinstance(code, str): code = compile(code, '<...
dlutxx/memo
python/advanced.py
Python
mit
1,657
""" Prefill an Array (6 kyu) https://www.codewars.com/kata/54129112fb7c188740000162/train/python Create the function prefill that returns an array of n elements that all have the same value v. See if you can do this without using a loop. You have to validate input: - v can be anything (primitive or otherwise) - if...
benpetty/Code-Katas
katas/prefill_an_array/prefill_an_array.py
Python
mit
1,086
from .mdl_user import * from .mdl_club import * from .mdl_event import * from .mdl_receipt import * from .mdl_budget import * from .mdl_division import * from .mdl_eventsignin import * from .mdl_joinrequest import *
fsxfreak/club-suite
clubsuite/suite/models/__init__.py
Python
mit
216
__author__ = 'deevarvar' import string import random import os #generate a random string def string_generator(size=6, chars=string.ascii_letters+string.digits): return ''.join(random.choice(chars) for _ in range(size)) #emulate touch cmd def touchFile(fname, time=None): with open(fname, 'a'): os.uti...
deevarvar/myLab
book/tlpi_zhiye/utlib/ut_util.py
Python
mit
335
import typing from flask import json FlaskHeaders = typing.Union[typing.List[typing.Tuple[str, str]], typing.Dict[str, str]] FlaskResponse = typing.Tuple[str, int, FlaskHeaders] def success(data, status=200) -> FlaskResponse: return json.dumps(data, indent=2), status, [("Content-Type", "application/json")] de...
nanobox-io/nanobox-adapter-libcloud
nanobox_libcloud/utils/output.py
Python
mit
612
#!/usr/bin/python2 # core.py # aoneill - 04/10/17 import sys import random import time import pauschpharos as PF import lumiversepython as L SEQ_LIM = 200 def memoize(ignore = None): if(ignore is None): ignore = set() def inner(func): cache = dict() def wrapper(*args): m...
alexoneill/15-love
game/core.py
Python
mit
1,573
from .circleclient import __version__
qba73/circleclient
circleclient/__init__.py
Python
mit
39
#!/usr/bin/env python3 # Copyright (c) 2014-2017 The Doriancoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the wallet keypool and interaction with wallet encryption/locking.""" from test_framework.test...
doriancoins/doriancoin
test/functional/wallet_keypool.py
Python
mit
3,428
#! /usr/bin/env python """Unit tests for SCardConnect/SCardStatus/SCardDisconnect This test case can be executed individually, or with all other test cases thru testsuite_scard.py. __author__ = "http://www.gemalto.com" Copyright 2001-2012 gemalto Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com Thi...
mixja/eap-sim-lab
lib/pyscard-1.6.16/smartcard/test/scard/testcase_getatr.py
Python
mit
3,083
#!/usr/bin/env python from argparse import ArgumentParser from collections import defaultdict import sys import os from sonLib.bioio import cigarRead, cigarWrite, getTempFile, system def getSequenceRanges(fa): """Get dict of (untrimmed header) -> [(start, non-inclusive end)] mappings from a trimmed fasta.""" ...
benedictpaten/cactus
src/cactus/blast/upconvertCoordinates.py
Python
mit
4,797
import pickle from pueue.client.socket import connect_socket, receive_data, process_response def command_factory(command): """A factory which returns functions for direct daemon communication. This factory will create a function which sends a payload to the daemon and returns the unpickled object which ...
Nukesor/Pueuew
pueue/client/factories.py
Python
mit
2,761
__author__ = 'zhonghong'
linzhonghong/zapi
zapi/core/__init__.py
Python
mit
26
#!/usr/bin/env python """ Title : Java program file Author : JG Date : dec 2016 Objet : script to create Propertie File Program in : get infos from yml out : print infos in properties file """ import sys,os import yaml import util as u from random import randint # =====================================...
JeGoi/IPa2
packages/java_properties.py
Python
mit
6,870
import os os.environ['KIVY_GL_BACKEND'] = 'gl' #need this to fix a kivy segfault that occurs with python3 for some reason from kivy.app import App class TestApp(App): pass if __name__ == '__main__': TestApp().run()
ISS-Mimic/Mimic
Pi/kivytest/Test_Kivy.py
Python
mit
225
import os.path, sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) import json import falcon import urllib import uuid import settings import requests from geopy.geocoders import Nominatim import geopy.distance from geopy.distance import vincenty import datetime radius = [] radius...
c-goosen/mytransport-hackathon
api/endpoints/interest.py
Python
mit
7,851
def main(**kwargs): print('foo foo')
lorien/runscript
test/script/foo.py
Python
mit
41
#!/usr/bin/env python3 # Copyright (c) 2014-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test mempool persistence. By default, bitcoind will dump mempool on shutdown and then reload it on sta...
tjps/bitcoin
test/functional/mempool_persist.py
Python
mit
6,912
import argparse from collections import defaultdict, Counter, deque import random import json import time from tqdm import tqdm import wikipedia class MarkovModel(object): def __init__(self): self.states = defaultdict(lambda: Counter()) self.totals = Counter() def add_sample(self, state, foll...
bschug/neverending-story
markov.py
Python
mit
5,169
from sanic.exceptions import * class GatcoException(SanicException): pass
gonrin/gatco
gatco/exceptions.py
Python
mit
78
SCORES = {'A': 100, 'B': 14, 'C': 9, 'D': 28, 'E': 145, 'F': 12, 'G': 3, 'H': 10, 'I': 200, 'J': 100, 'K': 114, 'L': 100, 'M': 25, 'N': 450, 'O': 80, 'P': 2, 'Q': 12, 'R': 400, 'S': 113, 'T': 405, 'U': 11, 'V': 10, 'W': 10, 'X': 3, 'Y': 210, 'Z': 23} def sexy_name(name): name_score =...
the-zebulan/CodeWars
katas/beta/how_sexy_is_your_name.py
Python
mit
566
l = list(range(1, 20 + 1, 2)) # this is wasteful in this program for i in l: print(i)
thoughtarray/IntroToProgramming
Chapter 4 Working with Lists/4_6.py
Python
mit
91
#!/usr/bin/env python3 import json import os import unittest import requests AGNOS_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__))) MANIFEST = os.path.join(AGNOS_DIR, "agnos.json") class TestAgnosUpdater(unittest.TestCase): def test_manifest(self): with open(MANIFEST) as f: m = json.load(f...
commaai/openpilot
selfdrive/hardware/tici/test_agnos_updater.py
Python
mit
595
import argparse import smtplib import mimetypes import os.path as path from email import encoders from email.mime.base import MIMEBase from email.mime.multipart import MIMEMultipart def parseOptions(): parser = argparse.ArgumentParser(description='Send e-books to my Kindle Paperwhite.') parser.add_argument('file', t...
comicxmz001/Send2Kindle
Send2Kindle_command_line.py
Python
mit
2,130
import deep_architect.searchers.common as se import numpy as np # NOTE: this searcher does not do any budget adjustment and needs to be # combined with an evaluator that does. class SuccessiveNarrowing(se.Searcher): def __init__(self, search_space_fn, num_initial_samples, reduction_factor, reset...
negrinho/deep_architect
deep_architect/searchers/successive_narrowing.py
Python
mit
3,234
# Copyright (c) 2015 The Phtevencoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Dummy Socks5 server for testing. ''' from __future__ import print_function, division, unicode_literals import socket, threadin...
ravenbyron/phtevencoin
qa/rpc-tests/test_framework/socks5.py
Python
mit
5,705
# -*- coding: utf-8 -*- """Implement directed graph abstract data type.""" from __future__ import print_function from .stack import Stack from .queue import Queue class Graph(object): """Implement a directed graph.""" def __init__(self): """Initialize a graph with no nodes or edges.""" self...
welliam/data-structures
src/graph.py
Python
mit
5,049
import os import shutil import unittest from django.utils import six from django_node import node, npm from django_node.node_server import NodeServer from django_node.server import server from django_node.base_service import BaseService from django_node.exceptions import ( OutdatedDependency, MalformedVersionInput,...
markfinger/django-node
tests/tests.py
Python
mit
8,492
import numpy as np import matplotlib.pyplot as plt import pandas as pd WGS = ['G69145', 'G71602', 'G71608', 'G76270'] ### scatch import duplicate text files # fname = "/seq/picard_aggregation/G69145/NA12878/current/NA12878.duplicate_metrics" # gdup = pd.read_csv(fname, "\t", skiprows=range(10), comment="#", names=[...
lhogstrom/ThornsInRoses
seq_duplication/dup_averages_wgs_nexome.py
Python
mit
2,668
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('questions', '0013_auto_20160210_0400'), ] operations = [ migrations.AlterField( model_name='category', ...
moshthepitt/answers
questions/migrations/0014_auto_20160210_0406.py
Python
mit
573
import tensorflow as tf import tensorflow.contrib.slim as slim class BaseReader(object): def read(self): raise NotImplementedError() class ImageReader(BaseReader): def __init__(self): self.width = None self.height = None def get_image_size(self): return self.width, self....
ml-101/templates
readers.py
Python
mit
1,577
#!/usr/bin/python2.7 from django.http import HttpResponse from AfricasTalkingGateway import AfricasTalkingGateway, AfricasTalkingGatewayException from reminder.models import Reminder import sys import os import django sys.path.append("/home/foxtrot/Dropbox/tunza_v2/") os.environ["DJANGO_SETTINGS_MODULE"] = "config.set...
omwomotieno/tunza_v3
call/callback.py
Python
mit
2,707
import requests # https://github.com/kennethreitz/grequests/issues/103 from gevent import monkey def stub(*args, **kwargs): # pylint: disable=unused-argument pass monkey.patch_all = stub import grequests import os import json from requests.adapters import HTTPAdapter from urllib3.util.retry import Retry meraki_ap...
joshand/CICO
cico_meraki.py
Python
mit
16,220
""" Created on 19 Nov 2020 @author: Bruno Beloff (bruno.beloff@southcoastscience.com) Two-Channel I2C-Bus Switch With Interrupt Logic and Reset https://www.ti.com/product/PCA9543A """ from scs_host.bus.i2c import I2C # ------------------------------------------------------------------------------------------------...
south-coast-science/scs_dfe_eng
src/scs_dfe/gas/scd30/pca9543a.py
Python
mit
1,642
""" A 2d grid map of m rows and n columns is initially filled with water. We may perform an addLand operation which turns the water at position (row, col) into a land. Given a list of positions to operate, count the number of islands after each addLand operation. An island is surrounded by water and is formed by connec...
amaozhao/algorithms
algorithms/union-find/count_islands.py
Python
mit
2,094
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals """This file is part of the django ERP project. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ...
mobb-io/django-erp
djangoerp/menus/signals.py
Python
mit
2,406
# @Author # Chloe-Agathe Azencott # chloe-agathe.azencott@mines-paristech.fr # April 2016 import argparse import h5py import numpy as np import os import sys def main(): """ Create train/test indices for one repeat of a 10-fold sampled leave-one-study-out experiment on the RFS data. The indices will be...
chagaz/SamSpecCoEN
code/setupSampledLOSO_writeIndices.py
Python
mit
5,303
import collections import unittest from kobold import assertions class TestAssertEqual(unittest.TestCase): def test_empty_hashes(self): assertions.assert_equal({}, {}) def test_distinct_keys(self): self.assertRaises( AssertionError, assertions.assert_equal, ...
krieghan/kobold_python
kobold/tests/test_assertions.py
Python
mit
2,267
# 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 ...
vulcansteel/autorest
AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/auto_rest_parameter_grouping_test_service/operations/parameter_grouping_operations.py
Python
mit
11,840
#!/usr/bin/env python # encoding: utf-8 # # Copyright (c) 2015 deanishe@deanishe.net # # MIT Licence. See http://opensource.org/licenses/MIT # # Created on 2015-11-23 # """Get app info with AppKit via objc bridge.""" from __future__ import print_function, unicode_literals, absolute_import import time import unicoded...
deanishe/alfred-appscripts
active_app_benchmarks/active_app_02_objc_bridge.py
Python
mit
1,286
"""Contains utility methods used by and with the pyebnf package.""" import math def esc_split(text, delimiter=" ", maxsplit=-1, escape="\\", *, ignore_empty=False): """Escape-aware text splitting: Split text on on a delimiter, recognizing escaped delimiters.""" is_escaped = False split_count = 0 yval = []...
treycucco/pyebnf
pyebnf/util.py
Python
mit
3,561
#### # Figure 4 # needs: # - data/*.npz produced by run.py #### import glob import sys sys.path.append('..') from lib.mppaper import * import lib.mpsetup as mpsetup import lib.immune as immune files = sorted((immune.parse_value(f, 'epsilon'), f) for f in glob.glob("data/*.npz")) import run sigma = run.sigma #### le...
andim/optimmune
fig4/fig4.py
Python
mit
2,501
import random import string def random_string(n): result = '' for _ in range(10): result += random.SystemRandom().choice( string.ascii_uppercase + string.digits) return result
adrianp/cartz
server/utils.py
Python
mit
210
# -*- coding: utf-8 -*- from os import getcwd, listdir from os.path import abspath, dirname, isdir, join as path_join from shutil import rmtree from sys import exc_info from tempfile import mkdtemp from unittest import TestCase from mock import patch, MagicMock from robot.libraries.BuiltIn import BuiltIn CURDIR = abs...
Eficode/robotframework-imagehorizonlibrary
tests/utest/test_screenshot.py
Python
mit
2,185
import tkinter.filedialog as tkFileDialog import numpy as np from numpy import sin,cos import os def InnerOrientation(mat1,mat2): """ mat1 为像素坐标,4*2,mat2为理论坐标4*2, h0,h1,h2,k0,k1,k2,这六个参数由下列矩阵定义: [x]=[h0]+[h1 h2] [i] [y]=[k0]+[k1 k2] [j] 返回6个定向参数的齐次矩阵,x方向单位权方差,y方向单位权方差 [h1 h2 h0] [k1 k2 ...
YU6326/YU6326.github.io
code/photogrammetry/inner_orientation.py
Python
mit
3,899
# coding=utf-8 """Unit tests for mapi/endpoints/tmdb.py.""" import pytest from mapi.endpoints import tmdb_find, tmdb_movies, tmdb_search_movies from mapi.exceptions import MapiNotFoundException, MapiProviderException from tests import JUNK_TEXT GOONIES_IMDB_ID = "tt0089218" GOONIES_TMDB_ID = 9340 JUNK_IMDB_ID = "tt...
jkwill87/mapi
tests/endpoints/test_endpoints_tmdb.py
Python
mit
4,908
"""Provide infrastructure to allow exploration of variations within populations. Uses the gemini framework (https://github.com/arq5x/gemini) to build SQLite database of variations for query and evaluation. """ import collections import csv from distutils.version import LooseVersion import os import subprocess import ...
gifford-lab/bcbio-nextgen
bcbio/variation/population.py
Python
mit
12,759
from Operators.Mutation.Mutator import Mutator from Operators.Mutation.DisplacementMutator import DisplacementMutator from Operators.Mutation.InversionMutator import InversionMutator
akkenoth/TSPGen
Operators/Mutation/__init__.py
Python
mit
183
class Solution(object): def dfs(self,rooms): # get all gate position queue=[(i,j,0) for i,rows in enumerate(rooms) for j,v in enumerate(rows) if not v] while queue: i,j,depth=queue.pop() # has a min path to gate and update if depth<rooms[i][j]: ...
Tanych/CodeTracking
286-Walls-and-Gates/solution.py
Python
mit
1,268
from .base import BASE_DIR, INSTALLED_APPS, MIDDLEWARE_CLASSES, REST_FRAMEWORK DEBUG = True ALLOWED_HOSTS = ['127.0.0.1'] SECRET_KEY = 'secret' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'holonet', 'USER': 'holonet', 'PASSWORD': '', ...
webkom/holonet
holonet/settings/development.py
Python
mit
1,029
import requests import copy # Получаем участников группы FB def fb_get_group_members(fb_page_id, access_token): url = 'https://graph.facebook.com/v2.8/%s/members?limit=1000&access_token=%s' % (fb_page_id, access_token) fb_group_members = {'status':'OK', 'data':{'members':[], 'users_count':0}} while T...
eugeneks/zmeyka
fb_req.py
Python
mit
10,919
# -*- coding: utf-8 -*- """ frest - flask restful api frame ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This project is the frame of the restful api server created with flask. :copyright: (C) 2017 h4wldev@gmail.com :license: MIT, see LICENSE for more details. """ import os from flask_script import Server, Ma...
h4wldev/Frest
app.py
Python
mit
1,064
import sys #from OpenGL.GLUT import * #from OpenGL.GLU import * #from OpenGL.GL import * class abstract: params = {} windowId = None terminated = False def initParams(self): return self def __init__(self): self.initParams().init() return def init(self...
nv8h/PyRattus
base/modules/rat/application/abstract.py
Python
mit
1,309
#! /usr/bin/python import event import nxt.locator import nxt.motor as motor brick = nxt.locator.find_one_brick() height_motor = motor.Motor(brick, motor.PORT_A) height_motor.turn(127, 5000, brake=False)
rolisz/walter_waiter
lower.py
Python
mit
203
#!/usr/bin/env python # -*- coding: utf-8 -*- from GestureAgentsTUIO.Tuio import TuioAgentGenerator import GestureAgentsPygame.Screen as Screen from pygame.locals import * class MouseAsTuioAgentGenerator(object): def __init__(self): self.pressed = False self.myagent = None self.sid = -1...
chaosct/GestureAgents
GestureAgentsPygame/Mouse.py
Python
mit
1,272
#!/usr/bin/python3 # Filename: k_means_cluster.py """ A Machine learning algorithm for K mean clustering. Date: 24th March, 2015 pm """ __author__ = "Anthony Wanjohi" __version__ = "1.0.0" import random, fractions def euclidean_distance(point, centroid): '''Returns the euclidean distance between two points''' asser...
TonyHinjos/Machine-Learning-Algorithms-Toolkit
k-means-clustering/k_means_cluster.py
Python
mit
4,794
import subprocess import os #from tailorscad.config import ScadConfig BASE_DIR = '/usr/bin/' DEFAULT = BASE_DIR + 'openscad' def build_with_openscad(state): args = build_args_from_state(state) out_call = '' for arg in args: out_call += ' ' + arg print 'args:', out_call try: ...
savorywatt/tailorSCAD
tailorscad/builder/openscad.py
Python
mit
1,142
# coding: utf-8 """ ORCID Member No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: Latest Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import si...
Royal-Society-of-New-Zealand/NZ-ORCID-Hub
orcid_api_v3/models/funding_contributor_v30_rc1.py
Python
mit
6,669
from django.contrib import admin from Players.models import Player @admin.register(Player) class PlayerAdmin(admin.ModelAdmin): view_on_site = True list_display = ('pk', 'first_name', 'last_name', 'number', 'team', 'position', 'age', 'height', 'weight') list_filter = ['team', 'position'] search_field...
pawelad/BLM
Players/admin.py
Python
mit
851
"""Th tests for the Rfxtrx component.""" # pylint: disable=too-many-public-methods,protected-access import unittest import time from homeassistant.bootstrap import _setup_component from homeassistant.components import rfxtrx as rfxtrx from tests.common import get_test_home_assistant class TestRFXTRX(unittest.TestCas...
Zyell/home-assistant
tests/components/test_rfxtrx.py
Python
mit
4,095
import sys import os.path import subprocess PY3 = sys.version >= '3' from setuptools import setup, find_packages # http://blogs.nopcode.org/brainstorm/2013/05/20/pragmatic-python-versioning-via-setuptools-and-git-tags/ # Fetch version from git tags, and write to version.py. # Also, when git is not available (PyPi pa...
richli/dame
setup.py
Python
mit
1,201
#/usr/bin/env python #Base Server -Chapter three -basicserver.py import socket, traceback host='' port=8080 s=socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind((host, port)) print "Waiting for connections..." s.listen(1) while True: try: clien...
jac2130/BayesGame
foundations-of-python-network-programming/python2/01/basicserver.py
Python
mit
745
''' Auxiliary code providing vector-valued scoring functions for convenient use in the parameter-free Ladder Mechanism. Original algorithm by Avrim Blum and Moritz Hardt Python implementation by Jamie Hall and Moritz Hardt MIT License ''' from sklearn.utils import check_consistent_length from functools import wraps ...
nerdcha/escalator
escalator/scorers.py
Python
mit
1,361
import sys import os import glob import inspect import pylab as pl from numpy import * from scipy import optimize import pickle import time import copy cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile(inspect.currentframe()))[0]) + "/templates") if cmd_folder not in sys.path: sys.path.in...
fedhere/SESNCfAlib
vaccaleibundgut.py
Python
mit
4,704
from tailorscad.builder.openscad import build_with_openscad from tailorscad.builder.coffeescad import build_with_coffeescad from tailorscad.constants import OPENSCAD from tailorscad.constants import COFFEESCAD def build_from_state(state): if state.scad_type is OPENSCAD: build_with_openscad(state) if...
savorywatt/tailorSCAD
tailorscad/builder/__init__.py
Python
mit
389
import yaml from os import makedirs from os.path import join,dirname,realpath,isdir script_dir = dirname(realpath(__file__)) default_yml_filepath = join(script_dir,'defaults.yml') defaults = { "output_dir": 'output', "header_img_dir": 'imgs/headers/', "scaled_img_dir": 'imgs/scaled/', "original_img_d...
naggie/dsblog
dsblog/environment.py
Python
mit
1,659
#!/usr/bin/python import sys text = sys.stdin.read() print 'Text:',text words = text.split() print 'Words:',words wordcount = len(words) print 'Wordcount:',wordcount
MarsBighead/mustang
Python/somescript.py
Python
mit
167
#!/usr/bin/python import socket import sys HOST, PORT = "24.21.106.140", 8080 # Create a socket (SOCK_STREAM means a TCP socket) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: # Connect to server and send data print "Connected to ", HOST, ":", PORT, "\n","Awaiting input\n" data = sys.stdi...
hillst/RnaMaker
bin/daemons/testclient.py
Python
mit
789
DATASET_DIR = '/tmp' BRAIN_DIR = '/tmp' GENRES = [ 'blues', 'classical', 'country', 'disco', 'hiphop', 'jazz', 'metal', 'pop', 'reggae', 'rock' ] NUM_BEATS = 10 KEEP_FRAMES = 0 TRAIN_TEST_RATIO = [7, 3] MODE = 'nn' PCA = False FEATURES = ['mfcc', 'dwt', 'beat'] MFCC_EXTRA = ['delta', 'ddelta', 'energy'...
kapilgarg1996/gmc
gmc/conf/global_settings.py
Python
mit
1,053
''' @author: KyleLevien ''' from ..defaultpackage.package import Package class _Ghostview(Package): def __init__(self): Package.__init__(self)
mason-bially/windows-installer
packages/_Ghostview/_Ghostview.py
Python
mit
169
#!/usr/bin/python3 #-*- coding: utf-8 -*- ############################################## # Home : http://netkiller.github.io # Author: Neo <netkiller@msn.com> # Upgrade: 2021-09-05 ############################################## # try: import os, sys module = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ...
oscm/devops
demo/docker.py
Python
mit
2,328
# -*- coding: utf-8 -*- # Copyright (c) 2006-2010 Tampere University of Technology # # 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 r...
tema-mbt/tema-adapterlib
adapterlib/testrunner.py
Python
mit
15,926