code
stringlengths
6
947k
repo_name
stringlengths
5
100
path
stringlengths
4
226
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
6
947k
#!/usr/bin/env python import os # My Sonos SONOS_IP = '192.168.0.34' # API stuff,. DHT_API_URL = os.environ['DHT_API_URL'] DB_BASE_TIMECODE = '%Y-%m-%d %H:%M:%S.%f'
BenSimonds/DHTSite
app/dhtapp/config.py
Python
mit
166
""" WSGI config for bknet project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` se...
benkuhn/benkuhn.net
bknet/wsgi.py
Python
mit
1,132
"""Virtual environment relocatable mixin.""" from __future__ import division from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import os import shutil class RelocateMixin(object): """Mixin which adds the ability to relocate a virtual environmen...
kevinconway/venvctrl
venvctrl/venv/relocate.py
Python
mit
3,455
# coding=utf-8 from copy import deepcopy from ..exception import UnimplementedException from .utils import ConstValue, build_zhihu_obj_from_dict, SimpleEnum __all__ = ['SearchResult', 'SearchResultSection', 'SearchType'] _search_type_t_map = { 'GENERAL': 'general', 'PEOPLE': 'people', 'TOPIC': 'topic',...
lbc001/zhihu-oauth
zhihu_oauth/zhcls/search.py
Python
mit
6,167
# -*- coding: utf-8 -*- import os from django import template register = template.Library() @register.simple_tag def get_altair_scripts(dashboard_slug): path = "dashboards/" + dashboard_slug + "/altair_scripts" scripts = os.listdir("templates/" + path) includes = [] for script in scripts: inc...
synw/django-chartflo
chartflo/templatetags/chartflo_tags.py
Python
mit
374
"""Unit tests of authorization searches.""" import pytest from ..utilities.general import is_never_authz, is_no_authz, uses_cataloging, uses_filesystem_only from dlkit.abstract_osid.osid import errors from dlkit.primordium.id.primitives import Id from dlkit.primordium.type.primitives import Type from dlkit.runtime ...
mitsei/dlkit
tests/authorization/test_searches.py
Python
mit
5,434
import sys import numpy as np import os import pandas as pd from sklearn import preprocessing import re from nltk.corpus import stopwords from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.feature_extraction.text import TfidfVectorizer f...
gtesei/fast-furious
competitions/jigsaw-toxic-comment-classification-challenge/eda.py
Python
mit
11,538
from math import log from PIL import Image, ImageDraw my_data = [['slashdot', 'USA', 'yes', 18, 'None'], ['google', 'France', 'yes', 23, 'Premium'], ['digg', 'USA', 'yes', 24, 'Basic'], ['kiwitobes', 'France', 'yes', 23, 'Basic'], ['google', 'UK', 'no', 21, 'Premium'], ...
luoshao23/ML_algorithm
Decission_Tree/tree.py
Python
mit
7,395
def Tmin(arg0, *args): _min = arg0 for arg in args: if arg < _min: _min = arg return _min
Oreder/PythonSelfStudy
TestModule/Tmin.py
Python
mit
122
import json from django.contrib.auth import authenticate, login, logout from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.core.context_processors import csrf from django.http import HttpResponseRedirect, HttpResponse from django.shortcuts import render, r...
Earthstar/double-d
streetfarer/views.py
Python
mit
7,086
#name:make_figures.py #author:Will Barnes #Description: make some figures useful to notes on AIA response functions import numpy as np import matplotlib.pyplot as plt import seaborn.apionly as sns def display_aia_response_control_flow(): """Show the control flow of the IDL programs used to compute AIA response fu...
wtbarnes/aia_response
make_figures.py
Python
mit
2,177
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'Event.date' db.delete_column(u'photocontest_event', 'da...
endthestart/photocontest
photocontest/photocontest/migrations/0009_auto__del_field_event_date.py
Python
mit
2,554
""" Django settings for pinned project. Generated by 'django-admin startproject' using Django 1.11.6. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os ...
LorenzSelv/pinned
pinned/settings.py
Python
mit
5,525
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2016-08-16 00:39 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('user', '0009_auto_20160816_0720'), ] operations = [ migrations.AlterField( ...
internship2016/sovolo
app/user/migrations/0010_auto_20160816_0939.py
Python
mit
1,662
# -*- coding: utf-8 -*- from branca.element import MacroElement from folium.elements import JSCSSMixin from folium.utilities import parse_options from jinja2 import Template class MeasureControl(JSCSSMixin, MacroElement): """ Add a measurement widget on the map. Parameters ---------- position: str...
ocefpaf/folium
folium/plugins/measure_control.py
Python
mit
1,858
"""1310. XOR Queries of a Subarray https://leetcode.com/problems/xor-queries-of-a-subarray/ Given the array arr of positive integers and the array queries where queries[i] = [Li, Ri], for each query i compute the XOR of elements from Li to Ri (that is, arr[Li] xor arr[Li+1] xor ... xor arr[Ri] ). Return an array conta...
isudox/leetcode-solution
python-algorithm/leetcode/problem_1310.py
Python
mit
1,637
""" This is a dummy to try and get a gis gui up and running """ from GUI_1 import MyShape import json from collections import defaultdict from tkinter import * from tkinter import ttk from descartes.patch import PolygonPatch import shapely import shapely.geometry as geometry from shapely.ops import cascaded_union impor...
d15123601/geotinkering
dummy_gis.py
Python
mit
17,528
while True: pass print('1. from Fahrenheit to Celsius') print('2. from Inches to Centimeter') print('3. from Feet to Meter') print('4. from Pounds to Kilogram') valg=int(input()) if (valg == 1): while True: print("Enter a temperature in Fahrenheit, enter q too quite : "...
basirsedighi/LearingPython
01.Loops/FirstStepToBecomePropperEuropean.py
Python
mit
1,484
import os, sys, hashlib, random, time from functions import * from helpers import * working_dir = os.getcwd() args = sys.argv package = 0 if(os.path.isfile(args[1])): package = open(args[1], 'rb') else: sys.exit(-1) IV = package.read(64) key = setupKey(args[2], IV) checksum = list(applyXOR(bytearray(package.read(1...
SpencerBelleau/glyptodon
modules/scanner.py
Python
mit
1,018
''' Created on 04.10.2012 @author: michi ''' from PyQt4.QtCore import pyqtSignal from ems.qt4.applicationservice import ApplicationService #@UnresolvedImport class ModelUpdateService(ApplicationService): objectIdsUpdated = pyqtSignal(str, list) objectsUpdated = pyqtSignal(str) modelUpdate...
mtils/ems
ems/qt4/services/modelupdate.py
Python
mit
590
from room import Room r = Room() r.roomname = 'room 420' r.exits = {'hallway': 'hallway'} r.roomdesc = """ as the door opens smoke languidly rolls out. The lights are off and the curtain is pulled, which would normally make for a very dark room except for what appears to be a super nova sitting in the corner of the ro...
elstupido/rpg
rooms/prolog/Room420-1.room.py
Python
mit
1,463
from django.conf import settings from django.http import HttpResponse, HttpResponseForbidden from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_POST from functools import wraps from twilio.twiml.voice_response import VoiceResponse from twilio.twiml.messaging_response i...
TwilioDevEd/webhooks-example-django
webhooks/views.py
Python
mit
2,249
import random def randomurl(): chars='abcdefghijklmnopqrstuvwxyz' length=random.randint(5, 20) choice=random.choice return ''.join(choice(chars) for i in range(length))+'.com' def xssencode(javascript): javascript2='eval(String.fromCharCode(%s))' % ','.join(str(ord(i)) for i in javascript) ...
RaspPiTor/JAPTT
XSS/xssencode.py
Python
mit
1,283
# Very simple example application for BrickPython. # # Copyright (c) 2014 Charles Weir. Shared under the MIT Licence. import sys, os # Python path kludge - omit these 2 lines if BrickPython is installed. sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))) from BrickPython.CommandLineAp...
charlesweir/BrickPython
ExamplePrograms/SimpleApp.py
Python
mit
990
import new import byteplay as bp import inspect def persistent_locals(f): """Function decorator to expose local variables after execution. Modify the function such that, at the exit of the function (regular exit or exceptions), the local dictionary is copied to a read-only function property 'locals'. ...
ActiveState/code
recipes/Python/577283_Decorator_expose_local_variables_functiafter/recipe-577283.py
Python
mit
3,276
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv) # if os.path.exists('.env'): # print('Importing environment from .env...') # for...
junqueira/balance
manage.py
Python
mit
1,570
""" Contains Stdout writer """ #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #---------------...
mattvonrocketstein/smash
smashlib/ipy3x/nbconvert/writers/stdout.py
Python
mit
1,101
from django import forms from django.core.validators import MinLengthValidator from ddcz.notifications import Audience class News(forms.Form): text = forms.CharField( label="", widget=forms.Textarea( attrs={"class": "comment__textarea", "cols": 80, "rows": 30}, ), vali...
dracidoupe/graveyard
dragon/forms/news.py
Python
mit
481
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('interpreter', '0010_auto_20141215_0027'), ] operations = [ migrations.RemoveField( model_name='band', ...
nanomolina/MusicWeb
src/Music/apps/interpreter/migrations/0011_auto_20141215_0030.py
Python
mit
600
from __future__ import unicode_literals import sys if sys.version_info >= (2, 7): # Django Ticket #17671 - Allow using a cursor as a ContextManager # in Python 2.7 from django.db.backends.util import CursorWrapper if not hasattr(CursorWrapper, '__enter__'): enter = lambda self: self exi...
yousseb/django_pytds
django_pytds/patches.py
Python
mit
485
# Twisted Imports from twisted.internet import reactor, defer, task from twisted.internet.interfaces import IAddress # Zope Imports from zope.interface import implementer # Phidget Imports from Phidgets.PhidgetException import PhidgetErrorCodes, PhidgetException # System Imports import time @implementer(IAddress) ...
rasata/octopus
octopus/transport/phidgets.py
Python
mit
1,712
from .expressions import Value from ..exceptions import BuilderError def get_param_store(paramstyle): if paramstyle == "qmark": return QmarkParamStore() elif paramstyle == "numeric": return NumericParamStore() elif paramstyle == "named": return NamedParamStore() elif paramstyle ...
modimore/BreezeBlocks
package/breezeblocks/sql/param_store.py
Python
mit
3,955
from django.conf.urls import url from . import views app_name = 'feed' urlpatterns = [ url(r'^$', views.FeedView.as_view(), name='userfeed'), url(r'ajax/more/$', views.LoadMoreAjax.as_view(), name='ajax_loadmore'), ]
peromo93/instapix
feed/urls.py
Python
mit
228
import pytest from sanic import Sanic from sanic.errorpages import exception_response from sanic.exceptions import NotFound from sanic.request import Request from sanic.response import HTTPResponse @pytest.fixture def app(): app = Sanic("error_page_testing") @app.route("/error", methods=["GET", "POST"]) ...
channelcat/sanic
tests/test_errorpages.py
Python
mit
2,703
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('hack_plot', '0005_auto_20150505_1940'), ] operations = [ migrations.AddField( model_name='sshhackip', ...
hellsgate1001/graphs
hack_plot/migrations/0006_sshhackip_located.py
Python
mit
444
#! /usr/bin/env python # -*- coding: utf-8 -*- import tensorflow as tf def batch_norm(inputs, name_scope, is_training, epsilon=1e-3, decay=0.99): with tf.variable_scope(name_scope): size = inputs.get_shape().as_list()[1] gamma = tf.get_variable( 'gamma', [size], initializer=tf.consta...
hirofumi0810/tensorflow_end2end_speech_recognition
models/recurrent/layers/batch_normalization.py
Python
mit
1,447
""" shapefile.py Provides read and write support for ESRI Shapefiles. author: jlawhead<at>geospatialpython.com date: 2015/06/22 version: 1.2.3 Compatible with Python versions 2.4-3.x version changelog: Reader.iterShapeRecords() bugfix for Python 3 """ __version__ = "1.2.3" from struct import pack, unpack,...
CalebM1987/pyshp
shapefile.py
Python
mit
47,927
from __future__ import division from bs4 import BeautifulSoup import urllib2 import re def url_request(url): hdr = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36', 'Accept':'*/*'} request = urllib2.Request(url, headers=hd...
wang-g/wang-g.github.io
support_data.py
Python
mit
4,150
from unittest import TestCase class TestStage(TestCase): def test_add_players(self): self.fail() def test_initialize_settings(self): self.fail() def test_initialize_players(self): self.fail() def test_on_enter(self): self.fail() def test_on_pre_leave(self): ...
Zenohm/mafiademonstration
tests/test_stage.py
Python
mit
336
# 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/v2018_12_01/aio/operations/_public_ip_addresses_operations.py
Python
mit
43,544
import sys import re import argparse import os.path BLOCK_TAG_START = '{%' BLOCK_TAG_END = '%}' tag_re = (re.compile('(%s.*?%s)' % (re.escape(BLOCK_TAG_START), re.escape(BLOCK_TAG_END)))) name_extract_re = (re.compile('%s\W*block\W+([^\W]+)\W*?%s' % (re.escape(BLOCK_TAG_START), re.escape...
susanctu/Crazyfish-Public
webgen/webgen.py
Python
mit
8,518
from app import models from app import db u = models.User(first_name="Sam", last_name="Redmond") s = models.Subject(name="math") db.session.add(u) db.session.commit() db.session.add(u.teachSubject(s)) db.session.commit() print "Got here" for t in s.tutors: print t for sub in u.subjectsITutor: print sub
sredmond/menlo-mathsci-help
app/tests.py
Python
mit
306
import subprocess subp=subprocess.Popen('./test.sh',shell=True,stdout=subprocess.PIPE) while subp.poll()==None: print subp.stdout.readline() print subp.returncode
zhulangen/python-websocket-shell
tests/exc_shell.py
Python
mit
168
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-05-12 08:14 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('article', '0002_auto_20170512_1554'), ] operations =...
stffer/yunshu
article/migrations/0003_auto_20170512_1614.py
Python
mit
645
from __future__ import unicode_literals import logging from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist from django.db import connections, router, transaction from django.db.models import Manager, Q from django.db.models.query import QuerySet from django.utils import s...
chipx86/reviewboard
reviewboard/reviews/managers.py
Python
mit
28,564
import mdp import Oger import numpy import pylab import random ### README # study the memory capacities of same size reservoirs def main(): num_waves = 100 waves = [gen_test_wave(2.0*random.random()-1.0) for x in range(num_waves)] print "Shape of waves" , numpy.shape(waves[0]) ### Create reservoir...
grezesf/Research
Reservoirs/Task5-Memory_Tuning/task5.py
Python
mit
2,640
from django.conf.urls import url, include from rest_framework import routers from .views import BookmarkViewSet, GetTitle router = routers.DefaultRouter() router.register(r'bookmarks', BookmarkViewSet) urlpatterns = [ url(r'^get-title/$', GetTitle.as_view(), name='get_title'), url(r'^', include(router.urls...
hellsgate1001/waypoints
waypoints/bookmarks/api_urls.py
Python
mit
326
'''Standard challenge module.''' import os import shutil import fcntl from cffi import FFI from tornado import gen, concurrent, process from tornado.stack_context import StackContext from tornado.ioloop import IOLoop import PyExt import Privilege import Config from Utils import FileUtils STATUS_NONE = 0 STATUS_AC = ...
pzread/judge
StdChal.py
Python
mit
33,830
# -*- coding: utf-8 -*- import random import pytest from holviapi.utils import ( ISO_REFERENCE_VALID, fin_reference_isvalid, int2fin_reference, iso_reference_isvalid, str2iso_reference ) def test_fin_reference_isvalid_valid_results(): """Test handpicked, known-good inputs""" assert fin_re...
rambo/python-holviapi
holviapi/tests/test_refnos.py
Python
mit
2,888
# import os import random import torch import numpy as np def cor_pairs_match_Adam(Kx, Kz, N, params, p1, p2, epo, device): print("use device:", device) Kx = Kx / N Kz = Kz / N Kx = torch.from_numpy(Kx).float().to(device) Kz = torch.from_numpy(Kz).float().to(device) m = np.shape(Kx)[0] n = np.shape(Kz)[0] F =...
LaetitiaPapaxanthos/UnionCom
PrimeDual.py
Python
mit
2,943
config = { "name": "Tombstone counter", # plugin name "type": "receiver", #plugin type "description": ["counts tombstones in a world"] #description } import database as db # import terraria database class Receiver(): # required class to be called by plugin manager def __init__(self): #do any ini...
flying-sheep/omnitool
plugins/tombstone.py
Python
mit
1,209
import argparse class Parser(object): def __init__(self): parser = argparse.ArgumentParser() parser.add_argument("--path", default='/home/priyesh/Desktop/Expt_Deep_CC', help="Base path for the code") parser.add_argument("--project", default='DO...
yashchandak/GNN
Sample_Run/DOPE/parser.py
Python
mit
4,549
# 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/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_09_01_preview/operations/_skus_operations.py
Python
mit
5,833
from abc import ABCMeta, abstractmethod class mySequence(object): """mySequence""" __metaclass__ = ABCMeta # Python 2 style @abstractmethod def __len__(self): """Return the length of the sequence""" @abstractmethod def __getitem__(self, j): """Return the jth element of the seq...
wangzhe3224/python_data_structure_and_algorithms
chapter2/mySequence.py
Python
mit
1,458
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings') try: from django.core.management import execute_from_command_line except I...
msterin/play
vsc-play/python/helloworld/manage.py
Python
mit
666
#!/usr/bin/env python # hint: slice def execute(x): ret = x[::2] return ret
manabu/nlp100-2015-python
chapter01/chapter01_01.py
Python
mit
85
#!/usr/bin/env python ''' The MIT License (MIT) Copyright (c) <2016> <Mathias Lesche> 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 ...
mlesche/dsp
dsp/src/report/build_report.py
Python
mit
45,655
import os gettext = lambda s: s DATA_DIR = os.path.dirname(os.path.dirname(__file__)) """ Django settings for flex project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settin...
samastur/flexlayout
flex/settings.py
Python
mit
5,343
# coding: utf-8 from setuptools import setup, find_packages setup( name='tc_librato', version="0.0.1", description='Thumbor Librato extensions', author='Peter Schröder, Sebastian Eichner', author_email='peter.schroeder@jimdo.com, sebastian.eichner@jimdo.com', zip_safe=False, include_packag...
thumbor-community/librato
setup.py
Python
mit
441
#!/usr/bin/env python3 # encoding: UTF-8 import unittest from vCloudOVFMunger import sanitise_machine_name # Test my basic string sanitiser. This needs no setup, files, or network stuff. # python -m unittest test.test_sanitise_machine_name class XMLTests(unittest.TestCase): def setUp(self): self.allte...
environmentalomics/iso-to-image
uploader/test/test_sanitise_machine_name.py
Python
mit
1,066
import numpy as np def sigmoid(x): """ Calculate sigmoid """ return 1 / (1 + np.exp(-x)) # Network size N_input = 4 N_hidden = 3 N_output = 2 np.random.seed(42) # Make some fake data X = np.random.randn(4) weights_input_to_hidden = np.random.normal( 0, scale=0.1, size=(N_input, N_hidden)) weigh...
swirlingsand/deep-learning-foundations
play/multi-layer.py
Python
mit
771
#!/bin/python # coding: utf-8 import argparse import sys import signal import traceback import datetime import lglass.object import lglass_sql.nic def objects(lines): obj = [] for line in lines: if isinstance(line, bytes): line = line.decode("iso-8859-15") if not line.strip() and...
fritz0705/lglass
contrib/grs-import/grs-import-sqlid.py
Python
mit
2,771
from django.db import models from django.contrib.auth.models import User class Task(models.Model): name = models.CharField(max_length=100) def __unicode__(self): return self.name class Surgeon(models.Model): name = models.CharField(max_length=100) def __unicode__(self): return self....
dcastro9/video_library_project
Django/video_manager/models.py
Python
mit
906
# -*- coding: utf-8 -*- from __future__ import unicode_literals import random import pickle import json from fanpy import Fanfou, FanfouHTTPError, NoAuth from fanpy.api import FanfouDictResponse, FanfouListResponse, POST_ACTIONS, method_for_uri noauth = NoAuth() fanfou_na = Fanfou(auth=noauth) AZaz = 'abcdefghijklm...
mookrs/fanpy
tests/test_sanity.py
Python
mit
1,473
# !/usr/bin/env python3 # -*- encoding: utf-8 -*- """ ERP+ """ __author__ = 'CVtek dev' __credits__ = [] __version__ = "1.0" __maintainer__ = "CVTek dev" __status__ = "Development" __model_name__ = 'sr_mulher.SRMulher' import auth, base_models from orm import * from form import * class SRMulher(Model, View): def __...
IdeaSolutionsOnline/ERP4R
core/objs/sr_mulher.py
Python
mit
2,051
# -*- coding: utf-8 -*- from mpcontribs.io.core import mp_level01_titles from mpcontribs.io.core.recdict import RecursiveDict from IPython.display import display_html class Structures(RecursiveDict): """class to hold and display list of pymatgen structures for single mp-id""" def __init__(self, content): ...
materialsproject/MPContribs
mpcontribs-io/mpcontribs/io/core/components/sdata.py
Python
mit
1,600
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals import sys from terminaltables import SingleTable def _to_utf8(message): try: return message.encode('utf-8') except UnicodeDecodeError: return message def _print_message(stream, *component...
ImageIntelligence/mimiron
mimiron/core/io.py
Python
mit
1,857
""" Provides utility functions for spreadflow config script. """ import inspect from spreadflow_core.component import Compound from spreadflow_core.dsl.stream import AddTokenOp, SetDefaultTokenOp from spreadflow_core.dsl.parser import ComponentParser from spreadflow_core.dsl.tokens import \ AliasToken, \ Comp...
spreadflow/spreadflow-core
spreadflow_core/script.py
Python
mit
7,764
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015-2018 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Base package for building Invenio application factories.""" import os from setup...
tiborsimko/invenio-base
setup.py
Python
mit
2,590
# -*- coding: utf-8 -*- from behave import when, given, then from nose import tools from vswitch.bridge import add_br """Create bridges feature steps file Feature: add-br """ BRIDGE_NAME = 'test' @given('a name for the bridge') def step_given_add_bridge(context): context.bridge_name = BRIDGE_NAME tools.a...
ervitis/vswitch
atdd/steps/create_bridge.py
Python
mit
912
import _plotly_utils.basevalidators class HovertemplateValidator(_plotly_utils.basevalidators.StringValidator): def __init__( self, plotly_name="hovertemplate", parent_name="choroplethmapbox", **kwargs ): super(HovertemplateValidator, self).__init__( plotly_name=plotly_name, ...
plotly/plotly.py
packages/python/plotly/plotly/validators/choroplethmapbox/_hovertemplate.py
Python
mit
488
from django.db import models class Autor(models.Model): nombre = models.CharField(max_length=50) pais = models.CharField(max_length=50) descripcion = models.TextField(max_length=200) foto = models.ImageField(upload_to='foto_autor') def __unicode__(self): return self.nombre
richpolis/siveinpy
SiveinPy/apps/autores/models.py
Python
mit
282
from distutils.core import setup setup( name='arghlog', version='0.9', description='Logging integration for argh commands', author='Mark Paschal', author_email='markpasc@markpasc.org', url='https://github.com/markpasc/arghlog', packages=[], py_modules=['arghlog'], requires=['argpa...
markpasc/arghlog
setup.py
Python
mit
337
""" <Program> unittest_toolbox.py <Author> Konstantin Andrianov <Started> March 26, 2012 <Copyright> See LICENSE for licensing information. <Purpose> Provides an array of various methods for unit testing. Use it instead of actual unittest module. This module builds on unittest module. Specifically, ...
monzum/tuf-legacy
src/TUF/src/tuf/tests/unittest_toolbox.py
Python
mit
16,778
import pytest import sys pytest_plugins = "pytester", import os, py pid = os.getpid() def pytest_addoption(parser): parser.addoption('--lsof', action="store_true", dest="lsof", default=False, help=("run FD checks if lsof is available")) def pytest_configure(config): config.addinivalue_...
lotaku/pytest-2.3.5
testing/conftest.py
Python
mit
3,773
# Relative-refs.pyw """A short python script for repathing xrefs in Autocad.""" import win32com.client,os, os.path, tkFileDialog from Tkinter import * from tkMessageBox import askokcancel from time import sleep # Get a COM object for Autocad acad = win32com.client.Dispatch("AutoCAD.Application") def repath(filename)...
ActiveState/code
recipes/Python/440498_Win32com__Batch_repathing_Autocad/recipe-440498.py
Python
mit
3,367
DEBUG = True DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', }, } INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contri...
fjsj/liveservererror
testsettings.py
Python
mit
487
print print "This test runs Verlet dynamics with the MonteCarloEMT potential instead" print "of the usual EMT potential. The result must be the same, but the" print "performance will be slightly worse." print from Asap import * from Asap.Dynamics.VelocityVerlet import VelocityVerlet from cPickle import * from Numer...
auag92/n2dm
Asap-3.8.4/Test/testMonteCarloEMT.py
Python
mit
1,391
class Solution: # @param num, a list of integers # @return a string def largestNumber(self, num): return ''.join(sorted(map(str, num), cmp=self.cmp)).lstrip('0') or '0' def cmp(self, x, y): return [1, -1][x + y > y + x]
zhyu/leetcode
algorithms/largestNumber/largestNumber.py
Python
mit
254
import _plotly_utils.basevalidators class TickvalsValidator(_plotly_utils.basevalidators.DataArrayValidator): def __init__(self, plotly_name="tickvals", parent_name="carpet.baxis", **kwargs): super(TickvalsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name,...
plotly/plotly.py
packages/python/plotly/plotly/validators/carpet/baxis/_tickvals.py
Python
mit
407
from loader import * from extract_keywords import split_line from collections import defaultdict def main(): keyword_data = load_single_file('keyword_table.csv') paper_data = load_single_file('Paper.csv') with open('lda_input.txt', 'w', encoding='utf-8') as write_file: for paper_id in paper_data.keys(): paper...
leeopop/2015-CS570-Project
prepare_lda.py
Python
mit
897
import os import sys from setuptools import setup, find_packages version = '0.3.3' def get_package_manifest(filename): packages = [] with open(filename) as package_file: for line in package_file.readlines(): line = line.strip() if not line: continue ...
njoyce/sockjs-gevent
setup.py
Python
mit
2,151
import json from podiomirror.transactions.transaction import Transaction class RelationTransaction(Transaction): def __init__(self, transaction_type, app_id=None, field_id=None, parent_id=None, child_id=None): super().__init__(transaction_type) self.app_id = app_id self.field_id = field_...
patriksletmo/podio-mirror
podiomirror/transactions/relation_transaction.py
Python
mit
836
import numpy as np import glob from lamost import load_spectra allfiles = np.array(glob.glob("example_LAMOST/Data_All/*fits")) # we want just the file names allfiles = np.char.lstrip(allfiles, 'example_LAMOST/Data_All/') dir_dat = "example_LAMOST/Data_All" ID, wl, flux, ivar = load_spectra(dir_dat, allfiles) npix = ...
annayqho/TheCannon
code/lamost/xcalib_5labels/make_tr_file_list.py
Python
mit
797
"""Podspec helper.""" from grow.translations import locales class Error(Exception): def __init__(self, message): super(Error, self).__init__(message) self.message = message class PodSpecParseError(Error): pass class PodSpec(object): def __init__(self, yaml, pod): yaml = yaml...
grow/grow
grow/pods/podspec.py
Python
mit
1,721
from __future__ import absolute_import, print_function, division import warnings import six from six.moves import urllib from netlib import utils from netlib.http import cookies from netlib.odict import ODict from .. import encoding from .headers import Headers from .message import Message, _native, _always_bytes, M...
Kriechi/netlib
netlib/http/request.py
Python
mit
11,925
# -- encoding: utf-8 -- from __future__ import with_statement from stackspy.utils import first import difflib def probe_pyramid_no_slashes(context): test_url = first(u.url for u in context.html_urls if len(u.relative_url) > 2 and u.endswith("/")) if test_url: with_slash = context.get_url(test_url) without_slas...
akx/stackspy
stackspy/detectors/frameworks/pyramid.py
Python
mit
587
class Solution: # @param s, a string # @return an integer def lengthOfLastWord(self, s): s = s.strip().split(' ')[-1].strip(',') return len(s) a = Solution() print a.lengthOfLastWord("Hello World")
pikeszfish/Leetcode.py
leetcode.py/LengthofLastWord.py
Python
mit
232
#!/usr/bin/env python # # command-line BinaryNinja lifter # # BinaryNinja multiplatform version of Z0MBIE's PE_STAT for opcode frequency # statistics http://z0mbie.dreamhosters.com/opcodes.html # # Copyright (c) 2020-2021 Vector 35 Inc # # Permission is hereby granted, free of charge, to any person obtaining a copy # o...
joshwatson/binaryninja-api
python/examples/cli_lift.py
Python
mit
2,801
from __future__ import unicode_literals from django.apps import AppConfig class IngestConfig(AppConfig): name = 'ingest'
IQSS/miniverse
dv_apps/ingest/apps.py
Python
mit
128
#!/usr/bin/env python # encoding: utf-8 from base_task import BaseTask, Node task_definitions = [ { 'name': 'first_test_runs_task', 'start': Node('A', 0, 0), 'finish': Node('Z', 500, 500), 'mid_nodes': [ Node('B', 50, 500), Node('C', 50, 100), No...
Cosiek/KombiVojager
tasks.py
Python
mit
2,187
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2016-11-26 22:42 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('parliament', '0002_auto_20161123_1157'), ] operations = [ migrations.AlterF...
openkamer/openkamer
parliament/migrations/0003_auto_20161126_2342.py
Python
mit
467
try: import multiprocessing except ImportError: pass from setuptools import setup setup( name='Flask-Imagine', version='0.5', description='Extension which provides easy image manipulation support in Flask applications.', url='https://github.com/FlaskGuys/Flask-Imagine', author='Kronas', ...
kronas/Flask-Imagine
setup.py
Python
mit
1,027
from pygame import Rect class AfflictionBox(): def __init__(self, affliction, font, rectPosition = (0, 0)): self.affliction = affliction self.rectPosition = rectPosition self.name = self.affliction.name self.font = font self.textSize = self.font.size(self.name) self.textRect = Rect(self.rectPosition, self...
ZakDoesGaming/OregonTrail
lib/afflictionBox.py
Python
mit
523
# coding: utf-8 """ Nordigen Account Information Services API No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: 2.0 (v2) Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ i...
ltowarek/budget-supervisor
third_party/nordigen/test/test_token_api.py
Python
mit
896
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import json import pymongo from scrapy.settings import Settings from scrapy.exceptions import DropItem from scrapy import log fr...
diegordzr/YellowSpider
yellow/yellow/pipelines.py
Python
mit
1,714
from django.conf.urls import patterns, include, url from django.views.generic import TemplateView # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() import api, foxycart urlpatterns = patterns('', url(r'^$', TemplateView.as_view(template_name='index.html')),...
hacknashvillereview/review_application
review_app/review_app/urls.py
Python
mit
1,606
import logging import requests import tarfile from lxml import etree from . import discover from . import template log = logging.getLogger(__name__) URLPREFIX = 'https://cloud-images.ubuntu.com/precise/current/' PREFIXES = dict( server='{release}-server-cloudimg-amd64.', desktop='{release}-desktop-cloudi...
tv42/downburst
downburst/image.py
Python
mit
5,246
__author__ = 'Yves Bonjour' import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "../../common")) from WerkzeugService import create_status_error_response from WerkzeugService import create_status_ok_response from WerkzeugService import WerkzeugService from werkzeug.routing import Map, Rule f...
ybonjour/nuus
services/newsletter/Service.py
Python
mit
1,883
# -*- coding: utf-8 -*- import unittest from getkey.platforms import PlatformTest def readchar_fn_factory(stream): v = [x for x in stream] def inner(blocking=False): return v.pop(0) return inner class TestGetkey(unittest.TestCase): def test_basic_character(self): getkey = Platform...
kcsaff/getkey
tests/unit/test_getkey.py
Python
mit
1,320