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 |
|---|---|---|---|---|---|
"""Support for switches through the SmartThings cloud API."""
from typing import Optional, Sequence
from pysmartthings import Attribute, Capability
from homeassistant.components.switch import SwitchEntity
from . import SmartThingsEntity
from .const import DATA_BROKERS, DOMAIN
async def async_setup_entry(hass, conf... | tchellomello/home-assistant | homeassistant/components/smartthings/switch.py | Python | apache-2.0 | 2,231 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from erpnext.stock.stock_balance import update_bin_qty, get_reserved_qty
def execute():
""" Set the Serial Numbers in Sales Invoice I... | ovresko/erpnext | erpnext/patches/v8_0/set_sales_invoice_serial_number_from_delivery_note.py | Python | gpl-3.0 | 1,393 |
# 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 ... | garimakhulbe/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/operations/__init__.py | Python | mit | 588 |
# -*- coding: utf-8 -*-
# __
# /__) _ _ _ _ _/ _
# / ( (- (/ (/ (- _) / _)
# /
"""
Requests HTTP Library
~~~~~~~~~~~~~~~~~~~~~
Requests is an HTTP library, written in Python, for human beings. Basic GET
usage:
>>> import requests
>>> r = requests.get('https://www.python.org')
>>> ... | HiSPARC/station-software | user/python/Lib/site-packages/requests/__init__.py | Python | gpl-3.0 | 3,921 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2006-2009 Zuza Software Foundation
#
# This file is part of the Translate Toolkit.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; e... | bluemini/kuma | vendor/packages/translate/storage/base.py | Python | mpl-2.0 | 28,157 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Justin Santa Barbara
# 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.apach... | shootstar/novatest | nova/api/openstack/compute/contrib/__init__.py | Python | apache-2.0 | 1,608 |
from create_organization import *
from create_office import *
from change_user_roles import *
from delete_organisation import *
from create_facility import *
| devinbalkind/eden | modules/tests/org/__init__.py | Python | mit | 158 |
from __future__ import print_function
#!/usr/bin/env python
#########################################################################
# Reinforcement Learning with NES on the CartPoleEnvironment
#
# Requirements: pylab (for plotting only). If not available, comment the
# last 3 lines out
#############################... | affordablewindurbines/jarvisproject | pybrain/examples/rl/environments/cartpole/cart_nes.py | Python | gpl-3.0 | 1,736 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import stock_picking_to_batch
from . import stock_immediate_transfer
| Aravinthu/odoo | addons/stock_picking_batch/wizard/__init__.py | Python | agpl-3.0 | 176 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint
def execute():
from patches.september_2012 import repost_stock
repost_stock.execute() | saurabh6790/test-med-app | patches/october_2013/set_stock_value_diff_in_sle.py | Python | agpl-3.0 | 307 |
# Copyright 2013 IBM Corp.
| openstack/powervc-driver | nova-powervc/test/nova/driver/virt/powervc/sync/__init__.py | Python | apache-2.0 | 27 |
# exceptions.py
# Copyright (C) 2006, 2007, 2008 Michael Bayer mike_mp@zzzcomputing.com
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""exception classes"""
import traceback, sys, re
from mako import util
class MakoException(Exception):
... | appcelerator/titanium_mobile_tooling | thirdparty/mako/exceptions.py | Python | apache-2.0 | 9,607 |
# Copyright (C) 2013 Hewlett-Packard Development Company, L.P.
#
# 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 appli... | hybrid-storage-dev/cinder-fs-111t-hybrid-cherry | scheduler/weights/chance.py | Python | apache-2.0 | 951 |
# $Id$
#
from inc_cfg import *
test_param = TestParam(
"Callee=optional SRTP, caller=no SRTP",
[
InstanceParam("callee", "--null-audio --use-srtp=1 --srtp-secure=0 --max-calls=1"),
InstanceParam("caller", "--null-audio --max-calls=1")
]
)
| xiejianying/pjsip | tests/pjsua/scripts-call/150_srtp_1_0.py | Python | gpl-2.0 | 254 |
# Test various loop types, some may be implemented/optimized differently
while True:
try:
break
finally:
print('finally 1')
for i in [1, 5, 10]:
try:
continue
finally:
print('finally 2')
for i in range(3):
try:
continue
finally:
print('finally 3... | AriZuu/micropython | tests/basics/try_finally_loops.py | Python | mit | 1,447 |
from __future__ import unicode_literals
from django.conf import settings
def trailing_slash():
if getattr(settings, 'TASTYPIE_ALLOW_MISSING_SLASH', False):
return '/?'
return '/'
| waseem18/oh-mainline | vendor/packages/django-tastypie/tastypie/utils/urls.py | Python | agpl-3.0 | 198 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#... | gptech/ansible | lib/ansible/modules/database/proxysql/proxysql_mysql_users.py | Python | gpl-3.0 | 17,462 |
def main(request, response):
code = """
test(function() {
assert_equals(self.%s, undefined);
});
""" % request.GET["varName"]
return ([("Content-Type", "text/javascript")], code)
| meh/servo | tests/wpt/web-platform-tests/csp/assert_undefined.py | Python | mpl-2.0 | 190 |
# test % operation on big integers
delta = 100000000000000000000000000000012345
for i in range(11):
for j in range(11):
x = delta * (i)# - 5) # TODO reinstate negative number test when % is working with sign correctly
y = delta * (j)# - 5) # TODO reinstate negative number test when % is working wi... | martinribelotta/micropython | tests/basics/int_big_mod.py | Python | mit | 382 |
#!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import copy
import cStringIO
import optparse
import os
import re
import sys
STATEMENT_RE = "\[\[(.*?)\]\]" # [[...]]
EXPR_RE = "... | plxaye/chromium | src/native_client_sdk/src/build_tools/easy_template.py | Python | apache-2.0 | 2,949 |
from . import users_ldap
from . import populate_wizard
| sergiocorato/server-tools | users_ldap_populate/models/__init__.py | Python | agpl-3.0 | 55 |
#!/usr/bin/python
# (c) 2017, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_cdot_svm.py | Python | bsd-3-clause | 8,258 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | andreaso/ansible | lib/ansible/parsing/yaml/loader.py | Python | gpl-3.0 | 1,986 |
# coding=utf-8
#
# Copyright © 2016 Intel Corporation
#
# 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, me... | BPI-SINOVOIP/BPI-Mainline-kernel | linux-5.4/Documentation/sphinx/kerneldoc.py | Python | gpl-2.0 | 6,359 |
"""
ViewSets are essentially just a type of class based view, that doesn't provide
any method handlers, such as `get()`, `post()`, etc... but instead has actions,
such as `list()`, `retrieve()`, `create()`, etc...
Actions are only bound to methods at the point of instantiating the views.
user_list = UserViewSet.a... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/rest_framework/viewsets.py | Python | agpl-3.0 | 5,628 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from . import fixtures
from .runner import run
| shinglyu/servo | tests/wpt/harness/wptrunner/executors/pytestrunner/__init__.py | Python | mpl-2.0 | 247 |
# -*- coding: utf-8 -*-
# (c) 2016, James Cammarata <jimi@sngx.net>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your o... | alxgu/ansible | test/units/parsing/utils/test_jsonify.py | Python | gpl-3.0 | 1,491 |
# -*- coding: utf-8 -*-
import os.path
import posixpath
import re
import urllib
from docutils import nodes
from sphinx import addnodes, util
from sphinx.locale import admonitionlabels
def _parents(node):
while node.parent:
node = node.parent
yield node
class BootstrapTranslator(nodes.NodeVisitor... | exploreodoo/datStruct | odoo/doc/_extensions/odoo/translator.py | Python | gpl-2.0 | 26,718 |
#!/usr/bin/env python
# Turn PubMed XML into TXT files.
#
# Revised version of previous script to extract texts from the PubMed baseline
# distribution XML files. This is otherwise similar to that used to extract
# texts for the BioNLP shared tasks and a number of other similar efforts, but
# it now by default separat... | ninjin/bionlp_st_2011_supporting | tools/extractTIABs.py | Python | isc | 10,250 |
#!/usr/bin/python
# Copyright (c) 2013, Ali Clark <ali@clark.gb.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... | aliclark/irctail | irccolor.py | Python | isc | 13,122 |
import os
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'generic.views.home', name='home'),
url(r'^admin/', include(admin.site.urls)),
url(r'^logout$', 'django.contrib.auth.... | arscariosus/django-mango | mango/mango/urls.py | Python | isc | 947 |
name = 'tools'
version = '0.1.0'
version_cmd = 'echo "0.1.0"'
depends = ['build-essential', 'git', 'vim', 'curl', 'wget', 'tree']
install_script = ''
| cbednarski/ifs-python | ifs/source/tools.py | Python | isc | 150 |
"""
Data filter module.
"""
__docformat__ = "restructuredtext en"
## Copyright (c) 2009 Emmanuel Goossaert
##
## This file is part of npy.
##
## npy is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either v... | fredmorcos/attic | projects/neural_py/datafilter.py | Python | isc | 12,865 |
# coding=utf-8
from .events import *
| chili-epfl/pyrobots | src/robots/events/__init__.py | Python | isc | 37 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sprite
import item
class Item(item.Item):
name = "exit"
can_pick = False
is_exit = True
class Sprite(sprite.Item):
def place(self, pos):
sprite.Item.place(self, pos)
self.depth = self.y*16-10
self.shadow.offs... | cjb/curveship | lib/item/exit.py | Python | isc | 327 |
# -*- 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 'Report'
db.create_table('books_report', (
('id', self.gf('django.db.models.field... | carquois/blobon | blobon/books/migrations/0025_auto__add_report.py | Python | mit | 13,118 |
"""
File : sender.py
Author : ian
Created : 19-04-2018
Last Modified By : ian
Last Modified On : 19-04-2018
***********************************************************************
The MIT License (MIT)
Copyright © 2018 Ian Cooper <ian_hammond_cooper@yahoo.co.uk>
Permission is hereby gra... | BrighterCommand/Brightside | examples/partition_testing/sender.py | Python | mit | 3,248 |
from fluentcheck.assertions_is.base_is import IsBase
class __IsNumbers(IsBase):
@property
def number(self) -> "Is":
self.check.is_number()
return self
@property
def not_number(self) -> "Is":
self.check.is_not_number()
return self
@property
def integer(self) ->... | csparpa/check | fluentcheck/assertions_is/numbers.py | Python | mit | 2,158 |
import os
import nose
import shutil
import yaml
from tastic import reminders, cl_utils
from tastic.utKit import utKit
from fundamentals import tools
su = tools(
arguments={"settingsFile": None},
docString=__doc__,
logLevel="DEBUG",
options_first=False,
projectName="tastic"
)
arguments, settings, l... | thespacedoctor/tastic | tastic/tests/test_reminders.py | Python | mit | 2,037 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-30 23:23
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Create... | danicarrion/pyrestcli | tests/restserver/polls/migrations/0001_initial.py | Python | mit | 1,228 |
#!/usr/bin/env python
from __future__ import division
import matplotlib.pyplot as plt
import matplotlib
from scipy import constants as const
from pylab import *
#
def planck(T,lambda_i,lambda_f,step=10**(-1)):
x ,y = ([] for i in range(2))
for i in arange(lambda_i,lambda_f,step): # i*10**(-9) - correctuin to nm
... | mkocka/galaxytea | integral/domcek/numerical_integration.py | Python | mit | 3,477 |
from . import file
def reader(stream):
return file.BovespaFileReader(stream)
| thypad/bovespa | bovespa/io/__init__.py | Python | mit | 82 |
import pytest
@pytest.fixture(autouse=True)
def my_fix(request):
print('auto')
pytest.set_trace()
@pytest.fixture(params=[1, 2])
def size_k(request):
return request.param
# @pytest.fixture(autouse=True, scope='module')
# def a():
# print('a')
# @pytest.fixture(scope='function', params=[1,2])
# de... | squeaky-pl/japronto | integration_tests/experiments.py | Python | mit | 462 |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
import hashlib
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import ArgumentsReq... | ccxt/ccxt | python/ccxt/therock.py | Python | mit | 54,914 |
# coding: utf-8
from ElementBase import ElementBase
from ElementParameter import ElementParameter
from ElementValue import ElementValue
import photos
class PickImagefromPhotos(ElementBase):
def __init__(self):
self.status = 'running'
self.output = None
self.params = None
self.type = 'Standard'
self.setup_p... | shaun-h/istaflow | elements/PickImagefromPhotos.py | Python | mit | 1,122 |
"""
mark domains/boundaries with dolfin MeshFunctions
"""
from dolfin import *
from importlib import import_module
from math import sqrt, pow
synonymes = {
"fluid":{"bulkfluid","pore"},
"pore": "porecenter",
"sin":"membrane",
"molecule":"dna",
"moleculeb":"dnab",
"solid":{"dna", "membrane"},
... | mitschabaude/nanopores | nanopores/geometries/P_geo/subdomains.py | Python | mit | 5,044 |
import re
from typing import Iterable, Pattern
from ..types import Token
from ..utils import exc_for_token
def tokenize(
formula: str,
word_chars: Pattern = re.compile(r"[\.\_\w]"),
numeric_chars: Pattern = re.compile(r"[0-9\.]"),
whitespace_chars: Pattern = re.compile(r"\s"),
) -> Iterable[Token]:
... | matthewwardrop/formulaic | formulaic/parser/algos/tokenize.py | Python | mit | 6,706 |
"""Learn to estimate functions from examples. (Chapters 18-20)"""
from utils import *
import copy, heapq, math, random
from collections import defaultdict
#______________________________________________________________________________
def rms_error(predictions, targets):
return math.sqrt(ms_error(predictions, ta... | duttondj/decisiontree | learning.py | Python | mit | 27,402 |
import numpy as np
from PolicyEvaluation import policy_eval
def policy_improvement(env, discount_factor=1.0):
"""
Policy Improvement Algorithm. Iteratively evaluates and improves a policy
until an optimal policy is found.
Args:
env: The OpenAI envrionment.
policy_eval_fn: Policy Ev... | davidbrown3/reinforcement-learning | DP/PolicyIteration.py | Python | mit | 1,776 |
import json
import codecs
import os
from collections import Counter
from rnn_music_rep import encode_json_notes, generate_metadata_tsv
from enum import Enum
import numpy as np # type: ignore
try:
import cPickle as pickle # type: ignore
except:
import pickle # type: ignore
class DataLoader(object):
class Mode(En... | alexcoplan/p2proj | src/rnn/data_loader.py | Python | mit | 8,854 |
import requests
import io
import zipfile
import hmac
import base64
from hashlib import sha256
from urllib.parse import urlencode, parse_qsl
from datetime import timedelta, datetime
from django.http import (
HttpResponse, JsonResponse,
HttpResponseRedirect,
HttpResponseNotFound, HttpResponseForbidden
)
from... | CCrypto/ccvpn3 | lambdainst/views.py | Python | mit | 15,497 |
"""139. Word Break
https://leetcode.com/problems/word-break/description/
Given a non-empty string s and a dictionary wordDict containing a list of
non-empty words, determine if s can be segmented into a space-separated
sequence of one or more dictionary words.
Note:
The same word in the dictionary may be reused mult... | isudox/leetcode-solution | python-algorithm/leetcode/problem_139.py | Python | mit | 2,048 |
#!/usr/bin/env python
'''
MSER detector test
'''
# Python 2/3 compatibility
from __future__ import print_function
import numpy as np
import cv2
from tests_common import NewOpenCVTests
class mser_test(NewOpenCVTests):
def test_mser(self):
img = self.get_sample('cv/mser/puzzle.png', 0)
smallImg =... | zzjkf2009/Midterm_Astar | opencv/modules/python/test/test_mser.py | Python | mit | 3,880 |
"""
dj-stripe Custom Field Definitions
"""
import decimal
from django.conf import SettingsReference, settings
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from .settings import djstripe_settings
from .utils import convert_tstamp
def import_jsonfield():
if ... | dj-stripe/dj-stripe | djstripe/fields.py | Python | mit | 7,212 |
from sepa.definitions.general import code_or_proprietary, party
from sepa.definitions.mandate import mandate_group_header, original_message, mandate
# PAIN.010.001.05 - Mandate Amendment Request v5
standard = 'pain.010.001.05'
name = 'mandate_amendment_request'
definition = {
'_namespaces': {
None: 'urn:is... | VerenigingCampusKabel/python-sepa | sepa/messages/pain/pain010.py | Python | mit | 1,179 |
'''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
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, p... | wavycloud/pyboto3 | pyboto3/migrationhubconfig.py | Python | mit | 12,097 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('session', '0006_auto_20160829_1440'),
]
operations = [
migrations.RenameField(
model_name='entry',
o... | PeteTheAutomator/ACServerManager | session/migrations/0007_auto_20160829_1728.py | Python | mit | 391 |
# -*- coding: utf-8 -*-
""" Sahana Eden Disaster Victim Registration Model
@copyright: 2012-2016 (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 ... | flavour/ifrc_qa | modules/s3db/dvr.py | Python | mit | 205,431 |
# The MIT License (MIT)
# Copyright (c) 2015 İlker Kesen
# 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,... | rdeits/meshcat-python | src/meshcat/tests/dummy_websocket_client.py | Python | mit | 2,151 |
import _plotly_utils.basevalidators
class ZminValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="zmin", parent_name="histogram2dcontour", **kwargs):
super(ZminValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram2dcontour/_zmin.py | Python | mit | 471 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 23 10:32:51 2014
"""
import transportdata as transdat
import numpy as np
import logging
logging.basicConfig()
l = logging.getLogger(__name__)
l.setLevel(logging.DEBUG)
class DataObject():
"""
Creates a data object containing x and y data. Data can be processed ... | transportWMI/previewTransportData | lib/DataObject.py | Python | mit | 11,778 |
from app import app
from flask import request, jsonify
from app.models import User
@app.route('/users.json')
def find_users():
query = request.args.get('query', '')
users = []
if query:
users = [{'id': user.google_id, 'name': user.name, 'avatar': user.picture, 'type': 'user'} for user in User.objec... | publicscience/hive | app/routes/api/user.py | Python | mit | 385 |
import sys
import numpy as np, math
import copy
from threading import RLock
import itertools
import matplotlib.pyplot as pp
import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3')
import rospy
import tf
import hrl_lib.util as ut
import hrl_lib.transforms as tr
import hrl_lib.matplotlib_util as mpu
# collect... | tapomayukh/projects_in_python | dynamic_parameters_estimation/dyn_param_est.py | Python | mit | 4,677 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.FaqListView.as_view(), name='faq_list'),
url(r'^(?P<slug>[\w-]+)/$', views.FaqView.as_view(), name='faq_detail'),
]
| onespacemedia/cms-faqs | apps/faqs/urls.py | Python | mit | 212 |
#!/usr/bin/python
#coding:utf-8
__author__ = "XunTu qiqipipioioi@qq.com"
import numpy as np
import scipy.optimize as sop
import scipy.sparse as ssp
import struct
import matplotlib.pyplot as plt
import sys
sys.path.append('../sparseAutoencoder/')
sys.path.append('../softmax/')
import sparseAutoencoder
import softmax
... | qiqipipioioi/UFLDLExercisePython | stackedAutoencoder/stackedAutoencoder.py | Python | mit | 11,411 |
def longest(s):
hashmap = {}
start = 0
maxLen = 0
for i in range(len(s)):
c = s[i]
if len(hashmap) == 2 and c not in hashmap:
charEndsMostLeft = " "
minLast = len(s)
for ch in hashmap.keys():
last = hashmap[ch]
if last <... | quake0day/oj | longestsubstring.py | Python | mit | 1,137 |
import random
import sys
def randomGua(mode='CT'):
if mode == 'TN':
x = [random.randint(1, 1000) for i in range(3)]
outtxt = '%s:%s'%(mode,','.join([str(i) for i in x]))
else:
x = []
for idx in range(6):
item = random.randint(0, 7)
if item in (1, 2, 4):
... | thuleqaid/boost_study | vimsetting/vimfiles/plugin/LiuYao.py | Python | mit | 1,125 |
def main(data):
instructions = data.split("\n")
result = 0
for instruction in instructions:
result += int(instruction)
print result
if __name__ == "__main__":
data = open("puzzle_input", 'r').read()
main(data)
| Shifterovich/AoC | 2018/1/part1.py | Python | mit | 246 |
# 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.modules.attachments import AttachmentFolder
def tes... | mic4ael/indico | indico/modules/attachments/models/folders_test.py | Python | mit | 1,890 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='user',
name='money',
... | zee93/PocketControl | accounts/migrations/0002_user_money.py | Python | mit | 406 |
# -*- coding: utf-8 -*-
#
# python-gearman documentation build configuration file, created by
# sphinx-quickstart on Mon Jul 27 14:30:15 2009.
#
# 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.
... | samuel/python-gearman | docs/conf.py | Python | mit | 6,501 |
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')))
import tohu
| maxalbert/tohu | tests/v4/context.py | Python | mit | 129 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from chalicelib.models import remove_emoji
class TestRemoveEmoji:
def test_normal(self):
assert remove_emoji(":emoji:hoge") == "hoge"
assert remove_emoji(":emoji1::emoji2:hoge") == "hoge"
assert remove_emoji(":emoji1::emoji2... | tadashi-aikawa/tina | tests/test_models.py | Python | mit | 803 |
from collections import deque
from operator import itemgetter as og_itemgetter
from strict_functions import strict_globals
@strict_globals(deque=deque, itemgetter=og_itemgetter)
def itemgetter(iterable, indexes):
''' same functionality as operator.itemgetter except, this one supports
both positive and nega... | CodyKochmann/generators | generators/itemgetter.py | Python | mit | 1,292 |
from jsonrpc import ServiceProxy
access = ServiceProxy("http://127.0.0.1:7875")
pwd = raw_input("Enter wallet passphrase: ")
access.walletpassphrase(pwd, 60)
| DynastyDYN/Dynasty | contrib/wallettools/walletunlock.py | Python | mit | 158 |
NUM_DIGITS = 4
OFFSET = NUM_DIGITS - 1
def get_num_grid(file_name):
#reads file in and turns into list of lists
num_grid = []
with open(file_name) as f:
for line in f:
num_grid.append(line.split())
num_grid = turn_into_numbers(num_grid)
return num_grid
def turn_into_numbers(num_gri... | ctlewitt/Project-Euler | prob11-largest_product_in_a_grid.py | Python | mit | 2,567 |
import shutil
from anarcho import app
from anarcho.storage_workers.base_worker import BaseStorageWorker
import os
class LocalStorageWorker(BaseStorageWorker):
def __init__(self, flask_app):
super(LocalStorageWorker, self).__init__(flask_app)
if 'local_storage_dir' not in self.flask_app.worker_co... | nrudenko/anarcho | anarchoApp/anarcho/storage_workers/local_storage_worker.py | Python | mit | 3,114 |
#!/usr/bin/python
class BaseLanguage:
name = ''
outputExtension = ''
inputFilePath = ''
outputFilePath = ''
def __init__(self):
name = 'base'
# Set output extension
def setOutputExtension(self, outputExtension):
self.outputExtension = outputExtension
# Load the config... | will-iam/python-like | language/base.py | Python | mit | 1,146 |
from sklearn.cross_validation import train_test_split
from sklearn.feature_extraction.text import TfidfTransformer, CountVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline import Pipeline
import pandas as pd
import numpy as np
data = pd.read_csv('tweets.csv')
train, test = train_test_split(... | dan-silver/machine-learning-visualizer | tweet_scraper/words.py | Python | mit | 904 |
from datetime import timedelta
import json
from django.conf import settings
from django.utils import timezone
from django.template import RequestContext
from django.template.loader import render_to_string
from django.views import generic
from django.contrib.admin.views.decorators import staff_member_required
from jsonv... | michaelbrooks/django-twitter-stream | twitter_stream/views.py | Python | mit | 3,462 |
import requests
import psycopg2
from datetime import datetime
# Reads your API key from a file
with open('API_KEY.txt') as inf:
API_KEY = inf.read().strip()
DB_NAME = 'times_tracker'
DB_USER = 'root'
conn = psycopg2.connect("dbname=%s user=%s" % (DB_NAME, DB_USER))
def most_popular_articles(category = 'mostemai... | sbrother/dsla-web-service | scripts/pull_nytimes_data.py | Python | mit | 1,297 |
import numpy as np
def get_classification(sequence_class_prob, k=3):
''' From predicted classes for a sequence of clips corresponfing to a video, it
returns the top k classes and its respective scores
'''
class_prob = np.mean(sequence_class_prob, axis=0)
labels_index = np.argsort(class_prob[1:])[:... | imatge-upc/activitynet-2016-cvprw | src/processing.py | Python | mit | 1,838 |
from typing import Union, Tuple, Sized, Container, Any, TypeVar, Callable
from typing import Iterable, Iterator, Sequence, Dict, Generic, cast
from typing import Optional, List, overload
from dataclasses import dataclass
import numpy
import sys
try:
import cupy
get_array_module = cupy.get_array_module
except ... | explosion/thinc | thinc/types.py | Python | mit | 40,965 |
import sys
sys.path.append('.')
import unittest
import pycoind
class TestBlockchain(unittest.TestCase):
# Block whose hash does not meet the required target
block_1_invalid_target = '01000000000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26fd4e1732e44abdc5199c755a22eaf95b32c27af28396b7066e8e5d... | ricmoo/pycoind | tests/test-blockchain.py | Python | mit | 16,135 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-06-09 17:11
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
import kolibri.core.device.models
class Migration(migrations.Migration):
dependencies = [
("device", "0007_deviceappkey"),
... | mrpau/kolibri | kolibri/core/device/migrations/0008_devicesettings_allow_other_browsers_to_connect.py | Python | mit | 601 |
from django.template import Library
from django.conf import settings
if "django.contrib.sites" in settings.INSTALLED_APPS:
from django.contrib.sites.models import Site
current_domain = lambda: Site.objects.get_current().domain
elif getattr(settings, "SITE_DOMAIN", None):
current_domain = lambda: settings.... | Rootbuzz/Django-Socialtags | templatetags/social_tags.py | Python | mit | 1,440 |
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
pass
@app.route('/register')
def register():
pass
if __name__ == '__main__':
app.run(debug=True)
| ColdSauce/SMIRC | main.py | Python | mit | 188 |
from django.shortcuts import render
from .serializers import MovieSerializer, RatingSerializer
from registration.models import MyUser
import csv
from .models import Rating, Movie, Genre
from rest_framework import status
from csv import reader
from .disable import CsrfExemptSessionAuthentication
from rest_framework.view... | tanql/RecommendApi | rate/views.py | Python | mit | 7,850 |
from htmldom import htmldom
from fuzzywuzzy import process
from html import unescape
import requests
import urllib
MTGSTOCKS_BASE_URL = 'http://www.mtgstocks.com'
QUERY_STRING = '/cards/search?utf8=%E2%9C%93&print%5Bcard%5D={}&button='
SETS_PATH = MTGSTOCKS_BASE_URL + '/sets'
def generate_search_url(name):
format... | jmizzoni/mtg-price-fetcher | src/scraper.py | Python | mit | 2,598 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kylelovesbum.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| TheBiggerGuy/KyleLovesBum.com | manage.py | Python | mit | 255 |
# -*- mode: python; coding: utf-8; -*-
from django.conf import settings
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.models import Site
from django.core.cache import cache
from tagging.models import Tag
from tagging.utils import LOGARITHMIC
from blog.posts.models import Post
from blog.... | jobscry/vz-blog | utils/context_processors.py | Python | mit | 2,267 |
# -- begin menu --
#
# {{{ menu [folder] }}} creates a navigation menu, in the form of an unordered
# list, for the pages in directory [folder].
#
# It titles them by their [title] attribute. So for a Markdown file, writing
# title: [my title]
# at the beginning of the file, and putting the file in directory ... | qema/nanosite | packages/menu/macros.py | Python | mit | 1,071 |
from flask_wtf import FlaskForm
from wtforms import ValidationError
from wtforms.fields import HiddenField, StringField, TextAreaField
from wtforms.validators import InputRequired
from librectf.constants import SUPPORTED_LANGUAGES
class ProblemSubmitForm(FlaskForm):
pid = HiddenField("Problem ID")
flag = Str... | EasyCTF/OpenCTF | server-old/librectf/forms/chals.py | Python | mit | 850 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | onshape-public/onshape-clients | python/onshape_client/oas/models/bt_app_element_reference_info.py | Python | mit | 5,827 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jack River'
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'very secret key'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TE... | ritksm/leech | leech_devel/local_settings.example.py | Python | mit | 862 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Original source: github.com/okfn/bibserver
# Authors:
# markmacgillivray
# Etienne Posthumus (epoz)
# Francois Boulogne <fboulogne at april dot org>
import itertools
import re
import sys
import unicodedata
__all__ = ['string_to_latex', 'latex_to_unicode', 'protect_uppe... | perrette/myref | papers/latexenc.py | Python | mit | 98,547 |
# -*- coding: utf-8 -*-
import re
import sys
import nltk
import string
import tweepy
import numpy as np
from os import path
from PIL import Image
from wordcloud import WordCloud
CONSUMER_KEY = "INSIRA A CONSUMER_KEY CRIADA NA ETAPA ANTERIOR"
CONSUMER_SECRET_KEY = "INSIRA A CONSUMER_SECRET_KEY CRIADA NA ETAPA ANTERIO... | nolram/word_cloud | word_cloud.py | Python | mit | 6,371 |
# -*- coding: utf-8 -*-
import logging
from django.conf import settings
from django.http import HttpResponseNotFound, HttpResponseRedirect
from django.template.response import TemplateResponse
from redirect.models import Redirect
logger = logging.getLogger('umami.redirect')
class RedirectServiceMiddleware:
def... | AIE-Guild/umami | redirect/middleware.py | Python | mit | 1,325 |
import json
from django.conf import settings
from django.contrib.admin.filters import SimpleListFilter
from django.contrib.contenttypes.models import ContentType
from django.urls import reverse
from django.utils.html import format_html, conditional_escape
from event_store.models import Organization, EVENT_REVIEW_CHOI... | MoveOnOrg/eventroller | reviewer/filters.py | Python | mit | 2,657 |
from django.views.generic import TemplateView, View
from dash.access import (df, hostname, ip, issue, mem, numberofcores, w, ps,
whereis, users, boot, loadavg, bandwidth, dnsmasq_leases,
ping, date)
from dash.utils import json_response
class IndexView(TemplateView):
templat... | dongweiming/django-linux-dash | dash/views.py | Python | mit | 1,117 |