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 |
|---|---|---|---|---|---|
# If we list all the natural numbers below 10 that are multiples of 3 or 5,
# we get 3, 5, 6 and 9. The sum of these multiples is 23.
# range: search-space. E.g.: [1..10]
# mult: multiples. E.g.: [3, 5]
# Find the sum of all the multiples of 3 or 5 below 1000.
def findSum():
s = 0
rng = list(range(1, 1... | a-n-d-r-e-i/peuler | multiSum.py | Python | gpl-3.0 | 506 |
# Copyright (c) 2015 Red Hat 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... | openstack/neutron-lib | neutron_lib/api/definitions/qos.py | Python | apache-2.0 | 6,023 |
# -*- coding: utf-8 -*-
"""
a simple way to remember to remove dead code due to notanymore supported
library of python versions.
"""
from .insupportable import *
__author__ = 'Matthias Bussonnier'
__email__ = 'bussonniermatthias@gmail.com'
__version__ = '0.1.2'
| Carreau/insupportable | insupportable/__init__.py | Python | bsd-3-clause | 264 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for the OGR/GPKG provider.
.. note:: 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.... | medspx/QGIS | tests/src/python/test_provider_ogr_gpkg.py | Python | gpl-2.0 | 36,067 |
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
"""Tests pleaseTurnOver, pageBreakBefore, frameBreakBefore, keepWithNext...
"""
__version__='''$Id: test_platypus_pleaseturnover.py 3959 2012-09-27 14:39:39Z robin $'''
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outp... | nakagami/reportlab | tests/test_platypus_pleaseturnover.py | Python | bsd-3-clause | 9,168 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_functions
----------------------------------
Tests for `functions` module.
"""
try:
import unittest2 as unittest
except ImportError:
import unittest
from wikipediabase import functions, skin
def addone(x):
return x+1
class TestFunctions(unittest.T... | fakedrake/WikipediaBase-skinz | tests/test_functions.py | Python | bsd-3-clause | 1,053 |
from collections import OrderedDict
def dict_variables(rd, sv, name):
return {
"RELEASE_DATE": rd,
"SHORT_STRING": "".join(sv),
"SHORT_VERSION": ".".join(str(int(x)) for x in sv),
"NAME": name,
}
VERSIONS = OrderedDict([
('3.14.5', dict_variables("201405311735", ("03", "14"... | hughdbrown/linux_binary | src/linux_versions.py | Python | mit | 4,985 |
# pAhaggar Python module
#
# Copyright (C) 2012-2013 Djalal Harouni <tixxdz@opendz.org>
# Copyright (C) 2012-2013 LIRE Laboratory.
# University Constantine 2, Algeria.
#
# Author(s): Djalal Harouni <tixxdz@opendz.org>
# Pr. Mohamed Benmohammed
#
# This program is free software; you can redistribute it and/or
# mo... | tixxdz/ahaggar | scripts/pahaggar/__init__.py | Python | gpl-2.0 | 738 |
import pickle
from matplotlib import pyplot as plt
plt.style.use('classic')
import matplotlib as mpl
fs = 12.
fw = 'bold'
mpl.rc('lines', linewidth=2., color='k')
mpl.rc('font', size=fs, weight=fw, family='Arial')
mpl.rc('legend', fontsize='small')
import numpy
def grad( x, u ) :
return numpy.gradient(u) / nu... | matthewpklein/battsimpy | docs/extra_files/electrode_ocv_gen.py | Python | gpl-3.0 | 5,199 |
# -*- coding: utf8 -*-
import numpy as np
import matplotlib.pyplot as plt
import pymysql
import pymysql.cursors
import YahooFinance as yf
import KabuCom as kc
import datetime
import json
import hashlib
import config
class CurbFinanceMySQL:
def __init__(self):
self.host = mysql_config['host']
self.port = mysql_c... | EnsekiTT/cfinance | finance.py | Python | mit | 3,699 |
"""
A pure python (slow) implementation of rijndael with a decent interface
To include -
from rijndael import rijndael
To do a key setup -
r = rijndael(key, block_size = 16)
key must be a string of length 16, 24, or 32
blocksize must be 16, 24, or 32. Default is 16
To use -
ciphertext = r.encrypt(plaintext)
plai... | jevinskie/aes-over-pcie | utils/rijndael.py | Python | bsd-3-clause | 10,985 |
import csv
from topic import Topic
from query import Query
from document import Document
from data_file import DataFile
from user import User
from condition import Condition
class QueriesSummaryFile(DataFile):
def __init__(self, file_name):
DataFile.__init__(self, file_name)
self.__parse()
def __parse(... | fire-uta/iiix-data-parser | queries_summary_file.py | Python | mit | 1,248 |
import git
import glob
import logging
import os
from .config import AssignmentConfig
logger = logging.getLogger(__name__)
class GradeSheetError(Exception):
"""A general-purpose exception thrown by the Assignment class.
"""
pass
class GradeSheet(object):
"""A gradesheet for an assignment. Gradeshee... | grade-it/grader | redkyn-grader/grader/models/gradesheet.py | Python | mit | 4,035 |
from SimpleCV.base import *
from SimpleCV.Features import Feature, FeatureSet
from SimpleCV.Color import Color
from SimpleCV.ImageClass import Image
class SegmentationBase(object):
"""
Right now I am going to keep this class as brain dead and single threaded as
possible just so I can get the hang of abc in... | nils-werner/SimpleCV | SimpleCV/Segmentation/SegmentationBase.py | Python | bsd-3-clause | 2,426 |
# -*- coding: utf-8 -*-
from trytond.pool import Pool
from product import Template, Product, ProductVariationAttributes, \
ProductAttribute
def register():
Pool.register(
Template,
Product,
ProductVariationAttributes,
ProductAttribute,
module='nereid_catalog_variants', ... | fulfilio/nereid-catalog-variants | __init__.py | Python | bsd-3-clause | 340 |
"""Support for MAX! binary sensors via MAX! Cube."""
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.helpers.entity import EntityCategory
from . import DATA_KEY
def setup_platform(hass, config, add_entities, discovery_info=None):
"""I... | home-assistant/home-assistant | homeassistant/components/maxcube/binary_sensor.py | Python | apache-2.0 | 2,360 |
#!/usr/bin/env python2.7
# asli@cbs.dtu.dk, thomas@cbs.dtu.dk
import sys, gzip
import re, string
import argparse
import os
from Bio.Blast import NCBIStandalone
from operator import itemgetter, attrgetter
from datetime import datetime as dt
import time
sys.path.append('/home/projects5/pr_53035/people/asli/bin/lib/pytho... | MG-group-tools/MGFunc | others/blastdecide_ublast.dbg.py | Python | gpl-3.0 | 13,354 |
import shutil
from PyQt5.QtCore import QThread, pyqtSignal
from requests import get
from os import path, makedirs, remove, listdir
from sys import platform
from zipfile import ZipFile
from GUI.Downloader import FileDownloaderWindow
from GUI.Strings import Strings
from API.CurseAPI import CurseAPI
from Utils.Utils im... | Brain888/OpenMineMods | Utils/Updater.py | Python | agpl-3.0 | 2,000 |
from listeners import * | natea/django-lfc | lfc/__init__.py | Python | bsd-3-clause | 23 |
from textwrap import dedent
from typing import Dict, List
import pytest
import gen
from gen.tests.utils import make_arguments, true_false_msg, validate_error
class TestAdminRouterTLSConfig:
"""
Tests for the Admin Router TLS Config creation.
"""
@pytest.mark.parametrize(
'adminrouter_tls_1_... | branden/dcos | gen/tests/test_adminrouter_tls_conf.py | Python | apache-2.0 | 11,615 |
# Copyright 2019 Virgil Dupras
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html
from datetime import date
import pytest
from ..testutil import eq_, with_... | hsoft/moneyguru | core/tests/gui/transaction_panel_test.py | Python | gpl-3.0 | 11,860 |
# 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 __future__ import absolute_import
import datetime
from random import randint
import sqlalchemy as sa
import struc... | mozilla/build-relengapi | relengapi/blueprints/archiver/__init__.py | Python | mpl-2.0 | 9,767 |
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | shoreflyer/cerbero | cerbero/commands/fetch.py | Python | lgpl-2.1 | 4,802 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring ... | lootr/netzob | netzob/src/netzob/Inference/Grammar/ProcessWrappers/all.py | Python | gpl-3.0 | 2,230 |
"""
OVERALL CREDIT TO:
t0mm0, Eldorado, VOINAGE, BSTRDMKR, tknorris, smokdpi, TheHighway
urlresolver XBMC Addon
Copyright (C) 2011 t0mm0
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 So... | azumimuo/family-xbmc-addon | script.mrknow.urlresolver/lib/urlresolver9/plugins/watchers.py | Python | gpl-2.0 | 2,206 |
#!/usr/bin/python
'Finite difference RTM as a linear operator'
import os, sys, tempfile, subprocess
import rsf.prog, rsf.path
# Madagascar bin directory
bindir=os.path.join(rsf.prog.RSFROOT,'bin')
# Madagascar DATAPATH
datapath=rsf.path.datapath().rstrip('/')
# Madagascar commands
cp=os.path.join(bindir,'sfcp')
rtm... | TobbeTripitaka/src | user/zhiguang/Mfdlsrtm.py | Python | gpl-2.0 | 715 |
INF = 9e9
def _min_index(dists, visited):
mn, min_index = INF, -1
for i in range(len(visited)):
if not visited[i] and dists[i] < mn:
mn, min_index = dists[i], i
return min_index
def print_MST(graph):
n = len(graph)
parents = [ 0 ] * n
dists = [ INF ] * n
visite... | sshh12/SchoolCode | Algorithms/Graphs/PrimMST.py | Python | mit | 898 |
# coding=utf-8
from __future__ import absolute_import, division, print_function, \
unicode_literals
import json
import re
import socket
import unicodedata
from base64 import standard_b64decode, urlsafe_b64decode
from collections import OrderedDict
from decimal import Decimal as DecimalType
from typing import Any, ... | eflglobal/filters | filters/string.py | Python | mit | 27,879 |
# coding: utf-8
'''Tests for CovManager collection views
@author: Jesse Schwartzentruber (:truber)
@license:
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/.
'''
import ... | MozillaSecurity/FuzzManager | server/covmanager/tests/test_collections.py | Python | mpl-2.0 | 5,682 |
import asyncio
import colorsys
import enum
import functools
import psmove
import time
import traceback
import random
SETTINGSFILE = 'joustsettings.yaml'
#Human speeds[slow, mid, fast]
#SLOW_WARNING = [0.1, 0.15, 0.28]
#SLOW_MAX = [0.25, 0.8, 1]
#FAST_WARNING = [0.5, 0.6, 0.8]
#FAST_MAX = [1, 1.4, 1.8]
SLOW_WARNING =... | aangert/PiParty | common.py | Python | mit | 5,854 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2012, 2014, 2015 CERN.
#
# Invenio 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 optio... | inveniosoftware/invenio-upgrader | invenio_upgrader/models.py | Python | gpl-2.0 | 1,169 |
from netpyne import specs
# Simulation options
cfg = specs.SimConfig() # object of class SimConfig to store simulation configuration
cfg.duration = 1*1e3 # Duration of the simulation, in ms
cfg.dt = 0.025 # Internal integration timestep to use
cfg.verbose = False # Show detailed messag... | Neurosim-lab/netpyne | doc/source/code/tut8_cfg.py | Python | mit | 945 |
#!/usr/bin/env python
'''Test load using the Python PNG loader. You should see the rgb_8bpp_trans.png
image with a hole on it on a checkboard background.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import unittest
import base_load
from pyglet.image.codecs.png import PNGImageDecoder
c... | gdkar/pyglet | tests/image/PNG_INDEXED_TRANS_LOAD.py | Python | bsd-3-clause | 500 |
# -*- coding: utf-8 -*-
def write_rom(rom_path: str, rom_content: bytes):
with open(rom_path, mode='wb') as bios:
print('Writing "', rom_path, '" bios file ...')
return bios.write(rom_content)
| emeric254/PyHawaiiBiosReader | tools/RomWriter.py | Python | mit | 215 |
import requests
from bs4 import BeautifulSoup
from Crawler.BzojCrawler.BzojConfig import BzojUser , BzojVIPUser
class BzojScanner:
s = requests.session()
scan_url = 'http://www.lydsy.com/JudgeOnline/status.php?problem_id=&user_id={}&language=-1&jresult=-1'
def Analyse(self, html):
soup = Beauti... | CKboss/VirtualJudgePY | Crawler/BzojCrawler/BzojScanner.py | Python | gpl-2.0 | 1,925 |
# coding: utf-8
from elasticsearch import Elasticsearch, helpers
import psycopg2, pprint, sys, time, os
CHUNK_SIZE = 10000
def getEnvOrExit(var):
environment = ''
try:
environment = os.environ[var]
except:
print('[Error]: Environment variable ' + var + ' not defined.')
sys.exit(1)
... | yueou/nyaa | deploy/ansible/roles/elasticsearch/files/reindex_nyaapantsu.py | Python | mit | 2,722 |
# 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 u... | dmlc/mxnet | python/mxnet/profiler.py | Python | apache-2.0 | 15,751 |
'''Arsenal Authorization class.'''
#
# Copyright 2015 CityGrid Media, 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 r... | CityGrid/arsenal | client/arsenalclient/authorization.py | Python | apache-2.0 | 6,734 |
# (C) 2014 Andrew Vaught
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. R... | andyv/sse | kw.py | Python | bsd-2-clause | 5,849 |
from luigi_bigquery.config import get_config
from luigi_bigquery.client import ResultProxy
from luigi_bigquery.job import Job
from luigi_bigquery.targets.result import ResultTarget
from luigi_bigquery.targets.bq import DatasetTarget
from luigi_bigquery.targets.bq import TableTarget
from luigi_bigquery.targets.gcs impor... | hakobera/luigi-bigquery | luigi_bigquery/task.py | Python | apache-2.0 | 7,892 |
# -*- coding: utf-8 -*-
from yafowil.base import factory
def get_example():
part = factory(u'fieldset', name='yafowilwidgetautosuggest')
part['text'] = factory('field:label:error:autosuggest', props={
'label': 'Enter some text',
'source': sorted((u'Weißburgunder', u'Welschriesling',
... | bluedynamics/yafowil.widget.autosuggest | src/yafowil/widget/autosuggest/example.py | Python | bsd-3-clause | 501 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006, TUBITAK/UEKAE
#
# 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.
#
# Plea... | hknyldz/pisitools | pisilinux/pisilinux/scenarioapi/constants.py | Python | gpl-3.0 | 2,030 |
class Outputter:
pass | DonaldWhyte/module-dependency | tests/outputters/not-subclass.py | Python | mit | 28 |
# Copyright 2015 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | ros2/launch | launch_testing/test/launch_testing/test_copyright.py | Python | apache-2.0 | 722 |
#!/usr/bin/env python
import logging
import logging.handlers
import argparse
import sys
import time # this is only being used as part of the example
import os
import env
# logger should only be imported after initlogging has been called
logger = None
def initlogging(name='docklet'):
# Deafults
global logger... | caodg/docklet | src/log.py | Python | bsd-3-clause | 2,418 |
from django import forms
class AfricasTalkingForm(forms.Form):
def __init__(self,*args,**kwargs):
super(AfricasTalkingForm,self).__init__(*args,**kwargs)
self.fields['from'] = forms.CharField()
to = forms.CharField(label='Receiving ShortCode')
text = forms.CharField(label='Message')
d... | I-TECH-UW/mwachx | transports/africas_talking/forms.py | Python | apache-2.0 | 402 |
from django.core.management.base import BaseCommand
from bibliotik.models import BibliotikFulltext, BibliotikTorrent
class Command(BaseCommand):
help = 'Clears and rebuilds the Biblitoik fulltext table.'
def handle(self, *args, **options):
print u'Deleting all fulltext entries...'
BibliotikF... | grandmasterchef/WhatManager2 | WhatManager2/management/commands/bibliotik_rebuild_fulltext.py | Python | mit | 940 |
import sys, re
import shared, js_optimizer
class AsmModule():
def __init__(self, filename):
self.filename = filename
self.js = open(filename).read()
self.start_asm = self.js.find(js_optimizer.start_asm_marker)
self.start_funcs = self.js.find(js_optimizer.start_funcs_marker)
self.end_funcs = s... | shrimpboyho/git.js | emscript/emscripten/1.5.6/tools/asm_module.py | Python | gpl-2.0 | 10,782 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import openni
import pygame
from PIL import Image
import numpy as np
POSE2USE = 'Psi'
class Kinect(object):
def __init__(self, game):
self.game = game
self.ctx = openni.Context()
self.ctx.init()
self.user = openni.UserGenerator()
... | celiacintas/kinect_stuff | skeleton/mykinect.py | Python | gpl-2.0 | 3,781 |
"""
Copyright 2016 Gregory Jensen
This file is part of PyWireDI.
PyWireDI 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.
PyWireDI is dist... | ThetaSinner/PyWireDI | tests/test_caseTransform.py | Python | gpl-3.0 | 1,155 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright 2014 Techdealer
##############BIBLIOTECAS A IMPORTAR E DEFINICOES####################
import urllib,urllib2,re,xbmcplugin,xbmcgui,sys,xbmc,xbmcaddon,xbmcvfs,socket,HTMLParser
import json
h = HTMLParser.HTMLParser()
addon_id = 'plugin.video.replaypt'
selfAddon ... | siouka/dmind | plugin.video.replaypt/docverdade.py | Python | gpl-2.0 | 8,418 |
#! /usr/bin/python
# debugmode=True
debugmode=False
from os import listdir,path,system
from popen2 import popen4
import sys
def svnCommand(cmd):
if debugmode:
print "SVN:",cmd
else:
system("svn "+cmd)
def rmEmpty(d):
if not path.isdir(d):
return False
else:
isEmpty=Tr... | Unofficial-Extend-Project-Mirror/openfoam-extend-Core-OpenFOAM-1.5-dev | bin/foamAddAndRemoveFromRelease.py | Python | gpl-2.0 | 1,974 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from erpnext.accounts.party import get_due_date
from frappe.test_runner import make_test_records
from erpnext.exceptions... | ESS-LLP/erpnext-healthcare | erpnext/selling/doctype/customer/test_customer.py | Python | gpl-3.0 | 8,333 |
# Copyright (c) 2013 Rackspace
# 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... | fabian4/trove | trove/guestagent/datastore/experimental/redis/service.py | Python | apache-2.0 | 20,833 |
# Copyright 2019 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... | davidzchen/tensorflow | tensorflow/python/keras/layers/dense_attention_test.py | Python | apache-2.0 | 34,547 |
#!/usr/bin/env python
config = {
"exes": {
# Get around the https warnings
"hg": ['/usr/local/bin/hg', "--config", "web.cacerts=/etc/pki/tls/certs/ca-bundle.crt"],
"hgtool.py": ["/usr/local/bin/hgtool.py"],
"gittool.py": ["/usr/local/bin/gittool.py"],
},
'gecko_pull_url': 'ht... | armenzg/build-mozharness | configs/b2g_bumper/master.py | Python | mpl-2.0 | 4,028 |
import random
import string
import time
import storm
class TestSpout(storm.Spout):
def nextTuple(self):
"""Emit a random letter every five seconds."""
time.sleep(5)
storm.emit([random.choice(string.ascii_letters)])
TestSpout().run()
| mattskone/storm-python-demo | multilang/resources/testspout.py | Python | mit | 268 |
#!/usr/bin/env python3.2
#
# Copyright (c) Net24 Limited, Christchurch, New Zealand 2011-2012
# and Voyager Internet Ltd, New Zealand, 2012-2013
#
# This file is part of py-magcode-core.
#
# Py-magcode-core is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gener... | onlinepcwizard/dms | dms/zone_engine.py | Python | gpl-3.0 | 74,441 |
# Copyright 2020 Tensorforce Team. 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 la... | reinforceio/tensorforce | tensorforce/core/models/tensorforce.py | Python | apache-2.0 | 147,854 |
from Conjugate import verb
from random import randrange as r
def limit(number, max = 1689):
t1 = number + max
t2 = abs(number - max)
t3 = t2 - t1
t4 = t3 / 2
t5 = abs(t4) - t4
t6 = t5 / 2
return t6
def readfile(path = "sorted verbs.txt"):
with open(path, "rb") as f:
f = f.read(... | TheGoomy42/German-Verb-Conjugation-Quiz | Question_Generator.py | Python | mit | 6,305 |
import pytest
from aioredis.errors import (
ProtocolError,
ReplyError,
AuthError,
MaxClientsError,
)
from aioredis.parser import PyReader
@pytest.fixture
def reader():
return PyReader()
def test_nothing(reader):
assert reader.gets() is False
def test_error_when_feeding_non_string(read... | ymap/aioredis | tests/pyreader_test.py | Python | mit | 6,582 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014-2017 CERN.
#
# INSPIRE 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 ... | jacquerie/inspire-next | inspirehep/modules/authors/rest/citations.py | Python | gpl-3.0 | 4,632 |
import sys
def main(filepath):
with open(filepath, 'r') as f:
for line in f.readlines():
if line:
line = line.strip()
line = line.split(';')[:-1]
distances = []
for city in line:
city = city.strip()
... | tdsymonds/codeeval | python/easy/(124) road-trip.py | Python | mit | 812 |
# 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... | zhimin711/nova | nova/tests/unit/api/openstack/compute/test_extended_status.py | Python | apache-2.0 | 4,900 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2015-2016 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | vup1120/oq-hazardlib | openquake/hazardlib/gsim/montalva_2016.py | Python | agpl-3.0 | 20,875 |
# encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from test_haystack.discovery.models import Bar, Foo
from haystack import indexes
class FooIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, model_attr='body')
def get_m... | streeter/django-haystack | test_haystack/discovery/search_indexes.py | Python | bsd-3-clause | 498 |
import json
import subprocess
import sublime
try:
from urllib.parse import urlencode
from urllib.request import urlopen
except ImportError:
from urllib import urlencode, urlopen
BASE_URL = 'https://slack.com/api/'
def api_call(method, call_args={}, loading=None, filename=None, icon=None):
if icon:
... | simion/sublime-slack-integration | api.py | Python | gpl-2.0 | 1,631 |
import jedi
import sys
from os.path import dirname, join
def test_namespace_package():
sys.path.insert(0, join(dirname(__file__), 'namespace_package/ns1'))
sys.path.insert(1, join(dirname(__file__), 'namespace_package/ns2'))
try:
# goto definition
assert jedi.Script('from pkg import ns1_fi... | alexrao/YouCompleteMe | third_party/ycmd/third_party/jedi/test/test_evaluate/test_namespace_package.py | Python | gpl-3.0 | 2,316 |
#Copyright (c) 2011, Peter Brunner (Lugoues)
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish,... | Lugoues/beets-replaygain | beetsplug/replaygain/__init__.py | Python | mit | 4,154 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011 Chris Liechti <cliechti@gmx.net>
# All Rights Reserved.
# Simplified BSD License (see LICENSE.txt for full text)
"""\
X-Protocol command class for serial devices.
The X-Protocol simple:
- line based
- line ends with '\n', '\r' shall be ignored
- m... | cetic/python-msp430-tools | examples/asm/forth_to_asm_advanced/xprotocol.py | Python | bsd-3-clause | 4,878 |
from nose.tools import assert_equal, assert_is_not_none
from nose_parameterized import parameterized
from util import query, commit
from time import time
import json
import os
USE_SCHEMA = True
for q in (
'DROP TABLE IF EXISTS obs_perftest_simple',
'''CREATE TABLE obs_perftest_simple (cartodb_id SE... | CartoDB/observatory-extension | src/python/test/perftest.py | Python | bsd-3-clause | 13,951 |
# Copyright 2014 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.
"""Generates Python source files from a mojom.Module."""
import re
from itertools import ifilter
import mojom.generate.generator as generator
import mojom.... | sgraham/nope | third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_python_generator.py | Python | bsd-3-clause | 11,084 |
# A list of directory locations that other scripts will use to determine output locations
import os.path
# Path to the root directory of the project.
# Append to this to create absolute paths for the other locations
project_root = os.path.expanduser('~/Documents/co_processors/ParCNN/')
# Output location for the .h fi... | alan4186/ParCNN | Software/Verilog_Builder/project_settings.py | Python | mit | 834 |
import copy
from datetime import datetime, timedelta
from django.contrib.contenttypes.models import ContentType
from django.db import IntegrityError
from django.db import models, transaction
from django.db.models import Q
from django.db.models.manager import Manager
from django.db.models.query import QuerySet
from dja... | finiteloopsoftware/django-bitemporal | bitemporal/models.py | Python | bsd-3-clause | 13,067 |
"""Add is_locked field to testable.
Revision ID: 344c3f86394c
Revises: 15e554bd88aa
Create Date: 2013-10-14 21:02:27.239190
"""
# revision identifiers, used by Alembic.
revision = '344c3f86394c'
down_revision = '15e554bd88aa'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto gene... | ucsb-cs/submit | submit/migrations/versions/344c3f86394c_add_is_locked_field_.py | Python | bsd-2-clause | 696 |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import MySQLdb
import sys
def time_data_clean(time_data):
rating = [0.0]*len(time_data)
time = [0]*len(time_data)
rating = [x[0] for x in time_data]
time = [x[1] for x in time_data]
return rating, time
def main():
db = MySQLd... | KeltyAllen/Amazon-Reviews-Project | app/Rating_Avg.py | Python | mit | 1,403 |
# pyOCD debugger
# Copyright (c) 2015-2019 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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... | pyocd/pyOCD | pyocd/coresight/dwt.py | Python | apache-2.0 | 9,308 |
import praw
import obot
from steamapi import getheroes, getproplayerlist, getschema, getleaguelisting
from reddit import botinfo
from reddit import workerdeletebadcomments, workerfindcomments, workerdeleterequestedcomments
import threading
from reddit.botinfo import message
#message = True
class LoginReddit:
def... | NNTin/Reply-Dota-2-Reddit | reddit/loginreddit.py | Python | mit | 2,023 |
from Tools.Profile import profile
profile("LOAD:GUISkin")
from Components.GUISkin import GUISkin
profile("LOAD:Source")
from Components.Sources.Source import Source
profile("LOAD:GUIComponent")
from Components.GUIComponent import GUIComponent
profile("LOAD:eRCInput")
from enigma import eRCInput
class Screen(dict, GUI... | devclone/enigma2-9f38fd6 | lib/python/Screens/Screen.py | Python | gpl-2.0 | 4,739 |
"""
measurement_control.py is becoming very large
this file is intended for small helpers to keep main file more clean
"""
from collections.abc import Iterable
from scipy.spatial import ConvexHull
import numpy as np
def scale_bounds(af_pars, x_scale=None):
if x_scale is not None:
for b_name in ["bounds",... | DiCarloLab-Delft/PycQED_py3 | pycqed/measurement/measurement_control_helpers.py | Python | mit | 1,347 |
# Copyright 2020 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 agreed to in writing, s... | googleapis/python-pubsublite | google/cloud/pubsublite/cloudpubsub/internal/async_publisher_impl.py | Python | apache-2.0 | 2,060 |
# Copyright 2016 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... | bozzzzo/quark | quarkc/test/generate_docs.py | Python | apache-2.0 | 1,081 |
import tensorflow as tf
from odin.bay.vi.autoencoder.variational_autoencoder import \
VariationalAutoencoder
class SequentialVAE(VariationalAutoencoder):
r"""
References:
Yingzhen Li and Stephan Mandt. "Disentangled Sequential Autoencoder".
In _International Conference on Machine Learning_, 2018.
... | imito/odin | odin/bay/vi/autoencoder/sequential_vae.py | Python | mit | 1,596 |
# Copyright (C) 2014 Coders at Work
from keyvalue import KeyValueStore
from metadata import MetaDataFile
import os
import sys
last_component_id = 0
class InvalidComponentState(Exception):
def __init__(self, name, state):
super(InvalidComponentState, self).__init__(
u'Component "%s" is in an... | hansl/habitat | habitat/base.py | Python | apache-2.0 | 3,978 |
from datetime import datetime
from uuid import uuid4
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.types import DateTime, Integer, Unicode
from tornado.options import define, options, parse_command_line
define("c... | mikethebeer/scraty | backend/src/models.py | Python | apache-2.0 | 1,998 |
"""Helper functions for any word-vector operations.
TODO: Figure out how to log ImportError when building on travis, if gensim not available
TODO: Run Latin W2V again with WordTokenizer().
TODO: Add CLTK logging to this.
"""
import logging
import os
import sys
import time
from cltk.utils.cltk_logger import logger
#... | LBenzahia/cltk | cltk/vector/word2vec.py | Python | mit | 6,542 |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... | liosha2007/temporary-groupdocs-python3-sdk | groupdocs/models/UserPasswordInfo.py | Python | apache-2.0 | 1,072 |
import time
import datetime
from flask.ext.admin._compat import text_type
from flask.ext.admin.babel import lazy_gettext
class BaseFilter(object):
"""
Base filter class.
"""
def __init__(self, name, options=None, data_type=None):
"""
Constructor.
:param name:
... | ibushong/test-repo | flask_admin/model/filters.py | Python | bsd-3-clause | 8,579 |
# Copyright 2015 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... | dhalleine/tensorflow | tensorflow/python/kernel_tests/matrix_solve_ls_op_test.py | Python | apache-2.0 | 8,547 |
# Copyright 2007-2019 Red Hat, Inc. and others.
#
# This file is part of Bodhi.
#
# 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... | Conan-Kudo/bodhi | bodhi/tests/server/test_metadata.py | Python | gpl-2.0 | 22,439 |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.db import router
from django.template.response import TemplateResponse
from django.utils.safestring import mark_safe
from ... | okfse/froide | froide/foirequest/admin.py | Python | mit | 11,487 |
from twisted.trial.unittest import TestCase
from txssmi.builder import SSMIRequest, SSMICommandException
class SSMICommandTestCase(TestCase):
def test_valid_fields(self):
LoginRequest = SSMIRequest.create('LOGIN', {})
login = LoginRequest(username='foo', password='bar')
self.assertEqual(... | praekelt/txssmi | txssmi/tests/test_commands.py | Python | bsd-3-clause | 1,544 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Created on: 01/28/15
from __future__ import print_function
__author__ = 'karas84'
import gi
gi.require_version('Unity', '7.0')
from gi.repository import Unity, GLib
import threading
import re
import subprocess
import sys
import os
import hashlib
import shutil
impor... | karas84/whatsapp-launcher | whatsapp-launcher.py | Python | gpl-2.0 | 62,338 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import json
import time
import datetime
from util import download
if __name__ == '__main__':
data = download('http://news.at.zhihu.com/api/2/news/latest', check_exists=False, upload=False)
jd = json.loads(data)
date = datetime.date(int(jd['date']... | isayme/zhihudaily_sync | sync.py | Python | mit | 932 |
#!/usr/bin/env python
import os
import sys
import simdna
import simdna.simdnautil.util as util
import simdna.synthetic as synthetic
import argparse
def do(options):
if (options.seed is not None):
import numpy as np
np.random.seed(options.seed)
from simdna import random
random.seed(... | kundajelab/simdna | scripts/densityMotifSimulation.py | Python | mit | 3,374 |
#!/usr/bin/python
"""
:copyright:
EQcorrscan developers.
:license:
GNU Lesser General Public License, Version 3
(https://www.gnu.org/copyleft/lesser.html)
"""
import importlib
import sys
import warnings
from eqcorrscan.core.match_filter.party import Party # NOQA
from eqcorrscan.core.match_filter.family ... | eqcorrscan/EQcorrscan | eqcorrscan/__init__.py | Python | gpl-3.0 | 3,103 |
import os
import time
import calculate
from github import Github
from django.conf import settings
from calaccess_raw import get_model_list
from calaccess_raw.management.commands import CalAccessCommand
from django.contrib.humanize.templatetags.humanize import intcomma
class Command(CalAccessCommand):
help = 'Crea... | dwillis/django-calaccess-raw-data | example/toolbox/management/commands/createfielddocissues.py | Python | mit | 5,833 |
# coding=utf-8
from typing import List
import networkx as nx
import pyisemail
from fuzzywuzzy import fuzz
from recordclass import recordclass
import pandas as pd
import saapy.util as su
from .lexeme import cleanup_proper_name
def connect_actors(actor_frame, connectivity_sets, connectivity_column):
"""
:para... | ashapochka/saapy | saapy/analysis/actor.py | Python | apache-2.0 | 11,608 |
# -*- coding: utf-8 -*-
import argparse
import logging
import os
import sys
import ipp_macro_series_parser.demographie.build_parameters as constructeur
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
'-d',
'--download',
action = 'store_true',
help = "... | TaxIPP-Life/til-france | til_france/scripts/population_and_dependance_builder.py | Python | gpl-3.0 | 1,858 |
#
# 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... | nathanielvarona/airflow | tests/providers/mysql/hooks/test_mysql.py | Python | apache-2.0 | 16,771 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.