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
from datetime import datetime class NodeWeight: SPEED_RECORD_COUNT = 3 SPEED_INIT_VALUE = 100 * 1024 ^ 2 # Start with a big speed of 100 MB/s REQUEST_TIME_RECORD_COUNT = 3 def __init__(self, nodeid): self.id: int = nodeid self.speed = [self.SPEED_INIT_VALUE] * self.SPEED_RECORD_COUN...
hal0x2328/neo-python
neo/Network/nodeweight.py
Python
mit
2,320
# encoding: utf-8 from django.apps import AppConfig class ManagerConfig(AppConfig): name = 'manager'
valdergallo/raidmanager
manager/apps.py
Python
mit
107
import click import os import unittest from app import create_app, db from app.models import UrlLink app = create_app(os.getenv('APP_SETTINGS')) @app.shell_context_processor def make_shell_context(): return dict(app=app, db=db, UrlLink=UrlLink) @app.cli.command() def recreate_db(): click.echo('Recreating ...
Kalenai/url-shortener
manage.py
Python
mit
672
import vdf import urllib2 import json import time import shelve filters = ['basic','genres'] URL_BASE = 'http://store.steampowered.com/api/appdetails?appids=' FILTERS = '&filters=' + ','.join(filters) OWNED_GAMES_URL = 'http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=' ERR_STR = '\t'*4 + 'Error:...
itsWeller/SteamCategorizer
categorizer.py
Python
mit
2,724
import os import re import subprocess def available_cpu_count(): """ Number of available virtual or physical CPUs on this system, i.e. user/real as output by time(1) when called with an optimally scaling userspace-only program""" # cpuset # cpuset may restrict the number of *available* processors...
macks22/nsf-award-data
util/num_cpus.py
Python
mit
2,737
from flask import Flask app = Flask(__name__) from media import Movie from flask import render_template import re @app.route('/') def index(): '''View function for index page.''' toy_story = Movie(title = "Toy Story 3", trailer_youtube_url ="https://www.youtube.com/watch?v=QW0sjQFpXTU", poster_image_url="https...
mr-karan/Udacity-FullStack-ND004
Project1/projects/movieServer/app.py
Python
mit
2,980
import sys import os from scale_model import StartupDataModel, VCModel from flask.ext.restful import Resource, reqparse from flask import Flask, jsonify, request, make_response import os from database import db from flask.ext.security import current_user from json import dumps class Scale_DAO(object): def __init_...
wigginslab/lean-workbench
lean_workbench/scale/scale_resource.py
Python
mit
1,731
from setuptools import setup setup( setup_requires=['pbr', ], pbr=True, auto_version="PBR", )
rocktavious/pyversion
setup.py
Python
mit
107
import os import sys from pathlib import Path class Setup: CONFIGURATION_FILE = os.path.join(Path(__file__).parents[1], "config", "server.cfg") VLC_DEFAULT_COMMAND = "vlc -f" POSIX = 'posix' in sys.builtin_module_names VLC_PLAYLIST_END = "vlc://quit"
danfr/RemoteTV
Server/bin/Setup.py
Python
mit
269
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('rango', '0002_auto_20150401_0132'), ] operations = [ migrations.AddField( model_name='category', nam...
matheuskiser/pdx_code_guild
django/tango_with_django_project/rango/migrations/0003_category_slug.py
Python
mit
444
from __future__ import print_function import math, nltk from termcolor import colored from analyze import generate_stopwords, sanitize from vector import Vector class NaiveBayesClassifier(): def __init__(self): """ Creates: """ self.c = {"+" : Vector(), "-" : Vector()} ...
trivedi/sentapy
NaiveBayes.py
Python
mit
7,810
from django.apps import apps from rest_framework import serializers Experiment = apps.get_model("visualize", "Experiment") class ExperimentSerializer(serializers.ModelSerializer): """JSON serialized representation of the Experiment Model""" class Meta: model = Experiment fields = '__all__' ...
brookefitzgerald/neural-exploration
neural_exploration/visualize/serializers.py
Python
mit
1,912
#!/usr/bin/env python import argparse import datetime import os import re import requests import subprocess import sys import time import xively DEBUG = os.environ["DEBUG"] or false def read_temperature(from_file): if DEBUG: print "Reading temperature from file: %s" % from_file temperature = None with op...
dwc/pi-monitoring
bin/push_temperature.py
Python
mit
1,946
def generate_concept_HTML(concept_title, concept_description): html_text_1 = ''' <div class="concept"> <div class="concept-title"> ''' + concept_title html_text_2 = ''' </div> <div class="concept-description"> ''' + concept_description html_text_3 = ''' </div> </di...
DWilburn/automate-your-page
html_generator.py
Python
mit
2,544
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2017-10-16 16:08 from __future__ import unicode_literals import ckeditor.fields from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('main', '0043_about'), ] operations = [ migrations.Cr...
OKThess/website
main/migrations/0044_okthessmeetup.py
Python
mit
775
""" picture.py Author: Jett Credit: None Assignment: Use the ggame library to "paint" a graphical picture of something (e.g. a house, a face or landscape). Use at least: 1. Three different Color objects. 2. Ten different Sprite objects. 3. One (or more) RectangleAsset objects. 4. One (or more) CircleAsset objects. 5...
Jetzal/Picture
picture.py
Python
mit
1,761
from django.views.generic import ListView, DetailView from .forms import OrganisationSearchForm from .models import Organisation class OrganisationSearchView(ListView): template_name = 'justizgelder/search.html' paginate_by = 25 def get_queryset(self): self.form = OrganisationSearchForm(self.req...
correctiv/correctiv-justizgelder
correctiv_justizgelder/views.py
Python
mit
1,160
""" Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list. For example, Assume that words = ["practice", "makes", "perfect", "coding", "makes"]. Given word1 = "coding", word2 = "practice", return 3. Given word1 = "makes", word2 = "coding", return 1 """ c...
hs634/algorithms
python/strings/shortest_distance_between_words_1.py
Python
mit
799
#Author : Lewis Mervin lhm30@cam.ac.uk #Supervisor : Dr. A. Bender #All rights reserved 2016 #Protein Target Prediction Tool trained on SARs from PubChem (Mined 21/06/16) and ChEMBL21 #Molecular Descriptors : 2048bit Morgan Binary Fingerprints (Rdkit) - ECFP4 #Dependencies : rdkit, sklearn, numpy #libraries from rdkit...
lhm30/PIDGINv2
predict_enriched.py
Python
mit
11,872
import cv2 import numpy as np import os from math import sqrt from constants import ( GROUND_TRUTH, RAWDATA_FOLDER) FONT = cv2.FONT_HERSHEY_SIMPLEX WINDOW_NAME = "Labeling" CTRL_PT_RADIUS = 10 class Boundary: def __init__(self, width, height): self.top = height self.right = width self.bottom = 0 self.lef...
trangnm58/idrec
localization_cnn/create_ground_truth.py
Python
mit
5,533
# postgresql/__init__.py # Copyright (C) 2005-2021 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: https://www.opensource.org/licenses/mit-license.php from . import base from . import pg8000 # noqa from . import psycopg2 # noq...
zzzeek/sqlalchemy
lib/sqlalchemy/dialects/postgresql/__init__.py
Python
mit
2,443
def find_equilibrium(arr): left_sum = 0 right_sum = sum(arr[1:]) # List slicing copies references to each value. if left_sum == right_sum and arr: # Don't return 0 if arr is empty. return 0 for i in range(1, len(arr)): left_sum += arr[i - 1] right_sum -= arr[i] if left_...
adriano-arce/Interview-Problems
Array-Problems/Find-Equilibrium/Find-Equilibrium.py
Python
mit
778
__author__ = 'sfaci' """ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distr...
OSAlt/secret-santa
santa_lib/__init__.py
Python
mit
559
""" This module is used to translate Events from Marathon's EventBus system. See: * https://mesosphere.github.io/marathon/docs/event-bus.html * https://github.com/mesosphere/marathon/blob/master/src/main/scala/mesosphere/marathon/core/event/Events.scala """ from marathon.models.base import MarathonObject from marathon...
thefactory/marathon-python
marathon/models/events.py
Python
mit
7,466
# # Copyright (c) Addy Yeow Chin Heng <ayeowch@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 without restriction, including # without limitation the rights to use, copy, modify...
ayeowch/bitnodes-hardware
hardware/__init__.py
Python
mit
1,220
import os import unittest import pytest import numpy as np import hail as hl import hail.expr.aggregators as agg import hail.utils as utils from hail.linalg import BlockMatrix from hail.utils import FatalError from ..helpers import (startTestHailContext, stopTestHailContext, resource, skip_unles...
danking/hail
hail/python/test/hail/methods/test_statgen.py
Python
mit
73,655
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys from flask_script import Manager, Shell, Server from flask_migrate import MigrateCommand from gakkgakk.app import create_app from gakkgakk.models import User from gakkgakk.settings import DevConfig, ProdConfig from gakkgakk.database import db reload(...
jkaberg/GakkGakk
manage.py
Python
mit
1,062
import sys from os.path import dirname import drain.step, drain.serialize from drain.drake import is_target_filename, is_step_filename if len(sys.argv) == 1: raise ValueError('Need at least one argument') args = sys.argv[1:] drain.PATH = dirname(dirname(dirname(args[0]))) if is_target_filename(args[0]): ou...
potash/drain
bin/run_step.py
Python
mit
692
import sys, os _current_dir = os.path.abspath(os.path.dirname(__file__)) PROJECT_ROOT = os.path.normpath(os.path.join(_current_dir, "..")) sys.path.append(PROJECT_ROOT) from lib.config import config mimicus_dir = config.get('pdfrate', 'mimicus_dir') import_path = os.path.join(mimicus_dir, 'reproduction') sys.path.app...
uvasrg/EvadeML
classifiers/pdfrate_wrapper.py
Python
mit
5,330
import numpy as NP import healpy as HP from astropy.io import fits import glob rootdir = '/data3/t_nithyanandan/project_HERA/' beams_dir = 'power_patterns/CST/mdl03/' prefix = 'X4Y2H_490_' suffix = '.hmap' pols = ['X'] colnum = 0 outdata = [] schemes = [] nsides = [] npixs = [] frequencies = [] for pol in pols: f...
dannyjacobs/PRISim
main/consolidate_HERA_CST_beams.py
Python
mit
2,436
from cStringIO import StringIO from datetime import datetime from functools import partial from itertools import chain, imap, izip from logging import StreamHandler import os from os import chdir from os.path import join, basename, split, dirname, relpath from sys import stderr from time import time from mimetypes impo...
gartung/dxr
dxr/app.py
Python
mit
20,359
import calendar db = [None] def get_month_transaction_days(acc, year, month): monthdays = calendar.monthrange(year, month) result = db[0].view('bank/transaction_days', startkey=[acc._id, year, month, 1], endkey=[acc._id, year, month, monthdays], group=True, group_level=4).all() return [r['key'][-...
baverman/cakeplant
cakeplant/bank/model.py
Python
mit
573
""" @author: ruben """ import matplotlib.pyplot as plt from pastas.read.knmi import KnmiStation import numpy as np # How to use it? # data from a meteorological station download = True meteo = True hourly = False if hourly and not meteo: raise(ValueError('Hourly data is only available in meteorological stations'...
gwtsa/gwtsa
examples/reads/test_knmidata.py
Python
mit
1,974
from setuptools import setup setup(name='PubNubPython27', version='1.0', description='OpenShift Python-2.7 Community Cartridge based application', author='Doron Sherman', author_email='doron@pubnub.com', url='http://www.python.org/sigs/distutils-sig/', # Uncomment one or more lines below in t...
pubnub/pubnub-openshift-quickstart
setup.py
Python
mit
603
# 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 ...
lmazuel/azure-sdk-for-python
azure-mgmt-containerinstance/azure/mgmt/containerinstance/models/usage_name.py
Python
mit
1,236
from rest_framework import serializers # Serializer will look at models and convert them to JSON for us from .models import List, Card #our models # Have to load CardSerializer before List for order of operations class CardSerializer(serializers.ModelSerializer): # Model we are representing is Card class Meta...
jantaylor/djangular-scrum
scrumboard/serializers.py
Python
mit
663
import inspect from nlglib.features import category, NEGATED from nlglib.microplanning import String, Element class SignatureError(Exception): """Exception for PredicateMsgSpec.""" pass class Document: """Document represents a container holding information about a document. This includes the docum...
roman-kutlak/nlglib
nlglib/macroplanning/struct.py
Python
mit
14,242
# -*- coding: utf-8 -*- # © 2012 Aleksejs Popovs <me@popoffka.ru> # Licensed under MIT License. See ../LICENSE for more info. from BaseStorage import BaseStorage try: import cPickle as pickle except ImportError: import pickle import os class FileStorage(BaseStorage): def __init__(self): self.path = None self.i...
popoffka/ponydraw
server/storage/FileStorage.py
Python
mit
1,715
from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from sqlalchemy import inspect from models import Base, Restaurant, MenuItem, User # Init database session def db_init(): engine = create_engine('sqlite:///restaurantmenuwithusers.db') Base.metadata.bind = engine DBSession = sess...
jonanone/APIProject
vagrant/restaurant_menu/database_helper.py
Python
mit
5,732
#!/usr/bin/env python3 """ Created on 27 May 2019 @author: Bruno Beloff (bruno.beloff@southcoastscience.com) """ import sys import time from scs_dfe.gas.isi.elc_dsi_t1 import ElcDSIt1 from scs_dfe.interface.interface_conf import InterfaceConf from scs_host.bus.i2c import I2C from scs_host.sys.host import Host # ...
south-coast-science/scs_dfe_eng
tests/gas/isi/elc_dsi_t1_test.py
Python
mit
1,580
"""Tutorial on how to create a convolutional autoencoder w/ Tensorflow. Parag K. Mital, Jan 2016 """ import tensorflow as tf import numpy as np import math from libs.activations import lrelu from libs.utils import corrupt # %% def autoencoder(input_shape=[None, 784], n_filters=[1, 10, 10, 10], ...
apoorva-sharma/deep-frame-interpolation
tensorflow_tutorials-master/python/09_convolutional_autoencoder.py
Python
mit
5,033
# MIT License # Copyright (c) 2016 https://github.com/sndnv # See the project's LICENSE file for the full text def get_header_files_size_data(sources_dir, header_files_by_size, rows_count): """ Builds table rows list containing data about header files sizes (largest/smallest). :param sources_dir: configur...
sndnv/cadb
cadb/utils/Stats.py
Python
mit
9,700
from django.conf.urls import patterns, url from .views import EmailAlternativeView urlpatterns = patterns( '', url(r'^email_alternative/(?P<pk>\d+)/$', EmailAlternativeView.as_view(), name='email_alternative'), )
bigmassa/django_mail_save
mail_save/urls.py
Python
mit
238
from __future__ import division, print_function, absolute_import import os import logging from datetime import datetime from ..modules.patterns import Singleton class SilenceableStreamHandler(logging.StreamHandler): def __init__(self, *args, **kwargs): super(SilenceableStreamHandler, self).__init__(*arg...
evenmarbles/mlpy
mlpy/tools/log.py
Python
mit
9,057
# http://lodev.org/cgtutor/filtering.html import cv2 import numpy as np #img = cv2.imread('../images/input_sharp_edges.jpg', cv2.IMREAD_GRAYSCALE) img = cv2.imread('../images/input_tree.jpg') rows, cols = img.shape[:2] #cv2.imshow('Original', img) ################### # Motion Blur size = 15 kernel_motion_blur = np.z...
PacktPublishing/OpenCV-Computer-Vision-Projects-with-Python
Module 2/1/image_filters.py
Python
mit
2,407
# -*- coding: utf8 -*- # # Created by 'myth' on 6/27/15 from django.http import JsonResponse from oauth2_provider.decorators import protected_resource from apps.sso.userinfo import Onlineweb4Userinfo USERINFO_SCOPES = [ 'authentication.onlineuser.username.read', 'authentication.onlineuser.first_name.read', ...
dotKom/onlineweb4
apps/sso/endpoints.py
Python
mit
1,048
#!/usr/bin/python3 """ A script to determine the edit distance between 2 strings http://introcs.cs.princeton.edu/java/assignments/sequence.html """ from memoize import Memoize penalties={'gap':2,'mismatch':1,'match':0} def break_into_chunks(func): chunksize=100 def wrapper(string1,string2): for i i...
Bolt64/my_code
Rosalind/edit_distancev3.py
Python
mit
2,389
#!/usr/bin/env python ''' Author: Jos Hirth, kaioa.com License: GNU General Public License - http://www.gnu.org/licenses/gpl.html Warranty: see above ''' DOCNAME='sodipodi:docname' import sys, simplestyle try: from xml.dom.minidom import parse except: sys.exit('The export_gpl.py module requires PyXML. Please...
NirBenTalLab/proorigami-cde-package
cde-root/usr/local/apps/inkscape/share/inkscape/extensions/export_gimp_palette.py
Python
mit
1,346
"""Test Logex Initization and Error Handling""" import subprocess from unittest import TestCase from samples import app, api, logex from samples import bp_app, api_v1, api_v2, bp_logex class BaseTestCase(TestCase): DEBUG = True __blueprints__ = False @classmethod def setUpClass(cls): cls.a...
pinntech/flask-logex
tests/base.py
Python
mit
1,058
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import mmap import re import collections import math import detectlanguage import codecs detectlanguage.configuration.api_key = "d6ed8c76914a9809b58c2e11904fbaa3" class Analyzer: def __init__(self, passwd): self.evaluation = {} self._passwd = passwd ...
haastt/analisador
src/Analyzer.py
Python
mit
8,325
from TranslateLib import translate as _ from meta import bot from models.dialogs import Dialogs from utils.chat import ParseUserData, get_username_or_name, typing, crash_message @bot.message_handler(commands=['help']) def cmd_help(message): text = [ 'Я - бот, который считает карму в чатах Telegram', ...
Illemius/telegram-karma-bot
extensions/helper.py
Python
mit
5,918
#pragma error #pragma repy global foo foo = 2
sburnett/seattle
repy/tests/ut_repytests_global.py
Python
mit
47
# # GridCoordinates.py # # @author Alain Rinder # @date 2017.06.02 # @version 0.1 # from lib.graphics import * from src.interface.IDrawable import * from src.interface.Color import * class Square(IDrawable): def __init__(self, board, coord): self.board = board...
alainrinder/quoridor.py
src/interface/Square.py
Python
mit
1,284
# -*- coding: utf-8 -*- """Family module for Vikidia.""" # # (C) Pywikibot team, 2010-2016 # # Distributed under the terms of the MIT license. # from __future__ import absolute_import, unicode_literals from pywikibot import family class Family(family.SubdomainFamily): """Family class for Vikidia.""" name =...
magul/pywikibot-core
pywikibot/families/vikidia_family.py
Python
mit
639
import os from glob import glob from collections import Counter import numpy as np from json import dump, load from traitlets import TraitError import matplotlib.pyplot as plt import matplotlib.ticker as mtick import matplotlib.gridspec as gridspec from traitlets import validate from ipywidgets import IntRangeSlider ...
deisi/SFG2D
sfg2d/widgets.py
Python
mit
66,147
# -*- coding: utf-8 -*- # Copyright © 2012-2022 Roberto Alsina and others. # 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 t...
getnikola/nikola
nikola/plugins/task/posts.py
Python
mit
5,120
# -*- coding: utf-8 -*- """ This module defines substantial HPACK integration tests. These can take a very long time to run, so they're outside the main test suite, but they need to be run before every change to HPACK. """ from hpack.hpack import Decoder, Encoder from binascii import unhexlify from pytest import skip ...
jimcarreer/hpack
test/test_hpack_integration.py
Python
mit
2,084
import bpy import math import mathutils from bpy_extras.io_utils import axis_conversion bl_info = { "name": "Export JM's Skeleton", "description": "", "author": "James Mintram", "version": (0, 1), "blender": (2, 75, 0), "category": "Export", } reserved_properties = ( 'cycles_visibility...
jamesmintram/blenderplugins
jm_skel_export.py
Python
mit
6,496
import click from alertaclient.utils import build_query @click.command('tag', short_help='Tag alerts') @click.option('--ids', '-i', metavar='UUID', multiple=True, help='List of alert IDs (can use short 8-char id)') @click.option('--query', '-q', 'query', metavar='QUERY', help='severity:"warning" AND resource:web') @...
alerta/python-alerta
alertaclient/commands/cmd_tag.py
Python
mit
1,050
import enum from typing import Dict, Set from backend.common.consts.event_type import EventType @enum.unique class AwardType(enum.IntEnum): """ An award type defines a logical type of award that an award falls into. These types are the same across both years and competitions within a year. In other w...
the-blue-alliance/the-blue-alliance
src/backend/common/consts/award_type.py
Python
mit
5,567
#!/usr/bin/env python import io import os import sys try: from setuptools import setup, Command, find_packages except ImportError: from distutils.core import setup, Command, find_packages __version__ = "1.4.3" with io.open('README.rst', encoding='utf-8') as readme_file: long_description = readme_file.r...
eiginn/passpie
setup.py
Python
mit
2,730
from __future__ import absolute_import import itertools __all__ = ["Registry"] class Registry(object): """The registry of access control list.""" def __init__(self): self._roles = {} self._resources = {} self._allowed = {} self._denied = {} # to allow additional sh...
tonyseek/simple-rbac
rbac/acl.py
Python
mit
5,469
from datetime import datetime import click import crayons import tweakers from tabulate import tabulate from . import __version__, config, utils def format_date(dt): if dt.date() == datetime.today().date(): return dt.strftime("%H:%M") elif dt.year == datetime.today().year: return dt.strftime...
timotk/tweakstream
tweakstream/cli.py
Python
mit
3,757
import pytest from werkzeug.exceptions import Unauthorized from emol.models import User, Role, UserRole, Discipline
lrt512/emol
emol/emol/models/tests/test_user.py
Python
mit
119
#!/usr/bin/env python # -*- coding: utf-8 -*- from pyparsing import ParseFatalException from simplegenerator import ReGenerator import unittest class ReGeneratorTest(unittest.TestCase): def setUp(self): self.alphanum_pattern = "[a-zA-Z0-9_]" self.alpha_pattern = "[a-zA-Z]" self.num_patter...
michalwiacek/simplegenerator
tests/regenerator_tests.py
Python
mit
6,967
import RPi.GPIO as GPIO import time from array import * #configuracoin de pines del stepper bipolar out1 = 11 out2 = 13 out3 = 15 out4 = 16 #delay value timeValue = 0.005 #matriz de pines del stepper outs = [out1,out2,out3,out4] #secuencia para mover el stepper matriz = [ [1,0,0,1], [1,1,0,0], [0,1,1,0...
Locottus/Python
machines/python/stepperLeft.py
Python
mit
1,515
# coding=utf-8 import os import time from gzip import GzipFile from StringIO import StringIO from django.shortcuts import render_to_response, redirect from django.template import RequestContext from django.http import HttpResponse from django.core.management import call_command from django.views.decorators.csrf impor...
hva/warehouse
warehouse/backup/views.py
Python
mit
3,061
from .._pickle_api import pickle_dumps, pickle_loads def test_pickle_dumps(): data = {"hello": "world", "test": 123} expected = [ b"\x80\x04\x95\x1e\x00\x00\x00\x00\x00\x00\x00}\x94(\x8c\x05hello\x94\x8c\x05world\x94\x8c\x04test\x94K{u.", b"\x80\x04\x95\x1e\x00\x00\x00\x00\x00\x00\x00}\x94(\x8...
explosion/srsly
srsly/tests/test_pickle_api.py
Python
mit
870
from suplemon import helpers from suplemon.linelight.color_map import color_map class Syntax: def get_comment(self, line): return ("", "") def get_color(self, raw_line): color = color_map["white"] line = raw_line.strip() if helpers.starts(line, ["{", "}"]): color =...
twolfson/suplemon
suplemon/linelight/json.py
Python
mit
442
# Challenge: guess-number game infinite number of guesses # The game: Guess the number game. # In this game we will try to guess a random number between 0 and 100 generated # by the computer. Depending on our guess, the computer will give us hints, # whether we guessed too high, too low or if we guessed correctly. # # ...
vinaymayar/python-game-workshop
lesson4/guess_game.py
Python
mit
1,288
# coding: utf-8 """ This file is where things are stuffed away. Probably you don't ever need to alter these definitions. """ import sys import os.path import uuid import dateutil.parser import datetime from bs4 import BeautifulSoup from urllib.parse import urlparse, urljoin import gzip import requests impor...
Vastra-Gotalandsregionen/verifierad.nu
helper.py
Python
mit
10,385
from flask import current_app from ..core import Service, db from .models import Component class ComponentsService(Service): __model__ = Component
mcflugen/wmt-rest
wmt/flask/components/__init__.py
Python
mit
155
# -*- coding: utf-8 -*- from orator.migrations import Migrator, DatabaseMigrationRepository from .base_command import BaseCommand class MigrateCommand(BaseCommand): """ Run the database migrations. migrate {--d|database= : The database connection to use.} {--p|path= : The path of migrati...
Hanaasagi/sorator
orator/commands/migrations/migrate_command.py
Python
mit
2,409
import json import os import bson import networkx as nx from networkx.readwrite import json_graph class NetworkAnalysis: def __init__(self, population, tolerance=0.1): self.population = population self.tolerance = tolerance self.pcdb = self.population.pcdb def get_network(self): ...
MaterialsDiscovery/PyChemia
pychemia/dm/network.py
Python
mit
4,980
from django.conf import settings import requests import logging graphite_api = settings.GRAPHITE_API user = settings.GRAPHITE_USER password = settings.GRAPHITE_PASS graphite_from = settings.GRAPHITE_FROM auth = (user, password) def get_data(target_pattern): resp = requests.get( graphite_api + 'render', a...
BillGuard/cabot
cabot/cabotapp/graphite.py
Python
mit
2,507
class Category(object): def __init__(self, client): self.client = client def list(self): response = self.client._make_request('/categories') response = response.json() return self.client._list_response(response) def search(self, category_name): categories = self.lis...
andreagrandi/toshl-python
toshl/category.py
Python
mit
427
import decimal from datetime import datetime from django.conf import settings from django.conf.urls import url, include from pinax.stripe.forms import PlanForm from .base import ViewConfig invoices = [ dict(date=datetime(2017, 10, 1), subscription=dict(plan=dict(name="Pro")), period_start=datetime(2017, 10, 1),...
pinax/pinax_theme_tester
pinax_theme_tester/configs/stripe.py
Python
mit
3,913
from multiprocessing import Pool class Process: def __init__(self, processes=8): self.p = Pool(processes) def Exec(self, f, data): return self.p.map(f, data)
chengluyu/SDU-Computer-Networks
assignment-2/multiprocesser.py
Python
mit
185
"""Map Comprehensions""" def inverse_filter_dict(dictionary, keys): """Filter a dictionary by any keys not given. Args: dictionary (dict): Dictionary. keys (iterable): Iterable containing data type(s) for valid dict key. Return: dict: Filtered dictionary. """ return {key:...
joeflack4/jflack
joeutils/data_structures/comprehensions/maps/__init__.py
Python
mit
883
from setuptools import setup setup(name='excel_form_builder', version='0.1.1', description='Convert Word/PDF documents to Excel Workbooks', url='https://github.com/aseli1/dm_excel_form_builder', author='Anthony Seliga', author_email='anthony.seliga@gmail.com', license='MIT', p...
aseli1/dm_excel_form_builder
setup.py
Python
mit
487
from django.test import TestCase from mock import patch from digest.management.commands.import_importpython import ImportPythonParser from digest.utils import MockResponse, read_fixture class ImportPythonWeeklyTest(TestCase): def setUp(self): self.url = "http://importpython.com/newsletter/no/60/" ...
pythondigest/pythondigest
digest/tests/test_import_importpython.py
Python
mit
2,657
from twisted.python import usage from txpx import runner from supperfeed.build import Build class Options(usage.Options): subCommands = [ ("build", None, Build, Build.__doc__), ] def opt_version(self): print 'SupperFeed server v???' return usage.Options.opt_version(self) ...
corydodt/SupperFeed
supperfeed/spoon.py
Python
mit
595
# -*- coding: utf-8 -*- import repy try: from setuptools import setup except ImportError: from distutils.core import setup setup( name=repy.__pkgname__, version=repy.__version__, description="Python Regex cli tool", author_name=repy.__author_name__, author_email=repy.__author_email__, ...
Grokzen/repy
setup.py
Python
mit
1,433
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Created on 4 juin 2013 @author: Aristote Diasonama ''' from shop.handlers.event.base import BaseHandler from shop.handlers.base_handler import asso_required from shop.models.event import Event from shop.shop_exceptions import EventNotFoundException class ShowEven...
EventBuck/EventBuck
shop/handlers/event/show.py
Python
mit
2,800
import setuptools with open("space_tracer.md") as f: long_description = f.read() about = {} with open("plugin/PySrc/space_tracer/about.py") as f: exec(f.read(), about) # noinspection PyUnresolvedReferences setuptools.setup( name=about['__title__'], version=about['__version__'], author=about['__aut...
donkirkby/live-py-plugin
setup.py
Python
mit
1,514
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # cob documentation build configuration file, created by # sphinx-quickstart on Sun Jan 7 18:09:10 2018. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autoge...
schae234/cob
docs/conf.py
Python
mit
5,863
#!/usr/bin/env python # encoding: utf-8 import urllib from config import USERNAME, EXTENSION, PASSWORD, APP_KEY, APP_SECRET, SERVER, MOBILE from ringcentral import SDK def main(): sdk = SDK(APP_KEY, APP_SECRET, SERVER) platform = sdk.platform() platform.login(USERNAME, EXTENSION, PASSWORD) to_number...
ringcentral/python-sdk
demo_sms.py
Python
mit
609
import curses import random class Screen(object): def __init__(self, maxy, maxx): self.setmaxyx(maxy, maxx) self.pos = (0, 0) def clear(self, *args): if not args: y, x = self.getmaxyx() self.lines = [] for i in range(y): self.lines.ap...
thesealion/writelightly
writelightly/tests/base.py
Python
mit
4,192
import argparse class Wait(object): @staticmethod def add_parser(parser): parser.add_parser('wait') def __init__(self, dung): self.dung = dung def run(self): self.dung.wait_for_it()
dgholz/dung
dung/command/wait.py
Python
mit
226
# -*- coding: utf-8 *-* from redis._compat import iteritems, iterkeys, itervalues from redis.connection import Token from redis.exceptions import RedisError from .base import RedisBase class ZsetCommands(RedisBase): # SORTED SET COMMANDS def zadd(self, name, *args, **kwargs): """ Set any numb...
katakumpo/niceredis
niceredis/client/zset.py
Python
mit
11,593
from __future__ import division from pprint import pprint import string import math __author__ = 'Youval' def test_new_chain_names(i_transforms, unique_chain_names): ''' (int, int, set) -> dictionary Create a dictionary keys: a string made of chain_name + str(i_transform number) values: string (one or two ...
youdar/work
work/MTRIX/test_new_chain_names_creation.py
Python
mit
2,991
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('billing', '0003_auto_20160816_1429'), ...
topaz1874/srvup
src/billing/migrations/0004_usermerchantid.py
Python
mit
813
#!/usr/bin/env python2 # -*- coding: utf-8 -*- from pwn import * context(arch='amd64', os='linux', aslr=False, terminal=['tmux', 'neww']) env = {'LD_PRELOAD': './libc.so.6'} if args['GDB']: io = gdb.debug( './artifact-amd64-2.24-9ubuntu2.2', env=env, gdbscript='''\ set follow-fork-...
integeruser/on-pwning
2017-hitcon-quals/Impeccable-Artifact/artifact.py
Python
mit
3,733
# -*- coding: utf-8 -*- from django.db.models import Q from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers from rest_framework.validators import UniqueValidator from .models import User from go_green.badge.serializers import BadgeViewSetSerializer class UserViewSetSerial...
TraMZzz/GoGreen
go_green/users/serializers.py
Python
mit
1,359
# -*- coding: utf-8 -*- """ Some py2/py3 compatibility support based on a stripped down version of six so we don't have to depend on a specific version of it. """ import sys PY2 = sys.version_info[0] == 2 if PY2: string_types = basestring, else: string_types = str, def add_metaclass(metaclass):...
Harut/chakert
chakert/_compat.py
Python
mit
837
#!/usr/bin/env python #-*-coding:utf-8-*- # # @author Meng G. # 2016-03-28 restructed from sqip import app as application if __name__ == '__main__': application.debug = True application.run(host="0.0.0.0")
gaomeng1900/SQIP-py
app.py
Python
cc0-1.0
212
from collections.abc import Sequence import pytest from regolith.schemas import SCHEMAS, validate, EXEMPLARS from pprint import pprint @pytest.mark.parametrize("key", SCHEMAS.keys()) def test_validation(key): if isinstance(EXEMPLARS[key], Sequence): for e in EXEMPLARS[key]: validate(key, e, ...
scopatz/regolith
tests/test_validators.py
Python
cc0-1.0
876
import six from django.contrib.auth.tokens import PasswordResetTokenGenerator class TokenGenerator(PasswordResetTokenGenerator): def _make_hash_value(self, user, timestamp): return ( six.text_type(user.pk) + six.text_type(timestamp) + six.text_type(user.username) ) accoun...
Datateknologerna-vid-Abo-Akademi/date-website
members/tokens.py
Python
cc0-1.0
358
import tornado.gen from .models import Feed # Handlers in Tornado like Views in Django class FeedHandler(tornado.web.RequestHandler): @tornado.gen.coroutine def get(self): feed = yield Feed.fetch() self.write(feed)
rudyryk/python-samples
hello_tornado/hello_feed/core/handlers.py
Python
cc0-1.0
240
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This file is part of captlog. # # captlog - The Captain's Log (secret diary and notes application) # # Written in 2013 by Ricardo Garcia <r@rg3.name> # # To the extent possible under law, the author(s) have dedicated all copyright # and related and neighboring rights to...
rg3/captlog
setup.py
Python
cc0-1.0
1,110