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 plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Hoverlabel(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatter"
_path_str = "scatter.hoverlabel"
_valid_props = {
"align",
"ali... | plotly/plotly.py | packages/python/plotly/plotly/graph_objs/scatter/_hoverlabel.py | Python | mit | 17,848 |
import sys
import math
def getNextEle (X, C, F, i):
res = 0
residue = 0
for j in range(1,i):
t = int ( math.ceil ( (C-residue) / (x+ j*F)))
residue = t * # cosider residue cookies because of integral time seconds
res += X / (x + i*F);
def main():
| ziiin/onjCodes | codejam/2014/B-cookie-clicker.py | Python | mit | 294 |
import os
import dj_database_url
from .base_settings import *
ALLOWED_HOSTS = ['shaha-halaqat.herokuapp.com', '0.0.0.0']
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
STATI... | EmadMokhtar/halaqat | halaqat/settings/shaha.py | Python | mit | 1,432 |
"""
This is the (unofficial) Python API for EZTV.it
Using this code, you can manage to get the information regarding any TV Show
which is listed on EZTV.it See how to use it thanks to the file "APIExample.py"
"""
from bs4 import BeautifulSoup
import requests
import re
URL = "http://eztv.it"
class EztvException(Exc... | PaulSec/TVShowsManager | eztv_api.py | Python | mit | 6,056 |
import unittest
from katas.kyu_7.sum_of_numbers_from_zero_to_n import show_sequence
class ShowSequenceTestCase(unittest.TestCase):
def test_equal_1(self):
self.assertEqual(show_sequence(6), '0+1+2+3+4+5+6 = 21')
def test_equal_2(self):
self.assertEqual(show_sequence(7), '0+1+2+3+4+5+6+7 = 28... | the-zebulan/CodeWars | tests/kyu_7_tests/test_sum_of_numbers_from_zero_to_n.py | Python | mit | 566 |
import os, time
from threading import Thread
from pyven.logging.logger import Logger
import pyven.constants
from pyven.reporting.content.success import Success
from pyven.reporting.content.failure import Failure
from pyven.reporting.content.unknown import Unknown
from pyven.reporting.content.title import Title
from ... | mgaborit/pyven | source/pyven/steps/step.py | Python | mit | 3,958 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | JoseALermaIII/python-tutorials | docs/source/conf.py | Python | mit | 6,850 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 22 14:49:04 2015
@author: James
"""
#import PIL
from PIL import ImageOps, ImageFilter, ImageGrab, Image
import os
fp = os.getcwd() + '\\trees_ss 8.jpg\\'
img = Image.open('trees_ss 8.jpg', 'r')
#labels = img.split
#print labels
pixel = img.getpixel((1,1))
r, g, b =... | jtara1/tol-bot | tests_etc/PIL-test.py | Python | mit | 340 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | mattcongy/itshop | docker-images/taigav2/taiga-back/taiga/projects/api.py | Python | mit | 32,383 |
# -*- 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/copy_files.py | Python | mit | 2,163 |
# SPDX-License-Identifier: MIT
# Copyright (C) 2021 Tobias Gruetzmacher
from ..scraper import _ParserScraper
class AnotherDummyTestScraper(_ParserScraper):
url = 'https://dummy.example/'
| webcomics/dosage | tests/mocks/extra/dummy.py | Python | mit | 193 |
# SPDX-FileCopyrightText: 2019 Jean-Louis Fuchs <ganwell@fangorn.ch>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Test mpipe."""
import mpipe
from hypothesis import given
import hypothesis.strategies as st
@given(st.integers(
max_value=2 ** 30,
min_value=-2 ** 30,
))
def test_mpipe(num):
"""Test i... | ganwell/rbtree | old_dev/src/test_mpipe.py | Python | mit | 712 |
# coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.gi... | docusign/docusign-python-client | docusign_esign/models/document_html_collapsible_display_settings.py | Python | mit | 11,943 |
# -*- coding:utf-8 -*-
__author__ = 'chenjun'
import torch
from torch.autograd import Variable
from utils.util import *
"""Beam search module.
Beam search takes the top K results from the model, predicts the K results for
each of the previous K result, getting K*K results. Pick the top K results from
K*K results, an... | nanfeng1101/Seq2Seq | pytorch_models/models/beam_search.py | Python | mit | 4,237 |
import datetime
import rjm
from pathlib import Path
def cmd_journal(project_code, model_path, jrn_path, com_dir, log_dir):
command_path = Path(__file__).parent
command_name = command_path.name
time_stamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
rvt_jrn = rjm.JournalMaker()
com_data = {
... | hdm-dt-fb/rvt_model_services | commands/audit_no_ws/__init__.py | Python | mit | 979 |
# -*- coding: utf-8 -*-
from sqlalchemy import func
from sqlalchemy.exc import IntegrityError
from ..core import db
from ..models import UserGroupPermission
def create(user_group_id, permission_id):
user_group_permission = UserGroupPermission(
user_group_id=user_group_id,
permission_id=permission_... | soasme/flask-perm | flask_perm/services/user_group_permission.py | Python | mit | 2,790 |
#! /usr/bin/python
#should move this file inside docker image
import ast
import solution
'''driver file running the program
takes the test cases from the answers/question_name file
and executes each test case. The output of each execution
will be compared and the program outputs a binary string.
Eg : 1110111 mea... | akhilerm/Castle | storage/app/public/drivers/driver.py | Python | mit | 1,024 |
# -*- coding: utf-8 -*-
#!/usr/bin/python
from applescript import asrun, asquote
subject = 'A new email'
body = '''This is the body of my "email."
I hope it comes out right.
Regards,
Dr. Drang
'''
ascript = '''
tell application "Mail"
activate
make new outgoing message with properties {{visible:true, subjec... | QuentinJi/aspy | test.py | Python | mit | 424 |
from settings.staging import *
ALLOWED_HOSTS = ['{{cookiecutter.repo_name}}.TODO']
EMAIL_BACKEND = 'sparkpost.django.email_backend.SparkPostEmailBackend'
| taaviteska/django-template | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/settings/production.py | Python | mit | 157 |
# -*- coding: utf-8 -*-
# users.py
#
# Copyright 2014-2015 BitVault, Inc. dba Gem
from __future__ import unicode_literals
from .config import *
from .wrappers import *
from .errors import *
from .subscriptions import Subscriptions
from .devices import Devices
from .wallets import generate, Wallet
class Users(DictW... | GemHQ/round-py | round/users.py | Python | mit | 6,392 |
from soba.models.continuousModel import ContinuousModel
import soba.visualization.ramen.mapGenerator as ramen
import soba.run
from collections import OrderedDict
import json
from time import time
import sys
from model import SEBAModel
from visualization.back import Visualization
import datetime as dt
aStar = False
... | gsi-upm/soba | projects/seba/run.py | Python | mit | 3,404 |
'''
Created on Jun 6, 2014
@author: rtermondt
'''
from django.conf import settings
def global_settings(request):
invitation_system_setting = getattr(settings, 'INVITATION_SYSTEM', None)
if invitation_system_setting == True:
invite_system = True
else:
invite_system = False
ret... | richtermondt/inithub-web | inithub/inithub/context_processors.py | Python | mit | 376 |
import utils
import resources.bible as bible
import resources.passages as passages
import resources.sermons as sermons
import resources.events as events
import config
import cards
import speech
from .intents_utils import ensure_date_and_service_slots_filled, ensure_date_is_a_sunday, \
ensure_service_valid, ensure_d... | mauriceyap/ccm-assistant | src/intents/intents.py | Python | mit | 7,176 |
# -*- coding: utf-8 -*-
# @Author: Cody Kochmann
# @Date: 2017-09-09 14:58:43
# @Last Modified by: Cody Kochmann
# @Last Modified time: 2017-12-09 10:27:36
from functools import partial
from strict_functions import strict_globals
@strict_globals(partial=partial)
def chain(*args):
"""itertools.chain, just bett... | CodyKochmann/generators | generators/chain.py | Python | mit | 1,291 |
#!/usr/bin/env python
import unittest
from pentai.base.bit_reverse import *
class BitReverseTest(unittest.TestCase):
def test_reverse(self):
x = reverse_mask(0xF3000000)
self.assertEquals(x, 0x000000CF)
def test_reverse_empty(self):
x = reverse_mask(0x00000000)
self.assertEq... | cropleyb/pentai | pentai/base/t_bit_reverse.py | Python | mit | 1,354 |
# -*- coding: utf-8 -*-
""" This is the pytest configuration file """
import colorama
import pytest
import sys
from seleniumbase import config as sb_config
from seleniumbase.core import log_helper
from seleniumbase.core import proxy_helper
from seleniumbase.fixtures import constants
def pytest_addoption(parser):
... | mdmintz/SeleniumBase | seleniumbase/plugins/pytest_plugin.py | Python | mit | 34,757 |
import os
import shutil
import unittest
from parameterized.parameterized import parameterized
import six
from conans.client import defs_to_string
from conans.client.build.meson import Meson
from conans.client.conf import default_settings_yml
from conans.client.tools import args_to_string
from conans.errors import Con... | memsharded/conan | conans/test/unittests/client/build/meson_test.py | Python | mit | 9,218 |
import click
from syncano_cli.base.options import ColorSchema
class Prompter(object):
indent = ' '
def prompt(self, text, color=None, **kwargs):
styles_kwargs = {'fg': color or ColorSchema.PROMPT}
return click.prompt(click.style("{}{}".format(self.indent, text), **styles_kwargs), **kwargs)... | Syncano/syncano-cli | syncano_cli/base/prompter.py | Python | mit | 536 |
from django.contrib.auth.decorators import login_required
from django.conf.urls import include, url
from django.contrib import admin
from quiz.views import answer_reader, QuestionDetail, QuizDetail, QuizList
urlpatterns = [
url('^accounts/', include('django.contrib.auth.urls')),
url(r'^admin/', admin.site.ur... | pbx/django-quiz | quizproject/urls.py | Python | mit | 699 |
from tf_idf import *
class EventAnalysis:
"""
Class that contains all the necessary operation to process to a text analysis
"""
@staticmethod
def get_id_website(id_doc, is_website):
"""
Apply the processing to have a website id
"""
return id_doc if not... | Diego999/Social-Recommendation-System | event_analyse/event_analysis.py | Python | mit | 2,010 |
from functools import reduce
from operator import add
from pygame.math import Vector2 as V2
import pygame as pg, os
from src.display.tkinter_windows import create_menu
from src.core import constants
def init_display():
pg.init()
info = pg.display.Info()
dims = (int(info.current_w * 0.6), int(info.current_... | StardustGogeta/Physics-2.0 | Physics 2.0.py | Python | mit | 7,824 |
from django.utils.translation import ugettext_lazy as _
def configure_admin_site(admin_site):
# Text to put at the end of each page's <title>.
admin_site.site_title = _('SimpleERP Admin site')
# Text to put in each page's <h1>.
admin_site.site_header = _('SimpleERP Administration')
# Text to put... | samupl/simpleERP | simpleERP/admin.py | Python | mit | 416 |
# modu
# Copyright (c) 2006-2010 Phil Christensen
# http://modu.bubblehouse.org
#
#
# See LICENSE for details
"""
Twisted plugin to launch a modu web application container.
"""
from zope.interface import implements
from twisted.python import usage
from twisted.plugin import IPlugin
from twisted.application import in... | philchristensen/modu | src/twisted/plugins/modu_web.py | Python | mit | 1,455 |
from sqlalchemy import Column, Integer, String, func, Boolean
from app import db
class CnesProfessional(db.Model):
__tablename__ = 'cnes_professional'
year = Column(Integer, primary_key=True)
region = Column(String(1), primary_key=True)
mesoregion = Column(String(4), primary_key=True)
microregion ... | DataViva/dataviva-api | app/models/cnes_professional.py | Python | mit | 2,123 |
"""Connect4 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | ClovisDj/Playconnect4 | Connect4/urls.py | Python | mit | 909 |
# -*- coding: utf-8 -*-
import unittest
from pg_requests.functions import fn, Function
class FunctionFactoryTest(unittest.TestCase):
def test_get_new_function(self):
f = fn.COUNT
self.assertIsInstance(f, Function)
self.assertEqual(f.name, 'COUNT')
self.assertEqual(f('*'), 'COUNT(*)... | prawn-cake/pg_query | pg_requests/tests/test_functions.py | Python | mit | 611 |
import mcpi.minecraft as minecraft
import mcpi.block as block
import mcpi.minecraftstuff as mcstuff
from time import sleep
class Planet():
def __init__(self, pos, radius, blockType, blockData = 0):
self.mc = minecraft.Minecraft.create()
self.pos = pos
self.radius = radius
... | martinohanlon/minecraft-starwars | planet.py | Python | mit | 1,268 |
import web
from pycryptics.solve_clue import CrypticClueSolver, split_clue_text
import webbrowser
import re
# from fake_solve_clue import FakeCrypticClueSolver as CrypticClueSolver
# from fake_solve_clue import split_clue_text
SERVER = "http://localhost:8080/solve/"
class index:
def GET(self):
return rend... | rdeits/cryptics | pycryptics/crypticweb/server.py | Python | mit | 2,649 |
import numpy as np
import scipy.stats as stats
import sys
# lib eh a nossa biblioteca criada para este trabalho
import lib.naive_bayes as nb
import lib.preprocessing as prep
import lib.validation as valid
import lib.normalization as normal
from config.constants import *
def case3(output=True):
accuracy_in_eac... | queirozfcom/spam-filter | case3_naive_normal.py | Python | mit | 8,514 |
# deterministic_signals.py
"""Contains class factories for deterministic signals.
Deterministic signals are defined as the class of signals that have a
delay that is to be subtracted from the residuals.
"""
import numpy as np
from enterprise import pulsar
from enterprise.signals import parameter, selections, signal_b... | jellis18/enterprise | enterprise/signals/deterministic_signals.py | Python | mit | 8,133 |
# Copyright 2019 Google LLC.
"""Pipeline to decode and reencode a video using OpenCV."""
from absl import app
from absl import flags
from video_processing import processor_runner
from video_processing.processors import opencv_video_decoder
from video_processing.processors import opencv_video_encoder
flags.DEFINE_stri... | learningequality/video-vectorization | video_processing/pipelines/simple_encode_decode.py | Python | mit | 902 |
# MIT License
#
# Copyright (c) 2015-2021 Iakiv Kramarenko
#
# 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, modif... | yashaka/selene | selene/core/conditions.py | Python | mit | 1,391 |
from django.urls import path
from events import views
app_name = "api_events"
urlpatterns = [
path("", views.EventListView.as_view()),
path("<int:pk>/", views.EventDetailView.as_view()),
path("comment/<int:pk>/", views.EventCommentView.as_view()),
path("attachment/<int:pk>/", views.EventAttachmentView... | MicroPyramid/Django-CRM | events/urls.py | Python | mit | 335 |
# Add settings here that are specific for live production environments
# These settings will override those set in default_config.py
# SECRET_KEY must be set to a random and unique phrase before running the application.
# See http://flask.pocoo.org/docs/0.12/quickstart/ on how to generate a secret key.
# SECRET_KEY = ... | Frumple/mrt-file-server | instance_template/production/config.py | Python | mit | 510 |
import gdata.blogger.client
import gdata.blogger.data
import atom
class Blog:
"""
A simple class for interacting with a Blogger blog.
It uses the Google gdata API to create, update and delete posts.
"""
def __init__ (self, blog, client):
self.client = client
self.blog_id = blog.get_blog_id()
... | jweslley/frogstarb | frogstarb/blogger.py | Python | mit | 3,965 |
import os
# We'll render HTML templates and access data sent by POST
# using the request object from flask. Redirect and url_for
# will be used to redirect the user once the upload is done
# and send_from_directory will help us to send/show on the
# browser the file that the user just uploaded
from flask import Flask, ... | duaraghav8/Corque | demo.py | Python | mit | 2,535 |
"""Module provider for rage4"""
import json
import logging
import requests
from lexicon.exceptions import AuthenticationError
from lexicon.providers.base import Provider as BaseProvider
LOGGER = logging.getLogger(__name__)
NAMESERVER_DOMAINS = ["rage4.com"]
def provider_parser(subparser):
"""Configure provide... | AnalogJ/lexicon | lexicon/providers/rage4.py | Python | mit | 5,281 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (c) 2017 Ivo Tzvetkov
#
# 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 wit... | ivotkv/redmsg-logger | redmsg_logger/logger.py | Python | mit | 2,648 |
import struct
import spindrift.mysql.charset as charset
from spindrift.mysql.constants import CLIENT, SERVER_STATUS
import spindrift.mysql.util as util
MAX_PACKET_LEN = 2**24-1
NULL_COLUMN = 251
UNSIGNED_CHAR_COLUMN = 251
UNSIGNED_SHORT_COLUMN = 252
UNSIGNED_INT24_COLUMN = 253
UNSIGNED_INT64_COLUMN = 254
def writ... | robertchase/spindrift | spindrift/mysql/packet.py | Python | mit | 9,220 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import wagtail.core.blocks
import wagtail.core.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0029_auto_20150811_1924'),
]
operations = [
migrations.Add... | OpenCanada/website | articles/migrations/0030_auto_20150806_2136.py | Python | mit | 928 |
class BinaryTree:
"""This is the binary tree ADT
"""
def __init__(self, root=None):
self._root = root
def element(self):
return self.element
def root(self):
return self._root
def setRoot(self, r):
self._root = r
def parent(self, v):
if v == self.... | amal029/DataStructuresAndAlgorithmsInPython | Tree/binaryTree.py | Python | mit | 6,263 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import unittest
import warnings
import numpy as np
from pymatgen.io.cif import CifParser, CifWriter, CifBlock
from pymatgen.io.vasp.inputs import Poscar
from pymatgen import Element, Specie, Lattice, Structu... | mbkumar/pymatgen | pymatgen/io/tests/test_cif.py | Python | mit | 43,823 |
#!/usr/bin/env python
"""
This is a module contains scripts for generating compact, upper-triangle and full matrices of 5C interaction data.
Concepts
--------
Data can either be arranged in compact, complete, or flattened (row-major) upper-triangle arrays. Compact arrays are N x M, where N is the number of forward p... | bxlab/hifive | hifive/fivec_binning.py | Python | mit | 71,263 |
#!/usr/bin/env python3
import asyncio
import sys
from third_party import X, Y, Z
from library import some_connection, \
some_decorator
# fmt: off
from third_party import (X,
Y, Z)
# fmt: on
f'trigger 3.6 mode'
# Comment 1
# Comment 2
# fmt: off
def func_no_args():
a; b... | psf/black | tests/data/fmtonoff.py | Python | mit | 9,645 |
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
from xmitgcm import open_mdsdataset
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
plt.ion()
dir1 = '/homedata/bderembl/runmit/test_southatlgyre'
ds1 = open_mdsdataset(dir1,prefix=['S'])
nt = 0
nz = 0
#... | Herpinemmanuel/Oceanography | Cas_1/Salinity/A_General_Salinity.py | Python | mit | 983 |
def neighbors(node, all_nodes):
dirs = [[0, 1], [1, 0], [-1, 0], [0, -1]]
ddirs = [[1, 1], [1, -1], [-1, 1], [-1, -1]]
result = set()
# cdef bool x
for dir in dirs:
nx, ny = node[0] + dir[0], node[1] + dir[1]
try:
all_nodes[nx][ny]
except IndexError:
... | NiclasEriksen/importANT | pypf.py | Python | mit | 3,410 |
from unittest import TestCase
from unittest.mock import MagicMock
from dakara_player_vlc.dakara_manager import DakaraManager
class DakaraManagerTestCase(TestCase):
"""Test the dakara manager class
"""
def setUp(self):
# create a mock font loader
self.font_loader = MagicMock()
# ... | Nadeflore/dakara-player-vlc | tests/test_dakara_manager.py | Python | mit | 4,895 |
# pinspect_support_module_1.py
# Copyright (c) 2013-2019 Pablo Acosta-Serafini
# See LICENSE for details
# pylint: disable=C0103,C0111,C0411,C0412,C0413,R0201,R0205,R0903,W0212,W0621
from __future__ import print_function
import sys
import pexdoc.exh
import pexdoc.pcontracts
import tests.support.pinspect_support_module... | pmacosta/pexdoc | tests/support/pinspect_support_module_1.py | Python | mit | 5,165 |
#!/var/www/django/treeio/venv/bin/python
#
# The Python Imaging Library
# $Id$
#
# PIL raster font compiler
#
# history:
# 1997-08-25 fl created
# 2002-03-10 fl use "from PIL import"
#
from __future__ import print_function
VERSION = "0.4"
import glob, sys
# drivers
from PIL import BdfFontFile
from PIL import Pc... | havard024/prego | venv/bin/pilfont.py | Python | mit | 1,043 |
import socket
import threading
bind_ip = "0.0.0.0"
bind_port = 9999
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((bind_ip, bind_port))
server.listen(5)
print "[*] Listening on %s:%d" % (bind_ip, bind_port)
def handle_client(client_socket):
request = client_socket.recv(1024)
print "[*... | yiannisk/python-black-hat | sample_tcp_server.py | Python | mit | 615 |
from flask import Flask, request, jsonify, abort
import os
import requests
app = Flask(__name__)
app.debug = os.getenv('DEBUG', '') == 'True'
def access_token():
return os.getenv('ACCESS_TOKEN', '')
def check_user_id(user_id):
if user_id not in os.getenv('USER_IDS', ''):
return abort(403)
def check_user_nam... | cyrilkyburz/bhwi_proxy | bhwi_proxy.py | Python | mit | 1,516 |
from django.apps import AppConfig
class MoocConfig(AppConfig):
name = 'mooc'
| Zing22/Moogle | moogle/mooc/apps.py | Python | mit | 83 |
import cProfile
import StringIO
import pstats
import contextlib
@contextlib.contextmanager
def profiled():
pr = cProfile.Profile()
pr.enable()
yield
pr.disable()
s = StringIO.StringIO()
ps = pstats.Stats(pr, stream=s).sort_stats("cumulative")
ps.print_stats()
# uncomment this to see wh... | DBeath/flask-feedrsub | feedrsub/utils/profiler.py | Python | mit | 386 |
'''
Created on Jan 2, 2015
@author: alessandro
'''
import add_path
import os
import cv2
import sys
import json
import getopt
import random
import numpy as np
from filter_tig import FilterTIG
EDGE = 8
BASE_LOG = 2
MIN_EDGE_LOG = int(np.ceil(np.log(10.)/np.log(BASE_LOG)))
MAX_EDGE_LOG = int(np.ceil(np.log(500.)/np.log(... | bubae/gazeAssistRecognize | lib/BING-Objectness/source/bing.py | Python | mit | 10,487 |
# ECB wrapper skeleton file for 50.020 Security
# Oka, SUTD, 2014
from present import *
import argparse
nokeybits=80
blocksize=64
def ecb(infile,outfile,keyfile,mode):
key = 0x0
with open(keyfile, 'rb') as fkey:
for i in range(nokeybits / 8):
key |= ord(fkey.read(1)) << i * 8
with ope... | LYZhelloworld/Courses | 50.020/08/ecb.py | Python | mit | 1,521 |
""" Settings for proj """
from .base import *
try:
from .local import *
except ImportError as exc:
exc.args = tuple(
['%s (did you rename settings/local-dist.py?)' % exc.args[0]])
raise exc
| damsonn/django-docker-compose | proj/settings/__init__.py | Python | mit | 211 |
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.utils import six
class AccountActivationTokenGenerator(PasswordResetTokenGenerator):
def _make_hash_value(self, user, timestamp):
return (six.text_type(user.pk) + six.text_type(timestamp)) + six.text_type(user.is_active)
accou... | srijannnd/Login-and-Register-App-in-Django | simplesocial/accounts/tokens.py | Python | mit | 375 |
#!/usr/local/bin/python
# Code Fights Digits Product Problem
def digitsProduct(product):
def get_single_dig_factors(product):
# Helper function to generate single-digit factors of product
n = product
factors = []
for i in range(9, 1, -1):
while n % i == 0 and n > 1:
... | HKuz/Test_Code | CodeFights/digitsProduct.py | Python | mit | 1,457 |
#!/usr/bin/env python
TestFileName = "data/TestMap.png"
import wx
from wx.lib.floatcanvas import NavCanvas, FloatCanvas
#import sys
#sys.path.append("..")
#from floatcanvas import NavCanvas, FloatCanvas
class DrawFrame(wx.Frame):
"""
A frame used for the FloatCanvas Demo
"""
def __init__(self... | dnxbjyj/python-basic | gui/wxpython/wxPython-demo-4.0.1/samples/floatcanvas/Map.py | Python | mit | 1,965 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
# This module is NOT auto-generated
# Inspired by decompiled Java classes from vCenter's internalvim25stubs.jar
# Unless states otherside, the methods and attributes were not used by esxcli,
# and thus not tested
log = logging.getLogger(__name__)
de... | xuru/pyvisdk | pyvisdk/do/vim_esx_cl_inetworkfirewallrulesetallowediplist_firewall_ruleset_allowedip.py | Python | mit | 1,110 |
import random
import sys
sys.setrecursionlimit(7000)
def selection_sort(array, counter):
for i in range(0,len(array)):
min_val = array[i:len(array)+1][0]
for j in array[i:len(array)+1]:
counter += 1
if j < min_val:
min_val = j
k = array[i:len(array)+... | SulavKhadka/Sorting-Algorithms | sort_algos.py | Python | mit | 4,236 |
class GameStats():
def __init__(self, ai_settings):
self.ai_settings = ai_settings
self.game_active = False
self.high_score = 0
self.reset_stats()
def reset_stats(self):
self.ships_left = self.ai_settings.ship_limit
self.score = 0
self.level = 1
| imuntil/Python | L/game/game_stats.py | Python | mit | 311 |
# -*- coding: utf-8; mode: python; indent-tabs-mode: t; tab-width:4 -*-
from ..Qt import QtGui, QtCore
from ..templates import ui_plotTemplate as plotTemplate
from ..utilities.expeyesWidgetsNew import expeyesWidgets
import sys,time,functools,os
_translate = QtCore.QCoreApplication.translate
class AppWindow(QtGui.QWi... | csparkresearch/ExpEYES17-Qt | SPARK17/experiments/acgen.py | Python | mit | 1,163 |
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2016) Hewlett Packard Enterprise Development LP
#
# 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 limi... | danielreed/python-hpOneView | hpOneView/resources/networking/ethernet_networks.py | Python | mit | 9,856 |
"""build_ext tests
"""
import sys, os, shutil, tempfile, unittest, site, zipfile
from setuptools.command.upload_docs import upload_docs
from setuptools.dist import Distribution
SETUP_PY = """\
from setuptools import setup
setup(name='foo')
"""
class TestUploadDocsTest(unittest.TestCase):
def setUp(s... | diego-d5000/MisValesMd | env/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/tests/test_upload_docs.py | Python | mit | 1,950 |
from math import exp
import numpy as np
import openpyxl as op
# Initialize parameters
K = 100
T = 1
S = 100
r = 0.05
H = 110
X_rebate = 1
N = 4
dx = 0.2524
wb = op.load_workbook('Euro_prices_F5.3.xlsx')
def call(x,y):
sheet_call = wb.get_sheet_by_name('Call')
c = sheet_call.cell(row=x, ... | Michalos88/Quant-Projects | Amer_Up&Out_put.py | Python | mit | 4,251 |
""" A pair of numbers is considered to be cool if their product is divisible by their sum. More formally,
a pair (i, j) is cool if and only if (i * j) % (i + j) = 0.
Given two lists a and b, find cool pairs with the first number in the pair from a, and the second one from b.
Return the number of different sums of el... | ntthuy11/CodeFights | Arcade/04_Python/05_ComplexityOfComprehension/coolPairs.py | Python | mit | 853 |
import os
import sys
import pytest
import vtk
import pyvista
developer_note = """
vtk has been directly imported in vtk>=9
Please see:
https://github.com/pyvista/pyvista/pull/1163
"""
@pytest.mark.skipif(not pyvista._vtk.VTK9,
reason='``vtk`` can be loaded directly on vtk<9')
def test_vtk_not_lo... | akaszynski/vtkInterface | tests/test_init.py | Python | mit | 1,317 |
from django.contrib.sitemaps import Sitemap
from .models import Concert, Artist, Venue
class ConcertSitemap(Sitemap):
changefreq = "daily"
priority = 0.5
def items(self):
return Concert.objects.all()
def lastmod(self, obj):
return obj.modify_date
class ArtistSiteMap(Sitemap):
ch... | suriya/rasikapriya | rasikapriya/sitemaps.py | Python | mit | 770 |
"""
Copyright (c) 2009 John Markus Bjoerndalen <jmb@cs.uit.no>,
Brian Vinter <vinter@nbi.dk>, Rune M. Friborg <rune.m.friborg@gmail.com>.
See LICENSE.txt for licensing details (MIT License).
"""
from pycsp_import import *
import time
@io
def wait(seconds):
time.sleep(seconds)
@process
def delay_ou... | runefriborg/pycsp | test/iotest.py | Python | mit | 475 |
import urllib2
import eyed3
import mechanize
import os
from bs4 import BeautifulSoup as bs
import unicodedata as ud
import sys
import string
reload(sys)
sys.setdefaultencoding('utf-8')
class Song:
def __init__(self, keyword, filename, albumart, aaformat, dd='/home/praneet/Music/'):
self.info = keyword.split('@')
... | praneetmehta/FSMD | ID3update.py | Python | mit | 3,922 |
from functools import partial
from random import choice, randrange
from string import ascii_letters as letters, digits, punctuation, whitespace
from marrow.schema.testing import ValidationTest
from marrow.schema.validate.pattern import alphanumeric, username, twitterusername, facebookusername, creditcard, hexcolor, al... | marrow/schema | test/validate/test_pattern.py | Python | mit | 3,413 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import paw.models
class Migration(migrations.Migration):
dependencies = [
('paw', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='pageicon',
... | rectory-school/rectory-apps | paw/migrations/0002_auto_20150119_1938.py | Python | mit | 525 |
import logging
import os
import sys
import time
import RPi.GPIO as GPIO
from Utilities.SettingsManager import SettingsManager
from termcolor import colored
from Utilities.SleepableThread import SleepableThread
class SonarController(SleepableThread):
# region Variables
SC = SettingsManager(settin... | MJWherry/Greggg-Python | Sensors/SonarController.py | Python | mit | 8,550 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""McGill Robotics ROS Bagger.
This tool can:
1. Record the specified topics into 15 second bags to the specified
directory.
2. Merge previously recorded bags from the specified directory.
By default, all the topics defined in your project's 'topics' f... | mcgill-robotics/compsys | scripts/bag/bag/__main__.py | Python | mit | 1,110 |
#!/usr/bin/env python
"""
"""
import os,sys
import numpy as np
import matplotlib
#matplotlib.use('Agg')
import pylab as p
import cPickle as pkl
from scipy import interpolate
matplotlib.rc('xtick',labelsize=25)
matplotlib.rc('ytick',labelsize=25)
modeTitle=['Total Intensity','Invariant Interval','Matrix Template Ma... | griffinfoster/pulsar-polarization-sims | scripts/plotLineValVsTint.py | Python | mit | 5,743 |
import json
from django.test import TestCase
from cabinet.factories import UserFactory, BookOwnFactory
from factories import ClientFactory, AccessTokenFactory
class BookOwnTest(TestCase):
fixtures = ['users.json', 'client.json', 'books.json',
'bookownerships.json']
def setUp(self):
... | ax003d/sichu_web | sichu/apiserver/tests.py | Python | mit | 2,756 |
# -*- coding: utf-8 -*-
'''
'''
from __future__ import absolute_import
from datafs.core.data_api import DataAPI
from datafs.config.helpers import get_api, to_config_file
__author__ = """Climate Impact Lab"""
__email__ = 'jsimcock@rhg.com'
__version__ = '0.7.1'
_module_imports = (
DataAPI,
get_api,
to_co... | ClimateImpactLab/DataFS | datafs/__init__.py | Python | mit | 392 |
# -*- coding: utf-8 -*-
from chunsabot.botlogic import brain
from chunsabot.database import Database, Cache
from bs4 import BeautifulSoup as Soup
import requests
#from threading import Thread
from multiprocessing.pool import ThreadPool
class Weather:
cWEATHER_GET_URL = Database.load_config("weather_url_all")
... | susemeee/Chunsabot-framework | chunsabot/modules/weather.py | Python | mit | 3,474 |
salario = float(raw_input())
print(salario + (salario * 0.78)) | matheusmonte/PythonScripts | Salario078.py | Python | mit | 62 |
# -*- coding: utf-8 -*-
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from users.api import UserViewSet
router = DefaultRouter()
router.register('user', UserViewSet, base_name='user')
urlpatterns = [
url(r'1.0/', include(router.urls)), # include de las url's router
]
| krainet/Wordplease | users/api_urls.py | Python | mit | 320 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-05 17:14
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('conversations', '0002_auto_20160405_2119'),
]
operation... | enlighter/phone-convesation-test-portal | convo_test/conversations/migrations/0003_auto_20160405_2244.py | Python | mit | 544 |
# !/bin/env/ python
from flask import Flask
app = Flask(__name__, instance_relative_config=True)
app.config.from_object('config.default')
app.config.from_pyfile('config.py')
#app.config.from_envvar('APP_CONFIG_FILE')
| gitgitcode/myflask | maomew/__init__.py | Python | mit | 219 |
from django.shortcuts import render
from .models import Blurb, Schedule
def index(request):
blurbs = Blurb.objects.filter(display=True)
schedule = Schedule.objects.filter(display=True)
return render(request, "frontpage.html", {"blurbs": blurbs, "schedule": schedule})
| lopopolo/hyperbola | hyperbola/frontpage/views.py | Python | mit | 284 |
# Generated by Django 2.1.8 on 2019-05-15 14:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('diseases', '0002'),
]
operations = [
migrations.AddField(
model_name='disease',
name='biology_drugbank_url',
... | UPDDI/mps-database-server | diseases/migrations/0003.py | Python | mit | 799 |
#!/usr/bin/env python
import json
import sys
import argparse
from clingo import Control, Number
class App:
def __init__(self, args):
self.control = Control()
self.args = args
self.horizon = 0
self.objects = 0
self.end = None
def show(self, model):
if not s... | potassco/clingo | examples/clingo/expansion/main.py | Python | mit | 3,702 |
"""
This file contains the class definitions and functions that form the base of an MCMC sampler.
These classes are the base Parameter class, various MCMC step classes (e.g., Gibbs update,
Metropolis-Hastings update), and various proposal distributions for the Metropolis-like
algorithms.
"""
#TODO: ADD IN ASSERTIONS T... | acbecker/BART | steps.py | Python | mit | 11,512 |
import time
def wait_for_transaction(blockchain_client, txn_hash, max_wait=60, sleep_time=5):
start = time.time()
while True:
txn_receipt = blockchain_client.get_transaction_receipt(txn_hash)
if txn_receipt is not None:
break
elif time.time() > start + max_wait:
... | pipermerriam/ethereum-client-utils | eth_client_utils/utils.py | Python | mit | 2,183 |
"""
Django settings for stompy project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# ... | jaredkerim/stompy | app/settings.py | Python | mit | 3,293 |
from engine.Input import Keyboard;
from engine import Update;
from engine import Global;
# --------------------------------------------------- *\
# Player behaviour
# --------------------------------------------------- */
player = None;
controlsEnabled = False;
scale = Global.scale;
# ------------------------------... | WilliamDASILVA/TheMysteryOfSchweitzer | gameplay/behaviours/playerBehaviour.py | Python | mit | 4,453 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.