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 |
|---|---|---|---|---|---|
from copperhead import *
import numpy as np
@cu
def extrema_op(a, b):
a_min_idx, a_min_val, a_max_idx, a_max_val = a
b_min_idx, b_min_val, b_max_idx, b_max_val = b
if a_min_val < b_min_val:
if a_max_val > b_max_val:
return a
else:
return a_min_idx, a_min_val, b_max_i... | copperhead/copperhead | samples/extrema.py | Python | apache-2.0 | 780 |
"""
Annalist site root URL definitions for testing
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
__author__ = "Graham Klyne (GK@ACM.ORG)"
__copyright__ = "Copyright 2014, G. Klyne"
__license__ = "MIT (http://opensource.org/licenses/MIT)"
from ... | gklyne/annalist | src/annalist_root/annalist_site/runtests_urls.py | Python | mit | 610 |
"""Generic bins"""
import numbers
import reprlib
class VolumeError(Exception):
pass
class SimpleBin(object):
"""An object to represent a bin in the Bin Packing Problem."""
def __init__(self, volume):
self._volume = 0
self._available_volume = 0
self.volume = volume
self.... | ibigpapa/bin_packing_problem | binpackp/bins.py | Python | mit | 4,532 |
from django.http import HttpResponse
class rc_factory(object):
"""
Status codes.
"""
CODES = dict(ALL_OK = ('OK', 200),
CREATED = ('Created', 201),
DELETED = ('', 204), # 204 says "Don't send a body!"
BAD_REQUEST = ('Bad Request', 400),
... | j2a/django-simprest | simprest/utils.py | Python | bsd-3-clause | 1,001 |
#!/usr/bin/python
# (c) 2016, Tomas Karasek <tom.to.the.k@gmail.com>
# (c) 2016, Matt Baldwin <baldwin@stackpointcloud.com>
# (c) 2016, Thibaud Morel l'Horset <teebes@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 P... | j00bar/ansible | lib/ansible/modules/cloud/packet/packet_device.py | Python | gpl-3.0 | 18,501 |
from django.db.utils import IntegrityError
from scrapy import log
from scrapy.exceptions import DropItem
from dynamic_scraper.models import SchedulerRuntime
class DjangoWriterPipeline(object):
def process_item(self, item, spider):
try:
item['news_website'] = spider.ref_object
... | kholidfu/django-dynamic-scraper | example_project/open_news/scraper/pipelines.py | Python | bsd-3-clause | 766 |
from rest_framework import permissions
class IsOwnerOrReadOnly(permissions.BasePermission):
"""
Custom permissions to only allow owner of an object to edit it.
"""
# This file is taken from djandorestframework tutorial
def has_object_permission(self, request, view, obj):
# anyone can read... | krsoninikhil/cloud-clipboard | server/clipboard/permissions.py | Python | mit | 472 |
"""Getting imports
adapted from sklearn module testing.py file (for the imports)
run at the root of the package::
nosetests tests -v --with-coverage --cover-package=pyfasst
which enables verbose output, and shows how much of the package in
``pyfasst`` is being covered by the tests
2013 Jean-Louis Durrieu
"""
im... | wslihgt/pyfasst | pyfasst_tests/testing.py | Python | gpl-2.0 | 795 |
# coding=utf-8
'''Ludwig: a deep learning experimentation toolbox
'''
from codecs import open
from os import path
from setuptools import setup, find_packages
here = path.abspath(path.dirname(__file__))
# Get the long description from the README.md file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
... | uber/ludwig | setup.py | Python | apache-2.0 | 2,764 |
#!/usr/bin/env python
# This script tries to suggest a minimal number of modified switches that uses
# mostly easy-to-get switches (Blue, Clear, Black, Grey linear) and offer some
# options for making sure not to waste any of the switch parts.
# This covers only the Cherry MX family of switches.
import itertools
sp... | tylert/yak-keyboards | mx_switch_mods.py | Python | gpl-3.0 | 3,102 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: ls-checkpoint.py
import numpy as np
import pprint
import sys
import six
import tensorflow as tf
from tensorpack.tfutils.varmanip import get_checkpoint_path
if __name__ == '__main__':
fpath = sys.argv[1]
if fpath.endswith('.npy'):
params = np.load... | google-research/ssl_detection | third_party/tensorpack/scripts/ls-checkpoint.py | Python | apache-2.0 | 723 |
#!/usr/bin/python
class Solution(object):
def plusOne(self, digits):
carry = True
i = len(digits) - 1
while carry and i >= 0:
digits[i] += 1
digits[i] %= 10
if digits[i] != 0:
carry = False
i -= 1
if carry:
... | pisskidney/leetcode | easy/66.py | Python | mit | 367 |
#!/usr/bin/env python
'''Tooltip
This is a test of the new gtk tooltip system. It is a
fairly straight forward port of the example distributed with gtk.
'''
import pygtk
pygtk.require('2.0')
import gtk
import cairo
import gobject
import pango
rects = [
{"x":10, "y":10, "r":0.0, "g":0.0, "b":0.9, "tooltip":"Blue... | GNOME/pygtk | examples/pygtk-demo/demos/tooltip.py | Python | lgpl-2.1 | 9,394 |
# (c) Crown Owned Copyright, 2016. Dstl.
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.utils.text import slugify
from .models import User
class UserCreationForm(fo... | dstl/lighthouse | apps/accounts/admin.py | Python | mit | 3,933 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'bitmessageui.ui'
#
# Created: Tue May 12 19:56:56 2015
# by: PyQt4 UI code generator 4.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except A... | metamarcdw/PyBitmessage-I2P | src/bitmessageqt/bitmessageui.py | Python | mit | 47,513 |
#TSTOP
#
#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.
#
#This program is distributed in the hope that it will be useful,
... | gpersistence/tstop | python/persistence/ConfigViewer.py | Python | gpl-3.0 | 6,550 |
# Copyright 2013: Mirantis Inc.
# 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 b... | pyKun/rally | rally/deployment/serverprovider/providers/openstack.py | Python | apache-2.0 | 10,149 |
#blob account credentials
blob_account_name = ''
blob_account_key = ''
#twitter app oauth credentials
oauth_consumer_key = ''
oauth_consumer_secret = ''
#documentdb credentials
db_client = ''
db_client_key = ''
db_name = ''
db_collection = ''
| rjhunter8285/nsc-cloudproject-s22016 | prototype/api/FlaskApp/FlaskApp/azure_components/static/app_keys.py | Python | apache-2.0 | 245 |
# -*- coding: utf-8 -*-
import matplotlib
from keras.models import load_model, Model
import h5py
import numpy as np
from keras import backend as K
import matplotlib.pyplot as plt
from matplotlib.pyplot import cm
from matplotlib.backends.backend_pdf import PdfPages
import argparse
def parse_input():
parser = argp... | StefReck/Km3-Autoencoder | scripts/plotting/make_layer_output_histgramms.py | Python | mit | 5,909 |
#pip intall qrcode
import qrcode
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
#TODO EXPORT FOR SVG
'''
import qrcode.image.svg
if method == 'basic':
# Simple factory, just a set of rects.
factory = qrcode.image.svg.SvgImage
elif met... | WZQ1397/automatic-repo | python/QRcodeEXPORT.py | Python | lgpl-3.0 | 692 |
# Copyright 2020 KMEE INFORMATICA LTDA
# Gabriel Cardoso de Faria <gabriel.cardoso@kmee.com.br>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from xmldiff import main
import os
import logging
from datetime import datetime
from odoo.tools import config
from ... import l10n_br_nfse_ginfes
from... | kmee/l10n-brazil | l10n_br_nfse_ginfes/tests/test_fiscal_document_nfse_ginfes.py | Python | agpl-3.0 | 1,937 |
from file_transfer_helper import SendFileTest, FileTransferTest, \
ReceiveFileTest, exec_file_transfer_test
from config import JINGLE_FILE_TRANSFER_ENABLED
if not JINGLE_FILE_TRANSFER_ENABLED:
print "NOTE: built with --disable-file-transfer or --disable-voip"
raise SystemExit(77)
class SendFileBeforeAcce... | mlundblad/telepathy-gabble | tests/twisted/jingle-share/test-send-file-send-before-accept.py | Python | lgpl-2.1 | 1,163 |
from setuptools import setup, find_packages
from codecs import open
from os import path
__version__ = '0.1.4'
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
install_requires =... | su27/qcloud_cos_py3 | setup.py | Python | mit | 1,086 |
"""
$url play.afreecatv.com
$type live
"""
import logging
import re
from streamlink.plugin import Plugin, PluginArgument, PluginArguments, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream.hls import HLSStream
from streamlink.stream.hls import HLSStreamReader, HLSStreamWriter
log = logg... | streamlink/streamlink | src/streamlink/plugins/afreeca.py | Python | bsd-2-clause | 7,314 |
__author__ = 'Saleem'
| saleem-latif/GeoCode | geocode/__init__.py | Python | gpl-2.0 | 22 |
import numpy as np
import matplotlib.pyplot as plt
m_pod = np.loadtxt('../data_files/overland_structural_trades/m_pod.txt', delimiter = '\t')
A_tube = np.loadtxt('../data_files/overland_structural_trades/A_tube.txt', delimiter = '\t')
dx = np.loadtxt('../data_files/overland_structural_trades/dx.txt', delimiter = '\t')... | kennethdecker/MagnePlane | paper/images/trade_scripts/overland_structural_trades_plot.py | Python | apache-2.0 | 1,193 |
from common.log import logUtils as log
from common.ripple import userUtils
from constants import exceptions
from constants import messageTemplates
from constants import serverPackets
from events import logoutEvent
from objects import fokabot
from objects import glob
def joinChannel(userID = 0, channel = "", token = N... | osuripple/pep.py | helpers/chatHelper.py | Python | agpl-3.0 | 15,058 |
# -*- coding: utf-8 -*-
# © 2014-2015 Avanzosc
# © 2014-2015 Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import models
| Endika/manufacture | mrp_production_real_cost/__init__.py | Python | agpl-3.0 | 165 |
"""
Copyright (C) 2017-2021 Vanessa Sochat.
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 shub.apps.users.models import User
from shub.apps.main.models import C... | singularityhub/sregistry | shub/apps/users/views/users.py | Python | mpl-2.0 | 4,236 |
from setuptools import setup, find_packages
setup(name='MODEL1204280035',
version=20140916,
description='MODEL1204280035 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/MODEL1204280035',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/MODEL1204280035 | setup.py | Python | cc0-1.0 | 377 |
import sublime, sublime_plugin
import os
class JasmineCoffeeScriptDetectFileTypeCommand(sublime_plugin.EventListener):
""" Detects current file type if the file's extension isn't conclusive """
def on_load(self, view):
filename = view.file_name()
if not filename: # buffer has never been saved
return... | integrum/sublime-text-jasmine-coffeescript | JasmineCoffeeScriptDetectFileType.py | Python | mit | 722 |
# This directory is a Python package.
| Donkyhotay/MoonPy | zope/dublincore/fssync/__init__.py | Python | gpl-3.0 | 38 |
#
# Albow - Layout widgets
#
from pygame import Rect
from widget import Widget
class RowOrColumn(Widget):
_is_gl_container = True
def __init__(self, size, items, kwds):
align = kwds.pop('align', 'c')
self.spacing = spacing = kwds.pop('spacing', 10)
expand = kwds.pop('expand', None)
... | Neui/MCEdit-Unified | albow/layout.py | Python | isc | 4,976 |
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------------
# Copyright 2019-2020 Arm Limited
#
# 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 Li... | ARM-software/astc-encoder | Test/testlib/image.py | Python | apache-2.0 | 13,923 |
# Copyright 2012 IBM Corp.
# Copyright 2013 Red Hat, 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 r... | mahak/nova | nova/tests/unit/conductor/test_conductor.py | Python | apache-2.0 | 236,719 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Registry',
fields=[
('id', models.AutoField(ver... | zacherytapp/wedding | weddingapp/apps/registry/migrations/0001_initial.py | Python | bsd-3-clause | 1,051 |
from lxml import etree
import sys
REQUEST_BODY_PART_1 = '<![CDATA[actualEvent='
REQUEST_BODY_PART_2 = '&queryEmail='
REQUEST_BODY_PART_3 = ']]>'
CONTENT_TYPE = 'Content-type: application/x-www-form-urlencoded'
def usage():
print "python create_test_case [URL]"\
" [EVENT_NAME] [AMOUNT_CASES] [TEST_CASE_FI... | Ezetowers/AppEngine_EventsManagement | load_tests/QueryGuest_Case/query_guests.py | Python | mit | 1,268 |
#!/usr/bin/env python
##
## https://www.dropbox.com/developers/core/start/python
##
import os, sys, argparse
import locale, logging, json, types
import config
from base64 import b64decode
# Include the Dropbox SDK
from dropbox.session import DropboxSession
from dropbox.client import DropboxClient
# Initialize versio... | Spoon4/dpbox | dpbox.py | Python | gpl-2.0 | 11,413 |
# Copyright (C) 2008-2010 Adam Olsen
#
# 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 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that... | strahlc/exaile | xlgui/main.py | Python | gpl-2.0 | 43,837 |
#!/usr/env python
# -*- coding: utf-8 -*-
__author__ = 'eduardo'
import logging
import json
import re
import time
from lbsociam.model import gmaps
from googlemaps.exceptions import ApiError, TransportError, Timeout, _RetriableRequest
from lbsociam.model import location as loc
log = logging.getLogger()
# Wakeup time ... | lightbase/LBSociam | lbsociam/lib/location.py | Python | gpl-2.0 | 8,822 |
from django.db.models.fields.related import ManyToManyField
def to_dict(instance):
opts = instance._meta
data = {}
for f in opts.concrete_fields + opts.many_to_many:
if isinstance(f, ManyToManyField):
if instance.pk is None:
data[f.name] = []
else:
... | FiniteElementries/barebone_server | helper/model.py | Python | mit | 1,178 |
import os
import redis
REDIS_PORT = 6379
REDIS_DB = 0
REDIS_HOST = os.environ.get('REDIS_PORT_6379_TCP_ADDR', 'redis')
REDIS_CONNECTION_POOL = redis.ConnectionPool(host=REDIS_HOST,
port=REDIS_PORT,
db=REDIS_DB)
| helloworldajou/webserver | apiserver/redis_cli.py | Python | apache-2.0 | 303 |
#!/usr/bin/python
#
# Size report of (stripped) object and source files.
#
import os
import sys
def getsize(fname):
return os.stat(fname).st_size
def getlines(fname):
f = None
try:
f = open(fname, 'rb')
lines = f.read().split('\n')
return len(lines)
finally:
if f is not None:
f.close()
f = None
d... | JoshEngebretson/duktape | src/gensizereport.py | Python | mit | 1,847 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# decorator makes wrappers that have the same API as their wrapped function;
# this is important for the odoo.api.guess() that relies on signatures
from collections import defaultdict
from decorator import decorator
from... | Aravinthu/odoo | odoo/tools/cache.py | Python | agpl-3.0 | 7,996 |
"""
test .agg behavior / note that .apply is tested generally in test_groupby.py
"""
import datetime
import functools
from functools import partial
import re
import numpy as np
import pytest
from pandas.errors import PerformanceWarning
from pandas.core.dtypes.common import is_integer_dtype
import pandas as pd
from ... | gfyoung/pandas | pandas/tests/groupby/aggregate/test_aggregate.py | Python | bsd-3-clause | 41,836 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# v1.36
# * fixed call checkfiles subroutine
# v1.35
# * fixed rs-urls in handleFree(..) and freeWait(..)
# * removed getInfo(..) function as it was not used anywhere (in this file)
# * removed some (old?) comment blocks
import re
from module.network.RequestFactory impo... | swayf/pyLoad | module/plugins/hoster/RapidshareCom.py | Python | agpl-3.0 | 8,265 |
#!/usr/bin/env python
"""
Display, edit and check the release manager's transition file.
@contact: Debian FTP Master <ftpmaster@debian.org>
@copyright: 2008 Joerg Jaspert <joerg@debian.org>
@license: GNU General Public License version 2 or later
"""
# This program is free software; you can redistribute it and/or mod... | luther07/dak | dak/transitions.py | Python | gpl-2.0 | 21,921 |
#!/usr/bin/env python
from datasets import cp
from datasets import variables
from datasets import Camera
def loaddataset():
setglobalvariables()
loadcameras()
return getcameras(), loadconfiguration()
def setglobalvariables():
variables.current_dataset_path = variables.datasets_path + '/pets09/ica... | lacatus/TFM | datasets/pets01_crop.py | Python | apache-2.0 | 2,034 |
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines 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 ap... | google/uncertainty-baselines | baselines/diabetic_retinopathy_detection/utils/uncertainty_utils.py | Python | apache-2.0 | 32,876 |
import random, time
import string, sys
def main():
# Modulo Gerador de Senha.
def PasswordGenerator():
# Gerador para a senha "Fraca".
def PassFraca():
letterStore = string.ascii_lowercase # Letras de A a Z minusculas.
print("") # Espaço.
print("".join(random.sample(letterStore, int(passGen)))) # Junção... | Pharaoh00/Pharaoh-Toolkit | v0.0.0/ToolKit(v0.0.0)BKP.py | Python | mit | 6,983 |
from streamlink.plugins.viasat import Viasat
from tests.plugins import PluginCanHandleUrl
class TestPluginCanHandleUrlViasat(PluginCanHandleUrl):
__plugin__ = Viasat
should_match = [
"http://www.juicyplay.dk/story/se-robinson-benjamins-store-forandring",
"http://www.tv3.dk/paradise-hotel/para... | melmorabity/streamlink | tests/plugins/test_viasat.py | Python | bsd-2-clause | 2,116 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "projectservice.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| TangentMicroServices/ProjectService | manage.py | Python | gpl-2.0 | 257 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google 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... | googleapis/python-dialogflow | google/cloud/dialogflow_v2/types/webhook.py | Python | apache-2.0 | 8,774 |
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# T... | Donkyhotay/MoonPy | zope/server/logger/sysloglogger.py | Python | gpl-3.0 | 1,951 |
# Copyright 2016 The TensorFlow Authors. 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 applica... | liyi193328/seq2seq | seq2seq/contrib/lookup/lookup_ops.py | Python | apache-2.0 | 58,750 |
# -*- coding: UTF-8 -*-
#--------------------------------------------------------------------------
# Copyright (c) : 2004 - 2007 Softwell sas - Milano
# Written by : Giovanni Porcari, Michele Bertoldi
# Saverio Porcari, Francesco Porcari , Francesco Cavazzana
#--------------------------------------... | poppogbr/genropy | packages/showcase/webpages/webpage_elements/widgets/user_assistance/floatingpane.py | Python | lgpl-2.1 | 4,401 |
#!/usr/bin/env python
import caffe
import numpy as np
from cv2 import *
import time
caffe.set_mode_cpu()
net = caffe.Net('../../../../models/DeepMARCaffe/DeepMAR.prototxt',
'../../../../models/DeepMARCaffe/DeepMAR.caffemodel',
caffe.TEST)
img = imread('CAM01_2014-02-15_20140215161032... | kyu-sz/DeepMAR_deploy | test/benchmark_cpu.py | Python | gpl-3.0 | 862 |
"""
Represents manager for every animation in the stage.
Every animation that is run in the Rinde thread, has to be inserted to this collection.
"""
class Animations:
"""
Collection of each animation that is being running.
"""
__ACTIVE = set()
"""
Buffer for each animation that could not be activated directly... | r0jsik/rinde | rinde/property/animation.py | Python | mit | 2,851 |
"""
Sana mDS(mobile Dispatch Server)
================================
A packetizing dropbox and forwarding server for collection and dissemination
of data.
Discussion Groups
-----------------
1. For development questions and discussion: `Sana developer group
<http://groups.google.com/group/sana-developers>`... | SanaMobile/middleware_mds_v1 | src/mds/__init__.py | Python | bsd-3-clause | 499 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
`sword2` logging
"""
import logging
import logging.config
from os import path as os_path
SWORD2_LOGGING_CONFIG = "./sword2_logging.conf" # default
BASIC_CONFIG = """[loggers]
keys=root
[handlers]
keys=consoleHandler
[formatters]
keys=basicFormatting
[logger_root... | oerpub/python-sword2 | sword2/sword2_logging.py | Python | mit | 827 |
import os
import responses
import sys
from cStringIO import StringIO
from django.test import TestCase
from django.core import management
from django.core.urlresolvers import reverse
from django.core.exceptions import ValidationError
from django.contrib.gis.geos import Point, GEOSGeometry
from nodeshot.core.layers.mod... | SCORE42/nodeshot | nodeshot/interop/sync/tests/tests.py | Python | gpl-3.0 | 32,632 |
import os
def check(cmd, mf):
m = mf.findNode('pygame')
if m is None or m.filename is None:
return None
def addpath(f):
return os.path.join(os.path.dirname(m.filename), f)
RESOURCES = ['freesansbold.ttf', 'pygame_icon.tiff', 'pygame_icon.icns']
result = dict(
loader_files... | nCoda/macOS | .eggs/py2app-0.14-py2.7.egg/py2app/recipes/pygame.py | Python | gpl-3.0 | 407 |
#!/usr/bin/env python2.7
import datetime
import monthdelta
def parse_date(date_str):
return datetime.datetime.strptime(date_str, "%Y-%m-%d")
def unparse_date(date_obj):
return date_obj.strftime("%Y-%m-%d")
class Company(object):
def __init__(self, name):
self.name = name
self.flows = []
... | gkotian/zulip | tools/deprecated/finbot/money.py | Python | apache-2.0 | 7,737 |
from django import template
from django.db import models
from djpcms.utils import force_str
from djpcms import get_site
register = template.Library()
@register.filter
def site_address(request):
host = request.environ.get('HTTP_HOST','')
if host:
if request.is_secure():
retu... | strogo/djpcms | djpcms/templatetags/djpmodutils.py | Python | bsd-3-clause | 1,926 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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... | CMSS-BCRDB/RDS | trove/guestagent/strategies/storage/base.py | Python | apache-2.0 | 1,512 |
import string
from Bio import Alphabet, Seq
from Bio.Alphabet import IUPAC
class Transcribe:
def __init__(self, dna_alphabet, rna_alphabet):
self.dna_alphabet = dna_alphabet
self.rna_alphabet = rna_alphabet
def transcribe(self, dna):
assert dna.alphabet == self.dna_alphabet, \... | dbmi-pitt/DIKB-Micropublication | scripts/mp-scripts/Bio/Transcribe.py | Python | apache-2.0 | 1,051 |
# aledflash.py Demo/test program for MicroPython asyncio
# Author: Peter Hinch
# Copyright Peter Hinch 2020 Released under the MIT license
# Flashes the onboard LED's each at a different rate. Stops after ten seconds.
# Run on MicroPython board bare hardware
import pyb
import uasyncio as asyncio
async def toggle(objL... | peterhinch/micropython-async | v3/as_demos/aledflash.py | Python | mit | 1,016 |
import variables as v
import time
import random
import pathfind
def ai():
for event in v.networkEvents:
if event["type"] == "turn":
v.networkChanges.append({"type": "turn", "turn": {"player": v.opUnid, "time": time.time()}})
if len(v.opDeck) > 0 and len(v.opHand) < 4:
... | lightopa/Aiopa-Battles | campaignAI.py | Python | mit | 9,176 |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
from selenium.webdriver.support import expected_con... | influence-usa/lobbying_federal_domestic | notebooks/scraping_house_clerk_site.py | Python | cc0-1.0 | 3,603 |
# Copyright 2017 Christoph Reiter
#
# 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 2 of the License, or
# (at your option) any later version.
import os
import contextlib
from g... | quodlibet/quodlibet | quodlibet/qltk/chooser.py | Python | gpl-2.0 | 6,935 |
###
#KEY VARIABLES
pc = 2 # The percent change to report on
days = 30 # How many days to retrieve on each pull
volume = 1 # Daily = 1, Weekly = 7, Monthly = 30
report_type = 'new' #can be 'active' or 'new'
group_by = "country" #Grouping can be 'country' for country, for other possible groupings, check Amplitude docs.... | william-gill/get-stats | get_stats.py | Python | gpl-3.0 | 3,210 |
def foo(x, y={1:2, 2:3, 3:4}):
pass
| omaraboumrad/mastool | mastool/samples/dict_with_vals_as_arg.py | Python | apache-2.0 | 40 |
# -*- coding: cp1254 -*-
# Onur Yilmaz
# Imports
import codecs
import locale
import bisect
import random
import sys
import pickle
import textwrap
from nltk.tokenize import BlanklineTokenizer
from nltk.corpus.reader import TaggedCorpusReader
from random import shuffle
from nltk.corpus import treebank
from nl... | bugraoral/TextRank | pos_tagger.py | Python | gpl-3.0 | 974 |
#!/usr/bin/env python
from __future__ import print_function
import pricematrices as pm
import time
from functools import wraps
def fn_timer(function):
@wraps(function)
def function_timer(*args, **kwargs):
t0 = time.time()
result = function(*args, **kwargs)
t1 = time.time()
prin... | kumkee/SURF2016 | src/marketdata/test.py | Python | gpl-3.0 | 886 |
# -*- coding: utf-8 -*-
"""
Auth* related model.
This is where the models used by :mod:`repoze.who` and :mod:`repoze.what` are
defined.
It's perfectly fine to re-use this definition in the SkyLines application,
though.
"""
import os
from datetime import datetime
import struct
from hashlib import sha256
from sqlalch... | dkm/skylines | skylines/model/auth.py | Python | agpl-3.0 | 10,867 |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: Text Trees
#
# Copyright (C) 2001-2017 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# Peter Ljunglöf <peter.ljunglof@gu.se>
# Nathan Bodenstab <bodenstab@cslu.ogi.edu> (tree transforms)
# URL: <h... | sdoran35/hate-to-hugs | venv/lib/python3.6/site-packages/nltk/tree.py | Python | mit | 64,375 |
# -*- coding: utf8 -*-
"""
This file contains configuration for Okcoin.com stock.
"""
__author__ = "Jan Seda"
__copyright__ = "Copyright (C) Jan Seda"
__credits__ = []
__license__ = ""
__version__ = "0.1"
__maintainer__ = "Jan Seda"
__email__ = ""
__status__ = "Production"
import urllib.parse
import inspect
from ..... | Honzin/ccs | ccs/okcoincom/public/__init__.py | Python | agpl-3.0 | 863 |
works_filter_details = {
"has_funder": {
"possible_values": None,
"description": "metadata which includes one or more funder entry",
},
"funder": {
"possible_values": "{funder_id}",
"description": "metadata which include the {funder_id} in FundRef data",
},
"location"... | sckott/habanero | habanero/crossref/filters.py | Python | mit | 11,987 |
#-
# Copyright (c) 2014 Michael Roe
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# Licensed to BER... | 8l/beri | cheritest/trunk/tests/fpu/test_raw_fpu_mul_inf_single.py | Python | apache-2.0 | 1,953 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import,print_function
import os
import sys
import code
import warnings
import string
import inspect
import argparse
from flask import _request_ctx_stack
from .cli import prompt, prompt_pass, prompt_bool, prompt_choices
from ._compat import izip, text_type
cl... | wjt/flask-script | flask_script/commands.py | Python | bsd-3-clause | 18,544 |
"""
Create inset.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from fabmetheus_utilities.geometry.creation import lineation
from fabmetheus_utili... | natetrue/ReplicatorG | skein_engines/skeinforge-40/fabmetheus_utilities/geometry/manipulation_paths/_outset.py | Python | gpl-2.0 | 1,041 |
import argparse, sys
def print_and_exit(string):
class PrintAction(argparse.Action):
"""An argparse action to print your module's docstring."""
def __call__(self, parser, namespace, values, option_string=None):
print(string)
sys.exit(0)
return PrintAction
def init_parse... | MatthewDarling/basic_argparse | basic_argparse.py | Python | mit | 1,036 |
import sys
import multiprocessing
_current = None
_total = None
def _init(current, total):
global _current
global _total
_current = current
_total = total
def _wrapped_func(func_and_args):
func, argument, should_print_progress, filter_ = func_and_args
if should_print_progress:
wit... | GPUOpen-Drivers/llvm | tools/opt-viewer/optpmap.py | Python | apache-2.0 | 1,743 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2010 Jakim Friant
#
# 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; eithe... | prculley/gramps | gramps/gen/plug/report/_paper.py | Python | gpl-2.0 | 3,698 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from fitnessfunction import FitnessFunction
from model.integertest import IntegerTest
class IntegerTestFitnessFunction(FitnessFunction):
def __init__(self):
super(IntegerTestFitnessFunction, self).__init__()
def fitness(self, model):
if not isins... | ValyrianTech/BitcoinSpellbook-v0.3 | darwin/fitnessfunction/integertestfitnessfunction.py | Python | gpl-3.0 | 748 |
#!/usr/bin/env python
import re, logging, copy
from threading import Lock
class Tagger(object):
def __init__(self, hosts_attr="fields.hosts", hosts_sep=":", tag_file="tags_jobs.safe"):
self.tags_by_host = {}
self.hosts_sep = str(hosts_sep)
self.hosts_attr = str(hosts_attr)
self.ta... | RRZE-HPC/LMS | midware/influxdbrouter/influxdbrouter/tagstore.py | Python | gpl-3.0 | 2,579 |
# 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 os
import re
import sys
def _SyncFilesToCloud(input_api, output_api):
"""Searches for .sha1 files and uploads them to Cloud Storage.
It val... | mogoweb/chromium-crosswalk | tools/perf/page_sets/PRESUBMIT.py | Python | bsd-3-clause | 2,402 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-04-20 15:47
from __future__ import unicode_literals
import django.db.models.deletion
import modelcluster.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtail_personalisation', '0007_... | LabD/wagtail-personalisation | src/wagtail_personalisation/migrations/0008_devicerule.py | Python | mit | 1,191 |
# -*- coding: utf-8 -*-
import os
import sys
import random
def readhumanlines_i(inDir, num):
filename = os.path.join(inDir,str(num),'ivectors_' + str(num), 'spk_ivector.ark')
f = open(filename)
lines = f.readlines()
f.close()
return lines
def readhumanlines_d(inDir, num):
filename = os.path.j... | daishoui/MyGithub | taskCode/20171024/createhmn.py | Python | gpl-3.0 | 3,052 |
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | tseaver/google-cloud-python | trace/tests/system/gapic/v2/test_system_trace_service_v2_vpcsc.py | Python | apache-2.0 | 1,467 |
#!/bin/python
def insertionSort(L):
shiftCount = 0
for i in range(len(L)):
key = L[i]
for j in reversed(range(i)):
if L[j] <= key:
break
L[j], L[j + 1] = L[j + 1], L[j]
shiftCount += 1
return shiftCount
size = int(raw_input())
L = [int(va... | lilsweetcaligula/Online-Judges | hackerrank/algorithms/sorting/easy/running_time_of_algorithms/py/solution.py | Python | mit | 406 |
"""Print effective userid
SYNOPSIS:
whoami
DESCRIPTION:
Print the user name associated with current remote
server access rights.
* PASSIVE PLUGIN:
No requests are sent to server, as current user
is known by $USER environment variable (`env USER`);
AUTHOR:
nil0x42 <http://goo.gl/kb2wf>
""... | nil0x42/phpsploit | plugins/system/whoami/plugin.py | Python | gpl-3.0 | 371 |
#!/usr/bin/python
#
# Copyright 2015 Google Inc. 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 b... | haveal/googleads-dfa-reporting-samples | python/v2.2/get_size.py | Python | apache-2.0 | 2,025 |
import ConfigParser
import os
class ConfigHelper:
conf = 'luna.conf'
def __init__(self, core, logger):
self.core = core
self.logger = logger
self._reset()
self.full_path = ''.join([self.core.storage_path, self.conf])
self.configure(False)
def _reset(self):
... | wackerl91/luna | resources/lib/util/confighelper.py | Python | gpl-3.0 | 9,306 |
"""
This is a dummy to try and get a gis gui up and running
"""
from GUI_1 import MyShape
import json
from collections import defaultdict
from tkinter import *
from tkinter import ttk
from descartes.patch import PolygonPatch
import shapely
import shapely.geometry as geometry
from shapely.ops import cascaded_union
impor... | d15123601/geotinkering | dummy_gis.py | Python | mit | 17,528 |
import lightgbm as lgb
import pandas as pd
import keras_train
import numpy as np
import config
def lgbm_train(train_part, train_part_label, valide_part, valide_part_label, fold_seed,
fold = 5, train_weight = None, valide_weight = None, flags = None):
"""
LGBM Training
"""
CATEGORY_... | ifuding/Kaggle | TalkingDataFraudDetect/Code/lgb.py | Python | apache-2.0 | 7,393 |
import time
import aiohttp
from datetime import timedelta
import json
import encryption
from secret import *
from AList_ProfileProcessor import profile_preprocessor
import random
class AList:
def __init__(self, client):
self.apiurl = "https://anilist.co/api"
self.commands = [['awaifu', self.waifu]... | ccubed/AngelBot | AList.py | Python | mit | 49,247 |
# Copyright 2011 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 requ... | mikalstill/nova | nova/tests/unit/api/openstack/compute/test_server_metadata.py | Python | apache-2.0 | 31,012 |
from datetime import date
from io import StringIO
import os
from django.test import TestCase
from organisations.models import Organisation, OrganisationDivisionSet
from organisations.management.commands.update_end_dates import Command
class UpdateEndDatesTests(TestCase):
def setUp(self):
# set up test dat... | DemocracyClub/EveryElection | every_election/apps/organisations/tests/test_update_end_dates.py | Python | bsd-3-clause | 8,582 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_11_01/aio/operations/_vpn_link_connections_operations.py | Python | mit | 5,986 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.