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 __future__ import absolute_import
from __future__ import unicode_literals
from setuptools import setup, find_packages
setup(
name="lamprey",
version="0.1.0a1",
description='Lamprey is a Yesql-inspired wrapper around mysqlclient',
license='MIT',
keywords='lamprey mysql mysqlclient mariadb datab... | quexxon/lamprey | setup.py | Python | mit | 1,225 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import template
register = template.Library()
| datadesk/django-bigbuild | bigbuild/templatetags/bigbuild_tags.py | Python | mit | 104 |
# orm/relationships.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Heuristics related to join conditions as used in
:func:`.relationship`.
Provi... | michaelBenin/sqlalchemy | lib/sqlalchemy/orm/relationships.py | Python | mit | 111,667 |
import unittest
from leap import is_leap_year
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.4.0
class LeapTest(unittest.TestCase):
def test_year_not_divisible_by_4(self):
self.assertIs(is_leap_year(2015), False)
def test_year_divisible_by_4_not_divisible_by_100(self):
... | rootulp/exercism | python/leap/leap_test.py | Python | mit | 730 |
from flask import request, jsonify, make_response, g, Blueprint
from flask_security import login_required, current_user
from api.helper.apiexception import ApiException
from api.helper.permissions import current_user_has_permission_to_change
from api.helper.search import prepare_mongo_query
import time
import pymongo... | Drakulix/knex | backend/api/notifications.py | Python | mit | 7,883 |
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Bitcoin P2P ... | CryptArc/bitcoin | test/functional/test_framework/mininode.py | Python | mit | 23,406 |
class CorsError(Exception):
"""Base exception for all CORS-related errors."""
def __init__(self, status='500 Internal Server Error'):
Exception.__init__(self, status)
self.status = status
class OriginError(CorsError):
"""Invalid request origin."""
def __init__(self, origin):
... | monsur/cors-python | cors/errors.py | Python | mit | 1,329 |
'''
Markov Model for transportation
Ankur Goswami
'''
def load_inputs(datafiles):
inputs = {}
for file in datafiles:
with open(file, 'r') as rf:
for line in rf:
split = line.split('\t', 1)
segnum = split[0]
if segnum in inputs:
... | ankur-gos/PSL-Bipedal | MarkovModel/model.py | Python | mit | 3,405 |
# File name: brapci.py
# Author: Rene F. Gabriel Junior <renefgj@gmail.com>
# Date created: 2018-04-30
# Date last modified: 2018-04-30
# Python Version: 3.5
import sys, string, re, urllib.request, xml.sax
print('#####################')
print('# O A I - P M H #')
print('# v0.1 #')
print('###########... | ReneFGJ/Brapci | py/brapci.py | Python | mit | 1,770 |
# -*- coding: utf-8 -*-
import datetime
from django.db import models
from django.db.models.query_utils import Q
from . import BOARD_KANBAN
class SprintManager(models.Manager):
"""
Manager for sprints
"""
def active(self):
"""
Returns active start <= now () <= end or kanban sprints
... | stxnext/tragile | tragile/sprint/managers.py | Python | mit | 608 |
import csv
f1 = csv.reader(open('restaurants.csv', 'rb'))
writer = csv.writer(open("restaurants_sorted.csv", "wb"))
redupli = set()
for row in f1:
if row[1] not in redupli:
writer.writerow(row)
redupli.add( row[1] ) | anistark/scraper | python/peter.py | Python | mit | 236 |
# -*- coding: utf-8 -*-
from dp_tornado.engine.controller import Controller
class JsLibController(Controller):
def get(self):
self.render('tests/view/static/js_lib/test.html')
def post(self):
self.finish({
'result': True
})
| why2pac/dp-tornado | example/controller/tests/view/static/js_lib/__init__.py | Python | mit | 273 |
import win32con
import sys
from ctypes import *
WNDPROC = WINFUNCTYPE(c_long, c_int, c_uint, c_int, c_int)
class WNDCLASS(Structure):
_fields_ = [('style', c_uint),
('lpfnWndProc', WNDPROC),
('cbClsExtra', c_int),
('cbWndExtra', c_int),
('hInstance',... | ActiveState/code | recipes/Python/208699_Calling_Windows_API_using_ctypes/recipe-208699.py | Python | mit | 4,158 |
import requests
import json
import sys
'''ADD FACES TO CERTAIN PERSON (INCLUDE PERSONID) '''
key = "{Ocp-Apim-Subscription-Key}" #YOUR key. Not gonna give you mine, smartypants
personId = sys.argv[1] #define person whose faces will be added
number_files = int(sys.argv[2]) #define number number of files (faces) to ad... | danielSbastos/face-recognition-scienceFair | add_face.py | Python | mit | 1,989 |
"""
External pillar module to fetch hosts roles information fron Mongodb
Developped for Quanta internal uses
"""
import logging
import collections
try:
import pymongo
HAS_PYMONGO = True
except ImportError:
HAS_PYMONGO = False
__opts__ = {
'mongo.db': 'salt',
'mongo.host': 'salt',
'mongo.pa... | Korrigan/pepperstack | salt_ext_modules/pillar/pepperstack.py | Python | mit | 5,973 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-09-18 14:52
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('workflows', '0026_run_exclude'),
]
operations = [
migrations.AlterModelOpti... | GETLIMS/LIMS-Backend | lims/workflows/migrations/0027_auto_20170918_1452.py | Python | mit | 1,138 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from indico.core.notifications import make_email, send_email
from... | mic4ael/indico | indico/modules/vc/notifications.py | Python | mit | 1,932 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import subprocess
import difflib
import os.path
import filecmp
import shutil
import shlex
import xml.etree.ElementTree as ET
import json
import struct
# from collections.abc import Iterable
from collections import abc
def diff(expected, genera... | vladimirgamalian/fontbm | tests/functional_tests.py | Python | mit | 12,786 |
from setuptools import setup
from pip.req import parse_requirements
import sys, os
sys.path.append("wutu_compiler/")
install_reqs = list(parse_requirements("requirements.txt", session={}))
def version():
import version
return version.get_version()
setup(name="wutu",
version=version(),
descr... | zaibacu/wutu-compiler | setup.py | Python | mit | 731 |
import json
import decimal
import logging
import re
from bs4 import BeautifulSoup
from datetime import datetime
import libcrawler
seat_selection_tag_re = re.compile("^event_seat_selection")
ticket_type_tag_re = re.compile("^classic_ticket_type")
au_re = re.compile("^AU")
booking_re = re.... | vstefan/ozevnts | src/libcrawler/ticketmastercrawler.py | Python | mit | 9,431 |
import discord
from discord.ext import commands
import asyncio
import functools
import html
import logging
import sys
import traceback
import tweepy
import tweepy.asynchronous
from utilities import checks
errors_logger = logging.getLogger("errors")
def setup(bot):
bot.add_cog(Twitter(bot))
class TwitterStream(t... | Harmon758/Harmonbot | Discord/cogs/twitter.py | Python | mit | 11,553 |
#!/usr/bin/env python3
# transpiled with BefunCompile v1.3.0 (c) 2017
def td(a,b):
return ((0)if(b==0)else(a//b))
def tm(a,b):
return ((0)if(b==0)else(a%b))
s=[]
def sp():
global s
if (len(s) == 0):
return 0
return s.pop()
def sa(v):
global s
s.append(v)
def sr():
global s
i... | Mikescher/Project-Euler_Befunge | compiled/Python3/Euler_Problem-086.py | Python | mit | 3,092 |
from __future__ import print_function
import numpy as np
import matplotlib as plt
import cv2
import os
import time
import urllib2
from zipfile import ZipFile
from PIL import Image
import io
np.random.seed(7) # for reproducibility
from keras import backend as K
from keras.models import Model, model_from_json, model_f... | AdrianNunez/deeplearning-activity-recognition | main.py | Python | mit | 11,836 |
# -*- coding: utf-8 -*-
import shelve
def abrir_agenda(ruta):
'''
abre un fichero shelve con ruta <nombre> y devuelve
el enlace al fichero
'''
agenda = shelve.open(ruta)
return agenda
def pedir_datos():
nombre = raw_input('Introduce el nombre: ')
edad = raw_input('Introduce la edad: '... | txtbits/daw-python | colecciones de datos/diccionarios/diccionario.py | Python | mit | 1,443 |
from __future__ import print_function
import tensorflow as tf
import argparse
from antk.core import config
from antk.core import generic_model
from antk.core import loader
from antk.models import tree_model
def return_parser():
parser = argparse.ArgumentParser(description="For testing")
parser.add_argument("da... | aarontuor/antk | test/modelwrappers/tree.py | Python | mit | 3,432 |
"""
:mod:`pyffi.spells.nif` --- NetImmerse/Gamebryo File/Keyframe (.nif/.kf/.kfa) spells
=====================================================================================
.. automodule:: pyffi.spells.nif.check
.. automodule:: pyffi.spells.nif.dump
.. automodule:: pyffi.spells.nif.fix
.. automodule:: pyffi.spells.... | griest024/PokyrimTools | pyffi-develop/pyffi/spells/nif/__init__.py | Python | mit | 5,842 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2018-05-07 09:00
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('consultorio', '0037_auto_20180430_1146'),
... | andresmauro17/mediapp | src/apps/consultorio/migrations/0038_auto_20180507_0900.py | Python | mit | 2,801 |
from yowsup.stacks import YowStackBuilder
from yowsup.layers.auth import AuthError
from BotosanLayer import BotosanLayer
from BotoChatLayer import BotoChatLayer
from yowsup.layers import YowLayerEvent
from yowsup.layers.network import YowNetworkLayer
class BotoSanStack(object):
def __init__(self, credentials, enc... | FredLoh/BotoSan | BotoSanStack.py | Python | mit | 780 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "paratransit.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that ... | NiJeLorg/paratransit_api | paratransit/manage.py | Python | mit | 809 |
from django import template
from wedding import models
register = template.Library()
@register.simple_tag(takes_context=True)
def return_event_from_group(context, event_short_name):
try:
group_id = context.request.session["group_id"]
group = models.Group.objects.get(id=group_id)
except (KeyEr... | joshsimmons/animportantdate | animportantdate/wedding/templatetags/wedding.py | Python | mit | 502 |
from .ecsclient import ECSClient
__all__ = ['ECSClient']
| observerss/koi | koi/ecs/__init__.py | Python | mit | 58 |
from django.core.mail import send_mail
from django.conf import settings
import html2text
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from django.utils.text import normalize_newlines
def remove_newlines(text):
"""
Removes all newline characters from a block... | CompileInc/stormtrooper | stormtrooper/tasker/utils.py | Python | mit | 1,201 |
import modernpylib
# Test int
assert (123).instance_of(int)
assert (123).to_s() == "123"
assert (123).to_f() == 123.0 and (123).to_f().instance_of(float)
# Test float
assert (123.45).instance_of(float)
assert (123.45).to_s() == "123.45"
assert (123.45).to_i() == 123
# Test str
assert "hello".instance_of(str)
assert ... | shinznatkid/modernpy | modernpy/test.py | Python | mit | 839 |
from tori.db.metadata.entity import EntityMetadata
class EntityMetadataHelper(object):
""" Entity Metadata Helper """
@staticmethod
def imprint(cls, collection_name, indexes):
""" Imprint the entity metadata to the class (type)
:param cls: the entity class
:type cls: type
... | shiroyuki/Tori | tori/db/metadata/helper.py | Python | mit | 1,269 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class Role(Document):
def before_rename(self, old, new, merge=False):
if old in ("Guest", "Administrator", "System Ma... | paurosello/frappe | frappe/core/doctype/role/role.py | Python | mit | 1,287 |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^$', 'rha.core.views.home', name='home'),
url(r'^email/', 'rha.core.views.email', name='em... | klebercode/rhape | rha/urls.py | Python | mit | 441 |
"""
TODO: implement Images2Neibs.infer_shape() methods
"""
import numpy
import theano
from theano import Op, Apply
import theano.tensor as T
from theano.gradient import grad_not_implemented
from theano.gradient import grad_undefined
class Images2Neibs(Op):
__props__ = ("mode",)
def __init__(self, mode='v... | nke001/attention-lvcsr | libs/Theano/theano/tensor/nnet/neighbours.py | Python | mit | 24,423 |
import module2
owner = 'module1'
module2.show_owner(owner)
| wonghoifung/learning-python | python_yuanmapouxi/module1.py | Python | mit | 61 |
# from enum import IntEnum
LEVEL_UNKNOWN_DEATH = int(0)
LEVEL_NOS = int(-1)
LEVEL_FINISHED = int(-2)
LEVEL_MAX = 21
LEVELS_PER_ZONE = 4
TOTAL_ZONES = 5
# class LevelSpecial(IntEnum):
# UNKNOWN_DEATH = 0,
# NOS = -1,
# FINISHED = -2
#
#
# class Level(object):
# @staticmethod
# def fromstr(level_st... | incnone/necrobot | necrobot/util/necrodancer/level.py | Python | mit | 3,460 |
#Copyright (c) 2017 Vantiv eCommerce
#
#Permission is hereby granted, free of charge, to any person
#obtaining a copy of this software and associated documentation
#files (the "Software"), to deal in the Software without
#restriction, including without limitation the rights to use,
#copy, modify, merge, publish, distri... | LitleCo/litle-sdk-for-python | litleSdkPythonTest/functional/TestEcheckSale.py | Python | mit | 7,120 |
"""
[ref.href] leetcode.com/problems/valid-parentheses
"
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not.
"
"""
class Solution(object):... | CptDemocracy/Python | Puzzles/leetcode/April-11th-2016/areParensValid.py | Python | mit | 1,032 |
# coding=utf-8
"""
Upload models.
Copyright (C) 2013 Nicolas Valcárcel Scerpella
Authors:
Nicolas Valcárcel Scerpella <nvalcarcel@gmail.com>
"""
# Standard library imports
# Framework imports
from django.db import models
# 3rd party imports
# Local imports
# Create your models here.
FILE_TYPE_CHOICES = (
... | nxvl/critsend_test | upload/models.py | Python | mit | 601 |
# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/operations/_blob_containers_operations.py | Python | mit | 79,622 |
from war import SimpleMindedPlayer, DummiePlayer, play_game
play_game([SimpleMindedPlayer(), DummiePlayer()])
| psattiza/war | games/sm_vs_dummie.py | Python | mit | 110 |
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def mergeKLists(self, lists):
"""
:type lists: List[ListNode]
:rtype: ListNode
"""
from heapq import heapify, heappop... | grehujt/leetcode | 23. Merge k Sorted Lists/solution.py | Python | mit | 1,168 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
import os
from flask import current_app
from flask.ext.failsafe import failsafe
from flask.ext.script import Manager, Server
@failsafe
def create_app():
from talkoohakemisto import Application
return Application()
manager = Manager(create_app)
man... | talkoopaiva/talkoohakemisto-api | manage.py | Python | mit | 794 |
# -*- coding: utf-8 -*-
"""
Gmailbox
~~~~~~~~~~~~~~~~~~
A Vim plugin for displaying your Gmail inbox
within your favourite text editor ;)
:copyright: (c) 2011 by Gianluca Bargelli.
:license: MIT License, see LICENSE for more details.
"""
import vim
import base64
import urllib2
import xml.... | proudlygeek/vim-gmailbox | gmailbox.py | Python | mit | 6,124 |
from mock import patch
from django.contrib.auth.models import User
from django.test import TransactionTestCase
from core.models import Channel, Trigger, Action, Recipe
from channel_clock.tasks import beat
class TasksTest(TransactionTestCase):
fixtures = ['channel_clock/fixtures/initial_data.json']
@patch("co... | daisychainme/daisychain | daisychain/channel_clock/tests/test_tasks.py | Python | mit | 1,157 |
# ro_namespaces.py
"""
Research Object manifest read, write, decode functions
"""
__author__ = "Graham Klyne (GK@ACM.ORG)"
__copyright__ = "Copyright 2011-2013, University of Oxford"
__license__ = "MIT (http://opensource.org/licenses/MIT)"
#import sys
#import os
#import os.path
#import re
#import urlparse... | wf4ever/ro-manager | src/rocommand/ro_namespaces.py | Python | mit | 2,587 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('esauth', '0003_esauth_index'),
]
operations = [
migrations.RemoveField(
model_name='esauth',
name='a... | childe/esproxy | esauth/migrations/0004_auto_20160624_1036.py | Python | mit | 1,429 |
#!/usr/bin/env python
"""
The tweets in our twitter collection have a field called "source". This field describes the application
that was used to create the tweet. Following the examples for using the $group operator, your task is
to modify the 'make-pipeline' function to identify most used applications for creating ... | napjon/moocs_solution | DataWranglingMongoDB/Lesson5/using_group.py | Python | mit | 1,981 |
"""Conversions between some common numeric types (float, np.floatXX) and
universal m/exp notation.
"""
import sys
import math
import numpy as np
import gmpy2 as gmp
mpfr_t = type(gmp.mpfr())
from .integral import bitmask
# reusable definitions
ROUND_NEAREST_EVEN = 1
ROUND_NEAREST_AWAY = 2
ROUND_UP = 3
ROUND_DOWN ... | billzorn/fpunreal | titanfp/titanic/conversion.py | Python | mit | 19,014 |
from . import cli
from . import builtins
| tjfontaine/llmdb | llmdb/__init__.py | Python | mit | 41 |
#!/usr/bin/python
from __future__ import print_function
import os
import glob
import argparse
import numpy as np
import sys
from dicom_tools.make_histo import make_histo
# from dicom_tools.read_files import read_files
from dicom_tools.FileReader import FileReader
import ROOT
from array import array
from dicom_tools.myr... | carlomt/dicom_tools | bin/dicom_make_histo_indir.py | Python | mit | 19,988 |
#!/usr/bin/env python3
# vim:fileencoding=utf-8
class Player:
def __init__(self):
pass
def update(self, elapsed):
pass
def render(self):
pass
# eof
| kdiduk/pytoons | pytoons/player.py | Python | mit | 190 |
import pygame
import math
import copy
from libcocorun import Expr
from game import StateMachine
DIR_RIGHT = 0
DIR_DOWN = 90
DIR_LEFT = 180
DIR_UP = 270
class Animatable:
"""
Provides sprites with an animation framework.
Animatables have different states. Each state has its own animation.
The list of ... | jasontbradshaw/coconut-run | sprites.py | Python | mit | 9,177 |
from django.contrib.auth.models import Group
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
# misc utility methods ---
def blast_email(subject, message_txt, message_html, recipients):
email = EmailMultiAlternatives(
... | ambitioninc/django-narrative | narrative/executor.py | Python | mit | 2,532 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update encrypted deploy password in Travis config file
"""
# pylint: skip-file
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key... | eddie-dunn/swytcher | travis_pypi_setup.py | Python | mit | 3,777 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.modeling
~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for modeling languages.
:copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, bygroups, using, d... | tmm1/pygments.rb | vendor/pygments-main/pygments/lexers/modeling.py | Python | mit | 13,408 |
import random
import re
from .utils import valid_word
class TextGenerator(object):
"""
Pretty simple text generator using
a Markov Chain. The code for this class is
based off of the following gist.
https://gist.github.com/agiliq/131679#file-gistfile1-py
"""
def __init__(self, prefix_leng... | Agrajag-Petunia/existential-romantic-novel | src/textgenerator.py | Python | mit | 2,887 |
from flask import Flask, Response, render_template, request
import json
from subprocess import Popen, PIPE
import os
from tempfile import mkdtemp
from werkzeug import secure_filename
app = Flask(__name__)
@app.route("/")
def index():
return """
Available API endpoints:
GET /containers List al... | DGregan/dt211-cloud-repo | container-server.py | Python | mit | 7,771 |
'''Functions to interact with YouTube playlists'''
import itertools
import requests
from chineurs import authentication, pagination
def insert_video(headers, playlist_id, video_id):
'''Inserts a video in a playlist'''
response = requests.post(
'https://www.googleapis.com/youtube/v3/playlistItems?part... | jroitgrund/chineurs | chineurs/youtube_playlist.py | Python | mit | 1,473 |
#!/usr/bin/env python3
import jinja2
import json
import os
import sys
def amount(currency, num):
return "{}{:.2f}".format(currency, num)
def mkdirp(path):
sofar = ""
bits = path.split("/")[:-1]
for b in bits:
sofar = sofar + b + "/"
try:
os.mkdir(sofar)
except Fi... | barrucadu/lainonlife | frontend/build.py | Python | mit | 2,507 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wordpress_importer', '0002_postimport_article_page'),
]
operations = [
migrations.CreateModel(
name='ImportDownl... | albertoconnor/website | wordpress_importer/migrations/0003_importdownloaderror.py | Python | mit | 696 |
from datetime import date
from django import template
from django.conf import settings
from anires.core.models import Advert
register = template.Library()
# settings value
@register.assignment_tag
def get_google_maps_key():
return getattr(settings, 'GOOGLE_MAPS_KEY', "")
@register.assignment_tag(takes_context... | lhaze/anires_www | anires/core/templatetags/cms_tags.py | Python | mit | 4,712 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
import re
from flexget.utils.titles.parser import TitleParser
from flexget.utils import qualities
from flexget.utils.tools import str_to_int
log = logging.getLo... | qvazzler/Flexget | flexget/utils/titles/movie.py | Python | mit | 4,302 |
from subprocess import call
import os.path
def install_package(git_address, package_name):
BASEDIR = os.path.join(os.path.dirname((os.path.dirname(__file__))))
box_path = os.path.join(BASEDIR, 'box/')
name = package_name.lower()
install_temp_path = os.path.join(box_path, name + "-pkg/")
install_path = os.path.joi... | hsw5138/bis | backend/emerald/package_operation.py | Python | mit | 609 |
from rest_framework import serializers
from .models import Venue
class VenueSerializer(serializers.ModelSerializer):
class Meta:
model = Venue
fields = ('id',
'name',
'place_id',
'unofficial',
'formatted_address',
... | projectjamjar/masonjar | jamjar/jamjar/venues/serializers.py | Python | mit | 569 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
from amara import binderytools
from Backoffice import *
import os
import shutil
xml = binderytools.bind_file('blueprint.xml')
# Move old apoidea to apoidea.old
# Create apoidea
backofficeDirectory = "./apoidea"
if os.path.exists(backofficeDirectory):
shutil.rmtree(back... | washimimizuku/apoidea | genesis/generate.py | Python | mit | 2,782 |
# -*- coding: utf-8 -*-
"""
zx10challenges.views.challenges
===============================
This contains the bulk of the app's code, as it deals with accepting user
submissions and testing them.
:copyright: (C) 2013 Matthew Frazier
:license: MIT/X11 -- see the LICENSE file for details
"""
import os
from flask impor... | leafstorm/0x10challenges | zx10challenges/views/challenges.py | Python | mit | 6,034 |
import flask
import sqlalchemy
from ruddock import search_utils
from ruddock.resources import MemberSearchMode
def search_members_by_name(query, mode=None):
"""
Searches members by name. Returns a list of user_id values that match the
search query. By default, this searches all members. If mode is set to
'cur... | RuddockHouse/RuddockWebsite | ruddock/member_utils.py | Python | mit | 1,639 |
# Copyright (c) 2014 Universidade Federal Fluminense (UFF)
# Copyright (c) 2014 Polytechnic Institute of New York University.
# This file is part of noWorkflow.
# Please, consult the license terms in the LICENSE file.
from __future__ import (absolute_import, print_function,
division, unicode_li... | paopao74cn/noworkflow | capture/noworkflow/now/cmd/cmd_list.py | Python | mit | 1,273 |
# 2014-12-17
# build by qianqians
# deletenote
def deletenote(filestr):
genfilestr = []
count = 0
errornote = ""
for i in range(len(filestr)):
str = filestr[i]
while(1):
if count == 1:
indexafter = str.find("*/")
if indexafter is not -1:
... | yinchunlong/abelkhan-1 | juggle/parser/deletenote.py | Python | mit | 1,136 |
from .base import Exporter
| pirsquare/BigQuery-GCS | bigquery_gcs/__init__.py | Python | mit | 27 |
# mssql/base.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: mssql
:name: Microsoft SQL Server
Auto Increment Behavior
-------... | sauloal/PiCastPy | sqlalchemy/dialects/mssql/base.py | Python | mit | 51,200 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Download and build the data if it does not exist.
import os
import parlai.core.build_data as build_data
from parlai.c... | facebookresearch/ParlAI | parlai/tasks/bot_adversarial_dialogue/build.py | Python | mit | 3,597 |
"""autogenerated by genpy from velodyne_msgs/VelodyneScan.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import genpy
import velodyne_msgs.msg
import std_msgs.msg
class VelodyneScan(genpy.Message):
_md5sum = "50804fc9533a0e579e6322c04ae70566"
_t... | UCSD-E4E/aerial_lidar | catkin_ws/devel/lib/python2.7/dist-packages/velodyne_msgs/msg/_VelodyneScan.py | Python | mit | 8,018 |
import json
import logging
import math
from pyramid.httpexceptions import HTTPBadRequest, HTTPForbidden, HTTPNotFound
from pyramid.response import Response
from pyramid.view import view_config
from community_csdt.src.models.classes import *
class ClassesView(object):
def __init__(self, context, request):
... | electricity345/community.csdt | src/community_csdt/community_csdt/src/views/classes_view.py | Python | mit | 22,906 |
from .gender import genderNS
| willrp/willbuyer | backend/controller/api/store/gender/__init__.py | Python | mit | 29 |
"""
Copyright (c) 2016-2019 billyoyo
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, ... | billy-yoyo/RainbowSixSiege-Python-API | r6sapi/exceptions.py | Python | mit | 1,255 |
# -*- coding: utf-8 -*-
"""
54. 品詞タグ付け
Stanford Core NLPの解析結果XMLを読み込み,単語,レンマ,品詞をタブ区切り形式で出力せよ.
pyton2.7で実行
"""
import xml.etree.ElementTree as ET
import codecs
fname_parsed = 'nlp.txt.xml'
out_file = "output-54.txt"
# xmlファイルの読み込み
tree = ET.parse(fname_parsed)
root = tree.getroot()
output = ""
# word,lemma,POSの値を取得
... | yasutaka/nlp_100 | kiyota/54.py | Python | mit | 722 |
# -*- coding: utf-8 -*-
from lxml.html import tostring, HtmlElement
from scrapy.exceptions import DropItem
from mydm.ai import get_category
from mydm.model import is_exists_article, save_article
def get_article_lang(item):
if any(ord(_) > 19967 for _ in item['title']):
return 'zh'
return 'en'
cl... | alone-walker/BlogSpider | spider/src/mydm/pipelines/store.py | Python | mit | 1,258 |
import sys
def encrypt(k):
plaintext = raw_input('Enter plain text message: ')
cipher = ''
for each in plaintext:
c = (ord(each)+k) % 126
if c < 32:
c+=31
cipher += chr(c)
print 'Your encrypted message is: ' + cipher
def decrypt(k):
cipher = raw_input('Enter encrypted message: ')
plaintex... | ActiveState/code | recipes/Python/578545_Caesar_Ciphers_Program_in_Python/recipe-578545.py | Python | mit | 765 |
'''
Offline tests
'''
from builtins import object
from unittest import TestCase
import mock
from mock import MagicMock
from crawling.distributed_scheduler import DistributedScheduler
from scrapy.http import Request
from scutils.redis_throttled_queue import RedisThrottledQueue
class ThrottleMixin(object):
@mock.p... | istresearch/scrapy-cluster | crawler/tests/test_distributed_scheduler.py | Python | mit | 15,849 |
import scrapy
import urlparse
from gradsearch.items import Professor
class PrincetonEESpider(scrapy.Spider):
name = "princeton_ee"
allowed_domains = ["princeton.edu"]
start_urls = ["http://ee.princeton.edu/people/faculty"]
def cleanup(self, sel):
return sel.xpath('normalize-space(text())').extract()
def parse... | lalpert/gradsearch-scala | scrapers/gradsearch/spiders/princetonee_spider.py | Python | mit | 1,145 |
"""
Description:
Requirements: pySerial, wxPython Phoenix
glossary and of other descriptions:
DMM - digital multimeter
PSU - power supply
SBC - single board computer
INS - general instrument commands
GEN - general sequence instructions
"""
import wx
import theme
import base
# from wx.lib.agw import spinctrl
cl... | swprojects/Serial-Sequence-Creator | dialogs/delay.py | Python | mit | 3,814 |
import time
import os
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("app-path=" + os.path.dirname(os.path.abspath(__file__)))
chrome_options.add_argument("enable-logging")
os.environ["NWJS_LOG_FILE"]=os.path.dirname(os.path.a... | pdx1989/nw.js | test/remoting/nw-custom/rc6-nwjs-log-arg-2/test.py | Python | mit | 771 |
#!/usr/bin/env python
# encoding: utf-8
def run(whatweb, pluginname):
whatweb.recog_from_file(pluginname, "js/common.js", "openWin")
| cflq3/getcms | plugins/fsmcms_cms.py | Python | mit | 139 |
try:
import autocomplete_light.shortcuts as al
except ImportError:
pass
try:
from guardian.shortcuts import assign_perm, remove_perm, get_perms_for_model, get_objects_for_user
except ImportError:
pass
from django.forms import Form, Select, SelectMultiple, DateInput
from django.forms.widgets import Dat... | Pyco7/django-ajax-views | ajaxviews/helpers.py | Python | mit | 6,547 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals, print_function
from six.moves import range
from six import string_types
import frappe, copy, json
from frappe import _, msgprint
from frappe.utils import cint
import frappe.share... | paurosello/frappe | frappe/permissions.py | Python | mit | 18,573 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "art.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| memnonila/art | manage.py | Python | mit | 246 |
#!/ursr/bin/env python
# reusable code for s3 operations
from datetime import datetime, timedelta
from dateutil.tz import tzutc
def shrink_objects_by_time(objects, delta):
"""Takes a list of objects output by boto3.bucket.objects.all and returns a list
of objects newer than the timedelta object passed as delt... | btilton/s3-replicator | utils/s3.py | Python | mit | 877 |
import tensorflow as tf
import numpy as np
# # initialize Interacive session
# Create 100 phony x, y data points in NumPy, y = x * 0.1 + 0.3
x_data = np.random.rand(100).astype(np.float32)
y_data = x_data * 0.1 + 0.3
# Try to find values for W and b that compute y_data = W * x_data + b
# (We know that W should be 0.... | pkumusic/AI | learn_tf/linear_regression.py | Python | mit | 1,126 |
#!/usr/bin/env python
import json
import os
from fabric.colors import red, green, blue, cyan, magenta
data_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../data'))
print "DATA DIR: {0}".format(data_dir)
def readJSONFile(path):
print blue(" > Reading JSON File: {0}".format(path))
with open(path)... | rex/Buffy | scripts/build-scripts.py | Python | mit | 1,194 |
import json
import os
import time
from pathlib import Path
import helium
import pytest
from bmds.bmds3.recommender import RecommenderSettings
from django.conf import settings
from django.core.management import call_command
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import Desire... | shapiromatron/bmds-server | tests/conftest.py | Python | mit | 8,319 |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | zhengwsh/InplusTrader_Linux | InplusTrader/backtestEngine/mod/simple_stock_realtime_trade/__init__.py | Python | mit | 687 |
from polyphony import testbench
from polyphony import unroll as ur
def unroll03_a(x):
sum = 0
for i in ur(range(10), 2):
for j in ur(range(10)):
sum += (i * j * x)
return sum
def unroll03_b(x):
sum = 0
for i in ur(range(10)):
for j in ur(range(10)):
sum +=... | ktok07b6/polyphony | tests/unroll/unroll03.py | Python | mit | 514 |
from django.shortcuts import redirect
from mobler import settings as mobler_settings
from mobler.browscap import browser
import time
import urlparse
import urllib
COOKIE_AGE = mobler_settings.MOBLER_COOKIE_AGE
COOKIE_NAME = mobler_settings.MOBLER_COOKIE_NAME
def build_full_path(request):
''' Build a full path+que... | dmpayton/django-mobler | mobler/middleware.py | Python | mit | 1,640 |
# In test set the environment variable like this:
# DJANGO_SETTINGS_MODULE=qzard.settings.test
from .base import * # NOQA
import logging.config
| triump0870/qzard | src/qzard/settings/test.py | Python | mit | 159 |
"""
Document level related operations.
"""
import datetime
from pytimeline.util import set_value_rec
class DataPoint(object):
"""
Document level abstaction.
"""
def __init__(self, document=None, datetime_key='_dt'):
"""
DataPoint constructor.
:Parameters:
- `docum... | tadasv/pytimeline | pytimeline/datapoint.py | Python | mit | 4,448 |