code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation import ugettext_lazy as _
from philo.forms.fields im... | ithinksw/philo | philo/models/fields/__init__.py | Python | isc | 4,971 |
import hashlib
import json
import logging
import os
import subprocess
import sys
import time
from collections import defaultdict
from shutil import copy
from shutil import copyfile
from shutil import copystat
from shutil import copytree
from tempfile import mkdtemp
import boto3
import botocore
import yaml
import sys
... | nficano/python-lambda | aws_lambda/aws_lambda.py | Python | isc | 26,779 |
# Copyright (c) 2015, Max Fillinger <max@max-fillinger.net>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND... | mfil/getebook | getebook/epub.py | Python | isc | 25,314 |
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
from scipy.spatial import distance
import matplotlib.pyplot as plt
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn.datasets.samples_generator import make_blobs
from sklearn.preprocessing import StandardScaler
from s... | banacer/door-wiz | src/identification/Identifier.py | Python | mit | 1,449 |
#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
... | wanghuafeng/spider_tools | decorator.py | Python | mit | 1,524 |
"""
********************************************************************
Test file for implementation check of CR3BP library.
********************************************************************
Last update: 21/01/2022
Description
-----------
Contains a few sample orbit propagations to test the CR3BP l... | poliastro/poliastro | contrib/CR3BP/test_run_CR3BP.py | Python | mit | 6,277 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. All Rights Reserved.
#
# 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... | tzpBingo/github-trending | codespace/python/tencentcloud/scf/v20180416/errorcodes.py | Python | mit | 27,390 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutIteration(Koan):
def test_iterators_are_a_type(self):
it = iter(range(1,6))
total = 0
for num in it:
total += num
self.assertEqual(15 , total)
def test_iterating_with_next(self):... | bohdan7/python_koans | python3/koans/about_iteration.py | Python | mit | 3,923 |
from api_request import Api
from util import Util
from twocheckout import Twocheckout
class Sale(Twocheckout):
def __init__(self, dict_):
super(self.__class__, self).__init__(dict_)
@classmethod
def find(cls, params=None):
if params is None:
params = dict()
response = ... | 2Checkout/2checkout-python | twocheckout/sale.py | Python | mit | 3,388 |
import json
import os
from flask import request, g, render_template, make_response, jsonify, Response
from helpers.raw_endpoint import get_id, store_json_to_file
from helpers.groups import get_groups
from json_controller import JSONController
from main import app
from pymongo import MongoClient, errors
HERE = os.pat... | CenterForOpenScience/scinet | scinet/views.py | Python | mit | 4,696 |
from corecat.constants import OBJECT_CODES, MODEL_VERSION
from ._sqlalchemy import Base, CoreCatBaseMixin
from ._sqlalchemy import Column, \
Integer, \
String, Text
class Project(CoreCatBaseMixin, Base):
"""Project Model class represent for the 'projects' table
which is used to store project's basic i... | DanceCats/CoreCat | corecat/models/project.py | Python | mit | 1,533 |
#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivault import hashiwrapper
ANSIBLE_METADATA = {'status': ['stableinterface'],... | TerryHowe/ansible-modules-hashivault | ansible/modules/hashivault/hashivault_approle_role_get.py | Python | mit | 1,659 |
from scrapy.spiders import Spider
from scrapy.selector import Selector
from scrapy.http import HtmlResponse
from FIFAscrape.items import PlayerItem
from urlparse import urlparse, urljoin
from scrapy.http.request import Request
from scrapy.conf import settings
import random
import time
class fifaSpider(Spider... | HashirZahir/FIFA-Player-Ratings | FIFAscrape/spiders/fifa_spider.py | Python | mit | 3,458 |
print("hello!!!!") | coolralf/KaggleTraining | HELP.py | Python | mit | 18 |
# 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/sql/azure-mgmt-sqlvirtualmachine/azure/mgmt/sqlvirtualmachine/aio/_sql_virtual_machine_management_client.py | Python | mit | 5,342 |
from flask import Blueprint, request, render_template
from ..load import processing_results
from ..abbr import get_abbr_map
abbr_map = get_abbr_map()
liner_mod = Blueprint('liner', __name__, template_folder='templates', static_folder='static')
@liner_mod.route('/liner', methods=['GET', 'POST'])
def liner():
if r... | griimick/feature-mlsite | app/liner/views.py | Python | mit | 1,108 |
# 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-web/azure/mgmt/web/models/dimension.py | Python | mit | 1,562 |
import asyncio
import discord
import datetime
import pytz
from discord.ext import commands
from Cogs import FuzzySearch
from Cogs import Settings
from Cogs import DisplayName
from Cogs import Message
from Cogs import Nullify
class Time:
# Init with the bot reference, and a reference to the s... | TheMasterGhost/CorpBot | Cogs/Time.py | Python | mit | 8,457 |
import unittest
from katas.beta.what_color_is_your_name import string_color
class StringColorTestCase(unittest.TestCase):
def test_equal_1(self):
self.assertEqual(string_color('Jack'), '79CAE5')
def test_equal_2(self):
self.assertEqual(string_color('Joshua'), '6A10D6')
def test_equal_3(... | the-zebulan/CodeWars | tests/beta_tests/test_what_color_is_your_name.py | Python | mit | 656 |
# coding: utf-8
from sqlalchemy.testing import eq_, assert_raises, assert_raises_message, \
config, is_
import re
from sqlalchemy.testing.util import picklers
from sqlalchemy.interfaces import ConnectionProxy
from sqlalchemy import MetaData, Integer, String, INT, VARCHAR, func, \
bindparam, select, event, Type... | michaelBenin/sqlalchemy | test/engine/test_execute.py | Python | mit | 70,582 |
"""
``editquality generate_make -h``
::
Code-generate Makefile from template and configuration
:Usage:
generate_make -h | --help
generate_make
[--config=<path>]
[--main=<filename>]
[--output=<path>]
[--template... | wiki-ai/editquality | editquality/utilities/generate_make.py | Python | mit | 2,362 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | vulcansteel/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/models/product.py | Python | mit | 931 |
# coding=utf8
"""
Parser for todo format string.
from todo.parser import parser
parser.parse(string) # return an Todo instance
"""
from models import Task
from models import Todo
from ply import lex
from ply import yacc
class TodoLexer(object):
"""
Lexer for Todo format string.
Tokens
ID ... | guori12321/todo | todo/parser.py | Python | mit | 2,473 |
import time
import pymemcache.client
import pytest
from limits import RateLimitItemPerMinute, RateLimitItemPerSecond
from limits.storage import MemcachedStorage, storage_from_string
from limits.strategies import (
FixedWindowElasticExpiryRateLimiter,
FixedWindowRateLimiter,
)
from tests.utils import fixed_sta... | alisaifee/limits | tests/storage/test_memcached.py | Python | mit | 3,218 |
import os
import sys
import tempfile
from fabric.api import run, sudo, env, local, hide, settings
from fabric.contrib.files import append, sed, exists, contains
from fabric.context_managers import prefix
from fabric.operations import get, put
from fabric.context_managers import cd
from fabric.tasks import Task
from ... | ff0000/red-fab-deploy | fab_deploy/joyent/postgres.py | Python | mit | 5,514 |
"""
Gauged
https://github.com/chriso/gauged (MIT Licensed)
Copyright 2014 (c) Chris O'Hara <cohara87@gmail.com>
"""
from urlparse import urlparse, parse_qsl
from urllib import unquote
from .mysql import MySQLDriver
from .sqlite import SQLiteDriver
from .postgresql import PostgreSQLDriver
def parse_dsn(dsn_string):
... | chriso/gauged | gauged/drivers/__init__.py | Python | mit | 1,960 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ibtokin.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | ibtokin/ibtokin | manage.py | Python | mit | 805 |
import boto
import mock
import moto
import tempfile
import unittest
from click.testing import CliRunner
from rubberjackcli.click import rubberjack
class CLITests(unittest.TestCase):
@moto.mock_s3_deprecated
@mock.patch('boto.beanstalk.layer1.Layer1.create_application_version')
@mock.patch('boto.beansta... | laterpay/rubberjack-cli | tests/test_cli.py | Python | mit | 6,380 |
from __future__ import absolute_import, division, print_function
# note: py.io capture tests where copied from
# pylib 1.4.20.dev2 (rev 13d9af95547e)
from __future__ import with_statement
import pickle
import os
import sys
from io import UnsupportedOperation
import _pytest._code
import py
import pytest
import contextl... | tareqalayan/pytest | testing/test_capture.py | Python | mit | 40,501 |
import zmq
import datetime
import pytz
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from registrations.models import Registration
from registrations import handlers
from registrations import tasks
class Command(BaseCommand):
def log(self, message):
f... | greencoder/hopefullysunny-django | registrations/management/commands/registration_worker.py | Python | mit | 1,481 |
#!/usr/bin/python
from noisemapper.mapper import *
#from collectors.lib import utils
### Define the object mapper and start mapping
def main():
# utils.drop_privileges()
mapper = NoiseMapper()
mapper.run()
if __name__ == "__main__":
main()
| dustlab/noisemapper | scripts/nmcollector.py | Python | mit | 259 |
import numpy as np
from numpy import cumsum, sum, searchsorted
from numpy.random import rand
import math
import utils
import core.sentence as sentence
import core.markovchain as mc
import logging
logger = logging.getLogger(__name__)
# Dialogue making class. Need to review where to return a string, where to return a l... | dcorney/text-generation | core/dialogue.py | Python | mit | 5,911 |
# -*- coding: utf-8 -*-
from django.contrib.admin import TabularInline
from .models import GalleryPhoto
class PhotoInline(TabularInline):
"""
Tabular inline that will be displayed in the gallery form during frontend
editing or in the admin site.
"""
model = GalleryPhoto
fk_name = "gallery"
| izimobil/djangocms-unitegallery | djangocms_unitegallery/admin.py | Python | mit | 318 |
from __future__ import annotations
from collections import defaultdict
from collections.abc import Generator, Iterable, Mapping, MutableMapping
from contextlib import contextmanager
import logging
import re
import textwrap
from types import MappingProxyType
from typing import TYPE_CHECKING, Any, NamedTuple
from markd... | executablebooks/mdformat | src/mdformat/renderer/_context.py | Python | mit | 22,558 |
import teca.utils as tecautils
import teca.ConfigHandler as tecaconf
import unittest
class TestFileFilter(unittest.TestCase):
def setUp(self):
self.conf = tecaconf.ConfigHandler(
"tests/test_data/configuration.json",
{"starting_path": "tests/test_data/images"}
)
self... | alfateam123/Teca | tests/test_utils.py | Python | mit | 902 |
#!/usr/bin/env python
from hdf5handler import HDF5Handler
handler = HDF5Handler('mydata.hdf5')
handler.open()
for i in range(100):
handler.put(i, 'numbers')
handler.close()
| iambernie/hdf5handler | examples/opening.py | Python | mit | 183 |
"""
[2015-07-13] Challenge #223 [Easy] Garland words
https://www.reddit.com/r/dailyprogrammer/comments/3d4fwj/20150713_challenge_223_easy_garland_words/
# Description
A [_garland word_](http://blog.vivekhaldar.com/post/89763722591/garland-words) is one that starts and ends with the
same N letters in the same order, f... | DayGitH/Python-Challenges | DailyProgrammer/DP20150713A.py | Python | mit | 1,597 |
from decimal import Decimal
from django import forms
from django.template.loader import render_to_string
from django.template.defaultfilters import slugify
class BaseWidget(forms.TextInput):
"""
Base widget. Do not use this directly.
"""
template = None
instance = None
def get_parent_id(self,... | redsolution/django-generic-ratings | ratings/forms/widgets.py | Python | mit | 7,704 |
#!/usr/bin/env python
import sys
import os
from treestore import Treestore
try: taxonomy = sys.argv[1]
except: taxonomy = None
t = Treestore()
treebase_uri = 'http://purl.org/phylo/treebase/phylows/tree/%s'
tree_files = [x for x in os.listdir('trees') if x.endswith('.nex')]
base_uri = 'http://www.phylocommons.org/... | NESCent/phylocommons | tools/treebase_scraper/annotate_trees.py | Python | mit | 622 |
from .stats_view_base import StatsViewSwagger, StatsViewSwaggerKeyRequired
from .stats_util_dataverses import StatsMakerDataverses
class DataverseCountByMonthView(StatsViewSwaggerKeyRequired):
"""API View - Dataverse counts by Month."""
# Define the swagger attributes
# Note: api_path must match the path... | IQSS/miniverse | dv_apps/metrics/stats_views_dataverses.py | Python | mit | 6,085 |
import uuid
from django.db import models
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import BaseUserManager
from django.utils import timezone
from accelerator_abstract.models import BaseUserRole
from accelerator_abstract.models.base_base_profile... | masschallenge/django-accelerator | simpleuser/models.py | Python | mit | 6,632 |
from setuptools import setup, find_packages
from codecs import open
import os
def read(*paths):
"""Build a file path from *paths* and return the contents."""
with open(os.path.join(*paths), 'r') as f:
return f.read()
setup(
name='transposer',
version='0.0.3',
description='Transposes column... | keithhamilton/transposer | setup.py | Python | mit | 1,307 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-11-01 20:02
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('phone_numbers', '0001_initial'),
... | RobSpectre/garfield | garfield/phone_numbers/migrations/0002_phonenumber_related_sim.py | Python | mit | 626 |
def calc():
h, l = input().split(' ')
mapa = []
for i_row in range(int(h)):
mapa.append(input().split(' '))
maior_num = 0
for row in mapa:
for col in row:
n = int(col)
if (n > maior_num):
maior_num = n
qtd = [0 for i in range(maior_num + 1)]
for row in mapa:
for col in row:
n ... | DestructHub/bcs-contest | 2016/Main/L/Python/solution_1_wrong.py | Python | mit | 471 |
#!/usr/bin/env python
"""
Manage and display experimental results.
"""
__license__ = 'MIT License <http://www.opensource.org/licenses/mit-license.php>'
__author__ = 'Lucas Theis <lucas@theis.io>'
__docformat__ = 'epytext'
__version__ = '0.4.3'
import sys
import os
import numpy
import random
import scipy
import socke... | jonasrauber/c2s | c2s/experiment.py | Python | mit | 21,962 |
import traceback
class EnsureExceptionHandledGuard:
"""Helper for ensuring that Future's exceptions were handled.
This solves a nasty problem with Futures and Tasks that have an
exception set: if nobody asks for the exception, the exception is
never logged. This violates the Zen of Python: 'Errors s... | mikhtonyuk/rxpython | concurrent/futures/cooperative/ensure_exception_handled.py | Python | mit | 3,261 |
__package__ = 'archivebox.core'
| pirate/bookmark-archiver | archivebox/core/__init__.py | Python | mit | 32 |
import logging.handlers
import os
_pabotlog = logging.getLogger('PABot')
_pabotlog.setLevel(logging.DEBUG)
_logPath = os.path.abspath("./logging/pabot.log")
_formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(name)s - %(message)s')
_consoleStreamHandler = logging.StreamHandler()
_consoleStreamHandler.s... | KevinJMcGrath/Symphony-Ares | modules/plugins/PABot/logging.py | Python | mit | 796 |
import ast
import heisenberg.library.heisenberg_dynamics_context
import heisenberg.library.orbit_plot
import heisenberg.option_parser
import heisenberg.plot
import heisenberg.util
import matplotlib
import numpy as np
import sys
# https://github.com/matplotlib/matplotlib/issues/5907 says this should fix "Exceeded cell ... | vdods/heisenberg | heisenberg/plot/__main__.py | Python | mit | 4,283 |
def send_simple_message():
return requests.post(
"https://api.mailgun.net/v3/sandbox049ff464a4d54974bb0143935f9577ef.mailgun.org/messages",
auth=("api", "key-679dc79b890e700f11f001a6bf86f4a1"),
data={"from": "Mailgun Sandbox <postmaster@sandbox049ff464a4d54974bb0143935f9577ef.mailgun.org>",
... | nicorellius/pdxpixel | pdxpixel/core/mailgun.py | Python | mit | 1,073 |
def load_keys(filepath):
"""
Loads the Twitter API keys into a dict.
:param filepath: file path to config file with Twitter API keys.
:return: keys_dict
:raise: IOError
"""
try:
keys_file = open(filepath, 'rb')
keys = {}
for line in keys_file:
key, value =... | nhatbui/LebronCoin | lebroncoin/key_loader.py | Python | mit | 654 |
"""Main entry points for scripts."""
from __future__ import print_function, division
from argparse import ArgumentParser
from collections import OrderedDict
from copy import copy
from datetime import datetime
import glob
import json
import logging
import math
import os
import scipy.stats
import numpy as np
from .ve... | snfactory/cubefit | cubefit/main.py | Python | mit | 26,267 |
# -*- coding: utf-8 -*-
def calc_note(count, value):
qnt = 0
if count >= value:
qnt = int(count) / value
print '%d nota(s) de R$ %d.00' % (qnt, value)
return count - qnt * value
n = float(raw_input())
print 'NOTAS:'
n = calc_note(n, 100)
n = calc_note(n, 50)
n = calc_note(n, 20)
n = calc_no... | vicenteneto/online-judge-solutions | URI/1-Beginner/1021.py | Python | mit | 907 |
import datetime
import time
import boto
import redis
import requests
import random
import zlib
from django.shortcuts import get_object_or_404
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.template.loader import render_to_string
from django.db import IntegrityE... | slava-sh/NewsBlur | apps/reader/views.py | Python | mit | 95,205 |
__author__ = "Guillaume"
__license__ = "MIT"
__copyright__ = "2015, ESRF"
import numpy
from freesas.model import SASModel
class Grid:
"""
This class is used to create a grid which include all the input models
"""
def __init__(self, inputfiles):
"""
:param inputfiles: list of pdb files... | kif/freesas | freesas/average.py | Python | mit | 9,116 |
#!/usr/bin/env python
"""
Project-wide application configuration.
DO NOT STORE SECRETS, PASSWORDS, ETC. IN THIS FILE.
They will be exposed to users. Use environment variables instead.
See get_secrets() below for a fast way to access them.
"""
import os
"""
NAMES
"""
# Project name used for display
PROJECT_NAME = 'q... | 18F/quotable | app_config.py | Python | mit | 1,915 |
import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class Command(BaseCommand):
help = 'Report instructors activity.'
... | swcarpentry/amy | amy/workshops/management/commands/instructors_activity.py | Python | mit | 5,305 |
# 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/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_policy_assignments_operations.py | Python | mit | 38,695 |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 25 16:20:12 2015
@author: Balázs Hidasi
@lastmodified: Loreto Parisi (loretoparisi at gmail dot com)
"""
import sys
import os
import numpy as np
import pandas as pd
import datetime as dt
# To redirect output to file
class Logger(object):
def __init__(self, filename=... | loretoparisi/docker | theano/rsc15/preprocess.py | Python | mit | 3,325 |
from attributes import *
from constants import *
# ------------------------------------------------------------------------------
#
class UnitManager (Attributes) :
"""
UnitManager class -- manages a pool
"""
# --------------------------------------------------------------------------
#
... | JensTimmerman/radical.pilot | docs/architecture/api_draft/unit_manager.py | Python | mit | 3,311 |
import datetime
from django.contrib.contenttypes.models import ContentType
from django.utils import timezone
from .models import Action
def create_action(user, verb, target=None):
now = timezone.now()
last_minute = now - datetime.timedelta(seconds=60)
similar_actions = Action.objects.filter(user_id=user... | EssaAlshammri/django-by-example | bookmarks/bookmarks/actions/utils.py | Python | mit | 679 |
# -*- coding: utf-8 -*-
#
# RedPipe documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 19 13:22:45 2017.
#
# 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
# autogenerated file.
#
# A... | 72squared/redpipe | docs/conf.py | Python | mit | 5,400 |
from src.tools.dictionaries import PostLoadedDict
# Utility class
################################################
class ServerImplementationDict(PostLoadedDict):
def __missing__(self, key):
try:
return super().__missing__(key)
except KeyError:
return NotImplemented
########... | juanchodepisa/sbtk | SBTK_League_Helper/src/interfacing/servers.py | Python | mit | 1,946 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 John Paulett (john -at- paulett.org)
# Copyright (C) 2009, 2011, 2013 David Aguilar (davvid -at- gmail.com)
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""Python libr... | arnavd96/Cinemiezer | myvenv/lib/python3.4/site-packages/music21/ext/jsonpickle/__init__.py | Python | mit | 5,049 |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 09 13:04:53 2015
* If TimerTool.exe is running, kill the process.
* If input parameter is given, start TimerTool and set clock resolution
Starts TimerTool.exe and sets the clock resolution to argv[0] ms
Ex: python set_clock_resolution 0.5
@author: marcus
"""
... | marcus-nystrom/share-gaze | sync_clocks/test_clock_resolution.py | Python | mit | 1,930 |
blocklevel = ["blockquote", "div", "form", "p", "table", "video", "h1", "h2", "h3", "h4", "h5", "h6", "hr", "details", "article", "header", "main"]
def normalizeEnter(src):
#Deletes all user defined for readability reason existing line breaks that are issues for the HTML output
for elem in blocklevel:
while src.fin... | ValorNaram/isl | inputchangers/002.py | Python | mit | 1,044 |
import cairo
from gi.repository import Gtk
from gi.repository import Gdk
from pylsner import plugin
class Window(Gtk.Window):
def __init__(self):
super(Window, self).__init__(skip_pager_hint=True,
skip_taskbar_hint=True,
)
... | mrmrwat/pylsner | pylsner/gui.py | Python | mit | 2,624 |
# Given the list values = [] , write code that fills the list with each set of numbers below.
# a.1 2 3 4 5 6 7 8 9 10
list = []
for i in range(11):
list.append(i)
print(list) | futurepr0n/Books-solutions | Python-For-Everyone-Horstmann/Chapter6-Lists/R6.1A.py | Python | mit | 203 |
"""
Tests for L{monotone}.
"""
from hypothesis import given, strategies as st
import errno
from monotone import get_clock_info, monotonic
from monotone import _api, _bindings
import os
import platform
import pytest
needs_posix = pytest.mark.skipif(
os.name == "posix" and platform.system() == "Darwin",
reas... | mrwsr/monotone | test/test_monotone.py | Python | mit | 7,143 |
"""
http://community.topcoder.com/stat?c=problem_statement&pm=1667
Single Round Match 147 Round 1 - Division II, Level One
"""
class CCipher:
def decode(self, cipherText, shift):
a = ord('A')
decoder = [a + (c - shift if c >= shift else c - shift + 26) for c in range(26)]
plain = [chr(dec... | warmsea/tc-srm | srm147/CCipher.py | Python | mit | 389 |
from hwt.synthesizer.rtlLevel.extract_part_drivers import extract_part_drivers
from hwt.synthesizer.rtlLevel.remove_unconnected_signals import removeUnconnectedSignals
from hwt.synthesizer.rtlLevel.mark_visibility_of_signals_and_check_drivers import markVisibilityOfSignalsAndCheckDrivers
class DummyPlatform():
""... | Nic30/HWToolkit | hwt/synthesizer/dummyPlatform.py | Python | mit | 775 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
RJUST = 12
def format_fans(fans):
return format_line(prefix='fans'.rjust(RJUST), values=fans)
def format_rpms(rpms):
return format_line(prefix='rpms'.rjust(RJUST), values=rpms)
def format_pwms(pwm... | Bengt/AL-FanControl | python/fancontrol/ui/cli_util.py | Python | mit | 2,042 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Package'
db.create_table(u'api_package', (
(u'id', self.gf('django.db.models.fie... | toranb/django-bower-registry | api/migrations/0001_initial.py | Python | mit | 1,703 |
from __future__ import absolute_import
import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from plotly.tests.utils import compare_dict
from plotly.tests.test_optional.optional_utils import run_fig
from plotly.tests.test_optional.test_matplotlylib... | ee-in/python-api | plotly/tests/test_optional/test_matplotlylib/test_annotations.py | Python | mit | 1,342 |
from distutils.core import setup
setup(
# Application name:
name="streaker",
# Version number (initial):
version="0.0.1",
# Application author details:
author="Aldi Alimucaj",
author_email="aldi.alimucaj@gmail.com",
# Packages
packages=["streaker"],
scripts=['bin/streaker'],... | aldialimucaj/Streaker | setup.py | Python | mit | 680 |
from __future__ import absolute_import, division, print_function, unicode_literals
# Statsd client. Loosely based on the version by Steve Ivy <steveivy@gmail.com>
import logging
import random
import socket
import time
from contextlib import contextmanager
log = logging.getLogger(__name__)
class StatsD(object):
... | smarkets/smk_python_sdk | smarkets/statsd.py | Python | mit | 2,824 |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='fcit',
# Versions... | kjchalup/dtit | setup.py | Python | mit | 2,610 |
import pandas as pd
import os
import time
from datetime import datetime
import re
from time import mktime
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import style
style.use("dark_background")
# path = "X:/Backups/intraQuarter" # for Windows with X files :)
# if git clone'ed then use relative path... | PythonProgramming/Support-Vector-Machines---Basics-and-Fundamental-Investing-Project | p10.py | Python | mit | 4,949 |
from __future__ import absolute_import
from .base import WhiteNoise
__version__ = '2.0.3'
__all__ = ['WhiteNoise']
| KnockSoftware/whitenoise | whitenoise/__init__.py | Python | mit | 118 |
import struct
''' Refer to docs for all the exact formats. There are many so check them out before converting things yourself '''
''' If there's a specific offset you want to do things from, use pack_into and unack_into from the docs '''
#Integer to string
i1= 1234
print "Int to string as 8 byte little endian", repr(... | arvinddoraiswamy/LearnPython | 17.py | Python | mit | 867 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# 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 right... | jeremiedecock/tictactoe-py | jdhp/tictactoe/player/greedy.py | Python | mit | 1,951 |
__author__ = 'besta'
class BestaPlayer:
def __init__(self, fichier, player):
self.fichier = fichier
self.grille = self.getFirstGrid()
self.best_hit = 0
self.players = player
def getFirstGrid(self):
"""
Implements function to get the first grid.
:retur... | KeserOner/puissance4 | bestaplayer.py | Python | mit | 9,518 |
# User info wrapper object
import logging
class User(object):
"""
Wrapper object around an entry in users.json. Behaves like a read-only dictionary if
asked, but adds some useful logic to decouple the front end from the JSON structure.
"""
_NAME_KEYS = ["display_name", "real_name"]
_DEFAULT_IM... | hfaran/slack-export-viewer | slackviewer/user.py | Python | mit | 2,188 |
#!/hpf/largeprojects/ccmbio/naumenko/tools/bcbio/anaconda/bin/python
"""
Looks for a specific sample
"""
import re
import sys
import os
import os.path
sample = sys.argv[1]
family,sample_only = sample.split("_")
match = re.match('\d*',family)
if match:
prefix=str(int(match.group(0))/100)
report_path = pref... | naumenko-sa/cre | cre.locate_sample.py | Python | mit | 895 |
# -*- coding: utf-8 -*-
"""
Date: 2/2/2017
Team: Satoshi Nakamoto
@Authors: Alex Levering and Hector Muro
Non-standard dependencies:
* Twython
* NLTK
* Folium
* Geocoder
* psycopg2
TO DO BEFOREHAND:
The following steps are non-automatable and have to be performed manually.
* Have the NLTK vader lexicon locally (nltk... | SatoshiNakamotoGeoscripting/SatoshiNakamotoGeoscripting | Final_assignment/main.py | Python | mit | 2,489 |
#!/usr/bin/python
#coding: utf-8
from __future__ import unicode_literals
import os
import unittest
import xlrd
import msp.schedule_parser as schedule_parser
__author__ = "Andrey Konovalov"
__copyright__ = "Copyright (C) 2014 Andrey Konovalov"
__license__ = "MIT"
__version__ = "0.1"
this_dir, this_filename = os.pat... | xairy/mipt-schedule-parser | msp/test/schedule_tests.py | Python | mit | 8,974 |
import gzip
import glob
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
from scipy.stats import spearmanr
def get_num_lines_gz(filename):
num_lines = 0
with gzip.open(filename, "r") as fp:
for line in fp:
num_lines += 1
return num_lines
def main():
... | vervacity/ggr-project | scripts/data_qc/summarize_chipseq_qc.py | Python | mit | 4,085 |
student_phoneNumber_name = {1: 'a', 3: 'c', 2: 'b'}
def Handler() :
while (1) :
choice = eval(input("Enter :\t 1 - to search student name \n \t 2 - to insert new student record \n \t 0 - to quit\n"))
print(choice)
if (choice == 1) :
if (student_phoneNumber_name) :
phone_number = input("Enter student's p... | ajitghz582/PythonLearning | DAY_1_ASSIGNMENTS/1_name_phone_number.py | Python | mit | 1,070 |
""" Tests for Dynamo3 """
import sys
import unittest
from decimal import Decimal
from pickle import dumps, loads
from urllib.parse import urlparse
from botocore.exceptions import ClientError
from mock import ANY, MagicMock, patch
from dynamo3 import (
Binary,
Dynamizer,
DynamoDBConnection,
DynamoDBEr... | stevearc/dynamo3 | tests/__init__.py | Python | mit | 22,100 |
Alchemy sentiment analysis: fb12d2c55fff36e1e268584e261b6b010b37279f
Africa Is Talking: 676dbd926bbb04fa69ce90ee81d3f5ffee2692aaf80eb5793bd70fe93e77dc2e
| crakama/bc_7_twitment | keys.py | Python | mit | 156 |
#!/usr/bin/env python3
"""
Categorize and analyze user sessions.
Read in ecfs_obfuscated_filtered.gz file, output some fancy results.
"""
from collections import defaultdict
from collections import Counter
import sys
import time
import os
import resource
import json
import fnmatch
from pipes import Pipes
impo... | zdvresearch/fast15-paper-extras | ecfs_user_sessions/src/analyze_user_sessions.py | Python | mit | 7,526 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author Stephan Reith
@date 31.08.2016
This is a simple example to demonstrate how the ROS Spinnaker Interface can be used.
You will also need a ROS Listener and a ROS Talker to send and receive data.
Make sure they communicate over the same ROS topics and std_msgs.... | reiths/ros_spinnaker_interface | examples/example_ros_spinnaker_interface.py | Python | mit | 2,533 |
# -*- coding: utf-8 -*-
""" Resource Import Tools
@copyright: 2011-12 (c) Sahana Software Foundation
@license: MIT
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
... | ashwyn/eden-message_parser | modules/s3/s3import.py | Python | mit | 123,322 |
from __future__ import absolute_import, division, print_function, unicode_literals
import string
import urllib
try:
from urllib.parse import urlparse, urlencode, urljoin, parse_qsl, urlunparse
from urllib.request import urlopen, Request
from urllib.error import HTTPError
except ImportError:
from urlpars... | VulcanTechnologies/oauth2lib | oauth2lib/utils.py | Python | mit | 2,411 |
from otp.ai.AIBaseGlobal import *
import DistributedCCharBaseAI
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM, State
from direct.fsm import State
from direct.task import Task
import random
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
impo... | ksmit799/Toontown-Source | toontown/classicchars/DistributedGoofySpeedwayAI.py | Python | mit | 6,450 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from scrapy.spider import Spider
from scrapy.selector import Selector
from my_settings import name_file, test_mode, difference_days
from datetime import datetime, timedelta
print "Run spider NewenglandFilm"
file_output = open(name_file, 'a')
email_current_sessio... | dcondrey/scrapy-spiders | dist/spiders/newenglandfilm.py | Python | mit | 1,625 |
import base64
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.3, 2.4 fallback.
from django import http, template
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from djang... | isaac-philip/loolu | common/django/contrib/admin/views/decorators.py | Python | mit | 3,535 |
#guimporter.py
import sys
from PySide import QtGui, QtCore, QtWebKit
Signal = QtCore.Signal | lazunin/stclient | guimporter.py | Python | mit | 92 |
# -*- coding: utf-8 -*-
# @Author: karthik
# @Date: 2016-12-10 21:40:07
# @Last Modified by: chandan
# @Last Modified time: 2016-12-11 12:55:27
from models.portfolio import Portfolio
from models.company import Company
from models.position import Position
import tenjin
from tenjin.helpers import *
import wikipedia... | coders-creed/botathon | src/info/fetch_info.py | Python | mit | 2,889 |
#!/usr/bin/python
from typing import List, Optional
"""
16. 3Sum Closest
https://leetcode.com/problems/3sum-closest/
"""
def bsearch(nums, left, right, res, i, j, target):
while left <= right:
middle = (left + right) // 2
candidate = nums[i] + nums[j] + nums[middle]
if res is None or ab... | pisskidney/leetcode | medium/16.py | Python | mit | 1,070 |