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 |
|---|---|---|---|---|---|
import datetime
import json
import logging
from threading import Thread
from time import sleep
import arrow
import sys
from geventwebsocket import WebSocketError
from conf.appconfig import LOG_REQUEST_DEFAULTS
from totemlogs.server import sockets
from totemlogs.services.log import fetch_logs
from totemlogs.util import ... | totem/totem-logs | totemlogs/views/log.py | Python | mit | 3,719 |
#!/usr/bin/python
from _functools import reduce
import copy
from bitcoin.bech32 import bech32decode, BECH32_PREFIXES, bech32encode
from bitcoin.main import *
### Hex to bin converter and vice versa for objects
def json_is_base(obj, base):
if not is_python2 and isinstance(obj, bytes):
return False
... | conio/pybitcointools | bitcoin/transaction.py | Python | mit | 22,333 |
import os
import json
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = os.environ.get('SECRET_KEY', 'tralalalala')
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'... | Mihai925/EduCoding | educoding/settings.py | Python | mit | 5,347 |
import math
import graph
def Bellman_Ford(G, w, start_vertex):
'''
Function for computing shortest paths on directed graphs.
Reports detection of negative cycle if one exists.
Inputs:
[G]: graph.Graph object of graph representation
[w]: weight mapping of edges
[start_vertex]: ... | Sorrop/py-graph-algorithms | bellman_ford.py | Python | mit | 3,010 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class EventProducerDocumentType(Document):
pass
| mhbu50/frappe | frappe/event_streaming/doctype/event_producer_document_type/event_producer_document_type.py | Python | mit | 244 |
import collections
import os
import re
import subprocess
import tempfile
# FileInfo stores all paths for a given media file
FileInfo = collections.namedtuple(
'FileInfo',
[
'origin_path',
'parent_path',
'base_name',
'file_name',
'file_extension',
'file_size_mb',
... | ofreshy/ojo | ojo/models/file_info.py | Python | mit | 5,055 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Randomly pick point on the sphere surface.
#
# References:
# [1] Shpere Poin Picking -- from Wolfram MathWorld
# http://mathworld.wolfram.com/SpherePointPicking.html
# [2] Random Points on a Sphere
# https://www.jasondavies.com/maps/random-points/
#
# Aaron LI
... | liweitianux/atoolbox | rand/sphere.py | Python | mit | 1,333 |
# -*- coding: utf-8 -*-
from django.dispatch import Signal
result_success = Signal(providing_args=['request', 'form'])
result_failure = Signal(providing_args=['request', 'form'])
order_status_changed = Signal(providing_args=['order', 'old_status']) | kmike/django-mailru-money | mailru_money/signals.py | Python | mit | 249 |
import csv
import re
import pickle
import scraper
from models import *
# Copied from StackOverFlow where someone copied it to from Django source
url_check_regex = re.compile(
r'^(?:http|ftp)s?://'
r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|'
r'localhost|'
r'\d{... | TripleSnail/mafia_analyze | src/training_data_manager.py | Python | mit | 2,067 |
# -*- coding: utf8 -*-
class ActionSelection(object):
def __init__(self):
return
@staticmethod
def select_action(probabilities):
raise NotImplementedError()
| arnomoonens/DeepRL | yarll/actionselection/action_selection.py | Python | mit | 187 |
# 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/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py | Python | mit | 5,455 |
# -*- coding: utf-8 -*-
import scrapy
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
from yunqiCrawl.items import YunqiBookListItem, YunqiBookDetailItem
from scrapy.http import Request
class YunqiQqComSpider(CrawlSpider):
name = 'yunqi.qq.com'
allowed_domains = ['... | qiyeboy/SpiderBook | ch17/yunqiCrawl/yunqiCrawl/spiders/yunqi_qq_com.py | Python | mit | 4,065 |
# Given two binary trees, check if the first tree is subtree of the second one.
# A Binary Tree node
class Node:
# Constructor to initialise node
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def store_in_order(root, arr):
if root is None:
... | anubhavshrimal/Data_Structures_Algorithms_In_Python | Tree/BinaryTree/Is_SubTree.py | Python | mit | 1,310 |
# -*- coding: utf-8 -*-
# Copyright © 2015-2016 Juanjo Conti 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 to ... | atiro/nikola | nikola/plugins/task/authors.py | Python | mit | 13,977 |
# coding: utf8
# Copyright 2013-2015 Vincent Jacques <vincent@vincent-jacques.net>
import unittest
import textwrap
from .. import Document, Section, Paragraph, Container
class IndentationTestCase(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
self.doc = Document()
def t... | jacquev6/RecursiveDocument | RecursiveDocument/tests/IndentationTestCase.py | Python | mit | 6,858 |
#!/usr/bin/env python2
import subprocess
import atexit
from math import pi
children = []
def cleanup():
for child in children:
print "Terminating child process"
child.terminate()
atexit.register(cleanup)
def run_c(file_name):
process = subprocess.Popen(["csim", str(file_name)])
children.a... | dawsonjon/Chips-2.0 | examples/example_3.py | Python | mit | 2,724 |
import re
import nltk
from replacers import RegexReplacer
from replacers import AntonymReplacer
neg_replacer=RegexReplacer()
replacer=AntonymReplacer()
from nltk.tokenize import RegexpTokenizer
tokenizer =RegexpTokenizer("[\w']+")
from nltk.stem import WordNetLemmatizer
lemmatizer = WordNetLemmatizer()
from nltk.corpus... | ccphillippi/AFP | afp/sentiment/Sentiment_Classifier.py | Python | mit | 3,063 |
from collections import OrderedDict
expected = [
OrderedDict(
[
(
"content",
[
OrderedDict(
[
("type", "section"),
("id", u"s2-1-1-1"),
... | elifesciences/elife-tools | tests/fixtures/test_body_block_content_render/content_28_expected.py | Python | mit | 13,925 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
SeaIceData
A QGIS plugin
Downloads sea ice concentration data from NSIDC
-------------------
begin : 2014-10-02
copyrigh... | lo-ise/sea_ice_downloader | __init__.py | Python | mit | 1,318 |
import unittest
class OutcomeTest(unittest.TestCase):
def testPass(self):
return
def testFail(self):
self.assertFalse(True)
def testError(self):
raise RuntimeError('Test error!') | gaufung/PythonStandardLibrary | DevelopTool/unittest/unittest_outcomes.py | Python | mit | 215 |
# -*- coding: utf-8 -*-
import base64
from flask import Blueprint, request, Response, abort
from ..db import database
from .models import PageView
from ..config import BEACON, JAVASCRIPT, DOMAIN
# 1 pixel GIF, base64-encoded.
BEACON = base64.b64decode(
b'R0lGODlhAQABAIAAANvf7wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEA... | sunu/webby | webby/pageview/views.py | Python | mit | 820 |
import pytest
import meshio
from . import helpers
test_set = [
helpers.empty_mesh,
helpers.line_mesh,
helpers.tri_mesh,
helpers.tri_mesh_2d,
helpers.quad_mesh,
]
@pytest.mark.parametrize("mesh", test_set)
def test(mesh, tmp_path):
filepath = tmp_path / "out.svg"
meshio.write_points_cell... | nschloe/meshio | tests/test_svg.py | Python | mit | 357 |
class Solution(object):
def countPrimes(self, n):
"""
:type n: int
:rtype: int
"""
if n < 3:
return 0
is_prime = [1 for i in xrange(n)]
is_prime[1] = 0
is_prime[0] = 0
for i in xrange(2, n):
if is_prime[i] == 1:
for ... | xingjian-f/Leetcode-solution | 204. Count Primes.py | Python | mit | 459 |
"""
Support for myStrom switches.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/switch.mystrom/
"""
import logging
import requests
from blumate.components.switch import SwitchDevice
DEFAULT_NAME = 'myStrom Switch'
_LOGGER = logging.getLogger(__name... | bdfoster/blumate | blumate/components/switch/mystrom.py | Python | mit | 3,122 |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HUnitR04b_IsolatedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HUnitR04b_IsolatedLHS
"""
# Flag this instance as compiled now
self.is_compiled = True
sup... | levilucio/SyVOLT | UMLRT2Kiltera_MM/Properties/unit_contracts/HUnitR04b_IsolatedLHS.py | Python | mit | 1,155 |
import math
from ds.vortex.core import baseNode
from ds.vortex.core import plug as plugs
class HalfPiNode(baseNode.BaseNode):
def __init__(self, name):
"""
:param name: str, the name of the node
"""
baseNode.BaseNode.__init__(self, name)
def initialize(self):
... | dsparrow27/vortex | src/ds/vortex/nodes/constants/halfPi.py | Python | mit | 945 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 24 16:01:11 2017
@author: huijian
"""
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def sortedA... | LeetCodeGroup/PythonDescription | 108.ConvertSortedArraytoBinarySearchTree.py | Python | mit | 946 |
n, k, l, c, d, p, nl, np = map(int, input().split())
drink = (k * l) // nl
limes = c * d
salt = p // np
result = min(drink, limes, salt) // n
print(result)
| mathemage/CompetitiveProgramming | codeforces/div2/151/A/A.py | Python | mit | 157 |
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... | liuluheng/levmu | test/client/.ycm_extra_conf.py | Python | mit | 5,966 |
# !/usr/bin/env python
# coding: utf-8
'''
Description:
You have a number of envelopes with widths and heights given as a pair of integers (w, h).
One envelope can fit into another if and only if both the width and height of one envelope is greater than the width and height of the other envelope.
What is t... | Jan-zou/LeetCode | python/BinarySearch/354_russian_doll_envelopes.py | Python | mit | 743 |
#!/usr/bin/env python
from netCDF4 import Dataset
import numpy
from ent_analysis.lib.thermo import SAM
import glob
import ent_analysis.lib.model_param as mc
def makechi(filename):
key = int(filename.split('/')[-1].split('_')[-1].split('.')[0])
print "chi_condensed_profile", key
condensedfile = Dataset('... | vladpopa/ent_analysis | time_profiles/chi_condensed.py | Python | mit | 4,191 |
import example2
import re
def a(var1):
def x():
pass
if var1 > 0:
b()
c()
def b():
c()
def c():
a(0)
x = 10
y = a(x)
x = 5
c()
example2.e(x)
print(40)
b() | paopao74cn/noworkflow | tests/example1.py | Python | mit | 198 |
from flask_restful import Resource
from flask import request
from functools import wraps
from app.modules.handler import require_appkey
import logging, ConfigParser, json, random, string
#Get logger
logger = logging.getLogger(__name__)
def check_auth(username, password):
config = ConfigParser.RawConfigParser()
conf... | videlanicolas/assimilator | app/modules/apikeymgmt.py | Python | mit | 4,530 |
from pythonstory.common.decorators import packet
from pythonstory.common import sendopcodes
from pythonstory.common.packethelpers import maple_time
import time
@packet(sendopcodes.SET_FIELD)
def change_map(builder, destinationid, character, channel, spawnpoint=0):
(builder
.write_int(channel - 1)
.writ... | martolini/pythonstory | pythonstory/channel/player/packets.py | Python | mit | 527 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import six
import tty, sys
import curses, datetime, locale
from decimal import Decimal
import getpass
import electrum
from electrum.util import format_satoshis, set_verb... | dabura667/electrum | gui/text.py | Python | mit | 18,215 |
from setuptools import setup
setup(
name='restpi',
version='0.1',
description='Nifty Library written in Python for controlling Raspberry Pi based devices remotely.',
url='http://github.com/andela-cnnadi/restpi',
author='Chidiebere Nnadi',
author_email='chidiebere.nnadi@gmail.com',
license='... | andela-cnnadi/restpi | setup.py | Python | mit | 587 |
from __future__ import with_statement
import keyword
import itertools
import xmlrpclib
#WORDS = "/usr/share/dict/words"
WORDS = "data_uniqd"
server_url = 'http://127.0.0.1:20738/RPC2'
server = xmlrpclib.Server(server_url)
G = server.ubigraph
def testName (name):
method_nm = '_'.join(name)
if keyword.iskeywo... | hausdorff/python-api-breakin | attack.py | Python | mit | 1,029 |
class Cell:
"""
Cell: represent a single cell on the game board
It saves all data(markers, states) related to a cell
"""
def __init__(self):
self._isMine = False #Cell is a mine or not
self._isRevealed = False #Cell is revealed by player or not
self._isFlagged = False #Cell ... | yqian1991/minesweeper | minesweeper/models.py | Python | mit | 1,256 |
import os
import stat
import unittest
import six
from conans.model.ref import ConanFileReference, PackageReference
from conans.test.utils.tools import NO_SETTINGS_PACKAGE_ID, TestClient
from conans.util.files import load
base_conanfile = '''
from conans import ConanFile
class TestSystemReqs(ConanFile):
name = "... | conan-io/conan | conans/test/integration/system_reqs_test.py | Python | mit | 14,100 |
#!/usr/bin/python3
import sqlite3
from functools import wraps
from flask import Flask, render_template, request, redirect, send_file, Response, jsonify, abort, session
from werkzeug.utils import secure_filename
import variables as var
import util
import math
import os
import os.path
import errno
from typing import Typ... | azlux/botamusique | interface.py | Python | mit | 28,479 |
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault(
'DJANGO_SETTINGS_MODULE', 'feedback_form.tests.settings')
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| bitmazk/django-feedback-form | manage.py | Python | mit | 269 |
"""Implements various algorithms."""
import numpy as _nmp
import tqdm as _tqdm
def gibbs(mdl, **args):
"""A Gibbs sampler."""
n_iters, n_burnin, hide_progress = args['n_iters'], args['n_burnin'], args['hide_progress']
state = _nmp.r_[0, [_nmp.nan] * n_iters]
sums = {_: _nmp.zeros_like(mdl.state[_]) ... | dvav/eQTLseq | eQTLseq/alg.py | Python | mit | 1,196 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "productgallery.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| matachi/product-gallery | manage.py | Python | mit | 257 |
import json
import os
from fabric.api import *
from fabric.contrib import files
from fabric.utils import abort, error
from jinja2 import Environment, FileSystemLoader
from StringIO import StringIO
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
APP_ENV = json.load(open(os.path.join(PROJECT_PATH, 'config','f... | p4r4digm/todo-helper | fabfile.py | Python | mit | 7,078 |
class Wee:
def __init__(self):
self.called = False
def __iter__(self):
return self
def next(self):
print "in next"
if not self.called:
self.called = True
return "dog"
raise StopIteration
for i in Wee():
print i
| ArcherSys/ArcherSys | skulpt/test/run/t185.py | Python | mit | 292 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#avg 110,429166666667 142,303939393939 39,4660202129861 17,303315566334 358,067727272727 145,667575757576 39,0507475838317 18,0599499387257 607,147575757576 146,828787878788 39,4196129733035 17,4218484639878 854,394393939394 146,564696969697 38,... | soylentdeen/Graffity | src/BCI/fibre_tips.py | Python | mit | 10,191 |
# -*- coding: utf-8 -*-
"""Shared code for tests"""
import textwrap
import pytest
@pytest.fixture
def multisample_vcf():
"""Return string with multi-sample VCF"""
return textwrap.dedent(
"""
##fileformat=VCFv4.3
##contig=<ID=20,length=62435964,assembly=B36,md5=f126cdf8a6e0c7f379d618f... | bihealth/vcfpy | tests/conftest.py | Python | mit | 3,487 |
import sys
import asyncio
import time
import os
import json
import websockets
import PureCloudPlatformClientV2
from pprint import pprint
from datetime import date
from PureCloudPlatformClientV2.rest import ApiException
from PureCloudPlatformClientV2.models import response
print("---------------------------------------... | MyPureCloud/developercenter-tutorials | real-time-queue-observation-query/python/index.py | Python | mit | 4,055 |
import bpy
import json
import bmesh
from os import listdir
from os.path import isfile, join
def get_faces_for_material(ob, bm, mat_name):
for slot, _mat in enumerate(ob.data.materials):
if _mat.name.startswith(mat_name):
slot_index = slot
break
else:
#print("material %s ... | MaxReimann/troen-simulator | source/util/texatlaspacker.py | Python | mit | 6,169 |
import logging
from marshmallow import ValidationError
from airy.models import Project, TaskStatus
from airy.exceptions import ProjectError
from airy.database import db
from airy.serializers import ProjectSerializer
logger = logging.getLogger(__name__)
def get(project_id, task_status):
project = db.session.que... | xuhcc/airy | airy/units/project.py | Python | mit | 1,613 |
import pandas as pd
'''
TODO: bunch of functions
each works on a feature's column
does some postprocessing in pandas
returns entire dataframe with updated column
the features get to decide which of the functions here they would like to invoke
'''
# def exampleprocessor(data,**kwargs):
# '''
# @param dat... | dssg/education-college-public | code/modeling/featurepipeline/postprocessors.py | Python | mit | 999 |
from rules.contrib.views import PermissionRequiredMixin
from django.db import transaction
from django.shortcuts import redirect, get_object_or_404
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib import messages
from django.views.generic import (
CreateView,
DetailView,
UpdateV... | letsmeet-click/letsmeet.click | letsmeet/events/views.py | Python | mit | 3,368 |
from django.shortcuts import get_object_or_404
from django.template.defaultfilters import slugify
from rest_framework.exceptions import NotFound
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.generics import (
CreateAPIView,
DestroyAPIView,
ListAP... | kasper190/SPAforum | forum/api/views.py | Python | mit | 2,783 |
#!/usr/bin/python -O
from save_switcher import SaveSwitcher
from utils import *
def main():
try:
save_switcher = SaveSwitcher()
except OSError:
print "Invalid OS"
except IOError:
print "No save file found. Please start VVVVVV ",
print "and run this program a... | kylemsguy/vvvvvv-multisave | cli.py | Python | mit | 4,924 |
# Typically, an Illumina machine writes a RTAComplete.txt file when it has
# finished the sequencing process. However, some instruments may use another
# completed_marker_file, for instance one that indicates that files have
# been transferred.
import re
class InstrumentFactory():
@staticmethod
def get_id(ru... | arteria-project/arteria-runfolder | runfolder/lib/instrument.py | Python | mit | 2,222 |
import datetime
import json
import threading
import uuid
from Interface import projectmgr
from ml import pipeline
def Validate(id, name):
results = {}
status = "Completed"
message = "Completed"
try:
srvjson = json.loads(projectmgr.GetService(name, "ml").servicedata)
model_type = srvjso... | deepakkumar1984/sia-cog | ml/backgroundproc.py | Python | mit | 2,175 |
"""
WSGI config for Security API project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "application.settings")
from djan... | DataIsTheNewBlack/Django-GestionPatrimoine | application/wsgi.py | Python | mit | 490 |
import unittest
from katas.kyu_6.the_shell_game import find_the_ball
class FindTheBallTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(find_the_ball(5, []), 5)
def test_equals_2(self):
self.assertEqual(find_the_ball(0, [(0, 1), (2, 1), (0, 1)]), 2)
| the-zebulan/CodeWars | tests/kyu_6_tests/test_the_shell_game.py | Python | mit | 297 |
import numpy as np
import scipy.interpolate as spi
def interp_map_regular_grid(a, x, y, x_i, y_i, method="linear", debug=False, wrap=True):
"""Interpolates 2d fields from regular grid to another regular grid.
wrap option: pads outer values/coordinates with other side of the array.
Only works with lon/lat... | jbusecke/xarrayutils | xarrayutils/numpy_utils.py | Python | mit | 2,649 |
import jmespath
import demistomock as demisto
from CommonServerPython import *
from JSONFeedApiModule import * # noqa: E402
from typing import Dict
DEFAULT_COUNT = 100
SEARCH_PARAMS = {
'indicator': 'indicator',
'from': 'from',
'until': 'until',
'threat_type': 'threatType',
'malware_family': 'malw... | VirusTotal/content | Packs/FeedIntel471/Integrations/Intel471MalwareIndicator/Intel471MalwareIndicator.py | Python | mit | 6,628 |
#!/usr/bin/env python3
from app import create_app, db, graph, forge
from app.email import send_email
from app.models import Person, Link
from app.faker import fake
from flask_script import Manager, Shell
from flask_migrate import Migrate, MigrateCommand
import os
app = create_app(os.getenv('HISTORIA_CONFIG') or 'defa... | squarenomad/historia | backend/manage.py | Python | mit | 1,531 |
from cffi import FFI
from matplotlib import pyplot as plt
from matplotlib import patches as mpatches
from ctypes import c_double
from math import asin, sqrt, degrees
def analytic_evaluation(var_b, var_e):
"""Analytic function of theta integral."""
return 2.0 * asin(1 / (sqrt(1 + 4 * float(var_b) ** 2... | MircoT/Theoretical-and-Computational-Methods-for-The-Molecular-Sciences | sources/tetaEvaluation_cffi.py | Python | mit | 2,031 |
# coding: utf-8
"""
Salt Edge Account Information API
API Reference for services # noqa: E501
OpenAPI spec version: 5.0.0
Contact: support@saltedge.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagger_cl... | ltowarek/budget-supervisor | third_party/saltedge/test/test_holder_info_api.py | Python | mit | 827 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import datetime
class Migration(migrations.Migration):
dependencies = [
('sponsors', '0019_auto_20160407_2257'),
]
operations = [
migrations.AlterField(
model_name='adver... | davogler/POSTv3 | sponsors/migrations/0020_auto_20160408_1532.py | Python | mit | 468 |
#!/usr/bin/python
import apihelper
list1 = [ 0, 1, 2, 3, 5, 7 ]
print "list1 = %s" % str(list1)
# for item in list1:
while list1:
list1.pop(0)
print "list1 = %s" % str(list1)
print "list1 = %s" % str(list1)
| jtraver/dev | python/list/pop3.py | Python | mit | 218 |
from __future__ import print_function
import time
import numpy
from AppKit import NSBitmapImageRep, NSDeviceRGBColorSpace
colors = ximport("colors")
background( None )
def makeColorlookup( iterations, blackAlpha=255 ):
"""Create a color lookup table"""
#clr1 = colors.rgb(0.6, 0.8, 1.0)
#clr2 = colors.rg... | karstenw/nodebox-pyobjc | examples/New Functions/Example fractal 2.py | Python | mit | 2,211 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2018_08_01/aio/operations/_azure_firewalls_operations.py | Python | mit | 23,273 |
from pycket import config
from pycket import values, values_string
from pycket.base import W_Object, SingletonMeta
from pycket.cont import continuation, label, loop_label
from rpython.rlib import rerased
from rpython.rlib.objectmodel import compute_hash, import_from_mixin, r_dict, specialize
... | krono/pycket | pycket/values_hash.py | Python | mit | 16,296 |
from src.Piloto import Piloto
from src.Escuderia import Escuderia
from src.Circuito import Circuito
from src.CampeonatoMundial import CampeonatoMundial
from datetime import date
class Formula1(object):
"""
Modela una liga de formula 1
:author: Francisco Lopez Baena
:version: 1
"""
campeonatos... | globber-torpes/formula1 | src/Formula1.py | Python | mit | 11,510 |
# -*- encoding: utf-8 -*-
from mock import Mock
import pytest
from itertools import islice
from thefuck import ui
from thefuck.types import CorrectedCommand, SortedCorrectedCommandsSequence
@pytest.fixture
def patch_getch(monkeypatch):
def patch(vals):
def getch():
for val in vals:
... | manashmndl/thefuck | tests/test_ui.py | Python | mit | 3,918 |
import os
__author__ = 'Daniel Nyga'
from .debug import (out, stop, trace, stoptrace, err, warn, ok)
from .tools import (ifnone, ifnot, allnone, allin, allequal, allnot, edict, idxif, first, fst, last, LinearScale,
mapstr, chunks, pairwise, project, isnone, is_not_none, where, where_not, str2bool... | danielnyga/dnutils | src/dnutils/__init__.py | Python | mit | 1,013 |
import lldb
import re
def gdb_escape(string):
result = ""
for curr_char in string:
result += format(ord(curr_char), '02x')
return result
def gdb_unescape(string):
result = ""
pos = 0
while pos < len(string):
result += chr(int(string[pos:pos+2], 16))
pos += 2
return ... | vadimcn/vscode-lldb | debuggee/rr.py | Python | mit | 866 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ALM documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 26 00:04:55 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... | ttadano/ALM | docs/conf.py | Python | mit | 5,945 |
import re
import sys
import gadgets as g
from rop_shellcode import GenerateROPShellcode
"""
This program is to create an ROP program to edit a specific file
"""
"""
These are the commands usually used to call execve on 32-bit systems
They've been tested on libc-2.15 and libc-2.17
Please change only the relative a... | torcellite/Stack-Smashing | src/rop/gen_file_edit_rop.py | Python | mit | 5,669 |
import datetime
from unittest.mock import Mock
from django.contrib.auth.models import Group, User
from django.test import TestCase
import pytest
from freezegun import freeze_time
from dataporten.models import DataportenUser
from dataporten.tests.factories import UserFactory
from ..apps import create_contributor_grou... | afriestad/WikiLinks | semesterpage/tests/test_models.py | Python | mit | 10,451 |
"""
Unit tests for computing density, baroclinic head and the internal pressure
gradient from a temperature field.
Runs MES convergence tests against a non-trivial analytical solution in a
deformed geometry.
NOTE currently only linear equation of state is tested
TODO test full nonlinear equation of state
"""
from the... | tkarna/cofs | test/pressure_grad/test_pg-stack_mes.py | Python | mit | 10,331 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... | EmanueleCannizzaro/scons | test/Progress/TARGET.py | Python | mit | 2,343 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Mustafa
# @Date: 2015-07-10 00:09:37
# @Last Modified by: Mustafa
# @Last Modified time: 2015-07-30 03:21:21
__version__ = '0.0.6' | mstg/scanpkg | scanpkg/__version__.py | Python | mit | 191 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | theiviaxx/Frog | frog/migrations/0001_initial.py | Python | mit | 7,312 |
from __future__ import with_statement
import unittest
from doku.sudoku.cover import DLXSolver
from doku.sudoku.parse import StringParser
class SudokuDLXSolverTestCase(unittest.TestCase):
def test_solver_4(self):
parser = StringParser(4)
known = parser.parse('.3...1....4...3.')
solution = ... | collinwat/doku | tests/sudoku/cover_test.py | Python | mit | 1,686 |
"""
WSGI config for miblog project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... | ossdemura/django-miniblog | src/miblog/wsgi.py | Python | mit | 390 |
from PyQt4 import QtGui,QtCore
import os
#from PyQt4.QtWidgets import QFileDialog
class MyWindow(QtGui.QWidget):
def __init__(self):
super(MyWindow,self).__init__()
self.myButton = QtGui.QPushButton(self)
self.myButton.setObjectName("myButton")
self.myButton.setText("Test... | UpSea/midProjects | BasicOperations/01_01_PyQt4/StandardSaveAndOpen.py | Python | mit | 1,219 |
#!/usr/bin/env python3
import sys
from rpg import app
if __name__ == "__main__":
game = app.Game()
sys.exit(game.run())
| tvarney/txtrpg | __main__.py | Python | mit | 130 |
from nose.tools import *
from nose import with_setup
import flatxml
import os
def _get_path(path):
return "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), path)
def test_parse_file_no_write():
xml_file = _get_path("files/simple.xml")
result = flatxml.parse_file(xml_file)
assert result['xml_a_[... | AbleEng/flatxml | flatxml/test/flatxml_tests.py | Python | mit | 1,002 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-12-17 03:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('interactive', '0032_auto_20161202_1642'),
]
operations = [
migrations.AddFi... | adminq80/Interactive_estimation | game/interactive/migrations/0033_auto_20161217_0342.py | Python | mit | 1,093 |
import sys
import argparse
from cps2zmq.gather.MameServer import MameServer
def parse_args(args):
parser = argparse.ArgumentParser(description='starts a MameServer process')
parser.add_argument('address', type=str,
help='address to bind')
parser.add_argument('port', type=int,
... | goosechooser/cps2-zmq | scripts/mame_server_cli.py | Python | mit | 969 |
from echo_server import Server_class
from echo_client import client_class
import pdb
import sys
from multiprocessing import Process, Value
backlog = 5
server_socket = Server_class(backlog)
#client_socket = client_class()
#server_count = Value('i', 1)
processes = {}
#client_socket = client_class()
#mess... | DryTuna/network_tools | echo_main.py | Python | mit | 611 |
# coding: utf-8
from __future__ import absolute_import
from google.appengine.ext import ndb
import geojson
# import do not work yet (for unit test)
# add them later
from api import fields
import model
import util
import config
from .tag import Taggable#, TagStructure, Tag, TagRelation
from .collection import Collec... | wodore/wodore-gae | main/model/route.py | Python | mit | 5,959 |
# coding: utf-8
from __future__ import unicode_literals, division, print_function
import os
from pymatgen.util.testing import PymatgenTest
from pymatgen.io.abinitio.tasks import *
from pymatgen.io.abinitio.tasks import TaskPolicy
test_dir = os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", 'test_files... | yanikou19/pymatgen | pymatgen/io/abinitio/tests/test_tasks.py | Python | mit | 4,854 |
{
PDBConst.Name: "journey",
PDBConst.Columns: [
{
PDBConst.Name: "ID",
PDBConst.Attributes: ["int", "not null", "auto_increment", "primary key"]
},
{
PDBConst.Name: "Name",
PDBConst.Attributes: ["varchar(255)", "not null"]
},
{
PDBConst.Name: "Datetime... | eddiedb6/ej | db/TableJourney.py | Python | mit | 558 |
import os
import unittest
from Database import Database
from DomainLogEntry import DomainLogEntry
from XenTopOutputParser import XenTopOutputParser
# noinspection PyMethodMayBeStatic
class DatabaseTest(unittest.TestCase):
def test_create_tables(self):
database = Database("/tmp/lala.db")
os.unli... | speedbur/logVmTraffic | test/test_Database.py | Python | mit | 1,829 |
# Largest palindrome product
# ------------------------------------------------- #
# Run through all numbers from 999 to 100. Check if
# any of them are the same backwards. If they are
# set p equal to the number.
# ------------------------------------------------- #
p=0
for i in range(999,100,-2):
for j in range(99... | Drudoo/Euler | 1-10/Euler_4.py | Python | mit | 511 |
import numpy as np
# from smq.utils import set_attr_from_dict
from smq.core import SMQModule
################################################################################
# v2 style
class Task2(SMQModule):
"""Base task, always minimum"""
def __init__(self, conf, ref):
SMQModule.__init__(self, con... | x75/smq | smq/tasks.py | Python | mit | 3,549 |
import asyncio
import logging
from aiobasex import errors, query
from aiobasex.utils import communicate_with_server, string_args_to_bytes
logger = logging.getLogger(__name__)
class BaseXSession:
# A facade for BaseX intercommunication.
_QUERY = b'\x00'
_CREATE = b'\x08'
_ADD = b'\x09'
_REPLACE... | mksh/aiobasex | aiobasex/session.py | Python | mit | 4,270 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import pandas as pd
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.INFO)
COLUMNS = ["crim", "zn", "indus", "nox", "rm", "age",
"dis", "tax", "ptratio", "medv"]
FEATUR... | waynewolf/abucket | from-tf-web/quickstart/6-building-input-functions-with-tf.contrib.learn.py | Python | mit | 1,748 |
__author__ = "Christian Kongsgaard"
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules
# RiBuild Modules
# ---------------------------------------------------------------------------------------------------... | thp44/delphin_6_automation | delphin_6_automation/sampling/archive/input_generation.py | Python | mit | 968 |
import subprocess
from setuptools import setup
from setuptools.command.test import test as TestCommand
class TestSuite(TestCommand):
user_options = []
def initialize_options(self):
TestCommand.initialize_options(self)
def run_tests(self):
subprocess.check_call(['docker-compose', 'build'... | mksh/aiobasex | setup.py | Python | mit | 1,220 |
#!/usr/bin/env python
# encoding: utf-8
"""
@version: ??
@author: muyeby
@contact: bxf_hit@163.com
@site: http://muyeby.github.io
@software: PyCharm
@file: __init__.py
@time: 16-7-28 上午9:55
""" | muyeby/NLP | Seg/Hmmseg/model/__init__.py | Python | mit | 197 |
#!/usr/bin/env python
import time
import HTMLParser
from cmd_exec import cmd_exec
ITER_TIME = 15.0
def get_status(api, truncate):
cur_cmd = ""
while True:
curStatus = api.user_timeline()[0]
curStatus = HTMLParser.HTMLParser().unescape(curStatus.text)
if curStatus != cur_cmd:
cur_cmd = curStatus
... | JakeBurchard/twcmds | twcmds/daemon.py | Python | mit | 545 |
# code for the progress bar
import time
class ProgressBar:
def __init__(self, loop_length):
import time
self.start = time.time()
self.increment_size = 100.0/loop_length
self.curr_count = 0
self.curr_pct = 0
self.overflow = False
print('% complete: ', end=''... | Prooffreader/ipython_simple_progress_bar | ProgressBar.py | Python | mit | 1,578 |