code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
"""Contains a Node class which implements an AVL binary search tree.
Each node can be considered a binary search tree and has the usual
methods to insert, delete, and check membership of nodes. By default,
the insert and delete methods will perform self-balancing consistent
with an AVL tree. This behavior can be suppr... | jonathanstallings/data-structures | bst.py | Python | mit | 16,629 |
#
# Copyright 2021 The BigDL Authors.
#
# 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 law or agreed to in ... | intel-analytics/BigDL | scala/ppml/scripts/vfl_split_dataset.py | Python | apache-2.0 | 2,010 |
from __future__ import unicode_literals
import weakref
from datetime import date, datetime
from functools import wraps
from ..compat import string_types, quote_plus, PY2
# parts of URL to be omitted
SKIP_IN_PATH = (None, "", b"", [], ())
def _escape(value):
"""
Escape a single value of a URL string or a que... | cmsdaq/hltd | lib/elasticsearch-py-7.0.0/elasticsearch/client/utils.py | Python | lgpl-3.0 | 2,939 |
infile = open('read_pairs3.dat', 'r')
listtext = '['
for line in infile:
# add line, without newline (line[:-1]), with a trailing comma:
listtext += line[:-1] + ', '
infile.close()
listtext = listtext + ']'
pairs = eval(listtext)
import pprint; pprint.pprint(pairs)
| qilicun/python | python3/src/files/read_pairs3.py | Python | gpl-3.0 | 274 |
import logging
from django.conf import settings
from django.contrib.auth.tokens import default_token_generator
from django.core.mail import EmailMessage, EmailMultiAlternatives
from django.core.urlresolvers import reverse
from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode... | okfish/django-oscar | src/oscar/apps/customer/utils.py | Python | bsd-3-clause | 4,674 |
# -*- coding: utf-8 -*-
"""
This scripts reqires a third party module 'requests'.
You can get it from PyPI, i.e. you can install it using
easy_install or pip.
http://docs.python-requests.org/en/v0.10.4/
Original source code is written by shin1ogawa, which is in Java.
https://gist.github.com/1899391
Materials... | ymotongpoo/restroom | python/requests-oauth2/requests-oauth2.py | Python | apache-2.0 | 4,775 |
# coding: utf-8
from __future__ import unicode_literals
import hashlib
import time
from .common import InfoExtractor
from ..utils import (
int_or_none,
sanitized_Request,
)
def _get_api_key(api_path):
if api_path.endswith('?'):
api_path = api_path[:-1]
api_key = 'fb5f58a820353bd7095de526253c14fd'
a = '{0:}{... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/streamcz.py | Python | gpl-3.0 | 2,880 |
#!/usr/bin/python
#
# Copyright 2008 Dan Smith <dsmith@danplanet.com>
#
# 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, either version 3 of the License, or
# (at your option) any later version.
... | coddingtonbear/d-rats | d_rats/transport.py | Python | gpl-3.0 | 12,492 |
"""
Views used by XQueue certificate generation.
"""
import json
import logging
from django.contrib.auth.models import User
from django.db import transaction
from django.http import Http404, HttpResponse, HttpResponseForbidden
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http impor... | Stanford-Online/edx-platform | lms/djangoapps/certificates/views/xqueue.py | Python | agpl-3.0 | 9,765 |
# -*- coding: utf-8 -*-
from ...objects import *
from ...errors import *
from ...common import get_logger
from ...metadata import Field, FieldList
from ...stores import DataStore
from ...datautil import collapse_record
__all__ = (
"MongoDBStore",
"MongoDBCollection",
)
try:
import pymongo
exc... | indera/bubbles | bubbles/backends/mongo/objects.py | Python | mit | 6,331 |
from .core import merge, merge_with, valmap, keymap, update_in, assoc
| obmarg/toolz | toolz/dicttoolz/__init__.py | Python | bsd-3-clause | 70 |
import os
import cv2
import numpy as np
import math
photo_dir = 'Pola_scaled'
output_dir = 'Pola_blur'
def images_in_dir(photo_dir):
for subdir in os.listdir(photo_dir):
if subdir.startswith('.'):
continue
for photo in os.listdir(os.path.join(photo_dir, subdir)):
if photo.s... | KlubJagiellonski/pola-ai | data/blur.py | Python | bsd-3-clause | 3,799 |
#----------------------------------------------------------------------
# Copyright (c) 2011-2015 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... | ahelsing/geni-ch | plugins/pgch/PGCH.py | Python | mit | 28,128 |
from flask import Flask
from flask import current_app, request
from flask.ext.login import LoginManager
import requests
from models import User
app = Flask(__name__, static_folder=None)
app.url_map.strict_slashes = False
app.config.from_pyfile('config.py')
try:
app.config.from_pyfile('local_config.py')
except IOErro... | romanchyla/adsgut2 | adsgut_service/views.py | Python | mit | 1,747 |
# coding=utf-8
import unittest
from text import grep
from text import string_utils
import text_test
class GrepTest(unittest.TestCase):
def test_grep(self):
log_list = text_test.read_log()
linux_syslog_head = '(\S+\s+\d+)\s+(\d+:\d+:\d+)\s+(\S+)\s+'
group_data = grep.grep... | interhui/py-text | text_test/grep_test.py | Python | apache-2.0 | 1,719 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Guillaume Martinez (lunik@tiwabbit.fr)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import
import pytest
from ansible.modules.source_control.gitlab.gitlab_runner import GitLabRunner
def _... | roadmapper/ansible | test/units/modules/source_control/gitlab/test_gitlab_runner.py | Python | gpl-3.0 | 3,198 |
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class HelloscrapyPipeline(object):
def process_item(self, item, spider):
return item
| orangain/helloscrapy | helloscrapy/pipelines.py | Python | mit | 265 |
#! /usr/bin/env python
# Copyright 2010, 2011 Martin C. Frith
# Read query-genome alignments: write them along with the probability
# that each alignment is not the true mapping of its query. These
# probabilities make the risky assumption that one of the alignments
# reported for each query is correct.
import sys,... | CampagneLaboratory/gobyweb-plugins | resources/LAST_230/last-map-probs.py | Python | lgpl-3.0 | 4,594 |
"""
WSGI config for hotf 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/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS... | tommybobbins/PiThermostat | django/hotf/wsgi.py | Python | gpl-2.0 | 385 |
# -*- coding: utf-8 -*-
import datetime
import hashlib
import json
import os
import stat
import tarfile
from copy import deepcopy
from tempfile import mkdtemp
from django.conf import settings
from django.core import mail
from django.core.files.storage import default_storage as storage
from django.core.management impor... | Jobava/zamboni | mkt/webapps/tests/test_tasks.py | Python | bsd-3-clause | 32,210 |
#*************************************************************************
# This is a Python library for the Adafruit Thermal Printer.
# Pick one up at --> http://www.adafruit.com/products/597
# These printers use TTL serial to communicate, 2 pins are required.
# IMPORTANT: On 3.3V systems (e.g. Raspberry Pi), use a 1... | commonslabgr/donation-box-pi | donation-box/resources/Adafruit_Thermal.py | Python | gpl-3.0 | 16,563 |
# Copyright 2018 Datawire. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | datawire/ambassador | python/ambassador/envoy/v2/v2route.py | Python | apache-2.0 | 26,951 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('clowder_account', '0004_auto_20150729_0019'),
]
operations = [
migrations.AddField(
model_name='company',
... | keithhackbarth/clowder_server | clowder_account/migrations/0005_company_name.py | Python | agpl-3.0 | 419 |
"""
Starts a service to scan in intervals for new devices.
Will emit EVENT_PLATFORM_DISCOVERED whenever a new service has been discovered.
Knows which components handle certain types, will make sure they are
loaded before the EVENT_PLATFORM_DISCOVERED is fired.
"""
import logging
import threading
from blumate import... | bdfoster/blumate | blumate/components/discovery.py | Python | mit | 4,559 |
# Copyright (c) 2015 Clinton Knight All rights reserved.
# Copyright (c) 2015 Tom Barron 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... | scality/manila | manila/tests/share/drivers/netapp/dataontap/fakes.py | Python | apache-2.0 | 14,219 |
from radtrack.util.unitConversion import convertUnitsString, \
convertUnitsStringToNumber, \
convertUnitsNumberToString, \
convertUnitsNumber
from radtrack.util.RbMath import roundSigFig
from math ... | radiasoft/radtrack | tests/util/unitConversion_test.py | Python | apache-2.0 | 1,578 |
import os, sys
import datetime,time
#join multiple ascii files
#for file in range(1,len(sys.argv-1)):
output_file=sys.argv[1]
with open(output_file, 'w') as outfile:
for fname in sys.argv[2:]:
with open(fname) as infile:
for line in infile:
line = line.replace("\r","")
line = line.replace("\n","")
... | billgertz/FAB-UI | fabui/python/join.py | Python | gpl-2.0 | 558 |
import numpy as np
import matplotlib.pyplot as plt
def graph(formula, x_range):
x = np.array(x_range)
y = formula(x) # <- note now we're calling the function 'formula' with x
plt.plot(x, y)
plt.show()
def my_formula(x):
return x**3+2*x-4
graph(my_formula, range(0, 11)) | triump0870/hackerearth | plot/eval.py | Python | gpl-2.0 | 305 |
import pytest
import importlib
from utils.migration import search, MigratioNotFound
class mockModule:
def __init__(self, revision: str, down_revisions: list):
self.revision = revision
self.down_revisions = down_revisions
def mock_import_module_loop(module_path: str):
modules = {
'migratio... | wy65701436/harbor | make/photon/prepare/tests/migrations/utils_test.py | Python | apache-2.0 | 2,914 |
import parmed.unit as units
from intermol.decorators import accepts_compatible_units
from intermol.forces.abstract_nonbonded_type import AbstractNonbondedType
class BuckinghamNonbondedType(AbstractNonbondedType):
__slots__ = ['a', 'b', 'C6', 'type']
@accepts_compatible_units(None, None,
... | shirtsgroup/InterMol | intermol/forces/buckingham_nonbonded_type.py | Python | mit | 1,549 |
from contextlib import contextmanager
import datetime
import faulthandler
import os
import re
import signal
import subprocess
import sys
from test import support, script_helper
from test.script_helper import assert_python_ok
import tempfile
import unittest
try:
import threading
HAVE_THREADS = True
except Impor... | PennartLoettring/Poettrix | rootfs/usr/lib/python3.4/test/test_faulthandler.py | Python | gpl-2.0 | 19,443 |
class PyDelphinException(Exception):
"""The base class for pyDelphin exceptions."""
def __init__(self, *args, **kwargs):
"""Create a new PyDelphinException."""
return super(PyDelphinException, self).__init__(*args, **kwargs)
class PyDelphinWarning(Warning):
"""The base class for pyDelphin ... | matichorvat/pydelphin | delphin/exceptions.py | Python | mit | 2,294 |
"""This demo illustrates the built-in mesh types."""
# Copyright (C) 2008 Garth N. Wells
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of ... | MelanieBittl/dolfin | demo/undocumented/built-in/python/demo_built-in.py | Python | gpl-3.0 | 1,924 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 Cubic ERP - Teradata SAC (<http://cubicerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the... | OpusVL/odoo | addons/l10n_cl/__openerp__.py | Python | agpl-3.0 | 1,693 |
# Copyright 2008-2009 by Peter Cock. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
#
# This module is for reading and writing PIR or NBRF format files as
# SeqRecord objects. ... | BlogomaticProject/Blogomatic | opt/blog-o-matic/usr/lib/python/Bio/SeqIO/PirIO.py | Python | gpl-2.0 | 7,113 |
### QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
### Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
###
### 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 ... | AlexCatarino/Lean | Algorithm.Python/TwoLegCurrencyConversionRegressionAlgorithm.py | Python | apache-2.0 | 2,913 |
import numpy as np
import theano
import theano.tensor as T
def floatX(arr):
"""
Shortcut to turn a numpy array into an array with the
correct dtype for Theano.
"""
return arr.astype(theano.config.floatX)
def shared_empty(dim=2, dtype=None):
"""
Shortcut to create an empty Theano shared ... | DataFighter/Lasagne-tutorial | lasagne/utils.py | Python | mit | 3,756 |
__source__ = 'https://leetcode.com/problems/single-number-iii/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/single-number-iii.py
# Time: O(n)
# Space: O(1)
#
# Description: Leetcode # 260. Single Number III
#
# Given an array of numbers nums, in which exactly two
# elements appear only once and all the o... | JulyKikuAkita/PythonPrac | cs15211/SingleNumberIII.py | Python | apache-2.0 | 3,636 |
import os
import datetime
import sys
import subprocess
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)
appdir = os.path.dirname(os.path.dirname(__file__))
if not appdir:
appdir = os.getcwd();
else:
print >> sys.stderr, "App directory:", appdir
log = os.path.join(appdir,"... | dynaTrace/Dynatrace-Splunk-Application | src/APM_dynatrace/bin/cleanFlume.py | Python | bsd-3-clause | 663 |
from ajenti.api import *
from ajenti.ui import *
from ajenti.plugmgr import PluginLoader, RepositoryManager
class PluginManager(CategoryPlugin, URLHandler):
text = 'Plugins'
icon = '/dl/plugins/icon.png'
folder = 'bottom'
def on_session_start(self):
self._mgr = RepositoryManager(self.app.conf... | digideskio/ajenti | ajenti/plugins/plugins/main.py | Python | lgpl-3.0 | 4,512 |
from collections import defaultdict
import json, subprocess, sys, re, magic, csv, os, logging
#STRAWMAN FIXME
#THIS WOULD BE A PROGRAMMATICALLY INGESTED JSON ON MODULE LOAD IN REAL LIFE
#DONT HATE THIS PART
#programs = defaultdict(dict)
#programs['bwa']={"default":"/opt/common/CentOS_6/bwa/bwa-0.7.12/bwa",
# ... | alexpenson/cmo | cmo/util.py | Python | gpl-2.0 | 9,301 |
from _collections_abc import *
from _collections_abc import __all__
| grupoprog3/proyecto_final | proyecto/flask/Lib/collections/abc.py | Python | apache-2.0 | 70 |
'''---------------------------------------------------------------------------------------
DJANGO MAP CLUSTERING
- kmeans
- grid
VERSION: 0.1
AUTHOR: biodiv
LICENSE: GPL
---------------------------------------------------------------------------------------'''
'''---------------------------------------------------... | biodiv/anycluster | build/lib/anycluster/MapClusterer.py | Python | mit | 32,869 |
import sys
from bot import Command, categories
class ShutdownCmd(Command):
def __init__(self, bot):
super().__init__(bot)
self.name = 'shutdown'
self.help = '$[shutdown-help]'
self.bot_owner_only = True
self.category = categories.SETTINGS
async def handle(self, cmd):
... | jvicu2001/alexis-bot | bot/modules/shutdown.py | Python | mit | 419 |
# Support Python 2 and 3
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import print_function
"""
Taken from: https://github.com/crm416/point-location/blob/master/geo/shapes.py
and: http://www.toptal.com/python/computational-geometry-in-python-from-theory-to-imple... | sonofeft/ODPSlides | odpslides/segments.py | Python | lgpl-3.0 | 2,670 |
#!/usr/bin/env python
import sys
import rospy
from crazyflie_rospy.srv import AddCrazyflie, AddCrazyflieRequest, AddCrazyflieResponse
def main(args):
rospy.init_node('crazyflie_add')
uri = rospy.get_param("~uri")
tf_prefix = rospy.get_param("~tf_prefix")
roll_trim = rospy.get_param("~roll_trim", 0.0)... | potix2/crazyflie_rospy | scripts/crazyflie_add.py | Python | mit | 1,867 |
from __future__ import unicode_literals
from .common import InfoExtractor
from .internetvideoarchive import InternetVideoArchiveIE
class RottenTomatoesIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rottentomatoes\.com/m/[^/]+/trailers/(?P<id>\d+)'
_TEST = {
'url': 'http://www.rottentomatoes.co... | jbuchbinder/youtube-dl | youtube_dl/extractor/rottentomatoes.py | Python | unlicense | 1,280 |
# Under MIT License, see LICENSE.txt
from ai.executors.executor import Executor
class PlayExecutor(Executor):
def __init__(self, p_world_state):
super().__init__(p_world_state)
def exec(self):
self._send_books()
self._execute_strategy()
self._send_robots_status()
def _... | AlexandraMercier/StrategyIA | ai/executors/play_executor.py | Python | mit | 1,681 |
class EvalStringsToASTsMixin(object):
def eval_to_ast(self, e, n, extra_constraints=(), exact=None):
if type(e) is String:
return [StringV(v, ) for v in self.eval(e, n, extra_constraints=extra_constraints, exact=exact) ]
return super(EvalStringsToASTsMixin, self).eval_to_ast(e, n, extra... | angr/claripy | claripy/frontend_mixins/eval_string_to_ast_mixin.py | Python | bsd-2-clause | 396 |
# -*- coding: utf-8 -*-
"""
flask.jsonimpl
~~~~~~~~~~~~~~
Implementation helpers for the JSON support in Flask.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import io
import uuid
from datetime import date
from .globals import current_app, request
from ._... | zxjzxj9/FlaskBoard | web/lib/python2.7/site-packages/flask/json.py | Python | apache-2.0 | 9,261 |
#!/usr/bin/python3
import requests
import unicodecsv as csv
from bs4 import BeautifulSoup
with open("steam_data.csv", 'wb') as f:
writer = csv.writer(f, dialect='excel')
writer.writerow(["UserID", "SteamID", "Game Title", "AppID", "Recommended?", "Review", "Date Posted", "Hours Played"])
# getting userIDs fro... | jamesslomka/steam-reviews | steam-reviews.py | Python | mit | 4,696 |
# pylint: disable-msg=W0614,W0401,W0611,W0622
# flake8: noqa
__docformat__ = 'restructuredtext'
# Let users know if they're missing any of our hard dependencies
hard_dependencies = ("numpy", "pytz", "dateutil")
missing_dependencies = []
for dependency in hard_dependencies:
try:
__import__(dependency)
... | GuessWhoSamFoo/pandas | pandas/__init__.py | Python | bsd-3-clause | 3,973 |
# Author: Hunter Baines <0x68@protonmail.com>
# Copyright: (C) 2017 Hunter Baines
# License: GNU GPL version 3
"""A class for defining errors and a function for printing error messages.
"""
import sys
import textwrap
class Error(object):
"""An error IDed by an int flag and a string description.
Parameters
... | HunterBaines/sudb | sudb/error.py | Python | gpl-3.0 | 2,997 |
import torch
import torchvision.models as models
from matplotlib import pyplot as plt
def plot_kernels(tensor, num_cols=6):
if not tensor.ndim==4:
raise Exception("assumes a 4D tensor")
if not tensor.shape[-1]==3:
raise Exception("last dim needs to be 3 to plot")
num_kernels = tensor.shape[... | lakehanne/ensenso | ensenso_detect/src/ununsed/vgg_viewer.py | Python | mit | 887 |
# -*- mode: python; coding: utf-8 -*-
# Copyright 2017 the HERA Collaboration
# Licensed under the BSD License.
"""Integration with the HERA on-site monitor-and-control (M&C) system.
This module is imported even if M&C reporting is disabled. If that's the case,
the various calls are all no-ops, as tested by seeing if... | HERA-Team/librarian | librarian_server/mc_integration.py | Python | bsd-2-clause | 12,532 |
"""
Support for the Fitbit API.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.fitbit/
"""
import os
import json
import logging
import datetime
import time
from homeassistant.const import HTTP_OK
from homeassistant.util import Throttle
from homea... | Zyell/home-assistant | homeassistant/components/sensor/fitbit.py | Python | mit | 14,305 |
# Copyright (c) 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | beagles/neutron_hacking | neutron/plugins/ml2/rpc.py | Python | apache-2.0 | 9,582 |
#-*-coding:utf-8-*-
import time
import connection
from scrapy.dupefilter import BaseDupeFilter
from scrapy.utils.request import request_fingerprint
class RFPDupeFilter(BaseDupeFilter):
"""基于redis的request去重过滤器"""
def __init__(self, server, key):
"""初始化 duplication filter
Parameters
... | younghz/sr-chn | scrapy_redis/dupefilter.py | Python | bsd-3-clause | 1,727 |
# Copyright (c) 2016 Universidade Federal Fluminense (UFF)
# Copyright (c) 2016 Polytechnic Institute of New York University.
# This file is part of noWorkflow.
# Please, consult the license terms in the LICENSE file.
"""'now demo' command"""
from __future__ import (absolute_import, print_function,
... | gems-uff/noworkflow | capture/noworkflow/now/cmd/cmd_demo.py | Python | mit | 2,330 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2015 Ben Kurtovic <ben.kurtovic@gmail.com>
#
# 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, includ... | earwig/earwigbot | earwigbot/managers.py | Python | mit | 12,238 |
"""@author Sebastien E. Bourban and Michael S. Turnbull
"""
"""@note ... this work is based on a collaborative effort between
.________. ,--.
| | . ( (
|,-. / HR Wallingford E... | ArteliaTelemac/PostTelemac | PostTelemac/meshlayerparsers/libs_telemac/parsers/parserJanet.py | Python | gpl-3.0 | 6,213 |
import mpsolve as mps
from time import time
from sys import argv
#
if 'M' not in locals():
if len(argv) < 2:
M = 20
else:
M = int(argv[1])
phi = [1]
for m in range(M):
phi0 = list(phi)
phi = [0] + phi0
phi[:m+1] = [x - (m + 1)*y for x, y in zip(phi, phi0)]
del phi0
ctx = mps.Context... | robol/MPSolve | examples/python/wilkinson.py | Python | gpl-3.0 | 1,198 |
"""
GAVIP Example AVIS: Data Sharing AVI
These URLs are used by the AVI web-interface.
"""
from django.conf.urls import include, patterns, url
from rest_framework.urlpatterns import format_suffix_patterns
from plugins.urls import job_list_urls
from avi import views, views_api
api_urls = [
# API definitions
ur... | fionnoh/example-avi-aladin-lite | urls.py | Python | lgpl-3.0 | 1,838 |
import numpy as np
import copy as cp
from move import Move
from globalconsts import \
EMPTY, RED, BLACK, BKING, RKING, \
FORWARD_LEFT, FORWARD_RIGHT, BACKWARD_LEFT, BACKWARD_RIGHT, \
WIN, CONTINUE, LOSE, TIE
#http://www.learnpython.org/en/Multiple_Function_Arguments
class Board(object):
'''A class to r... | zlalvani/checkers-learner | board.py | Python | mit | 10,906 |
'''Slack service
Reference:
https://www.fullstackpython.com/blog/build-first-slack-bot-python.html
'''
import time
import config
from clients import GPIOClient
from slackclient import SlackClient
# starterbot's ID as an environment variable
BOT_ID = config.get_value('bot_id')
# constants
AT_BOT = "<@" + BO... | chasingbob/slack-home-automation | slack_service.py | Python | mit | 2,033 |
from sympy.core import S, Add
from sympy.assumptions import Q, ask
from sympy.logic.boolalg import fuzzy_not
def refine(expr, assumptions=True):
"""
Simplify an expression using assumptions.
Gives the form of expr that would be obtained if symbols
in it were replaced by explicit numerical expressions ... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/sympy/assumptions/refine.py | Python | agpl-3.0 | 5,023 |
"""
a2qt Qt for Python wrapper.
"""
import a2qt
if a2qt.QT_VERSION == 6:
from PySide6.QtGui import *
else:
from PySide2.QtGui import (
QAbstractTextDocumentLayout, QAccessible,
QAccessibleEditableTextInterface, QAccessibleEvent, QAccessibleInterface,
QAccessibleObject, QAccessibleState... | ewerybody/a2 | ui/a2qt/QtGui.py | Python | gpl-3.0 | 3,274 |
from backend import app
if __name__ == '__main__':
app.run('0.0.0.0',port=8080, threaded=True, debug=True)
| zpurcey/bestbuy-demo | runbackend.py | Python | mit | 112 |
import pytest
import os
import mock
import json
from copy import deepcopy
from paramiko import AuthenticationException
from paramiko.ssh_exception import NoValidConnectionsError
from aeon_ztp.bin import opx_bootstrap
from aeon.opx.device import Device
args = {
'target': '1.1.1.1',
'server': '2.2.2.2',
'to... | Apstra/aeon-ztps | tests/test_opx_bootstrap.py | Python | apache-2.0 | 9,694 |
# -*- 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 'URL'
db.create_table('seo_url', (
('id', self.gf('django.db.models.fields.AutoFi... | bashu/django-easy-seo | seo/south_migrations/0006_auto__add_url__add_unique_url_site_url.py | Python | gpl-3.0 | 3,240 |
"""
Django settings for coderbounty project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
import os
import dj_database_url
import sys
from django.http import Ht... | CoderBounty/coderbounty | coderbounty/settings.py | Python | agpl-3.0 | 8,293 |
#!/usr/bin/env python
"""models.py
Udacity conference server-side Python App Engine data & ProtoRPC models
$Id: models.py,v 1.1 2014/05/24 22:01:10 wesc Exp $
created/forked from conferences.py by wesc on 2014 may 24
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
import httplib
import endpoints
from protor... | gurlinthewurld/conference | ConferenceCentral_Complete/models.py | Python | gpl-3.0 | 7,687 |
import clingo
import sys
def inject_one(val):
return clingo.create_num(val.num() + val.num())
def inject_two(val):
return [val, clingo.create_num(val.num() + val.num())]
def on_model(m):
print m
c = clingo.Control(sys.argv)
c.add("base", [], "#external c. a :- c. a :- not b. b :- not a. r(@inject_one(2)... | potassco/clingo | scratch/pyclingo/main.py | Python | mit | 2,029 |
import wx
def OnTaskBarRight(event):
app.ExitMainLoop()
#setup app
app= wx.PySimpleApp()
#setup icon object
icon = wx.Icon(r'C:\Users\QuakeZ\Documents\GitHub\MusicCloud\Crawler\Crawler-Src\icon-120.png', wx.BITMAP_TYPE_ANY)
#setup taskbar icon
tbicon = wx.TaskBarIcon()
tbicon.SetIcon(icon, "I am an Icon... | hanvo/MusicCloud | Crawler/Test Scripts/IconTesting.py | Python | bsd-3-clause | 412 |
# -*- coding: utf-8 -*-
'''
CPX, Compare with X Test
'''
import unittest
from nesasm.tests import MetaInstructionCase
from six import add_metaclass
@add_metaclass(MetaInstructionCase)
class CpxImmTest(unittest.TestCase):
asm = 'CPX #$10'
lex = [('T_INSTRUCTION', 'CPX'), ('T_HEX_NUMBER', '#$10')]
syn = [... | gutomaia/nesasm_py | nesasm/tests/cpx_test.py | Python | bsd-3-clause | 1,226 |
"""Setup for fourmis XBlock."""
import os
from setuptools import setup
def package_data(pkg, roots):
"""Generic function to find package_data.
All of the files under each of the `roots` will be declared as package
data for package `pkg`.
"""
data = []
for root in roots:
for dirname,... | teodam/openedx-manhill | setup.py | Python | mit | 893 |
# -*- coding: utf-8 -*-
import os
import random
# pour melanger les graphes...
def shuffle(G):
random.shuffle(G[0])
for c in G[1].items():
random.shuffle(c[1])
# pour completer les graphes NON orientes...
def completer_graphe_no(G):
for x in G[0]:
for y in G[0][x]:
if not ... | NicovincX2/Python-3.5 | Algorithmique/Algorithme/Algorithme de la théorie des graphes/graph_functions.py | Python | gpl-3.0 | 746 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | iemejia/incubator-beam | sdks/python/apache_beam/runners/direct/transform_evaluator.py | Python | apache-2.0 | 47,327 |
import signal
import pyev
import socket
import sys
import inspect
import traceback
def safe( old ):
def new( *args, **kwargs ):
try:
return old(*args, **kwargs)
except :
traceback.print_exc()
return new
class ev_chat( object ... | hackshel/py-aluminium | src/evchat.py | Python | bsd-3-clause | 3,398 |
'''
Created on Feb 6, 2011
@author: Mark V Systems Limited
(c) Copyright 2011 Mark V Systems Limited, All rights reserved.
'''
from tkinter import *
try:
from tkinter.ttk import *
except ImportError:
from ttk import *
from arelle.CntlrWinTooltip import ToolTip
import io
from arelle import (XmlUtil, ViewWinList... | Arelle/Arelle | arelle/ViewWinXml.py | Python | apache-2.0 | 1,337 |
"""
WSGI config for veterinario 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", "veterinario.settings")
from djang... | taopypy/taopypy-django-tests | veterinario/veterinario/wsgi.py | Python | mit | 397 |
import datetime
import logging
import urllib
from analyticsclient.client import Client
from analyticsclient.constants import data_formats, demographics
from django.http import HttpResponse, HttpResponseRedirect
from django.utils import timezone
from analytics_dashboard.courses.presenters.performance import CourseRepo... | edx/edx-analytics-dashboard | analytics_dashboard/courses/views/csv.py | Python | agpl-3.0 | 5,098 |
# -*- coding: utf-8 -*-
#
# privacyIDEA is a Multi-Factor-Management system that supports
# a wide variety of different tokentypes like smartphone apps, key fob tokens,
# yubikeys, u2f, fido2, email, sms...
# The administrator of an organization can manage the 2nd factors of the
# users centrally in privacyIDEA and con... | GluuFederation/oxAuth | Server/integrations/privacyidea/privacyidea.py | Python | mit | 14,772 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import werkzeug
from werkzeug import urls
from werkzeug.exceptions import NotFound, Forbidden
from odoo import http, _
from odoo.http import request
from odoo.osv import expression
from odoo.tools import consteq, plaint... | rven/odoo | addons/portal/controllers/mail.py | Python | agpl-3.0 | 12,616 |
import unittest
import pyrtl
import io
class TestConditional(unittest.TestCase):
def setUp(self):
pyrtl.reset_working_block()
def check_trace(self, correct_string):
sim_trace = pyrtl.SimulationTrace()
sim = pyrtl.Simulation(tracer=sim_trace)
for i in range(8):
sim.... | nvandervoort/PyRTL | tests/test_conditional.py | Python | bsd-3-clause | 18,154 |
import logging
import os
from pip._internal.utils.subprocess import runner_with_spinner_message
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from typing import List, Optional
from pip._vendor.pep517.wrappers import Pep517HookCaller
logger = logging.getLogger(__name__)
d... | nataddrho/DigiCue-USB | Python3/src/venv/Lib/site-packages/pip/_internal/operations/build/wheel.py | Python | mit | 1,458 |
# -*- 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 unique constraint on 'Tag', fields ['name']
db.create_unique('lamenews_tag', ['name'])
def ba... | aliva/lamenews | lamenews/migrations/0003_auto__add_unique_tag_name.py | Python | bsd-3-clause | 4,655 |
# -*- coding: utf-8 -*-
#-----------------------------------------------------------
#
# fTools
# Copyright (C) 2008-2011 Carson Farmer
# EMAIL: carson.farmer (at) gmail.com
# WEB : http://www.ftools.ca/fTools.html
#
# A collection of data management and analysis tools for vector data
#
#-----------------------------... | sebastic/QGIS | python/plugins/fTools/tools/doGeometry.py | Python | gpl-2.0 | 49,678 |
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions a... | machine-intelligence/rl-teacher-atari | agents/ga3c/ga3c/ThreadTrainer.py | Python | mit | 2,485 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-07-29 10:00
from __future__ import unicode_literals
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('accounts', '0006_auto_20160719_1258'),
]
operations = [
migratio... | davideferre/django-ember-jwt-tutorial | server/accounts/migrations/0007_auto_20160729_1000.py | Python | mit | 516 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache/incubator-airflow | airflow/www/forms.py | Python | apache-2.0 | 7,018 |
import os
import subprocess
import shutil
from camio_deps import *
#Since we fetch the source code from source code repositories, these are assumed to build for all platforms
#if this is not the case, platform specific repos will need to be fetched from the platform specific arch file.
def install_dep_svn(dep):
... | mgrosvenor/libchaste | scripts/camio_prepare_repo_deps.py | Python | bsd-3-clause | 1,621 |
# Copyright 2018 Capital One Services, LLC
#
# 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 law or agreed to in... | kapilt/cloud-custodian | tools/c7n_gcp/c7n_gcp/provider.py | Python | apache-2.0 | 1,350 |
import time
from flask import request, abort
from app.views.api.v1 import APIView_v1
# TODO: make this configurable
from app import backends
from app.backends.influxdb import InfluxDBBackend
class PointsParser(object):
def __init__(self, data):
self.points = []
self.interval = None
self... | BasementCat/humidors | webapp/app/views/api/v1/points.py | Python | mit | 4,250 |
# coding=utf-8
import tkinter as tk
import logging
"""
http://stackoverflow.com/questions/7591294/how-to-create-a-self-resizing-grid-of-buttons-in-tkinter
"""
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)-15s %(name)-5s %(levelname)-8s %(message)s')
# levels: CRITICA... | pwust/MoccaSinPOS | src/button-grid-2.py | Python | gpl-2.0 | 4,894 |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# 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... | mlperf/training_results_v0.5 | v0.5.0/google/research_v3.32/gnmt-tpuv3-32/code/gnmt/model/t2t/tensor2tensor/models/image_transformer_2d.py | Python | apache-2.0 | 27,826 |
import pymongo
import datetime
'''
File: fill_db.py
Description: Needs to be run before testing test_io.py, test_job.py and test_scheme.py. This module populates data being used by the test modules for deploying a job and testing the new scheme created.
Author/s: NYU ITP team
'''
'''
config - Configuration to be used... | dcrosta/mongo-disco | fill_db.py | Python | apache-2.0 | 885 |
""" Cisco_IOS_XR_ppp_ma_gbl_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR ppp\-ma\-gbl package configuration.
This YANG module augments the
Cisco\-IOS\-XR\-subscriber\-infra\-tmplmgr\-cfg
module with configuration data.
Copyright (c) 2013\-2016 by Cisco Systems, Inc.
All rights reser... | 111pontes/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ppp_ma_gbl_cfg.py | Python | apache-2.0 | 998 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core
from hypothesis import given
import caffe2.python.hypothesis_test_util as hu
import hypothesis.strategies as st
import numpy as np
class ... | Yangqing/caffe2 | caffe2/python/operator_test/clip_tensor_op_test.py | Python | apache-2.0 | 1,391 |
from datetime import datetime, date
import types
import tempfile
import tarfile
import ocgis
from ocgis import RequestDataset
import datetime as dt
import os
from flyingpigeon import analogs
from pywps.Process import WPSProcess
import logging
class AnalogsProcess(WPSProcess):
def __init__(self):
# defini... | sradanov/flyingpigeon | flyingpigeon/processes/wps_analogs.py | Python | apache-2.0 | 8,822 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.